diff options
Diffstat (limited to 'shell/bin/editor.php')
-rw-r--r-- | shell/bin/editor.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shell/bin/editor.php b/shell/bin/editor.php new file mode 100644 index 0000000..6eac87e --- /dev/null +++ b/shell/bin/editor.php @@ -0,0 +1,21 @@ +<?php +function main($args) { + if (isset($_POST['stdin'])) { + if (isset($args[1])) { + file_put_contents($args[1],$_POST['stdin']); + } else { + echo $_POST['stdin']; + } + } else { + if (isset($args[1]) && file_exists($args[1])) { + $text = file_get_contents($args[1]); + } else { + $text = ''; + } + echo '<div class="editor">'; + echo '<input type="hidden" name="stddest" value="'.$_POST['c'].'" />'; + echo '<textarea name="stdin">'.$text.'</textarea>'."\n"; + echo '<input type="submit" value="save" />'; + echo '</div>'; + } +} |