root/trunk/scripts/prepend.inc.php

Revision 1739, 3.6 KB (checked in by driehle, 4 months ago)

Some Bugfixes for old Jlog-Versions

  • Property svn:keywords set to HeadURL Rev Author Date
Line 
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
27error_reporting(E_ALL ^ E_NOTICE);
28require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."personal".DIRECTORY_SEPARATOR."settings.inc.php");
29require_once(JLOG_BASEPATH."scripts".DIRECTORY_SEPARATOR."version.inc.php");
30 
31// these two constants did not exist in Jlog 1.0.2
32if (!defined('JLOG_INSTALLED_VERSION')) {
33    define('JLOG_INSTALLED_VERSION', '1.0.2');
34}
35if (!defined('JLOG_LANGUAGE')) {
36    define('JLOG_LANGUAGE', 'de');
37}
38
39// redirect to update-script if new jlog version was installed
40if(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
48define("JLOG_DB_CONTENT", JLOG_DB_PREFIX."content");
49define("JLOG_DB_COMMENTS", JLOG_DB_PREFIX."comments");
50define("JLOG_DB_CATASSIGN", JLOG_DB_PREFIX."catassign");
51define("JLOG_DB_CATEGORIES", JLOG_DB_PREFIX."categories");
52define("JLOG_DB_ATTRIBUTES", JLOG_DB_PREFIX."attributes");
53
54// we need these files on every page
55require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang.'.JLOG_LANGUAGE.'.inc.php');
56require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'database.class.php');
57require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'bbcode.php');
58require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'general.func.php'); 
59require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'comments.php');
60
61// additionaly, when in admin-mode, we need this file
62if(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);
66if ($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);
72if ($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
82setlocale(LC_TIME, $l['locale']);
83require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'categories.class.php');
84require_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
Note: See TracBrowser for help on using the browser.