From a27e66289adc49ac4bcdf0ef18cd1e31c6e4244b Mon Sep 17 00:00:00 2001 From: "mike.morgan%oregonstate.edu" Date: Wed, 5 Apr 2006 01:11:38 +0000 Subject: [PATCH] Added install.php support, modified install.js to work in prod. Fixed footers to have disclaimer. Added support page link to from disclaimer. git-svn-id: svn://10.0.0.236/trunk@193576 18797224-902f-48f8-a5cc-f745e15eee43 --- .../public/htdocs/css/cavendish/content.css | 9 +++ .../webtools/addons/public/htdocs/install.php | 71 +++++++++++++++++++ .../addons/public/htdocs/js/install.js | 40 ++++++++--- .../webtools/addons/public/htdocs/support.php | 12 ++++ .../tpl/inc/wrappers/default-footer.tpl | 4 ++ .../public/tpl/inc/wrappers/nonav-footer.tpl | 4 ++ .../webtools/addons/public/tpl/support.tpl | 26 +++++++ 7 files changed, 156 insertions(+), 10 deletions(-) create mode 100755 mozilla/webtools/addons/public/htdocs/install.php create mode 100644 mozilla/webtools/addons/public/htdocs/support.php create mode 100644 mozilla/webtools/addons/public/tpl/support.tpl diff --git a/mozilla/webtools/addons/public/htdocs/css/cavendish/content.css b/mozilla/webtools/addons/public/htdocs/css/cavendish/content.css index 4a46debb3b7..0ef40776f35 100755 --- a/mozilla/webtools/addons/public/htdocs/css/cavendish/content.css +++ b/mozilla/webtools/addons/public/htdocs/css/cavendish/content.css @@ -440,3 +440,12 @@ #comments-sort { float: right; } + +.disclaimer { + text-align: center; + color: #ccc; + font-size: x-small; + width: 600px; + margin-left: auto; + margin-right: auto; +} diff --git a/mozilla/webtools/addons/public/htdocs/install.php b/mozilla/webtools/addons/public/htdocs/install.php new file mode 100755 index 00000000000..a624da3f4b5 --- /dev/null +++ b/mozilla/webtools/addons/public/htdocs/install.php @@ -0,0 +1,71 @@ +query(" + SELECT + vid, + m.id, + uri + FROM version v + INNER JOIN main m ON m.id=v.id + WHERE + uri='$uri' + LIMIT + 1 +", SQL_INIT, SQL_ASSOC); + +if (empty($db->record)) { + echo 'nope'; + exit; +} else { + $row=$db->record; + $uri=$row['uri']; + $id = $row['id']; + $vid = $row['vid']; +} + +//Are we behind a proxy and given the IP via an alternate enviroment variable? If so, use it. +if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { + $remote_addr = mysql_real_escape_string($_SERVER["HTTP_X_FORWARDED_FOR"]); +} else { + $remote_addr = mysql_real_escape_string($_SERVER["REMOTE_ADDR"]); +} + +// Clean the user agent string. +$http_user_agent = mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']); + +// Rate limit set to 10 minutes. +$sql = " + SELECT + did + FROM + downloads + WHERE + id='$id' AND + vid='$vid' AND + user_ip='$remote_addr' AND + user_agent='$http_user_agent' AND + date>DATE_SUB(NOW(), INTERVAL 10 MINUTE) + LIMIT + 1 +"; +$db->query($sql,SQL_INIT,SQL_ASSOC); + +if (empty($db->record)) { + $db->query(" + INSERT INTO + downloads (ID, date, vID, user_ip, user_agent) + VALUES + ('${id}',NOW(),'{$vid}', '{$remote_addr}', '{$http_user_agent}') + ",SQL_NONE); +} + +header('Location: '.$uri); +exit; +?> diff --git a/mozilla/webtools/addons/public/htdocs/js/install.js b/mozilla/webtools/addons/public/htdocs/js/install.js index 9778ed0531a..8fd23ae8187 100644 --- a/mozilla/webtools/addons/public/htdocs/js/install.js +++ b/mozilla/webtools/addons/public/htdocs/js/install.js @@ -32,16 +32,36 @@ function getPlatformName() } function install( aEvent, extName, iconURL) { - var p = new XMLHttpRequest(); - p.open("GET", "/core/install.php?uri="+aEvent.target.href, false); - p.send(null); - var params = new Array(); - params[extName] = { - URL: aEvent.target.href, - IconURL: iconURL, - toString: function () { return this.URL; } - }; - InstallTrigger.install(params); + if (aEvent.target.href.match(/^.+\.xpi$/)) { + + var params = new Array(); + + params[extName] = { + URL: aEvent.target.href, + IconURL: iconURL, + toString: function () { return this.URL; } + }; + + InstallTrigger.install(params); + + try { + var p = new XMLHttpRequest(); + p.open("GET", "/install.php?uri="+aEvent.target.href, true); + p.send(null); + } catch(e) { } + + return false; + } +} + +function installTheme( aEvent, extName) { + InstallTrigger.installChrome(InstallTrigger.SKIN,aEvent.target.href,extName); + + try { + var p = new XMLHttpRequest(); + p.open("GET", "/install.php?uri="+aEvent.target.href, true); + p.send(null); + } catch(e) { } return false; } diff --git a/mozilla/webtools/addons/public/htdocs/support.php b/mozilla/webtools/addons/public/htdocs/support.php new file mode 100644 index 00000000000..d92b7e963ba --- /dev/null +++ b/mozilla/webtools/addons/public/htdocs/support.php @@ -0,0 +1,12 @@ +assign( + array( 'title' => 'Support', + 'content' => 'support.tpl') +); +?> diff --git a/mozilla/webtools/addons/public/tpl/inc/wrappers/default-footer.tpl b/mozilla/webtools/addons/public/tpl/inc/wrappers/default-footer.tpl index 6754c70d420..af4e7590eaf 100644 --- a/mozilla/webtools/addons/public/tpl/inc/wrappers/default-footer.tpl +++ b/mozilla/webtools/addons/public/tpl/inc/wrappers/default-footer.tpl @@ -16,5 +16,9 @@ +
+Mozilla is providing links to these applications as a courtesy, and makes no representations regarding the applications or any information related thereto. Any questions, complaints or claims regarding the applications must be directed to the appropriate software vendor. See our Support Page for support information and contacts. +
+ diff --git a/mozilla/webtools/addons/public/tpl/inc/wrappers/nonav-footer.tpl b/mozilla/webtools/addons/public/tpl/inc/wrappers/nonav-footer.tpl index bd07c678e24..b45cdaaa9d0 100644 --- a/mozilla/webtools/addons/public/tpl/inc/wrappers/nonav-footer.tpl +++ b/mozilla/webtools/addons/public/tpl/inc/wrappers/nonav-footer.tpl @@ -11,5 +11,9 @@ +
+Mozilla is providing links to these applications as a courtesy, and makes no representations regarding the applications or any information related thereto. Any questions, complaints or claims regarding the applications must be directed to the appropriate software vendor. See our Support Page for support information and contacts. +
+ diff --git a/mozilla/webtools/addons/public/tpl/support.tpl b/mozilla/webtools/addons/public/tpl/support.tpl new file mode 100644 index 00000000000..659488b182d --- /dev/null +++ b/mozilla/webtools/addons/public/tpl/support.tpl @@ -0,0 +1,26 @@ +
+

Support

+ +

This is a list of different ways to get support for Mozilla Add-ons, which includes Themes and Extensions.

+ +
+
MozillaZine Forums
+
People in the MozillaZine forums are often helpful and know a lot about Mozilla Add-ons.
+ +
IRC Chat
+
IRC is probably the best way to find support. You should find people who can help in #umo or #firefox on irc.mozilla.org. If you don't have an IRC client, you can use ChatZilla.
+ +
developer.mozilla.org (DevMo) Extensions Page
+
Extensions developers can look for documentation on how to create their own extensions here.
+ +
DevMo Themes Page
+
Theme designers interesting in making themes for Mozilla applications should read this document.
+ +
Mozilla Product Support
+
For support on one of the Mozilla applications themeselves, please visit this page.
+ +
File a Bug in Bugzilla
+
To file a bug regarding an major error in an extension or theme, or to report a problem with this website, please file a bug in Bugzilla to make sure it gets tracked properly.
+
+ +