@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * sysem config setting |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @version 1.0 |
|
| 7 | - * @since 22/April/2007 |
|
| 8 | - * |
|
| 9 | - */ |
|
| 3 | + * sysem config setting |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @version 1.0 |
|
| 7 | + * @since 22/April/2007 |
|
| 8 | + * |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | //FILESYSTEM CONFIG <br> |
| 12 | 12 | define('AJAX_INIT_DONE', true); |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | //FILESYSTEM CONFIG <br> |
| 12 | 12 | define('AJAX_INIT_DONE', true); |
| 13 | -require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php"); |
|
| 13 | +require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."class.auth.php"); |
|
| 14 | 14 | define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration |
| 15 | 15 | |
| 16 | 16 | // Added for phpMyFAQ |
| 17 | 17 | define('PMF_ROOT_DIR', dirname(dirname(dirname(dirname(dirname(__DIR__)))))); |
| 18 | 18 | define('IS_VALID_PHPMYFAQ', null); |
| 19 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
| 19 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
| 20 | 20 | |
| 21 | 21 | if (!isset($_SESSION)) { |
| 22 | 22 | session_start(PMF_Session::PMF_COOKIE_NAME_AUTH); |
@@ -37,48 +37,48 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | //Directories Declarations |
| 39 | 39 | |
| 40 | -define('DIR_AJAX_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR) ; // the path to ajax file manager |
|
| 41 | -define('DIR_AJAX_INC', DIR_AJAX_ROOT . "inc" . DIRECTORY_SEPARATOR); |
|
| 42 | -define('DIR_AJAX_CLASSES', DIR_AJAX_ROOT . "classes" . DIRECTORY_SEPARATOR); |
|
| 43 | -define("DIR_AJAX_LANGS", DIR_AJAX_ROOT . "langs" . DIRECTORY_SEPARATOR); |
|
| 44 | -define('DIR_AJAX_JS', DIR_AJAX_ROOT . 'jscripts' . DIRECTORY_SEPARATOR); |
|
| 45 | -define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS . 'edit_area' . DIRECTORY_SEPARATOR); |
|
| 46 | -define('DIR_LANG', DIR_AJAX_ROOT . 'langs' . DIRECTORY_SEPARATOR); |
|
| 40 | +define('DIR_AJAX_ROOT', dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR); // the path to ajax file manager |
|
| 41 | +define('DIR_AJAX_INC', DIR_AJAX_ROOT."inc".DIRECTORY_SEPARATOR); |
|
| 42 | +define('DIR_AJAX_CLASSES', DIR_AJAX_ROOT."classes".DIRECTORY_SEPARATOR); |
|
| 43 | +define("DIR_AJAX_LANGS", DIR_AJAX_ROOT."langs".DIRECTORY_SEPARATOR); |
|
| 44 | +define('DIR_AJAX_JS', DIR_AJAX_ROOT.'jscripts'.DIRECTORY_SEPARATOR); |
|
| 45 | +define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS.'edit_area'.DIRECTORY_SEPARATOR); |
|
| 46 | +define('DIR_LANG', DIR_AJAX_ROOT.'langs'.DIRECTORY_SEPARATOR); |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | //Class Declarations |
| 50 | -define('CLASS_FILE', DIR_AJAX_INC .'class.file.php'); |
|
| 51 | -define("CLASS_UPLOAD", DIR_AJAX_INC . 'class.upload.php'); |
|
| 52 | -define('CLASS_MANAGER', DIR_AJAX_INC . 'class.manager.php'); |
|
| 53 | -define('CLASS_IMAGE', DIR_AJAX_INC . "class.image.php"); |
|
| 54 | -define('CLASS_HISTORY', DIR_AJAX_INC . "class.history.php"); |
|
| 55 | -define('CLASS_SESSION_ACTION', DIR_AJAX_INC . "class.sessionaction.php"); |
|
| 56 | -define('CLASS_PAGINATION', DIR_AJAX_INC . 'class.pagination.php'); |
|
| 57 | -define('CLASS_SEARCH', DIR_AJAX_INC . "class.search.php"); |
|
| 50 | +define('CLASS_FILE', DIR_AJAX_INC.'class.file.php'); |
|
| 51 | +define("CLASS_UPLOAD", DIR_AJAX_INC.'class.upload.php'); |
|
| 52 | +define('CLASS_MANAGER', DIR_AJAX_INC.'class.manager.php'); |
|
| 53 | +define('CLASS_IMAGE', DIR_AJAX_INC."class.image.php"); |
|
| 54 | +define('CLASS_HISTORY', DIR_AJAX_INC."class.history.php"); |
|
| 55 | +define('CLASS_SESSION_ACTION', DIR_AJAX_INC."class.sessionaction.php"); |
|
| 56 | +define('CLASS_PAGINATION', DIR_AJAX_INC.'class.pagination.php'); |
|
| 57 | +define('CLASS_SEARCH', DIR_AJAX_INC."class.search.php"); |
|
| 58 | 58 | //SCRIPT FILES declarations |
| 59 | -define('SPT_FUNCTION_BASE', DIR_AJAX_INC . 'function.base.php'); |
|
| 59 | +define('SPT_FUNCTION_BASE', DIR_AJAX_INC.'function.base.php'); |
|
| 60 | 60 | //include different config base file according to query string "config" |
| 61 | 61 | $configBaseFileName = 'config.base.php'; |
| 62 | 62 | |
| 63 | -if(CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.' . secureFileName($_GET['config']) . ".php") |
|
| 63 | +if (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)).DIRECTORY_SEPARATOR.'config.'.secureFileName($_GET['config']).".php") |
|
| 64 | 64 | { |
| 65 | - $configBaseFileName = 'config.' . secureFileName($_GET['config']) . ".php"; |
|
| 65 | + $configBaseFileName = 'config.'.secureFileName($_GET['config']).".php"; |
|
| 66 | 66 | } |
| 67 | -require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . $configBaseFileName); |
|
| 67 | +require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.$configBaseFileName); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | -require_once(DIR_AJAX_LANGS . CONFIG_LANG_DEFAULT . ".php"); |
|
| 71 | -require_once(DIR_AJAX_INC . "function.base.php"); |
|
| 70 | +require_once(DIR_AJAX_LANGS.CONFIG_LANG_DEFAULT.".php"); |
|
| 71 | +require_once(DIR_AJAX_INC."function.base.php"); |
|
| 72 | 72 | |
| 73 | -require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.session.php"); |
|
| 73 | +require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."class.session.php"); |
|
| 74 | 74 | $session = new Session(); |
| 75 | 75 | $auth = new Auth(); |
| 76 | 76 | |
| 77 | -if(CONFIG_ACCESS_CONTROL_MODE == 1) |
|
| 77 | +if (CONFIG_ACCESS_CONTROL_MODE == 1) |
|
| 78 | 78 | {//access control enabled |
| 79 | - if(!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE)))) |
|
| 79 | + if (!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE)))) |
|
| 80 | 80 | {// |
| 81 | - header('Location: ' . appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString())); |
|
| 81 | + header('Location: '.appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString())); |
|
| 82 | 82 | exit; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -1,53 +1,53 @@ |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?><?php |
| 7 | 7 | /** |
| 8 | - * the purpose I added this class is to make the file system much flexible |
|
| 9 | - * for customization. |
|
| 10 | - * Actually, this is a kind of interface and you should modify it to fit your system |
|
| 11 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 12 | - * @link www.phpletter.com |
|
| 13 | - * @since 4/August/2007 |
|
| 14 | - */ |
|
| 15 | - class Auth |
|
| 16 | - { |
|
| 17 | - var $__loginIndexInSession = 'ajax_user'; |
|
| 18 | - function __construct() |
|
| 19 | - { |
|
| 8 | + * the purpose I added this class is to make the file system much flexible |
|
| 9 | + * for customization. |
|
| 10 | + * Actually, this is a kind of interface and you should modify it to fit your system |
|
| 11 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 12 | + * @link www.phpletter.com |
|
| 13 | + * @since 4/August/2007 |
|
| 14 | + */ |
|
| 15 | + class Auth |
|
| 16 | + { |
|
| 17 | + var $__loginIndexInSession = 'ajax_user'; |
|
| 18 | + function __construct() |
|
| 19 | + { |
|
| 20 | 20 | |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - function Auth() |
|
| 24 | - { |
|
| 25 | - $this->__construct(); |
|
| 26 | - } |
|
| 27 | - /** |
|
| 28 | - * check if the user has logged |
|
| 29 | - * |
|
| 30 | - * @return boolean |
|
| 31 | - */ |
|
| 32 | - function isLoggedIn() |
|
| 33 | - { |
|
| 34 | - return (!empty($_SESSION[$this->__loginIndexInSession])?true:false); |
|
| 35 | - } |
|
| 36 | - /** |
|
| 37 | - * validate the username & password |
|
| 38 | - * @return boolean |
|
| 39 | - * |
|
| 40 | - */ |
|
| 41 | - function login() |
|
| 42 | - { |
|
| 43 | - if($_POST['username'] == CONFIG_LOGIN_USERNAME && $_POST['password'] == CONFIG_LOGIN_PASSWORD) |
|
| 44 | - { |
|
| 45 | - $_SESSION[$this->__loginIndexInSession] = true; |
|
| 46 | - return true; |
|
| 47 | - }else |
|
| 48 | - { |
|
| 49 | - return false; |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } |
|
| 23 | + function Auth() |
|
| 24 | + { |
|
| 25 | + $this->__construct(); |
|
| 26 | + } |
|
| 27 | + /** |
|
| 28 | + * check if the user has logged |
|
| 29 | + * |
|
| 30 | + * @return boolean |
|
| 31 | + */ |
|
| 32 | + function isLoggedIn() |
|
| 33 | + { |
|
| 34 | + return (!empty($_SESSION[$this->__loginIndexInSession])?true:false); |
|
| 35 | + } |
|
| 36 | + /** |
|
| 37 | + * validate the username & password |
|
| 38 | + * @return boolean |
|
| 39 | + * |
|
| 40 | + */ |
|
| 41 | + function login() |
|
| 42 | + { |
|
| 43 | + if($_POST['username'] == CONFIG_LOGIN_USERNAME && $_POST['password'] == CONFIG_LOGIN_PASSWORD) |
|
| 44 | + { |
|
| 45 | + $_SESSION[$this->__loginIndexInSession] = true; |
|
| 46 | + return true; |
|
| 47 | + }else |
|
| 48 | + { |
|
| 49 | + return false; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | 53 | ?> |
| 54 | 54 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function isLoggedIn() |
| 33 | 33 | { |
| 34 | - return (!empty($_SESSION[$this->__loginIndexInSession])?true:false); |
|
| 34 | + return (!empty($_SESSION[$this->__loginIndexInSession]) ? true : false); |
|
| 35 | 35 | } |
| 36 | 36 | /** |
| 37 | 37 | * validate the username & password |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function login() |
| 42 | 42 | { |
| 43 | - if($_POST['username'] == CONFIG_LOGIN_USERNAME && $_POST['password'] == CONFIG_LOGIN_PASSWORD) |
|
| 43 | + if ($_POST['username'] == CONFIG_LOGIN_USERNAME && $_POST['password'] == CONFIG_LOGIN_PASSWORD) |
|
| 44 | 44 | { |
| 45 | 45 | $_SESSION[$this->__loginIndexInSession] = true; |
| 46 | 46 | return true; |
| 47 | - }else |
|
| 47 | + } else |
|
| 48 | 48 | { |
| 49 | 49 | return false; |
| 50 | 50 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $_SESSION[$this->__loginIndexInSession] = true; |
| 46 | 46 | return true; |
| 47 | - }else |
|
| 47 | + } else |
|
| 48 | 48 | { |
| 49 | 49 | return false; |
| 50 | 50 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - die(); |
|
| 2 | + die(); |
|
| 3 | 3 | ?><pre>Array |
| 4 | 4 | ( |
| 5 | 5 | [currentFolderPath] => ../../../../uploaded/ |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?><?php |
| 7 | - /** |
|
| 8 | - * sysem base config setting |
|
| 9 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 10 | - * @link www.phpletter.com |
|
| 11 | - * @since 1/August/2007 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 7 | + /** |
|
| 8 | + * sysem base config setting |
|
| 9 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 10 | + * @link www.phpletter.com |
|
| 11 | + * @since 1/August/2007 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | error_reporting(E_ALL); |
@@ -18,121 +18,119 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - //Access Control Setting |
|
| 22 | - /** |
|
| 23 | - * turn off => false |
|
| 24 | - * by session => true |
|
| 25 | - */ |
|
| 21 | + //Access Control Setting |
|
| 22 | + /** |
|
| 23 | + * turn off => false |
|
| 24 | + * by session => true |
|
| 25 | + */ |
|
| 26 | 26 | define('CONFIG_ACCESS_CONTROL_MODE', true); |
| 27 | 27 | define("CONFIG_LOGIN_USERNAME", 'sdfgdfgdfgdgfdgsdfsdfg3454dsfb5e'); |
| 28 | 28 | define('CONFIG_LOGIN_PASSWORD', 'ASDF@#%JHGSDFGasdkjfh3812764ksdjfbhkjxcf'); |
| 29 | - define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page |
|
| 29 | + define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page |
|
| 30 | 30 | |
| 31 | - //SYSTEM MODE CONFIG |
|
| 32 | - /** |
|
| 33 | - * turn it on when you have this system for demo purpose |
|
| 34 | - * that means changes made to each image is not physically applied to it |
|
| 35 | - * and all uploaded files/created folders will be removed automatically |
|
| 36 | - */ |
|
| 37 | - define('CONFIG_SYS_DEMO_ENABLE', false); |
|
| 38 | - define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only |
|
| 39 | - define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false |
|
| 31 | + //SYSTEM MODE CONFIG |
|
| 32 | + /** |
|
| 33 | + * turn it on when you have this system for demo purpose |
|
| 34 | + * that means changes made to each image is not physically applied to it |
|
| 35 | + * and all uploaded files/created folders will be removed automatically |
|
| 36 | + */ |
|
| 37 | + define('CONFIG_SYS_DEMO_ENABLE', false); |
|
| 38 | + define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only |
|
| 39 | + define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false |
|
| 40 | 40 | |
| 41 | - //User Permissions |
|
| 42 | - define('CONFIG_OPTIONS_DELETE', true); //disable to delete folder |
|
| 43 | - define('CONFIG_OPTIONS_CUT', true); //disalbe to cut a file/folder |
|
| 44 | - define('CONFIG_OPTIONS_COPY', true); //disable to copy a file/folder |
|
| 45 | - define('CONFIG_OPTIONS_NEWFOLDER', true); //disable to create new folder |
|
| 46 | - define('CONFIG_OPTIONS_RENAME', true); //disable to rename the file/folder |
|
| 47 | - define('CONFIG_OPTIONS_UPLOAD', true); //disable to upload the file |
|
| 48 | - define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor |
|
| 49 | - define('CONFIG_OPTIONS_SEARCH', true); //disable to search documents |
|
| 50 | - //FILESYSTEM CONFIG |
|
| 51 | - /* |
|
| 41 | + //User Permissions |
|
| 42 | + define('CONFIG_OPTIONS_DELETE', true); //disable to delete folder |
|
| 43 | + define('CONFIG_OPTIONS_CUT', true); //disalbe to cut a file/folder |
|
| 44 | + define('CONFIG_OPTIONS_COPY', true); //disable to copy a file/folder |
|
| 45 | + define('CONFIG_OPTIONS_NEWFOLDER', true); //disable to create new folder |
|
| 46 | + define('CONFIG_OPTIONS_RENAME', true); //disable to rename the file/folder |
|
| 47 | + define('CONFIG_OPTIONS_UPLOAD', true); //disable to upload the file |
|
| 48 | + define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor |
|
| 49 | + define('CONFIG_OPTIONS_SEARCH', true); //disable to search documents |
|
| 50 | + //FILESYSTEM CONFIG |
|
| 51 | + /* |
|
| 52 | 52 | * CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to |
| 53 | 53 | and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder |
| 54 | 54 | these two paths accept relative path only, don't use absolute path |
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | - define('CONFIG_SYS_DEFAULT_PATH', '../../../../images/'); //accept relative path only |
|
| 58 | - define('CONFIG_SYS_ROOT_PATH', '../../../../images/'); //accept relative path only |
|
| 59 | - define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name |
|
| 60 | - define("CONFIG_SYS_DIR_SESSION_PATH", '/tmp'); |
|
| 61 | - define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns |
|
| 62 | - /** |
|
| 63 | - * reg => regulare expression |
|
| 64 | - * csv => a list of comma separated file/folder name, (exactly match the specified file/folders) |
|
| 65 | - * list => a list of comma spearated vague file/folder name (partially match the specified file/folders) |
|
| 66 | - * |
|
| 67 | - */ |
|
| 68 | - //more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php |
|
| 69 | - define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple |
|
| 70 | - define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple |
|
| 71 | - define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple |
|
| 72 | - define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple |
|
| 73 | - define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1 |
|
| 57 | + define('CONFIG_SYS_DEFAULT_PATH', '../../../../images/'); //accept relative path only |
|
| 58 | + define('CONFIG_SYS_ROOT_PATH', '../../../../images/'); //accept relative path only |
|
| 59 | + define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name |
|
| 60 | + define("CONFIG_SYS_DIR_SESSION_PATH", '/tmp'); |
|
| 61 | + define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns |
|
| 62 | + /** |
|
| 63 | + * reg => regulare expression |
|
| 64 | + * csv => a list of comma separated file/folder name, (exactly match the specified file/folders) |
|
| 65 | + * list => a list of comma spearated vague file/folder name (partially match the specified file/folders) |
|
| 66 | + * |
|
| 67 | + */ |
|
| 68 | + //more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php |
|
| 69 | + define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple |
|
| 70 | + define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple |
|
| 71 | + define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple |
|
| 72 | + define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple |
|
| 73 | + define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1 |
|
| 74 | 74 | |
| 75 | - //UPLOAD OPTIONS CONFIG |
|
| 76 | - define('CONFIG_UPLOAD_MAXSIZE', 50 * 1024 & 1024 ); //by bytes |
|
| 77 | - //define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes |
|
| 78 | - //define('CONFIG_UPLOAD_VALID_EXTS', 'txt');// |
|
| 75 | + //UPLOAD OPTIONS CONFIG |
|
| 76 | + define('CONFIG_UPLOAD_MAXSIZE', 50 * 1024 & 1024 ); //by bytes |
|
| 77 | + //define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes |
|
| 78 | + //define('CONFIG_UPLOAD_VALID_EXTS', 'txt');// |
|
| 79 | 79 | |
| 80 | - define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid |
|
| 80 | + define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid |
|
| 81 | 81 | |
| 82 | - define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste |
|
| 83 | - define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // |
|
| 84 | - //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// |
|
| 85 | - define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf'); |
|
| 86 | - //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // |
|
| 87 | - define('CONFIG_UPLOAD_INVALID_EXTS', ''); |
|
| 82 | + define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste |
|
| 83 | + define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // |
|
| 84 | + //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// |
|
| 85 | + define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf'); |
|
| 86 | + //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // |
|
| 87 | + define('CONFIG_UPLOAD_INVALID_EXTS', ''); |
|
| 88 | 88 | |
| 89 | - //Preview |
|
| 90 | - define('CONFIG_IMG_THUMBNAIL_MAX_X', 100); |
|
| 91 | - define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100); |
|
| 92 | - define('CONFIG_THICKBOX_MAX_WIDTH', 700); |
|
| 93 | - define('CONFIG_THICKBOX_MAX_HEIGHT', 430); |
|
| 89 | + //Preview |
|
| 90 | + define('CONFIG_IMG_THUMBNAIL_MAX_X', 100); |
|
| 91 | + define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100); |
|
| 92 | + define('CONFIG_THICKBOX_MAX_WIDTH', 700); |
|
| 93 | + define('CONFIG_THICKBOX_MAX_HEIGHT', 430); |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8 |
|
| 98 | - * Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT |
|
| 99 | - * Howerver, some Web Hosts do not have standard php.ini setting |
|
| 100 | - * which you will find the file manager can not locate your files correctly |
|
| 101 | - * if you do have such issue, please change it to fit your system. |
|
| 102 | - * so what should you to do get it |
|
| 103 | - * 1. create a php script file (let's call it document_root.php) |
|
| 104 | - * 2. add the following codes in in |
|
| 105 | - * <?php |
|
| 106 | - * echo dirname(__FILE__); |
|
| 107 | - * ?> |
|
| 108 | - * 3. upload document_root.php to you website root folder which will only be reached when you visit http://www.domain-name.com or http://localhost/ at localhost computer |
|
| 109 | - * 4. run it via http://www.domain-name.com/document_root.php or http://localhost/docuent_root.php if localhost computer, the url has to be exactly like that |
|
| 110 | - * 5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be |
|
| 111 | - * 6. enjoy it |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - * |
|
| 115 | - */ |
|
| 96 | + /** |
|
| 97 | + * CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8 |
|
| 98 | + * Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT |
|
| 99 | + * Howerver, some Web Hosts do not have standard php.ini setting |
|
| 100 | + * which you will find the file manager can not locate your files correctly |
|
| 101 | + * if you do have such issue, please change it to fit your system. |
|
| 102 | + * so what should you to do get it |
|
| 103 | + * 1. create a php script file (let's call it document_root.php) |
|
| 104 | + * 2. add the following codes in in |
|
| 105 | + * <?php |
|
| 106 | + * echo dirname(__FILE__); |
|
| 107 | + * ?> |
|
| 108 | + * 3. upload document_root.php to you website root folder which will only be reached when you visit http://www.domain-name.com or http://localhost/ at localhost computer |
|
| 109 | + * 4. run it via http://www.domain-name.com/document_root.php or http://localhost/docuent_root.php if localhost computer, the url has to be exactly like that |
|
| 110 | + * 5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be |
|
| 111 | + * 6. enjoy it |
|
| 112 | + * |
|
| 113 | + */ |
|
| 116 | 114 | |
| 117 | 115 | |
| 118 | - define('CONFIG_WEBSITE_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']); |
|
| 119 | - //theme related setting |
|
| 120 | - /* |
|
| 116 | + define('CONFIG_WEBSITE_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']); |
|
| 117 | + //theme related setting |
|
| 118 | + /* |
|
| 121 | 119 | * options avaialbe for CONFIG_EDITOR_NAME are: |
| 122 | 120 | stand_alone |
| 123 | 121 | tinymce |
| 124 | 122 | fckeditor |
| 125 | 123 | */ |
| 126 | - //CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8 |
|
| 127 | - define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'tinymce')); |
|
| 128 | - define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default |
|
| 129 | - define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail |
|
| 130 | - define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10); |
|
| 131 | - define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client |
|
| 124 | + //CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8 |
|
| 125 | + define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'tinymce')); |
|
| 126 | + define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default |
|
| 127 | + define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail |
|
| 128 | + define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10); |
|
| 129 | + define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client |
|
| 132 | 130 | |
| 133 | - //General Option Declarations |
|
| 134 | - //LANGAUGAE DECLARATIONNS |
|
| 131 | + //General Option Declarations |
|
| 132 | + //LANGAUGAE DECLARATIONNS |
|
| 135 | 133 | |
| 136 | - define('CONFIG_LANG_INDEX', 'language'); //the index in the session |
|
| 137 | - define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en |
|
| 134 | + define('CONFIG_LANG_INDEX', 'language'); //the index in the session |
|
| 135 | + define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en |
|
| 138 | 136 | ?> |
| 139 | 137 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | define('CONFIG_SYS_DEMO_ENABLE', false); |
| 38 | 38 | define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only |
| 39 | - define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false |
|
| 39 | + define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true); //REMOVE THE thumbnail view if false |
|
| 40 | 40 | |
| 41 | 41 | //User Permissions |
| 42 | 42 | define('CONFIG_OPTIONS_DELETE', true); //disable to delete folder |
| 43 | - define('CONFIG_OPTIONS_CUT', true); //disalbe to cut a file/folder |
|
| 44 | - define('CONFIG_OPTIONS_COPY', true); //disable to copy a file/folder |
|
| 43 | + define('CONFIG_OPTIONS_CUT', true); //disalbe to cut a file/folder |
|
| 44 | + define('CONFIG_OPTIONS_COPY', true); //disable to copy a file/folder |
|
| 45 | 45 | define('CONFIG_OPTIONS_NEWFOLDER', true); //disable to create new folder |
| 46 | 46 | define('CONFIG_OPTIONS_RENAME', true); //disable to rename the file/folder |
| 47 | 47 | define('CONFIG_OPTIONS_UPLOAD', true); //disable to upload the file |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | 57 | define('CONFIG_SYS_DEFAULT_PATH', '../../../../images/'); //accept relative path only |
| 58 | - define('CONFIG_SYS_ROOT_PATH', '../../../../images/'); //accept relative path only |
|
| 58 | + define('CONFIG_SYS_ROOT_PATH', '../../../../images/'); //accept relative path only |
|
| 59 | 59 | define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name |
| 60 | 60 | define("CONFIG_SYS_DIR_SESSION_PATH", '/tmp'); |
| 61 | 61 | define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1 |
| 74 | 74 | |
| 75 | 75 | //UPLOAD OPTIONS CONFIG |
| 76 | - define('CONFIG_UPLOAD_MAXSIZE', 50 * 1024 & 1024 ); //by bytes |
|
| 76 | + define('CONFIG_UPLOAD_MAXSIZE', 50*1024 & 1024); //by bytes |
|
| 77 | 77 | //define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes |
| 78 | 78 | //define('CONFIG_UPLOAD_VALID_EXTS', 'txt');// |
| 79 | 79 | |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | fckeditor |
| 125 | 125 | */ |
| 126 | 126 | //CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8 |
| 127 | - define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'tinymce')); |
|
| 128 | - define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default |
|
| 129 | - define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail |
|
| 127 | + define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor']) ? secureFileName($_GET['editor']) : 'tinymce')); |
|
| 128 | + define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme']) ? secureFileName($_GET['theme']) : 'default')); //change the theme to your custom theme rather than default |
|
| 129 | + define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE ? 'detail' : 'detail')); //thumnail or detail |
|
| 130 | 130 | define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10); |
| 131 | 131 | define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client |
| 132 | 132 | |
@@ -134,5 +134,5 @@ discard block |
||
| 134 | 134 | //LANGAUGAE DECLARATIONNS |
| 135 | 135 | |
| 136 | 136 | define('CONFIG_LANG_INDEX', 'language'); //the index in the session |
| 137 | - define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en |
|
| 137 | + define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG.secureFileName($_GET['language']).'.php') ? secureFileName($_GET['language']) : 'en')); //change it to be your language file base name, such en |
|
| 138 | 138 | ?> |
| 139 | 139 | \ No newline at end of file |
@@ -1,189 +1,189 @@ |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?><?php |
| 7 | - include_once(CLASS_FILE); |
|
| 8 | - require_once(CLASS_SESSION_ACTION); |
|
| 9 | - require_once(CLASS_MANAGER); |
|
| 10 | - class Search |
|
| 11 | - { |
|
| 12 | - var $rootFolder = ''; |
|
| 13 | - var $files = array(); |
|
| 14 | - var $rootFolderInfo = array(); |
|
| 15 | - var $searchkeywords = array( |
|
| 16 | - 'mtime_from'=>'', |
|
| 17 | - 'mtime_to'=>'', |
|
| 18 | - 'name'=>'', |
|
| 19 | - 'size_from'=>'', |
|
| 20 | - 'size_to'=>'', |
|
| 21 | - 'recursive'=>'0', |
|
| 7 | + include_once(CLASS_FILE); |
|
| 8 | + require_once(CLASS_SESSION_ACTION); |
|
| 9 | + require_once(CLASS_MANAGER); |
|
| 10 | + class Search |
|
| 11 | + { |
|
| 12 | + var $rootFolder = ''; |
|
| 13 | + var $files = array(); |
|
| 14 | + var $rootFolderInfo = array(); |
|
| 15 | + var $searchkeywords = array( |
|
| 16 | + 'mtime_from'=>'', |
|
| 17 | + 'mtime_to'=>'', |
|
| 18 | + 'name'=>'', |
|
| 19 | + 'size_from'=>'', |
|
| 20 | + 'size_to'=>'', |
|
| 21 | + 'recursive'=>'0', |
|
| 22 | 22 | |
| 23 | - ); |
|
| 24 | - var $sessionAction = null; |
|
| 25 | - /** |
|
| 26 | - * constructor |
|
| 27 | - * |
|
| 28 | - * @param string $rootFolder |
|
| 29 | - */ |
|
| 30 | - function __construct($rootFolder) |
|
| 31 | - { |
|
| 32 | - $this->rootFolder = $rootFolder; |
|
| 33 | - $this->sessionAction = new SessionAction(); |
|
| 34 | - $objRootFolder = new file($this->rootFolder); |
|
| 35 | - $tem = $objRootFolder->getFileInfo(); |
|
| 36 | - $obj = new manager($this->rootFolder, false); |
|
| 37 | - $obj->setSessionAction($this->sessionAction); |
|
| 38 | - $selectedDocuments = $this->sessionAction->get(); |
|
| 39 | - $fileType = $obj->getFolderInfo($this->rootFolder); |
|
| 23 | + ); |
|
| 24 | + var $sessionAction = null; |
|
| 25 | + /** |
|
| 26 | + * constructor |
|
| 27 | + * |
|
| 28 | + * @param string $rootFolder |
|
| 29 | + */ |
|
| 30 | + function __construct($rootFolder) |
|
| 31 | + { |
|
| 32 | + $this->rootFolder = $rootFolder; |
|
| 33 | + $this->sessionAction = new SessionAction(); |
|
| 34 | + $objRootFolder = new file($this->rootFolder); |
|
| 35 | + $tem = $objRootFolder->getFileInfo(); |
|
| 36 | + $obj = new manager($this->rootFolder, false); |
|
| 37 | + $obj->setSessionAction($this->sessionAction); |
|
| 38 | + $selectedDocuments = $this->sessionAction->get(); |
|
| 39 | + $fileType = $obj->getFolderInfo($this->rootFolder); |
|
| 40 | 40 | |
| 41 | - foreach($fileType as $k=>$v) |
|
| 42 | - { |
|
| 43 | - $tem[$k] = $v; |
|
| 44 | - } |
|
| 41 | + foreach($fileType as $k=>$v) |
|
| 42 | + { |
|
| 43 | + $tem[$k] = $v; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $tem['path'] = backslashToSlash($this->rootFolder); |
|
| 47 | - $tem['type'] = (is_dir($this->rootFolder)?'folder':'file'); |
|
| 48 | - $tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder))); |
|
| 49 | - //$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
|
| 50 | - //$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']); |
|
| 51 | - $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag'); |
|
| 52 | - $tem['url'] = getFileUrl($this->rootFolder); |
|
| 53 | - $tem['friendly_path'] = transformFilePath($this->rootFolder); |
|
| 54 | - $tem['file'] = 0; |
|
| 55 | - $tem['subdir'] = 0; |
|
| 56 | - $manager = null; |
|
| 57 | - $this->rootFolderInfo = $tem; |
|
| 58 | - $tem = null; |
|
| 59 | - } |
|
| 46 | + $tem['path'] = backslashToSlash($this->rootFolder); |
|
| 47 | + $tem['type'] = (is_dir($this->rootFolder)?'folder':'file'); |
|
| 48 | + $tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder))); |
|
| 49 | + //$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
|
| 50 | + //$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']); |
|
| 51 | + $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag'); |
|
| 52 | + $tem['url'] = getFileUrl($this->rootFolder); |
|
| 53 | + $tem['friendly_path'] = transformFilePath($this->rootFolder); |
|
| 54 | + $tem['file'] = 0; |
|
| 55 | + $tem['subdir'] = 0; |
|
| 56 | + $manager = null; |
|
| 57 | + $this->rootFolderInfo = $tem; |
|
| 58 | + $tem = null; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * constructor |
|
| 65 | - * |
|
| 66 | - * @param string $rootFolder |
|
| 67 | - */ |
|
| 68 | - function Search($rootFolder) |
|
| 69 | - { |
|
| 70 | - $this->__construct($rootFolder); |
|
| 71 | - } |
|
| 63 | + /** |
|
| 64 | + * constructor |
|
| 65 | + * |
|
| 66 | + * @param string $rootFolder |
|
| 67 | + */ |
|
| 68 | + function Search($rootFolder) |
|
| 69 | + { |
|
| 70 | + $this->__construct($rootFolder); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * change the search keyword individually |
|
| 75 | - * |
|
| 76 | - * @param string $key |
|
| 77 | - * @param string $value |
|
| 78 | - */ |
|
| 79 | - function addSearchKeyword($key, $value) |
|
| 80 | - { |
|
| 81 | - $this->searchkeywords[$key] = $value; |
|
| 82 | - } |
|
| 83 | - /** |
|
| 84 | - * change the search keywords |
|
| 85 | - * |
|
| 86 | - * @param array $keywords |
|
| 87 | - */ |
|
| 88 | - function addSearchKeywords($keywords) |
|
| 89 | - { |
|
| 90 | - foreach($this->searchkeywords as $k=>$v) |
|
| 91 | - { |
|
| 92 | - if(array_key_exists($k, $keywords) !== false) |
|
| 93 | - { |
|
| 94 | - $this->searchkeywords[$k] = $keywords[$k]; |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - /** |
|
| 99 | - * get the file according to the search keywords |
|
| 100 | - * |
|
| 101 | - */ |
|
| 102 | - function doSearch($baseFolderPath = null) |
|
| 103 | - { |
|
| 73 | + /** |
|
| 74 | + * change the search keyword individually |
|
| 75 | + * |
|
| 76 | + * @param string $key |
|
| 77 | + * @param string $value |
|
| 78 | + */ |
|
| 79 | + function addSearchKeyword($key, $value) |
|
| 80 | + { |
|
| 81 | + $this->searchkeywords[$key] = $value; |
|
| 82 | + } |
|
| 83 | + /** |
|
| 84 | + * change the search keywords |
|
| 85 | + * |
|
| 86 | + * @param array $keywords |
|
| 87 | + */ |
|
| 88 | + function addSearchKeywords($keywords) |
|
| 89 | + { |
|
| 90 | + foreach($this->searchkeywords as $k=>$v) |
|
| 91 | + { |
|
| 92 | + if(array_key_exists($k, $keywords) !== false) |
|
| 93 | + { |
|
| 94 | + $this->searchkeywords[$k] = $keywords[$k]; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + /** |
|
| 99 | + * get the file according to the search keywords |
|
| 100 | + * |
|
| 101 | + */ |
|
| 102 | + function doSearch($baseFolderPath = null) |
|
| 103 | + { |
|
| 104 | 104 | |
| 105 | - $baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath))); |
|
| 105 | + $baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath))); |
|
| 106 | 106 | |
| 107 | - $dirHandler = @opendir($baseFolderPath); |
|
| 108 | - if($dirHandler) |
|
| 109 | - { |
|
| 110 | - while(false !== ($file = readdir($dirHandler))) |
|
| 111 | - { |
|
| 112 | - if($file != '.' && $file != '..') |
|
| 113 | - { |
|
| 114 | - $path = $baseFolderPath . $file; |
|
| 115 | - if(is_file($path)) |
|
| 116 | - { |
|
| 117 | - $isValid = true; |
|
| 107 | + $dirHandler = @opendir($baseFolderPath); |
|
| 108 | + if($dirHandler) |
|
| 109 | + { |
|
| 110 | + while(false !== ($file = readdir($dirHandler))) |
|
| 111 | + { |
|
| 112 | + if($file != '.' && $file != '..') |
|
| 113 | + { |
|
| 114 | + $path = $baseFolderPath . $file; |
|
| 115 | + if(is_file($path)) |
|
| 116 | + { |
|
| 117 | + $isValid = true; |
|
| 118 | 118 | |
| 119 | - $fileTime = @filemtime($path); |
|
| 120 | - $fileSize = @filesize($path); |
|
| 121 | - if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false) |
|
| 122 | - { |
|
| 123 | - $isValid = false; |
|
| 124 | - } |
|
| 125 | - if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from'])) |
|
| 126 | - { |
|
| 127 | - $isValid = false; |
|
| 128 | - } |
|
| 129 | - if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to'])) |
|
| 130 | - { |
|
| 131 | - $isValid = false; |
|
| 132 | - } |
|
| 133 | - if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from'])) |
|
| 134 | - { |
|
| 135 | - $isValid = false; |
|
| 136 | - } |
|
| 137 | - if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to'])) |
|
| 138 | - { |
|
| 139 | - $isValid = false; |
|
| 140 | - } |
|
| 141 | - if($isValid && isListingDocument($path)) |
|
| 142 | - { |
|
| 143 | - $finalPath = $path; |
|
| 144 | - $objFile = new file($finalPath); |
|
| 145 | - $tem = $objFile->getFileInfo(); |
|
| 146 | - $obj = new manager($finalPath, false); |
|
| 147 | - $obj->setSessionAction($this->sessionAction); |
|
| 148 | - $selectedDocuments = $this->sessionAction->get(); |
|
| 149 | - $fileType = $obj->getFileType($finalPath); |
|
| 119 | + $fileTime = @filemtime($path); |
|
| 120 | + $fileSize = @filesize($path); |
|
| 121 | + if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false) |
|
| 122 | + { |
|
| 123 | + $isValid = false; |
|
| 124 | + } |
|
| 125 | + if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from'])) |
|
| 126 | + { |
|
| 127 | + $isValid = false; |
|
| 128 | + } |
|
| 129 | + if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to'])) |
|
| 130 | + { |
|
| 131 | + $isValid = false; |
|
| 132 | + } |
|
| 133 | + if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from'])) |
|
| 134 | + { |
|
| 135 | + $isValid = false; |
|
| 136 | + } |
|
| 137 | + if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to'])) |
|
| 138 | + { |
|
| 139 | + $isValid = false; |
|
| 140 | + } |
|
| 141 | + if($isValid && isListingDocument($path)) |
|
| 142 | + { |
|
| 143 | + $finalPath = $path; |
|
| 144 | + $objFile = new file($finalPath); |
|
| 145 | + $tem = $objFile->getFileInfo(); |
|
| 146 | + $obj = new manager($finalPath, false); |
|
| 147 | + $obj->setSessionAction($this->sessionAction); |
|
| 148 | + $selectedDocuments = $this->sessionAction->get(); |
|
| 149 | + $fileType = $obj->getFileType($finalPath); |
|
| 150 | 150 | |
| 151 | - foreach($fileType as $k=>$v) |
|
| 152 | - { |
|
| 153 | - $tem[$k] = $v; |
|
| 154 | - } |
|
| 151 | + foreach($fileType as $k=>$v) |
|
| 152 | + { |
|
| 153 | + $tem[$k] = $v; |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - $tem['path'] = backslashToSlash($finalPath); |
|
| 157 | - $tem['type'] = (is_dir($finalPath)?'folder':'file'); |
|
| 156 | + $tem['path'] = backslashToSlash($finalPath); |
|
| 157 | + $tem['type'] = (is_dir($finalPath)?'folder':'file'); |
|
| 158 | 158 | /* $tem['size'] = transformFileSize($tem['size']); |
| 159 | 159 | $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
| 160 | 160 | $tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/ |
| 161 | - $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag'); |
|
| 162 | - $tem['url'] = getFileUrl($tem['path']); |
|
| 163 | - $this->rootFolderInfo['file']++; |
|
| 164 | - $manager = null; |
|
| 165 | - $this->files[] = $tem; |
|
| 166 | - $tem = null; |
|
| 167 | - } |
|
| 168 | - }elseif(is_dir($path) && $this->searchkeywords['recursive']) |
|
| 169 | - { |
|
| 170 | - $this->Search($baseFolderPath); |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - } |
|
| 161 | + $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag'); |
|
| 162 | + $tem['url'] = getFileUrl($tem['path']); |
|
| 163 | + $this->rootFolderInfo['file']++; |
|
| 164 | + $manager = null; |
|
| 165 | + $this->files[] = $tem; |
|
| 166 | + $tem = null; |
|
| 167 | + } |
|
| 168 | + }elseif(is_dir($path) && $this->searchkeywords['recursive']) |
|
| 169 | + { |
|
| 170 | + $this->Search($baseFolderPath); |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - function getFoundFiles() |
|
| 179 | - { |
|
| 180 | - return $this->files; |
|
| 181 | - } |
|
| 178 | + function getFoundFiles() |
|
| 179 | + { |
|
| 180 | + return $this->files; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - function getRootFolderInfo() |
|
| 184 | - { |
|
| 183 | + function getRootFolderInfo() |
|
| 184 | + { |
|
| 185 | 185 | |
| 186 | - return $this->rootFolderInfo; |
|
| 187 | - } |
|
| 188 | - } |
|
| 186 | + return $this->rootFolderInfo; |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | 189 | ?> |
| 190 | 190 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | $selectedDocuments = $this->sessionAction->get(); |
| 39 | 39 | $fileType = $obj->getFolderInfo($this->rootFolder); |
| 40 | 40 | |
| 41 | - foreach($fileType as $k=>$v) |
|
| 41 | + foreach ($fileType as $k=>$v) |
|
| 42 | 42 | { |
| 43 | 43 | $tem[$k] = $v; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $tem['path'] = backslashToSlash($this->rootFolder); |
| 47 | - $tem['type'] = (is_dir($this->rootFolder)?'folder':'file'); |
|
| 48 | - $tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder))); |
|
| 47 | + $tem['type'] = (is_dir($this->rootFolder) ? 'folder' : 'file'); |
|
| 48 | + $tem['size'] = (is_dir($this->rootFolder) ? '' : transformFileSize(@filesize($this->rootFolder))); |
|
| 49 | 49 | //$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
| 50 | 50 | //$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']); |
| 51 | - $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag'); |
|
| 51 | + $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false ? ($this->sessionAction->getAction() == "copy" ? 'copyFlag' : 'cutFlag') : 'noFlag'); |
|
| 52 | 52 | $tem['url'] = getFileUrl($this->rootFolder); |
| 53 | 53 | $tem['friendly_path'] = transformFilePath($this->rootFolder); |
| 54 | 54 | $tem['file'] = 0; |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | function addSearchKeywords($keywords) |
| 89 | 89 | { |
| 90 | - foreach($this->searchkeywords as $k=>$v) |
|
| 90 | + foreach ($this->searchkeywords as $k=>$v) |
|
| 91 | 91 | { |
| 92 | - if(array_key_exists($k, $keywords) !== false) |
|
| 92 | + if (array_key_exists($k, $keywords) !== false) |
|
| 93 | 93 | { |
| 94 | 94 | $this->searchkeywords[$k] = $keywords[$k]; |
| 95 | 95 | } |
@@ -102,43 +102,43 @@ discard block |
||
| 102 | 102 | function doSearch($baseFolderPath = null) |
| 103 | 103 | { |
| 104 | 104 | |
| 105 | - $baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath))); |
|
| 105 | + $baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath) ? $this->rootFolder : $baseFolderPath))); |
|
| 106 | 106 | |
| 107 | 107 | $dirHandler = @opendir($baseFolderPath); |
| 108 | - if($dirHandler) |
|
| 108 | + if ($dirHandler) |
|
| 109 | 109 | { |
| 110 | - while(false !== ($file = readdir($dirHandler))) |
|
| 110 | + while (false !== ($file = readdir($dirHandler))) |
|
| 111 | 111 | { |
| 112 | - if($file != '.' && $file != '..') |
|
| 112 | + if ($file != '.' && $file != '..') |
|
| 113 | 113 | { |
| 114 | - $path = $baseFolderPath . $file; |
|
| 115 | - if(is_file($path)) |
|
| 114 | + $path = $baseFolderPath.$file; |
|
| 115 | + if (is_file($path)) |
|
| 116 | 116 | { |
| 117 | 117 | $isValid = true; |
| 118 | 118 | |
| 119 | 119 | $fileTime = @filemtime($path); |
| 120 | 120 | $fileSize = @filesize($path); |
| 121 | - if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false) |
|
| 121 | + if ($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false) |
|
| 122 | 122 | { |
| 123 | 123 | $isValid = false; |
| 124 | 124 | } |
| 125 | - if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from'])) |
|
| 125 | + if ($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from'])) |
|
| 126 | 126 | { |
| 127 | 127 | $isValid = false; |
| 128 | 128 | } |
| 129 | - if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to'])) |
|
| 129 | + if ($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to'])) |
|
| 130 | 130 | { |
| 131 | 131 | $isValid = false; |
| 132 | 132 | } |
| 133 | - if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from'])) |
|
| 133 | + if ($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from'])) |
|
| 134 | 134 | { |
| 135 | 135 | $isValid = false; |
| 136 | 136 | } |
| 137 | - if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to'])) |
|
| 137 | + if ($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to'])) |
|
| 138 | 138 | { |
| 139 | 139 | $isValid = false; |
| 140 | 140 | } |
| 141 | - if($isValid && isListingDocument($path)) |
|
| 141 | + if ($isValid && isListingDocument($path)) |
|
| 142 | 142 | { |
| 143 | 143 | $finalPath = $path; |
| 144 | 144 | $objFile = new file($finalPath); |
@@ -148,24 +148,24 @@ discard block |
||
| 148 | 148 | $selectedDocuments = $this->sessionAction->get(); |
| 149 | 149 | $fileType = $obj->getFileType($finalPath); |
| 150 | 150 | |
| 151 | - foreach($fileType as $k=>$v) |
|
| 151 | + foreach ($fileType as $k=>$v) |
|
| 152 | 152 | { |
| 153 | 153 | $tem[$k] = $v; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $tem['path'] = backslashToSlash($finalPath); |
| 157 | - $tem['type'] = (is_dir($finalPath)?'folder':'file'); |
|
| 157 | + $tem['type'] = (is_dir($finalPath) ? 'folder' : 'file'); |
|
| 158 | 158 | /* $tem['size'] = transformFileSize($tem['size']); |
| 159 | 159 | $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
| 160 | 160 | $tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/ |
| 161 | - $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag'); |
|
| 161 | + $tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false ? ($this->sessionAction->getAction() == "copy" ? 'copyFlag' : 'cutFlag') : 'noFlag'); |
|
| 162 | 162 | $tem['url'] = getFileUrl($tem['path']); |
| 163 | 163 | $this->rootFolderInfo['file']++; |
| 164 | 164 | $manager = null; |
| 165 | 165 | $this->files[] = $tem; |
| 166 | 166 | $tem = null; |
| 167 | 167 | } |
| 168 | - }elseif(is_dir($path) && $this->searchkeywords['recursive']) |
|
| 168 | + }elseif (is_dir($path) && $this->searchkeywords['recursive']) |
|
| 169 | 169 | { |
| 170 | 170 | $this->Search($baseFolderPath); |
| 171 | 171 | } |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | $this->files[] = $tem; |
| 166 | 166 | $tem = null; |
| 167 | 167 | } |
| 168 | - }elseif(is_dir($path) && $this->searchkeywords['recursive']) |
|
| 168 | + } elseif(is_dir($path) && $this->searchkeywords['recursive']) |
|
| 169 | 169 | { |
| 170 | 170 | $this->Search($baseFolderPath); |
| 171 | 171 | } |
@@ -1,98 +1,98 @@ |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?><?php |
| 7 | 7 | /** |
| 8 | - *Session Action Class |
|
| 9 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 10 | - * @link www.phpletter.com |
|
| 11 | - * @since 22/May/2007 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 14 | - class SessionAction |
|
| 15 | - { |
|
| 16 | - var $actionIndex = 'ajax_file_action'; |
|
| 17 | - var $selectedDocIndex = 'ajax_selected_doc'; |
|
| 18 | - var $fromFolderIndex = 'ajax_from_folder'; |
|
| 19 | - function __construct() |
|
| 20 | - { |
|
| 21 | - if(!isset($_SESSION[$this->actionIndex])) |
|
| 22 | - { |
|
| 23 | - $_SESSION[$this->actionIndex] = ''; |
|
| 24 | - } |
|
| 25 | - if(!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex])) |
|
| 26 | - { |
|
| 27 | - $_SESSION[$this->selectedDocIndex] = array(); |
|
| 28 | - } |
|
| 29 | - if(!isset($_SESSION[$this->fromFolderIndex])) |
|
| 30 | - { |
|
| 31 | - $_SESSION[$this->fromFolderIndex] = ''; |
|
| 32 | - } |
|
| 33 | - } |
|
| 8 | + *Session Action Class |
|
| 9 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 10 | + * @link www.phpletter.com |
|
| 11 | + * @since 22/May/2007 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | + class SessionAction |
|
| 15 | + { |
|
| 16 | + var $actionIndex = 'ajax_file_action'; |
|
| 17 | + var $selectedDocIndex = 'ajax_selected_doc'; |
|
| 18 | + var $fromFolderIndex = 'ajax_from_folder'; |
|
| 19 | + function __construct() |
|
| 20 | + { |
|
| 21 | + if(!isset($_SESSION[$this->actionIndex])) |
|
| 22 | + { |
|
| 23 | + $_SESSION[$this->actionIndex] = ''; |
|
| 24 | + } |
|
| 25 | + if(!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex])) |
|
| 26 | + { |
|
| 27 | + $_SESSION[$this->selectedDocIndex] = array(); |
|
| 28 | + } |
|
| 29 | + if(!isset($_SESSION[$this->fromFolderIndex])) |
|
| 30 | + { |
|
| 31 | + $_SESSION[$this->fromFolderIndex] = ''; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - function SessionAction() |
|
| 36 | - { |
|
| 37 | - $this->__construct(); |
|
| 38 | - } |
|
| 39 | - /** |
|
| 40 | - * count the number of selected documents |
|
| 41 | - * |
|
| 42 | - */ |
|
| 43 | - function count() |
|
| 44 | - { |
|
| 45 | - return (isset($_SESSION[$this->selectedDocIndex])?sizeof($_SESSION[$this->selectedDocIndex]):0); |
|
| 46 | - } |
|
| 47 | - /** |
|
| 48 | - * assign the selected documents |
|
| 49 | - * |
|
| 50 | - * @param array $selectedDocuments |
|
| 51 | - */ |
|
| 52 | - function set($selectedDocuments) |
|
| 53 | - { |
|
| 54 | - $_SESSION[$this->selectedDocIndex] = $selectedDocuments; |
|
| 35 | + function SessionAction() |
|
| 36 | + { |
|
| 37 | + $this->__construct(); |
|
| 38 | + } |
|
| 39 | + /** |
|
| 40 | + * count the number of selected documents |
|
| 41 | + * |
|
| 42 | + */ |
|
| 43 | + function count() |
|
| 44 | + { |
|
| 45 | + return (isset($_SESSION[$this->selectedDocIndex])?sizeof($_SESSION[$this->selectedDocIndex]):0); |
|
| 46 | + } |
|
| 47 | + /** |
|
| 48 | + * assign the selected documents |
|
| 49 | + * |
|
| 50 | + * @param array $selectedDocuments |
|
| 51 | + */ |
|
| 52 | + function set($selectedDocuments) |
|
| 53 | + { |
|
| 54 | + $_SESSION[$this->selectedDocIndex] = $selectedDocuments; |
|
| 55 | 55 | |
| 56 | - } |
|
| 57 | - /** |
|
| 58 | - * get the selected documents |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - function get() |
|
| 62 | - { |
|
| 63 | - return (isset($_SESSION[$this->selectedDocIndex])?$_SESSION[$this->selectedDocIndex]:array()); |
|
| 64 | - } |
|
| 56 | + } |
|
| 57 | + /** |
|
| 58 | + * get the selected documents |
|
| 59 | + * @return array |
|
| 60 | + */ |
|
| 61 | + function get() |
|
| 62 | + { |
|
| 63 | + return (isset($_SESSION[$this->selectedDocIndex])?$_SESSION[$this->selectedDocIndex]:array()); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - function setAction($action) |
|
| 67 | - { |
|
| 68 | - $_SESSION[$this->actionIndex] = $action; |
|
| 69 | - } |
|
| 70 | - /** |
|
| 71 | - * get the action |
|
| 72 | - * |
|
| 73 | - * @return unknown |
|
| 74 | - */ |
|
| 75 | - function getAction() |
|
| 76 | - { |
|
| 77 | - return (isset($_SESSION[$this->actionIndex])?$_SESSION[$this->actionIndex]:''); |
|
| 78 | - } |
|
| 79 | - /** |
|
| 80 | - * set the folder |
|
| 81 | - * |
|
| 82 | - * @param string $folder |
|
| 83 | - */ |
|
| 84 | - function setFolder($folder) |
|
| 85 | - { |
|
| 86 | - $_SESSION[$this->fromFolderIndex] = $folder; |
|
| 87 | - } |
|
| 88 | - /** |
|
| 89 | - * get the folder |
|
| 90 | - * |
|
| 91 | - * @return string |
|
| 92 | - */ |
|
| 93 | - function getFolder() |
|
| 94 | - { |
|
| 95 | - return (isset($_SESSION[$this->fromFolderIndex])?$_SESSION[$this->fromFolderIndex]:''); |
|
| 96 | - } |
|
| 97 | - } |
|
| 66 | + function setAction($action) |
|
| 67 | + { |
|
| 68 | + $_SESSION[$this->actionIndex] = $action; |
|
| 69 | + } |
|
| 70 | + /** |
|
| 71 | + * get the action |
|
| 72 | + * |
|
| 73 | + * @return unknown |
|
| 74 | + */ |
|
| 75 | + function getAction() |
|
| 76 | + { |
|
| 77 | + return (isset($_SESSION[$this->actionIndex])?$_SESSION[$this->actionIndex]:''); |
|
| 78 | + } |
|
| 79 | + /** |
|
| 80 | + * set the folder |
|
| 81 | + * |
|
| 82 | + * @param string $folder |
|
| 83 | + */ |
|
| 84 | + function setFolder($folder) |
|
| 85 | + { |
|
| 86 | + $_SESSION[$this->fromFolderIndex] = $folder; |
|
| 87 | + } |
|
| 88 | + /** |
|
| 89 | + * get the folder |
|
| 90 | + * |
|
| 91 | + * @return string |
|
| 92 | + */ |
|
| 93 | + function getFolder() |
|
| 94 | + { |
|
| 95 | + return (isset($_SESSION[$this->fromFolderIndex])?$_SESSION[$this->fromFolderIndex]:''); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | ?> |
| 99 | 99 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | var $fromFolderIndex = 'ajax_from_folder'; |
| 19 | 19 | function __construct() |
| 20 | 20 | { |
| 21 | - if(!isset($_SESSION[$this->actionIndex])) |
|
| 21 | + if (!isset($_SESSION[$this->actionIndex])) |
|
| 22 | 22 | { |
| 23 | 23 | $_SESSION[$this->actionIndex] = ''; |
| 24 | 24 | } |
| 25 | - if(!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex])) |
|
| 25 | + if (!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex])) |
|
| 26 | 26 | { |
| 27 | 27 | $_SESSION[$this->selectedDocIndex] = array(); |
| 28 | 28 | } |
| 29 | - if(!isset($_SESSION[$this->fromFolderIndex])) |
|
| 29 | + if (!isset($_SESSION[$this->fromFolderIndex])) |
|
| 30 | 30 | { |
| 31 | 31 | $_SESSION[$this->fromFolderIndex] = ''; |
| 32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | function count() |
| 44 | 44 | { |
| 45 | - return (isset($_SESSION[$this->selectedDocIndex])?sizeof($_SESSION[$this->selectedDocIndex]):0); |
|
| 45 | + return (isset($_SESSION[$this->selectedDocIndex]) ? sizeof($_SESSION[$this->selectedDocIndex]) : 0); |
|
| 46 | 46 | } |
| 47 | 47 | /** |
| 48 | 48 | * assign the selected documents |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | function get() |
| 62 | 62 | { |
| 63 | - return (isset($_SESSION[$this->selectedDocIndex])?$_SESSION[$this->selectedDocIndex]:array()); |
|
| 63 | + return (isset($_SESSION[$this->selectedDocIndex]) ? $_SESSION[$this->selectedDocIndex] : array()); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | function setAction($action) |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function getAction() |
| 76 | 76 | { |
| 77 | - return (isset($_SESSION[$this->actionIndex])?$_SESSION[$this->actionIndex]:''); |
|
| 77 | + return (isset($_SESSION[$this->actionIndex]) ? $_SESSION[$this->actionIndex] : ''); |
|
| 78 | 78 | } |
| 79 | 79 | /** |
| 80 | 80 | * set the folder |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | function getFolder() |
| 94 | 94 | { |
| 95 | - return (isset($_SESSION[$this->fromFolderIndex])?$_SESSION[$this->fromFolderIndex]:''); |
|
| 95 | + return (isset($_SESSION[$this->fromFolderIndex]) ? $_SESSION[$this->fromFolderIndex] : ''); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | ?> |
| 99 | 99 | \ No newline at end of file |
@@ -1,201 +1,201 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * image save function |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/May/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 2 | + /** |
|
| 3 | + * image save function |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/May/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | - $error = ""; |
|
| 13 | - $info = ""; |
|
| 14 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 15 | - { |
|
| 16 | - $error = SYS_DISABLED; |
|
| 17 | - } |
|
| 18 | - elseif(empty($_POST['path'])) |
|
| 19 | - { |
|
| 20 | - $error = IMG_SAVE_EMPTY_PATH; |
|
| 21 | - }elseif(!file_exists($_POST['path'])) |
|
| 22 | - { |
|
| 23 | - $error = IMG_SAVE_NOT_EXISTS; |
|
| 24 | - }elseif(!isUnderRoot($_POST['path'])) |
|
| 25 | - { |
|
| 26 | - $error = IMG_SAVE_PATH_DISALLOWED; |
|
| 27 | - }elseif(($sessionDir = $session->getSessionDir()) == '') |
|
| 28 | - { |
|
| 29 | - $error = SESSION_PERSONAL_DIR_NOT_FOUND; |
|
| 30 | - } |
|
| 31 | - else |
|
| 32 | - { |
|
| 33 | - require_once(CLASS_HISTORY); |
|
| 34 | - $history = new History($_POST['path'], $session); |
|
| 35 | - if(!empty($_POST['mode'])) |
|
| 36 | - { |
|
| 37 | - //get the original image which is the lastest session image if any when the system is in demo |
|
| 38 | - $lastestSessionImageInfo = $history->getLastestRestorable(); |
|
| 39 | - if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE) |
|
| 40 | - { |
|
| 41 | - $originalSessionImageInfo = $history->getOriginalImage(); |
|
| 42 | - if(sizeof($originalSessionImageInfo)) |
|
| 43 | - { |
|
| 44 | - $originalImage = $sessionDir . $originalSessionImageInfo['info']['name']; |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - if(empty($originalImage)) |
|
| 48 | - { |
|
| 49 | - $originalImage = $_POST['path']; |
|
| 50 | - } |
|
| 12 | + $error = ""; |
|
| 13 | + $info = ""; |
|
| 14 | + if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 15 | + { |
|
| 16 | + $error = SYS_DISABLED; |
|
| 17 | + } |
|
| 18 | + elseif(empty($_POST['path'])) |
|
| 19 | + { |
|
| 20 | + $error = IMG_SAVE_EMPTY_PATH; |
|
| 21 | + }elseif(!file_exists($_POST['path'])) |
|
| 22 | + { |
|
| 23 | + $error = IMG_SAVE_NOT_EXISTS; |
|
| 24 | + }elseif(!isUnderRoot($_POST['path'])) |
|
| 25 | + { |
|
| 26 | + $error = IMG_SAVE_PATH_DISALLOWED; |
|
| 27 | + }elseif(($sessionDir = $session->getSessionDir()) == '') |
|
| 28 | + { |
|
| 29 | + $error = SESSION_PERSONAL_DIR_NOT_FOUND; |
|
| 30 | + } |
|
| 31 | + else |
|
| 32 | + { |
|
| 33 | + require_once(CLASS_HISTORY); |
|
| 34 | + $history = new History($_POST['path'], $session); |
|
| 35 | + if(!empty($_POST['mode'])) |
|
| 36 | + { |
|
| 37 | + //get the original image which is the lastest session image if any when the system is in demo |
|
| 38 | + $lastestSessionImageInfo = $history->getLastestRestorable(); |
|
| 39 | + if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE) |
|
| 40 | + { |
|
| 41 | + $originalSessionImageInfo = $history->getOriginalImage(); |
|
| 42 | + if(sizeof($originalSessionImageInfo)) |
|
| 43 | + { |
|
| 44 | + $originalImage = $sessionDir . $originalSessionImageInfo['info']['name']; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + if(empty($originalImage)) |
|
| 48 | + { |
|
| 49 | + $originalImage = $_POST['path']; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - include_once(CLASS_IMAGE); |
|
| 53 | - $image = new Image(); |
|
| 54 | - if($image->loadImage($originalImage)) |
|
| 55 | - { |
|
| 52 | + include_once(CLASS_IMAGE); |
|
| 53 | + $image = new Image(); |
|
| 54 | + if($image->loadImage($originalImage)) |
|
| 55 | + { |
|
| 56 | 56 | |
| 57 | - switch($_POST['mode']) |
|
| 58 | - { |
|
| 59 | - case "resize": |
|
| 60 | - if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false))) |
|
| 61 | - { |
|
| 62 | - $error = IMG_SAVE_RESIZE_FAILED; |
|
| 63 | - } |
|
| 64 | - break; |
|
| 65 | - case "crop": |
|
| 66 | - if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height'])) |
|
| 67 | - { |
|
| 68 | - $error = IMG_SAVE_CROP_FAILED; |
|
| 69 | - } |
|
| 70 | - break; |
|
| 71 | - case "flip": |
|
| 72 | - if(!$image->flip($_POST['flip_angle'])) |
|
| 73 | - { |
|
| 74 | - $error = IMG_SAVE_FLIP_FAILED; |
|
| 75 | - } |
|
| 76 | - break; |
|
| 77 | - case "rotate": |
|
| 57 | + switch($_POST['mode']) |
|
| 58 | + { |
|
| 59 | + case "resize": |
|
| 60 | + if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false))) |
|
| 61 | + { |
|
| 62 | + $error = IMG_SAVE_RESIZE_FAILED; |
|
| 63 | + } |
|
| 64 | + break; |
|
| 65 | + case "crop": |
|
| 66 | + if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height'])) |
|
| 67 | + { |
|
| 68 | + $error = IMG_SAVE_CROP_FAILED; |
|
| 69 | + } |
|
| 70 | + break; |
|
| 71 | + case "flip": |
|
| 72 | + if(!$image->flip($_POST['flip_angle'])) |
|
| 73 | + { |
|
| 74 | + $error = IMG_SAVE_FLIP_FAILED; |
|
| 75 | + } |
|
| 76 | + break; |
|
| 77 | + case "rotate": |
|
| 78 | 78 | |
| 79 | - if(!$image->rotate(intval($_POST['angle']))) |
|
| 80 | - { |
|
| 81 | - $error = IMG_SAVE_ROTATE_FAILED; |
|
| 82 | - } |
|
| 79 | + if(!$image->rotate(intval($_POST['angle']))) |
|
| 80 | + { |
|
| 81 | + $error = IMG_SAVE_ROTATE_FAILED; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - break; |
|
| 85 | - default: |
|
| 86 | - $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 87 | - } |
|
| 84 | + break; |
|
| 85 | + default: |
|
| 86 | + $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - if(empty($error)) |
|
| 91 | - { |
|
| 92 | - $sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 93 | - if(!@copy($originalImage, $sessionNewPath)) |
|
| 94 | - {//keep a copy under the session folder |
|
| 95 | - $error = IMG_SAVE_BACKUP_FAILED; |
|
| 96 | - }else |
|
| 97 | - { |
|
| 90 | + if(empty($error)) |
|
| 91 | + { |
|
| 92 | + $sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 93 | + if(!@copy($originalImage, $sessionNewPath)) |
|
| 94 | + {//keep a copy under the session folder |
|
| 95 | + $error = IMG_SAVE_BACKUP_FAILED; |
|
| 96 | + }else |
|
| 97 | + { |
|
| 98 | 98 | |
| 99 | - $isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false); |
|
| 100 | - //save the modified image |
|
| 101 | - $sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1); |
|
| 102 | - $history->add($sessionImageInfo); |
|
| 103 | - if(CONFIG_SYS_DEMO_ENABLE) |
|
| 104 | - {//demo only |
|
| 105 | - if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) |
|
| 106 | - { |
|
| 107 | - $imagePath = $sessionDir . $originalSessionImageInfo['info']['name']; |
|
| 108 | - }else |
|
| 109 | - { |
|
| 110 | - $imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 111 | - } |
|
| 112 | - }else |
|
| 113 | - { |
|
| 114 | - if($isSaveAsRequest) |
|
| 115 | - {//save as request |
|
| 116 | - //check save to folder if exists |
|
| 117 | - if(isset($_POST['save_to']) && strlen($_POST['save_to'])) |
|
| 118 | - { |
|
| 119 | - $imagePath = $originalImage; |
|
| 120 | - }else |
|
| 121 | - { |
|
| 122 | - $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); |
|
| 123 | - } |
|
| 99 | + $isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false); |
|
| 100 | + //save the modified image |
|
| 101 | + $sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1); |
|
| 102 | + $history->add($sessionImageInfo); |
|
| 103 | + if(CONFIG_SYS_DEMO_ENABLE) |
|
| 104 | + {//demo only |
|
| 105 | + if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) |
|
| 106 | + { |
|
| 107 | + $imagePath = $sessionDir . $originalSessionImageInfo['info']['name']; |
|
| 108 | + }else |
|
| 109 | + { |
|
| 110 | + $imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 111 | + } |
|
| 112 | + }else |
|
| 113 | + { |
|
| 114 | + if($isSaveAsRequest) |
|
| 115 | + {//save as request |
|
| 116 | + //check save to folder if exists |
|
| 117 | + if(isset($_POST['save_to']) && strlen($_POST['save_to'])) |
|
| 118 | + { |
|
| 119 | + $imagePath = $originalImage; |
|
| 120 | + }else |
|
| 121 | + { |
|
| 122 | + $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to'])) |
|
| 126 | - { |
|
| 127 | - $error = IMG_SAVE_AS_FOLDER_NOT_FOUND; |
|
| 128 | - }elseif(file_exists($imagePath)) |
|
| 129 | - { |
|
| 130 | - $error = IMG_SAVE_AS_NEW_IMAGE_EXISTS; |
|
| 131 | - }elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name'])) |
|
| 132 | - { |
|
| 133 | - $error = IMG_SAVE_AS_ERR_NAME_INVALID; |
|
| 134 | - } |
|
| 125 | + if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to'])) |
|
| 126 | + { |
|
| 127 | + $error = IMG_SAVE_AS_FOLDER_NOT_FOUND; |
|
| 128 | + }elseif(file_exists($imagePath)) |
|
| 129 | + { |
|
| 130 | + $error = IMG_SAVE_AS_NEW_IMAGE_EXISTS; |
|
| 131 | + }elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name'])) |
|
| 132 | + { |
|
| 133 | + $error = IMG_SAVE_AS_ERR_NAME_INVALID; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - }else |
|
| 137 | - {//save request |
|
| 138 | - $imagePath = $originalImage; |
|
| 139 | - } |
|
| 136 | + }else |
|
| 137 | + {//save request |
|
| 138 | + $imagePath = $originalImage; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - } |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - if($image->saveImage($imagePath)) |
|
| 144 | - { |
|
| 143 | + if($image->saveImage($imagePath)) |
|
| 144 | + { |
|
| 145 | 145 | |
| 146 | - if(CONFIG_SYS_DEMO_ENABLE) |
|
| 147 | - { |
|
| 148 | - if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo)) |
|
| 149 | - {//keep this original image information on session for future reference if demo only |
|
| 150 | - $originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1); |
|
| 151 | - $history->add($originalSessionImageInfo); |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - $imageInfo = $image->getFinalImageInfo(); |
|
| 155 | - }else |
|
| 156 | - { |
|
| 157 | - $error = IMG_SAVE_FAILED; |
|
| 146 | + if(CONFIG_SYS_DEMO_ENABLE) |
|
| 147 | + { |
|
| 148 | + if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo)) |
|
| 149 | + {//keep this original image information on session for future reference if demo only |
|
| 150 | + $originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1); |
|
| 151 | + $history->add($originalSessionImageInfo); |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + $imageInfo = $image->getFinalImageInfo(); |
|
| 155 | + }else |
|
| 156 | + { |
|
| 157 | + $error = IMG_SAVE_FAILED; |
|
| 158 | 158 | |
| 159 | - } |
|
| 160 | - if(isset($imageInfo)) |
|
| 161 | - { |
|
| 162 | - $info .= ",width:" . $imageInfo['width'] . ""; |
|
| 163 | - $info .= ",height:" . $imageInfo['height'] . ""; |
|
| 164 | - $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'"; |
|
| 165 | - if($isSaveAsRequest) |
|
| 166 | - { |
|
| 167 | - $info .= ",save_as:'1'"; |
|
| 168 | - }else |
|
| 169 | - { |
|
| 170 | - $info .= ",save_as:'0'"; |
|
| 171 | - } |
|
| 172 | - $info .= ",folder_path:'" . dirname($imagePath) . "'"; |
|
| 173 | - $info .= ",path:'" . backslashToSlash($imagePath) . "'"; |
|
| 159 | + } |
|
| 160 | + if(isset($imageInfo)) |
|
| 161 | + { |
|
| 162 | + $info .= ",width:" . $imageInfo['width'] . ""; |
|
| 163 | + $info .= ",height:" . $imageInfo['height'] . ""; |
|
| 164 | + $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'"; |
|
| 165 | + if($isSaveAsRequest) |
|
| 166 | + { |
|
| 167 | + $info .= ",save_as:'1'"; |
|
| 168 | + }else |
|
| 169 | + { |
|
| 170 | + $info .= ",save_as:'0'"; |
|
| 171 | + } |
|
| 172 | + $info .= ",folder_path:'" . dirname($imagePath) . "'"; |
|
| 173 | + $info .= ",path:'" . backslashToSlash($imagePath) . "'"; |
|
| 174 | 174 | |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - } |
|
| 180 | - }else |
|
| 181 | - { |
|
| 182 | - $error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage; |
|
| 183 | - } |
|
| 179 | + } |
|
| 180 | + }else |
|
| 181 | + { |
|
| 182 | + $error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - }else |
|
| 186 | - { |
|
| 187 | - $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - echo "{"; |
|
| 191 | - echo "error:'" . $error . "'"; |
|
| 192 | - if(isset($image) && is_object($image)) |
|
| 193 | - { |
|
| 194 | - $image->DestroyImages(); |
|
| 195 | - } |
|
| 196 | - echo $info; |
|
| 197 | - echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . ""; |
|
| 198 | - echo "}"; |
|
| 185 | + }else |
|
| 186 | + { |
|
| 187 | + $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + echo "{"; |
|
| 191 | + echo "error:'" . $error . "'"; |
|
| 192 | + if(isset($image) && is_object($image)) |
|
| 193 | + { |
|
| 194 | + $image->DestroyImages(); |
|
| 195 | + } |
|
| 196 | + echo $info; |
|
| 197 | + echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . ""; |
|
| 198 | + echo "}"; |
|
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | ?> |
| 202 | 202 | \ No newline at end of file |
@@ -6,25 +6,25 @@ discard block |
||
| 6 | 6 | * @since 22/May/2007 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 9 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | $error = ""; |
| 13 | 13 | $info = ""; |
| 14 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 14 | + if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 15 | 15 | { |
| 16 | 16 | $error = SYS_DISABLED; |
| 17 | 17 | } |
| 18 | - elseif(empty($_POST['path'])) |
|
| 18 | + elseif (empty($_POST['path'])) |
|
| 19 | 19 | { |
| 20 | - $error = IMG_SAVE_EMPTY_PATH; |
|
| 21 | - }elseif(!file_exists($_POST['path'])) |
|
| 20 | + $error = IMG_SAVE_EMPTY_PATH; |
|
| 21 | + }elseif (!file_exists($_POST['path'])) |
|
| 22 | 22 | { |
| 23 | - $error = IMG_SAVE_NOT_EXISTS; |
|
| 24 | - }elseif(!isUnderRoot($_POST['path'])) |
|
| 23 | + $error = IMG_SAVE_NOT_EXISTS; |
|
| 24 | + }elseif (!isUnderRoot($_POST['path'])) |
|
| 25 | 25 | { |
| 26 | 26 | $error = IMG_SAVE_PATH_DISALLOWED; |
| 27 | - }elseif(($sessionDir = $session->getSessionDir()) == '') |
|
| 27 | + }elseif (($sessionDir = $session->getSessionDir()) == '') |
|
| 28 | 28 | { |
| 29 | 29 | $error = SESSION_PERSONAL_DIR_NOT_FOUND; |
| 30 | 30 | } |
@@ -32,51 +32,51 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | require_once(CLASS_HISTORY); |
| 34 | 34 | $history = new History($_POST['path'], $session); |
| 35 | - if(!empty($_POST['mode'])) |
|
| 35 | + if (!empty($_POST['mode'])) |
|
| 36 | 36 | { |
| 37 | 37 | //get the original image which is the lastest session image if any when the system is in demo |
| 38 | 38 | $lastestSessionImageInfo = $history->getLastestRestorable(); |
| 39 | - if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE) |
|
| 39 | + if (sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE) |
|
| 40 | 40 | { |
| 41 | 41 | $originalSessionImageInfo = $history->getOriginalImage(); |
| 42 | - if(sizeof($originalSessionImageInfo)) |
|
| 42 | + if (sizeof($originalSessionImageInfo)) |
|
| 43 | 43 | { |
| 44 | - $originalImage = $sessionDir . $originalSessionImageInfo['info']['name']; |
|
| 44 | + $originalImage = $sessionDir.$originalSessionImageInfo['info']['name']; |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - if(empty($originalImage)) |
|
| 47 | + if (empty($originalImage)) |
|
| 48 | 48 | { |
| 49 | 49 | $originalImage = $_POST['path']; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | include_once(CLASS_IMAGE); |
| 53 | 53 | $image = new Image(); |
| 54 | - if($image->loadImage($originalImage)) |
|
| 54 | + if ($image->loadImage($originalImage)) |
|
| 55 | 55 | { |
| 56 | 56 | |
| 57 | - switch($_POST['mode']) |
|
| 57 | + switch ($_POST['mode']) |
|
| 58 | 58 | { |
| 59 | 59 | case "resize": |
| 60 | - if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false))) |
|
| 60 | + if (!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint']) ? true : false))) |
|
| 61 | 61 | { |
| 62 | 62 | $error = IMG_SAVE_RESIZE_FAILED; |
| 63 | 63 | } |
| 64 | 64 | break; |
| 65 | 65 | case "crop": |
| 66 | - if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height'])) |
|
| 66 | + if (!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height'])) |
|
| 67 | 67 | { |
| 68 | 68 | $error = IMG_SAVE_CROP_FAILED; |
| 69 | 69 | } |
| 70 | 70 | break; |
| 71 | 71 | case "flip": |
| 72 | - if(!$image->flip($_POST['flip_angle'])) |
|
| 72 | + if (!$image->flip($_POST['flip_angle'])) |
|
| 73 | 73 | { |
| 74 | 74 | $error = IMG_SAVE_FLIP_FAILED; |
| 75 | 75 | } |
| 76 | 76 | break; |
| 77 | 77 | case "rotate": |
| 78 | 78 | |
| 79 | - if(!$image->rotate(intval($_POST['angle']))) |
|
| 79 | + if (!$image->rotate(intval($_POST['angle']))) |
|
| 80 | 80 | { |
| 81 | 81 | $error = IMG_SAVE_ROTATE_FAILED; |
| 82 | 82 | } |
@@ -87,114 +87,114 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | - if(empty($error)) |
|
| 90 | + if (empty($error)) |
|
| 91 | 91 | { |
| 92 | - $sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 93 | - if(!@copy($originalImage, $sessionNewPath)) |
|
| 92 | + $sessionNewPath = $sessionDir.uniqid(md5(time())).".".getFileExt($_POST['path']); |
|
| 93 | + if (!@copy($originalImage, $sessionNewPath)) |
|
| 94 | 94 | {//keep a copy under the session folder |
| 95 | 95 | $error = IMG_SAVE_BACKUP_FAILED; |
| 96 | - }else |
|
| 96 | + } else |
|
| 97 | 97 | { |
| 98 | 98 | |
| 99 | - $isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false); |
|
| 99 | + $isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to']) ? true : false); |
|
| 100 | 100 | //save the modified image |
| 101 | 101 | $sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1); |
| 102 | 102 | $history->add($sessionImageInfo); |
| 103 | - if(CONFIG_SYS_DEMO_ENABLE) |
|
| 103 | + if (CONFIG_SYS_DEMO_ENABLE) |
|
| 104 | 104 | {//demo only |
| 105 | - if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) |
|
| 105 | + if (isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) |
|
| 106 | 106 | { |
| 107 | - $imagePath = $sessionDir . $originalSessionImageInfo['info']['name']; |
|
| 108 | - }else |
|
| 107 | + $imagePath = $sessionDir.$originalSessionImageInfo['info']['name']; |
|
| 108 | + } else |
|
| 109 | 109 | { |
| 110 | - $imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 110 | + $imagePath = $sessionDir.uniqid(md5(time())).".".getFileExt($_POST['path']); |
|
| 111 | 111 | } |
| 112 | - }else |
|
| 112 | + } else |
|
| 113 | 113 | { |
| 114 | - if($isSaveAsRequest) |
|
| 114 | + if ($isSaveAsRequest) |
|
| 115 | 115 | {//save as request |
| 116 | 116 | //check save to folder if exists |
| 117 | - if(isset($_POST['save_to']) && strlen($_POST['save_to'])) |
|
| 117 | + if (isset($_POST['save_to']) && strlen($_POST['save_to'])) |
|
| 118 | 118 | { |
| 119 | 119 | $imagePath = $originalImage; |
| 120 | - }else |
|
| 120 | + } else |
|
| 121 | 121 | { |
| 122 | - $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); |
|
| 122 | + $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])).$_POST['new_name'].".".getFileExt($_POST['path']); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to'])) |
|
| 125 | + if (!file_exists($_POST['save_to']) || !is_dir($_POST['save_to'])) |
|
| 126 | 126 | { |
| 127 | 127 | $error = IMG_SAVE_AS_FOLDER_NOT_FOUND; |
| 128 | - }elseif(file_exists($imagePath)) |
|
| 128 | + }elseif (file_exists($imagePath)) |
|
| 129 | 129 | { |
| 130 | 130 | $error = IMG_SAVE_AS_NEW_IMAGE_EXISTS; |
| 131 | - }elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name'])) |
|
| 131 | + }elseif (!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name'])) |
|
| 132 | 132 | { |
| 133 | 133 | $error = IMG_SAVE_AS_ERR_NAME_INVALID; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - }else |
|
| 136 | + } else |
|
| 137 | 137 | {//save request |
| 138 | 138 | $imagePath = $originalImage; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if($image->saveImage($imagePath)) |
|
| 143 | + if ($image->saveImage($imagePath)) |
|
| 144 | 144 | { |
| 145 | 145 | |
| 146 | - if(CONFIG_SYS_DEMO_ENABLE) |
|
| 146 | + if (CONFIG_SYS_DEMO_ENABLE) |
|
| 147 | 147 | { |
| 148 | - if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo)) |
|
| 148 | + if (!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo)) |
|
| 149 | 149 | {//keep this original image information on session for future reference if demo only |
| 150 | 150 | $originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1); |
| 151 | 151 | $history->add($originalSessionImageInfo); |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | $imageInfo = $image->getFinalImageInfo(); |
| 155 | - }else |
|
| 155 | + } else |
|
| 156 | 156 | { |
| 157 | 157 | $error = IMG_SAVE_FAILED; |
| 158 | 158 | |
| 159 | 159 | } |
| 160 | - if(isset($imageInfo)) |
|
| 160 | + if (isset($imageInfo)) |
|
| 161 | 161 | { |
| 162 | - $info .= ",width:" . $imageInfo['width'] . ""; |
|
| 163 | - $info .= ",height:" . $imageInfo['height'] . ""; |
|
| 164 | - $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'"; |
|
| 165 | - if($isSaveAsRequest) |
|
| 162 | + $info .= ",width:".$imageInfo['width'].""; |
|
| 163 | + $info .= ",height:".$imageInfo['height'].""; |
|
| 164 | + $info .= ",size:'".transformFileSize($imageInfo['size'])."'"; |
|
| 165 | + if ($isSaveAsRequest) |
|
| 166 | 166 | { |
| 167 | 167 | $info .= ",save_as:'1'"; |
| 168 | - }else |
|
| 168 | + } else |
|
| 169 | 169 | { |
| 170 | 170 | $info .= ",save_as:'0'"; |
| 171 | 171 | } |
| 172 | - $info .= ",folder_path:'" . dirname($imagePath) . "'"; |
|
| 173 | - $info .= ",path:'" . backslashToSlash($imagePath) . "'"; |
|
| 172 | + $info .= ",folder_path:'".dirname($imagePath)."'"; |
|
| 173 | + $info .= ",path:'".backslashToSlash($imagePath)."'"; |
|
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | } |
| 180 | - }else |
|
| 180 | + } else |
|
| 181 | 181 | { |
| 182 | - $error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage; |
|
| 182 | + $error = IMG_SAVE_IMG_OPEN_FAILED.$originalImage; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - }else |
|
| 185 | + } else |
|
| 186 | 186 | { |
| 187 | 187 | $error = IMG_SAVE_UNKNOWN_MODE; |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | echo "{"; |
| 191 | - echo "error:'" . $error . "'"; |
|
| 192 | - if(isset($image) && is_object($image)) |
|
| 191 | + echo "error:'".$error."'"; |
|
| 192 | + if (isset($image) && is_object($image)) |
|
| 193 | 193 | { |
| 194 | 194 | $image->DestroyImages(); |
| 195 | 195 | } |
| 196 | 196 | echo $info; |
| 197 | - echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . ""; |
|
| 197 | + echo ",history:".(isset($history) && is_object($history) ? ($history->getNumRestorable()) : 0).""; |
|
| 198 | 198 | echo "}"; |
| 199 | 199 | |
| 200 | 200 | |
@@ -14,21 +14,19 @@ discard block |
||
| 14 | 14 | if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
| 15 | 15 | { |
| 16 | 16 | $error = SYS_DISABLED; |
| 17 | - } |
|
| 18 | - elseif(empty($_POST['path'])) |
|
| 17 | + } elseif(empty($_POST['path'])) |
|
| 19 | 18 | { |
| 20 | 19 | $error = IMG_SAVE_EMPTY_PATH; |
| 21 | - }elseif(!file_exists($_POST['path'])) |
|
| 20 | + } elseif(!file_exists($_POST['path'])) |
|
| 22 | 21 | { |
| 23 | 22 | $error = IMG_SAVE_NOT_EXISTS; |
| 24 | - }elseif(!isUnderRoot($_POST['path'])) |
|
| 23 | + } elseif(!isUnderRoot($_POST['path'])) |
|
| 25 | 24 | { |
| 26 | 25 | $error = IMG_SAVE_PATH_DISALLOWED; |
| 27 | - }elseif(($sessionDir = $session->getSessionDir()) == '') |
|
| 26 | + } elseif(($sessionDir = $session->getSessionDir()) == '') |
|
| 28 | 27 | { |
| 29 | 28 | $error = SESSION_PERSONAL_DIR_NOT_FOUND; |
| 30 | - } |
|
| 31 | - else |
|
| 29 | + } else |
|
| 32 | 30 | { |
| 33 | 31 | require_once(CLASS_HISTORY); |
| 34 | 32 | $history = new History($_POST['path'], $session); |
@@ -93,7 +91,7 @@ discard block |
||
| 93 | 91 | if(!@copy($originalImage, $sessionNewPath)) |
| 94 | 92 | {//keep a copy under the session folder |
| 95 | 93 | $error = IMG_SAVE_BACKUP_FAILED; |
| 96 | - }else |
|
| 94 | + } else |
|
| 97 | 95 | { |
| 98 | 96 | |
| 99 | 97 | $isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false); |
@@ -105,11 +103,11 @@ discard block |
||
| 105 | 103 | if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) |
| 106 | 104 | { |
| 107 | 105 | $imagePath = $sessionDir . $originalSessionImageInfo['info']['name']; |
| 108 | - }else |
|
| 106 | + } else |
|
| 109 | 107 | { |
| 110 | 108 | $imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
| 111 | 109 | } |
| 112 | - }else |
|
| 110 | + } else |
|
| 113 | 111 | { |
| 114 | 112 | if($isSaveAsRequest) |
| 115 | 113 | {//save as request |
@@ -117,7 +115,7 @@ discard block |
||
| 117 | 115 | if(isset($_POST['save_to']) && strlen($_POST['save_to'])) |
| 118 | 116 | { |
| 119 | 117 | $imagePath = $originalImage; |
| 120 | - }else |
|
| 118 | + } else |
|
| 121 | 119 | { |
| 122 | 120 | $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); |
| 123 | 121 | } |
@@ -125,15 +123,15 @@ discard block |
||
| 125 | 123 | if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to'])) |
| 126 | 124 | { |
| 127 | 125 | $error = IMG_SAVE_AS_FOLDER_NOT_FOUND; |
| 128 | - }elseif(file_exists($imagePath)) |
|
| 126 | + } elseif(file_exists($imagePath)) |
|
| 129 | 127 | { |
| 130 | 128 | $error = IMG_SAVE_AS_NEW_IMAGE_EXISTS; |
| 131 | - }elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name'])) |
|
| 129 | + } elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name'])) |
|
| 132 | 130 | { |
| 133 | 131 | $error = IMG_SAVE_AS_ERR_NAME_INVALID; |
| 134 | 132 | } |
| 135 | 133 | |
| 136 | - }else |
|
| 134 | + } else |
|
| 137 | 135 | {//save request |
| 138 | 136 | $imagePath = $originalImage; |
| 139 | 137 | } |
@@ -152,7 +150,7 @@ discard block |
||
| 152 | 150 | } |
| 153 | 151 | } |
| 154 | 152 | $imageInfo = $image->getFinalImageInfo(); |
| 155 | - }else |
|
| 153 | + } else |
|
| 156 | 154 | { |
| 157 | 155 | $error = IMG_SAVE_FAILED; |
| 158 | 156 | |
@@ -165,7 +163,7 @@ discard block |
||
| 165 | 163 | if($isSaveAsRequest) |
| 166 | 164 | { |
| 167 | 165 | $info .= ",save_as:'1'"; |
| 168 | - }else |
|
| 166 | + } else |
|
| 169 | 167 | { |
| 170 | 168 | $info .= ",save_as:'0'"; |
| 171 | 169 | } |
@@ -177,12 +175,12 @@ discard block |
||
| 177 | 175 | } |
| 178 | 176 | |
| 179 | 177 | } |
| 180 | - }else |
|
| 178 | + } else |
|
| 181 | 179 | { |
| 182 | 180 | $error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage; |
| 183 | 181 | } |
| 184 | 182 | |
| 185 | - }else |
|
| 183 | + } else |
|
| 186 | 184 | { |
| 187 | 185 | $error = IMG_SAVE_UNKNOWN_MODE; |
| 188 | 186 | } |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 3 | - echo '{'; |
|
| 4 | - $count = 1; |
|
| 5 | - foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 6 | - { |
|
| 2 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 3 | + echo '{'; |
|
| 4 | + $count = 1; |
|
| 5 | + foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | 8 | |
| 9 | - echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; |
|
| 10 | - $count++; |
|
| 11 | - } |
|
| 12 | - echo "}"; |
|
| 9 | + echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; |
|
| 10 | + $count++; |
|
| 11 | + } |
|
| 12 | + echo "}"; |
|
| 13 | 13 | ?> |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 2 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 3 | 3 | echo '{'; |
| 4 | 4 | $count = 1; |
| 5 | - foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 5 | + foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 6 | 6 | { |
| 7 | 7 | |
| 8 | 8 | |
| 9 | - echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; |
|
| 9 | + echo (($count > 1) ? ', ' : '')."'".$v."':'".$k."'"; |
|
| 10 | 10 | $count++; |
| 11 | 11 | } |
| 12 | 12 | echo "}"; |
@@ -1,20 +1,20 @@ |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?><?php |
| 7 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 7 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 8 | 8 | ?> |
| 9 | 9 | <select class="input inputSearch" name="search_folder" id="search_folder"> |
| 10 | 10 | <?php |
| 11 | 11 | |
| 12 | - foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 13 | - { |
|
| 14 | - ?> |
|
| 12 | + foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 13 | + { |
|
| 14 | + ?> |
|
| 15 | 15 | <option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option> |
| 16 | 16 | <?php |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - ?> |
|
| 19 | + ?> |
|
| 20 | 20 | </select> |
| 21 | 21 | \ No newline at end of file |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
| 6 | 6 | ?><?php |
| 7 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 7 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 8 | 8 | ?> |
| 9 | 9 | <select class="input inputSearch" name="search_folder" id="search_folder"> |
| 10 | 10 | <?php |
| 11 | 11 | |
| 12 | - foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 12 | + foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) |
|
| 13 | 13 | { |
| 14 | 14 | ?> |
| 15 | 15 | <option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option> |