Not Solved the shoutbox on the portal.... is possible?
#3
Not Solved
Heloo there
open ./portal.php

find
eval("\$portal = \"".$templates->get("portal")."\";"); 

above it add
 //shoutbox



if($action == "do_shout")
{
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts");
	$count = $db->num_rows($query);
	$startat = $count - 5;
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts ORDER BY dateline LIMIT $startat, 5");
	$check = 0;
	while($shout = $db->fetch_array($query))
	{
		$username = $shout['username'];
		if($username == $mybb['username'])
		{
			$check++;
		}
	}
	if($check >= 5)
	{
		eval("\$error = \"".$templates->get("shoutbox_error_flood")."\";");
		outputpage($error);
	}
	else
	{
		$message = addslashes($message);
		$dateline = time();
		$ipaddress = $REMOTE_ADDR;
		$query = $db->query("INSERT INTO ".TABLE_PREFIX."shouts VALUES ('','$mybb[uid]','$mybb[username]','$message','$dateline','$ipaddress')");
		redirect("shoutbox.php", "Shout submitted.", $settings['bbname']." - Shoutbox");
	}
}
elseif($action == "do_delete")
{
	$db->query("DELETE FROM ".TABLE_PREFIX."shouts WHERE sid='$sid'");
	redirect("shoutbox.php", "Shout deleted.", $settings['bbname']." - Shoutbox");
}
elseif($action == "do_edit")
{
	$message = addslashes($message);
	$db->query("UPDATE ".TABLE_PREFIX."shouts SET message='$message' WHERE sid='$sid'");
	redirect("shoutbox.php", "Shout edited.", $settings['bbname']." - Shoutbox");
}
elseif($action == "delete")
{
	if(!$sid)
	{
		error("Invalid Shout", "Invalid shout.");
	}
	else
	{
		$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts WHERE sid='$sid'");
		$shout = $db->fetch_array($query);
		if($mybb['uid'] != $shout['uid'] && $mybb['usergroup'] != 4 && $mybb['usergroup'] != 3)
		{
			nopermission();
		}
		eval("\$deleteshout = \"".$templates->get("shoutbox_deleteshout")."\";");
		outputpage($deleteshout);
	}
}
elseif($action == "edit")
{
	if(!$sid)
	{
		error("Invalid Shout", "Invalid shout.");
	}
	else
	{
		$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts WHERE sid='$sid'");
		$shout = $db->fetch_array($query);
		if($mybb['uid'] != $shout['uid'] && $mybb['usergroup'] != 4 && $mybb['usergroup'] != 3)
		{
			nopermission();
		}
		$shout['message'] = str_replace('"', '"', $shout['message']);
		eval("\$editshout = \"".$templates->get("shoutbox_editshout")."\";");
		outputpage($editshout);
	}
}
else
{
	if(!$page)
	{
		$page = 1;
	}
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts");
	$count = $db->num_rows($query);
	$limit = 24;
	$pages = $count / $limit;
	$pages = ceil($pages);
	if($count == 0)
	{
		eval("\$shouts = \"".$templates->get("shoutbox_error_noshouts")."\";");
	}
	$startat = $count - ($limit * $page);
	if($page == $pages)
	{
		if($startat != 0)
		{
			$limit = $limit + $startat;
			$startat = 0;
		}
	}
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."shouts ORDER BY dateline LIMIT $startat, $limit");
	while($shout = $db->fetch_array($query))
	{
		$shout['shouttime'] = mydate($settings['dateformat'], $shout['dateline']) . " " . mydate($settings['timeformat'], $shout['dateline']);
		$query2 = $db->query("SELECT u.usergroup, g.* FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.uid='$shout[uid]'");
		$group = $db->fetch_array($query2);
		$shout['message'] = postify($shout['message']);
		$mecheck = explode(" ", $shout['message']);
		if($mecheck[0] == "/me" || $mecheck[0] == "/slap")
		{
			$shout['message'] = domecode($shout['message'], $shout['username']);
			$shout['username'] = "";
		}
		else
		{
			$shout['username'] = formatname($shout['username'], $group['namestyle']);
			$shout['username'] = "<<a href=\"member.php?action=profile&uid=$shout[uid]\">$shout[username]</a>>";
		}
		if($mybb['usergroup'] == 4 || $mybb['usergroup'] == 3)
		{
			$title = "title=\"Posted: $shout[shouttime], IP: $shout[ipaddress]\"";
		}
		else
		{
			$title = "title=\"Posted: $shout[shouttime]\"";
		}
		if($mybb['uid'] == $shout['uid'] || $mybb['usergroup'] == 4 || $mybb['usergroup'] == 3)
		{
			eval("\$options = \"".$templates->get("shoutbox_options")."\";");
		}
		else
		{
			$options = "";
		}
		if($bgcolor == "trow1")
		{
			$bgcolor = "trow2";
		}
		else
		{
			$bgcolor = "trow1";
		}
		eval("\$shouts .= \"".$templates->get("shoutbox_shout")."\";");
	}
	if($page != 1)
	{
		if($page == $pages)
		{
			$nextpage = $page - 1;
			eval("\$next = \"".$templates->get("shoutbox_next")."\";");
		}
		else
		{
			$prevpage = $page + 1;
			$nextpage = $page - 1;
			eval("\$prev = \"".$templates->get("shoutbox_prev")."\";");
			eval("\$next = \"".$templates->get("shoutbox_next")."\";");
		}
	}
	else
	{
		if($pages > 1)
		{
			$prevpage = $page + 1;
			eval("\$prev = \"".$templates->get("shoutbox_prev")."\";");
		}
	}
	if($pages > 1)
	{
		eval("\$pageselect = \"".$templates->get("shoutbox_pages")."\";");
	}
	eval("\$submit = \"".$templates->get("shoutbox_submit")."\";");
	
	$refresh = "<meta http-equiv=\"refresh\" content=\"60;URL=portal.php\">";
	eval("\$shoutbox = \"".$templates->get("shoutbox")."\";");
}

then open
Admin CP > Templates >Modify / delete > Portal page templates > portal

find

$latestthread

below it add

<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<table border="0" cellspacing="$theme[borderwidth]" cellpadding="$theme[tablespace]" width="100%">
<tr>
<td cellspacing="0" cellpadding="0" >
<span class="smalltext">
$shoutbox</span>
<div align="center">$shoutboxlink | </div>
</td>
</tr>
</table>
</td></tr></table>
<br />

it will look something as here
this will also refresh the portal each few secs, so u can see all the new posts.
take note that you cant post shouts from there, u can only see them
regardsSmile
Reply


Messages In This Thread
RE: the shoutbox on the portal.... is possible? - by zaher1988 - 2006-03-28, 04:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)