Changeset 9b94eb6 in github


Ignore:
Timestamp:
Feb 6, 2010 1:12:49 PM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
33ea0c7
Parents:
a65bf3a
Message:
  • Fix setting task name according to auth state. So, any action before user is authenticated is assigned to 'login' task instead of 'mail'. Now binding plugins to 'login' task is possible and realy usefull. It's also possible to bind to all tasks excluding 'login'.
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    ra65bf3a r9b94eb6  
    22=========================== 
    33 
     4- Fix setting task name according to auth state 
    45- Password: fix vpopmaild driver (#1486478) 
    56- Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] (#1486474) 
  • index.php

    r10eedbe r9b94eb6  
    8181 
    8282// try to log in 
    83 if ($RCMAIL->action=='login' && $RCMAIL->task=='mail') { 
     83if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { 
    8484  // purge the session in case of new login when a session already exists  
    8585  $RCMAIL->kill_session(); 
     
    118118      parse_str($url, $query); 
    119119 
     120    $RCMAIL->set_task('mail'); 
     121 
    120122    // allow plugins to control the redirect url after login success 
    121123    $redir = $RCMAIL->plugins->exec_hook('login_after', $query + array('task' => $RCMAIL->task)); 
     
    133135 
    134136// end session 
    135 else if ($RCMAIL->task=='logout' && isset($_SESSION['user_id'])) { 
     137else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id'])) { 
    136138  $userdata = array('user' => $_SESSION['username'], 'host' => $_SESSION['imap_host'], 'lang' => $RCMAIL->user->language); 
    137139  $OUTPUT->show_message('loggedout'); 
     
    142144 
    143145// check session and auth cookie 
    144 else if ($RCMAIL->action != 'login' && $_SESSION['user_id'] && $RCMAIL->action != 'send') { 
     146else if ($RCMAIL->task != 'login' && $_SESSION['user_id'] && $RCMAIL->action != 'send') { 
    145147  if (!$RCMAIL->authenticate_session()) { 
    146148    $OUTPUT->show_message('sessionerror', 'error'); 
     
    169171  if ($OUTPUT->ajax_call) 
    170172    $OUTPUT->redirect(array(), 2000); 
    171    
     173 
    172174  if (!empty($_REQUEST['_framed'])) 
    173175    $OUTPUT->command('redirect', '?'); 
  • plugins/archive/archive.php

    r6a7d063 r9b94eb6  
    1717  { 
    1818    $rcmail = rcmail::get_instance(); 
    19  
    20     if (!$rcmail->user->ID) 
    21       return; 
    2219 
    2320    $this->register_action('plugin.archive', array($this, 'request_action')); 
  • plugins/autologon/autologon.php

    rcc97ea0 r9b94eb6  
    77class autologon extends rcube_plugin 
    88{ 
     9  public $task = 'login'; 
    910 
    1011  function init() 
     
    1920 
    2021    // change action to login 
    21     if ($args['task'] == 'mail' && empty($args['action']) && empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost()) 
     22    if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost()) 
    2223      $args['action'] = 'login'; 
    2324 
  • plugins/help/help.php

    r6a7d063 r9b94eb6  
    1313class help extends rcube_plugin 
    1414{ 
     15    // all task excluding 'login' and 'logout' 
     16    public $task = '?(?!login|logout).*'; 
     17 
    1518    function init() 
    1619    { 
    1720      $rcmail = rcmail::get_instance(); 
    1821       
    19       if (!$rcmail->user->ID) 
    20         return; 
    21  
    2222      $this->add_texts('localization/', false); 
    2323       
  • plugins/http_authentication/http_authentication.php

    rcc97ea0 r9b94eb6  
    1111class http_authentication extends rcube_plugin 
    1212{ 
     13  public $task = 'login'; 
    1314 
    1415  function init() 
     
    2122  { 
    2223    // change action to login 
    23     if ($args['task'] == 'mail' && empty($args['action']) && empty($_SESSION['user_id']) 
     24    if (empty($args['action']) && empty($_SESSION['user_id']) 
    2425        && !empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) 
    2526      $args['action'] = 'login'; 
  • plugins/markasjunk/markasjunk.php

    r6a7d063 r9b94eb6  
    1717  { 
    1818    $rcmail = rcmail::get_instance(); 
    19  
    20     if (!$rcmail->user->ID) 
    21       return; 
    2219 
    2320    $this->register_action('plugin.markasjunk', array($this, 'request_action')); 
  • plugins/new_user_identity/new_user_identity.php

    r4d54cfe r9b94eb6  
    2323class new_user_identity extends rcube_plugin 
    2424{ 
     25    public $task = 'login'; 
     26 
    2527    function init() 
    2628    { 
  • plugins/squirrelmail_usercopy/squirrelmail_usercopy.php

    r5edb5b6 r9b94eb6  
    1111class squirrelmail_usercopy extends rcube_plugin 
    1212{ 
     13        public $task = 'login|settings'; 
     14 
    1315        private $prefs = null; 
    1416        private $abook = array(); 
  • program/include/rcmail.php

    r2b35c5d r9b94eb6  
    4040  public $output; 
    4141  public $plugins; 
    42   public $task = 'mail'; 
     42  public $task; 
    4343  public $action = ''; 
    4444  public $comm_path = './'; 
     
    9292    } 
    9393 
    94     // set task and action properties 
    95     $this->set_task(get_input_value('_task', RCUBE_INPUT_GPC)); 
    96     $this->action = asciiwords(get_input_value('_action', RCUBE_INPUT_GPC)); 
    97  
    9894    // connect to database 
    9995    $GLOBALS['DB'] = $this->get_dbh(); 
     
    124120    $this->set_user(new rcube_user($_SESSION['user_id'])); 
    125121 
     122    // set task and action properties 
     123    $this->set_task(get_input_value('_task', RCUBE_INPUT_GPC)); 
     124    $this->action = asciiwords(get_input_value('_action', RCUBE_INPUT_GPC)); 
     125 
    126126    // reset some session parameters when changing task 
    127127    if ($_SESSION['task'] != $this->task) 
     
    132132 
    133133    // create IMAP object 
    134     if ($this->task == 'mail') 
     134    if ($this->task == 'login') 
    135135      $this->imap_init(); 
    136136       
     
    148148  { 
    149149    $task = asciiwords($task); 
    150     $this->task = $task ? $task : 'mail'; 
     150 
     151    if ($this->user && $this->user->ID) 
     152      $task = !$task || $task == 'login' ? 'mail' : $task; 
     153    else 
     154      $task = 'login'; 
     155 
     156    $this->task = $task; 
    151157    $this->comm_path = $this->url(array('task' => $this->task)); 
    152158     
  • program/include/rcube_plugin_api.php

    r10eedbe r9b94eb6  
    9191          $plugin = new $plugin_name($this); 
    9292          // check inheritance and task specification 
    93           if (is_subclass_of($plugin, 'rcube_plugin') && (!$plugin->task || preg_match('/('.$plugin->task.')/i', $rcmail->task))) { 
     93          if (is_subclass_of($plugin, 'rcube_plugin') && (!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task))) { 
    9494            $plugin->init(); 
    9595            $this->plugins[] = $plugin; 
  • program/steps/mail/func.inc

    rad18d63 r9b94eb6  
    2525$NOIMAP_ACTIONS = array('spell', 'addcontact', 'autocomplete', 'upload', 'display-attachment', 'remove-attachment'); 
    2626 
     27// Init IMAP object 
     28$RCMAIL->imap_init(); 
    2729 
    2830// log in to imap server 
Note: See TracChangeset for help on using the changeset viewer.