From 3c168503834651b56b9b5de61621e8fbe958c298 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 11 Mar 2012 12:00:32 +0100 Subject: [PATCH 001/219] OpenID: display error msg if ID URL used to register an account does not exist --- include/auth.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/auth.php b/include/auth.php index fc52684e64..6a3e31cb7d 100755 --- a/include/auth.php +++ b/include/auth.php @@ -117,10 +117,15 @@ else { // NOTREACHED } // new account - $_SESSION['register'] = 1; - $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); - $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); - goaway($openid->authUrl()); + try { + $_SESSION['register'] = 1; + $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); + $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); + goaway($openid->authUrl()); + } catch (Exception $e) { + // if the OpenID is misspelled we land here + notice( t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.

The error message was: ').$e->getMessage() ); + } // NOTREACHED } } From 6cbd765e1ff77a1efb01b1f096a875c881c43905 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 11 Mar 2012 12:03:47 +0100 Subject: [PATCH 002/219] Revert "OpenID: display error msg if ID URL used to register an account does not exist" This reverts commit 3c168503834651b56b9b5de61621e8fbe958c298. --- include/auth.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/include/auth.php b/include/auth.php index 6a3e31cb7d..fc52684e64 100755 --- a/include/auth.php +++ b/include/auth.php @@ -117,15 +117,10 @@ else { // NOTREACHED } // new account - try { - $_SESSION['register'] = 1; - $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); - $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); - goaway($openid->authUrl()); - } catch (Exception $e) { - // if the OpenID is misspelled we land here - notice( t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.

The error message was: ').$e->getMessage() ); - } + $_SESSION['register'] = 1; + $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); + $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); + goaway($openid->authUrl()); // NOTREACHED } } From 8a1f175df022e2fc2c2162aa314ea34454482d48 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 17 Mar 2012 11:07:49 +0100 Subject: [PATCH 003/219] New bbcode element: "spoiler". Mail: Top post quotes are now embraced in "spoiler" elements --- include/bbcode.php | 10 ++++++++++ include/email.php | 4 ++-- include/msgclean.php | 2 +- include/poller.php | 7 ++++++- include/quoteconvert.php | 2 +- include/text.php | 19 +++++++++++++++++++ 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index d69cb263f8..9fce895b8d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -189,8 +189,18 @@ function bbcode($Text,$preserve_nl = false) { // Check for [code] text $Text = preg_replace("/\[code\](.*?)\[\/code\]/ism","$CodeLayout", $Text); + // Declare the format for [spoiler] layout + $SpoilerLayout = '
$1
'; + + // Check for [spoiler] text + // handle nested quotes + $endlessloop = 0; + while ((strpos($Text, "[/spoiler]") !== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) + $Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism","$SpoilerLayout", $Text); + // Declare the format for [quote] layout $QuoteLayout = '
$1
'; + // Check for [quote] text // handle nested quotes $endlessloop = 0; diff --git a/include/email.php b/include/email.php index a3449a4249..43f04d7c20 100755 --- a/include/email.php +++ b/include/email.php @@ -74,7 +74,7 @@ function email_msg_headers($mbox,$uid) { } -function email_get_msg($mbox,$uid) { +function email_get_msg($mbox,$uid, $reply) { $ret = array(); $struc = (($mbox && $uid) ? @imap_fetchstructure($mbox,$uid,FT_UID) : null); @@ -114,7 +114,7 @@ function email_get_msg($mbox,$uid) { $ret['body'] = removegpg($ret['body']); $msg = removesig($ret['body']); $ret['body'] = $msg['body']; - $ret['body'] = convertquote($ret['body'], false); + $ret['body'] = convertquote($ret['body'], $reply); if (trim($html) != '') $ret['body'] = removelinebreak($ret['body']); diff --git a/include/msgclean.php b/include/msgclean.php index 284ad1ce4b..eabb47788a 100644 --- a/include/msgclean.php +++ b/include/msgclean.php @@ -13,7 +13,7 @@ function savereplace($pattern, $replace, $text) function unifyattributionline($message) { - $quotestr = array('quote', 'collapsed'); + $quotestr = array('quote', 'spoiler'); foreach ($quotestr as $quote) { $message = savereplace('/----- Original Message -----\s.*?From: "([^<"].*?)" <(.*?)>\s.*?To: (.*?)\s*?Cc: (.*?)\s*?Sent: (.*?)\s.*?Subject: ([^\n].*)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message); diff --git a/include/poller.php b/include/poller.php index 3bc98e36ff..085e95a6ae 100755 --- a/include/poller.php +++ b/include/poller.php @@ -504,7 +504,12 @@ function poller_run($argv, $argc){ //$datarray['title'] = notags(trim($meta->subject)); $datarray['created'] = datetime_convert('UTC','UTC',$meta->date); - $r = email_get_msg($mbox,$msg_uid); + // Is it reply? + $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or + (substr(strtolower($datarray['title']), 0, 3) == "re-") or + (raw_refs != "")); + + $r = email_get_msg($mbox,$msg_uid, $reply); if(! $r) { logger("Mail: can't fetch msg ".$msg_uid); continue; diff --git a/include/quoteconvert.php b/include/quoteconvert.php index 3aee93234f..2a6d28370a 100644 --- a/include/quoteconvert.php +++ b/include/quoteconvert.php @@ -124,7 +124,7 @@ function removetofu($message) } if ($quotestart != 0) { - $message = trim(substr($message, 0, $quotestart))."\n[collapsed]\n".substr($message, $quotestart+7, -8).'[/collapsed]'; + $message = trim(substr($message, 0, $quotestart))."\n[spoiler]".substr($message, $quotestart+7, -8).'[/spoiler]'; } return($message); diff --git a/include/text.php b/include/text.php index d34fd7fbee..bcd567a154 100644 --- a/include/text.php +++ b/include/text.php @@ -955,6 +955,25 @@ function prepare_body($item,$attach = false) { $s .= '
' . t('Filed under:') . ' ' . $x . '
'; } + // Look for spoiler + $spoilersearch = '
'; + + // Remove line breaks before the spoiler + while ((strpos($s, "\n".$spoilersearch) !== false)) + $s = str_replace("\n".$spoilersearch, $spoilersearch, $s); + while ((strpos($s, "
".$spoilersearch) !== false)) + $s = str_replace("
".$spoilersearch, $spoilersearch, $s); + + while ((strpos($s, $spoilersearch) !== false)) { + + $pos = strpos($s, $spoilersearch); + $rnd = random_string(8); + $spoilerreplace = ''.sprintf(t('Click to open/close')).''. + '