Completed
Push — master ( f5f8b9...bcfe8b )
by Patrick
15s
created
class.FlipREST.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@
 block discarded – undo
75 75
         if(!isset($this->headers['Authorization']))
76 76
         {
77 77
             $this->app->user = $this->getUserFromSession();
78
-        } 
79
-        else 
78
+        }
79
+        else
80 80
         {
81 81
             $header = $this->headers['Authorization'];
82 82
             $this->app->user = $this->getUserFromHeader($header);
Please login to merge, or discard this patch.
Data/class.Filter.php 1 patch
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,11 +35,17 @@  discard block
 block discarded – undo
35 35
             return array(new FilterClause($string));
36 36
         }
37 37
         $children = array();
38
-        if($parens) array_push($children, '(');
38
+        if($parens)
39
+        {
40
+            array_push($children, '(');
41
+        }
39 42
         $children = array_merge($children, self::process_string($clauses[1]));
40 43
         array_push($children, trim($clauses[2]));
41 44
         $children = array_merge($children, self::process_string($clauses[3]));
42
-        if($parens) array_push($children, ')');
45
+        if($parens)
46
+        {
47
+            array_push($children, ')');
48
+        }
43 49
         return $children;
44 50
     }
45 51
 
@@ -178,7 +184,10 @@  discard block
 block discarded – undo
178 184
         $count = count($this->children);
179 185
         for($i = 0; $i < $count; $i++)
180 186
         {
181
-            if(!is_object($this->children[$i])) continue;
187
+            if(!is_object($this->children[$i]))
188
+            {
189
+                continue;
190
+            }
182 191
             if(strstr($this->children[$i]->var1, $substr) !== false ||
183 192
                strstr($this->children[$i]->var2, $substr) !== false)
184 193
             {
Please login to merge, or discard this patch.
Auth/class.LDAPGroup.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,10 @@
 block discarded – undo
179 179
         $count = count($groups);
180 180
         for($i = 0; $i < $count; $i++)
181 181
         {
182
-            if($groups[$i] === false || $groups[$i] === null) continue;
182
+            if($groups[$i] === false || $groups[$i] === null)
183
+            {
184
+                continue;
185
+            }
183 186
             array_push($data, new LDAPGroup($groups[$i]));
184 187
         }
185 188
         $users = $this->server->read($this->server->user_base, $userFilter, false, $select);
Please login to merge, or discard this patch.
Auth/class.NullAuthenticator.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Auth;
3 3
 
4
-class NullAuthenticator extends Authenticator
5
-{
6
-    public function login($username, $password)
7
-    {
4
+class NullAuthenticator extends Authenticator
5
+{
6
+    public function login($username, $password)
7
+    {
8 8
         return array('res'=>true, 'extended'=>null);
9 9
     }
10 10
 
11
-    public function isLoggedIn($data)
12
-    {
13
-        if(isset($data['res']))
14
-        {
11
+    public function isLoggedIn($data)
12
+    {
13
+        if(isset($data['res']))
14
+        {
15 15
             return $data['res'];
16 16
         }
17 17
         return false;
18 18
     }
19 19
 
20
-    public function getUser($data)
21
-    {
20
+    public function getUser($data)
21
+    {
22 22
         return null;
23 23
     }
24 24
 }
Please login to merge, or discard this patch.
LDAP/class.LDAPObject.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,14 @@
 block discarded – undo
16 16
          $ret = array();
17 17
          foreach ($this as $key => $value)
18 18
          {
19
-            if($key === 'server' || $key === 'count') continue;
20
-            if(is_numeric($key)) continue;
19
+            if($key === 'server' || $key === 'count')
20
+            {
21
+                continue;
22
+            }
23
+            if(is_numeric($key))
24
+            {
25
+                continue;
26
+            }
21 27
             if($key === 'jpegphoto')
22 28
             {
23 29
                 $ret[$key] = base64_encode($value[0]);
Please login to merge, or discard this patch.
Auth/class.Group.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,10 @@
 block discarded – undo
90 90
                 {
91 91
                     $isLast = true;
92 92
                 }
93
-                if(!isset($group->member[$i]->type)) continue;
93
+                if(!isset($group->member[$i]->type))
94
+                {
95
+                    continue;
96
+                }
94 97
                 if($group->member[$i]->type === 'Group')
95 98
                 {
96 99
                     $this->addMember($group->member[$i]->cn, true, $isLast);
Please login to merge, or discard this patch.
Auth/class.GoogleAuthenticator.php 1 patch
Braces   +35 added lines, -33 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@  discard block
 block discarded – undo
2 2
 namespace Auth;
3 3
 require dirname(__FILE__).'/../libs/google/src/Google/autoload.php';
4 4
 
5
-class GoogleAuthenticator extends Authenticator
6
-{
5
+class GoogleAuthenticator extends Authenticator
6
+{
7 7
     protected $client;
8 8
     protected $token = null;
9 9
 
10
-    public function __construct($params)
11
-    {
10
+    public function __construct($params)
11
+    {
12 12
         parent::__construct($params);
13
-        if(!isset($params['client_secrets_path']))
14
-        {
13
+        if(!isset($params['client_secrets_path']))
14
+        {
15 15
             throw new \Exception('Missing required parameter client_secrets_path!');
16 16
         }
17
-        if(!isset($params['redirect_url']))
18
-        {
17
+        if(!isset($params['redirect_url']))
18
+        {
19 19
             $params['redirect_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/oauth2callback.php?src=google';
20 20
         }
21 21
         $this->token = \FlipSession::getVar('GoogleToken', null);
@@ -25,63 +25,64 @@  discard block
 block discarded – undo
25 25
         $this->client->setRedirectUri($params['redirect_url']);
26 26
     }
27 27
 
28
-    public function getSupplementLink()
29
-    {
28
+    public function getSupplementLink()
29
+    {
30 30
         $authUrl = $this->client->createAuthUrl();
31 31
         return '<a href="'.filter_var($authUrl, FILTER_SANITIZE_URL).'"><img src="/img/common/google_sign_in.png" style="width: 2em;"/></a>';
32 32
     }
33 33
 
34
-    public function authenticate($code, &$currentUser = false)
35
-    {
34
+    public function authenticate($code, &$currentUser = false)
35
+    {
36 36
         $googleUser = false;
37
-        try
38
-        {
37
+        try
38
+        {
39 39
             $this->client->authenticate($code);
40 40
             $this->token = $this->client->getAccessToken();
41 41
             \FlipSession::setVar('GoogleToken', $this->token);
42 42
             $oauth2Service = new \Google_Service_Oauth2($this->client);
43 43
             $googleUser = $oauth2Service->userinfo->get();
44
-        }
45
-        catch(\Exception $ex)
46
-        {
44
+        }
45
+        catch(\Exception $ex)
46
+        {
47 47
             return self::LOGIN_FAILED;
48 48
         }
49 49
 
50 50
         $auth = \AuthProvider::getInstance();
51 51
         $localUsers = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$googleUser->email));
52
-        if($localUsers !== false && isset($localUsers[0]))
53
-        {
54
-            if($localUsers[0]->canLoginWith('google.com'))
55
-            {
52
+        if($localUsers !== false && isset($localUsers[0]))
53
+        {
54
+            if($localUsers[0]->canLoginWith('google.com'))
55
+            {
56 56
                 $auth->impersonateUser($localUsers[0]);
57 57
                 return self::SUCCESS;
58 58
             }
59 59
             $currentUser = $localUsers[0];
60 60
             return self::ALREADY_PRESENT;
61
-        }
62
-        else
63
-        {
61
+        }
62
+        else
63
+        {
64 64
             $user = new PendingUser();
65 65
             $user->setEmail($googleUser->email);
66 66
             $user->setGivenName($googleUser->givenName);
67 67
             $user->setLastName($googleUser->familyName);
68 68
             $user->addLoginProvider('google.com');
69 69
             $ret = $auth->activatePendingUser($user);
70
-            if($ret === false)
71
-            {
70
+            if($ret === false)
71
+            {
72 72
                  throw new \Exception('Unable to create user! '.$res);
73 73
             }
74 74
             return self::SUCCESS;
75 75
         }
76 76
     }
77 77
 
78
-    public function getUser($data = false)
79
-    {
80
-        if($data === false)
81
-        {
78
+    public function getUser($data = false)
79
+    {
80
+        if($data === false)
81
+        {
82 82
             $data = $this->token;
83 83
         }
84
-        try {
84
+        try
85
+        {
85 86
             $this->client->setAccessToken($data);
86 87
             $oauth2Service = new \Google_Service_Oauth2($this->client);
87 88
             $googleUser = $oauth2Service->userinfo->get();
@@ -92,8 +93,9 @@  discard block
 block discarded – undo
92 93
             $profileUser['displayName'] = $googleUser->name;
93 94
             $profileUser['jpegPhoto'] = base64_encode(file_get_contents($googleUser->picture));
94 95
             return $profileUser;
95
-        } catch(\Exception $e)
96
-        {
96
+        }
97
+        catch(\Exception $e)
98
+        {
97 99
             return false;
98 100
         }
99 101
     }
Please login to merge, or discard this patch.