Skip to content

Commit

Permalink
3.0.9
Browse files Browse the repository at this point in the history
Improvements on logs (#3759)
  • Loading branch information
nilsteampassnet committed Jul 3, 2023
1 parent d424149 commit 88f7986
Show file tree
Hide file tree
Showing 31 changed files with 216 additions and 14 deletions.
3 changes: 3 additions & 0 deletions includes/language/bulgarian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/catalan.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/chinese.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/czech.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/dutch.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* @see https://www.teampass.net
*/
return array(
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',
'error_while_creating_file' => 'Error while creating file',
'field' => 'Field',
'exceeds_maximum_length_of' => 'exceeds maximum length of',
Expand Down
3 changes: 3 additions & 0 deletions includes/language/estonian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/french.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Jour',
'reset' => 'Réinitialiser',
'error_while_creating_file' => 'Création du fichier impossible',
'new_keys_generated' => 'Nouvelles clés générées',
'user_creation' => 'Utilisateur créé',
'user_deletion' => 'Utilisateur supprimé',

);
3 changes: 3 additions & 0 deletions includes/language/german.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/greek.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/hungarian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/italian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/japanese.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/norwegian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/polish.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/portuguese.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/portuguese_br.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Dia',
'reset' => 'Redefinir',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/romanian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/russian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1102,5 +1102,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/spanish.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Día',
'reset' => 'Restablecer',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/swedish.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/turkish.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/ukrainian.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions includes/language/vietnamese.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,5 +1101,8 @@
'day' => 'Day',
'reset' => 'Reset',
'error_while_creating_file' => 'Error while creating file',
'new_keys_generated' => 'New keys generated',
'user_creation' => 'User creation',
'user_deletion' => 'User deletion',

);
3 changes: 3 additions & 0 deletions install/install.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,9 @@ function encryptFollowingDefuse($message, $ascii_key)
`roles_from_ad_groups` varchar(1000) NULL,
`ongoing_process_id` VARCHAR(100) NULL,
`mfa_enabled` tinyint(1) NOT null DEFAULT '1',
`created_at` varchar(30) NULL,
`updated_at` varchar(30) NULL,
`deleted_at` varchar(30) NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`)
) CHARSET=utf8;"
Expand Down
1 change: 0 additions & 1 deletion install/upgrade_run_3.0.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,6 @@
mysqli_query(
$db_link,
"ALTER TABLE `" . $pre . "export`
MODIFY COLUMN `id` int(12) NOT NULL,
MODIFY COLUMN `label` VARCHAR(500) NOT NULL,
MODIFY COLUMN `path` VARCHAR(500) NOT NULL;"
);
Expand Down
87 changes: 86 additions & 1 deletion install/upgrade_run_3.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,51 @@
"int(12) NOT NULL"
);

// Add field created_at to USERS table
$res = addColumnIfNotExist(
$pre . 'users',
'created_at',
"varchar(30) NULL;"
);
if ($res === false) {
echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table USERS! ' . mysqli_error($db_link) . '!"}]';
mysqli_close($db_link);
exit();
}

// Add field updated_at to USERS table
$res = addColumnIfNotExist(
$pre . 'users',
'updated_at',
"varchar(30) NULL;"
);
if ($res === false) {
echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table USERS! ' . mysqli_error($db_link) . '!"}]';
mysqli_close($db_link);
exit();
}

// Add field deleted_at to USERS table
$res = addColumnIfNotExist(
$pre . 'users',
'deleted_at',
"varchar(30) NULL;"
);
if ($res === false) {
echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table USERS! ' . mysqli_error($db_link) . '!"}]';
mysqli_close($db_link);
exit();
}

//
$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "users` WHERE created_at IS NOT NULL"));
if (intval($tmp) === 0) {
populateUsersTable($pre);
}


// populate created_at, updated_at and deleted_at fields in USERS table

//---<END 3.0.9

// Save timestamp
Expand All @@ -336,4 +381,44 @@
mysqli_close($db_link);

// Finished
echo '[{"finish":"1" , "next":"", "error":""}]';
echo '[{"finish":"1" , "next":"", "error":""}]';


//---< FUNCTIONS

function populateUsersTable($pre)
{
global $db_link;
// loop on users - created_at
$users = mysqli_query(
$db_link,
"select u.id as uid, ls.date as datetime
from `" . $pre . "users` as u
inner join `" . $pre . "log_system` as ls on ls.field_1 = u.id
WHERE ls.type = 'user_mngt' AND ls.label = 'at_user_added'"
);
while ($user = mysqli_fetch_assoc($users)) {
if (empty((string) $user['datetime']) === false && is_null($user['datetime']) === false) {
// update created_at field
mysqli_query(
$db_link,
"UPDATE `" . $pre . "users` SET created_at = '".$user['datetime']."' WHERE id = ".$user['uid']
);
}
}

// loop on users - updated_at
$users = mysqli_query(
$db_link,
"select u.id as uid, (select date from " . $pre . "log_system where type = 'user_mngt' and field_1=uid order by date DESC limit 1) as datetime from `" . $pre . "users` as u;"
);
while ($user = mysqli_fetch_assoc($users)) {
if (empty((string) $user['datetime']) === false && is_null($user['datetime']) === false) {
// update updated_at field
mysqli_query(
$db_link,
"UPDATE `" . $pre . "users` SET updated_at = '".$user['datetime']."' WHERE id = ".$user['uid']
);
}
}
}
15 changes: 8 additions & 7 deletions pages/utilities.logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

<div class="tab-content mt-1" id="myTabContent">
<div class="tab-pane fade show active" id="connections" role="tabpanel" aria-labelledby="connections-tab">
<table class="table table-striped table-responsive" id="table-connections" style="width:100%;">
<table class="table table-striped nowrap table-responsive-sm" id="table-connections" style="width:100%;">
<thead>
<tr>
<th style=""><?php echo langHdl('date'); ?></th>
Expand All @@ -109,7 +109,7 @@
</table>
</div>
<div class="tab-pane fade" id="errors" role="tabpanel" aria-labelledby="errors-tab">
<table class="table table-striped table-responsive" table-responsive id="table-errors" style="width:100%;">
<table class="table table-striped nowrap table-responsive-sm" id="table-errors" style="width:100%;">
<thead>
<tr>
<th style=""><?php echo langHdl('date'); ?></th>
Expand All @@ -120,7 +120,7 @@
</table>
</div>
<div class="tab-pane fade" id="copy" role="tabpanel" aria-labelledby="copy-tab">
<table class="table table-striped table-responsive" id="table-copy" style="width:100%;">
<table class="table table-striped nowrap table-responsive-sm" id="table-copy" style="width:100%;">
<thead>
<tr>
<th style=""><?php echo langHdl('date'); ?></th>
Expand All @@ -131,18 +131,19 @@
</table>
</div>
<div class="tab-pane fade" id="admin" role="tabpanel" aria-labelledby="admin-tab">
<table class="table table-striped table-responsive" id="table-admin" style="width:100%;">
<table class="table table-striped nowrap table-responsive-sm" id="table-admin" style="width:100%;">
<thead>
<tr>
<th style=""><?php echo langHdl('date'); ?></th>
<th style=""><?php echo langHdl('user'); ?></th>
<th style=""><?php echo langHdl('author'); ?></th>
<th style=""><?php echo langHdl('action'); ?></th>
<th style=""><?php echo langHdl('who'); ?></th>
</tr>
</thead>
</table>
</div>
<div class="tab-pane fade" id="items" role="tabpanel" aria-labelledby="items-tab">
<table class="table table-striped table-responsive" id="table-items" style="width:100%;">
<table class="table table-striped nowrap table-responsive-sm" id="table-items" style="width:100%;">
<thead>
<tr>
<th style=""><?php echo langHdl('date'); ?></th>
Expand All @@ -157,7 +158,7 @@
</table>
</div>
<div class="tab-pane fade" id="failed" role="tabpanel" aria-labelledby="failed-tab">
<table class="table table-striped table-responsive" id="table-failed" style="width:100%;">
<table class="table table-striped nowrap table-responsive-sm" id="table-failed">
<thead>
<tr>
<th style=""><?php echo langHdl('date'); ?></th>
Expand Down
Loading

0 comments on commit 88f7986

Please sign in to comment.