shoutbox problem

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

NICOI69
Greenhorn
Greenhorn
Posts: 15
Joined: Sun Jun 11, 2006 3:33 am

ok test and password testing
is now working i had email verifacation on
NICOI69
Greenhorn
Greenhorn
Posts: 15
Joined: Sun Jun 11, 2006 3:33 am

##############################################################
## MOD Title: Shoutbox MOD
## MOD Author: battye < (N/A) > (N/A) http://www.online-scrabble.com
## MOD Description: Add a cool shoutbox to your index!
##
## MOD Version: 0.1.3
##
## Installation Level: Easy
## Installation Time: 10 Minutes (According to EasyTIME: http://www.cmxmods.net/easytime.php)
##
## Files To Edit:
## admin_board.php
## board_config_body.tpl
## constants.php
## functions.php
## index.php
## index_body.tpl
## lang_admin.php
## lang_main.php
##
## Included Files: (3)
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes: I've always wanted a shoutbox, and I was bored, so WANT + BORED = MOD
## Run shoutbox_install.php to install the shoutbox table. Make the changes to the files first though.
##
## To upgrade to 0.1.3 overwrite shoutbox.php, and re-apply changes to lang_main.php, index.php and index_body.tpl
##############################################################
## MOD History:
##
## 2005-10-26 - Version 0.0.1
## - As with all initial releases, there is a tonne more to be added
##
## 2005-10-27 - Version 0.0.2
## - bbCode & Smilies
##
## 2005-10-27 - Version 0.0.3
## - Delete feature
##
## 2005-12-03 - Version 0.0.4
## - Fixed delete feature
##
## 2005-12-06 - Version 0.0.5
## - Word censor, fixed delete issue again
##
## 2005-12-13 - Version 0.0.6
## - Date added, and authors name is a link (except for Guests). Thanks to hmartin for code snippets :-)
##
## 2005-12-16 - Version 0.1.0
## - Admin panel area. More to be added in the future to it.
##
## 2006-01-03 - Version 0.1.1
## - Added link to index from the main shoutbox page for convenience.
##
## 2006-02-09 - Version 0.1.2
## - Fixed HTML issue, added refresh button.
##
## 2006-05-08 - Version 0.1.3
## - Fixed bbCode
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ COPY ]------------------------------------------
#

copy shoutbox.php to shoutbox.php
copy shoutbox_install.php to shoutbox_install.php
copy templates/subSilver/shoutbox_body.tpl to templates/subSilver/shoutbox_body.tpl

#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#

Run shoutbox_install.php to run the SQL.

#
#-----[ OPEN ]------------------------------------------
#

admin/admin_board.php

#
#-----[ FIND ]------------------------------------------
#

$sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : "";
$sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : "";

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Shoutbox
$guest_shoutbox_yes = ( $new['guest_shoutbox'] ) ? "checked=\"checked\"" : "";
$guest_shoutbox_no = ( !$new['guest_shoutbox'] ) ? "checked=\"checked\"" : "";

$shoutbox_rows = intval($new['rows_shoutbox']);
// End

#
#-----[ FIND ]------------------------------------------
#

"L_AUTOLOGIN_TIME_EXPLAIN" => $lang['Autologin_time_explain'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Shoutbox MOD
"L_SHOUTBOX" => $lang['Shoutbox'],
"L_SHOUTBOX_EXPLAIN" => $lang['Shoutbox_explain'],
"L_GUEST_SHOUTBOX" => $lang['Shoutbox_open_to_guests'],
"L_SHOUTBOX_ROWS" => $lang['Shoutbox_rows'],
// End ..

#
#-----[ FIND ]------------------------------------------
#

"SAVEBOX_LIMIT" => $new['max_savebox_privmsgs'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Shoutbox
"SHOUTBOX_GUEST_YES" => $guest_shoutbox_yes,
"SHOUTBOX_GUEST_NO" => $guest_shoutbox_no,
"SHOUTBOX_ROWS" => $shoutbox_rows,
// End

#
#-----[ OPEN ]------------------------------------------
#

includes/constants.php

#
#-----[ FIND ]------------------------------------------
#

define('DEBUG', 1); // Debugging off

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Shoutbox MOD
define('SHOUTBOX_TABLE', $table_prefix.'shoutbox');

#
#-----[ OPEN ]------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------
#

// Behave as per HTTP/1.1 spec for others
header('Location: ' . $server_protocol . $server_name . $server_port . $script_name . $url);
exit;
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

function sb_next_id()
{
global $db;

$sql = "SELECT shoutbox_id FROM " . SHOUTBOX_TABLE . " ORDER BY shoutbox_id DESC LIMIT 1";

if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Cannot get id data', '', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);

return ($row['shoutbox_id'] + 1);
}

function sb_convert_id($id)
{
global $db;

$sql = "SELECT username FROM " . USERS_TABLE . " WHERE user_id = '" . intval($id) . "'";

if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Cannot get userdata', '', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);

return $row['username'];
}

#
#-----[ OPEN ]------------------------------------------
#

index.php

#
#-----[ FIND ]------------------------------------------
#

$template->set_filenames(array(
'body' => 'index_body.tpl')
);

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Start the shoutbox
include($phpbb_root_path . '/includes/bbcode.'.$phpEx);

// Auth
if( $board_config['guest_shoutbox'] == 0 && !$userdata['session_logged_in'] ) // Not open to guests
{
$template->assign_block_vars('shout_no_guest', array() );
}

if( $board_config['guest_shoutbox'] == 1 || $userdata['session_logged_in'] )
{
$shoutbox_limit = $board_config['rows_shoutbox'];
$shoutbox_sql = "SELECT * FROM " . SHOUTBOX_TABLE . " ORDER BY shoutbox_id DESC LIMIT $shoutbox_limit";

if ( !$shoutbox_result = $db->sql_query($shoutbox_sql) )
{
message_die(GENERAL_ERROR, 'Could not query shoutbox table', '', __LINE__, __FILE__, $shoutbox_sql);
}

if( $db->sql_numrows($shoutbox_result) < 1 )
{
$template->assign_block_vars('no_shout_row', array());
}

while( $shoutbox_row = $db->sql_fetchrow($shoutbox_result) )
{
$shoutbox_author = sb_convert_id($shoutbox_row['shoutbox_author']);
$shoutbox_text = $shoutbox_row['shoutbox_text'];

$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

if( count($shoutbox_text) )
{
$shoutbox_text = preg_replace($orig_word, $replacement_word, $shoutbox_text);
}

$template->assign_block_vars('shout_row', array(
"L_DELETE" => ( $userdata['user_level'] == ADMIN ) ? '<a href="' . append_sid('shoutbox.'.$phpEx.'?mode=delete&shout_id=' . intval($shoutbox_row['shoutbox_id']) . '') . '">' . $lang['Delete'] . '</a>' : '',
"U_DATETIME" => $shoutbox_row['shoutbox_datetime'],
"U_AUTHOR" => ( $shoutbox_row['shoutbox_author'] != ANONYMOUS ) ? "<a href='" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $shoutbox_row['shoutbox_author'] . "") . "'>" . sb_convert_id($shoutbox_row['shoutbox_author']) . "</a>" : $lang['Guest'],
"U_SHOUT" => smilies_pass(bbencode_second_pass($shoutbox_text, ''))));
}

$db->sql_freeresult($shoutbox_result);
}

$template->assign_vars(array(
'F_FORM' => append_sid("shoutbox.$phpEx?mode=submit"),
'F_REFRESH' => append_sid("index.$phpEx"),

'U_SHOUT_LINK' => append_sid("shoutbox.$phpEx"),

'L_NO_GUESTS' => $lang['Shoutbox_no_guests'],
'L_NO_SHOUTS' => $lang['Shoutbox_no_posts'],
'L_SUBMIT' => $lang['Submit'],
'L_REFRESH' => $lang['Shoutbox_refresher'],
'L_SHOUTBOX' => $lang['Shoutbox'],
'L_MAKE_A_SHOUT' => $lang['Shoutbox_make']));

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#

//
// Configuration
//

#
#-----[ AFTER, ADD ]------------------------------------------
#

$lang['Shoutbox'] = 'Shoutbox';
$lang['Shoutbox_explain'] = 'Here you can adjust all settings regarding the shoutbox';
$lang['Shoutbox_open_to_guests'] = 'Should the Shoutbox be open to Guests?';
$lang['Shoutbox_rows'] = 'How many shouts should be displayed on the index?';
$lang['Shoutbox_refresher'] = 'Refresh';

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

$lang['Board_disable'] = 'Sorry, but this board is currently unavailable. Please try again later.';

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Shoutbox Lang
$lang['Shoutbox'] = 'Shoutbox';
$lang['Shoutbox_refresh'] = 'Refresh';
$lang['Shoutbox_make'] = 'Make a Shout!';
$lang['Shoutbox_admin_delete_only'] = 'Only administrators can delete messages!';
$lang['Shoutbox_message_delete'] = 'The message was deleted successfully';
$lang['Shoutbox_table_made'] = 'Shoutbox table created successfully';
$lang['Shoutbox_no_guests'] = 'You must register in order to use the shoutbox!';

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<tr>
<th class="thHead" colspan="2">{L_COOKIE_SETTINGS}</th>
</tr>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<tr>
<th class="thHead" colspan="2">{L_SHOUTBOX}</th>
</tr>
<tr>
<td class="row2" colspan="2"><span class="gensmall">{L_SHOUTBOX_EXPLAIN}</span></td>
</tr>
<tr>
<td class="row1">{L_GUEST_SHOUTBOX}</td>
<td class="row2"><input type="radio" name="guest_shoutbox" value="1" {SHOUTBOX_GUEST_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="guest_shoutbox" value="0" {SHOUTBOX_GUEST_NO} /> {L_NO}</td>
</tr>
<tr>
<td class="row1">{L_SHOUTBOX_ROWS}</td>
<td class="row2"><input class="post" type="text" maxlength="5" size="2" name="rows_shoutbox" value="{SHOUTBOX_ROWS}" /></td>
</tr>

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
<tr>
<td align="left"><span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span></td>
<td align="right"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>

#
#-----[ AFTER, ADD ]------------------------------------------
#

<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="2" height="28" align="center"><span class="cattitle"><a href="{U_SHOUT_LINK}" class="cattitle">{L_SHOUTBOX}</a></span></td>
</tr>
<!-- BEGIN no_shout_row -->
<tr>
<td class="row1" colspan="2" align="center" valign="middle" width="100%">
<span class="gensmall">
<b>{L_NO_SHOUTS}</b>
</span>
</td>
</tr>
<!-- END no_shout_row -->
<!-- BEGIN shout_no_guest -->
<tr>
<td class="row1" colspan="2" align="center" valign="middle" width="100%">
<span class="gensmall">
<b>{L_NO_GUESTS}</b>
</span>
</td>
</tr>
<!-- END shout_no_guest -->
<!-- BEGIN shout_row -->
<tr>
<td class="row1" align="center" valign="middle" width="15%">
<span class="gensmall">
<b>{shout_row.U_AUTHOR}</b><br />
{shout_row.L_DELETE}
</span>
</td>

<td class="row2" align="left" width="85%">
<span class="gensmall">
&nbsp;{shout_row.U_DATETIME}: {shout_row.U_SHOUT}
</span>
</td>
</tr>
<!-- END shout_row -->
<tr>
<form action="{F_FORM}" method="post">
<td class="row3" colspan="2" align="center" width="100%">
<span class="gensmall">
<input type="text" name="shout" length="50" maxlength="255" /> <input type="submit" name="submit" value="{L_SUBMIT}" /> <input type="submit" name="submit" value="{L_REFRESH}" />
</span>
</td>
</form>
</tr>
</table>
<br />

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

NICOI69 wrote:ok test and password testing
is now working i had email verifacation on
Okay, where is the error? It looks fine to me.
Also, I can't see the shoutbox, did you install it on every template?
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
NICOI69
Greenhorn
Greenhorn
Posts: 15
Joined: Sun Jun 11, 2006 3:33 am

no just the subsilver also the reason it was working cause i deleted
message_die(GENERAL_ERROR, 'Could not query shoutbox table', '', __LINE__, __FILE__, $shoutbox_sql);
just to make it work
Post Reply