summaryrefslogtreecommitdiffstats
path: root/handlers/default.inc.php
blob: 6a08d77be37bbf7db4c31a05da250f3443d0aa12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?PHP
  include('code/message.inc.php');
  
  class default_handler {
    function Get($data) {
      if($data['title'])
        $title = strtr($data['title'], array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;', '"' => '&quot;'));
      else
        $title = strtr($data['_page'], array(':' => ' - '));
      $content = '<h2>' . $title . '</h2>' . strtr($data['content'], array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;',
                                                                           '"' => '&quot;', "\n" => '<br />', "\r" => ''));
      
      return array('title' => $title, 'content' => $content);
    }
    
    function Add() {
      $title = 'Add page';
      
      $content = '<form method="post" action="' . $GLOBALS['links']->GetNeonLink('Pages:Add') . '">';
      $content .= '<input type="hidden" name="handler" value="' . $_POST['handler'] . '" />';
      $content .= 'Name: ';
      $content .= '<input type="text" name="name" size="70" /><br />';
      $content .= 'Titel: ';
      $content .= '<input type="text" name="title" size="70" /><br />';
      $content .= '<textarea name="content" class="pageedit pageedit_input" rows="25" cols="70">';
      $content .= '</textarea><br />';
      $content .= '<input type="submit" class="submit" value="Hinzufügen" /> ';
      $content .= '<input type="submit" name="back" class="submit" value="Zurück" />';
      $content .= '</form>';
      
      return array('title' => 'Neue Seite', 'content' => $content);
    }
    
    function Edit($data) {
      $title = 'Edit \'' . $data['_page'] . '\'';
      
      $content = '<form method="post" action="' . $GLOBALS['links']->GetNeonLink('Pages:Edit') . '">';
      $content .= '<input type="hidden" name="id" value="' . $_POST['id'] . '" />';
      $content .= 'Titel: ';
      $content .= '<input type="text" name="title" value="';
      $content .= strtr($data['title'], array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;', '"' => '&quot;'));
      $content .= '" size="70" /><br />';
      $content .= '<textarea name="content" class="pageedit pageedit_input" rows="25" cols="70">';
      $content .= strtr($data['content'], array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;', '"' => '&quot;'));
      $content .= '</textarea><br />';
      $content .= '<input type="submit" class="submit" value="Änderungen übernehmen" /> ';
      $content .= '<input type="submit" name="back" class="submit" value="Zurück" />';
      $content .= '</form>';
      
      return array('title' => $title, 'content' => $content);
    }
    
    function ErrorMessage($type, $data = array()) {
      return array('content' => '<span class="error">' . Message($type, $data) . '</span>', 'title' => Message('error'));
    }
  }
  
  $handlers['default'] = new default_handler;
?>