juste un test pour vérifier qu'on ne fait pas un opendir d'un truc qui n'existe pas, et correction d'un petit bug (manquait les points pour concat les chaines)

This commit is contained in:
erics 2004-09-10 19:30:08 +00:00
parent 27ae7510fb
commit 94714d0c41

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -62,7 +63,7 @@ if ($_GET["action"] == 'set')
require_once($file); require_once($file);
$obj = new $classname(); $obj = new $classname();
$sql = "delete from ".MAIN_DB_PREFIX."expedition_methode where rowid = "$obj->id";"; $sql = "delete from ".MAIN_DB_PREFIX."expedition_methode where rowid = ".$obj->id.";";
$db->query($sql); $db->query($sql);
$sql=''; $sql='';
$sql = "insert into ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,status) VALUES (".$obj->id.",'".$obj->code."','".$obj->name."','".addslashes($obj->description)."',".$_GET["statut"].");"; $sql = "insert into ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,status) VALUES (".$obj->id.",'".$obj->code."','".$obj->name."','".addslashes($obj->description)."',".$_GET["statut"].");";
@ -167,10 +168,11 @@ print '<td align="center" colspan="2">Actif</td>';
print '<td align="center" colspan="2">Défaut</td>'; print '<td align="center" colspan="2">Défaut</td>';
print "</tr>\n"; print "</tr>\n";
$handle=opendir($dir); if(is_dir($dir)) {
$handle=opendir($dir);
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_') if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_')
{ {
$name = substr($file, 19, strlen($file) - 31); $name = substr($file, 19, strlen($file) - 31);
@ -218,9 +220,13 @@ while (($file = readdir($handle))!==false)
print '</td></tr>'; print '</td></tr>';
} }
}
closedir($handle);
}
else
{
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
} }
closedir($handle);
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -240,10 +246,11 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$handle=opendir($dir); if(is_dir($dir)) {
$handle=opendir($dir);
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_') if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
{ {
$name = substr($file, 15, strlen($file) - 27); $name = substr($file, 15, strlen($file) - 27);
@ -289,9 +296,13 @@ while (($file = readdir($handle))!==false)
print '</td></tr>'; print '</td></tr>';
} }
}
closedir($handle);
}
else
{
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
} }
closedir($handle);
print '</table>'; print '</table>';
/* /*