Skip to content
Snippets Groups Projects
Select Git revision
  • master default
  • disable-new-requests
  • fix-bulletin-view-missing-notes-error
  • add-missing-queue-managers
  • projects-task-53
  • projects-task-51
  • projects-task-43
  • projects-task-24
  • projects-task-31
  • projects-task-32
  • projects-task-8
  • project-setup-docs
  • projects-task-28
  • projects-task-27
  • projects-task-9
  • projects-task-7
  • mass-update-course-codes-in-sections
  • wdn-four
  • learning-outcomes
  • additional-bulletin-pages
  • svn-redesign
  • svn-popups
  • svn-trunk
  • svn-performance
  • svn-tim
25 results

Action.php

Blame
  • Action.php 1.19 KiB
    <?php
    
    /**
     * A custom base controller class that takes care of setting up custom View Helpers.
     */
    
    class App_Controller_Action extends Unl_Controller_Action
    {
        public function init()
        {	
            parent::init();
            $this->view->addHelperPath(dirname(__FILE__) . '/../View/Helper', 'App_View_Helper');
            $this->view->doctype()->setDoctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL);
            // Zend_Controller_Action_HelperBroker::addPrefix('App_Controller_Helper');
            
            $this->_transparentCasLogin();
        }
        
        protected function _transparentCasLogin()
        {
            $session = new Zend_Session_Namespace(__CLASS__);
            
            if (!array_key_exists('unl_sso', $_COOKIE)) {
    	        // Only passively check for a login once per hour (per user)
    	        if ($session->lastCasCheck > time() - 60*60) {
    	            return;
    	        }
                $session->lastCasCheck = time();
            } else {
            	$session->lastCasCheck = 0;
            }
            
        	// The auth module is doing its thing (probably an active login or logout). Let it be.
        	if (get_class($this) == 'Auth_IndexController') {
        		return;
        	}
        	
        	Auth_UserModel::authenticateUser();
        }
    }