Automatically calculate the filesystem path of the application and use
[misc/kostenrechnung] / ajax / ajax.php
index 72f226e..57f35a3 100644 (file)
@@ -13,8 +13,10 @@ function fetch($mask)
 
   $row = pg_fetch_assoc($sth);
 
-  foreach ($mask['edit']['list'] as $field => $info)
-    if (array_key_exists('format', $info))
+  foreach ($mask['edit'] as $field => $info)
+    if ($info['type'] == 'boolean')
+      $row[$field] = $row[$field]?true:false;
+    elseif (array_key_exists('format', $info))
       $row[$field] = sprintf($info['format'], $row[$field]);
 
   return $row;
@@ -54,11 +56,11 @@ function format_ajax($data)
 if (empty($_POST['func']))
   exit;
 
-if (empty($_POST['mask']))
+if (empty($_POST['source']))
   exit;
 
 connect_db();
-if (load_mask($_POST['mask'], '../') === false) exit;
+if (load_mask($_POST['source']) === false) exit;
 
 $data = array('error' => 'Unknown function');