diff options
Diffstat (limited to 'central/trunk')
-rw-r--r-- | central/trunk/activate.php | 81 | ||||
-rw-r--r-- | central/trunk/index.php | 24 | ||||
-rw-r--r-- | central/trunk/template.php | 160 | ||||
-rw-r--r-- | central/trunk/theme/activate.tpl | 62 | ||||
-rw-r--r-- | central/trunk/theme/activated.tpl | 14 | ||||
-rw-r--r-- | central/trunk/theme/index.tpl | 19 |
6 files changed, 288 insertions, 72 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 | ||
5 | include('instadisc.php'); | 5 | include('instadisc.php'); |
6 | include('template.php'); | ||
6 | 7 | ||
7 | if (!isset($_GET['submit'])) | 8 | if (!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 | ||
55 | function showForm($username, $code, $errors) | 44 | function 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 | ||
99 | function ifErrors($errors, $id) | 72 | function 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 | ||
111 | function doErrors($errors, $id) | 85 | function 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 | } |
diff --git a/central/trunk/index.php b/central/trunk/index.php index ce71def..1ef9c9d 100644 --- a/central/trunk/index.php +++ b/central/trunk/index.php | |||
@@ -3,24 +3,10 @@ | |||
3 | /* InstaDisc Server - A Four Island Project */ | 3 | /* InstaDisc Server - A Four Island Project */ |
4 | 4 | ||
5 | include('instadisc.php'); | 5 | include('instadisc.php'); |
6 | include('template.php'); | ||
6 | 7 | ||
7 | ?> | 8 | $template = new FITemplate('index'); |
8 | <HTML> | 9 | $template->add('SITENAME', instaDisc_getConfig('siteName')); |
9 | <HEAD> | 10 | $template->display(); |
10 | <TITLE>Four Island InstaDisc Central Server</TITLE> | ||
11 | </HEAD> | ||
12 | <BODY> | ||
13 | <CENTER> | ||
14 | <H1><?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc</H1> | ||
15 | 11 | ||
16 | <P>Welcome to <?php instaDisc_getConfig('siteName')); ?>'s InstaDisc Central Server! | 12 | ?> |
17 | <P>InstaDisc is a wonderful productivity-increasing notification program. For more information about the project itself, see | ||
18 | <A HREF="http://fourisland.com/projects/instadisc/">its project site</A>.<P>An InstaDisc "Central Server" is where you can | ||
19 | register for the InstaDisc service. There are many Central Servers around the world, you generally pick the one that is | ||
20 | closest to you. If you would like to choose <?php echo(instaDisc_getConfig('siteName')); ?>'s, why not register now? | ||
21 | <P><A HREF="register.php">Register</A> | ||
22 | <BR><A HREF="login.php">Login</A> | ||
23 | <BR><A HREF="activate.php">Activation page</A> | ||
24 | </CENTER> | ||
25 | </BODY> | ||
26 | </HTML> | ||
diff --git a/central/trunk/template.php b/central/trunk/template.php new file mode 100644 index 0000000..b4ec16b --- /dev/null +++ b/central/trunk/template.php | |||
@@ -0,0 +1,160 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/template.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | class FITemplate | ||
22 | { | ||
23 | |||
24 | var $file; | ||
25 | var $tags; | ||
26 | var $blocks; | ||
27 | var $refs; | ||
28 | |||
29 | function FITemplate($filename) | ||
30 | { | ||
31 | $tfn = 'theme/' . $filename . '.tpl'; | ||
32 | if (file_exists($tfn)) | ||
33 | { | ||
34 | $this->file = $tfn; | ||
35 | } else { | ||
36 | throw new Exception($tfn . ' does not exist'); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | function add($name, $value) | ||
41 | { | ||
42 | $this->tags[$name] = $value; | ||
43 | } | ||
44 | |||
45 | function adds($tagarr) | ||
46 | { | ||
47 | foreach ($tagarr as $name => $value) | ||
48 | { | ||
49 | $this->add($name,$value); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | function adds_block($block, $tagarr) | ||
54 | { | ||
55 | if (!isset($this->blocks[$block])) | ||
56 | { | ||
57 | $this->blocks[$block] = array('count' => 1); | ||
58 | } | ||
59 | foreach ($tagarr as $name => $value) | ||
60 | { | ||
61 | $this->blocks[$block][$this->blocks[$block]['count']][$name] = $value; | ||
62 | } | ||
63 | $this->blocks[$block]['count']++; | ||
64 | } | ||
65 | |||
66 | function add_ref($id, $block, $tagarr) | ||
67 | { | ||
68 | $this->adds_block($block,$tagarr); | ||
69 | $this->refs[$id] = &$this->blocks[$block][$this->blocks[$block]['count']-1];//'$this->blocks[\'' . $block . '\'][' . ($this->blocks[$block]['count']-1) . ']'; | ||
70 | } | ||
71 | |||
72 | function adds_ref($id, $tagarr) | ||
73 | { | ||
74 | foreach ($tagarr as $name => $value) | ||
75 | { | ||
76 | $this->refs[$id][$name] = $value; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | function adds_ref_sub($id, $block, $tagarr) | ||
81 | { | ||
82 | if (!isset($this->refs[$id][$block])) | ||
83 | { | ||
84 | $this->refs[$id][$block] = array('count' => 1); | ||
85 | } | ||
86 | foreach ($tagarr as $name => $value) | ||
87 | { | ||
88 | $this->refs[$id][$block][$this->refs[$id][$block]['count']][$name] = $value; | ||
89 | } | ||
90 | $this->refs[$id][$block]['count']++; | ||
91 | } | ||
92 | |||
93 | function display() | ||
94 | { | ||
95 | $template = file_get_contents($this->file); | ||
96 | while (preg_match('/<!--INCLUDE ([^>]*)-->/',$template) == 1) | ||
97 | { | ||
98 | preg_match('/<!--INCLUDE ([^>]*)-->/',$template,$mat); | ||
99 | $fname = $mat[1]; | ||
100 | $itmp = new FITemplate($fname); | ||
101 | $template = str_replace('<!--INCLUDE ' . $fname . '-->',file_get_contents($itmp->file),$template); | ||
102 | } | ||
103 | if (isset($this->tags)) | ||
104 | { | ||
105 | foreach ($this->tags as $name => $value) | ||
106 | { | ||
107 | $template = str_replace('<!--' . $name . '-->',$value,$template); | ||
108 | } | ||
109 | } | ||
110 | if (isset($this->blocks)) | ||
111 | { | ||
112 | foreach ($this->blocks as $bname => $block) | ||
113 | { | ||
114 | $this->parseBlock($template, $bname, $block); | ||
115 | } | ||
116 | } | ||
117 | while (preg_match('/<!--BEGIN ([^>]*)-->/',$template) == 1) | ||
118 | { | ||
119 | preg_match('/<!--BEGIN ([^>]*)-->/',$template,$mat); | ||
120 | $bname = $mat[1]; | ||
121 | $start = strpos($template,'<!--BEGIN ' . $bname . '-->'); | ||
122 | $end = strpos($template,'<!--END ' . $bname . '-->'); | ||
123 | $template = str_replace(substr($template,$start,$end-$start+strlen($bname)+11),'',$template); | ||
124 | } | ||
125 | $template = preg_replace('/<!--([^>]*)-->/','',$template); | ||
126 | echo($template); | ||
127 | } | ||
128 | |||
129 | function parseBlock(&$template, $bname, $block) | ||
130 | { | ||
131 | while (strpos($template,'<!--BEGIN ' . $bname . '-->') !== FALSE) | ||
132 | { | ||
133 | $start = strpos($template,'<!--BEGIN ' . $bname . '-->'); | ||
134 | $end = strpos($template,'<!--END ' . $bname . '-->'); | ||
135 | $gencont = substr($template,$start+strlen($bname)+13,$end-$start-strlen($bname)-13); | ||
136 | $blockcont = ''; | ||
137 | foreach ($block as $lname => $blocktags) | ||
138 | { | ||
139 | if ($lname != 'count') | ||
140 | { | ||
141 | $scrcont = $gencont; | ||
142 | foreach ($blocktags as $name => $value) | ||
143 | { | ||
144 | if (!is_array($value)) | ||
145 | { | ||
146 | $scrcont = str_replace('<!--' . $bname . '.' . $name . '-->',$value,$scrcont); | ||
147 | } else { | ||
148 | $this->parseBlock($scrcont, $bname . '.' . $name, $value); | ||
149 | } | ||
150 | } | ||
151 | $blockcont .= $scrcont; | ||
152 | } | ||
153 | } | ||
154 | $template = str_replace(substr($template,$start,$end-$start+strlen($bname)+11),$blockcont,$template); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | } | ||
159 | |||
160 | ?> | ||
diff --git a/central/trunk/theme/activate.tpl b/central/trunk/theme/activate.tpl new file mode 100644 index 0000000..caf8da6 --- /dev/null +++ b/central/trunk/theme/activate.tpl | |||
@@ -0,0 +1,62 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | <LINK REL="stylesheet" TYPE="text/css" HREF="uniform.css"> | ||
5 | </HEAD> | ||
6 | |||
7 | <BODY> | ||
8 | <CENTER> | ||
9 | <H1>InstaDisc Activation</H1> | ||
10 | |||
11 | <P>If you've already registered and an activation email has been sent to your address, please fill in the form below. | ||
12 | </CENTER> | ||
13 | |||
14 | <FORM CLASS="uniform" ACTION="./activate.php?submit=" METHOD="POST"> | ||
15 | |||
16 | <!--BEGIN ERROR--> | ||
17 | <DIV ID="errorMsg">Uh oh! Validation errors!<P> | ||
18 | <OL> | ||
19 | <!--END ERROR--> | ||
20 | |||
21 | <!--BEGIN ERRORS--> | ||
22 | <LI><A HREF="#error<!--ERRORS.NAME-->"><!--ERRORS.MSG--></A></LI> | ||
23 | <!--END ERRORS--> | ||
24 | |||
25 | <!--BEGIN ERROR--> | ||
26 | </OL> | ||
27 | </DIV> | ||
28 | <!--END ERROR--> | ||
29 | |||
30 | <FIELDSET CLASS="inlineLabels"> | ||
31 | <LEGEND>User Details</LEGEND> | ||
32 | |||
33 | <DIV CLASS="ctrlHolder<!--USERNAME_ERR-->"> | ||
34 | <!--BEGIN USERNAME_ERRS--> | ||
35 | <P ID="error<!--USERNAME_ERRS.NAME-->" CLASS="errorField"><EM>*</EM> | ||
36 | <!--USERNAME_ERRS.MSG--> | ||
37 | </P> | ||
38 | <!--END USERNAME_ERRS--> | ||
39 | |||
40 | <LABEL FOR="username"><EM>*</EM> Username: </LABEL> | ||
41 | <INPUT TYPE="text" ID="username" NAME="username" CLASS="textInput" VALUE="<!--USERNAME-->"> | ||
42 | </DIV> | ||
43 | |||
44 | <DIV CLASS="ctrlHolder<!--CODE_ERR-->"> | ||
45 | <!--BEGIN CODE_ERRS--> | ||
46 | <P ID="error<!--CODE_ERRS.NAME-->" CLASS="errorField"><EM>*</EM> | ||
47 | <!--CODE_ERRS.MSG--> | ||
48 | </P> | ||
49 | <!--END CODE_ERRS--> | ||
50 | |||
51 | <LABEL FOR="code"><EM>*</EM> Activation Code: </LABEL> | ||
52 | <INPUT TYPE="text" ID="code" NAME="code" CLASS="textInput" VALUE="<!--CODE-->"> | ||
53 | </DIV> | ||
54 | </FIELDSET> | ||
55 | |||
56 | <DIV CLASS="buttonHolder"> | ||
57 | <INPUT TYPE="submit" NAME="submit" VALUE="Verify"> | ||
58 | <INPUT TYPE="submit" NAME="submit" VALUE="Delete"> | ||
59 | </DIV> | ||
60 | </FORM> | ||
61 | </BODY> | ||
62 | </HTML> | ||
diff --git a/central/trunk/theme/activated.tpl b/central/trunk/theme/activated.tpl new file mode 100644 index 0000000..43c716f --- /dev/null +++ b/central/trunk/theme/activated.tpl | |||
@@ -0,0 +1,14 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | </HEAD> | ||
5 | <BODY> | ||
6 | <CENTER> | ||
7 | <H1>InstaDisc Activation</H1> | ||
8 | |||
9 | <P>Thank you for activating! You've now been signed up for the InstaDisc service. | ||
10 | You will recieve an email with the information to input into your InstaDisc client. | ||
11 | </CENTER> | ||
12 | </BODY> | ||
13 | </HTML> | ||
14 | |||
diff --git a/central/trunk/theme/index.tpl b/central/trunk/theme/index.tpl new file mode 100644 index 0000000..789928b --- /dev/null +++ b/central/trunk/theme/index.tpl | |||
@@ -0,0 +1,19 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | </HEAD> | ||
5 | <BODY> | ||
6 | <CENTER> | ||
7 | <H1><!--SITENAME--> InstaDisc</H1> | ||
8 | |||
9 | <P>Welcome to <!--SITENAME-->'s InstaDisc Central Server! | ||
10 | <P>InstaDisc is a wonderful productivity-increasing notification program. For more information about the project itself, see | ||
11 | <A HREF="http://fourisland.com/projects/instadisc/">its project site</A>.<P>An InstaDisc "Central Server" is where you can | ||
12 | register for the InstaDisc service. There are many Central Servers around the world, you generally pick the one that is | ||
13 | closest to you. If you would like to choose <!--SITENAME-->'s, why not register now? | ||
14 | <P><A HREF="register.php">Register</A> | ||
15 | <BR><A HREF="login.php">Login</A> | ||
16 | <BR><A HREF="activate.php">Activation page</A> | ||
17 | </CENTER> | ||
18 | </BODY> | ||
19 | </HTML> | ||