equal
deleted
inserted
replaced
101 $flags |= YMS_ANY_CLIENT; |
101 $flags |= YMS_ANY_CLIENT; |
102 |
102 |
103 $notes = $notes ? $db->escape(strval($notes)) : ''; |
103 $notes = $notes ? $db->escape(strval($notes)) : ''; |
104 |
104 |
105 $q = $db->sql_query("UPDATE " . table_prefix . "yms_yubikeys SET flags = $flags, notes = '$notes', client_id = $client_id WHERE id = $key_id;"); |
105 $q = $db->sql_query("UPDATE " . table_prefix . "yms_yubikeys SET flags = $flags, notes = '$notes', client_id = $client_id WHERE id = $key_id;"); |
|
106 if ( !$q ) |
|
107 $db->_die(); |
|
108 |
|
109 return true; |
|
110 } |
|
111 |
|
112 function yms_delete_key($id, $client_id = false) |
|
113 { |
|
114 global $db, $session, $paths, $template, $plugins; // Common objects |
|
115 |
|
116 if ( $client_id === false ) |
|
117 $client_id = $session->user_id; |
|
118 |
|
119 $q = $db->sql_query('SELECT 1 FROM ' . table_prefix . "yms_yubikeys WHERE id = $id AND client_id = $client_id;"); |
|
120 if ( !$q ) |
|
121 $db->_die(); |
|
122 |
|
123 if ( $db->numrows() < 1 ) |
|
124 { |
|
125 $db->free_result(); |
|
126 return 'yms_err_delete_not_found'; |
|
127 } |
|
128 $db->free_result(); |
|
129 |
|
130 $q = $db->sql_query('DELETE FROM ' . table_prefix . "yms_yubikeys WHERE id = $id AND client_id = $client_id;"); |
106 if ( !$q ) |
131 if ( !$q ) |
107 $db->_die(); |
132 $db->_die(); |
108 |
133 |
109 return true; |
134 return true; |
110 } |
135 } |