@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->manager->action) { |
7 | - case 22: |
|
8 | - if (!$modx->hasPermission('edit_snippet')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 23: |
|
13 | - if (!$modx->hasPermission('new_snippet')) { |
|
7 | + case 22: |
|
8 | + if (!$modx->hasPermission('edit_snippet')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 23: |
|
13 | + if (!$modx->hasPermission('new_snippet')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -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 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | // Get table Names (alphabetical) |
24 | 24 | $tbl_site_module_depobj = $modx->getFullTableName('site_module_depobj'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $rs = $modx->db->select('*', $tbl_site_snippets, "id='{$id}'"); |
40 | 40 | $content = $modx->db->getRow($rs); |
41 | 41 | if (!$content) { |
42 | - header("Location: " . MODX_SITE_URL . "index.php?id=" . $site_start); |
|
42 | + header("Location: ".MODX_SITE_URL."index.php?id=".$site_start); |
|
43 | 43 | } |
44 | 44 | $_SESSION['itemname'] = $content['name']; |
45 | 45 | if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $content['name'] = $_REQUEST['itemname']; |
51 | 51 | } else { |
52 | 52 | $_SESSION['itemname'] = $_lang["new_snippet"]; |
53 | - $content['category'] = (int)$_REQUEST['catid']; |
|
53 | + $content['category'] = (int) $_REQUEST['catid']; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($modx->manager->hasFormValues()) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Add lock-element JS-Script |
63 | 63 | $lockElementId = $id; |
64 | 64 | $lockElementType = 4; |
65 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
65 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
66 | 66 | ?> |
67 | 67 | <script type="text/javascript"> |
68 | 68 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
432 | 432 | |
433 | 433 | <h1 class="pagetitle"> |
434 | - <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i> |
|
434 | + <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i> |
|
435 | 435 | </h1> |
436 | 436 | |
437 | 437 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | <div class="form-control-name clearfix"> |
458 | 458 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
459 | 459 | <?php if ($modx->hasPermission('save_role')): ?> |
460 | - <label class="custom-control" title="<?= $_lang['lock_snippet'] . "\n" . $_lang['lock_snippet_msg'] ?>" tooltip> |
|
460 | + <label class="custom-control" title="<?= $_lang['lock_snippet']."\n".$_lang['lock_snippet_msg'] ?>" tooltip> |
|
461 | 461 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
462 | 462 | <i class="fa fa-lock"></i> |
463 | 463 | </label> |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
482 | 482 | <option> </option> |
483 | 483 | <?php |
484 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
484 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
485 | 485 | foreach (getCategories() as $n => $v) { |
486 | - echo '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . '</option>'; |
|
486 | + echo '<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category']).'</option>'; |
|
487 | 487 | } |
488 | 488 | ?> |
489 | 489 | </select> |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | <div class="form-group"> |
501 | 501 | <?php if ($_SESSION['mgrRole'] == 1): ?> |
502 | 502 | <div class="form-row"> |
503 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label> |
|
503 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label> |
|
504 | 504 | </div> |
505 | 505 | <?php endif; ?> |
506 | 506 | <div class="form-row"> |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | <span><?= $_lang['snippet_code'] ?></span> |
518 | 518 | </div> |
519 | 519 | <div class="section-editor clearfix"> |
520 | - <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php" . "\n" . trim($modx->htmlspecialchars($content['snippet'])) . "\n") ?></textarea> |
|
520 | + <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php"."\n".trim($modx->htmlspecialchars($content['snippet']))."\n") ?></textarea> |
|
521 | 521 | </div> |
522 | 522 | <!-- PHP text editor end --> |
523 | 523 | </div> |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | INNER JOIN {$tbl_site_module_depobj} AS smd ON smd.module=sm.id AND smd.type=40 |
553 | 553 | INNER JOIN {$tbl_site_snippets} AS ss ON ss.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams=1", 'sm.name'); |
554 | 554 | while ($row = $modx->db->getRow($ds)) { |
555 | - echo "<option value='" . $row['guid'] . "'" . ($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row['name']) . "</option>"; |
|
555 | + echo "<option value='".$row['guid']."'".($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row['name'])."</option>"; |
|
556 | 556 | } |
557 | 557 | ?> |
558 | 558 | </select> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -$userid = (int)$value; |
|
2 | +$userid = (int) $value; |
|
3 | 3 | if (!isset($modx->filter->cache['ui'][$userid])) { |
4 | 4 | if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
5 | 5 | else $user = $modx->getUserInfo($userid); |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | $userid = (int)$value; |
3 | 3 | if (!isset($modx->filter->cache['ui'][$userid])) { |
4 | - if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
|
5 | - else $user = $modx->getUserInfo($userid); |
|
4 | + if ($userid < 0) { |
|
5 | + $user = $modx->getWebUserInfo(abs($userid)); |
|
6 | + } else { |
|
7 | + $user = $modx->getUserInfo($userid); |
|
8 | + } |
|
6 | 9 | $modx->filter->cache['ui'][$userid] = $user; |
7 | 10 | } else { |
8 | 11 | $user = $modx->filter->cache['ui'][$userid]; |
@@ -1,43 +1,43 @@ |
||
1 | 1 | <?php |
2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
4 | -else {$limit=124;$delim='';} |
|
2 | +if (strpos($opt, ',')) list($limit, $delim) = explode(',', $opt); |
|
3 | +elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {$limit = $opt; $delim = ''; } |
|
4 | +else {$limit = 124; $delim = ''; } |
|
5 | 5 | |
6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
7 | -$limit = (int)$limit; |
|
6 | +if ($delim === '') $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.'; |
|
7 | +$limit = (int) $limit; |
|
8 | 8 | |
9 | 9 | $content = $modx->filter->parseDocumentSource($value); |
10 | 10 | |
11 | 11 | $content = strip_tags($content); |
12 | 12 | |
13 | -$content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
|
14 | -if(preg_match('/\s+/',$content)) |
|
15 | - $content = preg_replace('/\s+/',' ',$content); |
|
13 | +$content = str_replace(array("\r\n", "\r", "\n", "\t", ' '), ' ', $content); |
|
14 | +if (preg_match('/\s+/', $content)) |
|
15 | + $content = preg_replace('/\s+/', ' ', $content); |
|
16 | 16 | $content = trim($content); |
17 | 17 | |
18 | 18 | $pos = $modx->filter->strpos($content, $delim); |
19 | 19 | |
20 | -if($pos!==false && $pos<$limit) { |
|
20 | +if ($pos !== false && $pos < $limit) { |
|
21 | 21 | $_ = explode($delim, $content); |
22 | 22 | $text = ''; |
23 | - foreach($_ as $v) { |
|
24 | - if($limit <= $modx->filter->strlen($text.$v.$delim)) break; |
|
23 | + foreach ($_ as $v) { |
|
24 | + if ($limit <= $modx->filter->strlen($text.$v.$delim)) break; |
|
25 | 25 | $text .= $v.$delim; |
26 | 26 | } |
27 | - if($text) $content = $text; |
|
27 | + if ($text) $content = $text; |
|
28 | 28 | } |
29 | 29 | |
30 | -if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) { |
|
30 | +if ($limit < $modx->filter->strlen($content) && strpos($content, ' ') !== false) { |
|
31 | 31 | $_ = explode(' ', $content); |
32 | 32 | $text = ''; |
33 | - foreach($_ as $v) { |
|
34 | - if($limit <= $modx->filter->strlen($text.$v.' ')) break; |
|
35 | - $text .= $v . ' '; |
|
33 | + foreach ($_ as $v) { |
|
34 | + if ($limit <= $modx->filter->strlen($text.$v.' ')) break; |
|
35 | + $text .= $v.' '; |
|
36 | 36 | } |
37 | - if($text!=='') $content = $text; |
|
37 | + if ($text !== '') $content = $text; |
|
38 | 38 | } |
39 | 39 | |
40 | -if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit); |
|
41 | -if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
40 | +if ($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit); |
|
41 | +if ($modx->filter->substr($content, -1) == $delim) $content = rtrim($content, $delim).$delim; |
|
42 | 42 | |
43 | 43 | return $content; |
@@ -1,9 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
4 | -else {$limit=124;$delim='';} |
|
2 | +if(strpos($opt,',')) { |
|
3 | + list($limit,$delim) = explode(',', $opt); |
|
4 | +} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';} |
|
5 | 5 | |
6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
6 | +if($delim==='') { |
|
7 | + $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
8 | +} |
|
7 | 9 | $limit = (int)$limit; |
8 | 10 | |
9 | 11 | $content = $modx->filter->parseDocumentSource($value); |
@@ -11,8 +13,9 @@ discard block |
||
11 | 13 | $content = strip_tags($content); |
12 | 14 | |
13 | 15 | $content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
14 | -if(preg_match('/\s+/',$content)) |
|
16 | +if(preg_match('/\s+/',$content)) { |
|
15 | 17 | $content = preg_replace('/\s+/',' ',$content); |
18 | +} |
|
16 | 19 | $content = trim($content); |
17 | 20 | |
18 | 21 | $pos = $modx->filter->strpos($content, $delim); |
@@ -21,23 +24,35 @@ discard block |
||
21 | 24 | $_ = explode($delim, $content); |
22 | 25 | $text = ''; |
23 | 26 | foreach($_ as $v) { |
24 | - if($limit <= $modx->filter->strlen($text.$v.$delim)) break; |
|
27 | + if($limit <= $modx->filter->strlen($text.$v.$delim)) { |
|
28 | + break; |
|
29 | + } |
|
25 | 30 | $text .= $v.$delim; |
26 | 31 | } |
27 | - if($text) $content = $text; |
|
28 | -} |
|
32 | + if($text) { |
|
33 | + $content = $text; |
|
34 | + } |
|
35 | + } |
|
29 | 36 | |
30 | 37 | if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) { |
31 | 38 | $_ = explode(' ', $content); |
32 | 39 | $text = ''; |
33 | 40 | foreach($_ as $v) { |
34 | - if($limit <= $modx->filter->strlen($text.$v.' ')) break; |
|
41 | + if($limit <= $modx->filter->strlen($text.$v.' ')) { |
|
42 | + break; |
|
43 | + } |
|
35 | 44 | $text .= $v . ' '; |
36 | 45 | } |
37 | - if($text!=='') $content = $text; |
|
38 | -} |
|
46 | + if($text!=='') { |
|
47 | + $content = $text; |
|
48 | + } |
|
49 | + } |
|
39 | 50 | |
40 | -if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit); |
|
41 | -if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
51 | +if($limit < $modx->filter->strlen($content)) { |
|
52 | + $content = $modx->filter->substr($content, 0, $limit); |
|
53 | +} |
|
54 | +if($modx->filter->substr($content,-1)==$delim) { |
|
55 | + $content = rtrim($content,$delim) . $delim; |
|
56 | +} |
|
42 | 57 | |
43 | 58 | return $content; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $pre = null, |
31 | 31 | $charset = '', |
32 | 32 | $connection_method = 'SET CHARACTER SET' |
33 | - ) { |
|
33 | + ){ |
|
34 | 34 | $this->config['host'] = $host ? $host : $GLOBALS['database_server']; |
35 | 35 | $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase']; |
36 | 36 | $this->config['user'] = $uid ? $uid : $GLOBALS['database_user']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']); |
121 | 121 | |
122 | 122 | $modx->sendmail(array( |
123 | - 'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'], |
|
123 | + 'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'], |
|
124 | 124 | 'body' => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}", |
125 | 125 | 'type' => 'text' |
126 | 126 | ) |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | } else { |
138 | 138 | $dbase = trim($dbase, '`'); // remove the `` chars |
139 | 139 | if (!@ mysql_select_db($dbase, $this->conn)) { |
140 | - $modx->messageQuit("Failed to select the database '" . $dbase . "'!"); |
|
140 | + $modx->messageQuit("Failed to select the database '".$dbase."'!"); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | @mysql_query("{$connection_method} {$charset}", $this->conn); |
144 | 144 | $tend = $modx->getMicroTime(); |
145 | 145 | $totaltime = $tend - $tstart; |
146 | 146 | if ($modx->dumpSQL) { |
147 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s", |
|
148 | - $totaltime) . "</fieldset><br />"; |
|
147 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s", |
|
148 | + $totaltime)."</fieldset><br />"; |
|
149 | 149 | } |
150 | 150 | if (function_exists('mysql_set_charset')) { |
151 | 151 | mysql_set_charset($this->config['charset']); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | case 1091: |
226 | 226 | break; |
227 | 227 | default: |
228 | - $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql); |
|
228 | + $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql); |
|
229 | 229 | } |
230 | 230 | } else { |
231 | 231 | $tend = $modx->getMicroTime(); |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | $debug_path[] = $line['function']; |
240 | 240 | } |
241 | 241 | $debug_path = implode(' > ', array_reverse($debug_path)); |
242 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms", |
|
243 | - $totaltime * 1000) . "</legend>"; |
|
244 | - $modx->queryCode .= $sql . '<br><br>'; |
|
242 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms", |
|
243 | + $totaltime * 1000)."</legend>"; |
|
244 | + $modx->queryCode .= $sql.'<br><br>'; |
|
245 | 245 | if ($modx->event->name) { |
246 | - $modx->queryCode .= 'Current Event => ' . $modx->event->name . '<br>'; |
|
246 | + $modx->queryCode .= 'Current Event => '.$modx->event->name.'<br>'; |
|
247 | 247 | } |
248 | 248 | if ($modx->event->activePlugin) { |
249 | - $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>'; |
|
249 | + $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>'; |
|
250 | 250 | } |
251 | 251 | if ($modx->currentSnippet) { |
252 | - $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>'; |
|
252 | + $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>'; |
|
253 | 253 | } |
254 | 254 | if (stripos($sql, 'select') === 0) { |
255 | - $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>'; |
|
255 | + $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>'; |
|
256 | 256 | } else { |
257 | - $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>'; |
|
257 | + $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>'; |
|
258 | 258 | } |
259 | - $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>'; |
|
259 | + $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>'; |
|
260 | 260 | $modx->queryCode .= "</fieldset><br />"; |
261 | 261 | } |
262 | 262 | $modx->executedQueries = $modx->executedQueries + 1; |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | if (is_null($value) || strtolower($value) === 'null') { |
351 | 351 | $flds = 'NULL'; |
352 | 352 | } else { |
353 | - $flds = "'" . $value . "'"; |
|
353 | + $flds = "'".$value."'"; |
|
354 | 354 | } |
355 | - $fields[$key] = "`{$key}` = " . $flds; |
|
355 | + $fields[$key] = "`{$key}` = ".$flds; |
|
356 | 356 | } |
357 | 357 | $fields = implode(",", $fields); |
358 | 358 | } |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | $this->query("INSERT INTO {$intotable} {$fields}"); |
381 | 381 | } else { |
382 | 382 | if (empty($fromtable)) { |
383 | - $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '", |
|
384 | - array_values($fields)) . "')"; |
|
383 | + $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '", |
|
384 | + array_values($fields))."')"; |
|
385 | 385 | $rt = $this->query("INSERT INTO {$intotable} {$fields}"); |
386 | 386 | } else { |
387 | 387 | if (version_compare($this->getVersion(), "4.0.14") >= 0) { |
388 | 388 | $fromtable = $this->replaceFullTableName($fromtable); |
389 | - $fields = "(" . implode(",", array_keys($fields)) . ")"; |
|
389 | + $fields = "(".implode(",", array_keys($fields)).")"; |
|
390 | 390 | $where = trim($where); |
391 | 391 | $limit = trim($limit); |
392 | 392 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | } else { |
400 | 400 | $ds = $this->select($fromfields, $fromtable, $where, '', $limit); |
401 | 401 | while ($row = $this->getRow($ds)) { |
402 | - $fields = "(" . implode(",", array_keys($fields)) . ") VALUES('" . implode("', '", |
|
403 | - $row) . "')"; |
|
402 | + $fields = "(".implode(",", array_keys($fields)).") VALUES('".implode("', '", |
|
403 | + $row)."')"; |
|
404 | 404 | $rt = $this->query("INSERT INTO {$intotable} {$fields}"); |
405 | 405 | } |
406 | 406 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | public function getInsertId($conn = null) |
486 | 486 | { |
487 | 487 | if (!is_resource($conn)) { |
488 | - $conn =& $this->conn; |
|
488 | + $conn = & $this->conn; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | return mysql_insert_id($conn); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | public function getAffectedRows($conn = null) |
499 | 499 | { |
500 | 500 | if (!is_resource($conn)) { |
501 | - $conn =& $this->conn; |
|
501 | + $conn = & $this->conn; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | return mysql_affected_rows($conn); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | public function getLastError($conn = null) |
512 | 512 | { |
513 | 513 | if (!is_resource($conn)) { |
514 | - $conn =& $this->conn; |
|
514 | + $conn = & $this->conn; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | return mysql_error($conn); |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | $orderby = trim($orderby); |
281 | 281 | $limit = trim($limit); |
282 | 282 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
283 | - $where = "WHERE {$where}"; |
|
283 | + $where = "where {$where}"; |
|
284 | 284 | } |
285 | 285 | if ($orderby !== '' && stripos($orderby, 'ORDER BY') !== 0) { |
286 | 286 | $orderby = "ORDER BY {$orderby}"; |
287 | 287 | } |
288 | 288 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
289 | - $limit = "LIMIT {$limit}"; |
|
289 | + $limit = "limit {$limit}"; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return $this->query("DELETE FROM {$from} {$where} {$orderby} {$limit}"); |
@@ -322,16 +322,16 @@ discard block |
||
322 | 322 | $orderby = trim($orderby); |
323 | 323 | $limit = trim($limit); |
324 | 324 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
325 | - $where = "WHERE {$where}"; |
|
325 | + $where = "where {$where}"; |
|
326 | 326 | } |
327 | 327 | if ($orderby !== '' && stripos($orderby, 'ORDER') !== 0) { |
328 | 328 | $orderby = "ORDER BY {$orderby}"; |
329 | 329 | } |
330 | 330 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
331 | - $limit = "LIMIT {$limit}"; |
|
331 | + $limit = "limit {$limit}"; |
|
332 | 332 | } |
333 | 333 | |
334 | - return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderby} {$limit}"); |
|
334 | + return $this->query("select {$fields} FROM {$from} {$where} {$orderby} {$limit}"); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | } |
359 | 359 | $where = trim($where); |
360 | 360 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
361 | - $where = "WHERE {$where}"; |
|
361 | + $where = "where {$where}"; |
|
362 | 362 | } |
363 | 363 | |
364 | - return $this->query("UPDATE {$table} SET {$fields} {$where}"); |
|
364 | + return $this->query("update {$table} SET {$fields} {$where}"); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | $where = trim($where); |
391 | 391 | $limit = trim($limit); |
392 | 392 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
393 | - $where = "WHERE {$where}"; |
|
393 | + $where = "where {$where}"; |
|
394 | 394 | } |
395 | 395 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
396 | - $limit = "LIMIT {$limit}"; |
|
396 | + $limit = "limit {$limit}"; |
|
397 | 397 | } |
398 | 398 | $rt = $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}"); |
399 | 399 | } else { |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | |
733 | 733 | public function truncate($table_name) |
734 | 734 | { |
735 | - $rs = $this->query("TRUNCATE {$table_name}"); |
|
735 | + $rs = $this->query("truncate {$table_name}"); |
|
736 | 736 | |
737 | 737 | return $rs; |
738 | 738 | } |
@@ -268,6 +268,7 @@ discard block |
||
268 | 268 | /** |
269 | 269 | * @name: delete |
270 | 270 | * |
271 | + * @param string $from |
|
271 | 272 | */ |
272 | 273 | public function delete($from, $where = '', $orderby = '', $limit = '') |
273 | 274 | { |
@@ -414,6 +415,9 @@ discard block |
||
414 | 415 | } |
415 | 416 | } |
416 | 417 | |
418 | + /** |
|
419 | + * @param string $table |
|
420 | + */ |
|
417 | 421 | public function save($fields, $table, $where = '') |
418 | 422 | { |
419 | 423 | |
@@ -444,6 +448,7 @@ discard block |
||
444 | 448 | /** |
445 | 449 | * @name: freeResult |
446 | 450 | * |
451 | + * @param mysqli_result $rs |
|
447 | 452 | */ |
448 | 453 | public function freeResult($rs) |
449 | 454 | { |
@@ -554,6 +559,7 @@ discard block |
||
554 | 559 | * @name: getColumn |
555 | 560 | * @desc: returns an array of the values found on colun $name |
556 | 561 | * @param: $dsq - dataset or query string |
562 | + * @param string $name |
|
557 | 563 | */ |
558 | 564 | public function getColumn($name, $dsq) |
559 | 565 | { |
@@ -720,6 +726,9 @@ discard block |
||
720 | 726 | return $result; |
721 | 727 | } |
722 | 728 | |
729 | + /** |
|
730 | + * @param string $table_name |
|
731 | + */ |
|
723 | 732 | public function optimize($table_name) |
724 | 733 | { |
725 | 734 | $rs = $this->query("OPTIMIZE TABLE {$table_name}"); |
@@ -730,6 +739,9 @@ discard block |
||
730 | 739 | return $rs; |
731 | 740 | } |
732 | 741 | |
742 | + /** |
|
743 | + * @param string $table_name |
|
744 | + */ |
|
733 | 745 | public function truncate($table_name) |
734 | 746 | { |
735 | 747 | $rs = $this->query("TRUNCATE {$table_name}"); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -$lockElementId = (int)$lockElementId; |
|
6 | +$lockElementId = (int) $lockElementId; |
|
7 | 7 | |
8 | 8 | if ($lockElementId > 0) { |
9 | 9 | ?> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | var stay = document.getElementById('stay'); |
19 | 19 | // Trigger unlock |
20 | 20 | if ((stay && stay.value !== '2') || !form_save) { |
21 | - var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random(); |
|
21 | + var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random(); |
|
22 | 22 | if (navigator.sendBeacon) { |
23 | 23 | navigator.sendBeacon(url) |
24 | 24 | } else { |
@@ -3,12 +3,12 @@ discard block |
||
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('delete_plugin')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforePluginFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforePluginFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the plugin. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_plugins'), "id='{$id}'"); |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | // invoke OnPluginFormDelete event |
31 | 31 | $modx->invokeEvent("OnPluginFormDelete", |
32 | - array( |
|
33 | - "id" => $id |
|
34 | - )); |
|
32 | + array( |
|
33 | + "id" => $id |
|
34 | + )); |
|
35 | 35 | |
36 | 36 | // empty cache |
37 | 37 | $modx->clearCache('full'); |
@@ -1,13 +1,13 @@ 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('delete_plugin')) { |
|
5 | +if (!$modx->hasPermission('delete_plugin')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -37,5 +37,5 @@ discard block |
||
37 | 37 | $modx->clearCache('full'); |
38 | 38 | |
39 | 39 | // finished emptying cache - redirect |
40 | -$header="Location: index.php?a=76&r=2"; |
|
40 | +$header = "Location: index.php?a=76&r=2"; |
|
41 | 41 | header($header); |
@@ -3,12 +3,12 @@ discard block |
||
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('delete_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeChunkFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the chunk. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnChunkFormDelete event |
28 | 28 | $modx->invokeEvent("OnChunkFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -1,13 +1,13 @@ 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('delete_snippet')) { |
|
5 | +if (!$modx->hasPermission('delete_snippet')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -34,5 +34,5 @@ discard block |
||
34 | 34 | $modx->clearCache('full'); |
35 | 35 | |
36 | 36 | // finished emptying cache - redirect |
37 | -$header="Location: index.php?a=76&r=2"; |
|
37 | +$header = "Location: index.php?a=76&r=2"; |
|
38 | 38 | header($header); |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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('delete_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
10 | 10 | if($id == 0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->getRecordCount($rs); |
17 | 17 | if($limit > 0) { |
18 | - include "header.inc.php"; |
|
19 | - ?> |
|
18 | + include "header.inc.php"; |
|
19 | + ?> |
|
20 | 20 | |
21 | 21 | <h1><?php echo $_lang['manage_templates']; ?></h1> |
22 | 22 | |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->db->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | - } |
|
34 | - ?> |
|
31 | + while($row = $modx->db->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | + } |
|
34 | + ?> |
|
35 | 35 | </ul> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php |
39 | - include_once "footer.inc.php"; |
|
40 | - exit; |
|
39 | + include_once "footer.inc.php"; |
|
40 | + exit; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if($id == $default_template) { |
44 | - $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
44 | + $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set the item name for logger |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | // invoke OnBeforeTempFormDelete event |
52 | 52 | $modx->invokeEvent("OnBeforeTempFormDelete", array( |
53 | - "id" => $id |
|
54 | - )); |
|
53 | + "id" => $id |
|
54 | + )); |
|
55 | 55 | |
56 | 56 | // delete the document. |
57 | 57 | $modx->db->delete($modx->getFullTableName('site_templates'), "id='{$id}'"); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | // invoke OnTempFormDelete event |
62 | 62 | $modx->invokeEvent("OnTempFormDelete", array( |
63 | - "id" => $id |
|
64 | - )); |
|
63 | + "id" => $id |
|
64 | + )); |
|
65 | 65 | |
66 | 66 | // empty cache |
67 | 67 | $modx->clearCache('full'); |
@@ -1,20 +1,20 @@ 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('delete_template')) { |
|
5 | +if (!$modx->hasPermission('delete_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
10 | -if($id == 0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->getRecordCount($rs); |
17 | -if($limit > 0) { |
|
17 | +if ($limit > 0) { |
|
18 | 18 | include "header.inc.php"; |
19 | 19 | ?> |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->db->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
31 | + while ($row = $modx->db->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['introtext'] != '' ? ' - '.$row['introtext'] : '').'</li>'; |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </ul> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | |
43 | -if($id == $default_template) { |
|
43 | +if ($id == $default_template) { |
|
44 | 44 | $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
45 | 45 | } |
46 | 46 |
@@ -3,12 +3,12 @@ discard block |
||
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('delete_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeSnipFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeSnipFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the snippet. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_snippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnSnipFormDelete event |
28 | 28 | $modx->invokeEvent("OnSnipFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -1,13 +1,13 @@ 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('delete_snippet')) { |
|
5 | +if (!$modx->hasPermission('delete_snippet')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -34,5 +34,5 @@ discard block |
||
34 | 34 | $modx->clearCache('full'); |
35 | 35 | |
36 | 36 | // finished emptying cache - redirect |
37 | -$header="Location: index.php?a=76&r=2"; |
|
37 | +$header = "Location: index.php?a=76&r=2"; |
|
38 | 38 | header($header); |