Changeset 540

Show
Ignore:
Timestamp:
05/21/08 11:43:42 (6 months ago)
Author:
aarkerio
Message:

New Try

Location:
trunk/app
Files:
46 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/app_controller.php

    r538 r540  
    1818 public function beforeFilter() 
    1919 { 
    20      $this->Auth->fields         = array('username' => 'email', 'password' => 'pwd'); 
    21      $this->Auth->loginAction    = array('controller' => 'users', 'action' => 'login'); 
    22      $this->Auth->loginRedirect  = array('controller' => 'news', 'action' => 'display'); 
    23      $this->Auth->logoutRedirect = '/news/display'; 
     20     $this->Auth->fields         = array('username'   => 'email', 'password' => 'pwd'); 
     21     $this->Auth->loginAction    = array('controller' => 'users', 'action'   => 'login'); 
     22     $this->Auth->loginRedirect  = array('controller' => 'news', 'action'    => 'display'); 
     23     $this->Auth->logoutRedirect = array('controller' => 'news', 'action'    => 'display'); 
    2424     $this->Auth->loginError     = 'Invalid e-mail / password combination. Please try again'; 
    2525     $this->Auth->authorize      = 'controller';   
     
    2828     $this->set('cU', $this->Auth->user());  // $cU current user array to use in the views if user logged in 
    2929 } 
     30 
     31 public function isAuthorized()  
     32 {       
     33   if (isset( $this->params[Configure::read('Routing.admin')] )): 
     34       if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
     35          return true; 
     36       else: 
     37              return false; 
     38       endif; 
     39   endif; 
    3040  
     41   return true; 
     42 } 
     43 
    3144 public function msgFlash($msg, $to) 
    3245 { 
  • trunk/app/controllers/acquaintances_controller.php

    r538 r540  
    2323    $this->Auth->allow(array('display'));  
    2424 } 
    25   
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30           return true; 
    31        else: 
    32               return false; 
    33        endif; 
    34    endif; 
    35   
    36    return true; 
    37  } 
    38   
     25   
    3926 public function display($username, $user_id) 
    4027 { 
  • trunk/app/controllers/answers_controller.php

    r538 r540  
    2121 } 
    2222  
    23  public function isAuthorized()  
    24  {       
    25    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    26        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    27          return true; 
    28        else: 
    29              return false; 
    30        endif;    
    31    endif; 
    32  
    33    return true; 
    34  } 
    35  
    36   /***   === ADMIN METHODS===  ***/ 
     23 /***   === ADMIN METHODS===  ***/ 
    3724   
    38   public function admin_add()  
    39   { 
     25 public function admin_add()  
     26 { 
    4027   if (!empty($this->data["Answer"])) 
    4128   {   
  • trunk/app/controllers/categories_controller.php

    r538 r540  
    2222 } 
    2323  
    24  public function isAuthorized()  
    25  {       
    26    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    27        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    28          return true; 
    29        else: 
    30              return false; 
    31        endif;    
    32    endif; 
    33  
    34    return true; 
    35  }   
    36  
    3724 public function index($order = null) 
    3825 { 
  • trunk/app/controllers/catfaqs_controller.php

    r538 r540  
    2222    parent::beforeFilter(); 
    2323    $this->Auth->allow(array('display', 'view')); 
    24  } 
    25   
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    3724 } 
    3825  
  • trunk/app/controllers/catforums_controller.php

    r538 r540  
    2424 } 
    2525 
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    37  } 
    38   
    3926 public function display($username, $user_id)  
    4027 {  
  • trunk/app/controllers/catglossaries_controller.php

    r538 r540  
    2424 } 
    2525  
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    37  } 
    38  
    3926 public function display($username) 
    4027 { 
  • trunk/app/controllers/colleges_controller.php

    r538 r540  
    2424 } 
    2525  
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    37  } 
    38  
    3926 public function view()  
    4027 {      
  • trunk/app/controllers/comments_controller.php

    r538 r540  
    2424 } 
    2525   
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    37  } 
    38   
    3926 public function view($username=null, $entry_id=null) 
    4027 {     
  • trunk/app/controllers/confirms_controller.php

    r538 r540  
    1919    $this->Auth->allow(array('signup')); 
    2020 } 
    21   
    22  public function isAuthorized()  
    23  {       
    24    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    25        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    26          return true; 
    27        else: 
    28              return false; 
    29        endif;    
    30    endif; 
    31  
    32    return true; 
    33  } 
    34   
     21   
    3522 public function signup($secret = null) 
    3623 {  
  • trunk/app/controllers/discussions_controller.php

    r538 r540  
    2727         $this->Auth->allow(array('captcha', 'add')); 
    2828    endif; 
    29  } 
    30   
    31  public function isAuthorized()  
    32  {       
    33    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    34        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    35          return true; 
    36        else: 
    37              return false; 
    38        endif;    
    39    endif; 
    40  
    41    return true; 
    4229 } 
    4330  
  • trunk/app/controllers/ecourses_controller.php

    r538 r540  
    2222 } 
    2323  
    24  public function isAuthorized()  
    25  {       
    26    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    27        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    28          return true; 
    29        else: 
    30              return false; 
    31        endif;    
    32    endif; 
    33  
    34    return true; 
    35  } 
    36   
    37  
    38  /**** 
    39      ===== ADMIN SECTION ========== 
    40  ****/ 
     24 /****     ===== ADMIN SECTION ========== ****/ 
    4125 public function admin_start() 
    4226  { 
  • trunk/app/controllers/entries_controller.php

    r538 r540  
    2525 }  
    2626  
    27  public function isAuthorized()  
    28  {       
    29    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    30        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    31          return true; 
    32        else: 
    33              return false; 
    34        endif;    
    35    endif; 
    36  
    37    return true; 
    38  } 
    39  
    4027 public function rss($username) 
    4128 { 
  • trunk/app/controllers/events_controller.php

    r538 r540  
    1515class EventsController extends AppController 
    1616 
    17   public $helpers       = array('Html', 'Javascript', 'Ajax', 'Form'); 
     17 public $helpers       = array('Html', 'Javascript', 'Ajax', 'Form'); 
    1818    
    19   public $components    = array('Portal'); 
     19 public $components    = array('Portal'); 
    2020    
    21   public function beforeFilter()  
    22   { 
     21 public function beforeFilter()  
     22 { 
    2323    parent::beforeFilter(); 
    2424    // allow everyone to join 
    2525    $this->Auth->allow(array('display')); 
    26   } 
    27   
    28  public function isAuthorized()  
    29  {       
    30    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    31        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    32          return true; 
    33        else: 
    34              return false; 
    35        endif;    
    36    endif; 
    37  
    38    return true; 
    3926 } 
    4027  
    41     
    42   public function calendar() 
    43   {   
     28 public function calendar() 
     29 {   
    4430      $this->layout  = 'portal'; 
    4531       
  • trunk/app/controllers/faqs_controller.php

    r538 r540  
    2424 } 
    2525 
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    37  } 
    38    
    3926 public function index($order = null) 
    4027 { 
  • trunk/app/controllers/forums_controller.php

    r538 r540  
    2222    parent::beforeFilter(); 
    2323    $this->Auth->allow(array('display', 'discussion', 'view', 'index')); 
    24  } 
    25   
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    3724 } 
    3825  
  • trunk/app/controllers/galleries_controller.php

    r538 r540  
    1515class GalleriesController extends AppController 
    1616{ 
    17   public $helpers       = array('Ajax', 'User', 'Gags');     
     17 public $helpers       = array('Ajax', 'User', 'Gags');     
    1818 
    19   public function beforeFilter()  
     19 public function beforeFilter()  
    2020 { 
    2121    parent::beforeFilter(); 
  • trunk/app/controllers/glossaries_controller.php

    r538 r540  
    2121 { 
    2222   parent::beforeFilter(); 
    23  } 
    24  
    25   
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    3723 } 
    3824   
  • trunk/app/controllers/groups_controller.php

    r538 r540  
    2121  } 
    2222 
    23  public function isAuthorized()  
    24  {       
    25    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    26        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    27          return true; 
    28        else: 
    29              return false; 
    30        endif;    
    31    endif; 
    32  
    33    return true; 
    34  } 
    35    
    3623 /**   === ADMIN METHODS ===  **/  
    3724 public function admin_listing()  
  • trunk/app/controllers/helps_controller.php

    r538 r540  
    2222     parent::beforeFilter(); 
    2323     $this->Auth->allow(array('display', 'tour')); 
    24  } 
    25   
    26  public function isAuthorized()  
    27  {       
    28    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    29        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    30          return true; 
    31        else: 
    32              return false; 
    33        endif;    
    34    endif; 
    35  
    36    return true; 
    3724 } 
    3825  
  • trunk/app/controllers/images_controller.php

    r538 r540  
    2323 } 
    2424     
    25  public function isAuthorized()  
    26  {       
    27    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    28        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    29          return true; 
    30        else: 
    31              return false; 
    32        endif;    
    33    endif; 
    34  
    35    return true; 
    36  } 
    37   
    3825 /***  === ADMIN METHODS  ***/ 
    3926  
  • trunk/app/controllers/lessons_controller.php

    r538 r540  
    2323    $this->Auth->allow(array('view', 'display')); 
    2424 } 
    25   
    26   
    27  public function isAuthorized()  
    28  {       
    29    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    30        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    31          return true; 
    32        else: 
    33              return false; 
    34        endif;    
    35    endif; 
    36  
    37    return true; 
    38  } 
    39   
    4025  
    4126 public function view($username, $id) 
  • trunk/app/controllers/medias_controller.php

    r538 r540  
    2020    $this->Auth->allow(array('view', 'display')); 
    2121 } 
    22  
    23   
    24  public function isAuthorized()  
    25  {       
    26    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    27        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    28          return true; 
    29        else: 
    30              return false; 
    31        endif;    
    32    endif; 
    33  
    34    return true; 
    35  } 
    36   
    3722  
    3823 public function index($id = null) 
  • trunk/app/controllers/messages_controller.php

    r538 r540  
    2626 } 
    2727 
    28  public function isAuthorized()  
    29  {       
    30    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    31        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    32          return true; 
    33        else: 
    34              return false; 
    35        endif;    
    36    endif; 
    37  
    38    return true; 
    39  } 
    40   
    4128 public function message($username) // show form to send message to teacher 
    4229 {       
  • trunk/app/controllers/news_controller.php

    r538 r540  
    2424   parent::beforeFilter(); 
    2525   $this->Auth->allow(array('view', 'display', 'rss', 'category')); 
    26  } 
    27   
    28  public function isAuthorized()  
    29  {       
    30    if (isset( $this->params[Configure::read('Routing.admin')] )): 
    31        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
    32          return true; 
    33        else: 
    34              return false; 
    35        endif;    
    36    endif; 
    37  
    38    return true; 
    3926 } 
    4027  
  • trunk/app/controllers/newsletters_controller.php

    r538 r540  
    2121  } 
    2222