function htmlentities(texte) {
texte = texte.replace(/"/g,'"'); // 34 22
texte = texte.replace(/&/g,'&'); // 38 26
texte = texte.replace(/\'/g,'''); // 39 27
texte = texte.replace(//g,'>'); // 62 3E
texte = texte.replace(/\^/g,'ˆ'); // 94 5E
texte = texte.replace(/‘/g,'‘'); // 145 91
texte = texte.replace(/’/g,'’'); // 146 92
texte = texte.replace(/“/g,'“'); // 147 93
texte = texte.replace(/”/g,'”'); // 148 94
texte = texte.replace(/•/g,'•'); // 149 95
texte = texte.replace(/–/g,'–'); // 150 96
texte = texte.replace(/—/g,'—'); // 151 97
texte = texte.replace(/˜/g,'˜'); // 152 98
texte = texte.replace(/™/g,'™'); // 153 99
texte = texte.replace(/š/g,'š'); // 154 9A
texte = texte.replace(/›/g,'›'); // 155 9B
texte = texte.replace(/œ/g,'œ'); // 156 9C
texte = texte.replace(//g,'ť'); // 157 9D
texte = texte.replace(/ž/g,'ž'); // 158 9E
texte = texte.replace(/Ÿ/g,'Ÿ'); // 159 9F
texte = texte.replace(/ /g,' '); // 160 A0
texte = texte.replace(/¡/g,'¡'); // 161 A1
texte = texte.replace(/¢/g,'¢'); // 162 A2
texte = texte.replace(/£/g,'£'); // 163 A3
texte = texte.replace(/ /g,'¤'); // 164 A4
texte = texte.replace(/¥/g,'¥'); // 165 A5
texte = texte.replace(/¦/g,'¦'); // 166 A6
texte = texte.replace(/§/g,'§'); // 167 A7
texte = texte.replace(/¨/g,'¨'); // 168 A8
texte = texte.replace(/©/g,'©'); // 169 A9
texte = texte.replace(/ª/g,'ª'); // 170 AA
texte = texte.replace(/«/g,'«'); // 171 AB
texte = texte.replace(/¬/g,'¬'); // 172 AC
texte = texte.replace(//g,''); // 173 AD
texte = texte.replace(/®/g,'®'); // 174 AE
texte = texte.replace(/¯/g,'¯'); // 175 AF
texte = texte.replace(/°/g,'°'); // 176 B0
texte = texte.replace(/±/g,'±'); // 177 B1
texte = texte.replace(/²/g,'²'); // 178 B2
texte = texte.replace(/³/g,'³'); // 179 B3
texte = texte.replace(/´/g,'´'); // 180 B4
texte = texte.replace(/µ/g,'µ'); // 181 B5
texte = texte.replace(/¶/g,'¶'); // 182 B6
texte = texte.replace(/·/g,'·'); // 183 B7
texte = texte.replace(/¸/g,'¸'); // 184 B8
texte = texte.replace(/¹/g,'¹'); // 185 B9
texte = texte.replace(/º/g,'º'); // 186 BA
texte = texte.replace(/»/g,'»'); // 187 BB
texte = texte.replace(/¼/g,'¼'); // 188 BC
texte = texte.replace(/½/g,'½'); // 189 BD
texte = texte.replace(/¾/g,'¾'); // 190 BE
texte = texte.replace(/¿/g,'¿'); // 191 BF
texte = texte.replace(/À/g,'À'); // 192 C0
texte = texte.replace(/Á/g,'Á'); // 193 C1
texte = texte.replace(/Â/g,'Â'); // 194 C2
texte = texte.replace(/Ã/g,'Ã'); // 195 C3
texte = texte.replace(/Ä/g,'Ä'); // 196 C4
texte = texte.replace(/Å/g,'Å'); // 197 C5
texte = texte.replace(/Æ/g,'Æ'); // 198 C6
texte = texte.replace(/Ç/g,'Ç'); // 199 C7
texte = texte.replace(/È/g,'È'); // 200 C8
texte = texte.replace(/É/g,'É'); // 201 C9
texte = texte.replace(/Ê/g,'Ê'); // 202 CA
texte = texte.replace(/Ë/g,'Ë'); // 203 CB
texte = texte.replace(/Ì/g,'Ì'); // 204 CC
texte = texte.replace(/Í/g,'Í'); // 205 CD
texte = texte.replace(/Î/g,'Î'); // 206 CE
texte = texte.replace(/Ï/g,'Ï'); // 207 CF
texte = texte.replace(/Ð/g,'Ð'); // 208 D0
texte = texte.replace(/Ñ/g,'Ñ'); // 209 D1
texte = texte.replace(/Ò/g,'Ò'); // 210 D2
texte = texte.replace(/Ó/g,'Ó'); // 211 D3
texte = texte.replace(/Ô/g,'Ô'); // 212 D4
texte = texte.replace(/Õ/g,'Õ'); // 213 D5
texte = texte.replace(/Ö/g,'Ö'); // 214 D6
texte = texte.replace(/×/g,'×'); // 215 D7
texte = texte.replace(/Ø/g,'Ø'); // 216 D8
texte = texte.replace(/Ù/g,'Ù'); // 217 D9
texte = texte.replace(/Ú/g,'Ú'); // 218 DA
texte = texte.replace(/Û/g,'Û'); // 219 DB
texte = texte.replace(/Ü/g,'Ü'); // 220 DC
texte = texte.replace(/Ý/g,'Ý'); // 221 DD
texte = texte.replace(/Þ/g,'Þ'); // 222 DE
texte = texte.replace(/ß/g,'ß'); // 223 DF
texte = texte.replace(/à/g,'à'); // 224 E0
texte = texte.replace(/á/g,'á'); // 225 E1
texte = texte.replace(/â/g,'â'); // 226 E2
texte = texte.replace(/ã/g,'ã'); // 227 E3
texte = texte.replace(/ä/g,'ä'); // 228 E4
texte = texte.replace(/å/g,'å'); // 229 E5
texte = texte.replace(/æ/g,'æ'); // 230 E6
texte = texte.replace(/ç/g,'ç'); // 231 E7
texte = texte.replace(/è/g,'è'); // 232 E8
texte = texte.replace(/é/g,'é'); // 233 E9
texte = texte.replace(/ê/g,'ê'); // 234 EA
texte = texte.replace(/ë/g,'ë'); // 235 EB
texte = texte.replace(/ì/g,'ì'); // 236 EC
texte = texte.replace(/í/g,'í'); // 237 ED
texte = texte.replace(/î/g,'î'); // 238 EE
texte = texte.replace(/ï/g,'ï'); // 239 EF
texte = texte.replace(/ð/g,'ð'); // 240 F0
texte = texte.replace(/ñ/g,'ñ'); // 241 F1
texte = texte.replace(/ò/g,'ò'); // 242 F2
texte = texte.replace(/ó/g,'ó'); // 243 F3
texte = texte.replace(/ô/g,'ô'); // 244 F4
texte = texte.replace(/õ/g,'õ'); // 245 F5
texte = texte.replace(/ö/g,'ö'); // 246 F6
texte = texte.replace(/÷/g,'÷'); // 247 F7
texte = texte.replace(/ø/g,'ø'); // 248 F8
texte = texte.replace(/ù/g,'ù'); // 249 F9
texte = texte.replace(/ú/g,'ú'); // 250 FA
texte = texte.replace(/û/g,'û'); // 251 FB
texte = texte.replace(/ü/g,'ü'); // 252 FC
texte = texte.replace(/ý/g,'ý'); // 253 FD
texte = texte.replace(/þ/g,'þ'); // 254 FE
texte = texte.replace(/ÿ/g,'ÿ'); // 255 FF
return texte;
}
//Décode une chaîne
function html_entity_decode(texte) {
texte = texte.replace(/"/g,'"'); // 34 22
texte = texte.replace(/&/g,'&'); // 38 26
texte = texte.replace(/'/g,"'"); // 39 27
texte = texte.replace(/</g,'<'); // 60 3C
texte = texte.replace(/>/g,'>'); // 62 3E
texte = texte.replace(/ˆ/g,'^'); // 94 5E
texte = texte.replace(/‘/g,'‘'); // 145 91
texte = texte.replace(/’/g,'’'); // 146 92
texte = texte.replace(/“/g,'“'); // 147 93
texte = texte.replace(/”/g,'”'); // 148 94
texte = texte.replace(/•/g,'•'); // 149 95
texte = texte.replace(/–/g,'–'); // 150 96
texte = texte.replace(/—/g,'—'); // 151 97
texte = texte.replace(/˜/g,'˜'); // 152 98
texte = texte.replace(/™/g,'™'); // 153 99
texte = texte.replace(/š/g,'š'); // 154 9A
texte = texte.replace(/›/g,'›'); // 155 9B
texte = texte.replace(/œ/g,'œ'); // 156 9C
texte = texte.replace(/ť/g,''); // 157 9D
texte = texte.replace(/ž/g,'ž'); // 158 9E
texte = texte.replace(/Ÿ/g,'Ÿ'); // 159 9F
texte = texte.replace(/ /g,' '); // 160 A0
texte = texte.replace(/¡/g,'¡'); // 161 A1
texte = texte.replace(/¢/g,'¢'); // 162 A2
texte = texte.replace(/£/g,'£'); // 163 A3
texte = texte.replace(/¤/g,' '); // 164 A4
texte = texte.replace(/¥/g,'¥'); // 165 A5
texte = texte.replace(/¦/g,'¦'); // 166 A6
texte = texte.replace(/§/g,'§'); // 167 A7
texte = texte.replace(/¨/g,'¨'); // 168 A8
texte = texte.replace(/©/g,'©'); // 169 A9
texte = texte.replace(/ª/g,'ª'); // 170 AA
texte = texte.replace(/«/g,'«'); // 171 AB
texte = texte.replace(/¬/g,'¬'); // 172 AC
texte = texte.replace(//g,''); // 173 AD
texte = texte.replace(/®/g,'®'); // 174 AE
texte = texte.replace(/¯/g,'¯'); // 175 AF
texte = texte.replace(/°/g,'°'); // 176 B0
texte = texte.replace(/±/g,'±'); // 177 B1
texte = texte.replace(/²/g,'²'); // 178 B2
texte = texte.replace(/³/g,'³'); // 179 B3
texte = texte.replace(/´/g,'´'); // 180 B4
texte = texte.replace(/µ/g,'µ'); // 181 B5
texte = texte.replace(/¶/g,'¶'); // 182 B6
texte = texte.replace(/·/g,'·'); // 183 B7
texte = texte.replace(/¸/g,'¸'); // 184 B8
texte = texte.replace(/¹/g,'¹'); // 185 B9
texte = texte.replace(/º/g,'º'); // 186 BA
texte = texte.replace(/»/g,'»'); // 187 BB
texte = texte.replace(/¼/g,'¼'); // 188 BC
texte = texte.replace(/½/g,'½'); // 189 BD
texte = texte.replace(/¾/g,'¾'); // 190 BE
texte = texte.replace(/¿/g,'¿'); // 191 BF
texte = texte.replace(/À/g,'À'); // 192 C0
texte = texte.replace(/Á/g,'Á'); // 193 C1
texte = texte.replace(/Â/g,'Â'); // 194 C2
texte = texte.replace(/Ã/g,'Ã'); // 195 C3
texte = texte.replace(/Ä/g,'Ä'); // 196 C4
texte = texte.replace(/Å/g,'Å'); // 197 C5
texte = texte.replace(/Æ/g,'Æ'); // 198 C6
texte = texte.replace(/Ç/g,'Ç'); // 199 C7
texte = texte.replace(/È/g,'È'); // 200 C8
texte = texte.replace(/É/g,'É'); // 201 C9
texte = texte.replace(/Ê/g,'Ê'); // 202 CA
texte = texte.replace(/Ë/g,'Ë'); // 203 CB
texte = texte.replace(/Ì/g,'Ì'); // 204 CC
texte = texte.replace(/Í/g,'Í'); // 205 CD
texte = texte.replace(/Î/g,'Î'); // 206 CE
texte = texte.replace(/Ï/g,'Ï'); // 207 CF
texte = texte.replace(/Ð/g,'Ð'); // 208 D0
texte = texte.replace(/Ñ/g,'Ñ'); // 209 D1
texte = texte.replace(/Ò/g,'Ò'); // 210 D2
texte = texte.replace(/Ó/g,'Ó'); // 211 D3
texte = texte.replace(/Ô/g,'Ô'); // 212 D4
texte = texte.replace(/Õ/g,'Õ'); // 213 D5
texte = texte.replace(/Ö/g,'Ö'); // 214 D6
texte = texte.replace(/×/g,'×'); // 215 D7
texte = texte.replace(/Ø/g,'Ø'); // 216 D8
texte = texte.replace(/Ù/g,'Ù'); // 217 D9
texte = texte.replace(/Ú/g,'Ú'); // 218 DA
texte = texte.replace(/Û/g,'Û'); // 219 DB
texte = texte.replace(/Ü/g,'Ü'); // 220 DC
texte = texte.replace(/Ý/g,'Ý'); // 221 DD
texte = texte.replace(/Þ/g,'Þ'); // 222 DE
texte = texte.replace(/ß/g,'ß'); // 223 DF
texte = texte.replace(/à/g,'à'); // 224 E0
texte = texte.replace(/á/g,'á'); // 225 E1
texte = texte.replace(/â/g,'â'); // 226 E2
texte = texte.replace(/ã/g,'ã'); // 227 E3
texte = texte.replace(/ä/g,'ä'); // 228 E4
texte = texte.replace(/å/g,'å'); // 229 E5
texte = texte.replace(/æ/g,'æ'); // 230 E6
texte = texte.replace(/ç/g,'ç'); // 231 E7
texte = texte.replace(/è/g,'è'); // 232 E8
texte = texte.replace(/é/g,'é'); // 233 E9
texte = texte.replace(/ê/g,'ê'); // 234 EA
texte = texte.replace(/ë/g,'ë'); // 235 EB
texte = texte.replace(/ì/g,'ì'); // 236 EC
texte = texte.replace(/í/g,'í'); // 237 ED
texte = texte.replace(/î/g,'î'); // 238 EE
texte = texte.replace(/ï/g,'ï'); // 239 EF
texte = texte.replace(/ð/g,'ð'); // 240 F0
texte = texte.replace(/ñ/g,'ñ'); // 241 F1
texte = texte.replace(/ò/g,'ò'); // 242 F2
texte = texte.replace(/ó/g,'ó'); // 243 F3
texte = texte.replace(/ô/g,'ô'); // 244 F4
texte = texte.replace(/õ/g,'õ'); // 245 F5
texte = texte.replace(/ö/g,'ö'); // 246 F6
texte = texte.replace(/÷/g,'÷'); // 247 F7
texte = texte.replace(/ø/g,'ø'); // 248 F8
texte = texte.replace(/ù/g,'ù'); // 249 F9
texte = texte.replace(/ú/g,'ú'); // 250 FA
texte = texte.replace(/û/g,'û'); // 251 FB
texte = texte.replace(/ü/g,'ü'); // 252 FC
texte = texte.replace(/ý/g,'ý'); // 253 FD
texte = texte.replace(/þ/g,'þ'); // 254 FE
texte = texte.replace(/ÿ/g,'ÿ'); // 255 FF
return texte;
}
function spipcatchattypo(texte,url,pack)
{
#SET{spipcatchatregex2, [a-z A-Z 0-9]+.png$}
');]
');
texte = texte.replace(/[\W]{1}mdr[^\S]{1}/g,'
');
texte = texte.replace(/[\W]{1}[p]+tdr[^\S]{1}/g,'
');
texte = texte.replace(/_/gi,'
');
texte = texte.replace(/{{{/gi,'');
texte = texte.replace(/}}}/gi,'');
texte = texte.replace(/{{/gi,'');
texte = texte.replace(/}}/gi,'');
texte = texte.replace(/{/gi,'');
texte = texte.replace(/}/gi,'');
texte = texte.replace(/{/gi,'');
texte = texte.replace(/}/gi,'');
return texte;
}
function spipcatchatemoticonpublic(emoticon)
{
$('#message').val($('#message').val()+''+emoticon);
$('#emoticon').trigger("play");
}
function session() {
$(location).attr('href', 'spip.php')
}
function spipcatchatrestartmenu(e, t) {
$('#selectUser').val(e);
$('#auto').val(t)
}
function spipcatchatadduser(e, t) {
(id = $('#selectUser').val()) ? $.ajax({
type: 'POST',
url: t + 'phpscripts/set-users.php',
data: 'id=' + id + '&stat=' + e,
success: function () {
$('#auto').val('');
$('#selectUser').val('');
spipcatchatrest(t)
}
}) : ($('#spipcatchatmembreajout').css('display', 'block'), $('#spipcatchat').css('display', 'none'), setTimeout(function () {
$('#spipcatchatmembreajout').css('display', 'none');
$('#spipcatchat').css('display', 'block')
}, 4000), $('#auto').val(''), $('#selectUser').val(''));
spipcatchatrest(t)
}
function spipcatchatrest(e) {
$.getJSON(e + 'phpscripts/get-users-liste.php', function (e) {
if (0 != e) {
$('#BoxUsers').css('display', 'block');
$('.spipcatchatmembreschat').css('display', 'none');
for (var t in e) $('#idauteurcatchat' + e[t]).css('display', 'block')
} else $('#BoxUsers').css('display', 'none')
})
}
function spipcatchatShowChat(e, t, n, r, i, s, o, u, pack,q,cache) {
$.ajax({
url: e + 'phpscripts/get-autorisation.php',
type: 'POST',
data: 'id_auteur='+t+'&id_salon='+n+'&nom='+encodeURIComponent(s)+'&url='+encodeURIComponent(e)+'&char='+encodeURIComponent(o)+'&historique='+encodeURIComponent(q)+'&catcache='+encodeURIComponent(cache),
success: function (s) {
'1' == s || '4' == s ? (startchat(u, '125000', n, t, e, i, r, o, pack,q), $('#spipcatchatselectsalon').css('display', 'block')) : '2' == s ? (startchat(u, '125000', n, t, e, i, r, o, pack,q), $('#pepoletrash').css('display', 'block'), $('#spipcatchatselectsalon').css('display', 'block')) : '3' == s ? (startchat(u, '125000', n, t, e, i, r, o, pack,q), $('#pepoletrash').css('display', 'block'), $('#pepoleadd').css('display', 'block'), $('#spipcatchatselectsalon').css('display', 'block')) : ($('#spipcatchatsalonprive').css('display', 'block'), setTimeout(function () {
window.location = r
}, 7000))
}
})
}
function spipcatchatsalon(e, t, n, r) {
$.getJSON(e + 'phpscripts/get-selected-salon.php', {
lang: t,
'char': n,
auteur: r
}, function (e) {
$('#spipcatchatselectedsalonchat').html(html_entity_decode(e))
})
}
function spipcatchatShowSalon(e, t, n, r) {
i && clearInterval(i);
spipcatchatsalon(e, t, n, r);
var i = setInterval(function () {
spipcatchatsalon(e, t, n, r)
}, 100000)
}
function logoSpipHidden(e) {
$('.' + e).css('display', 'none')
}
function logoSpipShow(e) {
$('.' + e).css('display', 'block')
}
function quit(e) {
$(location).attr('href', e)
}
function spipcatchattrash(e, t, n, r) {
$('#container').addClass('spipcatchatpause');
$.ajax({
type: 'POST',
url: t + 'phpscripts/set-trash.php',
data: 'char=' + encodeURIComponent(r),
success: function (t) {
1 != t && alert(n + '' + t);
$(location).attr('href', e)
}
})
}
function unlocked(e, t) {
'false' != document.getElementById('public').value ? ($('#public').attr('src', e), $('#public').val('false')) : ($('#public').attr('src', t), $('#public').val('true'))
}
function spipcatchataddsalon(e, t, n) {
var r = encodeURIComponent(htmlentities($('#newSalon').val())),
s = encodeURIComponent($('#public').val()),
o = encodeURIComponent(n[2]),
u = document.getElementsByTagName('option'),
a = 1;
i = 1;
for (y = $('#newSalon').val(); u.length > i; ) {
x = u[i].firstChild.nodeValue;
if (x == '[√] ' + y || x == '[–] ' + y || x == '[x] ' + y) a = 0;
i++
}
r && a ? ($('fieldset').addClass('spipcatchatpause'), $.ajax({
type: 'POST',
url: e + '/phpscripts/set-addsalon.php',
data: 'newsalon=' + r + '&public=' + s + '&catchatid=' + o + '&char=' + encodeURIComponent(n[3]),
success: function () {
alert(n[0]);
$('fieldset').removeClass('spipcatchatpause');
spipcatchatsalon(e, t, n[3], n[2])
}
})) : 0 == a && alert(n[1])
}
function spipcatchathelp(e) {
window.open(e + '/doc/Guide de l utilisateur.pdf', '_blank')
}
function getMessages(e, t, n, r, i, pack,q) {
$.getJSON(n + 'phpscripts/get-message.php', {
auteur: t,
ref: e / 1000,
aucunmessage: r[0],
'char': i,
'h':q,
}, function (e) {
var t = $('#text');
$('#spipcatchatannonce').html('' + e.annonce + '');
$('#text').html(spipcatchattypo(e.messages, n, pack.trim()));
1 != scrollBar && (t[0].scrollTop = t[0].scrollHeight, scrollBar = !0);
void 0 !== t && t[0].childNodes.length > nombreMessage && (t[0].scrollTop = t[0].scrollHeight, $('#soundGet').trigger('play'));
void 0 !== t && (nombreMessage = t[0].childNodes.length)
if(e.cache=="oui"){$('#spipcatchatpointpublic').css('display','block'); }else{$('#spipcatchatpointpublic').css('display','none');}
})
}
function spipcatchatsetmessage(e, t, n, r) {
var i = encodeURIComponent($('#message').val());
$('#message').val('');
$.ajax({
type: 'POST',
url: e + '/phpscripts/set-message.php',
data: 'message=' + i + '&auteur=' + t + '&char=' + encodeURIComponent(n) + '&ref=' + encodeURIComponent(r),
success: function (e) {
$('#soundPost').trigger('play');
$('#soundGet').trigger('stop');
1 != e && $('#responsePost').html(e).slideDown('slow');
$('#message').focus()
},
error: function (e) {
alert('Erreur')
}
})
}
function startchat(e, t, n, r, i, s, o, u, pack,q) {
document.getElementById('message') && (getOnlineUsers(n, r, i, s, o, u), statusStart = window.setInterval(function () {
getOnlineUsers(n, r, i, s, o, u)
}, t), window.setInterval(function () {
getMessages(e, r, i, s, u, pack,q)
}, e), $('#message').focus())
}
function getOnlineUsers(e, t, n, r, i, s) {
$('#SpipCatChatStatus option[value=1]').removeProp('selected'); $('#SpipCatChatStatus option[value=2]').removeProp('selected'); $('#SpipCatChatStatus option[value=3]').removeProp('selected');
$.getJSON(n + 'phpscripts/get-online.php', {
auteur: t,
salon: e
}, function (e) {
if (1 == e.autorisation) {
var r = '', s,o;
for (o in e.list)
'busy' == e.list[o].status ? (texte = 'Occupé(e) [X]', s = 'inactive',
t == e.list[o].id && $('#SpipCatChatStatus option[value=2]').prop('selected', 'selected')) : 'inactive' == e.list[o].status ? (texte = ' Absent(e) [-] ', s = 'neutral',
t == e.list[o].id && $('#SpipCatChatStatus option[value=1]').prop('selected', 'selected')) : (texte = 'En ligne [√]', s = 'active',
t == e.list[o].id && $('#SpipCatChatStatus option[value=3]').prop('selected', 'selected')),
r += ' ' + e.list[o].login + '
';
$('#users').html(r)
} else window.location = i
})
}
function SpipCatChatsetStatus(e, t, n) {
$.ajax({
type: 'POST',
url: n + '/phpscripts/set-status.php',
data: 'status=' + e + '&auteur=' + t,
success: function (e) {
$('#users-td').addClass('spipcatchatpause');
$('#SpipCatChatStatus').addClass('spipcatselectpause');
$('#statutattentechange').css('display', 'block');
$('#statusResponse').html('