Fix formatting in mod/network

This commit is contained in:
Hypolite Petovan 2018-01-21 10:26:05 -05:00
parent a5952e5425
commit 83124a8d57

View file

@ -1,4 +1,5 @@
<?php
/**
* @file mod/network.php
*/
@ -8,9 +9,9 @@ use Friendica\Content\ForumManager;
use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -21,7 +22,8 @@ require_once 'include/conversation.php';
require_once 'include/items.php';
require_once 'include/acl_selectors.php';
function network_init(App $a) {
function network_init(App $a)
{
if (!local_user()) {
notice(t('Permission denied.') . EOL);
return;
@ -156,12 +158,12 @@ function network_init(App $a) {
unset($_GET['nets']);
}
if (!x($a->page, 'aside')) {
$a->page['aside'] = '';
}
$a->page['aside'] .= (Feature::isEnabled(local_user(), 'groups') ? Group::sidebarWidget('network/0', 'network', 'standard', $group_id) : '');
$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'] .= Widget::networks('network', (x($_GET, 'nets') ? $_GET['nets'] : ''));
@ -169,8 +171,8 @@ function network_init(App $a) {
$a->page['aside'] .= Widget::fileAs('network', (x($_GET, 'file') ? $_GET['file'] : ''));
}
function saved_searches($search) {
function saved_searches($search)
{
if (!Feature::isEnabled(local_user(), 'savedsearch')) {
return '';
}
@ -229,7 +231,8 @@ function saved_searches($search) {
*
* @return Array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active);
*/
function network_query_get_sel_tab(App $a) {
function network_query_get_sel_tab(App $a)
{
$no_active = '';
$starred_active = '';
$new_active = '';
@ -239,8 +242,7 @@ function network_query_get_sel_tab(App $a) {
$spam_active = '';
$postord_active = '';
if (($a->argc > 1 && $a->argv[1] === 'new')
|| ($a->argc > 2 && $a->argv[2] === 'new')) {
if (($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) {
$new_active = 'active';
}
@ -260,13 +262,7 @@ function network_query_get_sel_tab(App $a) {
$spam_active = 'active';
}
if (($new_active == '')
&& ($starred_active == '')
&& ($bookmarked_active == '')
&& ($conv_active == '')
&& ($spam_active == '')) {
if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') && ($conv_active == '') && ($spam_active == '')) {
$no_active = 'active';
}
@ -284,7 +280,8 @@ function network_query_get_sel_tab(App $a) {
* @brief Return selected network from query
* @return string Name of the selected network
*/
function network_query_get_sel_net() {
function network_query_get_sel_net()
{
$network = false;
if (x($_GET, 'nets')) {
@ -294,7 +291,8 @@ function network_query_get_sel_net() {
return $network;
}
function network_query_get_sel_group(App $a) {
function network_query_get_sel_group(App $a)
{
$group = false;
if ($a->argc >= 2 && is_numeric($a->argv[1])) {
@ -311,11 +309,11 @@ function network_query_get_sel_group(App $a) {
* @param integer $update Used for the automatic reloading
* @return string SQL with the appropriate LIMIT clause
*/
function networkPager($a, $update) {
function networkPager($a, $update)
{
if ($update) {
// only setup pagination on initial page view
return ' LIMIT 100';
}
// check if we serve a mobile device and get the user settings
@ -344,7 +342,8 @@ function networkPager($a, $update) {
*
* @param array $condition The array with the SQL condition
*/
function networkSetSeen($condition) {
function networkSetSeen($condition)
{
if (empty($condition)) {
return;
}
@ -365,7 +364,8 @@ function networkSetSeen($condition) {
* @param integer $update Used for the automatic reloading
* @return string HTML of the conversation
*/
function networkConversation($a, $items, $mode, $update) {
function networkConversation($a, $items, $mode, $update)
{
// Set this so that the conversation function can find out contact info for our wall-wall items
$a->page_contact = $a->contact;
@ -382,7 +382,8 @@ function networkConversation($a, $items, $mode, $update) {
return $o;
}
function network_content(App $a, $update = 0) {
function network_content(App $a, $update = 0)
{
if (!local_user()) {
return Login::form();
}
@ -421,8 +422,8 @@ function network_content(App $a, $update = 0) {
* @param integer $update Used for the automatic reloading
* @return string HTML of the network content in flat view
*/
function networkFlatView(App $a, $update = 0) {
function networkFlatView(App $a, $update = 0)
{
// Rawmode is used for fetching new content at the end of the page
$rawmode = (isset($_GET["mode"]) AND ( $_GET["mode"] == "raw"));
@ -501,8 +502,8 @@ function networkFlatView(App $a, $update = 0) {
* @param integer $update Used for the automatic reloading
* @return string HTML of the network content in flat view
*/
function networkThreadedView(App $a, $update = 0) {
function networkThreadedView(App $a, $update = 0)
{
// Rawmode is used for fetching new content at the end of the page
$rawmode = (isset($_GET["mode"]) AND ( $_GET["mode"] == "raw"));
@ -571,8 +572,7 @@ function networkThreadedView(App $a, $update = 0) {
if ($gid) {
if (($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) {
notice(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) . EOL);
"Warning: This group contains %s members from a network that doesn't allow non public messages.", $t) . EOL);
notice(t("Messages in this group won't be send to these receivers.") . EOL);
}
}
@ -668,7 +668,6 @@ function networkThreadedView(App $a, $update = 0) {
$o = replace_macros(get_markup_template("section_title.tpl"), [
'$title' => t('Group: %s', $group['name'])
]) . $o;
} elseif ($cid) {
$fields = ['id', 'name', 'network', 'writable', 'nurl',
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
@ -692,10 +691,10 @@ function networkThreadedView(App $a, $update = 0) {
'id' => 'network',
]) . $o;
if ($contact['network'] === NETWORK_OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) {
if ($contact['network'] === NETWORK_OSTATUS && $contact['writable'] && !PConfig::get(local_user(), 'system',
'nowarn_insecure')) {
notice(t('Private messages to this person are at risk of public disclosure.') . EOL);
}
} else {
notice(t('Invalid contact.') . EOL);
goaway('network');
@ -709,10 +708,12 @@ function networkThreadedView(App $a, $update = 0) {
}
if ($datequery) {
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created <= '%s' ",
dbesc(datetime_convert(date_default_timezone_get(), '', $datequery))));
}
if ($datequery2) {
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created >= '%s' ",
dbesc(datetime_convert(date_default_timezone_get(), '', $datequery2))));
}
$sql_order = "";
@ -812,9 +813,7 @@ function networkThreadedView(App $a, $update = 0) {
}
// Only show it when unfiltered (no groups, no networks, ...)
if (Config::get('system', 'comment_public') && in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])
&& (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
if (Config::get('system', 'comment_public') && in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
if (DBM::is_result($r)) {
$top_limit = current($r)['order_date'];
$bottom_limit = end($r)['order_date'];
@ -1003,7 +1002,9 @@ function network_tabs(App $a)
// save selected tab, but only if not in file mode
if (!x($_GET, 'file')) {
PConfig::set(local_user(), 'network.view','tab.selected',[$all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active]);
PConfig::set(local_user(), 'network.view', 'tab.selected', [
$all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active
]);
}
$arr = ['tabs' => $tabs];