Passed
Push — main ( 4b1ce6...7d2b49 )
by Rafael
80:06
created
public/htdocs/api/index.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 // Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used.
76 76
 if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
77
-    define("DOLENTITY", (int)$_SERVER['HTTP_DOLAPIENTITY']);
77
+    define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
78 78
 }
79 79
 
80 80
 // Response for preflight requests (used by browser when into a CORS context)
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 // If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log"
184 184
 if (getDolGlobalString('MAIN_API_DEBUG')) {
185 185
     $r = $api->r;
186
-    $r->onCall(function () use ($r) {
186
+    $r->onCall(function() use ($r) {
187 187
         // Don't log Luracast Restler Explorer resources calls
188 188
         //if (!preg_match('/^explorer/', $r->url)) {
189 189
         //  'method'  => $api->r->requestMethod,
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
     $sql = "SELECT up.value";
449 449
     $sql .= " FROM " . MAIN_DB_PREFIX . "user_param as up";
450 450
     $sql .= " WHERE up.param = 'API_COUNT_CALL'";
451
-    $sql .= " AND up.fk_user = " . ((int)$userid);
452
-    $sql .= " AND up.entity = " . ((int)$conf->entity);
451
+    $sql .= " AND up.fk_user = " . ((int) $userid);
452
+    $sql .= " AND up.entity = " . ((int) $conf->entity);
453 453
 
454 454
     $result = $db->query($sql);
455 455
     if ($result) {
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
         if ($nbrows == 0) {
459 459
             $sql2 = "INSERT INTO " . MAIN_DB_PREFIX . "user_param";
460 460
             $sql2 .= " (fk_user, entity, param, value)";
461
-            $sql2 .= " VALUES (" . ((int)$userid) . ", " . ((int)$conf->entity) . ", 'API_COUNT_CALL', 1)";
461
+            $sql2 .= " VALUES (" . ((int) $userid) . ", " . ((int) $conf->entity) . ", 'API_COUNT_CALL', 1)";
462 462
         } else {
463 463
             $updateapi = true;
464 464
             $sql2 = "UPDATE " . MAIN_DB_PREFIX . "user_param as up";
465 465
             $sql2 .= " SET up.value = up.value + 1";
466 466
             $sql2 .= " WHERE up.param = 'API_COUNT_CALL'";
467
-            $sql2 .= " AND up.fk_user = " . ((int)$userid);
468
-            $sql2 .= " AND up.entity = " . ((int)$conf->entity);
467
+            $sql2 .= " AND up.fk_user = " . ((int) $userid);
468
+            $sql2 .= " AND up.entity = " . ((int) $conf->entity);
469 469
         }
470 470
 
471 471
         $result2 = $db->query($sql2);
Please login to merge, or discard this patch.