]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Reset network when showing a contact's posts
[friendica.git] / include / conversation.php
index 9cc6a83427f841fc4becc9a04dd57eba39bcefd7..5296011bb37e080a220f4eb024455b79115ac13c 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 require_once("include/bbcode.php");
+require_once("include/acl_selectors.php");
 
 
 // Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
@@ -369,7 +370,7 @@ if(!function_exists('conversation')) {
 function conversation(&$a, $items, $mode, $update, $preview = false) {
 
 
-       require_once('bbcode.php');
+       require_once('include/bbcode.php');
 
        $ssl_state = ((local_user()) ? true : false);
 
@@ -684,6 +685,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                        continue;
                                }
 
+                               call_hooks('display_item', $arr);
+
                                $item['pagedrop'] = $page_dropping;
 
                                if($item['id'] == $item['parent']) {
@@ -702,7 +705,9 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
 
        $o = replace_macros($page_template, array(
                '$baseurl' => $a->get_baseurl($ssl_state),
+               '$return_path' => $a->query_string,
                '$live_update' => $live_update_div,
+               '$remove' => t('remove'),
                '$mode' => $mode,
                '$user' => $a->user,
                '$threads' => $threads,
@@ -790,7 +795,7 @@ function item_photo_menu($item){
        if(($cid) && (! $item['self'])) {
                $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid;
                $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
-               $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
+               $posts_link = $a->get_baseurl($ssl_state) . '/network/0?nets=all&cid=' . $cid;
 
                $clean_url = normalise_link($item['author-link']);
 
@@ -876,26 +881,21 @@ function format_like($cnt,$arr,$type,$id) {
        if($cnt == 1)
                $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 . '\');"';
+               $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
                switch($type) {
                        case 'like':
-//                             $phrase = sprintf( t('<span  %1$s>%2$d people</span> like this.'), $spanatts, $cnt);
-                               $mood = t('like this');
+                               $phrase = sprintf( t('<span  %1$s>%2$d people</span> like this'), $spanatts, $cnt);
                                break;
                        case 'dislike':
-//                             $phrase = sprintf( t('<span  %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt);
-                               $mood = t('don\'t like this');
+                               $phrase = sprintf( t('<span  %1$s>%2$d people</span> don\'t like this'), $spanatts, $cnt);
                                break;
                }
-               $tpl = get_markup_template("voting_fakelink.tpl");
-               $phrase = replace_macros($tpl, array(
-                       '$vote_id' => $type . 'list-' . $id,
-                       '$count' => $cnt,
-                       '$people' => t('people'),
-                       '$vote_mood' => $mood
+               $phrase .= EOL ;
+               $o .= replace_macros(get_markup_template('voting_fakelink.tpl'), array(
+                       '$phrase' => $phrase,
+                       '$type' => $type,
+                       '$id' => $id
                ));
-               $o .= $phrase;
-//             $o .= EOL ;
 
                $total = count($arr);
                if($total >= MAX_LIKERS)
@@ -910,7 +910,7 @@ function format_like($cnt,$arr,$type,$id) {
                        $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
                }
                $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
-               $o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
+               $o .= "\t" . '<div class="wall-item-' . $type . '-expanded" id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
        }
        return $o;
 }}
@@ -920,7 +920,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
 
        $o = '';
 
-       $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
+       $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
 
 /*     $plaintext = false;
        if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) )
@@ -964,8 +964,6 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
        ));
 
 
-       $tpl = get_markup_template("jot.tpl");
-
        $jotplugins = '';
        $jotnets = '';
 
@@ -996,10 +994,31 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
        if($notes_cid)
                $jotnets .= '<input type="hidden" name="contact_allow[]" value="' . $notes_cid .'" />';
 
+
+       // Private/public post links for the non-JS ACL form
+       $private_post = 1;
+       if($_REQUEST['public'])
+               $private_post = 0;
+
+       $query_str = $a->query_string;
+       if(strpos($query_str, 'public=1') !== false)
+               $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str);
+
+       // I think $a->query_string may never have ? in it, but I could be wrong
+       // It looks like it's from the index.php?q=[etc] rewrite that the web
+       // server does, which converts any ? to &, e.g. suggest&ignore=61 for suggest?ignore=61
+       if(strpos($query_str, '?') === false)
+               $public_post_link = '?public=1';
+       else
+               $public_post_link = '&public=1';
+
+
+
 //     $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
+       $tpl = get_markup_template("jot.tpl");
 
        $o .= replace_macros($tpl,array(
-               '$return_path' => $a->query_string,
+               '$return_path' => $query_str,
                '$action' =>  $a->get_baseurl(true) . '/item',
                '$share' => (x($x,'button') ? $x['button'] : t('Share')),
                '$upload' => t('Upload photo'),
@@ -1035,14 +1054,22 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
                '$jotnets' => $jotnets,
                '$emtitle' => t('Example: bob@example.com, mary@example.com'),
                '$lockstate' => $x['lockstate'],
-               '$acl' => $x['acl'],
                '$bang' => $x['bang'],
                '$profile_uid' => $x['profile_uid'],
                '$preview' => ((feature_enabled($x['profile_uid'],'preview')) ? t('Preview') : ''),
                '$jotplugins' => $jotplugins,
                '$sourceapp' => t($a->sourcename),
                '$cancel' => t('Cancel'),
-               '$rand_num' => random_digits(12)
+               '$rand_num' => random_digits(12),
+
+               // ACL permissions box
+               '$acl' => $x['acl'],
+               '$acl_data' => $x['acl_data'],
+               '$group_perms' => t('Post to Groups'),
+               '$contact_perms' => t('Post to Contacts'),
+               '$private' => t('Private post'),
+               '$is_private' => $private_post,
+               '$public_link' => $public_post_link,
        ));