X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnetwork.php;h=97bc0713d18f569b9d078a5c4b018244a12a439e;hb=f20464112f274d720649c2f92480cc235df4db19;hp=aa42e2f529b97aee64d02eeb0525b2d27ae940c8;hpb=030f6f306cba0f025d124fc7a2912a2bafb291be;p=friendica.git diff --git a/mod/network.php b/mod/network.php index aa42e2f529..97bc0713d1 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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 .= ''; + $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 .= ''; $_SESSION['return_url'] = $a->cmd; @@ -59,10 +65,14 @@ function network_content(&$a, $update = 0) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$geotag' => $geotag, - '$nickname' => $a->user['nickname'] + '$nickname' => $a->user['nickname'], + '$linkurl' => t('Please enter a link URL:'), + '$utubeurl' => t('Please enter a YouTube link:'), + '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), + '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$whereareu' => t('Where are you right now?') )); - require_once('include/acl_selectors.php'); $tpl = load_view_file("view/jot.tpl"); @@ -73,11 +83,34 @@ 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, + '$action' => 'item', + '$share' => t('Share'), + '$upload' => t('Upload photo'), + '$weblink' => t('Insert web link'), + '$youtube' => t('Insert YouTube video'), + '$video' => t('Insert Vorbis [.ogg] video'), + '$audio' => t('Insert Vorbis [.ogg] audio'), + '$setloc' => t('Set your location'), + '$noloc' => t('Clear browser location'), + '$wait' => t('Please wait'), + '$permset' => t('Permission settings'), + '$content' => '', + '$post_id' => '', '$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 +123,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 .= '
' . "\r\n"; - $o .= "\r\n"; - } + $o .= "\r\n"; } @@ -118,6 +151,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 @@ -133,7 +168,7 @@ function network_content(&$a, $update = 0) { } $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( $contact_str )) "; - $o = '

' . t('Group: ') . $r[0]['name'] . '

' . $o; + $o = '

' . t('Group: ') . $r[0]['name'] . '

' . $o; } if((! $group) && (! $update)) @@ -179,15 +214,17 @@ function network_content(&$a, $update = 0) { AND `item`.`parent` = `parentitem`.`id` $sql_extra ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC LIMIT %d ,%d ", - intval($_SESSION['uid']), + intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']) ); } + $author_contacts = extract_item_authors($r,local_user()); $cmnt_tpl = load_view_file('view/comment_item.tpl'); $like_tpl = load_view_file('view/like.tpl'); + $noshare_tpl = load_view_file('view/like_noshare.tpl'); $tpl = load_view_file('view/wall_item.tpl'); $wallwall = load_view_file('view/wallwall_item.tpl'); @@ -213,9 +250,21 @@ function network_content(&$a, $update = 0) { $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); $profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); + $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; + + if(strlen($item['author-link'])) { + if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { + $profile_link = $redirect_url; + $sparkle = ' sparkle'; + } + elseif(isset($author_contacts[$item['author-link']])) { + $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']]; + $sparkle = ' sparkle'; + } + } - $location = (($item['location']) ? '' . $item['location'] . '' : ''); - $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); + $location = (($item['location']) ? '' . $item['location'] . '' : ''); + $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); if($coord) { if($location) $location .= '
(' . $coord . ')'; @@ -228,13 +277,14 @@ function network_content(&$a, $update = 0) { $o .= replace_macros($tpl,array( '$id' => $item['item_id'], + '$linktitle' => t('View $name\'s profile'), '$profile_url' => $profile_link, '$name' => $profile_name, '$sparkle' => $sparkle, '$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' => '', @@ -264,14 +314,14 @@ function network_content(&$a, $update = 0) { $comment = ''; $template = $tpl; $commentww = ''; + $sparkle = ''; $owner_url = $owner_photo = $owner_name = ''; - $profile_url = $item['url']; + if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) + continue; $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) - continue; $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) @@ -308,7 +358,6 @@ function network_content(&$a, $update = 0) { $owner_url = $redirect_url; $osparkle = ' sparkle'; } - } } @@ -319,12 +368,19 @@ function network_content(&$a, $update = 0) { $likebuttons = ''; if($item['id'] == $item['parent']) { - $likebuttons = replace_macros($like_tpl,array('$id' => $item['id'])); + $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array( + '$id' => $item['id'], + '$likethis' => t("I like this \x28toggle\x29"), + '$nolike' => t("I don't like this \x28toggle\x29"), + '$share' => t('Share'), + '$wait' => t('Please wait') + )); } 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'], @@ -336,14 +392,10 @@ function network_content(&$a, $update = 0) { )); } - $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'])); - - - - if(($item['network'] === 'dfrn') && (! $item['self'] )) { - $profile_url = $redirect_url; - $sparkle = ' sparkle'; - } + $edpost = ''; + if(($item['id'] == $item['parent']) && (intval($item['wall']) == 1)) + $edpost = ''; + $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete'))); $photo = $item['photo']; $thumb = $item['thumb']; @@ -355,28 +407,25 @@ function network_content(&$a, $update = 0) { $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb); - - $profile_link = $profile_url; - - // Can we use our special contact URL for this author? - if(strlen($item['author-link'])) { - if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) { + $profile_link = $item['author-link']; + if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { $profile_link = $redirect_url; $sparkle = ' sparkle'; } - else { - $profile_link = $item['author-link']; - $sparkle = ''; + elseif(isset($author_contacts[$item['author-link']])) { + $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']]; + $sparkle = ' sparkle'; } } - + else + $profile_link = $item['url']; $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']) : ''); - $location = (($item['location']) ? '' . $item['location'] . '' : ''); - $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); + $location = (($item['location']) ? '' . $item['location'] . '' : ''); + $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); if($coord) { if($location) $location .= '
(' . $coord . ')'; @@ -394,7 +443,11 @@ function network_content(&$a, $update = 0) { $tmp_item = replace_macros($template,array( '$id' => $item['item_id'], - '$title' => t('View $name\'s profile'), + '$linktitle' => t('View $name\'s profile'), + '$olinktitle' => t('View $owner_name\'s profile'), + '$to' => t('to'), + '$wall' => t('Wall-to-Wall'), + '$vwall' => t('via Wall-To-Wall:'), '$profile_url' => $profile_link, '$name' => $profile_name, '$thumb' => $profile_avatar, @@ -409,6 +462,8 @@ function network_content(&$a, $update = 0) { '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, '$owner_name' => $owner_name, + '$plink' => get_plink($item), + '$edpost' => $edpost, '$drop' => $drop, '$vote' => $likebuttons, '$like' => $like, @@ -424,8 +479,10 @@ function network_content(&$a, $update = 0) { } } - if(! $update) + if(! $update) { $o .= paginate($a); + $o .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; + } return $o; } \ No newline at end of file