@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if (IN_MANAGER_MODE!="true") { |
|
2 | +if (IN_MANAGER_MODE != "true") { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_plugin') && !$modx->hasPermission('save_snippet') && !$modx->hasPermission('save_template') && !$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['catId'])? intval($_GET['catId']) : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['catId']) ? intval($_GET['catId']) : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | deleteCategory($id); |
20 | 20 | |
21 | 21 | // finished emptying cache - redirect |
22 | -$header="Location: index.php?a=76"; |
|
22 | +$header = "Location: index.php?a=76"; |
|
23 | 23 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_document')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /************ webber ********/ |
@@ -30,50 +30,50 @@ discard block |
||
30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
31 | 31 | |
32 | 32 | if(!$udperms->checkPermissions()) { |
33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // get the timestamp on which the document was deleted. |
37 | 37 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
38 | 38 | $deltime = $modx->db->getValue($rs); |
39 | 39 | if(!$deltime) { |
40 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
40 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $children = array(); |
44 | 44 | |
45 | 45 | function getChildren($parent) { |
46 | 46 | |
47 | - global $modx; |
|
48 | - global $children; |
|
49 | - global $deltime; |
|
47 | + global $modx; |
|
48 | + global $children; |
|
49 | + global $deltime; |
|
50 | 50 | |
51 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
|
52 | - // the document has children documents, we'll need to delete those too |
|
53 | - while ($row=$modx->db->getRow($rs)) { |
|
54 | - $children[] = $row['id']; |
|
55 | - getChildren($row['id']); |
|
56 | - //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
57 | - } |
|
51 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
|
52 | + // the document has children documents, we'll need to delete those too |
|
53 | + while ($row=$modx->db->getRow($rs)) { |
|
54 | + $children[] = $row['id']; |
|
55 | + getChildren($row['id']); |
|
56 | + //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | getChildren($id); |
61 | 61 | |
62 | 62 | if(count($children)>0) { |
63 | - $modx->db->update( |
|
64 | - array( |
|
65 | - 'deleted' => 0, |
|
66 | - 'deletedby' => 0, |
|
67 | - 'deletedon' => 0, |
|
68 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
63 | + $modx->db->update( |
|
64 | + array( |
|
65 | + 'deleted' => 0, |
|
66 | + 'deletedby' => 0, |
|
67 | + 'deletedon' => 0, |
|
68 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
69 | 69 | } |
70 | 70 | //'undelete' the document. |
71 | 71 | $modx->db->update( |
72 | - array( |
|
73 | - 'deleted' => 0, |
|
74 | - 'deletedby' => 0, |
|
75 | - 'deletedon' => 0, |
|
76 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
72 | + array( |
|
73 | + 'deleted' => 0, |
|
74 | + 'deletedby' => 0, |
|
75 | + 'deletedon' => 0, |
|
76 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
77 | 77 | |
78 | 78 | $modx->invokeEvent("OnDocFormUnDelete", |
79 | 79 | array( |
@@ -1,48 +1,48 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_document')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_document')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | /************ webber ********/ |
13 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
14 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
13 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
14 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
15 | 15 | |
16 | 16 | /************** webber *************/ |
17 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
18 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
19 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
20 | -$add_path=$sd.$sb.$pg; |
|
17 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
18 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
19 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
20 | +$add_path = $sd.$sb.$pg; |
|
21 | 21 | |
22 | 22 | /***********************************/ |
23 | 23 | |
24 | 24 | |
25 | 25 | // check permissions on the document |
26 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
26 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
27 | 27 | $udperms = new udperms(); |
28 | 28 | $udperms->user = $modx->getLoginUserID(); |
29 | 29 | $udperms->document = $id; |
30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
31 | 31 | |
32 | -if(!$udperms->checkPermissions()) { |
|
32 | +if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | |
36 | 36 | // get the timestamp on which the document was deleted. |
37 | 37 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
38 | 38 | $deltime = $modx->db->getValue($rs); |
39 | -if(!$deltime) { |
|
39 | +if (!$deltime) { |
|
40 | 40 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
41 | 41 | } |
42 | 42 | |
43 | 43 | $children = array(); |
44 | 44 | |
45 | -function getChildren($parent) { |
|
45 | +function getChildren($parent){ |
|
46 | 46 | |
47 | 47 | global $modx; |
48 | 48 | global $children; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
52 | 52 | // the document has children documents, we'll need to delete those too |
53 | - while ($row=$modx->db->getRow($rs)) { |
|
53 | + while ($row = $modx->db->getRow($rs)) { |
|
54 | 54 | $children[] = $row['id']; |
55 | 55 | getChildren($row['id']); |
56 | 56 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | getChildren($id); |
61 | 61 | |
62 | -if(count($children)>0) { |
|
62 | +if (count($children) > 0) { |
|
63 | 63 | $modx->db->update( |
64 | 64 | array( |
65 | 65 | 'deleted' => 0, |
@@ -88,5 +88,5 @@ discard block |
||
88 | 88 | $modx->clearCache('full'); |
89 | 89 | |
90 | 90 | // finished emptying cache - redirect |
91 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
91 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
92 | 92 | header($header); |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_document')) { |
|
2 | +if(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."); |
|
4 | +} |
|
5 | +if(!$modx->hasPermission('delete_document')) { |
|
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
6 | 8 | |
@@ -42,7 +44,8 @@ discard block |
||
42 | 44 | |
43 | 45 | $children = array(); |
44 | 46 | |
45 | -function getChildren($parent) { |
|
47 | +function getChildren($parent) |
|
48 | +{ |
|
46 | 49 | |
47 | 50 | global $modx; |
48 | 51 | global $children; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('settings')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | $data = $_POST; |
7 | 7 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -9,41 +9,41 @@ discard block |
||
9 | 9 | |
10 | 10 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
11 | 11 | { |
12 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
13 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
14 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
15 | - if(is_file($htaccess)) |
|
16 | - { |
|
17 | - $_ = file_get_contents($htaccess); |
|
18 | - if(strpos($_,'RewriteBase')===false) |
|
19 | - { |
|
20 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
21 | - } |
|
22 | - elseif(is_writable($htaccess)) |
|
23 | - { |
|
24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
25 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | - { |
|
27 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
28 | - } |
|
29 | - } |
|
30 | - } |
|
31 | - elseif(is_file($sample_htaccess)) |
|
32 | - { |
|
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
12 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
13 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
14 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
15 | + if(is_file($htaccess)) |
|
16 | + { |
|
17 | + $_ = file_get_contents($htaccess); |
|
18 | + if(strpos($_,'RewriteBase')===false) |
|
34 | 19 | { |
35 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
36 | - } |
|
37 | - elseif($modx->config['base_url']!=='/') |
|
38 | - { |
|
39 | - $_ = file_get_contents($htaccess); |
|
40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
41 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | - { |
|
43 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
44 | - } |
|
45 | - } |
|
46 | - } |
|
20 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
21 | + } |
|
22 | + elseif(is_writable($htaccess)) |
|
23 | + { |
|
24 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
25 | + if(!@file_put_contents($htaccess,$_)) |
|
26 | + { |
|
27 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
28 | + } |
|
29 | + } |
|
30 | + } |
|
31 | + elseif(is_file($sample_htaccess)) |
|
32 | + { |
|
33 | + if(!@rename($sample_htaccess,$htaccess)) |
|
34 | + { |
|
35 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
36 | + } |
|
37 | + elseif($modx->config['base_url']!=='/') |
|
38 | + { |
|
39 | + $_ = file_get_contents($htaccess); |
|
40 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
41 | + if(!@file_put_contents($htaccess,$_)) |
|
42 | + { |
|
43 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
44 | + } |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
55 | 55 | |
56 | 56 | if (isset($data) && count($data) > 0) { |
57 | - if(isset($data['manager_language'])) { |
|
58 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
59 | - if(is_file($lang_path)) { |
|
60 | - include($lang_path); |
|
57 | + if(isset($data['manager_language'])) { |
|
58 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
59 | + if(is_file($lang_path)) { |
|
60 | + include($lang_path); |
|
61 | 61 | global $modx_lang_attribute; |
62 | 62 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
63 | - } |
|
64 | - } |
|
65 | - $savethese = array(); |
|
66 | - $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
|
67 | - $data['mail_check_timeperiod'] = intval($data['mail_check_timeperiod']) < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
68 | - foreach ($data as $k => $v) { |
|
69 | - switch ($k) { |
|
63 | + } |
|
64 | + } |
|
65 | + $savethese = array(); |
|
66 | + $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
|
67 | + $data['mail_check_timeperiod'] = intval($data['mail_check_timeperiod']) < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
68 | + foreach ($data as $k => $v) { |
|
69 | + switch ($k) { |
|
70 | 70 | case 'settings_version':{ |
71 | 71 | if($modx->getVersionData('version')!=$data['settings_version']){ |
72 | 72 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -74,24 +74,24 @@ discard block |
||
74 | 74 | } |
75 | 75 | break; |
76 | 76 | } |
77 | - case 'error_page': |
|
78 | - case 'unauthorized_page': |
|
79 | - if (trim($v) == '' || !is_numeric($v)) { |
|
80 | - $v = $data['site_start']; |
|
81 | - } |
|
82 | - break; |
|
77 | + case 'error_page': |
|
78 | + case 'unauthorized_page': |
|
79 | + if (trim($v) == '' || !is_numeric($v)) { |
|
80 | + $v = $data['site_start']; |
|
81 | + } |
|
82 | + break; |
|
83 | 83 | |
84 | - case 'lst_custom_contenttype': |
|
85 | - case 'txt_custom_contenttype': |
|
86 | - // Skip these |
|
87 | - $k = ''; |
|
88 | - break; |
|
89 | - case 'rb_base_dir': |
|
90 | - case 'rb_base_url': |
|
91 | - case 'filemanager_path': |
|
92 | - $v = trim($v); |
|
93 | - $v = rtrim($v,'/') . '/'; |
|
94 | - break; |
|
84 | + case 'lst_custom_contenttype': |
|
85 | + case 'txt_custom_contenttype': |
|
86 | + // Skip these |
|
87 | + $k = ''; |
|
88 | + break; |
|
89 | + case 'rb_base_dir': |
|
90 | + case 'rb_base_url': |
|
91 | + case 'filemanager_path': |
|
92 | + $v = trim($v); |
|
93 | + $v = rtrim($v,'/') . '/'; |
|
94 | + break; |
|
95 | 95 | case 'manager_language': |
96 | 96 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
97 | 97 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -99,56 +99,56 @@ discard block |
||
99 | 99 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
100 | 100 | $v = 'english'; |
101 | 101 | } |
102 | - break; |
|
103 | - case 'smtppw': |
|
104 | - if ($v !== '********************' && $v !== '') { |
|
105 | - $v = trim($v); |
|
106 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | - $v = str_replace('=','%',$v); |
|
108 | - } elseif ($v === '********************') { |
|
109 | - $k = ''; |
|
110 | - } |
|
111 | - break; |
|
102 | + break; |
|
103 | + case 'smtppw': |
|
104 | + if ($v !== '********************' && $v !== '') { |
|
105 | + $v = trim($v); |
|
106 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | + $v = str_replace('=','%',$v); |
|
108 | + } elseif ($v === '********************') { |
|
109 | + $k = ''; |
|
110 | + } |
|
111 | + break; |
|
112 | 112 | case 'valid_hostnames': |
113 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
114 | - if ($v !== ',') { |
|
115 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
116 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
117 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
118 | - } |
|
119 | - $k = ''; |
|
120 | - break; |
|
121 | - case 'session_timeout': |
|
122 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
123 | - $v = intval($v) < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
124 | - break; |
|
125 | - default: |
|
126 | - break; |
|
127 | - } |
|
128 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
113 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
114 | + if ($v !== ',') { |
|
115 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
116 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
117 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
118 | + } |
|
119 | + $k = ''; |
|
120 | + break; |
|
121 | + case 'session_timeout': |
|
122 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
123 | + $v = intval($v) < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
124 | + break; |
|
125 | + default: |
|
126 | + break; |
|
127 | + } |
|
128 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
129 | 129 | |
130 | - $modx->config[$k] = $v; |
|
130 | + $modx->config[$k] = $v; |
|
131 | 131 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
133 | - } |
|
132 | + if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
133 | + } |
|
134 | 134 | |
135 | - // Run a single query to save all the values |
|
136 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
135 | + // Run a single query to save all the values |
|
136 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
137 | 137 | VALUES ".implode(', ', $savethese); |
138 | - $modx->db->query($sql); |
|
138 | + $modx->db->query($sql); |
|
139 | 139 | |
140 | - // Reset Template Pages |
|
141 | - if (isset($data['reset_template'])) { |
|
142 | - $newtemplate = intval($data['default_template']); |
|
143 | - $oldtemplate = intval($data['old_template']); |
|
144 | - $tbl = $modx->getFullTableName('site_content'); |
|
145 | - $reset = $data['reset_template']; |
|
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | - } |
|
140 | + // Reset Template Pages |
|
141 | + if (isset($data['reset_template'])) { |
|
142 | + $newtemplate = intval($data['default_template']); |
|
143 | + $oldtemplate = intval($data['old_template']); |
|
144 | + $tbl = $modx->getFullTableName('site_content'); |
|
145 | + $reset = $data['reset_template']; |
|
146 | + if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | + else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | + } |
|
149 | 149 | |
150 | - // empty cache |
|
151 | - $modx->clearCache('full'); |
|
150 | + // empty cache |
|
151 | + $modx->clearCache('full'); |
|
152 | 152 | } |
153 | 153 | $header="Location: index.php?a=7&r=10"; |
154 | 154 | header($header); |
@@ -1,44 +1,44 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('settings')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('settings')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | $data = $_POST; |
7 | 7 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
8 | 8 | unset($_POST); |
9 | 9 | |
10 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
10 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
11 | 11 | { |
12 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
13 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
14 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
15 | - if(is_file($htaccess)) |
|
12 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
13 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
14 | + $dir = '/'.trim($modx->config['base_url'], '/'); |
|
15 | + if (is_file($htaccess)) |
|
16 | 16 | { |
17 | 17 | $_ = file_get_contents($htaccess); |
18 | - if(strpos($_,'RewriteBase')===false) |
|
18 | + if (strpos($_, 'RewriteBase') === false) |
|
19 | 19 | { |
20 | 20 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
21 | 21 | } |
22 | - elseif(is_writable($htaccess)) |
|
22 | + elseif (is_writable($htaccess)) |
|
23 | 23 | { |
24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
25 | - if(!@file_put_contents($htaccess,$_)) |
|
24 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
25 | + if (!@file_put_contents($htaccess, $_)) |
|
26 | 26 | { |
27 | 27 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | } |
31 | - elseif(is_file($sample_htaccess)) |
|
31 | + elseif (is_file($sample_htaccess)) |
|
32 | 32 | { |
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
33 | + if (!@rename($sample_htaccess, $htaccess)) |
|
34 | 34 | { |
35 | 35 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
36 | 36 | } |
37 | - elseif($modx->config['base_url']!=='/') |
|
37 | + elseif ($modx->config['base_url'] !== '/') |
|
38 | 38 | { |
39 | 39 | $_ = file_get_contents($htaccess); |
40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
41 | - if(!@file_put_contents($htaccess,$_)) |
|
40 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
41 | + if (!@file_put_contents($htaccess, $_)) |
|
42 | 42 | { |
43 | 43 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
44 | 44 | } |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
50 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
49 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
50 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
51 | 51 | } |
52 | 52 | |
53 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
54 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
53 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
54 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
55 | 55 | |
56 | 56 | if (isset($data) && count($data) > 0) { |
57 | - if(isset($data['manager_language'])) { |
|
58 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
59 | - if(is_file($lang_path)) { |
|
57 | + if (isset($data['manager_language'])) { |
|
58 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
59 | + if (is_file($lang_path)) { |
|
60 | 60 | include($lang_path); |
61 | 61 | global $modx_lang_attribute; |
62 | 62 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | foreach ($data as $k => $v) { |
69 | 69 | switch ($k) { |
70 | 70 | case 'settings_version':{ |
71 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
72 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
71 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
72 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
73 | 73 | $v = $modx->getVersionData('version'); |
74 | 74 | } |
75 | 75 | break; |
@@ -90,21 +90,21 @@ discard block |
||
90 | 90 | case 'rb_base_url': |
91 | 91 | case 'filemanager_path': |
92 | 92 | $v = trim($v); |
93 | - $v = rtrim($v,'/') . '/'; |
|
93 | + $v = rtrim($v, '/').'/'; |
|
94 | 94 | break; |
95 | 95 | case 'manager_language': |
96 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
97 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
96 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
97 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
98 | 98 | $langFileDir = dirname($langFile); |
99 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
99 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
100 | 100 | $v = 'english'; |
101 | 101 | } |
102 | 102 | break; |
103 | 103 | case 'smtppw': |
104 | 104 | if ($v !== '********************' && $v !== '') { |
105 | 105 | $v = trim($v); |
106 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | - $v = str_replace('=','%',$v); |
|
106 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | + $v = str_replace('=', '%', $v); |
|
108 | 108 | } elseif ($v === '********************') { |
109 | 109 | $k = ''; |
110 | 110 | } |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | $v = str_replace(array(' ,', ', '), ',', $v); |
114 | 114 | if ($v !== ',') { |
115 | 115 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
116 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
117 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
116 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
117 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
118 | 118 | } |
119 | 119 | $k = ''; |
120 | 120 | break; |
121 | 121 | case 'session_timeout': |
122 | 122 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
123 | - $v = intval($v) < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
123 | + $v = intval($v) < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
124 | 124 | break; |
125 | 125 | default: |
126 | 126 | break; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $modx->config[$k] = $v; |
131 | 131 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
132 | + if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // Run a single query to save all the values |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | $oldtemplate = intval($data['old_template']); |
144 | 144 | $tbl = $modx->getFullTableName('site_content'); |
145 | 145 | $reset = $data['reset_template']; |
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
146 | + if ($reset == 1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | + else if ($reset == 2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // empty cache |
151 | 151 | $modx->clearCache('full'); |
152 | 152 | } |
153 | -$header="Location: index.php?a=7&r=10"; |
|
153 | +$header = "Location: index.php?a=7&r=10"; |
|
154 | 154 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('settings')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -7,39 +9,27 @@ discard block |
||
7 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
8 | 10 | unset($_POST); |
9 | 11 | |
10 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
11 | -{ |
|
12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
12 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
13 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
14 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
15 | - if(is_file($htaccess)) |
|
16 | - { |
|
16 | + if(is_file($htaccess)) { |
|
17 | 17 | $_ = file_get_contents($htaccess); |
18 | - if(strpos($_,'RewriteBase')===false) |
|
19 | - { |
|
18 | + if(strpos($_,'RewriteBase')===false) { |
|
20 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
21 | - } |
|
22 | - elseif(is_writable($htaccess)) |
|
23 | - { |
|
20 | + } elseif(is_writable($htaccess)) { |
|
24 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
25 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | - { |
|
22 | + if(!@file_put_contents($htaccess,$_)) { |
|
27 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
28 | 24 | } |
29 | 25 | } |
30 | - } |
|
31 | - elseif(is_file($sample_htaccess)) |
|
32 | - { |
|
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
34 | - { |
|
26 | + } elseif(is_file($sample_htaccess)) { |
|
27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
35 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
36 | - } |
|
37 | - elseif($modx->config['base_url']!=='/') |
|
38 | - { |
|
29 | + } elseif($modx->config['base_url']!=='/') { |
|
39 | 30 | $_ = file_get_contents($htaccess); |
40 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
41 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | - { |
|
32 | + if(!@file_put_contents($htaccess,$_)) { |
|
43 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
44 | 34 | } |
45 | 35 | } |
@@ -68,7 +58,7 @@ discard block |
||
68 | 58 | foreach ($data as $k => $v) { |
69 | 59 | switch ($k) { |
70 | 60 | case 'settings_version':{ |
71 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
72 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
73 | 63 | $v = $modx->getVersionData('version'); |
74 | 64 | } |
@@ -129,7 +119,9 @@ discard block |
||
129 | 119 | |
130 | 120 | $modx->config[$k] = $v; |
131 | 121 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
122 | + if(!empty($k)) { |
|
123 | + $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
124 | + } |
|
133 | 125 | } |
134 | 126 | |
135 | 127 | // Run a single query to save all the values |
@@ -143,8 +135,11 @@ discard block |
||
143 | 135 | $oldtemplate = intval($data['old_template']); |
144 | 136 | $tbl = $modx->getFullTableName('site_content'); |
145 | 137 | $reset = $data['reset_template']; |
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
138 | + if($reset==1) { |
|
139 | + $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | + } else if($reset==2) { |
|
141 | + $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
142 | + } |
|
148 | 143 | } |
149 | 144 | |
150 | 145 | // empty cache |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | elseif(is_writable($htaccess)) |
23 | 23 | { |
24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
24 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
25 | 25 | if(!@file_put_contents($htaccess,$_)) |
26 | 26 | { |
27 | 27 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | elseif($modx->config['base_url']!=='/') |
38 | 38 | { |
39 | 39 | $_ = file_get_contents($htaccess); |
40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
40 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
41 | 41 | if(!@file_put_contents($htaccess,$_)) |
42 | 42 | { |
43 | 43 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -16,24 +16,24 @@ |
||
16 | 16 | $pth = dirname(dirname(dirname(__FILE__)))."/install/"; |
17 | 17 | $pth = str_replace("\\","/",$pth); |
18 | 18 | if(isset($_GET["rminstall"])) { |
19 | - if(is_dir($pth)) { |
|
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
21 | - } |
|
19 | + if(is_dir($pth)) { |
|
20 | + if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
24 | 24 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 25 | |
26 | 26 | // rmdirRecursive - detects symbollic links on unix |
27 | 27 | function rmdirRecursive($path,$followLinks=false) { |
28 | - $dir = opendir($path) ; |
|
29 | - while ($entry = readdir($dir)) { |
|
30 | - if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
|
31 | - @unlink( "$path/$entry" ); |
|
32 | - } |
|
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | - rmdirRecursive("$path/$entry"); // recursive |
|
35 | - } |
|
36 | - } |
|
37 | - closedir($dir); |
|
38 | - return @rmdir($path); |
|
28 | + $dir = opendir($path) ; |
|
29 | + while ($entry = readdir($dir)) { |
|
30 | + if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
|
31 | + @unlink( "$path/$entry" ); |
|
32 | + } |
|
33 | + elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | + rmdirRecursive("$path/$entry"); // recursive |
|
35 | + } |
|
36 | + } |
|
37 | + closedir($dir); |
|
38 | + return @rmdir($path); |
|
39 | 39 | } |
@@ -12,25 +12,25 @@ |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -$msg =''; |
|
15 | +$msg = ''; |
|
16 | 16 | $pth = dirname(dirname(dirname(__FILE__)))."/install/"; |
17 | -$pth = str_replace("\\","/",$pth); |
|
18 | -if(isset($_GET["rminstall"])) { |
|
19 | - if(is_dir($pth)) { |
|
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
17 | +$pth = str_replace("\\", "/", $pth); |
|
18 | +if (isset($_GET["rminstall"])) { |
|
19 | + if (is_dir($pth)) { |
|
20 | + if (!rmdirRecursive($pth)) $msg = "An error occured while attempting to remove the install folder"; |
|
21 | 21 | } |
22 | 22 | } |
23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
23 | +if ($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
24 | 24 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 25 | |
26 | 26 | // rmdirRecursive - detects symbollic links on unix |
27 | -function rmdirRecursive($path,$followLinks=false) { |
|
28 | - $dir = opendir($path) ; |
|
27 | +function rmdirRecursive($path, $followLinks = false){ |
|
28 | + $dir = opendir($path); |
|
29 | 29 | while ($entry = readdir($dir)) { |
30 | 30 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
31 | - @unlink( "$path/$entry" ); |
|
31 | + @unlink("$path/$entry"); |
|
32 | 32 | } |
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
33 | + elseif (is_dir("$path/$entry") && $entry != '.' && $entry != '..') { |
|
34 | 34 | rmdirRecursive("$path/$entry"); // recursive |
35 | 35 | } |
36 | 36 | } |
@@ -17,20 +17,24 @@ |
||
17 | 17 | $pth = str_replace("\\","/",$pth); |
18 | 18 | if(isset($_GET["rminstall"])) { |
19 | 19 | if(is_dir($pth)) { |
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
20 | + if(!rmdirRecursive($pth)) { |
|
21 | + $msg="An error occured while attempting to remove the install folder"; |
|
22 | + } |
|
21 | 23 | } |
22 | 24 | } |
23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
25 | +if($msg) { |
|
26 | + echo "<script>alert('".addslashes($msg)."');</script>"; |
|
27 | +} |
|
24 | 28 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 29 | |
26 | 30 | // rmdirRecursive - detects symbollic links on unix |
27 | -function rmdirRecursive($path,$followLinks=false) { |
|
31 | +function rmdirRecursive($path,$followLinks=false) |
|
32 | +{ |
|
28 | 33 | $dir = opendir($path) ; |
29 | - while ($entry = readdir($dir)) { |
|
34 | + while ($entry = readdir($dir)) { |
|
30 | 35 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
31 | 36 | @unlink( "$path/$entry" ); |
32 | - } |
|
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
37 | + } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | 38 | rmdirRecursive("$path/$entry"); // recursive |
35 | 39 | } |
36 | 40 | } |
@@ -491,7 +491,7 @@ |
||
491 | 491 | }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
492 | 492 | $publishedon = $pub_date; |
493 | 493 | $publishedby = $modx->getLoginUserID(); |
494 | - }elseif ($was_published && !$published) { |
|
494 | + }elseif ($was_published && !$published) { |
|
495 | 495 | $publishedon = 0; |
496 | 496 | $publishedby = 0; |
497 | 497 | } else { |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | switch ($actionToTake) { |
276 | - case 'new' : |
|
276 | + case 'new' : |
|
277 | 277 | |
278 | - // invoke OnBeforeDocFormSave event |
|
279 | - switch($modx->config['docid_incrmnt_method']) |
|
280 | - { |
|
278 | + // invoke OnBeforeDocFormSave event |
|
279 | + switch($modx->config['docid_incrmnt_method']) |
|
280 | + { |
|
281 | 281 | case '1': |
282 | 282 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
283 | 283 | $where = "T1.id IS NULL"; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | default: |
293 | 293 | $id = ''; |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | 296 | $modx->invokeEvent("OnBeforeDocFormSave", array ( |
297 | 297 | "mode" => "new", |
@@ -442,256 +442,256 @@ discard block |
||
442 | 442 | |
443 | 443 | |
444 | 444 | break; |
445 | - case 'edit' : |
|
445 | + case 'edit' : |
|
446 | 446 | |
447 | - // get the document's current parent |
|
448 | - $oldparent = $existingDocument['parent']; |
|
449 | - $doctype = $existingDocument['type']; |
|
447 | + // get the document's current parent |
|
448 | + $oldparent = $existingDocument['parent']; |
|
449 | + $doctype = $existingDocument['type']; |
|
450 | 450 | |
451 | - if ($id == $site_start && $published == 0) { |
|
452 | - $modx->manager->saveFormValues(27); |
|
453 | - $modx->webAlertAndQuit("Document is linked to site_start variable and cannot be unpublished!"); |
|
454 | - } |
|
455 | - $today = $_SERVER['REQUEST_TIME'] + $modx->config['server_offset_time']; |
|
456 | - if ($id == $site_start && ($pub_date > $today || $unpub_date != "0")) { |
|
457 | - $modx->manager->saveFormValues(27); |
|
458 | - $modx->webAlertAndQuit("Document is linked to site_start variable and cannot have publish or unpublish dates set!"); |
|
459 | - } |
|
460 | - if ($parent == $id) { |
|
461 | - $modx->manager->saveFormValues(27); |
|
462 | - $modx->webAlertAndQuit("Document can not be it's own parent!"); |
|
463 | - } |
|
451 | + if ($id == $site_start && $published == 0) { |
|
452 | + $modx->manager->saveFormValues(27); |
|
453 | + $modx->webAlertAndQuit("Document is linked to site_start variable and cannot be unpublished!"); |
|
454 | + } |
|
455 | + $today = $_SERVER['REQUEST_TIME'] + $modx->config['server_offset_time']; |
|
456 | + if ($id == $site_start && ($pub_date > $today || $unpub_date != "0")) { |
|
457 | + $modx->manager->saveFormValues(27); |
|
458 | + $modx->webAlertAndQuit("Document is linked to site_start variable and cannot have publish or unpublish dates set!"); |
|
459 | + } |
|
460 | + if ($parent == $id) { |
|
461 | + $modx->manager->saveFormValues(27); |
|
462 | + $modx->webAlertAndQuit("Document can not be it's own parent!"); |
|
463 | + } |
|
464 | 464 | |
465 | - $parents = $modx->getParentIds($parent); |
|
466 | - if (in_array($id, $parents)) { |
|
467 | - $modx->webAlertAndQuit("Document descendant can not be it's parent!"); |
|
468 | - } |
|
465 | + $parents = $modx->getParentIds($parent); |
|
466 | + if (in_array($id, $parents)) { |
|
467 | + $modx->webAlertAndQuit("Document descendant can not be it's parent!"); |
|
468 | + } |
|
469 | 469 | |
470 | - // check to see document is a folder |
|
471 | - $rs = $modx->db->select('count(id)', $tbl_site_content, "parent='{$id}'"); |
|
472 | - $count = $modx->db->getValue($rs); |
|
473 | - if ($count > 0) { |
|
474 | - $isfolder = 1; |
|
475 | - } |
|
476 | - |
|
477 | - // set publishedon and publishedby |
|
478 | - $was_published = $existingDocument['published']; |
|
479 | - |
|
480 | - // keep original publish state, if change is not permitted |
|
481 | - if (!$modx->hasPermission('publish_document')) { |
|
482 | - $published = $was_published; |
|
483 | - $pub_date = 'pub_date'; |
|
484 | - $unpub_date = 'unpub_date'; |
|
485 | - } |
|
470 | + // check to see document is a folder |
|
471 | + $rs = $modx->db->select('count(id)', $tbl_site_content, "parent='{$id}'"); |
|
472 | + $count = $modx->db->getValue($rs); |
|
473 | + if ($count > 0) { |
|
474 | + $isfolder = 1; |
|
475 | + } |
|
486 | 476 | |
487 | - // if it was changed from unpublished to published |
|
488 | - if (!$was_published && $published) { |
|
489 | - $publishedon = $currentdate; |
|
490 | - $publishedby = $modx->getLoginUserID(); |
|
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | - $publishedon = $pub_date; |
|
493 | - $publishedby = $modx->getLoginUserID(); |
|
494 | - }elseif ($was_published && !$published) { |
|
495 | - $publishedon = 0; |
|
496 | - $publishedby = 0; |
|
497 | - } else { |
|
498 | - $publishedon = 'publishedon'; |
|
499 | - $publishedby = 'publishedby'; |
|
500 | - } |
|
477 | + // set publishedon and publishedby |
|
478 | + $was_published = $existingDocument['published']; |
|
501 | 479 | |
502 | - // invoke OnBeforeDocFormSave event |
|
503 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
504 | - "mode" => "upd", |
|
505 | - "id" => $id |
|
506 | - )); |
|
480 | + // keep original publish state, if change is not permitted |
|
481 | + if (!$modx->hasPermission('publish_document')) { |
|
482 | + $published = $was_published; |
|
483 | + $pub_date = 'pub_date'; |
|
484 | + $unpub_date = 'unpub_date'; |
|
485 | + } |
|
507 | 486 | |
508 | - // update the document |
|
509 | - $modx->db->update( |
|
510 | - "introtext='{$introtext}', " |
|
511 | - . "content='{$content}', " |
|
512 | - . "pagetitle='{$pagetitle}', " |
|
513 | - . "longtitle='{$longtitle}', " |
|
514 | - . "type='{$type}', " |
|
515 | - . "description='{$description}', " |
|
516 | - . "alias='{$alias}', " |
|
517 | - . "link_attributes='{$link_attributes}', " |
|
518 | - . "isfolder={$isfolder}, " |
|
519 | - . "richtext={$richtext}, " |
|
520 | - . "published={$published}, " |
|
521 | - . "pub_date={$pub_date}, " |
|
522 | - . "unpub_date={$unpub_date}, " |
|
523 | - . "parent={$parent}, " |
|
524 | - . "template={$template}, " |
|
525 | - . "menuindex={$menuindex}, " |
|
526 | - . "searchable={$searchable}, " |
|
527 | - . "cacheable={$cacheable}, " |
|
528 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
529 | - . "editedon={$currentdate}, " |
|
530 | - . "publishedon={$publishedon}, " |
|
531 | - . "publishedby={$publishedby}, " |
|
532 | - . "contentType='{$contentType}', " |
|
533 | - . "content_dispo={$contentdispo}, " |
|
534 | - . "donthit={$donthit}, " |
|
535 | - . "menutitle='{$menutitle}', " |
|
536 | - . "hidemenu={$hidemenu}, " |
|
537 | - . "alias_visible={$aliasvisible}" |
|
538 | - , $tbl_site_content, "id='{$id}'"); |
|
539 | - |
|
540 | - // update template variables |
|
541 | - $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
|
542 | - $tvIds = array (); |
|
543 | - while ($row = $modx->db->getRow($rs)) { |
|
544 | - $tvIds[$row['tmplvarid']] = $row['id']; |
|
545 | - } |
|
546 | - $tvDeletions = array(); |
|
547 | - $tvChanges = array(); |
|
548 | - foreach ($tmplvars as $field => $value) { |
|
549 | - if (!is_array($value)) { |
|
550 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
487 | + // if it was changed from unpublished to published |
|
488 | + if (!$was_published && $published) { |
|
489 | + $publishedon = $currentdate; |
|
490 | + $publishedby = $modx->getLoginUserID(); |
|
491 | + }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | + $publishedon = $pub_date; |
|
493 | + $publishedby = $modx->getLoginUserID(); |
|
494 | + }elseif ($was_published && !$published) { |
|
495 | + $publishedon = 0; |
|
496 | + $publishedby = 0; |
|
551 | 497 | } else { |
552 | - $tvId = $value[0]; |
|
553 | - $tvVal = $value[1]; |
|
498 | + $publishedon = 'publishedon'; |
|
499 | + $publishedby = 'publishedby'; |
|
500 | + } |
|
554 | 501 | |
555 | - if (isset($tvIds[$tvId])) { |
|
556 | - $tvChanges[] = array(array('tmplvarid' => $tvId, 'contentid' => $id, 'value' => $modx->db->escape($tvVal)), array('id' => $tvIds[$tvId])); |
|
502 | + // invoke OnBeforeDocFormSave event |
|
503 | + $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
504 | + "mode" => "upd", |
|
505 | + "id" => $id |
|
506 | + )); |
|
507 | + |
|
508 | + // update the document |
|
509 | + $modx->db->update( |
|
510 | + "introtext='{$introtext}', " |
|
511 | + . "content='{$content}', " |
|
512 | + . "pagetitle='{$pagetitle}', " |
|
513 | + . "longtitle='{$longtitle}', " |
|
514 | + . "type='{$type}', " |
|
515 | + . "description='{$description}', " |
|
516 | + . "alias='{$alias}', " |
|
517 | + . "link_attributes='{$link_attributes}', " |
|
518 | + . "isfolder={$isfolder}, " |
|
519 | + . "richtext={$richtext}, " |
|
520 | + . "published={$published}, " |
|
521 | + . "pub_date={$pub_date}, " |
|
522 | + . "unpub_date={$unpub_date}, " |
|
523 | + . "parent={$parent}, " |
|
524 | + . "template={$template}, " |
|
525 | + . "menuindex={$menuindex}, " |
|
526 | + . "searchable={$searchable}, " |
|
527 | + . "cacheable={$cacheable}, " |
|
528 | + . "editedby=" . $modx->getLoginUserID() . ", " |
|
529 | + . "editedon={$currentdate}, " |
|
530 | + . "publishedon={$publishedon}, " |
|
531 | + . "publishedby={$publishedby}, " |
|
532 | + . "contentType='{$contentType}', " |
|
533 | + . "content_dispo={$contentdispo}, " |
|
534 | + . "donthit={$donthit}, " |
|
535 | + . "menutitle='{$menutitle}', " |
|
536 | + . "hidemenu={$hidemenu}, " |
|
537 | + . "alias_visible={$aliasvisible}" |
|
538 | + , $tbl_site_content, "id='{$id}'"); |
|
539 | + |
|
540 | + // update template variables |
|
541 | + $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
|
542 | + $tvIds = array (); |
|
543 | + while ($row = $modx->db->getRow($rs)) { |
|
544 | + $tvIds[$row['tmplvarid']] = $row['id']; |
|
545 | + } |
|
546 | + $tvDeletions = array(); |
|
547 | + $tvChanges = array(); |
|
548 | + foreach ($tmplvars as $field => $value) { |
|
549 | + if (!is_array($value)) { |
|
550 | + if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
557 | 551 | } else { |
558 | - $tvAdded[] = array('tmplvarid' => $tvId, 'contentid' => $id, 'value' => $modx->db->escape($tvVal)); |
|
552 | + $tvId = $value[0]; |
|
553 | + $tvVal = $value[1]; |
|
554 | + |
|
555 | + if (isset($tvIds[$tvId])) { |
|
556 | + $tvChanges[] = array(array('tmplvarid' => $tvId, 'contentid' => $id, 'value' => $modx->db->escape($tvVal)), array('id' => $tvIds[$tvId])); |
|
557 | + } else { |
|
558 | + $tvAdded[] = array('tmplvarid' => $tvId, 'contentid' => $id, 'value' => $modx->db->escape($tvVal)); |
|
559 | + } |
|
559 | 560 | } |
560 | 561 | } |
561 | - } |
|
562 | 562 | |
563 | - if (!empty($tvDeletions)) { |
|
564 | - $modx->db->delete($tbl_site_tmplvar_contentvalues, 'id IN('.implode(',', $tvDeletions).')'); |
|
565 | - } |
|
563 | + if (!empty($tvDeletions)) { |
|
564 | + $modx->db->delete($tbl_site_tmplvar_contentvalues, 'id IN('.implode(',', $tvDeletions).')'); |
|
565 | + } |
|
566 | 566 | |
567 | - if (!empty($tvAdded)) { |
|
568 | - foreach ($tvAdded as $tv) { |
|
569 | - $modx->db->insert($tv, $tbl_site_tmplvar_contentvalues); |
|
567 | + if (!empty($tvAdded)) { |
|
568 | + foreach ($tvAdded as $tv) { |
|
569 | + $modx->db->insert($tv, $tbl_site_tmplvar_contentvalues); |
|
570 | + } |
|
570 | 571 | } |
571 | - } |
|
572 | 572 | |
573 | - if (!empty($tvChanges)) { |
|
574 | - foreach ($tvChanges as $tv) { |
|
575 | - $modx->db->update($tv[0], $tbl_site_tmplvar_contentvalues, "id='{$tv[1]['id']}'"); |
|
573 | + if (!empty($tvChanges)) { |
|
574 | + foreach ($tvChanges as $tv) { |
|
575 | + $modx->db->update($tv[0], $tbl_site_tmplvar_contentvalues, "id='{$tv[1]['id']}'"); |
|
576 | + } |
|
576 | 577 | } |
577 | - } |
|
578 | 578 | |
579 | - // set document permissions |
|
580 | - if ($use_udperms == 1 && is_array($document_groups)) { |
|
581 | - $new_groups = array(); |
|
582 | - // process the new input |
|
583 | - foreach ($document_groups as $value_pair) { |
|
584 | - list($group, $link_id) = explode(',', $value_pair); // @see actions/mutate_content.dynamic.php @ line 1138 (permissions list) |
|
585 | - $new_groups[$group] = $link_id; |
|
586 | - } |
|
579 | + // set document permissions |
|
580 | + if ($use_udperms == 1 && is_array($document_groups)) { |
|
581 | + $new_groups = array(); |
|
582 | + // process the new input |
|
583 | + foreach ($document_groups as $value_pair) { |
|
584 | + list($group, $link_id) = explode(',', $value_pair); // @see actions/mutate_content.dynamic.php @ line 1138 (permissions list) |
|
585 | + $new_groups[$group] = $link_id; |
|
586 | + } |
|
587 | 587 | |
588 | - // grab the current set of permissions on this document the user can access |
|
589 | - $isManager = $modx->hasPermission('access_permissions'); |
|
590 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
591 | - $rs = $modx->db->select( |
|
592 | - 'groups.id, groups.document_group', |
|
593 | - "{$tbl_document_groups} AS groups |
|
588 | + // grab the current set of permissions on this document the user can access |
|
589 | + $isManager = $modx->hasPermission('access_permissions'); |
|
590 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
591 | + $rs = $modx->db->select( |
|
592 | + 'groups.id, groups.document_group', |
|
593 | + "{$tbl_document_groups} AS groups |
|
594 | 594 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
595 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
596 | - ); |
|
597 | - $old_groups = array(); |
|
598 | - while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
599 | - |
|
600 | - // update the permissions in the database |
|
601 | - $insertions = $deletions = array(); |
|
602 | - foreach ($new_groups as $group => $link_id) { |
|
603 | - if (array_key_exists($group, $old_groups)) { |
|
604 | - unset($old_groups[$group]); |
|
605 | - continue; |
|
606 | - } elseif ($link_id == 'new') { |
|
607 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
595 | + "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
596 | + ); |
|
597 | + $old_groups = array(); |
|
598 | + while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
599 | + |
|
600 | + // update the permissions in the database |
|
601 | + $insertions = $deletions = array(); |
|
602 | + foreach ($new_groups as $group => $link_id) { |
|
603 | + if (array_key_exists($group, $old_groups)) { |
|
604 | + unset($old_groups[$group]); |
|
605 | + continue; |
|
606 | + } elseif ($link_id == 'new') { |
|
607 | + $insertions[] = '('.(int)$group.','.$id.')'; |
|
608 | + } |
|
609 | + } |
|
610 | + if (!empty($insertions)) { |
|
611 | + $modx->db->query("INSERT INTO {$tbl_document_groups} (document_group, document) VALUES ".implode(',', $insertions)); |
|
612 | + } |
|
613 | + if (!empty($old_groups)) { |
|
614 | + $modx->db->delete($tbl_document_groups, "id IN (".implode(',', $old_groups).")"); |
|
615 | + } |
|
616 | + // necessary to remove all permissions as document is public |
|
617 | + if ((isset($_POST['chkalldocs']) && $_POST['chkalldocs'] == 'on')) { |
|
618 | + $modx->db->delete($tbl_document_groups, "document='{$id}'"); |
|
608 | 619 | } |
609 | 620 | } |
610 | - if (!empty($insertions)) { |
|
611 | - $modx->db->query("INSERT INTO {$tbl_document_groups} (document_group, document) VALUES ".implode(',', $insertions)); |
|
612 | - } |
|
613 | - if (!empty($old_groups)) { |
|
614 | - $modx->db->delete($tbl_document_groups, "id IN (".implode(',', $old_groups).")"); |
|
615 | - } |
|
616 | - // necessary to remove all permissions as document is public |
|
617 | - if ((isset($_POST['chkalldocs']) && $_POST['chkalldocs'] == 'on')) { |
|
618 | - $modx->db->delete($tbl_document_groups, "document='{$id}'"); |
|
621 | + |
|
622 | + // do the parent stuff |
|
623 | + if ($parent != 0) { |
|
624 | + $fields = array('isfolder' => 1); |
|
625 | + $modx->db->update($fields, $tbl_site_content, "id='{$_REQUEST['parent']}'"); |
|
619 | 626 | } |
620 | - } |
|
621 | 627 | |
622 | - // do the parent stuff |
|
623 | - if ($parent != 0) { |
|
624 | - $fields = array('isfolder' => 1); |
|
625 | - $modx->db->update($fields, $tbl_site_content, "id='{$_REQUEST['parent']}'"); |
|
626 | - } |
|
628 | + // finished moving the document, now check to see if the old_parent should no longer be a folder |
|
629 | + $rs = $modx->db->select('COUNT(id)', $tbl_site_content, "parent='{$oldparent}'"); |
|
630 | + $limit = $modx->db->getValue($rs); |
|
627 | 631 | |
628 | - // finished moving the document, now check to see if the old_parent should no longer be a folder |
|
629 | - $rs = $modx->db->select('COUNT(id)', $tbl_site_content, "parent='{$oldparent}'"); |
|
630 | - $limit = $modx->db->getValue($rs); |
|
632 | + if ($limit == 0) { |
|
633 | + $fields = array('isfolder' => 0); |
|
634 | + $modx->db->update($fields, $tbl_site_content, "id='{$oldparent}'"); |
|
635 | + } |
|
631 | 636 | |
632 | - if ($limit == 0) { |
|
633 | - $fields = array('isfolder' => 0); |
|
634 | - $modx->db->update($fields, $tbl_site_content, "id='{$oldparent}'"); |
|
635 | - } |
|
636 | 637 | |
638 | + // invoke OnDocFormSave event |
|
639 | + $modx->invokeEvent("OnDocFormSave", array ( |
|
640 | + "mode" => "upd", |
|
641 | + "id" => $id |
|
642 | + )); |
|
637 | 643 | |
638 | - // invoke OnDocFormSave event |
|
639 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
640 | - "mode" => "upd", |
|
641 | - "id" => $id |
|
642 | - )); |
|
644 | + // secure web documents - flag as private |
|
645 | + include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
646 | + secureWebDocument($id); |
|
643 | 647 | |
644 | - // secure web documents - flag as private |
|
645 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
646 | - secureWebDocument($id); |
|
648 | + // secure manager documents - flag as private |
|
649 | + include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
650 | + secureMgrDocument($id); |
|
647 | 651 | |
648 | - // secure manager documents - flag as private |
|
649 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
650 | - secureMgrDocument($id); |
|
651 | - |
|
652 | - // Set the item name for logger |
|
653 | - $_SESSION['itemname'] = $no_esc_pagetitle; |
|
652 | + // Set the item name for logger |
|
653 | + $_SESSION['itemname'] = $no_esc_pagetitle; |
|
654 | 654 | |
655 | - if ($syncsite == 1) { |
|
656 | - // empty cache |
|
657 | - $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
|
658 | - $flag = ''; |
|
659 | - foreach($keys as $key) { |
|
660 | - if ($existingDocument[$key]===$_POST[$key]) continue; |
|
661 | - $flag = 'full'; |
|
662 | - break; |
|
655 | + if ($syncsite == 1) { |
|
656 | + // empty cache |
|
657 | + $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
|
658 | + $flag = ''; |
|
659 | + foreach($keys as $key) { |
|
660 | + if ($existingDocument[$key]===$_POST[$key]) continue; |
|
661 | + $flag = 'full'; |
|
662 | + break; |
|
663 | + } |
|
664 | + if($flag==='full') $modx->clearCache('full'); |
|
665 | + else $modx->clearCache($id); |
|
663 | 666 | } |
664 | - if($flag==='full') $modx->clearCache('full'); |
|
665 | - else $modx->clearCache($id); |
|
666 | - } |
|
667 | 667 | |
668 | - if ($_POST['refresh_preview'] == '1') |
|
669 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
670 | - else { |
|
671 | - if ($_POST['stay'] != '2' && $id > 0) { |
|
672 | - $modx->unlockElement(7, $id); |
|
673 | - } |
|
674 | - if ($_POST['stay'] != '') { |
|
675 | - $id = $_REQUEST['id']; |
|
676 | - if ($type == "reference") { |
|
677 | - // weblink |
|
678 | - $a = ($_POST['stay'] == '2') ? "27&id=$id" : "72&pid=$parent"; |
|
668 | + if ($_POST['refresh_preview'] == '1') |
|
669 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
670 | + else { |
|
671 | + if ($_POST['stay'] != '2' && $id > 0) { |
|
672 | + $modx->unlockElement(7, $id); |
|
673 | + } |
|
674 | + if ($_POST['stay'] != '') { |
|
675 | + $id = $_REQUEST['id']; |
|
676 | + if ($type == "reference") { |
|
677 | + // weblink |
|
678 | + $a = ($_POST['stay'] == '2') ? "27&id=$id" : "72&pid=$parent"; |
|
679 | + } else { |
|
680 | + // document |
|
681 | + $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
|
682 | + } |
|
683 | + $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
679 | 684 | } else { |
680 | - // document |
|
681 | - $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
|
685 | + $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
|
682 | 686 | } |
683 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
687 | + } |
|
688 | + if (headers_sent()) { |
|
689 | + $header = str_replace('Location: ','',$header); |
|
690 | + echo "<script>document.location.href='$header';</script>\n"; |
|
684 | 691 | } else { |
685 | - $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
|
692 | + header($header); |
|
686 | 693 | } |
687 | - } |
|
688 | - if (headers_sent()) { |
|
689 | - $header = str_replace('Location: ','',$header); |
|
690 | - echo "<script>document.location.href='$header';</script>\n"; |
|
691 | - } else { |
|
692 | - header($header); |
|
693 | - } |
|
694 | - break; |
|
695 | - default : |
|
696 | - $modx->webAlertAndQuit("No operation set in request."); |
|
694 | + break; |
|
695 | + default : |
|
696 | + $modx->webAlertAndQuit("No operation set in request."); |
|
697 | 697 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | if (!$modx->hasPermission('save_document')) { |
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | $aliasvisible = $_POST['alias_visible']; |
35 | 35 | |
36 | 36 | /************* webber ********/ |
37 | -$sd=isset($_POST['dir'])?'&dir='.$_POST['dir']:'&dir=DESC'; |
|
38 | -$sb=isset($_POST['sort'])?'&sort='.$_POST['sort']:'&sort=pub_date'; |
|
39 | -$pg=isset($_POST['page'])?'&page='.(int)$_POST['page']:''; |
|
40 | -$add_path=$sd.$sb.$pg; |
|
37 | +$sd = isset($_POST['dir']) ? '&dir='.$_POST['dir'] : '&dir=DESC'; |
|
38 | +$sb = isset($_POST['sort']) ? '&sort='.$_POST['sort'] : '&sort=pub_date'; |
|
39 | +$pg = isset($_POST['page']) ? '&page='.(int) $_POST['page'] : ''; |
|
40 | +$add_path = $sd.$sb.$pg; |
|
41 | 41 | |
42 | 42 | |
43 | 43 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // auto assign alias |
72 | 72 | if (!$alias && $automatic_alias) { |
73 | 73 | $alias = strtolower($modx->stripAlias(trim($pagetitle))); |
74 | - if(!$allow_duplicate_alias) { |
|
74 | + if (!$allow_duplicate_alias) { |
|
75 | 75 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND alias='$alias'")) != 0) { |
76 | 76 | $cnt = 1; |
77 | 77 | $tempAlias = $alias; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | $alias = $tempAlias; |
84 | 84 | } |
85 | - }else{ |
|
85 | + } else { |
|
86 | 86 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) { |
87 | 87 | $cnt = 1; |
88 | 88 | $tempAlias = $alias; |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | // get document groups for current user |
166 | -$tmplvars = array (); |
|
166 | +$tmplvars = array(); |
|
167 | 167 | if ($_SESSION['mgrDocgroups']) { |
168 | 168 | $docgrp = implode(",", $_SESSION['mgrDocgroups']); |
169 | 169 | } |
170 | 170 | |
171 | 171 | // ensure that user has not made this document inaccessible to themselves |
172 | -if($_SESSION['mgrRole'] != 1 && is_array($document_groups)) { |
|
172 | +if ($_SESSION['mgrRole'] != 1 && is_array($document_groups)) { |
|
173 | 173 | $document_group_list = implode(',', $document_groups); |
174 | - $document_group_list = implode(',', array_filter(explode(',',$document_group_list), 'is_numeric')); |
|
175 | - if(!empty($document_group_list)) { |
|
174 | + $document_group_list = implode(',', array_filter(explode(',', $document_group_list), 'is_numeric')); |
|
175 | + if (!empty($document_group_list)) { |
|
176 | 176 | $rs = $modx->db->select('COUNT(mg.id)', "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg", "mga.membergroup = mg.user_group AND mga.documentgroup IN({$document_group_list}) AND mg.member = {$_SESSION['mgrInternalKey']}"); |
177 | 177 | $count = $modx->db->getValue($rs); |
178 | - if($count == 0) { |
|
178 | + if ($count == 0) { |
|
179 | 179 | if ($actionToTake == 'edit') { |
180 | 180 | $modx->manager->saveFormValues(27); |
181 | 181 | $modx->webAlertAndQuit(sprintf($_lang["resource_permissions_error"]), "index.php?a=27&id={$id}"); |
@@ -193,45 +193,45 @@ discard block |
||
193 | 193 | INNER JOIN {$tbl_site_tmplvar_templates} AS tvtpl ON tvtpl.tmplvarid = tv.id |
194 | 194 | LEFT JOIN {$tbl_site_tmplvar_contentvalues} AS tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$id}' |
195 | 195 | LEFT JOIN {$tbl_site_tmplvar_access} AS tva ON tva.tmplvarid=tv.id", |
196 | - "tvtpl.templateid = '{$template}' AND (1='{$_SESSION['mgrRole']}' OR ISNULL(tva.documentgroup)" . ((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)") . ")", |
|
196 | + "tvtpl.templateid = '{$template}' AND (1='{$_SESSION['mgrRole']}' OR ISNULL(tva.documentgroup)".((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)").")", |
|
197 | 197 | "tv.rank" |
198 | 198 | ); |
199 | 199 | while ($row = $modx->db->getRow($rs)) { |
200 | 200 | $tmplvar = ''; |
201 | 201 | switch ($row['type']) { |
202 | 202 | case 'url': |
203 | - $tmplvar = $_POST["tv" . $row['id']]; |
|
204 | - if ($_POST["tv" . $row['id'] . '_prefix'] != '--') { |
|
205 | - $tmplvar = str_replace(array ( |
|
203 | + $tmplvar = $_POST["tv".$row['id']]; |
|
204 | + if ($_POST["tv".$row['id'].'_prefix'] != '--') { |
|
205 | + $tmplvar = str_replace(array( |
|
206 | 206 | "feed://", |
207 | 207 | "ftp://", |
208 | 208 | "http://", |
209 | 209 | "https://", |
210 | 210 | "mailto:" |
211 | 211 | ), "", $tmplvar); |
212 | - $tmplvar = $_POST["tv" . $row['id'] . '_prefix'] . $tmplvar; |
|
212 | + $tmplvar = $_POST["tv".$row['id'].'_prefix'].$tmplvar; |
|
213 | 213 | } |
214 | 214 | break; |
215 | 215 | case 'file': |
216 | - $tmplvar = $_POST["tv" . $row['id']]; |
|
216 | + $tmplvar = $_POST["tv".$row['id']]; |
|
217 | 217 | break; |
218 | 218 | default: |
219 | - if (is_array($_POST["tv" . $row['id']])) { |
|
219 | + if (is_array($_POST["tv".$row['id']])) { |
|
220 | 220 | // handles checkboxes & multiple selects elements |
221 | - $feature_insert = array (); |
|
222 | - $lst = $_POST["tv" . $row['id']]; |
|
221 | + $feature_insert = array(); |
|
222 | + $lst = $_POST["tv".$row['id']]; |
|
223 | 223 | while (list ($featureValue, $feature_item) = each($lst)) { |
224 | 224 | $feature_insert[count($feature_insert)] = $feature_item; |
225 | 225 | } |
226 | 226 | $tmplvar = implode("||", $feature_insert); |
227 | 227 | } else { |
228 | - $tmplvar = $_POST["tv" . $row['id']]; |
|
228 | + $tmplvar = $_POST["tv".$row['id']]; |
|
229 | 229 | } |
230 | 230 | break; |
231 | 231 | } |
232 | 232 | // save value if it was modified |
233 | 233 | if (strlen($tmplvar) > 0 && $tmplvar != $row['default_text']) { |
234 | - $tmplvars[$row['id']] = array ( |
|
234 | + $tmplvars[$row['id']] = array( |
|
235 | 235 | $row['id'], |
236 | 236 | $tmplvar |
237 | 237 | ); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // check to see if the user is allowed to save the document in the place he wants to save it in |
255 | 255 | if ($use_udperms == 1) { |
256 | 256 | if ($existingDocument['parent'] != $parent) { |
257 | - include_once MODX_MANAGER_PATH ."processors/user_documents_permissions.class.php"; |
|
257 | + include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
258 | 258 | $udperms = new udperms(); |
259 | 259 | $udperms->user = $modx->getLoginUserID(); |
260 | 260 | $udperms->document = $parent; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | case 'new' : |
277 | 277 | |
278 | 278 | // invoke OnBeforeDocFormSave event |
279 | - switch($modx->config['docid_incrmnt_method']) |
|
279 | + switch ($modx->config['docid_incrmnt_method']) |
|
280 | 280 | { |
281 | 281 | case '1': |
282 | 282 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $id = $modx->db->getValue($rs); |
286 | 286 | break; |
287 | 287 | case '2': |
288 | - $rs = $modx->db->select('MAX(id)+1',$tbl_site_content); |
|
288 | + $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
289 | 289 | $id = $modx->db->getValue($rs); |
290 | 290 | break; |
291 | 291 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $id = ''; |
294 | 294 | } |
295 | 295 | |
296 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
296 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
297 | 297 | "mode" => "new", |
298 | 298 | "id" => $id |
299 | 299 | )); |
@@ -308,48 +308,47 @@ discard block |
||
308 | 308 | $publishedon = ($published ? $currentdate : 0); |
309 | 309 | $publishedby = ($published ? $modx->getLoginUserID() : 0); |
310 | 310 | |
311 | - if ((!empty($pub_date))&&($published)){ |
|
312 | - $publishedon=$pub_date; |
|
313 | - } |
|
314 | - |
|
315 | - $dbInsert = array |
|
316 | - ( |
|
317 | - "introtext" => $introtext , |
|
318 | - "content" => $content , |
|
319 | - "pagetitle" => $pagetitle , |
|
320 | - "longtitle" => $longtitle , |
|
321 | - "type" => $type , |
|
322 | - "description" => $description , |
|
323 | - "alias" => $alias , |
|
324 | - "link_attributes" => $link_attributes , |
|
325 | - "isfolder" => $isfolder , |
|
326 | - "richtext" => $richtext , |
|
327 | - "published" => $published , |
|
328 | - "parent" => $parent , |
|
329 | - "template" => $template , |
|
330 | - "menuindex" => $menuindex , |
|
331 | - "searchable" => $searchable , |
|
332 | - "cacheable" => $cacheable , |
|
333 | - "createdby" => $modx->getLoginUserID() , |
|
334 | - "createdon" => $currentdate , |
|
335 | - "editedby" => $modx->getLoginUserID() , |
|
336 | - "editedon" => $currentdate , |
|
337 | - "publishedby" => $publishedby , |
|
338 | - "publishedon" => $publishedon , |
|
339 | - "pub_date" => $pub_date , |
|
340 | - "unpub_date" => $unpub_date , |
|
341 | - "contentType" => $contentType , |
|
342 | - "content_dispo" => $contentdispo , |
|
343 | - "donthit" => $donthit , |
|
344 | - "menutitle" => $menutitle , |
|
345 | - "hidemenu" => $hidemenu , |
|
311 | + if ((!empty($pub_date)) && ($published)) { |
|
312 | + $publishedon = $pub_date; |
|
313 | + } |
|
314 | + |
|
315 | + $dbInsert = array( |
|
316 | + "introtext" => $introtext, |
|
317 | + "content" => $content, |
|
318 | + "pagetitle" => $pagetitle, |
|
319 | + "longtitle" => $longtitle, |
|
320 | + "type" => $type, |
|
321 | + "description" => $description, |
|
322 | + "alias" => $alias, |
|
323 | + "link_attributes" => $link_attributes, |
|
324 | + "isfolder" => $isfolder, |
|
325 | + "richtext" => $richtext, |
|
326 | + "published" => $published, |
|
327 | + "parent" => $parent, |
|
328 | + "template" => $template, |
|
329 | + "menuindex" => $menuindex, |
|
330 | + "searchable" => $searchable, |
|
331 | + "cacheable" => $cacheable, |
|
332 | + "createdby" => $modx->getLoginUserID(), |
|
333 | + "createdon" => $currentdate, |
|
334 | + "editedby" => $modx->getLoginUserID(), |
|
335 | + "editedon" => $currentdate, |
|
336 | + "publishedby" => $publishedby, |
|
337 | + "publishedon" => $publishedon, |
|
338 | + "pub_date" => $pub_date, |
|
339 | + "unpub_date" => $unpub_date, |
|
340 | + "contentType" => $contentType, |
|
341 | + "content_dispo" => $contentdispo, |
|
342 | + "donthit" => $donthit, |
|
343 | + "menutitle" => $menutitle, |
|
344 | + "hidemenu" => $hidemenu, |
|
346 | 345 | "alias_visible" => $aliasvisible |
347 | 346 | ); |
348 | 347 | |
349 | 348 | if ($id != '') |
350 | 349 | $dbInsert["id"] = $id; |
351 | 350 | |
352 | - $key = $modx->db->insert( $dbInsert, $tbl_site_content); |
|
351 | + $key = $modx->db->insert($dbInsert, $tbl_site_content); |
|
353 | 352 | |
354 | 353 | $tvChanges = array(); |
355 | 354 | foreach ($tmplvars as $field => $value) { |
@@ -371,7 +370,7 @@ discard block |
||
371 | 370 | foreach ($document_groups as $value_pair) { |
372 | 371 | // first, split the pair (this is a new document, so ignore the second value |
373 | 372 | list($group) = explode(',', $value_pair); // @see actions/mutate_content.dynamic.php @ line 1138 (permissions list) |
374 | - $new_groups[] = '('.(int)$group.','.$key.')'; |
|
373 | + $new_groups[] = '('.(int) $group.','.$key.')'; |
|
375 | 374 | } |
376 | 375 | $saved = true; |
377 | 376 | if (!empty($new_groups)) { |
@@ -380,7 +379,7 @@ discard block |
||
380 | 379 | } else { |
381 | 380 | $isManager = $modx->hasPermission('access_permissions'); |
382 | 381 | $isWeb = $modx->hasPermission('web_access_permissions'); |
383 | - if($use_udperms && !($isManager || $isWeb) && $parent != 0) { |
|
382 | + if ($use_udperms && !($isManager || $isWeb) && $parent != 0) { |
|
384 | 383 | // inherit document access permissions |
385 | 384 | $modx->db->insert( |
386 | 385 | array( |
@@ -399,17 +398,17 @@ discard block |
||
399 | 398 | } |
400 | 399 | |
401 | 400 | // invoke OnDocFormSave event |
402 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
401 | + $modx->invokeEvent("OnDocFormSave", array( |
|
403 | 402 | "mode" => "new", |
404 | 403 | "id" => $key |
405 | 404 | )); |
406 | 405 | |
407 | 406 | // secure web documents - flag as private |
408 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
407 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
409 | 408 | secureWebDocument($key); |
410 | 409 | |
411 | 410 | // secure manager documents - flag as private |
412 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
411 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
413 | 412 | secureMgrDocument($key); |
414 | 413 | |
415 | 414 | // Set the item name for logger |
@@ -428,13 +427,13 @@ discard block |
||
428 | 427 | // document |
429 | 428 | if ($_POST['mode'] == "4") |
430 | 429 | $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
431 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay']; |
|
430 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay']; |
|
432 | 431 | } else { |
433 | 432 | $header = "Location: index.php?a=3&id=$key&r=1"; |
434 | 433 | } |
435 | 434 | |
436 | 435 | if (headers_sent()) { |
437 | - $header = str_replace('Location: ','',$header); |
|
436 | + $header = str_replace('Location: ', '', $header); |
|
438 | 437 | echo "<script>document.location.href='$header';</script>\n"; |
439 | 438 | } else { |
440 | 439 | header($header); |
@@ -488,7 +487,7 @@ discard block |
||
488 | 487 | if (!$was_published && $published) { |
489 | 488 | $publishedon = $currentdate; |
490 | 489 | $publishedby = $modx->getLoginUserID(); |
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
490 | + }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) { |
|
492 | 491 | $publishedon = $pub_date; |
493 | 492 | $publishedby = $modx->getLoginUserID(); |
494 | 493 | }elseif ($was_published && !$published) { |
@@ -500,7 +499,7 @@ discard block |
||
500 | 499 | } |
501 | 500 | |
502 | 501 | // invoke OnBeforeDocFormSave event |
503 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
502 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
504 | 503 | "mode" => "upd", |
505 | 504 | "id" => $id |
506 | 505 | )); |
@@ -525,7 +524,7 @@ discard block |
||
525 | 524 | . "menuindex={$menuindex}, " |
526 | 525 | . "searchable={$searchable}, " |
527 | 526 | . "cacheable={$cacheable}, " |
528 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
527 | + . "editedby=".$modx->getLoginUserID().", " |
|
529 | 528 | . "editedon={$currentdate}, " |
530 | 529 | . "publishedon={$publishedon}, " |
531 | 530 | . "publishedby={$publishedby}, " |
@@ -539,7 +538,7 @@ discard block |
||
539 | 538 | |
540 | 539 | // update template variables |
541 | 540 | $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
542 | - $tvIds = array (); |
|
541 | + $tvIds = array(); |
|
543 | 542 | while ($row = $modx->db->getRow($rs)) { |
544 | 543 | $tvIds[$row['tmplvarid']] = $row['id']; |
545 | 544 | } |
@@ -592,7 +591,7 @@ discard block |
||
592 | 591 | 'groups.id, groups.document_group', |
593 | 592 | "{$tbl_document_groups} AS groups |
594 | 593 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
595 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
594 | + "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
596 | 595 | ); |
597 | 596 | $old_groups = array(); |
598 | 597 | while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
@@ -604,7 +603,7 @@ discard block |
||
604 | 603 | unset($old_groups[$group]); |
605 | 604 | continue; |
606 | 605 | } elseif ($link_id == 'new') { |
607 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
606 | + $insertions[] = '('.(int) $group.','.$id.')'; |
|
608 | 607 | } |
609 | 608 | } |
610 | 609 | if (!empty($insertions)) { |
@@ -636,17 +635,17 @@ discard block |
||
636 | 635 | |
637 | 636 | |
638 | 637 | // invoke OnDocFormSave event |
639 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
638 | + $modx->invokeEvent("OnDocFormSave", array( |
|
640 | 639 | "mode" => "upd", |
641 | 640 | "id" => $id |
642 | 641 | )); |
643 | 642 | |
644 | 643 | // secure web documents - flag as private |
645 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
644 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
646 | 645 | secureWebDocument($id); |
647 | 646 | |
648 | 647 | // secure manager documents - flag as private |
649 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
648 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
650 | 649 | secureMgrDocument($id); |
651 | 650 | |
652 | 651 | // Set the item name for logger |
@@ -654,14 +653,14 @@ discard block |
||
654 | 653 | |
655 | 654 | if ($syncsite == 1) { |
656 | 655 | // empty cache |
657 | - $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
|
656 | + $keys = array('alias', 'parent', 'published', 'isfolder', 'menuindex', 'alias_visible'); |
|
658 | 657 | $flag = ''; |
659 | - foreach($keys as $key) { |
|
660 | - if ($existingDocument[$key]===$_POST[$key]) continue; |
|
658 | + foreach ($keys as $key) { |
|
659 | + if ($existingDocument[$key] === $_POST[$key]) continue; |
|
661 | 660 | $flag = 'full'; |
662 | 661 | break; |
663 | 662 | } |
664 | - if($flag==='full') $modx->clearCache('full'); |
|
663 | + if ($flag === 'full') $modx->clearCache('full'); |
|
665 | 664 | else $modx->clearCache($id); |
666 | 665 | } |
667 | 666 | |
@@ -680,13 +679,13 @@ discard block |
||
680 | 679 | // document |
681 | 680 | $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
682 | 681 | } |
683 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
682 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path; |
|
684 | 683 | } else { |
685 | 684 | $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
686 | 685 | } |
687 | 686 | } |
688 | 687 | if (headers_sent()) { |
689 | - $header = str_replace('Location: ','',$header); |
|
688 | + $header = str_replace('Location: ', '', $header); |
|
690 | 689 | echo "<script>document.location.href='$header';</script>\n"; |
691 | 690 | } else { |
692 | 691 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if (!$modx->hasPermission('save_document')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -82,7 +84,7 @@ discard block |
||
82 | 84 | } |
83 | 85 | $alias = $tempAlias; |
84 | 86 | } |
85 | - }else{ |
|
87 | + } else { |
|
86 | 88 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) { |
87 | 89 | $cnt = 1; |
88 | 90 | $tempAlias = $alias; |
@@ -132,8 +134,7 @@ discard block |
||
132 | 134 | } |
133 | 135 | //end webber |
134 | 136 | } |
135 | -} |
|
136 | -elseif ($alias) { |
|
137 | +} elseif ($alias) { |
|
137 | 138 | $alias = $modx->stripAlias($alias); |
138 | 139 | } |
139 | 140 | |
@@ -147,8 +148,7 @@ discard block |
||
147 | 148 | |
148 | 149 | if ($pub_date < $currentdate) { |
149 | 150 | $published = 1; |
150 | - } |
|
151 | - elseif ($pub_date > $currentdate) { |
|
151 | + } elseif ($pub_date > $currentdate) { |
|
152 | 152 | $published = 0; |
153 | 153 | } |
154 | 154 | } |
@@ -276,8 +276,7 @@ discard block |
||
276 | 276 | case 'new' : |
277 | 277 | |
278 | 278 | // invoke OnBeforeDocFormSave event |
279 | - switch($modx->config['docid_incrmnt_method']) |
|
280 | - { |
|
279 | + switch($modx->config['docid_incrmnt_method']) { |
|
281 | 280 | case '1': |
282 | 281 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
283 | 282 | $where = "T1.id IS NULL"; |
@@ -308,7 +307,7 @@ discard block |
||
308 | 307 | $publishedon = ($published ? $currentdate : 0); |
309 | 308 | $publishedby = ($published ? $modx->getLoginUserID() : 0); |
310 | 309 | |
311 | - if ((!empty($pub_date))&&($published)){ |
|
310 | + if ((!empty($pub_date))&&($published)) { |
|
312 | 311 | $publishedon=$pub_date; |
313 | 312 | } |
314 | 313 | |
@@ -346,8 +345,9 @@ discard block |
||
346 | 345 | "alias_visible" => $aliasvisible |
347 | 346 | ); |
348 | 347 | |
349 | - if ($id != '') |
|
350 | - $dbInsert["id"] = $id; |
|
348 | + if ($id != '') { |
|
349 | + $dbInsert["id"] = $id; |
|
350 | + } |
|
351 | 351 | |
352 | 352 | $key = $modx->db->insert( $dbInsert, $tbl_site_content); |
353 | 353 | |
@@ -423,11 +423,13 @@ discard block |
||
423 | 423 | // redirect/stay options |
424 | 424 | if ($_POST['stay'] != '') { |
425 | 425 | // weblink |
426 | - if ($_POST['mode'] == "72") |
|
427 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
426 | + if ($_POST['mode'] == "72") { |
|
427 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
428 | + } |
|
428 | 429 | // document |
429 | - if ($_POST['mode'] == "4") |
|
430 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
430 | + if ($_POST['mode'] == "4") { |
|
431 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
432 | + } |
|
431 | 433 | $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay']; |
432 | 434 | } else { |
433 | 435 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -488,10 +490,10 @@ discard block |
||
488 | 490 | if (!$was_published && $published) { |
489 | 491 | $publishedon = $currentdate; |
490 | 492 | $publishedby = $modx->getLoginUserID(); |
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
493 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | 494 | $publishedon = $pub_date; |
493 | 495 | $publishedby = $modx->getLoginUserID(); |
494 | - }elseif ($was_published && !$published) { |
|
496 | + } elseif ($was_published && !$published) { |
|
495 | 497 | $publishedon = 0; |
496 | 498 | $publishedby = 0; |
497 | 499 | } else { |
@@ -547,7 +549,9 @@ discard block |
||
547 | 549 | $tvChanges = array(); |
548 | 550 | foreach ($tmplvars as $field => $value) { |
549 | 551 | if (!is_array($value)) { |
550 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
552 | + if (isset($tvIds[$value])) { |
|
553 | + $tvDeletions[] = $tvIds[$value]; |
|
554 | + } |
|
551 | 555 | } else { |
552 | 556 | $tvId = $value[0]; |
553 | 557 | $tvVal = $value[1]; |
@@ -595,7 +599,9 @@ discard block |
||
595 | 599 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
596 | 600 | ); |
597 | 601 | $old_groups = array(); |
598 | - while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
602 | + while ($row = $modx->db->getRow($rs)) { |
|
603 | + $old_groups[$row['document_group']] = $row['id']; |
|
604 | + } |
|
599 | 605 | |
600 | 606 | // update the permissions in the database |
601 | 607 | $insertions = $deletions = array(); |
@@ -657,17 +663,22 @@ discard block |
||
657 | 663 | $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
658 | 664 | $flag = ''; |
659 | 665 | foreach($keys as $key) { |
660 | - if ($existingDocument[$key]===$_POST[$key]) continue; |
|
666 | + if ($existingDocument[$key]===$_POST[$key]) { |
|
667 | + continue; |
|
668 | + } |
|
661 | 669 | $flag = 'full'; |
662 | 670 | break; |
663 | 671 | } |
664 | - if($flag==='full') $modx->clearCache('full'); |
|
665 | - else $modx->clearCache($id); |
|
672 | + if($flag==='full') { |
|
673 | + $modx->clearCache('full'); |
|
674 | + } else { |
|
675 | + $modx->clearCache($id); |
|
676 | + } |
|
666 | 677 | } |
667 | 678 | |
668 | - if ($_POST['refresh_preview'] == '1') |
|
669 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
670 | - else { |
|
679 | + if ($_POST['refresh_preview'] == '1') { |
|
680 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
681 | + } else { |
|
671 | 682 | if ($_POST['stay'] != '2' && $id > 0) { |
672 | 683 | $modx->unlockElement(7, $id); |
673 | 684 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('settings')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $modx->db->truncate($modx->getFullTableName('manager_log')); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('settings')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('settings')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | 7 | $modx->db->truncate($modx->getFullTableName('manager_log')); |
8 | 8 | |
9 | -$header="Location: index.php?a=13"; |
|
9 | +$header = "Location: index.php?a=13"; |
|
10 | 10 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('settings')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_module')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforeModFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforeModFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the module. |
23 | 23 | $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | // invoke OnModFormDelete event |
32 | 32 | $modx->invokeEvent("OnModFormDelete", |
33 | - array( |
|
34 | - "id" => $id |
|
35 | - )); |
|
33 | + array( |
|
34 | + "id" => $id |
|
35 | + )); |
|
36 | 36 | |
37 | 37 | // empty cache |
38 | 38 | $modx->clearCache('full'); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_module')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_module')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
@@ -38,5 +38,5 @@ discard block |
||
38 | 38 | $modx->clearCache('full'); |
39 | 39 | |
40 | 40 | // finished emptying cache - redirect |
41 | -$header="Location: index.php?a=106&r=2"; |
|
41 | +$header = "Location: index.php?a=106&r=2"; |
|
42 | 42 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_module')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('save_password')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = $_POST['id']; |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | $pass2 = $_POST['pass2']; |
10 | 10 | |
11 | 11 | if($pass1!=$pass2){ |
12 | - $modx->webAlertAndQuit("Passwords don't match!"); |
|
12 | + $modx->webAlertAndQuit("Passwords don't match!"); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | if(strlen($pass1)<6){ |
16 | - $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
16 | + $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | $pass1 = $modx->htmlspecialchars($pass1, ENT_NOQUOTES); |
20 | - $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
21 | - $uid = $modx->getLoginUserID(); |
|
22 | - $modx->loadExtension('phpass'); |
|
23 | - $f['password'] = $modx->phpass->HashPassword($pass1); |
|
24 | - $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
20 | + $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
21 | + $uid = $modx->getLoginUserID(); |
|
22 | + $modx->loadExtension('phpass'); |
|
23 | + $f['password'] = $modx->phpass->HashPassword($pass1); |
|
24 | + $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
25 | 25 | |
26 | - // invoke OnManagerChangePassword event |
|
27 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
28 | - 'userid' => $uid, |
|
29 | - 'username' => $_SESSION['mgrShortname'], |
|
30 | - 'userpassword' => $pass1 |
|
31 | - )); |
|
26 | + // invoke OnManagerChangePassword event |
|
27 | + $modx->invokeEvent('OnManagerChangePassword', array ( |
|
28 | + 'userid' => $uid, |
|
29 | + 'username' => $_SESSION['mgrShortname'], |
|
30 | + 'userpassword' => $pass1 |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | $header="Location: index.php?a=2"; |
34 | 34 | header($header); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('save_password')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('save_password')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | $pass1 = $_POST['pass1']; |
9 | 9 | $pass2 = $_POST['pass2']; |
10 | 10 | |
11 | -if($pass1!=$pass2){ |
|
11 | +if ($pass1 != $pass2) { |
|
12 | 12 | $modx->webAlertAndQuit("Passwords don't match!"); |
13 | 13 | } |
14 | 14 | |
15 | -if(strlen($pass1)<6){ |
|
15 | +if (strlen($pass1) < 6) { |
|
16 | 16 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
17 | 17 | } |
18 | 18 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | $uid = $modx->getLoginUserID(); |
22 | 22 | $modx->loadExtension('phpass'); |
23 | 23 | $f['password'] = $modx->phpass->HashPassword($pass1); |
24 | - $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
24 | + $modx->db->update($f, $tbl_manager_users, "id='{$uid}'"); |
|
25 | 25 | |
26 | 26 | // invoke OnManagerChangePassword event |
27 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
27 | + $modx->invokeEvent('OnManagerChangePassword', array( |
|
28 | 28 | 'userid' => $uid, |
29 | 29 | 'username' => $_SESSION['mgrShortname'], |
30 | 30 | 'userpassword' => $pass1 |
31 | 31 | )); |
32 | 32 | |
33 | -$header="Location: index.php?a=2"; |
|
33 | +$header = "Location: index.php?a=2"; |
|
34 | 34 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('save_password')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -8,11 +10,11 @@ discard block |
||
8 | 10 | $pass1 = $_POST['pass1']; |
9 | 11 | $pass2 = $_POST['pass2']; |
10 | 12 | |
11 | -if($pass1!=$pass2){ |
|
13 | +if($pass1!=$pass2) { |
|
12 | 14 | $modx->webAlertAndQuit("Passwords don't match!"); |
13 | 15 | } |
14 | 16 | |
15 | -if(strlen($pass1)<6){ |
|
17 | +if(strlen($pass1)<6) { |
|
16 | 18 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
17 | 19 | } |
18 | 20 |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_snippet')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforeChunkFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the chunk. |
23 | 23 | $modx->db->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
24 | 24 | |
25 | 25 | // invoke OnChunkFormDelete event |
26 | 26 | $modx->invokeEvent("OnChunkFormDelete", |
27 | - array( |
|
28 | - "id" => $id |
|
29 | - )); |
|
27 | + array( |
|
28 | + "id" => $id |
|
29 | + )); |
|
30 | 30 | |
31 | 31 | // empty cache |
32 | 32 | $modx->clearCache('full'); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_snippet')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_snippet')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
@@ -32,5 +32,5 @@ discard block |
||
32 | 32 | $modx->clearCache('full'); |
33 | 33 | |
34 | 34 | // finished emptying cache - redirect |
35 | -$header="Location: index.php?a=76&r=2"; |
|
35 | +$header = "Location: index.php?a=76&r=2"; |
|
36 | 36 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |