Land New FAQ, Category and Application Managers. Fixes Bug 255309, Bug 255312, and the DevCP part of Bug 256254. Other fixes included, Bug 254925.

This commit is contained in:
psychoticwolf%carolina.rr.com 2004-10-31 20:57:26 +00:00
Родитель 39210677f9
Коммит 87997c6077
4 изменённых файлов: 327 добавлений и 279 удалений

Просмотреть файл

@ -265,7 +265,7 @@ if ($mode=="update") {
$sql = "SELECT `Name`, `Homepage`, `Description` FROM `t_main` WHERE `ID` = '$item_id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($sql_result);
$name = $row["Name"];
if (!$name) { $name=$row["Name"]; }
$homepage = $row["Homepage"];
$description = $row["Description"];
@ -335,7 +335,11 @@ if (!$authors) {$authors="$_SESSION[email]"; }
?>
<TR><TD><SPAN class="global">Author(s):*</SPAN></TD><TD><INPUT NAME="authors" TYPE="TEXT" VALUE="<?php echo"$authors"; ?>" SIZE=45></TD></TR>
<?php
if ($version) {
echo"<TR><TD><SPAN class=\"file\">Version:*</SPAN></TD><TD>$version<INPUT NAME=\"version\" TYPE=\"HIDDEN\" VALUE=\"$version\"></TD></TR>\n";
} else {
echo"<TR><TD><SPAN class=\"file\">Version:*</SPAN></TD><TD><INPUT NAME=\"version\" TYPE=\"TEXT\" VALUE=\"$version\"></TD></TR>\n";
}
echo"<TR><TD><SPAN class=\"file\">OS*</SPAN></TD><TD><SELECT NAME=\"osid\">";
$sql = "SELECT * FROM `t_os` ORDER BY `OSName` ASC";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
@ -732,6 +736,7 @@ if ($a != $count) {echo", "; } else {echo"<br>\n";}
echo"</font></DIV></TD></TR>\n";
$authors = $_POST["authors"];
?>
<TR><TD><SPAN class="global">Author(s):*</SPAN></TD><TD><INPUT NAME="authors" TYPE="TEXT" VALUE="<?php echo"$authors"; ?>" SIZE=70><INPUT NAME="submit" TYPE="SUBMIT" VALUE="Next &#187;"></TD></TR>
</FORM></TABLE>
<?php

Просмотреть файл

@ -1,162 +1,153 @@
<?php
require"core/sessionconfig.php";
require"../core/config.php";
$function = $_GET["function"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html lang="EN" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<?php
require"../core/config.php";
//Define Breadcrumbs for Header Navigation
$breadcrumbs[]['name'] = "Manage Application Versions";
$breadcrumbs[]['url'] = "/admin/appmanager.php";
?>
<link rel="stylesheet" type="text/css" href="/admin/core/mozupdates.css">
<title>MozUpdates :: Manage Application Versions</title>
</head>
<body>
<HTML>
<HEAD>
<TITLE>Mozilla Update :: Developer Control Panel :: Application Manager</TITLE>
<?php
include"$page_header";
include"inc_sidebar.php";
?>
<?php
if ($_SESSION["level"]=="admin") {
//Do Nothing, they're good. :-)
} else {
echo"<h1>Access Denied</h1>\n";
echo"You do not have access to the Application Manager";
include"$page_footer";
echo"</body></html>\n";
exit;
}
?>
<?php
if (!$function) {
//Add Category to MySQL Table
if ($_POST["submit"]=="Add Application") {
if ($_POST[AppName] != "Mozilla" && $_POST[SubVer] == "final") {
$_POST[SubVer] = "";
}
if ($_POST["AppName"]=="Other") {
$_POST["AppName"] = $_POST["othername"];
$_POST["GUID"] = $_POST["otherguid"];
}
$sql = "INSERT INTO `t_applications` (`AppName`,`Release`,`SubVer`,`GUID`) VALUES ('$_POST[AppName]','$_POST[Release]','$_POST[SubVer]','$_POST[GUID]')";
if ($_POST["submit"]=="Add Application" or $_POST["submit"]=="Add Version") {
echo"<h2>Processing Add Request, please wait...</h2>\n";
$appname = $_POST["appname"];
$guid = $_POST["guid"];
$shortname = $_POST["shortname"];
$version = $_POST["version"];
$major = $_POST["Major"];
$minor = $_POST["Minor"];
$release = $_POST["Release"];
$subver = $_POST["SubVer"];
$public_ver = $_POST["public_ver"];
$sql = "INSERT INTO `t_applications` (`AppName`, `GUID`, `shortname`, `Version`, `major`, `minor`, `release`,`SubVer`,`public_ver`) VALUES ('$appname','$guid','$shortname','$version', '$major','$minor','$release','$subver','$public_ver')";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
if ($sql_result) {
echo"The application $appname $version has been successfully added.";
}
}
?>
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1 ALIGN=CENTER STYLE="border: solid 1px #000000; width: 95%" class="listing">
<TR><TD COLSPAN=6 STYLE="background-color: #FFFFFF; font-size:14pt; font-weight: bold;">Manage Application List:</TD></TR>
<tr>
<td class="hline" colspan="6"></td>
</tr>
<h1>Manage Application List</h1>
<SPAN style="font-size:8pt">&nbsp;&nbsp;&nbsp;&nbsp; Show Versions for: <?php $i=0;
$sql = "SELECT `AppName` from `t_applications` GROUP BY `AppName` ORDER BY `AppName` ASC";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row = mysql_fetch_array($sql_result)) {
$appname = $row["AppName"];
echo"<a href=\"?application=".strtolower($appname)."\">$appname</a> / ";
}
echo"<a href=\"?function=addnewapp\">Add New Application...</a>";
?></span>
<h2>Application Versions for <?php echo ucwords($application); ?></h2>
<TABLE CELLPADDING=1 CELLSPACING=1 STYLE="border: 0px;">
<TR>
<tr>
<th></th>
<th>Release</th>
<th>Version</th>
<th style="width: 200px">Release</th>
<th>Public Version?</th>
</tr>
<?php
$sql = "SELECT * FROM `t_applications` ORDER BY `AppName` ASC, `major` ASC, `minor` ASC, `release` ASC, `SubVer` ASC";
$i=0;
$sql = "SELECT * FROM `t_applications` WHERE `AppName`='$application' ORDER BY `AppName` ASC, `major` ASC, `minor` ASC, `release` ASC, `SubVer` ASC";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
$lastname = "";
while ($row = mysql_fetch_array($sql_result)) {
// If it's a new AppName, start a new row
if ($lastname != $row["AppName"]) {
// Close out previous row if necessary
if ($lastname != "") {
echo"</td>";
echo"</tr>\n";
}
$applications[] = $row["AppName"];
echo"<tr>\n";
echo"<td>".++$i."</td>\n";
echo"<td>&nbsp;".$row["AppName"]."&nbsp;&nbsp;</td>";
echo"<td>";
echo"<td>&nbsp;<a href=\"?function=editversion&appid=".$row["AppID"]."\">$row[AppName] $row[Version]</a></td>";
echo"<td>$row[public_ver]</td>";
echo"</tr>\n";
} else {
// Separate with a comma
echo", ";
}
echo"<a href=\"?function=editcategory&appid=".$row["AppID"]."\">";
echo $row["Version"];
echo"</a>";
$lastname = $row["AppName"];
}
echo"</td>";
echo"</tr>\n";
?>
</table>
<div style="width: 660px; border: 1px dotted #AAA; margin-top: 2px; margin-left: 50px; font-size: 10pt; font-weight: bold">
<?php
//Add Category to MySQL Table
if ($_POST["submit"]=="Add Application") {
echo"<DIV style=\"text-align: center; font-size: 12pt\">The application $_POST[AppName] (Version $_POST[Release]$_POST[SubVer]) has been successfully added.</DIV>";
}
?>
<h2>New Version of <?php echo ucwords($application); ?></h2>
<form name="addapplication" method="post" action="?function=&action=addnewapp">
New Application
Name: <select name="AppName">
<?php
foreach ($applications as $application) {
echo"<OPTION value=\"$application\">$application</OPTION>\n";
}
echo"<OPTION value=\"Other\">Other</OPTION>\n";
$sql = "SELECT `AppName`, `GUID`, `shortname` FROM `t_applications` WHERE `AppName`='$application' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($sql_result);
$application = $row["AppName"];
$guid = $row["GUID"];
$shortname = $row["shortname"];
?>
</select>
Release: <input name="Release" type="text" size="5" maxlength="5" value=""><select name="SubVer">
<input name="appname" type="hidden" value="<?php echo ucwords($application); ?>">
<input name="guid" type="hidden" value="<?php echo"$guid"; ?>">
<input name="shortname" type="hidden" value="<?php echo"$shortname"; ?>">
<?php
$subvers = array("+"=>"+", "a"=>"alpha","b"=>"beta","final"=>"final");
Display Version (e.g. 1.0PR): <input name="version" size=8 maxlength=15 title="User Friendly Version (Ex. 1.0PR instead of 0.10)"><BR>
foreach($subvers as $key => $subver) {
$subver = ucwords($subver);
echo"<option value=\"$key\">$subver</option>\n";
}
?>
</select>
GUID: <input name="otherguid" type="text" size="25" MAXSIZE="50" value="">
Major: <input name="Major" type="text" size="5" maxlength="3" value="" title="Major Version #. (Ex. 1 if 1.0)">
Minor: <input name="Minor" type="text" size="5" maxlength="3" value="" title="Minor Version #. (Ex. 0 if 1.0)">
Release: <input name="Release" type="text" size="5" maxlength="3" value="" title="Release Version. (Ex. 2 if 1.0.2)">
SubVer: <input name="SubVer" size="5" maxlength="5" title="SubVersion Value (Ex. a4 if 1.8a4 or + if 0.10+)">
<BR>
<SPAN style="margin-left: 20px">If other, Name: <input name="othername" type="text" size="10"></span>
<input name="submit" type="submit" value="Add Application">
<div style="margin-top: 10px; font-size: 8pt">Should this version be exposed to end-users of the website, or just allowed for extension authors' install.rdf files? In general only release milestones should be exposed.</DIV>
Public Version: Yes: <input name="public_ver" type="radio" value="YES" checked> No: <input name="public_ver" type="radio" value="NO"><BR>
<BR>
<input name="submit" type="submit" value="Add Version">&nbsp;<input name="reset" type="reset" value="Reset Form">
</form>
</div>
<?php
} else if ($function=="editcategory") {
} else if ($function=="editversion") {
$appid = $_GET["appid"];
//Post Functions
if ($_POST["submit"] == "Update") {
if ($_POST[AppName] != "Mozilla" && $_POST[SubVer] == "final") {
$_POST[SubVer] = "";
}
$sql = "UPDATE `t_applications` SET `AppName`='$_POST[AppName]', `major`='$_POST[Major]', `minor`='$_POST[Minor]', `release`='$_POST[Release]', `SubVer`='$_POST[SubVer]',`GUID`='$_POST[GUID]' WHERE `appid`='$_POST[appid]'";
$appname = $_POST["AppName"];
$version = $_POST["version"];
$major = $_POST["Major"];
$minor = $_POST["Minor"];
$release = $_POST["Release"];
$subver = $_POST["SubVer"];
$public_ver = $_POST["public_ver"];
$appid=$_POST["appid"];
echo"<h2>Processing update request, please wait...</h2>\n";
$sql = "UPDATE `t_applications` SET `AppName`='$appname', `major`='$major', `minor`='$minor', `release`='$release', `SubVer`='$subver',`Version`='$version', `public_ver`='$public_ver' WHERE `appid`='$appid'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
if ($sql_result) {
echo"Your update to $appname $version has been successful.<br>";
}
echo"<div class=\"success\">Your update to $_POST[AppName], has been successful.</div>";
} else if ($_POST["submit"] == "Delete Application") {
} else if ($_POST["submit"] == "Delete Version") {
$appid=$_POST["appid"];
$appname = $_POST["AppName"];
$version = $_POST["version"];
echo"<h2>Processing delete request, please wait...</h2>\n";
$sql = "DELETE FROM `t_applications` WHERE `appid`='$_POST[appid]'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">You've successfully deleted the application '$_POST[AppName]'.</div>";
if ($sql_result) {
echo"You've successfully deleted the application '$appname $version'<br>";
include"$page_footer";
echo"</body>\n</html>\n";
exit;
}
}
if (!$appid) { $appid = $_POST["appid"]; }
@ -167,38 +158,61 @@ if (!$appid) { $appid = $_POST["appid"]; }
$row = mysql_fetch_array($sql_result);
?>
<div class="editbox">
<h3>Edit Application:</h3>
<form name="editcategory" method="post" action="?function=editcategory">
<form name="editcategory" method="post" action="?function=editversion">
<?php
echo"Name: <input name=\"AppName\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"".$row["AppName"]."\" /><br />\n";
echo"Major: <input name=\"Major\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$row["major"]."\" />";
echo"Minor: <input name=\"Minor\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$row["minor"]."\" />";
echo"Release: <input name=\"Release\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$row["release"]."\" />";
echo" <select name=\"SubVer\"/><br />\n";
echo"Name: <input name=\"AppName\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"".$row["AppName"]."\"><br>\n";
echo"Display Version: <input name=\"version\" type=\"text\" size=\"10\" maxlength=\"15\" value=\"$row[Version]\" title=\"User Friendly Version (Ex. 1.0PR instead of 0.10)\"><br>\n";
echo"Major: <input name=\"Major\" type=\"text\" size=\"5\" maxlength=\"3\" value=\"".$row["major"]."\" title=\"Major Version #. (Ex. 1 if 1.0)\">";
echo"Minor: <input name=\"Minor\" type=\"text\" size=\"5\" maxlength=\"3\" value=\"".$row["minor"]."\" title=\"Minor Version #. (Ex. 0 if 1.0)\">";
echo"Release: <input name=\"Release\" type=\"text\" size=\"5\" maxlength=\"3\" value=\"".$row["release"]."\" title=\"Release Version. (Ex. 2 if 1.0.2)\">";
echo"SubVer: <input name=\"SubVer\" type=\"text\" size=\"8\" maxlength=\"5\" value=\"$row[SubVer]\" title=\"SubVersion Value (Ex. a4 if 1.8a4 or + if 0.10+)\"><br>\n";
$subvers = array(""=>"", "+"=>"+", "a"=>"alpha", "b"=>"beta", "final"=>"final");
foreach($subvers as $key => $subver) {
$subver = ucwords($subver);
echo"<option value=\"$key\"";
if ($key==$row["SubVer"]) { echo" selected=\"selected\""; }
echo">$subver</option>\n";
}
echo"</select><br />\n";
echo"GUID: <input name=\"GUID\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"".$row["GUID"]."\" /><br />\n";
echo"<input name=\"appid\" type=\"hidden\" value=\"".$row["AppID"]."\" />\n";
?>
<div style="margin-top: 10px; font-size: 8pt">Should this version be exposed to end-users of the website, or just allowed for extension authors' install.rdf files? In general only release milestones should be exposed.</DIV>
<?php
$public_ver = $row["public_ver"];
echo"Public Version: ";
if ($public_ver=="YES") {
echo"Yes: <input name=\"public_ver\" type=\"radio\" value=\"YES\" checked> No: <input name=\"public_ver\" type=\"radio\" value=\"NO\">\n";
} else if ($public_ver=="NO") {
echo"Yes: <input name=\"public_ver\" type=\"radio\" value=\"YES\"> No: <input name=\"public_ver\" type=\"radio\" value=\"NO\" checked>\n";
}
<input name="submit" type="submit" value="Update" />
<input name="reset" type="reset" value="Reset Form" />
<input name="submit" type="submit" value="Delete Application" onclick="return confirm('Are you sure?');" />
echo"<input name=\"appid\" type=\"hidden\" value=\"".$row["AppID"]."\">\n";
?>
<BR><BR>
<input name="submit" type="submit" value="Update">
<input name="reset" type="reset" value="Reset Form">
<input name="submit" type="submit" value="Delete Version" onclick="return confirm('Are you sure you want to delete <?php echo"$row[AppName] $row[Version]"; ?>?');">
</form>
<BR><BR>
<A HREF="?function=">&#171;&#171; Return to Application Manager</A>
</div>
<?php
} else if ($function=="addnewapp") {
?>
<h1>Add New Application</h1>
<form name="addapplication" method="post" action="?function=&action=addnewapp">
Application Name: <input name="appname" type="text" title="Name of Application (e.g. Firefox)"><BR>
GUID of App: <input name="guid" type="text" size=35 title="Application Identifier"><BR>
Shortname: <input name="shortname" type="text" size="5" maxlength=2 title="two char abbrieviation of appname. (Eg fx for Firefox, or tb for Thunderbird)"><BR>
<BR>
Display Version (e.g. 1.0PR): <input name="version" size=8 maxlength=15 title="User Friendly Version (Ex. 1.0PR instead of 0.10)"><BR>
Major: <input name="Major" type="text" size="5" maxlength="3" value="" title="Major Version #. (Ex. 1 if 1.0)">
Minor: <input name="Minor" type="text" size="5" maxlength="3" value="" title="Minor Version #. (Ex. 0 if 1.0)">
Release: <input name="Release" type="text" size="5" maxlength="3" value="" title="Release Version. (Ex. 2 if 1.0.2)">
SubVer: <input name="SubVer" size="5" maxlength="5" title="SubVersion Value (Ex. a4 if 1.8a4 or + if 0.10+)">
<BR>
<input name="public_ver" type="hidden" value="YES">
<BR>
<input name="submit" type="submit" value="Add Application">&nbsp;<input name="reset" type="reset" value="Reset Form">
</form>
<?php
}
?>

Просмотреть файл

@ -1,65 +1,75 @@
<?php
require"core/sessionconfig.php";
require"../core/config.php";
$function = $_GET["function"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html lang="EN" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<?php
require"../core/config.php";
//Define Breadcrumbs for Header Navigation
$breadcrumbs[]['name'] = "Manage Extension Categories";
$breadcrumbs[]['url'] = "/admin/extcategories.php";
?>
<link rel="stylesheet" type="text/css" href="/admin/core/mozupdates.css">
<title>Mozilla Update :: Category Manager</title>
</head>
<body>
<HTML>
<HEAD>
<TITLE>Mozilla Update :: Developer Control Panel :: Category Manager</TITLE>
<?php
include"$page_header";
include"inc_sidebar.php";
?>
<?php
if ($_SESSION["level"]=="admin") {
//Do Nothing, they're good. :-)
} else {
echo"<h1>Access Denied</h1>\n";
echo"You do not have access to the Category Manager";
include"$page_footer";
echo"</body></html>\n";
exit;
}
?>
<?php
if (!$function) {
?>
<?php
if ($_POST["submit"]=="Create Category") {
if ($_POST[cattype]=="other") {$_POST["cattype"]=$_POST["othertype"];}
$sql = "INSERT INTO `t_categories` (`CatName`, `CatDesc`, `CatType`) VALUES ('$_POST[catname]', '$_POST[catdesc]', '$_POST[cattype]');";
$catname = $_POST["catname"];
$catdesc = $_POST["catdesc"];
$cattype = $_POST["cattype"];
$catapp = $_POST["catapp"];
$sql = "INSERT INTO `t_categories` (`CatName`, `CatDesc`, `CatType`, `CatApp`) VALUES ('$catname', '$catdesc', '$cattype', '$catapp');";
$result = mysql_query($sql) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
}
?>
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1 ALIGN=CENTER STYLE="border: solid 1px #000000; width: 95%" class="listing">
<TR><TD COLSPAN=4 STYLE="background-color: #FFFFFF; font-size:14pt; font-weight: bold;">Manage Category List:&nbsp;&nbsp;<SPAN style="font-size: 10pt">Show: <?php
$sql = "SELECT `CatType` FROM `t_categories` GROUP BY `CatType` ORDER BY `CatType`";
<h1>Manage Category List</h1>
<SPAN style="font-size:8pt">&nbsp;&nbsp;&nbsp;&nbsp; Show Categories for Application: <?php $i=0;
$sql = "SELECT `AppName` from `t_applications` GROUP BY `AppName` ORDER BY `AppName` ASC";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$num_results = mysql_num_rows($sql_result);
while ($row = mysql_fetch_array($sql_result)) {
$i++;
$appname = $row["AppName"];
echo"<a href=\"?application=".strtolower($appname)."\">$appname</a>";
if ($num_results>$i) { echo" / "; }
}
?></span>
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1 ALIGN=CENTER STYLE="border: 0px; width: 100%">
<?php
$typenames = array("E"=>"Extensions", "T"=>"Themes","P"=>"Plugins");
$sql1 = "SELECT `CatType`, `CatApp` FROM `t_categories` WHERE `CatApp`='$application' GROUP BY `CatType` ORDER BY `CatType`";
$sql_result1 = mysql_query($sql1, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row = mysql_fetch_array($sql_result1)) {
$type = ucwords($row["CatType"]);
echo"<a href=\"?function=&type=$type\">";
if ($types[$type]) {$type = $types[$type]; }
echo"$type";
echo"</A> / \n";
}
echo"<a href=\"?function=&type=%\">All</A>\n";
?></SPAN></TD></TR>
$application = strtolower($row["CatApp"]);
$typename=$typenames["$type"];
?>
<tr>
<td class="hline" colspan="4"></td>
<td colspan="4"><h2><?php echo"$typename Categories for ".ucwords($application); ?></h2></td>
</tr>
<tr>
<th></th>
<th>Name</th>
<th>Description</th>
<th>Type</th>
</tr>
<?php
$type = $_GET["type"];
if (!$type) {$type="%"; }
$i=0;
$sql = "SELECT * FROM `t_categories` WHERE `CatType` LIKE '$type' ORDER BY `CatType`,`CatName`";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row = mysql_fetch_array($sql_result)) {
@ -73,28 +83,19 @@ if (!$type) {$type="%"; }
echo"<td>$i</td>\n";
echo"<td><a href=\"?function=editcategory&categoryid=$categoryid\">$catname</a></td>\n";
echo"<td>$catdesc</a></td>\n";
echo"<td>$cattype</td>\n";
echo"</tr>\n";
}
?>
</table>
<div style="width: 640px; border: 1px dotted #AAA; margin-top: 2px; margin-left: 50px; font-size: 10pt; font-weight: bold">
<?php
if ($_POST["submit"]=="Create Category") {
//Disabled Here, See Above ^
// if ($_POST[cattype]=="other") {$_POST["cattype"]=$_POST["othertype"];}
// $sql = "INSERT INTO `t_categories` (`CatName`, `CatDesc`, `CatType`) VALUES ('$_POST[catname]', '$_POST[catdesc]', '$_POST[cattype]');";
// $result = mysql_query($sql) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">The category $_POST[catname] has been Successfully Added...</div>";
}
?>
</table>
<h2>New Category for <?php echo ucwords($application); ?><BR></h2>
<div style="font-size: 10pt; font-weight: bold">
<form name="addapplication" method="post" action="?function=&action=addnewcategory">
<SPAN style="color: #00F">New Category</SPAN>
Name: <input name="catname" type="text" value="" size="30" maxlength="100">
Description: <input name="catdesc" type="text" value="" size="30" maxlength="100"><BR>
<input name="catapp" type="hidden" value="<?php echo strtolower($application); ?>">
Name: <input name="catname" type="text" value="" size="30" maxlength="100"><BR>
Description: <input name="catdesc" type="text" value="" size="50" maxlength="100"><BR>
<SPAN style="margin-left: 20px">Type: <select name="cattype">";
<?php
@ -102,12 +103,13 @@ Description: <input name="catdesc" type="text" value="" size="30" maxlength="100
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row = mysql_fetch_array($sql_result)) {
$type = ucwords($row["CatType"]);
echo"<option value=\"$type\">$type</option>\n";
$typename = $typenames[$type];
echo"<option value=\"$type\">$typename</option>\n";
}
echo"<option value=\"other\">Other</option>\n";
?>
</select>
If other, Type: <INPUT NAME="othertype" TYPE="TEXT" SIZE=5 MAXLENGTH=1>
If other, Type: <INPUT NAME="othertype" TYPE="TEXT" SIZE=3 MAXLENGTH=1>
<input name="submit" type="submit" value="Create Category"></SPAN>
</form>
</div>
@ -117,68 +119,53 @@ If other, Type: <INPUT NAME="othertype" TYPE="TEXT" SIZE=5 MAXLENGTH=1>
$categoryid = $_GET["categoryid"];
//Post Functions
if ($_POST["submit"] == "Update") {
$sql = "UPDATE `t_categories` SET `CatName`='$_POST[catname]', `CatDesc`='$_POST[catdesc]', `CatType`='$_POST[cattype]' WHERE `CategoryID`='$_POST[categoryid]'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<h2>Processing Update, please wait...</h2>\n";
$categoryid = $_POST["categoryid"];
$catname = $_POST["catname"];
$catdesc = $_POST["catdesc"];
$cattype = $_POST["cattype"];
$sql = "UPDATE `t_categories` SET `CatName`='$catname', `CatDesc`='$catdesc', `CatType`='$cattype' WHERE `CategoryID`='$categoryid'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">Your update to $_POST[catname], has been submitted successfully...</div>";
echo"Your update to $catname, has been submitted successfully...<br>";
} else if ($_POST["submit"] == "Delete Category") {
$sql = "DELETE FROM `t_categories` WHERE `CategoryID`='$_POST[categoryid]'";
echo"<h2>Processing Delete Request, please wait...</h2>\n";
$categoryid = $_POST["categoryid"];
$sql = "DELETE FROM `t_categories` WHERE `CategoryID`='$categoryid'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">You've successfully deleted the category '$_POST[catname]'...</div>";
echo"You've successfully deleted the category '$catname'...<br>";
}
if (!$categoryid) { $categoryid = $_POST["categoryid"]; }
// Show Edit Form
$sql = "SELECT * FROM `t_categories` WHERE `CategoryID` = '$categoryid' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
$row = mysql_fetch_array($sql_result);
$categoryid = $row["CategoryID"];
$catapp = ucwords($row["CatApp"]);
$catname = $row["CatName"];
$catdesc = $row["CatDesc"];
$cattype = $row["CatType"];
?>
<div class="editbox">
<h3>Edit Category:</h3>
<h3>Edit Category <?php echo"$catname for ".ucwords($catapp); ?>:</h3>
<form name="editcategory" method="post" action="?function=editcategory">
<?php
echo"Name: <input name=\"catname\" type=\"text\" value=\"$catname\" size=\"30\" maxlength=\"100\"><br />\n";
echo"Description: <input name=\"catdesc\" type=\"text\" value=\"$catdesc\" size=\"30\" maxlength=\"100\"><br />\n";
echo"Type: <input name=\"cattype\" type=\"text\" value=\"$cattype\" size=\"1\" maxlength=\"1\">\n";
echo"<input name=\"categoryid\" type=\"hidden\" value=\"$categoryid\"><br />\n";
echo"Name: <input name=\"catname\" type=\"text\" value=\"$catname\" size=\"30\" maxlength=\"100\"><br>\n";
echo"Description: <input name=\"catdesc\" type=\"text\" value=\"$catdesc\" size=\"50\" maxlength=\"100\"><br>\n";
echo"Type: <input name=\"cattype\" type=\"text\" value=\"$cattype\" size=\"1\" maxlength=\"1\"><br>\n";
echo"<input name=\"categoryid\" type=\"hidden\" value=\"$categoryid\">\n";
?>
<input name="submit" type="submit" value="Update">
<input name="reset" type="reset" value="Reset Form">
<input name="submit" type="submit" value="Delete Category" onclick="return confirm('Are you sure?');">
</form>
<input name="submit" type="submit" value="Delete Category" onclick="return confirm('Are you sure you want to delete the category <?php echo"$catname"; ?> for <?php echo ucwords($catapp); ?>?');">
</form><br>
<A HREF="?function=">&#171;&#171; Return to Category Manager</A>
</div>
<?php
//} else if ($function=="addcategory") {
//Add Category to MySQL Table
//if ($_POST["submit"]=="Create Category") {
// $sql = "INSERT INTO `t_categories` (`CatName`, `CatDesc`, `CatType`) VALUES ('$_POST[catname]', '$_POST[catdesc]', '$_POST[cattype]');";
// $result = mysql_query($sql) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
// echo"<div class=\"success\">The category $_POST[catname] has been Successfully Added...</div>";
//}
?>
<?php
//<div class="editbox">
//<h3>Add New Category:</h3>
//<form name="addcategory" method="post" action="?function=addcategory">
//Name: <input name="catname" type="text" value="" size="30" maxlength="100"><br />
//Description: <input name="catdesc" type="text" value="" size="30" maxlength="100"><br />
//Type: <input name="cattype" type="text" value="E" size="1" maxlength="1"><br />
//<input name="submit" type="submit" value="Create Category">
//<input name="reset" type="reset" value="Reset Form">
//</form>
?>
<?php
} else {}
?>

Просмотреть файл

@ -1,40 +1,34 @@
<?php
require"core/sessionconfig.php";
require"../core/config.php";
$function = $_GET["function"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html lang="EN" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<?php
require"../core/config.php";
//Define Breadcrumbs for Header Navigation
$breadcrumbs[]['name'] = "Manage Application Versions";
$breadcrumbs[]['url'] = "/admin/appmanager.php";
?>
<link rel="stylesheet" type="text/css" href="/admin/core/mozupdates.css">
<title>MozUpdates :: Manage Application Versions</title>
</head>
<body>
<HTML>
<HEAD>
<TITLE>Mozilla Update :: Developer Control Panel :: FAQ Manager</TITLE>
<?php
include"$page_header";
include"inc_sidebar.php";
?>
<?php
if ($_SESSION["level"]=="admin") {
//Do Nothing, they're good. :-)
} else {
echo"<h1>Access Denied</h1>\n";
echo"You do not have access to the FAQ Manager";
include"$page_footer";
echo"</body></html>\n";
exit;
}
?>
<?php
if (!$function) {
?>
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1 ALIGN=CENTER STYLE="border: solid 1px #000000; width: 95%" class="listing">
<TR><TD COLSPAN=5 STYLE="background-color: #FFFFFF; font-size:14pt; font-weight: bold;">Manage FAQs:</TD></TR>
<tr>
<td class="hline" colspan="5"></td>
</tr>
<h1>Manage FAQs:</h1>
<TABLE CELLPADDING=1 CELLSPACING=1 ALIGN=CENTER STYLE="border: 0px; width: 100%">
<TR>
<tr>
<th></th>
@ -70,66 +64,92 @@ if (!$function) {
}
?>
</table>
<div style="width: 580px; border: 1px dotted #AAA; margin-top: 2px; margin-left: 50px; font-size: 10pt; font-weight: bold">
<h2><a href="?function=addentry">New FAQ Entry</A></h2>
<form name="addapplication" method="post" action="?function=addentry">
<a href="?function=addentry">New FAQ Entry</A>
Title: <input name="title" type="text" size="20" maxlength="150" value="">
<input name="submit" type="submit" value="Add Entry"></SPAN>
Title: <input name="title" type="text" size="30" maxlength="150" value="">
<input name="submit" type="submit" value="Next &#187;&#187;"></SPAN>
</form>
</div>
<?php
} else if ($function=="edit") {
$id = $_GET["id"];
//Post Functions
if ($_POST["submit"] == "Update Entry") {
$sql = "UPDATE `t_faq` SET `title`='$_POST[title]', `index`='$_POST[index]', `alias`='$_POST[alias]', `text`='$_POST[text]', `active`='$_POST[active]' WHERE `id`='$_POST[id]'";
echo"<h2>Processing your update, please wait...</h2>\n";
$title = $_POST["title"];
$index = $_POST["index"];
$alias = $_POST["alias"];
$text = $_POST["text"];
$active = $_POST["active"];
$id = $_POST["id"];
$sql = "UPDATE `t_faq` SET `title`='$title', `index`='$index', `alias`='$alias', `text`='$text', `active`='$active' WHERE `id`='$id'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">Your update to $_POST[title], has been successful.</div>";
if ($sql_result) {
echo"Your update to '$title', has been successful.<br>";
}
} else if ($_POST["submit"] == "Delete Entry") {
$sql = "DELETE FROM `t_faq` WHERE `id`='$_POST[id]'";
echo"<h2>Processing, please wait...</h2>\n";
$id = $_POST["id"];
$title = $_POST["title"];
$sql = "DELETE FROM `t_faq` WHERE `id`='$id'";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">You've successfully deleted the application '$_POST[AppName]'.</div>";
if ($sql_result) {
echo"You've successfully deleted the FAQ Entry '$title'.";
include"$page_footer";
echo"</body>\n</html>\n";
exit;
}
}
if (!$id) { $id = $_POST["id"]; }
// Show Edit Form
$sql = "SELECT * FROM `t_faq` WHERE `id` = '$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
$row = mysql_fetch_array($sql_result);
?>
<div class="editbox">
<h3>Edit FAQ Entry:</h3>
<form name="editfaq" method="post" action="?function=edit">
<?php
echo"<input name=\"id\" type=\"hidden\" value=\"".$row["id"]."\" />\n";
echo"Title: <input name=\"title\" type=\"text\" size=\"40\" maxlength=\"150\" value=\"".$row["title"]."\"><br>\n";
echo"Index: <input name=\"index\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$row["index"]."\">&nbsp;&nbsp;";
echo"Alias: <input name=\"alias\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$row["alias"]."\"><br>";
echo"Entry Text:<BR><TEXTAREA NAME=\"text\" ROWS=10 COLS=60>$row[text]</TEXTAREA>";
echo"Title: <input name=\"title\" type=\"text\" size=\"40\" maxlength=\"150\" value=\"".$row["title"]."\"> ";
echo"Alias: <input name=\"alias\" type=\"text\" size=\"8\" maxlength=\"20\" value=\"".$row["alias"]."\"><br>\n";
//List of Entry Index for User Convienience
echo"Existing Index Reference: <SELECT name=\"titleindex\">\n";
$sql = "SELECT `id`,`title`, `index` FROM `t_faq` ORDER BY `index` ASC";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row2 = mysql_fetch_array($sql_result)) {
echo"<OPTION value=\"$row2[index]\"";
if ($row2[id]==$id) {echo" SELECTED";}
echo">$row2[title] (Index: $row2[index])</OPTION>\n";
}
echo"</SELECT><BR>\n";
echo"Index: <input name=\"index\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$row["index"]."\"><BR>\n";
echo"<br>\n";
echo"Entry Text:<BR><TEXTAREA NAME=\"text\" ROWS=10 COLS=60>$row[text]</TEXTAREA><BR>";
$active = $row["active"];
echo"Show Entry on FAQ Page: ";
if ($active=="YES") {
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\" CHECKED>/ No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\">";
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\" CHECKED> No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\">";
} else if ($active=="NO") {
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\">/ No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\" CHECKED>";
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\"> No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\" CHECKED>";
} else {
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\">/ No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\">";
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\"> No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\">";
}
?>
<BR>
<input name="submit" type="submit" value="Update Entry" />
<input name="reset" type="reset" value="Reset Form" />
<input name="submit" type="submit" value="Delete Entry" onclick="return confirm('Are you sure?');" />
<BR><BR>
<input name="submit" type="submit" value="Update Entry">
<input name="reset" type="reset" value="Reset Form">
<input name="submit" type="submit" value="Delete Entry" onclick="return confirm('Are you sure you want to delete <?php echo $row["title"]; ?>?');" />
</form>
<BR><BR>
<A HREF="?function=">&#171;&#171; Return to FAQ Manager</A>
</div>
<?php
} else if ($function=="addentry") {
@ -137,29 +157,51 @@ if ($active=="YES") {
//Add Category to MySQL Table
if ($_POST["submit"]=="Add FAQ Entry") {
$sql = "INSERT INTO `t_faq` (`title`,`index`,`alias`, `text`, `active`) VALUES ('$_POST[title]','$_POST[index]','$_POST[alias]', '$_POST[text]', '$_POST[active]')";
echo"<h2>Adding Entry, please wait...</h2>\n";
$title = $_POST["title"];
$index = $_POST["index"];
$alias = $_POST["alias"];
$text = $_POST["text"];
$active = $_POST["active"];
$id = $_POST["id"];
$sql = "INSERT INTO `t_faq` (`title`,`index`,`alias`, `text`, `active`) VALUES ('$title','$index','$alias', '$text', '$active')";
$sql_result = mysql_query($sql, $connection) or trigger_error("<div class=\"error\">MySQL Error ".mysql_errno().": ".mysql_error()."</div>", E_USER_NOTICE);
echo"<div class=\"success\">The entry $_POST[title] has been successfully added.</div>";
if ($sql_result) {
echo"The entry '$title' has been successfully added.<br>\n";
}
}
?>
<div class="editbox">
<h3>Add FAQ Entry:</h3>
<h2>Add FAQ Entry:</h2>
<form name="addfaq" method="post" action="?function=addentry">
<?php
echo"Title: <input name=\"title\" type=\"text\" size=\"40\" maxlength=\"150\" value=\"$_POST[title]\"><br>\n";
echo"Index: <input name=\"index\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"\">&nbsp;&nbsp;";
echo"Alias: <input name=\"alias\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"\"><br>";
echo"Entry Text:<BR><TEXTAREA NAME=\"text\" ROWS=10 COLS=60></TEXTAREA>";
$title = $_POST["title"];
echo"Title: <input name=\"title\" type=\"text\" size=\"40\" maxlength=\"150\" value=\"$title\">&nbsp;\n";
echo"Alias: <input name=\"alias\" type=\"text\" size=\"8\" maxlength=\"20\" value=\"\"><br>";
//List of Entry Index for User Convienience
echo"<BR>Existing Index Reference: <SELECT name=\"titleindex\">\n";
$sql = "SELECT `id`,`title`, `index` FROM `t_faq` ORDER BY `index` ASC";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row2 = mysql_fetch_array($sql_result)) {
echo"<OPTION value=\"$row2[index]\"";
if ($row2[id]==$id) {echo" SELECTED";}
echo">$row2[title] (Index: $row2[index])</OPTION>\n";
}
echo"</SELECT><BR>\n";
echo"Index: <input name=\"index\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"\"> (used for FAQ page sort order)<br><br>\n";
echo"Entry Text:<BR><TEXTAREA NAME=\"text\" ROWS=10 COLS=60></TEXTAREA><BR>";
echo"Show Entry on FAQ Page: ";
echo"Yes: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"YES\" CHECKED>/ No: <INPUT NAME=\"active\" TYPE=\"RADIO\" VALUE=\"NO\">";
?>
<BR>
<BR><BR>
<input name="submit" type="submit" value="Add FAQ Entry" />
<input name="reset" type="reset" value="Reset Form" />
</form>
<BR><BR>
<A HREF="?function=">&#171;&#171; Return to FAQ Manager</A>
</div>