Mercurial > hg > fapweb
changeset 686:8730bffcffd4
Add new return code 903 and handling for it.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 09 Nov 2014 20:36:01 +0200 |
parents | b05376c7ece8 |
children | a38eab6f2bd2 |
files | admajax.php majax.inc.php |
diffstat | 2 files changed, 29 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Sun Nov 09 19:24:18 2014 +0200 +++ b/admajax.php Sun Nov 09 20:36:01 2014 +0200 @@ -538,7 +538,9 @@ // if (!stCheckHTTPS() || !stAdmSessionAuth() || !stCSRFCheck()) { + stSetStatus(903, "Session expired."); stSetupCacheControl(); + stDumpAJAXStatusErrors(); stSessionEnd(SESS_ADMIN);
--- a/majax.inc.php Sun Nov 09 19:24:18 2014 +0200 +++ b/majax.inc.php Sun Nov 09 20:36:01 2014 +0200 @@ -115,35 +115,34 @@ { if (req.readyState == 4) { - if (req.status == 404) - { - window.location = "<? echo $failover ?>"; - } - else - if (req.status == 902) - { - statusMsg(req.statusText); - jsMessageBox(req.responseText); - } - else - if (req.status == 200) + switch (req.status) { - if (success) - { - success(req.responseText); - } - statusMsg(req.statusText); - } - else - { - if (failure) - { - failure(req.status, req.statusText, req.responseText); - } - else - { - statusMsg("["+req.status+" - "+req.statusText+"] "+ req.responseText); - } + case 404: + window.location = "<? echo $failover ?>"; + break; + + case 902: + statusMsg(req.statusText); + jsMessageBox(req.responseText); + break; + + case 903: + var nitem = document.getElementById("adminContent"); + if (nitem) nstatus.innerHTML = req.responseText; + break; + + case 200: + if (success) + success(req.responseText); + statusMsg(req.statusText); + break; + + default: + if (failure) + failure(req.status, req.statusText, req.responseText); + else + statusMsg("["+req.status+" - "+req.statusText+"] "+ req.responseText); + break; } } }