@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->count = 0; |
| 60 | 60 | $this->setUrlMode(); |
| 61 | 61 | $this->generate_mode = 'crawl'; |
| 62 | - $this->targetDir = $modx->config['base_path'] . 'temp/export'; |
|
| 62 | + $this->targetDir = $modx->config['base_path'].'temp/export'; |
|
| 63 | 63 | if (!isset($this->total)) { |
| 64 | 64 | $this->getTotal(); |
| 65 | 65 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids))); |
| 116 | 116 | if (count($ignore_ids) > 0) { |
| 117 | - $ignore_ids = "AND NOT id IN ('" . implode("','", $ignore_ids) . "')"; |
|
| 117 | + $ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')"; |
|
| 118 | 118 | } else { |
| 119 | 119 | $ignore_ids = ''; |
| 120 | 120 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $noncache = ($noncache == 1) ? '' : 'AND cacheable=1'; |
| 125 | 125 | $where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}"; |
| 126 | 126 | $rs = $modx->getDatabase()->select('count(id)', $tbl_site_content, $where); |
| 127 | - $this->total = (int)$modx->getDatabase()->getValue($rs); |
|
| 127 | + $this->total = (int) $modx->getDatabase()->getValue($rs); |
|
| 128 | 128 | |
| 129 | 129 | return $this->total; |
| 130 | 130 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } elseif (!is_readable($directory)) { |
| 154 | 154 | return $rs; |
| 155 | 155 | } else { |
| 156 | - $files = glob($directory . '/*'); |
|
| 156 | + $files = glob($directory.'/*'); |
|
| 157 | 157 | if (!empty($files)) { |
| 158 | 158 | foreach ($files as $path) { |
| 159 | 159 | $rs = is_dir($path) ? $this->removeDirectoryAll($path) : unlink($path); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $_lang = $back_lang; |
| 184 | 184 | } else { |
| 185 | - $src = $this->curl_get_contents(MODX_SITE_URL . "index.php?id={$docid}"); |
|
| 185 | + $src = $this->curl_get_contents(MODX_SITE_URL."index.php?id={$docid}"); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | $modx = evolutionCMS(); |
| 218 | 218 | |
| 219 | 219 | if ($alias === '') { |
| 220 | - $filename = $prefix . $docid . $suffix; |
|
| 220 | + $filename = $prefix.$docid.$suffix; |
|
| 221 | 221 | } else { |
| 222 | 222 | if ($modx->config['suffix_mode'] === '1' && strpos($alias, '.') !== false) { |
| 223 | 223 | $suffix = ''; |
| 224 | 224 | } |
| 225 | - $filename = $prefix . $alias . $suffix; |
|
| 225 | + $filename = $prefix.$alias.$suffix; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return $filename; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 241 | 241 | |
| 242 | 242 | $ignore_ids = $this->ignore_ids; |
| 243 | - $dirpath = $this->targetDir . '/'; |
|
| 243 | + $dirpath = $this->targetDir.'/'; |
|
| 244 | 244 | |
| 245 | 245 | $prefix = $modx->config['friendly_url_prefix']; |
| 246 | 246 | $suffix = $modx->config['friendly_url_suffix']; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $ph['status'] = 'fail'; |
| 252 | 252 | $ph['msg1'] = $_lang['export_site_failed']; |
| 253 | - $ph['msg2'] = $_lang["export_site_failed_no_write"] . ' - ' . $dirpath; |
|
| 253 | + $ph['msg2'] = $_lang["export_site_failed_no_write"].' - '.$dirpath; |
|
| 254 | 254 | $msg_failed_no_write = $this->parsePlaceholder($tpl, $ph); |
| 255 | 255 | |
| 256 | 256 | $ph['msg2'] = $_lang["export_site_failed_no_retrieve"]; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | if (!$row['wasNull']) { // needs writing a document |
| 285 | 285 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
| 286 | - $filename = $dirpath . $docname; |
|
| 286 | + $filename = $dirpath.$docname; |
|
| 287 | 287 | if (!is_file($filename)) { |
| 288 | 288 | if ($row['published'] === '1') { |
| 289 | 289 | $status = $this->makeFile($row['id'], $filename); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
| 312 | 312 | '.') === false)) { // needs making a folder |
| 313 | 313 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
| 314 | - $dir_path = $dirpath . $end_dir; |
|
| 314 | + $dir_path = $dirpath.$end_dir; |
|
| 315 | 315 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
| 316 | 316 | return false; |
| 317 | 317 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | if ($modx->config['make_folders'] === '1' && $row['published'] === '1') { |
| 329 | 329 | if (!empty($filename) && is_file($filename)) { |
| 330 | - rename($filename, $dir_path . '/index.html'); |
|
| 330 | + rename($filename, $dir_path.'/index.html'); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | $this->targetDir = $dir_path; |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $ch = curl_init(); |
| 353 | 353 | curl_setopt($ch, CURLOPT_URL, $url); |
| 354 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT |
|
| 355 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER |
|
| 354 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT |
|
| 355 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER |
|
| 356 | 356 | curl_setopt($ch, CURLOPT_HEADER, false); |
| 357 | 357 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 358 | 358 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
@@ -279,7 +279,8 @@ discard block |
||
| 279 | 279 | $row['count'] = $this->count; |
| 280 | 280 | $row['url'] = $modx->makeUrl($row['id']); |
| 281 | 281 | |
| 282 | - if (!$row['wasNull']) { // needs writing a document |
|
| 282 | + if (!$row['wasNull']) { |
|
| 283 | +// needs writing a document |
|
| 283 | 284 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
| 284 | 285 | $filename = $dirpath . $docname; |
| 285 | 286 | if (!is_file($filename)) { |
@@ -307,7 +308,8 @@ discard block |
||
| 307 | 308 | $this->output[] = $this->parsePlaceholder($_lang['export_site_exporting_document'], $row); |
| 308 | 309 | } |
| 309 | 310 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
| 310 | - '.') === false)) { // needs making a folder |
|
| 311 | + '.') === false)) { |
|
| 312 | +// needs making a folder |
|
| 311 | 313 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
| 312 | 314 | $dir_path = $dirpath . $end_dir; |
| 313 | 315 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $role = $this->role; |
| 40 | 40 | |
| 41 | 41 | if ($role == 1) { |
| 42 | - return true; // administrator - grant all document permissions |
|
| 42 | + return true; // administrator - grant all document permissions |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | are private to the manager users will not be private to web users if the |
| 67 | 67 | document group is not assigned to a web user group and visa versa. |
| 68 | 68 | */ |
| 69 | - $permissionsok = false; // set permissions to false |
|
| 69 | + $permissionsok = false; // set permissions to false |
|
| 70 | 70 | |
| 71 | 71 | $rs = $modx->getDatabase()->select( |
| 72 | 72 | 'count(DISTINCT sc.id)', |
| 73 | 73 | "{$tblsc} AS sc |
| 74 | 74 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
| 75 | 75 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
| 76 | - "sc.id='{$this->document}' AND (" . (empty($docgrp) ? '' : "dg.document_group = " . $docgrp . " ||") . " sc.privatemgr = 0)" |
|
| 76 | + "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
| 77 | 77 | ); |
| 78 | 78 | $limit = $modx->getDatabase()->getValue($rs); |
| 79 | 79 | if ($limit == 1) { |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php namespace EvolutionCMS\Legacy; |
| 2 | 2 | |
| 3 | -class mgrResources { |
|
| 3 | +class mgrResources{ |
|
| 4 | 4 | /** |
| 5 | 5 | * @var array |
| 6 | 6 | */ |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * mgrResources constructor. |
| 23 | 23 | */ |
| 24 | - public function __construct() { |
|
| 24 | + public function __construct(){ |
|
| 25 | 25 | $this->setTypes(); |
| 26 | 26 | $this->queryItemsFromDB(); |
| 27 | 27 | $this->prepareCategoryArrays(); |
@@ -30,47 +30,47 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @return void |
| 32 | 32 | */ |
| 33 | - public function setTypes() { |
|
| 33 | + public function setTypes(){ |
|
| 34 | 34 | global $_lang; |
| 35 | - $this->types['site_templates'] = array( |
|
| 35 | + $this->types['site_templates'] = array( |
|
| 36 | 36 | 'title'=>$_lang["manage_templates"], |
| 37 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
| 38 | - 'permissions'=>array('new_template','edit_template'), |
|
| 37 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
| 38 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 39 | 39 | 'name'=>'templatename' |
| 40 | 40 | ); |
| 41 | - $this->types['site_tmplvars'] = array( |
|
| 41 | + $this->types['site_tmplvars'] = array( |
|
| 42 | 42 | 'title'=>$_lang["tmplvars"], |
| 43 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
| 44 | - 'permissions'=>array('new_template','edit_template'), |
|
| 43 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
| 44 | + 'permissions'=>array('new_template', 'edit_template'), |
|
| 45 | 45 | ); |
| 46 | 46 | $this->types['site_htmlsnippets'] = array( |
| 47 | 47 | 'title'=>$_lang["manage_htmlsnippets"], |
| 48 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
| 49 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
| 48 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
| 49 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
| 50 | 50 | ); |
| 51 | - $this->types['site_snippets'] = array( |
|
| 51 | + $this->types['site_snippets'] = array( |
|
| 52 | 52 | 'title'=>$_lang["manage_snippets"], |
| 53 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
| 54 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
| 53 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
| 54 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
| 55 | 55 | ); |
| 56 | - $this->types['site_plugins'] = array( |
|
| 56 | + $this->types['site_plugins'] = array( |
|
| 57 | 57 | 'title'=>$_lang["manage_plugins"], |
| 58 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
| 59 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
| 58 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
| 59 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
| 60 | 60 | ); |
| 61 | - $this->types['site_modules'] = array( |
|
| 61 | + $this->types['site_modules'] = array( |
|
| 62 | 62 | 'title'=>$_lang["manage_modules"], |
| 63 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
| 64 | - 'permissions'=>array('new_module','edit_module'), |
|
| 63 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
| 64 | + 'permissions'=>array('new_module', 'edit_module'), |
|
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @return void |
| 70 | 70 | */ |
| 71 | - public function queryItemsFromDB() { |
|
| 72 | - foreach($this->types as $resourceTable=>$type) { |
|
| 73 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
| 71 | + public function queryItemsFromDB(){ |
|
| 72 | + foreach ($this->types as $resourceTable=>$type) { |
|
| 73 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
| 74 | 74 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
| 75 | 75 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
| 76 | 76 | } |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | * @param array $permissions |
| 82 | 82 | * @return bool |
| 83 | 83 | */ |
| 84 | - public function hasAnyPermissions($permissions) { |
|
| 84 | + public function hasAnyPermissions($permissions){ |
|
| 85 | 85 | $modx = evolutionCMS(); |
| 86 | 86 | |
| 87 | - foreach($permissions as $p) |
|
| 88 | - if($modx->hasPermission($p)) return true; |
|
| 87 | + foreach ($permissions as $p) |
|
| 88 | + if ($modx->hasPermission($p)) return true; |
|
| 89 | 89 | |
| 90 | 90 | return false; |
| 91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param string $nameField |
| 96 | 96 | * @return array|bool |
| 97 | 97 | */ |
| 98 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
| 98 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
| 99 | 99 | $modx = evolutionCMS(); global $_lang; |
| 100 | 100 | |
| 101 | 101 | $allowed = array( |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | 'site_plugins', |
| 105 | 105 | 'site_modules' |
| 106 | 106 | ); |
| 107 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
| 107 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
| 108 | 108 | |
| 109 | 109 | $tvsql = ''; |
| 110 | 110 | $tvjoin = ''; |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $rs = $modx->getDatabase()->select( |
| 121 | 121 | "{$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", |
| 122 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
| 123 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 122 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
| 123 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
| 124 | 124 | "", |
| 125 | 125 | "category,name" |
| 126 | 126 | ); |
| 127 | 127 | $limit = $modx->getDatabase()->getRecordCount($rs); |
| 128 | 128 | |
| 129 | - if($limit < 1) return false; |
|
| 129 | + if ($limit < 1) return false; |
|
| 130 | 130 | |
| 131 | 131 | $result = array(); |
| 132 | 132 | while ($row = $modx->getDatabase()->getRow($rs)) { |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | /** |
| 139 | 139 | * @return void |
| 140 | 140 | */ |
| 141 | - public function prepareCategoryArrays() { |
|
| 142 | - foreach($this->items as $type=>$items) { |
|
| 143 | - foreach((array)$items as $item) { |
|
| 141 | + public function prepareCategoryArrays(){ |
|
| 142 | + foreach ($this->items as $type=>$items) { |
|
| 143 | + foreach ((array) $items as $item) { |
|
| 144 | 144 | $catid = $item['catid'] ? $item['catid'] : 0; |
| 145 | 145 | $this->categories[$catid] = $item['category']; |
| 146 | 146 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | natcasesort($this->categories); |
| 154 | 154 | |
| 155 | 155 | // Now sort by name |
| 156 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
| 157 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 156 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
| 157 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
| 158 | 158 | return strcasecmp($a['name'], $b['name']); |
| 159 | 159 | }); |
| 160 | 160 | } |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php namespace EvolutionCMS\Legacy; |
| 2 | 2 | |
| 3 | -class mgrResources { |
|
| 3 | +class mgrResources |
|
| 4 | +{ |
|
| 4 | 5 | /** |
| 5 | 6 | * @var array |
| 6 | 7 | */ |
@@ -21,7 +22,8 @@ discard block |
||
| 21 | 22 | /** |
| 22 | 23 | * mgrResources constructor. |
| 23 | 24 | */ |
| 24 | - public function __construct() { |
|
| 25 | + public function __construct() |
|
| 26 | + { |
|
| 25 | 27 | $this->setTypes(); |
| 26 | 28 | $this->queryItemsFromDB(); |
| 27 | 29 | $this->prepareCategoryArrays(); |
@@ -30,7 +32,8 @@ discard block |
||
| 30 | 32 | /** |
| 31 | 33 | * @return void |
| 32 | 34 | */ |
| 33 | - public function setTypes() { |
|
| 35 | + public function setTypes() |
|
| 36 | + { |
|
| 34 | 37 | global $_lang; |
| 35 | 38 | $this->types['site_templates'] = array( |
| 36 | 39 | 'title'=>$_lang["manage_templates"], |
@@ -68,7 +71,8 @@ discard block |
||
| 68 | 71 | /** |
| 69 | 72 | * @return void |
| 70 | 73 | */ |
| 71 | - public function queryItemsFromDB() { |
|
| 74 | + public function queryItemsFromDB() |
|
| 75 | + { |
|
| 72 | 76 | foreach($this->types as $resourceTable=>$type) { |
| 73 | 77 | if($this->hasAnyPermissions($type['permissions'])) { |
| 74 | 78 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -81,11 +85,13 @@ discard block |
||
| 81 | 85 | * @param array $permissions |
| 82 | 86 | * @return bool |
| 83 | 87 | */ |
| 84 | - public function hasAnyPermissions($permissions) { |
|
| 88 | + public function hasAnyPermissions($permissions) |
|
| 89 | + { |
|
| 85 | 90 | $modx = evolutionCMS(); |
| 86 | 91 | |
| 87 | - foreach($permissions as $p) |
|
| 88 | - if($modx->hasPermission($p)) return true; |
|
| 92 | + foreach($permissions as $p) { |
|
| 93 | + if($modx->hasPermission($p)) return true; |
|
| 94 | + } |
|
| 89 | 95 | |
| 90 | 96 | return false; |
| 91 | 97 | } |
@@ -95,7 +101,8 @@ discard block |
||
| 95 | 101 | * @param string $nameField |
| 96 | 102 | * @return array|bool |
| 97 | 103 | */ |
| 98 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
| 104 | + public function queryResources($resourceTable, $nameField = 'name') |
|
| 105 | + { |
|
| 99 | 106 | $modx = evolutionCMS(); global $_lang; |
| 100 | 107 | |
| 101 | 108 | $allowed = array( |
@@ -112,8 +119,9 @@ discard block |
||
| 112 | 119 | $tvsql = 'site_tmplvars.caption, '; |
| 113 | 120 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
| 114 | 121 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
| 122 | + } else { |
|
| 123 | + $sttfield = ''; |
|
| 115 | 124 | } |
| 116 | - else $sttfield = ''; |
|
| 117 | 125 | |
| 118 | 126 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
| 119 | 127 | |
@@ -126,7 +134,9 @@ discard block |
||
| 126 | 134 | ); |
| 127 | 135 | $limit = $modx->getDatabase()->getRecordCount($rs); |
| 128 | 136 | |
| 129 | - if($limit < 1) return false; |
|
| 137 | + if($limit < 1) { |
|
| 138 | + return false; |
|
| 139 | + } |
|
| 130 | 140 | |
| 131 | 141 | $result = array(); |
| 132 | 142 | while ($row = $modx->getDatabase()->getRow($rs)) { |
@@ -138,7 +148,8 @@ discard block |
||
| 138 | 148 | /** |
| 139 | 149 | * @return void |
| 140 | 150 | */ |
| 141 | - public function prepareCategoryArrays() { |
|
| 151 | + public function prepareCategoryArrays() |
|
| 152 | + { |
|
| 142 | 153 | foreach($this->items as $type=>$items) { |
| 143 | 154 | foreach((array)$items as $item) { |
| 144 | 155 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -154,7 +165,7 @@ discard block |
||
| 154 | 165 | |
| 155 | 166 | // Now sort by name |
| 156 | 167 | foreach($this->itemsPerCategory as $catid=>$items) { |
| 157 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
| 168 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
| 158 | 169 | return strcasecmp($a['name'], $b['name']); |
| 159 | 170 | }); |
| 160 | 171 | } |
@@ -5,10 +5,10 @@ |
||
| 5 | 5 | class DeprecatedCore implements DeprecatedCoreInterface |
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | - * @deprecated |
|
| 9 | - * |
|
| 10 | - * return @void |
|
| 11 | - */ |
|
| 8 | + * @deprecated |
|
| 9 | + * |
|
| 10 | + * return @void |
|
| 11 | + */ |
|
| 12 | 12 | public function dbConnect() |
| 13 | 13 | { |
| 14 | 14 | $modx = evolutionCMS(); |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | for ($i = 0; $i < $tablevel; $i++) { |
| 120 | 120 | $tabs .= "\t"; |
| 121 | 121 | } |
| 122 | - $listhtml = $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n"; |
|
| 122 | + $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n"; |
|
| 123 | 123 | foreach ($array as $key => $value) { |
| 124 | 124 | if (is_array($value)) { |
| 125 | - $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, |
|
| 126 | - $type, $ordered, $tablevel + 2) . $tabs . "\t</li>\n"; |
|
| 125 | + $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, |
|
| 126 | + $type, $ordered, $tablevel + 2).$tabs."\t</li>\n"; |
|
| 127 | 127 | } else { |
| 128 | - $listhtml .= $tabs . "\t<li>" . $value . "</li>\n"; |
|
| 128 | + $listhtml .= $tabs."\t<li>".$value."</li>\n"; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | - $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n"; |
|
| 131 | + $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n"; |
|
| 132 | 132 | |
| 133 | 133 | return $listhtml; |
| 134 | 134 | } |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | $msg = addslashes($modx->getDatabase()->escape($msg)); |
| 300 | 300 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 301 | 301 | $act = "__WebAlert();"; |
| 302 | - $fnc = "function __WebAlert(){" . substr($url, 11) . "};"; |
|
| 302 | + $fnc = "function __WebAlert(){".substr($url, 11)."};"; |
|
| 303 | 303 | } else { |
| 304 | - $act = ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
|
| 304 | + $act = ($url ? "window.location.href='".addslashes($url)."';" : ""); |
|
| 305 | 305 | } |
| 306 | 306 | $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
| 307 | 307 | if ($modx->isFrontend()) { |
@@ -177,7 +177,8 @@ |
||
| 177 | 177 | * @return bool|string |
| 178 | 178 | */ |
| 179 | 179 | public function putChunk($chunkName) |
| 180 | - { // alias name >.< |
|
| 180 | + { |
|
| 181 | +// alias name >.< |
|
| 181 | 182 | $modx = evolutionCMS(); |
| 182 | 183 | |
| 183 | 184 | return $modx->getChunk($chunkName); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $this->portable_hashes = $portable_hashes; |
| 50 | 50 | |
| 51 | - $this->random_state = microtime() . uniqid(mt_rand(), true); |
|
| 51 | + $this->random_state = microtime().uniqid(mt_rand(), true); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $output = ''; |
| 69 | 69 | for ($i = 0; $i < $count; $i += 16) { |
| 70 | 70 | $this->random_state = |
| 71 | - md5(microtime() . $this->random_state); |
|
| 71 | + md5(microtime().$this->random_state); |
|
| 72 | 72 | $output .= |
| 73 | 73 | pack('H*', md5($this->random_state)); |
| 74 | 74 | } |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | // consequently in lower iteration counts and hashes that are |
| 161 | 161 | // quicker to crack (by non-PHP code). |
| 162 | 162 | |
| 163 | - $hash = md5($salt . $password, true); |
|
| 163 | + $hash = md5($salt.$password, true); |
|
| 164 | 164 | do { |
| 165 | - $hash = md5($hash . $password, true); |
|
| 165 | + $hash = md5($hash.$password, true); |
|
| 166 | 166 | } while (--$count); |
| 167 | 167 | |
| 168 | 168 | $output = substr($setting, 0, 12); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | global $_lang, $_style; |
| 87 | 87 | |
| 88 | - $filename = trim($view_name) . '.tpl.phtml'; |
|
| 89 | - $file = self::get('views_dir') . $filename; |
|
| 88 | + $filename = trim($view_name).'.tpl.phtml'; |
|
| 89 | + $file = self::get('views_dir').$filename; |
|
| 90 | 90 | $view = &$this; |
| 91 | 91 | |
| 92 | 92 | if (is_file($file) |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | |
| 113 | 113 | $_update = array( |
| 114 | - 'id' => (int)$element_id, |
|
| 115 | - 'category' => (int)$category_id |
|
| 114 | + 'id' => (int) $element_id, |
|
| 115 | + 'category' => (int) $category_id |
|
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | $this->getDatabase()->update( |
| 119 | 119 | $_update, |
| 120 | 120 | $this->db_tbl[$element], |
| 121 | - "`id` = '" . (int)$element_id . "'" |
|
| 121 | + "`id` = '".(int) $element_id."'" |
|
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | return $this->getDatabase()->getAffectedRows() === 1; |
@@ -2,4 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Exception; |
| 4 | 4 | |
| 5 | -class ServiceNotFoundException extends Exception{} |
|
| 5 | +class ServiceNotFoundException extends Exception |
|
| 6 | +{ |
|
| 7 | +} |
|
@@ -2,4 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Exception; |
| 4 | 4 | |
| 5 | -class ContainerException extends Exception{} |
|
| 5 | +class ContainerException extends Exception |
|
| 6 | +{ |
|
| 7 | +} |
|
@@ -1,3 +1,5 @@ |
||
| 1 | 1 | <?php namespace EvolutionCMS\Interfaces; |
| 2 | 2 | |
| 3 | -interface ManagerApiInterface{} |
|
| 3 | +interface ManagerApiInterface |
|
| 4 | +{ |
|
| 5 | +} |
|