@@ -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; |
@@ -4,71 +4,71 @@ |
||
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | 6 | class ContextMenu { |
| 7 | - public $id; |
|
| 7 | + public $id; |
|
| 8 | 8 | /** |
| 9 | 9 | * @var string |
| 10 | 10 | */ |
| 11 | - public $html = ''; |
|
| 11 | + public $html = ''; |
|
| 12 | 12 | /** |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $visible = false; |
|
| 15 | + public $visible = false; |
|
| 16 | 16 | /** |
| 17 | 17 | * @var int |
| 18 | 18 | */ |
| 19 | - public $width = 120; |
|
| 19 | + public $width = 120; |
|
| 20 | 20 | |
| 21 | 21 | public function __construct($id = '', $width = 120, $visible = false) { |
| 22 | - global $ContextMenuCnt; |
|
| 23 | - $ContextMenuCnt++; |
|
| 24 | - $this->html = ""; |
|
| 25 | - $this->visible = $visible ? $visible : false; |
|
| 26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 28 | - } |
|
| 22 | + global $ContextMenuCnt; |
|
| 23 | + $ContextMenuCnt++; |
|
| 24 | + $this->html = ""; |
|
| 25 | + $this->visible = $visible ? $visible : false; |
|
| 26 | + $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | + $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | public function addItem($text, $action = "", $img = "", $disabled = 0) { |
| 31 | - global $base_url, $_style; |
|
| 31 | + global $base_url, $_style; |
|
| 32 | 32 | if($disabled) { |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | - if(!$img) { |
|
| 36 | - $img = $base_url . $_style['tx']; |
|
| 37 | - } |
|
| 38 | - if(substr($action, 0, 3) == "js:") { |
|
| 39 | - $action = substr($action, 3); |
|
| 40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 42 | - } else { |
|
| 43 | - $action = "window.location.href='" . $action . "'"; |
|
| 44 | - } |
|
| 45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 35 | + if(!$img) { |
|
| 36 | + $img = $base_url . $_style['tx']; |
|
| 37 | + } |
|
| 38 | + if(substr($action, 0, 3) == "js:") { |
|
| 39 | + $action = substr($action, 3); |
|
| 40 | + } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | + $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 42 | + } else { |
|
| 43 | + $action = "window.location.href='" . $action . "'"; |
|
| 44 | + } |
|
| 45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | + $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 47 | 47 | if(substr($img, 0, 5) == 'fa fa') { |
| 48 | 48 | $img = '<i class="' . $img . '"></i>'; |
| 49 | 49 | } else if(substr($img, 0, 1) != '<') { |
| 50 | 50 | $img = '<img src="' . $img . '" />'; |
| 51 | 51 | } |
| 52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
| 53 | - } |
|
| 52 | + $this->html .= $img . ' ' . $text . '</div>'; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | public function addSeparator() { |
| 56 | - $this->html .= " |
|
| 56 | + $this->html .= " |
|
| 57 | 57 | <div class='cntxMnuSeparator'></div> |
| 58 | 58 | "; |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | public function render() { |
| 62 | - global $ContextMenuScript; |
|
| 62 | + global $ContextMenuScript; |
|
| 63 | 63 | |
| 64 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 65 | - $ContextMenuScript = ""; // reset css |
|
| 66 | - return $html; |
|
| 67 | - } |
|
| 64 | + $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 65 | + $ContextMenuScript = ""; // reset css |
|
| 66 | + return $html; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | public function getClientScriptObject() { |
| 70 | - return "getCntxMenu('" . $this->id . "')"; |
|
| 71 | - } |
|
| 70 | + return "getCntxMenu('" . $this->id . "')"; |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $ContextMenuScript = <<<BLOCK |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | global $ContextMenuCnt; |
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | -class ContextMenu { |
|
| 6 | +class ContextMenu{ |
|
| 7 | 7 | public $id; |
| 8 | 8 | /** |
| 9 | 9 | * @var string |
@@ -18,56 +18,56 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public $width = 120; |
| 20 | 20 | |
| 21 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
| 21 | + public function __construct($id = '', $width = 120, $visible = false){ |
|
| 22 | 22 | global $ContextMenuCnt; |
| 23 | 23 | $ContextMenuCnt++; |
| 24 | 24 | $this->html = ""; |
| 25 | 25 | $this->visible = $visible ? $visible : false; |
| 26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 26 | + $this->width = is_numeric($width) ? (int) $width : 120; |
|
| 27 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 30 | + public function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
| 31 | 31 | global $base_url, $_style; |
| 32 | - if($disabled) { |
|
| 32 | + if ($disabled) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | - if(!$img) { |
|
| 36 | - $img = $base_url . $_style['tx']; |
|
| 35 | + if (!$img) { |
|
| 36 | + $img = $base_url.$_style['tx']; |
|
| 37 | 37 | } |
| 38 | - if(substr($action, 0, 3) == "js:") { |
|
| 38 | + if (substr($action, 0, 3) == "js:") { |
|
| 39 | 39 | $action = substr($action, 3); |
| 40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 40 | + } else if (substr($action, 0, 3) == "hl:") { |
|
| 41 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
| 42 | 42 | } else { |
| 43 | - $action = "window.location.href='" . $action . "'"; |
|
| 43 | + $action = "window.location.href='".$action."'"; |
|
| 44 | 44 | } |
| 45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 47 | - if(substr($img, 0, 5) == 'fa fa') { |
|
| 48 | - $img = '<i class="' . $img . '"></i>'; |
|
| 49 | - } else if(substr($img, 0, 1) != '<') { |
|
| 50 | - $img = '<img src="' . $img . '" />'; |
|
| 45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
| 46 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
| 47 | + if (substr($img, 0, 5) == 'fa fa') { |
|
| 48 | + $img = '<i class="'.$img.'"></i>'; |
|
| 49 | + } else if (substr($img, 0, 1) != '<') { |
|
| 50 | + $img = '<img src="'.$img.'" />'; |
|
| 51 | 51 | } |
| 52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
| 52 | + $this->html .= $img.' '.$text.'</div>'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addSeparator() { |
|
| 55 | + public function addSeparator(){ |
|
| 56 | 56 | $this->html .= " |
| 57 | 57 | <div class='cntxMnuSeparator'></div> |
| 58 | 58 | "; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function render() { |
|
| 61 | + public function render(){ |
|
| 62 | 62 | global $ContextMenuScript; |
| 63 | 63 | |
| 64 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 64 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
| 65 | 65 | $ContextMenuScript = ""; // reset css |
| 66 | 66 | return $html; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function getClientScriptObject() { |
|
| 70 | - return "getCntxMenu('" . $this->id . "')"; |
|
| 69 | + public function getClientScriptObject(){ |
|
| 70 | + return "getCntxMenu('".$this->id."')"; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -3,7 +3,8 @@ discard block |
||
| 3 | 3 | global $ContextMenuCnt; |
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | -class ContextMenu { |
|
| 6 | +class ContextMenu |
|
| 7 | +{ |
|
| 7 | 8 | public $id; |
| 8 | 9 | /** |
| 9 | 10 | * @var string |
@@ -18,7 +19,8 @@ discard block |
||
| 18 | 19 | */ |
| 19 | 20 | public $width = 120; |
| 20 | 21 | |
| 21 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
| 22 | + public function __construct($id = '', $width = 120, $visible = false) |
|
| 23 | + { |
|
| 22 | 24 | global $ContextMenuCnt; |
| 23 | 25 | $ContextMenuCnt++; |
| 24 | 26 | $this->html = ""; |
@@ -27,7 +29,8 @@ discard block |
||
| 27 | 29 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 32 | + public function addItem($text, $action = "", $img = "", $disabled = 0) |
|
| 33 | + { |
|
| 31 | 34 | global $base_url, $_style; |
| 32 | 35 | if($disabled) { |
| 33 | 36 | return; |
@@ -52,13 +55,15 @@ discard block |
||
| 52 | 55 | $this->html .= $img . ' ' . $text . '</div>'; |
| 53 | 56 | } |
| 54 | 57 | |
| 55 | - public function addSeparator() { |
|
| 58 | + public function addSeparator() |
|
| 59 | + { |
|
| 56 | 60 | $this->html .= " |
| 57 | 61 | <div class='cntxMnuSeparator'></div> |
| 58 | 62 | "; |
| 59 | 63 | } |
| 60 | 64 | |
| 61 | - public function render() { |
|
| 65 | + public function render() |
|
| 66 | + { |
|
| 62 | 67 | global $ContextMenuScript; |
| 63 | 68 | |
| 64 | 69 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -66,7 +71,8 @@ discard block |
||
| 66 | 71 | return $html; |
| 67 | 72 | } |
| 68 | 73 | |
| 69 | - public function getClientScriptObject() { |
|
| 74 | + public function getClientScriptObject() |
|
| 75 | + { |
|
| 70 | 76 | return "getCntxMenu('" . $this->id . "')"; |
| 71 | 77 | } |
| 72 | 78 | } |
@@ -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,12 +1,12 @@ 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('save_snippet')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $snippet = trim($_POST['post']); |
| 11 | 11 | $name = $modx->db->escape(trim($_POST['name'])); |
| 12 | 12 | $description = $modx->db->escape($_POST['description']); |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | //Kyle Jaebker - added category support |
| 35 | 35 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 36 | - $categoryid = (int)$_POST['categoryid']; |
|
| 36 | + $categoryid = (int) $_POST['categoryid']; |
|
| 37 | 37 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 38 | 38 | $categoryid = 0; |
| 39 | 39 | } else { |
| 40 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 40 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 41 | 41 | $categoryid = checkCategory($_POST['newcategory']); |
| 42 | 42 | if (!$categoryid) { |
| 43 | 43 | $categoryid = newCategory($_POST['newcategory']); |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
| 56 | 56 | |
| 57 | 57 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 58 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 58 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 59 | 59 | if ($version) { |
| 60 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 60 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 61 | 61 | } |
| 62 | 62 | if (isset($parsed['modx_category'])) { |
| 63 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 63 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 64 | 64 | $categoryid = getCategory($parsed['modx_category']); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // finished emptying cache - redirect |
| 112 | 112 | if ($_POST['stay'] != '') { |
| 113 | 113 | $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
| 114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 115 | 115 | header($header); |
| 116 | 116 | } else { |
| 117 | 117 | $header = "Location: index.php?a=76&r=2"; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | // finished emptying cache - redirect |
| 164 | 164 | if ($_POST['stay'] != '') { |
| 165 | 165 | $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
| 166 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 166 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 167 | 167 | header($header); |
| 168 | 168 | } else { |
| 169 | 169 | $modx->unlockElement(4, $id); |
@@ -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 | |