Exemplo n.º 1
0
Arquivo: app.php Projeto: pacew/ccast
function get_ticker()
{
    $q = query("select tick from ticker");
    if (($r = fetch($q)) == NULL) {
        $tick = 1;
        query("insert into ticker (tick) values (?)", $tick);
    } else {
        $tick = intval($r->tick) + 1;
        query("update ticker set tick = ?", $tick);
    }
    do_commits();
    return $tick;
}
Exemplo n.º 2
0
function pfinish()
{
    global $body;
    $ajax = 0;
    if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
        $ajax = 1;
    }
    if ($ajax) {
        echo $body;
        exit;
    }
    $ret = "";
    $ret .= "<!DOCTYPE html PUBLIC" . " '-//W3C//DTD XHTML 1.0 Transitional//EN'" . " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" . "\n";
    $ret .= "<html xmlns='http://www.w3.org/1999/xhtml'" . " id='sixapart-standard'>\n";
    $ret .= "<head>\n";
    $ret .= "<meta http-equiv='Content-Type'" . " content='text/html; charset=utf-8' />\n" . "<script type='text/javascript' src='/mt.js'></script>\n" . "<link rel='stylesheet' type='text/css'" . " href='/zorky.css' media='screen' />\n";
    $ret .= "<title>Zorky</title>\n";
    $ret .= "</head>\n";
    $ret .= "<body>\n";
    echo $ret;
    global $body;
    echo $body;
    $ret = "";
    $ret .= "</body>\n" . "</html>\n";
    echo $ret;
    do_commits();
    exit;
}
Exemplo n.º 3
0
    $jret = json_encode($ret);
    if ($arg_debug == 1) {
        redirect("index.php");
    }
    ob_clean();
    echo json_encode($ret);
    exit;
}
if ($arg_end_game) {
    $ret = (object) NULL;
    $q = query_db($db, "select pid from zorky where wave_id = ?", $arg_end_game);
    if (($r = fetch($q)) != NULL) {
        $pid = 0 + $r->pid;
        posix_kill($pid, 15);
        query_db($db, "delete from zorky where wave_id = ?", $arg_end_game);
        do_commits();
        $ret->display = "game ended";
        echo json_encode($ret);
        exit;
    } else {
        $ret->error = "wave_id not found";
        echo json_encode($ret);
        exit;
    }
}
if ($arg_get_data == 1) {
    $q = query_db($db, "select port" . " from zorky" . " where wave_id = ?", $arg_wave_id);
    if (($r = fetch($q)) == NULL) {
        $ret = (object) NULL;
        $ret->error = "wave_id not found";
        echo json_encode($ret);
Exemplo n.º 4
0
function pfinish()
{
    global $body;
    global $pstart_args;
    if ($pstart_args->nocache) {
        header("Cache-Control: no-store, no-cache, must-revalidate," . " post-check=0, pre-check=0");
        header("Pragma: no-cache");
        header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
    }
    $ajax = 0;
    if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
        $ajax = 1;
    }
    if ($ajax) {
        echo $body;
        exit;
    }
    $ret = "";
    $ret .= "<!DOCTYPE html PUBLIC" . " '-//W3C//DTD XHTML 1.0 Transitional//EN'" . " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" . "\n";
    $ret .= "<html xmlns='http://www.w3.org/1999/xhtml'>\n";
    $ret .= "<head>\n";
    if ($pstart_args->insert_html_head_template) {
        $ret .= html_head();
    }
    if ($pstart_args->extra_head) {
        $ret .= $pstart_args->extra_head;
    }
    if ($pstart_args->page_header->page_title_html) {
        $ret .= sprintf("<title>%s</title>\n", $pstart_args->page_header->page_title_html);
    }
    if ($pstart_args->page_header->page_description_html) {
        $ret .= sprintf("<meta name='description'" . " content='%s' />\n", $pstart_args->page_header->page_description_html);
    }
    if ($pstart_args->page_header->page_keywords_html) {
        $ret .= sprintf("<meta name='keywords'" . " content='%s' />\n", $pstart_args->page_header->page_keywords_html);
    }
    if ($pstart_args->facebook->meta_title_html) {
        $ret .= sprintf("<meta property='og:title'" . " content='%s' />\n", $pstart_args->facebook->meta_title_html);
    }
    if ($pstart_args->facebook->meta_description_html) {
        $ret .= sprintf("<meta property='og:description'" . " content='%s' />\n", $pstart_args->facebook->meta_description_html);
    }
    if ($pstart_args->facebook->meta_type_html) {
        $ret .= sprintf("<meta property='og:type'" . " content='%s' />\n", $pstart_args->facebook->meta_type_html);
    }
    if ($pstart_args->facebook->meta_url_html) {
        $ret .= sprintf("<meta property='og:url'" . " content='%s' />\n", $pstart_args->facebook->meta_url_html);
    }
    if ($pstart_args->facebook->meta_image_html) {
        $ret .= sprintf("<meta property='og:image'" . " content='%s' />\n", $pstart_args->facebook->meta_image_html);
    }
    if ($pstart_args->facebook->meta_site_name_html) {
        $ret .= sprintf("<meta property='og:site_name'" . " content='%s' />\n", $pstart_args->facebook->meta_site_name_html);
    }
    if ($pstart_args->facebook->meta_admins_html) {
        $ret .= sprintf("<meta property='og:admins'" . " content='%s' />\n", $pstart_args->facebook->meta_admins_html);
    }
    $ret .= "</head>\n";
    $c = "";
    if (@$pstart_args->body_class) {
        $c = sprintf("class='%s'", $pstart_args->body_class);
    }
    $i = "";
    if (@$pstart_args->body_id) {
        $i = sprintf("id='%s'", $pstart_args->body_id);
    }
    $ret .= "<body {$c} {$i}>\n";
    $rp = $pstart_args->require_password;
    if ($rp->password && $rp->password_seq) {
        require_password($rp->password, $rp->password_seq);
    }
    $ret .= "<div id='container' class='line'>\n";
    $container_class = "";
    if ($pstart_args->body->fluid_layout) {
        $container_class = sprintf("class='%s'", "fluid");
    }
    $ret .= "<div id='container-inner' {$container_class}>\n";
    if ($pstart_args->insert_banner_header_template) {
        $ret .= banner_header();
    }
    if ($pstart_args->content_wrapper) {
        $ret .= "<div id='content'>\n" . "<div id='content-inner'>\n";
    }
    $ret .= main_nav();
    if ($pstart_args->alpha_wrapper) {
        $alpha_class = "";
        if (!$pstart_args->insert_sidebar_template) {
            $alpha_class = sprintf("class='%s'", "no-sidebar");
        }
        $ret .= "<div id='alpha' {$alpha_class}>\n";
        $ret .= "<div id='alpha-inner'>\n";
    }
    global $prev_flash;
    if ($prev_flash) {
        $ret .= "<div class='flash_alert'>\n";
        $ret .= $prev_flash;
        $ret .= "</div>\n";
    }
    echo $ret;
    global $body;
    echo $body;
    $ret = "";
    if ($pstart_args->alpha_wrapper) {
        $ret .= "</div>\n" . "</div>\n";
    }
    if ($pstart_args->insert_sidebar_template) {
        $ret .= sidebar();
    }
    if ($pstart_args->content_wrapper) {
        $ret .= "</div>\n" . "</div>\n";
    }
    if ($pstart_args->insert_banner_footer_template) {
        $ret .= banner_footer();
    }
    global $extra_scripts;
    $ret .= $extra_scripts;
    global $extra_javascript;
    if (@$extra_javascript) {
        $ret .= "<script type='text/javascript'>\n";
        $ret .= $extra_javascript;
        $ret .= "</script>\n";
    }
    /* end container and container inner*/
    $ret .= "</div>\n";
    $ret .= "</div>\n";
    $ret .= "</body>\n" . "</html>\n";
    echo $ret;
    do_commits();
    if (session_id()) {
        session_write_close();
    }
    exit;
}