Browse Source

Minor - format code, remove "each" call deprecated in PHP 7.2

jmontoyaa 7 years ago
parent
commit
23ad97173e
2 changed files with 3 additions and 4 deletions
  1. 2 3
      main/document/document_slideshow.inc.php
  2. 1 1
      main/inc/lib/document.lib.php

+ 2 - 3
main/document/document_slideshow.inc.php

@@ -37,12 +37,11 @@ if (isset($_GET['action']) && $_GET['action'] == 'exit_slideshow') {
 
 // We check if there are images in this folder by searching the extensions for .jpg, .gif, .png
 // grabbing the list of all the documents of this folder
-//$all_files = $fileList['name'];
 $array_to_search = !empty($documentAndFolders) && is_array($documentAndFolders) ? $documentAndFolders : [];
 
 if (count($array_to_search) > 0) {
-    while (list($key) = each($array_to_search)) {
-        $all_files[] = basename($array_to_search[$key]['path']);
+    foreach ($array_to_search as $file) {
+        $all_files[] = basename($file['path']);
     }
 }
 

+ 1 - 1
main/inc/lib/document.lib.php

@@ -294,7 +294,7 @@ class DocumentManager
         if (!is_file($full_file_name)) {
             return false;
         }
-        $filename = ($name == '') ? basename($full_file_name) : api_replace_dangerous_char($name);
+        $filename = $name == '' ? basename($full_file_name) : api_replace_dangerous_char($name);
         $len = filesize($full_file_name);
         // Fixing error when file name contains a ","
         $filename = str_replace(',', '', $filename);