Esempio n. 1
0
function script_ende()
{
    global $script_complete, $handle, $logdatei_name, $error_including_pfc, $pfc_filename;
    if (!$script_complete) {
        // Script did not finish (max_execution_time?)
        if ($error_including_pfc) {
            chdir(dirname(__FILE__));
            @unlink($pfc_filename);
            $_SESSION['error_including_pfc'] = true;
            die('<p class="meldung_fehler">' . L_ANALYZE_MSG_ERR_CACHE_BROKEN . ' <a href="show_stat.php?clearcache=true&reload=true">' . L_SHOWSTAT_CLEAR_CACHE . '</a></p></body></html>');
        }
        @($c = fgetc($handle));
        while ($c != "\n" && $c !== false) {
            // skip current line
            $c = fgetc($handle);
        }
        save_results('goon');
        // save the current state (variables)
        // print a message with a link to go on analyzing
        echo '<p class="meldung_fehler">';
        echo L_ANALYZE_MSG_ERR_INCOMPLETE . ' ';
        if ($_SESSION['goon_pos'] !== false) {
            echo L_ANALYZE_MSG_ERR_MEMORY_LIMIT . '<br />';
            echo L_ANALYZE_MSG_ERR_TIMEOUT . '<br />';
        } else {
            echo L_ANALYZE_MSG_ERR_UNKNOWN_ERROR;
        }
        echo '<br />' . L_ANALYZE_MSG_ERR_CURRENT_POSITION . ': Byte: ' . $_SESSION['goon_pos'] . '  - ' . $logdatei_name . '<br />';
        echo '<a href="show_stat.php?' . SIDX . '&amp;goon=1';
        foreach ($_GET as $key => $val) {
            echo '&amp;' . $key . '=' . $val;
        }
        echo '">' . L_MSG_ERR_CONTINUE . '</a></p></body></html>';
    }
}
function get_answer($question)
{
    echo "\n------ {$question} ? (y/n/a/c) ";
    while (true) {
        $res = trim(fgetc(STDIN));
        if ($res == 'a') {
            exit;
        }
        if ($res == 'c') {
            save_results();
            exit;
        }
        if ($res == 'y') {
            return true;
        }
        if ($res == 'n') {
            return false;
        }
    }
}