@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser{ |
|
7 | 7 | public $host; |
8 | 8 | public $dbname; |
9 | 9 | public $prefix; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
31 | + public function __construct($host, $user, $password, $db, $prefix = 'modx_', $adminname, $adminemail, $adminpass, $connection_charset = 'utf8', $managerlanguage = 'english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent'){ |
|
32 | 32 | $this->host = $host; |
33 | 33 | $this->dbname = $db; |
34 | 34 | $this->prefix = $prefix; |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 45 | } |
46 | 46 | |
47 | - public function connect() { |
|
47 | + public function connect(){ |
|
48 | 48 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 49 | mysqli_select_db($this->conn, $this->dbname); |
50 | 50 | if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
51 | 51 | |
52 | 52 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | - if(function_exists("mysqli_get_server_info")) { |
|
53 | + if (function_exists("mysqli_get_server_info")) { |
|
54 | 54 | $ver = mysqli_get_server_info($this->conn); |
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
55 | + $this->dbMODx = version_compare($ver, "4.0.2"); |
|
56 | 56 | $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
57 | 57 | } |
58 | 58 | |
59 | - mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
|
59 | + mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}"); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function process($filename) { |
|
62 | + public function process($filename){ |
|
63 | 63 | global $custom_placeholders; |
64 | 64 | |
65 | 65 | // check to make sure file exists |
66 | 66 | if (!file_exists($filename)) { |
67 | 67 | $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
68 | - $this->installFailed = true ; |
|
68 | + $this->installFailed = true; |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | // check if in upgrade mode |
83 | 83 | if ($this->mode === 'upd') { |
84 | 84 | // remove non-upgradeable parts |
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
85 | + $s = strpos($idata, 'non-upgrade-able[['); |
|
86 | + $e = strpos($idata, ']]non-upgrade-able') + 17; |
|
87 | + if ($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
103 | 103 | |
104 | 104 | // Replace custom placeholders |
105 | - foreach($custom_placeholders as $key=>$val) { |
|
105 | + foreach ($custom_placeholders as $key=>$val) { |
|
106 | 106 | if (strpos($idata, '{'.$key.'}') !== false) { |
107 | 107 | $idata = str_replace('{'.$key.'}', $val, $idata); |
108 | 108 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | $sql_array = explode("\n\n", $idata); |
112 | 112 | |
113 | 113 | $num = 0; |
114 | - foreach($sql_array as $sql_entry) { |
|
114 | + foreach ($sql_array as $sql_entry) { |
|
115 | 115 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 116 | |
117 | 117 | if (preg_match('/^\#/', $sql_do)) continue; |
118 | 118 | |
119 | 119 | // strip out comments and \n for mysql 3.x |
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
120 | + if ($this->dbVersion < 4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do); |
|
122 | 122 | $sql_do = str_replace('\r', "", $sql_do); |
123 | 123 | $sql_do = str_replace('\n', "", $sql_do); |
124 | 124 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | $num = $num + 1; |
128 | 128 | if ($sql_do) mysqli_query($this->conn, $sql_do); |
129 | - if(mysqli_error($this->conn)) { |
|
129 | + if (mysqli_error($this->conn)) { |
|
130 | 130 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
131 | + if ($this->ignoreDuplicateErrors) { |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue; |
|
133 | 133 | } |
134 | 134 | // End Ignore duplicate |
135 | 135 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function close() { |
|
141 | + public function close(){ |
|
142 | 142 | mysqli_close($this->conn); |
143 | 143 | } |
144 | 144 | } |
@@ -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('bk_manager')) { |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | $dbase = trim($dbase, '`'); |
10 | 10 | |
11 | 11 | if (!isset($modx->config['snapshot_path'])) { |
12 | - if (is_dir(MODX_BASE_PATH . 'temp/backup/')) { |
|
13 | - $modx->config['snapshot_path'] = MODX_BASE_PATH . 'temp/backup/'; |
|
12 | + if (is_dir(MODX_BASE_PATH.'temp/backup/')) { |
|
13 | + $modx->config['snapshot_path'] = MODX_BASE_PATH.'temp/backup/'; |
|
14 | 14 | } else { |
15 | - $modx->config['snapshot_path'] = MODX_BASE_PATH . 'assets/backup/'; |
|
15 | + $modx->config['snapshot_path'] = MODX_BASE_PATH.'assets/backup/'; |
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if ($mode == 'restore1') { |
24 | 24 | if (isset($_POST['textarea']) && !empty($_POST['textarea'])) { |
25 | 25 | $source = trim($_POST['textarea']); |
26 | - $_SESSION['textarea'] = $source . "\n"; |
|
26 | + $_SESSION['textarea'] = $source."\n"; |
|
27 | 27 | } else { |
28 | 28 | $source = file_get_contents($_FILES['sqlfile']['tmp_name']); |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | header('Location: index.php?r=9&a=93'); |
32 | 32 | exit; |
33 | 33 | } elseif ($mode == 'restore2') { |
34 | - $path = $modx->config['snapshot_path'] . $_POST['filename']; |
|
34 | + $path = $modx->config['snapshot_path'].$_POST['filename']; |
|
35 | 35 | if (file_exists($path)) { |
36 | 36 | $source = file_get_contents($path); |
37 | 37 | import_sql($source); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (!is_writable(rtrim($modx->config['snapshot_path'], '/'))) { |
78 | 78 | $modx->webAlertAndQuit(parsePlaceholder($_lang["bkmgr_alert_mkdir"], array('snapshot_path' => $modx->config['snapshot_path']))); |
79 | 79 | } |
80 | - $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%'"; |
|
80 | + $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%'"; |
|
81 | 81 | $rs = $modx->db->query($sql); |
82 | 82 | $tables = $modx->db->getColumn('Name', $rs); |
83 | 83 | $today = date('Y-m-d_H-i-s'); |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | $modx->webAlertAndQuit('Unable to Backup Database'); |
110 | 110 | } |
111 | 111 | } else { |
112 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; // start normal header |
|
112 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; // start normal header |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | if (isset($_SESSION['result_msg']) && $_SESSION['result_msg'] != '') { |
116 | 116 | switch ($_SESSION['result_msg']) { |
117 | 117 | case 'import_ok': |
118 | - $ph['result_msg_import'] = '<div class="alert alert-success">' . $_lang["bkmgr_import_ok"] . '</div>'; |
|
119 | - $ph['result_msg_snapshot'] = '<div class="alert alert-success">' . $_lang["bkmgr_import_ok"] . '</div>'; |
|
118 | + $ph['result_msg_import'] = '<div class="alert alert-success">'.$_lang["bkmgr_import_ok"].'</div>'; |
|
119 | + $ph['result_msg_snapshot'] = '<div class="alert alert-success">'.$_lang["bkmgr_import_ok"].'</div>'; |
|
120 | 120 | break; |
121 | 121 | case 'snapshot_ok': |
122 | 122 | $ph['result_msg_import'] = ''; |
123 | - $ph['result_msg_snapshot'] = '<div class="alert alert-success">' . $_lang["bkmgr_snapshot_ok"] . '</div>'; |
|
123 | + $ph['result_msg_snapshot'] = '<div class="alert alert-success">'.$_lang["bkmgr_snapshot_ok"].'</div>'; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | $_SESSION['result_msg'] = ''; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | f.style.display = 'none'; |
180 | 180 | } |
181 | 181 | } |
182 | - <?= (isset($_REQUEST['r']) ? " doRefresh(" . $_REQUEST['r'] . ");" : "") ?> |
|
182 | + <?= (isset($_REQUEST['r']) ? " doRefresh(".$_REQUEST['r'].");" : "") ?> |
|
183 | 183 | |
184 | 184 | </script> |
185 | 185 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | </thead> |
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | - $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%'"; |
|
226 | + $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%'"; |
|
227 | 227 | $rs = $modx->db->query($sql); |
228 | 228 | $i = 0; |
229 | 229 | while ($db_status = $modx->db->getRow($rs)) { |
@@ -233,29 +233,29 @@ discard block |
||
233 | 233 | $table_string = ''; |
234 | 234 | } |
235 | 235 | |
236 | - echo '<tr>' . "\n" . '<td><label class="form-check form-check-label"><input type="checkbox" name="chk[]" class="form-check-input" value="' . $db_status['Name'] . '"' . (strstr($table_string, $db_status['Name']) === false ? '' : ' checked="checked"') . ' /><b class="text-primary">' . $db_status['Name'] . '</b></label></td>' . "\n"; |
|
237 | - echo '<td class="text-xs-center">' . (!empty($db_status['Comment']) ? '<i class="' . $_style['actions_help'] . '" data-tooltip="' . $db_status['Comment'] . '"></i>' : '') . '</td>' . "\n"; |
|
238 | - echo '<td class="text-xs-right">' . $db_status['Rows'] . '</td>' . "\n"; |
|
239 | - echo '<td class="text-xs-right">' . $db_status['Collation'] . '</td>' . "\n"; |
|
236 | + echo '<tr>'."\n".'<td><label class="form-check form-check-label"><input type="checkbox" name="chk[]" class="form-check-input" value="'.$db_status['Name'].'"'.(strstr($table_string, $db_status['Name']) === false ? '' : ' checked="checked"').' /><b class="text-primary">'.$db_status['Name'].'</b></label></td>'."\n"; |
|
237 | + echo '<td class="text-xs-center">'.(!empty($db_status['Comment']) ? '<i class="'.$_style['actions_help'].'" data-tooltip="'.$db_status['Comment'].'"></i>' : '').'</td>'."\n"; |
|
238 | + echo '<td class="text-xs-right">'.$db_status['Rows'].'</td>'."\n"; |
|
239 | + echo '<td class="text-xs-right">'.$db_status['Collation'].'</td>'."\n"; |
|
240 | 240 | |
241 | 241 | // Enable record deletion for certain tables (TRUNCATE TABLE) if they're not already empty |
242 | 242 | $truncateable = array( |
243 | - $modx->db->config['table_prefix'] . 'event_log', |
|
244 | - $modx->db->config['table_prefix'] . 'manager_log', |
|
243 | + $modx->db->config['table_prefix'].'event_log', |
|
244 | + $modx->db->config['table_prefix'].'manager_log', |
|
245 | 245 | ); |
246 | 246 | if ($modx->hasPermission('settings') && in_array($db_status['Name'], $truncateable) && $db_status['Rows'] > 0) { |
247 | - echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode=' . $action . '&u=' . $db_status['Name'] . '" title="' . $_lang['truncate_table'] . '">' . $modx->nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</a>' . '</td>' . "\n"; |
|
247 | + echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode='.$action.'&u='.$db_status['Name'].'" title="'.$_lang['truncate_table'].'">'.$modx->nicesize($db_status['Data_length'] + $db_status['Data_free']).'</a>'.'</td>'."\n"; |
|
248 | 248 | } else { |
249 | - echo '<td class="text-xs-right">' . $modx->nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</td>' . "\n"; |
|
249 | + echo '<td class="text-xs-right">'.$modx->nicesize($db_status['Data_length'] + $db_status['Data_free']).'</td>'."\n"; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if ($modx->hasPermission('settings')) { |
253 | - echo '<td class="text-xs-right">' . ($db_status['Data_free'] > 0 ? '<a class="text-danger" href="index.php?a=54&mode=' . $action . '&t=' . $db_status['Name'] . '" title="' . $_lang['optimize_table'] . '">' . $modx->nicesize($db_status['Data_free']) . '</a>' : '-') . '</td>' . "\n"; |
|
253 | + echo '<td class="text-xs-right">'.($db_status['Data_free'] > 0 ? '<a class="text-danger" href="index.php?a=54&mode='.$action.'&t='.$db_status['Name'].'" title="'.$_lang['optimize_table'].'">'.$modx->nicesize($db_status['Data_free']).'</a>' : '-').'</td>'."\n"; |
|
254 | 254 | } else { |
255 | - echo '<td class="text-xs-right">' . ($db_status['Data_free'] > 0 ? $modx->nicesize($db_status['Data_free']) : '-') . '</td>' . "\n"; |
|
255 | + echo '<td class="text-xs-right">'.($db_status['Data_free'] > 0 ? $modx->nicesize($db_status['Data_free']) : '-').'</td>'."\n"; |
|
256 | 256 | } |
257 | 257 | |
258 | - echo '<td class="text-xs-right">' . $modx->nicesize($db_status['Data_length'] - $db_status['Data_free']) . '</td>' . "\n" . '<td class="text-xs-right">' . $modx->nicesize($db_status['Index_length']) . '</td>' . "\n" . '<td class="text-xs-right">' . $modx->nicesize($db_status['Index_length'] + $db_status['Data_length'] + $db_status['Data_free']) . '</td>' . "\n" . "</tr>"; |
|
258 | + echo '<td class="text-xs-right">'.$modx->nicesize($db_status['Data_length'] - $db_status['Data_free']).'</td>'."\n".'<td class="text-xs-right">'.$modx->nicesize($db_status['Index_length']).'</td>'."\n".'<td class="text-xs-right">'.$modx->nicesize($db_status['Index_length'] + $db_status['Data_length'] + $db_status['Data_free']).'</td>'."\n"."</tr>"; |
|
259 | 259 | |
260 | 260 | $total = $total + $db_status['Index_length'] + $db_status['Data_length']; |
261 | 261 | $totaloverhead = $totaloverhead + $db_status['Data_free']; |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | <tr> |
267 | 267 | <td class="text-xs-right"><?= $_lang['database_table_totals'] ?></td> |
268 | 268 | <td colspan="4"> </td> |
269 | - <td class="text-xs-right"><?= $totaloverhead > 0 ? '<b class="text-danger">' . $modx->nicesize($totaloverhead) . '</b><br />(' . number_format($totaloverhead) . ' B)' : '-' ?></td> |
|
269 | + <td class="text-xs-right"><?= $totaloverhead > 0 ? '<b class="text-danger">'.$modx->nicesize($totaloverhead).'</b><br />('.number_format($totaloverhead).' B)' : '-' ?></td> |
|
270 | 270 | <td colspan="2"> </td> |
271 | - <td class="text-xs-right"><?= "<b>" . $modx->nicesize($total) . "</b><br />(" . number_format($total) . " B)" ?></td> |
|
271 | + <td class="text-xs-right"><?= "<b>".$modx->nicesize($total)."</b><br />(".number_format($total)." B)" ?></td> |
|
272 | 272 | </tr> |
273 | 273 | </tfoot> |
274 | 274 | </table> |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | foreach ($last_result['0'] as $k => $v) { |
320 | 320 | $title[] = $k; |
321 | 321 | } |
322 | - $result = '<thead><tr><th>' . implode('</th><th>', $title) . '</th></tr></thead>'; |
|
322 | + $result = '<thead><tr><th>'.implode('</th><th>', $title).'</th></tr></thead>'; |
|
323 | 323 | $result .= '<tbody>'; |
324 | 324 | foreach ($last_result as $row) { |
325 | 325 | $result_value = array(); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | foreach ($row as $k => $v) { |
328 | 328 | $result_value[] = $v; |
329 | 329 | } |
330 | - $result .= '<tr><td>' . implode('</td><td>', $result_value) . '</td></tr>'; |
|
330 | + $result .= '<tr><td>'.implode('</td><td>', $result_value).'</td></tr>'; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | $result .= '</tbody>'; |
334 | - $result = '<table class="table data">' . $result . '</table>'; |
|
334 | + $result = '<table class="table data">'.$result.'</table>'; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | while ($count < 11) { |
434 | 434 | $line = fgets($file); |
435 | 435 | foreach ($detailFields as $label) { |
436 | - $fileLabel = '# ' . $label; |
|
436 | + $fileLabel = '# '.$label; |
|
437 | 437 | if (strpos($line, $fileLabel) !== false) { |
438 | 438 | $details[$label] = htmlentities(trim(str_replace(array( |
439 | 439 | $fileLabel, |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | }; |
447 | 447 | fclose($file); |
448 | 448 | |
449 | - $tooltip = "Generation Time: " . $details["Generation Time"] . "\n"; |
|
450 | - $tooltip .= "Server version: " . $details["Server version"] . "\n"; |
|
451 | - $tooltip .= "PHP Version: " . $details["PHP Version"] . "\n"; |
|
452 | - $tooltip .= "Host: " . $details["Host"] . "\n"; |
|
449 | + $tooltip = "Generation Time: ".$details["Generation Time"]."\n"; |
|
450 | + $tooltip .= "Server version: ".$details["Server version"]."\n"; |
|
451 | + $tooltip .= "PHP Version: ".$details["PHP Version"]."\n"; |
|
452 | + $tooltip .= "Host: ".$details["Host"]."\n"; |
|
453 | 453 | ?> |
454 | 454 | <tr> |
455 | 455 | <td><?= $filename ?></td> |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | <?php |
482 | 482 | |
483 | 483 | if (is_numeric($_GET['tab'])) { |
484 | - echo '<script type="text/javascript">tpDBM.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
484 | + echo '<script type="text/javascript">tpDBM.setSelectedIndex( '.$_GET['tab'].' );</script>'; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | include_once "footer.inc.php"; // send footer |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | |
536 | 536 | // Set line feed |
537 | 537 | $lf = "\n"; |
538 | - $tempfile_path = $modx->config['base_path'] . 'assets/backup/temp.php'; |
|
538 | + $tempfile_path = $modx->config['base_path'].'assets/backup/temp.php'; |
|
539 | 539 | |
540 | 540 | $result = $modx->db->query('SHOW TABLES'); |
541 | 541 | $tables = $this->result2Array(0, $result); |
@@ -548,15 +548,15 @@ discard block |
||
548 | 548 | |
549 | 549 | // Set header |
550 | 550 | $output = "#{$lf}"; |
551 | - $output .= "# " . addslashes($modx->config['site_name']) . " Database Dump{$lf}"; |
|
551 | + $output .= "# ".addslashes($modx->config['site_name'])." Database Dump{$lf}"; |
|
552 | 552 | $output .= "# MODX Version:{$version['version']}{$lf}"; |
553 | 553 | $output .= "# {$lf}"; |
554 | 554 | $output .= "# Host: {$this->database_server}{$lf}"; |
555 | - $output .= "# Generation Time: " . $modx->toDateFormat(time()) . $lf; |
|
556 | - $output .= "# Server version: " . $modx->db->getVersion() . $lf; |
|
557 | - $output .= "# PHP Version: " . phpversion() . $lf; |
|
555 | + $output .= "# Generation Time: ".$modx->toDateFormat(time()).$lf; |
|
556 | + $output .= "# Server version: ".$modx->db->getVersion().$lf; |
|
557 | + $output .= "# PHP Version: ".phpversion().$lf; |
|
558 | 558 | $output .= "# Database: `{$this->dbname}`{$lf}"; |
559 | - $output .= "# Description: " . trim($_REQUEST['backup_title']) . "{$lf}"; |
|
559 | + $output .= "# Description: ".trim($_REQUEST['backup_title'])."{$lf}"; |
|
560 | 560 | $output .= "#"; |
561 | 561 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
562 | 562 | $output = ''; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | } |
576 | 576 | } |
577 | 577 | if ($callBack === 'snapshot') { |
578 | - if (!preg_match('@^' . $modx->db->config['table_prefix'] . '@', $tblval)) { |
|
578 | + if (!preg_match('@^'.$modx->db->config['table_prefix'].'@', $tblval)) { |
|
579 | 579 | continue; |
580 | 580 | } |
581 | 581 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $insertdump = $lf; |
598 | 598 | $insertdump .= "INSERT INTO `{$tblval}` VALUES ("; |
599 | 599 | $arr = $this->object2Array($row); |
600 | - if( ! is_array($arr)) $arr = array(); |
|
600 | + if (!is_array($arr)) $arr = array(); |
|
601 | 601 | foreach ($arr as $key => $value) { |
602 | 602 | if (is_null($value)) { |
603 | 603 | $value = 'NULL'; |
@@ -610,9 +610,9 @@ discard block |
||
610 | 610 | ), '\\n', $value); |
611 | 611 | $value = "'{$value}'"; |
612 | 612 | } |
613 | - $insertdump .= $value . ','; |
|
613 | + $insertdump .= $value.','; |
|
614 | 614 | } |
615 | - $output .= rtrim($insertdump, ',') . ");\n"; |
|
615 | + $output .= rtrim($insertdump, ',').");\n"; |
|
616 | 616 | if (1048576 < strlen($output)) { |
617 | 617 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
618 | 618 | $output = ''; |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @return array of keys from a language file |
6 | 6 | */ |
7 | -function get_lang_keys($filename) { |
|
8 | - $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
9 | - if(is_file($file) && is_readable($file)) { |
|
7 | +function get_lang_keys($filename){ |
|
8 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
9 | + if (is_file($file) && is_readable($file)) { |
|
10 | 10 | include($file); |
11 | 11 | $out = isset($_lang) ? array_keys($_lang) : array(); |
12 | 12 | } else { |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return array of languages that define the key in their file |
22 | 22 | */ |
23 | -function get_langs_by_key($key) { |
|
23 | +function get_langs_by_key($key){ |
|
24 | 24 | global $lang_keys; |
25 | 25 | $lang_return = array(); |
26 | - foreach($lang_keys as $lang=>$keys) { |
|
27 | - if(in_array($key, $keys)) { |
|
26 | + foreach ($lang_keys as $lang=>$keys) { |
|
27 | + if (in_array($key, $keys)) { |
|
28 | 28 | $lang_return[] = $lang; |
29 | 29 | } |
30 | 30 | } |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * @param string $selected_lang specify language to select in option list, default none |
41 | 41 | * @return string html option list |
42 | 42 | */ |
43 | -function get_lang_options($key = '', $selected_lang=null) { |
|
43 | +function get_lang_options($key = '', $selected_lang = null){ |
|
44 | 44 | global $lang_keys, $_lang; |
45 | 45 | $lang_options = ''; |
46 | - if( ! empty($key)) { |
|
46 | + if (!empty($key)) { |
|
47 | 47 | $languages = get_langs_by_key($key); |
48 | 48 | sort($languages); |
49 | 49 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
50 | 50 | |
51 | - foreach($languages as $language_name) { |
|
51 | + foreach ($languages as $language_name) { |
|
52 | 52 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
53 | 53 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } else { |
57 | 57 | $languages = array_keys($lang_keys); |
58 | 58 | sort($languages); |
59 | - foreach($languages as $language_name) { |
|
59 | + foreach ($languages as $language_name) { |
|
60 | 60 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
61 | 61 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
62 | 62 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -65,23 +65,23 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | -function form_radio($name,$value,$add='',$disabled=false) { |
|
68 | +function form_radio($name, $value, $add = '', $disabled = false){ |
|
69 | 69 | global ${$name}; |
70 | 70 | $var = ${$name}; |
71 | - $checked = ($var==$value) ? ' checked="checked"' : ''; |
|
72 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
73 | - if($add) $add = ' ' . $add; |
|
71 | + $checked = ($var == $value) ? ' checked="checked"' : ''; |
|
72 | + if ($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
73 | + if ($add) $add = ' '.$add; |
|
74 | 74 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add); |
75 | 75 | } |
76 | 76 | |
77 | -function wrap_label($str='',$object) { |
|
77 | +function wrap_label($str = '', $object){ |
|
78 | 78 | return "<label>{$object}\n{$str}</label>"; |
79 | 79 | } |
80 | 80 | |
81 | -function parseText($tpl='', $ph=array()) { |
|
82 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
81 | +function parseText($tpl = '', $ph = array()){ |
|
82 | + if (empty($ph) || empty($tpl)) return $tpl; |
|
83 | 83 | |
84 | - foreach($ph as $k=>$v) |
|
84 | + foreach ($ph as $k=>$v) |
|
85 | 85 | { |
86 | 86 | $k = "[+{$k}+]"; |
87 | 87 | $tpl = str_replace($k, $v, $tpl); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return $tpl; |
90 | 90 | } |
91 | 91 | |
92 | -function showHide($cond=true) { |
|
92 | +function showHide($cond = true){ |
|
93 | 93 | global $displayStyle; |
94 | 94 | $showHide = $cond ? $displayStyle : 'none'; |
95 | 95 | return sprintf('style="display:%s"', $showHide); |
@@ -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 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $count = count($array); |
81 | 81 | for ($i = 0; $i < $count; $i++) { |
82 | - $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :) |
|
82 | + $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :) |
|
83 | 83 | } |
84 | 84 | return $array; |
85 | 85 | } |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | $rw = realpath('../'); |
105 | 105 | $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
106 | 106 | if (substr($webstart_path, 0, 1) == '/') { |
107 | - $webstart_path = '..' . $webstart_path; |
|
107 | + $webstart_path = '..'.$webstart_path; |
|
108 | 108 | } else { |
109 | - $webstart_path = '../' . $webstart_path; |
|
109 | + $webstart_path = '../'.$webstart_path; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | ?> |
113 | 113 | <script type="text/javascript"> |
114 | 114 | |
115 | - var current_path = '<?= $startpath;?>'; |
|
115 | + var current_path = '<?= $startpath; ?>'; |
|
116 | 116 | |
117 | 117 | function viewfile (url) |
118 | 118 | { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | function unzipFile (file) |
149 | 149 | { |
150 | 150 | if (confirmUnzip()) { |
151 | - window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
151 | + window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | function deleteFolder (folder, status) |
171 | 171 | { |
172 | 172 | if (confirmDeleteFolder(status)) { |
173 | - window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
173 | + window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | function deleteFile (file) |
179 | 179 | { |
180 | 180 | if (confirmDelete()) { |
181 | - window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
181 | + window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
182 | 182 | return false; |
183 | 183 | } |
184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
189 | 189 | if (newFilename !== null && newFilename !== file) { |
190 | - window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
190 | + window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | { |
196 | 196 | var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
197 | 197 | if (newDirname !== null && newDirname !== dir) { |
198 | - window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
198 | + window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
205 | 205 | if (newFilename !== null && newFilename !== file) { |
206 | - window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
206 | + window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | <?php endif ?> |
223 | 223 | <?php |
224 | 224 | if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
225 | - $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
225 | + $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
226 | 226 | } else { |
227 | 227 | $href = 'a=2'; |
228 | 228 | } |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
233 | 233 | $ph['image'] = $_style['files_folder-open']; |
234 | 234 | $ph['subject'] = $_lang['add_folder']; |
235 | - $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
235 | + $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
236 | 236 | $_ = parsePlaceholder($tpl, $ph); |
237 | 237 | |
238 | - $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
238 | + $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
239 | 239 | $ph['image'] = $_style['files_page_html']; |
240 | - $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
240 | + $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
241 | 241 | $_ .= parsePlaceholder($tpl, $ph); |
242 | 242 | echo $_; |
243 | 243 | } |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | $ph = array(); |
268 | 268 | $ph['style_path'] = $theme_image_path; |
269 | 269 | // To Top Level with folder icon to the left |
270 | - if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
271 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
270 | + if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
271 | + $ph['image'] = ''.$_style['files_top'].''; |
|
272 | 272 | $ph['subject'] = '<span>Top</span>'; |
273 | 273 | } else { |
274 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
275 | - $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
274 | + $ph['image'] = ''.$_style['files_top'].''; |
|
275 | + $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | echo parsePlaceholder($tpl, $ph); |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | if (empty($v)) { |
290 | 290 | continue; |
291 | 291 | } |
292 | - $path .= rtrim($v, '/') . '/'; |
|
292 | + $path .= rtrim($v, '/').'/'; |
|
293 | 293 | if (1 < $count) { |
294 | - $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
295 | - $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
294 | + $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
295 | + $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
296 | 296 | } else { |
297 | - $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
297 | + $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
298 | 298 | } |
299 | 299 | $count--; |
300 | 300 | } |
@@ -307,16 +307,16 @@ discard block |
||
307 | 307 | </div> |
308 | 308 | <?php |
309 | 309 | // check to see user isn't trying to move below the document_root |
310 | - if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
310 | + if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
311 | 311 | $modx->webAlertAndQuit($_lang["files_access_denied"]); |
312 | 312 | } |
313 | 313 | |
314 | 314 | // Unzip .zip files - by Raymond |
315 | 315 | if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) { |
316 | - if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
317 | - echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
316 | + if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
317 | + echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
318 | 318 | } else { |
319 | - echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
319 | + echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | // End Unzip - Raymond |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | if ($_REQUEST['mode'] == 'deletefolder') { |
329 | 329 | $folder = $_REQUEST['folderpath']; |
330 | 330 | if (!$token_check || !@rrmdir($folder)) { |
331 | - echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
331 | + echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
332 | 332 | } else { |
333 | - echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
333 | + echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
342 | 342 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
343 | 343 | } else { |
344 | - if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
345 | - echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
344 | + if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
345 | + echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
346 | 346 | } else { |
347 | - echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
347 | + echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | umask($old_umask); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $filename = $modx->db->escape($filename); |
357 | 357 | |
358 | 358 | if (!checkExtension($filename)) { |
359 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
359 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
360 | 360 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
361 | 361 | echo $_lang['files.dynamic.php3']; |
362 | 362 | } else { |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | $newFilename = $modx->db->escape($newFilename); |
379 | 379 | |
380 | 380 | if (!checkExtension($newFilename)) { |
381 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
381 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
382 | 382 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
383 | 383 | echo $_lang['files.dynamic.php3']; |
384 | 384 | } else { |
385 | - if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
385 | + if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
386 | 386 | echo $_lang['files.dynamic.php5']; |
387 | 387 | } |
388 | 388 | umask($old_umask); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | // Rename folder here |
392 | 392 | if ($_REQUEST['mode'] == 'renameFolder') { |
393 | 393 | $old_umask = umask(0); |
394 | - $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
394 | + $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
395 | 395 | $dirname = $modx->db->escape($dirname); |
396 | 396 | $newDirname = str_replace(array( |
397 | 397 | '..\\', |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
405 | 405 | echo $_lang['files.dynamic.php3']; |
406 | - } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
406 | + } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
407 | 407 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
408 | 408 | } |
409 | 409 | umask($old_umask); |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | $newFilename = $modx->db->escape($newFilename); |
424 | 424 | |
425 | 425 | if (!checkExtension($newFilename)) { |
426 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
426 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
427 | 427 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
428 | 428 | echo $_lang['files.dynamic.php3']; |
429 | 429 | } else { |
430 | - if (!rename($filename, $path . '/' . $newFilename)) { |
|
430 | + if (!rename($filename, $path.'/'.$newFilename)) { |
|
431 | 431 | echo $_lang['files.dynamic.php5']; |
432 | 432 | } |
433 | 433 | umask($old_umask); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | ls($startpath); |
461 | 461 | echo "\n\n\n"; |
462 | 462 | if ($folders == 0 && $files == 0) { |
463 | - 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>'; |
|
463 | + 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>'; |
|
464 | 464 | } |
465 | 465 | ?> |
466 | 466 | </table> |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | <div class="container"> |
470 | 470 | <p> |
471 | 471 | <?php |
472 | - echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
473 | - echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
474 | - echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> '; |
|
475 | - echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
472 | + echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
473 | + echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
474 | + echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> '; |
|
475 | + echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
476 | 476 | ?> |
477 | 477 | </p> |
478 | 478 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | </form> |
498 | 498 | <?php |
499 | 499 | } else { |
500 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
500 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
501 | 501 | } |
502 | 502 | ?> |
503 | 503 | <div id="imageviewer"></div> |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | if ($file == $selFile) { |
577 | 577 | $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
578 | 578 | } |
579 | - return '<i class="' . $icon . ' FilesPage"></i>'; |
|
579 | + return '<i class="'.$icon.' FilesPage"></i>'; |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | function markRow($file, $selFile, $mode) |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | ); |
589 | 589 | if ($file == $selFile) { |
590 | 590 | $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
591 | - return ' class="' . $class . '"'; |
|
591 | + return ' class="'.$class.'"'; |
|
592 | 592 | } |
593 | 593 | return ''; |
594 | 594 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
600 | 600 | $dircounter = 0; |
601 | 601 | $filecounter = 0; |
602 | - $curpath = str_replace('//', '/', $curpath . '/'); |
|
602 | + $curpath = str_replace('//', '/', $curpath.'/'); |
|
603 | 603 | |
604 | 604 | if (!is_dir($curpath)) { |
605 | 605 | echo 'Invalid path "', $curpath, '"<br />'; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | |
610 | 610 | // first, get info |
611 | 611 | foreach ($dir as $file) { |
612 | - $newpath = $curpath . $file; |
|
612 | + $newpath = $curpath.$file; |
|
613 | 613 | if ($file === '..' || $file === '.') { |
614 | 614 | continue; |
615 | 615 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | if ($file === '..' || $file === '.') { |
620 | 620 | continue; |
621 | 621 | } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
622 | - $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>'; |
|
622 | + $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>'; |
|
623 | 623 | |
624 | 624 | $dfiles = scandir($newpath); |
625 | 625 | foreach ($dfiles as $i => $infile) { |
@@ -632,13 +632,13 @@ discard block |
||
632 | 632 | } |
633 | 633 | $file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
634 | 634 | |
635 | - $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>' : ''; |
|
635 | + $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>' : ''; |
|
636 | 636 | } else { |
637 | - $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
638 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
637 | + $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
638 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
639 | 639 | } |
640 | 640 | |
641 | - $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
641 | + $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
642 | 642 | |
643 | 643 | // increment the counter |
644 | 644 | $dircounter++; |
@@ -646,14 +646,14 @@ discard block |
||
646 | 646 | $type = getExtension($newpath); |
647 | 647 | $files_array[$filecounter]['file'] = $newpath; |
648 | 648 | $files_array[$filecounter]['stats'] = lstat($newpath); |
649 | - $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file; |
|
650 | - $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>'); |
|
651 | - $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']; |
|
652 | - $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>' : ''; |
|
653 | - $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>'; |
|
654 | - $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>'; |
|
655 | - $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>'; |
|
656 | - $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>'; |
|
649 | + $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file; |
|
650 | + $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>'); |
|
651 | + $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']; |
|
652 | + $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>' : ''; |
|
653 | + $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>'; |
|
654 | + $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>'; |
|
655 | + $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>'; |
|
656 | + $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>'; |
|
657 | 657 | |
658 | 658 | // increment the counter |
659 | 659 | $filecounter++; |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | for ($i = 0; $i < $folders; $i++) { |
667 | 667 | $filesizes += $dirs_array[$i]['stats']['7']; |
668 | 668 | echo '<tr>'; |
669 | - echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
670 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
671 | - echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
669 | + echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
670 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
671 | + echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
672 | 672 | echo '<td class="actions text-right">'; |
673 | 673 | echo $dirs_array[$i]['rename']; |
674 | 674 | echo $dirs_array[$i]['delete']; |
@@ -681,10 +681,10 @@ discard block |
||
681 | 681 | sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
682 | 682 | for ($i = 0; $i < $files; $i++) { |
683 | 683 | $filesizes += $files_array[$i]['stats']['7']; |
684 | - echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
685 | - echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
686 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
687 | - echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
684 | + echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
685 | + echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
686 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
687 | + echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
688 | 688 | echo '<td class="actions text-right">'; |
689 | 689 | echo $files_array[$i]['unzip']; |
690 | 690 | echo $files_array[$i]['view']; |
@@ -792,17 +792,17 @@ discard block |
||
792 | 792 | $zip = zip_open($file); |
793 | 793 | if ($zip) { |
794 | 794 | $old_umask = umask(0); |
795 | - $path = rtrim($path, '/') . '/'; |
|
795 | + $path = rtrim($path, '/').'/'; |
|
796 | 796 | while ($zip_entry = zip_read($zip)) { |
797 | 797 | if (zip_entry_filesize($zip_entry) > 0) { |
798 | 798 | // str_replace must be used under windows to convert "/" into "\" |
799 | 799 | $zip_entry_name = zip_entry_name($zip_entry); |
800 | - $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
801 | - $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
800 | + $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
801 | + $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
802 | 802 | if (!file_exists($complete_path)) { |
803 | 803 | $tmp = ''; |
804 | 804 | foreach (explode('/', $complete_path) AS $k) { |
805 | - $tmp .= $k . '/'; |
|
805 | + $tmp .= $k.'/'; |
|
806 | 806 | if (!is_dir($tmp)) { |
807 | 807 | mkdir($tmp, 0777); |
808 | 808 | } |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | |
824 | 824 | function rrmdir($dir) |
825 | 825 | { |
826 | - foreach (glob($dir . '/*') as $file) { |
|
826 | + foreach (glob($dir.'/*') as $file) { |
|
827 | 827 | if (is_dir($file)) { |
828 | 828 | rrmdir($file); |
829 | 829 | } else { |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $msg = ''; |
840 | 840 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
841 | 841 | if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
842 | - $userfile= array(); |
|
842 | + $userfile = array(); |
|
843 | 843 | |
844 | 844 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
845 | 845 | $userfile['error'] = $_FILES['userfile']['error'][$i]; |
@@ -856,12 +856,12 @@ discard block |
||
856 | 856 | $userfile['type'] = $_FILES['userfile']['type'][$i]; |
857 | 857 | |
858 | 858 | // this seems to be an upload action. |
859 | - $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
860 | - $path = rtrim($path, '/') . '/' . $userfile['name']; |
|
859 | + $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
860 | + $path = rtrim($path, '/').'/'.$userfile['name']; |
|
861 | 861 | $msg .= $path; |
862 | 862 | if ($userfile['error'] == 0) { |
863 | - $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : ''; |
|
864 | - $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>'; |
|
863 | + $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : ''; |
|
864 | + $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>'; |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | $userfilename = $userfile['tmp_name']; |
@@ -869,15 +869,15 @@ discard block |
||
869 | 869 | if (is_uploaded_file($userfilename)) { |
870 | 870 | // file is uploaded file, process it! |
871 | 871 | if (!checkExtension($userfile['name'])) { |
872 | - $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>'; |
|
872 | + $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>'; |
|
873 | 873 | } else { |
874 | - if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) { |
|
874 | + if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) { |
|
875 | 875 | // Ryan: Repair broken permissions issue with file manager |
876 | 876 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
877 | - @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions); |
|
877 | + @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions); |
|
878 | 878 | } |
879 | 879 | // Ryan: End |
880 | - $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>'; |
|
880 | + $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>'; |
|
881 | 881 | |
882 | 882 | // invoke OnFileManagerUpload event |
883 | 883 | $modx->invokeEvent('OnFileManagerUpload', array( |
@@ -885,13 +885,13 @@ discard block |
||
885 | 885 | 'filename' => $userfile['name'] |
886 | 886 | )); |
887 | 887 | // Log the change |
888 | - logFileChange('upload', $_POST['path'] . '/' . $userfile['name']); |
|
888 | + logFileChange('upload', $_POST['path'].'/'.$userfile['name']); |
|
889 | 889 | } else { |
890 | - $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>'; |
|
890 | + $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>'; |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | } else { |
894 | - $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>'; |
|
894 | + $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>'; |
|
895 | 895 | switch ($userfile['error']) { |
896 | 896 | case 0: //no error; possible file attack! |
897 | 897 | $msg .= $_lang['files_upload_error0']; |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | $msg .= '</span><br />'; |
916 | 916 | } |
917 | 917 | } |
918 | - return $msg . '<br/>'; |
|
918 | + return $msg.'<br/>'; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | function textsave() |
@@ -928,9 +928,9 @@ discard block |
||
928 | 928 | |
929 | 929 | // Write $content to our opened file. |
930 | 930 | if (file_put_contents($filename, $content) === false) { |
931 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />'; |
|
931 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />'; |
|
932 | 932 | } else { |
933 | - $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />'; |
|
933 | + $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />'; |
|
934 | 934 | $_REQUEST['mode'] = 'edit'; |
935 | 935 | } |
936 | 936 | // Log the change |
@@ -946,9 +946,9 @@ discard block |
||
946 | 946 | |
947 | 947 | $file = $_REQUEST['path']; |
948 | 948 | if (!$token_check || !@unlink($file)) { |
949 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />'; |
|
949 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />'; |
|
950 | 950 | } else { |
951 | - $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />'; |
|
951 | + $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />'; |
|
952 | 952 | } |
953 | 953 | |
954 | 954 | // Log the change |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
2 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
3 | 3 | |
4 | 4 | // Determine upgradeability |
5 | -$upgradeable= 0; |
|
5 | +$upgradeable = 0; |
|
6 | 6 | if ($installMode === 0) { |
7 | - $database_name= ''; |
|
8 | - $database_server= 'localhost'; |
|
7 | + $database_name = ''; |
|
8 | + $database_server = 'localhost'; |
|
9 | 9 | $table_prefix = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_'; |
10 | 10 | } else { |
11 | 11 | $database_name = ''; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | if ($dbase) { |
18 | 18 | $database_name = trim($dbase, '`'); |
19 | 19 | if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) |
20 | - $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2; |
|
21 | - elseif (! mysqli_select_db($conn, trim($dbase, '`'))) |
|
22 | - $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2; |
|
20 | + $upgradeable = (isset($_POST['installmode']) && $_POST['installmode'] == 'new') ? 0 : 2; |
|
21 | + elseif (!mysqli_select_db($conn, trim($dbase, '`'))) |
|
22 | + $upgradeable = (isset($_POST['installmode']) && $_POST['installmode'] == 'new') ? 0 : 2; |
|
23 | 23 | else |
24 | 24 | $upgradeable = 1; |
25 | 25 | } |
26 | - else $upgradable= 2; |
|
26 | + else $upgradable = 2; |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
@@ -49,28 +49,28 @@ discard block |
||
49 | 49 | $database_connection_method = 'SET CHARACTER SET'; |
50 | 50 | } |
51 | 51 | |
52 | -$ph['database_name'] = isset($_POST['database_name']) ? $_POST['database_name']: $database_name; |
|
53 | -$ph['tableprefix'] = isset($_POST['tableprefix']) ? $_POST['tableprefix']: $table_prefix; |
|
52 | +$ph['database_name'] = isset($_POST['database_name']) ? $_POST['database_name'] : $database_name; |
|
53 | +$ph['tableprefix'] = isset($_POST['tableprefix']) ? $_POST['tableprefix'] : $table_prefix; |
|
54 | 54 | $ph['selected_set_character_set'] = isset($database_connection_method) && $database_connection_method == 'SET CHARACTER SET' ? 'selected' : ''; |
55 | 55 | $ph['selected_set_names'] = isset($database_connection_method) && $database_connection_method == 'SET NAMES' ? 'selected' : ''; |
56 | 56 | $ph['show#connection_method'] = (($installMode == 0) || ($installMode == 2)) ? 'block' : 'none'; |
57 | -$ph['database_collation'] = isset($_POST['database_collation']) ? $_POST['database_collation']: $database_collation; |
|
58 | -$ph['show#AUH'] = ($installMode == 0) ? 'block':'none'; |
|
59 | -$ph['cmsadmin'] = isset($_POST['cmsadmin']) ? $_POST['cmsadmin']:'admin'; |
|
60 | -$ph['cmsadminemail'] = isset($_POST['cmsadminemail']) ? $_POST['cmsadminemail']:""; |
|
61 | -$ph['cmspassword'] = isset($_POST['cmspassword']) ? $_POST['cmspassword']:""; |
|
62 | -$ph['cmspasswordconfirm'] = isset($_POST['cmspasswordconfirm']) ? $_POST['cmspasswordconfirm']:""; |
|
57 | +$ph['database_collation'] = isset($_POST['database_collation']) ? $_POST['database_collation'] : $database_collation; |
|
58 | +$ph['show#AUH'] = ($installMode == 0) ? 'block' : 'none'; |
|
59 | +$ph['cmsadmin'] = isset($_POST['cmsadmin']) ? $_POST['cmsadmin'] : 'admin'; |
|
60 | +$ph['cmsadminemail'] = isset($_POST['cmsadminemail']) ? $_POST['cmsadminemail'] : ""; |
|
61 | +$ph['cmspassword'] = isset($_POST['cmspassword']) ? $_POST['cmspassword'] : ""; |
|
62 | +$ph['cmspasswordconfirm'] = isset($_POST['cmspasswordconfirm']) ? $_POST['cmspasswordconfirm'] : ""; |
|
63 | 63 | $ph['managerLangs'] = getLangs($install_language); |
64 | 64 | $ph['install_language'] = $install_language; |
65 | 65 | $ph['installMode'] = $installMode; |
66 | -$ph['checkedChkagree'] = isset($_POST['chkagree']) ? 'checked':""; |
|
66 | +$ph['checkedChkagree'] = isset($_POST['chkagree']) ? 'checked' : ""; |
|
67 | 67 | $ph['database_connection_method'] = isset($database_connection_method) ? $database_connection_method : ''; |
68 | -$ph['databasehost'] = isset($_POST['databasehost']) ? $_POST['databasehost']: $database_server; |
|
69 | -$ph['databaseloginname'] = isset($_SESSION['databaseloginname']) ? $_SESSION['databaseloginname']: ''; |
|
70 | -$ph['databaseloginpassword'] = isset($_SESSION['databaseloginpassword']) ? $_SESSION['databaseloginpassword']: ""; |
|
68 | +$ph['databasehost'] = isset($_POST['databasehost']) ? $_POST['databasehost'] : $database_server; |
|
69 | +$ph['databaseloginname'] = isset($_SESSION['databaseloginname']) ? $_SESSION['databaseloginname'] : ''; |
|
70 | +$ph['databaseloginpassword'] = isset($_SESSION['databaseloginpassword']) ? $_SESSION['databaseloginpassword'] : ""; |
|
71 | 71 | $ph['MGR_DIR'] = MGR_DIR; |
72 | 72 | |
73 | 73 | $content = file_get_contents('./actions/tpl_connection.html'); |
74 | -$content = parse($content, $_lang, '[%','%]'); |
|
74 | +$content = parse($content, $_lang, '[%', '%]'); |
|
75 | 75 | $content = parse($content, $ph); |
76 | 76 | echo $content; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Build and return document tree view nodes |
5 | 5 | * |
6 | 6 | */ |
7 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
7 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
8 | 8 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
9 | 9 | } |
10 | 10 | |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | exit('send some data'); |
19 | 19 | } //?? |
20 | 20 | |
21 | -$indent = (int)$_REQUEST['indent']; |
|
22 | -$parent = (int)$_REQUEST['parent']; |
|
23 | -$expandAll = (int)$_REQUEST['expandAll']; |
|
21 | +$indent = (int) $_REQUEST['indent']; |
|
22 | +$parent = (int) $_REQUEST['parent']; |
|
23 | +$expandAll = (int) $_REQUEST['expandAll']; |
|
24 | 24 | $output = ''; |
25 | -$theme = $manager_theme . "/"; |
|
25 | +$theme = $manager_theme."/"; |
|
26 | 26 | $hereid = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : ''; |
27 | 27 | |
28 | 28 | if (isset($_REQUEST['showonlyfolders'])) { |
@@ -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" /> |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | </div> |
102 | 102 | |
103 | 103 | <?php |
104 | -function run() { |
|
104 | +function run(){ |
|
105 | 105 | global $modx, $_lang; |
106 | 106 | |
107 | 107 | $tbl_site_content = $modx->getFullTableName('site_content'); |
108 | 108 | $output = ''; |
109 | 109 | $maxtime = $_POST['maxtime']; |
110 | 110 | |
111 | - if(!is_numeric($maxtime)) { |
|
111 | + if (!is_numeric($maxtime)) { |
|
112 | 112 | $maxtime = 30; |
113 | 113 | } |
114 | 114 | |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | $mtime = $mtime[1] + $mtime[0]; |
120 | 120 | $importstart = $mtime; |
121 | 121 | |
122 | - if($_POST['reset'] == 'on') { |
|
122 | + if ($_POST['reset'] == 'on') { |
|
123 | 123 | $modx->db->truncate($tbl_site_content); |
124 | 124 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
125 | 125 | } |
126 | 126 | |
127 | - $parent = (int)$_POST['parent']; |
|
127 | + $parent = (int) $_POST['parent']; |
|
128 | 128 | |
129 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
130 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
131 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
132 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
129 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
130 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
131 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
132 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
133 | 133 | } else { |
134 | 134 | $filedir = ''; |
135 | 135 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $files = pop_index($files); |
141 | 141 | |
142 | 142 | // no. of files to import |
143 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
143 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
144 | 144 | |
145 | 145 | // import files |
146 | - if(0 < count($files)) { |
|
146 | + if (0 < count($files)) { |
|
147 | 147 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
148 | 148 | importFiles($parent, $filedir, $files, 'root'); |
149 | 149 | } |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | $mtime = $mtime[1] + $mtime[0]; |
154 | 154 | $importend = $mtime; |
155 | 155 | $totaltime = ($importend - $importstart); |
156 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
156 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
157 | 157 | |
158 | - if($_POST['convert_link'] == 'on') { |
|
158 | + if ($_POST['convert_link'] == 'on') { |
|
159 | 159 | convertLink(); |
160 | 160 | } |
161 | 161 | |
162 | 162 | return $output; |
163 | 163 | } |
164 | 164 | |
165 | -function importFiles($parent, $filedir, $files, $mode) { |
|
165 | +function importFiles($parent, $filedir, $files, $mode){ |
|
166 | 166 | global $modx; |
167 | 167 | global $_lang, $allowedfiles; |
168 | 168 | global $search_default, $cache_default, $publish_default; |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
172 | 172 | |
173 | 173 | $createdby = $modx->getLoginUserID(); |
174 | - if(!is_array($files)) { |
|
174 | + if (!is_array($files)) { |
|
175 | 175 | return; |
176 | 176 | } |
177 | - if($_POST['object'] == 'all') { |
|
177 | + if ($_POST['object'] == 'all') { |
|
178 | 178 | $modx->config['default_template'] = '0'; |
179 | 179 | $richtext = '0'; |
180 | 180 | } else { |
181 | 181 | $richtext = '1'; |
182 | 182 | } |
183 | 183 | |
184 | - foreach($files as $id => $value) { |
|
185 | - if(is_array($value)) { |
|
184 | + foreach ($files as $id => $value) { |
|
185 | + if (is_array($value)) { |
|
186 | 186 | // create folder |
187 | 187 | $alias = $id; |
188 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
188 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
189 | 189 | $field = array(); |
190 | 190 | $field['type'] = 'document'; |
191 | 191 | $field['contentType'] = 'text/html'; |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | $field['isfolder'] = 1; |
201 | 201 | $field['menuindex'] = 1; |
202 | 202 | $find = false; |
203 | - foreach(array( |
|
203 | + foreach (array( |
|
204 | 204 | 'index.html', |
205 | 205 | 'index.htm' |
206 | 206 | ) as $filename) { |
207 | - $filepath = $filedir . $alias . '/' . $filename; |
|
208 | - if($find === false && file_exists($filepath)) { |
|
207 | + $filepath = $filedir.$alias.'/'.$filename; |
|
208 | + if ($find === false && file_exists($filepath)) { |
|
209 | 209 | $file = getFileContent($filepath); |
210 | 210 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
211 | 211 | |
@@ -217,17 +217,17 @@ discard block |
||
217 | 217 | $field['createdon'] = $date; |
218 | 218 | $field['editedon'] = $date; |
219 | 219 | $newid = $modx->db->insert($field, $tbl_site_content); |
220 | - if($newid) { |
|
220 | + if ($newid) { |
|
221 | 221 | $find = true; |
222 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
223 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
222 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
223 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
224 | 224 | } else { |
225 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
225 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
226 | 226 | exit; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | - if($find === false) { |
|
230 | + if ($find === false) { |
|
231 | 231 | $date = time(); |
232 | 232 | $field['pagetitle'] = '---'; |
233 | 233 | $field['content'] = ''; |
@@ -235,30 +235,30 @@ discard block |
||
235 | 235 | $field['editedon'] = $date; |
236 | 236 | $field['hidemenu'] = '1'; |
237 | 237 | $newid = $modx->db->insert($field, $tbl_site_content); |
238 | - if($newid) { |
|
238 | + if ($newid) { |
|
239 | 239 | $find = true; |
240 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
241 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
240 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
241 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
242 | 242 | } else { |
243 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
243 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
244 | 244 | exit; |
245 | 245 | } |
246 | 246 | } |
247 | 247 | } else { |
248 | 248 | // create document |
249 | - if($mode == 'sub' && $value == 'index.html') { |
|
249 | + if ($mode == 'sub' && $value == 'index.html') { |
|
250 | 250 | continue; |
251 | 251 | } |
252 | 252 | $filename = $value; |
253 | 253 | $fparts = explode('.', $value); |
254 | 254 | $alias = $fparts[0]; |
255 | 255 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
256 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
256 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
257 | 257 | |
258 | - if(!in_array($ext, $allowedfiles)) { |
|
259 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
258 | + if (!in_array($ext, $allowedfiles)) { |
|
259 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
260 | 260 | } else { |
261 | - $filepath = $filedir . $filename; |
|
261 | + $filepath = $filedir.$filename; |
|
262 | 262 | $file = getFileContent($filepath); |
263 | 263 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
264 | 264 | |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | $field['isfolder'] = 0; |
284 | 284 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
285 | 285 | $newid = $modx->db->insert($field, $tbl_site_content); |
286 | - if($newid) { |
|
287 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
286 | + if ($newid) { |
|
287 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
288 | 288 | } else { |
289 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
289 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
290 | 290 | exit; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $is_site_start = false; |
294 | - if($filename == 'index.html') { |
|
294 | + if ($filename == 'index.html') { |
|
295 | 295 | $is_site_start = true; |
296 | 296 | } |
297 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
297 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
298 | 298 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
299 | 299 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
300 | 300 | } |
@@ -303,85 +303,85 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
306 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
307 | 307 | global $_lang; |
308 | 308 | global $filesfound; |
309 | 309 | $dummy = $count; |
310 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
311 | - foreach($files as $file) { |
|
312 | - if($file == '.' || $file == '..') { |
|
310 | + if (!empty($directory) && $files = scandir($directory)) { |
|
311 | + foreach ($files as $file) { |
|
312 | + if ($file == '.' || $file == '..') { |
|
313 | 313 | continue; |
314 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
314 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
315 | 315 | closedir($h); |
316 | 316 | $count = -1; |
317 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
318 | - } elseif(strpos($file, '.htm') !== false) { |
|
317 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
318 | + } elseif (strpos($file, '.htm') !== false) { |
|
319 | 319 | $listing[$dummy] = $file; |
320 | 320 | $dummy = $dummy + 1; |
321 | 321 | $filesfound++; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | } else { |
325 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
325 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
326 | 326 | } |
327 | 327 | return ($listing); |
328 | 328 | } |
329 | 329 | |
330 | -function getFileContent($filepath) { |
|
330 | +function getFileContent($filepath){ |
|
331 | 331 | global $_lang; |
332 | 332 | // get the file |
333 | - if(!$buffer = file_get_contents($filepath)) { |
|
334 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
333 | + if (!$buffer = file_get_contents($filepath)) { |
|
334 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
335 | 335 | } else { |
336 | 336 | return $buffer; |
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | -function pop_index($array) { |
|
340 | +function pop_index($array){ |
|
341 | 341 | $new_array = array(); |
342 | - foreach($array as $k => $v) { |
|
343 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
342 | + foreach ($array as $k => $v) { |
|
343 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
344 | 344 | $new_array[$k] = $v; |
345 | 345 | } else { |
346 | 346 | array_unshift($new_array, $v); |
347 | 347 | } |
348 | 348 | } |
349 | - foreach($array as $k => $v) { |
|
350 | - if(is_array($v)) { |
|
349 | + foreach ($array as $k => $v) { |
|
350 | + if (is_array($v)) { |
|
351 | 351 | $new_array[$k] = $v; |
352 | 352 | } |
353 | 353 | } |
354 | 354 | return $new_array; |
355 | 355 | } |
356 | 356 | |
357 | -function treatContent($src, $filename, $alias) { |
|
357 | +function treatContent($src, $filename, $alias){ |
|
358 | 358 | global $modx; |
359 | 359 | |
360 | 360 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
361 | 361 | |
362 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
362 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
363 | 363 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
364 | 364 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
365 | 365 | } else { |
366 | 366 | $pagetitle = $alias; |
367 | 367 | } |
368 | - if(!$pagetitle) { |
|
368 | + if (!$pagetitle) { |
|
369 | 369 | $pagetitle = $alias; |
370 | 370 | } |
371 | 371 | |
372 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
372 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
373 | 373 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
374 | 374 | $description = str_replace('[*description*]', '', $description); |
375 | 375 | } else { |
376 | 376 | $description = ''; |
377 | 377 | } |
378 | 378 | |
379 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
379 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
380 | 380 | $content = $matches[1]; |
381 | 381 | } else { |
382 | 382 | $content = $src; |
383 | 383 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
384 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
384 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
385 | 385 | $content = preg_replace($s, $r, $content); |
386 | 386 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
387 | 387 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ); |
396 | 396 | } |
397 | 397 | |
398 | -function convertLink() { |
|
398 | +function convertLink(){ |
|
399 | 399 | global $modx; |
400 | 400 | $tbl_site_content = $modx->getFullTableName('site_content'); |
401 | 401 | |
@@ -403,33 +403,33 @@ discard block |
||
403 | 403 | $p = array(); |
404 | 404 | $target = array(); |
405 | 405 | $dir = ''; |
406 | - while($row = $modx->db->getRow($rs)) { |
|
406 | + while ($row = $modx->db->getRow($rs)) { |
|
407 | 407 | $id = $row['id']; |
408 | 408 | $array = explode('<a href=', $row['content']); |
409 | 409 | $c = 0; |
410 | - foreach($array as $v) { |
|
411 | - if($v[0] === '"') { |
|
410 | + foreach ($array as $v) { |
|
411 | + if ($v[0] === '"') { |
|
412 | 412 | $v = substr($v, 1); |
413 | 413 | list($href, $v) = explode('"', $v, 2); |
414 | 414 | $_ = $href; |
415 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
416 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
415 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
416 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
417 | 417 | } |
418 | - if($_[0] === '/') { |
|
418 | + if ($_[0] === '/') { |
|
419 | 419 | $_ = substr($_, 1); |
420 | 420 | } |
421 | 421 | $_ = str_replace('/index.html', '.html', $_); |
422 | 422 | $level = substr_count($_, '../'); |
423 | - if(1 < $level) { |
|
424 | - if(!isset($p[$id])) { |
|
423 | + if (1 < $level) { |
|
424 | + if (!isset($p[$id])) { |
|
425 | 425 | $p[$id] = $modx->getParentIds($id); |
426 | 426 | } |
427 | 427 | $k = array_keys($p[$id]); |
428 | - while(0 < $level) { |
|
428 | + while (0 < $level) { |
|
429 | 429 | $dir = array_shift($k); |
430 | 430 | $level--; |
431 | 431 | } |
432 | - if($dir != '') { |
|
432 | + if ($dir != '') { |
|
433 | 433 | $dir .= '/'; |
434 | 434 | } |
435 | 435 | } else { |
@@ -437,18 +437,18 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | $_ = trim($_, './'); |
440 | - if(strpos($_, '/') !== false) { |
|
440 | + if (strpos($_, '/') !== false) { |
|
441 | 441 | $_ = substr($_, strrpos($_, '/')); |
442 | 442 | } |
443 | - $_ = $dir . str_replace('.html', '', $_); |
|
444 | - if(!isset($target[$_])) { |
|
443 | + $_ = $dir.str_replace('.html', '', $_); |
|
444 | + if (!isset($target[$_])) { |
|
445 | 445 | $target[$_] = $modx->getIdFromAlias($_); |
446 | 446 | } |
447 | 447 | $target[$_] = trim($target[$_]); |
448 | - if(!empty($target[$_])) { |
|
449 | - $href = '[~' . $target[$_] . '~]'; |
|
448 | + if (!empty($target[$_])) { |
|
449 | + $href = '[~'.$target[$_].'~]'; |
|
450 | 450 | } |
451 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
451 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
452 | 452 | } |
453 | 453 | $c++; |
454 | 454 | } |
@@ -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,52 +1516,52 @@ 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 | } |
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | |
1535 | -function getDefaultTemplate() { |
|
1535 | +function getDefaultTemplate(){ |
|
1536 | 1536 | global $modx; |
1537 | 1537 | |
1538 | - switch($modx->config['auto_template_logic']) { |
|
1538 | + switch ($modx->config['auto_template_logic']) { |
|
1539 | 1539 | case 'sibling': |
1540 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1540 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1541 | 1541 | $site_start = $modx->config['site_start']; |
1542 | 1542 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1543 | 1543 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1544 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1544 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1545 | 1545 | $default_template = $sibl[0]['template']; |
1546 | 1546 | } |
1547 | 1547 | } else { |
1548 | 1548 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1549 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1550 | 1550 | $default_template = $sibl[0]['template']; |
1551 | 1551 | } else { |
1552 | 1552 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 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 | } |
1556 | 1556 | } |
1557 | 1557 | } |
1558 | - if(isset($default_template)) { |
|
1558 | + if (isset($default_template)) { |
|
1559 | 1559 | break; |
1560 | 1560 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1561 | 1561 | case 'parent': |
1562 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1562 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1563 | 1563 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1564 | - if(isset($parent['template'])) { |
|
1564 | + if (isset($parent['template'])) { |
|
1565 | 1565 | $default_template = $parent['template']; |
1566 | 1566 | } |
1567 | 1567 | } |
@@ -1570,7 +1570,7 @@ discard block |
||
1570 | 1570 | default: // default_template is already set |
1571 | 1571 | $default_template = $modx->config['default_template']; |
1572 | 1572 | } |
1573 | - if(!isset($default_template)) { |
|
1573 | + if (!isset($default_template)) { |
|
1574 | 1574 | $default_template = $modx->config['default_template']; |
1575 | 1575 | } // default_template is already set |
1576 | 1576 |
@@ -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('logs')) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
66 | 66 | foreach ($logs_user as $row) { |
67 | 67 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
68 | - echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
|
68 | + echo "\t\t".'<option value="'.$row['internalKey'].'"'.$selectedtext.'>'.$row['username']."</option>\n"; |
|
69 | 69 | } |
70 | 70 | ?> |
71 | 71 | </select> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
89 | - echo "\t\t" . '<option value="' . $row['action'] . '"' . $selectedtext . '>' . $row['action'] . ' - ' . $action . "</option>\n"; |
|
89 | + echo "\t\t".'<option value="'.$row['action'].'"'.$selectedtext.'>'.$row['action'].' - '.$action."</option>\n"; |
|
90 | 90 | } |
91 | 91 | ?> |
92 | 92 | </select> |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
103 | 103 | foreach ($logs_items as $row) { |
104 | 104 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
105 | - echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
|
105 | + echo "\t\t".'<option value="'.$row['itemid'].'"'.$selectedtext.'>'.$row['itemid']."</option>\n"; |
|
106 | 106 | } |
107 | 107 | ?> |
108 | 108 | </select> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
119 | 119 | foreach ($logs_names as $row) { |
120 | 120 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
121 | - echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
|
121 | + echo "\t\t".'<option value="'.$row['itemname'].'"'.$selectedtext.'>'.$row['itemname']."</option>\n"; |
|
122 | 122 | } |
123 | 123 | ?> |
124 | 124 | </select> |
@@ -176,26 +176,26 @@ discard block |
||
176 | 176 | // get the selections the user made. |
177 | 177 | $sqladd = array(); |
178 | 178 | if ($_REQUEST['searchuser'] != 0) { |
179 | - $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
|
179 | + $sqladd[] = "internalKey='".(int) $_REQUEST['searchuser']."'"; |
|
180 | 180 | } |
181 | 181 | if ($_REQUEST['action'] != 0) { |
182 | - $sqladd[] = "action=" . (int)$_REQUEST['action']; |
|
182 | + $sqladd[] = "action=".(int) $_REQUEST['action']; |
|
183 | 183 | } |
184 | 184 | if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
185 | - $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
|
185 | + $sqladd[] = "itemid='".$_REQUEST['itemid']."'"; |
|
186 | 186 | } |
187 | 187 | if ($_REQUEST['itemname'] != '0') { |
188 | - $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
|
188 | + $sqladd[] = "itemname='".$modx->db->escape($_REQUEST['itemname'])."'"; |
|
189 | 189 | } |
190 | 190 | if ($_REQUEST['message'] != "") { |
191 | - $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
|
191 | + $sqladd[] = "message LIKE '%".$modx->db->escape($_REQUEST['message'])."%'"; |
|
192 | 192 | } |
193 | 193 | // date stuff |
194 | 194 | if ($_REQUEST['datefrom'] != "") { |
195 | - $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
|
195 | + $sqladd[] = "timestamp>".$modx->toTimeStamp($_REQUEST['datefrom']); |
|
196 | 196 | } |
197 | 197 | if ($_REQUEST['dateto'] != "") { |
198 | - $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
|
198 | + $sqladd[] = "timestamp<".$modx->toTimeStamp($_REQUEST['dateto']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | // If current position is not set, set it to zero |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // Number of result to display on the page, will be in the LIMIT of the sql query also |
209 | 209 | $int_num_result = is_numeric($_REQUEST['nrresults']) ? $_REQUEST['nrresults'] : $number_of_logs; |
210 | 210 | |
211 | - $extargv = "&a=13&searchuser=" . $_REQUEST['searchuser'] . "&action=" . $_REQUEST['action'] . "&itemid=" . $_REQUEST['itemid'] . "&itemname=" . $_REQUEST['itemname'] . "&message=" . $_REQUEST['message'] . "&dateto=" . $_REQUEST['dateto'] . "&datefrom=" . $_REQUEST['datefrom'] . "&nrresults=" . $int_num_result . "&log_submit=" . $_REQUEST['log_submit']; // extra argv here (could be anything depending on your page) |
|
211 | + $extargv = "&a=13&searchuser=".$_REQUEST['searchuser']."&action=".$_REQUEST['action']."&itemid=".$_REQUEST['itemid']."&itemname=".$_REQUEST['itemname']."&message=".$_REQUEST['message']."&dateto=".$_REQUEST['dateto']."&datefrom=".$_REQUEST['datefrom']."&nrresults=".$int_num_result."&log_submit=".$_REQUEST['log_submit']; // extra argv here (could be anything depending on your page) |
|
212 | 212 | |
213 | 213 | // build the sql |
214 | 214 | $limit = $num_rows = $modx->db->getValue($modx->db->select('COUNT(*)', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''))); |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
217 | 217 | |
218 | 218 | if ($limit < 1) { |
219 | - echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
|
219 | + echo '<p>'.$_lang["mgrlog_emptysrch"].'</p>'; |
|
220 | 220 | } else { |
221 | - echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
|
221 | + echo '<p>'.$_lang["mgrlog_sortinst"].'</p>'; |
|
222 | 222 | |
223 | 223 | include_once "paginate.inc.php"; |
224 | 224 | // New instance of the Paging class, you can modify the color and the width of the html table |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | $current_row = $int_cur_position / $int_num_result; |
231 | 231 | |
232 | 232 | // Display the result as you like... |
233 | - print "<p>" . $_lang["paging_showing"] . " " . $array_paging['lower']; |
|
234 | - print " " . $_lang["paging_to"] . " " . $array_paging['upper']; |
|
235 | - print " (" . $array_paging['total'] . " " . $_lang["paging_total"] . ")<br />"; |
|
236 | - $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
|
237 | - $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
|
233 | + print "<p>".$_lang["paging_showing"]." ".$array_paging['lower']; |
|
234 | + print " ".$_lang["paging_to"]." ".$array_paging['upper']; |
|
235 | + print " (".$array_paging['total']." ".$_lang["paging_total"].")<br />"; |
|
236 | + $paging = $array_paging['first_link'].$_lang["paging_first"].(isset($array_paging['first_link']) ? "</a> " : " "); |
|
237 | + $paging .= $array_paging['previous_link'].$_lang["paging_prev"].(isset($array_paging['previous_link']) ? "</a> " : " "); |
|
238 | 238 | $pagesfound = sizeof($array_row_paging); |
239 | 239 | if ($pagesfound > 6) { |
240 | 240 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
245 | 245 | } else { |
246 | 246 | for ($i = 0; $i < $pagesfound; $i++) { |
247 | - $paging .= $array_row_paging[$i] . " "; |
|
247 | + $paging .= $array_row_paging[$i]." "; |
|
248 | 248 | } |
249 | 249 | } |
250 | - $paging .= $array_paging['next_link'] . $_lang["paging_next"] . (isset($array_paging['next_link']) ? "</a> " : " ") . " "; |
|
251 | - $paging .= $array_paging['last_link'] . $_lang["paging_last"] . (isset($array_paging['last_link']) ? "</a> " : " ") . " "; |
|
250 | + $paging .= $array_paging['next_link'].$_lang["paging_next"].(isset($array_paging['next_link']) ? "</a> " : " ")." "; |
|
251 | + $paging .= $array_paging['last_link'].$_lang["paging_last"].(isset($array_paging['last_link']) ? "</a> " : " ")." "; |
|
252 | 252 | // The above exemple print somethings like: |
253 | 253 | // Results 1 to 20 of 597 <<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>> |
254 | 254 | // Of course you can now play with array_row_paging in order to print |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
283 | 283 | $item = '<div style="text-align:center;">-</div>'; |
284 | 284 | } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
285 | - $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
|
285 | + $item = '<a href="index.php?a=3&id='.$logentry['itemid'].'">'.$logentry['itemname'].'</a>'; |
|
286 | 286 | } else { |
287 | 287 | $item = $logentry['itemname']; |
288 | 288 | } |
289 | 289 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
290 | - $user_drill = 'index.php?a=13&searchuser=' . $logentry['internalKey'] . '&itemname=0&log_submit=true'; |
|
290 | + $user_drill = 'index.php?a=13&searchuser='.$logentry['internalKey'].'&itemname=0&log_submit=true'; |
|
291 | 291 | ?> |
292 | 292 | <tr> |
293 | - <td><?= '<a href="' . $user_drill . '">' . $logentry['username'] . '</a>' ?></td> |
|
294 | - <td class="text-nowrap"><?= '[' . $logentry['action'] . '] ' . $logentry['message'] ?></td> |
|
293 | + <td><?= '<a href="'.$user_drill.'">'.$logentry['username'].'</a>' ?></td> |
|
294 | + <td class="text-nowrap"><?= '['.$logentry['action'].'] '.$logentry['message'] ?></td> |
|
295 | 295 | <td class="text-xs-right"><?= $logentry['itemid'] ?></td> |
296 | 296 | <td><?= $item ?></td> |
297 | 297 | <td class="text-nowrap"><?= $modx->toDateFormat($logentry['timestamp'] + $server_offset_time) ?></td> |