Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?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);
}
}