Projekt

Obecné

Profil

Stáhnout (2.57 KB) Statistiky
| Větev: | Tag: | Revize:
1
<?php
2
/* SVN FILE: $Id: app_controller.php 4409 2007-02-02 13:20:59Z phpnut $ */
3
/**
4
 * Short description for file.
5
 *
6
 * This file is application-wide controller file. You can put all
7
 * application-wide controller-related methods here.
8
 *
9
 * PHP versions 4 and 5
10
 *
11
 * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
12
 * Copyright 2005-2007, Cake Software Foundation, Inc.
13
 *								1785 E. Sahara Avenue, Suite 490-204
14
 *								Las Vegas, Nevada 89104
15
 *
16
 * Licensed under The MIT License
17
 * Redistributions of files must retain the above copyright notice.
18
 *
19
 * @filesource
20
 * @copyright		Copyright 2005-2007, Cake Software Foundation, Inc.
21
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
22
 * @package			cake
23
 * @subpackage		cake.app
24
 * @since			CakePHP(tm) v 0.2.9
25
 * @version			$Revision: 4409 $
26
 * @modifiedby		$LastChangedBy: phpnut $
27
 * @lastmodified	$Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
28
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
29
 */
30
/**
31
 * Short description for class.
32
 *
33
 * Add your application-wide methods in the class below, your controllers
34
 * will inherit them.
35
 *
36
 * @package		cake
37
 * @subpackage	cake.app
38
 */
39
class AppController extends Controller {
40

    
41
	var $components = array('CakeAuth');
42
	
43
	 var $helpers = array('Html', 'Javascript');
44

    
45
	function beforeFilter() {
46
		$this->CakeAuth->set();
47

    
48

    
49
///		$this->log('testuji uzivatel: '. $this->CakeAuth->login."\n" .
50
///				" name:".$this->name."\n" .
51
///				" akce:".$this->action."\n");
52

    
53
		//nastavit anonymous, kdyz neprihlasen
54
		if (	empty($this->CakeAuth->login) &&
55
				$this->name != 'CakeLogin' &&
56
				$this->action != 'anonymous') {
57
///			$this->log('PRESMEROVANI na anonym');
58
			$this->redirect('cake_login/anonymous');exit();
59
		}
60
		else if (!$this->CakeAuth->check($this->name, $this->action)) {
61
      		//$this->Session->setFlash('Varování: Přístup byl zamítnut.');
62
///			$this->log('PRESMEROVANI na login - pristup zamitnut');
63

    
64
      		$this->redirect('cake_login');exit();
65
    	}
66
///    	$this->log('OK');
67

    
68
		$this->canView = ($this->CakeAuth->security >= 10);
69
    	$this->canAdd = $this->canEdit = ($this->CakeAuth->security >= 60);
70
    	$this->canDelete = ($this->CakeAuth->security >= 99);
71

    
72
		//pr($this->canEdit);
73

    
74
    	$this->set('CakeAuth', $this->CakeAuth);
75
    	$this->set('canView', $this->canView);
76
    	$this->set('canAdd', $this->canAdd);
77
    	$this->set('canEdit', $this->canEdit);
78
    	$this->set('canDelete', $this->canDelete);
79

    
80
    	return true;
81
	}
82

    
83
	function beforeRender() {
84
		$this->set('ac', $this->CakeAuth);
85
	}
86
}
(2-2/4)