function arrayeval($array, $level = 0) { if (!is_array($array)) { return "'" . $array . "'"; } if (is_array($array) && function_exists('var_export')) { return var_export($array, true); } $space = ''; for ($i = 0; $i <= $level; $i++) { $space .= "\t"; } $evaluate = "Array\n{$space}(\n"; $comma = $space; if (is_array($array)) { foreach ($array as $key => $val) { $key = is_string($key) ? '\'' . addcslashes($key, '\'\\') . '\'' : $key; $val = !is_array($val) && (!preg_match("/^\\-?[1-9]\\d*\$/", $val) || strlen($val) > 12) ? '\'' . addcslashes($val, '\'\\') . '\'' : $val; if (is_array($val)) { $evaluate .= "{$comma}{$key} => " . arrayeval($val, $level + 1); } else { $evaluate .= "{$comma}{$key} => {$val}"; } $comma = ",\n{$space}"; } } $evaluate .= "\n{$space})"; return $evaluate; }
function cache_write($name, $var, $values) { $cachefile = S_ROOT . './data/data_' . $name . '.php'; $cachetext = "<?php\r\n" . "if(!defined('IN_SYS')) exit('Access Denied');\r\n" . '$' . $var . '=' . arrayeval($values) . "\r\n?>"; if (!swritefile($cachefile, $cachetext)) { exit("File: {$cachefile} write error."); } }
function pluginCache($cacheName,$varName,$data,$isarray){ @require_once libfile('function/cache'); if($isarray){ $cacheArray .= "\$$varName=".arrayeval($data).";\n"; writetocache($cacheName, $cacheArray); }else{ $cacheArray .= "\$$varName=".$data.";\n"; writetocache($cacheName, $cacheArray); } }
function set_cache($key, $value, $life) { global $_G; $data = array($key => array('data' => $value, 'life' => $life)); require_once libfile('function/cache'); $cache_file = $this->get_cache_file_path($key); dmkdir(dirname($cache_file)); $cachedata = "\$data = " . arrayeval($data) . ";\n"; if ($fp = @fopen($cache_file, 'wb')) { fwrite($fp, "<?php\n//Discuz! cache file, DO NOT modify me!" . "\n//Created: " . date("M j, Y, G:i") . "\n//Identify: " . md5($cache_file . $cachedata . $_G['config']['security']['authkey']) . "\n\nif(!defined('IN_DISCUZ')) {\n\texit('Access Denied');\n}\n\n{$cachedata}?>"); fclose($fp); } else { exit('Can not write to cache files, please check directory ./data/ and ./data/ultraxcache/ .'); } return true; }
$modelsql = ''; unset($resultmodels['mid']); $resultcolumns = array(); $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('modelcolumns') . ' WHERE mid = \'' . $_GET['mid'] . '\' ORDER BY displayorder, id'); while ($value = $_SGLOBAL['db']->fetch_array($query)) { unset($value['id']); unset($value['mid']); if (!empty($value['upid']) && $value['formtype'] == 'linkage') { $value['upid'] = $cacheinfo['columnids'][$value['upid']]; } $resultcolumns[] = $value; } $resultmodels['tpl'] = ''; $tarr = array('info' => array('version' => S_VER, 'charset' => $_SCONFIG['charset']), 'models' => $resultmodels, 'columns' => $resultcolumns, 'categories' => $cacheinfo['categoryarr']); $modelsql = "/** SupeSite Dump\r\n" . " * Version: SupeSite " . S_VER . "\r\n" . " * Charset: " . $_SCONFIG['charset'] . "\r\n" . " * Time: {$time}\r\n" . " * From: {$_SCONFIG['sitename']} (" . S_URL . ")\r\n" . " * \r\n" . " * SupeSite: http://www.supesite.com\r\n" . " * Please visit our website for latest news about SupeSite\r\n" . " * --------------------------------------------------------*/\r\n\r\n\r\n"; $modelsql .= '$cacheinfo = ' . arrayeval($tarr) . ';'; if (!writefile($modelsqlfile, $modelsql, 'php')) { fclose($fp); deltree($datadir . '/' . $backupdir . '/'); showmessage('file_write_error'); } else { fclose($fp); $zipfilearr[] = $modelsqlfile; } $dberrorarr = array(); $createtable = $tabledump = ''; $_SGLOBAL['db']->query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT'); //ÎÞ±¨´íÖ´ÐйرÕÎҵĴ´½¨±íºÍÁÐʱ²»¼ÓÒýºÅ foreach ($modeldbarr as $tmpvalue) { $createtable = $_SGLOBAL['db']->query('SHOW CREATE TABLE ' . tname($resultmodels['modelname'] . $tmpvalue), 'SILENT'); if (!$_SGLOBAL['db']->errno()) {
function arrayeval($array, $level = 0) { $space = ''; $evaluate = "Array {$space}("; $comma = $space; foreach ($array as $key => $val) { $key = is_string($key) ? '\'' . addcslashes($key, '\'\\') . '\'' : $key; $val = !is_array($val) && (!preg_match("/^\\-?\\d+\$/", $val) || strlen($val) > 12) ? '\'' . addcslashes($val, '\'\\') . '\'' : $val; if (is_array($val)) { $evaluate .= "{$comma}{$key} => " . arrayeval($val, $level + 1); } else { $evaluate .= "{$comma}{$key} => {$val}"; } $comma = ",{$space}"; } $evaluate .= "{$space})"; return $evaluate; }
$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 update_table() { global $_G; $tablepre = $_G[_config][db][tablepre]; $table = DB::fetch_all("SHOW TABLES"); foreach ($table as $k => $v) { if (is_array($v)) { foreach ($v as $kk => $vv) { if (preg_match("/" . $tablepre . "/is", $vv)) { $name = str_replace($tablepre, '', $vv); $arr[$name] = array(); $rs = DB::fetch_all("SHOW FULL FIELDS FROM {$vv}"); foreach ($rs as $k1 => $v1) { $f = array('type' => preg_replace("/\\(.*/", '', $v1['Type'])); if ($v1['Extra'] == 'auto_increment') { $f[pre] = true; } $arr[$name][$v1['Field']] = $f; } } } } } //写缓存,字段一定要写文件缓存. writetocache('table', arrayeval($arr)); copy(ROOT_PATH . 'web/cache/cache_table.php', ROOT_PATH . 'inc/config/cache_table.php'); $_G[table] = $arr; return $arr; }
/** * 获取或生成采集地址 */ function cacherobotlist($type, $url, $robotid, $sarray = array(), $varname = 'newurlarr') { global $alang; $cachefile = S_ROOT . './data/robot/' . $robotid . '_' . md5($url) . '.php'; if ($type == 'get') { if (file_exists($cachefile)) { include_once $cachefile; showprogress($alang['robot_robot_cache_read'] . ' (' . srealpath($cachefile) . ')', 1); //srealpath是格式化URL地址 return ${$varname}; } else { return false; } } else { $wtext = arrayeval($sarray); if (!@($fp = fopen($cachefile, 'w'))) { showprogress($alang['robot_robot_cache_write_failed'] . ' (' . srealpath($cachefile) . ')', 1); //缓存无法写入 } else { $text = "<?php\n\n"; $text .= '$' . $varname . '='; $text .= $wtext; $text .= "\n\n?>"; flock($fp, 2); fwrite($fp, $text); fclose($fp); showprogress($alang['robot_robot_cache_write_success'] . ' (' . srealpath($cachefile) . ')', 1); } } }
function updateattrext($force = true, $cachetime = '53200') { global $_G, $_SGLOBAL; $cachefile = B_ROOT . './data/system/attr_ext.cache.php'; if ($force == false) { $cachemtime = file_exists($cachefile) ? filemtime($cachefile) : 0; if ($_G['timestamp'] - $cachemtime < $cachetime) { @(include $cachefile); return false; } } $_SGLOBAL['brandlinks'] = $link = array(); $query = DB::query('SELECT * FROM ' . tname('modelcolumns') . ' WHERE mid = 2 and available = 1 order by displayorder'); while ($value = DB::fetch($query)) { if (!preg_match('/^ext_/', $value['fieldname'])) { continue; } $_SGLOBAL['attr_ext'][] = $value; } $cachetext = '$_SGLOBAL[\'attr_ext\']=' . arrayeval($_SGLOBAL['attr_ext']); writefile($cachefile, $cachetext, 'php'); @(include $cachefile); }
function getcachevars($data, $type = 'VAR') { $evaluate = ''; !is_array($data) && ($data = array($data)); foreach ($data as $key => $val) { if (!preg_match("/^[a-zA-Z_-�][a-zA-Z0-9_-�]*\$/", $key)) { continue; } if (is_array($val)) { $evaluate .= "\${$key} = " . arrayeval($val) . ";\n"; } else { $val = addcslashes($val, '\'\\'); $evaluate .= $type == 'VAR' ? "\${$key} = '{$val}';\n" : "define('" . strtoupper($key) . "', '{$val}');\n"; } } return $evaluate; }
private function save_config($focus = false) { if (TAE) { return true; } $file = ROOT_PATH . 'install/init_config.txt'; if (is_file($file) && !$focus) { return false; } $db_file = ROOT_PATH . 'inc/config/db.config.php'; $authkey = random(10); $rs = arrayeval($this->_config['db']); $text = "\r\n"; $text .= "\$_config['authkey'] = '{$authkey}';\r\n"; $text .= "\$_config['db']=" . $rs . ";\r\n"; $text .= "\r\n?>"; //检查原db.config.php文件是否存在数据库信息 $db_content = file_get_contents($db_file); //如存在,则将原db.config.php中的内容正则提取出来,并替换成新的追加到db.config.php if (strpos($db_content, 'authkey') !== false) { $new_content = preg_replace("/\\\$_config\\['authkey'\\](.*)\$/is", $text, $db_content); } else { $new_content = preg_replace("/\\?>/is", $text, $db_content); } if (!$new_content) { json('写入配置文件失败,请检查inc/config/目录是否有写入权限'); } $len = file_put_contents($db_file, $new_content); if ($len <= 0) { json('写入数据库配置文件失败,请检查inc/config/目录是否有写入权限'); } file_put_contents($file, 'init ok'); return true; }
function model_cache() { global $_SGLOBAL; $_SGLOBAL['updatemodel'] = array('model' => array(), 'category' => array(), 'comment' => array(), 'folder' => array()); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('models') . " m, " . tname('channels') . " c WHERE m.modelname = c.nameid"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $_SGLOBAL['updatemodel']['model'][$value['mid']] = $value; $_SGLOBAL['updatemodel']['category'][$value['mid']] = $value['mid']; $_SGLOBAL['updatemodel']['comment'][$value['mid']] = $value['mid']; $_SGLOBAL['updatemodel']['folder'][$value['mid']] = $value['mid']; $_SGLOBAL['updatemodel']['hot'][$value['mid']] = $value['mid']; $_SGLOBAL['updatemodel']['cache'][$value['mid']] = $value['mid']; } $cachefile = S_ROOT . './data/system/update_model.cache.php'; $text = '$_SGLOBAL[\'updatemodel\']=' . arrayeval($_SGLOBAL['updatemodel']) . ";"; writefile($cachefile, $text, 'php'); }
function brian_cat_cache() { require_once libfile('function/cache'); $cat_array = array(); $cat_array = brian_fetch_all('info_cat', ' ORDER BY cat_sort ASC', array('sort' => 'cat_id')); foreach ($cat_array as $k => $v) { if (!empty($v['cat_pid'])) { $ddd_time = time(); $cat_array[$k]['sum'] = DB::result_first("SELECT count(post_id) FROM " . DB::table("info_post") . " WHERE subcat_id = '{$v['cat_id']}' and `post_begin_time` > 0 and `post_begin_time` < '{$ddd_time}' and `post_end_time` > '{$ddd_time}' "); } } $cat_array_field .= "\$cat_array = " . arrayeval($cat_array) . ";\n"; writetocache('info_cat_array', $cat_array_field); }
$time = mktime(0, 0, 0, $tomonth, $todate, $toyear) - 604800; } elseif ($homeshow['Five_Date'] == 3) { $time = mktime(0, 0, 0, $tomonth, 1, $toyear); } elseif ($homeshow['Five_Date'] == 4) { $time = mktime(0, 0, 0, 1, 1, $toyear); } else { $time = 0; } $query = $db->query("select count(pid) as num, authorid, author from {$tablepre}posts where dateline >= {$time} group by authorid order by num desc limit 0, 15"); while ($result = $db->fetch_array($query)) { $result['avatar'] = discuz_uc_avatar($result['authorid'], small); $result['autitl'] = $result['author']; $result['author'] = cutstr($result['author'], $homeshow['AuNums']); $poststar[] = $result; } $cacheArray .= "\$poststar = " . arrayeval($poststar) . ";\n"; } unset($query, $poststar); writetocache('homeshow', '', $cacheArray); unset($cacheArray); } require_once $cacheFile; if (@$pic) { PHP_VERSION > 4.3 ? shuffle($pic) : ''; $i = 0; foreach ($pic as $key => $val) { if (is_readable($val['picpics']) || substr($val['picpics'], 0, 4) == 'http') { $picpics .= $comma . $val['picpics']; $piclinks .= $comma . $val['piclinks']; $pictexts .= $comma . $val['pictexts']; $comma = '|';
$qarr = parseparameter($ele); $_SGET = $qarr; $_SGET['page'] = empty($_SGET['page']) || intval($_SGET['page']) < 1 ? 1 : intval($_SGET['page']); if ($qarr['action'] == 'model') { $qarr['action'] = 'modelview'; } if (empty($channels['menus'][$qarr['action']]['upnameid']) && $channels['menus'][$qarr['action']]['upnameid'] != 'news') { $rs = createhtml(S_ROOT . "./{$qarr['action']}.php", $ele); } else { $rs = createhtml(S_ROOT . "./news.php", $ele); } if ($rs != true) { showmessage($rs); } } $cachetext = '$makecache=' . arrayeval($makecache); writefile($cachefile, $cachetext, 'php'); $nexturl = CPURL . '?action=freshhtml&op=making&page=' . ++$page; jumpmessage($nexturl, $alang['freshhtml_making_page_info_0'] . $total . $alang['freshhtml_making_page_info_1'] . $perpage . $alang['freshhtml_making_page_info_2'] . $page . $alang['freshhtml_making_page_info_3']); } else { $nexturl = CPURL . '?action=freshhtml&op=cache'; jumpmessage($nexturl, $alang['making_page_cache_update']); } } include template('admin/tpl/freshhtml.htm', 1); //信息提示 function jumpmessage($url, $message, $time = 1) { global $acid, $alang, $menus; obclean(); include template('admin/tpl/header.htm', 1);
function updatecreditsettings($get, $post) { global $_SGLOBAL; if (!API_UPDATECREDITSETTINGS) { return API_RETURN_FORBIDDEN; } $outextcredits = array(); foreach ($get['credit'] as $appid => $credititems) { if ($appid == UC_APPID) { foreach ($credititems as $value) { $outextcredits[$value['appiddesc'] . '|' . $value['creditdesc']] = array('creditsrc' => $value['creditsrc'], 'title' => $value['title'], 'unit' => $value['unit'], 'ratio' => $value['ratio']); } } } $cachefile = S_ROOT . './uc_client/data/cache/creditsettings.php'; $fp = fopen($cachefile, 'w'); $s = "<?php\r\n"; $s .= '$_CACHE[\'creditsettings\'] = ' . arrayeval($outextcredits) . ";\r\n"; fwrite($fp, $s); fclose($fp); return API_RETURN_SUCCEED; }
/** * 更新用户后台模型id */ function updateuserspacemid() { global $_SGLOBAL; dbconnect(); $midarr = array(); $query = $_SGLOBAL['db']->query('SELECT m.*, c.status FROM ' . tname('models') . ' m LEFT JOIN ' . tname('channels') . ' c ON (m.modelname = c.nameid) WHERE c.status > -1'); while ($result = $_SGLOBAL['db']->fetch_array($query)) { $midarr[] = $result; } $cachefile = S_ROOT . './cache/model/model.cache.php'; $text = '$cacheinfo = ' . arrayeval($midarr) . ';'; writefile($cachefile, $text, 'php'); return $midarr; }
function updatemembercache() { $dir = './forumdata/cache/'; if (!is_dir($dir)) { @mkdir($dir, 0777); } if (@($fp = fopen($dir . 'cache_settings.php', 'w'))) { fwrite($fp, "<?php\n//Discuz! cache file, DO NOT modify me!\n" . "//Created on " . date("M j, Y, G:i") . "\n\n\$_DCACHE['settings'] = " . arrayeval($GLOBALS['_DCACHE']['settings']) . "?>"); fclose($fp); } else { exit('Can not write to cache files, please check directory ./forumdata/ and ./forumdata/cache/ .'); } }
function updatebbsforumset() { global $_SGLOBAL; $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('forums') . ' ORDER BY displayorder'); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $value['pushsetting'] = unserialize($value['pushsetting']); $_SGLOBAL['bbsforumarr'][$value['fid']] = $value; } $cachefile = S_ROOT . './data/system/bbsforums.cache.php'; $cachetext = '$_SGLOBAL[\'bbsforumarr\']=' . arrayeval($_SGLOBAL['bbsforumarr']); writefile($cachefile, $cachetext, 'php'); }
if (isset($_GET['del'])) { $del['area_id'] = intval($_GET['del']); DB::delete('info_area', $del); } if (isset($_GET['edit'])) { $edit = intval($_GET['edit']); $edit_array = array(); $edit_array = fetch_all('info_area', ' WHERE area_id=' . $edit . ' ORDER BY area_pid DESC,area_sort ASC', '*', 0); } if (isset($_GET['edit_submit'])) { $edit_array = array(); $edit_array = gpc('area_'); DB::update('info_area', $edit_array, array('area_id' => $edit_array['area_id'])); } $area_array = array(); $area_array = fetch_all('info_area', ' ORDER BY area_pid ASC,area_sort ASC', '*', '1', 'area_id'); foreach ($area_array as $k => $v) { if ($v['area_pid'] == '0') { $sum = fetch_all('info_area', " WHERE area_pid='{$v['area_id']}' ", ' count(area_id) as sum ', 0); $area_array[$k] = array_merge($area_array[$k], $sum); } } if (!cloudaddons_getmd5("info.plugin")) { cpmsg(lang('admincp_msg', 'cloudaddons_genuine_message'), '', 'error', array('addonid' => "info.plugin")); } $area_array_field .= "\$area_array = " . arrayeval($area_array) . ";\n"; writetocache('info_area_array', $area_array_field); $pid_area_array = array(); $pid_area_array = fetch_all("info_area", " WHERE area_id='{$area_pid}' ", "*", 0); $style = 'default'; include template("info:admin/admin_area");
if ($page < $listpages) { ++$page; $nexturl = CPURL . '?action=makehtml&op=makecathtml&perlisthtml=' . $perlisthtml . '&catid=' . $catid . '&total=' . $countnum . '&page=' . $page; echo '<table style="width:98%;padding:0.2em;border: 1px solid #698CC3;font-size:14px;font-weight:bold;font-family: Trebuchet MS, Lucida Console, Lucida Sans, sans-serif;" align="center"><tr><td><a href=' . $nexturl . '>' . $alang['making_page_info_0'] . $total . $alang['making_page_info_1'] . $start . ' / ' . ($start + $perlisthtml) . $alang['making_page_info_2'] . '</a></td><td width="35%"><a href="' . $theurl . '&op=make">' . $alang['making_page_info_3'] . '</a></td></tr></table>'; jumpurl($nexturl, 1); } else { if ($_GET['jump'] == 'yes') { include_once S_ROOT . '/data/temp/catid.cache.php'; //取出其中一个catid生成html $catid = array_pop($tcatidarr); $jump = 'no'; if (!empty($tcatidarr)) { //保存到临时文件下,用于跳转 $jump = 'yes'; $cachefile = S_ROOT . './data/temp/catid.cache.php'; $text = '$tcatidarr = ' . arrayeval($tcatidarr) . ';'; writefile($cachefile, $text, 'php'); } updatehtmlpathcache(); $_SGLOBAL['db']->query("DELETE FROM " . tname('spacepages') . " WHERE catid='{$catid}'"); $query = $_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('spaceitems') . " WHERE catid='{$catid}'"); $countnum = $_SGLOBAL['db']->result($query, 0); $nexturl = CPURL . '?action=makehtml&op=makecathtml&perlisthtml=' . $perlisthtml . '&catid=' . $catid . '&total=' . $countnum . '&jump=' . $jump; echo '<table style="width:98%;padding:0.2em;border: 1px solid #698CC3;font-size:14px;font-weight:bold;font-family: Trebuchet MS, Lucida Console, Lucida Sans, sans-serif;" align="center"><tr><td><a href=' . $nexturl . '>' . $alang['making_page_info_0'] . $batch_makehtml_count . $alang['making_page_info_1'] . '0 / ' . $perlisthtml . $alang['making_page_info_2'] . '</a></td><td width="35%"><a href="' . $theurl . '&op=make">' . $alang['making_page_info_3'] . '</a></td></tr></table>'; jumpurl($nexturl, 1); exit; } showmessage('make_html_success', $theurl); } } elseif ($op == 'updatehtml') { include_once S_ROOT . '/data/temp/catidarr.cache.php';
function lovecache() { global $db, $tablepre, $lovecache, $smileyoff, $maxsmilies, $page, $lovepage, $dateformat, $timeformat, $timeoffset; $tpp = $lovepage ? $lovepage : 800; $start_limit = ($page - 1) * $tpp; $query = $db->query("select * FROM `" . $tablepre . "lovewall` ORDER BY `id` asc \r\n\t\tlimit {$start_limit},{$tpp}"); while ($rowlove = $db->fetch_array($query)) { $temptime = $rowlove['lovetime']; $rowlove['lovetime'] = gmdate("{$dateformat} {$timeformat}", $temptime + 3600 * $timeoffset); $rowlove['lovesay'] = dhtmlspecialchars($rowlove['lovesay']); $rowlove['lovesay'] = str_replace(array("'", '"'), array("\\'", "\""), $rowlove['lovesay']); $rowlove['lovesay'] = nl2br(str_replace(array("\t", ' ', ' ', "\r\n"), array(' ', ' ', ' ', '<br>'), $rowlove['lovesay'])); $rowlove['colorid'] = $rowlove['colorid'] ? $rowlove['colorid'] : mt_rand(0, 5); $rowlove['moodid'] = $rowlove['moodid'] ? $rowlove['moodid'] : mt_rand(0, 15); if ($rowlove['mysign'] == "匿名" or $rowlove['mysign'] == "") { $rowlove['mysign'] = str_replace(array("'", '"'), array("\\'", "\""), dhtmlspecialchars($rowlove['uname'])); } else { $rowlove['mysign'] = str_replace(array("'", '"'), array("\\'", "\""), dhtmlspecialchars($rowlove['mysign'])); } $rowlove['nickname'] = str_replace(array("'", '"'), array("\\'", "\""), dhtmlspecialchars($rowlove['nickname'])); if (!$smileyoff && !empty($GLOBALS['_DCACHE']['smilies']) && is_array($GLOBALS['_DCACHE']['smilies'])) { $rowlove['lovesay'] = preg_replace($GLOBALS['_DCACHE']['smilies']['searcharray'], $GLOBALS['_DCACHE']['smilies']['replacearray'], $rowlove['lovesay'], $maxsmilies); } $rowlove['lovesay'] = str_replace('\\"', '"', $rowlove['lovesay']); unset($rowlove['uid']); unset($rowlove['uname']); $lovewall[$rowlove[id]] = $rowlove; } if ($lovecache == 1) { $filepath = DISCUZ_ROOT . "./extend/lovewall/cache/cache_lovewall_{$page}.php"; $love_data = $lovewall ? "\$love_cache = " . arrayeval($lovewall) . ";\n\n" : ""; if (@($fp = fopen($filepath, 'w'))) { fwrite($fp, "<?php\n//Discuz! cache file, DO NOT modify me!\n" . "//Created on " . date("M j, Y, G:i") . "\n\n{$love_data}?>"); fclose($fp); } else { dexit('Can not write to cache files, please check directory ./extend/lovewall/cache/ .'); } } return $lovewall; }
function postnews_cache() { global $_SGLOBAL; $_SGLOBAL['postnews_set'] = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('postset')); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $_SGLOBAL['postnews_set'][$value['setid']] = $value; } $cachefile = S_ROOT . './data/system/postnews.cache.php'; $text = '$_SGLOBAL[\'postnews_set\']=' . arrayeval($_SGLOBAL['postnews_set']) . ";"; writefile($cachefile, $text, 'php'); }
<?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', '', '');
} if (isset($_GET['del'])) { $del['cat_id'] = intval($_GET['del']); DB::delete('house_cat', $del); } if (isset($_GET['edit'])) { $edit = intval($_GET['edit']); $edit_array = array(); $edit_array = fetch_all('house_cat', ' WHERE cat_id=' . $edit . ' ORDER BY cat_pid DESC,cat_sort ASC', '*', 0); } if (isset($_GET['edit_submit'])) { $edit_array = array(); $edit_array = gpc('cat_'); DB::update('house_cat', $edit_array, array('cat_id' => $edit_array['cat_id'])); } $cat_array = array(); $cat_array = fetch_all('house_cat', ' ORDER BY cat_pid ASC,cat_sort ASC'); foreach ($cat_array as $k => $v) { if ($v['cat_pid'] == '0') { $sum = fetch_all('house_cat', " WHERE cat_pid='{$v['cat_id']}' ", ' count(cat_id) as sum ', 0); $cat_array[$k] = array_merge($cat_array[$k], $sum); } } $cat_array_field .= "\$cat_array = " . arrayeval($cat_array) . ";\n"; writetocache('house_cat_array', $cat_array_field); if (!cloudaddons_getmd5("house.plugin")) { cpmsg(lang('admincp_msg', 'cloudaddons_genuine_message'), '', 'error', array('addonid' => "house.plugin")); } $pid_cat_array = array(); $pid_cat_array = fetch_all("house_cat", " WHERE cat_id='{$cat_pid}' ", "*", 0); include template("house:admin/admin_cat");
function get_cates() { global $_G; $cates = top('taobao_cate', 'get_user', '0'); //只写文件,只在本地使用 writetocache('taobao_cate', arrayeval($cates)); cpmsg('获取成功', 'success', "m=fetch&a=main"); }