[xoops-cvslog 6528] CVS update: xoops2jp/html/modules/legacy/forms

Back to archive index

NobuNobu nobun****@users*****
2007年 4月 30日 (月) 16:31:49 JST


Index: xoops2jp/html/modules/legacy/forms/CommentEditForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/CommentEditForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/CommentEditForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,174 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+
+/**
+ * This class is generated by makeActionForm tool.
+ */
+class Legacy_CommentEditForm extends XCube_ActionForm
+{
+	function getTokenName()
+	{
+		return "module.legacy.Legacy_CommentEditForm.TOKEN";
+	}
+
+	function prepare()
+	{
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['com_id'] =& new XCube_IntProperty('com_id');
+		$this->mFormProperties['com_pid'] =& new XCube_IntProperty('com_pid');
+		$this->mFormProperties['com_rootid'] =& new XCube_IntProperty('com_rootid');
+		$this->mFormProperties['com_modid'] =& new XCube_IntProperty('com_modid');
+		$this->mFormProperties['com_itemid'] =& new XCube_IntProperty('com_itemid');
+		$this->mFormProperties['com_icon'] =& new XCube_StringProperty('com_icon');
+		$this->mFormProperties['com_created'] =& new XCube_IntProperty('com_created');
+		$this->mFormProperties['com_modified'] =& new XCube_IntProperty('com_modified');
+		$this->mFormProperties['com_ip'] =& new XCube_StringProperty('com_ip');
+		$this->mFormProperties['com_title'] =& new XCube_StringProperty('com_title');
+		$this->mFormProperties['com_text'] =& new XCube_TextProperty('com_text');
+		$this->mFormProperties['com_sig'] =& new XCube_BoolProperty('com_sig');
+		$this->mFormProperties['com_status'] =& new XCube_IntProperty('com_status');
+		$this->mFormProperties['com_exparams'] =& new XCube_StringProperty('com_exparams');
+		$this->mFormProperties['dosmiley'] =& new XCube_BoolProperty('dosmiley');
+		$this->mFormProperties['doxcode'] =& new XCube_BoolProperty('doxcode');
+		$this->mFormProperties['doimage'] =& new XCube_BoolProperty('doimage');
+		$this->mFormProperties['dobr'] =& new XCube_BoolProperty('dobr');
+
+		//
+		// Set field properties
+		//
+		$this->mFieldProperties['com_id'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_id']->setDependsByArray(array('required'));
+		$this->mFieldProperties['com_id']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ID);
+
+		$this->mFieldProperties['com_pid'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_pid']->setDependsByArray(array('required'));
+		$this->mFieldProperties['com_pid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_PID);
+
+		$this->mFieldProperties['com_rootid'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_rootid']->setDependsByArray(array('required'));
+		$this->mFieldProperties['com_rootid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ROOTID);
+
+		$this->mFieldProperties['com_modid'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_modid']->setDependsByArray(array('required'));
+		$this->mFieldProperties['com_modid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_MODID);
+
+		$this->mFieldProperties['com_itemid'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_itemid']->setDependsByArray(array('required'));
+		$this->mFieldProperties['com_itemid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ITEMID);
+
+		$this->mFieldProperties['com_icon'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_icon']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['com_icon']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ICON, '25');
+		$this->mFieldProperties['com_icon']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_ICON, '25');
+		$this->mFieldProperties['com_icon']->addVar('maxlength', 25);
+
+		$this->mFieldProperties['com_ip'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_ip']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['com_ip']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_IP, '15');
+		$this->mFieldProperties['com_ip']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_IP, '15');
+		$this->mFieldProperties['com_ip']->addVar('maxlength', 15);
+
+		$this->mFieldProperties['com_title'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_title']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['com_title']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_TITLE, '255');
+		$this->mFieldProperties['com_title']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_TITLE, '255');
+		$this->mFieldProperties['com_title']->addVar('maxlength', 255);
+
+		$this->mFieldProperties['com_text'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_text']->setDependsByArray(array('required'));
+		$this->mFieldProperties['com_text']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_TEXT);
+
+		$this->mFieldProperties['com_exparams'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['com_exparams']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['com_exparams']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_EXPARAMS, '255');
+		$this->mFieldProperties['com_exparams']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_EXPARAMS, '255');
+		$this->mFieldProperties['com_exparams']->addVar('maxlength', 255);
+	}
+
+	function load(&$obj)
+	{
+		$this->set('com_id', $obj->get('com_id'));
+		$this->set('com_pid', $obj->get('com_pid'));
+		$this->set('com_rootid', $obj->get('com_rootid'));
+		$this->set('com_modid', $obj->get('com_modid'));
+		$this->set('com_itemid', $obj->get('com_itemid'));
+		$this->set('com_icon', $obj->get('com_icon'));
+		$this->set('com_created', $obj->get('com_created'));
+		$this->set('com_modified', $obj->get('com_modified'));
+		$this->set('com_ip', $obj->get('com_ip'));
+		$this->set('com_title', $obj->get('com_title'));
+		$this->set('com_text', $obj->get('com_text'));
+		$this->set('com_sig', $obj->get('com_sig'));
+		$this->set('com_status', $obj->get('com_status'));
+		$this->set('com_exparams', $obj->get('com_exparams'));
+		$this->set('dosmiley', $obj->get('dosmiley'));
+		$this->set('doxcode', $obj->get('doxcode'));
+		$this->set('doimage', $obj->get('doimage'));
+		$this->set('dobr', $obj->get('dobr'));
+	}
+
+	function update(&$obj)
+	{
+		$obj->set('com_id', $this->get('com_id'));
+		$obj->set('com_pid', $this->get('com_pid'));
+		$obj->set('com_rootid', $this->get('com_rootid'));
+		$obj->set('com_modid', $this->get('com_modid'));
+		$obj->set('com_itemid', $this->get('com_itemid'));
+		$obj->set('com_icon', $this->get('com_icon'));
+		$obj->set('com_created', $this->get('com_created'));
+		$obj->set('com_modified', time());
+
+		//
+		// TODO check NONAME form
+		//	$obj->set('com_uid', $this->get('com_uid'));
+
+		//
+		// TODO  IP will be changed when a administrator will edit or a user will
+		//      edit again.
+		//
+		$obj->set('com_ip', $_SERVER['REMOTE_ADDR']);
+		$obj->set('com_title', $this->get('com_title'));
+		$obj->set('com_text', $this->get('com_text'));
+		$obj->set('com_sig', $this->get('com_sig'));
+		$obj->set('com_status', $this->get('com_status'));
+		$obj->set('com_exparams', $this->get('com_exparams'));
+		$obj->set('dosmiley', $this->get('dosmiley'));
+		$obj->set('doxcode', $this->get('doxcode'));
+		$obj->set('doimage', $this->get('doimage'));
+		$obj->set('dobr', $this->get('dobr'));
+	}
+}
+
+class Legacy_CommentEditForm_Admin extends Legacy_CommentEditForm
+{
+	function prepare()
+	{
+		parent::prepare();
+		
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['dohtml'] =& new XCube_BoolProperty('dohtml');
+	}
+
+	function load(&$obj)
+	{
+		parent::load($obj);
+
+		$this->set('dohtml', $obj->get('dohtml'));
+	}
+
+	function update(&$obj)
+	{
+		update::load($obj);
+
+		$obj->set('dohtml', $this->get('dohtml'));
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/ImageFilterForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/ImageFilterForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/ImageFilterForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,60 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractFilterForm.class.php";
+
+define('IMAGE_SORT_KEY_IMAGE_ID', 1);
+define('IMAGE_SORT_KEY_IMAGE_NAME', 2);
+define('IMAGE_SORT_KEY_IMAGE_NICENAME', 3);
+define('IMAGE_SORT_KEY_IMAGE_MIMETYPE', 4);
+define('IMAGE_SORT_KEY_IMAGE_CREATED', 5);
+define('IMAGE_SORT_KEY_IMAGE_DISPLAY', 6);
+define('IMAGE_SORT_KEY_IMAGE_WEIGHT', 7);
+define('IMAGE_SORT_KEY_IMGCAT_ID', 8);
+define('IMAGE_SORT_KEY_MAXVALUE', 8);
+
+define('IMAGE_SORT_KEY_DEFAULT', IMAGE_SORT_KEY_IMAGE_WEIGHT);
+
+class Legacy_ImageFilterForm extends Legacy_AbstractFilterForm
+{
+	var $_mSortKeys = array(
+		IMAGE_SORT_KEY_IMAGE_ID => 'image_id',
+		IMAGE_SORT_KEY_IMAGE_NAME => 'image_name',
+		IMAGE_SORT_KEY_IMAGE_NICENAME => 'image_nicename',
+		IMAGE_SORT_KEY_IMAGE_MIMETYPE => 'image_mimetype',
+		IMAGE_SORT_KEY_IMAGE_CREATED => 'image_created',
+		IMAGE_SORT_KEY_IMAGE_DISPLAY => 'image_display',
+		IMAGE_SORT_KEY_IMAGE_WEIGHT => 'image_weight',
+		IMAGE_SORT_KEY_IMGCAT_ID => 'imgcat_id'
+	);
+
+	function getDefaultSortKey()
+	{
+		return IMAGE_SORT_KEY_DEFAULT;
+	}
+
+	function fetch()
+	{
+		parent::fetch();
+
+		$this->mNavi->addExtra('target', xoops_getrequest('target'));
+	
+		if (isset($_REQUEST['imgcat_id'])) {
+			$this->mNavi->addExtra('imgcat_id', xoops_getrequest('imgcat_id'));
+			$this->_mCriteria->add(new Criteria('imgcat_id', array(XOBJ_DTYPE_INT, xoops_getrequest('imgcat_id'))));
+		}
+		else {
+			$this->_mCriteria->add(new Criteria('imgcat_id', 0));
+		}
+		
+		$this->_mCriteria->add(new Criteria('image_display', 1));
+
+		$this->_mCriteria->addSort($this->getSort(), $this->getOrder());
+		if (abs($this->mSort) != IMAGE_SORT_KEY_IMAGE_WEIGHT) {
+			$this->_mCriteria->addSort(IMAGE_SORT_KEY_IMAGE_WEIGHT, $this->getOrder());
+		}
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/ImageUploadForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/ImageUploadForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/ImageUploadForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,155 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
+
+class Legacy_ImageUploadForm extends XCube_ActionForm
+{
+	var $mOldFileName = null;
+	var $_mIsNew = null;
+	var $mFormFile = null;
+
+	function getTokenName()
+	{
+		return "module.legacy.ImageUploadForm.TOKEN" . $this->get('imgcat_id');
+	}
+
+	function prepare()
+	{
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['image_name'] =& new XCube_ImageFileProperty('image_name');
+		$this->mFormProperties['image_nicename'] =& new XCube_StringProperty('image_nicename');
+		$this->mFormProperties['imgcat_id'] =& new XCube_IntProperty('imgcat_id');
+	
+		//
+		// Set field properties
+		//
+		$this->mFieldProperties['image_name'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_name']->setDependsByArray(array('extension'));
+		$this->mFieldProperties['image_name']->addVar('extension', 'jpg,gif,png');
+	
+		$this->mFieldProperties['image_nicename'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['image_nicename']->setDependsByArray(array('required'));
+		$this->mFieldProperties['image_nicename']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_IMAGE_NICENAME);
+		
+		$this->mFieldProperties['imgcat_id'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['imgcat_id']->setDependsByArray(array('required','objectExist'));
+		$this->mFieldProperties['imgcat_id']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_IMGCAT_ID);
+		$this->mFieldProperties['imgcat_id']->addMessage('objectExist', _MD_LEGACY_ERROR_OBJECTEXIST, _MD_LEGACY_LANG_IMGCAT_ID);
+		$this->mFieldProperties['imgcat_id']->addVar('handler', 'imagecategory');
+		$this->mFieldProperties['imgcat_id']->addVar('module', 'legacy');
+	}
+	
+	/**
+	 * Check the permission of uploading.
+	 */	
+	function validateImgcat_id()
+	{
+		$imgcat_id = $this->get('imgcat_id');
+		if ($imgcat_id != null) {
+			$root =& XCube_Root::getSingleton();
+			$xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser;
+			
+			$groups = array();
+			if (is_object($xoopsUser)) {
+				$groups =& $xoopsUser->getGroups();
+			}
+			else {
+				$groups = array(XOOPS_GROUP_ANONYMOUS);
+			}
+			
+			$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
+			$imgcat =& $handler->get($imgcat_id);
+			if (is_object($imgcat) && !$imgcat->hasUploadPerm($groups)) {
+				$this->addErrorMessage(_MD_LEGACY_ERROR_PERMISSION);
+			}
+		}
+	}
+
+	function validateImage_name()
+	{
+		$formFile = $this->get('image_name');
+		
+		if ($formFile == null && $this->_mIsNew ) {
+			$this->addErrorMessage(_MD_LEGACY_ERROR_YOU_MUST_UPLOAD);
+		}
+	}
+	
+	function validate()
+	{
+		parent::validate();
+		
+		$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
+		$category =& $handler->get($this->get('imgcat_id'));
+		
+		$formFile = $this->get('image_name');
+
+		if ($formFile != null && is_object($category)) {
+			//
+			// Imagefile width & height check.
+			//
+			if ($formFile->getWidth() > $category->get('imgcat_maxwidth') || $formFile->getHeight() > $category->get('imgcat_maxheight')) {
+				$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_IMG_SIZE, $category->get('imgcat_maxwidth'), $category->get('imgcat_maxheight')));
+			}
+			
+			//
+			// Check file size
+			//
+			if ($formFile->getFilesize() > $category->get('imgcat_maxsize')) {
+				$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_IMG_FILESIZE, $category->get('imgcat_maxsize')));
+			}
+		}
+	}
+	
+	function load(&$obj)
+	{
+		$this->set('image_nicename', $obj->get('image_nicename'));
+		$this->set('imgcat_id', $obj->get('imgcat_id'));
+		
+		$this->_mIsNew = $obj->isNew();
+		$this->mOldFileName = $obj->get('image_name');
+	}
+
+	function update(&$obj)
+	{
+		$obj->set('image_nicename', $this->get('image_nicename'));
+		$obj->set('image_display', true);
+		$obj->set('imgcat_id', $this->get('imgcat_id'));
+		
+		$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
+		$category =& $handler->get($this->get('imgcat_id'));
+
+		$this->mFormFile = $this->get('image_name');
+		
+		if ($this->mFormFile != null) {
+			$this->mFormFile->setRandomToBodyName('img');
+			
+			$filename = $this->mFormFile->getBodyName();
+			$this->mFormFile->setBodyName(substr($filename, 0, 24));
+	
+			$obj->set('image_name', $this->mFormFile->getFileName());
+			$obj->set('image_mimetype', $this->mFormFile->getContentType());
+			
+			//
+			// To store db
+			//
+			if ($category->get('imgcat_storetype') == 'db') {
+				$obj->loadImageBody();
+				if (!is_object($obj->mImageBody)) {
+					$obj->mImageBody =& $obj->createImageBody();
+				}
+					
+				//
+				// Access to private member property.
+				//
+				$obj->mImageBody->set('image_body', file_get_contents($this->mFormFile->_mTmpFileName));
+			}
+		}
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/MiscFriendForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/MiscFriendForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/MiscFriendForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,64 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
+
+class Legacy_MiscFriendForm extends XCube_ActionForm
+{
+	function getTokenName()
+	{
+		return "module.legacy.MiscFriendForm.TOKEN";
+	}
+
+	function prepare()
+	{
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['yname'] =& new XCube_StringProperty('yname');
+		$this->mFormProperties['ymail'] =& new XCube_StringProperty('ymail');
+		$this->mFormProperties['fname'] =& new XCube_StringProperty('fname');
+		$this->mFormProperties['fmail'] =& new XCube_StringProperty('fmail');
+	
+		//
+		// Set field properties
+		//
+	
+		$this->mFieldProperties['yname'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['yname']->setDependsByArray(array('required'));
+		$this->mFieldProperties['yname']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_YNAME);
+	
+		$this->mFieldProperties['ymail'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['ymail']->setDependsByArray(array('required','email'));
+		$this->mFieldProperties['ymail']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_YMAIL);
+		$this->mFieldProperties['ymail']->addMessage('required', _MD_LEGACY_ERROR_EMAIL, _MD_LEGACY_LANG_YMAIL);
+	
+		$this->mFieldProperties['fname'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['fname']->setDependsByArray(array('required'));
+		$this->mFieldProperties['fname']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_FNAME);
+	
+		$this->mFieldProperties['fmail'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['fmail']->setDependsByArray(array('required','email'));
+		$this->mFieldProperties['fmail']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_FMAIL);
+		$this->mFieldProperties['fmail']->addMessage('email', _MD_LEGACY_ERROR_EMAIL, _MD_LEGACY_LANG_FMAIL);
+	}
+	
+	function load(&$user)
+	{
+		$this->set('yname', $user->get('uname'));
+		$this->set('ymail', $user->get('email'));
+	}
+	
+	function update(&$mailer)
+	{
+		$mailer->assign("YOUR_NAME", $this->get('yname'));
+		$mailer->assign("FRIEND_NAME", $this->get('fname'));
+		$mailer->setToEmails($this->get('fmail'));
+		$mailer->setFromEmail($this->get('ymail'));
+		$mailer->setFromName($this->get('yname'));
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/NotifyDeleteForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/NotifyDeleteForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/NotifyDeleteForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,44 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
+
+class Legacy_NotifyDeleteForm extends XCube_ActionForm
+{
+	var $mNotifiyIds = array();
+	var $mFatalError = false;
+	
+	function getTokenName()
+	{
+		return $_SERVER['REQUEST_METHOD'] == 'POST' ? "module.legacy.NotifyDeleteForm.TOKEN" : null;
+	}
+
+	function fetch()
+	{
+		parent::fetch();
+		
+		$root =& XCube_Root::getSingleton();
+		$t_arr = $root->mContext->mRequest->getRequest('del_not');
+		
+		if (!is_array($t_arr)) {
+			$this->addErrorMessage(_MD_LEGACY_LANG_ERROR);
+			$this->mFatalError = true;
+			return;
+		}
+		
+		foreach ($t_arr as $t_modid => $t_idArr) {
+			if (!is_array($t_idArr)) {
+				$this->addErrorMessage(_MD_LEGACY_LANG_ERROR);
+				$this->mFatalError = true;
+				return;
+			}
+			foreach ($t_idArr as $t_id) {
+				$this->mNotifiyIds[] = array('modid' => intval($t_modid), 'id' => intval($t_id));
+			}
+		}
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/SearchResultsForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/SearchResultsForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/SearchResultsForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,98 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
+
+class Legacy_SearchResultsForm extends XCube_ActionForm
+{
+	var $mQueries = array();
+	var $_mKeywordMin = 0;
+	
+	function Legacy_SearchResultsForm($keywordMin)
+	{
+		parent::XCube_ActionForm();
+		$this->_mKeywordMin = intval($keywordMin);
+	}
+		
+	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('mask', _MD_LEGACY_ERROR_MASK, _MD_LEGACY_LANG_ANDOR);
+		$this->mFieldProperties['andor']->addVar('mask', '/^(AND|OR|exact)$/i');
+	}
+	
+	function fetch()
+	{
+		parent::fetch();
+		
+		$t_queries = array();
+		
+		$myts =& MyTextSanitizer::getInstance();
+		if ($this->get('andor') == 'exact' && strlen($this->get('query')) >= $this->_mKeywordMin) {
+			$this->mQueries[] = $myts->addSlashes($this->get('query'));
+		}
+		else {
+			$query = $this->get('query');
+			if (defined('XOOPS_USE_MULTIBYTES')) {
+				$query = xoops_trim($query);
+			}
+
+			$separator = '/[\s,]+/';
+			if (defined('_MD_LEGACY_FORMAT_SEARCH_SEPARATOR')) {
+				$separator = _MD_LEGACY_FORMAT_SEARCH_SEPARATOR;
+			}
+		
+			$tmpArr = preg_split($separator, $query);
+			foreach ($tmpArr as $tmp) {
+				if (strlen($tmp) >= $this->_mKeywordMin) {
+					$this->mQueries[] = $myts->addSlashes($tmp);
+				}
+			}
+		}
+		
+		$this->set('query', implode(" ", $this->mQueries));
+	}
+	
+	function fetchAndor()
+	{
+		if ($this->get('andor') == "") {
+			$this->set('andor', 'AND');
+		}
+	}
+	
+	function validate()
+	{
+		parent::validate();
+		
+		if (!count($this->mQueries)) {
+			$this->addErrorMessage(_MD_LEGACY_ERROR_SEARCH_QUERY_REQUIRED);
+		}
+	}
+	
+	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'] = LEGACY_SEARCH_RESULT_MAXHIT;
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/SearchShowallForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/SearchShowallForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/SearchShowallForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,42 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
+
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SearchResultsForm.class.php";
+
+class Legacy_SearchShowallForm extends Legacy_SearchResultsForm
+{
+	function prepare()
+	{
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['mid'] =& new XCube_IntProperty('mid');
+		$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('mask', _MD_LEGACY_ERROR_MASK, _MD_LEGACY_LANG_ANDOR);
+		$this->mFieldProperties['andor']->addVar('mask', '/^(AND|OR|exact)$/i');
+
+		$this->set('start', 0);
+	}
+	
+	function update(&$params)
+	{
+		$params['queries'] = $this->mQueries;
+		$params['andor'] = $this->get('andor');
+		$params['maxhit'] = LEGACY_SEARCH_SHOWALL_MAXHIT;
+		$params['start'] = $this->get('start');
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/SearchShowallbyuserForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/SearchShowallbyuserForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/SearchShowallbyuserForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,42 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
+
+require_once XOOPS_MODULE_PATH . "/legacy/forms/SearchShowallForm.class.php";
+
+class Legacy_SearchShowallbyuserForm extends Legacy_SearchShowallForm
+{
+	function prepare()
+	{
+		parent::prepare();
+		
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['uid'] =& new XCube_IntProperty('uid');
+		$this->mFormProperties['mid'] =& new XCube_IntProperty('mid');
+		$this->mFormProperties['start'] =& new XCube_IntProperty('start');
+		
+		//
+		// Set field properties
+		//
+		$this->mFieldProperties['uid'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['uid']->setDependsByArray(array('required'));
+		$this->mFieldProperties['uid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_UID);
+		
+		$this->mFieldProperties['mid'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['mid']->setDependsByArray(array('required'));
+		$this->mFieldProperties['mid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_MID);
+	}
+	
+	function update(&$params)
+	{
+		$params['uid'] = $this->get('uid');
+		$params['start'] = $this->get('start');
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/SmilesFilterForm.class.php
diff -u /dev/null xoops2jp/html/modules/legacy/forms/SmilesFilterForm.class.php:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/SmilesFilterForm.class.php	Mon Apr 30 16:31:49 2007
@@ -0,0 +1,43 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractFilterForm.class.php";
+
+define('SMILES_SORT_KEY_ID', 1);
+define('SMILES_SORT_KEY_CODE', 2);
+define('SMILES_SORT_KEY_SMILE_URL', 3);
+define('SMILES_SORT_KEY_EMOTION', 4);
+define('SMILES_SORT_KEY_DISPLAY', 5);
+define('SMILES_SORT_KEY_MAXVALUE', 5);
+
+define('SMILES_SORT_KEY_DEFAULT', SMILES_SORT_KEY_ID);
+
+class Legacy_SmilesFilterForm extends Legacy_AbstractFilterForm
+{
+	var $mSortKeys = array(
+		SMILES_SORT_KEY_ID => 'id',
+		SMILES_SORT_KEY_CODE => 'code',
+		SMILES_SORT_KEY_SMILE_URL => 'smile_url',
+		SMILES_SORT_KEY_EMOTION => 'emotion',
+		SMILES_SORT_KEY_DISPLAY => 'display'
+	);
+
+	function getDefaultSortKey()
+	{
+		return SMILES_SORT_KEY_ID;
+	}
+
+	function fetch()
+	{
+		parent::fetch();
+	
+		if (isset($_REQUEST['target'])) {
+			$this->mNavi->addExtra('target', xoops_getrequest('target'));
+		}
+		
+		$this->_mCriteria->addSort($this->getSort(), $this->getOrder());
+	}
+}
+
+?>
Index: xoops2jp/html/modules/legacy/forms/index.html
diff -u /dev/null xoops2jp/html/modules/legacy/forms/index.html:1.1.4.1
--- /dev/null	Mon Apr 30 16:31:49 2007
+++ xoops2jp/html/modules/legacy/forms/index.html	Mon Apr 30 16:31:49 2007
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index