@@ -5,72 +5,72 @@ discard block |
||
5 | 5 | var $errorcode; |
6 | 6 | var $errors = array(); |
7 | 7 | |
8 | - function __construct() { |
|
8 | + function __construct() { |
|
9 | 9 | |
10 | - $_lang = $this->include_lang('errormsg'); |
|
10 | + $_lang = $this->include_lang('errormsg'); |
|
11 | 11 | |
12 | - $this->errors = array( |
|
13 | - 0 => $_lang["No errors occured."], |
|
14 | - 1 => $_lang["An error occured!"], |
|
15 | - 2 => $_lang["Document's ID not passed in request!"], |
|
16 | - 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | - 4 => $_lang["ID passed in request is NaN!"], |
|
18 | - 5 => $_lang["The document is locked!"], |
|
19 | - 6 => $_lang["Too many results returned from database!"], |
|
20 | - 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | - 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | - 9 => $_lang["Logging error!"], |
|
23 | - 10 => $_lang["Table to optimise not found in request!"], |
|
24 | - 11 => $_lang["No settings found in request!"], |
|
25 | - 12 => $_lang["The document must have a title!"], |
|
26 | - 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | - 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | - 15 => $_lang["The document was not found!"], |
|
12 | + $this->errors = array( |
|
13 | + 0 => $_lang["No errors occured."], |
|
14 | + 1 => $_lang["An error occured!"], |
|
15 | + 2 => $_lang["Document's ID not passed in request!"], |
|
16 | + 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | + 4 => $_lang["ID passed in request is NaN!"], |
|
18 | + 5 => $_lang["The document is locked!"], |
|
19 | + 6 => $_lang["Too many results returned from database!"], |
|
20 | + 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | + 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | + 9 => $_lang["Logging error!"], |
|
23 | + 10 => $_lang["Table to optimise not found in request!"], |
|
24 | + 11 => $_lang["No settings found in request!"], |
|
25 | + 12 => $_lang["The document must have a title!"], |
|
26 | + 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | + 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | + 15 => $_lang["The document was not found!"], |
|
29 | 29 | |
30 | - 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | - 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | - 601 => $_lang["Document's ID not passed in request!"], |
|
33 | - 602 => $_lang["New parent not set in request!"], |
|
34 | - 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | - 901 => $_lang["wrong password!"], // wrong password! |
|
36 | - 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | - 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | - 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | - 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | - ); |
|
41 | - } |
|
30 | + 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | + 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | + 601 => $_lang["Document's ID not passed in request!"], |
|
33 | + 602 => $_lang["New parent not set in request!"], |
|
34 | + 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | + 901 => $_lang["wrong password!"], // wrong password! |
|
36 | + 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | + 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | + 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | + 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - function include_lang($context='common') { |
|
44 | - global $modx; |
|
45 | - $_lang = array(); |
|
43 | + function include_lang($context='common') { |
|
44 | + global $modx; |
|
45 | + $_lang = array(); |
|
46 | 46 | |
47 | - $context = trim($context,'/'); |
|
48 | - if(strpos($context,'..')!==false) return; |
|
47 | + $context = trim($context,'/'); |
|
48 | + if(strpos($context,'..')!==false) return; |
|
49 | 49 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | - else |
|
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | - include_once($lang_path . 'english.inc.php'); |
|
55 | - $manager_language = $modx->config['manager_language']; |
|
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | - return $_lang; |
|
59 | - } |
|
50 | + if($context === 'common') |
|
51 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | + else |
|
53 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | + include_once($lang_path . 'english.inc.php'); |
|
55 | + $manager_language = $modx->config['manager_language']; |
|
56 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | + return $_lang; |
|
59 | + } |
|
60 | 60 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
62 | - $this->errorcode=$errorcode; |
|
63 | - $this->errormessage=$this->errors[$errorcode]; |
|
64 | - if($custommessage!="") { |
|
65 | - $this->errormessage=$custommessage; |
|
66 | - } |
|
67 | - } |
|
61 | + function setError($errorcode, $custommessage=""){ |
|
62 | + $this->errorcode=$errorcode; |
|
63 | + $this->errormessage=$this->errors[$errorcode]; |
|
64 | + if($custommessage!="") { |
|
65 | + $this->errormessage=$custommessage; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - function getError() { |
|
70 | - return $this->errorcode; |
|
71 | - } |
|
69 | + function getError() { |
|
70 | + return $this->errorcode; |
|
71 | + } |
|
72 | 72 | |
73 | - function dumpError(){ |
|
73 | + function dumpError(){ |
|
74 | 74 | ?> |
75 | 75 | <html> |
76 | 76 | <head> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | </body> |
89 | 89 | </html> |
90 | 90 | <?php |
91 | - exit; |
|
92 | - } |
|
91 | + exit; |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | var $errorcode; |
6 | 6 | var $errors = array(); |
7 | 7 | |
8 | - function __construct() { |
|
8 | + function __construct(){ |
|
9 | 9 | |
10 | 10 | $_lang = $this->include_lang('errormsg'); |
11 | 11 | |
@@ -40,33 +40,33 @@ discard block |
||
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | - function include_lang($context='common') { |
|
43 | + function include_lang($context = 'common'){ |
|
44 | 44 | global $modx; |
45 | 45 | $_lang = array(); |
46 | 46 | |
47 | - $context = trim($context,'/'); |
|
48 | - if(strpos($context,'..')!==false) return; |
|
47 | + $context = trim($context, '/'); |
|
48 | + if (strpos($context, '..') !== false) return; |
|
49 | 49 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
50 | + if ($context === 'common') |
|
51 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
52 | 52 | else |
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | - include_once($lang_path . 'english.inc.php'); |
|
53 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
54 | + include_once($lang_path.'english.inc.php'); |
|
55 | 55 | $manager_language = $modx->config['manager_language']; |
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
56 | + if (is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | 57 | include_once("{$lang_path}{$manager_language}.inc.php"); |
58 | 58 | return $_lang; |
59 | 59 | } |
60 | 60 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
62 | - $this->errorcode=$errorcode; |
|
63 | - $this->errormessage=$this->errors[$errorcode]; |
|
64 | - if($custommessage!="") { |
|
65 | - $this->errormessage=$custommessage; |
|
61 | + function setError($errorcode, $custommessage = ""){ |
|
62 | + $this->errorcode = $errorcode; |
|
63 | + $this->errormessage = $this->errors[$errorcode]; |
|
64 | + if ($custommessage != "") { |
|
65 | + $this->errormessage = $custommessage; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - function getError() { |
|
69 | + function getError(){ |
|
70 | 70 | return $this->errorcode; |
71 | 71 | } |
72 | 72 |
@@ -1,11 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // this is the old error handler. Here for legacy, until i replace all the old errors. |
3 | -class errorHandler{ |
|
3 | +class errorHandler |
|
4 | +{ |
|
4 | 5 | |
5 | 6 | var $errorcode; |
6 | 7 | var $errors = array(); |
7 | 8 | |
8 | - function __construct() { |
|
9 | + function __construct() |
|
10 | + { |
|
9 | 11 | |
10 | 12 | $_lang = $this->include_lang('errormsg'); |
11 | 13 | |
@@ -40,25 +42,31 @@ discard block |
||
40 | 42 | ); |
41 | 43 | } |
42 | 44 | |
43 | - function include_lang($context='common') { |
|
45 | + function include_lang($context='common') |
|
46 | + { |
|
44 | 47 | global $modx; |
45 | 48 | $_lang = array(); |
46 | 49 | |
47 | 50 | $context = trim($context,'/'); |
48 | - if(strpos($context,'..')!==false) return; |
|
51 | + if(strpos($context,'..')!==false) { |
|
52 | + return; |
|
53 | + } |
|
49 | 54 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | - else |
|
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
55 | + if($context === 'common') { |
|
56 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
57 | + } else { |
|
58 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
59 | + } |
|
54 | 60 | include_once($lang_path . 'english.inc.php'); |
55 | 61 | $manager_language = $modx->config['manager_language']; |
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
62 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) { |
|
63 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
64 | + } |
|
58 | 65 | return $_lang; |
59 | 66 | } |
60 | 67 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
68 | + function setError($errorcode, $custommessage="") |
|
69 | + { |
|
62 | 70 | $this->errorcode=$errorcode; |
63 | 71 | $this->errormessage=$this->errors[$errorcode]; |
64 | 72 | if($custommessage!="") { |
@@ -66,11 +74,13 @@ discard block |
||
66 | 74 | } |
67 | 75 | } |
68 | 76 | |
69 | - function getError() { |
|
77 | + function getError() |
|
78 | + { |
|
70 | 79 | return $this->errorcode; |
71 | 80 | } |
72 | 81 | |
73 | - function dumpError(){ |
|
82 | + function dumpError() |
|
83 | + { |
|
74 | 84 | ?> |
75 | 85 | <html> |
76 | 86 | <head> |
@@ -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,24 +3,24 @@ |
||
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 | } |
26 | 26 | ?> |
27 | 27 | \ No newline at end of file |
@@ -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 | |
4 | 4 | // START HACK |
5 | 5 | if (isset ($modx)) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $which_browser_default = $which_browser; |
17 | 17 | while ($row = $modx->db->getRow($rs)) { |
18 | - if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
18 | + if ($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
19 | 19 | $settings[$row['setting_name']] = $row['setting_value']; |
20 | 20 | if (isset($modx->config)) { |
21 | 21 | $modx->config[$row['setting_name']] = $row['setting_value']; |
@@ -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 | |
4 | 6 | // START HACK |
5 | 7 | if (isset ($modx)) { |
@@ -15,7 +17,9 @@ discard block |
||
15 | 17 | |
16 | 18 | $which_browser_default = $which_browser; |
17 | 19 | while ($row = $modx->db->getRow($rs)) { |
18 | - 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 | + } |
|
19 | 23 | $settings[$row['setting_name']] = $row['setting_value']; |
20 | 24 | if (isset($modx->config)) { |
21 | 25 | $modx->config[$row['setting_name']] = $row['setting_value']; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | var stay = document.getElementById('stay'); |
19 | 19 | // Trigger unlock |
20 | 20 | if ((stay && stay.value !== '2') || !form_save) { |
21 | - var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random(); |
|
21 | + var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random(); |
|
22 | 22 | if (navigator.sendBeacon) { |
23 | 23 | navigator.sendBeacon(url) |
24 | 24 | } else { |
@@ -11,19 +11,19 @@ |
||
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 | } |
29 | 29 | ?> |
30 | 30 | \ No newline at end of file |
@@ -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 | |
4 | 4 | /** |
5 | 5 | * Secure Manager Documents |
@@ -10,20 +10,20 @@ discard block |
||
10 | 10 | * |
11 | 11 | */ |
12 | 12 | |
13 | -function secureMgrDocument($docid='') { |
|
13 | +function secureMgrDocument($docid = ''){ |
|
14 | 14 | global $modx; |
15 | 15 | |
16 | - $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
16 | + $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid > 0 ? "id='$docid'" : "privatemgr = 1")); |
|
17 | 17 | $rs = $modx->db->select( |
18 | 18 | 'DISTINCT sc.id', |
19 | 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" |
|
22 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."mga.id>0" |
|
23 | 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).")"); |
|
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 | 27 | } |
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | \ No newline at end of file |
@@ -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 | |
4 | 6 | /** |
5 | 7 | * Secure Manager Documents |
@@ -10,7 +12,8 @@ discard block |
||
10 | 12 | * |
11 | 13 | */ |
12 | 14 | |
13 | -function secureMgrDocument($docid='') { |
|
15 | +function secureMgrDocument($docid='') |
|
16 | +{ |
|
14 | 17 | global $modx; |
15 | 18 | |
16 | 19 | $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - /** |
|
4 | - * System Alert Message Queue Display file |
|
5 | - * Written By Raymond Irving, April, 2005 |
|
6 | - * |
|
7 | - * Used to display system alert messages inside the browser |
|
8 | - * |
|
9 | - */ |
|
3 | + /** |
|
4 | + * System Alert Message Queue Display file |
|
5 | + * Written By Raymond Irving, April, 2005 |
|
6 | + * |
|
7 | + * Used to display system alert messages inside the browser |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | |
11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
12 | 12 | |
13 | - $sysMsgs = ""; |
|
14 | - $limit = count($SystemAlertMsgQueque); |
|
15 | - for($i=0;$i<$limit;$i++) { |
|
16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | - } |
|
18 | - // reset message queque |
|
19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
13 | + $sysMsgs = ""; |
|
14 | + $limit = count($SystemAlertMsgQueque); |
|
15 | + for($i=0;$i<$limit;$i++) { |
|
16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | + } |
|
18 | + // reset message queque |
|
19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if($sysMsgs!="") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
28 | 28 | ?> |
29 | 29 | <script type="text/javascript"> |
30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | // ]]> |
43 | 43 | </script> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | ?> |
47 | 47 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $sysMsgs = ""; |
14 | 14 | $limit = count($SystemAlertMsgQueque); |
15 | - for($i=0;$i<$limit;$i++) { |
|
15 | + for ($i = 0; $i < $limit; $i++) { |
|
16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
17 | 17 | } |
18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if ($sysMsgs != "") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | var sysAlert = new Element('div').setProperties({ |
33 | 33 | 'class': 'sysAlert' |
34 | 34 | }); |
35 | - sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>'; |
|
35 | + sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>'; |
|
36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
37 | 37 | buttons: 1, |
38 | 38 | button1: 'Ok', |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | class Paging |
32 | 32 | { |
33 | 33 | |
34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | - var $int_cur_position;// Current position in recordset |
|
37 | - var $str_ext_argv; // Extra argv of query string |
|
34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | + var $int_cur_position; // Current position in recordset |
|
37 | + var $str_ext_argv; // Extra argv of query string |
|
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ Constructor |
40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
65 | 65 | |
66 | 66 | if ($this->int_cur_position != 0) { |
67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
75 | 75 | } |
76 | 76 | return $array_paging; |
77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
87 | 87 | // if current page, do not make a link |
88 | 88 | if ($i == $this->getCurrentPage()) { |
89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
90 | 90 | } else { |
91 | 91 | $int_new_position = ($i * $this->int_num_result); |
92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | return $array_all_page; |
@@ -21,5 +21,5 @@ |
||
21 | 21 | if($ok) { |
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | - echo '{status:"null"}'; |
|
24 | + echo '{status:"null"}'; |
|
25 | 25 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | 14 | |
15 | -if($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
15 | +if ($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
16 | 16 | $modx->lockElement($_GET['type'], $_GET['id'], true); |
17 | 17 | $ok = true; |
18 | 18 | } |
19 | 19 | |
20 | 20 | header('Content-type: application/json'); |
21 | -if($ok) { |
|
21 | +if ($ok) { |
|
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | 24 | echo '{status:"null"}'; |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler{ |
|
16 | 16 | // Single variable for a log entry |
17 | 17 | var $entry = array(); |
18 | 18 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
20 | 20 | global $modx; |
21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
23 | 23 | |
24 | 24 | // User Credentials |
25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 27 | |
28 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
28 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | + if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
30 | 30 | |
31 | - $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
31 | + $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | + if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
33 | 33 | |
34 | 34 | $this->writeToLog(); |
35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | // function to write to the log |
39 | 39 | // collects all required info, and |
40 | 40 | // writes it to the logging table |
41 | - function writeToLog() { |
|
41 | + function writeToLog(){ |
|
42 | 42 | global $modx; |
43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 44 | |
45 | - if($this->entry['internalKey'] == "") { |
|
45 | + if ($this->entry['internalKey'] == "") { |
|
46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
47 | 47 | } |
48 | - if(empty($this->entry['action'])) { |
|
48 | + if (empty($this->entry['action'])) { |
|
49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
50 | 50 | } |
51 | - if($this->entry['msg'] == "") { |
|
51 | + if ($this->entry['msg'] == "") { |
|
52 | 52 | include_once "actionlist.inc.php"; |
53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
54 | - if($this->entry['msg'] == "") { |
|
54 | + if ($this->entry['msg'] == "") { |
|
55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
56 | 56 | } |
57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
67 | - if(!$insert_id) { |
|
66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
67 | + if (!$insert_id) { |
|
68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
69 | 69 | } else { |
70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | - if(($insert_id % $trim) === 0) { |
|
73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | + if (($insert_id % $trim) === 0) { |
|
73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -12,11 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler |
|
16 | +{ |
|
16 | 17 | // Single variable for a log entry |
17 | 18 | var $entry = array(); |
18 | 19 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
20 | + function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") |
|
21 | + { |
|
20 | 22 | global $modx; |
21 | 23 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | 24 | $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
@@ -26,10 +28,16 @@ discard block |
||
26 | 28 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 29 | |
28 | 30 | $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
31 | + if($this->entry['itemId'] == 0) { |
|
32 | + $this->entry['itemId'] = "-"; |
|
33 | + } |
|
34 | + // to stop items having id 0 |
|
30 | 35 | |
31 | 36 | $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
37 | + if($this->entry['itemName'] == "") { |
|
38 | + $this->entry['itemName'] = "-"; |
|
39 | + } |
|
40 | + // to stop item name being empty |
|
33 | 41 | |
34 | 42 | $this->writeToLog(); |
35 | 43 | return; |
@@ -38,7 +46,8 @@ discard block |
||
38 | 46 | // function to write to the log |
39 | 47 | // collects all required info, and |
40 | 48 | // writes it to the logging table |
41 | - function writeToLog() { |
|
49 | + function writeToLog() |
|
50 | + { |
|
42 | 51 | global $modx; |
43 | 52 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 53 |