| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * Jlog |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | * |
|---|
| 20 | * $HeadURL$ |
|---|
| 21 | * $Rev$ |
|---|
| 22 | * $Author$ |
|---|
| 23 | * $Date$ |
|---|
| 24 | */ |
|---|
| 25 | |
|---|
| 26 | // load settings and version information |
|---|
| 27 | error_reporting(E_ALL ^ E_NOTICE); |
|---|
| 28 | require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."personal".DIRECTORY_SEPARATOR."settings.inc.php"); |
|---|
| 29 | require_once(JLOG_BASEPATH."scripts".DIRECTORY_SEPARATOR."version.inc.php"); |
|---|
| 30 | |
|---|
| 31 | // these two constants did not exist in Jlog 1.0.2 |
|---|
| 32 | if (!defined('JLOG_INSTALLED_VERSION')) { |
|---|
| 33 | define('JLOG_INSTALLED_VERSION', '1.0.2'); |
|---|
| 34 | } |
|---|
| 35 | if (!defined('JLOG_LANGUAGE')) { |
|---|
| 36 | define('JLOG_LANGUAGE', 'de'); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | // redirect to update-script if new jlog version was installed |
|---|
| 40 | if(version_compare(JLOG_INSTALLED_VERSION, JLOG_SOFTWARE_VERSION, '<') |
|---|
| 41 | AND substr($_SERVER['SCRIPT_FILENAME'], -17) !== '/admin/update.php') |
|---|
| 42 | { |
|---|
| 43 | header('Location: ' . JLOG_PATH . '/admin/update.php'); |
|---|
| 44 | exit; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | // define constants for names of tables in database |
|---|
| 48 | define("JLOG_DB_CONTENT", JLOG_DB_PREFIX."content"); |
|---|
| 49 | define("JLOG_DB_COMMENTS", JLOG_DB_PREFIX."comments"); |
|---|
| 50 | define("JLOG_DB_CATASSIGN", JLOG_DB_PREFIX."catassign"); |
|---|
| 51 | define("JLOG_DB_CATEGORIES", JLOG_DB_PREFIX."categories"); |
|---|
| 52 | define("JLOG_DB_ATTRIBUTES", JLOG_DB_PREFIX."attributes"); |
|---|
| 53 | |
|---|
| 54 | // we need these files on every page |
|---|
| 55 | require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang.'.JLOG_LANGUAGE.'.inc.php'); |
|---|
| 56 | require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'database.class.php'); |
|---|
| 57 | require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'bbcode.php'); |
|---|
| 58 | require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'general.func.php'); |
|---|
| 59 | require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'comments.php'); |
|---|
| 60 | |
|---|
| 61 | // additionaly, when in admin-mode, we need this file |
|---|
| 62 | if(defined('JLOG_ADMIN')) require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang-admin.'.JLOG_LANGUAGE.'.inc.php'); |
|---|
| 63 | |
|---|
| 64 | // connect to database |
|---|
| 65 | $connect = @mysql_connect(JLOG_DB_URL, JLOG_DB_USER, JLOG_DB_PWD); |
|---|
| 66 | if ($connect == FALSE) { |
|---|
| 67 | mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysql_error()); |
|---|
| 68 | die("<strong>".$l['db_error']."</strong><br />".$l['plz_try_again']."."); |
|---|
| 69 | } |
|---|
| 70 | // select our database |
|---|
| 71 | $select = @mysql_select_db(JLOG_DB); |
|---|
| 72 | if ($connect == FALSE) { |
|---|
| 73 | mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysql_error()); |
|---|
| 74 | die("<strong>".$l['db_error']."</strong><br />".$l['plz_try_again']."."); |
|---|
| 75 | } |
|---|
| 76 | // do some settings |
|---|
| 77 | @mysql_query("SET NAMES utf8"); |
|---|
| 78 | @mysql_query("SET sql_mode=''"); |
|---|
| 79 | |
|---|
| 80 | // some more code that needs to run for every page - however, this |
|---|
| 81 | // code requires an established connection to the database |
|---|
| 82 | setlocale(LC_TIME, $l['locale']); |
|---|
| 83 | require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'categories.class.php'); |
|---|
| 84 | require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'jlogPlugins.class.php'); |
|---|
| 85 | $plugins = new JlogPluginManager(JLOG_BASEPATH.'plugins'.DIRECTORY_SEPARATOR); |
|---|
| 86 | |
|---|
| 87 | // call hooks for bbcode plugins |
|---|
| 88 | $bbcode = $plugins->callHook('bbcode', $bbcode); |
|---|
| 89 | $bbcomments = $plugins->callHook('bbcomments', $bbcomments); |
|---|
| 90 | |
|---|
| 91 | // eof |
|---|