X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnetwork.php;h=552625c2afc6dc7e6e4c2b665b49d04f99f1351d;hb=63622966666729ba82fef8f12484e022500ff867;hp=a78500174ea1d31f07981f81887e0fa2d84d0bb2;hpb=c12075a00518ae224c826d3e9373001b243f1839;p=friendica.git diff --git a/mod/network.php b/mod/network.php index a78500174e..552625c2af 100644 --- a/mod/network.php +++ b/mod/network.php @@ -1,15 +1,20 @@ argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0); + + $cid = 0; if (x($_GET, 'cid') && intval($_GET['cid']) != 0) { $cid = $_GET['cid']; + $_GET['nets'] = 'all'; + $group_id = 0; } + PConfig::set(local_user(), 'network.view', 'group.selected', $group_id); + if ($a->argc > 1) { for ($x = 1; $x < $a->argc; $x ++) { if (is_a_date_arg($a->argv[$x])) { @@ -139,16 +152,13 @@ function network_init(App $a) { unset($_GET['nets']); } - $group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0); - - PConfig::set(local_user(), 'network.view', 'group.selected', $group_id); if (!x($a->page, 'aside')) { $a->page['aside'] = ''; } - $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : ''); - $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? ForumManager::widget(local_user(),$cid) : ''); + $a->page['aside'] .= (Feature::isEnabled(local_user(),'groups') ? Group::sidebarWidget('network/0','network','standard',$group_id) : ''); + $a->page['aside'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : ''); $a->page['aside'] .= posted_date_widget('network',local_user(),false); $a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= saved_searches($search); @@ -157,7 +167,7 @@ function network_init(App $a) { function saved_searches($search) { - if (!feature_enabled(local_user(),'savedsearch')) { + if (!Feature::isEnabled(local_user(),'savedsearch')) { return ''; } @@ -495,9 +505,9 @@ function networkThreadedView(App $a, $update = 0) { $rawmode = (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")); if (isset($_GET["last_received"]) && isset($_GET["last_commented"]) && isset($_GET["last_created"]) && isset($_GET["last_id"])) { - $last_received = dbm::date($_GET["last_received"]); - $last_commented = dbm::date($_GET["last_commented"]); - $last_created = dbm::date($_GET["last_created"]); + $last_received = DBM::date($_GET["last_received"]); + $last_commented = DBM::date($_GET["last_commented"]); + $last_created = DBM::date($_GET["last_created"]); $last_id = intval($_GET["last_id"]); } else { $last_received = ''; @@ -557,7 +567,7 @@ function networkThreadedView(App $a, $update = 0) { $o .= $tabs; if ($group) { - if (($t = group_public_members($group)) && !PConfig::get(local_user(),'system','nowarn_insecure')) { + if (($t = Contact::getOStatusCountByGroupId($group)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) { notice(sprintf(tt("Warning: This group contains %s member from a network that doesn't allow non public messages.", "Warning: This group contains %s members from a network that doesn't allow non public messages.", $t), $t).EOL); @@ -573,11 +583,11 @@ function networkThreadedView(App $a, $update = 0) { // If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor $condition = array("`id` = ? AND (`forum` OR `prv`)", $cid); $contact = dba::select('contact', array('addr', 'nick'), $condition, array('limit' => 1)); - if (dbm::is_result($contact)) { + if (DBM::is_result($contact)) { if ($contact["addr"] != '') { - $content = "@".$contact["addr"]; + $content = "!".$contact["addr"]; } else { - $content = "@".$contact["nick"]."+".$cid; + $content = "!".$contact["nick"]."+".$cid; } } } @@ -626,7 +636,7 @@ function networkThreadedView(App $a, $update = 0) { if ($group) { $r = dba::select('group', array('name'), array('id' => $group, 'uid' => $_SESSION['uid']), array('limit' => 1)); - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { if ($update) killme(); notice(t('No such group') . EOL); @@ -634,14 +644,14 @@ function networkThreadedView(App $a, $update = 0) { // NOTREACHED } - $contacts = expand_groups(array($group)); + $contacts = Group::expand(array($group)); if ((is_array($contacts)) && count($contacts)) { $contact_str_self = ""; $contact_str = implode(',',$contacts); $self = dba::select('contact', array('id'), array('uid' => $_SESSION['uid'], 'self' => true), array('limit' => 1)); - if (dbm::is_result($self)) { + if (DBM::is_result($self)) { $contact_str_self = $self["id"]; } @@ -662,7 +672,7 @@ function networkThreadedView(App $a, $update = 0) { 'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'); $condition = array("`id` = ? AND (NOT `blocked` OR `pending`)", $cid); $r = dba::select('contact', $fields, $condition, array('limit' => 1)); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid); $entries[0] = array( @@ -673,7 +683,7 @@ function networkThreadedView(App $a, $update = 0) { 'details' => $r['location'], ); - $entries[0]["account_type"] = account_type($r); + $entries[0]["account_type"] = Contact::getAccountType($r); $o = replace_macros(get_markup_template("viewcontact_template.tpl"),array( 'contacts' => $entries, @@ -806,7 +816,7 @@ function networkThreadedView(App $a, $update = 0) { $parents_str = ''; $date_offset = ""; - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { if (!in_array($rr['item_id'],$parents_arr)) { $parents_arr[] = $rr['item_id']; @@ -833,7 +843,7 @@ function networkThreadedView(App $a, $update = 0) { $parents ); - if (dbm::is_result($thread_items)) { + if (DBM::is_result($thread_items)) { $items = array_merge($items, dba::inArray($thread_items)); } } @@ -856,11 +866,12 @@ function networkThreadedView(App $a, $update = 0) { if (!$group && !$cid && !$star) { $condition = array('unseen' => true, 'uid' => local_user()); + networkSetSeen($condition); } elseif ($parents_str) { $condition = array("`uid` = ? AND `unseen` AND `parent` IN (" . dbesc($parents_str) . ")", local_user()); + networkSetSeen($condition); } - networkSetSeen($condition); $mode = 'network'; $o .= networkConversation($a, $items, $mode, $update); @@ -874,17 +885,19 @@ function networkThreadedView(App $a, $update = 0) { * @param App $a The global App * @return string Html of the networktab */ -function network_tabs(App $a) { +function network_tabs(App $a) +{ // item filter tabs /// @TODO fix this logic, reduce duplication /// $a->page['content'] .= '
'; - list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) = network_query_get_sel_tab($a); + // if no tabs are selected, defaults to comments - if ($no_active=='active') $all_active='active'; + if ($no_active == 'active') { + $all_active = 'active'; + } - $cmd = (($datequery) ? '' : $a->cmd); - $len_naked_cmd = strlen(str_replace('/new','',$cmd)); + $cmd = $a->cmd; // tabs $tabs = array( @@ -906,7 +919,7 @@ function network_tabs(App $a) { ), ); - if (feature_enabled(local_user(),'personal_tab')) { + if (Feature::isEnabled(local_user(),'personal_tab')) { $tabs[] = array( 'label' => t('Personal'), 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', @@ -917,7 +930,7 @@ function network_tabs(App $a) { ); } - if (feature_enabled(local_user(),'new_tab')) { + if (Feature::isEnabled(local_user(),'new_tab')) { $tabs[] = array( 'label' => t('New'), 'url' => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), @@ -928,7 +941,7 @@ function network_tabs(App $a) { ); } - if (feature_enabled(local_user(),'link_tab')) { + if (Feature::isEnabled(local_user(),'link_tab')) { $tabs[] = array( 'label' => t('Shared Links'), 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', @@ -939,7 +952,7 @@ function network_tabs(App $a) { ); } - if (feature_enabled(local_user(),'star_posts')) { + if (Feature::isEnabled(local_user(),'star_posts')) { $tabs[] = array( 'label' => t('Starred'), 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',