Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.1.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2009, 03:42 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 27,274
Arianna will become famous soon enough
Default Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Excuse me if this has been posted before. xD But I have a mod which I've just made. It's really simple, just a new database and a page, so tell me if you find any errors.
Run this SQL query:
Code:
CREATE TABLE  `yoursite_adopts`.`adopts_shoutbox` (
`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`user` VARCHAR( 50 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,
`date` VARCHAR( 20 ) NOT NULL ,
`comment` VARCHAR( 10000 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,
PRIMARY KEY (  `id` )
) ENGINE = MYISAM
Now make a file called 'shoutbox.php' with these contents...
PHP Code:
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************

include("inc/functions.php");
include(
"inc/config.php");
include(
"inc/bbcode.php");

$themeurl grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************

$links getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************

$ads getads("any");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************

$pagecontent getsitecontent("index");
$article_title $pagecontent[title];
$article_content $pagecontent[content];
$article_content nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************

$browsertitle grabanysetting("browsertitle");
$sitename grabanysetting("sitename");
$slogan grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************

$loginstatus logincheck();
$isloggedin $loginstatus[loginstatus];
$loggedinname $loginstatus[username];

// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************

$article_title "Shoutbox";
$article_content "<p>Welcome to our shoutbox. Keep it G-rated and nice. You will be <b>banned</b> if you do not obey these rules. Thanks.</p>";

$article_content $article_content."<div class='enclosecomments'>";
$query "SELECT * FROM ".$prefix."shoutbox ORDER BY id DESC LIMIT 0, 10";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i $num) {
    
$id=@mysql_result($result,$i,"id");
    
$user=@mysql_result($result,$i,"user");
    
$date=@mysql_result($result,$i,"date");
    
$nolinecomment=@mysql_result($result,$i,"comment");
    
$nolinecomment bbconvert($nolinecomment);
    
$comment=nl2br($nolinecomment);
    
$commentdiv "<div class='comment' style='width:94%;padding:2%;background-color:aliceblue;margin-bottom:5px;'><div class='userdate' style='width:50%;height:25px;color:red;'>".$user." - ".$date."</div>".$comment."</div>";
    
$article_content $article_content.$commentdiv;
    
$i++;
}
$article_content $article_content."</div><p>Post a shoutout!</p>";
$article_content $article_content."<form action='shoutbox.php' method='post'>
This here is where you write the comment. Listen... keep it G-rated. Or we'll just delete the comment.
<textarea rows='15' cols='60' name='comment' wrap='physical' ></textarea><br>
<input type='submit' /></form>"
;

//here the user posts a comment
$comment $_POST["comment"];
if (
$comment != "") {
    
$date date("Y-m-d H:i:s");
    
// $date = "10-23-3 21:02:35";
    
$user $loggedinname;
    if (
$isloggedin!="yes") {
        
$user "Guest";
        }
    
$comment $comment;
    
mysql_query("INSERT INTO ".$prefix."shoutbox VALUES ('', '$user', '$date', '$comment')");
    
$article_content $article_content."<p>Your comment has been posted. Click <a href='shoutbox.php'>here</a> to view it.</p>";
}
else {
    
$article_content $article_content."Post a shout out, if you'd like.";
    }
// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file $themeurl;

// Do the template changes and echo the ready template
$template file_get_contents($file);

$template replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':ARTICLEDATE:',$article_date,$template);

$template replace(':BROWSERTITLE:',$browsertitle,$template);
$template replace(':SITENAME:',$sitename,$template);

//Define our links
$template replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...
$sidebar getsidebar();
$template replace(':SIDEFEED:',$sidebar,$template);

// Okay - now what we're going to do is get the style switchery thing
$style getstyle();
$template replace(':STYLESHEET:',$style,$template);

//Get the ad content...
$template replace(':ADS:',$ads,$template);

//Get the slogan info
$template replace(':SLOGAN:',$slogan,$template);


echo 
$template;

// **********************************************************************
// End Template Definition
// **********************************************************************
?>
It works. :) Guests will post as "Guest". You can, of course, edit the code a bit so only members may post.

EDIT: PLEASE READ Sea's post below this. Shoutboxes take quite a lot of server load. I don't know much about it, but Sea does, so listen to her. :)
Reply With Quote
  #2  
Old 12-22-2009, 10:07 PM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 18,119
Seapyramid
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Just want to make a note on shout boxes. They tend to pull many server resources & adoptables sites pull on the servers greatly just by their nature. I don't recommend any Free Service for an adoptables site because as soon as you start getting a decent number of members you tend to get shut down. I have seen it before.

Using a shout box on a free host is asking to be shut down. If you want your site to live, watch your CPU usage & don't even try a shout box on a free host.

Sea
Reply With Quote
  #3  
Old 12-23-2009, 02:56 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 27,274
Arianna will become famous soon enough
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Hmmm.. I'm not using a free host, I pay for the hosting myself, $6 a month, with my own domain name. I'm not one for free hosting. *shudders*
I don't know if you think that it's free because of the subdomain, but that's only because I'm running the adoptables for another website, sort of. xD
I run a forum on my site, too, and my bandwidth and stuff all seems to be fine. :/ Could you elaborate?
Reply With Quote
  #4  
Old 12-23-2009, 03:24 AM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 18,119
Seapyramid
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

I never meant it to be you or anyone special. :) Baudwidth is not the issue. CPU or Server resouces is. They are the things you must 'look' for & not readily available on your CPanel. They are the things even paid host don't talk much about until u exceed them & get 'white' pages or get shut down.

Sea
Reply With Quote
  #5  
Old 12-23-2009, 03:43 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 27,274
Arianna will become famous soon enough
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Thanks, Sea. I'll try and do some research on stuff like that, and for now, take the shoutbox mod down.
Though I do have a question for you, if you don't mind. xD I might be integrating in with MyBB - MyBB has a low server load, I think, because lots of people run it, as do I. Would it be better have the 'shoutbox' as a thread on a forum, instead?
Reply With Quote
  #6  
Old 12-26-2009, 11:14 PM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 18,119
Seapyramid
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Shout Box is a drain.. period! If you want to run it on a trade page or special page.. then yes.. otherwise to use on all pages... Well PGS runs a shout box on all pages. It also has a high CPU server. It is a bit more expensive then some of the others, but not bad. $10 a month & they work with your server calls. If you want to run high CPU.. well thats who I recommend to stay alive.

Sea
Reply With Quote
  #7  
Old 12-27-2009, 04:16 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 27,274
Arianna will become famous soon enough
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Oh, I planned on having a 'shoutbox' page, which people would go to via a link in the navbar - not on every page... That would really be resource draining, I can understand that.
Right now my shoutbox is located here: www.twig.pixelpuppy.net/adoptables/shoutbox.php
Do you think that it's taking too many resources? Dx
Reply With Quote
  #8  
Old 12-23-2010, 08:39 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 492,082
Hall of Famer is on a distinguished road
Default RE: Shoutbox Mod ~ Finished. :) [[Also converts BBcode]]

Well this is a very interesting modification, wonder why it never received moderate attention. There's one thing I'd like to point out though, the template definition looks quite different in Arianna's shoutbox.php, and it is not compatible with the current Rusnak Adoptables script files. To fix this, simply find the template definition codes and replace it with what you usually see from other script files:

Find:
PHP Code:
// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file $themeurl;

// Do the template changes and echo the ready template
$template file_get_contents($file);

$template replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':ARTICLEDATE:',$article_date,$template);

$template replace(':BROWSERTITLE:',$browsertitle,$template);
$template replace(':SITENAME:',$sitename,$template);

//Define our links
$template replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...
$sidebar getsidebar();
$template replace(':SIDEFEED:',$sidebar,$template);

// Okay - now what we're going to do is get the style switchery thing
$style getstyle();
$template replace(':STYLESHEET:',$style,$template);

//Get the ad content...
$template replace(':ADS:',$ads,$template);

//Get the slogan info
$template replace(':SLOGAN:',$slogan,$template);


echo 
$template;

// **********************************************************************
// End Template Definition
// **********************************************************************
?> 
Replace with:
PHP Code:
// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file $themeurl;

// Do the template changes and echo the ready template
$template file_get_contents($file);

$template replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':ARTICLEDATE:',$article_date,$template);

$template replace(':BROWSERTITLE:',$browsertitle,$template);
$template replace(':SITENAME:',$sitename,$template);

//Define our links
$template replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar getsidebar();
$template replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template replace(':ADS:',$ads,$template);

//Get the slogan info
$template replace(':SLOGAN:',$slogan,$template);


echo 
$template;

// **********************************************************************
// End Template Definition
// **********************************************************************



?> 
This should fix the no method error for function 'getstyle' appearing on line 132. I tested it on my development demo site, and it works perfectly. Again Arianna deserves a karma for making such an amazing shoutbox mod.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Support for BBCode jason1234h Questions and Supports 2 07-22-2013 12:46 AM
Messed up BBCode SilverDragonTears Questions and Supports 19 02-13-2012 11:50 AM
Extra BBcode AlexC Mys v1.2.x Mods 0 04-14-2011 01:48 PM
HTML instead of BBCODE PokePets Questions and Supports 3 08-09-2010 06:36 AM
BBCode Fireballchad Addons/Mods Graveyard 5 09-19-2009 09:09 AM


All times are GMT -5. The time now is 02:48 PM.

Currently Active Users: 693 (0 members and 693 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636