[svn-inject] Installing original source of quickappoint
[debian/quickappoint.git] / lib / prepend.php
1 <?php
2 // This file should be called first from everywhere ;-)
3
4 error_reporting(E_ALL);
5 session_start();
6 require_once(dirname(__FILE__) . '/../etc/options.php');
7
8
9 // check server settings: magic quotes gpc
10 if (get_magic_quotes_gpc()) die('The PHP variable magic_quotes_gpc is on. At the moment it is required to turn it off to use quickappoint.');
11
12 // logout
13 if (isset($_GET['logout'])) {
14         unset($_SESSION['person']);
15         session_destroy();
16 }
17                 
18
19 // language settings
20 if (isset($_SESSION['person']) && isset($_SESSION['person']['locale'])) setlocale(LC_ALL, $_SESSION['person']['locale']);
21 else setlocale(LC_ALL, $project_options['locale']);
22 bindtextdomain("messages", "./locale");
23 textdomain("messages");
24
25 // check authentification
26 $request = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER["REQUEST_URI"];
27 $found = FALSE;
28 foreach ($unrestricted_pages as $page) {
29         if (strpos($request, $page) === 0) {$found = TRUE; break;}
30 }
31 if (!$found) {
32         if (!isset($_SESSION['person']) || empty($_SESSION['person'])) {
33                 $_SESSION['errormsg'] = 'You have to login first!'; 
34                 header('Location:' . $project_options['projecturl'] . 'login.php');
35         }
36 }
37
38 ?>