1<?php
2/**
3 * @license    http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html
4 * @author     Francois Merciol <dokuplugin@merciol.fr>
5 *
6 * Plugin Schedule: manage events per wiki @groups
7
8 */
9
10// faire un XML
11
12if (!defined ('DOKU_INC'))
13    define ('DOKU_INC', realpath (dirname (__FILE__).'/../../../').'/');
14require_once (DOKU_INC.'inc/init.php');
15require_once (DOKU_INC.'inc/common.php');
16require_once (DOKU_INC.'inc/auth.php');
17require_once (realpath (dirname (__FILE__)).'/poiDB.class.php');
18
19// ============================================================
20if (isset ($_SERVER['REMOTE_USER']))
21    $INFO['userinfo'] = $auth->getUserData ($auth->cleanUser ($_SERVER['REMOTE_USER']));
22$schdplug =& plugin_load ('syntax', 'schedule_block');
23$isAdmin =
24         isset ($INFO ['userinfo']) &&
25         isset ($INFO ['userinfo']['grps']) &&
26         in_array (trim ($schdplug->getConf ('adminGroup')), $INFO ['userinfo']['grps']);
27
28$poiDB = new poiDB ($schdplug);
29if ('list' == $_REQUEST ['action'])
30    echo json_encode ($poiDB->getInsee ($_REQUEST['insee']));
31elseif ($isAdmin) {
32    switch ($_REQUEST ['action']) {
33    case 'add':
34        $poiDB->addLine ($_REQUEST ['line']);
35        break;
36    case 'remove':
37        $poiDB->removeLine ($_REQUEST ['line']);
38        break;
39    default:
40        die ('No Ajax Function !');
41    }
42} else
43      die ("No Ajax Function !");
44
45// ============================================================
46