📄 cache.php
字号:
<?php
!$_SERVER['PHP_SELF'] && $_SERVER['PHP_SELF']=$_SERVER['SCRIPT_NAME'];
substr($_SERVER['PHP_SELF'],-9,-4)!=='admin' && exit('Forbidden');
function settings() {
$query=query("SELECT * FROM duoxun_settings");
$settings="<?php\r\n\$set=array(\r\n";
while(@extract(db_cv(fetch_array($query)))) {
$name=stripslashes(key_cv($name));
$settings.="\t'$name'=>'$value',\r\n";
}
$settings.=");\r\n?>";
writeover('cache/set.php',$settings);
}
function links() {
$link='';
$link2='';
$query=query("SELECT * FROM duoxun_links ORDER BY displayorder");
while(@extract(db_cv(fetch_array($query)))) {
if($logo) {
$link.="<a href=\"$url\" target=_blank><img src=\"$logo\" alt=\"$descrip\" width=\"88\" height=\"31\"></a>";
} else {
$link2.="<a href=\"$url\" target=\"_blank\" title=\"$descrip\">[$name]</a>";
}
}
$link2&&$link=$link2.'<br>'.$link;
$cache="<?php\r\n\$link='$link';\r\n?>";
writeover('cache/link.php',$cache);
}
function templates() {
global $set;
require_once(R_P.'cache/set.php');
$query=query("SELECT * FROM duoxun_templates WHERE templateid='{$set['templateid']}'");
while(@extract(db_cv(fetch_array($query)))) {
$templatecontent="<?php
\$templateid='$templateid';
\$name='$name';
\$charset='$charset';
\$tplpath='$tplpath';
\$imgpath='$imgpath';
\?>";
writeover(R_P.'cache/template.php',str_replace("\?>","?>",$templatecontent));
}
}
function sortcache() {
$query=query("SELECT * FROM duoxun_sort ORDER BY vieworder");
$catedb=array();
$sort_cache="<?php\r\n\$sort=array(\r\n";
while($sort=db_cv(fetch_array($query))) {
$catedb[]=$sort;
}
$sortcache='';
foreach($catedb as $cate) {
if(!$cate) continue;
$cate['name']=preg_replace("/\<(.+?)\>/is","",$cate['name']);
$sort_cache.="array(\r\n\t'id'=>'$cate[sid]',\r\n\t'name'=>'$cate[name]',\r\n\t'ifcheck'=>'$cate[ifcheck]',\r\n\t'more'=>'list.php?id=$cate[sid]',\r\n\t),\r\n";
$sortcache.="<option value=\"$cate[sid]\">>> {$cate['name']}</option>\r\n";
}
$sort_cache.=");\r\n?>";
writeover(R_P."cache/sortcache.php","<?php\r\n\$sortcache='\r\n$sortcache';\r\n?>");
writeover(R_P.'cache/sort_cache.php',$sort_cache);
}
function toppic() {
$query=query("SELECT * FROM duoxun_toppic ORDER BY displayorder");
$catedb=array();
$cache="<?php\r\n\$toppic=array(\r\n";
while($rs=db_cv(fetch_array($query))) {
$catedb[]=$rs;
}
foreach($catedb as $cate) {
if(!$cate) continue;
$cate['title']=preg_replace("/\<(.+?)\>/is","",$cate['title']);
$cache.="'$cate[tpid]'=>array(\r\n\t'tpid'=>'$cate[tpid]',\r\n\t'displayorder'=>'$cate[displayorder]',\r\n\t'title'=>'$cate[title]',\r\n\t'picurl'=>'$cate[picurl]',\r\n\t'linkurl'=>'$cate[linkurl]',\r\n\t),\r\n";
}
$cache.=");\r\n?>";
writeover(R_P."cache/toppic.php",$cache);
}
function bbs() {
$query=query("SELECT * FROM duoxun_bbs ORDER BY showorder");
$catedb=array();
$cache="<?php\r\n\$bbs=array(\r\n";
while($rs=db_cv(fetch_array($query))) {
$catedb[]=$rs;
}
foreach($catedb as $cate) {
if(!$cate) continue;
$cate['bname']=preg_replace("/\<(.+?)\>/is","",$cate['bname']);
$cache.="array(\r\n\t'bid'=>'$cate[bid]',\r\n\t'name'=>'$cate[bname]',\r\n\t'code'=>'$cate[bcode]',\r\n\t'more'=>'$cate[bmore]',\r\n\t),\r\n";
}
$cache.=");\r\n?>";
writeover(R_P."cache/bbs.php",$cache);
}
function wordfb() {
$wordfb="\$wordfb=array(\r\n";
$query=query("SELECT * FROM duoxun_wordfb");
while(@extract(db_cv(fetch_array($query)))) {
if($word) {
$wordfb.="\t'$word'=>'$wordreplace',\r\n";
}
}
$wordfb.=");";
writeover(R_P."cache/wordfb.php","<?php\r\n".$wordfb."\r\n?>");
}
function db_cv($array) {
if(is_array($array)) {
foreach($array as $key=>$value) {
$array[$key]=str_replace(array("\\","'"),array("\\\\","\'"),$value);
}
}
return $array;
}
function key_cv($key) {
$key=str_replace(array(';','\\','/','(',')','$'),'',$key);
return $key;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -