News:

Wondering if this will always be free?  See why free is better.

Main Menu

nneonneo's Shoutbox

Started by nneonneo, December 26, 2006, 06:58:11 PM

Previous topic - Next topic

adventurer

how can I get time line and shout text in 1 line???

Picobrain

Ok I finally have installed shoutbox on my forum (actually ameo installed it for me, thanks dude ;) ) and I have 2 questions:

1. How can I put shoutbox on the bottom of the page, right now its on the top.

2. Can I hide somehow shoutbox not to show on every page? For example if I go to my profile I can still see the shoutbox, or if I go in the admin panel shoutbox is still there. I just want shoutbox to show only on the first page of the forum.

Thank you

henryjesus

how do you reduce the lines for the shoutbox ?

nneonneo

#4903
@MrMoney: I swear that I've posted instructions on how to do it before...unfortunately, the search feature refuses to show me more than one post, so I can't find it :(

The previous one was for making the shoutbox show people entering/leaving as shouts (IRC-style), but the idea is the same.

The basic idea is this: when the chat is loaded, add the user to a list of active users, and when the chat is unloaded, remove the user from that list. The active list can be included as part of the shout updates, which should reduce the amount of AJAX required.

Really early versions (pre-1.03) came with a disabled form of typing notification, which would show users who was typing at a given moment. However, that killed servers very quickly due to the incredible load, which is why it was disabled. Unfortunately, I don't have a copy of that script any more.

@SirTony: Open yshout.php and change
// Regular user $_GET commands: history, help
if(isset($_GET["history"]))
{
history();
exit;
}

to
// Regular user $_GET commands: history, help
if(isset($_GET["history"]))
{
if(isGuest()) echo 'Register to view shoutbox history.';
else history();
exit;
}


@magnastik: Have you tried http://www.simplemachines.org/community/index.php?topic=137508.msg1829501#msg1829501?

@Casal: Uhh, sorry, I'm not sure what you are saying. Are you getting database errors of some sort?

@zach21uk: There's a way to do it. It's a little hack, but it is minimally invasive.

Open up yshout.php. Before
// Check configuration files
if(!file_exists($yshoutdir.'settings.php'))

add
if(isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!') $settingsPath = 'settings1.php';
else $settingsPath='settings.php';


Now change both
'settings.php'
to
$settingsPath
(n.b. one might be "settings.php")

Now, if $shoutFile starts with an exclamation mark (which will be stripped off later), the alternate settings file gets loaded. So, we can just change
$shoutFile='home';
to
$shoutFile='!home';
in the files where the alternate settings should be loaded.

Note that this doesn't scale to more settings files well, but the advantage is minimal modification of the scripts.

@adventurer: Edit preg_timeformat in yshout/settings.php to your liking...

@Picobrain: You can opt to move the shoutbox code (the block with // YSHOUT HERE - shoutbox code) from index.template.php where it is installed by default to BoardIndex.template.php, and place it at the bottom as you desire in that file.

@henryjesus: Edit yshout/settings.php and reduce $maxLines.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

nneonneo

OK. Let me try this...

These are instructions for making an online-users list. They are most definitely alpha instructions, so they might not work 100%.

In yshout/js/yshout.js, change
function unloadChat() {
to
function setStatus(status) {
   new ajax (yshout_php, {
         postBody: 'reqtype=status&status=' + status + '&file=' + shoutFile
      });
}
function unloadChat() {
setStatus("off");


In yshout.php, change
// Load settings
require_once($yshoutdir."settings.php");
global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$sbMaintenance;

to
if(!file_exists($yshoutdir.'_status.php'))
{
// If _status.php has been deleted, assume it should be reset to defaults
$online_list=array();
$sbMaintenance=false;
writeBanList();
}
// Load settings
require_once($yshoutdir."settings.php");
global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$sbMaintenance;
require_once($yshoutdir.'_banlist.php');
global $online_list;
require_once($yshoutdir.'_status.php');


Change
case "autoshout":
if(isMod())
processCommand($_POST["shout"]);
break;
}

to
case "autoshout":
if(isMod())
processCommand($_POST["shout"]);
break;
case "status":
setStatus($_POST['status']=='on');
break;
}

function getStatus() {
global $online_list;
$list=$online_list;
if(isset($list[0]) && $list[0] >= 1) {
$list[0] = $list[0] . ' guest' . (($list[0]!=1) ? 's': '');
} else {
unset($list[0]);
}
return '<br /><div id="status">Users currently viewing the shoutbox: '.implode(', ', $list).'</div>';
}

function writeStatus() {
global $online_list, $yshoutdir;
$writeText = "<"."?php\n"; // php header
$writeText .= '$online_list = '.var_export($online_list,true).";\n";
$writeText .= '?'.'>'; // end tag
$handle = fopen($yshoutdir."_status.php", "w");
if($handle===false) die('File error (writeStatus); aborted');
$failcount=0;
while( !flock($handle, LOCK_EX) ) // just IN CASE two bans happen simultaneously
{
usleep(50000);
$failcount++;
if($failcount > 20) die('Write error (writeStatus); aborted'); // one second
}
fwrite($handle, $writeText);
flock($handle, LOCK_UN);
fclose($handle);
}

function setStatus($online) {
global $user, $online_list;
if($user['id']==0) {
if($online)
$online_list[0]++;
elseif($online_list[0] >= 1)
$online_list[0]--;
} else {
if($online && loadMemberData(Array($user['id']),false,'profile')!==false) {
global $user_profile;
$profile=$user_profile[$user['id']];
$a_style = ' class="userclass" style="color: '.(empty($profile['member_group_color']) ? $profile['post_group_color'] : $profile['member_group_color']).'"';
$online_list[$user['id']]="<a$a_style href=\"index.php?action=profile;u=".$user['id'].'">'.$user['name'].'</a>';
} elseif(!$online) {
unset($online_list[$user['id']]);
}
}
writeStatus();
global $chatPath;
touch($chatPath);
}

Change
return $chatText.' '; // hack: totally empty responses can break some browsers
to
return $chatText.getStatus().' '; // hack: totally empty responses can break some browsers
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

zach21uk

#4905
Quote from: nneonneo on January 12, 2009, 09:35:34 AM
@zach21uk: There's a way to do it. It's a little hack, but it is minimally invasive.

Open up yshout.php. Before
// Check configuration files
if(!file_exists($yshoutdir.'settings.php'))

add
if(isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!') $settingsPath = 'settings1.php';
else $settingsPath='settings.php';


Now change both
'settings.php'
to
$settingsPath
(n.b. one might be "settings.php")

Now, if $shoutFile starts with an exclamation mark (which will be stripped off later), the alternate settings file gets loaded. So, we can just change
$shoutFile='home';
to
$shoutFile='!home';
in the files where the alternate settings should be loaded.

Note that this doesn't scale to more settings files well, but the advantage is minimal modification of the scripts.

I'm probably being really stupid here, but im getting and error in the shoutbox now saying "no settings"

This is my code:

// Figure out where the yshout folder is
global $yshoutdir;
$yshoutdir=(defined('SMF')||isset($yshout_from_index))?'yshout/':'';

if(isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!') $settingsPath = 'settings1.php';
else $settingsPath='settings.php';

// Check configuration files
if(!file_exists($yshoutdir.'$settingsPath'))
{
echo 'Error: No settings.';
return;
}
if(!file_exists($yshoutdir.'_banlist.php'))
{
// If _banlist.php has been deleted, assume it should be reset to defaults
$ban_ips_readpost=$ban_ips_post=$ban_names_readpost=$ban_names_post=array();
$sbMaintenance=false;
writeBanList();
}
// Load settings
require_once($yshoutdir."settings.php");
global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$sbMaintenance;


What have I done wrong?

nneonneo

Don't put quotes around $settingsPath. You also need to replace "settings.php" by $settingsPath.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

zach21uk

Quote from: nneonneo on January 12, 2009, 11:52:26 AM
Don't put quotes around $settingsPath. You also need to replace "settings.php" by $settingsPath.

OK I've done that and had partial success.    The shoutbox on my main page seems to be using the settings from "settings1.php" instead of "settings.php".    settings1.php should only be used on the /yshout/index.php version of the shoutbox.

The only variable that I need to be different is that on the main board, I need 18 lines displayed and on the /yshout/index.php I want 40 lines displayed.

Once again, here is my code from yshout.php as it stands:

// Figure out where the yshout folder is
global $yshoutdir;
$yshoutdir=(defined('SMF')||isset($yshout_from_index))?'yshout/':'';

if(isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!') $settingsPath = 'settings1.php';
else $settingsPath='settings.php';

// Check configuration files
if(!file_exists($yshoutdir.$settingsPath))
{
echo 'Error: No settings.';
return;
}
if(!file_exists($yshoutdir.'_banlist.php'))
{
// If _banlist.php has been deleted, assume it should be reset to defaults
$ban_ips_readpost=$ban_ips_post=$ban_names_readpost=$ban_names_post=array();
$sbMaintenance=false;
writeBanList();
}
// Load settings
require_once($yshoutdir.$settingsPath);
global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$sbMaintenance;
require_once($yshoutdir.'_banlist.php');


and this is the code from the yshout/index.php where i added the "!"

// YSHOUT HERE - <head> code
global $boardurl,$shoutFile;
$boardurl=".."; // change this to the relative or absolute path to the forum root
$shoutFile='!home';
if(!file_exists("$boardurl/Themes"))

Casal

x nneonneo;

What I say is that the chat does that the forum sometimes does not connect with the database and gives mistakes constant.
♫♪♫♪

t0k3nBuDz

I am sure this has been asked before, but I get this error.  What should I do?

Fatal error: Call to undefined function allowedTo() in /home/c732108/public_html/forum/yshout/yshout.php on line 69

Cobra97

#4910
Hi,

  I installed this today, and everything went fine.  However later I decided that I didn't want to use it after all.  So I un-installed it, and again everything said it went fine.

However now my forum has crashed, and I'm not sure why?  I'm getting this now:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.


I had made a backup before I installed it and uploaded these files thinking it would fix the problem.  I even reinstalled a backup of my database, still with no luck??  What am I overlooking here?

I have manually reinstall all the files this mod has changed?

./index.php
./Themes/default/index.template.php
./Themes/default/languages/Modifications.english.php
./Themes/default/languages/Modifications.english-utf8.php

------------------------------------------------------------------------------------------

EDIT

I found the problem, it was being caused by some permission errors left over from the mod.

t0k3nBuDz

#4911
I am sure this has been asked before, but I get this error.  What should I do?

Fatal error: Call to undefined function allowedTo() in /home/c732108/public_html/forum/yshout/yshout.php on line 69


henryjesus

thanks sunking .. i'll give it a shot ... the best !

henryjesus

sunking .. it worked .. i have a scrollbar now ... just want to ask , is it possible for the shoutbox position to be reversed ? instead of having messages at the bottom , i would like to start from the top :)

[unplugged]

Open /yshout/settings.php and change $reverseshouts to true.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



t0k3nBuDz

#4915
-
Quote from: t0k3nBuDz on January 12, 2009, 05:00:50 PM
I am sure this has been asked before, but I get this error.  What should I do?

Fatal error: Call to undefined function allowedTo() in /home/c732108/public_html/forum/yshout/yshout.php on line 69


Quote from: SunKing on January 13, 2009, 08:27:19 AM
Open /yshout/settings.php and change $reverseshouts to true.

This reply was for me?  I just want to make sure before I do something I shouldn't be doing... (edit) I see now that it was not for me, is to reverse the messages.  Thats nice....I will use that too. Thanks.

BTW, I am extremely grateful you all take the time out of your busy schedules to help a n00b like me.  After trying to read this tread, it seams this could be a full time job, just answering questions and dealing with issues.  So.....Thanks

zach21uk

REPOSTED

OK I've done that and had partial success.    The shoutbox on my main page seems to be using the settings from "settings1.php" instead of "settings.php".    settings1.php should only be used on the /yshout/index.php version of the shoutbox.

The only variable that I need to be different is that on the main board, I need 18 lines displayed and on the /yshout/index.php I want 40 lines displayed.

Once again, here is my code from yshout.php as it stands:

// Figure out where the yshout folder is
global $yshoutdir;
$yshoutdir=(defined('SMF')||isset($yshout_from_index))?'yshout/':'';

if(isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!') $settingsPath = 'settings1.php';
else $settingsPath='settings.php';

// Check configuration files
if(!file_exists($yshoutdir.$settingsPath))
{
echo 'Error: No settings.';
return;
}
if(!file_exists($yshoutdir.'_banlist.php'))
{
// If _banlist.php has been deleted, assume it should be reset to defaults
$ban_ips_readpost=$ban_ips_post=$ban_names_readpost=$ban_names_post=array();
$sbMaintenance=false;
writeBanList();
}
// Load settings
require_once($yshoutdir.$settingsPath);
global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$sbMaintenance;
require_once($yshoutdir.'_banlist.php');


and this is the code from the yshout/index.php where i added the "!"

// YSHOUT HERE - <head> code
global $boardurl,$shoutFile;
$boardurl=".."; // change this to the relative or absolute path to the forum root
$shoutFile='!home';
if(!file_exists("$boardurl/Themes"))

nneonneo

@zach21uk: Sorry, that code had a slight problem. Try replacing
if(isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!') $settingsPath = 'settings1.php';
by
if((isset($shoutFile) && $shoutFile[0]=='!') || (isset($_REQUEST['file']) && $_REQUEST['file'][0]=='!')) $settingsPath = 'settings1.php';

@Casal: Try the tips for "high-bandwidth usage" on the main mod page.
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

zach21uk

The two settings files still seem to be getting confused.   I updated to the new code you provided, but settings1.php is still being used on the main shoutbox, which is supposed to be using settings.php

zach21uk

Also - Can someone tell me where I can control the overall WIDTH of the shoutbox

Advertisement: