function toScreen(Error $error)
    {
        extract($error->toArray());
        $frmt = formatter('<li>%s <em>in</em> %s</li>');
        $msg = date('H:i:s') . " {$component} {$signal} at {$place} - {$title}\n";
        $trace = join(array_map($frmt, format_trace($error->getTrace())));
        return <<<HTML
<style type="text/css">
.Debug { font-family:Calibri,Arial,sans-serif; border:1px solid #D86; padding:0 0 .7em .5em; margin:.5em 0 }
.Debug PRE { font-family:Consolas,Courier,monospace; margin:0; }
.Debug SMALL { color:#777; }
.Debug H1 { font-size:1.3em; margin:5px 0 0 0; color: #F75; }
.Debug H1 SMALL { font-size:.8em; color: #777; }
.Debug H1 SMALL STRONG { color: #000; }
.Debug H2 { font-size:1em; background-color:#EE9; margin:.5em 0 0 -8px; padding:.3em 10px; }
.Debug H3 { font-size:1em; margin:0 -8px; padding:0 10px .2em 10px; }
.Debug H4 { font-size:.9em; margin:7px 0 10px 1px; float:left; }
.Debug UL { font-size:1em; margin:5px 5px 0 0; padding-left:1.7em; list-style:none; }
</style>
<div class="Debug">
<h1>Unhandled exception
<small>at {$place}</small></h1>
<h2>{$msg}</h2>
<h4>Via:</h4>
<ul>{$trace}</ul>
</div>
HTML;
    }
/**
 * Returns a string representation of an array
 * 
 * @param  array  $array  Array to be stringified
 * @param  bool   $html   Whether to prettify output with HTML and CSS
 * @return string         String representation of input array
 */
function array_to_string($array, $html = false)
{
    $fn = formatter($html ? '<em>%s</em>' : '%s');
    $s1 = $html ? "\n" : '';
    $s2 = $html ? "&nbsp;&nbsp;&nbsp;" : ' ';
    $OUT = array();
    $MAX = array_reduce(array_map('strlen', array_keys($array)), 'max');
    foreach ($array as $key => $val) {
        $SPACER = str_repeat('&nbsp;', max($MAX - strlen($key), 0));
        $OUT[] = to_string($key) . $SPACER . $fn(' = ') . str_replace("\n", $s2, to_string($val));
    }
    return $fn("[{$s2}") . join(",{$s2}", $OUT) . $fn("{$s1}]");
}
    foreach ($row as $key => $value) {
        $row[$key] = preg_replace("/\"/", "\"\"", $value);
    }
    fprintf($handle, "\"%s\"\n", implode("\",\"", $row));
}
/*********************************************************************/
$filter = $argv[1];
$in = $argv[2];
$out = $argv[3];
// Process the input file
if (!file_exists($in)) {
    print_usage_and_exit("File {$in} not found");
}
$csv = read_input($in, isset($argv[5]) ? $argv[5] : ',');
// Filter the CSV data for conversion
if (!@(include $filter)) {
    print_usage_and_exit("Could not include filter script {$in}");
}
$conf = formatter_filter($csv);
$conf["start_at"] = isset($conf["start_at"]) ? $conf["start_at"] : 1;
$conf["id"] = isset($conf["id"]) ? $conf["id"] : 0;
$conf["rows"] = isset($conf["rows"]) ? $conf['rows'] : array();
$csv = formatter($csv, $conf);
// Write the output
$handle = fopen($out, 'w');
if (!$handle) {
    // print_error_and_exit('Could not create output file');
}
write_output($handle, $csv);
fclose($handle);
print "Successfully format all test cases\n";
Beispiel #4
0
        } else {
            $db = "asos";
            $sql = sprintf("SELECT *, mslp as pres, metar as raw, p01i as phour,\n\t\t\t\tnull as relh\n\t\t\t\tfrom alldata where\n\t\t\t\tstation = \$1  and valid  >= \$3 and valid  < \$4\n\t\t\t\tand \$2 = \$2 ORDER by valid DESC");
        }
    }
}
$dbconn = iemdb($db);
pg_query($dbconn, "SET TIME ZONE '" . $metadata["tzname"] . "'");
$rs = pg_prepare($dbconn, "_MYSELECT", $sql);
$rs = pg_execute($dbconn, "_MYSELECT", array($station, $network, date("Y-m-d", $date), date("Y-m-d", $date + 90400)));
$table = "";
for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) {
    if ($row['dwpf'] == null && $row['relh'] != null) {
        $row['dwpf'] = dwpf($row["tmpf"], $row["relh"]);
    }
    $table .= formatter($i, $row);
}
pg_close($dbconn);
include "../../include/myview.php";
$t = new MyView();
$t->thispage = "iem-sites";
$t->title = "Observation History";
$t->sites_current = 'obhistory';
$savevars = array("year" => date("Y", $date), "month" => date("m", $date), "day" => date("d", $date));
$t->jsextra = <<<EOF
<script type="text/javascript">
var hide = false;
function hideMetars(){
\tvar table = document.getElementById("datatable");
\tvar len = table.rows.length;
\tvar rowStyle = (hide)? "none":"table-row";
function forum_banned()
{
    global $db, $r, $h;
    print '

<div class="generalinfo_txt">
<div><img src="images/info_left.jpg"alt=""/></div>
<div class="info_mid"><h2 style="padding-top:10px;"> Forum Banned Users</h2></div>
<div><img src="images/info_right.jpg"alt=""/></div> </div>
<div class="generalinfo_simple"><br> <br><br>


<table border="1" width="100%" class="table" cellspacing="0" cellpadding="2">
    <tr style="text-align:center;">
        <th>Who</th>
        <th>Time Left</th>
        <th>Reason</th>
    </tr>
    ';
    $q = $db->query("SELECT `userid`,`username`,`forumban`,`fb_reason` FROM users WHERE `forumban` > 0 ORDER BY `forumban` DESC");
    while ($r = $db->fetch_row($q)) {
        print "<tr>\r\n<td><a href='viewuser.php?u=" . $r['userid'] . "'>" . formatter($r['username']) . "</a></td>\r\n<td>" . formatter($r['forumban']) . "</td>\r\n<td>" . formatter($r['fb_reason']) . "</td></tr>";
    }
    echo "</table></div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div>";
}