@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @param string $string |
| 39 | 39 | * @param string $charset |
| 40 | - * @return mixed |
|
| 40 | + * @return string |
|
| 41 | 41 | */ |
| 42 | 42 | function entities($string, $charset = 'UTF-8') |
| 43 | 43 | { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | if (! function_exists('get_by_key')) { |
| 49 | 49 | /** |
| 50 | 50 | * @param mixed $data |
| 51 | - * @param string|int $key |
|
| 51 | + * @param string $key |
|
| 52 | 52 | * @param mixed $default |
| 53 | 53 | * @param Closure $validate |
| 54 | 54 | * @return mixed |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!function_exists('createGUID')) { |
|
| 3 | +if (!function_exists('createGUID')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * create globally unique identifiers (guid) |
| 6 | 6 | * |
@@ -8,22 +8,22 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | function createGUID() |
| 10 | 10 | { |
| 11 | - srand((double)microtime() * 1000000); |
|
| 11 | + srand((double) microtime() * 1000000); |
|
| 12 | 12 | $r = rand(); |
| 13 | - $u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1); |
|
| 13 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
| 14 | 14 | $m = md5($u); |
| 15 | 15 | |
| 16 | 16 | return $m; |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if(!function_exists('generate_password')) { |
|
| 20 | +if (!function_exists('generate_password')) { |
|
| 21 | 21 | // Generate password |
| 22 | 22 | function generate_password($length = 10) |
| 23 | 23 | { |
| 24 | 24 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
| 25 | 25 | $ps_len = strlen($allowable_characters); |
| 26 | - mt_srand((double)microtime() * 1000000); |
|
| 26 | + mt_srand((double) microtime() * 1000000); |
|
| 27 | 27 | $pass = ""; |
| 28 | 28 | for ($i = 0; $i < $length; $i++) { |
| 29 | 29 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -if (! function_exists('entities')) { |
|
| 36 | +if (!function_exists('entities')) { |
|
| 37 | 37 | /** |
| 38 | 38 | * @param string $string |
| 39 | 39 | * @param string $charset |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -if (! function_exists('get_by_key')) { |
|
| 48 | +if (!function_exists('get_by_key')) { |
|
| 49 | 49 | /** |
| 50 | 50 | * @param mixed $data |
| 51 | 51 | * @param string|int $key |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (is_array($data) && (is_int($key) || is_string($key)) && $key !== '' && array_key_exists($key, $data)) { |
| 60 | 60 | $out = $data[$key]; |
| 61 | 61 | } |
| 62 | - if (! empty($validate) && is_callable($validate)) { |
|
| 62 | + if (!empty($validate) && is_callable($validate)) { |
|
| 63 | 63 | $out = (($validate($out) === true) ? $out : $default); |
| 64 | 64 | } |
| 65 | 65 | return $out; |
@@ -212,7 +212,6 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * @param array $services |
| 215 | - * @param array $parameters |
|
| 216 | 215 | */ |
| 217 | 216 | public function __construct(array $services = array()) |
| 218 | 217 | { |
@@ -282,6 +281,9 @@ discard block |
||
| 282 | 281 | return $service; |
| 283 | 282 | } |
| 284 | 283 | |
| 284 | + /** |
|
| 285 | + * @param string $name |
|
| 286 | + */ |
|
| 285 | 287 | private function checkServiceAlias($name){ |
| 286 | 288 | foreach ($this->providerAliases as $alias => $interface) { |
| 287 | 289 | if($name === $interface) { |
@@ -319,7 +321,7 @@ discard block |
||
| 319 | 321 | * |
| 320 | 322 | * @param object $service The service. |
| 321 | 323 | * @param string $name The service name. |
| 322 | - * @param array $callDefinitions The service calls definition. |
|
| 324 | + * @param boolean $callDefinitions The service calls definition. |
|
| 323 | 325 | * |
| 324 | 326 | * @throws Exceptions\ContainerException On failure. |
| 325 | 327 | */ |
@@ -561,7 +563,7 @@ discard block |
||
| 561 | 563 | * @param int $count_attempts |
| 562 | 564 | * @param string $type $type |
| 563 | 565 | * @param string $responseCode |
| 564 | - * @return bool|null |
|
| 566 | + * @return false|null |
|
| 565 | 567 | * @global string $base_url |
| 566 | 568 | * @global string $site_url |
| 567 | 569 | */ |
@@ -1262,7 +1264,7 @@ discard block |
||
| 1262 | 1264 | } |
| 1263 | 1265 | |
| 1264 | 1266 | /** |
| 1265 | - * @param $contents |
|
| 1267 | + * @param string $contents |
|
| 1266 | 1268 | * @return mixed |
| 1267 | 1269 | */ |
| 1268 | 1270 | public function RecoveryEscapedTags($contents) |
@@ -1286,7 +1288,7 @@ discard block |
||
| 1286 | 1288 | } |
| 1287 | 1289 | |
| 1288 | 1290 | /** |
| 1289 | - * @param $tstart |
|
| 1291 | + * @param double $tstart |
|
| 1290 | 1292 | * @return array |
| 1291 | 1293 | */ |
| 1292 | 1294 | public function getTimerStats($tstart) |
@@ -2052,7 +2054,7 @@ discard block |
||
| 2052 | 2054 | |
| 2053 | 2055 | /** |
| 2054 | 2056 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
| 2055 | - * @param $content |
|
| 2057 | + * @param string $content |
|
| 2056 | 2058 | * @param string $left |
| 2057 | 2059 | * @param string $right |
| 2058 | 2060 | * @return mixed |
@@ -2228,7 +2230,7 @@ discard block |
||
| 2228 | 2230 | /** |
| 2229 | 2231 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
| 2230 | 2232 | * |
| 2231 | - * @param $content |
|
| 2233 | + * @param string $content |
|
| 2232 | 2234 | * @return string |
| 2233 | 2235 | * @internal param string $documentSource |
| 2234 | 2236 | */ |
@@ -3263,7 +3265,7 @@ discard block |
||
| 3263 | 3265 | |
| 3264 | 3266 | /** |
| 3265 | 3267 | * @param $templateID |
| 3266 | - * @return mixed |
|
| 3268 | + * @return string |
|
| 3267 | 3269 | */ |
| 3268 | 3270 | public function _getTemplateCodeFromDB($templateID) |
| 3269 | 3271 | { |
@@ -3306,7 +3308,7 @@ discard block |
||
| 3306 | 3308 | /** |
| 3307 | 3309 | * @param $id |
| 3308 | 3310 | * @param int $top |
| 3309 | - * @return mixed |
|
| 3311 | + * @return string |
|
| 3310 | 3312 | */ |
| 3311 | 3313 | public function getUltimateParentId($id, $top = 0) |
| 3312 | 3314 | { |
@@ -3646,7 +3648,7 @@ discard block |
||
| 3646 | 3648 | * |
| 3647 | 3649 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3648 | 3650 | * @param int $id Element- / Resource-id |
| 3649 | - * @return bool |
|
| 3651 | + * @return false|null |
|
| 3650 | 3652 | */ |
| 3651 | 3653 | public function lockElement($type, $id) |
| 3652 | 3654 | { |
@@ -3668,7 +3670,7 @@ discard block |
||
| 3668 | 3670 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3669 | 3671 | * @param int $id Element- / Resource-id |
| 3670 | 3672 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
| 3671 | - * @return bool |
|
| 3673 | + * @return false|null |
|
| 3672 | 3674 | */ |
| 3673 | 3675 | public function unlockElement($type, $id, $includeAllUsers = false) |
| 3674 | 3676 | { |
@@ -4181,7 +4183,7 @@ discard block |
||
| 4181 | 4183 | * Default: 1 |
| 4182 | 4184 | * @param string $fields List of fields |
| 4183 | 4185 | * Default: id, pagetitle, description, alias |
| 4184 | - * @return boolean|array |
|
| 4186 | + * @return string |
|
| 4185 | 4187 | */ |
| 4186 | 4188 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
| 4187 | 4189 | { |
@@ -4273,7 +4275,7 @@ discard block |
||
| 4273 | 4275 | * |
| 4274 | 4276 | * @param string $type |
| 4275 | 4277 | * @param bool $report |
| 4276 | - * @return bool |
|
| 4278 | + * @return boolean|null |
|
| 4277 | 4279 | */ |
| 4278 | 4280 | public function clearCache($type = '', $report = false) |
| 4279 | 4281 | { |
@@ -4463,7 +4465,7 @@ discard block |
||
| 4463 | 4465 | * Note: most code accesses the config array directly and we will continue to support this. |
| 4464 | 4466 | * |
| 4465 | 4467 | * @param string $name |
| 4466 | - * @param mixed $default |
|
| 4468 | + * @param string $default |
|
| 4467 | 4469 | * @return bool|string |
| 4468 | 4470 | */ |
| 4469 | 4471 | public function getConfig($name = '', $default = null) |
@@ -4636,7 +4638,7 @@ discard block |
||
| 4636 | 4638 | * - Placeholders prefix. Default: '{'. |
| 4637 | 4639 | * @param string $suffix {string} |
| 4638 | 4640 | * - Placeholders suffix. Default: '}'. |
| 4639 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
| 4641 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
| 4640 | 4642 | * - Parsed chunk or false if $chunkArr is not array. |
| 4641 | 4643 | */ |
| 4642 | 4644 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5608,7 +5610,7 @@ discard block |
||
| 5608 | 5610 | * Remove event listener - only for use within the current execution cycle |
| 5609 | 5611 | * |
| 5610 | 5612 | * @param string $evtName |
| 5611 | - * @return boolean |
|
| 5613 | + * @return false|null |
|
| 5612 | 5614 | */ |
| 5613 | 5615 | public function removeEventListener($evtName) |
| 5614 | 5616 | { |
@@ -5632,7 +5634,7 @@ discard block |
||
| 5632 | 5634 | * |
| 5633 | 5635 | * @param string $evtName |
| 5634 | 5636 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
| 5635 | - * @return boolean|array |
|
| 5637 | + * @return false|null |
|
| 5636 | 5638 | */ |
| 5637 | 5639 | public function invokeEvent($evtName, $extParams = array()) |
| 5638 | 5640 | { |
@@ -6277,7 +6279,7 @@ discard block |
||
| 6277 | 6279 | |
| 6278 | 6280 | /** |
| 6279 | 6281 | * @param string $str |
| 6280 | - * @return bool|mixed|string |
|
| 6282 | + * @return string |
|
| 6281 | 6283 | */ |
| 6282 | 6284 | public function atBindFileContent($str = '') |
| 6283 | 6285 | { |
@@ -6328,8 +6330,8 @@ discard block |
||
| 6328 | 6330 | } |
| 6329 | 6331 | |
| 6330 | 6332 | /** |
| 6331 | - * @param $str |
|
| 6332 | - * @return bool|string |
|
| 6333 | + * @param string $str |
|
| 6334 | + * @return false|string |
|
| 6333 | 6335 | */ |
| 6334 | 6336 | public function getExtFromFilename($str) |
| 6335 | 6337 | { |
@@ -6357,7 +6359,7 @@ discard block |
||
| 6357 | 6359 | * @param string $text Error message |
| 6358 | 6360 | * @param string $file File where the error was detected |
| 6359 | 6361 | * @param string $line Line number within $file |
| 6360 | - * @return boolean |
|
| 6362 | + * @return boolean|null |
|
| 6361 | 6363 | */ |
| 6362 | 6364 | public function phpError($nr, $text, $file, $line) |
| 6363 | 6365 | { |
@@ -6409,7 +6411,7 @@ discard block |
||
| 6409 | 6411 | * @param string $text |
| 6410 | 6412 | * @param string $line |
| 6411 | 6413 | * @param string $output |
| 6412 | - * @return bool |
|
| 6414 | + * @return null|boolean |
|
| 6413 | 6415 | */ |
| 6414 | 6416 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
| 6415 | 6417 | { |
@@ -6824,7 +6826,7 @@ discard block |
||
| 6824 | 6826 | |
| 6825 | 6827 | /** |
| 6826 | 6828 | * @param string $str |
| 6827 | - * @return bool|mixed|string |
|
| 6829 | + * @return string |
|
| 6828 | 6830 | */ |
| 6829 | 6831 | public function atBindInclude($str = '') |
| 6830 | 6832 | { |
@@ -6875,7 +6877,7 @@ discard block |
||
| 6875 | 6877 | * @param $str |
| 6876 | 6878 | * @param int $flags |
| 6877 | 6879 | * @param string $encode |
| 6878 | - * @return mixed |
|
| 6880 | + * @return null|string |
|
| 6879 | 6881 | */ |
| 6880 | 6882 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
| 6881 | 6883 | { |
@@ -6883,7 +6885,7 @@ discard block |
||
| 6883 | 6885 | } |
| 6884 | 6886 | |
| 6885 | 6887 | /** |
| 6886 | - * @param $string |
|
| 6888 | + * @param string $string |
|
| 6887 | 6889 | * @param bool $returnData |
| 6888 | 6890 | * @return bool|mixed |
| 6889 | 6891 | */ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $pre = null, |
| 34 | 34 | $charset = '', |
| 35 | 35 | $connection_method = 'SET CHARACTER SET' |
| 36 | - ) { |
|
| 36 | + ){ |
|
| 37 | 37 | $this->config['host'] = $host ? $host : $GLOBALS['database_server']; |
| 38 | 38 | $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase']; |
| 39 | 39 | $this->config['user'] = $uid ? $uid : $GLOBALS['database_user']; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $ua = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT']); |
| 74 | 74 | $referer = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER']); |
| 75 | 75 | $modx->sendmail(array( |
| 76 | - 'subject' => 'Missing to create the database connection! from ' . $modx->getPhpCompat()->entities($modx->config['site_name']), |
|
| 76 | + 'subject' => 'Missing to create the database connection! from '.$modx->getPhpCompat()->entities($modx->config['site_name']), |
|
| 77 | 77 | 'body' => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}", |
| 78 | 78 | 'type' => 'text' |
| 79 | 79 | )); |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | $tend = $modx->getMicroTime(); |
| 89 | 89 | $totaltime = $tend - $tstart; |
| 90 | 90 | if ($modx->dumpSQL) { |
| 91 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s", |
|
| 92 | - $totaltime) . "</fieldset><br />"; |
|
| 91 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s", |
|
| 92 | + $totaltime)."</fieldset><br />"; |
|
| 93 | 93 | } |
| 94 | 94 | $this->conn->set_charset($this->config['charset']); |
| 95 | 95 | $this->isConnected = true; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if (1000 < $safeCount) { |
| 123 | 123 | exit("Too many loops '{$safeCount}'"); |
| 124 | 124 | } |
| 125 | - if ( ! ($this->conn instanceof mysqli)) { |
|
| 125 | + if (!($this->conn instanceof mysqli)) { |
|
| 126 | 126 | $this->connect(); |
| 127 | 127 | } |
| 128 | 128 | if (is_array($s)) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | public function query($sql, $watchError = true) |
| 149 | 149 | { |
| 150 | 150 | $modx = evolutionCMS(); |
| 151 | - if ( ! ($this->conn instanceof mysqli)) { |
|
| 151 | + if (!($this->conn instanceof mysqli)) { |
|
| 152 | 152 | $this->connect(); |
| 153 | 153 | } |
| 154 | 154 | $tStart = $modx->getMicroTime(); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | case 1091: |
| 169 | 169 | break; |
| 170 | 170 | default: |
| 171 | - $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql); |
|
| 171 | + $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql); |
|
| 172 | 172 | } |
| 173 | 173 | } else { |
| 174 | 174 | $tend = $modx->getMicroTime(); |
@@ -182,24 +182,24 @@ discard block |
||
| 182 | 182 | $debug_path[] = $line['function']; |
| 183 | 183 | } |
| 184 | 184 | $debug_path = implode(' > ', array_reverse($debug_path)); |
| 185 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms", |
|
| 186 | - $totalTime * 1000) . "</legend>"; |
|
| 187 | - $modx->queryCode .= $sql . '<br><br>'; |
|
| 185 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms", |
|
| 186 | + $totalTime * 1000)."</legend>"; |
|
| 187 | + $modx->queryCode .= $sql.'<br><br>'; |
|
| 188 | 188 | if ($modx->event->name) { |
| 189 | - $modx->queryCode .= 'Current Event => ' . $modx->event->name . '<br>'; |
|
| 189 | + $modx->queryCode .= 'Current Event => '.$modx->event->name.'<br>'; |
|
| 190 | 190 | } |
| 191 | 191 | if ($modx->event->activePlugin) { |
| 192 | - $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>'; |
|
| 192 | + $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>'; |
|
| 193 | 193 | } |
| 194 | 194 | if ($modx->currentSnippet) { |
| 195 | - $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>'; |
|
| 195 | + $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>'; |
|
| 196 | 196 | } |
| 197 | 197 | if (stripos($sql, 'select') === 0) { |
| 198 | - $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>'; |
|
| 198 | + $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>'; |
|
| 199 | 199 | } else { |
| 200 | - $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>'; |
|
| 200 | + $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>'; |
|
| 201 | 201 | } |
| 202 | - $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>'; |
|
| 202 | + $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>'; |
|
| 203 | 203 | $modx->queryCode .= "</fieldset><br />"; |
| 204 | 204 | } |
| 205 | 205 | $modx->executedQueries++; |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | if ($value === null || strtolower($value) === 'null') { |
| 307 | 307 | $f = 'NULL'; |
| 308 | 308 | } else { |
| 309 | - $f = "'" . $value . "'"; |
|
| 309 | + $f = "'".$value."'"; |
|
| 310 | 310 | } |
| 311 | - $fields[$key] = "`{$key}` = " . $f; |
|
| 311 | + $fields[$key] = "`{$key}` = ".$f; |
|
| 312 | 312 | } |
| 313 | 313 | $fields = implode(',', $fields); |
| 314 | 314 | } |
@@ -343,12 +343,12 @@ discard block |
||
| 343 | 343 | $this->query("INSERT INTO {$intotable} {$fields}"); |
| 344 | 344 | } else { |
| 345 | 345 | if (empty($fromtable)) { |
| 346 | - $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '", |
|
| 347 | - array_values($fields)) . "')"; |
|
| 346 | + $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '", |
|
| 347 | + array_values($fields))."')"; |
|
| 348 | 348 | $this->query("INSERT INTO {$intotable} {$fields}"); |
| 349 | 349 | } else { |
| 350 | 350 | $fromtable = $this->replaceFullTableName($fromtable); |
| 351 | - $fields = "(" . implode(",", array_keys($fields)) . ")"; |
|
| 351 | + $fields = "(".implode(",", array_keys($fields)).")"; |
|
| 352 | 352 | $where = trim($where); |
| 353 | 353 | $limit = trim($limit); |
| 354 | 354 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | public function getInsertId($conn = null) |
| 444 | 444 | { |
| 445 | - if (! ($conn instanceof mysqli)) { |
|
| 446 | - $conn =& $this->conn; |
|
| 445 | + if (!($conn instanceof mysqli)) { |
|
| 446 | + $conn = & $this->conn; |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | return $conn->insert_id; |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | public function getAffectedRows($conn = null) |
| 457 | 457 | { |
| 458 | - if (! ($conn instanceof mysqli)) { |
|
| 459 | - $conn =& $this->conn; |
|
| 458 | + if (!($conn instanceof mysqli)) { |
|
| 459 | + $conn = & $this->conn; |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | return $conn->affected_rows; |
@@ -468,8 +468,8 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | public function getLastError($conn = null) |
| 470 | 470 | { |
| 471 | - if (! ($conn instanceof mysqli)) { |
|
| 472 | - $conn =& $this->conn; |
|
| 471 | + if (!($conn instanceof mysqli)) { |
|
| 472 | + $conn = & $this->conn; |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | return $conn->error; |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | { |
| 494 | 494 | $out = false; |
| 495 | 495 | if ($ds instanceof mysqli_result) { |
| 496 | - switch($mode){ |
|
| 496 | + switch ($mode) { |
|
| 497 | 497 | case 'assoc': |
| 498 | 498 | $out = $ds->fetch_assoc(); |
| 499 | 499 | break; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | public function getColumn($name, $dsq) |
| 524 | 524 | { |
| 525 | 525 | $col = array(); |
| 526 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
| 526 | + if (!($dsq instanceof mysqli_result)) { |
|
| 527 | 527 | $dsq = $this->query($dsq); |
| 528 | 528 | } |
| 529 | 529 | if ($dsq) { |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | public function getColumnNames($dsq) |
| 543 | 543 | { |
| 544 | 544 | $names = array(); |
| 545 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
| 545 | + if (!($dsq instanceof mysqli_result)) { |
|
| 546 | 546 | $dsq = $this->query($dsq); |
| 547 | 547 | } |
| 548 | 548 | if ($dsq) { |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | public function getValue($dsq) |
| 563 | 563 | { |
| 564 | 564 | $out = false; |
| 565 | - if ( ! ($dsq instanceof mysqli_result)) { |
|
| 565 | + if (!($dsq instanceof mysqli_result)) { |
|
| 566 | 566 | $dsq = $this->query($dsq); |
| 567 | 567 | } |
| 568 | 568 | if ($dsq) { |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $tableName = trim($tableName); |
| 661 | 661 | $dbase = trim($this->config['dbase'], '`'); |
| 662 | 662 | $prefix = $this->config['table_prefix']; |
| 663 | - if ((bool)$force === true) { |
|
| 663 | + if ((bool) $force === true) { |
|
| 664 | 664 | $result = "`{$dbase}`.`{$prefix}{$tableName}`"; |
| 665 | 665 | } elseif (strpos($tableName, '[+prefix+]') !== false) { |
| 666 | 666 | $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // Set line feed |
| 75 | 75 | $lf = "\n"; |
| 76 | - $tempfile_path = $modx->config['base_path'] . 'assets/backup/temp.php'; |
|
| 76 | + $tempfile_path = $modx->config['base_path'].'assets/backup/temp.php'; |
|
| 77 | 77 | |
| 78 | 78 | $result = $modx->getDatabase()->query('SHOW TABLES'); |
| 79 | 79 | $tables = $this->result2Array(0, $result); |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // Set header |
| 88 | 88 | $output = "#{$lf}"; |
| 89 | - $output .= "# " . addslashes($modx->getPhpCompat()->entities($modx->config['site_name'])) . " Database Dump{$lf}"; |
|
| 89 | + $output .= "# ".addslashes($modx->getPhpCompat()->entities($modx->config['site_name']))." Database Dump{$lf}"; |
|
| 90 | 90 | $output .= "# MODX Version:{$version['version']}{$lf}"; |
| 91 | 91 | $output .= "# {$lf}"; |
| 92 | 92 | $output .= "# Host: {$this->database_server}{$lf}"; |
| 93 | - $output .= "# Generation Time: " . $modx->toDateFormat(time()) . $lf; |
|
| 94 | - $output .= "# Server version: " . $modx->getDatabase()->getVersion() . $lf; |
|
| 95 | - $output .= "# PHP Version: " . phpversion() . $lf; |
|
| 93 | + $output .= "# Generation Time: ".$modx->toDateFormat(time()).$lf; |
|
| 94 | + $output .= "# Server version: ".$modx->getDatabase()->getVersion().$lf; |
|
| 95 | + $output .= "# PHP Version: ".phpversion().$lf; |
|
| 96 | 96 | $output .= "# Database: `{$this->dbname}`{$lf}"; |
| 97 | - $output .= "# Description: " . trim($_REQUEST['backup_title']) . "{$lf}"; |
|
| 97 | + $output .= "# Description: ".trim($_REQUEST['backup_title'])."{$lf}"; |
|
| 98 | 98 | $output .= "#"; |
| 99 | 99 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
| 100 | 100 | $output = ''; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | if ($callBack === 'snapshot') { |
| 116 | - if (!preg_match('@^' . $modx->getDatabase()->config['table_prefix'] . '@', $tblval)) { |
|
| 116 | + if (!preg_match('@^'.$modx->getDatabase()->config['table_prefix'].'@', $tblval)) { |
|
| 117 | 117 | continue; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | ), '\\n', $value); |
| 151 | 151 | $value = "'{$value}'"; |
| 152 | 152 | } |
| 153 | - $insertdump .= $value . ','; |
|
| 153 | + $insertdump .= $value.','; |
|
| 154 | 154 | } |
| 155 | - $output .= rtrim($insertdump, ',') . ");\n"; |
|
| 155 | + $output .= rtrim($insertdump, ',').");\n"; |
|
| 156 | 156 | if (1048576 < strlen($output)) { |
| 157 | 157 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
| 158 | 158 | $output = ''; |
@@ -1,75 +1,75 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -if($modx->getManagerApi()->action!='8' && isset($_SESSION['mgrValidated'])){ |
|
| 6 | +if ($modx->getManagerApi()->action != '8' && isset($_SESSION['mgrValidated'])) { |
|
| 7 | 7 | |
| 8 | - $homeurl = $modx->makeUrl($manager_login_startup>0 ? $manager_login_startup:$site_start); |
|
| 8 | + $homeurl = $modx->makeUrl($manager_login_startup > 0 ? $manager_login_startup : $site_start); |
|
| 9 | 9 | $logouturl = MODX_MANAGER_URL.'index.php?a=8'; |
| 10 | 10 | |
| 11 | - $modx->setPlaceholder('modx_charset',$modx_manager_charset); |
|
| 12 | - $modx->setPlaceholder('theme',$manager_theme); |
|
| 11 | + $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
|
| 12 | + $modx->setPlaceholder('theme', $manager_theme); |
|
| 13 | 13 | |
| 14 | - $modx->setPlaceholder('site_name',$modx->getPhpCompat()->entities($site_name)); |
|
| 15 | - $modx->setPlaceholder('logo_slogan',$_lang["logo_slogan"]); |
|
| 16 | - $modx->setPlaceholder('manager_lockout_message',$_lang["manager_lockout_message"]); |
|
| 14 | + $modx->setPlaceholder('site_name', $modx->getPhpCompat()->entities($site_name)); |
|
| 15 | + $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
|
| 16 | + $modx->setPlaceholder('manager_lockout_message', $_lang["manager_lockout_message"]); |
|
| 17 | 17 | |
| 18 | - $modx->setPlaceholder('home',$_lang["home"]); |
|
| 19 | - $modx->setPlaceholder('homeurl',$homeurl); |
|
| 20 | - $modx->setPlaceholder('logout',$_lang["logout"]); |
|
| 21 | - $modx->setPlaceholder('logouturl',$logouturl); |
|
| 22 | - $modx->setPlaceholder('manager_theme_url',MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
| 23 | - $modx->setPlaceholder('year',date('Y')); |
|
| 18 | + $modx->setPlaceholder('home', $_lang["home"]); |
|
| 19 | + $modx->setPlaceholder('homeurl', $homeurl); |
|
| 20 | + $modx->setPlaceholder('logout', $_lang["logout"]); |
|
| 21 | + $modx->setPlaceholder('logouturl', $logouturl); |
|
| 22 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
| 23 | + $modx->setPlaceholder('year', date('Y')); |
|
| 24 | 24 | |
| 25 | 25 | // load template |
| 26 | - if(!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) { |
|
| 27 | - $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
| 26 | + if (!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) { |
|
| 27 | + $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH.'media/style/common/manager.lockout.tpl'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $target = $modx->config['manager_lockout_tpl']; |
| 31 | 31 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
| 32 | 32 | $target = $modx->mergeSettingsContent($target); |
| 33 | 33 | |
| 34 | - if(substr($target,0,1)==='@') { |
|
| 35 | - if(substr($target,0,6)==='@CHUNK') { |
|
| 36 | - $target = trim(substr($target,7)); |
|
| 34 | + if (substr($target, 0, 1) === '@') { |
|
| 35 | + if (substr($target, 0, 6) === '@CHUNK') { |
|
| 36 | + $target = trim(substr($target, 7)); |
|
| 37 | 37 | $lockout_tpl = $modx->getChunk($target); |
| 38 | 38 | } |
| 39 | - elseif(substr($target,0,5)==='@FILE') { |
|
| 40 | - $target = trim(substr($target,6)); |
|
| 39 | + elseif (substr($target, 0, 5) === '@FILE') { |
|
| 40 | + $target = trim(substr($target, 6)); |
|
| 41 | 41 | $lockout_tpl = file_get_contents($target); |
| 42 | 42 | } |
| 43 | 43 | } else { |
| 44 | 44 | $chunk = $modx->getChunk($target); |
| 45 | - if($chunk!==false && !empty($chunk)) { |
|
| 45 | + if ($chunk !== false && !empty($chunk)) { |
|
| 46 | 46 | $lockout_tpl = $chunk; |
| 47 | 47 | } |
| 48 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 49 | - $target = MODX_BASE_PATH . $target; |
|
| 48 | + elseif (is_file(MODX_BASE_PATH.$target)) { |
|
| 49 | + $target = MODX_BASE_PATH.$target; |
|
| 50 | 50 | $lockout_tpl = file_get_contents($target); |
| 51 | 51 | } |
| 52 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
| 53 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
|
| 52 | + elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/manager.lockout.tpl')) { |
|
| 53 | + $target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/manager.lockout.tpl'; |
|
| 54 | 54 | $lockout_tpl = file_get_contents($target); |
| 55 | 55 | } |
| 56 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
| 57 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
|
| 56 | + elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/templates/actions/manager.lockout.tpl')) { |
|
| 57 | + $target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/templates/actions/manager.lockout.tpl'; |
|
| 58 | 58 | $login_tpl = file_get_contents($target); |
| 59 | 59 | } |
| 60 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
| 61 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
|
| 60 | + elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/manager.lockout.html')) { // ClipperCMS compatible |
|
| 61 | + $target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/manager.lockout.html'; |
|
| 62 | 62 | $lockout_tpl = file_get_contents($target); |
| 63 | 63 | } |
| 64 | 64 | else { |
| 65 | - $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
| 65 | + $target = MODX_MANAGER_PATH.'media/style/common/manager.lockout.tpl'; |
|
| 66 | 66 | $lockout_tpl = file_get_contents($target); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // merge placeholders |
| 71 | 71 | $lockout_tpl = $modx->mergePlaceholderContent($lockout_tpl); |
| 72 | - $regx = strpos($lockout_tpl,'[[+')!==false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers |
|
| 72 | + $regx = strpos($lockout_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers |
|
| 73 | 73 | $lockout_tpl = preg_replace($regx, '', $lockout_tpl); //cleanup |
| 74 | 74 | |
| 75 | 75 | echo $lockout_tpl; |
@@ -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,29 +12,29 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | 14 | switch($modx->getManagerApi()->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 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 28 | - $udperms->user = $modx->getLoginUserID(); |
|
| 29 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 30 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 31 | - if(!$udperms->checkPermissions()) { |
|
| 32 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - break; |
|
| 36 | - default: |
|
| 37 | - $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 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 28 | + $udperms->user = $modx->getLoginUserID(); |
|
| 29 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 30 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 31 | + if(!$udperms->checkPermissions()) { |
|
| 32 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + break; |
|
| 36 | + default: |
|
| 37 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 54 | 54 | |
| 55 | 55 | if($modx->getManagerApi()->action == 27) { |
| 56 | - //editing an existing document |
|
| 57 | - // check permissions on the document |
|
| 58 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 59 | - $udperms->user = $modx->getLoginUserID(); |
|
| 60 | - $udperms->document = $id; |
|
| 61 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 62 | - |
|
| 63 | - if(!$udperms->checkPermissions()) { |
|
| 64 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 65 | - } |
|
| 56 | + //editing an existing document |
|
| 57 | + // check permissions on the document |
|
| 58 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 59 | + $udperms->user = $modx->getLoginUserID(); |
|
| 60 | + $udperms->document = $id; |
|
| 61 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 62 | + |
|
| 63 | + if(!$udperms->checkPermissions()) { |
|
| 64 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // check to see if resource isn't locked |
| 69 | 69 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
| 70 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 70 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 71 | 71 | } |
| 72 | 72 | // end check for lock |
| 73 | 73 | |
@@ -76,74 +76,74 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // get document groups for current user |
| 78 | 78 | if($_SESSION['mgrDocgroups']) { |
| 79 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 79 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if(!empty ($id)) { |
| 83 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 84 | - if($docgrp) { |
|
| 85 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 86 | - } |
|
| 87 | - $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 88 | - $content = array(); |
|
| 89 | - $content = $modx->getDatabase()->getRow($rs); |
|
| 90 | - $modx->documentObject = &$content; |
|
| 91 | - if(!$content) { |
|
| 92 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 93 | - } |
|
| 94 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
| 83 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 84 | + if($docgrp) { |
|
| 85 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 86 | + } |
|
| 87 | + $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 88 | + $content = array(); |
|
| 89 | + $content = $modx->getDatabase()->getRow($rs); |
|
| 90 | + $modx->documentObject = &$content; |
|
| 91 | + if(!$content) { |
|
| 92 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 93 | + } |
|
| 94 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
| 95 | 95 | } else { |
| 96 | - $content = array(); |
|
| 96 | + $content = array(); |
|
| 97 | 97 | |
| 98 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 99 | - $content['template'] = $_REQUEST['newtemplate']; |
|
| 100 | - } else { |
|
| 101 | - $content['template'] = getDefaultTemplate(); |
|
| 102 | - } |
|
| 98 | + if(isset($_REQUEST['newtemplate'])) { |
|
| 99 | + $content['template'] = $_REQUEST['newtemplate']; |
|
| 100 | + } else { |
|
| 101 | + $content['template'] = getDefaultTemplate(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 104 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // restore saved form |
| 108 | 108 | $formRestored = $modx->getManagerApi()->loadFormValues(); |
| 109 | 109 | if(isset($_REQUEST['newtemplate'])) { |
| 110 | - $formRestored = true; |
|
| 110 | + $formRestored = true; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // retain form values if template was changed |
| 114 | 114 | // edited to convert pub_date and unpub_date |
| 115 | 115 | // sottwell 02-09-2006 |
| 116 | 116 | if($formRestored == true) { |
| 117 | - $content = array_merge($content, $_POST); |
|
| 118 | - $content['content'] = $_POST['ta']; |
|
| 119 | - if(empty ($content['pub_date'])) { |
|
| 120 | - unset ($content['pub_date']); |
|
| 121 | - } else { |
|
| 122 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 123 | - } |
|
| 124 | - if(empty ($content['unpub_date'])) { |
|
| 125 | - unset ($content['unpub_date']); |
|
| 126 | - } else { |
|
| 127 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 128 | - } |
|
| 117 | + $content = array_merge($content, $_POST); |
|
| 118 | + $content['content'] = $_POST['ta']; |
|
| 119 | + if(empty ($content['pub_date'])) { |
|
| 120 | + unset ($content['pub_date']); |
|
| 121 | + } else { |
|
| 122 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 123 | + } |
|
| 124 | + if(empty ($content['unpub_date'])) { |
|
| 125 | + unset ($content['unpub_date']); |
|
| 126 | + } else { |
|
| 127 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // increase menu index if this is a new document |
| 132 | 132 | if(!isset ($_REQUEST['id'])) { |
| 133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | - $modx->config['auto_menuindex'] = 1; |
|
| 135 | - } |
|
| 136 | - if($modx->config['auto_menuindex']) { |
|
| 137 | - $pid = (int)$_REQUEST['pid']; |
|
| 138 | - $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 139 | - $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
| 140 | - } else { |
|
| 141 | - $content['menuindex'] = 0; |
|
| 142 | - } |
|
| 133 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | + $modx->config['auto_menuindex'] = 1; |
|
| 135 | + } |
|
| 136 | + if($modx->config['auto_menuindex']) { |
|
| 137 | + $pid = (int)$_REQUEST['pid']; |
|
| 138 | + $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 139 | + $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
| 140 | + } else { |
|
| 141 | + $content['menuindex'] = 0; |
|
| 142 | + } |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if(isset ($_POST['which_editor'])) { |
| 146 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 146 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Add lock-element JS-Script |
@@ -543,23 +543,23 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
| 545 | 545 | <?php |
| 546 | - // invoke OnDocFormPrerender event |
|
| 547 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 548 | - 'id' => $id, |
|
| 549 | - 'template' => $content['template'] |
|
| 550 | - )); |
|
| 551 | - |
|
| 552 | - if(is_array($evtOut)) { |
|
| 553 | - echo implode('', $evtOut); |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - /*************************/ |
|
| 557 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 558 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 559 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 560 | - /*************************/ |
|
| 561 | - |
|
| 562 | - ?> |
|
| 546 | + // invoke OnDocFormPrerender event |
|
| 547 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 548 | + 'id' => $id, |
|
| 549 | + 'template' => $content['template'] |
|
| 550 | + )); |
|
| 551 | + |
|
| 552 | + if(is_array($evtOut)) { |
|
| 553 | + echo implode('', $evtOut); |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + /*************************/ |
|
| 557 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 558 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 559 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 560 | + /*************************/ |
|
| 561 | + |
|
| 562 | + ?> |
|
| 563 | 563 | <input type="hidden" name="a" value="5" /> |
| 564 | 564 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
| 565 | 565 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" /> |
@@ -574,54 +574,54 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | <h1> |
| 576 | 576 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
| 577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | - } else { |
|
| 579 | - if ($modx->getManagerApi()->action == '4') { |
|
| 577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | + } else { |
|
| 579 | + if ($modx->getManagerApi()->action == '4') { |
|
| 580 | 580 | echo $_lang['add_resource']; |
| 581 | 581 | } else if ($modx->getManagerApi()->action == '72') { |
| 582 | 582 | echo $_lang['add_weblink']; |
| 583 | 583 | } else { |
| 584 | 584 | echo $_lang['create_resource_title']; |
| 585 | 585 | } |
| 586 | - } ?> |
|
| 586 | + } ?> |
|
| 587 | 587 | </h1> |
| 588 | 588 | |
| 589 | 589 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
| 590 | 590 | |
| 591 | 591 | <?php |
| 592 | - // breadcrumbs |
|
| 593 | - if($modx->config['use_breadcrumbs']) { |
|
| 594 | - $temp = array(); |
|
| 595 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 596 | - |
|
| 597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | - $bID = (int) $_REQUEST['id']; |
|
| 599 | - $temp = $modx->getParentIds($bID); |
|
| 600 | - } else if(isset($_REQUEST['pid'])) { |
|
| 601 | - $bID = (int) $_REQUEST['pid']; |
|
| 602 | - $temp = $modx->getParentIds($bID); |
|
| 603 | - array_unshift($temp, $bID); |
|
| 604 | - } |
|
| 605 | - |
|
| 606 | - if($temp) { |
|
| 607 | - $parents = implode(',', $temp); |
|
| 608 | - |
|
| 609 | - if(!empty($parents)) { |
|
| 610 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 611 | - $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 612 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 613 | - $out .= '<li class="breadcrumbs__li"> |
|
| 592 | + // breadcrumbs |
|
| 593 | + if($modx->config['use_breadcrumbs']) { |
|
| 594 | + $temp = array(); |
|
| 595 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 596 | + |
|
| 597 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | + $bID = (int) $_REQUEST['id']; |
|
| 599 | + $temp = $modx->getParentIds($bID); |
|
| 600 | + } else if(isset($_REQUEST['pid'])) { |
|
| 601 | + $bID = (int) $_REQUEST['pid']; |
|
| 602 | + $temp = $modx->getParentIds($bID); |
|
| 603 | + array_unshift($temp, $bID); |
|
| 604 | + } |
|
| 605 | + |
|
| 606 | + if($temp) { |
|
| 607 | + $parents = implode(',', $temp); |
|
| 608 | + |
|
| 609 | + if(!empty($parents)) { |
|
| 610 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 611 | + $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 612 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 613 | + $out .= '<li class="breadcrumbs__li"> |
|
| 614 | 614 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
| 615 | 615 | <span class="breadcrumbs__sep">></span> |
| 616 | 616 | </li>'; |
| 617 | - } |
|
| 618 | - } |
|
| 619 | - } |
|
| 617 | + } |
|
| 618 | + } |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | - } |
|
| 624 | - ?> |
|
| 621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | + } |
|
| 624 | + ?> |
|
| 625 | 625 | |
| 626 | 626 | <!-- start main wrapper --> |
| 627 | 627 | <div class="sectionBody"> |
@@ -633,13 +633,13 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | <!-- General --> |
| 635 | 635 | <?php |
| 636 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 637 | - 'id' => $id |
|
| 638 | - )); |
|
| 639 | - if(is_array($evtOut)) { |
|
| 640 | - echo implode('', $evtOut); |
|
| 641 | - } else { |
|
| 642 | - ?> |
|
| 636 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 637 | + 'id' => $id |
|
| 638 | + )); |
|
| 639 | + if(is_array($evtOut)) { |
|
| 640 | + echo implode('', $evtOut); |
|
| 641 | + } else { |
|
| 642 | + ?> |
|
| 643 | 643 | <div class="tab-page" id="tabGeneral"> |
| 644 | 644 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
| 645 | 645 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -724,36 +724,36 @@ discard block |
||
| 724 | 724 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
| 725 | 725 | <option value="0">(blank)</option> |
| 726 | 726 | <?php |
| 727 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 728 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 729 | - $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 730 | - $currentCategory = ''; |
|
| 731 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | - continue; |
|
| 734 | - }; |
|
| 735 | - // Skip if not selectable but show if selected! |
|
| 736 | - $thisCategory = $row['category']; |
|
| 737 | - if($thisCategory == null) { |
|
| 738 | - $thisCategory = $_lang["no_category"]; |
|
| 739 | - } |
|
| 740 | - if($thisCategory != $currentCategory) { |
|
| 741 | - if($closeOptGroup) { |
|
| 742 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 743 | - } |
|
| 744 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 745 | - $closeOptGroup = true; |
|
| 746 | - } |
|
| 727 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 728 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 729 | + $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 730 | + $currentCategory = ''; |
|
| 731 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 732 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | + continue; |
|
| 734 | + }; |
|
| 735 | + // Skip if not selectable but show if selected! |
|
| 736 | + $thisCategory = $row['category']; |
|
| 737 | + if($thisCategory == null) { |
|
| 738 | + $thisCategory = $_lang["no_category"]; |
|
| 739 | + } |
|
| 740 | + if($thisCategory != $currentCategory) { |
|
| 741 | + if($closeOptGroup) { |
|
| 742 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 743 | + } |
|
| 744 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 745 | + $closeOptGroup = true; |
|
| 746 | + } |
|
| 747 | 747 | |
| 748 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 748 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 749 | 749 | |
| 750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 751 | - $currentCategory = $thisCategory; |
|
| 752 | - } |
|
| 753 | - if($thisCategory != '') { |
|
| 754 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 755 | - } |
|
| 756 | - ?> |
|
| 750 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 751 | + $currentCategory = $thisCategory; |
|
| 752 | + } |
|
| 753 | + if($thisCategory != '') { |
|
| 754 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 755 | + } |
|
| 756 | + ?> |
|
| 757 | 757 | </select> |
| 758 | 758 | </td> |
| 759 | 759 | </tr> |
@@ -793,37 +793,37 @@ discard block |
||
| 793 | 793 | </td> |
| 794 | 794 | <td valign="top"> |
| 795 | 795 | <?php |
| 796 | - $parentlookup = false; |
|
| 797 | - if(isset ($_REQUEST['id'])) { |
|
| 798 | - if($content['parent'] == 0) { |
|
| 799 | - $parentname = $site_name; |
|
| 800 | - } else { |
|
| 801 | - $parentlookup = $content['parent']; |
|
| 802 | - } |
|
| 803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | - if($_REQUEST['pid'] == 0) { |
|
| 805 | - $parentname = $site_name; |
|
| 806 | - } else { |
|
| 807 | - $parentlookup = $_REQUEST['pid']; |
|
| 808 | - } |
|
| 809 | - } elseif(isset($_POST['parent'])) { |
|
| 810 | - if($_POST['parent'] == 0) { |
|
| 811 | - $parentname = $site_name; |
|
| 812 | - } else { |
|
| 813 | - $parentlookup = $_POST['parent']; |
|
| 814 | - } |
|
| 815 | - } else { |
|
| 816 | - $parentname = $site_name; |
|
| 817 | - $content['parent'] = 0; |
|
| 818 | - } |
|
| 819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | - $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 821 | - $parentname = $modx->getDatabase()->getValue($rs); |
|
| 822 | - if(!$parentname) { |
|
| 823 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 824 | - } |
|
| 825 | - } |
|
| 826 | - ?> |
|
| 796 | + $parentlookup = false; |
|
| 797 | + if(isset ($_REQUEST['id'])) { |
|
| 798 | + if($content['parent'] == 0) { |
|
| 799 | + $parentname = $site_name; |
|
| 800 | + } else { |
|
| 801 | + $parentlookup = $content['parent']; |
|
| 802 | + } |
|
| 803 | + } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | + if($_REQUEST['pid'] == 0) { |
|
| 805 | + $parentname = $site_name; |
|
| 806 | + } else { |
|
| 807 | + $parentlookup = $_REQUEST['pid']; |
|
| 808 | + } |
|
| 809 | + } elseif(isset($_POST['parent'])) { |
|
| 810 | + if($_POST['parent'] == 0) { |
|
| 811 | + $parentname = $site_name; |
|
| 812 | + } else { |
|
| 813 | + $parentlookup = $_POST['parent']; |
|
| 814 | + } |
|
| 815 | + } else { |
|
| 816 | + $parentname = $site_name; |
|
| 817 | + $content['parent'] = 0; |
|
| 818 | + } |
|
| 819 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | + $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 821 | + $parentname = $modx->getDatabase()->getValue($rs); |
|
| 822 | + if(!$parentname) { |
|
| 823 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 824 | + } |
|
| 825 | + } |
|
| 826 | + ?> |
|
| 827 | 827 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
| 828 | 828 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $modx->getPhpCompat()->entities($parentname) ?>)</span></b> |
| 829 | 829 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | </tr> |
| 832 | 832 | <tr></tr> |
| 833 | 833 | <?php |
| 834 | - /* |
|
| 834 | + /* |
|
| 835 | 835 | if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { |
| 836 | 836 | ?> |
| 837 | 837 | <tr> |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | </tr> |
| 860 | 860 | <?php |
| 861 | 861 | }*/ |
| 862 | - ?> |
|
| 862 | + ?> |
|
| 863 | 863 | |
| 864 | 864 | <?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?> |
| 865 | 865 | <tr> |
@@ -872,36 +872,36 @@ discard block |
||
| 872 | 872 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
| 873 | 873 | <option value="none"><?= $_lang['none'] ?></option> |
| 874 | 874 | <?php |
| 875 | - // invoke OnRichTextEditorRegister event |
|
| 876 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 877 | - if(is_array($evtOut)) { |
|
| 878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | - $editor = $evtOut[$i]; |
|
| 880 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 881 | - } |
|
| 882 | - } |
|
| 883 | - ?> |
|
| 875 | + // invoke OnRichTextEditorRegister event |
|
| 876 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 877 | + if(is_array($evtOut)) { |
|
| 878 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | + $editor = $evtOut[$i]; |
|
| 880 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 881 | + } |
|
| 882 | + } |
|
| 883 | + ?> |
|
| 884 | 884 | </select> |
| 885 | 885 | </label> |
| 886 | 886 | </div> |
| 887 | 887 | <div id="content_body"> |
| 888 | 888 | <?php |
| 889 | - if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
| 890 | - $htmlContent = $content['content']; |
|
| 891 | - ?> |
|
| 889 | + if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
| 890 | + $htmlContent = $content['content']; |
|
| 891 | + ?> |
|
| 892 | 892 | <div class="section-editor clearfix"> |
| 893 | 893 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea> |
| 894 | 894 | </div> |
| 895 | 895 | <?php |
| 896 | - // Richtext-[*content*] |
|
| 897 | - $richtexteditorIds = array(); |
|
| 898 | - $richtexteditorOptions = array(); |
|
| 899 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 900 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 901 | - } else { |
|
| 902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 903 | - } |
|
| 904 | - ?> |
|
| 896 | + // Richtext-[*content*] |
|
| 897 | + $richtexteditorIds = array(); |
|
| 898 | + $richtexteditorOptions = array(); |
|
| 899 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 900 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 901 | + } else { |
|
| 902 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 903 | + } |
|
| 904 | + ?> |
|
| 905 | 905 | </div> |
| 906 | 906 | </td> |
| 907 | 907 | </tr> |
@@ -1208,8 +1208,8 @@ discard block |
||
| 1208 | 1208 | |
| 1209 | 1209 | <?php |
| 1210 | 1210 | |
| 1211 | - if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1212 | - ?> |
|
| 1211 | + if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1212 | + ?> |
|
| 1213 | 1213 | <tr> |
| 1214 | 1214 | <td> |
| 1215 | 1215 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1231,15 +1231,15 @@ discard block |
||
| 1231 | 1231 | <td> |
| 1232 | 1232 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1233 | 1233 | <?php |
| 1234 | - if(!$content['contentType']) { |
|
| 1235 | - $content['contentType'] = 'text/html'; |
|
| 1236 | - } |
|
| 1237 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1238 | - $ct = explode(",", $custom_contenttype); |
|
| 1239 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1240 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1241 | - } |
|
| 1242 | - ?> |
|
| 1234 | + if(!$content['contentType']) { |
|
| 1235 | + $content['contentType'] = 'text/html'; |
|
| 1236 | + } |
|
| 1237 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1238 | + $ct = explode(",", $custom_contenttype); |
|
| 1239 | + for($i = 0; $i < count($ct); $i++) { |
|
| 1240 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1241 | + } |
|
| 1242 | + ?> |
|
| 1243 | 1243 | </select> |
| 1244 | 1244 | </td> |
| 1245 | 1245 | </tr> |
@@ -1262,23 +1262,23 @@ discard block |
||
| 1262 | 1262 | </td> |
| 1263 | 1263 | </tr> |
| 1264 | 1264 | <?php |
| 1265 | - } else { |
|
| 1266 | - if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
| 1267 | - // non-admin managers creating or editing a document resource |
|
| 1268 | - ?> |
|
| 1265 | + } else { |
|
| 1266 | + if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
| 1267 | + // non-admin managers creating or editing a document resource |
|
| 1268 | + ?> |
|
| 1269 | 1269 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
| 1270 | 1270 | <input type="hidden" name="type" value="document" /> |
| 1271 | 1271 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
| 1272 | 1272 | <?php |
| 1273 | - } else { |
|
| 1274 | - // non-admin managers creating or editing a reference (weblink) resource |
|
| 1275 | - ?> |
|
| 1273 | + } else { |
|
| 1274 | + // non-admin managers creating or editing a reference (weblink) resource |
|
| 1275 | + ?> |
|
| 1276 | 1276 | <input type="hidden" name="type" value="reference" /> |
| 1277 | 1277 | <input type="hidden" name="contentType" value="text/html" /> |
| 1278 | 1278 | <?php |
| 1279 | - } |
|
| 1280 | - }//if mgrRole |
|
| 1281 | - ?> |
|
| 1279 | + } |
|
| 1280 | + }//if mgrRole |
|
| 1281 | + ?> |
|
| 1282 | 1282 | |
| 1283 | 1283 | <tr> |
| 1284 | 1284 | <td> |
@@ -1361,112 +1361,112 @@ discard block |
||
| 1361 | 1361 | ?> |
| 1362 | 1362 | |
| 1363 | 1363 | <?php |
| 1364 | - /******************************* |
|
| 1364 | + /******************************* |
|
| 1365 | 1365 | * Document Access Permissions */ |
| 1366 | - if($use_udperms == 1) { |
|
| 1367 | - $groupsarray = array(); |
|
| 1368 | - $sql = ''; |
|
| 1369 | - |
|
| 1370 | - $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1371 | - if($documentId > 0) { |
|
| 1372 | - // Load up, the permissions from the parent (if new document) or existing document |
|
| 1373 | - $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1374 | - while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1375 | - |
|
| 1376 | - // Load up the current permissions and names |
|
| 1377 | - $vs = array( |
|
| 1378 | - $tbl_document_group_names, |
|
| 1379 | - $tbl_document_groups, |
|
| 1380 | - $documentId |
|
| 1381 | - ); |
|
| 1382 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1383 | - $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1384 | - } else { |
|
| 1385 | - // Just load up the names, we're starting clean |
|
| 1386 | - $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1387 | - } |
|
| 1388 | - |
|
| 1389 | - // retain selected doc groups between post |
|
| 1390 | - if(isset($_POST['docgroups'])) { |
|
| 1391 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1392 | - } |
|
| 1366 | + if($use_udperms == 1) { |
|
| 1367 | + $groupsarray = array(); |
|
| 1368 | + $sql = ''; |
|
| 1369 | + |
|
| 1370 | + $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1371 | + if($documentId > 0) { |
|
| 1372 | + // Load up, the permissions from the parent (if new document) or existing document |
|
| 1373 | + $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1374 | + while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1375 | + |
|
| 1376 | + // Load up the current permissions and names |
|
| 1377 | + $vs = array( |
|
| 1378 | + $tbl_document_group_names, |
|
| 1379 | + $tbl_document_groups, |
|
| 1380 | + $documentId |
|
| 1381 | + ); |
|
| 1382 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1383 | + $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1384 | + } else { |
|
| 1385 | + // Just load up the names, we're starting clean |
|
| 1386 | + $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1387 | + } |
|
| 1388 | + |
|
| 1389 | + // retain selected doc groups between post |
|
| 1390 | + if(isset($_POST['docgroups'])) { |
|
| 1391 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1392 | + } |
|
| 1393 | + |
|
| 1394 | + $isManager = $modx->hasPermission('access_permissions'); |
|
| 1395 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1396 | + |
|
| 1397 | + // Setup Basic attributes for each Input box |
|
| 1398 | + $inputAttributes = array( |
|
| 1399 | + 'type' => 'checkbox', |
|
| 1400 | + 'class' => 'checkbox', |
|
| 1401 | + 'name' => 'docgroups[]', |
|
| 1402 | + 'onclick' => 'makePublic(false);', |
|
| 1403 | + ); |
|
| 1404 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1405 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1406 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1407 | + |
|
| 1408 | + // Loop through the permissions list |
|
| 1409 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 1410 | + |
|
| 1411 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1412 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1413 | + $inputId = 'group-' . $row['id']; |
|
| 1414 | + |
|
| 1415 | + $checked = in_array($inputValue, $groupsarray); |
|
| 1416 | + if($checked) { |
|
| 1417 | + $notPublic = true; |
|
| 1418 | + } // Mark as private access (either web or manager) |
|
| 1419 | + |
|
| 1420 | + // Skip the access permission if the user doesn't have access... |
|
| 1421 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1422 | + continue; |
|
| 1423 | + } |
|
| 1393 | 1424 | |
| 1394 | - $isManager = $modx->hasPermission('access_permissions'); |
|
| 1395 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1396 | - |
|
| 1397 | - // Setup Basic attributes for each Input box |
|
| 1398 | - $inputAttributes = array( |
|
| 1399 | - 'type' => 'checkbox', |
|
| 1400 | - 'class' => 'checkbox', |
|
| 1401 | - 'name' => 'docgroups[]', |
|
| 1402 | - 'onclick' => 'makePublic(false);', |
|
| 1403 | - ); |
|
| 1404 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1405 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1406 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1407 | - |
|
| 1408 | - // Loop through the permissions list |
|
| 1409 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
| 1410 | - |
|
| 1411 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1412 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1413 | - $inputId = 'group-' . $row['id']; |
|
| 1414 | - |
|
| 1415 | - $checked = in_array($inputValue, $groupsarray); |
|
| 1416 | - if($checked) { |
|
| 1417 | - $notPublic = true; |
|
| 1418 | - } // Mark as private access (either web or manager) |
|
| 1419 | - |
|
| 1420 | - // Skip the access permission if the user doesn't have access... |
|
| 1421 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1422 | - continue; |
|
| 1423 | - } |
|
| 1424 | - |
|
| 1425 | - // Setup attributes for this Input box |
|
| 1426 | - $inputAttributes['id'] = $inputId; |
|
| 1427 | - $inputAttributes['value'] = $inputValue; |
|
| 1428 | - if($checked) { |
|
| 1429 | - $inputAttributes['checked'] = 'checked'; |
|
| 1430 | - } else { |
|
| 1431 | - unset($inputAttributes['checked']); |
|
| 1432 | - } |
|
| 1433 | - |
|
| 1434 | - // Create attribute string list |
|
| 1435 | - $inputString = array(); |
|
| 1436 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1437 | - |
|
| 1438 | - // Make the <input> HTML |
|
| 1439 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1440 | - |
|
| 1441 | - // does user have this permission? |
|
| 1442 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1443 | - $vs = array( |
|
| 1444 | - $row['id'], |
|
| 1445 | - $_SESSION['mgrInternalKey'] |
|
| 1446 | - ); |
|
| 1447 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1448 | - $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
| 1449 | - $count = $modx->getDatabase()->getValue($rsp); |
|
| 1450 | - if($count > 0) { |
|
| 1451 | - ++$permissions_yes; |
|
| 1452 | - } else { |
|
| 1453 | - ++$permissions_no; |
|
| 1454 | - } |
|
| 1455 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1456 | - } |
|
| 1457 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1458 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1459 | - $permissions = array(); |
|
| 1460 | - } |
|
| 1425 | + // Setup attributes for this Input box |
|
| 1426 | + $inputAttributes['id'] = $inputId; |
|
| 1427 | + $inputAttributes['value'] = $inputValue; |
|
| 1428 | + if($checked) { |
|
| 1429 | + $inputAttributes['checked'] = 'checked'; |
|
| 1430 | + } else { |
|
| 1431 | + unset($inputAttributes['checked']); |
|
| 1432 | + } |
|
| 1461 | 1433 | |
| 1462 | - // See if the Access Permissions section is worth displaying... |
|
| 1463 | - if(!empty($permissions)) { |
|
| 1464 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1465 | - if($isManager && $isWeb) { |
|
| 1466 | - 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>'); |
|
| 1467 | - } |
|
| 1468 | - // Output the permissions list... |
|
| 1469 | - ?> |
|
| 1434 | + // Create attribute string list |
|
| 1435 | + $inputString = array(); |
|
| 1436 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1437 | + |
|
| 1438 | + // Make the <input> HTML |
|
| 1439 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1440 | + |
|
| 1441 | + // does user have this permission? |
|
| 1442 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1443 | + $vs = array( |
|
| 1444 | + $row['id'], |
|
| 1445 | + $_SESSION['mgrInternalKey'] |
|
| 1446 | + ); |
|
| 1447 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1448 | + $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
| 1449 | + $count = $modx->getDatabase()->getValue($rsp); |
|
| 1450 | + if($count > 0) { |
|
| 1451 | + ++$permissions_yes; |
|
| 1452 | + } else { |
|
| 1453 | + ++$permissions_no; |
|
| 1454 | + } |
|
| 1455 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1456 | + } |
|
| 1457 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1458 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1459 | + $permissions = array(); |
|
| 1460 | + } |
|
| 1461 | + |
|
| 1462 | + // See if the Access Permissions section is worth displaying... |
|
| 1463 | + if(!empty($permissions)) { |
|
| 1464 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1465 | + if($isManager && $isWeb) { |
|
| 1466 | + 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>'); |
|
| 1467 | + } |
|
| 1468 | + // Output the permissions list... |
|
| 1469 | + ?> |
|
| 1470 | 1470 | <!-- Access Permissions --> |
| 1471 | 1471 | <div class="tab-page" id="tabAccess"> |
| 1472 | 1472 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1500,31 +1500,31 @@ discard block |
||
| 1500 | 1500 | </ul> |
| 1501 | 1501 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1502 | 1502 | <?php |
| 1503 | - } // !empty($permissions) |
|
| 1504 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1505 | - ?> |
|
| 1503 | + } // !empty($permissions) |
|
| 1504 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1505 | + ?> |
|
| 1506 | 1506 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1507 | 1507 | <?php |
| 1508 | 1508 | |
| 1509 | - } |
|
| 1510 | - } |
|
| 1511 | - /* End Document Access Permissions * |
|
| 1509 | + } |
|
| 1510 | + } |
|
| 1511 | + /* End Document Access Permissions * |
|
| 1512 | 1512 | ***********************************/ |
| 1513 | - ?> |
|
| 1513 | + ?> |
|
| 1514 | 1514 | |
| 1515 | 1515 | <input type="submit" name="save" style="display:none" /> |
| 1516 | 1516 | <?php |
| 1517 | 1517 | |
| 1518 | - // invoke OnDocFormRender event |
|
| 1519 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1520 | - 'id' => $id, |
|
| 1521 | - 'template' => $content['template'] |
|
| 1522 | - )); |
|
| 1518 | + // invoke OnDocFormRender event |
|
| 1519 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1520 | + 'id' => $id, |
|
| 1521 | + 'template' => $content['template'] |
|
| 1522 | + )); |
|
| 1523 | 1523 | |
| 1524 | - if(is_array($evtOut)) { |
|
| 1525 | - echo implode('', $evtOut); |
|
| 1526 | - } |
|
| 1527 | - ?> |
|
| 1524 | + if(is_array($evtOut)) { |
|
| 1525 | + echo implode('', $evtOut); |
|
| 1526 | + } |
|
| 1527 | + ?> |
|
| 1528 | 1528 | </div><!--div class="tab-pane" id="documentPane"--> |
| 1529 | 1529 | </div><!--div class="sectionBody"--> |
| 1530 | 1530 | </fieldset> |
@@ -1535,17 +1535,17 @@ discard block |
||
| 1535 | 1535 | </script> |
| 1536 | 1536 | <?php |
| 1537 | 1537 | if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) { |
| 1538 | - if(is_array($richtexteditorIds)) { |
|
| 1539 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1540 | - // invoke OnRichTextEditorInit event |
|
| 1541 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1542 | - 'editor' => $editor, |
|
| 1543 | - 'elements' => $elements, |
|
| 1544 | - 'options' => $richtexteditorOptions[$editor] |
|
| 1545 | - )); |
|
| 1546 | - if(is_array($evtOut)) { |
|
| 1547 | - echo implode('', $evtOut); |
|
| 1548 | - } |
|
| 1549 | - } |
|
| 1550 | - } |
|
| 1538 | + if(is_array($richtexteditorIds)) { |
|
| 1539 | + foreach($richtexteditorIds as $editor => $elements) { |
|
| 1540 | + // invoke OnRichTextEditorInit event |
|
| 1541 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1542 | + 'editor' => $editor, |
|
| 1543 | + 'elements' => $elements, |
|
| 1544 | + 'options' => $richtexteditorOptions[$editor] |
|
| 1545 | + )); |
|
| 1546 | + if(is_array($evtOut)) { |
|
| 1547 | + echo implode('', $evtOut); |
|
| 1548 | + } |
|
| 1549 | + } |
|
| 1550 | + } |
|
| 1551 | 1551 | } |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if (!$modx->hasPermission('edit_document') || !$modx->hasPermission('save_document')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : null; |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; |
|
| 10 | 10 | $reset = isset($_POST['reset']) && $_POST['reset'] == 'true' ? 1 : 0; |
| 11 | 11 | $items = isset($_POST['list']) ? $_POST['list'] : ''; |
| 12 | 12 | $ressourcelist = ''; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | if (isset($_POST['listSubmitted'])) { |
| 26 | - $updateMsg .= '<div class="text-success" id="updated">' . $_lang['sort_updated'] . '</div>'; |
|
| 26 | + $updateMsg .= '<div class="text-success" id="updated">'.$_lang['sort_updated'].'</div>'; |
|
| 27 | 27 | if (strlen($items) > 0) { |
| 28 | 28 | $items = explode(';', $items); |
| 29 | 29 | foreach ($items as $key => $value) { |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | $tblsc = $modx->getFullTableName('site_content'); |
| 44 | 44 | $tbldg = $modx->getFullTableName('document_groups'); |
| 45 | 45 | |
| 46 | - $rs = $modx->getDatabase()->select('pagetitle', $tblsc, 'id=' . $id . ''); |
|
| 46 | + $rs = $modx->getDatabase()->select('pagetitle', $tblsc, 'id='.$id.''); |
|
| 47 | 47 | $pagetitle = $modx->getDatabase()->getValue($rs); |
| 48 | 48 | |
| 49 | 49 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
| 50 | 50 | $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : ''; |
| 51 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
| 52 | - $access = " AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
| 51 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
| 52 | + $access = " AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
| 53 | 53 | |
| 54 | - $rs = $modx->getDatabase()->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc . 'AS sc LEFT JOIN ' . $tbldg . ' dg ON dg.document=sc.id', 'sc.parent=' . $id . $access . ' GROUP BY sc.id', 'menuindex ASC'); |
|
| 54 | + $rs = $modx->getDatabase()->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc.'AS sc LEFT JOIN '.$tbldg.' dg ON dg.document=sc.id', 'sc.parent='.$id.$access.' GROUP BY sc.id', 'menuindex ASC'); |
|
| 55 | 55 | |
| 56 | 56 | if ($modx->getDatabase()->getRecordCount($rs)) { |
| 57 | 57 | $ressourcelist .= '<div class="clearfix"><ul id="sortlist" class="sortableList">'; |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | $classes .= ($row['hidemenu']) ? ' notInMenuNode ' : ' inMenuNode'; |
| 61 | 61 | $classes .= ($row['published']) ? ' publishedNode ' : ' unpublishedNode '; |
| 62 | 62 | $classes = ($row['deleted']) ? ' deletedNode ' : $classes; |
| 63 | - $icon = $row['isfolder'] ? '<i class="' . $_style['files_folder'] . '"></i> ' : ' <i class="' . $_style['files_page_html'] . '"></i> '; |
|
| 64 | - $ressourcelist .= '<li id="item_' . $row['id'] . '" class="' . $classes . '">' . $icon . $row['pagetitle'] . ' <small>(' . $row['id'] . ')</small></li>'; |
|
| 63 | + $icon = $row['isfolder'] ? '<i class="'.$_style['files_folder'].'"></i> ' : ' <i class="'.$_style['files_page_html'].'"></i> '; |
|
| 64 | + $ressourcelist .= '<li id="item_'.$row['id'].'" class="'.$classes.'">'.$icon.$row['pagetitle'].' <small>('.$row['id'].')</small></li>'; |
|
| 65 | 65 | } |
| 66 | 66 | $ressourcelist .= '</ul></div>'; |
| 67 | 67 | } else { |
| 68 | - $updateMsg = '<p class="text-danger">' . $_lang['sort_nochildren'] . '</p>'; |
|
| 68 | + $updateMsg = '<p class="text-danger">'.$_lang['sort_nochildren'].'</p>'; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | </script> |
| 149 | 149 | |
| 150 | 150 | <h1> |
| 151 | - <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $modx->getPhpCompat()->entities($pagetitle) . '<small>(' . $id . ')</small>' : $_lang['sort_menuindex']) ?> |
|
| 151 | + <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $modx->getPhpCompat()->entities($pagetitle).'<small>('.$id.')</small>' : $_lang['sort_menuindex']) ?> |
|
| 152 | 152 | </h1> |
| 153 | 153 | |
| 154 | 154 | <?= $_style['actionbuttons']['dynamic']['save'] ?> |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('settings')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | $data = $_POST; |
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -11,41 +11,41 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
| 13 | 13 | { |
| 14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
| 15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
| 16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
| 17 | - if(is_file($htaccess)) |
|
| 18 | - { |
|
| 19 | - $_ = file_get_contents($htaccess); |
|
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 21 | - { |
|
| 22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 23 | - } |
|
| 24 | - elseif(is_writable($htaccess)) |
|
| 25 | - { |
|
| 26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 28 | - { |
|
| 29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 30 | - } |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 34 | - { |
|
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 14 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
| 15 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
| 16 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
| 17 | + if(is_file($htaccess)) |
|
| 18 | + { |
|
| 19 | + $_ = file_get_contents($htaccess); |
|
| 20 | + if(strpos($_,'RewriteBase')===false) |
|
| 36 | 21 | { |
| 37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
| 38 | - } |
|
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 40 | - { |
|
| 41 | - $_ = file_get_contents($htaccess); |
|
| 42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 44 | - { |
|
| 45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 23 | + } |
|
| 24 | + elseif(is_writable($htaccess)) |
|
| 25 | + { |
|
| 26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 27 | + if(!@file_put_contents($htaccess,$_)) |
|
| 28 | + { |
|
| 29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + elseif(is_file($sample_htaccess)) |
|
| 34 | + { |
|
| 35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
| 36 | + { |
|
| 37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
| 38 | + } |
|
| 39 | + elseif($modx->config['base_url']!=='/') |
|
| 40 | + { |
|
| 41 | + $_ = file_get_contents($htaccess); |
|
| 42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 43 | + if(!@file_put_contents($htaccess,$_)) |
|
| 44 | + { |
|
| 45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
| 57 | 57 | |
| 58 | 58 | if (isset($data) && count($data) > 0) { |
| 59 | - if(isset($data['manager_language'])) { |
|
| 60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
| 61 | - if(is_file($lang_path)) { |
|
| 62 | - include($lang_path); |
|
| 59 | + if(isset($data['manager_language'])) { |
|
| 60 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
| 61 | + if(is_file($lang_path)) { |
|
| 62 | + include($lang_path); |
|
| 63 | 63 | global $modx_lang_attribute; |
| 64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
| 65 | - } |
|
| 66 | - } |
|
| 67 | - $savethese = array(); |
|
| 68 | - $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
| 69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 70 | - foreach ($data as $k => $v) { |
|
| 71 | - switch ($k) { |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + $savethese = array(); |
|
| 68 | + $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
| 69 | + $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 70 | + foreach ($data as $k => $v) { |
|
| 71 | + switch ($k) { |
|
| 72 | 72 | case 'settings_version':{ |
| 73 | 73 | if($modx->getVersionData('version')!=$data['settings_version']){ |
| 74 | 74 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | break; |
| 78 | 78 | } |
| 79 | - case 'error_page': |
|
| 80 | - case 'unauthorized_page': |
|
| 81 | - if (trim($v) == '' || !is_numeric($v)) { |
|
| 82 | - $v = $data['site_start']; |
|
| 83 | - } |
|
| 84 | - break; |
|
| 79 | + case 'error_page': |
|
| 80 | + case 'unauthorized_page': |
|
| 81 | + if (trim($v) == '' || !is_numeric($v)) { |
|
| 82 | + $v = $data['site_start']; |
|
| 83 | + } |
|
| 84 | + break; |
|
| 85 | 85 | |
| 86 | - case 'lst_custom_contenttype': |
|
| 87 | - case 'txt_custom_contenttype': |
|
| 88 | - // Skip these |
|
| 89 | - $k = ''; |
|
| 90 | - break; |
|
| 91 | - case 'rb_base_dir': |
|
| 92 | - case 'rb_base_url': |
|
| 93 | - case 'filemanager_path': |
|
| 94 | - $v = trim($v); |
|
| 95 | - $v = rtrim($v,'/') . '/'; |
|
| 96 | - break; |
|
| 86 | + case 'lst_custom_contenttype': |
|
| 87 | + case 'txt_custom_contenttype': |
|
| 88 | + // Skip these |
|
| 89 | + $k = ''; |
|
| 90 | + break; |
|
| 91 | + case 'rb_base_dir': |
|
| 92 | + case 'rb_base_url': |
|
| 93 | + case 'filemanager_path': |
|
| 94 | + $v = trim($v); |
|
| 95 | + $v = rtrim($v,'/') . '/'; |
|
| 96 | + break; |
|
| 97 | 97 | case 'manager_language': |
| 98 | 98 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
| 99 | 99 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -101,56 +101,56 @@ discard block |
||
| 101 | 101 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
| 102 | 102 | $v = 'english'; |
| 103 | 103 | } |
| 104 | - break; |
|
| 105 | - case 'smtppw': |
|
| 106 | - if ($v !== '********************' && $v !== '') { |
|
| 107 | - $v = trim($v); |
|
| 108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | - $v = str_replace('=','%',$v); |
|
| 110 | - } elseif ($v === '********************') { |
|
| 111 | - $k = ''; |
|
| 112 | - } |
|
| 113 | - break; |
|
| 104 | + break; |
|
| 105 | + case 'smtppw': |
|
| 106 | + if ($v !== '********************' && $v !== '') { |
|
| 107 | + $v = trim($v); |
|
| 108 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | + $v = str_replace('=','%',$v); |
|
| 110 | + } elseif ($v === '********************') { |
|
| 111 | + $k = ''; |
|
| 112 | + } |
|
| 113 | + break; |
|
| 114 | 114 | case 'valid_hostnames': |
| 115 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
| 116 | - if ($v !== ',') { |
|
| 117 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
| 118 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
| 119 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
| 120 | - } |
|
| 121 | - $k = ''; |
|
| 122 | - break; |
|
| 123 | - case 'session_timeout': |
|
| 124 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
| 125 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 126 | - break; |
|
| 127 | - default: |
|
| 128 | - break; |
|
| 129 | - } |
|
| 130 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
| 115 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
| 116 | + if ($v !== ',') { |
|
| 117 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
| 118 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
| 119 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
| 120 | + } |
|
| 121 | + $k = ''; |
|
| 122 | + break; |
|
| 123 | + case 'session_timeout': |
|
| 124 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
| 125 | + $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 126 | + break; |
|
| 127 | + default: |
|
| 128 | + break; |
|
| 129 | + } |
|
| 130 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
| 131 | 131 | |
| 132 | - $modx->config[$k] = $v; |
|
| 132 | + $modx->config[$k] = $v; |
|
| 133 | 133 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 135 | - } |
|
| 134 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - // Run a single query to save all the values |
|
| 138 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
| 137 | + // Run a single query to save all the values |
|
| 138 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
| 139 | 139 | VALUES ".implode(', ', $savethese); |
| 140 | - $modx->getDatabase()->query($sql); |
|
| 140 | + $modx->getDatabase()->query($sql); |
|
| 141 | 141 | |
| 142 | - // Reset Template Pages |
|
| 143 | - if (isset($data['reset_template'])) { |
|
| 144 | - $newtemplate = (int)$data['default_template']; |
|
| 145 | - $oldtemplate = (int)$data['old_template']; |
|
| 146 | - $tbl = $modx->getFullTableName('site_content'); |
|
| 147 | - $reset = $data['reset_template']; |
|
| 148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 150 | - } |
|
| 142 | + // Reset Template Pages |
|
| 143 | + if (isset($data['reset_template'])) { |
|
| 144 | + $newtemplate = (int)$data['default_template']; |
|
| 145 | + $oldtemplate = (int)$data['old_template']; |
|
| 146 | + $tbl = $modx->getFullTableName('site_content'); |
|
| 147 | + $reset = $data['reset_template']; |
|
| 148 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // empty cache |
|
| 153 | - $modx->clearCache('full'); |
|
| 152 | + // empty cache |
|
| 153 | + $modx->clearCache('full'); |
|
| 154 | 154 | } |
| 155 | 155 | $header="Location: index.php?a=7&r=10"; |
| 156 | 156 | header($header); |
@@ -1,46 +1,46 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('settings')) { |
|
| 5 | +if (!$modx->hasPermission('settings')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | $data = $_POST; |
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
| 10 | 10 | unset($_POST); |
| 11 | 11 | |
| 12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
| 12 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
| 13 | 13 | { |
| 14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
| 15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
| 16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
| 17 | - if(is_file($htaccess)) |
|
| 14 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
| 15 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
| 16 | + $dir = '/'.trim($modx->config['base_url'], '/'); |
|
| 17 | + if (is_file($htaccess)) |
|
| 18 | 18 | { |
| 19 | 19 | $_ = file_get_contents($htaccess); |
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 20 | + if (strpos($_, 'RewriteBase') === false) |
|
| 21 | 21 | { |
| 22 | 22 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 23 | 23 | } |
| 24 | - elseif(is_writable($htaccess)) |
|
| 24 | + elseif (is_writable($htaccess)) |
|
| 25 | 25 | { |
| 26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 26 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
| 27 | + if (!@file_put_contents($htaccess, $_)) |
|
| 28 | 28 | { |
| 29 | 29 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 33 | + elseif (is_file($sample_htaccess)) |
|
| 34 | 34 | { |
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 35 | + if (!@rename($sample_htaccess, $htaccess)) |
|
| 36 | 36 | { |
| 37 | 37 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
| 38 | 38 | } |
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 39 | + elseif ($modx->config['base_url'] !== '/') |
|
| 40 | 40 | { |
| 41 | 41 | $_ = file_get_contents($htaccess); |
| 42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 42 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
| 43 | + if (!@file_put_contents($htaccess, $_)) |
|
| 44 | 44 | { |
| 45 | 45 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 46 | 46 | } |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 52 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
| 51 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
| 52 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
| 56 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
| 55 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
| 56 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
| 57 | 57 | |
| 58 | 58 | if (isset($data) && count($data) > 0) { |
| 59 | - if(isset($data['manager_language'])) { |
|
| 60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
| 61 | - if(is_file($lang_path)) { |
|
| 59 | + if (isset($data['manager_language'])) { |
|
| 60 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
| 61 | + if (is_file($lang_path)) { |
|
| 62 | 62 | include($lang_path); |
| 63 | 63 | global $modx_lang_attribute; |
| 64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | $savethese = array(); |
| 68 | 68 | $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
| 69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 69 | + $data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
| 70 | 70 | foreach ($data as $k => $v) { |
| 71 | 71 | switch ($k) { |
| 72 | 72 | case 'settings_version':{ |
| 73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
| 74 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
| 73 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
| 74 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
| 75 | 75 | $v = $modx->getVersionData('version'); |
| 76 | 76 | } |
| 77 | 77 | break; |
@@ -92,21 +92,21 @@ discard block |
||
| 92 | 92 | case 'rb_base_url': |
| 93 | 93 | case 'filemanager_path': |
| 94 | 94 | $v = trim($v); |
| 95 | - $v = rtrim($v,'/') . '/'; |
|
| 95 | + $v = rtrim($v, '/').'/'; |
|
| 96 | 96 | break; |
| 97 | 97 | case 'manager_language': |
| 98 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
| 99 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
| 98 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
| 99 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
| 100 | 100 | $langFileDir = dirname($langFile); |
| 101 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
| 101 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
| 102 | 102 | $v = 'english'; |
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | case 'smtppw': |
| 106 | 106 | if ($v !== '********************' && $v !== '') { |
| 107 | 107 | $v = trim($v); |
| 108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | - $v = str_replace('=','%',$v); |
|
| 108 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
| 109 | + $v = str_replace('=', '%', $v); |
|
| 110 | 110 | } elseif ($v === '********************') { |
| 111 | 111 | $k = ''; |
| 112 | 112 | } |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | $v = str_replace(array(' ,', ', '), ',', $v); |
| 116 | 116 | if ($v !== ',') { |
| 117 | 117 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
| 118 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
| 119 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
| 118 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
| 119 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
| 120 | 120 | } |
| 121 | 121 | $k = ''; |
| 122 | 122 | break; |
| 123 | 123 | case 'session_timeout': |
| 124 | 124 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
| 125 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 125 | + $v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
| 126 | 126 | break; |
| 127 | 127 | default: |
| 128 | 128 | break; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $modx->config[$k] = $v; |
| 133 | 133 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 134 | + if (!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Run a single query to save all the values |
@@ -141,16 +141,16 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | // Reset Template Pages |
| 143 | 143 | if (isset($data['reset_template'])) { |
| 144 | - $newtemplate = (int)$data['default_template']; |
|
| 145 | - $oldtemplate = (int)$data['old_template']; |
|
| 144 | + $newtemplate = (int) $data['default_template']; |
|
| 145 | + $oldtemplate = (int) $data['old_template']; |
|
| 146 | 146 | $tbl = $modx->getFullTableName('site_content'); |
| 147 | 147 | $reset = $data['reset_template']; |
| 148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 148 | + if ($reset == 1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | + else if ($reset == 2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // empty cache |
| 153 | 153 | $modx->clearCache('full'); |
| 154 | 154 | } |
| 155 | -$header="Location: index.php?a=7&r=10"; |
|
| 155 | +$header = "Location: index.php?a=7&r=10"; |
|
| 156 | 156 | header($header); |
@@ -9,39 +9,27 @@ discard block |
||
| 9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
| 10 | 10 | unset($_POST); |
| 11 | 11 | |
| 12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
| 13 | -{ |
|
| 12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
| 14 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
| 15 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
| 16 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
| 17 | - if(is_file($htaccess)) |
|
| 18 | - { |
|
| 16 | + if(is_file($htaccess)) { |
|
| 19 | 17 | $_ = file_get_contents($htaccess); |
| 20 | - if(strpos($_,'RewriteBase')===false) |
|
| 21 | - { |
|
| 18 | + if(strpos($_,'RewriteBase')===false) { |
|
| 22 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 23 | - } |
|
| 24 | - elseif(is_writable($htaccess)) |
|
| 25 | - { |
|
| 20 | + } elseif(is_writable($htaccess)) { |
|
| 26 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
| 27 | - if(!@file_put_contents($htaccess,$_)) |
|
| 28 | - { |
|
| 22 | + if(!@file_put_contents($htaccess,$_)) { |
|
| 29 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 30 | 24 | } |
| 31 | 25 | } |
| 32 | - } |
|
| 33 | - elseif(is_file($sample_htaccess)) |
|
| 34 | - { |
|
| 35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
| 36 | - { |
|
| 26 | + } elseif(is_file($sample_htaccess)) { |
|
| 27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
| 37 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
| 38 | - } |
|
| 39 | - elseif($modx->config['base_url']!=='/') |
|
| 40 | - { |
|
| 29 | + } elseif($modx->config['base_url']!=='/') { |
|
| 41 | 30 | $_ = file_get_contents($htaccess); |
| 42 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
| 43 | - if(!@file_put_contents($htaccess,$_)) |
|
| 44 | - { |
|
| 32 | + if(!@file_put_contents($htaccess,$_)) { |
|
| 45 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
| 46 | 34 | } |
| 47 | 35 | } |
@@ -70,7 +58,7 @@ discard block |
||
| 70 | 58 | foreach ($data as $k => $v) { |
| 71 | 59 | switch ($k) { |
| 72 | 60 | case 'settings_version':{ |
| 73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
| 61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
| 74 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
| 75 | 63 | $v = $modx->getVersionData('version'); |
| 76 | 64 | } |
@@ -131,7 +119,9 @@ discard block |
||
| 131 | 119 | |
| 132 | 120 | $modx->config[$k] = $v; |
| 133 | 121 | |
| 134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 122 | + if(!empty($k)) { |
|
| 123 | + $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
| 124 | + } |
|
| 135 | 125 | } |
| 136 | 126 | |
| 137 | 127 | // Run a single query to save all the values |
@@ -145,8 +135,11 @@ discard block |
||
| 145 | 135 | $oldtemplate = (int)$data['old_template']; |
| 146 | 136 | $tbl = $modx->getFullTableName('site_content'); |
| 147 | 137 | $reset = $data['reset_template']; |
| 148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 138 | + if($reset==1) { |
|
| 139 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
| 140 | + } else if($reset==2) { |
|
| 141 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
| 142 | + } |
|
| 150 | 143 | } |
| 151 | 144 | |
| 152 | 145 | // empty cache |
@@ -1,12 +1,12 @@ 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 | // invoke OnManagerTreeInit event |
| 7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
|
| 8 | 8 | if(is_array($evtOut)) {
|
| 9 | - echo implode("\n", $evtOut);
|
|
| 9 | + echo implode("\n", $evtOut);
|
|
| 10 | 10 | } |
| 11 | 11 | ?> |
| 12 | 12 | |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | <div id="treeHolder"> |
| 54 | 54 | <?php |
| 55 | - // invoke OnManagerTreePrerender event |
|
| 56 | - $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
|
|
| 57 | - if(is_array($evtOut)) {
|
|
| 58 | - echo implode("\n", $evtOut);
|
|
| 59 | - } |
|
| 60 | - ?> |
|
| 55 | + // invoke OnManagerTreePrerender event |
|
| 56 | + $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
|
|
| 57 | + if(is_array($evtOut)) {
|
|
| 58 | + echo implode("\n", $evtOut);
|
|
| 59 | + } |
|
| 60 | + ?> |
|
| 61 | 61 | <div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = $modx->getPhpCompat()->entities($site_name); |
| 62 | - echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
| 62 | + echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
| 63 | 63 | <div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div> |
| 64 | 64 | </div> |
| 65 | 65 | <div id="treeRoot"></div> |
| 66 | 66 | <?php |
| 67 | - // invoke OnManagerTreeRender event |
|
| 68 | - $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
|
|
| 69 | - if(is_array($evtOut)) {
|
|
| 70 | - echo implode("\n", $evtOut);
|
|
| 71 | - } |
|
| 72 | - ?> |
|
| 67 | + // invoke OnManagerTreeRender event |
|
| 68 | + $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
|
|
| 69 | + if(is_array($evtOut)) {
|
|
| 70 | + echo implode("\n", $evtOut);
|
|
| 71 | + } |
|
| 72 | + ?> |
|
| 73 | 73 | </div> |
| 74 | 74 | </div> |