Ver código fonte

Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

Yannick Warnier 10 anos atrás
pai
commit
c5dccb4a6a

+ 2 - 2
main/admin/archive_cleanup.php

@@ -28,8 +28,8 @@ $message = null;
 
 if ($form->validate()) {
 	$archive_path = api_get_path(SYS_ARCHIVE_PATH);
-	$htaccess 	  = @file_get_contents($archive_path.'.htaccess');
-	$result 	  = rmdirr($archive_path, true);
+	$htaccess = @file_get_contents($archive_path.'.htaccess');
+	$result = rmdirr($archive_path, true, true);
 
 	if (!empty($htaccess)) {
 		@file_put_contents($archive_path.'/.htaccess', $htaccess);

+ 2 - 0
main/document/document.php

@@ -180,6 +180,8 @@ if (Portfolio::controller()->accept()) {
     Portfolio::controller()->run();
 }
 
+$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
+
 switch ($action) {
     case 'delete_item':
         if ($is_allowed_to_edit ||

+ 1 - 0
main/inc/ajax/document.ajax.php

@@ -5,6 +5,7 @@
  */
 require_once '../global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'document.lib.php';
+require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';
 
 $action = $_REQUEST['a'];
 switch ($action) {

+ 2 - 1
main/inc/lib/mail.lib.inc.php

@@ -39,7 +39,8 @@ function api_mail(
     $extra_headers = '',
     $additionalParameters = array()
 ) {
-    api_mail_html(
+    error_log("api_mail is deprecated. Using api_mail_html() on line ".__LINE__." of [".__FILE__."]");
+    return api_mail_html(
         $recipient_name,
         $recipient_email,
         $subject,

+ 11 - 2
main/inc/lib/main_api.lib.php

@@ -4284,12 +4284,13 @@ if (!function_exists('sys_get_temp_dir')) {
  * @version     1.0.3
  * @param       string   $dirname    Directory to delete
  * @param       bool     Deletes only the content or not
+ * @param       bool     $strict if one folder/file fails stop the loop
  * @return      bool     Returns TRUE on success, FALSE on failure
  * @link http://aidanlister.com/2004/04/recursively-deleting-a-folder-in-php/
  * @author      Yannick Warnier, adaptation for the Chamilo LMS, April, 2008
  * @author      Ivan Tcholakov, a sanity check about Directory class creation has been added, September, 2009
  */
-function rmdirr($dirname, $delete_only_content_in_folder = false) {
+function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) {
     $res = true;
 
     // A sanity check.
@@ -4318,7 +4319,15 @@ function rmdirr($dirname, $delete_only_content_in_folder = false) {
             }
 
             // Recurse.
-            rmdirr("$dirname/$entry");
+            if ($strict) {
+                $result = rmdirr("$dirname/$entry");
+                if ($result == false) {
+                    $res = false;
+                    break;
+                }
+            } else {
+                rmdirr("$dirname/$entry");
+            }
         }
     }