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

 找回密码
 立即注册
搜索

[疑难] 已解决,谢谢支持

[复制链接]
扯淡的微笑 发表于 2010-1-11 10:24:11 | 显示全部楼层 |阅读模式
本帖最后由 扯淡的微笑 于 2011-7-15 03:49 编辑

已解决,谢谢支持
回复

使用道具 举报

 楼主| 扯淡的微笑 发表于 2010-1-11 10:48:20 | 显示全部楼层
本帖最后由 扯淡的微笑 于 2011-7-15 03:36 编辑

已解决,谢谢支持
回复

使用道具 举报

 楼主| 扯淡的微笑 发表于 2010-1-13 16:57:16 | 显示全部楼层
本帖最后由 扯淡的微笑 于 2011-7-15 03:36 编辑

已解决,谢谢支持
回复

使用道具 举报

szrq 发表于 2010-1-13 18:21:08 | 显示全部楼层
  1. <?php
  2. if(!defined('IN_UCHOME')) {
  3.         exit('Access Denied');
  4. }
  5. function config_cache($updatedata=true) {
  6.         global $_SGLOBAL;
  7.         $_SCONFIG = array();
  8.         $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('config'));
  9.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  10.                 if($value['var'] == 'privacy') {
  11.                         $value['datavalue'] = empty($value['datavalue'])?array():unserialize($value['datavalue']);
  12.                 }
  13.                 if($value['var'] == 'jfconfig') {
  14.                         $value['datavalue'] = empty($value['datavalue'])?array():unserialize($value['datavalue']);
  15.                 }
  16.                 $_SCONFIG[$value['var']] = $value['datavalue'];
  17.         }
  18.         cache_write('config','_SCONFIG',$_SCONFIG);
  19.         if($updatedata) {
  20.                 $setting = data_get('setting');
  21.                 $_SGLOBAL['setting'] = empty($setting)?array():unserialize($setting);
  22.                 cache_write('setting',"_SGLOBAL['setting']",$_SGLOBAL['setting']);
  23.                 $mail = data_get('mail');
  24.                 $_SGLOBAL['mail'] = empty($mail)?array():unserialize($mail);
  25.                 cache_write('mail',"_SGLOBAL['mail']",$_SGLOBAL['mail']);
  26.                 $spam = data_get('spam');
  27.                 $_SGLOBAL['spam'] = empty($spam)?array():unserialize($spam);
  28.                 cache_write('spam',"_SGLOBAL['spam']",$_SGLOBAL['spam']);
  29.         }
  30. }
  31. function network_cache() {
  32.         global $_SGLOBAL,$_SCONFIG;
  33.         $setting = data_get('network');
  34.         $_SGLOBAL['network'] = empty($setting)?array():unserialize($setting);
  35.         cache_write('network',"_SGLOBAL['network']",$_SGLOBAL['network']);
  36. }
  37. function indexjufeng_cache() {
  38.         global $_SGLOBAL,$_SCONFIG;
  39.         $setting = data_get('indexjufeng');
  40.         $_SGLOBAL['indexjufeng'] = empty($setting)?array():unserialize($setting);
  41.         cache_write('indexjufeng',"_SGLOBAL['indexjufeng']",$_SGLOBAL['indexjufeng']);
  42. }
  43. function huandeng_cache() {
  44.         global $_SGLOBAL,$_SCONFIG;
  45.         $setting = data_get('huandeng');
  46.         $_SGLOBAL['huandeng'] = empty($setting)?array():unserialize($setting);
  47.         cache_write('huandeng',"_SGLOBAL['huandeng']",$_SGLOBAL['huandeng']);
  48. }
  49. function usergroup_cache() {
  50.         global $_SGLOBAL;
  51.         $usergroup = $_SGLOBAL['grouptitle'] = array();
  52.         $highest = true;
  53.         $lower = '';
  54.         $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('usergroup').' ORDER BY explower DESC');
  55.         while ($group = $_SGLOBAL['db']->fetch_array($query)) {
  56.                 $group['maxattachsize'] = intval($group['maxattachsize']) * 1024 * 1024;
  57.                 if($group['system'] == 0) {
  58.                         if($highest) {
  59.                                 $group['exphigher'] = 999999999;
  60.                                 $highest = false;
  61.                                 $lower = $group['explower'];
  62.                         }else {
  63.                                 $group['exphigher'] = $lower -1;
  64.                                 $lower = $group['explower'];
  65.                         }
  66.                 }
  67.                 $group['magicaward'] = unserialize($group['magicaward']);
  68.                 $usergroup = array($group['gid'] =>$group);
  69.                 $_SGLOBAL['grouptitle'][$group['gid']] = array(
  70.                 'grouptitle'=>$group['grouptitle'],
  71.                 'color'=>$group['color'],
  72.                 'icon'=>$group['icon']
  73.                 );
  74.                 cache_write('usergroup_'.$group['gid'],"_SGLOBAL['usergroup']",$usergroup);
  75.         }
  76.         cache_write('usergroup',"_SGLOBAL['grouptitle']",$_SGLOBAL['grouptitle']);
  77. }
  78. function profilefield_cache() {
  79.         global $_SGLOBAL;
  80.         $_SGLOBAL['profilefield'] = array();
  81.         $query = $_SGLOBAL['db']->query('SELECT fieldid, title, formtype, maxsize, required, invisible, allowsearch, choice FROM '.tname('profilefield').' ORDER BY displayorder');
  82.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  83.                 $_SGLOBAL['profilefield'][$value['fieldid']] = $value;
  84.         }
  85.         cache_write('profilefield',"_SGLOBAL['profilefield']",$_SGLOBAL['profilefield']);
  86. }
  87. function profield_cache() {
  88.         global $_SGLOBAL;
  89.         $_SGLOBAL['profield'] = array();
  90.         $query = $_SGLOBAL['db']->query('SELECT fieldid, title, formtype, inputnum, mtagminnum, manualmoderator, manualmember FROM '.tname('profield').' ORDER BY displayorder');
  91.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  92.                 $_SGLOBAL['profield'][$value['fieldid']] = $value;
  93.         }
  94.         cache_write('profield',"_SGLOBAL['profield']",$_SGLOBAL['profield']);
  95. }
  96. function adhuandeng_cache() {
  97.         global $_SGLOBAL;
  98.         $_SGLOBAL['adhuandeng'] = array();
  99.         $query = $_SGLOBAL['db']->query('SELECT fieldid, imagealt, imagesrc, imageurl, manualmoderator, manualmember FROM '.tname('adhuandeng').' ORDER BY displayorder');
  100.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  101.                 $_SGLOBAL['adhuandeng'][$value['fieldid']] = $value;
  102.         }
  103.         cache_write('adhuandeng',"_SGLOBAL['adhuandeng']",$_SGLOBAL['adhuandeng']);
  104. }
  105. function censor_cache() {
  106.         global $_SGLOBAL;
  107.         $_SGLOBAL['censor'] = $banned = $banwords = array();
  108.         $censorarr = explode("\n",data_get('censor'));
  109.         foreach($censorarr as $censor) {
  110.                 $censor = trim($censor);
  111.                 if(empty($censor)) continue;
  112.                 list($find,$replace) = explode('=',$censor);
  113.                 $findword = $find;
  114.                 $find = preg_replace("/\\\{(\d+)\\\}/",".{0,\\1}",preg_quote($find,'/'));
  115.                 switch($replace) {
  116.                         case '{BANNED}':
  117.                                 $banwords[] = preg_replace("/\\\{(\d+)\\\}/",'*',preg_quote($findword,'/'));
  118.                                 $banned[] = $find;
  119.                                 break;
  120.                         default:
  121.                                 $_SGLOBAL['censor']['filter']['find'][] = '/'.$find.'/i';
  122.                                 $_SGLOBAL['censor']['filter']['replace'][] = $replace;
  123.                                 break;
  124.                 }
  125.         }
  126.         if($banned) {
  127.                 $_SGLOBAL['censor']['banned'] = '/('.implode('|',$banned).')/i';
  128.                 $_SGLOBAL['censor']['banword'] = implode(', ',$banwords);
  129.         }
  130.         cache_write('censor',"_SGLOBAL['censor']",$_SGLOBAL['censor']);
  131. }
  132. function creditrule_cache() {
  133.         global $_SGLOBAL;
  134.         $_SGLOBAL['creditrule'] = array();
  135.         $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('creditrule'));
  136.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  137.                 $_SGLOBAL['creditrule'][$value['action']] = $value;
  138.         }
  139.         cache_write('creditrule',"_SGLOBAL['creditrule']",$_SGLOBAL['creditrule']);
  140. }
  141. function ad_cache() {
  142.         global $_SGLOBAL;
  143.         $_SGLOBAL['ad'] = array();
  144.         $query = $_SGLOBAL['db']->query('SELECT adid, pagetype FROM '.tname('ad')." WHERE system='1' AND available='1'");
  145.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  146.                 $_SGLOBAL['ad'][$value['pagetype']][] = $value['adid'];
  147.         }
  148.         cache_write('ad',"_SGLOBAL['ad']",$_SGLOBAL['ad']);
  149. }
  150. function task_cache() {
  151.         global $_SGLOBAL;
  152.         $_SGLOBAL['task'] = array();
  153.         $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('task')." WHERE available='1' ORDER BY displayorder");
  154.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  155.                 if((empty($value['endtime']) ||$value['endtime'] >= $_SGLOBAL['timestamp']) &&(empty($value['maxnum']) ||$value['maxnum']>$value['num'])) {
  156.                         $_SGLOBAL['task'][$value['taskid']] = $value;
  157.                 }
  158.         }
  159.         cache_write('task',"_SGLOBAL['task']",$_SGLOBAL['task']);
  160. }
  161. function click_cache() {
  162.         global $_SGLOBAL;
  163.         $_SGLOBAL['click'] = array();
  164.         $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('click').' ORDER BY displayorder');
  165.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  166.                 $_SGLOBAL['click'][$value['idtype']][$value['clickid']] = $value;
  167.         }
  168.         cache_write('click',"_SGLOBAL['click']",$_SGLOBAL['click']);
  169. }
  170. function block_cache() {
  171.         global $_SGLOBAL;
  172.         $_SGLOBAL['block'] = array();
  173.         $query = $_SGLOBAL['db']->query('SELECT bid, cachetime FROM '.tname('block'));
  174.         while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  175.                 $_SGLOBAL['block'][$value['bid']] = $value['cachetime'];
  176.         }
  177.         cache_write('block',"_SGLOBAL['block']",$_SGLOBAL['block']);
  178. }
  179. function tpl_cache() {
  180.         include_once(S_ROOT.'./source/function_cp.php');
  181.         $dir = S_ROOT.'./data/tpl_cache';
  182.         $files = sreaddir($dir);
  183.         foreach ($files as $file) {
  184.                 @unlink($dir.'/'.$file);
  185.         }
  186. }
  187. function block_data_cache() {
  188.         global $_SGLOBAL,$_SCONFIG;
  189.         if($_SCONFIG['cachemode'] == 'database') {
  190.                 $query = $_SGLOBAL['db']->query("SHOW TABLE STATUS LIKE '".tname('cache')."%'");
  191.                 while($table = $_SGLOBAL['db']->fetch_array($query)) {
  192.                         $_SGLOBAL['db']->query("TRUNCATE TABLE `$table[Name]`");
  193.                 }
  194.         }else {
  195.                 include_once(S_ROOT.'./source/function_cp.php');
  196.                 deltreedir(S_ROOT.'./data/block_cache');
  197.         }
  198. }
  199. function userapp_cache() {
  200.         global $_SGLOBAL,$_SCONFIG;
  201.         $_SGLOBAL['userapp'] = array();
  202.         if($_SCONFIG['my_status']) {
  203.                 $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('myapp')." WHERE flag='1' ORDER BY displayorder",'SILENT');
  204.                 while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  205.                         $_SGLOBAL['userapp'][$value['appid']] = $value;
  206.                 }
  207.         }
  208.         cache_write('userapp',"_SGLOBAL['userapp']",$_SGLOBAL['userapp']);
  209. }
  210. function app_cache() {
  211.         global $_SGLOBAL;
  212.         $relatedtag = unserialize(data_get('relatedtag'));
  213.         $default_open = 0;
  214.         if(empty($relatedtag)) {
  215.                 $relatedtag = array();
  216.                 include_once S_ROOT.'./uc_client/client.php';
  217.                 $relatedtag['data'] = uc_app_ls();
  218.                 $default_open = 1;
  219.         }
  220.         $_SGLOBAL['app'] = array();
  221.         foreach($relatedtag['data'] as $appid =>$data) {
  222.                 if($default_open) {
  223.                         $data['open'] = 1;
  224.                 }
  225.                 if($appid == UC_APPID) {
  226.                         $data['open'] = 0;
  227.                 }
  228.                 $_SGLOBAL['app'][$appid] = array(
  229.                 'name'=>$data['name'],
  230.                 'url'=>$data['url'],
  231.                 'type'=>$data['type'],
  232.                 'open'=>$data['open'],
  233.                 'icon'=>$data['type']=='OTHER'?'default':strtolower($data['type'])
  234.                 );
  235.         }
  236.         cache_write('app',"_SGLOBAL['app']",$_SGLOBAL['app']);
  237. }
  238. function eventclass_cache(){
  239.         global $_SGLOBAL;
  240.         $_SGLOBAL['eventclass'] = array();
  241.         $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('eventclass') .' ORDER BY displayorder');
  242.         while($value = $_SGLOBAL['db']->fetch_array($query)){
  243.                 if($value['poster']) {
  244.                         $value['poster'] = 'data/event/'.$value['classid'].'.jpg';
  245.                 }else {
  246.                         $value['poster'] = 'image/event/default.jpg';
  247.                 }
  248.                 $_SGLOBAL['eventclass'][$value['classid']] = $value;
  249.         }
  250.         cache_write('eventclass',"_SGLOBAL['eventclass']",$_SGLOBAL['eventclass']);
  251. }
  252. function magic_cache(){
  253.         global $_SGLOBAL;
  254.         $_SGLOBAL['magic'] = array();
  255.         $query = $_SGLOBAL['db']->query('SELECT mid, name FROM '.tname('magic')." WHERE close='0'");
  256.         while($value = $_SGLOBAL['db']->fetch_array($query)){
  257.                 $_SGLOBAL['magic'][$value['mid']] = $value['name'];
  258.         }
  259.         cache_write('magic',"_SGLOBAL['magic']",$_SGLOBAL['magic']);
  260. }
  261. function deltreedir($dir) {
  262.         $files = sreaddir($dir);
  263.         foreach ($files as $file) {
  264.                 if(is_dir("$dir/$file")) {
  265.                         deltreedir("$dir/$file");
  266.                 }else {
  267.                         @unlink("$dir/$file");
  268.                 }
  269.         }
  270. }
  271. function arrayeval($array,$level = 0) {
  272.         $space = '';
  273.         for($i = 0;$i <= $level;$i++) {
  274.                 $space .= "\t";
  275.         }
  276.         $evaluate = "Array\n$space(\n";
  277.         $comma = $space;
  278.         foreach($array as $key =>$val) {
  279.                 $key = is_string($key) ?'\''.addcslashes($key,'\'\\').'\'': $key;
  280.                 $val = !is_array($val) &&(!preg_match("/^\-?\d+$/",$val) ||strlen($val) >12 ||substr($val,0,1)=='0') ?'\''.addcslashes($val,'\'\\').'\'': $val;
  281.                 if(is_array($val)) {
  282.                         $evaluate .= "$comma$key => ".arrayeval($val,$level +1);
  283.                 }else {
  284.                         $evaluate .= "$comma$key => $val";
  285.                 }
  286.                 $comma = ",\n$space";
  287.         }
  288.         $evaluate .= "\n$space)";
  289.         return $evaluate;
  290. }
  291. function cache_write($name,$var,$values) {
  292.         $cachefile = S_ROOT.'./data/data_'.$name.'.php';
  293.         $cachetext = "<?php\r\n".
  294.         "if(!defined('IN_UCHOME')) exit('Access Denied');\r\n".
  295.         '.$var.'='.arrayeval($values).
  296.         "\r\n?>";
  297.         if(!swritefile($cachefile,$cachetext)) {
  298.                 exit("File: $cachefile write error.");
  299.         }
  300. }
  301. ?>
复制代码
回复

使用道具 举报

 楼主| 扯淡的微笑 发表于 2010-1-14 14:30:09 | 显示全部楼层
szrq 发表于 2010-01-13 18:21


好象不行
回复

使用道具 举报

szrq 发表于 2010-1-14 18:54:19 | 显示全部楼层
好象不行
扯淡的微笑 发表于 2010-01-14 14:30



    嗯? 什么不行?
代码已经100%的帮你还原了;
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-22 12:24 , Processed in 0.084663 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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