From: Jerome Jutteau Date: Sat, 22 Dec 2012 11:46:58 +0000 (+0100) Subject: Fix php 5.3 support and prepare languages X-Git-Tag: 1.0~25 X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/commitdiff_plain/ef06cd797d4f91e83b1e3e69d815ff3e6c773ace Fix php 5.3 support and prepare languages --- diff --git a/file.php b/file.php index 32c097f..0a6e32c 100644 --- a/file.php +++ b/file.php @@ -19,9 +19,10 @@ */ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); -require (JIRAFEAU_ROOT.'lib/config.php'); -require (JIRAFEAU_ROOT.'lib/settings.php'); -require (JIRAFEAU_ROOT.'lib/functions.php'); +require (JIRAFEAU_ROOT . 'lib/lang.php'); +require (JIRAFEAU_ROOT . 'lib/config.php'); +require (JIRAFEAU_ROOT . 'lib/settings.php'); +require (JIRAFEAU_ROOT . 'lib/functions.php'); if (isset ($_GET['h']) && !empty ($_GET['h'])) { @@ -31,7 +32,7 @@ if (isset ($_GET['h']) && !empty ($_GET['h'])) if (isset ($_GET['d']) && !empty ($_GET['d'])) $delete_code = $_GET['d']; - if (!ereg ('[0-9a-f]{32}$', $link_name)) + if (!preg_match ('/[0-9a-f]{32}$/', $link_name)) { header ("HTTP/1.0 404 Not Found"); diff --git a/index.php b/index.php index eb8d577..8a31665 100644 --- a/index.php +++ b/index.php @@ -20,6 +20,7 @@ define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/'); define ('DEBUG', true); +require (JIRAFEAU_ROOT . 'lib/lang.php'); require (JIRAFEAU_ROOT . 'lib/config.php'); require (JIRAFEAU_ROOT . 'lib/settings.php'); require (JIRAFEAU_ROOT . 'lib/functions.php'); @@ -61,6 +62,13 @@ if ($writable && isset ($_POST['jirafeau'])) $key, $time, $cfg, $_SERVER['REMOTE_ADDR']); } +if (file_exists (JIRAFEAU_ROOT . 'install.php') + && !file_exists (JIRAFEAU_ROOT.'lib/config.local.php')) +{ + header('Location: install.php'); + exit; +} + require (JIRAFEAU_ROOT.'lib/template/header.php'); /* Checking for errors. */ diff --git a/install.php b/install.php old mode 100644 new mode 100755 index 8a34477..1d052c1 --- a/install.php +++ b/install.php @@ -23,6 +23,7 @@ define ('QUOTE', "'"); define ('JIRAFEAU_CFG', JIRAFEAU_ROOT.'lib/config.local.php'); define ('JIRAFEAU_VAR_RAND_LENGTH', 15); +require (JIRAFEAU_ROOT . 'lib/lang.php'); require (JIRAFEAU_ROOT . 'lib/config.php'); function diff --git a/lib/config.php b/lib/config.php index 25926e1..a4b443a 100644 --- a/lib/config.php +++ b/lib/config.php @@ -20,17 +20,12 @@ * default configuration * if you want to change this, overwrite in a config.local.php file */ -// don't forget the ending '/' - $cfg['web_root'] = ''; - +/* don't forget the ending '/' */ +$cfg['web_root'] = ''; $cfg['var_root'] = ''; - $cfg['lang'] = ''; - $cfg['style'] = 'default'; - $cfg['rewrite'] = false; - $cfg['password'] = ''; if ((basename (__FILE__) != 'config.local.php') diff --git a/lib/lang.php b/lib/lang.php new file mode 100755 index 0000000..fd67e2d --- /dev/null +++ b/lib/lang.php @@ -0,0 +1,26 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +// Translation (TODO) +function _($text) +{ + return ("$text"); +} + +?> \ No newline at end of file diff --git a/lib/settings.php b/lib/settings.php index afd16c8..7d9db2f 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -25,20 +25,9 @@ define ('JIRAFEAU_VERSION', '0.4'); define ('VAR_FILES', $cfg['var_root'] . 'files/'); define ('VAR_LINKS', $cfg['var_root'] . 'links/'); -// i18n - -setlocale (LC_ALL, $cfg['lang']); - -bindtextdomain (JIRAFEAU_PACKAGE, JIRAFEAU_ROOT.'lib/locale'); -textdomain (JIRAFEAU_PACKAGE); - - // useful constants - if (!defined ('NL')) -{ define ('NL', "\n"); -} define ('JIRAFEAU_INFINITY', -1); define ('JIRAFEAU_MINUTE', 60); // 60