Browse Source

Fixing PHP notices.

Julio Montoya 11 years ago
parent
commit
775f007028

+ 3 - 3
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php

@@ -8,7 +8,7 @@
  */
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
-
+$editor = isset($_GET['editor']) ? $_GET['editor'] : null;
 echo '<div id="content">';
 $count = 1;
 $thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL;
@@ -230,7 +230,7 @@ foreach ($fileList as $file) {
                         echo '&nbsp;';
                 }
 
-                if ($_GET['editor'] != 'stand_alone') {
+                if ($editor != 'stand_alone') {
                     $path_chamilo_file = '../'.$file['path']; // fix for makes a good show when pressed next on window preview, don't only one image
                 } else {
                     $path_chamilo_file = $file['path'];
@@ -255,4 +255,4 @@ foreach ($fileList as $file) {
     $count++;
 }
 ?>
-</div>
+</div>

+ 2 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php

@@ -14,6 +14,7 @@
 
 require_once '../../../../../../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
+$editor = isset($_GET['editor']) ? Security::remove_XSS($_GET['editor']) : null;
 
 require_once CLASS_SESSION_ACTION;
 $sessionAction = new SessionAction();
@@ -72,7 +73,7 @@ if (!empty($_GET['view'])) {
     <script type="text/javascript" src="jscripts/ajaxfilemanager.js"></script>
     <script type="text/javascript">
 
-        var mode_editor = '<?php echo Security::remove_XSS($_GET['editor']);?>';
+        var mode_editor = '<?php echo $editor;?>';
         <!-- Chamilo hack for general my files users  -->
         if (!mode_editor) {
             // Added by Ivan Tcholakov, 22-JUL-2009.

+ 5 - 3
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php

@@ -31,9 +31,11 @@ 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
 
+$editor = isset($_GET['editor']) ? Security::remove_XSS($_GET['editor']) : null;
+
 //User Permissions
 //Hack by Juan Carlos Raña Trabado
-if(empty($_course['path']) || Security::remove_XSS($_GET['editor'])=="stand_alone") {
+if(empty($_course['path']) || $editor =="stand_alone") {
 	define('CONFIG_OPTIONS_DELETE', true);
 	define('CONFIG_OPTIONS_CUT', true);
 	define('CONFIG_OPTIONS_COPY', true);
@@ -75,7 +77,7 @@ these two paths accept relative path only, don't use absolute path
 
 // Integration for Chamilo
 
-if(!empty($_course['path']) && Security::remove_XSS($_GET['editor'])!="stand_alone") {
+if(!empty($_course['path']) && $editor != "stand_alone") {
 	if(!empty($group_properties['directory'])) {
 		$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document'.$group_properties['directory'].'/';
 	} else {
@@ -205,7 +207,7 @@ 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_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($editor)?secureFileName($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

+ 5 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php

@@ -262,7 +262,11 @@ function getParentPath($value) {
  * @param string $value
  * @return  boolean
  */
-function isUnderRoot($value) {
+function isUnderRoot($value)
+{
+    if (empty($value)) {
+        return false;
+    }
     $roorPath = strtolower(addTrailingSlash(backslashToSlash(getRealPath(CONFIG_SYS_ROOT_PATH))));
     if (file_exists($value) && @strpos(strtolower(addTrailingSlash(backslashToSlash(getRealPath($value)))), $roorPath) === 0) {
         return true;