Example #1
0
function topicCheckReader($topic_id, $user_id)
{
    $topic = topicGetById($topic_id);
    $private_flag = topicCheckPrivate($topic_id);
    $user_flag = topicCheckFlags($topic_id, array("[" . $user_id . "]"));
    $user_flag = $user_flag[0];
    $author_flag = $topic["author_id"] == $user_id;
    $moder_flag = topicCheckModerator($topic["id"], $user_id);
    $admin_flag = userCheckAdministrator($user_id);
    return $private_flag && ($user_flag || $author_flag || $moder_flag) || !$private_flag || $admin_flag;
}
Example #2
0
function topicGetModeratorsString($topic_id)
{
    $topic = topicGetById($topic_id);
    return $topic["moderators"];
}
Example #3
0
     echo "<form action=\"index.php?regusr\" method=\"post\">";
     echo "Username (used for logging in):<br /> <input type=\"text\" name=\"username\" /><br />";
     echo "Password:<br /> <input type=\"password\" name=\"password1\" /><br />";
     echo "Password (once more):<br /> <input type=\"password\" name=\"password2\" /><br />";
     echo "Nickname (showed in your profile):<br /> <input type=\"text\" name=\"nickname\" /><br />";
     echo "Your e-mail address:<br /> <input type=\"text\" name=\"email1\" /><br />";
     echo "Repeat your e-mail:<br /> <input type=\"text\" name=\"email2\" /><br />";
     echo "<h1><a id=\"foo\" href=\"javascript: void(0);\" onClick=\"javascript: \$('#foo').load('index.php?cap');\">CLICK ME!</a></h1>";
     echo "Result (solve problem upper):<br /> <input type=\"text\" name=\"captcha_res\" /><br />";
     echo "<input type=\"submit\" value=\"register\" />";
     echo "</form>";
 } else {
     if (isset($_GET["topic_id"])) {
         $user = userGetLoggedIn();
         if (topicExistsById(intval($_GET["topic_id"])) && topicCheckReader($_GET["topic_id"], $user["id"])) {
             $topic = topicGetById(intval($_GET["topic_id"]));
             $posts = postGetByTopicId(intval($topic["id"]));
             echo "<h1>" . stringDecode($topic["title"]) . "</h1>";
             if (topicCheckModerator($topic["id"], $user["id"]) || userCheckAdministrator($user["id"])) {
                 echo "<a href=\"index.php?edittopic&topic_id=" . $_GET["topic_id"] . "\">Edit topic</a>";
             }
             $topics = topicGetByIdRange($_GET["topic_id"], 0, 5);
             if (count($topics) > 0) {
                 echo "<br /> <br /> <p class=\"item_top\"> <b> Sub-topics: </b> </p> <br />";
                 for ($i = 0; $i < count($topics); $i++) {
                     echo "<a href=\"index.php?topic_id=" . intval($topics[$i]["id"]) . "\">" . stringDecode($topics[$i]["title"]) . "</a> <br />";
                 }
             }
             echo "<br /> <br /> <p class=\"item_top\"> <b> Topic posts: </b> </p> <br />";
             for ($i = 0; $i < count($posts); $i++) {
                 $author = userGetById($posts[$i]["author_id"]);