diff options
author | neoraider <devnull@localhost> | 2006-04-18 02:20:03 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2006-04-18 02:20:03 +0200 |
commit | 531b89f69ab5e72900fbd2484d60491f68e9153b (patch) | |
tree | 397a9203c3cc7c2042b9276f67e89ede68fcd0da | |
parent | e7359ccf2db89b1feec820d1c97583f720ae0d7a (diff) | |
download | neon-531b89f69ab5e72900fbd2484d60491f68e9153b.tar neon-531b89f69ab5e72900fbd2484d60491f68e9153b.zip |
Sofort-Bearbeiten funktioniert jetzt.
-rw-r--r-- | code/pages.inc.php | 5 | ||||
-rw-r--r-- | config/neon.sql | 26 | ||||
-rw-r--r-- | index.php | 12 | ||||
-rw-r--r-- | pages/content/Pages:Edit.xml | 30 | ||||
-rw-r--r-- | pages/content/Pages:Edit:Do.xml | 47 | ||||
-rw-r--r-- | pages/content/Pages:Handle.xml | 12 | ||||
-rw-r--r-- | pages/editor/default.xml | 8 | ||||
-rw-r--r-- | pages/editor/phpexec.xml | 8 |
8 files changed, 111 insertions, 37 deletions
diff --git a/code/pages.inc.php b/code/pages.inc.php index a6d9085..99ac017 100644 --- a/code/pages.inc.php +++ b/code/pages.inc.php @@ -14,6 +14,7 @@ 'Pages:Copy.c' => null, 'Pages:Delete.c' => null, 'Pages:Edit.c' => null, + 'Pages:Edit:Do.c' => null, 'Pages:Handle.c' => null, 'Pages:New.c' => null, 'Pages:Privs.c' => null, @@ -49,7 +50,7 @@ return $GLOBALS['templates'][$pagedata['template']]->Get($data); } - function GetEditor($page, $type) { + function GetEditor($page, $type, $backlink) { if(!$this->Exists($page, $type)) return array('title' => $page, 'content' => ErrorMessage('PageNotFound', array('page' => $page))); @@ -64,7 +65,7 @@ $data['_page'] = $page; $data['_type'] = $type; - return $this->Get($pagedata['template'], 'e', array('_data' => $data)); + return $this->Get($pagedata['template'], 'e', array('_data' => $data, '_backlink' => $backlink)); } function Exists($page, $type) { diff --git a/config/neon.sql b/config/neon.sql index 21fec04..f78cbd6 100644 --- a/config/neon.sql +++ b/config/neon.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Erstellungszeit: 16. April 2006 um 22:17 +-- Erstellungszeit: 18. April 2006 um 02:19 -- Server Version: 5.0.19 -- PHP-Version: 5.1.2-1+b1 -- @@ -32,6 +32,25 @@ INSERT INTO `groups` VALUES (3, 'Mitglied'); -- -------------------------------------------------------- -- +-- Tabellenstruktur für Tabelle `modules` +-- + +CREATE TABLE `modules` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) NOT NULL, + `enabled` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) +) TYPE=MyISAM AUTO_INCREMENT=2 ; + +-- +-- Daten für Tabelle `modules` +-- + +INSERT INTO `modules` VALUES (1, 'BBCode', 1); + +-- -------------------------------------------------------- + +-- -- Tabellenstruktur für Tabelle `nav` -- @@ -41,7 +60,7 @@ CREATE TABLE `nav` ( `text` tinytext NOT NULL, `link` tinytext NOT NULL, PRIMARY KEY (`id`) -) TYPE=MyISAM AUTO_INCREMENT=15 ; +) TYPE=MyISAM AUTO_INCREMENT=16 ; -- -- Daten für Tabelle `nav` @@ -58,6 +77,7 @@ INSERT INTO `nav` VALUES (9, 0, 'Mitglieder', ''); INSERT INTO `nav` VALUES (10, 0, 'Test', ''); INSERT INTO `nav` VALUES (11, 10, 'Lorem Ipsum', ':Test:LoremIpsum'); INSERT INTO `nav` VALUES (12, 8, 'Seiten', ':Pages'); +INSERT INTO `nav` VALUES (15, 8, 'Module', ':Modules'); INSERT INTO `nav` VALUES (14, 8, 'Benutzer', ':Users'); -- -------------------------------------------------------- @@ -129,6 +149,6 @@ CREATE TABLE `users` ( -- Daten für Tabelle `users` -- -INSERT INTO `users` VALUES (1, '', 0, 'NeoRaider', 'gamezock', '2006-04-16 22:17:42'); +INSERT INTO `users` VALUES (1, '', 0, 'NeoRaider', 'gamezock', '2006-04-18 02:17:02'); INSERT INTO `users` VALUES (3, '', 0, 'sicarius', 'armleuchter', '2006-03-05 23:46:46'); INSERT INTO `users` VALUES (4, '', 0, 'morti', 'return', '2006-03-05 22:02:27'); @@ -5,6 +5,7 @@ require_once('code/util.inc.php'); require_once('code/pages.inc.php'); require_once('code/nav.inc.php'); + require_once('code/links.inc.php'); header('Content-type: text/html;charset=UTF-8'); @@ -28,7 +29,16 @@ <?PHP echo $nav->ParseEntries(); ?> </div> <div id="content"> - <?PHP echo $data['content']; ?> + <?PHP + if($pages->HasWriteAccess($page, 'c')) { + $backlink = $GLOBALS['links']->GetNeonLink($page); + + echo '<a class="editlink" href="' . $GLOBALS['links']->GetNeonLink('Pages:Edit', + 'name=' . urlencode($page)) . '&type=c&backlink=' . urlencode($backlink) . '">Bearbeiten</a>'; + } + + echo $data['content']; + ?> </div> </body> </html> diff --git a/pages/content/Pages:Edit.xml b/pages/content/Pages:Edit.xml index dfe9a51..beaa0b3 100644 --- a/pages/content/Pages:Edit.xml +++ b/pages/content/Pages:Edit.xml @@ -3,7 +3,7 @@ <info> <name>Pages:Edit</name> <template>phpexec</template> - <access>0:0</access> + <access>9:0</access> <type>c</type> </info> <data> @@ -11,32 +11,22 @@ <![CDATA[ <?PHP require_once('code/pages.inc.php'); - require_once('code/links.inc.php'); require_once('code/util.inc.php'); - if($_POST['type'] != 'c' && $_POST['type'] != 'n' && $_POST['type'] != 'e') + if($_GET['type'] != 'c' && $_GET['type'] != 'n' && $_GET['type'] != 'e') exit(); - if($_POST['back']) { - header('Location: ' . $GLOBALS['links']->GetNeonLink('Pages', 'type=' . $_POST['type'], false)); - exit(); - } - - if(!$_POST['name']) exit(); - - $data = array(); + if(!$_GET['name'] || !$_GET['backlink']) exit(); - 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); + if(!$GLOBALS['pages']->HasWriteAccess(Unquote($_GET['name']), $_GET['type'])) + exit(); - header('Location: ' . $GLOBALS['links']->GetNeonLink('Pages', 'type=' . $_POST['type'], false)); - exit(); + $data = $GLOBALS['pages']->GetEditor(Unquote($_GET['name']), $_GET['type'], Unquote($_GET['backlink'])); + + $title = $data['title']; + + echo $data['content']; ?> ]]> </code> diff --git a/pages/content/Pages:Edit:Do.xml b/pages/content/Pages:Edit:Do.xml new file mode 100644 index 0000000..15c5f51 --- /dev/null +++ b/pages/content/Pages:Edit:Do.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<page> + <info> + <name>Pages:Edit:Do</name> + <template>phpexec</template> + <access>9:0</access> + <type>c</type> + </info> + <data> + <code> + <![CDATA[ +<?PHP + require_once('code/pages.inc.php'); + require_once('code/links.inc.php'); + require_once('code/util.inc.php'); + + + if($_POST['type'] != 'c' && $_POST['type'] != 'n' && $_POST['type'] != 'e') + 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> diff --git a/pages/content/Pages:Handle.xml b/pages/content/Pages:Handle.xml index c2b6602..cc334e0 100644 --- a/pages/content/Pages:Handle.xml +++ b/pages/content/Pages:Handle.xml @@ -44,13 +44,11 @@ <?PHP } elseif(isset($_POST['edit'])) { - if($_POST['name']) { - $data = $GLOBALS['pages']->GetEditor(Unquote($_POST['name']), $_POST['type']); - - $title = $data['title']; - - echo $data['content']; - } + $backlink = $GLOBALS['links']->GetNeonLink('Pages', 'type=' . $_POST['type'], false); + + header('Location: ' . $GLOBALS['links']->GetNeonLink('Pages:Edit', 'type=' . $_POST['type'] . + '&name=' . urlencode(Unquote($_POST['name'])) . '&backlink=' . urlencode($backlink), false)); + exit(); } elseif(isset($_POST['privs'])) { if($_POST['name']) { diff --git a/pages/editor/default.xml b/pages/editor/default.xml index 3c0c79e..f85929c 100644 --- a/pages/editor/default.xml +++ b/pages/editor/default.xml @@ -3,20 +3,24 @@ <info> <name>phpexec</name> <template>phpexec</template> - <access>0:0</access> + <access>9:0</access> <type>e</type> </info> <data> <code> <![CDATA[ <?PHP + require_once('code/links.inc.php'); + + $title = 'Edit \'' . $data['_data']['_page'] . '\''; echo '<h2>' . $title . '</h2>'; ?> -<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit'); ?>"> +<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit:Do'); ?>"> <input type="hidden" name="name" value="<?PHP echo $data['_data']['_page'] ?>" /> <input type="hidden" name="type" value="<?PHP echo $data['_data']['_type']; ?>" /> + <input type="hidden" name="backlink" value="<?PHP echo htmlspecialchars($data['_backlink']); ?>" /> Titel: <input type="text" name="data_title" value="<?PHP echo strtr($data['_data']['title'], array('<' => '<', '>' => '>', '&' => '&', '"' => '"')); ?>" size="70" /><br /> diff --git a/pages/editor/phpexec.xml b/pages/editor/phpexec.xml index a2c390d..be7c4e9 100644 --- a/pages/editor/phpexec.xml +++ b/pages/editor/phpexec.xml @@ -3,20 +3,24 @@ <info> <name>phpexec</name> <template>phpexec</template> - <access>0:0</access> + <access>9:0</access> <type>e</type> </info> <data> <code> <![CDATA[ <?PHP + require_once('code/links.inc.php'); + + $title = 'Edit \'' . $data['_data']['_page'] . '\''; echo '<h2>' . $title . '</h2>'; ?> -<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit'); ?>"> +<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit:Do'); ?>"> <input type="hidden" name="name" value="<?PHP echo $data['_data']['_page'] ?>" /> <input type="hidden" name="type" value="<?PHP echo $data['_data']['_type']; ?>" /> + <input type="hidden" name="backlink" value="<?PHP echo htmlspecialchars($data['_backlink']); ?>" /> <textarea name="data_code" class="pageedit spaced-bottom" rows="25" cols="70"><?PHP echo strtr($data['_data']['code'], array('<' => '<', '>' => '>', '&' => '&', '"' => '"')); ?></textarea><br /> |