Esempio n. 1
0
 $returnlink = basename($_SERVER['PHP_SELF']);
 list($loggedin, $isadmin) = manageCheckLogIn();
 if ($loggedin) {
     if ($isadmin) {
         if (isset($_GET['rebuildall'])) {
             $allthreads = allThreads();
             foreach ($allthreads as $thread) {
                 rebuildThread($thread['id']);
             }
             rebuildIndexes();
             $text .= manageInfo('Rebuilt board.');
         } elseif (isset($_GET['bans'])) {
             clearExpiredBans();
             if (isset($_POST['ip'])) {
                 if ($_POST['ip'] != '') {
                     $banexists = banByIP($_POST['ip']);
                     if ($banexists) {
                         fancyDie('Sorry, there is already a ban on record for that IP address.');
                     }
                     $ban = array();
                     $ban['ip'] = $_POST['ip'];
                     $ban['expire'] = $_POST['expire'] > 0 ? time() + $_POST['expire'] : 0;
                     $ban['reason'] = $_POST['reason'];
                     insertBan($ban);
                     $text .= manageInfo('Ban record added for ' . $ban['ip']);
                 }
             } elseif (isset($_GET['lift'])) {
                 $ban = banByID($_GET['lift']);
                 if ($ban) {
                     deleteBanByID($_GET['lift']);
                     $text .= manageInfo('Ban record lifted for ' . $ban['ip']);
Esempio n. 2
0
function manageModeratePost($post)
{
    global $isadmin;
    $ban = banByIP($post['ip']);
    $ban_disabled = !$ban && $isadmin ? '' : ' disabled';
    $ban_info = !$ban ? !$isadmin ? 'Only an administrator may ban an IP address.' : 'IP address: ' . $post["ip"] : ' A ban record already exists for ' . $post['ip'];
    $delete_info = $post['parent'] == TINYIB_NEWTHREAD ? 'This will delete the entire thread below.' : 'This will delete the post below.';
    $post_or_thread = $post['parent'] == TINYIB_NEWTHREAD ? 'Thread' : 'Post';
    $sticky_html = "";
    if ($post["parent"] == TINYIB_NEWTHREAD) {
        $sticky_set = $post['stickied'] == 1 ? '0' : '1';
        $sticky_unsticky = $post['stickied'] == 1 ? 'Un-sticky' : 'Sticky';
        $sticky_unsticky_help = $post['stickied'] == 1 ? 'Return this thread to a normal state.' : 'Keep this thread at the top of the board.';
        $sticky_html = <<<EOF
\t<tr><td colspan="2">&nbsp;</td></tr>
\t<tr><td align="right" width="50%;">
\t\t<form method="get" action="?">
\t\t<input type="hidden" name="manage" value="">
\t\t<input type="hidden" name="sticky" value="{$post['id']}">
\t\t<input type="hidden" name="setsticky" value="{$sticky_set}">
\t\t<input type="submit" value="{$sticky_unsticky} Thread" class="managebutton" style="width: 50%;">
\t\t</form>
\t</td><td><small>{$sticky_unsticky_help}</small></td></tr>
EOF;
        $post_html = "";
        $posts = postsInThreadByID($post["id"]);
        foreach ($posts as $post_temp) {
            $post_html .= buildPost($post_temp, TINYIB_INDEXPAGE);
        }
    } else {
        $post_html = buildPost($post, TINYIB_INDEXPAGE);
    }
    return <<<EOF
\t<fieldset>
\t<legend>Moderating No.{$post['id']}</legend>
\t
\t<fieldset>
\t<legend>Action</legend>
\t
\t<table border="0" cellspacing="0" cellpadding="0" width="100%">
\t<tr><td align="right" width="50%;">
\t
\t<form method="get" action="?">
\t<input type="hidden" name="manage" value="">
\t<input type="hidden" name="delete" value="{$post['id']}">
\t<input type="submit" value="Delete {$post_or_thread}" class="managebutton" style="width: 50%;">
\t</form>
\t
\t</td><td><small>{$delete_info}</small></td></tr>
\t<tr><td align="right" width="50%;">
\t
\t<form method="get" action="?">
\t<input type="hidden" name="manage" value="">
\t<input type="hidden" name="bans" value="{$post['ip']}">
\t<input type="submit" value="Ban Poster" class="managebutton" style="width: 50%;"{$ban_disabled}>
\t</form>
\t
\t</td><td><small>{$ban_info}</small></td></tr>

\t{$sticky_html}
\t
\t</table>
\t
\t</fieldset>
\t
\t<fieldset>
\t<legend>{$post_or_thread}</legend>\t
\t{$post_html}
\t</fieldset>
\t
\t</fieldset>
\t<br>
EOF;
}
Esempio n. 3
0
function checkBanned()
{
    $ban = banByIP($_SERVER['REMOTE_ADDR']);
    if ($ban) {
        if ($ban['expire'] == 0 || $ban['expire'] > time()) {
            $expire = $ban['expire'] > 0 ? '<br>This ban will expire ' . date('y/m/d(D)H:i:s', $ban['expire']) : '<br>This ban is permanent and will not expire.';
            $reason = $ban['reason'] == '' ? '' : '<br>Reason: ' . $ban['reason'];
            fancyDie('Your IP address ' . $ban['ip'] . ' has been banned from posting on this image board.  ' . $expire . $reason);
        } else {
            clearExpiredBans();
        }
    }
}
Esempio n. 4
0
function manageModeratePost($post)
{
    global $isadmin;
    $ban = banByIP($post['ip']);
    $ban_disabled = !$ban && $isadmin ? '' : ' disabled';
    $ban_disabled_info = !$ban ? '' : ' A ban record already exists for ' . $post['ip'];
    $post_html = buildPost($post, true);
    return <<<EOF
\t<fieldset>
\t<legend>Moderating post No.{$post['id']}</legend>
\t
\t<div class="floatpost">
\t<fieldset>
\t<legend>Post</legend>\t
\t{$post_html}
\t</fieldset>
\t</div>
\t
\t<fieldset>
\t<legend>Action</legend>\t\t\t\t\t
\t<form method="get" action="?">
\t<input type="hidden" name="manage" value="">
\t<input type="hidden" name="delete" value="{$post['id']}">
\t<input type="submit" value="Delete Post" class="managebutton">
\t</form>
\t<br>
\t<form method="get" action="?">
\t<input type="hidden" name="manage" value="">
\t<input type="hidden" name="bans" value="{$post['ip']}">
\t<input type="submit" value="Ban Poster" class="managebutton"{$ban_disabled}>{$ban_disabled_info}
\t</form>
\t</fieldset>
\t
\t</fieldset>
\t<br>
EOF;
}