[art-web] [download] set the content type to activate the gnome-theme-installer



commit 178df9008fe7fdfdf2352d2e2316a8a234813662
Author: Thomas Wood <thos gnome org>
Date:   Sun Nov 15 00:17:28 2009 +0000

    [download] set the content type to activate the gnome-theme-installer
    
    Set the content type when downloading gtk, metacity or icon themes to allow
    the browser to open the file in the theme installer. The extension is also
    checked because the application/x-gnome-theme-package type can only be set
    if the archive is gzipped.

 download |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/download b/download
index 15e247d..6694854 100644
--- a/download
+++ b/download
@@ -35,7 +35,17 @@ if($section == "backgrounds")
 else if($section == "themes")
 {
 	$theme_update_result = mysql_query("UPDATE theme SET download_count=download_count+1 WHERE themeID='$download_num'");
-	header("Location: $mirror_url$archive/themes/$category/$filename");
+
+	$ext = pathinfo ($filename, PATHINFO_EXTENSION);
+
+	if (($category == 'gtk2' || $category == 'metacity' || $category == 'icon') && $ext == 'gz')
+	{
+		header ("Content-type: application/x-gnome-theme-package");
+		header ("Content-Disposition: attachment; filename=\"$filename\"");
+		readfile ("$mirror_url$archive/themes/$category/$filename");
+	}
+	else
+		header ("Location: $mirror_url$archive/themes/$category/$filename");
 	exit();
 }
 else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]