2009-01-10 21:17:59 +02:00
|
|
|
<?php
|
|
|
|
/*-------------------------------------------------------
|
|
|
|
*
|
|
|
|
* LiveStreet Engine Social Networking
|
|
|
|
* Copyright © 2008 Mzhelskiy Maxim
|
|
|
|
*
|
|
|
|
*--------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Official site: www.livestreet.ru
|
|
|
|
* Contact e-mail: rus.engine@gmail.com
|
|
|
|
*
|
|
|
|
* GNU General Public License, version 2:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
*
|
|
|
|
---------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Получение новых комментов
|
|
|
|
*/
|
|
|
|
|
|
|
|
set_include_path(get_include_path().PATH_SEPARATOR.dirname(dirname(dirname(__FILE__))));
|
2009-03-21 15:48:00 +02:00
|
|
|
$sDirRoot=dirname(dirname(dirname(__FILE__)));
|
|
|
|
require_once($sDirRoot."/config/config.ajax.php");
|
2009-01-10 21:17:59 +02:00
|
|
|
|
|
|
|
$idCommentLast=@$_REQUEST['idCommentLast'];
|
2009-06-27 12:10:11 +03:00
|
|
|
$idTopic=@$_REQUEST['idTarget'];
|
2009-01-10 21:17:59 +02:00
|
|
|
$bStateError=true;
|
|
|
|
$sMsg='';
|
|
|
|
$sMsgTitle='';
|
|
|
|
$iMaxIdComment=0;
|
|
|
|
$aComments=array();
|
|
|
|
if ($oEngine->User_IsAuthorization()) {
|
|
|
|
$oUserCurrent=$oEngine->User_GetUserCurrent();
|
2009-06-27 12:10:11 +03:00
|
|
|
if ($oTopic=$oEngine->Topic_GetTopicById($idTopic)) {
|
2009-06-24 00:35:20 +03:00
|
|
|
$aReturn=$oEngine->Comment_GetCommentsNewByTargetId($oTopic->getId(),'topic',$idCommentLast);
|
2009-01-24 11:54:59 +02:00
|
|
|
$iMaxIdComment=$aReturn['iMaxIdComment'];
|
|
|
|
|
|
|
|
$oTopicRead=new TopicEntity_TopicRead();
|
|
|
|
$oTopicRead->setTopicId($oTopic->getId());
|
|
|
|
$oTopicRead->setUserId($oUserCurrent->getId());
|
|
|
|
$oTopicRead->setCommentCountLast($oTopic->getCountComment());
|
|
|
|
$oTopicRead->setCommentIdLast($iMaxIdComment);
|
|
|
|
$oTopicRead->setDateRead(date("Y-m-d H:i:s"));
|
|
|
|
$oEngine->Topic_SetTopicRead($oTopicRead);
|
|
|
|
|
|
|
|
$aCmts=$aReturn['comments'];
|
|
|
|
if ($aCmts and is_array($aCmts)) {
|
|
|
|
foreach ($aCmts as $aCmt) {
|
|
|
|
$aComments[]=array(
|
|
|
|
'html' => $aCmt['html'],
|
|
|
|
'idParent' => $aCmt['obj']->getPid(),
|
|
|
|
'id' => $aCmt['obj']->getId(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$bStateError=false;
|
|
|
|
} else {
|
2009-04-17 16:58:38 +03:00
|
|
|
$sMsgTitle=$oEngine->Lang_Get('error');
|
|
|
|
$sMsg=$oEngine->Lang_Get('system_error');
|
2009-01-24 11:54:59 +02:00
|
|
|
}
|
2009-01-10 21:17:59 +02:00
|
|
|
} else {
|
2009-04-17 16:58:38 +03:00
|
|
|
$sMsgTitle=$oEngine->Lang_Get('error');
|
|
|
|
$sMsg=$oEngine->Lang_Get('need_authorization');
|
2009-01-10 21:17:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['_RESULT'] = array(
|
|
|
|
"bStateError" => $bStateError,
|
|
|
|
"sMsgTitle" => $sMsgTitle,
|
|
|
|
"sMsg" => $sMsg,
|
|
|
|
"aComments" => $aComments,
|
|
|
|
"iMaxIdComment" => $iMaxIdComment,
|
|
|
|
);
|
|
|
|
|
2009-04-15 14:29:43 +03:00
|
|
|
?>
|