Copy name and city into page keywords
[infodrom.org/www.zeitungsliste.de] / lib / ajax.inc
1 <?php
2
3 $functions = array('search_check' => array('lib' => 'search.inc',
4                                            'func' => 'ajax_search_check'),
5                    'passwd_check' => array('lib' => 'login.inc',
6                                            'func' => 'ajax_passwd_check'),
7                    'nickname_check' => array('lib' => 'login.inc',
8                                              'func' => 'ajax_nickname_check'),
9                    'tag_add' => array('lib' => 'tags.inc',
10                                       'func' => 'ajax_tag_add'),
11                    'tag_del' => array('lib' => 'tags.inc',
12                                       'func' => 'ajax_tag_del'),
13                    'tag_new' => array('lib' => 'tags.inc',
14                                       'func' => 'ajax_tag_new'),
15                    'tag_exists' => array('lib' => 'tags.inc',
16                                          'func' => 'ajax_tag_exists'),
17                    'bookmark_up' => array('lib' => 'bookmarks.inc',
18                                           'func' => 'ajax_bookmark_up'),
19                    'bookmark_down' => array('lib' => 'bookmarks.inc',
20                                             'func' => 'ajax_bookmark_down'),
21                    'bookmark_del' => array('lib' => 'bookmarks.inc',
22                                            'func' => 'ajax_bookmark_del'),
23                    'bookmark_add' => array('lib' => 'bookmarks.inc',
24                                            'func' => 'ajax_bookmark_add'),
25                    'check_url' => array('lib' => 'functions.inc',
26                                         'func' => 'ajax_check_url'),
27                    'check_email' => array('lib' => 'misc.inc',
28                                           'func' => 'ajax_check_email'),
29                    );
30
31 function dumpinfo()
32 {
33   global $_SERVER;
34   global $_POST;
35   global $_GET;
36
37   $info = "\$_SERVER = " . var_export($_SERVER, true);
38   $info .= "\n\$_POST = " . var_export($_POST, true);
39   $info .= "\n\$_GET = " . var_export($_GET, true);
40
41   $f = fopen("/tmp/zlist.dump", "w");
42   fwrite($f, $info);
43   fclose($f);
44 }
45
46 function ajax_process()
47 {
48   global $functions;
49   global $_POST;
50
51   dumpinfo();
52
53   if (strlen($_POST['function']) && array_key_exists($_POST['function'], $functions)) {
54       if (array_key_exists('lib', $functions[$_POST['function']]))
55         include_once($functions[$_POST['function']]['lib']);
56       if (array_key_exists('func', $functions[$_POST['function']])) {
57         if (function_exists($functions[$_POST['function']]['func']))
58           return $functions[$_POST['function']]['func']();
59         else
60           return false;
61       }
62   }
63
64   return false;
65 }
66
67 ?>