广州传奇网络

地址:广州市天河区东圃大马路富华楼C座

电话:13808825895

邮箱:gz020wbs@163.com

QQ:1564443073

网址:http://www.020wbs.com/

首页 > 二次开发Ecshop二次开发 > ecshop恢复备份的一个bug

二次开发Ecshop二次开发

二次开发Ecshop二次开发

ecshop恢复备份的一个bug

 ECSHOP“恢复备份”页面有个小bug,未选择文件提示“删除成功”,添加判断语句避免此问题。

未选择文件提示“删除成功”

一、编辑/admin/database.php,添加判断语句

/* 删除备份 */
if ($_REQUEST['act'] == 'remove')
{
/* 权限判断 */
admin_priv('db_backup');

if (isset($_POST['file']))
{
$m_file = array(); //多卷文件
$s_file = array(); //单卷文件

$path = ROOT_PATH . DATA_DIR . '/sqldata/';

foreach ($_POST['file'] AS $file)
{
if (preg_match('/_[0-9]+\.sql$/', $file))
{
$m_file[] = substr($file, 0, strrpos($file, '_'));
}
else
{
$s_file[] = $file;
}
}

if ($m_file)
{
$m_file = array_unique ($m_file);

/* 获取文件列表 */
$real_file = array();

$folder = opendir($path);
while ($file = readdir($folder))
{
if ( preg_match('/_[0-9]+\.sql$/', $file) && is_file($path . $file))
{
$real_file[] = $file;
}
}

foreach ($real_file AS $file)
{
$short_file = substr($file, 0, strrpos($file, '_'));
if (in_array($short_file, $m_file))
{
@unlink($path . $file);
}
}
sys_msg($_LANG['remove_success'] , 0, array(array('text'=>$_LANG['restore'], 'href'=>'database.php?act=restore')));

}

if ($s_file)
{
foreach ($s_file AS $file)
{
@unlink($path . $file);
}
sys_msg($_LANG['remove_success'] , 0, array(array('text'=>$_LANG['restore'], 'href'=>'database.php?act=restore')));
}
}
else
{
sys_msg($_LANG['select_empty'], 1);
}
}

二、编辑/languages/zh_cn/admin/database.php,添加语言项

$_LANG['select_empty'] = '请选择文件!';