summaryrefslogtreecommitdiffstats
path: root/pages/content/Pages:Edit.xml
blob: c8288c92bc0aa4a9ee6cd88b29bbddd754a7dc03 (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
<?xml version="1.0" encoding="UTF-8" ?>
<page>
  <info>
    <name>Pages:Edit</name>
    <template>phpexec</template>
    <access>9:0</access>
    <type>c</type>
  </info>
  <data>
    <code>
      <![CDATA[
<?PHP
  Uses('pages', 'links', 'util');
  
  
  if($_POST['type'] != 'c' && $_POST['type'] != 'n' && $_POST['type'] != 'e' && $_POST['type'] != 'b')
    exit();
  
  if($_POST['back']) {
    header('Location: ' . Unquote($_POST['backlink']));
    exit();
  }
  
  if(!$_POST['name'] || !$_POST['backlink']) exit();
  
  if(!$GLOBALS['pages']->HasWriteAccess(Unquote($_POST['name']), $_POST['type']))
    exit();
  
  $data = array();
  
  foreach($_POST as $key => $val) {
    if(substr($key, 0, 5) != 'data_') continue;
    
    $data[substr($key, 5)] = Unquote($val);
  }
  
  $GLOBALS['pages']->Edit(Unquote($_POST['name']), $_POST['type'], $data);
  
  header('Location: ' . Unquote($_POST['backlink']));
  exit();
?>
      ]]>
    </code>
  </data>
</page>