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