// // Alternatively, the contents of this file may be used under the terms of // either the GNU General Public License Version 2 or later (the "GPL"), or // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), // in which case the provisions of the GPL or the LGPL are applicable instead // of those above. If you wish to allow use of your version of this file only // under the terms of either the GPL or the LGPL, and not to allow others to // use your version of this file under the terms of the MPL, indicate your // decision by deleting the provisions above and replace them with the notice // and other provisions required by the GPL or the LGPL. If you do not delete // the provisions above, a recipient may use your version of this file under // the terms of any one of the MPL, the GPL or the LGPL. // // ***** END LICENSE BLOCK ***** ?> "Extensions","T"=>"Themes","U"=>"Updates"); $typename = $types["$type"]; //RSS Autodiscovery Link switch ($_SESSION["category"]) { case "Newest": $rsslist = "newest"; break; case "Popular": $rsslist = "popular"; break; case "Top Rated": $rsslist = "rated"; break; } $rssfeed = "rss/?application=" . $application . "&type=" . $type . "&list=" . $rsslist; if (!$category) {$categoryname = "All $typename"; } else {$categoryname = $category; } ?> Mozilla Update :: Themes - List - <?php echo"$categoryname"; if ($pageid) {echo" - Page $pageid"; } ?> "; } ?> \n"; // Begin Content Area //Query for List Creation $s = "0"; $startpoint = ($pageid-1)*$items_per_page; if ($category=="Editors Pick" or $category=="Newest" or $category=="Popular" or $category=="Top Rated") { if ($category =="Editors Pick") { $editorpick="true"; } else if ($category =="Newest") { $orderby = "TV.DateAdded DESC, `Name` ASC"; } else if ($category =="Popular") { $orderby = "TM.TotalDownloads DESC, `Name` ASC"; } else if ($category =="Top Rated") { $orderby = "TM.Rating DESC, `Name` ASC"; } $catname = $category; $category = "%"; } if ($app_version=="0.10") {$app_version="0.95"; } $sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Description, TM.Rating, TM.TotalDownloads, TV.vID, SUBSTRING(MAX(CONCAT(LPAD(TV.Version, 6, '0'), TV.vID)), 7) AS MAXvID, MAX(TV.Version) AS Version, TA.AppName, TOS.OSName FROM `t_main` TM INNER JOIN t_version TV ON TM.ID = TV.ID INNER JOIN t_applications TA ON TV.AppID = TA.AppID INNER JOIN t_os TOS ON TV.OSID = TOS.OSID "; if ($category && $category !=="%") { $sql .="INNER JOIN t_categoryxref TCX ON TM.ID = TCX.ID INNER JOIN t_categories TC ON TCX.CategoryID = TC.CategoryID "; } if ($editorpick=="true") { $sql .="INNER JOIN t_reviews TR ON TM.ID = TR.ID "; } $sql .="WHERE Type = '$type' AND AppName = '$application' AND `approved` = 'YES' "; if ($editorpick=="true") { $sql .="AND TR.Pick = 'YES' "; } if ($category && $category !=="%") {$sql .="AND CatName LIKE '$category' ";} if ($app_version) { $sql .=" AND TV.MinAppVer_int <= '".strtolower($app_version)."' AND TV.MaxAppVer_int >= '".strtolower($app_version)."' ";} //MacOSX Specific override for All+Mac themes. Bug 252294 if ($OS=="MacOSX") { $app_os = $OS; } else { $app_os = "ALL"; } if ($OS) { $sql .=" AND (TOS.OSName = '$OS' OR TOS.OSName = '$app_os') "; } $sql .="GROUP BY `Name` "; if ($orderby) { $sql .="ORDER BY $orderby"; } else { $sql .="ORDER BY `Name` , `Version` DESC "; } $resultsquery = $sql; unset($sql); //Get Total Results from Result Query & Populate Page Control Vars. $sql_result = mysql_query($resultsquery, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); $totalresults = mysql_num_rows($sql_result); $num_pages = ceil($totalresults/$items_per_page); //Total # of Pages if ($pageid>$num_pages) {$pageid=$num_pages;} //Check PageId for Validity $startpoint = ($pageid-1)*$items_per_page; if ($startpoint<0) {$startpoint=0; $startitem=0;} $startitem = $startpoint+1; $enditem = $startpoint+$items_per_page; if ($totalresults=="0") {$startitem = "0"; } if ($enditem>$totalresults) {$enditem=$totalresults;} //Verify EndItem if ($_GET[nextnum]) {$startpoint = $_GET["nextnum"]; } //$resultsquery = str_replace("GROUP BY `Name` ", "", $resultsquery); $resultsquery .= " LIMIT $startpoint , $items_per_page"; //Append LIMIT clause to result query if ($category=="%") {$category = $catname; unset($catname); } //Now Showing Box echo"
"; if (!$OS) {$OS="all";} if (!$category) {$categoryname="All"; } else {$categoryname = $category;} echo"
"; $previd=$pageid-1; if ($previd >"0") { echo"« Previous · "; } echo"Page $pageid of $num_pages"; $nextid=$pageid+1; if ($pageid <$num_pages) { echo" · Next »"; } echo"
\n"; echo"".ucwords("$application $typename » $categoryname ")."
"; echo"".ucwords("$typename")." $startitem - $enditem of $totalresults"; // Modify List Form echo"
"; echo"
\n"; //Items-Per-Page echo"Show/Page: "; $perpage = array("5","10","20","50"); echo"\n"; // Operating Systems echo" OS: "; echo"\n"; //Versions of Application echo"Versions: "; echo"\n"; echo""; echo"
"; echo"
"; echo"
\n"; //--------------------------------- // Begin List //--------------------------------- //Get Author Data and Create $authorarray and $authorids $sql = "SELECT TM.Name, TU.UserName, TU.UserID, 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 ORDER BY `Type` , `Name` ASC "; // TM.Type = 'E' $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)) { $authorarray[$row[Name]][] = $row["UserName"]; $authorids[$row[UserName]] = $row["UserID"]; } //Assemble a display application version array $sql = "SELECT `Version`, `major`, `minor`, `release`, `SubVer` FROM `t_applications` WHERE `AppName`='$application' ORDER BY `major`,`minor`"; $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"]; $subver = $row["SubVer"]; $release = "$row[major].$row[minor]"; if ($row["release"]) {$release = ".$release$row[release]";} if ($subver !=="final") {$release="$release$subver";} $appvernames[$release] = $version; } //Query to Generate List.. $sql = "$resultsquery"; $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"]; $type = $row["Type"]; $name = $row["Name"]; $dateadded = $row["DateAdded"]; $dateupdated = $row["DateUpdated"]; $homepage = $row["Homepage"]; $description = $row["Description"]; $rating = $row["Rating"]; $authors = $authorarray[$name]; $osname = $row["OSName"]; $appname = $row["AppName"]; $downloadcount = $row["TotalDownloads"]; //Get Version Record for Referenced MAXvID from list query //$sql2 = "SELECT TV.vID, TV.Version, TV.MinAppVer, TV.MaxAppVer, TV.Size, TV.DateAdded AS VerDateAdded, TV.DateUpdated AS VerDateUpdated, TV.URI, TV.Notes, TP.PreviewURI FROM `t_version` TV //LEFT JOIN t_previews TP ON TV.vID = TP.vID //WHERE TV.vID = '$row[MAXvID]' LIMIT 1"; $sql2 = "SELECT TV.vID, TV.Version, TV.MinAppVer, TV.MaxAppVer, TV.Size, TV.DateAdded AS VerDateAdded, TV.DateUpdated AS VerDateUpdated, TV.URI, TV.Notes, TP.PreviewURI FROM `t_version` TV LEFT JOIN t_previews TP ON TV.vID = TP.vID INNER JOIN t_applications TA ON TV.AppID = TA.AppID INNER JOIN t_os TOS ON TV.OSID = TOS.OSID WHERE TV.ID = '$id' AND TV.Version = '$row[Version]' AND TA.AppName = '$appname' AND TOS.OSName = '$osname' LIMIT 1"; $sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); $row = mysql_fetch_array($sql_result2); $vid = $row["vID"]; if ($appvernames[$row["MinAppVer"]]) {$minappver = $appvernames[$row["MinAppVer"]]; } else { $minappver = $row["MinAppVer"]; } if ($appvernames[$row["MaxAppVer"]]) {$maxappver = $appvernames[$row["MaxAppVer"]]; } else { $maxappver = $row["MaxAppVer"]; } $VerDateAdded = $row["VerDateAdded"]; $VerDateUpdated = $row["VerDateUpdated"]; $filesize = $row["Size"]; $notes = $row["Notes"]; $version = $row["Version"]; $uri = $row["URI"]; $previewuri = $row["PreviewURI"]; if ($VerDateAdded > $dateadded) {$dateadded = $VerDateAdded; } if ($VerDateUpdated > $dateupdated) {$dateupdated = $VerDateUpdated; } //Turn Authors Array into readable string... $authorcount = count($authors); foreach ($authors as $author) { $userid = $authorids[$author]; $n++; $authorstring .= "$author"; if ($authorcount != $n) {$authorstring .=", "; } } $authors = $authorstring; unset($authorstring, $n); // Clear used Vars.. //Create Customizeable Timestamp $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 g:i:sa T", $timestamp); echo"
\n"; //echo"
"; //Not sure why this is here, it caused text to flood out of the box though. if ($previewuri) { list($width, $height, $imagetype, $attr) = getimagesize("$websitepath"."$previewuri"); echo"\"$name"; } //Upper-Right Side Box echo"\n"; echo"
"; echo"$name $version
"; echo"By $authors
"; echo"
"; //Description & Version Notes echo""; echo"$description
"; if ($notes) {echo"$notes"; } echo"
\n"; echo"
"; //echo"
"; //Icon Bar Modules echo"
"; echo"
"; if ($appname=="Thunderbird") { echo"\"\"More Info"; } else { //Make Theme Install work again, Bug 246754 //echo""; echo""; echo"\"\"Install"; } echo"
Size: $filesize kb
"; if ($homepage) {echo"";} echo"
\"$appname\" Works with:
  $minappver - $maxappver
"; if ($osname !=="ALL") { echo"
\"\"OS:
$osname
"; } echo"
"; echo"
Updated: $dateupdated | Total Downloads: $downloadcount
\n"; echo"
\n"; } //End While Loop if ($totalresults=="0") { echo"
\n"; echo"No themes found in this category for ".ucwords($application).".\n"; echo"
\n"; } ?> "; echo"
"; $previd=$pageid-1; if ($previd >"0") { echo"« Previous · "; } echo"Page $pageid of $num_pages"; $nextid=$pageid+1; if ($pageid <$num_pages) { echo" · Next »"; } echo"
\n"; //Skip to Page... if ($num_pages>1) { echo"Jump to: "; $pagesperpage=9; //Plus 1 by default.. $i = 01; //Dynamic Starting Point if ($pageid>11) { $nextpage=$pageid-10; } $i=$nextpage; //Dynamic Ending Point $maxpagesonpage=$pageid+$pagesperpage; //Page #s while ($i <= $maxpagesonpage && $i <= $num_pages) { if ($i==$pageid) { echo"$i "; } else { echo"$i "; } $i++; } } echo"
\n"; echo"".ucwords("$application $typename » $categoryname ")."
"; echo"".ucwords("$typename")." $startitem - $enditem of $totalresults"; echo"\n"; } echo"\n"; //End Content ?>