@@ -216,10 +216,10 @@ |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | - * loadPlugins - load all plugins execpt the plugins in setting["exclude_plugins"] |
|
220 | - * |
|
221 | - * @return array plugins |
|
222 | - */ |
|
219 | + * loadPlugins - load all plugins execpt the plugins in setting["exclude_plugins"] |
|
220 | + * |
|
221 | + * @return array plugins |
|
222 | + */ |
|
223 | 223 | public function loadPlugins() |
224 | 224 | { |
225 | 225 | $plugins = array(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function __construct($config) |
38 | 38 | { |
39 | 39 | $this->setConfig($config); |
40 | - $this->rootpath = $this->config["rootpath"] . "/tinymce/js/tinymce"; |
|
40 | + $this->rootpath = $this->config["rootpath"]."/tinymce/js/tinymce"; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | |
81 | 81 | // Load default settings |
82 | 82 | if (!($this->setting = @include($GLOBALS['xoops']->path("var/configs/tinymce.php")))) { |
83 | - $this->setting = include __DIR__ . "/settings.php"; |
|
83 | + $this->setting = include __DIR__."/settings.php"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // get editor language (from ...) |
87 | - if (is_readable(\XoopsBaseConfig::get('root-path') . $this->rootpath . '/langs/' . $this->config["language"] . '.js')) { |
|
87 | + if (is_readable(\XoopsBaseConfig::get('root-path').$this->rootpath.'/langs/'.$this->config["language"].'.js')) { |
|
88 | 88 | $this->setting["language"] = $this->config["language"]; |
89 | 89 | $configured[] = "language"; |
90 | 90 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $configured[] = "content_css"; |
94 | 94 | |
95 | 95 | if (!empty($this->config["theme"]) |
96 | - && is_dir(\XoopsBaseConfig::get('root-path') . $this->rootpath . "/themes/" . $this->config["theme"]) |
|
96 | + && is_dir(\XoopsBaseConfig::get('root-path').$this->rootpath."/themes/".$this->config["theme"]) |
|
97 | 97 | ) { |
98 | 98 | $this->setting["theme"] = $this->config["theme"]; |
99 | 99 | $configured[] = "theme"; |
@@ -127,63 +127,63 @@ discard block |
||
127 | 127 | foreach ($this->config["buttons"] as $button) { |
128 | 128 | $i++; |
129 | 129 | if (isset($button["before"])) { |
130 | - $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}_add_before"] = $button["before"]; |
|
130 | + $this->setting["theme_".$this->setting["theme"]."_buttons{$i}_add_before"] = $button["before"]; |
|
131 | 131 | } |
132 | 132 | if (isset($button["add"])) { |
133 | - $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}_add"] = $button["add"]; |
|
133 | + $this->setting["theme_".$this->setting["theme"]."_buttons{$i}_add"] = $button["add"]; |
|
134 | 134 | } |
135 | 135 | if (isset($button[""])) { |
136 | - $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] = $button[""]; |
|
136 | + $this->setting["theme_".$this->setting["theme"]."_buttons{$i}"] = $button[""]; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | $configured[] = "buttons"; |
140 | 140 | |
141 | 141 | if (isset($this->config["toolbar_location"])) { |
142 | - $this->setting["theme_" . $this->setting["theme"] . "_toolbar_location"] |
|
142 | + $this->setting["theme_".$this->setting["theme"]."_toolbar_location"] |
|
143 | 143 | = $this->config["toolbar_location"]; |
144 | 144 | $configured[] = "toolbar_location"; |
145 | 145 | } else { |
146 | - $this->setting["theme_" . $this->setting["theme"] . "_toolbar_location"] = "top"; |
|
146 | + $this->setting["theme_".$this->setting["theme"]."_toolbar_location"] = "top"; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | if (isset($this->config["toolbar_align"])) { |
150 | - $this->setting["theme_" . $this->setting["theme"] . "_toolbar_align"] = $this->config["toolbar_align"]; |
|
150 | + $this->setting["theme_".$this->setting["theme"]."_toolbar_align"] = $this->config["toolbar_align"]; |
|
151 | 151 | $configured[] = "toolbar_align"; |
152 | 152 | } else { |
153 | - $this->setting["theme_" . $this->setting["theme"] . "_toolbar_align"] = "left"; |
|
153 | + $this->setting["theme_".$this->setting["theme"]."_toolbar_align"] = "left"; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if (isset($this->config["statusbar_location"])) { |
157 | - $this->setting["theme_" . $this->setting["theme"] . "_statusbar_location"] |
|
157 | + $this->setting["theme_".$this->setting["theme"]."_statusbar_location"] |
|
158 | 158 | = $this->config["statusbar_location"]; |
159 | 159 | $configured[] = "statusbar_location"; |
160 | 160 | } |
161 | 161 | |
162 | 162 | if (isset($this->config["path_location"])) { |
163 | - $this->setting["theme_" . $this->setting["theme"] . "_path_location"] = $this->config["path_location"]; |
|
163 | + $this->setting["theme_".$this->setting["theme"]."_path_location"] = $this->config["path_location"]; |
|
164 | 164 | $configured[] = "path_location"; |
165 | 165 | } |
166 | 166 | |
167 | 167 | if (isset($this->config["resize_horizontal"])) { |
168 | - $this->setting["theme_" . $this->setting["theme"] . "_resize_horizontal"] |
|
168 | + $this->setting["theme_".$this->setting["theme"]."_resize_horizontal"] |
|
169 | 169 | = $this->config["resize_horizontal"]; |
170 | 170 | $configured[] = "resize_horizontal"; |
171 | 171 | } |
172 | 172 | |
173 | 173 | if (isset($this->config["resizing"])) { |
174 | - $this->setting["theme_" . $this->setting["theme"] . "_resizing"] = $this->config["resizing"]; |
|
174 | + $this->setting["theme_".$this->setting["theme"]."_resizing"] = $this->config["resizing"]; |
|
175 | 175 | $configured[] = "resizing"; |
176 | 176 | } |
177 | 177 | |
178 | 178 | if (!empty($this->config["fonts"])) { |
179 | - $this->setting["theme_" . $this->setting["theme"] . "_fonts"] = $this->config["fonts"]; |
|
179 | + $this->setting["theme_".$this->setting["theme"]."_fonts"] = $this->config["fonts"]; |
|
180 | 180 | $configured[] = "fonts"; |
181 | 181 | } |
182 | 182 | |
183 | - for ($i=1; $i <= 4; $i++) { |
|
183 | + for ($i = 1; $i <= 4; $i++) { |
|
184 | 184 | $buttons = array(); |
185 | - if (isset($this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"])) { |
|
186 | - $checklist = explode(",", $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"]); |
|
185 | + if (isset($this->setting["theme_".$this->setting["theme"]."_buttons{$i}"])) { |
|
186 | + $checklist = explode(",", $this->setting["theme_".$this->setting["theme"]."_buttons{$i}"]); |
|
187 | 187 | foreach ($checklist as $plugin) { |
188 | 188 | if (strpos(strtolower($plugin), "xoops") !== false) { |
189 | 189 | if (in_array($plugin, $this->xoopsPlugins)) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $buttons[] = $plugin; |
194 | 194 | } |
195 | 195 | } |
196 | - $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] = implode(",", $buttons); |
|
196 | + $this->setting["theme_".$this->setting["theme"]."_buttons{$i}"] = implode(",", $buttons); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $this->setting[$key] = $val; |
207 | 207 | } |
208 | 208 | |
209 | - if (!is_dir(\XoopsBaseConfig::get('root-path') . $this->rootpath . "/themes/" . $this->setting["theme"] . '/docs/' . $this->setting["language"] . '/')) { |
|
209 | + if (!is_dir(\XoopsBaseConfig::get('root-path').$this->rootpath."/themes/".$this->setting["theme"].'/docs/'.$this->setting["language"].'/')) { |
|
210 | 210 | $this->setting["docs_language"] = "en"; |
211 | 211 | } |
212 | 212 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | public function loadPlugins() |
224 | 224 | { |
225 | 225 | $plugins = array(); |
226 | - $plugins_list = XoopsLists::getDirListAsArray(\XoopsBaseConfig::get('root-path') . $this->rootpath . "/plugins"); |
|
226 | + $plugins_list = XoopsLists::getDirListAsArray(\XoopsBaseConfig::get('root-path').$this->rootpath."/plugins"); |
|
227 | 227 | if (empty($this->setting["plugins"])) { |
228 | 228 | $plugins = $plugins_list; |
229 | 229 | } else { |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | { |
249 | 249 | $xoopsPlugins = array(); |
250 | 250 | $xoops_root_path = \XoopsBaseConfig::get('root-path'); |
251 | - $allplugins = XoopsLists::getDirListAsArray ($xoops_root_path . $this->rootpath . "/plugins"); |
|
251 | + $allplugins = XoopsLists::getDirListAsArray($xoops_root_path.$this->rootpath."/plugins"); |
|
252 | 252 | foreach ($allplugins as $plugin) { |
253 | 253 | if (strpos(strtolower($plugin), "xoops") !== false |
254 | - && file_exists($xoops_root_path . $this->config["rootpath"] . "/include/$plugin.php")) { |
|
255 | - if ($right = @include $xoops_root_path . $this->config["rootpath"] . "/include/$plugin.php") { |
|
254 | + && file_exists($xoops_root_path.$this->config["rootpath"]."/include/$plugin.php")) { |
|
255 | + if ($right = @include $xoops_root_path.$this->config["rootpath"]."/include/$plugin.php") { |
|
256 | 256 | $xoopsPlugins[$plugin] = $plugin; |
257 | 257 | } |
258 | 258 | } |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | $css = array(); |
274 | - $css[] = $css_url . '/' . $css_file; |
|
275 | - $css_content = file_get_contents($css_path . '/' . $css_file); |
|
274 | + $css[] = $css_url.'/'.$css_file; |
|
275 | + $css_content = file_get_contents($css_path.'/'.$css_file); |
|
276 | 276 | |
277 | 277 | // get all import css files |
278 | 278 | if (preg_match_all("~\@import url\((.*\.css)\);~sUi", $css_content, $matches, PREG_PATTERN_ORDER)) { |
@@ -307,15 +307,15 @@ discard block |
||
307 | 307 | $callback = ""; |
308 | 308 | } |
309 | 309 | |
310 | - $ret = '<script language="javascript" type="text/javascript" src="' . \XoopsBaseConfig::get('url') . $this->rootpath . '/tinymce.min.js"></script>'; |
|
310 | + $ret = '<script language="javascript" type="text/javascript" src="'.\XoopsBaseConfig::get('url').$this->rootpath.'/tinymce.min.js"></script>'; |
|
311 | 311 | $ret .= '<script language="javascript" type="text/javascript"> |
312 | 312 | tinyMCE.init({ |
313 | 313 | '; |
314 | 314 | |
315 | 315 | foreach ($this->setting as $key => $val) { |
316 | - $ret .= $key . ":"; |
|
316 | + $ret .= $key.":"; |
|
317 | 317 | if ($val === true) { |
318 | - $ret.= "true,"; |
|
318 | + $ret .= "true,"; |
|
319 | 319 | } elseif ($val === false) { |
320 | 320 | $ret .= "false,"; |
321 | 321 | } else { |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | |
327 | 327 | // Ajout alain01 tinymce v4 |
328 | 328 | |
329 | - $chemin_array=parse_url(\XoopsBaseConfig::get('url')); |
|
330 | - $chemin_scheme = $chemin_array["scheme"]; // http |
|
331 | - $chemin_host = $chemin_array["host"]; // www.example.com or // localhost |
|
329 | + $chemin_array = parse_url(\XoopsBaseConfig::get('url')); |
|
330 | + $chemin_scheme = $chemin_array["scheme"]; // http |
|
331 | + $chemin_host = $chemin_array["host"]; // www.example.com or // localhost |
|
332 | 332 | //$chemin_path = $chemin_array["path"]; // /myweb1 |
333 | 333 | if (!isset($chemin_array['path'])) { |
334 | 334 | $chemin_path = ''; |
335 | 335 | } else { |
336 | - $chemin_path = $chemin_array["path"]; |
|
336 | + $chemin_path = $chemin_array["path"]; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | //$ret .='language_url : "'.$chemin_path.'/class/xoopseditor/tinymce4/tinymce/js/tinymce/langs/fr_FR.js",'; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $ret .= '"external_filemanager_path": "'.$chemin_path.'/class/xoopseditor/tinymce4/external_plugins/filemanager/",'; |
370 | 370 | $ret .= "\n"; |
371 | 371 | |
372 | - $ret .='templates: "'.$chemin_path.'/uploads/filemanager/templates/liste-templates.js",'; |
|
372 | + $ret .= 'templates: "'.$chemin_path.'/uploads/filemanager/templates/liste-templates.js",'; |
|
373 | 373 | $ret .= "\n"; |
374 | 374 | // fin ajout alain01 |
375 | 375 | |
@@ -387,6 +387,6 @@ discard block |
||
387 | 387 | </script> |
388 | 388 | '; |
389 | 389 | |
390 | - return $ret ; |
|
390 | + return $ret; |
|
391 | 391 | } |
392 | 392 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return $config = array( |
25 | 25 | "class" => "FormTextArea", |
26 | - "file" => \XoopsBaseConfig::get('root-path') . "/class/xoopseditor/textarea/textarea.php", |
|
26 | + "file" => \XoopsBaseConfig::get('root-path')."/class/xoopseditor/textarea/textarea.php", |
|
27 | 27 | "title" => _XOOPS_EDITOR_TEXTAREA, // display to end user |
28 | 28 | "order" => 1, // 0 will disable the editor |
29 | 29 | "nohtml" => 1 // For forms that have "dohtml" disabled |
@@ -73,8 +73,8 @@ |
||
73 | 73 | protected function __construct() |
74 | 74 | { |
75 | 75 | // Load static configurations |
76 | - $xoops_root_path = \XoopsBaseConfig::get('root-path'); |
|
77 | - $xoops_var_path = \XoopsBaseConfig::get('var-path'); |
|
76 | + $xoops_root_path = \XoopsBaseConfig::get('root-path'); |
|
77 | + $xoops_var_path = \XoopsBaseConfig::get('var-path'); |
|
78 | 78 | $this->path_basic = $xoops_root_path . '/class/captcha'; |
79 | 79 | $this->path_plugin = $xoops_root_path . '/Frameworks/captcha'; |
80 | 80 | $this->configPath = $xoops_var_path . '/configs/'; |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | // Load static configurations |
76 | 76 | $xoops_root_path = \XoopsBaseConfig::get('root-path'); |
77 | 77 | $xoops_var_path = \XoopsBaseConfig::get('var-path'); |
78 | - $this->path_basic = $xoops_root_path . '/class/captcha'; |
|
79 | - $this->path_plugin = $xoops_root_path . '/Frameworks/captcha'; |
|
80 | - $this->configPath = $xoops_var_path . '/configs/'; |
|
78 | + $this->path_basic = $xoops_root_path.'/class/captcha'; |
|
79 | + $this->path_plugin = $xoops_root_path.'/Frameworks/captcha'; |
|
80 | + $this->configPath = $xoops_var_path.'/configs/'; |
|
81 | 81 | $this->config = $this->loadConfig(); |
82 | 82 | $this->name = $this->config['name']; |
83 | 83 | } |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return array |
106 | 106 | */ |
107 | - function loadConfig( $name = 'config') { |
|
108 | - if ( $name === 'config' ) { |
|
107 | + function loadConfig($name = 'config') { |
|
108 | + if ($name === 'config') { |
|
109 | 109 | $filename = 'captcha.config'; |
110 | 110 | } else { |
111 | - $filename = 'captcha.config.' . $name; |
|
111 | + $filename = 'captcha.config.'.$name; |
|
112 | 112 | } |
113 | - if ( !$config = $this->readConfig($filename) ) { |
|
114 | - $config = $this->loadBasicConfig( $name ); |
|
115 | - $this->writeConfig($filename, $config ); |
|
113 | + if (!$config = $this->readConfig($filename)) { |
|
114 | + $config = $this->loadBasicConfig($name); |
|
115 | + $this->writeConfig($filename, $config); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $config; |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | { |
130 | 130 | $basic_config = array(); |
131 | 131 | $plugin_config = array(); |
132 | - $filename = ($filename === 'config') ? 'config.php' : 'config.' . $filename . '.php'; |
|
133 | - if (XoopsLoad::fileExists($file = $this->path_basic . '/' . $filename)) { |
|
132 | + $filename = ($filename === 'config') ? 'config.php' : 'config.'.$filename.'.php'; |
|
133 | + if (XoopsLoad::fileExists($file = $this->path_basic.'/'.$filename)) { |
|
134 | 134 | $basic_config = include $file; |
135 | 135 | } |
136 | - if (XoopsLoad::fileExists($file = $this->path_plugin . '/' . $filename)) { |
|
136 | + if (XoopsLoad::fileExists($file = $this->path_plugin.'/'.$filename)) { |
|
137 | 137 | $plugin_config = include $file; |
138 | 138 | } |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | function readConfig($filename = 'config') |
152 | 152 | { |
153 | - $path_file = $this->configPath . $filename . '.php'; |
|
153 | + $path_file = $this->configPath.$filename.'.php'; |
|
154 | 154 | $file = XoopsFile::getHandler('file', $path_file); |
155 | 155 | return eval(@$file->read()); |
156 | 156 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function writeConfig($filename = 'config', $config) |
167 | 167 | { |
168 | - $path_file = $this->configPath . $filename . '.php'; |
|
168 | + $path_file = $this->configPath.$filename.'.php'; |
|
169 | 169 | $file = XoopsFile::getHandler('file', $path_file); |
170 | - return $file->write( 'return ' . var_export($config, true) . ';'); |
|
170 | + return $file->write('return '.var_export($config, true).';'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -207,22 +207,22 @@ discard block |
||
207 | 207 | public function loadHandler($name = null) |
208 | 208 | { |
209 | 209 | $name = !empty($name) ? $name : (empty($this->config['mode']) ? 'text' : $this->config['mode']); |
210 | - $class = 'XoopsCaptcha' . ucfirst($name); |
|
210 | + $class = 'XoopsCaptcha'.ucfirst($name); |
|
211 | 211 | if (!empty($this->handler) && get_class($this->handler) == $class) { |
212 | 212 | return $this->handler; |
213 | 213 | } |
214 | 214 | $this->handler = null; |
215 | - if (XoopsLoad::fileExists($file = $this->path_basic . '/' . $name . '.php')) { |
|
215 | + if (XoopsLoad::fileExists($file = $this->path_basic.'/'.$name.'.php')) { |
|
216 | 216 | require_once $file; |
217 | 217 | } else { |
218 | - if (XoopsLoad::fileExists($file = $this->path_plugin . '/' . $name . '.php')) { |
|
218 | + if (XoopsLoad::fileExists($file = $this->path_plugin.'/'.$name.'.php')) { |
|
219 | 219 | require_once $file; |
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | 223 | if (!class_exists($class)) { |
224 | 224 | $class = 'XoopsCaptchaText'; |
225 | - require_once $this->path_basic . '/text.php'; |
|
225 | + require_once $this->path_basic.'/text.php'; |
|
226 | 226 | } |
227 | 227 | /* @var $handler XoopsCaptchaMethod */ |
228 | 228 | $handler = new $class($this); |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | $this->handler->destroyGarbage(); |
349 | 349 | |
350 | 350 | if ($clearSession) { |
351 | - foreach ($this->config as $k => $config ) { |
|
352 | - $_SESSION[$this->name . '_' . $k] = null; |
|
351 | + foreach ($this->config as $k => $config) { |
|
352 | + $_SESSION[$this->name.'_'.$k] = null; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | return true; |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | public function render() |
364 | 364 | { |
365 | 365 | $sessionName = $this->config['name']; |
366 | - $_SESSION[$sessionName . '_name'] = $sessionName; |
|
367 | - foreach ($this->config as $k => $config ) { |
|
368 | - $_SESSION[$sessionName . '_' . $k] = $config; |
|
366 | + $_SESSION[$sessionName.'_name'] = $sessionName; |
|
367 | + foreach ($this->config as $k => $config) { |
|
368 | + $_SESSION[$sessionName.'_'.$k] = $config; |
|
369 | 369 | } |
370 | 370 | $form = ''; |
371 | 371 | if (!$this->active || empty($this->config['name'])) { |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | $maxAttempts = $this->config['maxattempts']; |
376 | - $attempt = isset($_SESSION[$sessionName . '_attempt']) ? $_SESSION[$sessionName . '_attempt'] : 0; |
|
377 | - $_SESSION[$sessionName . '_attempt'] = $attempt; |
|
376 | + $attempt = isset($_SESSION[$sessionName.'_attempt']) ? $_SESSION[$sessionName.'_attempt'] : 0; |
|
377 | + $_SESSION[$sessionName.'_attempt'] = $attempt; |
|
378 | 378 | |
379 | 379 | // Failure on too many attempts |
380 | 380 | if (!empty($maxAttempts) && $attempt > $maxAttempts) { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | { |
411 | 411 | $code = ($code === null) ? $this->handler->getCode() : $code; |
412 | 412 | if (!empty($code)) { |
413 | - $_SESSION[$this->name . '_code'] = $code; |
|
413 | + $_SESSION[$this->name.'_code'] = $code; |
|
414 | 414 | return true; |
415 | 415 | } |
416 | 416 | return false; |
@@ -75,12 +75,13 @@ |
||
75 | 75 | */ |
76 | 76 | public function loadConfig($name = '') |
77 | 77 | { |
78 | - if (!is_object($this->handler)) |
|
79 | - $this->config = array(); |
|
80 | - else |
|
81 | - $this->config = empty($name) |
|
78 | + if (!is_object($this->handler)) { |
|
79 | + $this->config = array(); |
|
80 | + } else { |
|
81 | + $this->config = empty($name) |
|
82 | 82 | ? $this->handler->config |
83 | 83 | : array_merge($this->handler->config, $this->handler->loadConfig($name)); |
84 | + } |
|
84 | 85 | } |
85 | 86 | |
86 | 87 | /** |
@@ -105,7 +105,6 @@ discard block |
||
105 | 105 | * @param string $pubkey A public key for reCAPTCHA |
106 | 106 | * @param string $error The error given by reCAPTCHA (optional, default is null) |
107 | 107 | * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) |
108 | - |
|
109 | 108 | * @return string - The HTML to be embedded in the user's form. |
110 | 109 | */ |
111 | 110 | function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) |
@@ -172,13 +171,13 @@ discard block |
||
172 | 171 | } |
173 | 172 | |
174 | 173 | $response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, |
175 | - "/recaptcha/api/verify", |
|
176 | - array( |
|
177 | - 'privatekey' => $privkey, |
|
178 | - 'remoteip' => $remoteip, |
|
179 | - 'challenge' => $challenge, |
|
180 | - 'response' => $response |
|
181 | - ) + $extra_params); |
|
174 | + "/recaptcha/api/verify", |
|
175 | + array( |
|
176 | + 'privatekey' => $privkey, |
|
177 | + 'remoteip' => $remoteip, |
|
178 | + 'challenge' => $challenge, |
|
179 | + 'response' => $response |
|
180 | + ) + $extra_params); |
|
182 | 181 | |
183 | 182 | $answers = explode("\n", $response [1]); |
184 | 183 | $recaptcha_response = new ReCaptchaResponse(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $req = ""; |
52 | 52 | foreach ($data as $key => $value) { |
53 | - $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
53 | + $req .= $key.'='.urlencode(stripslashes($value)).'&'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Cut the last '&' |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $http_request = "POST $path HTTP/1.0\r\n"; |
77 | 77 | $http_request .= "Host: $host\r\n"; |
78 | 78 | $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; |
79 | - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; |
|
79 | + $http_request .= "Content-Length: ".strlen($req)."\r\n"; |
|
80 | 80 | $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; |
81 | 81 | $http_request .= "\r\n"; |
82 | 82 | $http_request .= $req; |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | |
123 | 123 | $errorpart = ""; |
124 | 124 | if ($error) { |
125 | - $errorpart = "&error=" . $error; |
|
125 | + $errorpart = "&error=".$error; |
|
126 | 126 | } |
127 | - return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> |
|
127 | + return '<script type="text/javascript" src="'.$server.'/challenge?k='.$pubkey.$errorpart.'"></script> |
|
128 | 128 | |
129 | 129 | <noscript> |
130 | - <iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> |
|
130 | + <iframe src="' . $server.'/noscript?k='.$pubkey.$errorpart.'" height="300" width="500" frameborder="0"></iframe><br/> |
|
131 | 131 | <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> |
132 | 132 | <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> |
133 | 133 | </noscript>'; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | function recaptcha_get_signup_url($domain = null, $appname = null) |
205 | 205 | { |
206 | - return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode( |
|
206 | + return "https://www.google.com/recaptcha/admin/create?"._recaptcha_qsencode( |
|
207 | 207 | array('domains' => $domain, 'app' => $appname)); |
208 | 208 | } |
209 | 209 | |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | function recaptcha_mailhide_url($pubkey, $privkey, $email) |
257 | 257 | { |
258 | 258 | if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { |
259 | - die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>"); |
|
259 | + die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, "."you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>"); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | $ky = pack('H*', $privkey); |
263 | 263 | $cryptmail = _recaptcha_aes_encrypt($email, $ky); |
264 | 264 | |
265 | - return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64($cryptmail); |
|
265 | + return "http://www.google.com/recaptcha/mailhide/d?k=".$pubkey."&c="._recaptcha_mailhide_urlbase64($cryptmail); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -305,5 +305,5 @@ discard block |
||
305 | 305 | $emailparts = _recaptcha_mailhide_email_parts($email); |
306 | 306 | $url = recaptcha_mailhide_url($pubkey, $privkey, $email); |
307 | 307 | |
308 | - return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) . "' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts [1]); |
|
308 | + return htmlentities($emailparts[0])."<a href='".htmlentities($url)."' onclick=\"window.open('".htmlentities($url)."', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@".htmlentities($emailparts [1]); |
|
309 | 309 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function render() |
65 | 65 | { |
66 | - $xoops_url = \XoopsBaseConfig::get('url'); |
|
66 | + $xoops_url = \XoopsBaseConfig::get('url'); |
|
67 | 67 | $js = "<script type='text/javascript'> |
68 | 68 | function xoops_captcha_refresh(imgId) |
69 | 69 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function loadImage() |
90 | 90 | { |
91 | - $xoops_url = \XoopsBaseConfig::get('url'); |
|
91 | + $xoops_url = \XoopsBaseConfig::get('url'); |
|
92 | 92 | return '<img id="' . ($this->config["name"]) . '" src="' . $xoops_url . '/class/captcha/image/scripts/image.php" onclick=\'this.src="' . $xoops_url . '/class/captcha/image/scripts/image.php?refresh="+Math.random()' . '\' style="cursor: pointer; vertical-align: middle;" alt="" />'; |
93 | 93 | } |
94 | 94 | } |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | return false; |
41 | 41 | } else { |
42 | 42 | $required_functions = array( |
43 | - 'imagecreatetruecolor' , |
|
44 | - 'imagecolorallocate' , |
|
45 | - 'imagefilledrectangle' , |
|
46 | - 'imagejpeg' , |
|
47 | - 'imagedestroy' , |
|
43 | + 'imagecreatetruecolor', |
|
44 | + 'imagecolorallocate', |
|
45 | + 'imagefilledrectangle', |
|
46 | + 'imagejpeg', |
|
47 | + 'imagedestroy', |
|
48 | 48 | 'imageftbbox'); |
49 | 49 | foreach ($required_functions as $func) { |
50 | 50 | if (!function_exists($func)) { |
51 | - trigger_error('Function ' . $func . ' is not defined', E_USER_WARNING); |
|
51 | + trigger_error('Function '.$func.' is not defined', E_USER_WARNING); |
|
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | } |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | $js = "<script type='text/javascript'> |
68 | 68 | function xoops_captcha_refresh(imgId) |
69 | 69 | { |
70 | - xoopsGetElementById(imgId).src = '" . $xoops_url . "/class/captcha/image/scripts/image.php?refresh='+Math.random(); |
|
70 | + xoopsGetElementById(imgId).src = '" . $xoops_url."/class/captcha/image/scripts/image.php?refresh='+Math.random(); |
|
71 | 71 | } |
72 | 72 | </script>"; |
73 | 73 | $image = $this->loadImage(); |
74 | - $image .= "<br /><a href=\"javascript: xoops_captcha_refresh('" . ($this->config['name']) . "')\">" . XoopsLocale::CLICK_TO_REFRESH_IMAGE_IF_NOT_CLEAR . "</a>"; |
|
75 | - $input = '<input type="text" name="' . $this->config['name'] . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] . '" maxlength="' . $this->config['num_chars'] . '" value="" required>'; |
|
74 | + $image .= "<br /><a href=\"javascript: xoops_captcha_refresh('".($this->config['name'])."')\">".XoopsLocale::CLICK_TO_REFRESH_IMAGE_IF_NOT_CLEAR."</a>"; |
|
75 | + $input = '<input type="text" name="'.$this->config['name'].'" id="'.$this->config['name'].'" size="'.$this->config['num_chars'].'" maxlength="'.$this->config['num_chars'].'" value="" required>'; |
|
76 | 76 | $rule = XoopsLocale::INPUT_LETTERS_IN_THE_IMAGE; |
77 | - $rule .= '<br />' . (empty($this->config['casesensitive']) ? XoopsLocale::CODE_IS_CASE_INSENSITIVE : XoopsLocale::CODE_IS_CASE_SENSITIVE); |
|
77 | + $rule .= '<br />'.(empty($this->config['casesensitive']) ? XoopsLocale::CODE_IS_CASE_INSENSITIVE : XoopsLocale::CODE_IS_CASE_SENSITIVE); |
|
78 | 78 | if (!empty($this->config['maxattempts'])) { |
79 | - $rule .= '<br />' . sprintf(XoopsLocale::F_MAXIMUM_ATTEMPTS, $this->config['maxattempts']); |
|
79 | + $rule .= '<br />'.sprintf(XoopsLocale::F_MAXIMUM_ATTEMPTS, $this->config['maxattempts']); |
|
80 | 80 | } |
81 | - return $js . $image . '<br /><br />' . $input . '<br />' . $rule; |
|
81 | + return $js.$image.'<br /><br />'.$input.'<br />'.$rule; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -89,6 +89,6 @@ discard block |
||
89 | 89 | public function loadImage() |
90 | 90 | { |
91 | 91 | $xoops_url = \XoopsBaseConfig::get('url'); |
92 | - return '<img id="' . ($this->config["name"]) . '" src="' . $xoops_url . '/class/captcha/image/scripts/image.php" onclick=\'this.src="' . $xoops_url . '/class/captcha/image/scripts/image.php?refresh="+Math.random()' . '\' style="cursor: pointer; vertical-align: middle;" alt="" />'; |
|
92 | + return '<img id="'.($this->config["name"]).'" src="'.$xoops_url.'/class/captcha/image/scripts/image.php" onclick=\'this.src="'.$xoops_url.'/class/captcha/image/scripts/image.php?refresh="+Math.random()'.'\' style="cursor: pointer; vertical-align: middle;" alt="" />'; |
|
93 | 93 | } |
94 | 94 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | include_once __DIR__ . '/recaptcha/recaptchalib.php'; |
67 | 67 | if (!empty($_POST['recaptcha_response_field'])) { |
68 | 68 | $resp = recaptcha_check_answer($this->config['private_key'], $_SERVER['REMOTE_ADDR'], |
69 | - $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']); |
|
69 | + $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']); |
|
70 | 70 | if (!$resp->is_valid) { |
71 | 71 | $this->handler->message[] = $resp->error; |
72 | 72 | } else { |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function render() |
44 | 44 | { |
45 | - include_once __DIR__ . '/recaptcha/recaptchalib.php'; |
|
45 | + include_once __DIR__.'/recaptcha/recaptchalib.php'; |
|
46 | 46 | $form = "<script type=\"text/javascript\"> |
47 | 47 | var RecaptchaOptions = { |
48 | - theme : '" . (empty($this->config['theme']) ? '' : $this->config['theme']) . "', |
|
49 | - lang : '" . (empty($this->config['lang']) ? '' : $this->config['lang']) . "' |
|
48 | + theme : '" . (empty($this->config['theme']) ? '' : $this->config['theme'])."', |
|
49 | + lang : '" . (empty($this->config['lang']) ? '' : $this->config['lang'])."' |
|
50 | 50 | }; |
51 | 51 | </script>"; |
52 | 52 | $public_key = empty($this->config['public_key']) ? '' : $this->config['public_key']; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function verify($sessionName = null) |
64 | 64 | { |
65 | 65 | $is_valid = false; |
66 | - include_once __DIR__ . '/recaptcha/recaptchalib.php'; |
|
66 | + include_once __DIR__.'/recaptcha/recaptchalib.php'; |
|
67 | 67 | if (!empty($_POST['recaptcha_response_field'])) { |
68 | 68 | $resp = recaptcha_check_answer($this->config['private_key'], $_SERVER['REMOTE_ADDR'], |
69 | 69 | $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']); |
@@ -33,8 +33,8 @@ |
||
33 | 33 | public function render() |
34 | 34 | { |
35 | 35 | $form = $this->loadText() . ' <input type="text" name="' . $this->config['name'] |
36 | - . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] |
|
37 | - . '" maxlength="' . $this->config['num_chars'] . '" value="" />'; |
|
36 | + . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] |
|
37 | + . '" maxlength="' . $this->config['num_chars'] . '" value="" />'; |
|
38 | 38 | $form .= '<br />' . XoopsLocale::INPUT_RESULT_FROM_EXPRESSION; |
39 | 39 | if (!empty($this->config['maxattempts'])) { |
40 | 40 | $form .= '<br />' . sprintf(XoopsLocale::F_MAXIMUM_ATTEMPTS, $this->config['maxattempts']); |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function render() |
34 | 34 | { |
35 | - $form = $this->loadText() . ' <input type="text" name="' . $this->config['name'] |
|
36 | - . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] |
|
37 | - . '" maxlength="' . $this->config['num_chars'] . '" value="" />'; |
|
38 | - $form .= '<br />' . XoopsLocale::INPUT_RESULT_FROM_EXPRESSION; |
|
35 | + $form = $this->loadText().' <input type="text" name="'.$this->config['name'] |
|
36 | + . '" id="'.$this->config['name'].'" size="'.$this->config['num_chars'] |
|
37 | + . '" maxlength="'.$this->config['num_chars'].'" value="" />'; |
|
38 | + $form .= '<br />'.XoopsLocale::INPUT_RESULT_FROM_EXPRESSION; |
|
39 | 39 | if (!empty($this->config['maxattempts'])) { |
40 | - $form .= '<br />' . sprintf(XoopsLocale::F_MAXIMUM_ATTEMPTS, $this->config['maxattempts']); |
|
40 | + $form .= '<br />'.sprintf(XoopsLocale::F_MAXIMUM_ATTEMPTS, $this->config['maxattempts']); |
|
41 | 41 | } |
42 | 42 | return $form; |
43 | 43 | } |
@@ -58,6 +58,6 @@ discard block |
||
58 | 58 | $expression = "{$val_a} + {$val_b} = ?"; |
59 | 59 | $this->code = $val_a + $val_b; |
60 | 60 | } |
61 | - return '<span style="font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;">' . $expression . '</span>'; |
|
61 | + return '<span style="font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;">'.$expression.'</span>'; |
|
62 | 62 | } |
63 | 63 | } |
@@ -297,15 +297,15 @@ |
||
297 | 297 | if ($RandImage = $this->loadBackground()) { |
298 | 298 | $ImageType = @getimagesize($RandImage); |
299 | 299 | switch (@$ImageType[2]) { |
300 | - case 1: |
|
301 | - $BackgroundImage = imagecreatefromgif($RandImage); |
|
302 | - break; |
|
303 | - case 2: |
|
304 | - $BackgroundImage = imagecreatefromjpeg($RandImage); |
|
305 | - break; |
|
306 | - case 3: |
|
307 | - $BackgroundImage = imagecreatefrompng($RandImage); |
|
308 | - break; |
|
300 | + case 1: |
|
301 | + $BackgroundImage = imagecreatefromgif($RandImage); |
|
302 | + break; |
|
303 | + case 2: |
|
304 | + $BackgroundImage = imagecreatefromjpeg($RandImage); |
|
305 | + break; |
|
306 | + case 3: |
|
307 | + $BackgroundImage = imagecreatefrompng($RandImage); |
|
308 | + break; |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | if (isset($BackgroundImage) && !empty($BackgroundImage)) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | if ($this->invalid) { |
142 | 142 | header("Content-type: image/gif"); |
143 | - readfile($this->xoops_root_path . "/images/subject/icon2.gif"); |
|
143 | + readfile($this->xoops_root_path."/images/subject/icon2.gif"); |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | return $items; |
166 | 166 | } |
167 | 167 | ; |
168 | - $file_path = $this->xoops_root_path . "/class/captcha/image/{$name}"; |
|
168 | + $file_path = $this->xoops_root_path."/class/captcha/image/{$name}"; |
|
169 | 169 | $files = \Xoops\Core\Lists\File::getList($file_path); |
170 | 170 | foreach ($files as $item) { |
171 | 171 | if (empty($extension) || preg_match("/(\.{$extension})$/i", $item)) { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public function loadFont() |
237 | 237 | { |
238 | 238 | $fonts = $this->getList("fonts", "ttf"); |
239 | - $this->font = $this->xoops_root_path . "/class/captcha/image/fonts/" . $fonts[array_rand($fonts)]; |
|
239 | + $this->font = $this->xoops_root_path."/class/captcha/image/fonts/".$fonts[array_rand($fonts)]; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | { |
283 | 283 | $RandBackground = null; |
284 | 284 | if ($backgrounds = $this->getList("backgrounds", "(gif|jpg|png)")) { |
285 | - $RandBackground = $this->xoops_root_path . "/class/captcha/image/backgrounds/" . $backgrounds[array_rand($backgrounds)]; |
|
285 | + $RandBackground = $this->xoops_root_path."/class/captcha/image/backgrounds/".$backgrounds[array_rand($backgrounds)]; |
|
286 | 286 | } |
287 | 287 | return $RandBackground; |
288 | 288 | } |