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

111 lines
3.4 KiB
PHP
Raw Normal View History

<?php
2008-09-21 09:36:57 +03:00
/*-------------------------------------------------------
*
* 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
*
---------------------------------------------------------
*/
/**
* Экшен обработки УРЛа вида /my/
* Оставлен только для редиректов со старых УРЛ на новые
2008-09-21 09:36:57 +03:00
*
* @package 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
}
}
?>