| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
class AppController extends Controller |
|---|
| 4 |
{ |
|---|
| 5 |
var $helpers = array('Html','Form','othAuth','Javascript', 'Time', 'Text','Cache','Tree','Habtm'); |
|---|
| 6 |
var $components = array('othAuth','Conf','Session','Openid','Captcha', 'YahooGeo','RequestHandler','FileOps','Ffmpeg', 'Nav'); |
|---|
| 7 |
|
|---|
| 8 |
var $othAuthRestrictions = array('add','edit','delete', CAKE_ADMIN); |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
* Called before view |
|---|
| 12 |
*/ |
|---|
| 13 |
function beforeFilter() |
|---|
| 14 |
{ |
|---|
| 15 |
$auth_conf = array( |
|---|
| 16 |
'mode' => 'oth', |
|---|
| 17 |
'login_page' => '/users/login', |
|---|
| 18 |
'logout_page' => '/users/logout', |
|---|
| 19 |
'access_page' => '/', |
|---|
| 20 |
'hashkey' => CAKE_SESSION_STRING, |
|---|
| 21 |
'noaccess_page' => '/users/noaccess', |
|---|
| 22 |
'strict_gid_check' => false, |
|---|
| 23 |
'history_active' => true, |
|---|
| 24 |
'login_limit' => true, |
|---|
| 25 |
'gid_order' => 'DESC'); |
|---|
| 26 |
|
|---|
| 27 |
$this->othAuth->controller = &$this; |
|---|
| 28 |
$this->othAuth->init($auth_conf); |
|---|
| 29 |
$this->othAuth->check(); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
function beforeRender() |
|---|
| 33 |
{ |
|---|
| 34 |
$this->set('sitename', $this->Conf->get('general.sitename')); |
|---|
| 35 |
$this->set('sitedesc', $this->Conf->get('general.sitedesc')); |
|---|
| 36 |
$this->set('siteurl', $this->Conf->get('general.siteurl')); |
|---|
| 37 |
$this->set('enable_comments', $this->Conf->get('general.enable_comments')); |
|---|
| 38 |
$this->set('enable_captcha', $this->Conf->get('general.enable_captcha')); |
|---|
| 39 |
$this->set('video_width', $this->Conf->get('video.width')); |
|---|
| 40 |
$this->set('video_height', $this->Conf->get('video.height')); |
|---|
| 41 |
$this->set('video_samplerate', $this->Conf->get('video.samplerate')); |
|---|
| 42 |
$this->set('video_bitrate', $this->Conf->get('video.bitrate')); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
function afterRender() |
|---|
| 46 |
{ |
|---|
| 47 |
$isAjax = !empty($this->params['isAjax']); |
|---|
| 48 |
|
|---|
| 49 |
$view =& ClassRegistry::getObject('view'); |
|---|
| 50 |
|
|---|
| 51 |
if ($isAjax) { |
|---|
| 52 |
|
|---|
| 53 |
$session =& $this->Session; |
|---|
| 54 |
if ($session->check('Message.flash')) { |
|---|
| 55 |
$message = $session->read('Message.flash'); |
|---|
| 56 |
$session->delSessionVar('Message.flash'); |
|---|
| 57 |
$message = preg_replace('/<div[^>]*>/i', '', $message); |
|---|
| 58 |
$message = preg_replace('/<\/div[^>]*>/i', '', $message); |
|---|
| 59 |
|
|---|
| 60 |
$_flash = '$("#flashMessage").html("'.$message.'").css("display", "block");'; |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
function captcha() |
|---|
| 66 |
{ |
|---|
| 67 |
$this->Captcha->render(); |
|---|
| 68 |
} |
|---|
| 69 |
|
|---|
| 70 |
} |
|---|
| 71 |
|
|---|
| 72 |
?> |
|---|
| 73 |
|
|---|