summaryrefslogtreecommitdiff
path: root/tpl/general
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/general')
-rw-r--r--tpl/general/bottom.php4
-rw-r--r--tpl/general/choice.php6
-rw-r--r--tpl/general/empty.php3
-rw-r--r--tpl/general/form.php6
-rw-r--r--tpl/general/inc_form.php26
-rw-r--r--tpl/general/inc_tree.php18
-rw-r--r--tpl/general/sqlerror.php13
-rw-r--r--tpl/general/top.php43
8 files changed, 119 insertions, 0 deletions
diff --git a/tpl/general/bottom.php b/tpl/general/bottom.php
new file mode 100644
index 0000000..b506bf0
--- /dev/null
+++ b/tpl/general/bottom.php
@@ -0,0 +1,4 @@
+ </div>
+ </body>
+</html>
+<?php die(); ?>
diff --git a/tpl/general/choice.php b/tpl/general/choice.php
new file mode 100644
index 0000000..3d54dce
--- /dev/null
+++ b/tpl/general/choice.php
@@ -0,0 +1,6 @@
+<?php
+require("top.php");
+foreach ($choice as $c => $u) {
+ echo '<button onclick="window.location=\'' . $u . '\'">' . $c . '</button>';
+}
+require("bottom.php");
diff --git a/tpl/general/empty.php b/tpl/general/empty.php
new file mode 100644
index 0000000..48b662b
--- /dev/null
+++ b/tpl/general/empty.php
@@ -0,0 +1,3 @@
+<?php
+require("top.php");
+require("bottom.php");
diff --git a/tpl/general/form.php b/tpl/general/form.php
new file mode 100644
index 0000000..1d21b8c
--- /dev/null
+++ b/tpl/general/form.php
@@ -0,0 +1,6 @@
+<?php
+require("top.php");
+
+require("inc_form.php");
+
+require("bottom.php");
diff --git a/tpl/general/inc_form.php b/tpl/general/inc_form.php
new file mode 100644
index 0000000..8cd2ad5
--- /dev/null
+++ b/tpl/general/inc_form.php
@@ -0,0 +1,26 @@
+<?php
+
+
+if (!isset($method)) $method = "POST";
+if (!isset($validate)) $validate = "Post";
+if (!isset($action)) $action = "index.php?p=$url";
+
+echo '<form method="' . $method . '" action="' . $action . '"' .
+ (isset($need_file) ? ' enctype="multipart/form-data"' : '') . '>';
+if (isset($form_message)) echo '<strong>' . $form_message . "</strong><br /><br />\n";
+
+foreach($fields as $f) {
+ if (isset($f['type']) && $f['type'] == 'textarea') {
+ echo '<label>' . $f['label'] . '</label><br />';
+ echo '<textarea name="' . $f['name'] . '">' . $f['value'] . '</textarea><br />';
+ } else {
+?>
+<label for="ff_<?php echo $f['name']; ?>"><?php echo $f['label']; ?></label>
+<input type="<?php echo (isset($f['type']) ? $f['type'] : 'text'); ?>" name="<?php echo $f['name']; ?>" <?php
+if (isset($f['value'])) echo ' value="' . $f['value'] . '"' ;
+if (isset($f['checked']) && $f['checked'] == true) echo ' checked="checked"';
+?> id="ff_<?php echo $f['name']; ?>"/><br /><?php
+ }
+}
+
+echo '<div class="empty_label">&nbsp;</div><input type="submit" value="' . $validate . '" /></form>';
diff --git a/tpl/general/inc_tree.php b/tpl/general/inc_tree.php
new file mode 100644
index 0000000..9b13d5a
--- /dev/null
+++ b/tpl/general/inc_tree.php
@@ -0,0 +1,18 @@
+<?php
+function tree_branch($tree, $id, $func) {
+ if (!isset($tree[$id])) return;
+ foreach($tree[$id] as $branch) {
+ echo '<p>'.$func($branch).'</p>';
+ if (isset($tree[$branch['id']])) {
+ echo '<div class="tree_branch">';
+ tree_branch($tree, $branch['id'], $func);
+ echo '</div>';
+ }
+ }
+}
+
+function tree($tree, $func) {
+ echo '<div class="tree_root">';
+ tree_branch($tree, 0, $func);
+ echo '</div>';
+}
diff --git a/tpl/general/sqlerror.php b/tpl/general/sqlerror.php
new file mode 100644
index 0000000..59f0806
--- /dev/null
+++ b/tpl/general/sqlerror.php
@@ -0,0 +1,13 @@
+<?php
+global $sql_min_priv_for_debug;
+require("top.php");
+
+if ($user['priv'] >= $sql_min_priv_for_debug) {
+ echo '<div class="error">An error happenned with the following SQL query :<br />';
+ echo '<code>' . $request . '</code><br />';
+ echo 'Mysql answered : ' . $sql_error . '</div>';
+} else {
+ echo '<div class="error">An internal error occurred, sorry.</div>';
+}
+
+require("bottom.php");
diff --git a/tpl/general/top.php b/tpl/general/top.php
new file mode 100644
index 0000000..e87e466
--- /dev/null
+++ b/tpl/general/top.php
@@ -0,0 +1,43 @@
+<?php
+global $user, $apps; //These might be hidden because this page is called from sql();
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title><?php echo $title; ?></title>
+ <link href="design/style.css" rel="stylesheet" type="text/css" media="screen" />
+ </head>
+
+ <body>
+ <div class="menu">
+ <div class="right">
+ <?php
+if ($user['id'] == 0) {
+ echo '<a href="new-account">Register</a><a href="?login">Login</a>';
+} else {
+ echo '<a href="user-notes-' . $user['id'] . '">My notebook</a><a href="?logout">Logout (' . $user['name'] . ')</a>';
+}
+?>
+ </div>
+ <div class="left">
+ <a href="notes">Notebooks</a>
+ <?php
+if ($user['id'] != 0) {
+ echo '<a href="image">Uploaded images</a>';
+} elseif ($user['priv'] >= $apps['image']['upload']) {
+ echo '<a href="upload-image">Upload image</a>';
+}
+?>
+ </div>
+ <div style="clear: both;"></div>
+ </div>
+
+ <div class="contents-right">
+
+ <h1><?php echo $title; ?></h1>
+
+<?php
+if (isset($message)) echo '<div class="message">' . $message . "</div>\n";
+if (isset($error)) echo '<div class="error">' . $error . "</div>\n";
+