示例#1
0
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
define('IN_APP', 1);
define('DS', DIRECTORY_SEPARATOR);
define('APP_ROOT', __DIR__ . DS . '..' . DS);
define('CORE_ROOT', APP_ROOT . 'core' . DS);
include APP_ROOT . 'config/common.php';
require CORE_ROOT . 'function.php';
require CORE_ROOT . 'app.php';
init_env();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <title>Test for Cheng</title>
    <link rel="stylesheet" type="text/css" href="static/style.css" />
</head>
<body>
    <h1><a href="?">Test for Cheng</a></h1>
    <a href="/">exit</a>
    <a class="clear btn" href="?exit=1">clear all side effects in db</a>
    <div class="conclusion fail" id="pre-box">SOME FAIL!</div>
    <ol><?php 
include 'test.php';
?>
</ol>
    <div class="conclusion <?php 
echo $all_pass ? 'pass' : 'fail';
        echo apc_fetch("key:" . $time);
        return true;
    }
    return false;
}
function init_env($time)
{
    chdir("/home/crowler/");
    init_db();
    $symbols = find_symbols_list();
    add_debug($time);
    return $symbols;
}
function generate_output($symbols, $time)
{
    $var = "";
    foreach ($symbols as $s) {
        $sym = get_symbol_name($s);
        $var .= "{$sym}>";
        $var .= print_news($s, $time);
        $var .= "\n";
    }
    apc_add("key:" . $time, $var);
    echo $var;
}
$time = isset($_GET["time"]) ? $_GET["time"] : 0;
if (try_cache($time) == true) {
    return;
}
$symbols = init_env($time);
generate_output($symbols, $time);