Example #1
0
function jal_get_shoutbox($cat = "", $comboTheme = 1)
{
    global $wpdb, $user_level, $user_identity, $user_url, $user_ID, $jal_admin_user_level, $show, $size, $position, $shout_opt, $shout_tb;
    $HiddenCat = "";
    $show_to_level = $shout_opt['level_for_shoutbox'];
    $level_for_archive = $shout_opt['level_for_archive'];
    $level_for_archive = $level_for_archive == -1 ? 1 : current_user_can('level_' . $level_for_archive);
    $level_for_theme = $shout_opt['level_for_theme'];
    $user_level = isset($user_level) ? $user_level : -1;
    $current = $show_to_level == -1 ? 1 : current_user_can('level_' . $show_to_level);
    $curthe = $level_for_theme == -1 ? 1 : current_user_can('level_' . $level_for_theme);
    $only_registered = $shout_opt['registered_only'];
    $only_registered = $only_registered == -1 ? 1 : current_user_can('level_' . $only_registered);
    $curadmin = current_user_can('level_' . $jal_admin_user_level);
    $use_theme = $shout_opt['use_theme'];
    $lastID = 0;
    if ($cat != "") {
        $HiddenCat = $cat;
    }
    if ($current == 1) {
        if ($cat == "") {
            if ($curthe == 1 && $use_theme == 1) {
                $HiddenCat = $cat = str_replace("\\", "", $_COOKIE['jalCombo']);
            }
        }
        $XHTML = $shout_opt['xhtml'];
        $Captcha = $shout_opt['use_captcha'];
        $jal_number_of_comments = get_option('shoutbox_nb_comment');
        $Actual_URL = get_bloginfo('wpurl');
        $_SESSION['Show_Users'] = $shout_opt['show_user_online'];
        $_SESSION['BadCalc'] = __("You should learn to count before use the shoutbox :)", wordspew);
        $_SESSION['DLSpam'] = __("I DON'T LIKE SPAM !!!", wordspew);
        $_SESSION['HTTPLimit'] = __("Sorry, but you can post only one url by message...", wordspew);
        $_SESSION['IPLogged'] = __("Your IP address have been banned from this blog, if you feel this is in error please contact the webmaster.", wordspew);
        $_SESSION['hashtext' . $shout_tb] = $shout_opt['hash'];
        $_SESSION['useURL'] = $shout_opt['use_url'];
        $_SESSION['useCaptcha'] = $Captcha;
        ?>
<div id="wordspew">
	<div id="chatoutput">
	<?php 
        @mysql_query("SET CHARACTER SET 'utf8'");
        @mysql_query("SET NAMES utf8");
        $wpdb->hide_errors();
        $SQLCat = html_entity_decode($cat, ENT_COMPAT, 'UTF-8');
        $SQLCat = str_replace("'", "\\'", $SQLCat);
        $SQL = "SELECT * FROM " . mysql_real_escape_string($shout_tb) . "liveshoutbox WHERE cat='" . mysql_real_escape_string($SQLCat) . "'";
        $SQL .= " ORDER BY id DESC LIMIT " . $jal_number_of_comments;
        $results = $wpdb->get_results($SQL);
        $wpdb->show_errors();
        // Will only add the last message div if it is looping for the first time
        $jal_first_time = true;
        $registered_only = $only_registered ? false : true;
        $rand1 = mt_rand(0, 10);
        $rand2 = mt_rand(0, 10);
        $total = intval($rand1 + $rand2);
        if ($shout_opt['use_sound'] == 1) {
            $img_sound = !isset($_COOKIE['jalSound' . $shout_tb]) || $_COOKIE['jalSound' . $shout_tb] == 1 || $_COOKIE['jalSound' . $shout_tb] == "" ? "sound_1.gif" : "sound_0.gif";
            echo '<img src="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/img/' . $img_sound . '" alt="" onclick="setSound();" id="JalSound" title="' . __("Click this to turn on/off sound", wordspew) . '"/>';
        }
        if ($shout_opt['show_spam'] == 1) {
            $nb = get_option('shoutbox_spam');
            printf(__('<div id="Show_Spam">%s spams blocked</div>', wordspew), $nb);
        }
        // Loops the messages into a list
        foreach ($results as $r) {
            if ($jal_first_time) {
                $_SESSION['Chrono'] = $r->time;
                printf(__('<div id="lastMessage"><span>Last Message</span><br/><div id="responseTime">%s</div>&nbsp;ago</div>', wordspew), jal_time_since($r->time));
                echo '<div id="usersOnline">' . jal_get_useronline_extended() . '</div>
		<ul id="outputList">';
            }
            $target = "";
            // Add links
            if (strpos($r->text, $Actual_URL) === false && $XHTML == 0) {
                $target = ' target="_blank"';
            }
            $theLink = __("link", wordspew);
            $theMail = __("email", wordspew);
            $r->text = preg_replace("`(http|ftp)+(s)?:(//)((\\w|\\.|\\-|_)+)(/)?(\\S+)?`i", "<a rel=\"nofollow\" href=\"\\0\"{$target}>&laquo;{$theLink}&raquo;</a>", $r->text);
            $r->text = preg_replace("`([-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6})`i", "<a href=\"mailto:\\1\">&laquo;{$theMail}&raquo;</a>", $r->text);
            if ($jal_first_time) {
                $lastID = $r->id;
            }
            $target = "";
            if ($r->url != "") {
                if (strpos($r->url, $Actual_URL) === false && $XHTML == 0) {
                    $target = ' target="_blank"';
                }
            }
            $url = empty($r->url) ? $r->name : '<a rel="nofollow" href="' . $r->url . '"' . $target . '>' . $r->name . '</a>';
            if ($jal_first_time && !isset($_COOKIE['jalCaptcha']) && !$user_ID && !$registered_only && $_SESSION['useCaptcha'] == '1') {
                echo '<li><span>' . __("Info", wordspew) . ' : </span><b>' . __("Please, resolve the addition below before post any new comment...", wordspew) . '</b></li>';
            }
            $TheText = $r->text;
            $verif = true;
            if (substr($TheText, 0, 2) == "@@") {
                $verif = false;
                $PosSpace = strpos($TheText, " ");
                $To = substr($TheText, 2, $PosSpace - 2);
                $Deb = strlen($To) + 2;
                $TheText = '<span class="InfoUser">' . __("Private message for", wordspew) . ' ' . $To . ':</span>' . substr($TheText, $Deb);
                $the_nickname = isset($user_identity) ? $user_identity : str_replace("\\'", "'", $_COOKIE['jalUserName']);
                if (strtolower($the_nickname) == strtolower($To) || strtolower($the_nickname) == strtolower($r->name) || ($user_level >= $jal_admin_user_level || $curadmin == 1)) {
                    $verif = true;
                }
            }
            if (verifyName($r->name)) {
                $class = "jal_user ";
            }
            $delete = "";
            if ($user_level >= $jal_admin_user_level || $curadmin == 1) {
                $delete .= ' <span onclick="deleteComment(' . $r->id . ')" class="delShout" title="' . __("Delete", wordspew) . '">x</span>';
            }
            $avatar = "";
            if ($show == '1' && $r->email != "") {
                $avatar = shout_get_avatar($r->email, $size, $position);
            }
            if ($verif) {
                echo '<li id="comment-new' . $r->id . '">' . $avatar . '<span title="' . jal_time_since($r->time) . '" class="' . $class . sanitize_name($r->name) . '">' . stripslashes($url) . ' : </span>' . convert_smilies(" " . stripslashes($TheText)) . $delete . '</li>
		';
            }
            $jal_first_time = false;
            $class = "";
        }
        if (!$results) {
            printf(__('<div id="lastMessage"><span>Last Message</span><br/><div id="responseTime">%s</div>&nbsp;ago</div>', wordspew), '0 ' . __('minute', wordspew));
            echo '
		<div id="usersOnline">' . jal_get_useronline_extended() . '</div>
		<ul id="outputList">
		<li>&nbsp;</li>
		';
        }
        $use_url = $shout_opt['use_url'] == 1 ? TRUE : FALSE;
        $use_textarea = $shout_opt['use_textarea'] == 1 ? TRUE : FALSE;
        $combo = '<input type="hidden" name="shout_cat" id="shout_cat" value="' . $HiddenCat . '"/>';
        if ($use_theme == 1 && ($comboTheme == 1 || $user_level >= $jal_admin_user_level)) {
            $SQL = "SELECT DISTINCT cat FROM " . mysql_real_escape_string($shout_tb) . "liveshoutbox WHERE cat!='' ORDER BY cat";
            $theme = $wpdb->get_results($SQL);
            $wpdb->show_errors();
            if ($curthe == 1) {
                if ($theme || $curadmin == 1) {
                    $combo .= '<div id="shout_theme" style="display:none;"><b>' . __("Theme:", wordspew) . '</b><br/>';
                    $combo .= '<select name="shout_cat_theme" id="shout_cat_theme" onchange="document.getElementById(\'chatbarText\').focus();" onblur="CleanBox()" 
				onfocus="oldval=this.options[this.selectedIndex].value">
				<option value="">' . __("Miscellaneous", wordspew) . '</option>';
                    foreach ($theme as $theme_name) {
                        $the_theme = stripslashes($theme_name->cat);
                        $selected = $SQLCat == $the_theme || $HiddenCat == $the_theme ? ' selected="true"' : '';
                        $combo .= '<option value="' . $the_theme . '"' . $selected . '>' . $the_theme . '</option>';
                    }
                    if ($user_level >= $jal_admin_user_level || $curadmin == 1) {
                        $combo .= '<option value="add_custom" style="font-weight:bold">' . __("New theme", wordspew) . '</option>';
                    }
                    $combo .= '</select></div>';
                }
            }
        }
        if (!defined("DB_CHARSET")) {
            @mysql_query("SET CHARACTER SET 'latin1'");
            @mysql_query("SET NAMES latin1");
        }
        ?>
	</ul>
	</div>
	<div id="chatInput">
<?php 
        $hashtext = $_SESSION['hashtext' . $shout_tb];
        if (!$registered_only) {
            $display_name = isset($_COOKIE['jalUserName']) ? $_COOKIE['jalUserName'] : __("Guest_", wordspew) . rand(0, 5000);
            $display_name = str_replace("\\'", "'", $display_name);
            ?>
	<form id="chatForm" method="post" action="<?php 
            echo $Actual_URL;
            ?>
/wp-content/plugins/pierres-wordspew/wordspew.php">
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php 
            echo md5($total . $hashtext);
            ?>
"/>
	<?php 
            if ($user_level >= $jal_admin_user_level || $curadmin == 1) {
                // If user is allowed to use the admin page
                $_SESSION['isAdmin' . $shout_tb] = true;
                echo '<a href="' . $Actual_URL . '/wp-admin/edit.php?page=wordspew_admin" onmouseover="ChangeURL(\'shoutboxAdmin\',\'' . $Actual_URL . '/wp-admin/edit.php?page=wordspew_admin\',\'&amp;shout_cat=\')" id="shoutboxAdmin">' . __("Admin", wordspew) . '</a>';
            } else {
                unset($_SESSION['isAdmin' . $shout_tb]);
            }
            echo '<div style="text-align:right;">';
            if ($level_for_archive == 1) {
                echo '<a href="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/wordspew_archive.php" onmouseover="ChangeURL(\'shoutboxArchive\',\'' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/wordspew_archive.php\',\'?shout_cat=\')" id="shoutboxArchive">' . __("Archive", wordspew) . '</a>| ';
            }
            echo '<a style="cursor:pointer;" onclick="ChangeBoxSize(1)" title="' . __("Click here to increase the height of the shoutbox.", wordspew) . '">+</a> <a style="cursor:pointer;" onclick="ChangeBoxSize(0)" title="' . __("Click here to decrease the height of the shoutbox.", wordspew) . '">-</a>
	</div>';
            if (!empty($user_identity)) {
                /* If they are logged in, then print their nickname */
                $_SESSION['Logged'] = "ok";
                ?>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php 
                echo $total;
                ?>
"/>
	<label><?php 
                _e('Name', wordspew);
                ?>
: <em><?php 
                echo $user_identity;
                ?>
</em></label>
	<input type="hidden" name="shoutboxname" id="shoutboxname" value="<?php 
                echo $user_identity;
                ?>
"/>
	<input type="hidden" name="shoutboxU" id="shoutboxU" value="<?php 
                if ($use_url) {
                    echo $user_url;
                }
                ?>
"/>
	<?php 
            } else {
                unset($_SESSION['Logged']);
                echo "\n";
                /* Otherwise allow the user to pick their own name */
                ?>

	<?php 
                if ($Captcha == 1) {
                    ?>
	<div id="shoutbox_captcha">
	<label><?php 
                    _e('Captcha', wordspew);
                    ?>
:</label> <select name="shoutboxOp" id="shoutboxOp" 
	onchange="MasqueSelect()" onclick="MasqueSelect()">
	<option value="-3"><?php 
                    echo $rand1 . "+" . $rand2 . "=";
                    ?>
</option>
	<?php 
                    for ($i = 0; $i < 21; $i++) {
                        echo '<option value="' . $i . '">' . $i . '</option>';
                    }
                    echo '</select></div>';
                } else {
                    ?>
		<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php 
                    echo $total;
                    ?>
"/>
	<?php 
                }
                ?>
	<label for="shoutboxname"><?php 
                _e('Name', wordspew);
                ?>
:</label>
	<input type="text" name="shoutboxname" id="shoutboxname" value="<?php 
                echo $display_name;
                ?>
" onfocus="Old_Sname=this.value;this.value='';"/>
	<label for="shoutboxU"<?php 
                if (!$use_url) {
                    echo ' style="display: none"';
                }
                ?>
><?php 
                _e('URL/Email', wordspew);
                ?>
:</label>
	<input type="text" name="shoutboxU" id="shoutboxU" value="<?php 
                if ($use_url) {
                    echo $_COOKIE['jalUrl'];
                }
                ?>
"<?php 
                if (!$use_url) {
                    echo ' style="display: none"';
                }
                ?>
/>
	<?php 
            }
            echo "\n";
            ?>
	<label for="chatbarText"><?php 
            _e('Message', wordspew);
            ?>
:</label>
	<?php 
            if ($use_textarea) {
                ?>
	<textarea rows="4" cols="16" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"></textarea>
	<?php 
            } else {
                ?>
	<input type="text" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"/>
	<?php 
            }
            ?>
	<input type="hidden" id="jal_lastID" value="<?php 
            echo $lastID + 1;
            ?>
" name="jal_lastID"/>

	<?php 
            echo $combo;
            ?>

	<input type="hidden" name="shout_no_js" value="true"/>
	<div id="SmileyList"></div>
	<input type="submit" id="submitchat" name="submit" value="<?php 
            _e('Send', wordspew);
            ?>
"/>
	</form>
<?php 
        } else {
            if ($level_for_archive == 1) {
                echo '<div style="text-align:right;">
		<a href="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/wordspew_archive.php?shout_cat=' . $cat . '">' . __("Archive", wordspew) . '</a>
		</div>';
            }
            ?>
	<form id="chatForm" action="">
	<p align="center"><?php 
            _e('You don\'t have sufficient rights to participate to this chat', wordspew);
            ?>
</p>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php 
            echo $total;
            ?>
"/>
	<input type="hidden" id="shoutboxname" value="<?php 
            echo __("Guest_", wordspew) . rand(0, 5000);
            ?>
"/>
	<input type="hidden" id="shoutboxU"/>
	<input type="hidden" id="chatbarText"/>
	<input type="hidden" id="shout_cat" value="<?php 
            echo $HiddenCat;
            ?>
"/>
	<input type="hidden" id="jal_lastID" value="<?php 
            echo $lastID + 1;
            ?>
"/>
	<input type="submit" id="submitchat" name="submit" style="display:none;"/>
	</form>
<?php 
        }
        ?>
	</div>
</div>
<?php 
        if ($shout_opt['use_sound'] == 1) {
            //Thanks to Eric HEUNTHEP -> http://portfolio.neolao.com/ for its cool free mp3 player -> http://flash-mp3-player.net/en/players/js/preview/
            echo '<object id="TheBox" type="application/x-shockwave-flash" data="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/player.swf" 
	width="1" height="1"><param name="movie" value="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/player.swf"/><param 
	name="AllowScriptAccess" value="always" /><param name="FlashVars" value="listener=myBox"/></object>
	';
        }
    }
}
Example #2
0
function jal_shoutbox_admin()
{
    global $wpdb, $user_level, $nb, $jal_version, $wp_roles, $wp_version, $shout_opt, $shout_cat, $shout_tb;
    $jal_admin_user_level = get_option('shoutbox_admin_level') != "" ? get_option('shoutbox_admin_level') : 10;
    get_currentuserinfo();
    // Gets logged in user.
    $level_for_archive = $shout_opt['level_for_archive'];
    $show_to_level = $shout_opt['level_for_shoutbox'];
    $level_for_theme = $shout_opt['level_for_theme'];
    $jal_number_of_comments = get_option('shoutbox_nb_comment');
    $nb = get_option('shoutbox_spam');
    $current = current_user_can('level_' . $jal_admin_user_level);
    // If user is not allowed to use the admin page
    if ($user_level < $jal_admin_user_level && $current != 1) {
        echo '<div class="wrap"><h2>' . __("No Access for you!", wordspew) . '</h2></div>';
    } else {
        $_SESSION['isAdmin' . $shout_tb] = true;
        if (isset($_POST['jal_truncate'])) {
            $what = stripslashes($_POST['cat']);
            $what = $what != "" ? $what : __("Miscellaneous", wordspew);
            $what = '"' . $what . '"';
            ?>
		<div class="updated"><p><?php 
            printf(__("The content of the shoutbox %s has been wiped.", wordspew), $what);
            ?>
</p></div>
<?php 
        }
        ?>
<div class="wrap">
	<h2><?php 
        _e('Live Shoutbox', wordspew);
        ?>
 v. <?php 
        echo $jal_version;
        ?>
	<?php 
        printf(__('(Actually <font color="red">%s</font> spams blocked)', wordspew), $nb);
        ?>
</h2>
	<p><?php 
        _e('When you update the Times and Colors, you may need to refresh/empty cache before you see the changes take effect', wordspew);
        ?>
</p>
	<p><?php 
        $results = $wpdb->get_var("SELECT id FROM " . $shout_tb . "liveshoutbox ORDER BY id DESC LIMIT 1");
        if ($results) {
            printf(__('There have been <b>%s</b> messages in this shoutbox', wordspew), $results);
        }
        ?>
&nbsp;</p>
	<form name="shoutbox_options" action="edit.php?page=wordspew_admin" method="post" id="shoutbox_options"> 
	<fieldset>
	<legend><b><?php 
        _e('Colors (Must be 6 digit hex)', wordspew);
        ?>
</b></legend>
	<div class="UserOption">
	<input type="hidden" name="page" value="wordspew_admin" />
	<?php 
        _e('Fade from', wordspew);
        ?>
: #<input type="text" maxlength="6" name="fade_from" value="<?php 
        echo $shout_opt['fade_from'];
        ?>
" 
	size="6" onchange="ChangeColor('fadefrom',this.value)" onkeyup="ChangeColor('fadefrom',this.value)"/>
	<span id="fadefrom" style="background:#<?php 
        echo $shout_opt['fade_from'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('The color that new messages fade in from. Default', wordspew);
        ?>
: 
	<span style="background:#666;color:#fff;">666666</span></div>

	<?php 
        _e('Fade to', wordspew);
        ?>
: #<input type="text" maxlength="6" name="fade_to" value="<?php 
        echo $shout_opt['fade_to'];
        ?>
" 
	size="6" onchange="ChangeColor('fadeto',this.value)" onkeyup="ChangeColor('fadeto',this.value)"/> 
	<span id="fadeto" style="background:#<?php 
        echo $shout_opt['fade_to'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('Also used as the background color of the box. Default', wordspew);
        ?>
	<span style="background:#fff;color:#000;">FFFFFF</span></div>

	<?php 
        _e('Text Color', wordspew);
        ?>
: #<input type="text" maxlength="6" name="text_color" value="<?php 
        echo $shout_opt['text_color'];
        ?>
" 
	size="6" onchange="ChangeColor('textcolor',this.value)" onkeyup="ChangeColor('textcolor',this.value)"/> 
	<span id="textcolor" style="background:#<?php 
        echo $shout_opt['text_color'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('The color of text within the box. Default', wordspew);
        ?>
: 
	<span style="background:#333;color:#fff;">333333</span></div>

	<?php 
        _e('Name Color', wordspew);
        ?>
: #<input type="text" maxlength="6" name="name_color" value="<?php 
        echo $shout_opt['name_color'];
        ?>
" 
	size="6" onchange="ChangeColor('namecolor',this.value)" onkeyup="ChangeColor('namecolor',this.value)"/> 
	<span id="namecolor" style="background:#<?php 
        echo $shout_opt['name_color'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('The color of peoples\' names. Default', wordspew);
        ?>
: 
	<span style="background:#06c;color:#fff;">0066CC</span></div>
	</div>
	</fieldset>
	<br />

	<fieldset>
	<legend><b><?php 
        _e('Others', wordspew);
        ?>
</b></legend>
	<div class="UserOption">
	<?php 
        _e('Show', wordspew);
        ?>
:<input type="text" maxlength="3" name="nb_comment" value="<?php 
        echo $jal_number_of_comments;
        ?>
" 
	size="2" /> <?php 
        _e('comments in the shoutbox', wordspew);
        ?>
<br />
	<div class="SousRub"><?php 
        _e('Enter, here, the number of shouts you want to show in your shoutbox', wordspew);
        ?>
</div>
	<?php 
        _e('Update Every', wordspew);
        ?>
: <input type="text" maxlength="3" name="update_seconds" 
	value="<?php 
        echo $shout_opt['update_seconds'] / 1000;
        ?>
" size="2" /> <?php 
        _e('Seconds', wordspew);
        ?>
<br />
	<div class="SousRub"><?php 
        _e('This determines how "live" the shoutbox is. With a bigger number, it will take more time for messages to show up, but also decrease the server load. You may use decimals. This number is used as the base for the first 8 javascript loads. After that, the number gets successively bigger. Adding a new comment or mousing over the shoutbox will reset the interval to the number suplied above. Default: 4 Seconds', wordspew);
        ?>
</div>
	<?php 
        _e('Fade Length', wordspew);
        ?>
: <input type="text" maxlength="3" name="fade_length" 
	value="<?php 
        echo $shout_opt['fade_length'] / 1000;
        ?>
" size="2" /> <?php 
        _e('Seconds', wordspew);
        ?>
<br />
	<div class="SousRub"><?php 
        _e('The amount of time it takes for the fader to completely blend with the background color. You may use decimals. Default 1.5 seconds', wordspew);
        ?>
</div>
	<?php 
        _e('Use textarea', wordspew);
        ?>
: <input type="checkbox" name="use_textarea"<?php 
        if ($shout_opt['use_textarea'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('A textarea is a bigger type of input box. Users will have more room to type their comments, but it will take up more space.', wordspew);
        ?>
</div>
	<?php 
        _e('Use URL field', wordspew);
        ?>
: <input type="checkbox" name="use_url"<?php 
        if ($shout_opt['use_url'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want users to have an option to add their URL when submitting a message.', wordspew);
        ?>
</div>
	<?php 
        _e('Use sound alert', wordspew);
        ?>
: <input type="checkbox" name="use_sound"<?php 
        if ($shout_opt['use_sound'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to hear a sound alert when someone post message', wordspew);
        ?>
</div>
	<?php 
        _e('Show smileys list', wordspew);
        ?>
: <input type="checkbox" name="Show_Smiley"<?php 
        if ($shout_opt['show_smiley'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to show the smileys list', wordspew);
        ?>
</div>	
	<?php 
        _e('Show blocked spams', wordspew);
        ?>
: <input type="checkbox" name="Show_Spam"<?php 
        if ($shout_opt['show_spam'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to show blocked spams', wordspew);
        ?>
</div>
	<?php 
        _e('Use a captcha', wordspew);
        ?>
: <input type="checkbox" name="Captcha"<?php 
        if ($shout_opt['use_captcha'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use a captcha (in fact it\'s a simple addition that users have to resolve before post any new message in the shoutbox).', wordspew);
        ?>
</div>
	<?php 
        _e('Use Themes', wordspew);
        ?>
: <input type="checkbox" name="Use_Theme" id="Use_Theme" onClick="disable_enable('Use_Theme', 'Show_themes_to', true);"<?php 
        if ($shout_opt['use_theme'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use themes.', wordspew);
        ?>
</div>
	<?php 
        _e('Use the RSS feed', wordspew);
        ?>
: <input type="checkbox" name="Use_RSS"<?php 
        if ($shout_opt['use_rss'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want that users can show and/or use the RSS feed of the shoutbox.', wordspew);
        ?>
</div>	
	<?php 
        _e('XHTML strict', wordspew);
        ?>
: <input type="checkbox" name="XHTML"<?php 
        if ($shout_opt['xhtml'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use XHTML strict', wordspew);
        ?>
</div>
	<b><?php 
        _e('Use spam filters', wordspew);
        ?>
</b>: <input type="checkbox" id="Use_Filters" name="Use_Filters" 
	<?php 
        if ($shout_opt['use_filters'] == '1' || !isset($shout_opt['use_filters'])) {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use filters against spams', wordspew);
        ?>
</div>

	<?php 
        _e('Use the shoutbox only on:', wordspew);
        ?>
 <input type="text" name="where" value="<?php 
        echo $shout_opt['where'];
        ?>
" style="width: 600px;"/>
	<div class="SousRub"><?php 
        _e('If you want to use the shoutbox only on some pages, enter here their titles (each entry have to be separated by a comma) otherwise or if you don\'t understand its usage, let this field empty.', wordspew);
        ?>
<br/><?php 
        _e('An other possibilities, is to show the shoutbox <b>only on particulars sections</b>. You can use this values:', wordspew);
        ?>
	<b>@homepage, @frontpage, @pages, @single, @archives, @category</b>.
	<br/><?php 
        _e('And last but not least, you can use 2 kinds of values to be more specific.', wordspew);
        ?>
 <b>(linked), (rubric)</b>.
	<br/><?php 
        _e('If you use the term:', wordspew);
        ?>
 @pages(rubric) <?php 
        _e('It meens that you want to use the same specific shoutbox for <b>ALL</b> pages.', wordspew);
        ?>
	<br/><?php 
        _e('If you use the term:', wordspew);
        ?>
 @pages(linked) <?php 
        _e('It meens that you want to use a specific shoutbox on <b>EACH</b> page.', wordspew);
        ?>
	<br/><?php 
        _e('You can use these 2 keywords with :', wordspew);
        ?>
 <b>@pages, @single, @archives</b> (<?php 
        printf(__('only %s, here', wordspew), 'rubric');
        ?>
), <b>@category</b>.
	<br/><?php 
        _e('Finally, if you want to use the shoutbox in a page template you\'ve done by yourself, enter : ', wordspew);
        ?>
 @page[<?php 
        _e('The name of your page', wordspew);
        ?>
].
	</div>
	</div>
	</fieldset>
	<br />

	<fieldset>
	<legend><b><?php 
        _e('Users options', wordspew);
        ?>
</b></legend>
	<div class="UserOption">

	<?php 
        if (current_user_can('level_10')) {
            ?>
	<font color="red"><?php 
            _e('<b>Who can administrate the shoutbox</b>', wordspew);
            ?>
:</font>
	<select name="admin_user_level">
	<?php 
            // Piece of code from "Role Manager" plugin for role and level part. Thanks to -> Thomas Schneider : http://www.im-web-gefunden.de/wordpress-plugins/role-manager/
            $array_admin = array();
            foreach ($wp_roles->role_names as $roledex => $rolename) {
                $role = $wp_roles->get_role($roledex);
                $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                if (!in_array($role_user_level, $array_admin)) {
                    array_push($array_admin, $role_user_level);
                    if ($role_user_level > 0) {
                        $selected = $jal_admin_user_level == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . " (" . __("level", wordspew) . " " . $role_user_level . ')</option>
				';
                    }
                }
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose the level required to administrate the shoutbox', wordspew);
            ?>
. <?php 
            printf(__('<a href="%s"><b>Click here</b></a> if you need more information on Roles and Capabilities.', wordspew), "http://codex.wordpress.org/Roles_and_Capabilities");
            ?>
</div>
	<?php 
        }
        ?>
	
	<?php 
        if (current_user_can('level_' . $jal_admin_user_level)) {
            _e('Who can <b>see the shoutbox</b>', wordspew);
            ?>
: <select id="level_for_shoutbox" name="level_for_shoutbox" 
	onchange="disable_enable('level_for_shoutbox', 'registered_only', false);">
	<?php 
            if ($wp_roles) {
                $array_box = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_box)) {
                        array_push($array_box, $role_user_level);
                        $selected = $show_to_level == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $show_to_level == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose, here, users able to <strong>see and post</strong> in your shoutbox. Other users will simply view nothing :)', wordspew);
            ?>
	<div style="color:red;" id="Info"><?php 
            _e('<b>Note:</b> You have choose to show the shoutbox only to :', wordspew);
            ?>
	<span id="From_List" style="font-weight:bold"><noscript><?php 
            _e('Please activate Javascript...', wordspew);
            ?>
</noscript></span>
	<?php 
            _e('in the list above,<br/>it will take precedence over the next option', wordspew);
            ?>
 (<em><?php 
            _e('Who can <b>see the shoutbox archives</b>', wordspew);
            ?>
</em>).</div>
	</div>
	
	<?php 
            _e('Who can <b>use the shoutbox</b>', wordspew);
            ?>
: <select id="registered_only" name="registered_only">
	<?php 
            if ($wp_roles) {
                $array_box = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_box)) {
                        array_push($array_box, $role_user_level);
                        $selected = $shout_opt['registered_only'] == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $shout_opt['registered_only'] == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose, here, users able to <strong>post messages</strong> in your shoutbox. Other users will simply view the discussion.', wordspew);
            ?>
</div>

	<?php 
            _e('Who can <b>see the shoutbox archives</b>', wordspew);
            ?>
: 
	<select id="Show_archive_to" name="Show_archive_to" onchange="disable_enable('level_for_shoutbox', 'registered_only', false);">
	<?php 
            if ($wp_roles) {
                $array_arch = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_arch)) {
                        array_push($array_arch, $role_user_level);
                        $selected = $level_for_archive == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $level_for_archive == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose who is able to see archive of the shoutbox', wordspew);
            ?>
.</div>
	
	<?php 
            _e('Who can see the differents themes', wordspew);
            ?>
: 
	<select id="Show_themes_to" name="Show_themes_to">
	<?php 
            if ($wp_roles) {
                $array_arch = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_arch)) {
                        array_push($array_arch, $role_user_level);
                        $selected = $level_for_theme == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $level_for_theme == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose who is able to see the differents themes of your shoutbox', wordspew);
            ?>
.</div>

<?php 
        }
        ?>

	<hr/>
	
	<?php 
        _e('Show users online', wordspew);
        ?>
: <input type="checkbox" id="Show_Users" name="Show_Users" 
	onClick="disable_enable('Show_Users', 'HideUsers', true);"<?php 
        if ($shout_opt['show_user_online'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to show, in real time, users online', wordspew);
        ?>
</div>

	<blockquote>
	<?php 
        _e('Users to hide', wordspew);
        ?>
: <input type="text" id="HideUsers" name="HideUsers" 
	value="<?php 
        echo stripslashes($shout_opt['hidden_users']);
        ?>
" size="30" />
	<div class="SousRub"><?php 
        _e('Place here, separated by comma, users that you want to hide from the "Users online" function of the shoutbox.', wordspew);
        ?>
</div>
	</blockquote>

	<?php 
        _e('Use avatars', wordspew);
        ?>
: <input type="checkbox" name="Use_Avatar"<?php 
        if ($shout_opt['show_avatar'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('If checked, avatar will be shown.', wordspew);
        ?>
</div>
	<?php 
        _e('Avatar size', wordspew);
        ?>
: <input type="text" maxlength="2" name="Avatar_size" 
	value="<?php 
        echo $shout_opt['avatar_size'];
        ?>
" size="2" /> px<br />
	<div class="SousRub"><?php 
        _e('Choose the size for the avatars. Valid values are from 1 to 80 inclusive. Any size other than 80 will cause the original Gravatar image to be downsampled using bicubic resampling before output', wordspew);
        ?>
</div>
	<?php 
        $position = $shout_opt['avatar_position'];
        _e('Avatar position', wordspew);
        ?>
: 
	<select name="Avatar_position">
	<option value="left"<?php 
        if ($position == "left") {
            echo ' selected="true"';
        }
        ?>
><?php 
        _e('Left', wordspew);
        ?>
</option>
	<option value="right"<?php 
        if ($position == "right") {
            echo ' selected="true"';
        }
        ?>
><?php 
        _e('Right', wordspew);
        ?>
</option>	
	</select>
	<div class="SousRub"><?php 
        _e('Choose the alignement for avatars (left or right)', wordspew);
        ?>
</div>

	</div>
	</fieldset><br />

	<input type="submit" name="jal_admin_options" value="<?php 
        _e('Save', wordspew);
        ?>
" class="button" id="jal_admin_options"/><br/><br/>
	<input type="submit" name="jal_truncate" value="<?php 
        _e('Delete ALL messages', wordspew);
        ?>
" class="button" id="jal_truncate_all" onclick="return confirm('<?php 
        printf(__("You are about to delete ALL messages from : %s in the shoutbox.\\nAre you sure you want to do this?\\n\\'Cancel\\' to stop, \\'OK\\' to delete.", wordspew), "&quot;'+document.getElementById('theme').innerHTML+'&quot;");
        ?>
');"/>
	<input type="submit" name="jal_truncate_archive" value="<?php 
        _e('Delete ALL ARCHIVED messages', wordspew);
        ?>
" class="button" id="jal_truncate_all_archive" onclick="return confirm('<?php 
        printf(__("You are about to delete ALL ARCHIVED messages from : %s.\\nAre you sure you want to do this?\\n\\'Cancel\\' to stop, \\'OK\\' to delete.", wordspew), "&quot;'+document.getElementById('theme').innerHTML+'&quot;");
        ?>
');"/>
	<input type="submit" name="jal_shout_archive" value="<?php 
        _e('Archive THEN Delete ALL messages', wordspew);
        ?>
" class="button" id="jal_shout_archive" onclick="return confirm('<?php 
        printf(__("You are about to archive THEN delete ALL messages from : %s.\\nAre you sure you want to do this?\\n\\'Cancel\\' to stop, \\'OK\\' to delete.", wordspew), "&quot;'+document.getElementById('theme').innerHTML+'&quot;");
        ?>
');"/><br/><br/>

	<input type="hidden" name="cat" id="cat" value="<?php 
        echo stripslashes($shout_cat);
        ?>
"/>
	</form>
	<fieldset>

	<?php 
        if (current_user_can('manage_options')) {
            ?>
	<p><?php 
            printf(__('<a href="%s"><b>Click here</b></a> to manage your banned words list and IP addresses.', wordspew), get_bloginfo('wpurl') . "/wp-admin/options-discussion.php#moderation_keys");
            ?>
</p>
	<p><?php 
            _e('<b><font color="red">Important !</font></b> To ban a single IP address just click on "Ban this IP" button. If you want to ban a range of IP, use this syntax (for this example i can say good bye to Vsevolod Stetsinsky) : 195.225.176/179.* where slash means from 176 to 179 and * from 0 to 255.<br/>BTW i ban IP addresses from 195.225.176.0 to 195.225.179.255. You can mix the two options...', wordspew);
            ?>
</p>
	<?php 
        }
        ?>

	<?php 
        @mysql_query("SET CHARACTER SET 'utf8'");
        @mysql_query("SET NAMES utf8");
        $SQLCat = html_entity_decode($shout_cat, ENT_COMPAT, 'UTF-8');
        $SQL = "SELECT * FROM " . $shout_tb . "liveshoutbox WHERE cat='" . mysql_real_escape_string($SQLCat) . "' ORDER BY id DESC LIMIT " . $jal_number_of_comments;
        $results = $wpdb->get_results($SQL);
        $jal_first_time = true;
        // Will only add the last message div if it is looping for the first time
        echo '<form action="edit.php?page=wordspew_admin" method="get">
	';
        echo '<b>' . __("Theme:", wordspew) . '</b>';
        $SQL = "SELECT DISTINCT cat FROM " . $shout_tb . "liveshoutbox ORDER BY cat";
        $theme = $wpdb->get_results($SQL);
        foreach ($theme as $theme_name) {
            if ($theme_name->cat == "") {
                echo ' <a class="shout" onclick="CleanBox(\'\',\'' . __("Miscellaneous", wordspew) . '\');"><b>' . __("Miscellaneous", wordspew) . '</b></a>,';
            } else {
                echo ' <a class="shout" onclick="CleanBox(\'' . $theme_name->cat . '\',\'' . str_replace(" ", " ", $theme_name->cat) . '\');">' . stripslashes($theme_name->cat) . '</a>,';
            }
        }
        $the_cat = $shout_cat == "" ? __("Miscellaneous", wordspew) : str_replace(" ", " ", stripslashes($shout_cat));
        $SQL = "SELECT DISTINCT cat FROM " . $shout_tb . "liveshoutboxarchive ORDER BY cat";
        $theme = $wpdb->get_results($SQL);
        $first_time = 0;
        echo "<br/><b>" . __("Archive:", wordspew) . "</b>";
        foreach ($theme as $theme_name) {
            if ($theme_name->cat == "") {
                echo ' <a class="archive" onclick="CountAndGo(\'\',\'' . __("Miscellaneous", wordspew) . '\');"><b>' . __("Miscellaneous", wordspew) . '</b></a>, ';
            } else {
                echo ' <a class="archive" onclick="CountAndGo(\'' . $theme_name->cat . '\',\'' . str_replace(" ", " ", $theme_name->cat) . '\');">' . stripslashes($theme_name->cat) . '</a>,';
            }
            $first_time += 1;
        }
        if ($first_time >= 1) {
            echo "<br/>" . __("<b>Information:</b> The first click on the desired shoutbox category will select it (if you want to empty its content for example), the second will let you browse to the archive page selected.", wordspew);
        }
        printf(__('<div id="lastMessage"><span>Last Message</span><br/><div id="responseTime">%s</div>&nbsp;ago</div>', wordspew), jal_time_since($_SESSION['Chrono']));
        $class_id = isset($_SERVER['HTTP_REFERER']) ? strpos($_SERVER['HTTP_REFERER'], "wordspew_archive.php") ? "archive" : "shout" : "shout";
        echo '<p id="usersOnline">' . jal_get_useronline_extended() . '</p>
	<div id="theme" class="' . $class_id . '">' . $the_cat . '</div>
	<hr/>

	<div align="right" id="chatoutput">
	<ul id="outputList" style="white-space: nowrap;">';
        foreach ($results as $r) {
            // Loops the messages into a list
            $class = "";
            if (verifyName($r->name)) {
                $class = "jal_user ";
            }
            $url = empty($r->url) ? $r->name : '<a href="' . $r->url . '" target="_blank">' . $r->name . '</a>';
            if ($jal_first_time) {
                $lastID = $r->id;
            }
            echo '<li id="comment-new' . $r->id . '">

	<span title="' . jal_time_since($r->time) . '" class="' . $class . sanitize_name($r->name) . '" id="user_' . $r->id . '">' . stripslashes($url) . ' : </span>
	<a href="http://whois.domaintools.com/' . $r->ipaddr . '" target="_blank" title="Whois">*</a>
	<input type="text" name="jal_text" id="text_' . $r->id . '" value="' . htmlspecialchars(stripslashes($r->text), ENT_QUOTES) . '" size="60"/>';
            if (current_user_can('manage_options')) {
                echo '
		<input type="text" name="ip" id="ip_' . $r->id . '" value="' . $r->ipaddr . '" size="14"/>
		<input type="button" name="jal_ban" value="' . __("Ban this IP", wordspew) . '" onclick="BanIP(' . $r->id . ',\'' . $r->ipaddr . '\')"/>';
            } else {
                echo '<input type="hidden" name="ip" id="ip_' . $r->id . '" value="' . $r->ipaddr . '"/>';
            }
            echo '
	<input type="button" name="jal_delete" value="' . __("Delete", wordspew) . '" onclick="deleteComment(' . $r->id . ')"/>
	<input type="button" name="jal_edit" value="' . __("Edit", wordspew) . '" onclick="EditComment(' . $r->id . ')"/></li>
	';
            $jal_first_time = false;
        }
        if (!$results) {
            echo '<li>&nbsp;</li>';
        }
        ?>
	</ul></div>
	<input type="hidden" id="jal_lastID" value="<?php 
        echo $lastID + 1;
        ?>
" name="jal_lastID"/>
	</form>
	</fieldset>
	</div>
<?php 
    }
}
Example #3
0
function jal_get_shoutbox () {
global $wpdb, $jal_table_prefix, $user_level, $user_nickname, $user_url, $user_ID, $jal_admin_user_level, $user_identity;
get_currentuserinfo(); // Gets logged in user.
$theuser_nickname=$user_nickname;
$ActualVersion=round(get_bloginfo('version'));
if($ActualVersion>=2) $theuser_nickname=$user_identity;
if(get_option('shoutbox_spam')=="")	jal_install_shout();
$XHTML=get_option('shoutbox_XHTML');
$Captcha=get_option('shoutbox_Captcha');
$jal_number_of_comments=get_option('shoutbox_nb_comment');
$Actual_URL=get_bloginfo('wpurl');
$_SESSION['Show_Users']=get_option('shoutbox_online');
$_SESSION['BadCalc']=__("You should learn to count before use the shoutbox :)",wordspew);
$_SESSION['DLSpam']=__("I DON'T LIKE SPAM !!!",wordspew);
$_SESSION['HTTPLimit']=__("Sorry, but you can post only one url by message...",wordspew);
$_SESSION['IPLogged']=__("Your IP address have been banned from this blog, if you feel this is in error please contact the webmaster.",wordspew);
$_SESSION['hashtext']=get_option('shoutbox_hash');
$_SESSION['useURL']=get_option('shoutbox_use_url');
$_SESSION['useCaptcha']=get_option('shoutbox_Captcha');
?>
<div id="wordspew">
	<div id="chatoutput">
		<?php
		@mysql_query("SET CHARACTER SET 'utf8'");
		@mysql_query("SET NAMES utf8");
		$wpdb->hide_errors();
		$results = $wpdb->get_results("SELECT * FROM ".$jal_table_prefix."liveshoutbox ORDER BY id DESC LIMIT ".$jal_number_of_comments);
		$wpdb->show_errors();

		// Will only add the last message div if it is looping for the first time
		$jal_first_time = true;
		$registered_only = (get_option('shoutbox_registered_only') == "1") ? TRUE : FALSE;
		// Loops the messages into a list
		foreach( $results as $r ) {
			$target="";
			// Add links
			if (strpos($r->text, $Actual_URL)===false && $XHTML==0) $target=' target="_blank"';
			$theLink=__("link",wordspew); $theMail=__("email",wordspew);
			$r->text = preg_replace("`(http|ftp)+(s)?:(//)((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a href=\"\\0\"$target>&laquo;$theLink&raquo;</a>", $r->text);
			$r->text = preg_replace("`([-_a-z0-9]+(\.[-_a-z0-9]+)*@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]{2,6})`i","<a href=\"mailto:\\1\">&laquo;$theMail&raquo;</a>", $r->text); 

			if ($jal_first_time == true) {
				$rand1=mt_rand(0,10);
				$rand2=mt_rand(0,10);
				$total=intval($rand1+$rand2);

				if (get_option('shoutbox_sound') == "1") {
					$img_sound=($_COOKIE['jalSound']==1 || $_COOKIE['jalSound']=="") ? "sound_1.gif" : "sound_0.gif";
					echo '<img src="'. $Actual_URL .'/wp-content/plugins/wordspew/'.$img_sound.'" alt="" 
					onclick="setSound();" id="JalSound" title="';
					_e("Click this to turn on/off sound",wordspew);
					echo '"/>
					';
				}
				if(get_option('shoutbox_Show_Spam')) {
					$nb = get_option('shoutbox_spam');
					printf(__('<div id="Show_Spam">%s spams blocked</div>',wordspew),$nb);
				}
				printf(__('<div id="lastMessage"><span>Last Message</span> <em id="responseTime">%s ago</em></div>',wordspew),jal_time_since($r->time));
				echo '<div id="usersOnline">'.jal_get_useronline_extended().'</div>';
				echo '<ul id="outputList">'; }

			if ($jal_first_time == true) $lastID = $r->id;
			$target="";
			if($r->url!="") if (strpos($r->url, $Actual_URL)===false && $XHTML==0) $target=' target="_blank"';
			$url = (empty($r->url) && $r->url = "http://") ? $r->name : '<a href="'.$r->url.'"'.$target.'>'.$r->name.'</a>';
			if($jal_first_time == true && !isset($_COOKIE['jalCaptcha']) && !$user_ID && !$registered_only && $_SESSION['useCaptcha'] == '1') 
				echo '<li><span>'.__("Info",wordspew).' : </span><b>'.__("Please, resolve the addition below before post any new comment...",wordspew).'</b></li>';
			if(verifyName($r->name)) {
			$class="jal_user ";
			}
			echo '<li><span title="'.jal_time_since( $r->time ).'" class="'.$class. sanitize_name($r->name).'">'.stripslashes($url).' : </span>'.convert_smilies(" ".stripslashes($r->text)).'</li>
			'; 
			$jal_first_time = false;
			$class="";
		}

		$use_url = (get_option('shoutbox_use_url') == "true") ? TRUE : FALSE;
		$use_textarea = (get_option('shoutbox_use_textarea') == "true") ? TRUE : FALSE;
		if (!defined("DB_CHARSET")) {
			@mysql_query("SET CHARACTER SET 'latin1'");
			@mysql_query("SET NAMES latin1");
			}
		?>
		</ul>
	</div>
	<div id="chatInput">
<?php 
	$hashtext = $_SESSION['hashtext'];

	if (!$registered_only || ($registered_only && $user_ID)) {
	$display_name=($_COOKIE['jalUserName']) ? $_COOKIE['jalUserName'] : __("Guest_",wordspew).rand(0,5000);
	$display_name=str_replace("\'", "'", $display_name);
	?>
	<form id="chatForm" method="post" action="<?php bloginfo('wpurl'); ?>/wp-content/plugins/wordspew/wordspew.php">
	<?php
	$current=current_user_can('level_'.$jal_admin_user_level);
	if ($user_level >= $jal_admin_user_level || $current==1) { // If user is allowed to use the admin page
		echo '<a href="'.get_bloginfo("wpurl").'/wp-admin/edit.php?page=wordspew" id="shoutboxAdmin">'. __("Admin",wordspew).'</a>';
	}
	if (!empty($theuser_nickname)) { /* If they are logged in, then print their nickname */ 
	$_SESSION['Logged']="ok"; ?>
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php echo $total; ?>"/>
	<label><?php _e('Name',wordspew); ?>: <em><?php echo $theuser_nickname ?></em></label>
	<input type="hidden" name="shoutboxname" id="shoutboxname" value="<?php echo $theuser_nickname; ?>"/>
	<input type="hidden" name="shoutboxU" id="shoutboxU" value="<?php if($use_url) { echo $user_url; } ?>"/>
	<?php } else { echo "\n"; /* Otherwise allow the user to pick their own name */ ?>

	<?php if ($Captcha==1) { ?>
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
	<div id="shoutbox_captcha">
	<label><?php _e('Captcha',wordspew); ?>:</label> <select name="shoutboxOp" id="shoutboxOp" 
	onchange="MasqueSelect()" onclick="MasqueSelect()">
	<option value="-3"><?php echo $rand1."+".$rand2."="; ?></option>
	<?php for ($i = 0; $i < 21; $i++) {
	echo '<option value="'.$i.'">'.$i.'</option>';
	}
	echo '</select></div>';
	}
	else { ?>
		<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
		<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php echo $total; ?>"/>
	<? } ?>

	<label for="shoutboxname"><?php _e('Name',wordspew); ?>:</label>
	<input type="text" name="shoutboxname" id="shoutboxname" value="<?php echo $display_name; ?>" maxlength="18"/>
	<label for="shoutboxU"<?php if (!$use_url) echo ' style="display: none"'; ?>><?php _e('URL/Email',wordspew); ?>:</label>
	<input type="text" name="shoutboxU" id="shoutboxU" value="<?php if ($_COOKIE['jalUrl'] && $use_url) echo $_COOKIE['jalUrl']; else echo 'http://'; ?>"<?php if (!$use_url) echo ' style="display: none"'; ?>/>
	<?php  } echo "\n"; ?>
	<label for="chatbarText"><?php _e('Message',wordspew) ?>:</label>
	<?php if ($use_textarea) { ?>
	<textarea rows="4" cols="16" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"></textarea>
	<?php } else { ?>
	<input type="text" name="chatbarText" id="chatbarText"/>
	<?php } ?>
	<input type="hidden" id="jal_lastID" value="<?php echo $lastID + 1; ?>" name="jal_lastID"/>
	<input type="hidden" name="shout_no_js" value="true"/>
	<div id="SmileyList"></div>
	<input type="submit" id="submitchat" name="submit" value="<?php _e('Send',wordspew);?>"/>
	</form>
<?php }
else { ?>
	<form id="chatForm" action="">
	<p align="center"><?php _e('You must be a registered user to participate in this chat',wordspew); ?></p>
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php echo $total; ?>"/>
	<input type="hidden" id="shoutboxname"/>
	<input type="hidden" id="shoutboxU"/>
	<input type="hidden" id="chatbarText"/>
	<input type="hidden" id="jal_lastID" value="<?php echo $lastID+1; ?>"/>
	<input type="submit" id="submitchat" name="submit" style="display:none;"/>
	</form>
<?php } ?>
	</div>
</div>
<?php if (get_option('shoutbox_sound') == "1") echo('<span id="TheBox"></span>'); }