summaryrefslogtreecommitdiff
path: root/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'common.php')
-rw-r--r--common.php46
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 }