mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-03 06:55:03 +03:00
This commit is contained in:
parent
53623d4d82
commit
803b87becb
|
@ -73,21 +73,19 @@ class ActionTalk extends Action {
|
||||||
$this->Security_ValidateSendForm();
|
$this->Security_ValidateSendForm();
|
||||||
/**
|
/**
|
||||||
* Получаем номер сообщения из УРЛ и проверяем существует ли оно
|
* Получаем номер сообщения из УРЛ и проверяем существует ли оно
|
||||||
*/
|
*/
|
||||||
$sTalkId=$this->GetParam(0);
|
$sTalkId=$this->GetParam(0);
|
||||||
if (!$oTalk=$this->Talk_GetTalkByIdAndUserId($sTalkId,$this->oUserCurrent->getId())) {
|
if (!($oTalk=$this->Talk_GetTalkById($sTalkId))) {
|
||||||
return parent::EventNotFound();
|
return parent::EventNotFound();
|
||||||
}
|
}
|
||||||
|
if (!($oTalkUser=$this->Talk_GetTalkUser($oTalk->getId(),$this->oUserCurrent->getId()))) {
|
||||||
|
return parent::EventNotFound();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Обработка удаления сообщения
|
* Обработка удаления сообщения
|
||||||
*/
|
*/
|
||||||
if ($oTalkUser=$this->Talk_GetTalkUser($sTalkId,$this->oUserCurrent->getId())) {
|
$this->Talk_DeleteTalkUserByArray($sTalkId,$this->oUserCurrent->getId());
|
||||||
if ($this->Talk_DeleteTalkUser($oTalkUser)) {
|
func_header_location(DIR_WEB_ROOT.'/'.ROUTE_PAGE_TALK.'/');
|
||||||
func_header_location(DIR_WEB_ROOT.'/'.ROUTE_PAGE_TALK.'/');
|
|
||||||
} else {
|
|
||||||
$this->Message_AddError($this->Lang_Get('system_error'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,11 +97,7 @@ class ActionTalk extends Action {
|
||||||
$this->Security_ValidateSendForm();
|
$this->Security_ValidateSendForm();
|
||||||
$aTalksIdDel=getRequest('talk_del');
|
$aTalksIdDel=getRequest('talk_del');
|
||||||
if (is_array($aTalksIdDel)) {
|
if (is_array($aTalksIdDel)) {
|
||||||
foreach ($aTalksIdDel as $sTalkId => $value) {
|
$this->Talk_DeleteTalkUserByArray(array_keys($aTalksIdDel),$this->oUserCurrent->getId());
|
||||||
if ($oTalkUser=$this->Talk_GetTalkUser($sTalkId,$this->oUserCurrent->getId())) {
|
|
||||||
$this->Talk_DeleteTalkUser($oTalkUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -168,8 +162,7 @@ class ActionTalk extends Action {
|
||||||
$oTalkUser->setCommentIdLast($iMaxIdComment);
|
$oTalkUser->setCommentIdLast($iMaxIdComment);
|
||||||
$oTalkUser->setCommentCountNew(0);
|
$oTalkUser->setCommentCountNew(0);
|
||||||
$this->Talk_UpdateTalkUser($oTalkUser);
|
$this->Talk_UpdateTalkUser($oTalkUser);
|
||||||
|
|
||||||
|
|
||||||
$this->Viewer_AddHtmlTitle($oTalk->getTitle());
|
$this->Viewer_AddHtmlTitle($oTalk->getTitle());
|
||||||
$this->Viewer_Assign('oTalk',$oTalk);
|
$this->Viewer_Assign('oTalk',$oTalk);
|
||||||
$this->Viewer_Assign('aComments',$aComments);
|
$this->Viewer_Assign('aComments',$aComments);
|
||||||
|
|
|
@ -304,8 +304,8 @@ class LsTalk extends Module {
|
||||||
* @param TalkEntity_TalkUser $oTalkUser
|
* @param TalkEntity_TalkUser $oTalkUser
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
public function DeleteTalkUser(TalkEntity_TalkUser $oTalkUser) {
|
public function DeleteTalkUserByArray($aTalkId,$sUserId) {
|
||||||
return $this->oMapper->DeleteTalkUser($oTalkUser);
|
return $this->oMapper->DeleteTalkUserByArray($aTalkId,$sUserId);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Есть ли юзер в этом разговоре
|
* Есть ли юзер в этом разговоре
|
||||||
|
@ -372,7 +372,13 @@ class LsTalk extends Module {
|
||||||
$data=$this->oMapper->GetUsersTalk($sTalkId);
|
$data=$this->oMapper->GetUsersTalk($sTalkId);
|
||||||
return $this->User_GetUsersAdditionalData($data);
|
return $this->User_GetUsersAdditionalData($data);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Увеличивает число новых комментов у юзеров
|
||||||
|
*
|
||||||
|
* @param unknown_type $sTalkId
|
||||||
|
* @param unknown_type $aExcludeId
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
public function increaseCountCommentNew($sTalkId,$aExcludeId=null) {
|
public function increaseCountCommentNew($sTalkId,$aExcludeId=null) {
|
||||||
return $this->oMapper->increaseCountCommentNew($sTalkId,$aExcludeId);
|
return $this->oMapper->increaseCountCommentNew($sTalkId,$aExcludeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
<?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
|
|
||||||
*
|
|
||||||
---------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
class TalkEntity_TalkComment extends Entity
|
|
||||||
{
|
|
||||||
public function getId() {
|
|
||||||
return $this->_aData['talk_comment_id'];
|
|
||||||
}
|
|
||||||
public function getPid() {
|
|
||||||
return $this->_aData['talk_comment_pid'];
|
|
||||||
}
|
|
||||||
public function getTalkId() {
|
|
||||||
return $this->_aData['talk_id'];
|
|
||||||
}
|
|
||||||
public function getUserId() {
|
|
||||||
return $this->_aData['user_id'];
|
|
||||||
}
|
|
||||||
public function getText() {
|
|
||||||
return $this->_aData['talk_comment_text'];
|
|
||||||
}
|
|
||||||
public function getDate() {
|
|
||||||
return $this->_aData['talk_comment_date'];
|
|
||||||
}
|
|
||||||
public function getUserIp() {
|
|
||||||
return $this->_aData['talk_comment_user_ip'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getUserLogin() {
|
|
||||||
return $this->_aData['user_login'];
|
|
||||||
}
|
|
||||||
public function getLevel() {
|
|
||||||
return $this->_aData['level'];
|
|
||||||
}
|
|
||||||
public function getUserProfileAvatar() {
|
|
||||||
return $this->_aData['user_profile_avatar'];
|
|
||||||
}
|
|
||||||
public function getUserProfileAvatarType() {
|
|
||||||
return $this->_aData['user_profile_avatar_type'];
|
|
||||||
}
|
|
||||||
public function getUserProfileAvatarPath($iSize=100) {
|
|
||||||
if ($this->getUserProfileAvatar()) {
|
|
||||||
return DIR_WEB_ROOT.DIR_UPLOADS_IMAGES.'/'.$this->getUserId().'/avatar_'.$iSize.'x'.$iSize.'.'.$this->getUserProfileAvatarType();
|
|
||||||
} else {
|
|
||||||
return DIR_STATIC_SKIN.'/images/avatar_'.$iSize.'x'.$iSize.'.jpg';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public function getTalkTitle() {
|
|
||||||
return $this->_aData['talk_title'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function setId($data) {
|
|
||||||
$this->_aData['talk_comment_id']=$data;
|
|
||||||
}
|
|
||||||
public function setPid($data) {
|
|
||||||
$this->_aData['talk_comment_pid']=$data;
|
|
||||||
}
|
|
||||||
public function setTalkId($data) {
|
|
||||||
$this->_aData['talk_id']=$data;
|
|
||||||
}
|
|
||||||
public function setUserId($data) {
|
|
||||||
$this->_aData['user_id']=$data;
|
|
||||||
}
|
|
||||||
public function setText($data) {
|
|
||||||
$this->_aData['talk_comment_text']=$data;
|
|
||||||
}
|
|
||||||
public function setDate($data) {
|
|
||||||
$this->_aData['talk_comment_date']=$data;
|
|
||||||
}
|
|
||||||
public function setUserIp($data) {
|
|
||||||
$this->_aData['talk_comment_user_ip']=$data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -140,14 +140,18 @@ class Mapper_Talk extends Mapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function DeleteTalkUser(TalkEntity_TalkUser $oTalkUser) {
|
public function DeleteTalkUserByArray($aTalkId,$sUserId) {
|
||||||
|
if (!is_array($aTalkId)) {
|
||||||
|
$aTalkId=array($aTalkId);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM ".DB_TABLE_TALK_USER."
|
$sql = "DELETE FROM ".DB_TABLE_TALK_USER."
|
||||||
WHERE
|
WHERE
|
||||||
talk_id = ?d
|
talk_id IN (?a)
|
||||||
AND
|
AND
|
||||||
user_id = ?d
|
user_id = ?d
|
||||||
";
|
";
|
||||||
if ($this->oDb->query($sql,$oTalkUser->getTalkId(),$oTalkUser->getUserId()))
|
if ($this->oDb->query($sql,$aTalkId,$sUserId))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -155,19 +159,15 @@ class Mapper_Talk extends Mapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function GetCountCommentNew($sUserId) {
|
public function GetCountCommentNew($sUserId) {
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(tc.talk_comment_id) as count_new
|
SUM(tu.comment_count_new) as count_new
|
||||||
FROM
|
FROM
|
||||||
".DB_TABLE_TALK_COMMENT." as tc,
|
|
||||||
".DB_TABLE_TALK_USER." as tu
|
".DB_TABLE_TALK_USER." as tu
|
||||||
WHERE
|
WHERE
|
||||||
(tc.talk_comment_date>tu.date_last or tu.date_last IS NULL)
|
tu.user_id = ?d
|
||||||
AND
|
|
||||||
tu.user_id = ?d
|
|
||||||
AND
|
|
||||||
tu.talk_id=tc.talk_id
|
|
||||||
";
|
";
|
||||||
if ($aRow=$this->oDb->selectRow($sql,$sUserId)) {
|
if ($aRow=$this->oDb->selectRow($sql,$sUserId)) {
|
||||||
return $aRow['count_new'];
|
return $aRow['count_new'];
|
||||||
|
|
Loading…
Reference in a new issue