<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// 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, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

//includes
include "config/config_aroundme.inc.php";
include "inc/functions.inc.php";


//templates
$templateOuter = 'default_pre_login.tpl.php';
$templateInner = 'error.tpl.php';
$template_path = $c_node['dir']['template_path'];
$template_name = $c_node['node']['template_default_name'];
$template_path = $template_path . $template_name . "/";
require_once($c_node['dir']['class_path'] . 'Template.class.php');
$tpl = & new Template($template_path); // This is the outter template
$body = & new Template($template_path); // This is the inner template
$body->set('templatePath', $template_path);


session_start();
if (isset($_SESSION['s_homepage'])) {
    $homepage = $_SESSION['s_homepage'];
}



//setup language
if(isset($_REQUEST['language_id'])) {
	$language_id = $_REQUEST['language_id'];
}
else {
	$language_id = $c_node['node']['language']['default'];
}

$languagePath = "language/" . $language_id . "/" . $template_name . "/";
$languageArrayPath = $languagePath . "/arrays/";
$languageTextPath = $languagePath . "/texts/";
require_once($languagePath . 'error.lang.php');
require_once($languageArrayPath . 'arr_language_name.lang.php');
$body->set('lang', $lang);
$tpl->set('lang', $lang);


/*
* MOVE TO TEMPLATE
*/
if(!empty($c_node['node']['language_available'])) {
	$body->set('language_available', $c_node['node']['language_available']);
}

if(!empty($homepage)) {
	$body->set('homepage', $homepage);
}

$tpl->set('templatePath', $template_path);
$body->set('templatePath', $template_path);


//write template
$tpl->set('content', $body->fetch($templateInner));
echo $tpl->fetch($templateOuter);
?>
