summaryrefslogtreecommitdiff
path: root/public_html
diff options
context:
space:
mode:
Diffstat (limited to 'public_html')
-rw-r--r--public_html/.htaccess11
-rw-r--r--public_html/add_user_test.html5
-rw-r--r--public_html/add_user_test.php44
-rw-r--r--public_html/api/index.php16
4 files changed, 76 insertions, 0 deletions
diff --git a/public_html/.htaccess b/public_html/.htaccess
new file mode 100644
index 0000000..ebc5438
--- /dev/null
+++ b/public_html/.htaccess
@@ -0,0 +1,11 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+
+ RewriteBase /~vanmeeuwen/kolab-wap/public_html
+
+ # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_URI} !=/favicon.ico
+ RewriteRule ^api/([a-z0-9-_]+)/([a-z0-9-_]+)(.*)$ api/index.php?object=$1&action=$2&rest=$3 [L,QSA]
+</IfModule>
diff --git a/public_html/add_user_test.html b/public_html/add_user_test.html
new file mode 100644
index 0000000..8e893ae
--- /dev/null
+++ b/public_html/add_user_test.html
@@ -0,0 +1,5 @@
+<form method="post" action="/~vanmeeuwen/kolab-wap/public_html/api/user/add?user_type_id=1">
+<input name="sn" type="text" value="van Meeuwen" />
+<input name="givenname" type="text" value="Jeroen" />
+<input name="submit" type="submit" value="Add User" />
+</form>
diff --git a/public_html/add_user_test.php b/public_html/add_user_test.php
new file mode 100644
index 0000000..ced1a13
--- /dev/null
+++ b/public_html/add_user_test.php
@@ -0,0 +1,44 @@
+<?php
+ require_once( dirname(__FILE__) . '/../lib/functions.php');
+
+ if (!valid_login())
+ need_login();
+
+ #echo "<pre>"; print_r($_SERVER); echo "</pre>";
+
+ if (array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS'])) {
+ $proto = 'https://';
+ } else {
+ $proto = 'http://';
+ }
+
+ define('API_ROOT', $proto . $_SERVER['HTTP_HOST'] . dirname($_SERVER["REQUEST_URI"]) . "/api/");
+
+ #$user_types = json_decode(base64_decode(implode('',file( API_ROOT . 'user_types/list'))));
+ $user_types = (array)(json_decode(implode('',file( API_ROOT . 'user_types/list'))));
+ #echo "<pre>"; print_r($user_types); echo "</pre>";
+
+ print '<form method="post">';
+ print '<table>';
+ print '<tr><td>User Type:</td><td><select name="user_type_id" onchange="javascript:update_user_type_form_elements(this.value);">';
+ foreach ($user_types as $id => $attrs) {
+ $attrs = (array)($attrs);
+ print '<option value="' . $id . '">' . $attrs['name'] . '</option>';
+ }
+ print '</select></td></tr>';
+ foreach ($user_types as $id => $attrs) {
+ $attrs = (array)($attrs);
+ $attrs['attributes'] = (array)($attrs['attributes']);
+ foreach ($attrs['attributes']['mandatory'] as $attribute_name => $attribute) {
+ if (!is_array($attribute)) {
+ print '<tr><td>' . $attribute . '</td><td><input type="text" name="' . $attribute . '" /></td></tr>';
+ } else {
+ print '<tr><td>' . $attribute_name . '</td><td>' . implode('<br />', $attribute) . '</td></tr>';
+ }
+ }
+ }
+
+ print '<tr><td colspan="2" align="center"><input type="submit" name="submit" value="Whatever is the localized equivalent of \'Add User\'" /></td></tr>';
+ print '</table>';
+ print '</form>';
+?>
diff --git a/public_html/api/index.php b/public_html/api/index.php
new file mode 100644
index 0000000..5146e3d
--- /dev/null
+++ b/public_html/api/index.php
@@ -0,0 +1,16 @@
+<?php
+ require_once( dirname(__FILE__) . "/../../lib/functions.php");
+
+ if (!valid_login()) {
+ need_login();
+ }
+
+ if (!empty($_GET['object']) && !empty($_GET['action'])) {
+ if (function_exists($_GET['object'] . '_' . $_GET['action'])) {
+ call_user_func_array($_GET['object'] . '_' . $_GET['action']);
+ } elseif (file_exists(dirname(__FILE__) . "/../../lib/actions/" . $_GET['object'] . '_' . $_GET['action'] . ".php")) {
+ require_once(dirname(__FILE__) . "/../../lib/actions/" . $_GET['object'] . '_' . $_GET['action'] . ".php");
+ }
+ }
+
+?>