All pastes #630417 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-07-23 05:02 UTC
rendered paste body
<?phpclass AppController extends Controller {	var $uses = array('setting');	var $components = array();	var $helpers = array('html');        var $beforeFilter = array('setupProductOptions', '__validateLoginStatus');		function setupProductOptions() {		$this->productOptions = $this->fetchOptions();		$this->set('productOptions', $this->productOptions); 	}		function __validateLoginStatus() {		if ( $this->action != 'login' ) {		echo '1';			if( $this->Session->check('User') ) {				$this->redirect('/users/login');				$this->Session->setFlash('The URL you\'ve followed requires you login.');			}		}	}		function fetchOptions() {		$result = $this->setting->findall();		foreach ( $result as $key => $value ) {			$value = $value['setting'];			$settings[$value['option']] = $value['value'];		}		if ( !isset($settings) ) { 			return False;		}		return $settings;	}?>