-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_user_settings.php
90 lines (79 loc) · 2.18 KB
/
update_user_settings.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?
include("common.php");
include("config.php");
//session_start();
$hash = $_COOKIE['hash'];
$id = $_COOKIE['id'];
if(strlen($id) < 2){
$id = 0;
}
$logged_in = false;
if($hash == md5($id.$salt)){
$logged_in = true;
}
if($logged_in == false){
echo '{"error":"need to login", "status":"error"}';
exit;
}
$key = fixString($_POST['key']);
$value = fixString($_POST['value']);
$sub_value = fixString($_POST['sub_value']);
if(!$sub_value){
$sub_value = null;
}
dboUpdateUserSettings($id, $key, $value, $sub_value);
if(!$sub_value){
echo '{"status":"success","key":"'.$key.'","value":"'.$value.'"}';
}else{
echo '{"status":"success","key":"'.$key.'","value":"'.$value.'", "sub_value":"'.$sub_value.'"}';
}
exit;
$date = fixString( $_GET['date'] );
$time = fixString( $_GET['time'] );
if($time == ""){
$all_day = " checked ";
}
if($_POST){
echo "Process request";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?echo $site_title;?> </title>
<link rel="stylesheet" type="text/css" href="css/main.css" media="screen" />
<script type='text/javascript' src='<?echo $jquery_path;?>'></script>
<script type='text/javascript'>
$(document).ready(function() {
$("input:radio").click(function() {
var full_role = $(this).attr('id');
$.post("post.php", { "full_role": full_role },
function(data){
alert(data.full_role); // John
//console.log(data.time); // 2pm
}, "json");
});
});
</script>
</head>
<body>
<?
drawHeader($id);
$results = getOus($id);
foreach($results as $item){
echo "<b>".$item['long_name']."</b>";
echo "<br />";
$roles = getRoles($id, $item['ou_code']);
foreach($roles as $role){
$full_role = $item['ou_code']."/".$role['role'];
//echo "<span class=\"roles\" id=\"".$item['ou_code']."/".$role['role']."\">+</span>";
echo "<input type=\"radio\" name=\"default_role\" value=\"\" class=\"roles\" id=\"$full_role\" />";
echo "<label for=\"$full_role\">";
echo $role['long_name'];
echo "</label>";
echo "<br />\n";
}
}
?>