summaryrefslogtreecommitdiffstats
path: root/ajax/scores.ajax.php
blob: c30446579f5204967ed79e4819ef799ac8e53e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?
session_start();

//$userID = $_SESSION['userID'];

require('../includes/maps.php');
require('../includes/mapclass.php');
require('../includes/datas.php');
include_once('../includes/sqlEmbedded.php');

$tmp = explode('.', $_GET['r']);
$args = explode('_', $tmp[0]);
$mapID = $args[0] * 1;
$page = $args[1] * 1;

if (!is_int($mapID) OR !is_int($page)) return;

//Include the notification text
$json = getScores($mapID, $page, 10);
$json['mapid'] = $mapID;
$json['page'] = $page;

//TODO: Show notifications someplace else!
$note = false;
if (isset($_SESSION['accepted']) AND $_SESSION['accepted'] == 1) {
	$userID = $_SESSION['userID'];
	$note = getNotified($userID);
} else {
	if (
			isset($_SESSION['preCompletedTutorial']) &&
			$_SESSION['preCompletedTutorial'] == true && 
			$_SESSION['preCompletedTutorialNotified'] == false) {
		$_SESSION['preCompletedTutorialNotified'] = true;
		$note = "<strong>Tutorial Completed!</strong>";
		$note .= "<center>You've unlocked: Blue Wall Color!";
		$note .= "<table><tr><td onclick='changeWallColor(\"#4444ff\")' style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table>";
		$note .= '<br /><a href="javascript:showSignin();"><strong>Sign in</strong></a> to save your progress!<br />';
		$note .= "</center>";
	}
}
if ($note !== false) $json['notificationtext'] = $note;

echo json_encode($json);

?>