123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?php
- //includes files
- require_once dirname(__DIR__, 2) . "/resources/require.php";
- require_once "resources/check_auth.php";
- //check permissions
- if (permission_exists('user_log_view')) {
- //access granted
- }
- else {
- echo "access denied";
- exit;
- }
- //add multi-lingual support
- $language = new text;
- $text = $language->get();
- //get the uuid
- $user_log_uuid = $_GET['id'];
- //pre-populate the form
- if (!empty($_GET) && is_array($_GET) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
- $sql = "select * from v_user_logs ";
- $sql .= "where user_log_uuid = :user_log_uuid ";
- //$sql .= "and domain_uuid = :domain_uuid ";
- //$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
- $parameters['user_log_uuid'] = $user_log_uuid;
- $database = new database;
- $row = $database->select($sql, $parameters, 'row');
- if (is_array($row) && @sizeof($row) != 0) {
- $domain_uuid = $row["domain_uuid"];
- $timestamp = $row["timestamp"];
- $user_uuid = $row["user_uuid"];
- $username = $row["username"];
- $type = $row["type"];
- $result = $row["result"];
- $remote_address = $row["remote_address"];
- $user_agent = $row["user_agent"];
- }
- unset($sql, $parameters, $row);
- }
- //create token
- $object = new token;
- $token = $object->create($_SERVER['PHP_SELF']);
- //show the header
- $document['title'] = $text['title-user_log'];
- require_once "resources/header.php";
- //get the users
- $sql = "SELECT user_uuid, username FROM v_users ";
- $sql .= "WHERE domain_uuid = :domain_uuid ";
- $sql .= "ORDER by username asc ";
- $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
- $database = new database;
- $users = $database->execute($sql, $parameters, 'all');
- unset ($sql, $parameters);
- //show the content
- echo "<form name='frm' id='frm' method='post' action=''>\n";
- echo "<input class='formfld' type='hidden' name='user_log_uuid' value='".escape($user_log_uuid)."'>\n";
- echo "<div class='action_bar' id='action_bar'>\n";
- echo " <div class='heading'><b>".$text['title-user_log']."</b></div>\n";
- echo " <div class='actions'>\n";
- echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'user_logs.php']);
- echo " </div>\n";
- echo " <div style='clear: both;'></div>\n";
- echo "</div>\n";
- echo $text['title_description-user_logs']."\n";
- echo "<br /><br />\n";
- echo "<div class='card'>\n";
- echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
- echo "<tr>\n";
- echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-domain_uuid']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <select class='formfld' name='domain_uuid'>\n";
- if (empty($domain_uuid)) {
- echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
- }
- else {
- echo " <option value=''>".$text['label-global']."</option>\n";
- }
- foreach ($_SESSION['domains'] as $row) {
- if ($row['domain_uuid'] == $domain_uuid) {
- echo " <option value='".$row['domain_uuid']."' selected='selected'>".escape($row['domain_name'])."</option>\n";
- }
- else {
- echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
- }
- }
- echo " </select>\n";
- echo "<br />\n";
- echo $text['description-domain_uuid']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-timestamp']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <input class='formfld' type='text' name='timestamp' maxlength='255' value='".escape($timestamp)."'>\n";
- echo "<br />\n";
- echo $text['description-timestamp']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-user_uuid']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <select class='formfld' name='user_uuid'>\n";
- echo " <option value=''></option>\n";
- foreach($users as $field) {
- if ($field['user_uuid'] == $user_uuid) { $selected = "selected='selected'"; } else { $selected = ''; }
- echo " <option value='".$field['user_uuid']."' $selected>".escape($field['username'])."</option>\n";
- }
- echo " </select>\n";
- echo "<br />\n";
- echo $text['description-user_uuid']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-username']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <input class='formfld' type='text' name='username' maxlength='255' value='".escape($username)."'>\n";
- echo "<br />\n";
- echo $text['description-username']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-type']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <input class='formfld' type='text' name='type' maxlength='255' value='".escape($type)."'>\n";
- echo "<br />\n";
- echo $text['description-type']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-result']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <select class='formfld' name='result'>\n";
- echo " <option value=''></option>\n";
- if ($result == "success") {
- echo " <option value='success' selected='selected'>".$text['label-success']."</option>\n";
- }
- else {
- echo " <option value='success'>".$text['label-success']."</option>\n";
- }
- if ($result == "failure") {
- echo " <option value='failure' selected='selected'>".$text['label-failure']."</option>\n";
- }
- else {
- echo " <option value='failure'>".$text['label-failure']."</option>\n";
- }
- echo " </select>\n";
- echo "<br />\n";
- echo $text['description-result']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-remote_address']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <input class='formfld' type='text' name='remote_address' maxlength='255' value='".escape($remote_address)."'>\n";
- echo "<br />\n";
- echo $text['description-remote_address']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
- echo " ".$text['label-user_agent']."\n";
- echo "</td>\n";
- echo "<td class='vtable' style='position: relative;' align='left'>\n";
- echo " <input class='formfld' type='text' name='user_agent' maxlength='255' value='".escape($user_agent)."'>\n";
- echo "<br />\n";
- echo $text['description-user_agent']."\n";
- echo "</td>\n";
- echo "</tr>\n";
- echo "</table>";
- echo "</div>";
- echo "<br /><br />";
- echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
- echo "</form>";
- //include the footer
- require_once "resources/footer.php";
- ?>
|