function build_cache_plugin() { $data = array(); $query = DB::query("SELECT * FROM " . DB::table('common_plugin') . " WHERE available='1'"); $pluginsetting = array(); while ($plugin = DB::fetch($query)) { $queryvars = DB::query("SELECT * FROM " . DB::table('common_pluginvar') . " WHERE pluginid='{$plugin['pluginid']}'"); while ($var = DB::fetch($queryvars)) { $data[$plugin['identifier']][$var['variable']] = $var['value']; if (in_array(substr($var['type'], 0, 6), array('group_', 'forum_'))) { $stype = substr($var['type'], 0, 5) . 's'; $type = substr($var['type'], 6); if ($type == 'select') { foreach (explode("\n", $var['extra']) as $key => $option) { $option = trim($option); if (strpos($option, '=') === FALSE) { $key = $option; } else { $item = explode('=', $option); $key = trim($item[0]); $option = trim($item[1]); } $var['select'][] = array($key, $option); } } $pluginsetting[$stype][$plugin['identifier']]['name'] = $plugin['name']; $pluginsetting[$stype][$plugin['identifier']]['setting'][$var['pluginvarid']] = array('title' => $var['title'], 'description' => $var['description'], 'type' => $type, 'select' => $var['select']); } } } writetocache('pluginsetting', getcachevars(array('pluginsetting' => $pluginsetting))); save_syscache('plugin', $data); }
function updatesettings() { global $_DCACHE; if (isset($_DCACHE['settings']) && is_array($_DCACHE['settings'])) { writetocache('settings', '', '$_DCACHE[\'settings\'] = ' . arrayeval($_DCACHE['settings']) . ";\n\n"); } }
function _creatCache(){ global $db, $tablepre; include DISCUZ_ROOT.'./include/cache.func.php'; $query = $db->query("SELECT data FROM {$tablepre}caches WHERE cachename='postawards'"); $data = $db->fetch_array($query); writetocache('postawards_setting', '', $data['data']); }
function updateLinkCache() { global $db; $query_id = $db->query("SELECT name,site,intro,type,img FROM `links` WHERE invisable = 1") or error('Unable to fetch link cache', __FILE__, __LINE__, $db->error()); while ($v = $db->fetch_array($query_id)) { $link[] = array('name' => $v['name'], 'site' => $v['site'], 'intro' => $v['intro'], 'type' => $v['type'], 'img' => 'logos/' . $v['img']); } writetocache('link.php', ROOT_PATH . 'cache', "define('LINK', true);\n" . '$linkCache = ' . var_export($link, true) . ";\n"); }
function pluginCache($cacheName,$varName,$data,$isarray){ @require_once libfile('function/cache'); if($isarray){ $cacheArray .= "\$$varName=".arrayeval($data).";\n"; writetocache($cacheName, $cacheArray); }else{ $cacheArray .= "\$$varName=".$data.";\n"; writetocache($cacheName, $cacheArray); } }
function shy9000_famehall_updateCache() { $query = DB::query("SELECT g.groupname, g.grouppic, m.uid, m.gid, m.value FROM " . DB::table('mingrentang') . " m, " . DB::table('mingrentanggroup') . " g WHERE m.gid=g.id ORDER BY m.uid"); while ($famehall = DB::fetch($query)) { $return[$famehall['uid']][] = $famehall['groupname']; $return2[$famehall['uid']][] = $famehall['gid']; $return3[$famehall['uid']][] = cutstr($famehall['value'], 40); $return4[$famehall['uid']][] = $famehall['grouppic'] ? $famehall['grouppic'] : 'def.gif'; } require_once libfile('function/cache'); writetocache('famehall_cache', getcachevars(array('_FHCACHE' => array('gname' => $return, 'gid' => $return2, 'js' => $return3, 'pic' => $return4)))); return $return; }
function UpdateAdsCache() { global $db; $query_id = $db->query("SELECT * FROM `advertising` ORDER BY id DESC"); while ($result = $db->fetch_array($query_id)) { $effectivetime = sprintf('%.2f', ($result['exptime'] - (time() - strtotime($result['addtime']))) / 86400); if ($effectivetime < 0) { continue; } $ads[] = array('' . $result['adlocation'] . '' => array('title' => $result['title'], 'url' => $result['url'], 'img' => $result['img'])); } writetocache('ads.php', ROOT_PATH . "cache", "define('ADS',true);\n" . '$adsCache = ' . var_export($ads, true) . ";\n"); }
function build_cache_plugin() { global $importtxt; $data = array(); $query = DB::query("SELECT * FROM " . DB::table('common_plugin') . " WHERE available='1'"); $pluginsetting = array(); while ($plugin = DB::fetch($query)) { $dir = substr($plugin['directory'], 0, -1); $plugin['modules'] = unserialize($plugin['modules']); if ($plugin['modules']['extra']['langexists']) { require_once libfile('function/plugin'); require_once libfile('function/admincp'); $file = DISCUZ_ROOT . './source/plugin/' . $dir . '/discuz_plugin_' . $dir . ($plugin['modules']['extra']['installtype'] ? '_' . $plugin['modules']['extra']['installtype'] : '') . '.xml'; $importtxt = @implode('', file($file)); $pluginarray = getimportdata('Discuz! Plugin', 1, 1); if ($pluginarray) { updatepluginlanguage($pluginarray); } } $queryvars = DB::query("SELECT * FROM " . DB::table('common_pluginvar') . " WHERE pluginid='{$plugin['pluginid']}'"); while ($var = DB::fetch($queryvars)) { $data[$plugin['identifier']][$var['variable']] = $var['value']; if (in_array(substr($var['type'], 0, 6), array('group_', 'forum_'))) { $stype = substr($var['type'], 0, 5) . 's'; $type = substr($var['type'], 6); if ($type == 'select') { foreach (explode("\n", $var['extra']) as $key => $option) { $option = trim($option); if (strpos($option, '=') === FALSE) { $key = $option; } else { $item = explode('=', $option); $key = trim($item[0]); $option = trim($item[1]); } $var['select'][] = array($key, $option); } } $pluginsetting[$stype][$plugin['identifier']]['name'] = $plugin['name']; $pluginsetting[$stype][$plugin['identifier']]['setting'][$var['pluginvarid']] = array('title' => $var['title'], 'description' => $var['description'], 'type' => $type, 'select' => $var['select']); } } } writetocache('pluginsetting', getcachevars(array('pluginsetting' => $pluginsetting))); save_syscache('plugin', $data); }
function build_cache_plugin_mobile() { if(!defined('DISCUZ_VERSION')) { require './source/discuz_version.php'; } global $_G; $setting = array(); $settings = array('closeforumorderby'); foreach($settings as $v) { $setting[$v] = $_G['setting'][$v]; } if(in_array('mobile', $_G['setting']['plugins']['available'])) { $extendsetting = C::t('#mobile#mobile_setting')->fetch_all(array( 'extend_used', 'extend_lastupdate' )); $array = array( 'discuzversion' => DISCUZ_VERSION, 'charset' => CHARSET, 'version' => MOBILE_PLUGIN_VERSION, 'pluginversion' => $_G['setting']['plugins']['version']['mobile'], 'oemversion' => in_array('mobileoem', $_G['setting']['plugins']['available']) ? $_G['setting']['plugins']['version']['mobileoem'] : '0', 'regname' => $_G['setting']['regname'], 'qqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0', 'sitename' => $_G['setting']['bbname'], 'mysiteid' => $_G['setting']['my_siteid'], 'ucenterurl' => $_G['setting']['ucenterurl'], 'setting' => $setting, 'extends' => array('used' => $extendsetting['extend_used'], 'lastupdate' => $extendsetting['extend_lastupdate']), ); } else { $array = array(); } require_once './source/plugin/mobile/mobile.class.php'; $data = array('mobilecheck' => mobile_core::json($array)); writetocache('mobile', getcachevars($data)); }
function categories_recache() { global $DMC, $DBPrefix, $settingInfo, $strCategory, $arrSideModule, $strAllCategory, $strPrivateLog; //get sum category $sum_sql = "select sum(cateCount) as sum_total from " . $DBPrefix . "categories where parent='0' and isHidden='0'"; $sum_result = $DMC->query($sum_sql); if ($arr_result = $DMC->fetchArray($sum_result)) { $sum_total = ($arr_result['sum_total'] == "" or $arr_result['sum_total'] == 0) ? 0 : $arr_result['sum_total']; } else { $sum_total = 0; } //隐私日志 $arr_private = $DMC->fetchArray($DMC->query("select count(id) as private_count from " . $DBPrefix . "logs where saveType=3")); $private_count = $arr_private['private_count']; //get main category $query_sql = "select id,name,cateTitle,outLinkUrl,cateCount,cateIcons from " . $DBPrefix . "categories where parent='0' and isHidden='0' order by orderNo"; $query_result = $DMC->query($query_sql); $arr_parent = $DMC->fetchQueryAll($query_result); for ($i = 0; $i < count($arr_parent); $i++) { //get sub category $sub_sql = "select id,name,cateTitle,outLinkUrl,cateCount,cateIcons from " . $DBPrefix . "categories where parent='" . $arr_parent[$i]['id'] . "' and isHidden='0' order by orderNo"; $sub_result = $DMC->query($sub_sql); $arr_sub[$i] = $DMC->fetchQueryAll($sub_result); } ob_start(); if (strpos($settingInfo['categoryImgPath'], "tree") > 0) { include F2BLOG_ROOT . "./include/treemenu.inc.php"; } else { include F2BLOG_ROOT . "./include/ulmenu.inc.php"; } $out_contents = create_sidebar_header("Category", $strCategory, $arrSideModule["category"]["isInstall"]); $out_contents .= ob_get_contents(); $out_contents .= create_sidebar_footer(); ob_end_clean(); writetocache('category', $out_contents, "html"); }
function update_data($echo, $DMC) { global $DBPrefix, $update_time, $update_logs; $delete_setting = true; //更新附件的文件类别 2009-05-12 $modify_sql[] = "ALTER TABLE `{$DBPrefix}attachments` ADD INDEX `name` (`name`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}guestbook` ADD COLUMN `HTTP_REFERER` text NULL DEFAULT NULL AFTER `parent`"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}links` ADD INDEX `isApp` (`isApp`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD COLUMN `isTopNews` tinyint(1) NOT NULL DEFAULT 0 AFTER `isTop`"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD INDEX `postTime` (`postTime`,`saveType`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD INDEX `isComment` (`isComment`,`isTrackback`,`isTop`,`isTopNews`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}members` ADD INDEX `password` (`password`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}members` ADD INDEX `role` (`role`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}setting` ADD INDEX `settName` (`settName`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}trackbacks` ADD INDEX `isApp` (`isApp`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD `autoSplit` int(8) NOT NULL default '0'"; // 強化驗證 $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '=http')"; $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '[url=')"; $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '[href=')"; //运行SQL语句 foreach ($modify_sql as $key => $value) { $DMC->query($value, "T"); if ($echo) { if ($DMC->error()) { echo $value . " ... <font color=red>" . $DMC->error() . "</font><br />"; } else { echo $value . " ... <font color=blue>OK</font><br />"; } } } $i = 0; $contents = "\$update_logs = array(\r\n"; $contents .= "\t'{$i}' => '{$update_time}',\r\n"; for ($i = 0; $i < count($update_logs); $i++) { $j = $i + 1; $contents .= "\t'{$j}' => '" . $update_logs[$i] . "',\r\n"; } $contents .= ");"; writetocache('update_logs', $contents); //清空缓存 if ($delete_setting == true) { //0909升级需要重新建立setting文件。 if (!@unlink(F2BLOG_ROOT . "./cache/cache_setting.php")) { echo "<script language=Javascript> \n"; echo "alert('Please update cache!');\n"; echo "</script>\n"; } } else { //更新缓存 settings_recache(); links_recache(); } return false; }
$Id: feed.php 20442 2009-09-28 01:17:13Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } @include_once DISCUZ_ROOT.'./forumdata/cache/cache_manyou.php'; if(!isset($myapps)) { $query = $db->query("SELECT * FROM {$tablepre}myapp WHERE flag='1' ORDER BY displayorder"); while($application = $db->fetch_array($query)) { $myapps[$application['appid']] = $application; } require_once DISCUZ_ROOT.'./include/cache.func.php'; writetocache('manyou', '', getcachevars(array('myapps' => $myapps))); } require_once DISCUZ_ROOT.'./uc_client/client.php'; $invitenum = $db->result_first("SELECT count(*) FROM {$tablepre}myinvite WHERE touid='$discuz_uid'"); $noticenum = $db->result_first("SELECT count(*) FROM {$tablepre}mynotice WHERE uid='$discuz_uid' AND new='1'"); $feeds = array(); $my_feedpp = $my_feedpp > 50 ? $my_feedpp : 50; $view = !empty($view) && in_array($view, array('me', 'all', 'friend')) ? $view : 'friend'; if(!$discuz_uid) { $view = 'all'; } $conf = array( 'type' => 'manyou', 'num' => $my_feedpp,
*/ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(!$tid){ showmessage("dps_postawards:wrong_request"); } if(!@include_once DISCUZ_ROOT.'./forumdata/cache/cache_postawards_setting.php'){ require_once DISCUZ_ROOT.'./include/cache.func.php'; $query = $db->query("SELECT data FROM {$tablepre}caches WHERE cachename='postawards'"); $data = $db->fetch_array($query); writetocache('postawards_setting', '', $data['data']); } $allow = $PACACHE['userright'][$groupid]; if(!$allow['postawards'] || !$adminid){ showmessage('group_nopermission', NULL, 'NOPERM'); } if(!$allow['systemcredit']){ $selfcreditmode = TRUE; } if(!$allow['ratemode']){ $ratemode = FALSE; }
$adminextend = $adminextendnew = array(); if (file_exists($adminextendfile = DISCUZ_ROOT . './data/sysdata/cache_adminextend.php')) { @(include $adminextendfile); } $menudirhandle = dir($menudir); while ($entry = $menudirhandle->read()) { if (!in_array($entry, array('.', '..')) && preg_match("/^menu\\_([\\w\\.]+)\$/", $entry, $entryr) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($menudir . '/' . $entry)) { @(include_once $menudir . '/' . $entry); $adminextendnew[] = $entryr[1]; } } if ($adminextend != $adminextendnew) { @unlink($adminextendfile); if ($adminextendnew) { require_once libfile('function/cache'); writetocache('adminextend', getcachevars(array('adminextend' => $adminextendnew))); } unset($_G['lang']['admincp']); } } if ($isfounder) { $menu['plugin'] = array(array('menu_addons', 'cloudaddons'), array('menu_plugins', 'plugins')); } loadcache('adminmenu'); if (is_array($_G['cache']['adminmenu'])) { foreach ($_G['cache']['adminmenu'] as $row) { $menu['plugin'][] = array($row['name'], $row['action']); } } if (!$menu['plugin']) { unset($topmenu['plugin']);
$data = array(); $query = $db->query("SELECT attach.aid, attach.attachment, t.tid, t.fid, t.subject FROM {$tablepre}attachments attach LEFT JOIN {$tablepre}threads t ON t.displayorder>=0 AND t.tid=attach.tid WHERE attach.readperm='0' AND displayorder>='0' AND filetype='image/pjpeg' {$fids} GROUP BY attach.tid ORDER BY {$orderby} DESC LIMIT {$searchnums}"); while ($pic = $db->fetch_array($query)) { $data['pic'][$pic[aid]]['showpicpics'] = $attachurl . '/' . $pic['attachment']; $data['pic'][$pic[aid]]['showpiclinks'] = "viewthread.php?tid={$pic['tid']}"; $data['pic'][$pic[aid]]['showpictexts'] = str_replace('\'', ' ', $pic['subject']); } $data['expiration'] = $cachelife + time(); $data['cacheshownums'] = $shownums; $data['cachesearchnums'] = $searchnums; $data['cachecachelife'] = $cachelife; $data['cacheorderby'] = $orderby; $data['cachecachename'] = $cachename; $data['cachesearchfid'] = $searchfid; require_once DISCUZ_ROOT . './include/cache.func.php'; writetocache($cachename, '', getcachevars($data)); include DISCUZ_ROOT . './forumdata/cache/cache_' . $cachename . '.php'; //} shuffle($pic); $i = 0; $j = 0; while ($j < $shownums && isset($pic[$i])) { if (is_readable($pic[$i]['showpicpics'])) { $showpicpics .= $comma . $pic[$i]['showpicpics']; $showpiclinks .= $comma . $pic[$i]['showpiclinks']; $showpictexts .= $comma . $pic[$i]['showpictexts']; $comma = '|'; $j++; } $i++; }
function autosave_recache($title = '', $description = '', $content = '') { global $sax_uid, $timestamp; $title = sax_addslashes($title); $description = sax_addslashes($description); $content = sax_addslashes($content); $autosavedb = array(); @(include_once SABLOG_ROOT . 'data/cache/cache_autosave.php'); $autosavedb[$sax_uid] = array('timestamp' => $timestamp, 'title' => $title, 'description' => $description, 'content' => $content); $contents = "\$autosavedb = unserialize('" . addcslashes(serialize($autosavedb), '\\\'') . "');"; writetocache('autosave', $contents); }
$cache_visits_today = $cache_visits_today + 1; $DMC->query("UPDATE " . $DBPrefix . "dailystatistics SET visits = visits+1 where visitDate='{$curDate}'"); } $cache_visits_total++; $online_count = $online_count + 1; } $onlineIP .= ")"; $onlineTM .= ")"; $onlines .= $onlineIP . ",\n" . $onlineTM . ",\n);\r\n\r\n"; //昨天\今天\总数 $onlines .= "\$cache_visits_yesterday = {$cache_visits_yesterday};\r\n\r\n"; $onlines .= "\$cache_visits_today = {$cache_visits_today};\r\n\r\n"; $onlines .= "\$cache_visits_total = {$cache_visits_total};\r\n\r\n"; if ($onlineCheck == "" || $offline_count > 0) { include_once F2BLOG_ROOT . "./include/cache.php"; writetocache('online', $onlines); } } //读取flash skin if (!empty($getDefaultSkinInfo['UseFlash'])) { if (file_exists(F2BLOG_ROOT . "skins/{$blogSkins}/" . $getDefaultSkinInfo['FlashPath'])) { echo "<div id=\"FlashHead\" style=\"text-align:" . $getDefaultSkinInfo['FlashAlign'] . ";top:" . $getDefaultSkinInfo['FlashTop'] . "px;\"></div> \n"; if ($getDefaultSkinInfo['FlashTransparent'] != "0") { echo "<script type=\"text/javascript\">WriteHeadFlash('skins/{$blogSkins}/" . $getDefaultSkinInfo['FlashPath'] . "','" . $getDefaultSkinInfo['FlashWidth'] . "','" . $getDefaultSkinInfo['FlashHeight'] . "',true)</script> \n"; } else { echo "<script type=\"text/javascript\">WriteHeadFlash('skins/{$blogSkins}/" . $getDefaultSkinInfo['FlashPath'] . "','" . $getDefaultSkinInfo['FlashWidth'] . "','" . $getDefaultSkinInfo['FlashHeight'] . "',false)</script> \n"; } } } ?> <div id="container">
This is NOT a freeware, use is subject to license terms $Id: admin.inc.php 21306 2009-11-26 00:56:50Z monkey $ */ if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) { exit('Access Denied'); } $palang = $GLOBALS['scriptlang']['dps_postawards']; @include_once DISCUZ_ROOT.'./forumdata/cache/cache_usergroups.php'; if(submitcheck('submit')){ require_once DISCUZ_ROOT.'./include/cache.func.php'; writetocache('postawards_setting', '', getcachevars(array('PACACHE' => array('userright' => $userright)))); $cache = serialize($userright); $cachedata = "\$PACACHE['userright'] = ".arrayeval($userright).";\n\n"; $db->query("REPLACE INTO {$tablepre}caches (cachename, type, dateline, data) VALUES ('postawards', '1', '$timestamp', '".addslashes($cachedata)."')"); } @include_once DISCUZ_ROOT.'./forumdata/cache/cache_postawards_setting.php'; if(is_array($PACACHE)) { foreach($PACACHE['userright'] as $key => $item) { $postawards_checked[$key] = $item['postawards'] ? ' checked' : ''; $systemcredit_checked[$key] = $item['systemcredit'] ? ' checked' : ''; $ratemode_checked[$key] = $item['ratemode'] ? ' checked' : ''; $ratelowlimit[$key] = $item['ratelowlimit']; $ratehighlimit[$key] = $item['ratehighlimit']; $ratealllimit[$key] = $item['ratealllimit'];
$pageinfo .= '<a href="' . rewrite_list($_GET['type'], $page + 1) . '" class="nextpage">' . lang('plugin/dzapp_haodai', 'page_3') . '</a><a href="' . rewrite_list($_GET['type'], $maxpage) . '" class="nextpage">' . lang('plugin/dzapp_haodai', 'page_4') . '</a>'; } } if (empty($result['items'])) { showmessage('dzapp_haodai:param_wrong'); } $articles = $result['items']; include template('dzapp_haodai:list'); } elseif ($action == 'calc') { $type = $_GET['type']; if (!in_array($type, array('chedai', 'debj', 'debx', 'esjys', 'fd', 'gjj', 'secondhand', 'zhdk'))) { showmessage('dzapp_haodai:param_wrong'); } if (!@(include_once DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_dkgl_' . $city . '.php' || TIMESTAMP - filemtime(DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_dkgl_' . $city . '.php') > $var['refreshtime'])) { $dkgl_article = get_article_dkgl_list(); writetocache('dzapp_haodai_dkgl_' . $city, getcachevars(array('dkgl_article' => $dkgl_article))); } $seodata = array('bbname' => $_G['setting']['bbname'], 'calc_type' => lang('plugin/dzapp_haodai', 'calc_' . $type)); list($navtitle, $metadescription, $metakeywords) = get_seosetting('', $seodata, $dzapp_haodai_seo['calc']); if (defined('IN_MOBILE') && $type == 'fd') { $script_more = ' var $btnss = $(\'.btn-b\'); var $tables = $btnss.siblings(\'.int_table\'); $btnss.click( function() { if ($tables.hasClass(\'hide-table\')) { $tables.removeClass(\'hide-table\'); $(this).html(\'' . lang('plugin/dzapp_haodai', 'hide-table') . '\'); } else { $tables.addClass(\'hide-table\');
function recentGbooks_recache() { global $DMC, $DMF, $DBPrefix, $strGuestBookHidden; if ($DMC == "") { $DMC = $DMF; } $i = 0; $result = $DMC->query("select * from " . $DBPrefix . "guestbook order by postTime desc Limit 0,10"); $contents = "\$recentgbookscache = array(\r\n"; while ($my = $DMC->fetchArray($result)) { $content = str_replace("<br />", "", subString($my['content'], 0, 100)); if ($my['isSecret']) { $content = $strGuestBookHidden; } $contents .= "\t'" . $i . "' => array(\n\t\t'id' => '" . $my['id'] . "',\n\t\t'content' => '" . $content . "',\n\t\t'author' => '" . $my['author'] . "',\n\t\t'postTime' => '" . $my['postTime'] . "',\n\t\t),\n"; $i++; } $contents .= ");"; writetocache('recentGbooks', $contents); }
if (isset($_GET['del'])) { $del['area_id'] = intval($_GET['del']); DB::delete('info_area', $del); } if (isset($_GET['edit'])) { $edit = intval($_GET['edit']); $edit_array = array(); $edit_array = fetch_all('info_area', ' WHERE area_id=' . $edit . ' ORDER BY area_pid DESC,area_sort ASC', '*', 0); } if (isset($_GET['edit_submit'])) { $edit_array = array(); $edit_array = gpc('area_'); DB::update('info_area', $edit_array, array('area_id' => $edit_array['area_id'])); } $area_array = array(); $area_array = fetch_all('info_area', ' ORDER BY area_pid ASC,area_sort ASC', '*', '1', 'area_id'); foreach ($area_array as $k => $v) { if ($v['area_pid'] == '0') { $sum = fetch_all('info_area', " WHERE area_pid='{$v['area_id']}' ", ' count(area_id) as sum ', 0); $area_array[$k] = array_merge($area_array[$k], $sum); } } if (!cloudaddons_getmd5("info.plugin")) { cpmsg(lang('admincp_msg', 'cloudaddons_genuine_message'), '', 'error', array('addonid' => "info.plugin")); } $area_array_field .= "\$area_array = " . arrayeval($area_array) . ";\n"; writetocache('info_area_array', $area_array_field); $pid_area_array = array(); $pid_area_array = fetch_all("info_area", " WHERE area_id='{$area_pid}' ", "*", 0); $style = 'default'; include template("info:admin/admin_area");
function smart_cache() { global $_G; $smart = $_G['cache']['plugin']['smart_video']; $hot = C::t("#smart_video#video")->fetch_all_by_where('smart_video_thread', 'visiable=1', 'play desc,dateline desc', 0, 10); $boke = C::t("#smart_video#video")->fetch_all_by_where('smart_video_user', 'threads<>0', 'threads desc', 0, 8); if (empty($smart['recom'])) { $new = C::t("#smart_video#video")->fetch_all_by_where('smart_video_thread', 'visiable=1', 'dateline desc', 0, 6); } else { $n_tids = explode("|", $smart['recom']); $new = C::t("#smart_video#video")->fetch_all_by_array('smart_video_thread', 'tid', $n_tids); } $fclass = C::t("#smart_video#video")->fetch_all("type=1"); $enew = array(); foreach ($fclass as $k => $v) { $enew[] = C::t("#smart_video#video")->fetch_all_by_where('smart_video_thread', 'fcid=' . intval($fclass[$k]['cid']) . " and visiable=1", 'dateline desc', 0, 9); if ($k == 8) { break; } } $smart_video = array('new' => $new, 'hot' => $hot, 'fclass' => $fclass, 'enew' => $enew, 'boke' => $boke, 'time' => time()); require_once libfile("function/cache"); writetocache('smart_video', getcachevars(array('smart_video' => $smart_video))); return $smart_video; }
function refreshApplication($appId, $appName, $version, $displayMethod, $narrow, $flag, $displayOrder) { $fields = array(); if($appName !== null && strlen($appName)>1) { $fields['appname'] = $appName; } if($version !== null) { $fields['version'] = $version; } if($displayMethod !== null) { // todo: remove $fields['displaymethod'] = $displayMethod; } if($narrow !== null) { $fields['narrow'] = $narrow; } if($flag !== null) { $fields['flag'] = $flag; } if($displayOrder !== null) { $fields['displayorder'] = $displayOrder; } $sql = sprintf('SELECT * FROM %s WHERE appid=\'%d\'', $GLOBALS['tablepre'].'myapp', $appId); $query = $GLOBALS['db']->query($sql); if($application = $GLOBALS['db']->fetch_array($query)) { $where = sprintf('appid = %d', $appId); updatetable('myapp', $fields, $where); } else { $fields['appid'] = $appId; $result = inserttable('myapp', $fields, 1); } $myapps = array(); $sql = sprintf('SELECT * FROM %s WHERE flag=\'1\' ORDER BY displayorder', $GLOBALS['tablepre'].'myapp'); $query = $GLOBALS['db']->query($sql); while($application = $GLOBALS['db']->fetch_array($query)) { $myapps[$application['appid']] = $application; } require_once DISCUZ_ROOT.'./include/cache.func.php'; writetocache('manyou', '', getcachevars(array('myapps' => $myapps))); }
function update_data($echo, $DMC) { global $DBPrefix, $update_time, $update_logs; $modify_sql = array(); if ($DMC->getServerInfo() > '4.1') { $default_charset = " DEFAULT CHARACTER SET utf8"; } else { $default_charset = ""; } //从f2blog v1.0 build 0909升级 $delete_setting = false; if ($arr_query = $DMC->query("SELECT * FROM " . $DBPrefix . "setting where id='1'", 'T')) { $setInfo = $DMC->fetchArray($arr_query, MYSQL_ASSOC); if ($setInfo['language'] == "zh_cn") { $strGholidayDefault = "{0101,元旦}{0214,情人节}{0308,妇女节}{0401,愚人节}{0501,劳动节}{0512,F2BLOG成立日}{1001,国庆日}{1224,平安夜}{1225,圣诞节}{1226,圣诞节翌日}"; $strNholidayDefault = "{0101,年初一春节}{0102,年初二}{0103,年初三}{0104,年初四}{0105,年初五开市}{0115,元宵节}{0505,端午节}{0701,开鬼门}{0707,七夕情人节}{0815,中秋节}{0909,重阳节}"; } else { if ($setInfo['language'] == "zh_tw") { $strNholidayDefault = "{0101,年初一春節}{0102,年初二}{0103,年初三}{0104,年初四}{0105,年初五開市}{0115,元宵節}{0505,端午節}{0701,開鬼門}{0707,七夕情人節}{0815,中秋節}{0816,中秋節翌日}{0909,重陽節}"; $strGholidayDefault = "{0101,元旦}{0214,情人節}{0308,婦女節}{0401,愚人節}{0501,勞動節}{0512,F2BLOG成立日}{1224,平安夜}{1225,聖誕節}{1226,聖誕節翌日}"; } else { $strNholidayDefault = "{0101,Lunar New Year's Day}{0102,The second day of the Lunar New Year}{0103,The third day of the Lunar New Year}{0104,The forth day of the Lunar New Year}{0105,The fifth day of the Lunar New Year}{0115,Lantern Festival}{0505,Tuen Ng Festival}{0701,Ghost Gate Open Day}{0707,Chinese Valentine's Day}{0815,Chinese Mid-Autumn Festival}{0816,The day following Chinese Mid-Autumn Festival}{0909,Chung Yeung Festival}"; $strGholidayDefault = "{0101,New Year's Day}{0214,Valentine's Day}{0308,Women's Day}{0401,Fool's Day}{0501,Labour Day}{0512,F2BLOG Foundation Day}{1224,Christmas Eve}{1225,Christmas Day}{1226,The day following Christams Day}"; } } //默认值 if (file_exists(F2BLOG_ROOT . "./admin/admin_config.php")) { include F2BLOG_ROOT . "./admin/admin_config.php"; } else { $cfg_page_size = "15"; $cfg_upload_file = "gif,jpg,rar,zip,doc,xls,pdf,ico,png,swf,wma,wav,mp3,wmv"; $cfg_upload_size = 1024000; //以byte单位等于1M 1024000 $cfg_mouseover_color = "#FFFFCC"; $content_width = 500; $backup_size = 1024; // 以KB为单位 $editor_plugins = "f2blog,f2music,flash"; $editor_button1 = 'bold,italic,underline,separator,justifyleft,justifycenter,justifyright,separator,fontselect,fontsizeselect,forecolor,backcolor,separator,hr,link,unlink,flash,f2_music,separator,f2_hide,f2_more,f2_page,separator,code'; $editor_button2 = ''; $editor_button3 = ''; } $editor_button1 = str_replace(',justifyleft,justifycenter', ',pastetext,pasteword,separator,justifyleft,justifycenter,justifyright', $editor_button1); $editor_plugins = "paste," . $editor_plugins; $arr_setting[] = "('about','','0');"; $arr_setting[] = "('adminPageSize','" . $cfg_page_size . "','0');"; $arr_setting[] = "('adminPerPage','25','0');"; $arr_setting[] = "('ajaxstatus','','0');"; $arr_setting[] = "('archivesmonth','5','0');"; $arr_setting[] = "('attachDir','1','0');"; $arr_setting[] = "('attachType','" . $cfg_upload_file . "','0');"; $arr_setting[] = "('autoSave','0','0');"; $arr_setting[] = "('autoSplit','0','0');"; $arr_setting[] = "('backupSize','" . ceil($cfg_upload_size / 1000) . "','0');"; $arr_setting[] = "('blogKeyword','','0');"; $arr_setting[] = "('blogTitle','Free & Freedom Blog','0');"; $arr_setting[] = "('blogUrl','http://localhost','0');"; $arr_setting[] = "('categoryImgPath','images/tree/folder_gray','0');"; $arr_setting[] = "('closeReason','Close Blogs!','0');"; $arr_setting[] = "('commentOrder','asc','0');"; $arr_setting[] = "('commLength','800','0');"; $arr_setting[] = "('commPage','10','0');"; $arr_setting[] = "('commTimerout','30','0');"; $arr_setting[] = "('defaultedits','tiny','0');"; $arr_setting[] = "('defaultSkin','default','1');"; $arr_setting[] = "('disType','0','0');"; $arr_setting[] = "('downcode','0','0');"; $arr_setting[] = "('editPluginButton1','" . $editor_button1 . "','0');"; $arr_setting[] = "('editPluginButton2','" . $editor_button2 . "','0');"; $arr_setting[] = "('editPluginButton3','" . $editor_button3 . "','0');"; $arr_setting[] = "('editPluginName','" . $editor_plugins . "','0');"; $arr_setting[] = "('email','*****@*****.**','0');"; $arr_setting[] = "('favicon','','0');"; $arr_setting[] = "('gbookOrder','desc','0');"; $arr_setting[] = "('gbookPage','10','0');"; $arr_setting[] = "('gcalendar','" . $strGholidayDefault . "','0');"; $arr_setting[] = "('genThumb','0','0');"; $arr_setting[] = "('gzipstatus','0','0');"; $arr_setting[] = "('headcode','','0');"; $arr_setting[] = "('img_width','400','0');"; $arr_setting[] = "('isHtmlPage','0','0');"; $arr_setting[] = "('isLinkTagLog','1','0');"; $arr_setting[] = "('isProgramRun','1','0');"; $arr_setting[] = "('isRegister','1','0');"; $arr_setting[] = "('isTbApp','0','0');"; $arr_setting[] = "('isValidateCode','0','0');"; $arr_setting[] = "('language','zh_cn','0');"; $arr_setting[] = "('linkTagLog','10','0');"; $arr_setting[] = "('loginvalid','0','0');"; $arr_setting[] = "('logo','','0');"; $arr_setting[] = "('logscomment','10','0');"; $arr_setting[] = "('logsgbook','10','0');"; $arr_setting[] = "('logspage','18','0');"; $arr_setting[] = "('master','{$admin}','0');"; $arr_setting[] = "('mouseovercolor','#FFFFCC','0');"; $arr_setting[] = "('name','My F2Blog','0');"; $arr_setting[] = "('ncalendar','" . $strNholidayDefault . "','0');"; $arr_setting[] = "('newRss','10','0');"; $arr_setting[] = "('onlineTime','3600','0');"; $arr_setting[] = "('pagebar','A','0');"; $arr_setting[] = "('perPageList','20','0');"; $arr_setting[] = "('perPageNormal','8','0');"; $arr_setting[] = "('readpagebar','1','0');"; $arr_setting[] = "('registerClose','Close Register!','0');"; $arr_setting[] = "('rewrite','0','0');"; $arr_setting[] = "('rssContentType','1','0');"; $arr_setting[] = "('rssLength','500','0');"; $arr_setting[] = "('setattachments','0','1');"; $arr_setting[] = "('setcategories','0','1');"; $arr_setting[] = "('setcomments','" . $setInfo['commNums'] . "','1');"; $arr_setting[] = "('setguestbook','" . $setInfo['messageNums'] . "','1');"; $arr_setting[] = "('setlogs','" . $setInfo['logNums'] . "','1');"; $arr_setting[] = "('setmembers','" . $setInfo['memberNums'] . "','1');"; $arr_setting[] = "('settags','" . $setInfo['tagNums'] . "','1');"; $arr_setting[] = "('settrackbacks','" . $setInfo['tbNums'] . "','1');"; $arr_setting[] = "('showattach','0','0');"; $arr_setting[] = "('showcalendar','1','0');"; $arr_setting[] = "('showcate','0','0');"; $arr_setting[] = "('showcomment','0','0');"; $arr_setting[] = "('showguest','0','0');"; $arr_setting[] = "('showlogs','1','0');"; $arr_setting[] = "('showonline','1','0');"; $arr_setting[] = "('showquote','0','0');"; $arr_setting[] = "('showtags','0','0');"; $arr_setting[] = "('showtoday','1','0');"; $arr_setting[] = "('showtotal','1','0');"; $arr_setting[] = "('showuser','0','0');"; $arr_setting[] = "('showyester','1','0');"; $arr_setting[] = "('sidecommentlength','12','0');"; $arr_setting[] = "('sidecommentstyle','{title}','0');"; $arr_setting[] = "('sidegbooklength','12','0');"; $arr_setting[] = "('sidegbookstyle','{title}','0');"; $arr_setting[] = "('sidelogslength','12','0');"; $arr_setting[] = "('sidelogsPage','10','0');"; $arr_setting[] = "('sidelogsstyle','{title}','0');"; $arr_setting[] = "('skinSwitch','" . $skinSwitch . "','1');"; $arr_setting[] = "('status','0','0');"; $arr_setting[] = "('tagNums','50','0');"; $arr_setting[] = "('tbSiteList','','0');"; $arr_setting[] = "('thumbSize','200x200','0');"; $arr_setting[] = "('timeSystemFormat','Y-m-d H:i','0');"; $arr_setting[] = "('timezone','8','0');"; $arr_setting[] = "('trackNums','10','0');"; $arr_setting[] = "('uservalid','0','0');"; $arr_setting[] = "('visitNums','0','1');"; $arr_setting[] = "('applylink','1','0');"; $arr_setting[] = "('disSearch','0','0');"; $arr_setting[] = "('gbface','1','0');"; $arr_setting[] = "('disAttach','1','0');"; $arr_setting[] = "('forum_user','','0');"; $arr_setting[] = "('loginStatus','1','0');"; $arr_setting[] = "('disTags','1','0');"; $arr_setting[] = "('fastEditor','1','0');"; $arr_setting[] = "('allowTrackback','1','0');"; $arr_setting[] = "('allowComment','1','0');"; $arr_setting[] = "('showKeyword','0','0');"; $arr_setting[] = "('autoUrl','0','0');"; $arr_setting[] = "('showPrint','0','0');"; $arr_setting[] = "('showDown','0','0');"; $arr_setting[] = "('showMail','0','0');"; $arr_setting[] = "('linkshow','0','0');"; $arr_setting[] = "('showUBB','0','0');"; $arr_setting[] = "('linklogo','images/logo.gif','0');"; $arr_setting[] = "('adminstyle','default','0');"; $arr_setting[] = "('footcode','','0');"; $arr_setting[] = "('linkmarquee','0','0');"; $arr_setting[] = "('currFormatDate','Y-m-d H:i','0');"; $arr_setting[] = "('listFormatDate','m-d','0');"; $arr_setting[] = "('showAlertStyle','0','0');"; $arr_setting[] = "('weatherStatus','1','0');"; $arr_setting[] = "('treeCategory','0','0');"; foreach ($arr_setting as $key => $value) { foreach ($setInfo as $subkey => $subvalue) { if (strpos($value, "'{$subkey}'") > 0 && $subkey != "isRegister" && $subkey != "gbookPage" && $subkey != "commPage") { $subvalue = str_replace("'", "'", $subvalue); $arr_setting[$key] = preg_replace("/\\('(.*?)','(.*?)','(.*?)'\\);/is", "('\\1','" . $subvalue . "','\\3');", $value); break; } } } foreach ($arr_setting as $key => $value) { $insert_sql[] = "insert into " . $DBPrefix . "setting values" . $value; } $create_sql[] = "DROP TABLE IF EXISTS `{$DBPrefix}setting`;"; $create_sql[] = "CREATE TABLE `{$DBPrefix}setting` (\r\n\t\t\t\t\t\t`settName` varchar( 30 ) NOT NULL ,\r\n\t\t\t\t\t\t`settValue` tinytext NOT NULL,\r\n\t\t\t\t\t\t`settAuto` tinyint(1) NOT NULL default '0'\r\n\t\t\t\t\t ) ENGINE=MyISAM {$default_charset};\r\n\t\t\t\t\t "; $modify_sql = array_merge($create_sql, $insert_sql); $delete_setting = true; } else { //更新 v1.0 以后的设定值 $arr_setting = array(); $arr_setting['applylink'] = "1"; $arr_setting['disSearch'] = "0"; $arr_setting['gbface'] = "1"; $arr_setting['disAttach'] = "1"; $arr_setting['forum_user'] = ""; $arr_setting['loginStatus'] = "1"; $arr_setting['disTags'] = '1'; $arr_setting['fastEditor'] = '0'; $arr_setting['allowTrackback'] = '1'; $arr_setting['allowComment'] = '1'; $arr_setting['showKeyword'] = '0'; $arr_setting['autoUrl'] = '0'; $arr_setting['showPrint'] = '0'; $arr_setting['showDown'] = '0'; $arr_setting['showMail'] = '0'; $arr_setting['linkshow'] = '0'; $arr_setting['showUBB'] = '0'; $arr_setting['linklogo'] = 'images/logo.gif'; $arr_setting['adminstyle'] = 'new'; $arr_setting['footcode'] = ''; $arr_setting['linkmarquee'] = '0'; $arr_setting['currFormatDate'] = 'Y-m-d H:i'; $arr_setting['listFormatDate'] = 'm-d'; $arr_setting['showAlertStyle'] = '0'; $arr_setting['weatherStatus'] = '1'; $arr_setting['treeCategory'] = '0'; foreach ($arr_setting as $key => $value) { if (!$DMC->fetchArray($DMC->query("select * from " . $DBPrefix . "setting where settName='{$key}'"))) { $modify_sql[] = "insert into " . $DBPrefix . "setting values('{$key}','{$value}','0')"; } } //新增粘贴插件 if (!$DMC->fetchArray($DMC->query("select * from " . $DBPrefix . "setting where settName='editPluginName' and settValue like '%paste%'"))) { $modify_sql[] = "update " . $DBPrefix . "setting set settValue=concat('paste,',settValue) where settName='editPluginName'"; $modify_sql[] = "update " . $DBPrefix . "setting set settValue=replace(settValue,',justifyleft,justifycenter',',pastetext,pasteword,separator,justifyleft,justifycenter,justifyright') where settName='editPluginButton1'"; } //清除属性(2007-02-01) if ($DMC->fetchArray($DMC->query("select * from " . $DBPrefix . "setting where settName='disTop'"))) { $modify_sql[] = "delete from {$DBPrefix}setting where settName='disTop' or settName='calendarmonth'"; } } //更新数据表(2006-11-11) if (!$DMC->query("SELECT cateIcons FROM " . $DBPrefix . "categories", 'T')) { $modify_sql[] = "DROP TABLE IF EXISTS `{$DBPrefix}linkgroup`;"; $modify_sql[] = "CREATE TABLE `{$DBPrefix}linkgroup` (\r\n\t\t\t\t\t\t`id` int(3) NOT NULL auto_increment,\r\n\t\t\t\t\t\t`name` varchar(50) NOT NULL,\r\n\t\t\t\t\t\t`isSidebar` tinyint(1) NOT NULL default '0',\r\n\t\t\t\t\t\t`orderNo` int(5) NOT NULL default '0',\r\n\t\t\t\t\t\tPRIMARY KEY (`id`),\r\n\t\t\t\t\t\tKEY `name` (`name`)\r\n\t\t\t\t\t\t) ENGINE=MyISAM {$default_charset};\r\n\t\t\t\t\t "; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD `autoSplit` int(8) NOT NULL default '0'"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}categories` ADD `cateIcons` tinyint(4) NOT NULL default '1'"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}links` ADD `lnkGrpId` int(3) NOT NULL default '1'"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}links` ADD `blogLogo` varchar(150) NOT NULL default ''"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}links` ADD `isApp` tinyint(1) NOT NULL default '0'"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}links` CHANGE `isHidden` `isSidebar` tinyint(1) NOT NULL default '0'"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}attachments` CHANGE `attTitle` `attTitle` varchar(150) NOT NULL default ''"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}members` CHANGE `role` `role` varchar(8) NOT NULL default 'user'"; $modify_sql[] = "INSERT INTO `{$DBPrefix}modules` VALUES (17, 'links', '[var]strLinks[/var]', 1, 0, 0, 4, 1, '', 'include/links.inc.php', 0, '', 0, '', 0, '')"; $modify_sql[] = "INSERT INTO `{$DBPrefix}modules` VALUES (18, 'archives', '[var]strArchives[/var]', 1, 0, 0, 4, 1, '', 'include/archives.inc.php', 0, '', 0, '', 0, '')"; $modify_sql[] = "INSERT INTO `{$DBPrefix}modules` VALUES (19, 'userPanel', '[var]strUserPanel[/var]', 2, 1, 0, 1, 1, 'side_userPanel()', '', 0, '', 0, '', 0, '')"; $modify_sql[] = "UPDATE `{$DBPrefix}modules` set modTitle='[var]strHomePageGBook[/var]' where id='16'"; $modify_sql[] = "INSERT INTO `{$DBPrefix}linkgroup` VALUES ('1', 'Links', '1', '1')"; $modify_sql[] = "UPDATE {$DBPrefix}links set lnkGrpId='1',isApp='1',isSidebar='1'"; $modify_sql[] = "UPDATE {$DBPrefix}categories set cateIcons='1'"; } //更新评论2007-02-01,因为恢复的地方没有使用它。 if (!$DMC->query("SELECT homepage FROM " . $DBPrefix . "comments", 'T')) { $modify_sql[] = "ALTER TABLE `{$DBPrefix}setting` CHANGE `settValue` `settValue` text NOT NULL"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}comments` ADD `homepage` varchar(100) NOT NULL default ''"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}comments` ADD `email` varchar(100) NOT NULL default ''"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}comments` ADD `face` varchar(30) NOT NULL default ''"; } //更新附件的文件类别(2007-02-01 $arrResult = $DMC->fetchQueryAll($DMC->query("SELECT name,id FROM " . $DBPrefix . "attachments where not fileType like '%/%' and not fileType like '%-%' ")); foreach ($arrResult as $value) { if ($value['name'] != "") { $fileType = updateFileType($value['name']); $modify_sql[] = "update " . $DBPrefix . "attachments set fileType='{$fileType}' where id='" . $value['id'] . "'"; } } //运行SQL语句 foreach ($modify_sql as $key => $value) { $DMC->query($value, "T"); if ($echo) { if ($DMC->error()) { echo $value . " ... <font color=red>" . $DMC->error() . "</font><br />"; } else { echo $value . " ... <font color=blue>OK</font><br />"; } } } $i = 0; $contents = "\$update_logs = array(\r\n"; $contents .= "\t'{$i}' => '{$update_time}',\r\n"; for ($i = 0; $i < count($update_logs); $i++) { $j = $i + 1; $contents .= "\t'{$j}' => '" . $update_logs[$i] . "',\r\n"; } $contents .= ");"; writetocache('update_logs', $contents); //清空缓存 if ($delete_setting == true) { //0909升级需要重新建立setting文件。 if (!@unlink(F2BLOG_ROOT . "./cache/cache_setting.php")) { echo "<script language=Javascript> \n"; echo "alert('Please update cache!');\n"; echo "</script>\n"; } } else { //更新缓存 settings_recache(); links_recache(); } }
function build_cache_setting() { global $_G; $table = 'common_setting'; $skipkeys = array('posttableids', 'siteuniqueid', 'mastermobile', 'closedreason', 'creditsnotify', 'backupdir', 'custombackup', 'jswizard', 'maxonlines', 'modreasons', 'newsletter', 'postno', 'postnocustom', 'customauthorinfo', 'domainwhitelist', 'ipregctrl', 'ipverifywhite', 'fastsmiley', 'defaultdoing', 'profilegroup'); $serialized = array('reginput', 'memory', 'search', 'creditspolicy', 'ftp', 'secqaa', 'ec_credit', 'qihoo', 'spacedata', 'infosidestatus', 'uc', 'indexhot', 'relatedtag', 'sitemessage', 'uchome', 'heatthread', 'recommendthread', 'disallowfloat', 'allowviewuserthread', 'advtype', 'click', 'card', 'rewritestatus', 'rewriterule', 'privacy', 'focus', 'forumkeys', 'article_tags', 'verify', 'seotitle', 'seodescription', 'seokeywords', 'domain', 'ranklist', 'seccodedata', 'inviteconfig', 'advexpiration', 'allowpostcomment', 'mobile', 'connect'); $data = array(); $query = DB::query("SELECT * FROM " . DB::table($table) . " WHERE skey NOT IN(" . dimplode($skipkeys) . ')'); while ($setting = DB::fetch($query)) { if ($setting['skey'] == 'extcredits') { if (is_array($setting['svalue'] = unserialize($setting['svalue']))) { foreach ($setting['svalue'] as $key => $value) { if ($value['available']) { unset($setting['svalue'][$key]['available']); } else { unset($setting['svalue'][$key]); } } } } elseif ($setting['skey'] == 'creditsformula') { if (!checkformulacredits($setting['svalue'])) { $setting['svalue'] = '$member[\'extcredits1\']'; } else { $setting['svalue'] = preg_replace("/(friends|doings|blogs|albums|polls|sharings|digestposts|posts|threads|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['svalue']); } } elseif ($setting['skey'] == 'maxsmilies') { $setting['svalue'] = $setting['svalue'] <= 0 ? -1 : $setting['svalue']; } elseif ($setting['skey'] == 'threadsticky') { $setting['svalue'] = explode(',', $setting['svalue']); } elseif ($setting['skey'] == 'attachdir') { $setting['svalue'] = preg_replace("/\\.asp|\\0/i", '0', $setting['svalue']); $setting['svalue'] = str_replace('\\', '/', substr($setting['svalue'], 0, 2) == './' ? DISCUZ_ROOT . $setting['svalue'] : $setting['svalue']); $setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : ''; } elseif ($setting['skey'] == 'attachurl') { $setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : ''; } elseif ($setting['skey'] == 'onlinehold') { $setting['svalue'] = $setting['svalue'] * 60; } elseif (in_array($setting['skey'], $serialized)) { $setting['svalue'] = @unserialize($setting['svalue']); if ($setting['skey'] == 'search') { foreach ($setting['svalue'] as $key => $val) { foreach ($val as $k => $v) { $setting['svalue'][$key][$k] = max(0, intval($v)); } } } if ($setting['skey'] == 'ftp') { $setting['svalue']['attachurl'] .= substr($setting['svalue']['attachurl'], -1, 1) != '/' ? '/' : ''; } } $_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue']; } DB::free_result($query); $data['newusergroupid'] = DB::result_first("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE creditshigher<=" . intval($data['initcredits']) . " AND " . intval($data['initcredits']) . "<creditslower LIMIT 1"); if ($data['srchhotkeywords']) { $data['srchhotkeywords'] = explode("\n", $data['srchhotkeywords']); } if ($data['search']) { $searchstatus = 0; foreach ($data['search'] as $item) { if ($item['status']) { $searchstatus = 1; break; } } if (!$searchstatus) { $data['search'] = array(); } } $data['creditspolicy'] = array_merge($data['creditspolicy'], get_cachedata_setting_creditspolicy()); if ($data['heatthread']['iconlevels']) { $data['heatthread']['iconlevels'] = explode(',', $data['heatthread']['iconlevels']); arsort($data['heatthread']['iconlevels']); } else { $data['heatthread']['iconlevels'] = array(); } if ($data['verify']) { foreach ($data['verify'] as $key => $value) { if ($value['available'] && !empty($value['icon'])) { $icourl = parse_url($value['icon']); if (!$icourl['host'] && !file_exists($value['icon'])) { $data['verify'][$key]['icon'] = $data['attachurl'] . 'common/' . $value['icon']; } } } } if ($data['recommendthread']['status']) { if ($data['recommendthread']['iconlevels']) { $data['recommendthread']['iconlevels'] = explode(',', $data['recommendthread']['iconlevels']); arsort($data['recommendthread']['iconlevels']); } else { $data['recommendthread']['iconlevels'] = array(); } } else { $data['recommendthread'] = array('allow' => 0); } if ($data['commentnumber'] && !$data['allowpostcomment']) { $data['commentnumber'] = 0; } if (!empty($data['ftp'])) { if (!empty($data['ftp']['allowedexts'])) { $data['ftp']['allowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['allowedexts']); $data['ftp']['allowedexts'] = explode("\n", strtolower($data['ftp']['allowedexts'])); array_walk($data['ftp']['allowedexts'], 'trim'); } if (!empty($data['ftp']['disallowedexts'])) { $data['ftp']['disallowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['disallowedexts']); $data['ftp']['disallowedexts'] = explode("\n", strtolower($data['ftp']['disallowedexts'])); array_walk($data['ftp']['disallowedexts'], 'trim'); } $data['ftp']['connid'] = 0; } if (!empty($data['forumkeys'])) { $data['forumfids'] = array_flip($data['forumkeys']); } else { $data['forumfids'] = array(); } $data['commentitem'] = explode("\t", $data['commentitem']); $commentitem = array(); foreach ($data['commentitem'] as $k => $v) { $tmp = explode(chr(0) . chr(0) . chr(0), $v); if (count($tmp) > 1) { $commentitem[$tmp[0]] = $tmp[1]; } else { $commentitem[$k] = $v; } } $data['commentitem'] = $commentitem; if ($data['allowviewuserthread']['allow']) { $data['allowviewuserthread'] = is_array($data['allowviewuserthread']['fids']) && $data['allowviewuserthread']['fids'] && !in_array('', $data['allowviewuserthread']['fids']) ? dimplode($data['allowviewuserthread']['fids']) : ''; } else { $data['allowviewuserthread'] = false; } include_once DISCUZ_ROOT . './source/discuz_version.php'; $_G['setting']['version'] = $data['version'] = DISCUZ_VERSION; $data['sitemessage']['time'] = !empty($data['sitemessage']['time']) ? $data['sitemessage']['time'] * 1000 : 0; foreach (array('register', 'login', 'newthread', 'reply') as $type) { $data['sitemessage'][$type] = !empty($data['sitemessage'][$type]) ? explode("\n", $data['sitemessage'][$type]) : array(); } $data['cachethreadon'] = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE status='1' AND threadcaches>0") ? 1 : 0; $data['disallowfloat'] = is_array($data['disallowfloat']) ? implode('|', $data['disallowfloat']) : ''; if (!$data['imagelib']) { unset($data['imageimpath']); } if (is_array($data['relatedtag']['order'])) { asort($data['relatedtag']['order']); $relatedtag = array(); foreach ($data['relatedtag']['order'] as $k => $v) { $relatedtag['status'][$k] = $data['relatedtag']['status'][$k]; $relatedtag['name'][$k] = $data['relatedtag']['name'][$k]; $relatedtag['limit'][$k] = $data['relatedtag']['limit'][$k]; $relatedtag['template'][$k] = $data['relatedtag']['template'][$k]; } $data['relatedtag'] = $relatedtag; foreach ((array) $data['relatedtag']['status'] as $appid => $status) { if (!$status) { unset($data['relatedtag']['limit'][$appid]); } } unset($data['relatedtag']['status'], $data['relatedtag']['order'], $relatedtag); } $data['domain']['defaultindex'] = isset($data['defaultindex']) && $data['defaultindex'] != '#' ? $data['defaultindex'] : ''; $data['domain']['holddomain'] = isset($data['holddomain']) ? $data['holddomain'] : ''; $data['domain']['list'] = array(); $query = DB::query("SELECT * FROM " . DB::table('common_domain') . " WHERE idtype IN('subarea', 'forum', 'topic', 'channel')"); while ($value = DB::fetch($query)) { $data['domain']['list'][$value['domain'] . '.' . $value['domainroot']] = array('id' => $value['id'], 'idtype' => $value['idtype']); } writetocache('domain', getcachevars(array('domain' => $data['domain']))); $data['seccodedata'] = is_array($data['seccodedata']) ? $data['seccodedata'] : array(); if ($data['seccodedata']['type'] == 2) { if (extension_loaded('ming')) { unset($data['seccodedata']['background'], $data['seccodedata']['adulterate'], $data['seccodedata']['ttf'], $data['seccodedata']['angle'], $data['seccodedata']['color'], $data['seccodedata']['size'], $data['seccodedata']['animator']); } else { $data['seccodedata']['animator'] = 0; } } elseif ($data['seccodedata']['type'] == 99) { $data['seccodedata']['width'] = 32; $data['seccodedata']['height'] = 24; } $data['watermarktype'] = !empty($data['watermarktype']) ? unserialize($data['watermarktype']) : array(); $data['watermarktext'] = !empty($data['watermarktext']) ? unserialize($data['watermarktext']) : array(); foreach ($data['watermarktype'] as $k => $v) { if ($data['watermarktype'][$k] == 'text' && $data['watermarktext']['text'][$k]) { if ($data['watermarktext']['text'][$k] && strtoupper(CHARSET) != 'UTF-8') { $data['watermarktext']['text'][$k] = diconv($data['watermarktext']['text'][$k], CHARSET, 'UTF-8', true); } $data['watermarktext']['text'][$k] = bin2hex($data['watermarktext']['text'][$k]); if (file_exists('static/image/seccode/font/en/' . $data['watermarktext']['fontpath'][$k])) { $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/en/' . $data['watermarktext']['fontpath'][$k]; } elseif (file_exists('static/image/seccode/font/ch/' . $data['watermarktext']['fontpath'][$k])) { $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/ch/' . $data['watermarktext']['fontpath'][$k]; } else { $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/' . $data['watermarktext']['fontpath'][$k]; } $data['watermarktext']['color'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['color'][$k]); $data['watermarktext']['shadowcolor'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['shadowcolor'][$k]); } else { $data['watermarktext']['text'][$k] = ''; $data['watermarktext']['fontpath'][$k] = ''; $data['watermarktext']['color'][$k] = ''; $data['watermarktext']['shadowcolor'][$k] = ''; } } $data['styles'] = array(); $query = DB::query("SELECT s.styleid, s.name, s.extstyle, t.directory FROM " . DB::table('common_style') . " s\n\t\t\t\tLEFT JOIN " . DB::table('common_template') . " t ON s.templateid=t.templateid\n\t\t\t\tWHERE s.available='1'"); while ($style = DB::fetch($query)) { $data['styles'][$style['styleid']] = dhtmlspecialchars($style['name']); } $exchcredits = array(); $allowexchangein = $allowexchangeout = FALSE; foreach ((array) $data['extcredits'] as $id => $credit) { $data['extcredits'][$id]['img'] = $credit['img'] ? '<img style="vertical-align:middle" src="' . $credit['img'] . '" />' : ''; if (!empty($credit['ratio'])) { $exchcredits[$id] = $credit; $credit['allowexchangein'] && ($allowexchangein = TRUE); $credit['allowexchangeout'] && ($allowexchangeout = TRUE); } $data['creditnotice'] && ($data['creditnames'][] = str_replace("'", "\\'", htmlspecialchars($id . '|' . $credit['title'] . '|' . $credit['unit']))); } $data['creditnames'] = $data['creditnotice'] ? @implode(',', $data['creditnames']) : ''; $creditstranssi = explode(',', $data['creditstrans']); $data['creditstrans'] = $creditstranssi[0]; unset($creditstranssi[0]); $data['creditstransextra'] = $creditstranssi; for ($i = 1; $i < 11; $i++) { $data['creditstransextra'][$i] = $data['creditstrans'] ? !$data['creditstransextra'][$i] ? $data['creditstrans'] : $data['creditstransextra'][$i] : 0; } $data['exchangestatus'] = $allowexchangein && $allowexchangeout; $data['transferstatus'] = isset($data['extcredits'][$data['creditstrans']]); list($data['zoomstatus'], $data['imagemaxwidth']) = explode("\t", $data['zoomstatus']); $data['imagemaxwidth'] = intval($data['imagemaxwidth']); require_once DISCUZ_ROOT . './config/config_ucenter.php'; $data['ucenterurl'] = UC_API; $query = DB::query("SELECT identifier, name FROM " . DB::table('common_magic') . " WHERE available='1'"); while ($magic = DB::fetch($query)) { $data['magics'][$magic['identifier']] = $magic['name']; } $data['tradeopen'] = DB::result_first("SELECT count(*) FROM " . DB::table('common_usergroup_field') . " WHERE allowposttrade='1'") ? 1 : 0; $data['medalstatus'] = intval(DB::result_first("SELECT count(*) FROM " . DB::table('forum_medal') . " WHERE available='1'")); $focus = array(); if ($data['focus']['data']) { foreach ($data['focus']['data'] as $k => $v) { if ($v['available'] && $v['position']) { foreach ($v['position'] as $position) { $focus[$position][$k] = $k; } } } } $data['focus'] = $focus; list($data['plugins'], $data['pluginlinks'], $data['hookscript'], $data['hookscriptmobile'], $data['threadplugins'], $data['specialicon']) = get_cachedata_setting_plugin(); if (empty($data['defaultindex'])) { $data['defaultindex'] = array(); } list($data['navs'], $data['subnavs'], $data['menunavs'], $data['navmns'], $data['navmn'], $data['navdms'], $data['navlogos']) = get_cachedata_mainnav(); $data['footernavs'] = get_cachedata_footernav(); $data['spacenavs'] = get_cachedata_spacenavs(); $data['mynavs'] = get_cachedata_mynavs(); $data['topnavs'] = get_cachedata_topnav(); require_once DISCUZ_ROOT . './uc_client/client.php'; $ucapparray = uc_app_ls(); $data['allowsynlogin'] = isset($ucapparray[UC_APPID]['synlogin']) ? $ucapparray[UC_APPID]['synlogin'] : 1; $appnamearray = array('UCHOME', 'XSPACE', 'DISCUZ', 'SUPESITE', 'SUPEV', 'ECSHOP', 'ECMALL', 'OTHER'); $data['ucapp'] = $data['ucappopen'] = array(); $data['uchomeurl'] = ''; $data['discuzurl'] = $_G['siteurl']; $appsynlogins = 0; foreach ($ucapparray as $apparray) { if ($apparray['appid'] != UC_APPID) { if (!empty($apparray['synlogin'])) { $appsynlogins = 1; } if ($data['uc']['navlist'][$apparray['appid']] && $data['uc']['navopen']) { $data['ucapp'][$apparray['appid']]['name'] = $apparray['name']; $data['ucapp'][$apparray['appid']]['url'] = $apparray['url']; } } else { $data['discuzurl'] = $apparray['url']; } if (!empty($apparray['viewprourl'])) { $data['ucapp'][$apparray['appid']]['viewprourl'] = $apparray['url'] . $apparray['viewprourl']; } foreach ($appnamearray as $name) { if ($apparray['type'] == $name && $apparray['appid'] != UC_APPID) { $data['ucappopen'][$name] = 1; if ($name == 'UCHOME') { $data['uchomeurl'] = $apparray['url']; } elseif ($name == 'XSPACE') { $data['xspaceurl'] = $apparray['url']; } } } } $data['allowsynlogin'] = $data['allowsynlogin'] && $appsynlogins ? 1 : 0; $data['homeshow'] = $data['uchomeurl'] && $data['uchome']['homeshow'] ? $data['uchome']['homeshow'] : '0'; unset($data['allowthreadplugin']); if ($data['jspath'] == 'data/cache/') { writetojscache(); } elseif (!$data['jspath']) { $data['jspath'] = 'static/js/'; } if ($data['cacheindexlife']) { $cachedir = DISCUZ_ROOT . './' . $data['cachethreaddir']; $tidmd5 = substr(md5(0), 3); @unlink($cachedir . '/' . $tidmd5[0] . '/' . $tidmd5[1] . '/' . $tidmd5[2] . '/0.htm'); } $reginputbwords = array('username', 'password', 'password2', 'email'); if (in_array($data['reginput']['username'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['username'])) { $data['reginput']['username'] = random(6); } if (in_array($data['reginput']['password'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['password'])) { $data['reginput']['password'] = random(6); } if (in_array($data['reginput']['password2'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['password2'])) { $data['reginput']['password2'] = random(6); } if (in_array($data['reginput']['email'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['email'])) { $data['reginput']['email'] = random(6); } $defaultcurhost = empty($_G['setting']['domain']['app']['default']) ? '{CURHOST}' : $_G['setting']['domain']['app']['default']; $output = array('str' => array(), 'preg' => array()); //str為二級域名的查找和替換,preg為rewrite和默認域名的查找和替換 $_G['domain'] = array(); if (is_array($_G['setting']['domain']['app'])) { $apps = $_G['setting']['domain']['app']; $repflag = $apps['portal'] || $apps['forum'] || $apps['group'] || $apps['home'] || $apps['default']; foreach ($apps as $app => $domain) { if (in_array($app, array('default', 'mobile'))) { continue; } $appphp = "{$app}.php"; if (!$domain) { $domain = $defaultcurhost; } if ($domain != '{CURHOST}') { $domain = 'http://' . $domain . $_G['siteport'] . '/'; } if ($repflag) { $output['str']['search'][$app] = "<a href=\"{$app}.php"; $output['str']['replace'][$app] = '<a href="' . $domain . $appphp; $_G['domain']['pregxprw'][$app] = '<a href\\="(' . preg_quote($domain, '/') . ')' . $appphp; } else { $_G['domain']['pregxprw'][$app] = '<a href\\="()' . $appphp; } } } if ($_G['setting']['rewritestatus'] || $output['str']['search']) { if ($_G['setting']['rewritestatus']) { require_once libfile('function/admincp'); $output['preg'] = rewritedata(0); } if ($repflag) { if ($defaultcurhost != '{CURHOST}') { $defaultcurhost = 'http://' . $defaultcurhost . $_G['siteport'] . '/'; } $output['preg']['search'][] = "/<a href=\"(\\w+\\.php)/"; $output['preg']['replace'][] = '<a href="' . $defaultcurhost . "\$1"; } } $data['output'] = $output; save_syscache('setting', $data); $_G['setting'] = $data; }
function update_data($echo, $DMC) { global $DBPrefix, $update_time, $update_logs; $delete_setting = true; $arr_setting = array(); // update 20090512 if (!in_array($update_logs, "20090512")) { //更新附件的文件类别 2009-05-12 $modify_sql[] = "ALTER TABLE `{$DBPrefix}attachments` ADD INDEX `name` (`name`)"; // `isSecret` tinyint(1) NOT NULL default '0', $modify_sql[] = "ALTER TABLE `{$DBPrefix}guestbook` ADD COLUMN `isSpam` tinyint(1) NOT NULL DEFAULT 0 AFTER `isSecret`"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}guestbook` ADD COLUMN `HTTP_REFERER` text NULL DEFAULT NULL AFTER `parent`"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}links` ADD INDEX `isApp` (`isApp`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD COLUMN `isSpam` tinyint(1) NOT NULL DEFAULT 0 AFTER `isTrackback`"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD COLUMN `isTopNews` tinyint(1) NOT NULL DEFAULT 0 AFTER `isTop`"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD INDEX `postTime` (`postTime`,`saveType`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD INDEX `isComment` (`isComment`,`isTrackback`,`isTop`,`isTopNews`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}members` ADD INDEX `password` (`password`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}members` ADD INDEX `role` (`role`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}setting` ADD INDEX `settName` (`settName`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}trackbacks` ADD INDEX `isApp` (`isApp`)"; $modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD `autoSplit` int(8) NOT NULL default '0'"; // 強化驗證 $SQL = "select count(`name`) from `{$DBPrefix}filters` where `category`='1' and `name`='=http'"; list($intNums) = $DMC->fetchArray($DMC->query($SQL), MYSQL_NUM); if ($intNums == 0) { $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '=http')"; } $SQL = "select count(`name`) from `{$DBPrefix}filters` where `category`='1' and `name`='[url='"; list($intNums) = $DMC->fetchArray($DMC->query($SQL), MYSQL_NUM); if ($intNums == 0) { $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '[url=')"; } $SQL = "select count(`name`) from `{$DBPrefix}filters` where `category`='1' and `name`='[href='"; list($intNums) = $DMC->fetchArray($DMC->query($SQL), MYSQL_NUM); if ($intNums == 0) { $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '[href=')"; } $SQL = "select count(`name`) from `{$DBPrefix}filters` where `category`='1' and `name`='缺 錢 個 人 兼 職'"; list($intNums) = $DMC->fetchArray($DMC->query($SQL), MYSQL_NUM); if ($intNums == 0) { $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '缺 錢 個 人 兼 職')"; } // ★全套愛愛★時間內不限次數★累ㄌ也ㄎ以找我按摩4小時3000★ $SQL = "select count(`name`) from `{$DBPrefix}filters` where `category`='1' and `name`='全套愛愛'"; list($intNums) = $DMC->fetchArray($DMC->query($SQL), MYSQL_NUM); if ($intNums == 0) { $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '全套愛愛')"; } // 跟新設定檔 $arr_setting['spamfilter'] = 'close'; } // update 20090625 if (!in_array($update_logs, "20090625")) { // `isSecret` tinyint(1) NOT NULL default '0', $modify_sql[] = "ALTER TABLE `{$DBPrefix}comments` ADD COLUMN `isSpam` tinyint(1) NOT NULL DEFAULT 0 AFTER `isSecret`"; } // update 20090630 if (!in_array($update_logs, "20090625")) { // This site baclofen is about baclofen remedy. $SQL = "select count(`name`) from `{$DBPrefix}filters` where `category`='1' and `name`='This site'"; list($intNums) = $DMC->fetchArray($DMC->query($SQL), MYSQL_NUM); if ($intNums == 0) { $modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, 'This site')"; } } /* if (!in_array($update_logs,"20090709")) { $SQL="select count(`name`) from `{$DBPrefix}modules` where `name`='BlogNews'"; list($intNums)=$DMC->fetchArray($DMC->query($SQL),MYSQL_NUM); if ($intNums==0) { $modify_sql[]="INSERT INTO `{$DBPrefix}modules` (`name`, `modTitle`, `disType`, `isHidden`, `indexOnly`, `orderNo`, `isSystem`, `htmlCode`, `pluginPath`, `isInstall`, `installFolder`, `installDate`, `settingXml`, `cateId`, `configPath`) VALUES('BlogNews', '跑馬燈', 3, 0, 0, 2, 1, '', 'include/plung.blognews.php', 0, '', 0, '', 0, '')"; } else $modify_sql[]="update `{$DBPrefix}modules` set isSystem='1',`pluginPath`='include/plung.blognews.php' where `name`='BlogNews'"; } */ if (is_array($arr_setting)) { foreach ($arr_setting as $key => $value) { if (!$DMC->fetchArray($DMC->query("select * from " . $DBPrefix . "setting where settName='{$key}'"))) { $modify_sql[] = "insert into " . $DBPrefix . "setting values('{$key}','{$value}','0')"; } } } //运行SQL语句 foreach ($modify_sql as $key => $value) { $DMC->query($value, "T"); if ($echo) { if ($DMC->error()) { echo $value . " ... <font color=red>" . $DMC->error() . "</font><br />"; } else { echo $value . " ... <font color=blue>OK</font><br />"; } } } $i = 0; $contents = "\$update_logs = array(\r\n"; $contents .= "\t'{$i}' => '{$update_time}',\r\n"; for ($i = 0; $i < count($update_logs); $i++) { $j = $i + 1; $contents .= "\t'{$j}' => '" . $update_logs[$i] . "',\r\n"; } $contents .= ");"; writetocache('update_logs', $contents); //清空缓存 if (!@unlink(F2BLOG_ROOT . "./cache/cache_setting.php")) { echo "<script language=Javascript> \n"; echo "alert('Please update cache!');\n"; echo "</script>\n"; } //更新缓存 settings_recache(); links_recache(); filters_recache(); /* //清空缓存 if ($delete_setting==true){//0909升级需要重新建立setting文件。 if (!@unlink(F2BLOG_ROOT."./cache/cache_setting.php")){ echo "<script language=Javascript> \n"; echo "alert('Please update cache!');\n"; echo "</script>\n"; } }else{ //更新缓存 settings_recache(); links_recache(); } */ return false; }
} if (isset($_GET['del'])) { $del['cat_id'] = intval($_GET['del']); DB::delete('house_cat', $del); } if (isset($_GET['edit'])) { $edit = intval($_GET['edit']); $edit_array = array(); $edit_array = fetch_all('house_cat', ' WHERE cat_id=' . $edit . ' ORDER BY cat_pid DESC,cat_sort ASC', '*', 0); } if (isset($_GET['edit_submit'])) { $edit_array = array(); $edit_array = gpc('cat_'); DB::update('house_cat', $edit_array, array('cat_id' => $edit_array['cat_id'])); } $cat_array = array(); $cat_array = fetch_all('house_cat', ' ORDER BY cat_pid ASC,cat_sort ASC'); foreach ($cat_array as $k => $v) { if ($v['cat_pid'] == '0') { $sum = fetch_all('house_cat', " WHERE cat_pid='{$v['cat_id']}' ", ' count(cat_id) as sum ', 0); $cat_array[$k] = array_merge($cat_array[$k], $sum); } } $cat_array_field .= "\$cat_array = " . arrayeval($cat_array) . ";\n"; writetocache('house_cat_array', $cat_array_field); if (!cloudaddons_getmd5("house.plugin")) { cpmsg(lang('admincp_msg', 'cloudaddons_genuine_message'), '', 'error', array('addonid' => "house.plugin")); } $pid_cat_array = array(); $pid_cat_array = fetch_all("house_cat", " WHERE cat_id='{$cat_pid}' ", "*", 0); include template("house:admin/admin_cat");
function build_cache_setting() { global $_G; $skipkeys = array('posttableids', 'mastermobile', 'masterqq', 'masteremail', 'closedreason', 'creditsnotify', 'backupdir', 'custombackup', 'jswizard', 'maxonlines', 'modreasons', 'newsletter', 'postno', 'postnocustom', 'customauthorinfo', 'domainwhitelist', 'ipregctrl', 'ipverifywhite', 'fastsmiley', 'defaultdoing', 'antitheftsetting', ); $serialized = array('reginput', 'memory', 'search', 'creditspolicy', 'ftp', 'secqaa', 'ec_credit', 'qihoo', 'spacedata', 'infosidestatus', 'uc', 'indexhot', 'relatedtag', 'sitemessage', 'uchome', 'heatthread', 'recommendthread', 'disallowfloat', 'allowviewuserthread', 'advtype', 'click', 'card', 'rewritestatus', 'rewriterule', 'privacy', 'focus', 'forumkeys', 'article_tags', 'verify', 'seotitle', 'seodescription', 'seokeywords', 'domain', 'ranklist', 'my_search_data', 'seccodedata', 'inviteconfig', 'advexpiration', 'allowpostcomment', /*(IN_MOBILE)*/ 'mobile', 'connect', 'upgrade', 'patch', 'strongpw', 'posttable_info', 'threadtable_info', 'profilegroup', 'antitheft', 'makehtml', 'guestviewthumb', 'grid', 'guesttipsinthread' ); $data = array(); foreach(C::t('common_setting')->fetch_all_not_key($skipkeys) as $setting) { if($setting['skey'] == 'extcredits') { if(is_array($setting['svalue'] = dunserialize($setting['svalue']))) { foreach($setting['svalue'] as $key => $value) { if($value['available']) { unset($setting['svalue'][$key]['available']); } else { unset($setting['svalue'][$key]); } } } } elseif($setting['skey'] == 'creditsformula') { if(!checkformulacredits($setting['svalue'])) { $setting['svalue'] = '$member[\'extcredits1\']'; } else { $setting['svalue'] = preg_replace("/(friends|doings|blogs|albums|polls|sharings|digestposts|posts|threads|oltime|extcredits[1-8])/", "\$member['\\1']", $setting['svalue']); } } elseif($setting['skey'] == 'maxsmilies') { $setting['svalue'] = $setting['svalue'] <= 0 ? -1 : $setting['svalue']; } elseif($setting['skey'] == 'threadsticky') { $setting['svalue'] = explode(',', $setting['svalue']); } elseif($setting['skey'] == 'attachdir') { $setting['svalue'] = preg_replace("/\.asp|\\0/i", '0', $setting['svalue']); $setting['svalue'] = str_replace('\\', '/', substr($setting['svalue'], 0, 2) == './' ? DISCUZ_ROOT.$setting['svalue'] : $setting['svalue']); $setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : ''; } elseif($setting['skey'] == 'attachurl') { $setting['svalue'] .= substr($setting['svalue'], -1, 1) != '/' ? '/' : ''; } elseif($setting['skey'] == 'onlinehold') { $setting['svalue'] = $setting['svalue'] * 60; } elseif(in_array($setting['skey'], $serialized)) { $setting['svalue'] = @dunserialize($setting['svalue'], $setting['skey']); if($setting['skey'] == 'search') { foreach($setting['svalue'] as $key => $val) { foreach($val as $k => $v) { $setting['svalue'][$key][$k] = max(0, intval($v)); } } } elseif($setting['skey'] == 'ftp') { $setting['svalue']['attachurl'] .= substr($setting['svalue']['attachurl'], -1, 1) != '/' ? '/' : ''; } elseif($setting['skey'] == 'inviteconfig') { $setting['svalue']['invitecodeprompt'] = stripslashes($setting['svalue']['invitecodeprompt']); } elseif($setting['skey'] == 'profilegroup') { $profile_settings = C::t('common_member_profile_setting')->fetch_all_by_available(1); foreach($setting['svalue'] as $key => $val) { $temp = array(); foreach($profile_settings as $pval) { if(in_array($pval['fieldid'], $val['field'])) { $temp[$pval['fieldid']] = $pval['fieldid']; } } foreach($val['field'] as $fieldid) { if(!in_array($fieldid, $temp)) { $temp[$fieldid] = $fieldid; } } $setting['svalue'][$key]['field'] = $temp; } C::t('common_setting')->update('profilegroup', $setting['svalue']); } } $_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue']; } $usergroup = C::t('common_usergroup')->fetch_by_credits($data['initcredits'], ''); $data['newusergroupid'] = $usergroup['groupid']; $data['buyusergroupexists'] = C::t('common_usergroup')->buyusergroup_exists(); if($data['srchhotkeywords']) { $data['srchhotkeywords'] = explode("\n", $data['srchhotkeywords']); } if($data['search']) { $searchstatus = 0; foreach($data['search'] as $item) { if($item['status']) { $searchstatus = 1; break; } } if(!$searchstatus) { $data['search'] = array(); } } $data['creditspolicy'] = array_merge($data['creditspolicy'], get_cachedata_setting_creditspolicy()); if($data['heatthread']['iconlevels']) { $data['heatthread']['iconlevels'] = explode(',', $data['heatthread']['iconlevels']); arsort($data['heatthread']['iconlevels']); } else { $data['heatthread']['iconlevels'] = array(); } if($data['verify']) { foreach($data['verify'] as $key => $value) { if($value['available']) { if(!empty($value['unverifyicon'])) { $icourl = parse_url($value['unverifyicon']); if(!$icourl['host'] && !file_exists($value['unverifyicon'])) { $data['verify'][$key]['unverifyicon'] = $data['attachurl'].'common/'.$value['unverifyicon']; } } if(!empty($value['icon'])) { $icourl = parse_url($value['icon']); if(!$icourl['host'] && !file_exists($value['icon'])) { $data['verify'][$key]['icon'] = $data['attachurl'].'common/'.$value['icon']; } } } } } if($data['recommendthread']['status']) { if($data['recommendthread']['iconlevels']) { $data['recommendthread']['iconlevels'] = explode(',', $data['recommendthread']['iconlevels']); arsort($data['recommendthread']['iconlevels']); } else { $data['recommendthread']['iconlevels'] = array(); } } else { $data['recommendthread'] = array('allow' => 0); } if($data['commentnumber'] && !$data['allowpostcomment']) { $data['commentnumber'] = 0; } if(!empty($data['ftp'])) { if(!empty($data['ftp']['allowedexts'])) { $data['ftp']['allowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['allowedexts']); $data['ftp']['allowedexts'] = explode("\n", strtolower($data['ftp']['allowedexts'])); array_walk($data['ftp']['allowedexts'], 'trim'); } if(!empty($data['ftp']['disallowedexts'])) { $data['ftp']['disallowedexts'] = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data['ftp']['disallowedexts']); $data['ftp']['disallowedexts'] = explode("\n", strtolower($data['ftp']['disallowedexts'])); array_walk($data['ftp']['disallowedexts'], 'trim'); } $data['ftp']['connid'] = 0; } if(!empty($data['forumkeys'])) { $data['forumfids'] = array_flip($data['forumkeys']); } else { $data['forumfids'] = array(); } $data['commentitem'] = explode("\t", $data['commentitem']); $commentitem = array(); foreach($data['commentitem'] as $k => $v) { $tmp = explode(chr(0).chr(0).chr(0), $v); if(count($tmp) > 1) { $commentitem[$tmp[0]] = $tmp[1]; } else { $commentitem[$k] = $v; } } $data['commentitem'] = $commentitem; if($data['allowviewuserthread']['allow']) { $data['allowviewuserthread'] = is_array($data['allowviewuserthread']['fids']) && $data['allowviewuserthread']['fids'] && !in_array('', $data['allowviewuserthread']['fids']) ? dimplode($data['allowviewuserthread']['fids']) : ''; } else { $data['allowviewuserthread'] = -1; } include_once DISCUZ_ROOT.'./source/discuz_version.php'; $_G['setting']['version'] = $data['version'] = DISCUZ_VERSION; /*vot*/ $_G['setting']['release'] = $data['release'] = DISCUZ_RELEASE; /*vot*/ $_G['setting']['ml_revision'] = $data['ml_revision'] = DISCUZ_ML_REVISION; $data['sitemessage']['time'] = !empty($data['sitemessage']['time']) ? $data['sitemessage']['time'] * 1000 : 0; foreach (array('register', 'login', 'newthread', 'reply') as $type) { $data['sitemessage'][$type] = !empty($data['sitemessage'][$type]) ? explode("\n", $data['sitemessage'][$type]) : array(); } $data['cachethreadon'] = C::t('forum_forum')->fetch_threadcacheon_num() ? 1 : 0; $data['disallowfloat'] = is_array($data['disallowfloat']) ? implode('|', $data['disallowfloat']) : ''; if(!$data['imagelib']) unset($data['imageimpath']); if(is_array($data['relatedtag']['order'])) { asort($data['relatedtag']['order']); $relatedtag = array(); foreach($data['relatedtag']['order'] AS $k => $v) { $relatedtag['status'][$k] = $data['relatedtag']['status'][$k]; $relatedtag['name'][$k] = $data['relatedtag']['name'][$k]; $relatedtag['limit'][$k] = $data['relatedtag']['limit'][$k]; $relatedtag['template'][$k] = $data['relatedtag']['template'][$k]; } $data['relatedtag'] = $relatedtag; foreach((array)$data['relatedtag']['status'] AS $appid => $status) { if(!$status) { unset($data['relatedtag']['limit'][$appid]); } } unset($data['relatedtag']['status'], $data['relatedtag']['order'], $relatedtag); } $data['domain']['defaultindex'] = isset($data['defaultindex']) && $data['defaultindex'] != '#' ? $data['defaultindex'] : ''; $data['domain']['holddomain'] = isset($data['holddomain']) ? $data['holddomain'] : ''; $data['domain']['list'] = array(); foreach(C::t('common_domain')->fetch_all_by_idtype(array('subarea', 'forum', 'topic', 'channel')) as $value) { $data['domain']['list'][$value['domain'].'.'.$value['domainroot']] = array('id' => $value['id'], 'idtype' => $value['idtype']); } writetocache('domain', getcachevars(array('domain' => $data['domain']))); $data['seccodedata'] = is_array($data['seccodedata']) ? $data['seccodedata'] : array(); if($data['seccodedata']['type'] == 2) { if(extension_loaded('ming')) { unset($data['seccodedata']['background'], $data['seccodedata']['adulterate'], $data['seccodedata']['ttf'], $data['seccodedata']['angle'], $data['seccodedata']['color'], $data['seccodedata']['size'], $data['seccodedata']['animator']); } else { $data['seccodedata']['animator'] = 0; } } elseif($data['seccodedata']['type'] == 99) { $data['seccodedata']['width'] = 32; $data['seccodedata']['height'] = 24; } $data['watermarktype'] = !empty($data['watermarktype']) ? dunserialize($data['watermarktype']) : array(); $data['watermarktext'] = !empty($data['watermarktext']) ? dunserialize($data['watermarktext']) : array(); foreach($data['watermarktype'] as $k => $v) { if($data['watermarktype'][$k] == 'text' && $data['watermarktext']['text'][$k]) { if($data['watermarktext']['text'][$k] && strtoupper(CHARSET) != 'UTF-8') { $data['watermarktext']['text'][$k] = diconv($data['watermarktext']['text'][$k], CHARSET, 'UTF-8', true); } $data['watermarktext']['text'][$k] = bin2hex($data['watermarktext']['text'][$k]); if(file_exists('static/image/seccode/font/en/'.$data['watermarktext']['fontpath'][$k])) { $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/en/'.$data['watermarktext']['fontpath'][$k]; } elseif(file_exists('static/image/seccode/font/ch/'.$data['watermarktext']['fontpath'][$k])) { $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/ch/'.$data['watermarktext']['fontpath'][$k]; } else { $data['watermarktext']['fontpath'][$k] = 'static/image/seccode/font/'.$data['watermarktext']['fontpath'][$k]; } $data['watermarktext']['color'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['color'][$k]); $data['watermarktext']['shadowcolor'][$k] = preg_replace('/#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', "hexdec('\\1').','.hexdec('\\2').','.hexdec('\\3')", $data['watermarktext']['shadowcolor'][$k]); } else { $data['watermarktext']['text'][$k] = ''; $data['watermarktext']['fontpath'][$k] = ''; $data['watermarktext']['color'][$k] = ''; $data['watermarktext']['shadowcolor'][$k] = ''; } } $data['styles'] = array(); foreach(C::t('common_style')->fetch_all_data(false, 1) as $style) { $data['styles'][$style['styleid']] = dhtmlspecialchars($style['name']); } $exchcredits = array(); $allowexchangein = $allowexchangeout = FALSE; foreach((array)$data['extcredits'] as $id => $credit) { $data['extcredits'][$id]['img'] = $credit['img'] ? '<img style="vertical-align:middle" src="'.$credit['img'].'" />' : ''; if(!empty($credit['ratio'])) { $exchcredits[$id] = $credit; $credit['allowexchangein'] && $allowexchangein = TRUE; $credit['allowexchangeout'] && $allowexchangeout = TRUE; } $data['creditnotice'] && $data['creditnames'][] = str_replace("'", "\'", dhtmlspecialchars($id.'|'.$credit['title'].'|'.$credit['unit'])); } $data['creditnames'] = $data['creditnotice'] ? @implode(',', $data['creditnames']) : ''; $creditstranssi = explode(',', $data['creditstrans']); $data['creditstrans'] = $creditstranssi[0]; unset($creditstranssi[0]); $data['creditstransextra'] = $creditstranssi; for($i = 1;$i < 11;$i++) { $data['creditstransextra'][$i] = $data['creditstrans'] ? (!$data['creditstransextra'][$i] ? $data['creditstrans'] : $data['creditstransextra'][$i]) : 0; } $data['exchangestatus'] = $allowexchangein && $allowexchangeout; $data['transferstatus'] = isset($data['extcredits'][$data['creditstrans']]); list($data['zoomstatus'], $data['imagemaxwidth']) = explode("\t", $data['zoomstatus']); $data['imagemaxwidth'] = intval($data['imagemaxwidth']); require_once DISCUZ_ROOT.'./config/config_ucenter.php'; $data['ucenterurl'] = UC_API; foreach(C::t('common_magic')->fetch_all_data(1) as $magic) { $magic['identifier'] = str_replace(':', '_', $magic['identifier']); $data['magics'][$magic['identifier']] = $magic['name']; } $data['tradeopen'] = C::t('common_usergroup_field')->count_by_field('allowposttrade', 1) ? 1 : 0; $data['medalstatus'] = intval(C::t('forum_medal')->count_by_available()); $focus = array(); if($data['focus']['data']) { foreach($data['focus']['data'] as $k => $v) { if($v['available'] && $v['position']) { foreach($v['position'] as $position) { $focus[$position][$k] = $k; } } } } $data['focus'] = $focus; list($data['plugins'], $data['pluginlinks'], $data['hookscript'], $data['hookscriptmobile'], $data['threadplugins'], $data['specialicon']) = get_cachedata_setting_plugin(); if(empty($data['defaultindex'])) $data['defaultindex'] = array(); list($data['navs'], $data['subnavs'], $data['menunavs'], $data['navmns'], $data['navmn'], $data['navdms'], $data['navlogos']) = get_cachedata_mainnav(); $data['footernavs'] = get_cachedata_footernav(); $data['spacenavs'] = get_cachedata_spacenavs(); $data['mynavs'] = get_cachedata_mynavs(); $data['topnavs'] = get_cachedata_topnav(); $data['profilenode'] = get_cachedata_threadprofile(); require_once DISCUZ_ROOT.'./uc_client/client.php'; $ucapparray = uc_app_ls(); $data['allowsynlogin'] = isset($ucapparray[UC_APPID]['synlogin']) ? $ucapparray[UC_APPID]['synlogin'] : 1; $appnamearray = array('UCHOME','XSPACE','DISCUZ','SUPESITE','SUPEV','ECSHOP','ECMALL','OTHER'); $data['ucapp'] = $data['ucappopen'] = array(); $data['uchomeurl'] = ''; $data['discuzurl'] = $_G['siteurl']; $appsynlogins = 0; foreach($ucapparray as $apparray) { if($apparray['appid'] != UC_APPID) { if(!empty($apparray['synlogin'])) { $appsynlogins = 1; } if($data['uc']['navlist'][$apparray['appid']] && $data['uc']['navopen']) { $data['ucapp'][$apparray['appid']]['name'] = $apparray['name']; $data['ucapp'][$apparray['appid']]['url'] = $apparray['url']; } } else { $data['discuzurl'] = $apparray['url']; } if(!empty($apparray['viewprourl'])) { $data['ucapp'][$apparray['appid']]['viewprourl'] = $apparray['url'].$apparray['viewprourl']; } foreach($appnamearray as $name) { if($apparray['type'] == $name && $apparray['appid'] != UC_APPID) { $data['ucappopen'][$name] = 1; if($name == 'UCHOME') { $data['uchomeurl'] = $apparray['url']; } elseif($name == 'XSPACE') { $data['xspaceurl'] = $apparray['url']; } } } } $data['allowsynlogin'] = $data['allowsynlogin'] && $appsynlogins ? 1 : 0; $data['homeshow'] = $data['uchomeurl'] && $data['uchome']['homeshow'] ? $data['uchome']['homeshow'] : '0'; unset($data['allowthreadplugin']); if($data['jspath'] == 'data/cache/') { writetojscache(); } elseif(!$data['jspath']) { $data['jspath'] = 'static/js/'; } if($data['cacheindexlife']) { $cachedir = DISCUZ_ROOT.'./'.$data['cachethreaddir']; $tidmd5 = substr(md5(0), 3); @unlink($cachedir.'/'.$tidmd5[0].'/'.$tidmd5[1].'/'.$tidmd5[2].'/0.htm'); } $reginputbwords = array('username', 'password', 'password2', 'email'); if(in_array($data['reginput']['username'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['username'])) { $data['reginput']['username'] = random(6); } if(in_array($data['reginput']['password'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['password'])) { $data['reginput']['password'] = random(6); } if(in_array($data['reginput']['password2'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['password2'])) { $data['reginput']['password2'] = random(6); } if(in_array($data['reginput']['email'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['email'])) { $data['reginput']['email'] = random(6); } $defaultcurhost = empty($_G['setting']['domain']['app']['default']) ? '{CURHOST}' : $_G['setting']['domain']['app']['default']; $output = array('str'=>array(), 'preg' => array()); //str为二级域名的查找和替换,preg为rewrite和默认域名的查找和替换 $_G['domain'] = array(); if(is_array($_G['setting']['domain']['app'])) { $apps = $_G['setting']['domain']['app']; $repflag = $apps['portal'] || $apps['forum'] || $apps['group'] || $apps['home'] || $apps['default']; foreach($apps as $app => $domain) { if(in_array($app, array('default', 'mobile'))) { continue; } $appphp = "{$app}.php"; if(!$domain) { $domain = $defaultcurhost; } if($domain != '{CURHOST}') { $domain = 'http://'.$domain.$_G['siteport'].'/'; } if($repflag) { $output['str']['search'][$app] = "<a href=\"{$app}.php"; $output['str']['replace'][$app] = '<a href="'.$domain.$appphp; $_G['domain']['pregxprw'][$app] = '<a href\="('.preg_quote($domain, '/').')'.$appphp; } else { $_G['domain']['pregxprw'][$app] = '<a href\="()'.$appphp; } } } if($_G['setting']['rewritestatus'] || $output['str']['search']) { if($_G['setting']['rewritestatus']) { require_once libfile('function/admincp'); $output['preg'] = rewritedata(0); } if($output['preg']) { foreach($data['footernavs'] as $id => $nav) { $data['footernavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']); } foreach($data['spacenavs'] as $id => $nav) { $data['spacenavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']); } foreach($data['mynavs'] as $id => $nav) { $data['mynavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']); } foreach($data['topnavs'] as $id => $nav) { $data['topnavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']); } foreach($data['plugins']['jsmenu'] as $key => $nav) { $data['plugins']['jsmenu'][$key]['url'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['url']); } } } $data['output'] = $output; $data['connect'] = in_array('qqconnect', $data['plugins']['available']) ? $data['connect'] : array(); savecache('setting', $data); $_G['setting'] = $data; }
showtablerow('', array('class="td24"'), array($lang['callback_url'], HD_CALLBACK_URL)); showtablerow('', array('class="td24"'), array($lang['host_url'], HD_API_HOST)); if (!isset($hd_token)) { $oauth = new HaoDaiOAuth(HD_AKEY, HD_SKEY); $auth_url = $oauth->getAuthorizeURL(HD_CALLBACK_URL); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="red">' . $lang['callback_expired'] . '</font> <a href="' . $auth_url . '"><img src="source/plugin/dzapp_haodai/images/haodai_login.png" class="vmiddle"></a>')); } else { if (isset($hd_token['expires']) && TIMESTAMP > $hd_token['expires'] - 3600) { $client = new HaoDaiClient(HD_AKEY, HD_SKEY); $client->set_debug(0); $result = $client->haodai_check_AccessToken(); if ($result['rs_code'] != '1000') { if ($result['rs_code'] == '2100') { $new_hd_token = $client->oauth->getAccessToken('token', $hd_token); require_once libfile('function/cache'); writetocache('dzapp_haodai_setting', getcachevars(array('hd_token' => $new_hd_token))); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="green">' . $lang['valid'] . '</font>')); } else { $auth_url = $client->oauth->getAuthorizeURL(HD_CALLBACK_URL); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="red">' . $lang['callback_expired'] . '</font> <a href="' . $auth_url . '"><img src="source/plugin/dzapp_haodai/images/haodai_login.png" class="vmiddle"></a>')); } } else { showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="green">' . $lang['valid'] . '</font>')); } } elseif (isset($hd_token['expires']) && TIMESTAMP < $hd_token['expires'] - 3600) { showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="green">' . $lang['valid'] . '</font>')); } else { $oauth = new HaoDaiOAuth(HD_AKEY, HD_SKEY); $auth_url = $oauth->getAuthorizeURL(HD_CALLBACK_URL); showtablerow('', array('class="td24"'), array($lang['callback_status'], '<font color="red">' . $lang['callback_expired'] . '</font> <a href="' . $auth_url . '"><img src="source/plugin/dzapp_haodai/images/haodai_login.png" class="vmiddle"></a>')); }
function get_cachedata_setting_plugin() { global $_G; $data = array(); $data['plugins'] = $data['pluginlinks'] = $data['hookscript'] = $data['threadplugins'] = $data['specialicon'] = $adminmenu = $scriptlang = array(); $query = DB::query("SELECT pluginid, available, name, identifier, directory, datatables, modules, version FROM " . DB::table('common_plugin') . ""); $data['plugins']['available'] = array(); while ($plugin = DB::fetch($query)) { $addadminmenu = $plugin['available'] && DB::result_first("SELECT count(*) FROM " . DB::table('common_pluginvar') . " WHERE pluginid='{$plugin['pluginid']}'") ? TRUE : FALSE; $plugin['modules'] = unserialize($plugin['modules']); if ($plugin['available']) { $data['plugins']['available'][] = $plugin['identifier']; $data['plugins']['version'][$plugin['identifier']] = $plugin['version']; if (!empty($plugin['modules']['extra']['langexists'])) { @(include DISCUZ_ROOT . './data/plugindata/' . $plugin['identifier'] . '.lang.php'); } } $plugin['directory'] = $plugin['directory'] . (!empty($plugin['directory']) && substr($plugin['directory'], -1) != '/' ? '/' : ''); if (is_array($plugin['modules'])) { unset($plugin['modules']['extra']); foreach ($plugin['modules'] as $k => $module) { if ($plugin['available'] && isset($module['name'])) { $k = ''; switch ($module['type']) { case 1: $navtype = 0; case 23: if ($module['type'] == 23) { $navtype = 1; } case 24: if ($module['type'] == 24) { $navtype = 2; } case 25: if ($module['type'] == 25) { $navtype = 3; } $module['url'] = $module['url'] ? $module['url'] : 'plugin.php?id=' . $plugin['identifier'] . ':' . $module['name']; if (!DB::result_first("SELECT count(*) FROM " . DB::table('common_nav') . " WHERE navtype='{$navtype}' AND type='3' AND identifier='{$plugin['identifier']}'")) { DB::insert('common_nav', array('name' => $module['menu'], 'title' => $module['navtitle'], 'url' => $module['url'], 'type' => 3, 'identifier' => $plugin['identifier'], 'navtype' => $navtype, 'available' => 1, 'icon' => $module['navicon'], 'subname' => $module['navsubname'], 'suburl' => $module['navsuburl'])); } break; case 5: $k = 'jsmenu'; $module['url'] = $module['url'] ? $module['url'] : 'plugin.php?id=' . $plugin['identifier'] . ':' . $module['name']; list($module['menu'], $module['title']) = explode('/', $module['menu']); $module['menu'] = $module['type'] == 1 ? $module['menu'] . ($module['title'] ? '<span>' . $module['title'] . '</span>' : '') : $module['menu']; $data['plugins'][$k][] = array('displayorder' => $module['displayorder'], 'adminid' => $module['adminid'], 'url' => "<a id=\"mn_plink_{$module['name']}\" href=\"{$module['url']}\">{$module['menu']}</a>"); break; case 14: $k = 'faq'; case 15: $k = !$k ? 'modcp_base' : $k; case 16: $k = !$k ? 'modcp_tools' : $k; case 7: $k = !$k ? 'spacecp' : $k; case 17: $k = !$k ? 'spacecp_profile' : $k; case 19: $k = !$k ? 'spacecp_credit' : $k; $data['plugins'][$k][$plugin['identifier'] . ':' . $module['name']] = array('displayorder' => $module['displayorder'], 'adminid' => $module['adminid'], 'name' => $module['menu'], 'url' => $module['url'], 'directory' => $plugin['directory']); break; case 21: $k = !$k ? 'portalcp' : $k; $data['plugins'][$k][$plugin['identifier'] . ':' . $module['name']] = array('displayorder' => $module['displayorder'], 'adminid' => $module['adminid'], 'name' => $module['menu'], 'url' => $module['url'], 'directory' => $plugin['directory']); break; case 3: $addadminmenu = TRUE; break; case 4: $data['plugins']['include'][$plugin['identifier']] = array('displayorder' => $module['displayorder'], 'adminid' => $module['adminid'], 'script' => $plugin['directory'] . $module['name']); break; case 11: $script = $plugin['directory'] . $module['name']; @(include_once DISCUZ_ROOT . './source/plugin/' . $script . '.class.php'); $classes = get_declared_classes(); $classnames = array(); $cnlen = strlen('plugin_' . $plugin['identifier']); foreach ($classes as $classname) { if (substr($classname, 0, $cnlen) == 'plugin_' . $plugin['identifier']) { $hscript = substr($classname, $cnlen + 1); $classnames[$hscript ? $hscript : 'global'] = $classname; } } foreach ($classnames as $hscript => $classname) { $hookmethods = get_class_methods($classname); foreach ($hookmethods as $funcname) { $v = explode('_', $funcname); $curscript = $v[0]; if (!$curscript || $classname == $funcname) { continue; } if (!@in_array($script, $data['hookscript'][$hscript][$curscript]['module'])) { $data['hookscript'][$hscript][$curscript]['module'][$plugin['identifier']] = $script; $data['hookscript'][$hscript][$curscript]['adminid'][$plugin['identifier']] = $module['adminid']; } if (preg_match('/\\_output$/', $funcname)) { $varname = preg_replace('/\\_output$/', '', $funcname); $data['hookscript'][$hscript][$curscript]['outputfuncs'][$varname][] = array('displayorder' => $module['displayorder'], 'func' => array($plugin['identifier'], $funcname)); } else { $data['hookscript'][$hscript][$curscript]['funcs'][$funcname][] = array('displayorder' => $module['displayorder'], 'func' => array($plugin['identifier'], $funcname)); } } } break; case 12: $script = $plugin['directory'] . $module['name']; @(include_once DISCUZ_ROOT . './source/plugin/' . $script . '.class.php'); if (class_exists('threadplugin_' . $plugin['identifier'])) { $classname = 'threadplugin_' . $plugin['identifier']; $hookclass = new $classname(); if ($hookclass->name) { $data['threadplugins'][$plugin['identifier']]['name'] = $hookclass->name; $data['threadplugins'][$plugin['identifier']]['icon'] = $hookclass->iconfile; $data['threadplugins'][$plugin['identifier']]['module'] = $script; } } break; } } } } if ($addadminmenu) { $adminmenu[] = array('url' => "plugins&operation=config&do={$plugin['pluginid']}", 'action' => 'plugins_config_' . $plugin['pluginid'], 'name' => $plugin['name']); } } $_G['setting']['plugins']['available'] = $data['plugins']['available']; $file = DISCUZ_ROOT . './data/plugindata/lang_plugin.php'; if ($fp = @fopen($file, 'wb')) { fwrite($fp, "<?php\n" . getcachevars(array('lang' => $scriptlang)) . '?>'); fclose($fp); } writetocache('adminmenu', getcachevars(array('adminmenu' => $adminmenu))); $data['pluginhooks'] = array(); foreach ($data['hookscript'] as $hscript => $hookscript) { foreach ($hookscript as $curscript => $scriptdata) { if (is_array($scriptdata['funcs'])) { foreach ($scriptdata['funcs'] as $funcname => $funcs) { usort($funcs, 'pluginmodulecmp'); $tmp = array(); foreach ($funcs as $k => $v) { $tmp[$k] = $v['func']; } $data['hookscript'][$hscript][$curscript]['funcs'][$funcname] = $tmp; } } if (is_array($scriptdata['outputfuncs'])) { foreach ($scriptdata['outputfuncs'] as $funcname => $funcs) { usort($funcs, 'pluginmodulecmp'); $tmp = array(); foreach ($funcs as $k => $v) { $tmp[$k] = $v['func']; } $data['hookscript'][$hscript][$curscript]['outputfuncs'][$funcname] = $tmp; } } } } foreach (array('links', 'spacecp', 'include', 'jsmenu', 'space', 'spacecp', 'spacecp_profile', 'spacecp_credit', 'faq', 'modcp_base', 'modcp_member', 'modcp_forum') as $pluginkey) { if (is_array($data['plugins'][$pluginkey])) { if (in_array($pluginkey, array('space', 'spacecp', 'spacecp_profile', 'spacecp_credit', 'faq', 'modcp_base', 'modcp_tools'))) { uasort($data['plugins'][$pluginkey], 'pluginmodulecmp'); } else { usort($data['plugins'][$pluginkey], 'pluginmodulecmp'); } foreach ($data['plugins'][$pluginkey] as $key => $module) { unset($data['plugins'][$pluginkey][$key]['displayorder']); } } } return array($data['plugins'], $data['pluginlinks'], $data['hookscript'], $data['threadplugins'], $data['specialicon']); }