Ignore:
Timestamp:
May 8, 2010, 1:08:51 AM (14 years ago)
Author:
patdenice
Message:

Upgrade can be launched automaticaly if user is already connected as webmaster.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_upgrade.php

    r5982 r6110  
    113113
    114114// Check access rights
    115 function check_upgrade_access_rights($current_release, $username, $password)
    116 {
    117   global $conf, $page;
     115function check_upgrade_access_rights()
     116{
     117  global $conf, $page, $current_release;
     118
     119  if (version_compare($current_release, '2.0', '>=') and isset($_COOKIE[session_name()]))
     120  {
     121    // Check if user is already connected as webmaster
     122    session_start();
     123    if (!empty($_SESSION['pwg_uid']))
     124    {
     125      $query = '
     126SELECT status
     127  FROM '.USER_INFOS_TABLE.'
     128  WHERE user_id = '.$_SESSION['pwg_uid'].'
     129;';
     130      pwg_query($query);
     131
     132      $row = pwg_db_fetch_assoc(pwg_query($query));
     133      if (isset($row['status']) and $row['status'] == 'webmaster')
     134      {
     135        define('PHPWG_IN_UPGRADE', true);
     136        return;
     137      }
     138    }
     139  }
     140
     141  if (!isset($_POST['username']) or !isset($_POST['password']))
     142  {
     143    return;
     144  }
     145
     146  $username = $_POST['password'];
     147  $password = $_POST['password'];
    118148
    119149  if(!@get_magic_quotes_gpc())
     
    231261  }
    232262}
    233 
    234 /**
    235  *  Get languages defined in the language directory
    236  */ 
    237 function get_fs_languages($target_charset = null)
    238 {
    239   if ( empty($target_charset) )
    240   {
    241     $target_charset = get_pwg_charset();
    242   }
    243   $target_charset = strtolower($target_charset);
    244  
    245   $dir = opendir(PHPWG_ROOT_PATH.'language');
    246  
    247   while ($file = readdir($dir))
    248   {
    249     $path = PHPWG_ROOT_PATH.'language/'.$file;
    250     if (!is_link($path) and is_dir($path) and file_exists($path.'/iso.txt'))
    251     {
    252       list($language_name) = @file($path.'/iso.txt');
    253      
    254       $languages[$file] = convert_charset($language_name, $target_charset);
    255     }
    256   }
    257   closedir($dir);
    258   @asort($languages);
    259  
    260   return $languages;
    261 }
    262 
    263263?>
Note: See TracChangeset for help on using the changeset viewer.