From 52ea842e872cc004fd012496c828e9fb6186bec9 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Mar 2012 10:33:39 +0100 Subject: [PATCH 01/17] html2bbcode: don't convert sizes and fonts. --- include/html2bbcode.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 65920380b5..442e386911 100755 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -10,7 +10,7 @@ Originally made for the syncom project: http://wiki.piratenpartei.de/Syncom function node2bbcode(&$doc, $oldnode, $attributes, $startbb, $endbb) { do { - $done = node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb); + $done = node2bbcodesub($doc, $oldnode, $attributes, $startbb, $endbb); } while ($done); } @@ -150,10 +150,14 @@ function html2bbcode($message) node2bbcode($doc, 'font', array('size'=>'/(\d+)/'), '[size=$1]', '[/size]'); node2bbcode($doc, 'font', array('color'=>'/(.+)/'), '[color=$1]', '[/color]'); - node2bbcode($doc, 'span', array('style'=>'/.*color:\s*(.+?)[,;].*/'), '[color="$1"]', '[/color]'); - node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(\d+)/'), '[size=$1]', '[/size]'); + // Untested + //node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(.+?)[,;].*font-family:\s*(.+?)[,;].*color:\s*(.+?)[,;].*/'), '[size=$1][font=$2][color=$3]', '[/color][/font][/size]'); + //node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(\d+)[,;].*/'), '[size=$1]', '[/size]'); + //node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(.+?)[,;].*/'), '[size=$1]', '[/size]'); + node2bbcode($doc, 'span', array('style'=>'/.*color:\s*(.+?)[,;].*/'), '[color="$1"]', '[/color]'); //node2bbcode($doc, 'span', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/font]'); + //node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*font-size:\s*(\d+?)pt.*/'), '[font=$1][size=$2]', '[/size][/font]'); //node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*font-size:\s*(\d+?)px.*/'), '[font=$1][size=$2]', '[/size][/font]'); //node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/font]'); From cb1ecf2c5ad649eb372db9eb3bd1da756f207fb6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 10 Mar 2012 00:15:27 +0100 Subject: [PATCH 02/17] diabook: Moving the location between the icons --- view/theme/diabook/style.css | 3 +++ view/theme/diabook/wall_item.tpl | 3 +-- view/theme/diabook/wallwall_item.tpl | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/view/theme/diabook/style.css b/view/theme/diabook/style.css index bccfea149e..2d4670dca4 100644 --- a/view/theme/diabook/style.css +++ b/view/theme/diabook/style.css @@ -1113,6 +1113,7 @@ section { } .wall-item-container .wall-item-location { padding-right: 40px; + display: table-cell; } .wall-item-container .wall-item-ago { word-wrap: break-word; @@ -1168,6 +1169,7 @@ section { .wall-item-container .wall-item-actions-social { float: left; margin-bottom: 1px; + display: table-cell; } .wall-item-container .wall-item-actions-social a { margin-right: 1em; @@ -1178,6 +1180,7 @@ section { .wall-item-container .wall-item-actions-tools { float: right; width: 80px; + display: table-cell; } .wall-item-container .wall-item-actions-tools a { float: right; diff --git a/view/theme/diabook/wall_item.tpl b/view/theme/diabook/wall_item.tpl index b1a0149490..8c892fd2a9 100644 --- a/view/theme/diabook/wall_item.tpl +++ b/view/theme/diabook/wall_item.tpl @@ -46,7 +46,6 @@
-
$item.location 
@@ -82,7 +81,7 @@ {{ endif }}
- +
$item.location 
diff --git a/view/theme/diabook/wallwall_item.tpl b/view/theme/diabook/wallwall_item.tpl index 603a908c5a..3b103745bb 100644 --- a/view/theme/diabook/wallwall_item.tpl +++ b/view/theme/diabook/wallwall_item.tpl @@ -52,7 +52,6 @@
-
$item.location 
@@ -88,7 +87,8 @@ {{ endif }}
- +
$item.location 
+
@@ -100,4 +100,4 @@
$item.comment -
\ No newline at end of file +
From 15916a2cb717828367fc7e0bb74137942836a772 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 10 Mar 2012 09:52:20 +0100 Subject: [PATCH 03/17] Mail: Removing signatures, gpg, unnecessary line breaks --- include/email.php | 14 +++ include/msgclean.php | 225 +++++++++++++++++++++++++++++++++++++++++++ include/poller.php | 3 +- 3 files changed, 240 insertions(+), 2 deletions(-) create mode 100644 include/msgclean.php diff --git a/include/email.php b/include/email.php index 659978b6ee..a3449a4249 100755 --- a/include/email.php +++ b/include/email.php @@ -1,5 +1,7 @@ parts) { $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'html'); + $html = $ret['body']; if (trim($ret['body']) == '') $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'plain'); @@ -107,6 +110,17 @@ function email_get_msg($mbox,$uid) { else $ret['body'] = $text; } + + $ret['body'] = removegpg($ret['body']); + $msg = removesig($ret['body']); + $ret['body'] = $msg['body']; + $ret['body'] = convertquote($ret['body'], false); + + if (trim($html) != '') + $ret['body'] = removelinebreak($ret['body']); + + $ret['body'] = unifyattributionline($ret['body']); + return $ret; } diff --git a/include/msgclean.php b/include/msgclean.php new file mode 100644 index 0000000000..284ad1ce4b --- /dev/null +++ b/include/msgclean.php @@ -0,0 +1,225 @@ +\s.*?To: (.*?)\s*?Cc: (.*?)\s*?Sent: (.*?)\s.*?Subject: ([^\n].*)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/----- Original Message -----\s.*?From: "([^<"].*?)" <(.*?)>\s.*?To: (.*?)\s*?Sent: (.*?)\s.*?Subject: ([^\n].*)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/-------- Original-Nachricht --------\s*\['.$quote.'\]\nDatum: (.*?)\nVon: (.*?) <(.*?)>\nAn: (.*?)\nBetreff: (.*?)\n/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/-------- Original-Nachricht --------\s*\['.$quote.'\]\sDatum: (.*?)\s.*Von: "([^<"].*?)" <(.*?)>\s.*An: (.*?)\n.*/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/-------- Original-Nachricht --------\s*\['.$quote.'\]\nDatum: (.*?)\nVon: (.*?)\nAn: (.*?)\nBetreff: (.*?)\n/i', "[".$quote."='$2']\n", $message); + + $message = savereplace('/-----Urspr.*?ngliche Nachricht-----\sVon: "([^<"].*?)" <(.*?)>\s.*Gesendet: (.*?)\s.*An: (.*?)\s.*Betreff: ([^\n].*?).*:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/-----Urspr.*?ngliche Nachricht-----\sVon: "([^<"].*?)" <(.*?)>\s.*Gesendet: (.*?)\s.*An: (.*?)\s.*Betreff: ([^\n].*?)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/Am (.*?), schrieb (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + + $message = savereplace('/Am .*?, \d+ .*? \d+ \d+:\d+:\d+ \+\d+\sschrieb\s(.*?)\s<(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/Am (.*?) schrieb (.*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/Am (.*?) schrieb <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/Am (.*?) schrieb (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/Am (.*?) schrieb (.*?)\n(.*?):\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + + $message = savereplace('/(\d+)\/(\d+)\/(\d+) ([^<"].*?) <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message); + + $message = savereplace('/On .*?, \d+ .*? \d+ \d+:\d+:\d+ \+\d+\s(.*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/On (.*?) at (.*?), (.*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$3']\n", $message); + $message = savereplace('/On (.*?)\n([^<].*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/On (.*?), (.*?), (.*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$3']\n", $message); + $message = savereplace('/On ([^,].*?), (.*?)\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/On (.*?), (.*?)\swrote\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + + // Der loescht manchmal den Body - was eigentlich unmoeglich ist + $message = savereplace('/On (.*?),(.*?),(.*?),(.*?), (.*?) wrote:\s*\['.$quote.'\]/i', "[".$quote."='$5']\n", $message); + + $message = savereplace('/Zitat von ([^<].*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/Quoting ([^<].*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/From: "([^<"].*?)" <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/From: <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/Du \(([^)].*?)\) schreibst:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/--- (.*?) <.*?> schrieb am (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/--- (.*?) schrieb am (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/\* (.*?) <(.*?)> hat geschrieben:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/(.*?) <(.*?)> schrieb (.*?)\):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) <(.*?)> schrieb am (.*?) um (.*):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) schrieb am (.*?) um (.*):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) \((.*?)\) schrieb:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/(.*?) schrieb:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/(.*?) <(.*?)> writes:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) \((.*?)\) writes:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + $message = savereplace('/(.*?) writes:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/\* (.*?) wrote:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) wrote \(.*?\):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) wrote:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/([^<].*?) <.*?> hat am (.*?)\sum\s(.*)\sgeschrieben:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + + $message = savereplace('/(\d+)\/(\d+)\/(\d+) ([^<"].*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message); + $message = savereplace('/(\d+)\/(\d+)\/(\d+) (.*?) <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message); + $message = savereplace('/(\d+)\/(\d+)\/(\d+) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message); + $message = savereplace('/(\d+)\/(\d+)\/(\d+) <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message); + + $message = savereplace('/(.*?) <(.*?)> schrubselte:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); + $message = savereplace('/(.*?) \((.*?)\) schrubselte:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message); + + } + return($message); +} + +function removegpg($message) +{ + + $pattern = '/(.*)\s*-----BEGIN PGP SIGNED MESSAGE-----\s*[\r\n].*Hash:.*?[\r\n](.*)'. + '[\r\n]\s*-----BEGIN PGP SIGNATURE-----\s*[\r\n].*'. + '[\r\n]\s*-----END PGP SIGNATURE-----(.*)/is'; + + preg_match($pattern, $message, $result); + + $cleaned = trim($result[1].$result[2].$result[3]); + + $cleaned = str_replace(array("\n- --\n", "\n- -"), array("\n-- \n", "\n-"), $cleaned); + + + if ($cleaned == '') + $cleaned = $message; + + return($cleaned); +} + +function removesig($message) +{ + $sigpos = strrpos($message, "\n-- \n"); + $quotepos = strrpos($message, "[/quote]"); + + if ($sigpos == 0) { + // Speziell fuer web.de, die das als Trenner verwenden + $message = str_replace("\n___________________________________________________________\n", "\n-- \n", $message); + $sigpos = strrpos($message, "\n-- \n"); + $quotepos = strrpos($message, "[/quote]"); + } + + // Sollte sich der Signaturtrenner innerhalb eines Quotes befinden + // wird keine Signaturtrennung ausgefuehrt + if (($sigpos < $quotepos) and ($sigpos != 0)) + return(array('body' => $message, 'sig' => '')); + + // To-Do: Regexp umstellen, so dass auf 1 oder kein Leerzeichen + // geprueft wird + //$message = str_replace("\n--\n", "\n-- \n", $message); + + $pattern = '/(.*)[\r\n]-- [\r\n](.*)/is'; + + preg_match($pattern, $message, $result); + + if (($result[1] != '') and ($result[2] != '')) { + $cleaned = trim($result[1])."\n"; + $sig = trim($result[2]); + // '[hr][size=x-small][color=darkblue]'.trim($result[2]).'[/color][/size]'; + } else { + $cleaned = $message; + $sig = ''; + } + + return(array('body' => $cleaned, 'sig' => $sig)); +} + +function removelinebreak($message) +{ + $arrbody = explode("\n", trim($message)); + + $lines = array(); + $lineno = 0; + + foreach($arrbody as $i => $line) { + $currquotelevel = 0; + $currline = $line; + while ((strlen($currline)>0) and ((substr($currline, 0, 1) == '>') + or (substr($currline, 0, 1) == ' '))) { + if (substr($currline, 0, 1) == '>') + $currquotelevel++; + + $currline = ltrim(substr($currline, 1)); + } + + $quotelevel = 0; + $nextline = trim($arrbody[$i+1]); + while ((strlen($nextline)>0) and ((substr($nextline, 0, 1) == '>') + or (substr($nextline, 0, 1) == ' '))) { + if (substr($nextline, 0, 1) == '>') + $quotelevel++; + + $nextline = ltrim(substr($nextline, 1)); + } + + $len = strlen($line); + $firstword = strpos($nextline.' ', ' '); + + $specialchars = ((substr(trim($nextline), 0, 1) == '-') or + (substr(trim($nextline), 0, 1) == '=') or + (substr(trim($nextline), 0, 1) == '*') or + (substr(trim($nextline), 0, 1) == '·') or + (substr(trim($nextline), 0, 4) == '[url') or + (substr(trim($nextline), 0, 5) == '[size') or + (substr(trim($nextline), 0, 7) == 'http://') or + (substr(trim($nextline), 0, 8) == 'https://')); + + if (!$specialchars) + $specialchars = ((substr(rtrim($line), -1) == '-') or + (substr(rtrim($line), -1) == '=') or + (substr(rtrim($line), -1) == '*') or + (substr(rtrim($line), -1) == '·') or + (substr(rtrim($line), -6) == '[/url]') or + (substr(rtrim($line), -7) == '[/size]')); + + //if ($specialchars) + // echo ("Special\n"); + + if ($lines[$lineno] != '') { + if (substr($lines[$lineno], -1) != ' ') + $lines[$lineno] .= ' '; + + while ((strlen($line)>0) and ((substr($line, 0, 1) == '>') + or (substr($line, 0, 1) == ' '))) { + + $line = ltrim(substr($line, 1)); + } + + } + //else + // $lines[$lineno] = $quotelevel.'-'.$len.'-'.$firstword.'-'; + + $lines[$lineno] .= $line; + //if ((($len + $firstword < 68) and (substr($line, -1, 1) != ' ')) + // or ($quotelevel != $currquotelevel) or $specialchars) + if (((substr($line, -1, 1) != ' ')) + or ($quotelevel != $currquotelevel)) + $lineno++; + } + return(implode("\n", $lines)); + +} +?> diff --git a/include/poller.php b/include/poller.php index cfbc46b87e..3be6caebd7 100755 --- a/include/poller.php +++ b/include/poller.php @@ -1,7 +1,6 @@ Date: Sat, 10 Mar 2012 11:29:40 +0100 Subject: [PATCH 04/17] New config options if ostatus polling should use the priority in the contacts --- include/poller.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/poller.php b/include/poller.php index 3be6caebd7..f165ad5905 100755 --- a/include/poller.php +++ b/include/poller.php @@ -140,7 +140,10 @@ function poller_run($argv, $argc){ if($manual_id) $contact['last-update'] = '0000-00-00 00:00:00'; - if($contact['network'] === NETWORK_DFRN || $contact['network'] === NETWORK_OSTATUS) + if($contact['network'] === NETWORK_DFRN) + $contact['priority'] = 2; + + if(!get_config('system','ostatus_use_priority') and ($contact['network'] === NETWORK_OSTATUS)) $contact['priority'] = 2; if($contact['priority'] || $contact['subhub']) { From 74b3e9f273b019729d213f3ccaeba1bb11d61d24 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 10 Mar 2012 15:50:35 +0100 Subject: [PATCH 05/17] Enabled Caching for items. Changed color of tags in diabook. --- include/text.php | 17 ++++++++++++++++- view/theme/diabook/style.css | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/text.php b/include/text.php index 5ad0154d7a..38736d8364 100644 --- a/include/text.php +++ b/include/text.php @@ -874,6 +874,14 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { + $cache = get_config('system','itemcache'); + + if (($cache != '')) { + $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach; + if (file_exists($cachefile)) + return(file_get_contents($cachefile)); + } + call_hooks('prepare_body_init', $item); $s = prepare_text($item['body']); @@ -882,8 +890,11 @@ function prepare_body($item,$attach = false) { call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html']; - if(! $attach) + if(! $attach) { + if ($cache != '') + file_put_contents($cachefile, $s); return $s; + } $arr = explode(',',$item['attach']); if(count($arr)) { @@ -917,6 +928,10 @@ function prepare_body($item,$attach = false) { $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body_final', $prep_arr); + + if ($cache != '') + file_put_contents($cachefile, $prep_arr['html']); + return $prep_arr['html']; }} diff --git a/view/theme/diabook/style.css b/view/theme/diabook/style.css index 2d4670dca4..0504ce96a9 100644 --- a/view/theme/diabook/style.css +++ b/view/theme/diabook/style.css @@ -1277,14 +1277,14 @@ section { } .tag { /*background: url("../../../images/tag_b.png") repeat-x center left;*/ - color: #3465A4; + color: #999; padding-left: 3px; font-size: 12px; } .tag a { padding-right: 5px; /*background: url("../../../images/tag.png") no-repeat center right;*/ - color: #3465A4; + color: #999; } .wwto { position: absolute !important; From 670b571c8ac0532cc80fff6351f91b1b0fa58e0c Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 10 Mar 2012 18:19:00 +0100 Subject: [PATCH 06/17] Caching improved. --- include/text.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/include/text.php b/include/text.php index 38736d8364..5bf815105b 100644 --- a/include/text.php +++ b/include/text.php @@ -874,25 +874,27 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { + call_hooks('prepare_body_init', $item); + $cache = get_config('system','itemcache'); if (($cache != '')) { - $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach; + $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach."-".hash("crc32", $item['body']); + if (file_exists($cachefile)) - return(file_get_contents($cachefile)); - } - - call_hooks('prepare_body_init', $item); - - $s = prepare_text($item['body']); + $s = file_get_contents($cachefile); + else { + $s = prepare_text($item['body']); + file_put_contents($cachefile, $s); + } + } else + $s = prepare_text($item['body']); $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html']; if(! $attach) { - if ($cache != '') - file_put_contents($cachefile, $s); return $s; } @@ -925,13 +927,9 @@ function prepare_body($item,$attach = false) { $s .= '
'; } - $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body_final', $prep_arr); - if ($cache != '') - file_put_contents($cachefile, $prep_arr['html']); - return $prep_arr['html']; }} From eb3b211461906c405c7d016401cb3cd6d7d03b83 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 14:22:19 +0100 Subject: [PATCH 07/17] New plugin that shows community pages in the sidebar --- addon/pages/README | 3 +++ addon/pages/pages.php | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 addon/pages/README create mode 100755 addon/pages/pages.php diff --git a/addon/pages/README b/addon/pages/README new file mode 100755 index 0000000000..6ec314b702 --- /dev/null +++ b/addon/pages/README @@ -0,0 +1,3 @@ +Pages + +Shows lists of community pages diff --git a/addon/pages/pages.php b/addon/pages/pages.php new file mode 100755 index 0000000000..13e6c4b593 --- /dev/null +++ b/addon/pages/pages.php @@ -0,0 +1,39 @@ + + * + */ + +function pages_install() { + register_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); +} + +function pages_uninstall() { + unregister_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); +} + +function pages_page_end($a,&$b) { + if (($a->module != "network") OR ($a->user['uid'] == 0)) + return; + + $pages = '

'.t("Community").'

    '; + $contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`Name` FROM `contact`, `user` + WHERE `network`= 'dfrn' AND `duplex` + AND `contact`.`nick`=`user`.`nickname` + AND `user`.`page-flags`= %d + AND `contact`.`uid` = %d", + intval(PAGE_COMMUNITY), + intval($a->user['uid'])); + foreach($contacts as $contact) { + $pages .= '
  • '.$contact["Name"]."
  • "; + } + $pages .= "
"; + if (sizeof($contacts) > 0) + $a->page['aside'] = $pages.$a->page['aside']; + +} + +?> From b879a1ddf1575a3bd355edcee634be4a8d179c25 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 17:45:12 +0100 Subject: [PATCH 08/17] Pages: Show every community page - even from foreign servers (with caching) --- addon/pages/pages.php | 70 +++++++++++++++++++++++++++++------- view/theme/diabook/style.css | 3 ++ 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/addon/pages/pages.php b/addon/pages/pages.php index 13e6c4b593..6b242be316 100755 --- a/addon/pages/pages.php +++ b/addon/pages/pages.php @@ -15,25 +15,71 @@ function pages_uninstall() { unregister_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); } +function pages_iscommunity($url, &$pagelist) { + // check every week for the status - should be enough + if ($pagelist[$url]["checked"]') != 0); + + $pagelist[$url] = array("community" => $iscommunity, "checked" => time()); + } else // Fetch from cache + $iscommunity = $pagelist[$url]["community"]; + return($iscommunity); +} + +function pages_getpages($uid) { + + // Fetch cached pagelist from configuration + $pagelist = get_pconfig($uid,'pages','pagelist'); + + if (sizeof($pagelist) == 0) + $pagelist = array(); + + $contacts = q("SELECT `id`, `url`, `Name` FROM `contact` + WHERE `network`= 'dfrn' AND `uid` = %d", + intval($uid)); + + $pages = array(); + + // Look if the profile is a community page + foreach($contacts as $contact) { + if (pages_iscommunity($contact["url"], $pagelist)) + $pages[] = array("url"=>$contact["url"], "Name"=>$contact["Name"]); + } + + // Write back cached pagelist + set_pconfig($uid,'pages','pagelist', $pagelist); + return($pages); +} + function pages_page_end($a,&$b) { + // Only move on if if it's the "network" module and there is a logged on user if (($a->module != "network") OR ($a->user['uid'] == 0)) return; - $pages = '

'.t("Community").'

    '; - $contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`Name` FROM `contact`, `user` - WHERE `network`= 'dfrn' AND `duplex` - AND `contact`.`nick`=`user`.`nickname` - AND `user`.`page-flags`= %d - AND `contact`.`uid` = %d", - intval(PAGE_COMMUNITY), - intval($a->user['uid'])); + $pages = '
    +
    +

    '.t("Community").'

    +
"; if (sizeof($contacts) > 0) $a->page['aside'] = $pages.$a->page['aside']; - } - ?> diff --git a/view/theme/diabook/style.css b/view/theme/diabook/style.css index 0504ce96a9..ce33076451 100644 --- a/view/theme/diabook/style.css +++ b/view/theme/diabook/style.css @@ -484,6 +484,9 @@ code { #sidebar-group-list .tool:hover { background: #EEE; } +#sidebar-pages-list .tool:hover { + background: #EEE; +} .tool .label { float: left; } From 9f76d96d46356b18325ca49c383f94a1958fefd3 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 19:11:25 +0100 Subject: [PATCH 09/17] Cache: item cache now has an autodelete of old files. The pages plugin now sets a link via redirection. So posting works. --- addon/pages/pages.php | 5 +++-- include/poller.php | 13 +++++++++++++ include/text.php | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/addon/pages/pages.php b/addon/pages/pages.php index 6b242be316..9e90cc24dd 100755 --- a/addon/pages/pages.php +++ b/addon/pages/pages.php @@ -55,7 +55,7 @@ function pages_getpages($uid) { // Look if the profile is a community page foreach($contacts as $contact) { if (pages_iscommunity($contact["url"], $pagelist)) - $pages[] = array("url"=>$contact["url"], "Name"=>$contact["Name"]); + $pages[] = array("url"=>$contact["url"], "Name"=>$contact["Name"], "id"=>$contact["id"]); } // Write back cached pagelist @@ -76,7 +76,8 @@ function pages_page_end($a,&$b) { $contacts = pages_getpages($a->user['uid']); foreach($contacts as $contact) { - $pages .= '
  • '.$contact["Name"]."
  • "; + $pages .= '
  • '. + $contact["Name"]."
  • "; } $pages .= ""; if (sizeof($contacts) > 0) diff --git a/include/poller.php b/include/poller.php index f165ad5905..65fafda4c8 100755 --- a/include/poller.php +++ b/include/poller.php @@ -69,6 +69,19 @@ function poller_run($argv, $argc){ // clear old cache Cache::clear(); + // clear item cache files if they are older than one day + $cache = get_config('system','itemcache'); + if (($cache != '') and is_dir($cache)) { + if ($dh = opendir($cache)) { + while (($file = readdir($dh)) !== false) { + $fullpath = $cache."/".$file; + if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - 1800)) + unlink($fullpath); + } + closedir($dh); + } + } + $manual_id = 0; $generation = 0; $hub_update = false; diff --git a/include/text.php b/include/text.php index 5bf815105b..08c5a54246 100644 --- a/include/text.php +++ b/include/text.php @@ -879,7 +879,7 @@ function prepare_body($item,$attach = false) { $cache = get_config('system','itemcache'); if (($cache != '')) { - $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".$attach."-".hash("crc32", $item['body']); + $cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".hash("crc32", $item['body']); if (file_exists($cachefile)) $s = file_get_contents($cachefile); From 739309abd0cb103fe5a4d5081a7252b5698ab787 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 19:41:29 +0100 Subject: [PATCH 10/17] Corrected some git problems --- addon/pages/README | 3 -- addon/pages/pages.php | 86 ------------------------------------------- 2 files changed, 89 deletions(-) delete mode 100755 addon/pages/README delete mode 100755 addon/pages/pages.php diff --git a/addon/pages/README b/addon/pages/README deleted file mode 100755 index 6ec314b702..0000000000 --- a/addon/pages/README +++ /dev/null @@ -1,3 +0,0 @@ -Pages - -Shows lists of community pages diff --git a/addon/pages/pages.php b/addon/pages/pages.php deleted file mode 100755 index 9e90cc24dd..0000000000 --- a/addon/pages/pages.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - */ - -function pages_install() { - register_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); -} - -function pages_uninstall() { - unregister_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); -} - -function pages_iscommunity($url, &$pagelist) { - // check every week for the status - should be enough - if ($pagelist[$url]["checked"]') != 0); - - $pagelist[$url] = array("community" => $iscommunity, "checked" => time()); - } else // Fetch from cache - $iscommunity = $pagelist[$url]["community"]; - return($iscommunity); -} - -function pages_getpages($uid) { - - // Fetch cached pagelist from configuration - $pagelist = get_pconfig($uid,'pages','pagelist'); - - if (sizeof($pagelist) == 0) - $pagelist = array(); - - $contacts = q("SELECT `id`, `url`, `Name` FROM `contact` - WHERE `network`= 'dfrn' AND `uid` = %d", - intval($uid)); - - $pages = array(); - - // Look if the profile is a community page - foreach($contacts as $contact) { - if (pages_iscommunity($contact["url"], $pagelist)) - $pages[] = array("url"=>$contact["url"], "Name"=>$contact["Name"], "id"=>$contact["id"]); - } - - // Write back cached pagelist - set_pconfig($uid,'pages','pagelist', $pagelist); - return($pages); -} - -function pages_page_end($a,&$b) { - // Only move on if if it's the "network" module and there is a logged on user - if (($a->module != "network") OR ($a->user['uid'] == 0)) - return; - - $pages = '
    -
    -

    '.t("Community").'

    -
    "; - if (sizeof($contacts) > 0) - $a->page['aside'] = $pages.$a->page['aside']; -} -?> From 9ca5de8c281fa0a7b2323f33765bca25b64bc29d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 19:45:28 +0100 Subject: [PATCH 11/17] Item cache now is one day. --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/poller.php b/include/poller.php index 65fafda4c8..3bc98e36ff 100755 --- a/include/poller.php +++ b/include/poller.php @@ -75,7 +75,7 @@ function poller_run($argv, $argc){ if ($dh = opendir($cache)) { while (($file = readdir($dh)) !== false) { $fullpath = $cache."/".$file; - if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - 1800)) + if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - 86400)) unlink($fullpath); } closedir($dh); From ebdf4842184cc8d0576abe99b29650c6b6512167 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 19:50:51 +0100 Subject: [PATCH 12/17] Added config options for the item cache and the ostatus priority --- htconfig.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htconfig.php b/htconfig.php index f52aed2b10..9d9c8a2c79 100755 --- a/htconfig.php +++ b/htconfig.php @@ -79,3 +79,9 @@ $a->config['system']['theme'] = 'duepuntozero'; // By default allow pseudonyms $a->config['system']['no_regfullname'] = true; + +// If set to true the priority settings of ostatus contacts are used +$a->config['system']['ostatus_use_priority'] = false; + +// If enabled all items are cached in the given directory +$a->config['system']['itemcache'] = ""; From 7235d5466a4f54cd80d1b661b142ec99230afbf2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 20:24:55 +0100 Subject: [PATCH 13/17] Removed changes --- view/theme/diabook/wall_item.tpl | 14 +++++--------- view/theme/diabook/wallwall_item.tpl | 16 ++++++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/view/theme/diabook/wall_item.tpl b/view/theme/diabook/wall_item.tpl index 6cbab0a715..321bbbe9ea 100644 --- a/view/theme/diabook/wall_item.tpl +++ b/view/theme/diabook/wall_item.tpl @@ -13,7 +13,8 @@ $item.name - menu + menu @@ -21,7 +22,8 @@
    - $item.name + $item.name - {{ if $item.plink }}$item.ago{{ else }} $item.ago {{ endif }} {{ if $item.lock }} - $item.lock {{ endif }} @@ -46,10 +48,7 @@
    -<<<<<<< HEAD:view/theme/diabook/wall_item.tpl -======= ->>>>>>> upstream/master:view/theme/diabook/wall_item.tpl
    @@ -85,11 +84,7 @@ {{ endif }}
    -<<<<<<< HEAD:view/theme/diabook/wall_item.tpl -
    $item.location 
    -=======
    $item.location 
    ->>>>>>> upstream/master:view/theme/diabook/wall_item.tpl
    @@ -102,3 +97,4 @@
    $item.comment
    + diff --git a/view/theme/diabook/wallwall_item.tpl b/view/theme/diabook/wallwall_item.tpl index 4f0a2e25fd..05ed4cc82c 100644 --- a/view/theme/diabook/wallwall_item.tpl +++ b/view/theme/diabook/wallwall_item.tpl @@ -18,7 +18,8 @@ $item.name - menu + menu @@ -26,8 +27,10 @@
    - $item.name - $item.to $item.owner_name + $item.name + $item.to $item.owner_name $item.vwall -   {{ if $item.plink }}$item.ago{{ else }} $item.ago {{ endif }} {{ if $item.lock }} - $item.lock {{ endif }} @@ -52,10 +55,7 @@
    -<<<<<<< HEAD:view/theme/diabook/wallwall_item.tpl -======= ->>>>>>> upstream/master:view/theme/diabook/wallwall_item.tpl
    @@ -92,10 +92,6 @@ {{ endif }}
    $item.location 
    -<<<<<<< HEAD:view/theme/diabook/wallwall_item.tpl - -======= ->>>>>>> upstream/master:view/theme/diabook/wallwall_item.tpl
    From 905ba5ba1d5d8e2d0caa5c0208357672ee527b7d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 22:39:40 +0100 Subject: [PATCH 14/17] Missing field in database.sql --- database.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/database.sql b/database.sql index 35c257f021..2add8bd856 100755 --- a/database.sql +++ b/database.sql @@ -636,6 +636,7 @@ CREATE TABLE IF NOT EXISTS `mailacct` ( `mailbox` CHAR( 255 ) NOT NULL, `user` CHAR( 255 ) NOT NULL , `pass` TEXT NOT NULL , +`reply_to` CHAR( 255 ) NOT NULL , `action` INT NOT NULL , `movetofolder` CHAR(255) NOT NULL , `pubmail` TINYINT(1) NOT NULL DEFAULT '0', From 2ed6b3531eb1a9b778dfd87614fd824480a135e2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Mar 2012 23:29:59 +0100 Subject: [PATCH 15/17] Removing test exports --- include/delivery.php | 4 ++-- include/notifier.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index c1ff07bd54..41869988dc 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -435,8 +435,8 @@ function delivery_run($argv, $argc){ $headers .= 'Reply-to: ' . $reply_to . "\n"; // for testing purposes: Collect exported mails - $file = tempnam("/tmp/friendica/", "mail-out-"); - file_put_contents($file, json_encode($it)); + // $file = tempnam("/tmp/friendica/", "mail-out-"); + // file_put_contents($file, json_encode($it)); $headers .= 'Message-Id: <' . iri2msgid($it['uri']). '>' . "\n"; diff --git a/include/notifier.php b/include/notifier.php index 5b23406fce..c0a98c8eb3 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -648,8 +648,8 @@ function notifier_run($argv, $argc){ $headers .= 'Reply-to: ' . $reply_to . "\n"; // for testing purposes: Collect exported mails - $file = tempnam("/tmp/friendica/", "mail-out2-"); - file_put_contents($file, json_encode($it)); + //$file = tempnam("/tmp/friendica/", "mail-out2-"); + //file_put_contents($file, json_encode($it)); $headers .= 'Message-Id: <' . iri2msgid($it['uri']) . '>' . "\n"; From 6e7a190e9197bcf4d00accc5d85ccca4a080bec8 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 12 Mar 2012 00:22:12 +0100 Subject: [PATCH 16/17] Mail: Subject are now with working "Re:" --- include/delivery.php | 28 +++++++--------------------- include/notifier.php | 31 ++++++++----------------------- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index 41869988dc..44a482ca28 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -446,30 +446,16 @@ function delivery_run($argv, $argc){ if($it['uri'] !== $it['parent-uri']) { $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; - if(! strlen($it['title'])) { + if(!strlen($it['title'])) { $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1", - dbesc($it['parent-uri']) - ); - if(count($r)) { - $subtitle = $r[0]['title']; - if($subtitle) { - if(strncasecmp($subtitle,'RE:',3)) - $subject = $subtitle; - else - $subject = 'Re: ' . $subtitle; - } - } + dbesc($it['parent-uri'])); + + if(count($r) AND ($r[0]['title'] != '')) + $subject = $r[0]['title']; } + if(strncasecmp($subject,'RE:',3)) + $subject = 'Re: '.$subject; } - /*$headers .= 'MIME-Version: 1.0' . "\n"; - //$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n"; - $headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n"; - $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n"; - $html = prepare_body($it); - //$message = '' . $html . ''; - $message = html2plain($html); - logger('notifier: email delivery to ' . $addr); - mail($addr, $subject, $message, $headers);*/ email_send($addr, $subject, $headers, $it); } break; diff --git a/include/notifier.php b/include/notifier.php index c0a98c8eb3..07edc70465 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -655,31 +655,16 @@ function notifier_run($argv, $argc){ if($it['uri'] !== $it['parent-uri']) { $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; - if(! strlen($it['title'])) { + if(!strlen($it['title'])) { $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1", - dbesc($it['parent-uri']) - ); - if(count($r)) { - $subtitle = $r[0]['title']; - if($subtitle) { - if(strncasecmp($subtitle,'RE:',3)) - $subject = $subtitle; - else - $subject = 'Re: ' . $subtitle; - } - } - } - } + dbesc($it['parent-uri'])); - /*$headers .= 'MIME-Version: 1.0' . "\n"; - //$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n"; - $headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n"; - $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n"; - $html = prepare_body($it); - //$message = '' . $html . ''; - $message = html2plain($html); - logger('notifier: email delivery to ' . $addr); - mail($addr, $subject, $message, $headers);*/ + if(count($r) AND ($r[0]['title'] != '')) + $subject = $r[0]['title']; + } + if(strncasecmp($subject,'RE:',3)) + $subject = 'Re: '.$subject; + } email_send($addr, $subject, $headers, $it); } break; From b5120888cf6e3aac29aa2a8d80bddcab73822e1e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 15 Mar 2012 21:17:51 +0100 Subject: [PATCH 17/17] html2bbcode: Disabled size conversion --- include/html2bbcode.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 0dafecc71f..69ccf41b71 100755 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -142,14 +142,14 @@ function html2bbcode($message) node2bbcode($doc, 'span', array('style'=>'font-style: italic;'), '[i]', '[/i]'); node2bbcode($doc, 'span', array('style'=>'font-weight: bold;'), '[b]', '[/b]'); - node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'size'=>'/(\d+)/', 'color'=>'/(.+)/'), '[font=$1][size=$2][color=$3]', '[/color][/size][/font]'); + /*node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'size'=>'/(\d+)/', 'color'=>'/(.+)/'), '[font=$1][size=$2][color=$3]', '[/color][/size][/font]'); node2bbcode($doc, 'font', array('size'=>'/(\d+)/', 'color'=>'/(.+)/'), '[size=$1][color=$2]', '[/color][/size]'); node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'size'=>'/(.+)/'), '[font=$1][size=$2]', '[/size][/font]'); node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'color'=>'/(.+)/'), '[font=$1][color=$3]', '[/color][/font]'); node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/'), '[font=$1]', '[/font]'); node2bbcode($doc, 'font', array('size'=>'/(\d+)/'), '[size=$1]', '[/size]'); node2bbcode($doc, 'font', array('color'=>'/(.+)/'), '[color=$1]', '[/color]'); - +*/ // Untested //node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(.+?)[,;].*font-family:\s*(.+?)[,;].*color:\s*(.+?)[,;].*/'), '[size=$1][font=$2][color=$3]', '[/color][/font][/size]'); //node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(\d+)[,;].*/'), '[size=$1]', '[/size]'); @@ -191,13 +191,13 @@ function html2bbcode($message) node2bbcode($doc, 'hr', array(), "[hr]", ""); - //node2bbcode($doc, 'table', array(), "", ""); - //node2bbcode($doc, 'tr', array(), "\n", ""); - //node2bbcode($doc, 'td', array(), "\t", ""); - node2bbcode($doc, 'table', array(), "[table]", "[/table]"); - node2bbcode($doc, 'th', array(), "[th]", "[/th]"); - node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]"); - node2bbcode($doc, 'td', array(), "[td]", "[/td]"); + node2bbcode($doc, 'table', array(), "", ""); + node2bbcode($doc, 'tr', array(), "\n", ""); + node2bbcode($doc, 'td', array(), "\t", ""); + //node2bbcode($doc, 'table', array(), "[table]", "[/table]"); + //node2bbcode($doc, 'th', array(), "[th]", "[/th]"); + //node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]"); + //node2bbcode($doc, 'td', array(), "[td]", "[/td]"); node2bbcode($doc, 'h1', array(), "\n\n[size=xx-large][b]", "[/b][/size]\n"); node2bbcode($doc, 'h2', array(), "\n\n[size=x-large][b]", "[/b][/size]\n");