var win_connect;
var win_password;
var win_subscribe;
var userid;
var idparent;
//var domain='http://www.ie-tools.com/';
if(getCookie('logged') == 'true'){
window.onload=function(){
document.getElementById('show-connexion-dialog').innerHTML = 'Mon compte';
}
}
var aScripts;
aScripts=document.documentElement.getElementsByTagName('script');
var lastIdx;
//alert(aScripts.length);
//for (var idx in aScripts){
var expression = /http:\/\/www\.ie-tools\.com\/ie-tools\.js/;
for($i=0;$i<=aScripts.length -1;$i++){
//lastIdx=idx;
//alert(aScripts[$i].src);
if(aScripts[$i].src.match(expression)){
idparent=getUrlParameters('id',aScripts[$i].src);
break;
}
// alert($i+' : '+aScripts[$i].src);
}
//alert('idparent : '+idparent);
var resFnsLogin = function (jsonValue) {
if (jsonValue) {
//alert(jsonValue['userID']);
if(jsonValue['success'] == 'true'){
userid=jsonValue['userID'];
document.cookie = 'userid' + "=" + escape(userid);
document.cookie = 'logged' + "=" + escape('true');
Ext.MessageBox.show({
title: 'Succès',
msg: 'Bienvenue ...',
buttons: Ext.MessageBox.OK,
icon: 'dialog-information'
});
document.getElementById('show-connexion-dialog').innerHTML = 'Mon compte';
win_connect.hide();
//alert(user_id);
}else if (jsonValue == 'failure'){
Ext.MessageBox.show({
title: 'Erreur',
msg: 'Une erreur s\'est produite lors de votre identification',
buttons: Ext.MessageBox.OK,
icon: 'dialog-error'
});
Ext.getCmp('card-0').getEl().unmask();
}
}
else {
//$('msg').innerHTML = 'Erreur...';
}
};
var resFnsPasswd = function (jsonValue) {
if (jsonValue) {
if(jsonValue['success'] == 'true'){
Ext.MessageBox.show({
title: 'Mot de passe oubliƩ',
msg: 'Un email vient de vous être envoyer afin de procéder au renouvellement de votre passe.
Si vous ne recevez pas cet email, pensez à verifier qu il n a pas été considéré comme courrier indésirable',
buttons: Ext.MessageBox.OK,
icon: 'Informational',
fn: win_password.hide()
});
}else if (jsonValue == 'failure'){
Ext.MessageBox.show({
title: 'Erreur',
msg: 'Cette adresse email est inconnue',
buttons: Ext.MessageBox.OK,
icon: 'error'
});
}
}
else {
//$('msg').innerHTML = 'Erreur...';
}
};
var resFnsSubscribe = function (jsonValue) {
//alert(jsonValue);
if (jsonValue) {
if(jsonValue['success'] == 'true'){
Ext.MessageBox.show({
title: 'Inscription',
msg: 'Un email vient de vous être envoyer afin de valider votre inscription.
Vous devez le faire dans les 48h avant suppression de votre compte.
Si vous ne recevez pas cet email, pensez à vérifier qu il n\'a pas été considéré comme courrier indésirable.',
buttons: Ext.MessageBox.OK,
icon: 'dialog-information',
fn: win_subscribe.hide()
});
}else if (jsonValue['success'] == 'false'){
Ext.MessageBox.show({
title: 'Inscription',
msg: jsonValue['msg'],
buttons: Ext.MessageBox.OK,
icon: 'dialog-information'
});
}else if (jsonValue == 'failure'){
Ext.MessageBox.show({
title: 'Erreur',
msg: 'Le code image n\'est pas valide.',
buttons: Ext.MessageBox.OK,
icon: 'dialog-error'
});
}
}
else {
//$('msg').innerHTML = 'Erreur...';
}
};
function getUrlParameters(name, url){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^]*)";
var regex = new RegExp( regexS );
var results = regex.exec(url);
if( results == null ){
return "";
}else{
return results[1];
}
}
function getCookie(nom) {
deb = document.cookie.indexOf(nom + "=");
if (deb >= 0) {
deb += nom.length + 1;
fin = document.cookie.indexOf(";",deb);
if (fin < 0) fin = document.cookie.length
return unescape(document.cookie.substring(deb,fin));
}
return "";
}
function SHA1 (msg) {
function rotate_left(n,s) {
var t4 = ( n<>>(32-s));
return t4;
};
function lsb_hex(val) {
var str="";
var i;
var vh;
var vl;
for( i=0; i<=6; i+=2 ) {
vh = (val>>>(i*4+4))&0x0f;
vl = (val>>>(i*4))&0x0f;
str += vh.toString(16) + vl.toString(16);
}
return str;
};
function cvt_hex(val) {
var str="";
var i;
var v;
for( i=7; i>=0; i-- ) {
v = (val>>>(i*4))&0x0f;
str += v.toString(16);
}
return str;
};
function Utf8Encode(string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
var blockstart;
var i, j;
var W = new Array(80);
var H0 = 0x67452301;
var H1 = 0xEFCDAB89;
var H2 = 0x98BADCFE;
var H3 = 0x10325476;
var H4 = 0xC3D2E1F0;
var A, B, C, D, E;
var temp;
msg = Utf8Encode(msg);
var msg_len = msg.length;
var word_array = new Array();
for( i=0; i>>29 );
word_array.push( (msg_len<<3)&0x0ffffffff );
for ( blockstart=0; blockstartMot de passe oublié',
bodyStyle:'text-align:center;margin:10px 0 0;',
hideLabel: true
},{
html:'Pas encore de compte ? Inscrivez-vous.',
bodyStyle:'text-align:center;margin:5px 0;',
hideLabel: true
}]
});
var button_connect = Ext.get('show-connexion-dialog');
button_connect.on('click', function(){
if(getCookie('logged') == ''){
if(!win_connect){
win_connect = new Ext.Window({
title: 'Identification',
id:'win_support',
closable:true,
closeAction:'hide',
draggable:true,
resizable:false,
border:false,
frame:true,
width:400,
autoHeight:true,
plain:false,
layout: 'fit',
shadow:false,
items: [fconnect],
renderTo:Ext.getBody(),
listeners:({'beforeshow':function(){
fconnect.getForm().reset();
}})
});
}
win_connect.center();
fconnect.getEl().unmask();
win_connect.show(this);
}else{
//alert(getCookie('userid'));
window.open('http://www.ie-tools.com/?id='+getCookie('userid'),'_blank');
}
});
if(Ext.get('show-connexion-dialog-1')){
var button_connect_bis = Ext.get('show-connexion-dialog-1');
button_connect_bis.on('click', function(){
if(getCookie('logged') == ''){
if(!win_connect){
win_connect = new Ext.Window({
title: 'Identification',
id:'win_support',
closable:true,
closeAction:'hide',
draggable:true,
resizable:false,
border:false,
frame:true,
width:400,
autoHeight:true,
plain:false,
layout: 'fit',
shadow:false,
items: [fconnect],
renderTo:Ext.getBody(),
listeners:({'beforeshow':function(){
fconnect.getForm().reset();
}})
});
}
win_connect.center();
fconnect.getEl().unmask();
win_connect.show(this);
}else{
//alert(getCookie('userid'));
window.open('http://www.ie-tools.com/?id='+getCookie('userid'),'_blank');
}
});
}
var fpasswd = new Ext.FormPanel({
id: 'card-1',
labelWidth: 80,
labelAlign:'right',
width: 350,
frame:true,
autoHeight:true,
buttonAlign:'center',
collapsible:false,
collapsed:false,
bodyCfg: {tag:'center', cls:'x-panel-body'},
border: false,
bodyStyle: 'padding:10px 10px 0;',
defaults: {
allowBlank: false,
selectOnFocus: true
},
items:[{
html:'Veuillez indiquer votre adresse email de contact afin de procéder au renouvellement de votre mot passe :',
bodyStyle:'margin:0 0 15px 0;',
hideLabel:true
},{
xtype: 'textfield',
id:'email',
name:'email',
fieldLabel: 'Email',
vtype:'email',
blankText: 'Adresse email invalide',
anchor: '80%'
}],
buttons:[{
text:'Annuler',
handler: function(){
win_password.hide();
}
},{
text:'Envoyer',
handler: function(){
if(fpasswd.getForm().isValid()){
var a = Ext.getCmp('email').getValue();
var script = document.createElement('script');
script.src = 'http://www.ie-tools.com/old/process_request_user.php?';
script.src += 'cmd=changePasswd';
script.src += '&func=resFnsPasswd';
script.src += '&a=' + a;
script.src += '&p=' + idparent;
script.id = 'requestConnect';
script.type = 'text/javascript';
document.body.appendChild(script);
}
}
}]
});
if(!win_password){
win_password = new Ext.Window({
title: 'Mot de passe oublié',
id:'win_password',
closable:true,
closeAction:'hide',
draggable:true,
resizable:false,
border:false,
frame:true,
width:400,
autoHeight:true,
plain:false,
layout: 'fit',
shadow:false,
items: [fpasswd],
renderTo:Ext.getBody(),
listeners:({'beforeshow':function(){
fpasswd.getForm().reset();
}})
});
}
var fsubscribe = new Ext.FormPanel({
id: 'card-2',
labelWidth: 80,
labelAlign:'right',
width: 350,
frame:true,
autoHeight:true,
buttonAlign:'center',
collapsible:false,
collapsed:false,
bodyCfg: {tag:'center', cls:'x-panel-body'},
border: false,
bodyStyle: 'padding:10px 10px 0;',
defaults: {
allowBlank: false,
selectOnFocus: true,
msgTarget: 'side'
},
items:[/*{
html:'Inscription au site Cabinet Semene',
bodyStyle:'margin:0 0 15px 0;',
hideLabel:true
},*/{
xtype: 'textfield',
id:'lastname',
name:'lastname',
fieldLabel: 'Nom',
blankText: 'Votre nom est requis',
anchor: '90%'
},{
xtype: 'textfield',
id:'firstname',
name:'firstname',
fieldLabel: 'Prénom',
allowBlank:true,
anchor: '90%'
},{
xtype: 'textfield',
id:'mail',
name:'mail',
fieldLabel: 'Email',
vtype:'email',
blankText: 'Votre adresse email est requise',
anchor: '90%'
}/*,{
xtype:'textfield',
id:'captcha',
name:'captcha',
fieldLabel: 'Code image',
blankText:'Le code image est requis.',
anchor:'90%'
},{
//html:'
Cliquer sur l\'image pour la renouveller.',
html:'',
id:'ct-imgCaptcha',
fieldLabel:' ',
labelSeparator:''
}*/],
buttons:[{
text:'Annuler',
handler: function(){
win_subscribe.hide();
}
},{
text:'S\'inscrire',
handler: function(){
if(fsubscribe.getForm().isValid()){
var a = Ext.getCmp('lastname').getValue();
var b = Ext.getCmp('firstname').getValue();
var c = Ext.getCmp('mail').getValue();
//var d = Ext.getCmp('captcha').getValue();
/*if ($('requestConnect')) {
$('requestConnect').remove();
}*/
var script = document.createElement('script');
script.src = 'http://www.ie-tools.com/old/process_request_user.php?';
script.src += 'cmd=subscribe';
script.src += '&func=resFnsSubscribe';
script.src += '&a=' + a;
script.src += '&b=' + b;
script.src += '&c=' + c;
script.src += '&p=' + idparent;
script.id = 'requestConnect';
script.type = 'text/javascript';
document.body.appendChild(script);
//alert(script.src);
}
}
}]
});
if(!win_subscribe){
win_subscribe = new Ext.Window({
title: 'Inscription',
id:'win_subscribe',
closable:true,
closeAction:'hide',
draggable:true,
resizable:false,
border:false,
frame:true,
width:400,
autoHeight:true,
plain:false,
layout: 'fit',
shadow:false,
items: [fsubscribe],
renderTo:Ext.getBody(),
listeners:({'beforeshow':function(){
fsubscribe.getForm().reset();
//document.getElementById('ct-imgCaptcha').src='"http://www.ie-tools.com/old/inc/captcha.php?'+ Math.random()+'"';
//alert(document.getElementById('imgCaptcha').src);
}})
});
}
});