1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
zxd_ctrlcenter/main.php
2022-01-26 02:20:35 +08:00

187 lines
10 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/* 公共头部开始 */
require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';
$zbp->Load();
$action = 'root';
if (!$zbp->CheckRights($action)) { $zbp->ShowError(6); die(); }
if (!$zbp->CheckPlugin('zxd_ctrlcenter')) { $zbp->ShowError(48); die(); }
$blogtitle = '控制中心';
require $blogpath . 'zb_system/admin/admin_header.php';
require $blogpath . 'zb_system/admin/admin_top.php';
/* 公共头部结束 */
// 当前用户打开的子插件
if(!empty($_GET['plugin']))
$PluginName = trim($_GET['plugin']); // trim函数去除获得参数的首尾空格
else
$PluginName = "";
if($PluginName=="home") $PluginName=""; // 如果请求的是首页,$PluginName设置为空
// 初始化全局变量
require $blogpath.'zb_users/plugin/zxd_ctrlcenter/config.php';
// 为后续两次遍历定义变量
$dir=$zbp->Config('zxd_ctrlcenter')->path.'plugin/'; // 遍历子插件所在Plugin目录
$file_arr = scandir($dir);
?>
<div id="divMain">
<div class="divHeader"><?php echo $blogtitle; ?></div>
<div class="SubMenu">
<!--左侧功能按钮-->
<a href="./main.php"><span class="m-left<?php if ($PluginName == "") echo " m-now"; ?>">首页</span></a>
<?php
foreach($file_arr as $item){
if($item!=".." && $item !=".") /* 排除..和.的情况 */ {
if(is_dir($dir."/".$item)) /* 判断是否为目录 */ {
$newpath = $dir.$item."/"; /* 子插件所在路径 */
include $newpath.'manage/config.php'; /* 包含插件名称$PluginTitle */
?>
<a href="./main.php?plugin=<?php echo $item; ?>"><span class="m-left<?php if ($PluginName == $item) echo " m-now"; ?>"><?php if(trim($PluginShortTitle)=="") echo $PluginTitle; else echo $PluginShortTitle; ?></span></a>
<td style="text-align: left;"></td>
<?php
/* 清除遍历的变量,以免影响后续 */
$PluginTitle = "";
$PluginShortTitle = "";
$PluginIntro = "";
}
}
}
?>
<!--右侧功能按钮-->
<a href="./main.php?plugin=DeleteConfig"><span class="m-right<?php if ($PluginName == "DeleteConfig") echo " m-now"; ?>">清除设置</span></a>
<a href="./main.php?plugin=about"><span class="m-right<?php if ($PluginName == "about") echo " m-now"; ?>">关于</span></a>
</div>
<div id="divMain2"><!--代码-->
<?php
$PluginTitle = ""; // 将要显示在插件设置页的插件标题后缀(格式:控制中心 - XXX
if($PluginName == "") /* 首页 */ {
?><table style="width: 100%;">
<tr style="text-align: center; font-weight: bold;"> <!-- font-size: medium; -->
<td></td>
<td>子插件名称</td>
<td>操作</td>
</tr><?php
foreach($file_arr as $item){
if($item!=".." && $item !="."){
if(is_dir($dir."/".$item)){
$newpath = $dir.$item."/";
$newurlpath = str_replace($zbp->Config('zxd_ctrlcenter')->path,$zbp->Config('zxd_ctrlcenter')->urlpath,$newpath);
include $newpath.'manage/config.php'; /*包含插件的名称$PluginTitle*/
include $newpath.'manage/status.php'; // 检查插件是否启用status.php
?>
<tr>
<td class="td5"><img src="<?php echo $newurlpath."logo.png"; ?>" style="width:32px; height:32px;"/></td>
<td style="text-align: left;"><?php echo $PluginTitle; ?></td>
<td class="td10" style="text-align: center;">
<a><img width="16" alt="停用"
src="<?php if($pluginstatus) { echo $bloghost.'zb_system/image/admin/control-power.png'; }
else { echo $bloghost.'zb_system/image/admin/control-power-off.png'; } ?>"
title="<?php if($pluginstatus) { echo "禁用"; } else { echo "启用";} ?>"
onclick="window.open().location = '<?php echo @$newurlpath.'manage/status.php?include=c_system_base&action='; if($pluginstatus) { echo 'dis'; } else { echo 'enb';} ?>'; "></a><!--location.reload();-->
&nbsp;&nbsp;
<a href="./main.php?plugin=<?php echo $item; ?>" title="管理" class="button"><img width="16" alt="管理" src="<?php echo $bloghost;?>zb_system/image/admin/setting_tools.png"></a></td>
</tr>
<?php
/* 清除遍历的变量,以免影响后续 */
$PluginTitle = "";
$PluginShortTitle = "";
$PluginIntro = "";
}
}
}
?></table><?php
} elseif ($PluginName == "about") /* 关于页 */ {
require $zbp->Config('zxd_ctrlcenter')->path.'about/readme.html'; // 插件介绍readme.html
$copyrightfilepath = $zbp->Config('zxd_ctrlcenter')->relativepath; // 设置版权信息文件plugin.xml
include $zbp->Config('zxd_ctrlcenter')->path.'public/copyright.php'; // 添加版权信息
$PluginTitle = "关于";
} elseif ($PluginName == "DeleteConfig") /* 清除设置 */ {// style="hidden
// $PluginTitle = "清除所有设置";
?>
<div id="DeleteConfigHiddenInfo">
<script>
if(!confirm("你要清除本插件的全部设置吗?") ||
!confirm('你真的想要清除本插件的全部设置吗?\r\n注意插件设置一经清除无法恢复\r\n您确认要清除吗')){
document.writeln("根据您的选择,未清除插件设置。");
document.writeln("正在返回插件首页...");
window.location.href="./main.php";
} else {
<?php //require $zbp->Config('zxd_ctrlcenter')->path.'public/Delete-ctrlcenter-Config.php'; ?>
window.location.href="./public/ctrlcenter_config.php?action=Delete";
document.writeln("插件设置已清除。");
}
</script>
</div><?php
// $result2 ="<script>var result = confirm('你真的想要清除本插件的全部设置吗?\\r\\n注意插件设置一经清除无法恢复\\r\\n您确认要清除吗'); document.writeln(result);</script>";
// echo '<script> result2 = document.getElementById("DeleteConfigContent"); result2.innerHTML = '.$result2.'; result2.innerHTML = "";</script>';
// if($result2!="true") { goto QuitDeleteConfig; }
//require $zbp->Config('zxd_ctrlcenter')->path.'public/Delete-ctrlcenter-Config.php'; //
//
// if(!$result1)
// $result ="<script>var result = confirm('你真的想要清除本插件的全部设置吗?\\r\\n注意插件设置一经清除无法恢复\\r\\n您确认要清除吗'); document.writeln(result);</script>";
// if($result){
// }
} else /* 插件页(或者插件不存在) */ {
require $zbp->Config('zxd_ctrlcenter')->path.'plugin/'.$PluginName.'/manage/status.php'; // 检查插件是否启用status.php【如果插件不存在这里会报错】
require $zbp->Config('zxd_ctrlcenter')->path.'plugin/'.$PluginName.'/manage/config.php'; // 插件config页config.php包含插件的名称$PluginTitle
if($PluginIntro!="") // 如果插件有信息页面,则输出信息页面,否则不输出
echo $PluginIntro."<br />"; // 插件config页config.php中的$PluginIntro变量
if($pluginstatus) /* 插件已启用 */ {
require $zbp->Config('zxd_ctrlcenter')->path.'public/plugin-disbtn.php'; // 添加禁用插件按钮
echo "<br />";
if(file_exists($zbp->Config('zxd_ctrlcenter')->path.'plugin/'.$PluginName.'/main.php')) // 如果插件有设置页面,则输出设置页面,否则不输出
require $zbp->Config('zxd_ctrlcenter')->path.'plugin/'.$PluginName.'/main.php'; // 插件设置页main.php
} else /* 插件未启用 */ {
require $zbp->Config('zxd_ctrlcenter')->path.'public/plugin-enbbtn.php'; // 添加启用插件按钮
echo "<br />";
}
$copyrightfilepath =$zbp->Config('zxd_ctrlcenter')->relativepath.'plugin/'.$PluginName.'/'; // 设置版权信息文件plugin.xml
include $zbp->Config('zxd_ctrlcenter')->path.'public/copyright.php'; // 添加版权信息
}
?>
</div>
</div>
<!--添加标题栏的标题-->
<script type="text/javascript">
AddHeaderIcon("<?php echo $zbp->Config('zxd_ctrlcenter')->urlpath . 'logo.png'; ?>");
</script>
<!-- 激活顶部快捷方式 -->
<script type="text/javascript">
ActiveTopMenu("topmenu_zxd_ctrlcenter_spider");
</script>
<!--在标题后加上插件的名字-->
<?php if ($PluginTitle!= ""): ?>
<script>
function AddPluginName() {
// 添加子插件名称
document.getElementsByClassName("divHeader")[0].innerHTML += " - <?php echo $PluginTitle; ?>";
// 启用/禁用插件的控制按钮前“引号”中的子插件名称
obj = document.getElementById("pluginName");
if (obj) obj.innerHTML = "“<?php echo $PluginTitle; ?>”";
}
AddPluginName();
</script>
<?php endif; ?>
<!--添加页脚-->
<?php
require $blogpath . 'zb_system/admin/admin_footer.php';
RunTime();
?>