diff --git a/bureau/admin/mail_doadd.php b/bureau/admin/mail_doadd.php
index f9041409..63737ba0 100644
--- a/bureau/admin/mail_doadd.php
+++ b/bureau/admin/mail_doadd.php
@@ -37,7 +37,7 @@ getFields($fields);
$res= array();
//FIXME seems good but maybe can be done in a more fashion way.
-$res=$mail->create($domain_id,$mail_arg);
+$res=$mail->create($domain_id,$mail_arg,$domain);
//once the mail created redirection to mail_properties.php, with the mail_id as parameters ( + domain_id )
if($res["mail_id"]== null){
diff --git a/bureau/admin/mail_properties.php b/bureau/admin/mail_properties.php
index ff17fa0d..a6af12c9 100644
--- a/bureau/admin/mail_properties.php
+++ b/bureau/admin/mail_properties.php
@@ -44,6 +44,7 @@ echo sprintf(_("Edition of %s")."
",$details['address_full']);
echo "";?>
+
-+ |
@@ -51,7 +52,6 @@ echo "";?>
|
- |
list_properties($mail_id);
$prev_desc="";
diff --git a/bureau/class/m_mail.php b/bureau/class/m_mail.php
index a361d2ae..dd99c443 100644
--- a/bureau/class/m_mail.php
+++ b/bureau/class/m_mail.php
@@ -127,20 +127,21 @@ class m_mail {
* and an error message if necessary.
* TODO piensar a enlever la contrainte d'unicité sur le champs address et en rajouter une sur adrresse+dom_id.
*/
- function create($dom_id, $mail_arg){
- global $mail,$err,$db,$cuid;
+ function create($dom_id, $mail_arg,$dom_name){
+ global $mail,$err,$db,$cuid,$quota;
$err->log("mail","create");
$return = array (
"state" => true,
"mail_id" => null,
"error" => "OK");
- //FIXME checker uniformité des mails.
- /*if(checkmail(mail_arg) != 0){
+
+ $m=$mail_arg."@".$dom_name;
+ if(checkmail($m) != 0){
$return["state"]=false;
$return["error"]="erreur d'appel a cancreate";
return $return;
- }*/
+ }
$return=$mail->cancreate($dom_id, $mail_arg);
//Si l'appel échoue
@@ -161,17 +162,21 @@ class m_mail {
$return["error"]=" hophophop tu t'es prix pour un banquier ouquoi ?";
return $return;
}
- //verifie quota ( une fois réparé ^^ )
- //TODO quotacheck;
+
+ // Check the quota :
+ if (!$quota->cancreate("mail")) {
+ $err->raise("mail",10);
+ return false;
+ }
- // a remplacer par un truc genre insert into address (domain_id, address) values (7, '4455') ; select id from address where address='4455';
- $db->query("insert into address (domain_id, address) VALUES ($dom_id, '$mail_arg');");
- $test=$db->query("select id from address where domain_id=$dom_id and address=\"$mail_arg\";");
- $db->next_record();
+ $db->query("insert into address (domain_id, address) VALUES ($dom_id, '$mail_arg');");
+ $test=$db->query("select id from address where domain_id=$dom_id and address=\"$mail_arg\";");
+
+ $db->next_record();
$return["mail_id"]=$db->f("id");
- return $return;
+ return $return;
}
/*
@@ -283,8 +288,6 @@ class m_mail {
$final=array_merge($f_simple,$f_adv);
- //FIXME sort pour avoir ceux qui sont ADVANCED a la fin, et trie par label pour etre "fixe"
-
return $final;
}
diff --git a/bureau/class/m_mysql.php b/bureau/class/m_mysql.php
index cc1935c1..be2138f8 100644
--- a/bureau/class/m_mysql.php
+++ b/bureau/class/m_mysql.php
@@ -375,7 +375,8 @@ class m_mysql {
function grant($base,$user,$rights=null,$pass=null,$table='*'){
global $err,$db;
$err->log("mysql","grant");
- if(!preg_match("#^[0-9a-z\_]*$#",$base)){
+
+ if(!preg_match("#^[0-9a-z_\\\\]*$#",$base)){
$err->raise("mysql",2);
return false;
}elseif(!$db->query("select db from db where db='$base';")){
@@ -385,12 +386,12 @@ class m_mysql {
if($rights==null){
$rights='ALL PRIVILEGES';
- }elseif(!preg_match("#^[a-zA-Z\,]*$#",$rights)){
+ }elseif(!preg_match("#^[a-zA-Z,\s]*$#",$rights)){
$err->raise("mysql",3);
return false;
}
- if(!preg_match("#^[0-9a-z\_]*$#",$user)) {
+ if(!preg_match("#^[0-9a-z_]*$#",$user)) {
$err->raise("mysql",5);
return false;
}
@@ -482,12 +483,8 @@ class m_mysql {
function get_userslist() {
global $db,$err,$bro,$cuid;
$err->log("mysql","get_userslist");
- $db->query("SELECT name FROM dbusers WHERE uid='$cuid' and enable not in ('ADMIN','HIDDEN') ORDER BY name;");
- if (!$db->num_rows()) {
- $err->raise("mysql",19);
- return false;
- }
$c=array();
+ $db->query("SELECT name FROM dbusers WHERE uid='$cuid' and enable not in ('ADMIN','HIDDEN') ORDER BY name;");
while ($db->next_record()) {
$c[]=array("name"=>substr($db->f("name"),strpos($db->f("name"),"_")+1));
}
@@ -753,7 +750,13 @@ class m_mysql {
$myadm=$db->f("name");
$password=$db->f("password");
}else{
- $myadm=$mem->user["login"]."_myadm";
+ if (strlen($mem->user["login"]) > 9) { //MYSQL doesn't allow login larger dans 16 characters
+ $myadm=substr($mem->user["login"],0,9);
+ $myadm=$myadm."_myadm";
+ }else{
+ $myadm=$mem->user["login"]."_myadm";
+ }
+
$chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$i = 0;
$password = "";
@@ -784,7 +787,7 @@ class m_mysql {
}
}
$d=$this->get_userslist();
- if (is_array($d)) {
+ if (!empty($d)) {
for($i=0;$idel_user($d[$i]["name"]);
}