Page 1 of 2

ajak shoutbox by handyman on portal

Posted: 22. August 2008 15:48
by drankur
Your phpBB Version: 3.02
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Beginner

What have you done before the problem was there?


What have you already tryed to solve the problem?


Description and Message
how can i integrate ajak shoutbox by handyman on portal, i can't fine the english support .
plz help

Re: ajak shoutbox by handyman on portal

Posted: 22. August 2008 17:40
by thomas.d
Hi Drankur,

the following is an instruction to integrate the Ajax Shoutbox by Paul into the Board3 Portal.

To integrate handymans box it sholud be about the same ...

Open \root\portal.php

Find

Code: Select all

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/lang_portal');
Add after

Code: Select all

//shoutbox
if (!function_exists('as_display'))
{
   include($phpbb_root_path . 'includes/functions_shoutbox.' . $phpEx);
}
as_display();
//end shoutbox
Open root\styles\prosilver\template\portal\portal_body.html

Find

Code: Select all

<!-- IF S_DISPLAY_NEWS -->
<!-- IF S_NEWS_COMPACT -->
Add before

Code: Select all

<!-- IF not S_IS_BOT and S_USER_LOGGED_IN  -->
<!-- INCLUDE shout_body.html -->
<!-- ENDIF -->
create a file "shout_body.html" and save it in \styles\prosilver\template:

Code: Select all

<!-- IF S_CAN_VIEW_AS -->
	<div class="forabg">
		<div class="inner">
			<span class="corners-top"><span></span></span>
			<ul class="topiclist">
				<li class="header">
					<dl>
						<dt>{L_SHOUTBOX}</dt>
					</dl>
				</li>
			</ul>
			<span id="shoutbox"></span>
			<span class="corners-bottom"><span></span></span>
		</div>
	</div>
	<script type="text/javascript">
	//<![CDATA[
	display_shoutbox = true;
	load_shout();
	//]]>
	</script>
<!-- ENDIF -->
Should work like this or at least similar to this ...

Re: ajak shoutbox by handyman on portal

Posted: 13. October 2008 08:57
by sagaraptor
what about handyman shotbox?

handyman do not have this "includes/functions_shoutbox."

Re: ajak shoutbox by handyman on portal

Posted: 13. October 2008 12:05
by thomas.d
Hi sagaraptor,

so what does Handymans Mod have instead?

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 01:21
by killians1978
handyman's has shout.php. Here is the code:

Code: Select all

<?php
/** 
*
* @package phpBB3
* @version $Id: shout.php 52 2007-11-04 05:56:17Z Handyman $
* @copyright (c) 2006 StarTrekGuide Group 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

define('CHAT_TABLE', $table_prefix . 'chat');
define('CHAT_SESSIONS_TABLE', $table_prefix . 'chat_sessions');

/******************************************/
/* EDIT these for custom online settings */
/****************************************/
$session_time = 300;
$default_delay = 15;
//set status
$times = array(
	'online'	=> 0,
	'idle'		=> 300,
	'offline'	=> 1800,
);
//set delay for each status
$delay = array(
	'online'	=> 5,
	'idle'		=> 60,
	'offline'	=> 300,
);
/*****************************************/
/* DO NOT EDIT ANYTHING BELOW THIS LINE */
/***************************************/
$user->add_lang('chat');
$mode = request_var('mode', '');
$last_id = request_var('last_id', 0);
$last_post = request_var('last_post', 0);
$last_time = request_var('last_time', 0);
$get = $init = false;
$count = 0;

switch ($mode)
{
	default:
		$sql = 'SELECT * FROM ' . CHAT_TABLE . ' ORDER BY message_id DESC';
		$result = $db->sql_query_limit($sql, 25);
		$rows = $db->sql_fetchrowset($result);

		foreach ($rows as $row)
		{
			if ($count++ == 0)
			{
				$last_id = $row['message_id'];
			}
			$template->assign_block_vars('chatrow', array(
				'MESSAGE_ID'	=> $row['message_id'],
				'USERNAME_FULL'	=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $user->lang['GUEST']),
				'MESSAGE'		=> generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
				'TIME'			=> $user->format_date($row['time']),
				'CLASS'			=> ($row['message_id'] % 2) ? 1 : 2,
			));
		}
		$db->sql_freeresult($result);

		if ($user->data['user_type'] == USER_FOUNDER || $user->data['user_type'] == USER_NORMAL)
		{
			$sql = 'SELECT * FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$user->data['user_id']}";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$db->sql_freeresult($result);

			if ($row['user_id'] != $user->data['user_id'])
			{
				$sql_ary = array(
					'user_id'			=> $user->data['user_id'],
					'username'			=> $user->data['username'],
					'user_colour'		=> $user->data['user_colour'],
					'user_login'		=> time(),
					'user_lastupdate'	=> time(),
				);
				$sql = 'INSERT INTO ' . CHAT_SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
				$db->sql_query($sql);
			}
			else
			{
				$sql_ary = array(
					'username'			=> $user->data['username'],
					'user_colour'		=> $user->data['user_colour'],
					'user_lastupdate'	=> time(),
					'user_login'		=> time(),
				);
				$sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$user->data['user_id']}";
				$db->sql_query($sql);
			}
		}
		whois_online();
		$template->assign_vars(array(
			'TIME'	=> time(),
		));
	break;
}

$mode = strtoupper($mode);
$template->assign_vars(array(
	'FILENAME'		=> append_sid("{$phpbb_root_path}chat.$phpEx"),
	'LAST_ID'		=> $last_id,
	'S_' . $mode	=> true,
));

function whois_online()
{
	global $db, $template, $user;
	global $delay, $last_post, $session_time;
	
	$check_time = time() - $session_time;
	
	$sql_ary = array(
		'username'			=> $user->data['username'],
		'user_colour'		=> $user->data['user_colour'],
		'user_lastupdate'	=> time(),
	);
	$sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$user->data['user_id']}";
	$result = $db->sql_query($sql);

	$sql = 'DELETE FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_lastupdate < $check_time";
	$db->sql_query($sql);
	
	$status_time = false;
	$sql = 'SELECT *
		FROM ' . CHAT_SESSIONS_TABLE . "
		WHERE user_lastupdate > $check_time
		ORDER BY username ASC";
	$result = $db->sql_query($sql);

	$status_time = time();
	while ($row = $db->sql_fetchrow($result))
	{
		if ($row['user_id'] == $user->data['user_id'])
		{
			$last_post = $row['user_lastpost'];
			$login_time = $row['user_login'];
			$status_time = ($last_post > $login_time) ? $last_post : $login_time;
		}
		$status = get_status($row['user_lastpost']);
		$template->assign_block_vars('whoisrow', array(
			'USERNAME_FULL'	=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $user->lang['GUEST']),
			'USER_STATUS'	=> $status,
		));
		$user_ary[] = $row['user_id'];
	}
	$db->sql_freeresult($result);
	
	$template->assign_vars(array(
		'DELAY'			=> ($status_time) ? $delay[get_status($status_time)] : $delay['idle'],
		'LAST_TIME'		=> time(),
		'S_WHOISONLINE'	=> true,
	));
	return false;
}
function get_status($last)
{
	global $times;

	$status = 'online';
	if ($last < (time() - $times['offline']))
	{
		$status = 'offline';
	}
	else if ($last < (time() - $times['idle']))
	{
		$status = 'idle';
	}
	return $status;
}
?>

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 01:36
by killians1978
Far be it from me to ask you to start fresh, but would it be possible to look over the handyman's files and see (if nothing else) would it be possible to just use a Custom Box html to include the Ajax box?

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 16:23
by ather
the handyman's mod includes a chat_body.html file..its easy to implement in any page u wosh

just type :

<!-- INCLUDE chat_body.html -->

and ur good to go, ps. this is my first post on this forum.. i use Board3 on my forum here : http://ppcwarez2.com

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 16:29
by killians1978
ather wrote:the handyman's mod includes a chat_body.html file..its easy to implement in any page u wosh

just type :

<!-- INCLUDE chat_body.html -->

and ur good to go, ps. this is my first post on this forum.. i use Board3 on my forum here : http://ppcwarez2.com
Ather,

I tried this on my board at http://redmoonlarp.com and it didn't work. I put the INCLUDE in the HTML custom box on the front portal to no effect. Is there somewhere specific in the portal.php file I should be putting this, instead of in a custom block?

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 17:00
by ather
erm u cant just put the include... , it has to be in the template file

open the portal.php and add some where the include line

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 17:04
by ather
try this, create a new bbcode (visible only to you, with the iframe of chatbox, a=since u can put bbcodes in the POrtal, just put the bbcode u made, see if that works

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 17:09
by ather
ok see this : http://ppcwarez2.com/phpbb/portal.php , that s my forum.. as u can see its appearing above now, but it can be chaged if u play with it a little, goto ACP/Styles/Templates/<click your temple>/and press edit, select the portal_body.html from the list and add <include.....>, purge cache and ur done

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 19:21
by killians1978
ather wrote:ok see this : http://ppcwarez2.com/phpbb/portal.php , that s my forum.. as u can see its appearing above now, but it can be chaged if u play with it a little, goto ACP/Styles/Templates/<click your temple>/and press edit, select the portal_body.html from the list and add <include.....>, purge cache and ur done
I did exactly that:

Code: Select all

<!-- IF S_DISPLAY_WELCOME -->
			<!-- IF S_DISPLAY_WELCOME_GUEST and S_USER_LOGGED_IN -->
			<!-- ELSE -->
				<!-- INCLUDE portal/block/welcome.html -->
			<!-- ENDIF -->
		<!-- ENDIF -->
		<!-- INCLUDE chat_body.html -->
		<!-- IF S_CUSTOM_CENTER -->
			<!-- INCLUDE portal/block/custom_center.html -->
		<!-- ENDIF -->

		<!-- IF S_DISPLAY_RECENT -->
			<!-- INCLUDE portal/block/recent.html -->
		<!-- ENDIF -->
Now I get a shoutbox, but it seems to not function. The one on my main board index works just fine.

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 20:58
by killians1978
ather wrote:move the

Code: Select all

<!-- INCLUDE chat_body.html -->
after,

Code: Select all

<!-- IF S_CUSTOM_CENTER -->
Done, with the exact same result. Only this time it's above the custom center block. I've moved it to a few different points on the portal_body.html, all with the exact same effect.

Again, http://redmoonlarp.com for what it looks like. chat_body.html appears to not be making all the calls that it needs to.

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 20:59
by killians1978
ather wrote:move the

Code: Select all

<!-- INCLUDE chat_body.html -->
after,

Code: Select all

<!-- IF S_CUSTOM_CENTER -->
Done, with the exact same result. Only this time it's above the custom center block. I've moved it to a few different points on the portal_body.html, all with the exact same effect.

Again, http://redmoonlarp.com for what it looks like. chat_body.html appears to not be making all the calls that it needs to.

Re: ajak shoutbox by handyman on portal

Posted: 14. November 2008 21:18
by ather
move the

Code: Select all

<!-- INCLUDE chat_body.html -->
after,

Code: Select all

<!-- IF S_CUSTOM_CENTER -->