// 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 .
$server = "localhost";
$port = 80;
// import HTTP_GET_VARS as _GET if _GET doesn't exist
if (!isset($_GET) && isset($HTTP_GET_VARS))
$_GET = &$HTTP_GET_VARS;
echo "
\n";
if ($_GET["mailbox"])
{
echo "Get mailbox ".$_GET["mailbox"]." content:
\n";
$s = fsockopen($server, $port, &$errno, &$errstr, 30) or die ("ERROR: can't connect to $server:$port");
fputs($s,"GET /websrv/admin.php?user_login=support&shard=".$_GET["shard"]."&mailbox=".$_GET["mailbox"]." HTTP/1.0\n\n");
while(!feof($s))
{
$l = trim(fgets($s, 2048));
if (ereg("^FILE:(.*)", $l, $reg))
echo "".$reg[1]."
\n";
}
fclose($s);
echo "
\n";
}
if ($_GET["mail"])
{
echo "Get mail ".$_GET["mailbox"]."/".$_GET["mail"]." content:
\n";
$s = fsockopen($server, $port, &$errno, &$errstr, 30) or die ("ERROR: can't connect to $server:$port");
fputs($s, "GET /websrv/admin.php?user_login=support&shard=".$_GET["shard"]."&mail=".$_GET["mail"]."&mailbox=".$_GET["mailbox"]." HTTP/1.0\n\n");
echo "Content of mail:
\n";
while(!feof($s))
echo nl2br(htmlentities(trim(fgets($s, 2048))));
fclose($s);
echo "
\n";
}
if ($_GET["recover_thread"])
{
echo "Recover thread ".$_GET["forum"]." ".$_GET["recover_thread"]."
\n";
$s = fsockopen($server, $port, &$errno, &$errstr, 30) or die ("ERROR: can't connect to $server:$port");
fputs($s, "GET /websrv/admin.php?user_login=support&shard=".$_GET["shard"]."&recover_thread=".$_GET["forum"]."&recover_threadthread=".$_GET["recover_thread"]." HTTP/1.0\n\n");
fclose($s);
echo "
\n";
}
if ($_GET["forum"])
{
echo "Get forum ".$_GET["forum"]." content:
\n";
$s = fsockopen($server, $port, &$errno, &$errstr, 30) or die ("ERROR: can't connect to $server:$port");
fputs($s, "GET /websrv/admin.php?user_login=support&shard=".$_GET["shard"]."&forum=".$_GET["forum"]." HTTP/1.0\n\n");
while(!feof($s))
{
$l = trim(fgets($s, 2048));
if (ereg("^FILE:(.*)", $l, $reg))
{
echo "".trim($reg[1])."\n";
if ($reg[1]{0} == '_')
{
echo " recover thread\n";
}
echo "
\n";
}
}
fclose($s);
echo "
\n";
}
if ($_GET["thread"])
{
echo "Get thread ".$_GET["forum"]."/".$_GET["thread"]." content:
\n";
$s = fsockopen($server, $port, &$errno, &$errstr, 30) or die ("ERROR: can't connect to $server:$port");
fputs($s, "GET /websrv/admin.php?user_login=support&shard=".$_GET["shard"]."&forum=".$_GET["forum"]."&thread=".$_GET["thread"]." HTTP/1.0\n\n");
echo "Content of thread:
\n";
while(!feof($s))
{
$l = trim(fgets($s, 2048));
if (ereg("^TOPIC:(.*) SUBMIT:(.*)$", $l, $reg))
echo nl2br(htmlentities(" TOPIC:".$reg[1]."SUBMITED BY: ".$reg[2]."\n"));
if (ereg("^AUTHOR:(.*) DATE:(.*) POST:(.*)", $l, $reg))
echo nl2br(htmlentities("AUTHOR: ".$reg[1]." DATE:".$reg[2]." POST:".$reg[3]."\n"));
}
fclose($s);
echo "
\n";
}
?>