]> git.mxchange.org Git - friendica.git/commitdiff
Merge https://github.com/friendica/friendica into pull
authorfriendica <info@friendica.com>
Wed, 5 Sep 2012 05:53:32 +0000 (22:53 -0700)
committerfriendica <info@friendica.com>
Wed, 5 Sep 2012 05:53:32 +0000 (22:53 -0700)
1  2 
include/conversation.php
mod/item.php

diff --combined include/conversation.php
index 13dfeeadd6d0d088b94572ae9fdee03f6c0299b2,90efc6d247f6dda0b2822d58bfd60316d12d5f38..3f493a6dc141f42757d9c807093a95aa3df315f2
@@@ -346,7 -346,7 +346,7 @@@ function count_descendants($item) 
   * Recursively prepare a thread for HTML
   */
  
- function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, $thread_level=1) {
+ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, $previewing, $thread_level=1) {
        $result = array();
  
        $wall_template = 'wall_thread.tpl';
                        $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
                else
                        $edpost = false;
 -              if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
 +
 +              if($item['uid'] == local_user())
                        $dropping = true;
 +              elseif(is_array($_SESSION['remote'])) {
 +                      foreach($_SESSION['remote'] as $visitor) {
 +                              if($visitor['cid'] == $item['contact-id']) {
 +                                      $dropping = true;
 +                                      break;
 +                              }
 +                      }
 +              }
  
                $drop = array(
                        'dropping' => $dropping,
  
                $item_result['children'] = array();
                if(count($item['children'])) {
-                       $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, ($thread_level + 1));
+                       $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, $previewing, ($thread_level + 1));
                }
                $item_result['private'] = $item['private'];
                $item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
@@@ -910,7 -901,7 +910,7 @@@ function conversation(&$a, $items, $mod
                                }
                        }
  
-                       $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode,  $profile_owner, $alike, $dlike);
+                       $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode,  $profile_owner, $alike, $dlike, $previewing);
                }
        }
                
diff --combined mod/item.php
index e3230c86436bebfb2f730bdb32ee7804d8d896aa,c2033d2503c65ad5b5c8483bc32ae94327cf7da9..52ea9d58c90c253c1b969ac593316592c3edb8f8
@@@ -306,7 -306,6 +306,7 @@@ function item_post(&$a) 
  
        $author = null;
        $self   = false;
 +      $contact_id = 0;
  
        if((local_user()) && (local_user() == $profile_uid)) {
                $self = true;
                );
        }
        elseif(remote_user()) {
 -              $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
 -                      intval(remote_user())
 -              );
 +              if(is_array($_SESSION['remote'])) {
 +                      foreach($_SESSION['remote'] as $v) {
 +                              if($v['uid'] == $profile_uid) {
 +                                      $contact_id = $v['cid'];
 +                                      break;
 +                              }
 +                      }
 +              }                               
 +              if($contact_id) {
 +                      $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
 +                              intval($contact_id)
 +                      );
 +              }
        }
  
        if(count($r)) {
  
        if($preview) {
                require_once('include/conversation.php');
-               $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false);
+               $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false, true);
                logger('preview: ' . $o);
                echo json_encode(array('preview' => $o));
                killme();