<?php defined('SYSPATH') or die('No direct script access.'); class Controller_UserEnvi extends Controller { protected $UserInfo; public function before() { if(!Auth::isLoggedIn()) { $this->redirect('sign', 302); } else { $model = new Model_Sign; $user = Auth::getData(); $this->UserInfo = $model->getFullInfoByID($user['ID'])->offsetGet(0); $directory = $this->request->directory(); if(!empty($directory)) if(UTF8::strcasecmp($this->request->directory(), $user['Type'])) //throw HTTP_Exception::factory(404, $this->request->directory()); throw HTTP_Exception::factory(404, 'Не пытайтесь попасть туда, куда попадать не следует.'); } } public function action_index() { $page = Request::factory($this->UserInfo['AccountType'].'/index')->execute(); $this->response->body($page); } public function action_profile() { $url = $this->UserInfo['AccountType']."/profile"; if(!empty($type)) $url .= '/'.$type; if(!empty($id)) $url .= '/'.$id; $page = Request::factory($url)->execute(); $this->response->body($page); } public function action_settings() { $page = Request::factory($this->UserInfo['AccountType'].'/settings')->execute(); $this->response->body($page); } }