JAVASCRIPT » Ajax

  Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg

AJAX & PHP FILE MANAGER - AJAX Script


AJAX & PHP FILE MANAGER API is an application where you can easily manage your server files. This API is a dynamic web based file management system that will allow you to create a user-friendly online document repository. You can use it to browse directories and files on the server and edit, copy, move, delete, search, upload, download files, create and extract archives, create new directories and files, edit images and files, view thumbnails files and much more... AJAX & PHP FILE MANAGER API is similar to the CPANEL FILE MANAGER API, but much more powerfull.  To install this api just copy the main folder to any place on your web server and configure the following configuration files on the config path: config/config.php (click here to see the file) <? $CONFIG[`root_path`] = `../files/exp`; $CONFIG[`root_path_name`] = `root`; $CONFIG[`dir_templates_path`] = `../files/templates/dirs/`; $CONFIG[`dir_templates_path_name`] = `templates`; $CONFIG[`file_templates_path`] = `../files/templates/files/`; $CONFIG[`file_templates_path_name`] = `templates`; if($_GET[`filemanager_type`] == "image") $CONFIG[`uploadExtensions`] = `gif,jpg,png,bmp,tif,tiff,psd,raw`; $CONFIG[`maxuploadsize_MB`] = `15`;//this variable is just a interface variable, but if you really wish to limit the upload size, go to config.file.php file. $CONFIG[`filemanager_homepage`] = `http://www.jplpinto.com/apis/filemanager/`; $CONFIG[`php_log_path`] = ``; $CONFIG[`server_log_path`] = ``; /**************** FILE PERMISSIONS **********************/ $CONFIG[`create_folder_permission`] = true; $CONFIG[`create_doc_permission`] = true; $CONFIG[`upload_permission`] = true; $CONFIG[`cut_permission`] = true; $CONFIG[`copy_permission`] = true; $CONFIG[`delete_permission`] = true; $CONFIG[`rename_permission`] = true; $CONFIG[`zip_permission`] = true; $CONFIG[`unzip_permission`] = true; $CONFIG[`file_edit_permission`] = true; $CONFIG[`image_edit_permission`] = true; $CONFIG[`search_permission`] = true; $CONFIG[`file_download_permission`] = true; /********************************************************/ $CONFIG[`show_tools_without_perms`] = true; $CONFIG[`chmod_available`] = false; ?> config/config.file.php (click here to see the file) <? require_once("../config/config.file.allowed.php"); require_once("../config/config.file.hidden.php"); require_once("../config/config.thumbnails.php"); require_once("../interfacelevel/ImageManager/config.aux.php"); class CONFIGFILE { function isValid($file) { $file_base_name = basename($file); $is_dir = is_dir($file); if(!$is_dir) { $allowed_files_ends_with = CONFIGFILEALLOWED::getAllowedFilesEndsWith(); $size = count($allowed_files_ends_with); if($size > 0) { $is_valid = false; for($i = 0; $i < $size; ++$i) { if(!empty($allowed_files_ends_with[$i])) { $subs = substr($file_base_name,strlen($file_base_name)-strlen($allowed_files_ends_with[$i])); if($subs == $allowed_files_ends_with[$i]) { $is_valid = true; break; } } } if(!$is_valid) return false; } } return CONFIGFILE::isValidAndNotHiddenFile($file); } function isValidAndNotHiddenFile($file) { $file_base_name = basename($file); $is_dir = is_dir($file); if(CONFIGFILEHIDDEN::getHiddenDirFiles() && $is_dir) return false; if(CONFIGFILEHIDDEN::getHiddenAllFilesExceptDirs() && $is_dir) return false; $hidden_files_full_path = CONFIGFILEHIDDEN::getHiddenFilesWithTheFullPath(); $size = count($hidden_files_full_path); for($i = 0; $i < $size; ++$i) { if(!empty($hidden_files_full_path[$i]) && $file == $hidden_files_full_path[$i]) return false; } $hidden_files_base_name = CONFIGFILEHIDDEN::getHiddenFilesWithTheBaseName(); $size = count($hidden_files_base_name); for($i = 0; $i < $size; ++$i) { if(!empty($hidden_files_base_name[$i]) && $file_base_name == $hidden_files_base_name[$i]) return false; } $hidden_files_start_with = CONFIGFILEHIDDEN::getHiddenFilesStartWith(); $hidden_files_start_with[] = CONFIGFILE::getTmpImgEditor(); $hidden_files_start_with[] = CONFIGFILE::getTmpImgThumbnail(); $size = count($hidden_files_start_with); for($i = 0; $i < $size; ++$i) if(!empty($hidden_files_start_with[$i])) { $index = strpos($file_base_name,$hidden_files_start_with[$i]); if(is_numeric($index) && $index == 0) return false; } $hidden_files_ends_with = CONFIGFILEHIDDEN::getHiddenFilesEndsWith(); $size = count($hidden_files_ends_with); for($i = 0; $i < $size; ++$i) if(!empty($hidden_files_ends_with[$i])) { $index = strrpos($file_base_name,$hidden_files_ends_with[$i]); if(is_numeric($index) && $index == strlen($file_base_name)-strlen($hidden_files_ends_with[$i])) return false; } return true; } /*If you don`t wish to limit the upload size, this function needs to return false.*/ function getUploadMaxSizeInBytes() { return 52428800; } function getTmpImgEditor() { return CONFIGIMAGEMANAGER::getTmpImgEditor(); } function getTmpImgThumbnail() { $config = CONFIGTHUMBNAILS::getThumbnailsConfig(); $dirname = dirname($config[`prefix_name`]); return $dirname != `.` && $dirname != `..` && !empty($dirname) ? $dirname : basename($config[`prefix_name`]); } } ?> config/config.file.allowed.php (click here to see the file) <? class CONFIGFILEALLOWED { /* get a files list of the files that will be allowed. Each element of the list must be a text with the end text of the file base name.*/ function getAllowedFilesEndsWith() { $config = array(); if($_GET[`filemanager_type`] == "image") { $config[] = ".gif"; $config[] = ".png"; $config[] = ".tif"; $config[] = ".bmp"; $config[] = ".jpg"; $config[] = ".raw"; } return $config; } } ?> config/config.file.hidden.php (click here to see the file) <? class CONFIGFILEHIDDEN { /* If true, get a files list that aren`t directories or else, get a directory files list.*/ function getHiddenDirFiles() { return false; } /* If true, get a directory files list or else, get a normal files list.*/ function getHiddenAllFilesExceptDirs() { return false; } /* get a files list of the hidden files. Each element of the list must be a text with the file full path.*/ function getHiddenFilesWithTheFullPath() { $config = array(); //$config[] = "../../exp/apagar dir/tool_cut.gif"; return $config; } /* get a files list of the hidden files. Each element of the list must be a text with the file base name.*/ function getHiddenFilesWithTheBaseName() { $config = array(); $config[] = ``; $config[] = `..`; $config[] = `.`; $config[] = `Thumbs.db`; return $config; } /* get a files list of the hidden files. Each element of the list must be a text with the begining text of the file base name.*/ function getHiddenFilesStartWith() { $config = array(); $config[] = ".__zip"; $config[] = ".__unzip"; return $config; } /* get a files list of the hidden files. Each element of the list must be a text with the end text of the file base name.*/ function getHiddenFilesEndsWith() { $config = array(); //$config[] = "png"; return $config; } } ?> config/config.thumbnails.php (click here to see the file) <? class CONFIGTHUMBNAILS { function getThumbnailsConfig() { $config[`prefix_name`] = `.___tmpimgthumbnails/.___tmpimgthumbnail_`; $config[`image_default`] = `../interfacelevel/images/image.gif`; $config[`image_error`] = `../interfacelevel/images/error.gif`; $config[`available_extensions`] = array(`gif`,`jpg`,`jpeg`,`png`); $config[`thumbnail_width`] = 250; $config[`thumbnail_height`] = 250; $config[`file_min_size_in_bytes`] = 1024; return $config; } } ?> The first file contains the general configuration, like the server files root path, the available upload extensions, the user permissions, the apache and php log file and other configurations... The other files contain the configuration of the server files that should be hide and showed. You can configure the hidden and allowed files by the begining, ended or full base or dir name of the file... The `config.thumbnails.php` file contains the configuration of the thumbnails server files, like the thumbnails width and height, the available extensions, the thumbnails prefix name and path and other configurations... It is very important to respect the syntax of the configuration files and not change the functions name.
Hits: 7276

Free   Version: n/a   Platform(s): All   Updated:  January 12, 2008

Developer: Demo Download  
Rated by: 1 user(s)  
Follow Navioo On Twitter

Submit a resource