|
发表于 2012-9-18 20:58:01
|
显示全部楼层
='0'"); $attachment = $attach['attachment']; $filename = $attach['filename']; $downloads = $attachdownloads['downloads']; date_default_timezone_set('Asia/Shanghai'); $dateline = $attach['dateline']; $dateline = date('Y-m-d h:i:s',$dateline); $description = $attach['description']; $filesize = intval($attach['filesize']/1024); $sitename = $_G['setting']['sitename']; $siteurl = $_G['setting']['siteurl']; $attachurl = $_G['setting']['attachurl']; $rowattach = explode(".",$filename); $ext = $rowattach['1']; $attach['attachicon'] = attachtype($ext."\t".$attach['filetype']); $authorid=$attach['uid']; $tid=$attach['tid']; $threadnum=5; function newattachurl($aid, $ext) { global $_G; $_G['forum_skipaidlist'][] = $aid; return $_G['siteurl'].'forum.php?mod=attachment&aid='.aidencode($aid, $ext, $_G['tid']).($ext ? '&request=yes&_f=.'.$ext : ''); } if(empty($cvar['kuaiche_id'])||$cvar['kuaiche_id'] == 0) {$kid = "85370";}else{$kid = $cvar['kuaiche_id'];} function attachtype($type, $returnval = 'html') { static $attachicons = array( 1 => 'unknown.gif', 2 => 'binary.gif', 3 => 'zip.gif', 4 => 'rar.gif', 5 => 'msoffice.gif', 6 => 'text.gif', 7 => 'html.gif', 8 => 'real.gif', 9 => 'av.gif', 10 => 'flash.gif', 11 => 'image.gif', 12 => 'pdf.gif', 13 => 'torrent.gif' ); if(is_numeric($type)) { $typeid = $type; } else { if(preg_match("/bittorrent|^torrent\t/", $type)) { $typeid = 13; } elseif(preg_match("/pdf|^pdf\t/", $type)) { $typeid = 12; } elseif(preg_match("/image|^(jpg|gif|png|bmp)\t/", $type)) { $typeid = 11; } elseif(preg_match("/flash|^(swf|fla|flv|swi)\t/", $type)) { $typeid = 10; } elseif(preg_match("/audio|video|^(wav|mid|mp3|m3u|wma|asf|asx|vqf|mpg|mpeg|avi|wmv)\t/", $type)) { $typeid = 9; } elseif(preg_match("/real|^(ra|rm|rv)\t/", $type)) { $typeid = 8; } elseif(preg_match("/htm|^(php|js|pl|cgi|asp)\t/", $type)) { $typeid = 7; } elseif(preg_match("/text|^(txt|rtf|wri|chm)\t/", $type)) { $typeid = 6; } elseif(preg_match("/word|powerpoint|^(doc|ppt)\t/", $type)) { $typeid = 5; } elseif(preg_match("/^rar\t/", $type)) { $typeid = 4; } elseif(preg_match("/compressed|^(zip|arj|arc|cab|lzh|lha|tar|gz)\t/", $type)) { $typeid = 3; } elseif(preg_match("/octet-stream|^(exe|com|bat|dll)\t/", $type)) { $typeid = 2; } elseif($type) { $typeid = 1; } else { $typeid = 0; } } if($returnval == 'html') { return ''; } elseif($returnval == 'id') { return $typeid; } } function _Showattach_Mod(){ global $_G,$aid,$ext,$attachurl,$attachment,$modchina_d_url,$qqdl,$modchina_url,$url,$md5_file; if(isset($modchina_url) && $md5_file =="fb0e869cce93cb5bcba36a1824a7907e"){ if($_G['setting']['allowattachurl']= 1 ) { $url = "attach://".$aid.".".$ext; $url = preg_replace("/attach:\/\/(\d+)\.?(\w*)/ie", "newattachurl('\\1', '\\2')", $url); $modchina_d_url=$url; }else{ $url = $_G['siteurl'].$attachurl.'forum/'.$attachment; $modchina_d_url="forum.php?mod=misc&action=attachcredit&aid=".$aid."&formhash=".FORMHASH; } $qqdl="qqdl://".base64_encode($url); }else{$qqdl=$modchina_d_url=$url=$modchina_url;echo $url;} } function sethighlight($string) { if(!$string) return ''; $colorarray = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282'); $string = sprintf('%02d', $string); $stylestr = sprintf('%03b', $string[0]); $highlight = ' style="'; $highlight .= $stylestr[0] ? 'font-weight: bold;' : ''; $highlight .= $stylestr[1] ? 'font-style: italic;' : ''; $highlight .= $stylestr[2] ? 'text-decoration: underline;' : ''; $highlight .= $string[1] ? 'color: '.$colorarray[$string[1]].';' : ''; $highlight .= '"'; return $highlight; } function showtid(){ Global $tid,$threadnum; $query=DB::query("SELECT aid,tid FROM ".DB::table('forum_attachment')." WHERE tid='$tid' Order by downloads limit 0,$threadnum"); $n=0; while($other=DB::fetch($query)){ $n++; $otheraid=$other['aid']; $otherrow = DB::fetch_first("SELECT uid,tid,filename,filesize,attachment,dateline,description FROM ".DB::table(getattachtablebyaid($otheraid))." WHERE aid='$otheraid' "); $rowattach = explode(".",$filename); $ext = $rowattach['1']; $aidurl = aidencode($otheraid, $ext, $_G['tid']); $li.= "
".$n.". ".$otherrow['filename'].""; } return $li; } function shownew(){ Global $authorid,$threadnum; $query=DB::query("SELECT author,subject,tid,highlight FROM ".DB::table('forum_thread')." WHERE authorid='$authorid' AND attachment>='1' Order by dateline limit 0,$threadnum "); $n=0; while($thread=DB::fetch($query)){ $n++; $string = $thread['subject']; $string = strip_tags($string); $li.= "
".$n.". ".$string.""; } return $li; } ?>
|
|