Esempio n. 1
0
function show_results($result, $id, $indent = null)
{
    foreach ($result[$id] as $value) {
        echo "{$indent}{$value}<br/>";
        if (isset($result["{$value}"])) {
            show_results($result, $value, $indent . implode('&nbsp;', array_fill(0, 12, '')));
        }
    }
}
Esempio n. 2
0
function start_benchmark()
{
    $pdo = new PDO(BENCHMARK_DSN, BENCHMARK_USER, BENCHMARK_PASS);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $queue = new MyQueue($pdo, BENCHMARK_QNAME);
    setup_table($pdo, BENCHMARK_QNAME);
    $results = array();
    try {
        $results['push'] = benchmark_push($queue, BENCHMARK_MSG_NUM);
        $results['pop'] = benchmark_pop($queue, BENCHMARK_MSG_NUM);
    } catch (Exception $e) {
        drop_table($pdo, BENCHMARK_QNAME);
        throw $e;
    }
    show_results($results, BENCHMARK_MSG_NUM);
    drop_table($pdo, BENCHMARK_QNAME);
}
Esempio n. 3
0
                }
                $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form);
                $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form);
                print $sel_search_form;
                show_results($dbh, $user_input, $nbr_lignes, $page);
            } else {
                print "<script type='text/javascript'>\n\t\t\t\t\t\twindow.close();\n\t\t\t\t\t</script>";
            }
        }
        break;
    default:
        $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form);
        $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form);
        print $sel_search_form;
        print $jscript;
        show_results($dbh, $user_input, $nbr_lignes, $page);
        break;
}
function show_results($dbh, $user_input, $nbr_lignes = 0, $page = 0, $id = 0)
{
    global $nb_per_page;
    global $base_url;
    global $caller;
    global $charset;
    global $msg;
    global $expl_list_id;
    // on récupére le nombre de lignes qui vont bien
    if (!$id) {
        if ($user_input == "") {
            $requete = "SELECT COUNT(1) FROM groupexpl";
        } else {
Esempio n. 4
0
$form->add('label', 'label_room', 'room', 'Which room would you like to reserve:');
$obj = $form->add('radios', 'room', array('A' => 'Room A', 'B' => 'Room B', 'C' => 'Room C'));
$obj->set_rule(array('required' => array('error', 'Room selection is required!')));
// "extra"
$form->add('label', 'label_extra', 'extra', 'Extra requirements:');
$obj = $form->add('checkboxes', 'extra[]', array('flipchard' => 'Flipchard and pens', 'plasma' => 'Plasma TV screen', 'beverages' => 'Coffee, tea and mineral water'));
// "date"
$form->add('label', 'label_date', 'date', 'Reservation date');
$date = $form->add('date', 'date');
$date->set_rule(array('required' => array('error', 'Date is required!'), 'date' => array('error', 'Date is invalid!')));
// date format
// don't forget to use $date->get_date() if the form is valid to get the date in YYYY-MM-DD format ready to be used
// in a database or with PHP's strtotime function!
$date->format('M d, Y');
// selectable dates are starting with the current day
$date->direction(1);
$form->add('note', 'note_date', 'date', 'Date format is M d, Y');
// "time"
$form->add('label', 'label_time', 'time', 'Reservation time :');
$form->add('time', 'time', '', array('hours' => array(9, 10, 11, 12, 13, 14, 15, 16, 17), 'minutes' => array(0, 30)));
// "submit"
$form->add('submit', 'btnsubmit', 'Submit');
// if the form is valid
if ($form->validate()) {
    // show results
    show_results();
    // otherwise
} else {
    // generate output using a custom template
    $form->render('includes/custom-templates/reservation.php');
}
Esempio n. 5
0
    $res = $db->query("select * from games\n        where pb like '%{$query}%' or pw like '%{$query}%' or ev like '%{$query}%' or date like '%{$query}%'\n        order by date desc\n        limit 300");
    $games = array();
    while ($game = $res->fetchArray()) {
        $games[] = $game;
    }
    if (!count($games)) {
        echo "<p>No games found matching &quot;{$query}&quot;.</p>";
        return;
    }
    echo "<p>" . count($games) . " games found, newest listed first:</p>\n        <table id='tourney-games'>\n        <tr><th>Date</th><th>Event</th><th>White</th><th>Black</th><th>Result</th></tr>";
    $class = "";
    foreach ($games as $game) {
        $class = $class == "odd" ? "even" : "odd";
        $gn = str_replace(".sgf", "", $game['filename']);
        echo "<tr class='{$class}'>\n";
        echo join("", array_map(create_function('$s', 'return "<td><a href=\\"./#' . $gn . '\\">" . $s . "</a></td>\\n";'), array($game['date'], $game['EV'], $game['PW'], $game['PB'], $game['RE'])));
        echo "</tr>";
    }
}
if ($_GET['q']) {
    show_results($_GET['q']);
} else {
    echo "<p>The game archive contains a representative sample of games from the last few hundred years.\n        Enter a query above to search by player name, event name, or date.</p>\n        <p>Many games come from GoGoD, with their permission. If you are interested in having a full\n        collection of well over 50,000 pro games along with other enriching materials, please purchase their\n        product (<a href='http://www.gogod.co.uk'>http://www.gogod.co.uk</a>).</p>";
}
?>
</table>

</div>

<?php 
include "footer.phtml";
Esempio n. 6
0
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: coordonnees.inc.php,v 1.5 2009-05-16 10:52:44 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
// la variable $caller, passée par l'URL, contient le nom du form appelant
$base_url = "./select.php?what=coord&caller={$caller}&param1={$param1}&param2={$param2}&param3={$param3}&id_bibli={$id_bibli}&no_display={$no_display}&bt_ajouter={$bt_ajouter}";
// contenu popup sélection fournisseur
require_once './selectors/templates/sel_coordonnees.tpl.php';
require_once $class_path . '/entites.class.php';
// affichage du header
print $sel_header;
print $jscript;
show_results($dbh, $nbr_lignes, $page);
// affichage des membres de la page
function show_results($dbh, $nbr_lignes = 0, $page = 0)
{
    global $nb_per_page;
    global $base_url;
    global $caller;
    global $charset;
    global $msg;
    global $id_bibli;
    // on récupére le nombre de lignes qui vont bien
    $nbr_lignes = entites::count_coordonnees($id_bibli);
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
Esempio n. 7
0
            print pmb_bidi("\n \t\t\t<a href='#' onclick=\"set_parent('{$caller}', '{$empr->id_empr}', '" . htmlentities(addslashes($empr_entry), ENT_QUOTES, $charset) . " ({$empr->empr_cb})')\">\n\t\t\t\t{$empr_entry}</a>");
            print pmb_bidi(' <i><small>' . $empr->lieu . '</small></i> (' . $empr->empr_cb . ')');
            print "<br />";
        }
        mysql_free_result($res);
        // constitution des liens
        $nbepages = ceil($nbr_lignes / $nb_per_page);
        $suivante = $page + 1;
        $precedente = $page - 1;
        // affichage du lien précédent si nécéssaire
        print '<hr /><div align=center>';
        if ($precedente > 0) {
            print "<a href='{$base_url}&page={$precedente}&nbr_lignes={$nbr_lignes}&user_input={$user_input}'><img src='./images/left.gif' border='0' title='{$msg['48']}' alt='[{$msg['48']}]' hspace='3' align='middle' /></a>";
        }
        for ($i = 1; $i <= $nbepages; $i++) {
            if ($i == $page) {
                print "<b>{$i}/{$nbepages}</b>";
            }
        }
        if ($suivante <= $nbepages) {
            print "<a href='{$base_url}&page={$suivante}&nbr_lignes={$nbr_lignes}&user_input={$user_input}'><img src='./images/right.gif' border='0' title='{$msg['49']}' alt='[{$msg['49']}]' hspace='3' align='middle' /></a>";
        }
    }
    print '</div>';
}
// affichage des membres de la page
$sel_search_form = str_replace("!!deb_rech!!", stripslashes($f_user_input), $sel_search_form);
print $sel_search_form;
print $jscript;
show_results($dbh, $user_input, $nbr_lignes, $page, $rech_regexp);
print $sel_footer;
Esempio n. 8
0
<!doctype html>
<html>
 <head>
  <title>wpa_cli_php demo</title>
 </head>
 <body>
 <?php 
include "wpa_cli.php";
$wpa_cli = new wpa_cli();
while (true) {
    if ($wpa_cli->scan() === true) {
        show_status($wpa_cli);
        show_results($wpa_cli);
        break;
    } else {
        sleep(0.5);
    }
}
function show_status($wpa_cli)
{
    $status = $wpa_cli->status();
    echo <<<EOF
 <h2>status()</h2>
 <table>
  <thead>
   <tr>
    <th>key</th>
    <th>value</th>
   </tr>
  </thead>
  <tbody>
$reqs['Clone Objects check'] = array("impact" => MUSTHAVE, "evaluate" => "!ini_get('zend.ze1_compatibility_mode');", "tip" => "set zend.ze1_compatibility_mode to Off");
$reqs['Magic quotes check'] = array("impact" => MUSTHAVE, "evaluate" => "!ini_get('magic_quotes_runtime');", "tip" => "set magic_quotes_runtime to Off");
?>
<html>
<head></head>
<body>
<pre>

<?php 
echo APPLICATION_NAME;
?>
 REQUIREMENTS CHECKER $Revision: 1.3 $  $Date: 2005/06/18 12:27:06 $
--------------------------------------------------------------

<?php 
show_results(check_requirements($reqs));
?>

--------------------------------------------------------------
* Fix all the <b>blocking</b> requirements.
* Fix all the <b>musthave</b> requirements.
* Try to fix all the <b>shouldhave</b> requirements.

Finished!
</pre>
</body>
</html>
<?php 
/** Base functions **/
/**
 * Checks requirements by evaluating an expression. If the result is true,
        ?>
        <div class="tab-pane" id="failed">
          <?php 
        print "<table id='errors' class='table-striped'><thead><th>Test</th><th>Result</th></thead><tbody>";
        echo show_results($json, $fails);
        print "</tbody></table>";
        ?>
        </div>
      <?php 
    }
    ?>
      
      <div class="tab-pane" id="warnings">
        <?php 
    print "<table id='errors' class='table-striped'><thead><th>Test</th><th>Result</th></thead><tbody>";
    echo show_results($json, $all_warnings, TRUE);
    print "</tbody></table>";
    ?>
      </div>

  </div><!-- /tab-content-->
 
<?php 
}
/*
 * 
 * name: count_results
 * @param array $results  An array of result data
 * @param string $type    Type of result we're interested in
 * @param int             0=fail, 1=pass, 2=all Specify if we are interested in passes or fails
 * @return
Esempio n. 11
0
error_reporting(E_ALL);
ini_set('display_errors', 'On');
if (empty($settings['show_res_secret'])) {
    die("Not configured\n");
}
if ($argv[2] != $settings['show_res_secret']) {
    die("Usage: php show_res.php <mode> <secret>\n");
}
if ($argv[1] == "db") {
    $res = get_db_results();
}
if ($argv[1] == "file") {
    $res = get_file_results();
}
$res = transcode_results($res);
show_results($res);
exit;
function get_db_results()
{
    $db = db_connect();
    $res = $db->query("SELECT choice FROM ballot_box");
    $out = array();
    while ($obj = $res->fetch_object()) {
        $out[] = $obj->choice;
    }
    $res->close();
    db_close($db);
    return $out;
}
function get_file_results()
{