diff --git a/mozilla/webtools/addons/developers/index.php b/mozilla/webtools/addons/developers/index.php deleted file mode 100644 index 7334e9a87d2..00000000000 --- a/mozilla/webtools/addons/developers/index.php +++ /dev/null @@ -1,16 +0,0 @@ -assign( - array( - 'content' =>'developers/index.tpl', - 'title' =>'Developer Login') -); - -// Set custom wrapper for this page. -$wrapper = 'inc/wrappers/nonav.tpl'; -?> diff --git a/mozilla/webtools/addons/inc/init.php b/mozilla/webtools/addons/inc/init.php index c9cce20240b..d253e6b1275 100644 --- a/mozilla/webtools/addons/inc/init.php +++ b/mozilla/webtools/addons/inc/init.php @@ -20,7 +20,6 @@ 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.'/auth.class.php'); require_once(LIB.'/error.php'); require_once(LIB.'/rdf.class.php'); require_once(LIB.'/rss.class.php'); diff --git a/mozilla/webtools/addons/lib/addon.class.php b/mozilla/webtools/addons/lib/addon.class.php index 8b64f83b51f..86c733d6c54 100644 --- a/mozilla/webtools/addons/lib/addon.class.php +++ b/mozilla/webtools/addons/lib/addon.class.php @@ -3,9 +3,9 @@ * Addon super class. The class to end all classes. * @package amo * @subpackage lib + * @todo properly separate accessors and mutators. */ -class AddOn extends AMO_Object -{ +class AddOn extends AMO_Object { // AddOn metadata. var $ID; var $GUID; @@ -63,8 +63,7 @@ class AddOn extends AMO_Object * * @param int $ID AddOn ID */ - function AddOn($ID=null) - { + function AddOn($ID=null) { // Our DB and Smarty objects are global to save cycles. global $db, $tpl; @@ -79,8 +78,10 @@ class AddOn extends AMO_Object } } - function getAddOn() - { + /** + * Get all commonly used AddOn information. + */ + function getAddOn() { $this->getAddonCats(); $this->getComments(); $this->getCurrentVersion(); @@ -88,8 +89,10 @@ class AddOn extends AMO_Object $this->getUserInfo(); } - function getMainPreview() - { + /** + * Get the "highlight" for the current AddOn. + */ + function getMainPreview() { // Gather previews information. $this->db->query(" SELECT @@ -116,8 +119,10 @@ class AddOn extends AMO_Object } - function getPreviews() - { + /** + * Get all preview information attached to the current AddOn. + */ + function getPreviews() { // Gather preview information $this->db->query(" SELECT @@ -144,9 +149,10 @@ class AddOn extends AMO_Object } } - function getHistory() - { - // Gather history of an addon + /** + * Get all previous versions of the current AddOn. + */ + function getHistory() { $this->db->query(" SELECT TV.vID, @@ -173,9 +179,10 @@ class AddOn extends AMO_Object $this->History = $this->db->record; } - function getCurrentVersion() - { - // Gather version information for most current version. + /** + * Get information about the most recent verison of the current AddOn. + */ + function getCurrentVersion() { $this->db->query(" SELECT version.vID, @@ -205,8 +212,12 @@ class AddOn extends AMO_Object } } - function getUserInfo() - { + /** + * Retrieve user information. + * + * @todo have this function set a User object instead + */ + function getUserInfo() { // Gather addons metadata, user info. $this->db->query(" SELECT @@ -229,8 +240,13 @@ class AddOn extends AMO_Object } } - function getComments($limit=5) - { + /** + * Get comments attached to this Addon. + * + * @param int $limit number of rows to limit by. + * @todo add left/right limit clauses i.e. LIMIT 10,20 to work with pagination + */ + function getComments($limit=5) { // Gather 10 latest comments. $this->db->query(" SELECT @@ -256,8 +272,10 @@ class AddOn extends AMO_Object $this->setVar('Comments',$this->db->record); } - function getAddonCats() - { + /** + * Retrieve all categories attached to the current AddOn. + */ + function getAddonCats() { // Gather addon categories. $this->db->query(" SELECT DISTINCT diff --git a/mozilla/webtools/addons/lib/amo.class.php b/mozilla/webtools/addons/lib/amo.class.php index 66dfd03d3c7..dc56f3ce9f4 100644 --- a/mozilla/webtools/addons/lib/amo.class.php +++ b/mozilla/webtools/addons/lib/amo.class.php @@ -1,15 +1,21 @@ db->next(SQL_ASSOC)); } + /** + * Get all operating system names (platforms). Used to populate forms. + */ function getPlatforms() { // Gather platforms.. @@ -90,6 +102,9 @@ class AMO_Object } + /** + * Get all application names. Used to populate forms. + */ function getApps() { // Gather aapplications. diff --git a/mozilla/webtools/addons/lib/auth.class.php b/mozilla/webtools/addons/lib/auth.class.php deleted file mode 100644 index 0bdf4eb44bc..00000000000 --- a/mozilla/webtools/addons/lib/auth.class.php +++ /dev/null @@ -1,101 +0,0 @@ -db =& $db; - - if (!is_null($id)) { - $this->resume($id); - } - } - - /** - * Write (or overwrite) a value to the session data array. - * - * @param string $key - * @param mixed $val - * @param bool $overwrite - * - * @return bool - */ - function write($key,$val,$overwrite=false) - { - if (!isset($this->data[$key]) || ($this->data[$key] == $val && $overwrite)) { - $this->data[$key] = $val; - return true; - } else { - return false; - } - } - - /** - * Retrieve a value from the session data array. - * - * @param string $key - * - * @return mixed|bool - */ - function read($key) - { - if (isset($this->data[$key])) { - return $this->data[$key]; - } else { - return false; - } - } - - /** - * Start a session. - * - * @return bool - */ - function create() - { - // Insert a session entry in the database. - if (true) { - return true; - } else { - return false; - } - - // Set a cookie containing the session ID. - } - - /** - * Resume a session. This gathers session data and restores it. - * - * @param $id - * - * @return bool - */ - function resume($id) - { - // Retrieve session data from database based on id. - if (true) { - return true; - } else { - return false; - } - } -} -?> diff --git a/mozilla/webtools/addons/lib/session.class.php b/mozilla/webtools/addons/lib/session.class.php index e69de29bb2d..3fcce624e7a 100644 --- a/mozilla/webtools/addons/lib/session.class.php +++ b/mozilla/webtools/addons/lib/session.class.php @@ -0,0 +1,126 @@ +db =& $db; + + if (!is_null($id)) { + $this->resume($id); + } + } + + /** + * Write (or overwrite) a value to the session data array. + * + * @param string $key + * @param mixed $val + * @param bool $overwrite + * + * @return bool + */ + function write($key,$val,$overwrite=false) { + if (!isset($this->data[$key]) || ($this->data[$key] == $val && $overwrite)) { + $this->data[$key] = $val; + return true; + } else { + return false; + } + } + + /** + * Retrieve a value from the session data array. + * + * @param string $key + * + * @return mixed|bool + */ + function read($key) { + if (isset($this->data[$key])) { + return $this->data[$key]; + } else { + return false; + } + } + + /** + * Start a session. + * + * @return bool + */ + function create() { + // Insert a session entry in the database. + if (true) { + return true; + } else { + return false; + } + + // Set a cookie containing the session ID. + } + + /** + * Resume a session. This gathers session data and restores it. + * + * @param $id + * + * @return bool + */ + function resume($id) { + // Retrieve session data from database based on id. + if (true) { + return true; + } else { + return false; + } + } + + /** + * Authenticate a user account against a database. + * + * @param string $username + * @param string $password + * + * @return bool + */ + function authencticate($username,$password) { + if (true) { + return true; + } else { + return false; + } + } + + /** + * Check to see if the user's session is valid. + * + * @param string $cookieName + * + * @return bool + */ + function isValidSession($cookieName='mozilla-addons') { + if (true) { + return true; + } else { + return false; + } + } +} +?> diff --git a/mozilla/webtools/addons/tpl/addon.tpl b/mozilla/webtools/addons/tpl/addon.tpl index 4c2aa415d68..b9e8bf82a6e 100644 --- a/mozilla/webtools/addons/tpl/addon.tpl +++ b/mozilla/webtools/addons/tpl/addon.tpl @@ -35,7 +35,7 @@ Requires: {$addon->AppName} {$addon->MinAppVer} - {$addon->MaxAppVer} {section name=comments loop=$addon->Comments max=10}
  • -
    {$addon->Comments[comments].CommentVote}out of 10
    +
    {$addon->Comments[comments].CommentVote} out of 10

    {$addon->Comments[comments].CommentTitle}

    by {$addon->Comments[comments].CommentName}, {$addon->Comments[comments].CommentDate|date_format}

    {$addon->Comments[comments].CommentNote}

    diff --git a/mozilla/webtools/addons/tpl/inc/header.tpl b/mozilla/webtools/addons/tpl/inc/header.tpl index eda4b73edb9..7d3ab94ca6f 100644 --- a/mozilla/webtools/addons/tpl/inc/header.tpl +++ b/mozilla/webtools/addons/tpl/inc/header.tpl @@ -26,8 +26,9 @@

    Mozilla Update: Beta