New index with basic functions
authorJoey Schulze <joey@infodrom.org>
Wed, 20 Jan 2010 10:06:59 +0000 (11:06 +0100)
committerJoey Schulze <joey@infodrom.org>
Wed, 20 Jan 2010 10:06:59 +0000 (11:06 +0100)
ajax/ajax.php [new file with mode: 0644]
index.php [new file with mode: 0644]

diff --git a/ajax/ajax.php b/ajax/ajax.php
new file mode 100644 (file)
index 0000000..2256e9d
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+require_once('../config.php');
+require_once('../lib/general.php');
+
+
+function fetch($mask)
+{
+  $sql = sprintf('SELECT id,%s FROM %s WHERE id = %d',
+                implode(',', array_keys($mask['edit'])),
+                $mask['table'], $_POST['id']);
+  error_log($sql);
+  $sth = pg_query($sql);
+}
+
+function format_ajax($data)
+{
+  header('Content-type: application/json; charset=UTF-8');
+  echo json_encode($data);
+  exit;
+}
+
+if (empty($_POST['func']))
+  exit;
+
+if (empty($_POST['mask']))
+  exit;
+
+connect_db();
+if (load_mask($_POST['mask'], '../') === false) exit;
+
+if ($_POST['func'] == 'fetch') {
+  format_ajax(fetch($mask));
+} elseif ($_POST['func'] == 'save') {
+  error_log('save');
+}
+
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..819fba0
--- /dev/null
+++ b/index.php
@@ -0,0 +1,23 @@
+<?php
+require_once('config.php');
+require_once('lib/general.php');
+
+$jsfiles = array('lib/json_parse.js');
+$jscode = '';
+$html = process();
+
+$html .= debug_info();
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Kostenleistungsrechnung</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<?=load_js($jsfiles, $jscode);?>
+<link href="stylesheet.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+<?=$html; ?>
+</body>
+</html>