function main() { global $_G; $id = intval($_GET['id']); if (!$id) { msg('抱歉,ID不存在'); return false; } $cache_name = 'img_' . $id; $cache = memory('get', $cache_name); if (is_array($cache)) { $img = $cache; } else { $img = D(array('and' => ' AND id = ' . $id, 'table' => __CLASS__)); if (!$img[id]) { msg('抱歉,当前信息不存在'); return false; } DB::update('img', array('like' => $img[like] + 1), 'id=' . $id); $up = D(array('and' => ' AND id <' . $id, 'table' => __CLASS__, 'order' => 'id DESC')); $down = D(array('and' => ' AND id >' . $id, 'table' => __CLASS__, 'order' => 'id ASC')); $img[up] = $up[id] ? '<a href="' . $up[url] . '">' . $up[title] . '</a>' : '没有了'; $img[down] = $down[id] ? '<a href="' . $down[url] . '">' . $down[title] . '</a>' : '没有了'; // $img[message] = preg_replace("/###\{(.*?)\}###/ies","parse_img_goods('\\1')",$img[message]); //$img[message] = preg_replace("/###\{(.*?)\}###/ies","parse('img_goods','\\1')",$img[message]); memory('set', $cache_name, $img); } $this->add(array('img' => $img)); seo($img['title'], $img['keywords'], $img['description']); $this->show(); }
function global_header_mobile() { global $_G, $show_message; function dsu_signtz() { dheader('Location: plugin.php?id=dsu_paulsign:sign&mobile=yes'); } $var = $_G['cache']['plugin']['dsu_paulsign']; if (defined('IN_dsu_paulsign') || $show_message || defined('IN_dsu_paulsc') || !$_G['uid'] || !$var['ifopen'] || !$var['wap_sign']) { return ''; } $tdtime = gmmktime(0, 0, 0, dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos'])) - $var['tos'] * 3600; $allowmem = memory('check'); if ($var['ftopen'] && in_array($_G['groupid'], unserialize($var['tzgroupid'])) && !in_array($_G['uid'], explode(",", $var['ban'])) && in_array($_G['groupid'], unserialize($var['groups']))) { if ($allowmem && $var['mcacheopen']) { $signtime = memory('get', 'dsu_pualsign_' . $_G['uid']); } if (!$signtime) { $qiandaodb = DB::fetch_first("SELECT time FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'"); $signtime = $qiandaodb['time']; $htime = dgmdate($_G['timestamp'], 'H', $var['tos']); if ($qiandaodb) { if ($allowmem && $var['mcacheopen']) { memory('set', 'dsu_pualsign_' . $_G['uid'], $qiandaodb['time'], 86400); } if ($qiandaodb['time'] < $tdtime) { if ($var['timeopen']) { if (!($htime < $var['stime']) && !($htime > $var['ftime'])) { return dsu_signtz(); } } else { return dsu_signtz(); } } } else { $ttps = DB::fetch_first("SELECT posts FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'"); if ($var['mintdpost'] <= $ttps['posts']) { if ($var['timeopen']) { if (!($htime < $var['stime']) && !($htime > $var['ftime'])) { return dsu_signtz(); } } else { return dsu_signtz(); } } } } else { if ($signtime < $tdtime) { if ($var['timeopen']) { if (!($htime < $var['stime']) && !($htime > $var['ftime'])) { return dsu_signtz(); } } else { return dsu_signtz(); } } } } return '<a href="plugin.php?id=dsu_paulsign:sign">' . lang('plugin/dsu_paulsign', 'name') . '</a>'; }
public function __construct() { $this->_table = 'pre_common_basedata'; $this->_allowmem = memory('check'); $this->_cache_ttl = 86400; parent::__construct(); }
function main() { global $_G; $id = intval($_GET['id']); if ($id < 1) { msg('ID不存在'); return false; } $cache_name = 'article_' . $id; $cache = memory('get', $cache_name); if (is_array($cache)) { $article = $cache; } else { $article = D(array('table' => 'article', 'and' => ' id = ' . $id . ' AND `hide`=0 ')); if (!$article[id]) { msg('抱歉,当前文章不存在或未审核'); } $up = D(array('and' => ' AND id <' . $id, 'table' => __CLASS__, 'order' => 'id DESC')); $down = D(array('and' => ' AND id >' . $id, 'table' => __CLASS__, 'order' => 'id ASC')); $article[up] = $up[id] ? '<a href="' . $up[id_url] . '">' . $up[title] . '</a>' : '没有了'; $article[down] = $down[id] ? '<a href="' . $down[id_url] . '">' . $down[title] . '</a>' : '没有了'; save_history(__CLASS__, $article[id]); DB::update('article', array('views' => $article[views] + 1), 'id=' . $article[id]); memory('set', $cache_name, $article); } $this->add(array('article' => $article)); seo($article['title'], $article['keywords'], $article['description']); $this->show($article['tpl']); }
protected function _getBaseInfo() { global $_G; $info = array(); loadcache(array('userstats', 'historyposts')); $indexData = memory('get', 'forum_index_page_1'); if (is_array($indexData) && $indexData) { $indexData = array(); $info['threads'] = $indexData['threads'] ? $indexData['threads'] : 0; $info['todayPosts'] = $indexData['todayposts'] ? $indexData['todayposts'] : 0; $info['allPosts'] = $indexData['posts'] ? $indexData['posts'] : 0; } else { $threads = $posts = $todayposts = 0; $query = C::t('forum_forum')->fetch_all_by_status(1, 0); foreach ($query as $forum) { if ($forum['type'] != 'group') { $threads += $forum['threads']; $posts += $forum['posts']; $todayposts += $forum['todayposts']; } } $info['threads'] = $threads ? $threads : 0; $info['allPosts'] = $posts ? $posts : 0; $info['todayPosts'] = $todayposts ? $todayposts : 0; } $info['members'] = $_G['cache']['userstats']['totalmembers'] ? intval($_G['cache']['userstats']['totalmembers']) : 0; $postdata = $_G['cache']['historyposts'] ? explode("\t", $_G['cache']['historyposts']) : array(0, 0); $info['yesterdayPosts'] = intval($postdata[0]); return $info; }
public function __construct() { $this->_table = 'common_member_forum_buylog'; $this->_pk = 'uid'; $this->_pre_cache_key = 'common_member'; $this->_allowmem = memory('check'); $this->_cache_ttl = 86400; parent::__construct(); }
public function __construct() { $this->_table = 'common_session'; $this->_pk = 'sid'; $this->_pre_cache_key = 'common_session_'; $this->_allowmem = memory('check'); $this->_cache_ttl = 120; parent::__construct(); }
public static function fetch_all_by_g_id() { $data = memory('get', 'plugin_dsuamupperc_fetch_all_by_g_id'); if ($data) { return $data; } $result = DB::fetch_all("SELECT * FROM %t WHERE id>%d LIMIT %d", array('plugin_dsuamupperc', '-1', '100'), 'id'); memory('set', 'plugin_dsuamupperc_fetch_all_by_g_id', $result, 60); return $result; }
public function delete($val, $unbuffered = false) { if ($val = dintval($val, true)) { $this->_pre_cache_key = 'blockstylecache_'; $this->_cache_ttl = getglobal('setting/memory/diyblock/ttl'); $this->_allowmem = getglobal('setting/memory/diyblock/enable') && memory('check'); return parent::delete($val, $unbuffered); } return false; }
private function member($groups = array()){ $cachekey = 'reply_robots_members'; $members = unserialize(memory('get',$cachekey)); if(is_array($members)){ return $members[array_rand($members)]; }else{ $members = DB::fetch_all("SELECT uid,username FROM ".DB::table('common_member')." WHERE `groupid` IN ({$groups}) LIMIT 100"); memory('set',$cachekey,serialize($members),86400); return $members[array_rand($members)]; } }
function cache() { global $_G; if ($_GET['onsubmit'] && check()) { if ($_GET[postdb][system_cache] == 1) { memory('clear'); loadcache($_G[_config][cache_list], 'update'); } api_post(array('m' => 'cache', 'a' => 'update', 'cache_list' => implode(',', $_G[_config][cache_list]))); remove_dir('web/templates_c/'); cpmsg('更新成功', 'success', 'm=tools&a=cache'); return false; } $this->show('tools/cache'); }
private static function _process_cmd_memory($cmd, $name, $ttl = 0) { $ret = ''; switch ($cmd) { case 'set': $ret = memory('set', 'process_lock_' . $name, time(), $ttl); break; case 'get': $ret = memory('get', 'process_lock_' . $name); break; case 'rm': $ret = memory('rm', 'process_lock_' . $name); } return $ret; }
public function count_by_lasttime($lasttime, $glu = '>=') { $lasttime = intval($lasttime); if (empty($lasttime) || !in_array('>=', '>', '<', '<=')) { return 0; } $mem_key = 'plugin_dsuamupper::count_by_lasttime' . $lasttime . $glu; $data = memory('get', $mem_key); if ($data) { return $data; } $result = DB::result_first("SELECT COUNT(*) FROM " . $this->_table . " WHERE lasttime {$glu} {$lasttime}"); memory('set', $mem_key, $result); return $result; }
function block_getstyle($styleids = array()) { global $_G; static $allowmem = null, $cachettl = null; if ($allowmem === null) { $allowmem = ($cachettl = getglobal('setting/memory/diyblock')) !== null && memory('check'); } $pre = 'blockstyle_'; if ($ret = $styleids && !is_array($styleids) ? $styleids : false) { if ($_G[$pre . $ret]) { return $_G[$pre . $ret]; } else { $styleids = (array) $styleids; } } $cacheprekey = 'blockstylecache_'; $styleids = array_map('intval', $styleids); $styleids = array_unique($styleids); if ($styleids) { if ($allowmem) { if (($cachedata = memory('get', $styleids, $cacheprekey)) !== false) { foreach ($cachedata as $styleid => $style) { $_G[$pre . $styleid] = $style; } if (!($styleids = array_diff($styleids, array_keys($cachedata)))) { return $ret ? $_G[$pre . $ret] : true; } } } if ($styleids) { foreach (C::t('common_block_style')->fetch_all($styleids) as $styleid => $value) { $value['template'] = !empty($value['template']) ? (array) dunserialize($value['template']) : array(); $value['fields'] = !empty($value['fields']) ? (array) dunserialize($value['fields']) : array(); $_G[$pre . $styleid] = $value; if ($allowmem) { memory('set', $cacheprekey . $styleid, $_G[$pre . $styleid], $cachettl); } } } return $ret ? $_G[$pre . $ret] : true; } return array(); }
function _process_cmd_memory($cmd, $name, $ttl = 0) { return memory($cmd, 'process_lock_' . $name, time(), $ttl); }
function block_get($parameter) { global $_G; static $allowmem; if ($allowmem === null) { include_once libfile('function/block'); $allowmem = getglobal('setting/memory/diyblock/enable') && memory('check'); } if (!$allowmem) { block_get_batch($parameter); return true; } $blockids = explode(',', $parameter); $lostbids = array(); foreach ($blockids as $bid) { $bid = intval($bid); if ($bid) { $_G['block'][$bid] = memory('get', 'blockcache_' . $bid); if ($_G['block'][$bid] === null) { $lostbids[] = $bid; } } } if ($lostbids) { block_get_batch(implode(',', $lostbids)); foreach ($lostbids as $bid) { if (isset($_G['block'][$bid])) { memory('set', 'blockcache_' . $bid, $_G['block'][$bid], getglobal('setting/memory/diyblock/ttl')); } } } }
function search_shop() { global $_G, $assign; $sid = $_GET['sid'] ? $_GET['sid'] : $_GET['shop']; $index = array(); //获取相关的 $rs = memory('get', $sid); if ($rs) { $index['xiangguan'] = $rs; } else { $index['xiangguan'] = top('taobaoke', 'get_recommend', 4, $sid, 20); if ($index['xiangguan']) { memory('set', $sid, $index['xiangguan'], 86400); } } $title = $assign['shop']['shop_title']; $shop1 = "专营"; $shop2 = "旗舰"; $shop3 = "专卖"; $and = ""; if (strpos($title, $shop1) !== false) { $and = " AND shop_title like '%{$shop1}%'"; } else { if (strpos($title, $shop2) !== false) { $and = " AND shop_title like '%{$shop2}%'"; } else { if (strpos($title, $shop3) !== false) { $and = " AND shop_title like '%{$shop3}%'"; } } } // $index['tag_shop'] = $this->get_shop($and); $tehui = D(array('and' => '', 'limit' => 20)); $index['tehui'] = $tehui; return $index; }
// } if (!empty($thisvars['uid'])) { $update_data = array('addup' => intval($addup), 'cons' => intval($cons), 'lasttime' => intval($_G['timestamp']), 'time' => intval($today), 'allow' => intval($arr['allow'])); C::t('#dsu_amupper#plugin_dsuamupper')->update($_G['uid'], $update_data); } else { $insert_data = array('uid' => intval($_G['uid']), 'uname' => dhtmlspecialchars("'" . addslashes($_G['username']) . "'"), 'addup' => intval($addup), 'cons' => intval($cons), 'lasttime' => intval($_G['timestamp']), 'time' => intval($today), 'allow' => intval($arr['allow'])); C::t('#dsu_amupper#plugin_dsuamupper')->insert($insert_data); } $jiangliba = 1; // 删除统计缓存 $nt1 = dgmdate($_G['timestamp'], 'i', $_G['setting']['timeoffset']); $nt2 = dgmdate($_G['timestamp'], 's', $_G['setting']['timeoffset']); $nt = $nt1 * 60 + $nt2; $Htime = $_G['timestamp'] - $nt; $mem_key = 'plugin_dsuamupper::count_by_lasttime' . $Htime . '>='; memory('rm', $mem_key); if ($jiangliba == 1) { switch ($thisvars['ms']) { case 1: // 关闭插件 break; case 2: // 无特殊奖励 updatemembercount($_G['uid'], array("extcredits{$thisvars['ptjf']}" => $pt), true, '', 0); break; case 3: // 特殊奖励(N)非循环 if (is_array($teshu)) { foreach ($teshu as $id => $result) { updatemembercount($_G['uid'], array("extcredits{$result['extcredits']}" => $result['reward']), true, '', 0); }
if ($num >= 1 && $num <= 9 && $exacr && $exacz) { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } require_once libfile('function/post'); require_once libfile('function/forum'); $pid = insertpost(array('fid' => $var['fidnumber'], 'tid' => $tidnumber, 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => '', 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => '0', 'anonymous' => '0', 'usesig' => '0', 'htmlon' => '0', 'bbcodeoff' => '0', 'smileyoff' => '0', 'parseurloff' => '0', 'attachment' => '0')); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$tidnumber}' AND fid='{$var['fidnumber']}'", 'UNBUFFERED'); updatepostcredits('+', $_G['uid'], 'reply', $var['fidnumber']); $lastpost = "{$tidnumber}\t" . addslashes($thread['subject']) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); } } if (memory('check')) { memory('set', 'dsu_pualsign_' . $_G['uid'], $_G['timestamp'], 86400); } if ($num == 0) { if ($stats['todayq'] > $stats['highestq']) { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET highestq='{$stats['todayq']}' WHERE id='1'"); } DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET yesterdayq='{$stats['todayq']}',todayq=1 WHERE id='1'"); } else { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET todayq=todayq+1 WHERE id='1'"); } if ($var['lockopen']) { discuz_process::unlock('dsu_paulsign'); } if ($var['tzopen']) { if ($exacr && $exacz) { sign_msg("{$lang[tsn_14]}{$lang[tsn_03]}{$lang[tsn_04]}{$psc}{$lang[tsn_15]}{$lang[tsn_06]} {$_G[setting][extcredits][$var[nrcredit]][title]} {$credit} {$_G[setting][extcredits][$var[nrcredit]][unit]} {$lang[tsn_16]} {$_G[setting][extcredits][$exacr][title]} {$exacz} {$_G[setting][extcredits][$exacr][unit]}." . $another_vip, "forum.php?mod=redirect&tid={$tidnumber}&goto=lastpost#lastpost");
function get_index_memory_by_groupid($key) { $enable = getglobal('setting/memory/forumindex'); if ($enable !== null && memory('check')) { if (IS_ROBOT) { $key = 'for_robot'; } $ret = memory('get', 'forum_index_page_' . $key); define('FORUM_INDEX_PAGE_MEMORY', $ret ? 1 : 0); if ($ret) { return $ret; } } return array('none' => null); }
* [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: topicadmin_merge.php 31741 2012-09-26 08:12:08Z zhangjie $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } if (!$_G['group']['allowmergethread']) { showmessage('no_privilege_mergethread'); } if (!submitcheck('modsubmit')) { include template('forum/topicadmin_action'); } else { //删除缓存 memory('rm', 'forumdisplay_' . $_G['fid']); $posttable = getposttablebytid($_G['tid']); $othertid = intval($_GET['othertid']); $otherposttable = getposttablebytid($othertid); $modaction = 'MRG'; $reason = checkreasonpm(); $other = C::t('forum_thread')->fetch_by_tid_displayorder($othertid, 0); if (!$other) { showmessage('admin_merge_nonexistence'); } elseif ($other['special']) { showmessage('special_noaction'); } if ($othertid == $_G['tid'] || $_G['adminid'] == 3 && $other['fid'] != $_G['forum']['fid']) { showmessage('admin_merge_invalid'); } $other['views'] = intval($other['views']);
disable_nfs_js(); exit; } if (isset($_GET["DISABLE_NFS"])) { disable_nfs_perform(); exit; } if ($_GET["filterby"] == null) { $_GET["filterby"] = "1;1;0;0"; } if (isset($_GET["status"])) { SERVICES_STATUS(); exit; } if (isset($_GET["mem"])) { echo memory(); exit; } if (isset($_GET["svc"])) { SERVICES_SVC(); exit; } if (isset($_GET["myfilter"])) { filter(); exit; } if (isset($_GET["SERVICE_OPTIONS_JS"])) { SERVICE_OPTIONS_JS(); exit; } if (isset($_GET["SERVICE_OPTIONS_POPUP"])) {
public function fetch_todayposts() { $mem_key = 'forum_forum_sum_todaypost'; $todayposts = memory('get', $mem_key); if ($todayposts !== false && $todayposts !== NULL) { return $todayposts; } $todayposts = DB::result_first("SELECT sum(todayposts) FROM " . DB::table($this->_table)); memory('set', $mem_key, $todayposts, 60); //缓存60秒 return $todayposts; }
public function delete($cachenames) { parent::delete($cachenames); if ($this->_allowmem || $this->_isfilecache) { foreach ((array) $cachenames as $cachename) { $this->_allowmem && memory('rm', $cachename); $this->_isfilecache && @unlink(DISCUZ_ROOT . './data/cache/cache_' . $cachename . '.php'); } } }
public function update_batch_cache($ids, $data, $cache_ttl = null, $pre_cache_key = null) { $ret = false; if ($this->_allowmem) { if ($pre_cache_key === null) { $pre_cache_key = $this->_pre_cache_key; } if ($cache_ttl === null) { $cache_ttl = $this->_cache_ttl; } if (($_data = memory('get', $ids, $pre_cache_key)) !== false) { foreach ($_data as $id => $value) { $ret = $this->store_cache($id, array_merge($value, $data), $cache_ttl, $pre_cache_key); } } } return $ret; }
public function delete($val, $unbuffered = false, $fetch_archive = 0) { $ret = false; if ($val = dintval($val, true)) { $ret = parent::delete($val, $unbuffered, $fetch_archive); if ($this->_allowmem) { $data = ($data = memory('get', 'deleteuids')) === false ? array() : $data; foreach ((array) $val as $uid) { $data[$uid] = $uid; } memory('set', 'deleteuids', $data, 86400 * 2); } } return $ret; }
while (list($number, $row) = each($mount_points)) { if (($number + 1) % 2 == 0) { $tpl->assign(array('ITEM_CLASS' => 'content')); } else { $tpl->assign(array('ITEM_CLASS' => 'content2')); } $tpl->assign(array('MOUNT' => $row['mount'], 'TYPE' => $row['fstype'], 'PARTITION' => $row['disk'], 'PERCENT' => $row['percent'], 'FREE' => make_hr($row['free'] * 1014), 'USED' => make_hr($row['used'] * 1024), 'SIZE' => make_hr($row['size'] * 1024))); $tpl->parse('DISK_LIST_ITEM', '.disk_list_item'); } $tpl->parse('DISK_LIST', 'disk_list'); } /* * * static page messages. * */ gen_admin_menu($tpl); gen_mount_point($tpl); $kernel = kernel(); $uptime = uptime(); $load = loadavg(); $cpu = cpu_info(); $mem = memory(); $tpl->assign(array('TR_SYSTEM_INFO_TITLE' => tr('System info'), 'TR_SYSTEM_INFO' => tr('Vital system info'), 'TR_CPU_SYSTEM_INFO' => tr('CPU system Info'), 'TR_CPU_MODEL' => tr('CPU model'), 'TR_CPU_MHZ' => tr('CPU MHz'), 'TR_CPU_CACHE' => tr('CPU cache'), 'TR_CPU_BOGOMIPS' => tr('CPU bogomips'), 'CPU_MODEL' => $cpu['model'], 'CPU_MHZ' => $cpu['mhz'], 'CPU_CACHE' => $cpu['cache'], 'CPU_BOGOMIPS' => $cpu['bogomips'], 'TR_MEMRY_SYSTEM_INFO' => tr('Memory system info'), 'TR_RAM' => tr('RAM'), 'TR_TOTAL' => tr('Total'), 'TR_USED' => tr('Used'), 'TR_FREE' => tr('Free'), 'TR_SWAP' => tr('Swap'), 'TR_UPTIME' => tr('Up time'), 'UPTIME' => $uptime, 'TR_KERNEL' => tr('Kernel'), 'KERNEL' => $kernel, 'TR_LOAD' => tr('Load'), 'LOAD' => $load[0] . ' ' . $load[1] . ' ' . $load[0], 'RAM' => tr('RAM'), 'RAM_TOTAL' => format_bytesize($mem['ram']['total']), 'RAM_USED' => format_bytesize($mem['ram']['used']), 'RAM_FREE' => format_bytesize($mem['ram']['free']), 'SWAP_TOTAL' => format_bytesize($mem['swap']['total']), 'SWAP_USED' => format_bytesize($mem['swap']['used']), 'SWAP_FREE' => format_bytesize($mem['swap']['free']), 'TR_FILE_SYSTEM_INFO' => tr('Filesystem system Info'), 'TR_MOUNT' => tr('Mount'), 'TR_TYPE' => tr('Type'), 'TR_PARTITION' => tr('Partition'), 'TR_PERCENT' => tr('Percent'), 'TR_SIZE' => tr('Size'))); gen_page_message($tpl); $tpl->parse('PAGE', 'page'); $tpl->prnt(); if (isset($cfg['DUMP_GUI_DEBUG'])) { dump_gui_debug(); } unset_messages();
function block_updatecache($bid, $forceupdate = false) { global $_G; if (isset($_G['block'][$bid]['cachetime']) && $_G['block'][$bid]['cachetime'] < 0 || !$forceupdate && discuz_process::islocked('block_update_cache', 5)) { return false; } block_memory_clear($bid); $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid]; if (!$block) { return; } $obj = block_script($block['blockclass'], $block['script']); if (is_object($obj)) { DB::update('common_block', array('dateline' => TIMESTAMP), array('bid' => $bid)); $_G['block'][$bid]['dateline'] = TIMESTAMP; $block['param'] = empty($block['param']) ? array() : unserialize($block['param']); $theclass = block_getclass($block['blockclass']); $thestyle = !empty($block['styleid']) ? block_getstyle($block['styleid']) : unserialize($block['blockstyle']); if (in_array($block['blockclass'], array('forum_thread', 'group_thread', 'space_blog', 'space_pic', 'portal_article'))) { $datalist = array(); $mapping = array('forum_thread' => 'tid', 'group_thread' => 'tid', 'space_blog' => 'blogid', 'space_blog' => 'picid', 'portal_article' => 'aid'); $idtype = $mapping[$block['blockclass']]; $bannedids = !empty($block['param']['bannedids']) ? explode(',', $block['param']['bannedids']) : array(); $bannedsql = $bannedids ? ' AND id NOT IN (' . dimplode($bannedids) . ')' : ''; $shownum = intval($block['shownum']); $titlelength = !empty($block['param']['titlelength']) ? intval($block['param']['titlelength']) : 40; $summarylength = !empty($block['param']['summarylength']) ? intval($block['param']['summarylength']) : 80; $query = DB::query('SELECT * FROM ' . DB::table('common_block_item_data') . " WHERE bid='{$bid}' AND isverified='1' {$bannedsql} ORDER BY stickgrade DESC, verifiedtime DESC LIMIT {$shownum}"); while ($value = DB::fetch($query)) { $value['title'] = cutstr($value['title'], $titlelength, ''); $value['summary'] = cutstr($value['summary'], $summarylength, ''); $value['itemtype'] = '3'; $datalist[] = $value; $bannedids[] = intval($value['id']); } $leftnum = $block['shownum'] - count($datalist); if ($leftnum > 0 && empty($block['isblank'])) { $block['param']['items'] = $leftnum; $block['param']['bannedids'] = implode(',', $bannedids); $return = $obj->getdata($thestyle, $block['param']); $return['data'] = array_merge($datalist, (array) $return['data']); } else { $return['data'] = $datalist; } } else { $return = $obj->getdata($thestyle, $block['param']); } if ($return['data'] === null) { $_G['block'][$block['bid']]['summary'] = $return['html']; DB::update('common_block', array('summary' => daddslashes($return['html'])), array('bid' => $bid)); } else { $_G['block'][$block['bid']]['itemlist'] = block_updateitem($bid, $return['data']); } } else { DB::update('common_block', array('dateline' => TIMESTAMP + 999999, 'cachetime' => 0), array('bid' => $bid)); $_G['block'][$bid]['dateline'] = TIMESTAMP + 999999; } if (getglobal('setting/memory/diyblock/enable') && memory('check')) { memory('set', 'blockcache_' . $bid, $_G['block'][$bid], getglobal('setting/memory/diyblock/ttl')); $styleid = $_G['block'][$bid]['styleid']; if ($styleid && $_G['blockstyle_' . $styleid]) { memory('set', 'blockstylecache_' . $styleid, $_G['blockstyle_' . $styleid], getglobal('setting/memory/diyblock/ttl')); } } discuz_process::unlock('block_update_cache'); }
function __construct() { $this->obj = memory('obj'); $this->name = $this->obj->name; }
function category_get_list_more($cat, $wheresql, $hassub = true, $hasnew = true, $hashot = true) { global $_G; $data = array(); $catid = $cat['catid']; $cachearr = array(); if ($hashot) { $cachearr[] = 'portalhotarticle'; } if ($hasnew) { $cachearr[] = 'portalnewarticle'; } if ($hassub) { foreach ($cat['children'] as $childid) { $cachearr[] = 'subcate' . $childid; } } $allowmemory = memory('check'); foreach ($cachearr as $key) { $cachekey = $key . $catid; $data[$key] = $allowmemory ? memory('get', $cachekey) : false; if ($data[$key] === false) { $list = array(); $sql = ''; if ($key == 'portalhotarticle') { $dateline = TIMESTAMP - 3600 * 24 * 90; $query = C::t('portal_article_count')->fetch_all_hotarticle($wheresql, $dateline); } elseif ($key == 'portalnewarticle') { $query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, 'ORDER BY at.dateline DESC', 0, 10, 0, 'at'); } elseif (substr($key, 0, 7) == 'subcate') { $cacheid = intval(str_replace('subcate', '', $key)); if (!empty($_G['cache']['portalcategory'][$cacheid])) { $where = ''; if (!empty($_G['cache']['portalcategory'][$cacheid]['children']) && dimplode($_G['cache']['portalcategory'][$cacheid]['children'])) { $_G['cache']['portalcategory'][$cacheid]['children'][] = $cacheid; $where = 'at.catid IN (' . dimplode($_G['cache']['portalcategory'][$cacheid]['children']) . ')'; } else { $where = 'at.catid=' . $cacheid; } $where .= " AND at.status='0'"; $query = C::t('portal_article_title')->fetch_all_by_sql($where, 'ORDER BY at.dateline DESC', 0, 10, 0, 'at'); } } if ($query) { foreach ($query as $value) { $value['catname'] = $value['catid'] == $cat['catid'] ? $cat['catname'] : $_G['cache']['portalcategory'][$value['catid']]['catname']; if ($value['pic']) { $value['pic'] = pic_get($value['pic'], '', $value['thumb'], $value['remote'], 1, 1); } $value['timestamp'] = $value['dateline']; $value['dateline'] = dgmdate($value['dateline']); $list[] = $value; } } $data[$key] = $list; if ($allowmemory) { memory('set', $cachekey, $list, empty($list) ? 60 : 600); } } } return $data; }