зеркало из https://github.com/mozilla/pjs.git
big shiny perf rework
This commit is contained in:
Родитель
a121e4d699
Коммит
635bfe09be
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Addon summary page. Displays a top-down view of all Addon properties.
|
||||
*
|
||||
* @package amo
|
||||
* @subpackage docs
|
||||
*/
|
||||
|
||||
// Arrays to store clean inputs.
|
||||
$clean = array(); // General array for verified inputs.
|
||||
$sql = array(); // Trusted for SQL.
|
||||
|
||||
// Get our addon ID.
|
||||
$clean['ID'] = intval($_GET['id']);
|
||||
$sql['ID'] =& $clean['ID'];
|
||||
|
||||
$addon = new AddOn($sql['ID']);
|
||||
|
||||
// Assign template variables.
|
||||
$tpl->assign(
|
||||
array( 'addon' => $addon,
|
||||
'title' => $addon->Name,
|
||||
'content' => 'addon.tpl',
|
||||
'sidebar' => 'inc/addon-sidebar.tpl')
|
||||
);
|
||||
?>
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Finish script.
|
||||
*
|
||||
* @package amo
|
||||
* @subpackage inc
|
||||
*/
|
||||
|
||||
// Set our wrapper if it has not been set.
|
||||
$wrapper = (!isset($wrapper)) ? 'inc/wrappers/default.tpl' : $wrapper;
|
||||
|
||||
// Display output.
|
||||
$tpl->display($wrapper);
|
||||
|
||||
// Disconnect from our database.
|
||||
//$db->disconnect();
|
||||
?>
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Global initialization script.
|
||||
*
|
||||
* @package amo
|
||||
* @subpackage docs
|
||||
* @todo find a more elegant way to push in global template data (like $cats)
|
||||
*/
|
||||
// Include config file.
|
||||
require_once('config.php');
|
||||
|
||||
// Set runtime options.
|
||||
ini_set('display_errors',DISPLAY_ERRORS);
|
||||
ini_set('error_reporting',ERROR_REPORTING);
|
||||
ini_set('magic_quotes_gpc',0);
|
||||
|
||||
// Include required libraries and classes.
|
||||
require_once('DB.php'); // PEAR::DB
|
||||
require_once('Auth.php'); // PEAR::Auth
|
||||
require_once(LIB.'/smarty/libs/Smarty.class.php'); // Smarty
|
||||
require_once(LIB.'/amo.class.php');
|
||||
require_once(LIB.'/addon.class.php');
|
||||
require_once(LIB.'/error.php');
|
||||
require_once(LIB.'/rdf.class.php');
|
||||
require_once(LIB.'/rss.class.php');
|
||||
require_once(LIB.'/session.class.php');
|
||||
require_once(LIB.'/sql.class.php');
|
||||
require_once(LIB.'/user.class.php');
|
||||
require_once(LIB.'/version.class.php');
|
||||
|
||||
// Database configuration.
|
||||
class AMO_SQL extends SQL
|
||||
{
|
||||
function AMO_SQL()
|
||||
{
|
||||
$dsn = array (
|
||||
'phptype' => 'mysql',
|
||||
'dbsyntax' => 'mysql',
|
||||
'username' => DB_USER,
|
||||
'password' => DB_PASS,
|
||||
'hostspec' => DB_HOST,
|
||||
'database' => DB_NAME,
|
||||
'port' => DB_PORT
|
||||
);
|
||||
$this->connect($dsn);
|
||||
|
||||
// Test connection; display "gone fishing" on failure.
|
||||
if (DB::isError($this->db)) {
|
||||
triggerError($this->error,'site-down.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global DB object.
|
||||
$db = new AMO_SQL();
|
||||
|
||||
if (USE_DB_SESSIONS)
|
||||
{
|
||||
$amo_session_handler = new AMO_Session($db);
|
||||
session_set_save_handler(array(&$amo_session_handler, '_open'),
|
||||
array(&$amo_session_handler, '_close'),
|
||||
array(&$amo_session_handler, '_read'),
|
||||
array(&$amo_session_handler, '_write'),
|
||||
array(&$amo_session_handler, '_destroy'),
|
||||
array(&$amo_session_handler, '_gc'));
|
||||
}
|
||||
|
||||
// Smarty configuration.
|
||||
class AMO_Smarty extends Smarty
|
||||
{
|
||||
function AMO_Smarty()
|
||||
{
|
||||
$this->template_dir = TEMPLATE_DIR;
|
||||
$this->compile_dir = COMPILE_DIR;
|
||||
$this->cache_dir = CACHE_DIR;
|
||||
$this->config_dir = CONFIG_DIR;
|
||||
|
||||
// Pass config variables to Smarty object.
|
||||
$this->assign('config',
|
||||
array( 'webpath' => WEB_PATH,
|
||||
'rootpath' => ROOT_PATH,
|
||||
'repo' => REPO_DIR)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Global template object.
|
||||
$tpl = new AMO_Smarty();
|
||||
|
||||
?>
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Overview provides an inside look at what is going on for an application.
|
||||
*
|
||||
* @package amo
|
||||
* @subpackage docs
|
||||
*
|
||||
* @todo Do something to spice up this page.
|
||||
* @todo Get main template spruced up.
|
||||
*/
|
||||
|
||||
// Arrays to store clean inputs.
|
||||
$clean = array(); // General array for verified inputs.
|
||||
$sql = array(); // Trusted for SQL.
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// $sql['app'] can equal $clean['app'] since it was assigned in a switch().
|
||||
$sql['app'] =& $clean['app'];
|
||||
|
||||
// Get most popular extensions based on application.
|
||||
$db->query("
|
||||
SELECT DISTINCT
|
||||
TM.ID ID,
|
||||
TM.Name name,
|
||||
TM.downloadcount dc
|
||||
FROM
|
||||
main TM
|
||||
INNER JOIN version TV ON TM.ID = TV.ID
|
||||
INNER JOIN applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN os TOS ON TV.OSID = TOS.OSID
|
||||
WHERE
|
||||
AppName = '{$sql['app']}' AND
|
||||
downloadcount > '0' AND
|
||||
approved = 'YES' AND
|
||||
Type = 'E'
|
||||
ORDER BY
|
||||
downloadcount DESC
|
||||
LIMIT
|
||||
5
|
||||
", SQL_ALL, SQL_ASSOC);
|
||||
|
||||
$popularExtensions = $db->record;
|
||||
|
||||
|
||||
// Assign template variables.
|
||||
$tpl->assign(
|
||||
array( 'popularExtensions' => $popularExtensions,
|
||||
'title' => $clean['app'].' Addons',
|
||||
'content' => 'index.tpl',
|
||||
'currentTab' => 'home')
|
||||
);
|
||||
|
||||
$wrapper = 'inc/wrappers/nonav.tpl';
|
||||
?>
|
|
@ -30,7 +30,7 @@
|
|||
* @version 2.6.8
|
||||
*/
|
||||
|
||||
/* $Id: Smarty.class.php,v 1.1 2005-07-11 23:52:14 mike.morgan%oregonstate.edu Exp $ */
|
||||
/* $Id: Smarty.class.php,v 1.2 2005-12-22 18:55:30 mconnor%steelgryphon.com Exp $ */
|
||||
|
||||
/**
|
||||
* DIR_SEP isn't used anymore, but third party apps might
|
||||
|
@ -138,7 +138,7 @@ class Smarty
|
|||
*
|
||||
* @var boolean
|
||||
*/
|
||||
var $compile_check = true;
|
||||
var $compile_check = false;
|
||||
|
||||
/**
|
||||
* This forces templates to compile every time. Useful for development
|
||||
|
@ -157,7 +157,7 @@ class Smarty
|
|||
* </ul>
|
||||
* @var integer
|
||||
*/
|
||||
var $caching = 0;
|
||||
var $caching = 2;
|
||||
|
||||
/**
|
||||
* The name of the directory for cache files.
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<h2><strong>{$addon->Name}</strong> » Overview</h2>
|
||||
|
||||
<script type="text/javascript" src="/js/auto.js"></script>
|
||||
|
||||
{if $addon->PreviewURI}
|
||||
<p class="screenshot">
|
||||
<a href="./previews.php?id={$addon->ID}" title="See more {$addon->Name} previews.">
|
||||
<img src="{$config.webpath}{$addon->PreviewURI}" height="{$addon->PreviewHeight}" width="{$addon->PreviewWidth}" alt="{$addon->Name} screenshot">
|
||||
</a>
|
||||
<strong><a href="./previews.php?id={$addon->ID}" title="See more {$addon->Name} previews.">More Previews »</a></strong>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p class="first">
|
||||
<strong><a href="./addon.php?id={$addon->ID}">{$addon->Name} {$addon->Version}</a></strong>,
|
||||
by <a href="./author.php?id={$addon->UserID}">{$addon->UserName}</a>,
|
||||
released on {$addon->VersionDateAdded|date_format}
|
||||
</p>
|
||||
|
||||
|
||||
<p>{$addon->Description}</p>
|
||||
|
||||
<p class="requires">
|
||||
Requires: {$addon->AppName} {$addon->MinAppVer} - {$addon->MaxAppVer} <img src="{$config.webpath}/img/{$addon->AppName|lower}_icon.png" width="34" height="34" alt="{$addon->AppName}">
|
||||
</p>
|
||||
|
||||
<div class="key-point install-box">
|
||||
<div class="install">
|
||||
<b><a href="{$addon->URI}" onclick="return install(event,'{$addon->AppName|escape} {$addon->Version|escape}', '{$config.webpath}/img/default.png');" TITLE="Install {$addon->AppName|escape} {$addon->Version|escape} (Right-Click to Download)">Install Now</a></b> ({$addon->Size|escape} KB File)</div></div>
|
||||
|
||||
<h3 id="user-comments">User Comments</h3>
|
||||
|
||||
<p><strong><a href="./addcomment.php?id={$addon->ID}">Add your own comment »</a></strong></p>
|
||||
|
||||
<ul id="opinions">
|
||||
{section name=comments loop=$addon->Comments max=10}
|
||||
<li>
|
||||
<div class="opinions-vote">{$addon->Comments[comments].CommentVote} <span class="opinions-caption">out of 10</span></div>
|
||||
<h4 class="opinions-title">{$addon->Comments[comments].CommentTitle}</h4>
|
||||
<p class="opinions-info">by {$addon->Comments[comments].CommentName}, {$addon->Comments[comments].CommentDate|date_format}</p>
|
||||
<p class="opinions-text">{$addon->Comments[comments].CommentNote}</p>
|
||||
<p class="opinions-helpful"><strong>{$addon->Comments[comments].helpful_yes}</strong> out of <strong>{$addon->Comments[comments].helpful_total}</strong> viewers found this comment helpful<br>
|
||||
Was this comment helpful? <a href="./ratecomment.php?aid={$addon->ID}&cid={$addon->Comments[comments].CommentID}&r=yes">Yes</a> | <a href="./ratecomment.php?aid={$addon->ID}&cid={$addon->Comments[comments].CommentID}&r=no">No</a></p>
|
||||
</li>
|
||||
{/section}
|
||||
</ul>
|
||||
|
||||
<p><strong><a href="./comments.php?id={$addon->ID}">Read all comments »</a></strong></p>
|
||||
|
||||
<h3>Addon Details</h3>
|
||||
<ul>
|
||||
<li>Categories:
|
||||
<ul>
|
||||
{section name=cats loop=$addon->AddonCats}
|
||||
<li><a href="./search.php?cat={$addon->AddonCats[cats].CategoryID}" title="See other Addons in this category.">{$addon->AddonCats[cats].CatName}</a></li>
|
||||
{/section}
|
||||
</ul>
|
||||
</li>
|
||||
<li>Last Updated: {$addon->DateUpdated|date_format}</li>
|
||||
<li>Total Downloads: {$addon->TotalDownloads} — Downloads this Week: {$addon->downloadcount}</li>
|
||||
<li>See <a href="./history.php?id={$addon->ID}">all previous releases</a> of this addon.</li>
|
||||
{if $addon->UserWebsite}
|
||||
<li>View the <a href="{$addon->Homepage}">Author's homepage</a> for this addon.</li>
|
||||
{/if}
|
||||
</ul>
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
|
||||
<div class="split-feature">
|
||||
<div class="split-feature-one">
|
||||
<div class="feature-download">
|
||||
<!-- Feature Image must be 200px wide... any height is fine, but around 170-200 is preferred -->
|
||||
<a href="./addon.php?id=1532"><img src="./images/features/del.icio.us.png" width="200" height="213" alt="del.icio.us Extension"></a>
|
||||
<h3><a href="http://releases.mozilla.org/pub/mozilla.org/extensions/del.icio.us/del.icio.us-1.0.2-fx.xpi" onclick="return install(event,'del.icio.us 1.0.2', '/images/default.png');" title="Install del.icio.us 1.0.2 (Right-Click to Download)">Install Extension (62 KB)</a> </h3>
|
||||
|
||||
</div>
|
||||
<h2>Featured Extension</h2>
|
||||
<h2><a href="./addon.php?id=1532">del.icio.us</a></h2>
|
||||
<p class="first">Harness the power of social bookmarking right in your browser with the del.icio.us Firefox extension! The del.icio.us extension for Firefox offers everything you need to seamlessly integrate the del.icio.us service with your Firefox browser. <a href="./addon.php?id=1532">Learn more...</a></p>
|
||||
</div>
|
||||
<a class="top-feature" href="./recommended.php"><img src="./images/feature-recommend.png" width="213" height="128" style="padding-left: 12px;" alt="We Recommend: See some of our favorite extensions to get you started."></a>
|
||||
|
||||
<div class="split-feature-two">
|
||||
<h2><img src="images/title-topdownloads.gif" width="150" height="24" alt="Top 10 Downloads"></h2>
|
||||
|
||||
<ol class="top-10">
|
||||
{section name=pe loop=$popularExtensions step=1 start=0}
|
||||
<li class="top-10-{$smarty.section.pe.iteration}"><a href="./addon.php?id={$popularExtensions[pe].ID}"><strong>{$popularExtensions[pe].name}</strong> {$popularExtensions[pe].dc}</a></li>
|
||||
{/section}
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<form id="front-search" method="get" action="/quicksearch.php" title="Search Mozilla Update">
|
||||
<div>
|
||||
<label for="q2" title="Search mozilla.org"s sites">search:</label>
|
||||
<input type="hidden" name="cof" value="">
|
||||
<input type="hidden" name="domains" value="mozilla.org">
|
||||
<input type="hidden" name="sitesearch" value="mozilla.org">
|
||||
<input id="q2" type="text" name="q" accesskey="s" size="40">
|
||||
<select name="section">
|
||||
<option value="A">Entire Site</option>
|
||||
<option value="E">Extensions</option>
|
||||
<option value="T">Themes</option>
|
||||
</select>
|
||||
<input type="submit" value="Go">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="front-section-left">
|
||||
<h2><img src="images/title-browse.gif" width="168" height="22" alt="Browse By Category"></h2>
|
||||
<ul>
|
||||
<li><a href="./extensions/showlist.php?application=firefox&category=Popular">Most Popular Add-ons</a></li>
|
||||
<li><a href="./extensions/showlist.php?application=firefox&category=Newest">Recently Added</a></li>
|
||||
<li><a href="./extensions/showlist.php?application=firefox&category=All">All Categories</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="front-section-right">
|
||||
<h2><img src="images/title-develop.gif" width="152" height="22" alt="Develop Your Own"></h2>
|
||||
<ul>
|
||||
<li><a href="./developers/">Login to Submit</a></li>
|
||||
<li><a href="http://developer.mozilla.org/en/docs/Extensions">Documentation</a></li>
|
||||
<li><a href="http://developer.mozilla.org/en/docs/Building_an_Extension">Develop Your Own</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
Загрузка…
Ссылка в новой задаче