Modified multiple template files to fix validation errors.
    Removed outdated template files for header/footer.tpl.
    Updated links and search forms to point to the correct href/action.
    Added themes/extensions templates.
    Fixed application values in main navigation so when app=null it wouldn't persist and instead be set to firefox by default.

*.sql
    Added v2.sql and updated amo.sql to contain the correct database structure.
    Note: v2.sql is for the v1->v2 migration when the public v2 is released.

search.php
    Fixed selected values for application, and cleaned up code.

session.class.php, includes.php
    No longer need session.class.php, it is replaced by auth.class.php.


git-svn-id: svn://10.0.0.236/trunk@188031 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mike.morgan%oregonstate.edu
2006-01-23 03:28:26 +00:00
parent d833635216
commit 2fb7d8a76d
12 changed files with 414 additions and 354 deletions

View File

@@ -110,9 +110,9 @@ $sort = array(
);
$apps = array(
'Firefox' => 'Firefox',
'Thunderbird' => 'Thunderbird',
'Mozilla' => 'Mozilla'
'firefox' => 'Firefox',
'thunderbird' => 'Thunderbird',
'mozilla' => 'Mozilla'
);
$perpage = array(

View File

@@ -8,7 +8,6 @@ require_once(LIB.'/auth.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');

View File

@@ -1,7 +0,0 @@
<div id="footer">
<p><a href="{$config.webpath}/?app=firefox" class="switch-fx">Firefox Add-ons </a><a href="{$config.webpath}/?app=thunderbird" class="switch-tb">Thunderbird Add-ons </a><a href="{$config.webpath}/?app=mozilla" class="switch-suite">Mozilla Suite Add-ons </a></p>
<p><a href="http://www.mozilla.org/privacy-policy.html">Privacy Policy</a> <a href="{$config.webpath}/faq.php">FAQ</a> <a href="http://www.mozilla.org/foundation/donate.html">Donate to Mozilla</a> <a href="http://mozilla.org/">The Mozilla Organization</a></p>
<p><span>Copyright &copy; 2004-2006</span> <a href="http://www.xramp.com/">256-bit SSL Encryption provided by XRamp</a></p>
</div>

View File

@@ -1,68 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>{if $title}{$title} :: {/if}Mozilla Addons :: Add Features to Mozilla Software</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="mozilla update, mozilla extensions, mozilla plugins, thunderbird themes, thunderbird extensions, firefox extensions, firefox themes">
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/print.css" media="print">
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/base/content.css" media="all">
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/cavendish/content.css" title="Cavendish" media="all">
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/base/template.css" media="screen">
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/cavendish/template.css" title="Cavendish" media="screen">
<link rel="home" title="Home" href="https://addons.mozilla.org/">
<link rel="alternate" type="application/rss+xml" title="New Firefox Extensions Additions" href="{$config.webpath}/rss/?app=firefox&amp;type=E&amp;list=newest">
<link rel="icon" href="{$config.webpath}/images/favicon.ico" type="image/png">
<script src="{$config.webpath}/js/install.js" type="text/javascript"></script>
<script src="{$config.webpath}/js/search-plugin.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<p class="skipLink"><a href="#firefox-feature" accesskey="2">Skip to main content</a></p>
<div id="mozilla-com"><a href="http://www.mozilla.com/">Visit Mozilla.com</a></div>
<div id="header">
<div id="key-title">
{assign var="app" value=$smarty.get.app|lower|default:"firefox"}
{if $app eq "firefox"}
<h1><a href="{$config.webpath}/?app=firefox" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-firefox.gif" width="276" height="54" alt="Firefox Add-ons Beta"></a></h1>
{elseif $app eq "thunderbird"}
<h1><a href="{$config.webpath}/?app=thunderbird" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-thunderbird.gif" width="355" height="54" alt="Thunderbird Add-ons Beta"></a></h1>
{elseif $app eq "mozilla"}
<h1><a href="{$config.webpath}/?app=mozilla" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-suite.gif" width="370" height="54" alt="Mozilla Suite Add-ons Beta"></a></h1>
{/if}
<form id="search" method="get" action="{$config.webpath}/quicksearch.php" title="Search Mozilla Update">
<div>
<label for="q" title="Search Mozilla Update">search:</label>
<input type="text" id="q" name="q" accesskey="s" size="10">
<select name="section" id="sectionsearch">
<option value="A">Entire Site</option>
<option value="E">Extensions</option>
<option value="T">Themes</option>
</select>
<input type="hidden" name="app" value="{$app}">
<input type="submit" id="submit" value="Go">
</div>
</form>
</div>
<div id="key-menu">
<ul id="menu-firefox">
<li{if $currentTab eq "home"} class="current"{/if}><a href="{$config.webpath}/?app={$app}">Home</a></li>
<li{if $currentTab eq "extensions"} class="current"{/if}><a href="{$config.webpath}/extensions/?app={$app}">Extensions</a></li>
<li{if $currentTab eq "pfs"} class="current"{/if}><a href="https://pfs.mozilla.org/plugins/?app={$app}">Plugins</a></li>
<li{if $currentTab eq "search-engines"} class="current"{/if}><a href="{$config.webpath}/search-engines.php?app={$app}">Search Engines</a></li>
<li{if $currentTab eq "themes"} class="current"{/if}><a href="{$config.webpath}/themes/?app={$app}">Themes</a></li>
</ul>
</div>
<!-- end key-menu -->
</div>
<!-- end header -->

View File

@@ -27,27 +27,23 @@
<div id="key-title">
{assign var="app" value=$smarty.get.app|lower|default:"firefox"}
{if $app eq "firefox"}
<h1><a href="{$config.webpath}/?app=firefox" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-firefox.gif" width="276" height="54" alt="Firefox Add-ons Beta"></a></h1>
{elseif $app eq "thunderbird"}
{if $smarty.get.app eq "thunderbird"}
{assign var="app" value="thunderbird"}
<h1><a href="{$config.webpath}/?app=thunderbird" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-thunderbird.gif" width="355" height="54" alt="Thunderbird Add-ons Beta"></a></h1>
{elseif $app eq "mozilla"}
{assign var="app" value="mozilla"}
<h1><a href="{$config.webpath}/?app=mozilla" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-suite.gif" width="370" height="54" alt="Mozilla Suite Add-ons Beta"></a></h1>
{else}
{assign var="app" value="firefox"}
<h1><a href="{$config.webpath}/?app=firefox" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-firefox.gif" width="276" height="54" alt="Firefox Add-ons Beta"></a></h1>
{/if}
<form id="search" method="get" action="{$config.webpath}/quicksearch.php" title="Search Mozilla Update">
<form id="search" method="get" action="{$config.webpath}/search.php" title="Search Mozilla Update">
<div>
<label for="q" title="Search Mozilla Update">search:</label>
<input type="text" id="q" name="q" accesskey="s" size="10">
<select name="section" id="sectionsearch">
<option value="A">Entire Site</option>
<option value="E">Extensions</option>
<option value="T">Themes</option>
</select>
<input type="hidden" name="app" value="{$app}">
<input type="submit" id="submit" value="Go">
<input type="text" id="q" name="q" accesskey="s" size="10"/>
<input type="hidden" name="app" value="{$app}"/>
<input type="submit" id="submit" value="Go"/>
</div>
</form>
</div>

View File

@@ -7,9 +7,6 @@
<p><span>Copyright &copy; 2004-2006</span> <a href="http://www.xramp.com/">256-bit SSL Encryption provided by XRamp</a></p>
</div>
</div>
<!-- close mBody -->
</div>
<!-- close container -->

View File

@@ -11,7 +11,6 @@
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/base/template.css" media="screen">
<link rel="stylesheet" type="text/css" href="{$config.webpath}/css/cavendish/template.css" title="Cavendish" media="screen">
<link rel="home" title="Home" href="https://addons.mozilla.org/">
<link rel="alternate" type="application/rss+xml" title="New Firefox Extensions Additions" href="{$config.webpath}/rss/?app=firefox&amp;type=E&amp;list=newest">
<link rel="icon" href="{$config.webpath}/images/favicon.ico" type="image/png">
<script src="{$config.webpath}/js/install.js" type="text/javascript"></script>
<script src="{$config.webpath}/js/search-plugin.js" type="text/javascript"></script>
@@ -27,25 +26,21 @@
<div id="key-title">
{assign var="app" value=$smarty.get.app|lower|default:"firefox"}
{if $app eq "firefox"}
<h1><a href="{$config.webpath}/?app=firefox" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-firefox.gif" width="276" height="54" alt="Firefox Add-ons Beta"></a></h1>
{elseif $app eq "thunderbird"}
{if $smarty.get.app eq "thunderbird"}
{assign var="app" value="thunderbird"}
<h1><a href="{$config.webpath}/?app=thunderbird" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-thunderbird.gif" width="355" height="54" alt="Thunderbird Add-ons Beta"></a></h1>
{elseif $app eq "mozilla"}
{assign var="app" value="mozilla"}
<h1><a href="{$config.webpath}/?app=mozilla" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-suite.gif" width="370" height="54" alt="Mozilla Suite Add-ons Beta"></a></h1>
{else}
{assign var="app" value="firefox"}
<h1><a href="{$config.webpath}/?app=firefox" title="Return to home page" accesskey="1"><img src="{$config.webpath}/images/title-firefox.gif" width="276" height="54" alt="Firefox Add-ons Beta"></a></h1>
{/if}
<form id="search" method="get" action="{$config.webpath}/quicksearch.php" title="Search Mozilla Update">
<form id="search" method="get" action="{$config.webpath}/search.php" title="Search Mozilla Update">
<div>
<label for="q" title="Search Mozilla Update">search:</label>
<input type="text" id="q" name="q" accesskey="s" size="10">
<select name="section" id="sectionsearch">
<option value="A">Entire Site</option>
<option value="E">Extensions</option>
<option value="T">Themes</option>
</select>
<input type="hidden" name="app" value="{$app}">
<input type="submit" id="submit" value="Go">
</div>
@@ -55,10 +50,10 @@
<div id="key-menu">
<ul id="menu-firefox">
<li{if $currentTab eq "home"} class="current"{/if}><a href="{$config.webpath}/?app={$app}">Home</a></li>
<li{if $currentTab eq "extensions"} class="current"{/if}><a href="{$config.webpath}/extensions/?app={$app}">Extensions</a></li>
<li{if $currentTab eq "extensions"} class="current"{/if}><a href="{$config.webpath}/extensions.php?app={$app}">Extensions</a></li>
<li{if $currentTab eq "pfs"} class="current"{/if}><a href="https://pfs.mozilla.org/plugins/?app={$app}">Plugins</a></li>
<li{if $currentTab eq "search-engines"} class="current"{/if}><a href="{$config.webpath}/search-engines.php?app={$app}">Search Engines</a></li>
<li{if $currentTab eq "themes"} class="current"{/if}><a href="{$config.webpath}/themes/?app={$app}">Themes</a></li>
<li{if $currentTab eq "themes"} class="current"{/if}><a href="{$config.webpath}/themes.php?app={$app}">Themes</a></li>
</ul>
</div>
<!-- end key-menu -->

View File

@@ -25,32 +25,28 @@
</div>
<form id="front-search" method="get" action="/quicksearch.php" title="Search Mozilla Update">
<form id="front-search" method="get" action="{$config.webpath}/search.php" title="Search Mozilla Addons">
<div>
<label for="q2" title="Search mozilla.org&quot;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">
<label for="q2" title="Search addons.mozilla.org">search:</label>
<input id="q2" type="text" name="q" accesskey="s" size="40"/>
<select name="type">
<option value="A">Entire Site</option>
<option value="E">Extensions</option>
<option value="T">Themes</option>
</select>
<input type="submit" value="Go">
<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&amp;category=Popular">Most Popular Add-ons</a></li>
<li><a href="./extensions/showlist.php?application=firefox&amp;category=Newest">Recently Added</a></li>
<li><a href="./extensions/showlist.php?application=firefox&amp;category=All">All Categories</a></li>
<li><a href="./search.php?app={$app}&amp;sort=downloads">Most Popular Add-ons</a></li>
<li><a href="./search.php?app={$app}&amp;sort=rating">Highest Rated Add-ons</a></li>
<li><a href="./search.php?app={$app}&amp;sort=newest">Recently Added</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>

View File

@@ -6,8 +6,10 @@
<form id="search-side" action="{$smarty.server.PHP_SELF}" method="get">
<input type="text" name="q" value="{$clean.q}" maxlength="32">
<input type="submit" value="Search"><br><br>
<div>
<input type="text" name="q" value="{$clean.q}" maxlength="32"/>
<input type="submit" value="Search"/>
</div>
<fieldset>
<legend>Search Options</legend>
@@ -33,7 +35,7 @@
<label for="app">App:</label>
<select id="app" name="app">
<option value="null">Any</option>
{html_options options=$apps selected=$clean.app}
{html_options options=$apps selected=$app}
</select>
</div>
@@ -69,7 +71,7 @@
</fieldset>
<input type="submit" value="Search"><br><br>
<p><input type="submit" value="Search"/></p>
</form>
@@ -122,8 +124,8 @@ Next Page &raquo;
<p class="first">{$results[r]->Description}</p>
<div style="margin-top: 30px; height: 34px">
<div class="iconbar">
<a href="{$results[r]->URI}" onclick="return install(event,'{$results[r]->Name}', '{$config.webpath}/images/default.png');">
<img src="{$config.webpath}/images/download.png" height="32" width="32" title="Install {$results[r]->Name}" ALT="">Install</a><br>
<a href="{$results[r]->URI|escape:url}" onclick="return install(event,'{$results[r]->Name}', '{$config.webpath}/images/default.png');">
<img src="{$config.webpath}/images/download.png" height="32" width="32" title="Install {$results[r]->Name}" ALT="">Install</a><br/>
<span class="filesize">&nbsp;&nbsp;{$results[r]->Size} kb</span>
</div>
<div class="iconbar">

View File

@@ -1,220 +0,0 @@
<?php
/**
* Session handling class.
* This class circumvents basic PHP Sessions and uses MySQL to store all session data.
* This was done was to preserve sessions across different LVS nodes by utilizing the application latyer.
*
* References:
* http://www.zend.com/zend/spotlight/code-gallery-wade8.php
*
* Due to the realities of PHP 5.0.5+ having a new and upsetting
* order of destruction [1] we have to force a session write at
* __destruct or there'll be no [db] class to use. Not really an
* issue for AMO live, but annoying for devs using 5+
*
* [1] http://bugs.php.net/bug.php?id=33772
*
* @package amo
* @subpackage lib
*/
class AMO_Session
{
/**
* SQL Pear::DB wrapper
* @var SQL
*/
var $db;
/**
* The table in which sessions are stored
* @var string
*/
var $dbTable = 'PHPSESSION';
/**
* Constructor
* @param $aDb object the database handle to use for storage
*/
function __construct(&$aDb)
{
$this->db = $aDb;
}
/**
* Destructor
* Required to force a flush of the session data to the database
* before the class disappears.
* @link http://bugs.php.net/bug.php?id=33772
*/
function __destruct()
{
session_write_close();
}
/**
* Prepare variables for use in SQL
* @param aArray array hash of variables to clean
* @return array a new hash with SQL cleaned values, FALSE on failure
*
* TODO: should this be here or should we extend SQL to handle hashes like
* this since it happens so often?
*/
function _prepareForSql($in)
{
/**
* If we don't have a database connection then we
* can't really continue
*/
if (empty($this->db))
return FALSE;
$out = array();
foreach ($in as $key => $value)
{
// TODO: when the SQL class gets it's own escapeSimple then
// change this to use that instead
$out[$key] = $this->db->db->escapeSimple($value);
}
return $out;
}
/**
* Open a new session
*
* @param $aPath string a path to be used to store the session
* @param $aName string a filename to be used to store the session
* @return boolean TRUE on success, FALSE otherwise
*/
function _open($aPath, $aName)
{
/**
* Return FALSE if we don't have a database to use
*/
return empty($this->db) == FALSE;
}
/**
* Close a session
* @return boolean TRUE on success, FALSE otherwise
*/
function _close()
{
return TRUE;
}
/**
* Read some data from a session
* @param $aSessId string a session Id
* @return string the data, or an empty string on failure
*/
function _read($aSessId)
{
if (! strlen($aSessId))
return '';
/**
* If for some reason we don't have a database handle, then
* we can't really continue here
*/
if (empty($this->db))
return '';
/**
* Clean the arguments for SQL
*/
$clean = $this->_prepareForSql(array('SessId' => $aSessId));
/**
* We only want the data, don't care about anything else
*/
$sql = sprintf("SELECT SESSIONDATA FROM %s WHERE SESSIONID='%s'", $this->dbTable, $clean['SessId']);
$data = '';
if ($this->db->query($sql, SQL_INIT, SQL_ASSOC))
{
/**
* Anything other than 1 row should indicate an error, so don't
* propagate this but rather handle it as if there was no data
* at all.
*/
if ($this->db->result->numRows() == 1)
{
$data = $this->db->record['SESSIONDATA'];
}
$this->db->result->free();
}
return $data;
}
/**
* Write some data to the session
* @param $aSessId string a session Id
* @param $aSessData string the encoded [serialized?] session data to store
*/
function _write($aSessId, $aSessData)
{
/**
* If for some reason we don't have a database handle, then
* we can't really continue here
*/
if (empty($this->db))
return FALSE;
/**
* Clean the arguments for SQL
*/
$clean = $this->_prepareForSql(array('SessId' => $aSessId, 'SessData' => $aSessData));
/**
* Due to the handy REPLACE [INTO] syntax, we don't care if there is already
* a record there or not, this one statment will insert or replace as needed.
* HOWEVER:
* Should we ever try to use the session Id as a foreign key in the database
* then this will cause a referential constraint failure, as the REPLACE will
* include a DELETE in cases where the record already exists. Additionally, if
* we store anything other than the SESSIONDATA in the table which doesn't have
* an automatic default then it will get lost between writes unless it is included
* in the statement.
*/
$sql = sprintf("REPLACE %s SET SESSIONID='%s', SESSIONDATA='%s'", $this->dbTable, $clean['SessId'], $clean['SessData']);
return $this->db->query($sql, SQL_NONE);
}
/**
* Destroy a session
* @param $aSessId string a session Id
* @return boolean TRUE on success, FALSE otherwise
*/
function _destroy($aSessId)
{
/**
* If for some reason we don't have a database handle, then
* we can't really continue here
*/
if (empty($this->db))
return FALSE;
/**
* Clean the arguments for SQL
*/
$clean = $this->_prepareForSql(array('SessId' => $aSessId));
$sql = sprintf("DELETE FROM %s WHERE SESSIONID='%s'", $this->dbTable, $clean['SessId']);
return $this->db->db->query($sql);
}
/**
* Garbage collector
* @param $aLifeTime number maximum age of a session to retain
* @return boolean TRUE on success, FALSE otherwise
*/
function _gc($sLifeTime)
{
return TRUE;
}
}
?>

View File

@@ -1,7 +1,360 @@
-- --------------------------------------------------------
CREATE TABLE PHPSESSION (
SESSIONID VARCHAR(32) NOT NULL DEFAULT '',
SESSIONDATA TEXT NOT NULL DEFAULT '',
PRIMARY KEY(SESSIONID)
)
ENGINE=InnoDB;
--
-- Table structure for table `applications`
--
DROP TABLE IF EXISTS `applications`;
CREATE TABLE `applications` (
`AppID` int(11) NOT NULL auto_increment,
`AppName` varchar(30) NOT NULL default '',
`Version` varchar(10) NOT NULL default '',
`major` int(3) NOT NULL default '0',
`minor` int(3) NOT NULL default '0',
`release` int(3) NOT NULL default '0',
`build` int(14) NOT NULL default '0',
`SubVer` varchar(15) NOT NULL default 'final',
`GUID` varchar(50) NOT NULL default '',
`int_version` varchar(5) default NULL,
`public_ver` enum('YES','NO') NOT NULL default 'YES',
`shortname` char(2) NOT NULL default '',
PRIMARY KEY (`AppID`),
KEY `AppName` (`AppName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `approvallog`
--
DROP TABLE IF EXISTS `approvallog`;
CREATE TABLE `approvallog` (
`LogID` int(5) NOT NULL auto_increment,
`ID` varchar(11) NOT NULL default '',
`vID` varchar(11) NOT NULL default '',
`UserID` varchar(11) NOT NULL default '',
`action` varchar(255) NOT NULL default '',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`Installation` enum('','YES','NO') NOT NULL default '',
`Uninstallation` enum('','YES','NO') NOT NULL default '',
`NewChrome` enum('','YES','NO') NOT NULL default '',
`AppWorks` enum('','YES','NO') NOT NULL default '',
`VisualErrors` enum('','YES','NO') NOT NULL default '',
`AllElementsThemed` enum('','YES','NO') NOT NULL default '',
`CleanProfile` enum('','YES','NO') NOT NULL default '',
`WorksAsDescribed` enum('','YES','NO') NOT NULL default '',
`TestBuild` varchar(255) NOT NULL default '',
`TestOS` varchar(255) NOT NULL default '',
`comments` text NOT NULL,
PRIMARY KEY (`LogID`),
KEY `ID` (`ID`),
KEY `vID` (`vID`),
KEY `UserID` (`UserID`),
KEY `UserID_2` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `authorxref`
--
DROP TABLE IF EXISTS `authorxref`;
CREATE TABLE `authorxref` (
`ID` int(11) NOT NULL default '0',
`UserID` int(11) NOT NULL default '0',
KEY `ID` (`ID`),
KEY `UserID` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`CategoryID` int(11) NOT NULL auto_increment,
`CatName` varchar(30) NOT NULL default '',
`CatDesc` varchar(100) NOT NULL default '',
`CatType` enum('E','T','P') NOT NULL default 'E',
`CatApp` varchar(25) NOT NULL default '',
PRIMARY KEY (`CategoryID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `categoryxref`
--
DROP TABLE IF EXISTS `categoryxref`;
CREATE TABLE `categoryxref` (
`ID` int(11) NOT NULL default '0',
`CategoryID` int(11) NOT NULL default '0',
KEY `IDIndex` (`ID`,`CategoryID`),
KEY `CategoryID` (`CategoryID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `downloads`
--
DROP TABLE IF EXISTS `downloads`;
CREATE TABLE `downloads` (
`dID` int(11) NOT NULL auto_increment,
`ID` int(11) unsigned default NULL,
`date` datetime default NULL,
`downloadcount` int(15) NOT NULL default '0',
`vID` int(11) unsigned default NULL,
`user_ip` varchar(15) NOT NULL default '',
`user_agent` varchar(255) default NULL,
`type` enum('count','download') NOT NULL default 'download',
`counted` int(1) unsigned NOT NULL default '0',
PRIMARY KEY (`dID`),
KEY `date` (`date`),
KEY `dup_download_check_idx` (`ID`,`date`,`vID`,`user_ip`,`user_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `faq`
--
DROP TABLE IF EXISTS `faq`;
CREATE TABLE `faq` (
`id` int(3) NOT NULL auto_increment,
`index` varchar(5) NOT NULL default '1',
`alias` varchar(12) NOT NULL default '',
`title` varchar(150) NOT NULL default '',
`text` text NOT NULL,
`lastupdated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`active` enum('YES','NO') NOT NULL default 'YES',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `feedback`
--
DROP TABLE IF EXISTS `feedback`;
CREATE TABLE `feedback` (
`CommentID` int(11) NOT NULL auto_increment,
`ID` int(11) NOT NULL default '0',
`CommentName` varchar(100) default NULL,
`CommentVote` tinyint(3) unsigned default NULL,
`CommentTitle` varchar(75) NOT NULL default '',
`CommentNote` text,
`CommentDate` datetime NOT NULL default '0000-00-00 00:00:00',
`commentip` varchar(15) NOT NULL default '',
`email` varchar(128) NOT NULL default '',
`formkey` varchar(160) NOT NULL default '',
`helpful-yes` int(6) NOT NULL default '0',
`helpful-no` int(6) NOT NULL default '0',
`helpful-rating` varchar(4) NOT NULL default '',
`VersionTagline` varchar(255) NOT NULL default '',
`flag` varchar(8) NOT NULL default '',
PRIMARY KEY (`CommentID`),
KEY `ID` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `feedback_ipbans`
--
DROP TABLE IF EXISTS `feedback_ipbans`;
CREATE TABLE `feedback_ipbans` (
`bID` int(11) NOT NULL auto_increment,
`beginip` varchar(15) NOT NULL default '',
`endip` varchar(15) NOT NULL default '',
`DateAdded` datetime default '0000-00-00 00:00:00',
`comments` text NOT NULL,
PRIMARY KEY (`bID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `main`
--
DROP TABLE IF EXISTS `main`;
CREATE TABLE `main` (
`ID` int(11) NOT NULL auto_increment,
`GUID` varchar(50) NOT NULL default '',
`Name` varchar(100) NOT NULL default '',
`Type` enum('T','E','P') NOT NULL default 'T',
`DateAdded` datetime NOT NULL default '0000-00-00 00:00:00',
`DateUpdated` datetime NOT NULL default '0000-00-00 00:00:00',
`Homepage` varchar(200) default NULL,
`Description` text NOT NULL,
`Rating` varchar(4) default NULL,
`downloadcount` int(15) NOT NULL default '0',
`TotalDownloads` int(18) NOT NULL default '0',
`devcomments` text NOT NULL,
PRIMARY KEY (`ID`),
KEY `Type` (`Type`),
KEY `GUID` (`GUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `os`
--
DROP TABLE IF EXISTS `os`;
CREATE TABLE `os` (
`OSID` int(11) NOT NULL auto_increment,
`OSName` varchar(20) NOT NULL default '',
PRIMARY KEY (`OSID`),
UNIQUE KEY `OSName` (`OSName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `previews`
--
DROP TABLE IF EXISTS `previews`;
CREATE TABLE `previews` (
`PreviewID` int(11) NOT NULL auto_increment,
`PreviewURI` varchar(200) NOT NULL default '',
`ID` int(5) NOT NULL default '0',
`caption` varchar(255) NOT NULL default '',
`preview` enum('YES','NO') NOT NULL default 'NO',
PRIMARY KEY (`PreviewID`),
KEY `ID` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `reviews`
--
DROP TABLE IF EXISTS `reviews`;
CREATE TABLE `reviews` (
`rID` int(11) NOT NULL auto_increment,
`ID` int(11) NOT NULL default '0',
`DateAdded` datetime NOT NULL default '0000-00-00 00:00:00',
`AuthorID` int(11) NOT NULL default '0',
`Title` varchar(60) NOT NULL default '',
`Body` text,
`ExtendedBody` text NOT NULL,
`pick` enum('YES','NO') NOT NULL default 'NO',
`featured` enum('YES','NO') NOT NULL default 'NO',
`featuredate` varchar(6) NOT NULL default '',
PRIMARY KEY (`rID`),
UNIQUE KEY `ID_2` (`ID`),
KEY `ID` (`ID`),
KEY `AuthorID` (`AuthorID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `userprofiles`
--
DROP TABLE IF EXISTS `userprofiles`;
CREATE TABLE `userprofiles` (
`UserID` int(11) NOT NULL auto_increment,
`UserName` varchar(100) NOT NULL default '',
`UserEmail` varchar(100) NOT NULL default '',
`UserWebsite` varchar(100) default NULL,
`UserPass` varchar(200) NOT NULL default '',
`UserMode` enum('A','E','U','D') NOT NULL default 'U',
`UserTrusted` enum('TRUE','FALSE') NOT NULL default 'FALSE',
`UserEmailHide` tinyint(1) NOT NULL default '1',
`UserLastLogin` datetime NOT NULL default '0000-00-00 00:00:00',
`ConfirmationCode` varchar(32) NOT NULL default '',
PRIMARY KEY (`UserID`),
UNIQUE KEY `UserEmail` (`UserEmail`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
-- --------------------------------------------------------
--
-- Table structure for table `version`
--
DROP TABLE IF EXISTS `version`;
CREATE TABLE `version` (
`vID` int(11) NOT NULL auto_increment,
`ID` int(11) NOT NULL default '0',
`Version` varchar(30) NOT NULL default '0',
`OSID` int(11) NOT NULL default '0',
`AppID` int(11) NOT NULL default '0',
`MinAppVer` varchar(10) NOT NULL default '',
`MinAppVer_int` varchar(10) NOT NULL default '',
`MaxAppVer` varchar(10) NOT NULL default '',
`MaxAppVer_int` varchar(10) NOT NULL default '',
`Size` int(11) NOT NULL default '0',
`DateAdded` datetime NOT NULL default '0000-00-00 00:00:00',
`DateUpdated` datetime NOT NULL default '0000-00-00 00:00:00',
`URI` varchar(255) NOT NULL default '',
`Notes` text,
`approved` enum('YES','NO','?','DISABLED') NOT NULL default '?',
PRIMARY KEY (`vID`),
KEY `ID` (`ID`),
KEY `AppID` (`AppID`),
KEY `OSID` (`OSID`),
KEY `Version` (`Version`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=0;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `authorxref`
--
ALTER TABLE `authorxref`
ADD CONSTRAINT `0_21` FOREIGN KEY (`ID`) REFERENCES `main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `0_22` FOREIGN KEY (`UserID`) REFERENCES `userprofiles` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `categoryxref`
--
ALTER TABLE `categoryxref`
ADD CONSTRAINT `0_25` FOREIGN KEY (`ID`) REFERENCES `main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `0_26` FOREIGN KEY (`CategoryID`) REFERENCES `categories` (`CategoryID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `feedback`
--
ALTER TABLE `feedback`
ADD CONSTRAINT `feedback_ibfk_1` FOREIGN KEY (`ID`) REFERENCES `main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `previews`
--
ALTER TABLE `previews`
ADD CONSTRAINT `previews_ibfk_1` FOREIGN KEY (`ID`) REFERENCES `main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `reviews`
--
ALTER TABLE `reviews`
ADD CONSTRAINT `0_40` FOREIGN KEY (`ID`) REFERENCES `main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `0_42` FOREIGN KEY (`AuthorID`) REFERENCES `userprofiles` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `version`
--
ALTER TABLE `version`
ADD CONSTRAINT `0_34` FOREIGN KEY (`ID`) REFERENCES `main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `version_ibfk_1` FOREIGN KEY (`OSID`) REFERENCES `os` (`OSID`) ON UPDATE CASCADE,
ADD CONSTRAINT `version_ibfk_2` FOREIGN KEY (`AppID`) REFERENCES `applications` (`AppID`) ON UPDATE CASCADE;

View File

@@ -0,0 +1,17 @@
-- SQL specific to v2 needed for migration of v1 production database
-- --------------------------------------------------------
--
-- Table structure for table `session_data`
--
DROP TABLE IF EXISTS `session_data`;
CREATE TABLE `session_data` (
`sess_id` varchar(255) NOT NULL default '',
`sess_user_id` int(11) NOT NULL default '0',
`sess_expires` int(11) unsigned NOT NULL default '0',
`sess_data` text,
PRIMARY KEY (`sess_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;