]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Logging message added
[friendica.git] / include / items.php
index eaa0565467d2459facee812f082151fbc3b907be..5915e2ecee24691462c56959c0a2d68cf9fbfcb7 100644 (file)
@@ -969,7 +969,7 @@ function query_page_info($url, $no_photos = false, $photo = "", $keywords = fals
        $data = Cache::get("parse_url:".$url);
        if (is_null($data)){
                $data = parseurl_getsiteinfo($url, true);
-               Cache::set("parse_url:".$url,serialize($data));
+               Cache::set("parse_url:".$url,serialize($data), CACHE_DAY);
        } else
                $data = unserialize($data);
 
@@ -1210,7 +1210,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        }
 
        $arr['wall']          = ((x($arr,'wall'))          ? intval($arr['wall'])                : 0);
-       $arr['uri']           = ((x($arr,'uri'))           ? notags(trim($arr['uri']))           : random_string());
+       $arr['guid']          = ((x($arr,'guid'))          ? notags(trim($arr['guid']))          : get_guid(32, $arr['network']));
+       $arr['uri']           = ((x($arr,'uri'))           ? notags(trim($arr['uri']))           : $arr['guid']);
        $arr['extid']         = ((x($arr,'extid'))         ? notags(trim($arr['extid']))         : '');
        $arr['author-name']   = ((x($arr,'author-name'))   ? notags(trim($arr['author-name']))   : '');
        $arr['author-link']   = ((x($arr,'author-link'))   ? notags(trim($arr['author-link']))   : '');
@@ -1248,7 +1249,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        $arr['app']           = ((x($arr,'app'))           ? notags(trim($arr['app']))           : '');
        $arr['origin']        = ((x($arr,'origin'))        ? intval($arr['origin'])              : 0 );
        $arr['network']       = ((x($arr,'network'))       ? trim($arr['network'])               : '');
-       $arr['guid']          = ((x($arr,'guid'))          ? notags(trim($arr['guid']))          : get_guid(32, $arr['network']));
        $arr['postopts']      = ((x($arr,'postopts'))      ? trim($arr['postopts'])              : '');
        $arr['resource-id']   = ((x($arr,'resource-id'))   ? trim($arr['resource-id'])           : '');
        $arr['event-id']      = ((x($arr,'event-id'))      ? intval($arr['event-id'])            : 0 );
@@ -1986,13 +1986,12 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
        if($contact['duplex'] && $contact['issued-id'])
                $idtosend = '1:' . $orig_id;
 
-    
+
        $rino = get_config('system','rino_encrypt');
        $rino = intval($rino);
 
-   
+       logger("Local rino version: ". $rino, LOGGER_DEBUG);
 
-       
        $ssl_val = intval(get_config('system','ssl_policy'));
        $ssl_policy = '';
 
@@ -2043,6 +2042,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
        $rino_remote_version = intval($res->rino);
        $page         = (($owner['page-flags'] == PAGE_COMMUNITY) ? 1 : 0);
 
+       logger("Remote rino version: ".$rino_remote_version." for ".$contact["url"], LOGGER_DEBUG);
+
        if($owner['page-flags'] == PAGE_PRVGROUP)
                $page = 2;
 
@@ -2120,26 +2121,26 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
                                        return -1;
                                } catch (CannotPerformOperation $ex) {
                                        logger('Cannot safely create a key');
-                                       return -1; 
+                                       return -1;
                                }
                                try {
                                        $data = Crypto::encrypt($postvars['data'], $key);
                                } catch (CryptoTestFailed $ex) {
                                        logger('Cannot safely perform encryption');
-                                       return -1; 
+                                       return -1;
                                } catch (CannotPerformOperation $ex) {
                                        logger('Cannot safely perform encryption');
-                                       return -1; 
+                                       return -1;
                                }
                                break;
                        default:
                                logger("rino: invalid requested verision '$rino_remote_version'");
                                return -1;
                }
-               
+
                $postvars['rino'] = $rino_remote_version;
                $postvars['data'] = bin2hex($data);
-               
+
                #logger('rino: sent key = ' . $key, LOGGER_DEBUG);
 
 
@@ -2167,7 +2168,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
 
                $postvars['key'] = bin2hex($postvars['key']);
        }
-       
+
 
        logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars,true), LOGGER_DATA);
 
@@ -4299,7 +4300,7 @@ function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
 
        logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: '  . $push_url . ' with verifier ' . $verify_token);
 
-       if(! strlen($contact['hub-verify'])) {
+       if(!strlen($contact['hub-verify']) OR ($contact['hub-verify'] != $verify_token)) {
                $r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d",
                        dbesc($verify_token),
                        intval($contact['id'])