summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2006-04-18 20:47:03 +0200
committerneoraider <devnull@localhost>2006-04-18 20:47:03 +0200
commit7b622dca2d4a24221202d85c15ba68d0974b432c (patch)
tree4234772ed30b7e2e7a7c751d8520ab608227035f
parentaea6a2fa30bff2be100858bfc582384df4b84195 (diff)
downloadneon-7b622dca2d4a24221202d85c15ba68d0974b432c.tar
neon-7b622dca2d4a24221202d85c15ba68d0974b432c.zip
Sofort-Bearbeiten-Funktion ?berarbeitet.
-rw-r--r--code/pages.inc.php1
-rw-r--r--index.php6
-rw-r--r--pages/content/Pages:Edit.xml29
-rw-r--r--pages/content/Pages:Edit:Do.xml47
-rw-r--r--pages/content/Pages:Handle.xml12
-rw-r--r--pages/editor/default.xml2
-rw-r--r--pages/editor/phpexec.xml2
7 files changed, 33 insertions, 66 deletions
diff --git a/code/pages.inc.php b/code/pages.inc.php
index 99ac017..a5e6df8 100644
--- a/code/pages.inc.php
+++ b/code/pages.inc.php
@@ -14,7 +14,6 @@
'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,
diff --git a/index.php b/index.php
index e732715..b4d930f 100644
--- a/index.php
+++ b/index.php
@@ -12,7 +12,8 @@
if($_GET['page']) $page = Unquote($_GET['page']);
else $page = $config['home'];
- $data = $pages->Get($page, 'c');
+ if($_GET['mode'] == 'edit') $data = $pages->GetEditor($page, 'c', $GLOBALS['links']->GetNeonLink($page, null, false));
+ else $data = $pages->Get($page, 'c');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
@@ -33,8 +34,7 @@
if($pages->HasWriteAccess($page, 'c')) {
$backlink = $GLOBALS['links']->GetNeonLink($page);
- echo '<a class="editlink" href="' . $GLOBALS['links']->GetNeonLink('Pages:Edit',
- 'name=' . urlencode($page)) . '&amp;type=c&amp;backlink=' . urlencode($backlink) . '">Bearbeiten</a>';
+ echo '<a class="editlink" href="' . $GLOBALS['links']->GetNeonLink($page, 'mode=edit') . '">Bearbeiten</a>';
}
echo $data['content'];
diff --git a/pages/content/Pages:Edit.xml b/pages/content/Pages:Edit.xml
index beaa0b3..973b9f0 100644
--- a/pages/content/Pages:Edit.xml
+++ b/pages/content/Pages:Edit.xml
@@ -11,22 +11,35 @@
<![CDATA[
<?PHP
require_once('code/pages.inc.php');
+ require_once('code/links.inc.php');
require_once('code/util.inc.php');
- if($_GET['type'] != 'c' && $_GET['type'] != 'n' && $_GET['type'] != 'e')
+ if($_POST['type'] != 'c' && $_POST['type'] != 'n' && $_POST['type'] != 'e')
exit();
- if(!$_GET['name'] || !$_GET['backlink']) exit();
+ if($_POST['back']) {
+ header('Location: ' . Unquote($_POST['backlink']));
+ exit();
+ }
+
+ if(!$_POST['name'] || !$_POST['backlink']) exit();
- if(!$GLOBALS['pages']->HasWriteAccess(Unquote($_GET['name']), $_GET['type']))
+ if(!$GLOBALS['pages']->HasWriteAccess(Unquote($_POST['name']), $_POST['type']))
exit();
- $data = $GLOBALS['pages']->GetEditor(Unquote($_GET['name']), $_GET['type'], Unquote($_GET['backlink']));
-
- $title = $data['title'];
-
- echo $data['content'];
+ $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>
diff --git a/pages/content/Pages:Edit:Do.xml b/pages/content/Pages:Edit:Do.xml
deleted file mode 100644
index 15c5f51..0000000
--- a/pages/content/Pages:Edit:Do.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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 cc334e0..f96cd4a 100644
--- a/pages/content/Pages:Handle.xml
+++ b/pages/content/Pages:Handle.xml
@@ -44,11 +44,13 @@
<?PHP
}
elseif(isset($_POST['edit'])) {
- $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();
+ if($_POST['name']) {
+ $data = $GLOBALS['pages']->GetEditor(Unquote($_POST['name']), $_POST['type'], $GLOBALS['links']->GetNeonLink('Pages', null, false));
+
+ $title = $data['title'];
+
+ echo $data['content'];
+ }
}
elseif(isset($_POST['privs'])) {
if($_POST['name']) {
diff --git a/pages/editor/default.xml b/pages/editor/default.xml
index f85929c..dd3438a 100644
--- a/pages/editor/default.xml
+++ b/pages/editor/default.xml
@@ -17,7 +17,7 @@
echo '<h2>' . $title . '</h2>';
?>
-<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit:Do'); ?>">
+<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit'); ?>">
<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']); ?>" />
diff --git a/pages/editor/phpexec.xml b/pages/editor/phpexec.xml
index be7c4e9..633106d 100644
--- a/pages/editor/phpexec.xml
+++ b/pages/editor/phpexec.xml
@@ -17,7 +17,7 @@
echo '<h2>' . $title . '</h2>';
?>
-<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit:Do'); ?>">
+<form method="post" action="<?PHP echo $GLOBALS['links']->GetNeonLink('Pages:Edit'); ?>">
<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']); ?>" />