8cb1d62e4db4d149033f1e520d63d5f8ffbf8cfa
[dylansserver.git] / index.php
1 <?php
2
3 abstract class cms {
4
5 private $config_file = '/etc/dylansserver.ini';
6 protected $db;
7 protected $recaptcha_publickey;
8 protected $recaptcha_privatekey;
9 protected $scripts;
10 public $title;
11 public $home_link;
12
13 public function __construct() {
14 $config = parse_ini_file($this->config_file, true);
15 $this->db = new mysqli(
16 $config['database']['domain'],
17 $config['database']['user'],
18 $config['database']['password'],
19 $config['database']['database']);
20 if (mysqli_connect_errno()) {
21 echo "Problem connecting to database: ";
22 echo mysqli_connect_error();
23 exit();
24 }
25 $this->recaptcha_publickey = $config['recaptcha']['publickey'];
26 $this->recaptcha_privatekey = $config['recaptcha']['privatekey'];
27 $this->title = $config['site']['default_title'];
28 $this->home_link = $config['site']['home_link'];
29 ob_start();
30 }
31
32 public static function determine_type() {
33 if (isset($_GET['page']) && is_numeric($_GET['page'])) {
34 return 'page';
35 } else if (isset($_GET['year'])) {
36 return 'archive';
37 } else if (isset($_GET['note'])) {
38 return 'note';
39 } else if ($_SERVER['REQUEST_URI'] == '/') {
40 return 'index';
41 } else if (isset($_GET['project'])) {
42 return 'project';
43 } else if (isset($_GET['rss'])) {
44 return 'rss';
45 } else if (isset($_GET['challenge'])) {
46 return 'captcha';
47 }
48 }
49
50 public function query() {
51 $args = func_get_args();
52 $statement = $this->db->prepare($args[0]);
53 $args = array_slice($args, 1);
54 call_user_func_array(array($statement, 'bind_param'), &$args);
55 $statement->execute();
56 $return = array();
57 $statement->store_result();
58 $row = array();
59 $data = $statement->result_metadata();
60 $fields = array();
61 $fields[0] = &$statement;
62 while($field = $data->fetch_field()) {
63 $fields[] = &$row[$field->name];
64 }
65 call_user_func_array("mysqli_stmt_bind_result", $fields);
66 $i = 0;
67 while ($statement->fetch()) {
68 foreach ($row as $key=>$value) $return[$i][$key] = $value;
69 $i++;
70 }
71 $statement->free_result();
72 return $return;
73 }
74
75 public function display_head($title = "dylansserver",
76 $home_link = "/") {
77 $scripts = $this->scripts;
78 $stylesheets = "<link href='/includes/style.css' rel='stylesheet' type='text/css'>";
79 $home_link = "http://validator.w3.org/unicorn/check?ucn_uri=dylansserver.com&amp;ucn_task=conformance#";
80 echo <<<END_OF_HEAD
81 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
82 "http://www.w3.org/TR/html4/loose.dtd">
83
84 <html>
85 <head>
86 <meta name="generator" content=
87 "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
88 <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
89
90 <title>$this->title</title>
91 <link rel="icon" href="/favicon.ico" type="image/png">
92 $stylesheets
93 $scripts
94 </head>
95
96 <body onload="return typeof highlight == 'function' ? highlight() : true;">
97 <div id="structure">
98 <div id="banner">
99 <a href="$this->home_link">
100 <img src="/images/dylansserver.png" alt="dylansserver"
101 border="0"></a>
102 </div>
103
104 <div id="content">
105 END_OF_HEAD;
106 }
107
108 public function display_contact() {
109 echo <<<END_OF_CONTACT
110 <div id="contact_me"><h1><a href=
111 "mailto:dylan@psu.edu">dylan</a></h1><a href=
112 "mailto:dylan@psu.edu">@psu.edu</a>
113 </div>
114 END_OF_CONTACT;
115 }
116
117 public function display_close($show_contact = true) {
118 if ($show_contact) {
119 $this->display_contact();
120 }
121 echo <<<END_OF_CLOSE
122 </div>
123 <br>
124 <br>
125 </div>
126 </body>
127 </html>
128 END_OF_CLOSE;
129 ob_flush();
130 }
131
132 }
133
134
135 class index extends cms {
136
137 public function display() {
138 $this->scripts = "<script type='text/javascript' src='/includes/index.js'></script>";
139 $this->display_head();
140 $this->display_exhibits();
141 echo "<ul id='portfolio'>";
142 $this->list_projects();
143 echo <<<OTHER_PROJECTS
144 <li>
145 <h3>things i've done for others:</h3>
146 </li>
147
148 <li><a href=
149 "http://activehamptons.com">activehamptons.com</a></li>
150
151 <li><a href=
152 "http://transfishing.com">transfishing.com</a></li>
153
154 <li>
155 <h3>something i've worked on:</h3>
156 </li>
157
158 <li><a href=
159 "http://tempositions.com">tempositions.com</a></li>
160
161 <li>
162 <h3>my repositories:</h3>
163 </li>
164
165 <li><a href=
166 "/git/">git://dylansserver.com</a></li>
167
168 <li>
169 <h3>some notes:</h3>
170 </li>
171
172 <li><a href=
173 "/notes/">here</a> [<a href="/notes/rss">rss</a>]</li>
174
175 <li>
176 <h3>my resume:</h3>
177 </li>
178
179 <li>[<a href=
180 "/resume">pdf</a>]</li>
181
182 <li>
183 </li>
184 OTHER_PROJECTS;
185 // Because of the CSS necessary for the animations,
186 // the contact link needs to be in #portfolio to clear
187 // the floats.
188 echo "<li>";
189 $this->display_contact();
190 echo "</li>";
191 echo "</ul>";
192 $this->display_close($show_contact = false);
193 }
194
195 protected function display_exhibits() {
196 echo "<div id='exhibit'>";
197 $sql = "SELECT text FROM projects ORDER BY rank";
198 $result = $this->db->query($sql);
199 while ($entry = $result->fetch_object()) {
200 echo $entry->text;
201 }
202 echo "</div>";
203 }
204
205 private function list_projects() {
206 echo <<<HEREDOC
207 <li>
208 <h3>my projects:</h3>
209 </li>
210 HEREDOC;
211 $sql = "SELECT title FROM projects ORDER BY rank";
212 $result = $this->db->query($sql);
213 while ($entry = $result->fetch_object()) {
214 echo "<li><a class='tab' href='$entry->title'>$entry->title</a></li>";
215 }
216 }
217
218 }
219
220
221 class project extends index {
222
223 protected function display_exhibits() {
224 echo "<div id='exhibit'>";
225 $sql = "SELECT text FROM projects
226 WHERE title = ?";
227 $result = $this->query($sql, "s", $_GET['project']);
228 if ($result = $result[0]['text']) {
229 $text = str_replace("class='exhibit'", "class='exhibit' style='display:block;'", $result);
230 echo $text;
231 echo "</div>";
232 } else {
233 throw new notFound();
234 }
235 }
236
237 }
238
239
240 class page extends cms {
241
242 private $page = 1;
243 private $offset = 0;
244 private $notes_per_page = 4;
245 private $number_of_pages = 1;
246
247 public function __construct() {
248 parent::__construct();
249 $this->page_offset();
250 $this->scripts = "
251 <script type='text/javascript' src='/includes/syntax/scripts/shCore.js'></script>
252 <script type='text/javascript' src='/includes/syntax/scripts/shAutoloader.js'></script>
253 <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shCore.css'>
254 <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shThemeDefault.css'>
255 <script type='text/javascript'>
256 function highlight() {
257 SyntaxHighlighter.autoloader(
258 'js /includes/syntax/scripts/shBrushJScript.js',
259 'bash /includes/syntax/scripts/shBrushBash.js',
260 'sql /includes/syntax/scripts/shBrushSql.js',
261 'cpp /includes/syntax/scripts/shBrushCpp.js');
262 SyntaxHighlighter.defaults['gutter'] = false;
263 SyntaxHighlighter.defaults['toolbar'] = false;
264 SyntaxHighlighter.all();
265 }
266 </script>
267 ";
268 }
269
270 private function page_offset() {
271 $sql = "SELECT COUNT(*) FROM notes";
272 $result = $this->db->query($sql);
273 $result = $result->fetch_array();
274 $this->number_of_pages = ceil($result[0] / $this->notes_per_page);
275 if (isset($_GET['page']) && is_numeric($_GET['page'])) {
276 $this->page = (int) $_GET['page'];
277 } else {
278 throw new notFound();
279 }
280 if ($this->page > $this->number_of_pages) {
281 throw new notFound();
282 }
283 if ($this->page < 1) {
284 throw new notFound();
285 }
286 $this->offset = ($this->page - 1) * $this->notes_per_page;
287 }
288
289 public function display() {
290 $this->display_head();
291 echo "<div id='notes'>";
292 $sql = "SELECT date_posted, title, url, text
293 FROM notes ORDER BY date_posted DESC
294 LIMIT ?, ?";
295 $result = $this->query($sql, "ii",
296 $this->offset,
297 $this->notes_per_page);
298 foreach ($result as $row => $entry) {
299 $title = $entry['title'];
300 $url = '/note/' . $entry['url'];
301 $date_posted = explode("-", $entry['date_posted']);
302 $year_posted = $date_posted[0];
303 $month_posted = $date_posted[1];
304 $datetime_posted = explode(' ', $date_posted[2]);
305 $day_posted = $datetime_posted[0];
306 $text = $entry['text'];
307 echo <<<END_NOTE
308 <div class='note'>
309 <h1>
310 <span class='date'>$year_posted/$month_posted/$day_posted/</span><a rel="canonical" href='$url'>$title</a>
311 </h1>
312 $text
313 </div>
314 END_NOTE;
315 }
316 echo "</div>";
317 $this->write_navigation();
318 $this->display_close();
319 }
320
321 private function write_navigation() {
322 echo "<div id='navigation'>";
323 echo "<h1>";
324 if($this->page > 1){
325 $previous_page = $this->page - 1;
326 echo "<a href='/notes/page/$previous_page'>prev</a>";
327 }
328 if($this->page < $this->number_of_pages) {
329 $forward_page = $this->page + 1;
330 echo " <a href='/notes/page/$forward_page'>next</a>";
331 }
332 echo "</h1>";
333 echo "</div>";
334 }
335
336 }
337
338
339 class note extends cms {
340
341 private $id;
342 private $comments_enabled = false;
343 private $failed_captcha;
344 public $url;
345 public $title;
346 public $year_posted;
347 public $month_posted;
348 public $day_posted;
349 public $text;
350 public $number_of_comments;
351
352 public function __construct() {
353 $this->scripts = "
354 <script type='text/javascript' src='/includes/syntax/scripts/shCore.js'></script>
355 <script type='text/javascript' src='/includes/syntax/scripts/shAutoloader.js'></script>
356 <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shCore.css'>
357 <link type='text/css' rel='stylesheet' href='/includes/syntax/styles/shThemeDefault.css'>
358 <script type='text/javascript'>
359 function highlight() {
360 SyntaxHighlighter.autoloader(
361 'js /includes/syntax/scripts/shBrushJScript.js',
362 'bash /includes/syntax/scripts/shBrushBash.js',
363 'sql /includes/syntax/scripts/shBrushSql.js',
364 'cpp /includes/syntax/scripts/shBrushCpp.js');
365 SyntaxHighlighter.defaults['gutter'] = false;
366 SyntaxHighlighter.defaults['toolbar'] = false;
367 SyntaxHighlighter.all();
368 }
369 </script>
370 ";
371
372 if (isset($_GET['comments'])) {
373 $this->scripts .= "
374 <script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>
375 <script type='text/javascript' src='/includes/comment.js'></script>";
376 }
377 parent::__construct();
378 if (isset($_GET['comments'])) {
379 $this->comments_enabled = true;
380 }
381 $url = htmlspecialchars($_SERVER['REQUEST_URI']);
382 if (isset($_GET['verify'])) {
383 $url = substr($url, 0, (strlen($url)-6));
384 }
385 $this->url = $url;
386 $sql = "SELECT title, date_posted, text, id
387 FROM notes WHERE url = ?";
388 $result = $this->query($sql, "s",
389 $_GET['note']);
390 if ($result) {
391 $entry = $result[0];
392 $this->id = $entry["id"];
393 $this->title = $entry["title"];
394 $date_posted = explode("-", $entry["date_posted"]);
395 $this->year_posted = $date_posted[0];
396 $this->month_posted = $date_posted[1];
397 $datetime_posted = explode(' ', $date_posted[2]);
398 $this->day_posted = $datetime_posted[0];
399 $this->text = $entry["text"];
400 } else {
401 throw new notFound();
402 }
403 $sql = "SELECT COUNT(*) FROM comments
404 WHERE note = $this->id";
405 $result = $this->db->query($sql);
406 $result = $result->fetch_array();
407 $this->number_of_comments = $result[0];
408 if (isset($_GET['verify'])) {
409 $this->verify();
410 }
411 }
412
413 public function display() {
414 $this->display_head();
415 $this->display_note();
416 if ($this->comments_enabled) {
417 $this->display_comments();
418 $this->display_comment_form();
419 }
420 $this->write_navigation();
421 $this->display_close();
422 }
423
424 private function verify() {
425 if (!isset($_POST['captcha'])) {
426 require_once('includes/recaptchalib.php');
427 echo "<br>";
428 $resp = recaptcha_check_answer ($this->recaptcha_privatekey,
429 $_SERVER["REMOTE_ADDR"],
430 $_POST["recaptcha_challenge_field"],
431 $_POST["recaptcha_response_field"]);
432 if (!$resp->is_valid) {
433 $this->failed_captcha = true;
434 }
435 }
436 if (isset($_POST['captcha']) || $resp->is_valid) {
437 $sql = ("INSERT INTO comments (date_posted, author,
438 text, note)
439 VALUES(NOW(), ?, ?, ?)");
440 $stmt = $this->db->prepare($sql);
441 // Checks are needed here (no blank text,
442 // and a default author needs to be set
443 // for no-javascript users.
444 $stmt->bind_param('sss',
445 $_POST['name'],
446 $_POST['text'],
447 $this->id);
448 $stmt->execute();
449 }
450 }
451
452 private function display_note() {
453 echo <<<END_OF_NOTE
454 <div id='note'>
455 <h1><span class='date'>$this->year_posted/$this->month_posted/$this->day_posted/</span>$this->title</h1>
456 $this->text
457 </div>
458 END_OF_NOTE;
459 }
460
461 private function write_navigation() {
462 echo <<<END_OF_NAVIGATION
463 <br><br><br><br>
464 <div id='navigation'>
465 <h1>
466 END_OF_NAVIGATION;
467 if (!$this->comments_enabled) {
468 $this->display_comment_link();
469 }
470 echo <<<END_OF_NAVIGATION
471 <a href="/notes/">back to notes/</a>
472 </h1>
473 </div>
474 END_OF_NAVIGATION;
475 }
476
477 private function display_comment_link() {
478 if ($this->number_of_comments > 0) {
479 $anchor_text = "comments($this->number_of_comments)/";
480 } else {
481 $anchor_text = "comment?";
482 }
483 if (substr($this->url, (strlen($this->url)-1), strlen($this->url)) == '/') {
484 $url = $this->url . 'comments/';
485 } else {
486 $url = $this->url . '/comments/';
487 }
488 echo "<a id='comment_link' href='$url'>$anchor_text</a>";
489 }
490
491 private function display_comments() {
492 echo "<div id='comments'>";
493 $sql= "SELECT date_posted, author, text
494 FROM comments WHERE note = ?
495 ORDER BY date_posted DESC";
496 $result = $this->query($sql, 'd', $this->id);
497 foreach ($result as $row => $entry) {
498 $date_posted = $entry['date_posted'];
499 $author = $entry['author'];
500 $text = htmlspecialchars($entry['text']);
501 $head = "<h3>" . htmlspecialchars($author) . "</h3>";
502 echo <<<END_OF_COMMENT
503 <div class='comment'>
504 $head
505 $text
506 </div>
507 END_OF_COMMENT;
508 }
509 echo "</div>";
510 }
511
512 private function display_comment_form() {
513 $publickey = $this->recaptcha_publickey;
514 echo <<<END_CAPTCHA_STYLE
515 <script type="text/javascript">
516 Recaptcha.create("$publickey",
517 "recaptcha_div",
518 {
519 theme : 'custom',
520 custom_theme_widget: 'recaptcha_widget',
521 callback: Recaptcha.focus_response_field
522 });
523 </script>
524 END_CAPTCHA_STYLE;
525 require_once('includes/recaptchalib.php');
526 $url = $this->url . "verify";
527 echo "<form id='comment_form' method='post' action='$url'>";
528 echo <<<END_OF_FORM
529 <div id="comment">
530 <h3>comment:</h3>
531 <textarea rows="10" cols="70" name="text" id="comment_text"></textarea>
532 <h3>name:</h3>
533 <input type=text name="name" id="comment_name">
534
535 <nowiki>
536 <div id="recaptcha_widget">
537 <br>
538 <h3><b>what's this say</b>?</h3>
539 <br>
540 <div id="recaptcha_image"></div>
541 <br><br><br>
542 <span class="recaptcha_only_if_image"><br><br><br></span>
543 <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
544 <br><br>
545 <h3 class="recaptcha_only_if_audio"><b>enter the numbers you hear</b>:</h3>
546 <span class="recaptcha_help">
547 <a href="javascript:Recaptcha.reload()">another?</a> /
548 <span class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">audio?</a> /</span>
549 <span class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">image?</a></span><a href="javascript:Recaptcha.showhelp()">help?</a>
550 </span>
551 </div>
552 END_OF_FORM;
553 echo recaptcha_get_html($this->recaptcha_publickey);
554 if ($this->failed_captcha) {
555 echo <<<END_OF_ERRORS
556 <div id="not_human">
557 reCAPTCHA said you're not human, <br>
558 try again?
559 </div>
560 <input id="submit" class="submit" type="submit" value="post comment">
561 </form>
562 </div>
563 END_OF_ERRORS;
564 } else {
565 echo <<<END_OF_ERRORS
566 <div id="not_human">
567 reCAPTCHA said you're not human, <br>
568 try again?
569 </div>
570 <div id="blank_comment">
571 but you didn't write anything! <br>
572 </div>
573 END_OF_ERRORS;
574 }
575 echo <<<END_OF_FORM
576 <input id="submit" class="submit" type="submit" value="post comment">
577 </form>
578 </div>
579 END_OF_FORM;
580 }
581 }
582
583
584 class archive extends cms {
585
586 public function __construct() {
587 parent::__construct();
588 }
589
590 private function check_exists() {
591 $sql = "SELECT COUNT(*) FROM notes
592 WHERE url = ?";
593 $results = $this->query($sql, "s", $_GET['note']);
594 if ($results[0]["COUNT(*)"] != 1) {
595 $this->not_found();
596 }
597 }
598
599 public function display() {
600 $this->display_head();
601 switch (true) {
602 case (isset($_GET['year']) && !isset($_GET['month'])
603 && !isset($_GET['day'])):
604 $sql = "SELECT title, url, date_posted, text
605 FROM notes WHERE YEAR(date_posted) = ?
606 ORDER BY date_posted DESC";
607 $result = $this->query($sql, "d",
608 $_GET['year']);
609 break;
610 case (isset($_GET['year']) && isset($_GET['month'])
611 && !isset($_GET['day'])):
612 $sql = "SELECT title, url, date_posted, text
613 FROM notes WHERE YEAR(date_posted) = ?
614 AND MONTH(date_posted) = ?
615 ORDER BY date_posted DESC";
616 $result = $this->query($sql, "dd",
617 $_GET['year'], $_GET['month']);
618 break;
619 case (isset($_GET['year']) && isset($_GET['month'])
620 && isset($_GET['day'])):
621 $sql = "SELECT title, url, date_posted, text
622 FROM notes WHERE YEAR(date_posted) = ?
623 AND MONTH(date_posted) = ?
624 AND DAY(date_posted) = ?
625 ORDER BY date_posted DESC";
626 $result = $this->query($sql, "ddd",
627 $_GET['year'], $_GET['month'],
628 $_GET['day']);
629 break;
630 }
631 if (count($result) >= 1) {
632 echo "<div id='notes'>";
633 foreach ($result as $row => $entry) {
634 $title = $entry['title'];
635 $url = '/note/' . $entry['url'];
636 $date_posted = explode("-", $entry['date_posted']);
637 $year_posted = $date_posted[0];
638 $month_posted = $date_posted[1];
639 $datetime_posted = explode(' ', $date_posted[2]);
640 $day_posted = $datetime_posted[0];
641 echo "<div class='note'>";
642 echo "<h1><span class='date'>";
643 echo "$year_posted/$month_posted/$day_posted/";
644 echo "</span><a href='$url'>$title</a></h1>";
645 echo $entry['text'];
646 echo "</div>";
647 }
648 echo "</div>";
649 $this->write_navigation();
650 } else {
651 echo "<br>";
652 echo "<h1>sorry, nothing here</h2>";
653 echo "<pre>Empty set (0.00 sec)</pre>";
654 }
655 $this->display_close();
656 }
657
658 private function write_navigation() {
659 echo "<br>";
660 echo "<div id='navigation'>";
661 // fill me in!
662 echo "</div>";
663 }
664
665 }
666
667
668 class rss extends cms {
669 public function display() {
670 $result = $this->db->query("SELECT date_posted, title, text, url
671 FROM notes ORDER BY date_posted DESC
672 LIMIT 5");
673 echo <<<END_OF_ENTRY
674 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
675 <channel>
676 <title>dylanstestserver.com/notes/rss</title>
677 <link>http://dylanstestserver.com/notes</link>
678 <description>dylanstestserver.com/notes/rss</description>
679 <atom:link href="http://dylanstestserver.com/notes/rss" rel="self" type="application/rss+xml" />
680 END_OF_ENTRY;
681 while ($entry = $result->fetch_object()) {
682 $title = $entry->title;
683 $date_posted = $entry->date_posted;
684 $url = "http://dylanstestserver.com/note/" . $entry->url;
685 $text = $entry->text;
686 $text = strip_tags($text);
687 $end_of_first_sentence = strpos($text, '.');
688 if ($end_of_first_sentence) {
689 $end_of_second_sentence = strpos($text, '.', ($end_of_first_sentence + 1));
690 if ($end_of_second_sentence) {
691 $description = substr($text, '0', ($end_of_second_sentence + 1));
692 } else {
693 $description = substr($text, '0', ($end_of_first_sentence + 1));
694 }
695 }
696 echo <<<END_OF_ENTRY
697 <item>
698 <title>$title</title>
699 <link>$url</link>
700 <guid>$url</guid>
701 <description>$description</description>
702 </item>
703 END_OF_ENTRY;
704 }
705 echo "</channel>";
706 echo "</rss>";
707
708 }
709 }
710
711
712 class notFound extends Exception {
713
714 public function __construct() {
715 header('HTTP/1.0 404 Not Found');
716 ob_end_clean();
717 include('404.php');
718 exit();
719 }
720
721 }
722
723
724 class captcha extends cms {
725
726 public function display() {
727 $challenge = $_GET['challenge'];
728 $response = $_GET['response'];
729 $remoteip = $_SERVER['REMOTE_ADDR'];
730 $curl = curl_init('http://api-verify.recaptcha.net/verify?');
731 curl_setopt ($curl, CURLOPT_POST, 4);
732 curl_setopt ($curl, CURLOPT_POSTFIELDS, "privatekey=$this->recaptcha_privatekey&remoteip=$remoteip&challenge=$challenge&response=$response");
733 $result = curl_exec ($curl);
734 curl_close ($curl);
735 }
736
737 }
738
739
740 ## now actually do something:
741 switch (cms::determine_type()) {
742 case 'index':
743 $index = new index();
744 $index->display();
745 break;
746 case 'project':
747 $project = new project();
748 $project->display();
749 break;
750 case 'note':
751 $note = new note;
752 $note->display();
753 break;
754 case 'page':
755 $page = new page;
756 $page->display();
757 break;
758 case "rss":
759 $rss = new rss();
760 $rss->display();
761 case 'archive':
762 $archive = new archive;
763 $archive->display();
764 break;
765 case "captcha":
766 $captcha = new captcha;
767 $captcha->display();
768 break;
769 }
770
771 ?>