"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 t_main values... $sql = "UPDATE `t_main` SET `Name`= '$_POST[name]', `Homepage`='$_POST[homepage]', `Description`='$_POST[description]', `DateUpdated`=NOW(NULL) WHERE `ID`='$_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 = $_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 `t_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 $sql = "DELETE FROM `t_authorxref` WHERE `ID` = '$_POST[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) { $sql = "INSERT INTO `t_authorxref` (`ID`, `UserID`) VALUES ('$_POST[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... $sql = "DELETE FROM `t_categoryxref` WHERE `ID` = '$_POST[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"] foreach ($_POST["categories"] as $categoryid) { $sql = "INSERT INTO `t_categoryxref` (`ID`, `CategoryID`) VALUES ('$_POST[id]', '$categoryid');"; //echo"$sql
\n"; //Debug $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 = $_POST["name"]; $id = $_POST["id"]; echo"

Deleting $name, please wait...

\n"; $sql = "SELECT `Version`, `URI` FROM `t_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"; } } $sql = "DELETE FROM `t_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 = $_GET["id"]; if (!$id) {$id = $_POST["id"]; } $sql = "SELECT TM.ID, TM.Type, TM.GUID, TM.Name, TM.Description, TM.DateAdded, TM.DateUpdated, TM.Homepage, TU.UserEmail FROM `t_main` TM LEFT JOIN t_authorxref TAX ON TM.ID = TAX.ID INNER JOIN t_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); //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 = $_POST["notes"]; $id = $_POST["id"]; $uri = $_POST["uri"]; $osid = $_POST["osid"]; $sql = "UPDATE `t_version` SET `OSID`='$osid', `Notes`='$notes', `DateUpdated`=NOW(NULL) WHERE `ID`='$id' AND `URI`='$uri'"; //echo"$sql
\n"; $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 `t_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 = $_POST["minappver_$i"]; $maxappver = $_POST["maxappver_$i"]; $vid = $_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) { $sql = "UPDATE `t_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 = $_POST["id"]; $uri = $_POST["uri"]; $version = $_POST["version"]; echo"

Deleting Version... Please wait...

\n"; $sql = "SELECT `Name` FROM `t_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 = "DELETE FROM `t_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 = $_GET["id"]; if (!$id) {$id = $_POST["id"]; } $sql = "SELECT TM.ID, TM.Name FROM `t_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 = $_GET["vid"]; if (!$vid) {$vid = $_POST["vid"]; } //Get Data for Form Population //INNER JOIN t_main TM ON TV.ID = TM.ID $sql = "SELECT `Version`, TV.OSID, `OSName`,`URI`,`Notes`,`Size`,`DateAdded`, `DateUpdated` FROM `t_version` TV INNER JOIN `t_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 `t_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 `t_version` TV INNER JOIN `t_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