* */ /** * Class docserver : manage the docservers and the filename in the classment on the docservers * * @author Claire Figueras * @license GPL * @package Maarch LetterBox 2.3 * @version 1.1 */ class docserver { /** * Draw the filename * * @param string $path_template path * @return array filename array */ public function filename($path_template) { // Draw the filename if ($_SESSION['config']['system'] == "true") { // Draw the filename $file_tab = scandir($path_template); array_shift($file_tab); array_shift($file_tab); $nb_files = count($file_tab); if ($nb_files == 0 ) { //LB20060801 rights change : wrx if (!mkdir($path_template."1",0000755)) { $_SESSION['error'] = _FILE_SEND_ERROR.". "._TRY_AGAIN.". "._MORE_INFOS." : ".$_SESSION['config']['adminname'].""; header("location: file_index.php"); exit; } else { //LB20060801 $destination_rept = $path_template."1/"; $file_destination_name = "1"; return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name); } } else { //Get next usable tree for the docserver //LB20060801 $destination_rept = $path_template.count($file_tab)."/"; $file_tab2 = scandir($path_template.strval(count($file_tab))); // delete the . and .. line array_shift($file_tab2); array_shift($file_tab2); $nb_files2 = count($file_tab2); //if number of files => 2000 then we create a new directory if ($nb_files2 >= 2000 ) { $new_rept = ($nb_files) + 1; //LB20060801 rights change : wrx if (!mkdir($path_template.$new_rept,0000755)) { $_SESSION['error'] = _FILE_SEND_ERROR.". "._TRY_AGAIN.". "._MORE_INFOS." : ".$_SESSION['config']['adminname'].""; header("location: file_index.php"); exit; } else { //LB20060801 $destination_rept = $path_template.$new_rept."/"; $file_destination_name = "1"; return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name); } } else { $new_file_name = ($nb_files2) + 1; //echo $destination_rept.$new_file_name."
"; //print_r($file_tab2); //modifs lgi le 18-06-2008 : correction annomalie docserver for($n=0;$n"; if($new_file_name == $current_file_name[0]) { //echo "warning, file already exists".$file_tab2[$n]."
"; $new_file_name ++; } } $file_destination_name = $new_file_name; return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name); } } } else { $file_tab = scandir($path_template); array_shift($file_tab); array_shift($file_tab); $nb_files = count($file_tab); if ($nb_files == 0 ) { if (!mkdir($path_template."1",0000200)) { $_SESSION['error'] = _FILE_SEND_ERROR.". "._TRY_AGAIN.". "._MORE_INFOS." : ".$_SESSION['config']['adminname'].""; header("location: file_index.php"); exit; } else { $destination_rept = $path_template."1\\"; $file_destination_name = "1"; return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name); } } else { //Get next usable tree for the docserver $destination_rept = $path_template.count($file_tab)."\\"; $file_tab2 = scandir($path_template.strval(count($file_tab))); // delete the . and .. line array_shift($file_tab2); array_shift($file_tab2); $nb_files2 = count($file_tab2); //if number of files => 2000 then we create a new directory if ($nb_files2 >= 2000 ) { $new_rept = ($nb_files) + 1; if (!mkdir($path_template.$new_rept,0000755)) { $_SESSION['error'] = _FILE_SEND_ERROR.". "._TRY_AGAIN.". "._MORE_INFOS." : ".$_SESSION['config']['adminname'].""; header("location: file_index.php"); exit; } else { $destination_rept = $path_template.$new_rept."\\"; $file_destination_name = "1"; return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name); } } else { $new_file_name = ($nb_files2) + 1; //echo $destination_rept.$new_file_name."
"; //print_r($file_tab2); //modifs lgi le 18-06-2008 : correction annomalie docserver for($n=0;$n"; if($new_file_name == $current_file_name[0]) { //echo "warning, file already exists".$file_tab2[$n]."
"; $new_file_name ++; } } $file_destination_name = $new_file_name; return array("destination_rept" => $destination_rept, "file_destination_name" => $file_destination_name); } } } } } ?>