03.17 php saved
jben_mbp
Tags add more
auth and beforeFilter  
Note
jben_mbp did not leave a note
  1. <?php
  2.  
  3. class AppController extends Controller
  4. {
  5.     var $lockedPages = array('secret');
  6.    
  7.     function beforeFilter()
  8.     {
  9.         // check if we're using the pages controller
  10.         if ($this->name = 'Pages')
  11.         {
  12.             // get args
  13.             $path = func_get_args();
  14.             // check if current page is in locked array
  15.             if (in_array($path[0], $this->lockedPages))
  16.             {
  17.                 $this->Auth->deny('display');
  18.             }
  19.         }
  20.     }
  21. }
  22.  
  23. ?>
Parsed in 0.025 seconds, using GeSHi 1.0.7.14

Modify this Paste