merge -c2836 from trunk to branch 2.0

- 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.

git-svn-id: http://piwigo.org/svn/branches/2.0@2837 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice
2008-11-06 14:46:41 +00:00
parent 894a38a9bf
commit 5f1fe1d4f9
13 changed files with 3551 additions and 5773 deletions
+46 -9
View File
@@ -23,17 +23,11 @@
function check_upgrade()
{
// Is Piwigo already installed ?
if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
if (defined('PHPWG_IN_UPGRADE'))
{
$message = 'Piwigo is not in upgrade mode. In include/mysql.inc.php,
insert line
<pre style="background-color:lightgray">
define(\'PHPWG_IN_UPGRADE\', true);
</pre>
if you want to upgrade';
die($message);
return PHPWG_IN_UPGRADE;
}
return false;
}
// concerning upgrade, we use the default tables
@@ -137,4 +131,47 @@ WHERE id IN ("' . implode('","', $plugins) . '")
}
}
// Check access rights
function check_upgrade_access_rights($current_release, $username, $password)
{
global $conf, $page;
if (version_compare($current_release, '1.5.0', '<'))
{
$query = '
SELECT password, status
FROM '.PREFIX_TABLE.'users
WHERE username = "'.$username.'"
;';
}
else
{
$query = '
SELECT u.password, ui.status
FROM '.$conf['users_table'].' AS u
INNER JOIN '.PREFIX_TABLE.'user_infos AS ui
ON u.id = ui.user_id
WHERE '.$conf['user_fields']['username'].'="'.$username.'"
;';
}
$row = mysql_fetch_assoc(mysql_query($query));
if (!isset($conf['pass_convert']))
{
$conf['pass_convert'] = create_function('$s', 'return md5($s);');
}
if ($row['password'] != $conf['pass_convert']($_POST['password']))
{
array_push($page['errors'], l10n('invalid_pwd'));
}
elseif ($row['status'] != 'admin' and $row['status'] != 'webmaster')
{
array_push($page['errors'], l10n('You do not have access rights to run upgrade'));
}
else
{
define('PHPWG_IN_UPGRADE', true);
}
}
?>
+3333 -5637
View File
File diff suppressed because it is too large Load Diff
+52 -14
View File
@@ -12,17 +12,16 @@
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/template/{$themeconf.template}/theme/{$themeconf.theme}/theme.css">
{literal}
<style type="text/css">
#theHeader { height: 105px; }
.content {
width: 800px;
min-height: 0px !important;
margin: auto;
padding: 25px;
text-align: left;
width: 800px;
min-height: 0px !important;
margin: auto;
padding: 25px;
text-align: left;
}
h2 { width: 770px !important; }
table { margin: 0px; }
td { padding: 3px 10px; }
</style>
{/literal}
<title>Piwigo {$RELEASE} - {'Upgrade'|@translate}</title>
@@ -36,17 +35,56 @@ h2 { width: 770px !important; }
{if isset($introduction)}
<h2>Piwigo {$RELEASE} - {'Upgrade'|@translate}</h2>
<p>{'language'|@translate} &nbsp;
<select name="language" onchange="document.location = 'upgrade.php?language='+this.options[this.selectedIndex].value;">
{html_options options=$language_options selected=$language_selection}
</select>
</p>
{if isset($errors)}
<div class="errors">
<ul>
{foreach from=$errors item=error}
<li>{$error}</li>
{/foreach}
</ul>
</div>
{/if}
<table>
<tr>
<td>{'language'|@translate}</td>
<td>
<select name="language" onchange="document.location = 'upgrade.php?language='+this.options[this.selectedIndex].value;">
{html_options options=$language_options selected=$language_selection}
</select>
</td>
</tr>
</table>
<p>{'introduction message'|@translate|@sprintf:$introduction.CURRENT_RELEASE}</p>
{if isset($login)}
<p>{'upgrade login message'|@translate}</p>
{/if}
<form method="POST" action="{$introduction.F_ACTION}" name="upgrade_form">
{if isset($login)}
<table>
<tr>
<td>{'Username'|@translate}</td>
<td><input type="text" name="username" id="username" size="25" maxlength="40" style="width: 150px;" /></td>
</tr>
<tr>
<td>{'Password'|@translate}</td>
<td><input type="password" name="password" id="password" size="25" maxlength="25" style="width: 150px;" /></td>
</tr>
</table>
{/if}
<p style="text-align: center;">
<a href="{$introduction.RUN_UPGRADE_URL}">{'Upgrade from %s to %s'|@translate|@sprintf:$introduction.CURRENT_RELEASE:$RELEASE}</b>
<input class="submit" type="submit" name="submit" value="{'Upgrade from %s to %s'|@translate|@sprintf:$introduction.CURRENT_RELEASE:$RELEASE}"/>
</p>
</form>
<!--
<p style="text-align: center;">
<a href="{$introduction.RUN_UPGRADE_URL}">{'Upgrade from %s to %s'|@translate|@sprintf:$introduction.CURRENT_RELEASE:$RELEASE}</a>
</p>
-->
{/if}
{if isset($upgrade)}