Completed
Pull Request — develop (#545)
by Agel_Nash
05:36
created
install/instprocessor.php 1 patch
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) {
3 3
     include_once(dirname(__FILE__)."/../assets/cache/siteManager.php");
4
-}else{
4
+} else {
5 5
     define('MGR_DIR', 'manager');
6 6
 }
7 7
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 echo "<p>{$_lang['setup_database']}</p>\n";
30 30
 
31
-$installMode= (int)$_POST['installmode'];
31
+$installMode = (int) $_POST['installmode'];
32 32
 $installData = $_POST['installdata'] == "1" ? 1 : 0;
33 33
 
34 34
 //if ($installMode == 1) {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
43 43
 $database_connection_charset = $_POST['database_connection_charset'];
44 44
 $database_connection_method = $_POST['database_connection_method'];
45
-$dbase = "`" . $_POST['database_name'] . "`";
45
+$dbase = "`".$_POST['database_name']."`";
46 46
 $table_prefix = $_POST['tableprefix'];
47 47
 $adminname = $_POST['cmsadmin'];
48 48
 $adminemail = $_POST['cmsadminemail'];
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 // set session name variable
55 55
 if (!isset ($site_sessionname)) {
56
-    $site_sessionname = 'SN' . uniqid('');
56
+    $site_sessionname = 'SN'.uniqid('');
57 57
 }
58 58
 
59 59
 // get base path and url
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
     array_pop($a);
68 68
 $pth = implode("install", $a);
69 69
 unset ($a);
70
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
71
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
70
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
71
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
72 72
 
73 73
 // connect to the database
74
-echo "<p>". $_lang['setup_database_create_connection'];
74
+echo "<p>".$_lang['setup_database_create_connection'];
75 75
 if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
76 76
     echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>";
77 77
     return;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 }
81 81
 
82 82
 // select database
83
-echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: ";
83
+echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
84 84
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
85 85
     echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>";
86 86
     $create = true;
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 
93 93
 // try to create the database
94 94
 if ($create) {
95
-    echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: ";
95
+    echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
96 96
     //	if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
97
-    if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
97
+    if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
98 98
         echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>";
99 99
         $errors += 1;
100 100
 ?>
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 
114 114
 // check table prefix
115 115
 if ($installMode == 0) {
116
-    echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: ";
117
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
118
-        echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>";
116
+    echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: ";
117
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
118
+        echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>";
119 119
         $errors += 1;
120
-        echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>";
120
+        echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>";
121 121
         return;
122 122
     } else {
123 123
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
124 124
     }
125 125
 }
126 126
 
127
-if(!function_exists('parseProperties')) {
127
+if (!function_exists('parseProperties')) {
128 128
     /**
129 129
      * parses a resource property string and returns the result as an array
130 130
      * duplicate of method in documentParser class
@@ -132,20 +132,20 @@  discard block
 block discarded – undo
132 132
      * @param string $propertyString
133 133
      * @return array
134 134
      */
135
-    function parseProperties($propertyString) {
136
-        $parameter= array ();
135
+    function parseProperties($propertyString){
136
+        $parameter = array();
137 137
         if (!empty ($propertyString)) {
138
-            $tmpParams= explode("&", $propertyString);
138
+            $tmpParams = explode("&", $propertyString);
139 139
             $countParams = count($tmpParams);
140
-            for ($x= 0; $x < $countParams; $x++) {
140
+            for ($x = 0; $x < $countParams; $x++) {
141 141
                 if (strpos($tmpParams[$x], '=', 0)) {
142
-                    $pTmp= explode("=", $tmpParams[$x]);
143
-                    $pvTmp= explode(";", trim($pTmp[1]));
142
+                    $pTmp = explode("=", $tmpParams[$x]);
143
+                    $pvTmp = explode(";", trim($pTmp[1]));
144 144
                     if ($pvTmp[1] == 'list' && $pvTmp[3] != "")
145
-                        $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default
145
+                        $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default
146 146
                     else
147 147
                         if ($pvTmp[1] != 'list' && $pvTmp[2] != "")
148
-                            $parameter[trim($pTmp[0])]= $pvTmp[2];
148
+                            $parameter[trim($pTmp[0])] = $pvTmp[2];
149 149
                 }
150 150
             }
151 151
         }
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 // check status of Inherit Parent Template plugin
157 157
 $auto_template_logic = 'parent';
158 158
 if ($installMode != 0) {
159
-    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
159
+    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
160 160
     $row = mysqli_fetch_row($rs);
161
-    if(!$row) {
161
+    if (!$row) {
162 162
         // not installed
163 163
         $auto_template_logic = 'system';
164 164
     } else {
165
-        if($row[1] == 1) {
165
+        if ($row[1] == 1) {
166 166
             // installed but disabled
167 167
             $auto_template_logic = 'system';
168 168
         } else {
169 169
             // installed, enabled .. see how it's configured
170 170
             $properties = parseProperties($row[0]);
171
-            if(isset($properties['inheritTemplate'])) {
172
-                if($properties['inheritTemplate'] == 'From First Sibling') {
171
+            if (isset($properties['inheritTemplate'])) {
172
+                if ($properties['inheritTemplate'] == 'From First Sibling') {
173 173
                     $auto_template_logic = 'sibling';
174 174
                 }
175 175
             }
@@ -193,20 +193,20 @@  discard block
 block discarded – undo
193 193
 $sqlParser->connect();
194 194
 
195 195
 // install/update database
196
-echo "<p>" . $_lang['setup_database_creating_tables'];
196
+echo "<p>".$_lang['setup_database_creating_tables'];
197 197
 if ($moduleSQLBaseFile) {
198 198
     $sqlParser->process($moduleSQLBaseFile);
199 199
     // display database results
200 200
     if ($sqlParser->installFailed == true) {
201 201
         $errors += 1;
202
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
203
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
204
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
202
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
203
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
204
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
205 205
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
206
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
206
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
207 207
         }
208 208
         echo "</p>";
209
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
209
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
210 210
         return;
211 211
     } else {
212 212
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 // custom or not
217 217
 if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) {
218 218
     $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");';
219
-}else{
219
+} else {
220 220
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
221 221
 }
222 222
 
223 223
 // write the config.inc.php file if new installation
224
-echo "<p>" . $_lang['writing_config_file'];
224
+echo "<p>".$_lang['writing_config_file'];
225 225
 
226 226
 $confph = array();
227 227
 $confph['database_server']    = $database_server;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 $chmodSuccess = @chmod($filename, 0404);
254 254
 
255 255
 if ($configFileFailed == true) {
256
-    echo '<span class="notok">' . $_lang['failed'] . "</span></p>";
256
+    echo '<span class="notok">'.$_lang['failed']."</span></p>";
257 257
     $errors += 1;
258 258
 ?>
259 259
     <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p>
@@ -270,35 +270,35 @@  discard block
 block discarded – undo
270 270
 // generate new site_id and set manager theme to default
271 271
 if ($installMode == 0) {
272 272
     $siteid = uniqid('');
273
-    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
273
+    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
274 274
 } else {
275 275
     // update site_id if missing
276
-    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
276
+    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
277 277
     if ($ds) {
278 278
         $r = mysqli_fetch_assoc($ds);
279 279
         $siteid = $r['setting_value'];
280 280
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
281 281
             $siteid = uniqid('');
282
-            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
282
+            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
283 283
         }
284 284
     }
285 285
 }
286 286
 
287 287
 // Reset database for installation of demo-site
288 288
 if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {
289
-	echo "<p>" . $_lang['resetting_database'];
289
+	echo "<p>".$_lang['resetting_database'];
290 290
 	$sqlParser->process($moduleSQLResetFile);
291 291
 	// display database results
292 292
 	if ($sqlParser->installFailed == true) {
293 293
 		$errors += 1;
294
-		echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
295
-		echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
296
-		echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
294
+		echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
295
+		echo "<p>".$_lang['setup_couldnt_install']."</p>";
296
+		echo "<p>".$_lang['installation_error_occured']."<br /><br />";
297 297
 		for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
298
-			echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
298
+			echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
299 299
 		}
300 300
 		echo "</p>";
301
-		echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
301
+		echo "<p>".$_lang['some_tables_not_updated']."</p>";
302 302
 		return;
303 303
 	} else {
304 304
 		echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 
308 308
 // Install Templates
309 309
 if (isset ($_POST['template']) || $installData) {
310
-    echo "<h3>" . $_lang['templates'] . ":</h3> ";
310
+    echo "<h3>".$_lang['templates'].":</h3> ";
311 311
     $selTemplates = $_POST['template'];
312 312
     foreach ($moduleTemplates as $k=>$moduleTemplate) {
313 313
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
314
-        if($installSample || in_array($k, $selTemplates)) {
314
+        if ($installSample || in_array($k, $selTemplates)) {
315 315
             $name = mysqli_real_escape_string($conn, $moduleTemplate[0]);
316 316
             $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]);
317 317
             $category = mysqli_real_escape_string($conn, $moduleTemplate[4]);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             $filecontent = $moduleTemplate[3];
320 320
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
321 321
             if (!file_exists($filecontent)) {
322
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
322
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>";
323 323
             } else {
324 324
                 // Create the category if it does not already exist
325 325
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -329,31 +329,31 @@  discard block
 block discarded – undo
329 329
                 $template = mysqli_real_escape_string($conn, $template);
330 330
 
331 331
                 // See if the template already exists
332
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
332
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
333 333
 
334 334
                 if (mysqli_num_rows($rs)) {
335
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
335
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
336 336
                         $errors += 1;
337
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
337
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
338 338
                         return;
339 339
                     }
340
-                    if(!is_null($save_sql_id_as)) {
340
+                    if (!is_null($save_sql_id_as)) {
341 341
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
342
-                        if(!$sql_id) {
343
-                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
342
+                        if (!$sql_id) {
343
+                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
344 344
                             $sql_id = $idQuery['id'];
345 345
                         }
346 346
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
347 347
                     }
348
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
348
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
349 349
                 } else {
350
-                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
350
+                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
351 351
                         $errors += 1;
352
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
352
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
353 353
                         return;
354 354
                     }
355
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
356
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
355
+                    if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
356
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
357 357
                 }
358 358
             }
359 359
         }
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 
363 363
 // Install Template Variables
364 364
 if (isset ($_POST['tv']) || $installData) {
365
-    echo "<h3>" . $_lang['tvs'] . ":</h3> ";
365
+    echo "<h3>".$_lang['tvs'].":</h3> ";
366 366
     $selTVs = $_POST['tv'];
367 367
     foreach ($moduleTVs as $k=>$moduleTV) {
368 368
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
369
-        if($installSample || in_array($k, $selTVs)) {
369
+        if ($installSample || in_array($k, $selTVs)) {
370 370
             $name = mysqli_real_escape_string($conn, $moduleTV[0]);
371 371
             $caption = mysqli_real_escape_string($conn, $moduleTV[1]);
372 372
             $desc = mysqli_real_escape_string($conn, $moduleTV[2]);
@@ -384,25 +384,25 @@  discard block
 block discarded – undo
384 384
             // Create the category if it does not already exist
385 385
             $category = getCreateDbCategory($category, $sqlParser);
386 386
 
387
-            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
387
+            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
388 388
             if (mysqli_num_rows($rs)) {
389 389
                 $insert = true;
390
-                while($row = mysqli_fetch_assoc($rs)) {
391
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
392
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
390
+                while ($row = mysqli_fetch_assoc($rs)) {
391
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
392
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
393 393
                         return;
394 394
                     }
395 395
                     $insert = false;
396 396
                 }
397
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
397
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
398 398
             } else {
399 399
                 //$q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
400
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
400
+                $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
401 401
                 if (!mysqli_query($sqlParser->conn, $q)) {
402
-                    echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
402
+                    echo "<p>".mysqli_error($sqlParser->conn)."</p>";
403 403
                     return;
404 404
                 }
405
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
405
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
406 406
             }
407 407
 
408 408
             // add template assignments
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
             if (count($assignments) > 0) {
412 412
 
413 413
                 // remove existing tv -> template assignments
414
-                $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
414
+                $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
415 415
                 $row = mysqli_fetch_assoc($ds);
416 416
                 $id = $row["id"];
417
-                mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
417
+                mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
418 418
 
419 419
                 // add tv -> template assignments
420 420
                 foreach ($assignments as $assignment) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                     if ($ds && $ts) {
424 424
                         $tRow = mysqli_fetch_assoc($ts);
425 425
                         $templateId = $tRow['id'];
426
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
426
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
427 427
                    }
428 428
                 }
429 429
             }
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 
434 434
 // Install Chunks
435 435
 if (isset ($_POST['chunk']) || $installData) {
436
-    echo "<h3>" . $_lang['chunks'] . ":</h3> ";
436
+    echo "<h3>".$_lang['chunks'].":</h3> ";
437 437
     $selChunks = $_POST['chunk'];
438 438
     foreach ($moduleChunks as $k=>$moduleChunk) {
439 439
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
440 440
         $count_new_name = 0;
441
-        if($installSample || in_array($k, $selChunks)) {
441
+        if ($installSample || in_array($k, $selChunks)) {
442 442
 
443 443
             $name = mysqli_real_escape_string($conn, $moduleChunk[0]);
444 444
             $desc = mysqli_real_escape_string($conn, $moduleChunk[1]);
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             $filecontent = $moduleChunk[2];
448 448
 
449 449
             if (!file_exists($filecontent))
450
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
450
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>";
451 451
             else {
452 452
 
453 453
                 // Create the category if it does not already exist
@@ -455,31 +455,31 @@  discard block
 block discarded – undo
455 455
 
456 456
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
457 457
                 $chunk = mysqli_real_escape_string($conn, $chunk);
458
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
458
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
459 459
                 $count_original_name = mysqli_num_rows($rs);
460
-                if($overwrite == 'false') {
461
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
462
-                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
460
+                if ($overwrite == 'false') {
461
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
462
+                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
463 463
                     $count_new_name = mysqli_num_rows($rs);
464 464
                 }
465 465
                 $update = $count_original_name > 0 && $overwrite == 'true';
466 466
                 if ($update) {
467
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
467
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
468 468
                         $errors += 1;
469
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
469
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
470 470
                         return;
471 471
                     }
472
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
473
-                } elseif($count_new_name == 0) {
474
-                    if($count_original_name > 0 && $overwrite == 'false') {
472
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
473
+                } elseif ($count_new_name == 0) {
474
+                    if ($count_original_name > 0 && $overwrite == 'false') {
475 475
                         $name = $newname;
476 476
                     }
477
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
477
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
478 478
                         $errors += 1;
479
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
479
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
480 480
                         return;
481 481
                     }
482
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
482
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
483 483
                 }
484 484
             }
485 485
         }
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
 
489 489
 // Install Modules
490 490
 if (isset ($_POST['module']) || $installData) {
491
-    echo "<h3>" . $_lang['modules'] . ":</h3> ";
491
+    echo "<h3>".$_lang['modules'].":</h3> ";
492 492
     $selModules = $_POST['module'];
493 493
     foreach ($moduleModules as $k=>$moduleModule) {
494 494
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
495
-        if($installSample || in_array($k, $selModules)) {
495
+        if ($installSample || in_array($k, $selModules)) {
496 496
             $name = mysqli_real_escape_string($conn, $moduleModule[0]);
497 497
             $desc = mysqli_real_escape_string($conn, $moduleModule[1]);
498 498
             $filecontent = $moduleModule[2];
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
502 502
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
503 503
             if (!file_exists($filecontent))
504
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
504
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>";
505 505
             else {
506 506
 
507 507
                 // Create the category if it does not already exist
@@ -510,22 +510,22 @@  discard block
 block discarded – undo
510 510
                 $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
511 511
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
512 512
                 $module = mysqli_real_escape_string($conn, $module);
513
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
513
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
514 514
                 if (mysqli_num_rows($rs)) {
515 515
                     $row = mysqli_fetch_assoc($rs);
516
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
517
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
518
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
516
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
517
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
518
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
519 519
                         return;
520 520
                     }
521
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
521
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
522 522
                 } else {
523 523
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
524
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
525
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
524
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
525
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
526 526
                         return;
527 527
                     }
528
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
528
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
529 529
                 }
530 530
             }
531 531
         }
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
 
535 535
 // Install Plugins
536 536
 if (isset ($_POST['plugin']) || $installData) {
537
-    echo "<h3>" . $_lang['plugins'] . ":</h3> ";
537
+    echo "<h3>".$_lang['plugins'].":</h3> ";
538 538
     $selPlugs = $_POST['plugin'];
539 539
     foreach ($modulePlugins as $k=>$modulePlugin) {
540 540
         $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
541
-        if($installSample || in_array($k, $selPlugs)) {
541
+        if ($installSample || in_array($k, $selPlugs)) {
542 542
             $name = mysqli_real_escape_string($conn, $modulePlugin[0]);
543 543
             $desc = mysqli_real_escape_string($conn, $modulePlugin[1]);
544 544
             $filecontent = $modulePlugin[2];
@@ -548,17 +548,17 @@  discard block
 block discarded – undo
548 548
             $category = mysqli_real_escape_string($conn, $modulePlugin[6]);
549 549
             $leg_names = '';
550 550
             $disabled = $modulePlugin[9];
551
-            if(array_key_exists(7, $modulePlugin)) {
551
+            if (array_key_exists(7, $modulePlugin)) {
552 552
                 // parse comma-separated legacy names and prepare them for sql IN clause
553
-                $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
553
+                $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
554 554
             }
555 555
             if (!file_exists($filecontent))
556
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
556
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>";
557 557
             else {
558 558
 
559 559
                 // disable legacy versions based on legacy_names provided
560
-                if(!empty($leg_names)) {
561
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
560
+                if (!empty($leg_names)) {
561
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
562 562
                     $rs = mysqli_query($sqlParser->conn, $update_query);
563 563
                 }
564 564
 
@@ -568,50 +568,50 @@  discard block
 block discarded – undo
568 568
                 $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
569 569
                 $plugin = removeDocblock($plugin, 'plugin');
570 570
                 $plugin = mysqli_real_escape_string($conn, $plugin);
571
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
571
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
572 572
                 if (mysqli_num_rows($rs)) {
573 573
                     $insert = true;
574
-                    while($row = mysqli_fetch_assoc($rs)) {
575
-                        $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
576
-                        if($row['description'] == $desc){
577
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
578
-                                echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
574
+                    while ($row = mysqli_fetch_assoc($rs)) {
575
+                        $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
576
+                        if ($row['description'] == $desc) {
577
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
578
+                                echo "<p>".mysqli_error($sqlParser->conn)."</p>";
579 579
                                 return;
580 580
                             }
581 581
                             $insert = false;
582 582
                         } else {
583
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
583
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
584 584
                                 echo "<p>".mysqli_error($sqlParser->conn)."</p>";
585 585
                                 return;
586 586
                             }
587 587
                         }
588 588
                     }
589
-                    if($insert === true) {
590
-                        $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
591
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
589
+                    if ($insert === true) {
590
+                        $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
591
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
592 592
                             echo "<p>".mysqli_error($sqlParser->conn)."</p>";
593 593
                             return;
594 594
                         }
595 595
                     }
596
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
596
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
597 597
                 } else {
598 598
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
599
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
600
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
599
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
600
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
601 601
                         return;
602 602
                     }
603
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
603
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
604 604
                 }
605 605
                 // add system events
606 606
                 if (count($events) > 0) {
607
-                    $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
607
+                    $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
608 608
                     if ($ds) {
609 609
                         $row = mysqli_fetch_assoc($ds);
610 610
                         $id = $row["id"];
611 611
                         // remove existing events
612
-                        mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
612
+                        mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
613 613
                         // add new events
614
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')");
614
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')");
615 615
                     }
616 616
                 }
617 617
             }
@@ -621,18 +621,18 @@  discard block
 block discarded – undo
621 621
 
622 622
 // Install Snippets
623 623
 if (isset ($_POST['snippet']) || $installData) {
624
-    echo "<h3>" . $_lang['snippets'] . ":</h3> ";
624
+    echo "<h3>".$_lang['snippets'].":</h3> ";
625 625
     $selSnips = $_POST['snippet'];
626 626
     foreach ($moduleSnippets as $k=>$moduleSnippet) {
627 627
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
628
-        if($installSample || in_array($k, $selSnips)) {
628
+        if ($installSample || in_array($k, $selSnips)) {
629 629
             $name = mysqli_real_escape_string($conn, $moduleSnippet[0]);
630 630
             $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]);
631 631
             $filecontent = $moduleSnippet[2];
632 632
             $properties = $moduleSnippet[3];
633 633
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
634 634
             if (!file_exists($filecontent))
635
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
635
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>";
636 636
             else {
637 637
 
638 638
                 // Create the category if it does not already exist
@@ -641,22 +641,22 @@  discard block
 block discarded – undo
641 641
                 $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent)));
642 642
                 $snippet = removeDocblock($snippet, 'snippet');
643 643
                 $snippet = mysqli_real_escape_string($conn, $snippet);
644
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
644
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
645 645
                 if (mysqli_num_rows($rs)) {
646 646
                     $row = mysqli_fetch_assoc($rs);
647
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
648
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
649
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
647
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
648
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
649
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
650 650
                         return;
651 651
                     }
652
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
652
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
653 653
                 } else {
654 654
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
655
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
656
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
655
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
656
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
657 657
                         return;
658 658
                     }
659
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
659
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
660 660
                 }
661 661
             }
662 662
         }
@@ -665,24 +665,24 @@  discard block
 block discarded – undo
665 665
 
666 666
 // Install demo-site
667 667
 if ($installData && $moduleSQLDataFile) {
668
-    echo "<p>" . $_lang['installing_demo_site'];
668
+    echo "<p>".$_lang['installing_demo_site'];
669 669
     $sqlParser->process($moduleSQLDataFile);
670 670
     // display database results
671 671
     if ($sqlParser->installFailed == true) {
672 672
         $errors += 1;
673
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
674
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
675
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
673
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
674
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
675
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
676 676
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
677
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
677
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
678 678
         }
679 679
         echo "</p>";
680
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
680
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
681 681
         return;
682 682
     } else {
683 683
         $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix);
684 684
         $rs = mysqli_query($sqlParser->conn, $sql);
685
-        if(mysqli_num_rows($rs)) {
685
+        if (mysqli_num_rows($rs)) {
686 686
             $row = mysqli_fetch_assoc($rs);
687 687
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
688 688
             mysqli_query($sqlParser->conn, $sql);
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
 
694 694
 // Install Dependencies
695 695
 foreach ($moduleDependencies as $dependency) {
696
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
696
+	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
697 697
 	if (!$ds) {
698
-		echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
698
+		echo "<p>".mysqli_error($sqlParser->conn)."</p>";
699 699
 		return;
700 700
 	} else {
701 701
 		$row = mysqli_fetch_assoc($ds);
@@ -703,37 +703,37 @@  discard block
 block discarded – undo
703 703
 		$moduleGuid = $row["guid"];
704 704
 	}
705 705
 	// get extra id
706
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
706
+	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
707 707
 	if (!$ds) {
708
-		echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
708
+		echo "<p>".mysqli_error($sqlParser->conn)."</p>";
709 709
 		return;
710 710
 	} else {
711 711
 		$row = mysqli_fetch_assoc($ds);
712 712
 		$extraId = $row["id"];
713 713
 	}
714 714
 	// setup extra as module dependency
715
-	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
715
+	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
716 716
 	if (!$ds) {
717
-		echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
717
+		echo "<p>".mysqli_error($sqlParser->conn)."</p>";
718 718
 		return;
719 719
 	} else {
720 720
 		if (mysqli_num_rows($ds) === 0) {
721
-			mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
722
-			echo '<p>&nbsp;&nbsp;' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>';
721
+			mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
722
+			echo '<p>&nbsp;&nbsp;'.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>';
723 723
 		} else {
724
-			mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
725
-			echo '<p>&nbsp;&nbsp;' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>';
724
+			mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']);
725
+			echo '<p>&nbsp;&nbsp;'.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>';
726 726
 		}
727 727
 		if ($dependency['type'] == 30 || $dependency['type'] == 40) {
728 728
 			// set extra guid for plugins and snippets
729
-			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
729
+			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
730 730
 			if (!$ds) {
731
-				echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
731
+				echo "<p>".mysqli_error($sqlParser->conn)."</p>";
732 732
 				return;
733 733
 			} else {
734 734
 				if (mysqli_num_rows($ds) != 0) {
735
-					mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
736
-					echo '<p>&nbsp;&nbsp;' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>';
735
+					mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
736
+					echo '<p>&nbsp;&nbsp;'.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>';
737 737
 				}
738 738
 			}
739 739
 		}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 
743 743
 // call back function
744 744
 if ($callBackFnc != "")
745
-    $callBackFnc ($sqlParser);
745
+    $callBackFnc($sqlParser);
746 746
 
747 747
 // Setup the MODX API -- needed for the cache processor
748 748
 define('MODX_API_MODE', true);
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
 }
778 778
 
779 779
 // setup completed!
780
-echo "<p><b>" . $_lang['installation_successful'] . "</b></p>";
781
-echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
780
+echo "<p><b>".$_lang['installation_successful']."</b></p>";
781
+echo "<p>".$_lang['to_log_into_content_manager']."</p>";
782 782
 if ($installMode == 0) {
783
-    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>";
783
+    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>";
784 784
 } else {
785
-    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>";
785
+    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>";
786 786
 }
787 787
 
788 788
 /**
@@ -792,11 +792,11 @@  discard block
 block discarded – undo
792 792
  * @param string $old
793 793
  * @return string
794 794
  */
795
-function propUpdate($new,$old){
795
+function propUpdate($new, $old){
796 796
     $newArr = parseProperties($new);
797 797
     $oldArr = parseProperties($old);
798
-    foreach ($oldArr as $k => $v){
799
-        if (isset($v['0']['options'])){
798
+    foreach ($oldArr as $k => $v) {
799
+        if (isset($v['0']['options'])) {
800 800
             $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options'];
801 801
         }
802 802
     }
@@ -811,30 +811,30 @@  discard block
 block discarded – undo
811 811
  * @param bool|mixed $json
812 812
  * @return string
813 813
  */
814
-function parseProperties($propertyString, $json=false) {
815
-    $propertyString = str_replace('{}', '', $propertyString );
816
-    $propertyString = str_replace('} {', ',', $propertyString );
814
+function parseProperties($propertyString, $json = false){
815
+    $propertyString = str_replace('{}', '', $propertyString);
816
+    $propertyString = str_replace('} {', ',', $propertyString);
817 817
 
818
-    if(empty($propertyString)) return array();
819
-    if($propertyString=='{}' || $propertyString=='[]') return array();
818
+    if (empty($propertyString)) return array();
819
+    if ($propertyString == '{}' || $propertyString == '[]') return array();
820 820
 
821 821
     $jsonFormat = isJson($propertyString, true);
822 822
     $property = array();
823 823
     // old format
824
-    if ( $jsonFormat === false) {
825
-        $props= explode('&', $propertyString);
824
+    if ($jsonFormat === false) {
825
+        $props = explode('&', $propertyString);
826 826
         foreach ($props as $prop) {
827 827
             $prop = trim($prop);
828
-            if($prop === '') {
828
+            if ($prop === '') {
829 829
                 continue;
830 830
             }
831 831
 
832 832
             $arr = explode(';', $prop);
833
-            if( ! is_array($arr)) {
833
+            if (!is_array($arr)) {
834 834
                 $arr = array();
835 835
             }
836 836
             $key = explode('=', isset($arr[0]) ? $arr[0] : '');
837
-            if( ! is_array($key) || empty($key[0])) {
837
+            if (!is_array($key) || empty($key[0])) {
838 838
                 continue;
839 839
             }
840 840
 
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 
859 859
         }
860 860
     // new json-format
861
-    } else if(!empty($jsonFormat)){
861
+    } else if (!empty($jsonFormat)) {
862 862
         $property = $jsonFormat;
863 863
     }
864 864
     if ($json) {
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
  * @param bool $returnData
874 874
  * @return bool|mixed
875 875
  */
876
-function isJson($string, $returnData=false) {
876
+function isJson($string, $returnData = false){
877 877
     $data = json_decode($string, true);
878 878
     return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false;
879 879
 }
@@ -883,20 +883,20 @@  discard block
 block discarded – undo
883 883
  * @param SqlParser $sqlParser
884 884
  * @return int
885 885
  */
886
-function getCreateDbCategory($category, $sqlParser) {
886
+function getCreateDbCategory($category, $sqlParser){
887 887
     $dbase = $sqlParser->dbname;
888
-    $dbase = '`' . trim($dbase,'`') . '`';
888
+    $dbase = '`'.trim($dbase, '`').'`';
889 889
     $table_prefix = $sqlParser->prefix;
890 890
     $category_id = 0;
891
-    if(!empty($category)) {
891
+    if (!empty($category)) {
892 892
         $category = mysqli_real_escape_string($sqlParser->conn, $category);
893 893
         $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
894
-        if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
894
+        if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
895 895
             $category_id = $row['id'];
896 896
         } else {
897 897
             $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
898 898
             $rs = mysqli_query($sqlParser->conn, $q);
899
-            if($rs) {
899
+            if ($rs) {
900 900
                 $category_id = mysqli_insert_id($sqlParser->conn);
901 901
             }
902 902
         }
@@ -911,12 +911,12 @@  discard block
 block discarded – undo
911 911
  * @param string $type
912 912
  * @return string
913 913
  */
914
-function removeDocblock($code, $type) {
914
+function removeDocblock($code, $type){
915 915
 
916 916
     $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1);
917 917
 
918 918
     // Procedure taken from plugin.filesource.php
919
-    switch($type) {
919
+    switch ($type) {
920 920
         case 'snippet':
921 921
             $elm_name = 'snippets';
922 922
             $include = 'return require';
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         default:
933 933
             return $cleaned;
934 934
     };
935
-    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
935
+    if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
936 936
         return $cleaned;
937 937
 
938 938
     // fileBinding not found - return code incl docblock
Please login to merge, or discard this patch.
manager/frames/1.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 header("X-XSS-Protection: 0");
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 if (isset($_COOKIE['MODX_themeColor'])) {
49
-    $body_class .= ' ' . $_COOKIE['MODX_themeColor'];
49
+    $body_class .= ' '.$_COOKIE['MODX_themeColor'];
50 50
 }
51 51
 
52 52
 if (isset($modx->pluginCache['ElementsInTree'])) {
@@ -74,36 +74,36 @@  discard block
 block discarded – undo
74 74
     $user['which_browser'] = $modx->config['which_browser'];
75 75
 }
76 76
 
77
-$css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime;
77
+$css = 'media/style/'.$modx->config['manager_theme'].'/css/page.css?v='.$lastInstallTime;
78 78
 
79 79
 if ($modx->config['manager_theme'] == 'default') {
80
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
81
-        require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
80
+    if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
81
+        require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php';
82 82
         $minifier = new Formatter\CSSMinify();
83
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css');
84
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css');
85
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css');
86
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css');
87
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css');
88
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css');
89
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css');
90
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css');
91
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css');
92
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css');
93
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css');
83
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css');
84
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css');
85
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css');
86
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css');
87
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css');
88
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css');
89
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css');
90
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css');
91
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css');
92
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css');
93
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css');
94 94
         $css = $minifier->minify();
95
-        file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css);
95
+        file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css);
96 96
     }
97
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
98
-        $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
97
+    if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
98
+        $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime;
99 99
     }
100 100
 }
101 101
 
102
-$modx->config['global_tabs'] = (int)($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin')));
102
+$modx->config['global_tabs'] = (int) ($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin')));
103 103
 
104 104
 ?>
105 105
 <!DOCTYPE html>
106
-<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="') . $mxla . '" xml:lang="' . $mxla . '"' ?>>
106
+<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="').$mxla.'" xml:lang="'.$mxla.'"' ?>>
107 107
 <head>
108 108
     <title><?= $site_name ?>- (EVO CMS Manager)</title>
109 109
     <meta http-equiv="Content-Type" content="text/html; charset=<?= $modx_manager_charset ?>" />
@@ -134,20 +134,20 @@  discard block
 block discarded – undo
134 134
         MODX_SITE_URL: '<?= MODX_SITE_URL ?>',
135 135
         MODX_MANAGER_URL: '<?= MODX_MANAGER_URL ?>',
136 136
         user: {
137
-          role: <?= (int)$user['role'] ?>,
137
+          role: <?= (int) $user['role'] ?>,
138 138
           username: '<?= $user['username'] ?>'
139 139
         },
140 140
         config: {
141 141
           mail_check_timeperiod: <?= $modx->config['mail_check_timeperiod'] ?>,
142
-          menu_height: <?= (int)$menu_height ?>,
143
-          tree_width: <?= (int)$tree_width ?>,
144
-          tree_min_width: <?= (int)$tree_min_width ?>,
145
-          session_timeout: <?= (int)$modx->config['session_timeout'] ?>,
146
-          site_start: <?= (int)$modx->config['site_start'] ?>,
147
-          tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int)$modx->config['tree_page_click'] : 27) ?>,
142
+          menu_height: <?= (int) $menu_height ?>,
143
+          tree_width: <?= (int) $tree_width ?>,
144
+          tree_min_width: <?= (int) $tree_min_width ?>,
145
+          session_timeout: <?= (int) $modx->config['session_timeout'] ?>,
146
+          site_start: <?= (int) $modx->config['site_start'] ?>,
147
+          tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int) $modx->config['tree_page_click'] : 27) ?>,
148 148
           theme: '<?= $modx->config['manager_theme'] ?>',
149 149
           which_browser: '<?= $user['which_browser'] ?>',
150
-          layout: <?= (int)$manager_layout ?>,
150
+          layout: <?= (int) $manager_layout ?>,
151 151
           textdir: '<?= $modx_textdir ?>',
152 152
           global_tabs: <?= $modx->config['global_tabs'] ?>
153 153
 
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
           delete a[b];
233 233
         },
234 234
         openedArray: [],
235
-        lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?>
235
+        lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)."\n" ?>
236 236
       };
237 237
       <?php
238 238
       $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
239
-      echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n		modx.openedArray[", $opened) . '] = 1;') . "\n";
239
+      echo (empty($opened) ? '' : 'modx.openedArray['.implode("] = 1;\n		modx.openedArray[", $opened).'] = 1;')."\n";
240 240
       ?>
241 241
     </script>
242 242
     <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script>
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                             <a href="javascript:;" class="dropdown-toggle" onclick="return false;">
366 366
                                 <span class="username"><?= $user['username'] ?></span>
367 367
                                 <?php if ($user['photo']) { ?>
368
-                                    <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span>
368
+                                    <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL.$user['photo'] ?>);"></span>
369 369
                                 <?php } else { ?>
370 370
                                     <span class="icon"><?= $_style['menu_user'] ?></span>
371 371
                                 <?php } ?>
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                                 $version = 'Evolution';
393 393
                                 ?>
394 394
                                 <?php
395
-                                echo sprintf('<li><span class="dropdown-item" title="%s &ndash; %s" %s>' . $version . ' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']);
395
+                                echo sprintf('<li><span class="dropdown-item" title="%s &ndash; %s" %s>'.$version.' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']);
396 396
                                 ?>
397 397
                             </ul>
398 398
                         </li>
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
      */
527 527
     function constructLink($action, $img, $text, $allowed)
528 528
     {
529
-        if ((bool)$allowed) {
529
+        if ((bool) $allowed) {
530 530
             echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action);
531 531
             echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
532 532
         }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     <script type="text/javascript">
538 538
 
539 539
       if (document.getElementById('treeMenu')) {
540
-          <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
540
+          <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?>
541 541
 
542 542
         document.getElementById('treeMenu_openelements').onclick = function(e) {
543 543
           e.preventDefault();
@@ -555,12 +555,12 @@  discard block
 block discarded – undo
555 555
           }
556 556
         };
557 557
           <?php } ?>
558
-          <?php if($use_browser && $modx->hasPermission('assets_images')) { ?>
558
+          <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?>
559 559
 
560 560
         document.getElementById('treeMenu_openimages').onclick = function(e) {
561 561
           e.preventDefault();
562 562
           if (modx.config.global_tabs && !e.shiftKey) {
563
-            modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'});
563
+            modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'});
564 564
           } else {
565 565
             var randomNum = '<?= $_lang["files_files"] ?>';
566 566
             if (e.shiftKey) {
@@ -573,12 +573,12 @@  discard block
 block discarded – undo
573 573
           }
574 574
         };
575 575
           <?php } ?>
576
-          <?php if($use_browser && $modx->hasPermission('assets_files')) { ?>
576
+          <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?>
577 577
 
578 578
         document.getElementById('treeMenu_openfiles').onclick = function(e) {
579 579
           e.preventDefault();
580 580
           if (modx.config.global_tabs && !e.shiftKey) {
581
-            modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'});
581
+            modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'});
582 582
           } else {
583 583
             var randomNum = '<?= $_lang["files_files"] ?>';
584 584
             if (e.shiftKey) {
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 
633 633
 </div>
634 634
 <?php if ($modx->config['show_picker'] != "0") {
635
-    include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php');
635
+    include('media/style/'.$modx->config['manager_theme'].'/color.switcher.php');
636 636
 } ?>
637 637
 </body>
638 638
 </html>
Please login to merge, or discard this patch.
manager/actions/files.dynamic.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('file_manager')) {
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 $newToken = makeToken();
10 10
 
11 11
 // settings
12
-$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/';
12
+$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/';
13 13
 $excludes = array(
14 14
     '.',
15 15
     '..',
16 16
     '.svn'
17 17
 );
18
-$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : '';
19
-$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix);
20
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix);
18
+$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : '';
19
+$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix);
20
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix);
21 21
 $viewablefiles = explode(',', 'jpg,gif,png,ico');
22 22
 
23 23
 $editablefiles = add_dot($editablefiles);
@@ -30,31 +30,31 @@  discard block
 block discarded – undo
30 30
 {
31 31
 */
32 32
 $protected_path[] = $modx->config['site_manager_path'];
33
-$protected_path[] = $modx->config['base_path'] . 'temp/backup';
34
-$protected_path[] = $modx->config['base_path'] . 'assets/backup';
33
+$protected_path[] = $modx->config['base_path'].'temp/backup';
34
+$protected_path[] = $modx->config['base_path'].'assets/backup';
35 35
 
36 36
 if (!$modx->hasPermission('save_plugin')) {
37
-    $protected_path[] = $modx->config['base_path'] . 'assets/plugins';
37
+    $protected_path[] = $modx->config['base_path'].'assets/plugins';
38 38
 }
39 39
 if (!$modx->hasPermission('save_snippet')) {
40
-    $protected_path[] = $modx->config['base_path'] . 'assets/snippets';
40
+    $protected_path[] = $modx->config['base_path'].'assets/snippets';
41 41
 }
42 42
 if (!$modx->hasPermission('save_template')) {
43
-    $protected_path[] = $modx->config['base_path'] . 'assets/templates';
43
+    $protected_path[] = $modx->config['base_path'].'assets/templates';
44 44
 }
45 45
 if (!$modx->hasPermission('save_module')) {
46
-    $protected_path[] = $modx->config['base_path'] . 'assets/modules';
46
+    $protected_path[] = $modx->config['base_path'].'assets/modules';
47 47
 }
48 48
 if (!$modx->hasPermission('empty_cache')) {
49
-    $protected_path[] = $modx->config['base_path'] . 'assets/cache';
49
+    $protected_path[] = $modx->config['base_path'].'assets/cache';
50 50
 }
51 51
 if (!$modx->hasPermission('import_static')) {
52
-    $protected_path[] = $modx->config['base_path'] . 'temp/import';
53
-    $protected_path[] = $modx->config['base_path'] . 'assets/import';
52
+    $protected_path[] = $modx->config['base_path'].'temp/import';
53
+    $protected_path[] = $modx->config['base_path'].'assets/import';
54 54
 }
55 55
 if (!$modx->hasPermission('export_static')) {
56
-    $protected_path[] = $modx->config['base_path'] . 'temp/export';
57
-    $protected_path[] = $modx->config['base_path'] . 'assets/export';
56
+    $protected_path[] = $modx->config['base_path'].'temp/export';
57
+    $protected_path[] = $modx->config['base_path'].'assets/export';
58 58
 }
59 59
 /*
60 60
 }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 {
84 84
     $count = count($array);
85 85
     for ($i = 0; $i < $count; $i++) {
86
-        $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :)
86
+        $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :)
87 87
     }
88 88
     return $array;
89 89
 }
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 $rw = realpath('../');
109 109
 $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf));
110 110
 if (substr($webstart_path, 0, 1) == '/') {
111
-    $webstart_path = '..' . $webstart_path;
111
+    $webstart_path = '..'.$webstart_path;
112 112
 } else {
113
-    $webstart_path = '../' . $webstart_path;
113
+    $webstart_path = '../'.$webstart_path;
114 114
 }
115 115
 
116 116
 ?>
117 117
     <script type="text/javascript">
118 118
 
119
-        var current_path = '<?= $startpath;?>';
119
+        var current_path = '<?= $startpath; ?>';
120 120
 
121 121
         function viewfile (url)
122 122
         {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         function unzipFile (file)
153 153
         {
154 154
             if (confirmUnzip()) {
155
-                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>";
155
+                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>";
156 156
                 return false;
157 157
             }
158 158
         }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         function deleteFolder (folder, status)
175 175
         {
176 176
             if (confirmDeleteFolder(status)) {
177
-                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>";
177
+                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>";
178 178
                 return false;
179 179
             }
180 180
         }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         function deleteFile (file)
183 183
         {
184 184
             if (confirmDelete()) {
185
-                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>";
185
+                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>";
186 186
                 return false;
187 187
             }
188 188
         }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         {
192 192
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
193 193
             if (newFilename !== null && newFilename !== file) {
194
-                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
194
+                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
195 195
             }
196 196
         }
197 197
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         {
200 200
             var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir);
201 201
             if (newDirname !== null && newDirname !== dir) {
202
-                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>";
202
+                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>";
203 203
             }
204 204
         }
205 205
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         {
208 208
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
209 209
             if (newFilename !== null && newFilename !== file) {
210
-                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
210
+                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
211 211
             }
212 212
         }
213 213
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             <?php endif ?>
227 227
             <?php
228 228
             if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') {
229
-                $href = 'a=31&path=' . urlencode($_REQUEST['path']);
229
+                $href = 'a=31&path='.urlencode($_REQUEST['path']);
230 230
             } else {
231 231
                 $href = 'a=2';
232 232
             }
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
                 $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>';
237 237
                 $ph['image'] = $_style['files_folder-open'];
238 238
                 $ph['subject'] = $_lang['add_folder'];
239
-                $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name=';
239
+                $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name=';
240 240
                 $_ = parsePlaceholder($tpl, $ph);
241 241
 
242
-                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>';
242
+                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>';
243 243
                 $ph['image'] = $_style['files_page_html'];
244
-                $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name=';
244
+                $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name=';
245 245
                 $_ .= parsePlaceholder($tpl, $ph);
246 246
                 echo $_;
247 247
             }
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
             $ph = array();
272 272
             $ph['style_path'] = $theme_image_path;
273 273
             // To Top Level with folder icon to the left
274
-            if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) {
275
-                $ph['image'] = '' . $_style['files_top'] . '';
274
+            if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) {
275
+                $ph['image'] = ''.$_style['files_top'].'';
276 276
                 $ph['subject'] = '<span>Top</span>';
277 277
             } else {
278
-                $ph['image'] = '' . $_style['files_top'] . '';
279
-                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/';
278
+                $ph['image'] = ''.$_style['files_top'].'';
279
+                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/';
280 280
             }
281 281
 
282 282
             echo parsePlaceholder($tpl, $ph);
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
                     if (empty($v)) {
294 294
                         continue;
295 295
                     }
296
-                    $path .= rtrim($v, '/') . '/';
296
+                    $path .= rtrim($v, '/').'/';
297 297
                     if (1 < $count) {
298
-                        $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path);
299
-                        $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>';
298
+                        $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path);
299
+                        $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>';
300 300
                     } else {
301
-                        $pieces[$i] = '<span>' . trim($v, '/') . '</span>';
301
+                        $pieces[$i] = '<span>'.trim($v, '/').'</span>';
302 302
                     }
303 303
                     $count--;
304 304
                 }
@@ -311,16 +311,16 @@  discard block
 block discarded – undo
311 311
         </div>
312 312
         <?php
313 313
         // check to see user isn't trying to move below the document_root
314
-        if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) {
314
+        if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) {
315 315
             $modx->webAlertAndQuit($_lang["files_access_denied"]);
316 316
         }
317 317
 
318 318
         // Unzip .zip files - by Raymond
319 319
         if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) {
320
-            if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) {
321
-                echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />';
320
+            if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) {
321
+                echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />';
322 322
             } else {
323
-                echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />';
323
+                echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />';
324 324
             }
325 325
         }
326 326
         // End Unzip - Raymond
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
             if ($_REQUEST['mode'] == 'deletefolder') {
333 333
                 $folder = $_REQUEST['folderpath'];
334 334
                 if (!$token_check || !@rrmdir($folder)) {
335
-                    echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />';
335
+                    echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />';
336 336
                 } else {
337
-                    echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />';
337
+                    echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />';
338 338
                 }
339 339
             }
340 340
 
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
                 if (!mkdirs("{$startpath}/{$foldername}", 0777)) {
346 346
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
347 347
                 } else {
348
-                    if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) {
349
-                        echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />';
348
+                    if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) {
349
+                        echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />';
350 350
                     } else {
351
-                        echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />';
351
+                        echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />';
352 352
                     }
353 353
                 }
354 354
                 umask($old_umask);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 $filename = $modx->db->escape($filename);
361 361
 
362 362
                 if (!checkExtension($filename)) {
363
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
363
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
364 364
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) {
365 365
                     echo $_lang['files.dynamic.php3'];
366 366
                 } else {
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
                 $newFilename = $modx->db->escape($newFilename);
383 383
 
384 384
                 if (!checkExtension($newFilename)) {
385
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
385
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
386 386
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
387 387
                     echo $_lang['files.dynamic.php3'];
388 388
                 } else {
389
-                    if (!copy($filename, MODX_BASE_PATH . $newFilename)) {
389
+                    if (!copy($filename, MODX_BASE_PATH.$newFilename)) {
390 390
                         echo $_lang['files.dynamic.php5'];
391 391
                     }
392 392
                     umask($old_umask);
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             // Rename folder here
396 396
             if ($_REQUEST['mode'] == 'renameFolder') {
397 397
                 $old_umask = umask(0);
398
-                $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname'];
398
+                $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname'];
399 399
                 $dirname = $modx->db->escape($dirname);
400 400
                 $newDirname = str_replace(array(
401 401
                     '..\\',
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
                 if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) {
409 409
                     echo $_lang['files.dynamic.php3'];
410
-                } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) {
410
+                } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) {
411 411
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
412 412
                 }
413 413
                 umask($old_umask);
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
                 $newFilename = $modx->db->escape($newFilename);
428 428
 
429 429
                 if (!checkExtension($newFilename)) {
430
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
430
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
431 431
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
432 432
                     echo $_lang['files.dynamic.php3'];
433 433
                 } else {
434
-                    if (!rename($filename, $path . '/' . $newFilename)) {
434
+                    if (!rename($filename, $path.'/'.$newFilename)) {
435 435
                         echo $_lang['files.dynamic.php5'];
436 436
                     }
437 437
                     umask($old_umask);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                 ls($startpath);
465 465
                 echo "\n\n\n";
466 466
                 if ($folders == 0 && $files == 0) {
467
-                    echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>';
467
+                    echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>';
468 468
                 }
469 469
                 ?>
470 470
             </table>
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
         <div class="container">
474 474
             <p>
475 475
                 <?php
476
-                echo $_lang['files_directories'] . ': <b>' . $folders . '</b> ';
477
-                echo $_lang['files_files'] . ': <b>' . $files . '</b> ';
478
-                echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> ';
479
-                echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>'
476
+                echo $_lang['files_directories'].': <b>'.$folders.'</b> ';
477
+                echo $_lang['files_files'].': <b>'.$files.'</b> ';
478
+                echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> ';
479
+                echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>'
480 480
                 ?>
481 481
             </p>
482 482
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
                 </form>
502 502
                 <?php
503 503
             } else {
504
-                echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>";
504
+                echo "<p>".$_lang['files_upload_inhibited_msg']."</p>";
505 505
             }
506 506
             ?>
507 507
             <div id="imageviewer"></div>
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
     if ($file == $selFile) {
587 587
         $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default'];
588 588
     }
589
-    return '<i class="' . $icon . ' FilesPage"></i>';
589
+    return '<i class="'.$icon.' FilesPage"></i>';
590 590
 }
591 591
 
592 592
 /**
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
     );
605 605
     if ($file == $selFile) {
606 606
         $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default'];
607
-        return ' class="' . $class . '"';
607
+        return ' class="'.$class.'"';
608 608
     }
609 609
     return '';
610 610
 }
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx;
619 619
     $dircounter = 0;
620 620
     $filecounter = 0;
621
-    $curpath = str_replace('//', '/', $curpath . '/');
621
+    $curpath = str_replace('//', '/', $curpath.'/');
622 622
 
623 623
     if (!is_dir($curpath)) {
624 624
         echo 'Invalid path "', $curpath, '"<br />';
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
     // first, get info
630 630
     foreach ($dir as $file) {
631
-        $newpath = $curpath . $file;
631
+        $newpath = $curpath.$file;
632 632
         if ($file === '..' || $file === '.') {
633 633
             continue;
634 634
         }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
             if ($file === '..' || $file === '.') {
639 639
                 continue;
640 640
             } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) {
641
-                $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>';
641
+                $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>';
642 642
 
643 643
                 $dfiles = scandir($newpath);
644 644
                 foreach ($dfiles as $i => $infile) {
@@ -651,13 +651,13 @@  discard block
 block discarded – undo
651 651
                 }
652 652
                 $file_exists = (0 < count($dfiles)) ? 'file_exists' : '';
653 653
 
654
-                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : '';
654
+                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : '';
655 655
             } else {
656
-                $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>';
657
-                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : '';
656
+                $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>';
657
+                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : '';
658 658
             }
659 659
 
660
-            $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : '';
660
+            $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : '';
661 661
 
662 662
             // increment the counter
663 663
             $dircounter++;
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
             $type = getExtension($newpath);
666 666
             $files_array[$filecounter]['file'] = $newpath;
667 667
             $files_array[$filecounter]['stats'] = lstat($newpath);
668
-            $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file;
669
-            $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, $len, strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>');
670
-            $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view'];
671
-            $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : '';
672
-            $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>';
673
-            $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>';
674
-            $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>';
675
-            $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>';
668
+            $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file;
669
+            $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, $len, strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>');
670
+            $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view'];
671
+            $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : '';
672
+            $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>';
673
+            $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>';
674
+            $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>';
675
+            $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>';
676 676
 
677 677
             // increment the counter
678 678
             $filecounter++;
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
     for ($i = 0; $i < $folders; $i++) {
686 686
         $filesizes += $dirs_array[$i]['stats']['7'];
687 687
         echo '<tr>';
688
-        echo '<td>' . $dirs_array[$i]['text'] . '</td>';
689
-        echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>';
690
-        echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>';
688
+        echo '<td>'.$dirs_array[$i]['text'].'</td>';
689
+        echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>';
690
+        echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>';
691 691
         echo '<td class="actions text-right">';
692 692
         echo $dirs_array[$i]['rename'];
693 693
         echo $dirs_array[$i]['delete'];
@@ -700,10 +700,10 @@  discard block
 block discarded – undo
700 700
     sort($files_array); // sorting the array alphabetically (Thanks pxl8r!)
701 701
     for ($i = 0; $i < $files; $i++) {
702 702
         $filesizes += $files_array[$i]['stats']['7'];
703
-        echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>';
704
-        echo '<td>' . $files_array[$i]['text'] . '</td>';
705
-        echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>';
706
-        echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>';
703
+        echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>';
704
+        echo '<td>'.$files_array[$i]['text'].'</td>';
705
+        echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>';
706
+        echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>';
707 707
         echo '<td class="actions text-right">';
708 708
         echo $files_array[$i]['unzip'];
709 709
         echo $files_array[$i]['view'];
@@ -840,17 +840,17 @@  discard block
 block discarded – undo
840 840
     $zip = zip_open($file);
841 841
     if ($zip) {
842 842
         $old_umask = umask(0);
843
-        $path = rtrim($path, '/') . '/';
843
+        $path = rtrim($path, '/').'/';
844 844
         while ($zip_entry = zip_read($zip)) {
845 845
             if (zip_entry_filesize($zip_entry) > 0) {
846 846
                 // str_replace must be used under windows to convert "/" into "\"
847 847
                 $zip_entry_name = zip_entry_name($zip_entry);
848
-                $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name));
849
-                $complete_name = $path . str_replace('\\', '/', $zip_entry_name);
848
+                $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name));
849
+                $complete_name = $path.str_replace('\\', '/', $zip_entry_name);
850 850
                 if (!file_exists($complete_path)) {
851 851
                     $tmp = '';
852 852
                     foreach (explode('/', $complete_path) AS $k) {
853
-                        $tmp .= $k . '/';
853
+                        $tmp .= $k.'/';
854 854
                         if (!is_dir($tmp)) {
855 855
                             mkdir($tmp, 0777);
856 856
                         }
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
  */
876 876
 function rrmdir($dir)
877 877
 {
878
-    foreach (glob($dir . '/*') as $file) {
878
+    foreach (glob($dir.'/*') as $file) {
879 879
         if (is_dir($file)) {
880 880
             rrmdir($file);
881 881
         } else {
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
     $msg = '';
895 895
     foreach ($_FILES['userfile']['name'] as $i => $name) {
896 896
         if (empty($_FILES['userfile']['tmp_name'][$i])) continue;
897
-        $userfile= array();
897
+        $userfile = array();
898 898
 
899 899
         $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i];
900 900
         $userfile['error'] = $_FILES['userfile']['error'][$i];
@@ -911,12 +911,12 @@  discard block
 block discarded – undo
911 911
         $userfile['type'] = $_FILES['userfile']['type'][$i];
912 912
 
913 913
         // this seems to be an upload action.
914
-        $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath));
915
-        $path = rtrim($path, '/') . '/' . $userfile['name'];
914
+        $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath));
915
+        $path = rtrim($path, '/').'/'.$userfile['name'];
916 916
         $msg .= $path;
917 917
         if ($userfile['error'] == 0) {
918
-            $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : '';
919
-            $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>';
918
+            $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : '';
919
+            $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>';
920 920
         }
921 921
 
922 922
         $userfilename = $userfile['tmp_name'];
@@ -924,15 +924,15 @@  discard block
 block discarded – undo
924 924
         if (is_uploaded_file($userfilename)) {
925 925
             // file is uploaded file, process it!
926 926
             if (!checkExtension($userfile['name'])) {
927
-                $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>';
927
+                $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>';
928 928
             } else {
929
-                if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) {
929
+                if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) {
930 930
                     // Ryan: Repair broken permissions issue with file manager
931 931
                     if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
932
-                        @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions);
932
+                        @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions);
933 933
                     }
934 934
                     // Ryan: End
935
-                    $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>';
935
+                    $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>';
936 936
 
937 937
                     // invoke OnFileManagerUpload event
938 938
                     $modx->invokeEvent('OnFileManagerUpload', array(
@@ -940,13 +940,13 @@  discard block
 block discarded – undo
940 940
                         'filename' => $userfile['name']
941 941
                     ));
942 942
                     // Log the change
943
-                    logFileChange('upload', $_POST['path'] . '/' . $userfile['name']);
943
+                    logFileChange('upload', $_POST['path'].'/'.$userfile['name']);
944 944
                 } else {
945
-                    $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>';
945
+                    $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>';
946 946
                 }
947 947
             }
948 948
         } else {
949
-            $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>';
949
+            $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>';
950 950
             switch ($userfile['error']) {
951 951
                 case 0: //no error; possible file attack!
952 952
                     $msg .= $_lang['files_upload_error0'];
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
             $msg .= '</span><br />';
971 971
         }
972 972
     }
973
-    return $msg . '<br/>';
973
+    return $msg.'<br/>';
974 974
 }
975 975
 
976 976
 /**
@@ -986,9 +986,9 @@  discard block
 block discarded – undo
986 986
 
987 987
     // Write $content to our opened file.
988 988
     if (file_put_contents($filename, $content) === false) {
989
-        $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />';
989
+        $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />';
990 990
     } else {
991
-        $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />';
991
+        $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />';
992 992
         $_REQUEST['mode'] = 'edit';
993 993
     }
994 994
     // Log the change
@@ -1007,9 +1007,9 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
     $file = $_REQUEST['path'];
1009 1009
     if (!$token_check || !@unlink($file)) {
1010
-        $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />';
1010
+        $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />';
1011 1011
     } else {
1012
-        $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />';
1012
+        $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />';
1013 1013
     }
1014 1014
 
1015 1015
     // Log the change
Please login to merge, or discard this patch.
manager/actions/mutate_settings/functions.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 function get_lang_keys($filename)
9 9
 {
10
-    $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
10
+    $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename;
11 11
     if (is_file($file) && is_readable($file)) {
12 12
         include($file);
13 13
         $out = isset($_lang) ? array_keys($_lang) : array();
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
     if (!empty($key)) {
54 54
         $languages = get_langs_by_key($key);
55 55
         sort($languages);
56
-        $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
56
+        $lang_options .= '<option value="">'.$_lang['language_title'].'</option>';
57 57
 
58 58
         foreach ($languages as $language_name) {
59 59
             $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
60
-            $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
60
+            $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>';
61 61
         }
62 62
 
63 63
         return $lang_options;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         foreach ($languages as $language_name) {
68 68
             $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
69 69
             $sel = $language_name === $selected_lang ? ' selected="selected"' : '';
70
-            $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
70
+            $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>';
71 71
         }
72 72
 
73 73
         return $lang_options;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $disabled = '';
93 93
     }
94 94
     if ($add) {
95
-        $add = ' ' . $add;
95
+        $add = ' '.$add;
96 96
     }
97 97
 
98 98
     return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value,
Please login to merge, or discard this patch.
manager/actions/mutate_module.dynamic.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-switch($modx->manager->action) {
5
+switch ($modx->manager->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if (!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if (!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
16 16
 	default:
17 17
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
19
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
21 21
 $tbl_membergroup_names = $modx->getFullTableName('membergroup_names');
22 22
 $tbl_site_content = $modx->getFullTableName('site_content');
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return string
35 35
  */
36
-function createGUID() {
36
+function createGUID(){
37 37
 	srand((double) microtime() * 1000000);
38 38
 	$r = rand();
39
-	$u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1);
39
+	$u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1);
40 40
 	$m = md5($u);
41 41
 	return $m;
42 42
 }
43 43
 
44 44
 // check to see the module editor isn't locked
45
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
45
+if ($lockedEl = $modx->elementIsLocked(6, $id)) {
46 46
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
47 47
 }
48 48
 // end check for lock
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 // Lock snippet for other users to edit
51 51
 $modx->lockElement(6, $id);
52 52
 
53
-if(isset($_GET['id'])) {
53
+if (isset($_GET['id'])) {
54 54
 	$rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
55 55
 	$content = $modx->db->getRow($rs);
56
-	if(!$content) {
56
+	if (!$content) {
57 57
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
58 58
 	}
59 59
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
60 60
 	$_SESSION['itemname'] = $content['name'];
61
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
61
+	if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
62 62
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
63 63
 	}
64 64
 } else {
65 65
 	$_SESSION['itemname'] = $_lang["new_module"];
66 66
 	$content['wrap'] = '1';
67 67
 }
68
-if($modx->manager->hasFormValues()) {
68
+if ($modx->manager->hasFormValues()) {
69 69
 	$modx->manager->loadFormValues();
70 70
 }
71 71
 
72 72
 // Add lock-element JS-Script
73 73
 $lockElementId = $id;
74 74
 $lockElementType = 6;
75
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
75
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
76 76
 ?>
77 77
 <script type="text/javascript">
78 78
 	function loadDependencies() {
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	function BrowseServer() {
420 420
 		var w = screen.width * 0.7;
421 421
 		var h = screen.height * 0.7;
422
-		OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h);
422
+		OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h);
423 423
 	}
424 424
 
425 425
 	function SetUrl(url, width, height, alt) {
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	<?php
440 440
 	// invoke OnModFormPrerender event
441 441
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
442
-	if(is_array($evtOut)) {
442
+	if (is_array($evtOut)) {
443 443
 		echo implode('', $evtOut);
444 444
 	}
445 445
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	<input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
454 454
 
455 455
 	<h1>
456
-		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
456
+		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
457 457
 	</h1>
458 458
 
459 459
 	<?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 						<div class="col-md-9 col-lg-10">
479 479
 							<div class="form-control-name clearfix">
480 480
 								<input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
481
-								<?php if($modx->hasPermission('save_role')): ?>
482
-									<label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip>
481
+								<?php if ($modx->hasPermission('save_role')): ?>
482
+									<label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip>
483 483
 										<input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
484 484
 										<i class="fa fa-lock"></i>
485 485
 									</label>
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
502 502
 								<option>&nbsp;</option>
503 503
 								<?php
504
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
505
-								foreach(getCategories() as $n => $v) {
506
-									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
504
+								include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
505
+								foreach (getCategories() as $n => $v) {
506
+									echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category'])."</option>\n";
507 507
 								}
508 508
 								?>
509 509
 							</select>
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				<div class="form-group">
536 536
 					<div class="form-row">
537 537
 						<label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> />
538
-							<?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label>
538
+							<?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label>
539 539
 					</div>
540 540
 					<div class="form-row">
541 541
 						<label for="parse_docblock">
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 			</div>
601 601
 			<!-- HTML text editor end -->
602 602
 		</div>
603
-		<?php if($modx->manager->action == '108'): ?>
603
+		<?php if ($modx->manager->action == '108'): ?>
604 604
 			<!-- Dependencies -->
605 605
 			<div class="tab-page" id="tabDepend">
606 606
 				<h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2>
@@ -628,14 +628,14 @@  discard block
 block discarded – undo
628 628
 						LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50
629 629
 						LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name');
630 630
 
631
-					include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
631
+					include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
632 632
 					$grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
633 633
 					$grd->noRecordMsg = $_lang['no_records_found'];
634 634
 					$grd->cssClass = 'grid';
635 635
 					$grd->columnHeaderClass = 'gridHeader';
636 636
 					$grd->itemClass = 'gridItem';
637 637
 					$grd->altItemClass = 'gridAltItem';
638
-					$grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
638
+					$grd->columns = $_lang['element_name']." ,".$_lang['type'];
639 639
 					$grd->fields = "name,type";
640 640
 					echo $grd->render();
641 641
 					?>
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
 			<h2 class="tab"><?= $_lang['access_permissions'] ?></h2>
649 649
 			<script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script>
650 650
 			<div class="container container-body">
651
-				<?php if($use_udperms == 1) : ?>
651
+				<?php if ($use_udperms == 1) : ?>
652 652
 					<?php
653 653
 					// fetch user access permissions for the module
654 654
 					$rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
655 655
 					$groupsarray = $modx->db->getColumn('usergroup', $rs);
656 656
 
657
-					if($modx->hasPermission('access_permissions')) {
657
+					if ($modx->hasPermission('access_permissions')) {
658 658
 						?>
659 659
 						<!-- User Group Access Permissions -->
660 660
 						<script type="text/javascript">
@@ -682,22 +682,22 @@  discard block
 block discarded – undo
682 682
 					}
683 683
 					$chk = '';
684 684
 					$rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
685
-					while($row = $modx->db->getRow($rs)) {
685
+					while ($row = $modx->db->getRow($rs)) {
686 686
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
687 687
 						$checked = in_array($row['id'], $groupsarray);
688
-						if($modx->hasPermission('access_permissions')) {
689
-							if($checked) {
688
+						if ($modx->hasPermission('access_permissions')) {
689
+							if ($checked) {
690 690
 								$notPublic = true;
691 691
 							}
692
-							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
692
+							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n";
693 693
 						} else {
694
-							if($checked) {
695
-								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
694
+							if ($checked) {
695
+								$chks = '<input type="hidden" name="usrgroups[]"  value="'.$row['id'].'" />'."\n".$chks;
696 696
 							}
697 697
 						}
698 698
 					}
699
-					if($modx->hasPermission('access_permissions')) {
700
-						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
699
+					if ($modx->hasPermission('access_permissions')) {
700
+						$chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks;
701 701
 					}
702 702
 					echo $chks;
703 703
 					?>
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		<?php
719 719
 		// invoke OnModFormRender event
720 720
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
721
-		if(is_array($evtOut)) {
721
+		if (is_array($evtOut)) {
722 722
 			echo implode('', $evtOut);
723 723
 		}
724 724
 		?>
Please login to merge, or discard this patch.
manager/actions/help/01About_EVO.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
5
+$logo = '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
6 6
 $downloadLinks = array(
7
-	0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
-	1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
-	2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
-	3=>array('title'=>$_lang["extras"],'link'=>array(
7
+	0=>array('title'=>$_lang["information"], 'link'=>'https://evo.im/'),
8
+	1=>array('title'=>$_lang["download"], 'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
+	2=>array('title'=>$_lang["previous_releases"], 'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
+	3=>array('title'=>$_lang["extras"], 'link'=>array(
11 11
 		'http://extras.evolution-cms.com/',
12 12
 		'https://github.com/extras-evolution'
13 13
 	)),
14 14
 );
15 15
 
16 16
 $translationLinks = array(
17
-	0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
-	1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
17
+	0=>array('title'=>'Evolution CMS', 'link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
+	1=>array('title'=>$_lang["extras"], 'link'=>'https://www.transifex.com/evolutioncms/extras/'),
19 19
 );
20 20
 
21 21
 /**
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
  * @param array $linkArr
24 24
  * @return string
25 25
  */
26
-function createList($sectionHeader, $linkArr) {
26
+function createList($sectionHeader, $linkArr){
27 27
 	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28 28
 	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29 29
 	$links = '';
30
-	foreach($linkArr as $row) {
30
+	foreach ($linkArr as $row) {
31 31
 		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32 32
 		foreach ($row['link'] as $link) {
33 33
 			$links .= $links != '' ? '<br/>' : '';
34
-			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
34
+			$links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>';
35 35
 		}
36 36
 		$output .= '
37 37
 		<tr>
38
-			<td align="left"><strong>' . $row["title"] . '</strong></td>
39
-			<td align="left">' . $links . '</td>
38
+			<td align="left"><strong>' . $row["title"].'</strong></td>
39
+			<td align="left">' . $links.'</td>
40 40
 		</tr>';
41 41
 		$links = '';
42 42
 	}
Please login to merge, or discard this patch.
manager/actions/search.static.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     exit();
4 4
 }
5 5
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                         <?php
42 42
                         $rs = $modx->db->select('*', $modx->getFullTableName('site_templates'));
43 43
                         $option[] = '<option value="">No selected</option>';
44
-                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : '';
44
+                        $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : '';
45 45
                         $selected = $templateid === 0 ? ' selected="selected"' : '';
46
-                        $option[] = '<option value="0"' . $selected . '>(blank)</option>';
46
+                        $option[] = '<option value="0"'.$selected.'>(blank)</option>';
47 47
                         while ($row = $modx->db->getRow($rs)) {
48 48
                             $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']);
49 49
                             $selected = $row['id'] == $templateid ? ' selected="selected"' : '';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset);
87 87
     $searchlongtitle = $modx->db->escape(trim($_REQUEST['searchfields']));
88 88
     $search_alias = $modx->db->escape(trim($_REQUEST['searchfields']));
89
-    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : '';
89
+    $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : '';
90 90
     $searchcontent = $modx->db->escape($_REQUEST['content']);
91 91
 
92 92
     $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type';
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $friendly_url_suffix = $modx->config['friendly_url_suffix'];
101 101
         $base_url = $modx->config['base_url'];
102 102
         $site_url = $modx->config['site_url'];
103
-        $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url);
103
+        $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url);
104 104
         if ($url[0] === '/') {
105
-            $url = preg_replace('@^' . $base_url . '@', '', $url);
105
+            $url = preg_replace('@^'.$base_url.'@', '', $url);
106 106
         }
107 107
         if (substr($url, 0, 4) === 'http') {
108
-            $url = preg_replace('@^' . $site_url . '@', '', $url);
108
+            $url = preg_replace('@^'.$site_url.'@', '', $url);
109 109
         }
110 110
         $idFromAlias = $modx->getIdFromAlias($url);
111 111
     }
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->db->query($articul_query);
120 120
 		$articul_id_array = $modx->db->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if (count($articul_id_array) > 0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
124
+			foreach ($articul_id_array as $articul) {
125
+				$articul_id .= $articul['contentid'];
126
+				if ($i !== count($articul_id_array)) {
127
+					$articul_id .= ',';
128 128
 				}
129 129
 				$i++;
130 130
 			}
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+				$sqladd .= $articul_id_query; //search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'";
158 158
             $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'";
159 159
             $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'";
160
-			$sqladd .= $articul_id_query;//search by TV
160
+			$sqladd .= $articul_id_query; //search by TV
161 161
         }
162 162
     } else if ($idFromAlias) {
163 163
         $sqladd .= " sc.id='{$idFromAlias}'";
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
         $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
181 181
         $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0;
182 182
         $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : '';
183
-        $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess';
184
-        $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
183
+        $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess';
184
+        $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
185 185
     }
186 186
 
187 187
     if ($sqladd) {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     $where = $sqladd;
192 192
 
193 193
     if ($where) {
194
-        $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id');
194
+        $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id');
195 195
         $limit = $modx->db->getRecordCount($rs);
196 196
     } else {
197 197
         $limit = 0;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                 if ($limit < 1) {
211 211
                     echo $_lang['search_empty'];
212 212
                 } else {
213
-                    printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit);
213
+                    printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit);
214 214
                     ?>
215 215
                     <script type="text/javascript" src="media/script/tablesort.js"></script>
216 216
                     <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1">
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
                                 if (function_exists('mb_strlen') && function_exists('mb_substr')) {
271 271
                                     ?>
272 272
                                     <td<?= $tdClass ?>>
273
-                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a>
273
+                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a>
274 274
                                     </td>
275
-                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td>
275
+                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td>
276 276
                                     <?php
277 277
                                 } else {
278 278
                                     ?>
279
-                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td>
280
-                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td>
279
+                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td>
280
+                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td>
281 281
                                     <?php
282 282
                                 }
283 283
                                 ?>
@@ -297,115 +297,115 @@  discard block
 block discarded – undo
297 297
                 if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
298 298
                     $docscounts = $modx->db->getRecordCount($rs);
299 299
                     if ($docscounts > 0) {
300
-                        $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>';
300
+                        $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>';
301 301
                         while ($row = $modx->db->getRow($rs)) {
302
-                            $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
302
+                            $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
303 303
                         }
304 304
                     }
305 305
                 }
306 306
 
307 307
                 //templates
308 308
                 if ($modx->hasPermission('edit_template')) {
309
-                    $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' 
310
-					OR `templatename` like '%" . $searchfields . "%' 
311
-					OR `description` like '%" . $searchfields . "%' 
312
-					OR `content` like '%" . $searchfields . "%'");
309
+                    $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' 
310
+					OR `templatename` like '%" . $searchfields."%' 
311
+					OR `description` like '%" . $searchfields."%' 
312
+					OR `content` like '%" . $searchfields."%'");
313 313
                     $templatecounts = $modx->db->getRecordCount($rs);
314 314
                     if ($templatecounts > 0) {
315
-                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>';
315
+                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>';
316 316
                         while ($row = $modx->db->getRow($rs)) {
317
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
317
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
318 318
                         }
319 319
                     }
320 320
                 }
321 321
 
322 322
                 //tvs
323 323
                 if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
324
-                    $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' 
325
-					OR `name` like '%" . $searchfields . "%' 
326
-					OR `description` like '%" . $searchfields . "%' 
327
-					OR `type` like '%" . $searchfields . "%' 
328
-					OR `elements` like '%" . $searchfields . "%' 
329
-					OR `display` like '%" . $searchfields . "%' 
330
-					OR `display_params` like '%" . $searchfields . "%' 
331
-					OR `default_text` like '%" . $searchfields . "%'");
324
+                    $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' 
325
+					OR `name` like '%" . $searchfields."%' 
326
+					OR `description` like '%" . $searchfields."%' 
327
+					OR `type` like '%" . $searchfields."%' 
328
+					OR `elements` like '%" . $searchfields."%' 
329
+					OR `display` like '%" . $searchfields."%' 
330
+					OR `display_params` like '%" . $searchfields."%' 
331
+					OR `default_text` like '%" . $searchfields."%'");
332 332
                     $tvscounts = $modx->db->getRecordCount($rs);
333 333
                     if ($tvscounts > 0) {
334
-                        $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>';
334
+                        $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>';
335 335
                         while ($row = $modx->db->getRow($rs)) {
336
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
336
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
337 337
                         }
338 338
                     }
339 339
                 }
340 340
 
341 341
                 //Chunks
342 342
                 if ($modx->hasPermission('edit_chunk')) {
343
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' 
344
-					OR `name` like '%" . $searchfields . "%' 
345
-					OR `description` like '%" . $searchfields . "%'     
346
-					OR `snippet` like '%" . $searchfields . "%'");
343
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' 
344
+					OR `name` like '%" . $searchfields."%' 
345
+					OR `description` like '%" . $searchfields."%'     
346
+					OR `snippet` like '%" . $searchfields."%'");
347 347
                     $chunkscounts = $modx->db->getRecordCount($rs);
348 348
                     if ($chunkscounts > 0) {
349
-                        $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>';
349
+                        $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>';
350 350
                         while ($row = $modx->db->getRow($rs)) {
351
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
351
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
352 352
                         }
353 353
                     }
354 354
                 }
355 355
 
356 356
                 //Snippets
357 357
                 if ($modx->hasPermission('edit_snippet')) {
358
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' 
359
-					OR `name` like '%" . $searchfields . "%' 
360
-					OR `description` like '%" . $searchfields . "%' 
361
-					OR `snippet` like '%" . $searchfields . "%'  
362
-					OR `properties` like '%" . $searchfields . "%'      
363
-					OR `moduleguid` like '%" . $searchfields . "%'");
358
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' 
359
+					OR `name` like '%" . $searchfields."%' 
360
+					OR `description` like '%" . $searchfields."%' 
361
+					OR `snippet` like '%" . $searchfields."%'  
362
+					OR `properties` like '%" . $searchfields."%'      
363
+					OR `moduleguid` like '%" . $searchfields."%'");
364 364
                     $snippetscounts = $modx->db->getRecordCount($rs);
365 365
                     if ($snippetscounts > 0) {
366
-                        $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>';
366
+                        $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>';
367 367
                         while ($row = $modx->db->getRow($rs)) {
368
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
368
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
369 369
                         }
370 370
                     }
371 371
                 }
372 372
 
373 373
                 //plugins
374 374
                 if ($modx->hasPermission('edit_plugin')) {
375
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' 
376
-					OR `name` like '%" . $searchfields . "%' 
377
-					OR `description` like '%" . $searchfields . "%' 
378
-					OR `plugincode` like '%" . $searchfields . "%'  
379
-					OR `properties` like '%" . $searchfields . "%'      
380
-					OR `moduleguid` like '%" . $searchfields . "%'");
375
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' 
376
+					OR `name` like '%" . $searchfields."%' 
377
+					OR `description` like '%" . $searchfields."%' 
378
+					OR `plugincode` like '%" . $searchfields."%'  
379
+					OR `properties` like '%" . $searchfields."%'      
380
+					OR `moduleguid` like '%" . $searchfields."%'");
381 381
                     $pluginscounts = $modx->db->getRecordCount($rs);
382 382
                     if ($pluginscounts > 0) {
383
-                        $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>';
383
+                        $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>';
384 384
                         while ($row = $modx->db->getRow($rs)) {
385
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
385
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
386 386
                         }
387 387
                     }
388 388
                 }
389 389
 
390 390
                 //modules
391 391
                 if ($modx->hasPermission('edit_module')) {
392
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' 
393
-                    OR `name` like '%" . $searchfields . "%' 
394
-                    OR `description` like '%" . $searchfields . "%' 
395
-                    OR `modulecode` like '%" . $searchfields . "%'  
396
-                    OR `properties` like '%" . $searchfields . "%'  
397
-                    OR `guid` like '%" . $searchfields . "%'      
398
-                    OR `resourcefile` like '%" . $searchfields . "%'");
392
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' 
393
+                    OR `name` like '%" . $searchfields."%' 
394
+                    OR `description` like '%" . $searchfields."%' 
395
+                    OR `modulecode` like '%" . $searchfields."%'  
396
+                    OR `properties` like '%" . $searchfields."%'  
397
+                    OR `guid` like '%" . $searchfields."%'      
398
+                    OR `resourcefile` like '%" . $searchfields."%'");
399 399
                     $modulescounts = $modx->db->getRecordCount($rs);
400 400
                     if ($modulescounts > 0) {
401
-                        $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>';
401
+                        $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>';
402 402
                         while ($row = $modx->db->getRow($rs)) {
403
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
403
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
404 404
                         }
405 405
                     }
406 406
                 }
407 407
 
408
-                echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1';
408
+                echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1';
409 409
             }
410 410
 
411 411
             ?>
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
  */
422 422
 function highlightingCoincidence($text, $search)
423 423
 {
424
-    $regexp = '!(' . str_replace(array(
424
+    $regexp = '!('.str_replace(array(
425 425
             '(',
426 426
             ')'
427 427
         ), array(
428 428
             '\(',
429 429
             '\)'
430
-        ), trim($search)) . ')!isu';
430
+        ), trim($search)).')!isu';
431 431
     return preg_replace($regexp, '<span class="text-danger">$1</span>', $text);
432 432
 }
433 433
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         $class .= ' deleted';
451 451
     }
452 452
     if ($class) {
453
-        $class = ' class="' . trim($class) . '"';
453
+        $class = ' class="'.trim($class).'"';
454 454
     }
455 455
     return $class;
456 456
 }
Please login to merge, or discard this patch.
manager/actions/mutate_plugin.dynamic.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_site_plugins = $modx->getFullTableName('site_plugins');
24 24
 $tbl_site_plugin_events = $modx->getFullTableName('site_plugin_events');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     $content['properties'] = str_replace("&", "&amp;", $content['properties']);
47 47
 } else {
48 48
     $_SESSION['itemname'] = $_lang["new_plugin"];
49
-    $content['category'] = (int)$_REQUEST['catid'];
49
+    $content['category'] = (int) $_REQUEST['catid'];
50 50
 }
51 51
 
52 52
 if ($modx->manager->hasFormValues()) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 // Add lock-element JS-Script
57 57
 $lockElementId = $id;
58 58
 $lockElementType = 5;
59
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
59
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
60 60
 
61 61
 /**
62 62
  * @param bool $cond
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     <input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
479 479
 
480 480
     <h1>
481
-        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
481
+        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
482 482
     </h1>
483 483
 
484 484
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                             <div class="form-control-name clearfix">
505 505
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
506 506
                                 <?php if ($modx->hasPermission('save_role')): ?>
507
-                                <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip>
507
+                                <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip>
508 508
                                     <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
509 509
                                     <i class="fa fa-lock"></i>
510 510
                                 </label>
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
529 529
                                 <option>&nbsp;</option>
530 530
                                 <?php
531
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
531
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
532 532
                                 foreach (getCategories() as $n => $v) {
533
-                                    echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v["category"]) . "</option>";
533
+                                    echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v["category"])."</option>";
534 534
                                 }
535 535
                                 ?>
536 536
                             </select>
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                 <?php if ($modx->hasPermission('save_role')): ?>
547 547
                 <div class="form-group">
548 548
                     <div class="form-row">
549
-                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label>
549
+                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label>
550 550
                     </div>
551 551
                     <div class="form-row">
552 552
                         <label>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
                             <select name="moduleguid" class="form-control" onchange="documentDirty=true;">
594 594
                                 <option>&nbsp;</option>
595 595
                                 <?php
596
-                                $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules") . " sm 
597
-								INNER JOIN " . $modx->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30
598
-								INNER JOIN " . $modx->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
596
+                                $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules")." sm 
597
+								INNER JOIN " . $modx->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30
598
+								INNER JOIN " . $modx->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
599 599
                                 while ($row = $modx->db->getRow($ds)) {
600
-                                    echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row["name"]) . "</option>";
600
+                                    echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row["name"])."</option>";
601 601
                                 }
602 602
                                 ?>
603 603
                             </select>
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                                 echoEventRows($evtnames);
659 659
                             }
660 660
                             echo '<hr class="clear">';
661
-                            echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>';
661
+                            echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>';
662 662
                         }
663 663
                         // display group name
664 664
                         if ($grp != $row['groupname']) {
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
                                 echoEventRows($evtnames);
668 668
                             }
669 669
                             echo '<hr class="clear">';
670
-                            echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>';
670
+                            echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>';
671 671
                         }
672
-                        $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n";
672
+                        $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n";
673 673
                         if (count($evtnames) == 2) {
674 674
                             echoEventRows($evtnames);
675 675
                         }
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 
682 682
                 function echoEventRows(&$evtnames)
683 683
                 {
684
-                    echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">' . implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . '</div></div>';
684
+                    echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">'.implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).'</div></div>';
685 685
                     $evtnames = array();
686 686
                 }
687 687
 
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Module_Categories_Manager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     die('Please use the MODx Backend.');
8 8
 }
9 9
 
10
-require_once realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Categories.php';
10
+require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php';
11 11
 
12 12
 class Module_Categories_Manager extends Categories
13 13
 {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
     {
95 95
         global $_lang, $_style;
96 96
 
97
-        $filename = trim($view_name) . '.tpl.phtml';
98
-        $file = self::get('views_dir') . $filename;
97
+        $filename = trim($view_name).'.tpl.phtml';
98
+        $file = self::get('views_dir').$filename;
99 99
         $view = &$this;
100 100
 
101 101
         if (is_file($file)
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
     {
121 121
 
122 122
         $_update = array(
123
-            'id'       => (int)$element_id,
124
-            'category' => (int)$category_id
123
+            'id'       => (int) $element_id,
124
+            'category' => (int) $category_id
125 125
         );
126 126
 
127 127
         $this->db->update(
128 128
             $_update,
129 129
             $this->db_tbl[$element],
130
-            "`id` = '" . (int)$element_id . "'"
130
+            "`id` = '".(int) $element_id."'"
131 131
         );
132 132
 
133 133
         return $this->db->getAffectedRows() === 1;
Please login to merge, or discard this patch.