Completed
Branch master (2d4977)
by Michael
03:20
created
include/captcha/image.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,56 +1,56 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Image Creation class for CAPTCHA
4
- *
5
- * D.J.
6
- */
3
+	 * Image Creation class for CAPTCHA
4
+	 *
5
+	 * D.J.
6
+	 */
7 7
 
8 8
 class XoopsCaptchaImage {
9
-    var $config	= array();
10
-
11
-    function XoopsCaptchaImage()
12
-    {
13
-        //$this->name = md5( session_id() );
14
-    }
15
-
16
-    function &instance()
17
-    {
18
-        static $instance;
19
-        if(!isset($instance)) {
20
-            $instance = new XoopsCaptchaImage();
21
-        }
22
-        return $instance;
23
-    }
24
-
25
-    /**
26
-     * Loading configs from CAPTCHA class
27
-     */
28
-    function loadConfig($config = array())
29
-    {
30
-        // Loading default preferences
31
-        $this->config =& $config;
32
-    }
33
-
34
-    function render()
35
-    {
36
-        $form = "<input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' /> &nbsp; ". $this->loadImage();
37
-        $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES);
38
-        if($this->config["maxattempt"]) {
39
-            $rule .=  " | ". sprintf( constant("XOOPS_CAPTCHA_MAXATTEMPTS"), $this->config["maxattempt"] );
40
-        }
41
-        $form .= "&nbsp;&nbsp;<small>{$rule}</small>";
42
-
43
-        return $form;
44
-    }
45
-
46
-
47
-    function loadImage()
48
-    {
49
-        $rule = $this->config["casesensitive"] ? constant("XOOPS_CAPTCHA_RULE_CASESENSITIVE") : constant("XOOPS_CAPTCHA_RULE_CASEINSENSITIVE");
50
-        $ret = "<img id='captcha' src='" . XOOPS_URL. "/". $this->config["imageurl"]. "' onclick=\"this.src='" . XOOPS_URL. "/". $this->config["imageurl"]. "?refresh='+Math.random()"."\" align='absmiddle'  style='cursor: pointer;' alt='".htmlspecialchars($rule, ENT_QUOTES)."' />";
51
-
52
-        return $ret;
53
-    }
9
+	var $config	= array();
10
+
11
+	function XoopsCaptchaImage()
12
+	{
13
+		//$this->name = md5( session_id() );
14
+	}
15
+
16
+	function &instance()
17
+	{
18
+		static $instance;
19
+		if(!isset($instance)) {
20
+			$instance = new XoopsCaptchaImage();
21
+		}
22
+		return $instance;
23
+	}
24
+
25
+	/**
26
+	 * Loading configs from CAPTCHA class
27
+	 */
28
+	function loadConfig($config = array())
29
+	{
30
+		// Loading default preferences
31
+		$this->config =& $config;
32
+	}
33
+
34
+	function render()
35
+	{
36
+		$form = "<input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' /> &nbsp; ". $this->loadImage();
37
+		$rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES);
38
+		if($this->config["maxattempt"]) {
39
+			$rule .=  " | ". sprintf( constant("XOOPS_CAPTCHA_MAXATTEMPTS"), $this->config["maxattempt"] );
40
+		}
41
+		$form .= "&nbsp;&nbsp;<small>{$rule}</small>";
42
+
43
+		return $form;
44
+	}
45
+
46
+
47
+	function loadImage()
48
+	{
49
+		$rule = $this->config["casesensitive"] ? constant("XOOPS_CAPTCHA_RULE_CASESENSITIVE") : constant("XOOPS_CAPTCHA_RULE_CASEINSENSITIVE");
50
+		$ret = "<img id='captcha' src='" . XOOPS_URL. "/". $this->config["imageurl"]. "' onclick=\"this.src='" . XOOPS_URL. "/". $this->config["imageurl"]. "?refresh='+Math.random()"."\" align='absmiddle'  style='cursor: pointer;' alt='".htmlspecialchars($rule, ENT_QUOTES)."' />";
51
+
52
+		return $ret;
53
+	}
54 54
 
55 55
 }
56 56
 ?>
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 class XoopsCaptchaImage {
9
-    var $config	= array();
9
+    var $config = array();
10 10
 
11 11
     function XoopsCaptchaImage()
12 12
     {
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     function &instance()
17 17
     {
18 18
         static $instance;
19
-        if(!isset($instance)) {
19
+        if (!isset($instance)) {
20 20
             $instance = new XoopsCaptchaImage();
21 21
         }
22 22
         return $instance;
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
     function loadConfig($config = array())
29 29
     {
30 30
         // Loading default preferences
31
-        $this->config =& $config;
31
+        $this->config = & $config;
32 32
     }
33 33
 
34 34
     function render()
35 35
     {
36
-        $form = "<input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' /> &nbsp; ". $this->loadImage();
36
+        $form = "<input type='text' name='" . $this->config["name"] . "' id='" . $this->config["name"] . "' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' /> &nbsp; " . $this->loadImage();
37 37
         $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES);
38
-        if($this->config["maxattempt"]) {
39
-            $rule .=  " | ". sprintf( constant("XOOPS_CAPTCHA_MAXATTEMPTS"), $this->config["maxattempt"] );
38
+        if ($this->config["maxattempt"]) {
39
+            $rule .= " | " . sprintf(constant("XOOPS_CAPTCHA_MAXATTEMPTS"), $this->config["maxattempt"]);
40 40
         }
41 41
         $form .= "&nbsp;&nbsp;<small>{$rule}</small>";
42 42
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     function loadImage()
48 48
     {
49 49
         $rule = $this->config["casesensitive"] ? constant("XOOPS_CAPTCHA_RULE_CASESENSITIVE") : constant("XOOPS_CAPTCHA_RULE_CASEINSENSITIVE");
50
-        $ret = "<img id='captcha' src='" . XOOPS_URL. "/". $this->config["imageurl"]. "' onclick=\"this.src='" . XOOPS_URL. "/". $this->config["imageurl"]. "?refresh='+Math.random()"."\" align='absmiddle'  style='cursor: pointer;' alt='".htmlspecialchars($rule, ENT_QUOTES)."' />";
50
+        $ret = "<img id='captcha' src='" . XOOPS_URL . "/" . $this->config["imageurl"] . "' onclick=\"this.src='" . XOOPS_URL . "/" . $this->config["imageurl"] . "?refresh='+Math.random()" . "\" align='absmiddle'  style='cursor: pointer;' alt='" . htmlspecialchars($rule, ENT_QUOTES) . "' />";
51 51
 
52 52
         return $ret;
53 53
     }
Please login to merge, or discard this patch.
include/captcha/formcaptcha.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	die("XOOPS root path not defined");
16 16
 }
17 17
 
18
-require_once XOOPS_ROOT_PATH."/class/xoopsform/formelement.php";
18
+require_once XOOPS_ROOT_PATH . "/class/xoopsform/formelement.php";
19 19
 
20 20
 /*
21 21
  * Usage
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 */
53 53
 	function XoopsFormCaptcha($caption = '', $name = 'xoopscaptcha', $skipmember = null, $numchar = null, $minfontsize = null, $maxfontsize = null, $backgroundtype = null, $backgroundnum = null) {
54
-		if(!class_exists("XoopsCaptcaha")) {
55
-			require_once SMARTOBJECT_ROOT_PATH."/include/captcha/captcha.php";
54
+		if (!class_exists("XoopsCaptcaha")) {
55
+			require_once SMARTOBJECT_ROOT_PATH . "/include/captcha/captcha.php";
56 56
 		}
57 57
 
58
-		$this->_captchaHandler =& XoopsCaptcha::instance();
58
+		$this->_captchaHandler = & XoopsCaptcha::instance();
59 59
 		$this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum);
60
-		if(!$this->_captchaHandler->active) {
60
+		if (!$this->_captchaHandler->active) {
61 61
 			$this->setHidden();
62
-		}else{
62
+		} else {
63 63
 			$caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption();
64 64
 			$this->setCaption($caption);
65 65
 		}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 	function render()
74 74
 	{
75
-		if(!$this->isHidden()) {
75
+		if (!$this->isHidden()) {
76 76
 			return $this->_captchaHandler->render();
77 77
 		}
78 78
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 		$this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum);
60 60
 		if(!$this->_captchaHandler->active) {
61 61
 			$this->setHidden();
62
-		}else{
62
+		} else{
63 63
 			$caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption();
64 64
 			$this->setCaption($caption);
65 65
 		}
Please login to merge, or discard this patch.
include/captcha/text.php 3 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,68 +1,68 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Text form for CAPTCHA
4
- *
5
- * D.J.
6
- */
3
+	 * Text form for CAPTCHA
4
+	 *
5
+	 * D.J.
6
+	 */
7 7
 
8 8
 class XoopsCaptchaText {
9
-    var $config	= array();
10
-    var $code;
9
+	var $config	= array();
10
+	var $code;
11 11
 
12
-    function XoopsCaptchaText()
13
-    {
14
-    }
12
+	function XoopsCaptchaText()
13
+	{
14
+	}
15 15
 
16
-    function &instance()
17
-    {
18
-        static $instance;
19
-        if(!isset($instance)) {
20
-            $instance = new XoopsCaptchaText();
21
-        }
22
-        return $instance;
23
-    }
16
+	function &instance()
17
+	{
18
+		static $instance;
19
+		if(!isset($instance)) {
20
+			$instance = new XoopsCaptchaText();
21
+		}
22
+		return $instance;
23
+	}
24 24
 
25
-    /**
26
-     * Loading configs from CAPTCHA class
27
-     */
28
-    function loadConfig($config = array())
29
-    {
30
-        // Loading default preferences
31
-        $this->config =& $config;
32
-    }
25
+	/**
26
+	 * Loading configs from CAPTCHA class
27
+	 */
28
+	function loadConfig($config = array())
29
+	{
30
+		// Loading default preferences
31
+		$this->config =& $config;
32
+	}
33 33
 
34
-    function setCode()
35
-    {
36
-        $_SESSION['XoopsCaptcha_sessioncode'] = strval( $this->code );
37
-    }
34
+	function setCode()
35
+	{
36
+		$_SESSION['XoopsCaptcha_sessioncode'] = strval( $this->code );
37
+	}
38 38
 
39
-    function render()
40
-    {
41
-        $form = $this->loadText()  . "&nbsp;&nbsp; <input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' />";
42
-        $rule = constant("XOOPS_CAPTCHA_RULE_TEXT");
43
-        if(!empty($rule)) {
44
-            $form .= "&nbsp;&nbsp;<small>{$rule}</small>";
45
-        }
39
+	function render()
40
+	{
41
+		$form = $this->loadText()  . "&nbsp;&nbsp; <input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' />";
42
+		$rule = constant("XOOPS_CAPTCHA_RULE_TEXT");
43
+		if(!empty($rule)) {
44
+			$form .= "&nbsp;&nbsp;<small>{$rule}</small>";
45
+		}
46 46
 
47
-        $this->setCode();
47
+		$this->setCode();
48 48
 
49
-        return $form;
50
-    }
49
+		return $form;
50
+	}
51 51
 
52
-    function loadText()
53
-    {
54
-        $val_a = rand(0, 9);
55
-        $val_b = rand(0, 9);
56
-        if($val_a > $val_b) {
57
-            $expression = "{$val_a} - {$val_b} = ?";
58
-            $this->code = $val_a - $val_b;
59
-        }else{
60
-            $expression = "{$val_a} + {$val_b} = ?";
61
-            $this->code = $val_a + $val_b;
62
-        }
52
+	function loadText()
53
+	{
54
+		$val_a = rand(0, 9);
55
+		$val_b = rand(0, 9);
56
+		if($val_a > $val_b) {
57
+			$expression = "{$val_a} - {$val_b} = ?";
58
+			$this->code = $val_a - $val_b;
59
+		}else{
60
+			$expression = "{$val_a} + {$val_b} = ?";
61
+			$this->code = $val_a + $val_b;
62
+		}
63 63
 
64
-        return "<span style='font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;'>{$expression}</span>";
65
-    }
64
+		return "<span style='font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;'>{$expression}</span>";
65
+	}
66 66
 
67 67
 }
68 68
 ?>
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 class XoopsCaptchaText {
9
-    var $config	= array();
9
+    var $config = array();
10 10
     var $code;
11 11
 
12 12
     function XoopsCaptchaText()
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     function &instance()
17 17
     {
18 18
         static $instance;
19
-        if(!isset($instance)) {
19
+        if (!isset($instance)) {
20 20
             $instance = new XoopsCaptchaText();
21 21
         }
22 22
         return $instance;
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
     function loadConfig($config = array())
29 29
     {
30 30
         // Loading default preferences
31
-        $this->config =& $config;
31
+        $this->config = & $config;
32 32
     }
33 33
 
34 34
     function setCode()
35 35
     {
36
-        $_SESSION['XoopsCaptcha_sessioncode'] = strval( $this->code );
36
+        $_SESSION['XoopsCaptcha_sessioncode'] = strval($this->code);
37 37
     }
38 38
 
39 39
     function render()
40 40
     {
41
-        $form = $this->loadText()  . "&nbsp;&nbsp; <input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' />";
41
+        $form = $this->loadText() . "&nbsp;&nbsp; <input type='text' name='" . $this->config["name"] . "' id='" . $this->config["name"] . "' size='" . $this->config["num_chars"] . "' maxlength='" . $this->config["num_chars"] . "' value='' />";
42 42
         $rule = constant("XOOPS_CAPTCHA_RULE_TEXT");
43
-        if(!empty($rule)) {
43
+        if (!empty($rule)) {
44 44
             $form .= "&nbsp;&nbsp;<small>{$rule}</small>";
45 45
         }
46 46
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $val_a = rand(0, 9);
55 55
         $val_b = rand(0, 9);
56
-        if($val_a > $val_b) {
56
+        if ($val_a > $val_b) {
57 57
             $expression = "{$val_a} - {$val_b} = ?";
58 58
             $this->code = $val_a - $val_b;
59
-        }else{
59
+        } else {
60 60
             $expression = "{$val_a} + {$val_b} = ?";
61 61
             $this->code = $val_a + $val_b;
62 62
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         if($val_a > $val_b) {
57 57
             $expression = "{$val_a} - {$val_b} = ?";
58 58
             $this->code = $val_a - $val_b;
59
-        }else{
59
+        } else{
60 60
             $expression = "{$val_a} + {$val_b} = ?";
61 61
             $this->code = $val_a + $val_b;
62 62
         }
Please login to merge, or discard this patch.
include/captcha/config.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 $language = preg_replace("/[^a-z0-9_\-]/i", "", $GLOBALS["xoopsConfig"]["language"]);
35 35
 
36 36
 if(! @include_once dirname(__FILE__)."/language/{$language}.php") {
37
-    require_once dirname(__FILE__)."/language/english.php";
37
+	require_once dirname(__FILE__)."/language/english.php";
38 38
 }
39 39
 
40 40
 return $config;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@
 block discarded – undo
14 14
 $config = array(
15 15
 	"mode"				=> 'image',
16 16
 	"name"				=> 'xoopscaptcha',
17
-	"skipmember"		=> true,					// Skip CAPTCHA check for members
18
-	"maxattempt"		=> 100,  					// Maximum attempts for each session
17
+	"skipmember"		=> true, // Skip CAPTCHA check for members
18
+	"maxattempt"		=> 100, // Maximum attempts for each session
19 19
 
20
-	"num_chars"			=> 4,  						// Maximum characters
20
+	"num_chars"			=> 4, // Maximum characters
21 21
 
22 22
 // For image mode, based on DuGris' SecurityImage
23
-	"rootpath"			=> dirname(__FILE__),		// __Absolute__ Path to the root of fonts and backgrounds
24
-	"imagepath"			=> "uploads/captcha",		// Path to temporary image files, __relative__ to XOOPS_ROOT_PATH
25
-	"imageurl"			=> "modules/smartobject/include/captcha/scripts/img.php",		// Path to the script for creating image, __relative__ to XOOPS_ROOT_PATH
26
-	"casesensitive"		=> false,					// Characters in image mode is case-sensitive
27
-	"fontsize_min"		=> 12,  					// Minimum font-size
28
-	"fontsize_max"		=> 12,  					// Maximum font-size
29
-	"background_type"	=> 0, 						// Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files
30
-	"background_num"	=> 50,						// Number of background images to generate
23
+	"rootpath"			=> dirname(__FILE__), // __Absolute__ Path to the root of fonts and backgrounds
24
+	"imagepath"			=> "uploads/captcha", // Path to temporary image files, __relative__ to XOOPS_ROOT_PATH
25
+	"imageurl"			=> "modules/smartobject/include/captcha/scripts/img.php", // Path to the script for creating image, __relative__ to XOOPS_ROOT_PATH
26
+	"casesensitive"		=> false, // Characters in image mode is case-sensitive
27
+	"fontsize_min"		=> 12, // Minimum font-size
28
+	"fontsize_max"		=> 12, // Maximum font-size
29
+	"background_type"	=> 0, // Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files
30
+	"background_num"	=> 50, // Number of background images to generate
31 31
 	"polygon_point"		=> 3,
32 32
 );
33 33
 
34 34
 $language = preg_replace("/[^a-z0-9_\-]/i", "", $GLOBALS["xoopsConfig"]["language"]);
35 35
 
36
-if(! @include_once dirname(__FILE__)."/language/{$language}.php") {
37
-    require_once dirname(__FILE__)."/language/english.php";
36
+if (!@include_once dirname(__FILE__) . "/language/{$language}.php") {
37
+    require_once dirname(__FILE__) . "/language/english.php";
38 38
 }
39 39
 
40 40
 return $config;
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($smartobject_link_handler);
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($smartobject_link_handler);
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
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 include_once("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';
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
-$myts =& MyTextSanitizer::getInstance();
16
+$myts = & MyTextSanitizer::getInstance();
17 17
 $xoopsConfig['sitename'] = $myts->displayTarea($xoopsConfig['sitename']);
18 18
 
19 19
 xoops_header(false);
@@ -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($smartobject_link_handler);
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'));
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $linkObj->setVar('date', time());
97 97
         $linkObj->hideFieldFromForm(array('from_uid', 'to_uid', 'link', 'mid', 'mid_name'));
98 98
 
99
-        $form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND,'javascript:window.close();');
99
+        $form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();');
100 100
 
101 101
         $form->assign($xoopsTpl);
102 102
 
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
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 if (!defined("XOOPS_ROOT_PATH")) {
11
-    die("XOOPS root path not defined");
11
+	die("XOOPS root path not defined");
12 12
 }
13 13
 
14 14
 define('_MI_SOBJECT_INDEX', 'Index');
Please login to merge, or discard this patch.
language/english/rating.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * Licence: GNU
8 8
  */
9 9
 if (!defined("XOOPS_ROOT_PATH")) {
10
-    die("XOOPS root path not defined");
10
+	die("XOOPS root path not defined");
11 11
 }
12 12
 
13 13
 define('_SOBJECT_RATING_RATE', 'Rate it !');
Please login to merge, or discard this patch.
language/english/main.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 if (!defined("XOOPS_ROOT_PATH")) {
11
-    die("XOOPS root path not defined");
11
+	die("XOOPS root path not defined");
12 12
 }
13 13
 
14 14
 
Please login to merge, or discard this patch.
language/english/adsense.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * Licence: GNU
8 8
  */
9 9
 if (!defined("XOOPS_ROOT_PATH")) {
10
-    die("XOOPS root path not defined");
10
+	die("XOOPS root path not defined");
11 11
 }
12 12
 
13 13
 define('_AM_SOBJECT_ADSENSES', 'Adense ads');
Please login to merge, or discard this patch.