summaryrefslogtreecommitdiffstats
path: root/pages/Privileges.c.xml
blob: 7374abb1be7a4d589398360aa99773df786b9b4d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?xml version="1.0" encoding="UTF-8" ?>
<page>
  <info>
    <name>Privileges</name>
    <template>phpexec</template>
    <access>00</access>
    <type>c</type>
  </info>
  <data>
    <code>
      <![CDATA[
<?PHP
  require_once('code/db.inc.php');
  require_once('code/links.inc.php');
  require_once('code/pages.inc.php');
  
  $title = 'Rechte';
  
  echo '<h2>Rechte</h2>';
  
  $type = $_GET['type'];
  if($type != 'c' && $type != 'n' && $type != 'e') $type = 'c';
  
  echo 'Seitentyp: ';
  echo '<a href="' . $GLOBALS['links']->GetNeonLink('Privileges', 'type=c') . '"';
  if($type == 'c') echo ' class="active_page_link"';
  echo '>Inhalt</a> | ';
  echo '<a href="' . $GLOBALS['links']->GetNeonLink('Privileges', 'type=n') . '"';
  if($type == 'n') echo ' class="active_page_link"';
  echo '>Navigation</a> | ';
  echo '<a href="' . $GLOBALS['links']->GetNeonLink('Privileges', 'type=e') . '"';
  if($type == 'e') echo ' class="active_page_link"';
  echo '>Editor</a><br /><br />';
  
  echo '<form action="' . $GLOBALS['links']->GetNeonLink('Privileges:Update') . '" method="post">';
  
  echo '<input type="hidden" name="type" value="' . $type . '" />';
  
  echo '<table class="privtab">';
  
  $groupres = $GLOBALS['db']->Execute('SELECT * FROM groups ORDER BY id');
  $pages = $GLOBALS['pages']->GetList();
  
  $groups = $groupres->GetArray();
  array_unshift($groups, array(0, 'Gast'));
  
  echo '<tr class="group">';
  
  echo '<td></td>';
  
  foreach($groups as $group) {
    echo '<td>' . $group[1] . '</td>';
  }
  
  echo '</tr>';
  
  $linex = true;
  
  foreach($pages as $page) {
    if($page[strlen($page)-1] != $type) continue;
    
    $pagedata = $GLOBALS['pages']->GetPageData(substr($page, 0, -2), $type);
    
    echo '<tr class="line' . ($linex ? '1' : '2') . '">';
    $linex = !$linex;
    
    echo '<td class="page">' . $pagedata['name'] . '</td>';
    
    foreach($groups as $group) {
      echo '<td><input type="checkbox" name="' . $pagedata['name'] . ':' . $group[0] . '" value="true" ';
      if((hexdec(substr($pagedata['access'], ($group[0]/8)*2, 2)) & (1 << ($group[0]%8))) != 0) echo 'checked="checked" ';
      echo '/></td>';
    }
    
    echo '</tr>';
  }
  
  echo '<tr><td colspan="' . (count($groups)+1) . '" class="submit">';
  echo '<input type="submit" value="Ändern" class="spaced-top" />';
  echo '</td></tr>';
  
  echo '</table>';
  
  echo '</form>';
?>
      ]]>
    </code>
  </data>
</page>