<?php
/***************************************************************************
functions.php - All common functies, insert here
-------------------
begin : May 23, 2002
copyright : (C) 2002 by Harm Kolk & Onno de Jong
email : hide@address.com
: hide@address.com
$Id: functions.php,v 1.9 2002/06/12 14:17:56 lyon Exp $
This file is part of the myCts project, specifically it belongs to
the website.
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
function error($type, $description, $fatal=true)
{
global $template;
global $db;
global $lang;
if(!$template)
{
echo 'Pre template error<br>\n Description: ' . $description;
}
else
{
if($fatal)
{
if(!defined('HEADER_PUTOUT'))
{
$header = new header($lang[ADMIN]['title']);
$header->do_print();
}
$template->set_filenames(
array(
'main' => 'error.tpl.htm')
);
$template->assign_vars(
array(
'ERROR' => $description
)
);
$template->pparse('main');
include 'footer.php';
exit();
}
else
{
$error = 'an error occured: ' . $description;
echo "<b>$error</b><br /><br />";
}
}
}
function get_request_var($name)
{
global $HTTP_POST_VARS;
global $HTTP_GET_VARS;
if(isset($HTTP_GET_VARS[$name]) || isset( $HTTP_POST_VARS[$name] ))
{
$return = (isset($HTTP_GET_VARS[$name])) ? $HTTP_GET_VARS[$name] : $HTTP_POST_VARS[$name];
$return = (is_string($return)) ? trim($return) : $return;
return $return;
}
return '';
}
?>