public function __construct()
{
parent::__construct(array('platal.ini', 'platal.conf'));
- $this->bootstrap(array('NbIns'), 'update_NbIns');
- $this->bootstrap(array('NbValid'), 'update_NbValid');
+ $this->bootstrap(array('NbIns'), array($this, 'updateNbIns'));
+ $this->bootstrap(array('NbValid'), array($this, 'updateNbValid'));
}
public function asso($key=null)
return null;
}
}
+
+
+ public function updateNbIns()
+ {
+ $res = XDB::query("SELECT COUNT(*)
+ FROM auth_user_md5
+ WHERE perms IN ('admin','user') AND deces=0");
+ $cnt = $res->fetchOneCell();
+ $this->changeDynamicConfig(array('NbIns' => $cnt));
+ }
+
+ public function updateNbValid()
+ {
+ $res = XDB::query("SELECT COUNT(*)
+ FROM requests");
+ $this->changeDynamicConfig(array('NbValid' => $res->fetchOneCell()));
+ }
}
+
+/******************************************************************************
+ * Dynamic configuration update/edition stuff
+ *****************************************************************************/
+
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
$this->makePerms($perms);
$this->securityChecks();
$this->setSkin();
- update_NbNotifs();
+ $this->updateNbNotifs();
check_redirect();
return true;
}
{
return AUTH_MDP;
}
+
+
+ public function updateNbNotifs()
+ {
+ require_once 'notifs.inc.php';
+ $n = select_notifs(false, S::i('uid'), S::v('watch_last'), false);
+ S::set('notifs', $n->numRows());
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+function __autoload($cls)
+{
+ if (!pl_autoload($cls)) {
+ $cls = strtolower($cls);
+ if (substr($cls, -3, 3) == 'req') {
+ @include 'validations.inc.php';
+ return;
+ } else if (substr($cls, 0, 6) == 'banana') {
+ require_once 'banana/banana.inc.php';
+ Banana::load(substr($cls, 6));
+ return;
+ }
+ @include "$cls.inc.php";
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
WHERE ni_id={?}', $uid);
XDB::execute('DELETE FROM watch_nonins WHERE ni_id={?}', $uid);
}
- update_NbNotifs();
+ Platal::session()->updateNbNotifs();
}
// }}}
$this->uid, $this->type, $this, $this->stamp);
global $globals;
- update_NbValid();
+ $globals->updateNbValid();
return true;
}
$success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?} AND stamp={?}',
$this->uid, $this->type, $this->stamp);
}
- update_NbValid();
+ $globals->updateNbValid();
return $success;
}
define('PL_PAGE_CLASS', 'XnetPage');
require_once dirname(dirname(__FILE__)) . '/core/include/platal.inc.php';
-
-function __autoload($cls)
-{
- $cls = strtolower($cls);
- if (!pl_autoload($cls)) {
- if (substr($cls, -3, 3) == 'req') {
- @include 'validations.inc.php';
- return;
- } else if (substr($cls, 0, 6) == 'banana') {
- require_once 'banana/banana.inc.php';
- Banana::load(substr($cls, 6));
- return;
- }
- @include "$cls.inc.php";
- }
-}
+require_once 'common.inc.php';
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
require_once dirname(dirname(__FILE__)) . '/core/include/platal.inc.php';
require_once 'security.inc.php';
-
-function __autoload($cls)
-{
- $cls = strtolower($cls);
- if (!pl_autoload($cls)) {
- if (substr($cls, -3, 3) == 'req') {
- @include 'validations.inc.php';
- return;
- } else if (substr($cls, 0, 6) == 'banana') {
- require_once 'banana/banana.inc.php';
- Banana::load(substr($cls, 6));
- return;
- }
- @include "$cls.inc.php";
- }
-}
-
-/******************************************************************************
- * Dynamic configuration update/edition stuff
- *****************************************************************************/
-
-function update_NbIns()
-{
- global $globals;
- $res = XDB::query("SELECT COUNT(*)
- FROM auth_user_md5
- WHERE perms IN ('admin','user') AND deces=0");
- $cnt = $res->fetchOneCell();
- $globals->changeDynamicConfig(array('NbIns' => $cnt));
-}
-
-function update_NbValid()
-{
- global $globals;
- $res = XDB::query("SELECT COUNT(*)
- FROM requests");
- $globals->changeDynamicConfig(array('NbValid' => $res->fetchOneCell()));
-}
-
-function update_NbNotifs()
-{
- require_once 'notifs.inc.php';
- $n = select_notifs(false, S::i('uid'), S::v('watch_last'), false);
- $_SESSION['notifs'] = $n->numRows();
-}
+require_once 'common.inc.php';
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
$mailer->send();
// update number of subscribers (perms or deceased may have changed)
- update_NbIns();
+ $globals->updateNbIns();
$page->trigSuccess("updaté correctement.");
}
case "u_kill":
user_clear_all_subs($mr['user_id']);
// update number of subscribers (perms or deceased may have changed)
- update_NbIns();
+ $globals->updateNbIns();
$page->trigSuccess("'{$mr['user_id']}' a été désinscrit !");
$mailer = new PlMailer("admin/useredit.mail.tpl");
$mailer->assign("admin", S::v('forlife'));
// Update the count of item to validate here... useful in development configuration
// where several copies of the site use the same DB, but not the same "dynamic configuration"
- update_NbValid();
+ global $globals;
+ $globals->updateNbValid();
$page->assign('vit', new ValidateIterator());
}
$page->changeTpl('carnet/panel.tpl');
if (Get::has('read')) {
- $_SESSION['watch_last'] = Get::v('read');
- update_NbNotifs();
+ S::set('watch_last', Get::v('read'));
+ Platal::session()->updateNbNotifs();
pl_redirect('carnet/panel');
}
function handler_photo_change(&$page)
{
+ global $globals;
$page->changeTpl('profile/trombino.tpl');
require_once('validations.inc.php');
XDB::execute('DELETE FROM requests
WHERE user_id = {?} AND type="photo"',
S::v('uid'));
- update_NbValid();
+ $globals->updateNbValid();
} elseif (Env::v('cancel')) {
$sql = XDB::query('DELETE FROM requests
WHERE user_id={?} AND type="photo"',
S::v('uid'));
- update_NbValid();
+ $globals->updateNbValid();
}
$sql = XDB::query('SELECT COUNT(*)
user_reindex($uid);
// update number of subscribers (perms has changed)
- update_NbIns();
+ $globals->updateNbIns();
if (!start_connexion($uid, false)) {
return PL_FORBIDDEN;
XDB::execute("DELETE FROM requests
WHERE type = 'paiements' AND data LIKE {?}",
PayReq::same_event($eid, $globals->asso('id')));
- update_NbValid();
+ $globals->updateNbValid();
}
if ($action == 'archive') {