Esempio n. 1
0
function trimThreads()
{
    if (TINYIB_MAXTHREADS > 0) {
        $numthreads = countThreads();
        if ($numthreads > TINYIB_MAXTHREADS) {
            $allthreads = allThreads();
            for ($i = TINYIB_MAXTHREADS; $i < $numthreads; $i++) {
                deletePostByID($allthreads[$i]['id']);
            }
        }
    }
}
Esempio n. 2
0
                    stickyThreadByID($post['id'], intval($_GET['setsticky']));
                    threadUpdated($post['id']);
                    $text .= manageInfo('Thread No.' . $post['id'] . ' ' . (intval($_GET['setsticky']) == 1 ? 'stickied' : 'un-stickied') . '.');
                } else {
                    fancyDie("Sorry, there doesn't appear to be a thread with that ID.");
                }
            } else {
                fancyDie("Form data was lost. Please go back and try again.");
            }
        } elseif (isset($_GET["rawpost"])) {
            $onload = manageOnLoad("rawpost");
            $text .= manageRawPostForm();
        } elseif (isset($_GET["logout"])) {
            $_SESSION['tinyib'] = '';
            session_destroy();
            die('--&gt; --&gt; --&gt;<meta http-equiv="refresh" content="0;url=' . $returnlink . '?manage">');
        }
        if ($text == '') {
            $text = manageStatus();
        }
    } else {
        $onload = manageOnLoad('login');
        $text .= manageLogInForm();
    }
    echo managePage($text, $onload);
} elseif (!file_exists('index.html') || countThreads() == 0) {
    rebuildIndexes();
}
if ($redirect) {
    echo '--&gt; --&gt; --&gt;<meta http-equiv="refresh" content="' . (isset($slow_redirect) ? '3' : '0') . ';url=' . (is_string($redirect) ? $redirect : 'index.html') . '">';
}
Esempio n. 3
0
function manageStatus()
{
    global $isadmin;
    $threads = countThreads();
    $bans = count(allBans());
    $info = $threads . ' ' . plural('thread', $threads) . ', ' . $bans . ' ' . plural('ban', $bans);
    $output = '';
    if ($isadmin && TINYIB_DBMODE == 'mysql' && function_exists('mysqli_connect')) {
        // Recommend MySQLi
        $output .= <<<EOF
\t<fieldset>
\t<legend>Notice</legend>
\t<p><b>TINYIB_DBMODE</b> is currently <b>mysql</b> in <b>settings.php</b>, but <a href="http://www.php.net/manual/en/book.mysqli.php">MySQLi</a> is installed.  Please change it to <b>mysqli</b>.  This will not affect your data.</p>
\t</fieldset>
EOF;
    }
    $reqmod_html = '';
    if (TINYIB_REQMOD != 'disable') {
        $reqmod_post_html = '';
        $reqmod_posts = latestPosts(false);
        foreach ($reqmod_posts as $post) {
            if ($reqmod_post_html != '') {
                $reqmod_post_html .= '<tr><td colspan="2"><hr></td></tr>';
            }
            $reqmod_post_html .= '<tr><td>' . buildPost($post, TINYIB_INDEXPAGE) . '</td><td valign="top" align="right">
			<table border="0"><tr><td>
			<form method="get" action="?"><input type="hidden" name="manage" value=""><input type="hidden" name="approve" value="' . $post['id'] . '"><input type="submit" value="Approve" class="managebutton"></form>
			</td><td>
			<form method="get" action="?"><input type="hidden" name="manage" value=""><input type="hidden" name="moderate" value="' . $post['id'] . '"><input type="submit" value="More Info" class="managebutton"></form>
			</td></tr><tr><td align="right" colspan="2">
			<form method="get" action="?"><input type="hidden" name="manage" value=""><input type="hidden" name="delete" value="' . $post['id'] . '"><input type="submit" value="Delete" class="managebutton"></form>
			</td></tr></table>
			</td></tr>';
        }
        if ($reqmod_post_html != '') {
            $reqmod_html = <<<EOF
\t<fieldset>
\t<legend>Pending posts</legend>
\t<table border="0" cellspacing="0" cellpadding="0" width="100%">
\t{$reqmod_post_html}
\t</table>
\t</fieldset>
EOF;
        }
    }
    $post_html = '';
    $posts = latestPosts(true);
    foreach ($posts as $post) {
        if ($post_html != '') {
            $post_html .= '<tr><td colspan="2"><hr></td></tr>';
        }
        $post_html .= '<tr><td>' . buildPost($post, TINYIB_INDEXPAGE) . '</td><td valign="top" align="right"><form method="get" action="?"><input type="hidden" name="manage" value=""><input type="hidden" name="moderate" value="' . $post['id'] . '"><input type="submit" value="Moderate" class="managebutton"></form></td></tr>';
    }
    $output .= <<<EOF
\t<fieldset>
\t<legend>Status</legend>
\t
\t<fieldset>
\t<legend>Info</legend>
\t<table border="0" cellspacing="0" cellpadding="0" width="100%">
\t<tbody>
\t<tr><td>
\t\t{$info}
\t</td>
EOF;
    if ($isadmin) {
        $output .= <<<EOF
\t<td valign="top" align="right">
\t\t<form method="get" action="?">
\t\t\t<input type="hidden" name="manage">
\t\t\t<input type="hidden" name="update">
\t\t\t<input type="submit" value="Update TinyIB" class="managebutton">
\t\t</form>
\t</td>
EOF;
    }
    $output .= <<<EOF
\t</tr>
\t</tbody>
\t</table>
\t</fieldset>

\t{$reqmod_html}
\t
\t<fieldset>
\t<legend>Recent posts</legend>
\t<table border="0" cellspacing="0" cellpadding="0" width="100%">
\t{$post_html}
\t</table>
\t</fieldset>
\t
\t</fieldset>
\t<br>
EOF;
    return $output;
}
Esempio n. 4
0
        } elseif (isset($_GET["moderate"])) {
            if ($_GET['moderate'] > 0) {
                $post = postByID($_GET['moderate']);
                if ($post) {
                    $text .= manageModeratePost($post);
                } else {
                    fancyDie("Sorry, there doesn't appear to be a post with that ID.");
                }
            } else {
                $onload = manageOnLoad('moderate');
                $text .= manageModeratePostForm();
            }
        } elseif (isset($_GET["logout"])) {
            $_SESSION['tinyib'] = '';
            session_destroy();
            die('--&gt; --&gt; --&gt;<meta http-equiv="refresh" content="0;url=' . $returnlink . '?manage">');
        }
        if ($text == '') {
            $text = 'Thread count: ' . countThreads() . ' &middot; Ban count: ' . count(allBans());
        }
    } else {
        $onload = manageOnLoad('login');
        $text .= manageLogInForm();
    }
    echo managePage($text, $onload);
} elseif (!file_exists('index.html') || count(allThreads()) == 0) {
    rebuildIndexes();
}
if ($redirect) {
    echo '--&gt; --&gt; --&gt;<meta http-equiv="refresh" content="0;url=index.html">';
}
Esempio n. 5
0
function rebuildIndexes()
{
    global $mysql_posts_table;
    $htmlposts = "";
    $page = 0;
    $i = 0;
    $pages = ceil(countThreads() / 10) - 1;
    $threads = allThreads();
    foreach ($threads as $thread) {
        $htmlreplies = array();
        $replies = latestRepliesInThreadByID($thread['id']);
        foreach ($replies as $reply) {
            $htmlreplies[] = buildPost($reply, False);
        }
        if (count($htmlreplies) == 3) {
            $thread["omitted"] = count(postsInThreadByID($thread['id'])) - 4;
        } else {
            $thread["omitted"] = 0;
        }
        $htmlposts .= buildPost($thread, False);
        $htmlposts .= implode("", array_reverse($htmlreplies));
        $htmlposts .= "<br clear=\"left\">\n" . "<hr>";
        $i += 1;
        if ($i == 10) {
            $file = $page == 0 ? "index.html" : $page . ".html";
            writePage($file, buildPage($htmlposts, 0, $pages, $page));
            $page += 1;
            $i = 0;
            $htmlposts = "";
        }
    }
    if ($page == 0 || $htmlposts != "") {
        $file = $page == 0 ? "index.html" : $page . ".html";
        writePage($file, buildPage($htmlposts, 0, $pages, $page));
    }
}
Esempio n. 6
0
                            <div class="widget">
                                <div class="widget-categories">
                                    <div class="widget-categories-heading">
                                        <h4>Categories</h4>
                                    </div>
                                    <div class="widget-categories-content">
                                        <div class="list-group">
                                            <?php 
if (isset($category)) {
    $activeSide = '';
} else {
    $activeSide = 'active';
}
?>
                                            <?php 
echo anchor('thread/', '<span class="label label-default label-pill pull-right"> ' . countThreads($threadSide, $closeThreads) . '</span> All Categories', 'class="list-group-item ' . $activeSide . '"');
?>
                                            <?php 
$c = $categoriesSide;
$limitCat = 3;
//Jumlah yang ditampilkan
$jumlahPageCat = ceil(count($c) / $limitCat);
//menghitung jumlah halaman/tab
$cat = 0;
echo '<div class="tab-content">';
for ($page = 1; $page <= $jumlahPageCat; $page++) {
    ?>
                                                <div class="tab-pane fade <?php 
    if ($page == 1) {
        echo 'active in';
    }
Esempio n. 7
0
function trimThreads()
{
    global $tinyib;
    if ($tinyib['maxthreads'] > 0) {
        $numthreads = countThreads();
        if ($numthreads > $tinyib['maxthreads']) {
            $allthreads = allThreads();
            for ($i = $tinyib['maxthreads']; $i < $numthreads; $i++) {
                deletePostByID($allthreads[$i]['id']);
            }
        }
    }
}