Browse Source

Minor code style corrections

Julio Montoya 13 years ago
parent
commit
47f043f3d3

+ 71 - 76
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php

@@ -11,74 +11,74 @@
 	
 class ImageAjaxFileManager
 {
-		var $_debug = false; 
-		var $_errors = array();
-		var $gdInfo = array(); //keep all information of GD extension
-		var $_imgOrig = null; //the hanlder of original image
-		var $_imgFinal = null; //the handler of final image
-		var $imageFile  = null;  
-    var $transparentColorRed = null;
-    var $transparentColorGreen = null;
-    var $transparentColorBlue = null;		 
-    var $chmod = 0755;
-    var $_imgInfoOrig = array(
-    	'name'=>'',
-    	'ext'=>'',
-    	'size'=>'',
-    	'width'=>'',
-    	'height'=>'',
-    	'type'=>'',
-    	'path'=>'',
-    );    
-    var $_imgInfoFinal = array(
-    	'name'=>'',
-    	'ext'=>'',
-    	'size'=>'',
-    	'width'=>'',
-    	'height'=>'', 
-    	'type'=>'',   
-    	'path'=>'',
-    );		
-		var $_imgQuality = 90;
-		/**
-		 * constructor
-		 *
-		 * @param boolean $debug
-		 * @return Image
-		 */
-		
-		function __construct($debug = false)
-		{
-			$this->enableDebug($debug);
-			$this->gdInfo = $this->getGDInfo();			
-		}
-		function Image($debug = false)
-		{
-			$this->__construct($debug);
-		}
-		/**
-		 * enable to debug
-		 *
-		 * @param boolean $value
-		 */
-		function enableDebug($value)
-		{
-			$this->_debug = ($value?true:false);
-		}
-		/**
-		 * check if debug enable
-		 * @return boolean
-		 */
-		function _isDebugEnable()
-		{
-			return $this->_debug;
-		}
-
-	    /**
-		 * append to errors array and shown the each error when the debug turned on  
-		 * 
-		 * @param  string $string
-		 * @return void
+	var $_debug = false;
+	var $_errors = array();
+	var $gdInfo = array(); //keep all information of GD extension
+	var $_imgOrig = null; //the hanlder of original image
+	var $_imgFinal = null; //the handler of final image
+	var $imageFile  = null;
+	var $transparentColorRed = null;
+	var $transparentColorGreen = null;
+	var $transparentColorBlue = null;
+	var $chmod = 0755;
+	var $_imgInfoOrig = array(
+	    	'name'=>'',
+	    	'ext'=>'',
+	    	'size'=>'',
+	    	'width'=>'',
+	    	'height'=>'',
+	    	'type'=>'',
+	    	'path'=>'',
+	);
+	var $_imgInfoFinal = array(
+		'name'=>'',
+		'ext'=>'',
+		'size'=>'',
+		'width'=>'',
+		'height'=>'', 
+		'type'=>'',   
+		'path'=>'',
+	);
+	var $_imgQuality = 90;
+	/**
+	 * constructor
+	 *
+	 * @param boolean $debug
+	 * @return Image
+	 */
+	
+	function __construct($debug = false)
+	{
+		$this->enableDebug($debug);
+		$this->gdInfo = $this->getGDInfo();
+	}
+	function Image($debug = false)
+	{
+		$this->__construct($debug);
+	}
+	/**
+	 * enable to debug
+	 *
+	 * @param boolean $value
+	 */
+	function enableDebug($value)
+	{
+		$this->_debug = ($value?true:false);
+	}
+	/**
+	 * check if debug enable
+	 * @return boolean
+	 */
+	function _isDebugEnable()
+	{
+		return $this->_debug;
+	}
+	
+	/**
+	 * append to errors array and shown the each error when the debug turned on
+	 *
+	 * @param  string $string
+	 * @return void
      * @access private
      * @copyright this function originally come from Andy's php 
 	 */
@@ -112,16 +112,13 @@ class ImageAjaxFileManager
      * @access public
      * @copyright this function originally come from Andy's php 
      */
-    function loadImage($filename)
-    {
+    function loadImage($filename) {
         $ext  = strtolower($this->_getExtension($filename));
         $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext);
         if (!$this->_isSupported($filename, $ext, $func, false)) {
-
             return false;
         }
-        if($ext == "gif")
-        {
+        if($ext == "gif") {
              // the following part gets the transparency color for a gif file
             // this code is from the PHP manual and is written by
             // fred at webblake dot net and webmaster at webnetwizard dotco dotuk, thanks!
@@ -795,6 +792,4 @@ class ImageAjaxFileManager
         }
         
     }	
-	}
-	
-?>
+}

+ 8 - 10
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php

@@ -1,15 +1,13 @@
 <?php
-	/**
-	 * This class provide all file upload functionalities
-	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
-	 * @link www.phpletter.com
-	 * @since 22/April/2007
-	 *
-	 */
+/**
+ * This class provide all file upload functionalities
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 22/April/2007
+ *
+ */
  require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';//from Dokeos
- class Upload
-
-{
+ class Upload {
 	var $fileType = ""; //the file type
 	var $originalFileName = "";
 	var $fileName = ""; //the file final name

+ 198 - 222
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php

@@ -1,245 +1,221 @@
 <?php
-	/**
-	 * sysem base config setting
-	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
-	 * @link www.phpletter.com
-	 * @since 1/August/2007
-	 *
-	 *
-	 * Modify system config setting for Chamilo
-	 * @author Juan Carlos Raña Trabado
-	 * @since 31/December/2008
-	 */
-
-    
-    //error_reporting(E_ALL);
-    //error_reporting(E_ALL ^ E_NOTICE);
-
-	//Access Control Setting
-	/**
-	 * turn off => false
-	 * by session => true
-	 */
-	define('CONFIG_ACCESS_CONTROL_MODE', false);
-	define("CONFIG_LOGIN_USERNAME", 'ajax');
-	define('CONFIG_LOGIN_PASSWORD', '123456');
-	define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page
-
-	//SYSTEM MODE CONFIG
-		/**
-		 * turn it on when you have this system for demo purpose
-		*  that means changes made to each image is not physically applied to it
-		*  and all uploaded files/created folders will be removed automatically
-		*/
-	define('CONFIG_SYS_DEMO_ENABLE', false);
-	define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only
-	define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false
-
-	//User Permissions
-	//Hack by Juan Carlos Raña Trabado
-	if(empty($_course['path']))
-	{
+/**
+ * sysem base config setting
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @since 1/August/2007
+ *
+ *
+ * Modify system config setting for Chamilo
+ * @author Juan Carlos Raña Trabado
+ * @since 31/December/2008
+ */
+
+//error_reporting(E_ALL);
+//error_reporting(E_ALL ^ E_NOTICE);
+
+//Access Control Setting
+/**
+* turn off => false
+* by session => true
+*/
+define('CONFIG_ACCESS_CONTROL_MODE', false);
+define("CONFIG_LOGIN_USERNAME", 'ajax');
+define('CONFIG_LOGIN_PASSWORD', '123456');
+define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page
+
+//SYSTEM MODE CONFIG
+/**
+* turn it on when you have this system for demo purpose
+*  that means changes made to each image is not physically applied to it
+*  and all uploaded files/created folders will be removed automatically
+*/
+define('CONFIG_SYS_DEMO_ENABLE', false);
+define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only
+define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false
+
+//User Permissions
+//Hack by Juan Carlos Raña Trabado
+if(empty($_course['path'])) {
+	define('CONFIG_OPTIONS_DELETE', true);
+	define('CONFIG_OPTIONS_CUT', true);
+	define('CONFIG_OPTIONS_COPY', true);
+	define('CONFIG_OPTIONS_NEWFOLDER', true);
+	define('CONFIG_OPTIONS_RENAME', true);
+	define('CONFIG_OPTIONS_UPLOAD', true);
+	define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor
+} else {
+	
+	if(api_is_allowed_to_edit()) {
+		//api_is_allowed_to_edit() from Chamilo
 		define('CONFIG_OPTIONS_DELETE', true);
 		define('CONFIG_OPTIONS_CUT', true);
 		define('CONFIG_OPTIONS_COPY', true);
 		define('CONFIG_OPTIONS_NEWFOLDER', true);
-		define('CONFIG_OPTIONS_RENAME', true);
+		define('CONFIG_OPTIONS_RENAME', false);
+		define('CONFIG_OPTIONS_UPLOAD', true);
+		define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor
+	} else {
+		define('CONFIG_OPTIONS_DELETE', true);
+		define('CONFIG_OPTIONS_CUT', true);
+		define('CONFIG_OPTIONS_COPY', true);
+		define('CONFIG_OPTIONS_NEWFOLDER', true);
+		define('CONFIG_OPTIONS_RENAME', false);
 		define('CONFIG_OPTIONS_UPLOAD', true);
 		define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor
 	}
-	else
-	{
-		if(api_is_allowed_to_edit())
-		{
-		//api_is_allowed_to_edit() from Chamilo
-			define('CONFIG_OPTIONS_DELETE', true);
-			define('CONFIG_OPTIONS_CUT', true);
-			define('CONFIG_OPTIONS_COPY', true);
-			define('CONFIG_OPTIONS_NEWFOLDER', true);
-			define('CONFIG_OPTIONS_RENAME', false);
-			define('CONFIG_OPTIONS_UPLOAD', true);
-			define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor
-
-		}
-		else
-		{
-			define('CONFIG_OPTIONS_DELETE', true);
-			define('CONFIG_OPTIONS_CUT', true);
-			define('CONFIG_OPTIONS_COPY', true);
-			define('CONFIG_OPTIONS_NEWFOLDER', true);
-			define('CONFIG_OPTIONS_RENAME', false);
-			define('CONFIG_OPTIONS_UPLOAD', true);
-			define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor
-		}
-	}
-
-
-	//FILESYSTEM CONFIG
-		/*
-		* CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to
-			and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder
-			these two paths accept relative path only, don't use absolute path
-		*/
-			//define('CONFIG_SYS_DEFAULT_PATH', '../uploaded/'); //accept relative path only
-			//define('CONFIG_SYS_ROOT_PATH', '../uploaded/');	//accept relative path only
-
-	/////////////// Integration for Chamilo
-
-	if(!empty($_course['path']))
-	{
-		if(!empty($group_properties['directory']))
-		{
-			$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document'.$group_properties['directory'].'/';
-		}
-		else
-		{
-			if(api_is_allowed_to_edit())
-			{
-				$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/';
-			}
-			else
-			{
-				$current_session_id = api_get_session_id();
-				if($current_session_id==0)
-				{
-					$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
-				}
-				else
-				{
-					$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
-				}				
+}
+
+
+//FILESYSTEM CONFIG
+/*
+* CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to
+and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder
+these two paths accept relative path only, don't use absolute path
+*/
+//define('CONFIG_SYS_DEFAULT_PATH', '../uploaded/'); //accept relative path only
+//define('CONFIG_SYS_ROOT_PATH', '../uploaded/');	//accept relative path only
+
+/////////////// Integration for Chamilo
+
+if(!empty($_course['path'])) {
+	if(!empty($group_properties['directory'])) {
+		$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document'.$group_properties['directory'].'/';
+	} else {
+		if(api_is_allowed_to_edit()) {
+			$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/';
+		} else {
+			$current_session_id = api_get_session_id();
+			if($current_session_id==0) {
+				$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
+			} else {
+				$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
 			}
 		}
 	}
-	else
-	{
-		if (api_is_platform_admin() && $_SESSION['this_section']=='platform_admin')
-		{
-			//home page portal
-			$PathChamiloAjaxFileManager='../../../../../../../home/default_platform_document/';
-		}
-		else
-		{
-			//my profile
-            $my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'none');
-			$PathChamiloAjaxFileManager='../../../../../../../main/'.$my_path['dir'].'my_files/';
-		}
-
+} else {
+	if (api_is_platform_admin() && $_SESSION['this_section']=='platform_admin') {
+		//home page portal
+		$PathChamiloAjaxFileManager='../../../../../../../home/default_platform_document/';
+	} else {
+		//my profile
+		$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'none');
+		$PathChamiloAjaxFileManager='../../../../../../../main/'.$my_path['dir'].'my_files/';
 	}
 
-	define('CONFIG_SYS_DEFAULT_PATH', $PathChamiloAjaxFileManager);
-	define('CONFIG_SYS_ROOT_PATH', $PathChamiloAjaxFileManager);
+}
 
-	////////////// end chamilo
+define('CONFIG_SYS_DEFAULT_PATH', $PathChamiloAjaxFileManager);
+define('CONFIG_SYS_ROOT_PATH', $PathChamiloAjaxFileManager);
 
-	define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
+////////////// end chamilo
 
 
-	define("CONFIG_SYS_DIR_SESSION_PATH", session_save_path()); // Hack by Juan Carlos Raña
 
+define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
+define("CONFIG_SYS_DIR_SESSION_PATH", session_save_path()); // Hack by Juan Carlos Raña
+define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
+/**
+* reg => regulare expression
+* csv => a list of comma separated file/folder name, (exactly match the specified file/folders)
+* list => a list of comma spearated vague file/folder name (partially match the specified file/folders)
+*
+*/
+//more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php
+define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
+define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple
+define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
+define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple
+define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1
 
-	define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
-		/**
-		 * reg => regulare expression
-		 * csv => a list of comma separated file/folder name, (exactly match the specified file/folders)
-		 * list => a list of comma spearated vague file/folder name (partially match the specified file/folders)
-		 *
-		 */
-	//more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php
-	define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
-	define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple
-	define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
-	define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple
-	define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1
+//UPLOAD OPTIONS CONFIG
+define('CONFIG_UPLOAD_MAXSIZE', 50000 * 1024 ); //by bytes For Chamilo upgrade from 50 to 50000 (50MB)
 
-	//UPLOAD OPTIONS CONFIG
-	define('CONFIG_UPLOAD_MAXSIZE', 50000 * 1024 ); //by bytes For Chamilo upgrade from 50 to 50000 (50MB)
+define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid. For Chamilo exclude original xml, js and css
 
-	define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid. For Chamilo exclude original xml, js and css
-
-	define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
-	define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png,bmp,tif,psd,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,ogg,ogx,ogv,oga, aif,aiff,wav,mp3,swf,flv, mp4, aac, ppt,rtf,doc, pdf,xls,txt,flv,odt,ods,odp,odg,odc,odf,odb,odi,pps,docx,pptx,xlsx,accdb,xml,mid, midi, svg, svgz');//For Chamilo updated
-		
-	//define viewable valid exts
-	$viewable='gif,bmp,txt,jpg,jpeg,png,tif,html,htm,mp3,wav,wmv,wma,rm,rmvb,mov,swf,flv,mp4,aac,avi,mpg,mpeg,asf,mid,midi';//updated by Chamilo
-	$viewable_array = explode(" ",$viewable);
-	
-	if (api_browser_support('svg')){				
-		$viewable_array[]=',svg';
-	}
-	if (api_browser_support('ogg')){
-		$viewable_array[]=',ogg';
-		$viewable_array[]=',ogx';
-		$viewable_array[]=',oga';
-		$viewable_array[]=',ogv';
-	}
-	if (api_browser_support('pdf')){
-		$viewable_array[]=',pdf';
-	}
-		
-	$viewable = implode(" ",$viewable_array);
-	$viewable = preg_replace('/\s+/', '', $viewable);//clean spaces
+define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
+define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png,bmp,tif,psd,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,ogg,ogx,ogv,oga, aif,aiff,wav,mp3,swf,flv, mp4, aac, ppt,rtf,doc, pdf,xls,txt,flv,odt,ods,odp,odg,odc,odf,odb,odi,pps,docx,pptx,xlsx,accdb,xml,mid, midi, svg, svgz');//For Chamilo updated
 	
+//define viewable valid exts
+$viewable='gif,bmp,txt,jpg,jpeg,png,tif,html,htm,mp3,wav,wmv,wma,rm,rmvb,mov,swf,flv,mp4,aac,avi,mpg,mpeg,asf,mid,midi';//updated by Chamilo
+$viewable_array = explode(" ",$viewable);
+
+if (api_browser_support('svg')){				
+	$viewable_array[]=',svg';
+}
+if (api_browser_support('ogg')){
+	$viewable_array[]=',ogg';
+	$viewable_array[]=',ogx';
+	$viewable_array[]=',oga';
+	$viewable_array[]=',ogv';
+}
+if (api_browser_support('pdf')){
+	$viewable_array[]=',pdf';
+}
+
+$viewable = implode(" ",$viewable_array);
+$viewable = preg_replace('/\s+/', '', $viewable);//clean spaces
+
 	//print_r($viewable);
-	
-	define("CONFIG_VIEWABLE_VALID_EXTS", $viewable);
-	
-	//define invalid exts
-	define('CONFIG_UPLOAD_INVALID_EXTS', 'php,php3,php4,php5,php6,phps,phtml,asp,aspx,jsp,cfm,cfc,pl,jar,sh,cgi,js,exe,com,bat,pif,scr,msi,ws,wsc,wsf,vb,vbe,vbs,reg,dll,ini'); //For Chamilo added.
-	//Preview
-	define('CONFIG_IMG_THUMBNAIL_MAX_X', 100);
-	define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100);
-	define('CONFIG_THICKBOX_MAX_WIDTH', 400); //only for html, pdf, svg
-	define('CONFIG_THICKBOX_MAX_HEIGHT', 330);//only for html, pdf, svg
-
-
-		/**
-		 * CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8
-		 * Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT
-		 * Howerver, some Web Hosts do not have standard php.ini setting
-		 * which you will find the file manager can not locate your files correctly
-		 * if you do have such issue, please change it to fit your system.
-		 * so what should you to do get it
-		 *   1. create a php script file (let's call it document_root.php)
-		 *   2. add the following codes in in
-		 * 			<?php
-		 * 				echo dirname(__FILE__);
-		 * 			?>
-		 *   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
-		 *   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
-		 *   5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be
-		 *   6. enjoy it
-		 *
-		 */
-
-	// Modified by Ivan Tcholakov, JUN-2009.
-	//define('CONFIG_WEBSITE_DOCUMENT_ROOT', '');
-	define('CONFIG_WEBSITE_DOCUMENT_ROOT', rtrim(api_get_path(SYS_SERVER_ROOT_PATH), '/'));
-
-	//theme related setting
-			/*
-			*	options avaialbe for CONFIG_EDITOR_NAME are:
-					stand_alone
-					tinymce
-					fckeditor
-			*/
-	//CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8
-	define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'fckeditor')); // run mode fckeditor (Chamilo editor)
-	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
-	define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'thumbnail':'detail')); //thumbnail or detail
-	define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10000); //change 10 by 10000 while pagination is deactivated on Chamilo
-	define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
-
-
-	//General Option Declarations
-
-	//LANGAUGAE DECLARATIONNS
-	$ajaxfilemanager_code_translation_table = array('' => 'en', 'pt' => 'pt_pt', 'sr' => 'sr_latn');
-	$langajaxfilemanager  = strtolower(str_replace('-', '_', api_get_language_isocode()));
-	$langajaxfilemanager = isset($ajaxfilemanager_code_translation_table[$langajaxfilemanager]) ? $ajaxfilemanager_code_translation_table[$langajaxfilemanager] : $langajaxfilemanager;
-	$langajaxfilemanager = file_exists(api_get_path(SYS_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/langs/'.$langajaxfilemanager.'.php') ? $langajaxfilemanager : 'en';
-
-	define('CONFIG_LANG_INDEX', 'language'); //the index in the session
-	define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):$langajaxfilemanager)); //change it to be your language file base name, such en
-	// Language text direction.
-	define('CONFIG_LANG_TEXT_DIRECTION_DEFAULT', in_array(CONFIG_LANG_DEFAULT, array('ar', 'prs', 'he', 'ps', 'fa')) ? 'rtl' : 'ltr');
+
+define("CONFIG_VIEWABLE_VALID_EXTS", $viewable);
+
+//define invalid exts
+define('CONFIG_UPLOAD_INVALID_EXTS', 'php,php3,php4,php5,php6,phps,phtml,asp,aspx,jsp,cfm,cfc,pl,jar,sh,cgi,js,exe,com,bat,pif,scr,msi,ws,wsc,wsf,vb,vbe,vbs,reg,dll,ini'); //For Chamilo added.
+//Preview
+define('CONFIG_IMG_THUMBNAIL_MAX_X', 100);
+define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100);
+define('CONFIG_THICKBOX_MAX_WIDTH', 400); //only for html, pdf, svg
+define('CONFIG_THICKBOX_MAX_HEIGHT', 330);//only for html, pdf, svg
+
+
+/**
+ * CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8
+* Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT
+* Howerver, some Web Hosts do not have standard php.ini setting
+ * which you will find the file manager can not locate your files correctly
+* if you do have such issue, please change it to fit your system.
+* so what should you to do get it
+*   1. create a php script file (let's call it document_root.php)
+*   2. add the following codes in in
+* 			<?php
+* 				echo dirname(__FILE__);
+* 			?>
+*   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
+*   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
+*   5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be
+*   6. enjoy it
+*
+*/
+
+// Modified by Ivan Tcholakov, JUN-2009.
+//define('CONFIG_WEBSITE_DOCUMENT_ROOT', '');
+define('CONFIG_WEBSITE_DOCUMENT_ROOT', rtrim(api_get_path(SYS_SERVER_ROOT_PATH), '/'));
+
+//theme related setting
+/*
+*	options avaialbe for CONFIG_EDITOR_NAME are:
+stand_alone
+tinymce
+fckeditor
+*/
+//CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8
+define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'fckeditor')); // run mode fckeditor (Chamilo editor)
+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
+define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'thumbnail':'detail')); //thumbnail or detail
+define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10000); //change 10 by 10000 while pagination is deactivated on Chamilo
+define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
+
+
+//General Option Declarations
+
+//LANGAUGAE DECLARATIONNS
+$ajaxfilemanager_code_translation_table = array('' => 'en', 'pt' => 'pt_pt', 'sr' => 'sr_latn');
+$langajaxfilemanager  = strtolower(str_replace('-', '_', api_get_language_isocode()));
+$langajaxfilemanager = isset($ajaxfilemanager_code_translation_table[$langajaxfilemanager]) ? $ajaxfilemanager_code_translation_table[$langajaxfilemanager] : $langajaxfilemanager;
+$langajaxfilemanager = file_exists(api_get_path(SYS_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/langs/'.$langajaxfilemanager.'.php') ? $langajaxfilemanager : 'en';
+
+define('CONFIG_LANG_INDEX', 'language'); //the index in the session
+define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):$langajaxfilemanager)); //change it to be your language file base name, such en
+// Language text direction.
+define('CONFIG_LANG_TEXT_DIRECTION_DEFAULT', in_array(CONFIG_LANG_DEFAULT, array('ar', 'prs', 'he', 'ps', 'fa')) ? 'rtl' : 'ltr');

+ 117 - 119
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.php

@@ -1,121 +1,119 @@
 <?php
-	/**
-	 * system  config setting
-	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
-	 * @link www.phpletter.com
-	 * @version 1.0
-	 * @since 22/April/2007
-	 *
-	 * Modifications of system config setting for Chamilo
-	 * @author Juan Carlos Raña Trabado
-	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2011 Fixing bugs
-	 * 
-	 * @since 31/December/2008
-	 */
-
-	// Loading the global initialization file.
-	require_once '../../../../../../inc/global.inc.php';
-
-	// Loading document repositories settings.
-	require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php' ;
-
-	//FILESYSTEM CONFIG	<br>
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php");
-	define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration
-
-	if(!headers_sent()) {
-		header('Content-Type: text/html; charset=utf-8');
-	}
-
-	/**
-	 * secure file name which retrieve from query string
-	 *
-	 * @param string $input
-	 * @return string
-	 */
-	function secureFileName($input)
-	{
-		return preg_replace('/[^a-zA-Z0-9\-_]/', '', $input);
-	}
-	//Directories Declarations
-
-	define('DIR_AJAX_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR) ; // the path to ajax file manager
-	define('DIR_AJAX_INC', DIR_AJAX_ROOT . "inc" . DIRECTORY_SEPARATOR);
-	define('DIR_AJAX_CLASSES', DIR_AJAX_ROOT .  "classes" . DIRECTORY_SEPARATOR);
-	define("DIR_AJAX_LANGS", DIR_AJAX_ROOT . "langs" . DIRECTORY_SEPARATOR);
-	define('DIR_AJAX_JS', DIR_AJAX_ROOT . 'jscripts' . DIRECTORY_SEPARATOR);
-	define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS . 'edit_area' . DIRECTORY_SEPARATOR);
-	define('DIR_LANG', DIR_AJAX_ROOT . 'langs' . DIRECTORY_SEPARATOR);
-
-
-	//Class Declarations
-	define('CLASS_FILE', DIR_AJAX_INC .'class.file.php');
-	define("CLASS_UPLOAD", DIR_AJAX_INC .  'class.upload.php');
-	define('CLASS_MANAGER', DIR_AJAX_INC . 'class.manager.php');
-	define('CLASS_IMAGE', DIR_AJAX_INC . "class.image.php");
-	define('CLASS_HISTORY', DIR_AJAX_INC . "class.history.php");
-	define('CLASS_SESSION_ACTION', DIR_AJAX_INC . "class.sessionaction.php");
-	define('CLASS_PAGINATION', DIR_AJAX_INC . 'class.pagination.php');
-	define('CLASS_SEARCH', DIR_AJAX_INC . "class.search.php");
-	//SCRIPT FILES declarations
-	define('SPT_FUNCTION_BASE', DIR_AJAX_INC . 'function.base.php');
-	//include different config base file according to query string "config"
-	$configBaseFileName = 'config.base.php';
-
-	if(CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.' . secureFileName($_GET['config']) . ".php")
-	{
-		$configBaseFileName = 'config.' . secureFileName($_GET['config']) . ".php";
-	}
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . $configBaseFileName);
-
-	// Loading the selected language file.
-	require_once(DIR_AJAX_LANGS . CONFIG_LANG_DEFAULT . ".php");
-	// In order the manager not to look ugly in cases of incompleted translations,
-	// we will initialize undefined language constants with English strings.
-	if (CONFIG_LANG_DEFAULT != "en")
-	{
-		require_once(DIR_AJAX_LANGS . "en.php");
-	}
-
-	require_once(DIR_AJAX_INC . "function.base.php");
-
-	require_once(dirname(__FILE__) .  DIRECTORY_SEPARATOR . "class.session.php");
-
-	$auth = new Auth();
-
-	if(CONFIG_ACCESS_CONTROL_MODE == 1)
-	{//access control enabled
-		if(!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE))))
-		{//
-			header('Location: ' . appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString()));
-			exit;
-		}
+/**
+ * system  config setting
+ * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @link www.phpletter.com
+ * @version 1.0
+ * @since 22/April/2007
+ *
+ * Modifications of system config setting for Chamilo
+ * @author Juan Carlos Raña Trabado
+ * @author Julio Montoya <gugli100@gmail.com> BeezNest 2011 Fixing bugs
+ * 
+ * @since 31/December/2008
+ */
+
+// Loading the global initialization file.
+require_once '../../../../../../inc/global.inc.php';
+
+// Loading document repositories settings.
+require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php' ;
+
+//FILESYSTEM CONFIG	<br>
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php");
+define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration
+
+if(!headers_sent()) {
+	header('Content-Type: text/html; charset=utf-8');
+}
+
+/**
+ * secure file name which retrieve from query string
+ *
+ * @param string $input
+ * @return string
+ */
+function secureFileName($input)
+{
+	return preg_replace('/[^a-zA-Z0-9\-_]/', '', $input);
+}
+//Directories Declarations
+
+define('DIR_AJAX_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR) ; // the path to ajax file manager
+define('DIR_AJAX_INC', DIR_AJAX_ROOT . "inc" . DIRECTORY_SEPARATOR);
+define('DIR_AJAX_CLASSES', DIR_AJAX_ROOT .  "classes" . DIRECTORY_SEPARATOR);
+define("DIR_AJAX_LANGS", DIR_AJAX_ROOT . "langs" . DIRECTORY_SEPARATOR);
+define('DIR_AJAX_JS', DIR_AJAX_ROOT . 'jscripts' . DIRECTORY_SEPARATOR);
+define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS . 'edit_area' . DIRECTORY_SEPARATOR);
+define('DIR_LANG', DIR_AJAX_ROOT . 'langs' . DIRECTORY_SEPARATOR);
+
+
+//Class Declarations
+define('CLASS_FILE', DIR_AJAX_INC .'class.file.php');
+define("CLASS_UPLOAD", DIR_AJAX_INC .  'class.upload.php');
+define('CLASS_MANAGER', DIR_AJAX_INC . 'class.manager.php');
+define('CLASS_IMAGE', DIR_AJAX_INC . "class.image.php");
+define('CLASS_HISTORY', DIR_AJAX_INC . "class.history.php");
+define('CLASS_SESSION_ACTION', DIR_AJAX_INC . "class.sessionaction.php");
+define('CLASS_PAGINATION', DIR_AJAX_INC . 'class.pagination.php');
+define('CLASS_SEARCH', DIR_AJAX_INC . "class.search.php");
+//SCRIPT FILES declarations
+define('SPT_FUNCTION_BASE', DIR_AJAX_INC . 'function.base.php');
+//include different config base file according to query string "config"
+$configBaseFileName = 'config.base.php';
+
+if(CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.' . secureFileName($_GET['config']) . ".php")
+{
+	$configBaseFileName = 'config.' . secureFileName($_GET['config']) . ".php";
+}
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . $configBaseFileName);
+
+// Loading the selected language file.
+require_once(DIR_AJAX_LANGS . CONFIG_LANG_DEFAULT . ".php");
+// In order the manager not to look ugly in cases of incompleted translations,
+// we will initialize undefined language constants with English strings.
+if (CONFIG_LANG_DEFAULT != "en")
+{
+	require_once(DIR_AJAX_LANGS . "en.php");
+}
+
+require_once(DIR_AJAX_INC . "function.base.php");
+
+require_once(dirname(__FILE__) .  DIRECTORY_SEPARATOR . "class.session.php");
+
+$auth = new Auth();
+
+if(CONFIG_ACCESS_CONTROL_MODE == 1)
+{//access control enabled
+	if(!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE))))
+	{//
+		header('Location: ' . appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString()));
+		exit;
 	}
-	addNoCacheHeaders();
-	$web_path = api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/';
-	//URL Declartions
-	define('CONFIG_URL_IMAGE_PREVIEW', 'ajax_image_preview.php');
-	define('CONFIG_URL_CREATE_FOLDER', 'ajax_create_folder.php');
-	define('CONFIG_URL_DELETE', 'ajax_delete_file.php');
-	define('CONFIG_URL_HOME', 'ajaxfilemanager.php');
-	define("CONFIG_URL_UPLOAD", 'ajax_file_upload.php');
-	define('CONFIG_URL_PREVIEW', 'ajax_preview.php');
-	define('CONFIG_URL_SAVE_NAME', 'ajax_save_name.php');
-	define('CONFIG_URL_IMAGE_EDITOR', 'ajax_image_editor.php');
-	define('CONFIG_URL_IMAGE_SAVE', 'ajax_image_save.php');
-	define('CONFIG_URL_IMAGE_RESET', 'ajax_editor_reset.php');
-	define('CONFIG_URL_IMAGE_UNDO', 'ajax_image_undo.php');
-	define('CONFIG_URL_CUT', 'ajax_file_cut.php');
-	define('CONFIG_URL_COPY', 'ajax_file_copy.php');
-	define('CONFIG_URL_LOAD_FOLDERS', '_ajax_load_folders.php');
-
-	define('CONFIG_URL_DOWNLOAD', 'ajax_download.php');
-	define('CONFIG_URL_TEXT_EDITOR', 'ajax_text_editor.php');
-	define('CONFIG_URL_GET_FOLDER_LIST', 'ajax_get_folder_listing.php');
-	define('CONFIG_URL_SAVE_TEXT', 'ajax_save_text.php');
-	define('CONFIG_URL_LIST_LISTING', 'ajax_get_file_listing.php');
-	define('CONFIG_URL_IMG_THUMBNAIL', $web_path.'ajax_image_thumbnail.php');
-	define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.php');
-	define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');
-
-?>
+}
+addNoCacheHeaders();
+$web_path = api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/';
+//URL Declartions
+define('CONFIG_URL_IMAGE_PREVIEW', 'ajax_image_preview.php');
+define('CONFIG_URL_CREATE_FOLDER', 'ajax_create_folder.php');
+define('CONFIG_URL_DELETE', 'ajax_delete_file.php');
+define('CONFIG_URL_HOME', 'ajaxfilemanager.php');
+define("CONFIG_URL_UPLOAD", 'ajax_file_upload.php');
+define('CONFIG_URL_PREVIEW', 'ajax_preview.php');
+define('CONFIG_URL_SAVE_NAME', 'ajax_save_name.php');
+define('CONFIG_URL_IMAGE_EDITOR', 'ajax_image_editor.php');
+define('CONFIG_URL_IMAGE_SAVE', 'ajax_image_save.php');
+define('CONFIG_URL_IMAGE_RESET', 'ajax_editor_reset.php');
+define('CONFIG_URL_IMAGE_UNDO', 'ajax_image_undo.php');
+define('CONFIG_URL_CUT', 'ajax_file_cut.php');
+define('CONFIG_URL_COPY', 'ajax_file_copy.php');
+define('CONFIG_URL_LOAD_FOLDERS', '_ajax_load_folders.php');
+
+define('CONFIG_URL_DOWNLOAD', 'ajax_download.php');
+define('CONFIG_URL_TEXT_EDITOR', 'ajax_text_editor.php');
+define('CONFIG_URL_GET_FOLDER_LIST', 'ajax_get_folder_listing.php');
+define('CONFIG_URL_SAVE_TEXT', 'ajax_save_text.php');
+define('CONFIG_URL_LIST_LISTING', 'ajax_get_file_listing.php');
+define('CONFIG_URL_IMG_THUMBNAIL', $web_path.'ajax_image_thumbnail.php');
+define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.php');
+define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');

+ 13 - 12
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php

@@ -8,16 +8,17 @@
      */
 require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "config.php";
 
-/**
- * force to ensure existence of stripos
- */
-if (!function_exists("stripos"))
-{
-  function stripos($str,$needle,$offset=0)
-  {
-      return @strpos(strtolower($str),strtolower($needle),$offset);
-  }
-}
+	/**
+	 * force to ensure existence of stripos
+	 */
+	if (!function_exists("stripos"))
+	{
+	  function stripos($str,$needle,$offset=0)
+	  {
+	      return @strpos(strtolower($str),strtolower($needle),$offset);
+	  }
+	}
+	
     /**
      * get the current Url but not the query string specified in $excls
      *
@@ -28,7 +29,7 @@ if (!function_exists("stripos"))
         $output = $_SERVER['PHP_SELF'];
         $count = 1;
         foreach($_GET as $k=>$v) {
-            if(array_search($k, $excls) ===false) {
+            if (array_search($k, $excls) ===false) {
                 $v = api_htmlentities(Security::remove_XSS($v));      
                 $strAppend = "&";
                 if($count == 1) {
@@ -37,7 +38,7 @@ if (!function_exists("stripos"))
                 }
                 $output .= $strAppend . $k . "=" . $v;
             }
-        }
+        }        
         return $output;
     }