From cbbbc3d5f963f07453bda22c85dfae6fe4e4de70 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 27 Aug 2012 10:37:31 +0000 Subject: [PATCH] =?UTF-8?q?Force=20le=20recalcul=20des=20quotas=20juste=20?= =?UTF-8?q?avant=20l'affichage=20des=20menus=20=3D>=20si=20on=20viens=20de?= =?UTF-8?q?=20faire=20un=20ajout,=20=C3=A7a=20en=20tiens=20compte=20dans?= =?UTF-8?q?=20l'affichage=20\o/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/admin/menu.php | 2 ++ bureau/admin/sql_doadd.php | 41 +++++++++++++------------------------- bureau/class/m_quota.php | 7 +++++-- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/bureau/admin/menu.php b/bureau/admin/menu.php index 6a280111..29cd852e 100644 --- a/bureau/admin/menu.php +++ b/bureau/admin/menu.php @@ -36,6 +36,8 @@ require_once("../class/config.php"); getquota("",true); // rebuild quota $MENUPATH=ALTERNC_PANEL."/admin/"; $file=file("/etc/alternc/menulist.txt", FILE_SKIP_EMPTY_LINES); diff --git a/bureau/admin/sql_doadd.php b/bureau/admin/sql_doadd.php index 6b0e8f30..5a193cb8 100644 --- a/bureau/admin/sql_doadd.php +++ b/bureau/admin/sql_doadd.php @@ -34,38 +34,25 @@ $fields = array ( ); getFields($fields); if (!$quota->cancreate("mysql")) { - $error=_("err_mysql_1"); - include("sql_add.php"); - exit; + $error=_("You "); + include("sql_add.php"); //FIXME svn del sql_add + exit; } $q=$quota->getquota("mysql"); -if($q['u'] == 0){ - $dbname=$mem->user["login"]; - if(!$mysql->add_db($dbname)){ - $error=$err->errstr(); - include("sql_add.php"); - exit; - } -}else{ - if(!empty($dbn)){ - $dbname=$mem->user["login"]."_".$dbn; - if(!$mysql->add_db($dbname)) { - $error=$err->errstr(); - include("sql_add.php"); - exit; - } - }else{ - $dbname=$mem->user["login"]; - if(!$mysql->add_db($dbname)) { - $error=$err->errstr(); - include("sql_add.php"); - exit; - } - - } +if($q['u'] > 0){ + $dbname=$mem->user["login"]."_".$dbn; +} else { + $dbname=$mem->user["login"]; } +if(!$mysql->add_db($dbname)) { + $error=$err->errstr(); + include("sql_add.php"); //FIXME svn del sql_add + exit; +} + + include("sql_list.php"); ?> diff --git a/bureau/class/m_quota.php b/bureau/class/m_quota.php index 06864ee2..3184b0a1 100644 --- a/bureau/class/m_quota.php +++ b/bureau/class/m_quota.php @@ -81,15 +81,18 @@ class m_quota { return $qlist; } - /* ----------------------------------------------------------------- */ /** Return a ressource usage (u) and total quota (t) * @param string $ressource ressource to get quota of * @Return array the quota used and total for this ressource (or for all ressource if unspecified) */ - function getquota($ressource="") { + function getquota($ressource="",$recheck=false) { global $db,$err,$cuid,$get_quota_cache,$hooks; $err->log("quota","getquota",$ressource); + if ($recheck) { // rebuilding quota + $get_quota_cache=null; + $this->quota=array(); + } if (! empty($get_quota_cache[$cuid]) ) { // This function is called many time each webpage, so I cache the result $this->quotas = $get_quota_cache[$cuid];