Ignore:
Timestamp:
Oct 19, 2006, 11:53:18 PM (18 years ago)
Author:
rvelices
Message:

put back the redirect function as it was in branch 1.6 (still not working perfectly with the auto_login)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r1527 r1567  
    459459    $status = 'normal';
    460460  }
    461  
     461
    462462  $insert =
    463463    array(
     
    523523  global $user, $conf;
    524524
    525   $directories =
    526     array(
    527       PHPWG_ROOT_PATH.'language/'.$user['language'],
    528       PHPWG_ROOT_PATH.'language/'.$conf['default_language'],
    529       PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE
    530       );
     525  $directories = array();
     526  if ( isset($user['language']) )
     527  {
     528    $directories[] = PHPWG_ROOT_PATH.'language/'.$user['language'];
     529  }
     530  $directories[] = PHPWG_ROOT_PATH.'language/'.$conf['default_language'];
     531  $directories[] = PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE;
    531532
    532533  foreach ($directories as $directory)
     
    557558    // search for an existing auto_login_key
    558559    $query = '
    559 SELECT auto_login_key 
     560SELECT auto_login_key
    560561  FROM '.USERS_TABLE.'
    561562  WHERE '.$conf['user_fields']['id'].' = '.$user_id.'
    562563;';
    563  
     564
    564565    $auto_login_key = current(mysql_fetch_assoc(pwg_query($query)));
    565     if (empty($auto_login_key)) 
     566    if (empty($auto_login_key))
    566567    {
    567568      $auto_login_key = base64_encode(md5(uniqid(rand(), true)));
     
    575576    $cookie = array('id' => $user_id, 'key' => $auto_login_key);
    576577    setcookie($conf['remember_me_name'],
    577               serialize($cookie), 
     578              serialize($cookie),
    578579              time()+$conf['remember_me_length'],
    579580              cookie_path()
     
    591592 * @return void
    592593*/
    593 function auto_login() { 
     594function auto_login() {
    594595  global $conf;
    595596
     
    613614    setcookie($conf['remember_me_name'], '', 0, cookie_path());
    614615    redirect(make_index_url());
    615   } 
     616  }
    616617}
    617618
Note: See TracChangeset for help on using the changeset viewer.