function mainHTML()
{
    global $schedulePID, $schedulePars, $debugString, $showLog;
    echo '<!DOCTYPE html>';
    echo '<html>';
    echo '<head>';
    echo '<meta name="viewport" content="width=550, initial-scale=1">';
    echo '<title>RPi Cam Download</title>';
    echo '<link rel="stylesheet" href="css/style_minified.css" />';
    echo '<link rel="stylesheet" href="' . getStyle() . '" />';
    echo '<script src="js/style_minified.js"></script>';
    echo '<script src="js/script.js"></script>';
    echo '</head>';
    echo '<body onload="schedule_rows()">';
    echo '<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">';
    echo '<div class="container">';
    echo '<div class="navbar-header">';
    if ($showLog) {
        echo '<a class="navbar-brand" href="schedule.php">';
    } else {
        echo '<a class="navbar-brand" href="' . ROOT_PHP . '">';
    }
    echo '<span class="glyphicon glyphicon-chevron-left"></span>Back - ' . CAM_STRING . '</a>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '<div class="container-fluid">';
    echo '<form action="schedule.php" method="POST">';
    if ($debugString) {
        echo $debugString . "<br>";
    }
    if ($showLog) {
        echo "&nbsp&nbsp;<button class='btn btn-primary' type='submit' name='action' value='downloadlog'>" . BTN_DOWNLOADLOG . "</button>";
        echo "&nbsp&nbsp;<button class='btn btn-primary' type='submit' name='action' value='clearlog'>" . BTN_CLEARLOG . "</button><br><br>";
        displayLog();
    } else {
        echo '<div class="container-fluid text-center">';
        echo "&nbsp;&nbsp;<button class='btn btn-primary' type='submit' name='action' value='save'>" . BTN_SAVE . "</button>";
        echo "&nbsp;&nbsp;<button class='btn btn-primary' type='submit' name='action' value='backup'>" . BTN_BACKUP . "</button>";
        echo "&nbsp;&nbsp;<button class='btn btn-primary' type='submit' name='action' value='restore'>" . BTN_RESTORE . "</button>";
        echo "&nbsp;&nbsp;<button class='btn btn-primary' type='submit' name='action' value='showlog'>" . BTN_SHOWLOG . "</button>";
        echo '&nbsp;&nbsp;&nbsp;&nbsp;';
        if ($schedulePID != 0) {
            echo "<button class='btn btn-danger' type='submit' name='action' value='stop'>" . BTN_STOP . "</button>";
        } else {
            echo "<button class='btn btn-danger' type='submit' name='action' value='start'>" . BTN_START . "</button>";
        }
        echo "<br></div>";
        showScheduleSettings($schedulePars);
    }
    echo '</form>';
    echo '</div>';
    cmdHelp();
    echo '</body>';
    echo '</html>';
}
function usage($error = null, $helpsubject = null)
{
    global $progname, $all_commands;
    $stderr = fopen('php://stderr', 'w');
    if (PEAR::isError($error)) {
        fputs($stderr, $error->getMessage() . "\n");
    } elseif ($error !== null) {
        fputs($stderr, "{$error}\n");
    }
    if ($helpsubject != null) {
        $put = cmdHelp($helpsubject);
    } else {
        $put = "Commands:\n";
        $maxlen = max(array_map("strlen", $all_commands));
        $formatstr = "%-{$maxlen}s  %s\n";
        ksort($all_commands);
        foreach ($all_commands as $cmd => $class) {
            $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd));
        }
        $put .= "Usage: {$progname} [options] command [command-options] <parameters>\n" . "Type \"{$progname} help options\" to list all options.\n" . "Type \"{$progname} help shortcuts\" to list all command shortcuts.\n" . "Type \"{$progname} help <command>\" to get the help for the specified command.";
    }
    fputs($stderr, "{$put}\n");
    fclose($stderr);
    exit;
}
Example #3
0
/**
 * cmdConsole()
 *
 * @param  array &$aryPear
 * @return void
 */
function cmdConsole(&$aryPear)
{
    foreach ($aryPear['opt'] as $sKey => $sValue) {
        switch ($sKey) {
            case 'e':
            case '--exec':
                cmdExec($sValue, $aryPear);
                exit;
            case 'u':
            case '--upgrade':
                cmdUpgrade($aryPear);
                exit;
            case '--package':
                cmdPackage($sValue);
                exit;
            case '--make_iplist':
                cmdMakeDoCoMoIpList($aryPear);
                cmdMakeEZwebIpList($aryPear);
                cmdMakeSoftBankIpList($aryPear);
                exit;
            case '--show_iplist':
                echo cmdShowIpList($aryPear) . "\n";
                exit;
            case '--make_map':
                cmdMakeDoCoMoMap($aryPear);
                cmdMakeSoftBankMap($aryPear);
                exit;
            case '--make_doc':
                echo cmdMakeDoc() . "\n";
                exit;
            case '--get_doc':
                cmdGetDoc($sValue);
                exit;
            case '--clean_doc':
                echo cmdCleanDoc() . "\n";
                exit;
            case '--clean_cache':
                echo cmdCleanCache() . "\n";
                exit;
            case '--show_log':
                echo cmdShowLog($sValue) . "\n";
                exit;
            case '--clean_log':
                echo cmdCleanLog() . "\n";
                exit;
            case '--clean_tmp':
                echo cmdCleanTmp() . "\n";
                exit;
            case 'p':
            case '--phpinfo':
                phpinfo();
                exit;
            case 'i':
            case '--info':
                echo cmdBlockenInfo() . "\n";
                exit;
            default:
                break;
        }
    }
    echo cmdHelp() . "\n";
    exit;
}