XMB Forum Software

ShoutBox?

nathan - 7-27-2014 at 08:08 PM

I looked on the hacks list and I didn't see a shoutbox hack, so, I'm wondering if anyone is willing to make one?

lottos - 7-27-2014 at 09:36 PM

There is an old one from Funforum (below) that is unlikely to work with the current XMB version.

An option is to grab a simple php based shoutbox and place it on your forum,


Code:
<?php require './header.php'; if ( X_SADMIN && isset($_GET['action']) ) { if ( $_GET['action'] == 'install' ) { $db->query("CREATE TABLE IF NOT EXISTS `".$tablepre."member_shouts` ( `id` int(10) NOT NULL auto_increment, `msgto` int(6) NOT NULL default '0', `msgfrom` int(6) NOT NULL default '0', `message` text NOT NULL, `private` char(3) NOT NULL default '', `msgline` int(10) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM "); $db->query("ALTER TABLE $table_members ADD `shoutop` SET('on', 'off', 'u2u') NOT NULL default 'u2u'"); exit("Installation Finished"); } } loadtemplates('member_profile_shout'); $sid = safeInt(fetchFromRequest('sid', X_GET|X_POST)); $memid = safeInt(fetchFromRequest('memid', X_GET|X_POST)); $message = fetchFromRequest('message', X_POST); if ( X_GUEST ) { $html = '<font class="tablerow">'.$lang['tabg_006'].'</font>'; eval("echo (\"".template('member_profile_shout')."\");"); exit; } if ( $action == "del" && $sid > 0 ) { if ( $memid == $self['uid'] || X_ADMIN ) { $where = (X_ADMIN ? '' : "msgto=$memid AND "); $db->query("DELETE FROM ".$tablepre."member_shouts WHERE $where id=$sid"); } } $query = $db->query("SELECT uid, username, shoutop FROM $table_members WHERE uid=$memid"); $checkmem = $db->fetch_array($query); if ( empty($checkmem['uid']) ) { $html = '<font class="tablerow">'.$lang['tabg_007'].'</font>'; eval("echo (\"".template('member_profile_shout')."\");"); } elseif( $checkmem['shoutop'] == "off" ) { $html = '<font class="tablerow">'.$lang['tabg_008'].'</font>'; eval("echo (\"".template('member_profile_shout')."\");"); } elseif ( !is_null($message) ) { //Submit Message $private = (fetchFromRequest('private', X_POST) == 'yes') ? 'yes' : 'no'; $message = checkInput(addslashes($message), '', '', 'script', false); $db->query("INSERT INTO ".$tablepre."member_shouts (message, msgto, msgfrom, private, msgline) VALUES ('$message', '$memid', ".$self['uid'].", '$private', $onlinetime)"); if ( $checkmem['shoutop'] == "u2u" ) { require ROOT.'include/u2u.inc.php'; $message = str_replace('*uid*', $checkmem['uid'], str_replace('*boardurl*', $SETTINGS['boardurl'], $lang['tabg_009'])); $usr = $checkmem['username']; db_u2u_insert( $usr, "The Staff", 'incoming', $usr, 'Inbox', $lang[tabg_015], $message, 'no', 'yes', 'no' ); } redirect('member.shoutbox.php?memid='.$memid, 0); } else { smcwcache(); validateTpp(); $html = ''; $thatbg = $THEME['altbg1']; if (isset($page)) { if ( $page < 1 ) { $page = 1; } $start_limit = ($page-1) * $self['ppp']; } else { $start_limit = 0; $page = 1; } $query = $db->query("SELECT m.username, t.* FROM ".$tablepre."member_shouts t, $table_members m WHERE (m.uid=t.msgfrom AND t.msgto='$memid')"); $total = $db->result($query, 0); $db->free_result($query); $mpurl = 'member.shoutbox.php?memid='.$memid; $multipage = ''; $multipage = multi($total, $self['tpp'], $page, $mpurl); $html = '<form action="member.shoutbox.php?memid='.$checkmem['uid'].'" method="POST"> <table border="0" width="100%"> <tr><td colspan="2"> <input type="text" name="message" maxlength="255" style="width: 100%;" /> '.$multipage.'</td></tr> <tr><td align="left"> <input type="submit" name="submit" class="submit" value="'.$lang['tabg_014'].'" /> </td><td class="tablerow" align="right"> '.$lang['tabg_013'].'<input type="checkbox" name="private" value="yes" /> </td></tr> </table> </form>'; $query = $db->query("SELECT m.username, t.* FROM ".$tablepre."member_shouts t, $table_members m WHERE (m.uid=t.msgfrom AND t.msgto='$memid') ORDER BY t.id DESC LIMIT $start_limit, ".$self['tpp']); while($S = $db->fetch_array($query)) { $S['message'] = postify($S['message'], 'no', 'yes', 'yes', 'no', 'yes', 'no'); $S['message'] = stripslashes($S['message']); if( $S['private'] == "yes" ) { if ( $memid == $self['uid'] || X_ADMIN || $S['msgfrom'] == $self['uid'] ) { $S['message'] = $S['message'].$lang['tabg_012']; } else { $S['message'] = ''; } } if( $memid == $self['uid'] || X_ADMIN ) { $delmess = ' <a title="'.$lang['tabg_010'].'" href="member.shoutbox.php?action=del&amp;sid='.$S['id'].'&amp;memid='.$memid.'">'.$lang['tabg_011'].'</a>'; } else { $delmess = ''; } if ( $S['message'] <> '' ) { $thatbg = ( $thatbg == $THEME['altbg2'] ? $THEME['altbg1'] : $THEME['altbg2']); $html .= '<div class="tablerow" style="background-color:'.$thatbg.'; width:100%; padding-top:2px; padding-bottom:2px"><a target="_top" href="member.php?action=viewpro&amp;uid='.$S['msgfrom'].'">'.$S['username'].'</a>: '.$S['message'].$delmess.'</div>'; } } eval("echo (\"".template('member_profile_shout')."\");"); } exit; ?>

nathan - 7-28-2014 at 01:07 AM

Because I'm a noob, can you tell me what I would do with the php script once I have it?

lottos - 8-2-2014 at 06:01 AM

I'd suggest looking from this post onwards as it has everything you need:
http://forums.xmbforum2.com/viewthread.php?tid=776793#pid137...