author | Dan Fuhry <dan@enanocms.org> |
Mon, 11 Apr 2016 11:23:30 -0400 | |
changeset 11 | b9eb748ac1e4 |
parent 9 | d58bafde2a92 |
permissions | -rw-r--r-- |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
2 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
3 |
function page_Special_YMS() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
4 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
5 |
global $db, $session, $paths, $template, $plugins; // Common objects |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
6 |
global $lang; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
7 |
global $output; |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
8 |
global $yms_client_id; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
9 |
|
8
be4a5f24bb29
Add support for freezing the YMS client ID
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
10 |
$yms_client_id = ($force_cid = getConfig('yms_force_client_id', 0)) > 0 ? intval($force_cid) : $session->user_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
11 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
12 |
// Require re-auth? |
9
d58bafde2a92
SECURITY: Require login to view YMS page if sudo mode requirement is turned off
Dan Fuhry <dan@enanocms.org>
parents:
8
diff
changeset
|
13 |
if ( !$session->user_logged_in || ($session->auth_level < USER_LEVEL_CHPREF && getConfig('yms_require_reauth', 1) == 1) ) |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
14 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
15 |
redirect(makeUrlNS('Special', "Login/$paths->fullpage", 'level=' . USER_LEVEL_CHPREF), '', '', 0); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
16 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
17 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
18 |
// Check for Yubikey plugin |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
19 |
if ( !function_exists('yubikey_validate_otp') ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
20 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
21 |
die_friendly($lang->get('yms_err_yubikey_plugin_missing_title'), '<p>' . $lang->get('yms_err_yubikey_plugin_missing_body') . '</p>'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
22 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
23 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
24 |
// Client switch allowed? |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
25 |
if ( $session->user_level >= USER_LEVEL_ADMIN && getConfig('yms_claim_enable', 0) == 1 ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
26 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
27 |
$on_home = empty($_POST) && !$paths->getParam(0); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
28 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
29 |
// yes. |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
30 |
$configkey = "yms_zeroeditsess_{$session->user_id}"; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
31 |
if ( getConfig($configkey, 0) == 1 && !isset($_GET['client_switch']) ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
32 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
33 |
// set to zero |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
34 |
$yms_client_id = 0; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
35 |
} |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
36 |
else if ( !getConfig($configkey) && isset($_GET['client_switch']) ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
37 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
38 |
// set to zero + update config |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
39 |
$yms_client_id = 0; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
40 |
setConfig($configkey, 1); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
41 |
} |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
42 |
else if ( getConfig($configkey) && isset($_GET['client_switch']) ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
43 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
44 |
// turning off |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
45 |
setConfig($configkey, false); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
46 |
} |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
47 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
48 |
// display a notice |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
49 |
if ( $yms_client_id == 0 && $on_home ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
50 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
51 |
$output->add_after_header('<div class="info-box">' . $lang->get('yms_msg_editing_zero') . '</div>'); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
52 |
} |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
53 |
} |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
54 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
55 |
// Does the client exist? |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
56 |
$q = $db->sql_query('SELECT 1 FROM ' . table_prefix . "yms_clients WHERE id = {$yms_client_id};"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
57 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
58 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
59 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
60 |
$client_exists = $db->numrows(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
61 |
$db->free_result(); |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
62 |
if ( !$client_exists && $yms_client_id > 0 ) |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
63 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
64 |
redirect(makeUrlNS('Special', 'YMSCreateClient'), '', '', 0); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
65 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
66 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
67 |
// Check for a subpage request |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
68 |
if ( $subpage = $paths->getParam(0) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
69 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
70 |
if ( preg_match('/^[A-z0-9]+$/', $subpage) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
71 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
72 |
if ( function_exists("page_Special_YMS_{$subpage}") ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
73 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
74 |
// call the subpage |
2 | 75 |
$return = call_user_func("page_Special_YMS_{$subpage}"); |
76 |
if ( !$return ) |
|
77 |
return false; |
|
78 |
||
79 |
// return true = continue exec |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
80 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
81 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
82 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
83 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
84 |
// |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
85 |
// POST processing |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
86 |
// |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
87 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
88 |
if ( isset($_POST['add_aes']) && isset($_POST['add_otp']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
89 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
90 |
$client_id = false; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
91 |
$enabled = $_POST['state'] == 'active'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
92 |
$any_client = isset($_POST['any_client']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
93 |
$notes = $_POST['notes']; |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
94 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
95 |
// Release key? |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
96 |
if ( $session->user_level >= USER_LEVEL_ADMIN && getConfig('yms_claim_enable', 0) == 1 && isset($_POST['allow_claim']) ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
97 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
98 |
$client_id = 0; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
99 |
// also allow anyone to validate OTPs from it and mark it as active |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
100 |
$any_client = true; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
101 |
$enabled = true; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
102 |
} |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
103 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
104 |
$result = yms_add_yubikey($_POST['add_aes'], $_POST['add_otp'], $client_id, $enabled, $any_client, $notes); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
105 |
yms_send_response('yms_msg_addkey_success', $result); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
106 |
} |
11
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
107 |
else if ( isset($_POST['csv']) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
108 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
109 |
$csv = explode("\n", trim($_POST['csv'])); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
110 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
111 |
$errors = array(); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
112 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
113 |
// first line: header |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
114 |
$head = str_getcsv($csv[0]); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
115 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
116 |
// column check: aes_secret |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
117 |
if ( !in_array('aes_secret', $head) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
118 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
119 |
$errors[] = $lang->get('yms_err_add_batch_missing_aes_key'); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
120 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
121 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
122 |
// column check: otp, public_id and private_id |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
123 |
if ( !in_array('otp', $head) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
124 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
125 |
if ( !in_array('public_id', $head) || !in_array('private_id', $head) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
126 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
127 |
$errors[] = $lang->get('yms_err_add_batch_missing_id'); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
128 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
129 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
130 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
131 |
if ( !empty($errors) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
132 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
133 |
yms_send_response(false, '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>'); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
134 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
135 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
136 |
// we are good to start processing |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
137 |
$db->transaction_begin(); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
138 |
for ( $i = 1; $i < count($csv); $i++ ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
139 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
140 |
$line = str_getcsv($csv[$i]); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
141 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
142 |
// ensure column count == row count |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
143 |
if ( count($line) !== count($head) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
144 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
145 |
$errors[] = $lang->get('yms_err_add_batch_bad_row_count', array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
146 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
147 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
148 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
149 |
// remap line |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
150 |
foreach ( $head as $j => $col ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
151 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
152 |
$line[$col] =& $line[$j]; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
153 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
154 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
155 |
// initialize row |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
156 |
$row = array( |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
157 |
'client_id' => $yms_client_id, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
158 |
'aes_secret' => yms_hex_encode(yms_tobinary($line['aes_secret'])), |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
159 |
'session_count' => 0, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
160 |
'token_count' => 0, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
161 |
'create_time' => time(), |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
162 |
'token_time' => 0, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
163 |
'flags' => 0, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
164 |
'notes' => '' |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
165 |
); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
166 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
167 |
if ( !preg_match('/^[0-9a-f]{32}$/', $row['aes_secret']) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
168 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
169 |
$errors[] = $lang->get('yms_err_add_batch_aes_secret', array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
170 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
171 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
172 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
173 |
// do we have an OTP? |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
174 |
if ( isset($line['otp']) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
175 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
176 |
// yes, decode it |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
177 |
$otp = yms_decode_otp($line['otp'], $line['aes_secret']); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
178 |
if ( $otp === false ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
179 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
180 |
$errors[] = $lang->get('yms_err_add_batch_bad_otp', array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
181 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
182 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
183 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
184 |
if ( !$otp['crc_good'] ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
185 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
186 |
$errors[] = $lang->get('yms_err_add_batch_bad_otp', array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
187 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
188 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
189 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
190 |
$row['public_id'] = $otp['publicid']; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
191 |
$row['private_id'] = $otp['privateid']; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
192 |
$row['session_count'] = $otp['session']; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
193 |
$row['token_count'] = $otp['count']; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
194 |
$row['token_time'] = $otp['timestamp']; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
195 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
196 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
197 |
// public and private ID |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
198 |
foreach ( array('public_id', 'private_id') as $col ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
199 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
200 |
if ( !empty($line[$col]) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
201 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
202 |
$row[$col] = yms_hex_encode(yms_tobinary($line[$col])); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
203 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
204 |
if ( !isset($row[$col]) || !preg_match('/^[0-9a-f]{12}$/', $row[$col]) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
205 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
206 |
$errors[] = $lang->get("yms_err_add_batch_bad_$col", array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
207 |
continue 2; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
208 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
209 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
210 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
211 |
// session count, token count and timestamp |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
212 |
foreach ( array('session_count', 'token_count', 'token_time') as $col ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
213 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
214 |
if ( !empty($line[$col]) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
215 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
216 |
$row[$col] = intval($line[$col]); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
217 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
218 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
219 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
220 |
// notes |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
221 |
if ( isset($line['notes']) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
222 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
223 |
$row['notes'] = trim($line['notes']); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
224 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
225 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
226 |
// lifecycle state |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
227 |
if ( isset($line['lifecycle_state']) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
228 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
229 |
if ( !in_array($line['lifecycle_state'], array('active', 'inactive')) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
230 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
231 |
$errors[] = $lang->get('yms_err_add_batch_bad_lifecycle_state', array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
232 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
233 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
234 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
235 |
if ( $line['lifecycle_state'] === 'active' ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
236 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
237 |
$row['flags'] |= YMS_ENABLED; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
238 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
239 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
240 |
else |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
241 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
242 |
// default to active |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
243 |
$row['flags'] |= YMS_ENABLED; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
244 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
245 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
246 |
// global access |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
247 |
if ( isset($line['access']) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
248 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
249 |
if ( !in_array($line['access'], array('global', 'restricted')) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
250 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
251 |
$errors[] = $lang->get('yms_err_add_batch_bad_access', array('line' => $i)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
252 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
253 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
254 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
255 |
if ( $line['access'] === 'global' ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
256 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
257 |
$row['flags'] |= YMS_ANY_CLIENT; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
258 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
259 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
260 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
261 |
// duplicate key check |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
262 |
$q = $db->sql_query('SELECT 1 FROM ' . table_prefix . "yms_yubikeys WHERE public_id = '{$row['public_id']}';"); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
263 |
if ( $db->numrows() > 0 ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
264 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
265 |
$errors[] = $lang->get('yms_err_add_batch_duplicate', array('line' => $i, 'public_id' => $row['public_id'])); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
266 |
continue; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
267 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
268 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
269 |
// build query |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
270 |
$cols = implode(', ', array_keys($row)); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
271 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
272 |
foreach ( $row as &$cell ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
273 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
274 |
if ( is_string($cell) ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
275 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
276 |
$cell = "'" . $db->escape($cell) . "'"; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
277 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
278 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
279 |
unset($cell); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
280 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
281 |
$query = sprintf("INSERT INTO %syms_yubikeys ( %s ) VALUES ( %s );", |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
282 |
table_prefix, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
283 |
$cols, |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
284 |
implode(', ', $row) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
285 |
); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
286 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
287 |
// insert it! |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
288 |
$q = $db->sql_query($query); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
289 |
if ( $q ) |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
290 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
291 |
$errors[] = $lang->get('yms_err_add_batch_success', array('line' => $i, 'public_id' => $row['public_id'])); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
292 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
293 |
else |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
294 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
295 |
$errors[] = $lang->get('yms_err_add_batch_query', array('line' => $i, 'public_id' => $row['public_id'], 'error' => $db->sql_error())); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
296 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
297 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
298 |
$db->transaction_commit(); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
299 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
300 |
yms_send_response('<p><strong>' . $lang->get('yms_lbl_add_batch_success_head') . '</strong></p><ul><li>' . implode('</li><li>', $errors) . '</li></ul>', true); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
301 |
} |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
302 |
else if ( isset($_POST['claim_otp']) && getConfig('yms_claim_enable', 0) == 1 ) |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
303 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
304 |
// do we need to validate a custom field? |
3 | 305 |
if ( ($url = getConfig('yms_claim_auth_url')) && getConfig('yms_claim_auth_field') && getConfig('yms_claim_auth_enable', 0) == 1 ) |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
306 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
307 |
if ( ($result = yms_validate_custom_field($_POST['custom_field'], $_POST['claim_otp'], $url)) !== true ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
308 |
yms_send_response('n/a', $result); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
309 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
310 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
311 |
// validate this OTP, make sure it's all good |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
312 |
$result = strtolower(yms_validate_otp($_POST['claim_otp'], 0)); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
313 |
if ( $result !== 'ok' ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
314 |
yms_send_response('n/a', "yubiauth_err_response_{$result}"); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
315 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
316 |
// change owner |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
317 |
$client_id = false; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
318 |
$enabled = $_POST['state'] == 'active'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
319 |
$any_client = isset($_POST['any_client']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
320 |
$notes = $_POST['notes']; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
321 |
$result = yms_chown_yubikey($_POST['claim_otp'], $client_id, $enabled, $any_client, $notes); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
322 |
yms_send_response('yms_msg_addkey_success', $result); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
323 |
} |
2 | 324 |
else if ( $paths->getParam(0) == 'DeleteKey' && $paths->getParam(2) == 'Confirm' ) |
325 |
{ |
|
326 |
csrf_request_confirm(); |
|
327 |
$id = intval($paths->getParam(1)); |
|
328 |
$result = yms_delete_key($id); |
|
329 |
yms_send_response('yms_msg_delete_success', $result); |
|
330 |
} |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
331 |
else if ( isset($_POST['update_counters']) ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
332 |
{ |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
333 |
$yk_id = $_POST['update_counters']; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
334 |
$scount = $_POST['session_count']; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
335 |
$tcount = $_POST['token_count']; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
336 |
$any_client = isset($_POST['any_client']); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
337 |
$result = yms_update_counters($yk_id, $scount, $tcount, false, $any_client); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
338 |
yms_send_response('yms_msg_counter_update_success', $result); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
339 |
} |
2 | 340 |
|
341 |
if ( isset($_GET['toggle']) && isset($_GET['state']) ) |
|
342 |
{ |
|
343 |
$id = intval($_GET['toggle']); |
|
344 |
if ( $_GET['state'] === 'active' ) |
|
345 |
$expr = 'flags | ' . YMS_ENABLED; |
|
346 |
else |
|
347 |
$expr = 'flags & ~' . YMS_ENABLED; |
|
348 |
||
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
349 |
$q = $db->sql_query('UPDATE ' . table_prefix . "yms_yubikeys SET flags = $expr WHERE id = $id AND client_id = {$yms_client_id};"); |
2 | 350 |
if ( !$q ) |
351 |
$db->die_json(); |
|
352 |
} |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
353 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
354 |
// Preload JS libraries we need for Yubikey |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
355 |
$template->preload_js(array('jquery', 'jquery-ui', 'l10n', 'flyin', 'messagebox', 'fadefilter')); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
356 |
// Load CSS |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
357 |
$template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/yms/styles.css" />'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
358 |
// Load JS |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
359 |
$template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/yms/cp.js"></script>'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
360 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
361 |
// Send header |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
362 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
363 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
364 |
// Message container |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
365 |
if ( !isset($_GET['ajax'] ) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
366 |
echo '<div id="yms-messages"></div><div id="yms-keylist">'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
367 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
368 |
// Buttons |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
369 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
370 |
<div class="yms-buttons"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
371 |
<a class="abutton abutton_green icon" style="background-image: url(<?php echo scriptPath; ?>/plugins/yms/icons/key_add.png);" |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
372 |
href="<?php echo makeUrlNS('Special', 'YMS/AddKey'); ?>" onclick="yms_showpage('AddKey'); return false;"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
373 |
<?php echo $lang->get('yms_btn_add_key'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
374 |
</a> |
11
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
375 |
<a class="abutton icon" style="background-image: url(<?php echo scriptPath; ?>/plugins/yms/icons/key_add.png);" |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
376 |
href="<?php echo makeUrlNS('Special', 'YMS/AddKeyBatch'); ?>" onclick="yms_showpage('AddKeyBatch'); return false;"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
377 |
<?php echo $lang->get('yms_btn_add_batch'); ?> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
378 |
</a> |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
379 |
<?php if ( getConfig('yms_claim_enable', 0) == 1 && $yms_client_id > 0 ): ?> |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
380 |
<a class="abutton abutton_blue icon" style="background-image: url(<?php echo scriptPath; ?>/plugins/yms/icons/key_add.png);" |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
381 |
href="<?php echo makeUrlNS('Special', 'YMS/AddPreregisteredKey'); ?>" onclick="yms_showpage('AddPreregisteredKey'); return false;"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
382 |
<?php echo $lang->get('yms_btn_add_key_preregistered'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
383 |
</a> |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
384 |
<?php endif; ?> |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
385 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
386 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
387 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
388 |
// Pull all Yubikeys |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
389 |
$q = $db->sql_query('SELECT id, public_id, session_count, create_time, access_time, flags, notes FROM ' . table_prefix . "yms_yubikeys WHERE client_id = {$yms_client_id} ORDER BY id ASC;"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
390 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
391 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
392 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
393 |
if ( $db->numrows() < 1 ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
394 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
395 |
echo '<h2 class="emptymessage">' . $lang->get('yms_msg_no_yubikeys') . '</h2>'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
396 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
397 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
398 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
399 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
400 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
401 |
<table border="0" cellspacing="1" cellpadding="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
402 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
403 |
<!-- Table header --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
404 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
405 |
<th><?php echo $lang->get('yms_th_id'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
406 |
<th><?php echo $lang->get('yms_th_publicid'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
407 |
<th><?php echo $lang->get('yms_th_createtime'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
408 |
<th><?php echo $lang->get('yms_th_accesstime'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
409 |
<th><?php echo $lang->get('yms_th_state'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
410 |
<th><?php echo $lang->get('yms_th_note'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
411 |
<th></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
412 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
413 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
414 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
415 |
$cls = 'row2'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
416 |
while ( $row = $db->fetchrow($q) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
417 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
418 |
$cls = $cls == 'row2' ? 'row1' : 'row2'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
419 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
420 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
421 |
<!-- Key ID --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
422 |
<td style="text-align: center;" class="<?php echo $cls; ?>"><?php echo $row['id']; ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
423 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
424 |
<!-- Public UID --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
425 |
<td style="text-align: left;" class="<?php echo $cls; ?>"><?php echo yms_modhex_encode($row['public_id']); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
426 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
427 |
<!-- Create time --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
428 |
<td style="text-align: left;" class="<?php echo $cls; ?>"><?php echo yms_date($row['create_time']); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
429 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
430 |
<!-- Access time --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
431 |
<td style="text-align: left;" class="<?php echo $cls; ?>"><?php echo $row['access_time'] <= $row['create_time'] ? $lang->get('yms_msg_access_never') : yms_date($row['access_time']); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
432 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
433 |
<!-- State --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
434 |
<td style="text-align: center;" class="<?php echo $cls; ?>"><?php echo yms_state_indicator($row['flags'], $row['id']); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
435 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
436 |
<!-- Notes --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
437 |
<td style="text-align: center;" class="<?php echo $cls; ?>"><?php echo yms_notes_cell($row['notes'], $row['id']); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
438 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
439 |
<!-- Actions --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
440 |
<td style="text-align: center;" class="<?php echo $cls; ?>"><?php echo yms_show_actions($row); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
441 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
442 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
443 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
444 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
445 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
446 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
447 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
448 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
449 |
<br /><br /> |
5
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
450 |
<?php |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
451 |
} |
5
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
452 |
|
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
453 |
?> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
454 |
<a href="<?php echo makeUrlNS('Special', 'YMS/Converter'); ?>" onclick="yms_showpage('Converter'); return false;" class="abutton abutton_red icon" |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
455 |
style="background-image: url(<?php echo scriptPath; ?>/plugins/yms/icons/application_view_icons.png);"> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
456 |
<?php echo $lang->get('yms_btn_show_converter'); ?> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
457 |
</a> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
458 |
|
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
459 |
<a href="<?php echo makeUrlNS('Special', 'YMS/ShowClientInfo'); ?>" onclick="yms_showpage('ShowClientInfo'); return false;" class="abutton abutton_blue icon" |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
460 |
style="background-image: url(<?php echo scriptPath; ?>/plugins/yms/icons/show_client_info.png);"> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
461 |
<?php echo $lang->get('yms_btn_show_client_info'); ?> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
462 |
</a> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
463 |
|
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
464 |
<?php if ( getConfig('yms_claim_enable', 0) == 1 ): ?> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
465 |
<a href="<?php echo makeUrlNS('Special', 'YMS', 'client_switch', true); ?>" class="abutton abutton_green"> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
466 |
<?php echo $yms_client_id == 0 ? $lang->get('yms_btn_switch_from_zero') : $lang->get('yms_btn_switch_to_zero'); ?> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
467 |
</a> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
468 |
<?php endif; ?> |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
469 |
<?php |
a917cbab0280
Fixed: Buttons at bottom were blocked when no Yubikeys present
Dan
parents:
4
diff
changeset
|
470 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
471 |
$db->free_result($q); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
472 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
473 |
// close off inner div (yms-keylist) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
474 |
if ( !isset($_GET['ajax'] ) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
475 |
echo '</div>'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
476 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
477 |
// Send footer |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
478 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
479 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
480 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
481 |
// Add key, using AES secret |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
482 |
function page_Special_YMS_AddKey() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
483 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
484 |
global $output; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
485 |
global $lang; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
486 |
|
1 | 487 |
$output->add_after_header('<div class="breadcrumbs"> |
488 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
|
489 |
' . $lang->get('yms_btn_add_key') . ' |
|
490 |
</div>'); |
|
491 |
||
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
492 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
493 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
494 |
<h3><?php echo $lang->get('yms_lbl_addkey_heading'); ?></h3> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
495 |
<p><?php echo $lang->get('yms_lbl_addkey_desc'); ?></p> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
496 |
<form action="<?php echo makeUrlNS('Special', 'YMS'); ?>" method="post"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
497 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
498 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
499 |
<table border="0" cellspacing="1" cellspacing="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
500 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
501 |
<!-- AES secret --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
502 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
503 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
504 |
<?php echo $lang->get('yms_lbl_addkey_field_secret'); ?><br /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
505 |
<small><?php echo $lang->get('yms_lbl_addkey_field_secret_hint'); ?></small> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
506 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
507 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
508 |
<input type="text" name="add_aes" value="" size="40" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
509 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
510 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
511 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
512 |
<!-- OTP --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
513 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
514 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
515 |
<?php echo $lang->get('yms_lbl_addkey_field_otp'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
516 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
517 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
518 |
<?php echo generate_yubikey_field('add_otp'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
519 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
520 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
521 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
522 |
<!-- State --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
523 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
524 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
525 |
<?php echo $lang->get('yms_lbl_addkey_field_state'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
526 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
527 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
528 |
<select name="state"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
529 |
<option value="active" selected="selected"><?php echo $lang->get('yms_state_active'); ?></option> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
530 |
<option value="inactive"><?php echo $lang->get('yms_state_inactive'); ?></option> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
531 |
</select> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
532 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
533 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
534 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
535 |
<!-- Any client --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
536 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
537 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
538 |
<?php echo $lang->get('yms_lbl_addkey_field_any_client_name'); ?><br /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
539 |
<small><?php echo $lang->get('yms_lbl_addkey_field_any_client_hint'); ?></small> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
540 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
541 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
542 |
<label> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
543 |
<input type="checkbox" name="any_client" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
544 |
<?php echo $lang->get('yms_lbl_addkey_field_any_client'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
545 |
</label> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
546 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
547 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
548 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
549 |
<!-- Allow claim --> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
550 |
<?php if ( getConfig('yms_claim_enable', 0) == 1 ): ?> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
551 |
<tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
552 |
<td class="row2"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
553 |
<?php echo $lang->get('yms_lbl_addkey_field_allow_claim_name'); ?><br /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
554 |
<small><?php echo $lang->get('yms_lbl_addkey_field_allow_claim_hint'); ?></small> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
555 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
556 |
<td class="row1"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
557 |
<label> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
558 |
<input type="checkbox" name="allow_claim" /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
559 |
<?php echo $lang->get('yms_lbl_addkey_field_allow_claim'); ?> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
560 |
</label> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
561 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
562 |
</tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
563 |
<?php endif; ?> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
564 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
565 |
<!-- Notes --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
566 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
567 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
568 |
<?php echo $lang->get('yms_lbl_addkey_field_notes'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
569 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
570 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
571 |
<textarea style="font-family: sans-serif; font-size: 9pt;" name="notes" rows="5" cols="40"></textarea> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
572 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
573 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
574 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
575 |
<!-- Submit --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
576 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
577 |
<th class="subhead" colspan="2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
578 |
<input type="submit" value="<?php echo $lang->get('yms_btn_addkey_submit'); ?>" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
579 |
</th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
580 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
581 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
582 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
583 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
584 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
585 |
</form> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
586 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
587 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
588 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
589 |
|
11
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
590 |
// Add multiple Yubikeys by uploading a CSV |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
591 |
function page_Special_YMS_AddKeyBatch() |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
592 |
{ |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
593 |
global $db, $session, $paths, $template, $plugins; // Common objects |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
594 |
global $lang, $output; |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
595 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
596 |
$output->add_after_header('<div class="breadcrumbs"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
597 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
598 |
' . $lang->get('yms_btn_add_batch') . ' |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
599 |
</div>'); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
600 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
601 |
$output->header(); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
602 |
?> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
603 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
604 |
<h3><?php echo $lang->get('yms_lbl_add_batch_heading'); ?></h3> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
605 |
<?php echo $lang->get('yms_lbl_add_batch_desc'); ?> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
606 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
607 |
<form action="<?php echo makeUrlNS('Special', 'YMS'); ?>" method="post"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
608 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
609 |
<div class="tblholder"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
610 |
<table border="0" cellspacing="1" cellspacing="4"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
611 |
<!-- CSV paste --> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
612 |
<tr> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
613 |
<td class="row2"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
614 |
<?php echo $lang->get('yms_lbl_add_batch_field_csv'); ?><br /> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
615 |
<small><?php echo $lang->get('yms_lbl_add_batch_field_csv_hint'); ?></small> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
616 |
</td> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
617 |
<td class="row1"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
618 |
<textarea name="csv" rows="8" cols="60"></textarea> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
619 |
</td> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
620 |
</tr> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
621 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
622 |
<!-- Submit --> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
623 |
<tr> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
624 |
<th class="subhead" colspan="2"> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
625 |
<input type="submit" value="<?php echo $lang->get('yms_btn_add_batch_submit'); ?>" /> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
626 |
</th> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
627 |
</tr> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
628 |
</table> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
629 |
</div> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
630 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
631 |
</form> |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
632 |
|
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
633 |
<?php |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
634 |
$output->footer(); |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
635 |
} |
b9eb748ac1e4
Add CSV based batch Yubikey registration
Dan Fuhry <dan@enanocms.org>
parents:
9
diff
changeset
|
636 |
|
6 | 637 |
// Add key, using just an OTP |
638 |
// Requires the key to be in the database as client ID 0 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
639 |
function page_Special_YMS_AddPreregisteredKey() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
640 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
641 |
global $db, $session, $paths, $template, $plugins; // Common objects |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
642 |
global $lang, $output; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
643 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
644 |
if ( getConfig('yms_claim_enable', 0) != 1 ) |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
645 |
die(); |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
646 |
|
1 | 647 |
$output->add_after_header('<div class="breadcrumbs"> |
648 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
|
649 |
' . $lang->get('yms_btn_add_key_preregistered') . ' |
|
650 |
</div>'); |
|
651 |
||
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
652 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
653 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
654 |
<h3><?php echo $lang->get('yms_lbl_claimkey_heading'); ?></h3> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
655 |
<p><?php echo $lang->get('yms_lbl_claimkey_desc'); ?></p> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
656 |
<form action="<?php echo makeUrlNS('Special', 'YMS'); ?>" method="post"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
657 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
658 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
659 |
<table border="0" cellspacing="1" cellspacing="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
660 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
661 |
<!-- OTP --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
662 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
663 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
664 |
<?php echo $lang->get('yms_lbl_addkey_field_otp'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
665 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
666 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
667 |
<?php echo generate_yubikey_field('claim_otp'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
668 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
669 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
670 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
671 |
<!-- State --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
672 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
673 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
674 |
<?php echo $lang->get('yms_lbl_addkey_field_state'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
675 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
676 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
677 |
<select name="state"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
678 |
<option value="active" selected="selected"><?php echo $lang->get('yms_state_active'); ?></option> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
679 |
<option value="inactive"><?php echo $lang->get('yms_state_inactive'); ?></option> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
680 |
</select> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
681 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
682 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
683 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
684 |
<!-- Any client --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
685 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
686 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
687 |
<?php echo $lang->get('yms_lbl_addkey_field_any_client_name'); ?><br /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
688 |
<small><?php echo $lang->get('yms_lbl_addkey_field_any_client_hint'); ?></small> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
689 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
690 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
691 |
<label> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
692 |
<input type="checkbox" name="any_client" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
693 |
<?php echo $lang->get('yms_lbl_addkey_field_any_client'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
694 |
</label> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
695 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
696 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
697 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
698 |
<!-- Notes --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
699 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
700 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
701 |
<?php echo $lang->get('yms_lbl_addkey_field_notes'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
702 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
703 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
704 |
<textarea style="font-family: sans-serif; font-size: 9pt;" name="notes" rows="5" cols="40"></textarea> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
705 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
706 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
707 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
708 |
<?php if ( ($field = getConfig('yms_claim_auth_field', '')) && getConfig('yms_claim_auth_url') ): ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
709 |
<!-- Custom field --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
710 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
711 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
712 |
<?php echo htmlspecialchars($field); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
713 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
714 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
715 |
<input type="text" name="custom_field" value="" size="30" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
716 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
717 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
718 |
<?php endif; ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
719 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
720 |
<!-- Submit --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
721 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
722 |
<th class="subhead" colspan="2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
723 |
<input type="submit" value="<?php echo $lang->get('yms_btn_addkey_submit'); ?>" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
724 |
</th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
725 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
726 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
727 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
728 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
729 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
730 |
</form> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
731 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
732 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
733 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
734 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
735 |
// Show the AES secret for a key |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
736 |
function page_Special_YMS_ShowAESKey() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
737 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
738 |
global $db, $session, $paths, $template, $plugins; // Common objects |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
739 |
global $lang, $output, $yms_client_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
740 |
|
1 | 741 |
$output->add_after_header('<div class="breadcrumbs"> |
742 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
|
743 |
' . $lang->get('yms_btn_show_aes') . ' |
|
744 |
</div>'); |
|
745 |
||
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
746 |
$id = intval($paths->getParam(1)); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
747 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
748 |
// verify ownership, retrieve key |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
749 |
$q = $db->sql_query('SELECT client_id, public_id, aes_secret, session_count, token_count, flags FROM ' . table_prefix . "yms_yubikeys WHERE id = $id;"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
750 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
751 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
752 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
753 |
if ( $db->numrows() < 1 ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
754 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
755 |
die_friendly('no rows', '<p>key not found</p>'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
756 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
757 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
758 |
list($client_id, $public_id, $secret, $scount, $tcount, $flags) = $db->fetchrow_num(); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
759 |
$db->free_result(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
760 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
761 |
if ( $client_id !== $yms_client_id ) |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
762 |
die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
763 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
764 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
765 |
?> |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
766 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
767 |
<h3><?php echo $lang->get('yms_showaes_heading_main'); ?></h3> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
768 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
769 |
<form action="<?php echo makeUrlNS('Special', 'YMS'); ?>" method="post"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
770 |
<input type="hidden" name="update_counters" value="<?php echo $id; ?>" /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
771 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
772 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
773 |
<table border="0" cellspacing="1" cellpadding="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
774 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
775 |
<th colspan="2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
776 |
<?php echo $lang->get('yms_showaes_th', array('public_id' => yms_modhex_encode($public_id))); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
777 |
</th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
778 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
779 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
780 |
<!-- hex --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
781 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
782 |
<td class="row2" style="width: 50%;"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
783 |
<?php echo $lang->get('yms_showaes_lbl_hex'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
784 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
785 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
786 |
<?php echo $secret; ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
787 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
788 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
789 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
790 |
<!-- modhex --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
791 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
792 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
793 |
<?php echo $lang->get('yms_showaes_lbl_modhex'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
794 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
795 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
796 |
<?php echo yms_modhex_encode($secret); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
797 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
798 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
799 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
800 |
<!-- base64 --> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
801 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
802 |
<td class="row2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
803 |
<?php echo $lang->get('yms_showaes_lbl_base64'); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
804 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
805 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
806 |
<?php echo base64_encode(yms_tobinary($secret)); ?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
807 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
808 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
809 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
810 |
<!-- COUNTERS --> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
811 |
<tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
812 |
<th colspan="2"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
813 |
<?php echo $lang->get('yms_showaes_th_counter'); ?> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
814 |
</th> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
815 |
</tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
816 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
817 |
<tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
818 |
<td class="row2"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
819 |
<?php echo $lang->get('yms_showaes_field_session_count'); ?><br /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
820 |
<small><?php echo $lang->get('yms_showaes_field_session_count_hint'); ?></small> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
821 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
822 |
<td class="row1"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
823 |
<input type="text" name="session_count" value="<?php echo $scount; ?>" size="5" /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
824 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
825 |
</tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
826 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
827 |
<tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
828 |
<td class="row2"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
829 |
<?php echo $lang->get('yms_showaes_field_otp_count'); ?><br /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
830 |
<small><?php echo $lang->get('yms_showaes_field_otp_count_hint'); ?></small> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
831 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
832 |
<td class="row1"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
833 |
<input type="text" name="token_count" value="<?php echo $tcount; ?>" size="5" /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
834 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
835 |
</tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
836 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
837 |
<!-- Any client --> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
838 |
<tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
839 |
<td class="row2"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
840 |
<?php echo $lang->get('yms_lbl_addkey_field_any_client_name'); ?><br /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
841 |
<small><?php echo $lang->get('yms_lbl_addkey_field_any_client_hint'); ?></small> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
842 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
843 |
<td class="row1"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
844 |
<label> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
845 |
<input type="checkbox" name="any_client" <?php if ( $flags & YMS_ANY_CLIENT ) echo 'checked="checked" '; ?>/> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
846 |
<?php echo $lang->get('yms_lbl_addkey_field_any_client'); ?> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
847 |
</label> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
848 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
849 |
</tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
850 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
851 |
<tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
852 |
<th class="subhead" colspan="2"> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
853 |
<input type="submit" value="<?php echo $lang->get('etc_save_changes'); ?>" /> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
854 |
</td> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
855 |
</tr> |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
856 |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
857 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
858 |
</div> |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
859 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
860 |
</form> |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
861 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
862 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
863 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
864 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
865 |
// show the user's API key and client ID |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
866 |
function page_Special_YMS_ShowClientInfo() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
867 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
868 |
global $db, $session, $paths, $template, $plugins; // Common objects |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
869 |
global $lang, $output, $yms_client_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
870 |
|
1 | 871 |
$output->add_after_header('<div class="breadcrumbs"> |
872 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
|
873 |
' . $lang->get('yms_btn_show_client_info') . ' |
|
874 |
</div>'); |
|
875 |
||
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
876 |
$q = $db->sql_query('SELECT apikey FROM ' . table_prefix . "yms_clients WHERE id = {$yms_client_id};"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
877 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
878 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
879 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
880 |
list($api_key) = $db->fetchrow_num(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
881 |
$db->free_result(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
882 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
883 |
$api_key = yms_tobinary($api_key); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
884 |
|
6 | 885 |
$validate_url = makeUrlComplete('Special', 'YubikeyValidate'); |
886 |
$validate_url = preg_replace('/[?&]auth=[0-9a-f]+/', '', $validate_url); |
|
887 |
||
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
888 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
889 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
890 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
891 |
<table border="0" cellspacing="1" cellpadding="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
892 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
893 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
894 |
<th colspan="2"><?php echo $lang->get('yms_th_client_id'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
895 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
896 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
897 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
898 |
<td class="row2"><?php echo $lang->get('yms_lbl_client_id'); ?></td> |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
899 |
<td class="row1"><?php echo strval($yms_client_id); ?></td> |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
900 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
901 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
902 |
<tr> |
6 | 903 |
<td class="row2"><?php echo $lang->get('yms_lbl_validate_url'); ?></td> |
904 |
<td class="row1"><?php echo htmlspecialchars($validate_url); ?></td> |
|
905 |
</tr> |
|
906 |
||
907 |
<tr> |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
908 |
<th colspan="2"><?php echo $lang->get('yms_th_api_key'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
909 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
910 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
911 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
912 |
<td class="row2"><?php echo $lang->get('yms_showaes_lbl_hex'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
913 |
<td class="row1"><?php echo yms_hex_encode($api_key); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
914 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
915 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
916 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
917 |
<td class="row2"><?php echo $lang->get('yms_showaes_lbl_modhex'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
918 |
<td class="row1"><?php echo yms_modhex_encode($api_key); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
919 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
920 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
921 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
922 |
<td class="row2"><?php echo $lang->get('yms_showaes_lbl_base64'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
923 |
<td class="row1"><?php echo base64_encode($api_key); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
924 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
925 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
926 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
927 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
928 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
929 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
930 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
931 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
932 |
// Converter between different binary encodings |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
933 |
function page_Special_YMS_Converter() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
934 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
935 |
global $db, $session, $paths, $template, $plugins; // Common objects |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
936 |
global $lang, $output; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
937 |
|
1 | 938 |
$output->add_after_header('<div class="breadcrumbs"> |
939 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
|
940 |
' . $lang->get('yms_btn_show_converter') . ' |
|
941 |
</div>'); |
|
942 |
||
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
943 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
944 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
945 |
if ( isset($_POST['value']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
946 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
947 |
switch($_POST['format']) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
948 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
949 |
case 'auto': |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
950 |
default: |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
951 |
$binary = yms_tobinary($_POST['value']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
952 |
break; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
953 |
case 'hex': |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
954 |
$_POST['value'] = str_replace(" ", '', $_POST['value']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
955 |
$binary = yms_hex_decode($_POST['value']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
956 |
break; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
957 |
case 'modhex': |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
958 |
$binary = yms_hex_decode(yms_modhex_decode($_POST['value'])); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
959 |
break; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
960 |
case 'base64': |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
961 |
$binary = base64_decode($_POST['value']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
962 |
break; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
963 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
964 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
965 |
if ( empty($binary) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
966 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
967 |
echo '<div class="error-box">' . $lang->get('yms_conv_err_invalid_string') . '</div>'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
968 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
969 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
970 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
971 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
972 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
973 |
<table border="0" cellspacing="1" cellpadding="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
974 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
975 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
976 |
<th colspan="2"><?php echo $lang->get('yms_th_converted_value'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
977 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
978 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
979 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
980 |
<td class="row2"><?php echo $lang->get('yms_showaes_lbl_hex'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
981 |
<td class="row1"><?php echo yms_hex_encode($binary); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
982 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
983 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
984 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
985 |
<td class="row2"><?php echo $lang->get('yms_showaes_lbl_modhex'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
986 |
<td class="row1"><?php echo yms_modhex_encode($binary); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
987 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
988 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
989 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
990 |
<td class="row2"><?php echo $lang->get('yms_showaes_lbl_base64'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
991 |
<td class="row1"><?php echo base64_encode($binary); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
992 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
993 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
994 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
995 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
996 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
997 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
998 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
999 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1000 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1001 |
<form method="post" class="submit_to_self" action="<?php echo makeUrl($paths->fullpage); ?>"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1002 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1003 |
<div class="tblholder"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1004 |
<table border="0" cellspacing="1" cellpadding="4"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1005 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1006 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1007 |
<th colspan="2"><?php echo $lang->get('yms_th_converter'); ?></th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1008 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1009 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1010 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1011 |
<td class="row2" style="width: 30%;"><?php echo $lang->get('yms_conv_lbl_value'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1012 |
<td class="row1"><input type="text" name="value" size="60" /></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1013 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1014 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1015 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1016 |
<td class="row2" style="width: 30%;"><?php echo $lang->get('yms_conv_lbl_format'); ?></td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1017 |
<td class="row1"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1018 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1019 |
foreach ( array('auto', 'hex', 'modhex', 'base64') as $i => $fmt ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1020 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1021 |
echo '<label><input type="radio" name="format" value="' . $fmt . '" '; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1022 |
if ( ( isset($_POST['format']) && $_POST['format'] === $fmt ) || ( !isset($_POST['format']) && $i == 0 ) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1023 |
echo 'checked="checked" '; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1024 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1025 |
echo '/> '; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1026 |
echo $lang->get("yms_conv_lbl_format_$fmt"); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1027 |
echo "</label>\n "; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1028 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1029 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1030 |
</td> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1031 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1032 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1033 |
<tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1034 |
<th class="subhead" colspan="2"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1035 |
<input type="submit" value="<?php echo $lang->get('yms_conv_btn_submit'); ?>" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1036 |
</th> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1037 |
</tr> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1038 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1039 |
</table> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1040 |
</div> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1041 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1042 |
</form> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1043 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1044 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1045 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1046 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1047 |
|
2 | 1048 |
function page_Special_YMS_DeleteKey() |
1049 |
{ |
|
1050 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
1051 |
global $lang, $output; |
|
1052 |
||
1053 |
$output->add_after_header('<div class="breadcrumbs"> |
|
1054 |
<a href="' . makeUrlNS('Special', 'YMS') . '">' . $lang->get('yms_specialpage_yms') . '</a> » |
|
1055 |
' . $lang->get('yms_btn_delete_key') . ' |
|
1056 |
</div>'); |
|
1057 |
||
1058 |
$id = intval($paths->getParam(1)); |
|
1059 |
if ( !$id ) |
|
1060 |
die(); |
|
1061 |
||
1062 |
if ( $paths->getParam(2) == 'Confirm' ) |
|
1063 |
{ |
|
1064 |
// go back, Jack! |
|
1065 |
return true; |
|
1066 |
} |
|
1067 |
||
1068 |
$delete_url = makeUrlNS('Special', "YMS/DeleteKey/$id/Confirm", "cstok={$session->csrf_token}", true); |
|
1069 |
||
1070 |
$output->header(); |
|
1071 |
||
1072 |
?> |
|
1073 |
<form action="<?php echo $delete_url; ?>" method="post"> |
|
1074 |
<div style="text-align: center;"> |
|
1075 |
<h3><?php echo $lang->get('yms_msg_delete_confirm'); ?></h3> |
|
1076 |
<input type="hidden" name="placeholder" value="placeholder" /> |
|
1077 |
<p> |
|
1078 |
<a href="<?php echo $delete_url; ?>" onclick="return yms_ajax_submit(this);" class="abutton abutton_red icon" style="background-image: url(<?php echo scriptPath; ?>/plugins/yms/icons/key_delete.png);"> |
|
1079 |
<?php echo $lang->get('yms_btn_delete_key'); ?> |
|
1080 |
</a> |
|
1081 |
</p> |
|
1082 |
</div> |
|
1083 |
</form> |
|
1084 |
<?php |
|
1085 |
||
1086 |
$output->footer(); |
|
1087 |
} |
|
1088 |
||
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1089 |
function page_Special_YMS_AjaxToggleState() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1090 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1091 |
global $db, $session, $paths, $template, $plugins; // Common objects |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1092 |
global $yms_client_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1093 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1094 |
$id = intval($_POST['id']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1095 |
if ( $_POST['state'] === 'active' ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1096 |
$expr = 'flags | ' . YMS_ENABLED; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1097 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1098 |
$expr = 'flags & ~' . YMS_ENABLED; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1099 |
|
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1100 |
$q = $db->sql_query('UPDATE ' . table_prefix . "yms_yubikeys SET flags = $expr WHERE id = $id AND client_id = {$yms_client_id};"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1101 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1102 |
$db->die_json(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1103 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1104 |
echo 'ok'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1105 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1106 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1107 |
function page_Special_YMS_AjaxNotes() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1108 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1109 |
global $db, $session, $paths, $template, $plugins; // Common objects |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1110 |
global $yms_client_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1111 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1112 |
if ( isset($_POST['get']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1113 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1114 |
$id = intval($_POST['get']); |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1115 |
$q = $db->sql_query('SELECT notes FROM ' . table_prefix . "yms_yubikeys WHERE id = $id AND client_id = {$yms_client_id};"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1116 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1117 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1118 |
if ( $db->numrows() < 1 ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1119 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1120 |
echo "key not found"; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1121 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1122 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1123 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1124 |
list($note) = $db->fetchrow_num(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1125 |
echo $note; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1126 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1127 |
$db->free_result(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1128 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1129 |
else if ( isset($_POST['save']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1130 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1131 |
$id = intval($_POST['save']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1132 |
$note = trim($_POST['note']); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1133 |
$note = $db->escape($note); |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1134 |
$q = $db->sql_query('UPDATE ' . table_prefix . "yms_yubikeys SET notes = '$note' WHERE id = $id AND client_id = {$yms_client_id};"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1135 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1136 |
$db->die_json(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1137 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1138 |
echo 'ok'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1139 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1140 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1141 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1142 |
// Client creation |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1143 |
function page_Special_YMSCreateClient() |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1144 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1145 |
global $db, $session, $paths, $template, $plugins; // Common objects |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1146 |
global $lang; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1147 |
global $output; |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1148 |
global $yms_client_id; |
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1149 |
|
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1150 |
$yms_client_id = $session->user_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1151 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1152 |
// Require re-auth? |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1153 |
if ( $session->auth_level < USER_LEVEL_CHPREF && getConfig('yms_require_reauth', 1) == 1 ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1154 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1155 |
redirect(makeUrlNS('Special', "Login/$paths->fullpage", 'level=' . USER_LEVEL_CHPREF), '', '', 0); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1156 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1157 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1158 |
// Check for Yubikey plugin |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1159 |
if ( !function_exists('yubikey_validate_otp') ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1160 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1161 |
die_friendly($lang->get('yms_err_yubikey_plugin_missing_title'), '<p>' . $lang->get('yms_err_yubikey_plugin_missing_body') . '</p>'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1162 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1163 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1164 |
// Does the client exist? |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1165 |
$q = $db->sql_query('SELECT 1 FROM ' . table_prefix . "yms_clients WHERE id = {$yms_client_id};"); |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1166 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1167 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1168 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1169 |
$client_exists = $db->numrows(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1170 |
$db->free_result(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1171 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1172 |
if ( $client_exists ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1173 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1174 |
die_friendly($lang->get('yms_err_client_exists_title'), '<p>' . $lang->get('yms_err_client_exists_body') . '</p>'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1175 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1176 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1177 |
$template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/yms/styles.css" />'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1178 |
$output->header(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1179 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1180 |
if ( isset($_POST['register_client']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1181 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1182 |
// register the client |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1183 |
// SHA1 key length: 160 bits |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1184 |
$api_key = base64_encode(AESCrypt::randkey(160 / 8)); |
4
9fdc988ce46e
Added counter and ANY_CLIENT settings to ShowAESKey; Significant improvements to claim system: Added master switch for the whole system; Added ability for administrators to "su" to client ID 0 to manage pooled keys; Added ability for admins to release key when it is added
Dan
parents:
3
diff
changeset
|
1185 |
$client_id = $yms_client_id; |
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1186 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1187 |
$q = $db->sql_query('INSERT INTO ' . table_prefix . "yms_clients(id, apikey) VALUES ($client_id, '$api_key');"); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1188 |
if ( !$q ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1189 |
$db->_die(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1190 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1191 |
$validate_url = makeUrlComplete('Special', 'YubikeyValidate'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1192 |
$validate_url = preg_replace('/[?&]auth=[0-9a-f]+/', '', $validate_url); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1193 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1194 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1195 |
<h3><?php echo $lang->get('yms_register_msg_success_title'); ?></h3> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1196 |
<?php echo $lang->get('yms_register_msg_success_body', array( |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1197 |
'yms_link' => makeUrlNS('Special', 'YMS'), |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1198 |
'client_id' => $client_id, |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1199 |
'api_key' => $api_key, |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1200 |
'validate_url' => $validate_url |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1201 |
)); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1202 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1203 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1204 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1205 |
// confirmation page |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1206 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1207 |
<form action="<?php echo makeUrlNS('Special', 'YMSCreateClient'); ?>" method="post"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1208 |
<h3><?php echo $lang->get('yms_register_confirm_title'); ?></h3> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1209 |
<p><?php echo $lang->get('yms_register_confirm_body'); ?></p> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1210 |
<p> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1211 |
<input type="submit" style="font-weight: bold;" name="register_client" value="<?php echo $lang->get('yms_register_btn_submit'); ?>" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1212 |
<input type="submit" name="cancel" value="<?php echo $lang->get('etc_cancel'); ?>" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1213 |
</p> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1214 |
</form> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1215 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1216 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1217 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1218 |
$output->footer(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1219 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1220 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1221 |
// Generic response function |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1222 |
// Processing functions return either true or a string containing an error message. This |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1223 |
// takes that return, and sends a response through the appropriate channel, while allowing |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1224 |
// shared backend functions. |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1225 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1226 |
function yms_send_response($success_string, $result) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1227 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1228 |
global $lang, $output; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1229 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1230 |
if ( $result === true ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1231 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1232 |
if ( isset($_GET['ajax']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1233 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1234 |
yms_json_response(array( |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1235 |
'mode' => 'success', |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1236 |
'message' => $lang->get($success_string) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1237 |
)); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1238 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1239 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1240 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1241 |
$output->add_after_header( |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1242 |
'<div class="info-box">' . $lang->get($success_string) . '</div>' |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1243 |
); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1244 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1245 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1246 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1247 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1248 |
if ( isset($_GET['ajax']) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1249 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1250 |
yms_json_response(array( |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1251 |
'mode' => 'error', |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1252 |
'error' => $lang->get($result) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1253 |
)); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1254 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1255 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1256 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1257 |
$output->add_after_header( |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1258 |
'<div class="error-box">' . $lang->get($result) . '</div>' |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1259 |
); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1260 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1261 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1262 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1263 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1264 |
function yms_json_response($response) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1265 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1266 |
global $db, $session, $paths, $template, $plugins; // Common objects |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1267 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1268 |
header('Content-type: application/json'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1269 |
echo enano_json_encode($response); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1270 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1271 |
$db->close(); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1272 |
exit; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1273 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1274 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1275 |
function yms_date($ts) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1276 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1277 |
return enano_date('Y-m-d H:m:i', $ts); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1278 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1279 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1280 |
function yms_state_indicator($flags, $id) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1281 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1282 |
global $lang; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1283 |
return $flags & YMS_ENABLED ? |
2 | 1284 |
'<a href="' . makeUrlNS('Special', 'YMS', "toggle=$id&state=inactive", true) . '" onclick="yms_toggle_state(this, ' . $id . '); return false;" class="yms-enabled">' . $lang->get('yms_state_active') . '</a>' : |
1285 |
'<a href="' . makeUrlNS('Special', 'YMS', "toggle=$id&state=active", true) . '" onclick="yms_toggle_state(this, ' . $id . '); return false;" class="yms-disabled">' . $lang->get('yms_state_inactive') . '</a>'; |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1286 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1287 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1288 |
function yms_notes_cell($notes, $id) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1289 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1290 |
global $lang; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1291 |
$notes = trim($notes); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1292 |
if ( empty($notes) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1293 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1294 |
$img = 'note_delete.png'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1295 |
$str = $lang->get('yms_btn_note_create'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1296 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1297 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1298 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1299 |
$img = 'note.png'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1300 |
$str = $lang->get('yms_btn_note_view'); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1301 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1302 |
echo '<a href="#" onclick="yms_show_notes(this, '.$id.'); return false;" title="' . $str . '"><img alt="' . $str . '" src="' . scriptPath . '/plugins/yms/icons/' . $img . '" /></a>'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1303 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1304 |
if ( !empty($notes) ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1305 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1306 |
echo ' '; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1307 |
if ( strlen($notes) > 15 ) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1308 |
echo htmlspecialchars(substr($notes, 0, 12)) . '...'; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1309 |
else |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1310 |
echo htmlspecialchars($notes); |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1311 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1312 |
} |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1313 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1314 |
function yms_show_actions($row) |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1315 |
{ |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1316 |
global $lang; |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1317 |
|
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1318 |
// Show AES secret |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1319 |
?> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1320 |
<a href="<?php echo makeUrlNS('Special', "YMS/ShowAESKey/{$row['id']}"); ?>" title="<?php echo $lang->get('yms_btn_show_aes'); ?>" onclick="yms_showpage('ShowAESKey/<?php echo $row['id']; ?>'); return false;"> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1321 |
<img alt="<?php echo $lang->get('yms_btn_show_aes'); ?>" src="<?php echo scriptPath; ?>/plugins/yms/icons/key_go.png" /> |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1322 |
</a> |
2 | 1323 |
<a href="<?php echo makeUrlNS('Special', "YMS/DeleteKey/{$row['id']}"); ?>" title="<?php echo $lang->get('yms_btn_delete_key'); ?>" onclick="yms_showpage('DeleteKey/<?php echo $row['id']; ?>'); return false;"> |
1324 |
<img alt="<?php echo $lang->get('yms_btn_delete_key'); ?>" src="<?php echo scriptPath; ?>/plugins/yms/icons/key_delete.png" /> |
|
1325 |
</a> |
|
0
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1326 |
<?php |
9997bee9ad03
First commit. Lacks key deletion support and an admin CP for controlling options.
Dan
parents:
diff
changeset
|
1327 |
} |