X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FForumManager.php;h=535f6483e4e55c2bf9f26f9916dd6744fe03ee3d;hb=f051ae169868905d3f3debbed37c8cf0f8b2be35;hp=e5d153f75960c5988ae34816ddd0c49689450fc8;hpb=d99a7efd90999c4b6adf8dbdec3b8f02ff0c0b3e;p=friendica.git diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index e5d153f759..535f6483e4 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -5,10 +5,14 @@ */ namespace Friendica\Content; -use Friendica\App; +use Friendica\Content\Feature; +use Friendica\Core\L10n; use Friendica\Core\System; +use Friendica\Database\DBA; use Friendica\Database\DBM; -use dba; +use Friendica\Model\Contact; + +require_once 'include/dba.php'; /** * @brief This class handles methods related to the forum functionality @@ -32,7 +36,7 @@ class ForumManager */ public static function getList($uid, $lastitem, $showhidden = true, $showprivate = false) { - $forumlist = array(); + $forumlist = []; $order = (($showhidden) ? '' : ' AND NOT `hidden` '); $order .= (($lastitem) ? ' ORDER BY `last-item` DESC ' : ' ORDER BY `name` ASC '); @@ -41,11 +45,11 @@ class ForumManager $select = '(`forum` OR `prv`)'; } - $contacts = dba::p( + $contacts = DBA::p( "SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb` FROM `contact` WHERE `network`= 'dfrn' AND $select AND `uid` = ? - AND NOT `blocked` AND NOT `hidden` AND NOT `pending` AND NOT `archive` + AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `success_update` > `failure_update` $order ", $uid @@ -55,16 +59,16 @@ class ForumManager return($forumlist); } - while ($contact = dba::fetch($contacts)) { - $forumlist[] = array( + while ($contact = DBA::fetch($contacts)) { + $forumlist[] = [ 'url' => $contact['url'], 'name' => $contact['name'], 'id' => $contact['id'], 'micro' => $contact['micro'], 'thumb' => $contact['thumb'], - ); + ]; } - dba::close($contacts); + DBA::close($contacts); return($forumlist); } @@ -82,7 +86,7 @@ class ForumManager */ public static function widget($uid, $cid = 0) { - if (! intval(feature_enabled(local_user(), 'forumlist_widget'))) { + if (! intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) { return; } @@ -101,15 +105,15 @@ class ForumManager foreach ($contacts as $contact) { $selected = (($cid == $contact['id']) ? ' forum-selected' : ''); - $entry = array( + $entry = [ 'url' => 'network?f=&cid=' . $contact['id'], - 'external_url' => 'redir/' . $contact['id'], + 'external_url' => Contact::magicLink($contact['url']), 'name' => $contact['name'], 'cid' => $contact['id'], 'selected' => $selected, 'micro' => System::removedBaseUrl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)), 'id' => ++$id, - ); + ]; $entries[] = $entry; } @@ -117,13 +121,13 @@ class ForumManager $o .= replace_macros( $tpl, - array( - '$title' => t('Forums'), + [ + '$title' => L10n::t('Forums'), '$forums' => $entries, - '$link_desc' => t('External link to forum'), + '$link_desc' => L10n::t('External link to forum'), '$total' => $total, '$visible_forums' => $visible_forums, - '$showmore' => t('show more')) + '$showmore' => L10n::t('show more')] ); } @@ -141,7 +145,7 @@ class ForumManager */ public static function profileAdvanced($uid) { - $profile = intval(feature_enabled($uid, 'forumlist_profile')); + $profile = intval(Feature::isEnabled($uid, 'forumlist_profile')); if (! $profile) { return; } @@ -157,7 +161,7 @@ class ForumManager $contacts = self::getList($uid, $lastitem, false, false); $total_shown = 0; - + $forumlist = ''; foreach ($contacts as $contact) { $forumlist .= micropro($contact, false, 'forumlist-profile-advanced'); $total_shown ++;