Few little Bugfixes

This commit is contained in:
Steven Mondji-Lerider 2012-08-19 20:50:47 +00:00
parent 391bb4a50d
commit 1723a40516
4 changed files with 32 additions and 26 deletions

View File

@ -37,7 +37,7 @@ getFields($fields);
$res= array(); $res= array();
//FIXME seems good but maybe can be done in a more fashion way. //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 ) //once the mail created redirection to mail_properties.php, with the mail_id as parameters ( + domain_id )
if($res["mail_id"]== null){ if($res["mail_id"]== null){

View File

@ -44,6 +44,7 @@ echo sprintf(_("Edition of <b>%s</b>")."<br />",$details['address_full']);
echo "</h3>";?> echo "</h3>";?>
<hr/> <hr/>
<h3><?php __("Select your action");?></h3>
<table class="tlist"> <table class="tlist">
<tr id='globalmail_title'><td colspan=2 class='advdom'><b><a href="javascript:toogle_properties('globalmail_');"><font id='globalmail_minus'>-</font><font id='globalmail_plus' style='display:none'>+</font> <?php __("Global options");?></a></b></td></tr> <tr id='globalmail_title'><td colspan=2 class='advdom'><b><a href="javascript:toogle_properties('globalmail_');"><font id='globalmail_minus'>-</font><font id='globalmail_plus' style='display:none'>+</font> <?php __("Global options");?></a></b></td></tr>
<tr id="globalmail_"><td> <tr id="globalmail_"><td>
@ -51,7 +52,6 @@ echo "</h3>";?>
</td> </td>
</tr> </tr>
<tr><td colspan=2><h3><?php __("Select your action");?></h3></td></tr>
<?php <?php
$properties = $mail->list_properties($mail_id); $properties = $mail->list_properties($mail_id);
$prev_desc=""; $prev_desc="";

View File

@ -127,20 +127,21 @@ class m_mail {
* and an error message if necessary. * 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. * 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){ function create($dom_id, $mail_arg,$dom_name){
global $mail,$err,$db,$cuid; global $mail,$err,$db,$cuid,$quota;
$err->log("mail","create"); $err->log("mail","create");
$return = array ( $return = array (
"state" => true, "state" => true,
"mail_id" => null, "mail_id" => null,
"error" => "OK"); "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["state"]=false;
$return["error"]="erreur d'appel a cancreate"; $return["error"]="erreur d'appel a cancreate";
return $return; return $return;
}*/ }
$return=$mail->cancreate($dom_id, $mail_arg); $return=$mail->cancreate($dom_id, $mail_arg);
//Si l'appel échoue //Si l'appel échoue
@ -161,12 +162,16 @@ class m_mail {
$return["error"]=" hophophop tu t'es prix pour un banquier ouquoi ?"; $return["error"]=" hophophop tu t'es prix pour un banquier ouquoi ?";
return $return; return $return;
} }
//verifie quota ( une fois réparé ^^ )
//TODO quotacheck;
// a remplacer par un truc genre insert into address (domain_id, address) values (7, '4455') ; select id from address where address='4455'; // Check the quota :
if (!$quota->cancreate("mail")) {
$err->raise("mail",10);
return false;
}
$db->query("insert into address (domain_id, address) VALUES ($dom_id, '$mail_arg');"); $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\";"); $test=$db->query("select id from address where domain_id=$dom_id and address=\"$mail_arg\";");
$db->next_record(); $db->next_record();
$return["mail_id"]=$db->f("id"); $return["mail_id"]=$db->f("id");
@ -283,8 +288,6 @@ class m_mail {
$final=array_merge($f_simple,$f_adv); $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; return $final;
} }

View File

@ -375,7 +375,8 @@ class m_mysql {
function grant($base,$user,$rights=null,$pass=null,$table='*'){ function grant($base,$user,$rights=null,$pass=null,$table='*'){
global $err,$db; global $err,$db;
$err->log("mysql","grant"); $err->log("mysql","grant");
if(!preg_match("#^[0-9a-z\_]*$#",$base)){
if(!preg_match("#^[0-9a-z_\\\\]*$#",$base)){
$err->raise("mysql",2); $err->raise("mysql",2);
return false; return false;
}elseif(!$db->query("select db from db where db='$base';")){ }elseif(!$db->query("select db from db where db='$base';")){
@ -385,12 +386,12 @@ class m_mysql {
if($rights==null){ if($rights==null){
$rights='ALL PRIVILEGES'; $rights='ALL PRIVILEGES';
}elseif(!preg_match("#^[a-zA-Z\,]*$#",$rights)){ }elseif(!preg_match("#^[a-zA-Z,\s]*$#",$rights)){
$err->raise("mysql",3); $err->raise("mysql",3);
return false; return false;
} }
if(!preg_match("#^[0-9a-z\_]*$#",$user)) { if(!preg_match("#^[0-9a-z_]*$#",$user)) {
$err->raise("mysql",5); $err->raise("mysql",5);
return false; return false;
} }
@ -482,12 +483,8 @@ class m_mysql {
function get_userslist() { function get_userslist() {
global $db,$err,$bro,$cuid; global $db,$err,$bro,$cuid;
$err->log("mysql","get_userslist"); $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(); $c=array();
$db->query("SELECT name FROM dbusers WHERE uid='$cuid' and enable not in ('ADMIN','HIDDEN') ORDER BY name;");
while ($db->next_record()) { while ($db->next_record()) {
$c[]=array("name"=>substr($db->f("name"),strpos($db->f("name"),"_")+1)); $c[]=array("name"=>substr($db->f("name"),strpos($db->f("name"),"_")+1));
} }
@ -752,8 +749,14 @@ class m_mysql {
if ($db->num_rows()) { if ($db->num_rows()) {
$myadm=$db->f("name"); $myadm=$db->f("name");
$password=$db->f("password"); $password=$db->f("password");
}else{
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{ }else{
$myadm=$mem->user["login"]."_myadm"; $myadm=$mem->user["login"]."_myadm";
}
$chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$i = 0; $i = 0;
$password = ""; $password = "";
@ -784,7 +787,7 @@ class m_mysql {
} }
} }
$d=$this->get_userslist(); $d=$this->get_userslist();
if (is_array($d)) { if (!empty($d)) {
for($i=0;$i<count($d);$i++) { for($i=0;$i<count($d);$i++) {
$this->del_user($d[$i]["name"]); $this->del_user($d[$i]["name"]);
} }