|
|
@ -12,11 +12,30 @@ |
|
|
header('location: ../index.php'); |
|
|
header('location: ../index.php'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$dir = substr($url, 0, strrpos($url, '/')); |
|
|
|
|
|
|
|
|
|
|
|
$oldurl = explode('_', $url); |
|
|
|
|
|
|
|
|
|
|
|
$oldtag = $oldurl[1]; |
|
|
|
|
|
|
|
|
|
|
|
$oldmd = str_replace('.md','',$oldurl[2]); |
|
|
|
|
|
|
|
|
if(isset($_POST['submit'])) { |
|
|
if(isset($_POST['submit'])) { |
|
|
|
|
|
$post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['tag']); |
|
|
|
|
|
$post_tag = rtrim($post_tag, ',\.\-'); |
|
|
|
|
|
$post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); |
|
|
|
|
|
$post_url = rtrim($post_url, ',\.\-'); |
|
|
$post_content = $_POST['content']; |
|
|
$post_content = $_POST['content']; |
|
|
} |
|
|
} |
|
|
if(!empty($post_content)) { |
|
|
if(!empty($post_content)) { |
|
|
file_put_contents('../'. $url, print_r($post_content, true)); |
|
|
|
|
|
|
|
|
$newurl = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md'; |
|
|
|
|
|
if($url === $newurl) { |
|
|
|
|
|
file_put_contents($url, print_r($post_content, true)); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
rename($url, $newurl); |
|
|
|
|
|
file_put_contents($newurl, print_r($post_content, true)); |
|
|
|
|
|
} |
|
|
header('location: ../index.php'); |
|
|
header('location: ../index.php'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -32,6 +51,7 @@ |
|
|
<link rel="stylesheet" type="text/css" href="../resources/style.css" /> |
|
|
<link rel="stylesheet" type="text/css" href="../resources/style.css" /> |
|
|
<link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> |
|
|
<link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> |
|
|
<script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> |
|
|
<script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> |
|
|
|
|
|
<script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> |
|
|
<script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> |
|
|
<script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> |
|
|
</head> |
|
|
</head> |
|
|
<body> |
|
|
<body> |
|
|
@ -48,8 +68,10 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="wmd-panel"> |
|
|
<div class="wmd-panel"> |
|
|
<form method="POST"> |
|
|
<form method="POST"> |
|
|
|
|
|
Tag: <br><input type="text" name="tag" size="60" maxlength="60" value="<?php echo $oldtag?>"/><br><br> |
|
|
|
|
|
Url: <br><input type="text" name="url" size="60" maxlength="60" value="<?php echo $oldmd ?>"/><br><br> |
|
|
<div id="wmd-button-bar" class="wmd-button-bar"></div> |
|
|
<div id="wmd-button-bar" class="wmd-button-bar"></div> |
|
|
<textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo file_get_contents('../' . $url)?></textarea><br>
|
|
|
|
|
|
|
|
|
<textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo file_get_contents($url)?></textarea><br>
|
|
|
<input type="submit" name="submit" value="Submit"/> |
|
|
<input type="submit" name="submit" value="Submit"/> |
|
|
</form> |
|
|
</form> |
|
|
</div> |
|
|
</div> |
|
|
|