码迷,mamicode.com
首页 > 其他好文 > 详细

禁止ecshop杂志编辑器自动修改路径

时间:2014-08-20 19:45:03      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   os   ar   问题   html   line   

ECSHOP杂志管理发送促销邮件功能十分强大,但每次编辑内容保存时,均会将HTML邮件内容的“src=”替换为’src=http://.$_SERVER["HTTP_HOST"]‘,即每次保存均在“src”引用的内容中增加站点路径,例如:

第一次保存:

src=”http://mm.meiwei101.com//test.jpg”

第二次保存:

src=”http://mm.meiwei101.com/http://mm.meiwei101.com//test.jpg”

这显然是无法接受的,解决此问题方法比较简单,在/admin/magazine_list.php中找到

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);

结果如下:

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);
	}


禁止ecshop杂志编辑器自动修改路径,布布扣,bubuko.com

禁止ecshop杂志编辑器自动修改路径

标签:style   http   color   os   ar   问题   html   line   

原文地址:http://my.oschina.net/Android1989/blog/304881

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!