2020-10-13 04:23:17 +00:00
|
|
|
<?php
|
2022-01-02 09:49:50 +00:00
|
|
|
/**
|
|
|
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
|
|
|
*
|
|
|
|
* @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/>.
|
|
|
|
*
|
|
|
|
*/
|
2020-10-13 04:23:17 +00:00
|
|
|
|
|
|
|
namespace Friendica\Module\Update;
|
|
|
|
|
|
|
|
use Friendica\Core\System;
|
|
|
|
use Friendica\DI;
|
2021-01-16 04:16:09 +00:00
|
|
|
use Friendica\Model\Post;
|
2020-10-13 04:23:17 +00:00
|
|
|
use Friendica\Module\Conversation\Network as NetworkModule;
|
|
|
|
|
|
|
|
class Network extends NetworkModule
|
|
|
|
{
|
2021-11-20 14:38:03 +00:00
|
|
|
protected function rawContent(array $request = [])
|
2020-10-13 04:23:17 +00:00
|
|
|
{
|
|
|
|
if (!isset($_GET['p']) || !isset($_GET['item'])) {
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2021-11-14 22:19:25 +00:00
|
|
|
$this->parseRequest($_GET);
|
2020-10-13 04:23:17 +00:00
|
|
|
|
|
|
|
$profile_uid = intval($_GET['p']);
|
|
|
|
|
|
|
|
$o = '';
|
|
|
|
|
|
|
|
if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($_GET['force'] == 1)) {
|
|
|
|
if (!empty($_GET['item'])) {
|
2021-01-16 04:16:09 +00:00
|
|
|
$item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
|
2020-10-13 04:23:17 +00:00
|
|
|
$parent = $item['parent'] ?? 0;
|
|
|
|
} else {
|
|
|
|
$parent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$conditionFields = [];
|
|
|
|
if (!empty($parent)) {
|
|
|
|
// Load only a single thread
|
|
|
|
$conditionFields['parent'] = $parent;
|
|
|
|
} elseif (self::$order === 'received') {
|
|
|
|
// Only load new toplevel posts
|
|
|
|
$conditionFields['unseen'] = true;
|
|
|
|
$conditionFields['gravity'] = GRAVITY_PARENT;
|
|
|
|
} else {
|
|
|
|
// Load all unseen items
|
|
|
|
$conditionFields['unseen'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = ['limit' => 100];
|
|
|
|
$table = 'network-item-view';
|
|
|
|
|
|
|
|
$items = self::getItems($table, $params, $conditionFields);
|
|
|
|
|
|
|
|
if (self::$order === 'received') {
|
|
|
|
$ordering = '`received`';
|
2022-04-20 21:03:33 +00:00
|
|
|
} elseif (self::$order === 'created') {
|
|
|
|
$ordering = '`created`';
|
2020-10-13 04:23:17 +00:00
|
|
|
} else {
|
|
|
|
$ordering = '`commented`';
|
|
|
|
}
|
|
|
|
|
2021-09-23 21:18:36 +00:00
|
|
|
$o = DI::conversation()->create($items, 'network', $profile_uid, false, $ordering, local_user());
|
2020-10-13 04:23:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
System::htmlUpdateExit($o);
|
|
|
|
}
|
|
|
|
}
|