JA_TPLS.php (备用)
<?php
/**
* EMLOG 前台模板切换 (非插件) By 【简爱】
*
* 地址:http://www.gouji.org/?post=204
*
* 邮箱:sc.419@qq.com
*
* Name: JA_TPLS.php
**/
$JA_Tpls_CookieOut = 2592000; // 这里是 Cookie 保存时间 (单位:秒)
$JA_Tpls_Choice = 'B'; // 显示方式 A:下拉菜单 B:列表 (大写字母)
// $JA_Tpls_Arr = array();
if(!defined('EMLOG_ROOT')){
define('TPLS_PATH', dirname(__FILE__).'/content/templates/');
$option = '<option value="JA_Tpls_Name_R">恢复默认</option>';
$text = '<br />[ <a href="?JA_Tpls_Name=JA_Tpls_Name_R" title="恢复默认模板" target="_self">恢复默认模板</a> ]';
$ph = @ opendir(TPLS_PATH);
while($file = @ readdir($ph)){
$dir_file = TPLS_PATH.$file;
if($file != "." && $file != ".." && is_dir($dir_file)){
if(isset($_COOKIE['JA_Tpls_Name']) && $_COOKIE['JA_Tpls_Name'] == $file){ // 判断是否为当前皮肤
$option .= '<option selected="" value="'.$file.'">'.$file.'</option>';
$text .= '<br /><b>» '.$file.' [当前模板]</b>';
}else{
$option .= '<option value="'.$file.'">'.$file.'</option>';
$text .= '<br /><a href="?JA_Tpls_Name='.$file.'" title="切换为 [ '.$file.' ]" target="_self">'.$file.'</a>';
$text .= ' [<a href="?JA_Tpls_Name='.$file.'" title="切换为 [ '.$file.' ]" target="_self">切换</a>|';
$text .= '<a href="?theme='.$file.'" title="预览 [ '.$file.' ]" target="_self">预览</a>]';
}
}
}
closedir($ph);
echo 'document.write(\'<style>#JA_Tpls_Choice a{text-decoration: none; outline:none;} #JA_Tpls_Choice a:hover{color:red;font-weight:bold;}#JA_Tpls_Choice{font-size:14px;font-family:Microsoft YaHei;}</style><div id="JA_Tpls_Choice">';
if($JA_Tpls_Choice == 'A'){
echo '<form action="" method="GET"><b>皮肤:</b><select name="JA_Tpls_Name">'.$option.'<input type="submit" value=" 确认 "></form>'; // 显示下拉菜单
}
if($JA_Tpls_Choice == 'B'){
echo '<b>皮肤列表:</b>'.$text; // 直接显示链接
}
echo '</div>\')';
}else{
if(isset($_GET['JA_Tpls_Name'])){
if($_GET['JA_Tpls_Name'] == 'JA_Tpls_Name_R'){
setcookie('JA_Tpls_Name', Option::get('nonce_templet'), time() + $JA_Tpls_CookieOut);
}elseif(!empty($_GET['JA_Tpls_Name'])
&& is_dir(TPLS_PATH . $_GET['JA_Tpls_Name'])
&& $_GET['JA_Tpls_Name'] != $_COOKIE['JA_Tpls_Name']){
setcookie('JA_Tpls_Name', $_GET['JA_Tpls_Name'], time() + $JA_Tpls_CookieOut);
}
$JA_url_in = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : BLOG_URL;
header("location:".$JA_url_in);
exit;
}elseif(isset($_GET['theme']) && !empty($_GET['theme'])
&& is_dir(TPLS_PATH . $_GET['theme'])){
setcookie('JA_Tpls_Name', $_GET['theme'], 0);
$JA_url_in = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : BLOG_URL;
header("location:".$JA_url_in);
exit;
}elseif(isset($_COOKIE['JA_Tpls_Name']) && !empty($_COOKIE['JA_Tpls_Name'])
&& is_dir(TPLS_PATH . $_COOKIE['JA_Tpls_Name'])){
define('JA_Tpls_Name', $_COOKIE['JA_Tpls_Name']);
}else{
define('JA_Tpls_Name', Option::get('nonce_templet'));
}
}
本文出自简爱博客,转载时请注明出处及相应链接。
评论
这是啥?
@lonewolf:前台切换模板的,估计废了或者 快废了