@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * @var array |
| 9 | 9 | */ |
| 10 | - public $types = array(); |
|
| 10 | + public $types = array(); |
|
| 11 | 11 | /** |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
@@ -25,73 +25,73 @@ discard block |
||
| 25 | 25 | * mgrResources constructor. |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - $this->setTypes(); |
|
| 29 | - $this->queryItemsFromDB(); |
|
| 30 | - $this->prepareCategoryArrays(); |
|
| 31 | - } |
|
| 28 | + $this->setTypes(); |
|
| 29 | + $this->queryItemsFromDB(); |
|
| 30 | + $this->prepareCategoryArrays(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | public function setTypes() { |
| 37 | - global $_lang; |
|
| 38 | - $this->types['site_templates'] = array( |
|
| 39 | - 'title'=>$_lang["manage_templates"], |
|
| 40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 41 | - 'permissions'=>array('new_template','edit_template'), |
|
| 42 | - 'name'=>'templatename' |
|
| 43 | - ); |
|
| 44 | - $this->types['site_tmplvars'] = array( |
|
| 45 | - 'title'=>$_lang["tmplvars"], |
|
| 46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 47 | - 'permissions'=>array('new_template','edit_template'), |
|
| 48 | - ); |
|
| 49 | - $this->types['site_htmlsnippets'] = array( |
|
| 50 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
| 51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 53 | - ); |
|
| 54 | - $this->types['site_snippets'] = array( |
|
| 55 | - 'title'=>$_lang["manage_snippets"], |
|
| 56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 58 | - ); |
|
| 59 | - $this->types['site_plugins'] = array( |
|
| 60 | - 'title'=>$_lang["manage_plugins"], |
|
| 61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 63 | - ); |
|
| 64 | - $this->types['site_modules'] = array( |
|
| 65 | - 'title'=>$_lang["manage_modules"], |
|
| 66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 67 | - 'permissions'=>array('new_module','edit_module'), |
|
| 68 | - ); |
|
| 69 | - } |
|
| 37 | + global $_lang; |
|
| 38 | + $this->types['site_templates'] = array( |
|
| 39 | + 'title'=>$_lang["manage_templates"], |
|
| 40 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 41 | + 'permissions'=>array('new_template','edit_template'), |
|
| 42 | + 'name'=>'templatename' |
|
| 43 | + ); |
|
| 44 | + $this->types['site_tmplvars'] = array( |
|
| 45 | + 'title'=>$_lang["tmplvars"], |
|
| 46 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 47 | + 'permissions'=>array('new_template','edit_template'), |
|
| 48 | + ); |
|
| 49 | + $this->types['site_htmlsnippets'] = array( |
|
| 50 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
| 51 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 52 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 53 | + ); |
|
| 54 | + $this->types['site_snippets'] = array( |
|
| 55 | + 'title'=>$_lang["manage_snippets"], |
|
| 56 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 57 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 58 | + ); |
|
| 59 | + $this->types['site_plugins'] = array( |
|
| 60 | + 'title'=>$_lang["manage_plugins"], |
|
| 61 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 62 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 63 | + ); |
|
| 64 | + $this->types['site_modules'] = array( |
|
| 65 | + 'title'=>$_lang["manage_modules"], |
|
| 66 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 67 | + 'permissions'=>array('new_module','edit_module'), |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | 74 | public function queryItemsFromDB() { |
| 75 | - foreach($this->types as $resourceTable=>$type) { |
|
| 76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 77 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 78 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 75 | + foreach($this->types as $resourceTable=>$type) { |
|
| 76 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
| 77 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
| 78 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @param array $permissions |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | 87 | public function hasAnyPermissions($permissions) { |
| 88 | - global $modx; |
|
| 88 | + global $modx; |
|
| 89 | 89 | |
| 90 | - foreach($permissions as $p) |
|
| 91 | - if($modx->hasPermission($p)) return true; |
|
| 90 | + foreach($permissions as $p) |
|
| 91 | + if($modx->hasPermission($p)) return true; |
|
| 92 | 92 | |
| 93 | - return false; |
|
| 94 | - } |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * @param string $resourceTable |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return array|bool |
| 100 | 100 | */ |
| 101 | 101 | public function queryResources($resourceTable, $nameField = 'name') { |
| 102 | - global $modx, $_lang; |
|
| 102 | + global $modx, $_lang; |
|
| 103 | 103 | |
| 104 | 104 | $allowed = array( |
| 105 | 105 | 'site_htmlsnippets', |
@@ -107,59 +107,59 @@ discard block |
||
| 107 | 107 | 'site_plugins', |
| 108 | 108 | 'site_modules' |
| 109 | 109 | ); |
| 110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
| 111 | - |
|
| 112 | - $tvsql = ''; |
|
| 113 | - $tvjoin = ''; |
|
| 114 | - if ($resourceTable === 'site_tmplvars') { |
|
| 115 | - $tvsql = 'site_tmplvars.caption, '; |
|
| 116 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 117 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 118 | - } |
|
| 119 | - else $sttfield = ''; |
|
| 120 | - |
|
| 121 | - $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 122 | - |
|
| 123 | - $rs = $modx->db->select( |
|
| 124 | - "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
| 125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
| 111 | + |
|
| 112 | + $tvsql = ''; |
|
| 113 | + $tvjoin = ''; |
|
| 114 | + if ($resourceTable === 'site_tmplvars') { |
|
| 115 | + $tvsql = 'site_tmplvars.caption, '; |
|
| 116 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
| 117 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
| 118 | + } |
|
| 119 | + else $sttfield = ''; |
|
| 120 | + |
|
| 121 | + $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
| 122 | + |
|
| 123 | + $rs = $modx->db->select( |
|
| 124 | + "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
| 125 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 126 | 126 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
| 127 | - "", |
|
| 128 | - "category,name" |
|
| 129 | - ); |
|
| 130 | - $limit = $modx->db->getRecordCount($rs); |
|
| 127 | + "", |
|
| 128 | + "category,name" |
|
| 129 | + ); |
|
| 130 | + $limit = $modx->db->getRecordCount($rs); |
|
| 131 | 131 | |
| 132 | - if($limit < 1) return false; |
|
| 132 | + if($limit < 1) return false; |
|
| 133 | 133 | |
| 134 | - $result = array(); |
|
| 135 | - while ($row = $modx->db->getRow($rs)) { |
|
| 136 | - $result[] = $row; |
|
| 137 | - } |
|
| 138 | - return $result; |
|
| 139 | - } |
|
| 134 | + $result = array(); |
|
| 135 | + while ($row = $modx->db->getRow($rs)) { |
|
| 136 | + $result[] = $row; |
|
| 137 | + } |
|
| 138 | + return $result; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @return void |
| 143 | 143 | */ |
| 144 | 144 | public function prepareCategoryArrays() { |
| 145 | - foreach($this->items as $type=>$items) { |
|
| 146 | - foreach((array)$items as $item) { |
|
| 147 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 148 | - $this->categories[$catid] = $item['category']; |
|
| 149 | - |
|
| 150 | - $item['type'] = $type; |
|
| 151 | - $this->itemsPerCategory[$catid][] = $item; |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - // Sort categories by name |
|
| 156 | - natcasesort($this->categories); |
|
| 157 | - |
|
| 158 | - // Now sort by name |
|
| 159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 161 | - return strcasecmp($a['name'], $b['name']); |
|
| 162 | - }); |
|
| 163 | - } |
|
| 164 | - } |
|
| 145 | + foreach($this->items as $type=>$items) { |
|
| 146 | + foreach((array)$items as $item) { |
|
| 147 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
| 148 | + $this->categories[$catid] = $item['category']; |
|
| 149 | + |
|
| 150 | + $item['type'] = $type; |
|
| 151 | + $this->itemsPerCategory[$catid][] = $item; |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + // Sort categories by name |
|
| 156 | + natcasesort($this->categories); |
|
| 157 | + |
|
| 158 | + // Now sort by name |
|
| 159 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 160 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 161 | + return strcasecmp($a['name'], $b['name']); |
|
| 162 | + }); |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | 165 | } |
@@ -1,6 +1,6 @@ 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 | |
| 6 | 6 | /********************/ |
@@ -12,30 +12,30 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | 14 | switch($modx->manager->action) { |
| 15 | - case 27: |
|
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | - } |
|
| 19 | - break; |
|
| 20 | - case 85: |
|
| 21 | - case 72: |
|
| 22 | - case 4: |
|
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | - // check user has permissions for parent |
|
| 27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 28 | - $udperms = new udperms(); |
|
| 29 | - $udperms->user = $modx->getLoginUserID(); |
|
| 30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 31 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 32 | - if(!$udperms->checkPermissions()) { |
|
| 33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - break; |
|
| 37 | - default: |
|
| 38 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + case 27: |
|
| 16 | + if(!$modx->hasPermission('edit_document')) { |
|
| 17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | + } |
|
| 19 | + break; |
|
| 20 | + case 85: |
|
| 21 | + case 72: |
|
| 22 | + case 4: |
|
| 23 | + if(!$modx->hasPermission('new_document')) { |
|
| 24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | + // check user has permissions for parent |
|
| 27 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 28 | + $udperms = new udperms(); |
|
| 29 | + $udperms->user = $modx->getLoginUserID(); |
|
| 30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 31 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 32 | + if(!$udperms->checkPermissions()) { |
|
| 33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + break; |
|
| 37 | + default: |
|
| 38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -54,22 +54,22 @@ discard block |
||
| 54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 55 | 55 | |
| 56 | 56 | if($modx->manager->action == 27) { |
| 57 | - //editing an existing document |
|
| 58 | - // check permissions on the document |
|
| 59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 60 | - $udperms = new udperms(); |
|
| 61 | - $udperms->user = $modx->getLoginUserID(); |
|
| 62 | - $udperms->document = $id; |
|
| 63 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 64 | - |
|
| 65 | - if(!$udperms->checkPermissions()) { |
|
| 66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 67 | - } |
|
| 57 | + //editing an existing document |
|
| 58 | + // check permissions on the document |
|
| 59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 60 | + $udperms = new udperms(); |
|
| 61 | + $udperms->user = $modx->getLoginUserID(); |
|
| 62 | + $udperms->document = $id; |
|
| 63 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 64 | + |
|
| 65 | + if(!$udperms->checkPermissions()) { |
|
| 66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // check to see if resource isn't locked |
| 71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
| 72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 73 | 73 | } |
| 74 | 74 | // end check for lock |
| 75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // get document groups for current user |
| 80 | 80 | if($_SESSION['mgrDocgroups']) { |
| 81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if(!empty ($id)) { |
| 85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 86 | - if($docgrp) { |
|
| 87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 88 | - } |
|
| 89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 90 | - $content = array(); |
|
| 91 | - $content = $modx->db->getRow($rs); |
|
| 92 | - $modx->documentObject = &$content; |
|
| 93 | - if(!$content) { |
|
| 94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 95 | - } |
|
| 96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
| 85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 86 | + if($docgrp) { |
|
| 87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 88 | + } |
|
| 89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 90 | + $content = array(); |
|
| 91 | + $content = $modx->db->getRow($rs); |
|
| 92 | + $modx->documentObject = &$content; |
|
| 93 | + if(!$content) { |
|
| 94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 95 | + } |
|
| 96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
| 97 | 97 | } else { |
| 98 | - $content = array(); |
|
| 98 | + $content = array(); |
|
| 99 | 99 | |
| 100 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
| 102 | - } else { |
|
| 103 | - $content['template'] = getDefaultTemplate(); |
|
| 104 | - } |
|
| 100 | + if(isset($_REQUEST['newtemplate'])) { |
|
| 101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
| 102 | + } else { |
|
| 103 | + $content['template'] = getDefaultTemplate(); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // restore saved form |
| 110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
| 111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
| 112 | - $formRestored = true; |
|
| 112 | + $formRestored = true; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // retain form values if template was changed |
| 116 | 116 | // edited to convert pub_date and unpub_date |
| 117 | 117 | // sottwell 02-09-2006 |
| 118 | 118 | if($formRestored == true) { |
| 119 | - $content = array_merge($content, $_POST); |
|
| 120 | - $content['content'] = $_POST['ta']; |
|
| 121 | - if(empty ($content['pub_date'])) { |
|
| 122 | - unset ($content['pub_date']); |
|
| 123 | - } else { |
|
| 124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 125 | - } |
|
| 126 | - if(empty ($content['unpub_date'])) { |
|
| 127 | - unset ($content['unpub_date']); |
|
| 128 | - } else { |
|
| 129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 130 | - } |
|
| 119 | + $content = array_merge($content, $_POST); |
|
| 120 | + $content['content'] = $_POST['ta']; |
|
| 121 | + if(empty ($content['pub_date'])) { |
|
| 122 | + unset ($content['pub_date']); |
|
| 123 | + } else { |
|
| 124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 125 | + } |
|
| 126 | + if(empty ($content['unpub_date'])) { |
|
| 127 | + unset ($content['unpub_date']); |
|
| 128 | + } else { |
|
| 129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 130 | + } |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // increase menu index if this is a new document |
| 134 | 134 | if(!isset ($_REQUEST['id'])) { |
| 135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | - $modx->config['auto_menuindex'] = 1; |
|
| 137 | - } |
|
| 138 | - if($modx->config['auto_menuindex']) { |
|
| 139 | - $pid = (int)$_REQUEST['pid']; |
|
| 140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
| 142 | - } else { |
|
| 143 | - $content['menuindex'] = 0; |
|
| 144 | - } |
|
| 135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
| 136 | + $modx->config['auto_menuindex'] = 1; |
|
| 137 | + } |
|
| 138 | + if($modx->config['auto_menuindex']) { |
|
| 139 | + $pid = (int)$_REQUEST['pid']; |
|
| 140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
| 142 | + } else { |
|
| 143 | + $content['menuindex'] = 0; |
|
| 144 | + } |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if(isset ($_POST['which_editor'])) { |
| 148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
| 547 | 547 | <?php |
| 548 | - // invoke OnDocFormPrerender event |
|
| 549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 550 | - 'id' => $id, |
|
| 551 | - 'template' => $content['template'] |
|
| 552 | - )); |
|
| 553 | - |
|
| 554 | - if(is_array($evtOut)) { |
|
| 555 | - echo implode('', $evtOut); |
|
| 556 | - } |
|
| 557 | - |
|
| 558 | - /*************************/ |
|
| 559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 562 | - /*************************/ |
|
| 563 | - |
|
| 564 | - ?> |
|
| 548 | + // invoke OnDocFormPrerender event |
|
| 549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 550 | + 'id' => $id, |
|
| 551 | + 'template' => $content['template'] |
|
| 552 | + )); |
|
| 553 | + |
|
| 554 | + if(is_array($evtOut)) { |
|
| 555 | + echo implode('', $evtOut); |
|
| 556 | + } |
|
| 557 | + |
|
| 558 | + /*************************/ |
|
| 559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 562 | + /*************************/ |
|
| 563 | + |
|
| 564 | + ?> |
|
| 565 | 565 | <input type="hidden" name="a" value="5" /> |
| 566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
| 567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | <h1> |
| 578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
| 579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 580 | - } else { |
|
| 581 | - if ($modx->manager->action == '4') { |
|
| 579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 580 | + } else { |
|
| 581 | + if ($modx->manager->action == '4') { |
|
| 582 | 582 | echo $_lang['add_resource']; |
| 583 | 583 | } else if ($modx->manager->action == '72') { |
| 584 | 584 | echo $_lang['add_weblink']; |
| 585 | 585 | } else { |
| 586 | 586 | echo $_lang['create_resource_title']; |
| 587 | 587 | } |
| 588 | - } ?> |
|
| 588 | + } ?> |
|
| 589 | 589 | </h1> |
| 590 | 590 | |
| 591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
| 592 | 592 | |
| 593 | 593 | <?php |
| 594 | - // breadcrumbs |
|
| 595 | - if($modx->config['use_breadcrumbs']) { |
|
| 596 | - $temp = array(); |
|
| 597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 598 | - |
|
| 599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | - $bID = (int) $_REQUEST['id']; |
|
| 601 | - $temp = $modx->getParentIds($bID); |
|
| 602 | - } else if(isset($_REQUEST['pid'])) { |
|
| 603 | - $bID = (int) $_REQUEST['pid']; |
|
| 604 | - $temp = $modx->getParentIds($bID); |
|
| 605 | - array_unshift($temp, $bID); |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - if($temp) { |
|
| 609 | - $parents = implode(',', $temp); |
|
| 610 | - |
|
| 611 | - if(!empty($parents)) { |
|
| 612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 614 | - while($row = $modx->db->getRow($rs)) { |
|
| 615 | - $out .= '<li class="breadcrumbs__li"> |
|
| 594 | + // breadcrumbs |
|
| 595 | + if($modx->config['use_breadcrumbs']) { |
|
| 596 | + $temp = array(); |
|
| 597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 598 | + |
|
| 599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 600 | + $bID = (int) $_REQUEST['id']; |
|
| 601 | + $temp = $modx->getParentIds($bID); |
|
| 602 | + } else if(isset($_REQUEST['pid'])) { |
|
| 603 | + $bID = (int) $_REQUEST['pid']; |
|
| 604 | + $temp = $modx->getParentIds($bID); |
|
| 605 | + array_unshift($temp, $bID); |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + if($temp) { |
|
| 609 | + $parents = implode(',', $temp); |
|
| 610 | + |
|
| 611 | + if(!empty($parents)) { |
|
| 612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 614 | + while($row = $modx->db->getRow($rs)) { |
|
| 615 | + $out .= '<li class="breadcrumbs__li"> |
|
| 616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
| 617 | 617 | <span class="breadcrumbs__sep">></span> |
| 618 | 618 | </li>'; |
| 619 | - } |
|
| 620 | - } |
|
| 621 | - } |
|
| 619 | + } |
|
| 620 | + } |
|
| 621 | + } |
|
| 622 | 622 | |
| 623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 625 | - } |
|
| 626 | - ?> |
|
| 623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 625 | + } |
|
| 626 | + ?> |
|
| 627 | 627 | |
| 628 | 628 | <!-- start main wrapper --> |
| 629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | <!-- General --> |
| 637 | 637 | <?php |
| 638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 639 | - 'id' => $id |
|
| 640 | - )); |
|
| 641 | - if(is_array($evtOut)) { |
|
| 642 | - echo implode('', $evtOut); |
|
| 643 | - } else { |
|
| 644 | - ?> |
|
| 638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 639 | + 'id' => $id |
|
| 640 | + )); |
|
| 641 | + if(is_array($evtOut)) { |
|
| 642 | + echo implode('', $evtOut); |
|
| 643 | + } else { |
|
| 644 | + ?> |
|
| 645 | 645 | <div class="tab-page" id="tabGeneral"> |
| 646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
| 647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
| 726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
| 727 | 727 | <option value="0">(blank)</option> |
| 728 | 728 | <?php |
| 729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 732 | - $currentCategory = ''; |
|
| 733 | - while($row = $modx->db->getRow($rs)) { |
|
| 734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | - continue; |
|
| 736 | - }; |
|
| 737 | - // Skip if not selectable but show if selected! |
|
| 738 | - $thisCategory = $row['category']; |
|
| 739 | - if($thisCategory == null) { |
|
| 740 | - $thisCategory = $_lang["no_category"]; |
|
| 741 | - } |
|
| 742 | - if($thisCategory != $currentCategory) { |
|
| 743 | - if($closeOptGroup) { |
|
| 744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 745 | - } |
|
| 746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 747 | - $closeOptGroup = true; |
|
| 748 | - } |
|
| 729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 732 | + $currentCategory = ''; |
|
| 733 | + while($row = $modx->db->getRow($rs)) { |
|
| 734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 735 | + continue; |
|
| 736 | + }; |
|
| 737 | + // Skip if not selectable but show if selected! |
|
| 738 | + $thisCategory = $row['category']; |
|
| 739 | + if($thisCategory == null) { |
|
| 740 | + $thisCategory = $_lang["no_category"]; |
|
| 741 | + } |
|
| 742 | + if($thisCategory != $currentCategory) { |
|
| 743 | + if($closeOptGroup) { |
|
| 744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 745 | + } |
|
| 746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 747 | + $closeOptGroup = true; |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 751 | 751 | |
| 752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 753 | - $currentCategory = $thisCategory; |
|
| 754 | - } |
|
| 755 | - if($thisCategory != '') { |
|
| 756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 757 | - } |
|
| 758 | - ?> |
|
| 752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 753 | + $currentCategory = $thisCategory; |
|
| 754 | + } |
|
| 755 | + if($thisCategory != '') { |
|
| 756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 757 | + } |
|
| 758 | + ?> |
|
| 759 | 759 | </select> |
| 760 | 760 | </td> |
| 761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
| 795 | 795 | </td> |
| 796 | 796 | <td valign="top"> |
| 797 | 797 | <?php |
| 798 | - $parentlookup = false; |
|
| 799 | - if(isset ($_REQUEST['id'])) { |
|
| 800 | - if($content['parent'] == 0) { |
|
| 801 | - $parentname = $site_name; |
|
| 802 | - } else { |
|
| 803 | - $parentlookup = $content['parent']; |
|
| 804 | - } |
|
| 805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | - if($_REQUEST['pid'] == 0) { |
|
| 807 | - $parentname = $site_name; |
|
| 808 | - } else { |
|
| 809 | - $parentlookup = $_REQUEST['pid']; |
|
| 810 | - } |
|
| 811 | - } elseif(isset($_POST['parent'])) { |
|
| 812 | - if($_POST['parent'] == 0) { |
|
| 813 | - $parentname = $site_name; |
|
| 814 | - } else { |
|
| 815 | - $parentlookup = $_POST['parent']; |
|
| 816 | - } |
|
| 817 | - } else { |
|
| 818 | - $parentname = $site_name; |
|
| 819 | - $content['parent'] = 0; |
|
| 820 | - } |
|
| 821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 823 | - $parentname = $modx->db->getValue($rs); |
|
| 824 | - if(!$parentname) { |
|
| 825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 826 | - } |
|
| 827 | - } |
|
| 828 | - ?> |
|
| 798 | + $parentlookup = false; |
|
| 799 | + if(isset ($_REQUEST['id'])) { |
|
| 800 | + if($content['parent'] == 0) { |
|
| 801 | + $parentname = $site_name; |
|
| 802 | + } else { |
|
| 803 | + $parentlookup = $content['parent']; |
|
| 804 | + } |
|
| 805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
| 806 | + if($_REQUEST['pid'] == 0) { |
|
| 807 | + $parentname = $site_name; |
|
| 808 | + } else { |
|
| 809 | + $parentlookup = $_REQUEST['pid']; |
|
| 810 | + } |
|
| 811 | + } elseif(isset($_POST['parent'])) { |
|
| 812 | + if($_POST['parent'] == 0) { |
|
| 813 | + $parentname = $site_name; |
|
| 814 | + } else { |
|
| 815 | + $parentlookup = $_POST['parent']; |
|
| 816 | + } |
|
| 817 | + } else { |
|
| 818 | + $parentname = $site_name; |
|
| 819 | + $content['parent'] = 0; |
|
| 820 | + } |
|
| 821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 823 | + $parentname = $modx->db->getValue($rs); |
|
| 824 | + if(!$parentname) { |
|
| 825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 826 | + } |
|
| 827 | + } |
|
| 828 | + ?> |
|
| 829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
| 830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
| 831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | </tr> |
| 834 | 834 | <tr></tr> |
| 835 | 835 | <?php |
| 836 | - /* |
|
| 836 | + /* |
|
| 837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
| 838 | 838 | ?> |
| 839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | </tr> |
| 862 | 862 | <?php |
| 863 | 863 | }*/ |
| 864 | - ?> |
|
| 864 | + ?> |
|
| 865 | 865 | |
| 866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
| 867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
| 874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
| 875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
| 876 | 876 | <?php |
| 877 | - // invoke OnRichTextEditorRegister event |
|
| 878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 879 | - if(is_array($evtOut)) { |
|
| 880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | - $editor = $evtOut[$i]; |
|
| 882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 883 | - } |
|
| 884 | - } |
|
| 885 | - ?> |
|
| 877 | + // invoke OnRichTextEditorRegister event |
|
| 878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 879 | + if(is_array($evtOut)) { |
|
| 880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 881 | + $editor = $evtOut[$i]; |
|
| 882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 883 | + } |
|
| 884 | + } |
|
| 885 | + ?> |
|
| 886 | 886 | </select> |
| 887 | 887 | </label> |
| 888 | 888 | </div> |
| 889 | 889 | <div id="content_body"> |
| 890 | 890 | <?php |
| 891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | - $htmlContent = $content['content']; |
|
| 893 | - ?> |
|
| 891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 892 | + $htmlContent = $content['content']; |
|
| 893 | + ?> |
|
| 894 | 894 | <div class="section-editor clearfix"> |
| 895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
| 896 | 896 | </div> |
| 897 | 897 | <?php |
| 898 | - // Richtext-[*content*] |
|
| 899 | - $richtexteditorIds = array(); |
|
| 900 | - $richtexteditorOptions = array(); |
|
| 901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 903 | - } else { |
|
| 904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 905 | - } |
|
| 906 | - ?> |
|
| 898 | + // Richtext-[*content*] |
|
| 899 | + $richtexteditorIds = array(); |
|
| 900 | + $richtexteditorOptions = array(); |
|
| 901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 903 | + } else { |
|
| 904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 905 | + } |
|
| 906 | + ?> |
|
| 907 | 907 | </div> |
| 908 | 908 | </td> |
| 909 | 909 | </tr> |
@@ -1190,8 +1190,8 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | <?php |
| 1192 | 1192 | |
| 1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1194 | - ?> |
|
| 1193 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1194 | + ?> |
|
| 1195 | 1195 | <tr> |
| 1196 | 1196 | <td> |
| 1197 | 1197 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1213,15 +1213,15 @@ discard block |
||
| 1213 | 1213 | <td> |
| 1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1215 | 1215 | <?php |
| 1216 | - if(!$content['contentType']) { |
|
| 1217 | - $content['contentType'] = 'text/html'; |
|
| 1218 | - } |
|
| 1219 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1220 | - $ct = explode(",", $custom_contenttype); |
|
| 1221 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1223 | - } |
|
| 1224 | - ?> |
|
| 1216 | + if(!$content['contentType']) { |
|
| 1217 | + $content['contentType'] = 'text/html'; |
|
| 1218 | + } |
|
| 1219 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1220 | + $ct = explode(",", $custom_contenttype); |
|
| 1221 | + for($i = 0; $i < count($ct); $i++) { |
|
| 1222 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1223 | + } |
|
| 1224 | + ?> |
|
| 1225 | 1225 | </select> |
| 1226 | 1226 | </td> |
| 1227 | 1227 | </tr> |
@@ -1244,23 +1244,23 @@ discard block |
||
| 1244 | 1244 | </td> |
| 1245 | 1245 | </tr> |
| 1246 | 1246 | <?php |
| 1247 | - } else { |
|
| 1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1249 | - // non-admin managers creating or editing a document resource |
|
| 1250 | - ?> |
|
| 1247 | + } else { |
|
| 1248 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1249 | + // non-admin managers creating or editing a document resource |
|
| 1250 | + ?> |
|
| 1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
| 1252 | 1252 | <input type="hidden" name="type" value="document" /> |
| 1253 | 1253 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
| 1254 | 1254 | <?php |
| 1255 | - } else { |
|
| 1256 | - // non-admin managers creating or editing a reference (weblink) resource |
|
| 1257 | - ?> |
|
| 1255 | + } else { |
|
| 1256 | + // non-admin managers creating or editing a reference (weblink) resource |
|
| 1257 | + ?> |
|
| 1258 | 1258 | <input type="hidden" name="type" value="reference" /> |
| 1259 | 1259 | <input type="hidden" name="contentType" value="text/html" /> |
| 1260 | 1260 | <?php |
| 1261 | - } |
|
| 1262 | - }//if mgrRole |
|
| 1263 | - ?> |
|
| 1261 | + } |
|
| 1262 | + }//if mgrRole |
|
| 1263 | + ?> |
|
| 1264 | 1264 | |
| 1265 | 1265 | <tr> |
| 1266 | 1266 | <td> |
@@ -1343,112 +1343,112 @@ discard block |
||
| 1343 | 1343 | ?> |
| 1344 | 1344 | |
| 1345 | 1345 | <?php |
| 1346 | - /******************************* |
|
| 1346 | + /******************************* |
|
| 1347 | 1347 | * Document Access Permissions */ |
| 1348 | - if($use_udperms == 1) { |
|
| 1349 | - $groupsarray = array(); |
|
| 1350 | - $sql = ''; |
|
| 1351 | - |
|
| 1352 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1353 | - if($documentId > 0) { |
|
| 1354 | - // Load up, the permissions from the parent (if new document) or existing document |
|
| 1355 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1357 | - |
|
| 1358 | - // Load up the current permissions and names |
|
| 1359 | - $vs = array( |
|
| 1360 | - $tbl_document_group_names, |
|
| 1361 | - $tbl_document_groups, |
|
| 1362 | - $documentId |
|
| 1363 | - ); |
|
| 1364 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1365 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1366 | - } else { |
|
| 1367 | - // Just load up the names, we're starting clean |
|
| 1368 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1369 | - } |
|
| 1370 | - |
|
| 1371 | - // retain selected doc groups between post |
|
| 1372 | - if(isset($_POST['docgroups'])) { |
|
| 1373 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1374 | - } |
|
| 1348 | + if($use_udperms == 1) { |
|
| 1349 | + $groupsarray = array(); |
|
| 1350 | + $sql = ''; |
|
| 1351 | + |
|
| 1352 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1353 | + if($documentId > 0) { |
|
| 1354 | + // Load up, the permissions from the parent (if new document) or existing document |
|
| 1355 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1356 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1357 | + |
|
| 1358 | + // Load up the current permissions and names |
|
| 1359 | + $vs = array( |
|
| 1360 | + $tbl_document_group_names, |
|
| 1361 | + $tbl_document_groups, |
|
| 1362 | + $documentId |
|
| 1363 | + ); |
|
| 1364 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1365 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1366 | + } else { |
|
| 1367 | + // Just load up the names, we're starting clean |
|
| 1368 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1369 | + } |
|
| 1370 | + |
|
| 1371 | + // retain selected doc groups between post |
|
| 1372 | + if(isset($_POST['docgroups'])) { |
|
| 1373 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1374 | + } |
|
| 1375 | + |
|
| 1376 | + $isManager = $modx->hasPermission('access_permissions'); |
|
| 1377 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1378 | + |
|
| 1379 | + // Setup Basic attributes for each Input box |
|
| 1380 | + $inputAttributes = array( |
|
| 1381 | + 'type' => 'checkbox', |
|
| 1382 | + 'class' => 'checkbox', |
|
| 1383 | + 'name' => 'docgroups[]', |
|
| 1384 | + 'onclick' => 'makePublic(false);', |
|
| 1385 | + ); |
|
| 1386 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1387 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1388 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1389 | + |
|
| 1390 | + // Loop through the permissions list |
|
| 1391 | + while($row = $modx->db->getRow($rs)) { |
|
| 1392 | + |
|
| 1393 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1394 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1395 | + $inputId = 'group-' . $row['id']; |
|
| 1396 | + |
|
| 1397 | + $checked = in_array($inputValue, $groupsarray); |
|
| 1398 | + if($checked) { |
|
| 1399 | + $notPublic = true; |
|
| 1400 | + } // Mark as private access (either web or manager) |
|
| 1401 | + |
|
| 1402 | + // Skip the access permission if the user doesn't have access... |
|
| 1403 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1404 | + continue; |
|
| 1405 | + } |
|
| 1375 | 1406 | |
| 1376 | - $isManager = $modx->hasPermission('access_permissions'); |
|
| 1377 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1378 | - |
|
| 1379 | - // Setup Basic attributes for each Input box |
|
| 1380 | - $inputAttributes = array( |
|
| 1381 | - 'type' => 'checkbox', |
|
| 1382 | - 'class' => 'checkbox', |
|
| 1383 | - 'name' => 'docgroups[]', |
|
| 1384 | - 'onclick' => 'makePublic(false);', |
|
| 1385 | - ); |
|
| 1386 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1387 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1388 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1389 | - |
|
| 1390 | - // Loop through the permissions list |
|
| 1391 | - while($row = $modx->db->getRow($rs)) { |
|
| 1392 | - |
|
| 1393 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1395 | - $inputId = 'group-' . $row['id']; |
|
| 1396 | - |
|
| 1397 | - $checked = in_array($inputValue, $groupsarray); |
|
| 1398 | - if($checked) { |
|
| 1399 | - $notPublic = true; |
|
| 1400 | - } // Mark as private access (either web or manager) |
|
| 1401 | - |
|
| 1402 | - // Skip the access permission if the user doesn't have access... |
|
| 1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1404 | - continue; |
|
| 1405 | - } |
|
| 1406 | - |
|
| 1407 | - // Setup attributes for this Input box |
|
| 1408 | - $inputAttributes['id'] = $inputId; |
|
| 1409 | - $inputAttributes['value'] = $inputValue; |
|
| 1410 | - if($checked) { |
|
| 1411 | - $inputAttributes['checked'] = 'checked'; |
|
| 1412 | - } else { |
|
| 1413 | - unset($inputAttributes['checked']); |
|
| 1414 | - } |
|
| 1415 | - |
|
| 1416 | - // Create attribute string list |
|
| 1417 | - $inputString = array(); |
|
| 1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1419 | - |
|
| 1420 | - // Make the <input> HTML |
|
| 1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1422 | - |
|
| 1423 | - // does user have this permission? |
|
| 1424 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1425 | - $vs = array( |
|
| 1426 | - $row['id'], |
|
| 1427 | - $_SESSION['mgrInternalKey'] |
|
| 1428 | - ); |
|
| 1429 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1430 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1431 | - $count = $modx->db->getValue($rsp); |
|
| 1432 | - if($count > 0) { |
|
| 1433 | - ++$permissions_yes; |
|
| 1434 | - } else { |
|
| 1435 | - ++$permissions_no; |
|
| 1436 | - } |
|
| 1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1438 | - } |
|
| 1439 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1441 | - $permissions = array(); |
|
| 1442 | - } |
|
| 1407 | + // Setup attributes for this Input box |
|
| 1408 | + $inputAttributes['id'] = $inputId; |
|
| 1409 | + $inputAttributes['value'] = $inputValue; |
|
| 1410 | + if($checked) { |
|
| 1411 | + $inputAttributes['checked'] = 'checked'; |
|
| 1412 | + } else { |
|
| 1413 | + unset($inputAttributes['checked']); |
|
| 1414 | + } |
|
| 1443 | 1415 | |
| 1444 | - // See if the Access Permissions section is worth displaying... |
|
| 1445 | - if(!empty($permissions)) { |
|
| 1446 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1447 | - if($isManager && $isWeb) { |
|
| 1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1449 | - } |
|
| 1450 | - // Output the permissions list... |
|
| 1451 | - ?> |
|
| 1416 | + // Create attribute string list |
|
| 1417 | + $inputString = array(); |
|
| 1418 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1419 | + |
|
| 1420 | + // Make the <input> HTML |
|
| 1421 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1422 | + |
|
| 1423 | + // does user have this permission? |
|
| 1424 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1425 | + $vs = array( |
|
| 1426 | + $row['id'], |
|
| 1427 | + $_SESSION['mgrInternalKey'] |
|
| 1428 | + ); |
|
| 1429 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1430 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1431 | + $count = $modx->db->getValue($rsp); |
|
| 1432 | + if($count > 0) { |
|
| 1433 | + ++$permissions_yes; |
|
| 1434 | + } else { |
|
| 1435 | + ++$permissions_no; |
|
| 1436 | + } |
|
| 1437 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1438 | + } |
|
| 1439 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1440 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1441 | + $permissions = array(); |
|
| 1442 | + } |
|
| 1443 | + |
|
| 1444 | + // See if the Access Permissions section is worth displaying... |
|
| 1445 | + if(!empty($permissions)) { |
|
| 1446 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1447 | + if($isManager && $isWeb) { |
|
| 1448 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1449 | + } |
|
| 1450 | + // Output the permissions list... |
|
| 1451 | + ?> |
|
| 1452 | 1452 | <!-- Access Permissions --> |
| 1453 | 1453 | <div class="tab-page" id="tabAccess"> |
| 1454 | 1454 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1482,31 +1482,31 @@ discard block |
||
| 1482 | 1482 | </ul> |
| 1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1484 | 1484 | <?php |
| 1485 | - } // !empty($permissions) |
|
| 1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1487 | - ?> |
|
| 1485 | + } // !empty($permissions) |
|
| 1486 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1487 | + ?> |
|
| 1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1489 | 1489 | <?php |
| 1490 | 1490 | |
| 1491 | - } |
|
| 1492 | - } |
|
| 1493 | - /* End Document Access Permissions * |
|
| 1491 | + } |
|
| 1492 | + } |
|
| 1493 | + /* End Document Access Permissions * |
|
| 1494 | 1494 | ***********************************/ |
| 1495 | - ?> |
|
| 1495 | + ?> |
|
| 1496 | 1496 | |
| 1497 | 1497 | <input type="submit" name="save" style="display:none" /> |
| 1498 | 1498 | <?php |
| 1499 | 1499 | |
| 1500 | - // invoke OnDocFormRender event |
|
| 1501 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1502 | - 'id' => $id, |
|
| 1503 | - 'template' => $content['template'] |
|
| 1504 | - )); |
|
| 1500 | + // invoke OnDocFormRender event |
|
| 1501 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1502 | + 'id' => $id, |
|
| 1503 | + 'template' => $content['template'] |
|
| 1504 | + )); |
|
| 1505 | 1505 | |
| 1506 | - if(is_array($evtOut)) { |
|
| 1507 | - echo implode('', $evtOut); |
|
| 1508 | - } |
|
| 1509 | - ?> |
|
| 1506 | + if(is_array($evtOut)) { |
|
| 1507 | + echo implode('', $evtOut); |
|
| 1508 | + } |
|
| 1509 | + ?> |
|
| 1510 | 1510 | </div><!--div class="tab-pane" id="documentPane"--> |
| 1511 | 1511 | </div><!--div class="sectionBody"--> |
| 1512 | 1512 | </fieldset> |
@@ -1517,63 +1517,63 @@ discard block |
||
| 1517 | 1517 | </script> |
| 1518 | 1518 | <?php |
| 1519 | 1519 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
| 1520 | - if(is_array($richtexteditorIds)) { |
|
| 1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1522 | - // invoke OnRichTextEditorInit event |
|
| 1523 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1524 | - 'editor' => $editor, |
|
| 1525 | - 'elements' => $elements, |
|
| 1526 | - 'options' => $richtexteditorOptions[$editor] |
|
| 1527 | - )); |
|
| 1528 | - if(is_array($evtOut)) { |
|
| 1529 | - echo implode('', $evtOut); |
|
| 1530 | - } |
|
| 1531 | - } |
|
| 1532 | - } |
|
| 1520 | + if(is_array($richtexteditorIds)) { |
|
| 1521 | + foreach($richtexteditorIds as $editor => $elements) { |
|
| 1522 | + // invoke OnRichTextEditorInit event |
|
| 1523 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1524 | + 'editor' => $editor, |
|
| 1525 | + 'elements' => $elements, |
|
| 1526 | + 'options' => $richtexteditorOptions[$editor] |
|
| 1527 | + )); |
|
| 1528 | + if(is_array($evtOut)) { |
|
| 1529 | + echo implode('', $evtOut); |
|
| 1530 | + } |
|
| 1531 | + } |
|
| 1532 | + } |
|
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | 1535 | /** |
| 1536 | 1536 | * @return string |
| 1537 | 1537 | */ |
| 1538 | 1538 | function getDefaultTemplate() { |
| 1539 | - global $modx; |
|
| 1539 | + global $modx; |
|
| 1540 | 1540 | |
| 1541 | 1541 | $default_template = ''; |
| 1542 | - switch($modx->config['auto_template_logic']) { |
|
| 1543 | - case 'sibling': |
|
| 1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1545 | - $site_start = $modx->config['site_start']; |
|
| 1546 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1547 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1549 | - $default_template = $sibl[0]['template']; |
|
| 1550 | - } |
|
| 1551 | - } else { |
|
| 1552 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | - $default_template = $sibl[0]['template']; |
|
| 1555 | - } else { |
|
| 1556 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1558 | - $default_template = $sibl[0]['template']; |
|
| 1559 | - } |
|
| 1560 | - } |
|
| 1561 | - } |
|
| 1562 | - if(isset($default_template)) { |
|
| 1563 | - break; |
|
| 1564 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1565 | - case 'parent': |
|
| 1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1567 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1568 | - if(isset($parent['template'])) { |
|
| 1569 | - $default_template = $parent['template']; |
|
| 1570 | - } |
|
| 1571 | - } |
|
| 1572 | - break; |
|
| 1573 | - case 'system': |
|
| 1574 | - default: // default_template is already set |
|
| 1575 | - $default_template = $modx->config['default_template']; |
|
| 1576 | - } |
|
| 1577 | - |
|
| 1578 | - return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
| 1542 | + switch($modx->config['auto_template_logic']) { |
|
| 1543 | + case 'sibling': |
|
| 1544 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
| 1545 | + $site_start = $modx->config['site_start']; |
|
| 1546 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
| 1547 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
| 1548 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1549 | + $default_template = $sibl[0]['template']; |
|
| 1550 | + } |
|
| 1551 | + } else { |
|
| 1552 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1553 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1554 | + $default_template = $sibl[0]['template']; |
|
| 1555 | + } else { |
|
| 1556 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
| 1557 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
| 1558 | + $default_template = $sibl[0]['template']; |
|
| 1559 | + } |
|
| 1560 | + } |
|
| 1561 | + } |
|
| 1562 | + if(isset($default_template)) { |
|
| 1563 | + break; |
|
| 1564 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
| 1565 | + case 'parent': |
|
| 1566 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
| 1567 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
| 1568 | + if(isset($parent['template'])) { |
|
| 1569 | + $default_template = $parent['template']; |
|
| 1570 | + } |
|
| 1571 | + } |
|
| 1572 | + break; |
|
| 1573 | + case 'system': |
|
| 1574 | + default: // default_template is already set |
|
| 1575 | + $default_template = $modx->config['default_template']; |
|
| 1576 | + } |
|
| 1577 | + |
|
| 1578 | + return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
| 1579 | 1579 | } |
@@ -1,20 +1,20 @@ 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 | switch($modx->manager->action) {
|
| 6 | - case 107: |
|
| 7 | - if(!$modx->hasPermission('new_module')) {
|
|
| 8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 9 | - } |
|
| 10 | - break; |
|
| 11 | - case 108: |
|
| 12 | - if(!$modx->hasPermission('edit_module')) {
|
|
| 13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 14 | - } |
|
| 15 | - break; |
|
| 16 | - default: |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + case 107: |
|
| 7 | + if(!$modx->hasPermission('new_module')) {
|
|
| 8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 9 | + } |
|
| 10 | + break; |
|
| 11 | + case 108: |
|
| 12 | + if(!$modx->hasPermission('edit_module')) {
|
|
| 13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 14 | + } |
|
| 15 | + break; |
|
| 16 | + default: |
|
| 17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | 18 | } |
| 19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
| 20 | 20 | // Get table names (alphabetical) |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | * @return string |
| 35 | 35 | */ |
| 36 | 36 | function createGUID() {
|
| 37 | - srand((double) microtime() * 1000000); |
|
| 38 | - $r = rand(); |
|
| 39 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
| 40 | - $m = md5($u); |
|
| 41 | - return $m; |
|
| 37 | + srand((double) microtime() * 1000000); |
|
| 38 | + $r = rand(); |
|
| 39 | + $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
| 40 | + $m = md5($u); |
|
| 41 | + return $m; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // check to see the module editor isn't locked |
| 45 | 45 | if($lockedEl = $modx->elementIsLocked(6, $id)) {
|
| 46 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
| 46 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
| 47 | 47 | } |
| 48 | 48 | // end check for lock |
| 49 | 49 | |
@@ -51,22 +51,22 @@ discard block |
||
| 51 | 51 | $modx->lockElement(6, $id); |
| 52 | 52 | |
| 53 | 53 | if(isset($_GET['id'])) {
|
| 54 | - $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
|
|
| 55 | - $content = $modx->db->getRow($rs); |
|
| 56 | - if(!$content) {
|
|
| 57 | - $modx->webAlertAndQuit("Module not found for id '{$id}'.");
|
|
| 58 | - } |
|
| 59 | - $content['properties'] = str_replace("&", "&", $content['properties']);
|
|
| 60 | - $_SESSION['itemname'] = $content['name']; |
|
| 61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
|
|
| 62 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 63 | - } |
|
| 54 | + $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
|
|
| 55 | + $content = $modx->db->getRow($rs); |
|
| 56 | + if(!$content) {
|
|
| 57 | + $modx->webAlertAndQuit("Module not found for id '{$id}'.");
|
|
| 58 | + } |
|
| 59 | + $content['properties'] = str_replace("&", "&", $content['properties']);
|
|
| 60 | + $_SESSION['itemname'] = $content['name']; |
|
| 61 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
|
|
| 62 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 63 | + } |
|
| 64 | 64 | } else {
|
| 65 | - $_SESSION['itemname'] = $_lang["new_module"]; |
|
| 66 | - $content['wrap'] = '1'; |
|
| 65 | + $_SESSION['itemname'] = $_lang["new_module"]; |
|
| 66 | + $content['wrap'] = '1'; |
|
| 67 | 67 | } |
| 68 | 68 | if($modx->manager->hasFormValues()) {
|
| 69 | - $modx->manager->loadFormValues(); |
|
| 69 | + $modx->manager->loadFormValues(); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Add lock-element JS-Script |
@@ -437,18 +437,18 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109"> |
| 439 | 439 | <?php |
| 440 | - // invoke OnModFormPrerender event |
|
| 441 | - $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
|
|
| 442 | - if(is_array($evtOut)) {
|
|
| 443 | - echo implode('', $evtOut);
|
|
| 444 | - } |
|
| 445 | - |
|
| 446 | - // Prepare internal params & info-tab via parseDocBlock |
|
| 447 | - $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
| 448 | - $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
| 449 | - $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
| 450 | - $internal = array(); |
|
| 451 | - ?> |
|
| 440 | + // invoke OnModFormPrerender event |
|
| 441 | + $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
|
|
| 442 | + if(is_array($evtOut)) {
|
|
| 443 | + echo implode('', $evtOut);
|
|
| 444 | + } |
|
| 445 | + |
|
| 446 | + // Prepare internal params & info-tab via parseDocBlock |
|
| 447 | + $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
| 448 | + $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
| 449 | + $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
| 450 | + $internal = array(); |
|
| 451 | + ?> |
|
| 452 | 452 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
| 453 | 453 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
| 454 | 454 | |
@@ -501,11 +501,11 @@ discard block |
||
| 501 | 501 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
| 502 | 502 | <option> </option> |
| 503 | 503 | <?php |
| 504 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 505 | - foreach(getCategories() as $n => $v) {
|
|
| 506 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
| 507 | - } |
|
| 508 | - ?> |
|
| 504 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 505 | + foreach(getCategories() as $n => $v) {
|
|
| 506 | + echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
| 507 | + } |
|
| 508 | + ?> |
|
| 509 | 509 | </select> |
| 510 | 510 | </div> |
| 511 | 511 | </div> |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | <i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a> |
| 613 | 613 | </div> |
| 614 | 614 | <?php |
| 615 | - $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name,
|
|
| 615 | + $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name,
|
|
| 616 | 616 | CASE smd.type |
| 617 | 617 | WHEN 10 THEN 'Chunk' |
| 618 | 618 | WHEN 20 THEN 'Document' |
@@ -628,17 +628,17 @@ discard block |
||
| 628 | 628 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50
|
| 629 | 629 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name');
|
| 630 | 630 | |
| 631 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 632 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
|
|
| 633 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
| 634 | - $grd->cssClass = 'grid'; |
|
| 635 | - $grd->columnHeaderClass = 'gridHeader'; |
|
| 636 | - $grd->itemClass = 'gridItem'; |
|
| 637 | - $grd->altItemClass = 'gridAltItem'; |
|
| 638 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
| 639 | - $grd->fields = "name,type"; |
|
| 640 | - echo $grd->render(); |
|
| 641 | - ?> |
|
| 631 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 632 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
|
|
| 633 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
| 634 | + $grd->cssClass = 'grid'; |
|
| 635 | + $grd->columnHeaderClass = 'gridHeader'; |
|
| 636 | + $grd->itemClass = 'gridItem'; |
|
| 637 | + $grd->altItemClass = 'gridAltItem'; |
|
| 638 | + $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
| 639 | + $grd->fields = "name,type"; |
|
| 640 | + echo $grd->render(); |
|
| 641 | + ?> |
|
| 642 | 642 | </div> |
| 643 | 643 | </div> |
| 644 | 644 | <?php endif; ?> |
@@ -650,12 +650,12 @@ discard block |
||
| 650 | 650 | <div class="container container-body"> |
| 651 | 651 | <?php if($use_udperms == 1) : ?> |
| 652 | 652 | <?php |
| 653 | - // fetch user access permissions for the module |
|
| 654 | - $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
|
|
| 655 | - $groupsarray = $modx->db->getColumn('usergroup', $rs);
|
|
| 653 | + // fetch user access permissions for the module |
|
| 654 | + $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
|
|
| 655 | + $groupsarray = $modx->db->getColumn('usergroup', $rs);
|
|
| 656 | 656 | |
| 657 | - if($modx->hasPermission('access_permissions')) {
|
|
| 658 | - ?> |
|
| 657 | + if($modx->hasPermission('access_permissions')) {
|
|
| 658 | + ?> |
|
| 659 | 659 | <!-- User Group Access Permissions --> |
| 660 | 660 | <script type="text/javascript"> |
| 661 | 661 | function makePublic(b) {
|
@@ -679,28 +679,28 @@ discard block |
||
| 679 | 679 | </script> |
| 680 | 680 | <p><?= $_lang['module_group_access_msg'] ?></p> |
| 681 | 681 | <?php |
| 682 | - } |
|
| 683 | - $chk = ''; |
|
| 684 | - $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
|
|
| 685 | - while($row = $modx->db->getRow($rs)) {
|
|
| 686 | - $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
| 687 | - $checked = in_array($row['id'], $groupsarray); |
|
| 688 | - if($modx->hasPermission('access_permissions')) {
|
|
| 689 | - if($checked) {
|
|
| 690 | - $notPublic = true; |
|
| 691 | - } |
|
| 692 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
| 693 | - } else {
|
|
| 694 | - if($checked) {
|
|
| 695 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
| 696 | - } |
|
| 697 | - } |
|
| 698 | - } |
|
| 699 | - if($modx->hasPermission('access_permissions')) {
|
|
| 700 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
| 701 | - } |
|
| 702 | - echo $chks; |
|
| 703 | - ?> |
|
| 682 | + } |
|
| 683 | + $chk = ''; |
|
| 684 | + $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
|
|
| 685 | + while($row = $modx->db->getRow($rs)) {
|
|
| 686 | + $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
| 687 | + $checked = in_array($row['id'], $groupsarray); |
|
| 688 | + if($modx->hasPermission('access_permissions')) {
|
|
| 689 | + if($checked) {
|
|
| 690 | + $notPublic = true; |
|
| 691 | + } |
|
| 692 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
| 693 | + } else {
|
|
| 694 | + if($checked) {
|
|
| 695 | + $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | + } |
|
| 699 | + if($modx->hasPermission('access_permissions')) {
|
|
| 700 | + $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
| 701 | + } |
|
| 702 | + echo $chks; |
|
| 703 | + ?> |
|
| 704 | 704 | <?php endif; ?> |
| 705 | 705 | </div> |
| 706 | 706 | </div> |
@@ -716,11 +716,11 @@ discard block |
||
| 716 | 716 | |
| 717 | 717 | <input type="submit" name="save" style="display:none;"> |
| 718 | 718 | <?php |
| 719 | - // invoke OnModFormRender event |
|
| 720 | - $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
|
|
| 721 | - if(is_array($evtOut)) {
|
|
| 722 | - echo implode('', $evtOut);
|
|
| 723 | - } |
|
| 724 | - ?> |
|
| 719 | + // invoke OnModFormRender event |
|
| 720 | + $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
|
|
| 721 | + if(is_array($evtOut)) {
|
|
| 722 | + echo implode('', $evtOut);
|
|
| 723 | + } |
|
| 724 | + ?> |
|
| 725 | 725 | </form> |
| 726 | 726 | <script type="text/javascript">setTimeout('showParameters();', 10);</script>
|
@@ -1,17 +1,17 @@ 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('import_static')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // Files to upload |
| 10 | 10 | $allowedfiles = array( |
| 11 | - 'html', |
|
| 12 | - 'htm', |
|
| 13 | - 'shtml', |
|
| 14 | - 'xml' |
|
| 11 | + 'html', |
|
| 12 | + 'htm', |
|
| 13 | + 'shtml', |
|
| 14 | + 'xml' |
|
| 15 | 15 | ); |
| 16 | 16 | ?> |
| 17 | 17 | <script language="javascript"> |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | <div class="tab-page"> |
| 44 | 44 | <div class="container container-body"> |
| 45 | 45 | <?php |
| 46 | - if(!isset($_POST['import'])) { |
|
| 47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
| 48 | - ?> |
|
| 46 | + if(!isset($_POST['import'])) { |
|
| 47 | + echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
| 48 | + ?> |
|
| 49 | 49 | <form action="index.php" method="post" name="importFrm"> |
| 50 | 50 | <input type="hidden" name="import" value="import" /> |
| 51 | 51 | <input type="hidden" name="a" value="95" /> |
@@ -85,18 +85,18 @@ discard block |
||
| 85 | 85 | <a href="javascript:;" class="btn btn-primary" onclick="window.importFrm.submit();"><i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang["import_site_start"] ?></a> |
| 86 | 86 | </form> |
| 87 | 87 | <?php |
| 88 | - } else { |
|
| 89 | - run(); |
|
| 90 | - $modx->clearCache('full'); |
|
| 91 | - ?> |
|
| 88 | + } else { |
|
| 89 | + run(); |
|
| 90 | + $modx->clearCache('full'); |
|
| 91 | + ?> |
|
| 92 | 92 | <a href="javascript:;" class="btn btn-primary" onclick="window.location.href='index.php?a=2';"><i class="<?= $_style["actions_close"] ?>"></i> <?= $_lang["close"] ?></a> |
| 93 | 93 | <script type="text/javascript"> |
| 94 | 94 | top.mainMenu.reloadtree(); |
| 95 | 95 | parent.tree.ca = 'open'; |
| 96 | 96 | </script> |
| 97 | 97 | <?php |
| 98 | - } |
|
| 99 | - ?> |
|
| 98 | + } |
|
| 99 | + ?> |
|
| 100 | 100 | </div> |
| 101 | 101 | </div> |
| 102 | 102 | |
@@ -105,64 +105,64 @@ discard block |
||
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | 107 | function run() { |
| 108 | - global $modx, $_lang; |
|
| 108 | + global $modx, $_lang; |
|
| 109 | 109 | |
| 110 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 111 | - $output = ''; |
|
| 112 | - $maxtime = $_POST['maxtime']; |
|
| 110 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 111 | + $output = ''; |
|
| 112 | + $maxtime = $_POST['maxtime']; |
|
| 113 | 113 | |
| 114 | - if(!is_numeric($maxtime)) { |
|
| 115 | - $maxtime = 30; |
|
| 116 | - } |
|
| 114 | + if(!is_numeric($maxtime)) { |
|
| 115 | + $maxtime = 30; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - @set_time_limit($maxtime); |
|
| 118 | + @set_time_limit($maxtime); |
|
| 119 | 119 | |
| 120 | - $mtime = microtime(); |
|
| 121 | - $mtime = explode(' ', $mtime); |
|
| 122 | - $mtime = $mtime[1] + $mtime[0]; |
|
| 123 | - $importstart = $mtime; |
|
| 120 | + $mtime = microtime(); |
|
| 121 | + $mtime = explode(' ', $mtime); |
|
| 122 | + $mtime = $mtime[1] + $mtime[0]; |
|
| 123 | + $importstart = $mtime; |
|
| 124 | 124 | |
| 125 | - if($_POST['reset'] == 'on') { |
|
| 126 | - $modx->db->truncate($tbl_site_content); |
|
| 127 | - $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
| 128 | - } |
|
| 125 | + if($_POST['reset'] == 'on') { |
|
| 126 | + $modx->db->truncate($tbl_site_content); |
|
| 127 | + $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - $parent = (int)$_POST['parent']; |
|
| 130 | + $parent = (int)$_POST['parent']; |
|
| 131 | 131 | |
| 132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 136 | - } else { |
|
| 132 | + if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 133 | + $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 134 | + } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 135 | + $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 136 | + } else { |
|
| 137 | 137 | $filedir = ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $filesfound = 0; |
|
| 140 | + $filesfound = 0; |
|
| 141 | 141 | |
| 142 | - $files = getFiles($filedir); |
|
| 143 | - $files = pop_index($files); |
|
| 142 | + $files = getFiles($filedir); |
|
| 143 | + $files = pop_index($files); |
|
| 144 | 144 | |
| 145 | - // no. of files to import |
|
| 146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 145 | + // no. of files to import |
|
| 146 | + $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 147 | 147 | |
| 148 | - // import files |
|
| 149 | - if(0 < count($files)) { |
|
| 150 | - $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
| 151 | - importFiles($parent, $filedir, $files, 'root'); |
|
| 152 | - } |
|
| 148 | + // import files |
|
| 149 | + if(0 < count($files)) { |
|
| 150 | + $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
| 151 | + importFiles($parent, $filedir, $files, 'root'); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $mtime = microtime(); |
|
| 155 | - $mtime = explode(' ', $mtime); |
|
| 156 | - $mtime = $mtime[1] + $mtime[0]; |
|
| 157 | - $importend = $mtime; |
|
| 158 | - $totaltime = ($importend - $importstart); |
|
| 159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 154 | + $mtime = microtime(); |
|
| 155 | + $mtime = explode(' ', $mtime); |
|
| 156 | + $mtime = $mtime[1] + $mtime[0]; |
|
| 157 | + $importend = $mtime; |
|
| 158 | + $totaltime = ($importend - $importstart); |
|
| 159 | + $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 160 | 160 | |
| 161 | - if($_POST['convert_link'] == 'on') { |
|
| 162 | - convertLink(); |
|
| 163 | - } |
|
| 161 | + if($_POST['convert_link'] == 'on') { |
|
| 162 | + convertLink(); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - return $output; |
|
| 165 | + return $output; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -172,144 +172,144 @@ discard block |
||
| 172 | 172 | * @param string $mode |
| 173 | 173 | */ |
| 174 | 174 | function importFiles($parent, $filedir, $files, $mode) { |
| 175 | - global $modx; |
|
| 176 | - global $_lang, $allowedfiles; |
|
| 177 | - global $search_default, $cache_default, $publish_default; |
|
| 178 | - |
|
| 179 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 180 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
| 181 | - |
|
| 182 | - $createdby = $modx->getLoginUserID(); |
|
| 183 | - if(!is_array($files)) { |
|
| 184 | - return; |
|
| 185 | - } |
|
| 186 | - if($_POST['object'] === 'all') { |
|
| 187 | - $modx->config['default_template'] = '0'; |
|
| 188 | - $richtext = '0'; |
|
| 189 | - } else { |
|
| 190 | - $richtext = '1'; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - foreach($files as $id => $value) { |
|
| 194 | - if(is_array($value)) { |
|
| 195 | - // create folder |
|
| 196 | - $alias = $id; |
|
| 197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 198 | - $field = array(); |
|
| 199 | - $field['type'] = 'document'; |
|
| 200 | - $field['contentType'] = 'text/html'; |
|
| 201 | - $field['published'] = $publish_default; |
|
| 202 | - $field['parent'] = $parent; |
|
| 203 | - $field['alias'] = $modx->stripAlias($alias); |
|
| 204 | - $field['richtext'] = $richtext; |
|
| 205 | - $field['template'] = $modx->config['default_template']; |
|
| 206 | - $field['searchable'] = $search_default; |
|
| 207 | - $field['cacheable'] = $cache_default; |
|
| 208 | - $field['createdby'] = $createdby; |
|
| 209 | - $field['isfolder'] = 1; |
|
| 210 | - $field['menuindex'] = 1; |
|
| 211 | - $find = false; |
|
| 212 | - foreach(array( |
|
| 213 | - 'index.html', |
|
| 214 | - 'index.htm' |
|
| 215 | - ) as $filename) { |
|
| 216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
| 217 | - if($find === false && file_exists($filepath)) { |
|
| 218 | - $file = getFileContent($filepath); |
|
| 219 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 220 | - |
|
| 221 | - $date = filemtime($filepath); |
|
| 222 | - $field['pagetitle'] = $pagetitle; |
|
| 223 | - $field['longtitle'] = $pagetitle; |
|
| 224 | - $field['description'] = $description; |
|
| 225 | - $field['content'] = $modx->db->escape($content); |
|
| 226 | - $field['createdon'] = $date; |
|
| 227 | - $field['editedon'] = $date; |
|
| 228 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 229 | - if($newid) { |
|
| 230 | - $find = true; |
|
| 231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 233 | - } else { |
|
| 234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 235 | - exit; |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - if($find === false) { |
|
| 240 | - $date = time(); |
|
| 241 | - $field['pagetitle'] = '---'; |
|
| 242 | - $field['content'] = ''; |
|
| 243 | - $field['createdon'] = $date; |
|
| 244 | - $field['editedon'] = $date; |
|
| 245 | - $field['hidemenu'] = '1'; |
|
| 246 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 247 | - if($newid) { |
|
| 248 | - $find = true; |
|
| 249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 251 | - } else { |
|
| 252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 253 | - exit; |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - } else { |
|
| 257 | - // create document |
|
| 258 | - if($mode == 'sub' && $value == 'index.html') { |
|
| 259 | - continue; |
|
| 260 | - } |
|
| 261 | - $filename = $value; |
|
| 262 | - $fparts = explode('.', $value); |
|
| 263 | - $alias = $fparts[0]; |
|
| 264 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
| 265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 266 | - |
|
| 267 | - if(!in_array($ext, $allowedfiles)) { |
|
| 268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 269 | - } else { |
|
| 270 | - $filepath = $filedir . $filename; |
|
| 271 | - $file = getFileContent($filepath); |
|
| 272 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 273 | - |
|
| 274 | - $date = filemtime($filepath); |
|
| 275 | - $field = array(); |
|
| 276 | - $field['type'] = 'document'; |
|
| 277 | - $field['contentType'] = 'text/html'; |
|
| 278 | - $field['pagetitle'] = $pagetitle; |
|
| 279 | - $field['longtitle'] = $pagetitle; |
|
| 280 | - $field['description'] = $description; |
|
| 281 | - $field['alias'] = $modx->stripAlias($alias); |
|
| 282 | - $field['published'] = $publish_default; |
|
| 283 | - $field['parent'] = $parent; |
|
| 284 | - $field['content'] = $modx->db->escape($content); |
|
| 285 | - $field['richtext'] = $richtext; |
|
| 286 | - $field['template'] = $modx->config['default_template']; |
|
| 287 | - $field['searchable'] = $search_default; |
|
| 288 | - $field['cacheable'] = $cache_default; |
|
| 289 | - $field['createdby'] = $createdby; |
|
| 290 | - $field['createdon'] = $date; |
|
| 291 | - $field['editedon'] = $date; |
|
| 292 | - $field['isfolder'] = 0; |
|
| 293 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
| 294 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 295 | - if($newid) { |
|
| 296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 297 | - } else { |
|
| 298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 299 | - exit; |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - $is_site_start = false; |
|
| 303 | - if($filename == 'index.html') { |
|
| 304 | - $is_site_start = true; |
|
| 305 | - } |
|
| 306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 307 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
| 308 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - } |
|
| 312 | - } |
|
| 175 | + global $modx; |
|
| 176 | + global $_lang, $allowedfiles; |
|
| 177 | + global $search_default, $cache_default, $publish_default; |
|
| 178 | + |
|
| 179 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 180 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
| 181 | + |
|
| 182 | + $createdby = $modx->getLoginUserID(); |
|
| 183 | + if(!is_array($files)) { |
|
| 184 | + return; |
|
| 185 | + } |
|
| 186 | + if($_POST['object'] === 'all') { |
|
| 187 | + $modx->config['default_template'] = '0'; |
|
| 188 | + $richtext = '0'; |
|
| 189 | + } else { |
|
| 190 | + $richtext = '1'; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + foreach($files as $id => $value) { |
|
| 194 | + if(is_array($value)) { |
|
| 195 | + // create folder |
|
| 196 | + $alias = $id; |
|
| 197 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 198 | + $field = array(); |
|
| 199 | + $field['type'] = 'document'; |
|
| 200 | + $field['contentType'] = 'text/html'; |
|
| 201 | + $field['published'] = $publish_default; |
|
| 202 | + $field['parent'] = $parent; |
|
| 203 | + $field['alias'] = $modx->stripAlias($alias); |
|
| 204 | + $field['richtext'] = $richtext; |
|
| 205 | + $field['template'] = $modx->config['default_template']; |
|
| 206 | + $field['searchable'] = $search_default; |
|
| 207 | + $field['cacheable'] = $cache_default; |
|
| 208 | + $field['createdby'] = $createdby; |
|
| 209 | + $field['isfolder'] = 1; |
|
| 210 | + $field['menuindex'] = 1; |
|
| 211 | + $find = false; |
|
| 212 | + foreach(array( |
|
| 213 | + 'index.html', |
|
| 214 | + 'index.htm' |
|
| 215 | + ) as $filename) { |
|
| 216 | + $filepath = $filedir . $alias . '/' . $filename; |
|
| 217 | + if($find === false && file_exists($filepath)) { |
|
| 218 | + $file = getFileContent($filepath); |
|
| 219 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 220 | + |
|
| 221 | + $date = filemtime($filepath); |
|
| 222 | + $field['pagetitle'] = $pagetitle; |
|
| 223 | + $field['longtitle'] = $pagetitle; |
|
| 224 | + $field['description'] = $description; |
|
| 225 | + $field['content'] = $modx->db->escape($content); |
|
| 226 | + $field['createdon'] = $date; |
|
| 227 | + $field['editedon'] = $date; |
|
| 228 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 229 | + if($newid) { |
|
| 230 | + $find = true; |
|
| 231 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 232 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 233 | + } else { |
|
| 234 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 235 | + exit; |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + if($find === false) { |
|
| 240 | + $date = time(); |
|
| 241 | + $field['pagetitle'] = '---'; |
|
| 242 | + $field['content'] = ''; |
|
| 243 | + $field['createdon'] = $date; |
|
| 244 | + $field['editedon'] = $date; |
|
| 245 | + $field['hidemenu'] = '1'; |
|
| 246 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 247 | + if($newid) { |
|
| 248 | + $find = true; |
|
| 249 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 250 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 251 | + } else { |
|
| 252 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 253 | + exit; |
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | + } else { |
|
| 257 | + // create document |
|
| 258 | + if($mode == 'sub' && $value == 'index.html') { |
|
| 259 | + continue; |
|
| 260 | + } |
|
| 261 | + $filename = $value; |
|
| 262 | + $fparts = explode('.', $value); |
|
| 263 | + $alias = $fparts[0]; |
|
| 264 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
| 265 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 266 | + |
|
| 267 | + if(!in_array($ext, $allowedfiles)) { |
|
| 268 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 269 | + } else { |
|
| 270 | + $filepath = $filedir . $filename; |
|
| 271 | + $file = getFileContent($filepath); |
|
| 272 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
| 273 | + |
|
| 274 | + $date = filemtime($filepath); |
|
| 275 | + $field = array(); |
|
| 276 | + $field['type'] = 'document'; |
|
| 277 | + $field['contentType'] = 'text/html'; |
|
| 278 | + $field['pagetitle'] = $pagetitle; |
|
| 279 | + $field['longtitle'] = $pagetitle; |
|
| 280 | + $field['description'] = $description; |
|
| 281 | + $field['alias'] = $modx->stripAlias($alias); |
|
| 282 | + $field['published'] = $publish_default; |
|
| 283 | + $field['parent'] = $parent; |
|
| 284 | + $field['content'] = $modx->db->escape($content); |
|
| 285 | + $field['richtext'] = $richtext; |
|
| 286 | + $field['template'] = $modx->config['default_template']; |
|
| 287 | + $field['searchable'] = $search_default; |
|
| 288 | + $field['cacheable'] = $cache_default; |
|
| 289 | + $field['createdby'] = $createdby; |
|
| 290 | + $field['createdon'] = $date; |
|
| 291 | + $field['editedon'] = $date; |
|
| 292 | + $field['isfolder'] = 0; |
|
| 293 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
| 294 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
| 295 | + if($newid) { |
|
| 296 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 297 | + } else { |
|
| 298 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 299 | + exit; |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + $is_site_start = false; |
|
| 303 | + if($filename == 'index.html') { |
|
| 304 | + $is_site_start = true; |
|
| 305 | + } |
|
| 306 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
| 307 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
| 308 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -319,27 +319,27 @@ discard block |
||
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | 321 | function getFiles($directory, $listing = array(), $count = 0) { |
| 322 | - global $_lang; |
|
| 323 | - global $filesfound; |
|
| 324 | - $dummy = $count; |
|
| 325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
| 326 | - foreach($files as $file) { |
|
| 327 | - if($file == '.' || $file == '..') { |
|
| 328 | - continue; |
|
| 329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
| 330 | - closedir($h); |
|
| 331 | - $count = -1; |
|
| 332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 333 | - } elseif(strpos($file, '.htm') !== false) { |
|
| 334 | - $listing[$dummy] = $file; |
|
| 335 | - $dummy = $dummy + 1; |
|
| 336 | - $filesfound++; |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - } else { |
|
| 340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 341 | - } |
|
| 342 | - return ($listing); |
|
| 322 | + global $_lang; |
|
| 323 | + global $filesfound; |
|
| 324 | + $dummy = $count; |
|
| 325 | + if( ! empty($directory) && $files = scandir($directory)) { |
|
| 326 | + foreach($files as $file) { |
|
| 327 | + if($file == '.' || $file == '..') { |
|
| 328 | + continue; |
|
| 329 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
| 330 | + closedir($h); |
|
| 331 | + $count = -1; |
|
| 332 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 333 | + } elseif(strpos($file, '.htm') !== false) { |
|
| 334 | + $listing[$dummy] = $file; |
|
| 335 | + $dummy = $dummy + 1; |
|
| 336 | + $filesfound++; |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + } else { |
|
| 340 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 341 | + } |
|
| 342 | + return ($listing); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | * @return bool|string |
| 348 | 348 | */ |
| 349 | 349 | function getFileContent($filepath) { |
| 350 | - global $_lang; |
|
| 351 | - // get the file |
|
| 352 | - if(!$buffer = file_get_contents($filepath)) { |
|
| 353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 354 | - } else { |
|
| 355 | - return $buffer; |
|
| 356 | - } |
|
| 350 | + global $_lang; |
|
| 351 | + // get the file |
|
| 352 | + if(!$buffer = file_get_contents($filepath)) { |
|
| 353 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 354 | + } else { |
|
| 355 | + return $buffer; |
|
| 356 | + } |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -361,20 +361,20 @@ discard block |
||
| 361 | 361 | * @return array |
| 362 | 362 | */ |
| 363 | 363 | function pop_index($array) { |
| 364 | - $new_array = array(); |
|
| 365 | - foreach($array as $k => $v) { |
|
| 366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 367 | - $new_array[$k] = $v; |
|
| 368 | - } else { |
|
| 369 | - array_unshift($new_array, $v); |
|
| 370 | - } |
|
| 371 | - } |
|
| 372 | - foreach($array as $k => $v) { |
|
| 373 | - if(is_array($v)) { |
|
| 374 | - $new_array[$k] = $v; |
|
| 375 | - } |
|
| 376 | - } |
|
| 377 | - return $new_array; |
|
| 364 | + $new_array = array(); |
|
| 365 | + foreach($array as $k => $v) { |
|
| 366 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
| 367 | + $new_array[$k] = $v; |
|
| 368 | + } else { |
|
| 369 | + array_unshift($new_array, $v); |
|
| 370 | + } |
|
| 371 | + } |
|
| 372 | + foreach($array as $k => $v) { |
|
| 373 | + if(is_array($v)) { |
|
| 374 | + $new_array[$k] = $v; |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | + return $new_array; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -384,108 +384,108 @@ discard block |
||
| 384 | 384 | * @return array |
| 385 | 385 | */ |
| 386 | 386 | function treatContent($src, $filename, $alias) { |
| 387 | - global $modx; |
|
| 388 | - |
|
| 389 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
| 390 | - |
|
| 391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 392 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 393 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
| 394 | - } else { |
|
| 395 | - $pagetitle = $alias; |
|
| 396 | - } |
|
| 397 | - if(!$pagetitle) { |
|
| 398 | - $pagetitle = $alias; |
|
| 399 | - } |
|
| 400 | - |
|
| 401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 402 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 403 | - $description = str_replace('[*description*]', '', $description); |
|
| 404 | - } else { |
|
| 405 | - $description = ''; |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 409 | - $content = $matches[1]; |
|
| 410 | - } else { |
|
| 411 | - $content = $src; |
|
| 412 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
| 413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 414 | - $content = preg_replace($s, $r, $content); |
|
| 415 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
| 416 | - } |
|
| 417 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
| 418 | - $content = trim($content); |
|
| 419 | - $pagetitle = $modx->db->escape($pagetitle); |
|
| 420 | - return array( |
|
| 421 | - $pagetitle, |
|
| 422 | - $content, |
|
| 423 | - $description |
|
| 424 | - ); |
|
| 387 | + global $modx; |
|
| 388 | + |
|
| 389 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
| 390 | + |
|
| 391 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
| 392 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 393 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
| 394 | + } else { |
|
| 395 | + $pagetitle = $alias; |
|
| 396 | + } |
|
| 397 | + if(!$pagetitle) { |
|
| 398 | + $pagetitle = $alias; |
|
| 399 | + } |
|
| 400 | + |
|
| 401 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
| 402 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
| 403 | + $description = str_replace('[*description*]', '', $description); |
|
| 404 | + } else { |
|
| 405 | + $description = ''; |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
| 409 | + $content = $matches[1]; |
|
| 410 | + } else { |
|
| 411 | + $content = $src; |
|
| 412 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
| 413 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 414 | + $content = preg_replace($s, $r, $content); |
|
| 415 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
| 416 | + } |
|
| 417 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
| 418 | + $content = trim($content); |
|
| 419 | + $pagetitle = $modx->db->escape($pagetitle); |
|
| 420 | + return array( |
|
| 421 | + $pagetitle, |
|
| 422 | + $content, |
|
| 423 | + $description |
|
| 424 | + ); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | 428 | * @return void |
| 429 | 429 | */ |
| 430 | 430 | function convertLink() { |
| 431 | - global $modx; |
|
| 432 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 431 | + global $modx; |
|
| 432 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
| 433 | 433 | |
| 434 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
| 435 | - $p = array(); |
|
| 434 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
| 435 | + $p = array(); |
|
| 436 | 436 | $target = array(); |
| 437 | - $dir = ''; |
|
| 438 | - while($row = $modx->db->getRow($rs)) { |
|
| 439 | - $id = $row['id']; |
|
| 440 | - $array = explode('<a href=', $row['content']); |
|
| 441 | - $c = 0; |
|
| 442 | - foreach($array as $v) { |
|
| 443 | - if($v[0] === '"') { |
|
| 444 | - $v = substr($v, 1); |
|
| 445 | - list($href, $v) = explode('"', $v, 2); |
|
| 446 | - $_ = $href; |
|
| 447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 449 | - } |
|
| 450 | - if($_[0] === '/') { |
|
| 451 | - $_ = substr($_, 1); |
|
| 452 | - } |
|
| 453 | - $_ = str_replace('/index.html', '.html', $_); |
|
| 454 | - $level = substr_count($_, '../'); |
|
| 455 | - if(1 < $level) { |
|
| 456 | - if(!isset($p[$id])) { |
|
| 457 | - $p[$id] = $modx->getParentIds($id); |
|
| 458 | - } |
|
| 459 | - $k = array_keys($p[$id]); |
|
| 460 | - while(0 < $level) { |
|
| 461 | - $dir = array_shift($k); |
|
| 462 | - $level--; |
|
| 463 | - } |
|
| 464 | - if($dir != '') { |
|
| 465 | - $dir .= '/'; |
|
| 466 | - } |
|
| 467 | - } else { |
|
| 468 | - $dir = ''; |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - $_ = trim($_, './'); |
|
| 472 | - if(strpos($_, '/') !== false) { |
|
| 473 | - $_ = substr($_, strrpos($_, '/')); |
|
| 474 | - } |
|
| 475 | - $_ = $dir . str_replace('.html', '', $_); |
|
| 476 | - if(!isset($target[$_])) { |
|
| 477 | - $target[$_] = $modx->getIdFromAlias($_); |
|
| 478 | - } |
|
| 479 | - $target[$_] = trim($target[$_]); |
|
| 480 | - if(!empty($target[$_])) { |
|
| 481 | - $href = '[~' . $target[$_] . '~]'; |
|
| 482 | - } |
|
| 483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 484 | - } |
|
| 485 | - $c++; |
|
| 486 | - } |
|
| 487 | - $content = implode('', $array); |
|
| 488 | - $f['content'] = $modx->db->escape($content); |
|
| 489 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
| 490 | - } |
|
| 437 | + $dir = ''; |
|
| 438 | + while($row = $modx->db->getRow($rs)) { |
|
| 439 | + $id = $row['id']; |
|
| 440 | + $array = explode('<a href=', $row['content']); |
|
| 441 | + $c = 0; |
|
| 442 | + foreach($array as $v) { |
|
| 443 | + if($v[0] === '"') { |
|
| 444 | + $v = substr($v, 1); |
|
| 445 | + list($href, $v) = explode('"', $v, 2); |
|
| 446 | + $_ = $href; |
|
| 447 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
| 448 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 449 | + } |
|
| 450 | + if($_[0] === '/') { |
|
| 451 | + $_ = substr($_, 1); |
|
| 452 | + } |
|
| 453 | + $_ = str_replace('/index.html', '.html', $_); |
|
| 454 | + $level = substr_count($_, '../'); |
|
| 455 | + if(1 < $level) { |
|
| 456 | + if(!isset($p[$id])) { |
|
| 457 | + $p[$id] = $modx->getParentIds($id); |
|
| 458 | + } |
|
| 459 | + $k = array_keys($p[$id]); |
|
| 460 | + while(0 < $level) { |
|
| 461 | + $dir = array_shift($k); |
|
| 462 | + $level--; |
|
| 463 | + } |
|
| 464 | + if($dir != '') { |
|
| 465 | + $dir .= '/'; |
|
| 466 | + } |
|
| 467 | + } else { |
|
| 468 | + $dir = ''; |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + $_ = trim($_, './'); |
|
| 472 | + if(strpos($_, '/') !== false) { |
|
| 473 | + $_ = substr($_, strrpos($_, '/')); |
|
| 474 | + } |
|
| 475 | + $_ = $dir . str_replace('.html', '', $_); |
|
| 476 | + if(!isset($target[$_])) { |
|
| 477 | + $target[$_] = $modx->getIdFromAlias($_); |
|
| 478 | + } |
|
| 479 | + $target[$_] = trim($target[$_]); |
|
| 480 | + if(!empty($target[$_])) { |
|
| 481 | + $href = '[~' . $target[$_] . '~]'; |
|
| 482 | + } |
|
| 483 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 484 | + } |
|
| 485 | + $c++; |
|
| 486 | + } |
|
| 487 | + $content = implode('', $array); |
|
| 488 | + $f['content'] = $modx->db->escape($content); |
|
| 489 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
| 490 | + } |
|
| 491 | 491 | } |
@@ -1,21 +1,21 @@ 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 | |
| 6 | 6 | switch((int) $modx->manager->action) { |
| 7 | - case 35: |
|
| 8 | - if(!$modx->hasPermission('edit_role')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 38: |
|
| 13 | - if(!$modx->hasPermission('new_role')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 35: |
|
| 8 | + if(!$modx->hasPermission('edit_role')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 38: |
|
| 13 | + if(!$modx->hasPermission('new_role')) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // check to see the snippet editor isn't locked |
| 26 | 26 | if($lockedEl = $modx->elementIsLocked(8, $role)) { |
| 27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | $modx->lockElement(8, $role); |
| 33 | 33 | |
| 34 | 34 | if($modx->manager->action == '35') { |
| 35 | - $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
| 36 | - $roledata = $modx->db->getRow($rs); |
|
| 37 | - if(!$roledata) { |
|
| 38 | - $modx->webAlertAndQuit("No role returned!"); |
|
| 39 | - } |
|
| 40 | - $_SESSION['itemname'] = $roledata['name']; |
|
| 35 | + $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
| 36 | + $roledata = $modx->db->getRow($rs); |
|
| 37 | + if(!$roledata) { |
|
| 38 | + $modx->webAlertAndQuit("No role returned!"); |
|
| 39 | + } |
|
| 40 | + $_SESSION['itemname'] = $roledata['name']; |
|
| 41 | 41 | } else { |
| 42 | - $roledata = 0; |
|
| 43 | - $_SESSION['itemname'] = $_lang["new_role"]; |
|
| 42 | + $roledata = 0; |
|
| 43 | + $_SESSION['itemname'] = $_lang["new_role"]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Add lock-element JS-Script |
@@ -107,63 +107,63 @@ discard block |
||
| 107 | 107 | <div class="form-group"> |
| 108 | 108 | <h3><?= $_lang['page_data_general'] ?></h3> |
| 109 | 109 | <?php |
| 110 | - echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
| 111 | - echo render_form('home', $_lang['role_home'], 'disabled'); |
|
| 112 | - echo render_form('messages', $_lang['role_messages']); |
|
| 113 | - echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
| 114 | - echo render_form('help', $_lang['role_help']); |
|
| 115 | - echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
| 116 | - echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
| 117 | - echo render_form('about', $_lang['role_about'], 'disabled'); |
|
| 118 | - echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
| 119 | - echo render_form('change_password', $_lang['role_change_password']); |
|
| 120 | - echo render_form('save_password', $_lang['role_save_password']); |
|
| 121 | - ?> |
|
| 110 | + echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
| 111 | + echo render_form('home', $_lang['role_home'], 'disabled'); |
|
| 112 | + echo render_form('messages', $_lang['role_messages']); |
|
| 113 | + echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
| 114 | + echo render_form('help', $_lang['role_help']); |
|
| 115 | + echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
| 116 | + echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
| 117 | + echo render_form('about', $_lang['role_about'], 'disabled'); |
|
| 118 | + echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
| 119 | + echo render_form('change_password', $_lang['role_change_password']); |
|
| 120 | + echo render_form('save_password', $_lang['role_save_password']); |
|
| 121 | + ?> |
|
| 122 | 122 | </div> |
| 123 | 123 | </div> |
| 124 | 124 | <div class="col-sm-6 col-lg-3"> |
| 125 | 125 | <div class="form-group"> |
| 126 | 126 | <h3><?= $_lang['role_content_management'] ?></h3> |
| 127 | 127 | <?php |
| 128 | - echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
| 129 | - echo render_form('new_document', $_lang['role_create_doc']); |
|
| 130 | - echo render_form('edit_document', $_lang['role_edit_doc']); |
|
| 131 | - echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
| 132 | - echo render_form('save_document', $_lang['role_save_doc']); |
|
| 133 | - echo render_form('publish_document', $_lang['role_publish_doc']); |
|
| 134 | - echo render_form('delete_document', $_lang['role_delete_doc']); |
|
| 135 | - echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
| 136 | - echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
| 137 | - echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
| 138 | - ?> |
|
| 128 | + echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
| 129 | + echo render_form('new_document', $_lang['role_create_doc']); |
|
| 130 | + echo render_form('edit_document', $_lang['role_edit_doc']); |
|
| 131 | + echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
| 132 | + echo render_form('save_document', $_lang['role_save_doc']); |
|
| 133 | + echo render_form('publish_document', $_lang['role_publish_doc']); |
|
| 134 | + echo render_form('delete_document', $_lang['role_delete_doc']); |
|
| 135 | + echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
| 136 | + echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
| 137 | + echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
| 138 | + ?> |
|
| 139 | 139 | </div> |
| 140 | 140 | </div> |
| 141 | 141 | <div class="col-sm-6 col-lg-3 form-group"> |
| 142 | 142 | <div class="form-group"> |
| 143 | 143 | <h3><?= $_lang['role_file_management'] ?></h3> |
| 144 | 144 | <?php |
| 145 | - echo render_form('file_manager', $_lang['role_file_manager']); |
|
| 146 | - echo render_form('assets_files', $_lang['role_assets_files']); |
|
| 147 | - echo render_form('assets_images', $_lang['role_assets_images']); |
|
| 148 | - ?> |
|
| 145 | + echo render_form('file_manager', $_lang['role_file_manager']); |
|
| 146 | + echo render_form('assets_files', $_lang['role_assets_files']); |
|
| 147 | + echo render_form('assets_images', $_lang['role_assets_images']); |
|
| 148 | + ?> |
|
| 149 | 149 | </div> |
| 150 | 150 | <div class="form-group"> |
| 151 | 151 | <h3><?= $_lang['category_management'] ?></h3> |
| 152 | 152 | <?php |
| 153 | - echo render_form('category_manager', $_lang['role_category_manager']); |
|
| 154 | - ?> |
|
| 153 | + echo render_form('category_manager', $_lang['role_category_manager']); |
|
| 154 | + ?> |
|
| 155 | 155 | </div> |
| 156 | 156 | </div> |
| 157 | 157 | <div class="col-sm-6 col-lg-3"> |
| 158 | 158 | <div class="form-group"> |
| 159 | 159 | <h3><?= $_lang['role_module_management'] ?></h3> |
| 160 | 160 | <?php |
| 161 | - echo render_form('new_module', $_lang['role_new_module']); |
|
| 162 | - echo render_form('edit_module', $_lang['role_edit_module']); |
|
| 163 | - echo render_form('save_module', $_lang['role_save_module']); |
|
| 164 | - echo render_form('delete_module', $_lang['role_delete_module']); |
|
| 165 | - echo render_form('exec_module', $_lang['role_run_module']); |
|
| 166 | - ?> |
|
| 161 | + echo render_form('new_module', $_lang['role_new_module']); |
|
| 162 | + echo render_form('edit_module', $_lang['role_edit_module']); |
|
| 163 | + echo render_form('save_module', $_lang['role_save_module']); |
|
| 164 | + echo render_form('delete_module', $_lang['role_delete_module']); |
|
| 165 | + echo render_form('exec_module', $_lang['role_run_module']); |
|
| 166 | + ?> |
|
| 167 | 167 | </div> |
| 168 | 168 | </div> |
| 169 | 169 | </div> |
@@ -173,44 +173,44 @@ discard block |
||
| 173 | 173 | <div class="form-group"> |
| 174 | 174 | <h3><?= $_lang['role_template_management'] ?></h3> |
| 175 | 175 | <?php |
| 176 | - echo render_form('new_template', $_lang['role_create_template']); |
|
| 177 | - echo render_form('edit_template', $_lang['role_edit_template']); |
|
| 178 | - echo render_form('save_template', $_lang['role_save_template']); |
|
| 179 | - echo render_form('delete_template', $_lang['role_delete_template']); |
|
| 180 | - ?> |
|
| 176 | + echo render_form('new_template', $_lang['role_create_template']); |
|
| 177 | + echo render_form('edit_template', $_lang['role_edit_template']); |
|
| 178 | + echo render_form('save_template', $_lang['role_save_template']); |
|
| 179 | + echo render_form('delete_template', $_lang['role_delete_template']); |
|
| 180 | + ?> |
|
| 181 | 181 | </div> |
| 182 | 182 | </div> |
| 183 | 183 | <div class="col-sm-6 col-lg-3"> |
| 184 | 184 | <div class="form-group"> |
| 185 | 185 | <h3><?= $_lang['role_snippet_management'] ?></h3> |
| 186 | 186 | <?php |
| 187 | - echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
| 188 | - echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
| 189 | - echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
| 190 | - echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
| 191 | - ?> |
|
| 187 | + echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
| 188 | + echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
| 189 | + echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
| 190 | + echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
| 191 | + ?> |
|
| 192 | 192 | </div> |
| 193 | 193 | </div> |
| 194 | 194 | <div class="col-sm-6 col-lg-3"> |
| 195 | 195 | <div class="form-group"> |
| 196 | 196 | <h3><?= $_lang['role_chunk_management'] ?></h3> |
| 197 | 197 | <?php |
| 198 | - echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
| 199 | - echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
| 200 | - echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
| 201 | - echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
| 202 | - ?> |
|
| 198 | + echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
| 199 | + echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
| 200 | + echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
| 201 | + echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
| 202 | + ?> |
|
| 203 | 203 | </div> |
| 204 | 204 | </div> |
| 205 | 205 | <div class="col-sm-6 col-lg-3"> |
| 206 | 206 | <div class="form-group"> |
| 207 | 207 | <h3><?= $_lang['role_plugin_management'] ?></h3> |
| 208 | 208 | <?php |
| 209 | - echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
| 210 | - echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
| 211 | - echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
| 212 | - echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
| 213 | - ?> |
|
| 209 | + echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
| 210 | + echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
| 211 | + echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
| 212 | + echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
| 213 | + ?> |
|
| 214 | 214 | </div> |
| 215 | 215 | </div> |
| 216 | 216 | </div> |
@@ -220,42 +220,42 @@ discard block |
||
| 220 | 220 | <div class="form-group"> |
| 221 | 221 | <h3><?= $_lang['role_user_management'] ?></h3> |
| 222 | 222 | <?php |
| 223 | - echo render_form('new_user', $_lang['role_new_user']); |
|
| 224 | - echo render_form('edit_user', $_lang['role_edit_user']); |
|
| 225 | - echo render_form('save_user', $_lang['role_save_user']); |
|
| 226 | - echo render_form('delete_user', $_lang['role_delete_user']); |
|
| 227 | - ?> |
|
| 223 | + echo render_form('new_user', $_lang['role_new_user']); |
|
| 224 | + echo render_form('edit_user', $_lang['role_edit_user']); |
|
| 225 | + echo render_form('save_user', $_lang['role_save_user']); |
|
| 226 | + echo render_form('delete_user', $_lang['role_delete_user']); |
|
| 227 | + ?> |
|
| 228 | 228 | </div> |
| 229 | 229 | </div> |
| 230 | 230 | <div class="col-sm-6 col-lg-3"> |
| 231 | 231 | <div class="form-group"> |
| 232 | 232 | <h3><?= $_lang['role_web_user_management'] ?></h3> |
| 233 | 233 | <?php |
| 234 | - echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
| 235 | - echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
| 236 | - echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
| 237 | - echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
| 238 | - ?> |
|
| 234 | + echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
| 235 | + echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
| 236 | + echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
| 237 | + echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
| 238 | + ?> |
|
| 239 | 239 | </div> |
| 240 | 240 | </div> |
| 241 | 241 | <div class="col-sm-6 col-lg-3"> |
| 242 | 242 | <div class="form-group"> |
| 243 | 243 | <h3><?= $_lang['role_udperms'] ?></h3> |
| 244 | 244 | <?php |
| 245 | - echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
| 246 | - echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
| 247 | - ?> |
|
| 245 | + echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
| 246 | + echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
| 247 | + ?> |
|
| 248 | 248 | </div> |
| 249 | 249 | </div> |
| 250 | 250 | <div class="col-sm-6 col-lg-3"> |
| 251 | 251 | <div class="form-group"> |
| 252 | 252 | <h3><?= $_lang['role_role_management'] ?></h3> |
| 253 | 253 | <?php |
| 254 | - echo render_form('new_role', $_lang['role_new_role']); |
|
| 255 | - echo render_form('edit_role', $_lang['role_edit_role']); |
|
| 256 | - echo render_form('save_role', $_lang['role_save_role']); |
|
| 257 | - echo render_form('delete_role', $_lang['role_delete_role']); |
|
| 258 | - ?> |
|
| 254 | + echo render_form('new_role', $_lang['role_new_role']); |
|
| 255 | + echo render_form('edit_role', $_lang['role_edit_role']); |
|
| 256 | + echo render_form('save_role', $_lang['role_save_role']); |
|
| 257 | + echo render_form('delete_role', $_lang['role_delete_role']); |
|
| 258 | + ?> |
|
| 259 | 259 | </div> |
| 260 | 260 | </div> |
| 261 | 261 | </div> |
@@ -265,23 +265,23 @@ discard block |
||
| 265 | 265 | <div class="form-group"> |
| 266 | 266 | <h3><?= $_lang['role_eventlog_management'] ?></h3> |
| 267 | 267 | <?php |
| 268 | - echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
| 269 | - echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
| 270 | - ?> |
|
| 268 | + echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
| 269 | + echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
| 270 | + ?> |
|
| 271 | 271 | </div> |
| 272 | 272 | </div> |
| 273 | 273 | <div class="col-sm-6 col-lg-3"> |
| 274 | 274 | <div class="form-group"> |
| 275 | 275 | <h3><?= $_lang['role_config_management'] ?></h3> |
| 276 | 276 | <?php |
| 277 | - echo render_form('logs', $_lang['role_view_logs']); |
|
| 278 | - echo render_form('settings', $_lang['role_edit_settings']); |
|
| 279 | - echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
| 280 | - echo render_form('import_static', $_lang['role_import_static']); |
|
| 281 | - echo render_form('export_static', $_lang['role_export_static']); |
|
| 282 | - echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
| 283 | - echo render_form('display_locks', $_lang['role_display_locks']); |
|
| 284 | - ?> |
|
| 277 | + echo render_form('logs', $_lang['role_view_logs']); |
|
| 278 | + echo render_form('settings', $_lang['role_edit_settings']); |
|
| 279 | + echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
| 280 | + echo render_form('import_static', $_lang['role_import_static']); |
|
| 281 | + echo render_form('export_static', $_lang['role_export_static']); |
|
| 282 | + echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
| 283 | + echo render_form('display_locks', $_lang['role_display_locks']); |
|
| 284 | + ?> |
|
| 285 | 285 | </div> |
| 286 | 286 | </div> |
| 287 | 287 | </div> |
@@ -300,32 +300,32 @@ discard block |
||
| 300 | 300 | * @return string |
| 301 | 301 | */ |
| 302 | 302 | function render_form($name, $label, $status = '') { |
| 303 | - global $modx, $roledata; |
|
| 303 | + global $modx, $roledata; |
|
| 304 | 304 | |
| 305 | - $tpl = '<label class="d-block" for="[+name+]check"> |
|
| 305 | + $tpl = '<label class="d-block" for="[+name+]check"> |
|
| 306 | 306 | <input name="[+name+]check" id="[+name+]check" class="click" type="checkbox" onchange="changestate(document.userform.[+name+])" [+checked+] [+status+]> |
| 307 | 307 | <input type="hidden" class="[+set+]" name="[+name+]" value="[+value+]"> |
| 308 | 308 | [+label+] |
| 309 | 309 | </label>'; |
| 310 | 310 | |
| 311 | - $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
| 312 | - $value = ($roledata[$name] == 1) ? 1 : 0; |
|
| 313 | - if($status == 'disabled') { |
|
| 314 | - $checked = 'checked'; |
|
| 315 | - $value = 1; |
|
| 316 | - $set = 'fix'; |
|
| 317 | - } else { |
|
| 318 | - $set = 'set'; |
|
| 319 | - } |
|
| 311 | + $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
| 312 | + $value = ($roledata[$name] == 1) ? 1 : 0; |
|
| 313 | + if($status == 'disabled') { |
|
| 314 | + $checked = 'checked'; |
|
| 315 | + $value = 1; |
|
| 316 | + $set = 'fix'; |
|
| 317 | + } else { |
|
| 318 | + $set = 'set'; |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $ph = array( |
|
| 322 | - 'name' => $name, |
|
| 323 | - 'checked' => $checked, |
|
| 324 | - 'status' => $status, |
|
| 325 | - 'value' => $value, |
|
| 326 | - 'label' => $label, |
|
| 327 | - 'set' => $set |
|
| 328 | - ); |
|
| 321 | + $ph = array( |
|
| 322 | + 'name' => $name, |
|
| 323 | + 'checked' => $checked, |
|
| 324 | + 'status' => $status, |
|
| 325 | + 'value' => $value, |
|
| 326 | + 'label' => $label, |
|
| 327 | + 'set' => $set |
|
| 328 | + ); |
|
| 329 | 329 | |
| 330 | - return $modx->parseText($tpl, $ph); |
|
| 330 | + return $modx->parseText($tpl, $ph); |
|
| 331 | 331 | } |
@@ -4,18 +4,18 @@ discard block |
||
| 4 | 4 | } |
| 5 | 5 | $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
| 6 | 6 | $downloadLinks = array( |
| 7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
| 8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
| 9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
| 10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
| 11 | - 'http://extras.evolution-cms.com/', |
|
| 12 | - 'https://github.com/extras-evolution' |
|
| 13 | - )), |
|
| 7 | + 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
| 8 | + 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
| 9 | + 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
| 10 | + 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
| 11 | + 'http://extras.evolution-cms.com/', |
|
| 12 | + 'https://github.com/extras-evolution' |
|
| 13 | + )), |
|
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | 16 | $translationLinks = array( |
| 17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
| 18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
| 17 | + 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
| 18 | + 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
| 19 | 19 | ); |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,23 +24,23 @@ discard block |
||
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | 26 | function createList($sectionHeader, $linkArr) { |
| 27 | - $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
| 28 | - $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
| 29 | - $links = ''; |
|
| 30 | - foreach($linkArr as $row) { |
|
| 31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
| 32 | - foreach ($row['link'] as $link) { |
|
| 33 | - $links .= $links != '' ? '<br/>' : ''; |
|
| 34 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
| 35 | - } |
|
| 36 | - $output .= ' |
|
| 27 | + $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
| 28 | + $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
| 29 | + $links = ''; |
|
| 30 | + foreach($linkArr as $row) { |
|
| 31 | + if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
| 32 | + foreach ($row['link'] as $link) { |
|
| 33 | + $links .= $links != '' ? '<br/>' : ''; |
|
| 34 | + $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
| 35 | + } |
|
| 36 | + $output .= ' |
|
| 37 | 37 | <tr> |
| 38 | 38 | <td align="left"><strong>' . $row["title"] . '</strong></td> |
| 39 | 39 | <td align="left">' . $links . '</td> |
| 40 | 40 | </tr>'; |
| 41 | - $links = ''; |
|
| 42 | - } |
|
| 43 | - $output .= '</table></div>'."\n"; |
|
| 41 | + $links = ''; |
|
| 42 | + } |
|
| 43 | + $output .= '</table></div>'."\n"; |
|
| 44 | 44 | return $output; |
| 45 | 45 | } |
| 46 | 46 | echo $logo; |
@@ -10,178 +10,178 @@ |
||
| 10 | 10 | Class TemplateParser {
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * @param array $config [action, tabs, toArray] |
|
| 14 | - * @param array $data |
|
| 15 | - * @return string |
|
| 16 | - */ |
|
| 17 | - public function output($config = array(), $data = array()) {
|
|
| 18 | - global $modx; |
|
| 19 | - |
|
| 20 | - $output = ''; |
|
| 21 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
| 22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
|
| 23 | - |
|
| 24 | - if($action) {
|
|
| 25 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
|
| 13 | + * @param array $config [action, tabs, toArray] |
|
| 14 | + * @param array $data |
|
| 15 | + * @return string |
|
| 16 | + */ |
|
| 17 | + public function output($config = array(), $data = array()) {
|
|
| 18 | + global $modx; |
|
| 19 | + |
|
| 20 | + $output = ''; |
|
| 21 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
| 22 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
|
| 23 | + |
|
| 24 | + if($action) {
|
|
| 25 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
|
| 26 | 26 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
| 27 | 27 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
| 28 | 28 | WHERE t1.action IN(' . $action . ') ' . $tab . '
|
| 29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 30 | 30 | |
| 31 | - if($modx->db->getRecordCount($sql)) {
|
|
| 32 | - $tabs = array(); |
|
| 33 | - while($row = $modx->db->getRow($sql)) {
|
|
| 34 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 35 | - $row['value'] = $data[$row['name']]; |
|
| 36 | - } |
|
| 37 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
| 38 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - if(!empty($config['toArray'])) {
|
|
| 42 | - $output = $tabs; |
|
| 43 | - } else {
|
|
| 44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
| 45 | - $output .= ' |
|
| 31 | + if($modx->db->getRecordCount($sql)) {
|
|
| 32 | + $tabs = array(); |
|
| 33 | + while($row = $modx->db->getRow($sql)) {
|
|
| 34 | + if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 35 | + $row['value'] = $data[$row['name']]; |
|
| 36 | + } |
|
| 37 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
| 38 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if(!empty($config['toArray'])) {
|
|
| 42 | + $output = $tabs; |
|
| 43 | + } else {
|
|
| 44 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
| 45 | + $output .= ' |
|
| 46 | 46 | <script type="text/javascript"> |
| 47 | 47 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
| 48 | 48 | </script>'; |
| 49 | 49 | |
| 50 | - foreach($tabs as $idTab => $tab) {
|
|
| 51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
| 52 | - $output .= ' |
|
| 50 | + foreach($tabs as $idTab => $tab) {
|
|
| 51 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
| 52 | + $output .= ' |
|
| 53 | 53 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
| 54 | 54 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
| 55 | - unset($tab['category_name']); |
|
| 56 | - foreach($tab as $item) {
|
|
| 57 | - $output .= $item; |
|
| 58 | - } |
|
| 59 | - $output .= '</div>'; |
|
| 60 | - } |
|
| 61 | - $output .= '</div>'; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - return $output; |
|
| 67 | - } |
|
| 55 | + unset($tab['category_name']); |
|
| 56 | + foreach($tab as $item) {
|
|
| 57 | + $output .= $item; |
|
| 58 | + } |
|
| 59 | + $output .= '</div>'; |
|
| 60 | + } |
|
| 61 | + $output .= '</div>'; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + return $output; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @param array $data |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | - private function render($data) {
|
|
| 74 | - global $modx, $_lang, $_country_lang; |
|
| 73 | + private function render($data) {
|
|
| 74 | + global $modx, $_lang, $_country_lang; |
|
| 75 | 75 | |
| 76 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
| 77 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
| 78 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
| 76 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
| 77 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
| 78 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
| 79 | 79 | |
| 80 | - $output = ''; |
|
| 81 | - $output .= '<div class="form-group row">'; |
|
| 80 | + $output = ''; |
|
| 81 | + $output .= '<div class="form-group row">'; |
|
| 82 | 82 | |
| 83 | - switch($data['type']) {
|
|
| 83 | + switch($data['type']) {
|
|
| 84 | 84 | |
| 85 | - case 'text': |
|
| 86 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 85 | + case 'text': |
|
| 86 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 87 | 87 | <div class="col-sm-7"> |
| 88 | 88 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 89 | - $output .= $data['content']; |
|
| 90 | - $output .= '</div>'; |
|
| 89 | + $output .= $data['content']; |
|
| 90 | + $output .= '</div>'; |
|
| 91 | 91 | |
| 92 | - break; |
|
| 92 | + break; |
|
| 93 | 93 | |
| 94 | - case 'textarea': |
|
| 95 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 94 | + case 'textarea': |
|
| 95 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 96 | 96 | <div class="col-sm-7"> |
| 97 | 97 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
| 98 | - $output .= $data['content']; |
|
| 99 | - $output .= '</div>'; |
|
| 98 | + $output .= $data['content']; |
|
| 99 | + $output .= '</div>'; |
|
| 100 | 100 | |
| 101 | - break; |
|
| 101 | + break; |
|
| 102 | 102 | |
| 103 | - case 'date': |
|
| 104 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
| 105 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 103 | + case 'date': |
|
| 104 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
| 105 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
| 106 | 106 | <div class="col-sm-7"> |
| 107 | 107 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 108 | - $output .= $data['content']; |
|
| 109 | - $output .= '</div>'; |
|
| 110 | - |
|
| 111 | - break; |
|
| 112 | - |
|
| 113 | - case 'select': |
|
| 114 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 115 | - $output .= '<div class="col-sm-7">'; |
|
| 116 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
| 117 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 118 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
| 119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
| 120 | - foreach($_country_lang as $key => $value) {
|
|
| 121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
| 122 | - } |
|
| 123 | - } else {
|
|
| 124 | - if($data['elements']) {
|
|
| 125 | - $elements = explode('||', $data['elements']);
|
|
| 126 | - foreach($elements as $key => $value) {
|
|
| 127 | - $value = explode('==', $value);
|
|
| 128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - $output .= '</select>'; |
|
| 133 | - $output .= $data['content']; |
|
| 134 | - $output .= '</div>'; |
|
| 135 | - |
|
| 136 | - break; |
|
| 137 | - |
|
| 138 | - case 'checkbox': |
|
| 139 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 140 | - $output .= '<div class="col-sm-7">'; |
|
| 141 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 142 | - if($data['elements']) {
|
|
| 143 | - $elements = explode('||', $data['elements']);
|
|
| 144 | - foreach($elements as $key => $value) {
|
|
| 145 | - $value = explode('==', $value);
|
|
| 146 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - $output .= $data['content']; |
|
| 150 | - $output .= '</div>'; |
|
| 151 | - |
|
| 152 | - break; |
|
| 153 | - |
|
| 154 | - case 'radio': |
|
| 155 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 156 | - $output .= '<div class="col-sm-7">'; |
|
| 157 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 158 | - if($data['elements']) {
|
|
| 159 | - $elements = explode('||', $data['elements']);
|
|
| 160 | - foreach($elements as $key => $value) {
|
|
| 161 | - $value = explode('==', $value);
|
|
| 162 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - $output .= $data['content']; |
|
| 166 | - $output .= '</div>'; |
|
| 167 | - |
|
| 168 | - break; |
|
| 169 | - |
|
| 170 | - case 'custom': |
|
| 171 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 172 | - $output .= '<div class="col-sm-7">'; |
|
| 173 | - $output .= $data['content']; |
|
| 174 | - $output .= '</div>'; |
|
| 175 | - |
|
| 176 | - break; |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - $output .= '</div>'; |
|
| 180 | - |
|
| 181 | - $output = $modx->parseText($output, $data); |
|
| 182 | - |
|
| 183 | - return $output; |
|
| 184 | - } |
|
| 108 | + $output .= $data['content']; |
|
| 109 | + $output .= '</div>'; |
|
| 110 | + |
|
| 111 | + break; |
|
| 112 | + |
|
| 113 | + case 'select': |
|
| 114 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 115 | + $output .= '<div class="col-sm-7">'; |
|
| 116 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
| 117 | + if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 118 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
| 119 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
| 120 | + foreach($_country_lang as $key => $value) {
|
|
| 121 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
| 122 | + } |
|
| 123 | + } else {
|
|
| 124 | + if($data['elements']) {
|
|
| 125 | + $elements = explode('||', $data['elements']);
|
|
| 126 | + foreach($elements as $key => $value) {
|
|
| 127 | + $value = explode('==', $value);
|
|
| 128 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + $output .= '</select>'; |
|
| 133 | + $output .= $data['content']; |
|
| 134 | + $output .= '</div>'; |
|
| 135 | + |
|
| 136 | + break; |
|
| 137 | + |
|
| 138 | + case 'checkbox': |
|
| 139 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 140 | + $output .= '<div class="col-sm-7">'; |
|
| 141 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 142 | + if($data['elements']) {
|
|
| 143 | + $elements = explode('||', $data['elements']);
|
|
| 144 | + foreach($elements as $key => $value) {
|
|
| 145 | + $value = explode('==', $value);
|
|
| 146 | + $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + $output .= $data['content']; |
|
| 150 | + $output .= '</div>'; |
|
| 151 | + |
|
| 152 | + break; |
|
| 153 | + |
|
| 154 | + case 'radio': |
|
| 155 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 156 | + $output .= '<div class="col-sm-7">'; |
|
| 157 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
| 158 | + if($data['elements']) {
|
|
| 159 | + $elements = explode('||', $data['elements']);
|
|
| 160 | + foreach($elements as $key => $value) {
|
|
| 161 | + $value = explode('==', $value);
|
|
| 162 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + $output .= $data['content']; |
|
| 166 | + $output .= '</div>'; |
|
| 167 | + |
|
| 168 | + break; |
|
| 169 | + |
|
| 170 | + case 'custom': |
|
| 171 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
| 172 | + $output .= '<div class="col-sm-7">'; |
|
| 173 | + $output .= $data['content']; |
|
| 174 | + $output .= '</div>'; |
|
| 175 | + |
|
| 176 | + break; |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + $output .= '</div>'; |
|
| 180 | + |
|
| 181 | + $output = $modx->parseText($output, $data); |
|
| 182 | + |
|
| 183 | + return $output; |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | } |
| 187 | 187 | |
@@ -5,133 +5,133 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | // action list |
| 7 | 7 | $GLOBALS['action_list'] = array( |
| 8 | - '1' => 'Loading a frame(set)', |
|
| 9 | - '2' => 'Viewing home page/ online users', |
|
| 10 | - '3' => 'Viewing data for resource', |
|
| 11 | - '4' => 'Creating a resource', |
|
| 12 | - '5' => 'Saving resource', |
|
| 13 | - '6' => 'Deleting resource', |
|
| 14 | - '7' => 'Waiting while MODX cleans up', |
|
| 15 | - '8' => 'Logged out', |
|
| 16 | - '9' => 'Viewing help', |
|
| 17 | - '10' => 'Viewing/ composing messages', |
|
| 18 | - '11' => 'Creating a user', |
|
| 19 | - '12' => 'Editing user', |
|
| 20 | - '13' => 'Viewing logging', |
|
| 21 | - '14' => 'Editing a parser', |
|
| 22 | - '15' => 'Saving a parser', |
|
| 23 | - '16' => 'Editing template', |
|
| 24 | - '17' => 'Editing settings', |
|
| 25 | - '18' => 'Viewing Credits :)', |
|
| 26 | - '19' => 'Creating a new template', |
|
| 27 | - '20' => 'Saving template', |
|
| 28 | - '21' => 'Deleting template', |
|
| 29 | - '22' => 'Editing Snippet', |
|
| 30 | - '23' => 'Creating a new Snippet', |
|
| 31 | - '24' => 'Saving Snippet', |
|
| 32 | - '25' => 'Deleting Snippet', |
|
| 33 | - '26' => 'Refreshing site', |
|
| 34 | - '27' => 'Editing resource', |
|
| 35 | - '28' => 'Changing password', |
|
| 36 | - '29' => 'Error', |
|
| 37 | - '30' => 'Saving settings', |
|
| 38 | - '31' => 'Using file manager', |
|
| 39 | - '32' => 'Saving user', |
|
| 40 | - '33' => 'Deleting user', |
|
| 41 | - '34' => 'Saving new password', |
|
| 42 | - '35' => 'Editing role', |
|
| 43 | - '36' => 'Saving role', |
|
| 44 | - '37' => 'Deleting role', |
|
| 45 | - '38' => 'Creating new role', |
|
| 46 | - '40' => 'Editing Access Permissions', |
|
| 47 | - '41' => 'Editing Access Permissions', |
|
| 48 | - '42' => 'Editing Access Permissions', |
|
| 49 | - '43' => 'Editing Access Permissions', |
|
| 50 | - '44' => 'Editing Access Permissions', |
|
| 51 | - '45' => 'Idle', |
|
| 52 | - '46' => 'Editing Access Permissions', |
|
| 53 | - '47' => 'Editing Access Permissions', |
|
| 54 | - '48' => 'Editing Access Permissions', |
|
| 55 | - '49' => 'Editing Access Permissions', |
|
| 56 | - '50' => 'Editing Access Permissions', |
|
| 57 | - '51' => 'Moving resource', |
|
| 58 | - '52' => 'Moved resource', |
|
| 59 | - '53' => 'Viewing system info', |
|
| 60 | - '54' => 'Optimizing a table', |
|
| 61 | - '55' => 'Empty logs', |
|
| 62 | - '56' => 'Refresh resource tree', |
|
| 63 | - '57' => 'Refresh menu', |
|
| 64 | - '58' => 'Logged in', |
|
| 65 | - '59' => 'About MODX', |
|
| 66 | - '60' => 'Emptying Recycle Bin', |
|
| 67 | - '61' => 'Publishing a resource', |
|
| 68 | - '62' => 'Un-publishing a resource', |
|
| 69 | - '63' => 'Un-deleting a resource', |
|
| 70 | - '64' => 'Removing deleted content', |
|
| 71 | - '65' => 'Deleting a message', |
|
| 72 | - '66' => 'Sending a message', |
|
| 73 | - '67' => 'Removing locks', |
|
| 74 | - '68' => 'Viewing site logging', |
|
| 75 | - '69' => 'Viewing online visitors', |
|
| 76 | - '70' => 'Viewing site schedule', |
|
| 77 | - '71' => 'Searching', |
|
| 78 | - '72' => 'Adding a weblink', |
|
| 79 | - '73' => 'Editing a weblink', |
|
| 80 | - //case "74" : return "Changing personal preferences"; break; |
|
| 81 | - '75' => 'User/ role management', |
|
| 82 | - '76' => 'Element management', |
|
| 83 | - '77' => 'Creating a new Chunk (HTML Snippet)', |
|
| 84 | - '78' => 'Editing Chunk (HTML Snippet)', |
|
| 85 | - '79' => 'Saving Chunk (HTML Snippet)', |
|
| 86 | - '80' => 'Deleting Chunk (HTML Snippet)', |
|
| 87 | - '83' => 'Exporting a resource to HTML', |
|
| 88 | - '84' => 'Load Element Selector', |
|
| 89 | - '85' => 'Create Folder', |
|
| 90 | - '86' => 'Role management', |
|
| 91 | - '87' => 'Create new web user', |
|
| 92 | - '88' => 'Editing web user', |
|
| 93 | - '89' => 'Saving web user', |
|
| 94 | - '90' => 'Deleting web user', |
|
| 95 | - '91' => 'Editing Web Access Permissions', |
|
| 96 | - '92' => 'Editing Access Permissions', |
|
| 97 | - '93' => 'Backup Manager', |
|
| 98 | - '94' => 'Duplicate resource', |
|
| 99 | - '95' => 'Importing resources from HTML', |
|
| 100 | - '96' => 'Duplicate Template', |
|
| 101 | - '97' => 'Duplicate Chunk (HTML Snippet)', |
|
| 102 | - '98' => 'Duplicate Snippet', |
|
| 103 | - '99' => 'Manage Web Users', |
|
| 104 | - '100' => 'Previewing resource', |
|
| 105 | - '101' => 'Create new plugin', |
|
| 106 | - '102' => 'Edit plugin', |
|
| 107 | - '103' => 'Saving plugin', |
|
| 108 | - '104' => 'Delete plugin', |
|
| 109 | - '105' => 'Duplicate plugin', |
|
| 110 | - '106' => 'Viewing Modules', |
|
| 111 | - '107' => 'Create new module', |
|
| 112 | - '108' => 'Edit module', |
|
| 113 | - '109' => 'Saving module', |
|
| 114 | - '110' => 'Delete module', |
|
| 115 | - '111' => 'Duplicate module', |
|
| 116 | - '112' => 'Execute module', |
|
| 117 | - '113' => 'Manage module dependencies', |
|
| 118 | - '114' => 'View event log', |
|
| 119 | - '115' => 'View event log details', |
|
| 120 | - '116' => 'Delete event log', |
|
| 121 | - '117' => 'Editing tv rank', |
|
| 122 | - '118' => 'Call settings ajax include', |
|
| 123 | - '119' => 'Login Fail (Temporary Block)', |
|
| 8 | + '1' => 'Loading a frame(set)', |
|
| 9 | + '2' => 'Viewing home page/ online users', |
|
| 10 | + '3' => 'Viewing data for resource', |
|
| 11 | + '4' => 'Creating a resource', |
|
| 12 | + '5' => 'Saving resource', |
|
| 13 | + '6' => 'Deleting resource', |
|
| 14 | + '7' => 'Waiting while MODX cleans up', |
|
| 15 | + '8' => 'Logged out', |
|
| 16 | + '9' => 'Viewing help', |
|
| 17 | + '10' => 'Viewing/ composing messages', |
|
| 18 | + '11' => 'Creating a user', |
|
| 19 | + '12' => 'Editing user', |
|
| 20 | + '13' => 'Viewing logging', |
|
| 21 | + '14' => 'Editing a parser', |
|
| 22 | + '15' => 'Saving a parser', |
|
| 23 | + '16' => 'Editing template', |
|
| 24 | + '17' => 'Editing settings', |
|
| 25 | + '18' => 'Viewing Credits :)', |
|
| 26 | + '19' => 'Creating a new template', |
|
| 27 | + '20' => 'Saving template', |
|
| 28 | + '21' => 'Deleting template', |
|
| 29 | + '22' => 'Editing Snippet', |
|
| 30 | + '23' => 'Creating a new Snippet', |
|
| 31 | + '24' => 'Saving Snippet', |
|
| 32 | + '25' => 'Deleting Snippet', |
|
| 33 | + '26' => 'Refreshing site', |
|
| 34 | + '27' => 'Editing resource', |
|
| 35 | + '28' => 'Changing password', |
|
| 36 | + '29' => 'Error', |
|
| 37 | + '30' => 'Saving settings', |
|
| 38 | + '31' => 'Using file manager', |
|
| 39 | + '32' => 'Saving user', |
|
| 40 | + '33' => 'Deleting user', |
|
| 41 | + '34' => 'Saving new password', |
|
| 42 | + '35' => 'Editing role', |
|
| 43 | + '36' => 'Saving role', |
|
| 44 | + '37' => 'Deleting role', |
|
| 45 | + '38' => 'Creating new role', |
|
| 46 | + '40' => 'Editing Access Permissions', |
|
| 47 | + '41' => 'Editing Access Permissions', |
|
| 48 | + '42' => 'Editing Access Permissions', |
|
| 49 | + '43' => 'Editing Access Permissions', |
|
| 50 | + '44' => 'Editing Access Permissions', |
|
| 51 | + '45' => 'Idle', |
|
| 52 | + '46' => 'Editing Access Permissions', |
|
| 53 | + '47' => 'Editing Access Permissions', |
|
| 54 | + '48' => 'Editing Access Permissions', |
|
| 55 | + '49' => 'Editing Access Permissions', |
|
| 56 | + '50' => 'Editing Access Permissions', |
|
| 57 | + '51' => 'Moving resource', |
|
| 58 | + '52' => 'Moved resource', |
|
| 59 | + '53' => 'Viewing system info', |
|
| 60 | + '54' => 'Optimizing a table', |
|
| 61 | + '55' => 'Empty logs', |
|
| 62 | + '56' => 'Refresh resource tree', |
|
| 63 | + '57' => 'Refresh menu', |
|
| 64 | + '58' => 'Logged in', |
|
| 65 | + '59' => 'About MODX', |
|
| 66 | + '60' => 'Emptying Recycle Bin', |
|
| 67 | + '61' => 'Publishing a resource', |
|
| 68 | + '62' => 'Un-publishing a resource', |
|
| 69 | + '63' => 'Un-deleting a resource', |
|
| 70 | + '64' => 'Removing deleted content', |
|
| 71 | + '65' => 'Deleting a message', |
|
| 72 | + '66' => 'Sending a message', |
|
| 73 | + '67' => 'Removing locks', |
|
| 74 | + '68' => 'Viewing site logging', |
|
| 75 | + '69' => 'Viewing online visitors', |
|
| 76 | + '70' => 'Viewing site schedule', |
|
| 77 | + '71' => 'Searching', |
|
| 78 | + '72' => 'Adding a weblink', |
|
| 79 | + '73' => 'Editing a weblink', |
|
| 80 | + //case "74" : return "Changing personal preferences"; break; |
|
| 81 | + '75' => 'User/ role management', |
|
| 82 | + '76' => 'Element management', |
|
| 83 | + '77' => 'Creating a new Chunk (HTML Snippet)', |
|
| 84 | + '78' => 'Editing Chunk (HTML Snippet)', |
|
| 85 | + '79' => 'Saving Chunk (HTML Snippet)', |
|
| 86 | + '80' => 'Deleting Chunk (HTML Snippet)', |
|
| 87 | + '83' => 'Exporting a resource to HTML', |
|
| 88 | + '84' => 'Load Element Selector', |
|
| 89 | + '85' => 'Create Folder', |
|
| 90 | + '86' => 'Role management', |
|
| 91 | + '87' => 'Create new web user', |
|
| 92 | + '88' => 'Editing web user', |
|
| 93 | + '89' => 'Saving web user', |
|
| 94 | + '90' => 'Deleting web user', |
|
| 95 | + '91' => 'Editing Web Access Permissions', |
|
| 96 | + '92' => 'Editing Access Permissions', |
|
| 97 | + '93' => 'Backup Manager', |
|
| 98 | + '94' => 'Duplicate resource', |
|
| 99 | + '95' => 'Importing resources from HTML', |
|
| 100 | + '96' => 'Duplicate Template', |
|
| 101 | + '97' => 'Duplicate Chunk (HTML Snippet)', |
|
| 102 | + '98' => 'Duplicate Snippet', |
|
| 103 | + '99' => 'Manage Web Users', |
|
| 104 | + '100' => 'Previewing resource', |
|
| 105 | + '101' => 'Create new plugin', |
|
| 106 | + '102' => 'Edit plugin', |
|
| 107 | + '103' => 'Saving plugin', |
|
| 108 | + '104' => 'Delete plugin', |
|
| 109 | + '105' => 'Duplicate plugin', |
|
| 110 | + '106' => 'Viewing Modules', |
|
| 111 | + '107' => 'Create new module', |
|
| 112 | + '108' => 'Edit module', |
|
| 113 | + '109' => 'Saving module', |
|
| 114 | + '110' => 'Delete module', |
|
| 115 | + '111' => 'Duplicate module', |
|
| 116 | + '112' => 'Execute module', |
|
| 117 | + '113' => 'Manage module dependencies', |
|
| 118 | + '114' => 'View event log', |
|
| 119 | + '115' => 'View event log details', |
|
| 120 | + '116' => 'Delete event log', |
|
| 121 | + '117' => 'Editing tv rank', |
|
| 122 | + '118' => 'Call settings ajax include', |
|
| 123 | + '119' => 'Login Fail (Temporary Block)', |
|
| 124 | 124 | |
| 125 | - '300' => 'Create Template Variable', |
|
| 126 | - '301' => 'Edit Template Variable', |
|
| 127 | - '302' => 'Save Template Variable', |
|
| 128 | - '303' => 'Delete Template Variable', |
|
| 129 | - '304' => 'Duplicate Template Variable', |
|
| 125 | + '300' => 'Create Template Variable', |
|
| 126 | + '301' => 'Edit Template Variable', |
|
| 127 | + '302' => 'Save Template Variable', |
|
| 128 | + '303' => 'Delete Template Variable', |
|
| 129 | + '304' => 'Duplicate Template Variable', |
|
| 130 | 130 | |
| 131 | - '200' => 'Viewing phpInfo()', |
|
| 132 | - '501' => 'Delete category', |
|
| 133 | - '998' => 'Viewing web page', |
|
| 134 | - '999' => 'Viewing test page', |
|
| 131 | + '200' => 'Viewing phpInfo()', |
|
| 132 | + '501' => 'Delete category', |
|
| 133 | + '998' => 'Viewing web page', |
|
| 134 | + '999' => 'Viewing test page', |
|
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | 142 | function getAction($actionId, $itemid='') { |
| 143 | - global $action_list; |
|
| 143 | + global $action_list; |
|
| 144 | 144 | |
| 145 | - $ret = sprintf($action_list[$actionId], $itemid); |
|
| 146 | - if (!$ret) $ret = "Idle (unknown)"; |
|
| 145 | + $ret = sprintf($action_list[$actionId], $itemid); |
|
| 146 | + if (!$ret) $ret = "Idle (unknown)"; |
|
| 147 | 147 | |
| 148 | - return $ret; |
|
| 148 | + return $ret; |
|
| 149 | 149 | } |
@@ -17,324 +17,324 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
| 19 | 19 | |
| 20 | - global $modx; |
|
| 20 | + global $modx; |
|
| 21 | 21 | $o = ''; |
| 22 | 22 | |
| 23 | 23 | // process any TV commands in value |
| 24 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
| 25 | - $value = ProcessTVCommand($value, $name, $docid); |
|
| 24 | + $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
| 25 | + $value = ProcessTVCommand($value, $name, $docid); |
|
| 26 | 26 | |
| 27 | - $params = array(); |
|
| 28 | - if($paramstring) { |
|
| 29 | - $cp = explode("&", $paramstring); |
|
| 30 | - foreach($cp as $p => $v) { |
|
| 31 | - $v = trim($v); // trim |
|
| 32 | - $ar = explode("=", $v); |
|
| 33 | - if(is_array($ar) && count($ar) == 2) { |
|
| 34 | - $params[$ar[0]] = decodeParamValue($ar[1]); |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - } |
|
| 27 | + $params = array(); |
|
| 28 | + if($paramstring) { |
|
| 29 | + $cp = explode("&", $paramstring); |
|
| 30 | + foreach($cp as $p => $v) { |
|
| 31 | + $v = trim($v); // trim |
|
| 32 | + $ar = explode("=", $v); |
|
| 33 | + if(is_array($ar) && count($ar) == 2) { |
|
| 34 | + $params[$ar[0]] = decodeParamValue($ar[1]); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - $id = "tv$name"; |
|
| 40 | - switch($format) { |
|
| 41 | - case 'image': |
|
| 42 | - $images = parseInput($value, '||', 'array'); |
|
| 43 | - foreach($images as $image) { |
|
| 44 | - if(!is_array($image)) { |
|
| 45 | - $image = explode('==', $image); |
|
| 46 | - } |
|
| 47 | - $src = $image[0]; |
|
| 39 | + $id = "tv$name"; |
|
| 40 | + switch($format) { |
|
| 41 | + case 'image': |
|
| 42 | + $images = parseInput($value, '||', 'array'); |
|
| 43 | + foreach($images as $image) { |
|
| 44 | + if(!is_array($image)) { |
|
| 45 | + $image = explode('==', $image); |
|
| 46 | + } |
|
| 47 | + $src = $image[0]; |
|
| 48 | 48 | |
| 49 | - if($src) { |
|
| 50 | - // We have a valid source |
|
| 51 | - $attributes = ''; |
|
| 52 | - $attr = array( |
|
| 53 | - 'class' => $params['class'], |
|
| 54 | - 'src' => $src, |
|
| 55 | - 'id' => ($params['id'] ? $params['id'] : ''), |
|
| 56 | - 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
| 57 | - 'style' => $params['style'] |
|
| 58 | - ); |
|
| 59 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
| 60 | - $attr['align'] = $params['align']; |
|
| 61 | - } |
|
| 62 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 63 | - $attributes .= ' ' . $params['attrib']; |
|
| 49 | + if($src) { |
|
| 50 | + // We have a valid source |
|
| 51 | + $attributes = ''; |
|
| 52 | + $attr = array( |
|
| 53 | + 'class' => $params['class'], |
|
| 54 | + 'src' => $src, |
|
| 55 | + 'id' => ($params['id'] ? $params['id'] : ''), |
|
| 56 | + 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
| 57 | + 'style' => $params['style'] |
|
| 58 | + ); |
|
| 59 | + if(isset($params['align']) && $params['align'] != 'none') { |
|
| 60 | + $attr['align'] = $params['align']; |
|
| 61 | + } |
|
| 62 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 63 | + $attributes .= ' ' . $params['attrib']; |
|
| 64 | 64 | |
| 65 | - // Output the image with attributes |
|
| 66 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - break; |
|
| 65 | + // Output the image with attributes |
|
| 66 | + $o .= '<img' . rtrim($attributes) . ' />'; |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + break; |
|
| 70 | 70 | |
| 71 | - case "delim": // display as delimitted list |
|
| 72 | - $value = parseInput($value, "||"); |
|
| 73 | - $p = $params['format'] ? $params['format'] : " "; |
|
| 74 | - if($p == "\\n") { |
|
| 75 | - $p = "\n"; |
|
| 76 | - } |
|
| 77 | - $o = str_replace("||", $p, $value); |
|
| 78 | - break; |
|
| 71 | + case "delim": // display as delimitted list |
|
| 72 | + $value = parseInput($value, "||"); |
|
| 73 | + $p = $params['format'] ? $params['format'] : " "; |
|
| 74 | + if($p == "\\n") { |
|
| 75 | + $p = "\n"; |
|
| 76 | + } |
|
| 77 | + $o = str_replace("||", $p, $value); |
|
| 78 | + break; |
|
| 79 | 79 | |
| 80 | - case "string": |
|
| 81 | - $value = parseInput($value); |
|
| 82 | - $format = strtolower($params['format']); |
|
| 83 | - if($format == 'upper case') { |
|
| 84 | - $o = strtoupper($value); |
|
| 85 | - } else if($format == 'lower case') { |
|
| 86 | - $o = strtolower($value); |
|
| 87 | - } else if($format == 'sentence case') { |
|
| 88 | - $o = ucfirst($value); |
|
| 89 | - } else if($format == 'capitalize') { |
|
| 90 | - $o = ucwords($value); |
|
| 91 | - } else { |
|
| 92 | - $o = $value; |
|
| 93 | - } |
|
| 94 | - break; |
|
| 80 | + case "string": |
|
| 81 | + $value = parseInput($value); |
|
| 82 | + $format = strtolower($params['format']); |
|
| 83 | + if($format == 'upper case') { |
|
| 84 | + $o = strtoupper($value); |
|
| 85 | + } else if($format == 'lower case') { |
|
| 86 | + $o = strtolower($value); |
|
| 87 | + } else if($format == 'sentence case') { |
|
| 88 | + $o = ucfirst($value); |
|
| 89 | + } else if($format == 'capitalize') { |
|
| 90 | + $o = ucwords($value); |
|
| 91 | + } else { |
|
| 92 | + $o = $value; |
|
| 93 | + } |
|
| 94 | + break; |
|
| 95 | 95 | |
| 96 | - case "date": |
|
| 97 | - if($value != '' || $params['default'] == 'Yes') { |
|
| 98 | - if(empty($value)) { |
|
| 99 | - $value = 'now'; |
|
| 100 | - } |
|
| 101 | - $timestamp = getUnixtimeFromDateString($value); |
|
| 102 | - $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
| 103 | - $o = strftime($p, $timestamp); |
|
| 104 | - } else { |
|
| 105 | - $value = ''; |
|
| 106 | - } |
|
| 107 | - break; |
|
| 96 | + case "date": |
|
| 97 | + if($value != '' || $params['default'] == 'Yes') { |
|
| 98 | + if(empty($value)) { |
|
| 99 | + $value = 'now'; |
|
| 100 | + } |
|
| 101 | + $timestamp = getUnixtimeFromDateString($value); |
|
| 102 | + $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
| 103 | + $o = strftime($p, $timestamp); |
|
| 104 | + } else { |
|
| 105 | + $value = ''; |
|
| 106 | + } |
|
| 107 | + break; |
|
| 108 | 108 | |
| 109 | - case "hyperlink": |
|
| 110 | - $value = parseInput($value, "||", "array"); |
|
| 111 | - $o = ''; |
|
| 112 | - $countValue = count($value); |
|
| 113 | - for($i = 0; $i < $countValue; $i++) { |
|
| 114 | - list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
| 115 | - if(!$url) { |
|
| 116 | - $url = $name; |
|
| 117 | - } |
|
| 118 | - if($url) { |
|
| 119 | - if($o) { |
|
| 120 | - $o .= '<br />'; |
|
| 121 | - } |
|
| 122 | - $attributes = ''; |
|
| 123 | - // setup the link attributes |
|
| 124 | - $attr = array( |
|
| 125 | - 'href' => $url, |
|
| 126 | - 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
| 127 | - 'class' => $params['class'], |
|
| 128 | - 'style' => $params['style'], |
|
| 129 | - 'target' => $params['target'], |
|
| 130 | - ); |
|
| 131 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 132 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
| 109 | + case "hyperlink": |
|
| 110 | + $value = parseInput($value, "||", "array"); |
|
| 111 | + $o = ''; |
|
| 112 | + $countValue = count($value); |
|
| 113 | + for($i = 0; $i < $countValue; $i++) { |
|
| 114 | + list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
| 115 | + if(!$url) { |
|
| 116 | + $url = $name; |
|
| 117 | + } |
|
| 118 | + if($url) { |
|
| 119 | + if($o) { |
|
| 120 | + $o .= '<br />'; |
|
| 121 | + } |
|
| 122 | + $attributes = ''; |
|
| 123 | + // setup the link attributes |
|
| 124 | + $attr = array( |
|
| 125 | + 'href' => $url, |
|
| 126 | + 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
| 127 | + 'class' => $params['class'], |
|
| 128 | + 'style' => $params['style'], |
|
| 129 | + 'target' => $params['target'], |
|
| 130 | + ); |
|
| 131 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 132 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
| 133 | 133 | |
| 134 | - // Output the link |
|
| 135 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - break; |
|
| 134 | + // Output the link |
|
| 135 | + $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + break; |
|
| 139 | 139 | |
| 140 | - case "htmltag": |
|
| 141 | - $value = parseInput($value, "||", "array"); |
|
| 142 | - $tagid = $params['tagid']; |
|
| 143 | - $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
| 144 | - $o = ''; |
|
| 145 | - // Loop through a list of tags |
|
| 140 | + case "htmltag": |
|
| 141 | + $value = parseInput($value, "||", "array"); |
|
| 142 | + $tagid = $params['tagid']; |
|
| 143 | + $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
| 144 | + $o = ''; |
|
| 145 | + // Loop through a list of tags |
|
| 146 | 146 | $countValue = count($value); |
| 147 | - for($i = 0; $i < $countValue; $i++) { |
|
| 148 | - $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
| 149 | - if(!$tagvalue) { |
|
| 150 | - continue; |
|
| 151 | - } |
|
| 147 | + for($i = 0; $i < $countValue; $i++) { |
|
| 148 | + $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
| 149 | + if(!$tagvalue) { |
|
| 150 | + continue; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - $attributes = ''; |
|
| 154 | - $attr = array( |
|
| 155 | - 'id' => ($tagid ? $tagid : $id), |
|
| 156 | - // 'tv' already added to id |
|
| 157 | - 'class' => $params['class'], |
|
| 158 | - 'style' => $params['style'], |
|
| 159 | - ); |
|
| 160 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 161 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
| 153 | + $attributes = ''; |
|
| 154 | + $attr = array( |
|
| 155 | + 'id' => ($tagid ? $tagid : $id), |
|
| 156 | + // 'tv' already added to id |
|
| 157 | + 'class' => $params['class'], |
|
| 158 | + 'style' => $params['style'], |
|
| 159 | + ); |
|
| 160 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
| 161 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
| 162 | 162 | |
| 163 | - // Output the HTML Tag |
|
| 164 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
| 165 | - } |
|
| 166 | - break; |
|
| 163 | + // Output the HTML Tag |
|
| 164 | + $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
| 165 | + } |
|
| 166 | + break; |
|
| 167 | 167 | |
| 168 | - case "richtext": |
|
| 169 | - $value = parseInput($value); |
|
| 170 | - $w = $params['w'] ? $params['w'] : '100%'; |
|
| 171 | - $h = $params['h'] ? $params['h'] : '400px'; |
|
| 172 | - $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
| 173 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
| 174 | - $o .= $modx->htmlspecialchars($value); |
|
| 175 | - $o .= '</textarea></div>'; |
|
| 176 | - $replace_richtext = array($id); |
|
| 177 | - // setup editors |
|
| 178 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
| 179 | - // invoke OnRichTextEditorInit event |
|
| 180 | - $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
| 181 | - 'editor' => $richtexteditor, |
|
| 182 | - 'elements' => $replace_richtext, |
|
| 183 | - 'forfrontend' => 1, |
|
| 184 | - 'width' => $w, |
|
| 185 | - 'height' => $h |
|
| 186 | - )); |
|
| 187 | - if(is_array($evtOut)) { |
|
| 188 | - $o .= implode("", $evtOut); |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - break; |
|
| 168 | + case "richtext": |
|
| 169 | + $value = parseInput($value); |
|
| 170 | + $w = $params['w'] ? $params['w'] : '100%'; |
|
| 171 | + $h = $params['h'] ? $params['h'] : '400px'; |
|
| 172 | + $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
| 173 | + $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
| 174 | + $o .= $modx->htmlspecialchars($value); |
|
| 175 | + $o .= '</textarea></div>'; |
|
| 176 | + $replace_richtext = array($id); |
|
| 177 | + // setup editors |
|
| 178 | + if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
| 179 | + // invoke OnRichTextEditorInit event |
|
| 180 | + $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
| 181 | + 'editor' => $richtexteditor, |
|
| 182 | + 'elements' => $replace_richtext, |
|
| 183 | + 'forfrontend' => 1, |
|
| 184 | + 'width' => $w, |
|
| 185 | + 'height' => $h |
|
| 186 | + )); |
|
| 187 | + if(is_array($evtOut)) { |
|
| 188 | + $o .= implode("", $evtOut); |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + break; |
|
| 192 | 192 | |
| 193 | - case "unixtime": |
|
| 194 | - $value = parseInput($value); |
|
| 195 | - $o = getUnixtimeFromDateString($value); |
|
| 196 | - break; |
|
| 193 | + case "unixtime": |
|
| 194 | + $value = parseInput($value); |
|
| 195 | + $o = getUnixtimeFromDateString($value); |
|
| 196 | + break; |
|
| 197 | 197 | |
| 198 | - case "viewport": |
|
| 199 | - $value = parseInput($value); |
|
| 200 | - $id = '_' . time(); |
|
| 201 | - if(!$params['vpid']) { |
|
| 202 | - $params['vpid'] = $id; |
|
| 203 | - } |
|
| 204 | - $sTag = "<iframe"; |
|
| 205 | - $eTag = "</iframe>"; |
|
| 206 | - $autoMode = "0"; |
|
| 207 | - $w = $params['width']; |
|
| 208 | - $h = $params['height']; |
|
| 209 | - if($params['stretch'] == 'Yes') { |
|
| 210 | - $w = "100%"; |
|
| 211 | - $h = "100%"; |
|
| 212 | - } |
|
| 213 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
| 214 | - $autoMode = "3"; //both |
|
| 215 | - } else if($params['awidth'] == 'Yes') { |
|
| 216 | - $autoMode = "1"; //width only |
|
| 217 | - } else if($params['aheight'] == 'Yes') { |
|
| 218 | - $autoMode = "2"; //height only |
|
| 219 | - } |
|
| 198 | + case "viewport": |
|
| 199 | + $value = parseInput($value); |
|
| 200 | + $id = '_' . time(); |
|
| 201 | + if(!$params['vpid']) { |
|
| 202 | + $params['vpid'] = $id; |
|
| 203 | + } |
|
| 204 | + $sTag = "<iframe"; |
|
| 205 | + $eTag = "</iframe>"; |
|
| 206 | + $autoMode = "0"; |
|
| 207 | + $w = $params['width']; |
|
| 208 | + $h = $params['height']; |
|
| 209 | + if($params['stretch'] == 'Yes') { |
|
| 210 | + $w = "100%"; |
|
| 211 | + $h = "100%"; |
|
| 212 | + } |
|
| 213 | + if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
| 214 | + $autoMode = "3"; //both |
|
| 215 | + } else if($params['awidth'] == 'Yes') { |
|
| 216 | + $autoMode = "1"; //width only |
|
| 217 | + } else if($params['aheight'] == 'Yes') { |
|
| 218 | + $autoMode = "2"; //height only |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
| 222 | - 'name' => 'viewport', |
|
| 223 | - 'version' => '0', |
|
| 224 | - 'plaintext' => false |
|
| 225 | - )); |
|
| 226 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
| 227 | - if($params['class']) { |
|
| 228 | - $o .= " class='" . $params['class'] . "' "; |
|
| 229 | - } |
|
| 230 | - if($params['style']) { |
|
| 231 | - $o .= " style='" . $params['style'] . "' "; |
|
| 232 | - } |
|
| 233 | - if($params['attrib']) { |
|
| 234 | - $o .= $params['attrib'] . " "; |
|
| 235 | - } |
|
| 236 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
| 237 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
| 238 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
| 239 | - $o .= ">"; |
|
| 240 | - $o .= $eTag; |
|
| 241 | - break; |
|
| 221 | + $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
| 222 | + 'name' => 'viewport', |
|
| 223 | + 'version' => '0', |
|
| 224 | + 'plaintext' => false |
|
| 225 | + )); |
|
| 226 | + $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
| 227 | + if($params['class']) { |
|
| 228 | + $o .= " class='" . $params['class'] . "' "; |
|
| 229 | + } |
|
| 230 | + if($params['style']) { |
|
| 231 | + $o .= " style='" . $params['style'] . "' "; |
|
| 232 | + } |
|
| 233 | + if($params['attrib']) { |
|
| 234 | + $o .= $params['attrib'] . " "; |
|
| 235 | + } |
|
| 236 | + $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
| 237 | + $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
| 238 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
| 239 | + $o .= ">"; |
|
| 240 | + $o .= $eTag; |
|
| 241 | + break; |
|
| 242 | 242 | |
| 243 | - case "datagrid": |
|
| 244 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 245 | - $grd = new DataGrid('', $value); |
|
| 243 | + case "datagrid": |
|
| 244 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 245 | + $grd = new DataGrid('', $value); |
|
| 246 | 246 | |
| 247 | - $grd->noRecordMsg = $params['egmsg']; |
|
| 247 | + $grd->noRecordMsg = $params['egmsg']; |
|
| 248 | 248 | |
| 249 | - $grd->columnHeaderClass = $params['chdrc']; |
|
| 250 | - $grd->cssClass = $params['tblc']; |
|
| 251 | - $grd->itemClass = $params['itmc']; |
|
| 252 | - $grd->altItemClass = $params['aitmc']; |
|
| 249 | + $grd->columnHeaderClass = $params['chdrc']; |
|
| 250 | + $grd->cssClass = $params['tblc']; |
|
| 251 | + $grd->itemClass = $params['itmc']; |
|
| 252 | + $grd->altItemClass = $params['aitmc']; |
|
| 253 | 253 | |
| 254 | - $grd->columnHeaderStyle = $params['chdrs']; |
|
| 255 | - $grd->cssStyle = $params['tbls']; |
|
| 256 | - $grd->itemStyle = $params['itms']; |
|
| 257 | - $grd->altItemStyle = $params['aitms']; |
|
| 254 | + $grd->columnHeaderStyle = $params['chdrs']; |
|
| 255 | + $grd->cssStyle = $params['tbls']; |
|
| 256 | + $grd->itemStyle = $params['itms']; |
|
| 257 | + $grd->altItemStyle = $params['aitms']; |
|
| 258 | 258 | |
| 259 | - $grd->columns = $params['cols']; |
|
| 260 | - $grd->fields = $params['flds']; |
|
| 261 | - $grd->colWidths = $params['cwidth']; |
|
| 262 | - $grd->colAligns = $params['calign']; |
|
| 263 | - $grd->colColors = $params['ccolor']; |
|
| 264 | - $grd->colTypes = $params['ctype']; |
|
| 259 | + $grd->columns = $params['cols']; |
|
| 260 | + $grd->fields = $params['flds']; |
|
| 261 | + $grd->colWidths = $params['cwidth']; |
|
| 262 | + $grd->colAligns = $params['calign']; |
|
| 263 | + $grd->colColors = $params['ccolor']; |
|
| 264 | + $grd->colTypes = $params['ctype']; |
|
| 265 | 265 | |
| 266 | - $grd->cellPadding = $params['cpad']; |
|
| 267 | - $grd->cellSpacing = $params['cspace']; |
|
| 268 | - $grd->header = $params['head']; |
|
| 269 | - $grd->footer = $params['foot']; |
|
| 270 | - $grd->pageSize = $params['psize']; |
|
| 271 | - $grd->pagerLocation = $params['ploc']; |
|
| 272 | - $grd->pagerClass = $params['pclass']; |
|
| 273 | - $grd->pagerStyle = $params['pstyle']; |
|
| 274 | - $o = $grd->render(); |
|
| 275 | - break; |
|
| 266 | + $grd->cellPadding = $params['cpad']; |
|
| 267 | + $grd->cellSpacing = $params['cspace']; |
|
| 268 | + $grd->header = $params['head']; |
|
| 269 | + $grd->footer = $params['foot']; |
|
| 270 | + $grd->pageSize = $params['psize']; |
|
| 271 | + $grd->pagerLocation = $params['ploc']; |
|
| 272 | + $grd->pagerClass = $params['pclass']; |
|
| 273 | + $grd->pagerStyle = $params['pstyle']; |
|
| 274 | + $o = $grd->render(); |
|
| 275 | + break; |
|
| 276 | 276 | |
| 277 | - case 'htmlentities': |
|
| 278 | - $value = parseInput($value); |
|
| 279 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
| 280 | - // remove delimiter from checkbox and listbox-multiple TVs |
|
| 281 | - $value = str_replace('||', '', $value); |
|
| 282 | - } |
|
| 283 | - $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 284 | - break; |
|
| 277 | + case 'htmlentities': |
|
| 278 | + $value = parseInput($value); |
|
| 279 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
| 280 | + // remove delimiter from checkbox and listbox-multiple TVs |
|
| 281 | + $value = str_replace('||', '', $value); |
|
| 282 | + } |
|
| 283 | + $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 284 | + break; |
|
| 285 | 285 | |
| 286 | - case 'custom_widget': |
|
| 287 | - $widget_output = ''; |
|
| 288 | - $o = ''; |
|
| 289 | - /* If we are loading a file */ |
|
| 290 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
| 291 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
| 292 | - if(!file_exists($file_name)) { |
|
| 293 | - $widget_output = $file_name . ' does not exist'; |
|
| 294 | - } else { |
|
| 295 | - $widget_output = file_get_contents($file_name); |
|
| 296 | - } |
|
| 297 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
| 298 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
| 299 | - if(!file_exists($file_name)) { |
|
| 300 | - $widget_output = $file_name . ' does not exist'; |
|
| 301 | - } else { |
|
| 302 | - /* The included file needs to set $widget_output. Can be string, array, object */ |
|
| 303 | - include $file_name; |
|
| 304 | - } |
|
| 305 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
| 306 | - $chunk_name = trim(substr($params['output'], 7)); |
|
| 307 | - $widget_output = $modx->getChunk($chunk_name); |
|
| 308 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
| 309 | - $eval_str = trim(substr($params['output'], 6)); |
|
| 310 | - $widget_output = eval($eval_str); |
|
| 311 | - } elseif($value !== '') { |
|
| 312 | - $widget_output = $params['output']; |
|
| 313 | - } else { |
|
| 314 | - $widget_output = ''; |
|
| 315 | - } |
|
| 316 | - if(is_string($widget_output)) { |
|
| 317 | - $_ = $modx->config['enable_filter']; |
|
| 318 | - $modx->config['enable_filter'] = 1; |
|
| 319 | - $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
| 320 | - $modx->config['enable_filter'] = $_; |
|
| 321 | - $o = $modx->parseDocumentSource($widget_output); |
|
| 322 | - } else { |
|
| 323 | - $o = $widget_output; |
|
| 324 | - } |
|
| 325 | - break; |
|
| 286 | + case 'custom_widget': |
|
| 287 | + $widget_output = ''; |
|
| 288 | + $o = ''; |
|
| 289 | + /* If we are loading a file */ |
|
| 290 | + if(substr($params['output'], 0, 5) == "@FILE") { |
|
| 291 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
| 292 | + if(!file_exists($file_name)) { |
|
| 293 | + $widget_output = $file_name . ' does not exist'; |
|
| 294 | + } else { |
|
| 295 | + $widget_output = file_get_contents($file_name); |
|
| 296 | + } |
|
| 297 | + } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
| 298 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
| 299 | + if(!file_exists($file_name)) { |
|
| 300 | + $widget_output = $file_name . ' does not exist'; |
|
| 301 | + } else { |
|
| 302 | + /* The included file needs to set $widget_output. Can be string, array, object */ |
|
| 303 | + include $file_name; |
|
| 304 | + } |
|
| 305 | + } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
| 306 | + $chunk_name = trim(substr($params['output'], 7)); |
|
| 307 | + $widget_output = $modx->getChunk($chunk_name); |
|
| 308 | + } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
| 309 | + $eval_str = trim(substr($params['output'], 6)); |
|
| 310 | + $widget_output = eval($eval_str); |
|
| 311 | + } elseif($value !== '') { |
|
| 312 | + $widget_output = $params['output']; |
|
| 313 | + } else { |
|
| 314 | + $widget_output = ''; |
|
| 315 | + } |
|
| 316 | + if(is_string($widget_output)) { |
|
| 317 | + $_ = $modx->config['enable_filter']; |
|
| 318 | + $modx->config['enable_filter'] = 1; |
|
| 319 | + $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
| 320 | + $modx->config['enable_filter'] = $_; |
|
| 321 | + $o = $modx->parseDocumentSource($widget_output); |
|
| 322 | + } else { |
|
| 323 | + $o = $widget_output; |
|
| 324 | + } |
|
| 325 | + break; |
|
| 326 | 326 | |
| 327 | - default: |
|
| 328 | - $value = parseInput($value); |
|
| 329 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
| 330 | - // add separator |
|
| 331 | - $value = explode('||', $value); |
|
| 332 | - $value = implode($sep, $value); |
|
| 333 | - } |
|
| 334 | - $o = $value; |
|
| 335 | - break; |
|
| 336 | - } |
|
| 337 | - return $o; |
|
| 327 | + default: |
|
| 328 | + $value = parseInput($value); |
|
| 329 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
| 330 | + // add separator |
|
| 331 | + $value = explode('||', $value); |
|
| 332 | + $value = implode($sep, $value); |
|
| 333 | + } |
|
| 334 | + $o = $value; |
|
| 335 | + break; |
|
| 336 | + } |
|
| 337 | + return $o; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | * @return string |
| 343 | 343 | */ |
| 344 | 344 | function decodeParamValue($s) { |
| 345 | - $s = str_replace("%3D", '=', $s); // = |
|
| 346 | - return str_replace("%26", '&', $s); // & |
|
| 345 | + $s = str_replace("%3D", '=', $s); // = |
|
| 346 | + return str_replace("%26", '&', $s); // & |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -356,20 +356,20 @@ discard block |
||
| 356 | 356 | * @return array|string |
| 357 | 357 | */ |
| 358 | 358 | function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
| 359 | - global $modx; |
|
| 360 | - if($modx->db->isResult($src)) { |
|
| 361 | - // must be a recordset |
|
| 362 | - $rows = array(); |
|
| 363 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
| 364 | - return ($type == "array") ? $rows : implode($delim, $rows); |
|
| 365 | - } else { |
|
| 366 | - // must be a text |
|
| 367 | - if($type == "array") { |
|
| 368 | - return explode($delim, $src); |
|
| 369 | - } else { |
|
| 370 | - return $src; |
|
| 371 | - } |
|
| 372 | - } |
|
| 359 | + global $modx; |
|
| 360 | + if($modx->db->isResult($src)) { |
|
| 361 | + // must be a recordset |
|
| 362 | + $rows = array(); |
|
| 363 | + while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
| 364 | + return ($type == "array") ? $rows : implode($delim, $rows); |
|
| 365 | + } else { |
|
| 366 | + // must be a text |
|
| 367 | + if($type == "array") { |
|
| 368 | + return explode($delim, $src); |
|
| 369 | + } else { |
|
| 370 | + return $src; |
|
| 371 | + } |
|
| 372 | + } |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
@@ -377,21 +377,21 @@ discard block |
||
| 377 | 377 | * @return bool|false|int |
| 378 | 378 | */ |
| 379 | 379 | function getUnixtimeFromDateString($value) { |
| 380 | - $timestamp = false; |
|
| 381 | - // Check for MySQL or legacy style date |
|
| 382 | - $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
| 383 | - $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
| 384 | - $matches = array(); |
|
| 385 | - if(strpos($value, '-') !== false) { |
|
| 386 | - if(preg_match($date_match_1, $value, $matches)) { |
|
| 387 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
| 388 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
| 389 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
| 390 | - } |
|
| 391 | - } |
|
| 392 | - // If those didn't work, use strtotime to figure out the date |
|
| 393 | - if($timestamp === false || $timestamp === -1) { |
|
| 394 | - $timestamp = strtotime($value); |
|
| 395 | - } |
|
| 396 | - return $timestamp; |
|
| 380 | + $timestamp = false; |
|
| 381 | + // Check for MySQL or legacy style date |
|
| 382 | + $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
| 383 | + $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
| 384 | + $matches = array(); |
|
| 385 | + if(strpos($value, '-') !== false) { |
|
| 386 | + if(preg_match($date_match_1, $value, $matches)) { |
|
| 387 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
| 388 | + } elseif(preg_match($date_match_2, $value, $matches)) { |
|
| 389 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
| 390 | + } |
|
| 391 | + } |
|
| 392 | + // If those didn't work, use strtotime to figure out the date |
|
| 393 | + if($timestamp === false || $timestamp === -1) { |
|
| 394 | + $timestamp = strtotime($value); |
|
| 395 | + } |
|
| 396 | + return $timestamp; |
|
| 397 | 397 | } |