Commit 0bf65964 authored by Alan Garcia's avatar Alan Garcia
Browse files

Cosmetic, again

parent 6adef177
......@@ -139,7 +139,6 @@ class m_aws {
function get_stats_details($id) {
global $db,$err,$cuid;
$err->log("aws","get_stats_details",$id);
$r=array();
$db->query("SELECT id, hostname, hostaliases, public FROM aws WHERE uid='$cuid' AND id='$id';");
if ($db->num_rows()) {
$db->next_record();
......@@ -295,7 +294,7 @@ class m_aws {
*/
function put_stats_details($id,$users,$hostaliases,$public) {
global $err,$db,$cuid;
if ($c=$this->get_stats_details($id)) {
if ($this->get_stats_details($id)) {
$this->delete_allowed_login($id, 1);
if (is_array($users)) {
foreach($users as $v) {
......@@ -306,7 +305,9 @@ class m_aws {
$this->_createconf($id);
$this->_createhtpasswd();
return true;
} else return false;
} else {
return false;
}
}
......
......@@ -60,7 +60,7 @@ if ($fatal) {
echo "<div class=\"alert alert-danger\">$error</div>";
} else {
if (!empty($error)) { echo "<p class='alert alert-danger'>$error</p>"; }
if (isset($error) && !empty($error)) { echo "<p class='alert alert-danger'>$error</p>"; }
?>
<table>
......
......@@ -136,7 +136,7 @@ class system_bind {
* @param string $domain
* @return string
*/
function get_zone_header($domain) {
function get_zone_header() {
return file_get_contents($this->ZONE_TEMPLATE);
}
......@@ -315,7 +315,7 @@ class system_bind {
function get_zone($domain) {
global $L_FQDN, $L_NS1_HOSTNAME, $L_NS2_HOSTNAME, $L_DEFAULT_MX, $L_DEFAULT_SECONDARY_MX, $L_PUBLIC_IP;
$zone =$this->get_zone_header($domain);
$zone =$this->get_zone_header();
$zone.=implode("\n",$this->conf_from_db($domain));
$zone.="\n;;;HOOKED ENTRY\n";
......
......@@ -79,6 +79,8 @@ class m_dom {
var $action_delete = "2";
var $tld_no_check_at_all = "1";
var $cache_domains_type_lst=false;
/* ----------------------------------------------------------------- */
/**
* Constructeur
......@@ -148,14 +150,16 @@ class m_dom {
* authoris. Retourne FALSE si une erreur s'est produite.
*/
function domains_type_lst() {
global $db,$err,$cuid;
global $db,$err;
$err->log("dom","domains_type_lst");
$db->query("select * from domaines_type order by advanced;");
$this->domains_type_lst=false;
while ($db->next_record()) {
$this->domains_type_lst[strtolower($db->Record["name"])] = $db->Record;
if (empty($this->cache_domains_type_lst)) {
$db->query("select * from domaines_type order by advanced;");
$this->cache_domains_type_lst=array();
while ($db->next_record()) {
$this->cache_domains_type_lst[strtolower($db->Record["name"])] = $db->Record;
}
}
return $this->domains_type_lst;
return $this->cache_domains_type_lst;
}
function domains_type_enable_values() {
......@@ -405,7 +409,7 @@ class m_dom {
break;
}
// If it is a know domains type
// If it is an unknown domains type
if (! array_key_exists( strtolower($val['type']), $this->domains_type_lst() ) ) {
echo "what is this shit ?\n";
print_r($entry);
......
......@@ -168,7 +168,7 @@ class m_ftp {
$db->next_record();
$regexp="/^".preg_quote(getuserpath(),"/")."\/(.*)$/";
$tr=preg_match($regexp, $db->f("homedir"),$match);
preg_match($regexp, $db->f("homedir"),$match);
$lg=explode("_",$db->f("name"));
if ((!is_array($lg)) || (count($lg)!=2)) {
......@@ -272,7 +272,7 @@ class m_ftp {
return false;
}
$lo=$mem->user["login"];
$l=substr($lo,0,1);
$full_login=$prefixe;
if ($login) $full_login.="_".$login;
if (! $this->check_login($full_login) ) return false;
......@@ -363,10 +363,9 @@ class m_ftp {
$db->query("SELECT login FROM membres WHERE uid='$cuid';");
$db->next_record();
$lo=$db->f("login");
$l=substr($lo,0,1);
$absolute=getuserpath()."/$dir";
if (!file_exists($absolute)) {
system("/bin/mkdir -p $absolute");
system("/bin/mkdir -p $absolute"); // FIXME replace with action
}
if (!is_dir($absolute)) {
$err->raise("ftp",_("The directory cannot be created"));
......@@ -399,7 +398,6 @@ class m_ftp {
global $mem,$db,$err;
$err->log("ftp","is_ftp",$dir);
$lo=$mem->user["login"];
$l=substr($lo,0,1);
if (substr($dir,0,1)=="/") $dir=substr($dir,1);
$db->query("SELECT id FROM ftpusers WHERE homedir='".getuserpath()."/$dir';");
if ($db->num_rows()) {
......
......@@ -158,6 +158,7 @@ class m_mail {
}
function catchall_set($domain_id, $target) {
global $err;
// target :
$target=rtrim($target);
if ( substr_count($target,'@') == 0 ) { // Pas de @
......@@ -885,7 +886,7 @@ ORDER BY
$db->query("SELECT value FROM variable where name='mailname_bounce';");
if (!$db->next_record()) {
$err->raise("mail",_("The email %s does not exist, it can't be deleted"),$mail);
$err->raise("mail",_("Problem: can't create default bounce mail"));
return false;
}
$mailname=$db->f("value");
......
......@@ -219,7 +219,6 @@ class m_mysql {
$err->raise("mysql",_("Database %s not found"),$dbn);
return array("enabled"=>false);
}
$c=array();
$db->next_record();
list($dbu,$dbn)=split_mysql_database_name($db->f("db"));
return array("enabled"=>true,"login"=>$db->f("login"),"db"=>$db->f("db"), "name"=>$dbn,"bck"=>$db->f("bck_mode"), "dir"=>substr($db->f("bck_dir"),strlen($root)), "size"=>$size, "pass"=>$db->f("pass"), "history"=>$db->f("bck_history"), "gzip"=>$db->f("bck_gzip"));
......@@ -604,7 +603,7 @@ class m_mysql {
$dbu=$dbn;
$r=array();
$dbn=str_replace('_','\_',$dbn);
$q=$this->dbus->query("Select * from mysql.db where Db='".$dbn."' and User!='".$cuid."_myadm';");
$this->dbus->query("Select * from mysql.db where Db='".$dbn."' and User!='".$cuid."_myadm';");
if(!$db->num_rows()){
return $r;
......@@ -1073,14 +1072,14 @@ class m_mysql {
$err->log("mysql","export");
$db->query("SELECT login, pass, db, bck_mode, bck_dir, bck_history, bck_gzip FROM db WHERE uid='$cuid';");
if ($db->next_record()) {
$str.=" <sql>\n";
$str =" <sql>\n";
$str.=" <login>".$db->Record["login"]."</login>\n";
$str.=" <pass>".$db->Record["pass"]."</pass>\n";
do {
$filename=$tmpdir."/mysql.".$db->Record["db"].".sql.gz";
$str.=" <database>".($db->Record["db"])."</database>\n";
$str.=" <password>".($db->Record["pass"])."</password>\n";
if ($s["bck_mode"]!=0) {
if ($s["bck_mode"]!=0) { // FIXME what is $s ?
$str.=" <backup-mode>".($db->Record["bck_mode"])."</backup-mode>\n";
$str.=" <backup-dir>".($db->Record["bck_dir"])."</backup-dir>\n";
$str.=" <backup-history>".($db->Record["bck_history"])."</backup-history>\n";
......@@ -1140,7 +1139,6 @@ class m_mysql {
$this->dbus->query("show databases;");
$res=array();
$d=array();
while($this->dbus->next_record()) {
$dbname=$this->dbus->f("Database");
$c=mysql_query("SHOW TABLE STATUS FROM $dbname;");
......
......@@ -157,7 +157,7 @@ class m_quota {
$err->log("quota","getquota",$ressource);
if ($recheck) { // rebuilding quota
$get_quota_cache=null;
$this->quota=array();
$this->quotas=array();
}
if (! empty($get_quota_cache[$cuid]) ) {
// This function is called many time each webpage, so I cache the result
......@@ -346,7 +346,6 @@ class m_quota {
*/
function deltype($type) {
global $db;
$qlist=$this->qlist();
if($db->query("UPDATE membres SET type='default' WHERE type='$type'") &&
$db->query("DELETE FROM defquotas WHERE type='$type'")) {
......
......@@ -26,9 +26,9 @@ require_once ALTERNC_PANEL."/class/functions.php";
// General variables setup
// *********************
if(is_readable('local.sh')){
$configFile = file_get_contents('local.sh', 'r');
$configFile = file_get_contents('local.sh';
} else if(is_readable('local.sh_generic')){
$configFile = file_get_contents('local.sh_generic', 'r');
$configFile = file_get_contents('local.sh_generic');
} else {
throw new Exception("You must provide a local.sh file", 1 );
}
......@@ -88,7 +88,9 @@ if ( is_readable("my.cnf") ) {
$mysqlConfigFile = file("my.cnf");
} else if(is_readable('my.cnf_generic')){
$mysqlConfigFile = file('my.cnf_generic');
}
} else {
throw new Exception("You must provide a my.cnf file", 1 );
}
foreach ($mysqlConfigFile as $line) {
if (preg_match('/^([A-Za-z0-9_]*) *= *"?(.*?)"?$/', trim($line), $matches)) {
......
......@@ -39,7 +39,6 @@ class m_roundcube {
global $db;
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i=2;
$domain="";
if (!empty($_SERVER["HTTP_HOST"])) {
do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
$expl=explode(".",$_SERVER["HTTP_HOST"],$i);
......@@ -79,6 +78,11 @@ class m_roundcube {
// Use cleandb.sh filled by roundcube ? http://trac.roundcube.net/browser/github/bin/cleandb.sh
include_once("/etc/roundcube/debian-db.php");
if (! isset($dbtype)) {
global $err;
$err->raise("roundcube::hook_mail_delete_for_real",_("Problem: missing var in Debian Roundcube configuration file"));
return false;
}
switch ($dbtype) {
case "sqlite":
......@@ -89,7 +93,7 @@ class m_roundcube {
if ($dbport != '') $dbport=":$dbport";
if ($dbserver == '') $dbserver="localhost";
$dbh= new PDO("$dbtype:host=$dbserver;dbname=$dbname;dbport=$dbport", $dbuser, $dbpass);
$rcdb = "$dbtype:$dbuser:$dbpass@$dbserver$dbport/$dbname";
#$rcdb = "$dbtype:$dbuser:$dbpass@$dbserver$dbport/$dbname";
break;
}
......
......@@ -39,7 +39,6 @@ class m_squirrelmail {
global $db;
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i=2;
$domain="";
if (!empty($_SERVER["HTTP_HOST"])) {
do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
$expl=explode(".",$_SERVER["HTTP_HOST"],$i);
......
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