From 7f8cbea1ec8a13567fa7541fbcbb096368bb8691 Mon Sep 17 00:00:00 2001 From: patdenice Date: Mon, 16 Mar 2009 16:57:10 +0000 Subject: [PATCH] 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 --- admin/template/goto/upgrade.tpl | 1 + include/common.inc.php | 1 + include/functions.inc.php | 1 - install.php | 15 +-- install/hosting.php | 59 +++++++++ install/php5_apache_configuration.php | 170 ++++++++++++++++++++++++++ language/de_DE/install.lang.php | 10 ++ language/en_UK/install.lang.php | 10 ++ language/es_ES/install.lang.php | 10 ++ language/fr_FR/install.lang.php | 10 ++ language/it_IT/install.lang.php | 10 ++ language/nl_NL/install.lang.php | 10 ++ language/pl_PL/install.lang.php | 10 ++ language/pl_PL/iso.txt | 2 +- upgrade.php | 28 +++-- 15 files changed, 331 insertions(+), 16 deletions(-) create mode 100644 install/hosting.php create mode 100644 install/php5_apache_configuration.php diff --git a/admin/template/goto/upgrade.tpl b/admin/template/goto/upgrade.tpl index 00cc297cf..4b5b2118a 100644 --- a/admin/template/goto/upgrade.tpl +++ b/admin/template/goto/upgrade.tpl @@ -112,6 +112,7 @@ textarea { margin-left: 20px; } {/if} {* content *} +
{$L_UPGRADE_HELP}
{* the_page *} diff --git a/include/common.inc.php b/include/common.inc.php index 1ca54e1bb..2cd761f9c 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -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 ); diff --git a/include/functions.inc.php b/include/functions.inc.php index 584933786..cccd0ed80 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -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 diff --git a/install.php b/install.php index 0836d6cf1..8bd91f5c2 100644 --- a/install.php +++ b/install.php @@ -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; @@ -430,4 +431,4 @@ if (count($infos) != 0 ) //----------------------------------------------------------- html code display $template->pparse('install'); -?> +?> \ No newline at end of file diff --git a/install/hosting.php b/install/hosting.php new file mode 100644 index 000000000..a46f71630 --- /dev/null +++ b/install/hosting.php @@ -0,0 +1,59 @@ + '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', +); +?> \ No newline at end of file diff --git a/install/php5_apache_configuration.php b/install/php5_apache_configuration.php new file mode 100644 index 000000000..d41542d83 --- /dev/null +++ b/install/php5_apache_configuration.php @@ -0,0 +1,170 @@ +=')) +{ + 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 ' + + + + + + + + + + +'.$title.' + + + +
+
+
+
+ +

'.$title.'

'; +} + +function closePage() +{ + echo ' +
+
'.sprintf(l10n('install_help'), PHPWG_URL.'/forum').'
+
+ +'; +} + +if (isset($_GET['setphp5'])) +{ + // Try to configure php5 + if (initPHP5()) + { + header('Location: '.$script.'.php?language='.$language); + } + else + { + openPage(); + echo ' +

'.l10n('Sorry!').'

+

+'.l10n('Piwigo was not able to configure PHP 5.').'
+'.l10n("You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself.").'
+'.l10n('Hope to see you back soon.').' +

'; + closePage(); + } +} +else +{ + openPage(); + echo ' + + + + + +
'.l10n('language').' + +
+ +

'.l10n('PHP 5 is required').'

+

+'.sprintf(l10n('It appears your webhost is currently running PHP %s.'), PHP_VERSION).'
+'.l10n('Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.').'
+'.l10n('Note you can change your configuration by yourself and restart Piwigo after that.').'
+

+


+ +

'; + closePage(); +} + +exit(); +?> \ No newline at end of file diff --git a/language/de_DE/install.lang.php b/language/de_DE/install.lang.php index 4410a0fac..a3d2cd6f2 100644 --- a/language/de_DE/install.lang.php +++ b/language/de_DE/install.lang.php @@ -61,4 +61,14 @@ $lang['install_end_message'] = 'Die Konfiguration der Piwigo abgeschlossen ist, * diesem Login ermö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.'; ?> \ No newline at end of file diff --git a/language/en_UK/install.lang.php b/language/en_UK/install.lang.php index 07d64d4ad..a921e0c76 100644 --- a/language/en_UK/install.lang.php +++ b/language/en_UK/install.lang.php @@ -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.'; ?> \ No newline at end of file diff --git a/language/es_ES/install.lang.php b/language/es_ES/install.lang.php index 9bdbb5e0b..8a9335716 100644 --- a/language/es_ES/install.lang.php +++ b/language/es_ES/install.lang.php @@ -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...'; ?> \ No newline at end of file diff --git a/language/fr_FR/install.lang.php b/language/fr_FR/install.lang.php index 184c77460..6a593ab32 100644 --- a/language/fr_FR/install.lang.php +++ b/language/fr_FR/install.lang.php @@ -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...'; ?> \ No newline at end of file diff --git a/language/it_IT/install.lang.php b/language/it_IT/install.lang.php index 984581576..7c524c3aa 100644 --- a/language/it_IT/install.lang.php +++ b/language/it_IT/install.lang.php @@ -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 ...'; ?> \ No newline at end of file diff --git a/language/nl_NL/install.lang.php b/language/nl_NL/install.lang.php index 22bdedbeb..e8399e473 100644 --- a/language/nl_NL/install.lang.php +++ b/language/nl_NL/install.lang.php @@ -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.'; ?> \ No newline at end of file diff --git a/language/pl_PL/install.lang.php b/language/pl_PL/install.lang.php index 399e827a6..37ada6308 100644 --- a/language/pl_PL/install.lang.php +++ b/language/pl_PL/install.lang.php @@ -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.'; ?> \ No newline at end of file diff --git a/language/pl_PL/iso.txt b/language/pl_PL/iso.txt index b0d1dc445..b8871defc 100644 --- a/language/pl_PL/iso.txt +++ b/language/pl_PL/iso.txt @@ -1 +1 @@ -Polski [PL] +Polski [PL] \ No newline at end of file diff --git a/upgrade.php b/upgrade.php index daee09113..5dc698f3c 100644 --- a/upgrade.php +++ b/upgrade.php @@ -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 |