2011-11-02 03:29:55 +00:00
|
|
|
<?php
|
2017-11-15 14:47:28 +00:00
|
|
|
/**
|
2020-02-09 15:18:46 +00:00
|
|
|
* @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/>.
|
|
|
|
*
|
2017-11-15 14:47:28 +00:00
|
|
|
*/
|
2018-07-20 02:15:21 +00:00
|
|
|
|
2017-04-30 04:07:00 +00:00
|
|
|
use Friendica\App;
|
2018-01-15 14:50:06 +00:00
|
|
|
use Friendica\Content\Widget;
|
2018-10-31 14:35:50 +00:00
|
|
|
use Friendica\Core\Renderer;
|
2018-07-20 12:19:26 +00:00
|
|
|
use Friendica\Database\DBA;
|
2019-12-15 23:28:31 +00:00
|
|
|
use Friendica\DI;
|
2017-12-07 14:04:24 +00:00
|
|
|
use Friendica\Model\Contact;
|
2020-07-31 03:55:01 +00:00
|
|
|
use Friendica\Module\Contact as ModuleContact;
|
2020-07-31 17:58:25 +00:00
|
|
|
use Friendica\Network\HTTPException;
|
2015-01-08 06:59:20 +00:00
|
|
|
|
2018-07-31 02:06:22 +00:00
|
|
|
function suggest_content(App $a)
|
|
|
|
{
|
2020-07-31 17:58:25 +00:00
|
|
|
if (!local_user()) {
|
|
|
|
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
2011-11-02 03:29:55 +00:00
|
|
|
}
|
|
|
|
|
2019-12-16 00:33:13 +00:00
|
|
|
$_SESSION['return_path'] = DI::args()->getCommand();
|
2011-12-18 09:44:46 +00:00
|
|
|
|
2019-12-30 19:02:09 +00:00
|
|
|
DI::page()['aside'] .= Widget::findPeople();
|
|
|
|
DI::page()['aside'] .= Widget::follow();
|
2011-11-02 04:27:11 +00:00
|
|
|
|
2020-07-30 14:08:32 +00:00
|
|
|
$contacts = Contact::getSuggestions(local_user());
|
|
|
|
if (!DBA::isResult($contacts)) {
|
2020-07-31 17:58:25 +00:00
|
|
|
return DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
2019-05-02 01:13:33 +00:00
|
|
|
}
|
|
|
|
|
2019-01-07 17:51:48 +00:00
|
|
|
$entries = [];
|
2020-07-30 14:08:32 +00:00
|
|
|
foreach ($contacts as $contact) {
|
2020-07-31 04:28:26 +00:00
|
|
|
$entries[] = ModuleContact::getContactTemplateVars($contact);
|
2011-11-02 03:29:55 +00:00
|
|
|
}
|
|
|
|
|
2018-10-31 14:44:06 +00:00
|
|
|
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
2015-10-17 19:25:21 +00:00
|
|
|
|
2020-07-31 17:58:25 +00:00
|
|
|
return Renderer::replaceMacros($tpl,[
|
2020-01-18 19:52:34 +00:00
|
|
|
'$title' => DI::l10n()->t('Friend Suggestions'),
|
2015-10-18 15:12:48 +00:00
|
|
|
'$contacts' => $entries,
|
2018-01-15 13:05:12 +00:00
|
|
|
]);
|
2011-11-02 03:29:55 +00:00
|
|
|
}
|