mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Merge branch 'master' of https://github.com/livestreet/livestreet
Conflicts: application/frontend/skin/developer/comments/comment_pagination.tpl
This commit is contained in:
commit
b974a3c0e8
|
@ -135,7 +135,7 @@ class ActionAdmin extends Action {
|
|||
}
|
||||
|
||||
/**
|
||||
* Загружает модальное окно создания категории бога
|
||||
* Загружает модальное окно создания категории блога
|
||||
*/
|
||||
protected function EventBlogCategoryModalAdd() {
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
|
@ -477,5 +477,4 @@ class ActionAdmin extends Action {
|
|||
*/
|
||||
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -975,6 +975,12 @@ class ActionAjax extends Action {
|
|||
if (!($oComment=$this->Comment_GetCommentById(getRequestStr('iTargetId',null,'post')))) {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
/**
|
||||
* Проверка типа комментария
|
||||
*/
|
||||
if (!in_array($oComment->getTargetType(),(array)Config::Get('module.comment.vote_target_allow'))) {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
/**
|
||||
* Голосует автор комментария?
|
||||
*/
|
||||
|
@ -1022,13 +1028,16 @@ class ActionAjax extends Action {
|
|||
$oTopicCommentVote->setValue($iVal);
|
||||
|
||||
$oComment->setCountVote($oComment->getCountVote()+1);
|
||||
$this->Hook_Run("vote_{$oTopicCommentVote->getTargetType()}_before",array('oTarget'=>$oComment,'oVote'=>$oTopicCommentVote,'iValue' => $iValue));
|
||||
if ($this->Vote_AddVote($oTopicCommentVote) and $this->Comment_UpdateComment($oComment)) {
|
||||
$this->Hook_Run("vote_{$oTopicCommentVote->getTargetType()}_after",array('oTarget'=>$oComment,'oVote'=>$oTopicCommentVote,'iValue' => $iValue));
|
||||
|
||||
$this->Message_AddNoticeSingle($this->Lang_Get('vote.notices.success'),$this->Lang_Get('attention'));
|
||||
$this->Viewer_AssignAjax('iRating',$oComment->getRating());
|
||||
/**
|
||||
* Добавляем событие в ленту
|
||||
*/
|
||||
$this->Stream_write($oTopicCommentVote->getVoterId(), 'vote_comment', $oComment->getId());
|
||||
$this->Stream_Write($oTopicCommentVote->getVoterId(), 'vote_comment_'.$oComment->getTargetType(), $oComment->getId());
|
||||
} else {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
|
@ -1108,7 +1117,9 @@ class ActionAjax extends Action {
|
|||
} elseif ($iValue==0) {
|
||||
$oTopic->setCountVoteAbstain($oTopic->getCountVoteAbstain()+1);
|
||||
}
|
||||
$this->Hook_Run("vote_{$oTopicVote->getTargetType()}_before",array('oTarget'=>$oTopic,'oVote'=>$oTopicVote,'iValue' => $iValue));
|
||||
if ($this->Vote_AddVote($oTopicVote) and $this->Topic_UpdateTopic($oTopic)) {
|
||||
$this->Hook_Run("vote_{$oTopicVote->getTargetType()}_after",array('oTarget'=>$oTopic,'oVote'=>$oTopicVote,'iValue' => $iValue));
|
||||
if ($iValue) {
|
||||
$this->Message_AddNoticeSingle($this->Lang_Get('vote.notices.success'),$this->Lang_Get('attention'));
|
||||
} else {
|
||||
|
@ -1172,7 +1183,11 @@ class ActionAjax extends Action {
|
|||
$iVal=(float)$this->Rating_VoteBlog($this->oUserCurrent,$oBlog,$iValue);
|
||||
$oBlogVote->setValue($iVal);
|
||||
$oBlog->setCountVote($oBlog->getCountVote()+1);
|
||||
|
||||
$this->Hook_Run("vote_{$oBlogVote->getTargetType()}_before",array('oTarget'=>$oBlog,'oVote'=>$oBlogVote,'iValue' => $iValue));
|
||||
if ($this->Vote_AddVote($oBlogVote) and $this->Blog_UpdateBlog($oBlog)) {
|
||||
$this->Hook_Run("vote_{$oBlogVote->getTargetType()}_after",array('oTarget'=>$oBlog,'oVote'=>$oBlogVote,'iValue' => $iValue));
|
||||
|
||||
$this->Viewer_AssignAjax('iCountVote',$oBlog->getCountVote());
|
||||
$this->Viewer_AssignAjax('iRating',$oBlog->getRating());
|
||||
$this->Message_AddNoticeSingle($this->Lang_Get('vote.notices.success'),$this->Lang_Get('attention'));
|
||||
|
@ -1259,7 +1274,11 @@ class ActionAjax extends Action {
|
|||
$oUserVote->setValue($iVal);
|
||||
//$oUser->setRating($oUser->getRating()+$iValue);
|
||||
$oUser->setCountVote($oUser->getCountVote()+1);
|
||||
|
||||
$this->Hook_Run("vote_{$oUserVote->getTargetType()}_before",array('oTarget'=>$oUser,'oVote'=>$oUserVote,'iValue' => $iValue));
|
||||
if ($this->Vote_AddVote($oUserVote) and $this->User_Update($oUser)) {
|
||||
$this->Hook_Run("vote_{$oUserVote->getTargetType()}_after",array('oTarget'=>$oUser,'oVote'=>$oUserVote,'iValue' => $iValue));
|
||||
|
||||
$this->Message_AddNoticeSingle($this->Lang_Get('vote.notices.success'),$this->Lang_Get('attention'));
|
||||
$this->Viewer_AssignAjax('iRating',$oUser->getRating());
|
||||
$this->Viewer_AssignAjax('iSkill',$oUser->getSkill());
|
||||
|
|
|
@ -1053,7 +1053,7 @@ class ActionBlog extends Action {
|
|||
*/
|
||||
if (!$oTopic) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
$bOk = false;
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Возможность постить коммент в топик в черновиках
|
||||
|
|
|
@ -94,4 +94,3 @@ class ActionComments extends Action {
|
|||
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -545,5 +545,4 @@ class ActionContent extends Action {
|
|||
$this->Viewer_Assign('sMenuItemSelect',$this->sMenuItemSelect);
|
||||
$this->Viewer_Assign('sMenuSubItemSelect',$this->sMenuSubItemSelect);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -88,5 +88,4 @@ class ActionError extends Action {
|
|||
$this->Viewer_AddHtmlTitle($this->Lang_Get('error'));
|
||||
$this->SetTemplateAction('index');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -100,10 +100,11 @@ class ActionIndex extends Action {
|
|||
* Вывод рейтинговых топиков
|
||||
*/
|
||||
protected function EventTop() {
|
||||
$sPeriod=1; // по дефолту 1 день
|
||||
$sPeriod=Config::Get('module.topic.default_period_top');
|
||||
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
|
||||
$sPeriod=getRequestStr('period');
|
||||
}
|
||||
if (!$sPeriod) $sPeriod=1;
|
||||
/**
|
||||
* Меню
|
||||
*/
|
||||
|
@ -151,10 +152,11 @@ class ActionIndex extends Action {
|
|||
* Вывод обсуждаемых топиков
|
||||
*/
|
||||
protected function EventDiscussed() {
|
||||
$sPeriod=1; // по дефолту 1 день
|
||||
$sPeriod=Config::Get('module.topic.default_period_discussed');
|
||||
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
|
||||
$sPeriod=getRequestStr('period');
|
||||
}
|
||||
if (!$sPeriod) $sPeriod=1;
|
||||
/**
|
||||
* Меню
|
||||
*/
|
||||
|
@ -327,5 +329,4 @@ class ActionIndex extends Action {
|
|||
$this->Viewer_Assign('iCountTopicsSubNew',$this->iCountTopicsNew);
|
||||
$this->Viewer_Assign('sNavTopicsSubUrl',$this->sNavTopicsSubUrl);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -240,5 +240,4 @@ class ActionLogin extends Action {
|
|||
return Router::Action('error');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -107,5 +107,4 @@ class ActionMy extends Action {
|
|||
$sPage=$iPage==1 ? '' : "page{$iPage}/";
|
||||
Router::Location($this->oUserProfile->getUserWebPath().'created/comments/'.$sPage);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -160,5 +160,4 @@ class ActionPersonalBlog extends Action {
|
|||
$this->Viewer_Assign('iCountTopicsSubNew',$iCountTopicsPersonalNew);
|
||||
$this->Viewer_Assign('sNavTopicsSubUrl',$this->sNavTopicsSubUrl);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -453,10 +453,6 @@ class ActionProfile extends Action {
|
|||
* Получаем список блогов которые создал юзер
|
||||
*/
|
||||
$aBlogsOwner=$this->Blog_GetBlogsByOwnerId($this->oUserProfile->getId());
|
||||
/**
|
||||
* Получаем список контактов
|
||||
*/
|
||||
$aUserFields = $this->User_getUserFieldsValues($this->oUserProfile->getId());
|
||||
/**
|
||||
* Вызов хуков
|
||||
*/
|
||||
|
@ -469,7 +465,6 @@ class ActionProfile extends Action {
|
|||
$this->Viewer_Assign('aBlogAdministrators',$aBlogAdministrators);
|
||||
$this->Viewer_Assign('aBlogsOwner',$aBlogsOwner);
|
||||
$this->Viewer_Assign('aUsersFriend',$aUsersFriend['collection']);
|
||||
$this->Viewer_Assign('aUserFields',$aUserFields);
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile').' '.$this->oUserProfile->getLogin());
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile_whois'));
|
||||
/**
|
||||
|
|
|
@ -349,5 +349,4 @@ class ActionRegistration extends Action {
|
|||
*/
|
||||
protected function EventConfirm() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -374,5 +374,4 @@ class ActionRss extends Action {
|
|||
}
|
||||
return $sText;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -104,5 +104,4 @@ class ActionTag extends Action {
|
|||
*/
|
||||
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -54,5 +54,4 @@ class BlockBlogNav extends Block {
|
|||
$this->Viewer_Assign("aNavigatorBlogs",$aResult['collection']);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -40,5 +40,4 @@ class BlockBlogs extends Block {
|
|||
$this->Viewer_Assign('sBlogsTop',$sTextResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -34,5 +34,4 @@ class BlockBlogsSearch extends Block {
|
|||
$this->Viewer_Assign("aBlogCategories",$aCategories);
|
||||
$this->Viewer_Assign("iCountBlogsAll",$aBlogsAll['count']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -39,5 +39,4 @@ class BlockStream extends Block {
|
|||
$this->Viewer_Assign('sStreamComments',$sTextResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -57,5 +57,4 @@ class BlockTags extends Block {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -39,5 +39,4 @@ class BlockTagsCity extends Block {
|
|||
*/
|
||||
$this->Viewer_Assign("aCityList",$aCities);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -39,5 +39,4 @@ class BlockTagsCountry extends Block {
|
|||
*/
|
||||
$this->Viewer_Assign("aCountryList",$aCountries);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -60,5 +60,4 @@ class BlockTagsFavouriteTopic extends Block {
|
|||
$this->Viewer_Assign("oFavouriteUser",$oUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -39,5 +39,4 @@ class HookCopyright extends Hook {
|
|||
*/
|
||||
return '© Powered by <a href="http://livestreetcms.org">LiveStreet CMS</a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -51,5 +51,4 @@ class HookMain extends Hook {
|
|||
*/
|
||||
$this->Ls_SenderRun();
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -53,5 +53,4 @@ class HookStatisticsPerformance extends Hook {
|
|||
*/
|
||||
return $this->Viewer_Fetch('actions/ActionAdmin/statistics_performance.tpl');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -571,5 +571,4 @@ class ModuleACL extends Module {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -1166,5 +1166,4 @@ class ModuleBlog extends Module {
|
|||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('blog_update'));
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -381,5 +381,4 @@ class ModuleBlog_EntityBlog extends Entity {
|
|||
public function setVote($data) {
|
||||
$this->_aData['vote']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -78,5 +78,4 @@ class ModuleBlog_EntityBlogCategory extends Entity {
|
|||
public function getUrlWeb() {
|
||||
return Router::GetPath('blogs').$this->getUrlFull().'/';
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -146,5 +146,4 @@ class ModuleBlog_EntityBlogUser extends Entity {
|
|||
public function setUser($data) {
|
||||
$this->_aData['user']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -785,5 +785,4 @@ class ModuleBlog_MapperBlog extends Mapper {
|
|||
}
|
||||
return $aResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -482,7 +482,7 @@ class ModuleComment extends Module {
|
|||
$this->Topic_increaseTopicCountComment($oComment->getTargetId());
|
||||
}
|
||||
//чистим зависимые кеши
|
||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array("comment_new_{$oComment->getTargetType()}","comment_new_user_{$oComment->getUserId()}_{$oComment->getTargetType()}","comment_new_{$oComment->getTargetType()}_{$oComment->getTargetId()}"));
|
||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array("comment_new","comment_new_{$oComment->getTargetType()}","comment_new_user_{$oComment->getUserId()}_{$oComment->getTargetType()}","comment_new_{$oComment->getTargetType()}_{$oComment->getTargetId()}"));
|
||||
$oComment->setId($sId);
|
||||
return $oComment;
|
||||
}
|
||||
|
@ -968,4 +968,3 @@ class ModuleComment extends Module {
|
|||
return $this->GetCommentsByArrayId($aCommentId);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -466,5 +466,4 @@ class ModuleComment_EntityComment extends Entity {
|
|||
public function setCountFavourite($data) {
|
||||
$this->_aData['comment_count_favourite']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -87,5 +87,4 @@ class ModuleComment_EntityCommentOnline extends Entity {
|
|||
public function setTargetParentId($data) {
|
||||
$this->_aData['target_parent_id']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -928,5 +928,4 @@ class ModuleComment_MapperComment extends Mapper {
|
|||
}
|
||||
return $aResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -469,5 +469,4 @@ class ModuleFavourite extends Module {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -98,5 +98,4 @@ class ModuleFavourite_EntityFavourite extends Entity {
|
|||
public function setTargetType($data) {
|
||||
$this->_aData['target_type']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleFavourite_EntityTag extends Entity {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -539,5 +539,4 @@ class ModuleFavourite_MapperFavourite extends Mapper {
|
|||
}
|
||||
return $aResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -419,5 +419,4 @@ class ModuleGeo extends Module {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleGeo_EntityCity extends ModuleGeo_EntityGeo {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleGeo_EntityCountry extends ModuleGeo_EntityGeo {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -114,5 +114,4 @@ class ModuleGeo_EntityGeo extends Entity {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleGeo_EntityRegion extends ModuleGeo_EntityGeo {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleGeo_EntityTarget extends Entity {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -365,5 +365,4 @@ class ModuleGeo_MapperGeo extends Mapper {
|
|||
}
|
||||
return $aResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -566,5 +566,4 @@ class ModuleNotify extends Module {
|
|||
return $this->sDir.'/'.$this->Lang_GetLangDefault().'/'.$sName;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -136,5 +136,4 @@ class ModuleNotify_EntityTask extends Entity {
|
|||
public function setNotifySubject($data) {
|
||||
$this->_aData['notify_subject']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -130,5 +130,4 @@ class ModuleNotify_MapperNotify extends Mapper {
|
|||
}
|
||||
return $aTasks;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -200,5 +200,4 @@ class ModuleRating extends Module {
|
|||
$oUserTarget->setRating($iRatingNew);
|
||||
return $iValue*$iDelta;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -47,7 +47,7 @@ class ModuleStream extends Module {
|
|||
'add_comment' => array('related' => 'comment','unique'=>true),
|
||||
'add_blog' => array('related' => 'blog','unique'=>true),
|
||||
'vote_topic' => array('related' => 'topic'),
|
||||
'vote_comment' => array('related' => 'comment'),
|
||||
'vote_comment_topic' => array('related' => 'comment'),
|
||||
'vote_blog' => array('related' => 'blog'),
|
||||
'vote_user' => array('related' => 'user'),
|
||||
'add_friend' => array('related' => 'user','unique_user'=>true),
|
||||
|
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleStream_EntityEvent extends Entity {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -297,5 +297,4 @@ class ModuleSubscribe extends Module {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleSubscribe_EntitySubscribe extends Entity {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -145,5 +145,4 @@ class ModuleSubscribe_MapperSubscribe extends Mapper {
|
|||
}
|
||||
return $aResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -801,5 +801,4 @@ class ModuleTalk extends Module {
|
|||
*/
|
||||
$this->Media_RemoveTarget('talk',$iTalkId,true);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -278,5 +278,4 @@ class ModuleTalk_EntityTalk extends Entity {
|
|||
public function setTalkUsers($data) {
|
||||
$this->_aData['talk_users']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -137,5 +137,4 @@ class ModuleTalk_EntityTalkUser extends Entity {
|
|||
public function setUser($data) {
|
||||
$this->_aData['user']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -552,5 +552,4 @@ class ModuleTalk_MapperTalk extends Mapper {
|
|||
}
|
||||
return $bOk;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -368,6 +368,19 @@ class ModuleTopic extends Module {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Обновляет контент топика в БД (таблица topic_content)
|
||||
*
|
||||
* @param ModuleTopic_EntityTopic $oTopic
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function UpdateTopicContent($oTopic) {
|
||||
$bRes=$this->oMapperTopic->UpdateTopicContent($oTopic);
|
||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('topic_update',"topic_update_user_{$oTopic->getUserId()}"));
|
||||
$this->Cache_Delete("topic_{$oTopic->getId()}");
|
||||
return $bRes;
|
||||
}
|
||||
/**
|
||||
* Удаление контента топика по его номеру
|
||||
*
|
||||
|
|
|
@ -34,8 +34,8 @@ class ModuleTopic_EntityTopic extends Entity {
|
|||
*/
|
||||
public function Init() {
|
||||
parent::Init();
|
||||
$this->aValidateRules[]=array('topic_title','string','max'=>200,'min'=>2,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_create_title'));
|
||||
$this->aValidateRules[]=array('topic_text_source','string','max'=>Config::Get('module.topic.max_length'),'min'=>2,'allowEmpty'=>false,'condition'=>'isNeedValidateText','label'=>$this->Lang_Get('topic_create_text'));
|
||||
$this->aValidateRules[]=array('topic_title','string','max'=>Config::Get('module.topic.title_max_length'),'min'=>Config::Get('module.topic.title_min_length'),'allowEmpty'=>Config::Get('module.topic.title_allow_empty'),'label'=>$this->Lang_Get('topic_create_title'));
|
||||
$this->aValidateRules[]=array('topic_text_source','string','max'=>Config::Get('module.topic.max_length'),'min'=>Config::Get('module.topic.min_length'),'allowEmpty'=>Config::Get('module.topic.allow_empty'),'condition'=>'isNeedValidateText','label'=>$this->Lang_Get('topic_create_text'));
|
||||
$this->aValidateRules[]=array('topic_tags','tags','count'=>15,'condition'=>'isNeedValidateTags','label'=>$this->Lang_Get('topic_create_tags'),'allowEmpty'=>Config::Get('module.topic.allow_empty_tags'));
|
||||
|
||||
$this->aValidateRules[]=array('blog_id','blog_id');
|
||||
|
|
|
@ -104,5 +104,4 @@ class ModuleTopic_EntityTopicRead extends Entity {
|
|||
public function setCommentIdLast($data) {
|
||||
$this->_aData['comment_id_last']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -129,5 +129,4 @@ class ModuleTopic_EntityTopicTag extends Entity {
|
|||
public function setSize($data) {
|
||||
$this->_aData['size']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -1556,5 +1556,4 @@ class ModuleUser extends Module {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -23,5 +23,4 @@
|
|||
*/
|
||||
class ModuleUser_EntityChangemail extends Entity {
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -164,5 +164,4 @@ class ModuleUser_EntityFriend extends Entity {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -136,5 +136,4 @@ class ModuleUser_EntityInvite extends Entity {
|
|||
public function setUsed($data) {
|
||||
$this->_aData['invite_used']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -51,5 +51,4 @@ class ModuleUser_EntityNote extends Entity {
|
|||
}
|
||||
return $this->Lang_Get('user_note.notices.target_error');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -119,5 +119,4 @@ class ModuleUser_EntityReminder extends Entity {
|
|||
public function setIsUsed($data) {
|
||||
$this->_aData['reminde_is_used']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -120,5 +120,4 @@ class ModuleUser_EntitySession extends Entity {
|
|||
public function setDateLast($data) {
|
||||
$this->_aData['session_date_last']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -738,5 +738,4 @@ class ModuleUser_EntityUser extends Entity {
|
|||
public function setUserFriend($data) {
|
||||
$this->_aData['user_friend']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -1280,5 +1280,4 @@ class ModuleUser_MapperUser extends Mapper {
|
|||
}
|
||||
return $aReturn;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -180,5 +180,4 @@ class ModuleVote extends Module {
|
|||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array("vote_update_{$sTargetType}"));
|
||||
return $this->oMapper->DeleteVoteByTarget($aTargetId,$sTargetType);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -136,5 +136,4 @@ class ModuleVote_EntityVote extends Entity {
|
|||
public function setIp($data) {
|
||||
$this->_aData['vote_ip']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -94,5 +94,4 @@ class ModuleVote_MapperVote extends Mapper {
|
|||
$res=$this->oDb->query($sql,$aTargetId,$sTargetType);
|
||||
return $res===false or is_null($res) ? false : true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -247,5 +247,4 @@ class ModuleWall extends Module {
|
|||
$this->UpdatePidWall($oWallParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -118,5 +118,4 @@ class ModuleWall_EntityWall extends Entity {
|
|||
public function getUrlWall() {
|
||||
return $this->getWallUser()->getUserWebPath().'wall/';
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -194,5 +194,4 @@ class ModuleWall_MapperWall extends Mapper {
|
|||
}
|
||||
return $aResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -30,5 +30,4 @@ $config['db']['params']['type'] = 'mysqli';
|
|||
$config['db']['params']['dbname'] = 'social';
|
||||
$config['db']['table']['prefix'] = 'prefix_';
|
||||
|
||||
return $config;
|
||||
?>
|
||||
return $config;
|
|
@ -122,9 +122,14 @@ $config['module']['blog']['category_allow_empty'] = true; // Разрешить
|
|||
$config['module']['topic']['new_time'] = 60*60*24*1; // Время в секундах в течении которого топик считается новым
|
||||
$config['module']['topic']['per_page'] = 10; // Число топиков на одну страницу
|
||||
$config['module']['topic']['max_length'] = 15000; // Максимальное количество символов в одном топике
|
||||
$config['module']['topic']['link_max_length'] = 500; // Максимальное количество символов в одном топике-ссылке
|
||||
$config['module']['topic']['question_max_length'] = 500;// Максимальное количество символов в одном топике-опросе
|
||||
$config['module']['topic']['min_length'] = 2; // Минимальное количество символов в одном топике
|
||||
$config['module']['topic']['allow_empty'] = false; // Разрешать или нет не заполнять текст топика
|
||||
$config['module']['topic']['title_max_length'] = 200; // Максимальное количество символов в заголовке топика
|
||||
$config['module']['topic']['title_min_length'] = 2; // Минимальное количество символов в заголовке топика
|
||||
$config['module']['topic']['title_allow_empty'] = false; // Разрешать или нет не заполнять заголовок топика
|
||||
$config['module']['topic']['allow_empty_tags'] = false; // Разрешать или нет не заполнять теги
|
||||
$config['module']['topic']['default_period_top'] = 1; // Дефолтный период (количество дней) для отображения ТОП топиков. Значения: 1,7,30,'all'
|
||||
$config['module']['topic']['default_period_discussed'] = 1; // Дефолтный период (количество дней) для отображения обсуждаемых топиков. Значения: 1,7,30,'all'
|
||||
// Модуль User
|
||||
$config['module']['user']['per_page'] = 15; // Число юзеров на страницу на странице статистики и в профиле пользователя
|
||||
$config['module']['user']['friend_on_profile'] = 15; // Ограничение на вывод числа друзей пользователя на странице его профиля
|
||||
|
@ -160,6 +165,7 @@ $config['module']['comment']['nested_per_page'] = 0; // Число коммен
|
|||
$config['module']['comment']['nested_page_reverse'] = true; // Определяет порядок вывода страниц. true - последние комментарии на первой странице, false - последние комментарии на последней странице
|
||||
$config['module']['comment']['favourite_target_allow'] = array('topic'); // Список типов комментов, которые разрешено добавлять в избранное
|
||||
$config['module']['comment']['edit_target_allow'] = array('topic','talk'); // Список типов комментов, которые разрешено редактировать
|
||||
$config['module']['comment']['vote_target_allow'] = array('topic'); // Список типов комментов, за которые разрешено голосовать
|
||||
// Модуль Talk
|
||||
$config['module']['talk']['per_page'] = 30; // Число приватных сообщений на одну страницу
|
||||
$config['module']['talk']['encrypt'] = 'livestreet'; // Ключ XXTEA шифрования идентификаторов в ссылках
|
||||
|
|
|
@ -29,5 +29,4 @@ $config['db']['params']['pass'] = '';
|
|||
$config['db']['params']['type'] = 'mysqli';
|
||||
$config['db']['params']['dbname'] = 'social';
|
||||
|
||||
return $config;
|
||||
?>
|
||||
return $config;
|
|
@ -39,5 +39,4 @@ $config['module']['user']['captcha_use_registration'] = false; // провер
|
|||
$config['lang']['current'] = 'english';
|
||||
$config['lang']['default'] = 'english';
|
||||
|
||||
return $config;
|
||||
?>
|
||||
return $config;
|
|
@ -239,6 +239,7 @@ ls.media = (function ($) {
|
|||
var sTitle = this.elements.link.title.val(),
|
||||
sTextInsert;
|
||||
|
||||
sTitle=ls.utils.escapeHtml(sTitle);
|
||||
if ($('.js-media-link-settings-image').is(':visible')) {
|
||||
var sAlign = this.elements.link.align.val();
|
||||
sAlign = sAlign == 'center' ? 'class="image-center"' : 'align="' + sAlign + '"';
|
||||
|
|
|
@ -1232,5 +1232,4 @@ return array(
|
|||
'13' => '[UTC + 13] Tonga Time, Phoenix Islands Time, Kamchatka Time',
|
||||
'14' => '[UTC + 14] Line Island Time'
|
||||
)
|
||||
);
|
||||
?>
|
||||
);
|
|
@ -1091,7 +1091,7 @@ return array(
|
|||
'stream_event_type_add_comment' => 'Добавление комментария',
|
||||
'stream_event_type_add_blog' => 'Добавление блога',
|
||||
'stream_event_type_vote_topic' => 'Голосование за топик',
|
||||
'stream_event_type_vote_comment' => 'Голосование за комментарий',
|
||||
'stream_event_type_vote_comment_topic' => 'Голосование за комментарий к топику',
|
||||
'stream_event_type_vote_blog' => 'Голосование за блог',
|
||||
'stream_event_type_vote_user' => 'Голосование за пользователя',
|
||||
'stream_event_type_add_friend' => 'Добавление в друзья',
|
||||
|
@ -1164,14 +1164,6 @@ return array(
|
|||
* Поиск по тегам
|
||||
*/
|
||||
'tag_title' => 'Поиск по тегам',
|
||||
/**
|
||||
* Постраничность
|
||||
*/
|
||||
'paging_next' => 'следующая',
|
||||
'paging_previos' => 'предыдущая',
|
||||
'paging_last' => 'последняя',
|
||||
'paging_first' => 'первая',
|
||||
'paging' => 'Страницы',
|
||||
/**
|
||||
* Загрузка изображений
|
||||
*/
|
||||
|
@ -1245,36 +1237,6 @@ return array(
|
|||
'plugins_activation_requires_error' => 'Для работы плагина необходим активированный плагин <b>%%plugin%%</b>',
|
||||
'plugins_submit_delete' => 'Удалить плагины',
|
||||
'plugins_delete_confirm' => 'Вы уверены, что желаете удалить указанные плагины?',
|
||||
/**
|
||||
* Валидация данных
|
||||
*/
|
||||
'validate_empty_error' => 'Необходимо заполнить поле %%field%%',
|
||||
'validate_string_too_long' => 'Поле %%field%% слишком длинное (максимально допустимо %%max%% символов)',
|
||||
'validate_string_too_short' => 'Поле %%field%% слишком короткое (минимально допустимо %%min%% символов)',
|
||||
'validate_string_no_lenght' => 'Поле %%field%% неверной длины (необходимо %%length%% символов)',
|
||||
'validate_email_not_valid' => 'Поле %%field%% не соответствует формату email адреса',
|
||||
'validate_number_must_integer' => 'Поле %%field%% должно быть целым числом',
|
||||
'validate_number_must_number' => 'Поле %%field%% должно быть числом',
|
||||
'validate_number_too_small' => 'Поле %%field%% слишком маленькое (минимально допустимо число %%min%%)',
|
||||
'validate_number_too_big' => 'Поле %%field%% слишком большое (максимально допустимо число %%max%%)',
|
||||
'validate_type_error' => 'Поле %%field%% должно иметь тип %%type%%',
|
||||
'validate_date_format_invalid' => 'Поле %%field%% имеет неверный формат даты',
|
||||
'validate_boolean_invalid' => 'Поле %%field%% должно быть %%true%% или %%false%%',
|
||||
'validate_required_must_be' => 'Поле %%field%% должно иметь значение %%value%%',
|
||||
'validate_required_cannot_blank' => 'Поле %%field%% не может быть пустым',
|
||||
'validate_url_not_valid' => 'Поле %%field%% не соответствует формату URL адреса',
|
||||
'validate_captcha_not_valid' => 'Поле %%field%% содержит неверный код',
|
||||
'validate_compare_must_repeated' => 'Поле %%field%% должно повторять %%compare_field%%',
|
||||
'validate_compare_must_not_equal' => 'Поле %%field%% не должно повторять %%compare_value%%',
|
||||
'validate_compare_must_greater' => 'Поле %%field%% должно быть больше чем %%compare_value%%',
|
||||
'validate_compare_must_greater_equal' => 'Поле %%field%% должно быть больше или равно %%compare_value%%',
|
||||
'validate_compare_must_less' => 'Поле %%field%% должно быть меньше чем %%compare_value%%',
|
||||
'validate_compare_must_less_equal' => 'Поле %%field%% должно быть меньше или равно %%compare_value%%',
|
||||
'validate_compare_invalid_operator' => 'У поля %%field%% неверный оператор сравнения %%operator%%',
|
||||
'validate_regexp_not_valid' => 'Поле %%field%% неверное',
|
||||
'validate_regexp_invalid_pattern' => 'У поля %%field%% неверное регулярное выражение',
|
||||
'validate_tags_count_more' => 'Поле %%field%% содержит слишком много тегов (максимально допустимо %%count%%)',
|
||||
'validate_tags_empty' => 'Поле %%field%% не содержит тегов, либо содержит неверные теги (размер тега допустим от %%min%% до %%max%% символов)',
|
||||
/**
|
||||
* Подписка
|
||||
*/
|
||||
|
@ -1421,4 +1383,3 @@ return array(
|
|||
'14' => '[UTC + 14] Остров Лайн'
|
||||
)
|
||||
);
|
||||
?>
|
|
@ -100,7 +100,7 @@
|
|||
{/if}
|
||||
|
||||
<a href="{$oTarget->getUrl()}">{$oTarget->getTitle()|escape:'html'}</a>
|
||||
{elseif $oStreamEvent->getEventType() == 'vote_comment'}
|
||||
{elseif $oStreamEvent->getEventType() == 'vote_comment_topic'}
|
||||
{* Проголосовали за комментарий *}
|
||||
|
||||
{if $bUserIsMale}
|
||||
|
|
|
@ -2,47 +2,49 @@
|
|||
* Поиск по личным сообщениям
|
||||
*}
|
||||
<div class="accordion">
|
||||
<h3 class="accordion-header" onclick="jQuery('#block_talk_search_content').toggle(); return false;"><span class="link-dotted">{$aLang.messages.search.title}</span></h3>
|
||||
<h3 class="accordion-header" onclick="jQuery('#block_talk_search_content').toggle(); return false;">
|
||||
<span class="link-dotted">{$aLang.messages.search.title}</span>
|
||||
</h3>
|
||||
|
||||
<form action="{router page='talk'}" method="GET" name="talk_filter_form" id="block_talk_search_content" class="accordion-content" {if $_aRequest.submit_talk_filter}style="display:block;"{/if}>
|
||||
{* Отправитель *}
|
||||
{include file='components/field/field.text.tpl'
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'sender'
|
||||
sLabel = $aLang.messages.search.fields.sender.label
|
||||
sNote = $aLang.messages.search.fields.sender.note
|
||||
sClasses = 'width-full autocomplete-users-sep'}
|
||||
|
||||
{* Искать в заголовке *}
|
||||
{include file='components/field/field.text.tpl'
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'keyword'
|
||||
sLabel = $aLang.messages.search.fields.keyword.label}
|
||||
|
||||
{* Искать в тексте *}
|
||||
{include file='components/field/field.text.tpl'
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'keyword_text'
|
||||
sLabel = $aLang.messages.search.fields.keyword_text.label}
|
||||
|
||||
{* Ограничения по дате *}
|
||||
{include file='components/field/field.text.tpl'
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'start'
|
||||
sPlaceholder = $aLang.messages.search.fields.start.placeholder
|
||||
sLabel = $aLang.messages.search.fields.start.label
|
||||
sClasses = 'width-200 date-picker'}
|
||||
|
||||
{include file='components/field/field.text.tpl'
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'end'
|
||||
sPlaceholder = $aLang.messages.search.fields.end.placeholder
|
||||
sClasses = 'width-200 date-picker'}
|
||||
|
||||
{* Искать только в избранном *}
|
||||
{include file='components/field/field.checkbox.tpl' sName='favourite' sLabel=$aLang.messages.search.fields.favourite.label}
|
||||
{include 'components/field/field.checkbox.tpl' sName='favourite' sLabel=$aLang.messages.search.fields.favourite.label}
|
||||
|
||||
{* Кнопки *}
|
||||
{include file='components/button/button.tpl'
|
||||
{include 'components/button/button.tpl'
|
||||
sName = 'submit_talk_filter'
|
||||
sMods = 'primary'
|
||||
sText = $aLang.search.find}
|
||||
|
||||
{include file='components/button/button.tpl' sType='reset' sText=$aLang.common.form_reset}
|
||||
{include 'components/button/button.tpl' sType='reset' sText=$aLang.common.form_reset}
|
||||
</form>
|
||||
</div>
|
|
@ -21,12 +21,15 @@
|
|||
{function editor_textarea}
|
||||
{include 'components/field/field.textarea.tpl'
|
||||
sName = $smarty.local.sName
|
||||
sValue = $smarty.local.sValue
|
||||
sLabel = $smarty.local.sLabel
|
||||
sMods = $smarty.local.sMods
|
||||
sClasses = $smarty.local.sClasses
|
||||
sId = $_uid
|
||||
sAttributes = $smarty.local.sAttributes
|
||||
aRules = $smarty.local.aRules
|
||||
sEntityField = $smarty.local.sEntityField
|
||||
sEntity = $smarty.local.sEntity
|
||||
sInputClasses = "$_sBindClass {$smarty.local.sInputClasses}"
|
||||
sInputAttributes = "{$smarty.local.sAttributes} data-editor-type=\"{$_sType}\" data-editor-set=\"{$_sSet}\""
|
||||
sNote = $smarty.local.sNote
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
{extends './field.text.tpl'}
|
||||
|
||||
{block 'field_input' prepend}
|
||||
<span data-type="captcha" data-captcha-name="{$smarty.local.sName}" class="form-auth-captcha"></span>
|
||||
<span data-type="captcha" data-captcha-name="{$smarty.local.sCaptchaName}" class="form-auth-captcha"></span>
|
||||
|
||||
{$_aRules = [
|
||||
'required' => true,
|
||||
'remote' => {router page='ajax/validate/captcha'},
|
||||
'remote-method' => 'POST',
|
||||
'remote-param-name' => $smarty.local.sName
|
||||
'remote-param-name' => $smarty.local.sCaptchaName
|
||||
]}
|
||||
|
||||
{$_sInputClasses = "$_sInputClasses width-100"}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{$_sName = ( $smarty.local.sName ) ? $smarty.local.sName : rand(0, 9999999)}
|
||||
|
||||
{* Получаем пункты установленные плагинами *}
|
||||
{hook run="{$_sComponentName}_{$_sName}" assign='aItemsHook' aItems=$smarty.local.aItems}
|
||||
{hook run="{$_sComponentName}_{$_sName}" assign='aItemsHook' aItems=$smarty.local.aItems array=true}
|
||||
|
||||
{$_aItems = ( $aItemsHook ) ? $aItemsHook : $smarty.local.aItems}
|
||||
|
||||
|
|
|
@ -44,16 +44,16 @@
|
|||
<ul class="{$_sComponentName}-list">
|
||||
{* Следущая страница *}
|
||||
{if $_aPaging.iPrevPage}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}{if $_aPaging.iPrevPage > 1}/page{$_aPaging.iPrevPage}{/if}/{$_aPaging.sGetParams}" sText="← {$aLang.paging_previos}" sLinkClasses="js-{$_sComponentName}-prev"}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}{if $_aPaging.iPrevPage > 1}/page{$_aPaging.iPrevPage}{/if}/{$_aPaging.sGetParams}" sText="← {$aLang.pagination.previos}" sLinkClasses="js-{$_sComponentName}-prev"}
|
||||
{else}
|
||||
{item sText="← {$aLang.paging_previos}"}
|
||||
{item sText="← {$aLang.pagination.previos}"}
|
||||
{/if}
|
||||
|
||||
{* Предыдущая страница *}
|
||||
{if $_aPaging.iNextPage}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}/page{$_aPaging.iNextPage}/{$_aPaging.sGetParams}" sText="{$aLang.paging_next} →" sLinkClasses="js-{$_sComponentName}-next"}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}/page{$_aPaging.iNextPage}/{$_aPaging.sGetParams}" sText="{$aLang.pagination.next} →" sLinkClasses="js-{$_sComponentName}-next"}
|
||||
{else}
|
||||
{item sText="{$aLang.paging_next} →"}
|
||||
{item sText="{$aLang.pagination.next} →"}
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
<ul class="{$_sComponentName}-list">
|
||||
{* Первая страница *}
|
||||
{if $_aPaging.iCurrentPage > 1}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}/{$_aPaging.sGetParams}" sText=$aLang.paging_first}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}/{$_aPaging.sGetParams}" sText=$aLang.pagination.first}
|
||||
{/if}
|
||||
|
||||
{* Страницы слева от текущей *}
|
||||
|
@ -79,7 +79,7 @@
|
|||
|
||||
{* Последняя страница *}
|
||||
{if $_aPaging.iCurrentPage < $_aPaging.iCountPage}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}/page{$_aPaging.iCountPage}/{$_aPaging.sGetParams}" sText=$aLang.paging_last}
|
||||
{item sUrl="{$_aPaging.sBaseUrl}/page{$_aPaging.iCountPage}/{$_aPaging.sGetParams}" sText=$aLang.pagination.last}
|
||||
{/if}
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -74,7 +74,8 @@
|
|||
sName = 'topic[topic_text_source]'
|
||||
sValue = (($oTopicEdit) ? $oTopicEdit->getTextSource() : '')|escape
|
||||
sLabel = $aLang.topic_create_text
|
||||
aRules = [ 'required' => true, 'rangelength' => "[2,{Config::Get('module.topic.max_length')}]" ]
|
||||
sEntityField = 'topic_text_source'
|
||||
sEntity = 'ModuleTopic_EntityTopic'
|
||||
sMediaTargetType = 'topic'
|
||||
sMediaTargetId = ($oTopicEdit) ? $oTopicEdit->getId() : ''}
|
||||
{/if}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{include file="components/field/field.checkbox.tpl"
|
||||
sName = "property[{$oProperty->getId()}]"
|
||||
sValue = 1
|
||||
bChecked = $oValue->getValueInt()
|
||||
sNote = $oProperty->getDescription()
|
||||
sLabel = $oProperty->getTitle()}
|
|
@ -44,6 +44,7 @@
|
|||
{* Описание *}
|
||||
{include file='components/field/field.text.tpl'
|
||||
sName = 'title'
|
||||
sInputClasses = 'js-input-title'
|
||||
sLabel = $aLang.uploadimg_title}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,41 +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
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Запрещаем напрямую через браузер обращение к этому файлу.
|
||||
*/
|
||||
if (!class_exists('Plugin')) {
|
||||
die('Hacking attemp!');
|
||||
}
|
||||
|
||||
class PluginProfiler extends Plugin {
|
||||
/**
|
||||
* Активация плагина Профайлер.
|
||||
* Создание таблицы в базе данных при ее отсутствии.
|
||||
*/
|
||||
public function Activate() {
|
||||
$this->ExportSQL(dirname(__FILE__).'/sql.sql');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Инициализация плагина Profiler
|
||||
*/
|
||||
public function Init() {
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,267 +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 PluginProfiler_ActionProfiler extends ActionPlugin {
|
||||
/**
|
||||
* Текущий юзер
|
||||
*
|
||||
* @var ModuleUser_EntityUser
|
||||
*/
|
||||
protected $oUserCurrent=null;
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function Init() {
|
||||
/**
|
||||
* Проверяем авторизован ли юзер
|
||||
*/
|
||||
if (!$this->User_IsAuthorization()) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('not_access'));
|
||||
return Router::Action('error');
|
||||
}
|
||||
/**
|
||||
* Получаем текущего юзера
|
||||
*/
|
||||
$this->oUserCurrent=$this->User_GetUserCurrent();
|
||||
/**
|
||||
* Проверяем является ли юзер администратором
|
||||
*/
|
||||
if (!$this->oUserCurrent->isAdministrator()) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('not_access'));
|
||||
return Router::Action('error');
|
||||
}
|
||||
|
||||
$this->SetDefaultEvent('report');
|
||||
}
|
||||
|
||||
protected function RegisterEvent() {
|
||||
$this->AddEvent('report','EventReport');
|
||||
$this->AddEvent('ajaxloadreport','EventAjaxLoadReport');
|
||||
$this->AddEvent('ajaxloadentriesbyfilter','EventAjaxLoadEntriesByFilter');
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
|
||||
**********************************************************************************
|
||||
*/
|
||||
|
||||
protected function EventReport() {
|
||||
/**
|
||||
* Обработка удаления отчетов профайлера
|
||||
*/
|
||||
if (isPost('submit_report_delete')) {
|
||||
$this->Security_ValidateSendForm();
|
||||
|
||||
$aReportsId=getRequest('report_del');
|
||||
if (is_array($aReportsId)) {
|
||||
if($this->PluginProfiler_Profiler_DeleteEntryByRequestId(array_keys($aReportsId))) {
|
||||
$this->Message_AddNotice($this->Lang_Get('plugin.profiler.report_delete_success'), $this->Lang_Get('attention'));
|
||||
} else {
|
||||
$this->Message_AddError($this->Lang_Get('plugin.profiler.report_delete_error'), $this->Lang_Get('error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Если вызвана обработка upload`а логов в базу данных
|
||||
*/
|
||||
if(getRequest('submit_profiler_import') and getRequest('profiler_date_import')) {
|
||||
$iCount = @$this->PluginProfiler_Profiler_UploadLog(date('Y-m-d H:i:s',strtotime(getRequest('profiler_date_import'))));
|
||||
if(!is_null($iCount)) {
|
||||
$this->Message_AddNotice($this->Lang_Get('plugin.profiler.import_report_success',array('count'=>$iCount)), $this->Lang_Get('attention'));
|
||||
} else {
|
||||
$this->Message_AddError($this->Lang_Get('plugin.profiler.import_report_error'), $this->Lang_Get('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Составляем фильтр для просмотра отчетов
|
||||
*/
|
||||
$aFilter=$this->BuildFilter();
|
||||
|
||||
/**
|
||||
* Передан ли номер страницы
|
||||
*/
|
||||
$iPage=preg_match("/^page(\d+)$/i",$this->getParam(0),$aMatch) ? $aMatch[1] : 1;
|
||||
/**
|
||||
* Получаем список отчетов
|
||||
*/
|
||||
$aResult=$this->PluginProfiler_Profiler_GetReportsByFilter($aFilter,$iPage,Config::Get('plugin.profiler.per_page'));
|
||||
$aReports=$aResult['collection'];
|
||||
/**
|
||||
* Если был использован фильтр, выводим количество найденых по фильтру
|
||||
*/
|
||||
if(count($aFilter)) {
|
||||
$this->Message_AddNotice(
|
||||
($aResult['count'])
|
||||
? $this->Lang_Get('plugin.profiler.filter_result_count',array('count'=>$aResult['count']))
|
||||
: $this->Lang_Get('plugin.profiler.filter_result_empty')
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Формируем постраничность
|
||||
*/
|
||||
$aPaging=$this->Viewer_MakePaging(
|
||||
$aResult['count'],$iPage,Config::Get('plugin.profiler.per_page'),Config::Get('pagination.pages.count'),
|
||||
Router::GetPath('profiler').$this->sCurrentEvent,
|
||||
array_intersect_key(
|
||||
$_REQUEST,
|
||||
array_fill_keys(array('start','end','request_id','time','per_page'), '')
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Загружаем переменные в шаблон
|
||||
*/
|
||||
$this->Viewer_Assign('aPaging',$aPaging);
|
||||
$this->Viewer_Assign('aReports',$aReports);
|
||||
$this->Viewer_Assign('aDatabaseStat',($aData=$this->PluginProfiler_Profiler_GetDatabaseStat())?$aData:array('max_date'=>'','count'=>''));
|
||||
$this->Viewer_AddBlock('right','actions/ActionProfiler/sidebar.tpl',array('plugin'=>'profiler'));
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('plugin.profiler.report_page_title'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Формирует из REQUEST массива фильтр для отбора отчетов
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function BuildFilter() {
|
||||
$aFilter = array();
|
||||
|
||||
if($start=getRequest('start')) {
|
||||
if(func_check($start,'text',6,10) && substr_count($start,'.')==2) {
|
||||
list($d,$m,$y)=explode('.',$start);
|
||||
if(@checkdate($m,$d,$y)) {
|
||||
$aFilter['date_min']="{$y}-{$m}-{$d}";
|
||||
} else {
|
||||
$this->Message_AddError(
|
||||
$this->Lang_Get('plugin.profiler.filter_error_date_format'),
|
||||
$this->Lang_Get('plugin.profiler.filter_error')
|
||||
);
|
||||
unset($_REQUEST['start']);
|
||||
}
|
||||
} else {
|
||||
$this->Message_AddError(
|
||||
$this->Lang_Get('plugin.profiler.filter_error_date_format'),
|
||||
$this->Lang_Get('plugin.profiler.filter_error')
|
||||
);
|
||||
unset($_REQUEST['start']);
|
||||
}
|
||||
}
|
||||
|
||||
if($end=getRequest('end')) {
|
||||
if(func_check($end,'text',6,10) && substr_count($end,'.')==2) {
|
||||
list($d,$m,$y)=explode('.',$end);
|
||||
if(@checkdate($m,$d,$y)) {
|
||||
$aFilter['date_max']="{$y}-{$m}-{$d} 23:59:59";
|
||||
} else {
|
||||
$this->Message_AddError(
|
||||
$this->Lang_Get('plugin.profiler.filter_error_date_format'),
|
||||
$this->Lang_Get('plugin.profiler.filter_error')
|
||||
);
|
||||
unset($_REQUEST['end']);
|
||||
}
|
||||
} else {
|
||||
$this->Message_AddError(
|
||||
$this->Lang_Get('plugin.profiler.filter_error_date_format'),
|
||||
$this->Lang_Get('plugin.profiler.filter_error')
|
||||
);
|
||||
unset($_REQUEST['end']);
|
||||
}
|
||||
}
|
||||
|
||||
if($iTimeFull=getRequest('time') and $iTimeFull>0) {
|
||||
$aFilter['time']=$iTimeFull;
|
||||
}
|
||||
|
||||
if($iPerPage=getRequest('per_page',0) and $iPerPage>0) {
|
||||
Config::Set('plugins.profiler.per_page',$iPerPage);
|
||||
}
|
||||
return $aFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Подгрузка данных одного профиля по ajax-запросу
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected function EventAjaxLoadReport() {
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
|
||||
$sReportId=str_replace('report_','',getRequest('reportId',null,'post'));
|
||||
$bTreeView=getRequest('bTreeView',false,'post');
|
||||
$sParentId=getRequest('parentId',null,'post');
|
||||
|
||||
$oViewerLocal=$this->Viewer_GetLocalViewer();
|
||||
$oViewerLocal->Assign('oReport',$this->PluginProfiler_Profiler_GetReportById($sReportId,$sParentId));
|
||||
if(!$sParentId) $oViewerLocal->Assign('sAction','tree');
|
||||
|
||||
$sTemplateName = ($bTreeView)
|
||||
? (($sParentId)
|
||||
? 'level'
|
||||
: 'tree')
|
||||
:'report';
|
||||
$this->Viewer_AssignAjax('sReportText',$oViewerLocal->Fetch($this->getTemplatePathPlugin()."/actions/ActionProfiler/ajax/{$sTemplateName}.tpl", 'profiler'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Подгрузка данных одного профиля по ajax-запросу
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected function EventAjaxLoadEntriesByFilter() {
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
|
||||
$sAction = $this->GetParam(0);
|
||||
$sReportId=str_replace('report_','',getRequest('reportId',null,'post'));
|
||||
|
||||
$oViewerLocal=$this->Viewer_GetLocalViewer();
|
||||
$oViewerLocal->Assign('sAction',$sAction);
|
||||
|
||||
$oReport = $this->PluginProfiler_Profiler_GetReportById($sReportId,($sAction=='tree')?0:null);
|
||||
|
||||
/**
|
||||
* Преобразуем report взависимости от выбранного фильтра
|
||||
*/
|
||||
switch ($sAction) {
|
||||
case 'query':
|
||||
$oReport->setAllEntries($oReport->getEntriesByName('query'));
|
||||
break;
|
||||
}
|
||||
$oViewerLocal->Assign('oReport',$oReport);
|
||||
|
||||
$sTemplateName=($sAction=='tree')?'tree':'report';
|
||||
$this->Viewer_AssignAjax('sReportText',$oViewerLocal->Fetch($this->getTemplatePathPlugin()."/actions/ActionProfiler/ajax/{$sTemplateName}.tpl", "profiler"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Завершение работы Action`a
|
||||
*
|
||||
*/
|
||||
public function EventShutdown() {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,41 +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 PluginProfiler_HookProfiler extends Hook {
|
||||
|
||||
public function RegisterHook() {
|
||||
/**
|
||||
* Хук для вставки HTML кода
|
||||
*/
|
||||
if ($oUserCurrent=$this->User_GetUserCurrent() and $oUserCurrent->isAdministrator()) {
|
||||
$this->AddHook('template_body_end', 'Profiler');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Выводим HTML
|
||||
*
|
||||
*/
|
||||
public function Profiler() {
|
||||
return $this->Viewer_Fetch(Plugin::GetTemplatePath(__CLASS__).'link.tpl');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,249 +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 PluginProfiler_ModuleProfiler extends Module {
|
||||
/**
|
||||
* Меппер для сохранения логов в базу данных и формирования выборок по данным из базы
|
||||
*
|
||||
* @var Mapper_Profiler
|
||||
*/
|
||||
protected $oMapper;
|
||||
|
||||
/**
|
||||
* Хендлер открытого файла лога
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
protected $hLog;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sDataDelimiter = "\t";
|
||||
|
||||
/**
|
||||
* Инициализация модуля
|
||||
*/
|
||||
public function Init() {
|
||||
$this->oMapper=Engine::GetMapper(__CLASS__);
|
||||
$this->hLog = @fopen(Config::Get('path.application.server').'/logs/'.Config::Get('sys.logs.profiler_file'),'r+');
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавить новую запись в базу данных
|
||||
*
|
||||
* @param PluginProfiler_ModuleProfiler_EntityEntry $oEntry
|
||||
* @return bool
|
||||
*/
|
||||
public function AddEntry(PluginProfiler_ModuleProfiler_EntityEntry $oEntry) {
|
||||
return $this->oMapper->AddEntry($oEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Читает из лог-файла записи
|
||||
*
|
||||
* @param string $sPath
|
||||
* @return PluginProfiler_ModuleProfiler_EntityEntry
|
||||
*/
|
||||
public function ReadEntry() {
|
||||
/**
|
||||
* Если хендлер не определен, или лог закончен, вовращаем null
|
||||
*/
|
||||
if(!$this->hLog or feof($this->hLog)) return null;
|
||||
/**
|
||||
* Читаем следующую строку и формируем объект Entry
|
||||
*/
|
||||
$sLine=fgets($this->hLog);
|
||||
if(!$sLine) return null;
|
||||
|
||||
$aTime = array();
|
||||
list(
|
||||
$aTime['request_date'],$aTime['request_id'],$aTime['time_full'],
|
||||
$aTime['time_start'],$aTime['time_stop'],$aTime['time_id'],
|
||||
$aTime['time_pid'],$aTime['time_name'],$aTime['time_comment']
|
||||
)=explode($this->sDataDelimiter,$sLine,9);
|
||||
|
||||
return Engine::GetEntity('PluginProfiler_Profiler_Entry',$aTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Выгружает записи из лога в базу данных
|
||||
*
|
||||
* @param string $sDateStart
|
||||
* @param string $sPath
|
||||
* @return bool|int
|
||||
*/
|
||||
public function UploadLog($sDateStart,$sPath=null) {
|
||||
if($sPath) $this->hLog = @fopen($sPath,'r+');
|
||||
if(!$this->hLog) return null;
|
||||
|
||||
rewind($this->hLog);
|
||||
|
||||
$iCount=0;
|
||||
while($oEntry=$this->ReadEntry()) {
|
||||
if(strtotime($oEntry->getDate())>strtotime($sDateStart)){
|
||||
$this->AddEntry($oEntry);
|
||||
$iCount++;
|
||||
}
|
||||
unset($oEntry);
|
||||
}
|
||||
return $iCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получает дату последней записи профайлера в базе данных
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetDatabaseStat() {
|
||||
return $this->oMapper->GetDatabaseStat();
|
||||
}
|
||||
|
||||
/**
|
||||
* Очищает файл лога
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function EraseLog() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Получает записи профайлера из базы данных, группированных по уровню "Report"
|
||||
* TODO: Реализовать кеширование данных
|
||||
*
|
||||
* @param array $aFilter
|
||||
* @param int $iPage
|
||||
* @param int $iPerPage
|
||||
* @return array
|
||||
*/
|
||||
public function GetReportsByFilter($aFilter,$iPage,$iPerPage) {
|
||||
$data=array(
|
||||
'collection'=>$this->oMapper->GetReportsByFilter($aFilter,$iCount,$iPage,$iPerPage),
|
||||
'count'=>$iCount
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получает профайл-отчет по идентификатору
|
||||
* TODO: доработать система вывода записей в виде дерева
|
||||
*
|
||||
* @param int $sId
|
||||
* @return ProfileEntity_Report
|
||||
*/
|
||||
public function GetReportById($sId,$sPid=null) {
|
||||
$aReportRows=$this->oMapper->GetReportById($sId,$sPid);
|
||||
if(count($aReportRows)) {
|
||||
/**
|
||||
* Если запрошена часть записей, отдельно получаем статистику общей выборки
|
||||
*/
|
||||
$aStat = !is_null($sPid)
|
||||
? $this->GetReportStatById($sId)
|
||||
: array(
|
||||
'count' => 0,
|
||||
'query' => 0,
|
||||
'modules' => array(),
|
||||
'time_full' => 0
|
||||
);
|
||||
|
||||
$oReport = Engine::GetEntity('PluginProfiler_Profiler_Report');
|
||||
$aEntries = $this->BuildEntriesRecursive($aReportRows);
|
||||
foreach ($aEntries as $oEntry) {
|
||||
$oReport->addEntry($oEntry);
|
||||
if(is_null($sPid)) {
|
||||
/**
|
||||
* Заполняем статистику
|
||||
*/
|
||||
$aStat['count']++;
|
||||
$aStat['time_full']=max($aStat['time_full'],$oEntry->getTimeFull());
|
||||
if($oEntry->getName()=='query') $aStat['query']++;
|
||||
}
|
||||
}
|
||||
|
||||
$oReport->setStat($aStat);
|
||||
return $oReport;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получает статистику данного отчета
|
||||
* (количество замеров, общее время, количество запросов к БД, используемые модули)
|
||||
*
|
||||
* @param string $sId
|
||||
* @return array
|
||||
*/
|
||||
public function GetReportStatById($sId) {
|
||||
$aStat = array(
|
||||
'count' => 0,
|
||||
'query' => 0,
|
||||
'modules' => array(),
|
||||
'time_full' => 0
|
||||
);
|
||||
|
||||
$aReportRows=$this->oMapper->GetReportStatById($sId);
|
||||
foreach ($aReportRows as $aEntry) {
|
||||
$aStat['count']++;
|
||||
$aStat['time_full']=max($aStat['time_full'],$aEntry['time_full']);
|
||||
/**
|
||||
* Является ли запросом
|
||||
*/
|
||||
if($aEntry['time_name']=='query') $aStat['query']++;
|
||||
}
|
||||
return $aStat;
|
||||
}
|
||||
|
||||
protected function BuildEntriesRecursive($aEntries,$bBegin=true) {
|
||||
static $aResultEntries;
|
||||
static $iLevel;
|
||||
if ($bBegin) {
|
||||
$aResultEntries=array();
|
||||
$iLevel=0;
|
||||
}
|
||||
foreach ($aEntries as $aEntry) {
|
||||
$aTemp=$aEntry;
|
||||
$aTemp['level']=$iLevel;
|
||||
unset($aTemp['childNodes']);
|
||||
$aResultEntries[]=Engine::GetEntity('PluginProfiler_Profiler_Entry',$aTemp);
|
||||
if (isset($aEntry['childNodes']) and count($aEntry['childNodes'])>0) {
|
||||
$iLevel++;
|
||||
$this->BuildEntriesRecursive($aEntry['childNodes'],false);
|
||||
}
|
||||
}
|
||||
$iLevel--;
|
||||
return $aResultEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Удаление отчетов из базы данных
|
||||
* TODO: Добавить обработку кеша данных
|
||||
*
|
||||
* @param array|int $aIds
|
||||
* @return bool
|
||||
*/
|
||||
public function DeleteEntryByRequestId($aIds) {
|
||||
if(!is_array($aIds)) $aIds = array($aIds);
|
||||
return $this->oMapper->DeleteEntryByRequestId($aIds);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,121 +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 PluginProfiler_ModuleProfiler_EntityEntry extends Entity
|
||||
{
|
||||
public function getRequestId() {
|
||||
return $this->_getDataOne('request_id');
|
||||
}
|
||||
public function getDate() {
|
||||
return $this->_getDataOne('request_date');
|
||||
}
|
||||
public function getTimeFull() {
|
||||
return str_replace(',','.',$this->_getDataOne('time_full'));
|
||||
}
|
||||
|
||||
public function getTimeStart($mode=null) {
|
||||
switch ($mode) {
|
||||
case 'seconds':
|
||||
list($iSeconds,)=explode(' ',$this->_getDataOne('time_start'),2);
|
||||
return $iSeconds;
|
||||
|
||||
case 'time':
|
||||
list(,$iTime)=explode(' ',$this->_getDataOne('time_start'),2);
|
||||
return $iTime;
|
||||
|
||||
case null:
|
||||
default:
|
||||
return $this->_getDataOne('time_start');
|
||||
|
||||
}
|
||||
}
|
||||
public function getTimeStop($mode=null) {
|
||||
switch ($mode) {
|
||||
case 'seconds':
|
||||
list($iSeconds,)=explode(' ',$this->_getDataOne('time_stop'),2);
|
||||
return $iSeconds;
|
||||
|
||||
case 'time':
|
||||
list(,$iTime)=explode(' ',$this->_getDataOne('time_stop'),2);
|
||||
return $iTime;
|
||||
|
||||
case null:
|
||||
default:
|
||||
return $this->_getDataOne('time_stop');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->_getDataOne('time_id');
|
||||
}
|
||||
public function getPid() {
|
||||
return $this->_getDataOne('time_pid') ? $this->_getDataOne('time_pid'): 0;
|
||||
}
|
||||
public function getName() {
|
||||
return $this->_getDataOne('time_name');
|
||||
}
|
||||
public function getComment() {
|
||||
return $this->_getDataOne('time_comment');
|
||||
}
|
||||
|
||||
public function getLevel() {
|
||||
return $this->_getDataOne('level');
|
||||
}
|
||||
public function getChildCount() {
|
||||
return $this->_getDataOne('child_count');
|
||||
}
|
||||
public function getParentTimeFull() {
|
||||
return $this->_getDataOne('parent_time_full');
|
||||
}
|
||||
|
||||
public function setRequestId($data) {
|
||||
$this->_aData['request_id']=$data;
|
||||
}
|
||||
public function setDate($data) {
|
||||
$this->_aData['request_date']=$data;
|
||||
}
|
||||
public function setTimeFull($data) {
|
||||
$this->_aData['time_full']=$data;
|
||||
}
|
||||
public function setTimeStart($data) {
|
||||
$this->_aData['time_start']=$data;
|
||||
}
|
||||
public function setTimeStop($data) {
|
||||
$this->_aData['time_stop']=$data;
|
||||
}
|
||||
public function setId($data) {
|
||||
$this->_aData['time_id']=$data;
|
||||
}
|
||||
public function setPid($data) {
|
||||
$this->_aData['time_pid']=$data;
|
||||
}
|
||||
public function setName($data) {
|
||||
$this->_aData['time_name']=$data;
|
||||
}
|
||||
public function setComment($data) {
|
||||
$this->_aData['time_comment']=$data;
|
||||
}
|
||||
|
||||
public function setLevel($data) {
|
||||
$this->_aData['level']=$data;
|
||||
}
|
||||
public function setParentTimeFull($data) {
|
||||
$this->_aData['parent_time_full']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,136 +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 PluginProfiler_ModuleProfiler_EntityReport extends Entity
|
||||
{
|
||||
public function getId() {
|
||||
return $this->_getDataOne('report_id');
|
||||
}
|
||||
public function getDate() {
|
||||
return $this->_getDataOne('report_date');
|
||||
}
|
||||
public function getAllEntries() {
|
||||
return $this->_getDataOne('report_entries')?$this->_getDataOne('report_entries'):array();
|
||||
}
|
||||
public function getTime() {
|
||||
return $this->_getDataOne('report_time_full')?$this->_getDataOne('report_time_full'):0;
|
||||
}
|
||||
|
||||
public function getEntriesByName($sName=null) {
|
||||
if(!$sName) return $this->getAllEntries();
|
||||
|
||||
$aResult=array();
|
||||
foreach ($this->getAllEntries() as $oEntry) {
|
||||
if($oEntry->getName()==$sName) $aResult[$oEntry->getId()]=$oEntry;
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
public function getCountEntriesByName($sName=null) {
|
||||
return count($this->getEntriesByName($sName));
|
||||
}
|
||||
|
||||
public function getEntriesByCommentFilter($sFilter) {
|
||||
$sFilter=str_replace('*','[\W]+',$sFilter);
|
||||
|
||||
$aResult=array();
|
||||
foreach ($this->_getDataOne('report_entries') as $oEntry) {
|
||||
if(preg_match("/{$sFilter}/Ui",$oEntry->getComment())) {
|
||||
$aResult[$oEntry->getId()]=$oEntry;
|
||||
}
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
public function getCountEntriesByCommentFilter($sFilter) {
|
||||
return count($this->getEntriesByCommentFilter($sFilter));
|
||||
}
|
||||
|
||||
public function getEntriesByPid($sPid) {
|
||||
$aResult=array();
|
||||
foreach ($this->_getDataOne('report_entries') as $oEntry) {
|
||||
if($oEntry->getPid()==$sPid) $aResult[]=$oEntry;
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
public function getCountEntriesByPid($sPid) {
|
||||
return $this->getEntriesByPid($sPid);
|
||||
}
|
||||
|
||||
public function getEntryShare($sEntryId) {
|
||||
if(!isset($this->_aData['report_entries'][$sEntryId])) return null;
|
||||
if(!$this->_aData['report_entries'][$sEntryId]->getParentTimeFull()) return '-';
|
||||
|
||||
return round($this->_aData['report_entries'][$sEntryId]->getTimeFull()*100/$this->_aData['report_entries'][$sEntryId]->getParentTimeFull(), 2);
|
||||
}
|
||||
|
||||
public function getEntryFullShare($sEntryId) {
|
||||
if(!isset($this->_aData['report_entries'][$sEntryId])) return null;
|
||||
|
||||
return ($iTimeFull=$this->getStat('time_full'))
|
||||
? round($this->_aData['report_entries'][$sEntryId]->getTimeFull()*100/$iTimeFull, 2)
|
||||
: '?';
|
||||
}
|
||||
/**
|
||||
* Получает статистику отчета
|
||||
*
|
||||
* @param string [$sKey default=null
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function getStat($sKey=null) {
|
||||
if(!$sKey) return $this->_getDataOne('report_stat');
|
||||
if(isset($this->_aData['report_stat'][$sKey])) return $this->_aData['report_stat'][$sKey];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setId($data) {
|
||||
$this->_aData['report_id']=$data;
|
||||
}
|
||||
public function setDate($data) {
|
||||
$this->_aData['report_date']=$data;
|
||||
}
|
||||
protected function setTime($data) {
|
||||
$this->_aData['report_time_full']=$data;
|
||||
}
|
||||
|
||||
public function addEntry(PluginProfiler_ModuleProfiler_EntityEntry $data) {
|
||||
if(!isset($this->_aData['report_id'])) {
|
||||
$this->setId($data->getRequestId());
|
||||
$this->setDate($data->getDate());
|
||||
}
|
||||
|
||||
if($this->getId()!=$data->getRequestId()) return null;
|
||||
$this->_aData['report_entries'][$data->getId()]=$data;
|
||||
}
|
||||
/**
|
||||
* Устанавливаем все записи одним массивом
|
||||
*
|
||||
* @param array $data
|
||||
* @return null
|
||||
*/
|
||||
public function setAllEntries($data) {
|
||||
if(!is_array($data)) return null;
|
||||
$this->_aData['report_entries']=$data;
|
||||
}
|
||||
public function setStat($data,$sKey=null) {
|
||||
if(!$sKey) {
|
||||
$this->_aData['report_stat']=$data;
|
||||
return ;
|
||||
}
|
||||
$this->_aData[$sKey]=$data;
|
||||
}
|
||||
}
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue