diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-02-01 00:01:36 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-02-02 17:34:31 +0000 |
| commit | a25f0a04682c4c39c1947220c90af4118c713952 (patch) | |
| tree | f7e9c2c630a50dd3e5dd76ce501dff4b1d8d4c26 /site-unavailable.php | |
| parent | 4d2a5476ceb1c11dc1fd146bfb0be077baa5fb01 (diff) | |
| download | webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.gz webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.bz2 webtrees-a25f0a04682c4c39c1947220c90af4118c713952.zip | |
Refactor classes to use namespaces, as per PSR-4. Replace GPL2 with GPL3.
Diffstat (limited to 'site-unavailable.php')
| -rw-r--r-- | site-unavailable.php | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/site-unavailable.php b/site-unavailable.php index 82486e63e7..f1b21eec33 100644 --- a/site-unavailable.php +++ b/site-unavailable.php @@ -1,22 +1,23 @@ <?php -// Site Unavailable -// -// webtrees: Web based Family History software -// Copyright (C) 2014 webtrees development team. -// -// 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; either version 2 of the License, or -// (at your option) any later version. -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +namespace Webtrees; + +/** + * webtrees: online genealogy + * Copyright (C) 2015 webtrees development team + * 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, either version 3 of the License, or + * (at your option) any later version. + * 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, see <http://www.gnu.org/licenses/>. + */ + +use PDO; +use PDOException; define('WT_SCRIPT_NAME', 'site-unavailable.php'); @@ -24,7 +25,7 @@ define('WT_SCRIPT_NAME', 'site-unavailable.php'); if (version_compare(PHP_VERSION, '5.4', '<')) { require WT_ROOT . 'includes/php_53_compatibility.php'; } -require 'library/autoload.php'; +require 'vendor/autoload.php'; // This script does not load session.php. // session.php won’t run until a configuration file and database connection exist... @@ -34,21 +35,21 @@ define('WT_ROOT', ''); define('WT_GED_ID', 0); define('WT_DATA_DIR', realpath('data') . DIRECTORY_SEPARATOR); -$WT_SESSION = new stdClass; +$WT_SESSION = new \stdClass; $WT_SESSION->locale = ''; require 'includes/functions/functions.php'; -define('WT_LOCALE', WT_I18N::init()); +define('WT_LOCALE', I18N::init()); http_response_code(503); header('Content-Type: text/html; charset=UTF-8'); // The page which redirected here may have provided an error message. $messages = ''; -foreach (WT_FlashMessages::getMessages() as $message) { +foreach (FlashMessages::getMessages() as $message) { $messages .= - '<blockquote>' . WT_Filter::escapeHtml($message->text) . '</blockquote>'; + '<blockquote>' . Filter::escapeHtml($message->text) . '</blockquote>'; } // If we can't connect to the database at all, give the reason why @@ -57,14 +58,14 @@ if (is_array($config_ini_php) && array_key_exists('dbhost', $config_ini_php) && try { $dbh = new PDO('mysql:host=' . $config_ini_php['dbhost'] . ';port=' . $config_ini_php['dbport'] . ';dbname=' . $config_ini_php['dbname'], $config_ini_php['dbuser'], $config_ini_php['dbpass'], array(PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE=>PDO::FETCH_OBJ, PDO::ATTR_CASE=>PDO::CASE_LOWER, PDO::ATTR_AUTOCOMMIT=>true)); } catch (PDOException $ex) { - $messages .= '<p>' . WT_I18N::translate('The database reported the following error message:') . '</p>'; + $messages .= '<p>' . I18N::translate('The database reported the following error message:') . '</p>'; $messages .= '<blockquote>' . $ex->getMessage() . '</blockquote>'; } } ?> <!DOCTYPE html> -<html <?php echo WT_I18N::html_markup(); ?>> +<html <?php echo I18N::html_markup(); ?>> <head> <meta charset="UTF-8"> <title><?php echo WT_WEBTREES; ?></title> @@ -82,26 +83,26 @@ if (is_array($config_ini_php) && array_key_exists('dbhost', $config_ini_php) && </style> </head> <body> - <h1><?php echo WT_I18N::translate('This website is temporarily unavailable'); ?></h1> + <h1><?php echo I18N::translate('This website is temporarily unavailable'); ?></h1> <div class="content"> <p> - <?php echo WT_I18N::translate('Oops! The webserver is unable to connect to the database server. It could be busy, undergoing maintenance, or simply broken. You should <a href="index.php">try again</a> in a few minutes or contact the website administrator.'); ?> + <?php echo I18N::translate('Oops! The webserver is unable to connect to the database server. It could be busy, undergoing maintenance, or simply broken. You should <a href="index.php">try again</a> in a few minutes or contact the website administrator.'); ?> </p> <?php echo $messages; ?> - <?php echo WT_I18N::translate('If you are the website administrator, you should check that:'); ?> + <?php echo I18N::translate('If you are the website administrator, you should check that:'); ?> <ol> <li> - <?php echo /* I18N: [you should check that:] ... */ WT_I18N::translate('the database connection settings in the file “/data/config.ini.php” are still correct'); ?> + <?php echo /* I18N: [you should check that:] ... */ I18N::translate('the database connection settings in the file “/data/config.ini.php” are still correct'); ?> </li> <li> - <?php echo /* I18N: [you should check that:] ... */ WT_I18N::translate('the folder “/data” and the file “/data/config.ini.php” have access permissions that allow the webserver to read them'); ?> + <?php echo /* I18N: [you should check that:] ... */ I18N::translate('the folder “/data” and the file “/data/config.ini.php” have access permissions that allow the webserver to read them'); ?> </li> <li> - <?php echo /* I18N: [you should check that:] ... */ WT_I18N::translate('you can connect to the database using other applications, such as phpmyadmin'); ?> + <?php echo /* I18N: [you should check that:] ... */ I18N::translate('you can connect to the database using other applications, such as phpmyadmin'); ?> </li> </ol> <p class="good"> - <?php echo WT_I18N::translate('If you cannot resolve the problem yourself, you can ask for help on the forums at <a href="http://webtrees.net">webtrees.net</a>'); ?> + <?php echo I18N::translate('If you cannot resolve the problem yourself, you can ask for help on the forums at <a href="http://webtrees.net">webtrees.net</a>'); ?> </p> </div> </body> |
