/
add_invitee.php
131 lines (100 loc) · 3.22 KB
/
add_invitee.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?
/*
*/
require 'prepend.php';
require 'Smarty.class.php';
require 'lib/nav.php';
require 'data_layer/Invitee.php';
function add_invitee() {
global $log, $conference_id, $_POST,$data;
$msgs = array();
$msgs[] = "no dice";
if ($_POST[invitee_flag] =='C'){
$msgs[] = "Company";
$invitee = new Invitee($data->db,$_POST[conference_id]) ;
$invitee->username = $_POST[invitee_username] ;
if (!$invitee->getInfoFromUserName() ) {
$msgs[] = "Could not find all Invitee info by username, please enter info by hand.";
return $msgs;
}
} elseif ($_POST[invitee_flag] =='O') {
if (!$_POST[invitee_email] ) {
$msgs[] = "No Invitee email";
return $msgs;
}
$invitee = new Invitee($data->db,$_POST[conference_id]) ;
$invitee->inviteeName = $_POST[invitee_name] ;
$invitee->inviteeEmail = $_POST[invitee_email] ;
}
if ($invitee->isMaxInvitee()) {
$msgs[] = "This Invitee is exceeds the maximum capacity of " . $invitee->companyMaxInvitee . " for your company.";
return $msgs;
}
$invitee->generateInviteeCode();
$invitee->create();
$invitee->sendNotify();
header("Location: cdetails.php?conference_id=$conference_id&func=view");
return $msgs;
}
put_headers();
// get db connect
$data = CData_Layer::create($errors) ;
// get the sess, auth and perm vars
page_open (array("sess" => "phplib_Session_Pre_Auth",
"auth" => "phplib_Pre_Auth",
"perm" => "phplib_Perm"));
## do this in every file after the page_open
$perm->check('USER');
if ($perm->have_perm('SUPER')) {
change_domain();
}
//Check persmissions
$qdomains = array();
if ($perm->have_perm('SUPER')){
$qdomains[0] = 'ALL';
global $adomain;
if ($FORM_VARS[domain]) {
$qdomains[0] = $FORM_VARS[domain];
} elseif ($adomain) {
$qdomains[0] = $adomain;
}
} elseif ($perm->have_perm('RESELLER') ) {
## HEre we'd query the reseller domains $qdomain[] = $auth->
} elseif ($perm->have_perm('ADMIN') ) {
$qdomains[] = $auth->auth[udomain];
}
if ($_POST[conference_id]) {
$conference_id = $_POST[conference_id] ;
} elseif ($_GET[conference_id]) {
$conference_id = $_GET[conference_id] ;
}
if (!$data->is_conference_owner($conference_id,$auth->auth["uname"]) ) {
header('Location: conference.php');
}
$header_smarty = get_smarty_header($data, $auth, $perm);
$smarty = get_smarty();
if ($_POST[add_invitee] ) {
$msgs = add_invitee();
}
if ($_POST[invitee_flag]) {
$invitee_flag =$_POST[invitee_flag];
} else {
$invitee_flag ='O';
}
$smarty->assign('msgs', $msgs);
$log->log("get_conference_ids " . $auth->auth["uname"] );
$invitee_users = $data->get_invitee_users($auth->auth["udomain"] ) ;
##$smarty->assign('user_conferences', $ids);
$smarty->assign('conference_id', $conference_id);
$smarty->assign('invitee_users', $invitee_users);
$smarty->assign('invitee_flag', $invitee_flag);
$smarty->assign('invitee_username', $_POST[invitee_username]);
$smarty->assign('invitee_name', $_POST[invitee_name]);
$smarty->assign('invitee_email', $_POST[invitee_email]);
$footer_smarty = get_smarty();
$header_smarty->display('app_header.tpl');
$smarty->display('add_invitee.tpl');
$footer_smarty->display('app_footer.tpl');
// freeze the session
page_close();
?>