Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

【Discuz! Plugin Tool 1.0】Disucz!插件安装工具,让我们告别CTRL+F!!

[复制链接]
 楼主| heyond 发表于 2006-9-30 22:57:05 | 显示全部楼层
原帖由 topbad蜗牛 于 2006-9-30 22:53 发表
其实你的想法是非常好的,但是现在摆在大家面前的是一个不完善的作品,当然新东西让人接受总有些过程,DZ在做什么改变之前要三思~


谨以此抛砖引玉,希望大家多多提出自己的看法。

我会尽力去完善它。
回复

使用道具 举报

freddy 发表于 2006-9-30 22:57:23 | 显示全部楼层
我晕..100楼的马甲都用上了.
回复

使用道具 举报

wlqc 发表于 2006-9-30 23:18:59 | 显示全部楼层
用户帐号及密码 最好直接调用 论坛本身管理员的。。并且增加上管理员判断。。

毕竟这个工具有危险性。。如果被心地不正的利用 是有一定危害的。。
望作者考虑!~
回复

使用道具 举报

fbise 发表于 2006-9-30 23:21:13 | 显示全部楼层
不错.喜欢这个工具...
回复

使用道具 举报

wlqc 发表于 2006-9-30 23:21:30 | 显示全部楼层
还有,我希望是 GBK 形式。。或者说是 GBK 级 UTF两种格式!~
回复

使用道具 举报

飞天蛙 发表于 2006-9-30 23:21:34 | 显示全部楼层
好像这个一定要安装阿,不安装不行
回复

使用道具 举报

meng12345 发表于 2006-9-30 23:23:55 | 显示全部楼层
收藏中!!!!
!!!!
谢谢楼主!!!
回复

使用道具 举报

wlqc 发表于 2006-9-30 23:24:42 | 显示全部楼层
管理员用户竟然不支持简体中文名!~~
回复

使用道具 举报

Clwarm 发表于 2006-9-30 23:25:27 | 显示全部楼层
不错的想法!!!
回复

使用道具 举报

wlqc 发表于 2006-9-30 23:34:14 | 显示全部楼层
问题来了。。
我选择安装 社区靓号

按下一步后出现

>> Discuz! Board Plugin Installation Wizard
   


string(61) "} elseif($action == 'tradelog') { $cpscript = 'tradelog';" string(13751) "query("SELECT errorcount FROM {$tablepre}adminsessions WHERE uid='$discuz_uid' AND ip='$onlineip' AND dateline+1800>'$timestamp'", 'SILENT'); if($db->error()) { $db->query("DROP TABLE IF EXISTS {$tablepre}adminsessions"); $db->query("CREATE TABLE {$tablepre}adminsessions (uid mediumint(8) UNSIGNED NOT NULL default '0', ip char(15) NOT NULL default '', dateline int(10) unsigned NOT NULL default '0', errorcount tinyint(1) NOT NULL default '0')"); $cpaccess = 1; } else { if($session = $db->fetch_array($query)) { if($session['errorcount'] == -1) { $db->query("UPDATE {$tablepre}adminsessions SET dateline='$timestamp' WHERE uid='$discuz_uid'", 'UNBUFFERED'); $cpaccess = 3; } elseif($session['errorcount'] <= 3) { $cpaccess = 1; } else { $cpaccess = 0; } } else { $db->query("DELETE FROM {$tablepre}adminsessions WHERE uid='$discuz_uid' OR dateline+1800<'$timestamp'"); $db->query("INSERT INTO {$tablepre}adminsessions (uid, ip, dateline, errorcount) VALUES ('$discuz_uid', '$onlineip', '$timestamp', '0')"); $cpaccess = 1; } } } } if($action && !in_array($action, array('main', 'header', 'menu', 'illegallog', 'ratelog', 'modslog', 'banlog', 'cplog', 'errorlog'))) { switch($cpaccess) { case 0: $extra = 'PERMISSION DENIED'; break; case 1: $extra = 'AUTHENTIFICATION(ERROR #'.intval($session['errorcount']).')'; break; case 2: $extra = 'IP ACCESS DENIED'; break; case 3: $extra = $semicolon = ''; if(is_array($_GET)) { foreach(array_merge($_GET, $_POST) as $key => $val) { if(!in_array($key, array('action', 'sid', 'formhash', 'admin_password')) && $val) { $extra .= $semicolon.$key.'='; if(is_array($val)) { $extra .= 'Array('; foreach($val as $arraykey => $arrayval) { $extra .= $arraykey.'='.cutstr($arrayval, 15).'; '; } $extra .= ')'; } else { $extra .= cutstr($val, 15); } $semicolon = '; '; } } $extra = nl2br(dhtmlspecialchars($extra)); } break; } @$fp = fopen(DISCUZ_ROOT.'./forumdata/cplog.php', 'a'); @flock($fp, 2); @fwrite($fp, "\t$timestamp\t".dhtmlspecialchars($discuz_userss)."\t$adminid\t$onlineip\t".dhtmlspecialchars($action)."\t$extra\n"); @fclose($fp); } if($cpaccess == 0) { clearcookies(); loginmsg('noaccess'); } elseif($cpaccess == 1) { if(!$admin_password || md5($admin_password) != $discuz_pw) { if($admin_password) { $db->query("UPDATE {$tablepre}adminsessions SET errorcount=errorcount+1 WHERE uid='$discuz_uid'"); } //$action = empty($action) ? 'home' : $action; loginmsg('', '', 'login'); } else { $db->query("UPDATE {$tablepre}adminsessions SET errorcount='-1' WHERE uid='$discuz_uid'"); loginmsg('login_succeed', 'admincp.php?'.$_SERVER['QUERY_STRING'].''); if(!empty($url_forward)) { echo "";exit; } } } elseif($cpaccess == 2) { loginmsg('noaccess_ip'); } if(empty($action) || isset($frames)) { parse_str($_SERVER['QUERY_STRING'], $getarray); $extra = $and = ''; foreach($getarray as $key => $value) { if($key == 'action' && in_array($value, array('header', 'menu'))) { $extra .= $and.$key.'=home'; }elseif(!in_array($key, array('sid', 'frames'))) { $extra .= $and.$key.'='.rawurlencode($value); $and = '&'; } } $extra = $extra && $action ? $extra : (!empty($runwizard) ? 'action=runwizard' : 'action=home'); ?> query("DELETE FROM {$tablepre}adminsessions WHERE uid='$discuz_uid' AND errorcount='-1'"); loginmsg('logout_succeed', 'index.php'); } else { $cpscript = ''; $isfounder = isfounder(); if($adminid == 1) { if($action == 'home') { $cpscript = 'home'; } elseif($action == 'runwizard') { $cpscript = 'runwizard'; } elseif($action == 'settings') { $cpscript = 'settings'; } elseif($action == 'xspace') { $cpscript = 'supesite'; } elseif($action == 'passport' || $action == 'siteengine' || $action == 'shopex') { $cpscript = 'passport'; } elseif($action == 'avatarshow_config' || $action == 'avatarshow_register') { $cpscript = 'avatarshow'; } elseif($action == 'qihoo_config' || $action == 'qihoo_topics') { $cpscript = 'qihoo'; } elseif($action == 'forumadd' || $action == 'forumsedit' || $action == 'forumsmerge' || $action == 'forumdetail' || $action == 'forumdelete' || $action == 'moderators' || $action == 'threadtypes' || $action=='forumcopy') { $cpscript = 'forums'; } elseif($action == 'editmember' || $action == 'memberadd' || $action == 'members' || $action == 'membersmerge' || $action == 'editgroups' || $action == 'access' || $action == 'editcredits' || $action == 'editmedals' || $action == 'memberprofile' || $action == 'profilefields' || $action == 'ipban' || $action == 'banmember') { $cpscript = 'members'; } elseif($action == 'usergroups' || $action == 'admingroups' || $action == 'ranks') { $cpscript = 'groups'; } elseif($action == 'announcements') { $cpscript = 'announcements'; } elseif($action == 'styles') { $cpscript = 'styles'; } elseif($isfounder && ($action == 'templates' || $action == 'tpladd' || $action == 'tpledit')) { $cpscript = 'templates'; } elseif($action == 'modmembers' || $action == 'modthreads' || $action == 'modreplies') { $cpscript = 'moderate'; } elseif($action == 'recyclebin') { $cpscript = 'recyclebin'; } elseif($action == 'alipay' || $action == 'orders') { $cpscript = 'ecommerce'; } elseif($action == 'forumlinks' || $action == 'onlinelist' || $action == 'medals' || $action == 'censor' || $action == 'discuzcodes' || $action == 'smilies' || $action == 'smiliesadd' || $action == 'attachtypes' || $action == 'crons' || $action == 'creditslog') { $cpscript = 'misc'; } elseif($action == 'adv' || $action == 'advadd' || $action == 'advedit') { $cpscript = 'advertisements'; } elseif($isfounder && ($action == 'export' || $action == 'import' || $action == 'runquery' || $action == 'optimize')) { $cpscript = 'database'; } elseif($action == 'attachments') { $cpscript = 'attachments'; } elseif($action == 'counter') { $cpscript = 'counter'; } elseif($action == 'sellmedals') { $cpscript = 'sellmedals'; } elseif($action == 'threads') { $cpscript = 'threads'; } elseif($action == 'pushthreads') { $cpscript = 'pushthreads'; } elseif($action == 'prune' || $action == 'pmprune') { $cpscript = 'prune'; } elseif($action == 'updatecache' || $action == 'jswizard' || $action == 'fileperms') { $cpscript = 'tools'; } elseif($action == 'plugins' || $action == 'pluginsconfig' || $action == 'pluginsedit' || $action == 'pluginhooks' || $action == 'pluginvars') { $cpscript = 'plugins'; } elseif($action == 'illegallog' || $action == 'ratelog' || $action == 'modslog' || $action == 'medalslog' || $action == 'banlog' || $action == 'cplog' || $action == 'errorlog') { $cpscript = 'logs'; } elseif($action == 'tradelog') { $cpscript = 'tradelog'; } if($radminid != $groupid) { $query = $db->query("SELECT disabledactions FROM {$tablepre}adminactions WHERE admingid='$groupid'"); $dactionarray = ($dactionarray = unserialize($db->result($query, 0))) ? $dactionarray : array(); if(in_array($action, $dactionarray)) { cpheader(); cpmsg('action_noaccess'); } } } elseif($adminid == 2 || $adminid == 3) { if($action == 'home') { $cpscript = 'home'; } elseif((($allowedituser || $allowbanuser) && ($action == 'editmember' || $action == 'banmember')) || ($allowbanip && $action == 'ipban')) { $cpscript = 'members'; } elseif($action == 'forumrules') { $cpscript = 'forums'; } elseif($allowpostannounce && $action == 'announcements') { $cpscript = 'announcements'; } elseif(($allowmoduser && $action == 'modmembers') || ($allowmodpost && ($action == 'modthreads' || $action == 'modreplies'))) { $cpscript = 'moderate'; } elseif(($allowcensorword && $action == 'censor') || $action == 'logout') { $cpscript = 'misc'; } elseif($allowmassprune && $action == 'prune') { $cpscript = 'prune'; } elseif($action == 'plugins') { $cpscript = 'plugins'; } elseif($allowviewlog && ($action == 'ratelog' || $action == 'modslog' || $action == 'banlog')) { $cpscript = 'logs'; } } if($cpscript) { require_once DISCUZ_ROOT.'./admin/'.$cpscript.'.inc.php'; } else { cpheader(); cpmsg('noaccess'); } if($action != 'menu' && $action != 'header') { cpfooter(); } } output(); function loginmsg($message, $url_forward = '', $msgtype = 'message') { extract($GLOBALS, EXTR_SKIP); $message = isset($msglang[$message]) ? $msglang[$message] : $message; if($msgtype == 'message') { $message = ' '.$message; if($url_forward) { $message .= "

$lang[message_redirect]"; $url_forward = transsid($url_forward); $message .= "


"; } else { $message .= '


'; } } else { $extra = isset($action) && empty($frames) && $action != 'logout' ? '?frames=yes&'.$_SERVER['QUERY_STRING'] : (in_array($action, array('header', 'menu', 'logout')) ? '' : '?'.$_SERVER['QUERY_STRING']); $message = '
'. ''. ''. ' '.$lang['username'].':'. ''.$discuz_user.''.$lang['menu_logout'].''. ' '. ' '.$lang['password'].':'. '  '. '  '. '
'. '  '; } ?>



     
         
         
         
Powered by Discuz!  &copy; 2001-2006 Comsenz Inc.
         
" string(243) "if(!$cachename || $cachename == 'admingroups') { $query = $db->query("SELECT * FROM {$tablepre}admingroups"); while($data = $db->fetch_array($query)) { writetocache($data['admingid'], '', getcachevars($data), 'admingroup_'); } }" string(30266) "Developed by Comsenz Inc.

Version: '.DISCUZ_KERNEL_VERSION.'
Release: '.DISCUZ_KERNEL_RELEASE); } elseif(!defined('IN_DISCUZ')) { exit('Access Denied'); } function arrayeval($array, $level = 0) { $space = ''; for($i = 0; $i <= $level; $i++) { $space .= "\t"; } $evaluate = "Array\n$space(\n"; $comma = $space; foreach($array as $key => $val) { $key = is_string($key) ? '\''.addcslashes($key, '\'\\').'\'' : $key; $val = !is_array($val) && (!preg_match("/^\-?[1-9]\d*$/", $val) || strlen($val) > 12) ? '\''.addcslashes($val, '\'\\').'\'' : $val; if(is_array($val)) { $evaluate .= "$comma$key => ".arrayeval($val, $level + 1); } else { $evaluate .= "$comma$key => $val"; } $comma = ",\n$space"; } $evaluate .= "\n$space)"; return $evaluate; } function updatecache($cachename = '') { global $db, $bbname, $tablepre, $maxbdays; $cachescript = array ( 'settings' => array('settings'), 'index' => array('announcements', 'onlinelist', 'forumlinks', 'supe_updateusers'), 'forumdisplay' => array('announcements_forum', 'globalstick', 'forums', 'icons', 'onlinelist', 'smilies_display'), 'viewthread' => array('forums', 'usergroups', 'ranks', 'bbcodes', 'smilies', 'fields_thread', 'smilies_display'), 'pm' => array('smilies_display'), 'post' => array('bbcodes_display', 'bbcodes', 'smilies_display', 'smilies', 'icons'), 'blog' => array('usergroups', 'ranks', 'bbcodes', 'smilies'), 'forums' => array('forums'), 'profilefields' => array('fields_required', 'fields_optional'), 'censor' => array('censor'), 'ipbanned' => array('ipbanned'), 'bbcodes' => array('bbcodes', 'smilies'), 'medals' => array('medals') ); if($maxbdays) { $cachescript['birthdays'] = array('birthdays'); $cachescript['index'][] = 'birthdays_index'; } foreach($cachescript as $script => $cachenames) { if(!$cachename || ($cachename && in_array($cachename, $cachenames))) { writetocache($script, $cachenames); } } if(!$cachename || $cachename == 'styles') { $stylevars = array(); $query = $db->query("SELECT * FROM {$tablepre}stylevars"); while($var = $db->fetch_array($query)) { $stylevars[$var['styleid']][$var['variable']] = $var['substitute']; } $query = $db->query("SELECT s.*, t.directory AS tpldir FROM {$tablepre}styles s LEFT JOIN {$tablepre}templates t ON s.templateid=t.templateid"); while($data = $db->fetch_array($query)) { $data = array_merge($data, $stylevars[$data['styleid']]); $data['bgcode'] = strpos($data['bgcolor'], '.') ? "background-image: url(\"$data[imgdir]/$data[bgcolor]\")" : "background-color: $data[bgcolor]"; $data['maintablebgcode'] = strpos($data['maintablecolor'], '.') ? "background=\"$data[maintablecolor]\"" : "bgcolor=\"$data[maintablecolor]\""; $data['catbgcode'] = strpos($data['catcolor'], '.') ? "background-image: url(\"$data[imgdir]/$data[catcolor]\")" : "background-color: $data[catcolor]"; $data['headerbgcode'] = strpos($data['headercolor'], '.') ? "background-image: url(\"$data[imgdir]/$data[headercolor]\")" : "background-color: $data[headercolor]"; $data['headermenubgcode'] = strpos($data['headermenu'], '.') ? "background-image: url(\"$data[imgdir]/$data[headermenu]\")" : "background-color: $data[headermenu]"; $data['boardlogo'] = image($data['boardimg'], $data['imgdir'], "alt=\"$bbname\""); $data['bold'] = $data['nobold'] ? 'normal' : 'bold'; writetocache($data['styleid'], '', getcachevars($data, 'CONST'), 'style_'); writetocsscache($data); } } if(!$cachename || $cachename == 'usergroups') { $query = $db->query("SELECT * FROM {$tablepre}usergroups u LEFT JOIN {$tablepre}admingroups a ON u.groupid=a.admingid"); while($data = $db->fetch_array($query)) { $ratearray = array(); if($data['raterange']) { foreach(explode("\n", $data['raterange']) as $rating) { $rating = explode("\t", $rating); $ratearray[$rating[0]] = array('min' => $rating[1], 'max' => $rating[2], 'mrpd' => $rating[3]); } } $data['raterange'] = $ratearray; $data['grouptitle'] = $data['color'] ? ''.$data['grouptitle'].'' : $data['grouptitle']; $data['grouptype'] = $data['type']; $data['grouppublic'] = $data['system'] != 'private'; $data['groupcreditshigher'] = $data['creditshigher']; $data['groupcreditslower'] = $data['creditslower']; unset($data['type'], $data['system'], $data['creditshigher'], $data['creditslower'], $data['color'], $data['groupavatar'], $data['admingid']); foreach($data as $key => $val) { if(!isset($data[$key])) { unset($data[$key]); } } writetocache($data['groupid'], '', getcachevars($data), 'usergroup_'); } } if(!$cachename || $cachename == 'admingroups') { $query = $db->query("SELECT * FROM {$tablepre}admingroups"); while($data = $db->fetch_array($query)) { writetocache($data['admingid'], '', getcachevars($data), 'admingroup_'); } } if(!$cachename || $cachename == 'plugins') { $query = $db->query("SELECT pluginid, available, adminid, name, identifier, datatables, directory, copyright, modules FROM {$tablepre}plugins"); while($plugin = $db->fetch_array($query)) { $data = array_merge($plugin, array('modules' => array()), array('vars' => array())); $plugin['modules'] = unserialize($plugin['modules']); if(is_array($plugin['modules'])) { foreach($plugin['modules'] as $module) { $data['modules'][$module['name']] = $module; } } $queryvars = $db->query("SELECT variable, value FROM {$tablepre}pluginvars WHERE pluginid='$plugin[pluginid]'"); while($var = $db->fetch_array($queryvars)) { $data['vars'][$var['variable']] = $var['value']; } writetocache($plugin['identifier'], '', "\$_DPLUGIN['$plugin[identifier]'] = ".arrayeval($data), 'plugin_'); } } } function updatesettings() { global $_DCACHE; if(isset($_DCACHE['settings']) && is_array($_DCACHE['settings'])) { writetocache('settings', '', '$_DCACHE[\'settings\'] = '.arrayeval($_DCACHE['settings'])); } } function writetocache($script, $cachenames, $cachedata = '', $prefix = 'cache_') { if(is_array($cachenames) && !$cachedata) { foreach($cachenames as $name) { $cachedata .= getcachearray($name); } } $dir = DISCUZ_ROOT.'./forumdata/cache/'; if(!is_dir($dir)) { @mkdir($dir, 0777); } if(@$fp = fopen("$dir$prefix$script.php", 'w')) { fwrite($fp, ""); fclose($fp); } else { dexit('Can not write to cache files, please check directory ./forumdata/ and ./forumdata/cache/ .'); } } function writetocsscache($data) { $styleid = $data['styleid']; include_once './forumdata/cache/style_'.$styleid.'.php'; $cachedir = DISCUZ_ROOT.'./forumdata/cache/'; $cssfile = template('css', $styleid, $data['tpldir']); $cssfile = !file_exists($cssfile) ? template('css', 1, './templates/default/') : $cssfile; $fp = fopen($cssfile, 'r'); $cssdata = fread($fp, filesize($cssfile)); fclose($fp); $cssdata = preg_replace("/<\?=([A-Z0-9]+)\?>/e", '\$data[strtolower(\'\1\')]', $cssdata); $cssdata = preg_replace("/<\?.+?\?>\s*/", '', $cssdata); $cssdata = str_replace("url(\"$data[imgdir]", "url(\"../../$data[imgdir]", $cssdata); $cssdata = str_replace("url($data[imgdir]", "url(../../$data[imgdir]", $cssdata); if(@$fp = fopen($cachedir.'style_'.$styleid.'.css', 'w')) { fwrite($fp, $cssdata); fclose($fp); } else { dexit('Can not write to cache files, please check directory ./forumdata/ and ./forumdata/cache/ .'); } } function getcachearray($cachename) { global $db, $timestamp, $tablepre, $timeoffset, $maxbdays; $cols = '*'; $conditions = ''; switch($cachename) { case 'settings': $table = 'settings'; $conditions = "WHERE variable NOT IN ('bbrules', 'bbrulestxt', 'maxonlines', 'welcomemsg', 'welcomemsgtxt', 'newsletter', 'creditsnotify', 'custombackup')"; break; case 'usergroups': $table = 'usergroups'; $cols = 'groupid, type, grouptitle, creditshigher, creditslower, stars, color, groupavatar, readaccess, allowavatar, allowcusbbcode, allowuseblog'; $conditions = "ORDER BY creditslower"; break; case 'ranks': $table = 'ranks'; $cols = 'ranktitle, postshigher, stars, color'; $conditions = "ORDER BY postshigher DESC"; break; case 'announcements': $table = 'announcements'; $cols = 'id, subject, redirect, starttime, endtime, message'; $conditions = "WHERE starttime<='$timestamp' AND (endtime>='$timestamp' OR endtime='0') ORDER BY displayorder, starttime DESC, id DESC"; break; case 'announcements_forum': $table = 'announcements a'; $cols = 'a.id, a.author, a.message, m.uid AS authorid, a.subject, a.redirect, a.starttime'; $conditions = "LEFT JOIN {$tablepre}members m ON m.username=a.author WHERE a.starttime<='$timestamp' ORDER BY a.displayorder, a.starttime DESC, a.id DESC LIMIT 1"; break; case 'globalstick': $table = 'forums'; $cols = 'fid, type, fup'; $conditions = "WHERE status='1' AND type IN ('forum', 'sub') ORDER BY type"; break; case 'forums': $table = 'forums f'; $cols = 'f.fid, f.type, f.name, f.fup, ff.viewperm, a.uid'; $conditions = "LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid LEFT JOIN {$tablepre}access a ON a.fid=f.fid AND a.allowview='1' WHERE f.status='1' ORDER BY f.type, f.displayorder"; break; case 'onlinelist': $table = 'onlinelist'; $conditions = "ORDER BY displayorder"; break; case 'forumlinks': $table = 'forumlinks'; $conditions = "ORDER BY displayorder"; break; case 'bbcodes': $table = 'bbcodes'; $conditions = "WHERE available='1'"; break; case 'bbcodes_display': $table = 'bbcodes'; $cols = 'tag, icon, example, explanation, params'; $conditions = "WHERE available='1' AND icon!=''"; break; case 'smilies': $table = 'smilies'; $cols = 'id, code, url'; $conditions = "WHERE type='smiley' ORDER BY LENGTH(code) DESC"; break; case 'smilies_display': $table = 'smilies'; $cols = 'id, code, url'; $conditions = "WHERE type='smiley' ORDER BY displayorder"; break; case 'icons': $table = 'smilies'; $cols = 'id, url'; $conditions = "WHERE type='icon' ORDER BY displayorder"; break; case 'fields_required': $table = 'profilefields'; $cols = 'fieldid, invisible, title, description, required, unchangeable, selective, choices'; $conditions = "WHERE available='1' AND required='1' ORDER BY displayorder"; break; case 'fields_optional': $table = 'profilefields'; $cols = 'fieldid, invisible, title, description, required, unchangeable, selective, choices'; $conditions = "WHERE available='1' AND required='0' ORDER BY displayorder"; break; case 'fields_thread': $table = 'profilefields'; $cols = 'fieldid, title, selective, choices'; $conditions = "WHERE available='1' AND invisible='0' AND showinthread='1' ORDER BY displayorder"; break; case 'ipbanned': $db->query("DELETE FROM {$tablepre}banned WHERE expiration<'$timestamp'"); $table = 'banned'; $cols = 'ip1, ip2, ip3, ip4, expiration'; break; case 'censor': $table = 'words'; $cols = 'find, replacement'; break; case 'medals': $table = 'medals'; $cols = '*'; $conditions = "WHERE available='1'"; break; case 'birthdays_index': $table = 'members'; $cols = 'uid, username, email, bday'; $conditions = "WHERE RIGHT(bday, 5)='".gmdate('m-d', $timestamp + $timeoffset * 3600)."' ORDER BY bday LIMIT $maxbdays"; break; case 'birthdays': $table = 'members'; $cols = 'uid'; $conditions = "WHERE RIGHT(bday, 5)='".gmdate('m-d', $timestamp + $timeoffset * 3600)."' ORDER BY bday"; break; } $data = array(); if($cachename != 'supe_updateusers') { $query = $db->query("SELECT $cols FROM {$tablepre}$table $conditions"); } switch($cachename) { case 'settings': $data['qihoo_links'] = array(); while($setting = $db->fetch_array($query)) { if($setting['variable'] == 'extcredits') { if(is_array($setting['value'] = unserialize($setting['value']))) { foreach($setting['value'] as $key => $value) { if($value['available']) { unset($setting['value'][$key]['available']); } else { unset($setting['value'][$key]); } } } } elseif($setting['variable'] == 'qihoo_keywords') { foreach(explode("\n", trim($setting['value'])) as $keyword) { if($keyword = trim($keyword)) { $data['qihoo_links']['keywords'][] = ''.dhtmlspecialchars(trim($keyword)).''; } } } elseif($setting['variable'] == 'qihoo_topics') { if(is_array($topics = unserialize($setting['value']))) { foreach($topics as $topic) { if($topic['topic'] = trim($topic['topic'])) { $data['qihoo_links']['topics'][] = ''.dhtmlspecialchars(trim($topic['topic'])).''; } } } } elseif($setting['variable'] == 'creditspolicy') { $setting['value'] = unserialize($setting['value']); } elseif($setting['variable'] == 'creditsformula') { $setting['value'] = preg_replace("/(digestposts|posts|pageviews|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['value']); } elseif($setting['variable'] == 'maxsmilies') { $setting['value'] = $setting['value'] <= 0 ? -1 : $setting['value']; } elseif($setting['variable'] == 'avatarshowstatus') { $setting['value'] = 0; } if(!in_array($setting['variable'], array('qihoo_keywords', 'qihoo_topics'))) { $GLOBALS[$setting['variable']] = $data[$setting['variable']] = $setting['value']; } } $data['stylejumpstatus'] = $data['stylejump']; $data['stylejump'] = array(); $query = $db->query("SELECT styleid, name FROM {$tablepre}styles WHERE available='1'"); while($style = $db->fetch_array($query)) { $data['stylejump'][$style['styleid']] = dhtmlspecialchars($style['name']); } $query = $db->query("SELECT COUNT(*) FROM {$tablepre}forums WHERE status='1' AND threadcaches>0"); $data['usethreadcaches'] = $db->result($query, 0) ? 1 : 0; $query = $db->query("SELECT COUNT(*) FROM {$tablepre}members"); $GLOBALS['totlamembers'] = $data['totalmembers'] = $db->result($query, 0); $query = $db->query("SELECT username FROM {$tablepre}members ORDER BY uid DESC LIMIT 1"); $GLOBALS['lastmember'] = $data['lastmember'] = $db->result($query, 0); $GLOBALS['version'] = $data['version'] = DISCUZ_KERNEL_VERSION; $modreasonsarray = array(); foreach(explode("\n", trim($data['modreasons'])) as $reason) { $reason = trim($reason); $modreasonarray[] = $reason ? array(dhtmlspecialchars($reason), $reason) : array('', '--------'); } $GLOBALS['modreasons'] = $data['modreasons'] = $modreasonarray; $query = $db->query("SELECT nextrun FROM {$tablepre}crons WHERE available>'0' AND nextrun>'$timestamp' ORDER BY nextrun LIMIT 1"); $data['cronnextrun'] = $db->result($query, 0); $data['advertisements'] = array(); $query = $db->query("SELECT * FROM {$tablepre}advertisements WHERE available>'0' AND starttime<='$timestamp' ORDER BY displayorder"); if($db->num_rows($query)) { while($adv = $db->fetch_array($query)) { $data['advertisements']['items'][$adv['advid']] = $adv['code']; if($adv['targets'] == '') { $data['advertisements']['types'][$adv['type']]['all'][] = $adv['advid']; } else { foreach(explode("\t", $adv['targets']) as $target) { if($target == 0) { $data['advertisements']['types'][$adv['type']]['index'][] = $adv['advid']; } else { $data['advertisements']['types'][$adv['type']]['forum_'.$target][] = $adv['advid']; } } } } $query = $db->query("SELECT starttime FROM {$tablepre}advertisements WHERE available>'0' AND starttime>'$timestamp' ORDER BY starttime LIMIT 1"); $data['advertisements']['lateststarttime'] = intval($db->result($query, 0)); $query = $db->query("SELECT endtime FROM {$tablepre}advertisements WHERE available>'0' AND endtime>'$timestamp' ORDER BY endtime LIMIT 1"); $data['advertisements']['latestendtime'] = intval($db->result($query, 0)); } $data['plugins'] = array(); $query = $db->query("SELECT available, name, identifier, directory, datatables, modules FROM {$tablepre}plugins"); while($plugin = $db->fetch_array($query)) { $plugin['modules'] = unserialize($plugin['modules']); if(is_array($plugin['modules'])) { foreach($plugin['modules'] as $module) { if($plugin['available'] && isset($module['name'])) { switch($module['type']) { case 1: $data['plugins']['links'][$plugin['identifier']][$module['name']] = array('adminid' => $module['adminid'], 'url' => "$module[menu]"); break; case 2: $data['plugins']['links'][$plugin['identifier']][$module['name']] = array('adminid' => $module['adminid'], 'url' => "$module[menu]", 'directory' => $plugin['directory']); break; case 4: $data['plugins']['include'][] = array('adminid' => $module['adminid'], 'script' => $plugin['directory'].$module['name']); break; } } } } } $data['hooks'] = array(); $query = $db->query("SELECT ph.title, ph.code, p.identifier FROM {$tablepre}plugins p LEFT JOIN {$tablepre}pluginhooks ph ON ph.pluginid=p.pluginid AND ph.available='1' WHERE p.available='1' ORDER BY p.identifier"); while($hook = $db->fetch_array($query)) { if($hook['title'] && $hook['code']) { $data['hooks'][$hook['identifier'].'_'.$hook['title']] = $hook['code']; } } break; case 'usergroups': global $userstatusby; while($group = $db->fetch_array($query)) { $groupid = $group['groupid']; $group['grouptitle'] = $group['color'] ? ''.$group['grouptitle'].'' : $group['grouptitle']; if($userstatusby == 2) { $group['byrank'] = $group['type'] == 'member' ? 1 : 0; } if($userstatusby == 0 || ($userstatusby == 2 && $group['type'] == 'member')) { unset($group['grouptitle'], $group['stars']); } if($group['type'] != 'member') { unset($group['creditshigher'], $group['creditslower']); } unset($group['groupid'], $group['color']); $data[$groupid] = $group; } break; case 'ranks': global $userstatusby; if($userstatusby == 2) { while($rank = $db->fetch_array($query)) { $rank['ranktitle'] = $rank['color'] ? ''.$rank['ranktitle'].'' : $rank['ranktitle']; unset($rank['color']); $data[] = $rank; } } break; case 'announcements': $data = array(); while($datarow = $db->fetch_array($query)) { if(empty($datarow['redirect'])) { unset($datarow['message']); } $data[] = $datarow; } break; case 'announcements_forum': if($data = $db->fetch_array($query)) { $data['authorid'] = intval($data['authorid']); $data['message'] = cutstr(strip_tags($data['message']), ($data['redirect'] ? 250 : 18)); } else { $data = array(); } break; case 'globalstick': $fuparray = $threadarray = array(); while($forum = $db->fetch_array($query)) { switch($forum['type']) { case 'forum': $fuparray[$forum['fid']] = $forum['fup']; break; case 'sub': $fuparray[$forum['fid']] = $fuparray[$forum['fup']]; break; } } $query = $db->query("SELECT tid, fid, displayorder FROM {$tablepre}threads WHERE displayorder IN (2, 3)"); while($thread = $db->fetch_array($query)) { switch($thread['displayorder']) { case 2: $threadarray[$fuparray[$thread['fid']]][] = $thread['tid']; break; case 3: $threadarray['global'][] = $thread['tid']; break; } } foreach(array_unique($fuparray) as $gid) { if(!empty($threadarray[$gid])) { $data['categories'][$gid] = array( 'tids' => implode(',', $threadarray[$gid]), 'count' => intval(@count($threadarray[$gid])) ); } } $data['global'] = array( 'tids' => empty($threadarray['global']) ? 0 : implode(',', $threadarray['global']), 'count' => intval(@count($threadarray['global'])) ); break; case 'censor': $banned = $mod = array(); $data = array('filter' => array(), 'banned' => '', 'mod' => ''); while($censor = $db->fetch_array($query)) { $censor['find'] = preg_replace("/\\\{(\d+)\\\}/", ".{0,\\1}", preg_quote($censor['find'], '/')); switch($censor['replacement']) { case '{BANNED}': $banned[] = $censor['find']; break; case '{MOD}': $mod[] = $censor['find']; break; default: $data['filter']['find'][] = '/'.$censor['find'].'/i'; $data['filter']['replace'][] = $censor['replacement']; break; } } if($banned) { $data['banned'] = '/('.implode('|', $banned).')/i'; } if($mod) { $data['mod'] = '/('.implode('|', $mod).')/i'; } break; case 'forums': while($forum = $db->fetch_array($query)) { if(!isset($forumlist[$forum['fid']])) { $forum['name'] = strip_tags($forum['name']); if($forum['uid']) { $forum['users'] = "\t$forum[uid]\t"; } unset($forum['uid']); if($forum['fup']) { $forumlist[$forum['fup']]['count']++; } $forumlist[$forum['fid']] = $forum; } elseif($forum['uid']) { if(!$forumlist[$forum['fid']]['users']) { $forumlist[$forum['fid']]['users'] = "\t"; } $forumlist[$forum['fid']]['users'] .= "$forum[uid]\t"; } } if(!empty($forumlist)) { foreach($forumlist as $fid => $forum) { if(($forum['type'] == 'group' && $forum['count']) || $forum['type'] != 'group') { $data[$fid]['fid'] = $forum['fid']; $data[$fid]['type'] = $forum['type']; $data[$fid]['name'] = $forum['name']; $data[$fid]['fup'] = $forum['fup']; $data[$fid]['viewperm'] = $forum['viewperm']; } } } break; case 'onlinelist': $data['legend'] = ''; while($list = $db->fetch_array($query)) { $data[$list['groupid']] = $list['url']; $data['legend'] .= " $list[title]       "; } break; case 'forumlinks': $tightlink_text = $tightlink_logo = ''; while($flink = $db->fetch_array($query)) { if($flink['note']) { $forumlink['content'] = "$flink[name]
$flink[note]"; if($flink['logo']) { $forumlink['type'] = 1; $forumlink['logo'] = $flink['logo']; } else { $forumlink['type'] = 2; } $data[] = $forumlink; } else { if($flink['logo']) { $tightlink_logo .= " "; } else { $tightlink_text .= "[$flink[name]] "; } } } if($tightlink_logo || $tightlink_text) { $tightlink_logo .= $tightlink_logo ? '
' : ''; $data[] = array('type' => 3, 'content' => $tightlink_logo.$tightlink_text); } break; case 'bbcodes': $regexp = array ( 1 => "/\[{bbtag}](.+?)\[\/{bbtag}\]/is", 2 => "/\[{bbtag}=(['\"]?)(.+?)(['\"]?)\](.+?)\[\/{bbtag}\]/is", 3 => "/\[{bbtag}=(['\"]?)(.+?)(['\"]?),(['\"]?)(.+?)(['\"]?)\](.+?)\[\/{bbtag}\]/is" ); while($bbcode = $db->fetch_array($query)) { $search = str_replace('{bbtag}', $bbcode['tag'], $regexp[$bbcode['params']]); $bbcode['replacement'] = preg_replace("/([\r\n])/", '', $bbcode['replacement']); switch($bbcode['params']) { case 2: $bbcode['replacement'] = str_replace('{1}', '\\2', $bbcode['replacement']); $bbcode['replacement'] = str_replace('{2}', '\\4', $bbcode['replacement']); break; case 3: $bbcode['replacement'] = str_replace('{1}', '\\2', $bbcode['replacement']); $bbcode['replacement'] = str_replace('{2}', '\\5', $bbcode['replacement']); $bbcode['replacement'] = str_replace('{3}', '\\7', $bbcode['replacement']); break; default: $bbcode['replacement'] = str_replace('{1}', '\\1', $bbcode['replacement']); break; } $replace = $bbcode['replacement']; for($i = 0; $i < $bbcode['nest']; $i++) { $data['searcharray'][] = $search; $data['replacearray'][] = $replace; } } break; case 'bbcodes_display': while($bbcode = $db->fetch_array($query)) { $tag = $bbcode['tag']; $bbcode['example'] = dhtmlspecialchars(trim($bbcode['example'])); if(!$bbcode['example']) { switch($bbcode['params']) { case 2: $bbcode['example'] = '['.$bbcode['tag'].'=][/'.$bbcode['tag'].']'; break; case 3: $bbcode['example'] = '['.$bbcode['tag'].'=,][/'.$bbcode['tag'].']'; break; default: $bbcode['example'] = '['.$bbcode['tag'].'][/'.$bbcode['tag'].']'; break; } } $bbcode['explanation'] = dhtmlspecialchars(trim($bbcode['explanation'])); unset($bbcode['tag']); $data[$tag] = $bbcode; } break; case 'smilies': $data = array('searcharray' => array(), 'replacearray' => array()); while($smiley = $db->fetch_array($query)) { $data['searcharray'][$smiley['id']] = '/'.preg_quote(dhtmlspecialchars($smiley['code']), '/').'/'; $data['replacearray'][$smiley['id']] = $smiley['url']; } break; case 'smilies_display': while($smiley = $db->fetch_array($query)) { $smiley['code'] = dhtmlspecialchars($smiley['code']); $smileyid = $smiley['id']; unset($smiley['id']); $data[$smileyid] = $smiley; } break; case 'icons': while($icon = $db->fetch_array($query)) { $data[$icon['id']] = $icon['url']; } break; case (in_array($cachename, array('fields_required', 'fields_optional', 'fields_thread'))): while($field = $db->fetch_array($query)) { $choices = array(); if($field['selective']) { foreach(explode("\n", $field['choices']) as $item) { list($index, $choice) = explode('=', $item); $choices[trim($index)] = trim($choice); } $field['choices'] = $choices; } else { unset($field['choices']); } $data[] = $field; } break; case 'ipbanned': if($db->num_rows($query)) { $data['expiration'] = 0; $data['regexp'] = $separator = ''; } while($banned = $db->fetch_array($query)) { $data['expiration'] = !$data['expiration'] || $banned['expiration'] < $data['expiration'] ? $banned['expiration'] : $data['expiration']; $data['regexp'] .= $separator. ($banned['ip1'] == '-1' ? '\\d+\\.' : $banned['ip1'].'\\.'). ($banned['ip2'] == '-1' ? '\\d+\\.' : $banned['ip2'].'\\.'). ($banned['ip3'] == '-1' ? '\\d+\\.' : $banned['ip3'].'\\.'). ($banned['ip4'] == '-1' ? '\\d+' : $banned['ip4']); $separator = '|'; } break; case 'medals': while($medal = $db->fetch_array($query)) { $data[$medal['medalid']] = array('name' => $medal['name'], 'image' => $medal['image'], 's1' => $medal['s1'],'r1' => $medal['r1'],'s2' => $medal['s2'],'r2' => $medal['r2'],'s3' => $medal['s3'],'r3' => $medal['r3'],'s4' => $medal['s4'],'r4' => $medal['r4'], 's5' => $medal['s5'],'r5' => $medal['r5'],'s6' => $medal['s6'],'r6' => $medal['r6'],'s7' => $medal['s7'],'r7' => $medal['r7'],'s8' => $medal['s8'],'r8' => $medal['r8'], 'post' => $medal['post'],'credit' => $medal['credit'],'regday' => $medal['regday'], 'thread' => $medal['thread'],'reply' => $medal['reply'],'admin' => $medal['admin'], 'online' => $medal['online'],'digest' => $medal['digest'],'pageview' => $medal['pageview'], 'use' => $medal['use'],'rest' => $medal['rest']); } break; case 'birthdays_index': $bdaymembers = array(); while($bdaymember = $db->fetch_array($query)) { $birthyear = intval($bdaymember['bday']); $bdaymembers[] = ''.$bdaymember['username'].''; } $data['todaysbdays'] = implode(', ', $bdaymembers); break; case 'birthdays': $data['uids'] = $comma = ''; $data['num'] = 0; while($bdaymember = $db->fetch_array($query)) { $data['uids'] .= $comma.$bdaymember['uid']; $comma = ','; $data['num'] ++; } break; case 'supe_updateusers': global $supe_tablepre, $supe_maxupdateusers, $supe_status; if($supe_status && $supe_maxupdateusers) { $query = $db->query("SELECT uid, username FROM {$supe_tablepre}userspaces WHERE islock=0 ORDER BY lastpost DESC LIMIT $supe_maxupdateusers"); while($datarow = $db->fetch_array($query)) { $data[$datarow['uid']] = $datarow; } } break; default: while($datarow = $db->fetch_array($query)) { $data[] = $datarow; } } return "\$_DCACHE['$cachename'] = ".arrayeval($data).";\n\n"; } function getcachevars($data, $type = 'VAR') { $evaluate = ''; foreach($data as $key => $val) { if(is_array($val)) { $evaluate .= "\$$key = ".arrayeval($val).";\n"; } else { $val = addcslashes($val, '\'\\'); $evaluate .= $type == 'VAR' ? "\$$key = '$val';\n" : "define('".strtoupper($key)."', '$val');\n"; } } return $evaluate; } ?>"
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-12-23 00:01 , Processed in 0.035189 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表