Exemplo n.º 1
0
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();
}
$row = run_sql("select max(qid) as qid from poll_question");
$qid = $row[0]["qid"];
vote_box($qid, false, true);
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
Exemplo n.º 2
0
    $can_moderate = true;
    $hide_value = $auth_user["hide_threshold"];
    $expand_value = $auth_user["expand_threshold"];
} else {
    $can_moderate = false;
    $hide_value = -1;
    $expand_value = 0;
}
print_header("Poll");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "poll");
writeln('</td>');
writeln('<td class="fill">');
vote_box($qid, true, false);
if ($javascript_enabled) {
    render_sliders(0, 0, $qid);
    print_noscript();
} else {
    render_page(0, 0, $qid, 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 . ';');
    writeln('var auth_zid = "' . $auth_zid . '";');
Exemplo n.º 3
0
        } else {
            if ($type_id == 3) {
                for ($i = 0; $i < count($aids); $i++) {
                    $aid = $keys[$i];
                    if ($aids[$aid] === "") {
                        $points = 0;
                    } else {
                        $points = $max + (int) $aids[$aid] * -1 + 1;
                    }
                    if ($points > 0) {
                        run_sql("insert into poll_vote (qid, aid, zid, time, points) values (?, ?, ?, ?, ?)", array($qid, $aid, $auth_zid, time(), $points));
                    }
                }
            }
        }
    }
    header("Location: /poll/{$qid}/{$clean}");
    die;
}
print_header("Poll");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "poll");
writeln('</td>');
writeln('<td class="fill">');
vote_box($qid, true, true);
writeln('		</td>');
writeln('	</tr>');
writeln('</table>');
print_footer();