From 531b89f69ab5e72900fbd2484d60491f68e9153b Mon Sep 17 00:00:00 2001 From: neoraider Date: Tue, 18 Apr 2006 00:20:03 +0000 Subject: Sofort-Bearbeiten funktioniert jetzt. --- code/pages.inc.php | 5 +++-- config/neon.sql | 26 ++++++++++++++++++++--- index.php | 12 ++++++++++- pages/content/Pages:Edit.xml | 30 +++++++++----------------- pages/content/Pages:Edit:Do.xml | 47 +++++++++++++++++++++++++++++++++++++++++ pages/content/Pages:Handle.xml | 12 +++++------ pages/editor/default.xml | 8 +++++-- pages/editor/phpexec.xml | 8 +++++-- 8 files changed, 111 insertions(+), 37 deletions(-) create mode 100644 pages/content/Pages:Edit:Do.xml 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 -- @@ -31,6 +31,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'); diff --git a/index.php b/index.php index 9b80e3b..e732715 100644 --- a/index.php +++ b/index.php @@ -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 @@ ParseEntries(); ?>
- + HasWriteAccess($page, 'c')) { + $backlink = $GLOBALS['links']->GetNeonLink($page); + + echo 'Bearbeiten'; + } + + echo $data['content']; + ?>
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 @@ Pages:Edit - 0:0 + 9:0 c @@ -11,32 +11,22 @@ 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']; ?> ]]> 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 @@ + + + + Pages:Edit:Do + + 9:0 + c + + + + 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(); +?> + ]]> + + + 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 @@ 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 @@ phpexec - 0:0 + 9:0 e ' . $title . ''; ?> -
+ + Titel: '"')); ?>" size="70" />
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 @@ phpexec - 0:0 + 9:0 e ' . $title . ''; ?> - + +
-- cgit v1.2.3