예제 #1
0
function widget_wordspew($args)
{
    global $user_ID, $user_level, $shout_opt, $shout_where;
    if (where_shout($shout_opt['where'], 0)) {
        extract($args);
        $jal_wp_url = get_bloginfo('wpurl') . '/wp-content/plugins/pierres-wordspew';
        $UseRSS = $shout_opt['use_rss'];
        $show_to_level = $shout_opt['level_for_shoutbox'];
        $user_level = isset($user_level) ? $user_level : -1;
        $current = $show_to_level == -1 ? 1 : current_user_can('level_' . $show_to_level);
        if ($current == 1) {
            $Woptions = get_option('widget_wordspew');
            $title = $Woptions['title'];
            $RSSLink = "";
            $libcat = " onmouseover=\"ChangeURL('shoutboxRSS','" . $jal_wp_url . "/wordspew-rss.php','?shout_cat=')\"";
            if ($UseRSS == '1') {
                $RSSLink = ' <a href="' . $jal_wp_url . '/wordspew-rss.php"' . $libcat . ' id="shoutboxRSS"><img 
		src="' . $jal_wp_url . '/img/rss.gif" border="0" alt="" title="' . __('Wordspew-RSS-Feed for:', wordspew) . ' ' . get_bloginfo('name') . '"/></a>';
            }
            echo $before_widget . $before_title . $title . $RSSLink . $after_title;
            jal_get_shoutbox($shout_where);
            echo $after_widget;
        }
    }
}
예제 #2
0
function jal_add_to_head()
{
    global $jal_version, $jal_admin_user_level, $user_ID, $user_email, $user_level, $wpdb, $show, $size, $position, $shout_opt, $user_identity, $shout_tb;
    $jal_admin_user_level = get_option('shoutbox_admin_level') != "" ? get_option('shoutbox_admin_level') : 10;
    $shout_opt = get_option('shoutbox_options');
    $_SESSION['use_spam_filters'] = isset($shout_opt['use_filters']) ? $shout_opt['use_filters'] : 1;
    $_SESSION['banned_msg'] = __('No, sorry you used a banned word!', wordspew);
    if (where_shout($shout_opt['where'], 1)) {
        $show_to_level = $shout_opt['level_for_shoutbox'];
        $user_level = isset($user_level) ? $user_level : -1;
        $current = $show_to_level == -1 ? 1 : current_user_can('level_' . $show_to_level);
        if ($current == 1) {
            $jal_wp_url = get_bloginfo('wpurl') . "/";
            $UseRSS = $shout_opt['use_rss'];
            $ShowRSS = "";
            if ($UseRSS == '1') {
                $ShowRSS = '<link rel="alternate" type="application/rss+xml" title="' . __('Wordspew-RSS-Feed for:', wordspew) . ' ' . get_bloginfo('name') . '" href="' . $jal_wp_url . 'wp-content/plugins/pierres-wordspew/wordspew-rss.php" />' . "\n";
            }
            $show = $shout_opt['show_avatar'];
            $size = $shout_opt['avatar_size'];
            $position = $shout_opt['avatar_position'];
            echo '
<!-- Added By Wordspew Plugin, modified by Pierre, version ' . $jal_version . ' -->' . "\n" . $ShowRSS . '<link rel="stylesheet" href="' . $jal_wp_url . 'wp-content/plugins/pierres-wordspew/style.css" type="text/css" />
';
            include 'css.php';
            echo '
<script type="text/javascript">
//<![CDATA[
var Old_Sname;
function trim(s) {
return s.replace(/^( | )+/, \'\').replace(/( | )+$/, \'\');
}
';
            $isAdmin = $user_level >= $jal_admin_user_level || current_user_can('level_' . $jal_admin_user_level) == 1 ? "true" : "false";
            $the_nickname = isset($user_identity) ? $user_identity : str_replace("\\'", "'", $_COOKIE['jalUserName']);
            include 'js.php';
            echo '
var show_avatar=' . $show . ', avatar_position="' . $position . '", avatar_size=' . $size . ', isAdmin=' . $isAdmin . ';
var var_XHTML=' . intval($shout_opt['xhtml']) . ', show_smiley=' . $shout_opt['show_smiley'] . ', shout_user="******";
var fade_length=' . $shout_opt['fade_length'] . ', fade_from="' . $shout_opt['fade_from'] . '", fade_to="' . $shout_opt['fade_to'] . '";

function CheckSpam(theText,theURL) {';
            if ($_SESSION['use_spam_filters'] == 1) {
                echo '
theMsg=document.getElementById(\'chatbarText\').value;
theMsg=theMsg.toLowerCase();
count_http=theMsg.split("http").length;
var limit=2;
if((document.getElementById(\'shoutboxU\').value).length>7) {
	if(document.getElementById(\'shoutboxU\').style.display!="none") {
		limit++;
		count_http++;
	}
}
if(count_http>limit) {
	alert("' . __('Sorry, but you can post only one url by message...', wordspew) . '");
	return false;
}
theText+=\' \'+theURL;';
                $spam = get_option('moderation_keys');
                $_SESSION['badwords' . $shout_tb] = $spam;
                if ($spam != "") {
                    $spam = str_replace("'", "\\'", $spam);
                    $spam = str_replace("\r\n", "','", $spam);
                    $spam = "'" . strtolower($spam) . "'";
                }
                echo '
var spam = [' . str_replace(",''", "", $spam) . '];
TextToScan=theText.toLowerCase();
for (var i = 0; i < spam.length; i++) {
	if(TextToScan.indexOf(spam[i])!=-1) {
		alert("' . $_SESSION['banned_msg'] . '\\n-> "+spam[i].toUpperCase());
		return false;
		break;
	}
}';
            }
            echo '
return true;
}
//]]>
</script>
<script type="text/javascript" src="' . $jal_wp_url . 'wp-content/plugins/pierres-wordspew/ajax_shout.js"></script>
<!-- End Wordspew Plugin -->
';
            $users = $shout_opt['hidden_users'];
            $users = str_replace(", ", ",", $users);
            $UsersToHide = stripslashes($users);
            $_SESSION['HideUsers' . $shout_tb] = explode(",", strtolower($UsersToHide));
            $_SESSION['CurrentUser'] = $user_email;
            $_SESSION['CookieHash'] = COOKIEHASH;
            $_SESSION['LoggedMsg'] = __('No, sorry you used the name of a registered user! You have to change it please.', wordspew);
            if (!isset($_SESSION['LoggedUsers'])) {
                $LoggedUsers = $wpdb->get_col("SELECT display_name FROM " . $wpdb->users);
                $_SESSION['LoggedUsers'] = $LoggedUsers;
            }
        }
    }
}