@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | -class DATEPICKER { |
|
| 3 | - function __construct() { |
|
| 2 | +class DATEPICKER{ |
|
| 3 | + function __construct(){ |
|
| 4 | 4 | } |
| 5 | - function getDP() { |
|
| 5 | + function getDP(){ |
|
| 6 | 6 | $modx = evolutionCMS(); global$_lang; |
| 7 | 7 | |
| 8 | 8 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
| 9 | - return $modx->parseText($tpl,$_lang,'[%','%]'); |
|
| 9 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 10 | 10 | } |
| 11 | 11 | } |
@@ -1,8 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | -class DATEPICKER { |
|
| 3 | - function __construct() { |
|
| 2 | +class DATEPICKER |
|
| 3 | +{ |
|
| 4 | + function __construct() |
|
| 5 | + { |
|
| 4 | 6 | } |
| 5 | - function getDP() { |
|
| 7 | + function getDP() |
|
| 8 | + { |
|
| 6 | 9 | $modx = evolutionCMS(); global$_lang; |
| 7 | 10 | |
| 8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('delete_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************ webber ********/ |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | 34 | if(!$udperms->checkPermissions()) { |
| 35 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 35 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // get the timestamp on which the document was deleted. |
| 39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
| 40 | 40 | $deltime = $modx->db->getValue($rs); |
| 41 | 41 | if(!$deltime) { |
| 42 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
| 42 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $children = array(); |
@@ -49,36 +49,36 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function getChildren($parent) { |
| 51 | 51 | |
| 52 | - $modx = evolutionCMS(); |
|
| 53 | - global $children; |
|
| 54 | - global $deltime; |
|
| 55 | - |
|
| 56 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
| 57 | - // the document has children documents, we'll need to delete those too |
|
| 58 | - while ($row=$modx->db->getRow($rs)) { |
|
| 59 | - $children[] = $row['id']; |
|
| 60 | - getChildren($row['id']); |
|
| 61 | - //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
| 62 | - } |
|
| 52 | + $modx = evolutionCMS(); |
|
| 53 | + global $children; |
|
| 54 | + global $deltime; |
|
| 55 | + |
|
| 56 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
| 57 | + // the document has children documents, we'll need to delete those too |
|
| 58 | + while ($row=$modx->db->getRow($rs)) { |
|
| 59 | + $children[] = $row['id']; |
|
| 60 | + getChildren($row['id']); |
|
| 61 | + //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
| 62 | + } |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | getChildren($id); |
| 66 | 66 | |
| 67 | 67 | if(count($children)>0) { |
| 68 | - $modx->db->update( |
|
| 69 | - array( |
|
| 70 | - 'deleted' => 0, |
|
| 71 | - 'deletedby' => 0, |
|
| 72 | - 'deletedon' => 0, |
|
| 73 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
| 68 | + $modx->db->update( |
|
| 69 | + array( |
|
| 70 | + 'deleted' => 0, |
|
| 71 | + 'deletedby' => 0, |
|
| 72 | + 'deletedon' => 0, |
|
| 73 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
| 74 | 74 | } |
| 75 | 75 | //'undelete' the document. |
| 76 | 76 | $modx->db->update( |
| 77 | - array( |
|
| 78 | - 'deleted' => 0, |
|
| 79 | - 'deletedby' => 0, |
|
| 80 | - 'deletedon' => 0, |
|
| 81 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
| 77 | + array( |
|
| 78 | + 'deleted' => 0, |
|
| 79 | + 'deletedby' => 0, |
|
| 80 | + 'deletedon' => 0, |
|
| 81 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
| 82 | 82 | |
| 83 | 83 | $modx->invokeEvent("OnDocFormUnDelete", |
| 84 | 84 | array( |
@@ -1,44 +1,44 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('delete_document')) { |
|
| 5 | +if (!$modx->hasPermission('delete_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************ webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | // check permissions on the document |
| 28 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 28 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 29 | 29 | $udperms = new udperms(); |
| 30 | 30 | $udperms->user = $modx->getLoginUserID(); |
| 31 | 31 | $udperms->document = $id; |
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | -if(!$udperms->checkPermissions()) { |
|
| 34 | +if (!$udperms->checkPermissions()) { |
|
| 35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // get the timestamp on which the document was deleted. |
| 39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
| 40 | 40 | $deltime = $modx->db->getValue($rs); |
| 41 | -if(!$deltime) { |
|
| 41 | +if (!$deltime) { |
|
| 42 | 42 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * @param int $parent |
| 49 | 49 | */ |
| 50 | -function getChildren($parent) { |
|
| 50 | +function getChildren($parent){ |
|
| 51 | 51 | |
| 52 | 52 | $modx = evolutionCMS(); |
| 53 | 53 | global $children; |
| 54 | 54 | global $deltime; |
| 55 | 55 | |
| 56 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
| 56 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'"); |
|
| 57 | 57 | // the document has children documents, we'll need to delete those too |
| 58 | - while ($row=$modx->db->getRow($rs)) { |
|
| 58 | + while ($row = $modx->db->getRow($rs)) { |
|
| 59 | 59 | $children[] = $row['id']; |
| 60 | 60 | getChildren($row['id']); |
| 61 | 61 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | getChildren($id); |
| 66 | 66 | |
| 67 | -if(count($children)>0) { |
|
| 67 | +if (count($children) > 0) { |
|
| 68 | 68 | $modx->db->update( |
| 69 | 69 | array( |
| 70 | 70 | 'deleted' => 0, |
@@ -93,5 +93,5 @@ discard block |
||
| 93 | 93 | $modx->clearCache('full'); |
| 94 | 94 | |
| 95 | 95 | // finished emptying cache - redirect |
| 96 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 96 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 97 | 97 | header($header); |
@@ -47,7 +47,8 @@ |
||
| 47 | 47 | /** |
| 48 | 48 | * @param int $parent |
| 49 | 49 | */ |
| 50 | -function getChildren($parent) { |
|
| 50 | +function getChildren($parent) |
|
| 51 | +{ |
|
| 51 | 52 | |
| 52 | 53 | $modx = evolutionCMS(); |
| 53 | 54 | global $children; |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
| 4 | 4 | } |
| 5 | 5 | if (!$modx->hasPermission('save_plugin')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang['error_no_privileges']); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
| 11 | 11 | $description = $modx->db->escape($_POST['description']); |
| 12 | 12 | $locked = $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | //Kyle Jaebker - added category support |
| 22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 23 | - $categoryid = (int)$_POST['categoryid']; |
|
| 23 | + $categoryid = (int) $_POST['categoryid']; |
|
| 24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 25 | 25 | $categoryid = 0; |
| 26 | 26 | } else { |
| 27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
| 41 | 41 | |
| 42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 44 | 44 | if ($version) { |
| 45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($parsed['modx_category'])) { |
| 48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | // finished emptying cache - redirect |
| 104 | 104 | if ($_POST['stay'] != '') { |
| 105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
| 106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
| 106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
| 107 | 107 | header($header); |
| 108 | 108 | } else { |
| 109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // finished emptying cache - redirect |
| 159 | 159 | if ($_POST['stay'] != '') { |
| 160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
| 161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
| 161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
| 162 | 162 | header($header); |
| 163 | 163 | } else { |
| 164 | 164 | $modx->unlockElement(5, $id); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // save selected system events |
| 178 | 178 | $formEventList = array(); |
| 179 | 179 | foreach ($sysevents as $evtId) { |
| 180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
| 180 | + if (!preg_match('@^[1-9][0-9]*$@', $evtId)) $evtId = getEventIdByName($evtId); |
|
| 181 | 181 | if ($mode == '101') { |
| 182 | 182 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
| 183 | 183 | } else { |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | $rs = $modx->db->select('*', '[+prefix+]site_plugin_events', sprintf("pluginid='%s'", $id)); |
| 203 | 203 | $dbEventList = array(); |
| 204 | 204 | $del = array(); |
| 205 | - while($row = $modx->db->getRow($rs)) { |
|
| 206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 205 | + while ($row = $modx->db->getRow($rs)) { |
|
| 206 | + if (!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if(empty($del)) return; |
|
| 209 | + if (empty($del)) return; |
|
| 210 | 210 | |
| 211 | - foreach($del as $delid) { |
|
| 211 | + foreach ($del as $delid) { |
|
| 212 | 212 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | function getEventIdByName($name) |
| 221 | 221 | { |
| 222 | 222 | $modx = evolutionCMS(); |
| 223 | - static $eventIds=array(); |
|
| 223 | + static $eventIds = array(); |
|
| 224 | 224 | |
| 225 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
| 225 | + if (isset($eventIds[$name])) return $eventIds[$name]; |
|
| 226 | 226 | |
| 227 | 227 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
| 228 | 228 | while ($row = $modx->db->getRow($rs)) { |
@@ -177,7 +177,9 @@ discard block |
||
| 177 | 177 | // save selected system events |
| 178 | 178 | $formEventList = array(); |
| 179 | 179 | foreach ($sysevents as $evtId) { |
| 180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
| 180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
| 181 | + $evtId = getEventIdByName($evtId); |
|
| 182 | + } |
|
| 181 | 183 | if ($mode == '101') { |
| 182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
| 183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
| 203 | 205 | $dbEventList = array(); |
| 204 | 206 | $del = array(); |
| 205 | 207 | while($row = $modx->db->getRow($rs)) { |
| 206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 208 | + if(!in_array($row['evtid'], $evtids)) { |
|
| 209 | + $del[] = $row['evtid']; |
|
| 210 | + } |
|
| 207 | 211 | } |
| 208 | 212 | |
| 209 | - if(empty($del)) return; |
|
| 213 | + if(empty($del)) { |
|
| 214 | + return; |
|
| 215 | + } |
|
| 210 | 216 | |
| 211 | 217 | foreach($del as $delid) { |
| 212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -222,7 +228,9 @@ discard block |
||
| 222 | 228 | $modx = evolutionCMS(); |
| 223 | 229 | static $eventIds=array(); |
| 224 | 230 | |
| 225 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
| 231 | + if(isset($eventIds[$name])) { |
|
| 232 | + return $eventIds[$name]; |
|
| 233 | + } |
|
| 226 | 234 | |
| 227 | 235 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
| 228 | 236 | while ($row = $modx->db->getRow($rs)) { |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('edit_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | // check user has permission to move document to chosen location |
| 26 | 26 | |
| 27 | 27 | if ($use_udperms == 1) { |
| 28 | - if ($oldparent != $newParentID) { |
|
| 29 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 30 | - $udperms = new udperms(); |
|
| 31 | - $udperms->user = $modx->getLoginUserID(); |
|
| 32 | - $udperms->document = $newParentID; |
|
| 33 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 34 | - |
|
| 35 | - if (!$udperms->checkPermissions()) { |
|
| 36 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
| 37 | - } |
|
| 38 | - } |
|
| 28 | + if ($oldparent != $newParentID) { |
|
| 29 | + include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 30 | + $udperms = new udperms(); |
|
| 31 | + $udperms->user = $modx->getLoginUserID(); |
|
| 32 | + $udperms->document = $newParentID; |
|
| 33 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 34 | + |
|
| 35 | + if (!$udperms->checkPermissions()) { |
|
| 36 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -43,67 +43,67 @@ discard block |
||
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | 45 | function allChildren($currDocID) { |
| 46 | - $modx = evolutionCMS(); |
|
| 47 | - $children= array(); |
|
| 48 | - $currDocID = $modx->db->escape($currDocID); |
|
| 49 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
|
| 50 | - while ($child= $modx->db->getRow($rs)) { |
|
| 51 | - $children[]= $child['id']; |
|
| 52 | - $children= array_merge($children, allChildren($child['id'])); |
|
| 53 | - } |
|
| 54 | - return $children; |
|
| 46 | + $modx = evolutionCMS(); |
|
| 47 | + $children= array(); |
|
| 48 | + $currDocID = $modx->db->escape($currDocID); |
|
| 49 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
|
| 50 | + while ($child= $modx->db->getRow($rs)) { |
|
| 51 | + $children[]= $child['id']; |
|
| 52 | + $children= array_merge($children, allChildren($child['id'])); |
|
| 53 | + } |
|
| 54 | + return $children; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
| 58 | - "id_document" => $documentID, |
|
| 59 | - "old_parent" => $oldparent, |
|
| 60 | - "new_parent" => $newParentID |
|
| 58 | + "id_document" => $documentID, |
|
| 59 | + "old_parent" => $oldparent, |
|
| 60 | + "new_parent" => $newParentID |
|
| 61 | 61 | )); |
| 62 | 62 | if (is_array($evtOut) && count($evtOut) > 0){ |
| 63 | - $newParent = array_pop($evtOut); |
|
| 64 | - if($newParent == $oldparent) { |
|
| 65 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 66 | - }else{ |
|
| 67 | - $newParentID = $newParent; |
|
| 68 | - } |
|
| 63 | + $newParent = array_pop($evtOut); |
|
| 64 | + if($newParent == $oldparent) { |
|
| 65 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 66 | + }else{ |
|
| 67 | + $newParentID = $newParent; |
|
| 68 | + } |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $children = allChildren($documentID); |
| 72 | 72 | if (!array_search($newParentID, $children)) { |
| 73 | - $modx->db->update(array( |
|
| 74 | - 'isfolder' => 1, |
|
| 75 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
| 76 | - |
|
| 77 | - $modx->db->update(array( |
|
| 78 | - 'parent' => $newParentID, |
|
| 79 | - 'editedby' => $modx->getLoginUserID(), |
|
| 80 | - 'editedon' => time(), |
|
| 81 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
| 82 | - |
|
| 83 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
| 84 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
| 85 | - $limit = $modx->db->getValue($rs); |
|
| 86 | - |
|
| 87 | - if(!$limit>0) { |
|
| 88 | - $modx->db->update(array( |
|
| 89 | - 'isfolder' => 0, |
|
| 90 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
| 91 | - } |
|
| 92 | - // Set the item name for logger |
|
| 93 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
| 94 | - $_SESSION['itemname'] = $pagetitle; |
|
| 95 | - |
|
| 96 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
| 97 | - "id_document" => $documentID, |
|
| 98 | - "old_parent" => $oldparent, |
|
| 99 | - "new_parent" => $newParentID |
|
| 100 | - )); |
|
| 101 | - |
|
| 102 | - // empty cache & sync site |
|
| 103 | - $modx->clearCache('full'); |
|
| 104 | - |
|
| 105 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 106 | - header($header); |
|
| 73 | + $modx->db->update(array( |
|
| 74 | + 'isfolder' => 1, |
|
| 75 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
| 76 | + |
|
| 77 | + $modx->db->update(array( |
|
| 78 | + 'parent' => $newParentID, |
|
| 79 | + 'editedby' => $modx->getLoginUserID(), |
|
| 80 | + 'editedon' => time(), |
|
| 81 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
| 82 | + |
|
| 83 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
| 84 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
| 85 | + $limit = $modx->db->getValue($rs); |
|
| 86 | + |
|
| 87 | + if(!$limit>0) { |
|
| 88 | + $modx->db->update(array( |
|
| 89 | + 'isfolder' => 0, |
|
| 90 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
| 91 | + } |
|
| 92 | + // Set the item name for logger |
|
| 93 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
| 94 | + $_SESSION['itemname'] = $pagetitle; |
|
| 95 | + |
|
| 96 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
| 97 | + "id_document" => $documentID, |
|
| 98 | + "old_parent" => $oldparent, |
|
| 99 | + "new_parent" => $newParentID |
|
| 100 | + )); |
|
| 101 | + |
|
| 102 | + // empty cache & sync site |
|
| 103 | + $modx->clearCache('full'); |
|
| 104 | + |
|
| 105 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 106 | + header($header); |
|
| 107 | 107 | } else { |
| 108 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
| 108 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
| 109 | 109 | } |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('edit_document')) { |
|
| 5 | +if (!$modx->hasPermission('edit_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
| 10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
| 10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 11 | 11 | |
| 12 | 12 | // ok, two things to check. |
| 13 | 13 | // first, document cannot be moved to itself |
| 14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
| 15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 15 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 18 | 18 | |
| 19 | 19 | $parents = $modx->getParentIds($newParentID); |
| 20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | if ($use_udperms == 1) { |
| 28 | 28 | if ($oldparent != $newParentID) { |
| 29 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 29 | + include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 30 | 30 | $udperms = new udperms(); |
| 31 | 31 | $udperms->user = $modx->getLoginUserID(); |
| 32 | 32 | $udperms->document = $newParentID; |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | * @param int $currDocID |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | -function allChildren($currDocID) { |
|
| 45 | +function allChildren($currDocID){ |
|
| 46 | 46 | $modx = evolutionCMS(); |
| 47 | - $children= array(); |
|
| 47 | + $children = array(); |
|
| 48 | 48 | $currDocID = $modx->db->escape($currDocID); |
| 49 | 49 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
| 50 | - while ($child= $modx->db->getRow($rs)) { |
|
| 51 | - $children[]= $child['id']; |
|
| 52 | - $children= array_merge($children, allChildren($child['id'])); |
|
| 50 | + while ($child = $modx->db->getRow($rs)) { |
|
| 51 | + $children[] = $child['id']; |
|
| 52 | + $children = array_merge($children, allChildren($child['id'])); |
|
| 53 | 53 | } |
| 54 | 54 | return $children; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
| 57 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
| 58 | 58 | "id_document" => $documentID, |
| 59 | 59 | "old_parent" => $oldparent, |
| 60 | 60 | "new_parent" => $newParentID |
| 61 | 61 | )); |
| 62 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 62 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 63 | 63 | $newParent = array_pop($evtOut); |
| 64 | - if($newParent == $oldparent) { |
|
| 64 | + if ($newParent == $oldparent) { |
|
| 65 | 65 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
| 66 | - }else{ |
|
| 66 | + } else { |
|
| 67 | 67 | $newParentID = $newParent; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
| 85 | 85 | $limit = $modx->db->getValue($rs); |
| 86 | 86 | |
| 87 | - if(!$limit>0) { |
|
| 87 | + if (!$limit > 0) { |
|
| 88 | 88 | $modx->db->update(array( |
| 89 | 89 | 'isfolder' => 0, |
| 90 | 90 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
| 94 | 94 | $_SESSION['itemname'] = $pagetitle; |
| 95 | 95 | |
| 96 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
| 96 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
| 97 | 97 | "id_document" => $documentID, |
| 98 | 98 | "old_parent" => $oldparent, |
| 99 | 99 | "new_parent" => $newParentID |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | // empty cache & sync site |
| 103 | 103 | $modx->clearCache('full'); |
| 104 | 104 | |
| 105 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 105 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 106 | 106 | header($header); |
| 107 | 107 | } else { |
| 108 | 108 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
@@ -12,12 +12,20 @@ discard block |
||
| 12 | 12 | // ok, two things to check. |
| 13 | 13 | // first, document cannot be moved to itself |
| 14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
| 15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 15 | +if($documentID==$newParentID) { |
|
| 16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 17 | +} |
|
| 18 | +if($documentID <= 0) { |
|
| 19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 20 | +} |
|
| 21 | +if($newParentID < 0) { |
|
| 22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 23 | +} |
|
| 18 | 24 | |
| 19 | 25 | $parents = $modx->getParentIds($newParentID); |
| 20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 26 | +if (in_array($documentID, $parents)) { |
|
| 27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 28 | +} |
|
| 21 | 29 | |
| 22 | 30 | $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
| 23 | 31 | $oldparent = $modx->db->getValue($rs); |
@@ -42,7 +50,8 @@ discard block |
||
| 42 | 50 | * @param int $currDocID |
| 43 | 51 | * @return array |
| 44 | 52 | */ |
| 45 | -function allChildren($currDocID) { |
|
| 53 | +function allChildren($currDocID) |
|
| 54 | +{ |
|
| 46 | 55 | $modx = evolutionCMS(); |
| 47 | 56 | $children= array(); |
| 48 | 57 | $currDocID = $modx->db->escape($currDocID); |
@@ -59,11 +68,11 @@ discard block |
||
| 59 | 68 | "old_parent" => $oldparent, |
| 60 | 69 | "new_parent" => $newParentID |
| 61 | 70 | )); |
| 62 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 71 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 63 | 72 | $newParent = array_pop($evtOut); |
| 64 | 73 | if($newParent == $oldparent) { |
| 65 | 74 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
| 66 | - }else{ |
|
| 75 | + } else { |
|
| 67 | 76 | $newParentID = $newParent; |
| 68 | 77 | } |
| 69 | 78 | } |
@@ -340,7 +340,8 @@ discard block |
||
| 340 | 340 | * @param string $string |
| 341 | 341 | * @return string |
| 342 | 342 | */ |
| 343 | -function save_user_quoted_printable($string) { |
|
| 343 | +function save_user_quoted_printable($string) |
|
| 344 | +{ |
|
| 344 | 345 | $crlf = "\n"; |
| 345 | 346 | $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
| 346 | 347 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
@@ -359,7 +360,8 @@ discard block |
||
| 359 | 360 | * @param string $pwd |
| 360 | 361 | * @param string $ufn |
| 361 | 362 | */ |
| 362 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
| 363 | +function sendMailMessage($email, $uid, $pwd, $ufn) |
|
| 364 | +{ |
|
| 363 | 365 | $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
| 364 | 366 | global $emailsubject, $emailsender; |
| 365 | 367 | global $site_name, $site_url; |
@@ -387,7 +389,8 @@ discard block |
||
| 387 | 389 | } |
| 388 | 390 | |
| 389 | 391 | // Save User Settings |
| 390 | -function saveUserSettings($id) { |
|
| 392 | +function saveUserSettings($id) |
|
| 393 | +{ |
|
| 391 | 394 | $modx = evolutionCMS(); |
| 392 | 395 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
| 393 | 396 | |
@@ -416,7 +419,8 @@ discard block |
||
| 416 | 419 | } |
| 417 | 420 | |
| 418 | 421 | // Web alert - sends an alert to web browser |
| 419 | -function webAlertAndQuit($msg) { |
|
| 422 | +function webAlertAndQuit($msg) |
|
| 423 | +{ |
|
| 420 | 424 | global $id, $modx; |
| 421 | 425 | $mode = $_POST['mode']; |
| 422 | 426 | $modx->manager->saveFormValues($mode); |
@@ -424,7 +428,8 @@ discard block |
||
| 424 | 428 | } |
| 425 | 429 | |
| 426 | 430 | // Generate password |
| 427 | -function generate_password($length = 10) { |
|
| 431 | +function generate_password($length = 10) |
|
| 432 | +{ |
|
| 428 | 433 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
| 429 | 434 | $ps_len = strlen($allowable_characters); |
| 430 | 435 | mt_srand((double) microtime() * 1000000); |
@@ -435,7 +440,8 @@ discard block |
||
| 435 | 440 | return $pass; |
| 436 | 441 | } |
| 437 | 442 | |
| 438 | -function sanitize($str = '', $safecount = 0) { |
|
| 443 | +function sanitize($str = '', $safecount = 0) |
|
| 444 | +{ |
|
| 439 | 445 | $modx = evolutionCMS(); |
| 440 | 446 | $safecount++; |
| 441 | 447 | if(1000 < $safecount) { |
@@ -60,110 +60,110 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | switch($input['mode']) { |
| 63 | - case '87' : // new user |
|
| 64 | - // check if this user name already exist |
|
| 65 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | - $limit = $modx->db->getValue($rs); |
|
| 67 | - if($limit > 0) { |
|
| 68 | - webAlertAndQuit("User name is already in use!"); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // check if the email address already exist |
|
| 72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | - $limit = $modx->db->getValue($rs); |
|
| 75 | - if($limit > 0) { |
|
| 76 | - webAlertAndQuit("Email is already in use!"); |
|
| 77 | - } |
|
| 78 | - } |
|
| 63 | + case '87' : // new user |
|
| 64 | + // check if this user name already exist |
|
| 65 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | + $limit = $modx->db->getValue($rs); |
|
| 67 | + if($limit > 0) { |
|
| 68 | + webAlertAndQuit("User name is already in use!"); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // check if the email address already exist |
|
| 72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | + $limit = $modx->db->getValue($rs); |
|
| 75 | + if($limit > 0) { |
|
| 76 | + webAlertAndQuit("Email is already in use!"); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // generate a new password for this user |
|
| 81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | + if(strlen($specifiedpassword) < 6) { |
|
| 83 | + webAlertAndQuit("Password is too short!"); |
|
| 84 | + } else { |
|
| 85 | + $newpassword = $specifiedpassword; |
|
| 86 | + } |
|
| 87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | + } elseif($passwordgenmethod == 'g') { |
|
| 90 | + $newpassword = generate_password(8); |
|
| 91 | + } else { |
|
| 92 | + webAlertAndQuit("No password generation method specified!"); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + // invoke OnBeforeWUsrFormSave event |
|
| 96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | + "mode" => "new", |
|
| 98 | + )); |
|
| 99 | + |
|
| 100 | + // create the user account |
|
| 101 | + $field = array(); |
|
| 102 | + $field['username'] = $esc_newusername; |
|
| 103 | + $field['password'] = md5($newpassword); |
|
| 104 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | + |
|
| 106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | + $field = $modx->db->escape($field); |
|
| 108 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | + |
|
| 110 | + // Save User Settings |
|
| 111 | + saveUserSettings($internalKey); |
|
| 112 | + |
|
| 113 | + // Set the item name for logger |
|
| 114 | + $_SESSION['itemname'] = $newusername; |
|
| 115 | + |
|
| 116 | + /*******************************************************************************/ |
|
| 117 | + // put the user in the user_groups he/ she should be in |
|
| 118 | + // first, check that up_perms are switched on! |
|
| 119 | + if($use_udperms == 1) { |
|
| 120 | + if(!empty($user_groups)) { |
|
| 121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | + $f = array(); |
|
| 123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | + $f['webuser'] = $internalKey; |
|
| 125 | + $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + // end of user_groups stuff! |
|
| 130 | + |
|
| 131 | + // invoke OnWebSaveUser event |
|
| 132 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
| 133 | + "mode" => "new", |
|
| 134 | + "userid" => $internalKey, |
|
| 135 | + "username" => $newusername, |
|
| 136 | + "userpassword" => $newpassword, |
|
| 137 | + "useremail" => $email, |
|
| 138 | + "userfullname" => $fullname |
|
| 139 | + )); |
|
| 79 | 140 | |
| 80 | - // generate a new password for this user |
|
| 81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | - if(strlen($specifiedpassword) < 6) { |
|
| 83 | - webAlertAndQuit("Password is too short!"); |
|
| 84 | - } else { |
|
| 85 | - $newpassword = $specifiedpassword; |
|
| 86 | - } |
|
| 87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | - } elseif($passwordgenmethod == 'g') { |
|
| 90 | - $newpassword = generate_password(8); |
|
| 91 | - } else { |
|
| 92 | - webAlertAndQuit("No password generation method specified!"); |
|
| 93 | - } |
|
| 141 | + // invoke OnWUsrFormSave event |
|
| 142 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 143 | + "mode" => "new", |
|
| 144 | + "id" => $internalKey |
|
| 145 | + )); |
|
| 94 | 146 | |
| 95 | - // invoke OnBeforeWUsrFormSave event |
|
| 96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | - "mode" => "new", |
|
| 98 | - )); |
|
| 99 | - |
|
| 100 | - // create the user account |
|
| 101 | - $field = array(); |
|
| 102 | - $field['username'] = $esc_newusername; |
|
| 103 | - $field['password'] = md5($newpassword); |
|
| 104 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | - |
|
| 106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | - $field = $modx->db->escape($field); |
|
| 108 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | - |
|
| 110 | - // Save User Settings |
|
| 111 | - saveUserSettings($internalKey); |
|
| 112 | - |
|
| 113 | - // Set the item name for logger |
|
| 114 | - $_SESSION['itemname'] = $newusername; |
|
| 115 | - |
|
| 116 | - /*******************************************************************************/ |
|
| 117 | - // put the user in the user_groups he/ she should be in |
|
| 118 | - // first, check that up_perms are switched on! |
|
| 119 | - if($use_udperms == 1) { |
|
| 120 | - if(!empty($user_groups)) { |
|
| 121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | - $f = array(); |
|
| 123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | - $f['webuser'] = $internalKey; |
|
| 125 | - $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - // end of user_groups stuff! |
|
| 130 | - |
|
| 131 | - // invoke OnWebSaveUser event |
|
| 132 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
| 133 | - "mode" => "new", |
|
| 134 | - "userid" => $internalKey, |
|
| 135 | - "username" => $newusername, |
|
| 136 | - "userpassword" => $newpassword, |
|
| 137 | - "useremail" => $email, |
|
| 138 | - "userfullname" => $fullname |
|
| 139 | - )); |
|
| 140 | - |
|
| 141 | - // invoke OnWUsrFormSave event |
|
| 142 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 143 | - "mode" => "new", |
|
| 144 | - "id" => $internalKey |
|
| 145 | - )); |
|
| 146 | - |
|
| 147 | - if($passwordnotifymethod == 'e') { |
|
| 148 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | - if($input['stay'] != '') { |
|
| 150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | - header($header); |
|
| 153 | - } else { |
|
| 154 | - $header = "Location: index.php?a=99&r=2"; |
|
| 155 | - header($header); |
|
| 156 | - } |
|
| 157 | - } else { |
|
| 158 | - if($input['stay'] != '') { |
|
| 159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | - } else { |
|
| 162 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - include_once "header.inc.php"; |
|
| 166 | - ?> |
|
| 147 | + if($passwordnotifymethod == 'e') { |
|
| 148 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | + if($input['stay'] != '') { |
|
| 150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | + header($header); |
|
| 153 | + } else { |
|
| 154 | + $header = "Location: index.php?a=99&r=2"; |
|
| 155 | + header($header); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + if($input['stay'] != '') { |
|
| 159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | + } else { |
|
| 162 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + include_once "header.inc.php"; |
|
| 166 | + ?> |
|
| 167 | 167 | |
| 168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 169 | 169 | |
@@ -185,124 +185,124 @@ discard block |
||
| 185 | 185 | </div> |
| 186 | 186 | <?php |
| 187 | 187 | |
| 188 | - include_once "footer.inc.php"; |
|
| 189 | - } |
|
| 190 | - break; |
|
| 191 | - case '88' : // edit user |
|
| 192 | - // generate a new password for this user |
|
| 193 | - if($genpassword == 1) { |
|
| 194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | - if(strlen($specifiedpassword) < 6) { |
|
| 196 | - webAlertAndQuit("Password is too short!"); |
|
| 197 | - } else { |
|
| 198 | - $newpassword = $specifiedpassword; |
|
| 199 | - } |
|
| 200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 202 | - } elseif($passwordgenmethod == 'g') { |
|
| 203 | - $newpassword = generate_password(8); |
|
| 204 | - } else { |
|
| 205 | - webAlertAndQuit("No password generation method specified!"); |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - if($passwordnotifymethod == 'e') { |
|
| 209 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - // check if the username already exist |
|
| 213 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 214 | - $limit = $modx->db->getValue($rs); |
|
| 215 | - if($limit > 0) { |
|
| 216 | - webAlertAndQuit("User name is already in use!"); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // check if the email address already exists |
|
| 220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 221 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 222 | - $limit = $modx->db->getValue($rs); |
|
| 223 | - if($limit > 0) { |
|
| 224 | - webAlertAndQuit("Email is already in use!"); |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // invoke OnBeforeWUsrFormSave event |
|
| 229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 230 | - "mode" => "upd", |
|
| 231 | - "id" => $id |
|
| 232 | - )); |
|
| 233 | - |
|
| 234 | - // update user name and password |
|
| 235 | - $field = array(); |
|
| 236 | - $field['username'] = $esc_newusername; |
|
| 237 | - if($genpassword == 1) { |
|
| 238 | - $field['password'] = md5($newpassword); |
|
| 239 | - } |
|
| 240 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 242 | - $field = $modx->db->escape($field); |
|
| 243 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 244 | - |
|
| 245 | - // Save User Settings |
|
| 246 | - saveUserSettings($id); |
|
| 247 | - |
|
| 248 | - // Set the item name for logger |
|
| 249 | - $_SESSION['itemname'] = $newusername; |
|
| 250 | - |
|
| 251 | - /*******************************************************************************/ |
|
| 252 | - // put the user in the user_groups he/ she should be in |
|
| 253 | - // first, check that up_perms are switched on! |
|
| 254 | - if($use_udperms == 1) { |
|
| 255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 256 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 257 | - if(!empty($user_groups)) { |
|
| 258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | - $field = array(); |
|
| 260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
| 261 | - $field['webuser'] = $id; |
|
| 262 | - $modx->db->insert($field, $tbl_web_groups); |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - // end of user_groups stuff! |
|
| 267 | - /*******************************************************************************/ |
|
| 268 | - |
|
| 269 | - // invoke OnWebSaveUser event |
|
| 270 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
| 271 | - "mode" => "upd", |
|
| 272 | - "userid" => $id, |
|
| 273 | - "username" => $newusername, |
|
| 274 | - "userpassword" => $newpassword, |
|
| 275 | - "useremail" => $email, |
|
| 276 | - "userfullname" => $fullname, |
|
| 277 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 278 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 279 | - )); |
|
| 280 | - |
|
| 281 | - // invoke OnWebChangePassword event |
|
| 282 | - if($genpassword == 1) { |
|
| 283 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
| 188 | + include_once "footer.inc.php"; |
|
| 189 | + } |
|
| 190 | + break; |
|
| 191 | + case '88' : // edit user |
|
| 192 | + // generate a new password for this user |
|
| 193 | + if($genpassword == 1) { |
|
| 194 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | + if(strlen($specifiedpassword) < 6) { |
|
| 196 | + webAlertAndQuit("Password is too short!"); |
|
| 197 | + } else { |
|
| 198 | + $newpassword = $specifiedpassword; |
|
| 199 | + } |
|
| 200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 202 | + } elseif($passwordgenmethod == 'g') { |
|
| 203 | + $newpassword = generate_password(8); |
|
| 204 | + } else { |
|
| 205 | + webAlertAndQuit("No password generation method specified!"); |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + if($passwordnotifymethod == 'e') { |
|
| 209 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + // check if the username already exist |
|
| 213 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 214 | + $limit = $modx->db->getValue($rs); |
|
| 215 | + if($limit > 0) { |
|
| 216 | + webAlertAndQuit("User name is already in use!"); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // check if the email address already exists |
|
| 220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 221 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 222 | + $limit = $modx->db->getValue($rs); |
|
| 223 | + if($limit > 0) { |
|
| 224 | + webAlertAndQuit("Email is already in use!"); |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // invoke OnBeforeWUsrFormSave event |
|
| 229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 230 | + "mode" => "upd", |
|
| 231 | + "id" => $id |
|
| 232 | + )); |
|
| 233 | + |
|
| 234 | + // update user name and password |
|
| 235 | + $field = array(); |
|
| 236 | + $field['username'] = $esc_newusername; |
|
| 237 | + if($genpassword == 1) { |
|
| 238 | + $field['password'] = md5($newpassword); |
|
| 239 | + } |
|
| 240 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 242 | + $field = $modx->db->escape($field); |
|
| 243 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 244 | + |
|
| 245 | + // Save User Settings |
|
| 246 | + saveUserSettings($id); |
|
| 247 | + |
|
| 248 | + // Set the item name for logger |
|
| 249 | + $_SESSION['itemname'] = $newusername; |
|
| 250 | + |
|
| 251 | + /*******************************************************************************/ |
|
| 252 | + // put the user in the user_groups he/ she should be in |
|
| 253 | + // first, check that up_perms are switched on! |
|
| 254 | + if($use_udperms == 1) { |
|
| 255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 256 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 257 | + if(!empty($user_groups)) { |
|
| 258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | + $field = array(); |
|
| 260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
| 261 | + $field['webuser'] = $id; |
|
| 262 | + $modx->db->insert($field, $tbl_web_groups); |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + // end of user_groups stuff! |
|
| 267 | + /*******************************************************************************/ |
|
| 268 | + |
|
| 269 | + // invoke OnWebSaveUser event |
|
| 270 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
| 271 | + "mode" => "upd", |
|
| 284 | 272 | "userid" => $id, |
| 285 | 273 | "username" => $newusername, |
| 286 | - "userpassword" => $newpassword |
|
| 274 | + "userpassword" => $newpassword, |
|
| 275 | + "useremail" => $email, |
|
| 276 | + "userfullname" => $fullname, |
|
| 277 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 278 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 287 | 279 | )); |
| 288 | - } |
|
| 289 | 280 | |
| 290 | - // invoke OnWUsrFormSave event |
|
| 291 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 292 | - "mode" => "upd", |
|
| 293 | - "id" => $id |
|
| 294 | - )); |
|
| 281 | + // invoke OnWebChangePassword event |
|
| 282 | + if($genpassword == 1) { |
|
| 283 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
| 284 | + "userid" => $id, |
|
| 285 | + "username" => $newusername, |
|
| 286 | + "userpassword" => $newpassword |
|
| 287 | + )); |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + // invoke OnWUsrFormSave event |
|
| 291 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 292 | + "mode" => "upd", |
|
| 293 | + "id" => $id |
|
| 294 | + )); |
|
| 295 | 295 | |
| 296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | - if($input['stay'] != '') { |
|
| 298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 300 | - } else { |
|
| 301 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 302 | - } |
|
| 296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | + if($input['stay'] != '') { |
|
| 298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 300 | + } else { |
|
| 301 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - include_once "header.inc.php"; |
|
| 305 | - ?> |
|
| 304 | + include_once "header.inc.php"; |
|
| 305 | + ?> |
|
| 306 | 306 | |
| 307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 308 | 308 | |
@@ -322,20 +322,20 @@ discard block |
||
| 322 | 322 | </div> |
| 323 | 323 | <?php |
| 324 | 324 | |
| 325 | - include_once "footer.inc.php"; |
|
| 326 | - } else { |
|
| 327 | - if($input['stay'] != '') { |
|
| 328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 330 | - header($header); |
|
| 331 | - } else { |
|
| 332 | - $header = "Location: index.php?a=99&r=2"; |
|
| 333 | - header($header); |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - break; |
|
| 337 | - default : |
|
| 338 | - webAlertAndQuit("No operation set in request."); |
|
| 325 | + include_once "footer.inc.php"; |
|
| 326 | + } else { |
|
| 327 | + if($input['stay'] != '') { |
|
| 328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 330 | + header($header); |
|
| 331 | + } else { |
|
| 332 | + $header = "Location: index.php?a=99&r=2"; |
|
| 333 | + header($header); |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + break; |
|
| 337 | + default : |
|
| 338 | + webAlertAndQuit("No operation set in request."); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('save_web_user')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $tbl_web_users = $modx->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $input = $_POST; |
| 14 | 14 | foreach($input as $k => $v) { |
| 15 | - if($k !== 'comment') { |
|
| 16 | - $v = sanitize($v); |
|
| 17 | - } |
|
| 18 | - $input[$k] = $v; |
|
| 15 | + if($k !== 'comment') { |
|
| 16 | + $v = sanitize($v); |
|
| 17 | + } |
|
| 18 | + $input[$k] = $v; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $id = (int)$input['id']; |
@@ -51,82 +51,82 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // verify password |
| 53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
| 54 | - webAlertAndQuit("Password typed is mismatched"); |
|
| 54 | + webAlertAndQuit("Password typed is mismatched"); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // verify email |
| 58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
| 59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
| 59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | switch($input['mode']) { |
| 63 | - case '87' : // new user |
|
| 64 | - // check if this user name already exist |
|
| 65 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | - $limit = $modx->db->getValue($rs); |
|
| 67 | - if($limit > 0) { |
|
| 68 | - webAlertAndQuit("User name is already in use!"); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // check if the email address already exist |
|
| 72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | - $limit = $modx->db->getValue($rs); |
|
| 75 | - if($limit > 0) { |
|
| 76 | - webAlertAndQuit("Email is already in use!"); |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // generate a new password for this user |
|
| 81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | - if(strlen($specifiedpassword) < 6) { |
|
| 83 | - webAlertAndQuit("Password is too short!"); |
|
| 84 | - } else { |
|
| 85 | - $newpassword = $specifiedpassword; |
|
| 86 | - } |
|
| 87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | - } elseif($passwordgenmethod == 'g') { |
|
| 90 | - $newpassword = generate_password(8); |
|
| 91 | - } else { |
|
| 92 | - webAlertAndQuit("No password generation method specified!"); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - // invoke OnBeforeWUsrFormSave event |
|
| 96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | - "mode" => "new", |
|
| 98 | - )); |
|
| 99 | - |
|
| 100 | - // create the user account |
|
| 101 | - $field = array(); |
|
| 102 | - $field['username'] = $esc_newusername; |
|
| 103 | - $field['password'] = md5($newpassword); |
|
| 104 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | - |
|
| 106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | - $field = $modx->db->escape($field); |
|
| 108 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | - |
|
| 110 | - // Save User Settings |
|
| 111 | - saveUserSettings($internalKey); |
|
| 112 | - |
|
| 113 | - // Set the item name for logger |
|
| 114 | - $_SESSION['itemname'] = $newusername; |
|
| 115 | - |
|
| 116 | - /*******************************************************************************/ |
|
| 117 | - // put the user in the user_groups he/ she should be in |
|
| 118 | - // first, check that up_perms are switched on! |
|
| 119 | - if($use_udperms == 1) { |
|
| 120 | - if(!empty($user_groups)) { |
|
| 121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | - $f = array(); |
|
| 123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | - $f['webuser'] = $internalKey; |
|
| 125 | - $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - // end of user_groups stuff! |
|
| 63 | + case '87' : // new user |
|
| 64 | + // check if this user name already exist |
|
| 65 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | + $limit = $modx->db->getValue($rs); |
|
| 67 | + if($limit > 0) { |
|
| 68 | + webAlertAndQuit("User name is already in use!"); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // check if the email address already exist |
|
| 72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | + $limit = $modx->db->getValue($rs); |
|
| 75 | + if($limit > 0) { |
|
| 76 | + webAlertAndQuit("Email is already in use!"); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // generate a new password for this user |
|
| 81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | + if(strlen($specifiedpassword) < 6) { |
|
| 83 | + webAlertAndQuit("Password is too short!"); |
|
| 84 | + } else { |
|
| 85 | + $newpassword = $specifiedpassword; |
|
| 86 | + } |
|
| 87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | + } elseif($passwordgenmethod == 'g') { |
|
| 90 | + $newpassword = generate_password(8); |
|
| 91 | + } else { |
|
| 92 | + webAlertAndQuit("No password generation method specified!"); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + // invoke OnBeforeWUsrFormSave event |
|
| 96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | + "mode" => "new", |
|
| 98 | + )); |
|
| 99 | + |
|
| 100 | + // create the user account |
|
| 101 | + $field = array(); |
|
| 102 | + $field['username'] = $esc_newusername; |
|
| 103 | + $field['password'] = md5($newpassword); |
|
| 104 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | + |
|
| 106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | + $field = $modx->db->escape($field); |
|
| 108 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | + |
|
| 110 | + // Save User Settings |
|
| 111 | + saveUserSettings($internalKey); |
|
| 112 | + |
|
| 113 | + // Set the item name for logger |
|
| 114 | + $_SESSION['itemname'] = $newusername; |
|
| 115 | + |
|
| 116 | + /*******************************************************************************/ |
|
| 117 | + // put the user in the user_groups he/ she should be in |
|
| 118 | + // first, check that up_perms are switched on! |
|
| 119 | + if($use_udperms == 1) { |
|
| 120 | + if(!empty($user_groups)) { |
|
| 121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | + $f = array(); |
|
| 123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | + $f['webuser'] = $internalKey; |
|
| 125 | + $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + // end of user_groups stuff! |
|
| 130 | 130 | |
| 131 | 131 | // invoke OnWebSaveUser event |
| 132 | 132 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -144,26 +144,26 @@ discard block |
||
| 144 | 144 | "id" => $internalKey |
| 145 | 145 | )); |
| 146 | 146 | |
| 147 | - if($passwordnotifymethod == 'e') { |
|
| 148 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | - if($input['stay'] != '') { |
|
| 150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | - header($header); |
|
| 153 | - } else { |
|
| 154 | - $header = "Location: index.php?a=99&r=2"; |
|
| 155 | - header($header); |
|
| 156 | - } |
|
| 157 | - } else { |
|
| 158 | - if($input['stay'] != '') { |
|
| 159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | - } else { |
|
| 162 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - include_once "header.inc.php"; |
|
| 166 | - ?> |
|
| 147 | + if($passwordnotifymethod == 'e') { |
|
| 148 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | + if($input['stay'] != '') { |
|
| 150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | + header($header); |
|
| 153 | + } else { |
|
| 154 | + $header = "Location: index.php?a=99&r=2"; |
|
| 155 | + header($header); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + if($input['stay'] != '') { |
|
| 159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | + } else { |
|
| 162 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + include_once "header.inc.php"; |
|
| 166 | + ?> |
|
| 167 | 167 | |
| 168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 169 | 169 | |
@@ -185,86 +185,86 @@ discard block |
||
| 185 | 185 | </div> |
| 186 | 186 | <?php |
| 187 | 187 | |
| 188 | - include_once "footer.inc.php"; |
|
| 189 | - } |
|
| 190 | - break; |
|
| 191 | - case '88' : // edit user |
|
| 192 | - // generate a new password for this user |
|
| 193 | - if($genpassword == 1) { |
|
| 194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | - if(strlen($specifiedpassword) < 6) { |
|
| 196 | - webAlertAndQuit("Password is too short!"); |
|
| 197 | - } else { |
|
| 198 | - $newpassword = $specifiedpassword; |
|
| 199 | - } |
|
| 200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 202 | - } elseif($passwordgenmethod == 'g') { |
|
| 203 | - $newpassword = generate_password(8); |
|
| 204 | - } else { |
|
| 205 | - webAlertAndQuit("No password generation method specified!"); |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - if($passwordnotifymethod == 'e') { |
|
| 209 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - // check if the username already exist |
|
| 213 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 214 | - $limit = $modx->db->getValue($rs); |
|
| 215 | - if($limit > 0) { |
|
| 216 | - webAlertAndQuit("User name is already in use!"); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // check if the email address already exists |
|
| 220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 221 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 222 | - $limit = $modx->db->getValue($rs); |
|
| 223 | - if($limit > 0) { |
|
| 224 | - webAlertAndQuit("Email is already in use!"); |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // invoke OnBeforeWUsrFormSave event |
|
| 229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 230 | - "mode" => "upd", |
|
| 231 | - "id" => $id |
|
| 232 | - )); |
|
| 233 | - |
|
| 234 | - // update user name and password |
|
| 235 | - $field = array(); |
|
| 236 | - $field['username'] = $esc_newusername; |
|
| 237 | - if($genpassword == 1) { |
|
| 238 | - $field['password'] = md5($newpassword); |
|
| 239 | - } |
|
| 240 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 242 | - $field = $modx->db->escape($field); |
|
| 243 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 244 | - |
|
| 245 | - // Save User Settings |
|
| 246 | - saveUserSettings($id); |
|
| 247 | - |
|
| 248 | - // Set the item name for logger |
|
| 249 | - $_SESSION['itemname'] = $newusername; |
|
| 250 | - |
|
| 251 | - /*******************************************************************************/ |
|
| 252 | - // put the user in the user_groups he/ she should be in |
|
| 253 | - // first, check that up_perms are switched on! |
|
| 254 | - if($use_udperms == 1) { |
|
| 255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 256 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 257 | - if(!empty($user_groups)) { |
|
| 258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | - $field = array(); |
|
| 260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
| 261 | - $field['webuser'] = $id; |
|
| 262 | - $modx->db->insert($field, $tbl_web_groups); |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - // end of user_groups stuff! |
|
| 267 | - /*******************************************************************************/ |
|
| 188 | + include_once "footer.inc.php"; |
|
| 189 | + } |
|
| 190 | + break; |
|
| 191 | + case '88' : // edit user |
|
| 192 | + // generate a new password for this user |
|
| 193 | + if($genpassword == 1) { |
|
| 194 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | + if(strlen($specifiedpassword) < 6) { |
|
| 196 | + webAlertAndQuit("Password is too short!"); |
|
| 197 | + } else { |
|
| 198 | + $newpassword = $specifiedpassword; |
|
| 199 | + } |
|
| 200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 202 | + } elseif($passwordgenmethod == 'g') { |
|
| 203 | + $newpassword = generate_password(8); |
|
| 204 | + } else { |
|
| 205 | + webAlertAndQuit("No password generation method specified!"); |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + if($passwordnotifymethod == 'e') { |
|
| 209 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + // check if the username already exist |
|
| 213 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 214 | + $limit = $modx->db->getValue($rs); |
|
| 215 | + if($limit > 0) { |
|
| 216 | + webAlertAndQuit("User name is already in use!"); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // check if the email address already exists |
|
| 220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 221 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 222 | + $limit = $modx->db->getValue($rs); |
|
| 223 | + if($limit > 0) { |
|
| 224 | + webAlertAndQuit("Email is already in use!"); |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // invoke OnBeforeWUsrFormSave event |
|
| 229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 230 | + "mode" => "upd", |
|
| 231 | + "id" => $id |
|
| 232 | + )); |
|
| 233 | + |
|
| 234 | + // update user name and password |
|
| 235 | + $field = array(); |
|
| 236 | + $field['username'] = $esc_newusername; |
|
| 237 | + if($genpassword == 1) { |
|
| 238 | + $field['password'] = md5($newpassword); |
|
| 239 | + } |
|
| 240 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 242 | + $field = $modx->db->escape($field); |
|
| 243 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 244 | + |
|
| 245 | + // Save User Settings |
|
| 246 | + saveUserSettings($id); |
|
| 247 | + |
|
| 248 | + // Set the item name for logger |
|
| 249 | + $_SESSION['itemname'] = $newusername; |
|
| 250 | + |
|
| 251 | + /*******************************************************************************/ |
|
| 252 | + // put the user in the user_groups he/ she should be in |
|
| 253 | + // first, check that up_perms are switched on! |
|
| 254 | + if($use_udperms == 1) { |
|
| 255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 256 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 257 | + if(!empty($user_groups)) { |
|
| 258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | + $field = array(); |
|
| 260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
| 261 | + $field['webuser'] = $id; |
|
| 262 | + $modx->db->insert($field, $tbl_web_groups); |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + // end of user_groups stuff! |
|
| 267 | + /*******************************************************************************/ |
|
| 268 | 268 | |
| 269 | 269 | // invoke OnWebSaveUser event |
| 270 | 270 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -293,16 +293,16 @@ discard block |
||
| 293 | 293 | "id" => $id |
| 294 | 294 | )); |
| 295 | 295 | |
| 296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | - if($input['stay'] != '') { |
|
| 298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 300 | - } else { |
|
| 301 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 302 | - } |
|
| 296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | + if($input['stay'] != '') { |
|
| 298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 300 | + } else { |
|
| 301 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - include_once "header.inc.php"; |
|
| 305 | - ?> |
|
| 304 | + include_once "header.inc.php"; |
|
| 305 | + ?> |
|
| 306 | 306 | |
| 307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 308 | 308 | |
@@ -322,20 +322,20 @@ discard block |
||
| 322 | 322 | </div> |
| 323 | 323 | <?php |
| 324 | 324 | |
| 325 | - include_once "footer.inc.php"; |
|
| 326 | - } else { |
|
| 327 | - if($input['stay'] != '') { |
|
| 328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 330 | - header($header); |
|
| 331 | - } else { |
|
| 332 | - $header = "Location: index.php?a=99&r=2"; |
|
| 333 | - header($header); |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - break; |
|
| 337 | - default : |
|
| 338 | - webAlertAndQuit("No operation set in request."); |
|
| 325 | + include_once "footer.inc.php"; |
|
| 326 | + } else { |
|
| 327 | + if($input['stay'] != '') { |
|
| 328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 330 | + header($header); |
|
| 331 | + } else { |
|
| 332 | + $header = "Location: index.php?a=99&r=2"; |
|
| 333 | + header($header); |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + break; |
|
| 337 | + default : |
|
| 338 | + webAlertAndQuit("No operation set in request."); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -345,14 +345,14 @@ discard block |
||
| 345 | 345 | * @return string |
| 346 | 346 | */ |
| 347 | 347 | function save_user_quoted_printable($string) { |
| 348 | - $crlf = "\n"; |
|
| 349 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 350 | - $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
| 351 | - $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
| 352 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 353 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 354 | - $string = preg_replace($f, $r, $string); |
|
| 355 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 348 | + $crlf = "\n"; |
|
| 349 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 350 | + $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
| 351 | + $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
| 352 | + $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 353 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 354 | + $string = preg_replace($f, $r, $string); |
|
| 355 | + return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -364,94 +364,94 @@ discard block |
||
| 364 | 364 | * @param string $ufn |
| 365 | 365 | */ |
| 366 | 366 | function sendMailMessage($email, $uid, $pwd, $ufn) { |
| 367 | - $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
|
| 368 | - global $emailsubject, $emailsender; |
|
| 369 | - global $site_name, $site_url; |
|
| 370 | - $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
| 371 | - // replace placeholders |
|
| 372 | - $message = str_replace("[+uid+]", $uid, $message); |
|
| 373 | - $message = str_replace("[+pwd+]", $pwd, $message); |
|
| 374 | - $message = str_replace("[+ufn+]", $ufn, $message); |
|
| 375 | - $message = str_replace("[+sname+]", $site_name, $message); |
|
| 376 | - $message = str_replace("[+saddr+]", $emailsender, $message); |
|
| 377 | - $message = str_replace("[+semail+]", $emailsender, $message); |
|
| 378 | - $message = str_replace("[+surl+]", $site_url, $message); |
|
| 379 | - |
|
| 380 | - $param = array(); |
|
| 381 | - $param['from'] = "{$site_name}<{$emailsender}>"; |
|
| 382 | - $param['subject'] = $emailsubject; |
|
| 383 | - $param['body'] = $message; |
|
| 384 | - $param['to'] = $email; |
|
| 385 | - $param['type'] = 'text'; |
|
| 386 | - $rs = $modx->sendmail($param); |
|
| 387 | - if(!$rs) { |
|
| 388 | - $modx->manager->saveFormValues(); |
|
| 389 | - $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
| 390 | - } |
|
| 367 | + $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
|
| 368 | + global $emailsubject, $emailsender; |
|
| 369 | + global $site_name, $site_url; |
|
| 370 | + $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
| 371 | + // replace placeholders |
|
| 372 | + $message = str_replace("[+uid+]", $uid, $message); |
|
| 373 | + $message = str_replace("[+pwd+]", $pwd, $message); |
|
| 374 | + $message = str_replace("[+ufn+]", $ufn, $message); |
|
| 375 | + $message = str_replace("[+sname+]", $site_name, $message); |
|
| 376 | + $message = str_replace("[+saddr+]", $emailsender, $message); |
|
| 377 | + $message = str_replace("[+semail+]", $emailsender, $message); |
|
| 378 | + $message = str_replace("[+surl+]", $site_url, $message); |
|
| 379 | + |
|
| 380 | + $param = array(); |
|
| 381 | + $param['from'] = "{$site_name}<{$emailsender}>"; |
|
| 382 | + $param['subject'] = $emailsubject; |
|
| 383 | + $param['body'] = $message; |
|
| 384 | + $param['to'] = $email; |
|
| 385 | + $param['type'] = 'text'; |
|
| 386 | + $rs = $modx->sendmail($param); |
|
| 387 | + if(!$rs) { |
|
| 388 | + $modx->manager->saveFormValues(); |
|
| 389 | + $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
| 390 | + } |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // Save User Settings |
| 394 | 394 | function saveUserSettings($id) { |
| 395 | - $modx = evolutionCMS(); |
|
| 396 | - $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
| 397 | - |
|
| 398 | - $settings = array( |
|
| 399 | - "login_home", |
|
| 400 | - "allowed_ip", |
|
| 401 | - "allowed_days" |
|
| 402 | - ); |
|
| 403 | - |
|
| 404 | - $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
| 405 | - |
|
| 406 | - foreach($settings as $n) { |
|
| 407 | - $vl = $_POST[$n]; |
|
| 408 | - if(is_array($vl)) { |
|
| 409 | - $vl = implode(",", $vl); |
|
| 410 | - } |
|
| 411 | - if($vl != '') { |
|
| 412 | - $f = array(); |
|
| 413 | - $f['webuser'] = $id; |
|
| 414 | - $f['setting_name'] = $n; |
|
| 415 | - $f['setting_value'] = $vl; |
|
| 416 | - $f = $modx->db->escape($f); |
|
| 417 | - $modx->db->insert($f, $tbl_web_user_settings); |
|
| 418 | - } |
|
| 419 | - } |
|
| 395 | + $modx = evolutionCMS(); |
|
| 396 | + $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
| 397 | + |
|
| 398 | + $settings = array( |
|
| 399 | + "login_home", |
|
| 400 | + "allowed_ip", |
|
| 401 | + "allowed_days" |
|
| 402 | + ); |
|
| 403 | + |
|
| 404 | + $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
| 405 | + |
|
| 406 | + foreach($settings as $n) { |
|
| 407 | + $vl = $_POST[$n]; |
|
| 408 | + if(is_array($vl)) { |
|
| 409 | + $vl = implode(",", $vl); |
|
| 410 | + } |
|
| 411 | + if($vl != '') { |
|
| 412 | + $f = array(); |
|
| 413 | + $f['webuser'] = $id; |
|
| 414 | + $f['setting_name'] = $n; |
|
| 415 | + $f['setting_value'] = $vl; |
|
| 416 | + $f = $modx->db->escape($f); |
|
| 417 | + $modx->db->insert($f, $tbl_web_user_settings); |
|
| 418 | + } |
|
| 419 | + } |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // Web alert - sends an alert to web browser |
| 423 | 423 | function webAlertAndQuit($msg) { |
| 424 | - global $id, $modx; |
|
| 425 | - $mode = $_POST['mode']; |
|
| 426 | - $modx->manager->saveFormValues($mode); |
|
| 427 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 424 | + global $id, $modx; |
|
| 425 | + $mode = $_POST['mode']; |
|
| 426 | + $modx->manager->saveFormValues($mode); |
|
| 427 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // Generate password |
| 431 | 431 | function generate_password($length = 10) { |
| 432 | - $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
| 433 | - $ps_len = strlen($allowable_characters); |
|
| 434 | - mt_srand((double) microtime() * 1000000); |
|
| 435 | - $pass = ""; |
|
| 436 | - for($i = 0; $i < $length; $i++) { |
|
| 437 | - $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
| 438 | - } |
|
| 439 | - return $pass; |
|
| 432 | + $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
| 433 | + $ps_len = strlen($allowable_characters); |
|
| 434 | + mt_srand((double) microtime() * 1000000); |
|
| 435 | + $pass = ""; |
|
| 436 | + for($i = 0; $i < $length; $i++) { |
|
| 437 | + $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
| 438 | + } |
|
| 439 | + return $pass; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | function sanitize($str = '', $safecount = 0) { |
| 443 | - $modx = evolutionCMS(); |
|
| 444 | - $safecount++; |
|
| 445 | - if(1000 < $safecount) { |
|
| 446 | - exit("error too many loops '{$safecount}'"); |
|
| 447 | - } |
|
| 448 | - if(is_array($str)) { |
|
| 449 | - foreach($str as $i => $v) { |
|
| 450 | - $str[$i] = sanitize($v, $safecount); |
|
| 451 | - } |
|
| 452 | - } else { |
|
| 453 | - // $str = strip_tags($str); // LEAVE < and > intact |
|
| 454 | - $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 455 | - } |
|
| 456 | - return $str; |
|
| 443 | + $modx = evolutionCMS(); |
|
| 444 | + $safecount++; |
|
| 445 | + if(1000 < $safecount) { |
|
| 446 | + exit("error too many loops '{$safecount}'"); |
|
| 447 | + } |
|
| 448 | + if(is_array($str)) { |
|
| 449 | + foreach($str as $i => $v) { |
|
| 450 | + $str[$i] = sanitize($v, $safecount); |
|
| 451 | + } |
|
| 452 | + } else { |
|
| 453 | + // $str = strip_tags($str); // LEAVE < and > intact |
|
| 454 | + $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
| 455 | + } |
|
| 456 | + return $str; |
|
| 457 | 457 | } |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('save_web_user')) { |
|
| 5 | +if (!$modx->hasPermission('save_web_user')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -11,14 +11,14 @@ 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; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -$id = (int)$input['id']; |
|
| 21 | +$id = (int) $input['id']; |
|
| 22 | 22 | $oldusername = $input['oldusername']; |
| 23 | 23 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
| 24 | 24 | $esc_newusername = $modx->db->escape($newusername); |
@@ -50,21 +50,21 @@ 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 | |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | if ($modx->config['allow_multiple_emails'] != 1) { |
| 73 | 73 | $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
| 74 | 74 | $limit = $modx->db->getValue($rs); |
| 75 | - if($limit > 0) { |
|
| 75 | + if ($limit > 0) { |
|
| 76 | 76 | webAlertAndQuit("Email is already in use!"); |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // generate a new password for this user |
| 81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | - if(strlen($specifiedpassword) < 6) { |
|
| 81 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | + if (strlen($specifiedpassword) < 6) { |
|
| 83 | 83 | webAlertAndQuit("Password is too short!"); |
| 84 | 84 | } else { |
| 85 | 85 | $newpassword = $specifiedpassword; |
| 86 | 86 | } |
| 87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 87 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | 88 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 89 | - } elseif($passwordgenmethod == 'g') { |
|
| 89 | + } elseif ($passwordgenmethod == 'g') { |
|
| 90 | 90 | $newpassword = generate_password(8); |
| 91 | 91 | } else { |
| 92 | 92 | webAlertAndQuit("No password generation method specified!"); |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | /*******************************************************************************/ |
| 117 | 117 | // put the user in the user_groups he/ she should be in |
| 118 | 118 | // first, check that up_perms are switched on! |
| 119 | - if($use_udperms == 1) { |
|
| 120 | - if(!empty($user_groups)) { |
|
| 121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 119 | + if ($use_udperms == 1) { |
|
| 120 | + if (!empty($user_groups)) { |
|
| 121 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | 122 | $f = array(); |
| 123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
| 123 | + $f['webgroup'] = (int) $user_groups[$i]; |
|
| 124 | 124 | $f['webuser'] = $internalKey; |
| 125 | 125 | $modx->db->insert($f, $tbl_web_groups); |
| 126 | 126 | } |
@@ -144,20 +144,20 @@ discard block |
||
| 144 | 144 | "id" => $internalKey |
| 145 | 145 | )); |
| 146 | 146 | |
| 147 | - if($passwordnotifymethod == 'e') { |
|
| 147 | + if ($passwordnotifymethod == 'e') { |
|
| 148 | 148 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 149 | - if($input['stay'] != '') { |
|
| 149 | + if ($input['stay'] != '') { |
|
| 150 | 150 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
| 151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 151 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 152 | 152 | header($header); |
| 153 | 153 | } else { |
| 154 | 154 | $header = "Location: index.php?a=99&r=2"; |
| 155 | 155 | header($header); |
| 156 | 156 | } |
| 157 | 157 | } else { |
| 158 | - if($input['stay'] != '') { |
|
| 158 | + if ($input['stay'] != '') { |
|
| 159 | 159 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
| 160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 160 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 161 | 161 | } else { |
| 162 | 162 | $stayUrl = "index.php?a=99&r=2"; |
| 163 | 163 | } |
@@ -190,29 +190,29 @@ discard block |
||
| 190 | 190 | break; |
| 191 | 191 | case '88' : // edit user |
| 192 | 192 | // generate a new password for this user |
| 193 | - if($genpassword == 1) { |
|
| 194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | - if(strlen($specifiedpassword) < 6) { |
|
| 193 | + if ($genpassword == 1) { |
|
| 194 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 195 | + if (strlen($specifiedpassword) < 6) { |
|
| 196 | 196 | webAlertAndQuit("Password is too short!"); |
| 197 | 197 | } else { |
| 198 | 198 | $newpassword = $specifiedpassword; |
| 199 | 199 | } |
| 200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 200 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 201 | 201 | webAlertAndQuit("You didn't specify a password for this user!"); |
| 202 | - } elseif($passwordgenmethod == 'g') { |
|
| 202 | + } elseif ($passwordgenmethod == 'g') { |
|
| 203 | 203 | $newpassword = generate_password(8); |
| 204 | 204 | } else { |
| 205 | 205 | webAlertAndQuit("No password generation method specified!"); |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | - if($passwordnotifymethod == 'e') { |
|
| 208 | + if ($passwordnotifymethod == 'e') { |
|
| 209 | 209 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // check if the username already exist |
| 213 | 213 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
| 214 | 214 | $limit = $modx->db->getValue($rs); |
| 215 | - if($limit > 0) { |
|
| 215 | + if ($limit > 0) { |
|
| 216 | 216 | webAlertAndQuit("User name is already in use!"); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | if ($modx->config['allow_multiple_emails'] != 1) { |
| 221 | 221 | $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
| 222 | 222 | $limit = $modx->db->getValue($rs); |
| 223 | - if($limit > 0) { |
|
| 223 | + if ($limit > 0) { |
|
| 224 | 224 | webAlertAndQuit("Email is already in use!"); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | // update user name and password |
| 235 | 235 | $field = array(); |
| 236 | 236 | $field['username'] = $esc_newusername; |
| 237 | - if($genpassword == 1) { |
|
| 237 | + if ($genpassword == 1) { |
|
| 238 | 238 | $field['password'] = md5($newpassword); |
| 239 | 239 | } |
| 240 | 240 | $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | /*******************************************************************************/ |
| 252 | 252 | // put the user in the user_groups he/ she should be in |
| 253 | 253 | // first, check that up_perms are switched on! |
| 254 | - if($use_udperms == 1) { |
|
| 254 | + if ($use_udperms == 1) { |
|
| 255 | 255 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
| 256 | 256 | $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
| 257 | - if(!empty($user_groups)) { |
|
| 258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 257 | + if (!empty($user_groups)) { |
|
| 258 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 259 | 259 | $field = array(); |
| 260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
| 260 | + $field['webgroup'] = (int) $user_groups[$i]; |
|
| 261 | 261 | $field['webuser'] = $id; |
| 262 | 262 | $modx->db->insert($field, $tbl_web_groups); |
| 263 | 263 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | )); |
| 280 | 280 | |
| 281 | 281 | // invoke OnWebChangePassword event |
| 282 | - if($genpassword == 1) { |
|
| 282 | + if ($genpassword == 1) { |
|
| 283 | 283 | $modx->invokeEvent("OnWebChangePassword", array( |
| 284 | 284 | "userid" => $id, |
| 285 | 285 | "username" => $newusername, |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | "id" => $id |
| 294 | 294 | )); |
| 295 | 295 | |
| 296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | - if($input['stay'] != '') { |
|
| 296 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 297 | + if ($input['stay'] != '') { |
|
| 298 | 298 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
| 299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 299 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 300 | 300 | } else { |
| 301 | 301 | $stayUrl = "index.php?a=99&r=2"; |
| 302 | 302 | } |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | include_once "footer.inc.php"; |
| 326 | 326 | } else { |
| 327 | - if($input['stay'] != '') { |
|
| 327 | + if ($input['stay'] != '') { |
|
| 328 | 328 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
| 329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 329 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
| 330 | 330 | header($header); |
| 331 | 331 | } else { |
| 332 | 332 | $header = "Location: index.php?a=99&r=2"; |
@@ -344,15 +344,15 @@ discard block |
||
| 344 | 344 | * @param string $string |
| 345 | 345 | * @return string |
| 346 | 346 | */ |
| 347 | -function save_user_quoted_printable($string) { |
|
| 347 | +function save_user_quoted_printable($string){ |
|
| 348 | 348 | $crlf = "\n"; |
| 349 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
| 349 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf; |
|
| 350 | 350 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
| 351 | 351 | $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
| 352 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
| 353 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
| 352 | + $f[] = '/([\011\040])'.$crlf.'/e'; |
|
| 353 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'"; |
|
| 354 | 354 | $string = preg_replace($f, $r, $string); |
| 355 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
| 355 | + return trim(wordwrap($string, 70, ' ='.$crlf)); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @param string $pwd |
| 364 | 364 | * @param string $ufn |
| 365 | 365 | */ |
| 366 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
| 366 | +function sendMailMessage($email, $uid, $pwd, $ufn){ |
|
| 367 | 367 | $modx = evolutionCMS(); global $_lang, $websignupemail_message; |
| 368 | 368 | global $emailsubject, $emailsender; |
| 369 | 369 | global $site_name, $site_url; |
@@ -384,14 +384,14 @@ discard block |
||
| 384 | 384 | $param['to'] = $email; |
| 385 | 385 | $param['type'] = 'text'; |
| 386 | 386 | $rs = $modx->sendmail($param); |
| 387 | - if(!$rs) { |
|
| 387 | + if (!$rs) { |
|
| 388 | 388 | $modx->manager->saveFormValues(); |
| 389 | 389 | $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // Save User Settings |
| 394 | -function saveUserSettings($id) { |
|
| 394 | +function saveUserSettings($id){ |
|
| 395 | 395 | $modx = evolutionCMS(); |
| 396 | 396 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
| 397 | 397 | |
@@ -403,12 +403,12 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
| 405 | 405 | |
| 406 | - foreach($settings as $n) { |
|
| 406 | + foreach ($settings as $n) { |
|
| 407 | 407 | $vl = $_POST[$n]; |
| 408 | - if(is_array($vl)) { |
|
| 408 | + if (is_array($vl)) { |
|
| 409 | 409 | $vl = implode(",", $vl); |
| 410 | 410 | } |
| 411 | - if($vl != '') { |
|
| 411 | + if ($vl != '') { |
|
| 412 | 412 | $f = array(); |
| 413 | 413 | $f['webuser'] = $id; |
| 414 | 414 | $f['setting_name'] = $n; |
@@ -420,33 +420,33 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // Web alert - sends an alert to web browser |
| 423 | -function webAlertAndQuit($msg) { |
|
| 423 | +function webAlertAndQuit($msg){ |
|
| 424 | 424 | global $id, $modx; |
| 425 | 425 | $mode = $_POST['mode']; |
| 426 | 426 | $modx->manager->saveFormValues($mode); |
| 427 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
| 427 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : '')); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // Generate password |
| 431 | -function generate_password($length = 10) { |
|
| 431 | +function generate_password($length = 10){ |
|
| 432 | 432 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
| 433 | 433 | $ps_len = strlen($allowable_characters); |
| 434 | 434 | mt_srand((double) microtime() * 1000000); |
| 435 | 435 | $pass = ""; |
| 436 | - for($i = 0; $i < $length; $i++) { |
|
| 436 | + for ($i = 0; $i < $length; $i++) { |
|
| 437 | 437 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
| 438 | 438 | } |
| 439 | 439 | return $pass; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | -function sanitize($str = '', $safecount = 0) { |
|
| 442 | +function sanitize($str = '', $safecount = 0){ |
|
| 443 | 443 | $modx = evolutionCMS(); |
| 444 | 444 | $safecount++; |
| 445 | - if(1000 < $safecount) { |
|
| 445 | + if (1000 < $safecount) { |
|
| 446 | 446 | exit("error too many loops '{$safecount}'"); |
| 447 | 447 | } |
| 448 | - if(is_array($str)) { |
|
| 449 | - foreach($str as $i => $v) { |
|
| 448 | + if (is_array($str)) { |
|
| 449 | + foreach ($str as $i => $v) { |
|
| 450 | 450 | $str[$i] = sanitize($v, $safecount); |
| 451 | 451 | } |
| 452 | 452 | } else { |
@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $children = array(); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $udperms->duplicateDoc = true; |
| 23 | 23 | |
| 24 | 24 | if(!$udperms->checkPermissions()) { |
| 25 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 25 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // Run the duplicator |
@@ -43,103 +43,103 @@ discard block |
||
| 43 | 43 | * @return int |
| 44 | 44 | */ |
| 45 | 45 | function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
| 46 | - $modx = evolutionCMS(); global $_lang; |
|
| 47 | - |
|
| 48 | - // invoke OnBeforeDocDuplicate event |
|
| 49 | - $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array( |
|
| 50 | - 'id' => $docid |
|
| 51 | - )); |
|
| 52 | - |
|
| 53 | - // if( !in_array( 'false', array_values( $evtOut ) ) ){} |
|
| 54 | - // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication |
|
| 55 | - // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false'); |
|
| 56 | - |
|
| 57 | - $userID = $modx->getLoginUserID(); |
|
| 58 | - |
|
| 59 | - $tblsc = $modx->getFullTableName('site_content'); |
|
| 60 | - |
|
| 61 | - // Grab the original document |
|
| 62 | - $rs = $modx->db->select('*', $tblsc, "id='{$docid}'"); |
|
| 63 | - $content = $modx->db->getRow($rs); |
|
| 64 | - |
|
| 65 | - // Handle incremental ID |
|
| 66 | - switch($modx->config['docid_incrmnt_method']) |
|
| 67 | - { |
|
| 68 | - case '1': |
|
| 69 | - $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
|
| 70 | - $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
| 71 | - $content['id'] = $modx->db->getValue($rs); |
|
| 72 | - break; |
|
| 73 | - case '2': |
|
| 74 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
| 75 | - $content['id'] = $modx->db->getValue($rs); |
|
| 76 | - break; |
|
| 77 | - |
|
| 78 | - default: |
|
| 79 | - unset($content['id']); // remove the current id. |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - // Once we've grabbed the document object, start doing some modifications |
|
| 83 | - if ($_toplevel == 0) { |
|
| 84 | - // count duplicates |
|
| 85 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
|
| 86 | - $pagetitle = $modx->db->escape($pagetitle); |
|
| 87 | - $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
|
| 88 | - if($count>=1) $count = ' '.($count+1); |
|
| 89 | - else $count = ''; |
|
| 90 | - |
|
| 91 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
| 92 | - $content['alias'] = null; |
|
| 93 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
| 94 | - $content['alias'] = null; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - // change the parent accordingly |
|
| 98 | - if ($parent !== null) $content['parent'] = $parent; |
|
| 99 | - |
|
| 100 | - // Change the author |
|
| 101 | - $content['createdby'] = $userID; |
|
| 102 | - $content['createdon'] = time(); |
|
| 103 | - // Remove other modification times |
|
| 104 | - $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0; |
|
| 105 | - |
|
| 106 | - // [FS#922] Should the published status be honored? - sirlancelot |
|
| 46 | + $modx = evolutionCMS(); global $_lang; |
|
| 47 | + |
|
| 48 | + // invoke OnBeforeDocDuplicate event |
|
| 49 | + $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array( |
|
| 50 | + 'id' => $docid |
|
| 51 | + )); |
|
| 52 | + |
|
| 53 | + // if( !in_array( 'false', array_values( $evtOut ) ) ){} |
|
| 54 | + // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication |
|
| 55 | + // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false'); |
|
| 56 | + |
|
| 57 | + $userID = $modx->getLoginUserID(); |
|
| 58 | + |
|
| 59 | + $tblsc = $modx->getFullTableName('site_content'); |
|
| 60 | + |
|
| 61 | + // Grab the original document |
|
| 62 | + $rs = $modx->db->select('*', $tblsc, "id='{$docid}'"); |
|
| 63 | + $content = $modx->db->getRow($rs); |
|
| 64 | + |
|
| 65 | + // Handle incremental ID |
|
| 66 | + switch($modx->config['docid_incrmnt_method']) |
|
| 67 | + { |
|
| 68 | + case '1': |
|
| 69 | + $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
|
| 70 | + $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
| 71 | + $content['id'] = $modx->db->getValue($rs); |
|
| 72 | + break; |
|
| 73 | + case '2': |
|
| 74 | + $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
| 75 | + $content['id'] = $modx->db->getValue($rs); |
|
| 76 | + break; |
|
| 77 | + |
|
| 78 | + default: |
|
| 79 | + unset($content['id']); // remove the current id. |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + // Once we've grabbed the document object, start doing some modifications |
|
| 83 | + if ($_toplevel == 0) { |
|
| 84 | + // count duplicates |
|
| 85 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
|
| 86 | + $pagetitle = $modx->db->escape($pagetitle); |
|
| 87 | + $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
|
| 88 | + if($count>=1) $count = ' '.($count+1); |
|
| 89 | + else $count = ''; |
|
| 90 | + |
|
| 91 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
| 92 | + $content['alias'] = null; |
|
| 93 | + } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
| 94 | + $content['alias'] = null; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + // change the parent accordingly |
|
| 98 | + if ($parent !== null) $content['parent'] = $parent; |
|
| 99 | + |
|
| 100 | + // Change the author |
|
| 101 | + $content['createdby'] = $userID; |
|
| 102 | + $content['createdon'] = time(); |
|
| 103 | + // Remove other modification times |
|
| 104 | + $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0; |
|
| 105 | + |
|
| 106 | + // [FS#922] Should the published status be honored? - sirlancelot |
|
| 107 | 107 | // if ($modx->hasPermission('publish_document')) { |
| 108 | 108 | // if ($modx->config['publish_default']) |
| 109 | 109 | // $content['pub_date'] = $content['pub_date']; // should this be changed to 1? |
| 110 | 110 | // else $content['pub_date'] = 0; |
| 111 | 111 | // } else { |
| 112 | - // User can't publish documents |
|
| 112 | + // User can't publish documents |
|
| 113 | 113 | // $content['published'] = $content['pub_date'] = 0; |
| 114 | 114 | // } |
| 115 | 115 | |
| 116 | 116 | // Set the published status to unpublished by default (see above ... commit #3388) |
| 117 | 117 | $content['published'] = $content['pub_date'] = 0; |
| 118 | 118 | |
| 119 | - // Escape the proper strings |
|
| 120 | - $content = $modx->db->escape($content); |
|
| 119 | + // Escape the proper strings |
|
| 120 | + $content = $modx->db->escape($content); |
|
| 121 | 121 | |
| 122 | - // Duplicate the Document |
|
| 123 | - $newparent = $modx->db->insert($content, $tblsc); |
|
| 122 | + // Duplicate the Document |
|
| 123 | + $newparent = $modx->db->insert($content, $tblsc); |
|
| 124 | 124 | |
| 125 | - // duplicate document's TVs |
|
| 126 | - duplicateTVs($docid, $newparent); |
|
| 127 | - duplicateAccess($docid, $newparent); |
|
| 125 | + // duplicate document's TVs |
|
| 126 | + duplicateTVs($docid, $newparent); |
|
| 127 | + duplicateAccess($docid, $newparent); |
|
| 128 | 128 | |
| 129 | - // invoke OnDocDuplicate event |
|
| 130 | - $evtOut = $modx->invokeEvent('OnDocDuplicate', array( |
|
| 131 | - 'id' => $docid, |
|
| 132 | - 'new_id' => $newparent |
|
| 133 | - )); |
|
| 129 | + // invoke OnDocDuplicate event |
|
| 130 | + $evtOut = $modx->invokeEvent('OnDocDuplicate', array( |
|
| 131 | + 'id' => $docid, |
|
| 132 | + 'new_id' => $newparent |
|
| 133 | + )); |
|
| 134 | 134 | |
| 135 | - // Start duplicating all the child documents that aren't deleted. |
|
| 136 | - $_toplevel++; |
|
| 137 | - $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
|
| 138 | - while ($row = $modx->db->getRow($rs)) |
|
| 139 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
| 135 | + // Start duplicating all the child documents that aren't deleted. |
|
| 136 | + $_toplevel++; |
|
| 137 | + $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
|
| 138 | + while ($row = $modx->db->getRow($rs)) |
|
| 139 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
| 140 | 140 | |
| 141 | - // return the new doc id |
|
| 142 | - return $newparent; |
|
| 141 | + // return the new doc id |
|
| 142 | + return $newparent; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -149,17 +149,17 @@ discard block |
||
| 149 | 149 | * @param int $newid |
| 150 | 150 | */ |
| 151 | 151 | function duplicateTVs($oldid, $newid){ |
| 152 | - $modx = evolutionCMS(); |
|
| 152 | + $modx = evolutionCMS(); |
|
| 153 | 153 | |
| 154 | - $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
| 154 | + $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
| 155 | 155 | |
| 156 | 156 | $newid = (int)$newid; |
| 157 | 157 | $oldid = (int)$oldid; |
| 158 | 158 | |
| 159 | 159 | $modx->db->insert( |
| 160 | - array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
|
| 161 | - "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from |
|
| 162 | - ); |
|
| 160 | + array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
|
| 161 | + "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from |
|
| 162 | + ); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | * @param int $newid |
| 170 | 170 | */ |
| 171 | 171 | function duplicateAccess($oldid, $newid){ |
| 172 | - $modx = evolutionCMS(); |
|
| 172 | + $modx = evolutionCMS(); |
|
| 173 | 173 | |
| 174 | - $tbldg = $modx->getFullTableName('document_groups'); |
|
| 174 | + $tbldg = $modx->getFullTableName('document_groups'); |
|
| 175 | 175 | |
| 176 | 176 | $newid = (int)$newid; |
| 177 | 177 | $oldid = (int)$oldid; |
| 178 | 178 | |
| 179 | 179 | $modx->db->insert( |
| 180 | - array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
|
| 181 | - "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from |
|
| 182 | - ); |
|
| 180 | + array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
|
| 181 | + "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from |
|
| 182 | + ); |
|
| 183 | 183 | } |
@@ -1,27 +1,27 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
|
| 5 | +if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $children = array(); |
| 15 | 15 | |
| 16 | 16 | // check permissions on the document |
| 17 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 17 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 18 | 18 | $udperms = new udperms(); |
| 19 | 19 | $udperms->user = $modx->getLoginUserID(); |
| 20 | 20 | $udperms->document = $id; |
| 21 | 21 | $udperms->role = $_SESSION['mgrRole']; |
| 22 | 22 | $udperms->duplicateDoc = true; |
| 23 | 23 | |
| 24 | -if(!$udperms->checkPermissions()) { |
|
| 24 | +if (!$udperms->checkPermissions()) { |
|
| 25 | 25 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $_SESSION['itemname'] = $name; |
| 34 | 34 | |
| 35 | 35 | // finish cloning - redirect |
| 36 | -$header="Location: index.php?r=1&a=3&id=$id"; |
|
| 36 | +$header = "Location: index.php?r=1&a=3&id=$id"; |
|
| 37 | 37 | header($header); |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param int $_toplevel |
| 43 | 43 | * @return int |
| 44 | 44 | */ |
| 45 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
| 45 | +function duplicateDocument($docid, $parent = null, $_toplevel = 0){ |
|
| 46 | 46 | $modx = evolutionCMS(); global $_lang; |
| 47 | 47 | |
| 48 | 48 | // invoke OnBeforeDocDuplicate event |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $content = $modx->db->getRow($rs); |
| 64 | 64 | |
| 65 | 65 | // Handle incremental ID |
| 66 | - switch($modx->config['docid_incrmnt_method']) |
|
| 66 | + switch ($modx->config['docid_incrmnt_method']) |
|
| 67 | 67 | { |
| 68 | 68 | case '1': |
| 69 | 69 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $content['id'] = $modx->db->getValue($rs); |
| 72 | 72 | break; |
| 73 | 73 | case '2': |
| 74 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
| 74 | + $rs = $modx->db->select('MAX(id)+1', $tblsc); |
|
| 75 | 75 | $content['id'] = $modx->db->getValue($rs); |
| 76 | 76 | break; |
| 77 | 77 | |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
| 86 | 86 | $pagetitle = $modx->db->escape($pagetitle); |
| 87 | 87 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
| 88 | - if($count>=1) $count = ' '.($count+1); |
|
| 88 | + if ($count >= 1) $count = ' '.($count + 1); |
|
| 89 | 89 | else $count = ''; |
| 90 | 90 | |
| 91 | 91 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
| 92 | 92 | $content['alias'] = null; |
| 93 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
| 93 | + } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
| 94 | 94 | $content['alias'] = null; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
| 155 | 155 | |
| 156 | - $newid = (int)$newid; |
|
| 157 | - $oldid = (int)$oldid; |
|
| 156 | + $newid = (int) $newid; |
|
| 157 | + $oldid = (int) $oldid; |
|
| 158 | 158 | |
| 159 | 159 | $modx->db->insert( |
| 160 | 160 | array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $tbldg = $modx->getFullTableName('document_groups'); |
| 175 | 175 | |
| 176 | - $newid = (int)$newid; |
|
| 177 | - $oldid = (int)$oldid; |
|
| 176 | + $newid = (int) $newid; |
|
| 177 | + $oldid = (int) $oldid; |
|
| 178 | 178 | |
| 179 | 179 | $modx->db->insert( |
| 180 | 180 | array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
@@ -42,7 +42,8 @@ discard block |
||
| 42 | 42 | * @param int $_toplevel |
| 43 | 43 | * @return int |
| 44 | 44 | */ |
| 45 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
| 45 | +function duplicateDocument($docid, $parent=null, $_toplevel=0) |
|
| 46 | +{ |
|
| 46 | 47 | $modx = evolutionCMS(); global $_lang; |
| 47 | 48 | |
| 48 | 49 | // invoke OnBeforeDocDuplicate event |
@@ -63,8 +64,7 @@ discard block |
||
| 63 | 64 | $content = $modx->db->getRow($rs); |
| 64 | 65 | |
| 65 | 66 | // Handle incremental ID |
| 66 | - switch($modx->config['docid_incrmnt_method']) |
|
| 67 | - { |
|
| 67 | + switch($modx->config['docid_incrmnt_method']) { |
|
| 68 | 68 | case '1': |
| 69 | 69 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
| 70 | 70 | $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
@@ -85,8 +85,11 @@ discard block |
||
| 85 | 85 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
| 86 | 86 | $pagetitle = $modx->db->escape($pagetitle); |
| 87 | 87 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
| 88 | - if($count>=1) $count = ' '.($count+1); |
|
| 89 | - else $count = ''; |
|
| 88 | + if($count>=1) { |
|
| 89 | + $count = ' '.($count+1); |
|
| 90 | + } else { |
|
| 91 | + $count = ''; |
|
| 92 | + } |
|
| 90 | 93 | |
| 91 | 94 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
| 92 | 95 | $content['alias'] = null; |
@@ -95,7 +98,9 @@ discard block |
||
| 95 | 98 | } |
| 96 | 99 | |
| 97 | 100 | // change the parent accordingly |
| 98 | - if ($parent !== null) $content['parent'] = $parent; |
|
| 101 | + if ($parent !== null) { |
|
| 102 | + $content['parent'] = $parent; |
|
| 103 | + } |
|
| 99 | 104 | |
| 100 | 105 | // Change the author |
| 101 | 106 | $content['createdby'] = $userID; |
@@ -135,8 +140,9 @@ discard block |
||
| 135 | 140 | // Start duplicating all the child documents that aren't deleted. |
| 136 | 141 | $_toplevel++; |
| 137 | 142 | $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
| 138 | - while ($row = $modx->db->getRow($rs)) |
|
| 139 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
| 143 | + while ($row = $modx->db->getRow($rs)) { |
|
| 144 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
| 145 | + } |
|
| 140 | 146 | |
| 141 | 147 | // return the new doc id |
| 142 | 148 | return $newparent; |
@@ -148,7 +154,8 @@ discard block |
||
| 148 | 154 | * @param int $oldid |
| 149 | 155 | * @param int $newid |
| 150 | 156 | */ |
| 151 | -function duplicateTVs($oldid, $newid){ |
|
| 157 | +function duplicateTVs($oldid, $newid) |
|
| 158 | +{ |
|
| 152 | 159 | $modx = evolutionCMS(); |
| 153 | 160 | |
| 154 | 161 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -168,7 +175,8 @@ discard block |
||
| 168 | 175 | * @param int $oldid |
| 169 | 176 | * @param int $newid |
| 170 | 177 | */ |
| 171 | -function duplicateAccess($oldid, $newid){ |
|
| 178 | +function duplicateAccess($oldid, $newid) |
|
| 179 | +{ |
|
| 172 | 180 | $modx = evolutionCMS(); |
| 173 | 181 | |
| 174 | 182 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | -if($_SESSION['mgrRole']!=1){ |
|
| 15 | +if($_SESSION['mgrRole']!=1) { |
|
| 16 | 16 | $rs = $modx->db->select( |
| 17 | 17 | 'sma.usergroup,mg.member', |
| 18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -70,7 +70,8 @@ discard block |
||
| 70 | 70 | * @param array $params |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | -function evalModule($moduleCode,$params){ |
|
| 73 | +function evalModule($moduleCode,$params) |
|
| 74 | +{ |
|
| 74 | 75 | $modx = evolutionCMS(); |
| 75 | 76 | $modx->event->params = &$params; // store params inside event object |
| 76 | 77 | if(is_array($params)) { |
@@ -80,11 +81,9 @@ discard block |
||
| 80 | 81 | $mod = eval($moduleCode); |
| 81 | 82 | $msg = ob_get_contents(); |
| 82 | 83 | ob_end_clean(); |
| 83 | - if (isset($php_errormsg)) |
|
| 84 | - { |
|
| 84 | + if (isset($php_errormsg)) { |
|
| 85 | 85 | $error_info = error_get_last(); |
| 86 | - switch($error_info['type']) |
|
| 87 | - { |
|
| 86 | + switch($error_info['type']) { |
|
| 88 | 87 | case E_NOTICE : |
| 89 | 88 | $error_level = 1; |
| 90 | 89 | case E_USER_NOTICE : |
@@ -97,8 +96,7 @@ discard block |
||
| 97 | 96 | default: |
| 98 | 97 | $error_level = 99; |
| 99 | 98 | } |
| 100 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 101 | - { |
|
| 99 | + if($modx->config['error_reporting']==='99' || 2<$error_level) { |
|
| 102 | 100 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
| 103 | 101 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
| 104 | 102 | } |
@@ -3,51 +3,51 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('exec_module')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | 15 | if($_SESSION['mgrRole']!=1){ |
| 16 | - $rs = $modx->db->select( |
|
| 17 | - 'sma.usergroup,mg.member', |
|
| 18 | - $modx->getFullTableName("site_module_access")." sma |
|
| 16 | + $rs = $modx->db->select( |
|
| 17 | + 'sma.usergroup,mg.member', |
|
| 18 | + $modx->getFullTableName("site_module_access")." sma |
|
| 19 | 19 | LEFT JOIN ".$modx->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'", |
| 20 | - "sma.module = '{$id}'" |
|
| 21 | - ); |
|
| 22 | - //initialize permission to -1, if it stays -1 no permissions |
|
| 23 | - //attached so permission granted |
|
| 24 | - $permissionAccessInt = -1; |
|
| 20 | + "sma.module = '{$id}'" |
|
| 21 | + ); |
|
| 22 | + //initialize permission to -1, if it stays -1 no permissions |
|
| 23 | + //attached so permission granted |
|
| 24 | + $permissionAccessInt = -1; |
|
| 25 | 25 | |
| 26 | - while ($row = $modx->db->getRow($rs)) { |
|
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 28 | - //if there are permissions and this member has permission, ofcourse |
|
| 29 | - //this is granted |
|
| 30 | - $permissionAccessInt = 1; |
|
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 32 | - //if there are permissions but this member has no permission and the |
|
| 33 | - //variable was still in init state we set permission to 0; no permissions |
|
| 34 | - $permissionAccessInt = 0; |
|
| 35 | - } |
|
| 36 | - } |
|
| 26 | + while ($row = $modx->db->getRow($rs)) { |
|
| 27 | + if($row["usergroup"] && $row["member"]) { |
|
| 28 | + //if there are permissions and this member has permission, ofcourse |
|
| 29 | + //this is granted |
|
| 30 | + $permissionAccessInt = 1; |
|
| 31 | + } elseif ($permissionAccessInt==-1) { |
|
| 32 | + //if there are permissions but this member has no permission and the |
|
| 33 | + //variable was still in init state we set permission to 0; no permissions |
|
| 34 | + $permissionAccessInt = 0; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 39 | - $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
| 40 | - } |
|
| 38 | + if($permissionAccessInt==0) { |
|
| 39 | + $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | 46 | if(!$content) { |
| 47 | - $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
| 47 | + $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
| 48 | 48 | } |
| 49 | 49 | if($content['disabled']) { |
| 50 | - $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
| 50 | + $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $output = evalModule($content["modulecode"],$parameter); |
| 64 | 64 | if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
| 65 | - echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
| 65 | + echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
| 66 | 66 | } |
| 67 | 67 | echo $output; |
| 68 | 68 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
@@ -75,38 +75,38 @@ discard block |
||
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | 77 | function evalModule($moduleCode,$params){ |
| 78 | - $modx = evolutionCMS(); |
|
| 79 | - $modx->event->params = &$params; // store params inside event object |
|
| 80 | - if(is_array($params)) { |
|
| 81 | - extract($params, EXTR_SKIP); |
|
| 82 | - } |
|
| 83 | - ob_start(); |
|
| 84 | - $mod = eval($moduleCode); |
|
| 85 | - $msg = ob_get_contents(); |
|
| 86 | - ob_end_clean(); |
|
| 87 | - if (isset($php_errormsg)) |
|
| 88 | - { |
|
| 89 | - $error_info = error_get_last(); |
|
| 78 | + $modx = evolutionCMS(); |
|
| 79 | + $modx->event->params = &$params; // store params inside event object |
|
| 80 | + if(is_array($params)) { |
|
| 81 | + extract($params, EXTR_SKIP); |
|
| 82 | + } |
|
| 83 | + ob_start(); |
|
| 84 | + $mod = eval($moduleCode); |
|
| 85 | + $msg = ob_get_contents(); |
|
| 86 | + ob_end_clean(); |
|
| 87 | + if (isset($php_errormsg)) |
|
| 88 | + { |
|
| 89 | + $error_info = error_get_last(); |
|
| 90 | 90 | switch($error_info['type']) |
| 91 | 91 | { |
| 92 | - case E_NOTICE : |
|
| 93 | - $error_level = 1; |
|
| 94 | - case E_USER_NOTICE : |
|
| 95 | - break; |
|
| 96 | - case E_DEPRECATED : |
|
| 97 | - case E_USER_DEPRECATED : |
|
| 98 | - case E_STRICT : |
|
| 99 | - $error_level = 2; |
|
| 100 | - break; |
|
| 101 | - default: |
|
| 102 | - $error_level = 99; |
|
| 92 | + case E_NOTICE : |
|
| 93 | + $error_level = 1; |
|
| 94 | + case E_USER_NOTICE : |
|
| 95 | + break; |
|
| 96 | + case E_DEPRECATED : |
|
| 97 | + case E_USER_DEPRECATED : |
|
| 98 | + case E_STRICT : |
|
| 99 | + $error_level = 2; |
|
| 100 | + break; |
|
| 101 | + default: |
|
| 102 | + $error_level = 99; |
|
| 103 | + } |
|
| 104 | + if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 105 | + { |
|
| 106 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | + $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
| 103 | 108 | } |
| 104 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 105 | - { |
|
| 106 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | - $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - unset($modx->event->params); |
|
| 111 | - return $mod.$msg; |
|
| 109 | + } |
|
| 110 | + unset($modx->event->params); |
|
| 111 | + return $mod.$msg; |
|
| 112 | 112 | } |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | -if(!$modx->hasPermission('exec_module')) { |
|
| 5 | +if (!$modx->hasPermission('exec_module')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | -if($_SESSION['mgrRole']!=1){ |
|
| 15 | +if ($_SESSION['mgrRole'] != 1) { |
|
| 16 | 16 | $rs = $modx->db->select( |
| 17 | 17 | 'sma.usergroup,mg.member', |
| 18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | $permissionAccessInt = -1; |
| 25 | 25 | |
| 26 | 26 | while ($row = $modx->db->getRow($rs)) { |
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 27 | + if ($row["usergroup"] && $row["member"]) { |
|
| 28 | 28 | //if there are permissions and this member has permission, ofcourse |
| 29 | 29 | //this is granted |
| 30 | 30 | $permissionAccessInt = 1; |
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 31 | + } elseif ($permissionAccessInt == -1) { |
|
| 32 | 32 | //if there are permissions but this member has no permission and the |
| 33 | 33 | //variable was still in init state we set permission to 0; no permissions |
| 34 | 34 | $permissionAccessInt = 0; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 38 | + if ($permissionAccessInt == 0) { |
|
| 39 | 39 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | -if(!$content) { |
|
| 46 | +if (!$content) { |
|
| 47 | 47 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
| 48 | 48 | } |
| 49 | -if($content['disabled']) { |
|
| 49 | +if ($content['disabled']) { |
|
| 50 | 50 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $_SESSION['itemname'] = $content['name']; |
| 61 | 61 | |
| 62 | 62 | |
| 63 | -$output = evalModule($content["modulecode"],$parameter); |
|
| 64 | -if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
|
| 63 | +$output = evalModule($content["modulecode"], $parameter); |
|
| 64 | +if (strpos(trim($output), '<') === 0 && strpos(trim($output), '<?xml') !== 0) { |
|
| 65 | 65 | echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
| 66 | 66 | } |
| 67 | 67 | echo $output; |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @param array $params |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | -function evalModule($moduleCode,$params){ |
|
| 77 | +function evalModule($moduleCode, $params){ |
|
| 78 | 78 | $modx = evolutionCMS(); |
| 79 | 79 | $modx->event->params = &$params; // store params inside event object |
| 80 | - if(is_array($params)) { |
|
| 80 | + if (is_array($params)) { |
|
| 81 | 81 | extract($params, EXTR_SKIP); |
| 82 | 82 | } |
| 83 | 83 | ob_start(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if (isset($php_errormsg)) |
| 88 | 88 | { |
| 89 | 89 | $error_info = error_get_last(); |
| 90 | - switch($error_info['type']) |
|
| 90 | + switch ($error_info['type']) |
|
| 91 | 91 | { |
| 92 | 92 | case E_NOTICE : |
| 93 | 93 | $error_level = 1; |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | default: |
| 102 | 102 | $error_level = 99; |
| 103 | 103 | } |
| 104 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 104 | + if ($modx->config['error_reporting'] === '99' || 2 < $error_level) |
|
| 105 | 105 | { |
| 106 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 106 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | 107 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -4,14 +4,14 @@ discard block |
||
| 4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -if( ! function_exists('evolutionCMS')) {
|
|
| 7 | +if (!function_exists('evolutionCMS')) {
|
|
| 8 | 8 | /** |
| 9 | 9 | * @return DocumentParser |
| 10 | 10 | */ |
| 11 | 11 | function evolutionCMS() |
| 12 | 12 | {
|
| 13 | - if( ! defined('MODX_CLASS')) {
|
|
| 14 | - if( ! class_exists('DocumentParser')) {
|
|
| 13 | + if (!defined('MODX_CLASS')) {
|
|
| 14 | + if (!class_exists('DocumentParser')) {
|
|
| 15 | 15 | throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
|
| 16 | 16 | } |
| 17 | 17 | define('MODX_CLASS', 'DocumentParser');
|
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $_ = crc32(__FILE__); |
| 30 | 30 | $_ = sprintf('%u', $_);
|
| 31 | 31 | |
| 32 | - return 'evo' . base_convert($_, 10, 36); |
|
| 32 | + return 'evo'.base_convert($_, 10, 36); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | function startCMSSession() |
| 39 | 39 | {
|
| 40 | 40 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
| 41 | - if(MODX_CLI) return; |
|
| 41 | + if (MODX_CLI) return; |
|
| 42 | 42 | |
| 43 | 43 | session_name($site_sessionname); |
| 44 | 44 | removeInvalidCmsSessionIds($site_sessionname); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | session_start(); |
| 51 | 51 | $key = "modx.mgr.session.cookie.lifetime"; |
| 52 | 52 | if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
|
| 53 | - $cookieLifetime = (int)$_SESSION[$key]; |
|
| 53 | + $cookieLifetime = (int) $_SESSION[$key]; |
|
| 54 | 54 | if ($cookieLifetime) {
|
| 55 | 55 | $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
| 56 | 56 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | function removeInvalidCmsSessionIds($session_name) |
| 81 | 81 | {
|
| 82 | - if(MODX_CLI) return; |
|
| 82 | + if (MODX_CLI) return; |
|
| 83 | 83 | // session ids is invalid iff it is empty string |
| 84 | 84 | // storage priorioty can see in PHP source ext/session/session.c |
| 85 | 85 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -4,14 +4,14 @@ discard block |
||
| 4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -if( ! function_exists('evolutionCMS')) {
|
|
| 7 | +if( ! function_exists('evolutionCMS')) { |
|
| 8 | 8 | /** |
| 9 | 9 | * @return DocumentParser |
| 10 | 10 | */ |
| 11 | - function evolutionCMS() |
|
| 12 | - {
|
|
| 13 | - if( ! defined('MODX_CLASS')) {
|
|
| 14 | - if( ! class_exists('DocumentParser')) {
|
|
| 11 | + function evolutionCMS() |
|
| 12 | + { |
|
| 13 | + if( ! defined('MODX_CLASS')) { |
|
| 14 | + if( ! class_exists('DocumentParser')) { |
|
| 15 | 15 | throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
|
| 16 | 16 | } |
| 17 | 17 | define('MODX_CLASS', 'DocumentParser');
|
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @return string |
| 26 | 26 | */ |
| 27 | -function genEvoSessionName() |
|
| 28 | -{
|
|
| 27 | +function genEvoSessionName() |
|
| 28 | +{ |
|
| 29 | 29 | $_ = crc32(__FILE__); |
| 30 | 30 | $_ = sprintf('%u', $_);
|
| 31 | 31 | |
@@ -35,10 +35,12 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | -function startCMSSession() |
|
| 39 | -{
|
|
| 38 | +function startCMSSession() |
|
| 39 | +{ |
|
| 40 | 40 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
| 41 | - if(MODX_CLI) return; |
|
| 41 | + if(MODX_CLI) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | session_name($site_sessionname); |
| 44 | 46 | removeInvalidCmsSessionIds($site_sessionname); |
@@ -49,14 +51,14 @@ discard block |
||
| 49 | 51 | session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
| 50 | 52 | session_start(); |
| 51 | 53 | $key = "modx.mgr.session.cookie.lifetime"; |
| 52 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
|
|
| 54 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
| 53 | 55 | $cookieLifetime = (int)$_SESSION[$key]; |
| 54 | - if ($cookieLifetime) {
|
|
| 56 | + if ($cookieLifetime) { |
|
| 55 | 57 | $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
| 56 | 58 | } |
| 57 | 59 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
| 58 | 60 | } |
| 59 | - if (!isset($_SESSION['modx.session.created.time'])) {
|
|
| 61 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
| 60 | 62 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
| 61 | 63 | } |
| 62 | 64 | } |
@@ -66,9 +68,9 @@ discard block |
||
| 66 | 68 | * @param $session_name |
| 67 | 69 | * @return void |
| 68 | 70 | */ |
| 69 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
| 70 | -{
|
|
| 71 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
|
|
| 71 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
| 72 | +{ |
|
| 73 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
| 72 | 74 | unset($storage[$session_name]); |
| 73 | 75 | } |
| 74 | 76 | } |
@@ -77,9 +79,11 @@ discard block |
||
| 77 | 79 | * @param $session_name |
| 78 | 80 | * @return void |
| 79 | 81 | */ |
| 80 | -function removeInvalidCmsSessionIds($session_name) |
|
| 81 | -{
|
|
| 82 | - if(MODX_CLI) return; |
|
| 82 | +function removeInvalidCmsSessionIds($session_name) |
|
| 83 | +{ |
|
| 84 | + if(MODX_CLI) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 83 | 87 | // session ids is invalid iff it is empty string |
| 84 | 88 | // storage priorioty can see in PHP source ext/session/session.c |
| 85 | 89 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -492,7 +492,7 @@ |
||
| 492 | 492 | }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
| 493 | 493 | $publishedon = $pub_date; |
| 494 | 494 | $publishedby = $modx->getLoginUserID(); |
| 495 | - }elseif ($was_published && !$published) { |
|
| 495 | + }elseif ($was_published && !$published) { |
|
| 496 | 496 | $publishedon = 0; |
| 497 | 497 | $publishedby = 0; |
| 498 | 498 | } else { |
@@ -280,19 +280,19 @@ |
||
| 280 | 280 | // invoke OnBeforeDocFormSave event |
| 281 | 281 | switch($modx->config['docid_incrmnt_method']) |
| 282 | 282 | { |
| 283 | - case '1': |
|
| 284 | - $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
| 285 | - $where = "T1.id IS NULL"; |
|
| 286 | - $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
| 287 | - $id = $modx->db->getValue($rs); |
|
| 283 | + case '1': |
|
| 284 | + $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
| 285 | + $where = "T1.id IS NULL"; |
|
| 286 | + $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
| 287 | + $id = $modx->db->getValue($rs); |
|
| 288 | + break; |
|
| 289 | + case '2': |
|
| 290 | + $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
| 291 | + $id = $modx->db->getValue($rs); |
|
| 288 | 292 | break; |
| 289 | - case '2': |
|
| 290 | - $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
| 291 | - $id = $modx->db->getValue($rs); |
|
| 292 | - break; |
|
| 293 | 293 | |
| 294 | - default: |
|
| 295 | - $id = ''; |
|
| 294 | + default: |
|
| 295 | + $id = ''; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | $modx->invokeEvent("OnBeforeDocFormSave", array( |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | case 'new' : |
| 279 | 279 | |
| 280 | 280 | // invoke OnBeforeDocFormSave event |
| 281 | - switch($modx->config['docid_incrmnt_method']) |
|
| 281 | + switch ($modx->config['docid_incrmnt_method']) |
|
| 282 | 282 | { |
| 283 | 283 | case '1': |
| 284 | 284 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | if (!$was_published && $published) { |
| 490 | 490 | $publishedon = $currentdate; |
| 491 | 491 | $publishedby = $modx->getLoginUserID(); |
| 492 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
| 492 | + }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) { |
|
| 493 | 493 | $publishedon = $pub_date; |
| 494 | 494 | $publishedby = $modx->getLoginUserID(); |
| 495 | 495 | }elseif ($was_published && !$published) { |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | // invoke OnBeforeDocFormSave event |
| 504 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
| 504 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
| 505 | 505 | "mode" => "upd", |
| 506 | 506 | "id" => $id |
| 507 | 507 | )); |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | . "menuindex={$menuindex}, " |
| 527 | 527 | . "searchable={$searchable}, " |
| 528 | 528 | . "cacheable={$cacheable}, " |
| 529 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
| 529 | + . "editedby=".$modx->getLoginUserID().", " |
|
| 530 | 530 | . "editedon={$currentdate}, " |
| 531 | 531 | . "publishedon={$publishedon}, " |
| 532 | 532 | . "publishedby={$publishedby}, " |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | // update template variables |
| 542 | 542 | $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
| 543 | - $tvIds = array (); |
|
| 543 | + $tvIds = array(); |
|
| 544 | 544 | while ($row = $modx->db->getRow($rs)) { |
| 545 | 545 | $tvIds[$row['tmplvarid']] = $row['id']; |
| 546 | 546 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | 'groups.id, groups.document_group', |
| 594 | 594 | "{$tbl_document_groups} AS groups |
| 595 | 595 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
| 596 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
| 596 | + "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
| 597 | 597 | ); |
| 598 | 598 | $old_groups = array(); |
| 599 | 599 | while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | unset($old_groups[$group]); |
| 606 | 606 | continue; |
| 607 | 607 | } elseif ($link_id == 'new') { |
| 608 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
| 608 | + $insertions[] = '('.(int) $group.','.$id.')'; |
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | if (!empty($insertions)) { |
@@ -637,17 +637,17 @@ discard block |
||
| 637 | 637 | |
| 638 | 638 | |
| 639 | 639 | // invoke OnDocFormSave event |
| 640 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
| 640 | + $modx->invokeEvent("OnDocFormSave", array( |
|
| 641 | 641 | "mode" => "upd", |
| 642 | 642 | "id" => $id |
| 643 | 643 | )); |
| 644 | 644 | |
| 645 | 645 | // secure web documents - flag as private |
| 646 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
| 646 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
| 647 | 647 | secureWebDocument($id); |
| 648 | 648 | |
| 649 | 649 | // secure manager documents - flag as private |
| 650 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
| 650 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
| 651 | 651 | secureMgrDocument($id); |
| 652 | 652 | |
| 653 | 653 | // Set the item name for logger |
@@ -673,13 +673,13 @@ discard block |
||
| 673 | 673 | // document |
| 674 | 674 | $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
| 675 | 675 | } |
| 676 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
| 676 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path; |
|
| 677 | 677 | } else { |
| 678 | 678 | $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | if (headers_sent()) { |
| 682 | - $header = str_replace('Location: ','',$header); |
|
| 682 | + $header = str_replace('Location: ', '', $header); |
|
| 683 | 683 | echo "<script>document.location.href='$header';</script>\n"; |
| 684 | 684 | } else { |
| 685 | 685 | header($header); |
@@ -134,8 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | //end webber |
| 136 | 136 | } |
| 137 | -} |
|
| 138 | -elseif ($alias) { |
|
| 137 | +} elseif ($alias) { |
|
| 139 | 138 | $alias = $modx->stripAlias($alias); |
| 140 | 139 | } |
| 141 | 140 | |
@@ -149,8 +148,7 @@ discard block |
||
| 149 | 148 | |
| 150 | 149 | if ($pub_date < $currentdate) { |
| 151 | 150 | $published = 1; |
| 152 | - } |
|
| 153 | - elseif ($pub_date > $currentdate) { |
|
| 151 | + } elseif ($pub_date > $currentdate) { |
|
| 154 | 152 | $published = 0; |
| 155 | 153 | } |
| 156 | 154 | } |
@@ -278,8 +276,7 @@ discard block |
||
| 278 | 276 | case 'new' : |
| 279 | 277 | |
| 280 | 278 | // invoke OnBeforeDocFormSave event |
| 281 | - switch($modx->config['docid_incrmnt_method']) |
|
| 282 | - { |
|
| 279 | + switch($modx->config['docid_incrmnt_method']) { |
|
| 283 | 280 | case '1': |
| 284 | 281 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
| 285 | 282 | $where = "T1.id IS NULL"; |
@@ -347,8 +344,9 @@ discard block |
||
| 347 | 344 | "alias_visible" => $aliasvisible |
| 348 | 345 | ); |
| 349 | 346 | |
| 350 | - if ($id != '') |
|
| 351 | - $dbInsert["id"] = $id; |
|
| 347 | + if ($id != '') { |
|
| 348 | + $dbInsert["id"] = $id; |
|
| 349 | + } |
|
| 352 | 350 | |
| 353 | 351 | $key = $modx->db->insert($dbInsert, $tbl_site_content); |
| 354 | 352 | |
@@ -424,11 +422,13 @@ discard block |
||
| 424 | 422 | // redirect/stay options |
| 425 | 423 | if ($_POST['stay'] != '') { |
| 426 | 424 | // weblink |
| 427 | - if ($_POST['mode'] == "72") |
|
| 428 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
| 425 | + if ($_POST['mode'] == "72") { |
|
| 426 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
| 427 | + } |
|
| 429 | 428 | // document |
| 430 | - if ($_POST['mode'] == "4") |
|
| 431 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
| 429 | + if ($_POST['mode'] == "4") { |
|
| 430 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
| 431 | + } |
|
| 432 | 432 | $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay']; |
| 433 | 433 | } else { |
| 434 | 434 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -489,10 +489,10 @@ discard block |
||
| 489 | 489 | if (!$was_published && $published) { |
| 490 | 490 | $publishedon = $currentdate; |
| 491 | 491 | $publishedby = $modx->getLoginUserID(); |
| 492 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
| 492 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
| 493 | 493 | $publishedon = $pub_date; |
| 494 | 494 | $publishedby = $modx->getLoginUserID(); |
| 495 | - }elseif ($was_published && !$published) { |
|
| 495 | + } elseif ($was_published && !$published) { |
|
| 496 | 496 | $publishedon = 0; |
| 497 | 497 | $publishedby = 0; |
| 498 | 498 | } else { |
@@ -548,7 +548,9 @@ discard block |
||
| 548 | 548 | $tvChanges = array(); |
| 549 | 549 | foreach ($tmplvars as $field => $value) { |
| 550 | 550 | if (!is_array($value)) { |
| 551 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
| 551 | + if (isset($tvIds[$value])) { |
|
| 552 | + $tvDeletions[] = $tvIds[$value]; |
|
| 553 | + } |
|
| 552 | 554 | } else { |
| 553 | 555 | $tvId = $value[0]; |
| 554 | 556 | $tvVal = $value[1]; |
@@ -596,7 +598,9 @@ discard block |
||
| 596 | 598 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
| 597 | 599 | ); |
| 598 | 600 | $old_groups = array(); |
| 599 | - while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
| 601 | + while ($row = $modx->db->getRow($rs)) { |
|
| 602 | + $old_groups[$row['document_group']] = $row['id']; |
|
| 603 | + } |
|
| 600 | 604 | |
| 601 | 605 | // update the permissions in the database |
| 602 | 606 | $insertions = $deletions = array(); |
@@ -658,9 +662,9 @@ discard block |
||
| 658 | 662 | $modx->clearCache('full'); |
| 659 | 663 | } |
| 660 | 664 | |
| 661 | - if ($_POST['refresh_preview'] == '1') |
|
| 662 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
| 663 | - else { |
|
| 665 | + if ($_POST['refresh_preview'] == '1') { |
|
| 666 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
| 667 | + } else { |
|
| 664 | 668 | if ($_POST['stay'] != '2' && $id > 0) { |
| 665 | 669 | $modx->unlockElement(7, $id); |
| 666 | 670 | } |