From 12dee92632b0c6c85536d48e3255421fff4e7a8d Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 23 Feb 2017 17:49:33 +0100 Subject: [PATCH] * [MOD] Print timestamp when logging to file * [MOD] Display user name and login when listing API tokens --- inc/Base.php | 6 +++--- inc/SP/Mgmt/ApiTokens/ApiTokenSearch.class.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/inc/Base.php b/inc/Base.php index 511a5ea6..eb50fc7a 100644 --- a/inc/Base.php +++ b/inc/Base.php @@ -67,11 +67,11 @@ $timeStart = Init::microtime_float(); * Función para enviar mensajes al log de errores * * @param mixed $data - * @param bool $printLastCaller + * @param bool $printLastCaller */ function debugLog($data, $printLastCaller = false) { - if (!error_log(print_r($data, true) . PHP_EOL, 3, LOG_FILE)) { + if (!error_log(date('Y-m-d H:i:s') . ' - ' . print_r($data, true) . PHP_EOL, 3, LOG_FILE)) { error_log(print_r($data, true)); } @@ -94,7 +94,7 @@ function debugLog($data, $printLastCaller = false) * Alias gettext function * * @param string $string - * @param bool $tranlate Si es necesario traducir + * @param bool $tranlate Si es necesario traducir * @return string */ function __($string, $tranlate = true) diff --git a/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.class.php b/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.class.php index 60859649..21239cf6 100644 --- a/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.class.php +++ b/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.class.php @@ -43,13 +43,14 @@ class ApiTokenSearch extends ApiTokenBase implements ItemSearchInterface */ public function getMgmtSearch(ItemSearchData $SearchData) { - $query = 'SELECT authtoken_id,' . - 'authtoken_userId,' . - 'authtoken_actionId, ' . - 'authtoken_token, ' . - 'user_login ' . - 'FROM authTokens ' . - 'LEFT JOIN usrData ON user_id = authtoken_userId '; + $query = /** @lang SQL */ + 'SELECT authtoken_id, + authtoken_userId, + authtoken_actionId, + authtoken_token, + CONCAT(user_name, \' (\', user_login, \')\') AS user_login + FROM authTokens + LEFT JOIN usrData ON user_id = authtoken_userId '; $Data = new QueryData();