Browse Source

Use modulekit-ajax

master
parent
commit
14f5a51daf
  1. 3
      .gitmodules
  2. 26
      ajax.php
  3. 1
      lib/modulekit/ajax
  4. 1
      modulekit.php

3
.gitmodules

@ -10,3 +10,6 @@
[submodule "lib/modulekit/form"]
path = lib/modulekit/form
url = https://github.com/plepe/modulekit-form.git
[submodule "lib/modulekit/ajax"]
path = lib/modulekit/ajax
url = https://github.com/plepe/modulekit-ajax.git

26
ajax.php

@ -0,0 +1,26 @@
<?php
/**
* @file ajax.php
* @brief Most ajax-requests call this file, it calls the specified function.
*/
?>
<?php include "conf.php"; /* load a local configuration */ ?>
<?php include "modulekit/loader.php"; /* loads all php-includes */ ?>
<?php
call_hooks("ajax_start");
function error($msg) {
/// Do something with this error
}
Header("Content-Type: application/json; charset=UTF-8");
$postdata = file_get_contents("php://input");
if ($postdata) {
$postdata = json_decode($postdata, true);
}
$fun = "ajax_{$_REQUEST['__func']}";
$return = $fun($_REQUEST["param"], $postdata);
print json_encode($return);

1
lib/modulekit/ajax

@ -0,0 +1 @@
Subproject commit 4dec2cc1d705f45132e2e7322aec657ddb9069af

1
modulekit.php

@ -5,6 +5,7 @@ $depend = array(
'html',
'modulekit-lang',
'modulekit-form',
'modulekit-ajax',
'openstreetbrowser-categories-main',
'openstreetmap-tag-translations',
);

Loading…
Cancel
Save