change: save before returning home
This commit is contained in:
parent
6b676c7ba1
commit
c18744c45f
23
index.php
23
index.php
|
@ -27,9 +27,6 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
require 'libs/Parsedown.php';
|
||||
$homelink = '<a accesskey="h" href="' . $root . '">home</a> ';
|
||||
|
||||
$action = '';
|
||||
if (isset($_POST['action'])) $action = $_POST['action'];
|
||||
else if (isset($_GET['action'])) $action = $_GET['action'];
|
||||
|
@ -37,6 +34,11 @@
|
|||
$param = '';
|
||||
if (isset($_GET['param'])) $param = $_GET['param'];
|
||||
|
||||
if (isset($_POST['home']))
|
||||
{
|
||||
$action = 'save';
|
||||
}
|
||||
|
||||
$content = '';
|
||||
if ($action == 'save')
|
||||
{
|
||||
|
@ -52,6 +54,11 @@
|
|||
|
||||
$action = 'open';
|
||||
$param = $title;
|
||||
|
||||
if (isset($_POST['home']))
|
||||
{
|
||||
header('Location: index.php');
|
||||
}
|
||||
}
|
||||
else if ($action == 'delete')
|
||||
{
|
||||
|
@ -61,6 +68,7 @@
|
|||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
require 'libs/Parsedown.php';
|
||||
$title = $_POST['title'];
|
||||
$content = $_POST['content'];
|
||||
$Parsedown = new Parsedown();
|
||||
|
@ -91,8 +99,9 @@
|
|||
$length = strlen($content);
|
||||
|
||||
echo '<form action="index.php" method="POST">
|
||||
<div>' . $homelink .
|
||||
'<select name="action">
|
||||
<div>
|
||||
<input type="submit" name="home" value="home" accesskey="h">
|
||||
<select name="action">
|
||||
<option value="save">save</option>
|
||||
<option value="delete">delete</option>
|
||||
<option value="preview">preview</option>
|
||||
|
@ -136,8 +145,8 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
echo '<form action="index.php" method="GET">' .$homelink .
|
||||
'<select name="action">
|
||||
echo '<form action="index.php" method="GET">
|
||||
<select name="action">
|
||||
<option ' . ($action == 'open' ? 'selected' : '') . ' value="open">open</option>
|
||||
<option ' . ($action == 'filter' ? 'selected' : '') . ' value="filter">filter</option>
|
||||
<option ' . ($action == 'search' ? 'selected' : '') . ' value="search">search</option>
|
||||
|
|
Loading…
Reference in New Issue