function updatecache($cachename = '') { global $db, $bbname, $tablepre, $maxbdays; static $cachescript = array('settings' => array('settings'), 'usergroups' => array('usergroups'), 'ipbanned' => array('ipbanned')); if ($maxbdays) { $cachescript['birthdays'] = array('birthdays'); $cachescript['index'][] = 'birthdays_index'; } $updatelist = empty($cachename) ? array_values($cachescript) : (is_array($cachename) ? array('0' => $cachename) : array(array('0' => $cachename))); $updated = array(); foreach ($updatelist as $value) { foreach ($value as $cname) { if (empty($updated) || !in_array($cname, $updated)) { $updated[] = $cname; getcachearray($cname); } } } foreach ($cachescript as $script => $cachenames) { if (empty($cachename) || !is_array($cachename) && in_array($cachename, $cachenames) || is_array($cachename) && array_intersect($cachename, $cachenames)) { $cachedata = ''; $query = $db->query("SELECT data FROM {$tablepre}caches WHERE cachename in(" . implodeids($cachenames) . ")"); while ($data = $db->fetch_array($query)) { $cachedata .= $data['data']; } writetocache($script, $cachenames, $cachedata); } } if (!$cachename || $cachename == 'admingroups') { $query = $db->query("SELECT * FROM {$tablepre}admingroups"); while ($data = $db->fetch_array($query)) { writetocache($data['admingid'], '', getcachevars($data), 'admingroup_'); } } }
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 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 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)); }
$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\');
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'];
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; }
<?php if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) { exit('Access Denied'); } if (submitcheck('submit')) { require_once libfile('function/cache'); writetocache('paulissue_setting', getcachevars(array('PACACHE' => array('issuetypeid' => $_G['gp_issuetypeid'])))); $cache = serialize($_G['gp_issuetypeid']); $cachedata = "\$PACACHE['issuetypeid'] = " . arrayeval($_G['gp_issuetypeid']) . ";\n\n"; DB::query("REPLACE INTO " . DB::table('common_cache') . " (cachekey, cachevalue, dateline) VALUES ('paulissue_setting', '" . addslashes($cachedata) . "', '{$_G['timestamp']}')"); cpmsg(lang('plugin/dsu_paulissue', 'ht_1'), '', 'succeed'); } @(include_once DISCUZ_ROOT . './data/cache/cache_paulissue_setting.php'); if (is_array($PACACHE)) { foreach ($PACACHE['issuetypeid'] as $key => $item) { $dt[$key] = $item['dt']; $ot[$key] = $item['ot']; } } showformheader("plugins&operation=config&do=13&identifier=dsu_paulissue&pmod=admin"); showtableheader('dsu_paulissue'); showsubtitle(array(lang('plugin/dsu_paulissue', 'ht_2'), lang('plugin/dsu_paulissue', 'ht_3'), lang('plugin/dsu_paulissue', 'ht_4'))); loadcache('plugin'); $ofids = dimplode(unserialize($_G['cache']['plugin']['dsu_paulissue']['ofid'])); $query = DB::query("SELECT name,fid FROM " . DB::table('forum_forum') . " WHERE fid IN ({$ofids}) ORDER BY fid"); while ($forum = DB::fetch($query)) { $list = showtablerow('', array('class="td35"', 'class="td35"', 'class="td35"', 'class="td35"', 'class="td35"', 'class="td35"', 'class="td35"', 'class="td35"'), array($forum['name'], '<input type="text" name="issuetypeid[' . $forum['fid'] . '][dt]" id="dt" value="' . $dt[$forum['fid']] . '">', '<input type="text" name="issuetypeid[' . $forum['fid'] . '][ot]" id="ot" value="' . $ot[$forum['fid']] . '">'), TRUE); echo $list; } showsubmit('submit', 'submit', '', '');
$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 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; }
$value['zone_name'] = diconv($value['zone_name'], 'UTF-8', CHARSET); $value['Province'] = diconv($value['Province'], 'UTF-8', CHARSET); $value['area'] = diconv($value['area'], 'UTF-8', CHARSET); $zones[$value['s_EN']] = $value['zone_name']; $zonesort['provinces'][$value['Province']][$value['s_EN']] = $value['zone_name']; $zonesort['letter_raw'][$value['letter']][$value['s_EN']] = $value['zone_name']; $zonesort['area'][$value['area']][$value['s_EN']] = $value['zone_name']; } foreach (range('A', 'Z') as $letter) { if (!empty($zonesort['letter_raw'][$letter])) { $zonesort['letter'][$letter] = $zonesort['letter_raw'][$letter]; } } require_once libfile('function/cache'); writetocache('dzapp_haodai_city', getcachevars(array('zones' => $zones))); writetocache('dzapp_haodai_city_sort', getcachevars(array('zonesort' => $zonesort))); } else { showmessage('dzapp_haodai:callback_error_admin'); } } else { @(include_once DISCUZ_ROOT . './data/sysdata/cache_dzapp_haodai_city_sort.php'); } if (!$_GET['city']) { include template('dzapp_haodai:city'); } else { if (!$_GET['city'] || $_GET['formhash'] != FORMHASH || !$zones[$_GET['city']]) { showmessage('dzapp_haodai:city_choose_wrong'); } dsetcookie('HD_CITY', $_GET['city']); showmessage('dzapp_haodai:city_choose_ok', 'plugin.php?id=dzapp_haodai'); }
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: check.php 32817 2013-03-13 11:29:12Z monkey $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } 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'], '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 updatespacesettings() { global $db, $tablepre, $initcredits; $initcreditarray = explode(',', $initcredits); $tmp = array(); for ($i = 1; $i <= 8; $i++) { $tmp['extcredits' . $i] = $initcreditarray[$i]; } $lowercredits = intval($initcredits); $groupinfo = $db->fetch_first("SELECT groupid, readaccess FROM {$tablepre}usergroups WHERE creditshigher<={$lowercredits} AND creditslower>{$lowercredits} ORDER BY creditshigher LIMIT 1"); $fids = 0; $query = $db->query("SELECT ff.fid, ff.viewperm, ff.formulaperm FROM {$tablepre}forumfields ff,{$tablepre}forums f WHERE f.fid=ff.fid AND f.status>'0' AND ff.password=''"); while ($forum = $db->fetch_array($query)) { if (empty($forum['viewperm']) || in_array($groupinfo['groupid'], explode("\t", $forum['viewperm']))) { $fids .= ',' . $forum['fid']; } } $spacesettings = array('parms' => array('infids' => $fids, 'groupid' => $groupinfo['groupid'], 'readaccess' => $groupinfo['readaccess'])); writetocache('spacesettings', '', getcachevars($spacesettings)); }
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; }
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 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']); }
$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']);
$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,
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 updatecache($cachename = '') { global $db, $bbname, $tablepre, $maxbdays; static $cachescript = array('settings' => array('settings'), 'forums' => array('forums'), 'icons' => array('icons'), 'ranks' => array('ranks'), 'usergroups' => array('usergroups'), 'request' => array('request'), 'medals' => array('medals'), 'magics' => array('magics'), 'topicadmin' => array('modreasons'), 'archiver' => array('advs_archiver'), 'register' => array('advs_register'), 'faqs' => array('faqs'), 'secqaa' => array('secqaa'), 'censor' => array('censor'), 'ipbanned' => array('ipbanned'), 'smilies' => array('smilies_js'), 'index' => array('announcements', 'onlinelist', 'forumlinks', 'advs_index'), 'forumdisplay' => array('smilies', 'announcements_forum', 'globalstick', 'floatthreads', 'forums', 'icons', 'onlinelist', 'advs_forumdisplay'), 'viewthread' => array('smilies', 'smileytypes', 'forums', 'usergroups', 'ranks', 'bbcodes', 'smilies', 'advs_viewthread', 'tags_viewthread', 'custominfo', 'groupicon'), 'post' => array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'icons'), 'profilefields' => array('fields_required', 'fields_optional'), 'viewpro' => array('fields_required', 'fields_optional', 'custominfo'), 'bbcodes' => array('bbcodes', 'smilies', 'smileytypes')); if ($maxbdays) { $cachescript['birthdays'] = array('birthdays'); $cachescript['index'][] = 'birthdays_index'; } $updatelist = empty($cachename) ? array_values($cachescript) : (is_array($cachename) ? array('0' => $cachename) : array(array('0' => $cachename))); $updated = array(); foreach ($updatelist as $value) { foreach ($value as $cname) { if (empty($updated) || !in_array($cname, $updated)) { $updated[] = $cname; getcachearray($cname); } } } foreach ($cachescript as $script => $cachenames) { if (empty($cachename) || !is_array($cachename) && in_array($cachename, $cachenames) || is_array($cachename) && array_intersect($cachename, $cachenames)) { $cachedata = ''; $query = $db->query("SELECT data FROM {$tablepre}caches WHERE cachename in(" . implodeids($cachenames) . ")"); while ($data = $db->fetch_array($query)) { $cachedata .= $data['data']; } writetocache($script, $cachenames, $cachedata); } } if (!$cachename || $cachename == 'styles') { $stylevars = $styledata = $styleicons = array(); $defaultstyleid = $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable = 'styleid'"); list(, $imagemaxwidth) = explode("\t", $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable = 'zoomstatus'")); $imagemaxwidth = $imagemaxwidth ? $imagemaxwidth : 600; $imagemaxwidthint = intval($imagemaxwidth); $query = $db->query("SELECT sv.* FROM {$tablepre}stylevars sv LEFT JOIN {$tablepre}styles s ON s.styleid = sv.styleid AND (s.available=1 OR s.styleid='{$defaultstyleid}')"); while ($var = $db->fetch_array($query)) { $stylevars[$var['styleid']][$var['variable']] = $var['substitute']; } $query = $db->query("SELECT s.*, t.directory AS tpldir FROM {$tablepre}styles s LEFT JOIN {$tablepre}templates t ON s.templateid=t.templateid WHERE s.available=1 OR s.styleid='{$defaultstyleid}'"); while ($data = $db->fetch_array($query)) { $data = array_merge($data, $stylevars[$data['styleid']]); $datanew = array(); $data['imgdir'] = $data['imgdir'] ? $data['imgdir'] : 'images/default'; $data['styleimgdir'] = $data['styleimgdir'] ? $data['styleimgdir'] : $data['imgdir']; foreach ($data as $k => $v) { if (substr($k, -7, 7) == 'bgcolor') { $newkey = substr($k, 0, -7) . 'bgcode'; $datanew[$newkey] = setcssbackground($data, $k); } } $data = array_merge($data, $datanew); $styleicons[$data['styleid']] = $data['menuhover']; if (strstr($data['boardimg'], ',')) { $flash = explode(",", $data['boardimg']); $flash[0] = trim($flash[0]); $flash[0] = preg_match('/^http:\\/\\//i', $flash[0]) ? $flash[0] : $data['styleimgdir'] . '/' . $flash[0]; $data['boardlogo'] = "<embed src=\"" . $flash[0] . "\" width=\"" . trim($flash[1]) . "\" height=\"" . trim($flash[2]) . "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"></embed>"; } else { $data['boardimg'] = preg_match('/^http:\\/\\//i', $data['boardimg']) ? $data['boardimg'] : $data['styleimgdir'] . '/' . $data['boardimg']; $data['boardlogo'] = "<img src=\"{$data['boardimg']}\" alt=\"{$bbname}\" border=\"0\" />"; } $data['bold'] = $data['nobold'] ? 'normal' : 'bold'; $contentwidthint = intval($data['contentwidth']); $contentwidthint = $contentwidthint ? $contentwidthint : 600; if (substr(trim($data['contentwidth']), -1, 1) != '%') { if (substr(trim($imagemaxwidth), -1, 1) != '%') { $data['imagemaxwidth'] = $imagemaxwidthint > $contentwidthint ? $contentwidthint : $imagemaxwidthint; } else { $data['imagemaxwidth'] = intval($contentwidthint * $imagemaxwidthint / 100); } } else { if (substr(trim($imagemaxwidth), -1, 1) != '%') { $data['imagemaxwidth'] = '%' . $imagemaxwidthint; } else { $data['imagemaxwidth'] = ($imagemaxwidthint > $contentwidthint ? $contentwidthint : $imagemaxwidthint) . '%'; } } $data['verhash'] = random(3); $styledata[] = $data; } foreach ($styledata as $data) { $data['styleicons'] = $styleicons; writetocache($data['styleid'], '', getcachevars($data, 'CONST'), 'style_'); writetocsscache($data); } } if (!$cachename || $cachename == 'usergroups') { $query = $db->query("SELECT * FROM {$tablepre}usergroups u\r\n\t\t\t\t\tLEFT JOIN {$tablepre}admingroups a ON u.groupid=a.admingid"); while ($data = $db->fetch_array($query)) { $ratearray = array(); if ($data['raterange']) { foreach (explode("\n", $data['raterange']) as $rating) { $rating = explode("\t", $rating); $ratearray[$rating[0]] = array('min' => $rating[1], 'max' => $rating[2], 'mrpd' => $rating[3]); } } $data['raterange'] = $ratearray; $data['grouptitle'] = $data['color'] ? '<font color="' . $data['color'] . '">' . $data['grouptitle'] . '</font>' : $data['grouptitle']; $data['grouptype'] = $data['type']; $data['grouppublic'] = $data['system'] != 'private'; $data['groupcreditshigher'] = $data['creditshigher']; $data['groupcreditslower'] = $data['creditslower']; unset($data['type'], $data['system'], $data['creditshigher'], $data['creditslower'], $data['color'], $data['groupavatar'], $data['admingid']); writetocache($data['groupid'], '', getcachevars($data), 'usergroup_'); } } if (!$cachename || $cachename == 'admingroups') { $query = $db->query("SELECT * FROM {$tablepre}admingroups"); while ($data = $db->fetch_array($query)) { writetocache($data['admingid'], '', getcachevars($data), 'admingroup_'); } } if (!$cachename || $cachename == 'plugins') { $query = $db->query("SELECT pluginid, available, adminid, name, identifier, datatables, directory, copyright, modules FROM {$tablepre}plugins"); while ($plugin = $db->fetch_array($query)) { $data = array_merge($plugin, array('modules' => array()), array('vars' => array())); $plugin['modules'] = unserialize($plugin['modules']); if (is_array($plugin['modules'])) { foreach ($plugin['modules'] as $module) { $data['modules'][$module['name']] = $module; } } $queryvars = $db->query("SELECT variable, value FROM {$tablepre}pluginvars WHERE pluginid='{$plugin['pluginid']}'"); while ($var = $db->fetch_array($queryvars)) { $data['vars'][$var['variable']] = $var['value']; } writetocache($plugin['identifier'], '', "\$_DPLUGIN['{$plugin['identifier']}'] = " . arrayeval($data), 'plugin_'); } } if (!$cachename || $cachename == 'threadsorts') { $sortlist = $templatedata = array(); $query = $db->query("SELECT t.typeid AS sortid, tt.optionid, tt.title, tt.type, tt.rules, tt.identifier, tt.description, tv.required, tv.unchangeable, tv.search\r\n\t\t\tFROM {$tablepre}threadtypes t\r\n\t\t\tLEFT JOIN {$tablepre}typevars tv ON t.typeid=tv.sortid\r\n\t\t\tLEFT JOIN {$tablepre}typeoptions tt ON tv.optionid=tt.optionid\r\n\t\t\tWHERE t.special='1' AND tv.available='1'\r\n\t\t\tORDER BY tv.displayorder"); while ($data = $db->fetch_array($query)) { $data['rules'] = unserialize($data['rules']); $sortid = $data['sortid']; $optionid = $data['optionid']; $sortlist[$sortid][$optionid] = array('title' => dhtmlspecialchars($data['title']), 'type' => dhtmlspecialchars($data['type']), 'identifier' => dhtmlspecialchars($data['identifier']), 'description' => dhtmlspecialchars($data['description']), 'required' => intval($data['required']), 'unchangeable' => intval($data['unchangeable']), 'search' => intval($data['search'])); if (in_array($data['type'], array('select', 'checkbox', 'radio'))) { if ($data['rules']['choices']) { $choices = array(); foreach (explode("\n", $data['rules']['choices']) as $item) { list($index, $choice) = explode('=', $item); $choices[trim($index)] = trim($choice); } $sortlist[$sortid][$optionid]['choices'] = $choices; } else { $typelist[$sortid][$optionid]['choices'] = array(); } } elseif (in_array($data['type'], array('text', 'textarea'))) { $sortlist[$sortid][$optionid]['maxlength'] = intval($data['rules']['maxlength']); } elseif ($data['type'] == 'image') { $sortlist[$sortid][$optionid]['maxwidth'] = intval($data['rules']['maxwidth']); $sortlist[$sortid][$optionid]['maxheight'] = intval($data['rules']['maxheight']); } elseif ($data['type'] == 'number') { $sortlist[$sortid][$optionid]['maxnum'] = intval($data['rules']['maxnum']); $sortlist[$sortid][$optionid]['minnum'] = intval($data['rules']['minnum']); } } $query = $db->query("SELECT typeid, description, template FROM {$tablepre}threadtypes WHERE special='1'"); while ($data = $db->fetch_array($query)) { $templatedata[$data['typeid']] = $data['template']; $threaddesc[$data['typeid']] = dhtmlspecialchars($data['description']); } foreach ($sortlist as $sortid => $option) { writetocache($sortid, '', "\$_DTYPE = " . arrayeval($option) . ";\n\n\$_DTYPETEMPLATE = \"" . str_replace('"', '\\"', $templatedata[$sortid]) . "\";\n", 'threadsort_'); } } }