Commit 62dde928 authored by Alan Garcia's avatar Alan Garcia
Browse files

Cosmetic

parent 02f735ec
......@@ -308,10 +308,12 @@ function getuserpath($user = null) {
*/
function cbox($test, $echo = TRUE) {
if ($test) {
$return = " checked=\"checked\"";
$return = " checked=\"checked\"";
} else {
$return='';
}
if( $echo ){
echo $return;
echo $return;
}
return $return;
}
......@@ -327,10 +329,12 @@ function cbox($test, $echo = TRUE) {
*/
function selected($bool, $echo = TRUE) {
if ($bool) {
$return = " selected=\"selected\"";
$return = " selected=\"selected\"";
} else {
$return='';
}
if( $echo ){
echo $return;
echo $return;
}
return $return;
}
......@@ -851,7 +855,7 @@ function display_browser($dir="", $caller="main.dir", $width=350, $height=450) {
document.write('&nbsp;<input type=\"button\" id=\"bt".$bid."\" value=\""._("Choose a folder...")."\" class=\"ina\">');
document.write('<div id=\"".$bid."\" title=\""._("Choose a folder...")."\" style=\"display: none; bgcolor:red;\">');
document.write(' <iframe src=\"/browseforfolder2.php?caller=".$caller."&amp;file=".ehe($dir, 0)."&amp;bid=".$bid."\" width=\"".($width-40)."\" height=\"".($height-64)."\" frameborder=\"no\" id=\"browseiframe\"></iframe>');
document.write(' <iframe src=\"/browseforfolder2.php?caller=".$caller."&amp;file=".ehe($dir, false)."&amp;bid=".$bid."\" width=\"".($width-40)."\" height=\"".($height-64)."\" frameborder=\"no\" id=\"browseiframe\"></iframe>');
document.write('</div>');
// -->
</script>
......
......@@ -251,7 +251,6 @@ class m_authip {
*/
function get_auth_class() {
global $hooks;
$authclass=array();
$authclass = $hooks->invoke('authip_class');
// Je rajoute la class DANS l'objet parce que
......
......@@ -182,7 +182,7 @@ class m_bro {
global $db,$cuid,$err;
$db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';");
$absolute=$this->convertabsolute($dir,0);
if (! file_exists($absolute)) {
if (!$absolute || !file_exists($absolute)) {
$err->raise('bro',_("This directory do not exist"));
return false;
}
......@@ -239,11 +239,11 @@ class m_bro {
$listmode=intval($listmode); $showicons=intval($showicons);
$showtype=intval($showtype); $downfmt=intval($downfmt);
$createfile=intval($createfile); $golastdir=intval($golastdir);
$db->query("SELECT * FROM browser WHERE uid='$cuid';");
$db->query("SELECT * FROM browser WHERE uid='".intval($cuid)."';");
if ($db->num_rows()==0) {
$db->query("INSERT INTO browser (editsizex, editsizey, listmode, showicons, downfmt, createfile, showtype, uid, editor_font, editor_size, golastdir) VALUES (70, 21, 0, 0, 0, 0, 0, '".$this->uid."','Arial, Helvetica, Sans-serif','12px',1);");
$db->query("INSERT INTO browser (editsizex, editsizey, listmode, showicons, downfmt, createfile, showtype, uid, editor_font, editor_size, golastdir) VALUES (70, 21, 0, 0, 0, 0, 0, '".intval($cuid)."','Arial, Helvetica, Sans-serif','12px',1);");
}
$db->query("UPDATE browser SET editsizex='$editsizex', editsizey='$editsizey', listmode='$listmode', showicons='$showicons', downfmt='$downfmt', createfile='$createfile', showtype='$showtype', editor_font='$editor_font', editor_size='$editor_size', golastdir='$golastdir' WHERE uid='$cuid';");
$db->query("UPDATE browser SET editsizex='$editsizex', editsizey='$editsizey', listmode='$listmode', showicons='$showicons', downfmt='$downfmt', createfile='$createfile', showtype='$showtype', editor_font='$editor_font', editor_size='$editor_size', golastdir='$golastdir' WHERE uid='".intval($cuid)."';");
return true;
}
......@@ -721,11 +721,11 @@ class m_bro {
function content($R,$file) {
global $err;
$absolute=$this->convertabsolute($R,0);
$std="";
if (!strpos($file,"/")) {
$absolute.="/".$file;
if (file_exists($absolute)) {
$std=str_replace("<","&lt;",str_replace("&","&amp;",file_get_contents($absolute)));
return $std;
} else {
$err->raise("bro",_("Cannot read the requested file. Please check the permissions"));
return false;
......@@ -734,7 +734,6 @@ class m_bro {
$err->raise("bro",_("File or folder name is incorrect"));
return false;
}
return $std;
}
......@@ -970,7 +969,7 @@ class m_bro {
header("Content-Disposition: attachment; filename=".$mem->user["login"].".zip");
header("Content-Type: application/x-zip");
header("Content-Transfer-Encoding: binary");
$d=escapeshellarg($this->convertabsolute($dir,0));
$d=escapeshellarg($this->convertabsolute($dir,false));
set_time_limit(0);
passthru("/usr/bin/zip -r - $d");
}
......@@ -1020,7 +1019,7 @@ class m_bro {
global $db,$err;
$err->log("bro","export_conf");
$str="<table border=\"1\"><caption> Browser </caption>\n";
$str=" <browser>\n";
$str.=" <browser>\n";
$pref=$this->GetPrefs();
$i=1;
......
......@@ -11,7 +11,6 @@ Class m_export {
function export_conf(){
global $hooks;
$conf = array();
$conf=$hooks->invoke('alternc_export_conf');
return $conf;
}
......
......@@ -271,7 +271,6 @@ class m_ftp {
$err->raise("ftp",_("The chosen prefix is not allowed"));
return false;
}
$lo=$mem->user["login"];
$full_login=$prefixe;
if ($login) $full_login.="_".$login;
......@@ -362,7 +361,6 @@ class m_ftp {
}
$db->query("SELECT login FROM membres WHERE uid='$cuid';");
$db->next_record();
$lo=$db->f("login");
$absolute=getuserpath()."/$dir";
if (!file_exists($absolute)) {
system("/bin/mkdir -p $absolute"); // FIXME replace with action
......@@ -397,7 +395,6 @@ class m_ftp {
function is_ftp($dir) {
global $mem,$db,$err;
$err->log("ftp","is_ftp",$dir);
$lo=$mem->user["login"];
if (substr($dir,0,1)=="/") $dir=substr($dir,1);
$db->query("SELECT id FROM ftpusers WHERE homedir='".getuserpath()."/$dir';");
if ($db->num_rows()) {
......
......@@ -88,7 +88,7 @@ class m_hooks {
// First, build the list of script we want to launch
$to_launch=array();
if (is_file($scripts)) {
if (is_executable($script)) {
if (is_executable($scripts)) {
$to_launch[]=$scripts;
}
} else if (is_dir($scripts)) {
......
......@@ -147,11 +147,9 @@ class m_hta {
global $mem,$err;
$err->log("hta","is_protected",$dir);
$absolute=ALTERNC_HTML."/".substr($mem->user["login"],0,1)."/".$mem->user["login"]."/$dir";
$sortie=array();
if (file_exists("$absolute/.htpasswd")){
return true;
}
else {
} else {
return false;
}
}
......
......@@ -34,7 +34,9 @@ class m_lxc implements vm {
public $IP;
public $KEY;
public $PORT;
public $maxtime;
public $TIMEOUT = 5;
public $error = array();
......@@ -107,7 +109,6 @@ class m_lxc implements vm {
$this->error[] = 'Unable to send data';
return FALSE;
}
$resp = '';
$resp = fgets($fp, 8192);
fclose ($fp);
......@@ -147,14 +148,14 @@ class m_lxc implements vm {
return $this->error;
} else {
$data = unserialize($res);
$error = $data['error'];
$error = (int)$data['error'];
$hostname = $data['hostname'];
$msg = $data['msg'];
$date_start = 'NOW()';
$uid = $mem->user['uid'];
if ((int)$data['error'] != 0) {
$err->raise('lxc', _($data['msg']));
if ($error != 0) {
$err->raise('lxc', _($msg));
return FALSE;
}
$db->query("INSERT INTO vm_history (ip,date_start,uid,serialized_object) VALUES ('$hostname', $date_start, '$uid', '$res')");
......
......@@ -76,6 +76,7 @@ class m_mail {
var $srv_pop3s;
var $cache_domain_mail_size = array();
var $enum_domains=array();
/* ----------------------------------------------------------------- */
/**
* Constructeur
......@@ -674,7 +675,7 @@ ORDER BY
}
}
$db->query("DELETE FROM recipient WHERE address_id=".$mail_id.";");
if ($m) {
if (isset($m) && $m) {
$db->query("INSERT INTO recipient SET address_id=".$mail_id.", recipients='".addslashes($red)."';");
}
return true;
......@@ -738,13 +739,11 @@ ORDER BY
$err->log("mail","export");
$domain=$this->enum_domains();
$str="<mail>\n";
$onepop=false;
foreach ($domain as $d) {
$str.=" <domain>\n <name>".xml_entities($d["domain"])."</name>\n";
$s=$this->enum_domain_mails($d["id"]);
if (count($s)) {
while (list($key,$val)=each($s)){
$test=$this->get_details($val['id']);
$str.=" <address>\n";
$str.=" <name>".xml_entities($val["address"])."</name>\n";
$str.=" <enabled>".xml_entities($val["enabled"])."</enabled>\n";
......
......@@ -486,9 +486,9 @@ Cordially.
$db->next_record();
// un cookie de 20 caractres pour le mail
$COOKIE=substr(md5(uniqid(rand(),1)),0,20);
$COOKIE=substr(md5(uniqid(rand(), true)),0,20);
// et de 6 pour la cl entrer. ca me semble suffisant...
$KEY=substr(md5(uniqid(rand(),1)),0,6);
$KEY=substr(md5(uniqid(rand(), true)),0,6);
$link="https://$L_FQDN/mem_cm.php?usr=$cuid&cookie=$COOKIE";
$txt=sprintf(_("Hello,
......
......@@ -8,6 +8,7 @@ if (!$admin->enabled) {
}
$db->query("SELECT id,hostname FROM stats;");
$d=array();
while ($db->next_record()) {
$d[]=$db->Record;
}
......@@ -16,4 +17,4 @@ foreach ($d as $r) {
$stats->_createconf($r[0],1);
}
?>
\ No newline at end of file
?>
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