Minahito
minah****@users*****
2006年 2月 2日 (木) 18:29:01 JST
Index: xoops2jp/html/modules/comment/service/LegacyCommentService.class.php diff -u xoops2jp/html/modules/comment/service/LegacyCommentService.class.php:1.1.2.2 xoops2jp/html/modules/comment/service/LegacyCommentService.class.php:removed --- xoops2jp/html/modules/comment/service/LegacyCommentService.class.php:1.1.2.2 Thu Nov 24 18:45:07 2005 +++ xoops2jp/html/modules/comment/service/LegacyCommentService.class.php Thu Feb 2 18:29:01 2006 @@ -1,173 +0,0 @@ -<?php - -require_once XOOPS_ROOT_PATH."/class/XCube_Service.class.php"; - -/** - * - * - * - * - */ -class LegacyCommentService extends XCube_Service -{ - var $mRule; - - function doSetConfig(&$parameters) - { - $this->mRule=$parameters['rule']; - - $dmy=null; - return $dmy; - } - - function doGetComment(&$parameters) - { - $commentHandler=&xoops_getmodulehandler('comments','comment'); - $comment=&$commentHandler->get($parameters['Id']); - - return $comment; - } - - function doGetComments(&$parameters) - { - $commentHandler=&xoops_getmodulehandler('comments','comment'); - $comments=&$commentHandler->getObjectsByObjId($parameters['ObjectId']); - - return $comments; - } - - function doPost(&$parameters) - { - $ret=false; - - /* TODO START */ - $commentHandler=&xoops_getmodulehandler('comments','comment'); - $comment=&$commentHandler->create(); - - $comment->setVar('obj_id',$parameters['ObjectId']); - - if(isset($parameters['Icon'])) { - $comment->setVar('icon',$parameters['Icon']); - } - else { - $comment->setVar('icon','blank.gif'); - } - - $comment->setVar('title',$parameters['Title']); - $comment->setVar('message',$parameters['Message']); - $comment->setVar('uid',$parameters['User']->getId()); - - $comment->setVar("status",XOOPS_COMMENT_PENDING); - - if(isset($parameters['Ip'])) - $comment->setVar("ip",$parameters['Ip']); - - if(!$commentHandler->insert($comment)) - return $ret; - - // - // If this is a top comment, set own id as root id. - // - $comment->setVar('root_id',$comment->getVar('id')); - if($commentHandler->insert($comment)) { - $ret=&$comment; - } - else { - $commentHandler->delete($comment); - } - - return $ret; - } - - function doPostResponse(&$parameters) - { - $ret=false; - - // - // TODO We must remove 'CODE CLONE' - // - - - /* TODO START */ - $commentHandler=&xoops_getmodulehandler('comments','comment'); - $parentComment=&$commentHandler->get($parameters['ParentId']); - if(!is_object($parentComment)) - return $ret; - - $comment=&$parentComment->createChild(); - - if(isset($parameters['Icon'])) { - $comment->setVar('icon',$parameters['Icon']); - } - else { - $comment->setVar('icon','blank.gif'); - } - - $comment->setVar('title',$parameters['Title']); - $comment->setVar('message',$parameters['Message']); - $comment->setVar('uid',$parameters['User']->getId()); - - $comment->setVar("status",XOOPS_COMMENT_PENDING); - - if(isset($parameters['Ip'])) - $comment->setVar("ip",$parameters['Ip']); - - if(!$commentHandler->insert($comment)) - return $ret; - - /* TODO END */ - - if($commentHandler->insert($comment)) - $ret=&$comment; - - return $ret; - } - - function doGetTotalComments(&$parameters) - { - $ret=0; - - $commentHandler=&xoops_gethandler('comment'); - - $criteria=new CriteriaCompo(new Criteria('com_modid',$parameters['mid'])); - $criteria->add(new Criteria('com_itemid',$parameters['itemId'])); - $criteria->add(new Criteria("com_status",XOOPS_COMMENT_ACTIVE)); - $ret=$commentHandler->getCount($criteria); - - return $ret; - } - - function doDelete(&$parameters) - { - $commentHandler=&xoops_gethandler('comment'); - $id=$parameters['Id']; - $comment=&$commentHandler->get($id); - - // - // Check - // - - $ret = $commentHandler->delete($comment); - - return $ret; - } - - function doDeleteAll(&$parameters) - { - $ret=true; //< TODO - - $commentHandler=&xoops_gethandler('comment'); - $id=$parameters['Id']; - $comment=&$commentHandler->get($id); - - // - // Check - // - - $commentHandler->deleteWithChild($comment); - - return $ret; - } -} - -?> \ No newline at end of file