]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Merge pull request #8939 from MrPetovan/task/8906-frio-viewas-redesign
[friendica.git] / src / Model / User.php
index 16dfb512208cf7e3759d1c0778bff435d793d875..78ae95804122d062a1263163936ca6a362314c1d 100644 (file)
@@ -823,7 +823,7 @@ class User
                        $photo_failure = false;
 
                        $filename = basename($photo);
-                       $curlResult = Network::curl($photo, true);
+                       $curlResult = DI::httpRequest()->get($photo, true);
                        if ($curlResult->isSuccess()) {
                                $img_str = $curlResult->getBody();
                                $type = $curlResult->getContentType();
@@ -1272,6 +1272,7 @@ class User
                        'total_users'           => 0,
                        'active_users_halfyear' => 0,
                        'active_users_monthly'  => 0,
+                       'active_users_weekly'   => 0,
                ];
 
                $userStmt = DBA::select('owner-view', ['uid', 'login_date', 'last-item'],
@@ -1284,6 +1285,7 @@ class User
 
                $halfyear = time() - (180 * 24 * 60 * 60);
                $month = time() - (30 * 24 * 60 * 60);
+               $week = time() - (7 * 24 * 60 * 60);
 
                while ($user = DBA::fetch($userStmt)) {
                        $statistics['total_users']++;
@@ -1297,6 +1299,11 @@ class User
                        ) {
                                $statistics['active_users_monthly']++;
                        }
+
+                       if ((strtotime($user['login_date']) > $week) || (strtotime($user['last-item']) > $week)
+                       ) {
+                               $statistics['active_users_weekly']++;
+                       }
                }
                DBA::close($userStmt);