News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

nneonneo's Shoutbox

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

Previous topic - Next topic

nneonneo

No, it has to be the URL or something. I recommend trying "/".
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!

Tricks

Ok and as i asked before do i change all of var board_url = "'; $boardurlparsed = parse_url($boardurl); echo $boardurlparsed['path'], '"; and if not which bits do i change?

I only ask this because it shows differently to your instructions.

nneonneo

var board_url = "'; $boardurlparsed = parse_url($boardurl); echo $boardurlparsed['path'], '";
==>
var board_url = "<url>";
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!

Tricks

Quote from: nneonneo on February 04, 2008, 03:32:03 PM
var board_url = "'; $boardurlparsed = parse_url($boardurl); echo $boardurlparsed['path'], '";
==>
var board_url = "<url>";

Changed it and now its not loading at all just hangs with the msg ...loading shoutbox...  :(

l.uca


4. Search after in index.template.php or boardindex.template.php depend on where u put shout box.

Code:
<div style="padding: 1ex 25px 1ex 25px;"id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">',$txt['yshout_loading'],'<br /><br /></div>

add

code:
<div class="smalltext" style="padding-left:25px;"><a href="javascript:collapse1.slidedown()">Open Smiley</a> | <a href="javascript:collapse1.slideup()">Close</a>';
                     require('mymod/smiley.php');
                     loadSmileys();
                  echo '
                     <div id="smiley_pic">';
                        printSmileys('shout_form','shout_text');
                  echo '
                     </div>
                     <script type="text/javascript">
                     //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
                     var collapse1=new animatedcollapse("smiley_pic", 1000, false)
                     </script>
                  </div>

Hallo to all, I have a little problem to insert smiley on yshout, becouse i don't know where is the code that i quoted, and if is possible can you give me the file smiley.php, thank's for all to all, bye bye.
this is my index.template.php


<?php
// Version: 1.1; index

/* This template is, perhaps, the most important template in the theme. It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below. It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.

The init sub template should load any data and set any hardcoded options.

The main_above sub template is what is shown above the main content, and
should contain anything that should be shown up there.

The main_below sub template, conversely, is shown after the main content.
It should probably contain the copyright statement and some other things.

The linktree sub template should display the link tree, using the data
in the $context['linktree'] variable.

The menu sub template should display all the relevant buttons the user
wants and or needs.

For more information on the templating system, please see the site at:
http://www.simplemachines.org/
*/

// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';

/* The version this template/theme is for.
This should probably be the version of SMF it was created for. */
$settings['theme_version'] = '1.1';

/* Set a setting that tells the theme that it can render the tabs. */
$settings['use_tabs'] = true;

/* Use plain buttons - as oppossed to text buttons? */
$settings['use_buttons'] = true;

/* Show sticky and lock status seperate from topic icons? */
$settings['seperate_sticky_lock'] = true;
}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt$modSettings;

// Show right to left and the character set for ease of translating.

if (!defined('_VALID_MOS')){
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title'], (!empty($context['description']) ? ' - '$context['description'] : '') , '" />', empty($context['robot_no_index']) ? '' '
<meta name="robots" content="noindex" />'
'
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
var smf_iso_case_folding = '
$context['server']['iso_case_folding'] ? 'true' 'false'';
var smf_charset = "'
$context['character_set'], '";
// ]]></script>
<title>'
$context['page_title'], '</title>';

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/print.css?fin11" media="print" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// YSHOUT HERE
global $boardurl;
echo '
<script src="'
,$boardurl,'/yshout/js/prototype.js" type="text/javascript"></script>
<script src="'
,$boardurl,'/yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="'
,$boardurl,'/yshout/js/behaviour.js" type="text/javascript"></script>
<script src="'
,$boardurl,'/yshout/js/domFunction.js" type="text/javascript"></script>
<script type="text/javascript">

var myfunc = new domFunction(function()
{
'
,empty($options['collapse_header']) ? 'loadChat();':'','
}, { "yshout":"id"});
var board_url = "'
$boardurl'";

</script>
<script src="'
,$boardurl,'/yshout/js/yshout.js?Jul222007" type="text/javascript"></script>
<script type="text/javascript">var shoutFile = "home.txt";</script>
<style type="text/css">
#yshout {
font-size: 10px;
}
#yshout p {
margin: 0 0 0; /* Top Bottom Linespacing */
}
.shout-invalid {
background: #FFFDD1;
}
#yshout fieldset {
border: none;
}
#yshout em {
font-style: normal;
}
#yshout p {
line-height: 1;
margin-top: 0;
}
#yshout {
overflow: hidden;
}
#yshout .shout-timestamp {
font-weight: normal; 
color: #FF9900;
}
#yshout .adminlink {
font-size: 6pt;
color: #141414;
}
#forum-name, #shout-text, #shout-button {
font-size: 9px;
margin: 0;
padding: 0;
}
#yshout #forum-name {
color: #666666;
width: 70px;
margin-right: 5px;
}
#yshout #shout-text {
color: #000000;
width: 310px;
margin-right: 5px;
}
#yshout #shout-button {
width: 55px;
}
#shouts .owner a {
color: #F00;
}
#shouts .moderator a {
color: #00F;
}
</style>'
;

// YSHOUT END

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name'], ' - RSS" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?board=' $context['current_board'] . '.0" />';

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '

<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = '
, empty($options['collapse_header']) ? 'false' 'true'';

function shrinkHeader(mode)
{'
;

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";

// YSHOUT HERE
document.getElementById("yshout").style.display = mode ? "none" : "";
if(!mode)
{
loadChat();
}
// YSHOUT END

current_header = mode;
}
// ]]></script>'
;

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = '
, empty($options['collapse_header_ic']) ? 'false' 'true'';

function shrinkHeaderIC(mode)
{'
;

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>
<head>
<script type="text/javascript" language="JavaScript" src="'
,$boardurl,'/mymod/animatedcollapse.js"></script>
</head>
<body>'
;

}

echo '
<div class="tborder" '
$context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' '''>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">'
;

if (empty($settings['header_logo_url']))


echo '
</td>
<td align="center" class="catbg">
<img src="'
$settings['images_url'], '/smflogo.gif" style="margin: 1px;" alt="" />
</td>
</tr>
</table>'
;


// display user name
echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr>'
;

if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> '
$txt['hello_member_ndt'], ' <b>'$context['user']['name'] , '</b></span>
</td>'
;

// display the time
echo '
<td class="titlebg2" height="32" align="right">
<span class="smalltext">' 
$context['current_time'], '</span>';

// this is the upshrink button for the user info section
echo '
<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="'
$settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' 'upshrink2.gif''" alt="*" title="'$txt['upshrink_description'], '" align="bottom" style="margin: 0 1ex;" /></a>
</td>
</tr>
<tr id="upshrinkHeader"'
, empty($options['collapse_header']) ? '' ' style="display: none;"''>
<td valign="top" colspan="2">
<table width="100%" class="bordercolor" cellpadding="8" cellspacing="1" border="0" style="margin-top: 1px;">
<tr>'
;

if (!empty($context['user']['avatar']))
echo '
<td class="windowbg" valign="middle">'
$context['user']['avatar']['image'], '</td>';

echo '
<td colspan="2" width="100%" valign="top" class="windowbg2"><span class="middletext">'
;

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<a href="'
$scripturl'?action=unread">'$txt['unread_since_visit'], '</a> <br />
<a href="'
$scripturl'?action=unreadreplies">'$txt['show_unread_replies'], '</a><br />';

}
// Otherwise they're a guest - send them a lovely greeting...
else
echo $txt['welcome_guest'];

// Now, onto our second set of info, are they logged in again?
if ($context['user']['is_logged'])
{
// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<b>'
$txt[616], '</b><br />';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
'
$context['unapproved_members'] == $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="'$scripturl'?action=viewmembers;sa=browse;type=approve">'$context['unapproved_members'] == $txt['approve_member'] : $context['unapproved_members'] . ' ' $txt['approve_members'], '</a> '$txt['approve_members_waiting'], '<br />';

// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
'
$txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
// YSHOUT HERE
echo '

<br /><b>Shout Box</b><br /><br />



<div id="yshout"'
, empty($options['collapse_header']) ? '>' ' style="display: none;">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';

                    


// YSHOUT END

echo ' </span>';
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo ' </span>
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/sha1.js"></script>

<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '" class="middletext" style="margin: 3px 1ex 1px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
<select name="cookielength">
<option value="60">'
$txt['smf53'], '</option>
<option value="1440">'
$txt['smf47'], '</option>
<option value="10080">'
$txt['smf48'], '</option>
<option value="43200">'
$txt['smf49'], '</option>
<option value="-1" selected="selected">'
$txt['smf50'], '</option>
</select>
<input type="submit" value="'
$txt[34], '" /><br />
<span class="middletext">'
$txt['smf52'], '</span>
<input type="hidden" name="hash_passwrd" value="" />
</form>'
;
}

echo '
</td>
</tr>
</table>
</td>
</tr>
</table>'
;

echo '
<table id="upshrinkHeader2"'
, empty($options['collapse_header']) ? '' ' style="display: none;"'' width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>'
;

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<td width="90%" class="titlebg2">
<span class="smalltext"><b>'
$txt[102], '</b>: '$context['random_news_line'], '</span>
</td>'
;
echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">
<form action="'
$scripturl'?action=search2" method="post" accept-charset="'$context['character_set'], '" style="margin: 0;">
<a href="'
$scripturl'?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>
<input type="text" name="search" value="" style="width: 190px;" />&nbsp;
<input type="submit" name="submit" value="'
$txt[182], '" style="width: 11ex;" />
<input type="hidden" name="advanced" value="0" />'
;

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="'
$context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd['
$context['current_board'], ']" value="'$context['current_board'], '" />';

echo '
</form>
</td>
</tr>
</table>
</div>'
;


// Show the menu here, according to the menu sub template.
template_menu();


// The main content should go here.
echo '
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">'
;
}

function 
template_main_below()
{
global $context$settings$options$scripturl$txt;

echo '
</div>'
;

// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '

<div id="footerarea" style="text-align: center; padding-bottom: 1ex;'
$context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' width: 100%;' '''">
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function smfFooterHighlight(element, value)
{
element.src = smf_images_url + "/" + (value ? "h_" : "") + element.id + ".gif";
}
// ]]></script>
<table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">
<tr>
<td width="28%" valign="middle" align="'
, !$context['right_to_left'] ? 'right' 'left''">
<a href="http://www.mysql.com/" target="_blank"><img id="powered-mysql" src="'
$settings['images_url'], '/powered-mysql.gif" alt="'$txt['powered_by_mysql'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
<a href="http://www.php.net/" target="_blank"><img id="powered-php" src="'
$settings['images_url'], '/powered-php.gif" alt="'$txt['powered_by_php'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
</td>
<td valign="middle" align="center" style="white-space: nowrap;">
'
theme_copyright(), '
</td>
<td width="28%" valign="middle" align="'
, !$context['right_to_left'] ? 'left' 'right''">
<a href="http://validator.w3.org/check/referer" target="_blank"><img id="valid-xhtml10" src="'
$settings['images_url'], '/valid-xhtml10.gif" alt="'$txt['valid_xhtml'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img id="valid-css" src="'
$settings['images_url'], '/valid-css.gif" alt="'$txt['valid_css'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
</td>
</tr>
</table>'
;

// Show the load time?
if ($context['show_load_time'])
echo '
<span class="smalltext">'
$txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'], '</span>';

// This is an interesting bug in Internet Explorer AND Safari. Rather annoying, it makes overflows just not tall enough.
if (($context['browser']['is_ie'] && !$context['browser']['is_ie4']) || $context['browser']['is_mac_ie'] || $context['browser']['is_safari'] || $context['browser']['is_firefox'])
{
// The purpose of this code is to fix the height of overflow: auto div blocks, because IE can't figure it out for itself.
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA['
;

// Unfortunately, Safari does not have a "getComputedStyle" implementation yet, so we have to just do it to code...
if ($context['browser']['is_safari'])
echo '
window.addEventListener("load", smf_codeFix, false);

function smf_codeFix()
{
var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

for (var i = 0; i < codeFix.length; i++)
{
if ((codeFix[i].className == "code" || codeFix[i].className == "post" || codeFix[i].className == "signature") && codeFix[i].offsetHeight < 20)
codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + "px";
}
}'
;
elseif ($context['browser']['is_firefox'])
echo '
window.addEventListener("load", smf_codeFix, false);
function smf_codeFix()
{
var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

for (var i = 0; i < codeFix.length; i++)
{
if (codeFix[i].className == "code" && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0))
codeFix[i].style.overflow = "scroll";
}
}'
;
else
echo '
var window_oldOnload = window.onload;
window.onload = smf_codeFix;

function smf_codeFix()
{
var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

for (var i = codeFix.length - 1; i > 0; i--)
{
if (codeFix[i].currentStyle.overflow == "auto" && (codeFix[i].currentStyle.height == "" || codeFix[i].currentStyle.height == "auto") && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0 || codeFix[i].className == "code"))
codeFix[i].style.height = (codeFix[i].offsetHeight + 36) + "px";
}

if (window_oldOnload)
{
window_oldOnload();
window_oldOnload = null;
}
}'
;

echo '
// ]]></script>'
;
}

echo '
</div>'
;

// The following will be used to let the user know that some AJAX process is running
echo '
<div id="ajax_in_progress" style="display: none;'
$context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' '''">'$txt['ajax_in_progress'], '</div>
'
;
if (!defined('_VALID_MOS')){
echo'
</body></html>'
;
}
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context$settings$options;

echo '<div class="nav" style="font-size: smaller; margin-bottom: 2ex; margin-top: 2ex;">';

// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Show the link, including a URL if it should have one.
echo '<b>'$settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '" class="nav">' $tree['name'] . '</a>' $tree['name'], '</b>';

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo '&nbsp;>&nbsp;';
}

echo '</div>';
}

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context$settings$options$scripturl$txt$modSettings;

// Work out where we currently are.
$current_action 'home';
if (in_array($context['current_action'], array('admin','managegames''arcadesettings''arcadecategory''ban''boardrecount''cleanperms''detailedversion''dumpdb''featuresettings''featuresettings2''findmember''maintain''manageattachments''manageboards''managecalendar''managesearch''membergroups''modlog''news''optimizetables''packageget''packages''permissions''pgdownload''postsettings''regcenter''repairboards''reports''serversettings''serversettings2''smileys''viewErrorLog''viewmembers')))
$current_action 'admin';
if (in_array($context['current_action'], array('gallery','arcade','tagged','search''downloads''admin''calendar''profile''mlist''register''login''help''pm')))
$current_action $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action 'search';

if ($context['current_action'] == 'googlemap')
$current_action 'googlemap';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' 'profile' 'admin';

// Begin SMFShop code
if ($context['current_action'] == 'shop')
$current_action 'shop';
if (in_array($context['current_action'], array('shop_general''shop_items_add''shop_items_edit''shop_cat''shop_inventory''shop_restock''shop_usergroup')))
$current_action 'admin';
// End SMFShop code

// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first 'last';
$last 'first';
}
else
{
$first 'first';
$last 'last';
}

// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' 
$first '">&nbsp;</td>';

// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'home' 'active_back' 'back' '">
<a href="http://www.risorsedirete.com/index.php">' 
HOME '</a>
</td>' 
$current_action == 'home' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

    
// Show the [forum] button.
   
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
            <td valign="top" class="maintab_' 
$current_action == 'home' 'active_back' 'back' '">
               <a href="'
$scripturl'">' $txt[103] , '
            </td>' 
$current_action == 'home' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'help' 'active_back' 'back' '">
<a href="'
$scripturl'?action=help">' $txt[119] , '</a>
</td>' 
$current_action == 'help' '<td class="maintab_active_' $last '">&nbsp;</td>' '';
        echo (
$current_action == 'arcade' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'arcade' 'active_back' 'back' '">
<a href="'
$scripturl'?action=arcade">' $txt['arcade'] , '</a>

</td>' 
$current_action == 'arcade' '<td class="maintab_active_' $last '">&nbsp;</td>' '';
    
// How about the [search] button?
if ($context['allow_search'])
echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'search' 'active_back' 'back' '">
<a href="'
$scripturl'?action=search">' $txt[182] , '</a>
</td>' 
$current_action == 'search' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// How about the [download] button?
if ($context['allow_search'])
echo ($current_action == 'downloads' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'downloads' 'active_back' 'back' '">
<a href="'
$scripturl'?action=downloads">Download' '</a>
</td>' 
$current_action == 'downloads' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'admin' 'active_back' 'back' '">
<a href="'
$scripturl'?action=admin">' $txt[2] , '</a>
</td>' 
$current_action == 'admin' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'profile' 'active_back' 'back' '">
<a href="'
$scripturl'?action=profile">' $txt[79] , '</a>
</td>' 
$current_action == 'profile' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'pm' 'active_back' 'back' '">
<a href="'
$scripturl'?action=pm">' $txt['pm_short'] , ' '$context['user']['unread_messages'] > '[<strong>'$context['user']['unread_messages'] . '</strong>]' '' '</a>
</td>' 
$current_action == 'pm' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// The [calendar]!
if ($context['allow_calendar'])
echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'calendar' 'active_back' 'back' '">
<a href="'
$scripturl'?action=calendar">' $txt['calendar24'] , '</a>
</td>' 
$current_action == 'calendar' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Google Maps Mod
if (($modSettings['googleMapsEnable']) && (allowedTo('googleMap_view')))
echo ($current_action == 'googlemap' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'googlemap' 'active_back' 'back' '">
<a href="'
$scripturl'?action=googlemap">' $txt['googleMap'] , '</a>
</td>' 
$current_action == 'googlemap' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

//Begin SMFShop code
//loadLanguage("shop");
echo ($current_action == 'shop' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'shop' 'active_back' 'back' '">
<a href="'
$scripturl'?action=shop">Shop</a>
</td>' 
$current_action == 'shop' '<td class="maintab_active_' $last '">&nbsp;</td>' '';
//END SMFShop code

// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'mlist' 'active_back' 'back' '">
<a href="'
$scripturl'?action=mlist">' $txt[331] , '</a>
</td>' 
$current_action == 'mlist' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// the [SMF Gallery] button
if ($context['allow_smfgallery_view'])
echo ($current_action == 'gallery' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'gallery' 'active_back' 'back' '">
<a href="'
$scripturl'?action=gallery">' $txt['smfgallery_menu']  , '</a>
</td>' 
$current_action == 'gallery' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// The [GoogleTagged] Button
echo ($current_action == 'tagged' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'tagged' 'active_back' 'back' '">
<a href="'
$scripturl'?action=tagged">' $txt['googletagged']  , '</a>
</td>' 
$current_action == 'tagged' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// the [Downloads System] button
if ($context['allow_downloads_view'])
echo ($current_action == 'downloads' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'downloads' 'active_back' 'back' '">
<a href="'
$scripturl'?action=downloads">' $txt['downloads_menu']  , '</a>
</td>' 
$current_action == 'downloads' '<td class="maintab_active_' $last '">&nbsp;</td>' '';



// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'login' 'active_back' 'back' '">
<a href="'
$scripturl'?action=login">' $txt[34] , '</a>
</td>' 
$current_action == 'login' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'register' 'active_back' 'back' '">
<a href="'
$scripturl'?action=register">' $txt[97] , '</a>
</td>' 
$current_action == 'register' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'logout' 'active_back' 'back' '">
<a href="'
$scripturl'?action=logout;sesc='$context['session_id'], '">' $txt[108] , '</a>
</td>' 
$current_action == 'logout' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// The end of tab section.
echo '
<td class="maintab_' 
$last '">&nbsp;</td>
</tr>
</table>'
;

}

?>

Tricks


l.uca

thank you so much for smiley.php, but can you help me about finder the file in index.template.php, becouse for me there isn't thanks more

nneonneo

@l.uca: Just look for
$txt['yshout_loading']
and add the prescribed code after the </div> which follows this snippet.

@Tricks: I think I have been dispensing bad advice. I believe that I have finally tracked down this bug, thanks to your tip. Set board_url to "". Then, in yshout/js/yshout.js, change
var yshout_php=(board_url?board_url+'/':'')+'yshout/yshout.php';
to
var yshout_php=(board_url?board_url:'')+'/yshout/yshout.php';
and that should fix it. This will definitely be added to 1.12, but at the downside of me taking a little while longer to post it.
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!

l.uca

I have this error :
Template Parse Error!
There was a problem loading the /Themes/default/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Parse error: syntax error, unexpected '<' in .../Themes/default/index.template.php on line 365
356:       }
357: // YSHOUT HERE
358:       echo '
359:                      360:                <br /><b>Shout Box</b><br /><br />
361:                362:
363:       364:                <div id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
365:                     <div class="smalltext" style="padding-left:25px;"><a href="javascript:collapse1.slidedown()">Open Smiley</a> | <a href="javascript:collapse1.slideup()">Close</a>';
366:                      require('mymod/smiley.php');
367:                      loadSmileys();
368:                   echo '
369:                      <div id="smiley_pic">';


So, i find the code:
<div id="yshout"', empty($options['collapse_header']) ? '>' : ' style="display: none;">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';

and after i past this:
<div class="smalltext" style="padding-left:25px;"><a href="javascript:collapse1.slidedown()">Open Smiley</a> | <a href="javascript:collapse1.slideup()">Close</a>';
require('mymod/smiley.php');
loadSmileys();
echo '
<div id="smiley_pic">';
printSmileys('shout_form','shout_text');
echo '
</div>
<script type="text/javascript">
//Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
var collapse1=new animatedcollapse("smiley_pic", 1000, false)
</script>
</div>



I don't know??????????? Where is the error?

nneonneo

Find
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
(line 364)
and remove the '; at the very end.
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!

l.uca

Thank you very much nneonneo, now i see the smaileys in my shout, but when i click it dont read, sure i insert the code to yshout.php in error position this is my code now can you check it please thank again  ;D ;D

my yshout.php:

<div class="smalltext" style="padding-left:25px;"><a href="javascript:collapse1.slidedown()">Open Smiley</a> | <a href="javascript:collapse1.slideup()">Close</a>';
require('mymod/smiley.php');
loadSmileys();
echo '
<div id="smiley_pic">';
printSmileys('shout_form','shout_text');
echo '
</div>
<script type="text/javascript">
//Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
var collapse1=new animatedcollapse("smiley_pic", 1000, false)
</script>
</div>

nneonneo

What you posted isn't yshout/yshout.php.
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!

l.uca

I'm sorry  :-[ :-[ :-[ :-[

is this :

<?php

// Version 1.11

// Editable Options (see yshout/js/yshout.js for more options)

// Set the maximum amount of lines to be displayed at a time

$max_lines 12;



// Sets the directory to which to log

$logDir "chats";



// Should we use GZip compression? If you are having trouble with the shoutbox, set this to false.

$gzipCompression=true;



// Guest usage. Set to false if you don't want guests to use the shoutbox: they will not be able to read it or post to it.

$allowGuests=true;



// Guest usage for posting. Set to false if you don't want to let guests post to the shoutbox; if allowGuests is on, they will still see it.

$allowGuestsPost=true;



// Automatic Guest Usernames: should they be able to choose their own usernames?

// Set to some string (a prefix) if you want to disable guest choice of username

// Set to false if you want to allow guests to choose a username

$autoGuestName=false;//'guest-';



// Command options.

// If this is set to false, all typed commands are disabled.

// Admin functions, via admin links, are still available.

$allowCommands=true;



// If this is set to false, guests will be denied access to commands.

$guestCommands=true;



// How long should the script wait for the chats to update? (in seconds)

// If this is set to 0 the script will not wait at all,

// but this will be very detrimental to performance.

// Make sure this is less than the maximum script execution time

// on your server, or the shoutbox will never update.

$updateTimeout=20;



// User-defined array of commands to block.

// Example: $bannedCommands=Array('/impersonate');

// Note that since SMF recognizes /me by default, it can't be blocked.

$bannedCommands=Array();



// How many characters will be permitted in each shout.

$maxShoutChars=125;



// How many characters will be permitted in the username.

// This does not apply to SMF registered usernames.

$maxUsernameChars=25;



/* Documentation

Functions

Command Implementation:

doMsg(string $msg)

Causes the shoutbox to be replaced with $msg until they

use /return (useful for making error messages, etc.)

processCommand(string $text)

Process an admin command. If this function fails to find

a match, it defaults to the user commands.

processUserCommand(string $text)

Process a user command. This function attempts to match

against all known commands. If a valid command match

isn't found, the function will return false and the

shout ("command") will be displayed as a regular shout.

makeShout(string $text)

Produce a shout as if it was from the current user, but

having only a datestamp (and no profile link, etc)

help(string $command - default '')

Allows users to get help on a command. Use <arg> to

denote required arguments and [arg] to denote optional

ones. Note that all <> must be entered as &lt; and &gt;

or they will not work.

Make sure to add an entry in this function for any new

commands.

Shouting:

checkDir(string $logDir)

Check the target directory to make sure it exists.

checkName(string $chatFile)

Check the filename for invalidities.

readChat(string $chatFile,string $logDir)

Dump the contents of the chat file to the client. If the

client is viewing a special message or command, then

readChat simply executes that command or prints the

message back on screen (this command/message is stored

in $_SESSION['readingCmd'])

truncateChat(string $chatFile,string $logDir,integer $max_lines)

Move the first line of a file from the chat file to the

history as long as the chat file exceeds the set

maximum.

writeLine(string $chatFile, string $logDir, string $newText, array $user)

Write a shout to the chat file. $user is an SMF user

session array which determines the username and rank of

the poster.

writeBanList()

Write the current ban list to _banlist.php which is

require'd by this script at the beginning. This allows

for "dynamic" ban lists.

history()

Show the history file in a neat, formatted HTML style.

preg_timeformat(array $matches)

Function used to replace matched <timeval=[UNIX time offset]> with formatted times

as per SMF's timeformat function. Called through preg_replace_callback.

Important Globals

$_SESSION

readingCmd

The command (if it starts with /) or the message to be

read back to the user instead of the normal shoutbox

stuff.

$_GET

n

Used by the history() function to determine the # of

history lines to output.

help

If this is set, the shoutbox will output a full HTML

help message (using help()). Use as a standalone page.

history

If this is set, the shoutbox will output a full HTML

history page (with history()). Use as a standalone page.

banid

For the administrator's ban link: this is passed as the user

ID of the member to be banned.

delete

For deleting shouts; this is a string in the form

datecode | ip (this is the format used in the <em title>

unban

Username/identifier to unban (used by /banlist)

file

File to read for history and delete functions (will be checked)

$_POST

file

Chat file to use. Will be checked for bad characters.

reqtype

What function to carry out (shout, refresh, init)

shout

If reqtype is shout, then this is the shout to be made.

$_SERVER

REMOTE_ADDR

Used for $ip to determine their IP address.

Global Variables

$ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post

Ban variables. _ips or _names is the ban criteria (IP

address or username) while _readpost or _post is the ban

severity (banned from reading+posting or just posting)

$chatFile,$logDir

These determine the location of the chat file.

$chatFile comes from $_POST['file'] while $logDir is hardcoded.

$user

SMF user data array, gleaned from ssi_welcome as a hack.

This determines a lot of things about the user (like the username and status)

$max_lines

Maximum number of lines to have in the shoutbox. Used by truncateChat.

$ip

User's IP address. Gathered from $_SERVER['REMOTE_ADDR'].

$reqType

Request type; see $_POST['reqtype'].

Super-Duper Command Implementation

To add a command, first decide whether this command is *user* or

*admin/mod* level.

The general format of a command is "/command <reqargs>

[optargs]".

Commands are processed in processCommand or processUserCommand.

The former is for admin/mod commands, and the latter is for users.

Processing begins by parsing the args and then running through a

long switch/case block. In this block, you will add your command code.

Your code should begin with a "case '/commandname':"  and end with a

return true; statement.

The two things you will have access to locally are $args and

$cmd. $args is a string containing all the arguments passed, and $cmd is

the exact command used. For example, with the command "/foo bar baz",

$cmd will be "/foo" and $args will be "bar baz". This will be handled by

the "case '/foo':" statement.

Globally, any of the superglobals are available, plus any

globals. All globals are declared already so there is no need to declare

them on your own.

To make a message appear on the client's shoutbox, set the

variable $_SESSION['readingCmd'] to $text (which is the main argument

for the processing function). This causes the exact text of the command

to be reparsed every time the user requests the shoutbox data, and your

information will be returned instead of the regular shouts.

Alternately, the doMsg function allows you to automatically set

a message that will stay up until they use /return.

Remember that whenever your function needs to exit, it must do

so with "return true;" so that the calling function will know not to

"shout" the command.

*/



session_start();

require(
dirname(__FILE__) . "/../SSI.php");

require_once(
$sourcedir '/Subs-Post.php');

require(
"_banlist.php");

if (!isset(
$maintenance)) $maintenance=false;

$defaultEncoding=(empty($context['character_set']) ? 'ISO-8859-1' $context['character_set']);

header('Content-type: text/html; charset='.$defaultEncoding);



$ip $_SERVER['REMOTE_ADDR'];

$max_lines+=1;

$user=ssi_welcome('nothing'); // ssi_welcome only does something IF the parameter is 'echo'; otherwise the user data is returned!

loadUserSettings();

loadTheme();

ssi_logOnline('nothing'); // don't want echo, so just use a nonexistant output method

function preg_timeformat($matches)

{

// format: <timeval=(value)>

return timeformat(intval($matches[1]));

}



if (
in_array($ip$ban_ips_readpost) || in_array($user['username'], $ban_names_readpost) || in_array($user['name'], $ban_names_readpost))

die($txt['yshout_banned']); // exit;



if (!$user['is_logged'])

{

if(!$allowGuests)

die($txt['yshout_no_guests']);

if($autoGuestName!==false)

$user['username']=$user['name']=$autoGuestName.substr(md5($ip),0,4);

elseif(isset($_POST['username']))

$_COOKIE['username']=$user['username']=$user['name']=$_POST['username'];

elseif(isset($_COOKIE['username']))

$user['username']=$user['name']=$_COOKIE['username'];

}



// Do not edit below this line unless you know what you are doing

if(isset($_GET["history"]))

{

history();

exit;

}



if(isset(
$_GET["help"]))

{

help();

exit;

}



if(isset(
$_GET['banid']))

{

if (!isset($_GET['mode']))

{

global $boardurl;

doMsg(<<<EOF

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<base href="
$boardurl/">

<head>

<meta http-equiv="content-type" content="text/html; charset=
$defaultEncoding" />

<title>
{$txt['yshout_ban_conf']}</title>

</head>

<body>

<h1>
{$txt['yshout_select_mode']}</h1>

<a href="javascript:ajaxGet('banid=
{$_GET['banid']}&amp;mode=rp');">{$txt['yshout_rp']}</a>

<br />

<a href="javascript:ajaxGet('banid=
{$_GET['banid']}&amp;mode=p');">{$txt['yshout_p']}</a>

</body>

</html>

EOF

);

exit;

}

if ($user['is_admin'] || $user['is_mod'])

{

if(!is_numeric($_GET['banid']))

{

// guest banning?

// ban by IP, since that's what will be listed for banning...



$oldread=isset($_SESSION['readingCmd'])?$_SESSION['readingCmd']:NULL;

doBan('ban_ips_',$_GET['mode'],$_GET['banid']);

if($oldread==NULL) unset($_SESSION['readingCmd']);

else $_SESSION['readingCmd']=$oldread;

exit;

}

if(loadMemberData(Array($_GET['banid']),false,'minimal')===false)

{

doMsg($txt['yshout_error'].$txt['yshout_no_user']);

exit;

}

$oldread=isset($_SESSION['readingCmd'])?$_SESSION['readingCmd']:NULL;

doBan('ban_names_',$_GET['mode'],$user_profile[$_GET['banid']]['memberName']);

if($oldread==NULL) unset($_SESSION['readingCmd']);

else $_SESSION['readingCmd']=$oldread;

}

exit;

}



if(isset(
$_GET['delete']))

{

if ($user['is_admin'] || $user['is_mod'])

{

global $logDir,$chatFile;

$chatFile=isset($_GET['file'])?$_GET['file']:"home.txt";

$chatFile checkName($chatFile);

$chatPath "$logDir/$chatFile";

$fileContents '';



if (file_exists($chatPath))

$fileContents file_get_contents($chatPath);

$fileContents=preg_replace('/<p[^>]*><em title="'.str_replace('|','\|',$_GET['delete']).'">.+\n/','',$fileContents);

$handle fopen($chatPath"w");

fputs($handle$fileContents);

fclose($handle);

echo $txt['yshout_del_success'];

}

exit;

}



if(isset(
$_GET['unban']))

{

if ($user['is_admin'] || $user['is_mod'])

{

$oldread=isset($_SESSION['readingCmd'])?$_SESSION['readingCmd']:NULL;

doBan('ban_'.$_GET["type"].'s_','u',$_GET['unban']);

if($oldread==NULL) unset($_SESSION['readingCmd']);

else $_SESSION['readingCmd']=$oldread;

}

exit;

}



if(!isset(
$_POST["file"]) || !isset($_POST["reqtype"]))

die($txt['yshout_no_action']);



$chatFile checkName($_POST["file"]);

$reqType $_POST["reqtype"];



switch(
$reqType) {

case "init":

if($gzipCompressionob_start("ob_gzhandler"); // GZip for everything BUT the 404 header

echo '<a href="javascript:goTo(\'file=',checkName($chatFile),'&amp;history\')">',$txt['yshout_history'],'</a>&nbsp;<a href="javascript:goTo(\'help\')">',$txt['yshout_commands'],'</a>';

if($user['is_admin'] || $user['is_mod'])

{

echo '&nbsp;<a href="javascript:history_number=prompt(\'How far back?\',200);if(history_number){goTo(\'file=',checkName($chatFile),'&amp;history&amp;n=\'+history_number)}else{void(0)}">',$txt['yshout_exthistory'],'</a>';

if(!isset($_COOKIE['yShout_hideadmlinks']))

echo '&nbsp;<a href="javascript:set_cookie(\'yShout_hideadmlinks\',\'true\',3600*24*365);delete_cookie(\'yShout_open\');loadChat();">',$txt['yshout_hide'],$txt['yshout_admlinks'],'</a>';

else

echo '&nbsp;<a href="javascript:delete_cookie(\'yShout_hideadmlinks\');delete_cookie(\'yShout_open\');loadChat();">',$txt['yshout_show'],$txt['yshout_admlinks'],'</a>';

echo '&nbsp;<a href="javascript:autoShout(\'/return\');">',$txt['yshout_return'],'</a>';

}

echo '<div id="shouts">';

echo readChat($chatFile$logDir);

echo '</div>';

if (in_array($ip$ban_ips_post) || in_array($user['username'], $ban_names_post) || in_array($user['name'], $ban_names_post))

echo '

<form id="shout-form" name="shout_form" action="#">

<fieldset>

<input id="forum-name" style="color: #666666;" maxlength="'
,$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />

<input id="shout-text" style="color: #666666;" maxlength="'
,$maxShoutChars,'" value="',$txt['yshout_p_banned'],'" type="text" disabled="true" />

<input id="shout-button" type="button" value="'
,$txt['yshout_banned'],'" disabled="true" />

</fieldset>

</form>'
;

elseif (!$user['is_admin'] && !$user['is_mod'] && $maintenance!==false)

echo '

<form id="shout-form" name="shout_form" action="#">

<fieldset>

<input id="forum-name" style="color: #666666;" maxlength="'
,$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />

<input id="shout-text" style="color: #666666;" maxlength="'
,$maxShoutChars,'" value="',$maintenance,'" type="text" disabled="true" />

<input id="shout-button" type="button" value="'
,$txt['yshout_maintenance'],'" disabled="true" />

</fieldset>

</form>'
;

elseif (!$user['is_logged'] && !$allowGuestsPost)

echo '

<form id="shout-form""shout_form" action="#">

<fieldset>

<input id="forum-name" style="color: #666666;" maxlength="'
,$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />

<input id="shout-text" style="color: #666666;" maxlength="'
,$maxShoutChars,'" value="',$txt['yshout_no_guests'],'" type="text" disabled="true" />

<input id="shout-button" type="button" value="'
,$txt['yshout_maintenance'],'" disabled="true" />

        <input id="shout-text" style="color: #666666;" maxlength="125" value="" type="text" name="shout_text" />
</fieldset>

</form>'
;

else

{

echo '<form id="shout-form" name="shout_form" action="#">

<fieldset>'
;

if (!$user['is_logged'] && $autoGuestName===false)

echo '

<input id="forum-name" style="color: #666666;" maxlength="'
,$maxUsernameChars,'" value="',$user['name'], '" type="text" name="shout_text" />';

else

echo '

<input id="forum-name" style="color: #666666;" maxlength="'
,$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />';

echo '

<input id="shout-text" style="color: #666666;" maxlength="'
,$maxShoutChars,'" value="" type="text" />

<input id="shout-button" type="button" value="'
,$txt['yshout_shout_button'],'" />

</fieldset>

</form>'
;

}

if($gzipCompressionob_end_flush();

break;



case "shout":

if (in_array($ip$ban_ips_post) || in_array($user['username'], $ban_names_post) || in_array($user['name'], $ban_names_post)) break;

if (!$user['is_logged'] && !$allowGuestsPost) break;

if (!$user['is_admin'] && !$user['is_mod'] && $maintenance!==false) break;

$shoutText $_POST["shout"];

if($shoutText[0]=='/' && $allowCommands)

{

if($user['is_admin'] || $user['is_mod'])

{

if(processCommand($shoutText)) break;

}

elseif($user['is_logged'] || $guestCommands)

{

$shoutText=substr($shoutText,0,$maxShoutChars);

if(processUserCommand($shoutText)) break;

}

}

$shoutName $user['name']; //$_POST["name"];



writeLine($chatFile$logDir$shoutText$user);

truncateChat($chatFile$logDir$max_lines);

refreshChats(true);

break;



case "refresh":

refreshChats(false);

break;

case "autoshout":

if($user['is_admin'] || $user['is_mod'])

processCommand($_POST["shout"]);

break;

}



function 
doMsg($msg)

{

echo $msg// tell user

$_SESSION['readingCmd']=$msg// make sure user keeps seeing this message; see readChat

}



function 
processCommand($text) {

global $reqType$chatFile$logDir$max_lines$ip$user$bannedCommands$txt$maintenance;

global $ban_ips_readpost$ban_ips_post$ban_names_readpost$ban_names_post;

if($text[0]!='/') return false// no slash, no service

$data=explode(' ',$text,2); // "2" means to make the first "word" separated from the rest

$cmd=$data[0]; // first word is the cmd. No cmds can have spaces, duh!

$args=(isset($data[1])?$data[1]:''); // are there even any arguments?

if(in_array($cmd,$bannedCommands)) return false;

switch($cmd) {

case "/clear":

for($a=0;$a<$max_lines;$a+=1truncateChat($chatFile,$logDir,0); // truncate $max_lines times, each approaching 0. This assumes that there aren't any shouts past $max_lines.

return true;

case "/return"// I'm done reading

unset($_SESSION['readingCmd']);

echo readChat($chatFile$logDir);

return true;

case "/lock":

if ($args=='')

{

doMsg($txt['yshout_error'].$txt['yshout_lock_arg_error']);

return true;

}

if($maintenance !== false)

doMsg(sprintf($txt['yshout_lock_changed'],$args));

else

doMsg(sprintf($txt['yshout_lock_success'], $args));

$maintenance $args;

writeBanList();

return true;

case "/unlock":

if($maintenance === false)

{

doMsg($txt['yshout_error'].$txt['yshout_unlock_already']);

return true;

}

$maintenance false;

writeBanList();

doMsg($txt['yshout_unlock_success']);

return true;

case "/banlist"// who's banned?

$_SESSION['readingCmd']=$text;

$temp=Array();

echo '<table>

<caption>'
,$txt['yshout_banlist_caption'],'</caption>';

echo '<tr><td>',$txt['yshout_ip_bans'],$txt['yshout_rp'],'</td><td>';

$temp=Array();

foreach($ban_ips_readpost as $i)

$temp[]="<a href=\"javascript:ajaxGet('unban=$i&type=ip');\">$i</a>";

echo implode($temp,','),'</tr>';

echo '<tr><td>',$txt['yshout_ip_bans'],$txt['yshout_p'],'</td><td>';

$temp=Array();

foreach($ban_ips_post as $i)

$temp[]="<a href=\"javascript:ajaxGet('unban=$i&type=ip');\">$i</a>";

echo implode($temp,','),'</tr>';

echo '<tr><td>',$txt['yshout_username_bans'],$txt['yshout_rp'],'</td><td>';

$temp=Array();

foreach($ban_names_readpost as $i)

$temp[]="<a href=\"javascript:ajaxGet('unban=$i&type=name');\">$i</a>";

echo implode($temp,','),'</tr>';

echo '<tr><td>',$txt['yshout_username_bans'],$txt['yshout_p'],'</td><td>';

$temp=Array();

foreach($ban_names_post as $i)

$temp[]="<a href=\"javascript:ajaxGet('unban=$i&type=name');\">$i</a>";

echo implode($temp,','),'</tr>';

echo '</table>';

return true;

case "/ban"// need to be more specific!

doMsg($txt['yshout_error'].$txt['yshout_ban_type_error']);

return true;

case "/banuser"// go away, we don't like you!

case "/banip":

$type=($cmd=='/banip')?'ban_ips_':'ban_names_'// prefixes for vars

$ar=explode(' ',$args,2); // true argument array. the "2" ensures that we cut only once: mode can't have spaces but user can.

if(count($ar)!=2// whoops: only one argument?

{

doMsg($txt['yshout_error'].$txt['yshout_ban_mode_error']);

return true;

}

$mode=$ar[0]; // set up vars

$id=$ar[1];

doBan($type,$mode,$id);

return true;

case "/impersonate"// lets pwn some n00bs!

// <user> [userlevel] [ip] [userid] /[shout text]

$slashpos=strpos($args,' /'); // use ' /' as a separator, so we can see how many args came before

if($slashpos===false// no shout? invalid formatting?

{

doMsg($txt['yshout_error'].$txt['yshout_imp_slash_error']);

return true;

}

$shout=substr($args,$slashpos+2);

$ar=explode(' ',substr($args,0,$slashpos));

$name='';

$userlevel=0;

$userid=0;



switch(count($ar)) // how many args did we get?

{

case 0// no args--what are you doing?

doMsg($txt['yshout_error'].$txt['yshout_imp_uname_error']);

return true;

case 4// reverse order to save space: we just set them from the back!

$userid=intval($ar[3]);

case 3:

$ip=$ar[2]; // corrupt the global >:D

case 2:

$userlevel=intval($ar[1]);

case 1:

$name=html_entity_decode($ar[0]);

break;

default:

doMsg($txt['yshout_error'].$txt['yshout_imp_max4_error']); // just so they know that we only have 4 params

return true;

}

$ip.='.'// to set off the impersonated msgs

$fakeuser=array('id'=>$userid,'name'=>$name,'is_admin'=>($userlevel==2)?1:0,'is_mod'=>($userlevel==1)?1:0,'is_logged'=>($userlevel==-1)?0:1); // fake SMF $user array

writeLine($chatFile,$logDir,$shout,$fakeuser); // do it, write the line

truncateChat($chatFile$logDir$max_lines); // make sure to scroll it, or bad things will happen

echo readChat($chatFile$logDir); // update admin's display

return true;

default: // it wasn't a command, n00b!

return processUserCommand($text);

}

return false;

}



function 
processUserCommand($text) {

global $reqType$chatFile$logDir,$max_lines$ip,$ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$user,$bannedCommands,$func;

if($text[0]!='/') return false// no slash, no service

$data=explode(' ',$text,2); // "2" means to make the first "word" separated from the rest

$cmd=$data[0]; // first word is the cmd. No cmds can have spaces, duh!

$args=(isset($data[1])?$data[1]:''); // are there even any arguments?

if(in_array($cmd,$bannedCommands)) return false;

switch($cmd) {

case "/help":

if(empty($args)) help();

elseif($args[0]!='/'help('/'.$args);

else help($args);

$_SESSION['readingCmd']=$text;

return true;

case "/return"// I'm done reading

unset($_SESSION['readingCmd']);

echo readChat($chatFile$logDir);

return true;

case "/pi":

$s_pi='141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609';

$n=5;

if($args!=''$n=intval($args);

$res=($n==0)?"PI IS EXACTLY 3!":'3.'.substr($s_pi,0,$n-1).(substr($s_pi,$n-1,1)+(substr($s_pi,$n,1)>=5?1:0));

// all that nasty little bit does is add the first n-2 chars, then add the last digit and increment if rounding is necessary.

makeShout($res);

return true;

case "/me":

checkDir($logDir);



$chatFile checkName($chatFile);



$chatPath "$logDir/$chatFile";



$newText $args.' ';

$newText $func['htmlspecialchars'](stripslashes($newText), ENT_QUOTES);

$newText str_replace(array("[list]","[center]","[left]","[right]"),"",$newText); // kill some BBCode--these tags are useless and can be abused

preparsecode($newText); // gah, sanitize input!!

$newText parse_bbc($newText); // w00t!

censorText($newText);

$shoutName=$user['name'];

$userID=$user['id'];

$writeText "<p><em title=\"".time()." | $ip\"><span class=\"shout-timestamp\">[<timeval=".time().">]</span><font color=\"red\"> * $shoutName</em> $newText</p></font>\n";

$handle fopen($chatPath"a");

if($handle===false) die("File error (processing /me); aborted");

$failcount=0;

while( !flock($handleLOCK_EX) ) // just IN CASE two ppl write to it at once

{

usleep(50000);

$failcount++;

if($failcount 20) die('Write error (processing /me); aborted'); // one second

}

fwrite($handle$writeText);

flock($handleLOCK_UN);

fclose($handle);

truncateChat($chatFile$logDir$max_lines);

refreshChats(true);

return true;

default:

return false;

}

return false;

}



function 
doBan($type,$mode,$id)

{

global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$txt;

switch($mode)

{

case 'u'// nice guy

$r=$type.'readpost'// need to search both ban arrays. Search this one first...

$index=array_search($id,$$r); // where is my little banned user?

if($index===false)

{

$r=$type.'post'// ...and this one second on failure.

$index=array_search($id,$$r);

if($index===false// whoops, both searches failed!

{

doMsg($txt['yshout_error'].'Couldn\'t find user to unban!');

return false;

}

}

array_splice($$r,$index,1); // cut the 1 element loose with splice. $$r is used because $r is the string variable denoting the target array.

doMsg("Success: unbanned $id.");

break;

case 'rp':

array_push(${$type.'readpost'},$id); // easy, huh!

doMsg("Success: banned $id from reading and posting.");

break;

case 'p':

array_push(${$type.'post'},$id);

doMsg("Success: banned $id from posting.");

break;

default:

doMsg($txt['yshout_error']."Invalid mode $mode! Use only 'u', 'rp' or 'p'!");

return false;

}

writeBanList(); // write the final report

return true;

}



function 
makeShout($text) {

global $chatFile,$logDir,$user,$max_lines;



writeLine($chatFile$logDir$text$user);

truncateChat($chatFile$logDir$max_lines);

refreshChats(true);

}



function 
refreshChats($force=false) {

global $chatFile,$logDir,$user,$max_lines,$gzipCompression,$updateTimeout;

$time=file_exists("$logDir/$chatFile")?filemtime("$logDir/$chatFile"):0;

$start_time=time();

session_write_close(); // so that future session requests succeed

while(!$force && (time() - $start_time $updateTimeout) && $time && ($time==filemtime("$logDir/$chatFile")))

{

sleep(1);

clearstatcache();

}

if($gzipCompressionob_start("ob_gzhandler");

echo readChat($chatFile$logDir);

if($gzipCompressionob_end_flush();

}



function 
checkDir($logDir) {

if (!is_dir($logDir))

mkdir($logDir);

}



function 
checkName($chatFile) {

$ret $chatFile;

$ret str_replace('/'''$chatFile);

return $ret;

}



function 
readChat($chatFile$logDir) {

global $user;

if(isset($_SESSION['readingCmd']))

{

$c=$_SESSION['readingCmd'];

if($c[0]!='/') echo $c// doMsg was used. Don't use doMsg with a slash unless you know what you're doing ;)

else

{

if($user['is_admin'] || $user['is_mod']) processCommand($_SESSION['readingCmd']); // execute the same command so the user gets to keep reading the message w/o interruption.

else processUserCommand($_SESSION['readingCmd']);

}

return ' ';

}

$chatFile checkName($chatFile);

$chatPath "$logDir/$chatFile";



$chatText "";



if (file_exists($chatPath))

$chatText file_get_contents($chatPath);

if ($user['is_admin'] || $user['is_mod'])

{

if (!isset($_COOKIE['yShout_hideadmlinks']))

{

$chatText preg_replace('/<em title="(\\d+) \| ([^"]+)"><span class="shout-timestamp">\[<timeval=(\d+)>\]<\/span> ([^<])/','<em title="\\1 | \\2"><span class="shout-timestamp">[<timeval=\\3>]</span>&nbsp;<a href="javascript:ajaxGet(\'banid=\\2\')"><span class="adminlink">ban</span></a>&nbsp;\\4',$chatText);

$chatText preg_replace('/<em title="(\\d+ \| [^"]+)"><span class="shout-timestamp">\[<timeval=(\d+)>\]<\/span>/','<em title="\\1"><span class="shout-timestamp">[<timeval=\\2>]</span>&nbsp;<a href="javascript:ajaxGet(\'file='.$chatFile.'&amp;delete=\\1\')"><span class="adminlink">del</span></a>&nbsp;',$chatText);

$chatText preg_replace('/<a href="index\.php\\?action=profile;u=(\\d+)">/','<a href="javascript:ajaxGet(\'banid=\\1\')"><span class="adminlink">ban</span></a>&nbsp;<a href="index.php?action=profile;u=\\1">',$chatText);

}

}

else

{

$chatText preg_replace('/<em title="(\d+) \| [0-9.]+"><span class="shout-timestamp">/','<em title="\\1 | logged"><span class="shout-timestamp">',$chatText);

}

$chatText=preg_replace_callback("/<timeval=(\d+)>/","preg_timeformat",$chatText);

return $chatText.' '// hack: totally empty responses can break some browsers

}



// truncateChat function based on one written by Travis Roman (http://mapleglobal.mine.nu/)



function truncateChat($chatFile$logDir$max_lines) {

$chatFile checkName($chatFile);

$chatPath "$logDir/$chatFile";

$fileContents '';



if (file_exists($chatPath))

$fileContents file_get_contents($chatPath);



$lines explode("\n"$fileContents);



if(count($lines) > $max_lines) {

$newText substr($fileContentsstrpos($fileContents"\n") + 1);

$handle fopen($chatPath"w");

fputs($handle$newText);

fclose($handle);



  // History

$oldText substr($fileContents0strpos($fileContents"\n") + 1);

$handle fopen("$logDir/history.$chatFile""a");

fputs($handle$oldText);

fclose($handle);

}

}



function 
writeLine($chatFile$logDir$newText$user) {

global $ip,$func;

checkDir($logDir);



$chatFile checkName($chatFile);



$chatPath "$logDir/$chatFile";



// $ip = $_SERVER['REMOTE_ADDR']; // impersonate >:D

$newText .= " ";

$newText $func['htmlspecialchars'](stripslashes($newText), ENT_QUOTES);

$newText str_replace(array("[list]","[center]","[left]","[right]"),"",$newText); // kill some BBCode--these tags are useless and can be abused

preparsecode($newText); // gah, sanitize input!!

$newText parse_bbc($newText); // w00t!

censorText($newText);

// $newText = preg_replace("(http:\/\/(.+?) )is", "<a href=\"http://$1\" target=\"_blank\">http://$1</a> ", $newText);



$p_class "";



if($user['is_admin']) $p_class ' class="owner"';

if($user['is_mod']) $p_class ' class="moderator"';

if(!$user['is_logged']) $p_class ' class="guest"';

$shoutName=$user['name'];

$userID=$user['id'];

$writeText="<p$p_class><em title=\"".time()." | $ip\"><span class=\"shout-timestamp\">[<timeval=".time().">]</span> ";

if($user['is_logged'])

$writeText.="<a href=\"index.php?action=profile;u=$userID\">$shoutName</a>";

else

$writeText.="$shoutName";

$writeText.=":</em> $newText</p>\n";

$handle fopen($chatPath"a");

$failcount=0;

if($handle===false) die('File error (writeLine); aborted');

while( !flock($handleLOCK_EX) ) // just IN CASE two ppl write to it at once

{

usleep(50000);

$failcount++;

if($failcount 20) die('Write error (writeLine); aborted'); // one second

}

fwrite($handle$writeText);

flock($handleLOCK_UN);

fclose($handle);

}



function 
help($command='')

{

global $user,$defaultEncoding,$txt;

$cmdlist=$txt['yshout_cmdlist'];



$cmdlistadmin=$txt['yshout_cmdlistadmin'];

if($user['is_admin'] || $user['is_mod'])

$cmdlist=array_merge($cmdlist,$cmdlistadmin);

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<base href="/advforums/">

<head>

<meta http-equiv="content-type" content="text/html; charset=<?php echo $defaultEncoding ?>" />

<title><?php echo $txt['yshout_cmd_reference']; ?></title>

</head>

<body>

<?php

if($command=='')

{

echo '<h1>',$txt['yshout_shoutbox'],' ',$txt['yshout_commands'],'</h1>';

foreach($cmdlist as $cmd=>$desc)

{

echo "$cmd$desc<br />\n";

}

}

else

{

if(isset($cmdlist[$command])) echo "$command{$cmdlist[$command]}<br />\n";

else echo "$command not found";

}

?>


</body>

</html>

<?php

}



function 
writeBanList() // generate our dynamic ban list, which is 'require'd at the start of this script

{

global $ban_ips_readpost,$ban_ips_post,$ban_names_readpost,$ban_names_post,$maintenance;

$writeText "<?php\n"// php header

$writeText .= '$ban_ips_readpost = '.var_export($ban_ips_readpost,true).";\n"// bans

$writeText .= '$ban_ips_post = '.var_export($ban_ips_post,true).";\n";

$writeText .= '$ban_names_readpost = '.var_export($ban_names_readpost,true).";\n";

$writeText .= '$ban_names_post = '.var_export($ban_names_post,true).";\n";

$writeText .= '$maintenance = '.var_export($maintenance,true).";\n";

$writeText .= '?>
'; // end tag

$handle = fopen("_banlist.php", "w");

if($handle===false) die('File error (writeBanList); aborted');

$failcount=0;

while( !flock($handle, LOCK_EX) ) // just IN CASE two ppl write to it at once

{

usleep(50000);

$failcount++;

if($failcount > 20) die('Write error (writeBanList); aborted'); // one second

}

fwrite($handle, $writeText);

flock($handle, LOCK_UN);

fclose($handle);

}



function history()

{

global $logDir,$boardurl,$gzipCompression,$defaultEncoding,$txt;

checkDir($logDir);







$chatPath = "$logDir/$chatFile";

$n=250;

if(isset($_GET['n'])) $n=intval($_GET['n']); // integers only!

if($gzipCompression) ob_start("ob_gzhandler");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<base href="<?php echo $boardurl,'/'?>">

<head>

<meta http-equiv="content-type" content="text/html; charset=<?php echo $defaultEncoding ?>" />

<title><?php echo $txt['yshout_shoutbox'],' ',$txt['yshout_history']; ?></title>

<style type="text/css">

#yshout {

font-size: 10px;

}

#yshout p {

margin: 0 0 0; /* Top Bottom Linespacing */

}

.shout-invalid {

background: #FFFDD1;

}

#yshout fieldset {

border: none;

}

#yshout em {

font-style: normal;

}

#yshout p {

line-height: 1;

margin-top: 0;

}

#yshout {

overflow: hidden;

}

#yshout .shout-timestamp {

font-weight: normal;

color: #000;

}

a:link {

color: #476C8E;

}

#shouts .owner a {

color: #F00;

}

#shouts .moderator a {

color: #00F;

}

</style>

</head>

<body>

<h1><?php echo $txt['yshout_shoutbox'],' ',$txt['yshout_history']; ?></h1>

<div id="yshout">

<div id="shouts">

<?php

global $user;

require_once("class.tail.php");

$mytail = new tail("$logDir/history.$chatFile");

$mytail->setGrep(".*");

$mytail->setNumberOfLines($n);

$text=$mytail->output(PLAIN).file_get_contents("$logDir/$chatFile");

if(!($user['is_admin'] || $user['is_mod']))

$text preg_replace('/<em title="(\d+) \| [0-9.]+"><span class="shout-timestamp">/','<em title="\\1 | logged"><span class="shout-timestamp">',$text);

echo preg_replace_callback("/<timeval=(\d+)>/","preg_timeformat",$text);

?>


</div>

</div>

</body>

</html>

<?php

if(
$gzipCompressionob_end_flush();

exit;

}

?>



nneonneo

You've made some wrong edits to the section described.

Change
switch($reqType) {
case "init":
if($gzipCompression) ob_start("ob_gzhandler"); // GZip for everything BUT the 404 header
echo '<a href="javascript:goTo(\'file=',checkName($chatFile),'&amp;history\')">',$txt['yshout_history'],'</a>&nbsp;<a href="javascript:goTo(\'help\')">',$txt['yshout_commands'],'</a>';
if($user['is_admin'] || $user['is_mod'])
{
echo '&nbsp;<a href="javascript:history_number=prompt(\'How far back?\',200);if(history_number){goTo(\'file=',checkName($chatFile),'&amp;history&amp;n=\'+history_number)}else{void(0)}">',$txt['yshout_exthistory'],'</a>';
if(!isset($_COOKIE['yShout_hideadmlinks']))
echo '&nbsp;<a href="javascript:set_cookie(\'yShout_hideadmlinks\',\'true\',3600*24*365);delete_cookie(\'yShout_open\');loadChat();">',$txt['yshout_hide'],$txt['yshout_admlinks'],'</a>';
else
echo '&nbsp;<a href="javascript:delete_cookie(\'yShout_hideadmlinks\');delete_cookie(\'yShout_open\');loadChat();">',$txt['yshout_show'],$txt['yshout_admlinks'],'</a>';
echo '&nbsp;<a href="javascript:autoShout(\'/return\');">',$txt['yshout_return'],'</a>';
}
echo '<div id="shouts">';
echo readChat($chatFile, $logDir);
echo '</div>';
if (in_array($ip, $ban_ips_post) || in_array($user['username'], $ban_names_post) || in_array($user['name'], $ban_names_post))
echo '
<form id="shout-form" action="#">
<fieldset>
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />
<input id="shout-text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="',$txt['yshout_p_banned'],'" type="text" disabled="true" />
<input id="shout-button" type="button" value="',$txt['yshout_banned'],'" disabled="true" />
</fieldset>
</form>';
elseif (!$user['is_admin'] && !$user['is_mod'] && $maintenance!==false)
echo '
<form id="shout-form" action="#">
<fieldset>
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />
<input id="shout-text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="',$maintenance,'" type="text" disabled="true" />
<input id="shout-button" type="button" value="',$txt['yshout_maintenance'],'" disabled="true" />
</fieldset>
</form>';
elseif (!$user['is_logged'] && !$allowGuestsPost)
echo '
<form id="shout-form" action="#">
<fieldset>
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />
<input id="shout-text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="',$txt['yshout_no_guests'],'" type="text" disabled="true" />
<input id="shout-button" type="button" value="',$txt['yshout_maintenance'],'" disabled="true" />
</fieldset>
</form>';
else
{
echo '<form id="shout-form" action="#">
<fieldset>';
if (!$user['is_logged'] && $autoGuestName===false)
echo '
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" />';
else
echo '
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />';
echo '
<input id="shout-text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="" type="text" />
<input id="shout-button" type="button" value="',$txt['yshout_shout_button'],'" />
</fieldset>
</form>';
}
if($gzipCompression) ob_end_flush();
break;

to
switch($reqType) {
case "init":
if($gzipCompression) ob_start("ob_gzhandler"); // GZip for everything BUT the 404 header
echo '<a href="javascript:goTo(\'file=',checkName($chatFile),'&amp;history\')">',$txt['yshout_history'],'</a>&nbsp;<a href="javascript:goTo(\'help\')">',$txt['yshout_commands'],'</a>';
if($user['is_admin'] || $user['is_mod'])
{
echo '&nbsp;<a href="javascript:history_number=prompt(\'How far back?\',200);if(history_number){goTo(\'file=',checkName($chatFile),'&amp;history&amp;n=\'+history_number)}else{void(0)}">',$txt['yshout_exthistory'],'</a>';
if(!isset($_COOKIE['yShout_hideadmlinks']))
echo '&nbsp;<a href="javascript:set_cookie(\'yShout_hideadmlinks\',\'true\',3600*24*365);delete_cookie(\'yShout_open\');loadChat();">',$txt['yshout_hide'],$txt['yshout_admlinks'],'</a>';
else
echo '&nbsp;<a href="javascript:delete_cookie(\'yShout_hideadmlinks\');delete_cookie(\'yShout_open\');loadChat();">',$txt['yshout_show'],$txt['yshout_admlinks'],'</a>';
echo '&nbsp;<a href="javascript:autoShout(\'/return\');">',$txt['yshout_return'],'</a>';
}
echo '<div id="shouts">';
echo readChat($chatFile, $logDir);
echo '</div>';
if (in_array($ip, $ban_ips_post) || in_array($user['username'], $ban_names_post) || in_array($user['name'], $ban_names_post))
echo '
<form id="shout-form" name="shout_form" action="#">
<fieldset>
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />
<input id="shout-text" name="shout_text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="',$txt['yshout_p_banned'],'" type="text" disabled="true" />
<input id="shout-button" type="button" value="',$txt['yshout_banned'],'" disabled="true" />
</fieldset>
</form>';
elseif (!$user['is_admin'] && !$user['is_mod'] && $maintenance!==false)
echo '
<form id="shout-form" name="shout_form" action="#">
<fieldset>
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />
<input id="shout-text" name="shout_text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="',$maintenance,'" type="text" disabled="true" />
<input id="shout-button" type="button" value="',$txt['yshout_maintenance'],'" disabled="true" />
</fieldset>
</form>';
elseif (!$user['is_logged'] && !$allowGuestsPost)
echo '
<form id="shout-form" name="shout_form" action="#">
<fieldset>
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />
<input id="shout-text" name="shout_text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="',$txt['yshout_no_guests'],'" type="text" disabled="true" />
<input id="shout-button" type="button" value="',$txt['yshout_maintenance'],'" disabled="true" />

</fieldset>
</form>';
else
{
echo '<form id="shout-form" name="shout_form" action="#">
<fieldset>';
if (!$user['is_logged'] && $autoGuestName===false)
echo '
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" />';
else
echo '
<input id="forum-name" style="color: #666666;" maxlength="',$maxUsernameChars,'" value="',$user['name'], '" type="text" disabled="true" />';
echo '
<input id="shout-text" name="shout_text" style="color: #666666;" maxlength="',$maxShoutChars,'" value="" type="text" />
<input id="shout-button" type="button" value="',$txt['yshout_shout_button'],'" />
</fieldset>
</form>';
}
if($gzipCompression) ob_end_flush();
break;


Also (unrelated), it looks like there could be a bug in the code.
$writeText .= ?>'; // end tag
should be
$writeText .= '?>'; // end tag
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!

l.uca

OK THANK YOU it work wery well, so for the history there is a problem because if a guest digit www.site.com/forum/yshout/yshout.php?file=home.txt&history [nofollow] not only read the shout but can see all user ip, can you see for this (bug), thank you again for averythink  ;D ;D

nneonneo

As of 1.10 (and a few earlier versions) guests can no longer see IP addresses: all they get is
"1201288599 | logged" where 1201288599 is the time posted (reflected in the time stamp) and "logged" is where the IP address *would* go if the user had permission to see it (admins, mods)
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!

RobXduffy

#1576
Anyway to Block certain Member groups from even seeing the shoutbox?

nneonneo

Find
// YSHOUT HERE
echo '
<br /><b>Shout Box</b><br /><br />

After the // YSHOUT HERE line, add
$loadit = true;
if(loadMemberData(Array($context['user']['id']),false,'profile')!==false)
{
global $user_profile;
$membergroups=explode(',', $user_profile[$context['user']['id']]['additionalGroups']);
$membergroups[]=$user_profile[$context['user']['id']]['ID_GROUP'];
$membergroups[]=$user_profile[$context['user']['id']]['ID_POSTGROUP'];
if (count(array_intersect(array(3,4), $membergroups)) > 0)
$loadit=false;
}
else $loadit=false;
if($loadit)

where 3,4 are the membergroups not allowed to see it.
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!

PipeRain

Hello!

I have used the 1.06 version of the shoutbox for some time and was just recently informed by my hosting company that its causing undue server load.

When I went to uninstall using the "Package Parser" to see what edits needed to be perfomed, I was given the following error : "ERROR: The package-info.xml file is invalid!".

What do I need to do to uninstall v. 1.06 to upgrade to current?

Thanks for the halp!

nneonneo

#1579
There are only two things that need to be done.

1) In Themes/default/index.template.php, find // YSHOUT HERE. There are three of them, followed by matching // YSHOUT END comments. Remove the code between each pair -- the first is a block of JS includes and CSS, the second is Javascript and the third is a div (echo '<div id="yshout"...)
2) Delete the yshout folder, or, if you wish to save the chats, back up the yshout/chats folder and put it back after upgrading.

EDIT: To be safe, the third step is to remove the stuff in Themes/default/languages/Modifications.english.php between "// ---- Begin modification - nneonneo's Shoutbox ----" and "// ---- End modification - nneonneo's Shoutbox ----"
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!

Advertisement: