mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-05-17 00:08:17 +03:00
добавлен аватар к блогам; теперь число новых комментов видно в спике топиков; ограничение по времени на постинг комментов; защита от дублирования комментов; возможность запрещать комментировать топик; кеширование статических страниц; защита "от дурака" при создании циклической зависимости между статическими страницами; уведомление при добавлении в друзья; возможность указывать свой текст при скрытии текста тегом [cut]; фикс ошибки при подключении блоков, могла возникать на некоторых хостингах; фикс ошибки при ресайзе прозрачных картинок, раньше прозрачный фон становился черным
This commit is contained in:
parent
e1309cf175
commit
04cd51dab1
|
@ -184,6 +184,22 @@ class ActionBlog extends Action {
|
|||
$oBlog->setDateAdd(date("Y-m-d H:i:s"));
|
||||
$oBlog->setLimitRatingTopic(getRequest('blog_limit_rating_topic'));
|
||||
$oBlog->setUrl(getRequest('blog_url'));
|
||||
/**
|
||||
* Загрузка аватара, делаем ресайзы
|
||||
*/
|
||||
if (is_uploaded_file($_FILES['avatar']['tmp_name'])) {
|
||||
$sFileTmp=$_FILES['avatar']['tmp_name'];
|
||||
if ($sFileAvatar=func_img_resize($sFileTmp,DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId(),"avatar_blog_{$oBlog->getUrl()}_48x48",3000,3000,48,48)) {
|
||||
func_img_resize($sFileTmp,DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId(),"avatar_blog_{$oBlog->getUrl()}_24x24",3000,3000,24,24);
|
||||
func_img_resize($sFileTmp,DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId(),"avatar_blog_{$oBlog->getUrl()}",3000,3000);
|
||||
$oBlog->setAvatar(1);
|
||||
$aFileInfo=pathinfo($sFileAvatar);
|
||||
$oBlog->setAvatarType($aFileInfo['extension']);
|
||||
} else {
|
||||
$this->Message_AddError('Не удалось загрузить аватар','Ошибка');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Создаём блог
|
||||
*/
|
||||
|
@ -254,7 +270,33 @@ class ActionBlog extends Action {
|
|||
$oBlog->setDescription($sText);
|
||||
$oBlog->setType(getRequest('blog_type'));
|
||||
$oBlog->setLimitRatingTopic(getRequest('blog_limit_rating_topic'));
|
||||
$oBlog->setUrl(getRequest('blog_url'));
|
||||
//$oBlog->setUrl(getRequest('blog_url')); // запрещаем смену URL блога
|
||||
/**
|
||||
* Загрузка аватара, делаем ресайзы
|
||||
*/
|
||||
if (is_uploaded_file($_FILES['avatar']['tmp_name'])) {
|
||||
$sFileTmp=$_FILES['avatar']['tmp_name'];
|
||||
if ($sFileAvatar=func_img_resize($sFileTmp,DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId(),"avatar_blog_{$oBlog->getUrl()}_48x48",3000,3000,48,48)) {
|
||||
func_img_resize($sFileTmp,DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId(),"avatar_blog_{$oBlog->getUrl()}_24x24",3000,3000,24,24);
|
||||
func_img_resize($sFileTmp,DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId(),"avatar_blog_{$oBlog->getUrl()}",3000,3000);
|
||||
$oBlog->setAvatar(1);
|
||||
$aFileInfo=pathinfo($sFileAvatar);
|
||||
$oBlog->setAvatarType($aFileInfo['extension']);
|
||||
} else {
|
||||
$this->Message_AddError('Не удалось загрузить аватар','Ошибка');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Удалить аватар
|
||||
*/
|
||||
if (isset($_REQUEST['avatar_delete'])) {
|
||||
$oBlog->setAvatar(0);
|
||||
@unlink(DIR_SERVER_ROOT.DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId()."/avatar_blog_{$oBlog->getUrl()}_48x48.".$oBlog->getAvatarType());
|
||||
@unlink(DIR_SERVER_ROOT.DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId()."/avatar_blog_{$oBlog->getUrl()}_24x24.".$oBlog->getAvatarType());
|
||||
@unlink(DIR_SERVER_ROOT.DIR_UPLOADS_IMAGES.'/'.$oBlog->getOwnerId()."/avatar_blog_{$oBlog->getUrl()}.".$oBlog->getAvatarType());
|
||||
$oBlog->setAvatarType(null);
|
||||
}
|
||||
/**
|
||||
* Обновляем блог
|
||||
*/
|
||||
|
@ -393,14 +435,18 @@ class ActionBlog extends Action {
|
|||
$bOk=false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Проверяем есть ли URL блога, с заменой всех пробельных символов на "_"
|
||||
*/
|
||||
$blogUrl=preg_replace("/\s+/",'_',getRequest('blog_url'));
|
||||
$_REQUEST['blog_url']=$blogUrl;
|
||||
if (!func_check(getRequest('blog_url'),'login',2,50)) {
|
||||
$this->Message_AddError('URL блога должен быть от 2 до 50 символов и только на латинице + цифры и знаки "-", "_"','Ошибка');
|
||||
$bOk=false;
|
||||
|
||||
if (!$oBlog) {
|
||||
/**
|
||||
* Проверяем есть ли URL блога, с заменой всех пробельных символов на "_"
|
||||
* Проверка только в том случаи если создаём новый блог, т.к при редактировании URL нельзя менять
|
||||
*/
|
||||
$blogUrl=preg_replace("/\s+/",'_',getRequest('blog_url'));
|
||||
$_REQUEST['blog_url']=$blogUrl;
|
||||
if (!func_check(getRequest('blog_url'),'login',2,50)) {
|
||||
$this->Message_AddError('URL блога должен быть от 2 до 50 символов и только на латинице + цифры и знаки "-", "_"','Ошибка');
|
||||
$bOk=false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Проверяем на счет плохих УРЛов
|
||||
|
@ -618,6 +664,12 @@ class ActionBlog extends Action {
|
|||
if ($this->oUserCurrent) {
|
||||
$this->Topic_SetDateRead($oTopic->getId(),$this->oUserCurrent->getId());
|
||||
}
|
||||
/**
|
||||
* Запоминаем число комментов в топике для юзера, это понадобится при показе числа новых комментов
|
||||
*/
|
||||
if ($this->oUserCurrent) {
|
||||
$this->Topic_SetCountCommentLast($oTopic->getId(),$this->oUserCurrent->getId(),$oTopic->getCountComment());
|
||||
}
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -703,6 +755,12 @@ class ActionBlog extends Action {
|
|||
if ($this->oUserCurrent) {
|
||||
$this->Topic_SetDateRead($oTopic->getId(),$this->oUserCurrent->getId());
|
||||
}
|
||||
/**
|
||||
* Запоминаем число комментов в топике для юзера, это понадобится при показе числа новых комментов
|
||||
*/
|
||||
if ($this->oUserCurrent) {
|
||||
$this->Topic_SetCountCommentLast($oTopic->getId(),$this->oUserCurrent->getId(),$oTopic->getCountComment());
|
||||
}
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -1003,6 +1061,20 @@ class ActionBlog extends Action {
|
|||
$this->Message_AddError('Ваш рейтинг слишком мал для написания комментариев','Ошибка');
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Проверяем разрешено ли постить комменты по времени
|
||||
*/
|
||||
if (!$this->ACL_CanPostCommentTime($this->oUserCurrent)) {
|
||||
$this->Message_AddError('Вам нельзя писать комментарии слишком часто','Ошибка');
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Проверяем запрет на добавления коммента автором топика
|
||||
*/
|
||||
if ($oTopic->getForbidComment()) {
|
||||
$this->Message_AddError('Автор топика запретил добавлять комментарии','Ошибка');
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Проверяем текст комментария
|
||||
*/
|
||||
|
@ -1010,7 +1082,7 @@ class ActionBlog extends Action {
|
|||
if (!func_check($sText,'text',2,10000)) {
|
||||
$this->Message_AddError('Текст комментария должен быть от 2 до 3000 символов и не содержать разного рода каку','Ошибка');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Проверям на какой коммент отвечаем
|
||||
*/
|
||||
|
@ -1039,6 +1111,14 @@ class ActionBlog extends Action {
|
|||
*/
|
||||
$sParentId=null;
|
||||
}
|
||||
/**
|
||||
* Проверка на дублирующий коммент
|
||||
*/
|
||||
if ($this->Comment_GetCommentUnique($oTopic->getId(),$this->oUserCurrent->getId(),$sParentId,md5($sText))) {
|
||||
$this->Message_AddError('Стоп! Спам!','Ошибка');
|
||||
return false;
|
||||
}
|
||||
//exit();
|
||||
/**
|
||||
* Создаём коммент
|
||||
*/
|
||||
|
@ -1053,10 +1133,16 @@ class ActionBlog extends Action {
|
|||
$oCommentNew->setDate(date("Y-m-d H:i:s"));
|
||||
$oCommentNew->setUserIp(func_getIp());
|
||||
$oCommentNew->setPid($sParentId);
|
||||
$oCommentNew->setTextHash(md5($sText));
|
||||
/**
|
||||
* Добавляем коммент
|
||||
*/
|
||||
if ($this->Comment_AddComment($oCommentNew)) {
|
||||
if ($this->Comment_AddComment($oCommentNew)) {
|
||||
/**
|
||||
* Сохраняем дату последнего коммента для юзера
|
||||
*/
|
||||
$this->oUserCurrent->setDateCommentLast(date("Y-m-d H:i:s"));
|
||||
$this->User_Update($this->oUserCurrent);
|
||||
/**
|
||||
* Отправка уведомления автору топика
|
||||
*/
|
||||
|
@ -1097,4 +1183,4 @@ class ActionBlog extends Action {
|
|||
$this->Viewer_Assign('iCountTopicsNew',$this->iCountTopicsNew);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -180,6 +180,7 @@ class ActionLink extends Action {
|
|||
$_REQUEST['blog_id']=$oTopic->getBlogId();
|
||||
$_REQUEST['topic_id']=$oTopic->getId();
|
||||
$_REQUEST['topic_publish_index']=$oTopic->getPublishIndex();
|
||||
$_REQUEST['topic_forbid_comment']=$oTopic->getForbidComment();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -314,6 +315,13 @@ class ActionLink extends Action {
|
|||
$oTopic->setPublishIndex(1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запрет на комментарии к топику
|
||||
*/
|
||||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
/**
|
||||
* Добавляем топик
|
||||
*/
|
||||
|
@ -411,6 +419,13 @@ class ActionLink extends Action {
|
|||
$oTopic->setPublishIndex(0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запрет на комментарии к топику
|
||||
*/
|
||||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
/**
|
||||
* Сохраняем топик
|
||||
*/
|
||||
|
|
|
@ -149,6 +149,10 @@ class ActionPage extends Action {
|
|||
* Получаем и загружаем список всех страниц
|
||||
*/
|
||||
$aPages=$this->Page_GetPages();
|
||||
if (count($aPages)==0 and $this->Page_GetCountPage()) {
|
||||
$this->Page_SetPagesPidToNull();
|
||||
$aPages=$this->Page_GetPages();
|
||||
}
|
||||
$this->Viewer_Assign('aPages',$aPages);
|
||||
}
|
||||
/**
|
||||
|
@ -163,10 +167,15 @@ class ActionPage extends Action {
|
|||
if (!$this->CheckPageFields()) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if ($oPageEdit->getId()==getRequest('page_pid')) {
|
||||
$this->Message_AddError('Пытаетесь вложить страницу саму в себя?','Ошибка');
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Обновляем свойства страницы
|
||||
*/
|
||||
$oPage=new PageEntity_Page();
|
||||
*/
|
||||
$oPageEdit->setActive(getRequest('page_active') ? 1 : 0);
|
||||
$oPageEdit->setDateEdit(date("Y-m-d H:i:s"));
|
||||
if (getRequest('page_pid')==0) {
|
||||
|
@ -282,4 +291,4 @@ class ActionPage extends Action {
|
|||
return $bOk;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -147,6 +147,7 @@ class ActionQuestion extends Action {
|
|||
$_REQUEST['blog_id']=$oTopic->getBlogId();
|
||||
$_REQUEST['topic_id']=$oTopic->getId();
|
||||
$_REQUEST['topic_publish_index']=$oTopic->getPublishIndex();
|
||||
$_REQUEST['topic_forbid_comment']=$oTopic->getForbidComment();
|
||||
|
||||
$_REQUEST['answer']=array();
|
||||
$aAnswers=$oTopic->getQuestionAnswers();
|
||||
|
@ -287,6 +288,13 @@ class ActionQuestion extends Action {
|
|||
$oTopic->setPublishIndex(1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запрет на комментарии к топику
|
||||
*/
|
||||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
/**
|
||||
* Добавляем топик
|
||||
*/
|
||||
|
@ -392,7 +400,14 @@ class ActionQuestion extends Action {
|
|||
} else {
|
||||
$oTopic->setPublishIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запрет на комментарии к топику
|
||||
*/
|
||||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
/**
|
||||
* Сохраняем топик
|
||||
*/
|
||||
|
|
|
@ -154,6 +154,7 @@ class ActionTopic extends Action {
|
|||
$_REQUEST['blog_id']=$oTopic->getBlogId();
|
||||
$_REQUEST['topic_id']=$oTopic->getId();
|
||||
$_REQUEST['topic_publish_index']=$oTopic->getPublishIndex();
|
||||
$_REQUEST['topic_forbid_comment']=$oTopic->getForbidComment();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -323,20 +324,27 @@ class ActionTopic extends Action {
|
|||
$oTopic->setBlogId($oBlog->getId());
|
||||
$oTopic->setUserId($this->oUserCurrent->getId());
|
||||
$oTopic->setType('topic');
|
||||
$oTopic->setTitle(getRequest('topic_title'));
|
||||
$oTopic->setTitle(getRequest('topic_title'));
|
||||
$oTopic->setCutText(null);
|
||||
/**
|
||||
* Парсим на предмет ХТМЛ тегов
|
||||
*/
|
||||
$sText=$this->Text_Parser(getRequest('topic_text'));
|
||||
/**
|
||||
* Создаёт анонс топика(обрезаем по тег <cut>)
|
||||
*/
|
||||
*/
|
||||
$sTestShort=$sText;
|
||||
$sTextTemp=str_replace("\r\n",'[<n>]',$sText);
|
||||
if (preg_match("/^(.*)<cut>(.*)$/i",$sTextTemp,$aMatch)) {
|
||||
$sTestShort=$aMatch[1];
|
||||
$sTextTemp=str_replace("\r\n",'[<rn>]',$sText);
|
||||
$sTextTemp=str_replace("\n",'[<n>]',$sTextTemp);
|
||||
if (preg_match("/^(.*)<cut(.*)>(.*)$/Ui",$sTextTemp,$aMatch)) {
|
||||
$sTestShort=$aMatch[1];
|
||||
if (preg_match('/^\s*name\s*=\s*"(.+)"\s*$/Ui',$aMatch[2],$aMatchCut)) {
|
||||
$oTopic->setCutText(trim($aMatchCut[1]));
|
||||
}
|
||||
}
|
||||
$sTestShort=str_replace('[<n>]',"\r\n",$sTestShort);
|
||||
$sTestShort=str_replace('[<rn>]',"\r\n",$sTestShort);
|
||||
$sTestShort=str_replace('[<n>]',"\r\n",$sTestShort);
|
||||
|
||||
$oTopic->setText($sText);
|
||||
$oTopic->setTextShort($sTestShort);
|
||||
$oTopic->setTextSource(getRequest('topic_text'));
|
||||
|
@ -359,7 +367,14 @@ class ActionTopic extends Action {
|
|||
if (getRequest('topic_publish_index')) {
|
||||
$oTopic->setPublishIndex(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запрет на комментарии к топику
|
||||
*/
|
||||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
/**
|
||||
* Добавляем топик
|
||||
*/
|
||||
|
@ -437,7 +452,8 @@ class ActionTopic extends Action {
|
|||
* Теперь можно смело редактировать топик
|
||||
*/
|
||||
$oTopic->setBlogId($oBlog->getId());
|
||||
$oTopic->setTitle(getRequest('topic_title'));
|
||||
$oTopic->setTitle(getRequest('topic_title'));
|
||||
$oTopic->setCutText(null);
|
||||
/**
|
||||
* Парсим на предмет ХТМЛ тегов
|
||||
*/
|
||||
|
@ -445,8 +461,11 @@ class ActionTopic extends Action {
|
|||
$sTestShort=$sText;
|
||||
$sTextTemp=str_replace("\r\n",'[<rn>]',$sText);
|
||||
$sTextTemp=str_replace("\n",'[<n>]',$sTextTemp);
|
||||
if (preg_match("/^(.*)<cut>(.*)$/i",$sTextTemp,$aMatch)) {
|
||||
$sTestShort=$aMatch[1];
|
||||
if (preg_match("/^(.*)<cut(.*)>(.*)$/Ui",$sTextTemp,$aMatch)) {
|
||||
$sTestShort=$aMatch[1];
|
||||
if (preg_match('/^\s*name\s*=\s*"(.+)"\s*$/Ui',$aMatch[2],$aMatchCut)) {
|
||||
$oTopic->setCutText(trim($aMatchCut[1]));
|
||||
}
|
||||
}
|
||||
$sTestShort=str_replace('[<rn>]',"\r\n",$sTestShort);
|
||||
$sTestShort=str_replace('[<n>]',"\r\n",$sTestShort);
|
||||
|
@ -474,6 +493,13 @@ class ActionTopic extends Action {
|
|||
$oTopic->setPublishIndex(0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запрет на комментарии к топику
|
||||
*/
|
||||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
/**
|
||||
* Сохраняем топик
|
||||
*/
|
||||
|
|
|
@ -86,6 +86,12 @@ class ACL extends Module {
|
|||
* @return bool
|
||||
*/
|
||||
public function CanPostCommentTime(UserEntity_User $oUser) {
|
||||
if (ACL_CAN_POST_COMMENT_TIME>0 and $oUser->getDateCommentLast()) {
|
||||
$sDateCommentLast=strtotime($oUser->getDateCommentLast());
|
||||
if ($oUser->getRating()<ACL_CAN_POST_COMMENT_TIME_RATING and ((time()-$sDateCommentLast)<ACL_CAN_POST_COMMENT_TIME)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,12 @@ class BlogEntity_Blog extends Entity
|
|||
public function getUrl() {
|
||||
return $this->_aData['blog_url'];
|
||||
}
|
||||
public function getAvatar() {
|
||||
return $this->_aData['blog_avatar'];
|
||||
}
|
||||
public function getAvatarType() {
|
||||
return $this->_aData['blog_avatar_type'];
|
||||
}
|
||||
|
||||
public function getUserLogin() {
|
||||
return $this->_aData['user_login'];
|
||||
|
@ -76,7 +82,13 @@ class BlogEntity_Blog extends Entity
|
|||
public function getUserVoteDelta() {
|
||||
return $this->_aData['user_vote_delta'];
|
||||
}
|
||||
|
||||
public function getAvatarPath($iSize=48) {
|
||||
if ($this->getAvatar()) {
|
||||
return DIR_WEB_ROOT.DIR_UPLOADS_IMAGES.'/'.$this->getOwnerId()."/avatar_blog_{$this->getUrl()}_".$iSize.'x'.$iSize.'.'.$this->getAvatarType();
|
||||
} else {
|
||||
return DIR_STATIC_SKIN.'/img/avatar_blog_'.$iSize.'x'.$iSize.'.gif';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -117,5 +129,11 @@ class BlogEntity_Blog extends Entity
|
|||
public function setUrl($data) {
|
||||
$this->_aData['blog_url']=$data;
|
||||
}
|
||||
public function setAvatar($data) {
|
||||
$this->_aData['blog_avatar']=$data;
|
||||
}
|
||||
public function setAvatarType($data) {
|
||||
$this->_aData['blog_avatar_type']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -30,11 +30,13 @@ class Mapper_Blog extends Mapper {
|
|||
blog_type,
|
||||
blog_date_add,
|
||||
blog_limit_rating_topic,
|
||||
blog_url
|
||||
blog_url,
|
||||
blog_avatar,
|
||||
blog_avatar_type
|
||||
)
|
||||
VALUES(?d, ?, ?, ?, ?, ?, ?)
|
||||
VALUES(?d, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
";
|
||||
if ($iId=$this->oDb->query($sql,$oBlog->getOwnerId(),$oBlog->getTitle(),$oBlog->getDescription(),$oBlog->getType(),$oBlog->getDateAdd(),$oBlog->getLimitRatingTopic(),$oBlog->getUrl())) {
|
||||
if ($iId=$this->oDb->query($sql,$oBlog->getOwnerId(),$oBlog->getTitle(),$oBlog->getDescription(),$oBlog->getType(),$oBlog->getDateAdd(),$oBlog->getLimitRatingTopic(),$oBlog->getUrl(),$oBlog->getAvatar(),$oBlog->getAvatarType())) {
|
||||
return $iId;
|
||||
}
|
||||
return false;
|
||||
|
@ -51,11 +53,13 @@ class Mapper_Blog extends Mapper {
|
|||
blog_count_vote = ?d,
|
||||
blog_count_user= ?d,
|
||||
blog_limit_rating_topic= ?f ,
|
||||
blog_url= ?
|
||||
blog_url= ?,
|
||||
blog_avatar= ?,
|
||||
blog_avatar_type= ?
|
||||
WHERE
|
||||
blog_id = ?d
|
||||
";
|
||||
if ($this->oDb->query($sql,$oBlog->getTitle(),$oBlog->getDescription(),$oBlog->getType(),$oBlog->getDateEdit(),$oBlog->getRating(),$oBlog->getCountVote(),$oBlog->getCountUser(),$oBlog->getLimitRatingTopic(),$oBlog->getUrl(),$oBlog->getId())) {
|
||||
if ($this->oDb->query($sql,$oBlog->getTitle(),$oBlog->getDescription(),$oBlog->getType(),$oBlog->getDateEdit(),$oBlog->getRating(),$oBlog->getCountVote(),$oBlog->getCountUser(),$oBlog->getLimitRatingTopic(),$oBlog->getUrl(),$oBlog->getAvatar(),$oBlog->getAvatarType(),$oBlog->getId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -41,6 +41,17 @@ class Comment extends Module {
|
|||
public function GetCommentById($sId) {
|
||||
return $this->oMapperTopicComment->GetCommentById($sId);
|
||||
}
|
||||
/**
|
||||
* Получает уникальный коммент, это помогает спастись от дублей комментов
|
||||
*
|
||||
* @param unknown_type $sTopicId
|
||||
* @param unknown_type $sUserId
|
||||
* @param unknown_type $sCommentPid
|
||||
* @param unknown_type $sHash
|
||||
*/
|
||||
public function GetCommentUnique($sTopicId,$sUserId,$sCommentPid,$sHash) {
|
||||
return $this->oMapperTopicComment->GetCommentUnique($sTopicId,$sUserId,$sCommentPid,$sHash);
|
||||
}
|
||||
/**
|
||||
* Получить все комменты
|
||||
*
|
||||
|
|
|
@ -47,6 +47,9 @@ class CommentEntity_TopicComment extends Entity
|
|||
public function getDelete() {
|
||||
return $this->_aData['comment_delete'];
|
||||
}
|
||||
public function getTextHash() {
|
||||
return $this->_aData['comment_text_hash'];
|
||||
}
|
||||
|
||||
public function getUserLogin() {
|
||||
return $this->_aData['user_login'];
|
||||
|
@ -145,6 +148,8 @@ class CommentEntity_TopicComment extends Entity
|
|||
public function setDelete($data) {
|
||||
$this->_aData['comment_delete']=$data;
|
||||
}
|
||||
|
||||
public function setTextHash($data) {
|
||||
$this->_aData['comment_text_hash']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -103,6 +103,23 @@ class Mapper_TopicComment extends Mapper {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function GetCommentUnique($sTopicId,$sUserId,$sCommentPid,$sHash) {
|
||||
$sql = "SELECT * FROM ".DB_TABLE_TOPIC_COMMENT."
|
||||
WHERE
|
||||
topic_id = ?d
|
||||
AND
|
||||
user_id = ?d
|
||||
AND
|
||||
(comment_pid = ?) or (? is NULL and comment_pid is NULL)
|
||||
AND
|
||||
comment_text_hash =?
|
||||
";
|
||||
if ($aRow=$this->oDb->selectRow($sql,$sTopicId,$sUserId,$sCommentPid,$sCommentPid,$sHash)) {
|
||||
return new CommentEntity_TopicComment($aRow);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function GetCommentsAll(&$iCount,$iCurrPage,$iPerPage) {
|
||||
$sql = "SELECT
|
||||
c.*,
|
||||
|
@ -386,11 +403,12 @@ class Mapper_TopicComment extends Mapper {
|
|||
user_id,
|
||||
comment_text,
|
||||
comment_date,
|
||||
comment_user_ip
|
||||
comment_user_ip,
|
||||
comment_text_hash
|
||||
)
|
||||
VALUES(?, ?d, ?d, ?, ?, ?)
|
||||
VALUES(?, ?d, ?d, ?, ?, ?, ?)
|
||||
";
|
||||
if ($iId=$this->oDb->query($sql,$oComment->getPid(),$oComment->getTopicId(),$oComment->getUserId(),$oComment->getText(),$oComment->getDate(),$oComment->getUserIp()))
|
||||
if ($iId=$this->oDb->query($sql,$oComment->getPid(),$oComment->getTopicId(),$oComment->getUserId(),$oComment->getText(),$oComment->getDate(),$oComment->getUserIp(),$oComment->getTextHash()))
|
||||
{
|
||||
return $iId;
|
||||
}
|
||||
|
@ -449,11 +467,12 @@ class Mapper_TopicComment extends Mapper {
|
|||
comment_text= ?,
|
||||
comment_rating= ?f,
|
||||
comment_count_vote= ?d,
|
||||
comment_delete = ?d
|
||||
comment_delete = ?d ,
|
||||
comment_text_hash = ?
|
||||
WHERE
|
||||
comment_id = ?d
|
||||
";
|
||||
if ($this->oDb->query($sql,$oTopicComment->getText(),$oTopicComment->getRating(),$oTopicComment->getCountVote(),$oTopicComment->getDelete(),$oTopicComment->getId())) {
|
||||
if ($this->oDb->query($sql,$oTopicComment->getText(),$oTopicComment->getRating(),$oTopicComment->getCountVote(),$oTopicComment->getDelete(),$oTopicComment->getTextHash(),$oTopicComment->getId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,9 @@ class Notify extends Module {
|
|||
*
|
||||
*/
|
||||
public function Init() {
|
||||
if (!class_exists('Viewer')) {
|
||||
require_once("./classes/modules/sys_viewer/Viewer.class.php");
|
||||
}
|
||||
$this->oViewerLocal=new Viewer(Engine::getInstance());
|
||||
$this->oViewerLocal->Init();
|
||||
$this->oViewerLocal->VarAssign();
|
||||
|
@ -282,5 +285,25 @@ class Notify extends Module {
|
|||
$this->Mail_setHTML();
|
||||
$this->Mail_Send();
|
||||
}
|
||||
|
||||
public function SendUserFriendNew(UserEntity_User $oUserTo,UserEntity_User $oUserFrom) {
|
||||
/**
|
||||
* Передаём в шаблон переменные
|
||||
*/
|
||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
||||
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
|
||||
/**
|
||||
* Формируем шаблон
|
||||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch("notify.user_friend_new.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
*/
|
||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
||||
$this->Mail_SetSubject('Вас добавили в друзья');
|
||||
$this->Mail_SetBody($sBody);
|
||||
$this->Mail_setHTML();
|
||||
$this->Mail_Send();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -24,6 +24,7 @@ require_once('mapper/Page.mapper.class.php');
|
|||
*/
|
||||
class Page extends Module {
|
||||
protected $oMapper;
|
||||
protected $aRebuildIds=array();
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
|
@ -39,7 +40,12 @@ class Page extends Module {
|
|||
* @return unknown
|
||||
*/
|
||||
public function AddPage(PageEntity_Page $oPage) {
|
||||
return $this->oMapper->AddPage($oPage);
|
||||
if ($this->oMapper->AddPage($oPage)) {
|
||||
//чистим зависимые кеши
|
||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('page_change',"page_change_{$oPage->getId()}","page_change_urlfull_{$oPage->getUrlFull()}"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Обновляет страницу
|
||||
|
@ -48,7 +54,12 @@ class Page extends Module {
|
|||
* @return unknown
|
||||
*/
|
||||
public function UpdatePage(PageEntity_Page $oPage) {
|
||||
return $this->oMapper->UpdatePage($oPage);
|
||||
if ($this->oMapper->UpdatePage($oPage)) {
|
||||
//чистим зависимые кеши
|
||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('page_change',"page_change_{$oPage->getId()}","page_change_urlfull_{$oPage->getUrlFull()}"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Получает страницу по полному УРЛу
|
||||
|
@ -56,7 +67,15 @@ class Page extends Module {
|
|||
* @param unknown_type $sUrlFull
|
||||
*/
|
||||
public function GetPageByUrlFull($sUrlFull,$iActive=1) {
|
||||
return $this->oMapper->GetPageByUrlFull($sUrlFull,$iActive);
|
||||
if (false === ($data = $this->Cache_Get("page_{$sUrlFull}_{$iActive}"))) {
|
||||
$data = $this->oMapper->GetPageByUrlFull($sUrlFull,$iActive);
|
||||
if ($data) {
|
||||
$this->Cache_Set($data, "page_{$sUrlFull}_{$iActive}", array("page_change_{$data->getId()}"), 60*60*1);
|
||||
} else {
|
||||
$this->Cache_Set($data, "page_{$sUrlFull}_{$iActive}", array("page_change_urlfull_{$sUrlFull}"), 60*60*1);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* Получает страницу по её айдишнику
|
||||
|
@ -115,6 +134,13 @@ class Page extends Module {
|
|||
public function RebuildUrlFull($oPageStart) {
|
||||
$aPages=$this->GetPagesByPid($oPageStart->getId());
|
||||
foreach ($aPages as $oPage) {
|
||||
if ($oPage->getId()==$oPageStart->getId()) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($oPage->getId(),$this->aRebuildIds)) {
|
||||
continue;
|
||||
}
|
||||
$this->aRebuildIds[]=$oPage->getId();
|
||||
$oPage->setUrlFull($oPageStart->getUrlFull().'/'.$oPage->getUrl());
|
||||
$this->UpdatePage($oPage);
|
||||
$this->RebuildUrlFull($oPage);
|
||||
|
@ -137,7 +163,29 @@ class Page extends Module {
|
|||
* @return unknown
|
||||
*/
|
||||
public function deletePageById($sId) {
|
||||
return $this->oMapper->deletePageById($sId);
|
||||
if ($this->oMapper->deletePageById($sId)) {
|
||||
//чистим зависимые кеши
|
||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('page_change',"page_change_{$sId}"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Получает число статических страниц
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
public function GetCountPage() {
|
||||
return $this->oMapper->GetCountPage();
|
||||
}
|
||||
/**
|
||||
* Устанавливает ВСЕМ страницам PID = NULL
|
||||
* Это бывает нужно, когда особо "умный" админ зациклит страницы сами на себя..
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
public function SetPagesPidToNull() {
|
||||
return $this->oMapper->SetPagesPidToNull();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -58,6 +58,19 @@ class Mapper_Page extends Mapper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function SetPagesPidToNull() {
|
||||
$sql = "UPDATE ".DB_TABLE_PAGE."
|
||||
SET
|
||||
page_pid = null,
|
||||
page_url_full = page_url
|
||||
";
|
||||
if ($this->oDb->query($sql))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function GetPageByUrlFull($sUrlFull,$iActive) {
|
||||
$sql = "SELECT * FROM ".DB_TABLE_PAGE." WHERE page_url_full = ? and page_active = ?d ";
|
||||
if ($aRow=$this->oDb->selectRow($sql,$sUrlFull,$iActive)) {
|
||||
|
@ -97,6 +110,14 @@ class Mapper_Page extends Mapper {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function GetCountPage() {
|
||||
$sql = "SELECT count(*) as count FROM ".DB_TABLE_PAGE." ";
|
||||
if ($aRow=$this->oDb->selectRow($sql)) {
|
||||
return $aRow['count'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function GetPagesByPid($sPid) {
|
||||
$sql = "SELECT
|
||||
*
|
||||
|
|
|
@ -56,7 +56,8 @@ class Text extends Module {
|
|||
// Разрешённые параметры тегов
|
||||
$this->oJevix->cfgAllowTagParams('img', array('src', 'alt', 'title', 'align'));
|
||||
$this->oJevix->cfgAllowTagParams('a', array('title', 'href'));
|
||||
// Параметры тегов являющиеся обязяательными
|
||||
$this->oJevix->cfgAllowTagParams('cut', array('name'));
|
||||
// Параметры тегов являющиеся обязательными
|
||||
$this->oJevix->cfgSetTagParamsRequired('img', 'src');
|
||||
$this->oJevix->cfgSetTagParamsRequired('a', 'href');
|
||||
// Теги которые необходимо вырезать из текста вместе с контентом
|
||||
|
|
|
@ -35,8 +35,8 @@ function smarty_insert_block($aParams,&$oSmarty) {
|
|||
* Устанавливаем шаблон
|
||||
*/
|
||||
$sTemplate=$aParams['block'];
|
||||
$aPath=pathinfo($sTemplate);
|
||||
$sBlock=ucfirst($aPath['filename']);
|
||||
$aPath=pathinfo($sTemplate);
|
||||
$sBlock=ucfirst($aPath['basename']);
|
||||
/**
|
||||
* Подключаем необходимый обработчик
|
||||
*/
|
||||
|
|
|
@ -113,6 +113,7 @@ class Topic extends Module {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получить топик по айдишнику учитывая его доступность(publish)
|
||||
* если publish=-1 то publish не учитывается при выборке
|
||||
|
@ -649,6 +650,19 @@ class Topic extends Module {
|
|||
$this->oMapperTopic->AddTopicRead($sTopicId,$sUserId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Запоминаем число комментов при чтении топика
|
||||
*
|
||||
* @param unknown_type $sTopicId
|
||||
* @param unknown_type $sUserId
|
||||
* @param unknown_type $iCountComment
|
||||
*/
|
||||
public function SetCountCommentLast($sTopicId,$sUserId,$iCountComment) {
|
||||
$res=$this->oMapperTopic->SetCountCommentLast($sTopicId,$sUserId,$iCountComment);
|
||||
if ($res===0) {
|
||||
$this->oMapperTopic->AddTopicCommentLast($sTopicId,$sUserId,$iCountComment);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Получаем дату прочтения топика юзером
|
||||
*
|
||||
|
|
|
@ -84,8 +84,17 @@ class TopicEntity_Topic extends Entity
|
|||
public function getCountComment() {
|
||||
return $this->_aData['topic_count_comment'];
|
||||
}
|
||||
public function getCutText() {
|
||||
return $this->_aData['topic_cut_text'];
|
||||
}
|
||||
public function getForbidComment() {
|
||||
return $this->_aData['topic_forbid_comment'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getCountCommentNew() {
|
||||
return $this->_aData['count_comment_new'];
|
||||
}
|
||||
public function getTagsLink() {
|
||||
$aTags=explode(',',$this->getTags());
|
||||
foreach ($aTags as $key => $value) {
|
||||
|
@ -346,5 +355,11 @@ class TopicEntity_Topic extends Entity
|
|||
public function setCountComment($data) {
|
||||
$this->_aData['topic_count_comment']=$data;
|
||||
}
|
||||
public function setCutText($data) {
|
||||
$this->_aData['topic_cut_text']=$data;
|
||||
}
|
||||
public function setForbidComment($data) {
|
||||
$this->_aData['topic_forbid_comment']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -32,12 +32,14 @@ class Mapper_Topic extends Mapper {
|
|||
topic_date_add,
|
||||
topic_user_ip,
|
||||
topic_publish,
|
||||
topic_publish_index
|
||||
topic_publish_index,
|
||||
topic_cut_text,
|
||||
topic_forbid_comment
|
||||
)
|
||||
VALUES(?d, ?d, ?, ?, ?, ?, ?, ?d, ?d)
|
||||
VALUES(?d, ?d, ?, ?, ?, ?, ?, ?d, ?d, ?, ?)
|
||||
";
|
||||
if ($iId=$this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getUserId(),$oTopic->getType(),$oTopic->getTitle(),
|
||||
$oTopic->getTags(),$oTopic->getDateAdd(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishIndex()))
|
||||
$oTopic->getTags(),$oTopic->getDateAdd(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishIndex(),$oTopic->getCutText(),$oTopic->getForbidComment()))
|
||||
{
|
||||
$oTopic->setId($iId);
|
||||
$this->AddTopicContent($oTopic);
|
||||
|
@ -280,7 +282,8 @@ class Mapper_Topic extends Mapper {
|
|||
tv.vote_delta as user_vote_delta,
|
||||
IF(tqv.topic_id IS NULL,0,1) as user_question_is_vote,
|
||||
bu.is_moderator as user_is_blog_moderator,
|
||||
bu.is_administrator as user_is_blog_administrator
|
||||
bu.is_administrator as user_is_blog_administrator,
|
||||
IF(tcl.comment_count_last IS NULL,t_fast.topic_count_comment,t_fast.topic_count_comment-tcl.comment_count_last) as count_comment_new
|
||||
FROM (
|
||||
SELECT
|
||||
t.*,
|
||||
|
@ -309,6 +312,13 @@ class Mapper_Topic extends Mapper {
|
|||
FROM ".DB_TABLE_TOPIC_VOTE."
|
||||
WHERE user_voter_id = ?d
|
||||
) AS tv ON t_fast.topic_id=tv.topic_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
topic_id,
|
||||
comment_count_last
|
||||
FROM ".DB_TABLE_TOPIC_COMMENT_LAST."
|
||||
WHERE user_id = ?d
|
||||
) AS tcl ON t_fast.topic_id=tcl.topic_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
topic_id
|
||||
|
@ -328,7 +338,7 @@ class Mapper_Topic extends Mapper {
|
|||
";
|
||||
|
||||
$aTopics=array();
|
||||
if ($aRows=$this->oDb->select($sql,($iCurrPage-1)*$iPerPage, $iPerPage, $iCurrentUserId,$iCurrentUserId, $iCurrentUserId)) {
|
||||
if ($aRows=$this->oDb->select($sql,($iCurrPage-1)*$iPerPage, $iPerPage, $iCurrentUserId,$iCurrentUserId,$iCurrentUserId,$iCurrentUserId)) {
|
||||
foreach ($aRows as $aTopic) {
|
||||
$aTopics[]=new TopicEntity_Topic($aTopic);
|
||||
}
|
||||
|
@ -657,11 +667,13 @@ class Mapper_Topic extends Mapper {
|
|||
topic_rating= ?f,
|
||||
topic_count_vote= ?d,
|
||||
topic_count_read= ?d,
|
||||
topic_count_comment= ?d
|
||||
topic_count_comment= ?d,
|
||||
topic_cut_text = ? ,
|
||||
topic_forbid_comment = ?
|
||||
WHERE
|
||||
topic_id = ?d
|
||||
";
|
||||
if ($this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getTitle(),$oTopic->getTags(),$oTopic->getDateEdit(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishIndex(),$oTopic->getRating(),$oTopic->getCountVote(),$oTopic->getCountRead(),$oTopic->getCountComment(),$oTopic->getId())) {
|
||||
if ($this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getTitle(),$oTopic->getTags(),$oTopic->getDateEdit(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishIndex(),$oTopic->getRating(),$oTopic->getCountVote(),$oTopic->getCountRead(),$oTopic->getCountComment(),$oTopic->getCutText(),$oTopic->getForbidComment(),$oTopic->getId())) {
|
||||
$this->UpdateTopicContent($oTopic);
|
||||
return true;
|
||||
}
|
||||
|
@ -872,6 +884,38 @@ class Mapper_Topic extends Mapper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function SetCountCommentLast($sTopicId,$sUserId,$iCountComment) {
|
||||
$sDate=date("Y-m-d H:i:s");
|
||||
$sql = "UPDATE ".DB_TABLE_TOPIC_COMMENT_LAST."
|
||||
SET
|
||||
comment_count_last = ? ,
|
||||
date_last = ?
|
||||
WHERE
|
||||
user_id = ?
|
||||
and
|
||||
topic_id = ?
|
||||
";
|
||||
return $this->oDb->query($sql,$iCountComment,$sDate,$sUserId,$sTopicId);
|
||||
}
|
||||
|
||||
public function AddTopicCommentLast($sTopicId,$sUserId,$iCountComment) {
|
||||
$sDate=date("Y-m-d H:i:s");
|
||||
$sql = "INSERT INTO ".DB_TABLE_TOPIC_COMMENT_LAST."
|
||||
(topic_id,
|
||||
user_id,
|
||||
comment_count_last,
|
||||
date_last
|
||||
)
|
||||
VALUES(?d, ?d, ?d, ?)
|
||||
";
|
||||
if ($this->oDb->query($sql,$sTopicId,$sUserId,$iCountComment,$sDate)===0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function GetDateRead($sTopicId,$sUserId) {
|
||||
$sql = "SELECT
|
||||
date_read
|
||||
|
|
|
@ -44,6 +44,9 @@ class UserEntity_User extends Entity {
|
|||
public function getDateActivate() {
|
||||
return $this->_aData['user_date_activate'];
|
||||
}
|
||||
public function getDateCommentLast() {
|
||||
return $this->_aData['user_date_comment_last'];
|
||||
}
|
||||
public function getIpRegister() {
|
||||
return $this->_aData['user_ip_register'];
|
||||
}
|
||||
|
@ -170,6 +173,9 @@ class UserEntity_User extends Entity {
|
|||
public function setDateActivate($data) {
|
||||
$this->_aData['user_date_activate']=$data;
|
||||
}
|
||||
public function setDateCommentLast($data) {
|
||||
$this->_aData['user_date_comment_last']=$data;
|
||||
}
|
||||
public function setIpRegister($data) {
|
||||
$this->_aData['user_ip_register']=$data;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ class Mapper_User extends Mapper {
|
|||
user_skill = ? ,
|
||||
user_date_last = ? ,
|
||||
user_date_activate = ? ,
|
||||
user_date_comment_last = ? ,
|
||||
user_ip_last = ?,
|
||||
user_rating = ? ,
|
||||
user_count_vote = ? ,
|
||||
|
@ -78,6 +79,7 @@ class Mapper_User extends Mapper {
|
|||
$oUser->getSkill(),
|
||||
$oUser->getDateLast(),
|
||||
$oUser->getDateActivate(),
|
||||
$oUser->getDateCommentLast(),
|
||||
$oUser->getIpLast(),
|
||||
$oUser->getRating(),
|
||||
$oUser->getCountVote(),
|
||||
|
|
|
@ -53,7 +53,7 @@ define('SYS_LOGS_SQL_ERROR_FILE','sql_error.log'); // файл лога ошиб
|
|||
* Настройки кеширования
|
||||
*/
|
||||
define('SYS_CACHE_USE',true); // использовать кеширование или нет
|
||||
define('SYS_CACHE_TYPE','file'); // тип кеширования: file и memory(пока не работает). memory использует мемкеш
|
||||
define('SYS_CACHE_TYPE','file'); // тип кеширования: file и memory. memory использует мемкеш
|
||||
define('SYS_CACHE_DIR','/tmp/'); // каталог для файлового кеша, также используется для временных картинок
|
||||
define('SYS_CACHE_PREFIX','livestreet_cache'); // префикс кеширования, чтоб можно было на одной машине держать несколько сайтов с общим кешевым хранилищем
|
||||
|
||||
|
@ -92,6 +92,8 @@ define('SYS_MAIL_INCLUDE_TALK_TEXT',true); // Включает в уведомл
|
|||
*/
|
||||
define('ACL_CAN_CREATE_BLOG',1); // порог рейтинга при котором юзер может создать коллективный блог
|
||||
define('ACL_CAN_POST_COMMENT',-10); // порог рейтинга при котором юзер может добавлять комментарии
|
||||
define('ACL_CAN_POST_COMMENT_TIME',10); // время в секундах между постингом комментариев, если 0 то ограничение по времени не будет работать
|
||||
define('ACL_CAN_POST_COMMENT_TIME_RATING',1); // рейтинг, выше которого перестаёт действовать ограничение по времени на постинг комментов. Не имеет смысла при ACL_CAN_POST_COMMENT_TIME=0
|
||||
define('ACL_CAN_VOTE_COMMENT',-3); // порог рейтинга при котором юзер может голосовать за комментарии
|
||||
define('ACL_CAN_VOTE_BLOG',-5); // порог рейтинга при котором юзер может голосовать за блог
|
||||
define('ACL_CAN_VOTE_TOPIC',-7); // порог рейтинга при котором юзер может голосовать за топик
|
||||
|
|
|
@ -43,4 +43,5 @@ define('DB_TABLE_USER_ADMINISTRATOR',DB_PREFIX_TABLE.'user_administrator');
|
|||
define('DB_TABLE_TOPIC_COMMENT_ONLINE',DB_PREFIX_TABLE.'topic_comment_online');
|
||||
define('DB_TABLE_INVITE',DB_PREFIX_TABLE.'invite');
|
||||
define('DB_TABLE_PAGE',DB_PREFIX_TABLE.'page');
|
||||
?>
|
||||
define('DB_TABLE_TOPIC_COMMENT_LAST',DB_PREFIX_TABLE.'topic_comment_last');
|
||||
?>
|
||||
|
|
|
@ -43,6 +43,7 @@ if ($oEngine->User_IsAuthorization()) {
|
|||
$sMsgTitle='Поздравляем!';
|
||||
$sMsg='У вас появился новый друг';
|
||||
$bState=true;
|
||||
$oEngine->Notify_SendUserFriendNew($oUser,$oUserCurrent);
|
||||
} else {
|
||||
$sMsgTitle='Ошибка!';
|
||||
$sMsg='Внутреняя ошибка, попробуйте позже';
|
||||
|
|
|
@ -396,8 +396,10 @@ function func_img_resize($sFileSrc,$sDirDest,$sFileDest,$iWidthMax,$iHeightMax,$
|
|||
$sFileFullPath=DIR_SERVER_ROOT.'/'.$sDirDest.'/'.$sFileDest;
|
||||
@func_mkdir(DIR_SERVER_ROOT,$sDirDest);
|
||||
if ($iWidthDest and $iWidthDest!=$aSize[0]) {
|
||||
$img_dest=imagecreatetruecolor($iWidthNew,$iHeightNew);
|
||||
if (imagecopyresampled($img_dest,$img_src,0,0,0,0,$iWidthNew,$iHeightNew,$aSize[0],$aSize[1])) {
|
||||
$img_dest=imagecreatetruecolor($iWidthNew,$iHeightNew);
|
||||
imagesavealpha($img_dest,true);
|
||||
imagealphablending($img_dest,false);
|
||||
if (imagecopyresampled($img_dest,$img_src,0,0,0,0,$iWidthNew,$iHeightNew,$aSize[0],$aSize[1])) {
|
||||
imagedestroy($img_src);
|
||||
switch ($aSize['mime']) {
|
||||
case 'image/png':
|
||||
|
|
35
patch.sql
35
patch.sql
|
@ -129,7 +129,7 @@ ALTER TABLE `prefix_invite`
|
|||
ADD CONSTRAINT `prefix_invite_fk` FOREIGN KEY (`user_from_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `prefix_invite_fk1` FOREIGN KEY (`user_to_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `prefix_invite` ADD INDEX ( `invite_date_add` )
|
||||
ALTER TABLE `prefix_invite` ADD INDEX ( `invite_date_add` ) ;
|
||||
|
||||
|
||||
-- Дополнительные поля настройки у юзера
|
||||
|
@ -140,7 +140,7 @@ ALTER TABLE `prefix_user` ADD `user_settings_notice_reply_comment` TINYINT( 1 )
|
|||
|
||||
|
||||
|
||||
ALTER TABLE `prefix_blog` ADD INDEX ( `blog_title` )
|
||||
ALTER TABLE `prefix_blog` ADD INDEX ( `blog_title` ) ;
|
||||
|
||||
|
||||
--
|
||||
|
@ -177,6 +177,37 @@ ALTER TABLE `prefix_page`
|
|||
|
||||
|
||||
|
||||
|
||||
-- делаем индекс уникальным, а не просто индексом
|
||||
ALTER TABLE `prefix_topic_read` DROP INDEX `topic_id_user_id` ,
|
||||
ADD UNIQUE `topic_id_user_id` ( `topic_id` , `user_id` ) ;
|
||||
|
||||
-- новое поле для текста КАТа
|
||||
ALTER TABLE `prefix_topic` ADD `topic_cut_text` VARCHAR( 100 ) NULL ;
|
||||
|
||||
|
||||
-- новое поле для запрета комментов в топике
|
||||
ALTER TABLE `prefix_topic` ADD `topic_forbid_comment` TINYINT( 1 ) NOT NULL DEFAULT '0';
|
||||
|
||||
|
||||
-- новое поле для хранения хеша текста коммента
|
||||
ALTER TABLE `prefix_topic_comment` ADD `comment_text_hash` VARCHAR( 32 ) NOT NULL AFTER `comment_text` ;
|
||||
|
||||
|
||||
ALTER TABLE `prefix_user` CHANGE `user_profile_avatar_type` `user_profile_avatar_type` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;
|
||||
|
||||
-- поля для аватара блога
|
||||
ALTER TABLE `prefix_blog` ADD `blog_avatar` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `prefix_blog` ADD `blog_avatar_type` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ;
|
||||
|
||||
|
||||
-- поле для хранения даты последнего коммента, оставленого юзером
|
||||
ALTER TABLE `prefix_user` ADD `user_date_comment_last` DATETIME NULL AFTER `user_date_activate` ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- ВНИМАНИЕ!!! То что ниже нужно выполнить только после запуска скрипта convert.php !!!! иначе УДАЛЯТСЯ ВСЕ ТОПИКИ!!!!!
|
||||
--
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
<p>
|
||||
<label for="blog_url">URL блога:</label>
|
||||
<input type="text" id="blog_url" name="blog_url" value="{$_aRequest.blog_url}" style="width: 100%;" /><br />
|
||||
<span class="form_note">URL блога по которому он будет доступен, по смыслу должен совпадать с названием блога и быть на латинице. Пробелы заменяться на "_"</span><br />
|
||||
<input type="text" id="blog_url" name="blog_url" value="{$_aRequest.blog_url}" style="width: 100%;" {if $_aRequest.blog_id}disabled{/if} /><br />
|
||||
<span class="form_note">URL блога по которому он будет доступен, по смыслу должен совпадать с названием блога и быть на латинице. Пробелы заменяться на "_". Внимание! URL нельзя изменить после создания блога!</span><br />
|
||||
<span class="form_note_red"></span>
|
||||
</p>
|
||||
|
||||
|
@ -49,8 +49,13 @@
|
|||
<input type="text" id="blog_limit_rating_topic" name="blog_limit_rating_topic" value="{$_aRequest.blog_limit_rating_topic}" style="width: 100%;" /><br />
|
||||
<span class="form_note">Рейтинг который необходим пользователю, чтобы написать в этот блог</span>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
{if $oBlogEdit and $oBlogEdit->getAvatar()}
|
||||
<img src="{$oBlogEdit->getAvatarPath(48)}" border="0">
|
||||
<img src="{$oBlogEdit->getAvatarPath(24)}" border="0">
|
||||
<input type="checkbox" id="avatar_delete" name="avatar_delete" value="on"> — <label for="avatar_delete"><span class="form">удалить</span></label><br /><br>
|
||||
{/if}
|
||||
<span class="form">Аватар:</span><br /> <input type="file" name="avatar" ><br>
|
||||
|
||||
<p class="l-bot">
|
||||
<input type="submit" name="submit_blog_add" value="сохранить">
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="blog_page">
|
||||
<img class="blog_avatar" src="{$DIR_STATIC_SKIN}/img/stub-user-middle.gif" width="48" height="48" alt="" title="{$oBlog->getTitle()|escape:'html'}" border="0">
|
||||
<img class="blog_avatar" src="{$oBlog->getAvatarPath(48)}" width="48" height="48" alt="" title="{$oBlog->getTitle()|escape:'html'}" border="0">
|
||||
<a href="{$DIR_WEB_ROOT}/blog/{$oBlog->getUrl()}/profile/">{$oBlog->getTitle()|escape:'html'}</a>
|
||||
(<a id="groupuserscnt" href="{$DIR_WEB_ROOT}/blog/{$oBlog->getUrl()}/profile/"><span id="blog_user_count">{$oBlog->getCountUser()}</span></a>)
|
||||
{if $oUserCurrent and $oUserCurrent->getId()!=$oBlog->getOwnerId()}
|
||||
|
|
|
@ -130,7 +130,7 @@ function showCommentForm(reply) {
|
|||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{if $oUserCurrent and !$oComment->getDelete()}
|
||||
{if $oUserCurrent and !$oComment->getDelete() and !$oTopic->getForbidComment()}
|
||||
<div class="comments_reply">
|
||||
<div class="reply_word_holder">(<a href="javascript:showCommentForm({$oComment->getId()});">ответить</a>)</div>
|
||||
<div style="display: none;" id="reply_{$oComment->getId()}"></div>
|
||||
|
@ -141,6 +141,12 @@ function showCommentForm(reply) {
|
|||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{if $oTopic->getForbidComment()}
|
||||
<div class="text">
|
||||
<br />
|
||||
Автор топика запретил оставлять комментарии.
|
||||
</div>
|
||||
{else}
|
||||
{if $oUserCurrent}
|
||||
<div class="WriteCommentHolder">
|
||||
<img src="{$DIR_STATIC_SKIN}/img/comment.gif"> <a name="comment" href="javascript:showCommentForm(0);" class="news_page_comments_title">написать комментарий</a>
|
||||
|
@ -159,8 +165,8 @@ function showCommentForm(reply) {
|
|||
<a href="{$DIR_WEB_ROOT}/login/">Авторизуйтесь</a>, пожалуйста, или
|
||||
<a href="{$DIR_WEB_ROOT}/registration/">зарегистрируйтесь</a>, если не зарегистрированы.<br><br>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="blog_page">
|
||||
<img class="blog_avatar" src="{$DIR_STATIC_SKIN}/img/stub-user-middle.gif" width="48" height="48" alt="" title="{$oBlog->getTitle()|escape:'html'}" border="0">
|
||||
<img class="blog_avatar" src="{$oBlog->getAvatarPath(48)}" width="48" height="48" alt="" title="{$oBlog->getTitle()|escape:'html'}" border="0">
|
||||
<a href="{$DIR_WEB_ROOT}/blog/{$oBlog->getUrl()}/">{$oBlog->getTitle()|escape:'html'}</a>
|
||||
(<a id="groupuserscnt" href="{$DIR_WEB_ROOT}/blog/{$oBlog->getUrl()}/profile/" title="подписчиков"><span id="blog_user_count">{$oBlog->getCountUser()}</span></a>)
|
||||
|
||||
|
|
|
@ -74,6 +74,13 @@ document.addEvent('domready', function() {
|
|||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" id="topic_forbid_comment" name="topic_forbid_comment" value="1" {if $_aRequest.topic_forbid_comment==1}checked{/if}/>
|
||||
<label for="topic_forbid_comment"> — запретить комментировать</label>
|
||||
<br />
|
||||
<span class="form_note">Если отметить эту галку, то нельзя будет оставлять комментарии к топику </span>
|
||||
</p>
|
||||
|
||||
{if $oUserCurrent->isAdministrator()}
|
||||
<p>
|
||||
<input type="checkbox" id="topic_publish_index" name="topic_publish_index" value="1" {if $_aRequest.topic_publish_index==1}checked{/if}/>
|
||||
|
|
|
@ -117,6 +117,13 @@ document.addEvent('domready', function() {
|
|||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" id="topic_forbid_comment" name="topic_forbid_comment" value="1" {if $_aRequest.topic_forbid_comment==1}checked{/if}/>
|
||||
<label for="topic_forbid_comment"> — запретить комментировать</label>
|
||||
<br />
|
||||
<span class="form_note">Если отметить эту галку, то нельзя будет оставлять комментарии к топику </span>
|
||||
</p>
|
||||
|
||||
{if $oUserCurrent->isAdministrator()}
|
||||
<p>
|
||||
<input type="checkbox" id="topic_publish_index" name="topic_publish_index" value="1" {if $_aRequest.topic_publish_index==1}checked{/if}/>
|
||||
|
|
|
@ -135,6 +135,13 @@ document.addEvent('domready', function() {
|
|||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" id="topic_forbid_comment" name="topic_forbid_comment" value="1" {if $_aRequest.topic_forbid_comment==1}checked{/if}/>
|
||||
<label for="topic_forbid_comment"> — запретить комментировать</label>
|
||||
<br />
|
||||
<span class="form_note">Если отметить эту галку, то нельзя будет оставлять комментарии к топику </span>
|
||||
</p>
|
||||
|
||||
{if $oUserCurrent->isAdministrator()}
|
||||
<p>
|
||||
<input type="checkbox" id="topic_publish_index" name="topic_publish_index" value="1" {if $_aRequest.topic_publish_index==1}checked{/if}/>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
<DIV class=footer>
|
||||
<DIV style="FLOAT: left">© Сайт работает на базе движка <a href="http://livestreet.ru" title="Бесплатный блого-социальный движок LiveStreet">LiveStreet</a>
|
||||
<DIV style="FLOAT: left">© Сайт работает на базе движка <a href="http://livestreet.ru" title="Бесплатный движок социальной сети LiveStreet">LiveStreet</a>
|
||||
</DIV>
|
||||
|
||||
<DIV style="FLOAT: right">© 2008 |
|
||||
|
|
BIN
templates/skin/habra/img/avatar_blog_48x48.gif
Normal file
BIN
templates/skin/habra/img/avatar_blog_48x48.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
3
templates/skin/habra/notify.user_friend_new.tpl
Normal file
3
templates/skin/habra/notify.user_friend_new.tpl
Normal file
|
@ -0,0 +1,3 @@
|
|||
Пользователь «<a href="{$DIR_WEB_ROOT}/profile/{$oUserFrom->getLogin()}/">{$oUserFrom->getLogin()}</a>»</b> добавил вас в друзья.
|
||||
<br><br>
|
||||
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>
|
|
@ -50,7 +50,13 @@
|
|||
|
||||
{$oTopic->getTextShort()}
|
||||
{if $oTopic->getTextShort()!=$oTopic->getText()}
|
||||
<br><br>( <a href="{$oTopic->getUrl()}" title="Прочитать топик полностью">Читать дальше</a> )
|
||||
<br><br>( <a href="{$oTopic->getUrl()}" title="Прочитать топик полностью">
|
||||
{if $oTopic->getCutText()}
|
||||
{$oTopic->getCutText()}
|
||||
{else}
|
||||
Читать дальше
|
||||
{/if}
|
||||
</a> )
|
||||
{/if}
|
||||
<div style="clear: left;"></div>
|
||||
<div class="posttags">
|
||||
|
@ -110,7 +116,7 @@
|
|||
</div>
|
||||
<div class="comment_plashka">
|
||||
{if $oTopic->getCountComment()>0}
|
||||
<a href="{$DIR_WEB_ROOT}/blog/{if $oTopic->getBlogUrl()}{$oTopic->getBlogUrl()}/{/if}{$oTopic->getId()}.html#comments" title="читать комментарии"><span class="red">{$oTopic->getCountComment()}</span></a>
|
||||
<a href="{$DIR_WEB_ROOT}/blog/{if $oTopic->getBlogUrl()}{$oTopic->getBlogUrl()}/{/if}{$oTopic->getId()}.html#comments" title="читать комментарии"><span class="red">{$oTopic->getCountComment()}{if $oTopic->getCountCommentNew()} <font color="Green">+{$oTopic->getCountCommentNew()}</font>{/if}</span></a>
|
||||
{else}
|
||||
<a href="{$DIR_WEB_ROOT}/blog/{if $oTopic->getBlogUrl()}{$oTopic->getBlogUrl()}/{/if}{$oTopic->getId()}.html#comments" title="написать комментарий"><span class="red">комментировать</span></a>
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue