]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/ForumManager.php
Update use statement lists with new Friendica\Database\dba class
[friendica.git] / src / Content / ForumManager.php
index e5d153f75960c5988ae34816ddd0c49689450fc8..edbe0b64e98deb382d0edd01d0534636ca68d282 100644 (file)
@@ -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 ');
@@ -45,7 +49,7 @@ class ForumManager
                        "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
@@ -56,13 +60,13 @@ class ForumManager
                }
 
                while ($contact = dba::fetch($contacts)) {
-                       $forumlist[] = array(
+                       $forumlist[] = [
                                'url'   => $contact['url'],
                                'name'  => $contact['name'],
                                'id'    => $contact['id'],
                                'micro' => $contact['micro'],
                                'thumb' => $contact['thumb'],
-                       );
+                       ];
                }
                dba::close($contacts);
 
@@ -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 ++;