Cosmetics

This commit is contained in:
Alan Garcia 2014-03-27 14:17:02 +00:00
parent 8e93341cd3
commit 0729df438e
2 changed files with 22 additions and 22 deletions

View File

@ -200,7 +200,7 @@ class m_bro {
function filelist($dir="", $showdirsize = false) { function filelist($dir="", $showdirsize = false) {
global $db,$cuid,$err; global $db,$cuid,$err;
$db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';"); $db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';");
$absolute=$this->convertabsolute($dir,0); $absolute=$this->convertabsolute($dir,false);
if (!$absolute || !file_exists($absolute)) { if (!$absolute || !file_exists($absolute)) {
$err->raise('bro',_("This directory do not exist")); $err->raise('bro',_("This directory do not exist"));
return false; return false;
@ -391,7 +391,7 @@ class m_bro {
function CreateDir($dir,$file) { function CreateDir($dir,$file) {
global $db,$cuid,$err; global $db,$cuid,$err;
$file=ssla($file); $file=ssla($file);
$absolute=$this->convertabsolute($dir."/".$file,0); $absolute=$this->convertabsolute($dir."/".$file,false);
#echo "$absolute"; #echo "$absolute";
if ($absolute && (!file_exists($absolute))) { if ($absolute && (!file_exists($absolute))) {
if (!mkdir($absolute,00777,true)) { if (!mkdir($absolute,00777,true)) {
@ -420,7 +420,7 @@ class m_bro {
function CreateFile($dir,$file) { function CreateFile($dir,$file) {
global $db,$err,$cuid; global $db,$err,$cuid;
$file=ssla($file); $file=ssla($file);
$absolute=$this->convertabsolute($dir."/".$file,0); $absolute=$this->convertabsolute($dir."/".$file,false);
if (!$absolute || file_exists($absolute)) { if (!$absolute || file_exists($absolute)) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -448,7 +448,7 @@ class m_bro {
function DeleteFile($file_list,$R) { function DeleteFile($file_list,$R) {
global $err, $mem; global $err, $mem;
$root=realpath(getuserpath()); $root=realpath(getuserpath());
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,false);
if (!$absolute && strpos($root,$absolute) === 0 && strlen($absolute) > (strlen($root)+1) ) { if (!$absolute && strpos($root,$absolute) === 0 && strlen($absolute) > (strlen($root)+1) ) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -474,7 +474,7 @@ class m_bro {
*/ */
function RenameFile($R,$old,$new) { function RenameFile($R,$old,$new) {
global $err; global $err;
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,false);
if (!$absolute) { if (!$absolute) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -508,7 +508,7 @@ class m_bro {
*/ */
function MoveFile($d,$old,$new) { function MoveFile($d,$old,$new) {
global $err; global $err;
$old=$this->convertabsolute($old,0); $old=$this->convertabsolute($old,false);
if (!$old) { if (!$old) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -517,7 +517,7 @@ class m_bro {
if ($new[0] != '/') { if ($new[0] != '/') {
$new = $old . '/' . $new; $new = $old . '/' . $new;
} }
$new = $this->convertabsolute($new,0); $new = $this->convertabsolute($new,false);
if (!$new) { if (!$new) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
@ -548,7 +548,7 @@ class m_bro {
*/ */
function ChangePermissions($R,$d,$perm,$verbose=false) { function ChangePermissions($R,$d,$perm,$verbose=false) {
global $err; global $err;
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,false);
if (!$absolute) { if (!$absolute) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -591,7 +591,7 @@ class m_bro {
*/ */
function UploadFile($R) { function UploadFile($R) {
global $_FILES,$err,$cuid,$action; global $_FILES,$err,$cuid,$action;
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,false);
if (!$absolute) { if (!$absolute) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -647,11 +647,11 @@ class m_bro {
*/ */
function ExtractFile($file, $dest=null) { function ExtractFile($file, $dest=null) {
global $err,$cuid,$mem,$action; global $err,$cuid,$mem,$action;
$file = $this->convertabsolute($file,0); $file = $this->convertabsolute($file,false);
if (is_null($dest)) { if (is_null($dest)) {
$dest = dirname($file); $dest = dirname($file);
} else { } else {
$dest = $this->convertabsolute($dest,0); $dest = $this->convertabsolute($dest,false);
} }
if (!$file || !$dest) { if (!$file || !$dest) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
@ -696,12 +696,12 @@ class m_bro {
*/ */
function CopyFile($d,$old,$new) { function CopyFile($d,$old,$new) {
global $err; global $err;
$old=$this->convertabsolute($old,0); $old=$this->convertabsolute($old,false);
if (!$old) { if (!$old) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
} }
$new=$this->convertabsolute($new,0); $new=$this->convertabsolute($new,false);
if (!$new) { if (!$new) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
return false; return false;
@ -757,7 +757,7 @@ class m_bro {
* @return string Le code HTML ainsi obtenu. * @return string Le code HTML ainsi obtenu.
*/ */
function PathList($path,$action, $justparent=false) { function PathList($path,$action, $justparent=false) {
$path=$this->convertabsolute($path,1); $path=$this->convertabsolute($path,true);
$a=explode("/",$path); $a=explode("/",$path);
if (!is_array($a)) $a=array($a); if (!is_array($a)) $a=array($a);
$c=''; $c='';
@ -789,7 +789,7 @@ class m_bro {
*/ */
function content($R,$file) { function content($R,$file) {
global $err; global $err;
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,false);
if (!strpos($file,"/")) { if (!strpos($file,"/")) {
$absolute.="/".$file; $absolute.="/".$file;
if (file_exists($absolute)) { if (file_exists($absolute)) {
@ -987,7 +987,7 @@ class m_bro {
*/ */
function save($file,$R,$texte) { function save($file,$R,$texte) {
global $err; global $err;
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,false);
if (!strpos($file,"/")) { if (!strpos($file,"/")) {
$absolute.="/".$file; $absolute.="/".$file;
if (file_exists($absolute)) { if (file_exists($absolute)) {
@ -1015,7 +1015,7 @@ class m_bro {
header("Content-Disposition: attachment; filename=".$mem->user["login"].".Z"); header("Content-Disposition: attachment; filename=".$mem->user["login"].".Z");
header("Content-Type: application/x-Z"); header("Content-Type: application/x-Z");
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
$d=escapeshellarg(".".$this->convertabsolute($dir,1)); $d=escapeshellarg(".".$this->convertabsolute($dir,true));
set_time_limit(0); set_time_limit(0);
passthru("/bin/tar -cZ -C ".getuserpath()."/".$mem->user["login"]."/ $d"); passthru("/bin/tar -cZ -C ".getuserpath()."/".$mem->user["login"]."/ $d");
} }
@ -1033,7 +1033,7 @@ class m_bro {
header("Content-Disposition: attachment; filename=".$mem->user["login"].".tgz"); header("Content-Disposition: attachment; filename=".$mem->user["login"].".tgz");
header("Content-Type: application/x-tgz"); header("Content-Type: application/x-tgz");
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
$d=escapeshellarg(".".$this->convertabsolute($dir,1)); $d=escapeshellarg(".".$this->convertabsolute($dir,true));
set_time_limit(0); set_time_limit(0);
passthru("/bin/tar -cz -C ".getuserpath()."/ $d"); passthru("/bin/tar -cz -C ".getuserpath()."/ $d");
} }
@ -1051,7 +1051,7 @@ class m_bro {
header("Content-Disposition: attachment; filename=".$mem->user["login"].".tar.bz2"); header("Content-Disposition: attachment; filename=".$mem->user["login"].".tar.bz2");
header("Content-Type: application/x-bzip2"); header("Content-Type: application/x-bzip2");
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
$d=escapeshellarg(".".$this->convertabsolute($dir,1)); $d=escapeshellarg(".".$this->convertabsolute($dir,true));
set_time_limit(0); set_time_limit(0);
passthru("/bin/tar -cj -C ".getuserpath()."/ $d"); passthru("/bin/tar -cj -C ".getuserpath()."/ $d");
} }

View File

@ -646,9 +646,9 @@ class m_dom {
* appellée lors de l'installation d'un nouveau domaine.</p> * appellée lors de l'installation d'un nouveau domaine.</p>
* *
* @param string $dom nom fqdn du domaine à installer * @param string $dom nom fqdn du domaine à installer
* @param integer $dns 1 ou 0 pour héberger le DNS du domaine ou pas. * @param boolean $dns 1 ou 0 pour héberger le DNS du domaine ou pas.
* @param integer $noerase 1 ou 0 pour rendre le domaine inamovible ou non * @param boolean $noerase 1 ou 0 pour rendre le domaine inamovible ou non
* @param integer $force 1 ou 0, si 1, n'effectue pas les tests de DNS. * @param boolean $force 1 ou 0, si 1, n'effectue pas les tests de DNS.
* force ne devrait être utilisé que par le super-admin. * force ne devrait être utilisé que par le super-admin.
$ @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon. $ @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
*/ */