@@ -12,7 +12,8 @@ |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -function secureWebDocument($docid='') { |
|
15 | +function secureWebDocument($docid='') |
|
16 | +{ |
|
16 | 17 | global $modx; |
17 | 18 | |
18 | 19 | $modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1")); |
@@ -17,7 +17,9 @@ |
||
17 | 17 | |
18 | 18 | $which_browser_default = $which_browser; |
19 | 19 | while ($row = $modx->db->getRow($rs)) { |
20 | - if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
20 | + if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') { |
|
21 | + $row['setting_value'] = $which_browser_default; |
|
22 | + } |
|
21 | 23 | $settings[$row['setting_name']] = $row['setting_value']; |
22 | 24 | if (isset($modx->config)) { |
23 | 25 | $modx->config[$row['setting_name']] = $row['setting_value']; |
@@ -12,16 +12,20 @@ |
||
12 | 12 | $modx->loadExtension('EXPORT_SITE'); |
13 | 13 | |
14 | 14 | |
15 | -if(is_dir(MODX_BASE_PATH . 'temp')) $export_dir = MODX_BASE_PATH . 'temp/export'; |
|
16 | -elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export'; |
|
15 | +if(is_dir(MODX_BASE_PATH . 'temp')) { |
|
16 | + $export_dir = MODX_BASE_PATH . 'temp/export'; |
|
17 | +} elseif(is_dir(MODX_BASE_PATH . 'assets')) { |
|
18 | + $export_dir = MODX_BASE_PATH . 'assets/export'; |
|
19 | +} |
|
17 | 20 | $modx->export->targetDir = $export_dir; |
18 | 21 | |
19 | -if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) |
|
22 | +if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) { |
|
20 | 23 | return $_lang['export_site.static.php6']; |
21 | -elseif($modx->config['rb_base_dir'] === $export_dir . '/') |
|
24 | +} elseif($modx->config['rb_base_dir'] === $export_dir . '/') { |
|
22 | 25 | return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
23 | -elseif(!is_writable($export_dir)) |
|
26 | +} elseif(!is_writable($export_dir)) { |
|
24 | 27 | return $_lang['export_site_target_unwritable']; |
28 | +} |
|
25 | 29 | |
26 | 30 | $modx->export->generate_mode = $_POST['generate_mode']; |
27 | 31 |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | $header="Location: index.php?r=1&a=3&id=$id"; |
37 | 37 | header($header); |
38 | 38 | |
39 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
39 | +function duplicateDocument($docid, $parent=null, $_toplevel=0) |
|
40 | +{ |
|
40 | 41 | global $modx, $_lang; |
41 | 42 | |
42 | 43 | // invoke OnBeforeDocDuplicate event |
@@ -57,8 +58,7 @@ discard block |
||
57 | 58 | $content = $modx->db->getRow($rs); |
58 | 59 | |
59 | 60 | // Handle incremental ID |
60 | - switch($modx->config['docid_incrmnt_method']) |
|
61 | - { |
|
61 | + switch($modx->config['docid_incrmnt_method']) { |
|
62 | 62 | case '1': |
63 | 63 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
64 | 64 | $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
@@ -79,8 +79,11 @@ discard block |
||
79 | 79 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
80 | 80 | $pagetitle = $modx->db->escape($pagetitle); |
81 | 81 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
82 | - if($count>=1) $count = ' '.($count+1); |
|
83 | - else $count = ''; |
|
82 | + if($count>=1) { |
|
83 | + $count = ' '.($count+1); |
|
84 | + } else { |
|
85 | + $count = ''; |
|
86 | + } |
|
84 | 87 | |
85 | 88 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
86 | 89 | $content['alias'] = null; |
@@ -89,7 +92,9 @@ discard block |
||
89 | 92 | } |
90 | 93 | |
91 | 94 | // change the parent accordingly |
92 | - if ($parent !== null) $content['parent'] = $parent; |
|
95 | + if ($parent !== null) { |
|
96 | + $content['parent'] = $parent; |
|
97 | + } |
|
93 | 98 | |
94 | 99 | // Change the author |
95 | 100 | $content['createdby'] = $userID; |
@@ -129,15 +134,17 @@ discard block |
||
129 | 134 | // Start duplicating all the child documents that aren't deleted. |
130 | 135 | $_toplevel++; |
131 | 136 | $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
132 | - while ($row = $modx->db->getRow($rs)) |
|
133 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
137 | + while ($row = $modx->db->getRow($rs)) { |
|
138 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
139 | + } |
|
134 | 140 | |
135 | 141 | // return the new doc id |
136 | 142 | return $newparent; |
137 | 143 | } |
138 | 144 | |
139 | 145 | // Duplicate Document TVs |
140 | -function duplicateTVs($oldid,$newid){ |
|
146 | +function duplicateTVs($oldid,$newid) |
|
147 | +{ |
|
141 | 148 | global $modx; |
142 | 149 | |
143 | 150 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -149,7 +156,8 @@ discard block |
||
149 | 156 | } |
150 | 157 | |
151 | 158 | // Duplicate Document Access Permissions |
152 | -function duplicateAccess($oldid,$newid){ |
|
159 | +function duplicateAccess($oldid,$newid) |
|
160 | +{ |
|
153 | 161 | global $modx; |
154 | 162 | |
155 | 163 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate Plugin |
21 | 24 | $newid = $modx->db->insert( |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate TV |
21 | 24 | $newid = $modx->db->insert( |
@@ -4,7 +4,9 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!isset($_GET['id'])) { |
7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + if(!$modx->hasPermission('remove_locks')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
8 | 10 | |
9 | 11 | // Remove all locks |
10 | 12 | $modx->db->truncate($modx->getFullTableName('active_user_locks')); |
@@ -117,7 +117,7 @@ |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure web documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
120 | +if($updategroupaccess==true) { |
|
121 | 121 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
122 | 122 | secureWebDocument(); |
123 | 123 |
@@ -12,12 +12,20 @@ discard block |
||
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if($documentID==$newParentID) { |
|
16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
17 | +} |
|
18 | +if($documentID <= 0) { |
|
19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
20 | +} |
|
21 | +if($newParentID < 0) { |
|
22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
23 | +} |
|
18 | 24 | |
19 | 25 | $parents = $modx->getParentIds($newParentID); |
20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
21 | 29 | |
22 | 30 | $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
23 | 31 | $oldparent = $modx->db->getValue($rs); |
@@ -38,7 +46,8 @@ discard block |
||
38 | 46 | } |
39 | 47 | } |
40 | 48 | |
41 | -function allChildren($currDocID) { |
|
49 | +function allChildren($currDocID) |
|
50 | +{ |
|
42 | 51 | global $modx; |
43 | 52 | $children= array(); |
44 | 53 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
@@ -56,11 +65,11 @@ discard block |
||
56 | 65 | "old_parent" => $oldparent, |
57 | 66 | "new_parent" => $newParentID |
58 | 67 | )); |
59 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
68 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
60 | 69 | $newParent = array_pop($evtOut); |
61 | 70 | if($newParent == $oldparent) { |
62 | 71 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
63 | - }else{ |
|
72 | + } else { |
|
64 | 73 | $newParentID = $newParent; |
65 | 74 | } |
66 | 75 | } |