Ejemplo n.º 1
0
<?php

@ob_end_clean();
error_reporting(E_ALL);
set_time_limit(0);
$include_path = get_include_path() . ':' . dirname(__FILE__) . '/lib/PHP_Shell-0.3.1';
set_include_path($include_path);
require_once "PHP/Shell.php";
$__shell = new PHP_Shell();
$__cmd = PHP_Shell_Commands::getInstance();
$f = <<<EOF
PHP-Barebone-Shell - Version %s%s
(c) 2006, Jan Kneschke <*****@*****.**>

>> use '?' to open the inline help 

EOF;
printf($f, $__shell->getVersion(), $__shell->hasReadline() ? ', with readline() support' : '');
unset($f);
while ($__shell->input()) {
    try {
        if ($__shell->parse() == 0) {
            ## we have a full command, execute it
            $__shell_retval = eval($__shell->getCode());
            if (isset($__shell_retval)) {
                // WORKAROUND for var_export error "Nesting level too deep - recursive dependency":
                ob_start();
                var_dump($__shell_retval);
                $dataDump = ob_get_clean();
                echo $dataDump;
            }
Ejemplo n.º 2
0
* @param integer $errno Error-Number
* @param string $errstr Error-Message
* @param string $errfile Filename where the error was raised
* @param interger $errline Line-Number in the File
* @param mixed $errctx ...
*/
function __shell_default_error_handler($errno, $errstr, $errfile, $errline, $errctx)
{
    ## ... what is this errno again ?
    if ($errno == 2048 || $errno == 8) {
        return;
    }
    throw new Exception(sprintf("%s:%d\r\n%s", $errfile, $errline, $errstr));
}
set_error_handler("__shell_default_error_handler");
$__shell = new PHP_Shell();
$f = <<<EOF
>> use '?' to open the inline help 
EOF;
printf($f, $__shell->getVersion(), $__shell->hasReadline() ? ', with readline() support' : '');
unset($f);
print $__shell->getColour("default");
while ($__shell->input()) {
    try {
        if ($__shell->parse() == 0) {
            ## we have a full command, execute it
            if ($__shell->isAutoloadEnabled() && !function_exists('__autoload')) {
                /**
                 * default autoloader
                 *
                 * If a class doesn't exist try to load it by guessing the filename