@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | public $user; |
7 | 7 | public $is_admin = false; |
8 | 8 | |
9 | - function __construct($title, $adminGroup='LDAPAdmins') |
|
9 | + function __construct($title, $adminGroup = 'LDAPAdmins') |
|
10 | 10 | { |
11 | 11 | $this->user = FlipSession::getUser(); |
12 | 12 | $this->is_admin = $this->userIsAdmin($adminGroup); |
13 | 13 | parent::__construct($title); |
14 | 14 | $adminCSS = '/css/common/admin.min.css'; |
15 | - if($this->minified !== 'min') |
|
15 | + if ($this->minified !== 'min') |
|
16 | 16 | { |
17 | 17 | $adminCSS = '/css/common/admin.css'; |
18 | 18 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | protected function userIsAdmin($adminGroup) |
24 | 24 | { |
25 | - if($this->user === false || $this->user === null) |
|
25 | + if ($this->user === false || $this->user === null) |
|
26 | 26 | { |
27 | 27 | return false; |
28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | function addAllLinks() |
33 | 33 | { |
34 | - if($this->user === false || $this->user === null) |
|
34 | + if ($this->user === false || $this->user === null) |
|
35 | 35 | { |
36 | 36 | $this->add_link('<i class="fa fa-sign-in"></i> Login', $this->loginUrl); |
37 | 37 | } |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | $ret = '<li>'; |
48 | 48 | $href = $this->getHrefForDropdown($link); |
49 | 49 | $ret .= $this->createLink($name.' <i class="fa fa-arrow-right"></i>', $href); |
50 | - $ret.='<ul>'; |
|
50 | + $ret .= '<ul>'; |
|
51 | 51 | $subNames = array_keys($link); |
52 | - foreach($subNames as $subName) |
|
52 | + foreach ($subNames as $subName) |
|
53 | 53 | { |
54 | - $ret.=$this->getLinkByName($subName, $link); |
|
54 | + $ret .= $this->getLinkByName($subName, $link); |
|
55 | 55 | } |
56 | - $ret.='</ul></li>'; |
|
56 | + $ret .= '</ul></li>'; |
|
57 | 57 | return $ret; |
58 | 58 | } |
59 | 59 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $sites = $this->getSiteLinksForHeader(); |
63 | 63 | $sideNav = $this->getLinksMenus(); |
64 | 64 | $log = '<a href="https://profiles.burningflipside.com/logout.php"><i class="fa fa-sign-out"></i></a>'; |
65 | - if($this->user === false || $this->user === null) |
|
65 | + if ($this->user === false || $this->user === null) |
|
66 | 66 | { |
67 | 67 | $log = '<a href="https://profiles.burningflipside.com/login.php?return='.$this->current_url().'"><i class="fa fa-sign-in"></i></a>'; |
68 | 68 | } |
@@ -108,26 +108,26 @@ discard block |
||
108 | 108 | const CARD_YELLOW = 'panel-yellow'; |
109 | 109 | const CARD_RED = 'panel-red'; |
110 | 110 | |
111 | - function add_card($iconName, $bigText, $littleText, $link='#', $color = self::CARD_BLUE, $textColor=false) |
|
111 | + function add_card($iconName, $bigText, $littleText, $link = '#', $color = self::CARD_BLUE, $textColor = false) |
|
112 | 112 | { |
113 | - if($textColor === false) |
|
113 | + if ($textColor === false) |
|
114 | 114 | { |
115 | - switch($color) |
|
115 | + switch ($color) |
|
116 | 116 | { |
117 | 117 | default: |
118 | - $textColor=''; |
|
118 | + $textColor = ''; |
|
119 | 119 | break; |
120 | 120 | case self::CARD_BLUE: |
121 | - $textColor='text-primary'; |
|
121 | + $textColor = 'text-primary'; |
|
122 | 122 | break; |
123 | 123 | case self::CARD_GREEN: |
124 | - $textColor='text-success'; |
|
124 | + $textColor = 'text-success'; |
|
125 | 125 | break; |
126 | 126 | case self::CARD_YELLOW: |
127 | - $textColor='text-warning'; |
|
127 | + $textColor = 'text-warning'; |
|
128 | 128 | break; |
129 | 129 | case self::CARD_RED: |
130 | - $textColor='text-danger'; |
|
130 | + $textColor = 'text-danger'; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | } |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $this->body .= $card; |
157 | 157 | } |
158 | 158 | |
159 | - function printPage($header=true) |
|
159 | + function printPage($header = true) |
|
160 | 160 | { |
161 | - if($this->user === false || $this->user === null) |
|
161 | + if ($this->user === false || $this->user === null) |
|
162 | 162 | { |
163 | 163 | $this->body = ' |
164 | 164 | <div class="row"> |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | </div> |
168 | 168 | </div>'; |
169 | 169 | } |
170 | - else if($this->is_admin === false) |
|
170 | + else if ($this->is_admin === false) |
|
171 | 171 | { |
172 | 172 | $this->body = ' |
173 | 173 | <div class="row"> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function getEmail() |
51 | 51 | { |
52 | - if(isset($this->email)) |
|
52 | + if (isset($this->email)) |
|
53 | 53 | { |
54 | 54 | return $this->email; |
55 | 55 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getGivenName() |
65 | 65 | { |
66 | - if(isset($this->givenName)) |
|
66 | + if (isset($this->givenName)) |
|
67 | 67 | { |
68 | 68 | return $this->givenName; |
69 | 69 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getLastName() |
79 | 79 | { |
80 | - if(isset($this->sn)) |
|
80 | + if (isset($this->sn)) |
|
81 | 81 | { |
82 | 82 | return $this->sn; |
83 | 83 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function getLoginProviders() |
106 | 106 | { |
107 | - if(isset($this->host)) |
|
107 | + if (isset($this->host)) |
|
108 | 108 | { |
109 | 109 | return $this->host; |
110 | 110 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | function addLoginProvider($provider) |
122 | 122 | { |
123 | - if(isset($this->host)) |
|
123 | + if (isset($this->host)) |
|
124 | 124 | { |
125 | 125 | array_push($this->host, $provider); |
126 | 126 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | Burning Flipside Technology Team'); |
200 | 200 | $email_msg->setSubject('Burning Flipside Registration'); |
201 | 201 | $email_provider = \EmailProvider::getInstance(); |
202 | - if($email_provider->sendEmail($email_msg) === false) |
|
202 | + if ($email_provider->sendEmail($email_msg) === false) |
|
203 | 203 | { |
204 | 204 | throw new \Exception('Unable to send email!'); |
205 | 205 | } |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | { |
6 | 6 | private $uid; |
7 | 7 | |
8 | - function __construct($data=false) |
|
8 | + function __construct($data = false) |
|
9 | 9 | { |
10 | 10 | $this->uid = false; |
11 | - if($data !== false && !isset($data['extended'])) |
|
11 | + if ($data !== false && !isset($data['extended'])) |
|
12 | 12 | { |
13 | 13 | //Generic user object |
14 | 14 | //TODO get from DB |
15 | 15 | } |
16 | 16 | else |
17 | 17 | { |
18 | - if(isset($data['extended'])) |
|
18 | + if (isset($data['extended'])) |
|
19 | 19 | { |
20 | 20 | $this->uid = $data['extended']; |
21 | 21 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $group_data_table = $auth_data_set['group']; |
29 | 29 | $filter = new \Data\Filter("uid eq '$this->uid' and gid eq '$name'"); |
30 | 30 | $groups = $group_data_table->read($filter); |
31 | - if($groups === false || !isset($groups[0])) |
|
31 | + if ($groups === false || !isset($groups[0])) |
|
32 | 32 | { |
33 | 33 | return false; |
34 | 34 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | return $this->server->update($obj); |
11 | 11 | } |
12 | - catch(\Exception $ex) |
|
12 | + catch (\Exception $ex) |
|
13 | 13 | { |
14 | 14 | $auth = \AuthProvider::getInstance(); |
15 | 15 | $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator'); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | protected function getField($fieldName) |
22 | 22 | { |
23 | - if(!is_object($this->ldapObj)) |
|
23 | + if (!is_object($this->ldapObj)) |
|
24 | 24 | { |
25 | 25 | return $this->getFieldLocal($fieldName); |
26 | 26 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | protected function getFieldSingleValue($fieldName) |
31 | 31 | { |
32 | - if(!is_object($this->ldapObj)) |
|
32 | + if (!is_object($this->ldapObj)) |
|
33 | 33 | { |
34 | 34 | return $this->getFieldLocalSingleValue($fieldName); |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | protected function setField($fieldName, $fieldValue) |
40 | 40 | { |
41 | - if(!is_object($this->ldapObj)) |
|
41 | + if (!is_object($this->ldapObj)) |
|
42 | 42 | { |
43 | 43 | return $this->setFieldLocal($fieldName, $fieldValue); |
44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | protected function appendField($fieldName, $fieldValue) |
49 | 49 | { |
50 | - if(!is_object($this->ldapObj)) |
|
50 | + if (!is_object($this->ldapObj)) |
|
51 | 51 | { |
52 | 52 | return $this->appendFieldLocal($fieldName, $fieldValue); |
53 | 53 | } |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | |
57 | 57 | private function getFieldLocal($fieldName) |
58 | 58 | { |
59 | - if($this->ldapObj === false) |
|
59 | + if ($this->ldapObj === false) |
|
60 | 60 | { |
61 | 61 | return false; |
62 | 62 | } |
63 | - if(!isset($this->ldapObj[$fieldName])) |
|
63 | + if (!isset($this->ldapObj[$fieldName])) |
|
64 | 64 | { |
65 | 65 | return false; |
66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | private function getFieldServer($fieldName) |
71 | 71 | { |
72 | 72 | $lowerName = strtolower($fieldName); |
73 | - if(!isset($this->ldapObj->{$lowerName})) |
|
73 | + if (!isset($this->ldapObj->{$lowerName})) |
|
74 | 74 | { |
75 | 75 | return false; |
76 | 76 | } |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | |
80 | 80 | private function getFieldLocalSingleValue($fieldName) |
81 | 81 | { |
82 | - if($this->ldapObj === false) |
|
82 | + if ($this->ldapObj === false) |
|
83 | 83 | { |
84 | 84 | return false; |
85 | 85 | } |
86 | - if(!isset($this->ldapObj[$fieldName])) |
|
86 | + if (!isset($this->ldapObj[$fieldName])) |
|
87 | 87 | { |
88 | 88 | return false; |
89 | 89 | } |
90 | - if(is_array($this->ldapObj[$fieldName])) |
|
90 | + if (is_array($this->ldapObj[$fieldName])) |
|
91 | 91 | { |
92 | 92 | return $this->ldapObj[$fieldName][0]; |
93 | 93 | } |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | private function getFieldServerSingleValue($fieldName) |
98 | 98 | { |
99 | 99 | $lowerName = strtolower($fieldName); |
100 | - if(!isset($this->ldapObj->{$lowerName})) |
|
100 | + if (!isset($this->ldapObj->{$lowerName})) |
|
101 | 101 | { |
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | $field = $this->ldapObj->{$lowerName}; |
105 | - if(!isset($field[0])) |
|
105 | + if (!isset($field[0])) |
|
106 | 106 | { |
107 | 107 | return false; |
108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | private function setFieldServer($fieldName, $fieldValue) |
113 | 113 | { |
114 | 114 | $obj = array('dn'=>$this->ldapObj->dn); |
115 | - if($fieldValue !== null && strlen($fieldValue) > 0) |
|
115 | + if ($fieldValue !== null && strlen($fieldValue) > 0) |
|
116 | 116 | { |
117 | 117 | $obj[$fieldName] = $fieldValue; |
118 | 118 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | private function appendFieldServer($fieldName, $fieldValue) |
129 | 129 | { |
130 | 130 | $obj = array('dn'=>$this->ldapObj->dn); |
131 | - if(isset($this->ldapObj->{$fieldName})) |
|
131 | + if (isset($this->ldapObj->{$fieldName})) |
|
132 | 132 | { |
133 | 133 | $obj[$fieldName] = $this->ldapObj->{$fieldName}; |
134 | 134 | $obj[$fieldName][$obj[$fieldName]['count']] = $fieldValue; |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | |
144 | 144 | private function setFieldLocal($fieldName, $fieldValue) |
145 | 145 | { |
146 | - if($this->ldapObj === false) |
|
146 | + if ($this->ldapObj === false) |
|
147 | 147 | { |
148 | 148 | $this->ldapObj = array(); |
149 | 149 | } |
150 | - if($fieldValue === null || strlen($fieldValue) === 0) |
|
150 | + if ($fieldValue === null || strlen($fieldValue) === 0) |
|
151 | 151 | { |
152 | - if(isset($this->ldapObj[$fieldName])) |
|
152 | + if (isset($this->ldapObj[$fieldName])) |
|
153 | 153 | { |
154 | 154 | unset($this->ldapObj[$fieldName]); |
155 | 155 | } |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | private function appendFieldLocal($fieldName, $fieldValue) |
163 | 163 | { |
164 | - if($this->ldapObj === false) |
|
164 | + if ($this->ldapObj === false) |
|
165 | 165 | { |
166 | 166 | $this->ldapObj = array(); |
167 | 167 | } |
168 | - if(!isset($this->ldapObj[$fieldName])) |
|
168 | + if (!isset($this->ldapObj[$fieldName])) |
|
169 | 169 | { |
170 | 170 | $this->ldapObj[$fieldName] = array(); |
171 | 171 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Auth; |
3 | -if(!class_exists('Httpful\Request')) |
|
3 | +if (!class_exists('Httpful\Request')) |
|
4 | 4 | { |
5 | 5 | require(realpath(dirname(__FILE__)).'/../libs/httpful/bootstrap.php'); |
6 | 6 | } |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | private $userData; |
11 | 11 | private $groupData = null; |
12 | 12 | |
13 | - public function __construct($data=false) |
|
13 | + public function __construct($data = false) |
|
14 | 14 | { |
15 | - if($data !== false && !isset($data['extended'])) |
|
15 | + if ($data !== false && !isset($data['extended'])) |
|
16 | 16 | { |
17 | 17 | //Generic user object |
18 | 18 | //TODO get from API |
19 | 19 | } |
20 | 20 | else |
21 | 21 | { |
22 | - if(isset($data['extended'])) |
|
22 | + if (isset($data['extended'])) |
|
23 | 23 | { |
24 | 24 | $this->userData = $data['extended']; |
25 | 25 | } |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | |
29 | 29 | function isInGroupNamed($name) |
30 | 30 | { |
31 | - if($this->groupData === null) |
|
31 | + if ($this->groupData === null) |
|
32 | 32 | { |
33 | 33 | $resp = \Httpful\Request::get('https://profiles.test.burningflipside.com/api/v1/users/me/groups')->authenticateWith($this->userData->uid, $this->userData->userPassword)->send(); |
34 | - if($resp->hasErrors()) |
|
34 | + if ($resp->hasErrors()) |
|
35 | 35 | { |
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | $this->groupData = $resp->body; |
39 | 39 | } |
40 | 40 | $count = count($this->groupData); |
41 | - for($i = 0; $i < $count; $i++) |
|
41 | + for ($i = 0; $i < $count; $i++) |
|
42 | 42 | { |
43 | - if($this->groupData[$i]->cn === $name) |
|
43 | + if ($this->groupData[$i]->cn === $name) |
|
44 | 44 | { |
45 | 45 | return true; |
46 | 46 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | function getDisplayName() |
52 | 52 | { |
53 | - if($this->userData === null) |
|
53 | + if ($this->userData === null) |
|
54 | 54 | { |
55 | 55 | return parent::getDisplayName(); |
56 | 56 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | function getGivenName() |
61 | 61 | { |
62 | - if($this->userData === null) |
|
62 | + if ($this->userData === null) |
|
63 | 63 | { |
64 | 64 | return parent::getGivenName(); |
65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | function getEmail() |
70 | 70 | { |
71 | - if($this->userData === null) |
|
71 | + if ($this->userData === null) |
|
72 | 72 | { |
73 | 73 | return parent::getEmail(); |
74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | function getUid() |
79 | 79 | { |
80 | - if($this->userData === null) |
|
80 | + if ($this->userData === null) |
|
81 | 81 | { |
82 | 82 | return parent::getUid(); |
83 | 83 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | function getPhoneNumber() |
88 | 88 | { |
89 | - if($this->userData === null) |
|
89 | + if ($this->userData === null) |
|
90 | 90 | { |
91 | 91 | return parent::getPhoneNumber(); |
92 | 92 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | function getOrganization() |
97 | 97 | { |
98 | - if($this->userData === null) |
|
98 | + if ($this->userData === null) |
|
99 | 99 | { |
100 | 100 | return parent::getOrganization(); |
101 | 101 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | function getTitles() |
106 | 106 | { |
107 | - if($this->userData === null) |
|
107 | + if ($this->userData === null) |
|
108 | 108 | { |
109 | 109 | return parent::getTitles(); |
110 | 110 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | function getState() |
115 | 115 | { |
116 | - if($this->userData === null) |
|
116 | + if ($this->userData === null) |
|
117 | 117 | { |
118 | 118 | return parent::getState(); |
119 | 119 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | function getCity() |
124 | 124 | { |
125 | - if($this->userData === null) |
|
125 | + if ($this->userData === null) |
|
126 | 126 | { |
127 | 127 | return parent::getCity(); |
128 | 128 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | function getLastName() |
133 | 133 | { |
134 | - if($this->userData === null) |
|
134 | + if ($this->userData === null) |
|
135 | 135 | { |
136 | 136 | return parent::getLastName(); |
137 | 137 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | function getNickName() |
142 | 142 | { |
143 | - if($this->userData === null) |
|
143 | + if ($this->userData === null) |
|
144 | 144 | { |
145 | 145 | return parent::getNickName(); |
146 | 146 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | function getAddress() |
151 | 151 | { |
152 | - if($this->userData === null) |
|
152 | + if ($this->userData === null) |
|
153 | 153 | { |
154 | 154 | return parent::getAddress(); |
155 | 155 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | function getPostalCode() |
160 | 160 | { |
161 | - if($this->userData === null) |
|
161 | + if ($this->userData === null) |
|
162 | 162 | { |
163 | 163 | return parent::getPostalCode(); |
164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | function getCountry() |
169 | 169 | { |
170 | - if($this->userData === null) |
|
170 | + if ($this->userData === null) |
|
171 | 171 | { |
172 | 172 | return parent::getCountry(); |
173 | 173 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | function getOrganizationUnits() |
178 | 178 | { |
179 | - if($this->userData === null) |
|
179 | + if ($this->userData === null) |
|
180 | 180 | { |
181 | 181 | return parent::getOrganizationUnits(); |
182 | 182 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | function getLoginProviders() |
187 | 187 | { |
188 | - if($this->userData === null) |
|
188 | + if ($this->userData === null) |
|
189 | 189 | { |
190 | 190 | return parent::getLoginProviders(); |
191 | 191 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
26 | - public function getMemberUids($recursive=true) |
|
26 | + public function getMemberUids($recursive = true) |
|
27 | 27 | { |
28 | 28 | return array(); |
29 | 29 | } |
30 | 30 | |
31 | - public function members($details=false, $recursive=true, $includeGroups=true) |
|
31 | + public function members($details = false, $recursive = true, $includeGroups = true) |
|
32 | 32 | { |
33 | 33 | return array(); |
34 | 34 | } |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | public function jsonSerialize() |
47 | 47 | { |
48 | 48 | $group = array(); |
49 | - try{ |
|
49 | + try { |
|
50 | 50 | $group['cn'] = $this->getGroupName(); |
51 | 51 | $group['description'] = $this->getDescription(); |
52 | 52 | $group['member'] = $this->getMemberUids(); |
53 | - } catch(\Exception $e) {echo $e->getMessage(); die();} |
|
53 | + } catch (\Exception $e) {echo $e->getMessage(); die(); } |
|
54 | 54 | return $group; |
55 | 55 | } |
56 | 56 | |
57 | - public function getNonMembers($select=false) |
|
57 | + public function getNonMembers($select = false) |
|
58 | 58 | { |
59 | 59 | return array(); |
60 | 60 | } |
61 | 61 | |
62 | - public function addMember($name, $isGroup=false, $flush=true) |
|
62 | + public function addMember($name, $isGroup = false, $flush = true) |
|
63 | 63 | { |
64 | 64 | return false; |
65 | 65 | } |
@@ -70,24 +70,24 @@ discard block |
||
70 | 70 | $auth = \AuthProvider::getInstance(); |
71 | 71 | $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator'); |
72 | 72 | $ldap->get_and_bind_server(true); |
73 | - if(isset($group->description)) |
|
73 | + if (isset($group->description)) |
|
74 | 74 | { |
75 | 75 | $this->setDescription($group->description); |
76 | 76 | unset($group->description); |
77 | 77 | } |
78 | - if(isset($group->member)) |
|
78 | + if (isset($group->member)) |
|
79 | 79 | { |
80 | 80 | $this->clearMembers(); |
81 | 81 | $count = count($group->member); |
82 | - for($i = 0; $i < $count; $i++) |
|
82 | + for ($i = 0; $i < $count; $i++) |
|
83 | 83 | { |
84 | 84 | $isLast = false; |
85 | - if($i === $count - 1) |
|
85 | + if ($i === $count - 1) |
|
86 | 86 | { |
87 | 87 | $isLast = true; |
88 | 88 | } |
89 | - if(!isset($group->member[$i]->type)) continue; |
|
90 | - if($group->member[$i]->type === 'Group') |
|
89 | + if (!isset($group->member[$i]->type)) continue; |
|
90 | + if ($group->member[$i]->type === 'Group') |
|
91 | 91 | { |
92 | 92 | $this->addMember($group->member[$i]->cn, true, $isLast); |
93 | 93 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | return true; |
102 | 102 | } |
103 | 103 | |
104 | - static function from_name($name, $data=false) |
|
104 | + static function from_name($name, $data = false) |
|
105 | 105 | { |
106 | 106 | return false; |
107 | 107 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | function getEmail() |
30 | 30 | { |
31 | - if(is_array($this->blob->mail)) |
|
31 | + if (is_array($this->blob->mail)) |
|
32 | 32 | { |
33 | 33 | return $this->blob->mail[0]; |
34 | 34 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | function getUid() |
39 | 39 | { |
40 | - if(is_array($this->blob->uid)) |
|
40 | + if (is_array($this->blob->uid)) |
|
41 | 41 | { |
42 | 42 | return $this->blob->uid[0]; |
43 | 43 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | function getPassword() |
48 | 48 | { |
49 | - if(is_array($this->blob->password)) |
|
49 | + if (is_array($this->blob->password)) |
|
50 | 50 | { |
51 | 51 | return $this->blob->password[0]; |
52 | 52 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function getGroupName() |
14 | 14 | { |
15 | - if(isset($data['gid'])) |
|
15 | + if (isset($data['gid'])) |
|
16 | 16 | { |
17 | 17 | return $data['gid']; |
18 | 18 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function getDescription() |
23 | 23 | { |
24 | - if(isset($data['description'])) |
|
24 | + if (isset($data['description'])) |
|
25 | 25 | { |
26 | 26 | return $data['description']; |
27 | 27 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $this->members(false); |
34 | 34 | } |
35 | 35 | |
36 | - public function members($details=false) |
|
36 | + public function members($details = false) |
|
37 | 37 | { |
38 | 38 | //TODO |
39 | 39 | return array(); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | $this->ldapObj = $data; |
15 | 15 | $this->server = \LDAP\LDAPServer::getInstance(); |
16 | - if(!is_object($data)) |
|
16 | + if (!is_object($data)) |
|
17 | 17 | { |
18 | 18 | throw new \Exception('Unable to setup LDAPGroup!'); |
19 | 19 | } |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | { |
39 | 39 | $rawMembers = $this->getField('member'); |
40 | 40 | $fieldName = 'member'; |
41 | - if($rawMembers === false) |
|
41 | + if ($rawMembers === false) |
|
42 | 42 | { |
43 | 43 | $rawMembers = $this->getField('uniqueMember'); |
44 | 44 | $fieldName = 'uniqueMember'; |
45 | 45 | } |
46 | - if($rawMembers === false) |
|
46 | + if ($rawMembers === false) |
|
47 | 47 | { |
48 | 48 | $rawMembers = $this->getField('memberUid'); |
49 | 49 | $fieldName = 'memberUid'; |
50 | 50 | } |
51 | - if(!isset($rawMembers['count'])) |
|
51 | + if (!isset($rawMembers['count'])) |
|
52 | 52 | { |
53 | 53 | $rawMembers['count'] = count($rawMembers); |
54 | 54 | } |
@@ -58,23 +58,23 @@ discard block |
||
58 | 58 | private function getIDFromDN($dn) |
59 | 59 | { |
60 | 60 | $split = explode(',', $dn); |
61 | - if(strncmp('cn=', $split[0], 3) === 0) |
|
61 | + if (strncmp('cn=', $split[0], 3) === 0) |
|
62 | 62 | { |
63 | 63 | return substr($split[0], 3); |
64 | 64 | } |
65 | 65 | return substr($split[0], 4); |
66 | 66 | } |
67 | 67 | |
68 | - public function getMemberUids($recursive=true) |
|
68 | + public function getMemberUids($recursive = true) |
|
69 | 69 | { |
70 | 70 | $members = array(); |
71 | 71 | $rawMembers = $this->getMembersField(); |
72 | - for($i = 0; $i < $rawMembers['count']; $i++) |
|
72 | + for ($i = 0; $i < $rawMembers['count']; $i++) |
|
73 | 73 | { |
74 | - if($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
74 | + if ($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
75 | 75 | { |
76 | 76 | $child = self::from_dn($rawMembers[$i], $this->server); |
77 | - if($child !== false) |
|
77 | + if ($child !== false) |
|
78 | 78 | { |
79 | 79 | $members = array_merge($members, $child->members()); |
80 | 80 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | $count = count($members); |
88 | - for($i = 0; $i < $count; $i++) |
|
88 | + for ($i = 0; $i < $count; $i++) |
|
89 | 89 | { |
90 | 90 | $members[$i] = $this->getIDFromDN($members[$i]); |
91 | 91 | } |
@@ -95,36 +95,36 @@ discard block |
||
95 | 95 | private function getObjectFromDN($dn) |
96 | 96 | { |
97 | 97 | $split = explode(',', $dn); |
98 | - if(strncmp('cn=', $dn, 3) === 0) |
|
98 | + if (strncmp('cn=', $dn, 3) === 0) |
|
99 | 99 | { |
100 | - if(count($split) === 1) |
|
100 | + if (count($split) === 1) |
|
101 | 101 | { |
102 | 102 | return LDAPGroup::from_name($dn, $this->server); |
103 | 103 | } |
104 | 104 | return LDAPGroup::from_name(substr($split[0], 3), $this->server); |
105 | 105 | } |
106 | - if(count($split) === 1) |
|
106 | + if (count($split) === 1) |
|
107 | 107 | { |
108 | 108 | return LDAPUser::from_name($dn, $this->server); |
109 | 109 | } |
110 | 110 | return LDAPUser::from_name(substr($split[0], 4), $this->server); |
111 | 111 | } |
112 | 112 | |
113 | - public function members($details=false, $recursive=true, $includeGroups=true) |
|
113 | + public function members($details = false, $recursive = true, $includeGroups = true) |
|
114 | 114 | { |
115 | 115 | $members = array(); |
116 | 116 | $rawMembers = $this->getMembersField(); |
117 | - for($i = 0; $i < $rawMembers['count']; $i++) |
|
117 | + for ($i = 0; $i < $rawMembers['count']; $i++) |
|
118 | 118 | { |
119 | - if($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
119 | + if ($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
120 | 120 | { |
121 | 121 | $child = self::from_dn($rawMembers[$i], $this->server); |
122 | - if($child !== false) |
|
122 | + if ($child !== false) |
|
123 | 123 | { |
124 | 124 | $members = array_merge($members, $child->members()); |
125 | 125 | } |
126 | 126 | } |
127 | - else if($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
127 | + else if ($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
128 | 128 | { |
129 | 129 | //Drop this member |
130 | 130 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | array_push($members, $rawMembers[$i]); |
134 | 134 | } |
135 | 135 | } |
136 | - if($details === true) |
|
136 | + if ($details === true) |
|
137 | 137 | { |
138 | 138 | $details = array(); |
139 | 139 | $count = count($members); |
140 | - for($i = 0; $i < $count; $i++) |
|
140 | + for ($i = 0; $i < $count; $i++) |
|
141 | 141 | { |
142 | 142 | $details[$i] = $this->getObjectFromDN($members[$i]); |
143 | 143 | } |
@@ -147,37 +147,37 @@ discard block |
||
147 | 147 | return $members; |
148 | 148 | } |
149 | 149 | |
150 | - public function getNonMemebers($select=false) |
|
150 | + public function getNonMemebers($select = false) |
|
151 | 151 | { |
152 | 152 | $data = array(); |
153 | 153 | $groupFilter = '(&(cn=*)(!(cn='.$this->getGroupName().'))'; |
154 | 154 | $userFilter = '(&(cn=*)'; |
155 | 155 | $members = $this->members(); |
156 | 156 | $count = count($members); |
157 | - for($i = 0; $i < $count; $i++) |
|
157 | + for ($i = 0; $i < $count; $i++) |
|
158 | 158 | { |
159 | - $dnComps = explode(',',$members[$i]); |
|
160 | - if(strncmp($members[$i], "uid=", 4) == 0) |
|
159 | + $dnComps = explode(',', $members[$i]); |
|
160 | + if (strncmp($members[$i], "uid=", 4) == 0) |
|
161 | 161 | { |
162 | - $userFilter.='(!('.$dnComps[0].'))'; |
|
162 | + $userFilter .= '(!('.$dnComps[0].'))'; |
|
163 | 163 | } |
164 | 164 | else |
165 | 165 | { |
166 | - $groupFilter.='(!('.$dnComps[0].'))'; |
|
166 | + $groupFilter .= '(!('.$dnComps[0].'))'; |
|
167 | 167 | } |
168 | 168 | } |
169 | - $userFilter.=')'; |
|
170 | - $groupFilter.=')'; |
|
169 | + $userFilter .= ')'; |
|
170 | + $groupFilter .= ')'; |
|
171 | 171 | $groups = $this->server->read($this->server->group_base, $groupFilter); |
172 | 172 | $count = count($groups); |
173 | - for($i = 0; $i < $count; $i++) |
|
173 | + for ($i = 0; $i < $count; $i++) |
|
174 | 174 | { |
175 | - if($groups[$i] === false || $groups[$i] === null) continue; |
|
175 | + if ($groups[$i] === false || $groups[$i] === null) continue; |
|
176 | 176 | array_push($data, new LDAPGroup($groups[$i])); |
177 | 177 | } |
178 | 178 | $users = $this->server->read($this->server->user_base, $userFilter, false, $select); |
179 | 179 | $count = count($users); |
180 | - for($i = 0; $i < $count; $i++) |
|
180 | + for ($i = 0; $i < $count; $i++) |
|
181 | 181 | { |
182 | 182 | array_push($data, new LDAPUser($users[$i])); |
183 | 183 | } |
@@ -186,24 +186,24 @@ discard block |
||
186 | 186 | |
187 | 187 | public function clearMembers() |
188 | 188 | { |
189 | - if(isset($this->ldapObj['member'])) |
|
189 | + if (isset($this->ldapObj['member'])) |
|
190 | 190 | { |
191 | 191 | $this->ldapObj['member'] = array(); |
192 | 192 | } |
193 | - else if(isset($this->ldapObj['uniquemember'])) |
|
193 | + else if (isset($this->ldapObj['uniquemember'])) |
|
194 | 194 | { |
195 | 195 | $this->ldapObj['uniquemember'] = array(); |
196 | 196 | } |
197 | - else if(isset($this->ldapObj['memberuid'])) |
|
197 | + else if (isset($this->ldapObj['memberuid'])) |
|
198 | 198 | { |
199 | 199 | $this->ldapObj['memberuid'] = array(); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | - public function addMember($name, $isGroup=false, $flush=true) |
|
203 | + public function addMember($name, $isGroup = false, $flush = true) |
|
204 | 204 | { |
205 | 205 | $dn = false; |
206 | - if($isGroup) |
|
206 | + if ($isGroup) |
|
207 | 207 | { |
208 | 208 | $dn = 'cn='.$name.','.$this->server->group_base; |
209 | 209 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $dn = 'uid='.$name.','.$this->server->user_base; |
213 | 213 | } |
214 | 214 | $propName = false; |
215 | - $rawMembers = $this->getMembersField($propName);; |
|
216 | - if(in_array($dn, $rawMembers) || in_array($name, $rawMembers)) |
|
215 | + $rawMembers = $this->getMembersField($propName); ; |
|
216 | + if (in_array($dn, $rawMembers) || in_array($name, $rawMembers)) |
|
217 | 217 | { |
218 | 218 | return true; |
219 | 219 | } |
220 | - if($propName === 'memberUid') |
|
220 | + if ($propName === 'memberUid') |
|
221 | 221 | { |
222 | - if($isGroup) |
|
222 | + if ($isGroup) |
|
223 | 223 | { |
224 | 224 | throw new \Exception('Unable to add a group as a child of this group type'); |
225 | 225 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | $tmp = strtolower($propName); |
233 | 233 | $this->ldapObj->$tmp = $rawMembers; |
234 | - if($flush === true) |
|
234 | + if ($flush === true) |
|
235 | 235 | { |
236 | 236 | $obj = array('dn'=>$this->ldapObj->dn); |
237 | 237 | $obj[$propName] = $rawMembers; |
@@ -243,29 +243,29 @@ discard block |
||
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | - static function from_dn($dn, $data=false) |
|
246 | + static function from_dn($dn, $data = false) |
|
247 | 247 | { |
248 | - if($data === false) |
|
248 | + if ($data === false) |
|
249 | 249 | { |
250 | 250 | throw new \Exception('data must be set for LDAPGroup'); |
251 | 251 | } |
252 | 252 | $group = $data->read($dn, false, true); |
253 | - if($group === false || !isset($group[0])) |
|
253 | + if ($group === false || !isset($group[0])) |
|
254 | 254 | { |
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | return new static($group[0]); |
258 | 258 | } |
259 | 259 | |
260 | - static function from_name($name, $data=false) |
|
260 | + static function from_name($name, $data = false) |
|
261 | 261 | { |
262 | - if($data === false) |
|
262 | + if ($data === false) |
|
263 | 263 | { |
264 | 264 | throw new \Exception('data must be set for LDAPGroup'); |
265 | 265 | } |
266 | 266 | $filter = new \Data\Filter("cn eq $name"); |
267 | 267 | $group = $data->read($data->group_base, $filter); |
268 | - if($group === false || !isset($group[0])) |
|
268 | + if ($group === false || !isset($group[0])) |
|
269 | 269 | { |
270 | 270 | return false; |
271 | 271 | } |