📄 cache.php
字号:
<?php
XYDW == OK or exit('Forbidden');
function cache_root($root=''){
global $db,$rootindex;
if($root==''){
$query = $db->query("SELECT * FROM xydw_root");
while($row = $db->fetch_array($query)){
$root[$row[name]] = $row[value];
}
$root = str_replace("\"","\\\"",$root);
}
$root = str_replace("\\'","'",$root);
$root['uplast'] = ltrim($root['uplast']);
foreach($root as $rootkey => $rootdb){
//$roots .= "\$rootindex['".$rootkey."'] = \"$rootdb\";\n";
$roots .= "\t\"$rootkey\" => \"$rootdb\",\n";
}
$roots = "<?php\r\n\$rootindex = array(\n".$roots."\t);\n?>";
writeover(R_P."data/cache/root.php",$roots);
}
function cache_lanmu(){
global $db,$rootindex;
$lanmuindex_b = array();
$query = $db->query("SELECT lid,name,lup,kind,type FROM xydw_lanmu ORDER BY 'lup' ASC");
while($lanmu = $db->fetch_array($query)){
$cache .= "\$lanmuindex[$lanmu[lid]] = array(\n\t\t\t\"name\" => \"$lanmu[name]\",\n\t\t\t\"kind\" =>\"$lanmu[kind]\",\n\t\t\t\"type\" => \"$lanmu[type]\"\n\t\t\t);\n";
$lanmu_opt .= "<option value='$lanmu[lid]'>$lanmu[name]</option>\n";
$lanmu['type'] == 1 ? $lanmua[] = "$lanmu[lid]" : $lanmuindex_b[$lanmu[kind]] .= "$lanmu[lid],";
}
foreach($lanmua as $lanmub){
$lanmuindex_b[$lanmub] = substr($lanmuindex_b[$lanmub],0,-1);
$lanmuindexb .= "$lanmub => array($lanmuindex_b[$lanmub]),";
$lanmuindex_a .= "$lanmub,";
}
$lanmuindexb = substr($lanmuindexb,0,-1);
$lanmuindex_a = substr($lanmuindex_a,0,-1);
$cache = "<?php\r\n\$lanmu_opt = \"{$lanmu_opt}\";\n{$cache}\n\$lanmuindexa = array($lanmuindex_a);\n\$lanmuindexb = array($lanmuindexb);\n?>";
writeover(R_P."data/cache/lanmu.php",$cache);
}
function cache_link(){
global $db,$rootindex;
$query = $db->query("SELECT * FROM xydw_link");
while($link = $db->fetch_array($query)){
if($link[logo]){
$ilink .= "<a href='$link[url]' target=_blank><img src='$link[logo]' title='$link[js]' border=0></a> ";
} else {
$tlink .= "<a href='$link[url]' target=_blank title='$link[js]'>$link[name]</a> ";
}
}
$cache = "<?php\r\n\$ilink=\"$ilink\";\n \$tlink=\"$tlink\";\n?>";
writeover(R_P."data/cache/link.php",$cache);
$rootindex[indexname] && include_once R_P.'include/doindex.php';
}
function cache_ad(){
global $db,$rootindex;
$query = $db->query("SELECT * FROM xydw_ads WHERE type='1'");
while($ads = $db->fetch_array($query)){
$ads['value'] = str_replace("\"","\\\"",$ads['value']);
$cache .= "\$adsindex[".$ads['name']."] = \"".$ads['value']."\";\n";
}
$cache = "<?php\r\n".$cache."\n?>";
writeover(R_P."data/cache/ads.php",$cache);
}
function cache_person_lanmu(){
global $db,$rootindex;
$query = $db->query("SELECT * FROM xydw_person_lanmu");
while($row = $db->fetch_array($query)){
$cache .= "\$personset['lanmu'][3][$row[id]] = array(
'name' => '$row[name]',
'link' => '$row[link]',
'target' => '$row[target]');\n";
$cache_a[$row[type]][$row[kind]] .= "$row[id],";
}
if($cache_a[1]){
foreach($cache_a[1] as $cache_ak => $caches_as){
$cache .= "\$personset['lanmu'][2][1][$cache_ak] = array(".substr($caches_as,0,-1).");\n";
}
}
if($cache_a[2]){
foreach($cache_a[2] as $cache_ak => $caches_as){
$cache .= "\$personset['lanmu'][2][2][$cache_ak] = array(".substr($caches_as,0,-1).");\n";
}
}
$cache = "<?php\r\n$cache\n?>";
writeover(R_P."data/cache/dlanmu_p.php",$cache);
}
function cache_zhuanti(){
global $db;
$query = $db->query("SELECT * FROM xydw_zhuanti");
while($row = $db->fetch_array($query)){
$cache .= "$row[id] => '$row[name]',";
}
$cache = substr($cache,0,-1);
$cache = "<?php\r\n\$ztindex = array($cache);\n?>";
writeover(R_P."data/cache/zhuanti.php",$cache);
}
function cache_vote(){
global $db;
$query = $db->query("SELECT * FROM xydw_votes WHERE xianshi=1");
while($row = $db->fetch_array($query)){
if($row['type'] == 1){
$type = "radio";
$name = "vote[0]";
} else {
$type = "checkbox";
$name = "vote[]";
}
$row['selects'] = str_replace("\r","", $row['selects']);
$row['selects'] = str_replace("\n\n","", $row['selects']);
$selects = explode("\n",$row['selects']);
unset($input);
foreach($selects as $option){
$option = explode("|",$option);
$option = $option[0];
$i++;
$option && $input .= "<input type=$type name=$name value='$i'> $option<br>\n";
}
$forms = "<form action='vote.php' method=post> $row[subject]<br>\n$input<br><input type=hidden name='name' value='$row[name]'><input type=submit name=submit value='提交'> <a href='vote.php?job=show&name=$row[name]' target=_blank>投票结果</a></form>";
$cache .= "\$votesindex[$row[name]] = \"$forms\";\n";
}
$cache = "<?php\r\n$cache\n?>";
writeover(R_P."data/cache/votes.php",$cache);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -