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 @@ +