Current time: 10-19-2018, 09:52 AM
Hello There, Guest! Login Register


Shoutbox Code for Danzell
07-12-2012, 01:59 PM
Post: #1
Shoutbox Code for Danzell
PHP Code:
function myshoutbox_show_shouts($last_id 0){
 global 
$db$mybb$parser$charset$lang;
 
 
$perms myshoutbox_can_view();
 if (!
$perms || $perms === 2) return;
 
 require_once 
MYBB_ROOT.'inc/class_parser.php';
 
$parser = new postParser;
 
 
$last_id = (int)$last_id// not needed here since when we call the function it converts $last_id to int already

 
$query $db->write_query("SELECT s.*, u.username, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."mysb_shouts s 
 LEFT JOIN "
.TABLE_PREFIX."users u ON (u.uid = s.uid) 
 WHERE s.id>
{$last_id} ORDER by s.id DESC LIMIT {$mybb->settings['mysb_shouts_main']}");
 
 
// fetch results 
 
$messages "";
 
$entries 0;
 
$usernames_cache = array();
 while (
$row $db->fetch_array($query))
 {
 
$report "(<a id=\"report_".$row['id']."\" href=\"#shoutbox\" onclick=\"javascript: return ShoutBox.promptReason(".$row['id'].");\" style=\"cursor: pointer;\">{$lang->mysb_report_button}</a>) ";
 
 
$parser_options = array(
 
'allow_mycode' => $mybb->settings['mysb_allow_mycode'],
 
'allow_smilies' => $mybb->settings['mysb_allow_smilies'],
 
'allow_imgcode' => $mybb->settings['mysb_allow_imgcode'],
 
'allow_html' => $mybb->settings['mysb_allow_html'],
 
"allow_videocode" => $mybb->settings['mysb_allow_video'],
 
'me_username' => $row['username']
 ); 
 
 
$message $parser->parse_message($row['shout_msg'], $parser_options);
 
 
$find stripos($message"/pvt");
 if(
$find == && $find !== false)
 {
 
sscanf($message"/pvt %d"$userID);
 
$userID = (int)$userID;
 
$message str_replace("/pvt ".$userID." """$message);
 if (
$mybb->user['uid'] == intval($userID) || $mybb->user['uid'] == $row['uid'])
 {
 if (
$mybb->user['uid'] == intval($userID))
 {
 
$userName $mybb->user['username'];
 }
 else {
 
// Unfortunately, we do not have this username...let's check our cache, if it's not in cache, query it
 
if (!empty($usernames_cache[$userID]))
 {
 
$userName $usernames_cache[$userID];
 }
 else {
 
$userName $db->fetch_field($db->simple_select('users''username''uid=\''.$userID.'\''), 'username');
 
$usernames_cache[$userID] = $userName;
 }
 }
 
 
$message "<span style=\"background-color: #AF4300; font-weight: bold;\">{$lang->mysb_pvt_to} ".htmlspecialchars_uni($userName).": ".$message."</span>";
 
 
$row['username'] = format_name($row['username'], $row['usergroup'], $row['displaygroup']);
 
$extra = ($mybb->usergroup['cancp'] == "title='{$row[shout_ip]}'" "");
 
 
$username $row['username'];
 
$date_time my_date($mybb->settings['mysb_datetime'], $row['shout_date']);

 if (
myshoutbox_can_delete()) {
 
$delete "(<a href='#shoutbox' onclick='javascript: return ShoutBox.deleteShout({$row[id]}, 1,\"{$lang->mysb_delconfirm}\");'>{$lang->mysb_delete}</a>) ";
 if (
$row['hidden'] == "yes"){
 
$recover "(<a href='#shoutbox' onclick='javascript: return ShoutBox.recoverShout({$row[id]}, 1, \"{$lang->mysb_recconfirm}\");'>{$lang->mysb_recover}</a>) ";
 
$remove "(<a href='#shoutbox' onclick='javascript: return ShoutBox.removeShout({$row[id]}, 1, \"{$lang->mysb_remconfirm}\");'>{$lang->mysb_remove}</a>) ";
 }
 }
 else {
 
$delete '&nbsp;';
 
$recover '&nbsp;';
 
$remove '&nbsp;';
 }
 
 if (
myshoutbox_can_delete() && $row['hidden'] == "yes") { 
 $messages 
.= "<span style=\"font-size: {$mybb->settings['mysb_text_size']}px\">&raquo; <strong><span style=\"color: #FF0000\";>{$lang->mysb_deleted_info}</span></strong> &raquo; {$remove}{$recover}{$report}<a href='#' onClick=\"javascript: ShoutBox.pvtAdd(".$row['uid']."); return false;\" {$extra}>{$username}</a> - {$date_time} -- {$message}</span><br />\r\n";
 }
 elseif (
$row['hidden'] == "no"$messages .= "<span style=\"font-size: {$mybb->settings['mysb_text_size']}px\">&raquo; {$delete}{$recover}{$report}<span style=\"\"><a href='#' onClick=\"javascript: ShoutBox.pvtAdd(".$row['uid']."); return false;\" {$extra}>{$username}</a></span> - {$date_time} -- {$message}</span><br />\r\n";
 
 
$entries++;
 
 if (
$entries == 1) {
 
$maxid $row['id'];
 }
 }
 }
 else {
 
$row['username'] = format_name($row['username'], $row['usergroup'], $row['displaygroup']);
 
 
$extra = ($mybb->usergroup['cancp'] == "title='{$row[shout_ip]}'" "");
 
 
$username ''.$row['username'].'';
 
$date_time my_date($mybb->settings['mysb_datetime'], $row['shout_date']);

 if (
myshoutbox_can_delete()) {
 
$delete "(<a href='#shoutbox' onclick='javascript: return ShoutBox.deleteShout({$row[id]}, 1,\"{$lang->mysb_delconfirm}\");'>{$lang->mysb_delete}</a>) ";
 if (
$row['hidden'] == "yes"){
 
$recover "(<a href='#shoutbox' onclick='javascript: return ShoutBox.recoverShout({$row[id]}, 1, \"{$lang->mysb_recconfirm}\");'>{$lang->mysb_recover}</a>) ";
 
$remove "(<a href='#shoutbox' onclick='javascript: return ShoutBox.removeShout({$row[id]}, 1, \"{$lang->mysb_remconfirm}\");'>{$lang->mysb_remove}</a>) ";
 }
 }
 else {
 
$delete '&nbsp;';
 
$recover '&nbsp;';
 
$remove '&nbsp;';
 }
 
 if (
myshoutbox_can_delete() && $row['hidden'] == "yes") { 
 $messages 
.= "<span style=\"font-size: {$mybb->settings['mysb_text_size']}px\">&raquo; <strong><span style=\"color: #FF0000\";>{$lang->mysb_deleted_info}</span></strong> &raquo; {$remove}{$recover}{$report}<a href='#' onClick=\"javascript: ShoutBox.pvtAdd(".$row['uid']."); return false;\" {$extra}>{$username}</a> - {$date_time} -- {$message}</span><br />\r\n";
 }
 elseif (
$row['hidden'] == "no"$messages .= "<span style=\"font-size: {$mybb->settings['mysb_text_size']}px\">&raquo; {$delete}{$recover}{$report}<a href='#' onClick=\"javascript: ShoutBox.pvtAdd(".$row['uid']."); return false;\" {$extra}>{$username}</a> - {$date_time} -- {$message}</span><br />\r\n";
 
 
$entries++;
 
 if (
$entries == 1) {
 
$maxid $row['id'];
 }
 }
 }
 
 if (!
$maxid) {
 
$maxid $last_id;
 }
 
 echo 
"{$maxid}^--^{$entries}^--^{$messages}^--^{$chat_messages}";
 exit;


Here it is Danzell. Big Grin
Quote
07-12-2012, 02:48 PM (This post was last modified: 07-12-2012 02:53 PM by voteman.)
Post: #2
RE: Shoutbox Code for Danzell
i don`t think this is the code. can`t see the functions that get the shout

send me a link or the name of the shoutbox used

oh i didn`t see the other link xD

[Image: 312jpzt.jpg]
I saw weird stuff in that place last night. Weird, strange, sick, twisted, eerie, godless, evil stuff... and I want in.
Press any key to continue, where's the any key?
Quote
07-12-2012, 02:55 PM (This post was last modified: 07-12-2012 02:55 PM by ac3xx.)
Post: #3
RE: Shoutbox Code for Danzell
Ah, sorry. Link is here in case anyone else wants to look: http://forums.mybb-plugins.com/thread-1616.html
Quote
07-12-2012, 04:46 PM
Post: #4
RE: Shoutbox Code for Danzell
I thought that this would be a great idea, good job Danzell! Big Grin

Creator of Mini Bulletin

Website Developer

Module Developer for NWE/MCC

http://script47.tk
Quote
07-17-2012, 12:50 AM
Post: #5
RE: Shoutbox Code for Danzell
This might help. Big Grin http://forums.mybb-plugins.com/thread-16...l#pid51073
Quote
07-17-2012, 10:14 AM
Post: #6
RE: Shoutbox Code for Danzell
i`ve seen the link before but i can`t test to see if it works. with html i just need to save the webpage in the format and load it with a browser. but to the shoutbox thing i think i need the whole frame.

Gah.... this should be so easy =)) we need to add one of the codes in the jscript file to the shout recall function.
but i have no idea how...

[Image: 312jpzt.jpg]
I saw weird stuff in that place last night. Weird, strange, sick, twisted, eerie, godless, evil stuff... and I want in.
Press any key to continue, where's the any key?
Quote
07-19-2012, 08:36 PM (This post was last modified: 07-19-2012 08:46 PM by voteman.)
Post: #7
RE: Shoutbox Code for Danzell
kay i found the handler we can use to add the sound

onkeypress


god i really hate having to relearn all this stuff...:facepalm:

[Image: 312jpzt.jpg]
I saw weird stuff in that place last night. Weird, strange, sick, twisted, eerie, godless, evil stuff... and I want in.
Press any key to continue, where's the any key?
Quote
07-21-2012, 01:56 PM
Post: #8
RE: Shoutbox Code for Danzell
Basically we need to check at the point where it finds a new message if the message is from the user who posted and if not play a noise. Tongue
Quote


Forum Jump:


Who's Here?
User(s) browsing this thread: 1 Guest(s)



Extenditude is owned by Evolse Limited