From ac6f085ced6a506a4c3362049b24b01b75afb464 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Nov 2006 15:52:17 +0000 Subject: [PATCH] Corrige comptage dans suppression recursive --- htdocs/admin/tools/index.php | 4 +- htdocs/admin/tools/purge.php | 2 +- htdocs/lib/functions.inc.php | 192 +++++++++++++++++------------------ 3 files changed, 99 insertions(+), 99 deletions(-) diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index 6ee91c46e0a..af9a6e2f03f 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -47,7 +47,9 @@ $form = new Form($db); print_fiche_titre($langs->trans("SystemToolsArea"),'','setup'); -print "
"; +//print "
"; +print info_admin($langs->trans("SystemAreaForAdminOnly")).'
'; + if ($message) print $message.'
'; diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 0c2aaafbd62..4f5b9d13a39 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -68,7 +68,7 @@ if ($_POST["action"]=='purge') foreach($filesarray as $key => $value) { //print "x ".$filesarray[$key]['fullname']."
\n"; - $count=dol_delete_dir_recursive($filesarray[$key]['fullname']); + $count+=dol_delete_dir_recursive($filesarray[$key]['fullname']); } } diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index c15111925c8..33efcb2e92a 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -70,7 +70,7 @@ function versioncompare($versionarray1,$versionarray2) if ($operande1 < $operande2) { $ret = -1; break; } if ($operande1 > $operande2) { $ret = 1; break; } $i++; - } + } return $ret; } @@ -143,8 +143,8 @@ function unaccent($str) */ function sanitize_string($str) { - $forbidden_chars_to_underscore=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); - //$forbidden_chars_to_remove=array("(",")"); + $forbidden_chars_to_underscore=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); + //$forbidden_chars_to_remove=array("(",")"); $forbidden_chars_to_remove=array(); return str_replace($forbidden_chars_to_underscore,"_",str_replace($forbidden_chars_to_remove,"",$str)); } @@ -166,14 +166,14 @@ function sanitize_string($str) function dolibarr_syslog($message, $level=LOG_INFO) { global $conf,$user,$langs; - + if ($conf->syslog->enabled) { // Change this to LOg_DEBUG to see all messages on *nix $level_maximum = LOG_INFO; if ($level > $level_maximum) return; - + // Ajout user a la log $login='???'; if (is_object($user) && $user->id) $login=$user->login; @@ -197,7 +197,7 @@ function dolibarr_syslog($message, $level=LOG_INFO) else { //define_syslog_variables(); déjà définit dans master.inc.php - + if (defined("MAIN_SYSLOG_FACILITY") && MAIN_SYSLOG_FACILITY) { $facility = MAIN_SYSLOG_FACILITY; @@ -211,9 +211,9 @@ function dolibarr_syslog($message, $level=LOG_INFO) { $facility = LOG_USER; } - + openlog("dolibarr", LOG_PID | LOG_PERROR, $facility); - + if (! $level) { syslog(LOG_ERR, $message); @@ -222,7 +222,7 @@ function dolibarr_syslog($message, $level=LOG_INFO) { syslog($level, $message); } - + closelog(); } } @@ -245,7 +245,7 @@ function dolibarr_fiche_head($links, $active='0', $title='', $notab=0) { $limittitle=30; print ''; - print + print ((!defined('MAIN_USE_SHORT_TITLE')) || (defined('MAIN_USE_SHORT_TITLE') && MAIN_USE_SHORT_TITLE)) ? dolibarr_trunc($title,$limittitle) : $title; @@ -275,7 +275,7 @@ function dolibarr_fiche_head($links, $active='0', $title='', $notab=0) } print "\n"; - + if (! $notab) print '
'."\n\n"; } @@ -289,11 +289,11 @@ function dolibarr_fiche_head($links, $active='0', $title='', $notab=0) function dolibarr_get_const($db, $name) { $value=''; - + $sql ="SELECT value"; $sql.=" FROM llx_const"; - $sql.=" WHERE name = '$name';"; - $resql=$db->query($sql); + $sql.=" WHERE name = '$name';"; + $resql=$db->query($sql); if ($resql) { $obj=$db->fetch_object($resql); @@ -317,22 +317,22 @@ function dolibarr_get_const($db, $name) function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='') { global $conf; - + $db->begin(); - - if (! $name) + + if (! $name) { dolibarr_print_error("Error: Call to function dolibarr_set_const with wrong parameters"); exit; } - + //dolibarr_syslog("dolibarr_set_const name=$name, value=$value"); - $sql = "DELETE FROM llx_const WHERE name = '$name';"; - $resql=$db->query($sql); - + $sql = "DELETE FROM llx_const WHERE name = '$name';"; + $resql=$db->query($sql); + $sql = "INSERT INTO llx_const(name,value,type,visible,note)"; $sql.= " VALUES ('$name','".addslashes($value)."','$type',$visible,'".addslashes($note)."');"; - $resql=$db->query($sql); + $resql=$db->query($sql); if ($resql) { @@ -382,7 +382,7 @@ function dolibarr_del_const($db, $name) function dolibarr_set_user_page_param($db, &$user, $url='', $tab) { $db->begin(); - + // On efface paramètres anciens $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param"; $sql.= " WHERE fk_user = ".$user->id; @@ -428,7 +428,7 @@ function dolibarr_set_user_page_param($db, &$user, $url='', $tab) function dolibarr_print_ca($ca) { global $langs,$conf; - + if ($ca > 1000) { $cat = round(($ca / 1000),2); @@ -479,7 +479,7 @@ function dolibarr_time_plus_duree($time,$duration_value,$duration_unit) function dolibarr_print_date($time,$format='') { global $conf; - + // Si format non défini, on prend $conf->format_date_text_short if (! $format) $format=$conf->format_date_text_short; @@ -527,22 +527,22 @@ function dolibarr_print_object_info($object) { global $langs; $langs->load("other"); - + if (isset($object->user_creation) && $object->user_creation->fullname) print $langs->trans("CreatedBy")." : " . $object->user_creation->fullname . '
'; if (isset($object->date_creation)) print $langs->trans("DateCreation")." : " . dolibarr_print_date($object->date_creation,"%A %d %B %Y %H:%M:%S") . '
'; - + if (isset($object->user_modification) && $object->user_modification->fullname) print $langs->trans("ModifiedBy")." : " . $object->user_modification->fullname . '
'; - + if (isset($object->date_modification)) print $langs->trans("DateLastModification")." : " . dolibarr_print_date($object->date_modification,"%A %d %B %Y %H:%M:%S") . '
'; - + if (isset($object->user_validation) && $object->user_validation->fullname) print $langs->trans("ValidatedBy")." : " . $object->user_validation->fullname . '
'; - + if (isset($object->date_validation)) print $langs->trans("DateValidation")." : " . dolibarr_print_date($object->date_validation,"%A %d %B %Y %H:%M:%S") . '
'; @@ -694,7 +694,7 @@ function img_statut($num,$alt = "default") if ($num == 1) $alt=$langs->trans("Late"); if ($num == 4) $alt=$langs->trans("Running"); if ($num == 5) $alt=$langs->trans("Closed"); - } + } return ''.$alt.''; } @@ -860,7 +860,7 @@ function img_warning($alt = "default",$float=0) $img=''.$alt.'load("main"); $langs->load("other"); - + $conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; // Si feuille de style en php existe if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php"; - + // Ce DTD est KO car inhibe document.body.scrollTop //print ''; // Ce DTD est OK print ''; print "\nDolibarr Authentification\n"; - + print ''."\n"; - - - + + + print '