]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
Merge commit 'mike/master'
[friendica.git] / mod / network.php
index aa42e2f529b97aee64d02eeb0525b2d27ae940c8..79a2f2b3896c6490acc789abc7b705b197ff3e7d 100644 (file)
@@ -2,6 +2,12 @@
 
 
 function network_init(&$a) {
+       if(! local_user()) {
+               notice( t('Permission denied.') . EOL);
+               return;
+       }
+  
+  
        require_once('include/group.php');
        if(! x($a->page,'aside'))
                $a->page['aside'] = '';
@@ -22,7 +28,7 @@ function network_init(&$a) {
 function network_content(&$a, $update = 0) {
 
        if(! local_user())
-               return '';
+       return login(false);
 
        $o = '';
 
@@ -32,23 +38,23 @@ function network_content(&$a, $update = 0) {
 
        $group = 0;
 
-       if(! $update) {
-               $o .= '<script> $(document).ready(function() { $(\'#nav-network-link\').addClass(\'nav-selected\'); });</script>';
+       $nouveau = false;
+       require_once('include/acl_selectors.php');
 
-               $nouveau = false;
+       if(($a->argc > 2) && $a->argv[2] === 'new')
+               $nouveau = true;
 
-               if(($a->argc > 2) && $a->argv[2] === 'new')
+       if($a->argc > 1) {
+               if($a->argv[1] === 'new')
                        $nouveau = true;
-
-                       // pull out the group here because the updater might have different args
-               if($a->argc > 1) {
-                       if($a->argv[1] === 'new')
-                               $nouveau = true;
-                       else {
-                               $group = intval($a->argv[1]);
-                               $group_acl = array('allow_gid' => '<' . $group . '>');
-                       }
+               else {
+                       $group = intval($a->argv[1]);
+                       $group_acl = array('allow_gid' => '<' . $group . '>');
                }
+       }
+
+       if(! $update) {
+               $o .= '<script> $(document).ready(function() { $(\'#nav-network-link\').addClass(\'nav-selected\'); });</script>';
 
                $_SESSION['return_url'] = $a->cmd;
 
@@ -62,7 +68,6 @@ function network_content(&$a, $update = 0) {
                        '$nickname' => $a->user['nickname']
                ));
 
-               require_once('include/acl_selectors.php');
 
                $tpl = load_view_file("view/jot.tpl");
                
@@ -73,11 +78,21 @@ function network_content(&$a, $update = 0) {
 
                $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
 
+               $jotplugins = '';
+               $jotnets = '';
+               call_hooks('jot_tool', $jotplugins);
+               call_hooks('jot_networks', $jotnets);
+
+               $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));        
+
                $o .= replace_macros($tpl,array(
                        '$return_path' => $a->cmd,
                        '$baseurl' => $a->get_baseurl(),
                        '$defloc' => $a->user['default-location'],
                        '$visitor' => 'block',
+                       '$emailcc' => t('CC: email addresses'),
+                       '$jotnets' => $jotnets,
+                       '$emtitle' => t('Example: bob@example.com, mary@example.com'),
                        '$lockstate' => $lockstate,
                        '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb),
                        '$bang' => (($group) ? '!' : ''),
@@ -90,10 +105,10 @@ function network_content(&$a, $update = 0) {
                // filtering by group and also you aren't writing a comment (the last
                // criteria is discovered in javascript).
 
-               if($a->pager['start'] == 0 && $a->argc == 1) {
                        $o .= '<div id="live-network"></div>' . "\r\n";
-                       $o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; </script>\r\n";
-               }
+                       $o .= "<script> var profile_uid = " . $_SESSION['uid'] 
+                               . "; var netargs = '" . substr($a->cmd,8) 
+                               . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
 
        }
 
@@ -118,6 +133,8 @@ function network_content(&$a, $update = 0) {
                        intval($_SESSION['uid'])
                );
                if(! count($r)) {
+                       if($update)
+                               killme();
                        notice( t('No such group') . EOL );
                        goaway($a->get_baseurl() . '/network');
                        return; // NOTREACHED
@@ -234,7 +251,7 @@ function network_content(&$a, $update = 0) {
                                        '$lock' => $lock,
                                        '$thumb' => $profile_avatar,
                                        '$title' => $item['title'],
-                                       '$body' => bbcode($item['body']),
+                                       '$body' => smilies(bbcode($item['body'])),
                                        '$ago' => relative_date($item['created']),
                                        '$location' => $location,
                                        '$indent' => '',
@@ -324,7 +341,8 @@ function network_content(&$a, $update = 0) {
 
                        if($item['last-child']) {
                                $comment = replace_macros($cmnt_tpl,array(
-                                       '$return_path' => $_SESSION['return_url'],
+                                       '$return_path' => '', 
+                                       '$jsreload' => '', // $_SESSION['return_url'],
                                        '$type' => 'net-comment',
                                        '$id' => $item['item_id'],
                                        '$parent' => $item['parent'],
@@ -409,6 +427,7 @@ function network_content(&$a, $update = 0) {
                                '$owner_url' => $owner_url,
                                '$owner_photo' => $owner_photo,
                                '$owner_name' => $owner_name,
+                               '$plink' => get_plink($item),
                                '$drop' => $drop,
                                '$vote' => $likebuttons,
                                '$like' => $like,
@@ -424,8 +443,10 @@ function network_content(&$a, $update = 0) {
                }
        }
 
-       if(! $update)
+       if(! $update) {
                $o .= paginate($a);
+               $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+       }
 
        return $o;
 }
\ No newline at end of file