INDEX `dfrn-id` (`dfrn-id`(64)),
INDEX `issued-id` (`issued-id`(64)),
INDEX `network_uid_lastupdate` (`network`,`uid`,`last-update`),
+ INDEX `uid_lastitem` (`uid`,`last-item`),
INDEX `gsid` (`gsid`),
FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
PRIMARY KEY(`id`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
---
--- TABLE gcign
---
-CREATE TABLE IF NOT EXISTS `gcign` (
- `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
- `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
- `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
- PRIMARY KEY(`id`),
- INDEX `uid` (`uid`),
- INDEX `gcid` (`gcid`)
-) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
-
--
-- TABLE gcontact
--
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Module\Contact as ModuleContact;
-
-function suggest_init(App $a)
-{
- if (! local_user()) {
- return;
- }
-}
-
-function suggest_post(App $a)
-{
- if (!empty($_POST['ignore']) && !empty($_POST['confirm'])) {
- DBA::insert('gcign', ['uid' => local_user(), 'gcid' => $_POST['ignore']]);
- notice(DI::l10n()->t('Contact suggestion successfully ignored.'));
- }
-
- DI::baseUrl()->redirect('suggest');
-}
+use Friendica\Network\HTTPException;
function suggest_content(App $a)
{
- $o = '';
-
- if (! local_user()) {
- notice(DI::l10n()->t('Permission denied.'));
- return;
+ if (!local_user()) {
+ throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
$_SESSION['return_path'] = DI::args()->getCommand();
DI::page()['aside'] .= Widget::findPeople();
DI::page()['aside'] .= Widget::follow();
-
$contacts = Contact::getSuggestions(local_user());
if (!DBA::isResult($contacts)) {
- $o .= DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
- return $o;
- }
-
-
- if (!empty($_GET['ignore'])) {
- // <form> can't take arguments in its "action" parameter
- // so add any arguments as hidden inputs
- $query = explode_querystring(DI::args()->getQueryString());
- $inputs = [];
- foreach ($query['args'] as $arg) {
- if (strpos($arg, 'confirm=') === false) {
- $arg_parts = explode('=', $arg);
- $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]];
- }
- }
-
- return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
- '$method' => 'post',
- '$message' => DI::l10n()->t('Do you really want to delete this suggestion?'),
- '$extra_inputs' => $inputs,
- '$confirm' => DI::l10n()->t('Yes'),
- '$confirm_url' => $query['base'],
- '$confirm_name' => 'confirm',
- '$cancel' => DI::l10n()->t('Cancel'),
- ]);
+ return DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
}
$entries = [];
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
- $o .= Renderer::replaceMacros($tpl,[
+ return Renderer::replaceMacros($tpl,[
'$title' => DI::l10n()->t('Friend Suggestions'),
'$contacts' => $entries,
]);
-
- return $o;
}
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1358);
+ define('DB_UPDATE_VERSION', 1359);
}
return [
"PRIMARY" => ["id"],
]
],
- "gcign" => [
- "comment" => "contacts ignored by friend suggestions",
- "fields" => [
- "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
- "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Local User id"],
- "gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => "gcontact.id of ignored contact"],
- ],
- "indexes" => [
- "PRIMARY" => ["id"],
- "uid" => ["uid"],
- "gcid" => ["gcid"],
- ]
- ],
"gcontact" => [
"comment" => "global contacts",
"fields" => [