]> git.mxchange.org Git - friendica-addons.git/blobdiff - statistics_json/statistics_json.php
Merge pull request #415 from Hypolite/task/replace-explicit-php-logical-operators
[friendica-addons.git] / statistics_json / statistics_json.php
index 8172c070124d725af930a0a6fde5970eef7d176d..2bd2f41f60ff320017353e88329fa70485e4b75c 100644 (file)
@@ -3,8 +3,9 @@
 /**
  * Name: Statistics
  * Description: Generates some statistics for http://the-federation.info/
- * Version: 0.1
+ * Version: 0.2
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
+ * Status: Unsupported
  */
 
 function statistics_json_install() {
@@ -29,7 +30,7 @@ function statistics_json_init() {
        $statistics = array(
                        "name" => $a->config["sitename"],
                        "network" => FRIENDICA_PLATFORM,
-                       "version" => FRIENDICA_VERSION,
+                       "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION,
                        "registrations_open" => ($a->config['register_policy'] != 0),
                        "total_users" => get_config('statistics_json','total_users'),
                        "active_users_halfyear" => get_config('statistics_json','active_users_halfyear'),
@@ -109,11 +110,11 @@ function statistics_json_cron($a,$b) {
                        $month = time() - (30 * 24 * 60 * 60);
 
                        foreach ($users AS $user) {
-                               if ((strtotime($user['login_date']) > $halfyear) OR
+                               if ((strtotime($user['login_date']) > $halfyear) ||
                                        (strtotime($user['lastitem_date']) > $halfyear))
                                        ++$active_users_halfyear;
 
-                               if ((strtotime($user['login_date']) > $month) OR
+                               if ((strtotime($user['login_date']) > $month) ||
                                        (strtotime($user['lastitem_date']) > $month))
                                        ++$active_users_monthly;
 
@@ -125,7 +126,7 @@ function statistics_json_cron($a,$b) {
                        set_config('statistics_json','active_users_monthly', $active_users_monthly);
        }
 
-       $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND left(body, 6) != '[share'");
+       $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND `uid` != 0 AND `id` = `parent` AND left(body, 6) != '[share'");
 
        if (!is_array($posts))
                $local_posts = -1;