예제 #1
0
require '../structure/forum.php';
require '../structure/forum.index.php';
require '../structure/forum.thread.php';
require '../structure/forum.post.php';
require '../structure/database.php';
require '../structure/user.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$base = new base($database);
$user = new user($database);
$forum = new forum($database);
$forum_index = new forum_index($database);
$thread = new thread($database);
$post = new post($database);
$user->updateLastActive();
//get config
$config = $base->loadConfig();
//set some variables that are used a lot throughout the page
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$f = $_GET['forum'];
$i = $_GET['id'];
//preform basic checks
if (!ctype_digit($f) || !ctype_digit($i) || !$thread->checkExistence($i) || !$thread->canView($i, $username, $rank)) {
    $base->redirect('index.php');
}
//if the GOTO field is set, let's skip to the selected post
if (ctype_digit($_GET['goto'])) {
    $getPageNum = $thread->getPageNum($_GET['goto'], $i);
    if ($getPageNum) {
        $base->redirect('viewthread.php?forum=' . $f . '&id=' . $i . '&page=' . $getPageNum . '&highlight=' . $_GET['goto'] . '#' . $_GET['goto']);
    }
 public function formatPost($content, $username, base $base, forum $forum = null)
 {
     //config
     $config = $base->loadConfig();
     //get the rank of the user
     $user = $this->database->processQuery("SELECT `acc_status` FROM `users` WHERE `username` = ? LIMIT 1", array($username), true);
     $rank = $user[0]['acc_status'];
     //users & fmods
     if ($rank < 4) {
         //apply filter for USERS if the forum variable is set
         if (!is_null($forum) && $rank < 3) {
             $forum->filter($content);
         }
         //remove HTML
         $content = htmlentities($content);
     }
     //youtube bbcode is seperate from other bbcodes, because only the youtube bbcodes can be toggled on/off for members
     if ($rank > 2 || $config['bbcode_members']) {
         $content = preg_replace('#\\[youtube\\](.+?)\\[\\/youtube\\]#', '<iframe width="560" height="315" src="http://www.youtube.com/embed/$1?rel=0" frameborder="0" allowfullscreen></iframe>', $content);
     }
     //now let's do BBCode for mods and admins
     if ($rank > 2) {
         //bcode and some smileys
         $bbcode = array('#\\[b\\](.+?)\\[\\/b\\]#i', '#\\[i\\](.+?)\\[\\/i\\]#i', '#\\[url=(.+?)](.+?)\\[\\/url\\]#i', '#\\[u\\](.+?)\\[\\/u\\]#i', '#:lolbert:#i', '#\\[img\\](.+?)\\[\\/img\\]#i');
         $replace = array('<b>$1</b>', '<i>$1</i>', '<a href="$1">$2</a>', '<u>$1</u>', '<img src="../img/forum/smileys/lolbert.png">', '<img src="$1" border="0">');
         $content = preg_replace($bbcode, $replace, $content);
         if ($rank == 4) {
             //convert QUOTE BBcode to actual HTML format
             $content = stripslashes(preg_replace('/\\[quote\\=(.+?)](.+?)\\[\\/quote\\]/s', '<div style="border:1px solid #957C07;margin: 14px 0 0">
                 <p style="background:#645305;margin:0;padding:2px;font-style:normal">
                         <strong>Original Content</strong> (Posted by: $1)
                 </p>
                 <div style="position:relative;float:right;overflow:hidden;height:33px;top:-28px;left:10px">
                         <span style="color:#957C07;font-family:Engravers MT,Felix Titling,Perpetua Titling MT,Times New Roman;font-style:normal;font-size:120px;line-height:81px">"</span>
                 </div>
                 <div style="font-style:italic;margin:8px 6px">$2
                 </div>
                 </div>', $content));
         }
     }
     //add smileys
     $text = array(':)', ';)', ':P', ':(', ':|', 'O_o', ':D', '^^', ':O', ':@');
     $smileys = array('<img src="../img/forum/smileys/smile.gif">', '<img src="../img/forum/smileys/wink.gif">', '<img src="../img/forum/smileys/tongue.gif">', '<img src="../img/forum/smileys/sad.gif">', '<img src="../img/forum/smileys/nosmile.gif">', '<img src="../img/forum/smileys/o.O.gif">', '<img src="../img/forum/smileys/bigsmile.gif">', '<img src="../img/forum/smileys/^^.gif">', '<img src="../img/forum/smileys/shocked.gif">', '<img src="../img/forum/smileys/angry.gif">');
     return $content = stripslashes(str_replace($text, $smileys, $content));
 }
예제 #3
0
                    <a href="../index.php" class=c>Main Menu</a> - <a href="index.php">Back</a>
                </div>
                </div>

		<img class="widescroll-top" src="../img/scroll/backdrop_765_top.gif" alt="" width="765" height="50" />
		<div class="widescroll">
			<div class="widescroll-bgimg">

				<div class="widescroll-content">
                                    <div id="black_fields">
                                        Here you can change the basic settings for your site.
                                        <hr>
                                        <?php 
if (!isset($_POST['update'])) {
    //get the current settings
    $settings = $base->loadConfig();
    ?>
                                        
                                                    <table>
                                                    <form action="settings.php" method="POST">
                                                        <tr><td><input type="checkbox" name="bbcode_members" <?php 
    echo $settings['bbcode_members'] == 1 ? 'checked="checked"' : '';
    ?>
>Allow members to use the YouTube BBCode</td></tr>
                                                        <tr><td><input type="checkbox" name="postcount" <?php 
    echo $settings['postcount'] == 1 ? 'checked="checked"' : '';
    ?>
>Show post count under posts</td></tr>
                                                        <tr><td><input type="text" name="floodlimit" value="<?php 
    echo $settings['floodlimit'];
    ?>