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 Glossary
7   */
8if (!defined ('DOKU_INC'))
9  define ('DOKU_INC', realpath (dirname (__FILE__).'/../../../').'/');
10require_once (DOKU_INC.'inc/init.php');
11require_once (DOKU_INC.'inc/common.php');
12require_once (DOKU_INC.'inc/auth.php');
13if (isset ($_SERVER['REMOTE_USER']))
14  $INFO['userinfo'] = $auth->getUserData ($auth->cleanUser ($_SERVER['REMOTE_USER']));
15{
16  $glossaryPlugin =& plugin_load ('syntax', 'glossary_div');
17  $glossary = new glossary ($glossaryPlugin, $_REQUEST ['glossary']['ns']);
18
19  $cacheCmd = true;
20  switch ($_REQUEST ['glossary']['action']) {
21  case 'clear':
22    $glossary->clearCache (md5 ($_REQUEST ['glossary']['ns']));
23    break;
24  case 'clearAll':
25    $glossary->clearCache (null);
26    break;
27  default:
28    $cacheCmd = false;
29  }
30  if (!$cacheCmd) {
31    ob_start ();
32    switch ($_REQUEST ['glossary']['operation']) {
33    case 'poll':
34      $glossary->poll ();
35      break;
36    case 'record':
37      $glossary->printProposal ();
38      break;
39    case $glossary->prop.'remove':
40      $glossary->adminProposal ();
41      break;
42    case $glossary->def.'remove':
43    case $glossary->def.'update':
44      $glossary->adminDefinition ();
45    case 'glos-remove':
46      $glossary->adminGlossaries ();
47      break;
48    }
49    $text = ob_get_contents ();
50    ob_end_clean ();
51    foreach ($glossary->message as $type => $msg)
52      $text = '<div class="'.$type.'">'.$msg.'</div>'.$text;
53    ptln ($text);
54  }
55}
56?>
57