Mercurial > hg > fapweb
annotate usrajax.js.php @ 1096:bbc0a3d0b51e
Major renaming / refactor of site messages. Some that were previously
modifiable from admin interface are now "hardcoded" in the configuration
file. Having these settings made modifiable from there made no sense
and just took space in the UI.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Jan 2017 22:15:06 +0200 |
parents | 01783161eeb2 |
children |
rev | line source |
---|---|
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 <?php |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 // |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 // FAPWeb - Simple Web-based Demoparty Management System |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 // User actions page AJAX javascript module |
1072 | 5 // (C) Copyright 2012-2017 Tecnic Software productions (TNSP) |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 // |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 $sessionType = "user"; |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
8 header("Content-Type: application/javascript"); |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 require_once "mconfig.inc.php"; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 require_once "msite.inc.php"; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 require_once "msession.inc.php"; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
14 // Initiate SQL database connection |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
15 if (!stConnectSQLDB()) |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 exit; |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
18 // Fetch non-"hardcoded" settings from SQL database |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
19 stReloadSettings(); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
20 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
21 stUserSessionAuth(); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
22 |
1069
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 stCommonAJAX("usrajax.php", "usrlogout.php"); |
5f92fa5e683a
Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 |
1085
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
25 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
26 ?> |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
27 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
28 function updateVote(eid, value) |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
29 { |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
30 var msuccess = function(txt) |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
31 { |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
32 } |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
33 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
34 var mfail = function(txt) |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
35 { |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
36 jsMessageBox("<h1>Ooops, an error occured</h2><p>Something went wrong, votes might not be submitted. :(</p>"); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
37 } |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
38 |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
39 jsSendPOSTRequest("action=set&entry_id="+eid+"&vote="+value, msuccess, mfail); |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
40 return false; |
01783161eeb2
Fix usr and adm ajax and voting.
Matti Hamalainen <ccr@tnsp.org>
parents:
1072
diff
changeset
|
41 } |