Completed
Push — master ( eb16f0...b029a9 )
by Patrick
03:00
created
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.
class.FlipSession.php 1 patch
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once('Autoload.php');
3
-if(!isset($_SESSION) && php_sapi_name() !== 'cli') { session_start(); }
3
+if(!isset($_SESSION) && php_sapi_name() !== 'cli')
4
+{
5
+session_start(); }
4 6
 if(!isset($_SESSION['ip_address']) && isset($_SERVER['REMOTE_ADDR']))
5 7
 {
6 8
     $_SESSION['ip_address'] = $_SERVER['REMOTE_ADDR'];
@@ -156,7 +158,10 @@  discard block
 block discarded – undo
156 158
             $pos = strpos($sessionData, "|", $offset);
157 159
             $len = $pos - $offset;
158 160
             $name = substr($sessionData, $offset, $len);
159
-            if($name === false) break;
161
+            if($name === false)
162
+            {
163
+                break;
164
+            }
160 165
             $offset += $len+1;
161 166
             $data = @unserialize(substr($sessionData, $offset));
162 167
             $res[$name] = $data;
Please login to merge, or discard this patch.
Auth/class.Group.php 2 patches
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.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     /**
45 45
      * Get the UID's of the Group Members
46 46
      *
47
-     * @param boolean $recursie Include members of child groups
47
+     * @param boolean $recursive Include members of child groups
48 48
      *
49 49
      * @return array Array of UIDs
50 50
      *
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.
Auth/class.LDAPCachableObject.php 1 patch
Doc Comments   +24 added lines patch added patch discarded remove patch
@@ -88,6 +88,9 @@  discard block
 block discarded – undo
88 88
         return $this->appendFieldServer($fieldName, $fieldValue);
89 89
     }
90 90
 
91
+    /**
92
+     * @param string $fieldName
93
+     */
91 94
     private function getFieldLocal($fieldName)
92 95
     {
93 96
         if($this->ldapObj === false)
@@ -101,6 +104,9 @@  discard block
 block discarded – undo
101 104
         return $this->ldapObj[$fieldName];
102 105
     }
103 106
 
107
+    /**
108
+     * @param string $fieldName
109
+     */
104 110
     private function getFieldServer($fieldName)
105 111
     {
106 112
         $lowerName = strtolower($fieldName);
@@ -111,6 +117,9 @@  discard block
 block discarded – undo
111 117
         return $this->ldapObj->{$lowerName};
112 118
     }
113 119
 
120
+    /**
121
+     * @param string $fieldName
122
+     */
114 123
     private function getFieldLocalSingleValue($fieldName)
115 124
     {
116 125
         if($this->ldapObj === false)
@@ -128,6 +137,9 @@  discard block
 block discarded – undo
128 137
         return $this->ldapObj[$fieldName];
129 138
     }
130 139
 
140
+    /**
141
+     * @param string $fieldName
142
+     */
131 143
     private function getFieldServerSingleValue($fieldName)
132 144
     {
133 145
         $lowerName = strtolower($fieldName);
@@ -143,6 +155,9 @@  discard block
 block discarded – undo
143 155
         return $field[0];
144 156
     }
145 157
 
158
+    /**
159
+     * @param string $fieldName
160
+     */
146 161
     private function setFieldServer($fieldName, $fieldValue)
147 162
     {
148 163
         $obj = array('dn'=>$this->ldapObj->dn);
@@ -159,6 +174,9 @@  discard block
 block discarded – undo
159 174
         return $this->update($obj);
160 175
     }
161 176
 
177
+    /**
178
+     * @param string $fieldName
179
+     */
162 180
     private function appendFieldServer($fieldName, $fieldValue)
163 181
     {
164 182
         $obj = array('dn'=>$this->ldapObj->dn);
@@ -175,6 +193,9 @@  discard block
 block discarded – undo
175 193
         return $this->update($obj);
176 194
     }
177 195
 
196
+    /**
197
+     * @param string $fieldName
198
+     */
178 199
     private function setFieldLocal($fieldName, $fieldValue)
179 200
     {
180 201
         if($this->ldapObj === false)
@@ -193,6 +214,9 @@  discard block
 block discarded – undo
193 214
         return true;
194 215
     }
195 216
 
217
+    /**
218
+     * @param string $fieldName
219
+     */
196 220
     private function appendFieldLocal($fieldName, $fieldValue)
197 221
     {
198 222
         if($this->ldapObj === false)
Please login to merge, or discard this patch.
Auth/class.PendingUser.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
      * We need the ability to obtain the user's unhashed plain text password to allow for it to be sent 
91 91
      * to the correct backend which will hash it
92 92
      *
93
-     * @return boolean|string The current password
93
+     * @return boolean The current password
94 94
      */
95 95
     public function getPassword()
96 96
     {
Please login to merge, or discard this patch.
Auth/class.SQLAuthenticator.php 1 patch
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * Get the data table for Pending Users
142 142
      *
143
-     * @return boolean|\Data\DataTable The Pending User Data Table
143
+     * @return boolean The Pending User Data Table
144 144
      */
145 145
     private function getPendingUserDataTable()
146 146
     {
@@ -213,6 +213,9 @@  discard block
 block discarded – undo
213 213
         return new SQLUser($users[0], $this);
214 214
     }
215 215
 
216
+    /**
217
+     * @param string $dataTableName
218
+     */
216 219
     private function getDataByFilter($dataTableName, $filter, $select, $top, $skip, $orderby)
217 220
     {
218 221
         $dataTable = $this->getDataTable($dataTableName);
@@ -278,6 +281,9 @@  discard block
 block discarded – undo
278 281
         return $dataTable->count();
279 282
     }
280 283
 
284
+    /**
285
+     * @param \Data\Filter $filter
286
+     */
281 287
     private function searchPendingUsers($filter, $select, $top, $skip, $orderby)
282 288
     {
283 289
         $userDataTable = $this->getPendingUserDataTable();
Please login to merge, or discard this patch.
Data/class.SQLDataSet.php 1 patch
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -113,6 +113,9 @@  discard block
 block discarded – undo
113 113
         throw new \Exception('No such table '.$name);
114 114
     }
115 115
 
116
+    /**
117
+     * @param string $tablename
118
+     */
116 119
     function read($tablename, $where = false, $select = '*', $count = false, $skip = false, $sort = false)
117 120
     {
118 121
         if($select === false)
@@ -158,6 +161,9 @@  discard block
 block discarded – undo
158 161
         return $ret;
159 162
     }
160 163
 
164
+    /**
165
+     * @param string $tablename
166
+     */
161 167
     function update($tablename, $where, $data)
162 168
     {
163 169
         $set = array();
@@ -180,6 +186,9 @@  discard block
 block discarded – undo
180 186
         return true;
181 187
     }
182 188
 
189
+    /**
190
+     * @param string $tablename
191
+     */
183 192
     function create($tablename, $data)
184 193
     {
185 194
         $set = array();
@@ -203,6 +212,9 @@  discard block
 block discarded – undo
203 212
         return true;
204 213
     }
205 214
 
215
+    /**
216
+     * @param string $tablename
217
+     */
206 218
     function delete($tablename, $where)
207 219
     {
208 220
         $sql = "DELETE FROM $tablename WHERE $where";
Please login to merge, or discard this patch.