• Welcome to Simple Machines Community Forum. Please login or sign up.
January 20, 2022, 03:27:23 AM

News:

Join the Facebook Fan Page.


Ultimate Shoutbox

Started by Grudge, March 28, 2004, 09:11:20 AM

Previous topic - Next topic

Ryan

ok now when i click proceed i get this :/

Fatal error: packageinstall(): Failed opening required '/home/virtual/site1/fst/var/www/html/Packages/temp/shoutPdb.php' (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/Sources/Packages.php on line 414

Jerry

Not sure about your problem M3THOD

Grudge,  I think that the function template_shout_form() in shout.template.php be changed from :
function template_shout_form()
{
global $context, $settings, $options, $txt, $user_info, $scripturl, $modSettings, $ID_MEMBER;

echo '
<center>
<form action="', $scripturl, '?action=shout" method="post">
<input type="hidden" value="', $context['qstr'], '" name="qstr" />
<input type="hidden" value="" name="email" />';

if ($user_info['is_guest'])
echo '
<input type="hidden" value="0" name="memberID" />
<input type="text" value="', $txt['shoutbox_6'], '" name="displayname" maxlength="100" onfocus="this.value=\'\'" /><br />
<input type="text" value="', $txt['shoutbox_7'], '" name="email" maxlength="100" onfocus="this.value=\'\'" /><br />';
else
echo '
<input type="hidden" value="', $user_info['name'], '" name="displayname" />
<input type="hidden" value="', $ID_MEMBER, '" name="memberID" />';

echo '
<input type="text" value="', $txt['shoutbox_8'], '" name="message" size="16"  maxlength="100" onfocus="this.value=\'\'" /><br />
<input type="submit" name="submit" value="', $txt['shoutbox_9'], '" />
</form>
</center>';

}
to
function template_shout_form()
{
global $context, $settings, $options, $txt, $user_info, $scripturl, $modSettings, $ID_MEMBER;

echo '
<center>
<form action="', $scripturl, '?action=shout" method="post">
<input type="hidden" value="', $context['qstr'], '" name="qstr" />
<input type="hidden" value="" name="email" />';

if ($user_info['is_guest'])
echo '
<input type="hidden" value="0" name="memberID" />
<input type="text" value="', $txt['shoutbox_6'], '" name="displayname" maxlength="100" onfocus="this.value=\'\'" /><br />
<input type="text" value="', $txt['shoutbox_7'], '" name="email" maxlength="100" onfocus="this.value=\'\'" /><br />';
else
echo '
<input type="hidden" value="', $user_info['name'], '" name="displayname" />
<input type="hidden" value="', $ID_MEMBER, '" name="memberID" />';

echo '
<input type="text" value="', $txt['shoutbox_8'], '" name="message" size="16"  maxlength="100" onblur="if(this.value==\'\') this.value=\'', $txt['shoutbox_8'], '\';" onfocus="if(this.value==\'', $txt['shoutbox_8'], '\') this.value=\'\';" /><br />
<input type="submit" name="submit" value="', $txt['shoutbox_9'], '" />
</form>
</center>';

}
that way when you are typing a message, and you click out of the input area the message stays, but "Message" still disapears when you click it for the first time, but if you click again the message you are typing does not dissapear. I actually


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Grudge

Sorry for the delay M3THOD,

Quite confused by that problem. Could you use an ftp client when at that step and see whether the temp directory contains any files? If for some reason it's just something not working on your server I can spent a few minutes tomorrow trying to make up a package that will work for you!

Jerry,
Thanks for that, not a bad idea
I'm only a half geek really...

Grudge

PS, Jerry, think I've decided on just doing this instead:

<input type="text" value="', $txt['shoutbox_8'], '" name="message" size="16" maxlength="100" onfocus="if (this.value == \'', $txt['shoutbox_8'], '\')this.value=\'\'" /><br />


Shall be in next version
I'm only a half geek really...

Jerry

Great work on this mod, its used almost more than posting on my forums :P


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Webby

November 24, 2004, 05:42:17 AM #45 Last Edit: November 24, 2004, 07:36:49 AM by Webby
What if I want to adjust the time, date and name font sizes....?

Also, I would like to have the date and name on line 1, and the shout on the next line.  Do I have to edit the shout.php or the shout.template.php ?

[edit]

Never mind, I fixed that already.

One question still : how do I display the last shout on the main page on my website? If I use SSI, it would display all shouts and I just want 1 to be displayed.....

[/edit]

Webby

One thing :

it seems that you can use codes like [ b], [ i], [ move] etc. and also : the [ img] code.........

The problem I have is that very big pictures can ruin the whole template.
So there has to be some kind of check I guess.  On my board the check is active and set to a maximum size, but the shoutbox will display the whole picture !!!

Grudge

Displaying last shout by SSI... maybe I could add that to the next version if I get time? Would be *very* easy to do, just query the shout table and get the message.

As the BBC, good point on the [img] tag. Maybe we should just strip out the img tag to stop it happening? Something like:
$shout = preg_replace('~\[img\](.+?)\[/img\]~s', '', $shout);
I'm only a half geek really...

HRM

Quote from: Jerry on November 22, 2004, 08:34:57 PM
Great work on this mod, its used almost more than posting on my forums :P

And you do have  a very good looking forum!! Wow.  Nice theme!

I was jus looking for an example of a good working shoutbox and you sure have one. , and your chat looks good too.
Ed
To install something for the cat's 'cut' is never nice..... (old dutch saying) :D

HRM

ANd is this one compatible with Rc2 and where says how to activate /install it?
To install something for the cat's 'cut' is never nice..... (old dutch saying) :D

Grudge

Yes it is, it gives you install instructions when you load it into the package server.
I'm only a half geek really...

HRM

Ok, Tnx grudge.

Although I Didn't really saw any instructions the package manager saif that everything was installed succesful right away  :) .

So now only need to make it appaer somewhere. It said it modificated my ssi.php also, so will check how to make it appear. ;)
To install something for the cat's 'cut' is never nice..... (old dutch saying) :D

Webby

Quote from: Grudge on November 25, 2004, 06:44:40 AM
Displaying last shout by SSI... maybe I could add that to the next version if I get time? Would be *very* easy to do, just query the shout table and get the message.

As the BBC, good point on the [img] tag. Maybe we should just strip out the img tag to stop it happening? Something like:
$shout = preg_replace('~\[img\](.+?)\[/img\]~s', '', $shout);

Where should I put this $shout = preg_replace('~\[img\](.+?)\[/img\]~s', '', $shout); exactly ?

Grudge

That was somewhat pseudo, it would be the shout() function though I'd think... I'm always at work when answering these at the moment so don't have code with me ;)
I'm only a half geek really...

Webby

function Shout()
{
global $db_prefix, $user_info, $settings, $modSettings, $txt, $user_info, $sourcedir;

isAllowedTo('make_shout');

$time = time();

$_POST['message'] = isset($_POST['message']) ? $_POST['message'] : '';
$_POST['displayname'] = isset($_POST['displayname']) ? $_POST['displayname'] : '';
$message = $_POST['message'];

//Put a space in front of the message - so we can just enter 1 smiley. We make up for it in the display
$message = " " . $message . " ";

$message = htmlspecialchars($message, ENT_QUOTES);
include_once($sourcedir . '/Subs-Post.php');
preparsecode($message);
//Here we put in some validation so we don't have to put up with too much crap

//make sure all the fields are filled in
if (($_POST['displayname'] == "") || ($_POST['message'] == ""))
fatal_error($txt['shoutbox_11'], false);

//make sure nobody hit submit without filling in all the fields
if (($_POST['displayname'] == $txt['shoutbox_6']) || ($_POST['email'] == $txt['shoutbox_7']) || ($_POST['message'] == $txt['shoutbox_8']))
fatal_error($txt['shoutbox_11'], false);

//make sure nobody puts in a bogus email address
if ($user_info['is_guest'] && preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error($txt['shoutbox_12'], false);

if ($_POST['displayname'] == "")
$_POST['displayname'] = $user_info['name'];

// Now we're ready to insert the shout
$result = db_query("
INSERT INTO {$db_prefix}shoutbox
(ID_MEMBER, displayname, message,time,email)
VALUES ('$_POST[memberID]', '$_POST[displayname]', '$message','$time','$_POST[email]')", __FILE__, __LINE__);

ob_end_clean();
header("Location: $_POST[qstr]");
obExit(false);
}


:)

Grudge

After:
$message = " " . $message . " ";

put:

$message = preg_replace('~\[img(.+?)\](.+?)\[/img\]~s', '', $message);

I haven't checked the regex is right but it shouldn't hurt to try. That will just strip out [img] tags... I think. I'll try remember check when I get home
I'm only a half geek really...

Webby

Checked it and it seemed ok, but when I tried it again it showed me a (very) big image and a ruined layout.

Maybe you'll find the time to check it when you get home ;)

Thanx !

Grudge

Did you try the same thing the second time? Were you just using [img] tags, or other attributes? What bout if you make it this?
$message = preg_replace('~\[img(.+?)*\](.+?)\[/img\]~s', '', $message);
I'm only a half geek really...

Webby

I was using the same line and no other attributes.  With this new code it gives me the same big picture.

I use :


[img]http://www.karinhexspoor.nl/images/introfoto2copy.jpg[/img]

Grudge

Note that this will obviously only work for *new* messages, not existing ones. The below doesn't work?
function Shout()
{
global $db_prefix, $user_info, $settings, $modSettings, $txt, $user_info, $sourcedir;

isAllowedTo('make_shout');

$time = time();

$_POST['message'] = isset($_POST['message']) ? $_POST['message'] : '';
$_POST['displayname'] = isset($_POST['displayname']) ? $_POST['displayname'] : '';
$message = str_replace('~\[img.+?\].+?\[/img\]~is', '', $_POST['message']);

//Put a space in front of the message - so we can just enter 1 smiley. We make up for it in the display
$message = " " . $message . " ";

$message = htmlspecialchars($message, ENT_QUOTES);
include_once($sourcedir . '/Subs-Post.php');
preparsecode($message);
//Here we put in some validation so we don't have to put up with too much crap

//make sure all the fields are filled in
if (($_POST['displayname'] == "") || ($_POST['message'] == ""))
fatal_error($txt['shoutbox_11'], false);

//make sure nobody hit submit without filling in all the fields
if (($_POST['displayname'] == $txt['shoutbox_6']) || ($_POST['email'] == $txt['shoutbox_7']) || ($_POST['message'] == $txt['shoutbox_8']))
fatal_error($txt['shoutbox_11'], false);

//make sure nobody puts in a bogus email address
if ($user_info['is_guest'] && preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $_POST['email']) == 0)
fatal_error($txt['shoutbox_12'], false);

if ($_POST['displayname'] == "")
$_POST['displayname'] = $user_info['name'];

// Now we're ready to insert the shout
$result = db_query("
INSERT INTO {$db_prefix}shoutbox
(ID_MEMBER, displayname, message,time,email)
VALUES ('$_POST[memberID]', '$_POST[displayname]', '$message','$time','$_POST[email]')", __FILE__, __LINE__);

ob_end_clean();
header("Location: $_POST[qstr]");
obExit(false);
}


:)
Quote
I'm only a half geek really...

Advertisement: