Merge pull request #8293 from MrPetovan/task/5562-community-pagination
Improve community pagination
This commit is contained in:
commit
da124af6ed
36 changed files with 710 additions and 499 deletions
|
@ -107,7 +107,7 @@ function common_content(App $a)
|
|||
return $o;
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString());
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
||||
if ($cid) {
|
||||
$common_friends = Model\GContact::commonFriends($uid, $cid, $pager->getStart(), $pager->getItemsPerPage());
|
||||
|
|
|
@ -1,259 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Widget\TrendingTags;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
|
||||
function community_content(App $a, $update = 0)
|
||||
{
|
||||
$o = '';
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
notice(DI::l10n()->t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$page_style = DI::config()->get('system', 'community_page_style');
|
||||
|
||||
if ($page_style == CP_NO_INTERNAL_COMMUNITY) {
|
||||
notice(DI::l10n()->t('Access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$accounttype = null;
|
||||
|
||||
if ($a->argc > 2) {
|
||||
switch ($a->argv[2]) {
|
||||
case 'person':
|
||||
$accounttype = User::ACCOUNT_TYPE_PERSON;
|
||||
break;
|
||||
case 'organisation':
|
||||
$accounttype = User::ACCOUNT_TYPE_ORGANISATION;
|
||||
break;
|
||||
case 'news':
|
||||
$accounttype = User::ACCOUNT_TYPE_NEWS;
|
||||
break;
|
||||
case 'community':
|
||||
$accounttype = User::ACCOUNT_TYPE_COMMUNITY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($a->argc > 1) {
|
||||
$content = $a->argv[1];
|
||||
} else {
|
||||
if (!empty(DI::config()->get('system', 'singleuser'))) {
|
||||
// On single user systems only the global page does make sense
|
||||
$content = 'global';
|
||||
} else {
|
||||
// When only the global community is allowed, we use this as default
|
||||
$content = $page_style == CP_GLOBAL_COMMUNITY ? 'global' : 'local';
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_array($content, ['local', 'global'])) {
|
||||
notice(DI::l10n()->t('Community option not available.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we are allowed to display the content to visitors
|
||||
if (!local_user()) {
|
||||
$available = $page_style == CP_USERS_AND_GLOBAL;
|
||||
|
||||
if (!$available) {
|
||||
$available = ($page_style == CP_USERS_ON_SERVER) && ($content == 'local');
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
$available = ($page_style == CP_GLOBAL_COMMUNITY) && ($content == 'global');
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
notice(DI::l10n()->t('Not available.') . EOL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$update) {
|
||||
$tabs = [];
|
||||
|
||||
if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Local Community'),
|
||||
'url' => 'community/local',
|
||||
'sel' => $content == 'local' ? 'active' : '',
|
||||
'title' => DI::l10n()->t('Posts from local users on this server'),
|
||||
'id' => 'community-local-tab',
|
||||
'accesskey' => 'l'
|
||||
];
|
||||
}
|
||||
|
||||
if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Global Community'),
|
||||
'url' => 'community/global',
|
||||
'sel' => $content == 'global' ? 'active' : '',
|
||||
'title' => DI::l10n()->t('Posts from users of the whole federated network'),
|
||||
'id' => 'community-global-tab',
|
||||
'accesskey' => 'g'
|
||||
];
|
||||
}
|
||||
|
||||
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
||||
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
|
||||
|
||||
Nav::setSelected('community');
|
||||
|
||||
// We need the editor here to be able to reshare an item.
|
||||
if (local_user()) {
|
||||
$x = [
|
||||
'is_owner' => true,
|
||||
'allow_location' => $a->user['allow_location'],
|
||||
'default_location' => $a->user['default-location'],
|
||||
'nickname' => $a->user['nickname'],
|
||||
'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
|
||||
'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true),
|
||||
'bang' => '',
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user(),
|
||||
];
|
||||
$o .= status_editor($a, $x, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
// check if we serve a mobile device and get the user settings accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
||||
} else {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 40);
|
||||
}
|
||||
|
||||
// now that we have the user settings, see if the theme forces
|
||||
// a maximum item number which is lower then the user choice
|
||||
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) {
|
||||
$itemspage_network = $a->force_max_items;
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString(), $itemspage_network);
|
||||
|
||||
$r = community_getitems($pager->getStart(), $pager->getItemsPerPage(), $content, $accounttype);
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
info(DI::l10n()->t('No results.') . EOL);
|
||||
return $o;
|
||||
}
|
||||
|
||||
$maxpostperauthor = (int) DI::config()->get('system', 'max_author_posts_community_page');
|
||||
|
||||
if (($maxpostperauthor != 0) && ($content == 'local')) {
|
||||
$count = 1;
|
||||
$previousauthor = "";
|
||||
$numposts = 0;
|
||||
$s = [];
|
||||
|
||||
do {
|
||||
foreach ($r as $item) {
|
||||
if ($previousauthor == $item["author-link"]) {
|
||||
++$numposts;
|
||||
} else {
|
||||
$numposts = 0;
|
||||
}
|
||||
$previousauthor = $item["author-link"];
|
||||
|
||||
if (($numposts < $maxpostperauthor) && (count($s) < $pager->getItemsPerPage())) {
|
||||
$s[] = $item;
|
||||
}
|
||||
}
|
||||
if (count($s) < $pager->getItemsPerPage()) {
|
||||
$r = community_getitems($pager->getStart() + ($count * $pager->getItemsPerPage()), $pager->getItemsPerPage(), $content, $accounttype);
|
||||
}
|
||||
} while ((count($s) < $pager->getItemsPerPage()) && ( ++$count < 50) && (count($r) > 0));
|
||||
} else {
|
||||
$s = $r;
|
||||
}
|
||||
|
||||
$o .= conversation($a, $s, $pager, 'community', $update, false, 'commented', local_user());
|
||||
|
||||
if (!$update) {
|
||||
$o .= $pager->renderMinimal(count($r));
|
||||
}
|
||||
|
||||
if (empty(DI::page()['aside'])) {
|
||||
DI::page()['aside'] = '';
|
||||
}
|
||||
|
||||
if (Feature::isEnabled(local_user(), 'trending_tags')) {
|
||||
DI::page()['aside'] .= TrendingTags::getHTML($content);
|
||||
}
|
||||
|
||||
$t = Renderer::getMarkupTemplate("community.tpl");
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$content' => $o,
|
||||
'$header' => '',
|
||||
'$show_global_community_hint' => ($content == 'global') && DI::config()->get('system', 'show_global_community_hint'),
|
||||
'$global_community_hint' => DI::l10n()->t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
|
||||
]);
|
||||
}
|
||||
|
||||
function community_getitems($start, $itemspage, $content, $accounttype)
|
||||
{
|
||||
if ($content == 'local') {
|
||||
if (!is_null($accounttype)) {
|
||||
$sql_accounttype = " AND `user`.`account-type` = ?";
|
||||
$values = [$accounttype, $start, $itemspage];
|
||||
} else {
|
||||
$sql_accounttype = "";
|
||||
$values = [$start, $itemspage];
|
||||
}
|
||||
|
||||
/// @todo Use "unsearchable" here as well (instead of "hidewall")
|
||||
$r = DBA::p("SELECT `item`.`uri`, `author`.`url` AS `author-link` FROM `thread`
|
||||
STRAIGHT_JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
||||
STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
|
||||
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
|
||||
AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin` $sql_accounttype
|
||||
ORDER BY `thread`.`commented` DESC LIMIT ?, ?", $values);
|
||||
return DBA::toArray($r);
|
||||
} elseif ($content == 'global') {
|
||||
if (!is_null($accounttype)) {
|
||||
$condition = ["`uid` = ? AND NOT `author`.`unsearchable` AND NOT `owner`.`unsearchable` AND `owner`.`contact-type` = ?", 0, $accounttype];
|
||||
} else {
|
||||
$condition = ["`uid` = ? AND NOT `author`.`unsearchable` AND NOT `owner`.`unsearchable`", 0];
|
||||
}
|
||||
|
||||
$r = Item::selectThreadForUser(0, ['uri'], $condition, ['order' => ['commented' => true], 'limit' => [$start, $itemspage]]);
|
||||
return DBA::toArray($r);
|
||||
}
|
||||
|
||||
// Should never happen
|
||||
return [];
|
||||
}
|
|
@ -331,7 +331,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
$o .= "<script> var netargs = '?item_id=" . $item_id . "'; </script>";
|
||||
}
|
||||
|
||||
$o .= conversation($a, [$item], new Pager(DI::args()->getQueryString()), 'display', $update_uid, false, 'commented', $item_uid);
|
||||
$o .= conversation($a, [$item], 'display', $update_uid, false, 'commented', $item_uid);
|
||||
|
||||
// Preparing the meta header
|
||||
$description = trim(HTML::toPlaintext(BBCode::convert($item["body"], false), 0, true));
|
||||
|
|
|
@ -675,7 +675,7 @@ function item_post(App $a) {
|
|||
$datarray["item_id"] = -1;
|
||||
$datarray["author-network"] = Protocol::DFRN;
|
||||
|
||||
$o = conversation($a, [array_merge($contact_record, $datarray)], new Pager(DI::args()->getQueryString()), 'search', false, true);
|
||||
$o = conversation($a, [array_merge($contact_record, $datarray)], 'search', false, true);
|
||||
|
||||
System::jsonExit(['preview' => $o]);
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ function message_content(App $a)
|
|||
$total = $r[0]['total'];
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString());
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
||||
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
|
||||
|
||||
|
|
|
@ -228,14 +228,12 @@ function networkPager(App $a, Pager $pager, $update)
|
|||
return ' LIMIT 100';
|
||||
}
|
||||
|
||||
// check if we serve a mobile device and get the user settings
|
||||
// accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network');
|
||||
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network');
|
||||
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
// now that we have the user settings, see if the theme forces
|
||||
|
@ -291,7 +289,7 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde
|
|||
$items = [];
|
||||
}
|
||||
|
||||
$o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user());
|
||||
$o = conversation($a, $items, $mode, $update, false, $ordering, local_user());
|
||||
|
||||
if (!$update) {
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
|
||||
|
@ -377,7 +375,7 @@ function networkFlatView(App $a, $update = 0)
|
|||
}
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString());
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
||||
networkPager($a, $pager, $update);
|
||||
|
||||
|
@ -669,7 +667,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$sql_range = '';
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString());
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
||||
$pager_sql = networkPager($a, $pager, $update);
|
||||
|
||||
|
|
|
@ -69,7 +69,15 @@ function notes_content(App $a, $update = false)
|
|||
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
|
||||
'contact-id'=> $a->contact['id']];
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString(), 40);
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
||||
|
||||
$params = ['order' => ['created' => true],
|
||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
|
@ -82,7 +90,7 @@ function notes_content(App $a, $update = false)
|
|||
|
||||
$count = count($notes);
|
||||
|
||||
$o .= conversation($a, $notes, $pager, 'notes', $update);
|
||||
$o .= conversation($a, $notes, 'notes', $update);
|
||||
}
|
||||
|
||||
$o .= $pager->renderMinimal($count);
|
||||
|
|
|
@ -1023,7 +1023,7 @@ function photos_content(App $a)
|
|||
$total = count($r);
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString(), 20);
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 20);
|
||||
|
||||
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
|
||||
$order_field = $_GET['order'] ?? '';
|
||||
|
@ -1299,7 +1299,7 @@ function photos_content(App $a)
|
|||
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
|
||||
$total = DBA::count('item', $condition);
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString());
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
||||
$params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
$result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
|
||||
|
@ -1565,7 +1565,7 @@ function photos_content(App $a)
|
|||
$total = count($r);
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString(), 20);
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 20);
|
||||
|
||||
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
|
||||
ANY_VALUE(`type`) AS `type`, ANY_VALUE(`album`) AS `album`, max(`scale`) AS `scale`,
|
||||
|
|
|
@ -356,11 +356,15 @@ function settings_post(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$itemspage_network = !empty($_POST['itemspage_network']) ? intval($_POST['itemspage_network']) : 40;
|
||||
$itemspage_network = !empty($_POST['itemspage_network']) ?
|
||||
intval($_POST['itemspage_network']) :
|
||||
DI::config()->get('system', 'itemspage_network');
|
||||
if ($itemspage_network > 100) {
|
||||
$itemspage_network = 100;
|
||||
}
|
||||
$itemspage_mobile_network = !empty($_POST['itemspage_mobile_network']) ? intval($_POST['itemspage_mobile_network']) : 20;
|
||||
$itemspage_mobile_network = !empty($_POST['itemspage_mobile_network']) ?
|
||||
intval($_POST['itemspage_mobile_network']) :
|
||||
DI::config()->get('system', 'itemspage_network_mobile');
|
||||
if ($itemspage_mobile_network > 100) {
|
||||
$itemspage_mobile_network = 100;
|
||||
}
|
||||
|
@ -938,9 +942,9 @@ function settings_content(App $a)
|
|||
}
|
||||
|
||||
$itemspage_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_network'));
|
||||
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
|
||||
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : DI::config()->get('system', 'itemspage_network'));
|
||||
$itemspage_mobile_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network'));
|
||||
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
|
||||
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
|
||||
$nosmile = DI::pConfig()->get(local_user(), 'system', 'no_smilies', 0);
|
||||
$first_day_of_week = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* See update_profile.php for documentation
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once 'mod/community.php';
|
||||
|
||||
function update_community_content(App $a) {
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo "<section>";
|
||||
|
||||
if ($_GET["force"] == 1) {
|
||||
$text = community_content($a, true);
|
||||
} else {
|
||||
$text = '';
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . DI::l10n()->t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
}
|
||||
|
||||
echo str_replace("\t", " ", $text);
|
||||
echo "</section>";
|
||||
echo "</body></html>\r\n";
|
||||
exit();
|
||||
}
|
|
@ -22,35 +22,17 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Contact;
|
||||
|
||||
function update_contact_content(App $a)
|
||||
{
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo "<section>";
|
||||
|
||||
if ($_GET["force"] == 1) {
|
||||
$text = Contact::content([], true);
|
||||
} else {
|
||||
$text = '';
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . DI::l10n()->t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
}
|
||||
|
||||
echo str_replace("\t", " ", $text);
|
||||
echo "</section>";
|
||||
echo "</body></html>\r\n";
|
||||
exit();
|
||||
System::htmlUpdateExit($text);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once "mod/display.php";
|
||||
|
@ -29,26 +30,7 @@ function update_display_content(App $a)
|
|||
{
|
||||
$profile_uid = intval($_GET["p"]);
|
||||
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo "<section>";
|
||||
|
||||
$text = display_content($a, true, $profile_uid);
|
||||
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . DI::l10n()->t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
}
|
||||
|
||||
echo str_replace("\t", " ", $text);
|
||||
echo "</section>";
|
||||
echo "</body></html>\r\n";
|
||||
exit();
|
||||
System::htmlUpdateExit($text);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once "mod/network.php";
|
||||
|
@ -34,30 +35,10 @@ function update_network_content(App $a)
|
|||
$profile_uid = intval($_GET['p']);
|
||||
$parent = intval($_GET['item']);
|
||||
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo "<section>";
|
||||
|
||||
if (!DI::pConfig()->get($profile_uid, "system", "no_auto_update") || ($_GET["force"] == 1)) {
|
||||
$text = network_content($a, $profile_uid, $parent);
|
||||
} else {
|
||||
$text = "";
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . DI::l10n()->t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
}
|
||||
|
||||
echo str_replace("\t", " ", $text);
|
||||
echo "</section>";
|
||||
echo "</body></html>\r\n";
|
||||
exit();
|
||||
System::htmlUpdateExit($text);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once("mod/notes.php");
|
||||
|
@ -29,11 +30,6 @@ function update_notes_content(App $a) {
|
|||
|
||||
$profile_uid = intval($_GET["p"]);
|
||||
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
|
||||
echo "<section>";
|
||||
|
||||
/**
|
||||
*
|
||||
* Grab the page inner contents by calling the content function from the profile module directly,
|
||||
|
@ -46,21 +42,5 @@ function update_notes_content(App $a) {
|
|||
|
||||
$text = notes_content($a, $profile_uid);
|
||||
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . DI::l10n()->t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
}
|
||||
|
||||
// reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
|
||||
echo str_replace("\t", " ", $text);
|
||||
echo "</section>";
|
||||
echo "</body></html>\r\n";
|
||||
exit();
|
||||
System::htmlUpdateExit($text);
|
||||
}
|
|
@ -225,7 +225,7 @@ function videos_content(App $a)
|
|||
$total = count($r);
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::args()->getQueryString(), 20);
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 20);
|
||||
|
||||
$r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,
|
||||
ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`filetype`) as `filetype`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue