]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote branch 'upstream/master'
authorMichael <icarus@dabo.de>
Sun, 26 Feb 2012 23:03:51 +0000 (00:03 +0100)
committerMichael <icarus@dabo.de>
Sun, 26 Feb 2012 23:03:51 +0000 (00:03 +0100)
13 files changed:
boot.php
include/Scrape.php
include/config.php
include/conversation.php
include/event.php
include/items.php
include/network.php
include/template_processor.php
include/text.php
mod/acl.php
mod/photo.php
mod/ping.php
mod/profile.php

index e9f9efd70d5ee8c9c06ada5d60b467a54ac53b9a..ada0f563d992a52f025d833dbf5bb5c2b7116377 100755 (executable)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '2.3.1263' );
+define ( 'FRIENDICA_VERSION',      '2.3.1264' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
 define ( 'DB_UPDATE_VERSION',      1127      );
 
index e98978f381e8bb3a68c08248f5398712ed6f8e9a..4c4ad3cdb935233d35bc820ff2b607c5c06553da 100755 (executable)
@@ -230,11 +230,16 @@ function scrape_feed($url) {
        $ret = array();
        $s = fetch_url($url);
 
-       if(! $s) 
+       $headers = $a->get_curl_headers();
+       $code = $a->get_curl_code();
+
+       logger('scrape_feed: returns: ' . $code . ' headers=' . $headers, LOGGER_DEBUG);
+
+       if(! $s) {
+               logger('scrape_feed: no data returned for ' . $url); 
                return $ret;
+       }
 
-       $headers = $a->get_curl_headers();
-       logger('scrape_feed: headers=' . $headers, LOGGER_DEBUG);
 
        $lines = explode("\n",$headers);
        if(count($lines)) {
@@ -258,8 +263,10 @@ function scrape_feed($url) {
                logger('scrape_feed: parse error: ' . $e);
        }
 
-       if(! $dom)
+       if(! $dom) {
+               logger('scrape_feed: failed to parse.');
                return $ret;
+       }
 
 
        $head = $dom->getElementsByTagName('base');
@@ -565,7 +572,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
                if($check_feed) {
 
                        $feedret = scrape_feed(($poll) ? $poll : $url);
-                       logger('probe_url: scrape_feed returns: ' . print_r($feedret,true), LOGGER_DATA);
+                       logger('probe_url: scrape_feed ' . (($poll)? $poll : $url) . ' returns: ' . print_r($feedret,true), LOGGER_DATA);
                        if(count($feedret) && ($feedret['feed_atom'] || $feedret['feed_rss'])) {
                                $poll = ((x($feedret,'feed_atom')) ? unamp($feedret['feed_atom']) : unamp($feedret['feed_rss']));
                                if(! x($vcard)) 
index 92694f51932c3d9f2358b7b6778dc1af1a403d86..2cddda0b8d9a98f30f022793c6423378a57382ff 100755 (executable)
@@ -162,7 +162,7 @@ function del_config($family,$key) {
        if(x($a->config[$family],$key))
                unset($a->config[$family][$key]);
        $ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
-               dbesc($cat),
+               dbesc($family),
                dbesc($key)
        );
        return $ret;
index 3d13a1179882d6c269079c981e3adc62d47c6a88..53369cf20f3ae1289fe75eeb47a6ed3e448bdc6c 100755 (executable)
@@ -232,7 +232,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
 
        $alike = array();
        $dlike = array();
-       
+       $o = "";
        
        // array with html for each thread (parent+comments)
        $threads = array();
@@ -436,7 +436,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                }
                                else {
                                        // prevent private email from leaking into public conversation
-                                       if((! $toplevelpost) && (! toplevelprivate) && ($item['private']) && ($profile_owner != local_user()))
+                                       if((! $toplevelpost) && (! $toplevelprivate) && ($item['private']) && ($profile_owner != local_user()))
                                                continue;
                                        $comments_seen ++;
                                }       
@@ -641,7 +641,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                $body = prepare_body($item,true);
 
                                $tmp_item = replace_macros($template,array(
-                                       '$type' => implode("",array_slice(split("/",$item['verb']),-1)),
+                                       '$type' => implode("",array_slice(explode("/",$item['verb']),-1)),
                                        '$tags' => $tags,
                                        '$body' => template_escape($body),
                                        '$id' => $item['item_id'],
index c7669b381c7305441d427cf9dba291f778c2247a..4a9a9a0041e40ec6318070806ec9add4be990333 100755 (executable)
@@ -163,7 +163,7 @@ function bbtoevent($s) {
        if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
                $ev['adjust'] = $match[1];
        $match = '';
-       $ev['nofinish'] = (($ev['start'] && (! $ev['finish'])) ? 1 : 0);
+       $ev['nofinish'] = (($ev['start'] && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
        return $ev;
 
 }
index c461b83b49da65fae7779ea8cd00a08432f25ac3..7d52571c25d6a176d32a0b70540df807102ac2ed 100755 (executable)
@@ -308,7 +308,7 @@ function get_atom_elements($feed,$item) {
        if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
                $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
                foreach($base as $link) {
-                       if(! $res['author-avatar']) {
+                       if(!x($res, 'author-avatar') || !$res['author-avatar']) {
                                if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
                                        $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
                        }
@@ -323,7 +323,7 @@ function get_atom_elements($feed,$item) {
                        foreach($base as $link) {
                                if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link']))
                                        $res['author-link'] = unxmlify($link['attribs']['']['href']);
-                               if(! $res['author-avatar']) {
+                               if(!x($res, 'author-avatar') || !$res['author-avatar']) {
                                        if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo')
                                                $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
                                }
@@ -503,7 +503,7 @@ function get_atom_elements($feed,$item) {
                $base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
 
                foreach($base as $link) {
-                       if(! $res['owner-avatar']) {
+                       if(!x($res, 'owner-avatar') || !$res['owner-avatar']) {
                                if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')                 
                                        $res['owner-avatar'] = unxmlify($link['attribs']['']['href']);
                        }
index 531c3ea4c8714ba18c21a09517e11c28b927bfc2..c72919dd8baf1fdaf25489e4ebccdd2f0fdd65c1 100755 (executable)
@@ -17,7 +17,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
        
        if (!is_null($accept_content)){
                curl_setopt($ch,CURLOPT_HTTPHEADER, array (
-                       "Accept: "+$accept_content
+                       "Accept: " . $accept_content
                ));
        }
        
@@ -60,6 +60,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
        $curl_info = @curl_getinfo($ch);
        $http_code = $curl_info['http_code'];
 
+//     logger('fetch_url:' . $http_code . ' data: ' . $s);
        $header = '';
 
        // Pull out multiple headers, e.g. proxy and continuation headers
@@ -74,11 +75,13 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
        if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
         $matches = array();
         preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
-        $url = trim(array_pop($matches));
-        $url_parsed = @parse_url($url);
+        $newurl = trim(array_pop($matches));
+               if(strpos($newurl,'/') === 0)
+                       $newurl = $url . $newurl;
+        $url_parsed = @parse_url($newurl);
         if (isset($url_parsed)) {
             $redirects++;
-            return fetch_url($url,$binary,$redirects,$timeout);
+            return fetch_url($newurl,$binary,$redirects,$timeout);
         }
     }
 
@@ -163,11 +166,13 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
        if($http_code == 301 || $http_code == 302 || $http_code == 303) {
         $matches = array();
         preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
-        $url = trim(array_pop($matches));
-        $url_parsed = @parse_url($url);
+        $newurl = trim(array_pop($matches));
+               if(strpos($newurl,'/') === 0)
+                       $newurl = $url . $newurl;
+        $url_parsed = @parse_url($newurl);
         if (isset($url_parsed)) {
             $redirects++;
-            return post_url($url,$params,$headers,$redirects,$timeout);
+            return fetch_url($newurl,$binary,$redirects,$timeout);
         }
     }
        $a->set_curl_code($http_code);
index 0d476f0e6e63f54a15f88dc69ebd514f58a22934..7f270fb4b39504b9d601e12d2cc6603a8d6ffde0 100755 (executable)
        
                        if(is_array($r) && count($r)) {
                                foreach ($r as $k => $v ) {
-                                       if (is_array($v))
+                                       if (is_array($v)) {
                                                $this->_build_replace($v, "$prefix$k.");
-                                       
-                                       $this->search[] =  $prefix . $k;
-                                       $this->replace[] = $v;
+                                       } else {
+                                               $this->search[] =  $prefix . $k;
+                                               $this->replace[] = $v;
+                                       }
                                }
                        }
                } 
@@ -53,7 +54,7 @@
                        $keys = array_map('trim',explode(".",$name));           
                        $val = $this->r;
                        foreach($keys as $k) {
-                               $val = $val[$k];
+                               $val = (isset($val[$k]) ? $val[$k] : null);
                        }
                        return $val;
                }
@@ -79,8 +80,8 @@
                        } else {
                                $val = $this->_get_var($args[2]);
                        }
-                       list($strue, $sfalse)= preg_split("|{{ *else *}}|", $args[3]);
-                       return ($val?$strue:$sfalse);
+                       $x = preg_split("|{{ *else *}}|", $args[3]);
+                       return ( $val ? $x[0] : (isset($x[1]) ? $x[1] : ""));
                }
                
                /**
index 0f7d2f731c5328f53f8884e3f8d0945a916d5ce0..1f5d4a3e12ae035a094f9129eb3a4007095a391e 100755 (executable)
@@ -996,7 +996,7 @@ function lang_selector() {
                        }
                        $ll = substr($l,5);
                        $ll = substr($ll,0,strrpos($ll,'/'));
-                       $selected = (($ll === $lang && (x($_SESSION['language']))) ? ' selected="selected" ' : '');
+                       $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? ' selected="selected" ' : '');
                        $o .= '<option value="' . $ll . '"' . $selected . '>' . $ll . '</option>';
                }
        }
index 98ca90ded8b27d55ecf7aa9854e428c1d068c203..375c618c86dbfe483c9229a347a19db174938ba8 100755 (executable)
@@ -16,6 +16,8 @@ function acl_init(&$a){
        if ($search!=""){
                $sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
                $sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
+       } else {
+               $sql_extra = $sql_extra2 = "";
        }
        
        // count groups and contacts
@@ -75,7 +77,7 @@ function acl_init(&$a){
        
        if ($type=='' || $type=='c'){
        
-               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url` FROM `contact` 
+               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` 
                        WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
                        $sql_extra2
                        ORDER BY `name` ASC ",
index a5a5a1dc174fb05ecb1a7e9bc64b527aed58b5eb..c4a93769af8d99a0944c5a1186e053a1507137c3 100755 (executable)
@@ -119,7 +119,7 @@ function photo_init(&$a) {
                // NOTREACHED
        }
 
-       if(intval($customres) && $customres > 0 && $customres < 500) {
+       if(isset($customres) && $customres > 0 && $customres < 500) {
                require_once('include/Photo.php');
                $ph = new Photo($data);
                if($ph->is_valid()) {
index 0f6f0a9d68957959c4d1568d03ca7b5627b20070..7380ff7d051e915c25b2450663bdad36827849ca 100644 (file)
@@ -26,9 +26,10 @@ function ping_init(&$a) {
                $dislikes = array();
                $friends = array();
                $posts = array();
-               
+               $home = 0;
+               $network = 0;
 
-               $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, 
+               $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`, 
                                `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, 
                                `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` 
                                FROM `item` INNER JOIN `item` as `pitem` ON  `pitem`.`id`=`item`.`parent`
index eba9874a8605d0015954b0b8dbe797ae8e04f5fe..74e1a2302002e8e48d4ed34944e2fb09f69e8447 100755 (executable)
@@ -107,7 +107,7 @@ function profile_content(&$a, $update = 0) {
 
        $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
 
-       if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
+       if($a->user['hidewall'] && (! $is_owner) && (! $remote_contact)) {
                notice( t('Access to this profile has been restricted.') . EOL);
                return;
        }
@@ -228,10 +228,12 @@ function profile_content(&$a, $update = 0) {
                        intval($a->profile['profile_uid']),
                        dbesc($parents_str)
                );
+               
+               $items = conv_sort($items,'created');
+       } else {
+               $items = array();
        }
 
-       $items = conv_sort($items,'created');
-
        if($is_owner && ! $update) {
                $o .= get_birthdays();
                $o .= get_events();