@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $modx->db->connect(); |
8 | 8 | $modx->getSettings(); |
9 | 9 | |
10 | -$vword = new VeriWord(148,60); |
|
10 | +$vword = new VeriWord(148, 60); |
|
11 | 11 | $vword->output_image(); |
12 | 12 | $vword->destroy_image(); |
13 | 13 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ## see sample.php for test and usage |
44 | 44 | ## sample URL: http://www.program-ruti.org/veriword/ |
45 | 45 | #### |
46 | -class VeriWord { |
|
46 | +class VeriWord{ |
|
47 | 47 | |
48 | 48 | /* path to font directory*/ |
49 | 49 | var $dir_font = "ttf/"; |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | var $im_width = 0; |
54 | 54 | var $im_height = 0; |
55 | 55 | |
56 | - function __construct($w=200, $h=80) { |
|
56 | + function __construct($w = 200, $h = 80){ |
|
57 | 57 | /* create session to set word for verification */ |
58 | 58 | startCMSSession(); |
59 | 59 | $this->set_veriword(); |
60 | - $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
|
60 | + $this->dir_font = dirname(__FILE__).'/'.$this->dir_font; |
|
61 | 61 | $this->im_width = $w; |
62 | 62 | $this->im_height = $h; |
63 | 63 | } |
64 | 64 | |
65 | - function set_veriword() { |
|
65 | + function set_veriword(){ |
|
66 | 66 | /* create session variable for verification, |
67 | 67 | you may change the session variable name */ |
68 | 68 | $this->word = $this->pick_word(); |
69 | 69 | $_SESSION['veriword'] = $this->word; |
70 | 70 | } |
71 | 71 | |
72 | - function output_image() { |
|
72 | + function output_image(){ |
|
73 | 73 | /* output the image as jpeg */ |
74 | 74 | $this->draw_image(); |
75 | 75 | header("Content-type: image/jpeg"); |
76 | 76 | imagejpeg($this->im); |
77 | 77 | } |
78 | 78 | |
79 | - function pick_word() { |
|
79 | + function pick_word(){ |
|
80 | 80 | global $modx; |
81 | 81 | // set default words |
82 | - $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
82 | + $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
83 | 83 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
84 | 84 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
85 | 85 | |
86 | 86 | /* pick one randomly for text verification */ |
87 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
87 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
88 | 88 | } |
89 | 89 | |
90 | - function draw_text() { |
|
90 | + function draw_text(){ |
|
91 | 91 | $dir = dir($this->dir_font); |
92 | 92 | $fontstmp = array(); |
93 | 93 | while (false !== ($file = $dir->read())) { |
94 | - if(substr($file, -4) == '.ttf') { |
|
94 | + if (substr($file, -4) == '.ttf') { |
|
95 | 95 | $fontstmp[] = $this->dir_font.$file; |
96 | 96 | } |
97 | 97 | } |
@@ -99,35 +99,35 @@ discard block |
||
99 | 99 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
100 | 100 | |
101 | 101 | /* angle for text inclination */ |
102 | - $text_angle = rand(-9,9); |
|
102 | + $text_angle = rand(-9, 9); |
|
103 | 103 | /* initial text size */ |
104 | 104 | $text_size = 30; |
105 | 105 | /* calculate text width and height */ |
106 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
107 | - $text_width = $box[2]-$box[0]; //text width |
|
108 | - $text_height= $box[5]-$box[3]; //text height |
|
106 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
107 | + $text_width = $box[2] - $box[0]; //text width |
|
108 | + $text_height = $box[5] - $box[3]; //text height |
|
109 | 109 | |
110 | 110 | /* adjust text size */ |
111 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
111 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
112 | 112 | |
113 | 113 | /* recalculate text width and height */ |
114 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
115 | - $text_width = $box[2]-$box[0]; //text width |
|
116 | - $text_height= $box[5]-$box[3]; //text height |
|
114 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
115 | + $text_width = $box[2] - $box[0]; //text width |
|
116 | + $text_height = $box[5] - $box[3]; //text height |
|
117 | 117 | |
118 | 118 | /* calculate center position of text */ |
119 | - $text_x = ($this->im_width - $text_width)/2; |
|
120 | - $text_y = ($this->im_height - $text_height)/2; |
|
119 | + $text_x = ($this->im_width - $text_width) / 2; |
|
120 | + $text_y = ($this->im_height - $text_height) / 2; |
|
121 | 121 | |
122 | 122 | /* create canvas for text drawing */ |
123 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
124 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
123 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
124 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
125 | 125 | |
126 | 126 | /* pick color for text */ |
127 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
127 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
128 | 128 | |
129 | 129 | /* draw text into canvas */ |
130 | - imagettftext ( $im_text, |
|
130 | + imagettftext($im_text, |
|
131 | 131 | $text_size, |
132 | 132 | $text_angle, |
133 | 133 | $text_x, |
@@ -143,19 +143,19 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | |
146 | - function draw_image() { |
|
146 | + function draw_image(){ |
|
147 | 147 | |
148 | 148 | /* pick one background image randomly from image directory */ |
149 | - $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
|
149 | + $img_file = $this->dir_noise."noise".rand(1, 4).".jpg"; |
|
150 | 150 | |
151 | 151 | /* create "noise" background image from your image stock*/ |
152 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
152 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
153 | 153 | $noise_width = imagesx($noise_img); |
154 | 154 | $noise_height = imagesy($noise_img); |
155 | 155 | |
156 | 156 | /* resize the background image to fit the size of image output */ |
157 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
158 | - imagecopyresampled ($this->im, |
|
157 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
158 | + imagecopyresampled($this->im, |
|
159 | 159 | $noise_img, |
160 | 160 | 0, 0, 0, 0, |
161 | 161 | $this->im_width, |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | $noise_height); |
165 | 165 | |
166 | 166 | /* put text image into background image */ |
167 | - imagecopymerge ( $this->im, |
|
167 | + imagecopymerge($this->im, |
|
168 | 168 | $this->draw_text(), |
169 | 169 | 0, 0, 0, 0, |
170 | 170 | $this->im_width, |
171 | 171 | $this->im_height, |
172 | - 70 ); |
|
172 | + 70); |
|
173 | 173 | |
174 | 174 | return $this->im; |
175 | 175 | } |
176 | 176 | |
177 | - function destroy_image() { |
|
177 | + function destroy_image(){ |
|
178 | 178 | |
179 | 179 | imagedestroy($this->im); |
180 | 180 |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | ## see sample.php for test and usage |
44 | 44 | ## sample URL: http://www.program-ruti.org/veriword/ |
45 | 45 | #### |
46 | -class VeriWord { |
|
46 | +class VeriWord |
|
47 | +{ |
|
47 | 48 | |
48 | 49 | /* path to font directory*/ |
49 | 50 | var $dir_font = "ttf/"; |
@@ -53,7 +54,8 @@ discard block |
||
53 | 54 | var $im_width = 0; |
54 | 55 | var $im_height = 0; |
55 | 56 | |
56 | - function __construct($w=200, $h=80) { |
|
57 | + function __construct($w=200, $h=80) |
|
58 | + { |
|
57 | 59 | /* create session to set word for verification */ |
58 | 60 | startCMSSession(); |
59 | 61 | $this->set_veriword(); |
@@ -62,21 +64,24 @@ discard block |
||
62 | 64 | $this->im_height = $h; |
63 | 65 | } |
64 | 66 | |
65 | - function set_veriword() { |
|
67 | + function set_veriword() |
|
68 | + { |
|
66 | 69 | /* create session variable for verification, |
67 | 70 | you may change the session variable name */ |
68 | 71 | $this->word = $this->pick_word(); |
69 | 72 | $_SESSION['veriword'] = $this->word; |
70 | 73 | } |
71 | 74 | |
72 | - function output_image() { |
|
75 | + function output_image() |
|
76 | + { |
|
73 | 77 | /* output the image as jpeg */ |
74 | 78 | $this->draw_image(); |
75 | 79 | header("Content-type: image/jpeg"); |
76 | 80 | imagejpeg($this->im); |
77 | 81 | } |
78 | 82 | |
79 | - function pick_word() { |
|
83 | + function pick_word() |
|
84 | + { |
|
80 | 85 | global $modx; |
81 | 86 | // set default words |
82 | 87 | $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
@@ -87,7 +92,8 @@ discard block |
||
87 | 92 | return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
88 | 93 | } |
89 | 94 | |
90 | - function draw_text() { |
|
95 | + function draw_text() |
|
96 | + { |
|
91 | 97 | $dir = dir($this->dir_font); |
92 | 98 | $fontstmp = array(); |
93 | 99 | while (false !== ($file = $dir->read())) { |
@@ -143,7 +149,8 @@ discard block |
||
143 | 149 | } |
144 | 150 | |
145 | 151 | |
146 | - function draw_image() { |
|
152 | + function draw_image() |
|
153 | + { |
|
147 | 154 | |
148 | 155 | /* pick one background image randomly from image directory */ |
149 | 156 | $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
@@ -174,7 +181,8 @@ discard block |
||
174 | 181 | return $this->im; |
175 | 182 | } |
176 | 183 | |
177 | - function destroy_image() { |
|
184 | + function destroy_image() |
|
185 | + { |
|
178 | 186 | |
179 | 187 | imagedestroy($this->im); |
180 | 188 |
@@ -3,23 +3,23 @@ |
||
3 | 3 | |
4 | 4 | // START HACK |
5 | 5 | if (isset ($modx)) { |
6 | - $user_id = $modx->getLoginUserID(); |
|
6 | + $user_id = $modx->getLoginUserID(); |
|
7 | 7 | } else { |
8 | - $user_id = $_SESSION['mgrInternalKey']; |
|
8 | + $user_id = $_SESSION['mgrInternalKey']; |
|
9 | 9 | } |
10 | 10 | // END HACK |
11 | 11 | |
12 | 12 | if (!empty($user_id)) { |
13 | - // Raymond: grab the user settings from the database. |
|
14 | - $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), "user=".$modx->getLoginUserID()); |
|
13 | + // Raymond: grab the user settings from the database. |
|
14 | + $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), "user=".$modx->getLoginUserID()); |
|
15 | 15 | |
16 | - $which_browser_default = $which_browser; |
|
17 | - while ($row = $modx->db->getRow($rs)) { |
|
18 | - if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
19 | - $settings[$row['setting_name']] = $row['setting_value']; |
|
20 | - if (isset($modx->config)) { |
|
21 | - $modx->config[$row['setting_name']] = $row['setting_value']; |
|
22 | - } |
|
23 | - } |
|
24 | - extract($settings, EXTR_OVERWRITE); |
|
16 | + $which_browser_default = $which_browser; |
|
17 | + while ($row = $modx->db->getRow($rs)) { |
|
18 | + if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
19 | + $settings[$row['setting_name']] = $row['setting_value']; |
|
20 | + if (isset($modx->config)) { |
|
21 | + $modx->config[$row['setting_name']] = $row['setting_value']; |
|
22 | + } |
|
23 | + } |
|
24 | + extract($settings, EXTR_OVERWRITE); |
|
25 | 25 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -17,7 +17,7 @@ discard block |
||
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') $row['setting_value'] = $which_browser_default; |
|
21 | 21 | $settings[$row['setting_name']] = $row['setting_value']; |
22 | 22 | if (isset($modx->config)) { |
23 | 23 | $modx->config[$row['setting_name']] = $row['setting_value']; |
@@ -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']; |
@@ -11,18 +11,18 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | function secureWebDocument($docid='') { |
14 | - global $modx; |
|
14 | + global $modx; |
|
15 | 15 | |
16 | - $modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1")); |
|
17 | - $rs = $modx->db->select( |
|
18 | - 'DISTINCT sc.id', |
|
19 | - $modx->getFullTableName("site_content")." sc |
|
16 | + $modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1")); |
|
17 | + $rs = $modx->db->select( |
|
18 | + 'DISTINCT sc.id', |
|
19 | + $modx->getFullTableName("site_content")." sc |
|
20 | 20 | LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
21 | 21 | LEFT JOIN ".$modx->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group", |
22 | - ($docid>0 ? " sc.id='{$docid}' AND ":"")."wga.id>0" |
|
23 | - ); |
|
24 | - $ids = $modx->db->getColumn("id",$rs); |
|
25 | - if(count($ids)>0) { |
|
26 | - $modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
27 | - } |
|
22 | + ($docid>0 ? " sc.id='{$docid}' AND ":"")."wga.id>0" |
|
23 | + ); |
|
24 | + $ids = $modx->db->getColumn("id",$rs); |
|
25 | + if(count($ids)>0) { |
|
26 | + $modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
27 | + } |
|
28 | 28 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -function secureWebDocument($docid='') { |
|
15 | +function secureWebDocument($docid = ''){ |
|
16 | 16 | global $modx; |
17 | 17 | |
18 | - $modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1")); |
|
18 | + $modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid > 0 ? "id='$docid'" : "privateweb = 1")); |
|
19 | 19 | $rs = $modx->db->select( |
20 | 20 | 'DISTINCT sc.id', |
21 | 21 | $modx->getFullTableName("site_content")." sc |
22 | 22 | LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
23 | 23 | LEFT JOIN ".$modx->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group", |
24 | - ($docid>0 ? " sc.id='{$docid}' AND ":"")."wga.id>0" |
|
24 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0" |
|
25 | 25 | ); |
26 | - $ids = $modx->db->getColumn("id",$rs); |
|
27 | - if(count($ids)>0) { |
|
28 | - $modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
26 | + $ids = $modx->db->getColumn("id", $rs); |
|
27 | + if (count($ids) > 0) { |
|
28 | + $modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ", $ids).")"); |
|
29 | 29 | } |
30 | 30 | } |
@@ -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")); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | // ajax response |
11 | 11 | if (isset($_POST['updateMsgCount'])) { |
12 | - header("Content-Type: application/json; charset=utf-8"); |
|
13 | - print $nrnewmessages.','.$nrtotalmessages; |
|
14 | - exit; |
|
12 | + header("Content-Type: application/json; charset=utf-8"); |
|
13 | + print $nrnewmessages.','.$nrtotalmessages; |
|
14 | + exit; |
|
15 | 15 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | // load template |
24 | 24 | if(!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) { |
25 | - $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
25 | + $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $target = $modx->config['manager_lockout_tpl']; |
@@ -30,40 +30,40 @@ discard block |
||
30 | 30 | $target = $modx->mergeSettingsContent($target); |
31 | 31 | |
32 | 32 | if(substr($target,0,1)==='@') { |
33 | - if(substr($target,0,6)==='@CHUNK') { |
|
34 | - $target = trim(substr($target,7)); |
|
35 | - $lockout_tpl = $modx->getChunk($target); |
|
36 | - } |
|
37 | - elseif(substr($target,0,5)==='@FILE') { |
|
38 | - $target = trim(substr($target,6)); |
|
39 | - $lockout_tpl = file_get_contents($target); |
|
40 | - } |
|
41 | - } else { |
|
42 | - $chunk = $modx->getChunk($target); |
|
43 | - if($chunk!==false && !empty($chunk)) { |
|
44 | - $lockout_tpl = $chunk; |
|
45 | - } |
|
46 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
47 | - $target = MODX_BASE_PATH . $target; |
|
48 | - $lockout_tpl = file_get_contents($target); |
|
49 | - } |
|
50 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
51 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
|
52 | - $lockout_tpl = file_get_contents($target); |
|
53 | - } |
|
54 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
55 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
|
56 | - $login_tpl = file_get_contents($target); |
|
57 | - } |
|
58 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
59 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
|
60 | - $lockout_tpl = file_get_contents($target); |
|
61 | - } |
|
62 | - else { |
|
63 | - $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
64 | - $lockout_tpl = file_get_contents($target); |
|
65 | - } |
|
66 | - } |
|
33 | + if(substr($target,0,6)==='@CHUNK') { |
|
34 | + $target = trim(substr($target,7)); |
|
35 | + $lockout_tpl = $modx->getChunk($target); |
|
36 | + } |
|
37 | + elseif(substr($target,0,5)==='@FILE') { |
|
38 | + $target = trim(substr($target,6)); |
|
39 | + $lockout_tpl = file_get_contents($target); |
|
40 | + } |
|
41 | + } else { |
|
42 | + $chunk = $modx->getChunk($target); |
|
43 | + if($chunk!==false && !empty($chunk)) { |
|
44 | + $lockout_tpl = $chunk; |
|
45 | + } |
|
46 | + elseif(is_file(MODX_BASE_PATH . $target)) { |
|
47 | + $target = MODX_BASE_PATH . $target; |
|
48 | + $lockout_tpl = file_get_contents($target); |
|
49 | + } |
|
50 | + elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
51 | + $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
|
52 | + $lockout_tpl = file_get_contents($target); |
|
53 | + } |
|
54 | + elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
55 | + $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
|
56 | + $login_tpl = file_get_contents($target); |
|
57 | + } |
|
58 | + elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
59 | + $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
|
60 | + $lockout_tpl = file_get_contents($target); |
|
61 | + } |
|
62 | + else { |
|
63 | + $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
64 | + $lockout_tpl = file_get_contents($target); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | // merge placeholders |
69 | 69 | $lockout_tpl = $modx->mergePlaceholderContent($lockout_tpl); |
@@ -1,75 +1,75 @@ |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -if($modx->manager->action!='8' && isset($_SESSION['mgrValidated'])){ |
|
6 | +if ($modx->manager->action != '8' && isset($_SESSION['mgrValidated'])) { |
|
7 | 7 | |
8 | - $homeurl = $modx->makeUrl($manager_login_startup>0 ? $manager_login_startup:$site_start); |
|
8 | + $homeurl = $modx->makeUrl($manager_login_startup > 0 ? $manager_login_startup : $site_start); |
|
9 | 9 | $logouturl = MODX_MANAGER_URL.'index.php?a=8'; |
10 | 10 | |
11 | - $modx->setPlaceholder('modx_charset',$modx_manager_charset); |
|
12 | - $modx->setPlaceholder('theme',$manager_theme); |
|
11 | + $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
|
12 | + $modx->setPlaceholder('theme', $manager_theme); |
|
13 | 13 | |
14 | - $modx->setPlaceholder('site_name',$site_name); |
|
15 | - $modx->setPlaceholder('logo_slogan',$_lang["logo_slogan"]); |
|
16 | - $modx->setPlaceholder('manager_lockout_message',$_lang["manager_lockout_message"]); |
|
14 | + $modx->setPlaceholder('site_name', $site_name); |
|
15 | + $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
|
16 | + $modx->setPlaceholder('manager_lockout_message', $_lang["manager_lockout_message"]); |
|
17 | 17 | |
18 | - $modx->setPlaceholder('home',$_lang["home"]); |
|
19 | - $modx->setPlaceholder('homeurl',$homeurl); |
|
20 | - $modx->setPlaceholder('logout',$_lang["logout"]); |
|
21 | - $modx->setPlaceholder('logouturl',$logouturl); |
|
22 | - $modx->setPlaceholder('manager_theme_url',MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
23 | - $modx->setPlaceholder('year',date('Y')); |
|
18 | + $modx->setPlaceholder('home', $_lang["home"]); |
|
19 | + $modx->setPlaceholder('homeurl', $homeurl); |
|
20 | + $modx->setPlaceholder('logout', $_lang["logout"]); |
|
21 | + $modx->setPlaceholder('logouturl', $logouturl); |
|
22 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
23 | + $modx->setPlaceholder('year', date('Y')); |
|
24 | 24 | |
25 | 25 | // load template |
26 | - if(!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) { |
|
27 | - $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
26 | + if (!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) { |
|
27 | + $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH.'media/style/common/manager.lockout.tpl'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $target = $modx->config['manager_lockout_tpl']; |
31 | 31 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
32 | 32 | $target = $modx->mergeSettingsContent($target); |
33 | 33 | |
34 | - if(substr($target,0,1)==='@') { |
|
35 | - if(substr($target,0,6)==='@CHUNK') { |
|
36 | - $target = trim(substr($target,7)); |
|
34 | + if (substr($target, 0, 1) === '@') { |
|
35 | + if (substr($target, 0, 6) === '@CHUNK') { |
|
36 | + $target = trim(substr($target, 7)); |
|
37 | 37 | $lockout_tpl = $modx->getChunk($target); |
38 | 38 | } |
39 | - elseif(substr($target,0,5)==='@FILE') { |
|
40 | - $target = trim(substr($target,6)); |
|
39 | + elseif (substr($target, 0, 5) === '@FILE') { |
|
40 | + $target = trim(substr($target, 6)); |
|
41 | 41 | $lockout_tpl = file_get_contents($target); |
42 | 42 | } |
43 | 43 | } else { |
44 | 44 | $chunk = $modx->getChunk($target); |
45 | - if($chunk!==false && !empty($chunk)) { |
|
45 | + if ($chunk !== false && !empty($chunk)) { |
|
46 | 46 | $lockout_tpl = $chunk; |
47 | 47 | } |
48 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
49 | - $target = MODX_BASE_PATH . $target; |
|
48 | + elseif (is_file(MODX_BASE_PATH.$target)) { |
|
49 | + $target = MODX_BASE_PATH.$target; |
|
50 | 50 | $lockout_tpl = file_get_contents($target); |
51 | 51 | } |
52 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
53 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
|
52 | + elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/manager.lockout.tpl')) { |
|
53 | + $target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/manager.lockout.tpl'; |
|
54 | 54 | $lockout_tpl = file_get_contents($target); |
55 | 55 | } |
56 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
57 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
|
56 | + elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/templates/actions/manager.lockout.tpl')) { |
|
57 | + $target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/templates/actions/manager.lockout.tpl'; |
|
58 | 58 | $login_tpl = file_get_contents($target); |
59 | 59 | } |
60 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
61 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
|
60 | + elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/manager.lockout.html')) { // ClipperCMS compatible |
|
61 | + $target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/manager.lockout.html'; |
|
62 | 62 | $lockout_tpl = file_get_contents($target); |
63 | 63 | } |
64 | 64 | else { |
65 | - $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
65 | + $target = MODX_MANAGER_PATH.'media/style/common/manager.lockout.tpl'; |
|
66 | 66 | $lockout_tpl = file_get_contents($target); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // merge placeholders |
71 | 71 | $lockout_tpl = $modx->mergePlaceholderContent($lockout_tpl); |
72 | - $regx = strpos($lockout_tpl,'[[+')!==false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers |
|
72 | + $regx = strpos($lockout_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers |
|
73 | 73 | $lockout_tpl = preg_replace($regx, '', $lockout_tpl); //cleanup |
74 | 74 | |
75 | 75 | echo $lockout_tpl; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -if($modx->manager->action!='8' && isset($_SESSION['mgrValidated'])){ |
|
6 | +if($modx->manager->action!='8' && isset($_SESSION['mgrValidated'])) { |
|
7 | 7 | |
8 | 8 | $homeurl = $modx->makeUrl($manager_login_startup>0 ? $manager_login_startup:$site_start); |
9 | 9 | $logouturl = MODX_MANAGER_URL.'index.php?a=8'; |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | if(substr($target,0,6)==='@CHUNK') { |
36 | 36 | $target = trim(substr($target,7)); |
37 | 37 | $lockout_tpl = $modx->getChunk($target); |
38 | - } |
|
39 | - elseif(substr($target,0,5)==='@FILE') { |
|
38 | + } elseif(substr($target,0,5)==='@FILE') { |
|
40 | 39 | $target = trim(substr($target,6)); |
41 | 40 | $lockout_tpl = file_get_contents($target); |
42 | 41 | } |
@@ -44,24 +43,20 @@ discard block |
||
44 | 43 | $chunk = $modx->getChunk($target); |
45 | 44 | if($chunk!==false && !empty($chunk)) { |
46 | 45 | $lockout_tpl = $chunk; |
47 | - } |
|
48 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
46 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
49 | 47 | $target = MODX_BASE_PATH . $target; |
50 | 48 | $lockout_tpl = file_get_contents($target); |
51 | - } |
|
52 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
49 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
53 | 50 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
54 | 51 | $lockout_tpl = file_get_contents($target); |
55 | - } |
|
56 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
52 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
57 | 53 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
58 | 54 | $login_tpl = file_get_contents($target); |
59 | - } |
|
60 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
55 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { |
|
56 | +// ClipperCMS compatible |
|
61 | 57 | $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
62 | 58 | $lockout_tpl = file_get_contents($target); |
63 | - } |
|
64 | - else { |
|
59 | + } else { |
|
65 | 60 | $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
66 | 61 | $lockout_tpl = file_get_contents($target); |
67 | 62 | } |
@@ -11,18 +11,18 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | function secureMgrDocument($docid='') { |
14 | - global $modx; |
|
14 | + global $modx; |
|
15 | 15 | |
16 | - $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
17 | - $rs = $modx->db->select( |
|
18 | - 'DISTINCT sc.id', |
|
19 | - $modx->getFullTableName("site_content")." sc |
|
16 | + $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
17 | + $rs = $modx->db->select( |
|
18 | + 'DISTINCT sc.id', |
|
19 | + $modx->getFullTableName("site_content")." sc |
|
20 | 20 | LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
21 | 21 | LEFT JOIN ".$modx->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group", |
22 | - ($docid>0 ? " sc.id='{$docid}' AND ":"")."mga.id>0" |
|
23 | - ); |
|
24 | - $ids = $modx->db->getColumn("id",$rs); |
|
25 | - if(count($ids)>0) { |
|
26 | - $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
27 | - } |
|
22 | + ($docid>0 ? " sc.id='{$docid}' AND ":"")."mga.id>0" |
|
23 | + ); |
|
24 | + $ids = $modx->db->getColumn("id",$rs); |
|
25 | + if(count($ids)>0) { |
|
26 | + $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
27 | + } |
|
28 | 28 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -function secureMgrDocument($docid='') { |
|
15 | +function secureMgrDocument($docid = ''){ |
|
16 | 16 | global $modx; |
17 | 17 | |
18 | - $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
18 | + $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid > 0 ? "id='$docid'" : "privatemgr = 1")); |
|
19 | 19 | $rs = $modx->db->select( |
20 | 20 | 'DISTINCT sc.id', |
21 | 21 | $modx->getFullTableName("site_content")." sc |
22 | 22 | LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
23 | 23 | LEFT JOIN ".$modx->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group", |
24 | - ($docid>0 ? " sc.id='{$docid}' AND ":"")."mga.id>0" |
|
24 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."mga.id>0" |
|
25 | 25 | ); |
26 | - $ids = $modx->db->getColumn("id",$rs); |
|
27 | - if(count($ids)>0) { |
|
28 | - $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
26 | + $ids = $modx->db->getColumn("id", $rs); |
|
27 | + if (count($ids) > 0) { |
|
28 | + $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ", $ids).")"); |
|
29 | 29 | } |
30 | 30 | } |
@@ -12,7 +12,8 @@ |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -function secureMgrDocument($docid='') { |
|
15 | +function secureMgrDocument($docid='') |
|
16 | +{ |
|
16 | 17 | global $modx; |
17 | 18 | |
18 | 19 | $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
@@ -16,35 +16,35 @@ discard block |
||
16 | 16 | $install_language = "english"; |
17 | 17 | |
18 | 18 | $_langFiles= array ( |
19 | - "en" => "english", |
|
20 | - "bg" => "bulgarian", |
|
21 | - "cs" => "czech", |
|
22 | - "da" => "danish", |
|
23 | - "fi" => "finnish-utf8", |
|
24 | - "fr" => "francais-utf8", |
|
25 | - "de" => "german", |
|
26 | - "he" => "hebrew", |
|
27 | - "it" => "italian", |
|
28 | - "ja" => "japanese-utf8", |
|
29 | - "nl" => "nederlands-utf8", |
|
30 | - "no" => "norwegian", |
|
31 | - "fa" => "persian", |
|
32 | - "pl" => "polish-utf8", |
|
33 | - "pt" => "portuguese-br-utf8", |
|
19 | + "en" => "english", |
|
20 | + "bg" => "bulgarian", |
|
21 | + "cs" => "czech", |
|
22 | + "da" => "danish", |
|
23 | + "fi" => "finnish-utf8", |
|
24 | + "fr" => "francais-utf8", |
|
25 | + "de" => "german", |
|
26 | + "he" => "hebrew", |
|
27 | + "it" => "italian", |
|
28 | + "ja" => "japanese-utf8", |
|
29 | + "nl" => "nederlands-utf8", |
|
30 | + "no" => "norwegian", |
|
31 | + "fa" => "persian", |
|
32 | + "pl" => "polish-utf8", |
|
33 | + "pt" => "portuguese-br-utf8", |
|
34 | 34 | // "pt" => "portuguese", |
35 | - "ru" => "russian-UTF8", |
|
36 | - "es" => "spanish-utf8", |
|
37 | - "sv" => "svenska" |
|
35 | + "ru" => "russian-UTF8", |
|
36 | + "es" => "spanish-utf8", |
|
37 | + "sv" => "svenska" |
|
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); |
40 | 40 | if (!empty($_langFiles[$_langISO6391])) $install_language = $_langFiles[$_langISO6391]; |
41 | 41 | |
42 | 42 | |
43 | 43 | if (isset($_POST['language']) && !stristr($_POST['language'],"..")) { |
44 | - $install_language = $_POST['language']; |
|
44 | + $install_language = $_POST['language']; |
|
45 | 45 | } else { |
46 | - if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
47 | - $install_language = $_GET['language']; |
|
46 | + if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
47 | + $install_language = $_GET['language']; |
|
48 | 48 | } |
49 | 49 | # load language file |
50 | 50 | require_once("lang/english.inc.php"); // As fallback |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | $manager_language = $install_language; |
54 | 54 | |
55 | 55 | if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) { |
56 | - $manager_language = $_POST['managerlanguage']; |
|
56 | + $manager_language = $_POST['managerlanguage']; |
|
57 | 57 | } else { |
58 | - if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
59 | - $manager_language = $_GET['managerlanguage']; |
|
58 | + if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
59 | + $manager_language = $_GET['managerlanguage']; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | foreach($_lang as $k=>$v) |
63 | 63 | { |
64 | - if(strpos($v,'[+MGR_DIR+]')!==false) |
|
65 | - $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
64 | + if(strpos($v,'[+MGR_DIR+]')!==false) |
|
65 | + $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
66 | 66 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | * Filename: /install/lang.php |
11 | 11 | */ |
12 | 12 | |
13 | -$_lang = array (); |
|
13 | +$_lang = array(); |
|
14 | 14 | |
15 | 15 | #default fallback language file - english |
16 | 16 | $install_language = "english"; |
17 | 17 | |
18 | -$_langFiles= array ( |
|
18 | +$_langFiles = array( |
|
19 | 19 | "en" => "english", |
20 | 20 | "bg" => "bulgarian", |
21 | 21 | "cs" => "czech", |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | "es" => "spanish-utf8", |
37 | 37 | "sv" => "svenska" |
38 | 38 | ); |
39 | -$_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); |
|
39 | +$_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); |
|
40 | 40 | if (!empty($_langFiles[$_langISO6391])) $install_language = $_langFiles[$_langISO6391]; |
41 | 41 | |
42 | 42 | |
43 | -if (isset($_POST['language']) && !stristr($_POST['language'],"..")) { |
|
43 | +if (isset($_POST['language']) && !stristr($_POST['language'], "..")) { |
|
44 | 44 | $install_language = $_POST['language']; |
45 | 45 | } else { |
46 | - if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
46 | + if (isset($_GET['language']) && !stristr($_GET['language'], "..")) |
|
47 | 47 | $install_language = $_GET['language']; |
48 | 48 | } |
49 | 49 | # load language file |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | |
53 | 53 | $manager_language = $install_language; |
54 | 54 | |
55 | -if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) { |
|
55 | +if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'], "..")) { |
|
56 | 56 | $manager_language = $_POST['managerlanguage']; |
57 | 57 | } else { |
58 | - if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
58 | + if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'], "..")) |
|
59 | 59 | $manager_language = $_GET['managerlanguage']; |
60 | 60 | } |
61 | 61 | |
62 | -foreach($_lang as $k=>$v) |
|
62 | +foreach ($_lang as $k=>$v) |
|
63 | 63 | { |
64 | - if(strpos($v,'[+MGR_DIR+]')!==false) |
|
64 | + if (strpos($v, '[+MGR_DIR+]') !== false) |
|
65 | 65 | $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
66 | 66 | } |
@@ -37,15 +37,18 @@ discard block |
||
37 | 37 | "sv" => "svenska" |
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); |
40 | -if (!empty($_langFiles[$_langISO6391])) $install_language = $_langFiles[$_langISO6391]; |
|
40 | +if (!empty($_langFiles[$_langISO6391])) { |
|
41 | + $install_language = $_langFiles[$_langISO6391]; |
|
42 | +} |
|
41 | 43 | |
42 | 44 | |
43 | 45 | if (isset($_POST['language']) && !stristr($_POST['language'],"..")) { |
44 | 46 | $install_language = $_POST['language']; |
45 | 47 | } else { |
46 | - if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
47 | - $install_language = $_GET['language']; |
|
48 | -} |
|
48 | + if (isset($_GET['language']) && !stristr($_GET['language'],"..")) { |
|
49 | + $install_language = $_GET['language']; |
|
50 | + } |
|
51 | + } |
|
49 | 52 | # load language file |
50 | 53 | require_once("lang/english.inc.php"); // As fallback |
51 | 54 | require_once("lang/".$install_language.".inc.php"); |
@@ -55,12 +58,13 @@ discard block |
||
55 | 58 | if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) { |
56 | 59 | $manager_language = $_POST['managerlanguage']; |
57 | 60 | } else { |
58 | - if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
59 | - $manager_language = $_GET['managerlanguage']; |
|
60 | -} |
|
61 | + if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) { |
|
62 | + $manager_language = $_GET['managerlanguage']; |
|
63 | + } |
|
64 | + } |
|
61 | 65 | |
62 | -foreach($_lang as $k=>$v) |
|
63 | -{ |
|
64 | - if(strpos($v,'[+MGR_DIR+]')!==false) |
|
65 | - $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
66 | -} |
|
66 | +foreach($_lang as $k=>$v) { |
|
67 | + if(strpos($v,'[+MGR_DIR+]')!==false) { |
|
68 | + $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
69 | + } |
|
70 | + } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('getLangOptions')) { |
|
2 | +if (!function_exists('getLangOptions')) { |
|
3 | 3 | /** |
4 | 4 | * @param string $install_language |
5 | 5 | * @return string |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $abrv_language = explode('-', $language); |
22 | 22 | $selected = ($language === $install_language) ? 'selected' : ''; |
23 | 23 | $_[] = sprintf('<option value="%s" %s>%s</option>', $language, $selected, |
24 | - ucwords($abrv_language[0])) . "\n"; |
|
24 | + ucwords($abrv_language[0]))."\n"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | return implode("\n", $_); |
@@ -32,6 +32,6 @@ discard block |
||
32 | 32 | $content = parse($content, array( |
33 | 33 | 'langOptions' => getLangOptions($install_language)) |
34 | 34 | ); |
35 | -$content = parse($content, $_lang,'[%','%]'); |
|
35 | +$content = parse($content, $_lang, '[%', '%]'); |
|
36 | 36 | |
37 | 37 | echo $content; |
@@ -515,6 +515,9 @@ discard block |
||
515 | 515 | $this->setDroptables(false); |
516 | 516 | } |
517 | 517 | |
518 | + /** |
|
519 | + * @param boolean $state |
|
520 | + */ |
|
518 | 521 | public function setDroptables($state) |
519 | 522 | { |
520 | 523 | $this->_isDroptables = $state; |
@@ -722,6 +725,9 @@ discard block |
||
722 | 725 | $_SESSION['result_msg'] = $result_code; |
723 | 726 | } |
724 | 727 | |
728 | +/** |
|
729 | + * @param string $dumpstring |
|
730 | + */ |
|
725 | 731 | function dumpSql(&$dumpstring) |
726 | 732 | { |
727 | 733 | global $modx; |
@@ -741,6 +747,9 @@ discard block |
||
741 | 747 | return true; |
742 | 748 | } |
743 | 749 | |
750 | +/** |
|
751 | + * @param string $dumpstring |
|
752 | + */ |
|
744 | 753 | function snapshot(&$dumpstring) |
745 | 754 | { |
746 | 755 | global $path; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('bk_manager')) { |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | $dbase = trim($dbase, '`'); |
10 | 10 | |
11 | 11 | if (!isset($modx->config['snapshot_path'])) { |
12 | - if (is_dir(MODX_BASE_PATH . 'temp/backup/')) { |
|
13 | - $modx->config['snapshot_path'] = MODX_BASE_PATH . 'temp/backup/'; |
|
12 | + if (is_dir(MODX_BASE_PATH.'temp/backup/')) { |
|
13 | + $modx->config['snapshot_path'] = MODX_BASE_PATH.'temp/backup/'; |
|
14 | 14 | } else { |
15 | - $modx->config['snapshot_path'] = MODX_BASE_PATH . 'assets/backup/'; |
|
15 | + $modx->config['snapshot_path'] = MODX_BASE_PATH.'assets/backup/'; |
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if ($mode == 'restore1') { |
24 | 24 | if (isset($_POST['textarea']) && !empty($_POST['textarea'])) { |
25 | 25 | $source = trim($_POST['textarea']); |
26 | - $_SESSION['textarea'] = $source . "\n"; |
|
26 | + $_SESSION['textarea'] = $source."\n"; |
|
27 | 27 | } else { |
28 | 28 | $source = file_get_contents($_FILES['sqlfile']['tmp_name']); |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | header('Location: index.php?r=9&a=93'); |
32 | 32 | exit; |
33 | 33 | } elseif ($mode == 'restore2') { |
34 | - $path = $modx->config['snapshot_path'] . $_POST['filename']; |
|
34 | + $path = $modx->config['snapshot_path'].$_POST['filename']; |
|
35 | 35 | if (file_exists($path)) { |
36 | 36 | $source = file_get_contents($path); |
37 | 37 | import_sql($source); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (!is_writable(rtrim($modx->config['snapshot_path'], '/'))) { |
78 | 78 | $modx->webAlertAndQuit(parsePlaceholder($_lang["bkmgr_alert_mkdir"], array('snapshot_path' => $modx->config['snapshot_path']))); |
79 | 79 | } |
80 | - $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%'"; |
|
80 | + $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%'"; |
|
81 | 81 | $rs = $modx->db->query($sql); |
82 | 82 | $tables = $modx->db->getColumn('Name', $rs); |
83 | 83 | $today = date('Y-m-d_H-i-s'); |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | $modx->webAlertAndQuit('Unable to Backup Database'); |
110 | 110 | } |
111 | 111 | } else { |
112 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; // start normal header |
|
112 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; // start normal header |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | if (isset($_SESSION['result_msg']) && $_SESSION['result_msg'] != '') { |
116 | 116 | switch ($_SESSION['result_msg']) { |
117 | 117 | case 'import_ok': |
118 | - $ph['result_msg_import'] = '<div class="alert alert-success">' . $_lang["bkmgr_import_ok"] . '</div>'; |
|
119 | - $ph['result_msg_snapshot'] = '<div class="alert alert-success">' . $_lang["bkmgr_import_ok"] . '</div>'; |
|
118 | + $ph['result_msg_import'] = '<div class="alert alert-success">'.$_lang["bkmgr_import_ok"].'</div>'; |
|
119 | + $ph['result_msg_snapshot'] = '<div class="alert alert-success">'.$_lang["bkmgr_import_ok"].'</div>'; |
|
120 | 120 | break; |
121 | 121 | case 'snapshot_ok': |
122 | 122 | $ph['result_msg_import'] = ''; |
123 | - $ph['result_msg_snapshot'] = '<div class="alert alert-success">' . $_lang["bkmgr_snapshot_ok"] . '</div>'; |
|
123 | + $ph['result_msg_snapshot'] = '<div class="alert alert-success">'.$_lang["bkmgr_snapshot_ok"].'</div>'; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | $_SESSION['result_msg'] = ''; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | f.style.display = 'none'; |
180 | 180 | } |
181 | 181 | } |
182 | - <?= (isset($_REQUEST['r']) ? " doRefresh(" . $_REQUEST['r'] . ");" : "") ?> |
|
182 | + <?= (isset($_REQUEST['r']) ? " doRefresh(".$_REQUEST['r'].");" : "") ?> |
|
183 | 183 | |
184 | 184 | </script> |
185 | 185 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | </thead> |
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | - $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%'"; |
|
226 | + $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%'"; |
|
227 | 227 | $rs = $modx->db->query($sql); |
228 | 228 | $i = 0; |
229 | 229 | while ($db_status = $modx->db->getRow($rs)) { |
@@ -233,29 +233,29 @@ discard block |
||
233 | 233 | $table_string = ''; |
234 | 234 | } |
235 | 235 | |
236 | - echo '<tr>' . "\n" . '<td><label class="form-check form-check-label"><input type="checkbox" name="chk[]" class="form-check-input" value="' . $db_status['Name'] . '"' . (strstr($table_string, $db_status['Name']) === false ? '' : ' checked="checked"') . ' /><b class="text-primary">' . $db_status['Name'] . '</b></label></td>' . "\n"; |
|
237 | - echo '<td class="text-xs-center">' . (!empty($db_status['Comment']) ? '<i class="' . $_style['actions_help'] . '" data-tooltip="' . $db_status['Comment'] . '"></i>' : '') . '</td>' . "\n"; |
|
238 | - echo '<td class="text-xs-right">' . $db_status['Rows'] . '</td>' . "\n"; |
|
239 | - echo '<td class="text-xs-right">' . $db_status['Collation'] . '</td>' . "\n"; |
|
236 | + echo '<tr>'."\n".'<td><label class="form-check form-check-label"><input type="checkbox" name="chk[]" class="form-check-input" value="'.$db_status['Name'].'"'.(strstr($table_string, $db_status['Name']) === false ? '' : ' checked="checked"').' /><b class="text-primary">'.$db_status['Name'].'</b></label></td>'."\n"; |
|
237 | + echo '<td class="text-xs-center">'.(!empty($db_status['Comment']) ? '<i class="'.$_style['actions_help'].'" data-tooltip="'.$db_status['Comment'].'"></i>' : '').'</td>'."\n"; |
|
238 | + echo '<td class="text-xs-right">'.$db_status['Rows'].'</td>'."\n"; |
|
239 | + echo '<td class="text-xs-right">'.$db_status['Collation'].'</td>'."\n"; |
|
240 | 240 | |
241 | 241 | // Enable record deletion for certain tables (TRUNCATE TABLE) if they're not already empty |
242 | 242 | $truncateable = array( |
243 | - $modx->db->config['table_prefix'] . 'event_log', |
|
244 | - $modx->db->config['table_prefix'] . 'manager_log', |
|
243 | + $modx->db->config['table_prefix'].'event_log', |
|
244 | + $modx->db->config['table_prefix'].'manager_log', |
|
245 | 245 | ); |
246 | 246 | if ($modx->hasPermission('settings') && in_array($db_status['Name'], $truncateable) && $db_status['Rows'] > 0) { |
247 | - echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode=' . $action . '&u=' . $db_status['Name'] . '" title="' . $_lang['truncate_table'] . '">' . $modx->nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</a>' . '</td>' . "\n"; |
|
247 | + echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode='.$action.'&u='.$db_status['Name'].'" title="'.$_lang['truncate_table'].'">'.$modx->nicesize($db_status['Data_length'] + $db_status['Data_free']).'</a>'.'</td>'."\n"; |
|
248 | 248 | } else { |
249 | - echo '<td class="text-xs-right">' . $modx->nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</td>' . "\n"; |
|
249 | + echo '<td class="text-xs-right">'.$modx->nicesize($db_status['Data_length'] + $db_status['Data_free']).'</td>'."\n"; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if ($modx->hasPermission('settings')) { |
253 | - echo '<td class="text-xs-right">' . ($db_status['Data_free'] > 0 ? '<a class="text-danger" href="index.php?a=54&mode=' . $action . '&t=' . $db_status['Name'] . '" title="' . $_lang['optimize_table'] . '">' . $modx->nicesize($db_status['Data_free']) . '</a>' : '-') . '</td>' . "\n"; |
|
253 | + echo '<td class="text-xs-right">'.($db_status['Data_free'] > 0 ? '<a class="text-danger" href="index.php?a=54&mode='.$action.'&t='.$db_status['Name'].'" title="'.$_lang['optimize_table'].'">'.$modx->nicesize($db_status['Data_free']).'</a>' : '-').'</td>'."\n"; |
|
254 | 254 | } else { |
255 | - echo '<td class="text-xs-right">' . ($db_status['Data_free'] > 0 ? $modx->nicesize($db_status['Data_free']) : '-') . '</td>' . "\n"; |
|
255 | + echo '<td class="text-xs-right">'.($db_status['Data_free'] > 0 ? $modx->nicesize($db_status['Data_free']) : '-').'</td>'."\n"; |
|
256 | 256 | } |
257 | 257 | |
258 | - echo '<td class="text-xs-right">' . $modx->nicesize($db_status['Data_length'] - $db_status['Data_free']) . '</td>' . "\n" . '<td class="text-xs-right">' . $modx->nicesize($db_status['Index_length']) . '</td>' . "\n" . '<td class="text-xs-right">' . $modx->nicesize($db_status['Index_length'] + $db_status['Data_length'] + $db_status['Data_free']) . '</td>' . "\n" . "</tr>"; |
|
258 | + echo '<td class="text-xs-right">'.$modx->nicesize($db_status['Data_length'] - $db_status['Data_free']).'</td>'."\n".'<td class="text-xs-right">'.$modx->nicesize($db_status['Index_length']).'</td>'."\n".'<td class="text-xs-right">'.$modx->nicesize($db_status['Index_length'] + $db_status['Data_length'] + $db_status['Data_free']).'</td>'."\n"."</tr>"; |
|
259 | 259 | |
260 | 260 | $total = $total + $db_status['Index_length'] + $db_status['Data_length']; |
261 | 261 | $totaloverhead = $totaloverhead + $db_status['Data_free']; |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | <tr> |
267 | 267 | <td class="text-xs-right"><?= $_lang['database_table_totals'] ?></td> |
268 | 268 | <td colspan="4"> </td> |
269 | - <td class="text-xs-right"><?= $totaloverhead > 0 ? '<b class="text-danger">' . $modx->nicesize($totaloverhead) . '</b><br />(' . number_format($totaloverhead) . ' B)' : '-' ?></td> |
|
269 | + <td class="text-xs-right"><?= $totaloverhead > 0 ? '<b class="text-danger">'.$modx->nicesize($totaloverhead).'</b><br />('.number_format($totaloverhead).' B)' : '-' ?></td> |
|
270 | 270 | <td colspan="2"> </td> |
271 | - <td class="text-xs-right"><?= "<b>" . $modx->nicesize($total) . "</b><br />(" . number_format($total) . " B)" ?></td> |
|
271 | + <td class="text-xs-right"><?= "<b>".$modx->nicesize($total)."</b><br />(".number_format($total)." B)" ?></td> |
|
272 | 272 | </tr> |
273 | 273 | </tfoot> |
274 | 274 | </table> |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | foreach ($last_result['0'] as $k => $v) { |
320 | 320 | $title[] = $k; |
321 | 321 | } |
322 | - $result = '<thead><tr><th>' . implode('</th><th>', $title) . '</th></tr></thead>'; |
|
322 | + $result = '<thead><tr><th>'.implode('</th><th>', $title).'</th></tr></thead>'; |
|
323 | 323 | $result .= '<tbody>'; |
324 | 324 | foreach ($last_result as $row) { |
325 | 325 | $result_value = array(); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | foreach ($row as $k => $v) { |
328 | 328 | $result_value[] = $v; |
329 | 329 | } |
330 | - $result .= '<tr><td>' . implode('</td><td>', $result_value) . '</td></tr>'; |
|
330 | + $result .= '<tr><td>'.implode('</td><td>', $result_value).'</td></tr>'; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | $result .= '</tbody>'; |
334 | - $result = '<table class="table data">' . $result . '</table>'; |
|
334 | + $result = '<table class="table data">'.$result.'</table>'; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | while ($count < 11) { |
434 | 434 | $line = fgets($file); |
435 | 435 | foreach ($detailFields as $label) { |
436 | - $fileLabel = '# ' . $label; |
|
436 | + $fileLabel = '# '.$label; |
|
437 | 437 | if (strpos($line, $fileLabel) !== false) { |
438 | 438 | $details[$label] = htmlentities(trim(str_replace(array( |
439 | 439 | $fileLabel, |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | }; |
447 | 447 | fclose($file); |
448 | 448 | |
449 | - $tooltip = "Generation Time: " . $details["Generation Time"] . "\n"; |
|
450 | - $tooltip .= "Server version: " . $details["Server version"] . "\n"; |
|
451 | - $tooltip .= "PHP Version: " . $details["PHP Version"] . "\n"; |
|
452 | - $tooltip .= "Host: " . $details["Host"] . "\n"; |
|
449 | + $tooltip = "Generation Time: ".$details["Generation Time"]."\n"; |
|
450 | + $tooltip .= "Server version: ".$details["Server version"]."\n"; |
|
451 | + $tooltip .= "PHP Version: ".$details["PHP Version"]."\n"; |
|
452 | + $tooltip .= "Host: ".$details["Host"]."\n"; |
|
453 | 453 | ?> |
454 | 454 | <tr> |
455 | 455 | <td><?= $filename ?></td> |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | <?php |
482 | 482 | |
483 | 483 | if (is_numeric($_GET['tab'])) { |
484 | - echo '<script type="text/javascript">tpDBM.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
484 | + echo '<script type="text/javascript">tpDBM.setSelectedIndex( '.$_GET['tab'].' );</script>'; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | include_once "footer.inc.php"; // send footer |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | |
536 | 536 | // Set line feed |
537 | 537 | $lf = "\n"; |
538 | - $tempfile_path = $modx->config['base_path'] . 'assets/backup/temp.php'; |
|
538 | + $tempfile_path = $modx->config['base_path'].'assets/backup/temp.php'; |
|
539 | 539 | |
540 | 540 | $result = $modx->db->query('SHOW TABLES'); |
541 | 541 | $tables = $this->result2Array(0, $result); |
@@ -548,15 +548,15 @@ discard block |
||
548 | 548 | |
549 | 549 | // Set header |
550 | 550 | $output = "#{$lf}"; |
551 | - $output .= "# " . addslashes($modx->config['site_name']) . " Database Dump{$lf}"; |
|
551 | + $output .= "# ".addslashes($modx->config['site_name'])." Database Dump{$lf}"; |
|
552 | 552 | $output .= "# MODX Version:{$version['version']}{$lf}"; |
553 | 553 | $output .= "# {$lf}"; |
554 | 554 | $output .= "# Host: {$this->database_server}{$lf}"; |
555 | - $output .= "# Generation Time: " . $modx->toDateFormat(time()) . $lf; |
|
556 | - $output .= "# Server version: " . $modx->db->getVersion() . $lf; |
|
557 | - $output .= "# PHP Version: " . phpversion() . $lf; |
|
555 | + $output .= "# Generation Time: ".$modx->toDateFormat(time()).$lf; |
|
556 | + $output .= "# Server version: ".$modx->db->getVersion().$lf; |
|
557 | + $output .= "# PHP Version: ".phpversion().$lf; |
|
558 | 558 | $output .= "# Database: `{$this->dbname}`{$lf}"; |
559 | - $output .= "# Description: " . trim($_REQUEST['backup_title']) . "{$lf}"; |
|
559 | + $output .= "# Description: ".trim($_REQUEST['backup_title'])."{$lf}"; |
|
560 | 560 | $output .= "#"; |
561 | 561 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
562 | 562 | $output = ''; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | } |
576 | 576 | } |
577 | 577 | if ($callBack === 'snapshot') { |
578 | - if (!preg_match('@^' . $modx->db->config['table_prefix'] . '@', $tblval)) { |
|
578 | + if (!preg_match('@^'.$modx->db->config['table_prefix'].'@', $tblval)) { |
|
579 | 579 | continue; |
580 | 580 | } |
581 | 581 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $insertdump = $lf; |
598 | 598 | $insertdump .= "INSERT INTO `{$tblval}` VALUES ("; |
599 | 599 | $arr = $this->object2Array($row); |
600 | - if( ! is_array($arr)) $arr = array(); |
|
600 | + if (!is_array($arr)) $arr = array(); |
|
601 | 601 | foreach ($arr as $key => $value) { |
602 | 602 | if (is_null($value)) { |
603 | 603 | $value = 'NULL'; |
@@ -610,9 +610,9 @@ discard block |
||
610 | 610 | ), '\\n', $value); |
611 | 611 | $value = "'{$value}'"; |
612 | 612 | } |
613 | - $insertdump .= $value . ','; |
|
613 | + $insertdump .= $value.','; |
|
614 | 614 | } |
615 | - $output .= rtrim($insertdump, ',') . ");\n"; |
|
615 | + $output .= rtrim($insertdump, ',').");\n"; |
|
616 | 616 | if (1048576 < strlen($output)) { |
617 | 617 | file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX); |
618 | 618 | $output = ''; |
@@ -597,7 +597,9 @@ |
||
597 | 597 | $insertdump = $lf; |
598 | 598 | $insertdump .= "INSERT INTO `{$tblval}` VALUES ("; |
599 | 599 | $arr = $this->object2Array($row); |
600 | - if( ! is_array($arr)) $arr = array(); |
|
600 | + if( ! is_array($arr)) { |
|
601 | + $arr = array(); |
|
602 | + } |
|
601 | 603 | foreach ($arr as $key => $value) { |
602 | 604 | if (is_null($value)) { |
603 | 605 | $value = 'NULL'; |