@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | -if(!$modx->hasPermission('new_chunk')) { |
|
| 2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | +if (!$modx->hasPermission('new_chunk')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
| 8 | -if($id==0) { |
|
| 7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
| 8 | +if ($id == 0) { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | // count duplicates |
| 13 | 13 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'")); |
| 14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 15 | -if($count>=1) $count = ' '.($count+1); |
|
| 15 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 16 | 16 | else $count = ''; |
| 17 | 17 | |
| 18 | 18 | // duplicate htmlsnippet |
@@ -30,5 +30,5 @@ discard block |
||
| 30 | 30 | $_SESSION['itemname'] = $name; |
| 31 | 31 | |
| 32 | 32 | // finish duplicating - redirect to new chunk |
| 33 | -$header="Location: index.php?r=2&a=78&id=$newid"; |
|
| 33 | +$header = "Location: index.php?r=2&a=78&id=$newid"; |
|
| 34 | 34 | header($header); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | var $role; |
| 8 | 8 | var $duplicateDoc = false; |
| 9 | 9 | |
| 10 | - function checkPermissions() { |
|
| 10 | + function checkPermissions(){ |
|
| 11 | 11 | |
| 12 | 12 | global $udperms_allowroot; |
| 13 | 13 | global $modx; |
@@ -19,23 +19,23 @@ discard block |
||
| 19 | 19 | $document = $this->document; |
| 20 | 20 | $role = $this->role; |
| 21 | 21 | |
| 22 | - if($role==1) { |
|
| 23 | - return true; // administrator - grant all document permissions |
|
| 22 | + if ($role == 1) { |
|
| 23 | + return true; // administrator - grant all document permissions |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) { |
|
| 26 | + if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
|
| 27 | 27 | return true; // permissions aren't in use |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'")); |
| 31 | - if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 32 | - if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) { |
|
| 31 | + if ($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 32 | + if (($this->duplicateDoc == true || $document == 0) && $parent == 0 && $udperms_allowroot == 0) { |
|
| 33 | 33 | return false; // deny duplicate || create new document at root if Allow Root is No |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // get document groups for current user |
| 37 | - if($_SESSION['mgrDocgroups']) { |
|
| 38 | - $docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']); |
|
| 37 | + if ($_SESSION['mgrDocgroups']) { |
|
| 38 | + $docgrp = implode(" || dg.document_group = ", $_SESSION['mgrDocgroups']); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /* Note: |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | are private to the manager users will not be private to web users if the |
| 47 | 47 | document group is not assigned to a web user group and visa versa. |
| 48 | 48 | */ |
| 49 | - $permissionsok = false; // set permissions to false |
|
| 49 | + $permissionsok = false; // set permissions to false |
|
| 50 | 50 | |
| 51 | 51 | $rs = $modx->db->select( |
| 52 | 52 | 'count(DISTINCT sc.id)', |
| 53 | 53 | "{$tblsc} AS sc |
| 54 | 54 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
| 55 | 55 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
| 56 | - "sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)" |
|
| 56 | + "sc.id='{$this->document}' AND (".((!$docgrp) ? null : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
| 57 | 57 | ); |
| 58 | 58 | $limit = $modx->db->getValue($rs); |
| 59 | - if($limit==1) $permissionsok = true; |
|
| 59 | + if ($limit == 1) $permissionsok = true; |
|
| 60 | 60 | |
| 61 | 61 | return $permissionsok; |
| 62 | 62 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if (isset($this->aliases[$id])) { |
| 62 | 62 | if ($this->aliasVisible[$id] == 1) { |
| 63 | 63 | if ($path != '') { |
| 64 | - $path = $this->aliases[$id] . '/' . $path; |
|
| 64 | + $path = $this->aliases[$id].'/'.$path; |
|
| 65 | 65 | } else { |
| 66 | 66 | $path = $this->aliases[$id]; |
| 67 | 67 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $modx->messageQuit("Cache path not set."); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
| 83 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
| 84 | 84 | $filesincache = count($files); |
| 85 | 85 | $deletedfiles = array(); |
| 86 | 86 | while ($file = array_shift($files)) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if(function_exists('opcache_get_status')) { |
|
| 96 | + if (function_exists('opcache_get_status')) { |
|
| 97 | 97 | $opcache = opcache_get_status(); |
| 98 | 98 | if (!empty($opcache['opcache_enabled'])) { |
| 99 | 99 | opcache_reset(); |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | if (isset($opcache)) { |
| 114 | 114 | echo '<p>Opcache empty.</p>'; |
| 115 | 115 | } |
| 116 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
| 116 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
| 117 | 117 | foreach ($deletedfiles as $deletedfile) { |
| 118 | - echo '<li>' . $deletedfile . '</li>'; |
|
| 118 | + echo '<li>'.$deletedfile.'</li>'; |
|
| 119 | 119 | } |
| 120 | 120 | echo '</ul>'; |
| 121 | 121 | } |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | // write the file |
| 134 | - $content = '<?php' . "\n"; |
|
| 135 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
| 136 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
| 134 | + $content = '<?php'."\n"; |
|
| 135 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
| 136 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
| 137 | 137 | |
| 138 | - $filename = $this->cachePath . '/sitePublishing.idx.php'; |
|
| 138 | + $filename = $this->cachePath.'/sitePublishing.idx.php'; |
|
| 139 | 139 | if (!$handle = fopen($filename, 'w')) { |
| 140 | 140 | exit("Cannot open file ({$filename}"); |
| 141 | 141 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | // update publish time file |
| 156 | 156 | $timesArr = array(); |
| 157 | 157 | |
| 158 | - $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', 'pub_date>' . $this->request_time); |
|
| 158 | + $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', 'pub_date>'.$this->request_time); |
|
| 159 | 159 | if (!$result) { |
| 160 | 160 | echo "Couldn't determine next publish event!"; |
| 161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $timesArr[] = $minpub; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', 'unpub_date>' . $this->request_time); |
|
| 168 | + $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', 'unpub_date>'.$this->request_time); |
|
| 169 | 169 | if (!$result) { |
| 170 | 170 | echo "Couldn't determine next unpublish event!"; |
| 171 | 171 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $config = array(); |
| 204 | 204 | $content .= '$c=&$this->config;'; |
| 205 | 205 | while (list($key, $value) = $modx->db->getRow($rs, 'num')) { |
| 206 | - $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
| 206 | + $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
| 207 | 207 | $config[$key] = $value; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -241,23 +241,23 @@ discard block |
||
| 241 | 241 | $docid = $doc['id']; |
| 242 | 242 | if ($use_alias_path) { |
| 243 | 243 | $tmpPath = $this->getParents($doc['parent']); |
| 244 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
| 244 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
| 245 | 245 | $key = $alias; |
| 246 | 246 | } else { |
| 247 | 247 | $key = $doc['alias']; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $doc['path'] = $tmpPath; |
| 251 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
| 252 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
| 253 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
| 251 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
| 252 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
| 253 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // get content types |
| 257 | 257 | $rs = $modx->db->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'"); |
| 258 | 258 | $content .= '$c=&$this->contentTypes;'; |
| 259 | 259 | while ($doc = $modx->db->getRow($rs)) { |
| 260 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
| 260 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // WRITE Chunks to cache file |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | if ($modx->config['minifyphp_incache']) { |
| 268 | 268 | $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']); |
| 269 | 269 | } |
| 270 | - $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
| 270 | + $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // WRITE snippets to cache file |
@@ -278,18 +278,18 @@ discard block |
||
| 278 | 278 | while ($row = $modx->db->getRow($rs)) { |
| 279 | 279 | $key = $row['name']; |
| 280 | 280 | if ($row['disabled']) { |
| 281 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
| 281 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
| 282 | 282 | } else { |
| 283 | 283 | $value = trim($row['snippet']); |
| 284 | 284 | if ($modx->config['minifyphp_incache']) { |
| 285 | 285 | $value = $this->php_strip_whitespace($value); |
| 286 | 286 | } |
| 287 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
| 287 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
| 288 | 288 | $properties = $modx->parseProperties($row['properties']); |
| 289 | 289 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
| 290 | 290 | $properties = array_merge($sharedproperties, $properties); |
| 291 | 291 | if (0 < count($properties)) { |
| 292 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
| 292 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | if ($modx->config['minifyphp_incache']) { |
| 308 | 308 | $value = $this->php_strip_whitespace($value); |
| 309 | 309 | } |
| 310 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
| 310 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
| 311 | 311 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
| 312 | 312 | $properties = $modx->parseProperties($row['properties']); |
| 313 | 313 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
| 314 | 314 | $properties = array_merge($sharedproperties, $properties); |
| 315 | 315 | if (0 < count($properties)) { |
| 316 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
| 316 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | } |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | foreach ($events as $evtname => $pluginnames) { |
| 338 | 338 | $events[$evtname] = $pluginnames; |
| 339 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
| 339 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $content .= "\n"; |
| 343 | 343 | |
| 344 | 344 | // close and write the file |
| 345 | - $filename = $this->cachePath . 'siteCache.idx.php'; |
|
| 345 | + $filename = $this->cachePath.'siteCache.idx.php'; |
|
| 346 | 346 | |
| 347 | 347 | // invoke OnBeforeCacheUpdate event |
| 348 | 348 | if ($modx) { |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!"); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
| 357 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
| 356 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
| 357 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | // invoke OnCacheUpdate event |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | $source = trim($source); |
| 373 | 373 | if (substr($source, 0, 5) !== '<?php') { |
| 374 | - $source = '<?php ' . $source; |
|
| 374 | + $source = '<?php '.$source; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | $tokens = token_get_all($source); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $_ .= $text; |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | - $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
| 430 | + $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
| 431 | 431 | $source = trim($source); |
| 432 | 432 | return $source; |
| 433 | 433 | } |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") { |
|
| 2 | +if (IN_MANAGER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('save_user')) { |
|
| 5 | +if (!$modx->hasPermission('save_user')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -44,56 +44,56 @@ discard block |
||
| 44 | 44 | $user_groups = $input['user_groups']; |
| 45 | 45 | |
| 46 | 46 | // verify password |
| 47 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
| 47 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
| 48 | 48 | webAlertAndQuit("Password typed is mismatched"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // verify email |
| 52 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
| 52 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
| 53 | 53 | webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // verify admin security |
| 57 | -if($_SESSION['mgrRole'] != 1) { |
|
| 57 | +if ($_SESSION['mgrRole'] != 1) { |
|
| 58 | 58 | // Check to see if user tried to spoof a "1" (admin) role |
| 59 | - if(!$modx->hasPermission('save_role')) { |
|
| 59 | + if (!$modx->hasPermission('save_role')) { |
|
| 60 | 60 | webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!"); |
| 61 | 61 | } |
| 62 | 62 | // Verify that the user being edited wasn't an admin and the user ID got spoofed |
| 63 | 63 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
| 64 | 64 | $limit = $modx->db->getValue($rs); |
| 65 | - if($limit > 0) { |
|
| 65 | + if ($limit > 0) { |
|
| 66 | 66 | webAlertAndQuit("You cannot alter an administrative user."); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -switch($input['mode']) { |
|
| 71 | +switch ($input['mode']) { |
|
| 72 | 72 | case '11' : // new user |
| 73 | 73 | // check if this user name already exist |
| 74 | 74 | $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
| 75 | 75 | $limit = $modx->db->getValue($rs); |
| 76 | - if($limit > 0) { |
|
| 76 | + if ($limit > 0) { |
|
| 77 | 77 | webAlertAndQuit("User name is already in use!"); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // check if the email address already exist |
| 81 | 81 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
| 82 | 82 | $limit = $modx->db->getValue($rs); |
| 83 | - if($limit > 0) { |
|
| 83 | + if ($limit > 0) { |
|
| 84 | 84 | webAlertAndQuit("Email is already in use!"); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // generate a new password for this user |
| 88 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 89 | - if(strlen($specifiedpassword) < 6) { |
|
| 88 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 89 | + if (strlen($specifiedpassword) < 6) { |
|
| 90 | 90 | webAlertAndQuit("Password is too short!"); |
| 91 | 91 | } else { |
| 92 | 92 | $newpassword = $specifiedpassword; |
| 93 | 93 | } |
| 94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 94 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 95 | 95 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 96 | - } elseif($passwordgenmethod == 'g') { |
|
| 96 | + } elseif ($passwordgenmethod == 'g') { |
|
| 97 | 97 | $newpassword = generate_password(8); |
| 98 | 98 | } else { |
| 99 | 99 | webAlertAndQuit("No password generation method specified!"); |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | /*******************************************************************************/ |
| 142 | 142 | // put the user in the user_groups he/ she should be in |
| 143 | 143 | // first, check that up_perms are switched on! |
| 144 | - if($use_udperms == 1) { |
|
| 145 | - if(!empty($user_groups)) { |
|
| 146 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 144 | + if ($use_udperms == 1) { |
|
| 145 | + if (!empty($user_groups)) { |
|
| 146 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 147 | 147 | $f = array(); |
| 148 | 148 | $f['user_group'] = intval($user_groups[$i]); |
| 149 | 149 | $f['member'] = $internalKey; |
@@ -153,20 +153,20 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | // end of user_groups stuff! |
| 155 | 155 | |
| 156 | - if($passwordnotifymethod == 'e') { |
|
| 156 | + if ($passwordnotifymethod == 'e') { |
|
| 157 | 157 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 158 | - if($input['stay'] != '') { |
|
| 158 | + if ($input['stay'] != '') { |
|
| 159 | 159 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
| 160 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 160 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 161 | 161 | header($header); |
| 162 | 162 | } else { |
| 163 | 163 | $header = "Location: index.php?a=75&r=2"; |
| 164 | 164 | header($header); |
| 165 | 165 | } |
| 166 | 166 | } else { |
| 167 | - if($input['stay'] != '') { |
|
| 167 | + if ($input['stay'] != '') { |
|
| 168 | 168 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
| 169 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 169 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 170 | 170 | } else { |
| 171 | 171 | $stayUrl = "index.php?a=75&r=2"; |
| 172 | 172 | } |
@@ -199,36 +199,36 @@ discard block |
||
| 199 | 199 | break; |
| 200 | 200 | case '12' : // edit user |
| 201 | 201 | // generate a new password for this user |
| 202 | - if($genpassword == 1) { |
|
| 203 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 204 | - if(strlen($specifiedpassword) < 6) { |
|
| 202 | + if ($genpassword == 1) { |
|
| 203 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 204 | + if (strlen($specifiedpassword) < 6) { |
|
| 205 | 205 | webAlertAndQuit("Password is too short!"); |
| 206 | 206 | } else { |
| 207 | 207 | $newpassword = $specifiedpassword; |
| 208 | 208 | } |
| 209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 209 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 210 | 210 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 211 | - } elseif($passwordgenmethod == 'g') { |
|
| 211 | + } elseif ($passwordgenmethod == 'g') { |
|
| 212 | 212 | $newpassword = generate_password(8); |
| 213 | 213 | } else { |
| 214 | 214 | webAlertAndQuit("No password generation method specified!"); |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | - if($passwordnotifymethod == 'e') { |
|
| 217 | + if ($passwordnotifymethod == 'e') { |
|
| 218 | 218 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // check if the username already exist |
| 222 | 222 | $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
| 223 | 223 | $limit = $modx->db->getValue($rs); |
| 224 | - if($limit > 0) { |
|
| 224 | + if ($limit > 0) { |
|
| 225 | 225 | webAlertAndQuit("User name is already in use!"); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | // check if the email address already exists |
| 229 | 229 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
| 230 | 230 | $limit = $modx->db->getValue($rs); |
| 231 | - if($limit > 0) { |
|
| 231 | + if ($limit > 0) { |
|
| 232 | 232 | webAlertAndQuit("Email is already in use!"); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | // update user name and password |
| 242 | 242 | $field = array(); |
| 243 | 243 | $field['username'] = $modx->db->escape($newusername); |
| 244 | - if($genpassword == 1) { |
|
| 244 | + if ($genpassword == 1) { |
|
| 245 | 245 | $field['password'] = $modx->phpass->HashPassword($newpassword); |
| 246 | 246 | } |
| 247 | 247 | $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | )); |
| 270 | 270 | |
| 271 | 271 | // invoke OnManagerChangePassword event |
| 272 | - if($genpassword == 1) { |
|
| 272 | + if ($genpassword == 1) { |
|
| 273 | 273 | $modx->invokeEvent("OnManagerChangePassword", array( |
| 274 | 274 | "userid" => $id, |
| 275 | 275 | "username" => $newusername, |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | /*******************************************************************************/ |
| 287 | 287 | // put the user in the user_groups he/ she should be in |
| 288 | 288 | // first, check that up_perms are switched on! |
| 289 | - if($use_udperms == 1) { |
|
| 289 | + if ($use_udperms == 1) { |
|
| 290 | 290 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
| 291 | 291 | $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
| 292 | - if(!empty($user_groups)) { |
|
| 293 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 292 | + if (!empty($user_groups)) { |
|
| 293 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 294 | 294 | $field = array(); |
| 295 | 295 | $field['user_group'] = intval($user_groups[$i]); |
| 296 | 296 | $field['member'] = $id; |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | // end of user_groups stuff! |
| 302 | 302 | /*******************************************************************************/ |
| 303 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
| 303 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
| 304 | 304 | $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
| 305 | 305 | } |
| 306 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 307 | - if($input['stay'] != '') { |
|
| 306 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 307 | + if ($input['stay'] != '') { |
|
| 308 | 308 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
| 309 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 309 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 310 | 310 | } else { |
| 311 | 311 | $stayUrl = "index.php?a=75&r=2"; |
| 312 | 312 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | <div class="sectionHeader"><?php echo $_lang['user_title']; ?></div> |
| 327 | 327 | <div class="sectionBody"> |
| 328 | 328 | <div id="disp"> |
| 329 | - <p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
| 329 | + <p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p> |
|
| 330 | 330 | </div> |
| 331 | 331 | </div> |
| 332 | 332 | </div> |
@@ -334,9 +334,9 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | include_once "footer.inc.php"; |
| 336 | 336 | } else { |
| 337 | - if($input['stay'] != '') { |
|
| 337 | + if ($input['stay'] != '') { |
|
| 338 | 338 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
| 339 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 339 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 340 | 340 | header($header); |
| 341 | 341 | } else { |
| 342 | 342 | $header = "Location: index.php?a=75&r=2"; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // Send an email to the user |
| 352 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
| 352 | +function sendMailMessage($email, $uid, $pwd, $ufn){ |
|
| 353 | 353 | global $modx, $_lang, $signupemail_message; |
| 354 | 354 | global $emailsubject, $emailsender; |
| 355 | 355 | global $site_name; |
@@ -371,14 +371,14 @@ discard block |
||
| 371 | 371 | $param['to'] = $email; |
| 372 | 372 | $param['type'] = 'text'; |
| 373 | 373 | $rs = $modx->sendmail($param); |
| 374 | - if(!$rs) { |
|
| 374 | + if (!$rs) { |
|
| 375 | 375 | $modx->manager->saveFormValues(); |
| 376 | 376 | $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // Save User Settings |
| 381 | -function saveUserSettings($id) { |
|
| 381 | +function saveUserSettings($id){ |
|
| 382 | 382 | global $modx; |
| 383 | 383 | $tbl_user_settings = $modx->getFullTableName('user_settings'); |
| 384 | 384 | |
@@ -430,27 +430,27 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | // get user setting field names |
| 432 | 432 | $settings = array(); |
| 433 | - foreach($_POST as $n => $v) { |
|
| 434 | - if(in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
| 433 | + foreach ($_POST as $n => $v) { |
|
| 434 | + if (in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
| 435 | 435 | continue; |
| 436 | 436 | } // ignore blacklist and empties |
| 437 | 437 | $settings[$n] = $v; // this value should be saved |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - foreach($defaults as $k) { |
|
| 441 | - if(isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
| 440 | + foreach ($defaults as $k) { |
|
| 441 | + if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') { |
|
| 442 | 442 | unset($settings[$k]); |
| 443 | 443 | } |
| 444 | - unset($settings['default_' . $k]); |
|
| 444 | + unset($settings['default_'.$k]); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
| 448 | 448 | |
| 449 | - foreach($settings as $n => $vl) { |
|
| 450 | - if(is_array($vl)) { |
|
| 449 | + foreach ($settings as $n => $vl) { |
|
| 450 | + if (is_array($vl)) { |
|
| 451 | 451 | $vl = implode(",", $vl); |
| 452 | 452 | } |
| 453 | - if($vl != '') { |
|
| 453 | + if ($vl != '') { |
|
| 454 | 454 | $f = array(); |
| 455 | 455 | $f['user'] = $id; |
| 456 | 456 | $f['setting_name'] = $n; |
@@ -462,20 +462,20 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | // Web alert - sends an alert to web browser |
| 465 | -function webAlertAndQuit($msg) { |
|
| 465 | +function webAlertAndQuit($msg){ |
|
| 466 | 466 | global $id, $modx; |
| 467 | 467 | $mode = $_POST['mode']; |
| 468 | 468 | $modx->manager->saveFormValues($mode); |
| 469 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
| 469 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '12' ? "&id={$id}" : '')); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Generate password |
| 473 | -function generate_password($length = 10) { |
|
| 473 | +function generate_password($length = 10){ |
|
| 474 | 474 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
| 475 | 475 | $ps_len = strlen($allowable_characters); |
| 476 | 476 | mt_srand((double) microtime() * 1000000); |
| 477 | 477 | $pass = ""; |
| 478 | - for($i = 0; $i < $length; $i++) { |
|
| 478 | + for ($i = 0; $i < $length; $i++) { |
|
| 479 | 479 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
| 480 | 480 | } |
| 481 | 481 | return $pass; |
@@ -1,36 +1,36 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | -if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
| 8 | -if($id==0) { |
|
| 7 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
| 8 | +if ($id == 0) { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /************webber ********/ |
| 13 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 14 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 13 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 14 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 15 | 15 | |
| 16 | 16 | /************** webber *************/ |
| 17 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 18 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 19 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 20 | -$add_path=$sd.$sb.$pg; |
|
| 17 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 18 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 19 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 20 | +$add_path = $sd.$sb.$pg; |
|
| 21 | 21 | |
| 22 | 22 | /***********************************/ |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | // check permissions on the document |
| 27 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 27 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 28 | 28 | $udperms = new udperms(); |
| 29 | 29 | $udperms->user = $modx->getLoginUserID(); |
| 30 | 30 | $udperms->document = $id; |
| 31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
| 32 | 32 | |
| 33 | -if(!$udperms->checkPermissions()) { |
|
| 33 | +if (!$udperms->checkPermissions()) { |
|
| 34 | 34 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
| 48 | 48 | |
| 49 | 49 | // invoke OnDocPublished event |
| 50 | -$modx->invokeEvent("OnDocPublished",array("docid"=>$id)); |
|
| 50 | +$modx->invokeEvent("OnDocPublished", array("docid"=>$id)); |
|
| 51 | 51 | |
| 52 | 52 | // Set the item name for logger |
| 53 | 53 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -55,6 +55,6 @@ discard block |
||
| 55 | 55 | // empty cache |
| 56 | 56 | $modx->clearCache('full'); |
| 57 | 57 | |
| 58 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 58 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 59 | 59 | |
| 60 | 60 | header($header); |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | 3 | |
| 4 | -if(!isset($_GET['id'])) { |
|
| 5 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 4 | +if (!isset($_GET['id'])) { |
|
| 5 | + if (!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | 6 | |
| 7 | 7 | // Remove all locks |
| 8 | 8 | $modx->db->truncate($modx->getFullTableName('active_user_locks')); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $type = intval($_GET['type']); |
| 15 | 15 | $id = intval($_GET['id']); |
| 16 | 16 | $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
| 17 | - if($type && $id) { |
|
| 17 | + if ($type && $id) { |
|
| 18 | 18 | $modx->unlockElement($type, $id, $includeAllUsers); |
| 19 | 19 | echo '1'; |
| 20 | 20 | exit; |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | -if(!$modx->hasPermission('new_plugin')) { |
|
| 2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | +if (!$modx->hasPermission('new_plugin')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
| 8 | -if($id==0) { |
|
| 7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
| 8 | +if ($id == 0) { |
|
| 9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | // count duplicates |
| 13 | 13 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
| 14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 15 | -if($count>=1) $count = ' '.($count+1); |
|
| 15 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 16 | 16 | else $count = ''; |
| 17 | 17 | |
| 18 | 18 | // duplicate Plugin |
@@ -42,5 +42,5 @@ discard block |
||
| 42 | 42 | $_SESSION['itemname'] = $name; |
| 43 | 43 | |
| 44 | 44 | // finish duplicating - redirect to new plugin |
| 45 | -$header="Location: index.php?r=2&a=102&id=$newid"; |
|
| 45 | +$header = "Location: index.php?r=2&a=102&id=$newid"; |
|
| 46 | 46 | header($header); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | -if(!($modx->hasPermission('settings') && ($modx->hasPermission('logs')||$modx->hasPermission('bk_manager')))) { |
|
| 2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | +if (!($modx->hasPermission('settings') && ($modx->hasPermission('logs') || $modx->hasPermission('bk_manager')))) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -31,5 +31,5 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $mode = intval($_REQUEST['mode']); |
| 34 | -$header="Location: index.php?a={$mode}&s=4"; |
|
| 34 | +$header = "Location: index.php?a={$mode}&s=4"; |
|
| 35 | 35 | header($header); |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(IN_MANAGER_MODE != "true") { |
|
| 2 | +if (IN_MANAGER_MODE != "true") { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('save_role')) { |
|
| 5 | +if (!$modx->hasPermission('save_role')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | extract($_POST); |
| 10 | 10 | |
| 11 | -if($name == '' || !isset ($name)) { |
|
| 12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
| 11 | +if ($name == '' || !isset ($name)) { |
|
| 12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}".($mode = 35 ? "&id={$id}" : "")); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // setup fields |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $fields = $modx->db->escape($fields); |
| 93 | 93 | |
| 94 | -switch($_POST['mode']) { |
|
| 94 | +switch ($_POST['mode']) { |
|
| 95 | 95 | case '38' : |
| 96 | 96 | $tbl = $modx->getFullTableName("user_roles"); |
| 97 | 97 | |
| 98 | 98 | // disallow duplicate names for role |
| 99 | 99 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
| 100 | - if($modx->db->getValue($rs) > 0) { |
|
| 100 | + if ($modx->db->getValue($rs) > 0) { |
|
| 101 | 101 | $modx->manager->saveFormValues(38); |
| 102 | 102 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
| 103 | 103 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // disallow duplicate names for role |
| 117 | 117 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
| 118 | - if($modx->db->getValue($rs) > 0) { |
|
| 118 | + if ($modx->db->getValue($rs) > 0) { |
|
| 119 | 119 | $modx->manager->saveFormValues(35); |
| 120 | 120 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
| 121 | 121 | } |