]> git.mxchange.org Git - friendica.git/commitdiff
Merge commit 'upstream/master'
authorMichael Vogel <icarus@dabo.de>
Wed, 28 Mar 2012 17:52:30 +0000 (19:52 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 28 Mar 2012 17:52:30 +0000 (19:52 +0200)
1  2 
include/email.php
include/poller.php
include/text.php

diff --combined include/email.php
index 43f04d7c2010f27f7d0ebcdfd4562322b7111c9d,8ea8145fb65acc9a58443a8139f3217ce3ee036a..bd44cb763e55a0b5741d8471a621efdef3b14510
@@@ -56,7 -56,7 +56,7 @@@ function email_msg_headers($mbox,$uid) 
        $raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
        $raw_header = str_replace("\r",'',$raw_header);
        $ret = array();
-       $h = split("\n",$raw_header);
+       $h = explode("\n",$raw_header);
        if(count($h))
        foreach($h as $line ) {
            if (preg_match("/^[a-zA-Z]/", $line)) {
@@@ -74,7 -74,7 +74,7 @@@
  }
  
  
 -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);
        $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 --combined include/poller.php
index 085e95a6ae1842c421e9c7eb6d341dbde72a1578,8262c1d605242b0cd7122fb3eec94d5e06e6c181..90a97867c204e5abae28479262c8729e5320b242
@@@ -232,7 -232,7 +232,7 @@@ function poller_run($argv, $argc)
  
                        $importer_uid = $contact['uid'];
                
-                       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+                       $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
                                intval($importer_uid)
                        );
                        if(! count($r))
                                                        //$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 --combined include/text.php
index 0497719498a5d0fafd6668263a2b1fe13442806d,5aaf047291a68d6f5aa9dd2598c1bf486f95e472..6d557ed84e8c62706cca664776d0e71337137055
@@@ -20,7 -20,7 +20,7 @@@ function replace_macros($s,$r) 
        
        //$a = get_app();
        //$a->page['debug'] .= "$tt <br>\n";
-       return $r;
+       return template_unescape($r);
  
  }}
  
@@@ -638,7 -638,7 +638,7 @@@ if(! function_exists('search')) 
  function search($s,$id='search-box',$url='/search',$save = false) {
        $a = get_app();
        $o  = '<div id="' . $id . '">';
-       $o .= '<form action="' . $a->get_baseurl() . $url . '" method="get" >';
+       $o .= '<form action="' . $a->get_baseurl((stristr($url,'network')) ? true : false) . $url . '" method="get" >';
        $o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />';
        $o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; 
        if($save)
@@@ -694,8 -694,13 +694,13 @@@ function linkify($s) 
  
  if(! function_exists('smilies')) {
  function smilies($s, $sample = false) {
        $a = get_app();
  
+       if(intval(get_config('system','no_smilies')) 
+               || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
+               return $s;
        $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_encode',$s);
        $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_encode',$s);
  
                '&lt;/3', 
                '&lt;\\3', 
                ':-)', 
- //            ':)', 
                ';-)', 
- //            ';)', 
                ':-(', 
- //            ':(', 
                ':-P', 
//            ':P', 
              ':-p', 
                ':-"', 
                ':-&quot;', 
                ':-x', 
                ':-X', 
                ':-D', 
- //            ':D', 
                '8-|', 
                '8-O', 
                ':-O', 
                '\\o/', 
                'o.O', 
                'O.o', 
-               '\\.../', 
-               '\\ooo/', 
                ":'(", 
                ":-!", 
                ":-/", 
                ':homebrew', 
                ':coffee', 
                ':facepalm',
-               ':headdesk',
                '~friendika', 
-               '~friendica', 
- //            'Diaspora*' 
-               ':beard',
-               ':whitebeard'
+               '~friendica'
  
        );
  
                '<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
- //            '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
- //            '<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";)"/>',                
                '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
- //            '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />',
//            '<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":P" />',
              '<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />',
- //            '<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":D"/>',                
                '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',                
                '<img src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />',
-               '<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\.../" />',
-               '<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\ooo/" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" />',
                '<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />',
                '<img src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
-               '<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />',
                '<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>',
-               '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>',
- //            '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
-               '<img src="' . $a->get_baseurl() . '/images/smiley-beard.png" alt=":beard" />',
-               '<img src="' . $a->get_baseurl() . '/images/smiley-whitebeard.png" alt=":whitebeard" />'
+               '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>'
        );
  
        $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
@@@ -955,36 -940,6 +940,36 @@@ function prepare_body($item,$attach = f
                        $s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>'; 
        }
  
 +      // Look for spoiler
 +      $spoilersearch = '<blockquote class="spoiler">';
 +
 +      // Remove line breaks before the spoiler
 +      while ((strpos($s, "\n".$spoilersearch) !== false))
 +              $s = str_replace("\n".$spoilersearch, $spoilersearch, $s);
 +      while ((strpos($s, "<br />".$spoilersearch) !== false))
 +              $s = str_replace("<br />".$spoilersearch, $spoilersearch, $s);
 +
 +      while ((strpos($s, $spoilersearch) !== false)) {
 +
 +              $pos = strpos($s, $spoilersearch);
 +              $rnd = random_string(8);
 +              $spoilerreplace = '<br /> <span id="spoiler-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'spoiler-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'.
 +                                      '<blockquote class="spoiler" id="spoiler-'.$rnd.'" style="display: none;">';
 +              $s = substr($s, 0, $pos).$spoilerreplace.substr($s, $pos+strlen($spoilersearch));
 +      }
 +
 +      // Look for quote with author
 +      $authorsearch = '<blockquote class="author">';
 +
 +      while ((strpos($s, $authorsearch) !== false)) {
 +
 +              $pos = strpos($s, $authorsearch);
 +              $rnd = random_string(8);
 +              $authorreplace = '<br /> <span id="author-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'author-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'.
 +                                      '<blockquote class="author" id="author-'.$rnd.'" style="display: block;">';
 +              $s = substr($s, 0, $pos).$authorreplace.substr($s, $pos+strlen($authorsearch));
 +      }
 +
        $prep_arr = array('item' => $item, 'html' => $s);
        call_hooks('prepare_body_final', $prep_arr);
  
@@@ -1345,6 -1300,7 +1330,7 @@@ function file_tag_save_file($uid,$item,
                $saved = get_pconfig($uid,'system','filetags');
                if((! strlen($saved)) || (! stristr($saved,'[' . file_tag_encode($file) . ']')))
                        set_pconfig($uid,'system','filetags',$saved . '[' . file_tag_encode($file) . ']');
+               info( t('Item filed') );
        }
        return true;
  }
@@@ -1380,3 -1336,19 +1366,19 @@@ function file_tag_unsave_file($uid,$ite
        return true;
  }
  
+ function normalise_openid($s) {
+       return trim(str_replace(array('http://','https://'),array('',''),$s),'/');
+ }
+ function undo_post_tagging($s) {
+       $matches = null;
+       $cnt = preg_match_all('/([@#])\[url=(.*?)\](.*?)\[\/url\]/ism',$s,$matches,PREG_SET_ORDER);
+       if($cnt) {
+               foreach($matches as $mtch) {
+                       $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
+               }
+       }
+       return $s;
+ }