forked from lirantal/daloradius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bill-pos-new.php
560 lines (445 loc) · 29.4 KB
/
bill-pos-new.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
<?php
/*
*********************************************************************************************************
* daloRADIUS - RADIUS Web Platform
* Copyright (C) 2007 - Liran Tal <[email protected]> All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*********************************************************************************************************
*
* Authors: Liran Tal <[email protected]>
* Filippo Lauria <[email protected]>
*
*********************************************************************************************************
*/
include("library/checklogin.php");
$operator = $_SESSION['operator_user'];
include('library/config_read.php');
include('library/check_operator_perm.php');
include_once("lang/main.php");
include_once("library/validation.php");
include("library/layout.php");
include_once("include/management/functions.php");
include('include/management/pages_common.php');
// init logging variables
$log = "visited page: ";
$logAction = "";
$logDebugSQL = "";
// if cleartext passwords are not allowed,
// we remove Cleartext-Password from the $valid_passwordTypes array
if (isset($configValues['CONFIG_DB_PASSWORD_ENCRYPTION']) &&
strtolower(trim($configValues['CONFIG_DB_PASSWORD_ENCRYPTION'])) !== 'yes') {
$valid_passwordTypes = array_values(array_diff($valid_passwordTypes, array("Cleartext-Password")));
}
$username = (array_key_exists('username', $_POST) && isset($_POST['username']))
? trim(str_replace("%", "", $_POST['username'])) : "";
$username_enc = (!empty($username)) ? htmlspecialchars($username, ENT_QUOTES, 'UTF-8') : "";
$password = (array_key_exists('password', $_POST) && isset($_POST['password'])) ? trim($_POST['password']) : "";
$passwordType = (array_key_exists('passwordType', $_POST) && isset($_POST['passwordType']) &&
in_array($_POST['passwordType'], $valid_passwordTypes)) ? $_POST['passwordType'] : "";
$profiles = (array_key_exists('profiles', $_POST) && isset($_POST['profiles'])) ? $_POST['profiles'] : array();
$planName = (array_key_exists('planName', $_POST) && isset($_POST['planName']))
? trim(str_replace("%", "", $_POST['planName'])) : "";
$notificationWelcome = (
array_key_exists('notificationWelcome', $_POST) &&
!empty(strtolower(trim($_POST['notificationWelcome']))) &&
in_array(strtolower(trim($_POST['notificationWelcome'])), array("yes", "no"))
) ? strtolower(trim($_POST['notificationWelcome'])) : "yes";
// billing info variables
$bi_contactperson = (array_key_exists('bi_contactperson', $_POST) && isset($_POST['bi_contactperson'])) ? $_POST['bi_contactperson'] : "";
$bi_company = (array_key_exists('bi_company', $_POST) && isset($_POST['bi_company'])) ? $_POST['bi_company'] : "";
$bi_email = (array_key_exists('bi_email', $_POST) && isset($_POST['bi_email'])) ? $_POST['bi_email'] : "";
$bi_phone = (array_key_exists('bi_phone', $_POST) && isset($_POST['bi_phone'])) ? $_POST['bi_phone'] : "";
$bi_address = (array_key_exists('bi_address', $_POST) && isset($_POST['bi_address'])) ? $_POST['bi_address'] : "";
$bi_city = (array_key_exists('bi_city', $_POST) && isset($_POST['bi_city'])) ? $_POST['bi_city'] : "";
$bi_state = (array_key_exists('bi_state', $_POST) && isset($_POST['bi_state'])) ? $_POST['bi_state'] : "";
$bi_country = (array_key_exists('bi_country', $_POST) && isset($_POST['bi_country'])) ? $_POST['bi_country'] : "";
$bi_zip = (array_key_exists('bi_zip', $_POST) && isset($_POST['bi_zip'])) ? $_POST['bi_zip'] : "";
$bi_postalinvoice = (array_key_exists('bi_postalinvoice', $_POST) && isset($_POST['bi_postalinvoice'])) ? $_POST['bi_postalinvoice'] : "";
$bi_faxinvoice = (array_key_exists('bi_faxinvoice', $_POST) && isset($_POST['bi_faxinvoice'])) ? $_POST['bi_faxinvoice'] : "";
$bi_emailinvoice = (array_key_exists('bi_emailinvoice', $_POST) && isset($_POST['bi_emailinvoice'])) ? $_POST['bi_emailinvoice'] : "";
$bi_paymentmethod = (array_key_exists('bi_paymentmethod', $_POST) && isset($_POST['bi_paymentmethod'])) ? $_POST['bi_paymentmethod'] : "";
$bi_cash = (array_key_exists('bi_cash', $_POST) && isset($_POST['bi_cash'])) ? $_POST['bi_cash'] : "";
$bi_creditcardname = (array_key_exists('bi_creditcardname', $_POST) && isset($_POST['bi_creditcardname'])) ? $_POST['bi_creditcardname'] : "";
$bi_creditcardnumber = (array_key_exists('bi_creditcardnumber', $_POST) && isset($_POST['bi_creditcardnumber'])) ? $_POST['bi_creditcardnumber'] : "";
$bi_creditcardverification = (array_key_exists('bi_creditcardverification', $_POST) && isset($_POST['bi_creditcardverification'])) ? $_POST['bi_creditcardverification'] : "";
$bi_creditcardtype = (array_key_exists('bi_creditcardtype', $_POST) && isset($_POST['bi_creditcardtype'])) ? $_POST['bi_creditcardtype'] : "";
$bi_creditcardexp = (array_key_exists('bi_creditcardexp', $_POST) && isset($_POST['bi_creditcardexp'])) ? $_POST['bi_creditcardexp'] : "";
$bi_lead = (array_key_exists('bi_lead', $_POST) && isset($_POST['bi_lead'])) ? $_POST['bi_lead'] : "";
$bi_coupon = (array_key_exists('bi_coupon', $_POST) && isset($_POST['bi_coupon'])) ? $_POST['bi_coupon'] : "";
$bi_ordertaker = (array_key_exists('bi_ordertaker', $_POST) && isset($_POST['bi_ordertaker'])) ? $_POST['bi_ordertaker'] : "";
$bi_notes = (array_key_exists('bi_notes', $_POST) && isset($_POST['bi_notes'])) ? $_POST['bi_notes'] : "";
$bi_changeuserbillinfo = (array_key_exists('changeUserBillInfo', $_POST) && isset($_POST['changeUserBillInfo'])) ? $_POST['changeUserBillInfo'] : "0";
$bi_billstatus = (array_key_exists('bi_billstatus', $_POST) && isset($_POST['bi_billstatus'])) ? $_POST['bi_billstatus'] : "";
$bi_lastbill = (array_key_exists('bi_lastbill', $_POST) && isset($_POST['bi_lastbill'])) ? $_POST['bi_lastbill'] : "";
$bi_nextbill = (array_key_exists('bi_nextbill', $_POST) && isset($_POST['bi_nextbill'])) ? $_POST['bi_nextbill'] : "";
$bi_nextinvoicedue = (array_key_exists('bi_nextinvoicedue', $_POST) && isset($_POST['bi_nextinvoicedue'])) ? $_POST['bi_nextinvoicedue'] : "";
$bi_billdue = (array_key_exists('bi_billdue', $_POST) && isset($_POST['bi_billdue'])) ? $_POST['bi_billdue'] : "";
// user info variables
$firstname = (array_key_exists('firstname', $_POST) && isset($_POST['firstname'])) ? $_POST['firstname'] : "";
$lastname = (array_key_exists('lastname', $_POST) && isset($_POST['lastname'])) ? $_POST['lastname'] : "";
$email = (array_key_exists('email', $_POST) && isset($_POST['email'])) ? $_POST['email'] : "";
$department = (array_key_exists('department', $_POST) && isset($_POST['department'])) ? $_POST['department'] : "";
$company = (array_key_exists('company', $_POST) && isset($_POST['company'])) ? $_POST['company'] : "";
$workphone = (array_key_exists('workphone', $_POST) && isset($_POST['workphone'])) ? $_POST['workphone'] : "";
$homephone = (array_key_exists('homephone', $_POST) && isset($_POST['homephone'])) ? $_POST['homephone'] : "";
$mobilephone = (array_key_exists('mobilephone', $_POST) && isset($_POST['mobilephone'])) ? $_POST['mobilephone'] : "";
$address = (array_key_exists('address', $_POST) && isset($_POST['address'])) ? $_POST['address'] : "";
$city = (array_key_exists('city', $_POST) && isset($_POST['city'])) ? $_POST['city'] : "";
$state = (array_key_exists('state', $_POST) && isset($_POST['state'])) ? $_POST['state'] : "";
$country = (array_key_exists('country', $_POST) && isset($_POST['country'])) ? $_POST['country'] : "";
$zip = (array_key_exists('zip', $_POST) && isset($_POST['zip'])) ? $_POST['zip'] : "";
$notes = (array_key_exists('notes', $_POST) && isset($_POST['notes'])) ? $_POST['notes'] : "";
$ui_changeuserinfo = (array_key_exists('changeuserinfo', $_POST) && isset($_POST['changeuserinfo'])) ? $_POST['changeuserinfo'] : "0";
$ui_enableUserPortalLogin = (array_key_exists('enableUserPortalLogin', $_POST) && isset($_POST['enableUserPortalLogin'])) ? $_POST['enableUserPortalLogin'] : "0";
$ui_PortalLoginPassword = (array_key_exists('portalLoginPassword', $_POST) && isset($_POST['portalLoginPassword'])) ? $_POST['portalLoginPassword'] : "";
function addPlanProfile($dbSocket, $username, $planName) {
global $logDebugSQL;
global $configValues;
// search to see if the plan is associated with any profiles
$sql = "SELECT profile_name FROM ".
$configValues['CONFIG_DB_TBL_DALOBILLINGPLANSPROFILES'].
" WHERE plan_name='$planName'";
$res = $dbSocket->getCol($sql);
// $res is an array of all profiles associated with this plan
// if the profile list for this plan isn't empty, we associate it with the user
if (count($res) != 0) {
// if profiles are associated with this plan, loop through each and add a usergroup entry for each
foreach($res as $profile_name) {
$sql = "INSERT INTO ".$configValues['CONFIG_DB_TBL_RADUSERGROUP']." (UserName,GroupName,priority) ".
" VALUES ('".$dbSocket->escapeSimple($username)."','$profile_name','0')";
$res = $dbSocket->query($sql);
}
return true;
}
return false;
}
function addUserBillInfo($dbSocket, $username) {
global $planName;
global $bi_contactperson;
global $bi_company;
global $bi_email;
global $bi_phone;
global $bi_address;
global $bi_city;
global $bi_state;
global $bi_country;
global $bi_zip;
global $bi_paymentmethod;
global $bi_cash;
global $bi_creditcardname;
global $bi_creditcardnumber;
global $bi_creditcardexp;
global $bi_creditcardverification;
global $bi_creditcardtype;
global $bi_notes;
global $bi_lead;
global $bi_coupon;
global $bi_ordertaker;
global $bi_billstatus;
global $bi_lastbill;
global $bi_nextbill;
global $bi_nextinvoicedue;
global $bi_billdue;
global $bi_postalinvoice;
global $bi_faxinvoice;
global $bi_emailinvoice;
global $bi_changeuserbillinfo;
global $logDebugSQL;
global $configValues;
$currDate = date('Y-m-d H:i:s');
$currBy = $_SESSION['operator_user'];
$sql = "SELECT * FROM ".$configValues['CONFIG_DB_TBL_DALOUSERBILLINFO'].
" WHERE username='".$dbSocket->escapeSimple($username)."'";
$res = $dbSocket->query($sql);
$logDebugSQL .= $sql . "\n";
// if there were no records for this user present in the userbillinfo table
if ($res->numRows() == 0) {
// calculate the nextbill and other related billing information
$sql = "SELECT * FROM ".$configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'].
" WHERE planName='".$dbSocket->escapeSimple($planName)."' LIMIT 1";
$res = $dbSocket->query($sql);
$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
$logDebugSQL .= $sql . "\n";
$planRecurring = $row['planRecurring'];
$planRecurringPeriod = $row['planRecurringPeriod'];
$planRecurringBillingSchedule = $row['planRecurringBillingSchedule'];
// initialize next bill date string (Y-m-d style)
$nextBillDate = "0000-00-00";
// get next billing date
if ($planRecurring == "Yes") {
$nextBillDate = getNextBillingDate($planRecurringBillingSchedule, $planRecurringPeriod);
}
// if $bi_nextbill was not set to anything (empty)
if (empty($bi_nextbill))
$bi_nextbill = $nextBillDate;
// insert user billing information table
$sql = "INSERT INTO ".$configValues['CONFIG_DB_TBL_DALOUSERBILLINFO'].
" (id, planname, username, contactperson, company, email, phone, ".
" address, city, state, country, zip, ".
" paymentmethod, cash, creditcardname, creditcardnumber, creditcardverification, creditcardtype, creditcardexp, ".
" notes, changeuserbillinfo, ".
" `lead`, coupon, ordertaker, billstatus, lastbill, nextbill, nextinvoicedue, billdue, postalinvoice, faxinvoice, emailinvoice, ".
" creationdate, creationby, updatedate, updateby) ".
" VALUES (0, '".$dbSocket->escapeSimple($planName)."',
'".$dbSocket->escapeSimple($username)."', '".$dbSocket->escapeSimple($bi_contactperson)."', '".
$dbSocket->escapeSimple($bi_company)."', '".$dbSocket->escapeSimple($bi_email)."', '".
$dbSocket->escapeSimple($bi_phone)."', '".$dbSocket->escapeSimple($bi_address)."', '".
$dbSocket->escapeSimple($bi_city)."', '".$dbSocket->escapeSimple($bi_state)."', '".
$dbSocket->escapeSimple($bi_country)."', '".
$dbSocket->escapeSimple($bi_zip)."', '".$dbSocket->escapeSimple($bi_paymentmethod)."', '".
$dbSocket->escapeSimple($bi_cash)."', '".$dbSocket->escapeSimple($bi_creditcardname)."', '".
$dbSocket->escapeSimple($bi_creditcardnumber)."', '".$dbSocket->escapeSimple($bi_creditcardverification)."', '".
$dbSocket->escapeSimple($bi_creditcardtype)."', '".$dbSocket->escapeSimple($bi_creditcardexp)."', '".
$dbSocket->escapeSimple($bi_notes)."', '".
$dbSocket->escapeSimple($bi_changeuserbillinfo)."', '".
$dbSocket->escapeSimple($bi_lead)."', '".$dbSocket->escapeSimple($bi_coupon)."', '".
$dbSocket->escapeSimple($bi_ordertaker)."', '".$dbSocket->escapeSimple($bi_billstatus)."', '".
$dbSocket->escapeSimple($bi_lastbill)."', '".$dbSocket->escapeSimple($bi_nextbill)."', '".
$dbSocket->escapeSimple($bi_nextinvoicedue)."', '".$dbSocket->escapeSimple($bi_billdue)."', '".
$dbSocket->escapeSimple($bi_postalinvoice)."', '".$dbSocket->escapeSimple($bi_faxinvoice)."', '".
$dbSocket->escapeSimple($bi_emailinvoice).
"', '$currDate', '$currBy', NULL, NULL)";
$res = $dbSocket->query($sql);
$logDebugSQL .= $sql . "\n";
$user_id = $dbSocket->getOne( "SELECT LAST_INSERT_ID() FROM `".$configValues['CONFIG_DB_TBL_DALOUSERBILLINFO']."`" );
return $user_id;
} //FIXME:
//if the user already exist in userinfo then we should somehow alert the user
//that this has happened and the administrator/operator will take care of it
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (array_key_exists('csrf_token', $_POST) && isset($_POST['csrf_token']) && dalo_check_csrf_token($_POST['csrf_token'])) {
// required later
$currDate = date('Y-m-d H:i:s');
$currBy = $operator;
include('library/opendb.php');
// check if username is already present in the radcheck table
$userExists = user_exists($dbSocket, $username);
if ($userExists) {
$failureMsg = "user already exist in database: <b> $username </b>";
$logAction .= "Failed adding new user already existing in database [$username] on page: ";
} else {
// username and password are required
if (empty($username) || empty($password)) {
$failureMsg = "username or password are empty";
$logAction .= "Failed adding (possible empty user/pass) new user [$username] on page: ";
} else {
// we "inject" the prepared password/auth attribute in the $_POST array.
// handleAttributes() - called later - will take care of it.
$_POST['injected_attribute'] = array( $passwordType, $password, ':=', 'check' );
include("library/attributes.php");
$skipList = array(
"username", "password", "passwordType", "profiles", "planName", "notificationWelcome",
"macaddress", "pincode", "submit", "firstname", "lastname", "email",
"department", "company", "workphone", "homephone", "mobilephone", "address", "city",
"state", "country", "zip", "notes", "bi_contactperson", "bi_company", "bi_email", "bi_phone",
"bi_address", "bi_city", "bi_state", "bi_country", "bi_zip", "bi_paymentmethod", "bi_cash",
"bi_creditcardname", "bi_creditcardnumber", "bi_creditcardverification", "bi_creditcardtype",
"bi_creditcardexp", "bi_notes", "bi_lead", "bi_coupon", "bi_ordertaker", "bi_billstatus",
"bi_lastbill", "bi_nextbill", "bi_nextinvoicedue", "bi_billdue", "bi_postalinvoice", "bi_faxinvoice",
"bi_emailinvoice", "changeUserBillInfo", "changeUserInfo", "copycontact", "portalLoginPassword",
"enableUserPortalLogin", "csrf_token", "submit"
);
$attributesCount = handleAttributes($dbSocket, $username, $skipList);
$groupsCount = insert_multiple_user_group_mappings($dbSocket, $username, $profiles);
// adding user info
$params = array(
"firstname" => $firstname,
"lastname" => $lastname,
"email" => $email,
"department" => $department,
"company" => $company,
"workphone" => $workphone,
"homephone" => $homephone,
"mobilephone" => $mobilephone,
"address" => $address,
"city" => $city,
"state" => $state,
"country" => $country,
"zip" => $zip,
"notes" => $notes,
"changeuserinfo" => $ui_changeuserinfo,
"enableuserportallogin" => $ui_enableUserPortalLogin,
"portalloginpassword" => $ui_PortalLoginPassword,
"creationdate" => $currDate,
"creationby" => $currBy,
);
$addedUserInfo = (add_user_info($dbSocket, $u, $params)) ? "stored" : "nothing to store";
addPlanProfile($dbSocket, $username, $planName);
$userbillinfo_id = addUserBillInfo($dbSocket, $username);
// create any invoices if required (meaning, if a plan was chosen)
if ($planName) {
include_once("include/management/userBilling.php");
// get plan information
$sql = "SELECT id, planCost, planSetupCost, planTax FROM ".$configValues['CONFIG_DB_TBL_DALOBILLINGPLANS'].
" WHERE planName='".$dbSocket->escapeSimple($planName)."' LIMIT 1";
$res = $dbSocket->query($sql);
$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
// calculate tax (planTax is the numerical percentage amount)
$calcTax = (float) ($row['planCost'] * (float)($row['planTax'] / 100) );
$invoiceItems[0]['plan_id'] = $row['id'];
$invoiceItems[0]['amount'] = $row['planCost'];
$invoiceItems[0]['tax'] = $calcTax;
$invoiceItems[0]['notes'] = 'charge for plan service';
if (isset($row['planSetupCost']) && ($row['planSetupCost'] != '') ) {
$calcTax = (float) ($row['planSetupCost'] * (float)($row['planTax'] / 100) );
$invoiceItems[1]['plan_id'] = $row['id'];
$invoiceItems[1]['amount'] = $row['planSetupCost'];
$invoiceItems[1]['tax'] = $calcTax;
$invoiceItems[1]['notes'] = 'charge for plan setup fee (one time)';
}
userInvoiceAdd($userbillinfo_id, array(), $invoiceItems);
}
$successMsg = sprintf('Inserted new user <strong>%s</strong>: ', $username_enc)
. sprintf('<a href="bill-pos-edit.php?username=%s" title="Edit">%s</a>',
$username_enc, urlencode($username_enc))
. '<ul style="color: black">'
. sprintf("<li><strong>attributes count</strong>: %d</li>", $attributesCount)
. sprintf("<li><strong>groups count</strong>: %d</li>", $groupsCount)
. sprintf("<li><strong>user info</strong>: %s</li>", $addedUserInfo)
. "</ul>";
$logAction .= sprintf("Successfully inserted new %s [%s] on page: ", $what, $u);
}
}
include('library/closedb.php');
} else {
// csrf
$failureMsg = "CSRF token error";
$logAction .= "$failureMsg on page: ";
}
}
include_once('library/config_read.php');
$hiddenPassword = (strtolower($configValues['CONFIG_IFACE_PASSWORD_HIDDEN']) == "yes")
? 'password' : 'text';
// print HTML prologue
$extra_css = array(
// css tabs stuff
"css/tabs.css"
);
$extra_js = array(
"library/javascript/ajax.js",
"library/javascript/ajaxGeneric.js",
"library/javascript/productive_funcs.js",
"library/javascript/dynamic_attributes.js",
// js tabs stuff
"library/javascript/tabs.js"
);
$title = t('Intro','billposnew.php');
$help = t('helpPage','billposnew');
print_html_prologue($title, $langCode, $extra_css, $extra_js);
include("menu-bill-pos.php");
echo '<div id="contentnorightbar">';
print_title_and_help($title, $help);
include_once('include/management/actionMessages.php');
if (!isset($successMsg)) {
include_once('include/management/populate_selectbox.php');
// set navbar stuff
$navkeys = array( 'AccountInfo', 'UserInfo', 'BillingInfo' );
// print navbar controls
print_tab_header($navkeys);
open_form();
// open 0-th tab (shown)
open_tab($navkeys, 0, true);
// open 0-th fieldset
$fieldset0_descriptor = array(
"title" => t('title','AccountInfo'),
);
open_fieldset($fieldset0_descriptor);
$input_descriptors0 = array();
$input_descriptors0[] = array(
"name" => "username",
"caption" => t('all','Username'),
"type" => "text",
"value" => ((isset($failureMsg)) ? $username : ""),
"random" => true,
"tooltipText" => t('Tooltip','usernameTooltip')
);
$input_descriptors0[] = array(
"name" => "password",
"caption" => t('all','Password'),
"type" => $hiddenPassword,
"value" => "",
"random" => true,
"tooltipText" => t('Tooltip','passwordTooltip')
);
$input_descriptors0[] = array(
"name" => "passwordType",
"caption" => t('all','PasswordType'),
"options" => $valid_passwordTypes,
"type" => "select",
"selected_value" => ((isset($failureMsg)) ? $passwordType : ""),
);
$options = get_active_plans();
array_unshift($options, '');
$input_descriptors0[] = array(
"name" => "planName",
"caption" => t('all','PlanName'),
"type" => "select",
"tooltipText" => t('Tooltip','planNameTooltip'),
"options" => $options,
"selected_value" => ((isset($failureMsg)) ? $planName : ""),
);
$options = get_groups();
array_unshift($options, '');
$input_descriptors0[] = array(
"type" =>"select",
"name" => "profiles[]",
"id" => "profiles",
"caption" => t('all','Profile'),
"options" => $options,
"multiple" => true,
"size" => 5,
"selected_value" => ((isset($failureMsg)) ? $groups : ""),
"tooltipText" => t('Tooltip','groupTooltip')
);
$input_descriptors0[] = array(
"name" => "notificationWelcome",
"caption" => t('all','SendWelcomeNotification'),
"type" => "select",
"options" => array( "yes", "no" ),
"selected_value" => ((isset($failureMsg)) ? $notificationWelcome : "yes"),
);
foreach ($input_descriptors0 as $input_descriptor) {
print_form_component($input_descriptor);
}
close_fieldset();
close_tab($navkeys, 0);
// open 1-st tab
open_tab($navkeys, 1);
//~ $customApplyButton = sprintf('<input type="submit" name="submit" value="%s" class="button">', t('buttons','apply'));
include_once('include/management/userinfo.php');
close_tab($navkeys, 1);
// open 2-nd tab
open_tab($navkeys, 2);
//~ $customApplyButton = sprintf('<input type="submit" name="submit" value="%s" class="button">', t('buttons','apply'));
include_once('include/management/userbillinfo.php');
close_tab($navkeys, 2);
$input_descriptors1 = array();
$input_descriptors1[] = array(
"name" => "csrf_token",
"type" => "hidden",
"value" => dalo_csrf_token(),
);
$input_descriptors1[] = array(
"type" => "submit",
"name" => "submit",
"value" => t('buttons','apply')
);
foreach ($input_descriptors1 as $input_descriptor) {
print_form_component($input_descriptor);
}
close_form();
}
print_back_to_previous_page();
include('include/config/logging.php');
print_footer_and_html_epilogue();
?>