big changes - templated files, new signin page
authorToby Elliott <telliott@mozilla.com>
Wed, 01 Apr 2009 10:25:39 -0700
changeset 739 976b5a15b0f6bfc87b9d2fe81802dfe3df33be8f
parent 738 d6fc95b91eb03051850b7fc12fbf5ca04a74a030
child 740 ff579afc926d71a4526f117e331f905300092802
push id412
push usertelliott@mozilla.com
push dateWed, 01 Apr 2009 17:25:43 +0000
big changes - templated files, new signin page
compile.php
server/.DS_Store
server/admin/editing.php
server/admin/pending.php
server/change_password.php
server/demo_create.php
server/demo_install.php
server/faq.php
server/firstrun.php
server/index.php
server/lib/forgot_password_done_tmpl.php
server/lib/forgot_password_reset_tmpl.php
server/lib/forgot_password_thanks_tmpl.php
server/lib/forgot_password_tmpl.php
server/lib/personas_functions.php
server/lib/signup_login_tmpl.php
server/lib/storage.php
server/lib/upload_persona_tmpl.php
server/lib/upload_success_tmpl.php
server/lib/upload_tos_tmpl.php
server/lib/user.php
server/personadetail.php
server/privacy.php
server/signin.php
server/templates/category_nav.php
server/templates/featured_designer.php
server/templates/featured_personas.php
server/templates/footer.php
server/templates/forgot_password_done_tmpl.php
server/templates/forgot_password_reset_tmpl.php
server/templates/forgot_password_thanks_tmpl.php
server/templates/forgot_password_tmpl.php
server/templates/get_personas.php
server/templates/header.php
server/templates/login_form.php
server/templates/nav.php
server/templates/popular_personas.php
server/templates/signup_form.php
server/templates/upload_persona_tmpl.php
server/templates/upload_success_tmpl.php
server/templates/upload_tos_tmpl.php
server/templates/user_error.php
server/updated.php
server/upload_forms.php
server/viewpersonas.php
store/demo_create.html
store/demo_install.html
store/faq.html
store/privacy.html
--- a/compile.php
+++ b/compile.php
@@ -41,185 +41,153 @@
 	require_once 'server/lib/personas_functions.php';	
 	require_once 'server/lib/storage.php';
 
 	$page_size = 21;
 	
 	$db = new PersonaStorage();
 	$categories = $db->get_categories();
 
-	####HACK to be removed after launch and replacing all the other files
-	function get_recent_page_hack()
-	{
-		$ch = curl_init();
-		$fp = fopen(PERSONAS_STORAGE_PREFIX . "/recent.html", "w");	
-		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/gallery/All/Recent?no_my=1");
-		curl_setopt($ch, CURLOPT_FILE, $fp);
-		curl_exec($ch);
-		fclose($fp);	
-	}
-
+	
 	function get_directory_html($path, $file)
 	{
 		if (!is_dir(PERSONAS_STORAGE_PREFIX . "/gallery/$path"))
 		{
 			mkdir(PERSONAS_STORAGE_PREFIX . "/gallery/$path");
 		}
 
 		$ch = curl_init();
 		$fp = fopen(PERSONAS_STORAGE_PREFIX . "/gallery/$path/$file", "w");	
 		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/gallery/$path/$file?no_my=1");
 		curl_setopt($ch, CURLOPT_FILE, $fp);
 		curl_exec($ch);
 		fclose($fp);	
 	}
 
-	function get_persona_html($id)
-	{
-		$path = make_persona_detail_path($id);
-
-		$ch = curl_init();
-		$fp = fopen("$path/$id", "w");	
-		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/persona/$id?no_my=1");
-		curl_setopt($ch, CURLOPT_FILE, $fp);
-		curl_exec($ch);
-		fclose($fp);	
-	}
-
-	function get_mainpage_html()
+	function make_directory_path($file)
 	{
-		$path = PERSONAS_STORAGE_PREFIX . "/index.html";
-
-		$ch = curl_init();
-		$fp = fopen("$path", "w");	
-		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/");
-		curl_setopt($ch, CURLOPT_FILE, $fp);
-		curl_exec($ch);
-		fclose($fp);	
+		$file = substr($file, 1); #remove leading slash
+		$components = explode("/", $file);
+		array_pop($components); #remove filename
+		$path = "";
+		foreach ($components as $dir)
+		{
+			$path .= "/" . $dir;
+			if (!is_dir($path))
+				mkdir($path);
+		}
 	}
-
-	function get_featured_html($db)
+	
+	function store_page($url, $filename)
 	{
-		$path = PERSONAS_STORAGE_PREFIX . "/featured";
-		$persona = $db->get_persona_by_id(FEATURE_DESIGNER_PERSONA_ID);
+		make_directory_path($filename);
+		$fp = fopen($filename, "w");
 
 		$ch = curl_init();
-		$fp = fopen("$path", "w");	
-		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/gallery/Designer/" . $persona['author'] . "?no_my=1");
-		curl_setopt($ch, CURLOPT_FILE, $fp);
-		curl_exec($ch);
-		fclose($fp);	
-	}
-
-	function get_updated_html()
-	{
-		$path = PERSONAS_STORAGE_PREFIX . "/updated/index.html";
-
-		$ch = curl_init();
-		$fp = fopen("$path", "w");	
-		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/updated");
+		curl_setopt($ch, CURLOPT_URL, $url);
 		curl_setopt($ch, CURLOPT_FILE, $fp);
 		curl_exec($ch);
-		fclose($fp);	
+		fclose($fp);		
 	}
 
-	function get_firstrun_html()
-	{
-		$path = PERSONAS_STORAGE_PREFIX . "/firstrun/index.html";
-
-		$ch = curl_init();
-		$fp = fopen("$path", "w");	
-		curl_setopt($ch, CURLOPT_URL, "http://localhost/store/dynamic/firstrun");
-		curl_setopt($ch, CURLOPT_FILE, $fp);
-		curl_exec($ch);
-		fclose($fp);	
-	}
-
-	get_directory_html('All', 'All');
-
 	#Top level popular page
 	$popular_list = $db->get_popular_personas(null, 21);
 	foreach ($popular_list as $item)
 	{
 		$data = extract_record_data($item);
 		$data['recent'] = (time() - strtotime($item['approve']) < 604800) ? true : false;
 		$popular_json[] = $data;
 	}
 	$master['popular'] = $popular_json;
 
-	get_directory_html('All', 'Popular');
-	
 	#Top level recent page
 	$recent_list = $db->get_recent_personas(null, 21);
 	foreach ($recent_list as $item)
 	{
 		$data = extract_record_data($item);
 		$data['recent'] = (time() - strtotime($item['approve']) < 604800) ? true : false;
 		$recent_json[] = $data;
 	}
 	$master['recent'] = $recent_json;
 
-	get_directory_html('All', 'Recent');
-	
 
 	foreach ($categories as $category)
 	{
 		#get category counts for pagination
 		$category_total = $db->get_personas_by_category_count($category);
 		$pages = floor($category_total/$page_size) + 1;
 		
-		$storage_path = PERSONAS_STORAGE_PREFIX . '/' . preg_replace('/ /', '_', $category);
-		if (!is_dir($storage_path))
-		{
-			mkdir($storage_path);
-		}
-
 		$popular_list = $db->get_popular_personas($category, 10);
 	
 		$count = 0;
 		$short_cat_list = array();
 		foreach ($popular_list as $item)
 		{
 			$data = extract_record_data($item);
 			$data['recent'] = (time() - strtotime($item['approve']) < 604800) ? true : false;
 			$short_cat_list[] = $data;
 		}
 		$category_array[] = array('name' => $category, 'personas' => $short_cat_list);
 
 		#get the html
-		get_directory_html("$category", "Popular");
-		get_directory_html("$category", "Recent");
+		#the popular page
+		store_page("http://localhost/gallery/$category/Popular?no_my", PERSONAS_STORAGE_PREFIX . "/gallery/$category/Popular");
+	
+		#the recent page
+		store_page("http://localhost/gallery/$category/Recent?no_my", PERSONAS_STORAGE_PREFIX . "/gallery/$category/Recent");
 
 		$i = 1;
 		while ($i <= $pages)
 		{
-			get_directory_html("$category/All", "$i");
+			store_page("http://localhost/gallery/$category/All/$i?no_my", PERSONAS_STORAGE_PREFIX . "/gallery/$category/All/$i");
 			$i++;
 		}		
 	}
 	$master['categories'] = $category_array;
 
 	file_put_contents(PERSONAS_STORAGE_PREFIX . '/index_1.json', json_encode($master));
 
 	#now write out the individual pages
 	$master_list = $db->get_active_persona_ids();
 	foreach ($master_list as $id)
 	{
-		get_persona_html($id);
+		$path = get_persona_path(PERSONAS_STORAGE_PREFIX . "/gallery/persona", $id);
+		store_page("http://localhost/persona/$id", $path . "/$id");
 	}
-	
+		
 	#and the index
-	get_mainpage_html();
+	store_page("http://localhost/index.html?no_my=1", PERSONAS_STORAGE_PREFIX . "/index.html");
+
+	#the all page
+	store_page("http://localhost/gallery/All/All?no_my", PERSONAS_STORAGE_PREFIX . "/gallery/All/All");
+
+	#the popular page
+	store_page("http://localhost/gallery/All/Popular?no_my", PERSONAS_STORAGE_PREFIX . "/gallery/All/Popular");
+
+	#the recent page
+	store_page("http://localhost/gallery/All/Recent?no_my", PERSONAS_STORAGE_PREFIX . "/gallery/All/Recent");
 
 	#featured designers
-	get_featured_html($db);
-
+	$featured_persona = $db->get_persona_by_id(FEATURE_DESIGNER_PERSONA_ID);
+	store_page("http://localhost/gallery/Designer/" . $featured_persona['author'] . "?no_my=1", PERSONAS_STORAGE_PREFIX . "/featured");
+	
 	#update page
-	get_updated_html();
+	store_page("http://localhost/updated?no_my=1", PERSONAS_STORAGE_PREFIX . "/updated.html");
 
 	#firstrun page
-	get_firstrun_html();
+	store_page("http://localhost/firstrun?no_my=1", PERSONAS_STORAGE_PREFIX . "/firstrun.html");
+
+	#recent page hack to provide a backwards compatible recent.html
+	store_page("http://localhost/gallery/All/Recent?no_my=1", PERSONAS_STORAGE_PREFIX . "/recent.html");
+
+	#faq
+	store_page("http://localhost/faq?no_my=1", PERSONAS_STORAGE_PREFIX . "/faq.html");
 
-	#hack to provide a recent.html page during the transition
-	get_recent_page_hack();
+	#demo_install
+	store_page("http://localhost/demo_install?no_my=1", PERSONAS_STORAGE_PREFIX . "/demo_install.html");
 
+	#demo_create
+	store_page("http://localhost/demo_install?no_my=1", PERSONAS_STORAGE_PREFIX . "/demo_create.html");
 
+	#privacy
+	store_page("http://localhost/demo_install?no_my=1", PERSONAS_STORAGE_PREFIX . "/privacy.html");
+	
 ?>
\ No newline at end of file
index 0c680a09b1beafe0e4c8db67a4e583c592219521..35dab9a388fc0dd94c145af82f636940c47d4241
GIT binary patch
literal 6148
zc%1E*-%i3X6o-Eu(+rJCFS+a^=o>TypTGxDCu)|A%{Y<UJ%dkdOMegwlf@e$a=xVb
zNO#UDTa*3)pvLp*4WI#J2u_CRBxBnlp)Xuh%No_oqPWh>I`6I|936h{&hUsSW+<Zh
z)2oo;srvNuyB*mq%DQ@Wy<e^kP`ci{Cx0Ck<zC?p&v-|J8kHNN!F`BB(^GG6W;DhS
zA1-p{;!79jfA`hy%!q29W4?S^`>)bdZ7VjaBM5@<*MyY`+2vvXh9C$>h+iKJZRs{x
z@p(e08#$Ubw58i%#khn{>5SI2p)K78bJ0?~d?=2rctcS<d?`cQU%j#*oD72??f3uN
ypYQ*IApB!gI=P#SvAz)O;P+bN+QTXV@j-xnDP#RsJlg0tw58i%IS2^Cq4)-J$yl8L
--- a/server/admin/editing.php
+++ b/server/admin/editing.php
@@ -60,60 +60,43 @@
 		$message .= "If you have any questions or want more information, please stop by the Persona message boards and tell us what's on your mind.\n\n";
 		$message .= "Best Wishes,\n";
 		$message .= "The Personas Team\n";
 		
 		$header = "From: personas-devel@mozilla.com\r\n";
 		return mail($address, 'Your Persona has been successfully edited', $message, $header);
 	}
 	 
-	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
-	header('Pragma: private');
-	
+	$title = "Admin | Edits Pending Approval";
 
 	try 
 	{
 		$user = new PersonaUser();
-		$user->authenticate(1);
+		$user->authenticate();
+		$user->force_signin(1);
 		if (!$user->has_admin_privs())
 		{
-			$this->_errors['login_user'] = "This account does not have privileges for this operation. Please log in with an account that does.";
-			$user->auth_form();
+			$_errors['error'] = 'This account does not have privileges for this operation. Please <a href="/signin?action=logout">log in</a> with an account that does.';
+			include '../templates/user_error.php';
 			exit;
 		}
 	}
 	catch(Exception $e)
 	{
 		error_log($e->getMessage());
 		print("Database problem. Please try again later.");
 		exit;
 	}
+
+	include '../templates/header.php'; ?>
 ?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Gallery</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
 <body>
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
+<?php include '../templates/nav.php'; ?>
             <div id="header">
                 <h2>View Personas</h2>
                 <h3>Your browser, your style! Dress it up with easy-to-change "skins" for your
                 Firefox.</h3>
             </div>
             <div id="maincontent">
                 <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : Admin </p>
                 <div id="gallery">
@@ -330,20 +313,16 @@
 			foreach ($categories as $list_category)
 			{
 				print "		<li" . ($page_category == $list_category ? ' class="active"' : "") . "><a href=\"/admin/editing.php?category=$list_category\">$list_category</a></li>\n";
 			}
 ?>
             </div>
         </div>
     </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
+<?php include '../templates/footer.php'; ?>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function() {
            $("#gallery .preview img").previewPersona();
         });
     </script>
-    <div id="footer">
-        <p>Copyright ' <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>   |  Terms of Use  |  Privacy</p>
-    </div>
 </body>
 </html>
--- a/server/admin/pending.php
+++ b/server/admin/pending.php
@@ -49,20 +49,21 @@
 		$message .= "If you have any questions or want more information, please stop by the Persona message boards and tell us what's on your mind.\n\n";
 		$message .= "Best Wishes,\n";
 		$message .= "The Personas Team\n";
 		
 		$header = "From: personas-devel@mozilla.com\r\n";
 		return mail($address, 'A problem with your Persona submission', $message, $header);
 	}
 	
-	function send_accept_email($address, $name)
+	function send_accept_email($address, $name, $id)
 	{
 		$message = "Thanks for submitting your Persona '$name'! We're big fans of creativity, and it's fun to see how people are dressing up their browsers.\n\n";
-		$message .= "You can check it out now in the <a href=\"http://www.getpersonas.com/store/gallery/All/Recent\"Personas directory</a>.\n\n";
+		$message .= "Once it gets automatically copied up to the live server you'll be able to view it in <a href=\"http://www.getpersonas.com/persona/$id\">its new home</a>.\n\n";
+		$message .= "You can also check it out shortly in the <a href=\"http://www.getpersonas.com/store/gallery/All/Recent\">Personas directory</a>.\n\n";
 		$message .= "If you have any questions or want more information, please stop by the <a href=\"https://labs.mozilla.com/forum/?CategoryID=18\">Persona message boards</a> and tell us what's on your mind.\n\n";
 		$message .= "Best Wishes,\n";
 		$message .= "The Personas Team\n";
 		
 		$header = "From: personas-devel@mozilla.com\r\n";
 		return mail($address, 'Thanks for submitting your Firefox persona', $message, $header);
 	}
 	
@@ -72,60 +73,44 @@
 		$message .= "If you have any questions or want more information, please stop by the Persona message boards and tell us what's on your mind.\n\n";
 		$message .= "Best Wishes,\n";
 		$message .= "The Personas Team\n";
 		
 		$header = "From: personas-devel@mozilla.com\r\n";
 		return mail($address, 'Your Persona has been successfully edited', $message, $header);
 	}
 	 
-	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
-	header('Pragma: private');
-	
+
+	$title = "Admin | Uploads Pending Approval";
 
 	try 
 	{
 		$user = new PersonaUser();
-		$user->authenticate(1);
+		$user->authenticate();
+		$user->force_signin(1);
 		if (!$user->has_admin_privs())
 		{
-			$this->_errors['login_user'] = "This account does not have privileges for this operation. Please log in with an account that does.";
-			$user->auth_form();
+			$_errors['error'] = 'This account does not have privileges for this operation. Please <a href="/signin?action=logout">log in</a> with an account that does.';
+			include '../templates/user_error.php';
 			exit;
 		}
 	}
 	catch(Exception $e)
 	{
 		error_log($e->getMessage());
 		print("Database problem. Please try again later.");
 		exit;
 	}
+
+	include '../templates/header.php';
 ?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Gallery</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
 <body>
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
+<?php include '../templates/nav.php'; ?>
             <div id="header">
                 <h2>View Personas</h2>
                 <h3>Your browser, your style! Dress it up with easy-to-change "skins" for your
                 Firefox.</h3>
             </div>
             <div id="maincontent">
                 <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : Admin </p>
                 <div id="gallery">
@@ -141,17 +126,17 @@
 	{
 		$persona = $db->get_persona_by_id($id);
 
 		switch ($_GET['verdict'])
 		{
 			case 'accept':
 				rename (make_persona_pending_path($id), make_persona_storage_path($id));
 				$db->approve_persona($persona{'id'});
-				send_accept_email($user->get_email($persona['author']), $persona['name']);
+				send_accept_email($user->get_email($persona['author']), $persona['name'], $persona['id']);
 				$id = null;
 				break;
 			case 'change':
 				$change_category = ini_get('magic_quotes_gpc') ? stripslashes($_GET['changecategory']) : $_GET['changecategory'];
 				$db->change_persona_category($persona['id'], $change_category);
 				break;			
 			case 'rebuild':
 				build_persona_files(make_persona_pending_path($id), $persona);
@@ -281,20 +266,16 @@
 			foreach ($categories as $list_category)
 			{
 				print "		<li" . ($page_category == $list_category ? ' class="active"' : "") . "><a href=\"/admin/pending.php?category=$list_category\">$list_category</a></li>\n";
 			}
 ?>
             </div>
         </div>
     </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
+<?php include '../templates/footer.php'; ?>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function() {
            $("#gallery .preview img").previewPersona();
         });
     </script>
-    <div id="footer">
-        <p>Copyright ' <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="privacy.html">Privacy</a></p>
-    </div>
 </body>
 </html>
--- a/server/change_password.php
+++ b/server/change_password.php
@@ -1,145 +1,143 @@
 <?php
 	require_once 'lib/personas_constants.php';
 	require_once 'lib/user.php';	
-
-	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
-	header('Pragma: private');
 	
+	$_GET['no_my'] = 1;
 	$user = new PersonaUser();
 	$error = null;
 	
 	
 	#initial request page
 	if (array_key_exists('userreq', $_POST))
 	{
 		try
 		{
 			$username = array_key_exists('userreq', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['userreq']) : $_POST['userreq']) : null;
 			if (!$user->user_exists($username))
 			{
 				$error = "Oops!  We are unable to locate the username you entered.  Please try again, or <a href='https://personas.services.mozilla.com/upload'>create a new one</a>.";
-				include "lib/forgot_password_tmpl.php";
+				include "templates/forgot_password_tmpl.php";
 				exit;
 			}
 			
 			$email = $user->get_email($username);
 			if (!$email)
 			{
 				$error = "We have no email address on file for you. Please contact personas-devel@mozilla.com";
-				include "lib/forgot_password_tmpl.php";
+				include "templates/forgot_password_tmpl.php";
 				exit;
 			}
 			
 			$code = $user->generate_password_change_code($username);
 			$mail_message = "So many passwords to remember! You asked to reset your personas password. To do so, please visit:\n\n";
 			$mail_message .= "https://personas.services.mozilla.com/forgot_password?username=$username&code=$code\n\n";
 			$mail_message .= "This link will let you change your password to something new. If you didn't ask for this, don't worry, we'll keep your password safe.\n\n";
 			$mail_message .= "Best Wishes,\n";
 			$mail_message .= "The Personas Team\n";
 			
 			if (!mail($email, 'Resetting your personas password', $mail_message, "From: personas-devel@mozilla.com\r\n"))
 			{
 				$error = "There was a problem with our mail server. Please try again in a few minutes. If it continues to not work, please contact personas-devel@mozilla.com";
-				include "lib/forgot_password_tmpl.php";
+				include "templates/forgot_password_tmpl.php";
 				exit;
 			}
 			
-			include "lib/forgot_password_thanks_tmpl.php";
+			include "templates/forgot_password_thanks_tmpl.php";
 			exit;
 		}
 		catch (Exception $e)
 		{
 			$error = "There was an internal error. Please contact personas-devel@mozilla.com";
 			error_log($e->getMessage());
-			include "lib/forgot_password_tmpl.php";
+			include "templates/forgot_password_tmpl.php";
 			exit;
 		}
 	}
 	
 	#here's a code, so give the password form
 	if (array_key_exists('username', $_GET))
 	{
 		try
 		{
 			$username = array_key_exists('username', $_GET) ? (ini_get('magic_quotes_gpc') ? stripslashes($_GET['username']) : $_GET['username']) : null;
 			$code = array_key_exists('code', $_GET) ? (ini_get('magic_quotes_gpc') ? stripslashes($_GET['code']) : $_GET['code']) : null;
 	
 			if (!$user->check_password_change_code($username, $code))
 			{
 				$error = "The code you submitted is not valid for that username. Please request another one";
-				include "lib/forgot_password_tmpl.php";
+				include "templates/forgot_password_tmpl.php";
 				exit;
 			}
 			
-			include "lib/forgot_password_reset_tmpl.php";
+			include "templates/forgot_password_reset_tmpl.php";
 			exit;
 		}
 		catch (Exception $e)
 		{
 			$error = "There was an internal error. Please contact personas-devel@mozilla.com";
 			error_log($e->getMessage());
-			include "lib/forgot_password_reset_tmpl.php";
+			include "templates/forgot_password_reset_tmpl.php";
 			exit;
 		}
 	}
 	
 	if (array_key_exists('user', $_POST))
 	{
 		try
 		{
 			$username = array_key_exists('user', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['user']) : $_POST['user']) : null;
 			$code = array_key_exists('code', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['code']) : $_POST['code']) : null;
 			$password = array_key_exists('password', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['password']) : $_POST['password']) : null;
 			$conf = array_key_exists('password-verify', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['password-verify']) : $_POST['password-verify']) : null;
 	
 			if (!$code)
 			{
-				include "lib/forgot_password_tmpl.php";
+				include "templates/forgot_password_tmpl.php";
 				exit;
 			}
 			if (!$user->check_password_change_code($username, $code))
 			{
 				$error = "The code you submitted is not valid for that username. Please request another one";
-				include "lib/forgot_password_tmpl.php";
+				include "templates/forgot_password_tmpl.php";
 				exit;
 			}
 	
 			if (strlen($password) < 6)
 			{
 				$error = "Password must be at least 6 characters long";
-				include "lib/forgot_password_reset_tmpl.php";
+				include "templates/forgot_password_reset_tmpl.php";
 				exit;
 			}
 
 			if (!preg_match('/[A-Z]/i', $password) || !preg_match('/[^A-Z]/i', $password))
 			{
 				$error = "The password should contain at least one alphabetic character and at least one non-alphabetic character";
-				include "lib/forgot_password_reset_tmpl.php";
+				include "templates/forgot_password_reset_tmpl.php";
 				exit;
 			}
 			
 			if ($password != $conf)
 			{
 				$error = "The password and confirmation do not match. Please try again";
-				include "lib/forgot_password_reset_tmpl.php";
+				include "templates/forgot_password_reset_tmpl.php";
 				exit;
 			}			
 	
 			$user->update_password($username, $password);
 			
-			include "lib/forgot_password_done_tmpl.php";
+			include "templates/forgot_password_done_tmpl.php";
 			exit;			
 		}
 		catch (Exception $e)
 		{
 			$error = "There was an internal error. Please contact personas-devel@mozilla.com";
 			error_log($e->getMessage());
-			include "lib/forgot_password_reset_tmpl.php";
+			include "templates/forgot_password_reset_tmpl.php";
 			exit;			
 		}
 	}		
 
-	include "lib/forgot_password_tmpl.php";
+	include "templates/forgot_password_tmpl.php";
 	exit;
 
 ?>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/server/demo_create.php
@@ -0,0 +1,225 @@
+<?php
+	require_once 'lib/personas_constants.php';
+	require_once 'lib/user.php';	
+
+
+	$user = new PersonaUser();
+	$title = "How to Create Personas"; 
+	include 'templates/header.php'; 
+?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'templates/nav.php'; ?>
+            <div id="header">
+                <h2>Demo</h2>
+                <h3>Personas are lightweight, easy to install and easy to change “skins” for your Firefox web browser.</h3>
+            </div>
+            <div id="maincontent" class="demo">
+                <div id="breadcrumbs">
+                    <a href="http://www.getpersonas.com">Personas Home</a> : How to Create Personas
+                </div>
+                <h3>How to Create Personas</h3>
+                
+
+                
+                
+                <div id="tutorial">
+
+
+                	<!-- STEP 1 -->
+
+
+                		<div class="tut_Title">Step 1: Understanding and Designing Persona Header and Footer Images</div>
+
+                        <p>
+
+
+                		Personas are made up of two graphic image files - a "header" image and a "footer" image - which skin
+                		the default Firefox UI background.</p>
+
+                		<div class="tut_SubTitle">An example of a header image</div>
+
+                	    <p>
+
+                		The header image is displayed as the background of the top of the browser window, nestling in behind
+                		the toolbars, address bar, search bar and the tab strip.</p>
+
+                		<p><span class="tutBold">Whatever header image you create, it will be anchored to the top-right corner of the
+                		browser window</span>.  The right-hand side of the image is always visible, and as a user
+                		increases the width of the browser window, the browser reveals more of the left-hand side of the
+                		image. This means that the most valuable visual information should be placed in the upper right area
+                		of the header image.</p>
+
+                		<p>The browser might reveal more of the lower portion of the image as well if it (or an extension)
+                		adds another toolbar (like the toolbar that comes with the StumbleUpon extension) or other UI
+                		elements to the top of the window.</p>
+
+                		<p>The header image should be PNG or JPG, <span class="tutBold">3000 pixels wide and 200 pixels tall</span> and <span class="tutBold">no
+                		larger than 300kb in filesize.</span></p>
+
+
+                		<div class="tut_Image"><a href="/static/img/Persona_Header_LABS.jpg"><img src="/static/img/tut_headerImage.jpg"
+                		border="0"></a></div>
+
+                		<div class="tut_SubTitle">Header image as seen in OSX, XP and Vista</div>
+
+                		<div class="tut_Image"><img src="/static/img/tut_OSXheader.jpg" border="0"><span
+                		class="caption">OSX</span></div> <div class="tut_Image"><img src="/static/img/tut_XPheader.jpg"
+                		border="0"><span class="caption">Windows XP</span></div> <div class="tut_Image"><img
+                		src="/static/img/tut_VISTAheader.jpg" border="0"><span class="caption">Windows Vista</span></div>
+
+                		<div class="tut_SubTitle">An example of a footer image</div>
+
+                        <p>
+
+
+                		The footer image is displayed as the background of the bottom of the browser window, behind the
+                		status and find bars.</p>
+
+                		<p><span class="tutBold">The footer image, unlike the header, is anchored to the bottom-left corner of the browser
+                		window</span>, so the left-hand side of the image is always visible. As a user increases the width
+                		of the browser window, the browser reveals more of the right-hand side of the image.</p>
+
+                		<p>When the status bar is in its default state, there is very little of the footer image shown
+                		vertically, and this should be taken into account in your designs.  The browser might reveal more of
+                		the upper portion of the image as well if it (or an extension) adds another bar (like the Find bar)
+                		or other UI elements to the bottom of the window.</p>
+
+                		<p>The footer image should be PNG or JPG, <span class="tutBold">3000 pixels wide and 100 pixels tall</span> and <span class="tutBold">no
+                		larger than 300kb in filesize.</span></p>
+
+                		<div class="tut_Image"><a href="/static/img/Persona_Footer_LABS.jpg"><img src="/static/img/tut_footerImage.jpg"
+                		border="0"></a></div>
+
+                		<div class="tut_SubTitle">Footer image as seen in OSX, XP and Vista</div>
+
+                		<div class="tut_Image"><img src="/static/img/tut_OSXfooter.jpg" border="0"><span
+                		class="caption">OSX</span></div> <div class="tut_Image"><img src="/static/img/tut_XPfooter.jpg"
+                		border="0"><span class="caption">Windows XP</span></div> <div class="tut_Image"><img
+                		src="/static/img/tut_VISTAfooter.jpg" border="0"><span class="caption">Windows Vista</span></div>
+
+
+
+                	<!-- STEP 2 -->
+
+
+                		<div class="tut_Title">Step 2: Testing your Persona Header and Footer Images</div>
+
+                	    <p>
+
+                		In general, designs that feature rich content areas in the top-right corner of the browser work
+                		best. Though that may be true, you should always check to see where the UI elements sit on top of
+                		your designs within the different platform versions of Firefox. <p>This may be a critical step in
+                		finalizing your image, depending on the importance of the visual information you are including in
+                		your designs.</p>
+
+
+
+                		<div class="tut_SubTitle">Option 1: Using the Custom Persona setting within Firefox</div> 
+
+                		<p>
+
+
+                		Within the Personas menu in the bottom left of the browser's status bar, you can enable an "offline" Persona on your own personal computer by enabling a setting within Preferences.
+                		In doing this, you can test your Personas before submitting them to the online catalog.  Follow these four steps to get the Custom Personas option up and running in your browser:
+
+            		</p>
+
+                		<div class="tut_Image"><img src="/static/img/tut_custom_1.jpg" border="0"><br><span
+                		class="caption"><span class="tutBold">STEP 1)</span> select "Preferences..."  <span class="tutBold">STEP 2)</span> check "Show Custom Persona in menu" <span class="tutBold">STEP 3)</span> select the Custom Persona and "Edit"</span></div>
+
+                		<div class="tut_Image"><img src="/static/img/tut_custom_2.jpg" border="0"><br><span
+                		class="caption"><span class="tutBold">STEP 4)</span> Build the Persona using the upload fields and additional settings</span></div>
+
+
+                		<p>
+
+                		Once your images are playing nice with the UI for all the OS flavors of Firefox, save final copies (PNG or JPG) -
+                		but be sure to check to <span class="tutBold">ensure they don't exceed 300k in filesize!</span>. (Note: This will only test your Persona on the platform you are currently using)
+
+            		</p>
+
+                		
+
+                		<div class="tut_SubTitle">Option 2: Cross-Platform Photoshop PSD Header Template</div> 
+
+                        <p>
+
+                		We've created a positioning template that can be used to help figure out placement of your
+                		artwork. The template is structured to allow testing of your Persona header within OSX, Windows XP and Windows Vista
+                		flavors of the browser. </p>
+
+                		<div class="link">Download the Personas Header Template:  <a
+                		href="/static/img/Persona_Header_TEMPLATE.psd" class="button"><span>download</span><span>&nbsp;</span></a></div>
+
+
+                        <p>
+                		The key to using this PSD template is to simply layer your Persona header image underneath one of
+                		the three OS layers.  Be sure to turn off any of the OS layers you aren't using, as they will
+                		overlap each other due to their transparency.</p>
+
+                		<div class="tut_Image center"><img src="/static/img/tut_PSpalette.jpg" border="0"><br><span
+                		class="caption">Photoshop overlay layerset</span></div>
+
+                	
+
+                		<p>Once you turn on an OS layer, you will be able to see where the UI elements will sit on top of
+                		your designs and you can flag any conflicts that may arise. </p>
+
+                		<div class="tut_SubTitle">Layer Overlays in Header Template PSD</div>
+
+                		<div class="tut_Image"><img src="/static/img/tut_OSXmask.jpg" border="0"><span class="caption">OSX layer
+                		overlay</span></div> <div class="tut_Image"><img src="/static/img/tut_XPmask.jpg" border="0"><span
+                		class="caption">Windows XP layer overlay</span></div> <div class="tut_Image"><img
+                		src="/static/img/tut_VISTAmask.jpg" border="0"><span class="caption">Windows Vista layer
+                		overlay</span></div>
+
+
+                	    <p>
+
+                		The example below shows our tutorial header image layered underneath the XP overlay, highlighting
+                		where the UI will interact with the design and warning of any issues that you may want to address.
+                		The secondary dark bar below the toolbar images is the location of the tabstrip.</p>
+
+                		<div class="tut_Image"><img src="/static/img/tut_XPoverlay.jpg" border="0"><span class="caption">XP
+                		overlay on top of header image</span></div>
+
+                		<p>
+                		Once your images are playing nice with the UI for all the OS flavors of Firefox, save final copies (PNG or JPG) -
+                		but be sure to check to <span class="tutBold">ensure they don't exceed 300k in filesize!</span>.</p>
+
+
+
+                	<!-- STEP 3 -->
+
+
+
+                		<div class="tut_Title">Step 3: Submit your Persona!</div>
+
+                        <p>
+
+                		Now that you have finalized the artwork, it is time to share! One thing to note, please do be sure
+                		that you have the rights to use whatever image or design you use in your Persona. (We don't want to
+                		get any nasty lawyer letters!)</p>
+
+                		<p>Follow the link below to start the process and add your creations to the constantly growing
+                		catalog of Firefox Personas!</p>
+
+                		<div class="link">Go create your first Persona:  <a href="/upload" class="button"><span>get started!</span><span>&nbsp;</span></a></div>
+
+
+
+
+                	</div>
+                
+                
+         
+         
+            </div>
+<?php include 'templates/get_personas.php'; ?>
+        </div>
+    </div>
+<?php include 'templates/footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/demo_install.php
@@ -0,0 +1,37 @@
+<?php
+	require_once 'lib/personas_constants.php';
+	require_once 'lib/user.php';	
+
+	$user = new PersonaUser();
+	$title = "How to Get Started"; 
+	include 'templates/header.php'; 
+?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'templates/nav.php'; ?>
+            <div id="header">
+                <h2>Watch Our Demo</h2>
+                <h3>Personas are lightweight, easy to install and easy to change “skins” for your Firefox web browser.</h3>
+            </div>
+            <div id="maincontent" class="demo">
+                <div id="breadcrumbs">
+                    <a href="/">Personas Home</a> : Watch Our Demo    
+                </div>
+                <h3>How to Get Started</h3>
+                
+					<object width="400" height="300"><param name="allowfullscreen" value="true"/>
+					<param name="allowscriptaccess" value="always" />
+					<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3841582&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />
+					<embed src="http://vimeo.com/moogaloop.swf?clip_id=3841582&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" 
+					allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed>
+					</object>
+                
+            </div>
+<?php include 'templates/get_personas.php'; ?>
+            
+        </div>
+    </div>
+<?php include 'templates/footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/faq.php
@@ -0,0 +1,138 @@
+<?php
+	require_once 'lib/personas_constants.php';
+	require_once 'lib/user.php';	
+
+
+	$user = new PersonaUser();
+
+	$title = "Frequent Questions"; 
+	include 'templates/header.php'; 
+?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'templates/nav.php'; ?>
+            <div id="header">
+                <h2>Frequent Questions</h2>
+                <h3>Personas are lightweight, easy to install and easy to change “skins” for your Firefox web browser.</h3>
+            </div>
+            <div id="maincontent" class="demo">
+                <div id="breadcrumbs">
+                    <a href="http://www.getpersonas.com">Personas Home</a> :  Frequent Questions
+                </div>
+               
+                <dl>
+                    <dt>What are Personas?</dt>
+                    <dd>
+                        <p>Personas are lightweight “skins” that change the look of your Firefox web browser. You can easily switch between Personas with just a few clicks. There are hundreds of Personas to choose from, with more added every day. You can even create your own and share it with others.</p>
+                    </dd>
+                    <dt>How do I add Personas to my Firefox?</dt>
+                    <dd><p>In less than 60 seconds, you can install a Persona and transform the look of your Firefox web browser. Visit <a href="http://getpersonas.com">GetPersonas.com</a> and click the download button. After installation, you will be asked to restart Firefox.</p>
+
+                    <p>If you want to see how it works, you can watch a quick video demonstration <a href="/demo_install">here</a>.</p>
+
+                    <p>Once Personas are installed, you’ll be able to choose and change your selected Persona any time simply by clicking on the little fox mask in the lower left-hand corner of your browser window.</p></dd>
+                
+                
+                <dt>How can I add or change my current Persona?</dt>
+                <dd><p>There are two easy ways to change your Persona:</p>
+                    <ol>
+                        <li>Visit the Personas website at <a href="http://getpersonas.com">GetPersonas.com</a>, check out the gallery, choose your favorite Persona, and click on your choice to instantly change the look of your browser.<br> OR</li>
+                       <li>Click on the little fox mask in the lower left hand corner of your browser, then select a Persona that suits your style.</li>
+                    </ol>
+                
+               <dt>I can't seem to find Personas for Firefox after I downloaded it and installed it.  Where is it?</dt>
+               <dd><p>Look for the little fox mask in the lower left-hand corner of your Firefox browser window.</p></dd>
+               
+               
+               <dt>Can I create my own Persona?</dt>
+
+               <dd><p>Absolutely! All you need to do is create two graphics files in your favorite graphics editing program (<em>e.g.</em>, Photoshop). To get started read more about how to <a href="/demo_create">create a Persona</a>.</p></dd>
+               
+               <dt>What's the maximum file size allowable for my persona?</dt>
+
+               <dd><p>The persona that you upload may not exceed 300KB for the header or the footer
+               image.</p></dd>
+               
+               
+
+               <dt>Do I still retain ownership over Persona artwork that I upload to the Personas website?</dt>
+
+               <dd><p>Yes.</p></dd> 
+
+
+               <dt>What’s the difference between a Firefox theme and Personas for Firefox?</dt>
+
+               <dd><p>Personas allow you to “skin” the top and bottom areas of Firefox only (the header and footer of the browser chrome) without any change to the look of the navigation buttons or menus. With Personas, you can easily switch between many different lightweight skins with no further installation required.</p>
+
+               <p>Like Personas, a Firefox theme is a type of Firefox add-on that extends the functionality of your browser and allows you to “skin” it in a variety of ways. However, unlike Personas, a theme changes the appearance of navigation buttons, toolbars and menus.  </p></dd>
+
+
+               <dt>If I have an existing Firefox theme installed, will Personas still work?</dt>
+
+               <dd><p>Yes, Personas will work. However, it’s strongly recommended that you uninstall a theme when using Personas. To disable a current Firefox theme, go to the “Tools” menu and select “Add-ons” to display the add-ons manager. Then click on the “Themes” button at the top of the add-ons manager window, click on the “Default” theme for Firefox, and click on “Use theme”. After a quick restart, you’ll be ready to dress up your browser with Personas.</p></dd>
+
+
+               <dt>Do I have to add my Persona to the public gallery?</dt>
+
+               <dd><p>No. When you upload your Persona at GetPersonas.com, you can choose to add it to the public gallery or keep it private. If you want to upload a custom Persona without visiting GetPersonas.com, you can do so anytime by following these steps:</p>
+
+            <ol>            
+               <li>Enable custom Personas in your version of Personas:
+                   <ul>
+                       <li>Click on the little fox mask icon in the lower left-hand corner of your browser</li>
+                          <li>Select "Preferences..."</li>
+                          <li>Under “Advanced”, select "Show Custom Persona Menu"</li>
+                          <li>Close the preferences window</li>
+                   </ul>
+               </li>
+               
+               <li>Create your custom Persona:
+               <ul>
+                 <li>Click on the little fox mask icon in the lower left-hand corner of your browser</li>
+                 <li>Select "Custom Persona", then select "Edit" from its sub-menu</li>
+                 <li>Specify a header, footer, text color and accent color for a Persona that’s locally stored on your computer</li>
+                 <li>Your new Persona will be automatically selected, or you can manually choose it from the little fox mask menu </li>
+                 </ul>
+</ol>
+
+               <dt>What kind of computer and operating system does Personas work with?</dt>
+
+               <dd><p>Personas work with any type of computer that has Firefox installed. This includes Apple Mac, Linux and Windows platforms. You must have administrative rights to add Personas to your Firefox browser.</p></dd>
+
+
+               <dt>How do I uninstall Personas for Firefox?</dt>
+
+               <dd><p>If you’ve decided Personas doesn’t work for you, you can uninstall with a few easy steps:</p>
+                   <ol>
+                      <li>Open the Add-ons dialog box by going to “Tools->Add-ons”</li>
+                      <li>Click on the “Extensions” button on the top</li>
+                      <li>Select “Personas” </li>
+                      <li>Click "Uninstall"</li>
+                      <li>Restart Firefox</li>
+                      </ol></dd>
+
+
+               <dt>How do I provide feedback? </dt>
+
+               <dd><p>Personas is currently in beta, so we’re always looking for ways to improve the product. We’d love to hear what you think. Visit the <a href="https://labs.mozilla.com/forum/?CategoryID=18">Personas</a> forums to send us your feedback.</p>
+
+
+
+               <dt>Is Personas for Firefox open source?</dt>
+
+               <dd><p>Yes. The source code for Personas is available under the MPL/GPL/LGPL tri-license. You can view the source <a href="http://hg.mozilla.org/labs/personas/personas">here</a>.</p>
+
+         </dd>       
+			   <dt>Are Partnership Opportunities Available?</dt>
+ 			  <dd><p>Yes. If you want to learn more about how Personas can work with your organization and brand, send us an <a href="mailto:personas@mozilla.com">email</a>. Be sure to include your name, title, organization, and the purpose of your Persona.</p></dd> 
+               
+      </dl>
+                
+            </div>
+<?php include 'templates/get_personas.php'; ?>
+        </div>
+    </div>
+<?php include 'templates/footer.php'; ?>
+</body>
+</html>
--- a/server/firstrun.php
+++ b/server/firstrun.php
@@ -1,83 +1,52 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Thanks for installing Personas</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
+<?php
+	require_once 'lib/personas_constants.php';	
+	require_once 'lib/personas_functions.php';	
+	require_once 'lib/storage.php';
+	require_once 'lib/user.php';
+
+	$db = new PersonaStorage();
+	$user = new PersonaUser();
+
+	$title = "Thanks for installing Personas"; 
+	include 'templates/header.php'; 
+?>
 <body class="firstrun">
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                
-                <div id="check-it-out">
-                    <div class="hd">
-                        &nbsp;
-                    </div>
-                    <p class="bd">
-                        Check it out! Your browser's all dressed up.                        
-                    </p>
-                    <div class="ft">
-                        &nbsp;
-                    </div>
-                </div>
-                
-            </div>
+<?php include 'templates/nav.php'; ?>
             <div id="header">
                 <h2>Thanks for Installing Personas for Firefox!</h2>
                 <h2>The Easiest Way to Dress Up Your Browser.</h2>
             </div>
             
-            <div class="feature">
-                <h3>Featured Designer</h3>
-<?php
-	require_once 'lib/personas_constants.php';	
-	require_once 'lib/personas_functions.php';	
-	require_once 'lib/storage.php';
-
-
-	$db = new PersonaStorage();
-	$persona = $db->get_persona_by_id(FEATURE_DESIGNER_PERSONA_ID); 
-	$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-	$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
-?>
-					<img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
-                    <h4><?= $persona['author'] ?></h4>
-                    <p class="try"><a href="/store/featured">view more »</a></p>
-            </div>
+<?php include 'templates/featured_designer.php'; ?>
             
             <div class="feature ">
                 <h3>Get Started with Personas</h3>
                 <ol class="get-started">
                     <li class="one">Click on the fox mask in the lower left corner of your Firefox browser, or go to the Personas page directly from <a href="http://www.getpersonas.com">here</a>.</li>
-                    <li class="two">Next, select a Persona from the list, or check out the <a a href="../gallery/All/Popular">Personas gallery</a>.</li>
+                    <li class="two">Next, select a Persona from the list, or check out the <a a href="/gallery/All/Popular">Personas gallery</a>.</li>
                     <li class="three">You can change your persona as much as you like! Choose a new one from the list or <a href="https://personas.services.mozilla.com/upload">create your own</a>.</li>
                 </ol>
                 
-                <p>Have a Personas question or comment? Check out our <a href="../faq.html">FAQ</a> section or <a href="https://labs.mozilla.com/forum/?CategoryID=18">discussion
+                <p>Have a Personas question or comment? Check out our <a href="/faq">FAQ</a> section or <a href="https://labs.mozilla.com/forum/?CategoryID=18">discussion
                 forum</a>.
                 </p>
             </div>
             
             <div class="feature last more">
                 <h3>Find out more about Firefox</h3>
                 <p>Wondering what to do now? Our <a href="http://en-us.www.mozilla.com/en-US/firefox/central/">Getting Started</a> page has plenty of helpful information.</p>
                 <p>Questions? Our <a href="https://labs.mozilla.com/forum/?CategoryID=18">Support page</a> has answers.</p>
                 <p>Ready to customize? Now that you’ve got Firefox and Personas, find out more about all the ways you can <a href="https://addons.mozilla.org/en-US/firefox">personalize Firefox</a>!</p>
              
             </div>
             
         </div>
     </div>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="../privacy.html">Privacy</a></p>
-    </div>
+<?php include 'templates/footer.php'; ?>
     <p id="get-more-personas">
        Click on the fox mask to get started!
     </p>
-    <script src="/store/js/urchin.js"></script>
 </body>
 </html>
--- a/server/index.php
+++ b/server/index.php
@@ -1,30 +1,25 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Dress up your web browser</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
+<?php
+	require_once 'lib/personas_constants.php';	
+	require_once 'lib/personas_functions.php';	
+	require_once 'lib/storage.php';
+	require_once 'lib/user.php';
+
+	$db = new PersonaStorage();
+	$user = new PersonaUser();
+
+	$title = "Dress up your web browser"; 
+	include 'templates/header.php'; 
+?>
 <body class="home">
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
+<?php include 'templates/nav.php'; ?>
+			<div id="header">
                 <h2>What will your browser wear today?</h2>
                 <h3>Personas are lightweight, easy-to-install and easy-to-change "skins" for your Firefox web browser.</h3>
                 <div class="get-personas">
                     <div>
                         <p>
                             <a href="https://addons.mozilla.org/en-US/firefox/downloads/latest/10900" class="get-personas" id="download"><span>Get Personas for Firefox - Free</span><span class="arrow"></span></a>
                         </p>
                         <p class="platforms-note">Firefox Add-on for Windows, Mac or Linux</p>
@@ -33,110 +28,26 @@
                 
                 <div id="more-info">
                     <div id="info">
                         <h4>Theme your browser according to your mood, hobby or season. </h4>
                         <p>Click the green download button to get started!</p>                  
                     </div>
                 </div>
             </div>
-            <div class="feature slideshow">
-                <h3>Featured Personas</h3>
-                <ul id="slideshow-nav">
-                    <li><a href="#" class="active">1</a></li>
-                    <li><a href="#">2</a></li>
-                    <li><a href="#">3</a></li>
-                    <li><a href="#">4</a></li>
-                </ul>
-                <a href="#" id="slideshow-previous"><img src="/store/img/nav-prev.png" alt="Previous"/></a>
-                <a href="#" id="slideshow-next"><img src="/store/img/nav-next.png" alt="Next"/></a>
-                <div id="slideshow">
-                    <ul id="slides">
-<?php
-	require_once 'lib/personas_constants.php';	
-	require_once 'lib/personas_functions.php';	
-	require_once 'lib/storage.php';
-
-
-	$db = new PersonaStorage();
-	$featured = $db->get_featured_personas();
-	$description_max = 50;
-	foreach ($featured as $persona)
-	{
-		$item_description = $persona['description'];
-		if (strlen($item_description) > $description_max)
-		{
-			$item_description = substr($item_description, 0, $description_max);
-			$item_description = preg_replace('/ [^ ]+$/', '', $item_description) . '...';
-		}
-		$persona_date = date("n/j/Y", strtotime($persona['approve']));
-		$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-		$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
-?>
-                        <li>
-                            <img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
-                            <h4><?= $persona['name'] ?></h4>
-                            <p class="try"><a href="<?= $detail_url ?>">view details »</a></p>
-                            <hr />
-                            <p class="designer"><strong>Designer:</strong> <?= $persona['author'] ?></p>
-                            <p class="added"><strong>Added:</strong> <?= $persona_date?></p>
-                            <hr />
+<?php include 'templates/featured_personas.php'; ?>
+<?php include 'templates/featured_designer.php'; ?>
+<?php include 'templates/popular_personas.php'; ?>
 
-                        </li>
-<?php
-	}
-?>
-                    </ul>
-                    
-                </div>
-            </div>
-            <div class="feature">
-                 <h3>Featured Designer</h3>
-<?php
-	$persona = $db->get_persona_by_id(FEATURE_DESIGNER_PERSONA_ID); 
-	$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-	$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
-?>
-					<img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
-                    <h4><?= $persona['author'] ?></h4>
-                    <p class="try"><a href="/store/featured">view more »</a></p>
-            </div>
-            <div class="feature last">
-                <h3>Most Popular Personas</h3>
-                <ol class="popular">
-<?php
-	$list = $db->get_popular_personas(null,3);
-	foreach ($list as $persona)
-	{
-		$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-?>
-					<li>
-                            <h4><?= $persona['name'] ?></h4>
-                            <hr />
-                            <img class="persona" alt="<?= $persona['name'] ?>" persona="<?= $persona_json ?>" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_popular.jpg">
-                            <p class="downloads"><strong>Current Users:</strong> <?= number_format($persona['popularity']) ?></p>
-                    </li>
-<?php
-	}
-?>
-                </ol>
-                
-                
-            </div>
         </div>
     </div>
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
+<?php include 'templates/footer.php'; ?>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function () {
             $("#slideshow").slider();
             $("#more-info").popup();
             $("#download").personasDownload({"bundle":"bundle-url", "bundle-text":'<span>Get Firefox and Personas - Free</span><span class="arrow"></span>'});
             $("#header").ie6Warning({"message":'<div id="ie6">Upgrade your browser to get the most out of this website. <a href="%LINK%">Download Firefox for free</a>.</div>'});
             $("img.persona").previewPersona();
         });
     </script>
-    <script src="/store/js/urchin.js"></script>
 </body>
 </html>
deleted file mode 100644
--- a/server/lib/forgot_password_done_tmpl.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Forgot Your Password</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body class="forgot-password">
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Forgot Your Password?</h2>
-            </div>
-            <div id="maincontent">
-                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="https://personas.services.mozilla.com/upload">Sign In</a> : Forgot Your Password?</p>
-                <p>Your password has been reset. You may <a href="/upload">login</a> now.</p>
-            </div>
-        </div>
-    </div>
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
deleted file mode 100644
--- a/server/lib/forgot_password_reset_tmpl.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Forgot Your Password</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-
-</head>
-<body class="forgot-password">
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Forgot Your Password?</h2>
-            </div>
-            <div id="maincontent">
-                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="https://personas.services.mozilla.com/upload">Sign In</a> : Forgot Your Password?</p>
-                
-<?php 
-	if ($error)
-		echo "<h4 class=\"error\">$error</h4>";
-?>
-                <h4>Enter your new password:</h4>
-                
-                <form action="forgot_password" method="post">
-                <input type=hidden name="user" value="<?= $username ?>">
-                <input type=hidden name="code" value="<?= $code ?>">
-                 <p>
-                        <label for="password">New password</label>
-                        <input type="password" name="password" value="" id="password" />
-                    </p>
-                    
-                    <p>
-                        <label for="password-verify">Re-type your new password</label>
-                        <input type="password" name="password-verify" value="" id="" />
-                    </p>
-                    
-                    <button type="submit" class="button"><span>reset password</span><span class="arrow">&nbsp;</span></button>
-                    
-                </form>
-            </div>
-        </div>
-    </div>
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
deleted file mode 100644
--- a/server/lib/forgot_password_thanks_tmpl.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Forgot Your Password</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-
-</head>
-<body class="forgot-password">
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Forgot Your Password?</h2>
-                <h3>Follow the easy steps below to start dressing up your browser!</h3>
-            </div>
-            <div id="maincontent">
-                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="https://personas.services.mozilla.com/upload">Sign In</a> : Forgot Your Password?</p>
-                
-                <p>Your password reset information has been e-mailed to you.</p>
-            </div>
-        </div>
-    </div>
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
deleted file mode 100644
--- a/server/lib/forgot_password_tmpl.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Forgot Your Password</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-
-</head>
-<body class="forgot-password">
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Forgot Your Password?</h2>
-            </div>
-            <div id="maincontent">
-                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="https://personas.services.mozilla.com/upload">Sign In</a> : Forgot Your Password?</p>
-<?php 
-	if ($error)
-		echo "<h4 class=\"error\">$error</h4>";
-?>
-                <h4>Please enter your Personas username below</h4>
-                <form action="forgot_password" method="post">
-                    <p>
-                        <label for="username">Username:</label>
-                        <input type="text" name="userreq" value="" id="username"/>
-                    </p>
-                    
-                    <button type="submit" class="button"><span>continue</span><span class="arrow">&nbsp;</span></button>
-                </form>
-            </div>
-            
-        </div>
-    </div>
-    
-   
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
--- a/server/lib/personas_functions.php
+++ b/server/lib/personas_functions.php
@@ -56,16 +56,25 @@
 		$base = preg_replace('/\/$/', '', $base);
 		$persona_path = $base . '/' . $first_folder;
 		if (!is_dir($persona_path)) { mkdir($persona_path); }
 		$persona_path .= "/" . $second_folder;
 		if (!is_dir($persona_path)) { mkdir($persona_path); }
 		return $persona_path;
 		
 	}
+
+	function get_persona_path($base, $persona_id)
+	{
+		$second_folder = $persona_id%10;
+		$first_folder = ($persona_id%100 - $second_folder)/10;
+
+		$base = preg_replace('/\/$/', '', $base);
+		return $base . '/' . $first_folder . "/" . $second_folder;		
+	}
 	
 	function build_persona_files($persona_path, $persona)
 	{
 		$imgcommand = "convert " . $persona_path . "/" . $persona['header'] . " -gravity NorthEast -crop 600x200+0+0  -scale 200x100 " . $persona_path . "/preview.jpg";
 		exec($imgcommand);
 		$imgcommand2 = "convert " . $persona_path . "/" . $persona['header'] . " -gravity NorthEast -crop 1360x200+0+0 -scale 680x100 " . $persona_path . "/preview_large.jpg";
 		exec($imgcommand2);
 		$imgcommand3 = "convert " . $persona_path . "/" . $persona['header'] . " -gravity NorthEast -crop 320x220+0+0  -scale 64x44 " . $persona_path . "/preview_popular.jpg";
deleted file mode 100644
--- a/server/lib/signup_login_tmpl.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Login</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Login</h2>
-            </div>
-            <div id="maincontent" class="login-signup">
-                <div id="breadcrumbs">
-                    Personas Home : Login    
-                </div>
-				<?php if (array_key_exists('success_message', $this->_errors)) echo '<p class="logout-success">' . $this->_errors['success_message'] . '</p>' ?>
-                <div id="login">
-                    <h4>Already a Personas Designer?</h4>
-                    <form action="<?= $_SERVER['SCRIPT_NAME'] ?>" method="post">
-                        <p><label for="login_user">Username</label>
-                        <input type="text" name="login_user" value="" id="" <?php if (array_key_exists('login_user', $this->_errors)) echo 'class="error"' ?> />
-                        <?php if (array_key_exists('login_user', $this->_errors)) echo '<span class="error-message">' . $this->_errors['login_user'] . '</span>' ?>
-                        </p>
-                        
-                        <p><label for="login_pass">Password</label>
-                        <input type="password" name="login_pass" value="" id="" />
-                        <span class="extra-info">Minimum 6 characters</span>
-                        </p>
-                        
-                        <p><label for="login_remember"><input type="checkbox" name="login_remember" id="remember" value="1" /> Remember me on this computer</label></p>
-                        <button type="submit" class="button"><span>sign in</span><span class="arrow"></span></button>
-                        
-                        <p class="forgot"><a href="/forgot_password">Forgot your password?</a></p>
-                    </form>
-                </div>
-<?php if (!$this->_no_signup)    
-		{
-?>
-                <div id="signup">
-                    <h4>New Personas Designer?</h3>
-                    <form action="<?= $_SERVER['SCRIPT_NAME'] ?>" method="post">
-                    <p><label for="email">Email</label>
-                    <input type="text" name="create_email" value="" id="" <?php if (array_key_exists('create_email', $this->_errors)) echo 'class="error"' ?>/>
-					<?php if (array_key_exists('create_email', $this->_errors)) echo '<span class="error-message">' . $this->_errors['create_email'] . '</span>' ?>
-                    </p>
-                    
-                    <p><label for="username">Username (displayed in the Personas gallery)</label>
-                    <input type="text" name="create_username" value="" id="" <?php if (array_key_exists('create_username', $this->_errors)) echo 'class="error"' ?>/>
-					<?php if (array_key_exists('create_username', $this->_errors)) echo '<span class="error-message">' . $this->_errors['create_username'] . '</span>' ?>
-                    </p>
-                    
-                    <p><label for="password">Password</label>
-                    <input type="password" name="create_password" value="" id="" <?php if (array_key_exists('create_password', $this->_errors)) echo 'class="error"' ?>/>
-					<?php if (array_key_exists('create_password', $this->_errors)) echo '<span class="error-message">' . $this->_errors['create_password'] . '</span>' ?>
-                    </p>
-                    
-                    <p><label for="password_confirm">Confirm Password</label>
-                    <input type="password" name="create_passconf" value="" id="" <?php if (array_key_exists('create_passconf', $this->_errors)) echo 'class="error"' ?>/>
-					<?php if (array_key_exists('create_passconf', $this->_errors)) echo '<span class="error-message">' . $this->_errors['create_passconf'] . '</span>' ?>
-                    </p>
-                    
-                    <p class="news"><label for="news"><input type="checkbox" name="news" id="news" value="" /> I’d like to receive news and information about Personas</label></p>
-                    
-            
-                    <div id="captcha">
-                        <script type="text/javascript">
-                                var RecaptchaOptions = {
-                                   theme : 'clean',
-                                   tabindex : 11
-                                };
-                                </script>
-
-                                    <script type="text/javascript" src="https://api-secure.recaptcha.net/challenge?k=<?= RECAPTCHA_PUBLIC_KEY ?>"></script>
-
-                        	<noscript>
-                          		<iframe src="https://api-secure.recaptcha.net/noscript?k=<?= RECAPTCHA_PUBLIC_KEY ?>" height="300" width="500" frameborder="0"></iframe><br/>
-                          		<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
-                          		<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
-                        	</noscript>        
-							<?php if (array_key_exists('captcha', $this->_errors)) echo '<span class="error-message">' . $this->_errors['captcha'] . '</span>' ?>
-
-                        
-                    </div>
-                    
-                    <button type="submit" class="button"><span>sign me up</span><span class="arrow"></span></button>
-                    </form>
-                </div>
-			<p class="disclaimer">Mozilla values your privacy. We will not sell or rent your email address</p>
-<?php 
-		} 
-?>
-            </div>
-        </div>
-    </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
--- a/server/lib/storage.php
+++ b/server/lib/storage.php
@@ -283,17 +283,17 @@ class PersonaStorage
 		}		
 		return $personas;
 	}
 
 	function get_popular_personas($category = null, $limit = null, $offset = null)
 	{
 		try
 		{
-			$statement = 'select * from personas where status = 1' . ($category ? " and category = :category" : "") . ' and popularity > 0 order by popularity desc' . ($limit ? " limit $limit" : "") . ($offset ? " offset $offset" : "");
+			$statement = 'select * from personas where status = 1' . ($category ? " and category = :category" : "") . ' and (popularity > 0 or license = "restricted") order by popularity desc' . ($limit ? " limit $limit" : "") . ($offset ? " offset $offset" : "");
 			$sth = $this->_dbh->prepare($statement);
 			if ($category)
 			{
 				$sth->bindParam(':category', $category);
 			}
 			$sth->execute();
 		}
 		catch( PDOException $exception )
@@ -517,17 +517,17 @@ class PersonaStorage
 			$sth->bindParam(':name', $name);
 			$sth->bindParam(':header', $header);
 			$sth->bindParam(':footer', $footer);
 			$sth->bindParam(':category', $category);
 			$sth->bindParam(':author', $author);
 			$sth->bindParam(':accentcolor', $accent);
 			$sth->bindParam(':textcolor', $text);
 			$sth->bindParam(':description', $desc);
-			$sth->bindParam(':license', $desc);
+			$sth->bindParam(':license', $license);
 			$sth->bindParam(':reason', $reason);
 			$sth->bindParam(':reasonother', $reasonother);
 			$sth->execute();
 			return $this->_dbh->lastInsertId();
 		}
 		catch( PDOException $exception )
 		{
 			error_log($exception->getMessage());
deleted file mode 100644
--- a/server/lib/upload_persona_tmpl.php
+++ /dev/null
@@ -1,195 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | <?= $upload_submitted['id'] ? "Edit" : "Create" ?> Your Persona</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload" class="active">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Create Your Persona</h2>
-                <h3>Follow the easy steps below to start dressing up your browser!</h3>
-            </div>
-            <div id="maincontent">
-                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <?= $upload_submitted['id'] ? "Edit" : "Create" ?> Your Own</p>
-                
-                <h4><?= $upload_submitted['id'] ? "Edit" : "Create" ?> Your Persona</h4>
-                <form method="POST" action="upload" enctype='multipart/form-data'>
-				<input type="hidden" name="agree" value="<?= htmlspecialchars($upload_submitted['agree']) ?>">
-				<input type="hidden" name="license" value="<?= htmlspecialchars($upload_submitted['license']) ?>">
-				<input type="hidden" name="id" value="<?= htmlspecialchars($upload_submitted['id']) ?>">
-                <div id="create-part-1">
-                    <p>
-                        <label for="persona-name">Persona Name</label>
-                        <input type="text" name="name" value="<?= htmlspecialchars($upload_submitted['name']) ?>" id="name" <?php if (array_key_exists('name', $upload_errors)) echo 'class="error"' ?> />
-                        <?php if (array_key_exists('name', $upload_errors)) echo '<span class="error-message">' . $upload_errors['name'] . '</span>' ?>
-                     </p>
-                    
-                    <p>
-                        <label for="textcolor">Text Color</label>
-                        <input type="text" name="textcolor" value="<?= htmlspecialchars($upload_submitted['textcolor']) ?>" id="textcolor"/ <?php if (array_key_exists('textcolor', $upload_errors)) echo 'class="error"' ?>>
-                         <?php if (array_key_exists('textcolor', $upload_errors)) echo '<span class="error-message">' . $upload_errors['textcolor'] . '</span>' ?>
-                    </p>
-                    
-                    <p>
-                        <label for="header-image">Header Image</label>
-                        <span><input type="file" name="header-image" value="" id="header-image"  <?php if (array_key_exists('header-image', $upload_errors)) echo 'class="error"' ?> /></span>
-                        <?php if (array_key_exists('header-image', $upload_errors)) echo '<span class="error-message">' . $upload_errors['header-image'] . '</span>' ?>
-                    </p>
-                    
-                    <p>
-                        <label for="description">Description</label>
-                        <textarea name="description" id="description" <?php if (array_key_exists('desription', $upload_errors)) echo 'class="error"' ?> ><?= $upload_submitted['description'] ?></textarea>
-                        <?php if (array_key_exists('description', $upload_errors)) echo '<span class="error-message">' . $upload_errors['description'] . '</span>' ?>
-                     </p>
-                </div>
-                
-                <div id="create-part-2">
-                    <p>
-                        <label for="category">Category</label>
-                        <select name="category" id="category">
-<?php
-		echo '<option value=""';
-		if ($upload_submitted['category'] == "")
-			echo " selected";
-		echo "></option>\n";
-		
-		foreach ($categories as $category)
-		{
-			echo "<option value=\"$category\"";
-			if ($category == $upload_submitted['category'])
-				echo " selected";
-			echo ">$category</option>\n";
-		} 
-?>
-						</select>
-                        <?php if (array_key_exists('category', $upload_errors)) echo '<span class="error-message">' . $upload_errors['category'] . '</span>' ?>
-                    </p>
-                    <p>
-                        <label for="accentcolor">Accent Color</label>
-                        <input type="text" name="accentcolor" value="<?= htmlspecialchars($upload_submitted['accentcolor']) ?>" id="accentcolor"/ <?php if (array_key_exists('accentcolor', $upload_errors)) echo 'class="error"' ?> >
-                        <?php if (array_key_exists('accentcolor', $upload_errors)) echo '<span class="error-message">' . $upload_errors['accentcolor'] . '</span>' ?>
-                     </p>
-                    
-                    <p>
-                        <label for="footer-image">Footer Image</label>
-                        <span><input type="file" name="footer-image" value="" id="footer-image" <?php if (array_key_exists('footer-image', $upload_errors)) echo 'class="error"' ?> /></span>
-                        <?php if (array_key_exists('footer-image', $upload_errors)) echo '<span class="error-message">' . $upload_errors['footer-image'] . '</span>' ?>
-                     </p>
-                    
-                    <p>
-                        <label for="reason">I'm creating a Persona to...</label>
-                        <span>
-                            <select name="reason" id="reason">
-<?php
-		$reasons = Array("" => "", "fun" => "have some fun", "build" => "build a brand", "non-profit" => "support a non-profit cause", "other" => "other");
-		foreach ($reasons as $reason => $longreason)
-		{
-			print "<option value=\"$reason\"";
-			if ($reason == $upload_submitted['reason'])
-				echo " selected";
-			print ">$longreason</option>\n";
-		}
-?>
-                            </select>
-                         <?php if (array_key_exists('reason', $upload_errors)) echo '<span class="error-message">' . $upload_errors['reason'] . '</span>' ?>
-                        </span>
-                    </p>
-                    
-                    <p id="other-info">
-                        <label for="other-reason">Reason:</label>
-                        <input id="other-reason" name="other-reason" type="text" value="<?= htmlspecialchars($upload_submitted['other-reason']) ?>"/>
-                        <?php if (array_key_exists('other-reason', $upload_errors)) echo '<span class="error-message">' . $upload_errors['other-reason'] . '</span>' ?>
-                   </p>
-                    
-                </div>
-                
-                <p class="continue">
-                    <button type="submit" class="button"><span>continue</span><span class="arrow">&nbsp;</span></button></p>
-            	</form>
-            </div>
-            <div id="secondary-content">
-              <ol id="upload-steps">
-                   <li class="completed">                         
-                          	<h3>Step 1:</h3>
-                          	<h4>Terms of Service</h4>
-                      </li>
-                <li class="current">
-                    <div class="wrapper">
-                        <h3>Step 2:</h3>
-                        <h4>Create Your Persona</h4>
-                    </div>
-                </li>
-               
-                <li>
-                    <h3>Step 3:</h3>
-                    <h4>Finish!</h4>
-                </li>
-              </ol>
-            </div>
-        </div>
-    </div>
-    
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
-   <script type="text/javascript" charset="utf-8">
-    $('#textcolor').ColorPicker({
-    	onSubmit: function(hsb, hex, rgb) {
-    		$('#textcolor').val(hex);
-    	},
-    	onBeforeShow: function () {
-    		$(this).ColorPickerSetColor(this.value);
-    	},
-    	onChange: function (hsb, hex, rgb) {
-        		$('#textcolor').val(hex);
-        	}
-        
-    })
-    .bind('keyup', function(){
-    	$(this).ColorPickerSetColor(this.value);
-    });
-    
-    
-    $('#accentcolor').ColorPicker({
-    	onSubmit: function(hsb, hex, rgb) {
-    		$('#accentcolor').val(hex);
-    	},
-    	onBeforeShow: function () {
-    		$(this).ColorPickerSetColor(this.value);
-    	},
-    	onChange: function (hsb, hex, rgb) {
-        		$('#accentcolor').val(hex);
-        	}
-        
-    })
-    .bind('keyup', function(){
-    	$(this).ColorPickerSetColor(this.value);
-    });
-    
-     $("#reason").change(function() {
-        if($(this)[0].selectedIndex == 4) {
-            $("#other-info").show();
-        } else {
-            $("#other-info").hide();
-        }
-    });
-  </script>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
deleted file mode 100644
--- a/server/lib/upload_success_tmpl.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Success!</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload" class="active">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Create Your Own</h2>
-                <h3>It’s easy to create your own Persona just follow the easy steps below!</h3>
-            </div>
-            <div id="maincontent" class="success">
-                <div id="breadcrumbs">
-                    <a href="http://www.getpersonas.com">Personas Home</a> : Create Your Own    
-                </div>
-                <h2>Success!</h2>
-                <h3>You have successfully <?= $action_verb ? $action_verb : "added" ?> your Persona.</h3>
-                <ul class="success-options">
-                    <li><a href="http://www.getpersonas.com/store/gallery/All/Popular">View Personas Gallery »</a></li>
-                </ul>
-            </div>
-            <div id="secondary-content">
-              <ol id="upload-steps">
-                  <li class="completed"> <!-- class="completed" needed to show green checkbox -->
-                      <h3>Step 1:</h3>
-                      <h4>Terms of Service</h4>
-                  </li>
-                <li class="completed"> 
-                    <h3>Step 2:</h3>
-                    <h4>Create Your Persona</h4> 
-                </li>
-                
-                <li class="completed">
-                    <h3>Step 3:</h3>
-                    <h4>Finish!</h4>
-                </li>
-              </ol>
-            </div>
-        </div>
-    </div>
-    <script src="js/jquery.js"></script>
-    <script src="js/script.js"></script>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
deleted file mode 100644
--- a/server/lib/upload_tos_tmpl.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Create Your Persona</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"><a href="https://personas.services.mozilla.com/upload?action=logout">Sign out</a></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload" class="active">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Create Your Persona</h2>
-                <h3>Follow the easy steps below to start dressing up your browser!</h3>
-            </div>
-            <div id="maincontent">
-                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : Create Your Own</p>
-                
-                <h4>Terms of Service</h4>
-               <form action="upload" method="post">
-               <input type="hidden" name="firstterms" value="1">
-                        <textarea name="agreement" id="agreement" readonly>
-Personas Designer Agreement
-
-Dated: March 12, 2009
-
-If you upload a “persona” design for the Firefox® web browser (each a “Persona”) in connection with any “persona” distribution services or features (the “Persona Services”) provided by Mozilla Corporation (“Mozilla”), you and your Personas are subject to the following terms, as well as Mozilla’s Privacy Policy, web site notices and other policies, guidelines or requirements that may be posted in connection with Persona Services (the “Terms”).  By submitting your Persona(s), you agree to these Terms.  If you are an individual acting as a representative of a corporation or other legal entity that wishes to use any Persona Services, you represent and agree that you accept the Terms on behalf of such entity.  If you have any questions about these terms or the Persona Services, please email: [personas@mozilla.com]
-
-1) Responsibility for Personas.  You represent and warrant that:
- ▪ the descriptions and other data that you provide about your Personas are true to the best of your knowledge; and
- ▪ your Personas do not violate any applicable law, regulation or ordinance, nor infringe or misappropriate the rights of any third party. 
-
-2) Licenses. In order to provide the Persona Services, you grant to Mozilla and its Affiliates a non-exclusive, worldwide, royalty-free, sublicensable license to distribute, transmit, reproduce, publish, publicly and privately perform and display and otherwise use your Personas solely in connection with Mozilla’s provision of the Persona Services. Mozilla may also bundle and/or package your Personas with other extensions and add-ons for delivery to users, maintain and/or update your Personas to provide compatibility with new versions of Firefox, and include your name and/or logo in drop down menus and other categorizations relating to the selection of Personas.
-
-3) Management of Persona Services.  Mozilla may manage the Persona Services in its sole discretion in a manner designed to facilitate the integrity and proper functioning of the Persona Services without limitation or liability. The following is a list of exemplary activities that Mozilla in its sole discretion may undertake as part of its management of the AMO Services: (i) monitor, test and review Personas; (ii) remove or disable Personas or change their listing or description; (iii) use, modify or remove authentication requirements for access to any Persona Services; and (iv) collect statistics and other data regarding your Personas, which may be made publicly available but if made publicly available will be subject to the Privacy Policy.
-
-4) Ownership, Reservation of Rights. You are welcome to use the Persona Services subject to these Terms, and Mozilla grants you the right to do so.  Mozilla and its licensors reserve all other rights in the Persona Services.  Further, nothing in the Terms shall be deemed to grant you any right to use the trademarks, trade names, service marks, or trade dress of Mozilla or its licensors and Mozilla hereby reserves all right, title and interest therein. For information on our trademarks, please see our Trademark and Logo Usage Policies. 
-
-5) The Persona Services are provided "as-is."  Mozilla, its contributors, licensors, and distributors, disclaim all warranties, whether express or implied, including without limitation, implied warranties of merchantability, fitness for a particular purpose and non-infringement. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so this disclaimer may not apply to you.
-
-6) Except as required by law, Mozilla, its contributors, licensors, and distributors will not be liable for any indirect, special, incidental, consequential, punitive, or exemplary damages arising out of or in any way relating to the use of Persona Services.  The collective liability under these Terms will not exceed $500 (five hundred dollars). Some jurisdictions do not allow the exclusion or limitation of certain damages, so this exclusion and limitation may not apply to you.
-
-7) Changes to the Terms. Mozilla may update these Terms as necessary from time to time. Any and all changes will be reflected on this page.  When Mozilla changes these Terms in a material way, a notice will be posted on the www.getpersonas.com Web site. These Terms may not be modified or cancelled without Mozilla’s written agreement. 
-
-8) Eligibility.  You represent that you are of legal age to form a binding contract and that you not are a person barred from receiving or using the Persona Services under the laws of any country, including the country in which you are resident or from which you use the Persona Services.
-
-9) Miscellaneous. These Terms are governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. If any portion of these Terms is held to be invalid or unenforceable, the remaining portions will remain in full force and effect. In the event of a conflict between a translated version of these Terms and the English language version, the English language version shall control.  Mozilla’s subsidiaries and affiliates shall be third party beneficiaries of these Terms, entitled to enforce and rely upon the provisions hereof.
-
-10) Termination. You may terminate your use of the Persona Services at any time.  Mozilla may modify or discontinue the Persona Services at its discretion.</textarea>
-                           <label class="agree" for="agree"><input type="checkbox" name="agree" value="1" id="agree" <?php if ($upload_submitted['agree'] == 1) echo "checked "; ?>/> I agree to the user agreement</label>
-<?php if (array_key_exists('agree', $upload_errors)) echo '<span class="error-message tos-error">' . $upload_errors['agree'] . '</span>' ?>
-                   
-                   
-                  <h4>How Would You Like to Share Your Personas Design?</h4>
-                     <p>We encourage you to make your design publicly available, though you may choose not to submit your design under an open source license.  Please select the option below that you prefer. </p>
-
-                     <div id="license-options">
-                         <p><label for="license-cc"><input type="radio" name="license" value="cc" id="license-cc" <?php if ($upload_submitted['license'] == 'cc') echo "checked "; ?>/>Yes, I want to make my design available to everyone under a Creative Commons license.</label></p>
-
-                            <ul>
-                             <li>   People may share and modify my Persona as long as they give me credit and don’t charge for it.  <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Learn more.</a></li>
-                                <li>My design will be quickly added to the directory and hosted for free.</li>
-                            </ul>
-
-                            <p><label for="license-restricted"><input type="radio" name="license" value="restricted" <?php if ($upload_submitted['license'] == 'restricted') echo "checked "; ?>id="license-restricted" />I’d rather restrict any modifications and sharing of my Personas design.</label></p>
-
-                            <ul>
-                             <li>   People may not share, modify, or distribute my design outside of the Personas application.
-                             </li>
-                             <li>I would like a free 30-day trial, after which point I may be charged a fee to help Mozilla sustain the program at no cost to users.  Full details will be sent via email as the trial period is expiring.</li>
-                            </ul>
-  <?php if (array_key_exists('license', $upload_errors)) echo '<span class="error-message">' . $upload_errors['license'] . '</span>' ?>
-
-                     </div>
-                   
-                   <button type="submit" class="button"><span>continue</span><span class="arrow">&nbsp;</span></button>
-                   
-                   
-                   
-               </form> 
-               
-               
-            </div>
-            <div id="secondary-content">
-              <ol id="upload-steps">
-                <li class="current"> <!-- Active step requires 'current' classname and the extra wrapper div -->
-                    <div class="wrapper">
-                        <h3>Step 1:</h3>
-                        <h4>Terms of Service</h4>
-                    </div> 
-                </li>
-                <li> <!-- class="completed" needed to show green checkbox -->
-                    <h3>Step 2:</h3>
-                    <h4>Create Your Persona</h4>
-                </li>
-                <li>
-                    <h3>Step 3:</h3>
-                    <h4>Finish!</h4>
-                </li>
-              </ol>
-            </div>
-        </div>
-    </div>
-    
-   
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-</body>
-</html>
--- a/server/lib/user.php
+++ b/server/lib/user.php
@@ -3,16 +3,17 @@
 require_once 'personas_constants.php';
 require_once 'recaptcha.php';
 
 class PersonaUser
 {
 	var $_dbh;
 
 	var $_username = null;
+	var $_unauthed_username = null;
 	var $_cookie_value = null;
 	var $_email = null;
 	var $_privs = 0;
 	var $_errors = array();
 	var $_no_signup = 0;
 	
 	function __construct($username = null, $password = null, $hostname = null, $dbname = null) 
 	{
@@ -21,23 +22,35 @@ class PersonaUser
 			$this->_dbh = new PDO('mysql:host=' . PERSONAS_HOST . ';dbname=' . PERSONAS_DB, PERSONAS_USERNAME, PERSONAS_PASSWORD);
 			$this->_dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 		}
 		catch( PDOException $exception )
 		{
 				error_log($exception->getMessage());
 				throw new Exception("Database unavailable", 503);
 		}
+
+		if (array_key_exists('PERSONA_USER', $_COOKIE))
+		{
+			list($username, $token) = explode(' ', $_COOKIE['PERSONA_USER']);
+			$this->_unauthed_username = $username;
+		}
+		
 	}
 	
 	function get_username()
 	{
 		return $this->_username;
 	}
 	
+	function get_unauthed_username()
+	{
+		return $this->_unauthed_username;
+	}
+	
 	function get_cookie()
 	{
 		return $this->_cookie_value;
 	}
 	
 	function get_email($username = null)
 	{
 		if ($username)
@@ -165,119 +178,54 @@ class PersonaUser
 		{
 			error_log("update_email: " . $exception->getMessage());
 			throw new Exception("Database unavailable", 503);
 		}
 		return 1;
 	
 	}
 
-	function authenticate($no_signup = null)
+	function authenticate()
 	{
-		if ($no_signup)
-			$this->_no_signup = 1;
-			
-		if (array_key_exists('logout', $_POST))
-		{
-			$this->log_out();
-		}
-		
-		if (array_key_exists('create_username', $_POST) && $_POST['create_username'])
-		{
-			#trying to create an account
-			$username = array_key_exists('create_username', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_username']) : $_POST['create_username']) : null;
-			$password = array_key_exists('create_password', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_password']) : $_POST['create_password']) : null;
-			$passwordconf = array_key_exists('create_passconf', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_passconf']) : $_POST['create_passconf']) : null;
-			$email = array_key_exists('create_email', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_email']) : $_POST['create_email']) : null;
-			
-			$username = trim($username);
-
-			$captcha_response = recaptcha_check_answer(
-				RECAPTCHA_PRIVATE_KEY,
-				$_SERVER['REMOTE_ADDR'],
-				$_POST['recaptcha_challenge_field'],
-				$_POST['recaptcha_response_field']
-			);
-			
-			if (!$captcha_response->is_valid) 
-				$this->_errors['captcha'] = "Invalid captcha response. Please try again.";
-
-			if (!preg_match('/^[A-Z0-9\._%+-]+@[A-Z0-9\.-]+\.[A-Z]{2,4}$/i', $email)) 
-				$this->_errors['create_email'] = "Invalid email address";
-
-			if (!preg_match('/^[A-Z0-9\._-]+$/i', $username)) 
-				$this->_errors['create_username'] = "Illegal characters in the username (alphanumerics, period, underscore and dash only)";
-			elseif (strlen($username) > 32)
-				$this->_errors['create_username'] = "Please limit your username to 32 characters or less";
-			elseif (strlen($username) < 6)
-				$this->_errors['create_username'] = "Please use at least 6 characters in your username";
-				
-			if (strlen($password) < 6)
-				$this->_errors['create_password'] = "Password must be at least 6 characters long";
-			elseif (!preg_match('/[A-Z]/i', $password) || !preg_match('/[^A-Z]/i', $password) )
-				$this->_errors['create_password'] = "Password should contain at least one alphabetic character and at least one non-alphabetic character";
-			
-			if ($password != $passwordconf)
-				$this->_errors['create_passconf'] = "Password does not match confirmation";
-			
-			if ($this->user_exists($username))
-				$this->_errors['create_username'] = "Username already in use";
-				
-			if (count($this->_errors) == 0)
-			{
-				if ($this->create_user($username, $password, $email))
-				{
-					setcookie('PERSONA_USER', $this->_cookie_value, null, '/');
-					return $this->_username;
-				}
-			}
-		}
-		
-		if (array_key_exists('login_user', $_POST) && $_POST['login_user'])
-		{
-			#trying to log in with password
-			$auth_user = ini_get('magic_quotes_gpc') ? stripslashes($_POST['login_user']) : $_POST['login_user'];
-			$auth_pass = array_key_exists('login_pass', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['login_pass']) : $_POST['login_pass']) : null;
-			$auth_remember = array_key_exists('login_remember', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['login_remember']) : $_POST['login_remember']) : null;
-			if ($this->authenticate_user_from_password($auth_user, $auth_pass))
-			{
-				setcookie('PERSONA_USER', $this->_cookie_value, $auth_remember ? time() + 60*60*24*365 : null, '/');
-				return $this->_username;
-			}
-			else
-			{
-				$this->_errors['login_user'] = "Invalid username or password. Please try again";
-			}
-		}
-		
-		if (!$this->_username && array_key_exists('PERSONA_USER', $_COOKIE))
+		if (array_key_exists('PERSONA_USER', $_COOKIE))
 		{
 			$this->authenticate_user_from_cookie($_COOKIE['PERSONA_USER']);
 		}
-				
+
+		if (!$this->_username && $this->_unauthed_username)
+		{
+			#we have a bad cookie.
+			$this->logout();
+			$this->force_signin();
+		}
+		
+		return $this->_username;
+	}
+	
+	function force_signin($admin = null)
+	{
 		if (!$this->_username)
 		{
-			$this->auth_form();
+			header('Location: /signin?return=' . $_SERVER['SCRIPT_NAME'] . ($admin ? "&admin=1" : ""));
 			exit;
 		}
-
-		return $this->_username;
 	}		
 	
 	function log_out()
 	{
 		setcookie('PERSONA_USER', '', time() - 3600, '/');		
 		$this->_errors['success_message'] = "You have been logged out. <a href=\"http://www.getpersonas.com/\">Return to the Personas Homepage</a>";
-		$this->auth_form();
-		exit;
+#		$this->auth_form();
+#		exit;
 	}
 
 	function auth_form()
 	{
-		include 'signup_login_tmpl.php';
+		#deprecated, I think...
+		#include '../templates/signup_form.php';
 	}
 	
 	function authenticate_user_from_password($username, $password) 
 	{
 		try
 		{
 			$select_stmt = 'select * from users where username = :username and md5 = :md5';
 			$sth = $this->_dbh->prepare($select_stmt);
--- a/server/personadetail.php
+++ b/server/personadetail.php
@@ -1,62 +1,46 @@
-<?php 
+<?php
 	require_once 'lib/personas_constants.php';	
 	require_once 'lib/personas_functions.php';	
 	require_once 'lib/storage.php';
-	
-	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
-	header('Pragma: private');
+	require_once 'lib/user.php';
+
+	$db = new PersonaStorage();
+	$user = new PersonaUser();
 	
 
-	$db = new PersonaStorage();
 	$categories = $db->get_categories();
 	array_unshift($categories, 'All');
 	$category = null;
 	
 	$path = array_key_exists('PATH_INFO', $_SERVER) ? $_SERVER['PATH_INFO'] : '/';
 	$path = substr($path, 1); #chop the lead slash
-	list($persona_id) = explode('/', $path.'');
+	list($persona_id) = explode('/', $path);
 
 	if (!is_numeric($persona_id))
 		$persona_id = null;
 	else
 	{
 		$persona_id = intval($persona_id);
 		$persona_data = $db->get_persona_by_id($persona_id);
 		$category = $persona_data['category'];
 		$persona_json = htmlentities(json_encode(extract_record_data($persona_data)));
 	}
+
+	$url_prefix = '/gallery';
+	$tabs = null;
 	
-	
+	$title = "Persona Detail"; 
+	include 'templates/header.php'; 
 ?>
-
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Persona Detail</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-
-</head>
 <body>
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
+<?php include 'templates/nav.php'; ?>
             <div id="header">
                 <h2>View Personas</h2>
                 <h3>Your browser, your style! Dress it up with easy-to-change "skins" for your
                 Firefox.</h3>
             </div>
             <div id="maincontent">
                 <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : View Personas</p>
 <?php
@@ -84,48 +68,26 @@
 	
 	} else {
 ?>            
                 <p class="description">We are unable to find this persona. Please return to the gallery and try again.</p>
 <?php
 	}
 ?>
             </div>
-	<div id="secondary-content">
-                <ul id="subnav">
-<?php
-			foreach ($categories as $list_category)
-			{
-				$category_url = "/store/gallery/$list_category";
-				if ($list_category == $category)
-				{
-					echo "		<li class=\"active\"><a href=\"$category_url/Popular\">$list_category</a></li>\n";
-				}
-				else
-				{
-					echo "		<li><a href=\"$category_url/Popular\">$list_category</a></li>\n";
-				}
-			}
-?>
-                </ul>
-            </div>
+<?php include 'templates/category_nav.php'; ?>
             
         </div>
     </div>
     
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
+<?php include 'templates/footer.php'; ?>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function () {
             $("#header").ie6Warning({"message":'<div id="ie6">Upgrade your browser to get the most out of this website. <a href="%LINK%">Download Firefox for free</a>.</div>'});
             $("#try-button").personasButton({
                                         'hasPersonas':'<span>wear this</span><span>&nbsp;</span>',
                                         'hasFirefox':'<span>get personas now!</span><span>&nbsp;</span>',
                                         'noFirefox':'<span>get personas with firefox</span><span>&nbsp;</span>'
                                         });
         });
     </script>
-    <script src="/store/js/urchin.js"></script>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/server/privacy.php
@@ -0,0 +1,63 @@
+<?php
+	require_once 'lib/personas_constants.php';
+	require_once 'lib/user.php';	
+
+	$user = new PersonaUser();
+	$title = "Privacy Policy"; 
+	include 'templates/header.php'; 
+?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'templates/nav.php'; ?>
+            <div id="header">
+                <h2>Privacy Policy</h2>
+                
+            </div>
+            <div id="maincontent" class="demo">
+                <div id="breadcrumbs">
+                    <a href="/">Personas Home</a> :  Privacy Policy
+                </div>
+               
+               
+                <h3>Mozilla Personas Privacy Policy</h3>
+                <p>Dated: March 20, 2009</p>
+                <p>We’re working hard to protect your privacy while delivering products and services that bring you the performance and protection you desire in your personal computing.  This privacy policy explains how Mozilla Corporation (“Mozilla”), a wholly-owned subsidiary of the non-profit Mozilla Foundation, collects and uses information about users of the official Mozilla Personas add-on (“Personas”) for Mozilla Firefox® web browser (“Firefox”).  It does not apply to other Mozilla websites, products or services.  </p>
+                <h4>Types of Information</h4>
+                <p>Personas collects certain information that falls into the following categories:</p>
+                <p><em>“Personal Information”</em> is information that you provide to us that personally identifies you, such as your name and email address.  Except as described below, Mozilla does not collect or require users of Personas to furnish Personal Information.  To protect your privacy any Personal Information will be available only to Mozilla employees, contractors, and selected contributors who signed confidentiality agreements that prohibit them from using or disclosing such information other than for internal Mozilla purposes.</p>
+                <p><em>“Non-Personal Information”</em> is information that cannot be directly associated with a specific person or entity.  Non-Personal Information includes but is not limited to your computer’s configuration, the Persona Design (as defined below) and the version of Personas you use.</p>
+                <p><em>“Potentially Personal Information”</em> is information that is Non-Personal Information in and of itself but that could be used in conjunction with other information to personally identify you.  For example, Internet Protocol (“IP”) addresses (the addresses of computers on the internet), which is Non-Personal Information in and of itself, could be Personal Information when combined with internet service provider (“ISP”) records.</p>
+                <p><em>“Aggregate Data”</em> is information that is recorded about users and collected into groups so it no longer reflects or references an individually identifiable user.  Aggregate Data does not contain any Personal Information.</p>
+                <h4>Personal Information</h4>
+                <p><em>Downloading Personas.</em>  Mozilla does not collect any Personal Information if you are downloading Personas.</p>
+                <p><em>Creating a Custom Persona.</em>  If you are creating a Custom Persona for your own use, Mozilla does not collect any Personal Information.</p>
+                <p><em>Contributing a Design to the Personas Gallery.</em> The Personas gallery is where you can browse all the available designs.  If you contribute a design or image (each a “Persona Design”) to the Personas gallery, Mozilla collects the following Personal Information: (1) your user name and (2) your email address.  Your user name will be used to attribute your Persona Design to you and will be publicly available on the Personas gallery.  You do not have to provide your real name; you can use a nickname or avatar.  Your email address will not be publicly available or shared with any third parties.  Mozilla will use your email address only to contact you regarding your design or to provide any additional information that you elect or opt in to receive.</p>
+                <p>In addition, Mozilla does not publicly release information gathered in connection with commercial transactions (i.e., transactions involving money). </p>
+                <p>Mozilla does not make publicly available Personal Information that it specifically promises at the time of collection to maintain in confidence. </p>
+                <h4>Interactive Product Features</h4>
+                <p>If you have Personas installed, each time you open Firefox Personas loads your selected Persona Design from the Mozilla server.  Once per day Personas checks to see if your selected Persona Design still is available in its list of Persona Designs.  This feature sends the same information that web browsers typically transfer with any HTTP requests including user agent and, Potentially Personally-Identifying Information such as, your IP address. </p>
+                <p>Personas has a feature that refreshes the Personas gallery once per day.  This feature sends the following Non-Personal Information to Mozilla: </p>
+                <ul>
+                <li>the category and ID of Persona Design selected;</li>
+                <li>the date/time the Persona Design was selected;</li>
+                <li>the ID and version of the application you used (e.g., Firefox 3.0.7);</li>
+                <li>your locale (e.g., English-US);</li>
+                <li>your operating system (i.e.,  Linux, Windows or Mac); and</li>
+                <li>your computer's architecture.</li>
+                </ul>
+                <p>Personas relies on Firefox’s automatic update feature for updates.  See the <a href="http://www.mozilla.com/en-US/legal/privacy/firefox-en.html">Firefox Privacy Policy</a> for privacy details of the Firefox automatic update feature. </p>
+                <p>We use this information to improve our products and services and to support decision making regarding feature and capacity planning.  Mozilla is an open organization that believes in sharing as much information as possible about its products, its operations, and its associations. Accordingly, we may release public reports containing Aggregate Data so that our global community and Personas partners may make better product and design decisions and so that users of Personas will know which are the most popular Persona Designs and Personas designers will know how many times their Persona Design was downloaded.  </p>
+                <h4>Privacy Policy Changes</h4>
+                
+                <p>Mozilla may change the Personas Privacy Policy from time to time.  Any and all changes will be reflected on this page.  When Mozilla changes this policy in a material way, a notice will be posted on the <a href="http://www.getpersonas.com">www.getpersonas.com</a> Web site.  Substantive changes may also be announced through the standard mechanisms by which Mozilla communicates with its users and community, including Mozilla's "announce" <a href="https://lists.mozilla.org/listinfo/announce">mailing list and newsgroup</a>.  It is your responsibility to ensure that you understand the terms of this Privacy Policy.  You should periodically check this page for any changes to the current policy.</p>
+                <h4>For More Information</h4>
+                <p>If you have questions about this privacy policy, please contact Mozilla at <a href="mailto:privacy@mozilla.com">privacy@mozilla.com</a>.  In your email, please identify the specific product or policy about which you have questions.</p>
+                
+            </div>
+<?php include 'templates/get_personas.php'; ?>
+        </div>
+    </div>
+<?php include 'templates/footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/signin.php
@@ -0,0 +1,131 @@
+<?php
+	require_once 'lib/personas_constants.php';
+	require_once 'lib/user.php';	
+
+	$user = new PersonaUser();
+	$_errors = array();
+	$return_url = null;
+	
+	if (array_key_exists('return', $_GET))
+		$return_url = $_GET['return'];
+	elseif (array_key_exists('return', $_POST))
+		$return_url = $_POST['return'];
+
+	if (!preg_match('/^\//', $return_url))
+		$return_url = null;
+
+
+	if ($_GET['action'] == 'signout')
+	{
+		$user->log_out();
+	
+		if ($return_url)
+		{
+			header('Location: ' . $return_url . '?signout_success=1');
+			exit;
+		}
+	}
+
+
+	if (array_key_exists('login_user', $_POST) && $_POST['login_user'])
+	{
+		#trying to log in with password
+		$auth_user = ini_get('magic_quotes_gpc') ? stripslashes($_POST['login_user']) : $_POST['login_user'];
+		$auth_pass = array_key_exists('login_pass', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['login_pass']) : $_POST['login_pass']) : null;
+		$auth_remember = array_key_exists('login_remember', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['login_remember']) : $_POST['login_remember']) : null;
+		if ($user->authenticate_user_from_password($auth_user, $auth_pass))
+		{
+			setcookie('PERSONA_USER', $user->get_cookie(), $auth_remember ? time() + 60*60*24*365 : null, '/');
+			if ($return_url)
+				header('Location: ' . $return_url);
+			else
+				header('Location: /');
+			exit;
+		}
+		else
+		{
+			$_errors['login_user'] = "Invalid username or password. Please try again";
+		}
+	}
+	
+	if (array_key_exists('create_username', $_POST) && $_POST['create_username'])
+	{
+		#trying to create an account
+		$username = array_key_exists('create_username', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_username']) : $_POST['create_username']) : null;
+		$password = array_key_exists('create_password', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_password']) : $_POST['create_password']) : null;
+		$passwordconf = array_key_exists('create_passconf', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_passconf']) : $_POST['create_passconf']) : null;
+		$email = array_key_exists('create_email', $_POST) ? (ini_get('magic_quotes_gpc') ? stripslashes($_POST['create_email']) : $_POST['create_email']) : null;
+		
+		$username = trim($username);
+
+		$captcha_response = recaptcha_check_answer(
+			RECAPTCHA_PRIVATE_KEY,
+			$_SERVER['REMOTE_ADDR'],
+			$_POST['recaptcha_challenge_field'],
+			$_POST['recaptcha_response_field']
+		);
+		
+		if (!$captcha_response->is_valid) 
+			$_errors['captcha'] = "Invalid captcha response. Please try again.";
+
+		if (!preg_match('/^[A-Z0-9\._%+-]+@[A-Z0-9\.-]+\.[A-Z]{2,4}$/i', $email)) 
+			$_errors['create_email'] = "Invalid email address";
+
+		if (!preg_match('/^[A-Z0-9\._-]+$/i', $username)) 
+			$_errors['create_username'] = "Illegal characters in the username (alphanumerics, period, underscore and dash only)";
+		elseif (strlen($username) > 32)
+			$_errors['create_username'] = "Please limit your username to 32 characters or less";
+		elseif (strlen($username) < 6)
+			$_errors['create_username'] = "Please use at least 6 characters in your username";
+			
+		if (strlen($password) < 6)
+			$_errors['create_password'] = "Password must be at least 6 characters long";
+		elseif (!preg_match('/[A-Z]/i', $password) || !preg_match('/[^A-Z]/i', $password) )
+			$_errors['create_password'] = "Password should contain at least one alphabetic character and at least one non-alphabetic character";
+		
+		if ($password != $passwordconf)
+			$_errors['create_passconf'] = "Password does not match confirmation";
+		
+		if ($user->user_exists($username))
+			$_errors['create_username'] = "Username already in use";
+			
+		if (count($_errors) == 0)
+		{
+			if ($user->create_user($username, $password, $email))
+			{
+				setcookie('PERSONA_USER', $user->get_cookie(), null, '/');
+				if ($return_url)
+					header('Location: ' . $return_url);
+				else
+					header('Location: /');
+				exit;
+			}
+		}
+	}
+
+	$title = "Login"; 
+	include 'templates/header.php'; 
+?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'templates/nav.php'; ?>
+            <div id="header">
+                <h2>Login</h2>
+            </div>
+            <div id="maincontent" class="login-signup">
+                <div id="breadcrumbs">
+                    Personas Home : Login    
+                </div>
+				<?php if (array_key_exists('success_message', $_errors)) echo '<p class="logout-success">' . $_errors['success_message'] . '</p>' ?>
+<?php include 'templates/login_form.php'; ?>
+<?php if (!$_GET['admin'])
+		include 'templates/signup_form.php'; 
+?>
+            </div>
+        </div>
+    </div>
+<?php include "templates/footer.php" ?>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/server/templates/category_nav.php
@@ -0,0 +1,41 @@
+			<div id="secondary-content">
+                <ul id="subnav">
+<?php
+			foreach ($categories as $list_category)
+			{
+				$category_url = "$url_prefix/$list_category";
+				if ($list_category == $category)
+				{
+					if ($tabs)
+					{
+						echo "		<li class=\"active\">$list_category\n";
+						echo "            <ul>\n";
+						foreach ($tabs as $list_tab)
+						{
+							if ($list_tab == 'My' && $no_my == 1)
+								continue;
+							#if ($list_tab == 'All' && $list_category == 'All')
+							#	continue;
+							$tab_url = "$url_prefix/$list_category/$list_tab";
+							echo "		<li";
+							if ($list_tab == $tab)
+								echo ' class="active"';
+							if ($list_tab == 'All' && $list_category != 'All')
+								$tab_url .= "/1";
+							echo "><a href=\"$tab_url\">$list_tab</a></li>\n";						
+						}
+						echo "                        </ul></li>\n";
+					}
+					else
+					{
+						echo "		<li class=\"active\"><a href=\"$category_url/Popular\">$list_category</a></li>\n";
+					}
+				}
+				else
+				{
+					echo "		<li><a href=\"$category_url/Popular\">$list_category</a></li>";
+				}
+			}
+?>
+                </ul>
+            </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/featured_designer.php
@@ -0,0 +1,11 @@
+            <div class="feature">
+                 <h3>Featured Designer</h3>
+<?php
+	$persona = $db->get_persona_by_id(FEATURE_DESIGNER_PERSONA_ID); 
+	$persona_json = htmlentities(json_encode(extract_record_data($persona)));
+	$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
+?>
+					<img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
+                    <h4><?= $persona['author'] ?></h4>
+                    <p class="try"><a href="/store/featured">view more »</a></p>
+            </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/featured_personas.php
@@ -0,0 +1,46 @@
+            <div class="feature slideshow">
+                <h3>Featured Personas</h3>
+                <ul id="slideshow-nav">
+                    <li><a href="#" class="active">1</a></li>
+                    <li><a href="#">2</a></li>
+                    <li><a href="#">3</a></li>
+                    <li><a href="#">4</a></li>
+                </ul>
+                <a href="#" id="slideshow-previous"><img src="/store/img/nav-prev.png" alt="Previous"/></a>
+                <a href="#" id="slideshow-next"><img src="/store/img/nav-next.png" alt="Next"/></a>
+                <div id="slideshow">
+                    <ul id="slides">
+<?php
+
+
+	$featured = $db->get_featured_personas();
+	$description_max = 50;
+	foreach ($featured as $persona)
+	{
+		$item_description = $persona['description'];
+		if (strlen($item_description) > $description_max)
+		{
+			$item_description = substr($item_description, 0, $description_max);
+			$item_description = preg_replace('/ [^ ]+$/', '', $item_description) . '...';
+		}
+		$persona_date = date("n/j/Y", strtotime($persona['approve']));
+		$persona_json = htmlentities(json_encode(extract_record_data($persona)));
+		$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
+?>
+                        <li>
+                            <img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
+                            <h4><?= $persona['name'] ?></h4>
+                            <p class="try"><a href="<?= $detail_url ?>">view details »</a></p>
+                            <hr />
+                            <p class="designer"><strong>Designer:</strong> <?= $persona['author'] ?></p>
+                            <p class="added"><strong>Added:</strong> <?= $persona_date?></p>
+                            <hr />
+
+                        </li>
+<?php
+	}
+?>
+                    </ul>
+                    
+                </div>
+            </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/footer.php
@@ -0,0 +1,6 @@
+    <div id="footer">
+        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="/privacy">Privacy</a></p>
+    </div>
+    <script src="/static/js/jquery.js"></script>
+    <script src="/static/js/script.js"></script>
+	<script src="/static/js/urchin.js"></script>
new file mode 100644
--- /dev/null
+++ b/server/templates/forgot_password_done_tmpl.php
@@ -0,0 +1,17 @@
+<?php $title = "Forgot Your Password"; include 'header.php'; ?>
+<body class="forgot-password">
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Forgot Your Password?</h2>
+            </div>
+            <div id="maincontent">
+                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="/signin">Sign In</a> : Forgot Your Password?</p>
+                <p>Your password has been reset. You may <a href="/signin">sign in</a> now.</p>
+            </div>
+        </div>
+    </div>
+<?php include 'footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/forgot_password_reset_tmpl.php
@@ -0,0 +1,39 @@
+<?php $title = "Forgot Your Password"; include 'header.php'; ?>
+<body class="forgot-password">
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Forgot Your Password?</h2>
+            </div>
+            <div id="maincontent">
+                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="/signin">Sign In</a> : Forgot Your Password?</p>
+                
+<?php 
+	if ($error)
+		echo "<h4 class=\"error\">$error</h4>";
+?>
+                <h4>Enter your new password:</h4>
+                
+                <form action="forgot_password" method="post">
+                <input type=hidden name="user" value="<?= $username ?>">
+                <input type=hidden name="code" value="<?= $code ?>">
+                 <p>
+                        <label for="password">New password</label>
+                        <input type="password" name="password" value="" id="password" />
+                    </p>
+                    
+                    <p>
+                        <label for="password-verify">Re-type your new password</label>
+                        <input type="password" name="password-verify" value="" id="" />
+                    </p>
+                    
+                    <button type="submit" class="button"><span>reset password</span><span class="arrow">&nbsp;</span></button>
+                    
+                </form>
+            </div>
+        </div>
+    </div>
+<?php include 'footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/forgot_password_thanks_tmpl.php
@@ -0,0 +1,19 @@
+<?php $title = "Forgot Your Password"; include 'header.php'; ?>
+<body class="forgot-password">
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Forgot Your Password?</h2>
+                <h3>Follow the easy steps below to start dressing up your browser!</h3>
+            </div>
+            <div id="maincontent">
+                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="/signin">Sign In</a> : Forgot Your Password?</p>
+                
+                <p>Your password reset information has been e-mailed to you.</p>
+            </div>
+        </div>
+    </div>
+<?php include 'footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/forgot_password_tmpl.php
@@ -0,0 +1,32 @@
+<?php $title = "Forgot Your Password"; include 'header.php'; ?>
+<body class="forgot-password">
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Forgot Your Password?</h2>
+            </div>
+            <div id="maincontent">
+                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="/signin">Sign In</a> : Forgot Your Password?</p>
+<?php 
+	if ($error)
+		echo "<h4 class=\"error\">$error</h4>";
+?>
+                <h4>Please enter your Personas username below</h4>
+                <form action="forgot_password" method="post">
+                    <p>
+                        <label for="username">Username:</label>
+                        <input type="text" name="userreq" value="" id="username"/>
+                    </p>
+                    
+                    <button type="submit" class="button"><span>continue</span><span class="arrow">&nbsp;</span></button>
+                </form>
+            </div>
+            
+        </div>
+    </div>
+    
+   
+<?php include 'footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/get_personas.php
@@ -0,0 +1,43 @@
+            <div id="secondary-content">
+              <ol id="demo-nav">
+<?php if (preg_match('/demo_install/', $_SERVER['SCRIPT_NAME'])) { ?>
+                <li class="current">
+                    <div class="wrapper">
+                        <span>How to Get Started</span>
+                    </div>
+                </li>
+<?php } else { ?>
+                <li> 
+					<a href="/demo_install">How to Get Started</a>
+				</li>
+<?php } ?>
+<?php if (preg_match('/demo_create/', $_SERVER['SCRIPT_NAME'])) { ?>
+                <li class="current">
+                    <div class="wrapper">
+                        <span>How to Create Personas</span>
+                    </div>
+                </li>
+<?php } else { ?>
+                <li> 
+					<a href="/demo_create">How to Create Personas</a>
+				</li>
+<?php } ?>
+<?php if (preg_match('/faq/', $_SERVER['SCRIPT_NAME'])) { ?>
+                <li class="current">
+                    <div class="wrapper">
+                        <span>Frequent Questions</span>
+                    </div>
+                </li>
+<?php } else { ?>
+                <li> 
+					<a href="/faq">Frequent Questions</a>
+				</li>
+<?php } ?>
+              </ol>
+              <div class="info-box">
+                <h3><a href="/">Get Personas Free</a></h3>
+                <div class="body">
+                    <p>Easy to install and easy to change "skins" for your Firefox web browser.</p>
+                </div>
+              </div>
+            </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/header.php
@@ -0,0 +1,12 @@
+<?php 
+	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
+	header('Pragma: private');
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+            "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+	<title>Personas for Firefox<?= $title ? ("  | $title") : "" ?></title>
+	<link href="/static/css/style.css" rel="stylesheet" type="text/css" media="all" />
+</head>
new file mode 100644
--- /dev/null
+++ b/server/templates/login_form.php
@@ -0,0 +1,23 @@
+                <div id="login">
+                    <h4>Already a Personas Designer?</h4>
+                    <form action="signin" method="post">
+<?php
+					if ($return_url)
+						echo "<input type=hidden name=return value=\"$return_url\">";
+?>
+						<p><label for="login_user">Username</label>
+                        <input type="text" name="login_user" value="" id="" <?php if (array_key_exists('login_user', $_errors)) echo 'class="error"' ?> />
+                        <?php if (array_key_exists('login_user', $_errors)) echo '<span class="error-message">' . $_errors['login_user'] . '</span>' ?>
+                        </p>
+                        
+                        <p><label for="login_pass">Password</label>
+                        <input type="password" name="login_pass" value="" id="" <?php if (array_key_exists('login_user', $_errors)) echo 'class="error"' ?> />
+                        <span class="extra-info">Minimum 6 characters</span>
+                        </p>
+                        
+                        <p><label for="login_remember"><input type="checkbox" name="login_remember" id="remember" value="1" /> Remember me on this computer</label></p>
+                        <button type="submit" class="button"><span>sign in</span><span class="arrow"></span></button>
+                        
+                        <p class="forgot"><a href="/forgot_password">Forgot your password?</a></p>
+                    </form>
+                </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/nav.php
@@ -0,0 +1,23 @@
+            <p id="account">
+<?php 
+	if(!array_key_exists('no_my', $_GET) && $user->get_unauthed_username())
+	{
+		echo 'Welcome, ' . $user->get_unauthed_username() . ' | <a href="/signin?action=signout&return=' . $_SERVER['SCRIPT_NAME'] . '">Sign Out</a>';
+	}
+	elseif(!array_key_exists('no_my', $_GET))
+	{
+		if (array_key_exists('signout_success', $_GET))
+			echo "You have been signed_out | ";
+		echo '<a href="/signin?return=' . $_SERVER['SCRIPT_NAME'] . '">Sign In</a>';
+	}
+?>
+			</p>
+            <div id="nav">
+                <h1><a href="/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
+                <ul>
+                    <li class="gallery"><a href="/gallery/All/Popular">Gallery</a></li>
+                    <li class="create"><a href="/upload/">Create <br/>Your Own</a></li>
+                    <li class="demo"><a href="/demo_install/">Demo</a></li>
+                    <li class="faq"><a href="/faq/">Frequent <br/>Questions</a></li>
+                </ul>
+            </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/popular_personas.php
@@ -0,0 +1,20 @@
+            <div class="feature last">
+                <h3>Most Popular Personas</h3>
+                <ol class="popular">
+<?php
+	$list = $db->get_popular_personas(null,3);
+	foreach ($list as $persona)
+	{
+		$persona_json = htmlentities(json_encode(extract_record_data($persona)));
+?>
+					<li>
+                            <h4><?= $persona['name'] ?></h4>
+                            <hr />
+                            <img class="persona" alt="<?= $persona['name'] ?>" persona="<?= $persona_json ?>" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_popular.jpg">
+                            <p class="downloads"><strong>Current Users:</strong> <?= number_format($persona['popularity']) ?></p>
+                    </li>
+<?php
+	}
+?>
+                </ol>
+            </div>
new file mode 100644
--- /dev/null
+++ b/server/templates/signup_form.php
@@ -0,0 +1,52 @@
+                <div id="signup">
+                    <h4>New Personas Designer?</h3>
+                    <form action="signin" method="post">
+<?php
+					if ($return_url)
+						echo "<input type=hidden name=return value=\"$return_url\">";
+?>
+                    <p><label for="email">Email</label>
+                    <input type="text" name="create_email" value="" id="" <?php if (array_key_exists('create_email', $_errors)) echo 'class="error"' ?>/>
+					<?php if (array_key_exists('create_email', $_errors)) echo '<span class="error-message">' . $_errors['create_email'] . '</span>' ?>
+                    </p>
+                    
+                    <p><label for="username">Username (displayed in the Personas gallery)</label>
+                    <input type="text" name="create_username" value="" id="" <?php if (array_key_exists('create_username', $_errors)) echo 'class="error"' ?>/>
+					<?php if (array_key_exists('create_username', $_errors)) echo '<span class="error-message">' . $_errors['create_username'] . '</span>' ?>
+                    </p>
+                    
+                    <p><label for="password">Password</label>
+                    <input type="password" name="create_password" value="" id="" <?php if (array_key_exists('create_password', $_errors)) echo 'class="error"' ?>/>
+					<?php if (array_key_exists('create_password', $_errors)) echo '<span class="error-message">' . $_errors['create_password'] . '</span>' ?>
+                    </p>
+                    
+                    <p><label for="password_confirm">Confirm Password</label>
+                    <input type="password" name="create_passconf" value="" id="" <?php if (array_key_exists('create_passconf', $_errors)) echo 'class="error"' ?>/>
+					<?php if (array_key_exists('create_passconf', $_errors)) echo '<span class="error-message">' . $_errors['create_passconf'] . '</span>' ?>
+                    </p>
+                    
+                    <p class="news"><label for="news"><input type="checkbox" name="news" id="news" value="" /> I’d like to receive news and information about Personas</label></p>
+                    
+            
+                    <div id="captcha">
+                        <script type="text/javascript">
+                                var RecaptchaOptions = {
+                                   theme : 'clean',
+                                   tabindex : 11
+                                };
+						</script>
+	
+						<script type="text/javascript" src="https://api-secure.recaptcha.net/challenge?k=<?= RECAPTCHA_PUBLIC_KEY ?>"></script>
+	
+						<noscript>
+							<iframe src="https://api-secure.recaptcha.net/noscript?k=<?= RECAPTCHA_PUBLIC_KEY ?>" height="300" width="500" frameborder="0"></iframe><br/>
+							<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
+							<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
+						</noscript>        
+						<?php if (array_key_exists('captcha', $_errors)) echo '<span class="error-message">' . $_errors['captcha'] . '</span>' ?>
+                    </div>
+                    
+                    <button type="submit" class="button"><span>sign me up</span><span class="arrow"></span></button>
+                    </form>
+                </div>
+			<p class="disclaimer">Mozilla values your privacy. We will not sell or rent your email address</p>
new file mode 100644
--- /dev/null
+++ b/server/templates/upload_persona_tmpl.php
@@ -0,0 +1,173 @@
+<?php $title = ($upload_submitted['id'] ? "Edit" : "Create") . " your Persona"; include 'header.php'; ?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Create Your Persona</h2>
+                <h3>Follow the easy steps below to start dressing up your browser!</h3>
+            </div>
+            <div id="maincontent">
+                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <?= $upload_submitted['id'] ? "Edit" : "Create" ?> Your Own</p>
+                
+                <h4><?= $upload_submitted['id'] ? "Edit" : "Create" ?> Your Persona</h4>
+                <form method="POST" action="upload" enctype='multipart/form-data'>
+				<input type="hidden" name="agree" value="<?= htmlspecialchars($upload_submitted['agree']) ?>">
+				<input type="hidden" name="license" value="<?= htmlspecialchars($upload_submitted['license']) ?>">
+				<input type="hidden" name="id" value="<?= htmlspecialchars($upload_submitted['id']) ?>">
+                <div id="create-part-1">
+                    <p>
+                        <label for="persona-name">Persona Name</label>
+                        <input type="text" name="name" value="<?= htmlspecialchars($upload_submitted['name']) ?>" id="name" <?php if (array_key_exists('name', $upload_errors)) echo 'class="error"' ?> />
+                        <?php if (array_key_exists('name', $upload_errors)) echo '<span class="error-message">' . $upload_errors['name'] . '</span>' ?>
+                     </p>
+                    
+                    <p>
+                        <label for="textcolor">Text Color</label>
+                        <input type="text" name="textcolor" value="<?= htmlspecialchars($upload_submitted['textcolor']) ?>" id="textcolor"/ <?php if (array_key_exists('textcolor', $upload_errors)) echo 'class="error"' ?>>
+                         <?php if (array_key_exists('textcolor', $upload_errors)) echo '<span class="error-message">' . $upload_errors['textcolor'] . '</span>' ?>
+                    </p>
+                    
+                    <p>
+                        <label for="header-image">Header Image</label>
+                        <span><input type="file" name="header-image" value="" id="header-image"  <?php if (array_key_exists('header-image', $upload_errors)) echo 'class="error"' ?> /></span>
+                        <?php if (array_key_exists('header-image', $upload_errors)) echo '<span class="error-message">' . $upload_errors['header-image'] . '</span>' ?>
+                    </p>
+                    
+                    <p>
+                        <label for="description">Description</label>
+                        <textarea name="description" id="description" <?php if (array_key_exists('desription', $upload_errors)) echo 'class="error"' ?> ><?= $upload_submitted['description'] ?></textarea>
+                        <?php if (array_key_exists('description', $upload_errors)) echo '<span class="error-message">' . $upload_errors['description'] . '</span>' ?>
+                     </p>
+                </div>
+                
+                <div id="create-part-2">
+                    <p>
+                        <label for="category">Category</label>
+                        <select name="category" id="category">
+<?php
+		echo '<option value=""';
+		if ($upload_submitted['category'] == "")
+			echo " selected";
+		echo "></option>\n";
+		
+		foreach ($categories as $category)
+		{
+			echo "<option value=\"$category\"";
+			if ($category == $upload_submitted['category'])
+				echo " selected";
+			echo ">$category</option>\n";
+		} 
+?>
+						</select>
+                        <?php if (array_key_exists('category', $upload_errors)) echo '<span class="error-message">' . $upload_errors['category'] . '</span>' ?>
+                    </p>
+                    <p>
+                        <label for="accentcolor">Accent Color</label>
+                        <input type="text" name="accentcolor" value="<?= htmlspecialchars($upload_submitted['accentcolor']) ?>" id="accentcolor"/ <?php if (array_key_exists('accentcolor', $upload_errors)) echo 'class="error"' ?> >
+                        <?php if (array_key_exists('accentcolor', $upload_errors)) echo '<span class="error-message">' . $upload_errors['accentcolor'] . '</span>' ?>
+                     </p>
+                    
+                    <p>
+                        <label for="footer-image">Footer Image</label>
+                        <span><input type="file" name="footer-image" value="" id="footer-image" <?php if (array_key_exists('footer-image', $upload_errors)) echo 'class="error"' ?> /></span>
+                        <?php if (array_key_exists('footer-image', $upload_errors)) echo '<span class="error-message">' . $upload_errors['footer-image'] . '</span>' ?>
+                     </p>
+                    
+                    <p>
+                        <label for="reason">I'm creating a Persona to...</label>
+                        <span>
+                            <select name="reason" id="reason">
+<?php
+		$reasons = Array("" => "", "fun" => "have some fun", "build" => "build a brand", "non-profit" => "support a non-profit cause", "other" => "other");
+		foreach ($reasons as $reason => $longreason)
+		{
+			print "<option value=\"$reason\"";
+			if ($reason == $upload_submitted['reason'])
+				echo " selected";
+			print ">$longreason</option>\n";
+		}
+?>
+                            </select>
+                         <?php if (array_key_exists('reason', $upload_errors)) echo '<span class="error-message">' . $upload_errors['reason'] . '</span>' ?>
+                        </span>
+                    </p>
+                    
+                    <p id="other-info">
+                        <label for="other-reason">Reason:</label>
+                        <input id="other-reason" name="other-reason" type="text" value="<?= htmlspecialchars($upload_submitted['other-reason']) ?>"/>
+                        <?php if (array_key_exists('other-reason', $upload_errors)) echo '<span class="error-message">' . $upload_errors['other-reason'] . '</span>' ?>
+                   </p>
+                    
+                </div>
+                
+                <p class="continue">
+                    <button type="submit" class="button"><span>continue</span><span class="arrow">&nbsp;</span></button></p>
+            	</form>
+            </div>
+            <div id="secondary-content">
+              <ol id="upload-steps">
+                   <li class="completed">                         
+                          	<h3>Step 1:</h3>
+                          	<h4>Terms of Service</h4>
+                      </li>
+                <li class="current">
+                    <div class="wrapper">
+                        <h3>Step 2:</h3>
+                        <h4><?= $title ?></h4>
+                    </div>
+                </li>
+               
+                <li>
+                    <h3>Step 3:</h3>
+                    <h4>Finish!</h4>
+                </li>
+              </ol>
+            </div>
+        </div>
+    </div>
+<?php include 'footer.php'; ?>
+   <script type="text/javascript" charset="utf-8">
+    $('#textcolor').ColorPicker({
+    	onSubmit: function(hsb, hex, rgb) {
+    		$('#textcolor').val(hex);
+    	},
+    	onBeforeShow: function () {
+    		$(this).ColorPickerSetColor(this.value);
+    	},
+    	onChange: function (hsb, hex, rgb) {
+        		$('#textcolor').val(hex);
+        	}
+        
+    })
+    .bind('keyup', function(){
+    	$(this).ColorPickerSetColor(this.value);
+    });
+    
+    
+    $('#accentcolor').ColorPicker({
+    	onSubmit: function(hsb, hex, rgb) {
+    		$('#accentcolor').val(hex);
+    	},
+    	onBeforeShow: function () {
+    		$(this).ColorPickerSetColor(this.value);
+    	},
+    	onChange: function (hsb, hex, rgb) {
+        		$('#accentcolor').val(hex);
+        	}
+        
+    })
+    .bind('keyup', function(){
+    	$(this).ColorPickerSetColor(this.value);
+    });
+    
+     $("#reason").change(function() {
+        if($(this)[0].selectedIndex == 4) {
+            $("#other-info").show();
+        } else {
+            $("#other-info").hide();
+        }
+    });
+  </script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/upload_success_tmpl.php
@@ -0,0 +1,41 @@
+<?php $title = "Success!"; include 'header.php'; ?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Create Your Own</h2>
+                <h3>It’s easy to create your own Persona just follow the easy steps below!</h3>
+            </div>
+            <div id="maincontent" class="success">
+                <div id="breadcrumbs">
+                    <a href="http://www.getpersonas.com">Personas Home</a> : Create Your Own    
+                </div>
+                <h2>Success!</h2>
+                <h3>You have successfully <?= $action_verb ? $action_verb : "added" ?> your Persona. Once it's approved, you'll be able to view it in the Gallery.</h3>
+                <ul class="success-options">
+                    <li><a href="http://www.getpersonas.com/store/gallery/All/Popular">View Personas Gallery »</a></li>
+                </ul>
+            </div>
+            <div id="secondary-content">
+              <ol id="upload-steps">
+                  <li class="completed"> <!-- class="completed" needed to show green checkbox -->
+                      <h3>Step 1:</h3>
+                      <h4>Persona Agreement</h4>
+                  </li>
+                <li class="completed"> 
+                    <h3>Step 2:</h3>
+                    <h4>Create Your Persona</h4> 
+                </li>
+                
+                <li class="completed">
+                    <h3>Step 3:</h3>
+                    <h4>Finish!</h4>
+                </li>
+              </ol>
+            </div>
+        </div>
+    </div>
+<?php include 'footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/upload_tos_tmpl.php
@@ -0,0 +1,104 @@
+<?php $title = "Create your Persona"; include 'header.php'; ?>
+<body>
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>Create Your Persona</h2>
+                <h3>Follow the easy steps below to start dressing up your browser!</h3>
+            </div>
+            <div id="maincontent">
+                <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : Create Your Own</p>
+                
+                <h4>Terms of Service</h4>
+               <form action="upload" method="post">
+               <input type="hidden" name="firstterms" value="1">
+                        <textarea name="agreement" id="agreement" readonly>
+Personas Designer Agreement
+
+Dated: March 12, 2009
+
+If you upload a “persona” design for the Firefox® web browser (each a “Persona”) in connection with any “persona” distribution services or features (the “Persona Services”) provided by Mozilla Corporation (“Mozilla”), you and your Personas are subject to the following terms, as well as Mozilla’s Privacy Policy, web site notices and other policies, guidelines or requirements that may be posted in connection with Persona Services (the “Terms”).  By submitting your Persona(s), you agree to these Terms.  If you are an individual acting as a representative of a corporation or other legal entity that wishes to use any Persona Services, you represent and agree that you accept the Terms on behalf of such entity.  If you have any questions about these terms or the Persona Services, please email: [personas@mozilla.com]
+
+1) Responsibility for Personas.  You represent and warrant that:
+ ▪ the descriptions and other data that you provide about your Personas are true to the best of your knowledge; and
+ ▪ your Personas do not violate any applicable law, regulation or ordinance, nor infringe or misappropriate the rights of any third party. 
+
+2) Licenses. In order to provide the Persona Services, you grant to Mozilla and its Affiliates a non-exclusive, worldwide, royalty-free, sublicensable license to distribute, transmit, reproduce, publish, publicly and privately perform and display and otherwise use your Personas solely in connection with Mozilla’s provision of the Persona Services. Mozilla may also bundle and/or package your Personas with other extensions and add-ons for delivery to users, maintain and/or update your Personas to provide compatibility with new versions of Firefox, and include your name and/or logo in drop down menus and other categorizations relating to the selection of Personas.
+
+3) Management of Persona Services.  Mozilla may manage the Persona Services in its sole discretion in a manner designed to facilitate the integrity and proper functioning of the Persona Services without limitation or liability. The following is a list of exemplary activities that Mozilla in its sole discretion may undertake as part of its management of the AMO Services: (i) monitor, test and review Personas; (ii) remove or disable Personas or change their listing or description; (iii) use, modify or remove authentication requirements for access to any Persona Services; and (iv) collect statistics and other data regarding your Personas, which may be made publicly available but if made publicly available will be subject to the Privacy Policy.
+
+4) Ownership, Reservation of Rights. You are welcome to use the Persona Services subject to these Terms, and Mozilla grants you the right to do so.  Mozilla and its licensors reserve all other rights in the Persona Services.  Further, nothing in the Terms shall be deemed to grant you any right to use the trademarks, trade names, service marks, or trade dress of Mozilla or its licensors and Mozilla hereby reserves all right, title and interest therein. For information on our trademarks, please see our Trademark and Logo Usage Policies. 
+
+5) The Persona Services are provided "as-is."  Mozilla, its contributors, licensors, and distributors, disclaim all warranties, whether express or implied, including without limitation, implied warranties of merchantability, fitness for a particular purpose and non-infringement. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so this disclaimer may not apply to you.
+
+6) Except as required by law, Mozilla, its contributors, licensors, and distributors will not be liable for any indirect, special, incidental, consequential, punitive, or exemplary damages arising out of or in any way relating to the use of Persona Services.  The collective liability under these Terms will not exceed $500 (five hundred dollars). Some jurisdictions do not allow the exclusion or limitation of certain damages, so this exclusion and limitation may not apply to you.
+
+7) Changes to the Terms. Mozilla may update these Terms as necessary from time to time. Any and all changes will be reflected on this page.  When Mozilla changes these Terms in a material way, a notice will be posted on the www.getpersonas.com Web site. These Terms may not be modified or cancelled without Mozilla’s written agreement. 
+
+8) Eligibility.  You represent that you are of legal age to form a binding contract and that you not are a person barred from receiving or using the Persona Services under the laws of any country, including the country in which you are resident or from which you use the Persona Services.
+
+9) Miscellaneous. These Terms are governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. If any portion of these Terms is held to be invalid or unenforceable, the remaining portions will remain in full force and effect. In the event of a conflict between a translated version of these Terms and the English language version, the English language version shall control.  Mozilla’s subsidiaries and affiliates shall be third party beneficiaries of these Terms, entitled to enforce and rely upon the provisions hereof.
+
+10) Termination. You may terminate your use of the Persona Services at any time.  Mozilla may modify or discontinue the Persona Services at its discretion.</textarea>
+                           <label class="agree" for="agree"><input type="checkbox" name="agree" value="1" id="agree" <?php if ($upload_submitted['agree'] == 1) echo "checked "; ?>/> I agree to the user agreement</label>
+<?php if (array_key_exists('agree', $upload_errors)) echo '<span class="error-message tos-error">' . $upload_errors['agree'] . '</span>' ?>
+              
+                   
+                   
+                   <h4>How Would You Like to Share Your Personas Design?</h4>
+                     <p>We encourage you to make your design publicly available, though you may choose not to submit your design under an open source license.  Please select the option below that you prefer. </p>
+                   
+                   
+                     <div id="license-options">
+                         <p><label for="license-cc"><input type="radio" name="license" value="cc" id="license-cc" <?php if ($upload_submitted['license'] == 'cc') echo "checked "; ?>/>Yes, I want to make my design available to everyone under a Creative Commons license.</label></p>
+
+                            <ul>
+                             <li>   People may share and modify my Persona as long as they give me credit and don’t charge for it.  <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Learn more.</a></li>
+                                <li>My design will be quickly added to the directory and hosted for free.</li>
+                            </ul>
+
+                            <p><label for="license-restricted"><input type="radio" name="license" value="restricted" <?php if ($upload_submitted['license'] == 'restricted') echo "checked "; ?>id="license-restricted" />I’d rather restrict any modifications and sharing of my Personas design.</label></p>
+
+                            <ul>
+                             <li>   People may not share, modify, or distribute my design outside of the Personas application.
+                             </li>
+                             <li>I would like a free 30-day trial, after which point I may be charged a fee to help Mozilla sustain the program at no cost to users.  Full details will be sent via email as the trial period is expiring.</li>
+                            </ul>
+  <?php if (array_key_exists('license', $upload_errors)) echo '<span class="error-message">' . $upload_errors['license'] . '</span>' ?>
+
+                     </div>
+                   
+                   <button type="submit" class="button"><span>continue</span><span class="arrow">&nbsp;</span></button>
+                   
+                   
+                   
+               </form> 
+               
+               
+            </div>
+            <div id="secondary-content">
+              <ol id="upload-steps">
+                <li class="current"> <!-- Active step requires 'current' classname and the extra wrapper div -->
+                    <div class="wrapper">
+                        <h3>Step 1:</h3>
+                        <h4>Terms of Service</h4>
+                    </div> 
+                </li>
+                <li> <!-- class="completed" needed to show green checkbox -->
+                    <h3>Step 2:</h3>
+                    <h4>Create Your Persona</h4>
+                </li>
+                <li>
+                    <h3>Step 3:</h3>
+                    <h4>Finish!</h4>
+                </li>
+              </ol>
+            </div>
+        </div>
+    </div>
+    
+   
+<?php include 'footer.php'; ?>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/server/templates/user_error.php
@@ -0,0 +1,16 @@
+<?php include 'header.php'; ?>
+<body >
+    <div id="outer-wrapper">
+        <div id="inner-wrapper">
+<?php include 'nav.php'; ?>
+            <div id="header">
+                <h2>A Problem Occurred</h2>
+            </div>
+            <div id="maincontent">
+                <?= $_errors['error'] ?>
+            </div>
+        </div>
+    </div>
+<?php include 'footer.php'; ?>
+</body>
+</html>
--- a/server/updated.php
+++ b/server/updated.php
@@ -1,131 +1,36 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas For Firefox | Firstrun</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
+<?php
+	require_once 'lib/personas_constants.php';	
+	require_once 'lib/personas_functions.php';	
+	require_once 'lib/storage.php';
+	require_once 'lib/user.php';
+
+	$db = new PersonaStorage();
+	$user = new PersonaUser();
+
+	$title = "Firstrun"; 
+	include 'templates/header.php'; 
+?>
 <body class="updated">
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                
-                <div id="check-it-out">
-                    <div class="hd">
-                        &nbsp;
-                    </div>
-                    <p class="bd">
-                        Check it out! Your browser's all dressed up.                        
-                    </p>
-                    <div class="ft">
-                        &nbsp;
-                    </div>
-                </div>
-                
-            </div>
+<?php include 'templates/nav.php'; ?>
             <div id="header">
                 <h2>You've been updated to the latest version of Personas!</h2>
 
             </div>
             
-            <div class="feature slideshow">
-                <h3>Featured Personas</h3>
-                <ul id="slideshow-nav">
-                    <li><a href="#" class="active">1</a></li>
-                    <li><a href="#">2</a></li>
-                    <li><a href="#">3</a></li>
-                    <li><a href="#">4</a></li>
-                </ul>
-                <a href="#" id="slideshow-previous"><img src="/store/img/nav-prev.png" alt="Previous"/></a>
-                <a href="#" id="slideshow-next"><img src="/store/img/nav-next.png" alt="Next"/></a>
-                <div id="slideshow">
-                    <ul id="slides">
-<?php
-	require_once 'lib/personas_constants.php';	
-	require_once 'lib/personas_functions.php';	
-	require_once 'lib/storage.php';
-
-
-	$db = new PersonaStorage();
-	$featured = $db->get_featured_personas();
-	$description_max = 50;
-	foreach ($featured as $persona)
-	{
-		$item_description = $persona['description'];
-		if (strlen($item_description) > $description_max)
-		{
-			$item_description = substr($item_description, 0, $description_max);
-			$item_description = preg_replace('/ [^ ]+$/', '', $item_description) . '...';
-		}
-		$persona_date = date("n/j/Y", strtotime($persona['approve']));
-		$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-		$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
-?>
-                        <li>
-                            <img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
-                            <h4><?= $persona['name'] ?></h4>
-                            <p class="try"><a href="<?= $detail_url ?>">view details »</a></p>
-                            <hr />
-                            <p class="designer"><strong>Designer:</strong> <?= $persona['author'] ?></p>
-                            <p class="added"><strong>Added:</strong> <?= $persona_date?></p>
-                            <hr />
-
-                        </li>
-<?php
-	}
-?>
-                    </ul>
-                    
-                </div>
-            </div>
-            <div class="feature">
-                <h3>Featured Designer</h3>
-<?php
-	$persona = $db->get_persona_by_id(FEATURE_DESIGNER_PERSONA_ID); 
-	$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-	$detail_url = "/store/gallery/persona/" . url_prefix($persona['id']);
-?>
-					<img class="preview persona" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_featured.jpg" persona="<?= $persona_json ?>">
-                    <h4><?= $persona['author'] ?></h4>
-                    <p class="try"><a href="/store/featured">view more »</a></p>
-            </div>
-            <div class="feature last">
-                <h3>Most Popular Personas</h3>
-                <ol class="popular">
-<?php
-	$list = $db->get_popular_personas(null,3);
-	foreach ($list as $persona)
-	{
-		$persona_json = htmlentities(json_encode(extract_record_data($persona)));
-?>
-					<li>
-                            <h4><?= $persona['name'] ?></h4>
-                            <hr />
-                            <img class="persona" alt="<?= $persona['name'] ?>" persona="<?= $persona_json ?>" src="<?= PERSONAS_LIVE_PREFIX . '/' . url_prefix($persona['id']) ?>/preview_popular.jpg">
-                            <p class="downloads"><strong>Current Users:</strong> <?= number_format($persona['popularity']) ?></p>
-                    </li>
-<?php
-	}
-?>
-                </ol>
-            </div>
+<?php include 'templates/featured_personas.php'; ?>
+<?php include 'templates/featured_designer.php'; ?>
+<?php include 'templates/popular_personas.php'; ?>
             
         </div>
     </div>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="../privacy.html">Privacy</a></p>
-    </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
+<?php include 'templates/footer.php'; ?>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function () {
             $("#slideshow").slider();
         });
         $("img.persona").previewPersona();
     </script>
-    <script src="/store/js/urchin.js"></script>
 </body>
 </html>
--- a/server/upload_forms.php
+++ b/server/upload_forms.php
@@ -1,28 +1,20 @@
 <?php
 
 	require_once 'lib/personas_constants.php';
 	require_once 'lib/personas_functions.php';
 	require_once 'lib/storage.php';
 	require_once 'lib/user.php';	
-	
-	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
-	header('Pragma: private');
-	
+		
 	#step 1: Authenticate
 	$user = new PersonaUser();
 
-	if (array_key_exists('action', $_GET) && $_GET['action'] == 'logout')
-	{
-		$user->log_out();
-	}
-
 	$auth_user = $user->authenticate();
-
+	$user->force_signin();
 
 	$db = new PersonaStorage();
 	
 	$upload_errors = array();
 	$upload_submitted = array();
 
 	#is this an edit?
 	
@@ -49,44 +41,44 @@
 		$upload_submitted['header'] = null;
 		$upload_submitted['footer'] = null;
 	}
 	else
 	{
 		#step 2: Terms of Service
 		if (!array_key_exists('agree', $_POST) && !array_key_exists('firstterms', $_POST))
 		{
-			include 'lib/upload_tos_tmpl.php';
+			include 'templates/upload_tos_tmpl.php';
 			exit;
 		}
 		
 		#do form validation on the terms. make sure to transfer the data into the next form.
 		
 		$upload_submitted['agree'] = ini_get('magic_quotes_gpc') ? stripslashes($_POST['agree']) : $_POST['agree'];
 		$upload_submitted['license'] = ini_get('magic_quotes_gpc') ? stripslashes($_POST['license']) : $_POST['license'];
 
 		if ($upload_submitted['agree'] != 1)
 			$upload_errors['agree'] = "Please make sure to agree to the licensing agreement";
 		
 		if ($upload_submitted['license'] != 'cc' && $upload_submitted['license'] != 'restricted')
 			$upload_errors['license'] = "Please make sure to choose the appropriate license";
 
 		if (count($upload_errors) > 0)
 		{
-			include 'lib/upload_tos_tmpl.php';
+			include 'templates/upload_tos_tmpl.php';
 			exit;
 		}
 	}
 	
 	#step 3: Upload Form
 	$categories = $db->get_categories();
 
 	if (!array_key_exists('name', $_POST))
 	{
-		include 'lib/upload_persona_tmpl.php';
+		include 'templates/upload_persona_tmpl.php';
 		exit;
 	}
 	
 	#ok, they've tried to submit the form. Let's look at the data...
 
 	$upload_submitted['category'] = ini_get('magic_quotes_gpc') ? stripslashes($_POST['category']) : $_POST['category'];
 	$upload_submitted['name'] = trim(ini_get('magic_quotes_gpc') ? stripslashes($_POST['name']) : $_POST['name']);
 	$upload_submitted['accentcolor'] = ini_get('magic_quotes_gpc') ? stripslashes($_POST['accentcolor']) : $_POST['accentcolor'];
@@ -160,17 +152,17 @@
 		$upload_submitted['footer'] = preg_replace('/[^A-Za-z0-9_\-\.]/', '', $_FILES['footer-image']['name']);
 	}
 	
 	if ($upload_submitted['header'] && $upload_submitted['header'] == $upload_submitted['footer'])
 		$upload_errors['footer-image'] = "Please use different names for the header and the footer";
 	
 	if (count($upload_errors) > 0)
 	{
-		include 'lib/upload_persona_tmpl.php';
+		include 'templates/upload_persona_tmpl.php';
 		exit;
 	}
 	
 	#now the more complex image checks		
 	
 	
 	if (!(array_key_exists('id', $upload_submitted) && $_FILES['header-image']['size'] == 0)) #images are optional on edit
 	{
@@ -191,17 +183,17 @@
 		if (!($ftype == 'JPEG' || $ftype == 'PNG'))
 			$upload_errors['footer-image'] = "We do not recognize the format of your footer image. Please let us know at persona-devel@mozilla.com if you think this is in error.";
 		elseif ($fheight < 100 || $fwidth < 2500)
 			$upload_errors['footer-image'] = "Please make sure your footer image is at least 2500x100 pixels (it appears to be $fwidth" . "x$fheight)";
 	}	
 			
 	if (count($upload_errors) > 0)
 	{
-		include 'lib/upload_persona_tmpl.php';
+		include 'templates/upload_persona_tmpl.php';
 		exit;
 	}
 	
 	#step 4: Success
 
 	if (array_key_exists('id', $upload_submitted))
 	{
 		$db->submit_persona_edit($upload_submitted['id'], $auth_user, $upload_submitted['name'], $upload_submitted['category'], $upload_submitted['accentcolor'], $upload_submitted['textcolor'], $upload_submitted['description'], $upload_submitted['header'], $upload_submitted['footer'], $upload_submitted['reason'], $upload_submitted['reason-other']);
@@ -216,33 +208,33 @@
 	}
 	$persona_path = make_persona_pending_path($upload_submitted['id']);
 	
 	if ($_FILES['footer-image']['size'] > 0 && !move_uploaded_file($_FILES['footer-image']['tmp_name'], $persona_path . "/" . $upload_submitted['footer']))
 	{
 		$upload_errors['footer-image'] = "A problem occured uploading your persona. Please contact persona-devel@mozilla.com to let us know about this issue. Thank you.";
 		if (!array_key_exists('id', $_POST))
 			$db->reject_persona($upload_submitted['id']);
-		include 'lib/upload_persona_tmpl.php';
+		include 'templates/upload_persona_tmpl.php';
 		exit;					
 	}
 
 	if ($_FILES['header-image']['size'] > 0)
 	{
 		if (!move_uploaded_file($_FILES['header-image']['tmp_name'], $persona_path . "/" . $upload_submitted['header']))
 		{
 			$upload_errors['header-image'] = "A problem occured uploading your persona. Please contact persona-devel@mozilla.com to let us know about this issue. Thank you.";
 			if (!array_key_exists('id', $_POST))
 				$db->reject_persona($upload_submitted['id']);
-			include 'lib/upload_persona_tmpl.php';
+			include 'templates/upload_persona_tmpl.php';
 			exit;					
 		}
 		build_persona_files($persona_path, $upload_submitted);
 	}
 	else
 	{
 		file_put_contents($persona_path . '/index_1.json', json_encode(extract_record_data($upload_submitted)));
 	}
 
-	include 'lib/upload_success_tmpl.php';
+	include 'templates/upload_success_tmpl.php';
 
 
 ?>
\ No newline at end of file
--- a/server/viewpersonas.php
+++ b/server/viewpersonas.php
@@ -1,64 +1,44 @@
 <?php 
 	require_once 'lib/personas_constants.php';	
 	require_once 'lib/personas_functions.php';	
 	require_once 'lib/storage.php';
 	require_once 'lib/user.php';
 	
-	header('Cache-Control: no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
-	header('Pragma: private');
-	
+	$user = new PersonaUser();
+	$user->authenticate();
+		
 	$page_size = 21;
 
 	$db = new PersonaStorage();
 	$categories = $db->get_categories();
 	array_unshift($categories, 'All');
 	$tabs = array('Popular', 'Recent', 'All', 'My');
 	
 	$path = array_key_exists('PATH_INFO', $_SERVER) ? $_SERVER['PATH_INFO'] : '/';
 	$path = substr($path, 1); #chop the lead slash
 	list($category, $tab, $page) = explode('/', $path.'//');
 
 	$no_my = array_key_exists('no_my', $_GET) ? 1 : 0;
-	$url_prefix = $no_my ? '/store/gallery' : '/store/dynamic/gallery';
+	$url_prefix = '/gallery';
 	$category = $category && ($category == 'Designer' || in_array(ucfirst($category), $categories)) ? ucfirst($category) : "All";
 	$tab = $tab && ($category == 'Designer' || in_array(ucfirst($tab), $tabs)) ? ucfirst($tab) : 'Popular';
 	$page = $page && is_numeric($page) ? $page : 1;
 
 	if ($tab == 'All' and $category == 'All')
 		$page_size = null;
-		
-	$user = new PersonaUser();
-	if (array_key_exists('PERSONA_USER', $_COOKIE))
-		$user->authenticate_user_from_cookie($_COOKIE['PERSONA_USER']);
+	
+	$title = "Gallery"; 
+	include 'templates/header.php'; 
 ?>
-
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas for Firefox | Gallery</title>
-	<link href="/store/css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
 <body>
     <div id="outer-wrapper">
         <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular" class="active">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
+<?php include 'templates/nav.php'; ?>
             <div id="header">
                 <h2>View Personas</h2>
                 <h3>Your browser, your style! Dress it up with easy-to-change "skins" for your
                 Firefox.</h3>
             </div>
             <div id="maincontent">
                 <p id="breadcrumbs"><a href="http://www.getpersonas.com">Personas Home</a> : <a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a> : <?= $category ?><?php if ($tab != "All") { echo " : $tab"; } ?></p>
                 <div id="gallery">
@@ -92,34 +72,33 @@
 				echo "There are no personas available here. Please use the navigation on the left to choose another category.";
 			}
 			
 			foreach ($list as $item)
 			{
 				$preview_url = PERSONAS_LIVE_PREFIX . '/' . url_prefix($item['id']) . '/' . "preview.jpg";
 				$persona_json = htmlentities(json_encode(extract_record_data($item)));
 				$persona_date = date("n/j/Y", strtotime($item['approve']));
-				$detail_url = $no_my ? ("/store/gallery/persona/" . url_prefix($item['id'])) : ("/store/dynamic/persona/" . $item['id']);
 				$item_description = $item['description'];
 				if (strlen($item_description) > $description_max)
 				{
 					$item_description = substr($item_description, 0, $description_max);
 					$item_description = preg_replace('/ [^ ]+$/', '', $item_description) . '...';
 				}
 ?>
                         <li class="gallery-item">
                             <div>
                                 <h3><?= $item['name'] ?></h3>
                                 <div class="preview">
                                     <img src="<?= $preview_url ?>" alt="<?= $item['name'] ?>" persona="<?= $persona_json ?>"/>
                                 </div>
                                 <p class="designer"><strong>Designer:</strong> <?= $item['author'] ?></p>
                                 <p class="added"><strong>Added:</strong> <?= $persona_date ?></p>
                                 <p><?= $item_description ?></p>
-                                <p><a href="<?= $detail_url ?>" class="view">view details »</a></p>
+                                <p><a href="<?= "/persona/" . $item['id'] ?>" class="view">view details »</a></p>
 <?php
 				if ($tab == 'My' || $user->has_admin_privs())
 				{
 					print "<p><a href=\"/upload?id=${item['id']}\" target=\"_blank\">Edit</a>";
 					if ($user->has_admin_privs())
 						print " | <a href=\"/admin/pending.php?verdict=pull&id=${item['id']}\" target=\"_blank\" onClick=\"return confirm('Confirm Deletion');\">Pull</a>";
 					print "</p>";
 				}
@@ -161,57 +140,19 @@
 					$url = "$url_prefix/$category/$tab/" . ($page + 1);
 					echo "<li><a href=\"$url\">Next</a></li>\n";
 				}
 				echo "</ul>\n";
 				echo "</div>\n";
 			}
 ?>
             </div>
-	<div id="secondary-content">
-                <ul id="subnav">
-<?php
-			foreach ($categories as $list_category)
-			{
-				$category_url = "$url_prefix/$list_category";
-				if ($list_category == $category)
-				{
-					echo "		<li class=\"active\">$list_category\n";
-					echo "            <ul>\n";
-					foreach ($tabs as $list_tab)
-					{
-						if ($list_tab == 'My' && $no_my == 1)
-							continue;
-						#if ($list_tab == 'All' && $list_category == 'All')
-						#	continue;
-						$tab_url = "$url_prefix/$list_category/$list_tab";
-						echo "		<li";
-						if ($list_tab == $tab)
-							echo ' class="active"';
-						if ($list_tab == 'All' && $list_category != 'All')
-							$tab_url .= "/1";
-						echo "><a href=\"$tab_url\">$list_tab</a></li>\n";						
-					}
-					echo "                        </ul></li>\n";
-				}
-				else
-				{
-					echo "		<li><a href=\"$category_url/Popular\">$list_category</a></li>";
-				}
-			}
-?>
-                </ul>
-            </div>
+<?php include 'templates/category_nav.php'; ?>
         </div>
     </div>
-    <script src="/store/js/jquery.js"></script>
-    <script src="/store/js/script.js"></script>
+<?php include 'templates/footer.php'; ?>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function() {
            $("#gallery .preview img").previewPersona();
         });
     </script>
-    <div id="footer">
-        <p>Copyright © <?= date("Y") ?> Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="http://www.getpersonas.com/store/privacy.html">Privacy</a></p>
-    </div>
-    <script src="/store/js/urchin.js"></script>
 </body>
 </html>
deleted file mode 100644
--- a/store/demo_create.html
+++ /dev/null
@@ -1,257 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas For Firefox | How To Create Personas</title>
-	<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html" class="active">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Demo</h2>
-                <h3>Personas are lightweight, easy to install and easy to change “skins” for your Firefox web browser.</h3>
-            </div>
-            <div id="maincontent" class="demo">
-                <div id="breadcrumbs">
-                    <a href="http://www.getpersonas.com">Personas Home</a> : How to Create Personas
-                </div>
-                <h3>How to Create Personas</h3>
-                
-
-                
-                
-                <div id="tutorial">
-
-
-                	<!-- STEP 1 -->
-
-
-                		<div class="tut_Title">Step 1: Understanding and Designing Persona Header and Footer Images</div>
-
-                        <p>
-
-
-                		Personas are made up of two graphic image files - a "header" image and a "footer" image - which skin
-                		the default Firefox UI background.</p>
-
-                		<div class="tut_SubTitle">An example of a header image</div>
-
-                	    <p>
-
-                		The header image is displayed as the background of the top of the browser window, nestling in behind
-                		the toolbars, address bar, search bar and the tab strip.</p>
-
-                		<p><span class="tutBold">Whatever header image you create, it will be anchored to the top-right corner of the
-                		browser window</span>.  The right-hand side of the image is always visible, and as a user
-                		increases the width of the browser window, the browser reveals more of the left-hand side of the
-                		image. This means that the most valuable visual information should be placed in the upper right area
-                		of the header image.</p>
-
-                		<p>The browser might reveal more of the lower portion of the image as well if it (or an extension)
-                		adds another toolbar (like the toolbar that comes with the StumbleUpon extension) or other UI
-                		elements to the top of the window.</p>
-
-                		<p>The header image should be PNG or JPG, <span class="tutBold">3000 pixels wide and 200 pixels tall</span> and <span class="tutBold">no
-                		larger than 300kb in filesize.</span></p>
-
-
-                		<div class="tut_Image"><a href="/store/img/Persona_Header_LABS.jpg"><img src="/store/img/tut_headerImage.jpg"
-                		border="0"></a></div>
-
-                		<div class="tut_SubTitle">Header image as seen in OSX, XP and Vista</div>
-
-                		<div class="tut_Image"><img src="/store/img/tut_OSXheader.jpg" border="0"><span
-                		class="caption">OSX</span></div> <div class="tut_Image"><img src="/store/img/tut_XPheader.jpg"
-                		border="0"><span class="caption">Windows XP</span></div> <div class="tut_Image"><img
-                		src="/store/img/tut_VISTAheader.jpg" border="0"><span class="caption">Windows Vista</span></div>
-
-                		<div class="tut_SubTitle">An example of a footer image</div>
-
-                        <p>
-
-
-                		The footer image is displayed as the background of the bottom of the browser window, behind the
-                		status and find bars.</p>
-
-                		<p><span class="tutBold">The footer image, unlike the header, is anchored to the bottom-left corner of the browser
-                		window</span>, so the left-hand side of the image is always visible. As a user increases the width
-                		of the browser window, the browser reveals more of the right-hand side of the image.</p>
-
-                		<p>When the status bar is in its default state, there is very little of the footer image shown
-                		vertically, and this should be taken into account in your designs.  The browser might reveal more of
-                		the upper portion of the image as well if it (or an extension) adds another bar (like the Find bar)
-                		or other UI elements to the bottom of the window.</p>
-
-                		<p>The footer image should be PNG or JPG, <span class="tutBold">3000 pixels wide and 100 pixels tall</span> and <span class="tutBold">no
-                		larger than 300kb in filesize.</span></p>
-
-                		<div class="tut_Image"><a href="/store/img/Persona_Footer_LABS.jpg"><img src="/store/img/tut_footerImage.jpg"
-                		border="0"></a></div>
-
-                		<div class="tut_SubTitle">Footer image as seen in OSX, XP and Vista</div>
-
-                		<div class="tut_Image"><img src="/store/img/tut_OSXfooter.jpg" border="0"><span
-                		class="caption">OSX</span></div> <div class="tut_Image"><img src="/store/img/tut_XPfooter.jpg"
-                		border="0"><span class="caption">Windows XP</span></div> <div class="tut_Image"><img
-                		src="/store/img/tut_VISTAfooter.jpg" border="0"><span class="caption">Windows Vista</span></div>
-
-
-
-                	<!-- STEP 2 -->
-
-
-                		<div class="tut_Title">Step 2: Testing your Persona Header and Footer Images</div>
-
-                	    <p>
-
-                		In general, designs that feature rich content areas in the top-right corner of the browser work
-                		best. Though that may be true, you should always check to see where the UI elements sit on top of
-                		your designs within the different platform versions of Firefox. <p>This may be a critical step in
-                		finalizing your image, depending on the importance of the visual information you are including in
-                		your designs.</p>
-
-
-
-                		<div class="tut_SubTitle">Option 1: Using the Custom Persona setting within Firefox</div> 
-
-                		<p>
-
-
-                		Within the Personas menu in the bottom left of the browser's status bar, you can enable an "offline" Persona on your own personal computer by enabling a setting within Preferences.
-                		In doing this, you can test your Personas before submitting them to the online catalog.  Follow these four steps to get the Custom Personas option up and running in your browser:
-
-            		</p>
-
-                		<div class="tut_Image"><img src="/store/img/tut_custom_1.jpg" border="0"><br><span
-                		class="caption"><span class="tutBold">STEP 1)</span> select "Preferences..."  <span class="tutBold">STEP 2)</span> check "Show Custom Persona in menu" <span class="tutBold">STEP 3)</span> select the Custom Persona and "Edit"</span></div>
-
-                		<div class="tut_Image"><img src="/store/img/tut_custom_2.jpg" border="0"><br><span
-                		class="caption"><span class="tutBold">STEP 4)</span> Build the Persona using the upload fields and additional settings</span></div>
-
-
-                		<p>
-
-                		Once your images are playing nice with the UI for all the OS flavors of Firefox, save final copies (PNG or JPG) -
-                		but be sure to check to <span class="tutBold">ensure they don't exceed 300k in filesize!</span>. (Note: This will only test your Persona on the platform you are currently using)
-
-            		</p>
-
-                		
-
-                		<div class="tut_SubTitle">Option 2: Cross-Platform Photoshop PSD Header Template</div> 
-
-                        <p>
-
-                		We've created a positioning template that can be used to help figure out placement of your
-                		artwork. The template is structured to allow testing of your Persona header within OSX, Windows XP and Windows Vista
-                		flavors of the browser. </p>
-
-                		<div class="link">Download the Personas Header Template:  <a
-                		href="/store/img/Persona_Header_TEMPLATE.psd" class="button"><span>download</span><span>&nbsp;</span></a></div>
-
-
-                        <p>
-                		The key to using this PSD template is to simply layer your Persona header image underneath one of
-                		the three OS layers.  Be sure to turn off any of the OS layers you aren't using, as they will
-                		overlap each other due to their transparency.</p>
-
-                		<div class="tut_Image center"><img src="/store/img/tut_PSpalette.jpg" border="0"><br><span
-                		class="caption">Photoshop overlay layerset</span></div>
-
-                	
-
-                		<p>Once you turn on an OS layer, you will be able to see where the UI elements will sit on top of
-                		your designs and you can flag any conflicts that may arise. </p>
-
-                		<div class="tut_SubTitle">Layer Overlays in Header Template PSD</div>
-
-                		<div class="tut_Image"><img src="/store/img/tut_OSXmask.jpg" border="0"><span class="caption">OSX layer
-                		overlay</span></div> <div class="tut_Image"><img src="/store/img/tut_XPmask.jpg" border="0"><span
-                		class="caption">Windows XP layer overlay</span></div> <div class="tut_Image"><img
-                		src="/store/img/tut_VISTAmask.jpg" border="0"><span class="caption">Windows Vista layer
-                		overlay</span></div>
-
-
-                	    <p>
-
-                		The example below shows our tutorial header image layered underneath the XP overlay, highlighting
-                		where the UI will interact with the design and warning of any issues that you may want to address.
-                		The secondary dark bar below the toolbar images is the location of the tabstrip.</p>
-
-                		<div class="tut_Image"><img src="/store/img/tut_XPoverlay.jpg" border="0"><span class="caption">XP
-                		overlay on top of header image</span></div>
-
-                		<p>
-                		Once your images are playing nice with the UI for all the OS flavors of Firefox, save final copies (PNG or JPG) -
-                		but be sure to check to <span class="tutBold">ensure they don't exceed 300k in filesize!</span>.</p>
-
-
-
-                	<!-- STEP 3 -->
-
-
-
-                		<div class="tut_Title">Step 3: Submit your Persona!</div>
-
-                        <p>
-
-                		Now that you have finalized the artwork, it is time to share! One thing to note, please do be sure
-                		that you have the rights to use whatever image or design you use in your Persona. (We don't want to
-                		get any nasty lawyer letters!)</p>
-
-                		<p>Follow the link below to start the process and add your creations to the constantly growing
-                		catalog of Firefox Personas!</p>
-
-                		<div class="link">Go create your first Persona:  <a href="https://personas.services.mozilla.com/upload" class="button"><span>get started!</span><span>&nbsp;</span></a></div>
-
-
-
-
-                	</div>
-                
-                
-         
-         
-            </div>
-            <div id="secondary-content">
-              <ol id="demo-nav">
-                <li> 
-                    <a href="demo_install.html">How to Get Started</a>
-                </li>
-                <li class="current">
-                    <div class="wrapper">
-                        <span>How to Create Personas</span>
-                    </div>
-                </li>
-              </ol>
-              
-              <div class="info-box">
-                <h3><a href="http://www.getpersonas.com">Get Personas Free</a></h3>
-                <div class="body">
-                    <p>Easy to install and easy to change "skins" for your Firefox web browser.</p>
-                </div>
-              </div>
-            </div>
-        </div>
-    </div>
-    <script src="js/jquery.js"></script>
-    <script src="js/script.js"></script>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="privacy.html">Privacy</a></p>
-        
-    </div>
-    <script src="/store/js/urchin.js"></script>
-</body>
-</html>
deleted file mode 100644
--- a/store/demo_install.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas For Firefox | How to Get Started</title>
-	<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html" class="active">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>How to Get Started</h2>
-                <h3>Personas are lightweight, easy to install and easy to change “skins” for your Firefox web browser.</h3>
-            </div>
-            <div id="maincontent" class="demo">
-                <div id="breadcrumbs">
-                    <a href="http://www.getpersonas.com">Personas Home</a> : Watch Our Demo    
-                </div>
-                <h3>How to Install Personas</h3>
-                
-                <object width="400" height="300"><param name="allowfullscreen" value="true"
-                /><param name="allowscriptaccess" value="always" /><param name="movie"
-                value="http://vimeo.com/moogaloop.swf?clip_id=3841582&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1"
-                /><embed
-                src="http://vimeo.com/moogaloop.swf?clip_id=3841582&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1"
-                type="application/x-shockwave-flash" allowfullscreen="true"
-                allowscriptaccess="always" width="400" height="300"></embed></object>
-                
-            </div>
-            <div id="secondary-content">
-              <ol id="demo-nav">
-                <li class="current"> 
-                    <div class="wrapper">
-                        <span>How to Get Started</span>
-                    </div>
-                </li>
-                <li>
-                    <a href="demo_create.html">How to Create Personas</a>
-                </li>
-              </ol>
-              
-              <div class="info-box">
-                  <h3><a href="http://www.getpersonas.com">Get Personas Free</a></h3>
-                  <div class="body">
-                      <p>Easy to install and easy to change "skins" for your Firefox web browser.</p>
-                  </div>
-                </div>
-            </div>
-            
-        </div>
-    </div>
-    <script src="js/jquery.js"></script>
-    <script src="js/script.js"></script>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="privacy.html">Privacy</a></p>
-        
-    </div>
-    <script src="/store/js/urchin.js"></script>
-</body>
-</html>
deleted file mode 100644
--- a/store/faq.html
+++ /dev/null
@@ -1,157 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas For Firefox | Frequent Questions</title>
-	<link href="css/style.css" rel="stylesheet" type="text/css" media="all" >
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html" class="active">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Frequent Questions</h2>
-                <h3>Personas are lightweight, easy to install and easy to change “skins” for your Firefox web browser.</h3>
-            </div>
-            <div id="maincontent" class="demo">
-                <div id="breadcrumbs">
-                    <a href="http://www.getpersonas.com">Personas Home</a> :  Frequent Questions
-                </div>
-               
-                <dl>
-                    <dt>What are Personas?</dt>
-                    <dd>
-                        <p>Personas are lightweight “skins” that change the look of your Firefox web browser. You can easily switch between Personas with just a few clicks. There are hundreds of Personas to choose from, with more added every day. You can even create your own and share it with others.</p>
-                    </dd>
-                    <dt>How do I add Personas to my Firefox?</dt>
-                    <dd><p>In less than 60 seconds, you can install a Persona and transform the look of your Firefox web browser. Visit <a href="http://getpersonas.com">GetPersonas.com</a> and click the download button. After installation, you will be asked to restart Firefox.</p>
-
-                    <p>If you want to see how it works, you can watch a quick video demonstration <a href="demo_install.html">here</a>.</p>
-
-                    <p>Once Personas are installed, you’ll be able to choose and change your selected Persona any time simply by clicking on the little fox mask in the lower left-hand corner of your browser window.</p></dd>
-                
-                
-                <dt>How can I add or change my current Persona?</dt>
-                <dd><p>There are two easy ways to change your Persona:</p>
-                    <ol>
-                        <li>Visit the Personas website at <a href="http://getpersonas.com">GetPersonas.com</a>, check out the gallery, choose your favorite Persona, and click on your choice to instantly change the look of your browser.<br> OR</li>
-                       <li>Click on the little fox mask in the lower left hand corner of your browser, then select a Persona that suits your style.</li>
-                    </ol>
-                
-               <dt>I can't seem to find Personas for Firefox after I downloaded it and installed it.  Where is it?</dt>
-               <dd><p>Look for the little fox mask in the lower left-hand corner of your Firefox browser window.</p></dd>
-               
-               
-               <dt>Can I create my own Persona?</dt>
-
-               <dd><p>Absolutely! All you need to do is create two graphics files in your favorite graphics editing program (<em>e.g.</em>, Photoshop). To get started read more about how to <a href="demo_create.html">create a Persona</a>.</p></dd>
-               
-               <dt>What's the maximum file size allowable for my persona?</dt>
-
-               <dd><p>The persona that you upload may not exceed 300KB for the header or the footer
-               image.</p></dd>
-               
-               
-
-               <dt>Do I still retain ownership over Persona artwork that I upload to the Personas website?</dt>
-
-               <dd><p>Yes.</p></dd> 
-
-
-               <dt>What’s the difference between a Firefox theme and Personas for Firefox?</dt>
-
-               <dd><p>Personas allow you to “skin” the top and bottom areas of Firefox only (the header and footer of the browser chrome) without any change to the look of the navigation buttons or menus. With Personas, you can easily switch between many different lightweight skins with no further installation required.</p>
-
-               <p>Like Personas, a Firefox theme is a type of Firefox add-on that extends the functionality of your browser and allows you to “skin” it in a variety of ways. However, unlike Personas, a theme changes the appearance of navigation buttons, toolbars and menus.  </p></dd>
-
-
-               <dt>If I have an existing Firefox theme installed, will Personas still work?</dt>
-
-               <dd><p>Yes, Personas will work. However, it’s strongly recommended that you uninstall a theme when using Personas. To disable a current Firefox theme, go to the “Tools” menu and select “Add-ons” to display the add-ons manager. Then click on the “Themes” button at the top of the add-ons manager window, click on the “Default” theme for Firefox, and click on “Use theme”. After a quick restart, you’ll be ready to dress up your browser with Personas.</p></dd>
-
-
-               <dt>Do I have to add my Persona to the public gallery?</dt>
-
-               <dd><p>No. When you upload your Persona at GetPersonas.com, you can choose to add it to the public gallery or keep it private. If you want to upload a custom Persona without visiting GetPersonas.com, you can do so anytime by following these steps:</p>
-
-            <ol>            
-               <li>Enable custom Personas in your version of Personas:
-                   <ul>
-                       <li>Click on the little fox mask icon in the lower left-hand corner of your browser</li>
-                          <li>Select "Preferences..."</li>
-                          <li>Under “Advanced”, select "Show Custom Persona Menu"</li>
-                          <li>Close the preferences window</li>
-                   </ul>
-               </li>
-               
-               <li>Create your custom Persona:
-               <ul>
-                 <li>Click on the little fox mask icon in the lower left-hand corner of your browser</li>
-                 <li>Select "Custom Persona", then select "Edit" from its sub-menu</li>
-                 <li>Specify a header, footer, text color and accent color for a Persona that’s locally stored on your computer</li>
-                 <li>Your new Persona will be automatically selected, or you can manually choose it from the little fox mask menu </li>
-                 </ul>
-</ol>
-
-               <dt>What kind of computer and operating system does Personas work with?</dt>
-
-               <dd><p>Personas work with any type of computer that has Firefox installed. This includes Apple Mac, Linux and Windows platforms. You must have administrative rights to add Personas to your Firefox browser.</p></dd>
-
-
-               <dt>How do I uninstall Personas for Firefox?</dt>
-
-               <dd><p>If you’ve decided Personas doesn’t work for you, you can uninstall with a few easy steps:</p>
-                   <ol>
-                      <li>Open the Add-ons dialog box by going to “Tools->Add-ons”</li>
-                      <li>Click on the “Extensions” button on the top</li>
-                      <li>Select “Personas” </li>
-                      <li>Click "Uninstall"</li>
-                      <li>Restart Firefox</li>
-                      </ol></dd>
-
-
-               <dt>How do I provide feedback? </dt>
-
-               <dd><p>Personas is currently in beta, so we’re always looking for ways to improve the product. We’d love to hear what you think. Visit the <a href="https://labs.mozilla.com/forum/?CategoryID=18">Personas</a> forums to send us your feedback.</p>
-
-
-
-               <dt>Is Personas for Firefox open source?</dt>
-
-               <dd><p>Yes. The source code for Personas is available under the MPL/GPL/LGPL tri-license. You can view the source <a href="http://hg.mozilla.org/labs/personas/personas">here</a>.</p>
-
-         </dd>       
-                 <dt>Are Partnership Opportunities Available?</dt>
-                 <dd><p>Yes. If you want to learn more about how Personas can work with your organization and brand, send us an <a href="mailto:personas@mozilla.com">email</a>. Be sure to include your name, title, organization, and the purpose of your Persona.</p></dd>                
-               
-      </dl>
-                
-            </div>
-            <div id="secondary-content">
-              
-              
-              <div class="info-box">
-                <h3><a href="http://www.getpersonas.com">Get Personas Free</a></h3>
-                <div class="body">
-                    <p>Easy to install and easy to change "skins" for your Firefox web browser.</p>
-                </div>
-              </div>
-            </div>
-        </div>
-    </div>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="privacy.html">Privacy</a></p>
-    </div>
-    <script src="/store/js/urchin.js"></script>
-</body>
-</html>
deleted file mode 100644
--- a/store/privacy.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-            "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-	<title>Personas For Firefox | Privacy Policy</title>
-	<link href="css/style.css" rel="stylesheet" type="text/css" media="all" >
-</head>
-<body>
-    <div id="outer-wrapper">
-        <div id="inner-wrapper">
-            <p id="account"></p>
-            <div id="nav">
-                <h1><a href="http://www.getpersonas.com/"><img src="/store/img/logo.png" alt="Mozilla Labs Personas"></a></h1>
-                <ul>
-                    <li class="gallery"><a href="http://www.getpersonas.com/store/gallery/All/Popular">Gallery</a></li>
-                    <li class="create"><a href="https://personas.services.mozilla.com/upload">Create <br/>Your Own</a></li>
-                    <li class="demo"><a href="http://www.getpersonas.com/store/demo_install.html">Demo</a></li>
-                    <li class="faq"><a href="http://www.getpersonas.com/store/faq.html">Frequent <br/>Questions</a></li>
-                </ul>
-            </div>
-            <div id="header">
-                <h2>Privacy Policy</h2>
-                
-            </div>
-            <div id="maincontent" class="demo">
-                <div id="breadcrumbs">
-                    <a href="http://www.getpersonas.com">Personas Home</a> :  Privacy Policy
-                </div>
-               
-               
-                <h3>Mozilla Personas Privacy Policy</h3>
-                <p>Dated: March 20, 2009</p>
-                <p>We’re working hard to protect your privacy while delivering products and services that bring you the performance and protection you desire in your personal computing.  This privacy policy explains how Mozilla Corporation (“Mozilla”), a wholly-owned subsidiary of the non-profit Mozilla Foundation, collects and uses information about users of the official Mozilla Personas add-on (“Personas”) for Mozilla Firefox® web browser (“Firefox”).  It does not apply to other Mozilla websites, products or services.  </p>
-                <h4>Types of Information</h4>
-                <p>Personas collects certain information that falls into the following categories:</p>
-                <p><em>“Personal Information”</em> is information that you provide to us that personally identifies you, such as your name and email address.  Except as described below, Mozilla does not collect or require users of Personas to furnish Personal Information.  To protect your privacy any Personal Information will be available only to Mozilla employees, contractors, and selected contributors who signed confidentiality agreements that prohibit them from using or disclosing such information other than for internal Mozilla purposes.</p>
-                <p><em>“Non-Personal Information”</em> is information that cannot be directly associated with a specific person or entity.  Non-Personal Information includes but is not limited to your computer’s configuration, the Persona Design (as defined below) and the version of Personas you use.</p>
-                <p><em>“Potentially Personal Information”</em> is information that is Non-Personal Information in and of itself but that could be used in conjunction with other information to personally identify you.  For example, Internet Protocol (“IP”) addresses (the addresses of computers on the internet), which is Non-Personal Information in and of itself, could be Personal Information when combined with internet service provider (“ISP”) records.</p>
-                <p><em>“Aggregate Data”</em> is information that is recorded about users and collected into groups so it no longer reflects or references an individually identifiable user.  Aggregate Data does not contain any Personal Information.</p>
-                <h4>Personal Information</h4>
-                <p><em>Downloading Personas.</em>  Mozilla does not collect any Personal Information if you are downloading Personas.</p>
-                <p><em>Creating a Custom Persona.</em>  If you are creating a Custom Persona for your own use, Mozilla does not collect any Personal Information.</p>
-                <p><em>Contributing a Design to the Personas Gallery.</em> The Personas gallery is where you can browse all the available designs.  If you contribute a design or image (each a “Persona Design”) to the Personas gallery, Mozilla collects the following Personal Information: (1) your user name and (2) your email address.  Your user name will be used to attribute your Persona Design to you and will be publicly available on the Personas gallery.  You do not have to provide your real name; you can use a nickname or avatar.  Your email address will not be publicly available or shared with any third parties.  Mozilla will use your email address only to contact you regarding your design or to provide any additional information that you elect or opt in to receive.</p>
-                <p>In addition, Mozilla does not publicly release information gathered in connection with commercial transactions (i.e., transactions involving money). </p>
-                <p>Mozilla does not make publicly available Personal Information that it specifically promises at the time of collection to maintain in confidence. </p>
-                <h4>Interactive Product Features</h4>
-                <p>If you have Personas installed, each time you open Firefox Personas loads your selected Persona Design from the Mozilla server.  Once per day Personas checks to see if your selected Persona Design still is available in its list of Persona Designs.  This feature sends the same information that web browsers typically transfer with any HTTP requests including user agent and, Potentially Personally-Identifying Information such as, your IP address. </p>
-                <p>Personas has a feature that refreshes the Personas gallery once per day.  This feature sends the following Non-Personal Information to Mozilla: </p>
-                <ul>
-                <li>the category and ID of Persona Design selected;</li>
-                <li>the date/time the Persona Design was selected;</li>
-                <li>the ID and version of the application you used (e.g., Firefox 3.0.7);</li>
-                <li>your locale (e.g., English-US);</li>
-                <li>your operating system (i.e.,  Linux, Windows or Mac); and</li>
-                <li>your computer's architecture.</li>
-                </ul>
-                <p>Personas relies on Firefox’s automatic update feature for updates.  See the <a href="http://www.mozilla.com/en-US/legal/privacy/firefox-en.html">Firefox Privacy Policy</a> for privacy details of the Firefox automatic update feature. </p>
-                <p>We use this information to improve our products and services and to support decision making regarding feature and capacity planning.  Mozilla is an open organization that believes in sharing as much information as possible about its products, its operations, and its associations. Accordingly, we may release public reports containing Aggregate Data so that our global community and Personas partners may make better product and design decisions and so that users of Personas will know which are the most popular Persona Designs and Personas designers will know how many times their Persona Design was downloaded.  </p>
-                <h4>Privacy Policy Changes</h4>
-                
-                <p>Mozilla may change the Personas Privacy Policy from time to time.  Any and all changes will be reflected on this page.  When Mozilla changes this policy in a material way, a notice will be posted on the <a href="http://www.getpersonas.com">www.getpersonas.com</a> Web site.  Substantive changes may also be announced through the standard mechanisms by which Mozilla communicates with its users and community, including Mozilla's "announce" <a href="https://lists.mozilla.org/listinfo/announce">mailing list and newsgroup</a>.  It is your responsibility to ensure that you understand the terms of this Privacy Policy.  You should periodically check this page for any changes to the current policy.</p>
-                <h4>For More Information</h4>
-                <p>If you have questions about this privacy policy, please contact Mozilla at <a href="mailto:privacy@mozilla.com">privacy@mozilla.com</a>.  In your email, please identify the specific product or policy about which you have questions.</p>
-                
-            </div>
-            <div id="secondary-content">
-              
-              
-              <div class="info-box">
-                <h3><a href="http://www.getpersonas.com">Get Personas Free</a></h3>
-                <div class="body">
-                    <p>Easy to install and easy to change "skins" for your Firefox web browser.</p>
-                </div>
-              </div>
-            </div>
-        </div>
-    </div>
-    <div id="footer">
-        <p>Copyright © 2009 Mozilla. <a href="http://labs.mozilla.com/projects/firefox-personas/">Personas</a> is a <a href="http://labs.mozilla.com">Mozilla Labs</a> experiment. | <a href="http://labs.mozilla.com/about-labs/">About Mozilla Labs</a>    |  <a href="privacy.html">Privacy</a></p>
-    </div>
-    <script src="/store/js/urchin.js"></script>
-</body>
-</html>