ECSHOP禁止杂志编辑器自动修改路径
ECSHOP杂志管理发送促销邮件功能十分强大,但每次编辑内容保存时,均会将HTML邮件内容的“src=”替换为’src=http://.$_SERVER[“HTTP_HOST”]‘,即每次保存均在“src”引用的内容中增加站点路径,例如:
第一次保存:
src=”http://www.phpally.comhttp://www.phpally.com/test.jpg”
第二次保存:
src=”http://www.phpally.comhttp://www.phpally.comhttp://www.phpally.com/test.jpg”
这显然是无法接受的,解决此问题方法比较简单,在/admin/magazine_list.php中找到
1 2 3 4 5 6 7 8 9 10 |
elseif ($_POST['step'] == 2) { $magazine_name = trim($_POST['magazine_name']); $magazine_content = trim($_POST['magazine_content']); $magazine_content = str_replace('src=\"','src=\"http://'.$_SERVER['HTTP_HOST'],$magazine_content); $time = gmtime(); $db->query("UPDATE " . $ecs->table('mail_templates') . " SET is_html = 1, template_subject = '$magazine_name', template_content = '$magazine_content', last_modify = '$time' WHERE type = 'magazine' AND template_id = '$id'"); $links[] = array('text' => $_LANG['magazine_list'], 'href' => 'magazine_list.php?act=list'); sys_msg($_LANG['edit_ok'], 0, $links); } |
注释$magazine_content = str_replace(‘src=\”‘,’src=\”http://’.$_SERVER[‘HTTP_HOST’],$magazine_content);
结果如下:
1 2 3 4 5 6 7 8 9 10 |
elseif ($_POST['step'] == 2) { $magazine_name = trim($_POST['magazine_name']); $magazine_content = trim($_POST['magazine_content']); //$magazine_content = str_replace('src=\"','src=\"http://'.$_SERVER['HTTP_HOST'],$magazine_content); //禁止保存时修改路径 $time = gmtime(); $db->query("UPDATE " . $ecs->table('mail_templates') . " SET is_html = 1, template_subject = '$magazine_name', template_content = '$magazine_content', last_modify = '$time' WHERE type = 'magazine' AND template_id = '$id'"); $links[] = array('text' => $_LANG['magazine_list'], 'href' => 'magazine_list.php?act=list'); sys_msg($_LANG['edit_ok'], 0, $links); } |