various cleanup/formating fun

git-svn-id: svn://10.0.0.236/trunk@168083 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mconnor%myrealbox.com
2005-01-20 21:14:13 +00:00
parent 712c70a9ba
commit b1f29b67f6
12 changed files with 436 additions and 367 deletions

View File

@@ -45,62 +45,71 @@ require"../core/config.php";
//Check and see if the CommentID/ID is valid.
$sql = "SELECT `ID`, `CommentID` FROM `feedback` WHERE `ID` = '".escape_string($_GET[id])."' AND `CommentID`='".escape_string($_GET["commentid"])."' LIMIT 1";
$sql = "SELECT `ID`, `CommentID`
FROM `feedback`
WHERE `ID` = '".escape_string($_GET[id])."'
AND `CommentID`='".escape_string($_GET["commentid"])."'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
if(mysql_num_rows($sql_result)=="0") {
unset($_GET["id"],$_GET["commentid"],$id,$commentid);
} else {
$id = escape_string($_GET["id"]);
$commentid = escape_string($_GET["commentid"]);
}
if(mysql_num_rows($sql_result)=="0") {
unset($_GET["id"],$_GET["commentid"],$id,$commentid);
} else {
$id = escape_string($_GET["id"]);
$commentid = escape_string($_GET["commentid"]);
}
//Make Sure action is as expected.
if ($_GET["action"]=="yes") {
$action="yes";
} else if ($_GET["action"]=="no") {
$action="no";
}
//Make Sure action is as expected.
if ($_GET["action"]=="yes") {
$action="yes";
} else if ($_GET["action"]=="no") {
$action="no";
}
if (!$commentid or !$action ) {
//No CommentID / Invalid Action --> Error.
page_error("4","No Comment ID or Action is Invalid");
exit;
}
if (!$commentid or !$action ) {
//No CommentID / Invalid Action --> Error.
page_error("4","No Comment ID or Action is Invalid");
exit;
}
//Get Data for the Comment Record as it stands.
$sql = "SELECT `helpful-yes`,`helpful-no`,`helpful-rating` FROM `feedback` WHERE `CommentID` = '$commentid' LIMIT 1";
$sql = "SELECT `helpful-yes`,`helpful-no`,`helpful-rating`
FROM `feedback`
WHERE `CommentID` = '$commentid'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
$row = mysql_fetch_array($sql_result);
$helpful_yes = $row["helpful-yes"];
$helpful_no = $row["helpful-no"];
$helpful_rating = $row["helpful-rating"];
$row = mysql_fetch_array($sql_result);
$helpful_yes = $row["helpful-yes"];
$helpful_no = $row["helpful-no"];
$helpful_rating = $row["helpful-rating"];
if ($action=="yes") {
$helpful_yes = $helpful_yes+1;
} else if ($action=="no") {
$helpful_no = $helpful_no+1;
}
if ($action=="yes") {
$helpful_yes = $helpful_yes+1;
} else if ($action=="no") {
$helpful_no = $helpful_no+1;
}
//Recompute the Helpful Rating for this Comment
$total = $helpful_yes+$helpful_no;
if ($total=="0") {
$helpful_rating=0;
} else {
if ($helpful_yes>$helpful_no) {
$helpful_rating = ($helpful_yes/$total)*100;
} else {
$helpful_rating = ($helpful_no/$total)*-100;
}
}
$sql = "UPDATE `feedback` SET `helpful-yes`='$helpful_yes',`helpful-no`='$helpful_no',`helpful-rating`='$helpful_rating' WHERE `CommentID`='$commentid' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Recompute the Helpful Rating for this Comment
$total = $helpful_yes+$helpful_no;
if ($total=="0") {
$helpful_rating=0;
} else {
if ($helpful_yes>$helpful_no) {
$helpful_rating = ($helpful_yes/$total)*100;
} else {
$helpful_rating = ($helpful_no/$total)*-100;
}
}
$sql = "UPDATE `feedback`
SET `helpful-yes`='$helpful_yes',`helpful-no`='$helpful_no',`helpful-rating`='$helpful_rating'
WHERE `CommentID`='$commentid' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if ($_GET["type"]=="E") {
$type="extensions";
$type="extensions";
} else if ($_GET["type"]=="T") {
$type="themes";
$type="themes";
}
$return_path="$type/moreinfo.php?id=$id&vid=$vid&".uriparams()."&page=comments&pageid=$_GET[pageid]#$commentid";

View File

@@ -41,27 +41,40 @@
// MySQL Server Configuration Variables
include"dbconfig.php"; // Include Database Server Configuration File
include "dbconfig.php"; // Include Database Server Configuration File
// General Website Configuration Variables
$websitepath = "/opt/update-beta"; // Local Path to Site Files
$repositorypath = "/opt/update-beta/files/"; //Path to XPI/JAR Respository
$sitehostname = $_SERVER["SERVER_NAME"]; // DNS Hostname, ex. "update.mozilla.org"
$ftpurl = "http://ftp.mozilla.org/pub/mozilla.org"; // URL to FTP site
// Local Path to Site Files
$websitepath = "/opt/update-beta";
// Path to XPI/JAR Respository
$repositorypath = "/opt/update-beta/files/";
// DNS Hostname, ex. "update.mozilla.org"
$sitehostname = $_SERVER["SERVER_NAME"];
// URL to FTP site
$ftpurl = "http://ftp.mozilla.org/pub/mozilla.org";
// Page Header and Footer Path Variables
$page_header = "$websitepath/core/inc_header.php"; // Path to Page Header on Disk
$page_footer = "$websitepath/core/inc_footer.php"; // Path to Page Footer on Disk
// Path to Page Header on Disk
$page_header = "$websitepath/core/inc_header.php";
// Path to Page Footer on Disk
$page_footer = "$websitepath/core/inc_footer.php";
//Function: getmicrotime() - Page Load Timing Debug Function
function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
// Update Core Include Files
include"inc_guids.php"; // GUID --> AppName Handler
include"inc_global.php"; // Global Functions - Variable Cleanup
include"inc_browserdetection.php"; //Browser Detection - App Variable Handling
include "inc_guids.php"; // GUID --> AppName Handler
include "inc_global.php"; // Global Functions - Variable Cleanup
include "inc_browserdetection.php"; //Browser Detection - App Variable Handling
?>

View File

@@ -135,7 +135,11 @@ if (!$application) { $application="firefox"; } //Default App is Firefox
//App_Version
//Get Max Version for Application Specified
if (!$app_version) {
$sql = "SELECT `major`,`minor`,`release`,`SubVer` FROM `applications` WHERE `AppName` = '$application' ORDER BY `major` DESC, `minor` DESC, `release` DESC, `SubVer` DESC LIMIT 1";
$sql = "SELECT `major`,`minor`,`release`,`SubVer`
FROM `applications`
WHERE `AppName` = '$application'
ORDER BY `major` DESC, `minor` DESC, `release` DESC, `SubVer` DESC
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);
$release = "$row[major].$row[minor]";
@@ -152,7 +156,11 @@ if (!$app_version) {
//Check for Internal Versioning for the $app_version
$sql = "SELECT `int_version`,`major`,`minor`,`release`,`SubVer` FROM `applications` WHERE `AppName`='$application' AND `int_version` IS NOT NULL ORDER BY `major` DESC, `minor` DESC, `release` DESC, `SubVer` DESC";
$sql = "SELECT `int_version`,`major`,`minor`,`release`,`SubVer`
FROM `applications`
WHERE `AppName`='$application'
AND `int_version` IS NOT NULL
ORDER BY `major` DESC, `minor` DESC, `release` DESC, `SubVer` DESC";
$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)) {
$release = "$row[major].$row[minor]";

View File

@@ -40,13 +40,13 @@
//Cache Control Headers
if ($nocache==TRUE) {
$expstr = gmdate("D, d M Y H:i:s", time() - 1800) . " GMT";
header("Expires: $expstr");
header("Cache-Control: public, max-age=0");
$expstr = gmdate("D, d M Y H:i:s", time() - 1800) . " GMT";
header("Expires: $expstr");
header("Cache-Control: public, max-age=0");
} else {
$expstr = gmdate("D, d M Y H:i:s", time() + 1800) . " GMT";
header("Expires: $expstr");
header("Cache-Control: public, max-age=1800");
$expstr = gmdate("D, d M Y H:i:s", time() + 1800) . " GMT";
header("Expires: $expstr");
header("Cache-Control: public, max-age=1800");
}
// ---------------------------
@@ -54,47 +54,52 @@ header("Cache-Control: public, max-age=1800");
// ---------------------------
function escape_string($value)
{
// Stripslashes if we need to
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Stripslashes if we need to
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote it if it's not an integer
if (!is_numeric($value)) {
$value = mysql_real_escape_string($value);
}
// Quote it if it's not an integer
if (!is_numeric($value)) {
$value = mysql_real_escape_string($value);
}
return $value;
return $value;
}
//Remove HTML tags and escape enities from GET/POST vars.
foreach ($_GET as $key => $val) {
$_GET["$key"] = htmlentities(str_replace("\\","",strip_tags($_GET["$key"])));
$_GET["$key"] = htmlentities(str_replace("\\","",strip_tags($_GET["$key"])));
}
foreach ($_POST as $key => $val) {
if (!is_array($_POST["$key"])) {
$_POST["$key"] = htmlentities(str_replace("\\","",strip_tags($_POST["$key"])));
}
if (!is_array($_POST["$key"])) {
$_POST["$key"] = htmlentities(str_replace("\\","",strip_tags($_POST["$key"])));
}
}
// Bug 250596 Fixes for incoming $_GET variables.
if ($_GET["application"]) {
$_GET["application"] = escape_string(strtolower($_GET["application"]));
$sql = "SELECT AppID FROM `applications` WHERE `AppName` = '".ucwords(strtolower($_GET["application"]))."' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)===0) {unset($_GET["application"]);}
$_GET["application"] = escape_string(strtolower($_GET["application"]));
$sql = "SELECT AppID FROM `applications`
WHERE `AppName` = '".ucwords(strtolower($_GET["application"]))."'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)===0) {unset($_GET["application"]);}
}
if ($_GET["category"] AND $_GET["category"] !=="All"
AND $_GET["category"] !=="Editors Pick" AND $_GET["category"] !=="Popular"
AND $_GET["category"] !=="Top Rated" AND $_GET["category"] !=="Newest") {
$sql = "SELECT CatName FROM `categories` WHERE `CatName` = '".escape_string(ucwords(strtolower($_GET["category"])))."' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)===0) {unset($_GET["category"]);}
AND $_GET["category"] !=="Editors Pick" AND $_GET["category"] !=="Popular"
AND $_GET["category"] !=="Top Rated" AND $_GET["category"] !=="Newest") {
$sql = "SELECT CatName
FROM `categories`
WHERE `CatName` = '".escape_string(ucwords(strtolower($_GET["category"])))."'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)===0) {unset($_GET["category"]);}
}
if (!is_numeric($_GET["id"])) { unset($_GET["id"]); }
@@ -105,46 +110,46 @@ if (!is_numeric($_GET["numpg"])) { unset($_GET["numpg"]); }
// page_error() function
function page_error($reason, $custom_message) {
global $page_header, $page_footer;
global $page_header, $page_footer;
echo"<TITLE>Mozilla Update :: Error</TITLE>\n";
echo"<TITLE>Mozilla Update :: Error</TITLE>\n";
include"$page_header";
echo"<div id=\"mBody\">";
echo"<h1>Mozilla Update :: Error</h1>\n";
echo"<SPAN style=\"font-size: 12pt\">\n";
echo"Mozilla Update has encountered an error and is unable to fulfill your request. Please try your request again later. If the
problem continues, please contact the Mozilla Update staff. More information about the error may be found at the end of this
message.<BR><BR>
Error $reason: $custom_message<BR><BR>
&nbsp;&nbsp;&nbsp;<A HREF=\"javascript:history.back()\">&#171;&#171; Go Back to Previous Page</A>";
echo"</SPAN>\n";
echo"</div>\n";
include"$page_footer";
echo"</body>\n</html>\n";
exit;
include"$page_header";
echo"<div id=\"mBody\">";
echo"<h1>Mozilla Update :: Error</h1>\n";
echo"<SPAN style=\"font-size: 12pt\">\n";
echo"Mozilla Update has encountered an error and is unable to fulfill your request. Please try your request again later. If the
problem continues, please contact the Mozilla Update staff. More information about the error may be found at the end of this
message.<BR><BR>
Error $reason: $custom_message<BR><BR>
&nbsp;&nbsp;&nbsp;<A HREF=\"javascript:history.back()\">&#171;&#171; Go Back to Previous Page</A>";
echo"</SPAN>\n";
echo"</div>\n";
include"$page_footer";
echo"</body>\n</html>\n";
exit;
}
function writeFormKey()
{
$sql = "SELECT UserPass FROM userprofiles WHERE UserID = '".$_SESSION["uid"]."'";
$res = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($res);
echo "<input type=\"hidden\" name=\"formkey\" value=\"".md5($row["UserPass"])."\">\n";
$sql = "SELECT UserPass FROM userprofiles WHERE UserID = '".$_SESSION["uid"]."'";
$res = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($res);
echo "<input type=\"hidden\" name=\"formkey\" value=\"".md5($row["UserPass"])."\">\n";
}
function checkFormKey()
{
$key = $_POST["formkey"];
$sql = "SELECT UserPass FROM userprofiles WHERE UserID = '".$_SESSION["uid"]."'";
$res = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($res);
if ($key != md5($row["UserPass"]))
{
echo "<br><font size=+2 color='red'>WARNING: FORMKEY MISMATCH!</font><br>\n";
return false;
}
return true;
$key = $_POST["formkey"];
$sql = "SELECT UserPass FROM userprofiles WHERE UserID = '".$_SESSION["uid"]."'";
$res = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$row = mysql_fetch_array($res);
if ($key != md5($row["UserPass"]))
{
echo "<br><font size=+2 color='red'>WARNING: FORMKEY MISMATCH!</font><br>\n";
return false;
}
return true;
}
// -----------------------------
@@ -153,27 +158,27 @@ function checkFormKey()
// -----------------------------
function uriparams() {
global $app_version, $application, $items_per_page, $category, $OS, $uriparams_skip;
$uriparams = "";
global $app_version, $application, $items_per_page, $category, $OS, $uriparams_skip;
$uriparams = "";
if ($application and $uriparams_skip !="application") { $uriparams .="application=$application&amp;"; }
if ($app_version and $uriparams_skip !="application") { $uriparams .="version=$app_version&amp;"; }
if ($OS) { $uriparams .="os=$OS&amp;"; }
if ($category and $uriparams_skip !="category") { $uriparams .="category=$category&amp;"; }
if ($items_per_page) { $uriparams .="numpg=$items_per_page"; }
if (substr($uriparams, -1)==";") {
$uriparams = substr($uriparams,0,strlen($uriparams)-5);
}
return $uriparams;
if ($application and $uriparams_skip !="application") { $uriparams .="application=$application&amp;"; }
if ($app_version and $uriparams_skip !="application") { $uriparams .="version=$app_version&amp;"; }
if ($OS) { $uriparams .="os=$OS&amp;"; }
if ($category and $uriparams_skip !="category") { $uriparams .="category=$category&amp;"; }
if ($items_per_page) { $uriparams .="numpg=$items_per_page"; }
if (substr($uriparams, -1)==";") {
$uriparams = substr($uriparams,0,strlen($uriparams)-5);
}
return $uriparams;
}
// -----------------------------
// function installtrigger() -- print installtrigger function for extension/theme installation on page.
// Usage null uriparams(string functionname)
// Usage null uriparams(string functionname)
// -----------------------------
function installtrigger($functionname) {
if ($functionname=="extensions") {
if ($functionname=="extensions") {
echo'
<script type="text/javascript">
<!--
@@ -198,7 +203,7 @@ function installtrigger($functionname) {
';
} else if ($functionname=="themes") {
} else if ($functionname=="themes") {
echo'
<script type="text/javascript">
<!--
@@ -213,7 +218,7 @@ function installtrigger($functionname) {
-->
</script>
';
}
}
}
?>

View File

@@ -38,12 +38,10 @@
//Reset GUIDs to something human-readable
if ($_GET["application"]=="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") {
$_GET["application"]="firefox";
$_GET["application"]="firefox";
} else if ($_GET["application"]=="{3550f703-e582-4d05-9a08-453d09bdfdc6}") {
$_GET["application"]="thunderbird";
$_GET["application"]="thunderbird";
} else if ($_GET["application"]=="{86c18b42-e466-45a9-ae7a-9b95ba6f5640}") {
$_GET["application"]="mozilla";
$_GET["application"]="mozilla";
}
?>

View File

@@ -37,7 +37,7 @@
// ***** END LICENSE BLOCK *****
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="mozilla update, mozilla extensions, mozilla plugins, thunderbird themes, thunderbird extensions, firefox extensions, firefox themes,">
<link rel="stylesheet" type="text/css" href="/css/print.css" media="print">

View File

@@ -43,79 +43,79 @@ require"../core/config.php";
$uri = escape_string(str_replace(" ","+",$_GET["uri"]));
$sql = "SELECT `vID`, TM.ID, `URI` FROM `version` TV INNER JOIN `main` TM ON TM.ID=TV.ID WHERE `URI`='$uri' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)=="0") {
exit("Invalid URI cannot Continue");
}
if (mysql_num_rows($sql_result)=="0") {
exit("Invalid URI cannot Continue");
}
$row = mysql_fetch_array($sql_result);
$uri=$row["URI"];
$id = $row["ID"];
$vid = $row["vID"];
$row = mysql_fetch_array($sql_result);
$uri=$row["URI"];
$id = $row["ID"];
$vid = $row["vID"];
// New DownloadCount management Code..
//Check for user, to see if they recently accessed this file (filters duplicate/triplicate+ requests in a short period).
$maxlife = date("YmdHis", mktime(date("H"), date("i")-10, date("s"), date("m"), date("d"), date("Y")));
//Are we behind a proxy and given the IP via an alternate enviroment variable? If so, use it.
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
$remote_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
$remote_addr = $_SERVER["REMOTE_ADDR"];
}
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
$remote_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
$remote_addr = $_SERVER["REMOTE_ADDR"];
}
$sql = "SELECT `dID` FROM `downloads` WHERE `ID`='$id' AND `vID`='$vid' AND `user_ip`='$remote_addr' AND `user_agent` = '$_SERVER[HTTP_USER_AGENT]' AND `date`>'$maxlife' AND `type`='download' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)=="0") {
//Insert a record of this download for the next 10 minutes anyway. :-)
$today=date("YmdHis");
if (mysql_num_rows($sql_result)=="0") {
//Insert a record of this download for the next 10 minutes anyway. :-)
$today=date("YmdHis");
$sql = "INSERT INTO `downloads` (`ID`,`date`,`vID`, `user_ip`, `user_agent`, `type`) VALUES ('$id','$today','$vid', '$remote_addr', '$_SERVER[HTTP_USER_AGENT]', 'download');";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$sql = "INSERT INTO `downloads` (`ID`,`date`,`vID`, `user_ip`, `user_agent`, `type`) VALUES ('$id','$today','$vid', '$remote_addr', '$_SERVER[HTTP_USER_AGENT]', 'download');";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Cleanup the Individual Downloads part of the table for old records
$sql = "DELETE FROM `downloads` WHERE `date`<'$maxlife' AND `type`='download'";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Cleanup the Individual Downloads part of the table for old records
$sql = "DELETE FROM `downloads` WHERE `date`<'$maxlife' AND `type`='download'";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$today=date("Ymd")."000000";
$today=date("Ymd")."000000";
//Per day download tracking -- Record hits for this day in the record (if it doesn't exist create it)
$sql = "SELECT `dID` FROM `downloads` WHERE `ID`='$id' AND `date`='$today' AND `type`='count' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)=="0") {
$sql = "INSERT INTO `downloads` (`ID`,`date`,`downloadcount`,`type`) VALUES ('$id','$today','1','count');";
} else {
$row = mysql_fetch_array($sql_result);
$sql = "UPDATE `downloads` SET `downloadcount`=downloadcount+1 WHERE `dID`='$row[dID]' LIMIT 1";
}
//Per day download tracking -- Record hits for this day in the record (if it doesn't exist create it)
$sql = "SELECT `dID` FROM `downloads` WHERE `ID`='$id' AND `date`='$today' AND `type`='count' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)=="0") {
$sql = "INSERT INTO `downloads` (`ID`,`date`,`downloadcount`,`type`) VALUES ('$id','$today','1','count');";
} else {
$row = mysql_fetch_array($sql_result);
$sql = "UPDATE `downloads` SET `downloadcount`=downloadcount+1 WHERE `dID`='$row[dID]' LIMIT 1";
}
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Download Statistic Management Code -- Maintain the last 7 days record count
$mindate = date("Ymd", mktime(0, 0, 0, date("m"), date("d")-7, date("Y")))."000000";
$downloadcount="0";
$sql = "SELECT `downloadcount` FROM `downloads` WHERE `ID`='$id' AND `date`>='$mindate' AND `type`='count' ORDER BY `date` DESC";
$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)) {
$downloadcount = $downloadcount+$row["downloadcount"];
}
//Download Statistic Management Code -- Maintain the last 7 days record count
$mindate = date("Ymd", mktime(0, 0, 0, date("m"), date("d")-7, date("Y")))."000000";
$downloadcount="0";
$sql = "SELECT `downloadcount` FROM `downloads` WHERE `ID`='$id' AND `date`>='$mindate' AND `type`='count' ORDER BY `date` DESC";
$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)) {
$downloadcount = $downloadcount+$row["downloadcount"];
}
//Update the 7 day count in the main record.
$sql = "UPDATE `main` SET `downloadcount`='$downloadcount' WHERE `ID`='$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Update the 7 day count in the main record.
$sql = "UPDATE `main` SET `downloadcount`='$downloadcount' WHERE `ID`='$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Update the total downloadcount in the main record.
$sql = "UPDATE `main` SET `TotalDownloads`=TotalDownloads+1 WHERE `ID`='$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Update the total downloadcount in the main record.
$sql = "UPDATE `main` SET `TotalDownloads`=TotalDownloads+1 WHERE `ID`='$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Clean up the Counts per day for >8 days.
$sql = "DELETE FROM `downloads` WHERE `ID`='$id' AND `date`<'$mindate' AND `type`='count'";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
}
//Clean up the Counts per day for >8 days.
$sql = "DELETE FROM `downloads` WHERE `ID`='$id' AND `date`<'$mindate' AND `type`='count'";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
}
//Send User on their way to the file, if requested...
if ($_GET["passthrough"]=="yes") {
header("Location: $uri");
header("Location: $uri");
}
?>

View File

@@ -43,36 +43,36 @@ require"../core/config.php";
//Check and see if the ID/vID is valid.
$sql = "SELECT TM.ID, TV.vID FROM `main` TM INNER JOIN `version` TV ON TM.ID=TV.ID WHERE TM.ID = '".escape_string($_POST[id])."' AND `vID`='".escape_string($_POST["vid"])."' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
if(mysql_num_rows($sql_result)=="0") {
unset($_POST["id"],$_POST["vid"],$id,$vid);
} else {
$id = escape_string($_POST["id"]);
$vid = escape_string($_POST["vid"]);
}
if(mysql_num_rows($sql_result)=="0") {
unset($_POST["id"],$_POST["vid"],$id,$vid);
} else {
$id = escape_string($_POST["id"]);
$vid = escape_string($_POST["vid"]);
}
$name = escape_string(strip_tags($_POST["name"]));
$title = escape_string(strip_tags($_POST["title"]));
$rating = escape_string($_POST["rating"]);
$comments = nl2br(strip_tags(escape_string($_POST["comments"])));
$email = escape_string($_POST["email"]);
if (!$name) {
$name="Anonymous";
}
if (!$title) {
$title="No Title";
}
$name = escape_string(strip_tags($_POST["name"]));
$title = escape_string(strip_tags($_POST["title"]));
$rating = escape_string($_POST["rating"]);
$comments = nl2br(strip_tags(escape_string($_POST["comments"])));
$email = escape_string($_POST["email"]);
if (!$name) {
$name="Anonymous";
}
if (!$title) {
$title="No Title";
}
//Make Sure Rating is as expected.
if (is_numeric($rating) and $rating<=5 and $rating>=0) {
} else {
unset($rating);
}
//Make Sure Rating is as expected.
if (is_numeric($rating) and $rating<=5 and $rating>=0) {
} else {
unset($rating);
}
if (!$rating or !$comments ) {
//No Rating or Comment Defined, throw an error.
page_error("3","Comment is Blank or Rating is Null.");
exit;
}
if (!$rating or !$comments ) {
//No Rating or Comment Defined, throw an error.
page_error("3","Comment is Blank or Rating is Null.");
exit;
}
//Compile Info about What Version of the item this comment is about.
@@ -81,78 +81,93 @@ $sql = "SELECT TV.Version, `OSName`, `AppName` FROM `version` TV
INNER JOIN `applications` TA ON TA.AppID=TV.AppID
WHERE TV.ID = '$id' AND TV.vID='$vid' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
$row = mysql_fetch_array($sql_result);
$version = $row["Version"];
$os = $row["OSName"];
$appname = $row["AppName"];
$versiontagline = "version $version for $appname";
if ($os !=="ALL") {$versiontagline .=" on $os"; }
$row = mysql_fetch_array($sql_result);
$version = $row["Version"];
$os = $row["OSName"];
$appname = $row["AppName"];
$versiontagline = "version $version for $appname";
if ($os !=="ALL") {$versiontagline .=" on $os"; }
//Are we behind a proxy and given the IP via an alternate enviroment variable? If so, use it.
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
$remote_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
$remote_addr = $_SERVER["REMOTE_ADDR"];
}
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
$remote_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
$remote_addr = $_SERVER["REMOTE_ADDR"];
}
//Check the Formkey against the DB, and see if this has already been posted...
$formkey = escape_string($_POST["formkey"]);
$date = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d")-1, date("Y")));
$sql = "SELECT `CommentID` FROM `feedback` WHERE `formkey` = '$formkey' AND `CommentDate`>='$date'";
$sql = "SELECT `CommentID`
FROM `feedback`
WHERE `formkey` = '$formkey'
AND `CommentDate`>='$date'";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
if (mysql_num_rows($sql_result)=="0") {
//FormKey check passed, now let's see if this IP is banned...
$sql = "SELECT `bID` from `feedback_ipbans` WHERE `beginip` <= '$remote_addr' AND `endip` >='$remote_addr' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
if (mysql_num_rows($sql_result)=="0") {
//FormKey check passed, now let's see if this IP is banned...
$sql = "SELECT `bID`
FROM `feedback_ipbans`
WHERE `beginip` <= '$remote_addr'
AND `endip` >='$remote_addr'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
if (mysql_num_rows($sql_result)=="0") {
//No Bans Returned, Proceed...
//FormKey doesn't exist, go ahead and add their comment.
$sql = "INSERT INTO `feedback` (`ID`, `CommentName`, `CommentVote`, `CommentTitle`, `CommentNote`, `CommentDate`, `commentip`, `email`, `formkey`, `VersionTagline`) VALUES ('$id', '$name', '$rating', '$title', '$comments', NOW(NULL), '$remote_addr', '$email', '$formkey', '$versiontagline');";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
//Get Rating Data and Create $ratingarray
$date = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d")-30, date("Y")));
$sql = "SELECT ID, CommentVote FROM `feedback` WHERE `ID` = '$id' AND `CommentDate`>='$date' AND `CommentVote` IS NOT NULL";
$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)) {
$ratingarray[$row[ID]][] = $row["CommentVote"];
}
//Compile Rating Average
if (!$ratingarray[$id]) {
$ratingarray[$id] = array();
}
$numratings = count($ratingarray[$id]);
$sumratings = array_sum($ratingarray[$id]);
if ($numratings>0) {
$rating = round($sumratings/$numratings, 1);
} else {
$rating="2.5"; //Default Rating
}
//FormKey doesn't exist, go ahead and add their comment.
$sql = "INSERT INTO `feedback` (`ID`, `CommentName`, `CommentVote`, `CommentTitle`, `CommentNote`, `CommentDate`, `commentip`, `email`, `formkey`, `VersionTagline`)
VALUES ('$id', '$name', '$rating', '$title', '$comments', NOW(NULL), '$remote_addr', '$email', '$formkey', '$versiontagline');";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$sql = "UPDATE `main` SET `Rating`='$rating' WHERE `ID`='$id' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
} else {
//User is Banned, Add Param to URI to throw an error about this...
$action="ipbanned";
//Get Rating Data and Create $ratingarray
$date = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d")-30, date("Y")));
$sql = "SELECT ID, CommentVote
FROM `feedback`
WHERE `ID` = '$id'
AND `CommentDate`>='$date'
AND `CommentVote` IS NOT NULL";
$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)) {
$ratingarray[$row[ID]][] = $row["CommentVote"];
}
//Compile Rating Average
if (!$ratingarray[$id]) {
$ratingarray[$id] = array();
}
$numratings = count($ratingarray[$id]);
$sumratings = array_sum($ratingarray[$id]);
if ($numratings > 0) {
$rating = round($sumratings/$numratings, 1);
} else {
$rating = "2.5"; //Default Rating
}
$sql = "UPDATE `main`
SET `Rating`='$rating'
WHERE `ID`='$id'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
} else {
//User is Banned, Add Param to URI to throw an error about this...
$action="ipbanned";
}
}
if ($_POST["type"]=="E") {
$type="extensions";
$type="extensions";
} else if ($_POST["type"]=="T") {
$type="themes";
$type="themes";
}
if (!$action) {
$action="successful";
$action="successful";
}
$return_path="$type/moreinfo.php?id=$id&vid=$vid&page=comments&action=$action";

View File

@@ -41,36 +41,43 @@ require"../core/config.php";
//Check and see if the CommentID/ID is valid.
$sql = "SELECT `ID`, `CommentID` FROM `feedback` WHERE `ID` = '".escape_string($_GET[id])."' AND `CommentID`='".escape_string($_GET["commentid"])."' LIMIT 1";
$sql = "SELECT `ID`, `CommentID`
FROM `feedback`
WHERE `ID` = '".escape_string($_GET[id])."'
AND `CommentID`='".escape_string($_GET["commentid"])."'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
if(mysql_num_rows($sql_result)=="0") {
unset($_GET["id"],$_GET["commentid"],$id,$commentid);
} else {
$id = escape_string($_GET["id"]);
$commentid = escape_string($_GET["commentid"]);
}
if(mysql_num_rows($sql_result)=="0") {
unset($_GET["id"],$_GET["commentid"],$id,$commentid);
} else {
$id = escape_string($_GET["id"]);
$commentid = escape_string($_GET["commentid"]);
}
//Make Sure action is as expected.
if ($_GET["action"]=="report") {
$action="yes";
}
//Make Sure action is as expected.
if ($_GET["action"]=="report") {
$action="yes";
}
if (!$commentid or !$action ) {
//No CommentID / Invalid Action --> Error.
page_error("4","No Comment ID or Action is Invalid");
exit;
}
if (!$commentid or !$action ) {
//No CommentID / Invalid Action --> Error.
page_error("4","No Comment ID or Action is Invalid");
exit;
}
//Set Flag on the Comment Record
$sql = "UPDATE `feedback` SET `flag`='YES' WHERE `CommentID`='$commentid' LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$sql = "UPDATE `feedback`
SET `flag`='YES'
WHERE `CommentID`='$commentid'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if ($_GET["type"]=="E") {
$type="extensions";
$type="extensions";
} else if ($_GET["type"]=="T") {
$type="themes";
$type="themes";
}
$return_path="$type/moreinfo.php?id=$id&vid=$vid&".uriparams()."&page=comments&pageid=$_GET[pageid]#$commentid";
@@ -80,6 +87,7 @@ $return_path="$type/moreinfo.php?id=$id&vid=$vid&".uriparams()."&page=comments&p
<head>
<title>Mozilla Update :: Report a Comment</title>
</head>
<body>
<?php
include"$page_header";

View File

@@ -46,7 +46,10 @@ require"../core/config.php";
<?php
//Bookmarking-Friendly Page Title
$id = escape_string($_GET["id"]);
$sql = "SELECT UserName FROM `userprofiles` WHERE UserID = '$id' LIMIT 1";
$sql = "SELECT UserName
FROM `userprofiles`
WHERE UserID = '$id'
LIMIT 1";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
if (mysql_num_rows($sql_result)===0) {
$return = page_error("2","Author ID is Invalid or Missing.");
@@ -72,27 +75,34 @@ include"$page_header";
<?php
$userid = escape_string($_GET["id"]);
$sql = "SELECT * FROM `userprofiles` WHERE `UserID` = '$userid' 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);
$userid = $row["UserID"];
$username = $row["UserName"];
$useremail = $row["UserEmail"];
$userwebsite = $row["UserWebsite"];
$usermode = $row["UserMode"];
$useremailhide = $row["UserEmailHide"];
$sql = "SELECT *
FROM `userprofiles`
WHERE `UserID` = '$userid'
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);
$userid = $row["UserID"];
$username = $row["UserName"];
$useremail = $row["UserEmail"];
$userwebsite = $row["UserWebsite"];
$usermode = $row["UserMode"];
$useremailhide = $row["UserEmailHide"];
if ($usermode=="A") {
$usermode_text = "Mozilla Update Administrator";
} else if ($usermode=="E") {
$usermode_text = "Mozilla Update Editor";
} else if ($usermode=="U") {
$usermode_text = "Extension/Theme Author";
}
if ($usermode=="A") {
$usermode_text = "Mozilla Update Administrator";
} else if ($usermode=="E") {
$usermode_text = "Mozilla Update Editor";
} else if ($usermode=="U") {
$usermode_text = "Extension/Theme Author";
}
?>
<h2>Author Profile &#187; <?php echo"$username"; ?></h2>
<?php if ($usermode_text) { echo"<div style=\"margin-bottom: 5px\"><strong>$usermode_text</strong></div>\n"; } ?>
<?php
if ($usermode_text)
echo"<div style=\"margin-bottom: 5px\"><strong>$usermode_text</strong></div>\n";
?>
Homepage: <?php
if ($userwebsite) {echo"<A HREF=\"$userwebsite\">$userwebsite</A>";
@@ -110,23 +120,28 @@ echo"<A HREF=\"mailto:$useremail\">$useremail</A>";
&nbsp;<BR>
<h2>All Extensions and Themes by <?php echo"$username"; ?></h2>
<?php
$sql = "SELECT TM.ID, TM.Type, TM.Name, TM.Description, TM.DateUpdated, TM.TotalDownloads, TU.UserEmail FROM `main` TM
LEFT JOIN authorxref TAX ON TM.ID = TAX.ID
INNER JOIN userprofiles TU ON TAX.UserID = TU.UserID
WHERE TU.UserID = '$userid' AND TM.Type !='P'
ORDER BY `Type` , `Name` ";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$numresults = mysql_num_rows($sql_result);
while ($row = mysql_fetch_array($sql_result)) {
$sql2 = "SELECT `vID`, `Version` FROM `version` WHERE `ID` = '$row[ID]' AND `approved` = 'YES' ORDER BY `Version` ASC LIMIT 1";
$sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$sql = "SELECT TM.ID, TM.Type, TM.Name, TM.Description,
TM.DateUpdated, TM.TotalDownloads, TU.UserEmail
FROM `main` TM
LEFT JOIN authorxref TAX ON TM.ID = TAX.ID
INNER JOIN userprofiles TU ON TAX.UserID = TU.UserID
WHERE TU.UserID = '$userid' AND TM.Type !='P'
ORDER BY `Type` , `Name` ";
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
$numresults = mysql_num_rows($sql_result);
while ($row = mysql_fetch_array($sql_result)) {
$sql2 = "SELECT `vID`, `Version`
FROM `version`
WHERE `ID` = '$row[ID]'
AND `approved` = 'YES'
ORDER BY `Version` ASC
LIMIT 1";
$sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
while ($row2 = mysql_fetch_array($sql_result2)) {
$vid = $row2["vID"];
$version = $row2["Version"];
$vid = $row2["vID"];
$version = $row2["Version"];
$v++;
$v++;
$id = $row["ID"];
$type = $row["Type"];
$name = $row["Name"];
@@ -137,27 +152,27 @@ $v++;
$authors = $row["UserEmail"];
$downloadcount = $row["TotalDownloads"];
$day=substr($dateupdated,8,2); //get the day
$month=substr($dateupdated,5,2); //get the month
$year=substr($dateupdated,0,4); //get the year
$hour=substr($dateupdated,11,2); //get the hour
$minute=substr($dateupdated,14,2); //get the minute
$second=substr($dateupdated,17,2); //get the sec
$day = substr($dateupdated,8,2); //get the day
$month = substr($dateupdated,5,2); //get the month
$year = substr($dateupdated,0,4); //get the year
$hour = substr($dateupdated,11,2); //get the hour
$minute = substr($dateupdated,14,2); //get the minute
$second = substr($dateupdated,17,2); //get the sec
$timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
$dateupdated = gmdate("F d, Y g:i:sa", $timestamp); //gmdate("F d, Y", $dutimestamp);
if ($type=="E") {
$typename = "extensions";
} else if ($type=="T") {
$typename = "themes";
}
if ($type == "E") {
$typename = "extensions";
} else if ($type == "T") {
$typename = "themes";
}
echo"<h3><A HREF=\"/$typename/moreinfo.php?".uriparams()."&amp;id=$id\">$name</A></h3>";
echo"$description<br>\n";
}
echo"<h3><A HREF=\"/$typename/moreinfo.php?".uriparams()."&amp;id=$id\">$name</A></h3>";
echo"$description<br>\n";
}
}
if ($numresults=="0") {
echo"No Extensions or Themes in the Database for $username";
echo"No Extensions or Themes in the Database for $username";
}
?>
</DIV>

View File

@@ -36,59 +36,57 @@
// the terms of any one of the MPL, the GPL or the LGPL.
//
// ***** END LICENSE BLOCK *****
?>
<?php
// http://blogs.law.harvard.edu/tech/rss
switch ($type) {
case "E":
$listType = "Extensions";
break;
$listType = "Extensions";
break;
case "P":
$listType = "Plugins";
break;
$listType = "Plugins";
break;
case "T":
$listType = "Themes";
break;
$listType = "Themes";
break;
}
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
echo " <title>" . htmlspecialchars($sitetitle,ENT_NOQUOTES,UTF-8) . "::" . htmlspecialchars($list,ENT_NOQUOTES,UTF-8) . " " . $listType . "</title>\n";
echo " <title>" . htmlspecialchars($sitetitle,ENT_NOQUOTES,"UTF-8") . "::" . htmlspecialchars($list,ENT_NOQUOTES,"UTF-8") . " " . $listType . "</title>\n";
echo " <link>" . $siteurl . "</link>\n";
echo " <description>" . htmlspecialchars($sitedescription,ENT_NOQUOTES,UTF-8) .
"</description>\n";
echo " <description>" . htmlspecialchars($sitedescription,ENT_NOQUOTES,"UTF-8") . "</description>\n";
echo " <language>" . $sitelanguage . "</language>\n";
echo " <copyright>" . htmlspecialchars($sitecopyright,ENT_NOQUOTES,UTF-8) . "</copyright>\n";
echo " <copyright>" . htmlspecialchars($sitecopyright,ENT_NOQUOTES,"UTF-8") . "</copyright>\n";
echo " <lastBuildDate>" . $currenttime . "</lastBuildDate>\n";
echo " <ttl>" . $rssttl . "</ttl>\n";
echo " <image>\n";
echo " <title>" . htmlspecialchars($sitetitle,ENT_NOQUOTES,UTF-8) . "</title>\n";
echo " <title>" . htmlspecialchars($sitetitle,ENT_NOQUOTES,"UTF-8") . "</title>\n";
echo " <link>" . $siteurl . "</link>\n";
echo " <url>" . $siteicon . "</url>\n";
echo " <width>16</width>\n";
echo " <height>16</height>\n";
echo " </image>\n";
$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)) {
$id = $row["ID"];
$title = htmlspecialchars($row["Title"],ENT_NOQUOTES,UTF-8);
$description = htmlspecialchars($row["Description"],ENT_NOQUOTES,UTF-8);
$dateupdated = gmdate("r", strtotime($row["DateStamp"]));
$version = htmlspecialchars($row["Version"],ENT_NOQUOTES,UTF-8);
$vid = $row["vID"];
$appname = htmlspecialchars($row["AppName"],ENT_NOQUOTES,UTF-8);
$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)) {
$id = $row["ID"];
$title = htmlspecialchars($row["Title"],ENT_NOQUOTES,"UTF-8");
$description = htmlspecialchars($row["Description"],ENT_NOQUOTES,"UTF-8");
$dateupdated = gmdate("r", strtotime($row["DateStamp"]));
$version = htmlspecialchars($row["Version"],ENT_NOQUOTES,"UTF-8");
$vid = $row["vID"];
$appname = htmlspecialchars($row["AppName"],ENT_NOQUOTES,"UTF-8");
echo " <item>\n";
echo " <pubDate>" . $dateupdated . "</pubDate>\n";
echo " <title>" . $title . " " . $version . " for " . $appname . "</title>\n";
echo " <link>http://$sitehostname/" . strtolower($listType) . "/moreinfo.php?id=" . $id . "&amp;vid=" . $vid . "</link>\n";
echo " <description>" . $description . "</description>\n";
echo " </item>\n";
echo " <item>\n";
echo " <pubDate>" . $dateupdated . "</pubDate>\n";
echo " <title>" . $title . " " . $version . " for " . $appname . "</title>\n";
echo " <link>http://$sitehostname/" . strtolower($listType) . "/moreinfo.php?id=" . $id . "&amp;vid=" . $vid . "</link>\n";
echo " <description>" . $description . "</description>\n";
echo " </item>\n";
}
}
echo "</channel>\n";
echo "</rss>\n";

View File

@@ -44,14 +44,14 @@ $app = strtolower($_GET["application"]); // Firefox, Thunderbird, Mozilla
$type = escape_string($_GET["type"]); //E, T, [P]
$list = ucwords(strtolower($_GET["list"])); // Newest, Updated, [Editors], Popular
$sitetitle = "Mozilla Update";
$siteicon = "http://www.mozilla.org/images/mozilla-16.png";
$siteurl = $_SERVER["SERVER_NAME"];
$sitetitle = "Mozilla Update";
$siteicon = "http://www.mozilla.org/images/mozilla-16.png";
$siteurl = $_SERVER["SERVER_NAME"];
$sitedescription = "the way to keep your mozilla software up-to-date";
$sitelanguage = "en-US";
$sitecopyright = "Copyright 2004-2005 The Mozilla Organization";
$currenttime = gmdate(r);// GMT
$rssttl = "120"; //Life of feed in minutes
$sitelanguage = "en-US";
$sitecopyright = "Copyright 2004-2005 The Mozilla Organization";
$currenttime = gmdate(r);// GMT
$rssttl = "120"; //Life of feed in minutes
header("Content-Type: application/xml; charset=utf-8");