bbcode: New element "share" for shared content

mail: Now mails connected via subject line if there isn't an appropriate header.
vier: Improvents to the theme so that shared messages are looking fine
This commit is contained in:
Michael Vogel 2012-12-17 03:01:40 +01:00
commit 9c0de28622
4 changed files with 110 additions and 8 deletions

View file

@ -2,6 +2,13 @@
require_once("boot.php");
function RemoveReply($subject) {
while (in_array(strtolower(substr($subject, 0, 3)), array("re:", "aw:")))
$subject = trim(substr($subject, 4));
return($subject);
}
function onepoll_run(&$argv, &$argc){
global $a, $db;
@ -367,10 +374,6 @@ function onepoll_run(&$argv, &$argc){
// $datarray['parent-uri'] = $r[0]['uri'];
}
if(! x($datarray,'parent-uri'))
$datarray['parent-uri'] = $datarray['uri'];
// Decoding the header
$subject = imap_mime_header_decode($meta->subject);
$datarray['title'] = "";
@ -385,11 +388,26 @@ function onepoll_run(&$argv, &$argc){
//$datarray['title'] = notags(trim($meta->subject));
$datarray['created'] = datetime_convert('UTC','UTC',$meta->date);
// Is it reply?
// Is it a reply?
$reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or
(substr(strtolower($datarray['title']), 0, 3) == "re-") or
(raw_refs != ""));
// Remove Reply-signs in the subject
$datarray['title'] = RemoveReply($datarray['title']);
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
if(!x($datarray,'parent-uri') and $reply) {
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) ORDER BY `created` DESC LIMIT 1",
besc(protect_sprintf($datarray['title'])));
if(count($r))
$datarray['parent-uri'] = $r[0]['parent-uri'];
}
if(! x($datarray,'parent-uri'))
$datarray['parent-uri'] = $datarray['uri'];
$r = email_get_msg($mbox,$msg_uid, $reply);
if(! $r) {
logger("Mail: can't fetch msg ".$msg_uid." for ".$mailconf[0]['user']);