diff options
Diffstat (limited to 'pages/Pages:Handle.xml')
-rw-r--r-- | pages/Pages:Handle.xml | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/pages/Pages:Handle.xml b/pages/Pages:Handle.xml new file mode 100644 index 0000000..85deebc --- /dev/null +++ b/pages/Pages:Handle.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<page> + <info> + <name>Pages:Handle</name> + <template>phpexec</template> + <access>0:0</access> + </info> + <data> + <code> + <![CDATA[ +<?PHP + Uses('pages', 'links', 'templates'); + + + if(isset($_POST['view'])) { + if($_POST['name']) { + header('Location: ' . $GLOBALS['links']->GetNeonLink(Unquote($_POST['name']), null, false)); + exit(); + } + } + elseif(isset($_POST['new'])) { + $title = '{{New page}}'; + ?> + <h2>{{New page}}</h2> + + <form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:New'); ?>"> + {{Name}}: <input type="text" id="pagename" name="name" size="70" /><br /> + {{Template}}: <select type="text" class="spaced-top" name="template" size="1" /> + <?PHP + foreach(array_keys($GLOBALS['templates']) as $key) + echo '<option>' . $key . '</option>'; + ?> + </select><br /> + <input type="submit" class="spaced-top" value="{{New}}" /> + <input type="submit" class="spaced-top" name="back" value="{{Back}}" /> + </form> + <?PHP + } + elseif(isset($_POST['edit'])) { + if($_POST['name']) { + $data = $GLOBALS['pages']->GetEditor(Unquote($_POST['name']), $GLOBALS['links']->GetNeonLink('Pages', null, false)); + + $title = $data['title']; + + echo $data['content']; + } + } + elseif(isset($_POST['privs'])) { + if($_POST['name']) { + $name = htmlspecialchars(Unquote($_POST['name'])); + + $title = '{{Change access to \'' . $name . '\'}}'; + + echo '<h2>{{Change access to \'' . $name . '\'}}</h2>'; + + $access = $GLOBALS['pages']->GetAccess(Unquote($_POST['name'])); + $groups = $GLOBALS['user']->ListGroups(); + + array_unshift($groups, array(0, '{{Guest}}')); + + echo '<form action="' . $GLOBALS['links']->GetNeonLink('Pages:Privs') . '" method="post">'; + + echo '<input type="hidden" name="name" value="' . $name . '" />'; + + echo '<table>'; + + foreach($groups as $group) { + echo '<tr><td>' . htmlspecialchars($group[1]) . '</td><td>'; + + echo '<select size="1" name="group_' . $group[0] . '">'; + + echo '<option value="0"'; + if((hexdec($access[0][$group[0]/4]) & (1 << ($group[0]%4))) == 0) echo ' selected="selected"'; + echo '>{{No access}}</option>'; + + echo '<option value="1"'; + if(((hexdec($access[0][$group[0]/4]) & (1 << ($group[0]%4))) != 0) + && ((hexdec($access[1][$group[0]/4]) & (1 << ($group[0]%4))) == 0)) + echo ' selected="selected"'; + echo '>{{Read only}}</option>'; + + echo '<option value="2"'; + if((hexdec($access[1][$group[0]/4]) & (1 << ($group[0]%4))) != 0) echo ' selected="selected"'; + echo '>{{Read and write}}</option>'; + + echo '</select></td></tr>'; + } + + echo '</table>'; + + echo '<input type="submit" class="spaced-top" value="{{Change}}" /> '; + echo '<input type="submit" class="spaced-top" name="back" value="{{Back}}" />'; + + echo '</form>'; + } + } + elseif(isset($_POST['copy'])) { + if($_POST['name']) { + $name = htmlspecialchars(Unquote($_POST['name'])); + + $title = '{{Copy \'' . $name . '\'}}'; + + echo '<h2>{{Copy \'' . $name . '\'}}</h2>'; + + echo '<form method="post" action="' . $GLOBALS['links']->GetNeonLink('Pages:Copy') . '">'; + echo '<input type="hidden" name="name" value="' . $name . '" />'; + echo '{{New name}}: <input type="text" name="newname" value="' . $name . '" size="70" /><br />'; + echo '<input type="submit" class="spaced-top" value="{{Copy}}" /> '; + echo '<input type="submit" class="spaced-top" name="back" value="{{Back}}" />'; + echo '</form>'; + } + } + elseif(isset($_POST['rename'])) { + if($_POST['name']) { + $name = htmlspecialchars(Unquote($_POST['name'])); + + $title = '{{Rename \'' . $name . '\'}}'; + + echo '<h2>{{Rename \'' . $name . '\'}}</h2>'; + + echo '<form method="post" action="' . $GLOBALS['links']->GetNeonLink('Pages:Rename') . '">'; + echo '<input type="hidden" name="name" value="' . $name . '" />'; + echo '{{New name}}: <input type="text" name="newname" value="' . $name . '" size="70" /><br />'; + echo '<input type="submit" class="spaced-top" value="{{Rename}}" /> '; + echo '<input type="submit" class="spaced-top" name="back" value="{{Back}}" />'; + echo '</form>'; + } + } + elseif(isset($_POST['delete'])) { + if($_POST['name']) { + $name = htmlspecialchars(Unquote($_POST['name'])); + + $title = '{{Delete \'' . $name . '\'}}'; + + echo '<h2>{{Delete \'' . $name . '\'}}</h2>'; + + echo '<form method="post" action="' . $GLOBALS['links']->GetNeonLink('Pages:Delete') . '">'; + echo '<input type="hidden" name="name" value="' . $name . '" />'; + echo '{{Do you really want to delete the page \'' . $name . '\'?}}<br />'; + echo '<input type="submit" class="spaced-top" value="{{Delete}}" /> '; + echo '<input type="submit" class="spaced-top" name="back" value="{{Back}}" />'; + echo '</form>'; + } + } +?> + ]]> + </code> + </data> +</page> |