Changeset 2836 for trunk/admin/include/functions_upgrade.php
- Timestamp:
- Nov 6, 2008, 3:44:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions_upgrade.php
r2819 r2836 24 24 function check_upgrade() 25 25 { 26 // Is Piwigo already installed ? 27 if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE) 26 if (defined('PHPWG_IN_UPGRADE')) 28 27 { 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; 36 29 } 30 return false; 37 31 } 38 32 … … 138 132 } 139 133 134 // Check access rights 135 function 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 = ' 142 SELECT password, status 143 FROM '.PREFIX_TABLE.'users 144 WHERE username = "'.$username.'" 145 ;'; 146 } 147 else 148 { 149 $query = ' 150 SELECT u.password, ui.status 151 FROM '.$conf['users_table'].' AS u 152 INNER JOIN '.PREFIX_TABLE.'user_infos AS ui 153 ON u.id = ui.user_id 154 WHERE '.$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 } 140 177 ?>
Note: See TracChangeset
for help on using the changeset viewer.