<?php

/***************************************************************************
 *
 *      Update to 2.0.20 by Alf (10.04.2006) 20:48
 *
 *	Title: xphpBBi - phpBB Complete Integration project 
 *	Description: Project to turn the phpBB forums into a fully functioning
 *		Xoops2 Module. Based on the phpBB 2.0.11 port from BBpixel.com - 
 *		(PBBoard v1.22).
 *	Credits: Xoops2 Module Development Team - Koudanshi - phpBB Group
 *	Thanks: To Koudanshi for a great start in his port, and phpBB Group for
 *		such a great forum software.
 *	License: GNU/GPL version 2 or later.
 ****************************************************************************/

/***************************************************************************
 *                               pagestart.php
 *                            -------------------
 *   begin                : Thursday, Aug 2, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: pagestart.php,v 1.1.2.10 2006/01/22 17:11:09 grahamje Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if (!defined('IN_PHPBB'))
{
	die("Hacking attempt");
}

define('IN_ADMIN', true);
// Include files
include_once($phpbb_root_path . 'common.php');

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$IsAdmin = false;
if ($xoopsUserIsAdmin || $userdata['user_level'] == ADMIN) $IsAdmin = true;

if (!is_object($xoopsUser))
{
	message_die(GENERAL_MESSAGE, 'Not Logged In - Access Denied');
	redirect(append_sid("login.php", true));
}
else if (!$IsAdmin)
{
	message_die(GENERAL_MESSAGE, $lang['Not_admin']);
	redirect(append_sid("/", true));
}

if ($HTTP_GET_VARS['sid'] != $userdata['sess_id'])
{
    redirect("index.php?sid=" . $userdata['sess_id']);
}

if (empty($no_page_header))
{
	// Not including the pageheader can be neccesarry if META tags are
	// needed in the calling script.
	include('./page_header_admin.php');
}

?>