Completed
Pull Request — master (#628)
by Richard
19:02 queued 04:58
created
xoopseditor/tinymce4/external_plugins/filemanager/uploader/success.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
     <style>
6 6
 	body{padding:0px; margin:0px;}
7 7
     </style>
8
-    <meta http-equiv="refresh" content="3;url=index.php?path=<?php echo strip_tags(preg_replace( "/[^a-zA-Z0-9\.\[\]_| -]/", '',$_GET['path'])); ?>">
8
+    <meta http-equiv="refresh" content="3;url=index.php?path=<?php echo strip_tags(preg_replace("/[^a-zA-Z0-9\.\[\]_| -]/", '', $_GET['path'])); ?>">
9 9
   </head>
10 10
   <body>
11 11
     <center><br/><br/>
Please login to merge, or discard this patch.
class/xoopseditor/tinymce4/external_plugins/filemanager/uploader/index.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     if($path==$current_path)  $cycle=false;
18 18
     
19 19
     if(file_exists($path."config.php")){
20
-	require_once($path."config.php");
21
-	$cycle=false;
20
+    require_once($path."config.php");
21
+    $cycle=false;
22 22
     }
23 23
     $path=fix_dirname($path)."/";
24 24
 }
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
  * @param $file The array wich contains info about all uploaded files.
45 45
  */
46 46
 function handle_uploaded_files($juploadPhpSupportClass, $files) {
47
-	return
48
-		"<P>We are in the 'handle_uploaded_files' callback function, in the index.php script. To avoid double coding, we "
49
-		. "just call the default behavior of the JUpload PHP class. Just replace this by your code...</P>"
50
-		. $juploadPhpSupportClass->defaultAfterUploadManagement();
51
-		;
47
+    return
48
+        "<P>We are in the 'handle_uploaded_files' callback function, in the index.php script. To avoid double coding, we "
49
+        . "just call the default behavior of the JUpload PHP class. Just replace this by your code...</P>"
50
+        . $juploadPhpSupportClass->defaultAfterUploadManagement();
51
+        ;
52 52
 
53 53
 }
54 54
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
 // see all details http://jupload.sourceforge.net/howto-customization.html
66 66
 //
67 67
 $appletParameters = array(
68
-		//Default value is ... maximum size for a file on the current FS. 2G is problably too much already.
68
+        //Default value is ... maximum size for a file on the current FS. 2G is problably too much already.
69 69
         'maxFileSize' => $JAVAMaxSizeUpload.'G',
70 70
         //
71 71
         //In the sourceforge project structure, the applet jar file is one folder below. Default
72 72
         //configuration is ok, if wjhk.jupload.jar is in the same folder as the script containing this call.
73 73
         'archive' => 'wjhk.jupload.jar',
74
-	'showLogWindow' => 'false',
75
-	'width' => '100%',
76
-	'height' =>'358px',
77
-	'name' => 'No limit Uploader',
78
-	'allowedFileExtensions' => implode('/',$ext),
74
+    'showLogWindow' => 'false',
75
+    'width' => '100%',
76
+    'height' =>'358px',
77
+    'name' => 'No limit Uploader',
78
+    'allowedFileExtensions' => implode('/',$ext),
79 79
         //To manage, other jar files, like the ftp jar files if postURL is an FTP URL:
80 80
         //'archive' => 'wjhk.jupload.jar,jakarta-commons-oro.jar,jakarta-commons-net.jar',
81 81
         //
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 // for htaccess protected folders 
95 95
 if((isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') && $_SERVER['PHP_AUTH_USER'] != '' && $_SERVER['PHP_AUTH_USER'] != '') 
96 96
 {
97
-	$appletParameters['specificHeaders'] = 'Authorization: Basic '.base64_encode($_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']);
97
+    $appletParameters['specificHeaders'] = 'Authorization: Basic '.base64_encode($_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']);
98 98
 }
99 99
 
100 100
 //
101 101
 //Then: the jupload PHP class parameters
102 102
 $classParameters = array(
103
-		//Files won't be stored on the server. Useful for first tests of the applet behavior ... and sourceforge demo site !
103
+        //Files won't be stored on the server. Useful for first tests of the applet behavior ... and sourceforge demo site !
104 104
         'demo_mode' => false,
105 105
         //
106 106
         //Allow creation of subdirectories, when uploading several folders/files (drag and drop a folder on the applet to use it).
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include '../config/config.php';
4
-if(!$java_upload) die('forbidden');
5
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbidden');
4
+if (!$java_upload) die('forbidden');
5
+if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbidden');
6 6
 
7 7
 //Let's load the 'interesting' stuff ...  ;-)
8 8
 include 'jupload.php';
9 9
 include '../include/utils.php';
10 10
 
11
-$path=$current_path.$_GET['path'];
12
-$cycle=true;
13
-$max_cycles=50;
14
-$i=0;
15
-while($cycle && $i<$max_cycles){
11
+$path = $current_path.$_GET['path'];
12
+$cycle = true;
13
+$max_cycles = 50;
14
+$i = 0;
15
+while ($cycle && $i < $max_cycles) {
16 16
     $i++;
17
-    if($path==$current_path)  $cycle=false;
17
+    if ($path == $current_path)  $cycle = false;
18 18
     
19
-    if(file_exists($path."config.php")){
19
+    if (file_exists($path."config.php")) {
20 20
 	require_once($path."config.php");
21
-	$cycle=false;
21
+	$cycle = false;
22 22
     }
23
-    $path=fix_dirname($path)."/";
23
+    $path = fix_dirname($path)."/";
24 24
 }
25 25
 
26
-$path="../".$current_path.$_GET['path'];
26
+$path = "../".$current_path.$_GET['path'];
27 27
 
28
-if(strpos($_GET['path'],'../')!==FALSE || strpos($_GET['path'],'./')!==FALSE || strpos($_GET['path'],'/')===0) die ('path error');
28
+if (strpos($_GET['path'], '../') !== FALSE || strpos($_GET['path'], './') !== FALSE || strpos($_GET['path'], '/') === 0) die ('path error');
29 29
 
30
-$path=str_replace(' ','~',$path);
30
+$path = str_replace(' ', '~', $path);
31 31
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
32 32
 ///////////////   The user callback function, that can be called after upload   ////////////////////////
33 33
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	'width' => '100%',
76 76
 	'height' =>'358px',
77 77
 	'name' => 'No limit Uploader',
78
-	'allowedFileExtensions' => implode('/',$ext),
78
+	'allowedFileExtensions' => implode('/', $ext),
79 79
         //To manage, other jar files, like the ftp jar files if postURL is an FTP URL:
80 80
         //'archive' => 'wjhk.jupload.jar,jakarta-commons-oro.jar,jakarta-commons-net.jar',
81 81
         //
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     );
93 93
 
94 94
 // for htaccess protected folders 
95
-if((isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') && $_SERVER['PHP_AUTH_USER'] != '' && $_SERVER['PHP_AUTH_USER'] != '') 
95
+if ((isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') && $_SERVER['PHP_AUTH_USER'] != '' && $_SERVER['PHP_AUTH_USER'] != '') 
96 96
 {
97 97
 	$appletParameters['specificHeaders'] = 'Authorization: Basic '.base64_encode($_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']);
98 98
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include '../config/config.php';
4
-if(!$java_upload) die('forbidden');
5
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbidden');
4
+if(!$java_upload) {
5
+    die('forbidden');
6
+}
7
+if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") {
8
+    die('forbidden');
9
+}
6 10
 
7 11
 //Let's load the 'interesting' stuff ...  ;-)
8 12
 include 'jupload.php';
@@ -14,7 +18,9 @@  discard block
 block discarded – undo
14 18
 $i=0;
15 19
 while($cycle && $i<$max_cycles){
16 20
     $i++;
17
-    if($path==$current_path)  $cycle=false;
21
+    if($path==$current_path) {
22
+        $cycle=false;
23
+    }
18 24
     
19 25
     if(file_exists($path."config.php")){
20 26
 	require_once($path."config.php");
@@ -25,7 +31,9 @@  discard block
 block discarded – undo
25 31
 
26 32
 $path="../".$current_path.$_GET['path'];
27 33
 
28
-if(strpos($_GET['path'],'../')!==FALSE || strpos($_GET['path'],'./')!==FALSE || strpos($_GET['path'],'/')===0) die ('path error');
34
+if(strpos($_GET['path'],'../')!==FALSE || strpos($_GET['path'],'./')!==FALSE || strpos($_GET['path'],'/')===0) {
35
+    die ('path error');
36
+}
29 37
 
30 38
 $path=str_replace(' ','~',$path);
31 39
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
Please login to merge, or discard this patch.
class/xoopseditor/tinymce4/external_plugins/filemanager/ajax_calls.php 3 patches
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -5,137 +5,137 @@  discard block
 block discarded – undo
5 5
 include('include/utils.php');
6 6
 
7 7
 if (isset($_SESSION['RF']['language_file']) && file_exists($_SESSION['RF']['language_file'])){
8
-	include($_SESSION['RF']['language_file']);
8
+    include($_SESSION['RF']['language_file']);
9 9
 }
10 10
 else {
11
-	die('Language file is missing!');
11
+    die('Language file is missing!');
12 12
 }
13 13
 
14 14
 if(isset($_GET['action'])) 
15 15
 {
16 16
     switch($_GET['action']) 
17 17
     {
18
-		case 'view':
19
-		    if(isset($_GET['type'])) {
20
-				$_SESSION['RF']["view_type"] = $_GET['type'];
21
-			}
22
-			else {
23
-				die('view type number missing');
24
-			}
25
-			break;
26
-		case 'sort':
27
-			if(isset($_GET['sort_by'])) {
28
-				$_SESSION['RF']["sort_by"] = $_GET['sort_by'];
29
-			}
18
+        case 'view':
19
+            if(isset($_GET['type'])) {
20
+                $_SESSION['RF']["view_type"] = $_GET['type'];
21
+            }
22
+            else {
23
+                die('view type number missing');
24
+            }
25
+            break;
26
+        case 'sort':
27
+            if(isset($_GET['sort_by'])) {
28
+                $_SESSION['RF']["sort_by"] = $_GET['sort_by'];
29
+            }
30 30
 			
31
-			if(isset($_GET['descending'])) {
32
-				$_SESSION['RF']["descending"] = $_GET['descending'] === "TRUE";
33
-			}
34
-			break;
35
-		case 'image_size': // not used
36
-	    	$pos = strpos($_POST['path'],$upload_dir);
37
-			if ($pos !== FALSE) 
38
-			{
39
-				$info=getimagesize(substr_replace($_POST['path'],$current_path,$pos,strlen($upload_dir)));
40
-				echo json_encode($info);
41
-			}
42
-	    	break;
43
-		case 'save_img':
44
-		    $info=pathinfo($_POST['name']);
31
+            if(isset($_GET['descending'])) {
32
+                $_SESSION['RF']["descending"] = $_GET['descending'] === "TRUE";
33
+            }
34
+            break;
35
+        case 'image_size': // not used
36
+            $pos = strpos($_POST['path'],$upload_dir);
37
+            if ($pos !== FALSE) 
38
+            {
39
+                $info=getimagesize(substr_replace($_POST['path'],$current_path,$pos,strlen($upload_dir)));
40
+                echo json_encode($info);
41
+            }
42
+            break;
43
+        case 'save_img':
44
+            $info=pathinfo($_POST['name']);
45 45
 
46
-		    if (strpos($_POST['path'], '/') === 0
47
-			|| strpos($_POST['path'], '../') !== FALSE
48
-			|| strpos($_POST['path'], './') === 0
49
-			|| strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0
50
-			|| $_POST['name'] != fix_filename($_POST['name'], $transliteration)
51
-			|| !in_array(strtolower($info['extension']), array('jpg','jpeg','png')))
52
-		    {
53
-			    die('wrong data');
54
-			}
46
+            if (strpos($_POST['path'], '/') === 0
47
+            || strpos($_POST['path'], '../') !== FALSE
48
+            || strpos($_POST['path'], './') === 0
49
+            || strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0
50
+            || $_POST['name'] != fix_filename($_POST['name'], $transliteration)
51
+            || !in_array(strtolower($info['extension']), array('jpg','jpeg','png')))
52
+            {
53
+                die('wrong data');
54
+            }
55 55
 
56
-		    $image_data = get_file_by_url($_POST['url']);
57
-		    if ($image_data === FALSE) 
58
-		    {
59
-		        die(lang_Aviary_No_Save);
60
-		    }
56
+            $image_data = get_file_by_url($_POST['url']);
57
+            if ($image_data === FALSE) 
58
+            {
59
+                die(lang_Aviary_No_Save);
60
+            }
61 61
 
62
-		    file_put_contents($current_path.$_POST['path'].$_POST['name'],$image_data);
62
+            file_put_contents($current_path.$_POST['path'].$_POST['name'],$image_data);
63 63
 
64
-		    create_img_gd($current_path.$_POST['path'].$_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
65
-		    // TODO something with this function cause its blowing my mind
66
-		    new_thumbnails_creation($current_path.$_POST['path'],$current_path.$_POST['path'].$_POST['name'],$_POST['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height);
67
-		    break;
68
-		case 'extract':
69
-		    if(strpos($_POST['path'],'/')===0 || strpos($_POST['path'],'../')!==FALSE || strpos($_POST['path'],'./')===0) {
70
-				die('wrong path');
71
-			}
64
+            create_img_gd($current_path.$_POST['path'].$_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
65
+            // TODO something with this function cause its blowing my mind
66
+            new_thumbnails_creation($current_path.$_POST['path'],$current_path.$_POST['path'].$_POST['name'],$_POST['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height);
67
+            break;
68
+        case 'extract':
69
+            if(strpos($_POST['path'],'/')===0 || strpos($_POST['path'],'../')!==FALSE || strpos($_POST['path'],'./')===0) {
70
+                die('wrong path');
71
+            }
72 72
 
73
-		    $path = $current_path.$_POST['path'];
74
-		    $info = pathinfo($path);
75
-		    $base_folder = $current_path.fix_dirname($_POST['path'])."/";
73
+            $path = $current_path.$_POST['path'];
74
+            $info = pathinfo($path);
75
+            $base_folder = $current_path.fix_dirname($_POST['path'])."/";
76 76
 
77
-		    switch($info['extension'])
78
-		    {
79
-				case "zip":
80
-				    $zip = new ZipArchive;
81
-				    if ($zip->open($path) === TRUE) {
82
-						//make all the folders
83
-						for($i = 0; $i < $zip->numFiles; $i++) 
84
-						{ 
85
-						    $OnlyFileName = $zip->getNameIndex($i);
86
-						    $FullFileName = $zip->statIndex($i);    
87
-						    if (substr($FullFileName['name'], -1, 1) ==="/")
88
-						    {
89
-								create_folder($base_folder.$FullFileName['name']);
90
-						    }
91
-						}
92
-						//unzip into the folders
93
-						for($i = 0; $i < $zip->numFiles; $i++) 
94
-						{ 
95
-						    $OnlyFileName = $zip->getNameIndex($i);
96
-						    $FullFileName = $zip->statIndex($i);    
77
+            switch($info['extension'])
78
+            {
79
+                case "zip":
80
+                    $zip = new ZipArchive;
81
+                    if ($zip->open($path) === TRUE) {
82
+                        //make all the folders
83
+                        for($i = 0; $i < $zip->numFiles; $i++) 
84
+                        { 
85
+                            $OnlyFileName = $zip->getNameIndex($i);
86
+                            $FullFileName = $zip->statIndex($i);    
87
+                            if (substr($FullFileName['name'], -1, 1) ==="/")
88
+                            {
89
+                                create_folder($base_folder.$FullFileName['name']);
90
+                            }
91
+                        }
92
+                        //unzip into the folders
93
+                        for($i = 0; $i < $zip->numFiles; $i++) 
94
+                        { 
95
+                            $OnlyFileName = $zip->getNameIndex($i);
96
+                            $FullFileName = $zip->statIndex($i);    
97 97
 					    
98
-						    if (!(substr($FullFileName['name'], -1, 1) ==="/"))
99
-						    {
100
-								$fileinfo = pathinfo($OnlyFileName);
101
-								if(in_array(strtolower($fileinfo['extension']),$ext))
102
-								{
103
-								    copy('zip://'. $path .'#'. $OnlyFileName , $base_folder.$FullFileName['name'] ); 
104
-								} 
105
-						    }
106
-						}
107
-						$zip->close();
108
-				    }
109
-				    else {
110
-						die(lang_Zip_No_Extract);
111
-				    }
98
+                            if (!(substr($FullFileName['name'], -1, 1) ==="/"))
99
+                            {
100
+                                $fileinfo = pathinfo($OnlyFileName);
101
+                                if(in_array(strtolower($fileinfo['extension']),$ext))
102
+                                {
103
+                                    copy('zip://'. $path .'#'. $OnlyFileName , $base_folder.$FullFileName['name'] ); 
104
+                                } 
105
+                            }
106
+                        }
107
+                        $zip->close();
108
+                    }
109
+                    else {
110
+                        die(lang_Zip_No_Extract);
111
+                    }
112 112
 
113
-				    break;
113
+                    break;
114 114
 
115
-				case "gz":
116
-				    $p = new PharData($path);
117
-				    $p->decompress(); // creates files.tar
115
+                case "gz":
116
+                    $p = new PharData($path);
117
+                    $p->decompress(); // creates files.tar
118 118
 
119
-				    break;
119
+                    break;
120 120
 
121
-				case "tar":
122
-				    // unarchive from the tar
123
-				    $phar = new PharData($path);
124
-				    $phar->decompressFiles();
125
-				    $files = array();
126
-				    check_files_extensions_on_phar( $phar, $files, '', $ext );
127
-				    $phar->extractTo( $current_path.fix_dirname( $_POST['path'] )."/", $files, TRUE );
121
+                case "tar":
122
+                    // unarchive from the tar
123
+                    $phar = new PharData($path);
124
+                    $phar->decompressFiles();
125
+                    $files = array();
126
+                    check_files_extensions_on_phar( $phar, $files, '', $ext );
127
+                    $phar->extractTo( $current_path.fix_dirname( $_POST['path'] )."/", $files, TRUE );
128 128
 
129
-				    break;
129
+                    break;
130 130
 
131
-				default:
132
-					die(lang_Zip_Invalid);
133
-		    }
134
-		    break;
135
-		case 'media_preview':    
136
-			$preview_file = $_GET["file"];
137
-			$info = pathinfo($preview_file);
138
-			?>
131
+                default:
132
+                    die(lang_Zip_Invalid);
133
+            }
134
+            break;
135
+        case 'media_preview':    
136
+            $preview_file = $_GET["file"];
137
+            $info = pathinfo($preview_file);
138
+            ?>
139 139
 			<div id="jp_container_1" class="jp-video " style="margin:0 auto;">
140 140
 			    <div class="jp-type-single">
141 141
 			      <div id="jquery_jplayer_1" class="jp-jplayer"></div>
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 			    </div>
185 185
 			  </div>
186 186
 			<?php
187
-			if(in_array(strtolower($info['extension']), $ext_music)) {
188
-			?>
187
+            if(in_array(strtolower($info['extension']), $ext_music)) {
188
+            ?>
189 189
 
190 190
 				<script type="text/javascript">
191 191
 				    $(document).ready(function(){
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 				  </script>
211 211
 
212 212
 			<?php
213
-			} elseif(in_array(strtolower($info['extension']), $ext_video)) {
214
-			?>
213
+            } elseif(in_array(strtolower($info['extension']), $ext_video)) {
214
+            ?>
215 215
 			    
216 216
 			    <script type="text/javascript">
217 217
 			    $(document).ready(function(){
@@ -235,63 +235,63 @@  discard block
 block discarded – undo
235 235
 			  </script>
236 236
 			    
237 237
 			<?php
238
-			}
239
-			break;
240
-		case 'copy_cut':
241
-			if ($_POST['sub_action'] !== 'copy' && $_POST['sub_action'] !== 'cut') {
242
-				die('wrong sub-action');
243
-			}
238
+            }
239
+            break;
240
+        case 'copy_cut':
241
+            if ($_POST['sub_action'] !== 'copy' && $_POST['sub_action'] !== 'cut') {
242
+                die('wrong sub-action');
243
+            }
244 244
 
245
-			if (trim($_POST['path']) == '' || trim($_POST['path_thumb']) == '') {
246
-				die('no path');
247
-			}
245
+            if (trim($_POST['path']) == '' || trim($_POST['path_thumb']) == '') {
246
+                die('no path');
247
+            }
248 248
 
249
-			$path = $current_path.$_POST['path'];
250
-		    $info = pathinfo($path);
251
-		    $base_folder = $current_path.fix_dirname($_POST['path'])."/";
249
+            $path = $current_path.$_POST['path'];
250
+            $info = pathinfo($path);
251
+            $base_folder = $current_path.fix_dirname($_POST['path'])."/";
252 252
 
253
-			if (is_dir($path))
254
-			{
255
-				// can't copy/cut dirs
256
-				if ($copy_cut_dirs === FALSE){
257
-					die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Folders));
258
-				}
253
+            if (is_dir($path))
254
+            {
255
+                // can't copy/cut dirs
256
+                if ($copy_cut_dirs === FALSE){
257
+                    die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Folders));
258
+                }
259 259
 
260
-				// size over limit
261
-				if ($copy_cut_max_size !== FALSE && is_int($copy_cut_max_size)){
262
-					if (($copy_cut_max_size * 1024 * 1024) < foldersize($path)){
263
-						die(sprintf(lang_Copy_Cut_Size_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_size));
264
-					}
265
-				}
260
+                // size over limit
261
+                if ($copy_cut_max_size !== FALSE && is_int($copy_cut_max_size)){
262
+                    if (($copy_cut_max_size * 1024 * 1024) < foldersize($path)){
263
+                        die(sprintf(lang_Copy_Cut_Size_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_size));
264
+                    }
265
+                }
266 266
 
267
-				// file count over limit
268
-				if ($copy_cut_max_count !== FALSE && is_int($copy_cut_max_count)){
269
-					if ($copy_cut_max_count < filescount($path)){
270
-						die(sprintf(lang_Copy_Cut_Count_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_count));
271
-					}
272
-				}
273
-			}
274
-			else {
275
-				// can't copy/cut files
276
-				if ($copy_cut_files === FALSE){
277
-					die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Files));
278
-				}
279
-			}
267
+                // file count over limit
268
+                if ($copy_cut_max_count !== FALSE && is_int($copy_cut_max_count)){
269
+                    if ($copy_cut_max_count < filescount($path)){
270
+                        die(sprintf(lang_Copy_Cut_Count_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_count));
271
+                    }
272
+                }
273
+            }
274
+            else {
275
+                // can't copy/cut files
276
+                if ($copy_cut_files === FALSE){
277
+                    die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Files));
278
+                }
279
+            }
280 280
 
281
-			$_SESSION['RF']['clipboard']['path'] = $path;
282
-			$_SESSION['RF']['clipboard']['path_thumb'] = $_POST['path_thumb'];
283
-			$_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
284
-			break;
285
-		case 'clear_clipboard':
286
-			$_SESSION['RF']['clipboard'] = NULL;
287
-			$_SESSION['RF']['clipboard_action'] = NULL;
288
-			break;
289
-	    default: die('no action passed');
281
+            $_SESSION['RF']['clipboard']['path'] = $path;
282
+            $_SESSION['RF']['clipboard']['path_thumb'] = $_POST['path_thumb'];
283
+            $_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
284
+            break;
285
+        case 'clear_clipboard':
286
+            $_SESSION['RF']['clipboard'] = NULL;
287
+            $_SESSION['RF']['clipboard_action'] = NULL;
288
+            break;
289
+        default: die('no action passed');
290 290
     }
291 291
 }
292 292
 else 
293 293
 {
294
-	die('no action passed');
294
+    die('no action passed');
295 295
 }
296 296
 
297 297
 ?>
298 298
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include('config/config.php');
4
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('Access Denied!');
4
+if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('Access Denied!');
5 5
 include('include/utils.php');
6 6
 
7
-if (isset($_SESSION['RF']['language_file']) && file_exists($_SESSION['RF']['language_file'])){
7
+if (isset($_SESSION['RF']['language_file']) && file_exists($_SESSION['RF']['language_file'])) {
8 8
 	include($_SESSION['RF']['language_file']);
9 9
 }
10 10
 else {
11 11
 	die('Language file is missing!');
12 12
 }
13 13
 
14
-if(isset($_GET['action'])) 
14
+if (isset($_GET['action'])) 
15 15
 {
16
-    switch($_GET['action']) 
16
+    switch ($_GET['action']) 
17 17
     {
18 18
 		case 'view':
19
-		    if(isset($_GET['type'])) {
19
+		    if (isset($_GET['type'])) {
20 20
 				$_SESSION['RF']["view_type"] = $_GET['type'];
21 21
 			}
22 22
 			else {
@@ -24,31 +24,31 @@  discard block
 block discarded – undo
24 24
 			}
25 25
 			break;
26 26
 		case 'sort':
27
-			if(isset($_GET['sort_by'])) {
27
+			if (isset($_GET['sort_by'])) {
28 28
 				$_SESSION['RF']["sort_by"] = $_GET['sort_by'];
29 29
 			}
30 30
 			
31
-			if(isset($_GET['descending'])) {
31
+			if (isset($_GET['descending'])) {
32 32
 				$_SESSION['RF']["descending"] = $_GET['descending'] === "TRUE";
33 33
 			}
34 34
 			break;
35 35
 		case 'image_size': // not used
36
-	    	$pos = strpos($_POST['path'],$upload_dir);
36
+	    	$pos = strpos($_POST['path'], $upload_dir);
37 37
 			if ($pos !== FALSE) 
38 38
 			{
39
-				$info=getimagesize(substr_replace($_POST['path'],$current_path,$pos,strlen($upload_dir)));
39
+				$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
40 40
 				echo json_encode($info);
41 41
 			}
42 42
 	    	break;
43 43
 		case 'save_img':
44
-		    $info=pathinfo($_POST['name']);
44
+		    $info = pathinfo($_POST['name']);
45 45
 
46 46
 		    if (strpos($_POST['path'], '/') === 0
47 47
 			|| strpos($_POST['path'], '../') !== FALSE
48 48
 			|| strpos($_POST['path'], './') === 0
49 49
 			|| strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0
50 50
 			|| $_POST['name'] != fix_filename($_POST['name'], $transliteration)
51
-			|| !in_array(strtolower($info['extension']), array('jpg','jpeg','png')))
51
+			|| !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png')))
52 52
 		    {
53 53
 			    die('wrong data');
54 54
 			}
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 		        die(lang_Aviary_No_Save);
60 60
 		    }
61 61
 
62
-		    file_put_contents($current_path.$_POST['path'].$_POST['name'],$image_data);
62
+		    file_put_contents($current_path.$_POST['path'].$_POST['name'], $image_data);
63 63
 
64 64
 		    create_img_gd($current_path.$_POST['path'].$_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
65 65
 		    // TODO something with this function cause its blowing my mind
66
-		    new_thumbnails_creation($current_path.$_POST['path'],$current_path.$_POST['path'].$_POST['name'],$_POST['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height);
66
+		    new_thumbnails_creation($current_path.$_POST['path'], $current_path.$_POST['path'].$_POST['name'], $_POST['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height);
67 67
 		    break;
68 68
 		case 'extract':
69
-		    if(strpos($_POST['path'],'/')===0 || strpos($_POST['path'],'../')!==FALSE || strpos($_POST['path'],'./')===0) {
69
+		    if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== FALSE || strpos($_POST['path'], './') === 0) {
70 70
 				die('wrong path');
71 71
 			}
72 72
 
@@ -74,33 +74,33 @@  discard block
 block discarded – undo
74 74
 		    $info = pathinfo($path);
75 75
 		    $base_folder = $current_path.fix_dirname($_POST['path'])."/";
76 76
 
77
-		    switch($info['extension'])
77
+		    switch ($info['extension'])
78 78
 		    {
79 79
 				case "zip":
80 80
 				    $zip = new ZipArchive;
81 81
 				    if ($zip->open($path) === TRUE) {
82 82
 						//make all the folders
83
-						for($i = 0; $i < $zip->numFiles; $i++) 
83
+						for ($i = 0; $i < $zip->numFiles; $i++) 
84 84
 						{ 
85 85
 						    $OnlyFileName = $zip->getNameIndex($i);
86 86
 						    $FullFileName = $zip->statIndex($i);    
87
-						    if (substr($FullFileName['name'], -1, 1) ==="/")
87
+						    if (substr($FullFileName['name'], -1, 1) === "/")
88 88
 						    {
89 89
 								create_folder($base_folder.$FullFileName['name']);
90 90
 						    }
91 91
 						}
92 92
 						//unzip into the folders
93
-						for($i = 0; $i < $zip->numFiles; $i++) 
93
+						for ($i = 0; $i < $zip->numFiles; $i++) 
94 94
 						{ 
95 95
 						    $OnlyFileName = $zip->getNameIndex($i);
96 96
 						    $FullFileName = $zip->statIndex($i);    
97 97
 					    
98
-						    if (!(substr($FullFileName['name'], -1, 1) ==="/"))
98
+						    if (!(substr($FullFileName['name'], -1, 1) === "/"))
99 99
 						    {
100 100
 								$fileinfo = pathinfo($OnlyFileName);
101
-								if(in_array(strtolower($fileinfo['extension']),$ext))
101
+								if (in_array(strtolower($fileinfo['extension']), $ext))
102 102
 								{
103
-								    copy('zip://'. $path .'#'. $OnlyFileName , $base_folder.$FullFileName['name'] ); 
103
+								    copy('zip://'.$path.'#'.$OnlyFileName, $base_folder.$FullFileName['name']); 
104 104
 								} 
105 105
 						    }
106 106
 						}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 				    $phar = new PharData($path);
124 124
 				    $phar->decompressFiles();
125 125
 				    $files = array();
126
-				    check_files_extensions_on_phar( $phar, $files, '', $ext );
127
-				    $phar->extractTo( $current_path.fix_dirname( $_POST['path'] )."/", $files, TRUE );
126
+				    check_files_extensions_on_phar($phar, $files, '', $ext);
127
+				    $phar->extractTo($current_path.fix_dirname($_POST['path'])."/", $files, TRUE);
128 128
 
129 129
 				    break;
130 130
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			    </div>
185 185
 			  </div>
186 186
 			<?php
187
-			if(in_array(strtolower($info['extension']), $ext_music)) {
187
+			if (in_array(strtolower($info['extension']), $ext_music)) {
188 188
 			?>
189 189
 
190 190
 				<script type="text/javascript">
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 				  </script>
211 211
 
212 212
 			<?php
213
-			} elseif(in_array(strtolower($info['extension']), $ext_video)) {
213
+			} elseif (in_array(strtolower($info['extension']), $ext_video)) {
214 214
 			?>
215 215
 			    
216 216
 			    <script type="text/javascript">
@@ -253,27 +253,27 @@  discard block
 block discarded – undo
253 253
 			if (is_dir($path))
254 254
 			{
255 255
 				// can't copy/cut dirs
256
-				if ($copy_cut_dirs === FALSE){
256
+				if ($copy_cut_dirs === FALSE) {
257 257
 					die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Folders));
258 258
 				}
259 259
 
260 260
 				// size over limit
261
-				if ($copy_cut_max_size !== FALSE && is_int($copy_cut_max_size)){
262
-					if (($copy_cut_max_size * 1024 * 1024) < foldersize($path)){
261
+				if ($copy_cut_max_size !== FALSE && is_int($copy_cut_max_size)) {
262
+					if (($copy_cut_max_size * 1024 * 1024) < foldersize($path)) {
263 263
 						die(sprintf(lang_Copy_Cut_Size_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_size));
264 264
 					}
265 265
 				}
266 266
 
267 267
 				// file count over limit
268
-				if ($copy_cut_max_count !== FALSE && is_int($copy_cut_max_count)){
269
-					if ($copy_cut_max_count < filescount($path)){
268
+				if ($copy_cut_max_count !== FALSE && is_int($copy_cut_max_count)) {
269
+					if ($copy_cut_max_count < filescount($path)) {
270 270
 						die(sprintf(lang_Copy_Cut_Count_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_count));
271 271
 					}
272 272
 				}
273 273
 			}
274 274
 			else {
275 275
 				// can't copy/cut files
276
-				if ($copy_cut_files === FALSE){
276
+				if ($copy_cut_files === FALSE) {
277 277
 					die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Files));
278 278
 				}
279 279
 			}
Please login to merge, or discard this patch.
Braces   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,13 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include('config/config.php');
4
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('Access Denied!');
4
+if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") {
5
+    die('Access Denied!');
6
+}
5 7
 include('include/utils.php');
6 8
 
7 9
 if (isset($_SESSION['RF']['language_file']) && file_exists($_SESSION['RF']['language_file'])){
8 10
 	include($_SESSION['RF']['language_file']);
9
-}
10
-else {
11
+} else {
11 12
 	die('Language file is missing!');
12 13
 }
13 14
 
@@ -18,8 +19,7 @@  discard block
 block discarded – undo
18 19
 		case 'view':
19 20
 		    if(isset($_GET['type'])) {
20 21
 				$_SESSION['RF']["view_type"] = $_GET['type'];
21
-			}
22
-			else {
22
+			} else {
23 23
 				die('view type number missing');
24 24
 			}
25 25
 			break;
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
105 105
 						    }
106 106
 						}
107 107
 						$zip->close();
108
-				    }
109
-				    else {
108
+				    } else {
110 109
 						die(lang_Zip_No_Extract);
111 110
 				    }
112 111
 
@@ -270,8 +269,7 @@  discard block
 block discarded – undo
270 269
 						die(sprintf(lang_Copy_Cut_Count_Limit, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), $copy_cut_max_count));
271 270
 					}
272 271
 				}
273
-			}
274
-			else {
272
+			} else {
275 273
 				// can't copy/cut files
276 274
 				if ($copy_cut_files === FALSE){
277 275
 					die(sprintf(lang_Copy_Cut_Not_Allowed, ($_POST['sub_action'] === 'copy' ? lcfirst(lang_Copy) : lcfirst(lang_Cut)), lang_Files));
@@ -288,8 +286,7 @@  discard block
 block discarded – undo
288 286
 			break;
289 287
 	    default: die('no action passed');
290 288
     }
291
-}
292
-else 
289
+} else 
293 290
 {
294 291
 	die('no action passed');
295 292
 }
Please login to merge, or discard this patch.
htdocs/class/xoopseditor/tinymce4/external_plugins/filemanager/upload.php 3 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
     $i++;
27 27
     if($path==$current_path)  $cycle=false;
28 28
     if(file_exists($path."config.php")){
29
-	require_once($path."config.php");
30
-	$cycle=false;
29
+    require_once($path."config.php");
30
+    $cycle=false;
31 31
     }
32 32
     $path=fix_dirname($path).'/';
33 33
 }
@@ -36,83 +36,83 @@  discard block
 block discarded – undo
36 36
 if (!empty($_FILES)) {
37 37
     $info=pathinfo($_FILES['file']['name']);
38 38
     if(in_array(fix_strtolower($info['extension']), $ext)){
39
-	$tempFile = $_FILES['file']['tmp_name'];   
39
+    $tempFile = $_FILES['file']['tmp_name'];   
40 40
 	  
41
-	$targetPath = $storeFolder;
42
-	$targetPathThumb = $storeFolderThumb;
43
-	$_FILES['file']['name'] = fix_filename($_FILES['file']['name'],$transliteration);
41
+    $targetPath = $storeFolder;
42
+    $targetPathThumb = $storeFolderThumb;
43
+    $_FILES['file']['name'] = fix_filename($_FILES['file']['name'],$transliteration);
44 44
 	 
45
-	if(file_exists($targetPath.$_FILES['file']['name'])){
46
-	    $i = 1;
47
-	    $info=pathinfo($_FILES['file']['name']);
48
-	    while(file_exists($targetPath.$info['filename']."_".$i.".".$info['extension'])) {
49
-		    $i++;
50
-	    }
51
-	    $_FILES['file']['name']=$info['filename']."_".$i.".".$info['extension'];
52
-	}
53
-	$targetFile =  $targetPath. $_FILES['file']['name']; 
54
-	$targetFileThumb =  $targetPathThumb. $_FILES['file']['name'];
45
+    if(file_exists($targetPath.$_FILES['file']['name'])){
46
+        $i = 1;
47
+        $info=pathinfo($_FILES['file']['name']);
48
+        while(file_exists($targetPath.$info['filename']."_".$i.".".$info['extension'])) {
49
+            $i++;
50
+        }
51
+        $_FILES['file']['name']=$info['filename']."_".$i.".".$info['extension'];
52
+    }
53
+    $targetFile =  $targetPath. $_FILES['file']['name']; 
54
+    $targetFileThumb =  $targetPathThumb. $_FILES['file']['name'];
55 55
 	
56
-	if(in_array(fix_strtolower($info['extension']),$ext_img)) $is_img=true;
57
-	else $is_img=false;
56
+    if(in_array(fix_strtolower($info['extension']),$ext_img)) $is_img=true;
57
+    else $is_img=false;
58 58
 	
59 59
 	
60
-	move_uploaded_file($tempFile,$targetFile);
61
-	chmod($targetFile, 0755);
60
+    move_uploaded_file($tempFile,$targetFile);
61
+    chmod($targetFile, 0755);
62 62
 	
63
-	if($is_img){
64
-	    $memory_error=false;
65
-	    if(!create_img_gd($targetFile, $targetFileThumb, 122, 91)){
66
-		$memory_error=false;
67
-	    }else{
68
-		if(!new_thumbnails_creation($targetPath,$targetFile,$_FILES['file']['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height)){
69
-		    $memory_error=false;
70
-		}else{		    
71
-		    $imginfo =getimagesize($targetFile);
72
-		    $srcWidth = $imginfo[0];
73
-		    $srcHeight = $imginfo[1];
63
+    if($is_img){
64
+        $memory_error=false;
65
+        if(!create_img_gd($targetFile, $targetFileThumb, 122, 91)){
66
+        $memory_error=false;
67
+        }else{
68
+        if(!new_thumbnails_creation($targetPath,$targetFile,$_FILES['file']['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height)){
69
+            $memory_error=false;
70
+        }else{		    
71
+            $imginfo =getimagesize($targetFile);
72
+            $srcWidth = $imginfo[0];
73
+            $srcHeight = $imginfo[1];
74 74
 		    
75
-		    if($image_resizing){
76
-			if($image_resizing_width==0){
77
-			    if($image_resizing_height==0){
78
-				$image_resizing_width=$srcWidth;
79
-				$image_resizing_height =$srcHeight;
80
-			    }else{
81
-				$image_resizing_width=$image_resizing_height*$srcWidth/$srcHeight;
82
-			}
83
-			}elseif($image_resizing_height==0){
84
-			    $image_resizing_height =$image_resizing_width*$srcHeight/$srcWidth;
85
-			}
86
-			$srcWidth=$image_resizing_width;
87
-			$srcHeight=$image_resizing_height;
88
-			create_img_gd($targetFile, $targetFile, $image_resizing_width, $image_resizing_height);
89
-		    }
90
-		    //max resizing limit control
91
-		    $resize=false;
92
-		    if($image_max_width!=0 && $srcWidth >$image_max_width){
93
-			$resize=true;
94
-			$srcHeight=$image_max_width*$srcHeight/$srcWidth;
95
-			$srcWidth=$image_max_width;
96
-		    }
97
-		    if($image_max_height!=0 && $srcHeight >$image_max_height){
98
-			$resize=true;
99
-			$srcWidth =$image_max_height*$srcWidth/$srcHeight;
100
-			$srcHeight =$image_max_height;
101
-		    }
102
-		    if($resize)
103
-			create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
104
-		}
105
-	    }		
106
-	    if($memory_error){
107
-		//error
108
-		unlink($targetFile);
109
-		header('HTTP/1.1 406 Not enought Memory',true,406);
110
-		exit();
111
-	    }
112
-	}
75
+            if($image_resizing){
76
+            if($image_resizing_width==0){
77
+                if($image_resizing_height==0){
78
+                $image_resizing_width=$srcWidth;
79
+                $image_resizing_height =$srcHeight;
80
+                }else{
81
+                $image_resizing_width=$image_resizing_height*$srcWidth/$srcHeight;
82
+            }
83
+            }elseif($image_resizing_height==0){
84
+                $image_resizing_height =$image_resizing_width*$srcHeight/$srcWidth;
85
+            }
86
+            $srcWidth=$image_resizing_width;
87
+            $srcHeight=$image_resizing_height;
88
+            create_img_gd($targetFile, $targetFile, $image_resizing_width, $image_resizing_height);
89
+            }
90
+            //max resizing limit control
91
+            $resize=false;
92
+            if($image_max_width!=0 && $srcWidth >$image_max_width){
93
+            $resize=true;
94
+            $srcHeight=$image_max_width*$srcHeight/$srcWidth;
95
+            $srcWidth=$image_max_width;
96
+            }
97
+            if($image_max_height!=0 && $srcHeight >$image_max_height){
98
+            $resize=true;
99
+            $srcWidth =$image_max_height*$srcWidth/$srcHeight;
100
+            $srcHeight =$image_max_height;
101
+            }
102
+            if($resize)
103
+            create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
104
+        }
105
+        }		
106
+        if($memory_error){
107
+        //error
108
+        unlink($targetFile);
109
+        header('HTTP/1.1 406 Not enought Memory',true,406);
110
+        exit();
111
+        }
112
+    }
113 113
     }else{
114
-	header('HTTP/1.1 406 file not permitted',true,406);
115
-	exit();
114
+    header('HTTP/1.1 406 file not permitted',true,406);
115
+    exit();
116 116
     }
117 117
 }else{
118 118
     header('HTTP/1.1 405 Bad Request', true, 405);
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,124 +1,124 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 include('config/config.php');
3
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbiden');
3
+if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbiden');
4 4
 include('include/utils.php');
5 5
 
6 6
 
7 7
 $storeFolder = $_POST['path'];
8 8
 $storeFolderThumb = $_POST['path_thumb'];
9 9
 
10
-$path_pos=strpos($storeFolder,$current_path);
11
-$thumb_pos=strpos($_POST['path_thumb'],$thumbs_base_path);
12
-if($path_pos!==0 
13
-    || $thumb_pos !==0
14
-    || strpos($storeFolderThumb,'../',strlen($thumbs_base_path))!==FALSE
15
-    || strpos($storeFolderThumb,'./',strlen($thumbs_base_path))!==FALSE
16
-    || strpos($storeFolder,'../',strlen($current_path))!==FALSE
17
-    || strpos($storeFolder,'./',strlen($current_path))!==FALSE )
10
+$path_pos = strpos($storeFolder, $current_path);
11
+$thumb_pos = strpos($_POST['path_thumb'], $thumbs_base_path);
12
+if ($path_pos !== 0 
13
+    || $thumb_pos !== 0
14
+    || strpos($storeFolderThumb, '../', strlen($thumbs_base_path)) !== FALSE
15
+    || strpos($storeFolderThumb, './', strlen($thumbs_base_path)) !== FALSE
16
+    || strpos($storeFolder, '../', strlen($current_path)) !== FALSE
17
+    || strpos($storeFolder, './', strlen($current_path)) !== FALSE)
18 18
     die('wrong path');
19 19
 
20 20
 
21
-$path=$storeFolder;
22
-$cycle=true;
23
-$max_cycles=50;
24
-$i=0;
25
-while($cycle && $i<$max_cycles){
21
+$path = $storeFolder;
22
+$cycle = true;
23
+$max_cycles = 50;
24
+$i = 0;
25
+while ($cycle && $i < $max_cycles) {
26 26
     $i++;
27
-    if($path==$current_path)  $cycle=false;
28
-    if(file_exists($path."config.php")){
27
+    if ($path == $current_path)  $cycle = false;
28
+    if (file_exists($path."config.php")) {
29 29
 	require_once($path."config.php");
30
-	$cycle=false;
30
+	$cycle = false;
31 31
     }
32
-    $path=fix_dirname($path).'/';
32
+    $path = fix_dirname($path).'/';
33 33
 }
34 34
 
35 35
 
36 36
 if (!empty($_FILES)) {
37
-    $info=pathinfo($_FILES['file']['name']);
38
-    if(in_array(fix_strtolower($info['extension']), $ext)){
37
+    $info = pathinfo($_FILES['file']['name']);
38
+    if (in_array(fix_strtolower($info['extension']), $ext)) {
39 39
 	$tempFile = $_FILES['file']['tmp_name'];   
40 40
 	  
41 41
 	$targetPath = $storeFolder;
42 42
 	$targetPathThumb = $storeFolderThumb;
43
-	$_FILES['file']['name'] = fix_filename($_FILES['file']['name'],$transliteration);
43
+	$_FILES['file']['name'] = fix_filename($_FILES['file']['name'], $transliteration);
44 44
 	 
45
-	if(file_exists($targetPath.$_FILES['file']['name'])){
45
+	if (file_exists($targetPath.$_FILES['file']['name'])) {
46 46
 	    $i = 1;
47
-	    $info=pathinfo($_FILES['file']['name']);
48
-	    while(file_exists($targetPath.$info['filename']."_".$i.".".$info['extension'])) {
47
+	    $info = pathinfo($_FILES['file']['name']);
48
+	    while (file_exists($targetPath.$info['filename']."_".$i.".".$info['extension'])) {
49 49
 		    $i++;
50 50
 	    }
51
-	    $_FILES['file']['name']=$info['filename']."_".$i.".".$info['extension'];
51
+	    $_FILES['file']['name'] = $info['filename']."_".$i.".".$info['extension'];
52 52
 	}
53
-	$targetFile =  $targetPath. $_FILES['file']['name']; 
54
-	$targetFileThumb =  $targetPathThumb. $_FILES['file']['name'];
53
+	$targetFile = $targetPath.$_FILES['file']['name']; 
54
+	$targetFileThumb = $targetPathThumb.$_FILES['file']['name'];
55 55
 	
56
-	if(in_array(fix_strtolower($info['extension']),$ext_img)) $is_img=true;
57
-	else $is_img=false;
56
+	if (in_array(fix_strtolower($info['extension']), $ext_img)) $is_img = true;
57
+	else $is_img = false;
58 58
 	
59 59
 	
60
-	move_uploaded_file($tempFile,$targetFile);
60
+	move_uploaded_file($tempFile, $targetFile);
61 61
 	chmod($targetFile, 0755);
62 62
 	
63
-	if($is_img){
64
-	    $memory_error=false;
65
-	    if(!create_img_gd($targetFile, $targetFileThumb, 122, 91)){
66
-		$memory_error=false;
67
-	    }else{
68
-		if(!new_thumbnails_creation($targetPath,$targetFile,$_FILES['file']['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height)){
69
-		    $memory_error=false;
70
-		}else{		    
71
-		    $imginfo =getimagesize($targetFile);
63
+	if ($is_img) {
64
+	    $memory_error = false;
65
+	    if (!create_img_gd($targetFile, $targetFileThumb, 122, 91)) {
66
+		$memory_error = false;
67
+	    } else {
68
+		if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height)) {
69
+		    $memory_error = false;
70
+		} else {		    
71
+		    $imginfo = getimagesize($targetFile);
72 72
 		    $srcWidth = $imginfo[0];
73 73
 		    $srcHeight = $imginfo[1];
74 74
 		    
75
-		    if($image_resizing){
76
-			if($image_resizing_width==0){
77
-			    if($image_resizing_height==0){
78
-				$image_resizing_width=$srcWidth;
79
-				$image_resizing_height =$srcHeight;
80
-			    }else{
81
-				$image_resizing_width=$image_resizing_height*$srcWidth/$srcHeight;
75
+		    if ($image_resizing) {
76
+			if ($image_resizing_width == 0) {
77
+			    if ($image_resizing_height == 0) {
78
+				$image_resizing_width = $srcWidth;
79
+				$image_resizing_height = $srcHeight;
80
+			    } else {
81
+				$image_resizing_width = $image_resizing_height * $srcWidth / $srcHeight;
82 82
 			}
83
-			}elseif($image_resizing_height==0){
84
-			    $image_resizing_height =$image_resizing_width*$srcHeight/$srcWidth;
83
+			}elseif ($image_resizing_height == 0) {
84
+			    $image_resizing_height = $image_resizing_width * $srcHeight / $srcWidth;
85 85
 			}
86
-			$srcWidth=$image_resizing_width;
87
-			$srcHeight=$image_resizing_height;
86
+			$srcWidth = $image_resizing_width;
87
+			$srcHeight = $image_resizing_height;
88 88
 			create_img_gd($targetFile, $targetFile, $image_resizing_width, $image_resizing_height);
89 89
 		    }
90 90
 		    //max resizing limit control
91
-		    $resize=false;
92
-		    if($image_max_width!=0 && $srcWidth >$image_max_width){
93
-			$resize=true;
94
-			$srcHeight=$image_max_width*$srcHeight/$srcWidth;
95
-			$srcWidth=$image_max_width;
91
+		    $resize = false;
92
+		    if ($image_max_width != 0 && $srcWidth > $image_max_width) {
93
+			$resize = true;
94
+			$srcHeight = $image_max_width * $srcHeight / $srcWidth;
95
+			$srcWidth = $image_max_width;
96 96
 		    }
97
-		    if($image_max_height!=0 && $srcHeight >$image_max_height){
98
-			$resize=true;
99
-			$srcWidth =$image_max_height*$srcWidth/$srcHeight;
100
-			$srcHeight =$image_max_height;
97
+		    if ($image_max_height != 0 && $srcHeight > $image_max_height) {
98
+			$resize = true;
99
+			$srcWidth = $image_max_height * $srcWidth / $srcHeight;
100
+			$srcHeight = $image_max_height;
101 101
 		    }
102
-		    if($resize)
102
+		    if ($resize)
103 103
 			create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
104 104
 		}
105 105
 	    }		
106
-	    if($memory_error){
106
+	    if ($memory_error) {
107 107
 		//error
108 108
 		unlink($targetFile);
109
-		header('HTTP/1.1 406 Not enought Memory',true,406);
109
+		header('HTTP/1.1 406 Not enought Memory', true, 406);
110 110
 		exit();
111 111
 	    }
112 112
 	}
113
-    }else{
114
-	header('HTTP/1.1 406 file not permitted',true,406);
113
+    } else {
114
+	header('HTTP/1.1 406 file not permitted', true, 406);
115 115
 	exit();
116 116
     }
117
-}else{
117
+} else {
118 118
     header('HTTP/1.1 405 Bad Request', true, 405);
119 119
     exit();
120 120
 }
121
-if(isset($_POST['submit'])){
121
+if (isset($_POST['submit'])) {
122 122
     $query = http_build_query(array(
123 123
         'type'      => $_POST['type'],
124 124
         'lang'      => $_POST['lang'],
@@ -126,5 +126,5 @@  discard block
 block discarded – undo
126 126
         'field_id'  => $_POST['field_id'],
127 127
         'fldr'      => $_POST['fldr'],
128 128
     ));
129
-    header("location: dialog.php?" . $query);
129
+    header("location: dialog.php?".$query);
130 130
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 include('config/config.php');
3
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbiden');
3
+if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") {
4
+    die('forbiden');
5
+}
4 6
 include('include/utils.php');
5 7
 
6 8
 
@@ -14,8 +16,9 @@  discard block
 block discarded – undo
14 16
     || strpos($storeFolderThumb,'../',strlen($thumbs_base_path))!==FALSE
15 17
     || strpos($storeFolderThumb,'./',strlen($thumbs_base_path))!==FALSE
16 18
     || strpos($storeFolder,'../',strlen($current_path))!==FALSE
17
-    || strpos($storeFolder,'./',strlen($current_path))!==FALSE )
19
+    || strpos($storeFolder,'./',strlen($current_path))!==FALSE ) {
18 20
     die('wrong path');
21
+}
19 22
 
20 23
 
21 24
 $path=$storeFolder;
@@ -24,7 +27,9 @@  discard block
 block discarded – undo
24 27
 $i=0;
25 28
 while($cycle && $i<$max_cycles){
26 29
     $i++;
27
-    if($path==$current_path)  $cycle=false;
30
+    if($path==$current_path) {
31
+        $cycle=false;
32
+    }
28 33
     if(file_exists($path."config.php")){
29 34
 	require_once($path."config.php");
30 35
 	$cycle=false;
@@ -53,8 +58,11 @@  discard block
 block discarded – undo
53 58
 	$targetFile =  $targetPath. $_FILES['file']['name']; 
54 59
 	$targetFileThumb =  $targetPathThumb. $_FILES['file']['name'];
55 60
 	
56
-	if(in_array(fix_strtolower($info['extension']),$ext_img)) $is_img=true;
57
-	else $is_img=false;
61
+	if(in_array(fix_strtolower($info['extension']),$ext_img)) {
62
+	    $is_img=true;
63
+	} else {
64
+	    $is_img=false;
65
+	}
58 66
 	
59 67
 	
60 68
 	move_uploaded_file($tempFile,$targetFile);
@@ -64,10 +72,10 @@  discard block
 block discarded – undo
64 72
 	    $memory_error=false;
65 73
 	    if(!create_img_gd($targetFile, $targetFileThumb, 122, 91)){
66 74
 		$memory_error=false;
67
-	    }else{
75
+	    } else{
68 76
 		if(!new_thumbnails_creation($targetPath,$targetFile,$_FILES['file']['name'],$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height)){
69 77
 		    $memory_error=false;
70
-		}else{		    
78
+		} else{		    
71 79
 		    $imginfo =getimagesize($targetFile);
72 80
 		    $srcWidth = $imginfo[0];
73 81
 		    $srcHeight = $imginfo[1];
@@ -77,10 +85,10 @@  discard block
 block discarded – undo
77 85
 			    if($image_resizing_height==0){
78 86
 				$image_resizing_width=$srcWidth;
79 87
 				$image_resizing_height =$srcHeight;
80
-			    }else{
88
+			    } else{
81 89
 				$image_resizing_width=$image_resizing_height*$srcWidth/$srcHeight;
82 90
 			}
83
-			}elseif($image_resizing_height==0){
91
+			} elseif($image_resizing_height==0){
84 92
 			    $image_resizing_height =$image_resizing_width*$srcHeight/$srcWidth;
85 93
 			}
86 94
 			$srcWidth=$image_resizing_width;
@@ -99,8 +107,9 @@  discard block
 block discarded – undo
99 107
 			$srcWidth =$image_max_height*$srcWidth/$srcHeight;
100 108
 			$srcHeight =$image_max_height;
101 109
 		    }
102
-		    if($resize)
103
-			create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
110
+		    if($resize) {
111
+		    			create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
112
+		    }
104 113
 		}
105 114
 	    }		
106 115
 	    if($memory_error){
@@ -110,11 +119,11 @@  discard block
 block discarded – undo
110 119
 		exit();
111 120
 	    }
112 121
 	}
113
-    }else{
122
+    } else{
114 123
 	header('HTTP/1.1 406 file not permitted',true,406);
115 124
 	exit();
116 125
     }
117
-}else{
126
+} else{
118 127
     header('HTTP/1.1 405 Bad Request', true, 405);
119 128
     exit();
120 129
 }
Please login to merge, or discard this patch.
tinymce4/external_plugins/filemanager/include/php_image_magician.php 3 patches
Indentation   +1067 added lines, -1067 removed lines patch added patch discarded remove patch
@@ -1,163 +1,163 @@  discard block
 block discarded – undo
1 1
 <?php
2
-   # ========================================================================#
3
-   #
4
-   #  This work is licensed under the Creative Commons Attribution 3.0 Unported
5
-   #  License. To view a copy of this license,
6
-   #  visit http://creativecommons.org/licenses/by/3.0/ or send a letter to
7
-   #  Creative Commons, 444 Castro Street, Suite 900, Mountain View, California,
8
-   #  94041, USA.
9
-   #
10
-   #  All rights reserved.
11
-   #
12
-   #  Author:    Jarrod Oberto
13
-   #  Version:   1.5.1
14
-   #  Date:      10-05-11
15
-   #  Purpose:   Provide tools for image manipulation using GD
16
-   #  Param In:  See functions.
17
-   #  Param Out: Produces a resized image
18
-   #  Requires : Requires PHP GD library.
19
-   #  Usage Example:
20
-   #                     include("lib/php_image_magician.php");
21
-   #                     $magicianObj = new resize('images/car.jpg');
22
-   #                     $magicianObj -> resizeImage(150, 100, 0);
23
-   #                     $magicianObj -> saveImage('images/car_small.jpg', 100);
24
-   #
25
-   #        - See end of doc for more examples -
26
-   #
27
-   #  Supported file types include: jpg, png, gif, bmp, psd (read)
28
-   #
29
-   #
30
-   #
31
-   #  The following functions are taken from phpThumb() [available from
32
-   #    http://phpthumb.sourceforge.net], and are used with written permission
33
-   #  from James Heinrich.
34
-   #    - GD2BMPstring
35
-   #      - GetPixelColor
36
-   #      - LittleEndian2String
37
-   #
38
-   #  The following functions are from Marc Hibbins and are used with written
39
-   #  permission (are also under the Attribution-ShareAlike
40
-   #  [http://creativecommons.org/licenses/by-sa/3.0/] license.
41
-   #    -
42
-   #
43
-   #  PhpPsdReader is used with written permission from Tim de Koning.
44
-   #  [http://www.kingsquare.nl/phppsdreader]
45
-   #
46
-   #
47
-   #
48
-   #  Modificatoin history
49
-   #  Date      Initials  Ver Description
50
-   #  10-05-11  J.C.O   0.0 Initial build
51
-   #  01-06-11  J.C.O   0.1.1   * Added reflections
52
-   #              * Added Rounded corners
53
-   #              * You can now use PNG interlacing
54
-   #              * Added shadow
55
-   #              * Added caption box
56
-   #              * Added vintage filter
57
-   #              * Added dynamic image resizing (resize on the fly)
58
-   #              * minor bug fixes
59
-   #  05-06-11  J.C.O   0.1.1.1 * Fixed undefined variables
60
-   #  17-06-11  J.C.O   0.1.2   * Added image_batch_class.php class
61
-   #              * Minor bug fixes
62
-   #  26-07-11  J.C.O   0.1.4 * Added support for external images
63
-   #              * Can now set the crop poisition
64
-   #  03-08-11  J.C.O   0.1.5 * Added reset() method to reset resource to
65
-   #                original input file.
66
-   #              * Added method addTextToCaptionBox() to
67
-   #                simplify adding text to a caption box.
68
-   #              * Added experimental writeIPTC. (not finished)
69
-   #              * Added experimental readIPTC. (not finished)
70
-   #  11-08-11  J.C.O     * Added initial border presets.
71
-   #  30-08-11  J.C.O     * Added 'auto' crop option to crop portrait
72
-   #                images near the top.
73
-   #  08-09-11  J.C.O     * Added cropImage() method to allow standalone
74
-   #                cropping.
75
-   #  17-09-11  J.C.O     * Added setCropFromTop() set method - set the
76
-   #                percentage to crop from the top when using
77
-   #                crop 'auto' option.
78
-   #              * Added setTransparency() set method - allows you
79
-   #                to turn transparency off (like when saving
80
-   #                as a jpg).
81
-   #              * Added setFillColor() set method - set the
82
-   #                background color to use instead of transparency.
83
-   #  05-11-11  J.C.O   0.1.5.1 * Fixed interlacing option
84
-   #  0-07-12  J.C.O   1.0
85
-   #
86
-   #  Known issues & Limitations:
87
-   # -------------------------------
88
-   #  Not so much an issue, the image is destroyed on the deconstruct rather than
89
-   #  when we have finished with it. The reason for this is that we don't know
90
-   #  when we're finished with it as you can both save the image and display
91
-   #  it directly to the screen (imagedestroy($this->imageResized))
92
-   #
93
-   #  Opening BMP files is slow. A test with 884 bmp files processed in a loop
94
-   #  takes forever - over 5 min. This test inlcuded opening the file, then
95
-   #  getting and displaying its width and height.
96
-   #
97
-   #  $forceStretch:
98
-   # -------------------------------
99
-   #  On by default.
100
-   #  $forceStretch can be disabled by calling method setForceStretch with false
101
-   #  parameter. If disabled, if an images original size is smaller than the size
102
-   #  specified by the user, the original size will be used. This is useful when
103
-   #  dealing with small images.
104
-   #
105
-   #  If enabled, images smaller than the size specified will be stretched to
106
-   #  that size.
107
-   #
108
-   #  Tips:
109
-   # -------------------------------
110
-   #  * If you're resizing a transparent png and saving it as a jpg, set
111
-   #  $keepTransparency to false with: $magicianObj->setTransparency(false);
112
-   #
113
-   #  FEATURES:
114
-   #    * EASY TO USE
115
-   #    * BMP SUPPORT (read & write)
116
-   #    * PSD (photoshop) support (read)
117
-   #    * RESIZE IMAGES
118
-   #      - Preserve transparency (png, gif)
119
-   #      - Apply sharpening (jpg) (requires PHP >= 5.1.0)
120
-   #      - Set image quality (jpg, png)
121
-   #      - Resize modes:
122
-   #        - exact size
123
-   #        - resize by width (auto height)
124
-   #        - resize by height (auto width)
125
-   #        - auto (automatically determine the best of the above modes to use)
126
-   #        - crop - resize as best as it can then crop the rest
127
-   #      - Force stretching of smaller images (upscale)
128
-   #    * APPLY FILTERS
129
-   #      - Convert to grey scale
130
-   #      - Convert to black and white
131
-   #      - Convert to sepia
132
-   #      - Convert to negative
133
-   #    * ROTATE IMAGES
134
-   #      - Rotate using predefined "left", "right", or "180"; or any custom degree amount
135
-   #    * EXTRACT EXIF DATA (requires exif module)
136
-   #      - make
137
-   #      - model
138
-   #      - date
139
-   #      - exposure
140
-   #      - aperture
141
-   #      - f-stop
142
-   #      - iso
143
-   #      - focal length
144
-   #      - exposure program
145
-   #      - metering mode
146
-   #      - flash status
147
-   #      - creator
148
-   #      - copyright
149
-   #    * ADD WATERMARK
150
-   #      - Specify exact x, y placement
151
-   #      - Or, specify using one of the 9 pre-defined placements such as "tl"
152
-   #        (for top left), "m" (for middle), "br" (for bottom right)
153
-   #        - also specify padding from edge amount (optional).
154
-   #      - Set opacity of watermark (png).
155
-   #    * ADD BORDER
156
-   #    * USE HEX WHEN SPECIFYING COLORS (eg: #ffffff)
157
-   #    * SAVE IMAGE OR OUTPUT TO SCREEN
158
-   #
159
-   #
160
-   # ========================================================================#
2
+    # ========================================================================#
3
+    #
4
+    #  This work is licensed under the Creative Commons Attribution 3.0 Unported
5
+    #  License. To view a copy of this license,
6
+    #  visit http://creativecommons.org/licenses/by/3.0/ or send a letter to
7
+    #  Creative Commons, 444 Castro Street, Suite 900, Mountain View, California,
8
+    #  94041, USA.
9
+    #
10
+    #  All rights reserved.
11
+    #
12
+    #  Author:    Jarrod Oberto
13
+    #  Version:   1.5.1
14
+    #  Date:      10-05-11
15
+    #  Purpose:   Provide tools for image manipulation using GD
16
+    #  Param In:  See functions.
17
+    #  Param Out: Produces a resized image
18
+    #  Requires : Requires PHP GD library.
19
+    #  Usage Example:
20
+    #                     include("lib/php_image_magician.php");
21
+    #                     $magicianObj = new resize('images/car.jpg');
22
+    #                     $magicianObj -> resizeImage(150, 100, 0);
23
+    #                     $magicianObj -> saveImage('images/car_small.jpg', 100);
24
+    #
25
+    #        - See end of doc for more examples -
26
+    #
27
+    #  Supported file types include: jpg, png, gif, bmp, psd (read)
28
+    #
29
+    #
30
+    #
31
+    #  The following functions are taken from phpThumb() [available from
32
+    #    http://phpthumb.sourceforge.net], and are used with written permission
33
+    #  from James Heinrich.
34
+    #    - GD2BMPstring
35
+    #      - GetPixelColor
36
+    #      - LittleEndian2String
37
+    #
38
+    #  The following functions are from Marc Hibbins and are used with written
39
+    #  permission (are also under the Attribution-ShareAlike
40
+    #  [http://creativecommons.org/licenses/by-sa/3.0/] license.
41
+    #    -
42
+    #
43
+    #  PhpPsdReader is used with written permission from Tim de Koning.
44
+    #  [http://www.kingsquare.nl/phppsdreader]
45
+    #
46
+    #
47
+    #
48
+    #  Modificatoin history
49
+    #  Date      Initials  Ver Description
50
+    #  10-05-11  J.C.O   0.0 Initial build
51
+    #  01-06-11  J.C.O   0.1.1   * Added reflections
52
+    #              * Added Rounded corners
53
+    #              * You can now use PNG interlacing
54
+    #              * Added shadow
55
+    #              * Added caption box
56
+    #              * Added vintage filter
57
+    #              * Added dynamic image resizing (resize on the fly)
58
+    #              * minor bug fixes
59
+    #  05-06-11  J.C.O   0.1.1.1 * Fixed undefined variables
60
+    #  17-06-11  J.C.O   0.1.2   * Added image_batch_class.php class
61
+    #              * Minor bug fixes
62
+    #  26-07-11  J.C.O   0.1.4 * Added support for external images
63
+    #              * Can now set the crop poisition
64
+    #  03-08-11  J.C.O   0.1.5 * Added reset() method to reset resource to
65
+    #                original input file.
66
+    #              * Added method addTextToCaptionBox() to
67
+    #                simplify adding text to a caption box.
68
+    #              * Added experimental writeIPTC. (not finished)
69
+    #              * Added experimental readIPTC. (not finished)
70
+    #  11-08-11  J.C.O     * Added initial border presets.
71
+    #  30-08-11  J.C.O     * Added 'auto' crop option to crop portrait
72
+    #                images near the top.
73
+    #  08-09-11  J.C.O     * Added cropImage() method to allow standalone
74
+    #                cropping.
75
+    #  17-09-11  J.C.O     * Added setCropFromTop() set method - set the
76
+    #                percentage to crop from the top when using
77
+    #                crop 'auto' option.
78
+    #              * Added setTransparency() set method - allows you
79
+    #                to turn transparency off (like when saving
80
+    #                as a jpg).
81
+    #              * Added setFillColor() set method - set the
82
+    #                background color to use instead of transparency.
83
+    #  05-11-11  J.C.O   0.1.5.1 * Fixed interlacing option
84
+    #  0-07-12  J.C.O   1.0
85
+    #
86
+    #  Known issues & Limitations:
87
+    # -------------------------------
88
+    #  Not so much an issue, the image is destroyed on the deconstruct rather than
89
+    #  when we have finished with it. The reason for this is that we don't know
90
+    #  when we're finished with it as you can both save the image and display
91
+    #  it directly to the screen (imagedestroy($this->imageResized))
92
+    #
93
+    #  Opening BMP files is slow. A test with 884 bmp files processed in a loop
94
+    #  takes forever - over 5 min. This test inlcuded opening the file, then
95
+    #  getting and displaying its width and height.
96
+    #
97
+    #  $forceStretch:
98
+    # -------------------------------
99
+    #  On by default.
100
+    #  $forceStretch can be disabled by calling method setForceStretch with false
101
+    #  parameter. If disabled, if an images original size is smaller than the size
102
+    #  specified by the user, the original size will be used. This is useful when
103
+    #  dealing with small images.
104
+    #
105
+    #  If enabled, images smaller than the size specified will be stretched to
106
+    #  that size.
107
+    #
108
+    #  Tips:
109
+    # -------------------------------
110
+    #  * If you're resizing a transparent png and saving it as a jpg, set
111
+    #  $keepTransparency to false with: $magicianObj->setTransparency(false);
112
+    #
113
+    #  FEATURES:
114
+    #    * EASY TO USE
115
+    #    * BMP SUPPORT (read & write)
116
+    #    * PSD (photoshop) support (read)
117
+    #    * RESIZE IMAGES
118
+    #      - Preserve transparency (png, gif)
119
+    #      - Apply sharpening (jpg) (requires PHP >= 5.1.0)
120
+    #      - Set image quality (jpg, png)
121
+    #      - Resize modes:
122
+    #        - exact size
123
+    #        - resize by width (auto height)
124
+    #        - resize by height (auto width)
125
+    #        - auto (automatically determine the best of the above modes to use)
126
+    #        - crop - resize as best as it can then crop the rest
127
+    #      - Force stretching of smaller images (upscale)
128
+    #    * APPLY FILTERS
129
+    #      - Convert to grey scale
130
+    #      - Convert to black and white
131
+    #      - Convert to sepia
132
+    #      - Convert to negative
133
+    #    * ROTATE IMAGES
134
+    #      - Rotate using predefined "left", "right", or "180"; or any custom degree amount
135
+    #    * EXTRACT EXIF DATA (requires exif module)
136
+    #      - make
137
+    #      - model
138
+    #      - date
139
+    #      - exposure
140
+    #      - aperture
141
+    #      - f-stop
142
+    #      - iso
143
+    #      - focal length
144
+    #      - exposure program
145
+    #      - metering mode
146
+    #      - flash status
147
+    #      - creator
148
+    #      - copyright
149
+    #    * ADD WATERMARK
150
+    #      - Specify exact x, y placement
151
+    #      - Or, specify using one of the 9 pre-defined placements such as "tl"
152
+    #        (for top left), "m" (for middle), "br" (for bottom right)
153
+    #        - also specify padding from edge amount (optional).
154
+    #      - Set opacity of watermark (png).
155
+    #    * ADD BORDER
156
+    #    * USE HEX WHEN SPECIFYING COLORS (eg: #ffffff)
157
+    #    * SAVE IMAGE OR OUTPUT TO SCREEN
158
+    #
159
+    #
160
+    # ========================================================================#
161 161
 
162 162
 
163 163
 class imageLib
@@ -171,37 +171,37 @@  discard block
 block discarded – undo
171 171
     private $width;         # Current width (width after resize)
172 172
     private $height;
173 173
     private $imageSize;
174
-  private $fileExtension;
174
+    private $fileExtension;
175 175
 
176
-  private $debug = true;
177
-  private $errorArray = array();
176
+    private $debug = true;
177
+    private $errorArray = array();
178 178
 
179
-  private $forceStretch = true;
180
-  private $aggresiveSharpening = false;
179
+    private $forceStretch = true;
180
+    private $aggresiveSharpening = false;
181 181
 
182
-  private $transparentArray = array('.png', '.gif');
183
-  private $keepTransparency = true;
184
-  private $fillColorArray = array('r'=>255, 'g'=>255, 'b'=>255);
182
+    private $transparentArray = array('.png', '.gif');
183
+    private $keepTransparency = true;
184
+    private $fillColorArray = array('r'=>255, 'g'=>255, 'b'=>255);
185 185
 
186
-  private $sharpenArray = array('jpg');
186
+    private $sharpenArray = array('jpg');
187 187
 
188
-  private $psdReaderPath;
189
-  private $filterOverlayPath;
188
+    private $psdReaderPath;
189
+    private $filterOverlayPath;
190 190
 
191
-  private $isInterlace;
191
+    private $isInterlace;
192 192
 
193
-  private $captionBoxPositionArray = array();
193
+    private $captionBoxPositionArray = array();
194 194
 
195
-  private $fontDir = 'fonts';
195
+    private $fontDir = 'fonts';
196 196
 
197
-  private $cropFromTopPercent = 10;
197
+    private $cropFromTopPercent = 10;
198 198
 
199 199
 
200 200
 ## --------------------------------------------------------
201 201
 
202 202
     function __construct($fileName)
203 203
     # Author:     Jarrod Oberto
204
-  # Date:     27-02-08
204
+    # Date:     27-02-08
205 205
     # Purpose:    Constructor
206 206
     # Param in:   $fileName: File name and path.
207 207
     # Param out:  n/a
@@ -246,20 +246,20 @@  discard block
 block discarded – undo
246 246
             $this->imageSize = getimagesize($this->fileName);
247 247
 
248 248
         } else {
249
-      $this->errorArray[] = 'File is not an image';
249
+        $this->errorArray[] = 'File is not an image';
250 250
     }
251 251
     }
252 252
 
253 253
 ## --------------------------------------------------------
254 254
 
255
-  private function initialise () {
255
+    private function initialise () {
256 256
 
257 257
     $this->psdReaderPath = __DIR__ . '/classPhpPsdReader.php';
258 258
     $this->filterOverlayPath = __DIR__ . '/filters';
259 259
 
260 260
     // *** Set if image should be interlaced or not.
261 261
     $this->isInterlace = false;
262
-  }
262
+    }
263 263
 
264 264
 
265 265
 
@@ -278,18 +278,18 @@  discard block
 block discarded – undo
278 278
     #                          1 / portrait = keep aspect set height;
279 279
     #                          2 / landscape = keep aspect set width;
280 280
     #                          3 / auto = auto;
281
-  #                          4 / crop= resize and crop;
282
-  #
283
-  #         $option can also be an array containing options for
284
-  #         cropping. E.G., array('crop', 'r')
285
-  #
286
-  #         This array only applies to 'crop' and the 'r' refers to
287
-  #         "crop right". Other value include; tl, t, tr, l, m (default),
288
-  #         r, bl, b, br, or you can specify your own co-ords (which
289
-  #         isn't recommended.
290
-  #
291
-  #       $sharpen:    true: sharpen (jpg only);
292
-  #                false: don't sharpen
281
+    #                          4 / crop= resize and crop;
282
+    #
283
+    #         $option can also be an array containing options for
284
+    #         cropping. E.G., array('crop', 'r')
285
+    #
286
+    #         This array only applies to 'crop' and the 'r' refers to
287
+    #         "crop right". Other value include; tl, t, tr, l, m (default),
288
+    #         r, bl, b, br, or you can specify your own co-ords (which
289
+    #         isn't recommended.
290
+    #
291
+    #       $sharpen:    true: sharpen (jpg only);
292
+    #                false: don't sharpen
293 293
     # Param out:  n/a
294 294
     # Reference:
295 295
     # Notes:      To clarify the $option input:
@@ -298,24 +298,24 @@  discard block
 block discarded – undo
298 298
     #                   is set. The width will be calculated and set automatically
299 299
     #                   to a the value that keeps the original aspect ratio.
300 300
     #               2 = The same but based on the width. We try make the image the
301
-  #                  biggest size we can while stil fitting inside the box size
301
+    #                  biggest size we can while stil fitting inside the box size
302 302
     #               3 = Depending whether the image is landscape or portrait, this
303 303
     #                   will automatically determine whether to resize via
304 304
     #                   dimension 1,2 or 0
305
-  #               4 = Will resize and then crop the image for best fit
306
-  #
307
-  #       forceStretch can be applied to options 1,2,3 and 4
305
+    #               4 = Will resize and then crop the image for best fit
306
+    #
307
+    #       forceStretch can be applied to options 1,2,3 and 4
308 308
     #
309 309
     {
310 310
 
311 311
     // *** We can pass in an array of options to change the crop position
312 312
     $cropPos = 'm';
313 313
     if (is_array($option) && fix_strtolower($option[0]) === 'crop') {
314
-      $cropPos = $option[1];         # get the crop option
314
+        $cropPos = $option[1];         # get the crop option
315 315
     } else if (strpos($option, '-') !== false) {
316
-      // *** Or pass in a hyphen seperated option
317
-      $optionPiecesArray = explode('-', $option);
318
-      $cropPos = end($optionPiecesArray);
316
+        // *** Or pass in a hyphen seperated option
317
+        $optionPiecesArray = explode('-', $option);
318
+        $cropPos = end($optionPiecesArray);
319 319
     }
320 320
 
321 321
     // *** Check the option is valid
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
     // *** If '4', then crop too
340 340
     if ($option == 4 || $option === 'crop') {
341 341
 
342
-      if (($optimalWidth >= $newWidth && $optimalHeight >= $newHeight)) {
342
+        if (($optimalWidth >= $newWidth && $optimalHeight >= $newHeight)) {
343 343
         $this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight, $cropPos);
344
-      }
344
+        }
345 345
     }
346 346
 
347 347
     // *** If Rotate.
348 348
     if ($autoRotate) {
349 349
 
350
-      $exifData = $this->getExif(false);
351
-      if (count($exifData) > 0) {
350
+        $exifData = $this->getExif(false);
351
+        if (count($exifData) > 0) {
352 352
 
353 353
         switch($exifData['orientation']) {
354 354
             case 8:
@@ -361,34 +361,34 @@  discard block
 block discarded – undo
361 361
                 $this->imageResized = imagerotate($this->imageResized,-90,0);
362 362
                 break;
363 363
         }
364
-      }
364
+        }
365 365
     }
366 366
 
367 367
     // *** Sharpen image (if jpg and the user wishes to do so)
368 368
     if ($sharpen && in_array($this->fileExtension, $this->sharpenArray)) {
369 369
 
370
-      // *** Sharpen
371
-      $this->sharpen();
370
+        // *** Sharpen
371
+        $this->sharpen();
372 372
     }
373 373
     }
374 374
 
375 375
 ## --------------------------------------------------------
376 376
 
377
-  public function cropImage($newWidth, $newHeight, $cropPos = 'm')
377
+    public function cropImage($newWidth, $newHeight, $cropPos = 'm')
378 378
     # Author:     Jarrod Oberto
379 379
     # Date:       08-09-11
380 380
     # Purpose:    Crops the image
381 381
     # Param in:   $newWidth: crop with
382 382
     #             $newHeight: crop height
383
-  #       $cropPos: Can be any of the following:
384
-  #             tl, t, tr, l, m, r, bl, b, br, auto
385
-  #           Or:
386
-  #             a custom position such as '30x50'
383
+    #       $cropPos: Can be any of the following:
384
+    #             tl, t, tr, l, m, r, bl, b, br, auto
385
+    #           Or:
386
+    #             a custom position such as '30x50'
387 387
     # Param out:  n/a
388 388
     # Reference:
389 389
     # Notes:
390 390
     #
391
-  {
391
+    {
392 392
 
393 393
     // *** Make sure the file passed in is valid
394 394
     if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); }else{ throw new Exception(); }};
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
     $this->imageResized = $this->image;
397 397
     $this->crop($this->width, $this->height, $newWidth, $newHeight, $cropPos);
398 398
 
399
-  }
399
+    }
400 400
 
401 401
 ## --------------------------------------------------------
402 402
 
403
-  private function keepTransparancy($width, $height, $im)
403
+    private function keepTransparancy($width, $height, $im)
404 404
     # Author:     Jarrod Oberto
405 405
     # Date:       08-04-11
406 406
     # Purpose:    Keep transparency for png and gif image
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
     # Reference:
410 410
     # Notes:
411 411
     #
412
-  {
412
+    {
413 413
     // *** If PNG, perform some transparency retention actions (gif untested)
414 414
     if (in_array($this->fileExtension, $this->transparentArray) && $this->keepTransparency) {
415
-      imagealphablending($im, false);
416
-      imagesavealpha($im, true);
417
-      $transparent = imagecolorallocatealpha($im, 255, 255, 255, 127);
418
-      imagefilledrectangle($im, 0, 0, $width, $height, $transparent);
415
+        imagealphablending($im, false);
416
+        imagesavealpha($im, true);
417
+        $transparent = imagecolorallocatealpha($im, 255, 255, 255, 127);
418
+        imagefilledrectangle($im, 0, 0, $width, $height, $transparent);
419 419
     } else {
420
-      $color = imagecolorallocate($im, $this->fillColorArray['r'], $this->fillColorArray['g'], $this->fillColorArray['b']);
421
-      imagefilledrectangle($im, 0, 0, $width, $height, $color);
420
+        $color = imagecolorallocate($im, $this->fillColorArray['r'], $this->fillColorArray['g'], $this->fillColorArray['b']);
421
+        imagefilledrectangle($im, 0, 0, $width, $height, $color);
422
+    }
422 423
     }
423
-  }
424 424
 
425 425
 ## --------------------------------------------------------
426 426
 
@@ -456,102 +456,102 @@  discard block
 block discarded – undo
456 456
 
457 457
 ## --------------------------------------------------------
458 458
 
459
-  private function getCropPlacing($optimalWidth, $optimalHeight, $newWidth, $newHeight, $pos='m')
460
-  #
461
-  # Author:   Jarrod Oberto
462
-  # Date:   July 11
463
-  # Purpose:  Set the cropping area.
464
-  # Params in:
465
-  # Params out: (array) the crop x and y co-ordinates.
466
-  # Notes:    When specifying the exact pixel crop position (eg 10x15), be
467
-  #       very careful as it's easy to crop out of the image leaving
468
-  #       black borders.
469
-  #
470
-  {
459
+    private function getCropPlacing($optimalWidth, $optimalHeight, $newWidth, $newHeight, $pos='m')
460
+    #
461
+    # Author:   Jarrod Oberto
462
+    # Date:   July 11
463
+    # Purpose:  Set the cropping area.
464
+    # Params in:
465
+    # Params out: (array) the crop x and y co-ordinates.
466
+    # Notes:    When specifying the exact pixel crop position (eg 10x15), be
467
+    #       very careful as it's easy to crop out of the image leaving
468
+    #       black borders.
469
+    #
470
+    {
471 471
     $pos = fix_strtolower($pos);
472 472
 
473 473
     // *** If co-ords have been entered
474 474
     if (strstr($pos, 'x')) {
475
-      $pos = str_replace(' ', '', $pos);
475
+        $pos = str_replace(' ', '', $pos);
476 476
 
477
-      $xyArray = explode('x', $pos);
478
-      list($cropStartX, $cropStartY) = $xyArray;
477
+        $xyArray = explode('x', $pos);
478
+        list($cropStartX, $cropStartY) = $xyArray;
479 479
 
480 480
     } else {
481 481
 
482
-      switch ($pos) {
482
+        switch ($pos) {
483 483
         case 'tl':
484 484
           $cropStartX = 0;
485
-          $cropStartY = 0;
486
-          break;
485
+            $cropStartY = 0;
486
+            break;
487 487
 
488 488
         case 't':
489 489
           $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
490
-          $cropStartY = 0;
491
-          break;
490
+            $cropStartY = 0;
491
+            break;
492 492
 
493 493
         case 'tr':
494 494
           $cropStartX = $optimalWidth - $newWidth;
495
-          $cropStartY = 0;
496
-          break;
495
+            $cropStartY = 0;
496
+            break;
497 497
 
498 498
         case 'l':
499 499
           $cropStartX = 0;
500
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
501
-          break;
500
+            $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
501
+            break;
502 502
 
503 503
         case 'm':
504 504
           $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
505
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
506
-          break;
505
+            $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
506
+            break;
507 507
 
508 508
         case 'r':
509 509
           $cropStartX = $optimalWidth - $newWidth;
510
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
511
-          break;
510
+            $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
511
+            break;
512 512
 
513 513
         case 'bl':
514 514
           $cropStartX = 0;
515
-          $cropStartY = $optimalHeight - $newHeight;
516
-          break;
515
+            $cropStartY = $optimalHeight - $newHeight;
516
+            break;
517 517
 
518 518
         case 'b':
519 519
           $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
520
-          $cropStartY = $optimalHeight - $newHeight;
521
-          break;
520
+            $cropStartY = $optimalHeight - $newHeight;
521
+            break;
522 522
 
523 523
         case 'br':
524 524
           $cropStartX = $optimalWidth - $newWidth;
525
-          $cropStartY = $optimalHeight - $newHeight;
526
-          break;
525
+            $cropStartY = $optimalHeight - $newHeight;
526
+            break;
527 527
 
528 528
         case 'auto':
529 529
           // *** If image is a portrait crop from top, not center. v1.5
530 530
           if ($optimalHeight > $optimalWidth) {
531 531
             $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
532 532
             $cropStartY = ($this->cropFromTopPercent /100) * $optimalHeight;
533
-          } else {
533
+            } else {
534 534
 
535 535
             // *** Else crop from the center
536 536
             $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
537 537
             $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
538
-          }
539
-          break;
538
+            }
539
+            break;
540 540
 
541 541
         default:
542 542
           // *** Default to center
543 543
           $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
544
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
545
-          break;
546
-      }
544
+            $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
545
+            break;
546
+        }
547 547
     }
548 548
 
549 549
     return array('x' => $cropStartX, 'y' => $cropStartY);
550
-  }
550
+    }
551 551
 
552 552
 ## --------------------------------------------------------
553 553
 
554
-  private function getDimensions($newWidth, $newHeight, $option)
554
+    private function getDimensions($newWidth, $newHeight, $option)
555 555
     # Author:     Jarrod Oberto
556 556
     # Date:       17-11-09
557 557
     # Purpose:    Get new image dimensions based on user specificaions
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
     # Param out:  Array of new width and height values
561 561
     # Reference:
562 562
     # Notes:    If $option = 3 then this function is call recursivly
563
-  #
564
-  #       To clarify the $option input:
563
+    #
564
+    #       To clarify the $option input:
565 565
     #               0 = The exact height and width dimensions you set.
566 566
     #               1 = Whatever height is passed in will be the height that
567 567
     #                   is set. The width will be calculated and set automatically
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
     #               3 = Depending whether the image is landscape or portrait, this
571 571
     #                   will automatically determine whether to resize via
572 572
     #                   dimension 1,2 or 0.
573
-  #               4 = Resize the image as much as possible, then crop the
574
-  #         remainder.
575
-  {
573
+    #               4 = Resize the image as much as possible, then crop the
574
+    #         remainder.
575
+    {
576 576
 
577 577
         switch ((string)($option))
578 578
         {
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
         $optimalWidth = $dimensionsArray['optimalWidth'];
600 600
         $optimalHeight = $dimensionsArray['optimalHeight'];
601 601
                 break;
602
-      case '4':
602
+        case '4':
603 603
       case 'crop':
604 604
                 $dimensionsArray = $this->getOptimalCrop($newWidth, $newHeight);
605 605
         $optimalWidth = $dimensionsArray['optimalWidth'];
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
         }
609 609
 
610 610
     return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
611
-  }
611
+    }
612 612
 
613 613
 ## --------------------------------------------------------
614 614
 
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
     // *** If forcing is off...
618 618
     if (!$this->forceStretch) {
619 619
 
620
-      // *** ...check if actual height is less than target height
621
-      if ($this->height < $newHeight) {
620
+        // *** ...check if actual height is less than target height
621
+        if ($this->height < $newHeight) {
622 622
         return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
623
-      }
623
+        }
624 624
     }
625 625
 
626 626
         $ratio = $this->width / $this->height;
@@ -638,10 +638,10 @@  discard block
 block discarded – undo
638 638
     // *** If forcing is off...
639 639
     if (!$this->forceStretch) {
640 640
 
641
-      // *** ...check if actual width is less than target width
642
-      if ($this->width < $newWidth) {
641
+        // *** ...check if actual width is less than target width
642
+        if ($this->width < $newWidth) {
643 643
         return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
644
-      }
644
+        }
645 645
     }
646 646
 
647 647
     $ratio = $this->height / $this->width;
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
     // *** If forcing is off...
666 666
     if (!$this->forceStretch) {
667 667
 
668
-      // *** ...check if actual size is less than target size
669
-      if ($this->width < $newWidth && $this->height < $newHeight) {
668
+        // *** ...check if actual size is less than target size
669
+        if ($this->width < $newWidth && $this->height < $newHeight) {
670 670
         return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
671
-      }
671
+        }
672 672
     }
673 673
 
674 674
         if ($this->height < $this->width)
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
             //$optimalHeight= $this->getSizeByFixedWidth($newWidth);
679 679
 
680 680
             $dimensionsArray = $this->getSizeByFixedWidth($newWidth, $newHeight);
681
-      $optimalWidth = $dimensionsArray['optimalWidth'];
682
-      $optimalHeight = $dimensionsArray['optimalHeight'];
681
+        $optimalWidth = $dimensionsArray['optimalWidth'];
682
+        $optimalHeight = $dimensionsArray['optimalHeight'];
683 683
         }
684 684
         elseif ($this->height > $this->width)
685 685
         // *** Image to be resized is taller (portrait)
@@ -688,30 +688,30 @@  discard block
 block discarded – undo
688 688
             //$optimalHeight= $newHeight;
689 689
 
690 690
             $dimensionsArray = $this->getSizeByFixedHeight($newWidth, $newHeight);
691
-      $optimalWidth = $dimensionsArray['optimalWidth'];
692
-      $optimalHeight = $dimensionsArray['optimalHeight'];
691
+        $optimalWidth = $dimensionsArray['optimalWidth'];
692
+        $optimalHeight = $dimensionsArray['optimalHeight'];
693 693
         }
694 694
     else
695 695
         // *** Image to be resizerd is a square
696 696
         {
697 697
 
698
-      if ($newHeight < $newWidth) {
699
-          //$optimalWidth = $newWidth;
698
+        if ($newHeight < $newWidth) {
699
+            //$optimalWidth = $newWidth;
700 700
         //$optimalHeight= $this->getSizeByFixedWidth($newWidth);
701 701
                 $dimensionsArray = $this->getSizeByFixedWidth($newWidth, $newHeight);
702 702
         $optimalWidth = $dimensionsArray['optimalWidth'];
703 703
         $optimalHeight = $dimensionsArray['optimalHeight'];
704
-      } else if ($newHeight > $newWidth) {
705
-          //$optimalWidth = $this->getSizeByFixedHeight($newHeight);
704
+        } else if ($newHeight > $newWidth) {
705
+            //$optimalWidth = $this->getSizeByFixedHeight($newHeight);
706 706
             //$optimalHeight= $newHeight;
707 707
                 $dimensionsArray = $this->getSizeByFixedHeight($newWidth, $newHeight);
708 708
         $optimalWidth = $dimensionsArray['optimalWidth'];
709 709
         $optimalHeight = $dimensionsArray['optimalHeight'];
710
-      } else {
710
+        } else {
711 711
         // *** Sqaure being resized to a square
712 712
         $optimalWidth = $newWidth;
713 713
         $optimalHeight= $newHeight;
714
-      }
714
+        }
715 715
         }
716 716
 
717 717
     return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
@@ -720,64 +720,64 @@  discard block
 block discarded – undo
720 720
 ## --------------------------------------------------------
721 721
 
722 722
     private function getOptimalCrop($newWidth, $newHeight)
723
-  # Author:     Jarrod Oberto
723
+    # Author:     Jarrod Oberto
724 724
     # Date:       17-11-09
725 725
     # Purpose:    Get optimal crop dimensions
726 726
     # Param in:   width and height as requested by user (fig 3)
727 727
     # Param out:  Array of optimal width and height (fig 2)
728 728
     # Reference:
729 729
     # Notes:      The optimal width and height return are not the same as the
730
-  #       same as the width and height passed in. For example:
731
-  #
732
-  #
733
-  #   |-----------------|     |------------|       |-------|
734
-  #   |             |   =>  |**|      |**|   =>  |       |
735
-  #   |             |     |**|      |**|       |       |
730
+    #       same as the width and height passed in. For example:
731
+    #
732
+    #
733
+    #   |-----------------|     |------------|       |-------|
734
+    #   |             |   =>  |**|      |**|   =>  |       |
735
+    #   |             |     |**|      |**|       |       |
736 736
     #   |           |       |------------|       |-------|
737
-  #   |-----------------|
738
-  #        original                optimal             crop
739
-  #              size                   size               size
740
-  #  Fig          1                      2                  3
741
-  #
742
-  #       300 x 250           150 x 125          150 x 100
743
-  #
744
-  #    The optimal size is the smallest size (that is closest to the crop size)
745
-  #    while retaining proportion/ratio.
746
-  #
747
-  #  The crop size is the optimal size that has been cropped on one axis to
748
-  #  make the image the exact size specified by the user.
749
-  #
750
-  #               * represent cropped area
751
-  #
752
-  {
737
+    #   |-----------------|
738
+    #        original                optimal             crop
739
+    #              size                   size               size
740
+    #  Fig          1                      2                  3
741
+    #
742
+    #       300 x 250           150 x 125          150 x 100
743
+    #
744
+    #    The optimal size is the smallest size (that is closest to the crop size)
745
+    #    while retaining proportion/ratio.
746
+    #
747
+    #  The crop size is the optimal size that has been cropped on one axis to
748
+    #  make the image the exact size specified by the user.
749
+    #
750
+    #               * represent cropped area
751
+    #
752
+    {
753 753
 
754 754
     // *** If forcing is off...
755 755
     if (!$this->forceStretch) {
756 756
 
757
-      // *** ...check if actual size is less than target size
758
-      if ($this->width < $newWidth && $this->height < $newHeight) {
757
+        // *** ...check if actual size is less than target size
758
+        if ($this->width < $newWidth && $this->height < $newHeight) {
759 759
         return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
760
-      }
760
+        }
761 761
     }
762 762
 
763 763
     $heightRatio = $this->height / $newHeight;
764 764
     $widthRatio  = $this->width /  $newWidth;
765 765
 
766 766
     if ($heightRatio < $widthRatio) {
767
-      $optimalRatio = $heightRatio;
767
+        $optimalRatio = $heightRatio;
768 768
     } else {
769
-      $optimalRatio = $widthRatio;
769
+        $optimalRatio = $widthRatio;
770 770
     }
771 771
 
772 772
     $optimalHeight = round( $this->height / $optimalRatio );
773 773
     $optimalWidth  = round( $this->width  / $optimalRatio );
774 774
 
775 775
     return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
776
-  }
776
+    }
777 777
 
778 778
 ## --------------------------------------------------------
779 779
 
780
-  private function sharpen()
780
+    private function sharpen()
781 781
     # Author:     Jarrod Oberto
782 782
     # Date:       08 04 2011
783 783
     # Purpose:    Sharpen image
@@ -786,56 +786,56 @@  discard block
 block discarded – undo
786 786
     # Reference:
787 787
     # Notes:
788 788
     # Credit:   Incorporates Joe Lencioni (August 6, 2008) code
789
-  {
789
+    {
790 790
 
791 791
     if (version_compare(PHP_VERSION, '5.1.0') >= 0) {
792 792
 
793
-      // ***
794
-      if ($this->aggresiveSharpening) { # A more aggressive sharpening solution
793
+        // ***
794
+        if ($this->aggresiveSharpening) { # A more aggressive sharpening solution
795 795
 
796 796
         $sharpenMatrix = array( array( -1, -1, -1 ),
797
-                         array( -1, 16, -1 ),
798
-                         array( -1, -1, -1 ) );
797
+                            array( -1, 16, -1 ),
798
+                            array( -1, -1, -1 ) );
799 799
         $divisor = 8;
800 800
         $offset = 0;
801 801
 
802 802
         imageconvolution($this->imageResized, $sharpenMatrix, $divisor, $offset);
803
-      }
804
-      else # More subtle and personally more desirable
805
-      {
803
+        }
804
+        else # More subtle and personally more desirable
805
+        {
806 806
         $sharpness  = $this->findSharp($this->widthOriginal, $this->width);
807 807
 
808 808
         $sharpenMatrix  = array(
809
-          array(-1, -2, -1),
810
-          array(-2, $sharpness + 12, -2), //Lessen the effect of a filter by increasing the value in the center cell
811
-          array(-1, -2, -1)
809
+            array(-1, -2, -1),
810
+            array(-2, $sharpness + 12, -2), //Lessen the effect of a filter by increasing the value in the center cell
811
+            array(-1, -2, -1)
812 812
         );
813 813
         $divisor    = $sharpness; // adjusts brightness
814 814
         $offset     = 0;
815 815
         imageconvolution($this->imageResized, $sharpenMatrix, $divisor, $offset);
816
-      }
816
+        }
817 817
     }
818 818
     else
819 819
     {
820
-      if ($this->debug) { throw new Exception('Sharpening required PHP 5.1.0 or greater.'); }
820
+        if ($this->debug) { throw new Exception('Sharpening required PHP 5.1.0 or greater.'); }
821
+    }
821 822
     }
822
-  }
823 823
 
824
-  ## --------------------------------------------------------
824
+    ## --------------------------------------------------------
825 825
 
826
-  private function sharpen2($level)
827
-  {
828
-      $sharpenMatrix  = array(
826
+    private function sharpen2($level)
827
+    {
828
+        $sharpenMatrix  = array(
829 829
         array($level, $level, $level),
830 830
         array($level, (8*$level)+1, $level), //Lessen the effect of a filter by increasing the value in the center cell
831 831
         array($level, $level, $level)
832
-      );
832
+        );
833 833
 
834
-  }
834
+    }
835 835
 
836 836
 ## --------------------------------------------------------
837 837
 
838
-  private function findSharp($orig, $final)
838
+    private function findSharp($orig, $final)
839 839
     # Author:     Ryan Rud (http://adryrun.com)
840 840
     # Purpose:    Find optimal sharpness
841 841
     # Param in:   n/a
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
     # Reference:
844 844
     # Notes:
845 845
     #
846
-  {
846
+    {
847 847
     $final  = $final * (750.0 / $orig);
848 848
     $a    = 52;
849 849
     $b    = -0.27810650887573124;
@@ -852,11 +852,11 @@  discard block
 block discarded – undo
852 852
     $result = $a + $b * $final + $c * $final * $final;
853 853
 
854 854
     return max(round($result), 0);
855
-  }
855
+    }
856 856
 
857 857
 ## --------------------------------------------------------
858 858
 
859
-  private function prepOption($option)
859
+    private function prepOption($option)
860 860
     # Author:     Jarrod Oberto
861 861
     # Purpose:    Prep option like change the passed in option to lowercase
862 862
     # Param in:   (str/int) $option: eg. 'exact', 'crop'. 0, 4
@@ -864,23 +864,23 @@  discard block
 block discarded – undo
864 864
     # Reference:
865 865
     # Notes:
866 866
     #
867
-  {
867
+    {
868 868
     if (is_array($option)) {
869
-      if (fix_strtolower($option[0]) === 'crop' && count($option) == 2) {
869
+        if (fix_strtolower($option[0]) === 'crop' && count($option) == 2) {
870 870
         return 'crop';
871
-      } else {
871
+        } else {
872 872
         throw new Exception('Crop resize option array is badly formatted.');
873
-      }
873
+        }
874 874
     } else if (strpos($option, 'crop') !== false) {
875
-      return 'crop';
875
+        return 'crop';
876 876
     }
877 877
 
878 878
     if (is_string($option)) {
879
-      return fix_strtolower($option);
879
+        return fix_strtolower($option);
880 880
     }
881 881
 
882 882
     return $option;
883
-  }
883
+    }
884 884
 
885 885
 
886 886
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
@@ -894,29 +894,29 @@  discard block
 block discarded – undo
894 894
 #
895 895
 
896 896
 
897
-  public function borderPreset($preset)
898
-  {
897
+    public function borderPreset($preset)
898
+    {
899 899
     switch ($preset)
900 900
     {
901 901
 
902
-      case 'simple':
902
+        case 'simple':
903 903
         $this->addBorder(7, '#fff');
904 904
         $this->addBorder(6, '#f2f1f0');
905 905
         $this->addBorder(2, '#fff');
906 906
         $this->addBorder(1, '#ccc');
907 907
         break;
908
-      default:
908
+        default:
909 909
         break;
910 910
     }
911 911
 
912
-  }
912
+    }
913 913
 
914 914
 
915 915
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
916 916
   Draw border
917 917
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
918 918
 
919
-  public function addBorder($thickness = 1, $rgbArray = array(255, 255, 255))
919
+    public function addBorder($thickness = 1, $rgbArray = array(255, 255, 255))
920 920
     # Author:     Jarrod Oberto
921 921
     # Date:       05-05-11
922 922
     # Purpose:    Add a border to the image
@@ -925,35 +925,35 @@  discard block
 block discarded – undo
925 925
     # Reference:
926 926
     # Notes:    This border is added to the INSIDE of the image
927 927
     #
928
-  {
928
+    {
929 929
     if ($this->imageResized) {
930 930
 
931
-      $rgbArray = $this->formatColor($rgbArray);
932
-      $r = $rgbArray['r'];
933
-      $g = $rgbArray['g'];
934
-      $b = $rgbArray['b'];
931
+        $rgbArray = $this->formatColor($rgbArray);
932
+        $r = $rgbArray['r'];
933
+        $g = $rgbArray['g'];
934
+        $b = $rgbArray['b'];
935 935
 
936 936
 
937
-      $x1 = 0;
938
-      $y1 = 0;
939
-      $x2 = imagesx($this->imageResized) - 1;
940
-      $y2 = imagesy($this->imageResized) - 1;
937
+        $x1 = 0;
938
+        $y1 = 0;
939
+        $x2 = imagesx($this->imageResized) - 1;
940
+        $y2 = imagesy($this->imageResized) - 1;
941 941
 
942
-      $rgbArray = imagecolorallocate($this->imageResized, $r, $g, $b);
942
+        $rgbArray = imagecolorallocate($this->imageResized, $r, $g, $b);
943 943
 
944 944
 
945
-      for($i = 0; $i < $thickness; $i++) {
946
-          imagerectangle($this->imageResized, $x1++, $y1++, $x2--, $y2--, $rgbArray);
947
-      }
945
+        for($i = 0; $i < $thickness; $i++) {
946
+            imagerectangle($this->imageResized, $x1++, $y1++, $x2--, $y2--, $rgbArray);
947
+        }
948
+    }
948 949
     }
949
-  }
950 950
 
951 951
 
952 952
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
953 953
   Gray Scale
954 954
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
955 955
 
956
-  public function greyScale()
956
+    public function greyScale()
957 957
     # Author:     Jarrod Oberto
958 958
     # Date:       07-05-2011
959 959
     # Purpose:    Make image greyscale
@@ -962,16 +962,16 @@  discard block
 block discarded – undo
962 962
     # Reference:
963 963
     # Notes:
964 964
     #
965
-  {
965
+    {
966 966
     if ($this->imageResized) {
967
-      imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
967
+        imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
968 968
     }
969 969
 
970
-  }
970
+    }
971 971
 
972
-  ## --------------------------------------------------------
972
+    ## --------------------------------------------------------
973 973
 
974
-  public function greyScaleEnhanced()
974
+    public function greyScaleEnhanced()
975 975
     # Author:     Jarrod Oberto
976 976
     # Date:       07-05-2011
977 977
     # Purpose:    Make image greyscale
@@ -980,29 +980,29 @@  discard block
 block discarded – undo
980 980
     # Reference:
981 981
     # Notes:
982 982
     #
983
-  {
983
+    {
984 984
     if ($this->imageResized) {
985
-      imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
986
-      imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -15);
987
-      imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, 2);
988
-      $this->sharpen($this->width);
985
+        imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
986
+        imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -15);
987
+        imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, 2);
988
+        $this->sharpen($this->width);
989
+    }
989 990
     }
990
-  }
991 991
 
992
-  ## --------------------------------------------------------
992
+    ## --------------------------------------------------------
993 993
 
994
-  public function greyScaleDramatic()
995
-  # Alias of gd_filter_monopin
996
-  {
994
+    public function greyScaleDramatic()
995
+    # Alias of gd_filter_monopin
996
+    {
997 997
     $this->gd_filter_monopin();
998
-  }
998
+    }
999 999
 
1000 1000
 
1001 1001
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1002 1002
   Black 'n White
1003 1003
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1004 1004
 
1005
-  public function blackAndWhite()
1005
+    public function blackAndWhite()
1006 1006
     # Author:     Jarrod Oberto
1007 1007
     # Date:       07-05-2011
1008 1008
     # Purpose:    Make image black and white
@@ -1011,21 +1011,21 @@  discard block
 block discarded – undo
1011 1011
     # Reference:
1012 1012
     # Notes:
1013 1013
     #
1014
-  {
1014
+    {
1015 1015
     if ($this->imageResized) {
1016 1016
 
1017
-      imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
1018
-      imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -1000);
1017
+        imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
1018
+        imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -1000);
1019 1019
     }
1020 1020
 
1021
-  }
1021
+    }
1022 1022
 
1023 1023
 
1024 1024
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1025 1025
   Negative
1026 1026
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1027 1027
 
1028
-  public function negative()
1028
+    public function negative()
1029 1029
     # Author:     Jarrod Oberto
1030 1030
     # Date:       07-05-2011
1031 1031
     # Purpose:    Make image negative
@@ -1034,20 +1034,20 @@  discard block
 block discarded – undo
1034 1034
     # Reference:
1035 1035
     # Notes:
1036 1036
     #
1037
-  {
1037
+    {
1038 1038
     if ($this->imageResized) {
1039 1039
 
1040
-      imagefilter($this->imageResized, IMG_FILTER_NEGATE);
1040
+        imagefilter($this->imageResized, IMG_FILTER_NEGATE);
1041 1041
     }
1042 1042
 
1043
-  }
1043
+    }
1044 1044
 
1045 1045
 
1046 1046
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1047 1047
   Sepia
1048 1048
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1049 1049
 
1050
-  public function sepia()
1050
+    public function sepia()
1051 1051
     # Author:     Jarrod Oberto
1052 1052
     # Date:       07-05-2011
1053 1053
     # Purpose:    Make image sepia
@@ -1056,90 +1056,90 @@  discard block
 block discarded – undo
1056 1056
     # Reference:
1057 1057
     # Notes:
1058 1058
     #
1059
-  {
1059
+    {
1060 1060
     if ($this->imageResized) {
1061
-      imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
1062
-      imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, -10);
1063
-      imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -20);
1064
-      imagefilter($this->imageResized, IMG_FILTER_COLORIZE, 60, 30, -15);
1061
+        imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
1062
+        imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, -10);
1063
+        imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -20);
1064
+        imagefilter($this->imageResized, IMG_FILTER_COLORIZE, 60, 30, -15);
1065
+    }
1065 1066
     }
1066
-  }
1067 1067
 
1068
-  ## --------------------------------------------------------
1068
+    ## --------------------------------------------------------
1069 1069
 
1070
-  public function sepia2()
1070
+    public function sepia2()
1071 1071
 
1072
-  {
1072
+    {
1073 1073
     if ($this->imageResized) {
1074 1074
 
1075
-      $total = imagecolorstotal( $this->imageResized );
1076
-      for ( $i = 0; $i < $total; $i++ ) {
1075
+        $total = imagecolorstotal( $this->imageResized );
1076
+        for ( $i = 0; $i < $total; $i++ ) {
1077 1077
         $index = imagecolorsforindex( $this->imageResized, $i );
1078 1078
         $red = ( $index["red"] * 0.393 + $index["green"] * 0.769 + $index["blue"] * 0.189 ) / 1.351;
1079 1079
         $green = ( $index["red"] * 0.349 + $index["green"] * 0.686 + $index["blue"] * 0.168 ) / 1.203;
1080 1080
         $blue = ( $index["red"] * 0.272 + $index["green"] * 0.534 + $index["blue"] * 0.131 ) / 2.140;
1081 1081
         imagecolorset( $this->imageResized, $i, $red, $green, $blue );
1082
-      }
1082
+        }
1083 1083
 
1084 1084
 
1085 1085
     }
1086
-  }
1086
+    }
1087 1087
 
1088 1088
 
1089 1089
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1090 1090
   Vintage
1091 1091
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1092 1092
 
1093
-  public function vintage()
1094
-  # Alias of gd_filter_monopin
1095
-  {
1093
+    public function vintage()
1094
+    # Alias of gd_filter_monopin
1095
+    {
1096 1096
     $this->gd_filter_vintage();
1097
-  }
1097
+    }
1098 1098
 
1099 1099
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1100 1100
   Presets By Marc Hibbins
1101 1101
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1102 1102
 
1103 1103
 
1104
-  /** Apply 'Monopin' preset */
1105
-  public function gd_filter_monopin()
1106
-  {
1104
+    /** Apply 'Monopin' preset */
1105
+    public function gd_filter_monopin()
1106
+    {
1107 1107
 
1108 1108
     if ($this->imageResized) {
1109
-      imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
1110
-      imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, -15);
1111
-      imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -15);
1112
-      $this->imageResized = $this->gd_apply_overlay($this->imageResized, 'vignette', 100);
1109
+        imagefilter($this->imageResized, IMG_FILTER_GRAYSCALE);
1110
+        imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, -15);
1111
+        imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -15);
1112
+        $this->imageResized = $this->gd_apply_overlay($this->imageResized, 'vignette', 100);
1113
+    }
1113 1114
     }
1114
-  }
1115 1115
 
1116
-  ## --------------------------------------------------------
1116
+    ## --------------------------------------------------------
1117 1117
 
1118
-  public function gd_filter_vintage()
1119
-  {
1118
+    public function gd_filter_vintage()
1119
+    {
1120 1120
     if ($this->imageResized) {
1121
-      $this->imageResized = $this->gd_apply_overlay($this->imageResized, 'vignette', 45);
1122
-      imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, 20);
1123
-      imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -35);
1124
-      imagefilter($this->imageResized, IMG_FILTER_COLORIZE, 60, -10, 35);
1125
-      imagefilter($this->imageResized, IMG_FILTER_SMOOTH, 7);
1126
-      $this->imageResized = $this->gd_apply_overlay($this->imageResized, 'scratch', 10);
1127
-    }
1128
-  }
1129
-
1130
-  ## --------------------------------------------------------
1131
-
1132
-  /** Apply a PNG overlay */
1133
-  private function gd_apply_overlay($im, $type, $amount)
1134
-  #
1135
-  # Original Author:    Marc Hibbins
1136
-  # License:  Attribution-ShareAlike 3.0
1137
-  # Purpose:
1138
-  # Params in:
1139
-  # Params out:
1140
-  # Notes:
1141
-  #
1142
-  {
1121
+        $this->imageResized = $this->gd_apply_overlay($this->imageResized, 'vignette', 45);
1122
+        imagefilter($this->imageResized, IMG_FILTER_BRIGHTNESS, 20);
1123
+        imagefilter($this->imageResized, IMG_FILTER_CONTRAST, -35);
1124
+        imagefilter($this->imageResized, IMG_FILTER_COLORIZE, 60, -10, 35);
1125
+        imagefilter($this->imageResized, IMG_FILTER_SMOOTH, 7);
1126
+        $this->imageResized = $this->gd_apply_overlay($this->imageResized, 'scratch', 10);
1127
+    }
1128
+    }
1129
+
1130
+    ## --------------------------------------------------------
1131
+
1132
+    /** Apply a PNG overlay */
1133
+    private function gd_apply_overlay($im, $type, $amount)
1134
+    #
1135
+    # Original Author:    Marc Hibbins
1136
+    # License:  Attribution-ShareAlike 3.0
1137
+    # Purpose:
1138
+    # Params in:
1139
+    # Params out:
1140
+    # Notes:
1141
+    #
1142
+    {
1143 1143
     $width = imagesx($im);
1144 1144
     $height = imagesy($im);
1145 1145
     $filter = imagecreatetruecolor($width, $height);
@@ -1162,15 +1162,15 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
     imagedestroy($comp);
1164 1164
     return $im;
1165
-  }
1165
+    }
1166 1166
 
1167 1167
 
1168 1168
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1169 1169
   Colorise
1170 1170
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1171 1171
 
1172
-  public function image_colorize($rgb) {
1173
-      imagetruecolortopalette($this->imageResized,true,256);
1172
+    public function image_colorize($rgb) {
1173
+        imagetruecolortopalette($this->imageResized,true,256);
1174 1174
     $numColors = imagecolorstotal($this->imageResized);
1175 1175
 
1176 1176
     for ($x = 0; $x < $numColors; $x++) {
@@ -1179,24 +1179,24 @@  discard block
 block discarded – undo
1179 1179
     // calculate grayscale in percent
1180 1180
     $grayscale = ($r + $g + $b) / 3 / 0xff;
1181 1181
 
1182
-      imagecolorset($this->imageResized,$x,
1183
-      $grayscale * $rgb[0],
1184
-      $grayscale * $rgb[1],
1185
-      $grayscale * $rgb[2]
1182
+        imagecolorset($this->imageResized,$x,
1183
+        $grayscale * $rgb[0],
1184
+        $grayscale * $rgb[1],
1185
+        $grayscale * $rgb[2]
1186 1186
     );
1187 1187
 
1188 1188
     }
1189 1189
 
1190 1190
     return true;
1191
-  }
1191
+    }
1192 1192
 
1193 1193
 
1194 1194
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1195 1195
   Reflection
1196 1196
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1197 1197
 
1198
-  public function addReflection($reflectionHeight = 50, $startingTransparency = 30, $inside = false, $bgColor = '#fff', $stretch=false, $divider = 0)
1199
-  {
1198
+    public function addReflection($reflectionHeight = 50, $startingTransparency = 30, $inside = false, $bgColor = '#fff', $stretch=false, $divider = 0)
1199
+    {
1200 1200
 
1201 1201
     // *** Convert color
1202 1202
     $rgbArray = $this->formatColor($bgColor);
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
     $bg = imagecreatetruecolor($this->width, $reflectionHeight);
1222 1222
 
1223 1223
     for ($x = 0; $x < $this->width; $x++) {
1224
-      imagecopy($bg, $im, $x, 0, $this->width-$x -1, 0, 1, $reflectionHeight);
1224
+        imagecopy($bg, $im, $x, 0, $this->width-$x -1, 0, 1, $reflectionHeight);
1225 1225
     }
1226 1226
     $im = $bg;
1227 1227
 
@@ -1230,16 +1230,16 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
     // *** Fade
1232 1232
     if ($stretch) {
1233
-      $step = 100/($reflectionHeight + $startingTransparency);
1233
+        $step = 100/($reflectionHeight + $startingTransparency);
1234 1234
     } else{
1235
-      $step = 100/$reflectionHeight;
1235
+        $step = 100/$reflectionHeight;
1236 1236
     }
1237 1237
     for($i=0; $i<=$reflectionHeight; $i++){
1238 1238
 
1239
-      if($startingTransparency>100) $startingTransparency = 100;
1240
-      if($startingTransparency< 1) $startingTransparency = 1;
1241
-      imagecopymerge($bg, $li, 0, $i, 0, 0, $this->width, 1, $startingTransparency);
1242
-      $startingTransparency+=$step;
1239
+        if($startingTransparency>100) $startingTransparency = 100;
1240
+        if($startingTransparency< 1) $startingTransparency = 1;
1241
+        imagecopymerge($bg, $li, 0, $i, 0, 0, $this->width, 1, $startingTransparency);
1242
+        $startingTransparency+=$step;
1243 1243
     }
1244 1244
 
1245 1245
     // *** Apply fade
@@ -1254,126 +1254,126 @@  discard block
 block discarded – undo
1254 1254
     // *** Determines if the reflection should be displayed inside or outside the image
1255 1255
     if ($inside) {
1256 1256
 
1257
-      // Create new blank image with sizes.
1258
-      $final = imagecreatetruecolor($this->width, $this->height);
1257
+        // Create new blank image with sizes.
1258
+        $final = imagecreatetruecolor($this->width, $this->height);
1259 1259
 
1260
-      imagecopymerge ($final, $this->imageResized, 0, 0, 0, $reflectionHeight, $this->width, $this->height - $reflectionHeight, 100);
1261
-      imagecopymerge ($final, $im, 0, $this->height - $reflectionHeight, 0, 0, $x, $y, 100);
1260
+        imagecopymerge ($final, $this->imageResized, 0, 0, 0, $reflectionHeight, $this->width, $this->height - $reflectionHeight, 100);
1261
+        imagecopymerge ($final, $im, 0, $this->height - $reflectionHeight, 0, 0, $x, $y, 100);
1262 1262
 
1263 1263
     } else {
1264 1264
 
1265
-      // Create new blank image with sizes.
1266
-      $final = imagecreatetruecolor($this->width, $this->height + $y);
1265
+        // Create new blank image with sizes.
1266
+        $final = imagecreatetruecolor($this->width, $this->height + $y);
1267 1267
 
1268
-      imagecopymerge ($final, $this->imageResized, 0, 0, 0, 0, $this->width, $this->height, 100);
1269
-      imagecopymerge ($final, $im, 0, $this->height, 0, 0, $x, $y, 100);
1268
+        imagecopymerge ($final, $this->imageResized, 0, 0, 0, 0, $this->width, $this->height, 100);
1269
+        imagecopymerge ($final, $im, 0, $this->height, 0, 0, $x, $y, 100);
1270 1270
     }
1271 1271
 
1272 1272
     $this->imageResized = $final;
1273 1273
 
1274 1274
     imagedestroy($li);
1275 1275
     imagedestroy($im);
1276
-  }
1276
+    }
1277 1277
 
1278 1278
 
1279 1279
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1280 1280
   Rotate
1281 1281
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1282 1282
 
1283
-  public function rotate($value = 90, $bgColor = 'transparent')
1283
+    public function rotate($value = 90, $bgColor = 'transparent')
1284 1284
     # Author:     Jarrod Oberto
1285 1285
     # Date:       07-05-2011
1286 1286
     # Purpose:    Rotate image
1287 1287
     # Param in:   (mixed) $degrees: (int) number of degress to rotate image
1288
-  #               (str) param "left": rotate left
1289
-  #               (str) param "right": rotate right
1290
-  #               (str) param "upside": upside-down image
1288
+    #               (str) param "left": rotate left
1289
+    #               (str) param "right": rotate right
1290
+    #               (str) param "upside": upside-down image
1291 1291
     # Param out:
1292 1292
     # Reference:
1293 1293
     # Notes:    The default direction of imageRotate() is counter clockwise.
1294 1294
     #
1295
-  {
1295
+    {
1296 1296
     if ($this->imageResized) {
1297 1297
 
1298
-      if (is_integer($value)) {
1298
+        if (is_integer($value)) {
1299 1299
         $degrees = $value;
1300
-      }
1300
+        }
1301 1301
 
1302
-      // *** Convert color
1303
-      $rgbArray = $this->formatColor($bgColor);
1304
-      $r = $rgbArray['r'];
1305
-      $g = $rgbArray['g'];
1306
-      $b = $rgbArray['b'];
1307
-      if (isset($rgbArray['a'])) {$a = $rgbArray['a']; }
1302
+        // *** Convert color
1303
+        $rgbArray = $this->formatColor($bgColor);
1304
+        $r = $rgbArray['r'];
1305
+        $g = $rgbArray['g'];
1306
+        $b = $rgbArray['b'];
1307
+        if (isset($rgbArray['a'])) {$a = $rgbArray['a']; }
1308 1308
 
1309
-      if (is_string($value)) {
1309
+        if (is_string($value)) {
1310 1310
 
1311 1311
         $value = fix_strtolower($value);
1312 1312
 
1313 1313
         switch ($value) {
1314
-          case 'left':
1314
+            case 'left':
1315 1315
             $degrees = 90;
1316 1316
             break;
1317
-          case 'right':
1317
+            case 'right':
1318 1318
             $degrees = 270;
1319 1319
             break;
1320
-          case 'upside':
1320
+            case 'upside':
1321 1321
             $degrees = 180;
1322 1322
             break;
1323
-          default:
1323
+            default:
1324 1324
             break;
1325 1325
         }
1326 1326
 
1327
-      }
1327
+        }
1328 1328
 
1329
-      // *** The default direction of imageRotate() is counter clockwise
1330
-      //   * This makes it clockwise
1331
-      $degrees = 360 - $degrees;
1329
+        // *** The default direction of imageRotate() is counter clockwise
1330
+        //   * This makes it clockwise
1331
+        $degrees = 360 - $degrees;
1332 1332
 
1333
-      // *** Create background color
1334
-      $bg = imagecolorallocatealpha($this->imageResized, $r, $g, $b, $a);
1333
+        // *** Create background color
1334
+        $bg = imagecolorallocatealpha($this->imageResized, $r, $g, $b, $a);
1335 1335
 
1336
-      // *** Fill with background
1336
+        // *** Fill with background
1337 1337
         imagefill($this->imageResized, 0, 0 , $bg);
1338 1338
 
1339
-      // *** Rotate
1340
-      $this->imageResized = imagerotate($this->imageResized, $degrees, $bg); // Rotate 45 degrees and allocated the transparent colour as the one to make transparent (obviously)
1339
+        // *** Rotate
1340
+        $this->imageResized = imagerotate($this->imageResized, $degrees, $bg); // Rotate 45 degrees and allocated the transparent colour as the one to make transparent (obviously)
1341 1341
 
1342
-      // Ensure alpha transparency
1342
+        // Ensure alpha transparency
1343 1343
         imagesavealpha($this->imageResized,true);
1344 1344
 
1345 1345
     }
1346
-  }
1346
+    }
1347 1347
 
1348 1348
 
1349 1349
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1350 1350
   Round corners
1351 1351
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1352 1352
 
1353
-  public function roundCorners($radius = 5,  $bgColor = 'transparent')
1353
+    public function roundCorners($radius = 5,  $bgColor = 'transparent')
1354 1354
     # Author:     Jarrod Oberto
1355 1355
     # Date:       19-05-2011
1356 1356
     # Purpose:    Create rounded corners on your image
1357 1357
     # Param in:   (int) radius = the amount of curvature
1358
-  #       (mixed) $bgColor = the corner background color
1358
+    #       (mixed) $bgColor = the corner background color
1359 1359
     # Param out:  n/a
1360 1360
     # Reference:
1361 1361
     # Notes:
1362 1362
     #
1363
-  {
1363
+    {
1364 1364
 
1365 1365
     // *** Check if the user wants transparency
1366 1366
     $isTransparent = false;
1367 1367
     if (!is_array($bgColor)) {
1368
-      if (fix_strtolower($bgColor) === 'transparent') {
1368
+        if (fix_strtolower($bgColor) === 'transparent') {
1369 1369
         $isTransparent = true;
1370
-      }
1370
+        }
1371 1371
     }
1372 1372
 
1373 1373
 
1374 1374
     // *** If we use transparency, we need to color our curved mask with a unique color
1375 1375
     if ($isTransparent) {
1376
-      $bgColor = $this->findUnusedGreen();
1376
+        $bgColor = $this->findUnusedGreen();
1377 1377
     }
1378 1378
 
1379 1379
     // *** Convert color
@@ -1389,11 +1389,11 @@  discard block
 block discarded – undo
1389 1389
     $cornerImg = imagecreatetruecolor($radius, $radius);
1390 1390
     //$cornerImg = imagecreate($radius, $radius);
1391 1391
 
1392
-      //imagealphablending($cornerImg, true);
1393
-      //imagesavealpha($cornerImg, true);
1392
+        //imagealphablending($cornerImg, true);
1393
+        //imagesavealpha($cornerImg, true);
1394 1394
 
1395
-      //imagealphablending($this->imageResized, false);
1396
-      //imagesavealpha($this->imageResized, true);
1395
+        //imagealphablending($this->imageResized, false);
1396
+        //imagesavealpha($this->imageResized, true);
1397 1397
 
1398 1398
     // *** Give it a color
1399 1399
     $maskColor = imagecolorallocate($cornerImg, 0, 0, 0);
@@ -1433,30 +1433,30 @@  discard block
 block discarded – undo
1433 1433
 
1434 1434
     // *** If corners are to be transparent, we fill our chromakey color as transparent.
1435 1435
     if ($isTransparent) {
1436
-      //imagecolortransparent($this->imageResized, $imagebgColor);
1437
-      $this->imageResized = $this->transparentImage($this->imageResized);
1438
-      imagesavealpha($this->imageResized, true);
1436
+        //imagecolortransparent($this->imageResized, $imagebgColor);
1437
+        $this->imageResized = $this->transparentImage($this->imageResized);
1438
+        imagesavealpha($this->imageResized, true);
1439 1439
     }
1440 1440
 
1441
-  }
1441
+    }
1442 1442
 
1443 1443
 
1444 1444
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1445 1445
   Shadow
1446 1446
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1447 1447
 
1448
-  public function addShadow($shadowAngle=45, $blur=15, $bgColor='transparent')
1449
-  #
1450
-  # Author:   Jarrod Oberto (Adapted from Pascal Naidon)
1451
-  # Ref:    http://www.les-stooges.org/pascal/webdesign/vignettes/index.php?la=en
1452
-  # Purpose:  Add a drop shadow to your image
1453
-  # Params in:  (int) $angle: the angle of the shadow
1454
-  #       (int) $blur: the blur distance
1455
-  #       (mixed) $bgColor: the color of the background
1456
-  # Params out:
1457
-  # Notes:
1458
-  #
1459
-  {
1448
+    public function addShadow($shadowAngle=45, $blur=15, $bgColor='transparent')
1449
+    #
1450
+    # Author:   Jarrod Oberto (Adapted from Pascal Naidon)
1451
+    # Ref:    http://www.les-stooges.org/pascal/webdesign/vignettes/index.php?la=en
1452
+    # Purpose:  Add a drop shadow to your image
1453
+    # Params in:  (int) $angle: the angle of the shadow
1454
+    #       (int) $blur: the blur distance
1455
+    #       (mixed) $bgColor: the color of the background
1456
+    # Params out:
1457
+    # Notes:
1458
+    #
1459
+    {
1460 1460
     // *** A higher number results in a smoother shadow
1461 1461
     define('STEPS', $blur*2);
1462 1462
 
@@ -1468,20 +1468,20 @@  discard block
 block discarded – undo
1468 1468
 
1469 1469
 
1470 1470
     if ($shadowAngle == 0) {
1471
-      $distWidth = 0;
1472
-      $distHeight = 0;
1471
+        $distWidth = 0;
1472
+        $distHeight = 0;
1473 1473
     } else {
1474
-      $distWidth = $shadowDistance * cos(deg2rad($shadowAngle));
1475
-      $distHeight = $shadowDistance * sin(deg2rad($shadowAngle));
1474
+        $distWidth = $shadowDistance * cos(deg2rad($shadowAngle));
1475
+        $distHeight = $shadowDistance * sin(deg2rad($shadowAngle));
1476 1476
     }
1477 1477
 
1478 1478
 
1479 1479
     // *** Convert color
1480 1480
     if (fix_strtolower($bgColor) !== 'transparent') {
1481
-      $rgbArray = $this->formatColor($bgColor);
1482
-      $r0 = $rgbArray['r'];
1483
-      $g0 = $rgbArray['g'];
1484
-      $b0 = $rgbArray['b'];
1481
+        $rgbArray = $this->formatColor($bgColor);
1482
+        $r0 = $rgbArray['r'];
1483
+        $g0 = $rgbArray['g'];
1484
+        $b0 = $rgbArray['b'];
1485 1485
     }
1486 1486
 
1487 1487
 
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
     $height = $this->height;
1491 1491
 
1492 1492
 
1493
-      $newImage = imagecreatetruecolor($width, $height);
1493
+        $newImage = imagecreatetruecolor($width, $height);
1494 1494
     imagecopyresampled($newImage, $image, 0, 0, 0, 0, $width, $height, $width, $height);
1495 1495
 
1496 1496
 
@@ -1507,18 +1507,18 @@  discard block
 block discarded – undo
1507 1507
 
1508 1508
     // *** Shadow (alpha)
1509 1509
     $shadow = imagecreatetruecolor($width+$blurWidth,$height+$blurHeight);
1510
-      imagealphablending($shadow, false);
1510
+        imagealphablending($shadow, false);
1511 1511
     $colour = imagecolorallocate($shadow, 0, 0, 0);
1512 1512
     imagefilledrectangle($shadow, 0, 0, $width+$blurWidth, $height+$blurHeight, $colour);
1513 1513
 
1514 1514
 
1515 1515
     for($i=0;$i<=STEPS;$i++) {
1516 1516
 
1517
-      $t = ((1.0*$i)/STEPS);
1518
-      $intensity = 255*$t*$t;
1517
+        $t = ((1.0*$i)/STEPS);
1518
+        $intensity = 255*$t*$t;
1519 1519
 
1520
-      $colour = imagecolorallocate($shadow, $intensity, $intensity, $intensity);
1521
-      $points = array(
1520
+        $colour = imagecolorallocate($shadow, $intensity, $intensity, $intensity);
1521
+        $points = array(
1522 1522
         $blurWidth*$t,        $blurHeight,     // Point 1 (x, y)
1523 1523
         $blurWidth,         $blurHeight*$t,  // Point 2 (x, y)
1524 1524
         $width,           $blurHeight*$t,  // Point 3 (x, y)
@@ -1527,20 +1527,20 @@  discard block
 block discarded – undo
1527 1527
         $width,           $height+$blurHeight*(1-$t),  // Point 6 (x, y)
1528 1528
         $blurWidth,         $height+$blurHeight*(1-$t),  // Point 7 (x, y)
1529 1529
         $blurWidth*$t,        $height      // Point 8 (x, y)
1530
-      );
1531
-      imagepolygon($shadow, $points, 8, $colour);
1530
+        );
1531
+        imagepolygon($shadow, $points, 8, $colour);
1532 1532
     }
1533 1533
 
1534 1534
     for($i=0;$i<=STEPS;$i++) {
1535 1535
 
1536
-      $t = ((1.0*$i)/STEPS);
1536
+        $t = ((1.0*$i)/STEPS);
1537 1537
         $intensity = 255*$t*$t;
1538 1538
 
1539
-      $colour = imagecolorallocate($shadow, $intensity, $intensity, $intensity);
1540
-      imagefilledarc($shadow, $blurWidth-1, $blurHeight-1, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 180, 268, $colour, IMG_ARC_PIE);
1541
-      imagefilledarc($shadow, $width, $blurHeight-1, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 270, 358, $colour, IMG_ARC_PIE);
1542
-      imagefilledarc($shadow, $width, $height, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 0, 90, $colour, IMG_ARC_PIE);
1543
-      imagefilledarc($shadow, $blurWidth-1, $height, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 90, 180, $colour, IMG_ARC_PIE);
1539
+        $colour = imagecolorallocate($shadow, $intensity, $intensity, $intensity);
1540
+        imagefilledarc($shadow, $blurWidth-1, $blurHeight-1, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 180, 268, $colour, IMG_ARC_PIE);
1541
+        imagefilledarc($shadow, $width, $blurHeight-1, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 270, 358, $colour, IMG_ARC_PIE);
1542
+        imagefilledarc($shadow, $width, $height, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 0, 90, $colour, IMG_ARC_PIE);
1543
+        imagefilledarc($shadow, $blurWidth-1, $height, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 90, 180, $colour, IMG_ARC_PIE);
1544 1544
     }
1545 1545
 
1546 1546
 
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
         imagealphablending($rgb, false);
1554 1554
 
1555 1555
         for ($theX=0;$theX<imagesx($rgb);$theX++){
1556
-      for ($theY=0;$theY<imagesy($rgb);$theY++){
1556
+        for ($theY=0;$theY<imagesy($rgb);$theY++){
1557 1557
 
1558 1558
         // *** Get the RGB values for every pixel of the RGB image
1559 1559
         $colArray = imagecolorat($rgb,$theX,$theY);
@@ -1569,14 +1569,14 @@  discard block
 block discarded – undo
1569 1569
 
1570 1570
         // *** Create color
1571 1571
         if(fix_strtolower($bgColor) === 'transparent') {
1572
-          $myColour = imagecolorallocatealpha($rgb,$r,$g,$b,$a);
1572
+            $myColour = imagecolorallocatealpha($rgb,$r,$g,$b,$a);
1573 1573
         } else {
1574
-          $myColour = imagecolorallocate($rgb,$r*(1.0-$t)+$r0*$t,$g*(1.0-$t)+$g0*$t,$b*(1.0-$t)+$b0*$t);
1574
+            $myColour = imagecolorallocate($rgb,$r*(1.0-$t)+$r0*$t,$g*(1.0-$t)+$g0*$t,$b*(1.0-$t)+$b0*$t);
1575 1575
         }
1576 1576
 
1577 1577
         // *** Add color to new rgb image
1578 1578
         imagesetpixel($rgb, $theX, $theY, $myColour);
1579
-      }
1579
+        }
1580 1580
     }
1581 1581
 
1582 1582
     imagealphablending($rgb, true);
@@ -1587,68 +1587,68 @@  discard block
 block discarded – undo
1587 1587
     imagedestroy($image);
1588 1588
     imagedestroy($newImage);
1589 1589
     imagedestroy($shadow);
1590
-  }
1590
+    }
1591 1591
 
1592 1592
 
1593 1593
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1594 1594
   Add Caption Box
1595 1595
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1596 1596
 
1597
-  public function addCaptionBox($side='b', $thickness=50, $padding=0, $bgColor='#000', $transaprencyAmount=30)
1598
-  #
1599
-  # Author:   Jarrod Oberto
1600
-  # Date:   26 May 2011
1601
-  # Purpose:  Add a caption box
1602
-  # Params in:  (str) $side: the side to add the caption box (t, r, b, or l).
1603
-  #       (int) $thickness: how thick you want the caption box to be.
1604
-  #       (mixed) $bgColor: The color of the caption box.
1605
-  #       (int) $transaprencyAmount: The amount of transparency to be
1606
-  #       applied.
1607
-  # Params out: n/a
1608
-  # Notes:
1609
-  #
1610
-  {
1611
-      $side = fix_strtolower($side);
1612
-
1613
-      // *** Convert color
1614
-      $rgbArray = $this->formatColor($bgColor);
1615
-      $r = $rgbArray['r'];
1616
-      $g = $rgbArray['g'];
1617
-      $b = $rgbArray['b'];
1618
-
1619
-      $positionArray = $this->calculateCaptionBoxPosition($side, $thickness, $padding);
1620
-
1621
-      // *** Store incase we want to use method addTextToCaptionBox()
1622
-      $this->captionBoxPositionArray = $positionArray;
1623
-
1624
-
1625
-      $transaprencyAmount = $this->invertTransparency($transaprencyAmount, 127, false);
1626
-      $transparent = imagecolorallocatealpha($this->imageResized, $r, $g, $b, $transaprencyAmount);
1627
-      imagefilledrectangle($this->imageResized, $positionArray['x1'], $positionArray['y1'], $positionArray['x2'], $positionArray['y2'], $transparent);
1628
-  }
1629
-
1630
-  ## --------------------------------------------------------
1631
-
1632
-  public function addTextToCaptionBox($text, $fontColor='#fff', $fontSize = 12, $angle = 0, $font = null)
1633
-  #
1634
-  # Author:   Jarrod Oberto
1635
-  # Date:   03 Aug 11
1636
-  # Purpose:  Simplify adding text to a caption box by automatically
1637
-  #       locating the center of the caption box
1638
-  # Params in:  The usually text paams (less a couple)
1639
-  # Params out: n/a
1640
-  # Notes:
1641
-  #
1642
-  {
1597
+    public function addCaptionBox($side='b', $thickness=50, $padding=0, $bgColor='#000', $transaprencyAmount=30)
1598
+    #
1599
+    # Author:   Jarrod Oberto
1600
+    # Date:   26 May 2011
1601
+    # Purpose:  Add a caption box
1602
+    # Params in:  (str) $side: the side to add the caption box (t, r, b, or l).
1603
+    #       (int) $thickness: how thick you want the caption box to be.
1604
+    #       (mixed) $bgColor: The color of the caption box.
1605
+    #       (int) $transaprencyAmount: The amount of transparency to be
1606
+    #       applied.
1607
+    # Params out: n/a
1608
+    # Notes:
1609
+    #
1610
+    {
1611
+        $side = fix_strtolower($side);
1612
+
1613
+        // *** Convert color
1614
+        $rgbArray = $this->formatColor($bgColor);
1615
+        $r = $rgbArray['r'];
1616
+        $g = $rgbArray['g'];
1617
+        $b = $rgbArray['b'];
1618
+
1619
+        $positionArray = $this->calculateCaptionBoxPosition($side, $thickness, $padding);
1620
+
1621
+        // *** Store incase we want to use method addTextToCaptionBox()
1622
+        $this->captionBoxPositionArray = $positionArray;
1623
+
1624
+
1625
+        $transaprencyAmount = $this->invertTransparency($transaprencyAmount, 127, false);
1626
+        $transparent = imagecolorallocatealpha($this->imageResized, $r, $g, $b, $transaprencyAmount);
1627
+        imagefilledrectangle($this->imageResized, $positionArray['x1'], $positionArray['y1'], $positionArray['x2'], $positionArray['y2'], $transparent);
1628
+    }
1629
+
1630
+    ## --------------------------------------------------------
1631
+
1632
+    public function addTextToCaptionBox($text, $fontColor='#fff', $fontSize = 12, $angle = 0, $font = null)
1633
+    #
1634
+    # Author:   Jarrod Oberto
1635
+    # Date:   03 Aug 11
1636
+    # Purpose:  Simplify adding text to a caption box by automatically
1637
+    #       locating the center of the caption box
1638
+    # Params in:  The usually text paams (less a couple)
1639
+    # Params out: n/a
1640
+    # Notes:
1641
+    #
1642
+    {
1643 1643
 
1644 1644
     // *** Get the caption box measurements
1645 1645
     if (count($this->captionBoxPositionArray) == 4) {
1646
-      $x1 = $this->captionBoxPositionArray['x1'];
1647
-      $x2 = $this->captionBoxPositionArray['x2'];
1648
-      $y1 = $this->captionBoxPositionArray['y1'];
1649
-      $y2 = $this->captionBoxPositionArray['y2'];
1646
+        $x1 = $this->captionBoxPositionArray['x1'];
1647
+        $x2 = $this->captionBoxPositionArray['x2'];
1648
+        $y1 = $this->captionBoxPositionArray['y1'];
1649
+        $y2 = $this->captionBoxPositionArray['y2'];
1650 1650
     } else {
1651
-      if ($this->debug) { throw new Exception('No caption box found.'); }else{ return false; }
1651
+        if ($this->debug) { throw new Exception('No caption box found.'); }else{ return false; }
1652 1652
     }
1653 1653
 
1654 1654
 
@@ -1672,53 +1672,53 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
     $this->addText($text, $pos, $padding = 0, $fontColor, $fontSize, $angle, $font);
1674 1674
 
1675
-  }
1675
+    }
1676 1676
 
1677
-  ## --------------------------------------------------------
1677
+    ## --------------------------------------------------------
1678 1678
 
1679
-  private function calculateCaptionBoxPosition($side, $thickness, $padding)
1680
-  {
1679
+    private function calculateCaptionBoxPosition($side, $thickness, $padding)
1680
+    {
1681 1681
     $positionArray = array();
1682 1682
 
1683 1683
     switch ($side) {
1684
-      case 't':
1684
+        case 't':
1685 1685
         $positionArray['x1'] = 0;
1686 1686
         $positionArray['y1'] = $padding;
1687 1687
         $positionArray['x2'] = $this->width;
1688 1688
         $positionArray['y2'] = $thickness + $padding;
1689 1689
         break;
1690
-      case 'r':
1690
+        case 'r':
1691 1691
         $positionArray['x1'] = $this->width - $thickness - $padding;
1692 1692
         $positionArray['y1'] = 0;
1693 1693
         $positionArray['x2'] = $this->width - $padding;
1694 1694
         $positionArray['y2'] = $this->height;
1695 1695
         break;
1696
-      case 'b':
1696
+        case 'b':
1697 1697
         $positionArray['x1'] = 0;
1698 1698
         $positionArray['y1'] = $this->height - $thickness - $padding;
1699 1699
         $positionArray['x2'] = $this->width;
1700 1700
         $positionArray['y2'] = $this->height - $padding;
1701 1701
         break;
1702
-      case 'l':
1702
+        case 'l':
1703 1703
         $positionArray['x1'] = $padding;
1704 1704
         $positionArray['y1'] = 0;
1705 1705
         $positionArray['x2'] = $thickness + $padding;
1706 1706
         $positionArray['y2'] = $this->height;
1707 1707
         break;
1708 1708
 
1709
-      default:
1709
+        default:
1710 1710
         break;
1711 1711
     }
1712 1712
 
1713 1713
     return $positionArray;
1714 1714
 
1715
-  }
1715
+    }
1716 1716
 
1717 1717
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
1718 1718
   Get EXIF Data
1719 1719
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1720 1720
 
1721
-  public function getExif($debug=false)
1721
+    public function getExif($debug=false)
1722 1722
     # Author:     Jarrod Oberto
1723 1723
     # Date:       07-05-2011
1724 1724
     # Purpose:    Get image EXIF data
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
     # Notes:
1729 1729
     # 23 May 13 : added orientation flag -jco
1730 1730
     #
1731
-  {
1731
+    {
1732 1732
 
1733 1733
     if (!$this->debug || !$debug) { $debug = false; }
1734 1734
 
@@ -1742,21 +1742,21 @@  discard block
 block discarded – undo
1742 1742
     $ev = $exifData['ApertureValue'];
1743 1743
     $apPeicesArray = explode('/', $ev);
1744 1744
     if (count($apPeicesArray) == 2) {
1745
-      $apertureValue = round($apPeicesArray[0] / $apPeicesArray[1], 2, PHP_ROUND_HALF_DOWN) . ' EV';
1745
+        $apertureValue = round($apPeicesArray[0] / $apPeicesArray[1], 2, PHP_ROUND_HALF_DOWN) . ' EV';
1746 1746
     } else { $apertureValue = '';}
1747 1747
 
1748 1748
     // *** Format the focal length
1749 1749
     $focalLength = $exifData['FocalLength'];
1750 1750
     $flPeicesArray = explode('/', $focalLength);
1751 1751
     if (count($flPeicesArray) == 2) {
1752
-      $focalLength = $flPeicesArray[0] / $flPeicesArray[1] . '.0 mm';
1752
+        $focalLength = $flPeicesArray[0] / $flPeicesArray[1] . '.0 mm';
1753 1753
     } else { $focalLength = '';}
1754 1754
 
1755 1755
     // *** Format fNumber
1756 1756
     $fNumber = $exifData['FNumber'];
1757 1757
     $fnPeicesArray = explode('/', $fNumber);
1758 1758
     if (count($fnPeicesArray) == 2) {
1759
-      $fNumber = $fnPeicesArray[0] / $fnPeicesArray[1];
1759
+        $fNumber = $fnPeicesArray[0] / $fnPeicesArray[1];
1760 1760
     } else { $fNumber = '';}
1761 1761
 
1762 1762
     // *** Resolve ExposureProgram
@@ -1774,63 +1774,63 @@  discard block
 block discarded – undo
1774 1774
 
1775 1775
 
1776 1776
     if (isset($exifData['Make'])) {
1777
-      $exifDataArray['make'] = $exifData['Make'];
1777
+        $exifDataArray['make'] = $exifData['Make'];
1778 1778
     } else { $exifDataArray['make'] = ''; }
1779 1779
 
1780 1780
     if (isset($exifData['Model'])) {
1781
-      $exifDataArray['model'] = $exifData['Model'];
1781
+        $exifDataArray['model'] = $exifData['Model'];
1782 1782
     } else { $exifDataArray['model'] = ''; }
1783 1783
 
1784 1784
     if (isset($exifData['DateTime'])) {
1785
-      $exifDataArray['date'] = $exifData['DateTime'];
1785
+        $exifDataArray['date'] = $exifData['DateTime'];
1786 1786
     } else { $exifDataArray['date'] = ''; }
1787 1787
 
1788 1788
     if (isset($exifData['ExposureTime'])) {
1789
-      $exifDataArray['exposure time'] = $exifData['ExposureTime'] . ' sec.';
1789
+        $exifDataArray['exposure time'] = $exifData['ExposureTime'] . ' sec.';
1790 1790
     } else { $exifDataArray['exposure time'] = ''; }
1791 1791
 
1792 1792
     if ($apertureValue != '') {
1793
-      $exifDataArray['aperture value'] = $apertureValue;
1793
+        $exifDataArray['aperture value'] = $apertureValue;
1794 1794
     } else { $exifDataArray['aperture value'] = ''; }
1795 1795
 
1796 1796
     if (isset($exifData['COMPUTED']['ApertureFNumber'])) {
1797
-      $exifDataArray['f-stop'] = $exifData['COMPUTED']['ApertureFNumber'];
1797
+        $exifDataArray['f-stop'] = $exifData['COMPUTED']['ApertureFNumber'];
1798 1798
     } else { $exifDataArray['f-stop'] = ''; }
1799 1799
 
1800 1800
     if (isset($exifData['FNumber'])) {
1801
-      $exifDataArray['fnumber'] = $exifData['FNumber'];
1801
+        $exifDataArray['fnumber'] = $exifData['FNumber'];
1802 1802
     } else { $exifDataArray['fnumber'] = ''; }
1803 1803
 
1804 1804
     if ($fNumber != '') {
1805
-      $exifDataArray['fnumber value'] = $fNumber;
1805
+        $exifDataArray['fnumber value'] = $fNumber;
1806 1806
     } else { $exifDataArray['fnumber value'] = ''; }
1807 1807
 
1808 1808
     if (isset($exifData['ISOSpeedRatings'])) {
1809
-      $exifDataArray['iso'] = $exifData['ISOSpeedRatings'];
1809
+        $exifDataArray['iso'] = $exifData['ISOSpeedRatings'];
1810 1810
     } else { $exifDataArray['iso'] = ''; }
1811 1811
 
1812 1812
     if ($focalLength != '') {
1813
-      $exifDataArray['focal length'] = $focalLength;
1813
+        $exifDataArray['focal length'] = $focalLength;
1814 1814
     } else { $exifDataArray['focal length'] = ''; }
1815 1815
 
1816 1816
     if (isset($ep)) {
1817
-      $exifDataArray['exposure program'] = $ep;
1817
+        $exifDataArray['exposure program'] = $ep;
1818 1818
     } else { $exifDataArray['exposure program'] = ''; }
1819 1819
 
1820 1820
     if ($mm != '') {
1821
-      $exifDataArray['metering mode'] = $mm;
1821
+        $exifDataArray['metering mode'] = $mm;
1822 1822
     } else { $exifDataArray['metering mode'] = ''; }
1823 1823
 
1824 1824
     if ($flash != '') {
1825
-      $exifDataArray['flash status'] = $flash;
1825
+        $exifDataArray['flash status'] = $flash;
1826 1826
     } else { $exifDataArray['flash status'] = ''; }
1827 1827
 
1828 1828
     if (isset($exifData['Artist'])) {
1829
-      $exifDataArray['creator'] = $exifData['Artist'] ;
1829
+        $exifDataArray['creator'] = $exifData['Artist'] ;
1830 1830
     } else { $exifDataArray['creator'] = ''; }
1831 1831
 
1832 1832
     if (isset($exifData['Copyright'])) {
1833
-      $exifDataArray['copyright'] = $exifData['Copyright'];
1833
+        $exifDataArray['copyright'] = $exifData['Copyright'];
1834 1834
     } else { $exifDataArray['copyright'] = ''; }
1835 1835
 
1836 1836
     // *** Orientation
@@ -1839,164 +1839,164 @@  discard block
 block discarded – undo
1839 1839
     } else { $exifDataArray['orientation'] = ''; }
1840 1840
 
1841 1841
     return $exifDataArray;
1842
-  }
1842
+    }
1843 1843
 
1844
-  ## --------------------------------------------------------
1844
+    ## --------------------------------------------------------
1845 1845
 
1846
-  private function resolveExposureProgram($ep)
1847
-  {
1846
+    private function resolveExposureProgram($ep)
1847
+    {
1848 1848
     switch ($ep) {
1849
-      case 0:
1849
+        case 0:
1850 1850
         $ep = '';
1851 1851
         break;
1852
-      case 1:
1852
+        case 1:
1853 1853
         $ep = 'manual';
1854 1854
         break;
1855
-      case 2:
1855
+        case 2:
1856 1856
         $ep = 'normal program';
1857 1857
         break;
1858
-      case 3:
1858
+        case 3:
1859 1859
         $ep = 'aperture priority';
1860 1860
         break;
1861
-      case 4:
1861
+        case 4:
1862 1862
         $ep = 'shutter priority';
1863 1863
         break;
1864
-      case 5:
1864
+        case 5:
1865 1865
         $ep = 'creative program';
1866 1866
         break;
1867
-      case 6:
1867
+        case 6:
1868 1868
         $ep = 'action program';
1869 1869
         break;
1870
-      case 7:
1870
+        case 7:
1871 1871
         $ep = 'portrait mode';
1872 1872
         break;
1873
-      case 8:
1873
+        case 8:
1874 1874
         $ep = 'landscape mode';
1875 1875
         break;
1876 1876
 
1877
-      default:
1877
+        default:
1878 1878
         break;
1879 1879
     }
1880 1880
 
1881 1881
     return $ep;
1882
-  }
1882
+    }
1883 1883
 
1884
-  ## --------------------------------------------------------
1884
+    ## --------------------------------------------------------
1885 1885
 
1886
-  private function resolveMeteringMode($mm)
1887
-  {
1886
+    private function resolveMeteringMode($mm)
1887
+    {
1888 1888
     switch ($mm) {
1889
-      case 0:
1889
+        case 0:
1890 1890
         $mm = 'unknown';
1891 1891
         break;
1892
-      case 1:
1892
+        case 1:
1893 1893
         $mm = 'average';
1894 1894
         break;
1895
-      case 2:
1895
+        case 2:
1896 1896
         $mm = 'center weighted average';
1897 1897
         break;
1898
-      case 3:
1898
+        case 3:
1899 1899
         $mm = 'spot';
1900 1900
         break;
1901
-      case 4:
1901
+        case 4:
1902 1902
         $mm = 'multi spot';
1903 1903
         break;
1904
-      case 5:
1904
+        case 5:
1905 1905
         $mm = 'pattern';
1906 1906
         break;
1907
-      case 6:
1907
+        case 6:
1908 1908
         $mm = 'partial';
1909 1909
         break;
1910
-      case 255:
1910
+        case 255:
1911 1911
         $mm = 'other';
1912 1912
         break;
1913 1913
 
1914
-      default:
1914
+        default:
1915 1915
         break;
1916 1916
     }
1917 1917
 
1918 1918
     return $mm;
1919
-  }
1919
+    }
1920 1920
 
1921
-  ## --------------------------------------------------------
1921
+    ## --------------------------------------------------------
1922 1922
 
1923
-  private function resolveFlash($flash)
1924
-  {
1923
+    private function resolveFlash($flash)
1924
+    {
1925 1925
     switch ($flash) {
1926
-      case 0:
1926
+        case 0:
1927 1927
         $flash = 'flash did not fire';
1928 1928
         break;
1929
-      case 1:
1929
+        case 1:
1930 1930
         $flash = 'flash fired';
1931 1931
         break;
1932
-      case 5:
1932
+        case 5:
1933 1933
         $flash = 'strobe return light not detected';
1934 1934
         break;
1935
-      case 7:
1935
+        case 7:
1936 1936
         $flash = 'strobe return light detected';
1937 1937
         break;
1938
-      case 9:
1938
+        case 9:
1939 1939
         $flash = 'flash fired, compulsory flash mode';
1940 1940
         break;
1941
-      case 13:
1941
+        case 13:
1942 1942
         $flash = 'flash fired, compulsory flash mode, return light not detected';
1943 1943
         break;
1944
-      case 15:
1944
+        case 15:
1945 1945
         $flash = 'flash fired, compulsory flash mode, return light detected';
1946 1946
         break;
1947
-      case 16:
1947
+        case 16:
1948 1948
         $flash = 'flash did not fire, compulsory flash mode';
1949 1949
         break;
1950
-      case 24:
1950
+        case 24:
1951 1951
         $flash = 'flash did not fire, auto mode';
1952 1952
         break;
1953
-      case 25:
1953
+        case 25:
1954 1954
         $flash = 'flash fired, auto mode';
1955 1955
         break;
1956
-      case 29:
1956
+        case 29:
1957 1957
         $flash = 'flash fired, auto mode, return light not detected';
1958 1958
         break;
1959
-      case 31:
1959
+        case 31:
1960 1960
         $flash = 'flash fired, auto mode, return light detected';
1961 1961
         break;
1962
-      case 32:
1962
+        case 32:
1963 1963
         $flash = 'no flash function';
1964 1964
         break;
1965
-      case 65:
1965
+        case 65:
1966 1966
         $flash = 'flash fired, red-eye reduction mode';
1967 1967
         break;
1968
-      case 69:
1968
+        case 69:
1969 1969
         $flash = 'flash fired, red-eye reduction mode, return light not detected';
1970 1970
         break;
1971
-      case 71:
1971
+        case 71:
1972 1972
         $flash = 'flash fired, red-eye reduction mode, return light detected';
1973 1973
         break;
1974
-      case 73:
1974
+        case 73:
1975 1975
         $flash = 'flash fired, compulsory flash mode, red-eye reduction mode';
1976 1976
         break;
1977
-      case 77:
1977
+        case 77:
1978 1978
         $flash = 'flash fired, compulsory flash mode, red-eye reduction mode, return light not detected';
1979 1979
         break;
1980
-      case 79:
1980
+        case 79:
1981 1981
         $flash = 'flash fired, compulsory flash mode, red-eye reduction mode, return light detected';
1982 1982
         break;
1983
-      case 89:
1983
+        case 89:
1984 1984
         $flash = 'flash fired, auto mode, red-eye reduction mode';
1985 1985
         break;
1986
-      case 93:
1986
+        case 93:
1987 1987
         $flash = 'flash fired, auto mode, return light not detected, red-eye reduction mode';
1988 1988
         break;
1989
-      case 95:
1989
+        case 95:
1990 1990
         $flash = 'flash fired, auto mode, return light detected, red-eye reduction mode';
1991 1991
         break;
1992 1992
 
1993
-      default:
1993
+        default:
1994 1994
         break;
1995 1995
     }
1996 1996
 
1997 1997
     return $flash;
1998 1998
 
1999
-  }
1999
+    }
2000 2000
 
2001 2001
 
2002 2002
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
@@ -2008,61 +2008,61 @@  discard block
 block discarded – undo
2008 2008
   Write IPTC Data
2009 2009
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
2010 2010
 
2011
-  public function writeIPTCcaption($value)
2012
-  # Caption
2013
-  {
2011
+    public function writeIPTCcaption($value)
2012
+    # Caption
2013
+    {
2014 2014
     $this->writeIPTC(120, $value);
2015
-  }
2015
+    }
2016 2016
 
2017
-  ## --------------------------------------------------------
2017
+    ## --------------------------------------------------------
2018 2018
 
2019
-  public function writeIPTCwriter($value)
2020
-  {
2019
+    public function writeIPTCwriter($value)
2020
+    {
2021 2021
     //$this->writeIPTC(65, $value);
2022
-  }
2022
+    }
2023 2023
 
2024
-  ## --------------------------------------------------------
2024
+    ## --------------------------------------------------------
2025 2025
 
2026
-  private function writeIPTC($dat, $value)
2027
-  {
2026
+    private function writeIPTC($dat, $value)
2027
+    {
2028 2028
 
2029 2029
     # LIMIT TO JPG
2030 2030
 
2031 2031
     $caption_block = $this->iptc_maketag(2, $dat, $value);
2032 2032
     $image_string = iptcembed($caption_block, $this->fileName);
2033 2033
     file_put_contents('iptc.jpg', $image_string);
2034
-  }
2034
+    }
2035 2035
 
2036 2036
 ## --------------------------------------------------------
2037 2037
 
2038
-  private function iptc_maketag($rec,$dat,$val)
2039
-  # Author:   Thies C. Arntzen
2040
-  # Purpose:    Function to format the new IPTC text
2041
-  # Param in:   $rec: Application record. (We’re working with #2)
2042
-  #       $dat: Index. (120 for caption, 118 for contact. See the IPTC IIM
2043
-  #         specification:
2044
-  #         http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
2045
-  #       $val: Value/data/text. Make sure this is within the length
2046
-  #         constraints of the IPTC IIM specification
2047
-  # Ref:      http://blog.peterhaza.no/working-with-image-meta-data-in-exif-and-iptc-headers-from-php/
2048
-  #       http://php.net/manual/en/function.iptcembed.php
2049
-  #
2050
-  {
2038
+    private function iptc_maketag($rec,$dat,$val)
2039
+    # Author:   Thies C. Arntzen
2040
+    # Purpose:    Function to format the new IPTC text
2041
+    # Param in:   $rec: Application record. (We’re working with #2)
2042
+    #       $dat: Index. (120 for caption, 118 for contact. See the IPTC IIM
2043
+    #         specification:
2044
+    #         http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
2045
+    #       $val: Value/data/text. Make sure this is within the length
2046
+    #         constraints of the IPTC IIM specification
2047
+    # Ref:      http://blog.peterhaza.no/working-with-image-meta-data-in-exif-and-iptc-headers-from-php/
2048
+    #       http://php.net/manual/en/function.iptcembed.php
2049
+    #
2050
+    {
2051 2051
     $len = strlen($val);
2052 2052
     if ($len < 0x8000)
2053
-      return chr(0x1c).chr($rec).chr($dat).
2054
-      chr($len >> 8).
2055
-      chr($len & 0xff).
2056
-      $val;
2053
+        return chr(0x1c).chr($rec).chr($dat).
2054
+        chr($len >> 8).
2055
+        chr($len & 0xff).
2056
+        $val;
2057 2057
     else
2058
-      return chr(0x1c).chr($rec).chr($dat).
2059
-      chr(0x80).chr(0x04).
2060
-      chr(($len >> 24) & 0xff).
2061
-      chr(($len >> 16) & 0xff).
2062
-      chr(($len >> 8 ) & 0xff).
2063
-      chr(($len ) & 0xff).
2064
-      $val;
2065
-  }
2058
+        return chr(0x1c).chr($rec).chr($dat).
2059
+        chr(0x80).chr(0x04).
2060
+        chr(($len >> 24) & 0xff).
2061
+        chr(($len >> 16) & 0xff).
2062
+        chr(($len >> 8 ) & 0xff).
2063
+        chr(($len ) & 0xff).
2064
+        $val;
2065
+    }
2066 2066
 
2067 2067
 
2068 2068
 
@@ -2070,23 +2070,23 @@  discard block
 block discarded – undo
2070 2070
   Write XMP Data
2071 2071
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
2072 2072
 
2073
-  //http://xmpphptoolkit.sourceforge.net/
2073
+    //http://xmpphptoolkit.sourceforge.net/
2074 2074
 
2075 2075
 
2076 2076
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
2077 2077
   Add Text
2078 2078
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
2079 2079
 
2080
-  public function addText($text, $pos = '20x20', $padding = 0, $fontColor='#fff', $fontSize = 12, $angle = 0, $font = null)
2080
+    public function addText($text, $pos = '20x20', $padding = 0, $fontColor='#fff', $fontSize = 12, $angle = 0, $font = null)
2081 2081
     # Author:     Jarrod Oberto
2082
-  # Date:       18-11-09
2082
+    # Date:       18-11-09
2083 2083
     # Purpose:    Add text to an image
2084 2084
     # Param in:
2085 2085
     # Param out:
2086 2086
     # Reference:  http://php.net/manual/en/function.imagettftext.php
2087 2087
     # Notes:      Make sure you supply the font.
2088 2088
     #
2089
-  {
2089
+    {
2090 2090
 
2091 2091
     // *** Convert color
2092 2092
     $rgbArray = $this->formatColor($fontColor);
@@ -2111,12 +2111,12 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
     // *** Add text
2113 2113
     imagettftext($this->imageResized, $fontSize, $angle, $x, $y, $fontColor, $font, $text);
2114
-  }
2114
+    }
2115 2115
 
2116
-  ## --------------------------------------------------------
2116
+    ## --------------------------------------------------------
2117 2117
 
2118
-  private function getTextFont($font)
2119
-  {
2118
+    private function getTextFont($font)
2119
+    {
2120 2120
     // *** Font path (shou
2121 2121
     $fontPath =  __DIR__ . '/' . $this->fontDir;
2122 2122
 
@@ -2127,25 +2127,25 @@  discard block
 block discarded – undo
2127 2127
     // *** Check if the passed in font exsits...
2128 2128
     if ($font == null || !file_exists($font)) {
2129 2129
 
2130
-      // *** ...If not, default to this font.
2131
-      $font = $fontPath . '/arimo.ttf';
2130
+        // *** ...If not, default to this font.
2131
+        $font = $fontPath . '/arimo.ttf';
2132 2132
 
2133
-      // *** Check our default font exists...
2134
-      if (!file_exists($font)) {
2133
+        // *** Check our default font exists...
2134
+        if (!file_exists($font)) {
2135 2135
 
2136 2136
         // *** If not, return false
2137 2137
         if ($this->debug) { throw new Exception('Font not found'); }else{ return false; }
2138
-      }
2138
+        }
2139 2139
     }
2140 2140
 
2141 2141
     return $font;
2142 2142
 
2143
-  }
2143
+    }
2144 2144
 
2145
-  ## --------------------------------------------------------
2145
+    ## --------------------------------------------------------
2146 2146
 
2147
-  private function getTextSize($fontSize, $angle, $font, $text)
2148
-  {
2147
+    private function getTextSize($fontSize, $angle, $font, $text)
2148
+    {
2149 2149
 
2150 2150
     // *** Define box (so we can get the width)
2151 2151
     $box = @imagettfbbox($fontSize, $angle, $font, $text);
@@ -2157,39 +2157,39 @@  discard block
 block discarded – undo
2157 2157
     $textHeight = abs($box[5] - $box[1]);
2158 2158
 
2159 2159
     return array('height' => $textHeight, 'width' => $textWidth);
2160
-  }
2160
+    }
2161 2161
 
2162 2162
 
2163 2163
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
2164 2164
   Add Watermark
2165 2165
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
2166 2166
 
2167
-  public function addWatermark($watermarkImage, $pos, $padding = 0, $opacity = 0)
2167
+    public function addWatermark($watermarkImage, $pos, $padding = 0, $opacity = 0)
2168 2168
     # Author:     Jarrod Oberto
2169 2169
     # Date:       18-11-09
2170 2170
     # Purpose:    Add watermark image
2171 2171
     # Param in:   (str) $watermark: The watermark image
2172
-  #       (str) $pos: Could be a pre-determined position such as:
2173
-  #           tl = top left,
2174
-  #           t  = top (middle),
2175
-  #           tr = top right,
2176
-  #           l  = left,
2177
-  #           m  = middle,
2178
-  #           r  = right,
2179
-  #           bl = bottom left,
2180
-  #           b  = bottom (middle),
2181
-  #           br = bottom right
2182
-  #         Or, it could be a co-ordinate position such as: 50x100
2183
-  #
2184
-  #       (int) $padding: If using a pre-determined position you can
2185
-  #         adjust the padding from the edges by passing an amount
2186
-  #         in pixels. If using co-ordinates, this value is ignored.
2172
+    #       (str) $pos: Could be a pre-determined position such as:
2173
+    #           tl = top left,
2174
+    #           t  = top (middle),
2175
+    #           tr = top right,
2176
+    #           l  = left,
2177
+    #           m  = middle,
2178
+    #           r  = right,
2179
+    #           bl = bottom left,
2180
+    #           b  = bottom (middle),
2181
+    #           br = bottom right
2182
+    #         Or, it could be a co-ordinate position such as: 50x100
2183
+    #
2184
+    #       (int) $padding: If using a pre-determined position you can
2185
+    #         adjust the padding from the edges by passing an amount
2186
+    #         in pixels. If using co-ordinates, this value is ignored.
2187 2187
     # Param out:
2188 2188
     # Reference:  http://www.php.net/manual/en/image.examples-watermark.php
2189 2189
     # Notes:      Based on example in reference.
2190
-  #
2191 2190
     #
2192
-  {
2191
+    #
2192
+    {
2193 2193
 
2194 2194
     // Load the stamp and the photo to apply the watermark to
2195 2195
     $stamp = $this->openImage ($watermarkImage);    # stamp
@@ -2207,132 +2207,132 @@  discard block
 block discarded – undo
2207 2207
     // *** Set watermark opacity
2208 2208
     if (fix_strtolower(strrchr($watermarkImage, '.')) === '.png') {
2209 2209
 
2210
-      $opacity = $this->invertTransparency($opacity, 100);
2211
-      $this->filterOpacity($stamp, $opacity);
2210
+        $opacity = $this->invertTransparency($opacity, 100);
2211
+        $this->filterOpacity($stamp, $opacity);
2212 2212
     }
2213 2213
 
2214 2214
     // Copy the watermark image onto our photo
2215 2215
     imagecopy($im, $stamp, $x, $y, 0, 0, imagesx($stamp), imagesy($stamp));
2216 2216
 
2217
-  }
2218
-
2219
-  ## --------------------------------------------------------
2220
-
2221
-  private function calculatePosition($pos, $padding, $assetWidth, $assetHeight, $upperLeft = true)
2222
-  #
2223
-  # Author:   Jarrod Oberto
2224
-  # Date:   08-05-11
2225
-  # Purpose:  Calculate the x, y pixel cordinates of the asset to place
2226
-  # Params in:  (str) $pos: Either something like: "tl", "l", "br" or an
2227
-  #         exact position like: "100x50"
2228
-  #       (int) $padding: The amount of padding from the edge. Only
2229
-  #         used for the predefined $pos.
2230
-  #       (int) $assetWidth: The width of the asset to add to the image
2231
-  #       (int) $assetHeight: The height of the asset to add to the image
2232
-  #       (bol) $upperLeft: if true, the asset will be positioned based
2233
-  #         on the upper left x, y coords. If false, it means you're
2234
-  #         using the lower left as the basepoint and this will
2235
-  #         convert it to the upper left position
2236
-  # Params out:
2237
-  # NOTE: this is done from the UPPER left corner!! But will convert lower
2238
-  #   left basepoints to upper left if $upperleft is set to false
2239
-  #
2240
-  #
2241
-  {
2217
+    }
2218
+
2219
+    ## --------------------------------------------------------
2220
+
2221
+    private function calculatePosition($pos, $padding, $assetWidth, $assetHeight, $upperLeft = true)
2222
+    #
2223
+    # Author:   Jarrod Oberto
2224
+    # Date:   08-05-11
2225
+    # Purpose:  Calculate the x, y pixel cordinates of the asset to place
2226
+    # Params in:  (str) $pos: Either something like: "tl", "l", "br" or an
2227
+    #         exact position like: "100x50"
2228
+    #       (int) $padding: The amount of padding from the edge. Only
2229
+    #         used for the predefined $pos.
2230
+    #       (int) $assetWidth: The width of the asset to add to the image
2231
+    #       (int) $assetHeight: The height of the asset to add to the image
2232
+    #       (bol) $upperLeft: if true, the asset will be positioned based
2233
+    #         on the upper left x, y coords. If false, it means you're
2234
+    #         using the lower left as the basepoint and this will
2235
+    #         convert it to the upper left position
2236
+    # Params out:
2237
+    # NOTE: this is done from the UPPER left corner!! But will convert lower
2238
+    #   left basepoints to upper left if $upperleft is set to false
2239
+    #
2240
+    #
2241
+    {
2242 2242
     $pos = fix_strtolower($pos);
2243 2243
 
2244 2244
     // *** If co-ords have been entered
2245 2245
     if (strstr($pos, 'x')) {
2246
-      $pos = str_replace(' ', '', $pos);
2246
+        $pos = str_replace(' ', '', $pos);
2247 2247
 
2248
-      $xyArray = explode('x', $pos);
2249
-      list($width, $height) = $xyArray;
2248
+        $xyArray = explode('x', $pos);
2249
+        list($width, $height) = $xyArray;
2250 2250
 
2251 2251
     } else {
2252 2252
 
2253
-      switch ($pos) {
2253
+        switch ($pos) {
2254 2254
         case 'tl':
2255 2255
           $width = 0 + $padding;
2256
-          $height = 0 + $padding;
2257
-          break;
2256
+            $height = 0 + $padding;
2257
+            break;
2258 2258
 
2259 2259
         case 't':
2260 2260
           $width = ($this->width / 2) - ($assetWidth / 2);
2261
-          $height = 0 + $padding;
2262
-          break;
2261
+            $height = 0 + $padding;
2262
+            break;
2263 2263
 
2264 2264
         case 'tr':
2265 2265
           $width = $this->width - $assetWidth - $padding;
2266
-          $height = 0 + $padding;;
2267
-          break;
2266
+            $height = 0 + $padding;;
2267
+            break;
2268 2268
 
2269 2269
         case 'l':
2270 2270
           $width = 0 + $padding;
2271
-          $height = ($this->height / 2) - ($assetHeight / 2);
2272
-          break;
2271
+            $height = ($this->height / 2) - ($assetHeight / 2);
2272
+            break;
2273 2273
 
2274 2274
         case 'm':
2275 2275
           $width = ($this->width / 2) - ($assetWidth / 2);
2276
-          $height = ($this->height / 2) - ($assetHeight / 2);
2277
-          break;
2276
+            $height = ($this->height / 2) - ($assetHeight / 2);
2277
+            break;
2278 2278
 
2279 2279
         case 'r':
2280 2280
           $width = $this->width - $assetWidth - $padding;
2281
-          $height = ($this->height / 2) - ($assetHeight / 2);
2282
-          break;
2281
+            $height = ($this->height / 2) - ($assetHeight / 2);
2282
+            break;
2283 2283
 
2284 2284
         case 'bl':
2285 2285
           $width = 0 + $padding;
2286
-          $height = $this->height - $assetHeight - $padding;
2287
-          break;
2286
+            $height = $this->height - $assetHeight - $padding;
2287
+            break;
2288 2288
 
2289 2289
         case 'b':
2290 2290
           $width = ($this->width / 2) - ($assetWidth / 2);
2291
-          $height = $this->height - $assetHeight - $padding;
2292
-          break;
2291
+            $height = $this->height - $assetHeight - $padding;
2292
+            break;
2293 2293
 
2294 2294
         case 'br':
2295 2295
           $width = $this->width - $assetWidth - $padding;
2296
-          $height = $this->height - $assetHeight - $padding;
2297
-          break;
2296
+            $height = $this->height - $assetHeight - $padding;
2297
+            break;
2298 2298
 
2299 2299
         default:
2300 2300
           $width = 0;
2301
-          $height = 0;
2302
-          break;
2303
-      }
2301
+            $height = 0;
2302
+            break;
2303
+        }
2304 2304
     }
2305 2305
 
2306 2306
     if (!$upperLeft) {
2307
-      $height = $height + $assetHeight;
2307
+        $height = $height + $assetHeight;
2308 2308
     }
2309 2309
 
2310 2310
     return array('width' => $width, 'height' => $height);
2311
-  }
2311
+    }
2312 2312
 
2313 2313
 
2314
-  ## --------------------------------------------------------
2314
+    ## --------------------------------------------------------
2315 2315
 
2316
-  private function filterOpacity(&$img, $opacity = 75)
2317
-  #
2318
-  # Author:     aiden dot mail at freemail dot hu
2319
-  # Author date:  29-03-08 08:16
2320
-  # Date added:   08-05-11
2321
-  # Purpose:    Change opacity of image
2322
-  # Params in:    $img: Image resource id
2323
-  #         (int) $opacity: the opacity amount: 0-100, 100 being not opaque.
2324
-  # Params out:   (bool) true on success, else false
2325
-  # Ref:      http://www.php.net/manual/en/function.imagefilter.php#82162
2326
-  # Notes:      png only
2327
-  #
2328
-  {
2316
+    private function filterOpacity(&$img, $opacity = 75)
2317
+    #
2318
+    # Author:     aiden dot mail at freemail dot hu
2319
+    # Author date:  29-03-08 08:16
2320
+    # Date added:   08-05-11
2321
+    # Purpose:    Change opacity of image
2322
+    # Params in:    $img: Image resource id
2323
+    #         (int) $opacity: the opacity amount: 0-100, 100 being not opaque.
2324
+    # Params out:   (bool) true on success, else false
2325
+    # Ref:      http://www.php.net/manual/en/function.imagefilter.php#82162
2326
+    # Notes:      png only
2327
+    #
2328
+    {
2329 2329
 
2330 2330
     if (!isset($opacity)) {
2331
-      return false;
2331
+        return false;
2332 2332
     }
2333 2333
 
2334 2334
     if ($opacity == 100) {
2335
-      return true;
2335
+        return true;
2336 2336
     }
2337 2337
 
2338 2338
     $opacity /= 100;
@@ -2347,37 +2347,37 @@  discard block
 block discarded – undo
2347 2347
     //find the most opaque pixel in the image (the one with the smallest alpha value)
2348 2348
     $minalpha = 127;
2349 2349
     for ($x = 0; $x < $w; $x++)
2350
-      for ($y = 0; $y < $h; $y++) {
2350
+        for ($y = 0; $y < $h; $y++) {
2351 2351
         $alpha = ( imagecolorat($img, $x, $y) >> 24 ) & 0xFF;
2352 2352
         if ($alpha < $minalpha) {
2353
-          $minalpha = $alpha;
2353
+            $minalpha = $alpha;
2354
+        }
2354 2355
         }
2355
-      }
2356 2356
 
2357 2357
     //loop through image pixels and modify alpha for each
2358 2358
     for ($x = 0; $x < $w; $x++) {
2359
-      for ($y = 0; $y < $h; $y++) {
2359
+        for ($y = 0; $y < $h; $y++) {
2360 2360
         //get current alpha value (represents the TANSPARENCY!)
2361 2361
         $colorxy = imagecolorat($img, $x, $y);
2362 2362
         $alpha = ( $colorxy >> 24 ) & 0xFF;
2363 2363
         //calculate new alpha
2364 2364
         if ($minalpha !== 127) {
2365
-          $alpha = 127 + 127 * $opacity * ( $alpha - 127 ) / ( 127 - $minalpha );
2365
+            $alpha = 127 + 127 * $opacity * ( $alpha - 127 ) / ( 127 - $minalpha );
2366 2366
         } else {
2367
-          $alpha += 127 * $opacity;
2367
+            $alpha += 127 * $opacity;
2368 2368
         }
2369 2369
         //get the color index with new alpha
2370 2370
         $alphacolorxy = imagecolorallocatealpha($img, ( $colorxy >> 16 ) & 0xFF, ( $colorxy >> 8 ) & 0xFF, $colorxy & 0xFF, $alpha);
2371 2371
         //set pixel with the new color + opacity
2372 2372
         if (!imagesetpixel($img, $x, $y, $alphacolorxy)) {
2373 2373
 
2374
-          return false;
2374
+            return false;
2375
+        }
2375 2376
         }
2376
-      }
2377 2377
     }
2378 2378
 
2379 2379
     return true;
2380
-  }
2380
+    }
2381 2381
 
2382 2382
 ## --------------------------------------------------------
2383 2383
 
@@ -2429,18 +2429,18 @@  discard block
 block discarded – undo
2429 2429
 
2430 2430
 ## --------------------------------------------------------
2431 2431
 
2432
-  public function reset()
2433
-  #
2434
-  # Author:   Jarrod Oberto
2435
-  # Date:   30-08-11
2436
-  # Purpose:  Reset the resource (allow further editing)
2437
-  # Params in:
2438
-  # Params out:
2439
-  # Notes:
2440
-  #
2441
-  {
2432
+    public function reset()
2433
+    #
2434
+    # Author:   Jarrod Oberto
2435
+    # Date:   30-08-11
2436
+    # Purpose:  Reset the resource (allow further editing)
2437
+    # Params in:
2438
+    # Params out:
2439
+    # Notes:
2440
+    #
2441
+    {
2442 2442
     $this->__construct($this->fileName);
2443
-  }
2443
+    }
2444 2444
 
2445 2445
 ## --------------------------------------------------------
2446 2446
 
@@ -2453,11 +2453,11 @@  discard block
 block discarded – undo
2453 2453
     # Param out:  n/a
2454 2454
     # Reference:
2455 2455
     # Notes:    * gif doesn't have a quality parameter
2456
-  #       * jpg has a quality setting 0-100 (100 being the best)
2456
+    #       * jpg has a quality setting 0-100 (100 being the best)
2457 2457
     #       * png has a quality setting 0-9 (0 being the best)
2458
-  #
2459
-  #             * bmp files have no native support for bmp files. We use a
2460
-  #       third party class to save as bmp.
2458
+    #
2459
+    #             * bmp files have no native support for bmp files. We use a
2460
+    #       third party class to save as bmp.
2461 2461
     {
2462 2462
 
2463 2463
     // *** Perform a check or two.
@@ -2478,14 +2478,14 @@  discard block
 block discarded – undo
2478 2478
             case '.jpeg':
2479 2479
         $this->checkInterlaceImage($this->isInterlace);
2480 2480
         if (imagetypes() & IMG_JPG) {
2481
-          imagejpeg($this->imageResized, $savePath, $imageQuality);
2481
+            imagejpeg($this->imageResized, $savePath, $imageQuality);
2482 2482
         } else { $error = 'jpg'; }
2483 2483
                 break;
2484 2484
 
2485 2485
             case '.gif':
2486 2486
         $this->checkInterlaceImage($this->isInterlace);
2487 2487
         if (imagetypes() & IMG_GIF) {
2488
-          imagegif($this->imageResized, $savePath);
2488
+            imagegif($this->imageResized, $savePath);
2489 2489
         } else { $error = 'gif'; }
2490 2490
                 break;
2491 2491
 
@@ -2498,13 +2498,13 @@  discard block
 block discarded – undo
2498 2498
 
2499 2499
         $this->checkInterlaceImage($this->isInterlace);
2500 2500
         if (imagetypes() & IMG_PNG) {
2501
-           imagepng($this->imageResized, $savePath, $invertScaleQuality);
2501
+            imagepng($this->imageResized, $savePath, $invertScaleQuality);
2502 2502
         } else { $error = 'png'; }
2503 2503
                 break;
2504 2504
 
2505 2505
             case '.bmp':
2506 2506
         file_put_contents($savePath, $this->GD2BMPstring($this->imageResized));
2507
-          break;
2507
+            break;
2508 2508
 
2509 2509
 
2510 2510
             // ... etc
@@ -2519,13 +2519,13 @@  discard block
 block discarded – undo
2519 2519
 
2520 2520
     // *** Display error if a file type is not supported.
2521 2521
     if ($error != '') {
2522
-      $this->errorArray[] = $error . ' support is NOT enabled. File not saved.';
2522
+        $this->errorArray[] = $error . ' support is NOT enabled. File not saved.';
2523 2523
     }
2524 2524
     }
2525 2525
 
2526 2526
 ## --------------------------------------------------------
2527 2527
 
2528
-  public function displayImage($fileType = 'jpg', $imageQuality="100")
2528
+    public function displayImage($fileType = 'jpg', $imageQuality="100")
2529 2529
     # Author:     Jarrod Oberto
2530 2530
     # Date:       18-11-09
2531 2531
     # Purpose:    Display images directly to the browser
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
     # Reference:
2535 2535
     # Notes:
2536 2536
     #
2537
-  {
2537
+    {
2538 2538
 
2539 2539
     if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); }else{ throw new Exception(); }}
2540 2540
 
@@ -2560,7 +2560,7 @@  discard block
 block discarded – undo
2560 2560
 
2561 2561
         imagepng($this->imageResized, '', $invertScaleQuality);
2562 2562
         break;
2563
-      case 'bmp':
2563
+        case 'bmp':
2564 2564
         echo 'bmp file format is not supported.';
2565 2565
         break;
2566 2566
 
@@ -2573,41 +2573,41 @@  discard block
 block discarded – undo
2573 2573
 
2574 2574
 
2575 2575
     //imagedestroy($this->imageResized);
2576
-  }
2576
+    }
2577 2577
 
2578 2578
 ## --------------------------------------------------------
2579 2579
 
2580
-  public function setTransparency($bool)
2581
-  # Sep 2011
2582
-  {
2580
+    public function setTransparency($bool)
2581
+    # Sep 2011
2582
+    {
2583 2583
     $this->keepTransparency = $bool;
2584
-  }
2584
+    }
2585 2585
 
2586 2586
 ## --------------------------------------------------------
2587 2587
 
2588
-  public function setFillColor($value)
2589
-  # Sep 2011
2588
+    public function setFillColor($value)
2589
+    # Sep 2011
2590 2590
     # Param in:   (mixed) $value: (array) Could be an array of RGB
2591
-  #               (str) Could be hex #ffffff or #fff, fff, ffffff
2592
-  #
2593
-  # If the keepTransparency is set to false, then no transparency is to be used.
2594
-  # This is ideal when you want to save as jpg.
2595
-  #
2596
-  # this method allows you to set the background color to use instead of
2597
-  # transparency.
2598
-  #
2599
-  {
2591
+    #               (str) Could be hex #ffffff or #fff, fff, ffffff
2592
+    #
2593
+    # If the keepTransparency is set to false, then no transparency is to be used.
2594
+    # This is ideal when you want to save as jpg.
2595
+    #
2596
+    # this method allows you to set the background color to use instead of
2597
+    # transparency.
2598
+    #
2599
+    {
2600 2600
     $colorArray = $this->formatColor($value);
2601 2601
     $this->fillColorArray = $colorArray;
2602
-  }
2602
+    }
2603 2603
 
2604 2604
 ## --------------------------------------------------------
2605 2605
 
2606
-  public function setCropFromTop($value)
2607
-  # Sep 2011
2608
-  {
2606
+    public function setCropFromTop($value)
2607
+    # Sep 2011
2608
+    {
2609 2609
     $this->cropFromTopPercent = $value;
2610
-  }
2610
+    }
2611 2611
 
2612 2612
 ## --------------------------------------------------------
2613 2613
 
@@ -2728,7 +2728,7 @@  discard block
 block discarded – undo
2728 2728
 
2729 2729
 ## --------------------------------------------------------
2730 2730
 
2731
-  public function getFileName()
2731
+    public function getFileName()
2732 2732
     # Author:     Jarrod Oberto
2733 2733
     # Date:       10-09-08
2734 2734
     # Purpose:
@@ -2738,40 +2738,40 @@  discard block
 block discarded – undo
2738 2738
     # Notes:
2739 2739
     #
2740 2740
     {
2741
-      return $this->fileName;
2741
+        return $this->fileName;
2742 2742
     }
2743 2743
 
2744 2744
 ## --------------------------------------------------------
2745 2745
 
2746
-  public function getHeight()
2746
+    public function getHeight()
2747 2747
     {
2748
-      return $this->height;
2748
+        return $this->height;
2749 2749
     }
2750 2750
 
2751 2751
 ## --------------------------------------------------------
2752 2752
 
2753
-  public function getWidth()
2753
+    public function getWidth()
2754 2754
     {
2755
-      return $this->width;
2755
+        return $this->width;
2756 2756
     }
2757 2757
 
2758 2758
 ## --------------------------------------------------------
2759 2759
 
2760
-  public function getOriginalHeight()
2760
+    public function getOriginalHeight()
2761 2761
     {
2762
-      return $this->heightOriginal;
2762
+        return $this->heightOriginal;
2763 2763
     }
2764 2764
 
2765 2765
 ## --------------------------------------------------------
2766 2766
 
2767
-  public function getOriginalWidth()
2767
+    public function getOriginalWidth()
2768 2768
     {
2769
-      return $this->widthOriginal;
2769
+        return $this->widthOriginal;
2770 2770
     }
2771 2771
 
2772 2772
 ## --------------------------------------------------------
2773 2773
 
2774
-  public function getErrors()
2774
+    public function getErrors()
2775 2775
     # Author:     Jarrod Oberto
2776 2776
     # Date:       19-11-09
2777 2777
     # Purpose:    Returns the error array
@@ -2780,252 +2780,252 @@  discard block
 block discarded – undo
2780 2780
     # Reference:
2781 2781
     # Notes:
2782 2782
     #
2783
-  {
2783
+    {
2784 2784
     return $this->errorArray;
2785
-  }
2785
+    }
2786 2786
 
2787 2787
 ## --------------------------------------------------------
2788 2788
 
2789
-  private function checkInterlaceImage($isEnabled)
2790
-  # jpg will use progressive (they don't use interace)
2791
-  {
2789
+    private function checkInterlaceImage($isEnabled)
2790
+    # jpg will use progressive (they don't use interace)
2791
+    {
2792 2792
     if ($isEnabled) {
2793
-      imageinterlace($this->imageResized, $isEnabled);
2793
+        imageinterlace($this->imageResized, $isEnabled);
2794
+    }
2794 2795
     }
2795
-  }
2796 2796
 
2797 2797
 ## --------------------------------------------------------
2798 2798
 
2799
-  protected function formatColor($value)
2799
+    protected function formatColor($value)
2800 2800
     # Author:     Jarrod Oberto
2801 2801
     # Date:       09-05-11
2802 2802
     # Purpose:    Determine color method passed in and return color as RGB
2803 2803
     # Param in:   (mixed) $value: (array) Could be an array of RGB
2804
-  #               (str) Could be hex #ffffff or #fff, fff, ffffff
2804
+    #               (str) Could be hex #ffffff or #fff, fff, ffffff
2805 2805
     # Param out:
2806 2806
     # Reference:
2807 2807
     # Notes:
2808 2808
     #
2809
-  {
2809
+    {
2810 2810
     $rgbArray = array();
2811 2811
 
2812 2812
     // *** If it's an array it should be R, G, B
2813 2813
     if (is_array($value)) {
2814 2814
 
2815
-      if (key($value) == 0 && count($value) == 3) {
2815
+        if (key($value) == 0 && count($value) == 3) {
2816 2816
 
2817 2817
         $rgbArray['r'] = $value[0];
2818 2818
         $rgbArray['g'] = $value[1];
2819 2819
         $rgbArray['b'] = $value[2];
2820 2820
 
2821
-      } else {
2821
+        } else {
2822 2822
         $rgbArray = $value;
2823
-      }
2823
+        }
2824 2824
     } else if (fix_strtolower($value) === 'transparent') {
2825 2825
 
2826
-      $rgbArray = array(
2826
+        $rgbArray = array(
2827 2827
         'r' => 255,
2828 2828
         'g' => 255,
2829 2829
         'b' => 255,
2830 2830
         'a' => 127
2831
-      );
2831
+        );
2832 2832
 
2833 2833
     } else {
2834 2834
 
2835
-      // *** ...Else it should be hex. Let's make it RGB
2836
-      $rgbArray = $this -> hex2dec($value);
2835
+        // *** ...Else it should be hex. Let's make it RGB
2836
+        $rgbArray = $this -> hex2dec($value);
2837 2837
     }
2838 2838
 
2839 2839
     return $rgbArray;
2840
-  }
2840
+    }
2841 2841
 
2842
-  ## --------------------------------------------------------
2842
+    ## --------------------------------------------------------
2843 2843
 
2844
-  function hex2dec($hex)
2845
-  # Purpose:  Convert #hex color to RGB
2846
-  {
2844
+    function hex2dec($hex)
2845
+    # Purpose:  Convert #hex color to RGB
2846
+    {
2847 2847
     $color = str_replace('#', '', $hex);
2848 2848
 
2849 2849
     if (strlen($color) == 3) {
2850
-      $color = $color . $color;
2850
+        $color = $color . $color;
2851 2851
     }
2852 2852
 
2853 2853
     $rgb = array(
2854
-      'r' => hexdec(substr($color, 0, 2)),
2855
-      'g' => hexdec(substr($color, 2, 2)),
2856
-      'b' => hexdec(substr($color, 4, 2)),
2857
-      'a' => 0
2854
+        'r' => hexdec(substr($color, 0, 2)),
2855
+        'g' => hexdec(substr($color, 2, 2)),
2856
+        'b' => hexdec(substr($color, 4, 2)),
2857
+        'a' => 0
2858 2858
     );
2859 2859
     return $rgb;
2860
-  }
2860
+    }
2861 2861
 
2862
-  ## --------------------------------------------------------
2862
+    ## --------------------------------------------------------
2863 2863
 
2864
-  private function createImageColor ($colorArray)
2865
-  {
2864
+    private function createImageColor ($colorArray)
2865
+    {
2866 2866
     $r = $colorArray['r'];
2867 2867
     $g = $colorArray['g'];
2868 2868
     $b = $colorArray['b'];
2869 2869
 
2870 2870
     return imagecolorallocate($this->imageResized, $r, $g, $b);
2871
-  }
2871
+    }
2872 2872
 
2873
-  ## --------------------------------------------------------
2873
+    ## --------------------------------------------------------
2874 2874
 
2875
-  private function testColorExists($colorArray)
2876
-  {
2875
+    private function testColorExists($colorArray)
2876
+    {
2877 2877
     $r = $colorArray['r'];
2878 2878
     $g = $colorArray['g'];
2879 2879
     $b = $colorArray['b'];
2880 2880
 
2881 2881
     if (imagecolorexact($this->imageResized, $r, $g, $b) == -1) {
2882
-      return false;
2882
+        return false;
2883 2883
     } else {
2884
-      return true;
2884
+        return true;
2885
+    }
2885 2886
     }
2886
-  }
2887 2887
 
2888
-  ## --------------------------------------------------------
2888
+    ## --------------------------------------------------------
2889 2889
 
2890
-  private function findUnusedGreen()
2891
-  # Purpose:  We find a green color suitable to use like green-screen effect.
2892
-  #     Therefore, the color must not exist in the image.
2893
-  {
2890
+    private function findUnusedGreen()
2891
+    # Purpose:  We find a green color suitable to use like green-screen effect.
2892
+    #     Therefore, the color must not exist in the image.
2893
+    {
2894 2894
     $green = 255;
2895 2895
 
2896 2896
     do {
2897 2897
 
2898
-      $greenChroma = array(0, $green, 0);
2899
-      $colorArray = $this->formatColor($greenChroma);
2900
-      $match = $this->testColorExists($colorArray);
2901
-      $green--;
2898
+        $greenChroma = array(0, $green, 0);
2899
+        $colorArray = $this->formatColor($greenChroma);
2900
+        $match = $this->testColorExists($colorArray);
2901
+        $green--;
2902 2902
 
2903 2903
     } while ($match == false && $green > 0);
2904 2904
 
2905 2905
     // *** If no match, just bite the bullet and use green value of 255
2906 2906
     if (!$match) {
2907
-      $greenChroma = array(0, $green, 0);
2907
+        $greenChroma = array(0, $green, 0);
2908 2908
     }
2909 2909
 
2910 2910
     return $greenChroma;
2911
-  }
2911
+    }
2912 2912
 
2913
-  ## --------------------------------------------------------
2913
+    ## --------------------------------------------------------
2914 2914
 
2915
-  private function findUnusedBlue()
2916
-  # Purpose:  We find a green color suitable to use like green-screen effect.
2917
-  #     Therefore, the color must not exist in the image.
2918
-  {
2915
+    private function findUnusedBlue()
2916
+    # Purpose:  We find a green color suitable to use like green-screen effect.
2917
+    #     Therefore, the color must not exist in the image.
2918
+    {
2919 2919
     $blue = 255;
2920 2920
 
2921 2921
     do {
2922 2922
 
2923
-      $blueChroma = array(0, 0, $blue);
2924
-      $colorArray = $this->formatColor($blueChroma);
2925
-      $match = $this->testColorExists($colorArray);
2926
-      $blue--;
2923
+        $blueChroma = array(0, 0, $blue);
2924
+        $colorArray = $this->formatColor($blueChroma);
2925
+        $match = $this->testColorExists($colorArray);
2926
+        $blue--;
2927 2927
 
2928 2928
     } while ($match == false && $blue > 0);
2929 2929
 
2930 2930
     // *** If no match, just bite the bullet and use blue value of 255
2931 2931
     if (!$match) {
2932
-      $blueChroma = array(0, 0, $blue);
2932
+        $blueChroma = array(0, 0, $blue);
2933 2933
     }
2934 2934
 
2935 2935
     return $blueChroma;
2936
-  }
2936
+    }
2937 2937
 
2938
-  ## --------------------------------------------------------
2938
+    ## --------------------------------------------------------
2939 2939
 
2940
-  private function invertTransparency($value, $originalMax, $invert=true)
2941
-  # Purpose:  This does two things:
2942
-  #       1) Convert the range from 0-127 to 0-100
2943
-  #       2) Inverts value to 100 is not transparent while 0 is fully
2944
-  #          transparent (like Photoshop)
2945
-  {
2940
+    private function invertTransparency($value, $originalMax, $invert=true)
2941
+    # Purpose:  This does two things:
2942
+    #       1) Convert the range from 0-127 to 0-100
2943
+    #       2) Inverts value to 100 is not transparent while 0 is fully
2944
+    #          transparent (like Photoshop)
2945
+    {
2946 2946
     // *** Test max range
2947 2947
     if ($value > $originalMax) {
2948
-      $value = $originalMax;
2948
+        $value = $originalMax;
2949 2949
     }
2950 2950
 
2951 2951
     // *** Test min range
2952 2952
     if ($value < 0) {
2953
-      $value = 0;
2953
+        $value = 0;
2954 2954
     }
2955 2955
 
2956 2956
     if ($invert) {
2957
-      return $originalMax - (($value/100) * $originalMax);
2957
+        return $originalMax - (($value/100) * $originalMax);
2958 2958
     } else {
2959
-      return ($value/100) * $originalMax;
2959
+        return ($value/100) * $originalMax;
2960
+    }
2960 2961
     }
2961
-  }
2962 2962
 
2963
-  ## --------------------------------------------------------
2963
+    ## --------------------------------------------------------
2964 2964
 
2965
-  private function transparentImage($src)
2966
-  {
2965
+    private function transparentImage($src)
2966
+    {
2967 2967
     // *** making images with white bg transparent
2968 2968
     $r1 = 0;
2969 2969
     $g1 = 255;
2970 2970
     $b1 = 0;
2971 2971
     for ($x = 0; $x < imagesx($src); ++$x) {
2972
-      for ($y = 0; $y < imagesy($src); ++$y) {
2972
+        for ($y = 0; $y < imagesy($src); ++$y) {
2973 2973
         $color = imagecolorat($src, $x, $y);
2974 2974
         $r = ($color >> 16) & 0xFF;
2975 2975
         $g = ($color >> 8) & 0xFF;
2976 2976
         $b = $color & 0xFF;
2977 2977
         for ($i = 0; $i < 270; $i++) {
2978
-          //if ($r . $g . $b == ($r1 + $i) . ($g1 + $i) . ($b1 + $i)) {
2979
-          if ($r == 0 && $g == 255 && $b == 0) {
2980
-          //if ($g == 255) {
2978
+            //if ($r . $g . $b == ($r1 + $i) . ($g1 + $i) . ($b1 + $i)) {
2979
+            if ($r == 0 && $g == 255 && $b == 0) {
2980
+            //if ($g == 255) {
2981 2981
             $trans_colour = imagecolorallocatealpha($src, 0, 0, 0, 127);
2982 2982
             imagefill($src, $x, $y, $trans_colour);
2983
-          }
2983
+            }
2984
+        }
2984 2985
         }
2985
-      }
2986 2986
     }
2987 2987
 
2988 2988
     return $src;
2989
-  }
2989
+    }
2990 2990
 
2991
-  ## --------------------------------------------------------
2991
+    ## --------------------------------------------------------
2992 2992
 
2993
-  function checkStringStartsWith($needle, $haystack)
2994
-  # Check if a string starts with a specific pattern
2995
-  {
2993
+    function checkStringStartsWith($needle, $haystack)
2994
+    # Check if a string starts with a specific pattern
2995
+    {
2996 2996
     return (substr($haystack, 0, strlen($needle))==$needle);
2997
-  }
2997
+    }
2998 2998
 
2999 2999
 
3000 3000
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
3001 3001
   BMP SUPPORT (SAVING) - James Heinrich
3002 3002
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
3003 3003
 
3004
-  private function GD2BMPstring(&$gd_image)
3004
+    private function GD2BMPstring(&$gd_image)
3005 3005
     # Author:     James Heinrich
3006 3006
     # Purpose:    Save file as type bmp
3007 3007
     # Param in:   The image canvas (passed as ref)
3008 3008
     # Param out:
3009 3009
     # Reference:
3010 3010
     # Notes:    This code was stripped out of two external files
3011
-  #       (phpthumb.bmp.php,phpthumb.functions.php) and added below to
3012
-  #       avoid dependancies.
3011
+    #       (phpthumb.bmp.php,phpthumb.functions.php) and added below to
3012
+    #       avoid dependancies.
3013 3013
     #
3014
-  {
3014
+    {
3015 3015
     $imageX = imagesx($gd_image);
3016 3016
     $imageY = imagesy($gd_image);
3017 3017
 
3018 3018
     $BMP = '';
3019 3019
     for ($y = ($imageY - 1); $y >= 0; $y--) {
3020
-      $thisline = '';
3021
-      for ($x = 0; $x < $imageX; $x++) {
3020
+        $thisline = '';
3021
+        for ($x = 0; $x < $imageX; $x++) {
3022 3022
         $argb = $this->GetPixelColor($gd_image, $x, $y);
3023 3023
         $thisline .= chr($argb['blue']).chr($argb['green']).chr($argb['red']);
3024
-      }
3025
-      while (strlen($thisline) % 4) {
3024
+        }
3025
+        while (strlen($thisline) % 4) {
3026 3026
         $thisline .= "\x00";
3027
-      }
3028
-      $BMP .= $thisline;
3027
+        }
3028
+        $BMP .= $thisline;
3029 3029
     }
3030 3030
 
3031 3031
     $bmpSize = strlen($BMP) + 14 + 40;
@@ -3050,11 +3050,11 @@  discard block
 block discarded – undo
3050 3050
     $BITMAPINFOHEADER .= $this->LittleEndian2String(       0, 4); // DWORD  biClrImportant;
3051 3051
 
3052 3052
     return $BITMAPFILEHEADER.$BITMAPINFOHEADER.$BMP;
3053
-  }
3053
+    }
3054 3054
 
3055 3055
 ## --------------------------------------------------------
3056 3056
 
3057
-  private function GetPixelColor(&$img, $x, $y)
3057
+    private function GetPixelColor(&$img, $x, $y)
3058 3058
     # Author:     James Heinrich
3059 3059
     # Purpose:
3060 3060
     # Param in:
@@ -3062,16 +3062,16 @@  discard block
 block discarded – undo
3062 3062
     # Reference:
3063 3063
     # Notes:
3064 3064
     #
3065
-  {
3065
+    {
3066 3066
     if (!is_resource($img)) {
3067
-      return false;
3067
+        return false;
3068 3068
     }
3069 3069
     return @imagecolorsforindex($img, @imagecolorat($img, $x, $y));
3070
-  }
3070
+    }
3071 3071
 
3072 3072
 ## --------------------------------------------------------
3073 3073
 
3074
-  private function LittleEndian2String($number, $minbytes=1)
3074
+    private function LittleEndian2String($number, $minbytes=1)
3075 3075
     # Author:     James Heinrich
3076 3076
     # Purpose:    BMP SUPPORT (SAVING)
3077 3077
     # Param in:
@@ -3079,34 +3079,34 @@  discard block
 block discarded – undo
3079 3079
     # Reference:
3080 3080
     # Notes:
3081 3081
     #
3082
-  {
3082
+    {
3083 3083
     $intstring = '';
3084 3084
     while ($number > 0) {
3085
-      $intstring = $intstring.chr($number & 255);
3086
-      $number >>= 8;
3085
+        $intstring = $intstring.chr($number & 255);
3086
+        $number >>= 8;
3087 3087
     }
3088 3088
     return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT);
3089
-  }
3089
+    }
3090 3090
 
3091 3091
 
3092 3092
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
3093 3093
   BMP SUPPORT (READING)
3094 3094
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
3095 3095
 
3096
-  private function ImageCreateFromBMP($filename)
3096
+    private function ImageCreateFromBMP($filename)
3097 3097
     # Author:     DHKold
3098 3098
     # Date:     The 15th of June 2005
3099
-  # Version:    2.0B
3099
+    # Version:    2.0B
3100 3100
     # Purpose:    To create an image from a BMP file.
3101 3101
     # Param in:   BMP file to open.
3102 3102
     # Param out:  Return a resource like the other ImageCreateFrom functions
3103 3103
     # Reference:  http://us3.php.net/manual/en/function.imagecreate.php#53879
3104
-  # Bug fix:    Author:   domelca at terra dot es
3105
-  #       Date:   06 March 2008
3106
-  #       Fix:    Correct 16bit BMP support
3104
+    # Bug fix:    Author:   domelca at terra dot es
3105
+    #       Date:   06 March 2008
3106
+    #       Fix:    Correct 16bit BMP support
3107 3107
     # Notes:
3108
-  #
3109
-  {
3108
+    #
3109
+    {
3110 3110
 
3111 3111
     //Ouverture du fichier en mode binaire
3112 3112
     if (! $f1 = fopen($filename,"rb")) return FALSE;
@@ -3117,8 +3117,8 @@  discard block
 block discarded – undo
3117 3117
 
3118 3118
     //2 : Chargement des ent�tes BMP
3119 3119
     $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'.
3120
-           '/Vcompression/Vsize_bitmap/Vhoriz_resolution'.
3121
-           '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40));
3120
+            '/Vcompression/Vsize_bitmap/Vhoriz_resolution'.
3121
+            '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40));
3122 3122
     $BMP['colors'] = pow(2,$BMP['bits_per_pixel']);
3123 3123
 
3124 3124
     if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset'];
@@ -3126,7 +3126,7 @@  discard block
 block discarded – undo
3126 3126
     $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8;
3127 3127
     $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']);
3128 3128
     $BMP['decal'] = ($BMP['width']*$BMP['bytes_per_pixel']/4);
3129
-       $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4);
3129
+        $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4);
3130 3130
     $BMP['decal'] = 4-(4*$BMP['decal']);
3131 3131
 
3132 3132
     if ($BMP['decal'] == 4) $BMP['decal'] = 0;
@@ -3135,7 +3135,7 @@  discard block
 block discarded – undo
3135 3135
     $PALETTE = array();
3136 3136
     if ($BMP['colors'] < 16777216)
3137 3137
     {
3138
-      $PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4));
3138
+        $PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4));
3139 3139
     }
3140 3140
 
3141 3141
     //4 : Cr�ation de l'image
@@ -3147,15 +3147,15 @@  discard block
 block discarded – undo
3147 3147
     $Y = $BMP['height']-1;
3148 3148
     while ($Y >= 0)
3149 3149
     {
3150
-      $X=0;
3151
-      while ($X < $BMP['width'])
3152
-      {
3150
+        $X=0;
3151
+        while ($X < $BMP['width'])
3152
+        {
3153 3153
         if ($BMP['bits_per_pixel'] == 24)
3154
-          $COLOR = unpack("V",substr($IMG,$P,3).$VIDE);
3154
+            $COLOR = unpack("V",substr($IMG,$P,3).$VIDE);
3155 3155
         elseif ($BMP['bits_per_pixel'] == 16)
3156 3156
         {
3157 3157
 
3158
-          /*
3158
+            /*
3159 3159
            * BMP 16bit fix
3160 3160
            * =================
3161 3161
            *
@@ -3167,94 +3167,94 @@  discard block
 block discarded – undo
3167 3167
            *
3168 3168
            */
3169 3169
 
3170
-          // *** Original code (don't work)
3171
-          //$COLOR = unpack("n",substr($IMG,$P,2));
3172
-          //$COLOR[1] = $PALETTE[$COLOR[1]+1];
3170
+            // *** Original code (don't work)
3171
+            //$COLOR = unpack("n",substr($IMG,$P,2));
3172
+            //$COLOR[1] = $PALETTE[$COLOR[1]+1];
3173 3173
 
3174
-          $COLOR = unpack("v",substr($IMG,$P,2));
3175
-          $blue = ($COLOR[1] & 0x001f) << 3;
3176
-          $green = ($COLOR[1] & 0x07e0) >> 3;
3177
-          $red = ($COLOR[1] & 0xf800) >> 8;
3178
-          $COLOR[1] = $red * 65536 + $green * 256 + $blue;
3174
+            $COLOR = unpack("v",substr($IMG,$P,2));
3175
+            $blue = ($COLOR[1] & 0x001f) << 3;
3176
+            $green = ($COLOR[1] & 0x07e0) >> 3;
3177
+            $red = ($COLOR[1] & 0xf800) >> 8;
3178
+            $COLOR[1] = $red * 65536 + $green * 256 + $blue;
3179 3179
 
3180 3180
         }
3181 3181
         elseif ($BMP['bits_per_pixel'] == 8)
3182 3182
         {
3183
-          $COLOR = unpack("n",$VIDE.substr($IMG,$P,1));
3184
-          $COLOR[1] = $PALETTE[$COLOR[1]+1];
3183
+            $COLOR = unpack("n",$VIDE.substr($IMG,$P,1));
3184
+            $COLOR[1] = $PALETTE[$COLOR[1]+1];
3185 3185
         }
3186 3186
         elseif ($BMP['bits_per_pixel'] == 4)
3187 3187
         {
3188
-          $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3189
-          if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F);
3190
-          $COLOR[1] = $PALETTE[$COLOR[1]+1];
3188
+            $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3189
+            if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F);
3190
+            $COLOR[1] = $PALETTE[$COLOR[1]+1];
3191 3191
         }
3192 3192
         elseif ($BMP['bits_per_pixel'] == 1)
3193 3193
         {
3194
-          $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3195
-          if     (($P*8)%8 == 0) $COLOR[1] =  $COLOR[1]        >>7;
3196
-          elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6;
3197
-          elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5;
3198
-          elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4;
3199
-          elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3;
3200
-          elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2;
3201
-          elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1;
3202
-          elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1);
3203
-          $COLOR[1] = $PALETTE[$COLOR[1]+1];
3194
+            $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3195
+            if     (($P*8)%8 == 0) $COLOR[1] =  $COLOR[1]        >>7;
3196
+            elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6;
3197
+            elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5;
3198
+            elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4;
3199
+            elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3;
3200
+            elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2;
3201
+            elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1;
3202
+            elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1);
3203
+            $COLOR[1] = $PALETTE[$COLOR[1]+1];
3204 3204
         }
3205 3205
         else
3206
-          return FALSE;
3206
+            return FALSE;
3207 3207
 
3208 3208
         imagesetpixel($res,$X,$Y,$COLOR[1]);
3209 3209
         $X++;
3210 3210
         $P += $BMP['bytes_per_pixel'];
3211
-      }
3211
+        }
3212 3212
 
3213
-      $Y--;
3214
-      $P+=$BMP['decal'];
3213
+        $Y--;
3214
+        $P+=$BMP['decal'];
3215 3215
     }
3216 3216
     //Fermeture du fichier
3217 3217
     fclose($f1);
3218 3218
 
3219 3219
     return $res;
3220
-  }
3220
+    }
3221 3221
 
3222 3222
 
3223 3223
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-
3224 3224
   PSD SUPPORT (READING)
3225 3225
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
3226 3226
 
3227
-  private function imagecreatefrompsd($fileName)
3228
-  # Author:     Tim de Koning
3229
-  # Version:    1.3
3230
-  # Purpose:    To create an image from a PSD file.
3231
-  # Param in:   PSD file to open.
3232
-  # Param out:  Return a resource like the other ImageCreateFrom functions
3233
-  # Reference:  http://www.kingsquare.nl/phppsdreader
3234
-  # Notes:
3235
-  #
3236
-  {
3227
+    private function imagecreatefrompsd($fileName)
3228
+    # Author:     Tim de Koning
3229
+    # Version:    1.3
3230
+    # Purpose:    To create an image from a PSD file.
3231
+    # Param in:   PSD file to open.
3232
+    # Param out:  Return a resource like the other ImageCreateFrom functions
3233
+    # Reference:  http://www.kingsquare.nl/phppsdreader
3234
+    # Notes:
3235
+    #
3236
+    {
3237 3237
     if (file_exists($this->psdReaderPath)) {
3238 3238
 
3239 3239
 
3240
-      include_once($this->psdReaderPath);
3240
+        include_once($this->psdReaderPath);
3241 3241
 
3242
-      $psdReader = new PhpPsdReader($fileName);
3242
+        $psdReader = new PhpPsdReader($fileName);
3243 3243
 
3244
-      if (isset($psdReader->infoArray['error'])) return '';
3245
-      else return $psdReader->getImage();
3244
+        if (isset($psdReader->infoArray['error'])) return '';
3245
+        else return $psdReader->getImage();
3246 3246
     } else {
3247
-      return false;
3247
+        return false;
3248
+    }
3248 3249
     }
3249
-  }
3250 3250
 
3251 3251
 ## --------------------------------------------------------
3252 3252
 
3253 3253
     public function __destruct() {
3254 3254
     if (is_resource($this->imageResized)) {
3255
-      imagedestroy($this->imageResized);
3255
+        imagedestroy($this->imageResized);
3256
+    }
3256 3257
     }
3257
-  }
3258 3258
 
3259 3259
 ## --------------------------------------------------------
3260 3260
 
Please login to merge, or discard this patch.
Spacing   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
     private $fileName;
167 167
     private $image;
168 168
     protected $imageResized;
169
-    private $widthOriginal;     # Always be the original width
169
+    private $widthOriginal; # Always be the original width
170 170
     private $heightOriginal;
171
-    private $width;         # Current width (width after resize)
171
+    private $width; # Current width (width after resize)
172 172
     private $height;
173 173
     private $imageSize;
174 174
   private $fileExtension;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     # Notes:
210 210
     #
211 211
     {
212
-    if (!$this->testGDInstalled()) { if ($this->debug) { throw new Exception('The GD Library is not installed.'); }else{ throw new Exception(); }};
212
+    if (!$this->testGDInstalled()) { if ($this->debug) { throw new Exception('The GD Library is not installed.'); } else { throw new Exception(); }};
213 213
 
214 214
     $this->initialise();
215 215
 
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 
253 253
 ## --------------------------------------------------------
254 254
 
255
-  private function initialise () {
255
+  private function initialise() {
256 256
 
257
-    $this->psdReaderPath = __DIR__ . '/classPhpPsdReader.php';
258
-    $this->filterOverlayPath = __DIR__ . '/filters';
257
+    $this->psdReaderPath = __DIR__.'/classPhpPsdReader.php';
258
+    $this->filterOverlayPath = __DIR__.'/filters';
259 259
 
260 260
     // *** Set if image should be interlaced or not.
261 261
     $this->isInterlace = false;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     // *** We can pass in an array of options to change the crop position
312 312
     $cropPos = 'm';
313 313
     if (is_array($option) && fix_strtolower($option[0]) === 'crop') {
314
-      $cropPos = $option[1];         # get the crop option
314
+      $cropPos = $option[1]; # get the crop option
315 315
     } else if (strpos($option, '-') !== false) {
316 316
       // *** Or pass in a hyphen seperated option
317 317
       $optionPiecesArray = explode('-', $option);
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
     $option = $this->prepOption($option);
323 323
 
324 324
     // *** Make sure the file passed in is valid
325
-    if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); }else{ throw new Exception(); }};
325
+    if (!$this->image) { if ($this->debug) { throw new Exception('file '.$this->getFileName().' is missing or invalid'); } else { throw new Exception(); }};
326 326
 
327 327
     // *** Get optimal width and height - based on $option
328 328
     $dimensionsArray = $this->getDimensions($newWidth, $newHeight, $option);
@@ -350,15 +350,15 @@  discard block
 block discarded – undo
350 350
       $exifData = $this->getExif(false);
351 351
       if (count($exifData) > 0) {
352 352
 
353
-        switch($exifData['orientation']) {
353
+        switch ($exifData['orientation']) {
354 354
             case 8:
355
-                $this->imageResized = imagerotate($this->imageResized,90,0);
355
+                $this->imageResized = imagerotate($this->imageResized, 90, 0);
356 356
                 break;
357 357
             case 3:
358
-                $this->imageResized = imagerotate($this->imageResized,180,0);
358
+                $this->imageResized = imagerotate($this->imageResized, 180, 0);
359 359
                 break;
360 360
             case 6:
361
-                $this->imageResized = imagerotate($this->imageResized,-90,0);
361
+                $this->imageResized = imagerotate($this->imageResized, -90, 0);
362 362
                 break;
363 363
         }
364 364
       }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
   {
392 392
 
393 393
     // *** Make sure the file passed in is valid
394
-    if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); }else{ throw new Exception(); }};
394
+    if (!$this->image) { if ($this->debug) { throw new Exception('file '.$this->getFileName().' is missing or invalid'); } else { throw new Exception(); }};
395 395
 
396 396
     $this->imageResized = $this->image;
397 397
     $this->crop($this->width, $this->height, $newWidth, $newHeight, $cropPos);
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
     $cropStartY = $cropArray['y'];
443 443
 
444 444
     // *** Crop this bad boy
445
-    $crop = imagecreatetruecolor($newWidth , $newHeight);
445
+    $crop = imagecreatetruecolor($newWidth, $newHeight);
446 446
     $this->keepTransparancy($optimalWidth, $optimalHeight, $crop);
447
-    imagecopyresampled($crop, $this->imageResized, 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
447
+    imagecopyresampled($crop, $this->imageResized, 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight, $newWidth, $newHeight);
448 448
 
449 449
     $this->imageResized = $crop;
450 450
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 
457 457
 ## --------------------------------------------------------
458 458
 
459
-  private function getCropPlacing($optimalWidth, $optimalHeight, $newWidth, $newHeight, $pos='m')
459
+  private function getCropPlacing($optimalWidth, $optimalHeight, $newWidth, $newHeight, $pos = 'm')
460 460
   #
461 461
   # Author:   Jarrod Oberto
462 462
   # Date:   July 11
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
           break;
487 487
 
488 488
         case 't':
489
-          $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
489
+          $cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
490 490
           $cropStartY = 0;
491 491
           break;
492 492
 
@@ -497,17 +497,17 @@  discard block
 block discarded – undo
497 497
 
498 498
         case 'l':
499 499
           $cropStartX = 0;
500
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
500
+          $cropStartY = ($optimalHeight / 2) - ($newHeight / 2);
501 501
           break;
502 502
 
503 503
         case 'm':
504
-          $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
505
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
504
+          $cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
505
+          $cropStartY = ($optimalHeight / 2) - ($newHeight / 2);
506 506
           break;
507 507
 
508 508
         case 'r':
509 509
           $cropStartX = $optimalWidth - $newWidth;
510
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
510
+          $cropStartY = ($optimalHeight / 2) - ($newHeight / 2);
511 511
           break;
512 512
 
513 513
         case 'bl':
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
           break;
517 517
 
518 518
         case 'b':
519
-          $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
519
+          $cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
520 520
           $cropStartY = $optimalHeight - $newHeight;
521 521
           break;
522 522
 
@@ -528,20 +528,20 @@  discard block
 block discarded – undo
528 528
         case 'auto':
529 529
           // *** If image is a portrait crop from top, not center. v1.5
530 530
           if ($optimalHeight > $optimalWidth) {
531
-            $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
532
-            $cropStartY = ($this->cropFromTopPercent /100) * $optimalHeight;
531
+            $cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
532
+            $cropStartY = ($this->cropFromTopPercent / 100) * $optimalHeight;
533 533
           } else {
534 534
 
535 535
             // *** Else crop from the center
536
-            $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
537
-            $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
536
+            $cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
537
+            $cropStartY = ($optimalHeight / 2) - ($newHeight / 2);
538 538
           }
539 539
           break;
540 540
 
541 541
         default:
542 542
           // *** Default to center
543
-          $cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
544
-          $cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
543
+          $cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
544
+          $cropStartY = ($optimalHeight / 2) - ($newHeight / 2);
545 545
           break;
546 546
       }
547 547
     }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
             case '0':
580 580
       case 'exact':
581 581
                 $optimalWidth = $newWidth;
582
-                $optimalHeight= $newHeight;
582
+                $optimalHeight = $newHeight;
583 583
                 break;
584 584
             case '1':
585 585
       case 'portrait':
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
       } else {
711 711
         // *** Sqaure being resized to a square
712 712
         $optimalWidth = $newWidth;
713
-        $optimalHeight= $newHeight;
713
+        $optimalHeight = $newHeight;
714 714
       }
715 715
         }
716 716
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
     }
762 762
 
763 763
     $heightRatio = $this->height / $newHeight;
764
-    $widthRatio  = $this->width /  $newWidth;
764
+    $widthRatio  = $this->width / $newWidth;
765 765
 
766 766
     if ($heightRatio < $widthRatio) {
767 767
       $optimalRatio = $heightRatio;
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
       $optimalRatio = $widthRatio;
770 770
     }
771 771
 
772
-    $optimalHeight = round( $this->height / $optimalRatio );
773
-    $optimalWidth  = round( $this->width  / $optimalRatio );
772
+    $optimalHeight = round($this->height / $optimalRatio);
773
+    $optimalWidth  = round($this->width / $optimalRatio);
774 774
 
775 775
     return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
776 776
   }
@@ -793,9 +793,9 @@  discard block
 block discarded – undo
793 793
       // ***
794 794
       if ($this->aggresiveSharpening) { # A more aggressive sharpening solution
795 795
 
796
-        $sharpenMatrix = array( array( -1, -1, -1 ),
796
+        $sharpenMatrix = array(array( -1, -1, -1 ),
797 797
                          array( -1, 16, -1 ),
798
-                         array( -1, -1, -1 ) );
798
+                         array( -1, -1, -1 ));
799 799
         $divisor = 8;
800 800
         $offset = 0;
801 801
 
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
       }
804 804
       else # More subtle and personally more desirable
805 805
       {
806
-        $sharpness  = $this->findSharp($this->widthOriginal, $this->width);
806
+        $sharpness = $this->findSharp($this->widthOriginal, $this->width);
807 807
 
808
-        $sharpenMatrix  = array(
808
+        $sharpenMatrix = array(
809 809
           array(-1, -2, -1),
810 810
           array(-2, $sharpness + 12, -2), //Lessen the effect of a filter by increasing the value in the center cell
811 811
           array(-1, -2, -1)
@@ -825,9 +825,9 @@  discard block
 block discarded – undo
825 825
 
826 826
   private function sharpen2($level)
827 827
   {
828
-      $sharpenMatrix  = array(
828
+      $sharpenMatrix = array(
829 829
         array($level, $level, $level),
830
-        array($level, (8*$level)+1, $level), //Lessen the effect of a filter by increasing the value in the center cell
830
+        array($level, (8 * $level) + 1, $level), //Lessen the effect of a filter by increasing the value in the center cell
831 831
         array($level, $level, $level)
832 832
       );
833 833
 
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
     # Notes:
845 845
     #
846 846
   {
847
-    $final  = $final * (750.0 / $orig);
847
+    $final = $final * (750.0 / $orig);
848 848
     $a    = 52;
849 849
     $b    = -0.27810650887573124;
850 850
     $c    = .00047337278106508946;
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
       $rgbArray = imagecolorallocate($this->imageResized, $r, $g, $b);
943 943
 
944 944
 
945
-      for($i = 0; $i < $thickness; $i++) {
945
+      for ($i = 0; $i < $thickness; $i++) {
946 946
           imagerectangle($this->imageResized, $x1++, $y1++, $x2--, $y2--, $rgbArray);
947 947
       }
948 948
     }
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
   {
1073 1073
     if ($this->imageResized) {
1074 1074
 
1075
-      $total = imagecolorstotal( $this->imageResized );
1076
-      for ( $i = 0; $i < $total; $i++ ) {
1077
-        $index = imagecolorsforindex( $this->imageResized, $i );
1078
-        $red = ( $index["red"] * 0.393 + $index["green"] * 0.769 + $index["blue"] * 0.189 ) / 1.351;
1079
-        $green = ( $index["red"] * 0.349 + $index["green"] * 0.686 + $index["blue"] * 0.168 ) / 1.203;
1080
-        $blue = ( $index["red"] * 0.272 + $index["green"] * 0.534 + $index["blue"] * 0.131 ) / 2.140;
1081
-        imagecolorset( $this->imageResized, $i, $red, $green, $blue );
1075
+      $total = imagecolorstotal($this->imageResized);
1076
+      for ($i = 0; $i < $total; $i++) {
1077
+        $index = imagecolorsforindex($this->imageResized, $i);
1078
+        $red = ($index["red"] * 0.393 + $index["green"] * 0.769 + $index["blue"] * 0.189) / 1.351;
1079
+        $green = ($index["red"] * 0.349 + $index["green"] * 0.686 + $index["blue"] * 0.168) / 1.203;
1080
+        $blue = ($index["red"] * 0.272 + $index["green"] * 0.534 + $index["blue"] * 0.131) / 2.140;
1081
+        imagecolorset($this->imageResized, $i, $red, $green, $blue);
1082 1082
       }
1083 1083
 
1084 1084
 
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
     imagefilledrectangle($filter, 0, 0, $width, $height, $transparent);
1152 1152
 
1153 1153
     // *** Resize overlay
1154
-    $overlay = $this->filterOverlayPath . '/' . $type . '.png';
1154
+    $overlay = $this->filterOverlayPath.'/'.$type.'.png';
1155 1155
     $png = imagecreatefrompng($overlay);
1156 1156
     imagecopyresampled($filter, $png, 0, 0, 0, 0, $width, $height, imagesx($png), imagesy($png));
1157 1157
 
@@ -1170,16 +1170,16 @@  discard block
 block discarded – undo
1170 1170
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1171 1171
 
1172 1172
   public function image_colorize($rgb) {
1173
-      imagetruecolortopalette($this->imageResized,true,256);
1173
+      imagetruecolortopalette($this->imageResized, true, 256);
1174 1174
     $numColors = imagecolorstotal($this->imageResized);
1175 1175
 
1176 1176
     for ($x = 0; $x < $numColors; $x++) {
1177
-    list($r,$g,$b) = array_values(imagecolorsforindex($this->imageResized,$x));
1177
+    list($r, $g, $b) = array_values(imagecolorsforindex($this->imageResized, $x));
1178 1178
 
1179 1179
     // calculate grayscale in percent
1180 1180
     $grayscale = ($r + $g + $b) / 3 / 0xff;
1181 1181
 
1182
-      imagecolorset($this->imageResized,$x,
1182
+      imagecolorset($this->imageResized, $x,
1183 1183
       $grayscale * $rgb[0],
1184 1184
       $grayscale * $rgb[1],
1185 1185
       $grayscale * $rgb[2]
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
   Reflection
1196 1196
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1197 1197
 
1198
-  public function addReflection($reflectionHeight = 50, $startingTransparency = 30, $inside = false, $bgColor = '#fff', $stretch=false, $divider = 0)
1198
+  public function addReflection($reflectionHeight = 50, $startingTransparency = 30, $inside = false, $bgColor = '#fff', $stretch = false, $divider = 0)
1199 1199
   {
1200 1200
 
1201 1201
     // *** Convert color
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
     $bg = imagecreatetruecolor($this->width, $reflectionHeight);
1222 1222
 
1223 1223
     for ($x = 0; $x < $this->width; $x++) {
1224
-      imagecopy($bg, $im, $x, 0, $this->width-$x -1, 0, 1, $reflectionHeight);
1224
+      imagecopy($bg, $im, $x, 0, $this->width - $x - 1, 0, 1, $reflectionHeight);
1225 1225
     }
1226 1226
     $im = $bg;
1227 1227
 
@@ -1230,16 +1230,16 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
     // *** Fade
1232 1232
     if ($stretch) {
1233
-      $step = 100/($reflectionHeight + $startingTransparency);
1234
-    } else{
1235
-      $step = 100/$reflectionHeight;
1233
+      $step = 100 / ($reflectionHeight + $startingTransparency);
1234
+    } else {
1235
+      $step = 100 / $reflectionHeight;
1236 1236
     }
1237
-    for($i=0; $i<=$reflectionHeight; $i++){
1237
+    for ($i = 0; $i <= $reflectionHeight; $i++) {
1238 1238
 
1239
-      if($startingTransparency>100) $startingTransparency = 100;
1240
-      if($startingTransparency< 1) $startingTransparency = 1;
1239
+      if ($startingTransparency > 100) $startingTransparency = 100;
1240
+      if ($startingTransparency < 1) $startingTransparency = 1;
1241 1241
       imagecopymerge($bg, $li, 0, $i, 0, 0, $this->width, 1, $startingTransparency);
1242
-      $startingTransparency+=$step;
1242
+      $startingTransparency += $step;
1243 1243
     }
1244 1244
 
1245 1245
     // *** Apply fade
@@ -1257,16 +1257,16 @@  discard block
 block discarded – undo
1257 1257
       // Create new blank image with sizes.
1258 1258
       $final = imagecreatetruecolor($this->width, $this->height);
1259 1259
 
1260
-      imagecopymerge ($final, $this->imageResized, 0, 0, 0, $reflectionHeight, $this->width, $this->height - $reflectionHeight, 100);
1261
-      imagecopymerge ($final, $im, 0, $this->height - $reflectionHeight, 0, 0, $x, $y, 100);
1260
+      imagecopymerge($final, $this->imageResized, 0, 0, 0, $reflectionHeight, $this->width, $this->height - $reflectionHeight, 100);
1261
+      imagecopymerge($final, $im, 0, $this->height - $reflectionHeight, 0, 0, $x, $y, 100);
1262 1262
 
1263 1263
     } else {
1264 1264
 
1265 1265
       // Create new blank image with sizes.
1266 1266
       $final = imagecreatetruecolor($this->width, $this->height + $y);
1267 1267
 
1268
-      imagecopymerge ($final, $this->imageResized, 0, 0, 0, 0, $this->width, $this->height, 100);
1269
-      imagecopymerge ($final, $im, 0, $this->height, 0, 0, $x, $y, 100);
1268
+      imagecopymerge($final, $this->imageResized, 0, 0, 0, 0, $this->width, $this->height, 100);
1269
+      imagecopymerge($final, $im, 0, $this->height, 0, 0, $x, $y, 100);
1270 1270
     }
1271 1271
 
1272 1272
     $this->imageResized = $final;
@@ -1334,13 +1334,13 @@  discard block
 block discarded – undo
1334 1334
       $bg = imagecolorallocatealpha($this->imageResized, $r, $g, $b, $a);
1335 1335
 
1336 1336
       // *** Fill with background
1337
-        imagefill($this->imageResized, 0, 0 , $bg);
1337
+        imagefill($this->imageResized, 0, 0, $bg);
1338 1338
 
1339 1339
       // *** Rotate
1340 1340
       $this->imageResized = imagerotate($this->imageResized, $degrees, $bg); // Rotate 45 degrees and allocated the transparent colour as the one to make transparent (obviously)
1341 1341
 
1342 1342
       // Ensure alpha transparency
1343
-        imagesavealpha($this->imageResized,true);
1343
+        imagesavealpha($this->imageResized, true);
1344 1344
 
1345 1345
     }
1346 1346
   }
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
   Round corners
1351 1351
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1352 1352
 
1353
-  public function roundCorners($radius = 5,  $bgColor = 'transparent')
1353
+  public function roundCorners($radius = 5, $bgColor = 'transparent')
1354 1354
     # Author:     Jarrod Oberto
1355 1355
     # Date:       19-05-2011
1356 1356
     # Purpose:    Create rounded corners on your image
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
     imagefill($cornerImg, 0, 0, $imagebgColor);
1415 1415
 
1416 1416
 
1417
-    imagefilledellipse($cornerImg, $radius, $radius, $radius * 2, $radius * 2, $maskColor );
1417
+    imagefilledellipse($cornerImg, $radius, $radius, $radius * 2, $radius * 2, $maskColor);
1418 1418
 
1419 1419
 
1420 1420
     // *** Map to top left corner
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
   Shadow
1446 1446
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1447 1447
 
1448
-  public function addShadow($shadowAngle=45, $blur=15, $bgColor='transparent')
1448
+  public function addShadow($shadowAngle = 45, $blur = 15, $bgColor = 'transparent')
1449 1449
   #
1450 1450
   # Author:   Jarrod Oberto (Adapted from Pascal Naidon)
1451 1451
   # Ref:    http://www.les-stooges.org/pascal/webdesign/vignettes/index.php?la=en
@@ -1458,10 +1458,10 @@  discard block
 block discarded – undo
1458 1458
   #
1459 1459
   {
1460 1460
     // *** A higher number results in a smoother shadow
1461
-    define('STEPS', $blur*2);
1461
+    define('STEPS', $blur * 2);
1462 1462
 
1463 1463
     // *** Set the shadow distance
1464
-    $shadowDistance = $blur*0.25;
1464
+    $shadowDistance = $blur * 0.25;
1465 1465
 
1466 1466
     // *** Set blur width and height
1467 1467
     $blurWidth = $blurHeight = $blur;
@@ -1495,83 +1495,83 @@  discard block
 block discarded – undo
1495 1495
 
1496 1496
 
1497 1497
     // *** RGB
1498
-    $rgb = imagecreatetruecolor($width+$blurWidth,$height+$blurHeight);
1498
+    $rgb = imagecreatetruecolor($width + $blurWidth, $height + $blurHeight);
1499 1499
     $colour = imagecolorallocate($rgb, 0, 0, 0);
1500
-    imagefilledrectangle($rgb, 0, 0, $width+$blurWidth, $height+$blurHeight, $colour);
1500
+    imagefilledrectangle($rgb, 0, 0, $width + $blurWidth, $height + $blurHeight, $colour);
1501 1501
     $colour = imagecolorallocate($rgb, 255, 255, 255);
1502 1502
     //imagefilledrectangle($rgb, $blurWidth*0.5-$distWidth, $blurHeight*0.5-$distHeight, $width+$blurWidth*0.5-$distWidth, $height+$blurWidth*0.5-$distHeight, $colour);
1503
-    imagefilledrectangle($rgb, $blurWidth*0.5-$distWidth, $blurHeight*0.5-$distHeight, $width+$blurWidth*0.5-$distWidth, $height+$blurWidth*0.5-$distHeight, $colour);
1503
+    imagefilledrectangle($rgb, $blurWidth * 0.5 - $distWidth, $blurHeight * 0.5 - $distHeight, $width + $blurWidth * 0.5 - $distWidth, $height + $blurWidth * 0.5 - $distHeight, $colour);
1504 1504
     //imagecopymerge($rgb, $newImage, 1+$blurWidth*0.5-$distWidth, 1+$blurHeight*0.5-$distHeight, 0,0, $width, $height, 100);
1505
-    imagecopymerge($rgb, $newImage, $blurWidth*0.5-$distWidth, $blurHeight*0.5-$distHeight, 0,0, $width+$blurWidth, $height+$blurHeight, 100);
1505
+    imagecopymerge($rgb, $newImage, $blurWidth * 0.5 - $distWidth, $blurHeight * 0.5 - $distHeight, 0, 0, $width + $blurWidth, $height + $blurHeight, 100);
1506 1506
 
1507 1507
 
1508 1508
     // *** Shadow (alpha)
1509
-    $shadow = imagecreatetruecolor($width+$blurWidth,$height+$blurHeight);
1509
+    $shadow = imagecreatetruecolor($width + $blurWidth, $height + $blurHeight);
1510 1510
       imagealphablending($shadow, false);
1511 1511
     $colour = imagecolorallocate($shadow, 0, 0, 0);
1512
-    imagefilledrectangle($shadow, 0, 0, $width+$blurWidth, $height+$blurHeight, $colour);
1512
+    imagefilledrectangle($shadow, 0, 0, $width + $blurWidth, $height + $blurHeight, $colour);
1513 1513
 
1514 1514
 
1515
-    for($i=0;$i<=STEPS;$i++) {
1515
+    for ($i = 0; $i <= STEPS; $i++) {
1516 1516
 
1517
-      $t = ((1.0*$i)/STEPS);
1518
-      $intensity = 255*$t*$t;
1517
+      $t = ((1.0 * $i) / STEPS);
1518
+      $intensity = 255 * $t * $t;
1519 1519
 
1520 1520
       $colour = imagecolorallocate($shadow, $intensity, $intensity, $intensity);
1521 1521
       $points = array(
1522
-        $blurWidth*$t,        $blurHeight,     // Point 1 (x, y)
1523
-        $blurWidth,         $blurHeight*$t,  // Point 2 (x, y)
1524
-        $width,           $blurHeight*$t,  // Point 3 (x, y)
1525
-        $width+$blurWidth*(1-$t), $blurHeight,     // Point 4 (x, y)
1526
-        $width+$blurWidth*(1-$t), $height,     // Point 5 (x, y)
1527
-        $width,           $height+$blurHeight*(1-$t),  // Point 6 (x, y)
1528
-        $blurWidth,         $height+$blurHeight*(1-$t),  // Point 7 (x, y)
1529
-        $blurWidth*$t,        $height      // Point 8 (x, y)
1522
+        $blurWidth * $t, $blurHeight, // Point 1 (x, y)
1523
+        $blurWidth, $blurHeight * $t, // Point 2 (x, y)
1524
+        $width, $blurHeight * $t, // Point 3 (x, y)
1525
+        $width + $blurWidth * (1 - $t), $blurHeight, // Point 4 (x, y)
1526
+        $width + $blurWidth * (1 - $t), $height, // Point 5 (x, y)
1527
+        $width, $height + $blurHeight * (1 - $t), // Point 6 (x, y)
1528
+        $blurWidth, $height + $blurHeight * (1 - $t), // Point 7 (x, y)
1529
+        $blurWidth * $t, $height      // Point 8 (x, y)
1530 1530
       );
1531 1531
       imagepolygon($shadow, $points, 8, $colour);
1532 1532
     }
1533 1533
 
1534
-    for($i=0;$i<=STEPS;$i++) {
1534
+    for ($i = 0; $i <= STEPS; $i++) {
1535 1535
 
1536
-      $t = ((1.0*$i)/STEPS);
1537
-        $intensity = 255*$t*$t;
1536
+      $t = ((1.0 * $i) / STEPS);
1537
+        $intensity = 255 * $t * $t;
1538 1538
 
1539 1539
       $colour = imagecolorallocate($shadow, $intensity, $intensity, $intensity);
1540
-      imagefilledarc($shadow, $blurWidth-1, $blurHeight-1, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 180, 268, $colour, IMG_ARC_PIE);
1541
-      imagefilledarc($shadow, $width, $blurHeight-1, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 270, 358, $colour, IMG_ARC_PIE);
1542
-      imagefilledarc($shadow, $width, $height, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 0, 90, $colour, IMG_ARC_PIE);
1543
-      imagefilledarc($shadow, $blurWidth-1, $height, 2*(1-$t)*$blurWidth, 2*(1-$t)*$blurHeight, 90, 180, $colour, IMG_ARC_PIE);
1540
+      imagefilledarc($shadow, $blurWidth - 1, $blurHeight - 1, 2 * (1 - $t) * $blurWidth, 2 * (1 - $t) * $blurHeight, 180, 268, $colour, IMG_ARC_PIE);
1541
+      imagefilledarc($shadow, $width, $blurHeight - 1, 2 * (1 - $t) * $blurWidth, 2 * (1 - $t) * $blurHeight, 270, 358, $colour, IMG_ARC_PIE);
1542
+      imagefilledarc($shadow, $width, $height, 2 * (1 - $t) * $blurWidth, 2 * (1 - $t) * $blurHeight, 0, 90, $colour, IMG_ARC_PIE);
1543
+      imagefilledarc($shadow, $blurWidth - 1, $height, 2 * (1 - $t) * $blurWidth, 2 * (1 - $t) * $blurHeight, 90, 180, $colour, IMG_ARC_PIE);
1544 1544
     }
1545 1545
 
1546 1546
 
1547 1547
     $colour = imagecolorallocate($shadow, 255, 255, 255);
1548 1548
     imagefilledrectangle($shadow, $blurWidth, $blurHeight, $width, $height, $colour);
1549
-    imagefilledrectangle($shadow, $blurWidth*0.5-$distWidth, $blurHeight*0.5-$distHeight, $width+$blurWidth*0.5-1-$distWidth, $height+$blurHeight*0.5-1-$distHeight, $colour);
1549
+    imagefilledrectangle($shadow, $blurWidth * 0.5 - $distWidth, $blurHeight * 0.5 - $distHeight, $width + $blurWidth * 0.5 - 1 - $distWidth, $height + $blurHeight * 0.5 - 1 - $distHeight, $colour);
1550 1550
 
1551 1551
 
1552 1552
     // *** The magic
1553 1553
         imagealphablending($rgb, false);
1554 1554
 
1555
-        for ($theX=0;$theX<imagesx($rgb);$theX++){
1556
-      for ($theY=0;$theY<imagesy($rgb);$theY++){
1555
+        for ($theX = 0; $theX < imagesx($rgb); $theX++) {
1556
+      for ($theY = 0; $theY < imagesy($rgb); $theY++) {
1557 1557
 
1558 1558
         // *** Get the RGB values for every pixel of the RGB image
1559
-        $colArray = imagecolorat($rgb,$theX,$theY);
1559
+        $colArray = imagecolorat($rgb, $theX, $theY);
1560 1560
         $r = ($colArray >> 16) & 0xFF;
1561 1561
         $g = ($colArray >> 8) & 0xFF;
1562 1562
         $b = $colArray & 0xFF;
1563 1563
 
1564 1564
         // *** Get the alpha value for every pixel of the shadow image
1565
-        $colArray = imagecolorat($shadow,$theX,$theY);
1565
+        $colArray = imagecolorat($shadow, $theX, $theY);
1566 1566
         $a = $colArray & 0xFF;
1567
-        $a = 127-floor($a/2);
1568
-        $t = $a/128.0;
1567
+        $a = 127 - floor($a / 2);
1568
+        $t = $a / 128.0;
1569 1569
 
1570 1570
         // *** Create color
1571
-        if(fix_strtolower($bgColor) === 'transparent') {
1572
-          $myColour = imagecolorallocatealpha($rgb,$r,$g,$b,$a);
1571
+        if (fix_strtolower($bgColor) === 'transparent') {
1572
+          $myColour = imagecolorallocatealpha($rgb, $r, $g, $b, $a);
1573 1573
         } else {
1574
-          $myColour = imagecolorallocate($rgb,$r*(1.0-$t)+$r0*$t,$g*(1.0-$t)+$g0*$t,$b*(1.0-$t)+$b0*$t);
1574
+          $myColour = imagecolorallocate($rgb, $r * (1.0 - $t) + $r0 * $t, $g * (1.0 - $t) + $g0 * $t, $b * (1.0 - $t) + $b0 * $t);
1575 1575
         }
1576 1576
 
1577 1577
         // *** Add color to new rgb image
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
   Add Caption Box
1595 1595
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1596 1596
 
1597
-  public function addCaptionBox($side='b', $thickness=50, $padding=0, $bgColor='#000', $transaprencyAmount=30)
1597
+  public function addCaptionBox($side = 'b', $thickness = 50, $padding = 0, $bgColor = '#000', $transaprencyAmount = 30)
1598 1598
   #
1599 1599
   # Author:   Jarrod Oberto
1600 1600
   # Date:   26 May 2011
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 
1630 1630
   ## --------------------------------------------------------
1631 1631
 
1632
-  public function addTextToCaptionBox($text, $fontColor='#fff', $fontSize = 12, $angle = 0, $font = null)
1632
+  public function addTextToCaptionBox($text, $fontColor = '#fff', $fontSize = 12, $angle = 0, $font = null)
1633 1633
   #
1634 1634
   # Author:   Jarrod Oberto
1635 1635
   # Date:   03 Aug 11
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
       $y1 = $this->captionBoxPositionArray['y1'];
1649 1649
       $y2 = $this->captionBoxPositionArray['y2'];
1650 1650
     } else {
1651
-      if ($this->debug) { throw new Exception('No caption box found.'); }else{ return false; }
1651
+      if ($this->debug) { throw new Exception('No caption box found.'); } else { return false; }
1652 1652
     }
1653 1653
 
1654 1654
 
@@ -1665,10 +1665,10 @@  discard block
 block discarded – undo
1665 1665
     $boxYMiddle = (($y2 - $y1) / 2);
1666 1666
 
1667 1667
     // *** Box middle - half the text width/height
1668
-    $xPos = ($x1 + $boxXMiddle) - ($textWidth/2);
1669
-    $yPos = ($y1 + $boxYMiddle) - ($textHeight/2);
1668
+    $xPos = ($x1 + $boxXMiddle) - ($textWidth / 2);
1669
+    $yPos = ($y1 + $boxYMiddle) - ($textHeight / 2);
1670 1670
 
1671
-    $pos = $xPos . 'x' . $yPos;
1671
+    $pos = $xPos.'x'.$yPos;
1672 1672
 
1673 1673
     $this->addText($text, $pos, $padding = 0, $fontColor, $fontSize, $angle, $font);
1674 1674
 
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
   Get EXIF Data
1719 1719
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
1720 1720
 
1721
-  public function getExif($debug=false)
1721
+  public function getExif($debug = false)
1722 1722
     # Author:     Jarrod Oberto
1723 1723
     # Date:       07-05-2011
1724 1724
     # Purpose:    Get image EXIF data
@@ -1733,34 +1733,34 @@  discard block
 block discarded – undo
1733 1733
     if (!$this->debug || !$debug) { $debug = false; }
1734 1734
 
1735 1735
     // *** Check all is good - check the EXIF library exists and the file exists, too.
1736
-    if (!$this->testEXIFInstalled()) { if ($debug) { throw new Exception('The EXIF Library is not installed.'); }else{ return array(); }};
1737
-    if (!file_exists($this->fileName)) { if ($debug) { throw new Exception('Image not found.'); }else{ return array(); }};
1738
-    if ($this->fileExtension !== '.jpg') { if ($debug) { throw new Exception('Metadata not supported for this image type.'); }else{ return array(); }};
1736
+    if (!$this->testEXIFInstalled()) { if ($debug) { throw new Exception('The EXIF Library is not installed.'); } else { return array(); }};
1737
+    if (!file_exists($this->fileName)) { if ($debug) { throw new Exception('Image not found.'); } else { return array(); }};
1738
+    if ($this->fileExtension !== '.jpg') { if ($debug) { throw new Exception('Metadata not supported for this image type.'); } else { return array(); }};
1739 1739
     $exifData = exif_read_data($this->fileName, 'IFD0');
1740 1740
 
1741 1741
     // *** Format the apperture value
1742 1742
     $ev = $exifData['ApertureValue'];
1743 1743
     $apPeicesArray = explode('/', $ev);
1744 1744
     if (count($apPeicesArray) == 2) {
1745
-      $apertureValue = round($apPeicesArray[0] / $apPeicesArray[1], 2, PHP_ROUND_HALF_DOWN) . ' EV';
1746
-    } else { $apertureValue = '';}
1745
+      $apertureValue = round($apPeicesArray[0] / $apPeicesArray[1], 2, PHP_ROUND_HALF_DOWN).' EV';
1746
+    } else { $apertureValue = ''; }
1747 1747
 
1748 1748
     // *** Format the focal length
1749 1749
     $focalLength = $exifData['FocalLength'];
1750 1750
     $flPeicesArray = explode('/', $focalLength);
1751 1751
     if (count($flPeicesArray) == 2) {
1752
-      $focalLength = $flPeicesArray[0] / $flPeicesArray[1] . '.0 mm';
1753
-    } else { $focalLength = '';}
1752
+      $focalLength = $flPeicesArray[0] / $flPeicesArray[1].'.0 mm';
1753
+    } else { $focalLength = ''; }
1754 1754
 
1755 1755
     // *** Format fNumber
1756 1756
     $fNumber = $exifData['FNumber'];
1757 1757
     $fnPeicesArray = explode('/', $fNumber);
1758 1758
     if (count($fnPeicesArray) == 2) {
1759 1759
       $fNumber = $fnPeicesArray[0] / $fnPeicesArray[1];
1760
-    } else { $fNumber = '';}
1760
+    } else { $fNumber = ''; }
1761 1761
 
1762 1762
     // *** Resolve ExposureProgram
1763
-    if (isset($exifData['ExposureProgram'])) { $ep =  $exifData['ExposureProgram']; }
1763
+    if (isset($exifData['ExposureProgram'])) { $ep = $exifData['ExposureProgram']; }
1764 1764
     if (isset($ep)) { $ep = $this->resolveExposureProgram($ep); }
1765 1765
 
1766 1766
 
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
     } else { $exifDataArray['date'] = ''; }
1787 1787
 
1788 1788
     if (isset($exifData['ExposureTime'])) {
1789
-      $exifDataArray['exposure time'] = $exifData['ExposureTime'] . ' sec.';
1789
+      $exifDataArray['exposure time'] = $exifData['ExposureTime'].' sec.';
1790 1790
     } else { $exifDataArray['exposure time'] = ''; }
1791 1791
 
1792 1792
     if ($apertureValue != '') {
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
     } else { $exifDataArray['flash status'] = ''; }
1827 1827
 
1828 1828
     if (isset($exifData['Artist'])) {
1829
-      $exifDataArray['creator'] = $exifData['Artist'] ;
1829
+      $exifDataArray['creator'] = $exifData['Artist'];
1830 1830
     } else { $exifDataArray['creator'] = ''; }
1831 1831
 
1832 1832
     if (isset($exifData['Copyright'])) {
@@ -2035,7 +2035,7 @@  discard block
 block discarded – undo
2035 2035
 
2036 2036
 ## --------------------------------------------------------
2037 2037
 
2038
-  private function iptc_maketag($rec,$dat,$val)
2038
+  private function iptc_maketag($rec, $dat, $val)
2039 2039
   # Author:   Thies C. Arntzen
2040 2040
   # Purpose:    Function to format the new IPTC text
2041 2041
   # Param in:   $rec: Application record. (We’re working with #2)
@@ -2059,8 +2059,8 @@  discard block
 block discarded – undo
2059 2059
       chr(0x80).chr(0x04).
2060 2060
       chr(($len >> 24) & 0xff).
2061 2061
       chr(($len >> 16) & 0xff).
2062
-      chr(($len >> 8 ) & 0xff).
2063
-      chr(($len ) & 0xff).
2062
+      chr(($len >> 8) & 0xff).
2063
+      chr(($len) & 0xff).
2064 2064
       $val;
2065 2065
   }
2066 2066
 
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
   Add Text
2078 2078
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*/
2079 2079
 
2080
-  public function addText($text, $pos = '20x20', $padding = 0, $fontColor='#fff', $fontSize = 12, $angle = 0, $font = null)
2080
+  public function addText($text, $pos = '20x20', $padding = 0, $fontColor = '#fff', $fontSize = 12, $angle = 0, $font = null)
2081 2081
     # Author:     Jarrod Oberto
2082 2082
   # Date:       18-11-09
2083 2083
     # Purpose:    Add text to an image
@@ -2118,23 +2118,23 @@  discard block
 block discarded – undo
2118 2118
   private function getTextFont($font)
2119 2119
   {
2120 2120
     // *** Font path (shou
2121
-    $fontPath =  __DIR__ . '/' . $this->fontDir;
2121
+    $fontPath = __DIR__.'/'.$this->fontDir;
2122 2122
 
2123 2123
 
2124 2124
     // *** The below is/may be needed depending on your version (see ref)
2125
-    putenv('GDFONTPATH=' . realpath('.'));
2125
+    putenv('GDFONTPATH='.realpath('.'));
2126 2126
 
2127 2127
     // *** Check if the passed in font exsits...
2128 2128
     if ($font == null || !file_exists($font)) {
2129 2129
 
2130 2130
       // *** ...If not, default to this font.
2131
-      $font = $fontPath . '/arimo.ttf';
2131
+      $font = $fontPath.'/arimo.ttf';
2132 2132
 
2133 2133
       // *** Check our default font exists...
2134 2134
       if (!file_exists($font)) {
2135 2135
 
2136 2136
         // *** If not, return false
2137
-        if ($this->debug) { throw new Exception('Font not found'); }else{ return false; }
2137
+        if ($this->debug) { throw new Exception('Font not found'); } else { return false; }
2138 2138
       }
2139 2139
     }
2140 2140
 
@@ -2192,8 +2192,8 @@  discard block
 block discarded – undo
2192 2192
   {
2193 2193
 
2194 2194
     // Load the stamp and the photo to apply the watermark to
2195
-    $stamp = $this->openImage ($watermarkImage);    # stamp
2196
-    $im = $this->imageResized;            # photo
2195
+    $stamp = $this->openImage($watermarkImage); # stamp
2196
+    $im = $this->imageResized; # photo
2197 2197
 
2198 2198
     // *** Get stamps width and height
2199 2199
     $sx = imagesx($stamp);
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 
2264 2264
         case 'tr':
2265 2265
           $width = $this->width - $assetWidth - $padding;
2266
-          $height = 0 + $padding;;
2266
+          $height = 0 + $padding; ;
2267 2267
           break;
2268 2268
 
2269 2269
         case 'l':
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
     $minalpha = 127;
2349 2349
     for ($x = 0; $x < $w; $x++)
2350 2350
       for ($y = 0; $y < $h; $y++) {
2351
-        $alpha = ( imagecolorat($img, $x, $y) >> 24 ) & 0xFF;
2351
+        $alpha = (imagecolorat($img, $x, $y) >> 24) & 0xFF;
2352 2352
         if ($alpha < $minalpha) {
2353 2353
           $minalpha = $alpha;
2354 2354
         }
@@ -2359,15 +2359,15 @@  discard block
 block discarded – undo
2359 2359
       for ($y = 0; $y < $h; $y++) {
2360 2360
         //get current alpha value (represents the TANSPARENCY!)
2361 2361
         $colorxy = imagecolorat($img, $x, $y);
2362
-        $alpha = ( $colorxy >> 24 ) & 0xFF;
2362
+        $alpha = ($colorxy >> 24) & 0xFF;
2363 2363
         //calculate new alpha
2364 2364
         if ($minalpha !== 127) {
2365
-          $alpha = 127 + 127 * $opacity * ( $alpha - 127 ) / ( 127 - $minalpha );
2365
+          $alpha = 127 + 127 * $opacity * ($alpha - 127) / (127 - $minalpha);
2366 2366
         } else {
2367 2367
           $alpha += 127 * $opacity;
2368 2368
         }
2369 2369
         //get the color index with new alpha
2370
-        $alphacolorxy = imagecolorallocatealpha($img, ( $colorxy >> 16 ) & 0xFF, ( $colorxy >> 8 ) & 0xFF, $colorxy & 0xFF, $alpha);
2370
+        $alphacolorxy = imagecolorallocatealpha($img, ($colorxy >> 16) & 0xFF, ($colorxy >> 8) & 0xFF, $colorxy & 0xFF, $alpha);
2371 2371
         //set pixel with the new color + opacity
2372 2372
         if (!imagesetpixel($img, $x, $y, $alphacolorxy)) {
2373 2373
 
@@ -2392,12 +2392,12 @@  discard block
 block discarded – undo
2392 2392
     #
2393 2393
     {
2394 2394
 
2395
-    if (!file_exists($file) && !$this->checkStringStartsWith('http://', $file)) { if ($this->debug) { throw new Exception('Image not found.'); }else{ throw new Exception(); }};
2395
+    if (!file_exists($file) && !$this->checkStringStartsWith('http://', $file)) { if ($this->debug) { throw new Exception('Image not found.'); } else { throw new Exception(); }};
2396 2396
 
2397 2397
         // *** Get extension
2398 2398
         $extension = strrchr($file, '.');
2399 2399
         $extension = fix_strtolower($extension);
2400
-        switch($extension)
2400
+        switch ($extension)
2401 2401
         {
2402 2402
             case '.jpg':
2403 2403
             case '.jpeg':
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 
2445 2445
 ## --------------------------------------------------------
2446 2446
 
2447
-    public function saveImage($savePath, $imageQuality="100")
2447
+    public function saveImage($savePath, $imageQuality = "100")
2448 2448
     # Author:     Jarrod Oberto
2449 2449
     # Date:       27-02-08
2450 2450
     # Purpose:    Saves the image
@@ -2461,10 +2461,10 @@  discard block
 block discarded – undo
2461 2461
     {
2462 2462
 
2463 2463
     // *** Perform a check or two.
2464
-    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); }else{ throw new Exception(); }}
2464
+    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); } else { throw new Exception(); }}
2465 2465
     $fileInfoArray = pathinfo($savePath);
2466 2466
     clearstatcache();
2467
-    if (!is_writable($fileInfoArray['dirname'])) {  if ($this->debug) { throw new Exception('The path is not writable. Please check your permissions.'); }else{ throw new Exception(); }}
2467
+    if (!is_writable($fileInfoArray['dirname'])) {  if ($this->debug) { throw new Exception('The path is not writable. Please check your permissions.'); } else { throw new Exception(); }}
2468 2468
 
2469 2469
     // *** Get extension
2470 2470
         $extension = strrchr($savePath, '.');
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 
2473 2473
     $error = '';
2474 2474
 
2475
-        switch($extension)
2475
+        switch ($extension)
2476 2476
         {
2477 2477
             case '.jpg':
2478 2478
             case '.jpeg':
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
 
2492 2492
             case '.png':
2493 2493
         // *** Scale quality from 0-100 to 0-9
2494
-        $scaleQuality = round(($imageQuality/100) * 9);
2494
+        $scaleQuality = round(($imageQuality / 100) * 9);
2495 2495
 
2496 2496
         // *** Invert qualit setting as 0 is best, not 9
2497 2497
         $invertScaleQuality = 9 - $scaleQuality;
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 
2512 2512
             default:
2513 2513
         // *** No extension - No save.
2514
-        $this->errorArray[] = 'This file type (' . $extension . ') is not supported. File not saved.';
2514
+        $this->errorArray[] = 'This file type ('.$extension.') is not supported. File not saved.';
2515 2515
                 break;
2516 2516
         }
2517 2517
 
@@ -2519,13 +2519,13 @@  discard block
 block discarded – undo
2519 2519
 
2520 2520
     // *** Display error if a file type is not supported.
2521 2521
     if ($error != '') {
2522
-      $this->errorArray[] = $error . ' support is NOT enabled. File not saved.';
2522
+      $this->errorArray[] = $error.' support is NOT enabled. File not saved.';
2523 2523
     }
2524 2524
     }
2525 2525
 
2526 2526
 ## --------------------------------------------------------
2527 2527
 
2528
-  public function displayImage($fileType = 'jpg', $imageQuality="100")
2528
+  public function displayImage($fileType = 'jpg', $imageQuality = "100")
2529 2529
     # Author:     Jarrod Oberto
2530 2530
     # Date:       18-11-09
2531 2531
     # Purpose:    Display images directly to the browser
@@ -2536,9 +2536,9 @@  discard block
 block discarded – undo
2536 2536
     #
2537 2537
   {
2538 2538
 
2539
-    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); }else{ throw new Exception(); }}
2539
+    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); } else { throw new Exception(); }}
2540 2540
 
2541
-        switch($fileType)
2541
+        switch ($fileType)
2542 2542
         {
2543 2543
             case 'jpg':
2544 2544
             case 'jpeg':
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
         header('Content-type: image/png');
2554 2554
 
2555 2555
         // *** Scale quality from 0-100 to 0-9
2556
-        $scaleQuality = round(($imageQuality/100) * 9);
2556
+        $scaleQuality = round(($imageQuality / 100) * 9);
2557 2557
 
2558 2558
         // *** Invert qualit setting as 0 is best, not 9
2559 2559
         $invertScaleQuality = 9 - $scaleQuality;
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
     # Notes:
2622 2622
     #
2623 2623
     {
2624
-        if(extension_loaded('gd') && function_exists('gd_info'))
2624
+        if (extension_loaded('gd') && function_exists('gd_info'))
2625 2625
         {
2626 2626
             $gdInstalled = true;
2627 2627
         }
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
     # Notes:
2646 2646
     #
2647 2647
     {
2648
-        if(extension_loaded('exif'))
2648
+        if (extension_loaded('exif'))
2649 2649
         {
2650 2650
             $exifInstalled = true;
2651 2651
         }
@@ -2847,7 +2847,7 @@  discard block
 block discarded – undo
2847 2847
     $color = str_replace('#', '', $hex);
2848 2848
 
2849 2849
     if (strlen($color) == 3) {
2850
-      $color = $color . $color;
2850
+      $color = $color.$color;
2851 2851
     }
2852 2852
 
2853 2853
     $rgb = array(
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
 
2862 2862
   ## --------------------------------------------------------
2863 2863
 
2864
-  private function createImageColor ($colorArray)
2864
+  private function createImageColor($colorArray)
2865 2865
   {
2866 2866
     $r = $colorArray['r'];
2867 2867
     $g = $colorArray['g'];
@@ -2937,7 +2937,7 @@  discard block
 block discarded – undo
2937 2937
 
2938 2938
   ## --------------------------------------------------------
2939 2939
 
2940
-  private function invertTransparency($value, $originalMax, $invert=true)
2940
+  private function invertTransparency($value, $originalMax, $invert = true)
2941 2941
   # Purpose:  This does two things:
2942 2942
   #       1) Convert the range from 0-127 to 0-100
2943 2943
   #       2) Inverts value to 100 is not transparent while 0 is fully
@@ -2954,9 +2954,9 @@  discard block
 block discarded – undo
2954 2954
     }
2955 2955
 
2956 2956
     if ($invert) {
2957
-      return $originalMax - (($value/100) * $originalMax);
2957
+      return $originalMax - (($value / 100) * $originalMax);
2958 2958
     } else {
2959
-      return ($value/100) * $originalMax;
2959
+      return ($value / 100) * $originalMax;
2960 2960
     }
2961 2961
   }
2962 2962
 
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
   function checkStringStartsWith($needle, $haystack)
2994 2994
   # Check if a string starts with a specific pattern
2995 2995
   {
2996
-    return (substr($haystack, 0, strlen($needle))==$needle);
2996
+    return (substr($haystack, 0, strlen($needle)) == $needle);
2997 2997
   }
2998 2998
 
2999 2999
 
@@ -3030,24 +3030,24 @@  discard block
 block discarded – undo
3030 3030
 
3031 3031
     $bmpSize = strlen($BMP) + 14 + 40;
3032 3032
     // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp
3033
-    $BITMAPFILEHEADER  = 'BM';                                    // WORD    bfType;
3033
+    $BITMAPFILEHEADER  = 'BM'; // WORD    bfType;
3034 3034
     $BITMAPFILEHEADER .= $this->LittleEndian2String($bmpSize, 4); // DWORD   bfSize;
3035
-    $BITMAPFILEHEADER .= $this->LittleEndian2String(       0, 2); // WORD    bfReserved1;
3036
-    $BITMAPFILEHEADER .= $this->LittleEndian2String(       0, 2); // WORD    bfReserved2;
3037
-    $BITMAPFILEHEADER .= $this->LittleEndian2String(      54, 4); // DWORD   bfOffBits;
3035
+    $BITMAPFILEHEADER .= $this->LittleEndian2String(0, 2); // WORD    bfReserved1;
3036
+    $BITMAPFILEHEADER .= $this->LittleEndian2String(0, 2); // WORD    bfReserved2;
3037
+    $BITMAPFILEHEADER .= $this->LittleEndian2String(54, 4); // DWORD   bfOffBits;
3038 3038
 
3039 3039
     // BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp
3040
-    $BITMAPINFOHEADER  = $this->LittleEndian2String(      40, 4); // DWORD  biSize;
3041
-    $BITMAPINFOHEADER .= $this->LittleEndian2String( $imageX, 4); // LONG   biWidth;
3042
-    $BITMAPINFOHEADER .= $this->LittleEndian2String( $imageY, 4); // LONG   biHeight;
3043
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(       1, 2); // WORD   biPlanes;
3044
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(      24, 2); // WORD   biBitCount;
3045
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(       0, 4); // DWORD  biCompression;
3046
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(       0, 4); // DWORD  biSizeImage;
3047
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(    2835, 4); // LONG   biXPelsPerMeter;
3048
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(    2835, 4); // LONG   biYPelsPerMeter;
3049
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(       0, 4); // DWORD  biClrUsed;
3050
-    $BITMAPINFOHEADER .= $this->LittleEndian2String(       0, 4); // DWORD  biClrImportant;
3040
+    $BITMAPINFOHEADER  = $this->LittleEndian2String(40, 4); // DWORD  biSize;
3041
+    $BITMAPINFOHEADER .= $this->LittleEndian2String($imageX, 4); // LONG   biWidth;
3042
+    $BITMAPINFOHEADER .= $this->LittleEndian2String($imageY, 4); // LONG   biHeight;
3043
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(1, 2); // WORD   biPlanes;
3044
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(24, 2); // WORD   biBitCount;
3045
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(0, 4); // DWORD  biCompression;
3046
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(0, 4); // DWORD  biSizeImage;
3047
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(2835, 4); // LONG   biXPelsPerMeter;
3048
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(2835, 4); // LONG   biYPelsPerMeter;
3049
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(0, 4); // DWORD  biClrUsed;
3050
+    $BITMAPINFOHEADER .= $this->LittleEndian2String(0, 4); // DWORD  biClrImportant;
3051 3051
 
3052 3052
     return $BITMAPFILEHEADER.$BITMAPINFOHEADER.$BMP;
3053 3053
   }
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
 
3072 3072
 ## --------------------------------------------------------
3073 3073
 
3074
-  private function LittleEndian2String($number, $minbytes=1)
3074
+  private function LittleEndian2String($number, $minbytes = 1)
3075 3075
     # Author:     James Heinrich
3076 3076
     # Purpose:    BMP SUPPORT (SAVING)
3077 3077
     # Param in:
@@ -3109,25 +3109,25 @@  discard block
 block discarded – undo
3109 3109
   {
3110 3110
 
3111 3111
     //Ouverture du fichier en mode binaire
3112
-    if (! $f1 = fopen($filename,"rb")) return FALSE;
3112
+    if (!$f1 = fopen($filename, "rb")) return FALSE;
3113 3113
 
3114 3114
     //1 : Chargement des ent�tes FICHIER
3115
-    $FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14));
3115
+    $FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1, 14));
3116 3116
     if ($FILE['file_type'] != 19778) return FALSE;
3117 3117
 
3118 3118
     //2 : Chargement des ent�tes BMP
3119 3119
     $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'.
3120 3120
            '/Vcompression/Vsize_bitmap/Vhoriz_resolution'.
3121
-           '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40));
3122
-    $BMP['colors'] = pow(2,$BMP['bits_per_pixel']);
3121
+           '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1, 40));
3122
+    $BMP['colors'] = pow(2, $BMP['bits_per_pixel']);
3123 3123
 
3124 3124
     if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset'];
3125 3125
 
3126
-    $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8;
3126
+    $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel'] / 8;
3127 3127
     $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']);
3128
-    $BMP['decal'] = ($BMP['width']*$BMP['bytes_per_pixel']/4);
3129
-       $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4);
3130
-    $BMP['decal'] = 4-(4*$BMP['decal']);
3128
+    $BMP['decal'] = ($BMP['width'] * $BMP['bytes_per_pixel'] / 4);
3129
+       $BMP['decal'] -= floor($BMP['width'] * $BMP['bytes_per_pixel'] / 4);
3130
+    $BMP['decal'] = 4 - (4 * $BMP['decal']);
3131 3131
 
3132 3132
     if ($BMP['decal'] == 4) $BMP['decal'] = 0;
3133 3133
 
@@ -3135,23 +3135,23 @@  discard block
 block discarded – undo
3135 3135
     $PALETTE = array();
3136 3136
     if ($BMP['colors'] < 16777216)
3137 3137
     {
3138
-      $PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4));
3138
+      $PALETTE = unpack('V'.$BMP['colors'], fread($f1, $BMP['colors'] * 4));
3139 3139
     }
3140 3140
 
3141 3141
     //4 : Cr�ation de l'image
3142
-    $IMG = fread($f1,$BMP['size_bitmap']);
3142
+    $IMG = fread($f1, $BMP['size_bitmap']);
3143 3143
     $VIDE = chr(0);
3144 3144
 
3145
-    $res = imagecreatetruecolor($BMP['width'],$BMP['height']);
3145
+    $res = imagecreatetruecolor($BMP['width'], $BMP['height']);
3146 3146
     $P = 0;
3147
-    $Y = $BMP['height']-1;
3147
+    $Y = $BMP['height'] - 1;
3148 3148
     while ($Y >= 0)
3149 3149
     {
3150
-      $X=0;
3150
+      $X = 0;
3151 3151
       while ($X < $BMP['width'])
3152 3152
       {
3153 3153
         if ($BMP['bits_per_pixel'] == 24)
3154
-          $COLOR = unpack("V",substr($IMG,$P,3).$VIDE);
3154
+          $COLOR = unpack("V", substr($IMG, $P, 3).$VIDE);
3155 3155
         elseif ($BMP['bits_per_pixel'] == 16)
3156 3156
         {
3157 3157
 
@@ -3171,7 +3171,7 @@  discard block
 block discarded – undo
3171 3171
           //$COLOR = unpack("n",substr($IMG,$P,2));
3172 3172
           //$COLOR[1] = $PALETTE[$COLOR[1]+1];
3173 3173
 
3174
-          $COLOR = unpack("v",substr($IMG,$P,2));
3174
+          $COLOR = unpack("v", substr($IMG, $P, 2));
3175 3175
           $blue = ($COLOR[1] & 0x001f) << 3;
3176 3176
           $green = ($COLOR[1] & 0x07e0) >> 3;
3177 3177
           $red = ($COLOR[1] & 0xf800) >> 8;
@@ -3180,38 +3180,38 @@  discard block
 block discarded – undo
3180 3180
         }
3181 3181
         elseif ($BMP['bits_per_pixel'] == 8)
3182 3182
         {
3183
-          $COLOR = unpack("n",$VIDE.substr($IMG,$P,1));
3184
-          $COLOR[1] = $PALETTE[$COLOR[1]+1];
3183
+          $COLOR = unpack("n", $VIDE.substr($IMG, $P, 1));
3184
+          $COLOR[1] = $PALETTE[$COLOR[1] + 1];
3185 3185
         }
3186 3186
         elseif ($BMP['bits_per_pixel'] == 4)
3187 3187
         {
3188
-          $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3189
-          if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F);
3190
-          $COLOR[1] = $PALETTE[$COLOR[1]+1];
3188
+          $COLOR = unpack("n", $VIDE.substr($IMG, floor($P), 1));
3189
+          if (($P * 2) % 2 == 0) $COLOR[1] = ($COLOR[1] >> 4); else $COLOR[1] = ($COLOR[1] & 0x0F);
3190
+          $COLOR[1] = $PALETTE[$COLOR[1] + 1];
3191 3191
         }
3192 3192
         elseif ($BMP['bits_per_pixel'] == 1)
3193 3193
         {
3194
-          $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3195
-          if     (($P*8)%8 == 0) $COLOR[1] =  $COLOR[1]        >>7;
3196
-          elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6;
3197
-          elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5;
3198
-          elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4;
3199
-          elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3;
3200
-          elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2;
3201
-          elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1;
3202
-          elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1);
3203
-          $COLOR[1] = $PALETTE[$COLOR[1]+1];
3194
+          $COLOR = unpack("n", $VIDE.substr($IMG, floor($P), 1));
3195
+          if (($P * 8) % 8 == 0) $COLOR[1] = $COLOR[1] >> 7;
3196
+          elseif (($P * 8) % 8 == 1) $COLOR[1] = ($COLOR[1] & 0x40) >> 6;
3197
+          elseif (($P * 8) % 8 == 2) $COLOR[1] = ($COLOR[1] & 0x20) >> 5;
3198
+          elseif (($P * 8) % 8 == 3) $COLOR[1] = ($COLOR[1] & 0x10) >> 4;
3199
+          elseif (($P * 8) % 8 == 4) $COLOR[1] = ($COLOR[1] & 0x8) >> 3;
3200
+          elseif (($P * 8) % 8 == 5) $COLOR[1] = ($COLOR[1] & 0x4) >> 2;
3201
+          elseif (($P * 8) % 8 == 6) $COLOR[1] = ($COLOR[1] & 0x2) >> 1;
3202
+          elseif (($P * 8) % 8 == 7) $COLOR[1] = ($COLOR[1] & 0x1);
3203
+          $COLOR[1] = $PALETTE[$COLOR[1] + 1];
3204 3204
         }
3205 3205
         else
3206 3206
           return FALSE;
3207 3207
 
3208
-        imagesetpixel($res,$X,$Y,$COLOR[1]);
3208
+        imagesetpixel($res, $X, $Y, $COLOR[1]);
3209 3209
         $X++;
3210 3210
         $P += $BMP['bytes_per_pixel'];
3211 3211
       }
3212 3212
 
3213 3213
       $Y--;
3214
-      $P+=$BMP['decal'];
3214
+      $P += $BMP['decal'];
3215 3215
     }
3216 3216
     //Fermeture du fichier
3217 3217
     fclose($f1);
Please login to merge, or discard this patch.
Braces   +86 added lines, -63 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     # Notes:
210 210
     #
211 211
     {
212
-    if (!$this->testGDInstalled()) { if ($this->debug) { throw new Exception('The GD Library is not installed.'); }else{ throw new Exception(); }};
212
+    if (!$this->testGDInstalled()) { if ($this->debug) { throw new Exception('The GD Library is not installed.'); } else{ throw new Exception(); }};
213 213
 
214 214
     $this->initialise();
215 215
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
     $option = $this->prepOption($option);
323 323
 
324 324
     // *** Make sure the file passed in is valid
325
-    if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); }else{ throw new Exception(); }};
325
+    if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); } else{ throw new Exception(); }};
326 326
 
327 327
     // *** Get optimal width and height - based on $option
328 328
     $dimensionsArray = $this->getDimensions($newWidth, $newHeight, $option);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
   {
392 392
 
393 393
     // *** Make sure the file passed in is valid
394
-    if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); }else{ throw new Exception(); }};
394
+    if (!$this->image) { if ($this->debug) { throw new Exception('file ' . $this->getFileName() .' is missing or invalid'); } else{ throw new Exception(); }};
395 395
 
396 396
     $this->imageResized = $this->image;
397 397
     $this->crop($this->width, $this->height, $newWidth, $newHeight, $cropPos);
@@ -671,27 +671,27 @@  discard block
 block discarded – undo
671 671
       }
672 672
     }
673 673
 
674
-        if ($this->height < $this->width)
675
-        // *** Image to be resized is wider (landscape)
674
+        if ($this->height < $this->width) {
675
+                // *** Image to be resized is wider (landscape)
676 676
         {
677 677
             //$optimalWidth = $newWidth;
678 678
             //$optimalHeight= $this->getSizeByFixedWidth($newWidth);
679 679
 
680 680
             $dimensionsArray = $this->getSizeByFixedWidth($newWidth, $newHeight);
681
+        }
681 682
       $optimalWidth = $dimensionsArray['optimalWidth'];
682 683
       $optimalHeight = $dimensionsArray['optimalHeight'];
683
-        }
684
-        elseif ($this->height > $this->width)
685
-        // *** Image to be resized is taller (portrait)
684
+        } elseif ($this->height > $this->width) {
685
+                // *** Image to be resized is taller (portrait)
686 686
         {
687 687
             //$optimalWidth = $this->getSizeByFixedHeight($newHeight);
688 688
             //$optimalHeight= $newHeight;
689 689
 
690 690
             $dimensionsArray = $this->getSizeByFixedHeight($newWidth, $newHeight);
691
+        }
691 692
       $optimalWidth = $dimensionsArray['optimalWidth'];
692 693
       $optimalHeight = $dimensionsArray['optimalHeight'];
693
-        }
694
-    else
694
+        } else
695 695
         // *** Image to be resizerd is a square
696 696
         {
697 697
 
@@ -800,8 +800,7 @@  discard block
 block discarded – undo
800 800
         $offset = 0;
801 801
 
802 802
         imageconvolution($this->imageResized, $sharpenMatrix, $divisor, $offset);
803
-      }
804
-      else # More subtle and personally more desirable
803
+      } else # More subtle and personally more desirable
805 804
       {
806 805
         $sharpness  = $this->findSharp($this->widthOriginal, $this->width);
807 806
 
@@ -814,8 +813,7 @@  discard block
 block discarded – undo
814 813
         $offset     = 0;
815 814
         imageconvolution($this->imageResized, $sharpenMatrix, $divisor, $offset);
816 815
       }
817
-    }
818
-    else
816
+    } else
819 817
     {
820 818
       if ($this->debug) { throw new Exception('Sharpening required PHP 5.1.0 or greater.'); }
821 819
     }
@@ -1236,8 +1234,12 @@  discard block
 block discarded – undo
1236 1234
     }
1237 1235
     for($i=0; $i<=$reflectionHeight; $i++){
1238 1236
 
1239
-      if($startingTransparency>100) $startingTransparency = 100;
1240
-      if($startingTransparency< 1) $startingTransparency = 1;
1237
+      if($startingTransparency>100) {
1238
+          $startingTransparency = 100;
1239
+      }
1240
+      if($startingTransparency< 1) {
1241
+          $startingTransparency = 1;
1242
+      }
1241 1243
       imagecopymerge($bg, $li, 0, $i, 0, 0, $this->width, 1, $startingTransparency);
1242 1244
       $startingTransparency+=$step;
1243 1245
     }
@@ -1648,7 +1650,7 @@  discard block
 block discarded – undo
1648 1650
       $y1 = $this->captionBoxPositionArray['y1'];
1649 1651
       $y2 = $this->captionBoxPositionArray['y2'];
1650 1652
     } else {
1651
-      if ($this->debug) { throw new Exception('No caption box found.'); }else{ return false; }
1653
+      if ($this->debug) { throw new Exception('No caption box found.'); } else{ return false; }
1652 1654
     }
1653 1655
 
1654 1656
 
@@ -1733,9 +1735,9 @@  discard block
 block discarded – undo
1733 1735
     if (!$this->debug || !$debug) { $debug = false; }
1734 1736
 
1735 1737
     // *** Check all is good - check the EXIF library exists and the file exists, too.
1736
-    if (!$this->testEXIFInstalled()) { if ($debug) { throw new Exception('The EXIF Library is not installed.'); }else{ return array(); }};
1737
-    if (!file_exists($this->fileName)) { if ($debug) { throw new Exception('Image not found.'); }else{ return array(); }};
1738
-    if ($this->fileExtension !== '.jpg') { if ($debug) { throw new Exception('Metadata not supported for this image type.'); }else{ return array(); }};
1738
+    if (!$this->testEXIFInstalled()) { if ($debug) { throw new Exception('The EXIF Library is not installed.'); } else{ return array(); }};
1739
+    if (!file_exists($this->fileName)) { if ($debug) { throw new Exception('Image not found.'); } else{ return array(); }};
1740
+    if ($this->fileExtension !== '.jpg') { if ($debug) { throw new Exception('Metadata not supported for this image type.'); } else{ return array(); }};
1739 1741
     $exifData = exif_read_data($this->fileName, 'IFD0');
1740 1742
 
1741 1743
     // *** Format the apperture value
@@ -2049,19 +2051,20 @@  discard block
 block discarded – undo
2049 2051
   #
2050 2052
   {
2051 2053
     $len = strlen($val);
2052
-    if ($len < 0x8000)
2053
-      return chr(0x1c).chr($rec).chr($dat).
2054
+    if ($len < 0x8000) {
2055
+          return chr(0x1c).chr($rec).chr($dat).
2054 2056
       chr($len >> 8).
2055 2057
       chr($len & 0xff).
2056 2058
       $val;
2057
-    else
2058
-      return chr(0x1c).chr($rec).chr($dat).
2059
+    } else {
2060
+          return chr(0x1c).chr($rec).chr($dat).
2059 2061
       chr(0x80).chr(0x04).
2060 2062
       chr(($len >> 24) & 0xff).
2061 2063
       chr(($len >> 16) & 0xff).
2062 2064
       chr(($len >> 8 ) & 0xff).
2063 2065
       chr(($len ) & 0xff).
2064 2066
       $val;
2067
+    }
2065 2068
   }
2066 2069
 
2067 2070
 
@@ -2134,7 +2137,7 @@  discard block
 block discarded – undo
2134 2137
       if (!file_exists($font)) {
2135 2138
 
2136 2139
         // *** If not, return false
2137
-        if ($this->debug) { throw new Exception('Font not found'); }else{ return false; }
2140
+        if ($this->debug) { throw new Exception('Font not found'); } else{ return false; }
2138 2141
       }
2139 2142
     }
2140 2143
 
@@ -2346,8 +2349,10 @@  discard block
 block discarded – undo
2346 2349
 
2347 2350
     //find the most opaque pixel in the image (the one with the smallest alpha value)
2348 2351
     $minalpha = 127;
2349
-    for ($x = 0; $x < $w; $x++)
2350
-      for ($y = 0; $y < $h; $y++) {
2352
+    for ($x = 0; $x < $w; $x++) {
2353
+          for ($y = 0;
2354
+    }
2355
+    $y < $h; $y++) {
2351 2356
         $alpha = ( imagecolorat($img, $x, $y) >> 24 ) & 0xFF;
2352 2357
         if ($alpha < $minalpha) {
2353 2358
           $minalpha = $alpha;
@@ -2392,7 +2397,7 @@  discard block
 block discarded – undo
2392 2397
     #
2393 2398
     {
2394 2399
 
2395
-    if (!file_exists($file) && !$this->checkStringStartsWith('http://', $file)) { if ($this->debug) { throw new Exception('Image not found.'); }else{ throw new Exception(); }};
2400
+    if (!file_exists($file) && !$this->checkStringStartsWith('http://', $file)) { if ($this->debug) { throw new Exception('Image not found.'); } else{ throw new Exception(); }};
2396 2401
 
2397 2402
         // *** Get extension
2398 2403
         $extension = strrchr($file, '.');
@@ -2461,10 +2466,10 @@  discard block
 block discarded – undo
2461 2466
     {
2462 2467
 
2463 2468
     // *** Perform a check or two.
2464
-    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); }else{ throw new Exception(); }}
2469
+    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); } else{ throw new Exception(); }}
2465 2470
     $fileInfoArray = pathinfo($savePath);
2466 2471
     clearstatcache();
2467
-    if (!is_writable($fileInfoArray['dirname'])) {  if ($this->debug) { throw new Exception('The path is not writable. Please check your permissions.'); }else{ throw new Exception(); }}
2472
+    if (!is_writable($fileInfoArray['dirname'])) {  if ($this->debug) { throw new Exception('The path is not writable. Please check your permissions.'); } else{ throw new Exception(); }}
2468 2473
 
2469 2474
     // *** Get extension
2470 2475
         $extension = strrchr($savePath, '.');
@@ -2536,7 +2541,7 @@  discard block
 block discarded – undo
2536 2541
     #
2537 2542
   {
2538 2543
 
2539
-    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); }else{ throw new Exception(); }}
2544
+    if (!is_resource($this->imageResized)) { if ($this->debug) { throw new Exception('saveImage: This is not a resource.'); } else{ throw new Exception(); }}
2540 2545
 
2541 2546
         switch($fileType)
2542 2547
         {
@@ -2624,8 +2629,7 @@  discard block
 block discarded – undo
2624 2629
         if(extension_loaded('gd') && function_exists('gd_info'))
2625 2630
         {
2626 2631
             $gdInstalled = true;
2627
-        }
2628
-        else
2632
+        } else
2629 2633
         {
2630 2634
             $gdInstalled = false;
2631 2635
         }
@@ -2648,8 +2652,7 @@  discard block
 block discarded – undo
2648 2652
         if(extension_loaded('exif'))
2649 2653
         {
2650 2654
             $exifInstalled = true;
2651
-        }
2652
-        else
2655
+        } else
2653 2656
         {
2654 2657
             $exifInstalled = false;
2655 2658
         }
@@ -2672,8 +2675,7 @@  discard block
 block discarded – undo
2672 2675
         if ($image)
2673 2676
         {
2674 2677
             $fileIsImage = true;
2675
-        }
2676
-        else
2678
+        } else
2677 2679
         {
2678 2680
             $fileIsImage = false;
2679 2681
         }
@@ -3109,11 +3111,15 @@  discard block
 block discarded – undo
3109 3111
   {
3110 3112
 
3111 3113
     //Ouverture du fichier en mode binaire
3112
-    if (! $f1 = fopen($filename,"rb")) return FALSE;
3114
+    if (! $f1 = fopen($filename,"rb")) {
3115
+        return FALSE;
3116
+    }
3113 3117
 
3114 3118
     //1 : Chargement des ent�tes FICHIER
3115 3119
     $FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14));
3116
-    if ($FILE['file_type'] != 19778) return FALSE;
3120
+    if ($FILE['file_type'] != 19778) {
3121
+        return FALSE;
3122
+    }
3117 3123
 
3118 3124
     //2 : Chargement des ent�tes BMP
3119 3125
     $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'.
@@ -3121,7 +3127,9 @@  discard block
 block discarded – undo
3121 3127
            '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40));
3122 3128
     $BMP['colors'] = pow(2,$BMP['bits_per_pixel']);
3123 3129
 
3124
-    if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset'];
3130
+    if ($BMP['size_bitmap'] == 0) {
3131
+        $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset'];
3132
+    }
3125 3133
 
3126 3134
     $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8;
3127 3135
     $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']);
@@ -3129,7 +3137,9 @@  discard block
 block discarded – undo
3129 3137
        $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4);
3130 3138
     $BMP['decal'] = 4-(4*$BMP['decal']);
3131 3139
 
3132
-    if ($BMP['decal'] == 4) $BMP['decal'] = 0;
3140
+    if ($BMP['decal'] == 4) {
3141
+        $BMP['decal'] = 0;
3142
+    }
3133 3143
 
3134 3144
     //3 : Chargement des couleurs de la palette
3135 3145
     $PALETTE = array();
@@ -3150,9 +3160,9 @@  discard block
 block discarded – undo
3150 3160
       $X=0;
3151 3161
       while ($X < $BMP['width'])
3152 3162
       {
3153
-        if ($BMP['bits_per_pixel'] == 24)
3154
-          $COLOR = unpack("V",substr($IMG,$P,3).$VIDE);
3155
-        elseif ($BMP['bits_per_pixel'] == 16)
3163
+        if ($BMP['bits_per_pixel'] == 24) {
3164
+                  $COLOR = unpack("V",substr($IMG,$P,3).$VIDE);
3165
+        } elseif ($BMP['bits_per_pixel'] == 16)
3156 3166
         {
3157 3167
 
3158 3168
           /*
@@ -3177,33 +3187,43 @@  discard block
 block discarded – undo
3177 3187
           $red = ($COLOR[1] & 0xf800) >> 8;
3178 3188
           $COLOR[1] = $red * 65536 + $green * 256 + $blue;
3179 3189
 
3180
-        }
3181
-        elseif ($BMP['bits_per_pixel'] == 8)
3190
+        } elseif ($BMP['bits_per_pixel'] == 8)
3182 3191
         {
3183 3192
           $COLOR = unpack("n",$VIDE.substr($IMG,$P,1));
3184 3193
           $COLOR[1] = $PALETTE[$COLOR[1]+1];
3185
-        }
3186
-        elseif ($BMP['bits_per_pixel'] == 4)
3194
+        } elseif ($BMP['bits_per_pixel'] == 4)
3187 3195
         {
3188 3196
           $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3189
-          if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F);
3197
+          if (($P*2)%2 == 0) {
3198
+              $COLOR[1] = ($COLOR[1] >> 4) ;
3199
+          } else {
3200
+              $COLOR[1] = ($COLOR[1] & 0x0F);
3201
+          }
3190 3202
           $COLOR[1] = $PALETTE[$COLOR[1]+1];
3191
-        }
3192
-        elseif ($BMP['bits_per_pixel'] == 1)
3203
+        } elseif ($BMP['bits_per_pixel'] == 1)
3193 3204
         {
3194 3205
           $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1));
3195
-          if     (($P*8)%8 == 0) $COLOR[1] =  $COLOR[1]        >>7;
3196
-          elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6;
3197
-          elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5;
3198
-          elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4;
3199
-          elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3;
3200
-          elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2;
3201
-          elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1;
3202
-          elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1);
3206
+          if     (($P*8)%8 == 0) {
3207
+              $COLOR[1] =  $COLOR[1]        >>7;
3208
+          } elseif (($P*8)%8 == 1) {
3209
+              $COLOR[1] = ($COLOR[1] & 0x40)>>6;
3210
+          } elseif (($P*8)%8 == 2) {
3211
+              $COLOR[1] = ($COLOR[1] & 0x20)>>5;
3212
+          } elseif (($P*8)%8 == 3) {
3213
+              $COLOR[1] = ($COLOR[1] & 0x10)>>4;
3214
+          } elseif (($P*8)%8 == 4) {
3215
+              $COLOR[1] = ($COLOR[1] & 0x8)>>3;
3216
+          } elseif (($P*8)%8 == 5) {
3217
+              $COLOR[1] = ($COLOR[1] & 0x4)>>2;
3218
+          } elseif (($P*8)%8 == 6) {
3219
+              $COLOR[1] = ($COLOR[1] & 0x2)>>1;
3220
+          } elseif (($P*8)%8 == 7) {
3221
+              $COLOR[1] = ($COLOR[1] & 0x1);
3222
+          }
3203 3223
           $COLOR[1] = $PALETTE[$COLOR[1]+1];
3224
+        } else {
3225
+                  return FALSE;
3204 3226
         }
3205
-        else
3206
-          return FALSE;
3207 3227
 
3208 3228
         imagesetpixel($res,$X,$Y,$COLOR[1]);
3209 3229
         $X++;
@@ -3241,8 +3261,11 @@  discard block
 block discarded – undo
3241 3261
 
3242 3262
       $psdReader = new PhpPsdReader($fileName);
3243 3263
 
3244
-      if (isset($psdReader->infoArray['error'])) return '';
3245
-      else return $psdReader->getImage();
3264
+      if (isset($psdReader->infoArray['error'])) {
3265
+          return '';
3266
+      } else {
3267
+          return $psdReader->getImage();
3268
+      }
3246 3269
     } else {
3247 3270
       return false;
3248 3271
     }
Please login to merge, or discard this patch.
class/xoopseditor/tinymce4/external_plugins/filemanager/include/utils.php 3 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -14,63 +14,63 @@  discard block
 block discarded – undo
14 14
 
15 15
 function duplicate_file($old_path,$name){
16 16
     if(file_exists($old_path)){
17
-	$info=pathinfo($old_path);
18
-	$new_path=$info['dirname']."/".$name.".".$info['extension'];
19
-	if(file_exists($new_path)) return false;
20
-	return copy($old_path,$new_path);
17
+    $info=pathinfo($old_path);
18
+    $new_path=$info['dirname']."/".$name.".".$info['extension'];
19
+    if(file_exists($new_path)) return false;
20
+    return copy($old_path,$new_path);
21 21
     }
22 22
 }
23 23
 
24 24
 function rename_file($old_path,$name,$transliteration){
25 25
     $name=fix_filename($name,$transliteration);
26 26
     if(file_exists($old_path)){
27
-	$info=pathinfo($old_path);
28
-	$new_path=$info['dirname']."/".$name.".".$info['extension'];
29
-	if(file_exists($new_path)) return false;
30
-	return rename($old_path,$new_path);
27
+    $info=pathinfo($old_path);
28
+    $new_path=$info['dirname']."/".$name.".".$info['extension'];
29
+    if(file_exists($new_path)) return false;
30
+    return rename($old_path,$new_path);
31 31
     }
32 32
 }
33 33
 
34 34
 function rename_folder($old_path,$name,$transliteration){
35 35
     $name=fix_filename($name,$transliteration);
36 36
     if(file_exists($old_path)){
37
-	$new_path=fix_dirname($old_path)."/".$name;
38
-	if(file_exists($new_path)) return false;
39
-	return rename($old_path,$new_path);
37
+    $new_path=fix_dirname($old_path)."/".$name;
38
+    if(file_exists($new_path)) return false;
39
+    return rename($old_path,$new_path);
40 40
     }
41 41
 }
42 42
 
43 43
 function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="") {
44 44
     if(image_check_memory_usage($imgfile,$newwidth,$newheight)){
45
-	require_once('php_image_magician.php');
46
-	$magicianObj = new imageLib($imgfile);
47
-	$magicianObj -> resizeImage($newwidth, $newheight, 'crop');
48
-	$magicianObj -> saveImage($imgthumb,80);
49
-	return true;
45
+    require_once('php_image_magician.php');
46
+    $magicianObj = new imageLib($imgfile);
47
+    $magicianObj -> resizeImage($newwidth, $newheight, 'crop');
48
+    $magicianObj -> saveImage($imgthumb,80);
49
+    return true;
50 50
     }
51 51
     return false;
52 52
 }
53 53
 
54 54
 function create_img($imgfile, $imgthumb, $newwidth, $newheight="") {
55 55
     if(image_check_memory_usage($imgfile,$newwidth,$newheight)){
56
-	require_once('php_image_magician.php');
57
-	$magicianObj = new imageLib($imgfile);
58
-	$magicianObj -> resizeImage($newwidth, $newheight, 'auto');
59
-	$magicianObj -> saveImage($imgthumb,80);
60
-	return true;
56
+    require_once('php_image_magician.php');
57
+    $magicianObj = new imageLib($imgfile);
58
+    $magicianObj -> resizeImage($newwidth, $newheight, 'auto');
59
+    $magicianObj -> saveImage($imgthumb,80);
60
+    return true;
61 61
     }else{
62
-	return false;
62
+    return false;
63 63
     }
64 64
 }
65 65
 
66 66
 function makeSize($size) {
67
-   $units = array('B','KB','MB','GB','TB');
68
-   $u = 0;
69
-   while ( (round($size / 1024) > 0) && ($u < 4) ) {
70
-     $size = $size / 1024;
71
-     $u++;
72
-   }
73
-   return (number_format($size, 0) . " " . $units[$u]);
67
+    $units = array('B','KB','MB','GB','TB');
68
+    $u = 0;
69
+    while ( (round($size / 1024) > 0) && ($u < 4) ) {
70
+        $size = $size / 1024;
71
+        $u++;
72
+    }
73
+    return (number_format($size, 0) . " " . $units[$u]);
74 74
 }
75 75
 
76 76
 function foldersize($path) {
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 
128 128
 function check_files_extensions_on_path($path,$ext){
129 129
     if(!is_dir($path)){
130
-	$fileinfo = pathinfo($path);
131
-	if(!in_array(mb_strtolower($fileinfo['extension']),$ext))
132
-	    unlink($path);
130
+    $fileinfo = pathinfo($path);
131
+    if(!in_array(mb_strtolower($fileinfo['extension']),$ext))
132
+        unlink($path);
133 133
     }else{
134
-	$files = scandir($path);
135
-	foreach($files as $file){
136
-	    check_files_extensions_on_path(trim($path,'/')."/".$file,$ext);
137
-	}
134
+    $files = scandir($path);
135
+    foreach($files as $file){
136
+        check_files_extensions_on_path(trim($path,'/')."/".$file,$ext);
137
+    }
138 138
     }
139 139
 }
140 140
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
 
163 163
 function fix_filename($str,$transliteration){
164 164
     if($transliteration){
165
-    	if( function_exists( 'transliterator_transliterate' ) )
166
-    	{
167
-    	   $str = transliterator_transliterate( 'Accents-Any', $str );
168
-    	}
169
-    	else
170
-    	{
171
-    	   $str = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
172
-    	}
165
+        if( function_exists( 'transliterator_transliterate' ) )
166
+        {
167
+            $str = transliterator_transliterate( 'Accents-Any', $str );
168
+        }
169
+        else
170
+        {
171
+            $str = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
172
+        }
173 173
 
174
-	$str = preg_replace( "/[^a-zA-Z0-9\.\[\]_| -]/", '', $str );
174
+    $str = preg_replace( "/[^a-zA-Z0-9\.\[\]_| -]/", '', $str );
175 175
     }
176 176
 
177 177
     $str=str_replace(array('"',"'","/","\\"),"",$str);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     // So we add that default 'file' name to fix that issue.
183 183
     if( strpos( $str, '.' ) === 0 )
184 184
     {
185
-       $str = 'file'.$str;
185
+        $str = 'file'.$str;
186 186
     }
187 187
 
188 188
     return trim( $str );
@@ -194,45 +194,45 @@  discard block
 block discarded – undo
194 194
 
195 195
 function fix_strtoupper($str){
196 196
     if( function_exists( 'mb_strtoupper' ) )
197
-	return mb_strtoupper($str);
197
+    return mb_strtoupper($str);
198 198
     else
199
-	return strtoupper($str);
199
+    return strtoupper($str);
200 200
 }
201 201
 
202 202
 
203 203
 function fix_strtolower($str){
204 204
     if( function_exists( 'mb_strtoupper' ) )
205
-	return mb_strtolower($str);
205
+    return mb_strtolower($str);
206 206
     else
207
-	return strtolower($str);
207
+    return strtolower($str);
208 208
 }
209 209
 
210 210
 function fix_path($path,$transliteration){
211 211
     $info=pathinfo($path);
212 212
     $tmp_path = $info['dirname'];
213
-	$str=fix_filename($info['filename'],$transliteration);
213
+    $str=fix_filename($info['filename'],$transliteration);
214 214
     if($tmp_path!="")
215
-		return $tmp_path.DIRECTORY_SEPARATOR.$str;
215
+        return $tmp_path.DIRECTORY_SEPARATOR.$str;
216 216
     else
217
-		return $str;
217
+        return $str;
218 218
 }
219 219
 
220 220
 function base_url(){
221
-  return sprintf(
221
+    return sprintf(
222 222
     "%s://%s",
223 223
     isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http',
224 224
     $_SERVER['HTTP_HOST']
225
-  );
225
+    );
226 226
 }
227 227
 
228 228
 function config_loading($current_path,$fld){
229 229
     if(file_exists($current_path.$fld.".config")){
230
-	require_once($current_path.$fld.".config");
231
-	return true;
230
+    require_once($current_path.$fld.".config");
231
+    return true;
232 232
     }
233 233
     echo "!!!!".$parent=fix_dirname($fld);
234 234
     if($parent!=="." && !empty($parent)){
235
-	config_loading($current_path,$parent);
235
+    config_loading($current_path,$parent);
236 236
     }
237 237
 
238 238
     return false;
@@ -241,16 +241,16 @@  discard block
 block discarded – undo
241 241
 
242 242
 function image_check_memory_usage($img, $max_breedte, $max_hoogte){
243 243
     if(file_exists($img)){
244
-	$K64 = 65536;    // number of bytes in 64K
245
-	$memory_usage = memory_get_usage();
246
-	$memory_limit = abs((int)(str_replace('M','',ini_get('memory_limit'))*1024*1024));
247
-	$image_properties = getimagesize($img);
248
-	$image_width = $image_properties[0];
249
-	$image_height = $image_properties[1];
250
-	$image_bits = $image_properties['bits'];
251
-	$image_memory_usage = $K64 + ($image_width * $image_height * ($image_bits )  * 2);
252
-	$thumb_memory_usage = $K64 + ($max_breedte * $max_hoogte * ($image_bits ) * 2);
253
-	$memory_needed = (int)($memory_usage + $image_memory_usage + $thumb_memory_usage);
244
+    $K64 = 65536;    // number of bytes in 64K
245
+    $memory_usage = memory_get_usage();
246
+    $memory_limit = abs((int)(str_replace('M','',ini_get('memory_limit'))*1024*1024));
247
+    $image_properties = getimagesize($img);
248
+    $image_width = $image_properties[0];
249
+    $image_height = $image_properties[1];
250
+    $image_bits = $image_properties['bits'];
251
+    $image_memory_usage = $K64 + ($image_width * $image_height * ($image_bits )  * 2);
252
+    $thumb_memory_usage = $K64 + ($max_breedte * $max_hoogte * ($image_bits ) * 2);
253
+    $memory_needed = (int)($memory_usage + $image_memory_usage + $thumb_memory_usage);
254 254
 
255 255
         if($memory_needed > $memory_limit){
256 256
                 ini_set('memory_limit',((int)($memory_needed/1024/1024)+5) . 'M');
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         }else{
263 263
             return true;
264 264
         }
265
-	    }else{
266
-	    return false;
265
+        }else{
266
+        return false;
267 267
     }
268 268
 }
269 269
 
@@ -276,26 +276,26 @@  discard block
 block discarded – undo
276 276
     //create relative thumbs
277 277
     $all_ok=true;
278 278
     if($relative_image_creation){
279
-	foreach($relative_path_from_current_pos as $k=>$path){
280
-	    if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
281
-	    if (!file_exists($targetPath.$path)) create_folder($targetPath.$path,false);
282
-	    $info=pathinfo($name);
283
-	    if(!endsWith($targetPath,$path))
284
-		if(!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
285
-		    $all_ok=false;
286
-	}
279
+    foreach($relative_path_from_current_pos as $k=>$path){
280
+        if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
281
+        if (!file_exists($targetPath.$path)) create_folder($targetPath.$path,false);
282
+        $info=pathinfo($name);
283
+        if(!endsWith($targetPath,$path))
284
+        if(!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
285
+            $all_ok=false;
286
+    }
287 287
     }
288 288
 
289 289
     //create fixed thumbs
290 290
     if($fixed_image_creation){
291
-	foreach($fixed_path_from_filemanager as $k=>$path){
292
-	    if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
293
-	    $base_dir=$path.substr_replace($targetPath, '', 0, strlen($current_path));
294
-	    if (!file_exists($base_dir)) create_folder($base_dir,false);
295
-	    $info=pathinfo($name);
296
-	    if(!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k]))
297
-		$all_ok=false;
298
-	}
291
+    foreach($fixed_path_from_filemanager as $k=>$path){
292
+        if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
293
+        $base_dir=$path.substr_replace($targetPath, '', 0, strlen($current_path));
294
+        if (!file_exists($base_dir)) create_folder($base_dir,false);
295
+        $info=pathinfo($name);
296
+        if(!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k]))
297
+        $all_ok=false;
298
+    }
299 299
     }
300 300
     return $all_ok;
301 301
 }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 function debugger($input, $trace = false, $halt = fale){
457 457
     \Xmf\Debug::dump($input);
458 458
     if ($trace){
459
-         \Xmf\Debug::backtrace();
459
+            \Xmf\Debug::backtrace();
460 460
     }
461 461
     if ($halt){
462 462
         exit();
Please login to merge, or discard this patch.
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbiden');
3
+if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbiden');
4 4
 
5 5
 function deleteDir($dir) {
6 6
     if (!file_exists($dir)) return true;
@@ -12,75 +12,75 @@  discard block
 block discarded – undo
12 12
     return rmdir($dir);
13 13
 }
14 14
 
15
-function duplicate_file($old_path,$name){
16
-    if(file_exists($old_path)){
17
-	$info=pathinfo($old_path);
18
-	$new_path=$info['dirname']."/".$name.".".$info['extension'];
19
-	if(file_exists($new_path)) return false;
20
-	return copy($old_path,$new_path);
15
+function duplicate_file($old_path, $name) {
16
+    if (file_exists($old_path)) {
17
+	$info = pathinfo($old_path);
18
+	$new_path = $info['dirname']."/".$name.".".$info['extension'];
19
+	if (file_exists($new_path)) return false;
20
+	return copy($old_path, $new_path);
21 21
     }
22 22
 }
23 23
 
24
-function rename_file($old_path,$name,$transliteration){
25
-    $name=fix_filename($name,$transliteration);
26
-    if(file_exists($old_path)){
27
-	$info=pathinfo($old_path);
28
-	$new_path=$info['dirname']."/".$name.".".$info['extension'];
29
-	if(file_exists($new_path)) return false;
30
-	return rename($old_path,$new_path);
24
+function rename_file($old_path, $name, $transliteration) {
25
+    $name = fix_filename($name, $transliteration);
26
+    if (file_exists($old_path)) {
27
+	$info = pathinfo($old_path);
28
+	$new_path = $info['dirname']."/".$name.".".$info['extension'];
29
+	if (file_exists($new_path)) return false;
30
+	return rename($old_path, $new_path);
31 31
     }
32 32
 }
33 33
 
34
-function rename_folder($old_path,$name,$transliteration){
35
-    $name=fix_filename($name,$transliteration);
36
-    if(file_exists($old_path)){
37
-	$new_path=fix_dirname($old_path)."/".$name;
38
-	if(file_exists($new_path)) return false;
39
-	return rename($old_path,$new_path);
34
+function rename_folder($old_path, $name, $transliteration) {
35
+    $name = fix_filename($name, $transliteration);
36
+    if (file_exists($old_path)) {
37
+	$new_path = fix_dirname($old_path)."/".$name;
38
+	if (file_exists($new_path)) return false;
39
+	return rename($old_path, $new_path);
40 40
     }
41 41
 }
42 42
 
43
-function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="") {
44
-    if(image_check_memory_usage($imgfile,$newwidth,$newheight)){
43
+function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight = "") {
44
+    if (image_check_memory_usage($imgfile, $newwidth, $newheight)) {
45 45
 	require_once('php_image_magician.php');
46 46
 	$magicianObj = new imageLib($imgfile);
47 47
 	$magicianObj -> resizeImage($newwidth, $newheight, 'crop');
48
-	$magicianObj -> saveImage($imgthumb,80);
48
+	$magicianObj -> saveImage($imgthumb, 80);
49 49
 	return true;
50 50
     }
51 51
     return false;
52 52
 }
53 53
 
54
-function create_img($imgfile, $imgthumb, $newwidth, $newheight="") {
55
-    if(image_check_memory_usage($imgfile,$newwidth,$newheight)){
54
+function create_img($imgfile, $imgthumb, $newwidth, $newheight = "") {
55
+    if (image_check_memory_usage($imgfile, $newwidth, $newheight)) {
56 56
 	require_once('php_image_magician.php');
57 57
 	$magicianObj = new imageLib($imgfile);
58 58
 	$magicianObj -> resizeImage($newwidth, $newheight, 'auto');
59
-	$magicianObj -> saveImage($imgthumb,80);
59
+	$magicianObj -> saveImage($imgthumb, 80);
60 60
 	return true;
61
-    }else{
61
+    } else {
62 62
 	return false;
63 63
     }
64 64
 }
65 65
 
66 66
 function makeSize($size) {
67
-   $units = array('B','KB','MB','GB','TB');
67
+   $units = array('B', 'KB', 'MB', 'GB', 'TB');
68 68
    $u = 0;
69
-   while ( (round($size / 1024) > 0) && ($u < 4) ) {
69
+   while ((round($size / 1024) > 0) && ($u < 4)) {
70 70
      $size = $size / 1024;
71 71
      $u++;
72 72
    }
73
-   return (number_format($size, 0) . " " . $units[$u]);
73
+   return (number_format($size, 0)." ".$units[$u]);
74 74
 }
75 75
 
76 76
 function foldersize($path) {
77 77
     $total_size = 0;
78 78
     $files = scandir($path);
79
-    $cleanPath = rtrim($path, '/'). '/';
79
+    $cleanPath = rtrim($path, '/').'/';
80 80
 
81
-    foreach($files as $t) {
81
+    foreach ($files as $t) {
82 82
         if ($t !== "." && $t !== "..") {
83
-            $currentFile = $cleanPath . $t;
83
+            $currentFile = $cleanPath.$t;
84 84
             if (is_dir($currentFile)) {
85 85
                 $size = foldersize($currentFile);
86 86
                 $total_size += $size;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 function filescount($path) {
99 99
     $total_count = 0;
100 100
     $files = scandir($path);
101
-    $cleanPath = rtrim($path, '/'). '/';
101
+    $cleanPath = rtrim($path, '/').'/';
102 102
 
103
-    foreach($files as $t) {
103
+    foreach ($files as $t) {
104 104
         if ($t !== "." && $t !== "..") {
105
-            $currentFile = $cleanPath . $t;
105
+            $currentFile = $cleanPath.$t;
106 106
             if (is_dir($currentFile)) {
107 107
                 $size = filescount($currentFile);
108 108
                 $total_count += $size;
@@ -116,108 +116,108 @@  discard block
 block discarded – undo
116 116
     return $total_count;
117 117
 }
118 118
 
119
-function create_folder($path=false,$path_thumbs=false){
119
+function create_folder($path = false, $path_thumbs = false) {
120 120
     $oldumask = umask(0);
121 121
     if ($path && !file_exists($path))
122 122
         mkdir($path, 0777, true); // or even 01777 so you get the sticky bit set
123
-    if($path_thumbs && !file_exists($path_thumbs))
123
+    if ($path_thumbs && !file_exists($path_thumbs))
124 124
         mkdir($path_thumbs, 0777, true) or die("$path_thumbs cannot be found"); // or even 01777 so you get the sticky bit set
125 125
     umask($oldumask);
126 126
 }
127 127
 
128
-function check_files_extensions_on_path($path,$ext){
129
-    if(!is_dir($path)){
128
+function check_files_extensions_on_path($path, $ext) {
129
+    if (!is_dir($path)) {
130 130
 	$fileinfo = pathinfo($path);
131
-	if(!in_array(mb_strtolower($fileinfo['extension']),$ext))
131
+	if (!in_array(mb_strtolower($fileinfo['extension']), $ext))
132 132
 	    unlink($path);
133
-    }else{
133
+    } else {
134 134
 	$files = scandir($path);
135
-	foreach($files as $file){
136
-	    check_files_extensions_on_path(trim($path,'/')."/".$file,$ext);
135
+	foreach ($files as $file) {
136
+	    check_files_extensions_on_path(trim($path, '/')."/".$file, $ext);
137 137
 	}
138 138
     }
139 139
 }
140 140
 
141
-function check_files_extensions_on_phar( $phar, &$files, $basepath, $ext ) {
142
-    foreach( $phar as $file )
141
+function check_files_extensions_on_phar($phar, &$files, $basepath, $ext) {
142
+    foreach ($phar as $file)
143 143
     {
144
-        if( $file->isFile() )
144
+        if ($file->isFile())
145 145
         {
146
-            if(in_array(mb_strtolower($file->getExtension()),$ext))
146
+            if (in_array(mb_strtolower($file->getExtension()), $ext))
147 147
             {
148 148
                 $files[] = $basepath.$file->getFileName( );
149 149
             }
150 150
         }
151
-        else if( $file->isDir() )
151
+        else if ($file->isDir())
152 152
         {
153
-            $iterator = new DirectoryIterator( $file );
153
+            $iterator = new DirectoryIterator($file);
154 154
             check_files_extensions_on_phar($iterator, $files, $basepath.$file->getFileName().'/', $ext);
155 155
         }
156 156
     }
157 157
 }
158 158
 
159
-function fix_get_params($str){
160
-    return strip_tags(preg_replace( "/[^a-zA-Z0-9\.\[\]_| -]/", '', $str));
159
+function fix_get_params($str) {
160
+    return strip_tags(preg_replace("/[^a-zA-Z0-9\.\[\]_| -]/", '', $str));
161 161
 }
162 162
 
163
-function fix_filename($str,$transliteration){
164
-    if($transliteration){
165
-    	if( function_exists( 'transliterator_transliterate' ) )
163
+function fix_filename($str, $transliteration) {
164
+    if ($transliteration) {
165
+    	if (function_exists('transliterator_transliterate'))
166 166
     	{
167
-    	   $str = transliterator_transliterate( 'Accents-Any', $str );
167
+    	   $str = transliterator_transliterate('Accents-Any', $str);
168 168
     	}
169 169
     	else
170 170
     	{
171 171
     	   $str = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
172 172
     	}
173 173
 
174
-	$str = preg_replace( "/[^a-zA-Z0-9\.\[\]_| -]/", '', $str );
174
+	$str = preg_replace("/[^a-zA-Z0-9\.\[\]_| -]/", '', $str);
175 175
     }
176 176
 
177
-    $str=str_replace(array('"',"'","/","\\"),"",$str);
178
-    $str=strip_tags($str);
177
+    $str = str_replace(array('"', "'", "/", "\\"), "", $str);
178
+    $str = strip_tags($str);
179 179
 
180 180
     // Empty or incorrectly transliterated filename.
181 181
     // Here is a point: a good file UNKNOWN_LANGUAGE.jpg could become .jpg in previous code.
182 182
     // So we add that default 'file' name to fix that issue.
183
-    if( strpos( $str, '.' ) === 0 )
183
+    if (strpos($str, '.') === 0)
184 184
     {
185 185
        $str = 'file'.$str;
186 186
     }
187 187
 
188
-    return trim( $str );
188
+    return trim($str);
189 189
 }
190 190
 
191
-function fix_dirname($str){
192
-    return str_replace('~',' ',dirname(str_replace(' ','~',$str)));
191
+function fix_dirname($str) {
192
+    return str_replace('~', ' ', dirname(str_replace(' ', '~', $str)));
193 193
 }
194 194
 
195
-function fix_strtoupper($str){
196
-    if( function_exists( 'mb_strtoupper' ) )
195
+function fix_strtoupper($str) {
196
+    if (function_exists('mb_strtoupper'))
197 197
 	return mb_strtoupper($str);
198 198
     else
199 199
 	return strtoupper($str);
200 200
 }
201 201
 
202 202
 
203
-function fix_strtolower($str){
204
-    if( function_exists( 'mb_strtoupper' ) )
203
+function fix_strtolower($str) {
204
+    if (function_exists('mb_strtoupper'))
205 205
 	return mb_strtolower($str);
206 206
     else
207 207
 	return strtolower($str);
208 208
 }
209 209
 
210
-function fix_path($path,$transliteration){
211
-    $info=pathinfo($path);
210
+function fix_path($path, $transliteration) {
211
+    $info = pathinfo($path);
212 212
     $tmp_path = $info['dirname'];
213
-	$str=fix_filename($info['filename'],$transliteration);
214
-    if($tmp_path!="")
213
+	$str = fix_filename($info['filename'], $transliteration);
214
+    if ($tmp_path != "")
215 215
 		return $tmp_path.DIRECTORY_SEPARATOR.$str;
216 216
     else
217 217
 		return $str;
218 218
 }
219 219
 
220
-function base_url(){
220
+function base_url() {
221 221
   return sprintf(
222 222
     "%s://%s",
223 223
     isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http',
@@ -225,44 +225,44 @@  discard block
 block discarded – undo
225 225
   );
226 226
 }
227 227
 
228
-function config_loading($current_path,$fld){
229
-    if(file_exists($current_path.$fld.".config")){
228
+function config_loading($current_path, $fld) {
229
+    if (file_exists($current_path.$fld.".config")) {
230 230
 	require_once($current_path.$fld.".config");
231 231
 	return true;
232 232
     }
233
-    echo "!!!!".$parent=fix_dirname($fld);
234
-    if($parent!=="." && !empty($parent)){
235
-	config_loading($current_path,$parent);
233
+    echo "!!!!".$parent = fix_dirname($fld);
234
+    if ($parent !== "." && !empty($parent)) {
235
+	config_loading($current_path, $parent);
236 236
     }
237 237
 
238 238
     return false;
239 239
 }
240 240
 
241 241
 
242
-function image_check_memory_usage($img, $max_breedte, $max_hoogte){
243
-    if(file_exists($img)){
244
-	$K64 = 65536;    // number of bytes in 64K
242
+function image_check_memory_usage($img, $max_breedte, $max_hoogte) {
243
+    if (file_exists($img)) {
244
+	$K64 = 65536; // number of bytes in 64K
245 245
 	$memory_usage = memory_get_usage();
246
-	$memory_limit = abs((int)(str_replace('M','',ini_get('memory_limit'))*1024*1024));
246
+	$memory_limit = abs((int)(str_replace('M', '', ini_get('memory_limit')) * 1024 * 1024));
247 247
 	$image_properties = getimagesize($img);
248 248
 	$image_width = $image_properties[0];
249 249
 	$image_height = $image_properties[1];
250 250
 	$image_bits = $image_properties['bits'];
251
-	$image_memory_usage = $K64 + ($image_width * $image_height * ($image_bits )  * 2);
252
-	$thumb_memory_usage = $K64 + ($max_breedte * $max_hoogte * ($image_bits ) * 2);
251
+	$image_memory_usage = $K64 + ($image_width * $image_height * ($image_bits) * 2);
252
+	$thumb_memory_usage = $K64 + ($max_breedte * $max_hoogte * ($image_bits) * 2);
253 253
 	$memory_needed = (int)($memory_usage + $image_memory_usage + $thumb_memory_usage);
254 254
 
255
-        if($memory_needed > $memory_limit){
256
-                ini_set('memory_limit',((int)($memory_needed/1024/1024)+5) . 'M');
257
-                if(ini_get('memory_limit') == ((int)($memory_needed/1024/1024)+5) . 'M'){
255
+        if ($memory_needed > $memory_limit) {
256
+                ini_set('memory_limit', ((int)($memory_needed / 1024 / 1024) + 5).'M');
257
+                if (ini_get('memory_limit') == ((int)($memory_needed / 1024 / 1024) + 5).'M') {
258 258
                 return true;
259
-            }else{
259
+            } else {
260 260
                 return false;
261 261
             }
262
-        }else{
262
+        } else {
263 263
             return true;
264 264
         }
265
-	    }else{
265
+	    } else {
266 266
 	    return false;
267 267
     }
268 268
 }
@@ -272,29 +272,29 @@  discard block
 block discarded – undo
272 272
     return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
273 273
 }
274 274
 
275
-function new_thumbnails_creation($targetPath,$targetFile,$name,$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height){
275
+function new_thumbnails_creation($targetPath, $targetFile, $name, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height) {
276 276
     //create relative thumbs
277
-    $all_ok=true;
278
-    if($relative_image_creation){
279
-	foreach($relative_path_from_current_pos as $k=>$path){
280
-	    if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
281
-	    if (!file_exists($targetPath.$path)) create_folder($targetPath.$path,false);
282
-	    $info=pathinfo($name);
283
-	    if(!endsWith($targetPath,$path))
284
-		if(!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
285
-		    $all_ok=false;
277
+    $all_ok = true;
278
+    if ($relative_image_creation) {
279
+	foreach ($relative_path_from_current_pos as $k=>$path) {
280
+	    if ($path != "" && $path[strlen($path) - 1] != "/") $path .= "/";
281
+	    if (!file_exists($targetPath.$path)) create_folder($targetPath.$path, false);
282
+	    $info = pathinfo($name);
283
+	    if (!endsWith($targetPath, $path))
284
+		if (!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
285
+		    $all_ok = false;
286 286
 	}
287 287
     }
288 288
 
289 289
     //create fixed thumbs
290
-    if($fixed_image_creation){
291
-	foreach($fixed_path_from_filemanager as $k=>$path){
292
-	    if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
293
-	    $base_dir=$path.substr_replace($targetPath, '', 0, strlen($current_path));
294
-	    if (!file_exists($base_dir)) create_folder($base_dir,false);
295
-	    $info=pathinfo($name);
296
-	    if(!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k]))
297
-		$all_ok=false;
290
+    if ($fixed_image_creation) {
291
+	foreach ($fixed_path_from_filemanager as $k=>$path) {
292
+	    if ($path != "" && $path[strlen($path) - 1] != "/") $path .= "/";
293
+	    $base_dir = $path.substr_replace($targetPath, '', 0, strlen($current_path));
294
+	    if (!file_exists($base_dir)) create_folder($base_dir, false);
295
+	    $info = pathinfo($name);
296
+	    if (!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k]))
297
+		$all_ok = false;
298 298
 	}
299 299
     }
300 300
     return $all_ok;
@@ -323,18 +323,18 @@  discard block
 block discarded – undo
323 323
 }
324 324
 
325 325
 // test for dir/file writability properly
326
-function is_really_writable($dir){
326
+function is_really_writable($dir) {
327 327
     $dir = rtrim($dir, '/');
328 328
     // linux, safe off
329
-    if (DIRECTORY_SEPARATOR === '/' && @ini_get("safe_mode") == FALSE){
329
+    if (DIRECTORY_SEPARATOR === '/' && @ini_get("safe_mode") == FALSE) {
330 330
         return is_writable($dir);
331 331
     }
332 332
 
333 333
     // Windows, safe ON. (have to write a file :S)
334
-    if (is_dir($dir)){
335
-        $dir = $dir.'/'.md5(mt_rand(1,1000).mt_rand(1,1000));
334
+    if (is_dir($dir)) {
335
+        $dir = $dir.'/'.md5(mt_rand(1, 1000).mt_rand(1, 1000));
336 336
 
337
-        if (($fp = @fopen($dir, 'ab')) === FALSE){
337
+        if (($fp = @fopen($dir, 'ab')) === FALSE) {
338 338
             return FALSE;
339 339
         }
340 340
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         @unlink($dir);
344 344
         return TRUE;
345 345
     }
346
-    elseif ( ! is_file($dir) || ($fp = @fopen($dir, 'ab')) === FALSE){
346
+    elseif (!is_file($dir) || ($fp = @fopen($dir, 'ab')) === FALSE) {
347 347
         return FALSE;
348 348
     }
349 349
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
  * Returns TRUE if callable and everything is OK
359 359
  * Otherwise returns FALSE
360 360
  */
361
-function is_function_callable($name){
361
+function is_function_callable($name) {
362 362
     if (function_exists($name) === FALSE) return FALSE;
363 363
     $disabled = explode(',', ini_get('disable_functions'));
364 364
     return !in_array($name, $disabled);
@@ -367,24 +367,24 @@  discard block
 block discarded – undo
367 367
 // recursivly copies everything
368 368
 function rcopy($source, $destination, $is_rec = FALSE) {
369 369
     if (is_dir($source)) {
370
-        if ($is_rec === FALSE){
370
+        if ($is_rec === FALSE) {
371 371
             $pinfo = pathinfo($source);
372 372
             $destination = rtrim($destination, '/').DIRECTORY_SEPARATOR.$pinfo['basename'];
373 373
         }
374
-        if (is_dir($destination) === FALSE){
374
+        if (is_dir($destination) === FALSE) {
375 375
             mkdir($destination, 0777, true);
376 376
         }
377 377
 
378 378
         $files = scandir($source);
379
-        foreach ($files as $file){
379
+        foreach ($files as $file) {
380 380
             if ($file !== "." && $file !== "..") {
381 381
                 rcopy($source.DIRECTORY_SEPARATOR.$file, rtrim($destination, '/').DIRECTORY_SEPARATOR.$file, TRUE);
382 382
             }
383 383
         }
384 384
     }
385 385
     else {
386
-        if (file_exists($source)){
387
-            if (is_dir($destination) === TRUE){
386
+        if (file_exists($source)) {
387
+            if (is_dir($destination) === TRUE) {
388 388
                 $pinfo = pathinfo($source);
389 389
                 $dest2 = rtrim($destination, '/').DIRECTORY_SEPARATOR.$pinfo['basename'];
390 390
             }
@@ -403,24 +403,24 @@  discard block
 block discarded – undo
403 403
 // Need more feedback from users and refactor if needed
404 404
 function rrename($source, $destination, $is_rec = FALSE) {
405 405
     if (is_dir($source)) {
406
-        if ($is_rec === FALSE){
406
+        if ($is_rec === FALSE) {
407 407
             $pinfo = pathinfo($source);
408 408
             $destination = rtrim($destination, '/').DIRECTORY_SEPARATOR.$pinfo['basename'];
409 409
         }
410
-        if (is_dir($destination) === FALSE){
410
+        if (is_dir($destination) === FALSE) {
411 411
             mkdir($destination, 0777, true);
412 412
         }
413 413
 
414 414
         $files = scandir($source);
415
-        foreach ($files as $file){
415
+        foreach ($files as $file) {
416 416
             if ($file !== "." && $file !== "..") {
417 417
                 rrename($source.DIRECTORY_SEPARATOR.$file, rtrim($destination, '/').DIRECTORY_SEPARATOR.$file, TRUE);
418 418
             }
419 419
         }
420 420
     }
421 421
     else {
422
-        if (file_exists($source)){
423
-            if (is_dir($destination) === TRUE){
422
+        if (file_exists($source)) {
423
+            if (is_dir($destination) === TRUE) {
424 424
                 $pinfo = pathinfo($source);
425 425
                 $dest2 = rtrim($destination, '/').DIRECTORY_SEPARATOR.$pinfo['basename'];
426 426
             }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 
442 442
     foreach ($files as $file) {
443 443
         if ($file !== "." && $file !== "..") {
444
-            if (is_dir($source.DIRECTORY_SEPARATOR.$file)){
444
+            if (is_dir($source.DIRECTORY_SEPARATOR.$file)) {
445 445
                 rrename_after_cleaner($source.DIRECTORY_SEPARATOR.$file);
446 446
             }
447 447
             else {
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
     return rmdir($source);
454 454
 }
455 455
 
456
-function debugger($input, $trace = false, $halt = fale){
456
+function debugger($input, $trace = false, $halt = fale) {
457 457
     \Xmf\Debug::dump($input);
458
-    if ($trace){
458
+    if ($trace) {
459 459
          \Xmf\Debug::backtrace();
460 460
     }
461
-    if ($halt){
461
+    if ($halt) {
462 462
         exit();
463 463
     }
464 464
 }
Please login to merge, or discard this patch.
Braces   +89 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1,13 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbiden');
3
+if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") {
4
+    die('forbiden');
5
+}
4 6
 
5 7
 function deleteDir($dir) {
6
-    if (!file_exists($dir)) return true;
7
-    if (!is_dir($dir)) return unlink($dir);
8
+    if (!file_exists($dir)) {
9
+        return true;
10
+    }
11
+    if (!is_dir($dir)) {
12
+        return unlink($dir);
13
+    }
8 14
     foreach (scandir($dir) as $item) {
9
-        if ($item === '.' || $item === '..') continue;
10
-        if (!deleteDir($dir.DIRECTORY_SEPARATOR.$item)) return false;
15
+        if ($item === '.' || $item === '..') {
16
+            continue;
17
+        }
18
+        if (!deleteDir($dir.DIRECTORY_SEPARATOR.$item)) {
19
+            return false;
20
+        }
11 21
     }
12 22
     return rmdir($dir);
13 23
 }
@@ -16,7 +26,9 @@  discard block
 block discarded – undo
16 26
     if(file_exists($old_path)){
17 27
 	$info=pathinfo($old_path);
18 28
 	$new_path=$info['dirname']."/".$name.".".$info['extension'];
19
-	if(file_exists($new_path)) return false;
29
+	if(file_exists($new_path)) {
30
+	    return false;
31
+	}
20 32
 	return copy($old_path,$new_path);
21 33
     }
22 34
 }
@@ -26,7 +38,9 @@  discard block
 block discarded – undo
26 38
     if(file_exists($old_path)){
27 39
 	$info=pathinfo($old_path);
28 40
 	$new_path=$info['dirname']."/".$name.".".$info['extension'];
29
-	if(file_exists($new_path)) return false;
41
+	if(file_exists($new_path)) {
42
+	    return false;
43
+	}
30 44
 	return rename($old_path,$new_path);
31 45
     }
32 46
 }
@@ -35,7 +49,9 @@  discard block
 block discarded – undo
35 49
     $name=fix_filename($name,$transliteration);
36 50
     if(file_exists($old_path)){
37 51
 	$new_path=fix_dirname($old_path)."/".$name;
38
-	if(file_exists($new_path)) return false;
52
+	if(file_exists($new_path)) {
53
+	    return false;
54
+	}
39 55
 	return rename($old_path,$new_path);
40 56
     }
41 57
 }
@@ -58,7 +74,7 @@  discard block
 block discarded – undo
58 74
 	$magicianObj -> resizeImage($newwidth, $newheight, 'auto');
59 75
 	$magicianObj -> saveImage($imgthumb,80);
60 76
 	return true;
61
-    }else{
77
+    } else{
62 78
 	return false;
63 79
     }
64 80
 }
@@ -84,8 +100,7 @@  discard block
 block discarded – undo
84 100
             if (is_dir($currentFile)) {
85 101
                 $size = foldersize($currentFile);
86 102
                 $total_size += $size;
87
-            }
88
-            else {
103
+            } else {
89 104
                 $size = filesize($currentFile);
90 105
                 $total_size += $size;
91 106
             }
@@ -106,8 +121,7 @@  discard block
 block discarded – undo
106 121
             if (is_dir($currentFile)) {
107 122
                 $size = filescount($currentFile);
108 123
                 $total_count += $size;
109
-            }
110
-            else {
124
+            } else {
111 125
                 $total_count += 1;
112 126
             }
113 127
         }
@@ -118,19 +132,24 @@  discard block
 block discarded – undo
118 132
 
119 133
 function create_folder($path=false,$path_thumbs=false){
120 134
     $oldumask = umask(0);
121
-    if ($path && !file_exists($path))
122
-        mkdir($path, 0777, true); // or even 01777 so you get the sticky bit set
123
-    if($path_thumbs && !file_exists($path_thumbs))
124
-        mkdir($path_thumbs, 0777, true) or die("$path_thumbs cannot be found"); // or even 01777 so you get the sticky bit set
135
+    if ($path && !file_exists($path)) {
136
+            mkdir($path, 0777, true);
137
+    }
138
+    // or even 01777 so you get the sticky bit set
139
+    if($path_thumbs && !file_exists($path_thumbs)) {
140
+            mkdir($path_thumbs, 0777, true) or die("$path_thumbs cannot be found");
141
+    }
142
+    // or even 01777 so you get the sticky bit set
125 143
     umask($oldumask);
126 144
 }
127 145
 
128 146
 function check_files_extensions_on_path($path,$ext){
129 147
     if(!is_dir($path)){
130 148
 	$fileinfo = pathinfo($path);
131
-	if(!in_array(mb_strtolower($fileinfo['extension']),$ext))
132
-	    unlink($path);
133
-    }else{
149
+	if(!in_array(mb_strtolower($fileinfo['extension']),$ext)) {
150
+		    unlink($path);
151
+	}
152
+    } else{
134 153
 	$files = scandir($path);
135 154
 	foreach($files as $file){
136 155
 	    check_files_extensions_on_path(trim($path,'/')."/".$file,$ext);
@@ -147,8 +166,7 @@  discard block
 block discarded – undo
147 166
             {
148 167
                 $files[] = $basepath.$file->getFileName( );
149 168
             }
150
-        }
151
-        else if( $file->isDir() )
169
+        } else if( $file->isDir() )
152 170
         {
153 171
             $iterator = new DirectoryIterator( $file );
154 172
             check_files_extensions_on_phar($iterator, $files, $basepath.$file->getFileName().'/', $ext);
@@ -165,8 +183,7 @@  discard block
 block discarded – undo
165 183
     	if( function_exists( 'transliterator_transliterate' ) )
166 184
     	{
167 185
     	   $str = transliterator_transliterate( 'Accents-Any', $str );
168
-    	}
169
-    	else
186
+    	} else
170 187
     	{
171 188
     	   $str = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
172 189
     	}
@@ -193,29 +210,32 @@  discard block
 block discarded – undo
193 210
 }
194 211
 
195 212
 function fix_strtoupper($str){
196
-    if( function_exists( 'mb_strtoupper' ) )
197
-	return mb_strtoupper($str);
198
-    else
199
-	return strtoupper($str);
200
-}
213
+    if( function_exists( 'mb_strtoupper' ) ) {
214
+    	return mb_strtoupper($str);
215
+    } else {
216
+    	return strtoupper($str);
217
+    }
218
+    }
201 219
 
202 220
 
203 221
 function fix_strtolower($str){
204
-    if( function_exists( 'mb_strtoupper' ) )
205
-	return mb_strtolower($str);
206
-    else
207
-	return strtolower($str);
208
-}
222
+    if( function_exists( 'mb_strtoupper' ) ) {
223
+    	return mb_strtolower($str);
224
+    } else {
225
+    	return strtolower($str);
226
+    }
227
+    }
209 228
 
210 229
 function fix_path($path,$transliteration){
211 230
     $info=pathinfo($path);
212 231
     $tmp_path = $info['dirname'];
213 232
 	$str=fix_filename($info['filename'],$transliteration);
214
-    if($tmp_path!="")
215
-		return $tmp_path.DIRECTORY_SEPARATOR.$str;
216
-    else
217
-		return $str;
218
-}
233
+    if($tmp_path!="") {
234
+    		return $tmp_path.DIRECTORY_SEPARATOR.$str;
235
+    } else {
236
+    		return $str;
237
+    }
238
+    }
219 239
 
220 240
 function base_url(){
221 241
   return sprintf(
@@ -256,13 +276,13 @@  discard block
 block discarded – undo
256 276
                 ini_set('memory_limit',((int)($memory_needed/1024/1024)+5) . 'M');
257 277
                 if(ini_get('memory_limit') == ((int)($memory_needed/1024/1024)+5) . 'M'){
258 278
                 return true;
259
-            }else{
279
+            } else{
260 280
                 return false;
261 281
             }
262
-        }else{
282
+        } else{
263 283
             return true;
264 284
         }
265
-	    }else{
285
+	    } else{
266 286
 	    return false;
267 287
     }
268 288
 }
@@ -277,24 +297,34 @@  discard block
 block discarded – undo
277 297
     $all_ok=true;
278 298
     if($relative_image_creation){
279 299
 	foreach($relative_path_from_current_pos as $k=>$path){
280
-	    if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
281
-	    if (!file_exists($targetPath.$path)) create_folder($targetPath.$path,false);
300
+	    if($path!="" && $path[strlen($path)-1]!="/") {
301
+	        $path.="/";
302
+	    }
303
+	    if (!file_exists($targetPath.$path)) {
304
+	        create_folder($targetPath.$path,false);
305
+	    }
282 306
 	    $info=pathinfo($name);
283
-	    if(!endsWith($targetPath,$path))
284
-		if(!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
307
+	    if(!endsWith($targetPath,$path)) {
308
+	    		if(!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
285 309
 		    $all_ok=false;
310
+	    }
286 311
 	}
287 312
     }
288 313
 
289 314
     //create fixed thumbs
290 315
     if($fixed_image_creation){
291 316
 	foreach($fixed_path_from_filemanager as $k=>$path){
292
-	    if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
317
+	    if($path!="" && $path[strlen($path)-1]!="/") {
318
+	        $path.="/";
319
+	    }
293 320
 	    $base_dir=$path.substr_replace($targetPath, '', 0, strlen($current_path));
294
-	    if (!file_exists($base_dir)) create_folder($base_dir,false);
321
+	    if (!file_exists($base_dir)) {
322
+	        create_folder($base_dir,false);
323
+	    }
295 324
 	    $info=pathinfo($name);
296
-	    if(!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k]))
297
-		$all_ok=false;
325
+	    if(!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k])) {
326
+	    		$all_ok=false;
327
+	    }
298 328
 	}
299 329
     }
300 330
     return $all_ok;
@@ -342,8 +372,7 @@  discard block
 block discarded – undo
342 372
         @chmod($dir, 0777);
343 373
         @unlink($dir);
344 374
         return TRUE;
345
-    }
346
-    elseif ( ! is_file($dir) || ($fp = @fopen($dir, 'ab')) === FALSE){
375
+    } elseif ( ! is_file($dir) || ($fp = @fopen($dir, 'ab')) === FALSE){
347 376
         return FALSE;
348 377
     }
349 378
 
@@ -359,7 +388,9 @@  discard block
 block discarded – undo
359 388
  * Otherwise returns FALSE
360 389
  */
361 390
 function is_function_callable($name){
362
-    if (function_exists($name) === FALSE) return FALSE;
391
+    if (function_exists($name) === FALSE) {
392
+        return FALSE;
393
+    }
363 394
     $disabled = explode(',', ini_get('disable_functions'));
364 395
     return !in_array($name, $disabled);
365 396
 }
@@ -381,14 +412,12 @@  discard block
 block discarded – undo
381 412
                 rcopy($source.DIRECTORY_SEPARATOR.$file, rtrim($destination, '/').DIRECTORY_SEPARATOR.$file, TRUE);
382 413
             }
383 414
         }
384
-    }
385
-    else {
415
+    } else {
386 416
         if (file_exists($source)){
387 417
             if (is_dir($destination) === TRUE){
388 418
                 $pinfo = pathinfo($source);
389 419
                 $dest2 = rtrim($destination, '/').DIRECTORY_SEPARATOR.$pinfo['basename'];
390
-            }
391
-            else {
420
+            } else {
392 421
                 $dest2 = $destination;
393 422
             }
394 423
 
@@ -417,14 +446,12 @@  discard block
 block discarded – undo
417 446
                 rrename($source.DIRECTORY_SEPARATOR.$file, rtrim($destination, '/').DIRECTORY_SEPARATOR.$file, TRUE);
418 447
             }
419 448
         }
420
-    }
421
-    else {
449
+    } else {
422 450
         if (file_exists($source)){
423 451
             if (is_dir($destination) === TRUE){
424 452
                 $pinfo = pathinfo($source);
425 453
                 $dest2 = rtrim($destination, '/').DIRECTORY_SEPARATOR.$pinfo['basename'];
426
-            }
427
-            else {
454
+            } else {
428 455
                 $dest2 = $destination;
429 456
             }
430 457
 
@@ -443,8 +470,7 @@  discard block
 block discarded – undo
443 470
         if ($file !== "." && $file !== "..") {
444 471
             if (is_dir($source.DIRECTORY_SEPARATOR.$file)){
445 472
                 rrename_after_cleaner($source.DIRECTORY_SEPARATOR.$file);
446
-            }
447
-            else {
473
+            } else {
448 474
                 unlink($source.DIRECTORY_SEPARATOR.$file);
449 475
             }
450 476
         }
Please login to merge, or discard this patch.
htdocs/class/xoopseditor/tinymce4/external_plugins/filemanager/dialog.php 4 patches
Indentation   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
 if($subdir==""){
26 26
     if(!empty($_COOKIE['last_position'])
27
-	&& strpos($_COOKIE['last_position'],'.')===FALSE)
28
-	$subdir= trim($_COOKIE['last_position']);
27
+    && strpos($_COOKIE['last_position'],'.')===FALSE)
28
+    $subdir= trim($_COOKIE['last_position']);
29 29
 }
30 30
 
31 31
 if($subdir==="/"){
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 if(!file_exists($current_path . $rfm_subfolder.$subdir)){
48 48
     $subdir='';
49 49
     if(!file_exists($current_path . $rfm_subfolder.$subdir)){
50
-	$rfm_subfolder="";
50
+    $rfm_subfolder="";
51 51
     }
52 52
 }
53 53
     
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
     $i++;
71 71
     if($parent==="./") $parent="";
72 72
     if(file_exists($current_path.$parent."config.php")){
73
-	require_once($current_path.$parent."config.php");
74
-	$cycle=false;
73
+    require_once($current_path.$parent."config.php");
74
+    $cycle=false;
75 75
     }
76 76
     
77 77
     if($parent=="") $cycle=false;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $language_file = 'lang/' .$path_parts['basename']. '.php';
117 117
     }
118 118
     else {
119
-    	echo "<script>console.log('The ".$lang." language file is not readable! Falling back...');</script>";
119
+        echo "<script>console.log('The ".$lang." language file is not readable! Falling back...');</script>";
120 120
     }
121 121
 }
122 122
 
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
         <link href="css/style.css" rel="stylesheet" type="text/css" />
155 155
 	<link href="css/dropzone.min.css" type="text/css" rel="stylesheet" />
156 156
 	<?php
157
-	$sprite_lang_file = 'img/spritemap_'.$lang.'.png';
158
-	$sprite_lang_file2 = 'img/spritemap@2x_'.$lang.'.png';
157
+    $sprite_lang_file = 'img/spritemap_'.$lang.'.png';
158
+    $sprite_lang_file2 = 'img/spritemap@2x_'.$lang.'.png';
159 159
 	
160
-	if ( ! file_exists($sprite_lang_file) || ! file_exists($sprite_lang_file2)){
161
-		//fallback
162
-		$sprite_lang_file = 'img/spritemap_en_EN.png';
163
-		$sprite_lang_file2 = 'img/spritemap@2x_en_EN.png';
164
-		if ( ! file_exists($sprite_lang_file) || ! file_exists($sprite_lang_file2)){
165
-			// we are in deep ****
166
-			echo '<script>console.log("Error: Spritemap not found!");</script>';
167
-			// exit();
168
-		}
169
-	}
170
-	?>
160
+    if ( ! file_exists($sprite_lang_file) || ! file_exists($sprite_lang_file2)){
161
+        //fallback
162
+        $sprite_lang_file = 'img/spritemap_en_EN.png';
163
+        $sprite_lang_file2 = 'img/spritemap@2x_en_EN.png';
164
+        if ( ! file_exists($sprite_lang_file) || ! file_exists($sprite_lang_file2)){
165
+            // we are in deep ****
166
+            echo '<script>console.log("Error: Spritemap not found!");</script>';
167
+            // exit();
168
+        }
169
+    }
170
+    ?>
171 171
 	<style>
172 172
 		.dropzone .dz-default.dz-message,
173 173
 		.dropzone .dz-preview .dz-error-mark,
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	<script type="text/javascript" src="js/imagesloaded.pkgd.min.js"></script>
220 220
 	<script type="text/javascript" src="js/jquery.queryloader2.min.js"></script>
221 221
 	<?php
222
-	if($aviary_active){
223
-	if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { ?>
222
+    if($aviary_active){
223
+    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { ?>
224 224
 	    <script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
225 225
 	<?php }else{ ?>
226 226
 	    <script type="text/javascript" src="http://feather.aviary.com/js/feather.js "></script>
@@ -402,16 +402,16 @@  discard block
 block discarded – undo
402 402
     if($file===".") $current_folder=array('file'=>$file);
403 403
     elseif($file==="..") $prev_folder=array('file'=>$file);
404 404
     elseif(is_dir($current_path.$rfm_subfolder.$subdir.$file)){
405
-	$date=filemtime($current_path.$rfm_subfolder.$subdir. $file);
406
-	$size=foldersize($current_path.$rfm_subfolder.$subdir. $file);
407
-	$file_ext=lang_Type_dir;
408
-	$sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
405
+    $date=filemtime($current_path.$rfm_subfolder.$subdir. $file);
406
+    $size=foldersize($current_path.$rfm_subfolder.$subdir. $file);
407
+    $file_ext=lang_Type_dir;
408
+    $sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
409 409
     }else{
410
-	$file_path=$current_path.$rfm_subfolder.$subdir.$file;
411
-	$date=filemtime($file_path);
412
-	$size=filesize($file_path);
413
-	$file_ext = substr(strrchr($file,'.'),1);
414
-	$sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
410
+    $file_path=$current_path.$rfm_subfolder.$subdir.$file;
411
+    $date=filemtime($file_path);
412
+    $size=filesize($file_path);
413
+    $file_ext = substr(strrchr($file,'.'),1);
414
+    $sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
415 415
     }
416 416
 }
417 417
 
@@ -430,19 +430,19 @@  discard block
 block discarded – undo
430 430
 
431 431
 switch($sort_by){
432 432
     case 'name':
433
-	usort($sorted, 'filenameSort');
434
-	break;
433
+    usort($sorted, 'filenameSort');
434
+    break;
435 435
     case 'date':
436
-	usort($sorted, 'dateSort');
437
-	break;
436
+    usort($sorted, 'dateSort');
437
+    break;
438 438
     case 'size':
439
-	usort($sorted, 'sizeSort');
440
-	break;
439
+    usort($sorted, 'sizeSort');
440
+    break;
441 441
     case 'extension':
442
-	usort($sorted, 'extensionSort');
443
-	break;
442
+    usort($sorted, 'extensionSort');
443
+    break;
444 444
     default:
445
-	break;
445
+    break;
446 446
     
447 447
 }
448 448
 
@@ -517,24 +517,24 @@  discard block
 block discarded – undo
517 517
     
518 518
     <div class="row-fluid">
519 519
 	<?php	
520
-	$link="dialog.php?".$get_params;
521
-	?>
520
+    $link="dialog.php?".$get_params;
521
+    ?>
522 522
 	<ul class="breadcrumb">	
523 523
 	<li class="pull-left"><a href="<?php echo $link?>/"><i class="icon-home"></i></a></li>
524 524
 	<li><span class="divider">/</span></li>
525 525
 	<?php
526
-	$bc=explode("/",$subdir);
527
-	$tmp_path='';
528
-	if(!empty($bc))
529
-	foreach($bc as $k=>$b){ 
530
-		$tmp_path.=$b."/";
531
-		if($k==count($bc)-2){
532
-	?> <li class="active"><?php echo $b?></li><?php
533
-		}elseif($b!=""){ ?>
526
+    $bc=explode("/",$subdir);
527
+    $tmp_path='';
528
+    if(!empty($bc))
529
+    foreach($bc as $k=>$b){ 
530
+        $tmp_path.=$b."/";
531
+        if($k==count($bc)-2){
532
+    ?> <li class="active"><?php echo $b?></li><?php
533
+        }elseif($b!=""){ ?>
534 534
 		<li><a href="<?php echo $link.$tmp_path?>"><?php echo $b?></a></li><li><span class="divider"><?php echo "/"; ?></span></li>
535 535
 	<?php }
536
-	}
537
-	?>
536
+    }
537
+    ?>
538 538
 	<li class="pull-right"><a class="btn-small" href="javascript:void('')" id="info"><i class="icon-question-sign"></i></a></li>
539 539
 	<li class="pull-right"><a id="refresh" class="btn-small" href="dialog.php?<?php echo $get_params.$subdir."&".uniqid() ?>"><i class="icon-refresh"></i></a></li>
540 540
 	
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 	    <ul class="grid cs-style-2 <?php echo "list-view".$view; ?>" id="main-item-container">
584 584
 		<?php
585 585
 		
586
-		$jplayer_ext=array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav");
587
-		foreach ($files as $file_array) {
588
-		    $file=$file_array['file'];
589
-			if($file === '.' || (isset($file_array['extension']) && $file_array['extension']!=lang_Type_dir) || ($file === '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter!='' && $file!==".." && strpos($file,$filter)===false))
590
-			    continue;
591
-			$new_name=fix_filename($file,$transliteration);
592
-			if($file!=='..' && $file!=$new_name){
593
-			    //rename
594
-			    rename_folder($current_path.$subdir.$new_name,$new_name,$transliteration);
595
-			    $file=$new_name;
596
-			}
597
-			//add in thumbs folder if not exist 
598
-			if (!file_exists($thumbs_path.$subdir.$file)) create_folder(false,$thumbs_path.$subdir.$file);
599
-			$class_ext = 3;			
600
-			if($file==='..' && trim($subdir) != '' ){
601
-			    $src = explode("/",$subdir);
602
-			    unset($src[count($src)-2]);
603
-			    $src=implode("/",$src);
604
-			    if($src==='') $src="/";
605
-			}
606
-			elseif ($file!=='..') {
607
-			    $src = $subdir . $file."/";
608
-			}
586
+        $jplayer_ext=array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav");
587
+        foreach ($files as $file_array) {
588
+            $file=$file_array['file'];
589
+            if($file === '.' || (isset($file_array['extension']) && $file_array['extension']!=lang_Type_dir) || ($file === '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter!='' && $file!==".." && strpos($file,$filter)===false))
590
+                continue;
591
+            $new_name=fix_filename($file,$transliteration);
592
+            if($file!=='..' && $file!=$new_name){
593
+                //rename
594
+                rename_folder($current_path.$subdir.$new_name,$new_name,$transliteration);
595
+                $file=$new_name;
596
+            }
597
+            //add in thumbs folder if not exist 
598
+            if (!file_exists($thumbs_path.$subdir.$file)) create_folder(false,$thumbs_path.$subdir.$file);
599
+            $class_ext = 3;			
600
+            if($file==='..' && trim($subdir) != '' ){
601
+                $src = explode("/",$subdir);
602
+                unset($src[count($src)-2]);
603
+                $src=implode("/",$src);
604
+                if($src==='') $src="/";
605
+            }
606
+            elseif ($file!=='..') {
607
+                $src = $subdir . $file."/";
608
+            }
609 609
 			
610
-			?>
610
+            ?>
611 611
 			    <li data-name="<?php echo $file ?>" <?php if($file==='..') echo 'class="back"'; else echo 'class="dir"'; ?>><?php
612
-			    $file_prevent_rename = false;
613
-			    $file_prevent_delete = false;
614
-			    if (isset($filePermissions[$file])) {
615
-				$file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
616
-				$file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
617
-			    }
618
-			    ?>	<figure data-name="<?php echo $file ?>" class="<?php if($file==="..") echo "back-"; ?>directory" data-type="<?php if($file!==".."){ echo "dir"; } ?>">
612
+                $file_prevent_rename = false;
613
+                $file_prevent_delete = false;
614
+                if (isset($filePermissions[$file])) {
615
+                $file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
616
+                $file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
617
+                }
618
+                ?>	<figure data-name="<?php echo $file ?>" class="<?php if($file==="..") echo "back-"; ?>directory" data-type="<?php if($file!==".."){ echo "dir"; } ?>">
619 619
 				    <a class="folder-link" href="dialog.php?<?php echo $get_params.rawurlencode($src)."&".uniqid() ?>">
620 620
 				    <div class="img-precontainer">
621 621
 					<div class="img-container directory"><span></span>
@@ -657,116 +657,116 @@  discard block
 block discarded – undo
657 657
 			    </figure>
658 658
 			</li>
659 659
 			<?php
660
-		    }
660
+            }
661 661
 			
662 662
             $files_prevent_duplicate = array();
663
-		    foreach ($files as $nu=>$file_array) {		
664
-			$file=$file_array['file'];
663
+            foreach ($files as $nu=>$file_array) {		
664
+            $file=$file_array['file'];
665 665
 		    
666
-			    if($file === '.' || $file === '..' || is_dir($current_path.$rfm_subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter!='' && strpos($file,$filter)===false))
667
-				    continue;
666
+                if($file === '.' || $file === '..' || is_dir($current_path.$rfm_subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter!='' && strpos($file,$filter)===false))
667
+                    continue;
668 668
 			    
669
-			    $file_path=$current_path.$rfm_subfolder.$subdir.$file;
670
-			    //check if file have illegal caracter
669
+                $file_path=$current_path.$rfm_subfolder.$subdir.$file;
670
+                //check if file have illegal caracter
671 671
 			    
672
-			    $filename=substr($file, 0, '-' . (strlen($file_array['extension']) + 1));
672
+                $filename=substr($file, 0, '-' . (strlen($file_array['extension']) + 1));
673 673
 			    
674
-			    if($file!=fix_filename($file,$transliteration)){
675
-				$file1=fix_filename($file,$transliteration);
676
-				$file_path1=($current_path.$rfm_subfolder.$subdir.$file1);
677
-				if(file_exists($file_path1)){
678
-				    $i = 1;
679
-				    $info=pathinfo($file1);
680
-				    while(file_exists($current_path.$rfm_subfolder.$subdir.$info['filename'].".[".$i."].".$info['extension'])) {
681
-					    $i++;
682
-				    }
683
-				    $file1=$info['filename'].".[".$i."].".$info['extension'];
684
-				    $file_path1=($current_path.$rfm_subfolder.$subdir.$file1);
685
-				}
674
+                if($file!=fix_filename($file,$transliteration)){
675
+                $file1=fix_filename($file,$transliteration);
676
+                $file_path1=($current_path.$rfm_subfolder.$subdir.$file1);
677
+                if(file_exists($file_path1)){
678
+                    $i = 1;
679
+                    $info=pathinfo($file1);
680
+                    while(file_exists($current_path.$rfm_subfolder.$subdir.$info['filename'].".[".$i."].".$info['extension'])) {
681
+                        $i++;
682
+                    }
683
+                    $file1=$info['filename'].".[".$i."].".$info['extension'];
684
+                    $file_path1=($current_path.$rfm_subfolder.$subdir.$file1);
685
+                }
686 686
 				
687
-				$filename=substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
688
-				rename_file($file_path,fix_filename($filename,$transliteration),$transliteration);
689
-				$file=$file1;
690
-				$file_array['extension']=fix_filename($file_array['extension'],$transliteration);
691
-				$file_path=$file_path1;
692
-			    }
687
+                $filename=substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
688
+                rename_file($file_path,fix_filename($filename,$transliteration),$transliteration);
689
+                $file=$file1;
690
+                $file_array['extension']=fix_filename($file_array['extension'],$transliteration);
691
+                $file_path=$file_path1;
692
+                }
693 693
 			    
694
-			    $is_img=false;
695
-			    $is_video=false;
696
-			    $is_audio=false;
697
-			    $show_original=false;
698
-			    $show_original_mini=false;
699
-			    $mini_src="";
700
-			    $src_thumb="";
701
-			    $extension_lower=fix_strtolower($file_array['extension']);
702
-			    if(in_array($extension_lower, $ext_img)){
703
-				$src = $base_url . $cur_dir . rawurlencode($file);
704
-				$mini_src = $src_thumb = $thumbs_path.$subdir. $file;
705
-				//add in thumbs folder if not exist
706
-				if(!file_exists($src_thumb)){
707
-				    try {
708
-					create_img_gd($file_path, $src_thumb, 122, 91);
709
-					new_thumbnails_creation($current_path.$rfm_subfolder.$subdir,$file_path,$file,$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height);
710
-				    } catch (Exception $e) {
711
-					$src_thumb=$mini_src="";
712
-				    }
713
-				}
714
-				$is_img=true;
715
-				//check if is smaller than thumb
716
-				list($img_width, $img_height, $img_type, $attr)=getimagesize($file_path);
717
-				if($img_width<122 && $img_height<91){ 
718
-					$src_thumb=$current_path.$rfm_subfolder.$subdir.$file;
719
-					$show_original=true;
720
-				}
694
+                $is_img=false;
695
+                $is_video=false;
696
+                $is_audio=false;
697
+                $show_original=false;
698
+                $show_original_mini=false;
699
+                $mini_src="";
700
+                $src_thumb="";
701
+                $extension_lower=fix_strtolower($file_array['extension']);
702
+                if(in_array($extension_lower, $ext_img)){
703
+                $src = $base_url . $cur_dir . rawurlencode($file);
704
+                $mini_src = $src_thumb = $thumbs_path.$subdir. $file;
705
+                //add in thumbs folder if not exist
706
+                if(!file_exists($src_thumb)){
707
+                    try {
708
+                    create_img_gd($file_path, $src_thumb, 122, 91);
709
+                    new_thumbnails_creation($current_path.$rfm_subfolder.$subdir,$file_path,$file,$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height);
710
+                    } catch (Exception $e) {
711
+                    $src_thumb=$mini_src="";
712
+                    }
713
+                }
714
+                $is_img=true;
715
+                //check if is smaller than thumb
716
+                list($img_width, $img_height, $img_type, $attr)=getimagesize($file_path);
717
+                if($img_width<122 && $img_height<91){ 
718
+                    $src_thumb=$current_path.$rfm_subfolder.$subdir.$file;
719
+                    $show_original=true;
720
+                }
721 721
 				
722
-				if($img_width<45 && $img_height<38){
723
-				    $mini_src=$current_path.$rfm_subfolder.$subdir.$file;
724
-				    $show_original_mini=true;
725
-				}
726
-			    }
722
+                if($img_width<45 && $img_height<38){
723
+                    $mini_src=$current_path.$rfm_subfolder.$subdir.$file;
724
+                    $show_original_mini=true;
725
+                }
726
+                }
727 727
 			    
728
-			    $is_icon_thumb=false;
729
-			    $is_icon_thumb_mini=false;
730
-			    $no_thumb=false;
731
-			    if($src_thumb==""){
732
-				$no_thumb=true;
733
-				if(file_exists('img/'.$icon_theme.'/'.$extension_lower.".jpg")){
734
-					$src_thumb ='img/'.$icon_theme.'/'.$extension_lower.".jpg";
735
-				}else{
736
-					$src_thumb = "img/".$icon_theme."/default.jpg";
737
-				}
738
-				$is_icon_thumb=true;
739
-			    }
740
-			    if($mini_src==""){
741
-				$is_icon_thumb_mini=false;
742
-			    }
728
+                $is_icon_thumb=false;
729
+                $is_icon_thumb_mini=false;
730
+                $no_thumb=false;
731
+                if($src_thumb==""){
732
+                $no_thumb=true;
733
+                if(file_exists('img/'.$icon_theme.'/'.$extension_lower.".jpg")){
734
+                    $src_thumb ='img/'.$icon_theme.'/'.$extension_lower.".jpg";
735
+                }else{
736
+                    $src_thumb = "img/".$icon_theme."/default.jpg";
737
+                }
738
+                $is_icon_thumb=true;
739
+                }
740
+                if($mini_src==""){
741
+                $is_icon_thumb_mini=false;
742
+                }
743 743
 			    
744
-			    $class_ext=0;
745
-			    if (in_array($extension_lower, $ext_video)) {
746
-				    $class_ext = 4;
747
-				    $is_video=true;
748
-			    }elseif (in_array($extension_lower, $ext_img)) {
749
-				    $class_ext = 2;
750
-			    }elseif (in_array($extension_lower, $ext_music)) {
751
-				    $class_ext = 5;
752
-				    $is_audio=true;
753
-			    }elseif (in_array($extension_lower, $ext_misc)) {
754
-				    $class_ext = 3;
755
-			    }else{
756
-				    $class_ext = 1;
757
-			    }
758
-			    if((!($_GET['type']==1 && !$is_img) && !(($_GET['type']==3 && !$is_video) && ($_GET['type']==3 && !$is_audio))) && $class_ext>0){
744
+                $class_ext=0;
745
+                if (in_array($extension_lower, $ext_video)) {
746
+                    $class_ext = 4;
747
+                    $is_video=true;
748
+                }elseif (in_array($extension_lower, $ext_img)) {
749
+                    $class_ext = 2;
750
+                }elseif (in_array($extension_lower, $ext_music)) {
751
+                    $class_ext = 5;
752
+                    $is_audio=true;
753
+                }elseif (in_array($extension_lower, $ext_misc)) {
754
+                    $class_ext = 3;
755
+                }else{
756
+                    $class_ext = 1;
757
+                }
758
+                if((!($_GET['type']==1 && !$is_img) && !(($_GET['type']==3 && !$is_video) && ($_GET['type']==3 && !$is_audio))) && $class_ext>0){
759 759
 ?>
760 760
 		    <li class="ff-item-type-<?php echo $class_ext; ?> file"  data-name="<?php echo $file; ?>"><?php
761
-		    $file_prevent_rename = false;
762
-		    $file_prevent_delete = false;
763
-		    if (isset($filePermissions[$file])) {
764
-			if (isset($filePermissions[$file]['prevent_duplicate']) && $filePermissions[$file]['prevent_duplicate']) {
765
-			    $files_prevent_duplicate[] = $file;
766
-			}
767
-			$file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
768
-			$file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
769
-		    }
761
+            $file_prevent_rename = false;
762
+            $file_prevent_delete = false;
763
+            if (isset($filePermissions[$file])) {
764
+            if (isset($filePermissions[$file]['prevent_duplicate']) && $filePermissions[$file]['prevent_duplicate']) {
765
+                $files_prevent_duplicate[] = $file;
766
+            }
767
+            $file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
768
+            $file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
769
+            }
770 770
             ?>		<figure data-name="<?php echo $file ?>" data-type="<?php if($is_img){ echo "img"; }else{ echo "file"; } ?>">
771 771
 				<a href="javascript:void('')" class="link" data-file="<?php echo $file; ?>" data-field_id="<?php echo $field_id; ?>" data-function="<?php echo $apply; ?>">
772 772
 				<div class="img-precontainer">
@@ -827,10 +827,10 @@  discard block
 block discarded – undo
827 827
 			</figure>			
828 828
 		</li>
829 829
 			<?php
830
-			}
831
-		    }
830
+            }
831
+            }
832 832
 		
833
-	?></div>
833
+    ?></div>
834 834
 	    </ul>
835 835
 	    <?php } ?>
836 836
 	</div>
Please login to merge, or discard this patch.
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -429,20 +429,20 @@
 block discarded – undo
429 429
 }
430 430
 
431 431
 switch($sort_by){
432
-    case 'name':
433
-	usort($sorted, 'filenameSort');
434
-	break;
435
-    case 'date':
436
-	usort($sorted, 'dateSort');
437
-	break;
438
-    case 'size':
439
-	usort($sorted, 'sizeSort');
440
-	break;
441
-    case 'extension':
442
-	usort($sorted, 'extensionSort');
443
-	break;
444
-    default:
445
-	break;
432
+        case 'name':
433
+	    usort($sorted, 'filenameSort');
434
+	    break;
435
+        case 'date':
436
+	    usort($sorted, 'dateSort');
437
+	    break;
438
+        case 'size':
439
+	    usort($sorted, 'sizeSort');
440
+	    break;
441
+        case 'extension':
442
+	    usort($sorted, 'extensionSort');
443
+	    break;
444
+        default:
445
+	    break;
446 446
     
447 447
 }
448 448
 
Please login to merge, or discard this patch.
Spacing   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -1,119 +1,119 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 include('config/config.php');
3 3
 
4
-$_SESSION['RF']["verify"]= "RESPONSIVEfilemanager";
4
+$_SESSION['RF']["verify"] = "RESPONSIVEfilemanager";
5 5
 
6
-if(isset($_POST['submit'])){
6
+if (isset($_POST['submit'])) {
7 7
 
8 8
 include('upload.php');
9 9
 
10
-}else{
10
+} else {
11 11
 
12 12
 include('include/utils.php');
13 13
 
14 14
 if (isset($_GET['fldr'])
15 15
     && !empty($_GET['fldr'])
16
-    && strpos($_GET['fldr'],'../')===FALSE
17
-    && strpos($_GET['fldr'],'./')===FALSE)
18
-    $subdir = urldecode(trim(strip_tags($_GET['fldr']),"/") ."/");
16
+    && strpos($_GET['fldr'], '../') === FALSE
17
+    && strpos($_GET['fldr'], './') === FALSE)
18
+    $subdir = urldecode(trim(strip_tags($_GET['fldr']), "/")."/");
19 19
 else
20 20
     $subdir = '';
21 21
     
22 22
 //remember last position
23
-setcookie('last_position',$subdir,time() + (86400 * 7)); 
23
+setcookie('last_position', $subdir, time() + (86400 * 7)); 
24 24
 
25
-if($subdir==""){
26
-    if(!empty($_COOKIE['last_position'])
27
-	&& strpos($_COOKIE['last_position'],'.')===FALSE)
28
-	$subdir= trim($_COOKIE['last_position']);
25
+if ($subdir == "") {
26
+    if (!empty($_COOKIE['last_position'])
27
+	&& strpos($_COOKIE['last_position'], '.') === FALSE)
28
+	$subdir = trim($_COOKIE['last_position']);
29 29
 }
30 30
 
31
-if($subdir==="/"){
32
-    $subdir="";
31
+if ($subdir === "/") {
32
+    $subdir = "";
33 33
 }
34 34
 
35 35
 
36 36
 /***
37 37
  *SUB-DIR CODE
38 38
  ***/
39
-if(!isset($_SESSION['RF']["subfolder"])) $_SESSION['RF']["subfolder"]='';
39
+if (!isset($_SESSION['RF']["subfolder"])) $_SESSION['RF']["subfolder"] = '';
40 40
 $rfm_subfolder = '';
41
-if(!empty($_SESSION['RF']["subfolder"]) && strpos($_SESSION['RF']["subfolder"],'../')===FALSE
42
-   && strpos($_SESSION['RF']["subfolder"],'./')===FALSE && strpos($_SESSION['RF']["subfolder"],"/")!==0
43
-    && strpos($_SESSION['RF']["subfolder"],'.')===FALSE) $rfm_subfolder= $_SESSION['RF']['subfolder'];
41
+if (!empty($_SESSION['RF']["subfolder"]) && strpos($_SESSION['RF']["subfolder"], '../') === FALSE
42
+   && strpos($_SESSION['RF']["subfolder"], './') === FALSE && strpos($_SESSION['RF']["subfolder"], "/") !== 0
43
+    && strpos($_SESSION['RF']["subfolder"], '.') === FALSE) $rfm_subfolder = $_SESSION['RF']['subfolder'];
44 44
    
45
-if($rfm_subfolder!="" && $rfm_subfolder[strlen($rfm_subfolder)-1]!=="/") $rfm_subfolder.="/";
45
+if ($rfm_subfolder != "" && $rfm_subfolder[strlen($rfm_subfolder) - 1] !== "/") $rfm_subfolder .= "/";
46 46
    
47
-if(!file_exists($current_path . $rfm_subfolder.$subdir)){
48
-    $subdir='';
49
-    if(!file_exists($current_path . $rfm_subfolder.$subdir)){
50
-	$rfm_subfolder="";
47
+if (!file_exists($current_path.$rfm_subfolder.$subdir)) {
48
+    $subdir = '';
49
+    if (!file_exists($current_path.$rfm_subfolder.$subdir)) {
50
+	$rfm_subfolder = "";
51 51
     }
52 52
 }
53 53
     
54
-if(trim($rfm_subfolder)==""){
55
-    $cur_dir = $upload_dir . $subdir;
56
-    $cur_path = $current_path . $subdir;
54
+if (trim($rfm_subfolder) == "") {
55
+    $cur_dir = $upload_dir.$subdir;
56
+    $cur_path = $current_path.$subdir;
57 57
     $thumbs_path = $thumbs_base_path;
58
-    $parent=$subdir;
59
-}else{
60
-    $cur_dir = $upload_dir . $rfm_subfolder.$subdir;
61
-    $cur_path = $current_path . $rfm_subfolder.$subdir;
62
-    $thumbs_path = $thumbs_base_path. $rfm_subfolder;
63
-    $parent=$rfm_subfolder.$subdir;
58
+    $parent = $subdir;
59
+} else {
60
+    $cur_dir = $upload_dir.$rfm_subfolder.$subdir;
61
+    $cur_path = $current_path.$rfm_subfolder.$subdir;
62
+    $thumbs_path = $thumbs_base_path.$rfm_subfolder;
63
+    $parent = $rfm_subfolder.$subdir;
64 64
 }
65 65
 
66
-$cycle=true;
67
-$max_cycles=50;
68
-$i=0;
69
-while($cycle && $i<$max_cycles){
66
+$cycle = true;
67
+$max_cycles = 50;
68
+$i = 0;
69
+while ($cycle && $i < $max_cycles) {
70 70
     $i++;
71
-    if($parent==="./") $parent="";
72
-    if(file_exists($current_path.$parent."config.php")){
71
+    if ($parent === "./") $parent = "";
72
+    if (file_exists($current_path.$parent."config.php")) {
73 73
 	require_once($current_path.$parent."config.php");
74
-	$cycle=false;
74
+	$cycle = false;
75 75
     }
76 76
     
77
-    if($parent=="") $cycle=false;
78
-    else $parent=fix_dirname($parent)."/";
77
+    if ($parent == "") $cycle = false;
78
+    else $parent = fix_dirname($parent)."/";
79 79
 }
80 80
 
81
-if(!is_dir($thumbs_path.$subdir)){
81
+if (!is_dir($thumbs_path.$subdir)) {
82 82
     create_folder(false, $thumbs_path.$subdir);
83 83
 }
84 84
 
85
-if(isset($_GET['popup'])) $popup= strip_tags($_GET['popup']); else $popup=0;
85
+if (isset($_GET['popup'])) $popup = strip_tags($_GET['popup']); else $popup = 0;
86 86
 //Sanitize popup
87
-$popup=!!$popup;
87
+$popup = !!$popup;
88 88
 
89 89
 //view type
90
-if(!isset($_SESSION['RF']["view_type"])){ $view=$default_view; $_SESSION['RF']["view_type"] = $view; }
91
-if(isset($_GET['view'])){ $view=fix_get_params($_GET['view']); $_SESSION['RF']["view_type"] = $view; }
92
-$view=$_SESSION['RF']["view_type"];
90
+if (!isset($_SESSION['RF']["view_type"])) { $view = $default_view; $_SESSION['RF']["view_type"] = $view; }
91
+if (isset($_GET['view'])) { $view = fix_get_params($_GET['view']); $_SESSION['RF']["view_type"] = $view; }
92
+$view = $_SESSION['RF']["view_type"];
93 93
 
94
-if(isset($_GET["filter"])) $filter=fix_get_params($_GET["filter"]);
95
-else $filter='';
94
+if (isset($_GET["filter"])) $filter = fix_get_params($_GET["filter"]);
95
+else $filter = '';
96 96
 
97
-if(!isset($_SESSION['RF']['sort_by'])) $_SESSION['RF']['sort_by']='';
98
-if(isset($_GET["sort_by"])) $sort_by=$_SESSION['RF']['sort_by']=fix_get_params($_GET["sort_by"]);
99
-else $sort_by=$_SESSION['RF']['sort_by'];
97
+if (!isset($_SESSION['RF']['sort_by'])) $_SESSION['RF']['sort_by'] = '';
98
+if (isset($_GET["sort_by"])) $sort_by = $_SESSION['RF']['sort_by'] = fix_get_params($_GET["sort_by"]);
99
+else $sort_by = $_SESSION['RF']['sort_by'];
100 100
 
101
-if(!isset($_SESSION['RF']['descending'])) $_SESSION['RF']['descending']=false;
102
-if(isset($_GET["descending"])) $descending=$_SESSION['RF']['descending']=fix_get_params($_GET["descending"])==="true";
103
-else $descending=$_SESSION['RF']['descending'];
101
+if (!isset($_SESSION['RF']['descending'])) $_SESSION['RF']['descending'] = false;
102
+if (isset($_GET["descending"])) $descending = $_SESSION['RF']['descending'] = fix_get_params($_GET["descending"]) === "true";
103
+else $descending = $_SESSION['RF']['descending'];
104 104
 
105 105
 
106
-$lang=$default_language;
107
-if(isset($_GET['lang']) && $_GET['lang'] !== 'undefined' && $_GET['lang']!='') {
108
-    $lang=fix_get_params($_GET['lang']);
109
-    $lang=trim($lang);
106
+$lang = $default_language;
107
+if (isset($_GET['lang']) && $_GET['lang'] !== 'undefined' && $_GET['lang'] != '') {
108
+    $lang = fix_get_params($_GET['lang']);
109
+    $lang = trim($lang);
110 110
 }
111 111
 
112 112
 $language_file = 'lang/'.$default_language.'.php'; 
113
-if ($lang!=$default_language) {
113
+if ($lang != $default_language) {
114 114
     $path_parts = pathinfo($lang);
115
-    if(is_readable('lang/' .$path_parts['basename']. '.php')){ 
116
-        $language_file = 'lang/' .$path_parts['basename']. '.php';
115
+    if (is_readable('lang/'.$path_parts['basename'].'.php')) { 
116
+        $language_file = 'lang/'.$path_parts['basename'].'.php';
117 117
     }
118 118
     else {
119 119
     	echo "<script>console.log('The ".$lang." language file is not readable! Falling back...');</script>";
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 $_SESSION['RF']['language_file'] = $language_file;
125 125
 require_once $language_file;
126 126
 
127
-if(!isset($_GET['type'])) $_GET['type']=0;
128
-if(!isset($_GET['field_id'])) $_GET['field_id']='';
127
+if (!isset($_GET['type'])) $_GET['type'] = 0;
128
+if (!isset($_GET['field_id'])) $_GET['field_id'] = '';
129 129
 
130
-$field_id=isset($_GET['field_id']) ? fix_get_params($_GET['field_id']) : '';
131
-$type_param=fix_get_params($_GET['type']);
130
+$field_id = isset($_GET['field_id']) ? fix_get_params($_GET['field_id']) : '';
131
+$type_param = fix_get_params($_GET['type']);
132 132
 
133 133
 $get_params = http_build_query(array(
134 134
     'type'      => $type_param,
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	$sprite_lang_file = 'img/spritemap_'.$lang.'.png';
158 158
 	$sprite_lang_file2 = 'img/spritemap@2x_'.$lang.'.png';
159 159
 	
160
-	if ( ! file_exists($sprite_lang_file) || ! file_exists($sprite_lang_file2)){
160
+	if (!file_exists($sprite_lang_file) || !file_exists($sprite_lang_file2)) {
161 161
 		//fallback
162 162
 		$sprite_lang_file = 'img/spritemap_en_EN.png';
163 163
 		$sprite_lang_file2 = 'img/spritemap@2x_en_EN.png';
164
-		if ( ! file_exists($sprite_lang_file) || ! file_exists($sprite_lang_file2)){
164
+		if (!file_exists($sprite_lang_file) || !file_exists($sprite_lang_file2)) {
165 165
 			// we are in deep ****
166 166
 			echo '<script>console.log("Error: Spritemap not found!");</script>';
167 167
 			// exit();
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	<script type="text/javascript" src="js/imagesloaded.pkgd.min.js"></script>
220 220
 	<script type="text/javascript" src="js/jquery.queryloader2.min.js"></script>
221 221
 	<?php
222
-	if($aviary_active){
222
+	if ($aviary_active) {
223 223
 	if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { ?>
224 224
 	    <script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
225
-	<?php }else{ ?>
225
+	<?php } else { ?>
226 226
 	    <script type="text/javascript" src="http://feather.aviary.com/js/feather.js "></script>
227 227
 	<?php }} ?>
228 228
 	
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 	<script>
238 238
 	    var ext_img=new Array('<?php echo implode("','", $ext_img)?>');
239 239
 	    var allowed_ext=new Array('<?php echo implode("','", $ext)?>');
240
-	    var loading_bar=<?php echo $loading_bar?"true":"false"; ?>;
241
-	    var image_editor=<?php echo $aviary_active?"true":"false"; ?>;
240
+	    var loading_bar=<?php echo $loading_bar ? "true" : "false"; ?>;
241
+	    var image_editor=<?php echo $aviary_active ? "true" : "false"; ?>;
242 242
 	    //dropzone config
243 243
 	    Dropzone.options.myAwesomeDropzone = {
244
-		    dictInvalidFileType: "<?php echo lang_Error_extension;?>",
244
+		    dictInvalidFileType: "<?php echo lang_Error_extension; ?>",
245 245
 		    dictFileTooBig: "<?php echo lang_Error_Upload; ?>",
246 246
 		    dictResponseError: "SERVER ERROR",
247 247
 		    paramName: "file", // The name that will be used to transfer the file
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 					done();
255 255
 			    }
256 256
 			    else { 
257
-			    	done("<?php echo lang_Error_extension;?>"); 
257
+			    	done("<?php echo lang_Error_extension; ?>"); 
258 258
 				}
259 259
 		    }
260 260
 	    };
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
 	<input type="hidden" id="cancel" value="<?php echo lang_Cancel; ?>" />
307 307
 	<input type="hidden" id="rename" value="<?php echo lang_Rename; ?>" />
308 308
 	<input type="hidden" id="lang_duplicate" value="<?php echo lang_Duplicate; ?>" />
309
-	<input type="hidden" id="duplicate" value="<?php if($duplicate_files) echo 1; else echo 0; ?>" />
309
+	<input type="hidden" id="duplicate" value="<?php if ($duplicate_files) echo 1; else echo 0; ?>" />
310 310
 	<input type="hidden" id="base_url" value="<?php echo $base_url?>"/>
311 311
 	<input type="hidden" id="base_url_true" value="<?php echo base_url(); ?>"/>
312 312
 	<input type="hidden" id="fldr_value" value="<?php echo $subdir; ?>"/>
313 313
 	<input type="hidden" id="sub_folder" value="<?php echo $rfm_subfolder; ?>"/>
314 314
 	<input type="hidden" id="file_number_limit_js" value="<?php echo $file_number_limit_js; ?>" />
315
-	<input type="hidden" id="descending" value="<?php echo $descending?"true":"false"; ?>" />
315
+	<input type="hidden" id="descending" value="<?php echo $descending ? "true" : "false"; ?>" />
316 316
 	<?php $protocol = 'http'; ?>
317
-	<input type="hidden" id="current_url" value="<?php echo str_replace(array('&filter='.$filter),array(''),$protocol."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>" />
317
+	<input type="hidden" id="current_url" value="<?php echo str_replace(array('&filter='.$filter), array(''), $protocol."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>" />
318 318
 	<input type="hidden" id="lang_show_url" value="<?php echo lang_Show_url; ?>" />
319
-	<input type="hidden" id="copy_cut_files_allowed" value="<?php if($copy_cut_files) echo 1; else echo 0; ?>" />
320
-	<input type="hidden" id="copy_cut_dirs_allowed" value="<?php if($copy_cut_dirs) echo 1; else echo 0; ?>" />
319
+	<input type="hidden" id="copy_cut_files_allowed" value="<?php if ($copy_cut_files) echo 1; else echo 0; ?>" />
320
+	<input type="hidden" id="copy_cut_dirs_allowed" value="<?php if ($copy_cut_dirs) echo 1; else echo 0; ?>" />
321 321
 	<input type="hidden" id="copy_cut_max_size" value="<?php echo $copy_cut_max_size; ?>" />
322 322
 	<input type="hidden" id="copy_cut_max_count" value="<?php echo $copy_cut_max_count; ?>" />
323 323
 	<input type="hidden" id="lang_copy" value="<?php echo lang_Copy; ?>" />
@@ -331,15 +331,15 @@  discard block
 block discarded – undo
331 331
 	<input type="hidden" id="lang_file_info" value="<?php echo fix_strtoupper(lang_File_info); ?>" />
332 332
 	<input type="hidden" id="lang_edit_image" value="<?php echo lang_Edit_image; ?>" />
333 333
 	<input type="hidden" id="lang_extract" value="<?php echo lang_Extract; ?>" />
334
-	<input type="hidden" id="transliteration" value="<?php echo $transliteration?"true":"false"; ?>" />
335
-<?php if($upload_files){ ?>
334
+	<input type="hidden" id="transliteration" value="<?php echo $transliteration ? "true" : "false"; ?>" />
335
+<?php if ($upload_files) { ?>
336 336
 <!-- uploader div start -->
337 337
 
338 338
 <div class="uploader">
339 339
     <center><button class="btn btn-inverse close-uploader"><i class="icon-backward icon-white"></i> <?php echo lang_Return_Files_List?></button></center>
340 340
 	<div class="space10"></div><div class="space10"></div>
341 341
 	<div class="tabbable upload-tabbable"> <!-- Only required for left/right tabs -->
342
-		<?php if($java_upload){ ?>
342
+		<?php if ($java_upload) { ?>
343 343
 	    <ul class="nav nav-tabs">
344 344
 			<li class="active"><a href="#tab1" data-toggle="tab"><?php echo lang_Upload_base; ?></a></li>
345 345
 			<li><a href="#tab2" id="uploader-btn" data-toggle="tab"><?php echo lang_Upload_java; ?></a></li>
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 				</form>
365 365
 			</div>
366 366
 		    <div class="upload-help"><?php echo lang_Upload_base_help; ?></div>
367
-			<?php if($java_upload){ ?>
367
+			<?php if ($java_upload) { ?>
368 368
 			</div>
369 369
 			<div class="tab-pane" id="tab2">
370 370
 		    	<div id="iframe-container"></div>
@@ -385,50 +385,50 @@  discard block
 block discarded – undo
385 385
 $class_ext = '';
386 386
 $src = '';
387 387
 
388
-if ($_GET['type']==1) 	 $apply = 'apply_img';
389
-elseif($_GET['type']==2) $apply = 'apply_link';
390
-elseif($_GET['type']==0 && $_GET['field_id']=='') $apply = 'apply_none';
391
-elseif($_GET['type']==3) $apply = 'apply_video';
388
+if ($_GET['type'] == 1) 	 $apply = 'apply_img';
389
+elseif ($_GET['type'] == 2) $apply = 'apply_link';
390
+elseif ($_GET['type'] == 0 && $_GET['field_id'] == '') $apply = 'apply_none';
391
+elseif ($_GET['type'] == 3) $apply = 'apply_video';
392 392
 else $apply = 'apply';
393 393
 
394 394
 $files = scandir($current_path.$rfm_subfolder.$subdir);
395
-$n_files=count($files);
395
+$n_files = count($files);
396 396
 
397 397
 //php sorting
398
-$sorted=array();
399
-$current_folder=array();
400
-$prev_folder=array();
401
-foreach($files as $k=>$file){
402
-    if($file===".") $current_folder=array('file'=>$file);
403
-    elseif($file==="..") $prev_folder=array('file'=>$file);
404
-    elseif(is_dir($current_path.$rfm_subfolder.$subdir.$file)){
405
-	$date=filemtime($current_path.$rfm_subfolder.$subdir. $file);
406
-	$size=foldersize($current_path.$rfm_subfolder.$subdir. $file);
407
-	$file_ext=lang_Type_dir;
408
-	$sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
409
-    }else{
410
-	$file_path=$current_path.$rfm_subfolder.$subdir.$file;
411
-	$date=filemtime($file_path);
412
-	$size=filesize($file_path);
413
-	$file_ext = substr(strrchr($file,'.'),1);
414
-	$sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
398
+$sorted = array();
399
+$current_folder = array();
400
+$prev_folder = array();
401
+foreach ($files as $k=>$file) {
402
+    if ($file === ".") $current_folder = array('file'=>$file);
403
+    elseif ($file === "..") $prev_folder = array('file'=>$file);
404
+    elseif (is_dir($current_path.$rfm_subfolder.$subdir.$file)) {
405
+	$date = filemtime($current_path.$rfm_subfolder.$subdir.$file);
406
+	$size = foldersize($current_path.$rfm_subfolder.$subdir.$file);
407
+	$file_ext = lang_Type_dir;
408
+	$sorted[$k] = array('file'=>$file, 'date'=>$date, 'size'=>$size, 'extension'=>$file_ext);
409
+    } else {
410
+	$file_path = $current_path.$rfm_subfolder.$subdir.$file;
411
+	$date = filemtime($file_path);
412
+	$size = filesize($file_path);
413
+	$file_ext = substr(strrchr($file, '.'), 1);
414
+	$sorted[$k] = array('file'=>$file, 'date'=>$date, 'size'=>$size, 'extension'=>$file_ext);
415 415
     }
416 416
 }
417 417
 
418 418
 function filenameSort($x, $y) {
419
-    return $x['file'] <  $y['file'];
419
+    return $x['file'] < $y['file'];
420 420
 }
421 421
 function dateSort($x, $y) {
422
-    return $x['date'] <  $y['date'];
422
+    return $x['date'] < $y['date'];
423 423
 }
424 424
 function sizeSort($x, $y) {
425
-    return $x['size'] -  $y['size'];
425
+    return $x['size'] - $y['size'];
426 426
 }
427 427
 function extensionSort($x, $y) {
428
-    return $x['extension'] <  $y['extension'];
428
+    return $x['extension'] < $y['extension'];
429 429
 }
430 430
 
431
-switch($sort_by){
431
+switch ($sort_by) {
432 432
     case 'name':
433 433
 	usort($sorted, 'filenameSort');
434 434
 	break;
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
     
447 447
 }
448 448
 
449
-if($descending){
450
-    $sorted=array_reverse($sorted);
449
+if ($descending) {
450
+    $sorted = array_reverse($sorted);
451 451
 }
452 452
 
453
-$files=array_merge(array($prev_folder),array($current_folder),$sorted);
453
+$files = array_merge(array($prev_folder), array($current_folder), $sorted);
454 454
 ?>          
455 455
 <!-- header div start -->
456 456
 <div class="navbar navbar-fixed-top">
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
 		<div class="filters">
467 467
 		    <div class="row-fluid">
468 468
 			<div class="span3 half"> 
469
-			    <?php if($upload_files){ ?>
469
+			    <?php if ($upload_files) { ?>
470 470
 						    <button class="tip btn upload-btn" title="<?php echo  lang_Upload_file; ?>"><i class="icon-plus"></i><i class="icon-file"></i></button> 
471 471
 			    <?php } ?>
472
-			    <?php if($create_folders){ ?>
472
+			    <?php if ($create_folders) { ?>
473 473
 						    <button class="tip btn new-folder" title="<?php echo  lang_New_Folder?>"><i class="icon-plus"></i><i class="icon-folder-open"></i></button> 
474 474
 			    <?php } ?>
475
-			    <?php if($copy_cut_files || $copy_cut_dirs){ ?>
475
+			    <?php if ($copy_cut_files || $copy_cut_dirs) { ?>
476 476
 				    <button class="tip btn paste-here-btn" title="<?php echo lang_Paste_Here; ?>"><i class="rficon-clipboard-apply"></i></button> 
477 477
 				    <button class="tip btn clear-clipboard-btn" title="<?php echo lang_Clear_Clipboard; ?>"><i class="rficon-clipboard-clear"></i></button> 
478 478
 				<?php } ?>
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 			<div class="span3 half view-controller">
481 481
 
482 482
 				<span><?php echo lang_View; ?>:</span>
483
-			    <button class="btn tip<?php if($view==0) echo " btn-inverse"; ?>" id="view0" data-value="0" title="<?php echo lang_View_boxes; ?>"><i class="icon-th <?php if($view==0) echo "icon-white"; ?>"></i></button>
484
-			    <button class="btn tip<?php if($view==1) echo " btn-inverse"; ?>" id="view1" data-value="1" title="<?php echo lang_View_list; ?>"><i class="icon-align-justify <?php if($view==1) echo "icon-white"; ?>"></i></button>
485
-			    <button class="btn tip<?php if($view==2) echo " btn-inverse"; ?>" id="view2" data-value="2" title="<?php echo lang_View_columns_list; ?>"><i class="icon-fire <?php if($view==2) echo "icon-white"; ?>"></i></button>
483
+			    <button class="btn tip<?php if ($view == 0) echo " btn-inverse"; ?>" id="view0" data-value="0" title="<?php echo lang_View_boxes; ?>"><i class="icon-th <?php if ($view == 0) echo "icon-white"; ?>"></i></button>
484
+			    <button class="btn tip<?php if ($view == 1) echo " btn-inverse"; ?>" id="view1" data-value="1" title="<?php echo lang_View_list; ?>"><i class="icon-align-justify <?php if ($view == 1) echo "icon-white"; ?>"></i></button>
485
+			    <button class="btn tip<?php if ($view == 2) echo " btn-inverse"; ?>" id="view2" data-value="2" title="<?php echo lang_View_columns_list; ?>"><i class="icon-fire <?php if ($view == 2) echo "icon-white"; ?>"></i></button>
486 486
 			</div>
487 487
 			<div class="span6 half types"> 
488 488
 				<span><?php echo lang_Filters; ?>:</span>
489
-			    <?php if($_GET['type']!=1 && $_GET['type']!=3){ ?>
489
+			    <?php if ($_GET['type'] != 1 && $_GET['type'] != 3) { ?>
490 490
 			    <input id="select-type-1" name="radio-sort" type="radio" data-item="ff-item-type-1" checked="checked"  class="hide"  />
491 491
 			    <label id="ff-item-type-1" title="<?php echo lang_Files; ?>" for="select-type-1" class="tip btn ff-label-type-1"><i class="icon-file"></i></label>
492 492
 			    <input id="select-type-2" name="radio-sort" type="radio" data-item="ff-item-type-2" class="hide"  />
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 			    <input id="select-type-5" name="radio-sort" type="radio" data-item="ff-item-type-5" class="hide"  />
499 499
 			    <label id="ff-item-type-5" title="<?php echo lang_Music; ?>" for="select-type-5" class="tip btn ff-label-type-5"><i class="icon-music"></i></label>
500 500
 			    <?php } ?>
501
-			    <input accesskey="f" type="text" class="filter-input <?php echo (($_GET['type']!=1 && $_GET['type']!=3) ? '' : 'filter-input-notype'); ?>" id="filter-input" name="filter" placeholder="<?php echo fix_strtolower(lang_Text_filter); ?>..." value="<?php echo $filter; ?>"/><?php if($n_files>$file_number_limit_js){ ?><label id="filter" class="btn"><i class="icon-play"></i></label><?php } ?>
501
+			    <input accesskey="f" type="text" class="filter-input <?php echo (($_GET['type'] != 1 && $_GET['type'] != 3) ? '' : 'filter-input-notype'); ?>" id="filter-input" name="filter" placeholder="<?php echo fix_strtolower(lang_Text_filter); ?>..." value="<?php echo $filter; ?>"/><?php if ($n_files > $file_number_limit_js) { ?><label id="filter" class="btn"><i class="icon-play"></i></label><?php } ?>
502 502
 			    
503 503
 			    <input id="select-type-all" name="radio-sort" type="radio" data-item="ff-item-type-all" class="hide"  />
504
-			     <label id="ff-item-type-all" title="<?php echo lang_All; ?>" <?php if($_GET['type']==1 || $_GET['type']==3){ ?>style="visibility: hidden;" <?php } ?> data-item="ff-item-type-all" for="select-type-all" style="margin-rigth:0px;" class="tip btn btn-inverse ff-label-type-all"><i class="icon-align-justify icon-white"></i></label>
504
+			     <label id="ff-item-type-all" title="<?php echo lang_All; ?>" <?php if ($_GET['type'] == 1 || $_GET['type'] == 3) { ?>style="visibility: hidden;" <?php } ?> data-item="ff-item-type-all" for="select-type-all" style="margin-rigth:0px;" class="tip btn btn-inverse ff-label-type-all"><i class="icon-align-justify icon-white"></i></label>
505 505
 			    
506 506
 			</div>
507 507
 		    </div>
@@ -517,20 +517,20 @@  discard block
 block discarded – undo
517 517
     
518 518
     <div class="row-fluid">
519 519
 	<?php	
520
-	$link="dialog.php?".$get_params;
520
+	$link = "dialog.php?".$get_params;
521 521
 	?>
522 522
 	<ul class="breadcrumb">	
523 523
 	<li class="pull-left"><a href="<?php echo $link?>/"><i class="icon-home"></i></a></li>
524 524
 	<li><span class="divider">/</span></li>
525 525
 	<?php
526
-	$bc=explode("/",$subdir);
527
-	$tmp_path='';
528
-	if(!empty($bc))
529
-	foreach($bc as $k=>$b){ 
530
-		$tmp_path.=$b."/";
531
-		if($k==count($bc)-2){
526
+	$bc = explode("/", $subdir);
527
+	$tmp_path = '';
528
+	if (!empty($bc))
529
+	foreach ($bc as $k=>$b) { 
530
+		$tmp_path .= $b."/";
531
+		if ($k == count($bc) - 2) {
532 532
 	?> <li class="active"><?php echo $b?></li><?php
533
-		}elseif($b!=""){ ?>
533
+		}elseif ($b != "") { ?>
534 534
 		<li><a href="<?php echo $link.$tmp_path?>"><?php echo $b?></a></li><li><span class="divider"><?php echo "/"; ?></span></li>
535 535
 	<?php }
536 536
 	}
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
 		</a>
547 547
 		<ul class="dropdown-menu pull-left sorting">
548 548
 		    <li><center><strong><?php echo lang_Sorting ?></strong></center></li>
549
-		<li><a class="sorter sort-name <?php if($sort_by==="name"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="name"><?php echo lang_Filename; ?></a></li>
550
-		<li><a class="sorter sort-date <?php if($sort_by==="date"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="date"><?php echo lang_Date; ?></a></li>
551
-		<li><a class="sorter sort-size <?php if($sort_by==="size"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="size"><?php echo lang_Size; ?></a></li>
552
-		<li><a class="sorter sort-extension <?php if($sort_by==="extension"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="extension"><?php echo lang_Type; ?></a></li>
549
+		<li><a class="sorter sort-name <?php if ($sort_by === "name") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="name"><?php echo lang_Filename; ?></a></li>
550
+		<li><a class="sorter sort-date <?php if ($sort_by === "date") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="date"><?php echo lang_Date; ?></a></li>
551
+		<li><a class="sorter sort-size <?php if ($sort_by === "size") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="size"><?php echo lang_Size; ?></a></li>
552
+		<li><a class="sorter sort-extension <?php if ($sort_by === "extension") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="extension"><?php echo lang_Type; ?></a></li>
553 553
 		</ul>
554 554
 	      </div>
555 555
 	</li>
@@ -558,22 +558,22 @@  discard block
 block discarded – undo
558 558
     <!-- breadcrumb div end -->
559 559
     <div class="row-fluid ff-container">
560 560
 	<div class="span12">	    
561
-	    <?php if(@opendir($current_path.$rfm_subfolder.$subdir)===FALSE){ ?>
561
+	    <?php if (@opendir($current_path.$rfm_subfolder.$subdir) === FALSE) { ?>
562 562
 	    <br/>
563 563
 	    <div class="alert alert-error">There is an error! The upload folder there isn't. Check your config.php file. </div> 
564
-	    <?php }else{ ?>
564
+	    <?php } else { ?>
565 565
 	    <h4 id="help"><?php echo lang_Swipe_help; ?></h4>
566
-	    <?php if(isset($folder_message)){ ?>
566
+	    <?php if (isset($folder_message)) { ?>
567 567
 		<div class="alert alert-block"><?php echo $folder_message; ?></div>
568 568
 	    <?php } ?>
569
-	    <?php if($show_sorting_bar){ ?>
569
+	    <?php if ($show_sorting_bar) { ?>
570 570
 	    <!-- sorter -->
571 571
 	    <div class="sorter-container <?php echo "list-view".$view; ?>">
572
-		<div class="file-name"><a class="sorter sort-name <?php if($sort_by==="name"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="name"><?php echo lang_Filename; ?></a></div>
573
-		<div class="file-date"><a class="sorter sort-date <?php if($sort_by==="date"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="date"><?php echo lang_Date; ?></a></div>
574
-		<div class="file-size"><a class="sorter sort-size <?php if($sort_by==="size"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="size"><?php echo lang_Size; ?></a></div>
572
+		<div class="file-name"><a class="sorter sort-name <?php if ($sort_by === "name") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="name"><?php echo lang_Filename; ?></a></div>
573
+		<div class="file-date"><a class="sorter sort-date <?php if ($sort_by === "date") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="date"><?php echo lang_Date; ?></a></div>
574
+		<div class="file-size"><a class="sorter sort-size <?php if ($sort_by === "size") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="size"><?php echo lang_Size; ?></a></div>
575 575
 		<div class='img-dimension'><?php echo lang_Dimension; ?></div>
576
-		<div class='file-extension'><a class="sorter sort-extension <?php if($sort_by==="extension"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="extension"><?php echo lang_Type; ?></a></div>
576
+		<div class='file-extension'><a class="sorter sort-extension <?php if ($sort_by === "extension") { echo ($descending) ? "descending" : "ascending"; } ?>" href="javascript:void('')" data-sort="extension"><?php echo lang_Type; ?></a></div>
577 577
 		<div class='file-operations'><?php echo lang_Operations; ?></div>
578 578
 	    </div>
579 579
 	    <?php } ?>
@@ -583,74 +583,74 @@  discard block
 block discarded – undo
583 583
 	    <ul class="grid cs-style-2 <?php echo "list-view".$view; ?>" id="main-item-container">
584 584
 		<?php
585 585
 		
586
-		$jplayer_ext=array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav");
586
+		$jplayer_ext = array("mp4", "flv", "webmv", "webma", "webm", "m4a", "m4v", "ogv", "oga", "mp3", "midi", "mid", "ogg", "wav");
587 587
 		foreach ($files as $file_array) {
588
-		    $file=$file_array['file'];
589
-			if($file === '.' || (isset($file_array['extension']) && $file_array['extension']!=lang_Type_dir) || ($file === '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter!='' && $file!==".." && strpos($file,$filter)===false))
588
+		    $file = $file_array['file'];
589
+			if ($file === '.' || (isset($file_array['extension']) && $file_array['extension'] != lang_Type_dir) || ($file === '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter != '' && $file !== ".." && strpos($file, $filter) === false))
590 590
 			    continue;
591
-			$new_name=fix_filename($file,$transliteration);
592
-			if($file!=='..' && $file!=$new_name){
591
+			$new_name = fix_filename($file, $transliteration);
592
+			if ($file !== '..' && $file != $new_name) {
593 593
 			    //rename
594
-			    rename_folder($current_path.$subdir.$new_name,$new_name,$transliteration);
595
-			    $file=$new_name;
594
+			    rename_folder($current_path.$subdir.$new_name, $new_name, $transliteration);
595
+			    $file = $new_name;
596 596
 			}
597 597
 			//add in thumbs folder if not exist 
598
-			if (!file_exists($thumbs_path.$subdir.$file)) create_folder(false,$thumbs_path.$subdir.$file);
598
+			if (!file_exists($thumbs_path.$subdir.$file)) create_folder(false, $thumbs_path.$subdir.$file);
599 599
 			$class_ext = 3;			
600
-			if($file==='..' && trim($subdir) != '' ){
601
-			    $src = explode("/",$subdir);
602
-			    unset($src[count($src)-2]);
603
-			    $src=implode("/",$src);
604
-			    if($src==='') $src="/";
600
+			if ($file === '..' && trim($subdir) != '') {
601
+			    $src = explode("/", $subdir);
602
+			    unset($src[count($src) - 2]);
603
+			    $src = implode("/", $src);
604
+			    if ($src === '') $src = "/";
605 605
 			}
606
-			elseif ($file!=='..') {
607
-			    $src = $subdir . $file."/";
606
+			elseif ($file !== '..') {
607
+			    $src = $subdir.$file."/";
608 608
 			}
609 609
 			
610 610
 			?>
611
-			    <li data-name="<?php echo $file ?>" <?php if($file==='..') echo 'class="back"'; else echo 'class="dir"'; ?>><?php
611
+			    <li data-name="<?php echo $file ?>" <?php if ($file === '..') echo 'class="back"'; else echo 'class="dir"'; ?>><?php
612 612
 			    $file_prevent_rename = false;
613 613
 			    $file_prevent_delete = false;
614 614
 			    if (isset($filePermissions[$file])) {
615 615
 				$file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
616 616
 				$file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
617 617
 			    }
618
-			    ?>	<figure data-name="<?php echo $file ?>" class="<?php if($file==="..") echo "back-"; ?>directory" data-type="<?php if($file!==".."){ echo "dir"; } ?>">
618
+			    ?>	<figure data-name="<?php echo $file ?>" class="<?php if ($file === "..") echo "back-"; ?>directory" data-type="<?php if ($file !== "..") { echo "dir"; } ?>">
619 619
 				    <a class="folder-link" href="dialog.php?<?php echo $get_params.rawurlencode($src)."&".uniqid() ?>">
620 620
 				    <div class="img-precontainer">
621 621
 					<div class="img-container directory"><span></span>
622
-					<img class="directory-img"  src="img/<?php echo $icon_theme; ?>/folder<?php if($file===".."){ echo "_back"; }?>.jpg" alt="folder" />
622
+					<img class="directory-img"  src="img/<?php echo $icon_theme; ?>/folder<?php if ($file === "..") { echo "_back"; }?>.jpg" alt="folder" />
623 623
 					</div>
624 624
 				    </div>
625 625
 				    <div class="img-precontainer-mini directory">
626 626
 					<div class="img-container-mini">
627 627
 					    <span></span>
628
-					    <img class="directory-img"  src="img/<?php echo $icon_theme; ?>/folder<?php if($file===".."){ echo "_back"; }?>.png" alt="folder" />
628
+					    <img class="directory-img"  src="img/<?php echo $icon_theme; ?>/folder<?php if ($file === "..") { echo "_back"; }?>.png" alt="folder" />
629 629
 					</div>
630 630
 				    </div>
631
-			<?php if($file===".."){ ?>
631
+			<?php if ($file === "..") { ?>
632 632
 				    <div class="box no-effect">
633 633
 					<h4><?php echo lang_Back ?></h4>
634 634
 				    </div>
635 635
 				    </a>
636 636
 				    
637
-			<?php }else{ ?>
637
+			<?php } else { ?>
638 638
 				    </a>
639 639
 				    <div class="box">
640
-					<h4 class="<?php if($ellipsis_title_after_first_row){ echo "ellipsis"; } ?>"><a class="folder-link" data-file="<?php echo $file ?>" href="dialog.php?<?php echo $get_params.rawurlencode($src)."&".uniqid() ?>"><?php echo $file; ?></a></h4>
640
+					<h4 class="<?php if ($ellipsis_title_after_first_row) { echo "ellipsis"; } ?>"><a class="folder-link" data-file="<?php echo $file ?>" href="dialog.php?<?php echo $get_params.rawurlencode($src)."&".uniqid() ?>"><?php echo $file; ?></a></h4>
641 641
 				    </div>
642 642
 				    <input type="hidden" class="name" value=""/>
643 643
 				    <input type="hidden" class="date" value="<?php echo $file_array['date']; ?>"/>
644
-				    <input type="hidden" class="size" value="<?php echo $file_array['size'];  ?>"/>
644
+				    <input type="hidden" class="size" value="<?php echo $file_array['size']; ?>"/>
645 645
 				    <input type="hidden" class="extension" value="<?php echo lang_Type_dir; ?>"/>
646
-				    <div class="file-date"><?php echo date(lang_Date_type,$file_array['date'])?></div>
647
-				    <?php if($show_folder_size){ ?><div class="file-size"><?php echo makeSize($file_array['size'])?></div><?php } ?>
646
+				    <div class="file-date"><?php echo date(lang_Date_type, $file_array['date'])?></div>
647
+				    <?php if ($show_folder_size) { ?><div class="file-size"><?php echo makeSize($file_array['size'])?></div><?php } ?>
648 648
 				    <div class='file-extension'><?php echo lang_Type_dir; ?></div>
649 649
 				    <figcaption>
650
-					    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if($rename_folders && !$file_prevent_rename) echo "rename-folder"; ?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
651
-					    <i class="icon-pencil <?php if(!$rename_folders || $file_prevent_rename) echo 'icon-white'; ?>"></i></a>
652
-					    <a href="javascript:void('')" class="tip-left erase-button <?php if($delete_folders && !$file_prevent_delete) echo "delete-folder"; ?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_Folder_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>"  data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
653
-					    <i class="icon-trash <?php if(!$delete_folders || $file_prevent_delete) echo 'icon-white'; ?>"></i>
650
+					    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if ($rename_folders && !$file_prevent_rename) echo "rename-folder"; ?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
651
+					    <i class="icon-pencil <?php if (!$rename_folders || $file_prevent_rename) echo 'icon-white'; ?>"></i></a>
652
+					    <a href="javascript:void('')" class="tip-left erase-button <?php if ($delete_folders && !$file_prevent_delete) echo "delete-folder"; ?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_Folder_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>"  data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
653
+					    <i class="icon-trash <?php if (!$delete_folders || $file_prevent_delete) echo 'icon-white'; ?>"></i>
654 654
 					    </a>
655 655
 				    </figcaption>
656 656
 			<?php } ?>
@@ -661,101 +661,101 @@  discard block
 block discarded – undo
661 661
 			
662 662
             $files_prevent_duplicate = array();
663 663
 		    foreach ($files as $nu=>$file_array) {		
664
-			$file=$file_array['file'];
664
+			$file = $file_array['file'];
665 665
 		    
666
-			    if($file === '.' || $file === '..' || is_dir($current_path.$rfm_subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter!='' && strpos($file,$filter)===false))
666
+			    if ($file === '.' || $file === '..' || is_dir($current_path.$rfm_subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter != '' && strpos($file, $filter) === false))
667 667
 				    continue;
668 668
 			    
669
-			    $file_path=$current_path.$rfm_subfolder.$subdir.$file;
669
+			    $file_path = $current_path.$rfm_subfolder.$subdir.$file;
670 670
 			    //check if file have illegal caracter
671 671
 			    
672
-			    $filename=substr($file, 0, '-' . (strlen($file_array['extension']) + 1));
672
+			    $filename = substr($file, 0, '-'.(strlen($file_array['extension']) + 1));
673 673
 			    
674
-			    if($file!=fix_filename($file,$transliteration)){
675
-				$file1=fix_filename($file,$transliteration);
676
-				$file_path1=($current_path.$rfm_subfolder.$subdir.$file1);
677
-				if(file_exists($file_path1)){
674
+			    if ($file != fix_filename($file, $transliteration)) {
675
+				$file1 = fix_filename($file, $transliteration);
676
+				$file_path1 = ($current_path.$rfm_subfolder.$subdir.$file1);
677
+				if (file_exists($file_path1)) {
678 678
 				    $i = 1;
679
-				    $info=pathinfo($file1);
680
-				    while(file_exists($current_path.$rfm_subfolder.$subdir.$info['filename'].".[".$i."].".$info['extension'])) {
679
+				    $info = pathinfo($file1);
680
+				    while (file_exists($current_path.$rfm_subfolder.$subdir.$info['filename'].".[".$i."].".$info['extension'])) {
681 681
 					    $i++;
682 682
 				    }
683
-				    $file1=$info['filename'].".[".$i."].".$info['extension'];
684
-				    $file_path1=($current_path.$rfm_subfolder.$subdir.$file1);
683
+				    $file1 = $info['filename'].".[".$i."].".$info['extension'];
684
+				    $file_path1 = ($current_path.$rfm_subfolder.$subdir.$file1);
685 685
 				}
686 686
 				
687
-				$filename=substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
688
-				rename_file($file_path,fix_filename($filename,$transliteration),$transliteration);
689
-				$file=$file1;
690
-				$file_array['extension']=fix_filename($file_array['extension'],$transliteration);
691
-				$file_path=$file_path1;
687
+				$filename = substr($file1, 0, '-'.(strlen($file_array['extension']) + 1));
688
+				rename_file($file_path, fix_filename($filename, $transliteration), $transliteration);
689
+				$file = $file1;
690
+				$file_array['extension'] = fix_filename($file_array['extension'], $transliteration);
691
+				$file_path = $file_path1;
692 692
 			    }
693 693
 			    
694
-			    $is_img=false;
695
-			    $is_video=false;
696
-			    $is_audio=false;
697
-			    $show_original=false;
698
-			    $show_original_mini=false;
699
-			    $mini_src="";
700
-			    $src_thumb="";
701
-			    $extension_lower=fix_strtolower($file_array['extension']);
702
-			    if(in_array($extension_lower, $ext_img)){
703
-				$src = $base_url . $cur_dir . rawurlencode($file);
704
-				$mini_src = $src_thumb = $thumbs_path.$subdir. $file;
694
+			    $is_img = false;
695
+			    $is_video = false;
696
+			    $is_audio = false;
697
+			    $show_original = false;
698
+			    $show_original_mini = false;
699
+			    $mini_src = "";
700
+			    $src_thumb = "";
701
+			    $extension_lower = fix_strtolower($file_array['extension']);
702
+			    if (in_array($extension_lower, $ext_img)) {
703
+				$src = $base_url.$cur_dir.rawurlencode($file);
704
+				$mini_src = $src_thumb = $thumbs_path.$subdir.$file;
705 705
 				//add in thumbs folder if not exist
706
-				if(!file_exists($src_thumb)){
706
+				if (!file_exists($src_thumb)) {
707 707
 				    try {
708 708
 					create_img_gd($file_path, $src_thumb, 122, 91);
709
-					new_thumbnails_creation($current_path.$rfm_subfolder.$subdir,$file_path,$file,$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height);
709
+					new_thumbnails_creation($current_path.$rfm_subfolder.$subdir, $file_path, $file, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height);
710 710
 				    } catch (Exception $e) {
711
-					$src_thumb=$mini_src="";
711
+					$src_thumb = $mini_src = "";
712 712
 				    }
713 713
 				}
714
-				$is_img=true;
714
+				$is_img = true;
715 715
 				//check if is smaller than thumb
716
-				list($img_width, $img_height, $img_type, $attr)=getimagesize($file_path);
717
-				if($img_width<122 && $img_height<91){ 
718
-					$src_thumb=$current_path.$rfm_subfolder.$subdir.$file;
719
-					$show_original=true;
716
+				list($img_width, $img_height, $img_type, $attr) = getimagesize($file_path);
717
+				if ($img_width < 122 && $img_height < 91) { 
718
+					$src_thumb = $current_path.$rfm_subfolder.$subdir.$file;
719
+					$show_original = true;
720 720
 				}
721 721
 				
722
-				if($img_width<45 && $img_height<38){
723
-				    $mini_src=$current_path.$rfm_subfolder.$subdir.$file;
724
-				    $show_original_mini=true;
722
+				if ($img_width < 45 && $img_height < 38) {
723
+				    $mini_src = $current_path.$rfm_subfolder.$subdir.$file;
724
+				    $show_original_mini = true;
725 725
 				}
726 726
 			    }
727 727
 			    
728
-			    $is_icon_thumb=false;
729
-			    $is_icon_thumb_mini=false;
730
-			    $no_thumb=false;
731
-			    if($src_thumb==""){
732
-				$no_thumb=true;
733
-				if(file_exists('img/'.$icon_theme.'/'.$extension_lower.".jpg")){
734
-					$src_thumb ='img/'.$icon_theme.'/'.$extension_lower.".jpg";
735
-				}else{
728
+			    $is_icon_thumb = false;
729
+			    $is_icon_thumb_mini = false;
730
+			    $no_thumb = false;
731
+			    if ($src_thumb == "") {
732
+				$no_thumb = true;
733
+				if (file_exists('img/'.$icon_theme.'/'.$extension_lower.".jpg")) {
734
+					$src_thumb = 'img/'.$icon_theme.'/'.$extension_lower.".jpg";
735
+				} else {
736 736
 					$src_thumb = "img/".$icon_theme."/default.jpg";
737 737
 				}
738
-				$is_icon_thumb=true;
738
+				$is_icon_thumb = true;
739 739
 			    }
740
-			    if($mini_src==""){
741
-				$is_icon_thumb_mini=false;
740
+			    if ($mini_src == "") {
741
+				$is_icon_thumb_mini = false;
742 742
 			    }
743 743
 			    
744
-			    $class_ext=0;
744
+			    $class_ext = 0;
745 745
 			    if (in_array($extension_lower, $ext_video)) {
746 746
 				    $class_ext = 4;
747
-				    $is_video=true;
747
+				    $is_video = true;
748 748
 			    }elseif (in_array($extension_lower, $ext_img)) {
749 749
 				    $class_ext = 2;
750 750
 			    }elseif (in_array($extension_lower, $ext_music)) {
751 751
 				    $class_ext = 5;
752
-				    $is_audio=true;
752
+				    $is_audio = true;
753 753
 			    }elseif (in_array($extension_lower, $ext_misc)) {
754 754
 				    $class_ext = 3;
755
-			    }else{
755
+			    } else {
756 756
 				    $class_ext = 1;
757 757
 			    }
758
-			    if((!($_GET['type']==1 && !$is_img) && !(($_GET['type']==3 && !$is_video) && ($_GET['type']==3 && !$is_audio))) && $class_ext>0){
758
+			    if ((!($_GET['type'] == 1 && !$is_img) && !(($_GET['type'] == 3 && !$is_video) && ($_GET['type'] == 3 && !$is_audio))) && $class_ext > 0) {
759 759
 ?>
760 760
 		    <li class="ff-item-type-<?php echo $class_ext; ?> file"  data-name="<?php echo $file; ?>"><?php
761 761
 		    $file_prevent_rename = false;
@@ -767,39 +767,39 @@  discard block
 block discarded – undo
767 767
 			$file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
768 768
 			$file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
769 769
 		    }
770
-            ?>		<figure data-name="<?php echo $file ?>" data-type="<?php if($is_img){ echo "img"; }else{ echo "file"; } ?>">
770
+            ?>		<figure data-name="<?php echo $file ?>" data-type="<?php if ($is_img) { echo "img"; } else { echo "file"; } ?>">
771 771
 				<a href="javascript:void('')" class="link" data-file="<?php echo $file; ?>" data-field_id="<?php echo $field_id; ?>" data-function="<?php echo $apply; ?>">
772 772
 				<div class="img-precontainer">
773
-				    <?php if($is_icon_thumb){ ?><div class="filetype"><?php echo $extension_lower ?></div><?php } ?>
773
+				    <?php if ($is_icon_thumb) { ?><div class="filetype"><?php echo $extension_lower ?></div><?php } ?>
774 774
 				    <div class="img-container">
775 775
 					    <span></span>
776
-					    <img alt="<?php echo $filename." thumbnails";?>" class="<?php echo $show_original ? "original" : "" ?> <?php echo $is_icon_thumb ? "icon" : "" ?>" src="<?php echo $src_thumb; ?>">
776
+					    <img alt="<?php echo $filename." thumbnails"; ?>" class="<?php echo $show_original ? "original" : "" ?> <?php echo $is_icon_thumb ? "icon" : "" ?>" src="<?php echo $src_thumb; ?>">
777 777
 				    </div>
778 778
 				</div>
779
-				<div class="img-precontainer-mini <?php if($is_img) echo 'original-thumb' ?>">
780
-				    <div class="filetype <?php echo $extension_lower ?> <?php if(!$is_icon_thumb){ echo "hide"; }?>"><?php echo $extension_lower ?></div>
779
+				<div class="img-precontainer-mini <?php if ($is_img) echo 'original-thumb' ?>">
780
+				    <div class="filetype <?php echo $extension_lower ?> <?php if (!$is_icon_thumb) { echo "hide"; }?>"><?php echo $extension_lower ?></div>
781 781
 				    <div class="img-container-mini">
782 782
 					<span></span>
783
-					<?php if($mini_src!=""){ ?>
784
-					<img alt="<?php echo $filename." thumbnails";?>" class="<?php echo $show_original_mini ? "original" : "" ?> <?php echo $is_icon_thumb_mini ? "icon" : "" ?>" src="<?php echo $mini_src; ?>">
783
+					<?php if ($mini_src != "") { ?>
784
+					<img alt="<?php echo $filename." thumbnails"; ?>" class="<?php echo $show_original_mini ? "original" : "" ?> <?php echo $is_icon_thumb_mini ? "icon" : "" ?>" src="<?php echo $mini_src; ?>">
785 785
 					<?php } ?>
786 786
 				    </div>
787 787
 				</div>
788
-				<?php if($is_icon_thumb){ ?>
788
+				<?php if ($is_icon_thumb) { ?>
789 789
 				<div class="cover"></div>
790 790
 				<?php } ?>
791 791
 				</a>	
792 792
 				<div class="box">				
793
-				<h4 class="<?php if($ellipsis_title_after_first_row){ echo "ellipsis"; } ?>"><a href="javascript:void('')" class="link" data-file="<?php echo $file; ?>" data-field_id="<?php echo $field_id; ?>" data-function="<?php echo $apply; ?>">
793
+				<h4 class="<?php if ($ellipsis_title_after_first_row) { echo "ellipsis"; } ?>"><a href="javascript:void('')" class="link" data-file="<?php echo $file; ?>" data-field_id="<?php echo $field_id; ?>" data-function="<?php echo $apply; ?>">
794 794
 				<?php echo $filename; ?></a> </h4>
795 795
 				</div>
796 796
 				<input type="hidden" class="date" value="<?php echo $file_array['date']; ?>"/>
797 797
 				<input type="hidden" class="size" value="<?php echo $file_array['size'] ?>"/>
798 798
 				<input type="hidden" class="extension" value="<?php echo $extension_lower; ?>"/>
799 799
 				<input type="hidden" class="name" value=""/>
800
-				<div class="file-date"><?php echo date(lang_Date_type,$file_array['date'])?></div>
800
+				<div class="file-date"><?php echo date(lang_Date_type, $file_array['date'])?></div>
801 801
 				<div class="file-size"><?php echo makeSize($file_array['size'])?></div>
802
-				<div class='img-dimension'><?php if($is_img){ echo $img_width."x".$img_height; } ?></div>
802
+				<div class='img-dimension'><?php if ($is_img) { echo $img_width."x".$img_height; } ?></div>
803 803
 				<div class='file-extension'><?php echo $extension_lower; ?></div>
804 804
 				<figcaption>
805 805
 				    <form action="force_download.php" method="post" class="download-form" id="form<?php echo $nu; ?>">
@@ -807,20 +807,20 @@  discard block
 block discarded – undo
807 807
 					<input type="hidden" class="name_download" name="name" value="<?php echo $file?>"/>
808 808
 					
809 809
 				    <a title="<?php echo lang_Download?>" class="tip-right" href="javascript:void('')" onclick="$('#form<?php echo $nu; ?>').submit();"><i class="icon-download"></i></a>
810
-				    <?php if($is_img && $src_thumb!=""){ ?>
811
-				    <a class="tip-right preview" title="<?php echo lang_Preview?>" data-url="<?php echo $src;?>" data-toggle="lightbox" href="#previewLightbox"><i class=" icon-eye-open"></i></a>
812
-				    <?php }elseif(($is_video || $is_audio) && in_array($extension_lower,$jplayer_ext)){ ?>
813
-				    <a class="tip-right modalAV <?php if($is_audio){ echo "audio"; }else{ echo "video"; } ?>"
814
-					title="<?php echo lang_Preview?>" data-url="ajax_calls.php?action=media_preview&title=<?php echo $filename; ?>&file=<?php echo $current_path.$rfm_subfolder.$subdir.$file;; ?>"
810
+				    <?php if ($is_img && $src_thumb != "") { ?>
811
+				    <a class="tip-right preview" title="<?php echo lang_Preview?>" data-url="<?php echo $src; ?>" data-toggle="lightbox" href="#previewLightbox"><i class=" icon-eye-open"></i></a>
812
+				    <?php }elseif (($is_video || $is_audio) && in_array($extension_lower, $jplayer_ext)) { ?>
813
+				    <a class="tip-right modalAV <?php if ($is_audio) { echo "audio"; } else { echo "video"; } ?>"
814
+					title="<?php echo lang_Preview?>" data-url="ajax_calls.php?action=media_preview&title=<?php echo $filename; ?>&file=<?php echo $current_path.$rfm_subfolder.$subdir.$file; ; ?>"
815 815
 					href="javascript:void('');" ><i class=" icon-eye-open"></i></a>
816
-				    <?php }else{ ?>
816
+				    <?php } else { ?>
817 817
 				    <a class="preview disabled"><i class="icon-eye-open icon-white"></i></a>
818 818
 				    <?php } ?>
819
-				    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if($rename_files && !$file_prevent_rename) echo "rename-file"; ?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir .$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
820
- 				    <i class="icon-pencil <?php if(!$rename_files || $file_prevent_rename) echo 'icon-white'; ?>"></i></a>
819
+				    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if ($rename_files && !$file_prevent_rename) echo "rename-file"; ?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
820
+ 				    <i class="icon-pencil <?php if (!$rename_files || $file_prevent_rename) echo 'icon-white'; ?>"></i></a>
821 821
 
822
-				    <a href="javascript:void('')" class="tip-left erase-button <?php if($delete_files && !$file_prevent_delete) echo "delete-file"; ?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
823
- 				    <i class="icon-trash <?php if(!$delete_files || $file_prevent_delete) echo 'icon-white'; ?>"></i>
822
+				    <a href="javascript:void('')" class="tip-left erase-button <?php if ($delete_files && !$file_prevent_delete) echo "delete-file"; ?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
823
+ 				    <i class="icon-trash <?php if (!$delete_files || $file_prevent_delete) echo 'icon-white'; ?>"></i>
824 824
 				    </a>
825 825
 				    </form>
826 826
 				</figcaption>
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
     var files_prevent_duplicate = new Array();
841 841
     <?php
842 842
     foreach ($files_prevent_duplicate as $key => $value): ?>
843
-        files_prevent_duplicate[<?php echo $key;?>] = '<?php echo $value; ?>';
843
+        files_prevent_duplicate[<?php echo $key; ?>] = '<?php echo $value; ?>';
844 844
     <?php endforeach; ?>
845 845
 </script>
846 846
 
Please login to merge, or discard this patch.
Braces   +192 added lines, -77 removed lines patch added patch discarded remove patch
@@ -7,26 +7,28 @@  discard block
 block discarded – undo
7 7
 
8 8
 include('upload.php');
9 9
 
10
-}else{
10
+} else{
11 11
 
12 12
 include('include/utils.php');
13 13
 
14 14
 if (isset($_GET['fldr'])
15 15
     && !empty($_GET['fldr'])
16 16
     && strpos($_GET['fldr'],'../')===FALSE
17
-    && strpos($_GET['fldr'],'./')===FALSE)
17
+    && strpos($_GET['fldr'],'./')===FALSE) {
18 18
     $subdir = urldecode(trim(strip_tags($_GET['fldr']),"/") ."/");
19
-else
19
+} else {
20 20
     $subdir = '';
21
+}
21 22
     
22 23
 //remember last position
23 24
 setcookie('last_position',$subdir,time() + (86400 * 7)); 
24 25
 
25 26
 if($subdir==""){
26 27
     if(!empty($_COOKIE['last_position'])
27
-	&& strpos($_COOKIE['last_position'],'.')===FALSE)
28
-	$subdir= trim($_COOKIE['last_position']);
29
-}
28
+	&& strpos($_COOKIE['last_position'],'.')===FALSE) {
29
+    	$subdir= trim($_COOKIE['last_position']);
30
+    }
31
+    }
30 32
 
31 33
 if($subdir==="/"){
32 34
     $subdir="";
@@ -36,13 +38,19 @@  discard block
 block discarded – undo
36 38
 /***
37 39
  *SUB-DIR CODE
38 40
  ***/
39
-if(!isset($_SESSION['RF']["subfolder"])) $_SESSION['RF']["subfolder"]='';
41
+if(!isset($_SESSION['RF']["subfolder"])) {
42
+    $_SESSION['RF']["subfolder"]='';
43
+}
40 44
 $rfm_subfolder = '';
41 45
 if(!empty($_SESSION['RF']["subfolder"]) && strpos($_SESSION['RF']["subfolder"],'../')===FALSE
42 46
    && strpos($_SESSION['RF']["subfolder"],'./')===FALSE && strpos($_SESSION['RF']["subfolder"],"/")!==0
43
-    && strpos($_SESSION['RF']["subfolder"],'.')===FALSE) $rfm_subfolder= $_SESSION['RF']['subfolder'];
47
+    && strpos($_SESSION['RF']["subfolder"],'.')===FALSE) {
48
+    $rfm_subfolder= $_SESSION['RF']['subfolder'];
49
+}
44 50
    
45
-if($rfm_subfolder!="" && $rfm_subfolder[strlen($rfm_subfolder)-1]!=="/") $rfm_subfolder.="/";
51
+if($rfm_subfolder!="" && $rfm_subfolder[strlen($rfm_subfolder)-1]!=="/") {
52
+    $rfm_subfolder.="/";
53
+}
46 54
    
47 55
 if(!file_exists($current_path . $rfm_subfolder.$subdir)){
48 56
     $subdir='';
@@ -56,7 +64,7 @@  discard block
 block discarded – undo
56 64
     $cur_path = $current_path . $subdir;
57 65
     $thumbs_path = $thumbs_base_path;
58 66
     $parent=$subdir;
59
-}else{
67
+} else{
60 68
     $cur_dir = $upload_dir . $rfm_subfolder.$subdir;
61 69
     $cur_path = $current_path . $rfm_subfolder.$subdir;
62 70
     $thumbs_path = $thumbs_base_path. $rfm_subfolder;
@@ -68,21 +76,30 @@  discard block
 block discarded – undo
68 76
 $i=0;
69 77
 while($cycle && $i<$max_cycles){
70 78
     $i++;
71
-    if($parent==="./") $parent="";
79
+    if($parent==="./") {
80
+        $parent="";
81
+    }
72 82
     if(file_exists($current_path.$parent."config.php")){
73 83
 	require_once($current_path.$parent."config.php");
74 84
 	$cycle=false;
75 85
     }
76 86
     
77
-    if($parent=="") $cycle=false;
78
-    else $parent=fix_dirname($parent)."/";
79
-}
87
+    if($parent=="") {
88
+        $cycle=false;
89
+    } else {
90
+        $parent=fix_dirname($parent)."/";
91
+    }
92
+    }
80 93
 
81 94
 if(!is_dir($thumbs_path.$subdir)){
82 95
     create_folder(false, $thumbs_path.$subdir);
83 96
 }
84 97
 
85
-if(isset($_GET['popup'])) $popup= strip_tags($_GET['popup']); else $popup=0;
98
+if(isset($_GET['popup'])) {
99
+    $popup= strip_tags($_GET['popup']);
100
+} else {
101
+    $popup=0;
102
+}
86 103
 //Sanitize popup
87 104
 $popup=!!$popup;
88 105
 
@@ -91,16 +108,29 @@  discard block
 block discarded – undo
91 108
 if(isset($_GET['view'])){ $view=fix_get_params($_GET['view']); $_SESSION['RF']["view_type"] = $view; }
92 109
 $view=$_SESSION['RF']["view_type"];
93 110
 
94
-if(isset($_GET["filter"])) $filter=fix_get_params($_GET["filter"]);
95
-else $filter='';
111
+if(isset($_GET["filter"])) {
112
+    $filter=fix_get_params($_GET["filter"]);
113
+} else {
114
+    $filter='';
115
+}
96 116
 
97
-if(!isset($_SESSION['RF']['sort_by'])) $_SESSION['RF']['sort_by']='';
98
-if(isset($_GET["sort_by"])) $sort_by=$_SESSION['RF']['sort_by']=fix_get_params($_GET["sort_by"]);
99
-else $sort_by=$_SESSION['RF']['sort_by'];
117
+if(!isset($_SESSION['RF']['sort_by'])) {
118
+    $_SESSION['RF']['sort_by']='';
119
+}
120
+if(isset($_GET["sort_by"])) {
121
+    $sort_by=$_SESSION['RF']['sort_by']=fix_get_params($_GET["sort_by"]);
122
+} else {
123
+    $sort_by=$_SESSION['RF']['sort_by'];
124
+}
100 125
 
101
-if(!isset($_SESSION['RF']['descending'])) $_SESSION['RF']['descending']=false;
102
-if(isset($_GET["descending"])) $descending=$_SESSION['RF']['descending']=fix_get_params($_GET["descending"])==="true";
103
-else $descending=$_SESSION['RF']['descending'];
126
+if(!isset($_SESSION['RF']['descending'])) {
127
+    $_SESSION['RF']['descending']=false;
128
+}
129
+if(isset($_GET["descending"])) {
130
+    $descending=$_SESSION['RF']['descending']=fix_get_params($_GET["descending"])==="true";
131
+} else {
132
+    $descending=$_SESSION['RF']['descending'];
133
+}
104 134
 
105 135
 
106 136
 $lang=$default_language;
@@ -114,8 +144,7 @@  discard block
 block discarded – undo
114 144
     $path_parts = pathinfo($lang);
115 145
     if(is_readable('lang/' .$path_parts['basename']. '.php')){ 
116 146
         $language_file = 'lang/' .$path_parts['basename']. '.php';
117
-    }
118
-    else {
147
+    } else {
119 148
     	echo "<script>console.log('The ".$lang." language file is not readable! Falling back...');</script>";
120 149
     }
121 150
 }
@@ -124,8 +153,12 @@  discard block
 block discarded – undo
124 153
 $_SESSION['RF']['language_file'] = $language_file;
125 154
 require_once $language_file;
126 155
 
127
-if(!isset($_GET['type'])) $_GET['type']=0;
128
-if(!isset($_GET['field_id'])) $_GET['field_id']='';
156
+if(!isset($_GET['type'])) {
157
+    $_GET['type']=0;
158
+}
159
+if(!isset($_GET['field_id'])) {
160
+    $_GET['field_id']='';
161
+}
129 162
 
130 163
 $field_id=isset($_GET['field_id']) ? fix_get_params($_GET['field_id']) : '';
131 164
 $type_param=fix_get_params($_GET['type']);
@@ -222,7 +255,7 @@  discard block
 block discarded – undo
222 255
 	if($aviary_active){
223 256
 	if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { ?>
224 257
 	    <script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
225
-	<?php }else{ ?>
258
+	<?php } else{ ?>
226 259
 	    <script type="text/javascript" src="http://feather.aviary.com/js/feather.js "></script>
227 260
 	<?php }} ?>
228 261
 	
@@ -306,7 +339,12 @@  discard block
 block discarded – undo
306 339
 	<input type="hidden" id="cancel" value="<?php echo lang_Cancel; ?>" />
307 340
 	<input type="hidden" id="rename" value="<?php echo lang_Rename; ?>" />
308 341
 	<input type="hidden" id="lang_duplicate" value="<?php echo lang_Duplicate; ?>" />
309
-	<input type="hidden" id="duplicate" value="<?php if($duplicate_files) echo 1; else echo 0; ?>" />
342
+	<input type="hidden" id="duplicate" value="<?php if($duplicate_files) {
343
+    echo 1;
344
+} else {
345
+    echo 0;
346
+}
347
+?>" />
310 348
 	<input type="hidden" id="base_url" value="<?php echo $base_url?>"/>
311 349
 	<input type="hidden" id="base_url_true" value="<?php echo base_url(); ?>"/>
312 350
 	<input type="hidden" id="fldr_value" value="<?php echo $subdir; ?>"/>
@@ -316,8 +354,18 @@  discard block
 block discarded – undo
316 354
 	<?php $protocol = 'http'; ?>
317 355
 	<input type="hidden" id="current_url" value="<?php echo str_replace(array('&filter='.$filter),array(''),$protocol."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>" />
318 356
 	<input type="hidden" id="lang_show_url" value="<?php echo lang_Show_url; ?>" />
319
-	<input type="hidden" id="copy_cut_files_allowed" value="<?php if($copy_cut_files) echo 1; else echo 0; ?>" />
320
-	<input type="hidden" id="copy_cut_dirs_allowed" value="<?php if($copy_cut_dirs) echo 1; else echo 0; ?>" />
357
+	<input type="hidden" id="copy_cut_files_allowed" value="<?php if($copy_cut_files) {
358
+    echo 1;
359
+} else {
360
+    echo 0;
361
+}
362
+?>" />
363
+	<input type="hidden" id="copy_cut_dirs_allowed" value="<?php if($copy_cut_dirs) {
364
+    echo 1;
365
+} else {
366
+    echo 0;
367
+}
368
+?>" />
321 369
 	<input type="hidden" id="copy_cut_max_size" value="<?php echo $copy_cut_max_size; ?>" />
322 370
 	<input type="hidden" id="copy_cut_max_count" value="<?php echo $copy_cut_max_count; ?>" />
323 371
 	<input type="hidden" id="lang_copy" value="<?php echo lang_Copy; ?>" />
@@ -385,11 +433,17 @@  discard block
 block discarded – undo
385 433
 $class_ext = '';
386 434
 $src = '';
387 435
 
388
-if ($_GET['type']==1) 	 $apply = 'apply_img';
389
-elseif($_GET['type']==2) $apply = 'apply_link';
390
-elseif($_GET['type']==0 && $_GET['field_id']=='') $apply = 'apply_none';
391
-elseif($_GET['type']==3) $apply = 'apply_video';
392
-else $apply = 'apply';
436
+if ($_GET['type']==1) {
437
+    $apply = 'apply_img';
438
+} elseif($_GET['type']==2) {
439
+    $apply = 'apply_link';
440
+} elseif($_GET['type']==0 && $_GET['field_id']=='') {
441
+    $apply = 'apply_none';
442
+} elseif($_GET['type']==3) {
443
+    $apply = 'apply_video';
444
+} else {
445
+    $apply = 'apply';
446
+}
393 447
 
394 448
 $files = scandir($current_path.$rfm_subfolder.$subdir);
395 449
 $n_files=count($files);
@@ -399,14 +453,16 @@  discard block
 block discarded – undo
399 453
 $current_folder=array();
400 454
 $prev_folder=array();
401 455
 foreach($files as $k=>$file){
402
-    if($file===".") $current_folder=array('file'=>$file);
403
-    elseif($file==="..") $prev_folder=array('file'=>$file);
404
-    elseif(is_dir($current_path.$rfm_subfolder.$subdir.$file)){
456
+    if($file===".") {
457
+        $current_folder=array('file'=>$file);
458
+    } elseif($file==="..") {
459
+        $prev_folder=array('file'=>$file);
460
+    } elseif(is_dir($current_path.$rfm_subfolder.$subdir.$file)){
405 461
 	$date=filemtime($current_path.$rfm_subfolder.$subdir. $file);
406 462
 	$size=foldersize($current_path.$rfm_subfolder.$subdir. $file);
407 463
 	$file_ext=lang_Type_dir;
408 464
 	$sorted[$k]=array('file'=>$file,'date'=>$date,'size'=>$size,'extension'=>$file_ext);
409
-    }else{
465
+    } else{
410 466
 	$file_path=$current_path.$rfm_subfolder.$subdir.$file;
411 467
 	$date=filemtime($file_path);
412 468
 	$size=filesize($file_path);
@@ -480,9 +536,27 @@  discard block
 block discarded – undo
480 536
 			<div class="span3 half view-controller">
481 537
 
482 538
 				<span><?php echo lang_View; ?>:</span>
483
-			    <button class="btn tip<?php if($view==0) echo " btn-inverse"; ?>" id="view0" data-value="0" title="<?php echo lang_View_boxes; ?>"><i class="icon-th <?php if($view==0) echo "icon-white"; ?>"></i></button>
484
-			    <button class="btn tip<?php if($view==1) echo " btn-inverse"; ?>" id="view1" data-value="1" title="<?php echo lang_View_list; ?>"><i class="icon-align-justify <?php if($view==1) echo "icon-white"; ?>"></i></button>
485
-			    <button class="btn tip<?php if($view==2) echo " btn-inverse"; ?>" id="view2" data-value="2" title="<?php echo lang_View_columns_list; ?>"><i class="icon-fire <?php if($view==2) echo "icon-white"; ?>"></i></button>
539
+			    <button class="btn tip<?php if($view==0) {
540
+    echo " btn-inverse";
541
+}
542
+?>" id="view0" data-value="0" title="<?php echo lang_View_boxes; ?>"><i class="icon-th <?php if($view==0) {
543
+    echo "icon-white";
544
+}
545
+?>"></i></button>
546
+			    <button class="btn tip<?php if($view==1) {
547
+    echo " btn-inverse";
548
+}
549
+?>" id="view1" data-value="1" title="<?php echo lang_View_list; ?>"><i class="icon-align-justify <?php if($view==1) {
550
+    echo "icon-white";
551
+}
552
+?>"></i></button>
553
+			    <button class="btn tip<?php if($view==2) {
554
+    echo " btn-inverse";
555
+}
556
+?>" id="view2" data-value="2" title="<?php echo lang_View_columns_list; ?>"><i class="icon-fire <?php if($view==2) {
557
+    echo "icon-white";
558
+}
559
+?>"></i></button>
486 560
 			</div>
487 561
 			<div class="span6 half types"> 
488 562
 				<span><?php echo lang_Filters; ?>:</span>
@@ -525,12 +599,13 @@  discard block
 block discarded – undo
525 599
 	<?php
526 600
 	$bc=explode("/",$subdir);
527 601
 	$tmp_path='';
528
-	if(!empty($bc))
529
-	foreach($bc as $k=>$b){ 
602
+	if(!empty($bc)) {
603
+		foreach($bc as $k=>$b){ 
530 604
 		$tmp_path.=$b."/";
605
+	}
531 606
 		if($k==count($bc)-2){
532 607
 	?> <li class="active"><?php echo $b?></li><?php
533
-		}elseif($b!=""){ ?>
608
+		} elseif($b!=""){ ?>
534 609
 		<li><a href="<?php echo $link.$tmp_path?>"><?php echo $b?></a></li><li><span class="divider"><?php echo "/"; ?></span></li>
535 610
 	<?php }
536 611
 	}
@@ -561,7 +636,7 @@  discard block
 block discarded – undo
561 636
 	    <?php if(@opendir($current_path.$rfm_subfolder.$subdir)===FALSE){ ?>
562 637
 	    <br/>
563 638
 	    <div class="alert alert-error">There is an error! The upload folder there isn't. Check your config.php file. </div> 
564
-	    <?php }else{ ?>
639
+	    <?php } else{ ?>
565 640
 	    <h4 id="help"><?php echo lang_Swipe_help; ?></h4>
566 641
 	    <?php if(isset($folder_message)){ ?>
567 642
 		<div class="alert alert-block"><?php echo $folder_message; ?></div>
@@ -586,8 +661,9 @@  discard block
 block discarded – undo
586 661
 		$jplayer_ext=array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav");
587 662
 		foreach ($files as $file_array) {
588 663
 		    $file=$file_array['file'];
589
-			if($file === '.' || (isset($file_array['extension']) && $file_array['extension']!=lang_Type_dir) || ($file === '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter!='' && $file!==".." && strpos($file,$filter)===false))
590
-			    continue;
664
+			if($file === '.' || (isset($file_array['extension']) && $file_array['extension']!=lang_Type_dir) || ($file === '..' && $subdir == '') || in_array($file, $hidden_folders) || ($filter!='' && $file!==".." && strpos($file,$filter)===false)) {
665
+						    continue;
666
+			}
591 667
 			$new_name=fix_filename($file,$transliteration);
592 668
 			if($file!=='..' && $file!=$new_name){
593 669
 			    //rename
@@ -595,27 +671,38 @@  discard block
 block discarded – undo
595 671
 			    $file=$new_name;
596 672
 			}
597 673
 			//add in thumbs folder if not exist 
598
-			if (!file_exists($thumbs_path.$subdir.$file)) create_folder(false,$thumbs_path.$subdir.$file);
674
+			if (!file_exists($thumbs_path.$subdir.$file)) {
675
+			    create_folder(false,$thumbs_path.$subdir.$file);
676
+			}
599 677
 			$class_ext = 3;			
600 678
 			if($file==='..' && trim($subdir) != '' ){
601 679
 			    $src = explode("/",$subdir);
602 680
 			    unset($src[count($src)-2]);
603 681
 			    $src=implode("/",$src);
604
-			    if($src==='') $src="/";
605
-			}
606
-			elseif ($file!=='..') {
682
+			    if($src==='') {
683
+			        $src="/";
684
+			    }
685
+			} elseif ($file!=='..') {
607 686
 			    $src = $subdir . $file."/";
608 687
 			}
609 688
 			
610 689
 			?>
611
-			    <li data-name="<?php echo $file ?>" <?php if($file==='..') echo 'class="back"'; else echo 'class="dir"'; ?>><?php
690
+			    <li data-name="<?php echo $file ?>" <?php if($file==='..') {
691
+    echo 'class="back"';
692
+} else {
693
+    echo 'class="dir"';
694
+}
695
+?>><?php
612 696
 			    $file_prevent_rename = false;
613 697
 			    $file_prevent_delete = false;
614 698
 			    if (isset($filePermissions[$file])) {
615 699
 				$file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
616 700
 				$file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
617 701
 			    }
618
-			    ?>	<figure data-name="<?php echo $file ?>" class="<?php if($file==="..") echo "back-"; ?>directory" data-type="<?php if($file!==".."){ echo "dir"; } ?>">
702
+			    ?>	<figure data-name="<?php echo $file ?>" class="<?php if($file==="..") {
703
+			        echo "back-";
704
+			    }
705
+			    ?>directory" data-type="<?php if($file!==".."){ echo "dir"; } ?>">
619 706
 				    <a class="folder-link" href="dialog.php?<?php echo $get_params.rawurlencode($src)."&".uniqid() ?>">
620 707
 				    <div class="img-precontainer">
621 708
 					<div class="img-container directory"><span></span>
@@ -634,7 +721,7 @@  discard block
 block discarded – undo
634 721
 				    </div>
635 722
 				    </a>
636 723
 				    
637
-			<?php }else{ ?>
724
+			<?php } else{ ?>
638 725
 				    </a>
639 726
 				    <div class="box">
640 727
 					<h4 class="<?php if($ellipsis_title_after_first_row){ echo "ellipsis"; } ?>"><a class="folder-link" data-file="<?php echo $file ?>" href="dialog.php?<?php echo $get_params.rawurlencode($src)."&".uniqid() ?>"><?php echo $file; ?></a></h4>
@@ -647,10 +734,22 @@  discard block
 block discarded – undo
647 734
 				    <?php if($show_folder_size){ ?><div class="file-size"><?php echo makeSize($file_array['size'])?></div><?php } ?>
648 735
 				    <div class='file-extension'><?php echo lang_Type_dir; ?></div>
649 736
 				    <figcaption>
650
-					    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if($rename_folders && !$file_prevent_rename) echo "rename-folder"; ?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
651
-					    <i class="icon-pencil <?php if(!$rename_folders || $file_prevent_rename) echo 'icon-white'; ?>"></i></a>
652
-					    <a href="javascript:void('')" class="tip-left erase-button <?php if($delete_folders && !$file_prevent_delete) echo "delete-folder"; ?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_Folder_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>"  data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
653
-					    <i class="icon-trash <?php if(!$delete_folders || $file_prevent_delete) echo 'icon-white'; ?>"></i>
737
+					    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if($rename_folders && !$file_prevent_rename) {
738
+    echo "rename-folder";
739
+}
740
+?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir.$file; ?>">
741
+					    <i class="icon-pencil <?php if(!$rename_folders || $file_prevent_rename) {
742
+    echo 'icon-white';
743
+}
744
+?>"></i></a>
745
+					    <a href="javascript:void('')" class="tip-left erase-button <?php if($delete_folders && !$file_prevent_delete) {
746
+    echo "delete-folder";
747
+}
748
+?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_Folder_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>"  data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
749
+					    <i class="icon-trash <?php if(!$delete_folders || $file_prevent_delete) {
750
+    echo 'icon-white';
751
+}
752
+?>"></i>
654 753
 					    </a>
655 754
 				    </figcaption>
656 755
 			<?php } ?>
@@ -663,8 +762,9 @@  discard block
 block discarded – undo
663 762
 		    foreach ($files as $nu=>$file_array) {		
664 763
 			$file=$file_array['file'];
665 764
 		    
666
-			    if($file === '.' || $file === '..' || is_dir($current_path.$rfm_subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter!='' && strpos($file,$filter)===false))
667
-				    continue;
765
+			    if($file === '.' || $file === '..' || is_dir($current_path.$rfm_subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter!='' && strpos($file,$filter)===false)) {
766
+			    				    continue;
767
+			    }
668 768
 			    
669 769
 			    $file_path=$current_path.$rfm_subfolder.$subdir.$file;
670 770
 			    //check if file have illegal caracter
@@ -732,7 +832,7 @@  discard block
 block discarded – undo
732 832
 				$no_thumb=true;
733 833
 				if(file_exists('img/'.$icon_theme.'/'.$extension_lower.".jpg")){
734 834
 					$src_thumb ='img/'.$icon_theme.'/'.$extension_lower.".jpg";
735
-				}else{
835
+				} else{
736 836
 					$src_thumb = "img/".$icon_theme."/default.jpg";
737 837
 				}
738 838
 				$is_icon_thumb=true;
@@ -745,14 +845,14 @@  discard block
 block discarded – undo
745 845
 			    if (in_array($extension_lower, $ext_video)) {
746 846
 				    $class_ext = 4;
747 847
 				    $is_video=true;
748
-			    }elseif (in_array($extension_lower, $ext_img)) {
848
+			    } elseif (in_array($extension_lower, $ext_img)) {
749 849
 				    $class_ext = 2;
750
-			    }elseif (in_array($extension_lower, $ext_music)) {
850
+			    } elseif (in_array($extension_lower, $ext_music)) {
751 851
 				    $class_ext = 5;
752 852
 				    $is_audio=true;
753
-			    }elseif (in_array($extension_lower, $ext_misc)) {
853
+			    } elseif (in_array($extension_lower, $ext_misc)) {
754 854
 				    $class_ext = 3;
755
-			    }else{
855
+			    } else{
756 856
 				    $class_ext = 1;
757 857
 			    }
758 858
 			    if((!($_GET['type']==1 && !$is_img) && !(($_GET['type']==3 && !$is_video) && ($_GET['type']==3 && !$is_audio))) && $class_ext>0){
@@ -767,7 +867,7 @@  discard block
 block discarded – undo
767 867
 			$file_prevent_rename = isset($filePermissions[$file]['prevent_rename']) && $filePermissions[$file]['prevent_rename'];
768 868
 			$file_prevent_delete = isset($filePermissions[$file]['prevent_delete']) && $filePermissions[$file]['prevent_delete'];
769 869
 		    }
770
-            ?>		<figure data-name="<?php echo $file ?>" data-type="<?php if($is_img){ echo "img"; }else{ echo "file"; } ?>">
870
+            ?>		<figure data-name="<?php echo $file ?>" data-type="<?php if($is_img){ echo "img"; } else{ echo "file"; } ?>">
771 871
 				<a href="javascript:void('')" class="link" data-file="<?php echo $file; ?>" data-field_id="<?php echo $field_id; ?>" data-function="<?php echo $apply; ?>">
772 872
 				<div class="img-precontainer">
773 873
 				    <?php if($is_icon_thumb){ ?><div class="filetype"><?php echo $extension_lower ?></div><?php } ?>
@@ -776,8 +876,11 @@  discard block
 block discarded – undo
776 876
 					    <img alt="<?php echo $filename." thumbnails";?>" class="<?php echo $show_original ? "original" : "" ?> <?php echo $is_icon_thumb ? "icon" : "" ?>" src="<?php echo $src_thumb; ?>">
777 877
 				    </div>
778 878
 				</div>
779
-				<div class="img-precontainer-mini <?php if($is_img) echo 'original-thumb' ?>">
780
-				    <div class="filetype <?php echo $extension_lower ?> <?php if(!$is_icon_thumb){ echo "hide"; }?>"><?php echo $extension_lower ?></div>
879
+				<div class="img-precontainer-mini <?php if($is_img) {
880
+    echo 'original-thumb' ?>">
881
+				    <div class="filetype <?php echo $extension_lower ?> <?php if(!$is_icon_thumb){ echo "hide";
882
+}
883
+}?>"><?php echo $extension_lower ?></div>
781 884
 				    <div class="img-container-mini">
782 885
 					<span></span>
783 886
 					<?php if($mini_src!=""){ ?>
@@ -809,18 +912,30 @@  discard block
 block discarded – undo
809 912
 				    <a title="<?php echo lang_Download?>" class="tip-right" href="javascript:void('')" onclick="$('#form<?php echo $nu; ?>').submit();"><i class="icon-download"></i></a>
810 913
 				    <?php if($is_img && $src_thumb!=""){ ?>
811 914
 				    <a class="tip-right preview" title="<?php echo lang_Preview?>" data-url="<?php echo $src;?>" data-toggle="lightbox" href="#previewLightbox"><i class=" icon-eye-open"></i></a>
812
-				    <?php }elseif(($is_video || $is_audio) && in_array($extension_lower,$jplayer_ext)){ ?>
813
-				    <a class="tip-right modalAV <?php if($is_audio){ echo "audio"; }else{ echo "video"; } ?>"
915
+				    <?php } elseif(($is_video || $is_audio) && in_array($extension_lower,$jplayer_ext)){ ?>
916
+				    <a class="tip-right modalAV <?php if($is_audio){ echo "audio"; } else{ echo "video"; } ?>"
814 917
 					title="<?php echo lang_Preview?>" data-url="ajax_calls.php?action=media_preview&title=<?php echo $filename; ?>&file=<?php echo $current_path.$rfm_subfolder.$subdir.$file;; ?>"
815 918
 					href="javascript:void('');" ><i class=" icon-eye-open"></i></a>
816
-				    <?php }else{ ?>
919
+				    <?php } else{ ?>
817 920
 				    <a class="preview disabled"><i class="icon-eye-open icon-white"></i></a>
818 921
 				    <?php } ?>
819
-				    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if($rename_files && !$file_prevent_rename) echo "rename-file"; ?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir .$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
820
- 				    <i class="icon-pencil <?php if(!$rename_files || $file_prevent_rename) echo 'icon-white'; ?>"></i></a>
922
+				    <a href="javascript:void('')" class="tip-left edit-button rename-file-paths <?php if($rename_files && !$file_prevent_rename) {
923
+    echo "rename-file";
924
+}
925
+?>" title="<?php echo lang_Rename?>" data-path="<?php echo $rfm_subfolder.$subdir .$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
926
+ 				    <i class="icon-pencil <?php if(!$rename_files || $file_prevent_rename) {
927
+    echo 'icon-white';
928
+}
929
+?>"></i></a>
821 930
 
822
-				    <a href="javascript:void('')" class="tip-left erase-button <?php if($delete_files && !$file_prevent_delete) echo "delete-file"; ?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
823
- 				    <i class="icon-trash <?php if(!$delete_files || $file_prevent_delete) echo 'icon-white'; ?>"></i>
931
+				    <a href="javascript:void('')" class="tip-left erase-button <?php if($delete_files && !$file_prevent_delete) {
932
+    echo "delete-file";
933
+}
934
+?>" title="<?php echo lang_Erase?>" data-confirm="<?php echo lang_Confirm_del; ?>" data-path="<?php echo $rfm_subfolder.$subdir.$file; ?>" data-thumb="<?php echo $thumbs_path.$subdir .$file; ?>">
935
+ 				    <i class="icon-trash <?php if(!$delete_files || $file_prevent_delete) {
936
+    echo 'icon-white';
937
+}
938
+?>"></i>
824 939
 				    </a>
825 940
 				    </form>
826 941
 				</figcaption>
Please login to merge, or discard this patch.
class/xoopseditor/tinymce4/external_plugins/filemanager/config/config.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 $chemin_scheme =  $chemin_array["scheme"]; // http
15 15
 $chemin_host =  $chemin_array["host"]; // www.example.com  or // localhost
16 16
 //  $chemin_path =  $chemin_array["path"]; // /myweb1
17
-  if (!isset($chemin_array['path']))
17
+    if (!isset($chemin_array['path']))
18 18
     {
19
-      $chemin_path = '';
19
+        $chemin_path = '';
20 20
     }
21
-  else
21
+    else
22 22
     {
23
-      $chemin_path =  $chemin_array["path"];
23
+        $chemin_path =  $chemin_array["path"];
24 24
     }
25 25
 // XOOPS
26 26
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 // SERVER OVERRIDE
75 75
 if ((int)(ini_get('post_max_size')) < $MaxSizeUpload){
76
-	$MaxSizeUpload = (int)(ini_get('post_max_size'));
76
+    $MaxSizeUpload = (int)(ini_get('post_max_size'));
77 77
 }
78 78
 
79 79
 $default_language 	= "en_EN"; //default language file name
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
     $usergroups = $GLOBALS['xoopsUser']->getGroups();
141 141
     $result_upload = array_intersect($usergroups, $allowed_groups_upload);
142 142
         if ($result_upload || $result_upload!=null) {
143
-           $upload_files = TRUE;
143
+            $upload_files = TRUE;
144 144
         }
145
-  $result_createfolder = array_intersect($usergroups, $allowed_groups_createfolder);
146
-       if ($result_createfolder || $result_createfolder!=null) {
147
-          $create_folders = TRUE;
145
+    $result_createfolder = array_intersect($usergroups, $allowed_groups_createfolder);
146
+        if ($result_createfolder || $result_createfolder!=null) {
147
+            $create_folders = TRUE;
148 148
         }
149 149
 }
150 150
 // XOOPS
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // XOOPS
3 3
 $current_path = __DIR__;
4
-if ( DIRECTORY_SEPARATOR !== "/" ) {
5
-    $current_path = str_replace( DIRECTORY_SEPARATOR, "/", $current_path);
4
+if (DIRECTORY_SEPARATOR !== "/") {
5
+    $current_path = str_replace(DIRECTORY_SEPARATOR, "/", $current_path);
6 6
 }
7 7
 $xoops_root_path = substr($current_path, 0, strpos(strtolower($current_path), "/class/xoopseditor/tinymce4/"));
8
-include_once $xoops_root_path . "/mainfile.php";
8
+include_once $xoops_root_path."/mainfile.php";
9 9
 
10 10
 $xoops = \Xoops::getInstance();
11 11
 $xoops->logger()->quiet();
12 12
 
13
-$chemin_array=parse_url(\XoopsBaseConfig::get('url'));
14
-$chemin_scheme =  $chemin_array["scheme"]; // http
15
-$chemin_host =  $chemin_array["host"]; // www.example.com  or // localhost
13
+$chemin_array = parse_url(\XoopsBaseConfig::get('url'));
14
+$chemin_scheme = $chemin_array["scheme"]; // http
15
+$chemin_host = $chemin_array["host"]; // www.example.com  or // localhost
16 16
 //  $chemin_path =  $chemin_array["path"]; // /myweb1
17 17
   if (!isset($chemin_array['path']))
18 18
     {
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
   else
22 22
     {
23
-      $chemin_path =  $chemin_array["path"];
23
+      $chemin_path = $chemin_array["path"];
24 24
     }
25 25
 // XOOPS
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 //XOOPS
30 30
 //session_start();
31
-if(!isset($_SESSION))
31
+if (!isset($_SESSION))
32 32
 {
33 33
 session_start();
34 34
 }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 //    |   |   |   |   |- plugin.min.js
55 55
 
56 56
 //$base_url="http://www.site.com";  // base url (only domain) of site (without final /). If you prefer relative urls leave empty
57
-$base_url=$chemin_scheme."://".$chemin_host;
57
+$base_url = $chemin_scheme."://".$chemin_host;
58 58
 
59 59
 //$upload_dir = '/source/'; // path from base_url to base of upload folder (with start and final /)
60 60
 
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
 $MaxSizeUpload = 100; //Mb
73 73
 
74 74
 // SERVER OVERRIDE
75
-if ((int)(ini_get('post_max_size')) < $MaxSizeUpload){
75
+if ((int)(ini_get('post_max_size')) < $MaxSizeUpload) {
76 76
 	$MaxSizeUpload = (int)(ini_get('post_max_size'));
77 77
 }
78 78
 
79 79
 $default_language 	= "en_EN"; //default language file name
80
-$icon_theme 		= "ico"; //ico or ico_dark you can cusatomize just putting a folder inside filemanager/img
80
+$icon_theme = "ico"; //ico or ico_dark you can cusatomize just putting a folder inside filemanager/img
81 81
 $show_folder_size 	= TRUE; //Show or not show folder size in list view feature in filemanager (is possible, if there is a large folder, to greatly increase the calculations)
82 82
 $show_sorting_bar 	= TRUE; //Show or not show sorting feature in filemanager
83
-$loading_bar 		= TRUE; //Show or not show loading bar
84
-$transliteration 	= FALSE; //active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters)
83
+$loading_bar = TRUE; //Show or not show loading bar
84
+$transliteration = FALSE; //active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters)
85 85
 
86 86
 //*******************************************
87 87
 //Images limit and resizing configuration
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 $rename_folders	 = FALSE;
127 127
 $duplicate_files = FALSE;
128 128
 $copy_cut_files	 = FALSE; // for copy/cut files
129
-$copy_cut_dirs	 = FALSE; // for copy/cut directories
129
+$copy_cut_dirs = FALSE; // for copy/cut directories
130 130
 
131 131
 // XOOPS
132 132
 global $xoopsUser;
@@ -139,43 +139,43 @@  discard block
 block discarded – undo
139 139
 if ($xoopsUser) {
140 140
     $usergroups = $GLOBALS['xoopsUser']->getGroups();
141 141
     $result_upload = array_intersect($usergroups, $allowed_groups_upload);
142
-        if ($result_upload || $result_upload!=null) {
142
+        if ($result_upload || $result_upload != null) {
143 143
            $upload_files = TRUE;
144 144
         }
145 145
   $result_createfolder = array_intersect($usergroups, $allowed_groups_createfolder);
146
-       if ($result_createfolder || $result_createfolder!=null) {
146
+       if ($result_createfolder || $result_createfolder != null) {
147 147
           $create_folders = TRUE;
148 148
         }
149 149
 }
150 150
 // XOOPS
151 151
 // defines size limit for paste in MB / operation
152 152
 // set 'FALSE' for no limit
153
-$copy_cut_max_size	 = 100;
153
+$copy_cut_max_size = 100;
154 154
 // defines file count limit for paste / operation
155 155
 // set 'FALSE' for no limit
156
-$copy_cut_max_count	 = 200;
156
+$copy_cut_max_count = 200;
157 157
 //IF any of these limits reached, operation won't start and generate warning
158 158
 
159 159
 //**********************
160 160
 //Allowed extensions (lowercase insert)
161 161
 //**********************
162 162
 $ext_img = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg'); //Images
163
-$ext_file = array('doc', 'docx','rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv','html','xhtml','psd','sql','log','fla','xml','ade','adp','mdb','accdb','ppt','pptx','odt','ots','ott','odb','odg','otp','otg','odf','ods','odp','css','ai'); //Files
164
-$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg','wma',"flv","webm"); //Video
165
-$ext_music = array('mp3', 'm4a', 'ac3', 'aiff', 'mid','ogg','wav'); //Audio
166
-$ext_misc = array('zip', 'rar','gz','tar','iso','dmg'); //Archives
163
+$ext_file = array('doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai'); //Files
164
+$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm"); //Video
165
+$ext_music = array('mp3', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav'); //Audio
166
+$ext_misc = array('zip', 'rar', 'gz', 'tar', 'iso', 'dmg'); //Archives
167 167
 
168
-$ext = array_merge($ext_img, $ext_file, $ext_misc, $ext_video,$ext_music); //allowed extensions
168
+$ext = array_merge($ext_img, $ext_file, $ext_misc, $ext_video, $ext_music); //allowed extensions
169 169
 
170 170
 
171 171
 /******************
172 172
  * AVIARY config
173 173
 *******************/
174 174
 $aviary_active 	= TRUE;
175
-$aviary_key 	= "dvh8qudbp6yx2bnp";
176
-$aviary_secret	= "m6xaym5q42rpw433";
175
+$aviary_key = "dvh8qudbp6yx2bnp";
176
+$aviary_secret = "m6xaym5q42rpw433";
177 177
 $aviary_version	= 3;
178
-$aviary_language= 'en';
178
+$aviary_language = 'en';
179 179
 
180 180
 
181 181
 //The filter and sorter are managed through both javascript and php scripts because if you have a lot of
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 // path_from_filemanager/test/test1/
214 214
 // PS if there isn't write permission in your destination folder you must set it
215 215
 $fixed_image_creation                   = FALSE; //activate or not the creation of one or more image resized with fixed path from filemanager folder
216
-$fixed_path_from_filemanager            = array('../test/','../test1/'); //fixed path of the image folder from the current position on upload folder
217
-$fixed_image_creation_name_to_prepend   = array('','test_'); //name to prepend on filename
218
-$fixed_image_creation_to_append         = array('_test',''); //name to appendon filename
219
-$fixed_image_creation_width             = array(300,400); //width of image (you can leave empty if you set height)
220
-$fixed_image_creation_height            = array(200,''); //height of image (you can leave empty if you set width)
216
+$fixed_path_from_filemanager            = array('../test/', '../test1/'); //fixed path of the image folder from the current position on upload folder
217
+$fixed_image_creation_name_to_prepend   = array('', 'test_'); //name to prepend on filename
218
+$fixed_image_creation_to_append         = array('_test', ''); //name to appendon filename
219
+$fixed_image_creation_width             = array(300, 400); //width of image (you can leave empty if you set height)
220
+$fixed_image_creation_height            = array(200, ''); //height of image (you can leave empty if you set width)
221 221
 
222 222
 
223 223
 // New image resized creation with relative path inside to upload folder after uploading (thumbnails in relative mode)
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 // just simply add a value in the array
226 226
 // The image creation path is always relative so if i'm inside source/test/test1 and I upload an image, the path start from here
227 227
 $relative_image_creation                = FALSE; //activate or not the creation of one or more image resized with relative path from upload folder
228
-$relative_path_from_current_pos         = array('thumb/','thumb/'); //relative path of the image folder from the current position on upload folder
229
-$relative_image_creation_name_to_prepend= array('','test_'); //name to prepend on filename
230
-$relative_image_creation_name_to_append = array('_test',''); //name to append on filename
231
-$relative_image_creation_width          = array(300,400); //width of image (you can leave empty if you set height)
232
-$relative_image_creation_height         = array(200,''); //height of image (you can leave empty if you set width)
228
+$relative_path_from_current_pos         = array('thumb/', 'thumb/'); //relative path of the image folder from the current position on upload folder
229
+$relative_image_creation_name_to_prepend = array('', 'test_'); //name to prepend on filename
230
+$relative_image_creation_name_to_append = array('_test', ''); //name to append on filename
231
+$relative_image_creation_width          = array(300, 400); //width of image (you can leave empty if you set height)
232
+$relative_image_creation_height         = array(200, ''); //height of image (you can leave empty if you set width)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
   if (!isset($chemin_array['path']))
18 18
     {
19 19
       $chemin_path = '';
20
-    }
21
-  else
20
+    } else
22 21
     {
23 22
       $chemin_path =  $chemin_array["path"];
24 23
     }
Please login to merge, or discard this patch.
xoopseditor/tinymce4/external_plugins/filemanager/config/config.ref.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 
34 34
 // SERVER OVERRIDE
35 35
 if ((int)(ini_get('post_max_size')) < $MaxSizeUpload){
36
-	$MaxSizeUpload = (int)(ini_get('post_max_size'));
36
+    $MaxSizeUpload = (int)(ini_get('post_max_size'));
37 37
 }
38 38
 
39 39
 $default_language 	= "en_EN"; //default language file name
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 //    |   |   |   |- responsivefilemanager
20 20
 //    |   |   |   |   |- plugin.min.js
21 21
 
22
-$base_url ="http://".$_SERVER['HTTP_HOST'];  // DON'T TOUCH (base url (only domain) of site (without final /)).
22
+$base_url = "http://".$_SERVER['HTTP_HOST']; // DON'T TOUCH (base url (only domain) of site (without final /)).
23 23
 $upload_dir = '/source/'; // path from base_url to base of upload folder (with start and final /)
24 24
 $current_path = '../source/'; // relative path from filemanager folder to upload folder (with final /)
25 25
 //thumbs folder can't put inside upload folder
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 $MaxSizeUpload = 100; //Mb
33 33
 
34 34
 // SERVER OVERRIDE
35
-if ((int)(ini_get('post_max_size')) < $MaxSizeUpload){
35
+if ((int)(ini_get('post_max_size')) < $MaxSizeUpload) {
36 36
 	$MaxSizeUpload = (int)(ini_get('post_max_size'));
37 37
 }
38 38
 
39 39
 $default_language 	= "en_EN"; //default language file name
40
-$icon_theme 		= "ico"; //ico or ico_dark you can cusatomize just putting a folder inside filemanager/img
40
+$icon_theme = "ico"; //ico or ico_dark you can cusatomize just putting a folder inside filemanager/img
41 41
 $show_folder_size 	= TRUE; //Show or not show folder size in list view feature in filemanager (is possible, if there is a large folder, to greatly increase the calculations)
42 42
 $show_sorting_bar 	= TRUE; //Show or not show sorting feature in filemanager
43
-$loading_bar 		= TRUE; //Show or not show loading bar
44
-$transliteration 	= FALSE; //active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters)
43
+$loading_bar = TRUE; //Show or not show loading bar
44
+$transliteration = FALSE; //active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters)
45 45
 
46 46
 //*******************************************
47 47
 //Images limit and resizing configuration
@@ -86,36 +86,36 @@  discard block
 block discarded – undo
86 86
 $rename_folders	 = TRUE;
87 87
 $duplicate_files = TRUE;
88 88
 $copy_cut_files	 = TRUE; // for copy/cut files
89
-$copy_cut_dirs	 = TRUE; // for copy/cut directories
89
+$copy_cut_dirs = TRUE; // for copy/cut directories
90 90
 
91 91
 
92 92
 // defines size limit for paste in MB / operation
93 93
 // set 'FALSE' for no limit
94
-$copy_cut_max_size	 = 100;
94
+$copy_cut_max_size = 100;
95 95
 // defines file count limit for paste / operation
96 96
 // set 'FALSE' for no limit
97
-$copy_cut_max_count	 = 200;
97
+$copy_cut_max_count = 200;
98 98
 //IF any of these limits reached, operation won't start and generate warning
99 99
 
100 100
 //**********************
101 101
 //Allowed extensions (lowercase insert)
102 102
 //**********************
103 103
 $ext_img = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg'); //Images
104
-$ext_file = array('doc', 'docx','rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv','html','xhtml','psd','sql','log','fla','xml','ade','adp','mdb','accdb','ppt','pptx','odt','ots','ott','odb','odg','otp','otg','odf','ods','odp','css','ai'); //Files
105
-$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg','wma',"flv","webm"); //Video 
106
-$ext_music = array('mp3', 'm4a', 'ac3', 'aiff', 'mid','ogg','wav'); //Audio
107
-$ext_misc = array('zip', 'rar','gz','tar','iso','dmg'); //Archives
104
+$ext_file = array('doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai'); //Files
105
+$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm"); //Video 
106
+$ext_music = array('mp3', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav'); //Audio
107
+$ext_misc = array('zip', 'rar', 'gz', 'tar', 'iso', 'dmg'); //Archives
108 108
 
109
-$ext = array_merge($ext_img, $ext_file, $ext_misc, $ext_video,$ext_music); //allowed extensions
109
+$ext = array_merge($ext_img, $ext_file, $ext_misc, $ext_video, $ext_music); //allowed extensions
110 110
 
111 111
 /******************
112 112
  * AVIARY config
113 113
 *******************/
114 114
 $aviary_active 	= TRUE;
115
-$aviary_key 	= "dvh8qudbp6yx2bnp";
116
-$aviary_secret	= "m6xaym5q42rpw433";
115
+$aviary_key = "dvh8qudbp6yx2bnp";
116
+$aviary_secret = "m6xaym5q42rpw433";
117 117
 $aviary_version	= 3;
118
-$aviary_language= 'en';
118
+$aviary_language = 'en';
119 119
 
120 120
 
121 121
 //The filter and sorter are managed through both javascript and php scripts because if you have a lot of
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 // path_from_filemanager/test/test1/
151 151
 // PS if there isn't write permission in your destination folder you must set it
152 152
 $fixed_image_creation                   = FALSE; //activate or not the creation of one or more image resized with fixed path from filemanager folder
153
-$fixed_path_from_filemanager            = array('../test/','../test1/'); //fixed path of the image folder from the current position on upload folder
154
-$fixed_image_creation_name_to_prepend   = array('','test_'); //name to prepend on filename
155
-$fixed_image_creation_to_append         = array('_test',''); //name to appendon filename
156
-$fixed_image_creation_width             = array(300,400); //width of image (you can leave empty if you set height)
157
-$fixed_image_creation_height            = array(200,''); //height of image (you can leave empty if you set width)
153
+$fixed_path_from_filemanager            = array('../test/', '../test1/'); //fixed path of the image folder from the current position on upload folder
154
+$fixed_image_creation_name_to_prepend   = array('', 'test_'); //name to prepend on filename
155
+$fixed_image_creation_to_append         = array('_test', ''); //name to appendon filename
156
+$fixed_image_creation_width             = array(300, 400); //width of image (you can leave empty if you set height)
157
+$fixed_image_creation_height            = array(200, ''); //height of image (you can leave empty if you set width)
158 158
 
159 159
 
160 160
 // New image resized creation with relative path inside to upload folder after uploading (thumbnails in relative mode)
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 // just simply add a value in the array
163 163
 // The image creation path is always relative so if i'm inside source/test/test1 and I upload an image, the path start from here
164 164
 $relative_image_creation                = FALSE; //activate or not the creation of one or more image resized with relative path from upload folder
165
-$relative_path_from_current_pos         = array('thumb/','thumb/'); //relative path of the image folder from the current position on upload folder
166
-$relative_image_creation_name_to_prepend= array('','test_'); //name to prepend on filename
167
-$relative_image_creation_name_to_append = array('_test',''); //name to append on filename
168
-$relative_image_creation_width          = array(300,400); //width of image (you can leave empty if you set height)
169
-$relative_image_creation_height         = array(200,''); //height of image (you can leave empty if you set width)
165
+$relative_path_from_current_pos         = array('thumb/', 'thumb/'); //relative path of the image folder from the current position on upload folder
166
+$relative_image_creation_name_to_prepend = array('', 'test_'); //name to prepend on filename
167
+$relative_image_creation_name_to_append = array('_test', ''); //name to append on filename
168
+$relative_image_creation_width          = array(300, 400); //width of image (you can leave empty if you set height)
169
+$relative_image_creation_height         = array(200, ''); //height of image (you can leave empty if you set width)
Please login to merge, or discard this patch.