@@ -1,27 +1,27 @@ 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_template')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $template = $modx->db->escape($_POST['post']); |
| 11 | 11 | $templatename = $modx->db->escape(trim($_POST['templatename'])); |
| 12 | 12 | $description = $modx->db->escape($_POST['description']); |
| 13 | 13 | $locked = $_POST['locked'] == 'on' ? 1 : 0; |
| 14 | -$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable |
|
| 14 | +$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable |
|
| 15 | 15 | $_POST['selectable'] == 'on' ? 1 : 0; |
| 16 | 16 | $currentdate = time() + $modx->config['server_offset_time']; |
| 17 | 17 | |
| 18 | 18 | //Kyle Jaebker - added category support |
| 19 | 19 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 20 | - $categoryid = (int)$_POST['categoryid']; |
|
| 20 | + $categoryid = (int) $_POST['categoryid']; |
|
| 21 | 21 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 22 | 22 | $categoryid = 0; |
| 23 | 23 | } else { |
| 24 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 24 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 25 | 25 | $categoryid = checkCategory($_POST['newcategory']); |
| 26 | 26 | if (!$categoryid) { |
| 27 | 27 | $categoryid = newCategory($_POST['newcategory']); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // finished emptying cache - redirect |
| 79 | 79 | if ($_POST['stay'] != '') { |
| 80 | 80 | $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
| 81 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 81 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 82 | 82 | header($header); |
| 83 | 83 | } else { |
| 84 | 84 | $header = "Location: index.php?a=76&r=2"; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | // finished emptying cache - redirect |
| 131 | 131 | if ($_POST['stay'] != '') { |
| 132 | 132 | $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
| 133 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 133 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 134 | 134 | header($header); |
| 135 | 135 | } else { |
| 136 | 136 | $modx->unlockElement(1, $id); |
@@ -1,18 +1,18 @@ 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_user')) { |
|
| 5 | +if (!$modx->hasPermission('delete_user')) { |
|
| 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 user, but first check if we are deleting our own record |
| 15 | -if($id==$modx->getLoginUserID()) { |
|
| 15 | +if ($id == $modx->getLoginUserID()) { |
|
| 16 | 16 | $modx->webAlertAndQuit("You can't delete yourself!"); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -50,5 +50,5 @@ discard block |
||
| 50 | 50 | "id" => $id |
| 51 | 51 | )); |
| 52 | 52 | |
| 53 | -$header="Location: index.php?a=75"; |
|
| 53 | +$header = "Location: index.php?a=75"; |
|
| 54 | 54 | 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_module')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
| 11 | 11 | $description = $modx->db->escape($_POST['description']); |
| 12 | 12 | $resourcefile = $modx->db->escape($_POST['resourcefile']); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | //Kyle Jaebker - added category support |
| 27 | 27 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 28 | - $categoryid = (int)$_POST['categoryid']; |
|
| 28 | + $categoryid = (int) $_POST['categoryid']; |
|
| 29 | 29 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 30 | 30 | $categoryid = 0; |
| 31 | 31 | } else { |
| 32 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 32 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 33 | 33 | $categoryid = checkCategory($_POST['newcategory']); |
| 34 | 34 | if (!$categoryid) { |
| 35 | 35 | $categoryid = newCategory($_POST['newcategory']); |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $name = isset($parsed['name']) ? $parsed['name'] : $name; |
| 46 | 46 | $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties; |
| 47 | 47 | $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid; |
| 48 | - $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams; |
|
| 48 | + $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams; |
|
| 49 | 49 | |
| 50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 52 | 52 | if ($version) { |
| 53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 54 | 54 | } |
| 55 | 55 | if (isset($parsed['modx_category'])) { |
| 56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // finished emptying cache - redirect |
| 112 | 112 | if ($_POST['stay'] != '') { |
| 113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
| 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=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // finished emptying cache - redirect |
| 169 | 169 | if ($_POST['stay'] != '') { |
| 170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
| 171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 172 | 172 | header($header); |
| 173 | 173 | } else { |
| 174 | 174 | $modx->unlockElement(6, $id); |
@@ -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('new_snippet')) { |
|
| 5 | +if (!$modx->hasPermission('new_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 | |
| 14 | 14 | // count duplicates |
| 15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
| 16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 17 | -if($count>=1) $count = ' '.($count+1); |
|
| 17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 18 | 18 | else $count = ''; |
| 19 | 19 | |
| 20 | 20 | // duplicate Snippet |
@@ -33,5 +33,5 @@ discard block |
||
| 33 | 33 | $_SESSION['itemname'] = $name; |
| 34 | 34 | |
| 35 | 35 | // finish duplicating - redirect to new snippet |
| 36 | -$header="Location: index.php?r=2&a=22&id=$newid"; |
|
| 36 | +$header = "Location: index.php?r=2&a=22&id=$newid"; |
|
| 37 | 37 | header($header); |
@@ -1,38 +1,38 @@ 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('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | // check permissions on the document |
| 29 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 29 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 30 | 30 | $udperms = new udperms(); |
| 31 | 31 | $udperms->user = $modx->getLoginUserID(); |
| 32 | 32 | $udperms->document = $id; |
| 33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
| 34 | 34 | |
| 35 | -if(!$udperms->checkPermissions()) { |
|
| 35 | +if (!$udperms->checkPermissions()) { |
|
| 36 | 36 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
| 50 | 50 | |
| 51 | 51 | // invoke OnDocUnPublished event |
| 52 | -$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
|
| 52 | +$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id)); |
|
| 53 | 53 | |
| 54 | 54 | // Set the item name for logger |
| 55 | 55 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -57,6 +57,6 @@ discard block |
||
| 57 | 57 | // empty cache |
| 58 | 58 | $modx->clearCache('full'); |
| 59 | 59 | |
| 60 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 60 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 61 | 61 | |
| 62 | 62 | header($header); |
@@ -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_module')) { |
|
| 5 | +if (!$modx->hasPermission('delete_module')) { |
|
| 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 | |
@@ -40,5 +40,5 @@ discard block |
||
| 40 | 40 | $modx->clearCache('full'); |
| 41 | 41 | |
| 42 | 42 | // finished emptying cache - redirect |
| 43 | -$header="Location: index.php?a=106&r=2"; |
|
| 43 | +$header = "Location: index.php?a=106&r=2"; |
|
| 44 | 44 | header($header); |
@@ -1,33 +1,32 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | //:: EVO Installer Setup file |
| 3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
| 4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
| 5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
| 4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
| 5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
| 6 | 6 | } |
| 7 | -if(!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
| 7 | +if (!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
| 8 | 8 | |
| 9 | 9 | require_once('../'.MGR_DIR.'/includes/version.inc.php'); |
| 10 | 10 | |
| 11 | -$chunkPath = $base_path .'install/assets/chunks'; |
|
| 12 | -$snippetPath = $base_path .'install/assets/snippets'; |
|
| 13 | -$pluginPath = $base_path .'install/assets/plugins'; |
|
| 14 | -$modulePath = $base_path .'install/assets/modules'; |
|
| 15 | -$templatePath = $base_path .'install/assets/templates'; |
|
| 16 | -$tvPath = $base_path .'install/assets/tvs'; |
|
| 11 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
| 12 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
| 13 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
| 14 | +$modulePath = $base_path.'install/assets/modules'; |
|
| 15 | +$templatePath = $base_path.'install/assets/templates'; |
|
| 16 | +$tvPath = $base_path.'install/assets/tvs'; |
|
| 17 | 17 | |
| 18 | 18 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
| 19 | 19 | $mt = &$moduleTemplates; |
| 20 | -if(is_dir($templatePath) && is_readable($templatePath)) { |
|
| 20 | +if (is_dir($templatePath) && is_readable($templatePath)) { |
|
| 21 | 21 | $d = dir($templatePath); |
| 22 | 22 | while (false !== ($tplfile = $d->read())) |
| 23 | 23 | { |
| 24 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
| 24 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
| 25 | 25 | $params = parse_docblock($templatePath, $tplfile); |
| 26 | - if(is_array($params) && (count($params)>0)) |
|
| 26 | + if (is_array($params) && (count($params) > 0)) |
|
| 27 | 27 | { |
| 28 | 28 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 29 | - $mt[] = array |
|
| 30 | - ( |
|
| 29 | + $mt[] = array( |
|
| 31 | 30 | $params['name'], |
| 32 | 31 | $description, |
| 33 | 32 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -45,12 +44,12 @@ discard block |
||
| 45 | 44 | |
| 46 | 45 | // setup Template Variable template files |
| 47 | 46 | $mtv = &$moduleTVs; |
| 48 | -if(is_dir($tvPath) && is_readable($tvPath)) { |
|
| 47 | +if (is_dir($tvPath) && is_readable($tvPath)) { |
|
| 49 | 48 | $d = dir($tvPath); |
| 50 | 49 | while (false !== ($tplfile = $d->read())) { |
| 51 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
| 50 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
| 52 | 51 | $params = parse_docblock($tvPath, $tplfile); |
| 53 | - if(is_array($params) && (count($params)>0)) { |
|
| 52 | + if (is_array($params) && (count($params) > 0)) { |
|
| 54 | 53 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 55 | 54 | $mtv[] = array( |
| 56 | 55 | $params['name'], |
@@ -62,9 +61,9 @@ discard block |
||
| 62 | 61 | $params['output_widget'], |
| 63 | 62 | $params['output_widget_params'], |
| 64 | 63 | "$templatePath/{$params['filename']}", /* not currently used */ |
| 65 | - $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */ |
|
| 64 | + $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */ |
|
| 66 | 65 | $params['modx_category'], |
| 67 | - $params['lock_tv'], /* value should be 1 or 0 */ |
|
| 66 | + $params['lock_tv'], /* value should be 1 or 0 */ |
|
| 68 | 67 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
| 69 | 68 | ); |
| 70 | 69 | } |
@@ -74,14 +73,14 @@ discard block |
||
| 74 | 73 | |
| 75 | 74 | // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content |
| 76 | 75 | $mc = &$moduleChunks; |
| 77 | -if(is_dir($chunkPath) && is_readable($chunkPath)) { |
|
| 76 | +if (is_dir($chunkPath) && is_readable($chunkPath)) { |
|
| 78 | 77 | $d = dir($chunkPath); |
| 79 | 78 | while (false !== ($tplfile = $d->read())) { |
| 80 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 79 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 81 | 80 | continue; |
| 82 | 81 | } |
| 83 | 82 | $params = parse_docblock($chunkPath, $tplfile); |
| 84 | - if(is_array($params) && count($params) > 0) { |
|
| 83 | + if (is_array($params) && count($params) > 0) { |
|
| 85 | 84 | $mc[] = array( |
| 86 | 85 | $params['name'], |
| 87 | 86 | $params['description'], |
@@ -97,14 +96,14 @@ discard block |
||
| 97 | 96 | |
| 98 | 97 | // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties |
| 99 | 98 | $ms = &$moduleSnippets; |
| 100 | -if(is_dir($snippetPath) && is_readable($snippetPath)) { |
|
| 99 | +if (is_dir($snippetPath) && is_readable($snippetPath)) { |
|
| 101 | 100 | $d = dir($snippetPath); |
| 102 | 101 | while (false !== ($tplfile = $d->read())) { |
| 103 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 102 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 104 | 103 | continue; |
| 105 | 104 | } |
| 106 | 105 | $params = parse_docblock($snippetPath, $tplfile); |
| 107 | - if(is_array($params) && count($params) > 0) { |
|
| 106 | + if (is_array($params) && count($params) > 0) { |
|
| 108 | 107 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 109 | 108 | $ms[] = array( |
| 110 | 109 | $params['name'], |
@@ -121,14 +120,14 @@ discard block |
||
| 121 | 120 | |
| 122 | 121 | // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties |
| 123 | 122 | $mp = &$modulePlugins; |
| 124 | -if(is_dir($pluginPath) && is_readable($pluginPath)) { |
|
| 123 | +if (is_dir($pluginPath) && is_readable($pluginPath)) { |
|
| 125 | 124 | $d = dir($pluginPath); |
| 126 | 125 | while (false !== ($tplfile = $d->read())) { |
| 127 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 126 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 128 | 127 | continue; |
| 129 | 128 | } |
| 130 | 129 | $params = parse_docblock($pluginPath, $tplfile); |
| 131 | - if(is_array($params) && count($params) > 0) { |
|
| 130 | + if (is_array($params) && count($params) > 0) { |
|
| 132 | 131 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 133 | 132 | $mp[] = array( |
| 134 | 133 | $params['name'], |
@@ -140,7 +139,7 @@ discard block |
||
| 140 | 139 | $params['modx_category'], |
| 141 | 140 | $params['legacy_names'], |
| 142 | 141 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
| 143 | - (int)$params['disabled'] |
|
| 142 | + (int) $params['disabled'] |
|
| 144 | 143 | ); |
| 145 | 144 | } |
| 146 | 145 | } |
@@ -150,14 +149,14 @@ discard block |
||
| 150 | 149 | // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams |
| 151 | 150 | $mm = &$moduleModules; |
| 152 | 151 | $mdp = &$moduleDependencies; |
| 153 | -if(is_dir($modulePath) && is_readable($modulePath)) { |
|
| 152 | +if (is_dir($modulePath) && is_readable($modulePath)) { |
|
| 154 | 153 | $d = dir($modulePath); |
| 155 | 154 | while (false !== ($tplfile = $d->read())) { |
| 156 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 155 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 157 | 156 | continue; |
| 158 | 157 | } |
| 159 | 158 | $params = parse_docblock($modulePath, $tplfile); |
| 160 | - if(is_array($params) && count($params) > 0) { |
|
| 159 | + if (is_array($params) && count($params) > 0) { |
|
| 161 | 160 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 162 | 161 | $mm[] = array( |
| 163 | 162 | $params['name'], |
@@ -165,12 +164,12 @@ discard block |
||
| 165 | 164 | "$modulePath/{$params['filename']}", |
| 166 | 165 | $params['properties'], |
| 167 | 166 | $params['guid'], |
| 168 | - (int)$params['shareparams'], |
|
| 167 | + (int) $params['shareparams'], |
|
| 169 | 168 | $params['modx_category'], |
| 170 | 169 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
| 171 | 170 | ); |
| 172 | 171 | } |
| 173 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
| 172 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
| 174 | 173 | $dependencies = explode(',', $params['dependencies']); |
| 175 | 174 | foreach ($dependencies as $dependency) { |
| 176 | 175 | $dependency = explode(':', $dependency); |
@@ -241,103 +240,103 @@ discard block |
||
| 241 | 240 | // setup callback function |
| 242 | 241 | $callBackFnc = "clean_up"; |
| 243 | 242 | |
| 244 | -function clean_up($sqlParser) { |
|
| 243 | +function clean_up($sqlParser){ |
|
| 245 | 244 | $ids = array(); |
| 246 | 245 | |
| 247 | 246 | // secure web documents - privateweb |
| 248 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
| 249 | - $sql = "SELECT DISTINCT sc.id |
|
| 247 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
| 248 | + $sql = "SELECT DISTINCT sc.id |
|
| 250 | 249 | FROM `".$sqlParser->prefix."site_content` sc |
| 251 | 250 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
| 252 | 251 | LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
| 253 | 252 | WHERE wga.id>0"; |
| 254 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
| 255 | - if(!$ds) { |
|
| 253 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
| 254 | + if (!$ds) { |
|
| 256 | 255 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
| 257 | 256 | } |
| 258 | 257 | else { |
| 259 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
| 260 | - if(count($ids)>0) { |
|
| 261 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
| 258 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
| 259 | + if (count($ids) > 0) { |
|
| 260 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
| 262 | 261 | unset($ids); |
| 263 | 262 | } |
| 264 | 263 | } |
| 265 | 264 | |
| 266 | 265 | // secure manager documents privatemgr |
| 267 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
| 268 | - $sql = "SELECT DISTINCT sc.id |
|
| 266 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
| 267 | + $sql = "SELECT DISTINCT sc.id |
|
| 269 | 268 | FROM `".$sqlParser->prefix."site_content` sc |
| 270 | 269 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
| 271 | 270 | LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
| 272 | 271 | WHERE mga.id>0"; |
| 273 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
| 274 | - if(!$ds) { |
|
| 272 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
| 273 | + if (!$ds) { |
|
| 275 | 274 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
| 276 | 275 | } |
| 277 | 276 | else { |
| 278 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
| 279 | - if(count($ids)>0) { |
|
| 280 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
| 277 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
| 278 | + if (count($ids) > 0) { |
|
| 279 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
| 281 | 280 | unset($ids); |
| 282 | 281 | } |
| 283 | 282 | } |
| 284 | 283 | } |
| 285 | 284 | |
| 286 | -function parse_docblock($element_dir, $filename) { |
|
| 285 | +function parse_docblock($element_dir, $filename){ |
|
| 287 | 286 | $params = array(); |
| 288 | - $fullpath = $element_dir . '/' . $filename; |
|
| 289 | - if(is_readable($fullpath)) { |
|
| 287 | + $fullpath = $element_dir.'/'.$filename; |
|
| 288 | + if (is_readable($fullpath)) { |
|
| 290 | 289 | $tpl = @fopen($fullpath, "r"); |
| 291 | - if($tpl) { |
|
| 290 | + if ($tpl) { |
|
| 292 | 291 | $params['filename'] = $filename; |
| 293 | 292 | $docblock_start_found = false; |
| 294 | 293 | $name_found = false; |
| 295 | 294 | $description_found = false; |
| 296 | 295 | |
| 297 | - while(!feof($tpl)) { |
|
| 296 | + while (!feof($tpl)) { |
|
| 298 | 297 | $line = fgets($tpl); |
| 299 | - if(!$docblock_start_found) { |
|
| 298 | + if (!$docblock_start_found) { |
|
| 300 | 299 | // find docblock start |
| 301 | - if(strpos($line, '/**') !== false) { |
|
| 300 | + if (strpos($line, '/**') !== false) { |
|
| 302 | 301 | $docblock_start_found = true; |
| 303 | 302 | } |
| 304 | 303 | continue; |
| 305 | - } elseif(!$name_found) { |
|
| 304 | + } elseif (!$name_found) { |
|
| 306 | 305 | // find name |
| 307 | 306 | $ma = null; |
| 308 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 307 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 309 | 308 | $params['name'] = trim($ma[1]); |
| 310 | 309 | $name_found = !empty($params['name']); |
| 311 | 310 | } |
| 312 | 311 | continue; |
| 313 | - } elseif(!$description_found) { |
|
| 312 | + } elseif (!$description_found) { |
|
| 314 | 313 | // find description |
| 315 | 314 | $ma = null; |
| 316 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 315 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 317 | 316 | $params['description'] = trim($ma[1]); |
| 318 | 317 | $description_found = !empty($params['description']); |
| 319 | 318 | } |
| 320 | 319 | continue; |
| 321 | 320 | } else { |
| 322 | 321 | $ma = null; |
| 323 | - if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
| 322 | + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
| 324 | 323 | $param = trim($ma[1]); |
| 325 | 324 | $val = trim($ma[2]); |
| 326 | - if(!empty($param) && !empty($val)) { |
|
| 327 | - if($param == 'internal') { |
|
| 325 | + if (!empty($param) && !empty($val)) { |
|
| 326 | + if ($param == 'internal') { |
|
| 328 | 327 | $ma = null; |
| 329 | - if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
| 328 | + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
| 330 | 329 | $param = trim($ma[1]); |
| 331 | 330 | $val = trim($ma[2]); |
| 332 | 331 | } |
| 333 | 332 | //if($val !== '0' && (empty($param) || empty($val))) { |
| 334 | - if(empty($param)) { |
|
| 333 | + if (empty($param)) { |
|
| 335 | 334 | continue; |
| 336 | 335 | } |
| 337 | 336 | } |
| 338 | 337 | $params[$param] = $val; |
| 339 | 338 | } |
| 340 | - } elseif(preg_match("/^\s*\*\/\s*$/", $line)) { |
|
| 339 | + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { |
|
| 341 | 340 | break; |
| 342 | 341 | } |
| 343 | 342 | } |
@@ -1,17 +1,17 @@ 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('edit_template') && $modx->manager->action == '301') { |
|
| 5 | +if (!$modx->hasPermission('edit_template') && $modx->manager->action == '301') { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | -if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
|
| 8 | +if (!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 13 | -$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
|
| 14 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : NULL; |
|
| 12 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 13 | +$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76; |
|
| 14 | +$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : NULL; |
|
| 15 | 15 | |
| 16 | 16 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 17 | 17 | $tbl_site_templates = $modx->getFullTableName('site_templates'); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $tbl_documentgroup_names = $modx->getFullTableName('documentgroup_names'); |
| 20 | 20 | |
| 21 | 21 | // check to see the snippet editor isn't locked |
| 22 | -if($lockedEl = $modx->elementIsLocked(2, $id)) { |
|
| 22 | +if ($lockedEl = $modx->elementIsLocked(2, $id)) { |
|
| 23 | 23 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
| 24 | 24 | } |
| 25 | 25 | // end check for lock |
@@ -29,25 +29,25 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | global $content; |
| 31 | 31 | $content = array(); |
| 32 | -if(isset($_GET['id'])) { |
|
| 32 | +if (isset($_GET['id'])) { |
|
| 33 | 33 | $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
| 34 | 34 | $content = $modx->db->getRow($rs); |
| 35 | - if(!$content) { |
|
| 36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
| 35 | + if (!$content) { |
|
| 36 | + header("Location: ".MODX_SITE_URL."index.php?id={$site_start}"); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $_SESSION['itemname'] = $content['caption']; |
| 40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
| 40 | + if ($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
| 41 | 41 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 42 | 42 | } |
| 43 | -} else if(isset($_REQUEST['itemname'])) { |
|
| 43 | +} else if (isset($_REQUEST['itemname'])) { |
|
| 44 | 44 | $content['name'] = $_REQUEST['itemname']; |
| 45 | 45 | } else { |
| 46 | 46 | $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
| 47 | - $content['category'] = (int)$_REQUEST['catid']; |
|
| 47 | + $content['category'] = (int) $_REQUEST['catid']; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if($modx->manager->hasFormValues()) { |
|
| 50 | +if ($modx->manager->hasFormValues()) { |
|
| 51 | 51 | $modx->manager->loadFormValues(); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | // Add lock-element JS-Script |
| 57 | 57 | $lockElementId = $id; |
| 58 | 58 | $lockElementType = 2; |
| 59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
| 59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
| 60 | 60 | |
| 61 | 61 | // get available RichText Editors |
| 62 | 62 | $RTEditors = ''; |
| 63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
| 64 | -if(is_array($evtOut)) { |
|
| 64 | +if (is_array($evtOut)) { |
|
| 65 | 65 | $RTEditors = implode(',', $evtOut); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | }, |
| 108 | 108 | cancel: function() { |
| 109 | 109 | documentDirty = false; |
| 110 | - document.location.href = 'index.php?a=<?= $origin ?><?=(empty($originId) ? '' : '&id=' . $originId) ?>'; |
|
| 110 | + document.location.href = 'index.php?a=<?= $origin ?><?=(empty($originId) ? '' : '&id='.$originId) ?>'; |
|
| 111 | 111 | } |
| 112 | 112 | }; |
| 113 | 113 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | <?php |
| 280 | 280 | // invoke OnTVFormPrerender event |
| 281 | 281 | $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
| 282 | - if(is_array($evtOut)) { |
|
| 282 | + if (is_array($evtOut)) { |
|
| 283 | 283 | echo implode("", $evtOut); |
| 284 | 284 | } |
| 285 | 285 | ?> |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | <input type="hidden" name="params" value="<?= $modx->htmlspecialchars($content['display_params']) ?>"> |
| 292 | 292 | |
| 293 | 293 | <h1> |
| 294 | - <i class="fa fa-list-alt"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_tmplvars']) ?><i class="fa fa-question-circle help"></i> |
|
| 294 | + <i class="fa fa-list-alt"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_tmplvars']) ?><i class="fa fa-question-circle help"></i> |
|
| 295 | 295 | </h1> |
| 296 | 296 | |
| 297 | 297 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | <div class="col-md-9 col-lg-10"> |
| 315 | 315 | <div class="form-control-name clearfix"> |
| 316 | 316 | <input name="name" type="text" maxlength="50" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
| 317 | - <?php if($modx->hasPermission('save_role')): ?> |
|
| 318 | - <label class="custom-control" title="<?= $_lang['lock_tmplvars'] . "\n" . $_lang['lock_tmplvars_msg'] ?>" tooltip> |
|
| 317 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
| 318 | + <label class="custom-control" title="<?= $_lang['lock_tmplvars']."\n".$_lang['lock_tmplvars_msg'] ?>" tooltip> |
|
| 319 | 319 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
| 320 | 320 | <i class="fa fa-lock"></i> |
| 321 | 321 | </label> |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
| 344 | 344 | <option> </option> |
| 345 | 345 | <?php |
| 346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 347 | - foreach(getCategories() as $n => $v) { |
|
| 348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 346 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 347 | + foreach (getCategories() as $n => $v) { |
|
| 348 | + echo "<option value='".$v['id']."'".($content["category"] == $v["id"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($v["category"])."</option>"; |
|
| 349 | 349 | } |
| 350 | 350 | ?> |
| 351 | 351 | </select> |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | <optgroup label="Custom Type"> |
| 384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
| 385 | 385 | <?php |
| 386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
| 387 | - foreach($custom_tvs as $ctv) { |
|
| 388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
| 389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
| 390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
| 386 | + $custom_tvs = scandir(MODX_BASE_PATH.'assets/tvs'); |
|
| 387 | + foreach ($custom_tvs as $ctv) { |
|
| 388 | + if (strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
| 389 | + $selected = ($content['type'] == 'custom_tv:'.$ctv ? "selected='selected'" : ""); |
|
| 390 | + echo '<option value="custom_tv:'.$ctv.'" '.$selected.'>'.$ctv.'</option>'; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | ?> |
@@ -462,36 +462,36 @@ discard block |
||
| 462 | 462 | $tplList = '<ul>'; |
| 463 | 463 | $preCat = ''; |
| 464 | 464 | $insideUl = 0; |
| 465 | - while($row = $modx->db->getRow($rs)) { |
|
| 465 | + while ($row = $modx->db->getRow($rs)) { |
|
| 466 | 466 | $row['category'] = stripslashes($row['category']); //pixelchutes |
| 467 | - if($preCat !== $row['category']) { |
|
| 467 | + if ($preCat !== $row['category']) { |
|
| 468 | 468 | $tplList .= $insideUl ? '</ul>' : ''; |
| 469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 469 | + $tplList .= '<li><strong>'.$row['category'].($row['catid'] != '' ? ' <small>('.$row['catid'].')</small>' : '').'</strong><ul>'; |
|
| 470 | 470 | $insideUl = 1; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
| 473 | + if ($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
| 474 | 474 | $checked = true; |
| 475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
| 475 | + } elseif (isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
| 476 | 476 | $checked = true; |
| 477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
| 477 | + } elseif ($id == 0 && is_array($_POST['template'])) { |
|
| 478 | 478 | $checked = in_array($row['id'], $_POST['template']); |
| 479 | 479 | } else { |
| 480 | 480 | $checked = $row['tmplvarid']; |
| 481 | 481 | } |
| 482 | 482 | $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
| 483 | 483 | $checked = $checked ? ' checked="checked"' : ''; |
| 484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
| 485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
| 484 | + $tplId = ' <small>('.$row['id'].')</small>'; |
|
| 485 | + $desc = !empty($row['tpldescription']) ? ' - '.$row['tpldescription'] : ''; |
|
| 486 | 486 | |
| 487 | 487 | $tplInfo = array(); |
| 488 | - if($row['tpllocked']) { |
|
| 488 | + if ($row['tpllocked']) { |
|
| 489 | 489 | $tplInfo[] = $_lang['locked']; |
| 490 | 490 | } |
| 491 | - if($row['id'] == $modx->config['default_template']) { |
|
| 491 | + if ($row['id'] == $modx->config['default_template']) { |
|
| 492 | 492 | $tplInfo[] = $_lang['defaulttemplate_title']; |
| 493 | 493 | } |
| 494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
| 494 | + $tplInfo = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
| 495 | 495 | |
| 496 | 496 | $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
| 497 | 497 | $tplList .= '</li>'; |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | <!-- Access Permissions --> |
| 508 | 508 | <?php |
| 509 | - if($use_udperms == 1) { |
|
| 509 | + if ($use_udperms == 1) { |
|
| 510 | 510 | // fetch permissions for the variable |
| 511 | 511 | $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
| 512 | 512 | $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
| 513 | 513 | |
| 514 | 514 | ?> |
| 515 | - <?php if($modx->hasPermission('access_permissions')) { ?> |
|
| 515 | + <?php if ($modx->hasPermission('access_permissions')) { ?> |
|
| 516 | 516 | <script type="text/javascript"> |
| 517 | 517 | function makePublic(b) { |
| 518 | 518 | var notPublic = false; |
@@ -541,26 +541,26 @@ discard block |
||
| 541 | 541 | <?php |
| 542 | 542 | $chk = ''; |
| 543 | 543 | $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
| 544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
| 544 | + if (empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
| 545 | 545 | $groupsarray = $_POST['docgroups']; |
| 546 | 546 | } |
| 547 | - while($row = $modx->db->getRow($rs)) { |
|
| 547 | + while ($row = $modx->db->getRow($rs)) { |
|
| 548 | 548 | $checked = in_array($row['id'], $groupsarray); |
| 549 | - if($modx->hasPermission('access_permissions')) { |
|
| 550 | - if($checked) { |
|
| 549 | + if ($modx->hasPermission('access_permissions')) { |
|
| 550 | + if ($checked) { |
|
| 551 | 551 | $notPublic = true; |
| 552 | 552 | } |
| 553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
| 553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='".$row['id']."' ".($checked ? "checked='checked'" : '')." onclick=\"makePublic(false)\" /> ".$row['name']."</label></li>"; |
|
| 554 | 554 | } else { |
| 555 | - if($checked) { |
|
| 556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
| 555 | + if ($checked) { |
|
| 556 | + echo "<input type='hidden' name='docgroups[]' value='".$row['id']."' />"; |
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | - if($modx->hasPermission('access_permissions')) { |
|
| 561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
| 560 | + if ($modx->hasPermission('access_permissions')) { |
|
| 561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' ".(!$notPublic ? "checked='checked'" : '')." onclick=\"makePublic(true)\" /> <span class='warning'>".$_lang['all_doc_groups']."</span></label></li>".$chks; |
|
| 562 | 562 | } |
| 563 | - echo '<ul>' . $chks . '</ul>'; |
|
| 563 | + echo '<ul>'.$chks.'</ul>'; |
|
| 564 | 564 | ?> |
| 565 | 565 | <?php } ?> |
| 566 | 566 | <?php } ?> |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | <?php |
| 574 | 574 | // invoke OnTVFormRender event |
| 575 | 575 | $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
| 576 | - if(is_array($evtOut)) { |
|
| 576 | + if (is_array($evtOut)) { |
|
| 577 | 577 | echo implode('', $evtOut); |
| 578 | 578 | } |
| 579 | 579 | ?> |
@@ -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); |