Test Failed
Pull Request — master (#592)
by Lucio
10:17
created
htdocs/class/auth/auth_ads.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                     return false;
93 93
                 }
94 94
             } else {
95
-                $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userUPN . ')');
95
+                $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)).'('.$userUPN.')');
96 96
             }
97 97
         } else {
98 98
             $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function getUPN($uname)
116 116
     {
117
-        $userDN = $uname . '@' . $this->ldap_domain_name;
117
+        $userDN = $uname.'@'.$this->ldap_domain_name;
118 118
 
119 119
         return $userDN;
120 120
     }
Please login to merge, or discard this patch.
htdocs/class/auth/auth_ldap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 if (!class_exists('XoopsAuthProvisionning')) {
34
-    trigger_error('Required class XoopsAuthProvisionning was not found at line ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
34
+    trigger_error('Required class XoopsAuthProvisionning was not found at line '.__FILE__.' at line '.__LINE__, E_USER_WARNING);
35 35
 
36 36
     return false;
37 37
 }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                 // We load the Xoops User database
238 238
                 return $this->loadXoopsUser($userDN, $uname, $pwd);
239 239
             } else {
240
-                $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userDN . ')');
240
+                $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)).'('.$userDN.')');
241 241
             }
242 242
         } else {
243 243
             $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND);
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         if (!$this->ldap_loginname_asdn) {
260 260
             // Bind with the manager
261 261
             if (!ldap_bind($this->_ds, $this->ldap_manager_dn, stripslashes($this->ldap_manager_pass))) {
262
-                $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $this->ldap_manager_dn . ')');
262
+                $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)).'('.$this->ldap_manager_dn.')');
263 263
 
264 264
                 return false;
265 265
             }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 $this->setErrors(0, sprintf(_AUTH_LDAP_USER_NOT_FOUND, $uname, $filter, $this->ldap_base_dn));
273 273
             }
274 274
         } else {
275
-            $userDN = $this->ldap_loginldap_attr . '=' . $uname . ',' . $this->ldap_base_dn;
275
+            $userDN = $this->ldap_loginldap_attr.'='.$uname.','.$this->ldap_base_dn;
276 276
         }
277 277
 
278 278
         return $userDN;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         if ($this->ldap_filter_person != '') {
291 291
             $filter = str_replace('@@loginname@@', $uname, $this->ldap_filter_person);
292 292
         } else {
293
-            $filter = $this->ldap_loginldap_attr . '=' . $uname;
293
+            $filter = $this->ldap_loginldap_attr.'='.$uname;
294 294
         }
295 295
 
296 296
         return $filter;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         if ($entries['count'] > 0) {
313 313
             $xoopsUser = $provisHandler->sync($entries[0], $uname, $pwd);
314 314
         } else {
315
-            $this->setErrors(0, sprintf('loadXoopsUser - ' . _AUTH_LDAP_CANT_READ_ENTRY, $userdn));
315
+            $this->setErrors(0, sprintf('loadXoopsUser - '._AUTH_LDAP_CANT_READ_ENTRY, $userdn));
316 316
         }
317 317
 
318 318
         return $xoopsUser;
Please login to merge, or discard this patch.
htdocs/class/auth/authfactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@
 block discarded – undo
61 61
                 $xoops_auth_method = 'xoops';
62 62
             }
63 63
 
64
-            $ret = include_once $GLOBALS['xoops']->path('class/auth/auth_' . $xoops_auth_method . '.php');
64
+            $ret = include_once $GLOBALS['xoops']->path('class/auth/auth_'.$xoops_auth_method.'.php');
65 65
             if ($ret == false) {
66 66
                 return false;
67 67
             }
68 68
 
69
-            $class = 'XoopsAuth' . ucfirst($xoops_auth_method);
69
+            $class = 'XoopsAuth'.ucfirst($xoops_auth_method);
70 70
             if (!class_exists($class)) {
71 71
                 $GLOBALS['xoopsLogger']->triggerError($class, _XO_ER_CLASSNOTFOUND, __FILE__, __LINE__, E_USER_ERROR);
72 72
 
Please login to merge, or discard this patch.
htdocs/class/auth/auth_provisionning.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
             return $newuser;
153 153
         } else {
154
-            redirect_header(XOOPS_URL . '/user.php', 5, $newuser->getHtmlErrors());
154
+            redirect_header(XOOPS_URL.'/user.php', 5, $newuser->getHtmlErrors());
155 155
         }
156 156
 
157 157
         return $ret;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         if ($member_handler->insertUser($xoopsUser)) {
183 183
             return $xoopsUser;
184 184
         } else {
185
-            redirect_header(XOOPS_URL . '/user.php', 5, $xoopsUser->getHtmlErrors());
185
+            redirect_header(XOOPS_URL.'/user.php', 5, $xoopsUser->getHtmlErrors());
186 186
         }
187 187
 
188 188
         return $ret;
Please login to merge, or discard this patch.
htdocs/class/commentrenderer.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         /* @var $this->_memberHandler XoopsMemberHandler  */
59 59
         $this->_memberHandler = xoops_getHandler('member');
60 60
         $this->_statusText    = array(
61
-            XOOPS_COMMENT_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #00ff00;">' . _CM_PENDING . '</span>',
62
-            XOOPS_COMMENT_ACTIVE  => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">' . _CM_ACTIVE . '</span>',
63
-            XOOPS_COMMENT_HIDDEN  => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">' . _CM_HIDDEN . '</span>');
61
+            XOOPS_COMMENT_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #00ff00;">'._CM_PENDING.'</span>',
62
+            XOOPS_COMMENT_ACTIVE  => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">'._CM_ACTIVE.'</span>',
63
+            XOOPS_COMMENT_HIDDEN  => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">'._CM_HIDDEN.'</span>');
64 64
     }
65 65
 
66 66
     /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         if (isset($this->_comments)) {
92 92
             unset($this->_comments);
93 93
         }
94
-        $this->_comments =& $comments_arr;
94
+        $this->_comments = & $comments_arr;
95 95
     }
96 96
 
97 97
     /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $count = count($this->_comments);
105 105
         for ($i = 0; $i < $count; ++$i) {
106 106
             if (false !== $this->_useIcons) {
107
-                $title = $this->_getTitleIcon($this->_comments[$i]->getVar('com_icon')) . '&nbsp;' . $this->_comments[$i]->getVar('com_title');
107
+                $title = $this->_getTitleIcon($this->_comments[$i]->getVar('com_icon')).'&nbsp;'.$this->_comments[$i]->getVar('com_title');
108 108
             } else {
109 109
                 $title = $this->_comments[$i]->getVar('com_title');
110 110
             }
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
                 $com_email = $this->_comments[$i]->getVar('com_email');
115 115
                 $text      = $this->_comments[$i]->getVar('com_text');
116 116
                 $text .= '<div style="text-align:right; margin-top: 2px; margin-bottom: 0; margin-right: 2px;">';
117
-                $text .= _CM_STATUS . ': ' . $this->_statusText[$this->_comments[$i]->getVar('com_status')] . '<br>';
118
-                $text .= 'IP: <span style="font-weight: bold;">' . $this->_comments[$i]->getVar('com_ip') . '</span>';
117
+                $text .= _CM_STATUS.': '.$this->_statusText[$this->_comments[$i]->getVar('com_status')].'<br>';
118
+                $text .= 'IP: <span style="font-weight: bold;">'.$this->_comments[$i]->getVar('com_ip').'</span>';
119 119
                 if (!empty($com_email)) {
120
-                    $text .= '<br>' . _CM_EMAIL . ' :<span style="font-weight: bold;"><a href="mailto:' . $com_email . '" title="' . $com_email . '">' . $com_email . '</a></span>';
120
+                    $text .= '<br>'._CM_EMAIL.' :<span style="font-weight: bold;"><a href="mailto:'.$com_email.'" title="'.$com_email.'">'.$com_email.'</a></span>';
121 121
                 }
122 122
                 $text .= '</div>';
123 123
             } else {
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
         include_once $GLOBALS['xoops']->path('class/tree.php');
155 155
         // construct comment tree
156 156
         $xot  = new XoopsObjectTree($this->_comments, 'com_id', 'com_pid', 'com_rootid');
157
-        $tree =& $xot->getTree();
157
+        $tree = & $xot->getTree();
158 158
 
159 159
         if (false !== $this->_useIcons) {
160
-            $title = $this->_getTitleIcon($tree[$comment_id]['obj']->getVar('com_icon')) . '&nbsp;' . $tree[$comment_id]['obj']->getVar('com_title');
160
+            $title = $this->_getTitleIcon($tree[$comment_id]['obj']->getVar('com_icon')).'&nbsp;'.$tree[$comment_id]['obj']->getVar('com_title');
161 161
         } else {
162 162
             $title = $tree[$comment_id]['obj']->getVar('com_title');
163 163
         }
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
             $com_email = $tree[$comment_id]['obj']->getVar('com_email');
175 175
             $text      = $tree[$comment_id]['obj']->getVar('com_text');
176 176
             $text .= '<div style="text-align:right; margin-top: 2px; margin-bottom: 0; margin-right: 2px;">';
177
-            $text .= _CM_STATUS . ': ' . $this->_statusText[$tree[$comment_id]['obj']->getVar('com_status')] . '<br>';
178
-            $text .= 'IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('com_ip') . '</span>';
177
+            $text .= _CM_STATUS.': '.$this->_statusText[$tree[$comment_id]['obj']->getVar('com_status')].'<br>';
178
+            $text .= 'IP: <span style="font-weight: bold;">'.$tree[$comment_id]['obj']->getVar('com_ip').'</span>';
179 179
             if (!empty($com_email)) {
180
-                $text .= '<br>' . _CM_EMAIL . ' :<span style="font-weight: bold;"><a href="mailto:' . $com_email . '" title="' . $com_email . '">' . $com_email . '</a></span>';
180
+                $text .= '<br>'._CM_EMAIL.' :<span style="font-weight: bold;"><a href="mailto:'.$com_email.'" title="'.$com_email.'">'.$com_email.'</a></span>';
181 181
             }
182 182
             $text .= '</div>';
183 183
         } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         }
198 198
         $replies = array();
199 199
         $this->_renderThreadReplies($tree, $comment_id, $replies, '&nbsp;&nbsp;', $admin_view);
200
-        $show_replies = (count($replies) > 0);// ? true : false;
200
+        $show_replies = (count($replies) > 0); // ? true : false;
201 201
         // Start edit by voltan
202 202
         $this->_tpl->append('comments', array(
203 203
             'pid'           => $tree[$comment_id]['obj']->getVar('com_pid'),
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
         $admin_view = (bool)$admin_view;
232 232
         if ($depth > 0) {
233 233
             if (false !== $this->_useIcons) {
234
-                $title = $this->_getTitleIcon($thread[$key]['obj']->getVar('com_icon')) . '&nbsp;' . $thread[$key]['obj']->getVar('com_title');
234
+                $title = $this->_getTitleIcon($thread[$key]['obj']->getVar('com_icon')).'&nbsp;'.$thread[$key]['obj']->getVar('com_title');
235 235
             } else {
236 236
                 $title = $thread[$key]['obj']->getVar('com_title');
237 237
             }
238
-            $title = (false !== $admin_view) ? $title . ' ' . $this->_statusText[$thread[$key]['obj']->getVar('com_status')] : $title;
238
+            $title = (false !== $admin_view) ? $title.' '.$this->_statusText[$thread[$key]['obj']->getVar('com_status')] : $title;
239 239
             // Start edit by voltan
240 240
             $replies[] = array(
241 241
                 'id'          => $key,
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
     {
279 279
         include_once $GLOBALS['xoops']->path('class/tree.php');
280 280
         $xot  = new XoopsObjectTree($this->_comments, 'com_id', 'com_pid', 'com_rootid');
281
-        $tree =& $xot->getTree();
281
+        $tree = & $xot->getTree();
282 282
         if (false !== $this->_useIcons) {
283
-            $title = $this->_getTitleIcon($tree[$comment_id]['obj']->getVar('com_icon')) . '&nbsp;' . $tree[$comment_id]['obj']->getVar('com_title');
283
+            $title = $this->_getTitleIcon($tree[$comment_id]['obj']->getVar('com_icon')).'&nbsp;'.$tree[$comment_id]['obj']->getVar('com_title');
284 284
         } else {
285 285
             $title = $tree[$comment_id]['obj']->getVar('com_title');
286 286
         }
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
             $com_email = $tree[$comment_id]['obj']->getVar('com_email');
290 290
             $text      = $tree[$comment_id]['obj']->getVar('com_text');
291 291
             $text .= '<div style="text-align:right; margin-top: 2px; margin-bottom: 0; margin-right: 2px;">';
292
-            $text .= _CM_STATUS . ': ' . $this->_statusText[$tree[$comment_id]['obj']->getVar('com_status')] . '<br>';
293
-            $text .= 'IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('com_ip') . '</span>';
292
+            $text .= _CM_STATUS.': '.$this->_statusText[$tree[$comment_id]['obj']->getVar('com_status')].'<br>';
293
+            $text .= 'IP: <span style="font-weight: bold;">'.$tree[$comment_id]['obj']->getVar('com_ip').'</span>';
294 294
             if (!empty($com_email)) {
295
-                $text .= '<br>' . _CM_EMAIL . ' :<span style="font-weight: bold;"><a href="mailto:' . $com_email . '" title="' . $com_email . '">' . $com_email . '</a></span>';
295
+                $text .= '<br>'._CM_EMAIL.' :<span style="font-weight: bold;"><a href="mailto:'.$com_email.'" title="'.$com_email.'">'.$com_email.'</a></span>';
296 296
             }
297 297
             $text .= '</div>';
298 298
         } else {
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
     {
343 343
         if ($depth > 0) {
344 344
             if (false !== $this->_useIcons) {
345
-                $title = $this->_getTitleIcon($thread[$key]['obj']->getVar('com_icon')) . '&nbsp;' . $thread[$key]['obj']->getVar('com_title');
345
+                $title = $this->_getTitleIcon($thread[$key]['obj']->getVar('com_icon')).'&nbsp;'.$thread[$key]['obj']->getVar('com_title');
346 346
             } else {
347 347
                 $title = $thread[$key]['obj']->getVar('com_title');
348 348
             }
349 349
             $admin_view = (bool)$admin_view;
350
-            $text = (false !== $admin_view) ? $thread[$key]['obj']->getVar('com_text') . '<div style="text-align:right; margin-top: 2px; margin-right: 2px;">' . _CM_STATUS . ': ' . $this->_statusText[$thread[$key]['obj']->getVar('com_status')] . '<br>IP: <span style="font-weight: bold;">' . $thread[$key]['obj']->getVar('com_ip') . '</span><br>' . _CM_EMAIL . ' :<span style="font-weight: bold;">' . $thread[$key]['obj']->getVar('com_email') . '</span></div>' : $thread[$key]['obj']->getVar('com_text');
350
+            $text = (false !== $admin_view) ? $thread[$key]['obj']->getVar('com_text').'<div style="text-align:right; margin-top: 2px; margin-right: 2px;">'._CM_STATUS.': '.$this->_statusText[$thread[$key]['obj']->getVar('com_status')].'<br>IP: <span style="font-weight: bold;">'.$thread[$key]['obj']->getVar('com_ip').'</span><br>'._CM_EMAIL.' :<span style="font-weight: bold;">'.$thread[$key]['obj']->getVar('com_email').'</span></div>' : $thread[$key]['obj']->getVar('com_text');
351 351
             // Start edit by voltan
352 352
             $replies[] = array(
353 353
                 'id'            => $key,
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
         if ($poster['id'] > 0) {
397 397
             $com_poster = $this->_memberHandler->getUser($poster_id);
398 398
             if (is_object($com_poster)) {
399
-                $poster['uname'] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $poster['id'] . '">' . $com_poster->getVar('uname') . '</a>';
399
+                $poster['uname'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$poster['id'].'">'.$com_poster->getVar('uname').'</a>';
400 400
             }
401 401
         } elseif ($poster['id'] == 0 && $poster_user != '') {
402 402
             $poster['id'] = 0; // to cope with deleted user accounts
403 403
             if (!empty($poster_website)) {
404
-                $poster['uname'] = '<a href="' . $poster_website . '">' . $poster_user . '</a>';
404
+                $poster['uname'] = '<a href="'.$poster_website.'">'.$poster_user.'</a>';
405 405
             } else {
406 406
                 $poster['uname'] = $poster_user;
407 407
             }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             /* @var  $com_poster XoopsUser */
432 432
             $com_poster = $this->_memberHandler->getUser($poster['id']);
433 433
             if (is_object($com_poster)) {
434
-                $poster['uname']      = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $poster['id'] . '">' . $com_poster->getVar('uname') . '</a>';
434
+                $poster['uname']      = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$poster['id'].'">'.$com_poster->getVar('uname').'</a>';
435 435
                 $poster_rank          = $com_poster->rank();
436 436
                 $poster['rank_image'] = ($poster_rank['image'] != '') ? $poster_rank['image'] : 'blank.gif';
437 437
                 $poster['rank_title'] = $poster_rank['title'];
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             }
444 444
         } elseif ($poster['id'] == 0 && $poster_user != '') {
445 445
             if (!empty($poster_website)) {
446
-                $poster['uname'] = '<a href="' . $poster_website . '">' . $poster_user . '</a>';
446
+                $poster['uname'] = '<a href="'.$poster_website.'">'.$poster_user.'</a>';
447 447
             } else {
448 448
                 $poster['uname'] = $poster_user;
449 449
             }
@@ -481,16 +481,16 @@  discard block
 block discarded – undo
481 481
         $icon_image = htmlspecialchars(trim($icon_image));
482 482
         if ($icon_image != '') {
483 483
             if (false !== $this->_doIconCheck) {
484
-                if (!file_exists($GLOBALS['xoops']->path('images/subject/' . $icon_image))) {
485
-                    return '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />';
484
+                if (!file_exists($GLOBALS['xoops']->path('images/subject/'.$icon_image))) {
485
+                    return '<img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />';
486 486
                 } else {
487
-                    return '<img src="' . XOOPS_URL . '/images/subject/' . $icon_image . '" alt="" />';
487
+                    return '<img src="'.XOOPS_URL.'/images/subject/'.$icon_image.'" alt="" />';
488 488
                 }
489 489
             } else {
490
-                return '<img src="' . XOOPS_URL . '/images/subject/' . $icon_image . '" alt="" />';
490
+                return '<img src="'.XOOPS_URL.'/images/subject/'.$icon_image.'" alt="" />';
491 491
             }
492 492
         }
493 493
 
494
-        return '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />';
494
+        return '<img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />';
495 495
     }
496 496
 }
Please login to merge, or discard this patch.
htdocs/class/captcha/xoopscaptcha.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     {
45 45
         xoops_loadLanguage('captcha');
46 46
         // Load static configurations
47
-        $this->path_basic  = XOOPS_ROOT_PATH . '/class/captcha';
48
-        $this->path_plugin = XOOPS_ROOT_PATH . '/Frameworks/captcha';
47
+        $this->path_basic  = XOOPS_ROOT_PATH.'/class/captcha';
48
+        $this->path_plugin = XOOPS_ROOT_PATH.'/Frameworks/captcha';
49 49
         $this->config      = $this->loadConfig();
50 50
         $this->name        = $this->config['name'];
51 51
     }
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $basic_config  = array();
78 78
         $plugin_config = array();
79
-        $filename      = empty($filename) ? 'config.php' : 'config.' . $filename . '.php';
80
-        if (file_exists($file = $this->path_basic . '/' . $filename)) {
79
+        $filename      = empty($filename) ? 'config.php' : 'config.'.$filename.'.php';
80
+        if (file_exists($file = $this->path_basic.'/'.$filename)) {
81 81
             $basic_config = include $file;
82 82
         }
83
-        if (file_exists($file = $this->path_plugin . '/' . $filename)) {
83
+        if (file_exists($file = $this->path_plugin.'/'.$filename)) {
84 84
             $plugin_config = include $file;
85 85
         }
86 86
 
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
     public function loadHandler($name = null)
130 130
     {
131 131
         $name  = !empty($name) ? $name : (empty($this->config['mode']) ? 'text' : $this->config['mode']);
132
-        $class = 'XoopsCaptcha' . ucfirst($name);
132
+        $class = 'XoopsCaptcha'.ucfirst($name);
133 133
         if (!empty($this->handler) && get_class($this->handler) == $class) {
134 134
             return $this->handler;
135 135
         }
136 136
         $this->handler = null;
137
-        if (file_exists($file = $this->path_basic . '/' . $name . '.php')) {
137
+        if (file_exists($file = $this->path_basic.'/'.$name.'.php')) {
138 138
             require_once $file;
139 139
         } else {
140
-            if (file_exists($file = $this->path_plugin . '/' . $name . '.php')) {
140
+            if (file_exists($file = $this->path_plugin.'/'.$name.'.php')) {
141 141
                 require_once $file;
142 142
             }
143 143
         }
144 144
 
145 145
         if (!class_exists($class)) {
146 146
             $class = 'XoopsCaptchaText';
147
-            require_once $this->path_basic . '/text.php';
147
+            require_once $this->path_basic.'/text.php';
148 148
         }
149 149
         $handler = new $class($this);
150 150
         if ($handler->isActive()) {
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
             $this->handler->destroyGarbage();
268 268
         }
269 269
         if ($clearSession) {
270
-            $_SESSION[$this->name . '_name']        = null;
271
-            $_SESSION[$this->name . '_skipmember']  = null;
272
-            $_SESSION[$this->name . '_code']        = null;
273
-            $_SESSION[$this->name . '_maxattempts'] = null;
270
+            $_SESSION[$this->name.'_name']        = null;
271
+            $_SESSION[$this->name.'_skipmember']  = null;
272
+            $_SESSION[$this->name.'_code']        = null;
273
+            $_SESSION[$this->name.'_maxattempts'] = null;
274 274
         }
275 275
 
276 276
         return true;
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
      */
284 284
     public function render()
285 285
     {
286
-        $_SESSION[$this->name . '_name']       = $this->name;
287
-        $_SESSION[$this->name . '_skipmember'] = $this->config['skipmember'];
286
+        $_SESSION[$this->name.'_name']       = $this->name;
287
+        $_SESSION[$this->name.'_skipmember'] = $this->config['skipmember'];
288 288
         $form                                  = '';
289 289
         if (!$this->active || empty($this->config['name'])) {
290 290
             return $form;
291 291
         }
292 292
 
293 293
         $maxAttempts                            = $this->config['maxattempts'];
294
-        $_SESSION[$this->name . '_maxattempts'] = $maxAttempts;
295
-        $attempt                                = isset($_SESSION[$this->name . '_attempt']) ? $_SESSION[$this->name . '_attempt'] : 0;
296
-        $_SESSION[$this->name . '_attempt']     = $attempt;
294
+        $_SESSION[$this->name.'_maxattempts'] = $maxAttempts;
295
+        $attempt                                = isset($_SESSION[$this->name.'_attempt']) ? $_SESSION[$this->name.'_attempt'] : 0;
296
+        $_SESSION[$this->name.'_attempt']     = $attempt;
297 297
 
298 298
         // Failure on too many attempts
299 299
         if (!empty($maxAttempts) && $attempt > $maxAttempts) {
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     {
331 331
         $code = ($code === null) ? $this->handler->getCode() : $code;
332 332
         if (!empty($code)) {
333
-            $_SESSION[$this->name . '_code'] = $code;
333
+            $_SESSION[$this->name.'_code'] = $code;
334 334
 
335 335
             return true;
336 336
         }
Please login to merge, or discard this patch.
htdocs/class/captcha/config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
  * the actual XOOPS config then we should do this. (Who said this? You are right!)
25 25
  */
26 26
 return $config = array(
27
-    'disabled'    => false,  // Disable CAPTCHA
28
-    'mode'        => 'text',  // default mode, you can choose 'text', 'image', 'recaptcha'(requires api key), 'recaptcha2'(requires api key)
29
-    'name'        => 'xoopscaptcha',  // captcha name
30
-    'skipmember'  => true,  // Skip CAPTCHA check for members
31
-    'maxattempts' => 10,  // Maximum attempts for each session
27
+    'disabled'    => false, // Disable CAPTCHA
28
+    'mode'        => 'text', // default mode, you can choose 'text', 'image', 'recaptcha'(requires api key), 'recaptcha2'(requires api key)
29
+    'name'        => 'xoopscaptcha', // captcha name
30
+    'skipmember'  => true, // Skip CAPTCHA check for members
31
+    'maxattempts' => 10, // Maximum attempts for each session
32 32
 );
Please login to merge, or discard this patch.
htdocs/class/captcha/recaptcha2.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $form = '<script src="https://www.google.com/recaptcha/api.js"></script>';
51 51
         $form .= '<div class="form-group"><div class="g-recaptcha" data-sitekey="'
52
-            . $this->config['website_key'] . '"></div></div>';
52
+            . $this->config['website_key'].'"></div></div>';
53 53
         return $form;
54 54
     }
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $isValid = false;
66 66
         $recaptchaResponse = Request::getString('g-recaptcha-response', '');
67
-        $recaptchaVerifyURL = 'https://www.google.com/recaptcha/api/siteverify?secret=' . $this->config['secret_key']
68
-            . '&response=' .  $recaptchaResponse . '&remoteip=' . IPAddress::fromRequest()->asReadable();
67
+        $recaptchaVerifyURL = 'https://www.google.com/recaptcha/api/siteverify?secret='.$this->config['secret_key']
68
+            . '&response='.$recaptchaResponse.'&remoteip='.IPAddress::fromRequest()->asReadable();
69 69
         $usedCurl = false;
70
-        if (function_exists('curl_init') && false !== ($curlHandle  = curl_init())) {
70
+        if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) {
71 71
             curl_setopt($curlHandle, CURLOPT_URL, $recaptchaVerifyURL);
72 72
             curl_setopt($curlHandle, CURLOPT_FAILONERROR, true);
73 73
             curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
Please login to merge, or discard this patch.
htdocs/class/captcha/recaptcha/recaptchalib.php 3 patches
Indentation   +59 added lines, -60 removed lines patch added patch discarded remove patch
@@ -100,16 +100,15 @@  discard block
 block discarded – undo
100 100
  * @param string $pubkey A public key for reCAPTCHA
101 101
  * @param string $error The error given by reCAPTCHA (optional, default is null)
102 102
  * @param boolean $use_ssl Should the request be made over ssl? (optional, default is true)
103
-
104 103
  * @return string - The HTML to be embedded in the user's form.
105 104
  */
106 105
 function recaptcha_get_html ($pubkey, $error = null, $use_ssl = true)
107 106
 {
108
-	if ($pubkey == null || $pubkey == '') {
109
-		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
110
-	}
107
+    if ($pubkey == null || $pubkey == '') {
108
+        die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
109
+    }
111 110
 
112
-	if ($use_ssl) {
111
+    if ($use_ssl) {
113 112
                 $server = RECAPTCHA_API_SECURE_SERVER;
114 113
         } else {
115 114
                 $server = RECAPTCHA_API_SERVER;
@@ -117,7 +116,7 @@  discard block
 block discarded – undo
117 116
 
118 117
         $errorpart = "";
119 118
         if ($error) {
120
-           $errorpart = "&amp;error=" . $error;
119
+            $errorpart = "&amp;error=" . $error;
121 120
         }
122 121
         return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
123 122
 
@@ -141,23 +140,23 @@  discard block
 block discarded – undo
141 140
 
142 141
 
143 142
 /**
144
-  * Calls an HTTP POST function to verify if the user's guess was correct
145
-  * @param string $privkey
146
-  * @param string $remoteip
147
-  * @param string $challenge
148
-  * @param string $response
149
-  * @param array $extra_params an array of extra variables to post to the server
150
-  * @return ReCaptchaResponse
151
-  */
143
+ * Calls an HTTP POST function to verify if the user's guess was correct
144
+ * @param string $privkey
145
+ * @param string $remoteip
146
+ * @param string $challenge
147
+ * @param string $response
148
+ * @param array $extra_params an array of extra variables to post to the server
149
+ * @return ReCaptchaResponse
150
+ */
152 151
 function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
153 152
 {
154
-	if ($privkey == null || $privkey == '') {
155
-		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
156
-	}
153
+    if ($privkey == null || $privkey == '') {
154
+        die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
155
+    }
157 156
 
158
-	if ($remoteip == null || $remoteip == '') {
159
-		die ("For security reasons, you must pass the remote ip to reCAPTCHA");
160
-	}
157
+    if ($remoteip == null || $remoteip == '') {
158
+        die ("For security reasons, you must pass the remote ip to reCAPTCHA");
159
+    }
161 160
 
162 161
 
163 162
 
@@ -170,13 +169,13 @@  discard block
 block discarded – undo
170 169
         }
171 170
 
172 171
         $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
173
-                                          array (
174
-                                                 'privatekey' => $privkey,
175
-                                                 'remoteip' => $remoteip,
176
-                                                 'challenge' => $challenge,
177
-                                                 'response' => $response
178
-                                                 ) + $extra_params
179
-                                          );
172
+                                            array (
173
+                                                    'privatekey' => $privkey,
174
+                                                    'remoteip' => $remoteip,
175
+                                                    'challenge' => $challenge,
176
+                                                    'response' => $response
177
+                                                    ) + $extra_params
178
+                                            );
180 179
 
181 180
         $answers = explode ("\n", $response [1]);
182 181
         $recaptcha_response = new ReCaptchaResponse();
@@ -200,44 +199,44 @@  discard block
 block discarded – undo
200 199
  * @param string $appname The name of your application
201 200
  */
202 201
 function recaptcha_get_signup_url ($domain = null, $appname = null) {
203
-	return "https://www.google.com/recaptcha/admin/create?" .  _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
202
+    return "https://www.google.com/recaptcha/admin/create?" .  _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
204 203
 }
205 204
 
206 205
 function _recaptcha_aes_pad($val) {
207
-	$block_size = 16;
208
-	$numpad = $block_size - (strlen ($val) % $block_size);
209
-	return str_pad($val, strlen ($val) + $numpad, chr($numpad));
206
+    $block_size = 16;
207
+    $numpad = $block_size - (strlen ($val) % $block_size);
208
+    return str_pad($val, strlen ($val) + $numpad, chr($numpad));
210 209
 }
211 210
 
212 211
 /* Mailhide related code */
213 212
 
214 213
 function _recaptcha_aes_encrypt($val,$ky) {
215
-	if (! function_exists ("mcrypt_encrypt")) {
216
-		die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
217
-	}
218
-	$mode=MCRYPT_MODE_CBC;
219
-	$enc=MCRYPT_RIJNDAEL_128;
220
-	$val=_recaptcha_aes_pad($val);
221
-	return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
214
+    if (! function_exists ("mcrypt_encrypt")) {
215
+        die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
216
+    }
217
+    $mode=MCRYPT_MODE_CBC;
218
+    $enc=MCRYPT_RIJNDAEL_128;
219
+    $val=_recaptcha_aes_pad($val);
220
+    return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
222 221
 }
223 222
 
224 223
 
225 224
 function _recaptcha_mailhide_urlbase64 ($x) {
226
-	return strtr(base64_encode ($x), '+/', '-_');
225
+    return strtr(base64_encode ($x), '+/', '-_');
227 226
 }
228 227
 
229 228
 /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
230 229
 function recaptcha_mailhide_url($pubkey, $privkey, $email) {
231
-	if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
232
-		die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
233
-		     "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
234
-	}
230
+    if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
231
+        die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
232
+                "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
233
+    }
235 234
 
236 235
 
237
-	$ky = pack('H*', $privkey);
238
-	$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
236
+    $ky = pack('H*', $privkey);
237
+    $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
239 238
 
240
-	return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
239
+    return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
241 240
 }
242 241
 
243 242
 /**
@@ -246,16 +245,16 @@  discard block
 block discarded – undo
246 245
  * the email is then displayed as [email protected]
247 246
  */
248 247
 function _recaptcha_mailhide_email_parts ($email) {
249
-	$arr = preg_split("/@/", $email );
250
-
251
-	if (strlen ($arr[0]) <= 4) {
252
-		$arr[0] = substr ($arr[0], 0, 1);
253
-	} else if (strlen ($arr[0]) <= 6) {
254
-		$arr[0] = substr ($arr[0], 0, 3);
255
-	} else {
256
-		$arr[0] = substr ($arr[0], 0, 4);
257
-	}
258
-	return $arr;
248
+    $arr = preg_split("/@/", $email );
249
+
250
+    if (strlen ($arr[0]) <= 4) {
251
+        $arr[0] = substr ($arr[0], 0, 1);
252
+    } else if (strlen ($arr[0]) <= 6) {
253
+        $arr[0] = substr ($arr[0], 0, 3);
254
+    } else {
255
+        $arr[0] = substr ($arr[0], 0, 4);
256
+    }
257
+    return $arr;
259 258
 }
260 259
 
261 260
 /**
@@ -265,11 +264,11 @@  discard block
 block discarded – undo
265 264
  * http://www.google.com/recaptcha/mailhide/apikey
266 265
  */
267 266
 function recaptcha_mailhide_html($pubkey, $privkey, $email) {
268
-	$emailparts = _recaptcha_mailhide_email_parts ($email);
269
-	$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
267
+    $emailparts = _recaptcha_mailhide_email_parts ($email);
268
+    $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
270 269
 
271
-	return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
272
-		"' 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]);
270
+    return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
271
+        "' 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]);
273 272
 
274 273
 }
275 274
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  * @param $data - array of string elements to be encoded
45 45
  * @return string - encoded request
46 46
  */
47
-function _recaptcha_qsencode ($data) {
47
+function _recaptcha_qsencode($data) {
48 48
         $req = "";
49
-        foreach ( $data as $key => $value )
50
-                $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
49
+        foreach ($data as $key => $value)
50
+                $req .= $key.'='.urlencode(stripslashes($value)).'&';
51 51
 
52 52
         // Cut the last '&'
53
-        $req=substr($req,0,strlen($req)-1);
53
+        $req = substr($req, 0, strlen($req) - 1);
54 54
         return $req;
55 55
 }
56 56
 
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function _recaptcha_http_post($host, $path, $data, $port = 80) {
68 68
 
69
-        $req = _recaptcha_qsencode ($data);
69
+        $req = _recaptcha_qsencode($data);
70 70
 
71 71
         $http_request  = "POST $path HTTP/1.0\r\n";
72 72
         $http_request .= "Host: $host\r\n";
73 73
         $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
74
-        $http_request .= "Content-Length: " . strlen($req) . "\r\n";
74
+        $http_request .= "Content-Length: ".strlen($req)."\r\n";
75 75
         $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
76 76
         $http_request .= "\r\n";
77 77
         $http_request .= $req;
78 78
 
79 79
         $response = '';
80
-        if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
80
+        if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) {
81 81
                 die ('Could not open socket');
82 82
         }
83 83
 
84 84
         fwrite($fs, $http_request);
85 85
 
86
-        while ( !feof($fs) )
86
+        while (!feof($fs))
87 87
                 $response .= fgets($fs, 1160); // One TCP-IP packet
88 88
         fclose($fs);
89 89
         $response = explode("\r\n\r\n", $response, 2);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
  * @return string - The HTML to be embedded in the user's form.
105 105
  */
106
-function recaptcha_get_html ($pubkey, $error = null, $use_ssl = true)
106
+function recaptcha_get_html($pubkey, $error = null, $use_ssl = true)
107 107
 {
108 108
 	if ($pubkey == null || $pubkey == '') {
109 109
 		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 
118 118
         $errorpart = "";
119 119
         if ($error) {
120
-           $errorpart = "&amp;error=" . $error;
120
+           $errorpart = "&amp;error=".$error;
121 121
         }
122
-        return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
122
+        return '<script type="text/javascript" src="'.$server.'/challenge?k='.$pubkey.$errorpart.'"></script>
123 123
 
124 124
 	<noscript>
125
-  		<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
125
+  		<iframe src="'. $server.'/noscript?k='.$pubkey.$errorpart.'" height="300" width="500" frameborder="0"></iframe><br/>
126 126
   		<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
127 127
   		<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
128 128
 	</noscript>';
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
   * @param array $extra_params an array of extra variables to post to the server
150 150
   * @return ReCaptchaResponse
151 151
   */
152
-function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
152
+function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = array())
153 153
 {
154 154
 	if ($privkey == null || $privkey == '') {
155 155
 		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
                 return $recaptcha_response;
170 170
         }
171 171
 
172
-        $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
173
-                                          array (
172
+        $response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
173
+                                          array(
174 174
                                                  'privatekey' => $privkey,
175 175
                                                  'remoteip' => $remoteip,
176 176
                                                  'challenge' => $challenge,
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
                                                  ) + $extra_params
179 179
                                           );
180 180
 
181
-        $answers = explode ("\n", $response [1]);
181
+        $answers = explode("\n", $response [1]);
182 182
         $recaptcha_response = new ReCaptchaResponse();
183 183
 
184
-        if (trim ($answers [0]) == 'true') {
184
+        if (trim($answers [0]) == 'true') {
185 185
                 $recaptcha_response->is_valid = true;
186 186
         }
187 187
         else {
@@ -199,45 +199,45 @@  discard block
 block discarded – undo
199 199
  * @param string $domain The domain where the page is hosted
200 200
  * @param string $appname The name of your application
201 201
  */
202
-function recaptcha_get_signup_url ($domain = null, $appname = null) {
203
-	return "https://www.google.com/recaptcha/admin/create?" .  _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
202
+function recaptcha_get_signup_url($domain = null, $appname = null) {
203
+	return "https://www.google.com/recaptcha/admin/create?"._recaptcha_qsencode(array('domains' => $domain, 'app' => $appname));
204 204
 }
205 205
 
206 206
 function _recaptcha_aes_pad($val) {
207 207
 	$block_size = 16;
208
-	$numpad = $block_size - (strlen ($val) % $block_size);
209
-	return str_pad($val, strlen ($val) + $numpad, chr($numpad));
208
+	$numpad = $block_size - (strlen($val) % $block_size);
209
+	return str_pad($val, strlen($val) + $numpad, chr($numpad));
210 210
 }
211 211
 
212 212
 /* Mailhide related code */
213 213
 
214
-function _recaptcha_aes_encrypt($val,$ky) {
215
-	if (! function_exists ("mcrypt_encrypt")) {
214
+function _recaptcha_aes_encrypt($val, $ky) {
215
+	if (!function_exists("mcrypt_encrypt")) {
216 216
 		die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
217 217
 	}
218
-	$mode=MCRYPT_MODE_CBC;
219
-	$enc=MCRYPT_RIJNDAEL_128;
220
-	$val=_recaptcha_aes_pad($val);
218
+	$mode = MCRYPT_MODE_CBC;
219
+	$enc = MCRYPT_RIJNDAEL_128;
220
+	$val = _recaptcha_aes_pad($val);
221 221
 	return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
222 222
 }
223 223
 
224 224
 
225
-function _recaptcha_mailhide_urlbase64 ($x) {
226
-	return strtr(base64_encode ($x), '+/', '-_');
225
+function _recaptcha_mailhide_urlbase64($x) {
226
+	return strtr(base64_encode($x), '+/', '-_');
227 227
 }
228 228
 
229 229
 /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
230 230
 function recaptcha_mailhide_url($pubkey, $privkey, $email) {
231 231
 	if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
232
-		die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
232
+		die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, ".
233 233
 		     "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
234 234
 	}
235 235
 
236 236
 
237 237
 	$ky = pack('H*', $privkey);
238
-	$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
238
+	$cryptmail = _recaptcha_aes_encrypt($email, $ky);
239 239
 
240
-	return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
240
+	return "http://www.google.com/recaptcha/mailhide/d?k=".$pubkey."&c="._recaptcha_mailhide_urlbase64($cryptmail);
241 241
 }
242 242
 
243 243
 /**
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
  * eg, given johndoe@example,com return ["john", "example.com"].
246 246
  * the email is then displayed as [email protected]
247 247
  */
248
-function _recaptcha_mailhide_email_parts ($email) {
249
-	$arr = preg_split("/@/", $email );
248
+function _recaptcha_mailhide_email_parts($email) {
249
+	$arr = preg_split("/@/", $email);
250 250
 
251
-	if (strlen ($arr[0]) <= 4) {
252
-		$arr[0] = substr ($arr[0], 0, 1);
253
-	} else if (strlen ($arr[0]) <= 6) {
254
-		$arr[0] = substr ($arr[0], 0, 3);
251
+	if (strlen($arr[0]) <= 4) {
252
+		$arr[0] = substr($arr[0], 0, 1);
253
+	} else if (strlen($arr[0]) <= 6) {
254
+		$arr[0] = substr($arr[0], 0, 3);
255 255
 	} else {
256
-		$arr[0] = substr ($arr[0], 0, 4);
256
+		$arr[0] = substr($arr[0], 0, 4);
257 257
 	}
258 258
 	return $arr;
259 259
 }
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
  * http://www.google.com/recaptcha/mailhide/apikey
266 266
  */
267 267
 function recaptcha_mailhide_html($pubkey, $privkey, $email) {
268
-	$emailparts = _recaptcha_mailhide_email_parts ($email);
269
-	$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
268
+	$emailparts = _recaptcha_mailhide_email_parts($email);
269
+	$url = recaptcha_mailhide_url($pubkey, $privkey, $email);
270 270
 
271
-	return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
272
-		"' 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]);
271
+	return htmlentities($emailparts[0])."<a href='".htmlentities($url).
272
+		"' 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]);
273 273
 
274 274
 }
275 275
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function _recaptcha_qsencode ($data) {
48 48
         $req = "";
49
-        foreach ( $data as $key => $value )
50
-                $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
49
+        foreach ( $data as $key => $value ) {
50
+                        $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
51
+        }
51 52
 
52 53
         // Cut the last '&'
53 54
         $req=substr($req,0,strlen($req)-1);
@@ -83,8 +84,10 @@  discard block
 block discarded – undo
83 84
 
84 85
         fwrite($fs, $http_request);
85 86
 
86
-        while ( !feof($fs) )
87
-                $response .= fgets($fs, 1160); // One TCP-IP packet
87
+        while ( !feof($fs) ) {
88
+                        $response .= fgets($fs, 1160);
89
+        }
90
+        // One TCP-IP packet
88 91
         fclose($fs);
89 92
         $response = explode("\r\n\r\n", $response, 2);
90 93
 
@@ -183,8 +186,7 @@  discard block
 block discarded – undo
183 186
 
184 187
         if (trim ($answers [0]) == 'true') {
185 188
                 $recaptcha_response->is_valid = true;
186
-        }
187
-        else {
189
+        } else {
188 190
                 $recaptcha_response->is_valid = false;
189 191
                 $recaptcha_response->error = $answers [1];
190 192
         }
Please login to merge, or discard this patch.