Fixes for Addons -> Add-ons in titles, etc. Just rudimentary changes there.

Added an update-hashes script as a small part of bug 302287.
This commit is contained in:
mike.morgan%oregonstate.edu 2006-06-30 05:30:03 +00:00
parent 2d3d294acf
commit bdc8829bb3
20 changed files with 84 additions and 23 deletions

View File

@ -69,7 +69,7 @@
<acronym title="Really Simple Syndication">RSS</acronym> feeds
allow you to take the latest content from our site and view it in other places
such as a feed reader, your browser or your website. Feeds make it easy and
convenient to stay on top of the latest from Mozilla Addons.
convenient to stay on top of the latest from Mozilla Add-ons.
</p>
<p>

View File

@ -46,7 +46,7 @@ if (preg_match('/^(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12
$tpl->assign(
array( 'newestExtensions' => $newestExtensions,
'popularExtensions' => $popularExtensions,
'title' => 'Addons',
'title' => 'Add-ons',
'currentTab' => $currentTab,
'content' => 'extensions.tpl',
'sidebar' => 'inc/category-sidebar.tpl',

View File

@ -31,7 +31,7 @@ function getPlatformName()
return "Unknown";
}
function install( aEvent, extName, iconURL) {
function install( aEvent, extName, iconURL, extHash) {
if (aEvent.target.href.match(/^.+\.xpi$/)) {
@ -43,6 +43,14 @@ function install( aEvent, extName, iconURL) {
toString: function () { return this.URL; }
};
// Only add the Hash param if it exists.
//
// We optionally add this to params[] because installTrigger
// will still try to compare a null hash as long as the var is set.
if (extHash) {
params[extName][Hash] = extHash;
}
InstallTrigger.install(params);
try {

View File

@ -36,7 +36,7 @@ $amo = new AMO_Object();
// Assign template variables.
$tpl->assign(
array( 'recommendedExtensions' => $amo->getRecommendedAddons($sql['app'],'E',10),
'title' => 'Recommended '.$clean['app'].' Addons',
'title' => 'Recommended '.$clean['app'].' Add-ons',
'content' => 'recommended.tpl',
'cats' => $amo->getCats('E'))
);

View File

@ -46,7 +46,7 @@ if (preg_match('/^(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12
$tpl->assign(
array( 'newestThemes' => $newestThemes,
'popularThemes' => $popularThemes,
'title' => 'Addons',
'title' => 'Add-ons',
'currentTab' => $currentTab,
'content' => 'themes.tpl',
'sidebar' => 'inc/category-sidebar.tpl',

View File

@ -88,7 +88,8 @@ if (empty($errors)) {
version.uri AS exturi,
version.minappver AS appminver,
version.maxappver AS appmaxver,
applications.guid AS appguid
applications.guid AS appguid,
version.hash AS hash
FROM
main
INNER JOIN version ON main.id = version.id

View File

@ -41,7 +41,7 @@ Works with:
{foreach key=key item=item from=$addon->OsVersions}
{if $item.URI}
<div class="{$item.OSName|escape}">
<a href="{$item.URI|escape}" onclick="return {$addon->installFunc}(event,'{$addon->Name|escape} {$item.Version|escape}', '{$config.webpath}/images/default.png');" title="Install for {$item.OSName|escape} {$item.Version|escape} (Right-Click to Download)">
<a href="{$item.URI|escape}" onclick="return {$addon->installFunc}(event,'{$addon->Name|escape} {$item.Version|escape}', '{$config.webpath}/images/default.png', '{$addon->hash|escape}');" title="Install for {$item.OSName|escape} {$item.Version|escape} (Right-Click to Download)">
Install Now
{if $multiDownloadLinks}
for {$item.OSName|escape}

View File

@ -16,7 +16,7 @@ Email not disclosed
<dd>{$user->UserLastLogin|date_format:"%A, %B %e, %Y"}</dd>
</dl>
<h3>Addons by {$user->UserName}</h3>
<h3>Add-ons by {$user->UserName}</h3>
<dl>
{section name=aa loop=$user->AddOns}
<dt><a href="{$config.webpath}/{$app}/{$user->AddOns[aa].ID}/">{$user->AddOns[aa].Name}</a></dt>

View File

@ -41,7 +41,7 @@
<input id="emailconfirm" name="emailconfirm" type="text" value="{$emailconfirm_value|escape}" size="40"/>
</div>
<p>How do you want to be known to visitors of Mozilla Addons?</p>
<p>How do you want to be known to visitors of Mozilla Add-ons?</p>
{if $error_name_empty}
<div class="amo-form-error">Name is a required field.</div>
@ -54,7 +54,7 @@
<p>If you have a website, enter the URL here. (including the http:// ) Your website
will be shown to site visitors on your author profile page. This field is optional;
if you don't have a website or don't want it linked to from Mozilla Addons, leave
if you don't have a website or don't want it linked to from Mozilla Add-ons, leave
this box blank.</p>
<div>
@ -80,10 +80,10 @@
</div>
<p>Review what you entered above. If everything's correct, click the "Join Mozilla
Addons" button.</p>
Add-ons" button.</p>
<div>
<input name="submit" type="submit" value="Join Mozilla Addons &raquo;" class="amo-submit"/>
<input name="submit" type="submit" value="Join Mozilla Add-ons &raquo;" class="amo-submit"/>
</div>
</form>
{/if}

View File

@ -26,9 +26,9 @@
<li><span>Find Similar Add-ons</span>
<ul>
{section name=cats loop=$addon->AddonCats}
<li><a href="{$config.webpath}/search.php?cat={$addon->AddonCats[cats].CategoryID}" title="See other Addons in this category.">{$addon->AddonCats[cats].CatName}</a></li>
<li><a href="{$config.webpath}/search.php?cat={$addon->AddonCats[cats].CategoryID}" title="See other Add-ons in this category.">{$addon->AddonCats[cats].CatName}</a></li>
{/section}
<li><a href="{$config.webpath}/search.php?app={$app}">Other {$app|capitalize} Addons</a></li>
<li><a href="{$config.webpath}/search.php?app={$app}">Other {$app|capitalize} Add-ons</a></li>
</ul>
</li>
</ul>

View File

@ -29,7 +29,7 @@
</div>
<form id="front-search" method="get" action="{$config.webpath}/search.php" title="Search Mozilla Addons">
<form id="front-search" method="get" action="{$config.webpath}/search.php" title="Search Mozilla Add-ons">
<div>
<label for="q2" title="Search addons.mozilla.org">search:</label>
<input id="q2" type="text" name="q" accesskey="s" size="40"/>

View File

@ -19,7 +19,7 @@
<a href="{$config.webpath}/{$app}/{$recommendedExtensions[re].id}/previews/"><img class="recommended-img" alt="" src="{$config.webpath}{$recommendedExtensions[re].previewuri}"/></a>
<h2><a href="{$config.webpath}/{$app}/{$recommendedExtensions[re].id}/">{$recommendedExtensions[re].name}</a></h2>
<div class="recommended-download">
<h3><a href="{$recommendedExtensions[re].uri}" onclick="return install(event,'{$recommendedExtensions[re].name} {$recommendedExtensions[re].version}', '{$config.webpath}/images/default.png');" title="Install {$recommendedExtensions[re].name} {$recommendedExtensions[re].version} (Right-Click to Download)">Install Extension ({$recommendedExtensions[re].size} KB)</a></h3>
<h3><a href="{$recommendedExtensions[re].uri}" onclick="return install(event,'{$recommendedExtensions[re].name} {$recommendedExtensions[re].version}', '{$config.webpath}/images/default.png', '$recommendedExtensions[re].hash');" title="Install {$recommendedExtensions[re].name} {$recommendedExtensions[re].version} (Right-Click to Download)">Install Extension ({$recommendedExtensions[re].size} KB)</a></h3>
</div>
<p>{$recommendedExtensions[re].body|nl2br}</p>
</div>

View File

@ -4,7 +4,7 @@
{if $success}
<p>Your password has been reset.</p>
<ul>
<li><a href="login.php">Login to Mozilla Addons</a></li>
li><a href="login.php">Login to Mozilla Add-ons</a></li>
</ul>
{else}
<form id="resetpassword" name="resetpassword" method="post" action="">

View File

@ -1,15 +1,15 @@
<?xml-stylesheet type="text/xsl" href="{$config.webpath|escape:html:"UTF-8"}/css/rss.xsl" media="screen"?>
<rss version="2.0">
<channel>
<title>{$list|escape:html:"UTF-8"} Mozilla Addons</title>
<title>{$list|escape:html:"UTF-8"} Mozilla Add-ons</title>
<link>{$config.host|escape:html:"UTF-8"}{$config.webpath|escape:html:"UTF-8"}</link>
<description>Mozilla Addons is the place to get extensions and themes for your Mozilla applications.</description>
<description>Mozilla Add-ons is the place to get extensions and themes for your Mozilla applications.</description>
<language>en-US</language>
<copyright>{$smarty.now|date_format:'%Y'} The Mozilla Foundation</copyright>
<lastBuildDate>{$smarty.now|date_format:"%a, %d %b %Y %H:%M:%S %Z"}</lastBuildDate>
<ttl>120</ttl>
<image>
<title>Mozilla Addons</title>
<title>Mozilla Add-ons</title>
<link>{$config.host|escape:html:"UTF-8"}{$config.webpath|escape:html:"UTF-8"}</link>
<url>http://mozilla.org/images/mozilla-16.png</url>
<width>16</width>

View File

@ -89,7 +89,7 @@
{if $results}
<h2>Search Results</h2>
<p class="first"><b>{$page.resultCount}</b> Addons found. Showing records <b>{$page.leftDisplay}-{$page.right}</b>. <em>Too many results? Try narrowing your search.</em></p>
<p class="first"><b>{$page.resultCount}</b> Add-ons found. Showing records <b>{$page.leftDisplay}-{$page.right}</b>. <em>Too many results? Try narrowing your search.</em></p>
<div class="pages">
<div class="prev">

View File

@ -18,6 +18,9 @@
<em:minVersion>{$update.appminver|escape:html:"UTF-8"}</em:minVersion>
<em:maxVersion>{$update.appmaxver|escape:html:"UTF-8"}</em:maxVersion>
<em:updateLink>{$update.exturi|escape:html:"UTF-8"}</em:updateLink>
{if $update.hash}
<em:updateHash>{$update.hash|escape:html:"UTF-8"}</em:updateHash>
{/if}
</RDF:Description>
</em:targetApplication>
</RDF:Description>

View File

@ -4,14 +4,14 @@
{if $confirmed}
<p>The account {$email|escape} has been activated successfully.</p>
<ul>
<li><a href="login.php">Login to Mozilla Addons</a></li>
<li><a href="login.php">Login to Mozilla Add-ons</a></li>
</ul>
{else}
<p>There was an error activating {$email|escape}. If the account hasn't been
registered yet, please register before activating.</p>
<ul>
<li><a href="createaccount.php">Create a Mozilla Addons account</a></li>
<li><a href="createaccount.php">Create a Mozilla Add-ons account</a></li>
</ul>
{/if}

View File

@ -0,0 +1,47 @@
<?php
/**
* Maintenance script for addons.mozilla.org.
*
* The purpose of this document is to perform periodic tasks that should not be
* done everytime a download occurs in install.php. This should reduce
* unnecessary DELETE and UPDATE queries and lighten the load on the database
* backend.
*
* This script should not ever be accessed over HTTP, and instead run via cron.
* Only sysadmins should be responsible for operating this script.
*
* @package amo
* @subpackage bin
*/
// Before doing anything, test to see if we are calling this from the command
// line. If this is being called from the web, HTTP environment variables will
// be automatically set by Apache. If these are found, exit immediately.
if (isset($_SERVER['HTTP_HOST'])) {
exit;
}
// If we get here, we're on the command line, which means we can continue.
require_once('../../public/inc/config.php');
// For the addon object and db stuff
require_once('../../public/inc/includes.php');
$versions = array();
$hashes = array();
$db = new AMO_SQL();
$db->query("SELECT name,type,vid,uri FROM main m INNER JOIN version v ON v.id = m.id WHERE m.id=735", SQL_ALL, SQL_ASSOC);
$versions=$db->record;
foreach($versions as $version) {
// Here we are making some assumptions on the file path.
// Change the first part if the server you are running on has the .xpi repository in a different location.
$buf = sha1_file('/data/amo/files/ftp/'.($version['type']=='E'?'extensions/':'themes/').str_replace(' ','_',strtolower($version['name'])).'/'.basename($version['uri']));
$db->query("UPDATE version SET hash='sha1:{$buf}' WHERE vid={$version['vid']}");
}
exit;
?>

View File

@ -201,6 +201,7 @@ class AddOn extends AMO_Object {
version.URI,
version.Notes,
version.DateAdded as VersionDateAdded,
version.hash as hash,
applications.AppName
FROM
version

View File

@ -348,6 +348,7 @@ class AMO_Object
r.title,
v.size,
v.version,
v.hash,
p.previewuri
FROM
main m