change: param empty by default
This commit is contained in:
parent
8693e3c8ad
commit
ac6c01bd46
20
index.php
20
index.php
|
@ -69,16 +69,19 @@
|
||||||
|
|
||||||
if ($action == 'open')
|
if ($action == 'open')
|
||||||
{
|
{
|
||||||
$title = $param;
|
if (!$param)
|
||||||
|
{
|
||||||
|
$param = date("Y-m-d H.i.s", time());
|
||||||
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
if (!file_exists($dir . '/' . $title))
|
if (!file_exists($dir . '/' . $param))
|
||||||
{
|
{
|
||||||
file_put_contents($dir . '/' . $title, $content);
|
file_put_contents($dir . '/' . $param, $content);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$content = file_get_contents($dir . '/' . $title);
|
$content = file_get_contents($dir . '/' . $param);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nblines = max(20, substr_count($content, "\r\n") + 1) * 2;
|
$nblines = max(20, substr_count($content, "\r\n") + 1) * 2;
|
||||||
|
@ -92,7 +95,7 @@
|
||||||
<input type="submit" name="go" value="go" accesskey="s">
|
<input type="submit" name="go" value="go" accesskey="s">
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div><input class="title" name="title" value="' . $title . '"></div><br>
|
<div><input class="title" name="title" value="' . $param . '"></div><br>
|
||||||
<div>
|
<div>
|
||||||
<textarea rows="' . $nblines. '" autofocus name="content" spellcheck="false">' . $content . '</textarea>
|
<textarea rows="' . $nblines. '" autofocus name="content" spellcheck="false">' . $content . '</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,13 +103,8 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$defaulttitle = date("Y-m-d H.i.s", time());
|
|
||||||
if ($param)
|
|
||||||
{
|
|
||||||
$defaulttitle = $param;
|
|
||||||
}
|
|
||||||
echo '<form action="index.php" method="GET">
|
echo '<form action="index.php" method="GET">
|
||||||
<input name="param" value="' . $defaulttitle . '">
|
<input name="param" value="' . $param . '">
|
||||||
<select name="action">
|
<select name="action">
|
||||||
<option value="open">open</option>
|
<option value="open">open</option>
|
||||||
<option value="filter">filter</option>
|
<option value="filter">filter</option>
|
||||||
|
|
Loading…
Reference in New Issue