From f0a30cc89ddf82e3c774800d24f0ea3664065d9c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 8 May 2008 22:16:04 -0400 Subject: read-only stuff darcs-hash:20080509021604-84dde-f785fc09dd435fc12741b3a75184e2425721d03d.gz --- common.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'common.php') diff --git a/common.php b/common.php index 499eafe47..a6061920d 100644 --- a/common.php +++ b/common.php @@ -42,3 +42,49 @@ function common_server_error($msg) { print $msg; exit(); } + +function common_user_error($msg) { + common_show_header('Error'); + common_element('div', array('class' => 'error'), $msg); + common_show_footer(); +} + +function common_element_start($tag, $attrs=NULL) { + print "<$tag"; + if (is_array($attrs)) { + foreach ($attrs as $name => $value) { + print " $name='$value'"; + } + } else if (is_string($attrs)) { + print " class='$attrs'"; + } + print '>'; +} + +function common_element_end($tag) { + print ""; +} + +function common_element($tag, $attrs=NULL, $content=NULL) { + common_element_start($tag, $attrs); + if ($content) print $content; + common_element_end($tag); +} + +function common_show_header($pagetitle) { + global $config; + common_element_start('html'); + common_element_start('head'); + common_element('title', NULL, $pagetitle . " - " . $config['site']['name']); + common_element_end('head'); + common_element_start('body'); +} + +function common_show_footer() { + common_element_end('body'); + common_element_end('html'); +} + +// TODO: set up gettext + +function _t($str) { $str } -- cgit v1.2.3-54-g00ecf