Completed
Push — master ( 01b1a5...81f493 )
by Michael
04:03
created
include/captcha/formcaptcha.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -38,52 +38,52 @@
 block discarded – undo
38 38
  */
39 39
 class XoopsFormCaptcha extends XoopsFormElement
40 40
 {
41
-    public $_captchaHandler;
41
+	public $_captchaHandler;
42 42
 
43
-    /**
44
-     * @param string  $caption        Caption of the form element, default value is defined in captcha/language/
45
-     * @param string  $name           Name for the input box
46
-     * @param boolean $skipmember     Skip CAPTCHA check for members
47
-     * @param int     $numchar        Number of characters in image mode, and input box size for text mode
48
-     * @param int     $minfontsize    Minimum font-size of characters in image mode
49
-     * @param int     $maxfontsize    Maximum font-size of characters in image mode
50
-     * @param int     $backgroundtype Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files
51
-     * @param int     $backgroundnum  Number of background images in image mode
52
-     *
53
-     */
54
-    public function __construct($caption = '', $name = 'xoopscaptcha', $skipmember = null, $numchar = null, $minfontsize = null, $maxfontsize = null, $backgroundtype = null, $backgroundnum = null)
55
-    {
56
-        if (!class_exists('XoopsCaptcaha')) {
57
-            require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php';
58
-        }
43
+	/**
44
+	 * @param string  $caption        Caption of the form element, default value is defined in captcha/language/
45
+	 * @param string  $name           Name for the input box
46
+	 * @param boolean $skipmember     Skip CAPTCHA check for members
47
+	 * @param int     $numchar        Number of characters in image mode, and input box size for text mode
48
+	 * @param int     $minfontsize    Minimum font-size of characters in image mode
49
+	 * @param int     $maxfontsize    Maximum font-size of characters in image mode
50
+	 * @param int     $backgroundtype Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files
51
+	 * @param int     $backgroundnum  Number of background images in image mode
52
+	 *
53
+	 */
54
+	public function __construct($caption = '', $name = 'xoopscaptcha', $skipmember = null, $numchar = null, $minfontsize = null, $maxfontsize = null, $backgroundtype = null, $backgroundnum = null)
55
+	{
56
+		if (!class_exists('XoopsCaptcaha')) {
57
+			require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php';
58
+		}
59 59
 
60
-        $this->_captchaHandler = XoopsCaptcha::getInstance();
61
-        $this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum);
62
-        if (!$this->_captchaHandler->active) {
63
-            $this->setHidden();
64
-        } else {
65
-            $caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption();
66
-            $this->setCaption($caption);
67
-        }
68
-    }
60
+		$this->_captchaHandler = XoopsCaptcha::getInstance();
61
+		$this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum);
62
+		if (!$this->_captchaHandler->active) {
63
+			$this->setHidden();
64
+		} else {
65
+			$caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption();
66
+			$this->setCaption($caption);
67
+		}
68
+	}
69 69
 
70
-    /**
71
-     * @param $name
72
-     * @param $val
73
-     * @return bool
74
-     */
75
-    public function setConfig($name, $val)
76
-    {
77
-        return $this->_captchaHandler->setConfig($name, $val);
78
-    }
70
+	/**
71
+	 * @param $name
72
+	 * @param $val
73
+	 * @return bool
74
+	 */
75
+	public function setConfig($name, $val)
76
+	{
77
+		return $this->_captchaHandler->setConfig($name, $val);
78
+	}
79 79
 
80
-    /**
81
-     * @return mixed|string
82
-     */
83
-    public function render()
84
-    {
85
-        if (!$this->isHidden()) {
86
-            return $this->_captchaHandler->render();
87
-        }
88
-    }
80
+	/**
81
+	 * @return mixed|string
82
+	 */
83
+	public function render()
84
+	{
85
+		if (!$this->isHidden()) {
86
+			return $this->_captchaHandler->render();
87
+		}
88
+	}
89 89
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
15 15
 
16
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php';
16
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php';
17 17
 
18 18
 /*
19 19
  * Usage
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function __construct($caption = '', $name = 'xoopscaptcha', $skipmember = null, $numchar = null, $minfontsize = null, $maxfontsize = null, $backgroundtype = null, $backgroundnum = null)
55 55
     {
56 56
         if (!class_exists('XoopsCaptcaha')) {
57
-            require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php';
57
+            require_once SMARTOBJECT_ROOT_PATH.'/include/captcha/captcha.php';
58 58
         }
59 59
 
60 60
         $this->_captchaHandler = XoopsCaptcha::getInstance();
Please login to merge, or discard this patch.
include/captcha/captcha.php 2 patches
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -13,239 +13,239 @@
 block discarded – undo
13 13
  */
14 14
 class XoopsCaptcha
15 15
 {
16
-    public $active = true;
17
-    public $mode   = 'text';    // potential values: image, text
18
-    public $config = array();
19
-
20
-    public $message = array(); // Logging error messages
21
-
22
-    /**
23
-     * XoopsCaptcha constructor.
24
-     */
25
-    public function __construct()
26
-    {
27
-        // Loading default preferences
28
-        $this->config = @include __DIR__ . '/config.php';
29
-
30
-        $this->setMode($this->config['mode']);
31
-    }
32
-
33
-    /**
34
-     * @return XoopsCaptcha
35
-     */
36
-    public static function getInstance()
37
-    {
38
-        static $instance;
39
-        if (null === $instance) {
40
-            $instance = new static();
41
-        }
42
-
43
-        return $instance;
44
-    }
45
-
46
-    /**
47
-     * @param $name
48
-     * @param $val
49
-     * @return bool
50
-     */
51
-    public function setConfig($name, $val)
52
-    {
53
-        if ($name === 'mode') {
54
-            $this->setMode($val);
55
-        } elseif (isset($this->$name)) {
56
-            $this->$name = $val;
57
-        } else {
58
-            $this->config[$name] = $val;
59
-        }
60
-
61
-        return true;
62
-    }
63
-
64
-    /**
65
-     * Set CAPTCHA mode
66
-     *
67
-     * For future possible modes, right now force to use text or image
68
-     *
69
-     * @param string $mode if no mode is set, just verify current mode
70
-     */
71
-    public function setMode($mode = null)
72
-    {
73
-        if (!empty($mode) && in_array($mode, array('text', 'image'))) {
74
-            $this->mode = $mode;
75
-
76
-            if ($this->mode !== 'image') {
77
-                return;
78
-            }
79
-        }
80
-
81
-        // Disable image mode
82
-        if (!extension_loaded('gd')) {
83
-            $this->mode = 'text';
84
-        } else {
85
-            $required_functions = array('imagecreatetruecolor', 'imagecolorallocate', 'imagefilledrectangle', 'imagejpeg', 'imagedestroy', 'imageftbbox');
86
-            foreach ($required_functions as $func) {
87
-                if (!function_exists($func)) {
88
-                    $this->mode = 'text';
89
-                    break;
90
-                }
91
-            }
92
-        }
93
-    }
94
-
95
-    /**
96
-     * Initializing the CAPTCHA class
97
-     * @param string $name
98
-     * @param null   $skipmember
99
-     * @param null   $num_chars
100
-     * @param null   $fontsize_min
101
-     * @param null   $fontsize_max
102
-     * @param null   $background_type
103
-     * @param null   $background_num
104
-     */
105
-    public function init($name = 'xoopscaptcha', $skipmember = null, $num_chars = null, $fontsize_min = null, $fontsize_max = null, $background_type = null, $background_num = null)
106
-    {
107
-        // Loading RUN-TIME settings
108
-        foreach (array_keys($this->config) as $key) {
109
-            if (isset(${$key}) && ${$key} !== null) {
110
-                $this->config[$key] = ${$key};
111
-            }
112
-        }
113
-        $this->config['name'] = $name;
114
-
115
-        // Skip CAPTCHA for member if set
116
-        if ($this->config['skipmember'] && is_object($GLOBALS['xoopsUser'])) {
117
-            $this->active = false;
118
-        }
119
-    }
120
-
121
-    /**
122
-     * Verify user submission
123
-     * @param  null $skipMember
124
-     * @return bool
125
-     */
126
-    public function verify($skipMember = null)
127
-    {
128
-        $sessionName = @$_SESSION['XoopsCaptcha_name'];
129
-        $skipMember  = ($skipMember === null) ? @$_SESSION['XoopsCaptcha_skipmember'] : $skipMember;
130
-        $maxAttempts = (int)(@$_SESSION['XoopsCaptcha_maxattempts']);
131
-
132
-        $is_valid = false;
133
-
134
-        // Skip CAPTCHA for member if set
135
-        if (is_object($GLOBALS['xoopsUser']) && !empty($skipMember)) {
136
-            $is_valid = true;
137
-            // Kill too many attempts
138
-        } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_' . $sessionName] > $maxAttempts) {
139
-            $this->message[] = XOOPS_CAPTCHA_TOOMANYATTEMPTS;
140
-
141
-            // Verify the code
142
-        } elseif (!empty($_SESSION['XoopsCaptcha_sessioncode'])) {
143
-            $func     = $this->config['casesensitive'] ? 'strcmp' : 'strcasecmp';
144
-            $is_valid = !$func(trim(@$_POST[$sessionName]), $_SESSION['XoopsCaptcha_sessioncode']);
145
-        }
146
-
147
-        if (!empty($maxAttempts)) {
148
-            if (!$is_valid) {
149
-                // Increase the attempt records on failure
150
-                $_SESSION['XoopsCaptcha_attempt_' . $sessionName]++;
151
-                // Log the error message
152
-                $this->message[] = XOOPS_CAPTCHA_INVALID_CODE;
153
-            } else {
154
-
155
-                // reset attempt records on success
156
-                $_SESSION['XoopsCaptcha_attempt_' . $sessionName] = null;
157
-            }
158
-        }
159
-        $this->destroyGarbage(true);
160
-
161
-        return $is_valid;
162
-    }
163
-
164
-    /**
165
-     * @return mixed|string
166
-     */
167
-    public function getCaption()
168
-    {
169
-        return defined('XOOPS_CAPTCHA_CAPTION') ? constant('XOOPS_CAPTCHA_CAPTION') : '';
170
-    }
171
-
172
-    /**
173
-     * @return string
174
-     */
175
-    public function getMessage()
176
-    {
177
-        return implode('<br>', $this->message);
178
-    }
179
-
180
-    /**
181
-     * Destory historical stuff
182
-     * @param  bool $clearSession
183
-     * @return bool
184
-     */
185
-    public function destroyGarbage($clearSession = false)
186
-    {
187
-        require_once __DIR__ . '/' . $this->mode . '.php';
188
-        $class          = 'XoopsCaptcha' . ucfirst($this->mode);
189
-        $captchaHandler = new $class();
190
-        if (method_exists($captchaHandler, 'destroyGarbage')) {
191
-            $captchaHandler->loadConfig($this->config);
192
-            $captchaHandler->destroyGarbage();
193
-        }
194
-
195
-        if ($clearSession) {
196
-            $_SESSION['XoopsCaptcha_name']        = null;
197
-            $_SESSION['XoopsCaptcha_skipmember']  = null;
198
-            $_SESSION['XoopsCaptcha_sessioncode'] = null;
199
-            $_SESSION['XoopsCaptcha_maxattempts'] = null;
200
-        }
201
-
202
-        return true;
203
-    }
204
-
205
-    /**
206
-     * @return mixed|string
207
-     */
208
-    public function render()
209
-    {
210
-        $form = '';
211
-
212
-        if (!$this->active || empty($this->config['name'])) {
213
-            return $form;
214
-        }
215
-
216
-        $_SESSION['XoopsCaptcha_name']        = $this->config['name'];
217
-        $_SESSION['XoopsCaptcha_skipmember']  = $this->config['skipmember'];
218
-        $maxAttempts                          = $this->config['maxattempt'];
219
-        $_SESSION['XoopsCaptcha_maxattempts'] = $maxAttempts;
220
-        /*
16
+	public $active = true;
17
+	public $mode   = 'text';    // potential values: image, text
18
+	public $config = array();
19
+
20
+	public $message = array(); // Logging error messages
21
+
22
+	/**
23
+	 * XoopsCaptcha constructor.
24
+	 */
25
+	public function __construct()
26
+	{
27
+		// Loading default preferences
28
+		$this->config = @include __DIR__ . '/config.php';
29
+
30
+		$this->setMode($this->config['mode']);
31
+	}
32
+
33
+	/**
34
+	 * @return XoopsCaptcha
35
+	 */
36
+	public static function getInstance()
37
+	{
38
+		static $instance;
39
+		if (null === $instance) {
40
+			$instance = new static();
41
+		}
42
+
43
+		return $instance;
44
+	}
45
+
46
+	/**
47
+	 * @param $name
48
+	 * @param $val
49
+	 * @return bool
50
+	 */
51
+	public function setConfig($name, $val)
52
+	{
53
+		if ($name === 'mode') {
54
+			$this->setMode($val);
55
+		} elseif (isset($this->$name)) {
56
+			$this->$name = $val;
57
+		} else {
58
+			$this->config[$name] = $val;
59
+		}
60
+
61
+		return true;
62
+	}
63
+
64
+	/**
65
+	 * Set CAPTCHA mode
66
+	 *
67
+	 * For future possible modes, right now force to use text or image
68
+	 *
69
+	 * @param string $mode if no mode is set, just verify current mode
70
+	 */
71
+	public function setMode($mode = null)
72
+	{
73
+		if (!empty($mode) && in_array($mode, array('text', 'image'))) {
74
+			$this->mode = $mode;
75
+
76
+			if ($this->mode !== 'image') {
77
+				return;
78
+			}
79
+		}
80
+
81
+		// Disable image mode
82
+		if (!extension_loaded('gd')) {
83
+			$this->mode = 'text';
84
+		} else {
85
+			$required_functions = array('imagecreatetruecolor', 'imagecolorallocate', 'imagefilledrectangle', 'imagejpeg', 'imagedestroy', 'imageftbbox');
86
+			foreach ($required_functions as $func) {
87
+				if (!function_exists($func)) {
88
+					$this->mode = 'text';
89
+					break;
90
+				}
91
+			}
92
+		}
93
+	}
94
+
95
+	/**
96
+	 * Initializing the CAPTCHA class
97
+	 * @param string $name
98
+	 * @param null   $skipmember
99
+	 * @param null   $num_chars
100
+	 * @param null   $fontsize_min
101
+	 * @param null   $fontsize_max
102
+	 * @param null   $background_type
103
+	 * @param null   $background_num
104
+	 */
105
+	public function init($name = 'xoopscaptcha', $skipmember = null, $num_chars = null, $fontsize_min = null, $fontsize_max = null, $background_type = null, $background_num = null)
106
+	{
107
+		// Loading RUN-TIME settings
108
+		foreach (array_keys($this->config) as $key) {
109
+			if (isset(${$key}) && ${$key} !== null) {
110
+				$this->config[$key] = ${$key};
111
+			}
112
+		}
113
+		$this->config['name'] = $name;
114
+
115
+		// Skip CAPTCHA for member if set
116
+		if ($this->config['skipmember'] && is_object($GLOBALS['xoopsUser'])) {
117
+			$this->active = false;
118
+		}
119
+	}
120
+
121
+	/**
122
+	 * Verify user submission
123
+	 * @param  null $skipMember
124
+	 * @return bool
125
+	 */
126
+	public function verify($skipMember = null)
127
+	{
128
+		$sessionName = @$_SESSION['XoopsCaptcha_name'];
129
+		$skipMember  = ($skipMember === null) ? @$_SESSION['XoopsCaptcha_skipmember'] : $skipMember;
130
+		$maxAttempts = (int)(@$_SESSION['XoopsCaptcha_maxattempts']);
131
+
132
+		$is_valid = false;
133
+
134
+		// Skip CAPTCHA for member if set
135
+		if (is_object($GLOBALS['xoopsUser']) && !empty($skipMember)) {
136
+			$is_valid = true;
137
+			// Kill too many attempts
138
+		} elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_' . $sessionName] > $maxAttempts) {
139
+			$this->message[] = XOOPS_CAPTCHA_TOOMANYATTEMPTS;
140
+
141
+			// Verify the code
142
+		} elseif (!empty($_SESSION['XoopsCaptcha_sessioncode'])) {
143
+			$func     = $this->config['casesensitive'] ? 'strcmp' : 'strcasecmp';
144
+			$is_valid = !$func(trim(@$_POST[$sessionName]), $_SESSION['XoopsCaptcha_sessioncode']);
145
+		}
146
+
147
+		if (!empty($maxAttempts)) {
148
+			if (!$is_valid) {
149
+				// Increase the attempt records on failure
150
+				$_SESSION['XoopsCaptcha_attempt_' . $sessionName]++;
151
+				// Log the error message
152
+				$this->message[] = XOOPS_CAPTCHA_INVALID_CODE;
153
+			} else {
154
+
155
+				// reset attempt records on success
156
+				$_SESSION['XoopsCaptcha_attempt_' . $sessionName] = null;
157
+			}
158
+		}
159
+		$this->destroyGarbage(true);
160
+
161
+		return $is_valid;
162
+	}
163
+
164
+	/**
165
+	 * @return mixed|string
166
+	 */
167
+	public function getCaption()
168
+	{
169
+		return defined('XOOPS_CAPTCHA_CAPTION') ? constant('XOOPS_CAPTCHA_CAPTION') : '';
170
+	}
171
+
172
+	/**
173
+	 * @return string
174
+	 */
175
+	public function getMessage()
176
+	{
177
+		return implode('<br>', $this->message);
178
+	}
179
+
180
+	/**
181
+	 * Destory historical stuff
182
+	 * @param  bool $clearSession
183
+	 * @return bool
184
+	 */
185
+	public function destroyGarbage($clearSession = false)
186
+	{
187
+		require_once __DIR__ . '/' . $this->mode . '.php';
188
+		$class          = 'XoopsCaptcha' . ucfirst($this->mode);
189
+		$captchaHandler = new $class();
190
+		if (method_exists($captchaHandler, 'destroyGarbage')) {
191
+			$captchaHandler->loadConfig($this->config);
192
+			$captchaHandler->destroyGarbage();
193
+		}
194
+
195
+		if ($clearSession) {
196
+			$_SESSION['XoopsCaptcha_name']        = null;
197
+			$_SESSION['XoopsCaptcha_skipmember']  = null;
198
+			$_SESSION['XoopsCaptcha_sessioncode'] = null;
199
+			$_SESSION['XoopsCaptcha_maxattempts'] = null;
200
+		}
201
+
202
+		return true;
203
+	}
204
+
205
+	/**
206
+	 * @return mixed|string
207
+	 */
208
+	public function render()
209
+	{
210
+		$form = '';
211
+
212
+		if (!$this->active || empty($this->config['name'])) {
213
+			return $form;
214
+		}
215
+
216
+		$_SESSION['XoopsCaptcha_name']        = $this->config['name'];
217
+		$_SESSION['XoopsCaptcha_skipmember']  = $this->config['skipmember'];
218
+		$maxAttempts                          = $this->config['maxattempt'];
219
+		$_SESSION['XoopsCaptcha_maxattempts'] = $maxAttempts;
220
+		/*
221 221
          if (!empty($maxAttempts)) {
222 222
          $_SESSION['XoopsCaptcha_maxattempts_'.$_SESSION['XoopsCaptcha_name']] = $maxAttempts;
223 223
          }
224 224
          */
225 225
 
226
-        // Fail on too many attempts
227
-        if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_' . $this->config['name']] > $maxAttempts) {
228
-            $form = XOOPS_CAPTCHA_TOOMANYATTEMPTS;
229
-            // Load the form element
230
-        } else {
231
-            $form = $this->loadForm();
232
-        }
233
-
234
-        return $form;
235
-    }
236
-
237
-    /**
238
-     * @return mixed
239
-     */
240
-    public function loadForm()
241
-    {
242
-        require_once __DIR__ . '/' . $this->mode . '.php';
243
-        $class          = 'XoopsCaptcha' . ucfirst($this->mode);
244
-        $captchaHandler = new $class();
245
-        $captchaHandler->loadConfig($this->config);
246
-
247
-        $form = $captchaHandler->render();
248
-
249
-        return $form;
250
-    }
226
+		// Fail on too many attempts
227
+		if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_' . $this->config['name']] > $maxAttempts) {
228
+			$form = XOOPS_CAPTCHA_TOOMANYATTEMPTS;
229
+			// Load the form element
230
+		} else {
231
+			$form = $this->loadForm();
232
+		}
233
+
234
+		return $form;
235
+	}
236
+
237
+	/**
238
+	 * @return mixed
239
+	 */
240
+	public function loadForm()
241
+	{
242
+		require_once __DIR__ . '/' . $this->mode . '.php';
243
+		$class          = 'XoopsCaptcha' . ucfirst($this->mode);
244
+		$captchaHandler = new $class();
245
+		$captchaHandler->loadConfig($this->config);
246
+
247
+		$form = $captchaHandler->render();
248
+
249
+		return $form;
250
+	}
251 251
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 class XoopsCaptcha
15 15
 {
16 16
     public $active = true;
17
-    public $mode   = 'text';    // potential values: image, text
17
+    public $mode   = 'text'; // potential values: image, text
18 18
     public $config = array();
19 19
 
20 20
     public $message = array(); // Logging error messages
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function __construct()
26 26
     {
27 27
         // Loading default preferences
28
-        $this->config = @include __DIR__ . '/config.php';
28
+        $this->config = @include __DIR__.'/config.php';
29 29
 
30 30
         $this->setMode($this->config['mode']);
31 31
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $sessionName = @$_SESSION['XoopsCaptcha_name'];
129 129
         $skipMember  = ($skipMember === null) ? @$_SESSION['XoopsCaptcha_skipmember'] : $skipMember;
130
-        $maxAttempts = (int)(@$_SESSION['XoopsCaptcha_maxattempts']);
130
+        $maxAttempts = (int) (@$_SESSION['XoopsCaptcha_maxattempts']);
131 131
 
132 132
         $is_valid = false;
133 133
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         if (is_object($GLOBALS['xoopsUser']) && !empty($skipMember)) {
136 136
             $is_valid = true;
137 137
             // Kill too many attempts
138
-        } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_' . $sessionName] > $maxAttempts) {
138
+        } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_'.$sessionName] > $maxAttempts) {
139 139
             $this->message[] = XOOPS_CAPTCHA_TOOMANYATTEMPTS;
140 140
 
141 141
             // Verify the code
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
         if (!empty($maxAttempts)) {
148 148
             if (!$is_valid) {
149 149
                 // Increase the attempt records on failure
150
-                $_SESSION['XoopsCaptcha_attempt_' . $sessionName]++;
150
+                $_SESSION['XoopsCaptcha_attempt_'.$sessionName]++;
151 151
                 // Log the error message
152 152
                 $this->message[] = XOOPS_CAPTCHA_INVALID_CODE;
153 153
             } else {
154 154
 
155 155
                 // reset attempt records on success
156
-                $_SESSION['XoopsCaptcha_attempt_' . $sessionName] = null;
156
+                $_SESSION['XoopsCaptcha_attempt_'.$sessionName] = null;
157 157
             }
158 158
         }
159 159
         $this->destroyGarbage(true);
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function destroyGarbage($clearSession = false)
186 186
     {
187
-        require_once __DIR__ . '/' . $this->mode . '.php';
188
-        $class          = 'XoopsCaptcha' . ucfirst($this->mode);
187
+        require_once __DIR__.'/'.$this->mode.'.php';
188
+        $class          = 'XoopsCaptcha'.ucfirst($this->mode);
189 189
         $captchaHandler = new $class();
190 190
         if (method_exists($captchaHandler, 'destroyGarbage')) {
191 191
             $captchaHandler->loadConfig($this->config);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
          */
225 225
 
226 226
         // Fail on too many attempts
227
-        if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_' . $this->config['name']] > $maxAttempts) {
227
+        if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_'.$this->config['name']] > $maxAttempts) {
228 228
             $form = XOOPS_CAPTCHA_TOOMANYATTEMPTS;
229 229
             // Load the form element
230 230
         } else {
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
      */
240 240
     public function loadForm()
241 241
     {
242
-        require_once __DIR__ . '/' . $this->mode . '.php';
243
-        $class          = 'XoopsCaptcha' . ucfirst($this->mode);
242
+        require_once __DIR__.'/'.$this->mode.'.php';
243
+        $class          = 'XoopsCaptcha'.ucfirst($this->mode);
244 244
         $captchaHandler = new $class();
245 245
         $captchaHandler->loadConfig($this->config);
246 246
 
Please login to merge, or discard this patch.
include/captcha/image.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -7,82 +7,82 @@
 block discarded – undo
7 7
  */
8 8
 class XoopsCaptchaImage
9 9
 {
10
-    public $config = array();
10
+	public $config = array();
11 11
 
12
-    /**
13
-     * XoopsCaptchaImage constructor.
14
-     */
15
-    public function __construct()
16
-    {
17
-        //$this->name = md5( session_id() );
18
-    }
12
+	/**
13
+	 * XoopsCaptchaImage constructor.
14
+	 */
15
+	public function __construct()
16
+	{
17
+		//$this->name = md5( session_id() );
18
+	}
19 19
 
20
-    /**
21
-     * @return XoopsCaptchaImage
22
-     */
23
-    public static function getInstance()
24
-    {
25
-        static $instance;
26
-        if (null === $instance) {
27
-            $instance = new static();
28
-        }
20
+	/**
21
+	 * @return XoopsCaptchaImage
22
+	 */
23
+	public static function getInstance()
24
+	{
25
+		static $instance;
26
+		if (null === $instance) {
27
+			$instance = new static();
28
+		}
29 29
 
30
-        return $instance;
31
-    }
30
+		return $instance;
31
+	}
32 32
 
33
-    /**
34
-     * Loading configs from CAPTCHA class
35
-     * @param array $config
36
-     */
37
-    public function loadConfig($config = array())
38
-    {
39
-        // Loading default preferences
40
-        $this->config = $config;
41
-    }
33
+	/**
34
+	 * Loading configs from CAPTCHA class
35
+	 * @param array $config
36
+	 */
37
+	public function loadConfig($config = array())
38
+	{
39
+		// Loading default preferences
40
+		$this->config = $config;
41
+	}
42 42
 
43
-    /**
44
-     * @return string
45
-     */
46
-    public function render()
47
-    {
48
-        $form = "<input type='text' name='" .
49
-                $this->config['name'] .
50
-                "' id='" .
51
-                $this->config['name'] .
52
-                "' size='" .
53
-                $this->config['num_chars'] .
54
-                "' maxlength='" .
55
-                $this->config['num_chars'] .
56
-                "' value='' /> &nbsp; " .
57
-                $this->loadImage();
58
-        $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES);
59
-        if ($this->config['maxattempt']) {
60
-            $rule .= ' | ' . sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']);
61
-        }
62
-        $form .= "&nbsp;&nbsp;<small>{$rule}</small>";
43
+	/**
44
+	 * @return string
45
+	 */
46
+	public function render()
47
+	{
48
+		$form = "<input type='text' name='" .
49
+				$this->config['name'] .
50
+				"' id='" .
51
+				$this->config['name'] .
52
+				"' size='" .
53
+				$this->config['num_chars'] .
54
+				"' maxlength='" .
55
+				$this->config['num_chars'] .
56
+				"' value='' /> &nbsp; " .
57
+				$this->loadImage();
58
+		$rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES);
59
+		if ($this->config['maxattempt']) {
60
+			$rule .= ' | ' . sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']);
61
+		}
62
+		$form .= "&nbsp;&nbsp;<small>{$rule}</small>";
63 63
 
64
-        return $form;
65
-    }
64
+		return $form;
65
+	}
66 66
 
67
-    /**
68
-     * @return string
69
-     */
70
-    public function loadImage()
71
-    {
72
-        $rule = $this->config['casesensitive'] ? constant('XOOPS_CAPTCHA_RULE_CASESENSITIVE') : constant('XOOPS_CAPTCHA_RULE_CASEINSENSITIVE');
73
-        $ret  = "<img id='captcha' src='" .
74
-                XOOPS_URL .
75
-                '/' .
76
-                $this->config['imageurl'] .
77
-                "' onclick=\"this.src='" .
78
-                XOOPS_URL .
79
-                '/' .
80
-                $this->config['imageurl'] .
81
-                "?refresh='+Math.random()" .
82
-                "\" align='absmiddle'  style='cursor: pointer;' alt='" .
83
-                htmlspecialchars($rule, ENT_QUOTES) .
84
-                "' />";
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function loadImage()
71
+	{
72
+		$rule = $this->config['casesensitive'] ? constant('XOOPS_CAPTCHA_RULE_CASESENSITIVE') : constant('XOOPS_CAPTCHA_RULE_CASEINSENSITIVE');
73
+		$ret  = "<img id='captcha' src='" .
74
+				XOOPS_URL .
75
+				'/' .
76
+				$this->config['imageurl'] .
77
+				"' onclick=\"this.src='" .
78
+				XOOPS_URL .
79
+				'/' .
80
+				$this->config['imageurl'] .
81
+				"?refresh='+Math.random()" .
82
+				"\" align='absmiddle'  style='cursor: pointer;' alt='" .
83
+				htmlspecialchars($rule, ENT_QUOTES) .
84
+				"' />";
85 85
 
86
-        return $ret;
87
-    }
86
+		return $ret;
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function render()
47 47
     {
48
-        $form = "<input type='text' name='" .
49
-                $this->config['name'] .
50
-                "' id='" .
51
-                $this->config['name'] .
52
-                "' size='" .
53
-                $this->config['num_chars'] .
54
-                "' maxlength='" .
55
-                $this->config['num_chars'] .
56
-                "' value='' /> &nbsp; " .
48
+        $form = "<input type='text' name='".
49
+                $this->config['name'].
50
+                "' id='".
51
+                $this->config['name'].
52
+                "' size='".
53
+                $this->config['num_chars'].
54
+                "' maxlength='".
55
+                $this->config['num_chars'].
56
+                "' value='' /> &nbsp; ".
57 57
                 $this->loadImage();
58 58
         $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES);
59 59
         if ($this->config['maxattempt']) {
60
-            $rule .= ' | ' . sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']);
60
+            $rule .= ' | '.sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']);
61 61
         }
62 62
         $form .= "&nbsp;&nbsp;<small>{$rule}</small>";
63 63
 
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
     public function loadImage()
71 71
     {
72 72
         $rule = $this->config['casesensitive'] ? constant('XOOPS_CAPTCHA_RULE_CASESENSITIVE') : constant('XOOPS_CAPTCHA_RULE_CASEINSENSITIVE');
73
-        $ret  = "<img id='captcha' src='" .
74
-                XOOPS_URL .
75
-                '/' .
76
-                $this->config['imageurl'] .
77
-                "' onclick=\"this.src='" .
78
-                XOOPS_URL .
79
-                '/' .
80
-                $this->config['imageurl'] .
81
-                "?refresh='+Math.random()" .
82
-                "\" align='absmiddle'  style='cursor: pointer;' alt='" .
83
-                htmlspecialchars($rule, ENT_QUOTES) .
73
+        $ret  = "<img id='captcha' src='".
74
+                XOOPS_URL.
75
+                '/'.
76
+                $this->config['imageurl'].
77
+                "' onclick=\"this.src='".
78
+                XOOPS_URL.
79
+                '/'.
80
+                $this->config['imageurl'].
81
+                "?refresh='+Math.random()".
82
+                "\" align='absmiddle'  style='cursor: pointer;' alt='".
83
+                htmlspecialchars($rule, ENT_QUOTES).
84 84
                 "' />";
85 85
 
86 86
         return $ret;
Please login to merge, or discard this patch.
include/xoops_core_common_functions.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function xoops_debug_dumbQuery($msg = '')
16 16
 {
17
-    global $xoopsDB;
18
-    $xoopsDB->query('SELECT * ' . $msg . ' FROM dudewhereismycar2');
17
+	global $xoopsDB;
18
+	$xoopsDB->query('SELECT * ' . $msg . ' FROM dudewhereismycar2');
19 19
 }
20 20
 
21 21
 function xoops_debug_initiateQueryCount()
22 22
 {
23
-    global $smartfactory_query_count_activated, $smartfactory_query_count;
24
-    $smartfactory_query_count_activated = true;
25
-    $smartfactory_query_count           = 0;
23
+	global $smartfactory_query_count_activated, $smartfactory_query_count;
24
+	$smartfactory_query_count_activated = true;
25
+	$smartfactory_query_count           = 0;
26 26
 }
27 27
 
28 28
 /**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function xoops_debug_getQueryCount($msg = '')
32 32
 {
33
-    global $smartfactory_query_count;
33
+	global $smartfactory_query_count;
34 34
 
35
-    return xoops_debug("xoops debug Query count ($msg): $smartfactory_query_count");
35
+	return xoops_debug("xoops debug Query count ($msg): $smartfactory_query_count");
36 36
 }
37 37
 
38 38
 /**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function xoops_debug($msg, $exit = false)
43 43
 {
44
-    echo "<div style='padding: 5px; color: red; font-weight: bold;'>debug:: $msg</div>";
45
-    if ($exit) {
46
-        die();
47
-    }
44
+	echo "<div style='padding: 5px; color: red; font-weight: bold;'>debug:: $msg</div>";
45
+	if ($exit) {
46
+		die();
47
+	}
48 48
 }
49 49
 
50 50
 /**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function xoops_comment($msg)
54 54
 {
55
-    echo "<div style='padding: 5px; color: green; font-weight: bold;'>=> $msg</div>";
55
+	echo "<div style='padding: 5px; color: green; font-weight: bold;'>=> $msg</div>";
56 56
 }
57 57
 
58 58
 /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function xoops_debug_vardump($var)
62 62
 {
63
-    if (class_exists('MyTextSanitizer')) {
64
-        $myts = MyTextSanitizer::getInstance();
65
-        xoops_debug($myts->displayTarea(var_export($var, true)));
66
-    } else {
67
-        xoops_debug(var_export($var, true));
68
-    }
63
+	if (class_exists('MyTextSanitizer')) {
64
+		$myts = MyTextSanitizer::getInstance();
65
+		xoops_debug($myts->displayTarea(var_export($var, true)));
66
+	} else {
67
+		xoops_debug(var_export($var, true));
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 function xoops_debug_dumbQuery($msg = '')
16 16
 {
17 17
     global $xoopsDB;
18
-    $xoopsDB->query('SELECT * ' . $msg . ' FROM dudewhereismycar2');
18
+    $xoopsDB->query('SELECT * '.$msg.' FROM dudewhereismycar2');
19 19
 }
20 20
 
21 21
 function xoops_debug_initiateQueryCount()
Please login to merge, or discard this patch.
blocks/addto.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function smartobject_addto_show($options)
10 10
 {
11
-    include_once(XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php');
12
-    include_once(SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php');
13
-    $smartaddto = new SmartAddTo($options[0]);
14
-    $block      = $smartaddto->renderForBlock();
11
+	include_once(XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php');
12
+	include_once(SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php');
13
+	$smartaddto = new SmartAddTo($options[0]);
14
+	$block      = $smartaddto->renderForBlock();
15 15
 
16
-    return $block;
16
+	return $block;
17 17
 }
18 18
 
19 19
 /**
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function smartobject_addto_edit($options)
24 24
 {
25
-    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
25
+	include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
26 26
 
27
-    $form = '';
27
+	$form = '';
28 28
 
29
-    $layout_select = new XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]);
30
-    $layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0);
31
-    $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1);
32
-    $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2);
33
-    $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3);
34
-    $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>';
29
+	$layout_select = new XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]);
30
+	$layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0);
31
+	$layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1);
32
+	$layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2);
33
+	$layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3);
34
+	$form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>';
35 35
 
36
-    return $form;
36
+	return $form;
37 37
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function smartobject_addto_show($options)
10 10
 {
11
-    include_once(XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php');
12
-    include_once(SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php');
11
+    include_once(XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php');
12
+    include_once(SMARTOBJECT_ROOT_PATH.'class/smartaddto.php');
13 13
     $smartaddto = new SmartAddTo($options[0]);
14 14
     $block      = $smartaddto->renderForBlock();
15 15
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function smartobject_addto_edit($options)
24 24
 {
25
-    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
25
+    include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
26 26
 
27 27
     $form = '';
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1);
32 32
     $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2);
33 33
     $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3);
34
-    $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>';
34
+    $form .= $layout_select->getCaption().' '.$layout_select->render().'<br>';
35 35
 
36 36
     return $form;
37 37
 }
Please login to merge, or discard this patch.
language/english/modinfo.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,4 +24,4 @@
 block discarded – undo
24 24
 
25 25
 define('_MI_SOBJECT_ADMFOOTER', 'Enabling admin footer for SmartModules');
26 26
 define('_MI_SOBJECT_ADMFOOTERDSC',
27
-       'By default SmartModules displays a footer in administrative pages to link on professionnal services available for this module. You can turn off the display of this footer here.');
27
+	   'By default SmartModules displays a footer in administrative pages to link on professionnal services available for this module. You can turn off the display of this footer here.');
Please login to merge, or discard this patch.
language/english/common.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 define('_CO_SOBJECT_MAKE_SELECTION', 'Make a selection...');
103 103
 define('_CO_SOBJECT_META_DESCRIPTION', 'Meta Description');
104 104
 define('_CO_SOBJECT_META_DESCRIPTION_DSC',
105
-       'In order to help Search Engines, you can customize the meta description you would like to use for this article. If you leave this field empty when creating a category, it will automatically be populated with the Summary field of this article.');
105
+	   'In order to help Search Engines, you can customize the meta description you would like to use for this article. If you leave this field empty when creating a category, it will automatically be populated with the Summary field of this article.');
106 106
 define('_CO_SOBJECT_META_KEYWORDS', 'Meta Keywords');
107 107
 define('_CO_SOBJECT_META_KEYWORDS_DSC',
108
-       'In order to help Search Engines, you can customize the keywords you would like to use for this article. If you leave this field empty when creating an article, it will automatically be populated with words from the Summary field of this article.');
108
+	   'In order to help Search Engines, you can customize the keywords you would like to use for this article. If you leave this field empty when creating an article, it will automatically be populated with words from the Summary field of this article.');
109 109
 define('_CO_SOBJECT_MODIFY', 'Edit');
110 110
 define('_CO_SOBJECT_MODULE_BUG', 'Report a bug for this module');
111 111
 define('_CO_SOBJECT_MODULE_DEMO', 'Demo Site');
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 define('_CO_SOBJECT_UPLOAD_IMAGE', 'Upload a new image:');
155 155
 define('_CO_SOBJECT_VERSION_HISTORY', 'Version History');
156 156
 define('_CO_SOBJECT_WARNING_BETA',
157
-       'This module comes as is, without any guarantees whatsoever. This module is BETA, meaning it is still under active development. This release is meant for <b>testing purposes only</b> and we <b>strongly</b> recommend that you do not use it on a live website or in a production environment.');
157
+	   'This module comes as is, without any guarantees whatsoever. This module is BETA, meaning it is still under active development. This release is meant for <b>testing purposes only</b> and we <b>strongly</b> recommend that you do not use it on a live website or in a production environment.');
158 158
 define('_CO_SOBJECT_WARNING_FINAL',
159
-       'This module comes as is, without any guarantees whatsoever. Although this module is not beta, it is still under active development. This release can be used in a live website or a production environment, but its use is under your own responsibility, which means the author is not responsible.');
159
+	   'This module comes as is, without any guarantees whatsoever. Although this module is not beta, it is still under active development. This release can be used in a live website or a production environment, but its use is under your own responsibility, which means the author is not responsible.');
160 160
 define('_CO_SOBJECT_WARNING_RC',
161
-       'This module comes as is, without any guarantees whatsoever. This module is a Release Candidate and should not be used on a production web site. The module is still under active development and its use is under your own responsibility, which means the author is not responsible.');
161
+	   'This module comes as is, without any guarantees whatsoever. This module is a Release Candidate and should not be used on a production web site. The module is still under active development and its use is under your own responsibility, which means the author is not responsible.');
162 162
 define('_CO_SOBJECT_WEIGHT_FORM_CAPTION', 'Weight');
163 163
 define('_CO_SOBJECT_WEIGHT_FORM_DSC', '');
164 164
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@
 block discarded – undo
178 178
 define('_CO_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2', 'Vertical with icons');
179 179
 define('_CO_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3', 'Vertical no icon');
180 180
 define('_CO_SOBJECT_CURRENT_FILE', 'Current file: ');
181
-define('_CO_SOBJECT_URL_FILE_DSC', "Alternatively, you can use an URL. If you select a file via 'Browse' button, URL will be ignored. You can use the tag {XOOPS_URL} to print " . XOOPS_URL);
181
+define('_CO_SOBJECT_URL_FILE_DSC', "Alternatively, you can use an URL. If you select a file via 'Browse' button, URL will be ignored. You can use the tag {XOOPS_URL} to print ".XOOPS_URL);
182 182
 define('_CO_SOBJECT_URL_FILE', 'URL: ');
183 183
 define('_CO_SOBJECT_UPLOAD', 'Select a file to upload: ');
184 184
 
Please login to merge, or discard this patch.
language/english/smartdbupdater.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 define('_SDU_MSG_NEWFIELD', 'Successfully added field %s');
21 21
 define('_SDU_MSG_NEWFIELD_ERR', 'Error adding field %s');
22 22
 define('_SDU_NEEDUPDATE',
23
-       'Your database is out-of-date. Please upgrade your database tables!<br><b>Note: The SmartFactory strongly recommends you to backup all SmartSection tables before running this upgrade script.</b><br>');
23
+	   'Your database is out-of-date. Please upgrade your database tables!<br><b>Note: The SmartFactory strongly recommends you to backup all SmartSection tables before running this upgrade script.</b><br>');
24 24
 define('_SDU_NOUPDATE', 'Your database is up-to-date. No updates are necessary.');
25 25
 define('_SDU_UPDATE_DB', 'Updating Database');
26 26
 define('_SDU_UPDATE_ERR', 'Errors updating to version %s');
Please login to merge, or discard this patch.
sendlink.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -26,82 +26,82 @@
 block discarded – undo
26 26
 $op = isset($_POST['op']) ? $_POST['op'] : '';
27 27
 
28 28
 switch ($op) {
29
-    case 'sendlink':
30
-
31
-        include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
32
-        $controller = new SmartObjectController($smartobjectLinkHandler);
33
-
34
-        $linkObj = $controller->storeSmartObject();
35
-        if ($linkObj->hasError()) {
36
-            /**
37
-             * @todo inform user and propose to close the window if a problem occured when saving the link
38
-             */
39
-        }
40
-
41
-        $xoopsMailer =& getMailer();
42
-        $xoopsMailer->useMail();
43
-        $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template');
44
-
45
-        $xoopsMailer->setTemplate('sendlink.tpl');
46
-        $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
47
-        $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name'));
48
-        $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name'));
49
-        $xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
50
-        $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
51
-        $xoopsMailer->assign('MESSAGE', $_POST['body']);
52
-        $xoopsMailer->setToEmails($linkObj->getVar('to_email'));
53
-        $xoopsMailer->setFromEmail($linkObj->getVar('from_email'));
54
-        $xoopsMailer->setFromName($xoopsConfig['sitename']);
55
-        $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename'])));
56
-
57
-        if (!$xoopsMailer->send(true)) {
58
-            $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true));
59
-        } else {
60
-            $xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS);
61
-        }
62
-
63
-        break;
64
-
65
-    default:
66
-        if (isset($_GET['mid'])) {
67
-            $mid = $_GET['mid'];
68
-        } else {
69
-            /**
70
-             * @todo close the window if no mid is passed as GET
71
-             */
72
-        }
73
-
74
-        $hModule = xoops_getHandler('module');
75
-        $module  = $hModule->get($mid);
76
-        $linkObj->setVar('mid', $module->getVar('mid'));
77
-        $linkObj->setVar('mid_name', $module->getVar('name'));
78
-
79
-        if (isset($_GET['link'])) {
80
-            $link = $_GET['link'];
81
-        } else {
82
-            /**
83
-             * @todo close the window if no link is passed as GET
84
-             */
85
-        }
86
-        $linkObj->setVar('link', $link);
87
-
88
-        if (is_object($xoopsUser)) {
89
-            $linkObj->setVar('from_uid', $xoopsUser->getVar('uid'));
90
-            $linkObj->setVar('from_name', $xoopsUser->getVar('name') !== '' ? $xoopsUser->getVar('name') : $xoopsUser->getVar('uname'));
91
-            $linkObj->setVar('from_email', $xoopsUser->getVar('email'));
92
-        }
93
-
94
-        $linkObj->setVar('subject', sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $xoopsConfig['sitename']));
95
-        $linkObj->setVar('body', sprintf(_CO_SOBJECT_BODY_DEFAULT, $xoopsConfig['sitename'], $link));
96
-        $linkObj->setVar('date', time());
97
-        $linkObj->hideFieldFromForm(array('from_uid', 'to_uid', 'link', 'mid', 'mid_name'));
98
-
99
-        $form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();');
100
-
101
-        $form->assign($xoopsTpl);
102
-
103
-        $xoopsTpl->assign('showform', true);
104
-        break;
29
+	case 'sendlink':
30
+
31
+		include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
32
+		$controller = new SmartObjectController($smartobjectLinkHandler);
33
+
34
+		$linkObj = $controller->storeSmartObject();
35
+		if ($linkObj->hasError()) {
36
+			/**
37
+			 * @todo inform user and propose to close the window if a problem occured when saving the link
38
+			 */
39
+		}
40
+
41
+		$xoopsMailer =& getMailer();
42
+		$xoopsMailer->useMail();
43
+		$xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template');
44
+
45
+		$xoopsMailer->setTemplate('sendlink.tpl');
46
+		$xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
47
+		$xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name'));
48
+		$xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name'));
49
+		$xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
50
+		$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
51
+		$xoopsMailer->assign('MESSAGE', $_POST['body']);
52
+		$xoopsMailer->setToEmails($linkObj->getVar('to_email'));
53
+		$xoopsMailer->setFromEmail($linkObj->getVar('from_email'));
54
+		$xoopsMailer->setFromName($xoopsConfig['sitename']);
55
+		$xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename'])));
56
+
57
+		if (!$xoopsMailer->send(true)) {
58
+			$xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true));
59
+		} else {
60
+			$xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS);
61
+		}
62
+
63
+		break;
64
+
65
+	default:
66
+		if (isset($_GET['mid'])) {
67
+			$mid = $_GET['mid'];
68
+		} else {
69
+			/**
70
+			 * @todo close the window if no mid is passed as GET
71
+			 */
72
+		}
73
+
74
+		$hModule = xoops_getHandler('module');
75
+		$module  = $hModule->get($mid);
76
+		$linkObj->setVar('mid', $module->getVar('mid'));
77
+		$linkObj->setVar('mid_name', $module->getVar('name'));
78
+
79
+		if (isset($_GET['link'])) {
80
+			$link = $_GET['link'];
81
+		} else {
82
+			/**
83
+			 * @todo close the window if no link is passed as GET
84
+			 */
85
+		}
86
+		$linkObj->setVar('link', $link);
87
+
88
+		if (is_object($xoopsUser)) {
89
+			$linkObj->setVar('from_uid', $xoopsUser->getVar('uid'));
90
+			$linkObj->setVar('from_name', $xoopsUser->getVar('name') !== '' ? $xoopsUser->getVar('name') : $xoopsUser->getVar('uname'));
91
+			$linkObj->setVar('from_email', $xoopsUser->getVar('email'));
92
+		}
93
+
94
+		$linkObj->setVar('subject', sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $xoopsConfig['sitename']));
95
+		$linkObj->setVar('body', sprintf(_CO_SOBJECT_BODY_DEFAULT, $xoopsConfig['sitename'], $link));
96
+		$linkObj->setVar('date', time());
97
+		$linkObj->hideFieldFromForm(array('from_uid', 'to_uid', 'link', 'mid', 'mid_name'));
98
+
99
+		$form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();');
100
+
101
+		$form->assign($xoopsTpl);
102
+
103
+		$xoopsTpl->assign('showform', true);
104
+		break;
105 105
 }
106 106
 
107 107
 $xoopsTpl->display('db:smartobject_sendlink.html');
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * Licence: GNU
8 8
  */
9 9
 
10
-include_once __DIR__ . '/header.php';
11
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartloader.php';
12
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectlink.php';
13
-require_once XOOPS_ROOT_PATH . '/class/template.php';
10
+include_once __DIR__.'/header.php';
11
+require_once SMARTOBJECT_ROOT_PATH.'class/smartloader.php';
12
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectlink.php';
13
+require_once XOOPS_ROOT_PATH.'/class/template.php';
14 14
 
15 15
 $xoopsTpl                = new XoopsTpl();
16 16
 $myts                    = MyTextSanitizer::getInstance();
17 17
 $xoopsConfig['sitename'] = $myts->displayTarea($xoopsConfig['sitename']);
18 18
 
19 19
 xoops_header(false);
20
-echo smart_get_css_link(SMARTOBJECT_URL . 'assets/css/module.css');
20
+echo smart_get_css_link(SMARTOBJECT_URL.'assets/css/module.css');
21 21
 echo '</head><body>';
22 22
 
23 23
 $smartobjectLinkHandler = xoops_getModuleHandler('link', 'smartobject');
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 switch ($op) {
29 29
     case 'sendlink':
30 30
 
31
-        include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
31
+        include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjectcontroller.php';
32 32
         $controller = new SmartObjectController($smartobjectLinkHandler);
33 33
 
34 34
         $linkObj = $controller->storeSmartObject();
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
              */
39 39
         }
40 40
 
41
-        $xoopsMailer =& getMailer();
41
+        $xoopsMailer = & getMailer();
42 42
         $xoopsMailer->useMail();
43
-        $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template');
43
+        $xoopsMailer->setTemplateDir('language/'.$xoopsConfig['language'].'/mail_template');
44 44
 
45 45
         $xoopsMailer->setTemplate('sendlink.tpl');
46 46
         $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
47 47
         $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name'));
48 48
         $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name'));
49
-        $xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
49
+        $xoopsMailer->assign('SITEURL', XOOPS_URL.'/');
50 50
         $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
51 51
         $xoopsMailer->assign('MESSAGE', $_POST['body']);
52 52
         $xoopsMailer->setToEmails($linkObj->getVar('to_email'));
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename'])));
56 56
 
57 57
         if (!$xoopsMailer->send(true)) {
58
-            $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true));
58
+            $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']).'<br>'.$xoopsMailer->getErrors(true));
59 59
         } else {
60 60
             $xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS);
61 61
         }
Please login to merge, or discard this patch.