Passed
Push — master ( 9cec7c...24d7ce )
by Nils
05:13
created
sources/logs.datatables.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 require_once 'SecureHandler.php';
28 28
 session_name('teampass_session');
29 29
 session_start();
30
-if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) {
30
+if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) {
31 31
     die('Hacking attempt...');
32 32
 }
33 33
 
@@ -893,15 +893,15 @@  discard block
 block discarded – undo
893 893
         //col1
894 894
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
895 895
         //col2
896
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
896
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
897 897
         //col3
898
-        $sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
898
+        $sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
899 899
         //col4
900 900
         $sOutput .= '"'.$record['process_type'].'", ';
901 901
         // col5
902 902
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
903 903
             $data_user = DB::queryfirstrow(
904
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
904
+                'SELECT name, lastname FROM '.prefixTable('users').'
905 905
                 WHERE id = %i',
906 906
                 json_decode($record['arguments'], true)['new_user_id']
907 907
             );
@@ -984,13 +984,12 @@  discard block
 block discarded – undo
984 984
         //col1
985 985
         $sOutput .= '"", ';
986 986
         //col2
987
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
987
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
988 988
         //col3
989 989
         $sOutput .= is_null($record['started_at']) === false ?
990
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
991
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
990
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
992 991
         //col4
993
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
992
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
994 993
         // col7
995 994
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
996 995
         //col5
@@ -1008,7 +1007,7 @@  discard block
 block discarded – undo
1008 1007
         $newUserId = json_decode($record['arguments'], true)['new_user_id'];
1009 1008
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1010 1009
             $data_user = DB::queryfirstrow(
1011
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1010
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1012 1011
                 WHERE id = %i',
1013 1012
                 $newUserId
1014 1013
             );
@@ -1024,7 +1023,7 @@  discard block
 block discarded – undo
1024 1023
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1025 1024
             $user = json_decode($record['arguments'], true)['user_id'];
1026 1025
             $data_user = DB::queryfirstrow(
1027
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1026
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1028 1027
                 WHERE id = %i',
1029 1028
                 $user
1030 1029
             );
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 DB::debugmode(false);
65 65
 $process_to_perform = DB::queryfirstrow(
66 66
     'SELECT *
67
-    FROM ' . prefixTable('processes') . '
67
+    FROM ' . prefixTable('processes').'
68 68
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item")
69 69
     ORDER BY increment_id ASC',
70 70
     1
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     // search for next process to handle
82 82
     $process_to_perform = DB::queryfirstrow(
83 83
         'SELECT *
84
-        FROM ' . prefixTable('processes') . '
84
+        FROM ' . prefixTable('processes').'
85 85
         WHERE is_in_progress = %i AND finished_at = "" AND process_type IN ("item_copy", "new_item", "update_item")
86 86
         ORDER BY increment_id ASC',
87 87
         0
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             $process_to_perform['increment_id']
99 99
         );
100 100
 
101
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
101
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
102 102
         handleTask(
103 103
             $process_to_perform['increment_id'],
104 104
             json_decode($process_to_perform['arguments'], true),
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS): bool
125 125
 {
126
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
126
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
127 127
     //DB::debugmode(false);
128 128
     $task_to_perform = DB::queryfirstrow(
129 129
         'SELECT *
130
-        FROM ' . prefixTable('processes_tasks') . '
130
+        FROM ' . prefixTable('processes_tasks').'
131 131
         WHERE process_id = %i AND finished_at IS NULL
132 132
         ORDER BY increment_id ASC',
133 133
         $processId
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         // check if a linux process is not currently on going
148 148
         // if sub_task_in_progress === 1 then exit
149 149
         if ((int) $task_to_perform['sub_task_in_progress'] === 0) {
150
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]', $SETTINGS);
150
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]', $SETTINGS);
151 151
 
152 152
             // handle next task
153 153
             $args = json_decode($task_to_perform['task'], true);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             DB::update(
229 229
                 prefixTable('processes_tasks'),
230 230
                 array(
231
-                    'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
231
+                    'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
232 232
                     'task' => json_encode(["status" => "Done"]),
233 233
                     'is_in_progress' => -1,
234 234
                     'finished_at' => time(),
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
         } else {
264 264
             // Task is currently being in progress by another server process
265
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
265
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
266 266
             return false;
267 267
         }
268 268
     }
Please login to merge, or discard this patch.