Access Denied\n"; echo"You do not have access to this item."; include"$page_footer"; echo"\n"; exit; } ?> "Extensions","T"=>"Themes"); if (!$_GET["type"]) {$_GET["type"]="E";} ?>

Manage :

" style="font-weight: bold;">Add New Item | Show: $typename) { $i++; echo"$typename"; if ($i !== $count) {echo" / "; } } unset($i); ?> \n"; echo"\n"; echo"\n"; echo"\n"; echo"\n"; echo"\n"; } ?>
Name Description Last Updated
$i$name$description$dateupdated
New Input File: ">
"; echo"

Updating $name, please wait...

"; if ($_POST["name"] && $_POST["authors"] && $_POST["categories"] && $_POST["description"]) { //Everything We *must* have is present... Begin.... //Phase One, update main values... if (checkFormKey()) { $sql = "UPDATE `main` SET `Name`= '".escape_string($_POST[name])."', `Homepage`='".escape_string($_POST[homepage])."', `Description`='".escape_string($_POST[description])."', `DateUpdated`=NOW(NULL) WHERE `ID`='".escape_string($_POST[id])."' LIMIT 1"; //echo"$sql
\n"; //Debug $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); if ($sql_result) { echo"Your update to $_POST[name] has been submitted successfully...
\n"; } } echo""; //Phase Two, Author List -- Autocomplete and Verify $authors = escape_string($_POST["authors"]); $authors = explode(", ","$authors"); foreach ($authors as $author) { if (strlen($author)<2) {continue;} //Kills all values that're too short.. $a++; $sql = "SELECT `UserID`,`UserEmail` FROM `userprofiles` WHERE `UserEmail` LIKE '$author%' ORDER BY `UserMode`, `UserName` ASC"; $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)) { $userid = $row["UserID"]; $useremail = $row["UserEmail"]; if ($numresults>1) { //Too many e-mails match, store individual data for error block. $r++; $emailerrors[$a]["foundemails"][$r] = $useremail; } $authorids[] = $userid; } if ($numresults !="1") { //No Valid Entry Found for this E-Mail or too many, kill and store data for error block. $emailerrors[$a]["author"] = "$author"; $updateauthors = "false"; // Just takes one of these to kill the author update. } } unset($a,$r); //Commit Updates to AuthorXref tables.. with the ID and UserID. if ($updateauthors != "false") { //Remove Current Authors if (checkFormKey()) { $id = escape_string($_POST["id"]); $sql = "DELETE FROM `authorxref` WHERE `ID` = '$id'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); } //Add New Authors based on $authorids sort($authorids); foreach ($authorids as $authorid) { if (checkFormKey()) { $id = escape_string($_POST["id"]); $sql = "INSERT INTO `authorxref` (`ID`, `UserID`) VALUES ('$id', '$authorid');"; $result = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); } } echo"Authors for $_POST[name]'s updated...
\n"; } else { echo"ERROR: Could not update Authors list, please fix the errors printed below and try again...
\n"; } unset($authors); //Clear from Post.. //Phase Three, Category List, update linkages. //print_r($_POST["categories"]); //Delete Current Category Linkages... if (checkFormKey()) { $id = escape_string($_POST["id"]); $sql = "DELETE FROM `categoryxref` WHERE `ID` = '$id'"; //echo"$sql
\n"; //Debug $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); //Add New Categories from $_POST["categories"] $sql = "SELECT `Type` from `main` WHERE `ID` = '$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); $type = $row["Type"]; foreach ($_POST["categories"] as $categoryname) { $sql2 = "SELECT `CategoryID` FROM `categories` WHERE `CatType` = '$type' AND `CatName` = '$categoryname' ORDER BY `CategoryID` ASC"; $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)) { $categoryid = $row2["CategoryID"]; $sql = "INSERT INTO `categoryxref` (`ID`, `CategoryID`) VALUES ('$id', '$categoryid');"; $result = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); } } echo"Categories for $_POST[name]'s updated...
\n"; } //End _POST if. } else { //Something Isnt Present.. Throw the main error and details... echo"You're missing one or more required fields, please return to the previous page and correct the errors and try again...
\n"; if (!$_POST["name"]) {echo"Name is required
\n";} if (!$_POST["authors"]) {echo"Authors is required
\n";} if (!$_POST["categories"]) {echo"Categories is required
\n";} if (!$_POST["description"]) {echo"Description is required
\n";} } echo"
"; } else if ($_POST["submit"]=="Delete") { $name = escape_string($_POST["name"]); $id = escape_string($_POST["id"]); echo"

Deleting $name, please wait...

\n"; $sql = "SELECT `Version`, `URI` FROM `version` WHERE `ID`='$id' GROUP BY `URI` ORDER BY `Version` 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)) { $version = $row["Version"]; $uri = $row["URI"]; //Delete File(s) from server if (strpos("$uri","approvalfile.php/")) { $file = str_replace("http://$sitehostname/developers/approvalfile.php/","$repositorypath/approval/",$uri); } else if (strpos("$uri","ftp.mozilla.org")) { $ftppath = $uri; $file = str_replace("http://ftp.mozilla.org/pub/mozilla.org/","$repositorypath/ftp/",$uri); } if (file_exists($file)) { $unlink = unlink($file); } else { $file_exists = "false"; } if ($file_exists == "false" or !$unlink) { echo"Error! Encountered a problem when trying to delete associated files, files were not deleted successfully
\n"; } else { echo"Deleted $name $version (".basename($uri).") successfully...
\n"; } } if ($ftppath) { $basename = basename($ftppath); $ftppath = str_replace("/$basename","",$ftppath); $ftppath = str_replace("http://ftp.mozilla.org/pub/mozilla.org","$repositorypath/ftp",$ftppath); if (@rmdir($ftppath)) { echo"Removed Directory for $name...
\n"; } else { echo"Warning! Unable to remove directory for $name. Directory may not be empty.
\n"; } } if (checkFormKey()) { $sql = "DELETE FROM `main` WHERE `ID`='$id'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); if ($sql_result) { echo"$name has been deleted...
\n"; echo"«« Back to Main Page...
\n"; include"$page_footer"; echo"\n\n"; exit; } } } //---------------------- // END //---------------------- //Get Parent Item Information $id = escape_string($_GET["id"]); if (!$id) {$id = escape_string($_POST["id"]); } $sql = "SELECT TM.ID, TM.Type, TM.GUID, TM.Name, TM.Description, TM.DateAdded, TM.DateUpdated, TM.Homepage, TU.UserEmail FROM `main` TM LEFT JOIN authorxref TAX ON TM.ID = TAX.ID INNER JOIN userprofiles TU ON TAX.UserID = TU.UserID WHERE TM.ID = '$id' ORDER BY `Type` , `Name` 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)) { $v++; $id = $row["ID"]; $type = $row["Type"]; $guid = $row["GUID"]; $name = $row["Name"]; $dateadded = date("l, F, j Y g:i:s",strtotime($row["DateAdded"])); $dateupdated = date("l, F, j Y g:i:s",strtotime($row["DateUpdated"])); $homepage = $row["Homepage"]; $description = $row["Description"]; $downloadcount = $row["DownloadCount"]; $authors[$v] = $row["UserEmail"]; } unset($v); if (!$guid) { $guid = "None"; } //Make Authors E-Mail Array into a Nice String $num_authors = count($authors); foreach($authors as $author) { $v++; $authorstring .= "$author"; if ($v != $num_authors) { $authorstring .=", "; } } $authors = $authorstring; unset($v); ?>

"> "> \n"; $authors = $_POST["authors"]; } ?>
GUID: Categories:
    
Date Added:
Last Updated:
Name* " SIZE=50 MAXLENGTH=100>
\n"; echo"
"; echo"Errors Found in Authors
\n"; echo"\n"; foreach ($emailerrors as $authorerror) { $author = $authorerror["author"]; $count = count($authorerror["foundemails"]); if ($count=="0") { //Error for No Entry Found echo"Entry '$author': No Matches Found, Please check your entry and try again.
\n"; } else { //Error for Too Many Entries Found echo"Entry '$author': Too Many Matches, Please make your entry more specific.
\n"; } if ($count>0 AND $count<6) { echo"    Possible Addresses found: "; foreach ($authorerror["foundemails"] as $foundemails) { $a++; echo"$foundemails"; if ($a != $count) {echo", "; } else {echo"
\n";} } } } echo"
Author(s):*" SIZE=50>
Homepage " SIZE=50 MAXLENGTH=200>
Description*
    ? This action is not reversable and will remove all files and listed versions.');">
   ">«« Back to Item Overview "; echo"

Updating Version, please wait...

\n"; //print_r($_POST); //echo"

\n"; echo""; //Phase One-Part 1 -- Version (per-file record update) $notes = escape_string($_POST["notes"]); $id = escape_string($_POST["id"]); $uri = escape_string($_POST["uri"]); $osid = escape_string($_POST["osid"]); if (checkFormKey()) { $sql = "UPDATE `version` SET `OSID`='$osid', `Notes`='$notes', `DateUpdated`=NOW(NULL) WHERE `ID`='$id' AND `URI`='$uri'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); echo"Version Notes and OS for $_POST[name] $_POST[version] updated...
\n"; } //Phase Two -- Update Min/Max Versions //Construct Internal App_Version Arrays $i=0; $sql = "SELECT `int_version`, `major`, `minor`, `release`, `SubVer` FROM `applications` ORDER BY `AppName`, `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)) { $i++; $int_version = $row["int_version"]; $subver = $row["SubVer"]; $release = "$row[major].$row[minor]"; if ($row["release"]) {$release = "$release.$row[release]";} if ($subver !=="final") {$release="$release$subver";} $app_internal_array[$release] = $int_version; } //print_r($app_internal_array); for ($i = 1; $i <= $_POST[maxval]; $i++) { unset($minappver_int,$maxappver_int); $minappver = escape_string($_POST["minappver_$i"]); $maxappver = escape_string($_POST["maxappver_$i"]); $vid = escape_string($_POST["appvid_$i"]); if ($app_internal_array["$minappver"]) {$minappver_int = $app_internal_array["$minappver"]; } if ($app_internal_array["$maxappver"]) {$maxappver_int = $app_internal_array["$maxappver"]; } if (!$minappver_int) {$minappver_int = $minappver;} if (!$maxappver_int) {$maxappver_int = $maxappver;} if ($minappver && $maxappver) { if (checkFormKey()) { $sql = "UPDATE `version` SET `MinAppVer`='$minappver', `MinAppVer_int`='$minappver_int', `MaxAppVer`='$maxappver', `MaxAppVer_int`='$maxappver_int' WHERE `vID`='$vid'"; //echo"$sql
\n"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); echo"Updated Target Application Values for Application $i...
\n"; } } else { if (!$minappver) { echo"Error: Minimum Version is not specified or invalid
\n"; } if (!$maxappver) { echo"Error: Maximum Version is not specified or invalid
\n"; } } } echo"
"; } else if ($_POST["submit"]=="Delete") { $id = escape_string($_POST["id"]); $uri = escape_string($_POST["uri"]); $version = escape_string($_POST["version"]); echo"

Deleting Version... Please wait...

\n"; $sql = "SELECT `Name` FROM `main` WHERE `ID` = '$id'"; $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"]; $sql_result = false; if (checkFormKey()) { $sql = "DELETE FROM `version` WHERE `ID`='$id' AND `URI`='$uri'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); } if ($sql_result) { //Delete File from server if (strpos("$uri","approvalfile.php/")) { $file = str_replace("http://$sitehostname/developers/approvalfile.php/","$repositorypath/approval/",$uri); } else if (strpos("$uri","ftp.mozilla.org")) { $file = str_replace("http://ftp.mozilla.org/pub/mozilla.org/","$repositorypath/ftp/",$uri); } if (file_exists($file)) { $unlink = unlink($file); } else { $file_exists = "false"; } if ($file_exists == "false" or !$unlink) { echo"Error! Encountered a problem when trying to delete associated files, files were not deleted successfully
\n"; } echo"
$name $version has been deleted...
«« Back to the $name overview page...
"; include"$page_footer"; echo""; exit; } } //---------------------- // END //---------------------- //Get Parent Item Information $id = escape_string($_GET["id"]); if (!$id) {$id = escape_string($_POST["id"]); } $sql = "SELECT TM.ID, TM.Name FROM `main` TM WHERE TM.ID = '$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); $id = $row["ID"]; $name = $row["Name"]; //----------------------- // Version Table //----------------------- $vid = escape_string($_GET["vid"]); if (!$vid) {$vid = escape_string($_POST["vid"]); } //Get Data for Form Population //INNER JOIN main TM ON TV.ID = TM.ID $sql = "SELECT `Version`, TV.OSID, `OSName`,`URI`,`Notes`,`Size`,`DateAdded`, `DateUpdated` FROM `version` TV INNER JOIN `os` TOS ON TOS.OSID=TV.OSID WHERE `vID` = '$vid' ORDER BY `Version` ASC 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); $v++; $version=$row["Version"]; $osid=$row["OSID"]; $osname=$row["OSName"]; $minappver=$row["MinAppVer"]; $maxappver=$row["MaxAppVer"]; $uri=$row["URI"]; $filename=basename($row["URI"]); $notes=$row["Notes"]; $size=$row["Size"]; ?>

"> \n"; echo"\n"; echo"\n"; echo"\n"; //Construct App_Versions Arrays $i=0; $sql = "SELECT `AppName`, `Version`, `major`, `minor`, `release`, `SubVer` FROM `applications` ORDER BY `AppName`, `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)) { $i++; $application = strtolower($row["AppName"]); $display_version = $row["Version"]; $subver = $row["SubVer"]; $release = "$row[major].$row[minor]"; if ($row["release"]) {$release = "$release.$row[release]";} if ($subver !=="final") {$release="$release$subver";} $app_ver_array[$application][] = $release; $app_display_array[$application][$release] = $display_version; } $i=0; echo"\n"; $sql = "SELECT vID, TV.AppID,`AppName`,`MinAppVer`,`MaxAppVer` FROM `version` TV INNER JOIN `applications` TA ON TA.AppID=TV.AppID WHERE `ID` = '$id' && TV.URI = '$uri' 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)) { $i++; $appname = $row["AppName"]; $appid=$row["AppID"]; $minappver=$row["MinAppVer"]; $maxappver=$row["MaxAppVer"]; echo"\n"; } echo""; echo"\n"; echo"\n"; ?>
$filename ($size"."kb)
Target Application(s):
$appname "; echo""; echo"\n"; echo" - "; echo"\n"; echo"
OS*"; echo"\n"; echo"
Version Notes:
    ?');">
   ">«« Back to Item Overview