// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
function addToLog($str)
{
global $adminLog;
$adminLog[] = $str;
}
function htmlProlog($rootFile, $title, $displayLinks = true, $addToHead = "")
{
echo "\n";
echo "
\n";
echo "$title\n";
echo "\n";
echo $addToHead."\n";
echo "\n";
echo "\n";
echo "\n";
global $admcookielogin, $admcookiepassword;
addToLog("admcookielogin=$admcookielogin admcookiepassword=$admcookiepassword");
addToLog("admlogin=$admcookielogin admcookiepassword=$admcookiepassword");
if ($displayLinks)
linkBar($title);
}
function htmlEpilog($logInfo = true)
{
global $HTTP_POST_VARS, $HTTP_GET_VARS, $sqlQueries, $nel_queries, $nel_updates, $admlogin, $allowrootdebug, $adminLog;
if ($admlogin == "root")
echo "\n";
if ($admlogin == "root" && $allowrootdebug && $logInfo)
{
if (isset($nel_queries) && count($nel_queries)>=1)
{
echo "
NeL shard queries\n";
echo "\n";
foreach ($nel_queries as $query)
echo "- $query
\n";
echo "
\n";
}
displayQueries();
echo "
HTTP_POST_VARS\n";
print_r($HTTP_POST_VARS);
echo "\nHTTP_GET_VAR\n";
print_r($HTTP_GET_VARS);
echo "
\n";
if (is_array($adminLog))
{
echo "
\n";
foreach ($adminLog as $log)
echo "$log
\n";
}
}
/*
echo "";
print_r($GLOBALS);
echo "
";
*/
echo "\n";
echo "\n";
}
function button($text, $bdcolor="#888888", $bgcolor="#eeeeee")
{
return "";
}
function linkBar($title)
{
global $admlogin, $group;
echo "\n";
if (file_exists("./nel.gif"))
{
echo "";
echo "";
echo " | \n";
}
echo "\n";
echo "\n";
echo "";
echo "";
echo "".button($title)." | ";
echo "".button("$admlogin/$group on ".$HTTP_HOST.$_SERVER['PHP_SELF'].helpLink("Main"))." | ";
echo " ";
echo " | \n";
echo "";
echo "";
echo " | \n";
echo " \n";
echo " |
\n";
}
function subBar($menus)
{
echo "\n";
foreach($menus as $name => $url)
echo "".button("$name")." | ";
echo "\n
|
\n";
}
function getFileRoot($name)
{
$n = basename($name);
$pos = strrpos($n, ".");
if ($pos === NULL)
return $n;
return substr($n, 0, $pos);
}
function helpLink($topic)
{
return "+";
}
function help($topic)
{
return helpLink($topic);
}
function helpCommon($topic)
{
return "+";
}
function helpAll($directory, $topic)
{
return "+";
}
function getVar($name)
{
if(isset($_POST[$name])) return $_POST[$name];
else if(isset($_GET[$name])) return $_GET[$name];
}
?>