Exemplo n.º 1
0
    exit;
}
if (isset($_GET["openvpn-rebuild-certificate"])) {
    openvpn_rebuild_certificates();
    exit;
}
if (isset($_GET["OpenVPNServerSessions"])) {
    openvpn_sesssions();
    exit;
}
if (isset($_GET["openvpn-client-sesssions"])) {
    openvpn_client_sesssions();
    exit;
}
if (isset($_GET["read-log"])) {
    read_log();
    exit;
}
//roundcube
if (isset($_GET["roundcube-restart"])) {
    RoundCube_restart();
    exit;
}
if (isset($_GET["roundcube-install-sieverules"])) {
    RoundCube_sieverules();
    exit;
}
if (isset($_GET["roundcube-install-calendar"])) {
    RoundCube_calendar();
    exit;
}
Exemplo n.º 2
0
function main()
{
    global $globals;
    global $id_file;
    global $mass_email_log;
    $startid = read_log();
    $f = fopen($mass_email_log, 'a');
    if ($id_file == "") {
        while (1) {
            $new_startid = do_batch($startid, $globals->batch, $f);
            if ($new_startid == $startid) {
                break;
            }
            $startid = $new_startid;
        }
    } else {
        $fid = fopen($id_file, 'r');
        if (!$fid) {
            echo $id_file . ' not found - create ID list and run again\\n';
            exit;
        }
        $thisid = 0;
        while (fscanf($fid, '%d', &$thisid)) {
            if ($thisid > $startid) {
                do_one($thisid, $f);
            }
        }
        fclose($fid);
    }
    echo 'All done!' . "\n";
}
            }
            $lastpos = ftell($f);
            fclose($f);
        }
    }
}
if (isset($argv[1])) {
    if (strcmp($argv[1], "start") === 0) {
        $settings = get_settings($settingsfile);
        read_log($settings);
    } elseif (strcmp($argv[1], "stop") === 0) {
        //Get parameters from oldsettingsfile
        $settings = get_settings($oldsettingsfile);
        foreach ($settings["c_ary"] as $name => $val) {
            delip($name, $settings);
        }
        exit(0);
    } elseif (strcmp($argv[1], "restart") === 0) {
        //Get parameters from oldsettingsfile
        $settings = get_settings($oldsettingsfile);
        foreach ($settings["c_ary"] as $name => $val) {
            delip($name, $settings);
        }
        //Get parameters from settingsfile
        $settings = get_settings($settingsfile);
        foreach ($settings["c_ary"] as $name => $val) {
            setip($name, $settings);
        }
        read_log($settings);
    }
}
Exemplo n.º 4
0
function page_result()
{
    global $site;
    if (!isset($_SESSION['log']) || !file_exists($site['dir'] . '/log/' . $_SESSION['log'])) {
        redirect();
    } else {
        $log = read_log();
    }
    if (empty($log['completed'])) {
        redirect();
    }
    $total_seconds = $log['end'] - $log['start'];
    $time_spent = calculate_duration($total_seconds);
    $total_questions = count($log['questions']);
    $total_correct = 0;
    $total_incorrect = 0;
    foreach ($log['questions'] as $question) {
        if ($question['question']['meaning'] == $question['answer']) {
            $total_correct++;
        } else {
            $total_incorrect++;
        }
    }
    $success_rate = min(array(round($total_correct * 100 / $total_questions), 100));
    $messages = array(95 => array('Excellent!', 'You have answered all of the questions correctly. You seem to have mastered first grade Kanji. Now on to the next level. Good luck!'), 75 => array('Great job!', 'You have answered most of the questions correctly. You seem to have a solid knowledge of first grade Kanji but make sure you review your incorrect answers.'), 50 => array('Good try...', 'Your knowledge of first grade Kanji is just above average. Make sure to carefully review your incorrect answers. You may want to go over your study materials as well.'), 25 => array('Not bad...', 'Your knowledge of first grade Kanji is below the average. It would be a really good idea to review your study materials.'), -1 => array('Oops!', 'You could not answer most of the questions correctly. Make sure to review your study materials and take the test again.'));
    foreach ($messages as $limit => $message) {
        if ($success_rate > $limit) {
            $feedback = $message;
            break;
        }
    }
    echo '
			<h2><span>', $feedback[0], '</span></h2>
			<p>', $feedback[1], '</p>
			<h2><span>Summary</span></h2>
			<dl>
				<dt>Number of questions:</dt>
				<dd>', $total_questions, '</dd>
				<dt>Number of correct answers:</dt>
				<dd>', $total_correct, '</dd>
				<dt>Number of incorrect answers:</dt>
				<dd>', $total_incorrect, '</dd>
				<dt>Success rate:</dt>
				<dd>%', $success_rate, '</dd>
				<dt>Time spent:</dt>
				<dd>', $time_spent, '</dd>
			</dl>
			<h2><span>Review</span></h2>
			<p>You can review your answers clicking on the questions below. The alternative marked with green is the correct answer, whereas the one marked with red is the alternative you have chosen for the incorrect answers. The time you spent on the question is given next to the question number as well.</p>';
    foreach ($log['questions'] as $number => $question) {
        echo '
			<h3><a href="#review_', $number, '" onclick="toggle_question(', $number, '); return false;">Question ', $number, '</a> - ', $question['question']['meaning'] == $question['answer'] ? '<span class="correct">[correct]</span>' : '<span class="incorrect">[incorrect]</span>', ' - (', calculate_duration($question['end'] - $question['start']), ')</h3>
			<div id="review_', $number, '" style="display: none;" class="review">
				<div>', $question['question']['parsed'], '</div>
				<ul>';
        foreach ($question['options'] as $option) {
            $class = '';
            if ($option['meaning'] == $question['answer']) {
                $class = 'incorrect';
            }
            if ($option['meaning'] == $question['question']['meaning']) {
                $class = 'correct';
            }
            echo '
					<li><span class="', $class, '">', $option['meaning'], ' (', $option['parsed'], ')</span></li>';
        }
        echo '
				</ul>
			</div>';
    }
    echo '
			<script type="text/javascript"><!-- // --><![CDATA[
				function toggle_question(item)
				{
					var review_item = document.getElementById("review_" + item);
					review_item.style.display = review_item.style.display == "" ? "none" : "";
				}
			// ]]></script>';
}
Exemplo n.º 5
0
if(isset($_GET["restart-mysql"])){RestartMysqlDaemon();exit;}


if(isset($_GET["restart-openvpn-server"])){RestartOpenVPNServer();exit;}
if(isset($_GET["openvpn-rebuild-certificate"])){openvpn_rebuild_certificates();exit;}
if(isset($_GET["OpenVPNServerSessions"])){openvpn_sesssions();exit;}
if(isset($_GET["openvpn-client-sesssions"])){openvpn_client_sesssions();exit;}
if(isset($_GET["openvpn-server-schedule"])){openvpn_server_exec_schedule();exit;}
if(isset($_GET["openvpn-status"])){openvpn_server_status();exit;}
if(isset($_GET["openvpn-clients-status"])){openvpn_clients_status();exit;}





if(isset($_GET["read-log"])){read_log();exit;}

//roundcube
if(isset($_GET["roundcube-restart"])){RoundCube_restart();exit;}
if(isset($_GET["roundcube-install-sieverules"])){RoundCube_sieverules();exit;}
if(isset($_GET["roundcube-install-contextmenu"])){RoundCube_contextmenu();exit;}
if(isset($_GET["roundcube-install-calendar"])){RoundCube_calendar();exit;}
if(isset($_GET["roundcube-install-globaladdressbook"])){RoundCube_globaladdressbook();exit;}
if(isset($_GET["roundcube-hack"])){RoundCube_hack();exit;}



if(isset($_GET["roundcube-sync"])){RoundCube_sync();exit;}