summaryrefslogtreecommitdiffstats
path: root/templates/phpexec.inc.php
blob: 52164a1eeb6a9444537fce802087055a06c7198d (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
<?PHP
  Uses('links');
  
  class phpexec_template {
    function GetTitle($data) {
      return strtr($data['_page'], array(':' => ' - '));
      
      //ob_start();
      
      //$content = ob_get_contents();
      //ob_end_clean();
    }
    
    function GetPage($data) {
      $title = strtr($data['_page'], array(':' => ' - '));
      
      ob_start();
      
      eval('?>' . $data['code']);
      
      $content = ob_get_contents();
      ob_end_clean();
      
      return array('title' => $title, 'content' => $content);
    }
    
    function GetEditor($data) {
      $title = '{{Edit \'' . $data['_page'] . '\'}}';
      
      $content = '<h2>' . $title . '</h2>';
      $content .= '<form method="post" action="' . $GLOBALS['links']->GetNeonLink('Pages:Edit') . '">';
      $content .= '<input type="hidden" name="name" value="' . $data['_page'] . '" />';
      $content .= '<input type="hidden" name="backlink" value="' . htmlspecialchars($data['_backlink']) . '" />';
      $content .= '<textarea name="data_code" class="pageedit spaced-bottom" rows="25" cols="70">';
      $content .= htmlspecialchars($data['code']) . '</textarea><br />';
      $content .= '<input type="submit" value="Änderungen übernehmen" />';
      $content .= '<input type="submit" name="back" value="Zurück" />';
      $content .= '</form>';
      
      return array('title' => $title, 'content' => $content);
    }
  }
  
  $GLOBALS['templates']['phpexec'] = new phpexec_template;
?>