mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-08 01:14:24 +03:00
132 lines
3.9 KiB
PHP
132 lines
3.9 KiB
PHP
<?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
|
|
*
|
|
---------------------------------------------------------
|
|
*/
|
|
|
|
/**
|
|
* Класс обработки УРЛа вида /comments/
|
|
*
|
|
*/
|
|
class ActionAdmin extends Action {
|
|
|
|
/**
|
|
* Главное меню
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $sMenuHeadItemSelect='admin';
|
|
|
|
public function Init() {
|
|
if(!$this->User_IsAuthorization() or !$oUserCurrent=$this->User_GetUserCurrent() or !$oUserCurrent->isAdministrator()) {
|
|
return parent::EventNotFound();
|
|
}
|
|
|
|
$this->oUserCurrent=$oUserCurrent;
|
|
}
|
|
|
|
protected function RegisterEvent() {
|
|
$this->AddEvent('plugins','EventPlugins');
|
|
$this->AddEvent('restorecomment','EventRestoreComment');
|
|
}
|
|
|
|
|
|
/**********************************************************************************
|
|
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
|
|
**********************************************************************************
|
|
*/
|
|
|
|
protected function EventRestoreComment() {
|
|
set_time_limit(0);
|
|
$this->Comment_RestoreTree();
|
|
$this->Cache_Clean();
|
|
die('restore ok');
|
|
}
|
|
|
|
protected function EventPlugins() {
|
|
$this->sMenuHeadItemSelect='plugins';
|
|
/**
|
|
* Обработка удаления плагинов
|
|
*/
|
|
if (isPost('submit_plugins_del')) {
|
|
$this->Security_ValidateSendForm();
|
|
|
|
$aPluginsDelete=getRequest('plugin_del');
|
|
if (is_array($aPluginsDelete)) {
|
|
$this->Plugin_Delete(array_keys($aPluginsDelete));
|
|
}
|
|
}
|
|
/**
|
|
* Получаем название плагина и действие
|
|
*/
|
|
if($sPlugin=getRequest('plugin',null,'get') and $sAction=getRequest('action',null,'get')) {
|
|
return $this->SubmitManagePlugin($sPlugin,$sAction);
|
|
}
|
|
/**
|
|
* Передан ли номер страницы
|
|
*/
|
|
$iPage= preg_match("/^\d+$/i",$this->GetEventMatch(2)) ? $this->GetEventMatch(2) : 1;
|
|
/**
|
|
* Получаем список блогов
|
|
*/
|
|
$aPlugins=$this->Plugin_GetList();
|
|
/**
|
|
* Загружаем переменные в шаблон
|
|
*/
|
|
$this->Viewer_Assign("aPlugins",$aPlugins);
|
|
$this->Viewer_AddHtmlTitle($this->Lang_Get('plugins_administartion_title'));
|
|
/**
|
|
* Устанавливаем шаблон вывода
|
|
*/
|
|
$this->SetTemplateAction('plugins');
|
|
}
|
|
|
|
/**
|
|
* Активация\деактивация плагина
|
|
*
|
|
* @param string $sPlugin
|
|
* @param string $sAction
|
|
*/
|
|
protected function SubmitManagePlugin($sPlugin,$sAction) {
|
|
$this->Security_ValidateSendForm();
|
|
if(!in_array($sAction,array('activate','deactivate'))) {
|
|
$this->Message_AddError($this->Lang_Get('plugins_unknown_action'),$this->Lang_Get('error'),true);
|
|
Router::Location(Router::GetPath('plugins'));
|
|
}
|
|
/**
|
|
* Активируем\деактивируем плагин
|
|
*/
|
|
if($bResult=$this->Plugin_Toggle($sPlugin,$sAction)) {
|
|
$this->Message_AddNotice($this->Lang_Get('plugins_action_ok'),$this->Lang_Get('attention'),true);
|
|
} else {
|
|
if(!($aMessages=$this->Message_GetErrorSession()) or !count($aMessages)) $this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'),true);
|
|
}
|
|
/**
|
|
* Возвращаем на страницу управления плагинами
|
|
*/
|
|
Router::Location(Router::GetPath('admin').'plugins/');
|
|
}
|
|
|
|
/**
|
|
* Выполняется при завершении работы экшена
|
|
*
|
|
*/
|
|
public function EventShutdown() {
|
|
/**
|
|
* Загружаем в шаблон необходимые переменные
|
|
*/
|
|
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
|
|
}
|
|
}
|
|
?>
|