Zend - The PHP Company




Forums

Add Code


R3X.PHORUM  

Type: application
Added by: phyr3xi4n
Entered: 09/06/2004
Last modified: 07/12/2003
Rating: - (fewer than 3 votes)
Views: 9379
Not your average forum.. to say the least. Features include:

+ Delete, modify, and quote messages

+ + Thread/Forum status (based on # of posts/views)

+ + Dynamic styles (100% image-based)

+ + Huge administration core

+ + Mini administration panel (bottom of every page)

+ + Event logging

+ + User login/signup/profiles

+ + Photoshop Contests =]


<?

    
/* -------------------------------------- */
    /* functions.php                          */
    /* this is the core of the whole thing!   */
    /* james klatt '04 (http://phyr3xi4n.net) */
    /* -------------------------------------- */

    // Logger
    
function logger($who$what$from){
    require (
"settings.php");
        if (
$who == ''){
        
$who "Anonymous";
        }
    
$when $forum_datestamp " (" $forum_timestamp ")";
    
$query00 mysql_query("INSERT INTO `phorum_logger` (`logger_who`, `logger_what`, `logger_when`, `logger_from`)"."VALUES ('$who', '$what', '$when', '$from')"); 
    }

    
// Validate URL
    
function validate($url){ 
    
$fp = @fopen($url,"r"); 
        if (
$fp){ 
        
fclose($fp); 
         return 
true
        }
        else{ 
        return 
false
        } 
    }

    
// Thanks to ZEND.COM, this could happen:
    
function replacestring ($search,$replace,$subject){
    
$srchlen=strlen($search);
        while (
$find stristr($subject,$search)){
        
$srchtxt substr($find,0,$srchlen);
        
$subject str_replace($srchtxt,$replace,$subject);
        }
    return 
$subject;
    }

    
// R3X.C0D3 Parser
    
function rc_parser ($junk$what){
    require (
"settings.php");
    require (
"$settings_style/style.php");
        
// Gandolf fucked my sister
        
if ($what != 'subject'){
        
// Check for an image
        
$well substr_count ($junk'[img]');
            if (
$well != '0'){
            
// Get the URL of the image
            
$junk preg_replace("/[img]/""[1]"$junk1);
            
$junk preg_replace("/[/img]/""[2]"$junk1);
            
preg_match("/[d+](.*)[d+]/"$junk$matches);
            
$img_url $matches[1];
                if (
validate($img_url)){
                
// Get the dimensions of the image
                
$img_dim getimagesize($matches[1]);
                }
        
// Reset [img] tags..
        
$junk replacestring("[1]""[img]"$junk);
        
$junk replacestring("[2]""[/img]"$junk);
        }

        
// Standard RC Parsing
        
$junk replacestring("[img]""<img src='"$junk);
            if (
$img_dim[0] > $max_imgwidth){
            
// Check if this is being quoted
            
$quote_check substr_count ($junk'[quote]');
                if (
$quote_check != '0'){
                
$junk replacestring("[/img]""' width='500' alt='$img_url' border='0'>"$junk);
                }
                else{
                
$junk replacestring("[/img]""' width='$max_imgwidth' alt='$img_url' border='0'>"$junk);
                }
            }
            else{
            
$junk replacestring("[/img]""' alt='$img_url' border='0'>"$junk);
            }

        
// RC Parse for a SCROLLING MARQUEE
        
$junk replacestring("[scroll, left]""<marquee direction='left' scrollamount='5'>"$junk);
        
$junk replacestring("[scroll, right]""<marquee direction='right'>"$junk);
        
$junk replacestring("[/scroll]""</marquee>"$junk);

        
// RC Parse for a BREAK
        
$junk replacestring("[br]""<br>"$junk);

        
// RC Parse for GLOWING TEXT
        
$junk replacestring("[glow(green)]""<span style='width: 300; height: 1; filter: glow(color=#00FF00, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);
        
$junk replacestring("[glow(white)]""<span style='width: 300; height: 1; filter: glow(color=#FFFFFF, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);
        
$junk replacestring("[glow(blue)]""<span style='width: 300; height: 1; filter: glow(color=#0000FF, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);
        
$junk replacestring("[glow(red)]""<span style='width: 300; height: 1; filter: glow(color=#FF0000, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);
        
$junk replacestring("[glow(black)]""<span style='width: 300; height: 1; filter: glow(color=#000000, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);
        
$junk replacestring("[glow(pink)]""<span style='width: 300; height: 1; filter: glow(color=#FF9999, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);
        
$junk replacestring("[glow(yellow)]""<span style='width: 300; height: 1; filter: glow(color=#FFFF00, strength=3)'>"$junk);
        
$junk replacestring("[/glow]""</span>"$junk);

        
// RC Parse for ALIGNMENT
        
$junk replacestring("[align=""<div align='"$junk);
        
$junk replacestring("[/align]""</div>"$junk);

        
// RC Parse for TEXT SIZE
        
$junk replacestring("[size=""<font size='"$junk);
        
$junk replacestring("[/size]""</font>"$junk);

        
// RC Parse for QUOTING
        
$junk replacestring("[quote]""<table width='100%' height='1' cellspacing='0' cellpadding='$quote_margin' border='0'><tr width='100%' height='1'><td width='100%' height='1'><table width='100%' height='1' cellspacing='0' cellpadding='0' border='0' align='center' bgcolor='$quote_border'><tr width='100%' height='1'><td width='1' height='1'></td><td width='*' height='1'></td><td width='1' height='1'></td></tr><tr width='100%' height='1'><td width='1' height='1'></td><td width='*' height='1'><table width='100%' height='100%' cellspacing='0' cellpadding='2' border='0' bgcolor='$quote_bgcolor'><tr><td>"$junk);
        
$junk replacestring("[/quote]""</td></tr></table></td><td width='1' height='1'></td></tr><tr width='100%' height='1'><td width='1' height='1'></td><td width='*' height='1'></td><td width='1' height='1'></td></tr></table></td></tr></table>"$junk);

        
// RC Parse for LINKING
        
$junk replacestring("[url=""<a href='"$junk);
        
$junk replacestring("[/url]""</a>"$junk);

        
// RC Parse for LINE BREAKS
        
$junk replacestring("n""<br>"$junk);
        }

    
// RC Parse for BOLD, ITALIC, UNDERLINE, STRIKE, FONT COLOR, and FONT FACE
    
$junk replacestring("[b]""<b>"$junk);
    
$junk replacestring("[/b]""</b>"$junk);
    
$junk replacestring("[i]""<i>"$junk);
    
$junk replacestring("[/i]""</i>"$junk);
    
$junk replacestring("[u]""<u>"$junk);
    
$junk replacestring("[/u]""</u>"$junk);
    
$junk replacestring("[s]""<strike>"$junk);
    
$junk replacestring("[/s]""</strike>"$junk);
    
$junk replacestring("[color=""<font color='"$junk);
    
$junk replacestring("[/color]""</font>"$junk);
    
$junk replacestring("[font=""<font face='"$junk);
    
$junk replacestring("[/font]""</font>"$junk);

    
// RC Parse for INDENTS
    
$junk replacestring("[indent]""&nbsp;&nbsp;&nbsp;"$junk);

        
// Then he fucked my mother
        
if ($what != 'subject'){
        
$junk replacestring("]""' target='_blank' class='replies'>"$junk);
            
// Word Filter
            
if ($usefilter == '1'){
            
$query12 mysql_query("SELECT * FROM `phorum_filter`");
                while (
$array12 mysql_fetch_array($query12)){
                
$junk replacestring("{$array12['badword']}",$filter_beg "{$array12['goodword']}$filter_end$junk);
                }
            }
        }

    return 
$junk;
    }

    
// Baleet Post
    
function baleet ($postnum){
    
// Get information for `$postnum`
    
$query00 mysql_query("SELECT * FROM `phorum_replies` WHERE `id`='$postnum'");
    
$array00 mysql_fetch_array($query00);
    
// Physically delete the post
    
$query01 mysql_query("DELETE FROM `phorum_replies` WHERE `id`='$postnum'");
    
// Find the most recent postee
    
$query02 mysql_query("SELECT * FROM `phorum_replies` WHERE `t_pimp`='{$array00['t_pimp']}' ORDER BY `id` DESC");
    
$array02 mysql_fetch_array($query02);
    
// Apply that name to `phorum_threads` container
    
$query03 mysql_query("UPDATE `phorum_threads` SET `server_datestamp`='{$array02['server_datestamp']}' WHERE `id`='{$array00['t_pimp']}'");
    }

    
// Conjure a New Forum
    
function newforum ($title$desc$mods){
    
$query01 mysql_query("INSERT INTO `phorum_forums` (title, description, mods, type_current, type_backup)".
    
"VALUES ('$title', '$desc', '$mods', 'open', 'open')");
    }

    
// Conjure a New Thread
    
function newthread ($f_pimp$title$type_base$type_current$server_datestamp){
    
$query01 mysql_query("INSERT INTO `phorum_threads` (f_pimp, title, type_base, type_current, server_datestamp)".
    
"VALUES ('$f_pimp', '$title', '$type_base', '$type_current', '$server_datestamp')");
    }

    
// Post Reply
    
function postreply ($f_pimp$t_pimp$post_author$post_subject$post_date$post_time$post_message$server_datestamp){
        if (isset(
$_SESSION['username'])){
        
$WHOpost_author $_SESSION['username'];
        }
        else{
        
$WHOpost_author "Guest";
        }

    
$query01 mysql_query("INSERT INTO `phorum_replies` (f_pimp, t_pimp, post_author, post_subject, post_date, post_time, post_message, server_datestamp)".
    
"VALUES ('$f_pimp', '$t_pimp', '$WHOpost_author', '$post_subject', '$post_date', '$post_time', '$post_message', '$server_datestamp')");

    
// Update the threads server time (helps with sorting)
    
$query01 mysql_query("UPDATE `phorum_threads` SET `server_datestamp`='$server_datestamp' WHERE `id`='$t_pimp'");
    }

    
// Modify Post
    
function modify ($postnum$newmessage$newsubject){
    require (
"settings.php");
    
// Template to display
    
$lastedit "Last edited by: {$_SESSION['username']} on $forum_datestamp ($forum_timestamp)";
    
$query00 mysql_query("UPDATE `phorum_replies` SET `post_message`='$newmessage', `lastedit`='$lastedit', `post_subject`='$newsubject' WHERE `id`='$postnum'");
    }

    
// Redirection
    
function redirect ($url$time$pause){
    print (
'<script>
    var redirecturl="' 
$url '"
    var pausefor=' 
$time '
        function postaction(){
            if (window.timer){
            clearInterval(timer)
            clearInterval(timer_2)
            }
        window.location=redirecturl
        }
    setTimeout("postaction()",pausefor*' 
$pause ')
    </script>'
);
    }

    
// View Counter
    
function viewcounter ($level$t_id){
        
// Add 1 (one) view to the counter if user isn't an Admin
        
if ($level != 'Admin'){
        
$query00 mysql_query("SELECT * FROM `phorum_threads` WHERE `id`='$t_id'");
        
$array00 mysql_fetch_array($query00);
        
$math $array00['views'] + 1;
        
$query01 mysql_query("UPDATE `phorum_threads` SET `views`='$math' WHERE `id`='$t_id'");
        }
    }

    
// Laspost
    
function lastpost ($lastpost_who$lastpost_time$lastpost_date){
        if (
$lastpost_who == '' oR $lastpost_time == '' OR $lastpost_date == ''){
        print (
'n/a');
        }
        else{
            if (
$lastpost_who == 'Guest'){
            print (
'Guest<br>' $lastpost_date ' (' $lastpost_time ')');
            }
            else{
            
// Get information on this user
            
$query00 mysql_query("SELECT * FROM `phorum_users` WHERE `username`='$lastpost_who'");
            
$array00 mysql_fetch_array($query00);
            print (
'<a href="index.php?page=viewprofile&u_id=' $array00['id'] . '" class="forums">' $lastpost_who '</a><br>' $lastpost_date ' (' $lastpost_time ')');
            }
        }
    }

    
// Forum/Thread Status
    
function status (){
        if (!isset(
$_GET['page']) && !isset($_GET['f_id']) && !isset($_GET['t_id'])){
            
// Check if user is an Admin
            
if ($_SESSION['level'] == 'Admin'){
            print (
'<a href="index.php?page=newforum" class="location">Start a new forum</a>');
            }
        }
        elseif (isset(
$_GET['page']) && isset($_GET['f_id']) && !isset($_GET['t_id'])){
        
$query00 mysql_query("SELECT * FROM `phorum_forums` WHERE `id`='{$_GET['f_id']}'");
        
$array00 mysql_fetch_array($query00);
            
// Check if the forum is locked or open
            
if ($array00['type_current'] == 'locked'){
            
$status0 "locked";
            print (
'This forum is locked!');
            }
            elseif (
$array00['type_current'] == 'open' AND $_GET['page'] != 'newthread'){
            
$status0 "open";
            print (
'<a href="index.php?page=newthread&f_id=' $_GET['f_id'] . '" class="location">Start a new thread</a>');
            }
        }
        elseif (isset(
$_GET['page']) && isset($_GET['f_id']) && isset($_GET['t_id'])){
        
$query01 mysql_query("SELECT * FROM `phorum_threads` WHERE `id`='{$_GET['t_id']}'");
        
$array01 mysql_fetch_array($query01);
            if (
$array01['type_current'] == 'locked'){
            
$status1 "locked";
            print (
'This thread is locked!');
            }
            elseif (
$array01['type_current'] == 'open' AND $_GET['page'] != 'postreply' AND $_GET['page'] != 'modify' AND $_GET['page'] != 'baleet' AND $_GET['page'] != 'quote' AND $_GET['page'] != 'vote'){
            
$status1 "open";
            print (
'<a href="index.php?page=postreply&f_id=' $_GET['f_id'] . '&t_id=' $_GET['t_id'] . '" class="location">Post a reply</a>');
            }
        }
    }

    
// Display Users Location
    
function location (){
        if (isset(
$_SESSION['username'])){
        
$query99 mysql_query("SELECT * FROM `phorum_users` WHERE `username`='{$_SESSION['username']}'");
        
$array99 mysql_fetch_array($query99);
        
$username "<a href="index.php?page=viewprofile&u_id=" . $array99['id'] . "" class="location">" $_SESSION['username'] . "</a> � ";
        }
        else{
        
$username "Guest � ";
        }
            
// I don't quite remember doing this.. *sigh*
            
if ($gayness == 'FiveBillion'){
            }
            else{
                if (!isset(
$_GET['page'])){
                print (
$username 'Forum Index');
                }
                else{
                print (
$username);
                    if (
$_GET['page'] == 'newforum'){
                    print (
'<a href="index.php" class="location">Forum Index</a> � Start a new forum');
                    }
                    else{
                        
// Retrieve all information for forums, threads, and replies
                        
if (isset($_GET['f_id'])){
                        
$query00 mysql_query("SELECT * FROM `phorum_forums` WHERE `id`='{$_GET['f_id']}'");
                        
$array00 mysql_fetch_array($query00);
                        }
                        if (isset(
$_GET['t_id'])){
                        
$query01 mysql_query("SELECT * FROM `phorum_threads` WHERE `id`='{$_GET['t_id']}'");
                        
$array01 mysql_fetch_array($query01);
                        }
                        if (isset(
$_GET['p_id'])){
                        
$query02 mysql_query("SELECT * FROM `phorum_replies` WHERE `id`='{$_GET['p_id']}'");
                        
$array02 mysql_fetch_array($query02);
                        }

                        
// If the user is viewing a regular page (memberlist, register, etc)
                        
if (isset($_GET['page']) && !isset($_GET['f_id']) && !isset($_GET['t_id']) && !isset($_GET['p_id'])){
                        print (
'<a href="index.php" class="location">Forum Index</a> � ');
                            if (
$_GET['page'] == 'memberlist'){
                            print (
'Member List');
                            }
                            elseif (
$_GET['page'] == 'viewprofile'){
                            print (
'User Profile');
                            }
                            elseif (
$_GET['page'] == 'register'){
                            print (
'Register');
                            }
                            elseif (
$_GET['page'] == 'editprofile'){
                            print (
'Edit Profile');
                            }
                            elseif (
$_GET['page'] == 'administration'){
                            print (
'Administration');
                            }
                        }
                        
// If the user is viewing the threads in a forum
                        
if (isset($_GET['page']) && isset($_GET['f_id']) && !isset($_GET['t_id']) && !isset($_GET['p_id'])){
                            if (
$_GET['page'] == 'newthread'){
                            print (
'<a href="index.php" class="location">Forum Index</a> � ' '<a href="index.php?page=threads&f_id=' $_GET['f_id'] . '" class="location">' rc_parser($array00['title'], "subject") . '</a> � Start a new thread');
                            }
                            else{
                            print (
'<a href="index.php" class="location">Forum Index</a> � ' rc_parser($array00['title'], "subject"));
                            }
                        }
                        
// If the user is viewing the replies in a thread
                        
if (isset($_GET['page']) && isset($_GET['f_id']) && isset($_GET['t_id']) && !isset($_GET['p_id'])){
                            if (
$_GET['page'] == 'postreply'){
                            print (
'<a href="index.php" class="location">Forum Index</a> � <a href="index.php?page=threads&f_id=' $_GET['f_id']  . '" class="location">' rc_parser($array00['title'], "subject") . '</a> � <a href="index.php?page=replies&f_id=' $_GET['f_id']  . '&t_id=' $_GET['t_id'] . '" class="location">' rc_parser($array01['title'], "subject") . '</a> � Post a reply');
                            }
                            else{
                            print (
'<a href="index.php" class="location">Forum Index</a> � <a href="index.php?page=threads&f_id=' $_GET['f_id']  . '" class="location">' rc_parser($array00['title'], "subject") . '</a> � ' rc_parser($array01['title'], "subject"));
                            }
                        }
                        
// If the user is doing something to a post (baleet, modify, etc)
                        
if (isset($_GET['page']) && isset($_GET['f_id']) && isset($_GET['t_id']) && isset($_GET['p_id'])){
                        print (
'<a href="index.php" class="location">Forum Index</a> � <a href="index.php?page=threads&f_id=' $_GET['f_id']  . '" class="location">' rc_parser($array00['title'], "subject") . '</a> � <a href="index.php?page=replies&f_id=' $_GET['f_id']  . '&t_id=' $_GET['t_id'] . '" class="location">' rc_parser($array01['title'], "subject") . '</a> � ');
                            if (
$_GET['page'] == 'vote'){
                            print (
'Cast your vote');
                            }
                            elseif (
$_GET['page'] == 'baleet'){
                            print (
'Baleet post');
                            }
                            elseif (
$_GET['page'] == 'modify'){
                            print (
'Modify post');
                            }
                            else{
                            print (
'Quote post');
                            }
                        }
                    }
                }
            }
        }

    
// Avatar Check
    
function avatar_check ($u_id$username){
    require (
"settings.php");
        if (
$username == 'Guest'){
            if (
$ava_guest == '1'){
            print (
'<img src="' $settings_style '/images/avatar_guest.gif" alt="Guest User">');
            }
            else{
            print (
'&nbsp;');
            }
        }
        else{
        
// Check if user exists
        
$query00 mysql_query("SELECT * FROM `phorum_users` WHERE `username`='$username'");
        
$nrows00 mysql_num_rows($query00);
            if (
$nrows00 != '0'){
            
$array00 mysql_fetch_array($query00);
                
// If the user is an Admin without an avatar
                
if ($array00['level'] == 'Admin' && $array00['avatar'] == ''){
                    if (
$ava_admin == '1'){
                    print (
'<img src="' $settings_style '/images/avatar_admin.gif" alt="Administrator">');
                    }
                    else{
                    print (
'&nbsp;');
                    }
                }
                
// If user is an Admin with an avatar
                
elseif ($array00['level'] == 'Admin' && $array00['avatar'] != ''){
                    if (
validate($array00['avatar'])){
                    
// Get the dimensions of the image
                    
$img_dim getimagesize($array00['avatar']);
                        if (
$img_dim[0] > $max_avawidth){
                        
$resized_ava_width $max_avawidth;
                        }
                        else{
                        
$resized_ava_width $img_dim[0];
                        }
                        if (
$img_dim[1] > $max_avaheight){
                        
$resized_ava_height $max_avaheight;
                        }
                        else{
                        
$resized_ava_height $img_dim[1];
                        }
                    print (
'<img src="' $array00['avatar'] . '" width="' $resized_ava_width '" height="' $resized_ava_height '" alt="Custom Avatar">');
                    }
                }
                
// If the user is a Regular User without an avatar
                
elseif ($array00['level'] == 'User' && $array00['avatar'] == ''){
                    if (
$ava_none == '1'){
                    print (
'<img src="' $settings_style '/images/avatar_none.gif" alt="No Avatar!">');
                    }
                    else{
                    print (
'&nbsp;');
                    }
                }
                
// If the user is a Regular User with an avatar
                
elseif ($array00['level'] == 'User' && $array00['avatar'] != ''){
                    if (
validate($array00['avatar'])){
                    
// Get the dimensions of the image
                    
$img_dim getimagesize($array00['avatar']);
                        if (
$img_dim[0] > $max_avawidth){
                        
$resized_ava_width $max_avawidth;
                        }
                        else{
                        
$resized_ava_width $img_dim[0];
                        }
                        if (
$img_dim[1] > $max_avaheight){
                        
$resized_ava_height $max_avaheight;
                        }
                        else{
                        
$resized_ava_height $img_dim[1];
                        }
                    print (
'<img src="' $array00['avatar'] . '" width="' $resized_ava_width '" height="' $resized_ava_height '" alt="Custom Avatar">');
                    }
                }
            }
            else{
                
// The user must not exist! /gasp/
                
if ($ava_removed == '1'){
                print (
'<img src="' $settings_style '/images/avatar_removed.gif" alt="Non-existent User">');
                }
                else{
                print (
'&nbsp;');
                }
            }
        }
    }

    
// Check Forum Type
    
function forum_type_check ($type$backup){
    require (
"settings.php");
        if (
$type == 'open'){
        print (
'<img src="' $settings_style '/images/forum_open.gif" alt="Open Forum">');
        }
        elseif (
$type == 'locked'){
        print (
'<img src="' $settings_style '/images/forum_locked.gif" alt="Locked Forum">');
        }
    }

    
// Check Thread Type
    
function thread_type_check ($id$base$type$backup$stamp){
    require (
"settings.php");
    
// Get all information for this thread
    
$query99 mysql_query("SELECT * FROM `phorum_threads` WHERE `id`='$id'");
    
$array99 mysql_fetch_array($query99);
        
// If the thread is a PHOTOSHOP CONTEST
        
if ($base == 'pscontest'){
        
$basepic "pscontest";
        
$basealt "Photoshop Contest";
        
// Check if the PS Contest has been 'offed (has ended)
        
$query00 mysql_query("SELECT * FROM `phorum_threads` WHERE `id`='$id'");
        
$array00 mysql_fetch_array($query00);
            if (
$array00['ps_status'] == 'offed'){
            
$offed "yes";
            }
        }
        
// If the thread is IMPORTANT
        
elseif ($base == 'important'){
        
$basepic "important";
        
$basealt "Important Thread";
        }
        
// If the thread is FUNNY
        
elseif ($base == 'funny'){
        
$basepic "funny";
        
$basealt "Funny Thread";
        }
        
// If the thread is NORMAL
        
elseif ($base == 'normal'){
        
$basepic "normal";
        
$basealt "Normal Thread";
        }
        
// If the thread isn't FINISHED
            
if ($type == 'open'){
                
// Check if the thread is OLD
                
if ($old_span_type == 'month'){
                
$chewwy $old_span 10000;
                }
                elseif (
$old_span_type == 'day'){
                
$chewwy $old_span 100;
                }
                else{
                
$chewwy 20 100;
                }
                
$difference $server_datestamp $stamp;
                
$query01 mysql_query("SELECT * FROM `phorum_replies` WHERE `t_pimp`='$id'");
                
$nrows01 mysql_num_rows($query01);
                    if (
$difference $chewwy){
                        if (
$nrows01 != '0'){
                        
$alt "Old";
                        print (
'<img src="' $settings_style '/images/' $basepic '_old.gif" alt="' $basealt ' (' $alt ')">');
                        }
                        elseif (
$offed == "yes"){
                        
$alt "Finished";
                        print (
'<img src="' $settings_style '/images/' $basepic '_offed.gif" alt="' $basealt ' (' $alt ')">');
                        }
                        else{
                        
$alt "Zero Replies";
                        print (
'<img src="' $settings_style '/images/' $basepic '_open.gif" alt="' $basealt ' (' $alt ')">');
                        }
                    }
                    else{
                    
// Check if the thread is HOTT (with TWO t's!)
                    
if ($hot_span_type == 'month'){
                    
$bacca $hot_span 10000;
                    }
                    elseif (
$hot_span_type == 'day'){
                    
$bacca $hot_span 100;
                    }
                    else{
                    
$bacca 10 100;
                    }
                    
$difference $server_datestamp $bacca;
                    
$query02 mysql_query("SELECT * FROM `phorum_replies` WHERE `t_pimp`='$id' AND `server_datestamp`>'$notcool'");
                    
$nrows02 mysql_num_rows($query02);
                        if (
$nrows02 >= $hot_peek OR $array99['views'] >= $hot_views){
                        
$alt "Hot";
                        print (
'<img src="' $settings_style '/images/' $basepic '_hot.gif" alt="' $basealt ' (' $alt ')">');
                        }
                        elseif (
$offed == "yes"){
                        
$alt "Finished";
                        print (
'<img src="' $settings_style '/images/' $basepic '_offed.gif" alt="' $basealt ' (' $alt ')">');
                        }
                        else{
                        
$alt "Open";
                        print (
'<img src="' $settings_style '/images/' $basepic '_open.gif" alt="' $basealt ' (' $alt ')">');
                        }
                    }
                }
            elseif (
$type == 'locked' AND $offed == "yes"){
            
$alt "Locked & Finished";
            print (
'<img src="' $settings_style '/images/' $basepic '_locked.gif" alt="' $basealt ' (' $alt ')">');
            }
            elseif (
$type == 'locked' AND $offed != "yes"){
            
$alt "Locked";
            print (
'<img src="' $settings_style '/images/' $basepic '_locked.gif" alt="' $basealt ' (' $alt ')">');
            }
        }

    
// Check Moderators
    
function forum_mod_check($string){
    
$string explode("||"$string);
    
$howmany count($string);
        
// If there is only one moderator..
        
if ($howmany == '1'){
        
// Check if the ONLY moderator exists /sigh/ El Immigrante says, "Lonely, lonely moderator. You have no friends."
        
$query03 mysql_query("SELECT * FROM `phorum_users` WHERE `username`='{$string['0']}'");
        
$nrows03 mysql_num_rows($query03);
            if (
$nrows03 != '0'){
            
$array03 mysql_fetch_array($query03);
            print (
'<a href="index.php?page=viewprofile&u_id=' $array03['id'] . '" class="forums">' $string['0'] . '</a>');
            }
            else{
                if (
$string[0] == ''){
                print (
'None');
                }
                else{
                print (
$string[0]);
                }
            }
        }
        
// If there is more than one moderator..
        
if ($howmany '1'){
        
// Check if the first user exists..
        
$query00 mysql_query("SELECT * FROM `phorum_users` WHERE `username`='{$string['0']}'");
        
$nrows00 mysql_num_rows($query00);
            if (
$nrows00 != '0'){
            
$array00 mysql_fetch_array($query00);
            print (
'<a href="index.php?page=viewprofile&u_id=' $array00['id'] . '" class="forums">' $string['0'] . '</a>');
            }
            else{
            print (
$string[0]);
            }
                for (
$i 1$i <= ($howmany 1); $i++){
                
// Check if each additional user exists..
                
$query01 mysql_query("SELECT * FROM `phorum_users` WHERE `username`='{$string[$i]}'");
                
$nrows01 mysql_num_rows($query01);
                    if (
$nrows01 != '0'){
                    
$array01 mysql_fetch_array($query01);
                    print (
', <a href="index.php?page=viewprofile&u_id=' $array01['id'] . '" class="forums">' $string[$i] . '</a>');
                    }
                    else{
                    print (
', ' $string[$i]);
                    }
                }
            }
        }

    
// In Japan they say, "and that concludes Lesson 2. In the first part of Lesson 3 [...], we'll start learning how to ask questions, and later get into some new, improved verbs. Cool."

?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories