Wysłane przez
nospor
Jakbym wiedzial co to jest to tez byloby swietnie ;)
Jakby mi ktos na tym forum odpowiedzial na pytanie związane z tym problemem, to juz dawno by to bylo zrobione. Niestety sie nie doczekalem.
http://forum.joomla.pl/showthread.php?t=21374
1. Community builder - dodatek społecznościowy http://www.joomlapolis.com/
2. Może kod shoutboxa napisanego też w Ajaxie pomoże:
Kod:
<?php
/**
* @version $Id: mod_smo_ajax_shoutbox.php,v 1.0.3 2005/11/29 02:21 stingrey Exp $
* @package Joomla_1.0.x
* @copyright (C) 2000 - 2005 Siemens-mobiles.org
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Joomla is Free Software
*/
// The number of comments that should show up in one viewing.
$jal_number_of_comments = 35;
//disabling notice to escape the weird undefined $mosConfig_user when
//shoutbox is on a wrapper page
error_reporting(E_ALL ^ E_NOTICE);
if(defined( '_VALID_MOS' )) {
require_once("configuration.php");
} else {
require_once("../configuration.php");
}
//require_once($path_to_mambo."/configuration.php");
$user = $mosConfig_user;
$db = $mosConfig_db;
$host = $mosConfig_host;
$pass = $mosConfig_password;
$prefix = $mosConfig_dbprefix;
$live = $mosConfig_live_site;
# Get the right language if it exists
if (file_exists($mosConfig_absolute_path.'/components/com_smo_ajax_shoutbox/languages/'.$mosConfig_lang.'.php')) {
include($mosConfig_absolute_path.'/components/com_smo_ajax_shoutbox/languages/'.$mosConfig_lang.'.php');
} else {
include($mosConfig_absolute_path.'/components/com_smo_ajax_shoutbox/languages/english.php');
}
//get the configuration file
require_once( $mosConfig_absolute_path."/administrator/components/com_smo_ajax_shoutbox/smo_ajax_shoutbox.cfg.php");
// Register globals - Thanks Karan et Etienne
$jal_lastID = isset($_GET['jal_lastID']) ? $_GET['jal_lastID'] : "";
$jal_user_name = isset($_POST['n']) ? $_POST['n'] : "";
$jal_user_url = isset($_POST['u']) ? $_POST['u'] : "";
$jal_user_text = isset($_POST['c']) ? $_POST['c'] : "";
$jalGetChat = isset($_GET['jalGetChat']) ? $_GET['jalGetChat'] : "";
$jalSendChat = isset($_GET['jalSendChat']) ? $_GET['jalSendChat'] : "";
// Time Since function courtesy
// http://blog.natbat.co.uk/archive/2003/Jun/14/jal_time_since
...................
////////////////////////////////////////////////////////////////////////////////////////////////////////
// If this file is called within mambo as a module, then let's echo the module and the last 10 shouts //
////////////////////////////////////////////////////////////////////////////////////////////////////////
if(defined( '_VALID_MOS' )) {
//let's first set the username/name ;)
if( $my -> id && shoutbox_format == 2 )
{
$query = "SELECT name
FROM #__users
WHERE id={$my -> id}
LIMIT 1";
$database -> setQuery($query);
$name = $database -> loadResult();
}
elseif ( $my -> id && shoutbox_format == 1 )
$name = $my -> username;
?>
<div id="shoutbox">
<div id="chatoutput">
<?php
global $jal_number_of_comments, $mosConfig_offset, $mosConfig_live_site, $mainframe;
$sql = "SELECT * FROM #__liveshoutbox ORDER BY id DESC LIMIT 10";
$database->setQuery( $sql );
$results = $database->loadObjectList();
// Will only add the last message div if it is looping for the first time
$jal_first_time = true;
// Loops the messages into a list
if($results) {foreach( $results as $r ) {
//Parse bbcode and smilies
$r->text = parse_bbcode(stripslashes($r->text));
if ($jal_first_time == true) { echo '<div id="help"><span><a href="javascript:openShoutboxHelp();" class="help_link">(?)</a></span></div><div id="lastMessage"><span>'._JAL_LAST_MESSAGE.':</span> <em id="responseTime">'.jal_time_since( $r->time ).' '._JAL_AGO.'</em></div>
<ul id="outputList">
'; }
if ($jal_first_time == true) $lastID = $r->id;
$url = (empty($r->url) && $r->url = "http://") ? $r->name : '<a href="'.$r->url.'">'.$r->name.'</a>';
echo '<li><span title="'.jal_time_since( $r->time ).'">'.stripslashes($url).' : </span>'.$r->text.'</li>
';
$jal_first_time = false; }
// If there is less than one entry in the box
} else {
echo "You need <b>at least one entry</b> in your shoutbox! Just type in a message now and reload, then you should be fine.";
}
?>
</ul>
</div>
<?
//check if guests are allowed to chat, otherwize ask them to register
if( !($my -> id == 0 && shoutbox_mode == 2) )
{
if(shoutbox_use_sound) {
/*if(shoutbox_sound_on)
$sound_name = "shoutbox_sound_on.swf";
else */
$sound_name = "smo_ajax_shoutbox_sound.swf";
?>
Sound: <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ID="sound" WIDTH=30 HEIGHT=30 CODEBASE="http://active.macromedia.com/flash2/cabs/swflash.cab#version=2,0,0,11"><PARAM NAME="Movie" VALUE="modules/<?=$sound_name?>"><EMBED NAME="sound" MAYSCRIPT SRC="modules/<?=$sound_name?>" WIDTH=30 HEIGHT=30 PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></OBJECT>
<?
}
?>
<form id="chatForm" method="post" action="index.php">
<?php if ( !$my -> id) { ?>
<input type="hidden" name="shoutbox_prefix" id="shoutbox_prefix" value="[GUEST]" />
<?php } else { ?>
<input type="hidden" name="shoutbox_prefix" id="shoutbox_prefix" value="" />
<?php } ?>
<?php
if ( $my->id ) { echo "\n";/* If they are logged in, then print their nickname */ ?>
<label><?php echo _CONTACT_NAME; ?><em><?php echo $name; ?></em></label>
<input type="hidden" name="shoutboxname" id="shoutboxname" value="<?php echo $name; ?>" />
<input type="hidden" name="shoutboxurl" id="shoutboxurl" value="" />
<?php } else { echo "\n"; /* Otherwise allow the user to pick their own name */ ?>
<label for="shoutboxname"><?php echo _CONTACT_NAME; ?></label>
<input class="shoutbox" type="text" name="shoutboxname" id="shoutboxname" value="" />
<?php if (!use_url) { echo '<span style="display: none">'; } ?>
<label for="shoutboxurl">url:</label>
<input class="shoutbox" type="text" name="shoutboxurl" id="shoutboxurl" value="" />
<?php if (!use_url) { echo "</span>"; } ?>
<?php } echo "\n"; ?>
<input type="hidden" id="jal_lastID" value="<?php echo $lastID + 1; ?>" name="jal_lastID" />
<input type="hidden" name="shout_no_js" value="true" />
<label for="chatbarText"><?php echo _JAL_MESSAGE; ?></label>
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<?php if (use_textarea) { ?>
<textarea rows="4" cols="16" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"></textarea>
<?php } else { ?>
<input class="shoutbox" type="text" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this, event);" />
<?php } ?>
</td></tr>
<tr><td <? if (!shoutbox_enable_smileys) { echo "colspan=\"2\"";}?>><input class="shoutbox" type="submit" id="submitchat" name="submit" value="<?php echo _SEND_BUTTON; ?>" /></td>
<? if (shoutbox_enable_smileys) { ?>
<td><input class="smileys" type="button" id="moresmileys" name="smileys" value="smileys" onClick="javascript:moreChatSmileys();" /></td>
<?
}
?>
</tr>
</table>
</form>
<?
}
else
echo "<center><strong>" . _PLEASE_LOGIN . "</strong></center>";
?>
</div>
<?php }
?>