X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fsuggest.php;h=8a25fb0b213771e3a5ba035b102211ee4894c492;hb=5db1717f4632a33da34e08b916816d7cba0e1878;hp=deda2b2c6c93bbfdb5738c6807ac2d5b4ddad0a3;hpb=5ba6c7717a06842c27fec15508ff8cabb3d9a31b;p=friendica.git diff --git a/mod/suggest.php b/mod/suggest.php index deda2b2c6c..8a25fb0b21 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -3,12 +3,13 @@ * @file mod/suggest.php */ use Friendica\App; +use Friendica\Content\ContactSelector; +use Friendica\Content\Widget; use Friendica\Core\System; use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; - -require_once 'include/contact_widgets.php'; +use Friendica\Model\Profile; function suggest_init(App $a) { if (! local_user()) { @@ -21,15 +22,15 @@ function suggest_init(App $a) { //
can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); - $inputs = array(); + $inputs = []; foreach ($query['args'] as $arg) { if (strpos($arg, 'confirm=') === false) { $arg_parts = explode('=', $arg); - $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); + $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]]; } } - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array( + $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ '$method' => 'get', '$message' => t('Do you really want to delete this suggestion?'), '$extra_inputs' => $inputs, @@ -37,22 +38,18 @@ function suggest_init(App $a) { '$confirm_url' => $query['base'], '$confirm_name' => 'confirmed', '$cancel' => t('Cancel'), - )); + ]); $a->error = 1; // Set $a->error so the other module functions don't execute return; } // Now check how the user responded to the confirmation query if (!$_REQUEST['canceled']) { - dba::insert('gcign', array('uid' => local_user(), 'gcid' => $_GET['ignore'])); + dba::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]); } } } - - - - function suggest_content(App $a) { require_once("mod/proxy.php"); @@ -65,8 +62,8 @@ function suggest_content(App $a) { $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; - $a->page['aside'] .= findpeople_widget(); - $a->page['aside'] .= follow_widget(); + $a->page['aside'] .= Widget::findPeople(); + $a->page['aside'] .= Widget::follow(); $r = GContact::suggestionQuery(local_user()); @@ -76,22 +73,20 @@ function suggest_content(App $a) { return $o; } - require_once 'include/contact_selectors.php'; - foreach ($r as $rr) { $connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id']; - $photo_menu = array( - 'profile' => array(t("View Profile"), zrl($rr["url"])), - 'follow' => array(t("Connect/Follow"), $connlnk), - 'hide' => array(t('Ignore/Hide'), $ignlnk) - ); + $photo_menu = [ + 'profile' => [t("View Profile"), Profile::zrl($rr["url"])], + 'follow' => [t("Connect/Follow"), $connlnk], + 'hide' => [t('Ignore/Hide'), $ignlnk] + ]; $contact_details = Contact::getDetailsByURL($rr["url"], local_user(), $rr); - $entry = array( - 'url' => zrl($rr['url']), + $entry = [ + 'url' => Profile::zrl($rr['url']), 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']), 'img_hover' => $rr['url'], 'name' => $contact_details['name'], @@ -106,18 +101,18 @@ function suggest_content(App $a) { 'connlnk' => $connlnk, 'photo_menu' => $photo_menu, 'ignore' => t('Ignore/Hide'), - 'network' => network_to_name($rr['network'], $rr['url']), + 'network' => ContactSelector::networkToName($rr['network'], $rr['url']), 'id' => ++$id, - ); + ]; $entries[] = $entry; } $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$title' => t('Friend Suggestions'), '$contacts' => $entries, - )); + ]); return $o; }