summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/login.php25
-rw-r--r--actions/showstream.php6
-rw-r--r--classes/profile.php0
-rw-r--r--classes/remote_profile.php0
-rw-r--r--classes/update.php0
-rw-r--r--classes/user.php0
-rw-r--r--common.php44
-rw-r--r--config.php24
-rw-r--r--index.php19
9 files changed, 118 insertions, 0 deletions
diff --git a/actions/login.php b/actions/login.php
new file mode 100644
index 000000000..a95dc9e3a
--- /dev/null
+++ b/actions/login.php
@@ -0,0 +1,25 @@
+<?php
+
+function handle_login() {
+ if ($_REQUEST['METHOD'] == 'POST') {
+ if (login_check_user($_REQUEST['user'], $_REQUEST['password'])) {
+
+ } else {
+ }
+ } else {
+ if (user_logged_in()) {
+ } else {
+ login_show_form();
+ }
+ }
+}
+
+function login_show_form() {
+ html_start();
+ html_head("Login");
+ html_body();
+}
+
+function login_check_user($username, $password) {
+
+} \ No newline at end of file
diff --git a/actions/showstream.php b/actions/showstream.php
new file mode 100644
index 000000000..2aaaacd0a
--- /dev/null
+++ b/actions/showstream.php
@@ -0,0 +1,6 @@
+<?php
+
+function handle_showstream() {
+ $profile_name = $_REQUEST['profile'];
+}
+
diff --git a/classes/profile.php b/classes/profile.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/classes/profile.php
diff --git a/classes/remote_profile.php b/classes/remote_profile.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/classes/remote_profile.php
diff --git a/classes/update.php b/classes/update.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/classes/update.php
diff --git a/classes/user.php b/classes/user.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/classes/user.php
diff --git a/common.php b/common.php
new file mode 100644
index 000000000..499eafe47
--- /dev/null
+++ b/common.php
@@ -0,0 +1,44 @@
+<?php
+
+# global configuration object
+
+// default configuration, overwritten in config.php
+
+$config =
+ array('site' =>
+ array('name' => 'Just another µB'),
+ 'dsn' =>
+ array('phptype' => 'mysql',
+ 'username' => 'stoica',
+ 'password' => 'apasswd',
+ 'hostspec' => 'localhost',
+ 'database' => 'thedb')
+ 'dboptions' =>
+ array('debug' => 2,
+ 'portability' => DB_PORTABILITY_ALL));
+
+require_once(INSTALLDIR . '/config.php');
+require_once('DB.php');
+
+function common_database() {
+ global $config;
+ $db =& DB::connect($config['dsn'], $config['dboptions']);
+ if (PEAR::isError($db)) {
+ common_server_error($db->getMessage());
+ } else {
+ return $db;
+ }
+}
+
+function common_read_database() {
+ // XXX: read from slave server
+ return common_database();
+}
+
+function common_server_error($msg) {
+ header('Status: 500 Server Error');
+ header('Content-type: text/plain');
+
+ print $msg;
+ exit();
+}
diff --git a/config.php b/config.php
new file mode 100644
index 000000000..c178baf9c
--- /dev/null
+++ b/config.php
@@ -0,0 +1,24 @@
+<?php
+
+$dsn = array(
+ 'phptype' => 'pgsql',
+ 'username' => 'someuser',
+ 'password' => 'apasswd',
+ 'hostspec' => 'localhost',
+ 'database' => 'thedb',
+ );
+
+$options = array(
+ 'debug' => 2,
+ 'portability' => DB_PORTABILITY_ALL,
+ );
+
+$db =& DB::connect($dsn, $options);
+if (PEAR::isError($db)) {
+ die($db->getMessage());
+}
+
+$config['db'] =
+ array( 'username' => 'stoica',
+ 'password' => 'replaceme',
+
diff --git a/index.php b/index.php
new file mode 100644
index 000000000..d63d09edf
--- /dev/null
+++ b/index.php
@@ -0,0 +1,19 @@
+<?php
+
+define('INSTALLDIR', dirname(__FILE__));
+
+require_once(INSTALLDIR . "/common.php");
+
+$action = $_REQUEST['action'];
+$actionfile = INSTALLDIR."/actions/$action.php";
+
+if (file_exists($actionfile)) {
+ require_once($actionfile);
+ $action_function = 'handle_' . $action;
+ if (function_exists($action_function)) {
+ call_user_func($action_function);
+} else {
+ // redirect to main
+}
+
+?> \ No newline at end of file