コード例 #1
0
ファイル: search.php プロジェクト: scarnago/pipecode
                } else {
                    if ($haystack == "polls") {
                        $title = $row[$i]["question"];
                        $link = "/poll/" . $row[$i]["qid"];
                        $body = "";
                        $zid = $row[$i]["zid"];
                    }
                }
            }
        }
        search_result($title, $link, $zid, $row[$i]["time"], $body);
    }
    writeln('</main>');
    writeln('</td>');
    writeln('</tr>');
    writeln('</table>');
    print_footer();
    die;
}
print_header("Search");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "search");
writeln('</td>');
writeln('<td class="fill">');
search_box();
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
コード例 #2
0
ファイル: edit.php プロジェクト: scarnago/pipecode
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
if ($zid != $auth_zid) {
    die("not your page");
}
print_header();
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("account", "feed");
writeln('</td>');
writeln('<td class="fill">');
writeln('<table class="fill">');
writeln('	<tr>');
for ($c = 0; $c < 3; $c++) {
    writeln('		<td class="feed_box">');
    writeln('			<table class="zebra">');
    $r = 0;
    $row = run_sql("select feed_user.fid, title from feed_user inner join feed on feed_user.fid = feed.fid where zid = ? and col = ? order by pos", array($auth_zid, $c));
    if (count($row) == 0) {
        writeln('				<tr><td>(no feeds)</td></tr>');
    }
    for ($i = 0; $i < count($row); $i++) {
        writeln('				<tr>');
        writeln('					<td>' . $row[$i]["title"] . '</td>');
コード例 #3
0
ファイル: submit.php プロジェクト: scarnago/pipecode
function print_submit_box($title, $body, $story, $tid, $preview)
{
    global $auth_zid;
    global $auth_user;
    print_header("Submit Story");
    writeln('<table class="fill">');
    writeln('<tr>');
    writeln('<td class="left_col">');
    print_left_bar("main", "pipe");
    writeln('</td>');
    writeln('<td class="fill">');
    if ($preview) {
        $a["zid"] = $auth_zid;
        $topic = db_get_rec("topic", $tid);
        $a["title"] = $title;
        $a["topic"] = $topic["topic"];
        $a["icon"] = $topic["icon"];
        $a["story"] = $story;
        writeln('<h1>Preview</h1>');
        writeln('<p>Check your links before you post!</p>');
        print_article($a);
    }
    writeln('<form method="post">');
    writeln('<div class="dialog_title">Submit Story</div>');
    writeln('<div class="dialog_body">');
    writeln('<table class="fill" style="padding: 0px">');
    writeln('	<tr>');
    writeln('		<td style="width: 80px">Title</td>');
    writeln('		<td colspan="2"><input name="title" type="text" value="' . $title . '" required="required"/></td>');
    writeln('	</tr>');
    writeln('	<tr>');
    writeln('		<td style="width: 80px">Topic</td>');
    writeln('		<td colspan="2">');
    writeln('			<select name="tid">');
    $topics = db_get_list("topic", "topic", array("promoted" => 1));
    $k = array_keys($topics);
    for ($i = 0; $i < count($topics); $i++) {
        $topic = $topics[$k[$i]];
        if ($topic["tid"] == $tid) {
            writeln('				<option value="' . $topic["tid"] . '" selected="selected">' . $topic["topic"] . '</option>');
        } else {
            writeln('				<option value="' . $topic["tid"] . '">' . $topic["topic"] . '</option>');
        }
    }
    writeln('			</select>');
    writeln('		</td>');
    writeln('	</tr>');
    writeln('	<tr>');
    writeln('		<td style="width: 80px; vertical-align: top; padding-top: 12px">Story</td>');
    writeln('		<td colspan="2"><textarea name="story" style="height: 200px" required="required">' . $body . '</textarea></td>');
    writeln('	</tr>');
    writeln('	<tr>');
    $question = captcha_challenge();
    writeln('		<td>Captcha</td>');
    writeln('		<td><table><tr><td>' . $question . '</td><td><input name="answer" type="text" style="margin-left: 8px; width: 100px"/></td></tr></table></td>');
    writeln('		<td class="right"><input type="submit" value="Submit"/> <input name="preview" type="submit" value="Preview"/></td>');
    writeln('	</tr>');
    writeln('</table>');
    writeln('</div>');
    writeln('</form>');
    writeln('</td>');
    writeln('</tr>');
    writeln('</table>');
    print_footer();
}
コード例 #4
0
ファイル: index.php プロジェクト: scarnago/pipecode
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "feed.php";
print_header();
if ($user_page == "") {
    writeln('<table class="fill">');
    writeln('<tr>');
    writeln('<td class="left_col">');
    print_left_bar("main", "feed");
    writeln('</td>');
    writeln('<td class="fill">');
}
$zid = "bryan@{$server_name}";
print_feed_page($zid);
if ($auth_zid == "") {
    writeln('<div style="text-align: center">This is a sample feed page. Login to create your own.</div>');
} else {
    writeln('<div style="text-align: center">This is a sample feed page. <a href="' . user_page_link($auth_zid) . 'feed/edit">Create</a> your own <a href="' . user_page_link($auth_zid) . '">homepage</a>.</div>');
}
writeln('		</td>');
writeln('	</tr>');
writeln('</table>');
print_footer();
コード例 #5
0
ファイル: root.php プロジェクト: scarnago/pipecode
$clean = clean_url($poll_question["question"]);
$type_id = $poll_question["type_id"];
if ($auth_zid == "") {
    $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();
コード例 #6
0
ファイル: topic.php プロジェクト: scarnago/pipecode
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "story.php";
$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++) {
コード例 #7
0
ファイル: comment.php プロジェクト: scarnago/pipecode
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "render.php";
$cid = (int) $s2;
if (!string_uses($cid, "[0-9]")) {
    die("invalid cid [{$cid}]");
}
$comment = db_get_rec("comment", $cid);
$can_moderate = false;
$a = article_info($comment);
print_header($comment["subject"]);
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "stories");
writeln('</td>');
writeln('<td class="fill">');
writeln('<h1>' . ucwords($a["type"]) . '</h1>');
writeln('<a href="' . $a["link"] . '">' . $a["title"] . '</a>');
writeln('<h2>Preview</h2>');
writeln(render_comment($comment["subject"], $comment["zid"], $comment["time"], $comment["cid"], $comment["comment"]));
writeln('</div>');
writeln('</td>');
writeln('</tr>');
writeln('</table>');
コード例 #8
0
ファイル: index.php プロジェクト: scarnago/pipecode
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "pipe.php";
print_header("Pipe");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("main", "pipe");
writeln('</td>');
writeln('<td class="fill">');
writeln('<h1>Stories in the Pipe</h1>');
writeln('<p>These are stories waiting to be published to the main page. Remember, anyone can <a href="/submit">submit</a> a new story!</p>');
$pipes = db_get_list("pipe", "time desc", array("closed" => 0));
if (count($pipes) == 0) {
    writeln('<h1>No stories in the pipe!</h1>');
    writeln('<p><a href="/submit">Submit</a> one now or <a href="/pipe/history">view the history</a>.</p>');
}
$k = array_keys($pipes);
for ($i = 0; $i < count($pipes); $i++) {
    $pipe = $pipes[$k[$i]];
    print_pipe_small($pipe["pid"], false);
}
if (count($pipes) > 0) {
コード例 #9
0
ファイル: index.php プロジェクト: scarnago/pipecode
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
$page = http_get_int("page", array("default" => 1, "required" => false));
$description = karma_description($user_conf["karma"]);
$icon = "karma-" . strtolower($description) . "-32.png";
$rows_per_page = 10;
$row = run_sql("select count(zid) as row_count from karma_log where zid = ?", array($zid));
$row_count = (int) $row[0]["row_count"];
$pages_count = ceil($row_count / $rows_per_page);
$row_start = ($page - 1) * $rows_per_page;
print_header("Karma");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("account", "karma");
writeln('</td>');
writeln('<td class="fill">');
writeln('<h1>Karma</h1>');
writeln('<table>');
writeln('	<tr>');
writeln('		<td><img alt="Karma Face" src="/images/' . $icon . '"/></td>');
writeln('		<td>' . $description . ' (' . $user_conf["karma"] . ')</td>');
writeln('	</tr>');
writeln('</table>');
$row = run_sql("select time, karma_log.value, karma_log.type_id, type, id from karma_log inner join karma_type on karma_log.type_id = karma_type.type_id where zid = ? order by time desc limit {$row_start}, {$rows_per_page}", array($zid));
writeln('<h1>Log</h1>');
writeln('<table class="zebra">');
writeln('	<tr>');
writeln('		<th>Time</th>');
writeln('		<th class="center">Points</th>');
コード例 #10
0
ファイル: index.php プロジェクト: scarnago/pipecode
// Pipecode is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pipecode is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pipecode.  If not, see <http://www.gnu.org/licenses/>.
//
include "feed.php";
if ($zid == $auth_zid) {
    print_header("", array("Edit"), array("news"), array("/feed/edit"));
    print_feed_page($zid);
} else {
    print_header();
    writeln('<table class="fill">');
    writeln('<tr>');
    writeln('<td class="left_bar">');
    print_left_bar("user", "comments");
    writeln('</td>');
    writeln('<td class="fill">');
    writeln('user page [' . $user_page . ']');
    writeln('</td>');
    writeln('</tr>');
    writeln('</table>');
}
print_footer();
コード例 #11
0
ファイル: settings.php プロジェクト: scarnago/pipecode
    $user_conf["time_zone"] = $time_zone;
    $user_conf["hide_threshold"] = $hide_threshold;
    $user_conf["expand_threshold"] = $expand_threshold;
    $user_conf["list_enabled"] = $list_enabled;
    $user_conf["real_name"] = $real_name;
    db_set_conf("user_conf", $user_conf, $auth_zid);
    //var_dump($user_conf);
    //die();
    header("Location: /menu/");
    die;
}
print_header("Settings");
writeln('<table class="fill">');
writeln('<tr>');
writeln('<td class="left_col">');
print_left_bar("account", "settings");
writeln('</td>');
writeln('<td class="fill">');
writeln('<h1>Settings</h1>');
writeln('<form method="post">');
beg_tab("JavaScript");
print_row(array("caption" => "Enable JavaScript", "check_key" => "javascript_enabled", "checked" => $user_conf["javascript_enabled"]));
end_tab();
beg_tab("Date and Time");
print_row(array("caption" => "Time Zone", "option_key" => "time_zone", "option_list" => $zones, "option_value" => $user_conf["time_zone"]));
end_tab();
beg_tab("Comments");
$scores = array("-1", "0", "1", "2", "3", "4", "5");
print_row(array("caption" => "Hide Threshold", "option_key" => "hide_threshold", "option_list" => $scores, "option_value" => $user_conf["hide_threshold"]));
print_row(array("caption" => "Expand Threshold", "option_key" => "expand_threshold", "option_list" => $scores, "option_value" => $user_conf["expand_threshold"]));
end_tab();