about summary refs log tree commit diff stats
path: root/central/trunk/activate.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-08-15 13:32:35 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-08-15 13:32:35 +0000
commit77bc692bb7694aa635be1ca3752894e976477ebb (patch)
treeaf4a392f30298339f511c60dcc4df8ce25941ec9 /central/trunk/activate.php
parent68878a057b30f338eda7cacfe5f93cd850e8aaa1 (diff)
downloadinstadisc-77bc692bb7694aa635be1ca3752894e976477ebb.tar.gz
instadisc-77bc692bb7694aa635be1ca3752894e976477ebb.tar.bz2
instadisc-77bc692bb7694aa635be1ca3752894e976477ebb.zip
Central: Moved over to Four Island Templating system
Borrowed the Four Island templating system code so as to ease the creation of frontends. index.php and activate.php have already been converted, and install.php will not
be converted (because it would be too difficult, and who would want to skin it anyway?)

NOTICE: The Four Island Templating system source code is copyrighted by Starla Insigna (c) 2008. All rights reserved. Use of this code in part or in whole apart from the
InstaDisc Central Server is a direct violation of copyright law. You have been warned.

Refs #25
Diffstat (limited to 'central/trunk/activate.php')
-rw-r--r--central/trunk/activate.php81
1 files changed, 28 insertions, 53 deletions
diff --git a/central/trunk/activate.php b/central/trunk/activate.php index c8d4aa0..7b319b5 100644 --- a/central/trunk/activate.php +++ b/central/trunk/activate.php
@@ -3,6 +3,7 @@
3/* InstaDisc Server - A Four Island Project */ 3/* InstaDisc Server - A Four Island Project */
4 4
5include('instadisc.php'); 5include('instadisc.php');
6include('template.php');
6 7
7if (!isset($_GET['submit'])) 8if (!isset($_GET['submit']))
8{ 9{
@@ -27,21 +28,9 @@ if (!isset($_GET['submit']))
27 { 28 {
28 if (instaDisc_activateAccount($_POST['username'], $_POST['code'])) 29 if (instaDisc_activateAccount($_POST['username'], $_POST['code']))
29 { 30 {
30?> 31 $template = new FITemplate('activated');
31<HTML> 32 $template->add('SITENAME', instaDisc_getConfig('siteName'));
32 <HEAD> 33 $template->display();
33 <TITLE><?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc Central Server</TITLE>
34 </HEAD>
35 <BODY>
36 <CENTER>
37 <H1>InstaDisc Activation</H1>
38
39 <P>Thank you for activating! You've now been signed up for the InstaDisc service.
40 You will recieve an email with the information to input into your InstaDisc client.
41 </CENTER>
42 </BODY>
43</HTML>
44<?php
45 } else { 34 } else {
46 addError($numOfErrors, $errors, '', 'The email could not be sent'); 35 addError($numOfErrors, $errors, '', 'The email could not be sent');
47 showForm($_POST['username'], $_POST['code'], $errors); 36 showForm($_POST['username'], $_POST['code'], $errors);
@@ -54,46 +43,30 @@ if (!isset($_GET['submit']))
54 43
55function showForm($username, $code, $errors) 44function showForm($username, $code, $errors)
56{ 45{
57?> 46 $template = new FITemplate('activate');
58<HTML> 47 $template->add('SITENAME', instaDisc_getConfig('siteName'));
59 <HEAD> 48
60 <TITLE><?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc Central Server</TITLE>
61 <LINK REL="stylesheet" TYPE="text/css" HREF="uniform.css">
62 </HEAD>
63 <BODY>
64 <CENTER>
65 <H1>InstaDisc Activation</H1>
66
67 <P>If you've already registered and an activation email has been sent to your address, please fill in the form below.
68 </CENTER>
69
70 <FORM CLASS="uniform" ACTION="./activate.php?submit=" METHOD="POST">
71<?php
72 if (isset($errors[1])) 49 if (isset($errors[1]))
73 { 50 {
74?><DIV ID="errorMsg">Uh oh! Validation errors!<P> 51 $template->adds('ERROR', array('ex'=>'1'));
75<OL><?php 52
76 foreach ($errors as $name => $value) 53 foreach ($errors as $name => $value)
77 { 54 {
78?><LI><A HREF="#error<?php echo($name); ?>"><?php echo($value['msg']); ?></A></LI><?php 55 $template->adds('ERRORS', array( 'NAME' => $name,
56 'MSG' => $value['msg']));
79 } 57 }
80?></OL></DIV><?php
81 } 58 }
82?> 59
83<FIELDSET CLASS="inlineLabels"><LEGEND>User Details</LEGEND> 60 $template->add('USERNAME_ERR', ifErrors($errors, 'username'));
84<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'username'); ?>"> 61 $template->add('CODE_ERR', ifErrors($errors, 'code'));
85<?php doErrors($errors, 'username'); ?> <LABEL FOR="username"><EM>*</EM> Username: </LABEL> 62
86 <INPUT TYPE="text" ID="username" NAME="username" CLASS="textInput" VALUE="<?php echo($username); ?>"> 63 doErrors($template, $errors, 'username');
87</DIV> 64 doErrors($template, $errors, 'code');
88<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'code'); ?>"> 65
89<?php doErrors($errors, 'code'); ?> <LABEL FOR="code"><EM>*</EM> Activation Code: </LABEL> 66 $template->add('USERNAME', $username);
90 <INPUT TYPE="text" ID="code" NAME="code" CLASS="textInput" VALUE="<?php echo($code); ?>"> 67 $template->add('CODE', $code);
91</DIV> 68
92</FIELDSET> 69 $template->display();
93<DIV CLASS="buttonHolder">
94 <INPUT TYPE="submit" NAME="submit" VALUE="Verify">
95 <INPUT TYPE="submit" NAME="submit" VALUE="Delete">
96</DIV></FORM><?php
97} 70}
98 71
99function ifErrors($errors, $id) 72function ifErrors($errors, $id)
@@ -102,19 +75,21 @@ function ifErrors($errors, $id)
102 { 75 {
103 if ($value['field'] == $id) 76 if ($value['field'] == $id)
104 { 77 {
105 echo(' error'); 78 return ' error';
106 return;
107 } 79 }
108 } 80 }
81
82 return '';
109} 83}
110 84
111function doErrors($errors, $id) 85function doErrors($template, $errors, $id)
112{ 86{
113 foreach ($errors as $name => $value) 87 foreach ($errors as $name => $value)
114 { 88 {
115 if ($value['field'] == $id) 89 if ($value['field'] == $id)
116 { 90 {
117?> <P ID="error<?php echo($name); ?>" CLASS="errorField"><EM>*</EM> <?php echo($value['msg']); ?></P><?php echo("\n"); 91 $template->adds(strtoupper($id) . '_ERRS', array( 'NAME' => $name,
92 'VALUE' => $value['msg']));
118 } 93 }
119 } 94 }
120} 95}