diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-05-08 22:16:04 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-05-08 22:16:04 -0400 |
commit | f0a30cc89ddf82e3c774800d24f0ea3664065d9c (patch) | |
tree | 13053422786e83ab57a55e63879e5ceb07d9ecfd /common.php | |
parent | 2df28057cdd5c54fb4f754f5c2222154efe2ad5b (diff) |
read-only stuff
darcs-hash:20080509021604-84dde-f785fc09dd435fc12741b3a75184e2425721d03d.gz
Diffstat (limited to 'common.php')
-rw-r--r-- | common.php | 46 |
1 files changed, 46 insertions, 0 deletions
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 "</$tag>"; +} + +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 } |