Ignore:
Timestamp:
Nov 6, 2008, 3:44:51 PM (15 years ago)
Author:
patdenice
Message:
  • Webmaster or administrator can login to run upgrade.
  • Inserting upgrade line in mysql.inc.php still work.
  • Convert espagnol upgrade file to utf8.
  • Minor changes in upgrade processus.
  • Remove all comments in pclzip.lib.php.
File:
1 edited

Legend:

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

    r2819 r2836  
    2424function check_upgrade()
    2525{
    26   // Is Piwigo already installed ?
    27   if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
     26  if (defined('PHPWG_IN_UPGRADE'))
    2827  {
    29     $message = 'Piwigo is not in upgrade mode. In include/mysql.inc.php,
    30 insert line
    31 <pre style="background-color:lightgray">
    32 define(\'PHPWG_IN_UPGRADE\', true);
    33 </pre>
    34 if you want to upgrade';
    35     die($message);
     28    return PHPWG_IN_UPGRADE;
    3629  }
     30  return false;
    3731}
    3832
     
    138132}
    139133
     134// Check access rights
     135function check_upgrade_access_rights($current_release, $username, $password)
     136{
     137  global $conf, $page;
     138
     139  if (version_compare($current_release, '1.5.0', '<'))
     140  {
     141    $query = '
     142SELECT password, status
     143FROM '.PREFIX_TABLE.'users
     144WHERE username = "'.$username.'"
     145;';
     146  }
     147  else
     148  {
     149    $query = '
     150SELECT u.password, ui.status
     151FROM '.$conf['users_table'].' AS u
     152INNER JOIN '.PREFIX_TABLE.'user_infos AS ui
     153ON u.id = ui.user_id
     154WHERE '.$conf['user_fields']['username'].'="'.$username.'"
     155;';
     156  }
     157  $row = mysql_fetch_assoc(mysql_query($query));
     158
     159  if (!isset($conf['pass_convert']))
     160  {
     161    $conf['pass_convert'] = create_function('$s', 'return md5($s);');
     162  }
     163
     164  if ($row['password'] != $conf['pass_convert']($_POST['password']))
     165  {
     166    array_push($page['errors'], l10n('invalid_pwd'));
     167  }
     168  elseif ($row['status'] != 'admin' and $row['status'] != 'webmaster')
     169  {
     170    array_push($page['errors'], l10n('You do not have access rights to run upgrade'));
     171  }
     172  else
     173  {
     174    define('PHPWG_IN_UPGRADE', true);
     175  }
     176}
    140177?>
Note: See TracChangeset for help on using the changeset viewer.