all error messages are now NOT ending by '.' and using correct capitalization. can't has been replaced by cannot, no 'I' talking about AlternC.

This commit is contained in:
Benjamin Sonntag 2012-10-18 07:52:54 +00:00
parent e865f4e906
commit 69d8e4f408
9 changed files with 57 additions and 66 deletions

View File

@ -216,22 +216,22 @@ class m_admin {
$from=trim($from);
if (empty($subject) || empty($message) || empty($from) ){
$err->raise("admin",_("The password is too long according to the password policy"));
$err->raise("admin",_("Subject, message and sender are mandatory"));
return false;
}
if (checkmail($from) != 0) {
$err->raise("admin",_("The password policy prevents you to use your login name inside your password"));
$err->raise("admin",_("Sender is syntaxically incorrect"));
return false;
}
@set_time_limit(1200);
$db->query("select distinct mail from membres;");
$db->query("SELECT DISTINCT mail FROM membres WHERE mail!='';");
while ($db->next_record()) {
// Can't do BCC due to postfix limitation
// FIXME: use phpmailer, far better for mass-mailing than sendmail (reply-to issue among others)
mail($db->f('mail'), $subject, $message, null, "-f$from");
}
return true;
}
@ -254,7 +254,7 @@ class m_admin {
}
$db=new DB_System();
$db->query("SELECT distinct creator FROM membres WHERE creator <> 0 ORDER BY creator asc;");
$db->query("SELECT DISTINCT creator FROM membres WHERE creator <> 0 ORDER BY creator ASC;");
if ($db->num_rows()) {
while ($db->next_record()) {
$creators[] = $this->get_creator($db->f("creator"));

View File

@ -339,7 +339,7 @@ class m_bro {
#echo "$absolute";
if ($absolute && (!file_exists($absolute))) {
if (!mkdir($absolute,00777,true)) {
$err->raise("bro",_("Cannot create the requested directory. Please check permissions."));
$err->raise("bro",_("Cannot create the requested directory. Please check the permissions"));
return false;
}
$db->query("UPDATE browser SET crff=1 WHERE uid='$cuid';");
@ -367,7 +367,7 @@ class m_bro {
}
if (!file_exists($absolute)) {
if (!@touch($absolute)) {
$err->raise("bro",_("Cannot create the requested file. Please check permissions."));
$err->raise("bro",_("Cannot create the requested file. Please check the permissions"));
return false;
}
}
@ -533,7 +533,7 @@ class m_bro {
exec("sudo /usr/lib/alternc/fixperms.sh -u ".$cuid." -f '".$absolute."/".$_FILES['userfile']['name']."'");
return $absolute."/".$_FILES['userfile']['name'];
} else {
$err->raise("bro",("Cannot create the requested file. Please check permissions."));
$err->raise("bro",("Cannot create the requested file. Please check the permissions"));
return false;
}
} else {
@ -584,7 +584,7 @@ class m_bro {
exec($cmd, $void, $ret);
}
if ($ret) {
$err->raise("bro",_("I can't find a way to extract the file %s, is it an unsupported compressed format?"), $file);
$err->raise("bro",_("I cannot find a way to extract the file %s, it is an unsupported compressed format"), $file);
}
// fix the perms of the extracted archive TODO: does it work???
exec("sudo /usr/lib/alternc/fixperms.sh -u ".$cuid." -d ".$dest_to_fix);
@ -688,7 +688,7 @@ class m_bro {
if (file_exists($absolute)) {
$std=str_replace("<","&lt;",str_replace("&","&amp;",file_get_contents($absolute)));
} else {
$err->raise("bro",_("Cannot read the requested file. Please check permissions."));
$err->raise("bro",_("Cannot read the requested file. Please check the permissions"));
return false;
}
} else {
@ -856,7 +856,7 @@ class m_bro {
fputs($f,$texte,strlen($texte));
fclose($f);
} else {
$err->raise("bro",("Cannot edit the requested file. Please check permissions."));
$err->raise("bro",("Cannot edit the requested file. Please check the permissions"));
return false;
}
}
@ -1001,7 +1001,7 @@ class m_bro {
$dir.="html/";
if(!is_dir($dir)){
if(!mkdir($dir))
$err->raise("bro",_("Cannot create the requested directory. Please check permissions."));
$err->raise("bro",_("Cannot create the requested directory. Please check the permissions"));
}
$timestamp=date("H:i:s");

View File

@ -129,7 +129,7 @@ class m_cron {
if (is_null($id)) { // if a new insert, quotacheck
$q = $quota->getquota("cron");
if ( $q["u"] >= $q["t"] ) {
$err->raise("cron",_("You seems to be over-quota."));
$err->raise("cron",_("You quota of cron entries is over. You cannot create more cron entries"));
return false;
}
} else { // if not a new insert, check the $cuid

View File

@ -165,7 +165,7 @@ class m_dom {
$id=intval($id);
// The name MUST contain only letter and digits, it's an identifier after all ...
if (!preg_match("#^[a-z0-9]+$#",$name)) {
$err->raise("dom", _("The name MUST contain only letter and digits."));
$err->raise("dom", _("The name MUST contain only letter and digits"));
return false;
}
$name=mysql_real_escape_string($name); $description=mysql_real_escape_string($description); $target=mysql_real_escape_string($target);
@ -312,27 +312,27 @@ class m_dom {
}
$db->query("SELECT compte FROM domaines WHERE domaine='$domain';");
if ($db->num_rows()) {
$err->raise("dom",_("The domain already exist."));
$err->raise("dom",_("The domain already exist"));
return false;
}
$db->query("SELECT compte FROM `sub_domaines` WHERE sub != \"\" AND concat( sub, \".\", domaine )='$domain' OR domaine='$domain';");
if ($db->num_rows()) {
$err->raise("dom",_("The domain already exist."));
$err->raise("dom",_("The domain already exist"));
return false;
}
$this->dns=$this->whois($domain);
if (!$force) {
$v=checkhostallow($domain,$this->dns);
if ($v==-1) {
$err->raise("dom",_("The last member of the domain name is incorrect or cannot be hosted in that server."));
$err->raise("dom",_("The last member of the domain name is incorrect or cannot be hosted in that server"));
return false;
}
if ($dns && $v==-2) {
$err->raise("dom",_("The domain cannot be found in the whois database."));
$err->raise("dom",_("The domain cannot be found in the whois database"));
return false;
}
if ($dns && $v==-3) {
$err->raise("dom",_("The domain cannot be found in the whois database."));
$err->raise("dom",_("The domain cannot be found in the whois database"));
return false;
}
@ -351,7 +351,7 @@ class m_dom {
}
// Check the quota :
if (!$quota->cancreate("dom")) {
$err->raise("dom",_("Your domain quota is over, you cannot create more domain names."));
$err->raise("dom",_("Your domain quota is over, you cannot create more domain names"));
return false;
}
if ($noerase) $noerase="1"; else $noerase="0";
@ -366,7 +366,7 @@ class m_dom {
$db->query("SELECT domaine FROM domaines WHERE compte='$cuid' AND domaine='$slavedom';");
$db->next_record();
if (!$db->Record["domaine"]) {
$err->raise("dom",_("Domain '%s' not found."),$slavedom);
$err->raise("dom",_("Domain '%s' not found"),$slavedom);
$isslave=false;
}
// Point to the master domain :
@ -628,14 +628,14 @@ class m_dom {
} // while
fclose($fp);
} else {
$err->raise("dom",_("The Whois database is unavailable, please try again later."));
$err->raise("dom",_("The Whois database is unavailable, please try again later"));
return false;
}
if ($found) {
return $server;
} else {
$err->raise("dom",_("The domain cannot be found in the whois database."));
$err->raise("dom",_("The domain cannot be found in the Whois database"));
return false;
}
} // whois
@ -717,7 +717,7 @@ class m_dom {
$r["name"]=$dom;
$db->query("SELECT * FROM domaines WHERE compte='$cuid' AND domaine='$dom'");
if ($db->num_rows()==0) {
$err->raise("dom",1,_("Domain '%s' not found."),$dom);
$err->raise("dom",1,_("Domain '%s' not found"),$dom);
return false;
}
$db->next_record();
@ -779,7 +779,7 @@ class m_dom {
}
$db->query("select sd.*, dt.description as type_desc, dt.only_dns from sub_domaines sd, domaines_type dt where compte='$cuid' and domaine='$dom' and sub='$sub' and ( length('$type')=0 or type='$type') and (length('$value')=0 or '$value'=valeur) and upper(dt.name)=upper(sd.type);");
if ($db->num_rows()==0) {
$err->raise("dom",_("The sub-domain does not exist."));
$err->raise("dom",_("The sub-domain does not exist"));
return false;
}
$db->next_record();
@ -811,7 +811,7 @@ class m_dom {
$value="/".$value;
}
if (!checkuserpath($value)) {
$err->raise("dom",_("The folder you entered is incorrect or does not exist."));
$err->raise("dom",_("The folder you entered is incorrect or does not exist"));
return false;
}
return true;
@ -899,12 +899,12 @@ class m_dom {
$fqdn=checkfqdn($sub);
// Special cases : * (all subdomains at once) and '' empty subdomain are allowed.
if (($sub != '*' && $sub!='') && !($fqdn==0 || $fqdn==4)) {
$err->raise("dom",_("There is some forbidden characters in the sub domain (only A-Z 0-9 and - are allowed)."));
$err->raise("dom",_("There is some forbidden characters in the sub domain (only A-Z 0-9 and - are allowed)"));
return false;
}
if (! $this->check_type_value($type,$dest)) {
$err->raise("dom",_("Invalid domain type selected, please check."));
$err->raise("dom",_("Invalid domain type selected, please check"));
return false;
}
@ -937,7 +937,7 @@ class m_dom {
if ($db->f('create_tmpdir')) {
if (! is_dir($dest_root . "/tmp")) {
if(!mkdir($dest_root . "/tmp")){
$err->raise("dom",_("I can't write to the destination folder"));
$err->raise("dom",_("Cannot write to the destination folder"));
}
}
}
@ -946,7 +946,7 @@ class m_dom {
if (! is_dir($dirr)) {
$old = umask(0);
if(!mkdir($dirr,0770,true)){
$err->raise("dom",_("I can't write to the destination folder"));
$err->raise("dom",_("Cannot write to the destination folder"));
}
umask($old);
}
@ -982,7 +982,7 @@ class m_dom {
return false;
}
if (!$r=$this->get_sub_domain_all($dom,$sub,$type)) {
$err->raise("dom",_("The sub-domain does not exist."));
$err->raise("dom",_("The sub-domain does not exist"));
return false;
} else {
$db->query("update sub_domaines set web_action='DELETE' where domaine='$dom' and sub='$sub' and type='$type' and ( length('$value')=0 or valeur='$value') ");
@ -1017,15 +1017,15 @@ class m_dom {
$this->dns=$this->whois($dom);
$v=checkhostallow($dom,$this->dns);
if ($v==-1) {
$err->raise("dom",_("The last member of the domain name is incorrect or cannot be hosted in that server."));
$err->raise("dom",_("The last member of the domain name is incorrect or cannot be hosted in that server"));
return false;
}
if ($dns && $v==-2) {
$err->raise("dom",_("The domain cannot be found in the whois database."));
$err->raise("dom",_("The domain cannot be found in the Whois database"));
return false;
}
if ($dns && $v==-3) {
$err->raise("dom",_("The DNS of this domain do not match the server's DNS. Please change your domain's DNS (you may need to wait 1 day) before you install it again."));
$err->raise("dom",_("The DNS of this domain do not match the server's DNS. Please change your domain's DNS before you install it again"));
return false;
}
}
@ -1050,13 +1050,13 @@ class m_dom {
if ($dns=="0" && $gesmx=="1" && !$force) {
$vmx = $this->checkmx($dom,$mx);
if ($vmx == 1) {
$err->raise("dom",_("There is no MX record pointing to this server, and you are asking us to host the mail here. Please fix your MX DNS pointer."));
$err->raise("dom",_("There is no MX record pointing to this server, and you are asking us to host the mail here. Please fix your MX DNS pointer"));
return false;
}
if ($vmx == 2) {
// Serveur non spécifié parmi les champx mx
$err->raise("dom",_("There is no MX record pointing to this server, and you are asking us to host the mail here. Please fix your MX DNS pointer."));
$err->raise("dom",_("There is no MX record pointing to this server, and you are asking us to host the mail here. Please fix your MX DNS pointer"));
return false;
}
}
@ -1110,7 +1110,7 @@ class m_dom {
function add_slave_ip($ip,$class="32") {
global $db,$err;
if (!checkip($ip)) { // FIXME: replace by filter_var (same for checkfqdn ?
$err->raise("dom",_("The IP address you entered is incorrect."));
$err->raise("dom",_("The IP address you entered is incorrect"));
return false;
}
$class=intval($class);
@ -1134,7 +1134,7 @@ class m_dom {
function del_slave_ip($ip) {
global $db,$err;
if (!checkip($ip)) {
$err->raise("dom",_("The IP address you entered is incorrect."));
$err->raise("dom",_("The IP address you entered is incorrect"));
return false;
}
$db->query("DELETE FROM slaveip WHERE ip='$ip'");

View File

@ -92,7 +92,7 @@ class m_ftp {
}
return $r;
} else {
$err->raise("ftp",_("No ftp account found"));
$err->raise("ftp",_("No FTP account found"));
return false;
}
}
@ -125,7 +125,7 @@ class m_ftp {
);
return $r;
} else {
$err->raise("ftp",_("This ftp account does not exist"));
$err->raise("ftp",_("This FTP account does not exist"));
return false;
}
}
@ -178,7 +178,7 @@ class m_ftp {
$db->query("SELECT count(*) AS cnt FROM ftpusers WHERE id='$id' and uid='$cuid';");
$db->next_record();
if (!$db->f("cnt")) {
$err->raise("ftp",_("This ftp account does not exist"));
$err->raise("ftp",_("This FTP account does not exist"));
return false;
}
$dir=$bro->convertabsolute($dir);
@ -196,7 +196,7 @@ class m_ftp {
$db->query("SELECT COUNT(*) AS cnt FROM ftpusers WHERE id!='$id' AND name='$prefixe$login';");
$db->next_record();
if ($db->f("cnt")) {
$err->raise("ftp",_("This ftp account already exists"));
$err->raise("ftp",_("This FTP account already exists"));
return false;
}
$absolute=getuserpath()."/$dir";
@ -204,7 +204,7 @@ class m_ftp {
system("/bin/mkdir -p $absolute");
}
if (!is_dir($absolute)) {
$err->raise("ftp",_("The directory cannot be created."));
$err->raise("ftp",_("The directory cannot be created"));
return false;
}
if (trim($pass)) {
@ -236,7 +236,7 @@ class m_ftp {
$db->next_record();
$name=$db->f("name");
if (!$name) {
$err->raise("ftp",_("This ftp account does not exist"));
$err->raise("ftp",_("This FTP account does not exist"));
return false;
}
$db->query("DELETE FROM ftpusers WHERE id='$id'");
@ -268,7 +268,7 @@ class m_ftp {
$db->query("SELECT count(*) AS cnt FROM ftpusers WHERE name='".$prefixe.$login."'");
$db->next_record();
if ($db->f("cnt")) {
$err->raise("ftp",_("This ftp account already exists"));
$err->raise("ftp",_("This FTP account already exists"));
return false;
}
$db->query("SELECT login FROM membres WHERE uid='$cuid';");
@ -280,7 +280,7 @@ class m_ftp {
system("/bin/mkdir -p $absolute");
}
if (!is_dir($absolute)) {
$err->raise("ftp",_("The directory cannot be created."));
$err->raise("ftp",_("The directory cannot be created"));
return false;
}
@ -296,7 +296,7 @@ class m_ftp {
$db->query("INSERT INTO ftpusers (name,password, encrypted_password,homedir,uid) VALUES ('".$prefixe.$login."', '', '$encrypted_password', '$absolute', '$cuid')");
return true;
} else {
$err->raise("ftp",_("Your ftp account quota is over. You cannot create more ftp accounts."));
$err->raise("ftp",_("Your FTP account quota is over. You cannot create more ftp accounts"));
return false;
}
}

View File

@ -193,11 +193,11 @@ class m_hta {
return false;
}
if (!@unlink("$dir/.htaccess")) {
$err->raise("hta",printf(_("I cannot delete the file '%s'/.htaccess"),$dir));
$err->raise("hta",printf(_("I cannot delete the file '%s/.htaccess'"),$dir));
return false;
}
if (!@unlink("$dir/.htpasswd")) {
$err->raise("hta",printf(_("I cannot delete the file '%s'/.htpasswd"),$dir));
$err->raise("hta",printf(_("I cannot delete the file '%s/.htpasswd'"),$dir));
return false;
}
return true;
@ -378,8 +378,8 @@ class m_hta {
} //authtype
} // Reading config file
fclose($file);
if ($errr ||  in_array(0,$lignes)) {
$err->raise("hta",_("An incompatible .htaccess file exists in this folder."));
if ($errr || in_array(0,$lignes)) {
$err->raise("hta",_("An incompatible .htaccess file exists in this folder"));
return false;
}
return true;

View File

@ -171,7 +171,7 @@ class m_mail {
FROM (address a LEFT JOIN mailbox m ON m.address_id=a.id) LEFT JOIN recipient r ON r.address_id=a.id, domaines d
WHERE $where AND d.id=a.domain_id AND a.type='' $limit ;");
if (! $db->next_record()) {
$err->raise("mail",_("No mail found for this query"));
$err->raise("mail",_("No email found for this query"));
return false;
}
$res=array();
@ -226,7 +226,7 @@ class m_mail {
// Check the quota:
if (!$quota->cancreate("mail")) {
$err->raise("mail",_("You cannot create email addresses: your quota is over."));
$err->raise("mail",_("You cannot create email addresses: your quota is over"));
return false;
}
// Already exists?
@ -345,11 +345,6 @@ class m_mail {
$err->raise("mail",_("The email %s does not exist, it can't be deleted"),$mail);
return false;
}
#This function is now used to delete mailman specific addres via the del_wrapper function so i'm commenting this part. Don't know if that's the right way tough..
/*if ($db->f("type")!="") { // Technically special : mailman, sympa ...
$err->raise("mail",_("The email %s is special, it can't be deleted"),$mail);
return false;
}*/
if ($db->f("mail_action")!="OK" || ($db->f("islocal") && $db->f("mailbox_action")!="OK")) { // will be deleted soon ...
$err->raise("mail",_("The email %s is already marked for deletion, it can't be deleted"),$mail);
return false;
@ -499,7 +494,7 @@ class m_mail {
}
foreach($this->forbiddenchars as $str) {
if (strpos($me["address"],$str)!==false) {
$err->raise("mail",_("There is forbidden characters in your mail name. You can't make it a POP/IMAP account, you can only use it as redirections to other emails."));
$err->raise("mail",_("There is forbidden characters in your email address. You can't make it a POP/IMAP account, you can only use it as redirection to other emails"));
return false;
break;
}
@ -519,7 +514,7 @@ class m_mail {
if ($islocal) {
if ($quotamb!=0 && $quotamb<(intval($me["used"]/1024/1024)+1)) {
$quotamb=intval($me["used"]/1024/1024)+1;
$err->raise("mail",_("You set a quota smaller than the current mailbox size. Since it's not allowed, we set the quota to the current mailbox size."));
$err->raise("mail",_("You set a quota smaller than the current mailbox size. Since it's not allowed, we set the quota to the current mailbox size"));
}
$db->query("UPDATE mailbox SET quota=".intval($quotamb)." WHERE address_id=".$mail_id.";");
}
@ -675,7 +670,7 @@ class m_mail {
$pass=mysql_escape_string($pass);
$db->query("SELECT * FROM mxaccount WHERE login='$login'");
if ($db->next_record()) {
$err->raise("mail",_("The MX account was not found."));
$err->raise("mail",_("The slave MX account was not found"));
return false;
}
$db->query("INSERT INTO mxaccount (login,pass) VALUES ('$login','$pass')");

View File

@ -277,10 +277,6 @@ class m_piwik {
foreach ($arguments AS $k=>$v)
$url .= sprintf('&%s=%s', urlencode($k), $v); // urlencode($v));
// We are supposed to chose what's enabled on our php instance :-)
// if (! ini_get('allow_url_fopen')==True) {
// $err->raise("piwik",_("Program Error: PHP ini var 'allow_url_fopen' is not allowed"));
//}
echo $url;
$page_content = file_get_contents($url);
if ($page_content === FALSE) {

View File

@ -182,7 +182,7 @@ class m_quota {
// Now we check that the value has been written properly :
exec("/usr/lib/alternc/quota_get $cuid &> /dev/null &",$a);
if ($size!=$a[1]) {
$err->raise("quota",_("Error writing the quota entry !"));
$err->raise("quota",_("Error writing the quota entry!"));
return false;
}
}