Is my first contribution so i dont know exactly how to explain the modifications but i'll do my best, thanks...
This is a mod for displaying "Kick" and "Ban" options in the menu that is displayed when you click a user, but this options only appears after being identifyied as a chat admin, if you get disconnected the options will hide, etc. etc. Is the same that /kick and /ban, but in a menu, so you just have to click the user you want to kick or ban.
Hope you like it..
/i18n/en_US/main.php, line 383
- Code: Select all
// line 480 in phpfreechat.class.php
$GLOBALS["i18n"]["Kick"] = "Kick";
// line 481 in phpfreechat.class.php
$GLOBALS["i18n"]["Are you sure you want to kick this user?"] = "Are you sure you want to kick this user?";
// line 482 in phpfreechat.class.php
$GLOBALS["i18n"]["Ban"] = "Ban";
// line 483 in phpfreechat.class.php
$GLOBALS["i18n"]["Are you sure you want to ban this user?"] = "Are you sure you want to ban this user?";
/src/phpfreechat.class.php, line 481, replace ");" with:
- Code: Select all
"Kick",
"Are you sure you want to kick this user?",
"Ban",
"Are you sure you want to ban this user?",
);
/data/public/js/pfcclient.js, various lines:
- Code: Select all
//-------------------------
//line 27
this.imadmin = false;
//-------------------------
//------------------------
//line 1037, add this functions, the kick and ban options builder
var isadmin = this.getUserMeta(nickid, 'isadmin');
if (isadmin == '') isadmin = false;
if (this.imadmin && (pfc.getUserMeta(nickid,'nick') != this.nickname) && !isadmin)
{ //the kick option
lblKckRuSr = this.res.getLabel('Are you sure you want to kick this user?');
var p = document.createElement('p');
p.setAttribute('class', 'pfc_nickwhois_pv');
p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
var a = document.createElement('a');
a.setAttribute('href', '');
a.pfc_nickid = nickid;
a.pfc_parent = div;
a.onclick = function(evt){
if(confirm(lblKckRuSr)){
var nick = pfc.getUserMeta(this.pfc_nickid,'nick');
pfc.sendRequest('/kick "'+nick+'"');
this.pfc_parent.style.display = 'none';
return false;
}
}
var img = document.createElement('img');
img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
img.alt = this.res.getLabel('Kick');
a.appendChild(img);
a.appendChild(document.createTextNode(this.res.getLabel('Kick')));
p.appendChild(a);
div.appendChild(p);
//the ban option
lblBnRuSr = this.res.getLabel('Are you sure you want to ban this user?');
var p = document.createElement('p');
p.setAttribute('class', 'pfc_nickwhois_pv');
p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6
var a = document.createElement('a');
a.setAttribute('href', '');
a.pfc_nickid = nickid;
a.pfc_parent = div;
a.onclick = function(evt){
if(confirm(lblBnRuSr)){
var nick = pfc.getUserMeta(this.pfc_nickid,'nick');
pfc.sendRequest('/ban "'+nick+'"');
this.pfc_parent.style.display = 'none';
return false;
}
}
var img = document.createElement('img');
img.setAttribute('src', this.res.getFileUrl('images/openpv.gif'));
img.alt = this.res.getLabel('Ban');
a.appendChild(img);
a.appendChild(document.createTextNode(this.res.getLabel('Ban')));
p.appendChild(a);
div.appendChild(p);
}
//---------------------------
//----------------------------
//line 1054, replace this:
var d = pfc.getNickWhoisBox(this.pfc_nickid);
//with this:
pfc.updateNickWhoisBox(this.pfc_nickid);
var d = pfc.getNickWhoisBox(this.pfc_nickid);
//------------------------------
//-----------------------------
//line 1067 to 1070, replace this:
if (isadmin)
img.setAttribute('src', this.res.getFileUrl('images/user-admin.gif'));
else
img.setAttribute('src', this.res.getFileUrl('images/user.gif'));
// with this:
if (isadmin)
{
if(pfc.getUserMeta(nickid,'nick') == this.nickname)
this.imadmin = true;
img.setAttribute('src', this.res.getFileUrl('images/user-admin.gif'));
}
else
img.setAttribute('src', this.res.getFileUrl('images/user.gif'));
//--------------------------
//--------------------------
// line 1439 to 1441, replace this:
loginlogout_icon.src = this.res.getFileUrl('images/logout.gif');
loginlogout_icon.alt = this.res.getLabel('Disconnect');
loginlogout_icon.title = loginlogout_icon.alt;
//with this:
this.imadmin = false;
loginlogout_icon.src = this.res.getFileUrl('images/logout.gif');
loginlogout_icon.alt = this.res.getLabel('Disconnect');
loginlogout_icon.title = loginlogout_icon.alt;
//-------------------------
and that's it
![Smile :)](./images/smilies/icon_smile.gif)