@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | function smart_adsense_initiate_smartytags() |
12 | 12 | { |
13 | - global $xoopsTpl, $smartobjectAdsenseHandler; |
|
14 | - if (is_object($xoopsTpl)) { |
|
15 | - foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
16 | - $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
17 | - } |
|
18 | - } |
|
13 | + global $xoopsTpl, $smartobjectAdsenseHandler; |
|
14 | + if (is_object($xoopsTpl)) { |
|
15 | + foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
16 | + $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
17 | + } |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
22 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
@@ -13,17 +13,17 @@ |
||
13 | 13 | global $xoopsTpl, $smartobjectAdsenseHandler; |
14 | 14 | if (is_object($xoopsTpl)) { |
15 | 15 | foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
16 | - $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
16 | + $xoopsTpl->assign('adsense_'.$k, $v->render()); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
22 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
|
26 | -require_once SMARTOBJECT_ROOT_PATH . 'class/adsense.php'; |
|
25 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/functions.php'; |
|
26 | +require_once SMARTOBJECT_ROOT_PATH.'class/adsense.php'; |
|
27 | 27 | |
28 | 28 | $smartobjectAdsenseHandler = xoops_getModuleHandler('adsense', 'smartobject'); |
29 | 29 | $smartobjectAdsensesObj = $smartobjectAdsenseHandler->getAdsensesByTag(); |
@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | function smart_customtag_initiate() |
12 | 12 | { |
13 | - global $xoopsTpl, $smartobjectCustomtagHandler; |
|
14 | - if (is_object($xoopsTpl)) { |
|
15 | - foreach ($smartobjectCustomtagHandler->objects as $k => $v) { |
|
16 | - $xoopsTpl->assign($k, $v->render()); |
|
17 | - } |
|
18 | - } |
|
13 | + global $xoopsTpl, $smartobjectCustomtagHandler; |
|
14 | + if (is_object($xoopsTpl)) { |
|
15 | + foreach ($smartobjectCustomtagHandler->objects as $k => $v) { |
|
16 | + $xoopsTpl->assign($k, $v->render()); |
|
17 | + } |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
22 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | smart_loadLanguageFile('smartobject', 'customtag'); |
@@ -19,13 +19,13 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
22 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | smart_loadLanguageFile('smartobject', 'customtag'); |
26 | 26 | |
27 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
|
28 | -require_once SMARTOBJECT_ROOT_PATH . 'class/customtag.php'; |
|
27 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/functions.php'; |
|
28 | +require_once SMARTOBJECT_ROOT_PATH.'class/customtag.php'; |
|
29 | 29 | |
30 | 30 | $smartobjectCustomtagHandler = xoops_getModuleHandler('customtag', 'smartobject'); |
31 | 31 | $smartobjectCustomTagsObj = $smartobjectCustomtagHandler->getCustomtagsByName(); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
10 | 10 | |
11 | 11 | if (!defined('SMARTOBJECT_URL')) { |
12 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
12 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
13 | 13 | } |
14 | 14 | require_once SMARTOBJECT_ROOT_PATH . 'class/rating.php'; |
15 | 15 | require_once SMARTOBJECT_ROOT_PATH . 'include/functions.php'; |
@@ -23,53 +23,53 @@ discard block |
||
23 | 23 | $smartobjectPluginHandler = new SmartPluginHandler(); |
24 | 24 | $pluginObj = $smartobjectPluginHandler->getPlugin($module_dirname); |
25 | 25 | if ($pluginObj) { |
26 | - $rating_item = $pluginObj->getItem(); |
|
27 | - if ($rating_item) { |
|
28 | - $rating_itemid = $pluginObj->getItemIdForItem($rating_item); |
|
29 | - $stats = $smartobjectRatingHandler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); |
|
30 | - $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); |
|
31 | - $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); |
|
32 | - $xoopsTpl->assign('smartobject_rating_item', $rating_item); |
|
33 | - if (is_object($xoopsUser)) { |
|
34 | - $ratingObj = $smartobjectRatingHandler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); |
|
35 | - $xoopsTpl->assign('smartobject_user_can_rate', true); |
|
36 | - } |
|
37 | - if (isset($ratingObj) && is_object($ratingObj)) { |
|
38 | - $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); |
|
39 | - $xoopsTpl->assign('smartobject_rated', true); |
|
40 | - } else { |
|
41 | - $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); |
|
42 | - $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); |
|
43 | - $urls = smart_getCurrentUrls(); |
|
44 | - $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
|
45 | - if (isset($xoTheme) && is_object($xoTheme)) { |
|
46 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
47 | - } else { |
|
48 | - //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
|
49 | - //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
26 | + $rating_item = $pluginObj->getItem(); |
|
27 | + if ($rating_item) { |
|
28 | + $rating_itemid = $pluginObj->getItemIdForItem($rating_item); |
|
29 | + $stats = $smartobjectRatingHandler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); |
|
30 | + $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); |
|
31 | + $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); |
|
32 | + $xoopsTpl->assign('smartobject_rating_item', $rating_item); |
|
33 | + if (is_object($xoopsUser)) { |
|
34 | + $ratingObj = $smartobjectRatingHandler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); |
|
35 | + $xoopsTpl->assign('smartobject_user_can_rate', true); |
|
36 | + } |
|
37 | + if (isset($ratingObj) && is_object($ratingObj)) { |
|
38 | + $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); |
|
39 | + $xoopsTpl->assign('smartobject_rated', true); |
|
40 | + } else { |
|
41 | + $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); |
|
42 | + $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); |
|
43 | + $urls = smart_getCurrentUrls(); |
|
44 | + $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
|
45 | + if (isset($xoTheme) && is_object($xoTheme)) { |
|
46 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
47 | + } else { |
|
48 | + //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
|
49 | + //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (isset($_POST['smartobject_rating_submit'])) { |
56 | - // The rating form has just been posted. Let's save the info |
|
57 | - $ratingObj = $smartobjectRatingHandler->create(); |
|
58 | - $ratingObj->setVar('dirname', $module_dirname); |
|
59 | - $ratingObj->setVar('item', $rating_item); |
|
60 | - $ratingObj->setVar('itemid', $rating_itemid); |
|
61 | - $ratingObj->setVar('uid', $xoopsUser->getVar('uid')); |
|
62 | - $ratingObj->setVar('date', time()); |
|
63 | - $ratingObj->setVar('rate', $_POST['smartobject_rating_value']); |
|
64 | - if (!$smartobjectRatingHandler->insert($ratingObj)) { |
|
65 | - if ($xoopsDB->errno() == 1062) { |
|
66 | - $message = _SOBJECT_RATING_DUPLICATE_ENTRY; |
|
67 | - } else { |
|
68 | - $message = _SOBJECT_RATING_ERROR; |
|
69 | - } |
|
70 | - } else { |
|
71 | - $message = _SOBJECT_RATING_SUCCESS; |
|
72 | - } |
|
73 | - redirect_header('', 3, $message); |
|
74 | - exit; |
|
56 | + // The rating form has just been posted. Let's save the info |
|
57 | + $ratingObj = $smartobjectRatingHandler->create(); |
|
58 | + $ratingObj->setVar('dirname', $module_dirname); |
|
59 | + $ratingObj->setVar('item', $rating_item); |
|
60 | + $ratingObj->setVar('itemid', $rating_itemid); |
|
61 | + $ratingObj->setVar('uid', $xoopsUser->getVar('uid')); |
|
62 | + $ratingObj->setVar('date', time()); |
|
63 | + $ratingObj->setVar('rate', $_POST['smartobject_rating_value']); |
|
64 | + if (!$smartobjectRatingHandler->insert($ratingObj)) { |
|
65 | + if ($xoopsDB->errno() == 1062) { |
|
66 | + $message = _SOBJECT_RATING_DUPLICATE_ENTRY; |
|
67 | + } else { |
|
68 | + $message = _SOBJECT_RATING_ERROR; |
|
69 | + } |
|
70 | + } else { |
|
71 | + $message = _SOBJECT_RATING_SUCCESS; |
|
72 | + } |
|
73 | + redirect_header('', 3, $message); |
|
74 | + exit; |
|
75 | 75 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
10 | 10 | |
11 | 11 | if (!defined('SMARTOBJECT_URL')) { |
12 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
12 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
13 | 13 | } |
14 | -require_once SMARTOBJECT_ROOT_PATH . 'class/rating.php'; |
|
15 | -require_once SMARTOBJECT_ROOT_PATH . 'include/functions.php'; |
|
14 | +require_once SMARTOBJECT_ROOT_PATH.'class/rating.php'; |
|
15 | +require_once SMARTOBJECT_ROOT_PATH.'include/functions.php'; |
|
16 | 16 | |
17 | 17 | smart_loadLanguageFile('smartobject', 'rating'); |
18 | 18 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $urls = smart_getCurrentUrls(); |
44 | 44 | $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
45 | 45 | if (isset($xoTheme) && is_object($xoTheme)) { |
46 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
46 | + $xoTheme->addStylesheet(SMARTOBJECT_URL.'assets/css/module.css'); |
|
47 | 47 | } else { |
48 | 48 | //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
49 | 49 | //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
@@ -14,16 +14,16 @@ |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | if (!class_exists('Projax')) { |
17 | - include __DIR__ . '/classes/JavaScript.php'; |
|
18 | - include __DIR__ . '/classes/Prototype.php'; |
|
19 | - include __DIR__ . '/classes/Scriptaculous.php'; |
|
17 | + include __DIR__ . '/classes/JavaScript.php'; |
|
18 | + include __DIR__ . '/classes/Prototype.php'; |
|
19 | + include __DIR__ . '/classes/Scriptaculous.php'; |
|
20 | 20 | |
21 | - // For $projax = new Projax(); |
|
21 | + // For $projax = new Projax(); |
|
22 | 22 | |
23 | - /** |
|
24 | - * Class projax |
|
25 | - */ |
|
26 | - class projax extends Scriptaculous |
|
27 | - { |
|
28 | - } |
|
23 | + /** |
|
24 | + * Class projax |
|
25 | + */ |
|
26 | + class projax extends Scriptaculous |
|
27 | + { |
|
28 | + } |
|
29 | 29 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | if (!class_exists('Projax')) { |
17 | - include __DIR__ . '/classes/JavaScript.php'; |
|
18 | - include __DIR__ . '/classes/Prototype.php'; |
|
19 | - include __DIR__ . '/classes/Scriptaculous.php'; |
|
17 | + include __DIR__.'/classes/JavaScript.php'; |
|
18 | + include __DIR__.'/classes/Prototype.php'; |
|
19 | + include __DIR__.'/classes/Scriptaculous.php'; |
|
20 | 20 | |
21 | 21 | // For $projax = new Projax(); |
22 | 22 |
@@ -38,60 +38,60 @@ |
||
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( |
|
55 | - $caption = '', |
|
56 | - $name = 'xoopscaptcha', |
|
57 | - $skipmember = null, |
|
58 | - $numchar = null, |
|
59 | - $minfontsize = null, |
|
60 | - $maxfontsize = null, |
|
61 | - $backgroundtype = null, |
|
62 | - $backgroundnum = null |
|
63 | - ) { |
|
64 | - if (!class_exists('XoopsCaptcaha')) { |
|
65 | - require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php'; |
|
66 | - } |
|
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( |
|
55 | + $caption = '', |
|
56 | + $name = 'xoopscaptcha', |
|
57 | + $skipmember = null, |
|
58 | + $numchar = null, |
|
59 | + $minfontsize = null, |
|
60 | + $maxfontsize = null, |
|
61 | + $backgroundtype = null, |
|
62 | + $backgroundnum = null |
|
63 | + ) { |
|
64 | + if (!class_exists('XoopsCaptcaha')) { |
|
65 | + require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php'; |
|
66 | + } |
|
67 | 67 | |
68 | - $this->_captchaHandler = XoopsCaptcha::getInstance(); |
|
69 | - $this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum); |
|
70 | - if (!$this->_captchaHandler->active) { |
|
71 | - $this->setHidden(); |
|
72 | - } else { |
|
73 | - $caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption(); |
|
74 | - $this->setCaption($caption); |
|
75 | - } |
|
76 | - } |
|
68 | + $this->_captchaHandler = XoopsCaptcha::getInstance(); |
|
69 | + $this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum); |
|
70 | + if (!$this->_captchaHandler->active) { |
|
71 | + $this->setHidden(); |
|
72 | + } else { |
|
73 | + $caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption(); |
|
74 | + $this->setCaption($caption); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param $name |
|
80 | - * @param $val |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function setConfig($name, $val) |
|
84 | - { |
|
85 | - return $this->_captchaHandler->setConfig($name, $val); |
|
86 | - } |
|
78 | + /** |
|
79 | + * @param $name |
|
80 | + * @param $val |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function setConfig($name, $val) |
|
84 | + { |
|
85 | + return $this->_captchaHandler->setConfig($name, $val); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @return mixed|string |
|
90 | - */ |
|
91 | - public function render() |
|
92 | - { |
|
93 | - if (!$this->isHidden()) { |
|
94 | - return $this->_captchaHandler->render(); |
|
95 | - } |
|
96 | - } |
|
88 | + /** |
|
89 | + * @return mixed|string |
|
90 | + */ |
|
91 | + public function render() |
|
92 | + { |
|
93 | + if (!$this->isHidden()) { |
|
94 | + return $this->_captchaHandler->render(); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
15 | 15 | |
16 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; |
|
16 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
|
17 | 17 | |
18 | 18 | /* |
19 | 19 | * Usage |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $backgroundnum = null |
63 | 63 | ) { |
64 | 64 | if (!class_exists('XoopsCaptcaha')) { |
65 | - require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php'; |
|
65 | + require_once SMARTOBJECT_ROOT_PATH.'/include/captcha/captcha.php'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $this->_captchaHandler = XoopsCaptcha::getInstance(); |
@@ -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 static function getInstance() |
|
24 | - { |
|
25 | - static $instance; |
|
26 | - if (null === $instance) { |
|
27 | - $instance = new static(); |
|
28 | - } |
|
20 | + /** |
|
21 | + * @return XoopsCaptchaText |
|
22 | + */ |
|
23 | + public static function getInstance() |
|
24 | + { |
|
25 | + static $instance; |
|
26 | + if (null === $instance) { |
|
27 | + $instance = new static(); |
|
28 | + } |
|
29 | 29 | |
30 | - return $instance; |
|
31 | - } |
|
30 | + return $instance; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Loading configs from CAPTCHA class |
|
35 | - * @param array $config |
|
36 | - */ |
|
37 | - public function loadConfig($config = array()) |
|
38 | - { |
|
39 | - // Loading default preferences |
|
40 | - $this->config = $config; |
|
41 | - } |
|
33 | + /** |
|
34 | + * Loading configs from CAPTCHA class |
|
35 | + * @param array $config |
|
36 | + */ |
|
37 | + public function loadConfig($config = array()) |
|
38 | + { |
|
39 | + // Loading default preferences |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - 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 @@ discard block |
||
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 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function render() |
52 | 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=''>"; |
|
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 | 54 | $rule = constant('XOOPS_CAPTCHA_RULE_TEXT'); |
55 | 55 | if (!empty($rule)) { |
56 | 56 | $form .= " <small>{$rule}</small>"; |
@@ -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 static function getInstance() |
|
24 | - { |
|
25 | - static $instance; |
|
26 | - if (null === $instance) { |
|
27 | - $instance = new static(); |
|
28 | - } |
|
20 | + /** |
|
21 | + * @return XoopsCaptchaImage |
|
22 | + */ |
|
23 | + public static function getInstance() |
|
24 | + { |
|
25 | + static $instance; |
|
26 | + if (null === $instance) { |
|
27 | + $instance = new static(); |
|
28 | + } |
|
29 | 29 | |
30 | - return $instance; |
|
31 | - } |
|
30 | + return $instance; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Loading configs from CAPTCHA class |
|
35 | - * @param array $config |
|
36 | - */ |
|
37 | - public function loadConfig($config = array()) |
|
38 | - { |
|
39 | - // Loading default preferences |
|
40 | - $this->config = $config; |
|
41 | - } |
|
33 | + /** |
|
34 | + * Loading configs from CAPTCHA class |
|
35 | + * @param array $config |
|
36 | + */ |
|
37 | + public function loadConfig($config = array()) |
|
38 | + { |
|
39 | + // Loading default preferences |
|
40 | + $this->config = $config; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return string |
|
45 | - */ |
|
46 | - public function render() |
|
47 | - { |
|
48 | - $form = "<input type='text' name='" . $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 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function render() |
47 | 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(); |
|
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 | 49 | $rule = htmlspecialchars(XOOPS_CAPTCHA_REFRESH, ENT_QUOTES); |
50 | 50 | if ($this->config['maxattempt']) { |
51 | - $rule .= ' | ' . sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']); |
|
51 | + $rule .= ' | '.sprintf(constant('XOOPS_CAPTCHA_MAXATTEMPTS'), $this->config['maxattempt']); |
|
52 | 52 | } |
53 | 53 | $form .= " <small>{$rule}</small>"; |
54 | 54 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function loadImage() |
62 | 62 | { |
63 | 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) . "'>"; |
|
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 | 66 | return $ret; |
67 | 67 | } |
@@ -12,40 +12,40 @@ |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | $config = array( |
15 | - 'mode' => 'image', |
|
16 | - 'name' => 'xoopscaptcha', |
|
17 | - 'skipmember' => true, |
|
18 | - // Skip CAPTCHA check for members |
|
19 | - 'maxattempt' => 100, |
|
20 | - // Maximum attempts for each session |
|
15 | + 'mode' => 'image', |
|
16 | + 'name' => 'xoopscaptcha', |
|
17 | + 'skipmember' => true, |
|
18 | + // Skip CAPTCHA check for members |
|
19 | + 'maxattempt' => 100, |
|
20 | + // Maximum attempts for each session |
|
21 | 21 | |
22 | - 'num_chars' => 4, |
|
23 | - // Maximum characters |
|
22 | + 'num_chars' => 4, |
|
23 | + // Maximum characters |
|
24 | 24 | |
25 | - // For image mode, based on DuGris' SecurityImage |
|
26 | - 'rootpath' => __DIR__, |
|
27 | - // __Absolute__ Path to the root of fonts and backgrounds |
|
28 | - 'imagepath' => 'uploads/captcha', |
|
29 | - // Path to temporary image files, __relative__ to XOOPS_ROOT_PATH |
|
30 | - 'imageurl' => 'modules/smartobject/include/captcha/scripts/img.php', |
|
31 | - // Path to the script for creating image, __relative__ to XOOPS_ROOT_PATH |
|
32 | - 'casesensitive' => false, |
|
33 | - // Characters in image mode is case-sensitive |
|
34 | - 'fontsize_min' => 12, |
|
35 | - // Minimum font-size |
|
36 | - 'fontsize_max' => 12, |
|
37 | - // Maximum font-size |
|
38 | - 'background_type' => 0, |
|
39 | - // Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files |
|
40 | - 'background_num' => 50, |
|
41 | - // Number of background images to generate |
|
42 | - 'polygon_point' => 3 |
|
25 | + // For image mode, based on DuGris' SecurityImage |
|
26 | + 'rootpath' => __DIR__, |
|
27 | + // __Absolute__ Path to the root of fonts and backgrounds |
|
28 | + 'imagepath' => 'uploads/captcha', |
|
29 | + // Path to temporary image files, __relative__ to XOOPS_ROOT_PATH |
|
30 | + 'imageurl' => 'modules/smartobject/include/captcha/scripts/img.php', |
|
31 | + // Path to the script for creating image, __relative__ to XOOPS_ROOT_PATH |
|
32 | + 'casesensitive' => false, |
|
33 | + // Characters in image mode is case-sensitive |
|
34 | + 'fontsize_min' => 12, |
|
35 | + // Minimum font-size |
|
36 | + 'fontsize_max' => 12, |
|
37 | + // Maximum font-size |
|
38 | + 'background_type' => 0, |
|
39 | + // Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files |
|
40 | + 'background_num' => 50, |
|
41 | + // Number of background images to generate |
|
42 | + 'polygon_point' => 3 |
|
43 | 43 | ); |
44 | 44 | |
45 | 45 | $language = preg_replace("/[^a-z0-9_\-]/i", '', $GLOBALS['xoopsConfig']['language']); |
46 | 46 | |
47 | 47 | if (!@require_once __DIR__ . "/language/{$language}.php") { |
48 | - require_once __DIR__ . '/language/english.php'; |
|
48 | + require_once __DIR__ . '/language/english.php'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $config; |
@@ -44,8 +44,8 @@ |
||
44 | 44 | |
45 | 45 | $language = preg_replace("/[^a-z0-9_\-]/i", '', $GLOBALS['xoopsConfig']['language']); |
46 | 46 | |
47 | -if (!@require_once __DIR__ . "/language/{$language}.php") { |
|
48 | - require_once __DIR__ . '/language/english.php'; |
|
47 | +if (!@require_once __DIR__."/language/{$language}.php") { |
|
48 | + require_once __DIR__.'/language/english.php'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $config; |
@@ -13,9 +13,9 @@ |
||
13 | 13 | * @filesource |
14 | 14 | */ |
15 | 15 | |
16 | -include __DIR__ . '/classes/JavaScript.php'; |
|
17 | -__DIR__ . '/classes/Prototype.php'; |
|
18 | -__DIR__ . '/classes/Scriptaculous.php'; |
|
16 | +include __DIR__.'/classes/JavaScript.php'; |
|
17 | +__DIR__.'/classes/Prototype.php'; |
|
18 | +__DIR__.'/classes/Scriptaculous.php'; |
|
19 | 19 | |
20 | 20 | // For $projax = new Projax(); |
21 | 21 |