123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?php
-
- if ($_GET['action']=="exit_slideshow")
- {
- $_SESSION["image_files_only"]=null;
- unset($image_files_only);
- }
- $array_to_search = (is_array($docs_and_folders))?$docs_and_folders:array();
- if(count($array_to_search) > 0) {
- while(list ($key) = each ($array_to_search))
- {
- $all_files[] = basename($array_to_search[$key]['path']);
-
- }
- }
- $all_extensions=array();
- $image_present=0;
- if ( count($all_files) > 0 )
- {
- foreach ($all_files as $file)
- {
- $slideshow_extension=strrchr($file,".");
- $slideshow_extension=strtolower($slideshow_extension);
- $all_extensions[]=$slideshow_extension;
- if ($slideshow_extension==".jpg" OR $slideshow_extension==".jpeg" OR $slideshow_extension==".gif" or $slideshow_extension==".png")
- {
- $image_present=1;
- $image_files_only[]=$file;
- }
- }
- }
- $tablename_column = $_GET['tablename_column'];
- if($tablename_column==0){
- $tablename_column=1;
- }
- else{
- $tablename_column= intval($tablename_column)-1;
- }
- $tablename_direction = $_GET['tablename_direction'];
- $image_files_only = sort_files($array_to_search);
- $_SESSION["image_files_only"] = $image_files_only;
- function sort_files($table){
-
- global $tablename_direction;
- $temp=array();
-
- foreach($table as $file_array){
- if($file_array['filetype']=='file'){
- $temp[] = array('file', $file_array['title'], $file_array['size'], $file_array['insert_date']);
- }
- }
-
- usort($temp, 'sort_table');
- if($tablename_direction == 'DESC'){
- rsort($temp);
- }
-
- $final_array=array();
- foreach($temp as $file_array){
- $final_array[] = $file_array[1];
- }
-
- return $final_array;
-
- }
- function sort_table($a, $b)
- {
- global $tablename_column;
- if($a[$tablename_column] > $b[$tablename_column]){
- return 1;
- }
- else{
- return -1;
- }
- }
-
- ?>
|