Bravo List

Bravo List (https://www.bvlist.com/index.php)
-   Downloads (https://www.bvlist.com/forumdisplay.php?f=16)
-   -   ftsp1.0_forums_mysqli_now (https://www.bvlist.com/showthread.php?t=12681)


       
       
       
       
   
 
           
    }

}
//--Returns the Minimum Read/Write Class Levels of a Forum --//
function get_forum_access_levels ($forumid)
{
    global $CURUSER, $site_url, $image_dir;
    $res = sql_query("SELECT minclassread, minclasswrite, minclasscreate
                        FROM forums
                        WHERE id = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

    if (mysqli_num_rows($res) != 1)
    {
        return false;
    }

    $arr = mysqli_fetch_assoc($res);

    return array("read"  => $arr["minclassread"],
                "write"  => $arr["minclasswrite"],
                "create" => $arr["minclasscreate"]);
}

//-- Returns The Forum Id Of A Topic, Or False On Error --//
function get_topic_forum ($topicid)
{
    global $CURUSER, $image_dir, $posts_read_expiry, $site_url;

    $res = sql_query("SELECT forumid
                        FROM topics
                        WHERE id = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

    if (mysqli_num_rows($res) != 1)
    {
        return false;
    }

    $arr = mysqli_fetch_assoc($res);

    return (int) $arr['forumid'];
}

//-- Returns The Id Of The Last Post Of A Forum --//
function update_topic_last_post ($topicid)
{
    $res = sql_query("SELECT MAX(id) AS id
                        FROM posts
                        WHERE topicid = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

    $arr = mysqli_fetch_assoc($res) or die ("No Post Found!");

    sql_query("UPDATE topics
                SET lastpost = {$arr['id']}
                WHERE id = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

    //-- Update Forum Post/Topic Count --//
    $forums = sql_query("SELECT id
                            FROM forums");

    while ($forum = mysqli_fetch_assoc($forums))
    {
        $postcount  = 0;
        $topiccount = 0;

        $topics = sql_query("SELECT id
                                FROM topics
                                WHERE forumid = $forum[id]");

        while ($topic = mysqli_fetch_assoc($topics))
        {
            $res = sql_query("SELECT COUNT(*)
                                FROM posts
                                WHERE topicid = $topic[id]");

            $arr = mysqli_fetch_row($res);

            $postcount += $arr[0];
            ++$topiccount;
        }
        sql_query("UPDATE forums
                    SET postcount = $postcount, topiccount = $topiccount
                    WHERE id = $forum[id]");
    }
}

function get_forum_last_post ($forumid)
{
    $res = sql_query("SELECT MAX(lastpost) AS lastpost
                        FROM topics
                        WHERE forumid = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

    $arr = mysqli_fetch_assoc($res);

    $postid = (int) $arr['lastpost'];

    return (is_valid_id($postid) ? $postid : 0);
}

//-- Inserts a Quick Jump Menu --//
function insert_quick_jump_menu ($currentforum = 0)
{
    global $CURUSER;

    ?>
   

       

           
            Quick jump:"); ?>
           
           
       
   

   

    }

//-- Inserts a Compose Frame --//
function insert_compose_frame ($id, $newtopic = true, $quote = false, $attachment = false)
{
    global $maxsubjectlength, $CURUSER, $maxfilesize, $image_dir, $use_attachment_mod, $site_url, $image_dir;

    if ($newtopic)
    {
        $res = sql_query("SELECT name
                            FROM forums
                            WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);

        $arr = mysqli_fetch_assoc($res) or die("Bad Forum ID!");

        ?>

New Topic in forum



        }
    else
    {
        $res = sql_query("SELECT t.forumid, t.subject, t.locked, f.minclassread
                            FROM topics AS t
                            LEFT JOIN forums AS f ON f.id = t.forumid
                            WHERE t.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);

        $arr = mysqli_fetch_assoc($res) or die ("Forum Error, Topic Not Found!");

        if ($CURUSER['class'] < $arr['minclassread'])
        {
            error_message("warn", "Sorry", "You are Not Allowed in Here!");
            end_table();
            exit();
        }

        if ($arr['locked'] == 'yes' && $CURUSER['class'] < UC_SITE_EDITOR)
        {
            error_message("warn", "Sorry", "The Topic is Locked!");
            end_table();
            exit();
        }
            ?>

Reply to Topic:



        }

    if ($quote)
    {
        $postid = (int) $_GET["postid"];

        if (!is_valid_id($postid))
        {
            error_message("error", "Error", "Invalid ID!");
        }

        $res = sql_query("SELECT posts.*, users.username
                            FROM posts
                            JOIN users ON posts.userid = users.id
                            WHERE posts.id = $postid") or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($res) == 0)
        {
            error_message("error", "Error", "No Post with that ID!");
        }

        $arr = mysqli_fetch_assoc($res);
    }

    begin_frame("Compose", true);

    ?>


   
    ' value='' />

   
    begin_table(true);

    if ($newtopic)
    {
        ?>

       
           
           
       

            }

    ?>
   
       
        ");
        if ($use_attachment_mod && $attachment)
        {
            ?>
           
               
           

                    }

        ?>
       
           
       

       
        end_table();

        ?>
   

   

Smilies


    end_frame();

    //-- Get Last 10 Posts If This Is A Reply --//
    if (!$newtopic)
    {
        $postres = sql_query("SELECT p.id, p.added, p.body, u.id AS uid, u.username, u.avatar
                                FROM posts AS p
                                LEFT JOIN users AS u ON u.id = p.userid
                                WHERE p.topicid = ".sqlesc($id)."
                                ORDER BY p.id DESC
                                LIMIT 10") or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($postres) > 0)
        {
            ?>

           

           
            begin_frame("Last 10 Posts, in Reverse Order");

            while ($post = mysqli_fetch_assoc($postres))
            {
                $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($post["avatar"]) : '');

                if (empty($avatar))
                {
                    $avatar = $image_dir."default_avatar.gif";
                }

                ?>

               

# by at GMT


                begin_table(true);

                ?>

           
               
               
           

           
                end_table();
            }

            end_frame();
        }
    }

    insert_quick_jump_menu();
}

if ($action == 'updatetopic' && $CURUSER['class'] >= UC_SITE_EDITOR)
{
    $topicid = (isset($_GET['topicid']) ? (int) $_GET['topicid'] : (isset($_POST['topicid']) ? (int) $_POST['topicid'] : 0));

    if (!is_valid_id($topicid))
    {
        error_message("error", "Error", "Invalid Topic ID!");
    }

    $topic_res = sql_query('SELECT t.sticky, t.locked, t.subject, t.forumid, f.minclasswrite,
                            (SELECT COUNT(id) FROM posts WHERE topicid = t.id) AS post_count
                            FROM topics AS t
                            LEFT JOIN forums AS f ON f.id = t.forumid
                            WHERE t.id = '.sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

    if (mysqli_num_rows($topic_res) == 0)
    {
        error_message("error", "Error", "No Topic with that ID!");
    }

    $topic_arr = mysqli_fetch_assoc($topic_res);

    if ($CURUSER['class'] < (int) $topic_arr['minclasswrite'])
    {
        error_message("error", "Error", "You are Not Allowed to Edit this Topic.");
    }

    $forumid = (int) $topic_arr['forumid'];
    $subject = $topic_arr['subject'];

    if ((isset($_GET['delete']) ? $_GET['delete'] : (isset($_POST['delete']) ? $_POST['delete'] : '')) == 'yes')
    {
        if ((isset($_GET['sure']) ? $_GET['sure'] : (isset($_POST['sure']) ? $_POST['sure'] : '')) != 'yes')
        {
            error_message("error", "Sanity Check", "You are about to Delete this Topic.  Click here to Confirm!");
        }

        write_log("Topic ".$subject." was Deleted by ".$CURUSER['username'].".");

        if ($use_attachment_mod)
        {
            $res = sql_query("SELECT attachments.filename
                                FROM posts
                                LEFT JOIN attachments ON attachments.postid = posts.id
                                WHERE posts.topicid = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

            while ($arr = mysqli_fetch_assoc($res))
            {
                if (!empty($arr['filename']) && is_file($attachment_dir."/".$arr['filename']))
                {
                    unlink($attachment_dir."/".$arr['filename']);
                }
            }
        }

        sql_query("DELETE posts, topics ".($use_attachment_mod ? ", attachments, attachmentdownloads " : "").($use_poll_mod ? ", postpolls, postpollanswers " : "")."
                    FROM topics
                    LEFT JOIN posts ON posts.topicid = topics.id ".($use_attachment_mod ? "
                    LEFT JOIN attachments ON attachments.postid = posts.id
                    LEFT JOIN attachmentdownloads ON attachmentdownloads.fileid = attachments.id " : "").($use_poll_mod ? "
                    LEFT JOIN postpolls ON postpolls.id = topics.pollid
                    LEFT JOIN postpollanswers ON postpollanswers.pollid = postpolls.id " : "")."
                    WHERE topics.id = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

        header('Location: '.$_SERVER['PHP_SELF'].'?action=viewforum&forumid='.$forumid);
        exit();
    }

    $returnto  = $_SERVER['PHP_SELF'].'?action=viewtopic&topicid='.$topicid;
    $updateset = array();
    $locked    = ($_POST['locked'] == 'yes' ? 'yes' : 'no');

    if ($locked != $topic_arr['locked'])
    {
        $updateset[] = 'locked = '.sqlesc($locked);
    }

    $sticky = ($_POST['sticky'] == 'yes' ? 'yes' : 'no');

    if ($sticky != $topic_arr['sticky'])
    {
        $updateset[] = 'sticky = '.sqlesc($sticky);
    }

    $new_subject = $_POST['subject'];

    if ($new_subject != $subject)
    {
        if (empty($new_subject))
        {
            error_message("error", "Error", "Topic Name Cannot be Empty.");
        }

        $updateset[] = 'subject = '.sqlesc($new_subject);
    }

    $new_forumid = (int) $_POST['new_forumid'];

    if (!is_valid_id($new_forumid))
    {
        error_message("error", "Error", "Invalid Forum ID!");
    }

    if ($new_forumid != $forumid)
    {
        $post_count = (int) $topic_arr['post_count'];

        $res = sql_query("SELECT minclasswrite
                            FROM forums
                            WHERE id = ".sqlesc($new_forumid)) or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($res) != 1)
        {
            error_message("error", "Error", "Forum Not Found!");
        }

        $arr = mysqli_fetch_assoc($res);

        if ($CURUSER['class'] < (int) $arr['minclasswrite'])
        {
            error_message("error", "Error", "You are Not Allowed to Move this Topic into the Selected Forum.");
        }

        $updateset[] = 'forumid = '.sqlesc($new_forumid);

        sql_query("UPDATE forums
                    SET topiccount = topiccount - 1, postcount = postcount - ".sqlesc($post_count)."
                    WHERE id = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

        sql_query("UPDATE forums
                    SET topiccount = topiccount + 1, postcount = postcount + ".sqlesc($post_count)."
                    WHERE id = ".sqlesc($new_forumid)) or sqlerr(__FILE__, __LINE__);

        $returnto = $_SERVER['PHP_SELF'].'?action=viewforum&forumid='.$new_forumid;
    }

    if (sizeof($updateset) > 0)
    {
        sql_query("UPDATE topics
                    SET ".implode(', ', $updateset)."
                    WHERE id = ".sqlesc($topicid));
    }

    header('Location: '.$returnto);
    exit();
}
else if ($action == "editforum" && $CURUSER['class'] == MAX_CLASS) //-- Action: Edit Forum --//
{
    $forumid = (int) $_GET["forumid"];

    if (!is_valid_id($forumid))
    {
        error_message("error", "Error", "Invalid ID!");
    }

    $res = sql_query("SELECT name, description, minclassread, minclasswrite, minclasscreate
                        FROM forums
                        WHERE id = $forumid") or sqlerr(__FILE__, __LINE__);

    if (mysqli_num_rows($res) == 0)
    {
        error_message("error", "Error", "No Forum Found with that ID!");
    }

    $forum = mysqli_fetch_assoc($res);

    site_header("Edit Forum");
    begin_frame("Edit Forum", "center");

    print("\n");

    begin_table();

    print("
           
           
        \n
       
           
           
        \n
       
           
            \n
           
               
            \n");

    end_table();

    print("");

    end_frame();
    site_footer();
    exit();
}
else if ($action == "updateforum" && $CURUSER['class'] == MAX_CLASS) //-- Action: Update Forum --//
{
    $forumid = (int) $_GET["forumid"];

    if (!is_valid_id($forumid))
    {
        error_message('error', 'Error', 'Invalid ID!');
    }

    $res = sql_query('SELECT id
                        FROM forums
                        WHERE id = '.sqlesc($forumid));

    if (mysqli_num_rows($res) == 0)
    {
        error_message('error', 'Error', 'No Forum with that ID!');
    }

    $name        = $_POST['name'];
    $description = $_POST['description'];

    if (empty($name))
    {
        error_message('error', 'Error', 'You Must Specify a Name for the Forum.');
    }

    if (empty($description))
    {
        error_message('error', 'Error', 'You Must Provide a Description for the Forum.');
    }

    sql_query("UPDATE forums
                SET name = ".sqlesc($name).", description = ".sqlesc($description).", minclassread = ".sqlesc((int) $_POST['readclass']).", minclasswrite = ".sqlesc((int) $_POST['writeclass']).", minclasscreate = ".sqlesc((int) $_POST['createclass'])."
                WHERE id = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

    header("Location: {$_SERVER['PHP_SELF']}");
    exit();
}
else if ($action == 'deleteforum' && $CURUSER['class'] == MAX_CLASS) //-- Action: Delete Forum --//
{
    $forumid = (int) $_GET['forumid'];

    if (!is_valid_id($forumid))
    {
        error_message('error', 'Error', 'Invalid ID!');
    }

    $confirmed = (int) $_GET['confirmed'];

    if (!$confirmed)
    {
        $rt = sql_query("SELECT topics.id, forums.name
                            FROM topics
                            LEFT JOIN forums ON forums.id=topics.forumid
                            WHERE topics.forumid = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

        $topics = mysqli_num_rows($rt);
        $posts  = 0;

        if ($topics > 0)
        {
            while ($topic = mysqli_fetch_assoc($rt))
            {
                $ids[] = $topic['id'];
                $forum = $topic['name'];
            }

            $rp = sql_query("SELECT COUNT(id)
                                FROM posts
                                WHERE topicid IN (".join(', ', $ids).")");

            foreach ($ids
                    AS
                    $id)
            {
                if ($a = mysqli_fetch_row($rp))
                {
                    $posts += $a[0];
                }
            }
        }

        if ($use_attachment_mod || $use_poll_mod)
        {
            $res = sql_query("SELECT ".($use_attachment_mod ? "
                                COUNT(attachments.id) AS attachments " : "").($use_poll_mod ? ($use_attachment_mod ? ', ' : '')."
                                COUNT(postpolls.id) AS polls " : "")."
                                FROM topics
                                LEFT JOIN posts ON topics.id=posts.topicid ".($use_attachment_mod ? "
                                LEFT JOIN attachments ON attachments.postid = posts.id " : "").($use_poll_mod ? "
                                LEFT JOIN postpolls ON postpolls.id=topics.pollid " : "")."
                                WHERE topics.forumid=".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

            ($use_attachment_mod ? $attachments = 0 : NULL);
            ($use_poll_mod ? $polls = 0 : NULL);

            if ($arr = mysqli_fetch_assoc($res))
            {
                ($use_attachment_mod ? $attachments = $arr['attachments'] : NULL);
                ($use_poll_mod ? $polls = $arr['polls'] : NULL);
            }
        }

        error_message("warn", "** WARNING! **", "Deleting this Forum with id=$forumid (".$forum.") will also Delete ".$posts." Post".($posts != 1 ? 's' : '').($use_attachment_mod ? ", ".$attachments." attachment".($attachments != 1 ? 's' : '') : "").($use_poll_mod ? " AND ".($polls - $attachments)." poll".(($polls - $attachments) != 1 ? 's' : '') : "")." in ".$topics." topic".($topics != 1 ? 's' : '').".[ACCEPT] [CANCEL]");
    }

    $rt = sql_query("SELECT topics.id ".($use_attachment_mod ? ", attachments.filename " : "")."
                        FROM topics
                        LEFT JOIN posts ON topics.id = posts.topicid ".($use_attachment_mod ? "
                        LEFT JOIN attachments ON attachments.postid = posts.id " : "")."
                        WHERE topics.forumid = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

    $topics = mysqli_num_rows($rt);

    if ($topics == 0)
    {
        sql_query("DELETE
                    FROM forums
                    WHERE id = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

        header("Location: {$_SERVER['PHP_SELF']}");
        exit();
    }
    else
    {
        while ($topic = mysqli_fetch_assoc($rt))
        {
            $tids[] = $topic['id'];

            if ($use_attachment_mod && !empty($topic['filename']))
            {
                $filename = $attachment_dir."/".$topic['filename'];

                if (is_file($filename))
                {
                    unlink($filename);
                }
            }
        }
    }

    sql_query("DELETE posts.*, topics.*, forums.* ".($use_attachment_mod ? ", attachments.*, attachmentdownloads.* " : "").($use_poll_mod ? ", postpolls.*, postpollanswers.* " : "")."
                FROM posts ".($use_attachment_mod ? "
                LEFT JOIN attachments ON attachments.postid = posts.id
                LEFT JOIN attachmentdownloads ON attachmentdownloads.fileid = attachments.id " : "")."
                LEFT JOIN topics ON topics.id = posts.topicid
                LEFT JOIN forums ON forums.id = topics.forumid ".($use_poll_mod ? "
                LEFT JOIN postpolls ON postpolls.id = topics.pollid
                LEFT JOIN postpollanswers ON postpollanswers.pollid = postpolls.id " : "")."
                WHERE posts.topicid IN (".join(', ', $tids).")") or sqlerr(__FILE__, __LINE__);

    header("Location: {$_SERVER['PHP_SELF']}");
    exit();
}
else if ($action == "newtopic") //-- Action: New Topic --//
{
    $forumid = (int) $_GET["forumid"];

    if (!is_valid_id($forumid))
    {
        error_message("error", "Error", "Invalid ID!");
    }

    site_header("New Topic");
    insert_compose_frame($forumid, true, false, true);
    site_footer();
    exit();
}
else if ($action == "post") //-- Action: Post --//
{
    $forumid = (isset($_POST['forumid']) ? (int) $_POST['forumid'] : NULL);

    if (isset($forumid) && !is_valid_id($forumid))
    {
        error_message("error", "Error", "Invalid Forum ID!");
    }

    $topicid = (isset($_POST['topicid']) ? (int) $_POST['topicid'] : NULL);

    if (isset($topicid) && !is_valid_id($topicid))
    {
        error_message("error", "Error", "Invalid Topic ID!");
    }

    $newtopic = is_valid_id($forumid);

    $subject = (isset($_POST["subject"]) ? $_POST["subject"] : '');

    if ($newtopic)
    {
        $subject = trim($subject);

        if (empty($subject))
        {
            error_message("error", "Error", "You must Enter a Subject.");
        }

        if (strlen($subject) > $maxsubjectlength)
        {
            error_message("error", "Error", "Subject is Limited to ".$maxsubjectlength." Characters.");
        }
    }
    else
    {
        $forumid = get_topic_forum($topicid) or die ("Bad topic ID");
    }

    /*
        if ($CURUSER["forumpost"] == 'no')
        {
            error_message("warn", "Sorry", "Your are not Allowed to Post.)");
        }
    */

    //-- Make Sure Sure User Has Write Access In Forum --//
    $arr = get_forum_access_levels($forumid) or die ("Bad Forum ID");

    if ($CURUSER['class'] < $arr["write"] || ($newtopic && $CURUSER['class'] < $arr["create"]))
    {
        error_message("warn", "Warning", "Permission Denied.");
    }

    $body = trim($_POST["body"]);

    if (empty($body))
    {
        error_message("error", "Error", "No Body Text.");
    }

    if (substr_count(strtolower($body), '[quote') > 3)
    {
        error_message("info", "Sorry", "Quote Limit Reached");
    }

    $userid = (int) $CURUSER["id"];

    if ($use_flood_mod && $CURUSER['class'] < UC_SITE_EDITOR)
    {
        $res = sql_query("SELECT COUNT(id) AS c
                            FROM posts
                            WHERE userid = ".$CURUSER['id']."
                            AND added > '".get_date_time(gmtime() - ($minutes * 60))."'");

        $arr = mysqli_fetch_assoc($res);

        if ($arr['c'] > $limit)
        {
            error_message("info", "Flood", "More than ".$limit." Posts in the last ".$minutes." Minutes.");
        }
    }

    if ($newtopic)
    {
        sql_query("INSERT INTO topics (userid, forumid, subject)
                    VALUES($userid, $forumid, ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);

        $topicid = mysqli_insert_id() or error_message("error", "Error", "No Topic ID Returned!");

/// Credits - Yummii ///
////////Shout in shoutbox when new torrent is uploaded//////////
$text = "Started a new thread ".$subject."";
//$userid = "7";
//$username = "System";
$date=time();
sql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
////////////end autoshout///////////////               
               
        sql_query("INSERT INTO posts (topicid, userid, added, body)
                    VALUES($topicid, $userid, ".sqlesc(get_date_time()).", ".sqlesc($body).")") or sqlerr(__FILE__, __LINE__);

        $postid = mysqli_insert_id() or error_message("error", "Error", "No Post ID Returned!");
                               
    }
    else
    {
        //-- Make Sure Topic Exists And Is Unlocked --//
        $res = sql_query("SELECT locked
                            FROM topics
                            WHERE id = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($res) == 0)
        {
            error_message("error", "Error", "Non-existent Topic!");
        }

        $arr = mysqli_fetch_assoc($res);

        if ($arr["locked"] == 'yes' && $CURUSER['class'] < UC_SITE_EDITOR)
        {
            error_message("info", "", "This Topic is Locked.  No New Posts are Allowed.");
        }

        //-- Check Double Post --//
        $doublepost = sql_query("SELECT p.id, p.added, p.userid, p.body, t.lastpost, t.id
                                    FROM posts AS p
                                    INNER JOIN topics AS t ON p.id = t.lastpost
                                    WHERE t.id = $topicid
                                    AND p.userid = $userid
                                    AND p.added > ".sqlesc(get_date_time(gmtime() - 1 * 86400))."
                                    ORDER BY p.added DESC
                                    LIMIT 1") or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($doublepost) == 0 || $CURUSER['class'] >= UC_SITE_EDITOR)
        {
            sql_query("INSERT INTO posts (topicid, userid, added, body)
                        VALUES($topicid, $userid, ".sqlesc(get_date_time()).", ".sqlesc($body).")") or sqlerr(__FILE__, __LINE__);

            $postid = mysqli_insert_id() or die("Post ID N/A");
        }
        else
        {
            $results = mysqli_fetch_assoc($doublepost);
            $postid  = (int) $results['lastpost'];

            sql_query("UPDATE posts
                        SET body = ".sqlesc(trim($results['body'])."\n\n".$body).", editedat = ".sqlesc(get_date_time()).", editedby = $userid
                        WHERE id = $postid") or sqlerr(__FILE__, __LINE__);
        }
/// Credits - Yummii ///
////////Shout in shoutbox when new torrent is uploaded//////////
$subject = mysqli_result(sql_query("SELECT subject from topics where id=".$topicid),0);
$text = "Replied to the thread ".$subject."";
//$userid = "";
//$username = "";
$date=time();
sql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
////////////end autoshout///////////////               
    }

    update_topic_last_post($topicid);

    if ($use_attachment_mod && ((isset($_POST['uploadattachment']) ? $_POST['uploadattachment'] : '') == 'yes'))
    {
        $file        = $_FILES['file'];
        $fname      = trim(stripslashes($file['name']));
        $size        = $file['size'];
        $tmpname    = $file['tmp_name'];
        $tgtfile    = $attachment_dir."/".$fname;
        $pp          = pathinfo($fname = $file['name']);
        $error      = $file['error'];
        $type        = $file['type'];
        $uploaderror = '';

        if (empty($fname))
        {
            $uploaderror = "Invalid Filename!";
        }

        if (!validfilename($fname))
        {
            $uploaderror = "Invalid Filename!";
        }

        foreach ($allowed_file_extensions
                AS
                $allowed_file_extension)

        if (!preg_match('/^(.+)\.['.join(']|[', $allowed_file_extensions).']$/si', $fname, $matches))
        {
            $uploaderror = 'Only Files With The Following Extensions Are Allowed: '.join(', ', $allowed_file_extensions).'.';
        }

        if ($size > $maxfilesize)
        {
            $uploaderror = error_message("warn", "Sorry", "That File Is Too Large.");
        }

        if ($pp['basename'] != $fname)
        {
            $uploaderror = error_message("warn", "Sorry", "Bad File Name.");
        }

        if (file_exists($tgtfile))
        {
            $uploaderror = error_message("warn", "Sorry", "A File With The Name Already Exists.");
        }

        if (!is_uploaded_file($tmpname))
        {
            $uploaderror = error_message("warn", "Sorry", "Can't Upload That File!");
        }

        if (!filesize($tmpname))
        {
            $uploaderror = error_message("warn", "Sorry", "File Empty!)");
        }

        if ($error != 0)
        {
            $uploaderror = error_message("error", "Sorry", "There Was An Error While Uploading That File.");
        }

        if (empty($uploaderror))
        {
            sql_query("INSERT INTO attachments (topicid, postid, filename, size, owner, added, type)
                        VALUES ('$topicid','$postid',".sqlesc($fname).", ".sqlesc($size).", '$userid', ".sqlesc(get_date_time()).", ".sqlesc($type).")") or sqlerr(__FILE__, __LINE__);

            move_uploaded_file($tmpname, $tgtfile);
        }
    }

    $headerstr = "Location: forums.php?action=viewtopic&topicid=$topicid".($use_attachment_mod && !empty($uploaderror) ? "&uploaderror=$uploaderror" : "")."&page=last";

    header($headerstr.($newtopic ? '' : "#$postid"));
    exit();
}
else if ($action == "viewtopic") //-- Action: View Topic --//
{
    $userid = (int) $CURUSER["id"];

    if ($use_poll_mod && $_SERVER['REQUEST_METHOD'] == "POST")
    {
        $choice = $_POST['choice'];
        $pollid = (int) $_POST["pollid"];

        if (ctype_digit($choice) && $choice < 256 && $choice == floor($choice))
        {
            $res = sql_query("SELECT pa.id
                                FROM postpolls AS p
                                LEFT JOIN postpollanswers AS pa ON pa.pollid = p.id AND pa.userid = ".sqlesc($userid)."
                                WHERE p.id = ".sqlesc($pollid)) or sqlerr(__FILE__, __LINE__);

            $arr = mysqli_fetch_assoc($res) or error_message("error", "Sorry", "Non-existent Poll!");

            if (is_valid_id($arr['id']))
            {
                error_message("error", "Error", "Dupe Vote");
            }

            sql_query("INSERT INTO postpollanswers
                        VALUES(id, ".sqlesc($pollid).", ".sqlesc($userid).", ".sqlesc($choice).")") or sqlerr(__FILE__, __LINE__);

            if (mysqli_affected_rows() != 1)
            {
                error_message("error", "Error", "An Error Occured. Your Vote has NOT been Counted.");
            }
        }
        else
        {
            error_message("error", "Error", "Please Select an Option.");
        }
    }

    $topicid = (int) $_GET["topicid"];

    if (!is_valid_id($topicid))
    {
        error_message("error", "Error", "Invalid Topic ID!2");
    }

    $page = (isset($_GET["page"]) ? $_GET["page"] : 0);

    //-- Get topic info
    $res = sql_query("SELECT ".($use_poll_mod ? 't.pollid, ' : '')."t.locked, t.subject, t.sticky, t.userid AS t_userid, t.forumid, f.name AS forum_name, f.minclassread, f.minclasswrite, f.minclasscreate, (SELECT COUNT(id) FROM posts WHERE topicid = t.id) AS p_count
                        FROM topics AS t
                        LEFT JOIN forums AS f ON f.id = t.forumid
                        WHERE t.id = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);

    $arr = mysqli_fetch_assoc($res) or error_message("error", "Error", "Topic NOT Found");

    mysqli_free_result($res);

    ($use_poll_mod ? $pollid = (int) $arr["pollid"] : NULL);

    $t_userid  = (int) $arr['t_userid'];
    $locked    = ($arr['locked'] == 'yes' ? true : false);
    $subject  = $arr['subject'];
    $sticky    = ($arr['sticky'] == "yes" ? true : false);
    $forumid  = (int) $arr['forumid'];
    $forum    = $arr["forum_name"];
    $postcount = (int) $arr['p_count'];

    if ($CURUSER["class"] < $arr["minclassread"])
    {
        error_message("warn", "Warning", "You are NOT Permitted to View this Topic.");
    }

    //-- Update Hits Column --//
    sql_query("UPDATE topics
                SET views = views + 1
                WHERE id = $topicid") or sqlerr(__FILE__, __LINE__);

    //-- Make Page Menu--//
    $pagemenu1 = "

";
    $perpage  = $postsperpage;
    $pages    = ceil($postcount / $perpage);

    if ($page[0] == "p")
    {
        $findpost = substr($page, 1);

        $res = sql_query("SELECT id
                            FROM posts
                            WHERE topicid = $topicid
                            ORDER BY added") or sqlerr(__FILE__, __LINE__);

        $i = 1;

        while ($arr = mysqli_fetch_row($res))
        {
            if ($arr[0] == $findpost)
            {
                break;
            }
            ++$i;
        }
        $page = ceil($i / $perpage);
    }

    if ($page == "last")
    {
        $page = $pages;
    }
    else
    {
        if ($page < 1)
        {
            $page = 1;
        }
        else
        {
            if ($page > $pages)
            {
                $page = $pages;
            }
        }
    }

    $offset    = ((int) $page * $perpage) - $perpage;
    $offset    = ($offset < 0 ? 0 : $offset);
    $pagemenu2 = '';

    for ($i = 1;
        $i <= $pages;
        ++$i)
    {
        $pagemenu2 .= ($i == $page ? "[$i]" : "$i");
    }

    $pagemenu1 .= ($page == 1 ? "<< Prev" : "<< Prev");

    $pmlb = "      ";

    $pagemenu3 = ($page == $pages ? "Next >>

" : "Next >>

");

    site_header("Viewing Topic $subject");

    if ($use_poll_mod && is_valid_id($pollid))
    {
        $res = sql_query("SELECT p.*, pa.id AS pa_id, pa.selection
                            FROM postpolls AS p
                            LEFT JOIN postpollanswers AS pa ON pa.pollid = p.id AND pa.userid = ".$CURUSER['id']."
                            WHERE p.id = ".sqlesc($pollid)) or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($res) > 0)
        {
            $arr1 = mysqli_fetch_assoc($res);

            $userid  = (int) $CURUSER['id'];
            $question = htmlspecialchars($arr1["question"]);

            $o = array($arr1["option0"],
                      $arr1["option1"],
                      $arr1["option2"],
                      $arr1["option3"],
                      $arr1["option4"],
                      $arr1["option5"],
                      $arr1["option6"],
                      $arr1["option7"],
                      $arr1["option8"],
                      $arr1["option9"],
                      $arr1["option10"],
                      $arr1["option11"],
                      $arr1["option12"],
                      $arr1["option13"],
                      $arr1["option14"],
                      $arr1["option15"],
                      $arr1["option16"],
                      $arr1["option17"],
                      $arr1["option18"],
                      $arr1["option19"]);

            ?>
       
xbdevsponsor 16th February 2023 11:11

ftsp1.0_forums_mysqli_now
 
mysqli_* now installed into our ftsp1.0 + shoutbox announcement mod installed
backup oldfirums
Code:

/**
**************************
** FreeTSP Version: 1.0 **
**************************
** http://www.freetsp.info
** https://github.com/Krypto/FreeTSP
** Licence Info: GPL
** Copyright (C) 2010 FreeTSP v1.0
** A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
** Project Leaders: Krypto, Fireknight.
**/

//-- Bleach Forums Improved and Optimized for TBDEV.NET by Alex2005 --//

require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.'function_main.php');
require_once(FUNC_DIR.'function_user.php');
require_once(FUNC_DIR.'function_vfunctions.php');
require_once(FUNC_DIR.'function_torrenttable.php');
require_once(FUNC_DIR.'function_bbcode.php');

db_connect(true);
logged_in();
parked();

//-- Configs Start --//

//-- The Max Class, ie: UC_CODER - Is Able To Delete, Edit The Forum Etc...  --//
define('MAX_CLASS', UC_MANAGER);

//-- Set's The Max File Size In php.ini, No Need To Change  --//
ini_set("upload_max_filesize", $maxfilesize);

//-- Set's The Root Path, Change Only If You Know What You Are Doing  --//
//define('ROOT_PATH', $_SERVER['DOCUMENT_ROOT'].'/');

//-- The Extensions That Are Allowed To Be Uploaded By The Users  --//
//-- Note: You Need To Have The Pics In The $image_dir Folder, ie zip.gif, rar.gif  --//
$allowed_file_extensions = array('rar',
                                'zip');

//--  Just A Check, So That The Default URL, Wont Have A Ending Backslash (to Double Backslash The Links), No Need To Edit Or Delete --//
$site_url_rev = strrev($site_url);

if ($site_url_rev[0] == '/')
{
    $site_url_rev[0] = '';
    $site_url        = strrev($site_url_rev);
}

//-- Configs End --//
$action = (isset($_GET["action"]) ? $_GET["action"] : (isset($_POST["action"]) ? $_POST["action"] : ''));

if (!function_exists('highlight'))
{
    function highlight ($search, $subject, $hlstart = '', $hlend = '')
    {
        $srchlen = strlen($search); //-- Length Of Searched String --//

        if ($srchlen == 0)
        {
            return $subject;
        }

        $find = $subject;

        while ($find = stristr($find, $search)) //-- Find $search Text In $subject -case Insensitive --//
        {
            $srchtxt = substr($find, 0, $srchlen); //-- Get New Search Text --//
            $find    = substr($find, $srchlen);
            $subject = str_replace($srchtxt, $hlstart.$srchtxt.$hlend, $subject); //-- Highlight Found Case Insensitive Search Text --//
        }

        return $subject;
    }
}

function catch_up ($id = 0)
{
    global $CURUSER, $posts_read_expiry;

    $userid = (int) $CURUSER['id'];

    $res = sql_query("SELECT t.id, t.lastpost, r.id AS r_id, r.lastpostread
                        FROM topics AS t
                        LEFT JOIN posts AS p ON p.id = t.lastpost
                        LEFT JOIN readposts AS r ON r.userid=".sqlesc($userid)." AND r.topicid=t.id
                        WHERE p.added > ".sqlesc(get_date_time(gmtime() - $posts_read_expiry)).(!empty($id) ? '
                        AND t.id '.(is_array($id) ? 'IN ('.implode(', ', $id).')' : '= '.sqlesc($id)) : '')) or sqlerr(__FILE__, __LINE__);

    while ($arr = mysqli_fetch_assoc($res))
    {
        $postid = (int) $arr['lastpost'];

        if (!is_valid_id($arr['r_id']))
        {
            sql_query("INSERT INTO readposts (userid, topicid, lastpostread)
                        VALUES($userid, ".(int) $arr['id'].", $postid)") or sqlerr(__FILE__, __LINE__);
        }
        else
        {
            if ($arr['lastpostread'] < $postid)
            {
                sql_query("UPDATE readposts
                            SET lastpostread = $postid
                            WHERE id = ".$arr['r_id']) or sqlerr(__FILE__, __LINE__);
            }
        }
    }
    mysqli_free_result($res);
}

//-- Begin Cached Online Users --//
function forum_stats ()
{
    //-- Active Users In Forums --//
    global $forum_width, $CURUSER, $image_dir, $site_url;

    $forum3 = "";
    $files  = CACHE_DIR."forum.txt";
    $expire = 30; //-- 30 Seconds --//

    if (file_exists($files) && filemtime($files) > (time() - $expire))
    {
        $forum3 = unserialize(file_get_contents($files));
    }
    else
    {
        $dt = sqlesc(get_date_time(gmtime() - 180));

        $forum1 = sql_query("SELECT id, username, class, warned, donor
                                FROM users
                                WHERE forum_access >= $dt
                                ORDER BY class DESC") or sqlerr(__FILE__, __LINE__);

        while ($forum2 = mysqli_fetch_assoc($forum1))
        {
            $forum3[] = $forum2;
        }

        $OUTPUT = serialize($forum3);
        $fp    = fopen($files, "w");

        fputs($fp, $OUTPUT);
        fclose($fp);
    } //-- End Else --//

    $forumusers = "";

    if (is_array($forum3))

    {
        foreach ($forum3
                AS
                $arr)
        {
            if ($forumusers)
            {
                $forumusers .= ",\n";
            }
            $forumusers .= "".format_username($arr)."";
        }
    }

    if (!$forumusers)
    {
        $forumusers = "There are Currently No Active Members in the Forum";
    }

    $topic_post_res = sql_query("SELECT SUM(topiccount) AS topics, SUM(postcount) AS posts
                                    FROM forums");

    $topic_post_arr = mysqli_fetch_assoc($topic_post_res);

    ?>

   
   
       
           
       

       
           
       

       
           
       
   
Now Active in Forums:

Our Members Wrote Posts in Threads


           

       
    }

function show_forums ($forid)
{
    global $CURUSER, $image_dir, $posts_read_expiry, $site_url;

    $forums_res = sql_query("SELECT f.id, f.name, f.description, f.postcount, f.topiccount, f.minclassread, p.added, p.topicid, p.userid, p.id AS pid, u.username, t.subject, t.lastpost, r.lastpostread
                                FROM forums AS f
                                LEFT JOIN posts AS p ON p.id = (SELECT MAX(lastpost) FROM topics WHERE forumid = f.id)
                                LEFT JOIN users AS u ON u.id = p.userid
                                LEFT JOIN topics AS t ON t.id = p.topicid
                                LEFT JOIN readposts AS r ON r.userid = ".sqlesc($CURUSER['id'])." AND r.topicid = p.topicid
                                WHERE f.forid = $forid
                                ORDER BY sort ASC") or sqlerr(__FILE__, __LINE__);

    while ($forums_arr = mysqli_fetch_assoc($forums_res))
    {
        if ($CURUSER['class'] < $forums_arr["minclassread"])
        {
            continue;
        }

        $forumid    = (int) $forums_arr["id"];
        $lastpostid = (int) $forums_arr['lastpost'];

        if (is_valid_id($forums_arr['pid']))
        {
            $lastpost = "  ";

            $img = 'unlocked'.((($forums_arr['added'] > (get_date_time(gmtime() - $posts_read_expiry))) ? ((int) $forums_arr['pid'] > $forums_arr['lastpostread']) : 0) ? 'new' : '');
        }
        else
        {
            $lastpost = "
N/A
";
            $img      = "unlocked";
        }
                //echo "";
        ?>
   

           
 
               
No New Posts

               


           

       
".number_format($forums_arr["topiccount"]).""; ?>".number_format($forums_arr["postcount"]).""; ?>
Subject
               
           
Body

       
        $qbody = ($quote ? "<<<@!1!@>>>" : '');

        if (function_exists('textbbcode'))
        {
            echo("".textbbcode("compose", "body", $qbody)."");
        }
        else
        {
            ?>
                    }
        echo("

                   

                        Add Attachment
                       
                       
                       
Allowed Files: rar, zipSize Limit

                   

               

               
           
Avatar
Forum name
               
           
Description
               
           
 Minimum Class Required to View\n Minimum Class Required to Post\n Minimum Class Required to Create Topics

                   
               

           
               
           
           
               
           
       

Poll
                   
                    if ($userid == $t_userid || $CURUSER['class'] >= UC_SITE_EDITOR)
                    {
                        ?>
                        - [Edit]
                        if ($CURUSER['class'] >= UC_SITE_EDITOR)
                        {
                            ?>
                            - [Delete]
                                                    }
                    }
                    ?>
               


                   
                       
                           
                       
                   

                               

                               

                               
                                $voted = (is_valid_id($arr1['pa_id']) ? true : false);

                                if (($locked && $CURUSER['class'] < UC_SITE_EDITOR) ? true : $voted)
                                {
                                    $uservote = ($arr1["selection"] != '' ? (int) $arr1["selection"] : -1);

                                    $res3 = sql_query("SELECT selection
                                                        FROM postpollanswers
                                                        WHERE pollid = ".sqlesc($pollid)."
                                                        AND selection < 20");

                                    $tvotes = mysql_num_rows($res3);

                                    $vs = $os = array();

                                    while ($arr3 = mysqli_fetch_row($res3))
                                    {
                                        $vs[$arr3[0]] += 1;
                                    }

                                    reset($o);

                                    for ($i = 0;
                                        $i < count($o);
                                        ++$i)
                                    {
                                        if ($o[$i])
                                        {
                                            $os[$i] = array($vs[$i],
                                                            $o[$i]);
                                        }
                                    }

                                    function srt ($a, $b)
                                    {
                                        if ($a[0] > $b[0])
                                        {
                                            return -1;
                                        }

                                        if ($a[0] < $b[0])
                                        {
                                            return 1;
                                        }

                                        return 0;
                                    }

                                    if ($arr1["sort"] == "yes")
                                    {
                                        usort($os, "srt");
                                    }

                                    ?>
                                   
                                   

                                       
                                        for ($i = 0;
                                            $a = $os[$i];
                                            ++$i)
                                        {
                                            if ($i == $uservote)
                                            {
                                                $a[1] .= " *";
                                            }

                                            $p = ($tvotes == 0 ? 0 : round($a[0] / $tvotes * 100));
                                            $c = ($i % 2 ? '' : "poll");

                                            ?>

                                           
                                               
                                               
                                           

                                                                                }
                                        ?>

                                   

                                                   

                                               

                                                     %
                                               

                                   

Votes:



                                                                    }
                                else
                                {
                                    ?>

                                   

                                       

                                       
                                        for ($i = 0;
                                            $a = $o[$i];
                                            ++$i)
                                        {
                                            echo "".htmlspecialchars($a)."";
                                        }

                                        ?>

                                       

                                       


                                   


                                                                    }
                                ?>
                           

               

       
            $listvotes = (isset($_GET['listvotes']) ? true : false);

            if ($CURUSER['class'] >= UC_ADMINISTRATOR)
            {
                if (!$listvotes)
                {
                    echo "List Voters";
                }
                else
                {
                    $res4 = sql_query("SELECT pa.userid, u.username
                                        FROM postpollanswers AS pa
                                        LEFT JOIN users AS u ON u.id = pa.userid
                                        WHERE pa.pollid = ".sqlesc($pollid)) or sqlerr(__FILE__, __LINE__);
                    $voters = '';

                    while ($arr4 = mysqli_fetch_assoc($res4))
                    {
                        if (!empty($voters) && !empty($arr4['username']))
                        {
                            $voters .= ', ';
                        }

                        $voters .= "".htmlspecialchars($arr4['username'])."";
                    }

                    echo $voters." (Hide)";
                }
            }
        }
        else
        {
            ?>

       

                    error_message("error", "Sorry", "Poll Does Not Exist");
        }
        ?>
   
        }
    ?>



       

               

               

               
       

    //-- Print table
    begin_frame();

    $res = sql_query("SELECT p.id, p.added, p.userid, p.added, p.body, p.editedby, p.editedat, u.id AS uid, u.username AS uusername, u.class, u.avatar, u.donor, u.title, u.country, u.enabled, u.warned, u.uploaded, u.downloaded, u.signature, u.last_access, (SELECT COUNT(id) FROM posts WHERE userid = u.id) AS posts_count, u2.username AS u2_username ".($use_attachment_mod ? ", at.id AS at_id, at.filename AS at_filename, at.postid AS at_postid, at.size AS at_size, at.downloads AS at_downloads, at.owner AS at_owner " : "").", (SELECT lastpostread FROM readposts WHERE userid = ".sqlesc((int) $CURUSER['id']).""."AND topicid = p.topicid LIMIT 1) AS lastpostread "."FROM posts AS p "."LEFT JOIN users AS u ON p.userid = u.id ".($use_attachment_mod ? "LEFT JOIN attachments AS at ON at.postid = p.id " : "")."LEFT JOIN users AS u2 ON u2.id = p.editedby "."WHERE p.topicid = ".sqlesc($topicid)." ORDER BY id LIMIT $offset, $perpage") or sqlerr(__FILE__, __LINE__);

    $pc = mysqli_num_rows($res);
    $pn = 0;

    while ($arr = mysqli_fetch_assoc($res))
    {
        ++$pn;

        $lpr      = $arr['lastpostread'];
        $postid  = (int) $arr["id"];
        $postadd  = $arr['added'];
        $posterid = (int) $arr['userid'];
        $added    = $arr['added']." GMT (".(get_elapsed_time(sql_timestamp_to_unix_timestamp($arr['added']))).")";

        //-- Get Poster Details --//
        $uploaded    = mksize($arr['uploaded']);
        $downloaded  = mksize($arr['downloaded']);
        $last_access = $arr['last_access'];

        if ($arr['downloaded'] > 0)
        {
            $ratio = $arr['uploaded'] / $arr['downloaded'];
            $color = get_ratio_color($ratio);
            $ratio = number_format($ratio, 3);

            if ($color)
            {
                $ratio = "".$ratio."";
            }
        }
        else {
            if ($arr['uploaded'] > 0)
            {
                $ratio = "∞";
            }
            else
            {
                $ratio = "---";
            }
        }

        if (($postid > $lpr) && ($postadd > (get_date_time(gmtime() - $posts_read_expiry))))
        {
            $newp = "  (New)";
        }

        $signature = ($CURUSER['signatures'] == 'yes' ? format_comment($arr['signature']) : '');

        $postername = $arr['uusername'];

        $avatar = (!empty($postername) ? ($CURUSER['avatars'] == "yes" ? htmlspecialchars($arr['avatar']) : '') : '');

        $title = (!empty($postername) ? (empty($arr['title']) ? "(".get_user_class_name($arr['class']).")" : "(".format_comment($arr['title']).")") : '');

        $forumposts = (!empty($postername) ? ($arr['posts_count'] != 0 ? $arr['posts_count'] : 'N/A') : 'N/A');

        $by = (!empty($postername) ? "".$postername."".($arr['donor'] == "yes" ? "Donor" : '').($arr['enabled'] == 'no' ? "This Account is Disabled" : ($arr['warned'] == 'yes' ? "Warned" : '')) : "unknown[".$posterid."]");

        if (empty($avatar))
        {
            $avatar = $image_dir."default_avatar.gif";
        }

        echo "";
        echo ($pn == $pc ? '' : '');

        //begin_table(true);

        $highlight = (isset($_GET['highlight']) ? $_GET['highlight'] : '');

        $body = (!empty($highlight) ? highlight(htmlspecialchars(trim($highlight)), format_comment($arr['body'])) : format_comment($arr['body']));
        /*
        if (is_valid_id($arr['editedby']))
        {
            $body .= "

Last edited by ".$arr['u2_username']." at ".$arr['editedat']." GMT

";
        }*/

        if ($use_attachment_mod && ((!empty($arr['at_filename']) && is_valid_id($arr['at_id'])) && $arr['at_postid'] == $postid))
        {
            foreach ($allowed_file_extensions
                    AS
                    $allowed_file_extension)
            {
                if (substr($arr['at_filename'], -3) == $allowed_file_extension)
                {
                    $aimg = $allowed_file_extension;
                }
            }

            $body .= "

                    Attached Files

                    Download 
                    ".htmlspecialchars($arr['at_filename'])." (".mksize($arr['at_size']).", ".$arr['at_downloads']." downloads)  
                    ".($CURUSER['class'] >= UC_SITE_EDITOR ? "  
                    " : "")."
                   

                   
";
        }

        if (!empty($signature))
        {
            $body .= "


                                                                    __________________________________________________________________________________________________________________
                                                                                                               
                                                                    ".$signature."

";
        }
                ?>
               
   
                       
   
   
        end_table();

        ?>
        }

    if (($postid > $lpr) && ($postadd > (get_date_time(gmtime() - $posts_read_expiry))))
    {
        if ($lpr)
        {
            sql_query("UPDATE readposts
                        SET lastpostread = $postid
                        WHERE userid = $userid
                        AND topicid = $topicid") or sqlerr(__FILE__, __LINE__);
        }
        else
        {
            sql_query("INSERT INTO readposts (userid, topicid, lastpostread)
                        VALUES($userid, $topicid, $postid)") or sqlerr(__FILE__, __LINE__);
        }
    }

    if ($locked && $CURUSER['class'] < UC_SITE_EDITOR)
    {
        display_message("warn", "Sorry", "This Topic is Locked.  No New Posts are Allowed.");
    }
    else
    {
        $arr = get_forum_access_levels($forumid);

        if ($CURUSER['class'] < $arr["write"])
        {

            display_message("warn", "Sorry", "You are Mot Permitted to Post in this Forum.");

            $maypost = false;
        }
        else
        {
            $maypost = true;
        }
    }

    //-- "View Unread" / "Add Reply" Buttons --//
    if ( $CURUSER['forumpos'] == 'no' )
    {
    }
    else
    {
        if ($maypost)
        {
            ?>
                       

                       
Comment

           

               

               
               
           
               
                   
               
           
# by at                         if (isset($newp))
                        {
                            echo ("$newp");
                        }
                        ?>

                   

               

                       
            if ($CURUSER['forumpos'] == 'no')
            {

            }

                if (!$locked && $CURUSER['class'] >= UC_SITE_EDITOR)
                {
                    ?>
                                       

                   
                       
                   
 
                                       

                                    }
                /*
                if (($CURUSER["id"] == $posterid && !$locked) && $CURUSER['class'] >= UC_SITE_EDITOR)
                {
                    ?>
                                       

                   
                       
                   

                                       

                                    }if (($CURUSER["id"] == $newp) && $CURUSER['class'] >= UC_SITE_EDITOR)
                {
                    ?>

                                       

                   
                       
                   

                                       

                                    }*/
                               
            if ($CURUSER['class'] >= UC_SITE_EDITOR)
            {
                ?>

                                       

                   
                       
                   

                                       
                               
               

               
                   
               
 
                               

                               
                               

               
                               

                    }
                    elseif(($CURUSER["id"] == $posterid && !$locked) && $CURUSER['class'] < UC_SITE_EDITOR) {
        ?>
               
                           

               
               
               
 
                               
                 
                               

               
               
               

                               
       
                       
                               

               
                               
       
                        ?>
               
                           

               
               
               
 
                               
                                         
                               

               
                               
       
               

               
               
       
           

                       
                       

                       
           

                       
                       

                       

           

                Posts:   
                Ratio:   
                Uploaded:   
                Downloaded:   
           

           

                       

                       
                       

                       
           

                   
                   
                       
       

                   

                       

                           
                           
                           
                   

           

                                   
                       
                                               
                    }
                echo "";
                    echo $pagemenu1.$pmlb.$pagemenu2.$pmlb.$pagemenu3;

    }

    //-- Mod Options --//
    if ($CURUSER['class'] >= UC_SITE_EDITOR)
    {
        ?>
       

           
           
           
            begin_table();

            ?>
           
                Staff Options
           

           
                Sticky
               
                   
               
           

           
                Locked
               
                   
               
           

           
                Topic Name
               
                   
               
           

           
                Move Topic
               
                   
               
           

           
               
                   
Delete Topic

               
               
                   

                   
                    Note: Any changes made to the Topic won't take effect if you select "Yes"
               
           

           
               
                   
               
           

           
            end_table();

            ?>

       


        }

    end_frame();               
       
    //-- Forum Quick Jump Drop-Down --//
    //insert_quick_jump_menu($forumid);

    site_footer();

    $uploaderror = (isset($_GET['uploaderror']) ? htmlspecialchars($_GET['uploaderror']) : '');

    if (!empty($uploaderror))
    {
        ?>
       
            }

    exit();
    }
    else if ($action == "quotepost") //-- Action: Quote --//
    {
        $topicid = (int) $_GET["topicid"];

        if (!is_valid_id($topicid))
        {
            error_message("error", "Error", "Invalid ID!");
        }

        if ( $CURUSER['forumpos'] == 'no' )
        {
            site_header("Post Reply");
            error_message("error", "Error", "Your Forum Privilage Has Been Disabled");
            site_footer();
            exit();
        }
        else
        {
            site_header("Post Reply");
            insert_compose_frame($topicid, false, true);
            site_footer();
            exit();
        }
    }

else if ($action == "reply") //-- Action: Reply --//
{
    $topicid = (int) $_GET["topicid"];

    if (!is_valid_id($topicid))
    {
        error_message("error", "Error", "Invalid ID!");
    }

    if ( $CURUSER['forumpos'] == 'no' )
    {
        site_header("Post Reply");
        error_message("error", "Error", "Your Forum Privilage Has Been Disabled");
        site_footer();
        exit();
    }
    else
    {
        site_header("Post Reply");
        insert_compose_frame($topicid, false, false, true);
        site_footer();
        exit();
    }
}
else if ($action == "editpost") //-- Action: Edit Post --//
{
    $postid = (int) $_GET["postid"];

    if (!is_valid_id($postid))
    {
        error_message("error", "Error", "Invalid ID!");
    }

    $res = sql_query("SELECT p.userid, p.topicid, p.body, t.locked
                        FROM posts AS p
                        LEFT JOIN topics AS t ON t.id = p.topicid
                        WHERE p.id = ".sqlesc($postid)) or sqlerr(__FILE__, __LINE__);

    if (mysqli_num_rows($res) == 0)
    {
        error_message("error", "Error", "No Post with that ID!");
    }

    $arr = mysqli_fetch_assoc($res);

    if (($CURUSER["id"] != $arr["userid"] || $arr["locked"] == 'yes') && $CURUSER['class'] < UC_SITE_EDITOR)
    {
        error_message("warn", "Warning", "Access Denied!");
    }

    if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
        $body = trim($_POST['body']);

        if (empty($body))
        {
            error_message("error", "Error", "Body Cannot be Empty!");
        }

        if (substr_count(strtolower($body), '[quote') > 3)
        {
            error_message("info", "Sorry", "Quote Limit Reached");
        }

        sql_query("UPDATE posts
                    SET body = ".sqlesc($body).", editedat = ".sqlesc(get_date_time()).", editedby = {$CURUSER['id']}
                    WHERE id = $postid") or sqlerr(__FILE__, __LINE__);

        header("Location: {$_SERVER['PHP_SELF']}?action=viewtopic&topicid={$arr['topicid']}&page=p$postid#$postid");
        exit();
    }

    site_header();

    if ($CURUSER['forumpos'] == 'no')
    {
        error_message("error", "Error", "Your Forum Privilage Has Been Disabled");
        site_footer();
        exit();
    }

?>

Edit Post




   
       
           
           
       
       
           
       
   
Body

                                $ebody = htmlspecialchars(unesc($arr["body"]));

                if (function_exists('textbbcode'))
                {
                    echo("".textbbcode("compose", "body", htmlspecialchars($arr["body"]))."");
                }
                else
                {
                    ?>
                   
                                    }
                ?>

           

               
           





    site_footer();
    exit();
}
else if ($action == 'deletepost' && $CURUSER['class'] >= UC_SITE_EDITOR) //-- Action: Delete Post --//
{
    $postid = (int) $_GET['postid'];

    if (!is_valid_id($postid))
    {
        error_message("error", "Error", "Invalid ID");
    }

    $res = sql_query("SELECT p.topicid".($use_attachment_mod ? ", a.filename" : "").", (SELECT COUNT(id) FROM posts WHERE topicid=p.topicid) AS posts_count, (SELECT MAX(id) FROM posts WHERE topicid=p.topicid AND id < p.id) AS p_id FROM posts AS p ".($use_attachment_mod ? "LEFT JOIN attachments AS a ON a.postid = p.id " : "")."
                    WHERE p.id=".sqlesc($postid)) or sqlerr(__FILE__, __LINE__);

    $arr = mysqli_fetch_assoc($res) or error_message("error", "Error", "Post NOT Found");

    $topicid = (int) $arr['topicid'];

    if ($arr['posts_count'] < 2)
    {
        error_message_center("error", "Error", "You cannot Delete the Post, it's the only Post!Delete the Topic instead?Click to Confirm.");
    }

    $redirtopost = (is_valid_id($arr['p_id']) ? "&page=p".$arr['p_id']."#".$arr['p_id'] : '');

    $sure = (int) $_GET['sure'];

    if (!$sure)
    {
        error_message("error", "Sanity Check", "You are about to Delete a Post!  Click here if you are sure?");
    }

    sql_query("DELETE posts.* ".($use_attachment_mod ? ", attachments.*, attachmentdownloads.* " : "")."FROM posts ".($use_attachment_mod ? "LEFT JOIN attachments ON attachments.postid = posts.id "."LEFT JOIN attachmentdownloads ON attachmentdownloads.fileid = attachments.id " : "")."WHERE posts.id = ".sqlesc($postid)) or sqlerr(__FILE__, __LINE__);

    if ($use_attachment_mod && !empty($arr['filename']))
    {
        $filename = $attachment_dir."/".$arr['filename'];

        if (is_file($filename))
        {
            unlink($filename);
        }
    }

    $headerstr = "Location: forums.php?action=viewtopic&topicid=$topicid".($use_attachment_mod && !empty($uploaderror) ? "&uploaderror=$uploaderror" : "")."&page=last";

    update_topic_last_post($topicid);

    header("Location: {$_SERVER['PHP_SELF']}?action=viewtopic&topicid=".$topicid.$redirtopost);
    exit();
}
else if ($use_poll_mod && ($action == 'deletepoll' && $CURUSER['class'] >= UC_SITE_EDITOR))
{
    $pollid = (int) $_GET["pollid"];

    if (!is_valid_id($pollid))
    {
        error_message("error", "Error", "Invalid ID!");
    }

    $res = sql_query("SELECT pp.id, t.id AS tid
                        FROM postpolls AS pp
                        LEFT JOIN topics AS t ON t.pollid = pp.id
                        WHERE pp.id = ".sqlesc($pollid));

    if (mysqli_num_rows($res) == 0)
    {
        error_message("error", "Error", "No Poll Found with that ID.");
    }

    $arr = mysqli_fetch_array($res);

    $sure = (int) isset($_GET['sure']) && (int) $_GET['sure'];

    if (!$sure || $sure != 1)
    {
        error_message("error", "Sanity Check", "You are about to Delete a Poll!  Click here to Confirm?");
    }

    sql_query("DELETE pp.*, ppa.*
                FROM postpolls AS pp
                LEFT JOIN postpollanswers AS ppa ON ppa.pollid = pp.id
                WHERE pp.id = ".sqlesc($pollid));

    if (mysqli_affected_rows() == 0)
    {
        error_message("error", "Sorry", "There was an Error while Deleting the Poll, Please try again.");
    }

    sql_query("UPDATE topics
                SET pollid = '0'
                WHERE pollid = ".sqlesc($pollid));

    header('Location: '.$_SERVER['PHP_SELF'].'?action=viewtopic&topicid='.(int) $arr['tid']);
    exit();
}
else if ($use_poll_mod && $action == 'makepoll')
{
    $subaction = (isset($_GET["subaction"]) ? $_GET["subaction"] : (isset($_POST["subaction"]) ? $_POST["subaction"] : ''));

    $pollid = (isset($_GET["pollid"]) ? (int) $_GET["pollid"] : (isset($_POST["pollid"]) ? (int) $_POST["pollid"] : 0));

    $topicid = (isset($_POST["topicid"]) ? (int) $_POST["topicid"] : 0);

    if ($subaction == "edit")
    {
        if (!is_valid_id($pollid))
        {
            error_message("error", "Error", "Invalid ID!");
        }

        $res = sql_query("SELECT pp.*, t.id AS tid
                            FROM postpolls AS pp
                            LEFT JOIN topics AS t ON t.pollid = pp.id
                            WHERE pp.id = ".sqlesc($pollid)) or sqlerr(__FILE__, __LINE__);

        if (mysqli_num_rows($res) == 0)
        {
            error_message("error", "Error", "No Poll found with that ID.");
        }

        $poll = mysqli_fetch_assoc($res);
    }

    if ($_SERVER["REQUEST_METHOD"] == "POST" && !$topicid)
    {
        $topicid = (int) ($subaction == "edit" ? $poll['tid'] : $_POST["updatetopicid"]);

        $question = $_POST["question"];
        $option0  = $_POST["option0"];
        $option1  = $_POST["option1"];
        $option2  = $_POST["option2"];
        $option3  = $_POST["option3"];
        $option4  = $_POST["option4"];
        $option5  = $_POST["option5"];
        $option6  = $_POST["option6"];
        $option7  = $_POST["option7"];
        $option8  = $_POST["option8"];
        $option9  = $_POST["option9"];
        $option10 = $_POST["option10"];
        $option11 = $_POST["option11"];
        $option12 = $_POST["option12"];
        $option13 = $_POST["option13"];
        $option14 = $_POST["option14"];
        $option15 = $_POST["option15"];
        $option16 = $_POST["option16"];
        $option17 = $_POST["option17"];
        $option18 = $_POST["option18"];
        $option19 = $_POST["option19"];
        $sort    = $_POST["sort"];

        if (!$question || !$option0 || !$option1)
        {
            error_message("warn", "Warning", "Missing Form Data!");
        }

        if ($subaction == "edit" && is_valid_id($pollid))
        {
            sql_query("UPDATE postpolls
                        SET "."question = ".sqlesc($question).", "."option0 = ".sqlesc($option0).", "."option1 = ".sqlesc($option1).", "."option2 = ".sqlesc($option2).", "."option3 = ".sqlesc($option3).", "."option4 = ".sqlesc($option4).", "."option5 = ".sqlesc($option5).", "."option6 = ".sqlesc($option6).", "."option7 = ".sqlesc($option7).", "."option8 = ".sqlesc($option8).", "."option9 = ".sqlesc($option9).", "."option10 = ".sqlesc($option10).", "."option11 = ".sqlesc($option11).", "."option12 = ".sqlesc($option12).", "."option13 = ".sqlesc($option13).", "."option14 = ".sqlesc($option14).", "."option15 = ".sqlesc($option15).", "."option16 = ".sqlesc($option16).", "."option17 = ".sqlesc($option17).", "."option18 = ".sqlesc($option18).", "."option19 = ".sqlesc($option19).", "."sort = ".sqlesc($sort)." "."
                        WHERE id = ".sqlesc((int) $poll["id"])) or sqlerr(__FILE__, __LINE__);
        }
        else
        {
            if (!is_valid_id($topicid))
            {
                error_message("error", "Error", "Invalid Topic ID!");
            }

            sql_query("INSERT INTO postpolls
                        VALUES(id".", ".sqlesc(get_date_time()).", ".sqlesc($question).", ".sqlesc($option0).", ".sqlesc($option1).", ".sqlesc($option2).", ".sqlesc($option3).", ".sqlesc($option4).", ".sqlesc($option5).", ".sqlesc($option6).", ".sqlesc($option7).", ".sqlesc($option8).", ".sqlesc($option9).", ".sqlesc($option10).", ".sqlesc($option11).", ".sqlesc($option12).", ".sqlesc($option13).", ".sqlesc($option14).", ".sqlesc($option15).", ".sqlesc($option16).", ".sqlesc($option17).", ".sqlesc($option18).", ".sqlesc($option19).", ".sqlesc($sort).")") or sqlerr(__FILE__, __LINE__);

            $pollnum = mysqli_insert_id();

            sql_query("UPDATE topics
                        SET pollid = ".sqlesc($pollnum)."
                        WHERE id = ".sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);
        }

        header("Location: {$_SERVER['PHP_SELF']}?action=viewtopic&topicid=$topicid");
        exit();
    }
    site_header();

    if ($subaction == "edit")
    {
        echo "

Edit Poll

";
    }
    ?>

   
   
   

        if ($subaction == "edit")
    {
        ?>
            }
    ?>
   
       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
           
       

       
           
       
   
Question *
               
           
Option 1 *" />
           
Option 2 *" />
           
Option 3" />
           
Option 4" />
           
Option 5" />
           
Option 6" />
           
Option 7" />
           
Option 8" />
           
Option 9" />
           
Option 10" />
           
Option 11" />
           
Option 12" />
           
Option 13" />
           
Option 14" />
           
Option 15" />
           
Option 16" />
           
Option 17" />
           
Option 18" />
           
Option 19" />
           
Option 20" />
           
Sort
                />Yes
                /> No

           

                ' style='height: 20pt' />
           

   

* Required





   
    site_footer();
    //end_main_frame();
}
else if ($use_attachment_mod && $action == "attachment")
{
    @ini_set('zlib.output_compression', 'Off');
    @set_time_limit(0);

    if (@ini_get('output_handler') == 'ob_gzhandler' && @ob_get_length() !== false)
    {
        @ob_end_clean();
        header('Content-Encoding:');
    }

    $id = (int) $_GET['attachmentid'];

    if (!is_valid_id($id))
    {
        die('Invalid Attachment ID!');
    }

    $at = sql_query("SELECT filename, owner, type
                        FROM attachments
                        WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);

    $resat = mysqli_fetch_assoc($at) or die('No Attachment with that ID!');

    $filename = $attachment_dir.'/'.$resat['filename'];

    if (!is_file($filename))
    {
        die('Non-existent Attachment.');
    }

    if (!is_readable($filename))
    {
        die('Attachment is Unreadable.');
    }

    if ((isset($_GET['subaction']) ? $_GET['subaction'] : '') == 'delete')
    {
        if ($CURUSER['id'] <> $resat["owner"] && $CURUSER['class'] < UC_SITE_EDITOR)
        {
            die('Not your Attachment to Delete.');
        }

        unlink($filename);

        sql_query("DELETE attachments, attachmentdownloads
                    FROM attachments
                    LEFT JOIN attachmentdownloads ON attachmentdownloads.fileid = attachments.id
                    WHERE attachments.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);

        die("File Successfully Deleted");
    }

    sql_query("UPDATE attachments
                SET downloads = downloads + 1
                WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);

    $res = sql_query("SELECT fileid
                        FROM attachmentdownloads
                        WHERE fileid=".sqlesc($id)."
                        AND userid=".sqlesc($CURUSER['id']));

    if (mysqli_num_rows($res) == 0)
    {
        sql_query("INSERT INTO attachmentdownloads (fileid, username, userid, date, downloads)
                    VALUES (".sqlesc($id).", ".sqlesc($CURUSER['username']).", ".sqlesc($CURUSER['id']).", ".sqlesc(get_date_time()).", 1)") or sqlerr(__FILE__, __LINE__);
    }
    else
    {
        sql_query("UPDATE attachmentdownloads
                    SET downloads = downloads + 1
                    WHERE fileid = ".sqlesc($id)."
                    AND userid = ".sqlesc($CURUSER['id']));
    }

    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private", false); //-- Required For Certain Browsers --//
    header("Content-Type: ".$arr['type']);
    header("Content-Disposition: attachment; filename="".basename($filename)."";");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($filename));
    readfile($filename);
    exit();
}
else if ($use_attachment_mod && $action == "whodownloaded")
{
    $fileid = (int) $_GET['fileid'];

    if (!is_valid_id($fileid))
    {
        die('Invalid ID!');
    }

    $res = sql_query("SELECT fileid, at.filename, userid, username, atdl.downloads, date, at.downloads AS dl
                        FROM attachmentdownloads AS atdl
                        LEFT JOIN attachments AS at ON at.id=atdl.fileid
                        WHERE fileid = ".sqlesc($fileid).($CURUSER['class'] < UC_SITE_EDITOR ? "
                        AND owner=".$CURUSER['id'] : '')) or sqlerr(__FILE__, __LINE__);

    if (mysqli_num_rows($res) == 0)
    {
        die('

Nothing Found!

');
    }
    else
    {
        ?>             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

   
   

       
       

       
        Who Downloaded
       
   
   
   
       
           
           
           
           
       

       
        $dls = 0;

        while ($arr = mysqli_fetch_assoc($res))
        {
            echo "
                   
                   
                   
                   
            ";

            $dls += (int) $arr['downloads'];
        }
        ?>
       
           
       
   
File NameDownloaded byDownloadsDate
".htmlspecialchars($arr['filename'])."".htmlspecialchars($arr['username'])."".(int) $arr['downloads']."".$arr['date']." (".get_elapsed_time(sql_timestamp_to_unix_timestamp($arr['date'])).")

                Total Downloads:
               
           

   
   
        }
}
else if ($action == "viewforum") //-- Action: View Forum --//
{
    $forumid = (int) $_GET['forumid'];

    if (!is_valid_id($forumid))
    {
        error_message("error", "Error", "Invalid ID!");
    }

    $page  = (isset($_GET["page"]) ? (int) $_GET["page"] : 0);
    $userid = (int) $CURUSER["id"];

    //--  Get Forum Details --//
    $res = sql_query("SELECT f.name AS forum_name, f.minclassread, (SELECT COUNT(id) FROM topics WHERE forumid = f.id) AS t_count FROM forums AS f
                        WHERE f.id = ".sqlesc($forumid)) or sqlerr(__FILE__, __LINE__);

    $arr = mysqli_fetch_assoc($res) or error_message("error", "Error", "No Forum with that ID!");

    if ($CURUSER['class'] < $arr["minclassread"])
    {
        error_message("warn", "Warning", "Access Denied!");
    }

    $perpage = (empty($CURUSER['topicsperpage']) ? 20 : (int) $CURUSER['topicsperpage']);
    $num    = (int) $arr['t_count'];

    if ($page == 0)
    {
        $page = 1;
    }

    $first = ($page * $perpage) - $perpage + 1;
    $last  = $first + $perpage - 1;

    if ($last > $num)
    {
        $last = $num;
    }

    $pages = floor($num / $perpage);

    if ($perpage * $pages < $num)
    {
        ++$pages;
    }

    //-- Build Menu --//
    $menu1 = "

";
    $menu2 = '';

    $lastspace = false;

    for ($i = 1;
        $i <= $pages;
        ++$i)
    {
        if ($i == $page)
        {
            $menu2 .= "[$i]\n";
        }

        else
        {
            if ($i > 3 && ($i < $pages - 2) && ($page - $i > 3 || $i - $page > 3))
            {
                if ($lastspace)
                {
                    continue;
                }

                $menu2 .= "... \n";

                $lastspace = true;
            }
            else
            {
                $menu2 .= "$i\n";

                $lastspace = false;
            }
        }

        if ($i < $pages)
        {
            $menu2 .= "|";
        }
    }

    $menu1 .= ($page == 1 ? "<< Prev" : "<< Prev");

    $mlb = "      ";

    $menu3 = ($last == $num ? "Next >>

" : "Next >>

");

    $offset = $first - 1;

    $topics_res = sql_query("SELECT t.id, t.userid, t.views, t.locked, t.sticky".($use_poll_mod ? ', t.pollid' : '').", t.subject, u1.username, r.lastpostread, p.id AS p_id, p.userid AS p_userid, p.added AS p_added, (SELECT COUNT(id) FROM posts WHERE topicid=t.id) AS p_count, u2.username AS u2_username
                            FROM topics AS t
                            LEFT JOIN users AS u1 ON u1.id=t.userid
                            LEFT JOIN readposts AS r ON r.userid = ".sqlesc($userid)." AND r.topicid = t.id
                            LEFT JOIN posts AS p ON p.id = (SELECT MAX(id) FROM posts WHERE topicid = t.id)
                            LEFT JOIN users AS u2 ON u2.id = p.userid
                            WHERE t.forumid = ".sqlesc($forumid)."
                            ORDER BY t.sticky, t.lastpost DESC
                            LIMIT $offset, $perpage") or sqlerr(__FILE__, __LINE__);

    site_header("Forum");

    ?>
       

               

               

               
               
        $arr = get_forum_access_levels($forumid) or die();

    $maypost = ($CURUSER['class'] >= $arr["write"] && $CURUSER['class'] >= $arr["create"]);

    if (!$maypost)
    {
        display_message("warn", "Sorry", "You are Not Permitted to Start New Topics in this Forum.");
    }

    ?>
   
       
           

                if ($maypost)
        {
            ?>
           

                    }

        ?>
       
   

               

                   
                   
               

           

               

                   
                   
                   
               

           
       
       
    if (mysqli_num_rows($topics_res) > 0)
    {
        ?>
       
           
               
               
               
               
               
           
                while ($topic_arr = mysqli_fetch_assoc($topics_res))
        {
            $topicid      = (int) $topic_arr['id'];
            $topic_userid = (int) $topic_arr['userid'];
            $sticky      = ($topic_arr['sticky'] == "yes");

            ($use_poll_mod ? $topicpoll = is_valid_id($topic_arr["pollid"]) : NULL);

            $tpages = floor($topic_arr['p_count'] / $postsperpage);

            if (($tpages * $postsperpage) != $topic_arr['p_count'])
            {
                ++$tpages;
            }

            if ($tpages > 1)
            {
                $topicpages = " (Multiple pages";

                $split = ($tpages > 10) ? true : false;
                $flag  = false;

                for ($i = 1;
                    $i <= $tpages;
                    ++$i)
                {
                    if ($split && ($i > 4 && $i < ($tpages - 3)))
                    {
                        if (!$flag)
                        {
                            $topicpages .= ' ...';
                            $flag = true;
                        }
                        continue;
                    }
                    $topicpages .= " $i";
                }
                $topicpages .= ")";
            }
            else
            {
                $topicpages = '';
            }

            $lpusername = (is_valid_id($topic_arr['p_userid']) && !empty($topic_arr['u2_username']) ? "
".$topic_arr['u2_username']."
" : "
unknown[$topic_userid]
");

            $lpauthor = (is_valid_id($topic_arr['userid']) && !empty($topic_arr['username']) ? "
".$topic_arr['username']."
" : "
unknown[$topic_userid]
");

            $new = ($topic_arr["p_added"] > (get_date_time(gmtime() - $posts_read_expiry))) ? ((int) $topic_arr['p_id'] > $topic_arr['lastpostread']) : 0;

            $topicpic = ($topic_arr['locked'] == "yes" ? ($new ? "lockednew" : "locked") : ($new ? "newpost" : "post"));

            ?>
                       
           

             
                               

               
               
               

               
           


                    }

        end_table();
    }
    else
    {
        display_message("info", "Sorry", "No Topics Found");
    }

    echo $menu1.$mlb.$menu2.$mlb.$menu3;
    ?>
   
Topic TitleRepliesViewsAuthorLast post

                   

                   

                   

               
".max(0, $topic_arr['p_count'] - 1).""; ?>".number_format($topic_arr['views']).""; ?>  
                   

                         ".$topic_arr["p_added"]." 
                                        By ".$lpusername."
"; ?>
                   
               

       
           
           
           
           
       
   

                New Posts
           
New Posts
                Locked Topic
           
Locked Topic

   
   
    //insert_quick_jump_menu($forumid);

    site_footer();
    exit();
}
else if ($action == 'viewunread') //-- Action: View Unread Posts --//
{
    if ((isset($_POST[$action."_action"]) ? $_POST[$action."_action"] : '') == 'clear')
    {
        $topic_ids = (isset($_POST['topic_id']) ? $_POST['topic_id'] : array());

        if (empty($topic_ids))
        {
            header('Location: '.$_SERVER['PHP_SELF'].'?action='.$action);
            exit();
        }

        foreach ($topic_ids
                AS
                $topic_id)
        {
            if (!is_valid_id($topic_id))
            {
                error_message("error", "Error", "Invalid ID!");
            }
        }

        catch_up($topic_ids);

        header('Location: '.$_SERVER['PHP_SELF'].'?action='.$action);
        exit();
    }
    else
    {
        $added = sqlesc(get_date_time(gmtime() - $posts_read_expiry));

        $res = sql_query('SELECT t.lastpost, r.lastpostread, f.minclassread
                            FROM topics AS t
                            LEFT JOIN posts AS p ON t.lastpost=p.id
                            LEFT JOIN readposts AS r ON r.userid='.sqlesc((int) $CURUSER['id']).' AND r.topicid=t.id
                            LEFT JOIN forums AS f ON f.id=t.forumid
                            WHERE p.added > '.$added) or sqlerr(__FILE__, __LINE__);
        $count = 0;

        while ($arr = mysqli_fetch_assoc($res))
        {
            if ($arr['lastpostread'] >= $arr['lastpost'] || $CURUSER['class'] < $arr['minclassread'])
            {
                continue;
            }

            $count++;
        }
        mysqli_free_result($res);

        if ($count > 0)
        {
            list($pagertop, $pagerbottom, $limit) = pager(25, $count, $_SERVER['PHP_SELF'].'?action='.$action.'&');

            site_header();

            echo '

Topics with Unread Posts

';

            echo $pagertop;

            ?>

           

       

           
               
                   
                       
                       
                   

               
                $res = sql_query('SELECT t.id, t.forumid, t.subject, t.lastpost, r.lastpostread, f.name, f.minclassread
                                    FROM topics AS t
                                    LEFT JOIN posts AS p ON t.lastpost=p.id
                                    LEFT JOIN readposts AS r ON r.userid='.sqlesc((int) $CURUSER['id']).' AND r.topicid=t.id
                                    LEFT JOIN forums AS f ON f.id=t.forumid
                                    WHERE p.added > '.$added.'
                                    ORDER BY t.forumid '.$limit) or sqlerr(__FILE__, __LINE__);

                while ($arr = mysqli_fetch_assoc($res))
                {
                    if ($arr['lastpostread'] >= $arr['lastpost'] || $CURUSER['class'] < $arr['minclassread'])
                    {
                        continue;
                    }

                    $post_res = sql_query("SELECT id
                                            FROM posts
                                            WHERE topicid = ".(int) $arr['id']) or sqlerr(__FILE__, __LINE__);

                    while ($post_arr = mysqli_fetch_assoc($post_res))

                    {
                        if ($arr['lastpostread'] < $post_arr['id'] && !isset($post[$i]))
                        {
                            $post[$i] = $post_arr['id'];
                        }
                    }
                    ?>
                   
                       
                       
                       
                   

                   
                    $i++;
                }
                mysqli_free_result($res);

                ?>
               
                   
               

               
                end_table();

                ?>

           

           
            echo $pagerbottom;

            echo '
Mark All Posts as Read
';

            site_footer();
            die();
        }
        else
        {
            error_message_center("info", "Sorry", "There are NO Unread Posts.Click here to get Today's Posts (last 24h).");
        }
    }
}
else
{
    if ($action == "getdaily")
    {
        $res = sql_query('SELECT COUNT(p.id) AS post_count
                            FROM posts AS p
                            LEFT JOIN topics AS t ON t.id = p.topicid
                            LEFT JOIN forums AS f ON f.id = t.forumid
                            WHERE ADDDATE(p.added, INTERVAL 1 DAY) > '.sqlesc(get_date_time()).'
                            AND f.minclassread <= '.$CURUSER['class']) or sqlerr(__FILE__, __LINE__);

        $arr = mysqli_fetch_assoc($res);
        mysqli_free_result($res);

        $count = (int) $arr['post_count'];

        if (empty($count))
        {
            error_message("info", "Sorry", "No Posts in the Last 24 Hours.");
        }

        site_header('Today Posts (Last 24 Hours)');

        list($pagertop, $pagerbottom, $limit) = pager(20, $count, $_SERVER['PHP_SELF'].'?action='.$action.'&');

        ?>

       

Today Posts (Last 24 Hours)



                echo $pagertop;

        ?>

   
TopicClear

                           
                       

                            &page=last#last'>in '>
                       

                           
                       

                         
                       
                   

       
           
           
           
           
       
       
        $res = sql_query('SELECT p.id AS pid, p.topicid, p.userid AS userpost, p.added, t.id AS tid, t.subject, t.forumid, t.lastpost, t.views, f.name, f.minclassread, f.topiccount, u.username
                            FROM posts AS p
                            LEFT JOIN topics AS t ON t.id = p.topicid
                            LEFT JOIN forums AS f ON f.id = t.forumid
                            LEFT JOIN users AS u ON u.id = p.userid
                            LEFT JOIN users AS topicposter ON topicposter.id = t.userid
                            WHERE ADDDATE(p.added, INTERVAL 1 DAY) > '.sqlesc(get_date_time()).'
                            AND f.minclassread <= '.$CURUSER['class'].'
                            ORDER BY p.added DESC '.$limit) or sqlerr(__FILE__, __LINE__);

        while ($getdaily = mysqli_fetch_assoc($res))
        {
            $postid  = (int) $getdaily['pid'];
            $posterid = (int) $getdaily['userpost'];

            ?>

       
           
           
           
           
       
                    }
        mysqli_free_result($res);

        end_table();

        echo $pagerbottom;

        site_footer();
    }
    else
    {
        if ($action == "search") //-- Action: Search --//
        {
            site_header("Forum Search");

            $error    = false;
            $found    = '';
            $keywords = (isset($_GET['keywords']) ? trim($_GET['keywords']) : '');

            if (!empty($keywords))
            {
                $res = sql_query("SELECT COUNT(id) AS c
                                    FROM posts
                                    WHERE body LIKE ".sqlesc("%".sqlwildcardesc($keywords)."%")) or sqlerr(__FILE__, __LINE__);

                $arr = mysqli_fetch_assoc($res);

                $count    = (int) $arr['c'];
                $keywords = htmlspecialchars($keywords);

                if ($count == 0)
                {
                    $error = true;
                }
                else
                {
                    list($pagertop, $pagerbottom, $limit) = pager(10, $count, $_SERVER['PHP_SELF'].'?action='.$action.'&keywords='.$keywords.'&');

                    $res = sql_query("SELECT p.id, p.topicid, p.userid, p.added, t.forumid, t.subject, f.name, f.minclassread, u.username
                                        FROM posts AS p
                                        LEFT JOIN topics AS t ON t.id=p.topicid
                                        LEFT JOIN forums AS f ON f.id=t.forumid
                                        LEFT JOIN users AS u ON u.id=p.userid
                                        WHERE p.body LIKE ".sqlesc("%".$keywords."%")." $limit");

                    $num = mysqli_num_rows($res);
                    echo $pagertop;

                    ?>

           
Topic TitleViewsAuthorPosted At

                &page=#'> In 
           


               
                if (!empty($getdaily['username']))
                {
                    ?>

                                            href="/userdetails.php?id=">

                                    }
                else
                {
                    ?>

                    Unknown[]

                                    }
                ?>

           

               


                                        echo get_elapsed_time(strtotime($getdaily['added']));
                    ?>

               

           

               
                   
                   
                   
                   
               

                   
                    for ($i = 0;
                        $i < $num;
                        ++$i)
                    {
                        $post = mysqli_fetch_assoc($res);

                        if ($post['minclassread'] > $CURUSER['class'])
                        {
                            --$count;
                            continue;
                        }

                        echo "
                               

                               

                               

                               
                            ";
                    }
                    end_table();

                    echo $pagerbottom;

                    $found = "[ Found $count Post".($count != 1 ? "s" : "")." ]";

                }
            }
            ?>
           

               

Search on Forums

Nothing Found ]" : $found)?>
               

               

                   

                       
                       
PostTopicForumPosted by
".$post['id']."
                                    ".htmlspecialchars($post['subject'])."
                               
".(empty($post['name']) ? 'unknown['.$post['forumid'].']' : "
                                    ".htmlspecialchars($post['name'])."")."
                               
".(empty($post['username']) ? 'unknown['.$post['userid'].']' : "
                                    ".$post['username']."")."at ".$post['added']."
                               

                           
                           
                               
                           
                           
                               

                           
                           
                       
By Keyword:

                                   
                                   
                                    Note: Searches
                                        Only
                                        in Posts.
                                   

                               

                   
               
           

           
            site_footer();
            exit();
        }
        else
        {
            if ($action == 'forumview')
            {
                $ovfid = (isset($_GET["forid"]) ? (int) $_GET["forid"] : 0);

                if (!is_valid_id($ovfid))
                {
                    error_message("error", "Error", "Invalid ID!");
                }

                $res = sql_query("SELECT name
                                    FROM overforums
                                    WHERE id = $ovfid
                                    ORDER BY sort") or sqlerr(__FILE__, __LINE__);

                $arr = mysqli_fetch_assoc($res) or error_message("error", "Sorry", "No Forums with that ID!");

                sql_query("UPDATE users
                            SET forum_access = ".sqlesc(get_date_time())."
                            WHERE id = {$CURUSER['id']}") or sqlerr(__FILE__, __LINE__);

                site_header("Forums");

                ?>

               

Forums
                   



   
       
           
           
           
           
       

               
                show_forums($ovfid);
              // echo "";
                end_table();

                site_footer();
                exit();
            }
            else //-- Default Action: View Forums --//
            {
                if (isset($_GET["catchup"]))
                {
                    catch_up();

                    header('Location: '.$_SERVER['PHP_SELF']);
                    exit();
                }

                sql_query("UPDATE users
                            SET forum_access = '".get_date_time()."'
                            WHERE id={$CURUSER['id']}") or sqlerr(__FILE__, __LINE__);

                site_header("Forums");
               
/////////////////////////////////////////// CHAT /////////////////////////////////////////////////////////////////////////                               
/* Start Chat Functions */
function autoshout ($msg = '')
{
    $message = $msg;

    sql_query("INSERT INTO shoutbox (date, text)
                VALUES (".implode(", ", array_map("sqlesc", array(time(), $message))).")") or sqlerr(__FILE__, __LINE__);
        echo "";                       
}

unset ($insert);

$insert = false;
$query  = "";

//-- Delete Shout --//
if (isset($_GET['del']) && get_user_class() >= UC_SITE_EDITOR && is_valid_id($_GET['del']))
{
    sql_query("DELETE
                FROM shoutbox
                WHERE id=".sqlesc($_GET['del']));
}

//-- Empty Shout - Coder/Owner --//
if (isset($_GET['delall']) && get_user_class() >= UC_SYSOP)
{
    $query = "TRUNCATE
                TABLE shoutbox";
}

sql_query($query);
unset($query);

//-- Power Users+ Can Edit Anyones Single Shouts - pdq --//
if (isset($_GET['edit']) && ($_GET['user'] == $CURUSER['id']) && ($CURUSER['class'] >= UC_USER && $CURUSER['class'] <= UC_SITE_EDITOR) && is_valid_id($_GET['edit']))
{
    $sql = sql_query('SELECT id, text, userid
                        FROM shoutbox
                        WHERE userid ='.sqlesc($_GET['user']).'
                        AND id ='.sqlesc($_GET['edit']));

    $res = mysqli_fetch_array($sql);

    echo "
           
           
           
           
            ";
    die;
}

//-- Edit Shout --//
if (isset($_GET['edit']) && get_user_class() >= UC_SITE_EDITOR && is_valid_id($_GET['edit']))
{
    $sql = sql_query('SELECT id,text
                        FROM shoutbox
                        WHERE id='.sqlesc($_GET['edit']));

    $res = mysqli_fetch_assoc($sql);
    unset($sql);

    echo "
         
         
         
          "; 
}

//-- Staff Shout Edit --//
if (isset($_POST['text']) && $CURUSER['class'] >= UC_SITE_EDITOR && is_valid_id($_POST['id']))
{
    $text        = trim($_POST['text']);
    $text_parsed = format_comment($text);

    sql_query('UPDATE shoutbox
                SET text = '.sqlesc($text).', text_parsed = '.sqlesc($text_parsed).'
                WHERE id ='.sqlesc($_POST['id']));

    unset ($text, $text_parsed);
}

// Power User+ Shout Edit --//
//-- Correction By Fireknight Added In theme_function.php --//
if (isset($_POST['text']) && (isset($_POST['user']) == $CURUSER['id']) && ($CURUSER['class'] >= UC_USER && $CURUSER['class'] < UC_SITE_EDITOR) && is_valid_id($_POST['id']))
{
    $text        = trim($_POST['text']);
    $text_parsed = format_comment($text);

    sql_query('UPDATE shoutbox
                SET text = '.sqlesc($text).', text_parsed = '.sqlesc($text_parsed).'
                WHERE userid='.sqlesc($_POST['user']).'
                AND id='.sqlesc($_POST['id']));

    unset ($text, $text_parsed);
}

if ($CURUSER['shoutboxpos'] == 'no')
{
    echo("
Sorry, you are NOT Authorized to Shout.  (Check your PMs for the reason why?)
");
    exit;
}

/* End Chat Functions */

echo "
Community Area

       
Chat Room

       
"; 
        echo "
           
               

Member Scene Member Trustee Site Contributor Prite Editor Forum Moderator Global Moderator Administrator Site Operator Team Leader Web Developer

 
           
 
";
/* 
  echo '

               
               
               
               
               
               
               
';
*/               
               
        echo "
";
                               
    echo "       
               
           

           
                       

                Smilies       
           

                       
                       

                       
           
   

                       

           
           
                                       
                       
                       

                       
           
             
                       
                       

                       
           
             
                       
                       

                       
           
             
                       
                       

                       
           

                       
                       

           
           

           
                       
                       

       
";
               
    if (isset($_POST['sent']) && $_POST['sent'] == "yes") {
         
          /* Stops Double Post */
          echo '';
          /* Stops Double Post */

      $limit      = 1;
      $userid      = $CURUSER["id"];
      $date        = sqlesc(time());
      $text        = (trim($_POST["shbox_text"]));
      $text_parsed = format_comment($text);
      $private_pattern = "/(^\/private)\s([a-zA-Z0-9]+)\s([\w\W\s]+)/";

                if (preg_match($private_pattern,$text,$vars))
        {
                       
            $to_user = mysqli_result(sql_query('SELECT id
                                                FROM users
                                                WHERE username = '.sqlesc($vars[2])),0) or exit(mysqli_error());

            if ($to_user != 0 && $to_user != $CURUSER['id'])
            {
                $text        = $vars[2]." - ".$vars[3];
                $text_parsed = format_comment($text);
               
                               
                sql_query ("INSERT INTO shoutbox (userid, date, text, text_parsed,to_user)
                                VALUES (".sqlesc($userid).", $date, ".sqlesc( $text ).",".sqlesc( $text_parsed).",".sqlesc($to_user).")") or sqlerr( __FILE__, __LINE__ );
            }
            //print "";
        }
         
        $batman = mysqli_fetch_row(sql_query("SELECT userid, date
                                            FROM shoutbox ORDER by id DESC
                                            LIMIT 1 ")) or print ("First Shout or an Error");
        if (empty($text) || strlen($text) == 1)
        {
            print("
Shout can't be empty");
                        echo "";
        }

        else
        {
            sql_query("INSERT INTO shoutbox (id, userid, date, text)
                            VALUES ('id',".sqlesc($userid).", $date, ".sqlesc($text).")") or sqlerr(__FILE__, __LINE__);
                               
                          //echo "";
        // echo "";
          // print "";
            $trigger_words = array(
                                              'Albert Einstein'=>array('He developed the general theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics).'),
                                  'Lil Wayne'=>array('Dwayne Michael Carter Jr. (born September 27, 1982), known professionally as Lil Wayne, is an American hip hop recording artist and author from New Orleans, Louisiana.'),
                                  'Pokemon'=>array($CURUSER['username'] .' has stolen them from Prevail, Yet again!'),
                                              'PHP'=>array('Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Development Team. PHP originally stood for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext Preprocessor.'),
                                              'Best Holiday Location'=>array('Australia we have friendly snakes, spiders & pokemon.'),
                        )                ;
          if(preg_match('/('.join('|',array_keys($trigger_words)).')/iU',$text,$trigger_key) && isset($trigger_words[$trigger_key[0]])) {
            shuffle($trigger_words[$trigger_key[0]]);
            $message = $trigger_words[$trigger_key[0]][0];
            sleep(1);
            //autoshout($message);               
                        $text = $message;
            $userid = "7";
            $username = "System";
            $date=time();
            sql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
                                 
               

                }
                }               
    }
//////////////////////////////////////////////////// END CHAT ////////////////////////////////////////////////////////////////////////////////////       
//-- Start Users on Index - Credits Bigjoos --//
$active3 = "";
$file    = CACHE_DIR."active.txt";
$expire  = 30; //-- 30 Seconds --//

if (file_exists($file) && filemtime($file) > (time() - $expire))
{
    $active3 = unserialize(file_get_contents($file));
}
else
{
    $dt      = sqlesc(get_date_time(gmtime() - 180));
   
        $active1 = sql_query("SELECT id, username, class, warned, enabled, added
                            FROM users
                            WHERE last_access >= $dt
                            ORDER BY class DESC") or sqlerr(__FILE__, __LINE__);

    while ($active2 = mysqli_fetch_assoc($active1))
    {
        $active3[] = $active2;
    }

    $OUTPUT = serialize($active3);
    $fp    = fopen($file, "w");

    fputs($fp, $OUTPUT);
    fclose($fp);
}

$activeusers = "";

if (is_array($active3))
{
    foreach ($active3
            AS
            $arr)
    {
        if ($activeusers)
        {
            $activeusers .= ",\n";
        }

        $activeusers .= "".format_username($arr)."";
    }
}       
        /*
    foreach ($active3
            AS
            $arr)
    {
        if ($activeusers)
        {
            $activeusers .= "\n";
        }
        $messages = ($CURUSER['id'] != $arr['id'] ? "PM User" : "" );
        $private = ($CURUSER['id'] != $arr['id'] ? "Private Shout " : "");
                $reply = ($CURUSER['id'] != $arr['id'] ? "','shbox','shbox_text')">Reply" : "" );       
                   
                if ($messages && $private && $reply) {
                $activeusers .= "
 $reply $private $messages ".format_username($arr)."
\n";
                } else {
                $activeusers .= "
 ".format_username($arr)."
\n";       
                }
    }
        */

$fh    = fopen(CACHE_DIR."active.txt", "r");
$string = file_get_contents(CACHE_DIR."active.txt");
$count  = preg_match_all('/username/', $string, $dummy);

if (!$activeusers)
{
    $activeusers = "Sorry - No Users Presently Active ";
}

echo "
 Users Online
";
 echo "
".$activeusers."
";
 
  echo "
";
?>


                               











               
eBook Club Forums

                               


                        Search Forums
                        New Posts
                        Todays Posts
                        Mark All as Read
                                               
               


                               
                    $ovf_res = sql_query("SELECT id, name, minclassview
                                            FROM overforums
                                            ORDER BY sort ASC") or sqlerr(__FILE__, __LINE__);

                    while ($ovf_arr = mysqli_fetch_assoc($ovf_res))
                    {
                        if ($CURUSER['class'] < $ovf_arr["minclassview"])
                        {
                            continue;
                        }

                        $ovfid  = (int) $ovf_arr["id"];
                        $ovfname = $ovf_arr["name"];

                        ?>

                                               
ForumsTopicsPostsLast post

                       
                           
                           
                           
                           
                       

                                           
                        show_forums($ovfid);
                                                echo "";
                    }
                   
                                        ?>
                                   

                               
                           
TopicsPostsLast post
       
                                                            if ($forum_stats_mod)
                    {
                        forum_stats();
                    }
                   
                    ?>

                                 
                site_footer();
            }
        }
    }
}

?>


All times are GMT +2. The time now is 00:44.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2026, vBulletin Solutions Inc.