@@ -268,6 +268,7 @@ discard block |
||
| 268 | 268 | /** |
| 269 | 269 | * @name: delete |
| 270 | 270 | * |
| 271 | + * @param string $from |
|
| 271 | 272 | */ |
| 272 | 273 | public function delete($from, $where = '', $orderby = '', $limit = '') |
| 273 | 274 | { |
@@ -414,6 +415,9 @@ discard block |
||
| 414 | 415 | } |
| 415 | 416 | } |
| 416 | 417 | |
| 418 | + /** |
|
| 419 | + * @param string $table |
|
| 420 | + */ |
|
| 417 | 421 | public function save($fields, $table, $where = '') |
| 418 | 422 | { |
| 419 | 423 | |
@@ -444,6 +448,7 @@ discard block |
||
| 444 | 448 | /** |
| 445 | 449 | * @name: freeResult |
| 446 | 450 | * |
| 451 | + * @param mysqli_result $rs |
|
| 447 | 452 | */ |
| 448 | 453 | public function freeResult($rs) |
| 449 | 454 | { |
@@ -554,6 +559,7 @@ discard block |
||
| 554 | 559 | * @name: getColumn |
| 555 | 560 | * @desc: returns an array of the values found on colun $name |
| 556 | 561 | * @param: $dsq - dataset or query string |
| 562 | + * @param string $name |
|
| 557 | 563 | */ |
| 558 | 564 | public function getColumn($name, $dsq) |
| 559 | 565 | { |
@@ -720,6 +726,9 @@ discard block |
||
| 720 | 726 | return $result; |
| 721 | 727 | } |
| 722 | 728 | |
| 729 | + /** |
|
| 730 | + * @param string $table_name |
|
| 731 | + */ |
|
| 723 | 732 | public function optimize($table_name) |
| 724 | 733 | { |
| 725 | 734 | $rs = $this->query("OPTIMIZE TABLE {$table_name}"); |
@@ -730,6 +739,9 @@ discard block |
||
| 730 | 739 | return $rs; |
| 731 | 740 | } |
| 732 | 741 | |
| 742 | + /** |
|
| 743 | + * @param string $table_name |
|
| 744 | + */ |
|
| 733 | 745 | public function truncate($table_name) |
| 734 | 746 | { |
| 735 | 747 | $rs = $this->query("TRUNCATE {$table_name}"); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @param string $param |
| 174 | 174 | * @param array $tvsArray |
| 175 | - * @return mixed |
|
| 175 | + * @return string |
|
| 176 | 176 | */ |
| 177 | 177 | function parseTvValues($param, $tvsArray) |
| 178 | 178 | { |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | /** |
| 567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
| 568 | 568 | * |
| 569 | - * @param $src |
|
| 569 | + * @param string $src |
|
| 570 | 570 | * @param string $delim |
| 571 | 571 | * @param string $type |
| 572 | 572 | * @param bool $columns |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | |
| 1023 | 1023 | if (! function_exists('ParseIntputOptions')) { |
| 1024 | 1024 | /** |
| 1025 | - * @param string|array|mysqli_result $v |
|
| 1025 | + * @param string $v |
|
| 1026 | 1026 | * @return array |
| 1027 | 1027 | */ |
| 1028 | 1028 | function ParseIntputOptions($v) |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * @return mixed |
|
| 66 | + * @return string |
|
| 67 | 67 | */ |
| 68 | 68 | public function getOutput() |
| 69 | 69 | { |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * @param int $flags |
| 11 | 11 | * @param string $encode |
| 12 | 12 | * @param int $safecount |
| 13 | - * @return string|array |
|
| 13 | + * @return null|string |
|
| 14 | 14 | */ |
| 15 | 15 | public function htmlspecialchars($str = '', $flags = ENT_COMPAT, $encode = '', $safecount = 0) |
| 16 | 16 | { |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | if(!function_exists('removeLastPath')) { |
| 746 | 746 | /** |
| 747 | 747 | * @param string $string |
| 748 | - * @return bool|string |
|
| 748 | + * @return string|false |
|
| 749 | 749 | */ |
| 750 | 750 | function removeLastPath($string) |
| 751 | 751 | { |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | if(!function_exists('getExtension')) { |
| 764 | 764 | /** |
| 765 | 765 | * @param string $string |
| 766 | - * @return bool|string |
|
| 766 | + * @return string|false |
|
| 767 | 767 | */ |
| 768 | 768 | function getExtension($string) |
| 769 | 769 | { |
@@ -357,7 +357,7 @@ |
||
| 357 | 357 | if(!function_exists('getFileContent')) { |
| 358 | 358 | /** |
| 359 | 359 | * @param string $filepath |
| 360 | - * @return bool|string |
|
| 360 | + * @return null|string |
|
| 361 | 361 | */ |
| 362 | 362 | function getFileContent($filepath) |
| 363 | 363 | { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
| 267 | 267 | * $extname - extension name in lowercase |
| 268 | 268 | * |
| 269 | - * @param $extname |
|
| 269 | + * @param string $extname |
|
| 270 | 270 | * @param bool $reload |
| 271 | 271 | * @return bool |
| 272 | 272 | */ |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param int $count_attempts |
| 310 | 310 | * @param string $type $type |
| 311 | 311 | * @param string $responseCode |
| 312 | - * @return bool|null |
|
| 312 | + * @return false|null |
|
| 313 | 313 | * @global string $base_url |
| 314 | 314 | * @global string $site_url |
| 315 | 315 | */ |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | /** |
| 1013 | - * @param $contents |
|
| 1013 | + * @param string $contents |
|
| 1014 | 1014 | * @return mixed |
| 1015 | 1015 | */ |
| 1016 | 1016 | public function RecoveryEscapedTags($contents) |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | /** |
| 1037 | - * @param $tstart |
|
| 1037 | + * @param double $tstart |
|
| 1038 | 1038 | * @return array |
| 1039 | 1039 | */ |
| 1040 | 1040 | public function getTimerStats($tstart) |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | |
| 1801 | 1801 | /** |
| 1802 | 1802 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
| 1803 | - * @param $content |
|
| 1803 | + * @param string $content |
|
| 1804 | 1804 | * @param string $left |
| 1805 | 1805 | * @param string $right |
| 1806 | 1806 | * @return mixed |
@@ -1973,7 +1973,7 @@ discard block |
||
| 1973 | 1973 | /** |
| 1974 | 1974 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
| 1975 | 1975 | * |
| 1976 | - * @param $content |
|
| 1976 | + * @param string $content |
|
| 1977 | 1977 | * @return string |
| 1978 | 1978 | * @internal param string $documentSource |
| 1979 | 1979 | */ |
@@ -3008,7 +3008,7 @@ discard block |
||
| 3008 | 3008 | |
| 3009 | 3009 | /** |
| 3010 | 3010 | * @param $templateID |
| 3011 | - * @return mixed |
|
| 3011 | + * @return string |
|
| 3012 | 3012 | */ |
| 3013 | 3013 | public function _getTemplateCodeFromDB($templateID) |
| 3014 | 3014 | { |
@@ -3051,7 +3051,7 @@ discard block |
||
| 3051 | 3051 | /** |
| 3052 | 3052 | * @param $id |
| 3053 | 3053 | * @param int $top |
| 3054 | - * @return mixed |
|
| 3054 | + * @return string |
|
| 3055 | 3055 | */ |
| 3056 | 3056 | public function getUltimateParentId($id, $top = 0) |
| 3057 | 3057 | { |
@@ -3391,7 +3391,7 @@ discard block |
||
| 3391 | 3391 | * |
| 3392 | 3392 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3393 | 3393 | * @param int $id Element- / Resource-id |
| 3394 | - * @return bool |
|
| 3394 | + * @return false|null |
|
| 3395 | 3395 | */ |
| 3396 | 3396 | public function lockElement($type, $id) |
| 3397 | 3397 | { |
@@ -3413,7 +3413,7 @@ discard block |
||
| 3413 | 3413 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
| 3414 | 3414 | * @param int $id Element- / Resource-id |
| 3415 | 3415 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
| 3416 | - * @return bool |
|
| 3416 | + * @return false|null |
|
| 3417 | 3417 | */ |
| 3418 | 3418 | public function unlockElement($type, $id, $includeAllUsers = false) |
| 3419 | 3419 | { |
@@ -3927,7 +3927,7 @@ discard block |
||
| 3927 | 3927 | * Default: 1 |
| 3928 | 3928 | * @param string $fields List of fields |
| 3929 | 3929 | * Default: id, pagetitle, description, alias |
| 3930 | - * @return boolean|array |
|
| 3930 | + * @return string |
|
| 3931 | 3931 | */ |
| 3932 | 3932 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
| 3933 | 3933 | { |
@@ -4019,7 +4019,7 @@ discard block |
||
| 4019 | 4019 | * |
| 4020 | 4020 | * @param string $type |
| 4021 | 4021 | * @param bool $report |
| 4022 | - * @return bool |
|
| 4022 | + * @return boolean|null |
|
| 4023 | 4023 | */ |
| 4024 | 4024 | public function clearCache($type = '', $report = false) |
| 4025 | 4025 | { |
@@ -4385,7 +4385,7 @@ discard block |
||
| 4385 | 4385 | * - Placeholders prefix. Default: '{'. |
| 4386 | 4386 | * @param string $suffix {string} |
| 4387 | 4387 | * - Placeholders suffix. Default: '}'. |
| 4388 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
| 4388 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
| 4389 | 4389 | * - Parsed chunk or false if $chunkArr is not array. |
| 4390 | 4390 | */ |
| 4391 | 4391 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5357,7 +5357,7 @@ discard block |
||
| 5357 | 5357 | * Remove event listener - only for use within the current execution cycle |
| 5358 | 5358 | * |
| 5359 | 5359 | * @param string $evtName |
| 5360 | - * @return boolean |
|
| 5360 | + * @return false|null |
|
| 5361 | 5361 | */ |
| 5362 | 5362 | public function removeEventListener($evtName) |
| 5363 | 5363 | { |
@@ -5381,7 +5381,7 @@ discard block |
||
| 5381 | 5381 | * |
| 5382 | 5382 | * @param string $evtName |
| 5383 | 5383 | * @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. |
| 5384 | - * @return boolean|array |
|
| 5384 | + * @return false|null |
|
| 5385 | 5385 | */ |
| 5386 | 5386 | public function invokeEvent($evtName, $extParams = array()) |
| 5387 | 5387 | { |
@@ -5976,7 +5976,7 @@ discard block |
||
| 5976 | 5976 | |
| 5977 | 5977 | /** |
| 5978 | 5978 | * @param string $str |
| 5979 | - * @return bool|mixed|string |
|
| 5979 | + * @return string |
|
| 5980 | 5980 | */ |
| 5981 | 5981 | public function atBindFileContent($str = '') |
| 5982 | 5982 | { |
@@ -6027,8 +6027,8 @@ discard block |
||
| 6027 | 6027 | } |
| 6028 | 6028 | |
| 6029 | 6029 | /** |
| 6030 | - * @param $str |
|
| 6031 | - * @return bool|string |
|
| 6030 | + * @param string $str |
|
| 6031 | + * @return false|string |
|
| 6032 | 6032 | */ |
| 6033 | 6033 | public function getExtFromFilename($str) |
| 6034 | 6034 | { |
@@ -6056,7 +6056,7 @@ discard block |
||
| 6056 | 6056 | * @param string $text Error message |
| 6057 | 6057 | * @param string $file File where the error was detected |
| 6058 | 6058 | * @param string $line Line number within $file |
| 6059 | - * @return boolean |
|
| 6059 | + * @return boolean|null |
|
| 6060 | 6060 | */ |
| 6061 | 6061 | public function phpError($nr, $text, $file, $line) |
| 6062 | 6062 | { |
@@ -6108,7 +6108,7 @@ discard block |
||
| 6108 | 6108 | * @param string $text |
| 6109 | 6109 | * @param string $line |
| 6110 | 6110 | * @param string $output |
| 6111 | - * @return bool |
|
| 6111 | + * @return null|boolean |
|
| 6112 | 6112 | */ |
| 6113 | 6113 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
| 6114 | 6114 | { |
@@ -6523,7 +6523,7 @@ discard block |
||
| 6523 | 6523 | |
| 6524 | 6524 | /** |
| 6525 | 6525 | * @param string $str |
| 6526 | - * @return bool|mixed|string |
|
| 6526 | + * @return string |
|
| 6527 | 6527 | */ |
| 6528 | 6528 | public function atBindInclude($str = '') |
| 6529 | 6529 | { |
@@ -6574,7 +6574,7 @@ discard block |
||
| 6574 | 6574 | * @param $str |
| 6575 | 6575 | * @param int $flags |
| 6576 | 6576 | * @param string $encode |
| 6577 | - * @return mixed |
|
| 6577 | + * @return null|string |
|
| 6578 | 6578 | */ |
| 6579 | 6579 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
| 6580 | 6580 | { |
@@ -6583,7 +6583,7 @@ discard block |
||
| 6583 | 6583 | } |
| 6584 | 6584 | |
| 6585 | 6585 | /** |
| 6586 | - * @param $string |
|
| 6586 | + * @param string $string |
|
| 6587 | 6587 | * @param bool $returnData |
| 6588 | 6588 | * @return bool|mixed |
| 6589 | 6589 | */ |
@@ -33,113 +33,113 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | switch ($_POST['mode']) { |
| 36 | - case '19': |
|
| 37 | - |
|
| 38 | - // invoke OnBeforeTempFormSave event |
|
| 39 | - $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 40 | - "mode" => "new", |
|
| 41 | - "id" => $id |
|
| 42 | - )); |
|
| 43 | - |
|
| 44 | - // disallow duplicate names for new templates |
|
| 45 | - $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'"); |
|
| 46 | - $count = $modx->db->getValue($rs); |
|
| 47 | - if ($count > 0) { |
|
| 48 | - $modx->manager->saveFormValues(19); |
|
| 49 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19"); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - //do stuff to save the new doc |
|
| 53 | - $newid = $modx->db->insert(array( |
|
| 54 | - 'templatename' => $templatename, |
|
| 55 | - 'description' => $description, |
|
| 56 | - 'content' => $template, |
|
| 57 | - 'locked' => $locked, |
|
| 58 | - 'selectable' => $selectable, |
|
| 59 | - 'category' => $categoryid, |
|
| 60 | - 'createdon' => $currentdate, |
|
| 61 | - 'editedon' => $currentdate |
|
| 62 | - ), $modx->getFullTableName('site_templates')); |
|
| 63 | - |
|
| 64 | - // invoke OnTempFormSave event |
|
| 65 | - $modx->invokeEvent("OnTempFormSave", array( |
|
| 66 | - "mode" => "new", |
|
| 67 | - "id" => $newid |
|
| 68 | - )); |
|
| 69 | - // Set new assigned Tvs |
|
| 70 | - saveTemplateAccess($newid); |
|
| 71 | - |
|
| 72 | - // Set the item name for logger |
|
| 73 | - $_SESSION['itemname'] = $templatename; |
|
| 74 | - |
|
| 75 | - // empty cache |
|
| 76 | - $modx->clearCache('full'); |
|
| 77 | - |
|
| 78 | - // finished emptying cache - redirect |
|
| 79 | - if ($_POST['stay'] != '') { |
|
| 80 | - $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
|
| 81 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 82 | - header($header); |
|
| 83 | - } else { |
|
| 84 | - $header = "Location: index.php?a=76&r=2"; |
|
| 85 | - header($header); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - break; |
|
| 89 | - case '16': |
|
| 90 | - |
|
| 91 | - // invoke OnBeforeTempFormSave event |
|
| 92 | - $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 93 | - "mode" => "upd", |
|
| 94 | - "id" => $id |
|
| 95 | - )); |
|
| 96 | - |
|
| 97 | - // disallow duplicate names for templates |
|
| 98 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'"); |
|
| 99 | - $count = $modx->db->getValue($rs); |
|
| 100 | - if ($count > 0) { |
|
| 101 | - $modx->manager->saveFormValues(16); |
|
| 102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}"); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - //do stuff to save the edited doc |
|
| 106 | - $modx->db->update(array( |
|
| 107 | - 'templatename' => $templatename, |
|
| 108 | - 'description' => $description, |
|
| 109 | - 'content' => $template, |
|
| 110 | - 'locked' => $locked, |
|
| 111 | - 'selectable' => $selectable, |
|
| 112 | - 'category' => $categoryid, |
|
| 113 | - 'editedon' => $currentdate |
|
| 114 | - ), $modx->getFullTableName('site_templates'), "id='{$id}'"); |
|
| 115 | - // Set new assigned Tvs |
|
| 116 | - saveTemplateAccess($id); |
|
| 117 | - |
|
| 118 | - // invoke OnTempFormSave event |
|
| 119 | - $modx->invokeEvent("OnTempFormSave", array( |
|
| 120 | - "mode" => "upd", |
|
| 121 | - "id" => $id |
|
| 122 | - )); |
|
| 123 | - |
|
| 124 | - // Set the item name for logger |
|
| 125 | - $_SESSION['itemname'] = $templatename; |
|
| 126 | - |
|
| 127 | - // first empty the cache |
|
| 128 | - $modx->clearCache('full'); |
|
| 129 | - |
|
| 130 | - // finished emptying cache - redirect |
|
| 131 | - if ($_POST['stay'] != '') { |
|
| 132 | - $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
|
| 133 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 134 | - header($header); |
|
| 135 | - } else { |
|
| 136 | - $modx->unlockElement(1, $id); |
|
| 137 | - $header = "Location: index.php?a=76&r=2"; |
|
| 138 | - header($header); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - |
|
| 142 | - break; |
|
| 143 | - default: |
|
| 144 | - $modx->webAlertAndQuit("No operation set in request."); |
|
| 36 | + case '19': |
|
| 37 | + |
|
| 38 | + // invoke OnBeforeTempFormSave event |
|
| 39 | + $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 40 | + "mode" => "new", |
|
| 41 | + "id" => $id |
|
| 42 | + )); |
|
| 43 | + |
|
| 44 | + // disallow duplicate names for new templates |
|
| 45 | + $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'"); |
|
| 46 | + $count = $modx->db->getValue($rs); |
|
| 47 | + if ($count > 0) { |
|
| 48 | + $modx->manager->saveFormValues(19); |
|
| 49 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19"); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + //do stuff to save the new doc |
|
| 53 | + $newid = $modx->db->insert(array( |
|
| 54 | + 'templatename' => $templatename, |
|
| 55 | + 'description' => $description, |
|
| 56 | + 'content' => $template, |
|
| 57 | + 'locked' => $locked, |
|
| 58 | + 'selectable' => $selectable, |
|
| 59 | + 'category' => $categoryid, |
|
| 60 | + 'createdon' => $currentdate, |
|
| 61 | + 'editedon' => $currentdate |
|
| 62 | + ), $modx->getFullTableName('site_templates')); |
|
| 63 | + |
|
| 64 | + // invoke OnTempFormSave event |
|
| 65 | + $modx->invokeEvent("OnTempFormSave", array( |
|
| 66 | + "mode" => "new", |
|
| 67 | + "id" => $newid |
|
| 68 | + )); |
|
| 69 | + // Set new assigned Tvs |
|
| 70 | + saveTemplateAccess($newid); |
|
| 71 | + |
|
| 72 | + // Set the item name for logger |
|
| 73 | + $_SESSION['itemname'] = $templatename; |
|
| 74 | + |
|
| 75 | + // empty cache |
|
| 76 | + $modx->clearCache('full'); |
|
| 77 | + |
|
| 78 | + // finished emptying cache - redirect |
|
| 79 | + if ($_POST['stay'] != '') { |
|
| 80 | + $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
|
| 81 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 82 | + header($header); |
|
| 83 | + } else { |
|
| 84 | + $header = "Location: index.php?a=76&r=2"; |
|
| 85 | + header($header); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + break; |
|
| 89 | + case '16': |
|
| 90 | + |
|
| 91 | + // invoke OnBeforeTempFormSave event |
|
| 92 | + $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
| 93 | + "mode" => "upd", |
|
| 94 | + "id" => $id |
|
| 95 | + )); |
|
| 96 | + |
|
| 97 | + // disallow duplicate names for templates |
|
| 98 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'"); |
|
| 99 | + $count = $modx->db->getValue($rs); |
|
| 100 | + if ($count > 0) { |
|
| 101 | + $modx->manager->saveFormValues(16); |
|
| 102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}"); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + //do stuff to save the edited doc |
|
| 106 | + $modx->db->update(array( |
|
| 107 | + 'templatename' => $templatename, |
|
| 108 | + 'description' => $description, |
|
| 109 | + 'content' => $template, |
|
| 110 | + 'locked' => $locked, |
|
| 111 | + 'selectable' => $selectable, |
|
| 112 | + 'category' => $categoryid, |
|
| 113 | + 'editedon' => $currentdate |
|
| 114 | + ), $modx->getFullTableName('site_templates'), "id='{$id}'"); |
|
| 115 | + // Set new assigned Tvs |
|
| 116 | + saveTemplateAccess($id); |
|
| 117 | + |
|
| 118 | + // invoke OnTempFormSave event |
|
| 119 | + $modx->invokeEvent("OnTempFormSave", array( |
|
| 120 | + "mode" => "upd", |
|
| 121 | + "id" => $id |
|
| 122 | + )); |
|
| 123 | + |
|
| 124 | + // Set the item name for logger |
|
| 125 | + $_SESSION['itemname'] = $templatename; |
|
| 126 | + |
|
| 127 | + // first empty the cache |
|
| 128 | + $modx->clearCache('full'); |
|
| 129 | + |
|
| 130 | + // finished emptying cache - redirect |
|
| 131 | + if ($_POST['stay'] != '') { |
|
| 132 | + $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
|
| 133 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 134 | + header($header); |
|
| 135 | + } else { |
|
| 136 | + $modx->unlockElement(1, $id); |
|
| 137 | + $header = "Location: index.php?a=76&r=2"; |
|
| 138 | + header($header); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + |
|
| 142 | + break; |
|
| 143 | + default: |
|
| 144 | + $modx->webAlertAndQuit("No operation set in request."); |
|
| 145 | 145 | } |
@@ -69,110 +69,110 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | switch($input['mode']) { |
| 72 | - case '11' : // new user |
|
| 73 | - // check if this user name already exist |
|
| 74 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
| 75 | - $limit = $modx->db->getValue($rs); |
|
| 76 | - if($limit > 0) { |
|
| 77 | - webAlertAndQuit("User name is already in use!", 12); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // check if the email address already exist |
|
| 81 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
| 82 | - $limit = $modx->db->getValue($rs); |
|
| 83 | - if($limit > 0) { |
|
| 84 | - webAlertAndQuit("Email is already in use!", 12); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // generate a new password for this user |
|
| 88 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 89 | - if(strlen($specifiedpassword) < 6) { |
|
| 90 | - webAlertAndQuit("Password is too short!", 12); |
|
| 91 | - } else { |
|
| 92 | - $newpassword = $specifiedpassword; |
|
| 93 | - } |
|
| 94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 95 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 96 | - } elseif($passwordgenmethod == 'g') { |
|
| 97 | - $newpassword = generate_password(8); |
|
| 98 | - } else { |
|
| 99 | - webAlertAndQuit("No password generation method specified!", 12); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - // invoke OnBeforeUserFormSave event |
|
| 103 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 104 | - "mode" => "new", |
|
| 105 | - )); |
|
| 106 | - |
|
| 107 | - // create the user account |
|
| 108 | - $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
| 109 | - |
|
| 110 | - $field = array(); |
|
| 111 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 112 | - $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
| 113 | - |
|
| 114 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 115 | - $field = $modx->db->escape($field); |
|
| 116 | - $modx->db->insert($field, $tbl_user_attributes); |
|
| 117 | - |
|
| 118 | - // Save user settings |
|
| 119 | - saveManagerUserSettings($internalKey); |
|
| 120 | - |
|
| 121 | - // invoke OnManagerSaveUser event |
|
| 122 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 123 | - "mode" => "new", |
|
| 124 | - "userid" => $internalKey, |
|
| 125 | - "username" => $newusername, |
|
| 126 | - "userpassword" => $newpassword, |
|
| 127 | - "useremail" => $email, |
|
| 128 | - "userfullname" => $fullname, |
|
| 129 | - "userroleid" => $role |
|
| 130 | - )); |
|
| 131 | - |
|
| 132 | - // invoke OnUserFormSave event |
|
| 133 | - $modx->invokeEvent("OnUserFormSave", array( |
|
| 134 | - "mode" => "new", |
|
| 135 | - "id" => $internalKey |
|
| 136 | - )); |
|
| 137 | - |
|
| 138 | - // Set the item name for logger |
|
| 139 | - $_SESSION['itemname'] = $newusername; |
|
| 140 | - |
|
| 141 | - /*******************************************************************************/ |
|
| 142 | - // put the user in the user_groups he/ she should be in |
|
| 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++) { |
|
| 147 | - $f = array(); |
|
| 148 | - $f['user_group'] = (int)$user_groups[$i]; |
|
| 149 | - $f['member'] = $internalKey; |
|
| 150 | - $modx->db->insert($f, $tbl_member_groups); |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - // end of user_groups stuff! |
|
| 155 | - |
|
| 156 | - if($passwordnotifymethod == 'e') { |
|
| 157 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 158 | - if($input['stay'] != '') { |
|
| 159 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 160 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | - header($header); |
|
| 162 | - } else { |
|
| 163 | - $header = "Location: index.php?a=75&r=2"; |
|
| 164 | - header($header); |
|
| 165 | - } |
|
| 166 | - } else { |
|
| 167 | - if($input['stay'] != '') { |
|
| 168 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 169 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 170 | - } else { |
|
| 171 | - $stayUrl = "index.php?a=75&r=2"; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - include_once "header.inc.php"; |
|
| 175 | - ?> |
|
| 72 | + case '11' : // new user |
|
| 73 | + // check if this user name already exist |
|
| 74 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
| 75 | + $limit = $modx->db->getValue($rs); |
|
| 76 | + if($limit > 0) { |
|
| 77 | + webAlertAndQuit("User name is already in use!", 12); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // check if the email address already exist |
|
| 81 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
| 82 | + $limit = $modx->db->getValue($rs); |
|
| 83 | + if($limit > 0) { |
|
| 84 | + webAlertAndQuit("Email is already in use!", 12); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // generate a new password for this user |
|
| 88 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 89 | + if(strlen($specifiedpassword) < 6) { |
|
| 90 | + webAlertAndQuit("Password is too short!", 12); |
|
| 91 | + } else { |
|
| 92 | + $newpassword = $specifiedpassword; |
|
| 93 | + } |
|
| 94 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 95 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 96 | + } elseif($passwordgenmethod == 'g') { |
|
| 97 | + $newpassword = generate_password(8); |
|
| 98 | + } else { |
|
| 99 | + webAlertAndQuit("No password generation method specified!", 12); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + // invoke OnBeforeUserFormSave event |
|
| 103 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 104 | + "mode" => "new", |
|
| 105 | + )); |
|
| 106 | + |
|
| 107 | + // create the user account |
|
| 108 | + $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
| 109 | + |
|
| 110 | + $field = array(); |
|
| 111 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 112 | + $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
| 113 | + |
|
| 114 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 115 | + $field = $modx->db->escape($field); |
|
| 116 | + $modx->db->insert($field, $tbl_user_attributes); |
|
| 117 | + |
|
| 118 | + // Save user settings |
|
| 119 | + saveManagerUserSettings($internalKey); |
|
| 120 | + |
|
| 121 | + // invoke OnManagerSaveUser event |
|
| 122 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 123 | + "mode" => "new", |
|
| 124 | + "userid" => $internalKey, |
|
| 125 | + "username" => $newusername, |
|
| 126 | + "userpassword" => $newpassword, |
|
| 127 | + "useremail" => $email, |
|
| 128 | + "userfullname" => $fullname, |
|
| 129 | + "userroleid" => $role |
|
| 130 | + )); |
|
| 131 | + |
|
| 132 | + // invoke OnUserFormSave event |
|
| 133 | + $modx->invokeEvent("OnUserFormSave", array( |
|
| 134 | + "mode" => "new", |
|
| 135 | + "id" => $internalKey |
|
| 136 | + )); |
|
| 137 | + |
|
| 138 | + // Set the item name for logger |
|
| 139 | + $_SESSION['itemname'] = $newusername; |
|
| 140 | + |
|
| 141 | + /*******************************************************************************/ |
|
| 142 | + // put the user in the user_groups he/ she should be in |
|
| 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++) { |
|
| 147 | + $f = array(); |
|
| 148 | + $f['user_group'] = (int)$user_groups[$i]; |
|
| 149 | + $f['member'] = $internalKey; |
|
| 150 | + $modx->db->insert($f, $tbl_member_groups); |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + // end of user_groups stuff! |
|
| 155 | + |
|
| 156 | + if($passwordnotifymethod == 'e') { |
|
| 157 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 158 | + if($input['stay'] != '') { |
|
| 159 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 160 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | + header($header); |
|
| 162 | + } else { |
|
| 163 | + $header = "Location: index.php?a=75&r=2"; |
|
| 164 | + header($header); |
|
| 165 | + } |
|
| 166 | + } else { |
|
| 167 | + if($input['stay'] != '') { |
|
| 168 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 169 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 170 | + } else { |
|
| 171 | + $stayUrl = "index.php?a=75&r=2"; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + include_once "header.inc.php"; |
|
| 175 | + ?> |
|
| 176 | 176 | |
| 177 | 177 | <h1><?php echo $_lang['user_title']; ?></h1> |
| 178 | 178 | |
@@ -194,125 +194,125 @@ discard block |
||
| 194 | 194 | </div> |
| 195 | 195 | <?php |
| 196 | 196 | |
| 197 | - include_once "footer.inc.php"; |
|
| 198 | - } |
|
| 199 | - break; |
|
| 200 | - case '12' : // edit user |
|
| 201 | - // generate a new password for this user |
|
| 202 | - if($genpassword == 1) { |
|
| 203 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 204 | - if(strlen($specifiedpassword) < 6) { |
|
| 205 | - webAlertAndQuit("Password is too short!", 12); |
|
| 206 | - } else { |
|
| 207 | - $newpassword = $specifiedpassword; |
|
| 208 | - } |
|
| 209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 210 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 211 | - } elseif($passwordgenmethod == 'g') { |
|
| 212 | - $newpassword = generate_password(8); |
|
| 213 | - } else { |
|
| 214 | - webAlertAndQuit("No password generation method specified!", 12); |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - if($passwordnotifymethod == 'e') { |
|
| 218 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - // check if the username already exist |
|
| 222 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
| 223 | - $limit = $modx->db->getValue($rs); |
|
| 224 | - if($limit > 0) { |
|
| 225 | - webAlertAndQuit("User name is already in use!", 12); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // check if the email address already exists |
|
| 229 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
| 230 | - $limit = $modx->db->getValue($rs); |
|
| 231 | - if($limit > 0) { |
|
| 232 | - webAlertAndQuit("Email is already in use!", 12); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // invoke OnBeforeUserFormSave event |
|
| 236 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 237 | - "mode" => "upd", |
|
| 238 | - "id" => $id |
|
| 239 | - )); |
|
| 240 | - |
|
| 241 | - // update user name and password |
|
| 242 | - $field = array(); |
|
| 243 | - $field['username'] = $modx->db->escape($newusername); |
|
| 244 | - if($genpassword == 1) { |
|
| 245 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 246 | - } |
|
| 247 | - $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
| 248 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 249 | - $field = $modx->db->escape($field); |
|
| 250 | - $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
| 251 | - |
|
| 252 | - // Save user settings |
|
| 253 | - saveManagerUserSettings($id); |
|
| 254 | - |
|
| 255 | - // Set the item name for logger |
|
| 256 | - $_SESSION['itemname'] = $newusername; |
|
| 257 | - |
|
| 258 | - // invoke OnManagerSaveUser event |
|
| 259 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 260 | - "mode" => "upd", |
|
| 261 | - "userid" => $id, |
|
| 262 | - "username" => $newusername, |
|
| 263 | - "userpassword" => $newpassword, |
|
| 264 | - "useremail" => $email, |
|
| 265 | - "userfullname" => $fullname, |
|
| 266 | - "userroleid" => $role, |
|
| 267 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 268 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 269 | - )); |
|
| 270 | - |
|
| 271 | - // invoke OnManagerChangePassword event |
|
| 272 | - if($genpassword == 1) { |
|
| 273 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
| 274 | - "userid" => $id, |
|
| 275 | - "username" => $newusername, |
|
| 276 | - "userpassword" => $newpassword |
|
| 277 | - )); |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - // invoke OnUserFormSave event |
|
| 281 | - $modx->invokeEvent("OnUserFormSave", array( |
|
| 282 | - "mode" => "upd", |
|
| 283 | - "id" => $id |
|
| 284 | - )); |
|
| 285 | - |
|
| 286 | - /*******************************************************************************/ |
|
| 287 | - // put the user in the user_groups he/ she should be in |
|
| 288 | - // first, check that up_perms are switched on! |
|
| 289 | - if($use_udperms == 1) { |
|
| 290 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 291 | - $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
| 292 | - if(!empty($user_groups)) { |
|
| 293 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 294 | - $field = array(); |
|
| 295 | - $field['user_group'] = (int)$user_groups[$i]; |
|
| 296 | - $field['member'] = $id; |
|
| 297 | - $modx->db->insert($field, $tbl_member_groups); |
|
| 298 | - } |
|
| 299 | - } |
|
| 300 | - } |
|
| 301 | - // end of user_groups stuff! |
|
| 302 | - /*******************************************************************************/ |
|
| 303 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
| 304 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
| 305 | - } |
|
| 306 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 307 | - if($input['stay'] != '') { |
|
| 308 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 309 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 310 | - } else { |
|
| 311 | - $stayUrl = "index.php?a=75&r=2"; |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - include_once "header.inc.php"; |
|
| 315 | - ?> |
|
| 197 | + include_once "footer.inc.php"; |
|
| 198 | + } |
|
| 199 | + break; |
|
| 200 | + case '12' : // edit user |
|
| 201 | + // generate a new password for this user |
|
| 202 | + if($genpassword == 1) { |
|
| 203 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 204 | + if(strlen($specifiedpassword) < 6) { |
|
| 205 | + webAlertAndQuit("Password is too short!", 12); |
|
| 206 | + } else { |
|
| 207 | + $newpassword = $specifiedpassword; |
|
| 208 | + } |
|
| 209 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 210 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 211 | + } elseif($passwordgenmethod == 'g') { |
|
| 212 | + $newpassword = generate_password(8); |
|
| 213 | + } else { |
|
| 214 | + webAlertAndQuit("No password generation method specified!", 12); |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + if($passwordnotifymethod == 'e') { |
|
| 218 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + // check if the username already exist |
|
| 222 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
| 223 | + $limit = $modx->db->getValue($rs); |
|
| 224 | + if($limit > 0) { |
|
| 225 | + webAlertAndQuit("User name is already in use!", 12); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // check if the email address already exists |
|
| 229 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
| 230 | + $limit = $modx->db->getValue($rs); |
|
| 231 | + if($limit > 0) { |
|
| 232 | + webAlertAndQuit("Email is already in use!", 12); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // invoke OnBeforeUserFormSave event |
|
| 236 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 237 | + "mode" => "upd", |
|
| 238 | + "id" => $id |
|
| 239 | + )); |
|
| 240 | + |
|
| 241 | + // update user name and password |
|
| 242 | + $field = array(); |
|
| 243 | + $field['username'] = $modx->db->escape($newusername); |
|
| 244 | + if($genpassword == 1) { |
|
| 245 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 246 | + } |
|
| 247 | + $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
| 248 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 249 | + $field = $modx->db->escape($field); |
|
| 250 | + $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
| 251 | + |
|
| 252 | + // Save user settings |
|
| 253 | + saveManagerUserSettings($id); |
|
| 254 | + |
|
| 255 | + // Set the item name for logger |
|
| 256 | + $_SESSION['itemname'] = $newusername; |
|
| 257 | + |
|
| 258 | + // invoke OnManagerSaveUser event |
|
| 259 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 260 | + "mode" => "upd", |
|
| 261 | + "userid" => $id, |
|
| 262 | + "username" => $newusername, |
|
| 263 | + "userpassword" => $newpassword, |
|
| 264 | + "useremail" => $email, |
|
| 265 | + "userfullname" => $fullname, |
|
| 266 | + "userroleid" => $role, |
|
| 267 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 268 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 269 | + )); |
|
| 270 | + |
|
| 271 | + // invoke OnManagerChangePassword event |
|
| 272 | + if($genpassword == 1) { |
|
| 273 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
| 274 | + "userid" => $id, |
|
| 275 | + "username" => $newusername, |
|
| 276 | + "userpassword" => $newpassword |
|
| 277 | + )); |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + // invoke OnUserFormSave event |
|
| 281 | + $modx->invokeEvent("OnUserFormSave", array( |
|
| 282 | + "mode" => "upd", |
|
| 283 | + "id" => $id |
|
| 284 | + )); |
|
| 285 | + |
|
| 286 | + /*******************************************************************************/ |
|
| 287 | + // put the user in the user_groups he/ she should be in |
|
| 288 | + // first, check that up_perms are switched on! |
|
| 289 | + if($use_udperms == 1) { |
|
| 290 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 291 | + $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
| 292 | + if(!empty($user_groups)) { |
|
| 293 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 294 | + $field = array(); |
|
| 295 | + $field['user_group'] = (int)$user_groups[$i]; |
|
| 296 | + $field['member'] = $id; |
|
| 297 | + $modx->db->insert($field, $tbl_member_groups); |
|
| 298 | + } |
|
| 299 | + } |
|
| 300 | + } |
|
| 301 | + // end of user_groups stuff! |
|
| 302 | + /*******************************************************************************/ |
|
| 303 | + if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
| 304 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
| 305 | + } |
|
| 306 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 307 | + if($input['stay'] != '') { |
|
| 308 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 309 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 310 | + } else { |
|
| 311 | + $stayUrl = "index.php?a=75&r=2"; |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + include_once "header.inc.php"; |
|
| 315 | + ?> |
|
| 316 | 316 | |
| 317 | 317 | <h1><?php echo $_lang['user_title']; ?></h1> |
| 318 | 318 | |
@@ -332,18 +332,18 @@ discard block |
||
| 332 | 332 | </div> |
| 333 | 333 | <?php |
| 334 | 334 | |
| 335 | - include_once "footer.inc.php"; |
|
| 336 | - } else { |
|
| 337 | - if($input['stay'] != '') { |
|
| 338 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 339 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 340 | - header($header); |
|
| 341 | - } else { |
|
| 342 | - $header = "Location: index.php?a=75&r=2"; |
|
| 343 | - header($header); |
|
| 344 | - } |
|
| 345 | - } |
|
| 346 | - break; |
|
| 347 | - default: |
|
| 348 | - webAlertAndQuit("No operation set in request.", 12); |
|
| 335 | + include_once "footer.inc.php"; |
|
| 336 | + } else { |
|
| 337 | + if($input['stay'] != '') { |
|
| 338 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 339 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 340 | + header($header); |
|
| 341 | + } else { |
|
| 342 | + $header = "Location: index.php?a=75&r=2"; |
|
| 343 | + header($header); |
|
| 344 | + } |
|
| 345 | + } |
|
| 346 | + break; |
|
| 347 | + default: |
|
| 348 | + webAlertAndQuit("No operation set in request.", 12); |
|
| 349 | 349 | } |