@@ -7,75 +7,75 @@ |
||
7 | 7 | */ |
8 | 8 | class XoopsCaptchaText |
9 | 9 | { |
10 | - public $config = array(); |
|
11 | - public $code; |
|
10 | + public $config = array(); |
|
11 | + public $code; |
|
12 | 12 | |
13 | - /** |
|
14 | - * XoopsCaptchaText constructor. |
|
15 | - */ |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - } |
|
13 | + /** |
|
14 | + * XoopsCaptchaText constructor. |
|
15 | + */ |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * @return XoopsCaptchaText |
|
22 | - */ |
|
23 | - public function &instance() |
|
24 | - { |
|
25 | - static $instance; |
|
26 | - if (!isset($instance)) { |
|
27 | - $instance = new XoopsCaptchaText(); |
|
28 | - } |
|
20 | + /** |
|
21 | + * @return XoopsCaptchaText |
|
22 | + */ |
|
23 | + public function &instance() |
|
24 | + { |
|
25 | + static $instance; |
|
26 | + if (!isset($instance)) { |
|
27 | + $instance = new XoopsCaptchaText(); |
|
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 | - public function setCode() |
|
44 | - { |
|
45 | - $_SESSION['XoopsCaptcha_sessioncode'] = (string)$this->code; |
|
46 | - } |
|
43 | + public function setCode() |
|
44 | + { |
|
45 | + $_SESSION['XoopsCaptcha_sessioncode'] = (string)$this->code; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function render() |
|
52 | - { |
|
53 | - $form = $this->loadText() . " <input type='text' name='" . $this->config['name'] . "' id='" . $this->config['name'] . "' size='" . $this->config['num_chars'] . "' maxlength='" . $this->config['num_chars'] . "' value='' />"; |
|
54 | - $rule = constant('XOOPS_CAPTCHA_RULE_TEXT'); |
|
55 | - if (!empty($rule)) { |
|
56 | - $form .= " <small>{$rule}</small>"; |
|
57 | - } |
|
48 | + /** |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function render() |
|
52 | + { |
|
53 | + $form = $this->loadText() . " <input type='text' name='" . $this->config['name'] . "' id='" . $this->config['name'] . "' size='" . $this->config['num_chars'] . "' maxlength='" . $this->config['num_chars'] . "' value='' />"; |
|
54 | + $rule = constant('XOOPS_CAPTCHA_RULE_TEXT'); |
|
55 | + if (!empty($rule)) { |
|
56 | + $form .= " <small>{$rule}</small>"; |
|
57 | + } |
|
58 | 58 | |
59 | - $this->setCode(); |
|
59 | + $this->setCode(); |
|
60 | 60 | |
61 | - return $form; |
|
62 | - } |
|
61 | + return $form; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public function loadText() |
|
68 | - { |
|
69 | - $val_a = mt_rand(0, 9); |
|
70 | - $val_b = mt_rand(0, 9); |
|
71 | - if ($val_a > $val_b) { |
|
72 | - $expression = "{$val_a} - {$val_b} = ?"; |
|
73 | - $this->code = $val_a - $val_b; |
|
74 | - } else { |
|
75 | - $expression = "{$val_a} + {$val_b} = ?"; |
|
76 | - $this->code = $val_a + $val_b; |
|
77 | - } |
|
64 | + /** |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public function loadText() |
|
68 | + { |
|
69 | + $val_a = mt_rand(0, 9); |
|
70 | + $val_b = mt_rand(0, 9); |
|
71 | + if ($val_a > $val_b) { |
|
72 | + $expression = "{$val_a} - {$val_b} = ?"; |
|
73 | + $this->code = $val_a - $val_b; |
|
74 | + } else { |
|
75 | + $expression = "{$val_a} + {$val_b} = ?"; |
|
76 | + $this->code = $val_a + $val_b; |
|
77 | + } |
|
78 | 78 | |
79 | - return "<span style='font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;'>{$expression}</span>"; |
|
80 | - } |
|
79 | + return "<span style='font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;'>{$expression}</span>"; |
|
80 | + } |
|
81 | 81 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | public function setCode() |
44 | 44 | { |
45 | - $_SESSION['XoopsCaptcha_sessioncode'] = (string)$this->code; |
|
45 | + $_SESSION['XoopsCaptcha_sessioncode'] = (string) $this->code; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -1,40 +1,40 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * CAPTCHA class For XOOPS |
|
4 | - * |
|
5 | - * Currently there are two types of CAPTCHA forms, text and image |
|
6 | - * The default mode is "text", it can be changed in the priority: |
|
7 | - * 1 If mode is set through XoopsFormCaptcha::setMode(), take it |
|
8 | - * 2 Elseif mode is set though captcha/config.php, take it |
|
9 | - * 3 Else, take "text" |
|
10 | - * |
|
11 | - * D.J. |
|
12 | - */ |
|
3 | + * CAPTCHA class For XOOPS |
|
4 | + * |
|
5 | + * Currently there are two types of CAPTCHA forms, text and image |
|
6 | + * The default mode is "text", it can be changed in the priority: |
|
7 | + * 1 If mode is set through XoopsFormCaptcha::setMode(), take it |
|
8 | + * 2 Elseif mode is set though captcha/config.php, take it |
|
9 | + * 3 Else, take "text" |
|
10 | + * |
|
11 | + * D.J. |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | $config = array( |
15 | - 'mode' => 'image', |
|
16 | - 'name' => 'xoopscaptcha', |
|
17 | - 'skipmember' => true, // Skip CAPTCHA check for members |
|
18 | - 'maxattempt' => 100, // Maximum attempts for each session |
|
15 | + 'mode' => 'image', |
|
16 | + 'name' => 'xoopscaptcha', |
|
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 | - // For image mode, based on DuGris' SecurityImage |
|
23 | - 'rootpath' => __DIR__, // __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 | - 'polygon_point' => 3 |
|
22 | + // For image mode, based on DuGris' SecurityImage |
|
23 | + 'rootpath' => __DIR__, // __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 | + 'polygon_point' => 3 |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | $language = preg_replace("/[^a-z0-9_\-]/i", '', $GLOBALS['xoopsConfig']['language']); |
35 | 35 | |
36 | 36 | if (!@include_once __DIR__ . "/language/{$language}.php") { |
37 | - require_once __DIR__ . '/language/english.php'; |
|
37 | + require_once __DIR__ . '/language/english.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $config; |
@@ -14,20 +14,20 @@ |
||
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' => __DIR__, // __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' => __DIR__, // __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 |
@@ -7,62 +7,62 @@ |
||
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 function &instance() |
|
24 | - { |
|
25 | - static $instance; |
|
26 | - if (!isset($instance)) { |
|
27 | - $instance = new XoopsCaptchaImage(); |
|
28 | - } |
|
20 | + /** |
|
21 | + * @return XoopsCaptchaImage |
|
22 | + */ |
|
23 | + public function &instance() |
|
24 | + { |
|
25 | + static $instance; |
|
26 | + if (!isset($instance)) { |
|
27 | + $instance = new XoopsCaptchaImage(); |
|
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='" . $this->config['name'] . "' id='" . $this->config['name'] . "' size='" . $this->config['num_chars'] . "' maxlength='" . $this->config['num_chars'] . "' value='' /> " . $this->loadImage(); |
|
49 | - $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES); |
|
50 | - if ($this->config['maxattempt']) { |
|
51 | - $rule .= ' | ' . sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']); |
|
52 | - } |
|
53 | - $form .= " <small>{$rule}</small>"; |
|
43 | + /** |
|
44 | + * @return string |
|
45 | + */ |
|
46 | + public function render() |
|
47 | + { |
|
48 | + $form = "<input type='text' name='" . $this->config['name'] . "' id='" . $this->config['name'] . "' size='" . $this->config['num_chars'] . "' maxlength='" . $this->config['num_chars'] . "' value='' /> " . $this->loadImage(); |
|
49 | + $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES); |
|
50 | + if ($this->config['maxattempt']) { |
|
51 | + $rule .= ' | ' . sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']); |
|
52 | + } |
|
53 | + $form .= " <small>{$rule}</small>"; |
|
54 | 54 | |
55 | - return $form; |
|
56 | - } |
|
55 | + return $form; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function loadImage() |
|
62 | - { |
|
63 | - $rule = $this->config['casesensitive'] ? constant('XOOPS_CAPTCHA_RULE_CASESENSITIVE') : constant('XOOPS_CAPTCHA_RULE_CASEINSENSITIVE'); |
|
64 | - $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) . "' />"; |
|
58 | + /** |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function loadImage() |
|
62 | + { |
|
63 | + $rule = $this->config['casesensitive'] ? constant('XOOPS_CAPTCHA_RULE_CASESENSITIVE') : constant('XOOPS_CAPTCHA_RULE_CASEINSENSITIVE'); |
|
64 | + $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) . "' />"; |
|
65 | 65 | |
66 | - return $ret; |
|
67 | - } |
|
66 | + return $ret; |
|
67 | + } |
|
68 | 68 | } |
@@ -13,239 +13,239 @@ |
||
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 instance() |
|
37 | - { |
|
38 | - static $instance; |
|
39 | - if (!isset($instance)) { |
|
40 | - $instance = new XoopsCaptcha(); |
|
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 instance() |
|
37 | + { |
|
38 | + static $instance; |
|
39 | + if (!isset($instance)) { |
|
40 | + $instance = new XoopsCaptcha(); |
|
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 | } |
@@ -14,7 +14,7 @@ discard block |
||
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 |
@@ -127,7 +127,7 @@ discard block |
||
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 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public function destroyGarbage($clearSession = false) |
186 | 186 | { |
187 | 187 | require_once __DIR__ . '/' . $this->mode . '.php'; |
188 | - $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
188 | + $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
189 | 189 | $captchaHandler = new $class(); |
190 | 190 | if (method_exists($captchaHandler, 'destroyGarbage')) { |
191 | 191 | $captchaHandler->loadConfig($this->config); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | public function loadForm() |
241 | 241 | { |
242 | 242 | require_once __DIR__ . '/' . $this->mode . '.php'; |
243 | - $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
243 | + $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
244 | 244 | $captchaHandler = new $class(); |
245 | 245 | $captchaHandler->loadConfig($this->config); |
246 | 246 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Adding CAPTCHA |
|
4 | - * |
|
5 | - * Currently there are two types of CAPTCHA forms, text and image |
|
6 | - * The default mode is "text", it can be changed in the priority: |
|
7 | - * 1 If mode is set through XoopsFormCaptcha::setMode(), take it |
|
8 | - * 2 Elseif mode is set though captcha/config.php, take it |
|
9 | - * 3 Else, take "text" |
|
10 | - * |
|
11 | - * D.J. |
|
12 | - */ |
|
3 | + * Adding CAPTCHA |
|
4 | + * |
|
5 | + * Currently there are two types of CAPTCHA forms, text and image |
|
6 | + * The default mode is "text", it can be changed in the priority: |
|
7 | + * 1 If mode is set through XoopsFormCaptcha::setMode(), take it |
|
8 | + * 2 Elseif mode is set though captcha/config.php, take it |
|
9 | + * 3 Else, take "text" |
|
10 | + * |
|
11 | + * D.J. |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
15 | 15 | |
@@ -38,52 +38,52 @@ discard block |
||
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::instance(); |
|
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::instance(); |
|
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 | } |
@@ -11,44 +11,44 @@ discard block |
||
11 | 11 | |
12 | 12 | function editclass($showmenu = false, $ratingid = 0) |
13 | 13 | { |
14 | - global $smartobjectRatingHandler; |
|
15 | - |
|
16 | - $ratingObj = $smartobjectRatingHandler->get($ratingid); |
|
17 | - |
|
18 | - if (!$ratingObj->isNew()) { |
|
19 | - if ($showmenu) { |
|
20 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING); |
|
21 | - } |
|
22 | - smart_collapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO); |
|
23 | - |
|
24 | - $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating'); |
|
25 | - $sform->display(); |
|
26 | - smart_close_collapsable('ratingedit'); |
|
27 | - } else { |
|
28 | - $ratingObj->hideFieldFromForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
29 | - |
|
30 | - if (isset($_POST['op'])) { |
|
31 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
32 | - $controller->postDataToObject($ratingObj); |
|
33 | - |
|
34 | - if ($_POST['op'] === 'changedField') { |
|
35 | - switch ($_POST['changedField']) { |
|
36 | - case 'dirname': |
|
37 | - $ratingObj->showFieldOnForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
38 | - break; |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - |
|
43 | - if ($showmenu) { |
|
44 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW); |
|
45 | - } |
|
46 | - |
|
47 | - smart_collapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO); |
|
48 | - $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating'); |
|
49 | - $sform->display(); |
|
50 | - smart_close_collapsable('ratingcreate'); |
|
51 | - } |
|
14 | + global $smartobjectRatingHandler; |
|
15 | + |
|
16 | + $ratingObj = $smartobjectRatingHandler->get($ratingid); |
|
17 | + |
|
18 | + if (!$ratingObj->isNew()) { |
|
19 | + if ($showmenu) { |
|
20 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING); |
|
21 | + } |
|
22 | + smart_collapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO); |
|
23 | + |
|
24 | + $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating'); |
|
25 | + $sform->display(); |
|
26 | + smart_close_collapsable('ratingedit'); |
|
27 | + } else { |
|
28 | + $ratingObj->hideFieldFromForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
29 | + |
|
30 | + if (isset($_POST['op'])) { |
|
31 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
32 | + $controller->postDataToObject($ratingObj); |
|
33 | + |
|
34 | + if ($_POST['op'] === 'changedField') { |
|
35 | + switch ($_POST['changedField']) { |
|
36 | + case 'dirname': |
|
37 | + $ratingObj->showFieldOnForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
38 | + break; |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | + |
|
43 | + if ($showmenu) { |
|
44 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW); |
|
45 | + } |
|
46 | + |
|
47 | + smart_collapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO); |
|
48 | + $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating'); |
|
49 | + $sform->display(); |
|
50 | + smart_close_collapsable('ratingcreate'); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | include_once __DIR__ . '/admin_header.php'; |
@@ -60,60 +60,60 @@ discard block |
||
60 | 60 | $op = ''; |
61 | 61 | |
62 | 62 | if (isset($_GET['op'])) { |
63 | - $op = $_GET['op']; |
|
63 | + $op = $_GET['op']; |
|
64 | 64 | } |
65 | 65 | if (isset($_POST['op'])) { |
66 | - $op = $_POST['op']; |
|
66 | + $op = $_POST['op']; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | switch ($op) { |
70 | - case 'mod': |
|
71 | - case 'changedField'; |
|
70 | + case 'mod': |
|
71 | + case 'changedField'; |
|
72 | 72 | |
73 | - $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
73 | + $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
74 | 74 | |
75 | - smart_xoops_cp_header(); |
|
76 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
75 | + smart_xoops_cp_header(); |
|
76 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
77 | 77 | |
78 | - editclass(true, $ratingid); |
|
79 | - break; |
|
78 | + editclass(true, $ratingid); |
|
79 | + break; |
|
80 | 80 | |
81 | - case 'addrating': |
|
82 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
83 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
84 | - $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php'); |
|
81 | + case 'addrating': |
|
82 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
83 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
84 | + $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php'); |
|
85 | 85 | |
86 | - break; |
|
86 | + break; |
|
87 | 87 | |
88 | - case 'del': |
|
89 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
91 | - $controller->handleObjectDeletion(); |
|
88 | + case 'del': |
|
89 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
91 | + $controller->handleObjectDeletion(); |
|
92 | 92 | |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | - default: |
|
95 | + default: |
|
96 | 96 | |
97 | - smart_xoops_cp_header(); |
|
98 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
97 | + smart_xoops_cp_header(); |
|
98 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
99 | 99 | |
100 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS); |
|
100 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS); |
|
101 | 101 | |
102 | - smart_collapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC); |
|
102 | + smart_collapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC); |
|
103 | 103 | |
104 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
105 | - $objectTable = new SmartObjectTable($smartobjectRatingHandler); |
|
106 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left')); |
|
107 | - $objectTable->addColumn(new SmartObjectColumn('dirname', 'left')); |
|
108 | - $objectTable->addColumn(new SmartObjectColumn('item', 'left', false, 'getItemValue')); |
|
109 | - $objectTable->addColumn(new SmartObjectColumn('date', 'center', 150)); |
|
110 | - $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 40, 'getRateValue')); |
|
104 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
105 | + $objectTable = new SmartObjectTable($smartobjectRatingHandler); |
|
106 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left')); |
|
107 | + $objectTable->addColumn(new SmartObjectColumn('dirname', 'left')); |
|
108 | + $objectTable->addColumn(new SmartObjectColumn('item', 'left', false, 'getItemValue')); |
|
109 | + $objectTable->addColumn(new SmartObjectColumn('date', 'center', 150)); |
|
110 | + $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 40, 'getRateValue')); |
|
111 | 111 | |
112 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
113 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
112 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
113 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
114 | 114 | |
115 | - $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE); |
|
116 | - /* |
|
115 | + $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE); |
|
116 | + /* |
|
117 | 117 | $criteria_upcoming = new CriteriaCompo(); |
118 | 118 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
119 | 119 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | )); |
139 | 139 | */ |
140 | 140 | |
141 | - $objectTable->render(); |
|
141 | + $objectTable->render(); |
|
142 | 142 | |
143 | - echo '<br />'; |
|
144 | - smart_close_collapsable('createdratings'); |
|
145 | - echo '<br>'; |
|
143 | + echo '<br />'; |
|
144 | + smart_close_collapsable('createdratings'); |
|
145 | + echo '<br>'; |
|
146 | 146 | |
147 | - break; |
|
147 | + break; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | //smart_modFooter(); |
@@ -67,53 +67,53 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | switch ($op) { |
70 | - case 'mod': |
|
71 | - case 'changedField'; |
|
70 | + case 'mod': |
|
71 | + case 'changedField'; |
|
72 | 72 | |
73 | - $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
73 | + $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
74 | 74 | |
75 | - smart_xoops_cp_header(); |
|
76 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
75 | + smart_xoops_cp_header(); |
|
76 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
77 | 77 | |
78 | - editclass(true, $ratingid); |
|
79 | - break; |
|
78 | + editclass(true, $ratingid); |
|
79 | + break; |
|
80 | 80 | |
81 | - case 'addrating': |
|
82 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
83 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
84 | - $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php'); |
|
81 | + case 'addrating': |
|
82 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
83 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
84 | + $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php'); |
|
85 | 85 | |
86 | - break; |
|
86 | + break; |
|
87 | 87 | |
88 | - case 'del': |
|
89 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
91 | - $controller->handleObjectDeletion(); |
|
88 | + case 'del': |
|
89 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
91 | + $controller->handleObjectDeletion(); |
|
92 | 92 | |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | - default: |
|
95 | + default: |
|
96 | 96 | |
97 | - smart_xoops_cp_header(); |
|
98 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
97 | + smart_xoops_cp_header(); |
|
98 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
99 | 99 | |
100 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS); |
|
100 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS); |
|
101 | 101 | |
102 | - smart_collapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC); |
|
102 | + smart_collapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC); |
|
103 | 103 | |
104 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
105 | - $objectTable = new SmartObjectTable($smartobjectRatingHandler); |
|
106 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left')); |
|
107 | - $objectTable->addColumn(new SmartObjectColumn('dirname', 'left')); |
|
108 | - $objectTable->addColumn(new SmartObjectColumn('item', 'left', false, 'getItemValue')); |
|
109 | - $objectTable->addColumn(new SmartObjectColumn('date', 'center', 150)); |
|
110 | - $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 40, 'getRateValue')); |
|
104 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
105 | + $objectTable = new SmartObjectTable($smartobjectRatingHandler); |
|
106 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left')); |
|
107 | + $objectTable->addColumn(new SmartObjectColumn('dirname', 'left')); |
|
108 | + $objectTable->addColumn(new SmartObjectColumn('item', 'left', false, 'getItemValue')); |
|
109 | + $objectTable->addColumn(new SmartObjectColumn('date', 'center', 150)); |
|
110 | + $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 40, 'getRateValue')); |
|
111 | 111 | |
112 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
113 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
112 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
113 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
114 | 114 | |
115 | - $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE); |
|
116 | - /* |
|
115 | + $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE); |
|
116 | + /* |
|
117 | 117 | $criteria_upcoming = new CriteriaCompo(); |
118 | 118 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
119 | 119 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | )); |
139 | 139 | */ |
140 | 140 | |
141 | - $objectTable->render(); |
|
141 | + $objectTable->render(); |
|
142 | 142 | |
143 | - echo '<br />'; |
|
144 | - smart_close_collapsable('createdratings'); |
|
145 | - echo '<br>'; |
|
143 | + echo '<br />'; |
|
144 | + smart_close_collapsable('createdratings'); |
|
145 | + echo '<br>'; |
|
146 | 146 | |
147 | - break; |
|
147 | + break; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | //smart_modFooter(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
56 | 56 | include_once SMARTOBJECT_ROOT_PATH . 'class/rating.php'; |
57 | 57 | $smartobjectRatingHandler = xoops_getModuleHandler('rating'); |
58 | -$indexAdmin = new ModuleAdmin(); |
|
58 | +$indexAdmin = new ModuleAdmin(); |
|
59 | 59 | |
60 | 60 | $op = ''; |
61 | 61 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | case 'mod': |
71 | 71 | case 'changedField'; |
72 | 72 | |
73 | - $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
73 | + $ratingid = isset($_GET['ratingid']) ? (int) $_GET['ratingid'] : 0; |
|
74 | 74 | |
75 | 75 | smart_xoops_cp_header(); |
76 | 76 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
@@ -12,32 +12,32 @@ discard block |
||
12 | 12 | |
13 | 13 | function editclass($showmenu = false, $adsenseid = 0, $clone = false) |
14 | 14 | { |
15 | - global $smartobjectAdsenseHandler; |
|
16 | - |
|
17 | - $adsenseObj = $smartobjectAdsenseHandler->get($adsenseid); |
|
18 | - |
|
19 | - if (!$clone && !$adsenseObj->isNew()) { |
|
20 | - if ($showmenu) { |
|
21 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING); |
|
22 | - } |
|
23 | - smart_collapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO); |
|
24 | - |
|
25 | - $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense'); |
|
26 | - $sform->display(); |
|
27 | - smart_close_collapsable('adsenseedit'); |
|
28 | - } else { |
|
29 | - $adsenseObj->setVar('adsenseid', 0); |
|
30 | - $adsenseObj->setVar('tag', ''); |
|
31 | - |
|
32 | - if ($showmenu) { |
|
33 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
34 | - } |
|
35 | - |
|
36 | - smart_collapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO); |
|
37 | - $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true); |
|
38 | - $sform->display(); |
|
39 | - smart_close_collapsable('adsensecreate'); |
|
40 | - } |
|
15 | + global $smartobjectAdsenseHandler; |
|
16 | + |
|
17 | + $adsenseObj = $smartobjectAdsenseHandler->get($adsenseid); |
|
18 | + |
|
19 | + if (!$clone && !$adsenseObj->isNew()) { |
|
20 | + if ($showmenu) { |
|
21 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING); |
|
22 | + } |
|
23 | + smart_collapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO); |
|
24 | + |
|
25 | + $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense'); |
|
26 | + $sform->display(); |
|
27 | + smart_close_collapsable('adsenseedit'); |
|
28 | + } else { |
|
29 | + $adsenseObj->setVar('adsenseid', 0); |
|
30 | + $adsenseObj->setVar('tag', ''); |
|
31 | + |
|
32 | + if ($showmenu) { |
|
33 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
34 | + } |
|
35 | + |
|
36 | + smart_collapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO); |
|
37 | + $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true); |
|
38 | + $sform->display(); |
|
39 | + smart_close_collapsable('adsensecreate'); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | include_once __DIR__ . '/admin_header.php'; |
@@ -50,73 +50,73 @@ discard block |
||
50 | 50 | $op = ''; |
51 | 51 | |
52 | 52 | if (isset($_GET['op'])) { |
53 | - $op = $_GET['op']; |
|
53 | + $op = $_GET['op']; |
|
54 | 54 | } |
55 | 55 | if (isset($_POST['op'])) { |
56 | - $op = $_POST['op']; |
|
56 | + $op = $_POST['op']; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | switch ($op) { |
60 | - case 'mod': |
|
60 | + case 'mod': |
|
61 | 61 | |
62 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
62 | + $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
63 | 63 | |
64 | - smart_xoops_cp_header(); |
|
65 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
64 | + smart_xoops_cp_header(); |
|
65 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
66 | 66 | |
67 | - editclass(true, $adsenseid); |
|
68 | - break; |
|
67 | + editclass(true, $adsenseid); |
|
68 | + break; |
|
69 | 69 | |
70 | - case 'clone': |
|
70 | + case 'clone': |
|
71 | 71 | |
72 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
72 | + $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
73 | 73 | |
74 | - smart_xoops_cp_header(); |
|
75 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
74 | + smart_xoops_cp_header(); |
|
75 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
76 | 76 | |
77 | - editclass(true, $adsenseid, true); |
|
78 | - break; |
|
77 | + editclass(true, $adsenseid, true); |
|
78 | + break; |
|
79 | 79 | |
80 | - case 'addadsense': |
|
81 | - if (@include_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
|
82 | - $xoopsCaptcha = XoopsCaptcha::instance(); |
|
83 | - if (!$xoopsCaptcha->verify()) { |
|
84 | - redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
|
85 | - exit; |
|
86 | - } |
|
87 | - } |
|
88 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
89 | - $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
90 | - $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
|
91 | - break; |
|
80 | + case 'addadsense': |
|
81 | + if (@include_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
|
82 | + $xoopsCaptcha = XoopsCaptcha::instance(); |
|
83 | + if (!$xoopsCaptcha->verify()) { |
|
84 | + redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
|
85 | + exit; |
|
86 | + } |
|
87 | + } |
|
88 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
89 | + $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
90 | + $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
|
91 | + break; |
|
92 | 92 | |
93 | - case 'del': |
|
93 | + case 'del': |
|
94 | 94 | |
95 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
96 | - $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
97 | - $controller->handleObjectDeletion(); |
|
95 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
96 | + $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
97 | + $controller->handleObjectDeletion(); |
|
98 | 98 | |
99 | - break; |
|
99 | + break; |
|
100 | 100 | |
101 | - default: |
|
101 | + default: |
|
102 | 102 | |
103 | - smart_xoops_cp_header(); |
|
104 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
103 | + smart_xoops_cp_header(); |
|
104 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
105 | 105 | |
106 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
106 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
107 | 107 | |
108 | - smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
|
108 | + smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
|
109 | 109 | |
110 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | - $objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
|
112 | - $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
113 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
110 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | + $objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
|
112 | + $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
113 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
114 | 114 | |
115 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
116 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
115 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
116 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
117 | 117 | |
118 | - $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
|
119 | - /* |
|
118 | + $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
|
119 | + /* |
|
120 | 120 | $criteria_upcoming = new CriteriaCompo(); |
121 | 121 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
122 | 122 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | 'criteria' => $criteria_last30days |
141 | 141 | )); |
142 | 142 | */ |
143 | - $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
144 | - $objectTable->addCustomAction('getCloneLink'); |
|
143 | + $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
144 | + $objectTable->addCustomAction('getCloneLink'); |
|
145 | 145 | |
146 | - $objectTable->render(); |
|
146 | + $objectTable->render(); |
|
147 | 147 | |
148 | - echo '<br />'; |
|
149 | - smart_close_collapsable('createdadsenses'); |
|
150 | - echo '<br>'; |
|
148 | + echo '<br />'; |
|
149 | + smart_close_collapsable('createdadsenses'); |
|
150 | + echo '<br>'; |
|
151 | 151 | |
152 | - break; |
|
152 | + break; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //smart_modFooter(); |
@@ -57,66 +57,66 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | switch ($op) { |
60 | - case 'mod': |
|
60 | + case 'mod': |
|
61 | 61 | |
62 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
62 | + $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
63 | 63 | |
64 | - smart_xoops_cp_header(); |
|
65 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
64 | + smart_xoops_cp_header(); |
|
65 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
66 | 66 | |
67 | - editclass(true, $adsenseid); |
|
68 | - break; |
|
67 | + editclass(true, $adsenseid); |
|
68 | + break; |
|
69 | 69 | |
70 | - case 'clone': |
|
70 | + case 'clone': |
|
71 | 71 | |
72 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
72 | + $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
73 | 73 | |
74 | - smart_xoops_cp_header(); |
|
75 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
74 | + smart_xoops_cp_header(); |
|
75 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
76 | 76 | |
77 | - editclass(true, $adsenseid, true); |
|
78 | - break; |
|
77 | + editclass(true, $adsenseid, true); |
|
78 | + break; |
|
79 | 79 | |
80 | - case 'addadsense': |
|
81 | - if (@include_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
|
82 | - $xoopsCaptcha = XoopsCaptcha::instance(); |
|
83 | - if (!$xoopsCaptcha->verify()) { |
|
84 | - redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
|
85 | - exit; |
|
86 | - } |
|
87 | - } |
|
88 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
89 | - $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
90 | - $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
|
91 | - break; |
|
80 | + case 'addadsense': |
|
81 | + if (@include_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
|
82 | + $xoopsCaptcha = XoopsCaptcha::instance(); |
|
83 | + if (!$xoopsCaptcha->verify()) { |
|
84 | + redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
|
85 | + exit; |
|
86 | + } |
|
87 | + } |
|
88 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
89 | + $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
90 | + $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
|
91 | + break; |
|
92 | 92 | |
93 | - case 'del': |
|
93 | + case 'del': |
|
94 | 94 | |
95 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
96 | - $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
97 | - $controller->handleObjectDeletion(); |
|
95 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
96 | + $controller = new SmartObjectController($smartobjectAdsenseHandler); |
|
97 | + $controller->handleObjectDeletion(); |
|
98 | 98 | |
99 | - break; |
|
99 | + break; |
|
100 | 100 | |
101 | - default: |
|
101 | + default: |
|
102 | 102 | |
103 | - smart_xoops_cp_header(); |
|
104 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
103 | + smart_xoops_cp_header(); |
|
104 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
105 | 105 | |
106 | - //smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
106 | + //smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
107 | 107 | |
108 | - smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
|
108 | + smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
|
109 | 109 | |
110 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | - $objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
|
112 | - $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
113 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
110 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
111 | + $objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
|
112 | + $objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
|
113 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
114 | 114 | |
115 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
116 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
115 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
116 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
117 | 117 | |
118 | - $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
|
119 | - /* |
|
118 | + $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
|
119 | + /* |
|
120 | 120 | $criteria_upcoming = new CriteriaCompo(); |
121 | 121 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
122 | 122 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | 'criteria' => $criteria_last30days |
141 | 141 | )); |
142 | 142 | */ |
143 | - $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
144 | - $objectTable->addCustomAction('getCloneLink'); |
|
143 | + $objectTable->addQuickSearch(array('title', 'summary', 'description')); |
|
144 | + $objectTable->addCustomAction('getCloneLink'); |
|
145 | 145 | |
146 | - $objectTable->render(); |
|
146 | + $objectTable->render(); |
|
147 | 147 | |
148 | - echo '<br />'; |
|
149 | - smart_close_collapsable('createdadsenses'); |
|
150 | - echo '<br>'; |
|
148 | + echo '<br />'; |
|
149 | + smart_close_collapsable('createdadsenses'); |
|
150 | + echo '<br>'; |
|
151 | 151 | |
152 | - break; |
|
152 | + break; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //smart_modFooter(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | switch ($op) { |
60 | 60 | case 'mod': |
61 | 61 | |
62 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
62 | + $adsenseid = isset($_GET['adsenseid']) ? (int) $_GET['adsenseid'] : 0; |
|
63 | 63 | |
64 | 64 | smart_xoops_cp_header(); |
65 | 65 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | case 'clone': |
71 | 71 | |
72 | - $adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
|
72 | + $adsenseid = isset($_GET['adsenseid']) ? (int) $_GET['adsenseid'] : 0; |
|
73 | 73 | |
74 | 74 | smart_xoops_cp_header(); |
75 | 75 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
@@ -12,45 +12,45 @@ discard block |
||
12 | 12 | |
13 | 13 | function edittag($tagid = 0, $language = false, $fct = false) |
14 | 14 | { |
15 | - global $smartobjectTagHandler; |
|
16 | - |
|
17 | - $tagObj = $smartobjectTagHandler->get($tagid); |
|
18 | - |
|
19 | - if ($tagObj->isNew()) { |
|
20 | - $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE; |
|
21 | - $title = _AM_SOBJECT_TAG_CREATE; |
|
22 | - $info = _AM_SOBJECT_TAG_CREATE_INFO; |
|
23 | - $collaps_name = 'tagcreate'; |
|
24 | - $form_name = _AM_SOBJECT_TAG_CREATE; |
|
25 | - $submit_button_caption = null; |
|
26 | - //$tagObj->stripMultilanguageFields(); |
|
27 | - } else { |
|
28 | - if ($language) { |
|
29 | - $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE; |
|
30 | - $title = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
31 | - $info = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO; |
|
32 | - $collaps_name = 'tageditlanguage'; |
|
33 | - $form_name = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
34 | - $submit_button_caption = null; |
|
35 | - $tagObj->makeNonMLFieldReadOnly(); |
|
36 | - } else { |
|
37 | - $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING; |
|
38 | - $title = _AM_SOBJECT_TAG_EDIT; |
|
39 | - $info = _AM_SOBJECT_TAG_EDIT_INFO; |
|
40 | - $collaps_name = 'tagedit'; |
|
41 | - $form_name = _AM_SOBJECT_TAG_EDIT; |
|
42 | - $submit_button_caption = null; |
|
43 | - $tagObj->stripMultilanguageFields(); |
|
44 | - } |
|
45 | - } |
|
46 | - |
|
47 | - //smart_adminMenu(2, $breadcrumb); |
|
48 | - |
|
49 | - smart_collapsableBar($collaps_name, $title, $info); |
|
50 | - |
|
51 | - $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption); |
|
52 | - $sform->display(); |
|
53 | - smart_close_collapsable($collaps_name); |
|
15 | + global $smartobjectTagHandler; |
|
16 | + |
|
17 | + $tagObj = $smartobjectTagHandler->get($tagid); |
|
18 | + |
|
19 | + if ($tagObj->isNew()) { |
|
20 | + $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE; |
|
21 | + $title = _AM_SOBJECT_TAG_CREATE; |
|
22 | + $info = _AM_SOBJECT_TAG_CREATE_INFO; |
|
23 | + $collaps_name = 'tagcreate'; |
|
24 | + $form_name = _AM_SOBJECT_TAG_CREATE; |
|
25 | + $submit_button_caption = null; |
|
26 | + //$tagObj->stripMultilanguageFields(); |
|
27 | + } else { |
|
28 | + if ($language) { |
|
29 | + $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE; |
|
30 | + $title = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
31 | + $info = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO; |
|
32 | + $collaps_name = 'tageditlanguage'; |
|
33 | + $form_name = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
34 | + $submit_button_caption = null; |
|
35 | + $tagObj->makeNonMLFieldReadOnly(); |
|
36 | + } else { |
|
37 | + $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING; |
|
38 | + $title = _AM_SOBJECT_TAG_EDIT; |
|
39 | + $info = _AM_SOBJECT_TAG_EDIT_INFO; |
|
40 | + $collaps_name = 'tagedit'; |
|
41 | + $form_name = _AM_SOBJECT_TAG_EDIT; |
|
42 | + $submit_button_caption = null; |
|
43 | + $tagObj->stripMultilanguageFields(); |
|
44 | + } |
|
45 | + } |
|
46 | + |
|
47 | + //smart_adminMenu(2, $breadcrumb); |
|
48 | + |
|
49 | + smart_collapsableBar($collaps_name, $title, $info); |
|
50 | + |
|
51 | + $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption); |
|
52 | + $sform->display(); |
|
53 | + smart_close_collapsable($collaps_name); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | include_once __DIR__ . '/admin_header.php'; |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | $op = ''; |
63 | 63 | |
64 | 64 | if (isset($_GET['op'])) { |
65 | - $op = $_GET['op']; |
|
65 | + $op = $_GET['op']; |
|
66 | 66 | } |
67 | 67 | if (isset($_POST['op'])) { |
68 | - $op = $_POST['op']; |
|
68 | + $op = $_POST['op']; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $tagid = isset($_GET['tagid']) ? $_GET['tagid'] : 0; |
@@ -74,66 +74,66 @@ discard block |
||
74 | 74 | |
75 | 75 | switch ($op) { |
76 | 76 | |
77 | - case 'del': |
|
78 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
79 | - $controller = new SmartObjectController($smartobjectTagHandler); |
|
80 | - $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM); |
|
77 | + case 'del': |
|
78 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
79 | + $controller = new SmartObjectController($smartobjectTagHandler); |
|
80 | + $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM); |
|
81 | 81 | |
82 | - break; |
|
82 | + break; |
|
83 | 83 | |
84 | - case 'addtag': |
|
85 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
86 | - $controller = new SmartObjectController($smartobjectTagHandler); |
|
87 | - $tagObj = $controller->storeSmartObject(); |
|
88 | - if ($tagObj->hasError()) { |
|
89 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
90 | - exit; |
|
91 | - } |
|
84 | + case 'addtag': |
|
85 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
86 | + $controller = new SmartObjectController($smartobjectTagHandler); |
|
87 | + $tagObj = $controller->storeSmartObject(); |
|
88 | + if ($tagObj->hasError()) { |
|
89 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
90 | + exit; |
|
91 | + } |
|
92 | 92 | |
93 | - if ($tagObj->hasError()) { |
|
94 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
95 | - } else { |
|
96 | - redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS); |
|
97 | - } |
|
98 | - exit; |
|
99 | - break; |
|
93 | + if ($tagObj->hasError()) { |
|
94 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
95 | + } else { |
|
96 | + redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS); |
|
97 | + } |
|
98 | + exit; |
|
99 | + break; |
|
100 | 100 | |
101 | - case 'mod': |
|
102 | - smart_xoops_cp_header(); |
|
103 | - edittag($tagid, $language, $fct); |
|
104 | - break; |
|
101 | + case 'mod': |
|
102 | + smart_xoops_cp_header(); |
|
103 | + edittag($tagid, $language, $fct); |
|
104 | + break; |
|
105 | 105 | |
106 | - default: |
|
106 | + default: |
|
107 | 107 | |
108 | - smart_xoops_cp_header(); |
|
108 | + smart_xoops_cp_header(); |
|
109 | 109 | |
110 | - //smart_adminMenu(2, _AM_SOBJECT_TAGS); |
|
110 | + //smart_adminMenu(2, _AM_SOBJECT_TAGS); |
|
111 | 111 | |
112 | - smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO); |
|
112 | + smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO); |
|
113 | 113 | |
114 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
115 | - $objectTable = new SmartObjectTable($smartobjectTagHandler, false, array('delete')); |
|
116 | - $objectTable->addColumn(new SmartObjectColumn('name')); |
|
117 | - $objectTable->addColumn(new SmartObjectColumn('language')); |
|
118 | - $objectTable->addColumn(new SmartObjectColumn('value')); |
|
119 | - // $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo')); |
|
114 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
115 | + $objectTable = new SmartObjectTable($smartobjectTagHandler, false, array('delete')); |
|
116 | + $objectTable->addColumn(new SmartObjectColumn('name')); |
|
117 | + $objectTable->addColumn(new SmartObjectColumn('language')); |
|
118 | + $objectTable->addColumn(new SmartObjectColumn('value')); |
|
119 | + // $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo')); |
|
120 | 120 | |
121 | - $objectTable->addFilter('language', 'getLanguages'); |
|
121 | + $objectTable->addFilter('language', 'getLanguages'); |
|
122 | 122 | |
123 | - $objectTable->addCustomAction('getEditLanguageLink'); |
|
124 | - $objectTable->addCustomAction('getEditItemLink'); |
|
123 | + $objectTable->addCustomAction('getEditLanguageLink'); |
|
124 | + $objectTable->addCustomAction('getEditItemLink'); |
|
125 | 125 | |
126 | - $objectTable->setDefaultSort('tagid'); |
|
126 | + $objectTable->setDefaultSort('tagid'); |
|
127 | 127 | |
128 | - $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE); |
|
128 | + $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE); |
|
129 | 129 | |
130 | - $objectTable->render(); |
|
130 | + $objectTable->render(); |
|
131 | 131 | |
132 | - echo '<br />'; |
|
133 | - smart_close_collapsable('tags'); |
|
134 | - echo '<br>'; |
|
132 | + echo '<br />'; |
|
133 | + smart_close_collapsable('tags'); |
|
134 | + echo '<br>'; |
|
135 | 135 | |
136 | - break; |
|
136 | + break; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | //smart_modFooter(); |
@@ -21,81 +21,81 @@ |
||
21 | 21 | $op = ''; |
22 | 22 | |
23 | 23 | if (isset($_GET['op'])) { |
24 | - $op = $_GET['op']; |
|
24 | + $op = $_GET['op']; |
|
25 | 25 | } |
26 | 26 | if (isset($_POST['op'])) { |
27 | - $op = $_POST['op']; |
|
27 | + $op = $_POST['op']; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | switch ($op) { |
31 | 31 | |
32 | - case 'del': |
|
33 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
34 | - $controller = new SmartObjectController($smartobjectLinkHandler); |
|
35 | - $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); |
|
32 | + case 'del': |
|
33 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
34 | + $controller = new SmartObjectController($smartobjectLinkHandler); |
|
35 | + $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); |
|
36 | 36 | |
37 | - break; |
|
37 | + break; |
|
38 | 38 | |
39 | - case 'view': |
|
40 | - $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; |
|
41 | - $linkObj = $smartobjectLinkHandler->get($linkid); |
|
39 | + case 'view': |
|
40 | + $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; |
|
41 | + $linkObj = $smartobjectLinkHandler->get($linkid); |
|
42 | 42 | |
43 | - if ($linkObj->isNew()) { |
|
44 | - redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND); |
|
45 | - } |
|
43 | + if ($linkObj->isNew()) { |
|
44 | + redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND); |
|
45 | + } |
|
46 | 46 | |
47 | - smart_xoops_cp_header(); |
|
47 | + smart_xoops_cp_header(); |
|
48 | 48 | |
49 | - //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); |
|
49 | + //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); |
|
50 | 50 | |
51 | - smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); |
|
51 | + smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); |
|
52 | 52 | |
53 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
53 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
54 | 54 | |
55 | - // --- |
|
56 | - // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
57 | - // $xoopsTpl = new XoopsTpl(); |
|
58 | - $xoopsTpl = new XoopsTpl(); |
|
59 | - //--- |
|
55 | + // --- |
|
56 | + // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
57 | + // $xoopsTpl = new XoopsTpl(); |
|
58 | + $xoopsTpl = new XoopsTpl(); |
|
59 | + //--- |
|
60 | 60 | |
61 | - $xoopsTpl->assign('link', $linkObj->toArray()); |
|
62 | - $xoopsTpl->display('db:smartobject_sentlink_display.tpl'); |
|
61 | + $xoopsTpl->assign('link', $linkObj->toArray()); |
|
62 | + $xoopsTpl->display('db:smartobject_sentlink_display.tpl'); |
|
63 | 63 | |
64 | - echo '<br />'; |
|
65 | - smart_close_collapsable('sentlinks'); |
|
66 | - echo '<br>'; |
|
64 | + echo '<br />'; |
|
65 | + smart_close_collapsable('sentlinks'); |
|
66 | + echo '<br>'; |
|
67 | 67 | |
68 | - break; |
|
68 | + break; |
|
69 | 69 | |
70 | - default: |
|
70 | + default: |
|
71 | 71 | |
72 | - smart_xoops_cp_header(); |
|
72 | + smart_xoops_cp_header(); |
|
73 | 73 | |
74 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
74 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
75 | 75 | |
76 | - //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS); |
|
76 | + //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS); |
|
77 | 77 | |
78 | - smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO); |
|
78 | + smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO); |
|
79 | 79 | |
80 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
81 | - $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, array('delete')); |
|
82 | - $objectTable->addColumn(new SmartObjectColumn('date')); |
|
83 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo')); |
|
84 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo')); |
|
85 | - $objectTable->addColumn(new SmartObjectColumn('link')); |
|
80 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
81 | + $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, array('delete')); |
|
82 | + $objectTable->addColumn(new SmartObjectColumn('date')); |
|
83 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo')); |
|
84 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo')); |
|
85 | + $objectTable->addColumn(new SmartObjectColumn('link')); |
|
86 | 86 | |
87 | - $objectTable->addCustomAction('getViewItemLink'); |
|
87 | + $objectTable->addCustomAction('getViewItemLink'); |
|
88 | 88 | |
89 | - $objectTable->setDefaultSort('date'); |
|
90 | - $objectTable->setDefaultOrder('DESC'); |
|
89 | + $objectTable->setDefaultSort('date'); |
|
90 | + $objectTable->setDefaultOrder('DESC'); |
|
91 | 91 | |
92 | - $objectTable->render(); |
|
92 | + $objectTable->render(); |
|
93 | 93 | |
94 | - echo '<br />'; |
|
95 | - smart_close_collapsable('sentlinks'); |
|
96 | - echo '<br>'; |
|
94 | + echo '<br />'; |
|
95 | + smart_close_collapsable('sentlinks'); |
|
96 | + echo '<br>'; |
|
97 | 97 | |
98 | - break; |
|
98 | + break; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | //smart_modFooter(); |
@@ -29,73 +29,73 @@ |
||
29 | 29 | |
30 | 30 | switch ($op) { |
31 | 31 | |
32 | - case 'del': |
|
33 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
34 | - $controller = new SmartObjectController($smartobjectLinkHandler); |
|
35 | - $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); |
|
32 | + case 'del': |
|
33 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
34 | + $controller = new SmartObjectController($smartobjectLinkHandler); |
|
35 | + $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); |
|
36 | 36 | |
37 | - break; |
|
37 | + break; |
|
38 | 38 | |
39 | - case 'view': |
|
40 | - $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; |
|
41 | - $linkObj = $smartobjectLinkHandler->get($linkid); |
|
39 | + case 'view': |
|
40 | + $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; |
|
41 | + $linkObj = $smartobjectLinkHandler->get($linkid); |
|
42 | 42 | |
43 | - if ($linkObj->isNew()) { |
|
44 | - redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND); |
|
45 | - } |
|
43 | + if ($linkObj->isNew()) { |
|
44 | + redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND); |
|
45 | + } |
|
46 | 46 | |
47 | - smart_xoops_cp_header(); |
|
47 | + smart_xoops_cp_header(); |
|
48 | 48 | |
49 | - //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); |
|
49 | + //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); |
|
50 | 50 | |
51 | - smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); |
|
51 | + smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); |
|
52 | 52 | |
53 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
53 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
54 | 54 | |
55 | - // --- |
|
56 | - // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
57 | - // $xoopsTpl = new XoopsTpl(); |
|
58 | - $xoopsTpl = new XoopsTpl(); |
|
59 | - //--- |
|
55 | + // --- |
|
56 | + // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
57 | + // $xoopsTpl = new XoopsTpl(); |
|
58 | + $xoopsTpl = new XoopsTpl(); |
|
59 | + //--- |
|
60 | 60 | |
61 | - $xoopsTpl->assign('link', $linkObj->toArray()); |
|
62 | - $xoopsTpl->display('db:smartobject_sentlink_display.tpl'); |
|
61 | + $xoopsTpl->assign('link', $linkObj->toArray()); |
|
62 | + $xoopsTpl->display('db:smartobject_sentlink_display.tpl'); |
|
63 | 63 | |
64 | - echo '<br />'; |
|
65 | - smart_close_collapsable('sentlinks'); |
|
66 | - echo '<br>'; |
|
64 | + echo '<br />'; |
|
65 | + smart_close_collapsable('sentlinks'); |
|
66 | + echo '<br>'; |
|
67 | 67 | |
68 | - break; |
|
68 | + break; |
|
69 | 69 | |
70 | - default: |
|
70 | + default: |
|
71 | 71 | |
72 | - smart_xoops_cp_header(); |
|
72 | + smart_xoops_cp_header(); |
|
73 | 73 | |
74 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
74 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
75 | 75 | |
76 | - //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS); |
|
76 | + //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS); |
|
77 | 77 | |
78 | - smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO); |
|
78 | + smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO); |
|
79 | 79 | |
80 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
81 | - $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, array('delete')); |
|
82 | - $objectTable->addColumn(new SmartObjectColumn('date')); |
|
83 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo')); |
|
84 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo')); |
|
85 | - $objectTable->addColumn(new SmartObjectColumn('link')); |
|
80 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
81 | + $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, array('delete')); |
|
82 | + $objectTable->addColumn(new SmartObjectColumn('date')); |
|
83 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo')); |
|
84 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo')); |
|
85 | + $objectTable->addColumn(new SmartObjectColumn('link')); |
|
86 | 86 | |
87 | - $objectTable->addCustomAction('getViewItemLink'); |
|
87 | + $objectTable->addCustomAction('getViewItemLink'); |
|
88 | 88 | |
89 | - $objectTable->setDefaultSort('date'); |
|
90 | - $objectTable->setDefaultOrder('DESC'); |
|
89 | + $objectTable->setDefaultSort('date'); |
|
90 | + $objectTable->setDefaultOrder('DESC'); |
|
91 | 91 | |
92 | - $objectTable->render(); |
|
92 | + $objectTable->render(); |
|
93 | 93 | |
94 | - echo '<br />'; |
|
95 | - smart_close_collapsable('sentlinks'); |
|
96 | - echo '<br>'; |
|
94 | + echo '<br />'; |
|
95 | + smart_close_collapsable('sentlinks'); |
|
96 | + echo '<br>'; |
|
97 | 97 | |
98 | - break; |
|
98 | + break; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | //smart_modFooter(); |