Jump to content


Javascript Help with shoutbox!


4 replies to this topic

#1 Veej

    Young Padawan

  • Members
  • Pip
  • 49 posts

Posted 05 December 2005 - 01:53 PM

Hey!

On my site I have a shoutbox, for which I want to make the text inut box wider...

Here is a screenshot: Posted Image

This is the code for the java shoutbox file:
function allonloads(){
SBpopulate();




}
// Insert Smiles to message box
function x(){
	return;
}
function DoSmilie(addSmilie, messageDef){
	var addSmilie, messageDef, revisedMessage;
	var currentMessage = document.shoutform1.ShoutComment.value;
	if(currentMessage==messageDef){currentMessage='';}
	revisedMessage = currentMessage+addSmilie;
	document.shoutform1.ShoutComment.value=revisedMessage;
	document.shoutform1.ShoutComment.focus();
	return;
}
//Drop-Down smilies
function MM_findObj(n, d){
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all){
		x=d.all[n];
	}
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) {
		x=d.getElementById(n);
	}
	return x;
}
function expand(listID){
	if(listID.style.display == "none") {
		listID.style.display = "";
	}else{
		listID.style.display = "none";
	}
	window.event.cancelBubble = true;
}
function contract(listID){
	if(listID.style.display == "show") {
		listID.style.display = "";
	}else{
		listID.style.display = "none";
	}
	window.event.cancelBubble = true;
}
//end Drop-Down smilies
/*
Original Javascript code by dynamic drive, modified by SuperCat http://www.ourscripts.net
Cross browser Marquee II-  Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Credit MUST stay intact
*/
var SBspeed=1;
var SBiedom=document.all||document.getElementById;
var SBactualheight='';
var SBcross_marquee, SBns_marquee;
if(SBiedom){
	SBtxt='<div style="position:relative;width:100%;height:'+SBheight+';overflow:hidden" onmouseover="SBspeed=0" onmouseout="SBspeed=1"><div 

id="SBiemarquee" style="position:absolute;left:0px;top:0px;width:100%;"></div></div>';
}else{
	SBtxt='<ilayer width=100 px height='+SBheight+' name="SBns_marquee"><layer name="SBns_marquee2" width=100% height='+SBheight+' left=0 top=0 

onmouseover="SBspeed=0" onmouseout="SBspeed=1"></layer></ilayer>';
}
function SBscroll(){
	if(SBiedom){
		if(parseInt(SBcross_marquee.style.top)>(SBactualheight*(-1)+2)){
			SBcross_marquee.style.top=parseInt(SBcross_marquee.style.top)-SBspeed+"px";
		}else{
			SBcross_marquee.style.top=parseInt(SBheight)+2+"px";
		}
	}
	else{
		if(SBns_marquee.top>(SBactualheight*(-1)+2)){
			SBns_marquee.top-=SBspeed;
		}else{
			SBns_marquee.top=parseInt(SBheight)+2;
		}
	}
}
function changeBoxSize(showhide) {
document.getElementById('smilies_hide').style.display='none';
document.getElementById('smilies_show').style.display='none';
document.getElementById('smilies_'+showhide).style.display='block';
}
function SBpopulate(){
	if(SBiedom){
		SBcross_marquee=document.getElementById? document.getElementById("SBiemarquee") : document.all.SBiemarquee;
		SBcross_marquee.style.top=parseInt(SBheight)+8+"px";
		SBcross_marquee.innerHTML=SBcontent;
		SBactualheight=SBcross_marquee.offsetHeight;
	}else{
		SBns_marquee=document.SBns_marquee.document.SBns_marquee2;
		SBns_marquee.top=parseInt(SBheight)+8;
		SBns_marquee.document.write(SBcontent);
		SBns_marquee.document.close();
		SBactualheight=SBns_marquee.document.height;
	}
	this.setInterval("SBscroll()",50);
}
window.onload=allonloads;

Could some one kindly tell me what I'd need to change please?

Thanks!

#2 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 05 December 2005 - 06:23 PM

actually, to change the width of the input box, you'd have to edit the html tag of that input box.

just find the input box you're trying to change and find the cols="xx" attribute and change it, example:

<input value="name" cols="13" />

you'd have to change the 13 to a higher number.

that's the first thing i'd try, i dont think the javascript has anything to do with it.

#3 Veej

    Young Padawan

  • Members
  • Pip
  • 49 posts

Posted 06 December 2005 - 05:44 AM

Oh right, thanks for replying...
But I could not find that in the code of the actual shoutbox block (nor the javascript)

The following code is that of the actual block for the shoutbox
[code]<?php
// ==========================================
// PHP-NUKE: Shout Box
// ==========================
//
// Copyright (c) 2003-2005 by Aric Bolf (SuperCat)
// http://www.OurScripts.net
//
// Copyright (c) 2002 by Quiecom
// http://www.Quiecom.com
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation
// ===========================================

if (eregi("block-Shout_Box.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

global $prefix, $ShoutSubmit, $ShoutComment, $db, $user, $cookie, $shoutuid, $top_content, $mid_content, $bottom_content, $ShoutMarqueewidth, $ShoutMarqueeheight, $currentlang;

function ShoutBox($ShoutSubmit, $prefix, $ShoutComment, $db, $user, $cookie, $shoutuid) {

global $admin, $admin_file, $currentlang, $top_content, $mid_content, $bottom_content, $ShoutMarqueewidth, $ShoutMarqueeheight;

$self = ereg_replace("/", "",$_SERVER['PHP_SELF']);
if ($admin_file == '') { $admin_file = 'admin'; }
if ((is_admin($admin)) AND ("".$admin_file.".php" == $self)) {
$sqlV = "select * from ".$prefix."_config";
$resultV = $db->sql_query($sqlV);
$confV = $db->sql_fetchrow($resultV);
if ($confV['Version_Num'] >= '7.6') {
$preURL = 'index.php?url=';
} else {
$preURL = '';
}
}

if ($currentlang) {
include_once("modules/Shout_Box/lang-block/lang-$currentlang.php");
} else {
include_once("modules/Shout_Box/lang-block/lang-english.php");
}

$PreviousShoutComment = $ShoutComment;

include("config.php");

cookiedecode($user);
$username = $cookie[1];

if ($username == "") { $username = "Anonymous"; }

$sql = "select * from ".$prefix."_shoutbox_conf";
$result = $db->sql_query($sql);
$conf = $db->sql_fetchrow($result);

// Check if block is in center position
$sql = "select bposition from ".$prefix."_blocks where blockfile='block-Shout_Box.php'";
$SBpos = $db->sql_query($sql);
$SBpos = $db->sql_fetchrow($SBpos);
if ($SBpos[0] == 'c' || $SBpos[0] == 'd') {
$SBpos = 'center';
$SBborder = 1;
} else {
$SBpos = 'side';
$SBborder = 0;
}

// Find user's IP
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) {
$uip = getenv("HTTP_CLIENT_IP");
} else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) {
$uip = getenv("HTTP_X_FORWARDED_FOR");
} else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) {
$uip = getenv("REMOTE_ADDR");
} else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) {
$uip = $_SERVER['REMOTE_ADDR'];
} else {
$uip = "";
}
if ($uip == 'unknown') { $uip = $_SERVER['REMOTE_ADDR']; }
if ($uip == "") { $uip = $_SERVER['REMOTE_ADDR']; }
if ($uip == "") { $uip = "noip"; }
if ($uip == 'unknown') { $uip = "noip"; }

//do IP test then ban if on list
if($conf[6] == "yes") {
$sql = "select * from ".$prefix."_shoutbox_ipblock";
$ipresult = $db->sql_query($sql);
while ($badips = $db->sql_fetchrow($ipresult)){
if($uip == $badips[1]) {
$BannedShouter = "yes";
}
}
}
//do name test then ban if on list (only applies to registered users)
if($conf[7] == "yes"){
$sql = "select * from ".$prefix."_shoutbox_nameblock";
$nameresult = $db->sql_query($sql);
while ($badname = $db->sql_fetchrow($nameresult)){
if($username == $badname[1]) {
$BannedShouter = "yes";
}
}
}
if ($BannedShouter != "yes") {

if ($ShoutSubmit == "ShoutPost") {
// start processing shout
if ($shoutuid) { $username = "$shoutuid"; }
//shoutuid tests
$username = trim($username); // remove whitespace off ends of nickname
if($conf[11] == "yes" && $conf[12] == "yes") {
$unum = strlen($username);
if($unum < 2) { $ShoutError = ""._NICKTOOSHORT.""; }
if($conf[11] == "yes" && !$username) { $ShoutError = ""._NONICK.""; }
if($conf[11] == "yes" && $username == ""._NAME."") { $ShoutError = ""._NONICK.""; }
if (eregi("javascript:(.*)", $username)) { $ShoutError = ""._JSINNICK.""; }
//$username = ereg_replace("([^ ]{42})","\\1",$username);
$username = htmlspecialchars($username, ENT_QUOTES);
$username = ereg_replace("&amp;amp;", "&amp;",$username);
}
if (!is_user($user) && ($username) && $username != "Anonymous") {
$username = ereg_replace(" ", "_",$username);
}

$ShoutComment = trim($ShoutComment); // remove whitespace off ends of shout
$ShoutComment = preg_replace('/\s+/', ' ', $ShoutComment); // convert double spaces in middle of shout to single space
$num = strlen($ShoutComment);
if ($num < 1) { $ShoutError = ""._SHOUTTOOSHORT.""; }
if ($num > 2500) { $ShoutError = ""._SHOUTTOOLONG.""; }
if (!$ShoutComment) { $ShoutError = ""._NOSHOUT.""; }
if ($ShoutComment == ""._SB_MESSAGE."") { $ShoutError = ""._NOSHOUT.""; }
if (eregi("javascript:(.*)", $ShoutComment)) { $ShoutError = ""._JSINSHOUT.""; }

// $ShoutComment = ereg_replace("([^ ]{42})","\\1",$ShoutComment);
$ShoutComment = htmlspecialchars($ShoutComment, ENT_QUOTES);
$ShoutComment = ereg_replace("&amp;amp;", "&amp;",$ShoutComment);

// Scan for links in the shout. If there is, replace it with [URL] or block it if disallowed
$i = 0;
$ShoutNew = '';
$ShoutArray = explode(" ",$ShoutComment);
foreach($ShoutArray as $ShoutPart) {
if (is_array($ShoutPart) == TRUE) { $ShoutPart = $ShoutPart[0]; }
if (eregi("http:\/\/", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
// fix for users adding text to the beginning of links: HACKhttp://www.website.com
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"http://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
} elseif (eregi("ftp:\/\/", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"ftp://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">FTP</a>]";
} elseif (eregi("irc:\/\/", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"irc://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">IRC</a>]";
} elseif (eregi("teamspeak:\/\/", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"teamspeak://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">TeamSpeak</a>]";
} elseif (eregi("aim:goim", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"aim:goim");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">AIM</a>]";
} elseif (eregi("gopher:\/\/", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"gopher://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">Gopher</a>]";
} elseif (eregi("mailto:", $ShoutPart)) {
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"mailto:");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
// email encoding to stop harvesters
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutNew[$i] = "[<a href=\"$ShoutPart\">E-Mail</a>]";
} elseif (eregi("www\.", $ShoutPart)) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"www.");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutPart = "http://" . $ShoutPart;
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
} elseif (eregi('@', $ShoutPart) AND eregi('\.', $ShoutPart)) {
// email encoding to stop harvesters
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutNew[$i] = "[<a href=\"mailto:$ShoutPart\">E-Mail</a>]";
} elseif ((eregi("\.(us|tv|cc|ws|ca|de|jp|ro|be|fm|ms|tc|ph|dk|st|ac|gs|vg|sh|kz|as|lt|to)", substr("$ShoutPart", -3,3))) OR (eregi("\.(com|net|org|mil|gov|biz|pro)", substr("$ShoutPart", -4,4))) OR (eregi("\.(info|name)", substr("$ShoutPart", -5,5))) OR (eregi("\.(co\.uk|co\.za|co\.nz|co\.il)", substr("$ShoutPart", -6,6)))) {
if (((!is_user($user)) AND ($conf[20] == "no")) OR ((is_user($user)) AND ($conf[10] == "no"))) { $ShoutError = ""._URLNOTALLOWED.""; break; }
$ShoutPart = "http://" . $ShoutPart;
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
} elseif (strlen(html_entity_decode($ShoutPart, ENT_QUOTES)) > 21) {
$ShoutNew[$i] = htmlspecialchars(wordwrap(html_entity_decode($ShoutPart, ENT_QUOTES), 21, " ", 1), ENT_QUOTES);

$ShoutNew[$i] = str_replace("[ b]", " [b]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[b ]", " [b]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /b]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ b]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/b ]", "[/b] ",$ShoutNew[$i]);

$ShoutNew[$i] = str_replace("[ i]", " [i]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[i ]", " [i]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /i]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ i]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/i ]", "[/i] ",$ShoutNew[$i]);

$ShoutNew[$i] = str_replace("[ u]", " [u]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[u ]", " [u]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /u]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ u]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/u ]", "[/u] ",$ShoutNew[$i]);
} else { $ShoutNew[$i] = $ShoutPart; }
$i++;
}
if ($ShoutError == "") { $ShoutComment = implode(" ",$ShoutNew); }

//Smilies from database
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayScan = $ShoutArrayReplace;
$sql = "select * from ".$prefix."_shoutbox_emoticons";
$eresult = $db->sql_query($sql);
while ($emoticons = $db->sql_fetchrow($eresult)) {
$i = 0;
foreach($ShoutArrayScan as $ShoutPart) {
if ($ShoutPart == $emoticons[1]) { $ShoutArrayReplace[$i] = $emoticons[2]; }
$i++;
}
}
$ShoutComment = implode(" ",$ShoutArrayReplace);

//do name test then error if on list
if($conf[7] == "yes"){
$sql = "select * from ".$prefix."_shoutbox_nameblock";
$nameresult = $db->sql_query($sql);
while ($badname = $db->sql_fetchrow($nameresult)){
if($username == $badname[1]) {
$ShoutError = ""._BANNEDNICK."";
}
}
}

// check for anonymous users cloning/ghosting registered users' nicknames
cookiedecode($user);
if (!is_user($user) && ($username) && $username != "Anonymous") {
$sql = "select * from ".$prefix."_users where username = '$username'";
$nameresult = $db->sql_query($sql);
$row = $db->sql_fetchrow($nameresult);
if ($row) {
$ShoutError = ""._NOCLONINGNICKS."";
}
}

//look for bad words, then censor them.
if($conf[8] == "yes") {
// start Anonymous nickname censor check here. If bad, replace bad nick with 'Anonymous'
if (!is_user($user) && ($username) && $username != "Anonymous") {
$sql = "select * from ".$prefix."_shoutbox_censor";
$cresult = $db->sql_query($sql);
while ($censor = $db->sql_fetchrow($cresult)) {
if ($username != 'Anonymous') {
$one = strtolower($censor[1]);
$usernameL = strtolower($username);
if (stristr($usernameL, $one) !== false) {
$username = "Anonymous";
}
}
}
}
// Censor of posting text
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayScan = $ShoutArrayReplace;
$sql = "select * from ".$prefix."_shoutbox_censor";
$cresult = $db->sql_query($sql);
while ($censor = $db->sql_fetchrow($cresult)) {
$i = 0;
foreach($ShoutArrayScan as $ShoutPart) {
$ShoutPart = strtolower($ShoutPart);
$censor[1] = strtolower($censor[1]);
if ($ShoutPart == $censor[1]) { $ShoutArrayReplace[$i] = $censor[2]; }
$i++;
}
}
$ShoutComment = implode(" ",$ShoutArrayReplace);

/*
// Phrase censor - Needs work before implementing
$sql = "select * from ".$prefix."_shoutbox_emoticons";
$eresult = $db->sql_query($sql);
while ($emoticons = $db->sql_fetchrow($eresult)) {
$ShoutComment = str_replace($emoticons[1],$emoticons[2],$ShoutComment);
}
*/
}

// duplicate posting checker. stops repeated spam attacks
$sql = "select * from ".$prefix."_shoutbox_shouts order by id DESC LIMIT 5";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) { if ($row[2] == $ShoutComment) { $ShoutError = ""._DUPLICATESHOUT.""; } }

if (!$ShoutError) {
$sql = "select * from ".$prefix."_shoutbox_date";
$resultD = $db->sql_query($sql);
$rowD = $db->sql_fetchrow($resultD);

// Special thanks to JRSweets for tipping me off to the timestamp option in date()
if ($conf[19] == 0) {
$day = date("$rowD[1]");
$time = date("$rowD[2]");
} elseif (strstr($conf[19], '+')) {
$sbTimeMultiplier = str_replace('+', '', $conf[19]);
$sbTimeOffset = $sbTimeMultiplier * 3600;
$sbTimeTemp = time();
$time = date("$rowD[2]", ($sbTimeTemp + $sbTimeOffset));
$day = date("$rowD[1]", ($sbTimeTemp + $sbTimeOffset));
} else {
$sbTimeMultiplier = str_replace('-', '', $conf[19]);
$sbTimeOffset = $sbTimeMultiplier * 3600;
$sbTimeTemp = time();
$time = date("$rowD[2]", ($sbTimeTemp - $sbTimeOffset));
$day = date("$rowD[1]", ($sbTimeTemp - $sbTimeOffset));
}

$currentTime = time();

$sql = "INSERT INTO ".$prefix."_shoutbox_shouts (id,name,comment,date,time,ip,timestamp) VALUES ('0','$username ','$ShoutComment','$day','$time','$uip','$currentTime')";
$db->sql_query($sql);

// if v7.0 of nuke or higher, add points earned per shout
// $conf[21]
$sqlVer = "select * from ".$prefix."_config";
$resultVer = $db->sql_query($sqlVer);
$confVer = $db->sql_fetchrow($resultVer);
if (is_user($user) AND $confVer['Version_Num'] >= '7.0' AND $conf[21] > 0) {
$sqlP = "select user_id,points from ".$prefix."_users WHERE username='$username'";
$resultP = $db->sql_query($sqlP);
$userP = $db->sql_fetchrow($resultP);
$userPoints = $userP['points'] + $conf[21];
$sqlP = "UPDATE ".$prefix."_users set points='$userPoints' where user_id='$userP[user_id]'";
$db->sql_query($sqlP);
}

$PreviousShoutComment = "";
$PreviousComment = "";
} else {
if ($username != ""._NAME."") {
$PreviousUsername = $username;
}
if ($PreviousShoutComment != ""._SB_MESSAGE."") {
$PreviousComment = $PreviousShoutComment;
}
}

}

//Display Content From here on down

if (!is_user($user) && ($username) && $username != "Anonymous") { $username = "Anonymous"; }

$ThemeSel = get_theme();
$sql = "select * from ".$prefix."_shoutbox_theme_images WHERE themeName='$ThemeSel'";
$result = $db->sql_query($sql);
$themeRow = $db->sql_fetchrow($result);

if ($themeRow[3] != '' AND file_exists("modules/Shout_Box/images/background/$themeRow[3]")) {
$showBackground = 'yes';
} else {
$showBackground = 'no';
}

if (file_exists("modules/Shout_Box/images/up/$themeRow[2]") AND $themeRow[2] != '') {
$up_img = "modules/Shout_Box/images/up/$themeRow[2]";
} else {
$up_img = "modules/Shout_Box/images/up/Black.gif";
}
if (file_exists("modules/Shout_Box/images/down/$themeRow[2]") AND $themeRow[2] != '') {
$down_img = "modules/Shout_Box/images/down/$themeRow[2]";
} else {
$down_img = "modules/Shout_Box/images/down/Black.gif";
}
if (file_exists("modules/Shout_Box/images/pause/$themeRow[2]") AND $themeRow[2] != '') {
$pause_img = "modules/Shout_Box/images/pause/$themeRow[2]";
} else {
$pause_img = "modules/Shout_Box/images/pause/Black.gif";
}

$sql = "select * from ".$prefix."_shoutbox_shouts order by id DESC LIMIT $conf[5]";
$result = $db->sql_query($sql);

// Top half

// shout error reporting
$top_content = "";
if ($ShoutError) {
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td style=\"background-color: #FFFFE1;\"><b>"._SB_NOTE.":</b> $ShoutError</td></tr></table>";
}

// table that holds the scrolling area
if ($showBackground == 'yes') {
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"$SBborder\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: url(modules/Shout_Box/images/background/$themeRow[3]);\" height=\"$conf[13]\">\n";
} else {
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"$SBborder\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"$conf[13]\">\n";
}
// end top content

// table of the actual scrolling content
if ($showBackground == 'yes') {
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\">";
} else {
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"2\">";
}
$flag = 1;
$ThemeSel = get_theme();
$sql = "select * from ".$prefix."_shoutbox_themes WHERE themeName='$ThemeSel'";
$resultT = $db->sql_query($sql);
$rowColor = $db->sql_fetchrow($resultT);

if (is_user($user)) {
$username = $cookie[1];
if ($username != '') {
$sqlF = "SELECT user_timezone, user_dateformat from ".$prefix."_users WHERE username='$username'";
$resultF = $db->sql_query($sqlF);
$userSetup = $db->sql_fetchrow($resultF);
}
}
$sql = "select * from ".$prefix."_shoutbox_date";
$resultD = $db->sql_query($sql);
$rowD = $db->sql_fetchrow($resultD);

// Sticky shouts
$sql = "select * from ".$prefix."_shoutbox_sticky where stickySlot=0";
$stickyResult = $db->sql_query($sql);
$stickyRow0 = $db->sql_fetchrow($stickyResult);
$sql = "select * from ".$prefix."_shoutbox_sticky where stickySlot=1";
$stickyResult = $db->sql_query($sql);
$stickyRow1 = $db->sql_fetchrow($stickyResult);

if ($stickyRow0) {
if ($showBackground == 'yes') {
$mid_content .= "<tr><td>";
} else {
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
$mid_content .= "<tr><td style=\"background-color: $rowColor[2];\">";
}
$mid_content .= "<b>"._SB_ADMIN.":</b> $stickyRow0[2]";
if ($conf[3] == "yes") {
if (is_user($user)) {
// add time adjustment for following user's timezone
$displayTime = $userSetup['user_timezone'] - $conf['serverTimezone'];
$displayTime = $displayTime * 3600;
$newTimestamp = $stickyRow0[3] + $displayTime;
$unixTime = date("$userSetup[user_dateformat]", $newTimestamp);
$mid_content .= "<br />$unixTime";
} else {
$unixDay = date("$rowD[1]", $stickyRow0[3]);
$unixTime = date("$rowD[2]", $stickyRow0[3]);
$mid_content .= "<br />$unixDay&nbsp;$unixTime";
}
}
$mid_content .= "</td></tr>";
}
if ($stickyRow1) {
if ($showBackground == 'yes') {
$mid_content .= "<tr><td>";
} else {
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
$mid_content .= "<tr><td style=\"background-color: $rowColor[3];\">";
}
$mid_content .= "<b>"._SB_ADMIN.":</b> $stickyRow1[2]";
if ($conf[3] == "yes") {
if (is_user($user)) {
// add time adjustment for following user's timezone
$displayTime = $userSetup['user_timezone'] - $conf['serverTimezone'];
$displayTime = $displayTime * 3600;
$newTimestamp = $stickyRow1[3] + $displayTime;
$unixTime = date("$userSetup[user_dateformat]", $newTimestamp);
$mid_content .= "<br />$unixTime";
} else {
$unixDay = date("$rowD[1]", $stickyRow1[3]);
$unixTime = date("$rowD[2]", $stickyRow1[3]);
$mid_content .= "<br />$unixDay&nbsp;$unixTime";
}
}
$mid_content .= "</td></tr>";
}
// end sticky shouts

$i = 0;
while ($row = $db->sql_fetchrow($result)) {
if ($flag == 1) { $bgcolor = $rowColor[2]; }
if ($flag == 2) { $bgcolor = $rowColor[3]; }
if ($showBackground == 'yes') {
$tempContent[$i] = "<tr><td>";
} else {
$tempContent[$i] = "<tr><td style=\"background-color: $bgcolor;\">";
}
$ShoutComment = str_replace('src=', 'src="', $row[2]);
$ShoutComment = str_replace('.gif>', '.gif" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.jpg>', '.jpg" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.png>', '.png" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.bmp>', '.bmp" alt="" />', $ShoutComment);
$ShoutComment = str_replace("http:", "".$preURL."http:", $ShoutComment);
$ShoutComment = str_replace("ftp:", "".$preURL."ftp:", $ShoutComment);

// BB code [b]word[/b] [i]word[/i] [u]word[/u]
if ((eregi("[b]", $ShoutComment)) AND (eregi("[/b]", $ShoutComment)) AND (substr_count("$ShoutComment","[b]") == substr_count("$ShoutComment","[/b]"))) {
$ShoutComment = eregi_replace("\[b\]","<span style=\"font-weight: bold\">","$ShoutComment");
$ShoutComment = eregi_replace("\[\/b\]","</span>","$ShoutComment");
}
if ((eregi("[i]", $ShoutComment)) AND (eregi("[/i]", $ShoutComment)) AND (substr_count("$ShoutComment","[i]") == substr_count("$ShoutComment","[/i]"))) {
$ShoutComment = eregi_replace("\[i\]","<span style=\"font-style: italic\">","$ShoutComment");
$ShoutComment = eregi_replace("\[\/i\]","</span>","$ShoutComment");
}
if ((eregi("[u]", $ShoutComment)) AND (eregi("[/u]", $ShoutComment)) AND (substr_count("$ShoutComment","[u]") == substr_count("$ShoutComment","[/u]"))) {
$ShoutComment = eregi_replace("\[u\]","<span style=\"text-decoration: underline\">","$ShoutComment");
$ShoutComment = eregi_replace("\[\/u\]","</span>","$ShoutComment");
}

if ($username == "Anonymous") {
$tempContent[$i] .= "<b>$row[1]:</b> $ShoutComment";
}
else {
// check to see if nickname is a user in the DB
$sqlN = "select * from ".$prefix."_users where username='$row[1]'";
$nameresultN = $db->sql_query($sqlN);
$rowN = $db->sql_fetchrow($nameresultN);
if (($rowN) AND ($row[1] != "Anonymous")) {
$tempContent[$i] .= "<b><a href=\"modules.php?name=Your_Acc

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 06 December 2005 - 04:40 PM

Considering that's made by PHP-Nuke, i'd recommend asking them first, not us.

#5 Veej

    Young Padawan

  • Members
  • Pip
  • 49 posts

Posted 06 December 2005 - 05:58 PM

I asked 2 days ago but still had no reply :rolleyes:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users