From: <ki...@us...> - 2010-01-13 23:26:46
|
Revision: 451 http://xc-tokai.svn.sourceforge.net/xc-tokai/?rev=451&view=rev Author: kilica Date: 2010-01-13 23:26:38 +0000 (Wed, 13 Jan 2010) Log Message: ----------- update guest post Modified Paths: -------------- modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsDeleteAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsEditAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueDeleteAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/class/AuthType.class.php modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsDeleteForm.class.php modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueDeleteForm.class.php modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php modules_xq/trunk/xoops_trust_path/modules/xq/language/ja_utf8/main.php modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsDeleteAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsDeleteAction.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsDeleteAction.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -91,7 +91,7 @@ protected function _setupActionForm() { $this->mActionForm =& $this->mAsset->getObject('form', 'Ans',false,'delete'); - $this->mActionForm->prepare(); + $this->mActionForm->prepare($this->mAsset->mDirname); } /** Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsEditAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsEditAction.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/AnsEditAction.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -115,7 +115,7 @@ protected function _setupActionForm() { $this->mActionForm =& $this->mAsset->getObject('form', 'Ans',false,'edit'); - $this->mActionForm->prepare(); + $this->mActionForm->prepare($this->mAsset->mDirname); } /** Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueDeleteAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueDeleteAction.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueDeleteAction.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -64,7 +64,7 @@ protected function _setupActionForm() { $this->mActionForm =& $this->mAsset->getObject('form', 'Que',false,'delete'); - $this->mActionForm->prepare(); + $this->mActionForm->prepare($this->mDirname->mAsset); } /** Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -115,7 +115,7 @@ protected function _setupActionForm() { $this->mActionForm =& $this->mAsset->getObject('form', 'Que',false,'edit'); - $this->mActionForm->prepare(); + $this->mActionForm->prepare($this->mAsset->mDirname); } /** Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -101,7 +101,7 @@ if($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')){ //is Editor ? - $action = return $this->_getXqAuthType('edit'); + $action = $this->_getXqAuthType('edit'); XCube_DelegateUitls::call('Legacy_Category.CheckPermitByUserId', XCube_Ref($check), $this->mQue->get('cat_id'), $action, Xq_Utils::getUid(), $module); if($check==true){ return true; Modified: modules_xq/trunk/xoops_trust_path/modules/xq/class/AuthType.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/class/AuthType.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/class/AuthType.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -44,16 +44,16 @@ { $xqAuthType = explode('|', Xq_Utils::getModuleConfig('auth_type', $this->_mDirname)); switch($type){ - case 'view': + case self::VIEW: return $xqAuthType[0]; break; - case 'question': + case self::QUESTION: return $xqAuthType[1]; break; - case 'answer': + case self::ANSWER: return $xqAuthType[2]; break; - case 'edit': + case self::EDIT: return $xqAuthType[3]; break; } Modified: modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsDeleteForm.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsDeleteForm.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsDeleteForm.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -12,12 +12,15 @@ require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php'; require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php'; +require_once XQ_TRUST_PATH . '/class/AuthType.class.php'; /** * Xq_AnsDeleteForm **/ class Xq_AnsDeleteForm extends XCube_ActionForm { + protected $_mDirname = ""; + /** * getTokenName * @@ -39,6 +42,7 @@ **/ public function prepare() { + $this->_mDirname = $dirname; // // Set form properties // Modified: modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -12,12 +12,16 @@ require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php'; require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php'; +require_once XQ_TRUST_PATH . '/class/AuthType.class.php'; /** * Xq_AnsEditForm **/ class Xq_AnsEditForm extends XCube_ActionForm { + protected $_mPasssword = ""; + protected $_mDirname = ""; + /** * getTokenName * @@ -39,6 +43,7 @@ **/ public function prepare() { + $this->_mDirname = $dirname; // // Set form properties // @@ -116,6 +121,7 @@ $this->set('comment', $obj->get('comment')); $this->set('ans_unixtime', $obj->get('ans_unixtime')); $this->set('cmt_unixtime', $obj->get('cmt_unixtime')); + $this->_mPassword = $obj->get('password'); } /** @@ -140,6 +146,32 @@ //$obj->set('ans_unixtime', $this->get('ans_unixtime')); //$obj->set('cmt_unixtime', $this->get('cmt_unixtime')); } + + /** + * updvalidatePasswordate + * + * @param void + * + * @return void + **/ + public function validatePassword() + { + if(XCube_Root::getSingleton()->mContext->mUser->isInRole('Site.RegisteredUser')){ + $authType = new Xq_AuthType($this->_mDirname); + //is Editor ? + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $this->get('cat_id'), $authType->getAuthType('edit'), Xq_Utils::getUid(), $module); + if($check==true){ + return; + } + } + + if($this->_mPassword && ! $this->get('uid')){ + if($this->_mPassword != $this->get('password')){ + $this->mErrorFlag = true; + $this->addErrorMessage(_MD_XQ_ERROR_INCORRECT_PASSWORD); + } + } + } } ?> Modified: modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueDeleteForm.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueDeleteForm.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueDeleteForm.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -12,12 +12,15 @@ require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php'; require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php'; +require_once XQ_TRUST_PATH . '/class/AuthType.class.php'; /** * Xq_QueDeleteForm **/ class Xq_QueDeleteForm extends XCube_ActionForm { + protected $_mDirname = ""; + /** * getTokenName * @@ -37,8 +40,9 @@ * * @return void **/ - public function prepare() + public function prepare($dirname) { + $this->_mDirname = $dirname; // // Set form properties // Modified: modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php 2010-01-13 23:26:38 UTC (rev 451) @@ -12,12 +12,16 @@ require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php'; require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php'; +require_once XQ_TRUST_PATH . '/class/AuthType.class.php'; /** * Xq_QueEditForm **/ class Xq_QueEditForm extends XCube_ActionForm { + protected $_mPasssword = ""; + protected $_mDirname = ""; + /** * getTokenName * @@ -37,8 +41,9 @@ * * @return void **/ - public function prepare() + public function prepare($dirname="") { + $this->_mDirname = $dirname; // // Set form properties // @@ -80,8 +85,7 @@ $this->mFieldProperties['name']->addVar('maxlength', '64'); $this->mFieldProperties['password'] = new XCube_FieldProperty($this); - $this->mFieldProperties['password']->setDependsByArray(array('required','maxlength')); - $this->mFieldProperties['password']->addMessage('required', _MD_XQ_ERROR_REQUIRED, _MD_XQ_LANG_PASSWORD, '8'); + $this->mFieldProperties['password']->setDependsByArray(array('maxlength')); $this->mFieldProperties['password']->addMessage('maxlength', _MD_XQ_ERROR_MAXLENGTH, _MD_XQ_LANG_PASSWORD, '8'); $this->mFieldProperties['password']->addVar('maxlength', '8'); } @@ -117,6 +121,7 @@ $this->set('reg_unixtime', $obj->get('reg_unixtime')); $this->set('end_date', date("Y/m/d", $obj->get('end_unixtime'))); $this->set('end_unixtime', $obj->get('end_unixtime')); + $this->_mPassword = $obj->get('password'); } /** @@ -142,6 +147,33 @@ $end_unixtime = mktime(0, 0, 0, $endUnixtimeArray[1], $endUnixtimeArray[2], $endUnixtimeArray[0]); $obj->set('end_unixtime', $end_unixtime); } + + /** + * updvalidatePasswordate + * + * @param void + * + * @return void + **/ + public function validatePassword() + { + if(XCube_Root::getSingleton()->mContext->mUser->isInRole('Site.RegisteredUser')){ + $authType = new Xq_AuthType($this->_mDirname); + //is Editor ? + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $this->get('cat_id'), $authType->getAuthType('edit'), Xq_Utils::getUid()); + //var_dump($check);echo $this->_mDirname;die(); + if($check==true){ + return; + } + } + + if($this->_mPassword && ! $this->get('uid')){ + if($this->_mPassword != $this->get('password')){ + $this->mErrorFlag = true; + $this->addErrorMessage(_MD_XQ_ERROR_INCORRECT_PASSWORD); + } + } + } } ?> Modified: modules_xq/trunk/xoops_trust_path/modules/xq/language/ja_utf8/main.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/language/ja_utf8/main.php 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/language/ja_utf8/main.php 2010-01-13 23:26:38 UTC (rev 451) @@ -15,6 +15,7 @@ define('_MD_XQ_ERROR_OBJECTEXIST', "{0}の入力値が不正です"); define('_MD_XQ_ERROR_DBUPDATE_FAILED', "データベースの更新に失敗しました"); define('_MD_XQ_ERROR_EMAIL', "{0}は不正なメールアドレスです"); +define('_MD_XQ_ERROR_INCORRECT_PASSWORD', "パスワードが正しくありません"); define('_MD_XQ_MESSAGE_CONFIRM_DELETE', "以下のデータを本当に削除しますか?"); define('_MD_XQ_LANG_ADD_A_NEW_QUE', "質問する"); define('_MD_XQ_LANG_QUE_ID', "QUE_ID"); Modified: modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html 2010-01-13 23:26:38 UTC (rev 451) @@ -18,13 +18,19 @@ </select> </dd> <dt><{$smarty.const._MD_XQ_LANG_NAME}></dt> - <{if ! $xoops_isuser && ! $actionForm->get('name')}> - <dd> - <{xoops_input type=text name=name value=$actionForm->get('name') size=15 maxlength=64}> - </dd> + <{if ! $xoops_isuser}> + <{if ! $actionForm->get('name')}> + <dd> + <{xoops_input type=text name=name value=$actionForm->get('name') size=15 maxlength=64}> + </dd> + <{else}> + <{xoops_input type=hidden name=name value=$actionForm->get('name')}> + <{/if}> + <{/if}> + <{if ! $xoops_isuser}> <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> <dd> - <{xoops_input type=text name=password value=$actionForm->get('password') size=15 maxlength=8}> + <{xoops_input type=text name=password value="" size=15 maxlength=8}> </dd> <{/if}> <dt><{$smarty.const._MD_XQ_LANG_EXP}></dt> Modified: modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html 2010-01-13 14:39:57 UTC (rev 450) +++ modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html 2010-01-13 23:26:38 UTC (rev 451) @@ -50,7 +50,7 @@ <div class="itemFoot"> <span class="itemStats"> <{$smarty.const._MD_XQ_LANG_END_UNIXTIME}> : <{if $object->get('end_unixtime') == 0}><{$smarty.const._MD_XQ_LANG_NO_END_UNIXTIME}><{else}><{$object->get('end_unixtime')|xoops_formattimestamp:s}><{/if}> - <{if $object->checkCloseAnswer()==false}><a href="./index.php?action=ReplyEdit&que_id=<{$object->get('que_id')}>"><img src="images/answer.gif" alt="<{$smarty.const._MD_XQ_LANG_ADD_A_NEW_ANS}>" /></a><{else}><img src="images/closed.gif" alt="<{$smarty.const._MD_XQ_LANG_CLOSED}>" /><{/if}> + <{if $object->checkCloseAnswer()==false}><a href="./index.php?action=AnsEdit&que_id=<{$object->get('que_id')}>"><img src="images/answer.gif" alt="<{$smarty.const._MD_XQ_LANG_ADD_A_NEW_ANS}>" /></a><{else}><img src="images/closed.gif" alt="<{$smarty.const._MD_XQ_LANG_CLOSED}>" /><{/if}> </span> </div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |