From 7f8cbea1ec8a13567fa7541fbcbb096368bb8691 Mon Sep 17 00:00:00 2001 From: patdenice Date: Mon, 16 Mar 2009 16:57:10 +0000 Subject: 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 --- install/php5_apache_configuration.php | 170 ++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 install/php5_apache_configuration.php (limited to 'install/php5_apache_configuration.php') 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 -- cgit v1.2.3