@@ -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 | |
@@ -28,26 +28,26 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function xoops_module_update_smartobject(XoopsModule $module) |
| 30 | 30 | { |
| 31 | - ob_start(); |
|
| 31 | + ob_start(); |
|
| 32 | 32 | |
| 33 | - $dbVersion = smart_GetMeta('version', 'smartobject'); |
|
| 34 | - if (!$dbVersion) { |
|
| 35 | - $dbVersion = 0; |
|
| 36 | - } |
|
| 33 | + $dbVersion = smart_GetMeta('version', 'smartobject'); |
|
| 34 | + if (!$dbVersion) { |
|
| 35 | + $dbVersion = 0; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $dbupdater = new SmartobjectDbupdater(); |
|
| 38 | + $dbupdater = new SmartobjectDbupdater(); |
|
| 39 | 39 | |
| 40 | - echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
| 40 | + echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
| 41 | 41 | |
| 42 | - // db migrate version = 1 |
|
| 43 | - $newDbVersion = 1; |
|
| 44 | - if ($dbVersion < $newDbVersion) { |
|
| 45 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 42 | + // db migrate version = 1 |
|
| 43 | + $newDbVersion = 1; |
|
| 44 | + if ($dbVersion < $newDbVersion) { |
|
| 45 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 46 | 46 | |
| 47 | - // Create table smartobject_link |
|
| 48 | - $table = new SmartDbTable('smartobject_link'); |
|
| 49 | - if (!$table->exists()) { |
|
| 50 | - $table->setStructure("CREATE TABLE %s ( |
|
| 47 | + // Create table smartobject_link |
|
| 48 | + $table = new SmartDbTable('smartobject_link'); |
|
| 49 | + if (!$table->exists()) { |
|
| 50 | + $table->setStructure("CREATE TABLE %s ( |
|
| 51 | 51 | `linkid` int(11) NOT NULL auto_increment, |
| 52 | 52 | `from_uid` int(11) NOT NULL default '0', |
| 53 | 53 | `from_email` varchar(255) NOT NULL default '', |
@@ -64,63 +64,63 @@ discard block |
||
| 64 | 64 | PRIMARY KEY (`linkid`) |
| 65 | 65 | ) ENGINE=MyISAM COMMENT='SmartObject by The SmartFactory <www.smartfactory.ca>' AUTO_INCREMENT=1 ;"); |
| 66 | 66 | |
| 67 | - if (!$dbupdater->updateTable($table)) { |
|
| 68 | - /** |
|
| 69 | - * @todo trap the errors |
|
| 70 | - */ |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - unset($table); |
|
| 74 | - // Create table smartobject_link |
|
| 75 | - $table = new SmartDbTable('smartobject_link'); |
|
| 76 | - if (!$table->fieldExists('date')) { |
|
| 77 | - $table->addNewField('date', "int(11) NOT NULL default '0'"); |
|
| 78 | - if (!$dbupdater->updateTable($table)) { |
|
| 79 | - /** |
|
| 80 | - * @todo trap the errors |
|
| 81 | - */ |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - unset($table); |
|
| 85 | - |
|
| 86 | - // Create table smartobject_tag |
|
| 87 | - $table = new SmartDbTable('smartobject_tag'); |
|
| 88 | - if (!$table->exists()) { |
|
| 89 | - $table->setStructure("CREATE TABLE %s ( |
|
| 67 | + if (!$dbupdater->updateTable($table)) { |
|
| 68 | + /** |
|
| 69 | + * @todo trap the errors |
|
| 70 | + */ |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + unset($table); |
|
| 74 | + // Create table smartobject_link |
|
| 75 | + $table = new SmartDbTable('smartobject_link'); |
|
| 76 | + if (!$table->fieldExists('date')) { |
|
| 77 | + $table->addNewField('date', "int(11) NOT NULL default '0'"); |
|
| 78 | + if (!$dbupdater->updateTable($table)) { |
|
| 79 | + /** |
|
| 80 | + * @todo trap the errors |
|
| 81 | + */ |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + unset($table); |
|
| 85 | + |
|
| 86 | + // Create table smartobject_tag |
|
| 87 | + $table = new SmartDbTable('smartobject_tag'); |
|
| 88 | + if (!$table->exists()) { |
|
| 89 | + $table->setStructure("CREATE TABLE %s ( |
|
| 90 | 90 | `tagid` int(11) NOT NULL auto_increment, |
| 91 | 91 | `name` varchar(255) NOT NULL default '', |
| 92 | 92 | `description` TEXT NOT NULL, |
| 93 | 93 | PRIMARY KEY (`id`) |
| 94 | 94 | ) ENGINE=MyISAM COMMENT='SmartObject by The SmartFactory <www.smartfactory.ca>' AUTO_INCREMENT=1 ;"); |
| 95 | 95 | |
| 96 | - if (!$dbupdater->updateTable($table)) { |
|
| 97 | - /** |
|
| 98 | - * @todo trap the errors |
|
| 99 | - */ |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - // Create table smartobject_tag_text |
|
| 104 | - $table = new SmartDbTable('smartobject_tag_text'); |
|
| 105 | - if (!$table->exists()) { |
|
| 106 | - $table->setStructure("CREATE TABLE %s ( |
|
| 96 | + if (!$dbupdater->updateTable($table)) { |
|
| 97 | + /** |
|
| 98 | + * @todo trap the errors |
|
| 99 | + */ |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + // Create table smartobject_tag_text |
|
| 104 | + $table = new SmartDbTable('smartobject_tag_text'); |
|
| 105 | + if (!$table->exists()) { |
|
| 106 | + $table->setStructure("CREATE TABLE %s ( |
|
| 107 | 107 | `tagid` int(11) NOT NULL default 0, |
| 108 | 108 | `language` varchar(255) NOT NULL default '', |
| 109 | 109 | `value` TEXT NOT NULL, |
| 110 | 110 | PRIMARY KEY (`id`, `language`) |
| 111 | 111 | ) ENGINE=MyISAM COMMENT='SmartObject by The SmartFactory <www.smartfactory.ca>' AUTO_INCREMENT=1 ;"); |
| 112 | 112 | |
| 113 | - if (!$dbupdater->updateTable($table)) { |
|
| 114 | - /** |
|
| 115 | - * @todo trap the errors |
|
| 116 | - */ |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - // Create table smartobject_adsense |
|
| 121 | - $table = new SmartDbTable('smartobject_adsense'); |
|
| 122 | - if (!$table->exists()) { |
|
| 123 | - $table->setStructure(" |
|
| 113 | + if (!$dbupdater->updateTable($table)) { |
|
| 114 | + /** |
|
| 115 | + * @todo trap the errors |
|
| 116 | + */ |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + // Create table smartobject_adsense |
|
| 121 | + $table = new SmartDbTable('smartobject_adsense'); |
|
| 122 | + if (!$table->exists()) { |
|
| 123 | + $table->setStructure(" |
|
| 124 | 124 | `adsenseid` int(11) NOT NULL auto_increment, |
| 125 | 125 | `format` VARCHAR(100) NOT NULL, |
| 126 | 126 | `description` TEXT NOT NULL, |
@@ -134,23 +134,23 @@ discard block |
||
| 134 | 134 | `tag` varchar(50) NOT NULL default '', |
| 135 | 135 | PRIMARY KEY (`adsenseid`) |
| 136 | 136 | "); |
| 137 | - } |
|
| 138 | - |
|
| 139 | - if (!$dbupdater->updateTable($table)) { |
|
| 140 | - /** |
|
| 141 | - * @todo trap the errors |
|
| 142 | - */ |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - // db migrate version = 2 |
|
| 146 | - $newDbVersion = 2; |
|
| 147 | - if ($dbVersion < $newDbVersion) { |
|
| 148 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 149 | - |
|
| 150 | - // Create table smartobject_rating |
|
| 151 | - $table = new SmartDbTable('smartobject_rating'); |
|
| 152 | - if (!$table->exists()) { |
|
| 153 | - $table->setStructure(' |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + if (!$dbupdater->updateTable($table)) { |
|
| 140 | + /** |
|
| 141 | + * @todo trap the errors |
|
| 142 | + */ |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + // db migrate version = 2 |
|
| 146 | + $newDbVersion = 2; |
|
| 147 | + if ($dbVersion < $newDbVersion) { |
|
| 148 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 149 | + |
|
| 150 | + // Create table smartobject_rating |
|
| 151 | + $table = new SmartDbTable('smartobject_rating'); |
|
| 152 | + if (!$table->exists()) { |
|
| 153 | + $table->setStructure(' |
|
| 154 | 154 | `ratingid` int(11) NOT NULL auto_increment, |
| 155 | 155 | `dirname` VARCHAR(255) NOT NULL, |
| 156 | 156 | `item` VARCHAR(255) NOT NULL, |
@@ -161,36 +161,36 @@ discard block |
||
| 161 | 161 | PRIMARY KEY (`ratingid`), |
| 162 | 162 | UNIQUE (`dirname`, `item`, `itemid`, `uid`) |
| 163 | 163 | '); |
| 164 | - } |
|
| 165 | - |
|
| 166 | - if (!$dbupdater->updateTable($table)) { |
|
| 167 | - /** |
|
| 168 | - * @todo trap the errors |
|
| 169 | - */ |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - // Create table smartobject_currency |
|
| 173 | - $table = new SmartDbTable('smartobject_currency'); |
|
| 174 | - $table->setData("2, 'EUR', 'Euro', '�', 0.65, 0"); |
|
| 175 | - $table->setData("3, 'USD', 'American dollar', '$', 0.9, 0"); |
|
| 176 | - $table->setData("1, 'CAD', 'Canadian dollar', '$', 1, 1"); |
|
| 177 | - |
|
| 178 | - if (!$dbupdater->updateTable($table)) { |
|
| 179 | - /** |
|
| 180 | - * @todo trap the errors |
|
| 181 | - */ |
|
| 182 | - } |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - // db migrate version = 3 |
|
| 186 | - $newDbVersion = 3; |
|
| 187 | - if ($dbVersion < $newDbVersion) { |
|
| 188 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 189 | - |
|
| 190 | - // Create table smartobject_customtag |
|
| 191 | - $table = new SmartDbTable('smartobject_customtag'); |
|
| 192 | - if (!$table->exists()) { |
|
| 193 | - $table->setStructure(' |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if (!$dbupdater->updateTable($table)) { |
|
| 167 | + /** |
|
| 168 | + * @todo trap the errors |
|
| 169 | + */ |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + // Create table smartobject_currency |
|
| 173 | + $table = new SmartDbTable('smartobject_currency'); |
|
| 174 | + $table->setData("2, 'EUR', 'Euro', '�', 0.65, 0"); |
|
| 175 | + $table->setData("3, 'USD', 'American dollar', '$', 0.9, 0"); |
|
| 176 | + $table->setData("1, 'CAD', 'Canadian dollar', '$', 1, 1"); |
|
| 177 | + |
|
| 178 | + if (!$dbupdater->updateTable($table)) { |
|
| 179 | + /** |
|
| 180 | + * @todo trap the errors |
|
| 181 | + */ |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + // db migrate version = 3 |
|
| 186 | + $newDbVersion = 3; |
|
| 187 | + if ($dbVersion < $newDbVersion) { |
|
| 188 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 189 | + |
|
| 190 | + // Create table smartobject_customtag |
|
| 191 | + $table = new SmartDbTable('smartobject_customtag'); |
|
| 192 | + if (!$table->exists()) { |
|
| 193 | + $table->setStructure(' |
|
| 194 | 194 | `customtagid` int(11) NOT NULL auto_increment, |
| 195 | 195 | `name` VARCHAR(255) NOT NULL, |
| 196 | 196 | `description` TEXT NOT NULL, |
@@ -198,24 +198,24 @@ discard block |
||
| 198 | 198 | `language` TEXT NOT NULL, |
| 199 | 199 | PRIMARY KEY (`customtagid`) |
| 200 | 200 | '); |
| 201 | - } |
|
| 202 | - |
|
| 203 | - if (!$dbupdater->updateTable($table)) { |
|
| 204 | - /** |
|
| 205 | - * @todo trap the errors |
|
| 206 | - */ |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - // db migrate version = 4 |
|
| 211 | - $newDbVersion = 4; |
|
| 212 | - if ($dbVersion < $newDbVersion) { |
|
| 213 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 214 | - |
|
| 215 | - // Create table smartobject_currency |
|
| 216 | - $table = new SmartDbTable('smartobject_currency'); |
|
| 217 | - if (!$table->exists()) { |
|
| 218 | - $table->setStructure(' |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if (!$dbupdater->updateTable($table)) { |
|
| 204 | + /** |
|
| 205 | + * @todo trap the errors |
|
| 206 | + */ |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + // db migrate version = 4 |
|
| 211 | + $newDbVersion = 4; |
|
| 212 | + if ($dbVersion < $newDbVersion) { |
|
| 213 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 214 | + |
|
| 215 | + // Create table smartobject_currency |
|
| 216 | + $table = new SmartDbTable('smartobject_currency'); |
|
| 217 | + if (!$table->exists()) { |
|
| 218 | + $table->setStructure(' |
|
| 219 | 219 | `currencyid` int(11) NOT NULL auto_increment, |
| 220 | 220 | `iso4217` VARCHAR(5) NOT NULL, |
| 221 | 221 | `name` VARCHAR(255) NOT NULL, |
@@ -224,46 +224,46 @@ discard block |
||
| 224 | 224 | `default_currency` int(1) NOT NULL, |
| 225 | 225 | PRIMARY KEY (`currencyid`) |
| 226 | 226 | '); |
| 227 | - } |
|
| 228 | - |
|
| 229 | - if (!$dbupdater->updateTable($table)) { |
|
| 230 | - /** |
|
| 231 | - * @todo trap the errors |
|
| 232 | - */ |
|
| 233 | - } |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - // db migrate version = 6 |
|
| 237 | - $newDbVersion = 6; |
|
| 238 | - if ($dbVersion < $newDbVersion) { |
|
| 239 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - $newDbVersion = 7; |
|
| 243 | - if ($dbVersion < $newDbVersion) { |
|
| 244 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 245 | - |
|
| 246 | - // Create table smartobject_file |
|
| 247 | - $table = new SmartDbTable('smartobject_file'); |
|
| 248 | - if (!$table->exists()) { |
|
| 249 | - $table->setStructure(' |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + if (!$dbupdater->updateTable($table)) { |
|
| 230 | + /** |
|
| 231 | + * @todo trap the errors |
|
| 232 | + */ |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + // db migrate version = 6 |
|
| 237 | + $newDbVersion = 6; |
|
| 238 | + if ($dbVersion < $newDbVersion) { |
|
| 239 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + $newDbVersion = 7; |
|
| 243 | + if ($dbVersion < $newDbVersion) { |
|
| 244 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 245 | + |
|
| 246 | + // Create table smartobject_file |
|
| 247 | + $table = new SmartDbTable('smartobject_file'); |
|
| 248 | + if (!$table->exists()) { |
|
| 249 | + $table->setStructure(' |
|
| 250 | 250 | `fileid` int(11) NOT NULL auto_increment, |
| 251 | 251 | `caption` varchar(255) collate latin1_general_ci NOT NULL, |
| 252 | 252 | `url` varchar(255) collate latin1_general_ci NOT NULL, |
| 253 | 253 | `description` text collate latin1_general_ci NOT NULL, |
| 254 | 254 | PRIMARY KEY (`fileid`) |
| 255 | 255 | '); |
| 256 | - if (!$dbupdater->updateTable($table)) { |
|
| 257 | - /** |
|
| 258 | - * @todo trap the errors |
|
| 259 | - */ |
|
| 260 | - } |
|
| 261 | - } |
|
| 262 | - unset($table); |
|
| 263 | - // Create table smartobject_urllink |
|
| 264 | - $table = new SmartDbTable('smartobject_urllink'); |
|
| 265 | - if (!$table->exists()) { |
|
| 266 | - $table->setStructure(' |
|
| 256 | + if (!$dbupdater->updateTable($table)) { |
|
| 257 | + /** |
|
| 258 | + * @todo trap the errors |
|
| 259 | + */ |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | + unset($table); |
|
| 263 | + // Create table smartobject_urllink |
|
| 264 | + $table = new SmartDbTable('smartobject_urllink'); |
|
| 265 | + if (!$table->exists()) { |
|
| 266 | + $table->setStructure(' |
|
| 267 | 267 | `urllinkid` int(11) NOT NULL auto_increment, |
| 268 | 268 | `caption` varchar(255) collate latin1_general_ci NOT NULL, |
| 269 | 269 | `url` varchar(255) collate latin1_general_ci NOT NULL, |
@@ -271,25 +271,25 @@ discard block |
||
| 271 | 271 | `target` varchar(10) collate latin1_general_ci NOT NULL, |
| 272 | 272 | PRIMARY KEY (`urllinkid`) |
| 273 | 273 | '); |
| 274 | - if (!$dbupdater->updateTable($table)) { |
|
| 275 | - /** |
|
| 276 | - * @todo trap the errors |
|
| 277 | - */ |
|
| 278 | - } |
|
| 279 | - } |
|
| 280 | - unset($table); |
|
| 281 | - } |
|
| 282 | - echo '</code>'; |
|
| 283 | - |
|
| 284 | - $feedback = ob_get_clean(); |
|
| 285 | - if (method_exists($module, 'setMessage')) { |
|
| 286 | - $module->setMessage($feedback); |
|
| 287 | - } else { |
|
| 288 | - echo $feedback; |
|
| 289 | - } |
|
| 290 | - smart_SetMeta('version', $newDbVersion, 'smartobject'); //Set meta version to current |
|
| 291 | - |
|
| 292 | - return true; |
|
| 274 | + if (!$dbupdater->updateTable($table)) { |
|
| 275 | + /** |
|
| 276 | + * @todo trap the errors |
|
| 277 | + */ |
|
| 278 | + } |
|
| 279 | + } |
|
| 280 | + unset($table); |
|
| 281 | + } |
|
| 282 | + echo '</code>'; |
|
| 283 | + |
|
| 284 | + $feedback = ob_get_clean(); |
|
| 285 | + if (method_exists($module, 'setMessage')) { |
|
| 286 | + $module->setMessage($feedback); |
|
| 287 | + } else { |
|
| 288 | + echo $feedback; |
|
| 289 | + } |
|
| 290 | + smart_SetMeta('version', $newDbVersion, 'smartobject'); //Set meta version to current |
|
| 291 | + |
|
| 292 | + return true; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | function xoops_module_install_smartobject(XoopsModule $module) |
| 300 | 300 | { |
| 301 | - ob_start(); |
|
| 301 | + ob_start(); |
|
| 302 | 302 | |
| 303 | - echo 'Using the ImpressCMS onInstall event'; |
|
| 304 | - $feedback = ob_get_clean(); |
|
| 303 | + echo 'Using the ImpressCMS onInstall event'; |
|
| 304 | + $feedback = ob_get_clean(); |
|
| 305 | 305 | |
| 306 | - return $feedback; |
|
| 306 | + return $feedback; |
|
| 307 | 307 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 21 | 21 | |
| 22 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
| 23 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartdbupdater.php'; |
|
| 22 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
| 23 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartdbupdater.php'; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @param XoopsModule $module |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $dbupdater = new SmartobjectDbupdater(); |
| 39 | 39 | |
| 40 | - echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
| 40 | + echo '<code>'._SDU_UPDATE_UPDATING_DATABASE.'<br>'; |
|
| 41 | 41 | |
| 42 | 42 | // db migrate version = 1 |
| 43 | 43 | $newDbVersion = 1; |
| 44 | 44 | if ($dbVersion < $newDbVersion) { |
| 45 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 45 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
| 46 | 46 | |
| 47 | 47 | // Create table smartobject_link |
| 48 | 48 | $table = new SmartDbTable('smartobject_link'); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | // db migrate version = 2 |
| 146 | 146 | $newDbVersion = 2; |
| 147 | 147 | if ($dbVersion < $newDbVersion) { |
| 148 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 148 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
| 149 | 149 | |
| 150 | 150 | // Create table smartobject_rating |
| 151 | 151 | $table = new SmartDbTable('smartobject_rating'); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // db migrate version = 3 |
| 186 | 186 | $newDbVersion = 3; |
| 187 | 187 | if ($dbVersion < $newDbVersion) { |
| 188 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 188 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
| 189 | 189 | |
| 190 | 190 | // Create table smartobject_customtag |
| 191 | 191 | $table = new SmartDbTable('smartobject_customtag'); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | // db migrate version = 4 |
| 211 | 211 | $newDbVersion = 4; |
| 212 | 212 | if ($dbVersion < $newDbVersion) { |
| 213 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 213 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
| 214 | 214 | |
| 215 | 215 | // Create table smartobject_currency |
| 216 | 216 | $table = new SmartDbTable('smartobject_currency'); |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | // db migrate version = 6 |
| 237 | 237 | $newDbVersion = 6; |
| 238 | 238 | if ($dbVersion < $newDbVersion) { |
| 239 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 239 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $newDbVersion = 7; |
| 243 | 243 | if ($dbVersion < $newDbVersion) { |
| 244 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
| 244 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
| 245 | 245 | |
| 246 | 246 | // Create table smartobject_file |
| 247 | 247 | $table = new SmartDbTable('smartobject_file'); |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | |
| 10 | 10 | function smartobject_plugin_smartband() |
| 11 | 11 | { |
| 12 | - global $xoopsConfig; |
|
| 13 | - require_once XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 12 | + global $xoopsConfig; |
|
| 13 | + require_once XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 14 | 14 | |
| 15 | - $pluginInfo = array(); |
|
| 16 | - $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP; |
|
| 17 | - $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 18 | - $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 15 | + $pluginInfo = array(); |
|
| 16 | + $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP; |
|
| 17 | + $pluginInfo['items']['item']['url'] = 'item.php?itemid=%u'; |
|
| 18 | + $pluginInfo['items']['item']['request'] = 'itemid'; |
|
| 19 | 19 | |
| 20 | - $pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY; |
|
| 21 | - $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 22 | - $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 20 | + $pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY; |
|
| 21 | + $pluginInfo['items']['category']['url'] = 'category.php?categoryid=%u'; |
|
| 22 | + $pluginInfo['items']['category']['request'] = 'categoryid'; |
|
| 23 | 23 | |
| 24 | - return $pluginInfo; |
|
| 24 | + return $pluginInfo; |
|
| 25 | 25 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | function smartobject_plugin_smartband() |
| 11 | 11 | { |
| 12 | 12 | global $xoopsConfig; |
| 13 | - require_once XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 13 | + require_once XOOPS_ROOT_PATH.'/modules/smartband/language/'.$xoopsConfig['language'].'/main.php'; |
|
| 14 | 14 | |
| 15 | 15 | $pluginInfo = array(); |
| 16 | 16 | $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP; |