root/trunk/redirectors/forumjump.php

Revision 291, 2.8 kB (checked in by hannes, 3 years ago)

establishing a global warnings array to store and display (choke) warnings

Line 
1 <?php
2
3 /**
4  * Package: Spam Board 5
5  * File: redirectors/forumjump.php
6  * Description: redirect user to another forum (called by class Forumjump)
7  *
8  * Copyright (C) 2007, 2009 Hannes Schueller
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as
12  * published by the Free Software Foundation, version 3 of the
13  * License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program (see LICENCE). If not,
22  * see <http://www.gnu.org/licenses/>.
23  **/
24
25 // called independently from index
26 require_once('../includes/config/settings.php');
27
28 // load classes on demand
29 function __autoload($class) {
30     global $SETTINGS;
31     if (is_file($SETTINGS['fspath'] . 'classes/pages/' . $class . '.php')) {
32         require_once($SETTINGS['fspath'] . 'classes/pages/' . $class . '.php');
33     } elseif (is_file($SETTINGS['fspath'] . 'classes/misc/' . $class . '.php')) {
34         require_once($SETTINGS['fspath'] . 'classes/misc/' . $class . '.php');
35     } else { die('Class ' . $class . ' not found.'); }
36 }
37
38 // initialize global warnings array
39 $WARNINGS = Array();
40
41 // import version number
42 require_once($SETTINGS['fspath'] . 'includes/config/version.php');
43 // bots definition
44 require_once($SETTINGS['fspath'] . 'includes/config/bots.php');
45 // formatting object
46 $F = new Format();
47 require($SETTINGS['fspath'] . 'includes/lang/' . $SETTINGS['language'] . '.php');
48 // open database connection
49 $C = new Connection();
50 Member::session();
51 if ($_SESSION['lang'] != '') {
52     include($SETTINGS['fspath'] . 'includes/lang/' . $_SESSION['lang'] . '.php');
53 }
54 require_once($SETTINGS['fspath'] . 'includes/input.php');
55
56 // check whether the user wants to go to a forum or category
57 $_red = explode('=', $INPUT['search_scope']);
58
59 // check if user has permission; required: read; dependent on id
60 if (Member::checkRights(ucfirst($_red[0]), 'r', $_red[1])) {
61     // permission granted
62     // close database connection
63     $C = NULL;
64     session_write_close();
65     // refresh session
66     session_start();
67     // forward to forum / category
68     header('Location: ' . $SETTINGS['webpath'] . $F->link($_red[0], TRUE) . 'id=' . $_red[1] . '&' . strip_tags(SID));
69     // just in case something went wrong with redirecting, print something
70     print(str_replace('%link%', '<a href="../' . $F->link(strtolower($_red[0])) . 'id='.$_red[1] . '&' . strip_tags(SID) . '">../' . $F->link(strtolower($_red[0])) . 'id=' . $_red[1] . '&' . strip_tags(SID) . '</a>', $LANG['redirection_problem']));
71 } else {
72     print($LANG['error_permission_denied']);
73 }
74
75 ?>
Note: See TracBrowser for help on using the browser.