<?
###################################################
# Based in Workbench.
# Copyright (C)2001 Stuart Wigley (hide@address.com)
#
# wikimapadmin.php 04/07/2007
#
# This file is part of Insecticida.
#
# Insecticida 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.
#
# Insecticida 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 Insecticida; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################
session_start();
require_once("../config.php");
#if user has logged in get $login from session
if (($HTTP_SESSION_VARS["group"] == "1") && session_is_registered("login"))
{
$login = $HTTP_SESSION_VARS["login"];
require_once("$path/connect.php");
require_once("$path/general.php");
if ($HTTP_GET_VARS["wikikey"])
{
$wikikey = $HTTP_GET_VARS["wikikey"];
}
else if ($HTTP_POST_VARS["wikikey"])
{
$wikikey = $HTTP_POST_VARS["wikikey"];
}
if ($HTTP_GET_VARS["wikivalue"])
{
$wikivalue = $HTTP_GET_VARS["wikivalue"];
}
else if ($HTTP_POST_VARS["wikivalue"])
{
$wikivalue = $HTTP_POST_VARS["wikivalue"];
}
$wedit = $HTTP_GET_VARS["wedit"];
$wnew = $HTTP_GET_VARS["wnew"];
$winsert = $HTTP_POST_VARS["winsert"];
$wupdate = $HTTP_POST_VARS["wupdate"];
$wdelete = $HTTP_GET_VARS["wdelete"];
$wikikeyOld = $HTTP_POST_VARS["wikikeyOld"];
if ($wikikey)
{
if ($winsert)
{
$theQuery1 = "insert into wikimap values ( '" . $wikikey .
"', '" . $wikivalue . "' )";
#echo("$theQuery1");
mysql_query("$theQuery1") or die (mysql_error());
}
else if ($wupdate)
{
$theQuery1 = "update wikimap set wikikey = '" . $wikikey .
"', wikivalue = '" . $wikivalue .
"' where wikikey = '$wikikeyOld'";
mysql_query("$theQuery1") or die (mysql_error());
}
else if ($wdelete)
{
$theQuery1 = "delete from wikimap where wikikey = '$wikikey'";
mysql_query("$theQuery1") or die (mysql_error());
}
}
include("$path/header.php");
?>
<table cellspacing="0" class="table3">
<tr class="rowtitle">
<td><h5>Manage Wiki Map</h5></td>
</tr>
<tr>
<td><p>This administration tool allows you to manage Wiki transformations. You can add, edit and delete transformations.
</p></td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td>
<form method="post" name="wikimapAdmin" action="wikimapadmin.php">
<?
{
#get all of the wikimap data
$queryWikiMap = mysql_query("select * from wikimap") or die(mysql_error());
echo("<table class=\"table1\">");
echo("<tr bgcolor=\"#dddddd\"><td><strong>Functional Pack</strong></td><td><strong>Description</strong></td><td><strong>Operation</strong></td></tr>");
while ($resultWikiMap = mysql_fetch_array($queryWikiMap))
{
if ($HTTP_GET_VARS["wedit"] && ($wikikey == $resultWikiMap[wikikey]))
{
echo( "<input type=\"hidden\" name=\"wikikeyOld\" value=\"$wikikey\">" );
echo("<tr>");
echo("<td><input type=\"text\" name=\"wikikey\" maxlength=\"" );
echo( mysql_field_len($queryWikiMap, 1)."\" value=\"");
echo( escapeHtml( $resultWikiMap[wikikey] ) . "\"></td>");
echo("<td><input type=\"text\" name=\"wikivalue\" size=95 maxlength=\"");
echo( mysql_field_len($queryWikiMap, 2)."\" value=\"" );
echo( escapeHtml( $resultWikiMap[wikivalue] ) . "\"></td>");
echo("<td><input type=\"hidden\" name=\"wupdate\" value=\"1\"><a href=\"javascript:document.forms[1].submit()\" onClick=\"return validateForm('projectAdmin');\">Submit</a></td></tr>");
}
else {
echo("<tr><td>$resultWikiMap[wikikey]</td><td>" );
echo( escapeHtml( $resultWikiMap[wikivalue] ) . "</td>" );
echo("<td><a href=\"wikimapadmin.php?wikikey=" );
echo( escapePlus( $resultWikiMap[wikikey] ) . "&wedit=1\">Edit</a> ");
echo("<a href=\"wikimapadmin.php?wikikey=$resultWikiMap[wikikey]&wdelete=1\">Del</a>");
echo("</td></tr>");
}
}
if ($wnew)
{
echo("<tr>");
echo("<td><input type=\"text\" name=\"wikikey\" maxlength=\"".mysql_field_len($queryWikiMap, 1)."\" value=\"\"></td>");
echo("<td><input type=\"text\" name=\"wikivalue\" maxlength=\"".mysql_field_len($queryWikiMap, 2)."\" value=\"\"></td>");
echo("<td><input type=\"hidden\" name=\"winsert\" value=\"1\"><a href=\"javascript:document.forms[1].submit()\" onClick=\"return validateForm('projectAdmin');\">Submit</a></td></tr>");
}
echo("<tr><td colspan=2><a href=\"wikimapadmin.php?wnew=1\">Add a new wiki transformation mapping</a></td></tr>");
echo("</table>");
}
?>
</td>
</tr>
</table>
</form>
<?include("$path/footer.php");
}
else{
include("$path/login.php");
}
?>