aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--install.php15
-rw-r--r--install/hosting.php59
-rw-r--r--install/php5_apache_configuration.php170
3 files changed, 237 insertions, 7 deletions
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 @@
+<?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',
+);
+?> \ 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 @@
+<?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();
+?> \ No newline at end of file