Esempio n. 1
0
{
    $test = new testXCache();
    $result = $test->xCachePass()->{$testmethod}();
    $now = time();
    if ($result != $now) {
        $content = "Current cache was generated " . ($now - $result) . " seconds ago" . HTMLCODE_BR;
    } else {
        $content = "Starting CACHE" . HTMLCODE_BR;
    }
    echo HTMLCODE_HR . "{$title}" . HTMLCODE_BR . "\n        {$content}";
}
/** Examples for xCachePass, apply cache if method start with _ **/
showresults('TEST1', 'test1');
showresults('TEST2', 'test2');
showresults('TEST3', 'mytest');
showresults('TEST4', 'othertest');
/** Examples for xCacheValue, set & get a value from cache **/
echo HTMLCODE_HR . "Cache a value width default TTL" . HTMLCODE_BR;
$testClass = new testXCache();
echo $testClass->xCacheValue("cache_values", "myTestValue", md5('myTestValue'), 'Current date is ' . date('Y-m-d H:i:s'));
echo HTMLCODE_HR . "Cache another value width regexp TTL" . HTMLCODE_BR;
$testClass = new testXCache();
echo $testClass->xCacheValue("cache_values", "varTest", md5('varTest'), 'Current date is ' . date('Y-m-d H:i:s'));
/** Examples for xCacheMethod, set & get a result from and existing method, passing parameters **/
echo HTMLCODE_HR . "Cache a current method" . HTMLCODE_BR;
$testClass = new testXCache();
$params = array('value1', 'value2');
echo $testClass->xCacheMethod("cache_methods", "testXCache_myMethod", md5('testXCache_myMethod' . json_encode($params)), $testClass, 'myMethod', $params);
echo HTMLCODE_HR;
echo "Retrieve a previous saved value." . HTMLCODE_BR;
echo $testClass->xCacheValue("cache_values", "varTest", md5('varTest'));
Esempio n. 2
0
        $fixrounds = true;
        showform($forces['att'], $forces['def']);
        nobattle();
    }
} else {
    showform(array(), array());
    include 'intro.php';
}
if (!$options['nounits'] && $options['legal'] && (!isset($options['gameidok']) or $options['gameidok'] == true)) {
    # $display results or averages
    if ($_REQUEST['reps'] > 1) {
        $results['duration'] = round($duration / $_REQUEST['reps'], 1) - 1;
        $results['ipcdiff'] = $ipcdiff;
        $out = showaverages($results);
    } else {
        $out = showresults($forces, $history, $t);
    }
    if (count($_REQUEST['pbem']) > 0) {
        global $host;
        if ($host == 'localhost') {
            echo '<h1>E-mail not available on localhost</h1>';
        } else {
            if ($_REQUEST['reps'] > 1 or $_REQUEST['battle'] !== 'Run') {
                echo "<em>E-mail not available when swapping or evaluating units or running battle more than once.</em><br />";
            } else {
                //use emogrifier to convert CSS styles in results($out) to in-line styles so colors are preserved in the email
                $cssstr = file_get_contents("aa.css");
                //gets the CSS and puts it's contents into a string
                $converttoinline = new emogrifier($out, $cssstr);
                //instantiates the emogrifier class
                //need to use @ operator to suppress PHP warnings when loading HTML into DOM object
Esempio n. 3
0
        break;
    case 3:
        $output .= '
          <h1>' . lang("ultra", "done") . '</h1>';
        break;
    default:
        //no error
        $output .= '
          <h1>' . lang("ultra", "title") . '</h1>';
}
unset($err);
$output .= '
        </div>';
// this is a pre-filter because mail from outside mail.php is priority
if ($_GET["moneyresult"]) {
    showresults();
}
$action = isset($_GET["action"]) ? $_GET["action"] : NULL;
switch ($action) {
    case "purchase":
        purchase();
        break;
    case "selected_quantity":
        approve();
        break;
    case "selected_item":
        select_quantity();
        break;
    case "selected_char":
        select_item();
        break;
Esempio n. 4
0
            $itemnum[$itsub] = $k + 1 . '-' . ($j + 1);
        }
    } else {
        $itemarr[] = $itel;
        $itemnum[$itel] = $k + 1;
    }
}
echo '<p style="color:#f00;">Warning: Results are not accurate or meaningful for randomized questions</p>';
require "../assessment/displayq2.php";
$questions = array_keys($qdata);
foreach ($itemarr as $k => $q) {
    echo '<div style="border:1px solid #000;padding:10px;margin-bottom:10px;clear:left;">';
    echo '<p><span style="float:right">(Question ID ' . $qsids[$q] . ')</span><b>' . $qsdata[$qsids[$q]][2] . '</b></p>';
    echo '<br class="clear"/>';
    echo '<div style="float:left;width:35%;">';
    showresults($q, $qsdata[$qsids[$q]][0]);
    echo '</div>';
    echo '<div style="float:left;width:60%;margin-left:10px;">';
    displayq($k, $qsids[$q], 0, 0, 0, 0);
    echo '</div>';
    echo '<br class="clear"/>';
    echo '</div>';
}
require "../footer.php";
function showresults($q, $qtype)
{
    global $qdata, $qsids, $qsdata;
    eval(interpret('control', $qtype, $qsdata[$qsids[$q]][1]));
    if ($qtype == 'choices' || $qtype == 'multans' || $qtype == 'multipart') {
        if (isset($choices) && !isset($questions)) {
            $questions =& $choices;