@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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> $name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
322 | + echo "<p> $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 |
||
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> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
348 | + echo "<p> $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> $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> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
@@ -362,11 +362,11 @@ discard block |
||
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 |
||
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> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
397 | + echo "<p> $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> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
405 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // add template assignments |
@@ -411,10 +411,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
447 | 447 | $filecontent = $moduleChunk[2]; |
448 | 448 | |
449 | 449 | if (!file_exists($filecontent)) |
450 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
450 | + echo "<p> $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 |
||
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> $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> $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> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
482 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
@@ -488,11 +488,11 @@ discard block |
||
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 |
||
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> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
504 | + echo "<p> $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 |
||
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> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
521 | + echo "<p> $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> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
528 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | } |
@@ -534,11 +534,11 @@ discard block |
||
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 |
||
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> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
556 | + echo "<p> $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 |
||
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> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
596 | + echo "<p> $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> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
603 | + echo "<p> $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 |
||
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> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
635 | + echo "<p> $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 |
||
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> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
652 | + echo "<p> $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> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
659 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | } |
@@ -665,24 +665,24 @@ discard block |
||
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 |
||
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 |
||
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> ' . $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> '.$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> ' . $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> '.$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> ' . $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> '.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>'; |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | } |
@@ -742,7 +742,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,14 +1,14 @@ discard block |
||
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 | |
6 | 6 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param array $ph |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function parsePh($tpl, $ph) { |
|
19 | +function parsePh($tpl, $ph){ |
|
20 | 20 | global $modx, $_lang; |
21 | 21 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
22 | 22 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string|int $cssId |
27 | 27 | * @return string |
28 | 28 | */ |
29 | -function renderViewSwitchButtons($cssId) { |
|
29 | +function renderViewSwitchButtons($cssId){ |
|
30 | 30 | global $modx, $_lang, $tpl; |
31 | 31 | |
32 | 32 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | * @param mgrResources $resources |
40 | 40 | * @return string |
41 | 41 | */ |
42 | -function createResourceList($resourceTable, $resources) { |
|
42 | +function createResourceList($resourceTable, $resources){ |
|
43 | 43 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
44 | 44 | |
45 | 45 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
46 | 46 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
47 | + if (!is_array($items) || empty($items)) { |
|
48 | 48 | return $_lang['no_results']; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Prepare elements- and categories-list |
52 | 52 | $elements = array(); |
53 | 53 | $categories = array(); |
54 | - foreach($items as $row) { |
|
54 | + foreach ($items as $row) { |
|
55 | 55 | $catid = $row['catid'] ? $row['catid'] : 0; |
56 | 56 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
57 | 57 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | |
60 | 60 | // Now render categories / panel-collapse |
61 | 61 | $panelGroup = ''; |
62 | - foreach($elements as $catid => $elList) { |
|
62 | + foreach ($elements as $catid => $elList) { |
|
63 | 63 | // Add panel-heading / category-collapse to output |
64 | 64 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
65 | 65 | 'tab' => $resourceTable, |
66 | 66 | 'category' => $categories[$catid]['name'], |
67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
67 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
68 | 68 | 'catid' => $catid, |
69 | 69 | )); |
70 | 70 | |
71 | 71 | // Prepare content for panel-collapse |
72 | 72 | $panelCollapse = ''; |
73 | - foreach($elList as $el) { |
|
73 | + foreach ($elList as $el) { |
|
74 | 74 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
75 | 75 | } |
76 | 76 | |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | * @param mgrResources $resources |
93 | 93 | * @return string |
94 | 94 | */ |
95 | -function createCombinedView($resources) { |
|
95 | +function createCombinedView($resources){ |
|
96 | 96 | global $modx, $_lang, $_style, $modx_textdir; |
97 | 97 | |
98 | 98 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
99 | 99 | $types = isset($resources->types) ? $resources->types : false; |
100 | 100 | $categories = isset($resources->categories) ? $resources->categories : false; |
101 | 101 | |
102 | - if(!$itemsPerCategory) { |
|
102 | + if (!$itemsPerCategory) { |
|
103 | 103 | return $_lang['no_results']; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $tpl = array( |
107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | // Easily loop through $itemsPerCategory-Array |
114 | 114 | $panelGroup = ''; |
115 | - foreach($categories as $catid => $category) { |
|
115 | + foreach ($categories as $catid => $category) { |
|
116 | 116 | // Prepare collapse content / elements-list |
117 | 117 | $panelCollapse = ''; |
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
118 | + foreach ($itemsPerCategory[$catid] as $el) { |
|
119 | 119 | $resourceTable = $el['type']; |
120 | 120 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
121 | 121 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
126 | 126 | 'tab' => 'categories_list', |
127 | 127 | 'category' => $categories[$catid], |
128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
128 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
129 | 129 | 'catid' => $catid, |
130 | 130 | )); |
131 | 131 | |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | * @param mgrResources $resources |
150 | 150 | * @return array |
151 | 151 | */ |
152 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
152 | +function prepareElementRowPh($row, $resourceTable, $resources){ |
|
153 | 153 | global $modx, $modx_textdir, $_style, $_lang; |
154 | 154 | |
155 | 155 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
156 | 156 | |
157 | 157 | $_lang["confirm_delete"] = $_lang["delete"]; |
158 | 158 | |
159 | - switch($resourceTable){ |
|
159 | + switch ($resourceTable) { |
|
160 | 160 | case 'site_templates': |
161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 162 | $lockElementType = 1; |
@@ -193,65 +193,65 @@ discard block |
||
193 | 193 | // Prepare displaying user-locks |
194 | 194 | $lockedByUser = ''; |
195 | 195 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
196 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | + if ($rowLock['sid'] == $modx->sid) { |
|
198 | 198 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
199 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
200 | 200 | 'lasthit_df' => $rowLock['lasthit_df'] |
201 | 201 | )); |
202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
202 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
203 | 203 | } else { |
204 | 204 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
205 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
206 | 206 | 'username' => $rowLock['username'], |
207 | 207 | 'lasthit_df' => $rowLock['lasthit_df'] |
208 | 208 | )); |
209 | - if($modx->hasPermission('remove_locks')) { |
|
210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
209 | + if ($modx->hasPermission('remove_locks')) { |
|
210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>'; |
|
211 | 211 | } else { |
212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
212 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - if($lockedByUser) { |
|
217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
216 | + if ($lockedByUser) { |
|
217 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // Caption |
221 | - if($resourceTable == 'site_tmplvars') { |
|
222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
221 | + if ($resourceTable == 'site_tmplvars') { |
|
222 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption']; |
|
223 | 223 | } else { |
224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
224 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Special marks |
228 | 228 | $tplInfo = array(); |
229 | - if($row['locked']) { |
|
229 | + if ($row['locked']) { |
|
230 | 230 | $tplInfo[] = $_lang['locked']; |
231 | 231 | } |
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
232 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | 233 | $tplInfo[] = $_lang['defaulttemplate_title']; |
234 | 234 | } |
235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
235 | + $marks = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
236 | 236 | |
237 | 237 | /* row buttons */ |
238 | 238 | $buttons = ''; |
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
239 | + if ($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
241 | 241 | } |
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
242 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
244 | 244 | } |
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
245 | + if ($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
247 | 247 | } |
248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
249 | 249 | |
250 | 250 | $catid = $row['catid'] ? $row['catid'] : 0; |
251 | 251 | |
252 | 252 | // Placeholders for elements-row |
253 | 253 | return array( |
254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
254 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
255 | 255 | 'lockedByUser' => $lockedByUser, |
256 | 256 | 'name' => $row['name'], |
257 | 257 | 'caption' => $caption, |
@@ -1,9 +1,9 @@ discard block |
||
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 | |
6 | -class mgrResources { |
|
6 | +class mgrResources{ |
|
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | - public function __construct() { |
|
27 | + public function __construct(){ |
|
28 | 28 | $this->setTypes(); |
29 | 29 | $this->queryItemsFromDB(); |
30 | 30 | $this->prepareCategoryArrays(); |
@@ -33,47 +33,47 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function setTypes() { |
|
36 | + public function setTypes(){ |
|
37 | 37 | global $_lang; |
38 | - $this->types['site_templates'] = array( |
|
38 | + $this->types['site_templates'] = array( |
|
39 | 39 | 'title'=>$_lang["manage_templates"], |
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
40 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
41 | + 'permissions'=>array('new_template', 'edit_template'), |
|
42 | 42 | 'name'=>'templatename' |
43 | 43 | ); |
44 | - $this->types['site_tmplvars'] = array( |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | 45 | 'title'=>$_lang["tmplvars"], |
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
46 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
47 | + 'permissions'=>array('new_template', 'edit_template'), |
|
48 | 48 | ); |
49 | 49 | $this->types['site_htmlsnippets'] = array( |
50 | 50 | 'title'=>$_lang["manage_htmlsnippets"], |
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
51 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
53 | 53 | ); |
54 | - $this->types['site_snippets'] = array( |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | 55 | 'title'=>$_lang["manage_snippets"], |
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
56 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
58 | 58 | ); |
59 | - $this->types['site_plugins'] = array( |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | 60 | 'title'=>$_lang["manage_plugins"], |
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
61 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
63 | 63 | ); |
64 | - $this->types['site_modules'] = array( |
|
64 | + $this->types['site_modules'] = array( |
|
65 | 65 | 'title'=>$_lang["manage_modules"], |
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
66 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
67 | + 'permissions'=>array('new_module', 'edit_module'), |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function queryItemsFromDB() { |
|
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
74 | + public function queryItemsFromDB(){ |
|
75 | + foreach ($this->types as $resourceTable=>$type) { |
|
76 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
77 | 77 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
78 | 78 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
87 | + public function hasAnyPermissions($permissions){ |
|
88 | 88 | global $modx; |
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach ($permissions as $p) |
|
91 | + if ($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | 93 | return false; |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $nameField |
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
101 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
102 | 102 | global $modx, $_lang; |
103 | 103 | |
104 | 104 | $allowed = array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
111 | 111 | |
112 | 112 | $tvsql = ''; |
113 | 113 | $tvjoin = ''; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | |
123 | 123 | $rs = $modx->db->select( |
124 | 124 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
125 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
126 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
127 | 127 | "", |
128 | 128 | "category,name" |
129 | 129 | ); |
130 | 130 | $limit = $modx->db->getRecordCount($rs); |
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if ($limit < 1) return false; |
|
133 | 133 | |
134 | 134 | $result = array(); |
135 | 135 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function prepareCategoryArrays() { |
|
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
144 | + public function prepareCategoryArrays(){ |
|
145 | + foreach ($this->items as $type=>$items) { |
|
146 | + foreach ((array) $items as $item) { |
|
147 | 147 | $catid = $item['catid'] ? $item['catid'] : 0; |
148 | 148 | $this->categories[$catid] = $item['category']; |
149 | 149 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | natcasesort($this->categories); |
157 | 157 | |
158 | 158 | // Now sort by name |
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
159 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
161 | 161 | return strcasecmp($a['name'], $b['name']); |
162 | 162 | }); |
163 | 163 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -7,7 +7,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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, |
@@ -1,35 +1,35 @@ discard block |
||
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 | |
6 | 6 | /********************/ |
7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
10 | -$add_path = $sd . $sb . $pg; |
|
7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
10 | +$add_path = $sd.$sb.$pg; |
|
11 | 11 | /*******************/ |
12 | 12 | |
13 | 13 | // check permissions |
14 | -switch($modx->manager->action) { |
|
14 | +switch ($modx->manager->action) { |
|
15 | 15 | case 27: |
16 | - if(!$modx->hasPermission('edit_document')) { |
|
16 | + if (!$modx->hasPermission('edit_document')) { |
|
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | 19 | break; |
20 | 20 | case 85: |
21 | 21 | case 72: |
22 | 22 | case 4: |
23 | - if(!$modx->hasPermission('new_document')) { |
|
23 | + if (!$modx->hasPermission('new_document')) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | 26 | // check user has permissions for parent |
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | - if(!$udperms->checkPermissions()) { |
|
32 | + if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
39 | 39 | } |
40 | 40 | |
41 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
41 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
42 | 42 | |
43 | 43 | // Get table names (alphabetical) |
44 | 44 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | -if($modx->manager->action == 27) { |
|
56 | +if ($modx->manager->action == 27) { |
|
57 | 57 | //editing an existing document |
58 | 58 | // check permissions on the document |
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
60 | 60 | $udperms = new udperms(); |
61 | 61 | $udperms->user = $modx->getLoginUserID(); |
62 | 62 | $udperms->document = $id; |
63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
64 | 64 | |
65 | - if(!$udperms->checkPermissions()) { |
|
65 | + if (!$udperms->checkPermissions()) { |
|
66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
73 | 73 | } |
74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
77 | 77 | $modx->lockElement(7, $id); |
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | -if($_SESSION['mgrDocgroups']) { |
|
80 | +if ($_SESSION['mgrDocgroups']) { |
|
81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
82 | 82 | } |
83 | 83 | |
84 | -if(!empty ($id)) { |
|
84 | +if (!empty ($id)) { |
|
85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
86 | - if($docgrp) { |
|
86 | + if ($docgrp) { |
|
87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
88 | 88 | } |
89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
90 | 90 | $content = array(); |
91 | 91 | $content = $modx->db->getRow($rs); |
92 | 92 | $modx->documentObject = &$content; |
93 | - if(!$content) { |
|
93 | + if (!$content) { |
|
94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
95 | 95 | } |
96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
97 | 97 | } else { |
98 | 98 | $content = array(); |
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
100 | + if (isset($_REQUEST['newtemplate'])) { |
|
101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
102 | 102 | } else { |
103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | -if(isset($_REQUEST['newtemplate'])) { |
|
111 | +if (isset($_REQUEST['newtemplate'])) { |
|
112 | 112 | $formRestored = true; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | -if($formRestored == true) { |
|
118 | +if ($formRestored == true) { |
|
119 | 119 | $content = array_merge($content, $_POST); |
120 | 120 | $content['content'] = $_POST['ta']; |
121 | - if(empty ($content['pub_date'])) { |
|
121 | + if (empty ($content['pub_date'])) { |
|
122 | 122 | unset ($content['pub_date']); |
123 | 123 | } else { |
124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
125 | 125 | } |
126 | - if(empty ($content['unpub_date'])) { |
|
126 | + if (empty ($content['unpub_date'])) { |
|
127 | 127 | unset ($content['unpub_date']); |
128 | 128 | } else { |
129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | -if(!isset ($_REQUEST['id'])) { |
|
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | +if (!isset ($_REQUEST['id'])) { |
|
135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
136 | 136 | $modx->config['auto_menuindex'] = 1; |
137 | 137 | } |
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
138 | + if ($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int) $_REQUEST['pid']; |
|
140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
142 | 142 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -if(isset ($_POST['which_editor'])) { |
|
147 | +if (isset ($_POST['which_editor'])) { |
|
148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
152 | 152 | $lockElementId = $id; |
153 | 153 | $lockElementType = 7; |
154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
155 | 155 | ?> |
156 | 156 | <script type="text/javascript"> |
157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | }, |
182 | 182 | cancel: function() { |
183 | 183 | documentDirty = false; |
184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
185 | 185 | }, |
186 | 186 | duplicate: function() { |
187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | }, |
191 | 191 | view: function() { |
192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
193 | 193 | } |
194 | 194 | }; |
195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | 'template' => $content['template'] |
552 | 552 | )); |
553 | 553 | |
554 | - if(is_array($evtOut)) { |
|
554 | + if (is_array($evtOut)) { |
|
555 | 555 | echo implode('', $evtOut); |
556 | 556 | } |
557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | <fieldset id="create_edit"> |
576 | 576 | |
577 | 577 | <h1> |
578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
580 | 580 | } else { |
581 | 581 | if ($modx->manager->action == '4') { |
582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | // breadcrumbs |
595 | - if($modx->config['use_breadcrumbs']) { |
|
595 | + if ($modx->config['use_breadcrumbs']) { |
|
596 | 596 | $temp = array(); |
597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
598 | 598 | |
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | 600 | $bID = (int) $_REQUEST['id']; |
601 | 601 | $temp = $modx->getParentIds($bID); |
602 | - } else if(isset($_REQUEST['pid'])) { |
|
602 | + } else if (isset($_REQUEST['pid'])) { |
|
603 | 603 | $bID = (int) $_REQUEST['pid']; |
604 | 604 | $temp = $modx->getParentIds($bID); |
605 | 605 | array_unshift($temp, $bID); |
606 | 606 | } |
607 | 607 | |
608 | - if($temp) { |
|
608 | + if ($temp) { |
|
609 | 609 | $parents = implode(',', $temp); |
610 | 610 | |
611 | - if(!empty($parents)) { |
|
611 | + if (!empty($parents)) { |
|
612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
614 | - while($row = $modx->db->getRow($rs)) { |
|
614 | + while ($row = $modx->db->getRow($rs)) { |
|
615 | 615 | $out .= '<li class="breadcrumbs__li"> |
616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
639 | 639 | 'id' => $id |
640 | 640 | )); |
641 | - if(is_array($evtOut)) { |
|
641 | + if (is_array($evtOut)) { |
|
642 | 642 | echo implode('', $evtOut); |
643 | 643 | } else { |
644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | </td> |
695 | 695 | </tr> |
696 | 696 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | 698 | |
699 | 699 | <tr> |
700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
732 | 732 | $currentCategory = ''; |
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + while ($row = $modx->db->getRow($rs)) { |
|
734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | 735 | continue; |
736 | 736 | }; |
737 | 737 | // Skip if not selectable but show if selected! |
738 | 738 | $thisCategory = $row['category']; |
739 | - if($thisCategory == null) { |
|
739 | + if ($thisCategory == null) { |
|
740 | 740 | $thisCategory = $_lang["no_category"]; |
741 | 741 | } |
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
742 | + if ($thisCategory != $currentCategory) { |
|
743 | + if ($closeOptGroup) { |
|
744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
745 | 745 | } |
746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | |
750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
753 | 753 | $currentCategory = $thisCategory; |
754 | 754 | } |
755 | - if($thisCategory != '') { |
|
755 | + if ($thisCategory != '') { |
|
756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
757 | 757 | } |
758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | 798 | $parentlookup = false; |
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
799 | + if (isset ($_REQUEST['id'])) { |
|
800 | + if ($content['parent'] == 0) { |
|
801 | 801 | $parentname = $site_name; |
802 | 802 | } else { |
803 | 803 | $parentlookup = $content['parent']; |
804 | 804 | } |
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
806 | + if ($_REQUEST['pid'] == 0) { |
|
807 | 807 | $parentname = $site_name; |
808 | 808 | } else { |
809 | 809 | $parentlookup = $_REQUEST['pid']; |
810 | 810 | } |
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
811 | + } elseif (isset($_POST['parent'])) { |
|
812 | + if ($_POST['parent'] == 0) { |
|
813 | 813 | $parentname = $site_name; |
814 | 814 | } else { |
815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | $parentname = $site_name; |
819 | 819 | $content['parent'] = 0; |
820 | 820 | } |
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
823 | 823 | $parentname = $modx->db->getValue($rs); |
824 | - if(!$parentname) { |
|
824 | + if (!$parentname) { |
|
825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
826 | 826 | } |
827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | }*/ |
864 | 864 | ?> |
865 | 865 | |
866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
867 | 867 | <tr> |
868 | 868 | <td colspan="2"> |
869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | <?php |
877 | 877 | // invoke OnRichTextEditorRegister event |
878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + if (is_array($evtOut)) { |
|
880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
881 | 881 | $editor = $evtOut[$i]; |
882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | 892 | $htmlContent = $content['content']; |
893 | 893 | ?> |
894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
903 | 903 | } else { |
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
905 | 905 | } |
906 | 906 | ?> |
907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
919 | 919 | $template = $default_template; |
920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
922 | 922 | $template = $_REQUEST['newtemplate']; |
923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | ); |
946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
947 | 947 | if ($group_tvs) { |
948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
949 | 949 | $from .= ' |
950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
952 | 952 | } |
953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
954 | 954 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -957,37 +957,37 @@ discard block |
||
957 | 957 | <!-- Template Variables -->' . "\n"; |
958 | 958 | if (!$group_tvs) { |
959 | 959 | $templateVariables .= ' |
960 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
960 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
961 | 961 | <div class="sectionBody tmplvars"> |
962 | 962 | <table>'; |
963 | 963 | } else if ($group_tvs == 2) { |
964 | 964 | $templateVariables .= ' |
965 | 965 | <div class="tab-section"> |
966 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
966 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
967 | 967 | <div class="tab-pane" id="paneTemplateVariables"> |
968 | 968 | <script type="text/javascript"> |
969 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
969 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
970 | 970 | </script>'; |
971 | 971 | } else if ($group_tvs == 3) { |
972 | 972 | $templateVariables .= ' |
973 | 973 | <div id="templateVariables" class="tab-page tmplvars"> |
974 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
974 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
975 | 975 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
976 | 976 | } else if ($group_tvs == 4) { |
977 | 977 | $templateVariables .= ' |
978 | 978 | <div id="templateVariables" class="tab-page tmplvars"> |
979 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
979 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
980 | 980 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
981 | 981 | |
982 | 982 | <div class="tab-pane" id="paneTemplateVariables"> |
983 | 983 | <script type="text/javascript"> |
984 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
984 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
985 | 985 | </script>'; |
986 | 986 | } |
987 | 987 | |
988 | 988 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
989 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
990 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
989 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
990 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
991 | 991 | $i = 0; |
992 | 992 | $tab = ''; |
993 | 993 | foreach ($tvsArray as $row) { |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | if ($group_tvs == 1 || $group_tvs == 3) { |
996 | 996 | if ($i === 0) { |
997 | 997 | $templateVariables .= ' |
998 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
999 | - <div class="tab-header">' . $row['category'] . '</div> |
|
998 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
999 | + <div class="tab-header">' . $row['category'].'</div> |
|
1000 | 1000 | <div class="tab-body tmplvars"> |
1001 | 1001 | <table>' . "\n"; |
1002 | 1002 | } else { |
@@ -1005,17 +1005,17 @@ discard block |
||
1005 | 1005 | </div> |
1006 | 1006 | </div> |
1007 | 1007 | |
1008 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
1009 | - <div class="tab-header">' . $row['category'] . '</div> |
|
1008 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
1009 | + <div class="tab-header">' . $row['category'].'</div> |
|
1010 | 1010 | <div class="tab-body tmplvars"> |
1011 | 1011 | <table>'; |
1012 | 1012 | } |
1013 | 1013 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
1014 | 1014 | if ($i === 0) { |
1015 | 1015 | $templateVariables .= ' |
1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1018 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1018 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1019 | 1019 | |
1020 | 1020 | <div class="tab-body tmplvars"> |
1021 | 1021 | <table>'; |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | </div> |
1026 | 1026 | </div> |
1027 | 1027 | |
1028 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1029 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1030 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1028 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1029 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1030 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1031 | 1031 | |
1032 | 1032 | <div class="tab-body tmplvars"> |
1033 | 1033 | <table>'; |
@@ -1035,18 +1035,18 @@ discard block |
||
1035 | 1035 | } else if ($group_tvs == 5) { |
1036 | 1036 | if ($i === 0) { |
1037 | 1037 | $templateVariables .= ' |
1038 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1039 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1040 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1038 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1039 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1040 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1041 | 1041 | <table>'; |
1042 | 1042 | } else { |
1043 | 1043 | $templateVariables .= ' |
1044 | 1044 | </table> |
1045 | 1045 | </div> |
1046 | 1046 | |
1047 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1048 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1049 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1047 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1048 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1049 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1050 | 1050 | |
1051 | 1051 | <table>'; |
1052 | 1052 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
1064 | 1064 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1065 | 1065 | }; |
1066 | 1066 | // Add richtext editor to the list |
1067 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1068 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1067 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1068 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1069 | 1069 | } |
1070 | 1070 | // splitter |
1071 | 1071 | if ($group_tvs) { |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | // post back value |
1082 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1083 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1084 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1082 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1083 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1084 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1085 | 1085 | } else { |
1086 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1086 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1087 | 1087 | } |
1088 | 1088 | } else { |
1089 | 1089 | $tvPBV = $row['value']; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1093 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1094 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1092 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1093 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1094 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1095 | 1095 | |
1096 | 1096 | $templateVariables .= ' |
1097 | 1097 | <tr> |
1098 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1099 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1098 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1099 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1100 | 1100 | </tr>'; |
1101 | 1101 | |
1102 | 1102 | $tab = $row['category_id']; |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1193 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | 1194 | ?> |
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
@@ -1213,13 +1213,13 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1216 | + if (!$content['contentType']) { |
|
1217 | 1217 | $content['contentType'] = 'text/html'; |
1218 | 1218 | } |
1219 | 1219 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1220 | 1220 | $ct = explode(",", $custom_contenttype); |
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1221 | + for ($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1223 | 1223 | } |
1224 | 1224 | ?> |
1225 | 1225 | </select> |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | 1247 | } else { |
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1248 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | 1249 | // non-admin managers creating or editing a document resource |
1250 | 1250 | ?> |
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1345,15 +1345,15 @@ discard block |
||
1345 | 1345 | <?php |
1346 | 1346 | /******************************* |
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1348 | + if ($use_udperms == 1) { |
|
1349 | 1349 | $groupsarray = array(); |
1350 | 1350 | $sql = ''; |
1351 | 1351 | |
1352 | 1352 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1353 | - if($documentId > 0) { |
|
1353 | + if ($documentId > 0) { |
|
1354 | 1354 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1355 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1356 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1357 | 1357 | |
1358 | 1358 | // Load up the current permissions and names |
1359 | 1359 | $vs = array( |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | // retain selected doc groups between post |
1372 | - if(isset($_POST['docgroups'])) { |
|
1372 | + if (isset($_POST['docgroups'])) { |
|
1373 | 1373 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1388,26 +1388,26 @@ discard block |
||
1388 | 1388 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1389 | 1389 | |
1390 | 1390 | // Loop through the permissions list |
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1391 | + while ($row = $modx->db->getRow($rs)) { |
|
1392 | 1392 | |
1393 | 1393 | // Create an inputValue pair (group ID and group link (if it exists)) |
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1394 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-'.$row['id']; |
|
1396 | 1396 | |
1397 | 1397 | $checked = in_array($inputValue, $groupsarray); |
1398 | - if($checked) { |
|
1398 | + if ($checked) { |
|
1399 | 1399 | $notPublic = true; |
1400 | 1400 | } // Mark as private access (either web or manager) |
1401 | 1401 | |
1402 | 1402 | // Skip the access permission if the user doesn't have access... |
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1403 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | 1404 | continue; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // Setup attributes for this Input box |
1408 | 1408 | $inputAttributes['id'] = $inputId; |
1409 | 1409 | $inputAttributes['value'] = $inputValue; |
1410 | - if($checked) { |
|
1410 | + if ($checked) { |
|
1411 | 1411 | $inputAttributes['checked'] = 'checked'; |
1412 | 1412 | } else { |
1413 | 1413 | unset($inputAttributes['checked']); |
@@ -1415,10 +1415,10 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | // Create attribute string list |
1417 | 1417 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1418 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1419 | 1419 | |
1420 | 1420 | // Make the <input> HTML |
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1421 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1422 | 1422 | |
1423 | 1423 | // does user have this permission? |
1424 | 1424 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1429,23 +1429,23 @@ discard block |
||
1429 | 1429 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1430 | 1430 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
1431 | 1431 | $count = $modx->db->getValue($rsp); |
1432 | - if($count > 0) { |
|
1432 | + if ($count > 0) { |
|
1433 | 1433 | ++$permissions_yes; |
1434 | 1434 | } else { |
1435 | 1435 | ++$permissions_no; |
1436 | 1436 | } |
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1437 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1438 | 1438 | } |
1439 | 1439 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1440 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | 1441 | $permissions = array(); |
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | // See if the Access Permissions section is worth displaying... |
1445 | - if(!empty($permissions)) { |
|
1445 | + if (!empty($permissions)) { |
|
1446 | 1446 | // Add the "All Document Groups" item if we have rights in both contexts |
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1447 | + if ($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
1449 | 1449 | } |
1450 | 1450 | // Output the permissions list... |
1451 | 1451 | ?> |
@@ -1478,12 +1478,12 @@ discard block |
||
1478 | 1478 | </script> |
1479 | 1479 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1480 | 1480 | <ul> |
1481 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1481 | + <?= implode("\n", $permissions)."\n" ?> |
|
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | 1485 | } // !empty($permissions) |
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1486 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | 1487 | ?> |
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | 'template' => $content['template'] |
1504 | 1504 | )); |
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1506 | + if (is_array($evtOut)) { |
|
1507 | 1507 | echo implode('', $evtOut); |
1508 | 1508 | } |
1509 | 1509 | ?> |
@@ -1516,16 +1516,16 @@ discard block |
||
1516 | 1516 | storeCurTemplate(); |
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1519 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | + if (is_array($richtexteditorIds)) { |
|
1521 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1522 | 1522 | // invoke OnRichTextEditorInit event |
1523 | 1523 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1524 | 1524 | 'editor' => $editor, |
1525 | 1525 | 'elements' => $elements, |
1526 | 1526 | 'options' => $richtexteditorOptions[$editor] |
1527 | 1527 | )); |
1528 | - if(is_array($evtOut)) { |
|
1528 | + if (is_array($evtOut)) { |
|
1529 | 1529 | echo implode('', $evtOut); |
1530 | 1530 | } |
1531 | 1531 | } |
@@ -1535,37 +1535,37 @@ discard block |
||
1535 | 1535 | /** |
1536 | 1536 | * @return string |
1537 | 1537 | */ |
1538 | -function getDefaultTemplate() { |
|
1538 | +function getDefaultTemplate(){ |
|
1539 | 1539 | global $modx; |
1540 | 1540 | |
1541 | 1541 | $default_template = ''; |
1542 | - switch($modx->config['auto_template_logic']) { |
|
1542 | + switch ($modx->config['auto_template_logic']) { |
|
1543 | 1543 | case 'sibling': |
1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1544 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1545 | 1545 | $site_start = $modx->config['site_start']; |
1546 | 1546 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1547 | 1547 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1548 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | 1549 | $default_template = $sibl[0]['template']; |
1550 | 1550 | } |
1551 | 1551 | } else { |
1552 | 1552 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | 1554 | $default_template = $sibl[0]['template']; |
1555 | 1555 | } else { |
1556 | 1556 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1557 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | 1558 | $default_template = $sibl[0]['template']; |
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | } |
1562 | - if(isset($default_template)) { |
|
1562 | + if (isset($default_template)) { |
|
1563 | 1563 | break; |
1564 | 1564 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1565 | 1565 | case 'parent': |
1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1566 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1567 | 1567 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1568 | - if(isset($parent['template'])) { |
|
1568 | + if (isset($parent['template'])) { |
|
1569 | 1569 | $default_template = $parent['template']; |
1570 | 1570 | } |
1571 | 1571 | } |
@@ -1,22 +1,22 @@ discard block |
||
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 |
||
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 |
||
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("&", "&", $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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
501 | 501 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
502 | 502 | <option> </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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -1,8 +1,8 @@ discard block |
||
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 | -if(!$modx->hasPermission('import_static')) { |
|
5 | +if (!$modx->hasPermission('import_static')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | <div class="tab-page"> |
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | - if(!isset($_POST['import'])) { |
|
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
46 | + if (!isset($_POST['import'])) { |
|
47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
48 | 48 | ?> |
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import" /> |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function run() { |
|
107 | +function run(){ |
|
108 | 108 | global $modx, $_lang; |
109 | 109 | |
110 | 110 | $tbl_site_content = $modx->getFullTableName('site_content'); |
111 | 111 | $output = ''; |
112 | 112 | $maxtime = $_POST['maxtime']; |
113 | 113 | |
114 | - if(!is_numeric($maxtime)) { |
|
114 | + if (!is_numeric($maxtime)) { |
|
115 | 115 | $maxtime = 30; |
116 | 116 | } |
117 | 117 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | $mtime = $mtime[1] + $mtime[0]; |
123 | 123 | $importstart = $mtime; |
124 | 124 | |
125 | - if($_POST['reset'] == 'on') { |
|
125 | + if ($_POST['reset'] == 'on') { |
|
126 | 126 | $modx->db->truncate($tbl_site_content); |
127 | 127 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
128 | 128 | } |
129 | 129 | |
130 | - $parent = (int)$_POST['parent']; |
|
130 | + $parent = (int) $_POST['parent']; |
|
131 | 131 | |
132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
132 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
133 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
134 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
135 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
136 | 136 | } else { |
137 | 137 | $filedir = ''; |
138 | 138 | } |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $files = pop_index($files); |
144 | 144 | |
145 | 145 | // no. of files to import |
146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
146 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
147 | 147 | |
148 | 148 | // import files |
149 | - if(0 < count($files)) { |
|
149 | + if (0 < count($files)) { |
|
150 | 150 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
151 | 151 | importFiles($parent, $filedir, $files, 'root'); |
152 | 152 | } |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $mtime = $mtime[1] + $mtime[0]; |
157 | 157 | $importend = $mtime; |
158 | 158 | $totaltime = ($importend - $importstart); |
159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
159 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
160 | 160 | |
161 | - if($_POST['convert_link'] == 'on') { |
|
161 | + if ($_POST['convert_link'] == 'on') { |
|
162 | 162 | convertLink(); |
163 | 163 | } |
164 | 164 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array $files |
172 | 172 | * @param string $mode |
173 | 173 | */ |
174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
174 | +function importFiles($parent, $filedir, $files, $mode){ |
|
175 | 175 | global $modx; |
176 | 176 | global $_lang, $allowedfiles; |
177 | 177 | global $search_default, $cache_default, $publish_default; |
@@ -180,21 +180,21 @@ discard block |
||
180 | 180 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
181 | 181 | |
182 | 182 | $createdby = $modx->getLoginUserID(); |
183 | - if(!is_array($files)) { |
|
183 | + if (!is_array($files)) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | - if($_POST['object'] === 'all') { |
|
186 | + if ($_POST['object'] === 'all') { |
|
187 | 187 | $modx->config['default_template'] = '0'; |
188 | 188 | $richtext = '0'; |
189 | 189 | } else { |
190 | 190 | $richtext = '1'; |
191 | 191 | } |
192 | 192 | |
193 | - foreach($files as $id => $value) { |
|
194 | - if(is_array($value)) { |
|
193 | + foreach ($files as $id => $value) { |
|
194 | + if (is_array($value)) { |
|
195 | 195 | // create folder |
196 | 196 | $alias = $id; |
197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
197 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
198 | 198 | $field = array(); |
199 | 199 | $field['type'] = 'document'; |
200 | 200 | $field['contentType'] = 'text/html'; |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | $field['isfolder'] = 1; |
210 | 210 | $field['menuindex'] = 1; |
211 | 211 | $find = false; |
212 | - foreach(array( |
|
212 | + foreach (array( |
|
213 | 213 | 'index.html', |
214 | 214 | 'index.htm' |
215 | 215 | ) as $filename) { |
216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
217 | - if($find === false && file_exists($filepath)) { |
|
216 | + $filepath = $filedir.$alias.'/'.$filename; |
|
217 | + if ($find === false && file_exists($filepath)) { |
|
218 | 218 | $file = getFileContent($filepath); |
219 | 219 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
220 | 220 | |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | $field['createdon'] = $date; |
227 | 227 | $field['editedon'] = $date; |
228 | 228 | $newid = $modx->db->insert($field, $tbl_site_content); |
229 | - if($newid) { |
|
229 | + if ($newid) { |
|
230 | 230 | $find = true; |
231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
231 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
232 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
233 | 233 | } else { |
234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
234 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
235 | 235 | exit; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
239 | - if($find === false) { |
|
239 | + if ($find === false) { |
|
240 | 240 | $date = time(); |
241 | 241 | $field['pagetitle'] = '---'; |
242 | 242 | $field['content'] = ''; |
@@ -244,30 +244,30 @@ discard block |
||
244 | 244 | $field['editedon'] = $date; |
245 | 245 | $field['hidemenu'] = '1'; |
246 | 246 | $newid = $modx->db->insert($field, $tbl_site_content); |
247 | - if($newid) { |
|
247 | + if ($newid) { |
|
248 | 248 | $find = true; |
249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
249 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
250 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
251 | 251 | } else { |
252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
252 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
253 | 253 | exit; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } else { |
257 | 257 | // create document |
258 | - if($mode == 'sub' && $value == 'index.html') { |
|
258 | + if ($mode == 'sub' && $value == 'index.html') { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | $filename = $value; |
262 | 262 | $fparts = explode('.', $value); |
263 | 263 | $alias = $fparts[0]; |
264 | 264 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
265 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
266 | 266 | |
267 | - if(!in_array($ext, $allowedfiles)) { |
|
268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
267 | + if (!in_array($ext, $allowedfiles)) { |
|
268 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
269 | 269 | } else { |
270 | - $filepath = $filedir . $filename; |
|
270 | + $filepath = $filedir.$filename; |
|
271 | 271 | $file = getFileContent($filepath); |
272 | 272 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
273 | 273 | |
@@ -292,18 +292,18 @@ discard block |
||
292 | 292 | $field['isfolder'] = 0; |
293 | 293 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
294 | 294 | $newid = $modx->db->insert($field, $tbl_site_content); |
295 | - if($newid) { |
|
296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
295 | + if ($newid) { |
|
296 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
297 | 297 | } else { |
298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
298 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
299 | 299 | exit; |
300 | 300 | } |
301 | 301 | |
302 | 302 | $is_site_start = false; |
303 | - if($filename == 'index.html') { |
|
303 | + if ($filename == 'index.html') { |
|
304 | 304 | $is_site_start = true; |
305 | 305 | } |
306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
306 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
307 | 307 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
308 | 308 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
309 | 309 | } |
@@ -318,26 +318,26 @@ discard block |
||
318 | 318 | * @param int $count |
319 | 319 | * @return array |
320 | 320 | */ |
321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
321 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
322 | 322 | global $_lang; |
323 | 323 | global $filesfound; |
324 | 324 | $dummy = $count; |
325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
326 | - foreach($files as $file) { |
|
327 | - if($file == '.' || $file == '..') { |
|
325 | + if (!empty($directory) && $files = scandir($directory)) { |
|
326 | + foreach ($files as $file) { |
|
327 | + if ($file == '.' || $file == '..') { |
|
328 | 328 | continue; |
329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
329 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
330 | 330 | closedir($h); |
331 | 331 | $count = -1; |
332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
333 | - } elseif(strpos($file, '.htm') !== false) { |
|
332 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
333 | + } elseif (strpos($file, '.htm') !== false) { |
|
334 | 334 | $listing[$dummy] = $file; |
335 | 335 | $dummy = $dummy + 1; |
336 | 336 | $filesfound++; |
337 | 337 | } |
338 | 338 | } |
339 | 339 | } else { |
340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
340 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
341 | 341 | } |
342 | 342 | return ($listing); |
343 | 343 | } |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | * @param string $filepath |
347 | 347 | * @return bool|string |
348 | 348 | */ |
349 | -function getFileContent($filepath) { |
|
349 | +function getFileContent($filepath){ |
|
350 | 350 | global $_lang; |
351 | 351 | // get the file |
352 | - if(!$buffer = file_get_contents($filepath)) { |
|
353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
352 | + if (!$buffer = file_get_contents($filepath)) { |
|
353 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
354 | 354 | } else { |
355 | 355 | return $buffer; |
356 | 356 | } |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | * @param array $array |
361 | 361 | * @return array |
362 | 362 | */ |
363 | -function pop_index($array) { |
|
363 | +function pop_index($array){ |
|
364 | 364 | $new_array = array(); |
365 | - foreach($array as $k => $v) { |
|
366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
365 | + foreach ($array as $k => $v) { |
|
366 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
367 | 367 | $new_array[$k] = $v; |
368 | 368 | } else { |
369 | 369 | array_unshift($new_array, $v); |
370 | 370 | } |
371 | 371 | } |
372 | - foreach($array as $k => $v) { |
|
373 | - if(is_array($v)) { |
|
372 | + foreach ($array as $k => $v) { |
|
373 | + if (is_array($v)) { |
|
374 | 374 | $new_array[$k] = $v; |
375 | 375 | } |
376 | 376 | } |
@@ -383,34 +383,34 @@ discard block |
||
383 | 383 | * @param string $alias |
384 | 384 | * @return array |
385 | 385 | */ |
386 | -function treatContent($src, $filename, $alias) { |
|
386 | +function treatContent($src, $filename, $alias){ |
|
387 | 387 | global $modx; |
388 | 388 | |
389 | 389 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
390 | 390 | |
391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
391 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
392 | 392 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
393 | 393 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
394 | 394 | } else { |
395 | 395 | $pagetitle = $alias; |
396 | 396 | } |
397 | - if(!$pagetitle) { |
|
397 | + if (!$pagetitle) { |
|
398 | 398 | $pagetitle = $alias; |
399 | 399 | } |
400 | 400 | |
401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
401 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
402 | 402 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
403 | 403 | $description = str_replace('[*description*]', '', $description); |
404 | 404 | } else { |
405 | 405 | $description = ''; |
406 | 406 | } |
407 | 407 | |
408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
408 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
409 | 409 | $content = $matches[1]; |
410 | 410 | } else { |
411 | 411 | $content = $src; |
412 | 412 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
413 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
414 | 414 | $content = preg_replace($s, $r, $content); |
415 | 415 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | /** |
428 | 428 | * @return void |
429 | 429 | */ |
430 | -function convertLink() { |
|
430 | +function convertLink(){ |
|
431 | 431 | global $modx; |
432 | 432 | $tbl_site_content = $modx->getFullTableName('site_content'); |
433 | 433 | |
@@ -435,33 +435,33 @@ discard block |
||
435 | 435 | $p = array(); |
436 | 436 | $target = array(); |
437 | 437 | $dir = ''; |
438 | - while($row = $modx->db->getRow($rs)) { |
|
438 | + while ($row = $modx->db->getRow($rs)) { |
|
439 | 439 | $id = $row['id']; |
440 | 440 | $array = explode('<a href=', $row['content']); |
441 | 441 | $c = 0; |
442 | - foreach($array as $v) { |
|
443 | - if($v[0] === '"') { |
|
442 | + foreach ($array as $v) { |
|
443 | + if ($v[0] === '"') { |
|
444 | 444 | $v = substr($v, 1); |
445 | 445 | list($href, $v) = explode('"', $v, 2); |
446 | 446 | $_ = $href; |
447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
447 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
448 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
449 | 449 | } |
450 | - if($_[0] === '/') { |
|
450 | + if ($_[0] === '/') { |
|
451 | 451 | $_ = substr($_, 1); |
452 | 452 | } |
453 | 453 | $_ = str_replace('/index.html', '.html', $_); |
454 | 454 | $level = substr_count($_, '../'); |
455 | - if(1 < $level) { |
|
456 | - if(!isset($p[$id])) { |
|
455 | + if (1 < $level) { |
|
456 | + if (!isset($p[$id])) { |
|
457 | 457 | $p[$id] = $modx->getParentIds($id); |
458 | 458 | } |
459 | 459 | $k = array_keys($p[$id]); |
460 | - while(0 < $level) { |
|
460 | + while (0 < $level) { |
|
461 | 461 | $dir = array_shift($k); |
462 | 462 | $level--; |
463 | 463 | } |
464 | - if($dir != '') { |
|
464 | + if ($dir != '') { |
|
465 | 465 | $dir .= '/'; |
466 | 466 | } |
467 | 467 | } else { |
@@ -469,18 +469,18 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | $_ = trim($_, './'); |
472 | - if(strpos($_, '/') !== false) { |
|
472 | + if (strpos($_, '/') !== false) { |
|
473 | 473 | $_ = substr($_, strrpos($_, '/')); |
474 | 474 | } |
475 | - $_ = $dir . str_replace('.html', '', $_); |
|
476 | - if(!isset($target[$_])) { |
|
475 | + $_ = $dir.str_replace('.html', '', $_); |
|
476 | + if (!isset($target[$_])) { |
|
477 | 477 | $target[$_] = $modx->getIdFromAlias($_); |
478 | 478 | } |
479 | 479 | $target[$_] = trim($target[$_]); |
480 | - if(!empty($target[$_])) { |
|
481 | - $href = '[~' . $target[$_] . '~]'; |
|
480 | + if (!empty($target[$_])) { |
|
481 | + $href = '[~'.$target[$_].'~]'; |
|
482 | 482 | } |
483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
483 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
484 | 484 | } |
485 | 485 | $c++; |
486 | 486 | } |
@@ -1,16 +1,16 @@ discard block |
||
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 | |
6 | -switch((int) $modx->manager->action) { |
|
6 | +switch ((int) $modx->manager->action) { |
|
7 | 7 | case 35: |
8 | - if(!$modx->hasPermission('edit_role')) { |
|
8 | + if (!$modx->hasPermission('edit_role')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 38: |
13 | - if(!$modx->hasPermission('new_role')) { |
|
13 | + if (!$modx->hasPermission('new_role')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_user_roles = $modx->getFullTableName('user_roles'); |
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | -if($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
26 | +if ($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
28 | 28 | } |
29 | 29 | // end check for lock |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // Lock snippet for other users to edit |
32 | 32 | $modx->lockElement(8, $role); |
33 | 33 | |
34 | -if($modx->manager->action == '35') { |
|
34 | +if ($modx->manager->action == '35') { |
|
35 | 35 | $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
36 | 36 | $roledata = $modx->db->getRow($rs); |
37 | - if(!$roledata) { |
|
37 | + if (!$roledata) { |
|
38 | 38 | $modx->webAlertAndQuit("No role returned!"); |
39 | 39 | } |
40 | 40 | $_SESSION['itemname'] = $roledata['name']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Add lock-element JS-Script |
47 | 47 | $lockElementId = $role; |
48 | 48 | $lockElementType = 8; |
49 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
49 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
50 | 50 | ?> |
51 | 51 | <script type="text/javascript"> |
52 | 52 | function changestate(element) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <input type="hidden" name="id" value="<?= $_GET['id'] ?>"> |
83 | 83 | |
84 | 84 | <h1> |
85 | - <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?> |
|
85 | + <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?> |
|
86 | 86 | </h1> |
87 | 87 | |
88 | 88 | <?= $_style['actionbuttons']['dynamic']['savedelete'] ?> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param string $status |
300 | 300 | * @return string |
301 | 301 | */ |
302 | -function render_form($name, $label, $status = '') { |
|
302 | +function render_form($name, $label, $status = ''){ |
|
303 | 303 | global $modx, $roledata; |
304 | 304 | |
305 | 305 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
312 | 312 | $value = ($roledata[$name] == 1) ? 1 : 0; |
313 | - if($status == 'disabled') { |
|
313 | + if ($status == 'disabled') { |
|
314 | 314 | $checked = 'checked'; |
315 | 315 | $value = 1; |
316 | 316 | $set = 'fix'; |