Moving to GitHub.
[platal.git] / classes / platalglobals.php.in
index 3f0085d..6bd1518 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -77,11 +77,12 @@ class PlatalGlobals extends PlGlobals
 
     public function updateNbIns()
     {
-        $res = XDB::query("SELECT  COUNT(*)
-                             FROM  accounts
-                            WHERE  state = 'active'");
-        $cnt = $res->fetchOneCell();
-        $this->changeDynamicConfig(array('NbIns' => $cnt));
+        $count = XDB::rawFetchOneCell("SELECT  COUNT(*)
+                                         FROM  accounts         AS a
+                                   INNER JOIN  account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms))
+                                   INNER JOIN  profiles         AS p  ON (ap.pid = p.pid)
+                                        WHERE  a.state = 'active' AND p.deathdate IS NULL");
+        $this->changeDynamicConfig(array('NbIns' => $count));
     }
 
     public function updateNbValid()
@@ -101,5 +102,5 @@ class PlatalGlobals extends PlGlobals
  * Dynamic configuration update/edition stuff
  *****************************************************************************/
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>