shoutbox

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
AzNBlade001

shoutbox

Post by AzNBlade001 »

I have installed the newest version of cms made simple multi language. I have just found the advertising iframe before website content.  It is like this:where post_id = 112388;
";
joerns
New Member
New Member
Posts: 4
Joined: Sun Jan 11, 2009 2:00 am

Re: shoutbox

Post by joerns »

I've built a shoutbox but this one is for the backend, doesn't use any database and my coding style could be much better :)
I include it in index.php and it does a good job since it makes it possible to leave messages for other admins.
Perhaps someone can build something useful out of it ??? Well, I don't think so but you can try...

[Edit]The second PHP tag ist missing. Worked nevertheless...
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by joerns on Sun Jan 11, 2009 2:15 am, edited 1 time in total.
joerns
New Member
New Member
Posts: 4
Joined: Sun Jan 11, 2009 2:00 am

Re: shoutbox

Post by joerns »

Where?
nhaack

Re: shoutbox

Post by nhaack »

cool... it is on-board already? What is it called? Is it in the plug-in directory?

Best
Nils
joerns
New Member
New Member
Posts: 4
Joined: Sun Jan 11, 2009 2:00 am

Re: shoutbox

Post by joerns »

Well I couldn't find it and so adapted my little script for the new version :)
What it looks like: Image
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by joerns on Mon Jan 12, 2009 6:37 pm, edited 1 time in total.
Slagar
Forum Members
Forum Members
Posts: 19
Joined: Sat May 10, 2008 11:42 am
Location: Auckland

Re: shoutbox

Post by Slagar »

Is this functionality already available, Mark? Where?  :o

Joerns, that looks fantastic!! I haven't tried it yet, but might do later :)
If there aren't any other solutions around, maybe this could be made into a simple module. I wish I knew more about module development myself  :-\

Also, I do agree with the OP that front-end shoutbox functionality could be quite handy!
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Re: shoutbox

Post by Nullig »

Excellent addon joerns. I tweaked it a little, coded english translations and added it to the dashboard page in admin, where system messages are shown.

Here's the code for:

shout.php

Code: Select all

<?php

// Settings...
$shout_filename=".htshout"; //Clever: Use a filename that starts with ".ht" to make Apache deny access automatically...
$shout_lang=array("title"=>"Admin Message Board","enter"=>"New message:","submit"=>"Submit","nodisplay"=>"The entries can not be displayed...","nostore"=>"The entry could not be saved.","created"=>"Board created.");
$shout_maxlen=1000;
$shout_timeformat="d.m.Y H:i:s"; //PHP-Time... -> http://de.php.net/manual/de/function.date.php

// (c) 2009 by js
$shout_time=date($shout_timeformat);
if(!file_exists($shout_filename))file_put_contents($shout_filename,"(".$shout_time.")\t".$shout_lang["created"]."\n");
$shout_content=file_get_contents($shout_filename);

if(isset($CMS_ADMIN_PAGE)&&$CMS_ADMIN_PAGE==1){
	//included, show entry list...
	
	echo '<div class="pagecontainer">
	<div class="pageoverflow"><div class="pageheader">'.$shout_lang["title"].'</div></div>
	';
	if($shout_content==false)echo '<div class="error">'.$shout_lang["nodisplay"].'</div>';
	else{
		$shout_content=htmlentities($shout_content,ENT_QUOTES,"UTF-8");
		$shout_content=preg_replace("/(^|\n)(.+)\t/",'<h3 style="margin:0;margin-top:3px;">$2</h3>',$shout_content); //put name+time into heading
		echo '<div style="border:1px ridge black;background-color:white;padding:5px;margin-bottom:5px;">'.$shout_content.'</div>';
	}
	echo '
	<form action="shout.php" method="POST"><input type="hidden" name="'.CMS_SECURE_PARAM_NAME.'" value="'.$_SESSION[CMS_USER_KEY].'" />'.$shout_lang["enter"].' <input type="text" name="shout_text" style="width:500px;"> <input type="submit" value="'.$shout_lang["submit"].'"></form>
	</div>';
	
}else{
	//direct call, seems to be a new entry...
	
	//Security things...
	require_once("../include.php");
	check_login();
	
	$shout_dest="index.php?".CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];
	if(isset($_POST["shout_text"])){
		$shout_post=$_POST["shout_text"];
		$shout_post=trim(str_replace(array("\n","\r"),"",$shout_post)); //For Security...
		if($shout_post!=""){
			$shout_content="(".$shout_time.") ".$gCms->variables['username']."\t".$shout_post."\n".$shout_content;
			$shout_content=substr($shout_content,0,$shout_maxlen).((strlen($shout_content)>$shout_maxlen)?"...":"");
			if(file_put_contents($shout_filename,$shout_content)) redirect($shout_dest);
			else echo '<div class="error">'.$shout_lang["nostore"].'</div>';
		} else redirect($shout_dest);
	}else redirect($shout_dest);
}

?>
and I added it to the dashboard.php file, near the bottom:

Code: Select all

$themeObject->DisplayDashboardPageItem("end");
include_once("shout.php");
?></div></div>
Nullig
Attachments
shout.jpg
Last edited by Nullig on Thu Feb 12, 2009 5:39 am, edited 1 time in total.
joerns
New Member
New Member
Posts: 4
Joined: Sun Jan 11, 2009 2:00 am

Re: shoutbox

Post by joerns »

Hmmm.
I think it would be better to shorten the entries when a new entry is added.
In your version the .htshout file will still be cropped after the specified lenght ($shout_maxlength) what isn't necessary any more, then.
There are so many things that could be improved. Perhaps the message board should be somewhat integrated with the System Messages (although it would prefer to only have it on the first page). Then data should be stored in a database, and modules should have the possibility to add messages (like "Guestbook: There is a new entry, please check").
Someone want to implement that? :)
Locked

Return to “Modules/Add-Ons”