2010/10/25

php list 的 url cache 及 footer 問題

php list 中可以插入遠端的 URL 當作郵件內容,但是內容只要輸入後會被 cache 在 mysql 資料庫中
資料表示 url_cache 如果想立即生效可以從 sql 中刪除被 cache 的 web url 文件
,但是 url cache refetch time 是可以設定的,預設是 3600 秒,只要修改
phplist 目錄中 config/config.php 檔案中的這一段就可以達成
# send a webpage. You can send the contents of a webpage, by adding
# [URL:http://website/file.html] as the content of a message. This can also be personalised
# for users by using eg
# [URL:http://website/file.html?email=[email]]
# the timeout for refetching a URL can be defined here. When the last time a URL has been
# fetched exceeds this time, the URL will be refetched. This is in seconds, 3600 is an hour
# this only affects sending within the same "process queue". If a new process queue is started
# the URL will be fetched the first time anyway. Therefore this is only useful is processing
# your queue takes longer than the time identified here.
define('REMOTE_URL_REFETCH_TIMEOUT',300);

另外在系統中,會自動增加 phplist 的廣告及 footer 訂閱的連結,如果想拿掉可以
修改 admin/sendemaillis.php 其中程式碼為

$url = getConfig("subscribeurl");$sep = ereg('\?',$url)?'&':'?';
$html["subscribe"] = sprintf('<a href="%s">%s</a>',$url,$strThisLink);
$text["subscribe"] = sprintf('%s',$url);
$html["subscribeurl"] = sprintf('%s',$url);
$text["subscribeurl"] = sprintf('%s',$url);
#?mid=1&id=1&uid=a9f35f130593a3d6b89cfe5cfb32a0d8&p=forward&email=michiel%40tincan.co.uk&
$url = getConfig("forwardurl");$sep = ereg('\?',$url)?'&':'?';
$html["forward"] = sprintf('<a href="%s%suid=%s&mid=%d">%s</a>',$url,$sep,$hash,$messageid,$strThisLink);
$text["forward"] = sprintf('%s%suid=%s&mid=%d',$url,$sep,$hash,$messageid);
$html["forwardurl"] = sprintf('%s%suid=%s&mid=%d',$url,$sep,$hash,$messageid);
$text["forwardurl"] = $text["forward"];
$url = getConfig("forwardurl");
# make sure there are no newlines, otherwise they get turned into <br/>s
$html["forwardform"] = sprintf('<form method="get" action="%s" name="forwardform" class="forwardform"><input type=hidden name="uid" value="%s" /><input type=hidden name="mid" value="%d" /><input type=hidden name="p" value="forward" /><input type=text name="email" value="" class="forwardinput" /><input name="Send" type="submit" value="%s" class="forwardsubmit"/></form>',$url,$hash,$messageid,$GLOBALS['strForward']);
// $text["signature"] = "\n\n--\nPowered by PHPlist, www.phplist.com --\n\n";
// skip by mtchang 2010.7.14
$text["signature"] = 'mtchang';



/* skip by mtchang 2010.7.14
if (!EMAILTEXTCREDITS) {
$html["signature"] = $PoweredByImage;#'
<div align="center" id="signature">
<a href="http://www.phplist.com/"><img alt="Powered by PHPlist" border="0" height="31" src="powerphplist.png" title="Powered by PHPlist" width="88" /></a></div>
';
# oops, accidentally became spyware, never intended that, so take it out again :-)
$html["signature"] = preg_replace('/src=".*power-phplist.png"/','src="powerphplist.png"',$html["signature"]);
} else {
$html["signature"] = $PoweredByText;
}
*/
$html["signature"] = '';



在 footer 產生訂閱連結的部分,可以修改

$text["footer"] = eregi_replace("\[SUBSCRIBE\]",$text["subscribe"],$text['footer']);
$html["footer"] = eregi_replace("\[SUBSCRIBE\]",$html["subscribe"],$html['footer']);
$text["footer"] = eregi_replace("\[PREFERENCES\]",$text["preferences"],$text["footer"]);
$html["footer"] = eregi_replace("\[PREFERENCES\]",$html["preferences"],$html["footer"]);
$text["footer"] = eregi_replace("\[FORWARD\]",$text["forward"],$text["footer"]);
$html["footer"] = eregi_replace("\[FORWARD\]",$html["forward"],$html["footer"]);
$html["footer"] = eregi_replace("\[FORWARDFORM\]",$html["forwardform"],$html["footer"]);
$text["footer"] = eregi_replace("\[BLACKLIST\]",$text["blacklist"],$text['footer']);
$html["footer"] = eregi_replace("\[BLACKLIST\]",$html["blacklist"],$html['footer']);
if (sizeof($forwardedby) && isset($forwardedby['email'])) {
$htmlmessage = eregi_replace("\[FORWARDEDBY]",$forwardedby["email"],$htmlmessage);
$textmessage = eregi_replace("\[FORWARDEDBY]",$forwardedby["email"],$textmessage);
$html["footer"] = eregi_replace("\[FORWARDEDBY]",$forwardedby["email"],$html["footer"]);
$text["footer"] = eregi_replace("\[FORWARDEDBY]",$forwardedby["email"],$text["footer"]);
$text["footer"] = eregi_replace("\[UNSUBSCRIBE\]",$text["blacklist"],$text['footer']);
$html["footer"] = eregi_replace("\[UNSUBSCRIBE\]",$html["blacklist"],$html['footer']);
} else {
$text["footer"] = eregi_replace("\[UNSUBSCRIBE\]",$text["unsubscribe"],$text['footer']);
$html["footer"] = eregi_replace("\[UNSUBSCRIBE\]",$html["unsubscribe"],$html['footer']);
}

$html["footer"] = '<div class="emailfooter">'.nl2br($html["footer"]).'</div>';
// skip footer by mtchang 2010.10.25
$html["footer"] = '';

沒有留言: