@@ -12,25 +12,25 @@ |
||
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -$msg =''; |
|
| 15 | +$msg = ''; |
|
| 16 | 16 | $pth = dirname(dirname(dirname(__FILE__)))."/install/"; |
| 17 | -$pth = str_replace("\\","/",$pth); |
|
| 18 | -if(isset($_GET["rminstall"])) { |
|
| 19 | - if(is_dir($pth)) { |
|
| 20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
| 17 | +$pth = str_replace("\\", "/", $pth); |
|
| 18 | +if (isset($_GET["rminstall"])) { |
|
| 19 | + if (is_dir($pth)) { |
|
| 20 | + if (!rmdirRecursive($pth)) $msg = "An error occured while attempting to remove the install folder"; |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
| 23 | +if ($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
| 24 | 24 | echo "<script>window.location='../index.php?a=2';</script>"; |
| 25 | 25 | |
| 26 | 26 | // rmdirRecursive - detects symbollic links on unix |
| 27 | -function rmdirRecursive($path,$followLinks=false) { |
|
| 28 | - $dir = opendir($path) ; |
|
| 27 | +function rmdirRecursive($path, $followLinks = false){ |
|
| 28 | + $dir = opendir($path); |
|
| 29 | 29 | while ($entry = readdir($dir)) { |
| 30 | 30 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
| 31 | - @unlink( "$path/$entry" ); |
|
| 31 | + @unlink("$path/$entry"); |
|
| 32 | 32 | } |
| 33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
| 33 | + elseif (is_dir("$path/$entry") && $entry != '.' && $entry != '..') { |
|
| 34 | 34 | rmdirRecursive("$path/$entry"); // recursive |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -1,5 +1,5 @@ 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 | if (!$modx->hasPermission('save_document')) { |
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | $aliasvisible = $_POST['alias_visible']; |
| 35 | 35 | |
| 36 | 36 | /************* webber ********/ |
| 37 | -$sd=isset($_POST['dir'])?'&dir='.$_POST['dir']:'&dir=DESC'; |
|
| 38 | -$sb=isset($_POST['sort'])?'&sort='.$_POST['sort']:'&sort=pub_date'; |
|
| 39 | -$pg=isset($_POST['page'])?'&page='.(int)$_POST['page']:''; |
|
| 40 | -$add_path=$sd.$sb.$pg; |
|
| 37 | +$sd = isset($_POST['dir']) ? '&dir='.$_POST['dir'] : '&dir=DESC'; |
|
| 38 | +$sb = isset($_POST['sort']) ? '&sort='.$_POST['sort'] : '&sort=pub_date'; |
|
| 39 | +$pg = isset($_POST['page']) ? '&page='.(int) $_POST['page'] : ''; |
|
| 40 | +$add_path = $sd.$sb.$pg; |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | // auto assign alias |
| 72 | 72 | if (!$alias && $automatic_alias) { |
| 73 | 73 | $alias = strtolower($modx->stripAlias(trim($pagetitle))); |
| 74 | - if(!$allow_duplicate_alias) { |
|
| 74 | + if (!$allow_duplicate_alias) { |
|
| 75 | 75 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND alias='$alias'")) != 0) { |
| 76 | 76 | $cnt = 1; |
| 77 | 77 | $tempAlias = $alias; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | $alias = $tempAlias; |
| 84 | 84 | } |
| 85 | - }else{ |
|
| 85 | + } else { |
|
| 86 | 86 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) { |
| 87 | 87 | $cnt = 1; |
| 88 | 88 | $tempAlias = $alias; |
@@ -163,19 +163,19 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // get document groups for current user |
| 166 | -$tmplvars = array (); |
|
| 166 | +$tmplvars = array(); |
|
| 167 | 167 | if ($_SESSION['mgrDocgroups']) { |
| 168 | 168 | $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // ensure that user has not made this document inaccessible to themselves |
| 172 | -if($_SESSION['mgrRole'] != 1 && is_array($document_groups)) { |
|
| 172 | +if ($_SESSION['mgrRole'] != 1 && is_array($document_groups)) { |
|
| 173 | 173 | $document_group_list = implode(',', $document_groups); |
| 174 | - $document_group_list = implode(',', array_filter(explode(',',$document_group_list), 'is_numeric')); |
|
| 175 | - if(!empty($document_group_list)) { |
|
| 174 | + $document_group_list = implode(',', array_filter(explode(',', $document_group_list), 'is_numeric')); |
|
| 175 | + if (!empty($document_group_list)) { |
|
| 176 | 176 | $rs = $modx->db->select('COUNT(mg.id)', "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg", "mga.membergroup = mg.user_group AND mga.documentgroup IN({$document_group_list}) AND mg.member = {$_SESSION['mgrInternalKey']}"); |
| 177 | 177 | $count = $modx->db->getValue($rs); |
| 178 | - if($count == 0) { |
|
| 178 | + if ($count == 0) { |
|
| 179 | 179 | if ($actionToTake == 'edit') { |
| 180 | 180 | $modx->manager->saveFormValues(27); |
| 181 | 181 | $modx->webAlertAndQuit(sprintf($_lang["resource_permissions_error"]), "index.php?a=27&id={$id}"); |
@@ -193,45 +193,45 @@ discard block |
||
| 193 | 193 | INNER JOIN {$tbl_site_tmplvar_templates} AS tvtpl ON tvtpl.tmplvarid = tv.id |
| 194 | 194 | LEFT JOIN {$tbl_site_tmplvar_contentvalues} AS tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$id}' |
| 195 | 195 | LEFT JOIN {$tbl_site_tmplvar_access} AS tva ON tva.tmplvarid=tv.id", |
| 196 | - "tvtpl.templateid = '{$template}' AND (1='{$_SESSION['mgrRole']}' OR ISNULL(tva.documentgroup)" . ((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)") . ")", |
|
| 196 | + "tvtpl.templateid = '{$template}' AND (1='{$_SESSION['mgrRole']}' OR ISNULL(tva.documentgroup)".((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)").")", |
|
| 197 | 197 | "tv.rank" |
| 198 | 198 | ); |
| 199 | 199 | while ($row = $modx->db->getRow($rs)) { |
| 200 | 200 | $tmplvar = ''; |
| 201 | 201 | switch ($row['type']) { |
| 202 | 202 | case 'url': |
| 203 | - $tmplvar = $_POST["tv" . $row['id']]; |
|
| 204 | - if ($_POST["tv" . $row['id'] . '_prefix'] != '--') { |
|
| 205 | - $tmplvar = str_replace(array ( |
|
| 203 | + $tmplvar = $_POST["tv".$row['id']]; |
|
| 204 | + if ($_POST["tv".$row['id'].'_prefix'] != '--') { |
|
| 205 | + $tmplvar = str_replace(array( |
|
| 206 | 206 | "feed://", |
| 207 | 207 | "ftp://", |
| 208 | 208 | "http://", |
| 209 | 209 | "https://", |
| 210 | 210 | "mailto:" |
| 211 | 211 | ), "", $tmplvar); |
| 212 | - $tmplvar = $_POST["tv" . $row['id'] . '_prefix'] . $tmplvar; |
|
| 212 | + $tmplvar = $_POST["tv".$row['id'].'_prefix'].$tmplvar; |
|
| 213 | 213 | } |
| 214 | 214 | break; |
| 215 | 215 | case 'file': |
| 216 | - $tmplvar = $_POST["tv" . $row['id']]; |
|
| 216 | + $tmplvar = $_POST["tv".$row['id']]; |
|
| 217 | 217 | break; |
| 218 | 218 | default: |
| 219 | - if (is_array($_POST["tv" . $row['id']])) { |
|
| 219 | + if (is_array($_POST["tv".$row['id']])) { |
|
| 220 | 220 | // handles checkboxes & multiple selects elements |
| 221 | - $feature_insert = array (); |
|
| 222 | - $lst = $_POST["tv" . $row['id']]; |
|
| 221 | + $feature_insert = array(); |
|
| 222 | + $lst = $_POST["tv".$row['id']]; |
|
| 223 | 223 | while (list ($featureValue, $feature_item) = each($lst)) { |
| 224 | 224 | $feature_insert[count($feature_insert)] = $feature_item; |
| 225 | 225 | } |
| 226 | 226 | $tmplvar = implode("||", $feature_insert); |
| 227 | 227 | } else { |
| 228 | - $tmplvar = $_POST["tv" . $row['id']]; |
|
| 228 | + $tmplvar = $_POST["tv".$row['id']]; |
|
| 229 | 229 | } |
| 230 | 230 | break; |
| 231 | 231 | } |
| 232 | 232 | // save value if it was modified |
| 233 | 233 | if (strlen($tmplvar) > 0 && $tmplvar != $row['default_text']) { |
| 234 | - $tmplvars[$row['id']] = array ( |
|
| 234 | + $tmplvars[$row['id']] = array( |
|
| 235 | 235 | $row['id'], |
| 236 | 236 | $tmplvar |
| 237 | 237 | ); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | // check to see if the user is allowed to save the document in the place he wants to save it in |
| 255 | 255 | if ($use_udperms == 1) { |
| 256 | 256 | if ($existingDocument['parent'] != $parent) { |
| 257 | - include_once MODX_MANAGER_PATH ."processors/user_documents_permissions.class.php"; |
|
| 257 | + include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 258 | 258 | $udperms = new udperms(); |
| 259 | 259 | $udperms->user = $modx->getLoginUserID(); |
| 260 | 260 | $udperms->document = $parent; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | case 'new' : |
| 277 | 277 | |
| 278 | 278 | // invoke OnBeforeDocFormSave event |
| 279 | - switch($modx->config['docid_incrmnt_method']) |
|
| 279 | + switch ($modx->config['docid_incrmnt_method']) |
|
| 280 | 280 | { |
| 281 | 281 | case '1': |
| 282 | 282 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $id = $modx->db->getValue($rs); |
| 286 | 286 | break; |
| 287 | 287 | case '2': |
| 288 | - $rs = $modx->db->select('MAX(id)+1',$tbl_site_content); |
|
| 288 | + $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
| 289 | 289 | $id = $modx->db->getValue($rs); |
| 290 | 290 | break; |
| 291 | 291 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $id = ''; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
| 296 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
| 297 | 297 | "mode" => "new", |
| 298 | 298 | "id" => $id |
| 299 | 299 | )); |
@@ -308,48 +308,47 @@ discard block |
||
| 308 | 308 | $publishedon = ($published ? $currentdate : 0); |
| 309 | 309 | $publishedby = ($published ? $modx->getLoginUserID() : 0); |
| 310 | 310 | |
| 311 | - if ((!empty($pub_date))&&($published)){ |
|
| 312 | - $publishedon=$pub_date; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - $dbInsert = array |
|
| 316 | - ( |
|
| 317 | - "introtext" => $introtext , |
|
| 318 | - "content" => $content , |
|
| 319 | - "pagetitle" => $pagetitle , |
|
| 320 | - "longtitle" => $longtitle , |
|
| 321 | - "type" => $type , |
|
| 322 | - "description" => $description , |
|
| 323 | - "alias" => $alias , |
|
| 324 | - "link_attributes" => $link_attributes , |
|
| 325 | - "isfolder" => $isfolder , |
|
| 326 | - "richtext" => $richtext , |
|
| 327 | - "published" => $published , |
|
| 328 | - "parent" => $parent , |
|
| 329 | - "template" => $template , |
|
| 330 | - "menuindex" => $menuindex , |
|
| 331 | - "searchable" => $searchable , |
|
| 332 | - "cacheable" => $cacheable , |
|
| 333 | - "createdby" => $modx->getLoginUserID() , |
|
| 334 | - "createdon" => $currentdate , |
|
| 335 | - "editedby" => $modx->getLoginUserID() , |
|
| 336 | - "editedon" => $currentdate , |
|
| 337 | - "publishedby" => $publishedby , |
|
| 338 | - "publishedon" => $publishedon , |
|
| 339 | - "pub_date" => $pub_date , |
|
| 340 | - "unpub_date" => $unpub_date , |
|
| 341 | - "contentType" => $contentType , |
|
| 342 | - "content_dispo" => $contentdispo , |
|
| 343 | - "donthit" => $donthit , |
|
| 344 | - "menutitle" => $menutitle , |
|
| 345 | - "hidemenu" => $hidemenu , |
|
| 311 | + if ((!empty($pub_date)) && ($published)) { |
|
| 312 | + $publishedon = $pub_date; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + $dbInsert = array( |
|
| 316 | + "introtext" => $introtext, |
|
| 317 | + "content" => $content, |
|
| 318 | + "pagetitle" => $pagetitle, |
|
| 319 | + "longtitle" => $longtitle, |
|
| 320 | + "type" => $type, |
|
| 321 | + "description" => $description, |
|
| 322 | + "alias" => $alias, |
|
| 323 | + "link_attributes" => $link_attributes, |
|
| 324 | + "isfolder" => $isfolder, |
|
| 325 | + "richtext" => $richtext, |
|
| 326 | + "published" => $published, |
|
| 327 | + "parent" => $parent, |
|
| 328 | + "template" => $template, |
|
| 329 | + "menuindex" => $menuindex, |
|
| 330 | + "searchable" => $searchable, |
|
| 331 | + "cacheable" => $cacheable, |
|
| 332 | + "createdby" => $modx->getLoginUserID(), |
|
| 333 | + "createdon" => $currentdate, |
|
| 334 | + "editedby" => $modx->getLoginUserID(), |
|
| 335 | + "editedon" => $currentdate, |
|
| 336 | + "publishedby" => $publishedby, |
|
| 337 | + "publishedon" => $publishedon, |
|
| 338 | + "pub_date" => $pub_date, |
|
| 339 | + "unpub_date" => $unpub_date, |
|
| 340 | + "contentType" => $contentType, |
|
| 341 | + "content_dispo" => $contentdispo, |
|
| 342 | + "donthit" => $donthit, |
|
| 343 | + "menutitle" => $menutitle, |
|
| 344 | + "hidemenu" => $hidemenu, |
|
| 346 | 345 | "alias_visible" => $aliasvisible |
| 347 | 346 | ); |
| 348 | 347 | |
| 349 | 348 | if ($id != '') |
| 350 | 349 | $dbInsert["id"] = $id; |
| 351 | 350 | |
| 352 | - $key = $modx->db->insert( $dbInsert, $tbl_site_content); |
|
| 351 | + $key = $modx->db->insert($dbInsert, $tbl_site_content); |
|
| 353 | 352 | |
| 354 | 353 | $tvChanges = array(); |
| 355 | 354 | foreach ($tmplvars as $field => $value) { |
@@ -371,7 +370,7 @@ discard block |
||
| 371 | 370 | foreach ($document_groups as $value_pair) { |
| 372 | 371 | // first, split the pair (this is a new document, so ignore the second value |
| 373 | 372 | list($group) = explode(',', $value_pair); // @see actions/mutate_content.dynamic.php @ line 1138 (permissions list) |
| 374 | - $new_groups[] = '('.(int)$group.','.$key.')'; |
|
| 373 | + $new_groups[] = '('.(int) $group.','.$key.')'; |
|
| 375 | 374 | } |
| 376 | 375 | $saved = true; |
| 377 | 376 | if (!empty($new_groups)) { |
@@ -380,7 +379,7 @@ discard block |
||
| 380 | 379 | } else { |
| 381 | 380 | $isManager = $modx->hasPermission('access_permissions'); |
| 382 | 381 | $isWeb = $modx->hasPermission('web_access_permissions'); |
| 383 | - if($use_udperms && !($isManager || $isWeb) && $parent != 0) { |
|
| 382 | + if ($use_udperms && !($isManager || $isWeb) && $parent != 0) { |
|
| 384 | 383 | // inherit document access permissions |
| 385 | 384 | $modx->db->insert( |
| 386 | 385 | array( |
@@ -399,17 +398,17 @@ discard block |
||
| 399 | 398 | } |
| 400 | 399 | |
| 401 | 400 | // invoke OnDocFormSave event |
| 402 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
| 401 | + $modx->invokeEvent("OnDocFormSave", array( |
|
| 403 | 402 | "mode" => "new", |
| 404 | 403 | "id" => $key |
| 405 | 404 | )); |
| 406 | 405 | |
| 407 | 406 | // secure web documents - flag as private |
| 408 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
| 407 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
| 409 | 408 | secureWebDocument($key); |
| 410 | 409 | |
| 411 | 410 | // secure manager documents - flag as private |
| 412 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
| 411 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
| 413 | 412 | secureMgrDocument($key); |
| 414 | 413 | |
| 415 | 414 | // Set the item name for logger |
@@ -428,13 +427,13 @@ discard block |
||
| 428 | 427 | // document |
| 429 | 428 | if ($_POST['mode'] == "4") |
| 430 | 429 | $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
| 431 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay']; |
|
| 430 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay']; |
|
| 432 | 431 | } else { |
| 433 | 432 | $header = "Location: index.php?a=3&id=$key&r=1"; |
| 434 | 433 | } |
| 435 | 434 | |
| 436 | 435 | if (headers_sent()) { |
| 437 | - $header = str_replace('Location: ','',$header); |
|
| 436 | + $header = str_replace('Location: ', '', $header); |
|
| 438 | 437 | echo "<script>document.location.href='$header';</script>\n"; |
| 439 | 438 | } else { |
| 440 | 439 | header($header); |
@@ -488,7 +487,7 @@ discard block |
||
| 488 | 487 | if (!$was_published && $published) { |
| 489 | 488 | $publishedon = $currentdate; |
| 490 | 489 | $publishedby = $modx->getLoginUserID(); |
| 491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
| 490 | + }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) { |
|
| 492 | 491 | $publishedon = $pub_date; |
| 493 | 492 | $publishedby = $modx->getLoginUserID(); |
| 494 | 493 | }elseif ($was_published && !$published) { |
@@ -500,7 +499,7 @@ discard block |
||
| 500 | 499 | } |
| 501 | 500 | |
| 502 | 501 | // invoke OnBeforeDocFormSave event |
| 503 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
| 502 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
| 504 | 503 | "mode" => "upd", |
| 505 | 504 | "id" => $id |
| 506 | 505 | )); |
@@ -525,7 +524,7 @@ discard block |
||
| 525 | 524 | . "menuindex={$menuindex}, " |
| 526 | 525 | . "searchable={$searchable}, " |
| 527 | 526 | . "cacheable={$cacheable}, " |
| 528 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
| 527 | + . "editedby=".$modx->getLoginUserID().", " |
|
| 529 | 528 | . "editedon={$currentdate}, " |
| 530 | 529 | . "publishedon={$publishedon}, " |
| 531 | 530 | . "publishedby={$publishedby}, " |
@@ -539,7 +538,7 @@ discard block |
||
| 539 | 538 | |
| 540 | 539 | // update template variables |
| 541 | 540 | $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
| 542 | - $tvIds = array (); |
|
| 541 | + $tvIds = array(); |
|
| 543 | 542 | while ($row = $modx->db->getRow($rs)) { |
| 544 | 543 | $tvIds[$row['tmplvarid']] = $row['id']; |
| 545 | 544 | } |
@@ -592,7 +591,7 @@ discard block |
||
| 592 | 591 | 'groups.id, groups.document_group', |
| 593 | 592 | "{$tbl_document_groups} AS groups |
| 594 | 593 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
| 595 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
| 594 | + "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
| 596 | 595 | ); |
| 597 | 596 | $old_groups = array(); |
| 598 | 597 | while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
@@ -604,7 +603,7 @@ discard block |
||
| 604 | 603 | unset($old_groups[$group]); |
| 605 | 604 | continue; |
| 606 | 605 | } elseif ($link_id == 'new') { |
| 607 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
| 606 | + $insertions[] = '('.(int) $group.','.$id.')'; |
|
| 608 | 607 | } |
| 609 | 608 | } |
| 610 | 609 | if (!empty($insertions)) { |
@@ -636,17 +635,17 @@ discard block |
||
| 636 | 635 | |
| 637 | 636 | |
| 638 | 637 | // invoke OnDocFormSave event |
| 639 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
| 638 | + $modx->invokeEvent("OnDocFormSave", array( |
|
| 640 | 639 | "mode" => "upd", |
| 641 | 640 | "id" => $id |
| 642 | 641 | )); |
| 643 | 642 | |
| 644 | 643 | // secure web documents - flag as private |
| 645 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
| 644 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
| 646 | 645 | secureWebDocument($id); |
| 647 | 646 | |
| 648 | 647 | // secure manager documents - flag as private |
| 649 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
| 648 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
| 650 | 649 | secureMgrDocument($id); |
| 651 | 650 | |
| 652 | 651 | // Set the item name for logger |
@@ -654,14 +653,14 @@ discard block |
||
| 654 | 653 | |
| 655 | 654 | if ($syncsite == 1) { |
| 656 | 655 | // empty cache |
| 657 | - $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
|
| 656 | + $keys = array('alias', 'parent', 'published', 'isfolder', 'menuindex', 'alias_visible'); |
|
| 658 | 657 | $flag = ''; |
| 659 | - foreach($keys as $key) { |
|
| 660 | - if ($existingDocument[$key]===$_POST[$key]) continue; |
|
| 658 | + foreach ($keys as $key) { |
|
| 659 | + if ($existingDocument[$key] === $_POST[$key]) continue; |
|
| 661 | 660 | $flag = 'full'; |
| 662 | 661 | break; |
| 663 | 662 | } |
| 664 | - if($flag==='full') $modx->clearCache('full'); |
|
| 663 | + if ($flag === 'full') $modx->clearCache('full'); |
|
| 665 | 664 | else $modx->clearCache($id); |
| 666 | 665 | } |
| 667 | 666 | |
@@ -680,13 +679,13 @@ discard block |
||
| 680 | 679 | // document |
| 681 | 680 | $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
| 682 | 681 | } |
| 683 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
| 682 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path; |
|
| 684 | 683 | } else { |
| 685 | 684 | $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
| 686 | 685 | } |
| 687 | 686 | } |
| 688 | 687 | if (headers_sent()) { |
| 689 | - $header = str_replace('Location: ','',$header); |
|
| 688 | + $header = str_replace('Location: ', '', $header); |
|
| 690 | 689 | echo "<script>document.location.href='$header';</script>\n"; |
| 691 | 690 | } else { |
| 692 | 691 | header($header); |
@@ -1,10 +1,10 @@ |
||
| 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')) { |
|
| 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')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | $modx->db->truncate($modx->getFullTableName('manager_log')); |
| 8 | 8 | |
| 9 | -$header="Location: index.php?a=13"; |
|
| 9 | +$header = "Location: index.php?a=13"; |
|
| 10 | 10 | header($header); |
@@ -1,11 +1,11 @@ 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('delete_module')) { |
|
| 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('delete_module')) { |
|
| 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 | |
@@ -38,5 +38,5 @@ discard block |
||
| 38 | 38 | $modx->clearCache('full'); |
| 39 | 39 | |
| 40 | 40 | // finished emptying cache - redirect |
| 41 | -$header="Location: index.php?a=106&r=2"; |
|
| 41 | +$header = "Location: index.php?a=106&r=2"; |
|
| 42 | 42 | 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('save_password')) { |
|
| 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_password')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -8,11 +8,11 @@ discard block |
||
| 8 | 8 | $pass1 = $_POST['pass1']; |
| 9 | 9 | $pass2 = $_POST['pass2']; |
| 10 | 10 | |
| 11 | -if($pass1!=$pass2){ |
|
| 11 | +if ($pass1 != $pass2) { |
|
| 12 | 12 | $modx->webAlertAndQuit("Passwords don't match!"); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -if(strlen($pass1)<6){ |
|
| 15 | +if (strlen($pass1) < 6) { |
|
| 16 | 16 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | $uid = $modx->getLoginUserID(); |
| 22 | 22 | $modx->loadExtension('phpass'); |
| 23 | 23 | $f['password'] = $modx->phpass->HashPassword($pass1); |
| 24 | - $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
| 24 | + $modx->db->update($f, $tbl_manager_users, "id='{$uid}'"); |
|
| 25 | 25 | |
| 26 | 26 | // invoke OnManagerChangePassword event |
| 27 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
| 27 | + $modx->invokeEvent('OnManagerChangePassword', array( |
|
| 28 | 28 | 'userid' => $uid, |
| 29 | 29 | 'username' => $_SESSION['mgrShortname'], |
| 30 | 30 | 'userpassword' => $pass1 |
| 31 | 31 | )); |
| 32 | 32 | |
| 33 | -$header="Location: index.php?a=2"; |
|
| 33 | +$header = "Location: index.php?a=2"; |
|
| 34 | 34 | 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('access_permissions')) { |
|
| 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('access_permissions')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | switch ($operation) { |
| 21 | 21 | case "add_user_group" : |
| 22 | 22 | $newgroup = $_REQUEST['newusergroup']; |
| 23 | - if(empty($newgroup)) { |
|
| 23 | + if (empty($newgroup)) { |
|
| 24 | 24 | $modx->webAlertAndQuit("No group name specified."); |
| 25 | 25 | } else { |
| 26 | 26 | $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_membergroup_names); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | break; |
| 35 | 35 | case "add_document_group" : |
| 36 | 36 | $newgroup = $_REQUEST['newdocgroup']; |
| 37 | - if(empty($newgroup)) { |
|
| 37 | + if (empty($newgroup)) { |
|
| 38 | 38 | $modx->webAlertAndQuit("No group name specified."); |
| 39 | 39 | } else { |
| 40 | 40 | $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_documentgroup_names); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | case "delete_user_group" : |
| 50 | 50 | $updategroupaccess = true; |
| 51 | 51 | $usergroup = intval($_REQUEST['usergroup']); |
| 52 | - if(empty($usergroup)) { |
|
| 52 | + if (empty($usergroup)) { |
|
| 53 | 53 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
| 54 | 54 | } else { |
| 55 | 55 | $modx->db->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | break; |
| 62 | 62 | case "delete_document_group" : |
| 63 | 63 | $group = intval($_REQUEST['documentgroup']); |
| 64 | - if(empty($group)) { |
|
| 64 | + if (empty($group)) { |
|
| 65 | 65 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
| 66 | 66 | } else { |
| 67 | 67 | $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | break; |
| 74 | 74 | case "rename_user_group" : |
| 75 | 75 | $newgroupname = $_REQUEST['newgroupname']; |
| 76 | - if(empty($newgroupname)) { |
|
| 76 | + if (empty($newgroupname)) { |
|
| 77 | 77 | $modx->webAlertAndQuit("No group name specified."); |
| 78 | 78 | } |
| 79 | 79 | $groupid = intval($_REQUEST['groupid']); |
| 80 | - if(empty($groupid)) { |
|
| 80 | + if (empty($groupid)) { |
|
| 81 | 81 | $modx->webAlertAndQuit("No group id specified for rename."); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | break; |
| 86 | 86 | case "rename_document_group" : |
| 87 | 87 | $newgroupname = $_REQUEST['newgroupname']; |
| 88 | - if(empty($newgroupname)) { |
|
| 88 | + if (empty($newgroupname)) { |
|
| 89 | 89 | $modx->webAlertAndQuit("No group name specified."); |
| 90 | 90 | } |
| 91 | 91 | $groupid = intval($_REQUEST['groupid']); |
| 92 | - if(empty($groupid)) { |
|
| 92 | + if (empty($groupid)) { |
|
| 93 | 93 | $modx->webAlertAndQuit("No group id specified for rename."); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $docgroup = intval($_REQUEST['docgroup']); |
| 102 | 102 | $rs = $modx->db->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
| 103 | 103 | $limit = $modx->db->getValue($rs); |
| 104 | - if($limit<=0) { |
|
| 104 | + if ($limit <= 0) { |
|
| 105 | 105 | $modx->db->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
| 106 | 106 | } else { |
| 107 | 107 | //alert user that coupling already exists? |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // secure manager documents - flag as private |
| 120 | -if($updategroupaccess==true){ |
|
| 120 | +if ($updategroupaccess == true) { |
|
| 121 | 121 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
| 122 | 122 | secureMgrDocument(); |
| 123 | 123 | |
@@ -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_web_user')) { |
|
| 5 | +if (!$modx->hasPermission('save_web_user')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | $tbl_web_groups = $modx->getFullTableName('web_groups'); |
| 12 | 12 | |
| 13 | 13 | $input = $_POST; |
| 14 | -foreach($input as $k => $v) { |
|
| 15 | - if($k !== 'comment') { |
|
| 14 | +foreach ($input as $k => $v) { |
|
| 15 | + if ($k !== 'comment') { |
|
| 16 | 16 | $v = sanitize($v); |
| 17 | 17 | } |
| 18 | 18 | $input[$k] = $v; |
@@ -50,41 +50,41 @@ discard block |
||
| 50 | 50 | $user_groups = $input['user_groups']; |
| 51 | 51 | |
| 52 | 52 | // verify password |
| 53 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
| 53 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
| 54 | 54 | webAlertAndQuit("Password typed is mismatched"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // verify email |
| 58 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
| 58 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
| 59 | 59 | webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -switch($input['mode']) { |
|
| 62 | +switch ($input['mode']) { |
|
| 63 | 63 | case '87' : // new user |
| 64 | 64 | // check if this user name already exist |
| 65 | 65 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
| 66 | 66 | $limit = $modx->db->getValue($rs); |
| 67 | - if($limit > 0) { |
|
| 67 | + if ($limit > 0) { |
|
| 68 | 68 | webAlertAndQuit("User name is already in use!"); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // check if the email address already exist |
| 72 | 72 | $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
| 73 | 73 | $limit = $modx->db->getValue($rs); |
| 74 | - if($limit > 0) { |
|
| 74 | + if ($limit > 0) { |
|
| 75 | 75 | webAlertAndQuit("Email is already in use!"); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // generate a new password for this user |
| 79 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 80 | - if(strlen($specifiedpassword) < 6) { |
|
| 79 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 80 | + if (strlen($specifiedpassword) < 6) { |
|
| 81 | 81 | webAlertAndQuit("Password is too short!"); |
| 82 | 82 | } else { |
| 83 | 83 | $newpassword = $specifiedpassword; |
| 84 | 84 | } |
| 85 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 85 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 86 | 86 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 87 | - } elseif($passwordgenmethod == 'g') { |
|
| 87 | + } elseif ($passwordgenmethod == 'g') { |
|
| 88 | 88 | $newpassword = generate_password(8); |
| 89 | 89 | } else { |
| 90 | 90 | webAlertAndQuit("No password generation method specified!"); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | /*******************************************************************************/ |
| 115 | 115 | // put the user in the user_groups he/ she should be in |
| 116 | 116 | // first, check that up_perms are switched on! |
| 117 | - if($use_udperms == 1) { |
|
| 118 | - if(!empty($user_groups)) { |
|
| 119 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 117 | + if ($use_udperms == 1) { |
|
| 118 | + if (!empty($user_groups)) { |
|
| 119 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 120 | 120 | $f = array(); |
| 121 | 121 | $f['webgroup'] = intval($user_groups[$i]); |
| 122 | 122 | $f['webuser'] = $internalKey; |
@@ -142,20 +142,20 @@ discard block |
||
| 142 | 142 | "id" => $internalKey |
| 143 | 143 | )); |
| 144 | 144 | |
| 145 | - if($passwordnotifymethod == 'e') { |
|
| 145 | + if ($passwordnotifymethod == 'e') { |
|
| 146 | 146 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 147 | - if($input['stay'] != '') { |
|
| 147 | + if ($input['stay'] != '') { |
|
| 148 | 148 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
| 149 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 149 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 150 | 150 | header($header); |
| 151 | 151 | } else { |
| 152 | 152 | $header = "Location: index.php?a=99&r=2"; |
| 153 | 153 | header($header); |
| 154 | 154 | } |
| 155 | 155 | } else { |
| 156 | - if($input['stay'] != '') { |
|
| 156 | + if ($input['stay'] != '') { |
|
| 157 | 157 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
| 158 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 158 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 159 | 159 | } else { |
| 160 | 160 | $stayUrl = "index.php?a=99&r=2"; |
| 161 | 161 | } |
@@ -188,36 +188,36 @@ discard block |
||
| 188 | 188 | break; |
| 189 | 189 | case '88' : // edit user |
| 190 | 190 | // generate a new password for this user |
| 191 | - if($genpassword == 1) { |
|
| 192 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 193 | - if(strlen($specifiedpassword) < 6) { |
|
| 191 | + if ($genpassword == 1) { |
|
| 192 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 193 | + if (strlen($specifiedpassword) < 6) { |
|
| 194 | 194 | webAlertAndQuit("Password is too short!"); |
| 195 | 195 | } else { |
| 196 | 196 | $newpassword = $specifiedpassword; |
| 197 | 197 | } |
| 198 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 198 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 199 | 199 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 200 | - } elseif($passwordgenmethod == 'g') { |
|
| 200 | + } elseif ($passwordgenmethod == 'g') { |
|
| 201 | 201 | $newpassword = generate_password(8); |
| 202 | 202 | } else { |
| 203 | 203 | webAlertAndQuit("No password generation method specified!"); |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | - if($passwordnotifymethod == 'e') { |
|
| 206 | + if ($passwordnotifymethod == 'e') { |
|
| 207 | 207 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // check if the username already exist |
| 211 | 211 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
| 212 | 212 | $limit = $modx->db->getValue($rs); |
| 213 | - if($limit > 0) { |
|
| 213 | + if ($limit > 0) { |
|
| 214 | 214 | webAlertAndQuit("User name is already in use!"); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // check if the email address already exists |
| 218 | 218 | $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
| 219 | 219 | $limit = $modx->db->getValue($rs); |
| 220 | - if($limit > 0) { |
|
| 220 | + if ($limit > 0) { |
|
| 221 | 221 | webAlertAndQuit("Email is already in use!"); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | // update user name and password |
| 231 | 231 | $field = array(); |
| 232 | 232 | $field['username'] = $esc_newusername; |
| 233 | - if($genpassword == 1) { |
|
| 233 | + if ($genpassword == 1) { |
|
| 234 | 234 | $field['password'] = md5($newpassword); |
| 235 | 235 | } |
| 236 | 236 | $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | /*******************************************************************************/ |
| 248 | 248 | // put the user in the user_groups he/ she should be in |
| 249 | 249 | // first, check that up_perms are switched on! |
| 250 | - if($use_udperms == 1) { |
|
| 250 | + if ($use_udperms == 1) { |
|
| 251 | 251 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
| 252 | 252 | $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
| 253 | - if(!empty($user_groups)) { |
|
| 254 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 253 | + if (!empty($user_groups)) { |
|
| 254 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 255 | 255 | $field = array(); |
| 256 | 256 | $field['webgroup'] = intval($user_groups[$i]); |
| 257 | 257 | $field['webuser'] = $id; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | )); |
| 276 | 276 | |
| 277 | 277 | // invoke OnWebChangePassword event |
| 278 | - if($genpassword == 1) { |
|
| 278 | + if ($genpassword == 1) { |
|
| 279 | 279 | $modx->invokeEvent("OnWebChangePassword", array( |
| 280 | 280 | "userid" => $id, |
| 281 | 281 | "username" => $newusername, |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | "id" => $id |
| 290 | 290 | )); |
| 291 | 291 | |
| 292 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 293 | - if($input['stay'] != '') { |
|
| 292 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 293 | + if ($input['stay'] != '') { |
|
| 294 | 294 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
| 295 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 295 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 296 | 296 | } else { |
| 297 | 297 | $stayUrl = "index.php?a=99&r=2"; |
| 298 | 298 | } |
@@ -320,9 +320,9 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | include_once "footer.inc.php"; |
| 322 | 322 | } else { |
| 323 | - if($input['stay'] != '') { |
|
| 323 | + if ($input['stay'] != '') { |
|
| 324 | 324 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
| 325 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 325 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 326 | 326 | header($header); |
| 327 | 327 | } else { |
| 328 | 328 | $header = "Location: index.php?a=99&r=2"; |
@@ -335,19 +335,19 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | // in case any plugins include a quoted_printable function |
| 338 | -function save_user_quoted_printable($string) { |
|
| 338 | +function save_user_quoted_printable($string){ |
|
| 339 | 339 | $crlf = "\n"; |
| 340 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 340 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf; |
|
| 341 | 341 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
| 342 | 342 | $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
| 343 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 344 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 343 | + $f[] = '/([\011\040])'.$crlf.'/e'; |
|
| 344 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'"; |
|
| 345 | 345 | $string = preg_replace($f, $r, $string); |
| 346 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 346 | + return trim(wordwrap($string, 70, ' ='.$crlf)); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | // Send an email to the user |
| 350 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
| 350 | +function sendMailMessage($email, $uid, $pwd, $ufn){ |
|
| 351 | 351 | global $modx, $_lang, $websignupemail_message; |
| 352 | 352 | global $emailsubject, $emailsender; |
| 353 | 353 | global $site_name, $site_url; |
@@ -368,14 +368,14 @@ discard block |
||
| 368 | 368 | $param['to'] = $email; |
| 369 | 369 | $param['type'] = 'text'; |
| 370 | 370 | $rs = $modx->sendmail($param); |
| 371 | - if(!$rs) { |
|
| 371 | + if (!$rs) { |
|
| 372 | 372 | $modx->manager->saveFormValues(); |
| 373 | 373 | $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // Save User Settings |
| 378 | -function saveUserSettings($id) { |
|
| 378 | +function saveUserSettings($id){ |
|
| 379 | 379 | global $modx; |
| 380 | 380 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
| 381 | 381 | |
@@ -387,12 +387,12 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
| 389 | 389 | |
| 390 | - foreach($settings as $n) { |
|
| 390 | + foreach ($settings as $n) { |
|
| 391 | 391 | $vl = $_POST[$n]; |
| 392 | - if(is_array($vl)) { |
|
| 392 | + if (is_array($vl)) { |
|
| 393 | 393 | $vl = implode(",", $vl); |
| 394 | 394 | } |
| 395 | - if($vl != '') { |
|
| 395 | + if ($vl != '') { |
|
| 396 | 396 | $f = array(); |
| 397 | 397 | $f['webuser'] = $id; |
| 398 | 398 | $f['setting_name'] = $n; |
@@ -404,33 +404,33 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | // Web alert - sends an alert to web browser |
| 407 | -function webAlertAndQuit($msg) { |
|
| 407 | +function webAlertAndQuit($msg){ |
|
| 408 | 408 | global $id, $modx; |
| 409 | 409 | $mode = $_POST['mode']; |
| 410 | 410 | $modx->manager->saveFormValues($mode); |
| 411 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 411 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : '')); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | // Generate password |
| 415 | -function generate_password($length = 10) { |
|
| 415 | +function generate_password($length = 10){ |
|
| 416 | 416 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
| 417 | 417 | $ps_len = strlen($allowable_characters); |
| 418 | 418 | mt_srand((double) microtime() * 1000000); |
| 419 | 419 | $pass = ""; |
| 420 | - for($i = 0; $i < $length; $i++) { |
|
| 420 | + for ($i = 0; $i < $length; $i++) { |
|
| 421 | 421 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
| 422 | 422 | } |
| 423 | 423 | return $pass; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | -function sanitize($str = '', $safecount = 0) { |
|
| 426 | +function sanitize($str = '', $safecount = 0){ |
|
| 427 | 427 | global $modx; |
| 428 | 428 | $safecount++; |
| 429 | - if(1000 < $safecount) { |
|
| 429 | + if (1000 < $safecount) { |
|
| 430 | 430 | exit("error too many loops '{$safecount}'"); |
| 431 | 431 | } |
| 432 | - if(is_array($str)) { |
|
| 433 | - foreach($str as $i => $v) { |
|
| 432 | + if (is_array($str)) { |
|
| 433 | + foreach ($str as $i => $v) { |
|
| 434 | 434 | $str[$i] = sanitize($v, $safecount); |
| 435 | 435 | } |
| 436 | 436 | } else { |
@@ -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('edit_template')) { |
|
| 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('edit_template')) { |
|
| 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_tmplvars'), "id='{$id}'")); |
| 14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "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 TV |
@@ -54,5 +54,5 @@ discard block |
||
| 54 | 54 | $_SESSION['itemname'] = $name; |
| 55 | 55 | |
| 56 | 56 | // finish duplicating - redirect to new variable |
| 57 | -$header="Location: index.php?r=2&a=301&id=$newid"; |
|
| 57 | +$header = "Location: index.php?r=2&a=301&id=$newid"; |
|
| 58 | 58 | header($header); |
@@ -1,14 +1,14 @@ 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('delete_eventlog')) { |
|
| 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('delete_eventlog')) { |
|
| 4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if (isset($_GET['cls']) && $_GET['cls']==1) { |
|
| 7 | +if (isset($_GET['cls']) && $_GET['cls'] == 1) { |
|
| 8 | 8 | $where = ''; |
| 9 | 9 | } else { |
| 10 | - $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
| 11 | - if($id==0) { |
|
| 10 | + $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
| 11 | + if ($id == 0) { |
|
| 12 | 12 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 13 | 13 | } |
| 14 | 14 | $where = "id='{$id}'"; |
@@ -17,5 +17,5 @@ discard block |
||
| 17 | 17 | // delete event log |
| 18 | 18 | $modx->db->delete($modx->getFullTableName('event_log'), $where); |
| 19 | 19 | |
| 20 | -$header="Location: index.php?a=114"; |
|
| 20 | +$header = "Location: index.php?a=114"; |
|
| 21 | 21 | header($header); |