mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-05-17 00:08:17 +03:00
теперь администратор может видеть текст удаленного коммента и востановить его; добавлен небольшой SEO функционал
This commit is contained in:
parent
c86f4cd46e
commit
662ea3639b
|
@ -670,6 +670,13 @@ class ActionBlog extends Action {
|
|||
if ($this->oUserCurrent) {
|
||||
$this->Topic_SetCountCommentLast($oTopic->getId(),$this->oUserCurrent->getId(),$oTopic->getCountComment());
|
||||
}
|
||||
|
||||
/**
|
||||
* Выставляем SEO данные
|
||||
*/
|
||||
$sTextSeo=preg_replace("/<.*>/Ui",' ',$oTopic->getText());
|
||||
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo,20));
|
||||
$this->Viewer_SetHtmlKeywords($oTopic->getTags());
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -761,6 +768,12 @@ class ActionBlog extends Action {
|
|||
if ($this->oUserCurrent) {
|
||||
$this->Topic_SetCountCommentLast($oTopic->getId(),$this->oUserCurrent->getId(),$oTopic->getCountComment());
|
||||
}
|
||||
/**
|
||||
* Выставляем SEO данные
|
||||
*/
|
||||
$sTextSeo=preg_replace("/<.*>/Ui",' ',$oTopic->getText());
|
||||
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo,20));
|
||||
$this->Viewer_SetHtmlKeywords($oTopic->getTags());
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -828,7 +841,12 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Получаем число новых топиков в текущем блоге
|
||||
*/
|
||||
$this->iCountTopicsBlogNew=$this->Topic_GetCountTopicsByBlogNew($oBlog);
|
||||
$this->iCountTopicsBlogNew=$this->Topic_GetCountTopicsByBlogNew($oBlog);
|
||||
/**
|
||||
* Выставляем SEO данные
|
||||
*/
|
||||
$sTextSeo=preg_replace("/<.*>/Ui",' ',$oBlog->getDescription());
|
||||
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo,20));
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -897,6 +915,11 @@ class ActionBlog extends Action {
|
|||
* Получаем число новых топиков в текущем блоге
|
||||
*/
|
||||
$this->iCountTopicsBlogNew=$this->Topic_GetCountTopicsByBlogNew($oBlog);
|
||||
/**
|
||||
* Выставляем SEO данные
|
||||
*/
|
||||
$sTextSeo=preg_replace("/<.*>/Ui",' ',$oBlog->getDescription());
|
||||
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo,20));
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -966,6 +989,11 @@ class ActionBlog extends Action {
|
|||
* Получаем число новых топиков в текущем блоге
|
||||
*/
|
||||
$this->iCountTopicsBlogNew=$this->Topic_GetCountTopicsByBlogNew($oBlog);
|
||||
/**
|
||||
* Выставляем SEO данные
|
||||
*/
|
||||
$sTextSeo=preg_replace("/<.*>/Ui",' ',$oBlog->getDescription());
|
||||
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo,20));
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
@ -1018,6 +1046,11 @@ class ActionBlog extends Action {
|
|||
$bNeedJoin=false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Выставляем SEO данные
|
||||
*/
|
||||
$sTextSeo=preg_replace("/<.*>/Ui",' ',$oBlog->getDescription());
|
||||
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo,20));
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
|
|
|
@ -109,14 +109,14 @@ class ActionRegistration extends Action {
|
|||
* А не занят ли логин?
|
||||
*/
|
||||
if ($this->User_GetUserByLogin(getRequest('login'))) {
|
||||
$this->Message_AddError('Этот логин уже занять','Ошибка');
|
||||
$this->Message_AddError('Этот логин уже занят','Ошибка');
|
||||
$bError=true;
|
||||
}
|
||||
/**
|
||||
* А не занято ли мыло?
|
||||
*/
|
||||
if ($this->User_GetUserByMail(getRequest('mail'))) {
|
||||
$this->Message_AddError('Этот емайл уже занять','Ошибка');
|
||||
$this->Message_AddError('Этот емайл уже занят','Ошибка');
|
||||
$bError=true;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -510,4 +510,32 @@ function func_date_smarty($aParams)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает обрезанный текст по заданное число слов
|
||||
*
|
||||
* @param unknown_type $sText
|
||||
* @param unknown_type $iCountWords
|
||||
*/
|
||||
function func_text_words($sText,$iCountWords) {
|
||||
$sText=str_replace("\r\n",'[<rn>]',$sText);
|
||||
$sText=str_replace("\n",'[<n>]',$sText);
|
||||
|
||||
$iCount=0;
|
||||
$aWordsResult=array();
|
||||
$aWords=preg_split("/\s+/",$sText);
|
||||
for($i=0;$i<count($aWords);$i++) {
|
||||
if ($iCount>=$iCountWords) {
|
||||
break;
|
||||
}
|
||||
if ($aWords[$i]!='[<rn>]' and $aWords[$i]!='[<n>]') {
|
||||
$aWordsResult[]=$aWords[$i];
|
||||
$iCount++;
|
||||
}
|
||||
}
|
||||
$sText=join(' ',$aWordsResult);
|
||||
$sText=str_replace('[<rn>]'," ",$sText);
|
||||
$sText=str_replace('[<n>]'," ",$sText);
|
||||
return $sText;
|
||||
}
|
||||
|
||||
?>
|
|
@ -62,7 +62,18 @@ function showCommentForm(reply) {
|
|||
|
||||
{foreach from=$aComments item=oComment}
|
||||
|
||||
<div class="{if $oUserCurrent and $oComment->getUserId()==$oUserCurrent->getId()}comment_item_self{else}{if $dDateTopicRead<=$oComment->getDate()}comment_item_new2{else}comment_item{/if}{/if}" style="margin-left: {$oComment->getLevel()*30}px;">
|
||||
<div class=
|
||||
{if $oComment->getDelete() and $oUserCurrent and $oUserCurrent->isAdministrator()}
|
||||
"comment_item_del_admin"
|
||||
{elseif $oUserCurrent and $oComment->getUserId()==$oUserCurrent->getId()}
|
||||
"comment_item_self"
|
||||
{elseif $dDateTopicRead<=$oComment->getDate()}
|
||||
"comment_item_new2"
|
||||
{else}
|
||||
"comment_item"
|
||||
{/if}
|
||||
style="margin-left: {$oComment->getLevel()*30}px;">
|
||||
|
||||
<a name="comment{$oComment->getId()}" href="{$DIR_WEB_ROOT}/profile/{$oComment->getUserLogin()}/"><img class="comments_avatar" src="{$oComment->getUserProfileAvatarPath(24)}" width="24" height="24" alt="" title="{$oComment->getUserLogin()}" border="0"></a>
|
||||
<div class="service_text_comments_holder">
|
||||
<a href="{$DIR_WEB_ROOT}/profile/{$oComment->getUserLogin()}/" class="comments_nickname">{$oComment->getUserLogin()}</a>
|
||||
|
@ -71,6 +82,9 @@ function showCommentForm(reply) {
|
|||
{if !$oComment->getDelete() and $oUserCurrent and $oUserCurrent->isAdministrator()}
|
||||
<span id="comment_delete_{$oComment->getId()}"> <a href="#" title="удалить комментарий" onclick="ajaxCommentDelete({$oComment->getId()}); return false;"><img src="{$DIR_STATIC_SKIN}/img/comment_del.gif" border="0" alt="удалить"></a></span>
|
||||
{/if}
|
||||
{if $oComment->getDelete() and $oUserCurrent and $oUserCurrent->isAdministrator()}
|
||||
<span id="comment_repair_{$oComment->getId()}"> <a href="#" title="восстановить комментарий" onclick="ajaxCommentRepair({$oComment->getId()}); return false;"><img src="{$DIR_STATIC_SKIN}/img/comment_repair.gif" border="0" alt="восстановить"></a></span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="rating_comment_holder" id="voter{$oComment->getId()}">
|
||||
{if !$oComment->getDelete()}
|
||||
|
@ -116,19 +130,21 @@ function showCommentForm(reply) {
|
|||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="comment_text" id="comment_content_{$oComment->getId()}">
|
||||
{if $oComment->getDelete()}
|
||||
<font color="#c5c5c5">комментарий был удален</font>
|
||||
{else}
|
||||
{if $oComment->isBad()}
|
||||
<div class="comment_text" id="comment_content_{$oComment->getId()}">
|
||||
|
||||
{if !$oComment->getDelete() or ($oUserCurrent and $oUserCurrent->isAdministrator())}
|
||||
{if $oComment->isBad()}
|
||||
<div style="display: none;" id="comment_text_{$oComment->getId()}">
|
||||
{$oComment->getText()}
|
||||
</div>
|
||||
<a href="#" onclick="$('comment_text_{$oComment->getId()}').style.display='block';$(this).style.display='none';return false;">раскрыть комментарий</a>
|
||||
{else}
|
||||
{$oComment->getText()}
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<font color="#c5c5c5">комментарий был удален</font>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
{if $oUserCurrent and !$oComment->getDelete() and !$oTopic->getForbidComment()}
|
||||
<div class="comments_reply">
|
||||
|
|
|
@ -59,6 +59,8 @@ LiveStreet представляет из себя <strong>бесплатный</
|
|||
<li><a href="http://livestreet.ru/profile/radioact/">radioact</a>(На удачу :)) — перечислил <b>190 рублей</b></li>
|
||||
<li>Аноним(live!) — перечислил <b>199 WMR</b></li>
|
||||
<li><a href="http://livestreet.ru/profile/serega/">serega</a>(все круто = )) — перечислил <b>20 WMZ</b></li>
|
||||
<li>dust(От сайта game66.ru), сайт <a href="http://game66.ru">game66.ru</a> — перечислил <b>10 WMZ</b></li>
|
||||
|
||||
</ul>
|
||||
</DIV>
|
||||
|
||||
|
|
|
@ -118,6 +118,14 @@ div.comment_text2 {
|
|||
background:#e7eefe;
|
||||
}
|
||||
|
||||
.comment_item_del_admin {
|
||||
position:relative;
|
||||
padding-bottom:3px;
|
||||
margin-top:3px;
|
||||
font-family:Arial;
|
||||
background:#c5c5c5;
|
||||
}
|
||||
|
||||
/*Опросы*/
|
||||
|
||||
.poll dl {
|
||||
|
|
|
@ -219,6 +219,9 @@ function ajaxCommentDelete(idComment) {
|
|||
}
|
||||
if (document.getElementById('comment_delete_'+idComment)) {
|
||||
document.getElementById('comment_delete_'+idComment).style.display='none';
|
||||
}
|
||||
if (document.getElementById('comment_repair_'+idComment)) {
|
||||
document.getElementById('comment_repair_'+idComment).style.display='inline';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +231,32 @@ function ajaxCommentDelete(idComment) {
|
|||
req.send( { idComment: idComment } );
|
||||
}
|
||||
|
||||
function ajaxCommentRepair(idComment) {
|
||||
var req = new JsHttpRequest();
|
||||
req.onreadystatechange = function() {
|
||||
if (req.readyState == 4) {
|
||||
document.getElementById('debug').innerHTML = req.responseText;
|
||||
closeWindowStatus();
|
||||
if (req.responseJS.bStateError) {
|
||||
msgErrorBox.alert(req.responseJS.sMsgTitle,req.responseJS.sMsg);
|
||||
} else {
|
||||
msgNoticeBox.alert(req.responseJS.sMsgTitle,req.responseJS.sMsg);
|
||||
if (document.getElementById('comment_content_'+idComment)) {
|
||||
document.getElementById('comment_content_'+idComment).innerHTML=req.responseJS.sCommentText;
|
||||
}
|
||||
if (document.getElementById('comment_delete_'+idComment)) {
|
||||
document.getElementById('comment_delete_'+idComment).style.display='inline';
|
||||
}
|
||||
if (document.getElementById('comment_repair_'+idComment)) {
|
||||
document.getElementById('comment_repair_'+idComment).style.display='none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
showWindowStatus('Восстановление комментария...');
|
||||
req.open(null, DIR_WEB_ROOT+'/include/ajax/commentRepair.php', true);
|
||||
req.send( { idComment: idComment } );
|
||||
}
|
||||
|
||||
function ajaxVoteUser(idUser,value) {
|
||||
var req = new JsHttpRequest();
|
||||
|
|
Loading…
Reference in a new issue