From: Martin G. <mge...@us...> - 2006-01-13 17:34:34
|
Update of /cvsroot/phpshell/phpshell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22607 Modified Files: AUTHORS ChangeLog INSTALL README phpshell.php Added Files: release.sh Log Message: Imported PHP Shell version 1.9. Index: ChangeLog =================================================================== RCS file: /cvsroot/phpshell/phpshell/ChangeLog,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ChangeLog 13 Jan 2006 17:29:47 -0000 1.4 +++ ChangeLog 13 Jan 2006 17:34:25 -0000 1.5 @@ -1,3 +1,18 @@ +2003-11-11 Martin Geisler <gim...@gi...> + + * AUTHORS 1.6: + Added Wolfgang Dautermann <wol...@fh...>. + + * phpshell.php 1.25: + Ups, I commited with $passwd = array('foo' => 'bar'). + + * phpshell.php 1.24: + Wolfgang Dautermann <wol...@fh...> suggested + that the directory list should be sorted. + + Also, changing directory through symbolic links now works as expected, + so that it's possible to go back using 'cd ..'. + 2003-04-01 Martin Geisler <gim...@gi...> * INSTALL 1.4: @@ -23,11 +38,6 @@ * phpshell.php 1.21: Added HTTP basic authentication to the script. - * .htaccess 1.2: - The .htaccess file will now prevent people from using phpshell.php on - new installations before they have either deleted it or changed the - path to the .htpasswd file. - * AUTHORS 1.5: Moved Jeremy Miller <JM...@ma...>. * phpshell.php 1.20: Updated version. @@ -122,7 +132,7 @@ * INSTALL 1.2: Made BUGS lowercase. - * .htaccess 1.1, INSTALL 1.1, README 1.1: New file. + * INSTALL 1.1, README 1.1: New file. * phpshell.php 1.7: Removed 'Martin Geisler' from the title, putting my name on the bottom Index: README =================================================================== RCS file: /cvsroot/phpshell/phpshell/README,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- README 13 Jan 2006 17:29:47 -0000 1.4 +++ README 13 Jan 2006 17:34:25 -0000 1.5 @@ -1,4 +1,4 @@ -README for PhpShell 1.8 +README for PhpShell 1.9 Copyright (C) 2000-2003 Martin Geisler <gim...@gi...> Licensed under the GNU GPL. See the file COPYING for details. Index: INSTALL =================================================================== RCS file: /cvsroot/phpshell/phpshell/INSTALL,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- INSTALL 13 Jan 2006 17:29:47 -0000 1.3 +++ INSTALL 13 Jan 2006 17:34:25 -0000 1.4 @@ -1,4 +1,4 @@ -Installation instructions for PhpShell 1.8 +Installation instructions for PhpShell 1.9 Copyright (C) 2000-2003 Martin Geisler <gim...@gi...> Licensed under the GNU GPL. See the file COPYING for details. @@ -13,7 +13,7 @@ Installation ------------ Installation is easy: first unpack the tarball or zipfile into your -webserver. This will create a subdirectory called phpweather-1.8. +webserver. This will create a subdirectory called phpweather-1.9. If you're using PhpShell on an Apache webserver running PHP as a module, then PhpShell wont work until you've edited phpshell.php. You Index: AUTHORS =================================================================== RCS file: /cvsroot/phpshell/phpshell/AUTHORS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AUTHORS 13 Jan 2006 17:29:47 -0000 1.4 +++ AUTHORS 13 Jan 2006 17:34:25 -0000 1.5 @@ -1,4 +1,4 @@ -Main author: Martin Geisler <gim...@gi...> +Main author: Martin Geisler <gim...@gi...> -*- text -*- Thanks goes to all these persons who have helped: @@ -22,3 +22,7 @@ Michael Zech <ke...@we...> Patch to make the stderr-checkbox remember it's state. + +Wolfgang Dautermann <wol...@fh...> + Multiple patches, including the sorting of directory entries in the + drop down box. Index: phpshell.php =================================================================== RCS file: /cvsroot/phpshell/phpshell/phpshell.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- phpshell.php 13 Jan 2006 17:29:47 -0000 1.4 +++ phpshell.php 13 Jan 2006 17:34:25 -0000 1.5 @@ -3,11 +3,11 @@ /* ************************************************************** - * PhpShell 1.8 * + * PhpShell 1.9 * ************************************************************** $Id$ - PhpShell is aninteractive PHP-page that will execute any command + PhpShell is an interactive PHP-page that will execute any command entered. See the files README and INSTALL or http://www.gimpster.com/wiki/PhpShell for further information. @@ -30,8 +30,6 @@ */ -define('PHPSHELL_VERSION', '1.8'); - /* Set your usernames and passwords like this: $passwd = array('username' => 'password'); @@ -51,7 +49,7 @@ !isset($_SERVER['PHP_AUTH_PW']) || !isset($passwd[$_SERVER['PHP_AUTH_USER']]) || $passwd[$_SERVER['PHP_AUTH_USER']] != $_SERVER['PHP_AUTH_PW']) { - header('WWW-Authenticate: Basic realm="PhpShell 1.8"'); + header('WWW-Authenticate: Basic realm="PhpShell 1.9"'); header('HTTP/1.0 401 Unauthorized'); $authenticated = false; } else { @@ -67,16 +65,17 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> - <title>PhpShell <?php echo PHPSHELL_VERSION ?></title> + <title>PhpShell 1.9</title> <link rel="stylesheet" href="phpshell.css" type="text/css" /> </head> -<body> -<h1>PhpShell <?php echo PHPSHELL_VERSION ?></h1> +<body onload="document.forms[0].command.focus();"> + +<h1>PhpShell 1.9</h1> <?php if (!$authenticated) { ?> <p>You failed to authenticate yourself to PhpShell. You can <a -href="phpshell.php">reload</a> to try again.</p> +href="<?php echo $_SERVER['PHP_SELF'] ?>">reload</a> to try again.</p> <p>Try reading the <a href="INSTALL">INSTALL</a> file if you're having problems with installing PhpShell.</p> @@ -84,9 +83,9 @@ </body> </html> -<?php exit; } //' <- fix syntax highlight... ?> - -<?php +<?php // ' <-- fix syntax highlight in Emacs + exit; +} error_reporting (E_ALL); @@ -104,6 +103,8 @@ $new_dir = $regs[1]; // 'cd /something/...' } else { $new_dir = $work_dir . '/' . $regs[1]; // 'cd somedir/...' + $new_dir = str_replace('/./', '/', $new_dir); + $new_dir = preg_replace('|/?[^/]*/\.\.|', '$1', $new_dir); } if (file_exists($new_dir) && is_dir($new_dir)) { $work_dir = $new_dir; @@ -119,8 +120,7 @@ } /* We now update $work_dir to avoid things like '/foo/../bar': */ -$work_dir = exec('pwd'); - +if ($work_dir == '') $work_dir = getcwd(); ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"> @@ -149,11 +149,13 @@ <?php /* Now we make a list of the directories. */ $dir_handle = opendir($work_dir); +/* We store the output so that we can sort it later: */ +$options = array(); /* Run through all the files and directories to find the dirs. */ while ($dir = readdir($dir_handle)) { if (is_dir($dir)) { if ($dir == '.') { - echo "<option value=\"$work_dir\" selected=\"selected\">Current Directory</option>\n"; + $options['.'] = "<option value=\"$work_dir\" selected=\"selected\">Current Directory</option>"; } elseif ($dir == '..') { /* We have found the parent dir. We must be carefull if the * parent directory is the root directory (/). */ @@ -164,30 +166,35 @@ /* The last / in work_dir were the first charecter. This * means that we have a top-level directory eg. /bin or /home * etc... */ - echo "<option value=\"/\">Parent Directory</option>\n"; + $options['..'] = "<option value=\"/\">Parent Directory</option>"; } else { - /* We do a little bit of string-manipulation to find the parent - * directory... Trust me - it works :-) */ - echo "<option value=\"". strrev(substr(strstr(strrev($work_dir), "/"), 1)) ."\">Parent Directory</option>\n"; + /* We do a little bit of string-manipulation to find the parent + * directory... Trust me - it works :-) */ + $options['..'] = "<option value=\"" . + strrev(substr(strstr(strrev($work_dir), "/"), 1)) . + "\">Parent Directory</option>"; } } else { if ($work_dir == '/') { - echo "<option value=\"$work_dir$dir\">$dir</option>\n"; + $options[$dir] = "<option value=\"/$dir\">$dir</option>"; } else { - echo "<option value=\"$work_dir/$dir\">$dir</option>\n"; + $options[$dir] = "<option value=\"$work_dir/$dir\">$dir</option>"; } } } } closedir($dir_handle); +ksort($options); + +echo implode("\n", $options) + ?> </select></p> <p>Command: <input type="text" name="command" size="60" /></p> - <p>Enable <code>stderr</code>-trapping? <input type="checkbox" name="stderr" <?php if ($stderr) echo "checked=\"checked\""; ?> /> <input name="submit_btn" type="submit" value="Execute Command" /></p> </fieldset> @@ -197,12 +204,13 @@ <p><textarea cols="80" rows="20" readonly="readonly"> <?php if (!empty($command)) { + if ($command == 'ls') { + /* ls looks much better with ' -F', IMHO. */ + $command .= ' -F'; + } if ($stderr) { $tmpfile = tempnam('/tmp', 'phpshell'); $command .= " 1> $tmpfile 2>&1; cat $tmpfile; rm $tmpfile"; - } elseif ($command == 'ls') { - /* ls looks much better with ' -F', IMHO. */ - $command .= ' -F'; } echo htmlspecialchars(shell_exec($command), ENT_COMPAT, 'UTF-8'); } @@ -212,16 +220,14 @@ </fieldset> </form> -<script type="text/javascript"> -document.forms[0].command.focus(); -</script> - <hr /> -<address>Copyright © 2000–2003, <a -href="mailto:gim...@gi...">Martin Geisler</a>. Get the latest -version at <a -href="http://www.gimpster.com/">www.gimpster.com/wiki/PhpShell</a>.</address> +<address> +Copyright © 2000–2003, <a +href="mailto:gim...@gi...">Martin Geisler</a>. Get the +latest version at <a +href="http://www.gimpster.com/wiki/PhpShell">www.gimpster.com/wiki/PhpShell</a>. +</address> <p> <a href="http://validator.w3.org/check/referer"> --- NEW FILE: release.sh --- #!/bin/zsh #set -x VERSION=1.9 echo "Releasing phpshell-$VERSION:" cd .. cp -r phpshell phpshell-$VERSION cd phpshell-$VERSION rcs2log -v \ -u "gimpster Martin Geisler gim...@gi..." \ -u "martin Martin Geisler gim...@gi..." > ChangeLog for file in phpshell.php README INSTALL; do sed -e "s/@VERSION@/$VERSION/g" $file > $file.tmp mv -f $file.tmp $file done # Clean: rm -f release.sh *.~*~ rm -fr RCS chmod 644 * cd .. # We make tarballs: ~/bin/inp phpshell-$VERSION for file in phpshell-$VERSION.*; do cp $file phpshell-latest${file#phpshell-$VERSION} done ncftpput -f ~/.ncftp/gimpster.cfg -F /web/downloads/phpshell \ phpshell-$VERSION.* phpshell-latest.* phpshell-$VERSION/ChangeLog # Remove release directory: rm -rf phpshell-$VERSION |