[ABD] UserStars

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

I have the activity stats code (how else would I be able to give you instructions ;) ). It would be better if you post your modified file
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

Thanks to Rich who spotted i missed a global
OPEN: includes/functions_activity_stats.php
FIND:

Code: Select all

    global $template, $user; 
REPLACE WITH:

Code: Select all

    global $template, $user, $phpbb_root_path; 
 
Should actually be
OPEN: includes/functions_activity_stats.php
FIND:

Code: Select all

    global $template, $user; 
REPLACE WITH:

Code: Select all

    global $template, $user, $config, $phpbb_root_path; 
 
Updated the other post

*edit* thinking about it, that should solve your error
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
**CASANOVA**
Registered User
Posts: 99
Joined: Wed May 26, 2010 12:31 pm
Contact:

Re: [RC3] UserStars

Post by **CASANOVA** »

Again the same eror on line 48
Look I think this is something about the second part of edit you have told me!

Code: Select all

$template->assign_block_vars('lastvisit', array(
				'USERNAME_FULL'	=> get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
			));
You said to replace with this and when I replace it I got error I couldn' t open my forum than! :/

Code: Select all

$template->assign_block_vars('lastvisit', array(
                'USERNAME_FULL'    => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
                'USER_STAR'        => ($row['user_star'] == 1) ? '<img src="' . $phpbb_root_path . $config['user_star_img'] . '" alt="' . $row['username'] . ' ' . $row['user_star_text'] . '" title="' . $row['username'] . ' ' . $row['user_star_text'] . '" />' : '';
            )); 
that is code you have told me to use :/



And Here is when I finidhed the editing it look like this:

Code: Select all

<?php
/**
*
* @package phpBB3
* @author Highway of Life ( David Lewis ) http://startrekguide.com
* @version $Id$
* @copyright (c) 2008 Star Trek Guide Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

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

/**
 * Display extra stats, activity over the last 24 hours for new users, posts and topics.
 *
 * @return bool
 */
function activity_mod()
{
	global $template, $user, $config, $phpbb_root_path; 

	$user->add_lang('mods/activity_stats');

	// if the user is a bot, we won’t even process this function...
	if ($user->data['is_bot'])
	{
		return false;
	}

	// obtain user activity data
	$active_users = obtain_active_user_data();
	
	// obtain posts/topics/new users activity
	$activity = obtain_activity_data();

	// 24 hour users online list, assign to the template block: lastvisit
	foreach ($active_users as $row)
	{
			$template->assign_block_vars('lastvisit', array(
                'USERNAME_FULL'    => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
                'USER_STAR'        => ($row['user_star'] == 1) ? '<img src="' . $phpbb_root_path . $config['user_star_img'] . '" alt="' . $row['username'] . ' ' . $row['user_star_text'] . '" title="' . $row['username'] . ' ' . $row['user_star_text'] . '" />' : '';
            )); 
	}

	// assign the stats to the template.
	$template->assign_vars(array(
		'USERS_24HOUR_TOTAL'	=> sprintf($user->lang['USERS_24HOUR_TOTAL'], sizeof($active_users)),
		'24HOUR_TOPICS'			=> sprintf($user->lang['24HOUR_TOPICS'], $activity['topics']),
		'24HOUR_POSTS'			=> sprintf($user->lang['24HOUR_POSTS'], $activity['posts']),
		'24HOUR_USERS'			=> sprintf($user->lang['24HOUR_USERS'], $activity['users']),
	));

	return true;
}

/**
 * Obtain an array of active users over the last 24 hours.
 *
 * @return array
 */
function obtain_active_user_data()
{
	global $cache;

	if (($active_users = $cache->get('_active_users')) === false)
	{
		global $db;

		$active_users = array();

		// grab a list of users who are currently online
		// and users who have visited in the last 24 hours
		$sql_ary = array(
			'SELECT'    => 'u.user_id, u.user_colour, u.username, u.user_type, u.user_star, u.user_star_text', 
			'FROM'		=> array(USERS_TABLE => 'u'),
			'LEFT_JOIN'	=> array(
				array(
					'FROM'	=> array(SESSIONS_TABLE => 's'),
					'ON'	=> 's.session_user_id = u.user_id',
				),
			),
			'WHERE'		=> 'u.user_lastvisit > ' . (time() - 86400) . ' OR s.session_user_id <> ' . ANONYMOUS,
			'GROUP_BY'	=> 'u.user_id',
			'ORDER_BY'	=> 'u.username',
		);

		$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));

		while ($row = $db->sql_fetchrow($result))
		{
			$active_users[$row['user_id']] = array(
				'user_id'		=> $row['user_id'],
				'user_type'		=> $row['user_type'],
				'username'		=> $row['username'],
				'user_colour'	=> $row['user_colour'],
                                'user_star'    => $row['user_star'],
                                'user_star_text'    => $row['user_star_text'], 
			);
		}
		$db->sql_freeresult($result);

		// cache this data for 1 hour, this improves performance
		$cache->put('_active_users', $active_users, 3600);
	}

	return $active_users;
}

/**
 * obtained cached 24 hour activity data
 *
 * @return array
 */
function obtain_activity_data()
{
	global $cache;

	if (($activity = $cache->get('_activity_mod')) === false)
	{
		global $db;

		// set interval to 24 hours ago
		$interval = time() - 86400;

		$activity = array();

		// total new posts in the last 24 hours
		$sql = 'SELECT COUNT(post_id) AS new_posts
				FROM ' . POSTS_TABLE . '
				WHERE post_time > ' . $interval;
		$result = $db->sql_query($sql);
		$activity['posts'] = $db->sql_fetchfield('new_posts');
		$db->sql_freeresult($result);

		// total new topics in the last 24 hours
		$sql = 'SELECT COUNT(topic_id) AS new_topics
				FROM ' . TOPICS_TABLE . '
				WHERE topic_time > ' . $interval;
		$result = $db->sql_query($sql);
		$activity['topics'] = $db->sql_fetchfield('new_topics');
		$db->sql_freeresult($result);

		// total new users in the last 24 hours, counts inactive users as well
		$sql = 'SELECT COUNT(user_id) AS new_users
				FROM ' . USERS_TABLE . '
				WHERE user_regdate > ' . $interval;
		$result = $db->sql_query($sql);
		$activity['users'] = $db->sql_fetchfield('new_users');
		$db->sql_freeresult($result);

		// cache this data for 1 hour, this improves performance
		$cache->put('_activity_mod', $activity, 3600);
	}

	return $activity;
}
?>

And I got this error /home/XXXXX/public_html/forum/includes/functions_activity_stats.php on line 48
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

Took me a while to pin point it, but I see the error now.
Replace this:

Code: Select all

$template->assign_block_vars('lastvisit', array(
                'USERNAME_FULL'    => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
                'USER_STAR'        => ($row['user_star'] == 1) ? '<img src="' . $phpbb_root_path . $config['user_star_img'] . '" alt="' . $row['username'] . ' ' . $row['user_star_text'] . '" title="' . $row['username'] . ' ' . $row['user_star_text'] . '" />' : '';
            ));
With this:

Code: Select all

$template->assign_block_vars('lastvisit', array(
                'USERNAME_FULL'    => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
                'USER_STAR'        => ($row['user_star'] == 1) ? '<img src="' . $phpbb_root_path . $config['user_star_img'] . '" alt="' . $row['username'] . ' ' . $row['user_star_text'] . '" title="' . $row['username'] . ' ' . $row['user_star_text'] . '" />' : '',
            ));
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
**CASANOVA**
Registered User
Posts: 99
Joined: Wed May 26, 2010 12:31 pm
Contact:

Re: [RC3] UserStars

Post by **CASANOVA** »

What can I say to this? Only one big thank you! Now works but can you please make the code for other my area requests if you can :(

**CASANOVA** wrote: I just need to make this star be visible in Users active over the last 24 hours, in chat body, on the index when you lookin at the Last post author and in the viewforum body in the postauthor and forgot in the thanks list too but I don' t know how and what to edit :(


EDIT: For thanks I use this http://www.phpbb.com/community/viewtopic.php?t=1690905

I am desperate because of this mod :cry: :lol: I want it so badly to make the star visible on this parts too!
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

cherokee red wrote:Right now there's no easy way to add the star to the index/viewforum without querying the users table separately and pulling the results. IIRC, I left them out intentionally as it causes unnecessary overheard (if you notice other areas when I place the star, I usually piggy back on to another query).
As for the chat MOD, i'd have to know which MOD and which version before I can do anything - but the code will probably be very similar to that I've posted above
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
**CASANOVA**
Registered User
Posts: 99
Joined: Wed May 26, 2010 12:31 pm
Contact:

Re: [RC3] UserStars

Post by **CASANOVA** »

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


I copy that from chat.php


And do you maybe be able in the near future to make the star visible in the index/viewforum? Beacuse I already know one forum which have it that is so why I asking for all this areas because I saw it on one forum!

It is visible exactly on those parts which I asking for!
BUSAAAAA
Registered User
Posts: 2
Joined: Mon May 24, 2010 12:26 pm

Re: [RC3] UserStars

Post by BUSAAAAA »

How do I put in a chat stars

This is the chat code

Code: Select all

/chat_body.html

<!-- IF S_GET_CHAT -->

	<!-- IF S_READ or S_ADD -->

		<!-- BEGIN chatrow -->

			<div id="p{chatrow.MESSAGE_ID}">

				<table class="tablebg" cellpadding="6" cellspacing="0" width="100%">

					<tr class="row{chatrow.CLASS}">

						<td>

							<!-- IF U_ACP or U_MCP -->

							<a href="javascript:void({chatrow.MESSAGE_ID})" title="{L_DELETE_POST}" onclick="delete_post('{chatrow.MESSAGE_ID}')"><span>{L_DELETE_POST}</span></p></a>

							<!-- ENDIF -->

							 <b class="postauthor">{chatrow.USERNAME_FULL} {chatrow.USER_STAR}</b> « {chatrow.TIME} » &nbsp; <span class="postbody">{chatrow.MESSAGE}</span>

						</td>

					</tr>

					

				</table>

			</div>

		<!-- END chatrow -->---{LAST_ID}

	<!-- IF S_WHOISONLINE -->---

			<!-- BEGIN whoisrow -->

				<div><img src="{T_IMAGESET_PATH}/{whoisrow.USER_STATUS}.png" class="online_img" /> {whoisrow.USERNAME_FULL}</div>

			<!-- END whoisrow -->---{LAST_TIME}---{DELAY}---{LAST_POST}

		<!-- ENDIF -->

	<!-- ENDIF -->

<!-- ELSE -->

	<!-- IF S_CHAT -->

		<!-- INCLUDE overall_header.html -->

	<!-- ENDIF -->

	<script type="text/javascript">

	<!--

	var fieldname = 'chat';

	var last_time = 0;

	var xmlHttp = http_object();

	var last_id = {LAST_ID};

	var type = 'receive';

	var post_time = {TIME};

	var read_interval = 15000;

	var interval = setInterval('handle_send("read", last_id);', read_interval);



	function handle_send(mode, f)

	{

		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)

		{

			indicator_switch('on');

			type = 'receive';

			param = 'mode=' + mode;	

			param += '&last_id=' + last_id;

			param += '&last_time=' + last_time;			

			param += '&last_post=' + post_time;			

			param += '&read_interval=' + read_interval;			

	

			if (mode == 'add' && document.text.message.value != '')

			{

				type = 'send';

				for(var i = 0; i < f.elements.length; i++)

				{ 

					elem = f.elements[i]; 

					param += '&' + elem.name + '=' + encodeURIComponent(elem.value); 

				}

				document.text.message.value = '';

			}

			else if (mode == 'delete')

			{

				type = 'delete';

				param += '&chat_id=' + f;

			}

			xmlHttp.open("POST", '{FILENAME}', true);

			xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

			xmlHttp.onreadystatechange = handle_return;

			xmlHttp.send(param);

		}

	}

	

	function handle_return()

	{

		if (xmlHttp.readyState == 4)

		{

			if (type != 'delete')

			{

				results = xmlHttp.responseText.split('---');

				if (results[1])

				{

					if (last_id == 0)

					{

						document.getElementById(fieldname).innerHTML = results[0];

					}

					else

					{

						document.getElementById(fieldname).innerHTML = results[0] + document.getElementById(fieldname).innerHTML;

					}

					last_id = results[1];

					if (results[2])

					{

						document.getElementById('whois_online').innerHTML = results[2];

						last_time = results[3];

						if (results[4] != read_interval * 1000)

						{

							window.clearInterval(interval);

							read_interval = results[4] * 1000;

							interval = setInterval('handle_send("read", last_id);', read_interval);

							document.getElementById('update_seconds').innerHTML = results[4];

						}

						post_time = results[5];

					}

				}

			}

			indicator_switch('off');

		}

	}

	

	function delete_post(chatid)

	{

		document.getElementById('p' + chatid).style.display = 'none';

		handle_send('delete', chatid);

	}

	

	function indicator_switch(mode)

	{

		if(document.getElementById("act_indicator"))

		{

			var img = document.getElementById("act_indicator");	

			if(img.style.visibility == "hidden" && mode == 'on') 

			{

				img.style.visibility = "visible";

			}

			else if (mode == 'off')

			{

				img.style.visibility = "hidden"

			}	

		}

	}

	

	function http_object()

	{

		if (window.XMLHttpRequest)

		{

			return new XMLHttpRequest();

		}

		else if(window.ActiveXObject)

		{

			return new ActiveXObject("Microsoft.XMLHTTP");

		}

		else

		{

			document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';

		}

	}

	-->

	</script>

	<style type="text/css">

	<!--

		.box

		{

			width: 100%;

			margin-left: auto;

			margin-right: auto;

		}

		.shouts {

			width: 100%;

			height:200px;

			overflow:auto;

		}

		#chat {

			width: 100%;

			text-align:left;

		}

		#message {

			width: 65%;

		}

		#whois_online{

			vertical-align:text-top;

			text-align:left;

		}

		.online_img {

			vertical-align:middle;

		}	

		#act_indicator {

			visibility:hidden;

		}

	-->

	</style>

	<div class="box">

		<table class="tablebg" cellspacing="1" width="100%">

				<tr>

					<th align="center" colspan="2">{SITENAME} {L_CHAT}</th>

				</tr>

			<!-- IF S_USER_LOGGED_IN -->

				<tr>

					<td align="center" class="cat nav" width="80%">

						<form name="text" id="text" method="post" action="javascript:void(0);" onsubmit="handle_send('add', this)" autocomplete="off">Poruka: 

							<input type="text" tabindex="1" name="message" id="message" class="inputbox" size="28" />

							<input class="button1" type="submit" name="submit" value="{L_SUBMIT}" />

						</form>

					</td>

					<td align="center" class="cat nav" width="25%">{L_ONLINE_LIST}</td>

			<!-- ENDIF -->

			<tr>

				<td class="row3" style="text-align:left;" height="220">

					<div class="shouts">

						<div id="chat">

							<!-- BEGIN chatrow -->

								<div id="p{chatrow.MESSAGE_ID}">

									<table class="tablebg" cellpadding="6" cellspacing="0" width="100%">

										<tr class="row{chatrow.CLASS}">

											<td>

												<!-- IF U_ACP or U_MCP -->

													<a href="javascript:void({chatrow.MESSAGE_ID})" title="{L_DELETE_POST}" onclick="delete_post('{chatrow.MESSAGE_ID}')"><span>{L_DELETE_POST}</span></p></a>

												<!-- ENDIF -->

												<b class="postauthor">{chatrow.USERNAME_FULL} {chatrow.USER_STAR} </b> « {chatrow.TIME} » &nbsp; <span class="postbody">{chatrow.MESSAGE}</span>

											</td>

										</tr>

										

									</table>

								</div>

							<!-- END chatrow -->

						</div>

					</div>

				</td>

				<td class="row1" nowrap="nowrap" width="25%">

					<div class="shouts">

						<div id="whois_online">

							<!-- BEGIN whoisrow -->

								<div><img src="{T_IMAGESET_PATH}/{whoisrow.USER_STATUS}.png" class="online_img" /> {whoisrow.USERNAME_FULL}</div>

							<!-- END whoisrow -->

						</div>

					</div>

				</td>

			</tr>

			

		</table>

	</div>

	<!-- IF S_CHAT -->

		<!-- INCLUDE overall_footer.html -->

	<!-- ENDIF -->

<!-- ENDIF -->

Code: Select all

///chat.php

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

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('chat');

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 */
/***************************************/

$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'	=> clean_username(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_login'		=> time(),
					'user_lastupdate'	=> 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(),
			'DELAY'	=> $default_delay,
		));
	break;
	case 'read':
		$sql = 'SELECT * FROM ' . CHAT_TABLE . " WHERE message_id > $last_id ORDER BY message_id DESC";
		$result = $db->sql_query_limit($sql, 25);
		$rows = $db->sql_fetchrowset($result);

		if (!sizeof($rows) && ((time() - 60) < $last_time))
		{
			exit;
		}
		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'	=> clean_username(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 ((time() - 60) > $last_time)
		{
			whois_online();
			$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);
		}
		$get = true;
	break;
	case 'add':
		if (!$user->data['is_registered'] || $user->data['user_type'] == USER_INACTIVE || $user->data['user_type'] == USER_IGNORE)
		{
			redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'));
		}

		$get = true;
		$read_interval = request_var('read_interval', 0);
		$message = utf8_normalize_nfc(request_var('message', '', true));

		if (!$message)
		{
			break;
		}
		clean_message($message);
		$uid = $bitfield = $options = '';
		$allow_bbcode = $allow_urls = $allow_smilies = true;
		generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);

		$sql_ary = array(
			'chat_id'			=> 1,
			'user_id'			=> $user->data['user_id'],
			'username'			=> $user->data['username'],
			'user_colour'		=> $user->data['user_colour'],
			'message'			=> $message,
			'bbcode_bitfield'	=> $bitfield,
			'bbcode_uid'		=> $uid,
			'bbcode_options'	=> $options,
			'time'				=> time(),
		);
		$sql = 'INSERT INTO ' . CHAT_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
		$db->sql_query($sql);

		$sql_ary = array(
			'username'			=> $user->data['username'],
			'user_colour'		=> $user->data['user_colour'],
			'user_lastpost'		=> time(),
			'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 = 'SELECT * FROM ' . CHAT_TABLE . " WHERE message_id > $last_id ORDER BY message_id DESC";
		$result = $db->sql_query_limit($sql, 25);
		$rows = $db->sql_fetchrowset($result);

		if (!sizeof($rows) && ((time() - 60) < $last_time))
		{
			exit;
		}
		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'	=> clean_username(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 ($read_interval != $delay['online'])
		{
			whois_online();
		}
	break;
	case 'delete':
		$get = true;
		$chat_id = request_var('chat_id', 0);

		if (!$chat_id)
		{
			break;
		}

		if (!$auth->acl_get('a_') && !$auth->acl_get('m_'))
		{
			break;
		}
		$sql = 'DELETE FROM ' . CHAT_TABLE . " WHERE message_id = $chat_id";
		$db->sql_query($sql);

	break;
}

$mode = strtoupper($mode);
$template->assign_vars(array(
	'FILENAME'		=> append_sid("{$phpbb_root_path}chat.$phpEx"),
	'LAST_ID'		=> $last_id,
	'S_CHAT'		=> (!$get) ? true : false,
	'S_GET_CHAT'	=> ($get) ? true : false,
	'S_' . $mode	=> true,
));
page_header($user->lang['PAGE_TITLE']);

$template->set_filenames(array(
	'body' => 'chat_body.html')
);

page_footer();

function whois_online()
{
	global $db, $template, $user, $config, $phpbb_root_path;
	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']}";
	$db->sql_query($sql);

	$sql = 'DELETE FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_lastupdate < $check_time";
	$db->sql_query($sql);

	$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((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
                       'USER_STAR'        => ($row['user_star'] == 1) ? '<img src="' . $phpbb_root_path . $config['user_star_img'] . '" alt="' . $row['username'] . ' ' . $row['user_star_text'] . '" title="' . $row['username'] . ' ' . $row['user_star_text'] . '" />' : '',
                       'USER_STATUS'	=> $status,
		));
	}
	$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;
}

function clean_message(&$message)
{
	if (strpos($message, '---') !== false)
	{
		$message = str_replace('---', '–––', $message);
		clean_message($message);
	}
}

function clean_username($user)
{
	if (strpos($user, '---') !== false)
	{
		$user = str_replace('---', '–––', $user);
		clean_username($user);
	}
	
	return $user;
}

?>

Code: Select all

///shout

<?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, $config, $phpbb_root_path; 
	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;
}
?>
batanaka
Registered User
Posts: 12
Joined: Tue Sep 21, 2010 11:35 pm

Re: [RC3] UserStars

Post by batanaka »

Is there an alternative download location for this? Both demo and download links seem to be dead.
BUSAAAAA
Registered User
Posts: 2
Joined: Mon May 24, 2010 12:26 pm

Re: [RC3] UserStars

Post by BUSAAAAA »

Can anyone answer :cry:
UKN0WN
Registered User
Posts: 45
Joined: Wed Jul 16, 2014 9:53 pm

Re: [RC3] UserStars

Post by UKN0WN »

Does anyone have a download link for this? one shown is not working and wan't to use it on my phpbb3 forum thx
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

Hm, I may have a link to this saved somewhere but it will take some digging. If you can hold off a day or two until I can find it, I will try and post back.
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
UKN0WN
Registered User
Posts: 45
Joined: Wed Jul 16, 2014 9:53 pm

Re: [RC3] UserStars

Post by UKN0WN »

stickerboy wrote:Hm, I may have a link to this saved somewhere but it will take some digging. If you can hold off a day or two until I can find it, I will try and post back.

ok ty broski <3
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

It may be a few days later than planned, but I managed to dig it up :)
http://stickerboy.github.io/phpbb-snipp ... ser-stars/

I'll update the 1st post, marking this as abandoned. If anyone wishes to take it over, please feel free to do so :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 26822
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [ABD] UserStars

Post by Paul »

This topic has been marked as [ABD] - Abandoned as the mod author has not been active recently. If the MOD author wishes to continue development, please PM anyone on the MOD Team to request this topic be unlocked.

Notice!
We do not recommend that a user of the phpBB software install this MOD, or any other mod that is marked as “abandoned” or “in development”, on a live forum. Doing so may cause your forum to not perform in the manner it should.


Thank you,
The phpBB Modifications Team
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development
Locked

Return to “[3.0.x] Abandoned MODs”