Merci pour ces remontées,
Essayer de remplacer le fichier tchatche.php dans modules/tchatche/tchatche.php par
Code PHP (php) :
Pour copier le contenu exact du code,
Veuillez citer le message
-
<?php
-
class tpl{
-
function tchatche_main(){
global $K_user,$K_mod,$K_theme;
$main = null;
$main .= '<script type="text/javascript">'."\n";
$main .= '
function ajax()
{
var http_request=null;
if (window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
//on définit l\'appel de la fonction au retour serveur
http_request.onreadystatechange = function() { alert_ajax(http_request); };
//on appelle le fichier reponse.txt
http_request.open("GET", "modules/tchatche/comments.php?cmd=show", true);
http_request.send(null);
}
-
function alert_ajax(http_request)
{
if (http_request.readyState == 4)
{
if (http_request.status == 200)
{
document.getElementById(\'c_cont\').innerHTML=http_request.responseText;
}
else
{
alert(\'There was a problem with the request.\');
}
}
}
setInterval(\'ajax()\', 3000);
window.onload = ajax();
'."\n";
$main .= '</script>'."\n";
$main .= '<div id="c_cont"></div>'."\n";
$main .= '<div id="u_online"></div>'."\n";
$main .= '<div class="clearer"></div>'."\n";
echo $main;
-
-
}//FIN FUNCTION tchatche_MAIN
function tchatche_publish()
{
global $K_user,$K_mod,$K_theme;
$main = null;
$main .= '<script type="text/javascript">'."\n";
$main .= '
function submitComment(text,id)
{
if(text == \'\')
{
alert("Vous n\'avez pas rempli le champ input");
return false;
}
else
{
var xhr;
try { xhr = new ActiveXObject(\'Msxml2.XMLHTTP\'); }
catch (e)
{
try { xhr = new ActiveXObject(\'Microsoft.XMLHTTP\'); }
catch (e2)
{
try { xhr = new XMLHttpRequest(); }
catch (e3) { xhr = false; }
}
}
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
{
if(xhr.status == 200)
{
document.getElementById(\'reponse\').innerHTML = \'<img class="tchatche-submit-success" src="'.(file_exists('modules/'.$K_mod.'/theme/ok.png') ? 'modules/'.$K_mod.'/theme/ok.png' : 'themes/'.$K_theme.'/images/ok.png' ).'" alt="" />\';
document.getElementById(\'text\').value = \'\';
}
else
{
document.getElementById(\'reponse\').innerHTML = \'<h5 class="tchatche-submit-error">Une erreur est intervenue dans la publication de votre commentaire</h5>\';
}
}
};
if(text == \'delete\')
{
xhr.open( \'POST\', "modules/'.$K_mod.'/comments.php?cmd=remove", true);
xhr.setRequestHeader(\'Content-Type\', \'application/x-www-form-urlencoded\');
xhr.send(\'id=\'+id);
}
if(text != \'delete\' && text != \'abus\')
{
-
xhr.open( \'POST\', "modules/'.$K_mod.'/comments.php?cmd=add", true);
xhr.setRequestHeader(\'Content-Type\', \'application/x-www-form-urlencoded\');
xhr.send(\'text=\'+text,\'\');
-
}
if(text == \'abus\')
{
-
xhr.open( \'POST\', "modules/'.$K_mod.'/comments.php?cmd=abus", true);
xhr.setRequestHeader(\'Content-Type\', \'application/x-www-form-urlencoded\');
xhr.send(\'id=\'+id);
-
}
}
}
-
'."\n";
$main .= '</script>'."\n";
$main .= '<div class="tchatche-comments-box">'."\n";
$main .= '<form action="index.php">'."\n";
$main .= '<img class="tchatche-user-infos" src="'.$K_user->avatar.'" alt="" />'."\n";
$main .= '<input type="text" name="text" id="text" />'."\n";
$main .= '<input type="button" value="Tchater" title="Valider avec la touche entrée" onclick="submitComment(escape(document.getElementById(\'text\').value));" /><span id="reponse"></span>'."\n";
$main .= '</form>'."\n";
$main .= '<p class="clearer"></p>'."\n";
$main .= '</div>'."\n";
echo $main;
}
function tchatche_comment($data)
{
global $K_user,$K_mod,$K_theme;
-
$main = '<div class="tchatche-comments">'."\n";
$main .= '<img src="'.$data->u_avatar.'" alt="" class="tchatche-comments-avatar" title="'.$data->userName.'"/>'."\n";
$main .= '<div class="tchatche-comments-text"><span class="tchatche-comments-date">'.date('H:i:s',$data->time).' :</span> '. bbcode($data->text,1, 0, 0, 0, 0, 0).'</div>'."\n";
$main .= '<img src="'.(file_exists('modules/tchatche/theme/abus.png') ? 'modules/tchatche/theme/abus.png' : 'themes/'.$K_theme.'/images/abus.png' ).'" alt="" class="tchatche-abus-img" onclick="submitComment(\'abus\',\''.$data->id.'\');" title="Signaler un abus" />'."\n";
if(get_grade() >= GRD_MODOF)
{
$main .= '<img src="'.(file_exists('modules/tchatche/theme/delete.png') ? 'modules/tchatche/theme/delete.png' : 'themes/'.$K_theme.'/images/delete.png' ).'" alt="" class="tchatche-delete-img" onclick="submitComment(\'delete\',\''.$data->id.'\');" title="Supprimer"/>'."\n";
}
$main .= '<div class="clearer"></div>'."\n";
$main .= '</div>'."\n";
echo $main;
}
function tchatche_comment_ADM($data)
{
global $K_user,$K_mod,$K_theme;
-
$main = '<div class="tchatche-comments">'."\n";
$main .= '<img src="'.$data->u_avatar.'" alt="" class="tchatche-comments-avatar" title="'.$data->userName.'"/>'."\n";
$main .= '<div class="tchatche-comments-text"><span class="tchatche-comments-date">'.date('H:i:s',$data->time).' :</span> '. bbcode($data->text,1, 0, 0, 0, 0, 0).'</div>'."\n";
$main .= '<a href="index.php?mod='.$K_mod.'&ac=gestion&cmd=valid&id='.$data->id.'"><img src="'.(file_exists('modules/tchatche/theme/check.png') ? 'modules/tchatche/theme/check.png' : 'themes/'.$K_theme.'/images/check.png' ).'" alt="" class="tchatche-check-img" /></a>'."\n";
if(get_grade() >= GRD_MODOF)
{
$main .= '<a href="index.php?mod='.$K_mod.'&ac=gestion&cmd=remove&id='.$data->id.'"><img src="'.(file_exists('modules/tchatche/theme/delete.png') ? 'modules/tchatche/theme/delete.png' : 'themes/'.$K_theme.'/images/delete.png' ).'" alt="" class="tchatche-delete-img" /></a>'."\n";
}
$main .= '<div class="clearer"></div>'."\n";
$main .= '</div>'."\n";
echo $main;
}
function tchatche_onlineh()
{
$main = null;
$main .= '<h5 class="tchatche-user-online">Membres connectés (sur 60 secondes)</h5>'."\n";
$main .= "\n".'<ul class="tchatche-online-list">'."\n";
echo $main;
}
function tchatche_online($data)
{
global $K_user,$K_mod,$K_theme;
$main = null;
$main .= '<script type="text/javascript">'."\n";
$main .= 'function online()
{
var user_online=null;
if (window.XMLHttpRequest) {
user_online = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
user_online = new ActiveXObject("Microsoft.XMLHTTP");
}
//on définit l\'appel de la fonction au retour serveur
user_online.onreadystatechange = function() { alert_online(user_online); };
//on appelle le fichier reponse.txt
user_online.open("GET", "modules/tchatche/online.php", true);
user_online.send(null);
}
-
function alert_online(user_online)
{
if (user_online.readyState == 4)
{
if (user_online.status == 200)
{
document.getElementById(\'u_online\').innerHTML=user_online.responseText;
}
else
{
alert(\'There was a problem with the request.\');
}
}
}
setInterval(\'online()\', 60000);
window.onload = online();
'."\n";
$main .= '</script>'."\n";
if(!empty($data))
{
$main .= '<li><img src="'.(file_exists('modules/tchatche/theme/user.png') ? 'modules/tchatche/theme/user.png' : 'themes/'.$K_theme.'/images/user.png' ).'" alt="" /> <a href="'.url_rw('index.php?mod=espace_membre&ac=profil&id='.$data->user,array($data->userName)).'" title="Dernière connexion : '.date('H:i:s',$data->last_time).'">'.$data->userName.'</a></li>'."\n";
}
echo $main;
}
function tchatche_onlinef()
{
$main = null;
$main .= '</ul>'."\n";
echo $main;
}
-
} // FIN CLASS
-
?>
-