Passed
Push — wip_sessions ( 2e0cc8...014f47 )
by Nils
05:41
created
api/Model/Operation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 "error" => '',
41 41
             );
42 42
     
43
-        }catch (Exception $e) {    
43
+        } catch (Exception $e) {    
44 44
             return false;
45 45
         }
46 46
     }
Please login to merge, or discard this patch.
scripts/task_maintenance_clean_orphan_objects.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         }
86 86
     }
87 87
 
88
-    $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
88
+    $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
89 89
     foreach ($items as $item) {
90 90
         //Delete item
91 91
         DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
     // delete orphan items
105 105
     $rows = DB::query(
106 106
         'SELECT id
107
-        FROM ' . prefixTable('items') . '
107
+        FROM ' . prefixTable('items').'
108 108
         ORDER BY id ASC'
109 109
     );
110 110
     foreach ($rows as $item) {
111 111
         DB::query(
112
-            'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
112
+            'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
113 113
             $item['id'],
114 114
             'at_creation'
115 115
         );
Please login to merge, or discard this patch.
scripts/task_maintenance_users_personal_folder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     //get through all users
77 77
     $users = DB::query(
78 78
         'SELECT id, login, email
79
-        FROM ' . prefixTable('users') . '
79
+        FROM ' . prefixTable('users').'
80 80
         WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
81 81
         ORDER BY login ASC'
82 82
     );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         //if folder doesn't exist then create it
97 97
         $data = DB::queryfirstrow(
98 98
             'SELECT id
99
-            FROM ' . prefixTable('nested_tree') . '
99
+            FROM ' . prefixTable('nested_tree').'
100 100
             WHERE title = %s AND parent_id = %i',
101 101
             $user['id'],
102 102
             0
Please login to merge, or discard this patch.
scripts/background_tasks___do_calculation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     // get count of Items in this folder
72 72
     $get = DB::queryfirstrow(
73 73
         'SELECT count(*) as num_results
74
-        FROM ' . prefixTable('items') . '
74
+        FROM ' . prefixTable('items').'
75 75
         WHERE inactif = %i AND id_tree = %i',
76 76
         0,
77 77
         $child->id
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
     $ret[$child->id]['id'] = $child->id;
81 81
 
82 82
     // get number of subfolders
83
-    $nodeDescendants =$tree->getDescendants($child->id, false, false, true);
83
+    $nodeDescendants = $tree->getDescendants($child->id, false, false, true);
84 84
     $ret[$child->id]['subfoldersCount'] = count($nodeDescendants);
85 85
 
86 86
     // get items number in subfolders
87 87
     if (count($nodeDescendants) > 0) {
88 88
         $get = DB::queryfirstrow(
89 89
             'SELECT count(*) as num_results
90
-            FROM ' . prefixTable('items') . '
90
+            FROM ' . prefixTable('items').'
91 91
             WHERE inactif = %i AND id_tree IN (%l)',
92 92
             0,
93 93
             implode(',', $nodeDescendants)
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 DB::debugmode(false);
75 75
 $process_to_perform = DB::queryfirstrow(
76 76
     'SELECT *
77
-    FROM ' . prefixTable('processes') . '
77
+    FROM ' . prefixTable('processes').'
78 78
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item")
79 79
     ORDER BY increment_id ASC',
80 80
     1
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     // search for next process to handle
92 92
     $process_to_perform = DB::queryfirstrow(
93 93
         'SELECT *
94
-        FROM ' . prefixTable('processes') . '
94
+        FROM ' . prefixTable('processes').'
95 95
         WHERE is_in_progress = %i AND finished_at = "" AND process_type IN ("item_copy", "new_item", "update_item")
96 96
         ORDER BY increment_id ASC',
97 97
         0
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $process_to_perform['increment_id']
109 109
         );
110 110
 
111
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
111
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
112 112
         handleTask(
113 113
             $process_to_perform['increment_id'],
114 114
             json_decode($process_to_perform['arguments'], true),
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 // launch a new iterative process
126 126
 $process_to_perform = DB::queryfirstrow(
127 127
     'SELECT *
128
-    FROM ' . prefixTable('processes') . '
128
+    FROM ' . prefixTable('processes').'
129 129
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item")
130 130
     ORDER BY increment_id ASC',
131 131
     1
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS): bool
149 149
 {
150
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
150
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
151 151
     $task_to_perform = DB::queryfirstrow(
152 152
         'SELECT *
153
-        FROM ' . prefixTable('processes_tasks') . '
153
+        FROM ' . prefixTable('processes_tasks').'
154 154
         WHERE process_id = %i AND finished_at IS NULL
155 155
         ORDER BY increment_id ASC',
156 156
         $processId
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // check if a linux process is not currently on going
164 164
         // if sub_task_in_progress === 1 then exit
165 165
         if ((int) $task_to_perform['sub_task_in_progress'] === 0) {
166
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]', $SETTINGS);
166
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]', $SETTINGS);
167 167
 
168 168
             // handle next task
169 169
             $args = json_decode($task_to_perform['task'], true);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             DB::update(
245 245
                 prefixTable('processes_tasks'),
246 246
                 array(
247
-                    'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
247
+                    'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
248 248
                     'task' => json_encode(["status" => "Done"]),
249 249
                     'is_in_progress' => -1,
250 250
                     'finished_at' => time(),
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
         } else {
280 280
             // Task is currently being in progress by another server process
281
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
281
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
282 282
             return false;
283 283
         }
284 284
     }
Please login to merge, or discard this patch.
scripts/task_maintenance_reload_cache_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@
 block discarded – undo
74 74
 function reloadCacheTable(): void
75 75
 {
76 76
     // Load expected files
77
-    require_once __DIR__. '/../sources/main.functions.php';
78
-    include __DIR__. '/../includes/config/tp.config.php';
77
+    require_once __DIR__.'/../sources/main.functions.php';
78
+    include __DIR__.'/../includes/config/tp.config.php';
79 79
 
80 80
     updateCacheTable('reload', NULL);
81 81
 }
82 82
\ No newline at end of file
Please login to merge, or discard this patch.
api/Model/ItemModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 use TeampassClasses\NestedTree\NestedTree;
26 26
 
27
-require_once API_ROOT_PATH . "/Model/Database.php";
27
+require_once API_ROOT_PATH."/Model/Database.php";
28 28
 
29 29
 class ItemModel extends Database
30 30
 {
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
             "SELECT i.id, label, description, i.pw, i.url, i.id_tree, i.login, i.email, i.viewed_no, i.fa_icon, i.inactif, i.perso, t.title as folder_label
47 47
             FROM ".prefixTable('items')." as i
48 48
             LEFT JOIN ".prefixTable('nested_tree')." as t ON (t.id = i.id_tree) ".
49
-            $sqlExtra . 
50
-            " ORDER BY i.id ASC" .
49
+            $sqlExtra. 
50
+            " ORDER BY i.id ASC".
51 51
             //($limit > 0 ? " LIMIT ?". ["i", $limit] : '')
52
-            ($limit > 0 ? " LIMIT ". $limit : '')
52
+            ($limit > 0 ? " LIMIT ".$limit : '')
53 53
         );
54 54
         $ret = [];
55 55
         foreach ($rows as $row) {
56 56
             $userKey = $this->select(
57 57
                 'SELECT share_key
58
-                FROM ' . prefixTable('sharekeys_items') . '
58
+                FROM ' . prefixTable('sharekeys_items').'
59 59
                 WHERE user_id = '.$userId.' AND object_id = '.$row['id']                
60 60
             );
61 61
             if (count($userKey) === 0 || empty($row['pw']) === true) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 if (empty($path) === true) {
90 90
                     $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
91 91
                 } else {
92
-                    $path .= '/' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
92
+                    $path .= '/'.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
93 93
                 }
94 94
             }
95 95
 
Please login to merge, or discard this patch.
api/index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 header("Access-Control-Allow-Methods: POST");
31 31
 header("Access-Control-Max-Age: 3600");
32 32
 header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
33
-require __DIR__ . "/inc/bootstrap.php";
33
+require __DIR__."/inc/bootstrap.php";
34 34
 
35 35
 // sanitize url segments
36 36
 $base = new BaseController();
37 37
 $uri = $base->getUriSegments();
38 38
 if (is_array($uri) === false || is_string($uri) === true) {
39
-    $uri = [$uri];  // ensure $uril is table
39
+    $uri = [$uri]; // ensure $uril is table
40 40
 }
41 41
 
42 42
 // Prepare DB password
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 if ($uri[0] === 'authorize') {
53 53
     // Is API enabled in Teampass settings
54 54
     if ($apiStatus['error'] === false) {
55
-        require API_ROOT_PATH . "/Controller/Api/AuthController.php";
55
+        require API_ROOT_PATH."/Controller/Api/AuthController.php";
56 56
         $objFeedController = new AuthController();
57
-        $strMethodName = $uri[0] . 'Action';
57
+        $strMethodName = $uri[0].'Action';
58 58
         $objFeedController->{$strMethodName}();
59 59
     } else {
60 60
         // Error management
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 
81 81
     // action related to USER
82 82
     } elseif ($controller === 'user') {
83
-        require API_ROOT_PATH . "/Controller/Api/UserController.php";
83
+        require API_ROOT_PATH."/Controller/Api/UserController.php";
84 84
         $objFeedController = new UserController();
85
-        $strMethodName = (string) $action . 'Action';
85
+        $strMethodName = (string) $action.'Action';
86 86
         $objFeedController->{$strMethodName}();
87 87
 
88 88
     // action related to ITEM
Please login to merge, or discard this patch.
api/Model/Database.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         try {
32 32
             $this->connection = new \mysqli(DB_HOST, DB_USER, DB_PASSWD_CLEAR, DB_NAME);
33 33
 
34
-            if ( mysqli_connect_errno()) {
34
+            if (mysqli_connect_errno()) {
35 35
                 throw new Exception("Could not connect to database.");   
36 36
             }
37 37
         } catch (Exception $e) {
@@ -39,37 +39,37 @@  discard block
 block discarded – undo
39 39
         }           
40 40
     }
41 41
 
42
-    public function select($query = "" , $params = [])
42
+    public function select($query = "", $params = [])
43 43
     {
44 44
         try {
45
-            $stmt = $this->executeStatement( $query , $params );
45
+            $stmt = $this->executeStatement($query, $params);
46 46
             $result = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);               
47 47
             $stmt->close();
48 48
 
49 49
             return $result;
50
-        } catch(Exception $e) {
51
-            throw New Exception( $e->getMessage() );
50
+        } catch (Exception $e) {
51
+            throw New Exception($e->getMessage());
52 52
         }
53 53
     }
54 54
 
55
-    private function executeStatement($query = "" , $params = [])
55
+    private function executeStatement($query = "", $params = [])
56 56
     {
57 57
         try {
58
-            $stmt = $this->connection->prepare( $query );
58
+            $stmt = $this->connection->prepare($query);
59 59
 
60
-            if($stmt === false) {
61
-                throw New Exception("Unable to do prepared statement: " . $query);
60
+            if ($stmt === false) {
61
+                throw New Exception("Unable to do prepared statement: ".$query);
62 62
             }
63 63
 
64
-            if( $params ) {
64
+            if ($params) {
65 65
                 $stmt->bind_param($params[0], $params[1]);
66 66
             }
67 67
 
68 68
             $stmt->execute();
69 69
 
70 70
             return $stmt;
71
-        } catch(Exception $e) {
72
-            throw New Exception( $e->getMessage() );
71
+        } catch (Exception $e) {
72
+            throw New Exception($e->getMessage());
73 73
         }   
74 74
     }
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.