/** * CPGscandir() //renamed because php5 has same function as scandir() * * recursive function that scan a directory, create the HTML code for each * picture and add new pictures in an array * * @param $dir the directory to be scanned * @param $expic_array the array that contains pictures already in DB * @param $newpic_array the array that contains new pictures found * @return */ function CPGscandir($dir, &$expic_array) { global $lang_search_new_php, $lang_common, $rowCounter, $icon_array; $dir = str_replace(".", "", $dir); $dir = str_replace('\\\\', '/', $dir); $dir = str_replace('\\', '/', $dir); static $dir_id = 0; static $count = 0; static $pic_id = 0; $pic_array = array(); $dir_array = array(); getfoldercontent($dir, $dir_array, $pic_array, $expic_array); if (count($pic_array) > 0) { $dir_id_str = sprintf("d%04d", $dir_id++); echo dirheader($dir, $dir_id_str); echo <<<EOT <tr> <td class="tablef"> <input type="checkbox" name="checkAll2" onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" /> </td> <td colspan="3" align="right" class="tablef"> <button type="submit" class="button" name="insert" id="submit_button" value="{$lang_search_new_php['insert_selected']}">{$icon_array['ok']}{$lang_search_new_php['insert_selected']}</button> </td> </tr> EOT; foreach ($pic_array as $picture) { $count++; $rowCounter++; $pic_id_str = sprintf("i%04d", $pic_id++); echo picrow($dir . $picture, $pic_id_str, $dir_id_str); } } if (count($dir_array) > 0) { foreach ($dir_array as $directory) { //if (substr($directory,0,1) != ".") // added do not show folders with dots: gaugau 03-11-02 CPGscandir($dir . $directory . DIRECTORY_SEPARATOR, $expic_array); } } return $count; }
/** * CPGscandir() //renamed because php5 has same function as scandir() * * recursive function that scan a directory, create the HTML code for each * picture and add new pictures in an array * * @param $dir the directory to be scanned * @param $expic_array the array that contains pictures already in DB * @param $newpic_array the array that contains new pictures found * @return */ function CPGscandir($dir, &$expic_array) { $dir = str_replace(".", "", $dir); static $dir_id = 0; static $count = 0; static $pic_id = 0; $pic_array = array(); $dir_array = array(); getfoldercontent($dir, $dir_array, $pic_array, $expic_array); if (count($pic_array) > 0) { $dir_id_str = sprintf("d%04d", $dir_id++); echo dirheader($dir, $dir_id_str); foreach ($pic_array as $picture) { $count++; $pic_id_str = sprintf("i%04d", $pic_id++); echo picrow($dir . $picture, $pic_id_str, $dir_id_str); } } if (count($dir_array) > 0) { foreach ($dir_array as $directory) { if (substr($directory, 0, 1) != ".") { // added do not show folders with dots: gaugau 03-11-02 CPGscandir($dir . $directory . '/', $expic_array); } } } return $count; }
/** * scandir() * * recursive function that scan a directory, create the HTML code for each * picture and add new pictures in an array * * @param $dir the directory to be scanned * @param $expic_array the array that contains pictures already in DB * @param $newpic_array the array that contains new pictures found * @return **/ function xcscandir($dir, &$expic_array) { static $dir_id = 0; static $count = 0; static $pic_id = 0; $pic_array = array(); $dir_array = array(); getfoldercontent($dir, $dir_array, $pic_array, $expic_array); if (count($pic_array) > 0) { $dir_id_str = sprintf("d%04d", $dir_id++); echo dirheader($dir, $dir_id_str); foreach ($pic_array as $picture) { $count++; $pic_id_str = sprintf("i%04d", $pic_id++); echo picrow($dir . $picture, $pic_id_str, $dir_id_str); } } if (count($dir_array) > 0) { foreach ($dir_array as $directory) { xcscandir($dir . $directory . '/', $expic_array); } } return $count; }