GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 8f9c3d...610f46 )
by
unknown
02:37
created
src/BitPrepared/Bundle/D1b0Workspace/Controller/V1/SecurityController.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Symfony\Component\HttpFoundation\JsonResponse;
8 8
 use Silex\Application;
9 9
 use Silex\Api\ControllerProviderInterface;
10
-use Monolog\Logger;
11 10
 use RedBeanPHP\Facade as R;
12 11
 
13 12
 class SecurityController implements ControllerProviderInterface
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -31,41 +31,41 @@  discard block
 block discarded – undo
31 31
     {
32 32
         /*TODO remove this line in producton DBG DATA {"authMode":"Email","email":"[email protected]","name":"ugo","surname":"ugo","password":"cane"}*/
33 33
         $data = json_decode($request->getContent(), true);
34
-        if($data === NULL){
35
-            $headers=[];
34
+        if ($data === NULL) {
35
+            $headers = [];
36 36
             $response = JsonResponse::create($res, 403, $headers)->setSharedMaxAge(300);
37 37
             return $response;
38 38
         }
39 39
 
40 40
         $authMode = $data['authMode'];
41 41
 
42
-        if($authMode === 'Email'){
42
+        if ($authMode === 'Email') {
43 43
             $email = $data['email'];
44 44
             $password = $data['password'];
45 45
             $name = $data['name'];
46 46
             $surname = $data['surname'];
47
-            $user = R::findOne('user',"WHERE email = ? AND name = ? AND surname = ?",[$email,$name,$surname]);
48
-            if($user->pwd === hash("sha256",$user->salt.$password)){
47
+            $user = R::findOne('user', "WHERE email = ? AND name = ? AND surname = ?", [$email, $name, $surname]);
48
+            if ($user->pwd === hash("sha256", $user->salt.$password)) {
49 49
                 //LOGGED IN!
50 50
                 $this->app['session']->set('user', ['id' => $user->id]);
51
-                $headers=[];
51
+                $headers = [];
52 52
                 $res = [
53
-                        "token"=>"blablabla",//TODO CREATE token
53
+                        "token"=>"blablabla", //TODO CREATE token
54 54
                         "clientId"=>$user->id
55 55
                 ];
56 56
                 $response = JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
57
-            }else{
58
-                $headers=[];
57
+            }else {
58
+                $headers = [];
59 59
                 $res = [
60 60
                         "errore"=>"sbagliato password o user" //TODO roba
61 61
                 ];
62 62
                 $response = JsonResponse::create($res, 401, $headers)->setSharedMaxAge(300);
63 63
             }
64 64
         }
65
-        else{
65
+        else {
66 66
             //Facebook Redirect
67 67
         }
68
-        return $response;// JsonResponse::create($output, 200, $headers)->setSharedMaxAge(300);
68
+        return $response; // JsonResponse::create($output, 200, $headers)->setSharedMaxAge(300);
69 69
     }
70 70
     public function logout(Request $request)
71 71
     {
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
     }
79 79
     public function confirm(Request $request)
80 80
     {
81
-            $confirmKey= $request->request->get('confirmKey');
82
-            $verify = R::findOne('verify',"WHERE key = ?",[$confirmKey]);
83
-            if (!$bean->id){
81
+            $confirmKey = $request->request->get('confirmKey');
82
+            $verify = R::findOne('verify', "WHERE key = ?", [$confirmKey]);
83
+            if (!$bean->id) {
84 84
                 //TODO mettere un controllo agli IP che forzano le richieste di token falsi
85 85
                 $response = "<html><head></head><body>Token non esistente!</body></html>";
86
-            }else{
87
-                if(strtotime($verify->inserttime) < strtotime("-15 minutes")){
88
-                    $user = R::load('user',$verify->user);
89
-                    $user->status="enabled";
90
-                    $user->updatetime=date('Y-m-d H:i:s');
86
+            }else {
87
+                if (strtotime($verify->inserttime) < strtotime("-15 minutes")) {
88
+                    $user = R::load('user', $verify->user);
89
+                    $user->status = "enabled";
90
+                    $user->updatetime = date('Y-m-d H:i:s');
91 91
                     $id = R::store($user);
92 92
                     $response = "<html><head></head><body>Account attivato complimenti!</body></html>";
93
-                }else{
93
+                }else {
94 94
                     $response = "<html><head></head><body>Impossibile attivare account inserire mail e password per richiedere un nuovo token!</body></html>";
95 95
                 }
96 96
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,15 +54,14 @@  discard block
 block discarded – undo
54 54
                         "clientId"=>$user->id
55 55
                 ];
56 56
                 $response = JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
57
-            }else{
57
+            } else{
58 58
                 $headers=[];
59 59
                 $res = [
60 60
                         "errore"=>"sbagliato password o user" //TODO roba
61 61
                 ];
62 62
                 $response = JsonResponse::create($res, 401, $headers)->setSharedMaxAge(300);
63 63
             }
64
-        }
65
-        else{
64
+        } else{
66 65
             //Facebook Redirect
67 66
         }
68 67
         return $response;// JsonResponse::create($output, 200, $headers)->setSharedMaxAge(300);
@@ -83,14 +82,14 @@  discard block
 block discarded – undo
83 82
             if (!$bean->id){
84 83
                 //TODO mettere un controllo agli IP che forzano le richieste di token falsi
85 84
                 $response = "<html><head></head><body>Token non esistente!</body></html>";
86
-            }else{
85
+            } else{
87 86
                 if(strtotime($verify->inserttime) < strtotime("-15 minutes")){
88 87
                     $user = R::load('user',$verify->user);
89 88
                     $user->status="enabled";
90 89
                     $user->updatetime=date('Y-m-d H:i:s');
91 90
                     $id = R::store($user);
92 91
                     $response = "<html><head></head><body>Account attivato complimenti!</body></html>";
93
-                }else{
92
+                } else{
94 93
                     $response = "<html><head></head><body>Impossibile attivare account inserire mail e password per richiedere un nuovo token!</body></html>";
95 94
                 }
96 95
             }
Please login to merge, or discard this patch.
src/BitPrepared/Bundle/D1b0Workspace/Controller/V1/WorkspaceController.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,11 +3,9 @@
 block discarded – undo
3 3
 namespace BitPrepared\Bundle\D1b0Workspace\Controller\V1;
4 4
 
5 5
 use Symfony\Component\HttpFoundation\Request;
6
-use Symfony\Component\HttpFoundation\Response;
7 6
 use Symfony\Component\HttpFoundation\JsonResponse;
8 7
 use Silex\Application;
9 8
 use Silex\Api\ControllerProviderInterface;
10
-use Monolog\Logger;
11 9
 use RedBeanPHP\Facade as R;
12 10
 
13 11
 class WorkspaceController implements ControllerProviderInterface
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         $factory = $app['controllers_factory'];
22 22
         # il mount point e' precedente e non serve prima
23 23
         $this->app['db'];
24
-        R::fancyDebug( TRUE );
24
+        R::fancyDebug(TRUE);
25 25
         $factory->get('/', array($this, 'getWorkspaceList'));
26 26
         $factory->post('/', array($this, 'createWorkspace'));
27 27
         $factory->get('/{id}', array($this, 'getWorkspace'));
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
         $factory->post('/{id}/part', array($this, 'postPart'));
30 30
         return $factory;
31 31
     }
32
-    public function getSessionId(){
33
-        $user_id=$this->app['session']->get('user')['id'];
32
+    public function getSessionId() {
33
+        $user_id = $this->app['session']->get('user')['id'];
34 34
         return $user_id;
35 35
     }
36 36
     public function getWorkspaceList(Request $request)
37 37
     {
38
-        $user_id=$this->getSessionId();
39
-        $workspaces =  R::getAll("SELECT ws.id,
38
+        $user_id = $this->getSessionId();
39
+        $workspaces = R::getAll("SELECT ws.id,
40 40
                                           ws.title,
41 41
                                           ws.description,
42 42
                                           ws.environment,
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
                                           LEFT JOIN workspace AS ws
46 46
                                           ON uws.workspace = ws.id
47 47
                                           WHERE uws.user = ?",[$user_id]);
48
-        $list=[];
49
-        foreach($workspaces as $ws){
50
-            array_push($list,[
48
+        $list = [];
49
+        foreach ($workspaces as $ws) {
50
+            array_push($list, [
51 51
                 "id"=>$ws['id'],
52 52
                 "title"=>$ws['title'],
53 53
                 "description"=>$ws['description'],
54 54
                 "environment"=>$ws['environment'],
55
-                "point"=>0,//TODO fare una view con i point già calcolati per il ws
55
+                "point"=>0, //TODO fare una view con i point già calcolati per il ws
56 56
                 "completed"=>$ws['completed'],
57 57
             ]);
58 58
         }
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
     }
63 63
     public function createWorkspace(Request $request)
64 64
     {
65
-        $user_id=$this->getSessionId();
66
-        $counter=0;
65
+        $user_id = $this->getSessionId();
66
+        $counter = 0;
67 67
         $data = json_decode($request->getContent(), true);
68 68
         //TODO validate json_decode
69
-        $title=$data['title'];
70
-        $description=$data['description'];
71
-        $environment=$data['environment'];
69
+        $title = $data['title'];
70
+        $description = $data['description'];
71
+        $environment = $data['environment'];
72 72
 
73 73
         $patrol = $data['team']['patrol'];
74 74
         $unit = $data['team']['unit'];
@@ -76,46 +76,46 @@  discard block
 block discarded – undo
76 76
 
77 77
         //save the workspace get id
78 78
         $ws = R::dispense("workspace");
79
-            $ws->title=$title;
80
-            $ws->description=$description;
81
-            $ws->environment=$environment;
82
-            $ws->completed=false;
83
-            $ws->inserttime=date('Y-m-d H:i:s');
84
-            $ws->lastupdatetime=date('Y-m-d H:i:s');
79
+            $ws->title = $title;
80
+            $ws->description = $description;
81
+            $ws->environment = $environment;
82
+            $ws->completed = false;
83
+            $ws->inserttime = date('Y-m-d H:i:s');
84
+            $ws->lastupdatetime = date('Y-m-d H:i:s');
85 85
         $id = R::store($ws);
86 86
 
87 87
         //save the team
88 88
         $team = R::dispense("team");
89
-            $team->workspace=$id;
90
-            $team->patrol=$patrol;
91
-            $team->unit=$unit;
92
-            $team->group=$group;
89
+            $team->workspace = $id;
90
+            $team->patrol = $patrol;
91
+            $team->unit = $unit;
92
+            $team->group = $group;
93 93
         $team_id = R::store($team);
94 94
 
95 95
         //create a phantom part to add badge
96 96
         $part = R::dispense("part");
97
-            $part->workspace=$id;
98
-            $part->user=$user_id;
99
-            $part->inserttime=date('Y-m-d H:i:s');
100
-            $part->lastupdatetime=date('Y-m-d H:i:s');
101
-            $part->totalpoint=0;
97
+            $part->workspace = $id;
98
+            $part->user = $user_id;
99
+            $part->inserttime = date('Y-m-d H:i:s');
100
+            $part->lastupdatetime = date('Y-m-d H:i:s');
101
+            $part->totalpoint = 0;
102 102
         $part_id = R::store($part);
103 103
 
104 104
         //add the badge to the project
105
-        foreach($data['badges'] as $badge_id){
105
+        foreach ($data['badges'] as $badge_id) {
106 106
             //TODO insert those badge as first hidden post
107 107
             $pb = R::dispense("partbadge");
108
-                $pb->badge=$badge_id;
109
-                $pb->part=$part_id;
110
-                $pb->inserttime=date('Y-m-d H:i:s');
108
+                $pb->badge = $badge_id;
109
+                $pb->part = $part_id;
110
+                $pb->inserttime = date('Y-m-d H:i:s');
111 111
             $tmp = R::store($pb);
112 112
         }
113 113
 
114 114
         //add the workspace created to the user as owner
115 115
         $usw = R::dispense("userworkspace");
116
-            $usw->user=$user_id;
117
-            $usw->workspace=$id;
118
-            $usw->inserttime=date('Y-m-d H:i:s');
116
+            $usw->user = $user_id;
117
+            $usw->workspace = $id;
118
+            $usw->inserttime = date('Y-m-d H:i:s');
119 119
         R::store($usw);
120 120
 
121 121
         $res = ["id" => $id];
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
         return JsonResponse::create($res, 201, $headers)->setSharedMaxAge(300);
124 124
     }
125 125
 
126
-    public function getWorkspace($id,Request $request){
127
-        $user_id=$this->getSessionId();
126
+    public function getWorkspace($id, Request $request) {
127
+        $user_id = $this->getSessionId();
128 128
         //TODO controllare che l'utente abbia diritto a vedere questo workspace
129 129
 
130
-        $workspace =  R::findOne("workspace","id = ?",[$id]);
131
-        $part = R::findAll("part","workspace = ?",[$id]);
130
+        $workspace = R::findOne("workspace", "id = ?", [$id]);
131
+        $part = R::findAll("part", "workspace = ?", [$id]);
132 132
 
133
-        $badges = R::findAll("workspacebadge","workspace = ?",[$id]);
133
+        $badges = R::findAll("workspacebadge", "workspace = ?", [$id]);
134 134
 
135
-        $l_part=[];
136
-        foreach($part as $p){
137
-            array_push($l_part,intval($p['id']));
135
+        $l_part = [];
136
+        foreach ($part as $p) {
137
+            array_push($l_part, intval($p['id']));
138 138
         }
139
-        $l_badges=[];
140
-        foreach($badges as $b){
141
-            array_push($l_badges,intval($b['badge']));
139
+        $l_badges = [];
140
+        foreach ($badges as $b) {
141
+            array_push($l_badges, intval($b['badge']));
142 142
         }
143 143
 
144 144
         $res = [
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
         return JsonResponse::create($res, 201, $headers)->setSharedMaxAge(300);
156 156
     }
157 157
 
158
-    public function share($id,Request $request){
159
-        $generatedKey = hash("sha256",(mt_rand(10000,99999).time().$id));
158
+    public function share($id, Request $request) {
159
+        $generatedKey = hash("sha256", (mt_rand(10000, 99999).time().$id));
160 160
         //TODO verificare documentazione realtiva sulla reale entropia generata da questo sistema
161
-        $user_id=$this->getSessionId();
161
+        $user_id = $this->getSessionId();
162 162
         $share = R::dispense("share");
163
-            $share->user=$user_id;
164
-            $share->workspace=$id;
165
-            $share->key=$generatedKey;
166
-            $share->inserttime=date('Y-m-d H:i:s');
163
+            $share->user = $user_id;
164
+            $share->workspace = $id;
165
+            $share->key = $generatedKey;
166
+            $share->inserttime = date('Y-m-d H:i:s');
167 167
         $share_id = R::store($share);
168 168
 
169 169
         $date = new \DateTime();
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
         return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
180 180
     }
181 181
 
182
-    public function postPart($id,Request $request){
183
-        $user_id=$this->getSessionId();
182
+    public function postPart($id, Request $request) {
183
+        $user_id = $this->getSessionId();
184 184
 
185 185
         $res = [];
186 186
         $headers = [];
Please login to merge, or discard this patch.
applications/workspace/web/index.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,11 @@
 block discarded – undo
11 11
 use Silex\Application;
12 12
 use Symfony\Component\HttpFoundation\Request;
13 13
 use Symfony\Component\HttpFoundation\Response;
14
-use Symfony\Component\HttpFoundation\JsonResponse;
15 14
 use Silex\Provider\MonologServiceProvider;
16 15
 use Ivoba\Silex\RedBeanServiceProvider;
17 16
 use Silex\Provider\SessionServiceProvider;
18 17
 use Carbon\Carbon;
19 18
 use Monolog\Logger;
20
-use RedBeanPHP\Facade as R;
21 19
 
22 20
 // FIXME va messo nel php.ini
23 21
 date_default_timezone_set('Europe/Rome');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 
38 38
 // @see: http://silex.sensiolabs.org/doc/providers/monolog.html
39 39
 $app->register(new MonologServiceProvider(), array(
40
-    "monolog.logfile" => ROOT_PATH . "/storage/logs/development_" . Carbon::now('Europe/Rome')->format("Y-m-d") . ".log",
40
+    "monolog.logfile" => ROOT_PATH."/storage/logs/development_".Carbon::now('Europe/Rome')->format("Y-m-d").".log",
41 41
     "monolog.level" => $app["log.level"],
42 42
     "monolog.name" => "application"
43 43
 ));
44 44
 
45 45
 // @see: https://github.com/ivoba/redbean-service-provider
46 46
 //'mysql:host=localhost;dbname=mydatabase', 'user', 'password'
47
-$app->register(new RedBeanServiceProvider(), array('db.options' => array( 'dsn' => 'sqlite:'.ROOT_PATH.'/../../database/workspace.sqlite' )));
47
+$app->register(new RedBeanServiceProvider(), array('db.options' => array('dsn' => 'sqlite:'.ROOT_PATH.'/../../database/workspace.sqlite')));
48 48
 $app->register(new SessionServiceProvider());
49 49
 
50 50
 // production (X-Forwarded-For*)
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 Request::enableHttpMethodParameterOverride();
53 53
 
54 54
 //handling CORS preflight request
55
-$app->before(function (Request $request) {
55
+$app->before(function(Request $request) {
56 56
     if ($request->getMethod() === "OPTIONS") {
57 57
         $response = new Response();
58 58
         $response->headers->set("Access-Control-Allow-Origin", "*");
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 }, Application::EARLY_EVENT);
65 65
 
66 66
 //handling CORS respons with right headers
67
-$app->after(function (Request $request, Response $response) {
67
+$app->after(function(Request $request, Response $response) {
68 68
     $response->headers->set("Access-Control-Allow-Origin", "*");
69 69
     $response->headers->set("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS");
70 70
 });
71 71
 
72
-$app->error(function (\Exception $e, Request $request, $code) use ($app) {
72
+$app->error(function(\Exception $e, Request $request, $code) use ($app) {
73 73
     // this handler will handle \Exception
74 74
     $app['monolog']->addError($e->getMessage());
75 75
     $app['monolog']->addError($e->getTraceAsString());
Please login to merge, or discard this patch.
src/BitPrepared/Bundle/D1b0Workspace/Exception/UnauthorizedException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
     // custom string representation of object
15 15
     public function __toString() {
16
-        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
16
+        return __CLASS__.": [{$this->code}]: {$this->message}\n";
17 17
     }
18 18
 
19 19
 }
Please login to merge, or discard this patch.
src/BitPrepared/Bundle/D1b0Workspace/Controller/V1/UserController.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
         $this->app['db'];
25 25
         //R::fancyDebug( TRUE );
26 26
         $factory->post('/signup', array($this, 'signup'));
27
-        $factory->get('/{id}', array($this, 'get'))->before([$this,'isSession']);
28
-        $factory->post('/{id}/badge', array($this, 'postBadge'))->before([$this,'isSession']);
29
-        $factory->get('/{id}/badge/{id_badge}', array($this, 'getBadge'))->before([$this,'isSession']);
30
-        $factory->patch('/{id}/badge/{id_badge}/completed', array($this, 'markBadgeAsCompleted'))->before([$this,'isSession']);
31
-        $factory->delete('/{id}/badge/{id_badge}', array($this, 'deleteUserBadge'))->before([$this,'isSession']);
32
-        $factory->get('/{id}/ticket', array($this, 'getTicket'))->before([$this,'isSession']);
27
+        $factory->get('/{id}', array($this, 'get'))->before([$this, 'isSession']);
28
+        $factory->post('/{id}/badge', array($this, 'postBadge'))->before([$this, 'isSession']);
29
+        $factory->get('/{id}/badge/{id_badge}', array($this, 'getBadge'))->before([$this, 'isSession']);
30
+        $factory->patch('/{id}/badge/{id_badge}/completed', array($this, 'markBadgeAsCompleted'))->before([$this, 'isSession']);
31
+        $factory->delete('/{id}/badge/{id_badge}', array($this, 'deleteUserBadge'))->before([$this, 'isSession']);
32
+        $factory->get('/{id}/ticket', array($this, 'getTicket'))->before([$this, 'isSession']);
33 33
         return $factory;
34 34
     }
35 35
 
36
-    public function isSession(Request $request,Application $app){
37
-            if($this->app['session']->has('user') !== true){
38
-                throw new UnauthorizedException("errore",1);
36
+    public function isSession(Request $request, Application $app) {
37
+            if ($this->app['session']->has('user') !== true) {
38
+                throw new UnauthorizedException("errore", 1);
39 39
             }
40 40
     }
41 41
 
42 42
     public function get($id, Request $request)
43 43
     {
44
-        $user = R::findOne('user', 'id = ?',["$id"]);
44
+        $user = R::findOne('user', 'id = ?', ["$id"]);
45 45
         $headers = [];
46 46
 
47 47
         $output = [
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
             'skills'=>'',
53 53
         ];
54 54
 
55
-        $badges = R::findAll('userbadgecomplete','WHERE user = ?',[$id]);
56
-        $badgeList=[];
57
-        foreach( $badges as $badge){
55
+        $badges = R::findAll('userbadgecomplete', 'WHERE user = ?', [$id]);
56
+        $badgeList = [];
57
+        foreach ($badges as $badge) {
58 58
             array_push($badgeList,
59 59
                 [
60 60
                     'badge'=>[
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 ]
69 69
             );
70 70
         }
71
-        $output['skills']=$badgeList;
71
+        $output['skills'] = $badgeList;
72 72
         return JsonResponse::create($output, 200, $headers)->setSharedMaxAge(300);
73 73
     }
74 74
 
@@ -82,35 +82,35 @@  discard block
 block discarded – undo
82 82
 
83 83
         $authMode = $data['authMode'];
84 84
         $id = -1;
85
-        if($authMode === 'Email'){
85
+        if ($authMode === 'Email') {
86 86
             /*
87 87
             $user = R::dispense('user');
88 88
             $user->authMode=$data['authMode'];
89 89
             $user->name=$data['name'];
90 90
             $user->surname=$data['surname'];
91 91
             $user->surname=$data['surname'];*/
92
-            try{
92
+            try {
93 93
                 $user = R::dispense('user');
94 94
                 //$user->import($data);
95 95
                 $size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);
96 96
                 $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
97 97
                 $user->salt = $iv;
98
-                $user->pwd = hash("sha256",$iv.$data['password']);
98
+                $user->pwd = hash("sha256", $iv.$data['password']);
99 99
                 $user->status = "checking";
100 100
                 //$user->id="11";
101
-                $user->name=$data['name'];
102
-                $user->email=$data['email'];
103
-                $user->surname=$data['surname'];
104
-                $user->authmode=$data['authMode'];
105
-                $user->inserttime=date('Y-m-d H:i:s');
106
-                $user->updatetime=date('Y-m-d G:i:s');
101
+                $user->name = $data['name'];
102
+                $user->email = $data['email'];
103
+                $user->surname = $data['surname'];
104
+                $user->authmode = $data['authMode'];
105
+                $user->inserttime = date('Y-m-d H:i:s');
106
+                $user->updatetime = date('Y-m-d G:i:s');
107 107
                 $id = R::store($user);
108 108
                 $res = (object)["id" => $id];
109
-            }catch(Exception $e){
109
+            }catch (Exception $e) {
110 110
                 echo $e;
111 111
             }
112 112
 
113
-        }else{
113
+        }else {
114 114
 
115 115
         }
116 116
 
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
         return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
120 120
     }
121 121
 
122
-    public function postBadge($id,Request $request)
122
+    public function postBadge($id, Request $request)
123 123
     {
124 124
         //TODO valiadre id in funzione della sessione utente (altrimenti chiunque aggiunge badge a chiunque)
125 125
         $data = json_decode($request->getContent(), true);
126 126
 
127 127
         $userbadge = R::dispense('userbadge');
128
-        $userbadge->user=$id;
129
-        $userbadge->badge=$data['id'];
130
-        $userbadge->inserttime=date('Y-m-d H:i:s');
131
-        $userbadge->updatetime=date('Y-m-d H:i:s');
128
+        $userbadge->user = $id;
129
+        $userbadge->badge = $data['id'];
130
+        $userbadge->inserttime = date('Y-m-d H:i:s');
131
+        $userbadge->updatetime = date('Y-m-d H:i:s');
132 132
         $id = R::store($userbadge);
133 133
 
134 134
         $res = (object)["id" => $id];
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
         return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
137 137
     }
138 138
 
139
-    public function getBadge($id,$id_badge,Request $request)
139
+    public function getBadge($id, $id_badge, Request $request)
140 140
     {
141
-        $badge = R::findOne('userbadgecomplete','WHERE user = ? AND badge = ?',[$id,$id_badge]);
141
+        $badge = R::findOne('userbadgecomplete', 'WHERE user = ? AND badge = ?', [$id, $id_badge]);
142 142
         $res = [
143 143
                     'badge'=>[
144 144
                         'id'=>$badge['badge'],
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
         $headers = [];
153 153
         return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
154 154
     }
155
-    public function markBadgeAsCompleted($id,$id_badge,Request $request){
156
-        $userbadge = R::load('userbadge',$id_badge);
157
-        $userbadge->user=$id;
158
-        $userbadge->badge=$id_badge;
159
-        $userbadge->updatetime=date('Y-m-d H:i:s');
160
-        $userbadge->completed=1;
155
+    public function markBadgeAsCompleted($id, $id_badge, Request $request) {
156
+        $userbadge = R::load('userbadge', $id_badge);
157
+        $userbadge->user = $id;
158
+        $userbadge->badge = $id_badge;
159
+        $userbadge->updatetime = date('Y-m-d H:i:s');
160
+        $userbadge->completed = 1;
161 161
         $id = R::store($userbadge);
162 162
         $res = (object)["id" => $id];
163 163
         $headers = [];
164 164
         return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300);
165 165
     }
166
-    public function deleteUserBadge($id,$id_badge,Request $request){
167
-        $userbadge = R::load('userbadge',$id_badge);
168
-        $userbadge->deleted=1;
169
-        $userbadge->updatetime=date('Y-m-d H:i:s');
166
+    public function deleteUserBadge($id, $id_badge, Request $request) {
167
+        $userbadge = R::load('userbadge', $id_badge);
168
+        $userbadge->deleted = 1;
169
+        $userbadge->updatetime = date('Y-m-d H:i:s');
170 170
         $id = R::store($userbadge);
171 171
         $headers = [];
172 172
         $response = new Response();
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
         $response->setSharedMaxAge(300);
176 176
         return $response;
177 177
     }
178
-    public function getTicket($id,Request $request){
179
-        $ticketRaw = R::findAll('ticket','WHERE user = ? AND (NOT status = "closed")',[$id]);
178
+    public function getTicket($id, Request $request) {
179
+        $ticketRaw = R::findAll('ticket', 'WHERE user = ? AND (NOT status = "closed")', [$id]);
180 180
 
181
-        $tickets=[];
182
-        foreach($ticketRaw as $ticket){
183
-            array_push($tickets,[
181
+        $tickets = [];
182
+        foreach ($ticketRaw as $ticket) {
183
+            array_push($tickets, [
184 184
                 "id"=>$ticket['id'],
185 185
                 "message"=>$ticket['message'],
186 186
                 "url"=>$ticket['url'],
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@
 block discarded – undo
106 106
                 $user->updatetime=date('Y-m-d G:i:s');
107 107
                 $id = R::store($user);
108 108
                 $res = (object)["id" => $id];
109
-            }catch(Exception $e){
109
+            } catch(Exception $e){
110 110
                 echo $e;
111 111
             }
112 112
 
113
-        }else{
113
+        } else{
114 114
 
115 115
         }
116 116
 
Please login to merge, or discard this patch.
src/BitPrepared/Bundle/D1b0Workspace/Controller/V1/StatusController.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
         $this->app->log('log info', [], Logger::INFO); //grazie al traits <- da trasformare prima in app
33 33
 
34 34
         $data = array(
35
-          "workspace" => "OK",
36
-          "fileManager" => "OK",
37
-          "externalLogin" => "OK"
35
+            "workspace" => "OK",
36
+            "fileManager" => "OK",
37
+            "externalLogin" => "OK"
38 38
         );
39 39
 
40 40
         $headers = [];
Please login to merge, or discard this patch.