]> git.mxchange.org Git - friendica-addons.git/blobdiff - communityhome/communityhome.php
[advancedcontentfilter] Fix typo in help page
[friendica-addons.git] / communityhome / communityhome.php
index 11309635af5905987386a900dfa0c20870a1cb1e..dc0a6bafaca64b0d7dec64cefc5e2c395dd71e63 100644 (file)
@@ -5,7 +5,10 @@
  * Description: Show last community activity in homepage
  * Version: 2.0
  * Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
+ * Status: Unsupported
  */
+
+use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
@@ -30,14 +33,13 @@ function communityhome_getopts()
        return [
                'hidelogin' => L10n::t('Hide login form'),
                'showlastusers' => L10n::t('Show last new users'),
-               'showactiveusers' => L10n::t('Show last active users'),
                'showlastphotos' => L10n::t('Show last photos'),
                'showlastlike' => L10n::t('Show last liked items'),
                'showcommunitystream' => L10n::t('Show community stream')
        ];
 }
 
-function communityhome_addon_admin(&$a, &$o)
+function communityhome_addon_admin(App $a, &$o)
 {
        $tpl = get_markup_template('settings.tpl', 'addon/communityhome/');
 
@@ -53,7 +55,7 @@ function communityhome_addon_admin(&$a, &$o)
        $o = replace_macros($tpl, $ctx);
 }
 
-function communityhome_addon_admin_post(&$a, &$b)
+function communityhome_addon_admin_post(App $a)
 {
        if (x($_POST, 'communityhome-submit')) {
                $opts = communityhome_getopts();
@@ -63,7 +65,7 @@ function communityhome_addon_admin_post(&$a, &$b)
        }
 }
 
-function communityhome_home(&$a, &$o)
+function communityhome_home(App $a, &$o)
 {
        // custom css
        $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/communityhome/communityhome.css" media="all" />';
@@ -116,40 +118,7 @@ function communityhome_home(&$a, &$o)
                        }
                }
        }
-       // 12 most active users (by posts and contacts)
-       // this query don't work on some mysql versions
-       if (Config::get('communityhome', 'showactiveusers')) {
-               $r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`  FROM
-                               (SELECT COUNT(*) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
-                               (SELECT COUNT(*) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
-                               (
-                               SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
-                               UNION ALL
-                               SELECT `contacts`,`items`,`con`.`uid` FROM `con` LEFT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
-                               ) AS `uni`, `user`, `profile`
-                               WHERE `uni`.`uid`=`user`.`uid`
-                               AND `uni`.`uid`=`profile`.`uid` AND `profile`.`publish`=1
-                               GROUP BY `uid`
-                               ORDER BY `items` DESC,`contacts` DESC
-                               LIMIT 0,10");
-               if ($r && count($r)) {
-                       $aside['$activeusers_title'] = L10n::t('Most active users');
-                       $aside['$activeusers_items'] = [];
 
-                       $photo = 'thumb';
-                       foreach ($r as $rr) {
-                               $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
-                               $entry = replace_macros($tpl, [
-                                       '$id' => $rr['id'],
-                                       '$profile_link' => $profile_link,
-                                       '$photo' => $rr[$photo],
-                                       '$photo_user' => sprintf("%s (%s posts, %s contacts)", $rr['name'], ($rr['items'] ? $rr['items'] : '0'),
-                                               ($rr['contacts'] ? $rr['contacts'] : '0'))
-                               ]);
-                               $aside['$activeusers_items'][] = $entry;
-                       }
-               }
-       }
        // last 12 photos
        if (Config::get('communityhome', 'showlastphotos')) {
                $aside['$photos_title'] = L10n::t('Latest photos');