实例介绍
【实例截图】
【核心代码】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | <?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: kk_xshow hack 2010-09-20 22:00:00Z ANE $ */ if (!defined( 'IN_DISCUZ' )) { exit ( 'Access Denied' ); } class plugin_kk_xshow_forum { function index_top() { global $_G , $kk_xshow , $notshow , $onlyshow , $thread_num ; $kk_xshow = $_G [ 'cache' ][ 'plugin' ][ 'kk_xshow' ]; $attachurl = $_G [ 'setting' ][ 'attachurl' ]; $kk_xshow [ 'cache_time' ] = $kk_xshow [ 'cache_time' ] < 10 ? 10 : $kk_xshow [ 'cache_time' ]; if ( $kk_xshow [ 'is_guest' ] || $_G [ 'uid' ]) { $cacheFile = DISCUZ_ROOT. './data/sysdata/cache_kk_xshow.php' ; $kk_xkk_xshowupdate = ( $_G [ 'timestamp' ]-@ filemtime ( $cacheFile )) > $kk_xshow [ 'cache_time' ] ? 1 : 0; // $notshow = $kk_xshow [ 'not_show' ] ? 'AND f.fid not IN(' . $kk_xshow [ 'not_show' ]. ')' : '' ; //不显示的版块 all $onlyshow = $kk_xshow [ 'only_show' ] ? 'AND f.fid IN(' . $kk_xshow [ 'only_show' ]. ')' : '' ; //仅显示的版块 all $x_title = explode ( '|' , str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'set_title' ])); // all $propre = explode ( '|' , str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'propre' ])); //前缀 all $linkwindow = $kk_xshow [ 'link_window' ] == 1 ? ' target="_blank"' : '' ; //all $pic_color = $kk_xshow [ 'pic_color' ] ? str_replace ( '#' , '0x' , $kk_xshow [ 'pic_color' ]) : '0x0099ff' ; //all $authnum_color = $kk_xshow [ 'authnum_color' ] ? $kk_xshow [ 'authnum_color' ] : str_replace ( '0x' , '#' , $pic_color ); //all $author_color = $kk_xshow [ 'author_color' ] ? $kk_xshow [ 'author_color' ] : $authnum_color ; //all $user_num = $kk_xshow [ 'user_num' ] ? $kk_xshow [ 'user_num' ] : '15' ; //user $pic_on = $kk_xshow [ 'pic_on' ]; //image $userdefinecss = $kk_xshow [ 'userdefinecss' ]; //none $thread_num = $kk_xshow [ 'thread_num' ] ? $kk_xshow [ 'thread_num' ] : 10; //thread reply 4th $tab_style = $kk_xshow [ 'tab_style' ]; //all if (! $kk_xshow [ 'five_list' ]) { $pic_height = max( $user_num , $thread_num )*20 -2; //pic $thread_num = max( $user_num , $thread_num ); } else { $pic_height = $thread_num *20 - 2; } $thread_height = $thread_num *20; //thread reply 4th $row_num = 5; $td_star_row = '13%' ; ! $pic_on && $row_num --; $kk_xshow [ 'five_list' ] && $row_num --; if ( $row_num == 5) { $td_row = '21%' ; } elseif ( $row_num == 4 && $pic_on ) { $td_row = '25%' ; } elseif ( $row_num == 4 && ! $pic_on ) { $td_row = '29%' ; } elseif ( $row_num == 3) { $td_row = '33%' ; } if ( $kk_xshow [ 'five_list' ]) { $tab_num = 3; } else { $tab_num = 4; } if ( $kk_xshow [ 'pic_switch' ] && $pic_on ) { //是否自定义图片 $picpics = str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'pic_urls' ]); $piclinks = str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'pic_links' ]); $pictexts = str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'pic_titles' ]); } require_once libfile( 'function/cache' ); require_once DISCUZ_ROOT. './source/plugin/kk_xshow/xshow.func.php' ; $cache_array = array ( 5 => 'image' , 2 => 'thread' , 0 => 'reply' , 1 => '4th' , 3 => 'user' ); foreach ( $cache_array as $time => $cache ) { $cache_file = DISCUZ_ROOT. './data/sysdata/cache_kk_xshow_' . $cache . '.php' ; if (( $_G [ 'timestamp' ] - @ filemtime ( $cache_file )) > ( $kk_xshow [ 'cache_time' ] $time )) { $a = 'update_' . $cache ; $this -> $a (); } } @ include_once DISCUZ_ROOT. './data/sysdata/cache_kk_xshow_image.php' ; @ include_once DISCUZ_ROOT. './data/sysdata/cache_kk_xshow_thread.php' ; @ include_once DISCUZ_ROOT. './data/sysdata/cache_kk_xshow_reply.php' ; @ include_once DISCUZ_ROOT. './data/sysdata/cache_kk_xshow_4th.php' ; @ include_once DISCUZ_ROOT. './data/sysdata/cache_kk_xshow_user.php' ; if (@ $pic && ! $kk_xshow [ 'pic_switch' ]) { // PHP_VERSION > 4.3 ? shuffle( $pic ) : '' ; $i = 0; $comma = '' ; foreach ( $pic as $key => $val ) { if ( is_readable ( $val [ 'picpics' ]) || substr ( $val [ 'picpics' ], 0, 4) == 'http' ) { $picpics .= $comma . $val [ 'picpics' ]; $piclinks .= $comma . $val [ 'piclinks' ]; $pictexts .= $comma . $val [ 'pictexts' ]; $i ; } else { if ( $_G [ 'setting' ][ 'ftp' ][ 'on' ]) { $picpics .= $comma . $_G [ 'setting' ][ 'ftp' ][ 'attachurl' ]. str_replace ( $attachurl , '' , $val [ 'picpics' ]); $piclinks .= $comma . $val [ 'piclinks' ]; $pictexts .= $comma . $val [ 'pictexts' ]; $i ; } else { $picpics .= $comma . $val [ 'picpics' ]; $piclinks .= $comma . $val [ 'piclinks' ]; $pictexts .= $comma . $val [ 'pictexts' ]; $i ; } } $comma = '|' ; if ( $i == $kk_xshow [ 'pic_num' ]) break ; } unset( $pic ); } if ( $kk_xshow [ 'tab_style' ]) { include template( 'kk_xshow:xshow_tab' ); } else { include template( 'kk_xshow:xshow' ); } } //include_once DISCUZ_ROOT.'./data/cache/cache_kk_xshow.php'; return $return ; } function update_image() { global $_G , $kk_xshow , $notshow , $onlyshow , $thread_num ; if ( $kk_xshow [ 'pic_switch' ] && $kk_xshow [ 'pic_on' ]) { //是否自定义图片 $picpics = str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'pic_urls' ]); $piclinks = str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'pic_links' ]); $pictexts = str_replace ( array ( "\r\n" , "\n" ), '|' , $kk_xshow [ 'pic_titles' ]); } if ( $kk_xshow [ 'pic_on' ]) { if (!@ $picpics || ! $kk_xshow [ 'pic_switch' ]) { //正常状态 $datapic = array (); $fids = $kk_xshow [ 'only_pic' ] ? 'AND t.fid IN(' . $kk_xshow [ 'only_pic' ]. ')' : '' ; $PicNums = $kk_xshow [ 'pic_schnum' ]; if ( $kk_xshow [ 'pic_transfer' ] == 1) { $orderby = 'tid' ; } else if ( $kk_xshow [ 'pic_transfer' ] == 2) { $orderby = 'tid' ; } else { $orderby = 'rand' ; } $orderby = $orderby != 'rand' ? 'attach.' . $orderby : 'rand()' ; $query = DB::query( "SELECT attach.attachment,t.tid, t.fid, t.subject FROM " .DB::table( 'forum_threadimage' ). " attach INNER JOIN " .DB::table( 'forum_thread' ). " t ON t.tid=attach.tid WHERE t.isgroup=0 AND t.displayorder>=0 $fids GROUP BY attach.tid ORDER BY $orderby DESC LIMIT 0, " . $PicNums ); while ( $pic = DB::fetch( $query )) { $pics [ 'picpics' ] = $_G [ 'setting' ][ 'attachurl' ]. 'forum/' . $pic [ 'attachment' ]; $pics [ 'piclinks' ] = 'forum.php?mod=viewthread%26tid=' . $pic [ 'tid' ]; $pics [ 'pictexts' ] = str_replace ( '\'' , ' ' , $pic [ 'subject' ]); $pics [ 'attaid' ] = $pic [ 'aid' ]; $datapic [] = $pics ; } $cacheArray .= "\$pic=" .arrayeval( $datapic ). ";\n" ; unset( $query , $datapic , $pics ); } writetocache( 'kk_xshow_image' , $cacheArray ); } } function update_thread() { global $_G , $kk_xshow , $notshow , $onlyshow , $thread_num ; $thread_num = $kk_xshow [ 'thread_num' ] ? $kk_xshow [ 'thread_num' ] : 10; //thread reply 4th $sql = "SELECT t.*, f.name FROM " .DB::table( 'forum_thread' ). " t, " .DB::table( 'forum_forum' ). " f WHERE f.status<>'3' AND f.fid=t.fid $notshow $onlyshow AND t.displayorder not IN(-1,-2,-4) ORDER BY t.dateline DESC LIMIT 0, $thread_num" ; $objarray = kk_xshow_query( $sql ); $cacheArray .= "\$newPost=" .arrayeval( $objarray ). ";\n\n" ; unset( $sql , $objarray ); writetocache( 'kk_xshow_thread' , $cacheArray ); } function update_reply() { global $_G , $kk_xshow , $notshow , $onlyshow , $thread_num ; $thread_num = $kk_xshow [ 'thread_num' ] ? $kk_xshow [ 'thread_num' ] : 10; //thread reply 4th $sql = "SELECT t.*, f.name FROM " .DB::table( 'forum_thread' ). " t, " .DB::table( 'forum_forum' ). " f WHERE f.status<>'3' AND f.fid=t.fid $notshow $onlyshow AND t.displayorder not IN(-1,-2,-4) AND t.closed NOT LIKE 'moved|%' AND t.replies!=0 ORDER BY t.lastpost DESC LIMIT 0, $thread_num" ; $objarray = kk_xshow_query( $sql ); $cacheArray .= "\$newReply=" .arrayeval( $objarray ). ";\n\n" ; writetocache( 'kk_xshow_reply' , $cacheArray ); } function update_4th() { global $_G , $kk_xshow , $notshow , $onlyshow , $thread_num ; $thread_num = $kk_xshow [ 'thread_num' ] ? $kk_xshow [ 'thread_num' ] : 10; //thread reply 4th $sortway = array ( '' , 'replies' , 'views' , 'dateline' , 'lastpost' ); $hotdig = $kk_xshow [ 'hot_dig' ] == 2 ? $sortway [ $kk_xshow [ 'dig_list' ]] : $sortway [ $kk_xshow [ 'hot_list' ]]; $ctime = $kk_xshow [ 'tid_day' ] ? $_G [ 'timestamp' ] - (3600 * 24 * $kk_xshow [ 'tid_day' ]) : 0; $DigShow = $kk_xshow [ 'hot_dig' ] == 2 && $kk_xshow [ 'dig_rank' ] ? 'AND t.digest IN(' . $kk_xshow [ 'dig_rank' ]. ')' : '' ; $sql = "SELECT t.*, f.name FROM " .DB::table( 'forum_thread' ). " t, " .DB::table( 'forum_forum' ). " f WHERE f.status<>'3' AND f.fid=t.fid $notshow $onlyshow $DigShow AND t.displayorder not IN(-1,-2,-4) AND t.replies!=0 AND t.dateline>$ctime ORDER BY t.$hotdig DESC LIMIT 0, $thread_num" ; $objarray = kk_xshow_query( $sql ); $cacheArray .= "\$ObjArray=" .arrayeval( $objarray ). ";\n\n" ; unset( $sortway , $hotdig , $sql , $ctime , $DigShow , $objarray ); writetocache( 'kk_xshow_4th' , $cacheArray ); } function update_user() { global $_G , $kk_xshow , $notshow , $onlyshow , $thread_num ; $user_num = $kk_xshow [ 'user_num' ] ? $kk_xshow [ 'user_num' ] : '15' ; //user $poststar = array (); $tomonth = date ( 'n' ); $todate = date ( 'j' ); $toyear = date ( 'Y' ); if ( $kk_xshow [ 'author_date' ] == 1) { $time = mktime (0, 0, 0, $tomonth , $todate , $toyear ); } else if ( $kk_xshow [ 'author_date' ] == 2) { $time = mktime (0, 0, 0, $tomonth , $todate , $toyear ) - 604800; } else if ( $kk_xshow [ 'author_date' ] == 3) { $time = mktime (0, 0, 0, $tomonth , 1, $toyear ); } else if ( $kk_xshow [ 'author_date' ] == 4) { $time = mktime (0, 0, 0, 1, 1, $toyear ); } else { $time = 0; } if ( $kk_xshow [ 'author_date' ] != 6) { $query = DB::query( "select count(pid) as num, authorid, author from " .DB::table( 'forum_post' ). " where dateline>=$time group by authorid order by num desc limit 0, $user_num" ); } else { $query = DB::query( "SELECT uid as authorid,username as author,regdate FROM " .DB::table( 'common_member' ). " ORDER BY regdate DESC limit 0, $user_num" ); } while ( $result = DB::fetch( $query )) { $result [ 'avatar' ] = discuz_uc_avatar( $result [ 'authorid' ], 'small' ); $result [ 'autitl' ] = $result [ 'author' ]; if ( $kk_xshow [ 'author_date' ] == 6) { $result [ 'num' ] = gmdate ( 'Y-m-d' , $result [ 'regdate' ] $_G [ 'setting' ][ 'timeoffset' ] * 3600); } $poststar [] = $result ; } $cacheArray .= "\$postStar=" .arrayeval( $poststar ). ";\n" ; writetocache( 'kk_xshow_user' , $cacheArray ); } } ?> |
标签: Discuz美化
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论