Commit 8e93341c authored by Alan Garcia's avatar Alan Garcia
Browse files

Some cosmetics

parent e63de8a4
......@@ -51,7 +51,7 @@ if ($newlogin) {
// Add an account
if ($mail->add_slave_account($newlogin,$newpass)) {
$error=_("The requested account address has been created. It is now allowed.");
$newlogin=false;$newpass=false;
$newlogin='';$newpass='';
}
}
......
......@@ -138,7 +138,7 @@ function var_input($infotype, $name, $value='') {
break;
case "boolean":
echo "<input type='hidden' name='$name' value='0' />"; // This way, there is allways something send, even if checkbox is unchecked
echo "<input type='checkbox' id='add_$id' name='$name' value='1' ";cbox($value);echo " />";
echo "<input type='checkbox' id='add_$id' name='$name' value='1' ";cbox((bool)$value);echo " />";
break;
default:
echo "WTF ? Dunno what to do with a ".$infotype['type'];
......
......@@ -143,7 +143,7 @@ class system_bind {
*
* @global m_dom $dom
* @param string $domain
* @return string
* @return array
*/
function get_domain_summary($domain=false) {
global $dom;
......
......@@ -50,7 +50,7 @@ class m_action {
function do_action() {
global $err, $L_INOTIFY_DO_ACTION;
$err->log("action", "do_action");
if( ! touch($L_INOTIFY_DO_ACTION) ){
if( ! @touch($L_INOTIFY_DO_ACTION) ){
return FALSE;
}
return TRUE;
......
......@@ -569,11 +569,11 @@ class m_admin {
* @param int $duration
* @param string $notes
* @param integer $force
* @param boolean $create_dom
* @param string $create_dom
* @param int $db_server_id
* @return boolean Returns FALSE if an error occurs, TRUE if not.
*/
function add_mem($login, $pass, $nom, $prenom, $mail, $canpass=1, $type='default', $duration=0, $notes = "", $force=0, $create_dom=false, $db_server_id) {
function add_mem($login, $pass, $nom, $prenom, $mail, $canpass=1, $type='default', $duration=0, $notes = "", $force=0, $create_dom='', $db_server_id) {
global $err,$quota,$classes,$cuid,$mem,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$hooks,$action;
$err->log("admin","add_mem",$login."/".$mail);
if (!$this->enabled) {
......@@ -1135,7 +1135,7 @@ EOF;
function checkalldom() {
global $db,$L_NS1,$L_NS2,$L_MX,$L_PUBLIC_IP;
$checked=array();
$r=$db->query("SELECT * FROM domaines ORDER BY domaine;");
$db->query("SELECT * FROM domaines ORDER BY domaine;");
$dl=array();
while ($db->next_record()) {
$dl[$db->Record["domaine"]]=$db->Record;
......@@ -1179,10 +1179,14 @@ EOF;
// Check the IP:
$out=array();
exec("dig +short A ".escapeshellarg($d["sub"].(($d["sub"]!="")?".":"").$c["domaine"]),$out);
if (!in_array($L_PUBLIC_IP,$out)) {
$errstr.="subdomain '".$d["sub"]."' don't point to $L_PUBLIC_IP but to ".implode(",",$out)."\n";
$errno=1;
}
if (! is_array($out)) { // exec dig can fail
$errno=1; $errstr.="Fail to get the DNS information. Try again.\n";
} else {
if (!in_array($L_PUBLIC_IP,$out)) {
$errstr.="subdomain '".$d["sub"]."' don't point to $L_PUBLIC_IP but to ".implode(",",$out)."\n";
$errno=1;
}
}
}
}
}
......@@ -1362,7 +1366,6 @@ EOF;
global $db,$classes,$hooks;
$tmp1=array();
$tmp2=array();
$tmp3=array();
$policies=array();
$db->query("SELECT * FROM policy;");
while ($db->next_record()) {
......
......@@ -99,12 +99,12 @@ class m_bro {
* @param string $dir
* @global m_mem $mem
* @param string $dir Dossier absolu que l'on souhaite vérifier
* @param integer $strip
* @param boolean $strip
* @return false|string Retourne le nom du dossier vrifi, relatif au
* dossier de l'utilisateur courant, ventuellement corrig.
* ou FALSE si le dossier n'est pas dans le dossier de l'utilisateur.
*/
function convertabsolute($dir,$strip=1) {
function convertabsolute($dir,$strip=true) {
global $mem;
$root=$this->get_user_root($mem->user["login"]);
// Sauvegarde du chemin de base.
......
......@@ -435,7 +435,7 @@ class m_dom {
$this->lock();
// function add_domain($domain,$dns,$noerase=0,$force=0,$isslave=0,$slavedom="")
if (! $this->add_domain($domain, true, false, 1) ) {
if (! $this->add_domain($domain, true, false, true) ) {
$err->raise('dom', "Error adding domain");
return false;
}
......@@ -652,7 +652,7 @@ class m_dom {
* force ne devrait tre utilis que par le super-admin.
$ @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
*/
function add_domain($domain,$dns,$noerase=0,$force=0,$isslave=0,$slavedom="") {
function add_domain($domain,$dns,$noerase=false,$force=false,$isslave=false,$slavedom="") {
global $db,$err,$quota,$classes,$L_MX,$L_FQDN,$tld,$cuid,$bro,$hooks;
$err->log("dom","add_domain",$domain);
......@@ -1608,6 +1608,10 @@ class m_dom {
return $res;
}
/**
*
* @return array
*/
function get_domain_all_summary() {
global $db,$err;
$res=array();
......
......@@ -23,6 +23,9 @@ abstract class AlterncTest extends PHPUnit_Extensions_Database_TestCase
*/
public function loadDataSet($fileList)
{
if (empty($fileList)) {
throw new \Exception("No files specified");
}
if( !is_array($fileList)){
$fileList = array($fileList);
}
......@@ -41,4 +44,4 @@ abstract class AlterncTest extends PHPUnit_Extensions_Database_TestCase
}
\ No newline at end of file
}
......@@ -25,6 +25,8 @@ if ( $nb != 1 ){
}
#we check that for that type only one option is specified
# FIXME je doute que ca fasse un truc pertinent ce morceau
$nb2=0;
foreach($options as $opt => $val){
$nb2=count($options[$opt]);
}
......@@ -61,6 +63,7 @@ function FixQuotaDovecot($conditions){
}
#We construct a sql query to get the mailbox root based on the option.
// FIXME where does $opt come from ??
switch($opt){
case "m":
if (!filter_var($val,FILTER_VALIDATE_EMAIL)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment