Minahito
minah****@users*****
2006年 5月 27日 (土) 22:06:39 JST
Index: xoops2jp/html/modules/base/forms/SearchShowallForm.class.php diff -u /dev/null xoops2jp/html/modules/base/forms/SearchShowallForm.class.php:1.1.2.1 --- /dev/null Sat May 27 22:06:39 2006 +++ xoops2jp/html/modules/base/forms/SearchShowallForm.class.php Sat May 27 22:06:39 2006 @@ -0,0 +1,43 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php"; +require_once XOOPS_MODULE_PATH . "/base/class/Legacy_Validator.class.php"; + +require_once XOOPS_MODULE_PATH . "/base/forms/SearchResultsForm.class.php"; + +class Legacy_SearchShowallForm extends Legacy_SearchResultsForm +{ + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['mid'] =& new XCube_IntProperty('mid'); + $this->mFormProperties['uid'] =& new XCube_IntProperty('uid'); + $this->mFormProperties['andor'] =& new XCube_StringProperty('andor'); + $this->mFormProperties['query'] =& new XCube_StringProperty('query'); + $this->mFormProperties['start'] =& new XCube_IntProperty('start'); + + // + // Set field properties + // + + $this->mFieldProperties['andor'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['andor']->setDependsByArray(array('mask')); + $this->mFieldProperties['andor']->addMessage('required', _MD_BASE_ERROR_MASK, _MD_BASE_LANG_ANDOR); + $this->mFieldProperties['andor']->addVar('mask', '/(AND|OR)/'); + } + + function update(&$params) + { + $params['mid'] = $this->get('mid'); + $params['queries'] = $this->mQueries; + $params['andor'] = $this->get('andor'); + $params['maxhit'] = 20; + $params['offset'] = $this->get('start') ? $this->get('start') : 0; + } +} + +?> Index: xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php diff -u /dev/null xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php:1.1.2.1 --- /dev/null Sat May 27 22:06:39 2006 +++ xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php Sat May 27 22:06:39 2006 @@ -0,0 +1,29 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php"; +require_once XOOPS_MODULE_PATH . "/base/class/Legacy_Validator.class.php"; + +require_once XOOPS_MODULE_PATH . "/base/forms/SearchShowallForm.class.php"; + +class Legacy_SearchShowallbyuserForm extends Legacy_SearchShowallForm +{ + function prepare() + { + parent::prepare(); + + // + // Set form properties + // + $this->mFormProperties['uid'] =& new XCube_IntProperty('uid'); + } + + function update(&$params) + { + parent::update($params); + $params['uid'] = $this->get('uid'); + } +} + +?> Index: xoops2jp/html/modules/base/forms/SearchResultsForm.class.php diff -u /dev/null xoops2jp/html/modules/base/forms/SearchResultsForm.class.php:1.1.2.1 --- /dev/null Sat May 27 22:06:39 2006 +++ xoops2jp/html/modules/base/forms/SearchResultsForm.class.php Sat May 27 22:06:39 2006 @@ -0,0 +1,60 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php"; +require_once XOOPS_MODULE_PATH . "/base/class/Legacy_Validator.class.php"; + +class Legacy_SearchResultsForm extends XCube_ActionForm +{ + var $mQueries = array(); + + function prepare() + { + // + // Set form properties + // + $this->mFormProperties['mids'] =& new XCube_IntArrayProperty('mids'); + $this->mFormProperties['andor'] =& new XCube_StringProperty('andor'); + $this->mFormProperties['query'] =& new XCube_StringProperty('query'); + + // + // Set field properties + // + + $this->mFieldProperties['andor'] =& new XCube_FieldProperty($this); + $this->mFieldProperties['andor']->setDependsByArray(array('mask')); + $this->mFieldProperties['andor']->addMessage('required', _MD_BASE_ERROR_MASK, _MD_BASE_LANG_ANDOR); + $this->mFieldProperties['andor']->addVar('mask', '/(AND|OR|exact)/'); + } + + function fetch() + { + parent::fetch(); + + $separator = '/[\s,]+/'; + if (defined('_MD_BASE_FORMAT_SEARCH_SEPARATOR')) { + $separator = _MD_BASE_FORMAT_SEARCH_SEPARATOR; + } + + $tmpArr = preg_split($separator, $this->get('query')); + $myts =& MyTextSanitizer::getInstance(); + foreach ($tmpArr as $tmp) { + $this->mQueries[] = $myts->addSlashes($tmp); + } + } + + function update(&$params) + { + $mids = $this->get('mids'); + if (count($mids) > 0) { + $params['mids'] = $mids; + } + + $params['queries'] = $this->mQueries; + $params['andor'] = $this->get('andor'); + $params['maxhit'] = 5; + } +} + +?>