]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'master' into groups
authorfriendica <info@friendica.com>
Sat, 19 Nov 2011 06:04:41 +0000 (22:04 -0800)
committerfriendica <info@friendica.com>
Sat, 19 Nov 2011 06:04:41 +0000 (22:04 -0800)
12 files changed:
boot.php
database.sql
include/conversation.php
include/diaspora.php
include/items.php
include/network.php
include/oembed.php
index.php
library/HTML5/TreeBuilder.php
mod/item.php
mod/settings.php
update.php

index 93b8c01063a23c8b5410075ed27c31aac9f70010..61383f0afdf76afd63b3c586dbe5fb1819b29e96 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,9 +9,9 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDIKA_PLATFORM',     'Friendica');
-define ( 'FRIENDIKA_VERSION',      '2.3.1166' );
+define ( 'FRIENDIKA_VERSION',      '2.3.1169' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
-define ( 'DB_UPDATE_VERSION',      1103      );
+define ( 'DB_UPDATE_VERSION',      1105      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
index 58b81b0ac52f91c58c209d4f42b1a8bf2e41e59b..98067d8d60ae5c193685bab207025e3aae7071ba 100644 (file)
@@ -113,7 +113,8 @@ CREATE TABLE IF NOT EXISTS `contact` (
   KEY `issued-id` (`issued-id`),
   KEY `dfrn-id` (`dfrn-id`),
   KEY `blocked` (`blocked`),
-  KEY `readonly` (`readonly`)  
+  KEY `readonly` (`readonly`),
+  KEY `pending` (`pending`)  
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
 -- --------------------------------------------------------
@@ -225,6 +226,7 @@ CREATE TABLE IF NOT EXISTS `item` (
   `unseen` tinyint(1) NOT NULL DEFAULT '1',
   `deleted` tinyint(1) NOT NULL DEFAULT '0',
   `origin` tinyint(1) NOT NULL DEFAULT '0',
+  `forum_mode` tinyint(1) NOT NULL DEFAULT '0',
   `last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
   PRIMARY KEY (`id`),
   KEY `guid` (`guid`),
@@ -243,10 +245,13 @@ CREATE TABLE IF NOT EXISTS `item` (
   KEY `starred` (`starred`),
   KEY `deleted` (`deleted`),
   KEY `origin`  (`origin`),
+  KEY `forum_mode` (`forum_mode`),
   KEY `last-child` (`last-child`),
   KEY `unseen` (`unseen`),
+  KEY `wall` (`wall`),
   FULLTEXT KEY `title` (`title`),
   FULLTEXT KEY `body` (`body`),
+  FULLTEXT KEY `tag` (`tag`),
   FULLTEXT KEY `allow_cid` (`allow_cid`),
   FULLTEXT KEY `allow_gid` (`allow_gid`),
   FULLTEXT KEY `deny_cid` (`deny_cid`),
@@ -441,6 +446,10 @@ CREATE TABLE IF NOT EXISTS `user` (
   PRIMARY KEY (`uid`), 
   KEY `nickname` (`nickname`),
   KEY `account_expired` (`account_expired`),
+  KEY `hidewall` (`hidewall`),
+  KEY `blockwall` (`blockwall`),
+  KEY `blocked` (`blocked`),
+  KEY `verified` (`verified`),
   KEY `login_date` (`login_date`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
index 7f9627a7d835cc75e3a29ba18dec3280da120343..9ac251e4607385d9030fe993d39926e155f98d87 100644 (file)
@@ -112,10 +112,9 @@ function localize_item(&$item){
                
                $parsedobj = parse_xml_string($xmlhead.$item['object']);
                
-               $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->link, $parsedobj->content);
+               $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->id, $parsedobj->content);
                $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
                
-               
        }
 
 }
index ff0c0c0d79825bd76b24fd74c8fd032f7ed5f4d3..36457655e5564738cf0db2e08144065900c3a6e1 100644 (file)
@@ -455,7 +455,9 @@ function diaspora_request($importer,$xml) {
                                intval($importer['uid'])
                        );
 
-                       if(count($self)) {
+                       // they are not CONTACT_IS_FOLLOWER anymore but that's what we have in the array
+
+                       if(count($self) && $contact['rel'] == CONTACT_IS_FOLLOWER) {
 
                                $arr = array();
                                $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $importer['uid']); 
index 7ab7eeaa403ab9d598af37b79d757ba085f80181..72c1a8b324346e042e668c1381766a9b916f2a00 100644 (file)
@@ -1529,10 +1529,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                                                        continue;
 
                                                // extract tag, if not duplicate, add to parent item
-                                               if($xo->content) {
-                                                       if(! (stristr($r[0]['tag'],trim($xo->content)))) {
+                                               if($xo->id && $xo->content) {
+                                                       $newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
+                                                       if(! (stristr($r[0]['tag'],$newtag))) {
                                                                q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
-                                                                       dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]'),
+                                                                       dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag),
                                                                        intval($r[0]['id'])
                                                                );
                                                        }
@@ -2084,15 +2085,17 @@ dbg(0);
                                        if(($xt->type == ACTIVITY_OBJ_NOTE) && ($xt->id == $r[0]['uri'])) {
 
                                                // extract tag, if not duplicate, and this user allows tags, add to parent item                                         
-                                               if($xo->content) {
 
-                                                       if(! (stristr($r[0]['tag'],trim($xo->content)))) {
+                                               if($xo->id && $xo->content) {
+                                                       $newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
+
+                                                       if(! (stristr($r[0]['tag'],$newtag))) {
                                                                $i = q("SELECT `blocktags` FROM `user` where `uid` = %d LIMIT 1",
                                                                        intval($importer['importer_uid'])
                                                                );
                                                                if(count($i) && ! ($i[0]['blocktags'])) {
                                                                        q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
-                                                                               dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]'),
+                                                                               dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag),
                                                                                intval($r[0]['id'])
                                                                        );
                                                                }
index a9ee3f0a54deece8d4624e337c8569a758a0a448..78ed24074367e24d4fada4dc14103f55667f657f 100644 (file)
@@ -5,7 +5,7 @@
 // results. 
 
 if(! function_exists('fetch_url')) {
-function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
+function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_content=Null) {
 
        $a = get_app();
 
@@ -14,8 +14,16 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
                return false;
 
        @curl_setopt($ch, CURLOPT_HEADER, true);
+       
+       if (!is_null($accept_content)){
+               curl_setopt($ch,CURLOPT_HTTPHEADER, array (
+                       "Accept: "+$accept_content
+               ));
+       }
+       
        @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
-       @curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
+       @curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
+
 
        if(intval($timeout)) {
                @curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
@@ -97,7 +105,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch, CURLOPT_POST,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
-       curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
+       curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
 
        if(intval($timeout)) {
                curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
index 7c0da459409c2859ac543cfa88cf79f6a4450cf4..118f7fa4a39f45fdb5b91819f864f199df40365b 100644 (file)
@@ -13,24 +13,30 @@ function oembed_replacecb($matches){
 function oembed_fetch_url($embedurl){
        
        $txt = Cache::get($embedurl);
+
+       $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm");
+       $ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
+       
                                
        if(is_null($txt)){
                $txt = "";
                
-               // try oembed autodiscovery
-               $redirects = 0;
-               $html_text = fetch_url($embedurl, false, $redirects, 15);
-               if($html_text){
-                       $dom = @DOMDocument::loadHTML($html_text);
-                       if ($dom){
-                               $xpath = new DOMXPath($dom);
-                               $attr = "oembed";
-                       
-                               $xattr = oe_build_xpath("class","oembed");
-                               $entries = $xpath->query("//link[@type='application/json+oembed']");
-                               foreach($entries as $e){
-                                       $href = $e->getAttributeNode("href")->nodeValue;
-                                       $txt = fetch_url($href);
+               if (!in_array($ext, $noexts)){
+                       // try oembed autodiscovery
+                       $redirects = 0;
+                       $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
+                       if($html_text){
+                               $dom = @DOMDocument::loadHTML($html_text);
+                               if ($dom){
+                                       $xpath = new DOMXPath($dom);
+                                       $attr = "oembed";
+                               
+                                       $xattr = oe_build_xpath("class","oembed");
+                                       $entries = $xpath->query("//link[@type='application/json+oembed']");
+                                       foreach($entries as $e){
+                                               $href = $e->getAttributeNode("href")->nodeValue;
+                                               $txt = fetch_url($href);
+                                       }
                                }
                        }
                }
index 78ceb6d770018c1587d6909cb50236a1e31a1919..e43d7332de65c1eba55eb66e0fc5a193eaab4a19 100644 (file)
--- a/index.php
+++ b/index.php
@@ -75,8 +75,6 @@ $a->timezone = (($default_timezone) ? $default_timezone : 'UTC');
 
 date_default_timezone_set($a->timezone);
 
-$a->init_pagehead();
-
 session_start();
 
 /**
@@ -95,6 +93,12 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
        load_translation_table($lang);
 }
 
+/*
+ * Create the page head after setting the language
+ *
+ */
+
+$a->init_pagehead();
 
 /**
  *
index 10d446d1eacdfa3c38d145ceb599c28f015bc2fb..578e73682bbd67f08266fc465de735384558917e 100644 (file)
@@ -3041,9 +3041,13 @@ class HTML5_TreeBuilder {
 
         if (!empty($token['attr'])) {
             foreach($token['attr'] as $attr) {
-                               // mike@macgirvin.com 2011-10-21, stray double quotes and/or numeric tags cause everything to abort
-                               $attr['name'] = str_replace('"','',$attr['name']);
-                if($attr['name'] && (!$el->hasAttribute($attr['name'])) && (! is_numeric($attr['name']))) {
+
+                               // mike@macgirvin.com 2011-11-17, check attribute name for
+                               // validity (ignoring extenders and combiners) as illegal chars in names
+                               // causes everything to abort
+
+                               $valid = preg_match('/^[a-zA-Z\_\:]([\-a-zA-Z0-9\_\:\.]+$)/',$attr['name'],$matches);
+                if($attr['name'] && (!$el->hasAttribute($attr['name'])) && ($valid)) {
                     $el->setAttribute($attr['name'], $attr['value']);
                 }
             }
index ee3bdca992d653757bc6999cce3f7f5b8ec33ecb..145c42cec996b7d2d1272f1fd2e996bd2ae61652 100644 (file)
@@ -865,12 +865,12 @@ function item_post(&$a) {
                                $addr = trim($recip);
                                if(! strlen($addr))
                                        continue;
-                               $disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username']) 
+                               $disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username']) 
                                        . '<br />';
                                $disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
                                $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; 
 
-                               $subject  = '[Friendika]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
+                               $subject  = '[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
                                $headers  = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
                                $headers .= 'MIME-Version: 1.0' . "\n";
                                $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
index 6cc80e3a61be29ad8e01cf2ecd32d73882538fb1..a073a5e984573dd02db94b32409510fd59468cd2 100644 (file)
@@ -644,7 +644,7 @@ function settings_content(&$a) {
        ));
 
        $hide_wall = replace_macros($opt_tpl,array(
-                       '$field'        => array('hidewall',  t('Hide profile details and all your messages from unknown viewers?'), $a->user['hidewall'], '', array(t('No'),t('Yes'))),
+                       '$field'        => array('hidewall',  t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], '', array(t('No'),t('Yes'))),
 
        ));
 
index 362935c38445b0e21a33c21541b2aa13625726c5..96fdec69115b0b0f71fe2f54dad16a97596d1cc3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1103 );
+define( 'UPDATE_VERSION' , 1105 );
 
 /**
  *
@@ -884,6 +884,22 @@ function update_1102() {
 }
 
 
+function update_1103() {
+       q("ALTER TABLE `item` ADD INDEX ( `wall` ) ");
+       q("ALTER TABLE `item` ADD FULLTEXT ( `tag` ) "); 
+       q("ALTER TABLE `contact` ADD INDEX ( `pending` ) ");
+       q("ALTER TABLE `user` ADD INDEX ( `hidewall` ) ");
+       q("ALTER TABLE `user` ADD INDEX ( `blockwall` ) ");
+       q("ALTER TABLE `user` ADD INDEX ( `blocked` ) ");
+       q("ALTER TABLE `user` ADD INDEX ( `verified` ) ");
+
+}
+
+function update_1104() {
+       q("ALTER TABLE `item` ADD `forum_mode` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `origin` , ADD INDEX ( `forum_mode` ) ");
+
+}
+