Messages d'erreurs
This commit is contained in:
parent
f0bdadab79
commit
de6f7a4e98
|
@ -128,7 +128,7 @@ class m_cron {
|
||||||
$db->query("SELECT uid FROM cron WHERE id = $id;");
|
$db->query("SELECT uid FROM cron WHERE id = $id;");
|
||||||
if (! $db->next_record()) { return "false"; } // return false if pb
|
if (! $db->next_record()) { return "false"; } // return false if pb
|
||||||
if ( $db->f('uid') != $cuid ) {
|
if ( $db->f('uid') != $cuid ) {
|
||||||
$err->raise("cron","Identity problem");
|
$err->raise("cron",_("Identity problem"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ class m_ftp {
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("ftp",1);
|
$err->raise("ftp",_("No ftp account found"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ class m_ftp {
|
||||||
);
|
);
|
||||||
return $r;
|
return $r;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("ftp",2);
|
$err->raise("ftp",_("This ftp account does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class m_ftp {
|
||||||
$db->query("SELECT count(*) AS cnt FROM ftpusers WHERE id='$id' and uid='$cuid';");
|
$db->query("SELECT count(*) AS cnt FROM ftpusers WHERE id='$id' and uid='$cuid';");
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
if (!$db->f("cnt")) {
|
if (!$db->f("cnt")) {
|
||||||
$err->raise("ftp",2);
|
$err->raise("ftp",_("This ftp account does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$dir=$bro->convertabsolute($dir);
|
$dir=$bro->convertabsolute($dir);
|
||||||
|
@ -197,7 +197,7 @@ class m_ftp {
|
||||||
}
|
}
|
||||||
$r=$this->prefix_list();
|
$r=$this->prefix_list();
|
||||||
if (!in_array($prefixe,$r)) {
|
if (!in_array($prefixe,$r)) {
|
||||||
$err->raise("ftp",3);
|
$err->raise("ftp",_("The chosen prefix is not allowed"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$lo=$mem->user["login"];
|
$lo=$mem->user["login"];
|
||||||
|
@ -206,7 +206,7 @@ class m_ftp {
|
||||||
$db->query("SELECT COUNT(*) AS cnt FROM ftpusers WHERE id!='$id' AND name='$prefixe$login';");
|
$db->query("SELECT COUNT(*) AS cnt FROM ftpusers WHERE id!='$id' AND name='$prefixe$login';");
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
if ($db->f("cnt")) {
|
if ($db->f("cnt")) {
|
||||||
$err->raise("ftp",4);
|
$err->raise("ftp",_("This ftp account already exists"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$absolute=getuserpath()."/$dir";
|
$absolute=getuserpath()."/$dir";
|
||||||
|
@ -214,7 +214,7 @@ class m_ftp {
|
||||||
system("/bin/mkdir -p $absolute");
|
system("/bin/mkdir -p $absolute");
|
||||||
}
|
}
|
||||||
if (!is_dir($absolute)) {
|
if (!is_dir($absolute)) {
|
||||||
$err->raise("ftp",6);
|
$err->raise("ftp",_("The directory cannot be created."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (trim($pass)) {
|
if (trim($pass)) {
|
||||||
|
@ -246,7 +246,7 @@ class m_ftp {
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
$name=$db->f("name");
|
$name=$db->f("name");
|
||||||
if (!$name) {
|
if (!$name) {
|
||||||
$err->raise("ftp",2);
|
$err->raise("ftp",_("This ftp account does not exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("DELETE FROM ftpusers WHERE id='$id'");
|
$db->query("DELETE FROM ftpusers WHERE id='$id'");
|
||||||
|
@ -271,14 +271,14 @@ class m_ftp {
|
||||||
}
|
}
|
||||||
$r=$this->prefix_list();
|
$r=$this->prefix_list();
|
||||||
if (!in_array($prefixe,$r) || $prefixe=="") {
|
if (!in_array($prefixe,$r) || $prefixe=="") {
|
||||||
$err->raise("ftp",3);
|
$err->raise("ftp",_("The chosen prefix is not allowed"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($login) $login="_".$login;
|
if ($login) $login="_".$login;
|
||||||
$db->query("SELECT count(*) AS cnt FROM ftpusers WHERE name='".$prefixe.$login."'");
|
$db->query("SELECT count(*) AS cnt FROM ftpusers WHERE name='".$prefixe.$login."'");
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
if ($db->f("cnt")) {
|
if ($db->f("cnt")) {
|
||||||
$err->raise("ftp",4);
|
$err->raise("ftp",_("This ftp account already exists"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$db->query("SELECT login FROM membres WHERE uid='$cuid';");
|
$db->query("SELECT login FROM membres WHERE uid='$cuid';");
|
||||||
|
@ -290,7 +290,7 @@ class m_ftp {
|
||||||
system("/bin/mkdir -p $absolute");
|
system("/bin/mkdir -p $absolute");
|
||||||
}
|
}
|
||||||
if (!is_dir($absolute)) {
|
if (!is_dir($absolute)) {
|
||||||
$err->raise("ftp",6);
|
$err->raise("ftp",_("The directory cannot be created."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class m_ftp {
|
||||||
$db->query("INSERT INTO ftpusers (name,password, encrypted_password,homedir,uid) VALUES ('".$prefixe.$login."', '', '$encrypted_password', '$absolute', '$cuid')");
|
$db->query("INSERT INTO ftpusers (name,password, encrypted_password,homedir,uid) VALUES ('".$prefixe.$login."', '', '$encrypted_password', '$absolute', '$cuid')");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("ftp",5);
|
$err->raise("ftp",_("Your ftp account quota is over. You cannot create more ftp accounts."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class m_hta {
|
||||||
$err->log("hta","createdir",$dir);
|
$err->log("hta","createdir",$dir);
|
||||||
$absolute=$bro->convertabsolute($dir,0);
|
$absolute=$bro->convertabsolute($dir,0);
|
||||||
if (!$absolute) {
|
if (!$absolute) {
|
||||||
$err->raise("hta",8,$dir);
|
$err->raise("hta",printf(_("The folder '%s' does not exist"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!file_exists($absolute)) {
|
if (!file_exists($absolute)) {
|
||||||
|
@ -75,12 +75,12 @@ class m_hta {
|
||||||
}
|
}
|
||||||
if (!file_exists("$absolute/.htaccess")) {
|
if (!file_exists("$absolute/.htaccess")) {
|
||||||
if (!@touch("$absolute/.htaccess")) {
|
if (!@touch("$absolute/.htaccess")) {
|
||||||
$err->raise("hta",12);
|
$err->raise("hta",_("File already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$file = @fopen("$absolute/.htaccess","r+");
|
$file = @fopen("$absolute/.htaccess","r+");
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
$err->raise("hta",12);
|
$err->raise("hta",_("File already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fseek($file,0);
|
fseek($file,0);
|
||||||
|
@ -90,7 +90,7 @@ class m_hta {
|
||||||
}
|
}
|
||||||
if (!file_exists("$absolute/.htpasswd")) {
|
if (!file_exists("$absolute/.htpasswd")) {
|
||||||
if (!touch("$absolute/.htpasswd")) {
|
if (!touch("$absolute/.htpasswd")) {
|
||||||
$err->raise("hta",12);
|
$err->raise("hta",_("File already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -112,7 +112,7 @@ class m_hta {
|
||||||
$absolute="$L_ALTERNC_LOC/html/".substr($mem->user["login"],0,1)."/".$mem->user["login"];
|
$absolute="$L_ALTERNC_LOC/html/".substr($mem->user["login"],0,1)."/".$mem->user["login"];
|
||||||
exec("find $absolute -name .htpasswd|sort",$sortie);
|
exec("find $absolute -name .htpasswd|sort",$sortie);
|
||||||
if(!count($sortie)){
|
if(!count($sortie)){
|
||||||
$err->raise("hta",4);
|
$err->raise("hta",_("No protected folder"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$pattern="/^".preg_quote($L_ALTERNC_LOC,"/")."\/html\/.\/[^\/]*\/(.*)\/\.htpasswd/";
|
$pattern="/^".preg_quote($L_ALTERNC_LOC,"/")."\/html\/.\/[^\/]*\/(.*)\/\.htpasswd/";
|
||||||
|
@ -189,15 +189,15 @@ class m_hta {
|
||||||
$err->log("hta","deldir",$dir);
|
$err->log("hta","deldir",$dir);
|
||||||
$dir=$bro->convertabsolute($dir,0);
|
$dir=$bro->convertabsolute($dir,0);
|
||||||
if (!$dir) {
|
if (!$dir) {
|
||||||
$err->raise("hta",8,$dir);
|
$err->raise("hta",printf(("The folder '%s' does not exist"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!@unlink("$dir/.htaccess")) {
|
if (!@unlink("$dir/.htaccess")) {
|
||||||
$err->raise("hta",5,$dir);
|
$err->raise("hta",printf(_("I cannot delete the file '%s'/.htaccess"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!@unlink("$dir/.htpasswd")) {
|
if (!@unlink("$dir/.htpasswd")) {
|
||||||
$err->raise("hta",6,$dir);
|
$err->raise("hta",printf(_("I cannot delete the file '%s'/.htpasswd"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -217,7 +217,7 @@ class m_hta {
|
||||||
$err->log("hta","add_user",$user."/".$dir);
|
$err->log("hta","add_user",$user."/".$dir);
|
||||||
$absolute=$bro->convertabsolute($dir,0);
|
$absolute=$bro->convertabsolute($dir,0);
|
||||||
if (!file_exists($absolute)) {
|
if (!file_exists($absolute)) {
|
||||||
$err->raise("hta",8,$dir);
|
$err->raise("hta",printf(("The folder '%s' does not exist"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (checkloginmail($user)){
|
if (checkloginmail($user)){
|
||||||
|
@ -230,7 +230,7 @@ class m_hta {
|
||||||
|
|
||||||
$file = @fopen("$absolute/.htpasswd","a+");
|
$file = @fopen("$absolute/.htpasswd","a+");
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
$err->raise("hta",12);
|
$err->raise("hta",_("File already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fseek($file,0);
|
fseek($file,0);
|
||||||
|
@ -238,7 +238,7 @@ class m_hta {
|
||||||
$s=fgets($file,1024);
|
$s=fgets($file,1024);
|
||||||
$t=explode(":",$s);
|
$t=explode(":",$s);
|
||||||
if ($t[0]==$user) {
|
if ($t[0]==$user) {
|
||||||
$err->raise("hta",10,$user);
|
$err->raise("hta",printf(_("The user '%s' already exist for this folder"),$user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ class m_hta {
|
||||||
fclose($file);
|
fclose($file);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$err->raise("hta",11);
|
$err->raise("hta",_("Please enter a valid username"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,14 +268,14 @@ class m_hta {
|
||||||
$err->log("hta","del_user",$lst."/".$dir);
|
$err->log("hta","del_user",$lst."/".$dir);
|
||||||
$absolute=$bro->convertabsolute($dir,0);
|
$absolute=$bro->convertabsolute($dir,0);
|
||||||
if (!file_exists($absolute)) {
|
if (!file_exists($absolute)) {
|
||||||
$err->raise("hta",8,$dir);
|
$err->raise("hta",printf(_("The folder '%s' does not exist"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
touch("$absolute/.htpasswd.new");
|
touch("$absolute/.htpasswd.new");
|
||||||
$file = fopen("$absolute/.htpasswd","r");
|
$file = fopen("$absolute/.htpasswd","r");
|
||||||
$newf = fopen("$absolute/.htpasswd.new","a");
|
$newf = fopen("$absolute/.htpasswd.new","a");
|
||||||
if (!$file || !$newf) {
|
if (!$file || !$newf) {
|
||||||
$err->raise("hta",12);
|
$err->raise("hta",_("File already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
reset($lst);
|
reset($lst);
|
||||||
|
@ -309,7 +309,7 @@ class m_hta {
|
||||||
$err->log("hta","change_pass",$user."/".$dir);
|
$err->log("hta","change_pass",$user."/".$dir);
|
||||||
$absolute=$bro->convertabsolute($dir,0);
|
$absolute=$bro->convertabsolute($dir,0);
|
||||||
if (!file_exists($absolute)) {
|
if (!file_exists($absolute)) {
|
||||||
$err->raise("hta",8,$dir);
|
$err->raise("hta",printf(_"The folder '%s' does not exist"),$dir));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ class m_hta {
|
||||||
$file = fopen("$absolute/.htpasswd","r");
|
$file = fopen("$absolute/.htpasswd","r");
|
||||||
$newf = fopen("$absolute/.htpasswd.new","a");
|
$newf = fopen("$absolute/.htpasswd.new","a");
|
||||||
if (!$file || !$newf) {
|
if (!$file || !$newf) {
|
||||||
$err->raise("hta",12);
|
$err->raise("hta",_("File already exist"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
while (!feof($file)) {
|
while (!feof($file)) {
|
||||||
|
@ -379,7 +379,7 @@ class m_hta {
|
||||||
} // Reading config file
|
} // Reading config file
|
||||||
fclose($file);
|
fclose($file);
|
||||||
if ($errr || in_array(0,$lignes)) {
|
if ($errr || in_array(0,$lignes)) {
|
||||||
$err->raise("hta",1);
|
$err->raise("hta",_("An incompatible .htaccess file exists in this folder."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -181,7 +181,7 @@ class m_quota {
|
||||||
// Now we check that the value has been written properly :
|
// Now we check that the value has been written properly :
|
||||||
exec("/usr/lib/alternc/quota_get $cuid &> /dev/null &",$a);
|
exec("/usr/lib/alternc/quota_get $cuid &> /dev/null &",$a);
|
||||||
if ($size!=$a[1]) {
|
if ($size!=$a[1]) {
|
||||||
$err->raise("quota",1);
|
$err->raise("quota",_("Error writing the quota entry !"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue