]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1510-contact-menu
authorMichael Vogel <icarus@dabo.de>
Sun, 11 Oct 2015 03:11:46 +0000 (05:11 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 11 Oct 2015 03:11:46 +0000 (05:11 +0200)
Conflicts:
include/conversation.php

include/acl_selectors.php
include/conversation.php
include/diaspora.php
include/feed.php
include/follow.php
include/items.php
mod/contacts.php
mod/dfrn_confirm.php
mod/dirfind.php
object/Item.php
view/templates/contact_edit.tpl

index 05856bd21738955bd4e5f538ed44c3923b45a8ff..a1154399a713035c43a8f83751006cdcd8228989 100644 (file)
@@ -392,7 +392,6 @@ function acl_lookup(&$a, $out_type = 'json') {
        if(!local_user())
                return "";
 
-
        $start = (x($_REQUEST,'start')?$_REQUEST['start']:0);
        $count = (x($_REQUEST,'count')?$_REQUEST['count']:100);
        $search = (x($_REQUEST,'search')?$_REQUEST['search']:"");
@@ -492,7 +491,7 @@ function acl_lookup(&$a, $out_type = 'json') {
                        $groups[] = array(
                                "type"  => "g",
                                "photo" => "images/twopeople.png",
-                               "name"  => $g['name'],
+                               "name"  => htmlentities($g['name']),
                                "id"    => intval($g['id']),
                                "uids"  => array_map("intval", explode(",",$g['uids'])),
                                "link"  => '',
@@ -547,7 +546,7 @@ function acl_lookup(&$a, $out_type = 'json') {
                        foreach($r as $g) {
                                $x['photos'][] = proxy_url($g['micro'], false, PROXY_SIZE_MICRO);
                                $x['links'][] = $g['url'];
-                               $x['suggestions'][] = $g['name'];
+                               $x['suggestions'][] = htmlentities($g['name']);
                                $x['data'][] = intval($g['id']);
                        }
                }
@@ -560,11 +559,11 @@ function acl_lookup(&$a, $out_type = 'json') {
                        $contacts[] = array(
                                "type"  => "c",
                                "photo" => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
-                               "name"  => $g['name'],
+                               "name"  => htmlentities($g['name']),
                                "id"    => intval($g['id']),
                                "network" => $g['network'],
                                "link" => $g['url'],
-                               "nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
+                               "nick" => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
                                "forum" => $g['forum']
                        );
                }
@@ -605,11 +604,11 @@ function acl_lookup(&$a, $out_type = 'json') {
                                $unknow_contacts[] = array(
                                        "type"  => "c",
                                        "photo" => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
-                                       "name"  => $row['author-name'],
+                                       "name"  => htmlentities($row['author-name']),
                                        "id"    => '',
                                        "network" => "unknown",
                                        "link" => $row['author-link'],
-                                       "nick" => $nick,
+                                       "nick" => htmlentities($nick),
                                        "forum" => false
                                );
                        }
index 1edf794257b9f4b2e3a0116503e826ca68f29f33..107fb84ea94dd1e5cd092bb5581d8f598c9e07ac 100644 (file)
@@ -946,7 +946,7 @@ function like_puller($a,$item,&$arr,$mode) {
                        $arr[$item['thr-parent']] = 1;
                else
                        $arr[$item['thr-parent']] ++;
-               $arr[$item['thr-parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
+               $arr[$item['thr-parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>';
        }
        return;
 }}
@@ -962,7 +962,7 @@ if(! function_exists('format_like')) {
 function format_like($cnt,$arr,$type,$id) {
        $o = '';
        if($cnt == 1)
-               $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
+               $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL;
        else {
                $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
                switch($type) {
index 61a0dfc3cf91d2c804aed06191c8c3b11700b28e..757cf1a6bade158c8a827da9f1a5ed72a7e5f340 100644 (file)
@@ -592,7 +592,7 @@ function diaspora_request($importer,$xml) {
                // perhaps we were already sharing with this person. Now they're sharing with us.
                // That makes us friends.
 
-               if($contact['rel'] == CONTACT_IS_FOLLOWER && !in_array($importer['page-flags'], array(PAGE_COMMUNITY, PAGE_SOAPBOX))) {
+               if($contact['rel'] == CONTACT_IS_FOLLOWER && in_array($importer['page-flags'], array(PAGE_FREELOVE))) {
                        q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
                                intval(CONTACT_IS_FRIEND),
                                intval($contact['id']),
@@ -774,7 +774,7 @@ function diaspora_post_allow($importer,$contact, $is_comment = false) {
        // perhaps we were already sharing with this person. Now they're sharing with us.
        // That makes us friends.
        // Normally this should have handled by getting a request - but this could get lost
-       if($contact['rel'] == CONTACT_IS_FOLLOWER && !in_array($importer['page-flags'], array(PAGE_COMMUNITY, PAGE_SOAPBOX))) {
+       if($contact['rel'] == CONTACT_IS_FOLLOWER && in_array($importer['page-flags'], array(PAGE_FREELOVE))) {
                q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
                        intval(CONTACT_IS_FRIEND),
                        intval($contact['id']),
index dd360a07b58bf46df256c3143e97329435617a1f..f11bb52a1bf4dd3e8153cef2a9971c5250dcc6a0 100644 (file)
@@ -201,8 +201,8 @@ function feed_import($xml,$importer,&$contact, &$hub) {
 
                //$item["object"] = $xml;
 
-               $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'",
-                       intval($importer["uid"]), dbesc($item["uri"]));
+               $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` = '%s'",
+                       intval($importer["uid"]), dbesc($item["uri"]), dbesc(NETWORK_FEED));
                if ($r) {
                        logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG);
                        continue;
index ca0228cc0f89542f3f66ae7531de0fe3c68e6329..21c05c8f3ef139062963dfbd05446b96f492d9a4 100644 (file)
@@ -154,11 +154,7 @@ function new_contact($uid,$url,$interactive = false) {
 
        $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
 
-       if($ret['network'] === NETWORK_MAIL) {
-               $writeable = 1;
-
-       }
-       if($ret['network'] === NETWORK_DIASPORA)
+       if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA)))
                $writeable = 1;
 
        // check if we already have a contact
@@ -215,9 +211,7 @@ function new_contact($uid,$url,$interactive = false) {
                        return $result;
                }
 
-               $new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
-               if($ret['network'] === NETWORK_DIASPORA)
-                       $new_relation = CONTACT_IS_FOLLOWER;
+               $new_relation = ((in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
 
                // create contact record
                $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`,
index 8691ccca495f38f023608d86c15616fb3eac02e8..5c7aa52e6fa70df0822da0aa9eb873bd3f06826c 100644 (file)
@@ -1239,10 +1239,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        $arr['guid']          = ((x($arr,'guid'))          ? notags(trim($arr['guid']))          : get_guid(32, $guid_prefix));
        $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-name']   = ((x($arr,'author-name'))   ? trim($arr['author-name'])   : '');
        $arr['author-link']   = ((x($arr,'author-link'))   ? notags(trim($arr['author-link']))   : '');
        $arr['author-avatar'] = ((x($arr,'author-avatar')) ? notags(trim($arr['author-avatar'])) : '');
-       $arr['owner-name']    = ((x($arr,'owner-name'))    ? notags(trim($arr['owner-name']))    : '');
+       $arr['owner-name']    = ((x($arr,'owner-name'))    ? trim($arr['owner-name'])    : '');
        $arr['owner-link']    = ((x($arr,'owner-link'))    ? notags(trim($arr['owner-link']))    : '');
        $arr['owner-avatar']  = ((x($arr,'owner-avatar'))  ? notags(trim($arr['owner-avatar']))  : '');
        $arr['created']       = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
@@ -1250,8 +1250,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        $arr['commented']     = ((x($arr,'commented')  !== false) ? datetime_convert('UTC','UTC',$arr['commented'])  : datetime_convert());
        $arr['received']      = ((x($arr,'received')  !== false) ? datetime_convert('UTC','UTC',$arr['received'])  : datetime_convert());
        $arr['changed']       = ((x($arr,'changed')  !== false) ? datetime_convert('UTC','UTC',$arr['changed'])  : datetime_convert());
-       $arr['title']         = ((x($arr,'title'))         ? notags(trim($arr['title']))         : '');
-       $arr['location']      = ((x($arr,'location'))      ? notags(trim($arr['location']))      : '');
+       $arr['title']         = ((x($arr,'title'))         ? trim($arr['title'])         : '');
+       $arr['location']      = ((x($arr,'location'))      ? trim($arr['location'])      : '');
        $arr['coord']         = ((x($arr,'coord'))         ? notags(trim($arr['coord']))         : '');
        $arr['last-child']    = ((x($arr,'last-child'))    ? intval($arr['last-child'])          : 0 );
        $arr['visible']       = ((x($arr,'visible') !== false) ? intval($arr['visible'])         : 1 );
@@ -1489,9 +1489,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        $arr = $unescaped;
 
        // find the item we just created
-       $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC ",
+       $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `network` = '%s' ORDER BY `id` ASC ",
                dbesc($arr['uri']),
-               intval($arr['uid'])
+               intval($arr['uid']),
+               dbesc($arr['network'])
        );
 
        if(count($r)) {
index ee62bf3c9e77cf6966101cbe6274c644786901d4..c562c9822da0f0664476ab42567e11b222666986 100644 (file)
@@ -590,6 +590,10 @@ function contacts_content(&$a) {
                if ($contact['network'] == NETWORK_DFRN)
                        $profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
 
+               if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) AND
+                       ($contact['rel'] == CONTACT_IS_FOLLOWER))
+                       $follow = $a->get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
+
                $o .= replace_macros($tpl, array(
                        '$header' => t('Contact Editor'),
                        '$tab_str' => $tab_str,
@@ -617,6 +621,8 @@ function contacts_content(&$a) {
                        '$updpub' => t('Update public posts'),
                        '$last_update' => $last_update,
                        '$udnow' => t('Update now'),
+                       '$follow' => $follow,
+                       '$follow_text' => t("Connect/Follow"),
                        '$profile_select' => $profile_select,
                        '$contact_id' => $contact['id'],
                        '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
index 1cc258853b9b52e154cfc1b795d93bb089ebd2dc..d5dbab951eabc0fc4065339a1710485780b2f802 100644 (file)
@@ -382,7 +382,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                                if($duplex)
                                        $new_relation = CONTACT_IS_FRIEND;
                                else
-                                       $new_relation = CONTACT_IS_SHARING;
+                                       $new_relation = CONTACT_IS_FOLLOWER;
 
                                if($new_relation != CONTACT_IS_FOLLOWER)
                                        $writable = 1;
index 1e4f5539fbe3d21a2501dbee2baede9cdf6f94ec..95f9bf53a8890052a264ae701d911dca765cee57 100644 (file)
@@ -145,7 +145,7 @@ function dirfind_content(&$a, $prefix = "") {
 
                                $o .= replace_macros($tpl,array(
                                        '$url' => zrl($jj->url),
-                                       '$name' => $jj->name,
+                                       '$name' => htmlentities($jj->name),
                                        '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
                                        '$tags' => $jj->tags,
                                        '$conntxt' => $conntxt,
index cc6d08ec2b4e3e7e23d91fdd51b35e9e2d28389b..63fa43d3e25eb2feb41e78f8cab56a84bb2432d7 100644 (file)
@@ -235,6 +235,8 @@ class Item extends BaseObject {
                        if ($shareable) $buttons['share'] = array( t('Share this'), t('share'));
                }
 
+               $comment = $this->get_comment_box($indent);
+
                if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0){
                        $shiny = 'shiny';
                }
@@ -304,6 +306,10 @@ class Item extends BaseObject {
                        !diaspora_is_redmatrix($item["owner-link"]) AND isset($buttons["like"]))
                        unset($buttons["like"]);
 
+               // Diaspora doesn't has multithreaded comments
+               if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment'))
+                       unset($comment);
+
                // Facebook can like comments - but it isn't programmed in the connector yet.
                if (($item["item_network"] == NETWORK_FACEBOOK) AND ($indent == 'comment') AND isset($buttons["like"]))
                        unset($buttons["like"]);
@@ -326,7 +332,7 @@ class Item extends BaseObject {
                        'id' => $this->get_id(),
                        'guid' => urlencode($item['guid']),
                        'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
-                       'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
+                       'olinktitle' => sprintf( t('View %s\'s profile @ %s'), htmlentities($this->get_owner_name()), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
                        'to' => t('to'),
                        'via' => t('via'),
                        'wall' => t('Wall-to-Wall'),
@@ -348,7 +354,7 @@ class Item extends BaseObject {
                        'shiny' => $shiny,
                        'owner_url' => $this->get_owner_url(),
                        'owner_photo' => proxy_url($this->get_owner_photo(), false, PROXY_SIZE_THUMB),
-                       'owner_name' => $owner_name_e,
+                       'owner_name' => htmlentities($owner_name_e),
                        'plink' => get_plink($item),
                        'edpost'    => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''),
                        'isstarred' => $isstarred,
@@ -361,7 +367,7 @@ class Item extends BaseObject {
                        'like' => $like,
                         'dislike'   => $dislike,
                        'switchcomment' => t('Comment'),
-                       'comment' => $this->get_comment_box($indent),
+                       'comment' => $comment,
                        'previewing' => ($conv->is_preview() ? ' preview ' : ''),
                        'wait' => t('Please wait'),
                        'thread_level' => $thread_level,
@@ -523,7 +529,7 @@ class Item extends BaseObject {
         */
        public function set_conversation($conv) {
                $previous_mode = ($this->conversation ? $this->conversation->get_mode() : '');
-               
+
                $this->conversation = $conv;
 
                // Set it on our children too
index 06141081cb7797df3a5a70ee5f7071e4d92d6cf6..95e8e5d29acec265dcc76d3ec4aa06031529dd2f 100644 (file)
@@ -51,6 +51,9 @@
                                {{if $lblsuggest}}
                                        <li><a href="fsuggest/{{$contact_id}}" id="contact-edit-suggest">{{$lblsuggest}}</a></li>
                                {{/if}}
+                               {{if $follow}}
+                                       <li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>
+                               {{/if}}
 
                        </ul>
                </div>