コード例 #1
0
ファイル: index.php プロジェクト: scarnago/pipecode
$page = http_get_int("page", array("default" => 1, "required" => false));
print_header();
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "stories");
writeln('</td>');
writeln('<td class="fill">');
$stories_per_page = 10;
$row = run_sql("select count(sid) as story_count from story");
$story_count = (int) $row[0]["story_count"];
$pages_count = ceil($story_count / $stories_per_page);
$story_start = ($page - 1) * $stories_per_page;
$row = run_sql("select sid from story order by sid desc limit {$story_start}, {$stories_per_page}");
for ($i = 0; $i < count($row); $i++) {
    print_story($row[$i]["sid"], "middle");
}
$s = "";
for ($i = 1; $i <= $pages_count; $i++) {
    if ($i == $page) {
        $s .= "{$i} ";
    } else {
        $s .= "<a href=\"?page={$i}\">{$i}</a> ";
    }
}
writeln('<div style="text-align: center">' . trim($s) . '</div>');
writeln('</td>');
writeln('<td class="right_col">');
if ($auth_zid != "") {
    print_user_box();
}
コード例 #2
0
ファイル: topic.php プロジェクト: scarnago/pipecode
$topic = $s2;
print_header("Topics");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
if ($topic == "") {
    print_left_bar("main", "topics");
} else {
    print_left_bar("main", $topic);
}
writeln('</td>');
writeln('<td class="fill">');
if ($topic == "") {
    writeln('<h1>Topics</h1>');
    $list = db_get_list("topic", "topic");
    $k = array_keys($list);
    for ($i = 0; $i < count($list); $i++) {
        $topic = $list[$k[$i]];
        writeln('<a href="/topic/' . $topic["topic"] . '"><div class="topic_box"><img alt="' . $topic["icon"] . '" src="/images/' . $topic["icon"] . '-64.png"/>' . $topic["topic"] . '</div></a>');
    }
} else {
    $topic = db_get_rec("topic", array("topic" => $topic));
    $row = run_sql("select sid from story where tid = ? order by sid desc", array($topic["tid"]));
    for ($i = 0; $i < count($row); $i++) {
        print_story($row[$i]["sid"]);
    }
}
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
コード例 #3
0
ファイル: root.php プロジェクト: scarnago/pipecode
    $hide_value = $auth_user["hide_threshold"];
    $expand_value = $auth_user["expand_threshold"];
} else {
    $can_moderate = false;
    $hide_value = -1;
    $expand_value = 0;
}
$story = db_get_rec("story", $sid);
print_header($story["title"]);
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "stories");
writeln('</td>');
writeln('<td class="fill">');
print_story($sid);
//print_story($sid, true, false);
if ($javascript_enabled) {
    render_sliders($sid, 0, 0);
    print_noscript();
} else {
    render_page($sid, 0, 0, false);
}
writeln('</td>');
writeln('</tr>');
writeln('</table>');
if ($javascript_enabled) {
    writeln('<script>');
    writeln();
    writeln('var hide_value = ' . $hide_value . ';');
    writeln('var expand_value = ' . $expand_value . ';');