]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge branch 'master' of github.com:annando/friendica
[friendica.git] / include / conversation.php
old mode 100755 (executable)
new mode 100644 (file)
index 6283cfe..dc574dd
@@ -167,12 +167,14 @@ function localize_item(&$item){
                }
        }
        $matches = null;
-       if(preg_match_all('/@[url=(.*?)]/is',$item['body'],$matches,PREG_SET_ORDER)) {
+       if(preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
                foreach($matches as $mtch) {
-                       $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
+                       if(! strpos($mtch[1],'zrl='))
+                               $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
                }
        }
 
+
 }
 
 /**
@@ -249,7 +251,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
        $threads = array();
        $threadsid = -1;
        
-       if(count($items)) {
+       if($items && count($items)) {
 
                if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
 
@@ -277,6 +279,9 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                else
                                        $nickname = $a->user['nickname'];
                                
+                               // prevent private email from leaking.
+                               if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
+                                               continue;
                        
                                $profile_name   = ((strlen($item['author-name']))   ? $item['author-name']   : $item['name']);
                                if($item['author-link'] && (! $item['author-name']))
@@ -341,7 +346,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                        'body' => template_escape($body),
                                        'text' => strip_tags(template_escape($body)),
                                        'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
-                                       'lock' => $lock,
                                        'location' => template_escape($location),
                                        'indent' => '',
                                        'owner_name' => template_escape($owner_name),
@@ -399,6 +403,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                        }
 
                        $comments_collapsed = false;
+                       $comments_seen = 0;
                        $comment_lastcollapsed = false;
                        $comment_firstcollapsed = false;
                        $blowhard = 0;
@@ -446,8 +451,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                else {
 
                                        // prevent private email reply to public conversation from leaking.
-                                       if($item['private'] && ! $threads[$threadsid]['private'])
-                                               continue;
+                                       if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
+                                                       continue;
 
                                        $comments_seen ++;
                                        $comment_lastcollapsed  = false;
@@ -531,9 +536,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                                if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
                                        }
 
+                                       $qc = $qcomment =  null;
 
-                                       $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
-                                       $qcomment = (($qc) ? explode("\n",$qc) : null);
+                                       if(in_array('qcomment',$a->plugins)) {
+                                               $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
+                                               $qcomment = (($qc) ? explode("\n",$qc) : null);
+                                       }
 
                                        if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
                                                $comment = replace_macros($cmnt_tpl,array(
@@ -549,16 +557,24 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                                        '$myphoto' => $a->contact['thumb'],
                                                        '$comment' => t('Comment'),
                                                        '$submit' => t('Submit'),
+                                                       '$edbold' => t('Bold'),
+                                                       '$editalic' => t('Italic'),
+                                                       '$eduline' => t('Underline'),
+                                                       '$edquote' => t('Quote'),
+                                                       '$edcode' => t('Code'),
+                                                       '$edimg' => t('Image'),
+                                                       '$edurl' => t('Link'),
+                                                       '$edvideo' => t('Video'),
                                                        '$preview' => t('Preview'),
                                                        '$ww' => (($mode === 'network') ? $commentww : '')
                                                ));
                                        }
                                }
 
-                               $edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
-                                               ? array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"))
-                                               : False);
-
+                               if(local_user() && link_compare($a->contact['url'],$item['author-link']))
+                                       $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
+                               else
+                                       $edpost = false;
 
                                $drop = '';
                                $dropping = false;
@@ -591,7 +607,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                                        'classtagger' => "",
                                                );
                                        }
-                                       $filer = t("file as");
+                                       $filer = t("save to folder");
                                }
 
 
@@ -622,10 +638,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                else
                                        $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
 
-
-
-
-
                                $like    = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
                                $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
 
@@ -709,7 +721,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
        }
 
        $page_template = get_markup_template("conversation.tpl");
-       $o .= replace_macros($page_template, array(
+       $o = replace_macros($page_template, array(
                '$baseurl' => $a->get_baseurl($ssl_state),
                '$mode' => $mode,
                '$user' => $a->user,
@@ -806,11 +818,11 @@ function item_photo_menu($item){
        }
 
        $menu = Array(
-               t("View status") => $status_link,
-               t("View profile") => $profile_link,
-               t("View photos") => $photos_link,
-               t("View recent") => $posts_link, 
-               t("Edit contact") => $contact_url,
+               t("View Status") => $status_link,
+               t("View Profile") => $profile_link,
+               t("View Photos") => $photos_link,
+               t("Network Posts") => $posts_link, 
+               t("Edit Contact") => $contact_url,
                t("Send PM") => $pm_url,
        );
        
@@ -911,7 +923,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
                '$vidurl' => t("Please enter a video link/URL:"),
                '$audurl' => t("Please enter an audio link/URL:"),
                '$term' => t('Tag term:'),
-               '$fileas' => t('File as:'),
+               '$fileas' => t('Save to Folder:'),
                '$whereareu' => t('Where are you right now?')
        ));
 
@@ -951,7 +963,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
        $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));        
 
        $o .= replace_macros($tpl,array(
-               '$return_path' => $a->cmd,
+               '$return_path' => $a->query_string,
                '$action' =>  $a->get_baseurl(true) . '/item',
                '$share' => (x($x,'button') ? $x['button'] : t('Share')),
                '$upload' => t('Upload photo'),
@@ -970,6 +982,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
                '$shortnoloc' => t('clear location'),
                '$title' => "",
                '$placeholdertitle' => t('Set title'),
+               '$category' => "",
+               '$placeholdercategory' => t('Categories (comma-separated list)'),
                '$wait' => t('Please wait'),
                '$permset' => t('Permission settings'),
                '$shortpermset' => t('permissions'),
@@ -1072,7 +1086,6 @@ function find_thread_parent_index($arr,$x) {
 }
 
 function render_location_google($item) {
-       $location = '';
        $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
        $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
        if($coord) {
@@ -1083,4 +1096,3 @@ function render_location_google($item) {
        }
        return $location;
 }
-