1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-05 07:54:24 +03:00
ifhub.club/application/classes/actions/ActionMy.class.php

114 lines
3.5 KiB
PHP
Raw Normal View History

<?php
2014-10-08 08:20:29 +03:00
/*
* LiveStreet CMS
* Copyright © 2013 OOO "ЛС-СОФТ"
*
* ------------------------------------------------------
*
* Official site: www.livestreetcms.com
* Contact e-mail: office@livestreetcms.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* ------------------------------------------------------
*
* @link http://www.livestreetcms.com
* @copyright 2013 OOO "ЛС-СОФТ"
* @author Maxim Mzhelskiy <rus.engine@gmail.com>
*
*/
2008-09-21 09:36:57 +03:00
/**
* Экшен обработки УРЛа вида /my/
* Оставлен только для редиректов со старых УРЛ на новые
2008-09-21 09:36:57 +03:00
*
2014-10-08 08:20:29 +03:00
* @package application.actions
* @since 1.0
2008-09-21 09:36:57 +03:00
*/
class ActionMy extends Action {
/**
* Объект юзера чей профиль мы смотрим
*
* @var ModuleUser_EntityUser|null
2008-09-21 09:36:57 +03:00
*/
protected $oUserProfile=null;
/**
* Инициализация
*/
2010-02-06 11:04:36 +02:00
public function Init() {
2008-09-21 09:36:57 +03:00
}
/**
* Регистрируем евенты
*/
protected function RegisterEvent() {
2012-07-09 08:47:42 +03:00
$this->AddEventPreg('/^.+$/i','/^(page([1-9]\d{0,5}))?$/i','EventTopics');
$this->AddEventPreg('/^.+$/i','/^blog$/i','/^(page([1-9]\d{0,5}))?$/i','EventTopics');
$this->AddEventPreg('/^.+$/i','/^comment$/i','/^(page([1-9]\d{0,5}))?$/i','EventComments');
2008-09-21 09:36:57 +03:00
}
2008-09-21 09:36:57 +03:00
/**********************************************************************************
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
**********************************************************************************
*/
2008-09-21 09:36:57 +03:00
/**
* Выводит список топиков которые написал юзер
* Перенаправляет на профиль пользователя
*
2008-09-21 09:36:57 +03:00
*/
protected function EventTopics() {
/**
* Получаем логин из УРЛа
*/
$sUserLogin=$this->sCurrentEvent;
/**
* Проверяем есть ли такой юзер
*/
if (!($this->oUserProfile=$this->User_GetUserByLogin($sUserLogin))) {
return parent::EventNotFound();
}
2008-09-21 09:36:57 +03:00
/**
* Передан ли номер страницы
*/
if ($this->GetParamEventMatch(0,0)=='blog') {
$iPage=$this->GetParamEventMatch(1,2) ? $this->GetParamEventMatch(1,2) : 1;
2008-09-21 09:36:57 +03:00
} else {
$iPage=$this->GetParamEventMatch(0,2) ? $this->GetParamEventMatch(0,2) : 1;
}
2008-09-21 09:36:57 +03:00
/**
* Выполняем редирект на новый URL, в новых версиях LS экшен "my" будет удален
2008-09-21 09:36:57 +03:00
*/
$sPage=$iPage==1 ? '' : "page{$iPage}/";
Router::Location($this->oUserProfile->getUserWebPath().'created/topics/'.$sPage);
2008-09-21 09:36:57 +03:00
}
2008-09-21 09:36:57 +03:00
/**
* Выводит список комментариев которые написал юзер
* Перенаправляет на профиль пользователя
*
2008-09-21 09:36:57 +03:00
*/
protected function EventComments() {
/**
* Получаем логин из УРЛа
*/
$sUserLogin=$this->sCurrentEvent;
/**
* Проверяем есть ли такой юзер
*/
if (!($this->oUserProfile=$this->User_GetUserByLogin($sUserLogin))) {
return parent::EventNotFound();
}
2008-09-21 09:36:57 +03:00
/**
* Передан ли номер страницы
*/
$iPage=$this->GetParamEventMatch(1,2) ? $this->GetParamEventMatch(1,2) : 1;
2008-09-21 09:36:57 +03:00
/**
* Выполняем редирект на новый URL, в новых версиях LS экшен "my" будет удален
2008-09-21 09:36:57 +03:00
*/
$sPage=$iPage==1 ? '' : "page{$iPage}/";
Router::Location($this->oUserProfile->getUserWebPath().'created/comments/'.$sPage);
2008-09-21 09:36:57 +03:00
}
}