]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorMichael Vogel <icarus@dabo.de>
Mon, 17 Dec 2012 09:32:53 +0000 (10:32 +0100)
committerMichael Vogel <icarus@dabo.de>
Mon, 17 Dec 2012 09:32:53 +0000 (10:32 +0100)
1  2 
boot.php
include/onepoll.php

diff --combined boot.php
index 9dacaaaec9709fcaec6018d48e2f44ef7f756b5f,e69b59d707c1e7cf131df94ddb6a22c745eb8c40..023c5807c8a4bb40474198711b25d4746b0dee6c
+++ b/boot.php
@@@ -12,7 -12,7 +12,7 @@@ require_once('library/Mobile_Detect/Mob
  require_once('include/features.php');
  
  define ( 'FRIENDICA_PLATFORM',     'Friendica');
- define ( 'FRIENDICA_VERSION',      '3.0.1545' );
+ define ( 'FRIENDICA_VERSION',      '3.1.1559' );
  define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
  define ( 'DB_UPDATE_VERSION',      1157      );
  
@@@ -520,19 -520,6 +520,19 @@@ if(! class_exists('App')) 
                        $this->is_tablet = $mobile_detect->isTablet();
                }
  
 +              function get_basepath() {
 +
 +                      $basepath = get_config("system", "basepath");
 +
 +                      if ($basepath == "")
 +                              $basepath = $_SERVER["DOCUMENT_ROOT"];
 +
 +                      if ($basepath == "")
 +                              $basepath = $_SERVER["PWD"];
 +
 +                      return($basepath);
 +              }
 +
                function get_baseurl($ssl = false) {
  
                        $scheme = $this->scheme;
@@@ -1908,7 -1895,7 +1908,7 @@@ function clear_cache($basepath = "", $p
                        $fullpath = $path."/".$file;
                        if ((filetype($fullpath) == "dir") and ($file != ".") and ($file != ".."))
                                clear_cache($basepath, $fullpath);
 -                      if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - $cachetime))
 +                      if ((filetype($fullpath) == "file") and (filectime($fullpath) < (time() - $cachetime)))
                                unlink($fullpath);
                }
                closedir($dh);
diff --combined include/onepoll.php
index 68d7873ecb9c3b54aeabc406c8a906d263eaf83b,8fabede11c9b67800a982d4f45e0ee3cff8a3aeb..10707ea9601dd40bfcd8452d8e800f57553ccd74
@@@ -2,13 -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;
  
  
        if($contact['network'] === NETWORK_DFRN) {
  
+               
                $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
                if(intval($contact['duplex']) && $contact['dfrn-id'])
                        $idtosend = '0:' . $orig_id;
                // they have permission to write to us. We already filtered this in the contact query.
                $perm = 'rw';
  
+               // But this may be our first communication, so set the writable flag if it isn't set already.
+               if(! intval($contact['writable']))
+                       q("update contact set writable = 1 where id = %d limit 1", intval($contact['id']));
                $url = $contact['poll'] . '?dfrn_id=' . $idtosend 
                        . '&dfrn_version=' . DFRN_PROTOCOL_VERSION 
                        . '&type=data&last_update=' . $last_update 
        //                                                      $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'] = "";
                                                //$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']);