📄 configuration.php
字号:
<?php
/*
[SOOBIC!] admin/configuration.php
Version: 1.5
Author: Soolan (soolan@qq.com)
Copyright: soolan (www.soobic.com)
Last Modified: 2005/4/18 10:00
*/
if(!defined("IN_SOOBIC")) {
exit("Access Denied");
}
cpheader();
if(!$allowsetconfig){
cpmsg("对不起,您的管理权限受限,不能进行此操作。");
}
if(!$action){
if($HTTP_GET_VARS['cID']==""){
?>
<table border="0" cellspacing="1" cellpadding="6" width="95%" class="tableout" align="center">
<tr class="header" align="center">
<td >变量名称</td><td >当前设置</td><td>编辑</td></tr>
<?
$configuration_query = $db->query("select configuration_id, configuration_title, configuration_value, use_function from $table_configuration where configuration_group_id = '" . (int)$gID . "' order by sort_order");
while ($configuration = $db->fetch_array($configuration_query)) {
if (tep_not_null($configuration['use_function'])) {
$use_function = $configuration['use_function'];
if (ereg('->', $use_function)) {
$class_method = explode('->', $use_function);
if (!is_object(${$class_method[0]})) {
include($soobic.'./includes/classes/'. $class_method[0] . '.php');
${$class_method[0]} = new $class_method[0]();
}
$cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
} else {
$cfgValue = tep_call_function($use_function, $configuration['configuration_value']);
}
} else {
$cfgValue = $configuration['configuration_value'];
}
if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
$cfg_extra_query = $db->query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from $table_configuration where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
$cfg_extra = $db->fetch_array($cfg_extra_query);
$cInfo_array = array_merge($configuration, $cfg_extra);
}
?> <tr >
<td bgcolor="<?=ALTBG1?>" width="200"><?=$configuration['configuration_title']; ?></td>
<td bgcolor="<?=ALTBG2?>" ><?=htmlspecialchars($cfgValue); ?></td>
<td bgcolor="<?=ALTBG1?>" width="40"><a href="<?=tep_href_link('admincp.php','act=configuration&gID='.$gID.'&cID='.$configuration['configuration_id'])?>">[详情]</a>
</tr>
<?php
}
?>
</table>
<tr bgcolor="<?=ALTBG2?>">
<td align="center">
<br>
<form method="post" action="<?=tep_href_link('admincp.php','act=configuration')?>">
<input type="hidden" name="gID" value="<?=$gID?>">
<input type="hidden" name="action" value="new">
<table border="0" cellspacing="1" cellpadding="6" width="95%" class="tableout" align="center">
<tr class="header"><td colspan="7">自定义变量</td></tr>
<tr align="center" bgcolor="<?=ALTBG1?>"><td width="40%" align="right">变量名称:</td>
<td align="left"><input type="text" size="50" name="configuration_title"></td>
</tr>
<tr align="center" bgcolor="<?=ALTBG2?>"><td align="right">变量:</td>
<td align="left"><input type="text" size="50" name="configuration_key"></td>
</tr>
<tr align="center" bgcolor="<?=ALTBG1?>"><td align="right">变量值:</td>
<td align="left"><input type="text" size="50" name="configuration_value"></td>
</tr>
<tr align="center" bgcolor="<?=ALTBG2?>"><td align="right">变量说明:</td>
<td align="left"><textarea name="configuration_description" cols="50" rows="4"></textarea></td>
</tr>
</table><br><center><?=$warning?>
<input type="submit" name="submit" value="提 交">
<input type="button" name="reset" value="恢复到默认设定" onClick="top.main.location.href='admincp.php?action=usergroups&type=member&reset=yes&groupsubmit=yes';"></center></form><br><br>
<?
}elseif( $HTTP_GET_VARS['cID'] ){
$cfg_extra_query = $db->query("select configuration_key,configuration_value,configuration_title, configuration_description, date_added, last_modified, use_function, set_function from $table_configuration where configuration_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");
$cfg_extra = $db->fetch_array($cfg_extra_query);
if ($cfg_extra['set_function']) {
eval('$value_field = ' . $cfg_extra['set_function']. '"' . htmlspecialchars($cfg_extra[configuration_value]) . '");');
} else {
$value_field ='<input type="text" size="50" name="configuration_value" value="'.$cfg_extra[configuration_value].'">';
}
?>
<table border="0" cellspacing="1" cellpadding="6" width="95%" class="tableout" align="center">
<tr class="header"><td><?=SPECIALS_NOTICE?></td></tr>
<tr bgcolor="<?=ALTBG1?>"><td>
<br><ul><li><?=$cfg_extra['configuration_title']; ?></ul>
<ul><li><?=$cfg_extra['configuration_description']; ?></ul>
</td></tr></table>
<br>
<form method="post" action="<?=tep_href_link('admincp.php','act=configuration')?>">
<table border="0" cellspacing="1" cellpadding="6" width="95%" class="tableout" align="center">
<tr class="header" align="center">
<td >变量名称</td><td >当前设置</td><td >添加时间</td><td >最后更新</td></tr>
<input type="hidden" name="cID" value="<?=$HTTP_GET_VARS['cID'];?>">
<input type="hidden" name="action" value="edit">
<td bgcolor="<?=ALTBG1?>" width="20%"><?=$cfg_extra[configuration_title] ?></td>
<td bgcolor="<?=ALTBG2?>"><?=$value_field?></td>
<td bgcolor="<?=ALTBG1?>" width="20%"><?=$cfg_extra[date_added] ?></td>
<td bgcolor="<?=ALTBG2?>" width="20%"><?=$cfg_extra[last_modified] ?></td>
</table>
<br>
<center>
<input type="submit" name="cidsubmit" value="提 交"></center></form><br><br>
<?
}
}else {
if($action=='edit'){
$db->query("update $table_configuration set configuration_value = '" . addslashes($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");
updatecache("settings");
cpmsg("Lansen! 常规选项成功更新。");
}elseif($action=='new'){
$datetime=date("Y-m-d h:i:s",time());
$db->query("INSERT into $table_configuration (configuration_title ,configuration_key,configuration_value,configuration_description,configuration_group_id,date_added) values ('$configuration_title','$configuration_key','$configuration_value','$configuration_description','$gID','$datetime')");
updatecache("settings");
cpmsg("Lansen! 常规选项增加更新。");
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -