image uploading fixes involving database filepaths, with no filename.
[phpns.git] / inc / header.php
blob24899fd27d8d2f53e370c8cb8be21edb7d1391ec
1 <?php
3 //error_reporting( E_ALL | E_STRICT ); //DEBUGGING, uncommment to activate
5 /* Copyright (c) 2007-08 Alec Henriksen
6 * phpns is free software; you can redistribute it and/or modify it under the
7 * terms of the GNU General Public Licence (GPL) as published by the Free
8 * Software Foundation; either version 2 of the Licence, or (at your option) any
9 * later version.
10 * Please see the GPL at http://www.gnu.org/copyleft/gpl.html for a complete
11 * understanding of what this license means and how to abide by it.
14 $globalvars['version'] = "2.2.0"; // define phpns version. :)
16 //we're going to set some quick vars, although important.
17 $globalvars['full_page'] = basename($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING']; //define full path + GET
18 $globalvars['path_to'] = dirname($_SERVER['PHP_SELF']);
19 $globalvars['filename'] = basename($_SERVER['PHP_SELF']); //just the filename
20 $globalvars['path_to_uri'] = $_SERVER['SERVER_NAME'].$globalvars['path_to'];
22 session_start(); //start session management
24 include("inc/config.php"); // include database information
25 include("inc/errors.php"); // include error profiles
27 //redirect to install dir if not installed
28 if ($globalvars['installed'] == "no") {
29 header("Location: install/index.php");
32 //connect to mysql database for all files
33 $mysql['connection'] = @mysql_connect($databaseinfo['host'], $databaseinfo['user'], $databaseinfo['password'])
34 or die ($error['connection']);
36 //select mysql database
37 $mysql['db'] = @mysql_select_db($databaseinfo['dbname'],$mysql['connection'])
38 or die ($error['database']);
40 //define alternating colors for table rows... and other uses
41 $globalvars['altcolor'][1] = '#ffffff';
42 $globalvars['altcolor'][2] = '#f5f5f5';
44 include("inc/function.php"); // include function header
46 //set error handler
47 //set_error_handler('phpns_error');
49 if (!$globalvars['pagetype']) {
50 $globalvars['pagetype'] = "admin"; //set admin pagetype if no pagetype detected. :)
53 if ($globalvars['pagetype'] == "admin" || $globalvars['pagetype'] == "about") {
54 include("inc/auth.php"); //include auth info if pagetype is admin (not login page)
57 if (!$globalvars['page_name']) { //display error if there is no content.
58 $globalvars['page_name'] = 'error';
59 $page_desc['error'] = "You have reached this page in error! Phpns couldn't find any page with the information supplied. If you think this is a bug in the phpns software, we would appreciate you filing the bug at <a href=\"http://launchpad.net/phpns\">the phpns launchpad website</a>!";
63 $sys_time_format = load_config('sys_time_format');
64 //define ip address and other vars
65 $globalvars['ip'] = $_SERVER['REMOTE_ADDR'];
66 $globalvars['time'] = time();
67 $globalvars['time_format'] = $sys_time_format['v1'];
69 include("inc/head_data.php"); //include head_data
70 include("inc/global_files.php"); //global files array