Move template class inclusion to common.inc.php.

Add forum link in upgrade page.
Install and upgrade try to configure PHP5.

git-svn-id: http://piwigo.org/svn/trunk@3203 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2009-03-16 16:57:10 +00:00
parent 11feae676a
commit 7f8cbea1ec
15 changed files with 331 additions and 16 deletions

View file

@ -112,6 +112,7 @@ textarea { margin-left: 20px; }
{/if}
</div> {* content *}
<div>{$L_UPGRADE_HELP}</div>
</div> {* the_page *}
</body>
</html>

View file

@ -101,6 +101,7 @@ if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors']))
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
include( PHPWG_ROOT_PATH .'include/template.class.php');
// Database connection
@mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or my_error( 'mysql_connect', true );

View file

@ -30,7 +30,6 @@ include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/template.class.php');
//----------------------------------------------------------- generic functions

View file

@ -21,12 +21,6 @@
// | USA. |
// +-----------------------------------------------------------------------+
//------------------------------------------------- check php version
if (version_compare(PHP_VERSION, '5', '<'))
{
die('Piwigo requires PHP 5 or above.');
}
//----------------------------------------------------------- include
define('PHPWG_ROOT_PATH','./');
@ -223,7 +217,14 @@ load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=
load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
//------------------------------------------------- check php version
if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<'))
{
include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php');
}
//----------------------------------------------------- template initialization
include( PHPWG_ROOT_PATH .'include/template.class.php');
$template=new Template(PHPWG_ROOT_PATH.'admin/template/goto', 'roma');
$template->set_filenames( array('install'=>'install.tpl') );
$step = 1;

59
install/hosting.php Normal file
View file

@ -0,0 +1,59 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based picture gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
/* PHP5 configuration for known servers */
$hosting = array(
//1and1
'kundenserver.de' => 'AddType x-mapp-php5 .php',
//Apinc
'apinc.org' => 'AddHandler x-httpd-php5 .php',
//Free
'free.fr' => 'php 1',
//Lost Oasis
'lost-oasis.net' => 'PHP_Version 5.0',
'lo-data.net' => 'PHP_Version 5.0',
//MediaTemple
'gridserver.com' => 'AddHandler php5-script .php',
//Online
'online.net' => 'AddType application/x-httpd-php5 .php',
//Ouvaton
'web.ocsa-data.net' => 'AddHandler application/x-suexec-php5 .php',
//OVH
'ovh.net' => 'SetEnv PHP_VER 5',
//Strato
'rzone.de' => 'AddType application/x-httpd-php5 .php',
//Web1.fr - NFrance
'nfrance.com' => 'AddHandler php-fastcgi5 .php',
);
?>

View file

@ -0,0 +1,170 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based picture gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}
$script = script_basename();
if (($script != 'install' and $script != 'upgrade')
or version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '>='))
{
die('Nothing to do here...');
}
function initPHP5()
{
include(PHPWG_ROOT_PATH.'install/hosting.php');
$htaccess = PHPWG_ROOT_PATH.'.htaccess';
if ((file_exists($htaccess) and (!is_readable($htaccess) or !is_writable($htaccess)))
or !($my_hostname = @gethostbyaddr($_SERVER['SERVER_ADDR'])))
{
return false;
}
foreach ($hosting as $hostname => $rule)
{
if (preg_match('!'.preg_quote($hostname).'$!',$my_hostname))
{
if (false !== ($fh = @fopen($htaccess,"ab")))
{
fwrite($fh,"\n".$rule);
fclose($fh);
return true;
}
}
}
return false;
}
function openPage()
{
global $script;
$title = 'Piwigo '.PHPWG_VERSION.' - '.l10n(ucwords($script));
header('Content-Type: text/html; charset=UTF-8');
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-script-type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="shortcut icon" type="image/x-icon" href="template-common/favicon.ico">
<link rel="stylesheet" type="text/css" href="admin/template/goto/layout.css">
<link rel="stylesheet" type="text/css" href="admin/template/goto/default-colors.css">
<link rel="stylesheet" type="text/css" href="admin/template/goto/theme/roma/theme.css">
<style type="text/css">
.content {
width: 800px;
min-height: 0px !important;
margin: auto;
padding: 25px;
text-align: left;
}
table { margin: 0 0 15px 0; }
td { padding: 3px 10px; }
h1 { text-align: left; }
</style>
<title>'.$title.'</title>
</head>
<body>
<div id="headbranch"></div>
<div id="the_page">
<div id="theHeader"></div>
<div id="content" class="content">
<h2>'.$title.'</h2>';
}
function closePage()
{
echo '
</div>
<div style="text-align: center">'.sprintf(l10n('install_help'), PHPWG_URL.'/forum').'</div>
</div>
</body>
</html>';
}
if (isset($_GET['setphp5']))
{
// Try to configure php5
if (initPHP5())
{
header('Location: '.$script.'.php?language='.$language);
}
else
{
openPage();
echo '
<h1>'.l10n('Sorry!').'</h1>
<p>
'.l10n('Piwigo was not able to configure PHP 5.').'<br>
'.l10n("You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself.").'<br>
'.l10n('Hope to see you back soon.').'
</p>';
closePage();
}
}
else
{
openPage();
echo '
<table>
<tr>
<td>'.l10n('language').'</td>
<td>
<select name="language" onchange="document.location = \''.$script.'.php?language=\'+this.options[this.selectedIndex].value;">';
foreach (get_languages('utf-8') as $code => $name)
{
echo '
<option label="'.$name.'" value="'.$code.'" '.($code == $language ? 'selected="selected"' : '') .'>'.$name.'</option>';
}
echo '
</select>
</td>
</tr>
</table>
<h1>'.l10n('PHP 5 is required').'</h1>
<p>
'.sprintf(l10n('It appears your webhost is currently running PHP %s.'), PHP_VERSION).'<br>
'.l10n('Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.').'<br>
'.l10n('Note you can change your configuration by yourself and restart Piwigo after that.').'<br>
</p>
<p style="text-align: center;"><br>
<input type="button" value="'.l10n('Try to configure PHP 5').'" onClick="document.location = \''.$script.'.php?language='.$language.'&amp;setphp5=\';">
</p>';
closePage();
}
exit();
?>

View file

@ -61,4 +61,14 @@ $lang['install_end_message'] = 'Die Konfiguration der Piwigo abgeschlossen ist,
* diesem Login erm&ouml;glicht Ihnen den Zugang zu den Verwaltungs-Panel und der Bilder- und Benutzerverwaltung.';
$lang['conf_mail_webmaster'] = 'Webmaster Mail-Adresse';
$lang['conf_mail_webmaster_info'] = 'Kontakt E-Mailadresse (nur für angemeldete Benutzer sichtbar)';
$lang['PHP 5 is required'] = 'PHP 5 ist erforderlich';
$lang['It appears your webhost is currently running PHP %s.'] = 'Es scheint Ihr Webhost ist derzeit laufenden PHP %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo wird versuchen um Ihre Konfiguration zu PHP 5 Schalten durch die Schaffung oder Änderung einer .Htaccess-Datei.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Hinweis: Sie können Ihre Konfiguration indem manuel Schalten und starten Sie wieder dass Piwigo.';
$lang['Try to configure PHP 5'] = 'Versuch zu konfigurieren PHP 5';
$lang['Sorry!'] = 'Bekümmert!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo kan nicht PHP 5 zu konfigurieren.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = "Sie können sich beziehen auf Ihrem Hosting-Anbieter die Unterstützung und sehen wie Sie könnte Umstellung auf PHP 5 von Ihnen.";
$lang['Hope to see you back soon.'] = 'Hoffen, Sie bald wieder zurück.';
?>

View file

@ -63,4 +63,14 @@ $lang['install_end_message'] = 'The configuration of Piwigo is finished, here is
* this login will enable you to access to the administration panel and to the instructions in order to place pictures in your directories';
$lang['conf_mail_webmaster'] = 'Webmaster mail address';
$lang['conf_mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail';
$lang['PHP 5 is required'] = 'PHP 5 is required';
$lang['It appears your webhost is currently running PHP %s.'] = 'It appears your webhost is currently running PHP %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Note you can change your configuration by yourself and restart Piwigo after that.';
$lang['Try to configure PHP 5'] = 'Try to configure PHP 5';
$lang['Sorry!'] = 'Sorry!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo was not able to configure PHP 5.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = "You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself.";
$lang['Hope to see you back soon.'] = 'Hope to see you back soon.';
?>

View file

@ -61,4 +61,14 @@ $lang['install_end_message'] = 'La configuración de la aplicación correctament
* Éste le permite acceder a la parte administración y a las instrucciones para colocar las imágenes en los repertorios.';
$lang['conf_mail_webmaster'] = 'Dirige e-mail del Administrador';
$lang['conf_mail_webmaster_info'] = 'Los visitadores podrán ponerse en contacto con usted por este mail';
$lang['PHP 5 is required'] = 'PHP 5 es requerido';
$lang['It appears your webhost is currently running PHP %s.'] = 'Aparentemente, la versión PHP de su hébergeur es PHP %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo va a tratar de pasar en PHP 5 creando o modificando el fichero .htaccess.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Anote que usted mismo puede cambiar la configuración PHP y volver a lanzar a Piwigo después.';
$lang['Try to configure PHP 5'] = 'Tratar de configurar PHP 5';
$lang['Sorry!'] = 'Desolado!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo no pudo configurar PHP 5.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = 'Usted debe ponerse en contacto con su hébergeur con el fin de saber cómo configurar PHP 5';
$lang['Hope to see you back soon.'] = 'Esperando verle de revisarle muy pronto...';
?>

View file

@ -61,4 +61,14 @@ $lang['install_end_message'] = 'La configuration de l\'application s\'est correc
* celui-ci vous permet d\'accéder à la partie administration et aux instructions pour placer les images dans les répertoires.';
$lang['conf_mail_webmaster'] = 'Adresse e-mail de l\'Administrateur';
$lang['conf_mail_webmaster_info'] = 'Les visiteurs pourront vous contacter par ce mail';
$lang['PHP 5 is required'] = 'PHP 5 est requis';
$lang['It appears your webhost is currently running PHP %s.'] = 'Apparemment, la version PHP de votre hébergeur est PHP %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo va essayer de passer en PHP 5 en créant ou en modifiant le fichier .htaccess.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Notez que vous pouvez changer vous-même la configuration PHP et re-lancer Piwigo après.';
$lang['Try to configure PHP 5'] = 'Essayer de configurer PHP 5';
$lang['Sorry!'] = 'Désolé!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo n\'a pas pu configurer PHP 5.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = 'Vous devez contacter votre hébergeur afin de savoir comment configurer PHP 5.';
$lang['Hope to see you back soon.'] = 'En espérant vous revoir très prochainement...';
?>

View file

@ -61,4 +61,14 @@ $lang['install_end_message'] = 'La configurazione di Piwigo è conclusa. Procede
* a questo punto sarete abilitati all\'accesso al pannello di amministrazione in cui troverete le istruzioni per l\'inserimento delle immagini nelle vostre directory';
$lang['conf_mail_webmaster'] = 'Indirizzo email del Amministratore';
$lang['conf_mail_webmaster_info'] = 'i visitatori potranno contattarvi utilizzando questo indirizzo email';
$lang['PHP 5 is required'] = 'È necessario PHP 5';
$lang['It appears your webhost is currently running PHP %s.'] = 'Sembrerebbe che la versione del vostro server è PHP %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo cerchrà di passare in PHP 5 creando o modificando il file .htaccess.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Notate che potete cambiare manualmente la configurazione e rilanciare Piwigo.';
$lang['Try to configure PHP 5'] = 'Provate a configuratre PHP 5';
$lang['Sorry!'] = 'Spiacente!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo non a potuto configurare PHP 5.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = 'Dovete contattare il votro provider per chiedere come configurare PHP 5.';
$lang['Hope to see you back soon.'] = 'Sperando di rivedervi prossimamente ...';
?>

View file

@ -63,4 +63,14 @@ $lang['install_end_message'] = 'Het installeren van Piwigo is klaar, de volgende
* Deze gebruikersnaam geeft u toegang tot de beheermenu zodat u afbeeldingen op uw website kan plaatsen';
$lang['conf_mail_webmaster'] = 'Webmaster email adres';
$lang['conf_mail_webmaster_info'] = 'Het is mogelijk dat bezoekers contact opnemen met de beheerder middels e-mail';
/* TODO */$lang['PHP 5 is required'] = 'PHP 5 is required';
/* TODO */$lang['It appears your webhost is currently running PHP %s.'] = 'It appears your webhost is currently running PHP %s.';
/* TODO */$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.';
/* TODO */$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Note you can change your configuration by yourself and restart Piwigo after that.';
/* TODO */$lang['Try to configure PHP 5'] = 'Try to configure PHP 5';
/* TODO */$lang['Sorry!'] = 'Sorry!';
/* TODO */$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo was not able to configure PHP 5.';
/* TODO */$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = "You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself.";
/* TODO */$lang['Hope to see you back soon.'] = 'Hope to see you back soon.';
?>

View file

@ -63,4 +63,14 @@ $lang['install_end_message'] = 'Konfiguracja Piwigo została zakończona, nastę
* logowanie to umożliwi Ci dostęp do panelu administracyjnego oraz instrukcji jak umieszczaćzdjęcia w katalogach';
$lang['conf_mail_webmaster'] = 'Adres email Webmaster\'a';
$lang['conf_mail_webmaster_info'] = 'Z jego pomocą odwiedzający będą mogli się skontaktować z administratorem strony';
$lang['PHP 5 is required'] = 'PHP 5 jest wymagane';
$lang['It appears your webhost is currently running PHP %s.'] = 'Twój serwer aktualnie używa PHP w wersji %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo może spróbować przełączyć Twoją konfigurację do PHP 5 poprzez modyfikację pliku .htaccess.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Możesz również zmienić tę konfigurację sam, a następnie uruchomić ponownie Piwigo.';
$lang['Try to configure PHP 5'] = 'Spróbuj skonfigurować PHP 5';
$lang['Sorry!'] = 'Niestety!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo nie mógł skonfigurować Twojego PHP 5.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = "Możesz skontaktować się z działem wsparcia Twojego providera aby dowiedzieć się jak włączyć PHP 5.";
$lang['Hope to see you back soon.'] = 'Do zobaczenia wkrótce.';
?>

View file

@ -21,12 +21,6 @@
// | USA. |
// +-----------------------------------------------------------------------+
//check php version
if (version_compare(PHP_VERSION, '5', '<'))
{
die('Piwigo requires PHP 5 or above.');
}
define('PHPWG_ROOT_PATH', './');
// load config file
@ -167,17 +161,37 @@ else
}
}
if ('fr_FR' == $language) {
define('PHPWG_DOMAIN', 'fr.piwigo.org');
}
else {
define('PHPWG_DOMAIN', 'piwigo.org');
}
define('PHPWG_URL', 'http://'.PHPWG_DOMAIN);
load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
// check php version
if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<'))
{
include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php');
}
// +-----------------------------------------------------------------------+
// | template initialization |
// +-----------------------------------------------------------------------+
include( PHPWG_ROOT_PATH .'include/template.class.php');
$template = new Template(PHPWG_ROOT_PATH.'admin/template/goto', 'roma');
$template->set_filenames(array('upgrade'=>'upgrade.tpl'));
$template->assign('RELEASE', PHPWG_VERSION);
$template->assign(array(
'RELEASE' => PHPWG_VERSION,
'L_UPGRADE_HELP' => sprintf(l10n('install_help'), PHPWG_URL.'/forum'),
)
);
// +-----------------------------------------------------------------------+
// | upgrade choice |