@@ -16,14 +16,14 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class SmartFormSelect_multiElement extends SmartFormSelectElement |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * SmartFormSelect_multiElement constructor. |
|
| 21 | - * @param string $object |
|
| 22 | - * @param string $key |
|
| 23 | - */ |
|
| 24 | - public function __construct($object, $key) |
|
| 25 | - { |
|
| 26 | - $this->multiple = true; |
|
| 27 | - parent::__construct($object, $key); |
|
| 28 | - } |
|
| 19 | + /** |
|
| 20 | + * SmartFormSelect_multiElement constructor. |
|
| 21 | + * @param string $object |
|
| 22 | + * @param string $key |
|
| 23 | + */ |
|
| 24 | + public function __construct($object, $key) |
|
| 25 | + { |
|
| 26 | + $this->multiple = true; |
|
| 27 | + parent::__construct($object, $key); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | * @package SmartObject |
| 10 | 10 | * @subpackage SmartObjectForm |
| 11 | 11 | */ |
| 12 | -include_once(SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformselectelement.php'); |
|
| 12 | +include_once(SMARTOBJECT_ROOT_PATH.'class/form/elements/smartformselectelement.php'); |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Class SmartFormSelect_multiElement |
@@ -11,18 +11,18 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormAutocompleteElement extends SmartAutocompleteElement |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormAutocompleteElement constructor. |
|
| 16 | - * @param string $object |
|
| 17 | - * @param string $key |
|
| 18 | - */ |
|
| 19 | - public function __construct($object, $key) |
|
| 20 | - { |
|
| 21 | - $var = $object->vars[$key]; |
|
| 22 | - $control = $object->controls[$key]; |
|
| 23 | - $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
| 14 | + /** |
|
| 15 | + * SmartFormAutocompleteElement constructor. |
|
| 16 | + * @param string $object |
|
| 17 | + * @param string $key |
|
| 18 | + */ |
|
| 19 | + public function __construct($object, $key) |
|
| 20 | + { |
|
| 21 | + $var = $object->vars[$key]; |
|
| 22 | + $control = $object->controls[$key]; |
|
| 23 | + $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
| 24 | 24 | |
| 25 | - $form_size = isset($control['size']) ? $control['size'] : 50; |
|
| 26 | - parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
| 27 | - } |
|
| 25 | + $form_size = isset($control['size']) ? $control['size'] : 50; |
|
| 26 | + parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormYesnoElement extends XoopsFormRadioYN |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormYesnoElement constructor. |
|
| 16 | - * @param string $object |
|
| 17 | - * @param string $key |
|
| 18 | - */ |
|
| 19 | - public function __construct($object, $key) |
|
| 20 | - { |
|
| 21 | - parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 22 | - } |
|
| 14 | + /** |
|
| 15 | + * SmartFormYesnoElement constructor. |
|
| 16 | + * @param string $object |
|
| 17 | + * @param string $key |
|
| 18 | + */ |
|
| 19 | + public function __construct($object, $key) |
|
| 20 | + { |
|
| 21 | + parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -36,29 +36,29 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class SmartobjectBasedUrl extends SmartObject |
| 38 | 38 | { |
| 39 | - /** |
|
| 40 | - * SmartobjectBasedUrl constructor. |
|
| 41 | - */ |
|
| 42 | - public function __construct() |
|
| 43 | - { |
|
| 44 | - $this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false); |
|
| 45 | - $this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false); |
|
| 46 | - $this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false); |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * SmartobjectBasedUrl constructor. |
|
| 41 | + */ |
|
| 42 | + public function __construct() |
|
| 43 | + { |
|
| 44 | + $this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false); |
|
| 45 | + $this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false); |
|
| 46 | + $this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param string $key |
|
| 51 | - * @param string $format |
|
| 52 | - * @return mixed |
|
| 53 | - */ |
|
| 54 | - public function getVar($key, $format = 'e') |
|
| 55 | - { |
|
| 56 | - if (0 === strpos($key, 'url_')) { |
|
| 57 | - return parent::getVar('url', $format); |
|
| 58 | - } elseif (0 === strpos($key, 'caption_')) { |
|
| 59 | - return parent::getVar('caption', $format); |
|
| 60 | - } else { |
|
| 61 | - return parent::getVar($key, $format); |
|
| 62 | - } |
|
| 63 | - } |
|
| 49 | + /** |
|
| 50 | + * @param string $key |
|
| 51 | + * @param string $format |
|
| 52 | + * @return mixed |
|
| 53 | + */ |
|
| 54 | + public function getVar($key, $format = 'e') |
|
| 55 | + { |
|
| 56 | + if (0 === strpos($key, 'url_')) { |
|
| 57 | + return parent::getVar('url', $format); |
|
| 58 | + } elseif (0 === strpos($key, 'caption_')) { |
|
| 59 | + return parent::getVar('caption', $format); |
|
| 60 | + } else { |
|
| 61 | + return parent::getVar($key, $format); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 31 | 31 | |
| 32 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
|
| 32 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php'; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Class SmartobjectBasedUrl |
@@ -15,65 +15,65 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class SmartPrinterFriendly |
| 17 | 17 | { |
| 18 | - public $_title; |
|
| 19 | - public $_dsc; |
|
| 20 | - public $_content; |
|
| 21 | - public $_tpl; |
|
| 22 | - public $_pageTitle = false; |
|
| 23 | - public $_width = 680; |
|
| 18 | + public $_title; |
|
| 19 | + public $_dsc; |
|
| 20 | + public $_content; |
|
| 21 | + public $_tpl; |
|
| 22 | + public $_pageTitle = false; |
|
| 23 | + public $_width = 680; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * SmartPrinterFriendly constructor. |
|
| 27 | - * @param $content |
|
| 28 | - * @param bool $title |
|
| 29 | - * @param bool $dsc |
|
| 30 | - */ |
|
| 31 | - public function __construct($content, $title = false, $dsc = false) |
|
| 32 | - { |
|
| 33 | - $this->_title = $title; |
|
| 34 | - $this->_dsc = $dsc; |
|
| 35 | - $this->_content = $content; |
|
| 36 | - } |
|
| 25 | + /** |
|
| 26 | + * SmartPrinterFriendly constructor. |
|
| 27 | + * @param $content |
|
| 28 | + * @param bool $title |
|
| 29 | + * @param bool $dsc |
|
| 30 | + */ |
|
| 31 | + public function __construct($content, $title = false, $dsc = false) |
|
| 32 | + { |
|
| 33 | + $this->_title = $title; |
|
| 34 | + $this->_dsc = $dsc; |
|
| 35 | + $this->_content = $content; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function render() |
|
| 39 | - { |
|
| 40 | - /** |
|
| 41 | - * @todo move the output to a template |
|
| 42 | - * @todo make the output XHTML compliant |
|
| 43 | - */ |
|
| 38 | + public function render() |
|
| 39 | + { |
|
| 40 | + /** |
|
| 41 | + * @todo move the output to a template |
|
| 42 | + * @todo make the output XHTML compliant |
|
| 43 | + */ |
|
| 44 | 44 | |
| 45 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 45 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 46 | 46 | |
| 47 | - $this->_tpl = new XoopsTpl(); |
|
| 47 | + $this->_tpl = new XoopsTpl(); |
|
| 48 | 48 | |
| 49 | - $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title); |
|
| 50 | - $this->_tpl->assign('smartobject_print_title', $this->_title); |
|
| 51 | - $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); |
|
| 52 | - $this->_tpl->assign('smartobject_print_content', $this->_content); |
|
| 53 | - $this->_tpl->assign('smartobject_print_width', $this->_width); |
|
| 49 | + $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title); |
|
| 50 | + $this->_tpl->assign('smartobject_print_title', $this->_title); |
|
| 51 | + $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); |
|
| 52 | + $this->_tpl->assign('smartobject_print_content', $this->_content); |
|
| 53 | + $this->_tpl->assign('smartobject_print_width', $this->_width); |
|
| 54 | 54 | |
| 55 | - $current_urls = smart_getCurrentUrls(); |
|
| 56 | - $current_url = $current_urls['full']; |
|
| 55 | + $current_urls = smart_getCurrentUrls(); |
|
| 56 | + $current_url = $current_urls['full']; |
|
| 57 | 57 | |
| 58 | - $this->_tpl->assign('smartobject_print_currenturl', $current_url); |
|
| 59 | - $this->_tpl->assign('smartobject_print_url', $this->url); |
|
| 58 | + $this->_tpl->assign('smartobject_print_currenturl', $current_url); |
|
| 59 | + $this->_tpl->assign('smartobject_print_url', $this->url); |
|
| 60 | 60 | |
| 61 | - $this->_tpl->display('db:smartobject_print.tpl'); |
|
| 62 | - } |
|
| 61 | + $this->_tpl->display('db:smartobject_print.tpl'); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @param $text |
|
| 66 | - */ |
|
| 67 | - public function setPageTitle($text) |
|
| 68 | - { |
|
| 69 | - $this->_pageTitle = $text; |
|
| 70 | - } |
|
| 64 | + /** |
|
| 65 | + * @param $text |
|
| 66 | + */ |
|
| 67 | + public function setPageTitle($text) |
|
| 68 | + { |
|
| 69 | + $this->_pageTitle = $text; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @param $width |
|
| 74 | - */ |
|
| 75 | - public function setWidth($width) |
|
| 76 | - { |
|
| 77 | - $this->_width = $width; |
|
| 78 | - } |
|
| 72 | + /** |
|
| 73 | + * @param $width |
|
| 74 | + */ |
|
| 75 | + public function setWidth($width) |
|
| 76 | + { |
|
| 77 | + $this->_width = $width; |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @todo make the output XHTML compliant |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 45 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 46 | 46 | |
| 47 | 47 | $this->_tpl = new XoopsTpl(); |
| 48 | 48 | |
@@ -5,68 +5,68 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | class SmartPlugin |
| 7 | 7 | { |
| 8 | - public $_infoArray; |
|
| 9 | - |
|
| 10 | - /** |
|
| 11 | - * SmartPlugin constructor. |
|
| 12 | - * @param $array |
|
| 13 | - */ |
|
| 14 | - public function __construct($array) |
|
| 15 | - { |
|
| 16 | - $this->_infoArray = $array; |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * @param $item |
|
| 21 | - * @return bool |
|
| 22 | - */ |
|
| 23 | - public function getItemInfo($item) |
|
| 24 | - { |
|
| 25 | - if (isset($this->_infoArray['items'][$item])) { |
|
| 26 | - return $this->_infoArray['items'][$item]; |
|
| 27 | - } else { |
|
| 28 | - return false; |
|
| 29 | - } |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @return mixed |
|
| 34 | - */ |
|
| 35 | - public function getItemList() |
|
| 36 | - { |
|
| 37 | - $itemsArray = $this->_infoArray['items']; |
|
| 38 | - foreach ($itemsArray as $k => $v) { |
|
| 39 | - $ret[$k] = $v['caption']; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - return $ret; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @return bool|int|string |
|
| 47 | - */ |
|
| 48 | - public function getItem() |
|
| 49 | - { |
|
| 50 | - $ret = false; |
|
| 51 | - foreach ($this->_infoArray['items'] as $k => $v) { |
|
| 52 | - $search_str = str_replace('%u', '', $v['url']); |
|
| 53 | - if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
| 54 | - $ret = $k; |
|
| 55 | - break; |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - return $ret; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @param $item |
|
| 64 | - * @return mixed |
|
| 65 | - */ |
|
| 66 | - public function getItemIdForItem($item) |
|
| 67 | - { |
|
| 68 | - return $_REQUEST[$this->_infoArray['items'][$item]['request']]; |
|
| 69 | - } |
|
| 8 | + public $_infoArray; |
|
| 9 | + |
|
| 10 | + /** |
|
| 11 | + * SmartPlugin constructor. |
|
| 12 | + * @param $array |
|
| 13 | + */ |
|
| 14 | + public function __construct($array) |
|
| 15 | + { |
|
| 16 | + $this->_infoArray = $array; |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * @param $item |
|
| 21 | + * @return bool |
|
| 22 | + */ |
|
| 23 | + public function getItemInfo($item) |
|
| 24 | + { |
|
| 25 | + if (isset($this->_infoArray['items'][$item])) { |
|
| 26 | + return $this->_infoArray['items'][$item]; |
|
| 27 | + } else { |
|
| 28 | + return false; |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @return mixed |
|
| 34 | + */ |
|
| 35 | + public function getItemList() |
|
| 36 | + { |
|
| 37 | + $itemsArray = $this->_infoArray['items']; |
|
| 38 | + foreach ($itemsArray as $k => $v) { |
|
| 39 | + $ret[$k] = $v['caption']; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + return $ret; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @return bool|int|string |
|
| 47 | + */ |
|
| 48 | + public function getItem() |
|
| 49 | + { |
|
| 50 | + $ret = false; |
|
| 51 | + foreach ($this->_infoArray['items'] as $k => $v) { |
|
| 52 | + $search_str = str_replace('%u', '', $v['url']); |
|
| 53 | + if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
| 54 | + $ret = $k; |
|
| 55 | + break; |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + return $ret; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @param $item |
|
| 64 | + * @return mixed |
|
| 65 | + */ |
|
| 66 | + public function getItemIdForItem($item) |
|
| 67 | + { |
|
| 68 | + return $_REQUEST[$this->_infoArray['items'][$item]['request']]; |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -74,57 +74,57 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | class SmartPluginHandler |
| 76 | 76 | { |
| 77 | - public $pluginPatterns = false; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @param $dirname |
|
| 81 | - * @return bool|SmartPlugin |
|
| 82 | - */ |
|
| 83 | - public function getPlugin($dirname) |
|
| 84 | - { |
|
| 85 | - $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
| 86 | - if (file_exists($pluginName)) { |
|
| 87 | - include_once($pluginName); |
|
| 88 | - $function = 'smartobject_plugin_' . $dirname; |
|
| 89 | - if (function_exists($function)) { |
|
| 90 | - $array = $function(); |
|
| 91 | - $ret = new SmartPlugin($array); |
|
| 92 | - |
|
| 93 | - return $ret; |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - return false; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @return array |
|
| 102 | - */ |
|
| 103 | - public function getPluginsArray() |
|
| 104 | - { |
|
| 105 | - include_once(XOOPS_ROOT_PATH . '/class/xoopslists.php'); |
|
| 106 | - |
|
| 107 | - $moduleHandler = xoops_getHandler('module'); |
|
| 108 | - $criteria = new CriteriaCompo(); |
|
| 109 | - $criteria->add(new Criteria('isactive', 1)); |
|
| 110 | - $tempModulesObj = $moduleHandler->getObjects($criteria); |
|
| 111 | - $modulesObj = array(); |
|
| 112 | - foreach ($tempModulesObj as $moduleObj) { |
|
| 113 | - $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
| 117 | - $ret = array(); |
|
| 118 | - foreach ($aFiles as $file) { |
|
| 119 | - if (substr($file, strlen($file) - 4, 4) === '.php') { |
|
| 120 | - $pluginName = str_replace('.php', '', $file); |
|
| 121 | - $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
| 122 | - if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
|
| 123 | - $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - return $ret; |
|
| 129 | - } |
|
| 77 | + public $pluginPatterns = false; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @param $dirname |
|
| 81 | + * @return bool|SmartPlugin |
|
| 82 | + */ |
|
| 83 | + public function getPlugin($dirname) |
|
| 84 | + { |
|
| 85 | + $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
| 86 | + if (file_exists($pluginName)) { |
|
| 87 | + include_once($pluginName); |
|
| 88 | + $function = 'smartobject_plugin_' . $dirname; |
|
| 89 | + if (function_exists($function)) { |
|
| 90 | + $array = $function(); |
|
| 91 | + $ret = new SmartPlugin($array); |
|
| 92 | + |
|
| 93 | + return $ret; |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + return false; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @return array |
|
| 102 | + */ |
|
| 103 | + public function getPluginsArray() |
|
| 104 | + { |
|
| 105 | + include_once(XOOPS_ROOT_PATH . '/class/xoopslists.php'); |
|
| 106 | + |
|
| 107 | + $moduleHandler = xoops_getHandler('module'); |
|
| 108 | + $criteria = new CriteriaCompo(); |
|
| 109 | + $criteria->add(new Criteria('isactive', 1)); |
|
| 110 | + $tempModulesObj = $moduleHandler->getObjects($criteria); |
|
| 111 | + $modulesObj = array(); |
|
| 112 | + foreach ($tempModulesObj as $moduleObj) { |
|
| 113 | + $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
| 117 | + $ret = array(); |
|
| 118 | + foreach ($aFiles as $file) { |
|
| 119 | + if (substr($file, strlen($file) - 4, 4) === '.php') { |
|
| 120 | + $pluginName = str_replace('.php', '', $file); |
|
| 121 | + $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
| 122 | + if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
|
| 123 | + $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + return $ret; |
|
| 129 | + } |
|
| 130 | 130 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $ret = false; |
| 51 | 51 | foreach ($this->_infoArray['items'] as $k => $v) { |
| 52 | 52 | $search_str = str_replace('%u', '', $v['url']); |
| 53 | - if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
| 53 | + if (strpos($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
| 54 | 54 | $ret = $k; |
| 55 | 55 | break; |
| 56 | 56 | } |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getPlugin($dirname) |
| 84 | 84 | { |
| 85 | - $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
| 85 | + $pluginName = SMARTOBJECT_ROOT_PATH.'plugins/'.$dirname.'.php'; |
|
| 86 | 86 | if (file_exists($pluginName)) { |
| 87 | 87 | include_once($pluginName); |
| 88 | - $function = 'smartobject_plugin_' . $dirname; |
|
| 88 | + $function = 'smartobject_plugin_'.$dirname; |
|
| 89 | 89 | if (function_exists($function)) { |
| 90 | 90 | $array = $function(); |
| 91 | 91 | $ret = new SmartPlugin($array); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function getPluginsArray() |
| 104 | 104 | { |
| 105 | - include_once(XOOPS_ROOT_PATH . '/class/xoopslists.php'); |
|
| 105 | + include_once(XOOPS_ROOT_PATH.'/class/xoopslists.php'); |
|
| 106 | 106 | |
| 107 | 107 | $moduleHandler = xoops_getHandler('module'); |
| 108 | 108 | $criteria = new CriteriaCompo(); |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
| 116 | + $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH.'plugins/'); |
|
| 117 | 117 | $ret = array(); |
| 118 | 118 | foreach ($aFiles as $file) { |
| 119 | 119 | if (substr($file, strlen($file) - 4, 4) === '.php') { |
| 120 | 120 | $pluginName = str_replace('.php', '', $file); |
| 121 | - $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
| 121 | + $module_xoops_version_file = XOOPS_ROOT_PATH."/modules/$pluginName/xoops_version.php"; |
|
| 122 | 122 | if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
| 123 | 123 | $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
| 124 | 124 | } |
@@ -192,7 +192,7 @@ |
||
| 192 | 192 | { |
| 193 | 193 | global $xoopsModule; |
| 194 | 194 | |
| 195 | - $smartModule =& smartsection_getModuleInfo(); |
|
| 195 | + $smartModule = & smartsection_getModuleInfo(); |
|
| 196 | 196 | |
| 197 | 197 | $result = true; |
| 198 | 198 | $module_id = $smartModule->getVar('mid'); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | /** |
| 34 | 34 | * @param $gperm_name |
| 35 | - * @param null $id |
|
| 35 | + * @param integer $id |
|
| 36 | 36 | * @return array |
| 37 | 37 | */ |
| 38 | 38 | public function getGrantedGroups($gperm_name, $id = null) |
@@ -11,18 +11,18 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class SmartobjectPermissionHandler extends XoopsObjectHandler |
| 13 | 13 | { |
| 14 | - public $handler; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * SmartobjectPermissionHandler constructor. |
|
| 18 | - * @param XoopsDatabase $handler |
|
| 19 | - */ |
|
| 20 | - public function __construct($handler) |
|
| 21 | - { |
|
| 22 | - $this->handler = $handler; |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - /* |
|
| 14 | + public $handler; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * SmartobjectPermissionHandler constructor. |
|
| 18 | + * @param XoopsDatabase $handler |
|
| 19 | + */ |
|
| 20 | + public function __construct($handler) |
|
| 21 | + { |
|
| 22 | + $this->handler = $handler; |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + /* |
|
| 26 | 26 | * Returns permissions for a certain type |
| 27 | 27 | * |
| 28 | 28 | * @param string $type "global", "forum" or "topic" (should perhaps have "post" as well - but I don't know) |
@@ -30,73 +30,73 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - /** |
|
| 34 | - * @param $gperm_name |
|
| 35 | - * @param null $id |
|
| 36 | - * @return array |
|
| 37 | - */ |
|
| 38 | - public function getGrantedGroups($gperm_name, $id = null) |
|
| 39 | - { |
|
| 40 | - static $groups; |
|
| 41 | - |
|
| 42 | - if (!isset($groups[$gperm_name]) || ($id !== null && !isset($groups[$gperm_name][$id]))) { |
|
| 43 | - $smartModule = $this->handler->getModuleInfo(); |
|
| 44 | - //Get group permissions handler |
|
| 45 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 46 | - |
|
| 47 | - //Get groups allowed for an item id |
|
| 48 | - $allowedgroups = $gpermHandler->getGroupIds($gperm_name, $id, $smartModule->getVar('mid')); |
|
| 49 | - $groups[$gperm_name][$id] = $allowedgroups; |
|
| 50 | - } |
|
| 51 | - //Return the permission array |
|
| 52 | - return isset($groups[$gperm_name][$id]) ? $groups[$gperm_name][$id] : array(); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @param $item_ids_array |
|
| 57 | - * @param bool $gperm_name |
|
| 58 | - * @return array |
|
| 59 | - */ |
|
| 60 | - public function getGrantedGroupsForIds($item_ids_array, $gperm_name = false) |
|
| 61 | - { |
|
| 62 | - static $groups; |
|
| 63 | - |
|
| 64 | - if ($gperm_name) { |
|
| 65 | - if (isset($groups[$gperm_name])) { |
|
| 66 | - return $groups[$gperm_name]; |
|
| 67 | - } |
|
| 68 | - } else { |
|
| 69 | - // if !$gperm_name then we will fetch all permissions in the module so we don't need them again |
|
| 70 | - return $groups; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - $smartModule = $this->handler->getModuleInfo(); |
|
| 74 | - |
|
| 75 | - $criteria = new CriteriaCompo(); |
|
| 76 | - $criteria->add(new Criteria('gperm_modid', $smartModule->getVar('mid'))); |
|
| 77 | - |
|
| 78 | - if ($gperm_name) { |
|
| 79 | - $criteria->add(new Criteria('gperm_name', $gperm_name)); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - //Get group permissions handler |
|
| 83 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 84 | - |
|
| 85 | - $permissionsObj = $gpermHandler->getObjects($criteria); |
|
| 86 | - |
|
| 87 | - foreach ($permissionsObj as $permissionObj) { |
|
| 88 | - $groups[$permissionObj->getVar('gperm_name')][$permissionObj->getVar('gperm_itemid')][] = $permissionObj->getVar('gperm_groupid'); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - //Return the permission array |
|
| 92 | - if ($gperm_name) { |
|
| 93 | - return isset($groups[$gperm_name]) ? $groups[$gperm_name] : array(); |
|
| 94 | - } else { |
|
| 95 | - return isset($groups) ? $groups : array(); |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - /* |
|
| 33 | + /** |
|
| 34 | + * @param $gperm_name |
|
| 35 | + * @param null $id |
|
| 36 | + * @return array |
|
| 37 | + */ |
|
| 38 | + public function getGrantedGroups($gperm_name, $id = null) |
|
| 39 | + { |
|
| 40 | + static $groups; |
|
| 41 | + |
|
| 42 | + if (!isset($groups[$gperm_name]) || ($id !== null && !isset($groups[$gperm_name][$id]))) { |
|
| 43 | + $smartModule = $this->handler->getModuleInfo(); |
|
| 44 | + //Get group permissions handler |
|
| 45 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 46 | + |
|
| 47 | + //Get groups allowed for an item id |
|
| 48 | + $allowedgroups = $gpermHandler->getGroupIds($gperm_name, $id, $smartModule->getVar('mid')); |
|
| 49 | + $groups[$gperm_name][$id] = $allowedgroups; |
|
| 50 | + } |
|
| 51 | + //Return the permission array |
|
| 52 | + return isset($groups[$gperm_name][$id]) ? $groups[$gperm_name][$id] : array(); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @param $item_ids_array |
|
| 57 | + * @param bool $gperm_name |
|
| 58 | + * @return array |
|
| 59 | + */ |
|
| 60 | + public function getGrantedGroupsForIds($item_ids_array, $gperm_name = false) |
|
| 61 | + { |
|
| 62 | + static $groups; |
|
| 63 | + |
|
| 64 | + if ($gperm_name) { |
|
| 65 | + if (isset($groups[$gperm_name])) { |
|
| 66 | + return $groups[$gperm_name]; |
|
| 67 | + } |
|
| 68 | + } else { |
|
| 69 | + // if !$gperm_name then we will fetch all permissions in the module so we don't need them again |
|
| 70 | + return $groups; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + $smartModule = $this->handler->getModuleInfo(); |
|
| 74 | + |
|
| 75 | + $criteria = new CriteriaCompo(); |
|
| 76 | + $criteria->add(new Criteria('gperm_modid', $smartModule->getVar('mid'))); |
|
| 77 | + |
|
| 78 | + if ($gperm_name) { |
|
| 79 | + $criteria->add(new Criteria('gperm_name', $gperm_name)); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + //Get group permissions handler |
|
| 83 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 84 | + |
|
| 85 | + $permissionsObj = $gpermHandler->getObjects($criteria); |
|
| 86 | + |
|
| 87 | + foreach ($permissionsObj as $permissionObj) { |
|
| 88 | + $groups[$permissionObj->getVar('gperm_name')][$permissionObj->getVar('gperm_itemid')][] = $permissionObj->getVar('gperm_groupid'); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + //Return the permission array |
|
| 92 | + if ($gperm_name) { |
|
| 93 | + return isset($groups[$gperm_name]) ? $groups[$gperm_name] : array(); |
|
| 94 | + } else { |
|
| 95 | + return isset($groups) ? $groups : array(); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /* |
|
| 100 | 100 | * Returns permissions for a certain type |
| 101 | 101 | * |
| 102 | 102 | * @param string $type "global", "forum" or "topic" (should perhaps have "post" as well - but I don't know) |
@@ -104,123 +104,123 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return array |
| 106 | 106 | */ |
| 107 | - /** |
|
| 108 | - * @param $gperm_name |
|
| 109 | - * @param null $id |
|
| 110 | - * @return array |
|
| 111 | - */ |
|
| 112 | - public function getGrantedItems($gperm_name, $id = null) |
|
| 113 | - { |
|
| 114 | - global $xoopsUser; |
|
| 115 | - static $permissions; |
|
| 116 | - |
|
| 117 | - if (!isset($permissions[$gperm_name]) || ($id !== null && !isset($permissions[$gperm_name][$id]))) { |
|
| 118 | - $smartModule = $this->handler->getModuleInfo(); |
|
| 119 | - |
|
| 120 | - if (is_object($smartModule)) { |
|
| 121 | - |
|
| 122 | - //Get group permissions handler |
|
| 123 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 124 | - |
|
| 125 | - //Get user's groups |
|
| 126 | - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); |
|
| 127 | - |
|
| 128 | - //Get all allowed item ids in this module and for this user's groups |
|
| 129 | - $userpermissions = $gpermHandler->getItemIds($gperm_name, $groups, $smartModule->getVar('mid')); |
|
| 130 | - $permissions[$gperm_name] = $userpermissions; |
|
| 131 | - } |
|
| 132 | - } |
|
| 133 | - //Return the permission array |
|
| 134 | - return isset($permissions[$gperm_name]) ? $permissions[$gperm_name] : array(); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * @param $id |
|
| 139 | - */ |
|
| 140 | - public function storeAllPermissionsForId($id) |
|
| 141 | - { |
|
| 142 | - foreach ($this->handler->getPermissions() as $permission) { |
|
| 143 | - $this->saveItem_Permissions($_POST[$permission['perm_name']], $id, $permission['perm_name']); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * Saves permissions for the selected category |
|
| 149 | - * |
|
| 150 | - * saveCategory_Permissions() |
|
| 151 | - * |
|
| 152 | - * @param array $groups : group with granted permission |
|
| 153 | - * @param $itemid |
|
| 154 | - * @param string $perm_name : name of the permission |
|
| 155 | - * @return bool : TRUE if the no errors occured |
|
| 156 | - * @internal param int $categoryID: categoryID on which we are setting permissions for Categories and Forums |
|
| 157 | - */ |
|
| 158 | - |
|
| 159 | - public function saveItem_Permissions($groups, $itemid, $perm_name) |
|
| 160 | - { |
|
| 161 | - $smartModule = $this->handler->getModuleInfo(); |
|
| 162 | - |
|
| 163 | - $result = true; |
|
| 164 | - $module_id = $smartModule->getVar('mid'); |
|
| 165 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 166 | - |
|
| 167 | - // First, if the permissions are already there, delete them |
|
| 168 | - $gpermHandler->deleteByModule($module_id, $perm_name, $itemid); |
|
| 169 | - //echo "itemid: $itemid - perm: $perm_name - modid: $module_id"; |
|
| 170 | - //exit; |
|
| 171 | - // Save the new permissions |
|
| 172 | - |
|
| 173 | - if (count($groups) > 0) { |
|
| 174 | - foreach ($groups as $group_id) { |
|
| 175 | - $gpermHandler->addRight($perm_name, $itemid, $group_id, $module_id); |
|
| 176 | - } |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - return $result; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * Delete all permission for a specific item |
|
| 184 | - * |
|
| 185 | - * deletePermissions() |
|
| 186 | - * |
|
| 187 | - * @param integer $itemid : id of the item for which to delete the permissions |
|
| 188 | - * @param $gperm_name |
|
| 189 | - * @return bool: TRUE if the no errors occured |
|
| 190 | - */ |
|
| 191 | - public function deletePermissions($itemid, $gperm_name) |
|
| 192 | - { |
|
| 193 | - global $xoopsModule; |
|
| 194 | - |
|
| 195 | - $smartModule =& smartsection_getModuleInfo(); |
|
| 196 | - |
|
| 197 | - $result = true; |
|
| 198 | - $module_id = $smartModule->getVar('mid'); |
|
| 199 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 200 | - |
|
| 201 | - $gpermHandler->deleteByModule($module_id, $gperm_name, $itemid); |
|
| 202 | - |
|
| 203 | - return $result; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Checks if the user has access to a specific permission on a given object |
|
| 208 | - * |
|
| 209 | - * @param string $gperm_name name of the permission to test |
|
| 210 | - * @param int $gperm_itemid id of the object to check |
|
| 211 | - * @return boolean: TRUE if user has access, FALSE if not |
|
| 212 | - **/ |
|
| 213 | - public function accessGranted($gperm_name, $gperm_itemid) |
|
| 214 | - { |
|
| 215 | - global $xoopsUser; |
|
| 216 | - |
|
| 217 | - $gperm_groupid = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); |
|
| 218 | - $smartModule = $this->handler->getModuleInfo(); |
|
| 219 | - $gperm_modid = $smartModule->getVar('mid'); |
|
| 220 | - |
|
| 221 | - //Get group permissions handler |
|
| 222 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 223 | - |
|
| 224 | - return $gpermHandler->checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid); |
|
| 225 | - } |
|
| 107 | + /** |
|
| 108 | + * @param $gperm_name |
|
| 109 | + * @param null $id |
|
| 110 | + * @return array |
|
| 111 | + */ |
|
| 112 | + public function getGrantedItems($gperm_name, $id = null) |
|
| 113 | + { |
|
| 114 | + global $xoopsUser; |
|
| 115 | + static $permissions; |
|
| 116 | + |
|
| 117 | + if (!isset($permissions[$gperm_name]) || ($id !== null && !isset($permissions[$gperm_name][$id]))) { |
|
| 118 | + $smartModule = $this->handler->getModuleInfo(); |
|
| 119 | + |
|
| 120 | + if (is_object($smartModule)) { |
|
| 121 | + |
|
| 122 | + //Get group permissions handler |
|
| 123 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 124 | + |
|
| 125 | + //Get user's groups |
|
| 126 | + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); |
|
| 127 | + |
|
| 128 | + //Get all allowed item ids in this module and for this user's groups |
|
| 129 | + $userpermissions = $gpermHandler->getItemIds($gperm_name, $groups, $smartModule->getVar('mid')); |
|
| 130 | + $permissions[$gperm_name] = $userpermissions; |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + //Return the permission array |
|
| 134 | + return isset($permissions[$gperm_name]) ? $permissions[$gperm_name] : array(); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @param $id |
|
| 139 | + */ |
|
| 140 | + public function storeAllPermissionsForId($id) |
|
| 141 | + { |
|
| 142 | + foreach ($this->handler->getPermissions() as $permission) { |
|
| 143 | + $this->saveItem_Permissions($_POST[$permission['perm_name']], $id, $permission['perm_name']); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * Saves permissions for the selected category |
|
| 149 | + * |
|
| 150 | + * saveCategory_Permissions() |
|
| 151 | + * |
|
| 152 | + * @param array $groups : group with granted permission |
|
| 153 | + * @param $itemid |
|
| 154 | + * @param string $perm_name : name of the permission |
|
| 155 | + * @return bool : TRUE if the no errors occured |
|
| 156 | + * @internal param int $categoryID: categoryID on which we are setting permissions for Categories and Forums |
|
| 157 | + */ |
|
| 158 | + |
|
| 159 | + public function saveItem_Permissions($groups, $itemid, $perm_name) |
|
| 160 | + { |
|
| 161 | + $smartModule = $this->handler->getModuleInfo(); |
|
| 162 | + |
|
| 163 | + $result = true; |
|
| 164 | + $module_id = $smartModule->getVar('mid'); |
|
| 165 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 166 | + |
|
| 167 | + // First, if the permissions are already there, delete them |
|
| 168 | + $gpermHandler->deleteByModule($module_id, $perm_name, $itemid); |
|
| 169 | + //echo "itemid: $itemid - perm: $perm_name - modid: $module_id"; |
|
| 170 | + //exit; |
|
| 171 | + // Save the new permissions |
|
| 172 | + |
|
| 173 | + if (count($groups) > 0) { |
|
| 174 | + foreach ($groups as $group_id) { |
|
| 175 | + $gpermHandler->addRight($perm_name, $itemid, $group_id, $module_id); |
|
| 176 | + } |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + return $result; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * Delete all permission for a specific item |
|
| 184 | + * |
|
| 185 | + * deletePermissions() |
|
| 186 | + * |
|
| 187 | + * @param integer $itemid : id of the item for which to delete the permissions |
|
| 188 | + * @param $gperm_name |
|
| 189 | + * @return bool: TRUE if the no errors occured |
|
| 190 | + */ |
|
| 191 | + public function deletePermissions($itemid, $gperm_name) |
|
| 192 | + { |
|
| 193 | + global $xoopsModule; |
|
| 194 | + |
|
| 195 | + $smartModule =& smartsection_getModuleInfo(); |
|
| 196 | + |
|
| 197 | + $result = true; |
|
| 198 | + $module_id = $smartModule->getVar('mid'); |
|
| 199 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 200 | + |
|
| 201 | + $gpermHandler->deleteByModule($module_id, $gperm_name, $itemid); |
|
| 202 | + |
|
| 203 | + return $result; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Checks if the user has access to a specific permission on a given object |
|
| 208 | + * |
|
| 209 | + * @param string $gperm_name name of the permission to test |
|
| 210 | + * @param int $gperm_itemid id of the object to check |
|
| 211 | + * @return boolean: TRUE if user has access, FALSE if not |
|
| 212 | + **/ |
|
| 213 | + public function accessGranted($gperm_name, $gperm_itemid) |
|
| 214 | + { |
|
| 215 | + global $xoopsUser; |
|
| 216 | + |
|
| 217 | + $gperm_groupid = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); |
|
| 218 | + $smartModule = $this->handler->getModuleInfo(); |
|
| 219 | + $gperm_modid = $smartModule->getVar('mid'); |
|
| 220 | + |
|
| 221 | + //Get group permissions handler |
|
| 222 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 223 | + |
|
| 224 | + return $gpermHandler->checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid); |
|
| 225 | + } |
|
| 226 | 226 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $modversion['min_xoops'] = '2.5.8'; |
| 44 | 44 | $modversion['min_admin'] = '1.1'; |
| 45 | 45 | $modversion['min_db'] = array( |
| 46 | - 'mysql' => '5.0.7', |
|
| 47 | - 'mysqli' => '5.0.7' |
|
| 46 | + 'mysql' => '5.0.7', |
|
| 47 | + 'mysqli' => '5.0.7' |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | // --- |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | global $xoopsConfig; |
| 75 | 75 | $common_file = XOOPS_ROOT_PATH . '/modules/smartobject/language/' . $xoopsConfig['language'] . '/common.php'; |
| 76 | 76 | if (file_exists($common_file)) { |
| 77 | - $flag_common = true; |
|
| 78 | - include_once $common_file; |
|
| 77 | + $flag_common = true; |
|
| 78 | + include_once $common_file; |
|
| 79 | 79 | } else { |
| 80 | - include_once(XOOPS_ROOT_PATH . '/modules/smartobject/language/english/common.php'); |
|
| 80 | + include_once(XOOPS_ROOT_PATH . '/modules/smartobject/language/english/common.php'); |
|
| 81 | 81 | } |
| 82 | 82 | // ----- |
| 83 | 83 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | //about |
| 37 | 37 | $modversion['module_status'] = 'RC 1'; |
| 38 | 38 | $modversion['release_date'] = '2016/03/28'; |
| 39 | -$modversion['release_file'] = XOOPS_URL . '/modules/' . $modversion['dirname'] . '/docs/changelog.txt'; |
|
| 39 | +$modversion['release_file'] = XOOPS_URL.'/modules/'.$modversion['dirname'].'/docs/changelog.txt'; |
|
| 40 | 40 | $modversion['module_website_url'] = 'www.xoops.org'; |
| 41 | 41 | $modversion['module_website_name'] = 'XOOPS'; |
| 42 | 42 | $modversion['min_php'] = '5.5'; |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | // ----- BUG: not read other language file ----- |
| 73 | 73 | //include_once(XOOPS_ROOT_PATH.'/modules/smartobject/language/english/common.php'); |
| 74 | 74 | global $xoopsConfig; |
| 75 | -$common_file = XOOPS_ROOT_PATH . '/modules/smartobject/language/' . $xoopsConfig['language'] . '/common.php'; |
|
| 75 | +$common_file = XOOPS_ROOT_PATH.'/modules/smartobject/language/'.$xoopsConfig['language'].'/common.php'; |
|
| 76 | 76 | if (file_exists($common_file)) { |
| 77 | 77 | $flag_common = true; |
| 78 | 78 | include_once $common_file; |
| 79 | 79 | } else { |
| 80 | - include_once(XOOPS_ROOT_PATH . '/modules/smartobject/language/english/common.php'); |
|
| 80 | + include_once(XOOPS_ROOT_PATH.'/modules/smartobject/language/english/common.php'); |
|
| 81 | 81 | } |
| 82 | 82 | // ----- |
| 83 | 83 | |
@@ -12,29 +12,29 @@ |
||
| 12 | 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,27 +14,27 @@ |
||
| 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 | |
| 34 | 34 | $language = preg_replace("/[^a-z0-9_\-]/i", '', $GLOBALS['xoopsConfig']['language']); |
| 35 | 35 | |
| 36 | -if (!@include_once __DIR__ . "/language/{$language}.php") { |
|
| 37 | - require_once __DIR__ . '/language/english.php'; |
|
| 36 | +if (!@include_once __DIR__."/language/{$language}.php") { |
|
| 37 | + require_once __DIR__.'/language/english.php'; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $config; |