summaryrefslogtreecommitdiff
path: root/shell/bin/editor.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-11-27 11:23:55 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-11-27 11:23:55 -0500
commitfb0380f48203a11584773f3db335eaadd9cc6fdf (patch)
tree98f7eb36ed8a3ec99c1cba5c9c0742af8931783b /shell/bin/editor.php
parent3d6790614bb0dc776e02a95835e5c274263d1d1a (diff)
This zip file was identified as ltshell-3.5.zip
Diffstat (limited to 'shell/bin/editor.php')
-rw-r--r--shell/bin/editor.php35
1 files changed, 19 insertions, 16 deletions
diff --git a/shell/bin/editor.php b/shell/bin/editor.php
index 6eac87e..39db3d8 100644
--- a/shell/bin/editor.php
+++ b/shell/bin/editor.php
@@ -1,21 +1,24 @@
<?php
-function main($args) {
- if (isset($_POST['stdin'])) {
- if (isset($args[1])) {
- file_put_contents($args[1],$_POST['stdin']);
+class p_editor extends prog {
+ public static function main($args, $env) {
+ if (isset($_POST['stdin'])) {
+ if (isset($args[1])) {
+ file_put_contents($args[1],$_POST['stdin']);
+ } else {
+ echo $_POST['stdin'];
+ }
} else {
- echo $_POST['stdin'];
+ 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>';
}
- } 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>';
}
}
+