зеркало из https://github.com/mozilla/pjs.git
Updated queries for rss and extensions/themes pages.
This commit is contained in:
Родитель
42145d1ee7
Коммит
28f6a2dca6
|
@ -12,21 +12,7 @@ startProcessing('extensions.tpl', 'extensions', $compileId);
|
|||
require_once('includes.php');
|
||||
|
||||
// If app is not set or empty, set it to null for our switch.
|
||||
$_GET['app'] = (!empty($_GET['app'])) ? $_GET['app'] : null;
|
||||
|
||||
// Determine our application.
|
||||
switch( $_GET['app'] ) {
|
||||
case 'mozilla':
|
||||
$clean['app'] = 'Mozilla';
|
||||
break;
|
||||
case 'thunderbird':
|
||||
$clean['app'] = 'Thunderbird';
|
||||
break;
|
||||
case 'firefox':
|
||||
default:
|
||||
$clean['app'] = 'Firefox';
|
||||
break;
|
||||
}
|
||||
$clean['app'] = (!empty($_GET['app']) && ctype_alpha($_GET['app'])) ? $_GET['app'] : null;
|
||||
|
||||
// $sql['app'] can equal $clean['app'] since it was assigned in a switch().
|
||||
// We have to ucfirst() it because the DB has caps.
|
||||
|
|
|
@ -11,20 +11,7 @@ startProcessing('rss.tpl',$memcacheId,$compileId,'xml');
|
|||
/**
|
||||
* Pull our input params.
|
||||
*/
|
||||
$rssapp = (!empty($_GET['app']) && ctype_alpha($_GET['app'])) ? $_GET['app'] : null;
|
||||
switch (strtolower($rssapp)) {
|
||||
case 'mozilla':
|
||||
$clean['app'] = 'mozilla';
|
||||
break;
|
||||
case 'thunderbird':
|
||||
$clean['app'] = 'thunderbird';
|
||||
break;
|
||||
case 'firefox':
|
||||
default:
|
||||
$clean['app'] = 'firefox';
|
||||
break;
|
||||
}
|
||||
|
||||
$clean['app']= (!empty($_GET['app']) && ctype_alpha($_GET['app'])) ? $_GET['app'] : null;
|
||||
$rsstype = !empty($_GET['type']) && ctype_alpha($_GET['type']) ? $_GET['type'] : null;
|
||||
switch (strtolower($rsstype)) {
|
||||
case 'themes':
|
||||
|
@ -44,7 +31,7 @@ switch (strtolower($rsslist)) {
|
|||
$rssOrderBy = 'm.downloadcount desc, m.totaldownloads desc, m.rating desc, m.dateupdated desc, m.name asc';
|
||||
break;
|
||||
case 'updated':
|
||||
$rssOrderBy = 'm.dateupdated desc, m.name asc';
|
||||
$rssOrderBy = 'v.dateupdated desc, m.name asc';
|
||||
break;
|
||||
case 'rated':
|
||||
$rssOrderBy = 'm.rating desc, m.downloadcount desc, m.name asc';
|
||||
|
@ -54,7 +41,7 @@ switch (strtolower($rsslist)) {
|
|||
/**
|
||||
* @TODO change this to dateapproved once the db has this in it.
|
||||
*/
|
||||
$rssOrderBy = 'm.dateupdateddesc, m.name asc';
|
||||
$rssOrderBy = 'v.dateupdated desc, m.name asc';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -83,13 +70,17 @@ $_rssSql = "
|
|||
a.appname
|
||||
FROM
|
||||
main m
|
||||
INNER JOIN version v ON v.id = m.id
|
||||
INNER JOIN version v ON m.id = v.id
|
||||
INNER JOIN (
|
||||
SELECT v.id, v.appid, v.osid, max(v.vid) as mxvid
|
||||
FROM version v
|
||||
WHERE approved = 'YES' group by v.id, v.appid, v.osid) as vv
|
||||
ON vv.mxvid = v.vid AND vv.id = v.id
|
||||
INNER JOIN applications a ON a.appid = v.appid
|
||||
WHERE
|
||||
v.approved = 'yes' AND
|
||||
a.appname = '{$sql['app']}' AND
|
||||
m.type = '{$sql['type']}' AND
|
||||
v.vid = (SELECT max(vid) FROM version WHERE id=m.id AND approved='YES')
|
||||
m.type = '{$sql['type']}'
|
||||
ORDER BY
|
||||
{$rssOrderBy}
|
||||
LIMIT 0,10
|
||||
|
|
|
@ -6,14 +6,14 @@ button to a completely new feature. They allow the application to be customized
|
|||
to fit the personal needs of each user if they need additional features,
|
||||
while minimizing the size of the application itself.</p>
|
||||
|
||||
<h2>Fresh from the Oven</h2>
|
||||
<h2>Recently Updated</h2>
|
||||
<ul>
|
||||
{section name=ne loop=$newestExtensions step=1 start=0}
|
||||
<li><a href="{$config.webpath}/{$app}/{$newestExtensions[ne].ID}/">{$newestExtensions[ne].name}</a> ({$newestExtensions[ne].dateupdated|date_format})</li>
|
||||
<li><a href="{$config.webpath}/{$app}/{$newestExtensions[ne].ID}/">{$newestExtensions[ne].name} {$newestExtensions[ne].version}</a> ({$newestExtensions[ne].dateupdated|date_format})</li>
|
||||
{/section}
|
||||
</ul>
|
||||
|
||||
<h2>Hot this Week</h2>
|
||||
<h2>Top Extensions</h2>
|
||||
<ul>
|
||||
{section name=pe loop=$popularExtensions step=1 start=0}
|
||||
<li><a href="{$config.webpath}/{$app}/{$popularExtensions[pe].ID}/">{$popularExtensions[pe].name}</a> ({$popularExtensions[pe].dc} downloads)</li>
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
<p>Themes are skins for Mozilla applications. They allow you to change the look and feel of the user interface and personalize it to your tastes. A theme can simply change colors, or it can change every piece of its appearance.</p>
|
||||
|
||||
<h2>Fresh from the Oven</h2>
|
||||
<h2>Recently Updated</h2>
|
||||
<ul>
|
||||
{section name=nt loop=$newestThemes step=1 start=0}
|
||||
<li><a href="{$config.webpath}/{$app}/{$newestThemes[nt].ID}/">{$newestThemes[nt].name}</a> ({$newestThemes[nt].dateupdated|date_format})</li>
|
||||
<li><a href="{$config.webpath}/{$app}/{$newestThemes[nt].ID}/">{$newestThemes[nt].name} {$newestThemes[nt].version}</a> ({$newestThemes[nt].dateupdated|date_format})</li>
|
||||
{/section}
|
||||
</ul>
|
||||
|
||||
<h2>Hot this Week</h2>
|
||||
<h2>Top Themes</h2>
|
||||
<ul>
|
||||
{section name=pt loop=$popularThemes step=1 start=0}
|
||||
<li><a href="{$config.webpath}/{$app}/{$popularThemes[pt].ID}/">{$popularThemes[pt].name}</a> ({$popularThemes[pt].dc} downloads)</li>
|
||||
|
|
|
@ -151,23 +151,25 @@ class AMO_Object
|
|||
|
||||
// Get most popular extensions based on application.
|
||||
$this->db->query("
|
||||
SELECT DISTINCT
|
||||
SELECT
|
||||
m.ID ID,
|
||||
m.Name name,
|
||||
m.downloadcount dc,
|
||||
v.DateUpdated as dateupdated
|
||||
v.DateUpdated as dateupdated,
|
||||
v.version
|
||||
FROM
|
||||
main m
|
||||
INNER JOIN version v ON m.ID = v.ID
|
||||
INNER JOIN applications TA ON v.AppID = TA.AppID
|
||||
INNER JOIN os o ON v.OSID = o.OSID
|
||||
INNER JOIN version v ON m.id = v.id
|
||||
INNER JOIN (
|
||||
SELECT v.id, v.appid, v.osid, max(v.vid) as mxvid
|
||||
FROM version v
|
||||
WHERE approved = 'YES' group by v.id, v.appid, v.osid) as vv
|
||||
ON vv.mxvid = v.vid AND vv.id = v.id
|
||||
INNER JOIN applications a ON a.appid = v.appid
|
||||
WHERE
|
||||
AppName = '{$app}' AND
|
||||
downloadcount > '0' AND
|
||||
approved = 'YES' AND
|
||||
Type = '{$type}'
|
||||
GROUP BY
|
||||
m.ID
|
||||
v.approved = 'yes' AND
|
||||
a.appname = '{$app}' AND
|
||||
m.type = '{$type}'
|
||||
ORDER BY
|
||||
v.dateupdated DESC , downloadcount DESC, rating DESC
|
||||
LIMIT
|
||||
|
@ -189,25 +191,26 @@ class AMO_Object
|
|||
|
||||
// Return most popular addons.
|
||||
$this->db->query("
|
||||
SELECT DISTINCT
|
||||
SELECT
|
||||
m.ID ID,
|
||||
m.Name name,
|
||||
m.downloadcount dc,
|
||||
v.DateUpdated as dateupdated
|
||||
FROM
|
||||
main m
|
||||
INNER JOIN version v ON m.ID = v.ID
|
||||
INNER JOIN applications TA ON v.AppID = TA.AppID
|
||||
INNER JOIN os o ON v.OSID = o.OSID
|
||||
INNER JOIN version v ON m.id = v.id
|
||||
INNER JOIN (
|
||||
SELECT v.id, v.appid, v.osid, max(v.vid) as mxvid
|
||||
FROM version v
|
||||
WHERE approved = 'YES' group by v.id, v.appid, v.osid) as vv
|
||||
ON vv.mxvid = v.vid AND vv.id = v.id
|
||||
INNER JOIN applications a ON a.appid = v.appid
|
||||
WHERE
|
||||
AppName = '{$app}' AND
|
||||
downloadcount > '0' AND
|
||||
approved = 'YES' AND
|
||||
Type = '{$type}'
|
||||
GROUP BY
|
||||
m.ID
|
||||
v.approved = 'yes' AND
|
||||
a.appname = '{$app}' AND
|
||||
m.type = '{$type}'
|
||||
ORDER BY
|
||||
downloadcount DESC, rating DESC, v.dateupdated DESC
|
||||
m.downloadcount DESC, m.rating DESC, v.dateupdated DESC
|
||||
LIMIT
|
||||
{$limit}
|
||||
", SQL_ALL, SQL_ASSOC);
|
||||
|
|
Загрузка…
Ссылка в новой задаче