@@ -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 | } |
@@ -264,7 +264,7 @@ |
||
| 264 | 264 | throw new \Exception('data must be set for LDAPGroup'); |
| 265 | 265 | } |
| 266 | 266 | $filter = new \Data\Filter("cn eq $name"); |
| 267 | - $group = $data->read($data->group_base, $filter); |
|
| 267 | + $group = $data->read($data->group_base, $filter); |
|
| 268 | 268 | if($group === false || !isset($group[0])) |
| 269 | 269 | { |
| 270 | 270 | return false; |
@@ -3,8 +3,7 @@ discard block |
||
| 3 | 3 | if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
| 4 | 4 | { |
| 5 | 5 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
| 6 | -} |
|
| 7 | -else |
|
| 6 | +} else |
|
| 8 | 7 | { |
| 9 | 8 | require_once('/var/www/secure_settings/class.FlipsideSettings.php'); |
| 10 | 9 | } |
@@ -85,8 +84,7 @@ discard block |
||
| 85 | 84 | { |
| 86 | 85 | $members = array_merge($members, $child->members()); |
| 87 | 86 | } |
| 88 | - } |
|
| 89 | - else |
|
| 87 | + } else |
|
| 90 | 88 | { |
| 91 | 89 | array_push($members, $rawMembers[$i]); |
| 92 | 90 | } |
@@ -130,12 +128,10 @@ discard block |
||
| 130 | 128 | { |
| 131 | 129 | $members = array_merge($members, $child->members()); |
| 132 | 130 | } |
| 133 | - } |
|
| 134 | - else if($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 131 | + } else if($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 135 | 132 | { |
| 136 | 133 | //Drop this member |
| 137 | - } |
|
| 138 | - else |
|
| 134 | + } else |
|
| 139 | 135 | { |
| 140 | 136 | array_push($members, $rawMembers[$i]); |
| 141 | 137 | } |
@@ -167,8 +163,7 @@ discard block |
||
| 167 | 163 | if(strncmp($members[$i], "uid=", 4) == 0) |
| 168 | 164 | { |
| 169 | 165 | $userFilter.='(!('.$dnComps[0].'))'; |
| 170 | - } |
|
| 171 | - else |
|
| 166 | + } else |
|
| 172 | 167 | { |
| 173 | 168 | $groupFilter.='(!('.$dnComps[0].'))'; |
| 174 | 169 | } |
@@ -179,7 +174,9 @@ discard block |
||
| 179 | 174 | $count = count($groups); |
| 180 | 175 | for($i = 0; $i < $count; $i++) |
| 181 | 176 | { |
| 182 | - if($groups[$i] === false || $groups[$i] === null) continue; |
|
| 177 | + if($groups[$i] === false || $groups[$i] === null) { |
|
| 178 | + continue; |
|
| 179 | + } |
|
| 183 | 180 | array_push($data, new LDAPGroup($groups[$i])); |
| 184 | 181 | } |
| 185 | 182 | $users = $this->server->read($this->server->user_base, $userFilter, false, $select); |
@@ -196,12 +193,10 @@ discard block |
||
| 196 | 193 | if(isset($this->ldapObj['member'])) |
| 197 | 194 | { |
| 198 | 195 | $this->ldapObj['member'] = array(); |
| 199 | - } |
|
| 200 | - else if(isset($this->ldapObj['uniquemember'])) |
|
| 196 | + } else if(isset($this->ldapObj['uniquemember'])) |
|
| 201 | 197 | { |
| 202 | 198 | $this->ldapObj['uniquemember'] = array(); |
| 203 | - } |
|
| 204 | - else if(isset($this->ldapObj['memberuid'])) |
|
| 199 | + } else if(isset($this->ldapObj['memberuid'])) |
|
| 205 | 200 | { |
| 206 | 201 | $this->ldapObj['memberuid'] = array(); |
| 207 | 202 | } |
@@ -213,8 +208,7 @@ discard block |
||
| 213 | 208 | if($isGroup) |
| 214 | 209 | { |
| 215 | 210 | $dn = 'cn='.$name.','.$this->server->group_base; |
| 216 | - } |
|
| 217 | - else |
|
| 211 | + } else |
|
| 218 | 212 | { |
| 219 | 213 | $dn = 'uid='.$name.','.$this->server->user_base; |
| 220 | 214 | } |
@@ -231,8 +225,7 @@ discard block |
||
| 231 | 225 | throw new \Exception('Unable to add a group as a child of this group type'); |
| 232 | 226 | } |
| 233 | 227 | array_push($rawMembers, $name); |
| 234 | - } |
|
| 235 | - else |
|
| 228 | + } else |
|
| 236 | 229 | { |
| 237 | 230 | array_push($rawMembers, $dn); |
| 238 | 231 | } |
@@ -243,8 +236,7 @@ discard block |
||
| 243 | 236 | $obj = array('dn'=>$this->ldapObj->dn); |
| 244 | 237 | $obj[$propName] = $rawMembers; |
| 245 | 238 | return $this->server->update($obj); |
| 246 | - } |
|
| 247 | - else |
|
| 239 | + } else |
|
| 248 | 240 | { |
| 249 | 241 | return true; |
| 250 | 242 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Auth; |
| 3 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
| 3 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
| 4 | 4 | { |
| 5 | 5 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
| 6 | 6 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $this->ldapObj = $data; |
| 22 | 22 | $this->server = \LDAP\LDAPServer::getInstance(); |
| 23 | - if(!is_object($data)) |
|
| 23 | + if (!is_object($data)) |
|
| 24 | 24 | { |
| 25 | 25 | throw new \Exception('Unable to setup LDAPGroup!'); |
| 26 | 26 | } |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $rawMembers = $this->getField('member'); |
| 47 | 47 | $fieldName = 'member'; |
| 48 | - if($rawMembers === false) |
|
| 48 | + if ($rawMembers === false) |
|
| 49 | 49 | { |
| 50 | 50 | $rawMembers = $this->getField('uniqueMember'); |
| 51 | 51 | $fieldName = 'uniqueMember'; |
| 52 | 52 | } |
| 53 | - if($rawMembers === false) |
|
| 53 | + if ($rawMembers === false) |
|
| 54 | 54 | { |
| 55 | 55 | $rawMembers = $this->getField('memberUid'); |
| 56 | 56 | $fieldName = 'memberUid'; |
| 57 | 57 | } |
| 58 | - if(!isset($rawMembers['count'])) |
|
| 58 | + if (!isset($rawMembers['count'])) |
|
| 59 | 59 | { |
| 60 | 60 | $rawMembers['count'] = count($rawMembers); |
| 61 | 61 | } |
@@ -65,23 +65,23 @@ discard block |
||
| 65 | 65 | private function getIDFromDN($dn) |
| 66 | 66 | { |
| 67 | 67 | $split = explode(',', $dn); |
| 68 | - if(strncmp('cn=', $split[0], 3) === 0) |
|
| 68 | + if (strncmp('cn=', $split[0], 3) === 0) |
|
| 69 | 69 | { |
| 70 | 70 | return substr($split[0], 3); |
| 71 | 71 | } |
| 72 | 72 | return substr($split[0], 4); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function getMemberUids($recursive=true) |
|
| 75 | + public function getMemberUids($recursive = true) |
|
| 76 | 76 | { |
| 77 | 77 | $members = array(); |
| 78 | 78 | $rawMembers = $this->getMembersField(); |
| 79 | - for($i = 0; $i < $rawMembers['count']; $i++) |
|
| 79 | + for ($i = 0; $i < $rawMembers['count']; $i++) |
|
| 80 | 80 | { |
| 81 | - if($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 81 | + if ($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 82 | 82 | { |
| 83 | 83 | $child = self::from_dn($rawMembers[$i], $this->server); |
| 84 | - if($child !== false) |
|
| 84 | + if ($child !== false) |
|
| 85 | 85 | { |
| 86 | 86 | $members = array_merge($members, $child->members()); |
| 87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | $count = count($members); |
| 95 | - for($i = 0; $i < $count; $i++) |
|
| 95 | + for ($i = 0; $i < $count; $i++) |
|
| 96 | 96 | { |
| 97 | 97 | $members[$i] = $this->getIDFromDN($members[$i]); |
| 98 | 98 | } |
@@ -102,36 +102,36 @@ discard block |
||
| 102 | 102 | private function getObjectFromDN($dn) |
| 103 | 103 | { |
| 104 | 104 | $split = explode(',', $dn); |
| 105 | - if(strncmp('cn=', $dn, 3) === 0) |
|
| 105 | + if (strncmp('cn=', $dn, 3) === 0) |
|
| 106 | 106 | { |
| 107 | - if(count($split) === 1) |
|
| 107 | + if (count($split) === 1) |
|
| 108 | 108 | { |
| 109 | 109 | return LDAPGroup::from_name($dn, $this->server); |
| 110 | 110 | } |
| 111 | 111 | return LDAPGroup::from_name(substr($split[0], 3), $this->server); |
| 112 | 112 | } |
| 113 | - if(count($split) === 1) |
|
| 113 | + if (count($split) === 1) |
|
| 114 | 114 | { |
| 115 | 115 | return LDAPUser::from_name($dn, $this->server); |
| 116 | 116 | } |
| 117 | 117 | return LDAPUser::from_name(substr($split[0], 4), $this->server); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function members($details=false, $recursive=true, $includeGroups=true) |
|
| 120 | + public function members($details = false, $recursive = true, $includeGroups = true) |
|
| 121 | 121 | { |
| 122 | 122 | $members = array(); |
| 123 | 123 | $rawMembers = $this->getMembersField(); |
| 124 | - for($i = 0; $i < $rawMembers['count']; $i++) |
|
| 124 | + for ($i = 0; $i < $rawMembers['count']; $i++) |
|
| 125 | 125 | { |
| 126 | - if($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 126 | + if ($recursive && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 127 | 127 | { |
| 128 | 128 | $child = self::from_dn($rawMembers[$i], $this->server); |
| 129 | - if($child !== false) |
|
| 129 | + if ($child !== false) |
|
| 130 | 130 | { |
| 131 | 131 | $members = array_merge($members, $child->members()); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | - else if($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 134 | + else if ($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0) |
|
| 135 | 135 | { |
| 136 | 136 | //Drop this member |
| 137 | 137 | } |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | array_push($members, $rawMembers[$i]); |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | - if($details === true) |
|
| 143 | + if ($details === true) |
|
| 144 | 144 | { |
| 145 | 145 | $details = array(); |
| 146 | 146 | $count = count($members); |
| 147 | - for($i = 0; $i < $count; $i++) |
|
| 147 | + for ($i = 0; $i < $count; $i++) |
|
| 148 | 148 | { |
| 149 | 149 | $details[$i] = $this->getObjectFromDN($members[$i]); |
| 150 | 150 | } |
@@ -154,37 +154,37 @@ discard block |
||
| 154 | 154 | return $members; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function getNonMemebers($select=false) |
|
| 157 | + public function getNonMemebers($select = false) |
|
| 158 | 158 | { |
| 159 | 159 | $data = array(); |
| 160 | 160 | $groupFilter = '(&(cn=*)(!(cn='.$this->getGroupName().'))'; |
| 161 | 161 | $userFilter = '(&(cn=*)'; |
| 162 | 162 | $members = $this->members(); |
| 163 | 163 | $count = count($members); |
| 164 | - for($i = 0; $i < $count; $i++) |
|
| 164 | + for ($i = 0; $i < $count; $i++) |
|
| 165 | 165 | { |
| 166 | - $dnComps = explode(',',$members[$i]); |
|
| 167 | - if(strncmp($members[$i], "uid=", 4) == 0) |
|
| 166 | + $dnComps = explode(',', $members[$i]); |
|
| 167 | + if (strncmp($members[$i], "uid=", 4) == 0) |
|
| 168 | 168 | { |
| 169 | - $userFilter.='(!('.$dnComps[0].'))'; |
|
| 169 | + $userFilter .= '(!('.$dnComps[0].'))'; |
|
| 170 | 170 | } |
| 171 | 171 | else |
| 172 | 172 | { |
| 173 | - $groupFilter.='(!('.$dnComps[0].'))'; |
|
| 173 | + $groupFilter .= '(!('.$dnComps[0].'))'; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | - $userFilter.=')'; |
|
| 177 | - $groupFilter.=')'; |
|
| 176 | + $userFilter .= ')'; |
|
| 177 | + $groupFilter .= ')'; |
|
| 178 | 178 | $groups = $this->server->read($this->server->group_base, $groupFilter); |
| 179 | 179 | $count = count($groups); |
| 180 | - for($i = 0; $i < $count; $i++) |
|
| 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) continue; |
|
| 183 | 183 | array_push($data, new LDAPGroup($groups[$i])); |
| 184 | 184 | } |
| 185 | 185 | $users = $this->server->read($this->server->user_base, $userFilter, false, $select); |
| 186 | 186 | $count = count($users); |
| 187 | - for($i = 0; $i < $count; $i++) |
|
| 187 | + for ($i = 0; $i < $count; $i++) |
|
| 188 | 188 | { |
| 189 | 189 | array_push($data, new LDAPUser($users[$i])); |
| 190 | 190 | } |
@@ -193,24 +193,24 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | public function clearMembers() |
| 195 | 195 | { |
| 196 | - if(isset($this->ldapObj['member'])) |
|
| 196 | + if (isset($this->ldapObj['member'])) |
|
| 197 | 197 | { |
| 198 | 198 | $this->ldapObj['member'] = array(); |
| 199 | 199 | } |
| 200 | - else if(isset($this->ldapObj['uniquemember'])) |
|
| 200 | + else if (isset($this->ldapObj['uniquemember'])) |
|
| 201 | 201 | { |
| 202 | 202 | $this->ldapObj['uniquemember'] = array(); |
| 203 | 203 | } |
| 204 | - else if(isset($this->ldapObj['memberuid'])) |
|
| 204 | + else if (isset($this->ldapObj['memberuid'])) |
|
| 205 | 205 | { |
| 206 | 206 | $this->ldapObj['memberuid'] = array(); |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - public function addMember($name, $isGroup=false, $flush=true) |
|
| 210 | + public function addMember($name, $isGroup = false, $flush = true) |
|
| 211 | 211 | { |
| 212 | 212 | $dn = false; |
| 213 | - if($isGroup) |
|
| 213 | + if ($isGroup) |
|
| 214 | 214 | { |
| 215 | 215 | $dn = 'cn='.$name.','.$this->server->group_base; |
| 216 | 216 | } |
@@ -220,17 +220,17 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | $propName = false; |
| 222 | 222 | $rawMembers = $this->getMembersField($propName); |
| 223 | - if(isset($rawMembers['count'])) |
|
| 223 | + if (isset($rawMembers['count'])) |
|
| 224 | 224 | { |
| 225 | 225 | unset($rawMembers['count']); |
| 226 | 226 | } |
| 227 | - if(in_array($dn, $rawMembers) || in_array($name, $rawMembers)) |
|
| 227 | + if (in_array($dn, $rawMembers) || in_array($name, $rawMembers)) |
|
| 228 | 228 | { |
| 229 | 229 | return true; |
| 230 | 230 | } |
| 231 | - if($propName === 'memberUid') |
|
| 231 | + if ($propName === 'memberUid') |
|
| 232 | 232 | { |
| 233 | - if($isGroup) |
|
| 233 | + if ($isGroup) |
|
| 234 | 234 | { |
| 235 | 235 | throw new \Exception('Unable to add a group as a child of this group type'); |
| 236 | 236 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | $tmp = strtolower($propName); |
| 244 | 244 | $this->ldapObj->$tmp = $rawMembers; |
| 245 | - if($flush === true) |
|
| 245 | + if ($flush === true) |
|
| 246 | 246 | { |
| 247 | 247 | $obj = array('dn'=>$this->ldapObj->dn); |
| 248 | 248 | $obj[$propName] = $rawMembers; |
@@ -254,29 +254,29 @@ discard block |
||
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - static function from_dn($dn, $data=false) |
|
| 257 | + static function from_dn($dn, $data = false) |
|
| 258 | 258 | { |
| 259 | - if($data === false) |
|
| 259 | + if ($data === false) |
|
| 260 | 260 | { |
| 261 | 261 | throw new \Exception('data must be set for LDAPGroup'); |
| 262 | 262 | } |
| 263 | 263 | $group = $data->read($dn, false, true); |
| 264 | - if($group === false || !isset($group[0])) |
|
| 264 | + if ($group === false || !isset($group[0])) |
|
| 265 | 265 | { |
| 266 | 266 | return false; |
| 267 | 267 | } |
| 268 | 268 | return new static($group[0]); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - static function from_name($name, $data=false) |
|
| 271 | + static function from_name($name, $data = false) |
|
| 272 | 272 | { |
| 273 | - if($data === false) |
|
| 273 | + if ($data === false) |
|
| 274 | 274 | { |
| 275 | 275 | throw new \Exception('data must be set for LDAPGroup'); |
| 276 | 276 | } |
| 277 | 277 | $filter = new \Data\Filter("cn eq $name"); |
| 278 | 278 | $group = $data->read($data->group_base, $filter); |
| 279 | - if($group === false || !isset($group[0])) |
|
| 279 | + if ($group === false || !isset($group[0])) |
|
| 280 | 280 | { |
| 281 | 281 | return false; |
| 282 | 282 | } |
@@ -241,7 +241,7 @@ |
||
| 241 | 241 | $obj['userPassword'] = $this->generateLDAPPass($password); |
| 242 | 242 | if(isset($this->ldap_obj->uniqueidentifier)) |
| 243 | 243 | { |
| 244 | - $obj['uniqueIdentifier'] = null; |
|
| 244 | + $obj['uniqueIdentifier'] = null; |
|
| 245 | 245 | } |
| 246 | 246 | //Make sure we are bound in write mode |
| 247 | 247 | $auth = \AuthProvider::getInstance(); |
@@ -50,6 +50,9 @@ |
||
| 50 | 50 | return $res; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param string $listName |
|
| 55 | + */ |
|
| 53 | 56 | private function isInListOrChild($listName, $group, $dn) |
| 54 | 57 | { |
| 55 | 58 | if(!isset($group[$listName])) |
@@ -8,15 +8,15 @@ discard block |
||
| 8 | 8 | private $ldapObj; |
| 9 | 9 | private $server; |
| 10 | 10 | |
| 11 | - public function __construct($data=false) |
|
| 11 | + public function __construct($data = false) |
|
| 12 | 12 | { |
| 13 | 13 | $this->server = \LDAP\LDAPServer::getInstance(); |
| 14 | - if($data !== false && !isset($data['dn']) && !isset($data['extended'])) |
|
| 14 | + if ($data !== false && !isset($data['dn']) && !isset($data['extended'])) |
|
| 15 | 15 | { |
| 16 | 16 | //Generic user object |
| 17 | 17 | $filter = new \Data\Filter('mail eq '.$data['mail']); |
| 18 | 18 | $users = $this->server->read($this->server->user_base, $filter); |
| 19 | - if($users === false || !isset($users[0])) |
|
| 19 | + if ($users === false || !isset($users[0])) |
|
| 20 | 20 | { |
| 21 | 21 | throw new \Exception('No such LDAP User!'); |
| 22 | 22 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | else |
| 26 | 26 | { |
| 27 | - if(isset($data['extended'])) |
|
| 27 | + if (isset($data['extended'])) |
|
| 28 | 28 | { |
| 29 | 29 | $this->ldapObj = $data['extended']; |
| 30 | 30 | } |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | private function check_child_group($array) |
| 39 | 39 | { |
| 40 | 40 | $res = false; |
| 41 | - for($i = 0; $i < $array['count']; $i++) |
|
| 41 | + for ($i = 0; $i < $array['count']; $i++) |
|
| 42 | 42 | { |
| 43 | - if(strpos($array[$i], $this->server->group_base) !== false) |
|
| 43 | + if (strpos($array[$i], $this->server->group_base) !== false) |
|
| 44 | 44 | { |
| 45 | 45 | $dn = explode(',', $array[$i]); |
| 46 | 46 | $res = $this->isInGroupNamed(substr($dn[0], 3)); |
| 47 | - if($res) return $res; |
|
| 47 | + if ($res) return $res; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | return $res; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private function isInListOrChild($listName, $group, $dn) |
| 54 | 54 | { |
| 55 | - if(!isset($group[$listName])) |
|
| 55 | + if (!isset($group[$listName])) |
|
| 56 | 56 | { |
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | - if(in_array($dn, $group[$listName])) |
|
| 59 | + if (in_array($dn, $group[$listName])) |
|
| 60 | 60 | { |
| 61 | 61 | return true; |
| 62 | 62 | } |
@@ -67,17 +67,17 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $filter = new \Data\Filter('cn eq '.$name); |
| 69 | 69 | $group = $this->server->read($this->server->group_base, $filter); |
| 70 | - if(!empty($group)) |
|
| 70 | + if (!empty($group)) |
|
| 71 | 71 | { |
| 72 | 72 | $group = $group[0]; |
| 73 | 73 | $dn = $this->ldapObj->dn; |
| 74 | 74 | $uid = $this->ldapObj->uid[0]; |
| 75 | 75 | $ret = $this->isInListOrChild('member', $group, $dn); |
| 76 | - if($ret === false) |
|
| 76 | + if ($ret === false) |
|
| 77 | 77 | { |
| 78 | 78 | $ret = $this->isInListOrChild('uniquemember', $group, $dn); |
| 79 | 79 | } |
| 80 | - if($ret === false && isset($group['memberUid']) && in_array($uid, $group['memberUid'])) |
|
| 80 | + if ($ret === false && isset($group['memberUid']) && in_array($uid, $group['memberUid'])) |
|
| 81 | 81 | { |
| 82 | 82 | return true; |
| 83 | 83 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function getOrganization() |
| 120 | 120 | { |
| 121 | 121 | $org = $this->getFieldSingleValue('o'); |
| 122 | - if($org === false) |
|
| 122 | + if ($org === false) |
|
| 123 | 123 | { |
| 124 | 124 | return 'Volunteer'; |
| 125 | 125 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | public function getTitles() |
| 130 | 130 | { |
| 131 | 131 | $titles = $this->getField('title'); |
| 132 | - if(isset($titles['count'])) |
|
| 132 | + if (isset($titles['count'])) |
|
| 133 | 133 | { |
| 134 | 134 | unset($titles['count']); |
| 135 | 135 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | public function getOrganizationUnits() |
| 175 | 175 | { |
| 176 | 176 | $units = $this->getField('ou'); |
| 177 | - if(isset($units['count'])) |
|
| 177 | + if (isset($units['count'])) |
|
| 178 | 178 | { |
| 179 | 179 | unset($units['count']); |
| 180 | 180 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | public function getLoginProviders() |
| 185 | 185 | { |
| 186 | 186 | $hosts = $this->getField('host'); |
| 187 | - if(isset($hosts['count'])) |
|
| 187 | + if (isset($hosts['count'])) |
|
| 188 | 188 | { |
| 189 | 189 | unset($hosts['count']); |
| 190 | 190 | } |
@@ -195,12 +195,12 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $res = array(); |
| 197 | 197 | $groups = $this->server->read($this->server->group_base); |
| 198 | - if(!empty($groups)) |
|
| 198 | + if (!empty($groups)) |
|
| 199 | 199 | { |
| 200 | 200 | $count = count($groups); |
| 201 | - for($i = 0; $i < $count; $i++) |
|
| 201 | + for ($i = 0; $i < $count; $i++) |
|
| 202 | 202 | { |
| 203 | - if($this->isInGroupNamed($groups[$i]['cn'][0])) |
|
| 203 | + if ($this->isInGroupNamed($groups[$i]['cn'][0])) |
|
| 204 | 204 | { |
| 205 | 205 | array_push($res, new LDAPGroup($groups[$i])); |
| 206 | 206 | } |
@@ -220,23 +220,23 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | private function generateLDAPPass($pass) |
| 222 | 222 | { |
| 223 | - mt_srand((double)microtime()*1000000); |
|
| 223 | + mt_srand((double)microtime() * 1000000); |
|
| 224 | 224 | $salt = pack("CCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand()); |
| 225 | - $hash = base64_encode(pack('H*',sha1($pass.$salt)).$salt); |
|
| 225 | + $hash = base64_encode(pack('H*', sha1($pass.$salt)).$salt); |
|
| 226 | 226 | return '{SSHA}'.$hash; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | public function setPass($password) |
| 230 | 230 | { |
| 231 | - if(!is_object($this->ldapObj)) |
|
| 231 | + if (!is_object($this->ldapObj)) |
|
| 232 | 232 | { |
| 233 | - return $this->setFieldLocal('userPassword', $this->generateLDAPPass($password)); |
|
| 233 | + return $this->setFieldLocal('userPassword', $this->generateLDAPPass($password)); |
|
| 234 | 234 | } |
| 235 | 235 | else |
| 236 | 236 | { |
| 237 | 237 | $obj = array('dn'=>$this->ldapObj->dn); |
| 238 | 238 | $obj['userPassword'] = $this->generateLDAPPass($password); |
| 239 | - if(isset($this->ldapObj->uniqueidentifier)) |
|
| 239 | + if (isset($this->ldapObj->uniqueidentifier)) |
|
| 240 | 240 | { |
| 241 | 241 | $obj['uniqueIdentifier'] = null; |
| 242 | 242 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | public function validate_password($password) |
| 252 | 252 | { |
| 253 | - if($this->server->bind($this->ldapObj->dn, $password)) |
|
| 253 | + if ($this->server->bind($this->ldapObj->dn, $password)) |
|
| 254 | 254 | { |
| 255 | 255 | return true; |
| 256 | 256 | } |
@@ -259,37 +259,37 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | public function validate_reset_hash($hash) |
| 261 | 261 | { |
| 262 | - if(isset($this->ldapObj->uniqueidentifier) && strcmp($this->ldapObj->uniqueidentifier[0], $hash) === 0) |
|
| 262 | + if (isset($this->ldapObj->uniqueidentifier) && strcmp($this->ldapObj->uniqueidentifier[0], $hash) === 0) |
|
| 263 | 263 | { |
| 264 | 264 | return true; |
| 265 | 265 | } |
| 266 | 266 | return false; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - static function from_name($name, $data=false) |
|
| 269 | + static function from_name($name, $data = false) |
|
| 270 | 270 | { |
| 271 | - if($data === false) |
|
| 271 | + if ($data === false) |
|
| 272 | 272 | { |
| 273 | 273 | throw new \Exception('data must be set for LDAPUser'); |
| 274 | 274 | } |
| 275 | 275 | $filter = new \Data\Filter("uid eq $name"); |
| 276 | 276 | $user = $data->read($data->user_base, $filter); |
| 277 | - if($user === false || !isset($user[0])) |
|
| 277 | + if ($user === false || !isset($user[0])) |
|
| 278 | 278 | { |
| 279 | 279 | return false; |
| 280 | 280 | } |
| 281 | 281 | return new static($user[0]); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - static function from_dn($dn, $data=false) |
|
| 284 | + static function from_dn($dn, $data = false) |
|
| 285 | 285 | { |
| 286 | - if($data === false) |
|
| 286 | + if ($data === false) |
|
| 287 | 287 | { |
| 288 | 288 | throw new \Exception('data must be set for LDAPUser'); |
| 289 | 289 | } |
| 290 | 290 | $filter = new \Data\Filter("dn eq $dn"); |
| 291 | 291 | $user = $data->read($data->user_base, $filter); |
| 292 | - if($user === false || !isset($user[0])) |
|
| 292 | + if ($user === false || !isset($user[0])) |
|
| 293 | 293 | { |
| 294 | 294 | return false; |
| 295 | 295 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | public function setUid($uid) |
| 320 | 320 | { |
| 321 | - if(!is_object($this->ldapObj)) |
|
| 321 | + if (!is_object($this->ldapObj)) |
|
| 322 | 322 | { |
| 323 | 323 | return $this->setFieldLocal('uid', $uid); |
| 324 | 324 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | public function setTitles($titles) |
| 368 | 368 | { |
| 369 | - if(!is_array($titles)) |
|
| 369 | + if (!is_array($titles)) |
|
| 370 | 370 | { |
| 371 | 371 | $titles = array($titles); |
| 372 | 372 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | public function setOrganizationUnits($ous) |
| 377 | 377 | { |
| 378 | - if(!is_array($ous)) |
|
| 378 | + if (!is_array($ous)) |
|
| 379 | 379 | { |
| 380 | 380 | $ous = array($ous); |
| 381 | 381 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | public function flushUser() |
| 386 | 386 | { |
| 387 | - if(is_object($this->ldapObj)) |
|
| 387 | + if (is_object($this->ldapObj)) |
|
| 388 | 388 | { |
| 389 | 389 | //In this mode we are always up to date |
| 390 | 390 | return true; |
@@ -392,11 +392,11 @@ discard block |
||
| 392 | 392 | $obj = $this->ldapObj; |
| 393 | 393 | $obj['objectClass'] = array('top', 'inetOrgPerson', 'extensibleObject'); |
| 394 | 394 | $obj['dn'] = 'uid='.$this->ldapObj['uid'].','.$this->server->user_base; |
| 395 | - if(!isset($obj['sn'])) |
|
| 395 | + if (!isset($obj['sn'])) |
|
| 396 | 396 | { |
| 397 | 397 | $obj['sn'] = $obj['uid']; |
| 398 | 398 | } |
| 399 | - if(!isset($obj['cn'])) |
|
| 399 | + if (!isset($obj['cn'])) |
|
| 400 | 400 | { |
| 401 | 401 | $obj['cn'] = $obj['uid']; |
| 402 | 402 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $ldapObj = $this->server->read($ldap->user_base, new \Data\Filter('uid eq '.$this->getUid())); |
| 414 | 414 | $ldapObj = $ldapObj[0]; |
| 415 | 415 | $hash = false; |
| 416 | - if(isset($ldapObj->userpassword)) |
|
| 416 | + if (isset($ldapObj->userpassword)) |
|
| 417 | 417 | { |
| 418 | 418 | $hash = hash('sha512', $ldapObj->dn.';'.$ldapObj->userpassword[0].';'.$ldapObj->mail[0]); |
| 419 | 419 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | $obj = array('dn'=>$this->ldapObj->dn); |
| 425 | 425 | $obj['uniqueIdentifier'] = $hash; |
| 426 | - if($this->server->update($obj) === false) |
|
| 426 | + if ($this->server->update($obj) === false) |
|
| 427 | 427 | { |
| 428 | 428 | throw new \Exception('Unable to create hash in LDAP object!'); |
| 429 | 429 | } |
@@ -21,14 +21,12 @@ discard block |
||
| 21 | 21 | throw new \Exception('No such LDAP User!'); |
| 22 | 22 | } |
| 23 | 23 | $this->ldapObj = $users[0]; |
| 24 | - } |
|
| 25 | - else |
|
| 24 | + } else |
|
| 26 | 25 | { |
| 27 | 26 | if(isset($data['extended'])) |
| 28 | 27 | { |
| 29 | 28 | $this->ldapObj = $data['extended']; |
| 30 | - } |
|
| 31 | - else |
|
| 29 | + } else |
|
| 32 | 30 | { |
| 33 | 31 | $this->ldapObj = $data; |
| 34 | 32 | } |
@@ -44,7 +42,9 @@ discard block |
||
| 44 | 42 | { |
| 45 | 43 | $dn = explode(',', $array[$i]); |
| 46 | 44 | $res = $this->isInGroupNamed(substr($dn[0], 3)); |
| 47 | - if($res) return $res; |
|
| 45 | + if($res) { |
|
| 46 | + return $res; |
|
| 47 | + } |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | return $res; |
@@ -206,8 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | return $res; |
| 209 | - } |
|
| 210 | - else |
|
| 209 | + } else |
|
| 211 | 210 | { |
| 212 | 211 | return false; |
| 213 | 212 | } |
@@ -231,8 +230,7 @@ discard block |
||
| 231 | 230 | if(!is_object($this->ldapObj)) |
| 232 | 231 | { |
| 233 | 232 | return $this->setFieldLocal('userPassword', $this->generateLDAPPass($password)); |
| 234 | - } |
|
| 235 | - else |
|
| 233 | + } else |
|
| 236 | 234 | { |
| 237 | 235 | $obj = array('dn'=>$this->ldapObj->dn); |
| 238 | 236 | $obj['userPassword'] = $this->generateLDAPPass($password); |
@@ -321,8 +319,7 @@ discard block |
||
| 321 | 319 | if(!is_object($this->ldapObj)) |
| 322 | 320 | { |
| 323 | 321 | return $this->setFieldLocal('uid', $uid); |
| 324 | - } |
|
| 325 | - else |
|
| 322 | + } else |
|
| 326 | 323 | { |
| 327 | 324 | throw new \Exception('Unsupported!'); |
| 328 | 325 | } |
@@ -416,8 +413,7 @@ discard block |
||
| 416 | 413 | if(isset($ldapObj->userpassword)) |
| 417 | 414 | { |
| 418 | 415 | $hash = hash('sha512', $ldapObj->dn.';'.$ldapObj->userpassword[0].';'.$ldapObj->mail[0]); |
| 419 | - } |
|
| 420 | - else |
|
| 416 | + } else |
|
| 421 | 417 | { |
| 422 | 418 | $hash = hash('sha512', $ldapObj->dn.';'.openssl_random_pseudo_bytes(10).';'.$ldapObj->mail[0]); |
| 423 | 419 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | $ret = $auth->activatePendingUser($user); |
| 67 | 67 | if($ret === false) |
| 68 | 68 | {
|
| 69 | - throw new \Exception('Unable to create user! '.$res);
|
|
| 69 | + throw new \Exception('Unable to create user! '.$res);
|
|
| 70 | 70 | } |
| 71 | 71 | return self::SUCCESS; |
| 72 | 72 | } |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | public function __construct($params) |
| 11 | 11 | {
|
| 12 | 12 | parent::__construct($params); |
| 13 | - if(!isset($params['client_secrets_path'])) |
|
| 13 | + if (!isset($params['client_secrets_path'])) |
|
| 14 | 14 | {
|
| 15 | 15 | throw new \Exception('Missing required parameter client_secrets_path!');
|
| 16 | 16 | } |
| 17 | - if(!isset($params['redirect_url'])) |
|
| 17 | + if (!isset($params['redirect_url'])) |
|
| 18 | 18 | {
|
| 19 | 19 | $params['redirect_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/oauth2callback.php?src=google'; |
| 20 | 20 | } |
@@ -34,21 +34,21 @@ discard block |
||
| 34 | 34 | public function authenticate($code, &$currentUser = false) |
| 35 | 35 | {
|
| 36 | 36 | $googleUser = false; |
| 37 | - try{
|
|
| 37 | + try {
|
|
| 38 | 38 | $this->client->authenticate($code); |
| 39 | 39 | $this->token = $this->client->getAccessToken(); |
| 40 | 40 | \FlipSession::setVar('GoogleToken', $this->token);
|
| 41 | 41 | $oauth2Service = new \Google_Service_Oauth2($this->client); |
| 42 | 42 | $googleUser = $oauth2Service->userinfo->get(); |
| 43 | - } catch(\Exception $ex) {
|
|
| 43 | + } catch (\Exception $ex) {
|
|
| 44 | 44 | return self::LOGIN_FAILED; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $auth = \AuthProvider::getInstance(); |
| 48 | 48 | $localUsers = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$googleUser->email));
|
| 49 | - if($localUsers !== false && isset($localUsers[0])) |
|
| 49 | + if ($localUsers !== false && isset($localUsers[0])) |
|
| 50 | 50 | {
|
| 51 | - if($localUsers[0]->canLoginWith('google.com'))
|
|
| 51 | + if ($localUsers[0]->canLoginWith('google.com'))
|
|
| 52 | 52 | {
|
| 53 | 53 | $auth->impersonateUser($localUsers[0]); |
| 54 | 54 | return self::SUCCESS; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $user->setLastName($googleUser->familyName); |
| 65 | 65 | $user->addLoginProvider('google.com');
|
| 66 | 66 | $ret = $auth->activatePendingUser($user); |
| 67 | - if($ret === false) |
|
| 67 | + if ($ret === false) |
|
| 68 | 68 | {
|
| 69 | 69 | throw new \Exception('Unable to create user! '.$res);
|
| 70 | 70 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function getUser($data = false) |
| 76 | 76 | {
|
| 77 | - if($data === false) |
|
| 77 | + if ($data === false) |
|
| 78 | 78 | {
|
| 79 | 79 | $data = $this->token; |
| 80 | 80 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $profileUser['displayName'] = $googleUser->name; |
| 90 | 90 | $profileUser['jpegPhoto'] = base64_encode(file_get_contents($googleUser->picture)); |
| 91 | 91 | return $profileUser; |
| 92 | - } catch(\Exception $e) |
|
| 92 | + } catch (\Exception $e) |
|
| 93 | 93 | {
|
| 94 | 94 | return false; |
| 95 | 95 | } |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | } |
| 56 | 56 | $currentUser = $localUsers[0]; |
| 57 | 57 | return self::ALREADY_PRESENT; |
| 58 | - } |
|
| 59 | - else |
|
| 58 | + } else |
|
| 60 | 59 | {
|
| 61 | 60 | $user = new PendingUser(); |
| 62 | 61 | $user->setEmail($googleUser->email); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function getUserFromToken($token) |
| 32 | 32 | { |
| 33 | - if($token === false) |
|
| 33 | + if ($token === false) |
|
| 34 | 34 | { |
| 35 | 35 | $token = \FlipSession::getVar('OAuthToken'); |
| 36 | 36 | } |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function getUserFromToken($token) |
| 27 | 27 | { |
| 28 | - if($token === false) |
|
| 28 | + if ($token === false) |
|
| 29 | 29 | { |
| 30 | 30 | $token = \FlipSession::getVar('OAuthToken'); |
| 31 | 31 | } |
| 32 | 32 | $resp = \Httpful\Request::get('https://api.github.com/user')->addHeader('Authorization', 'token '.$token['access_token'])->send(); |
| 33 | 33 | $github_user = $resp->body; |
| 34 | 34 | $user = new \Auth\PendingUser(); |
| 35 | - if(isset($github_user->name)) |
|
| 35 | + if (isset($github_user->name)) |
|
| 36 | 36 | { |
| 37 | 37 | $name = explode(' ', $github_user->name); |
| 38 | 38 | $user->setGivenName($name[0]); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function login($username, $password) |
| 48 | 48 | { |
| 49 | 49 | $resp = \Httpful\Request::post('https://profiles.test.burningflipside.com/api/v1/login?username='.urlencode($username).'&password='.urlencode($password))->send(); |
| 50 | - if($resp->hasErrors()) |
|
| 50 | + if ($resp->hasErrors()) |
|
| 51 | 51 | { |
| 52 | 52 | return false; |
| 53 | 53 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function isLoggedIn($data) |
| 60 | 60 | { |
| 61 | - if(isset($this->user)) |
|
| 61 | + if (isset($this->user)) |
|
| 62 | 62 | { |
| 63 | 63 | return true; |
| 64 | 64 | } |
| 65 | - if(isset($data['res'])) |
|
| 65 | + if (isset($data['res'])) |
|
| 66 | 66 | { |
| 67 | 67 | return $data['res']; |
| 68 | 68 | } |
@@ -30,14 +30,14 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function getUserFromToken($token) |
| 32 | 32 | { |
| 33 | - if($token === false) |
|
| 33 | + if ($token === false) |
|
| 34 | 34 | { |
| 35 | 35 | $token = \FlipSession::getVar('OAuthToken'); |
| 36 | 36 | } |
| 37 | 37 | $resp = \Httpful\Request::get('https://api.github.com/user')->addHeader('Authorization', 'token '.$token['access_token'])->send(); |
| 38 | 38 | $github_user = $resp->body; |
| 39 | 39 | $user = new \Auth\PendingUser(); |
| 40 | - if(isset($github_user->name)) |
|
| 40 | + if (isset($github_user->name)) |
|
| 41 | 41 | { |
| 42 | 42 | $name = explode(' ', $github_user->name); |
| 43 | 43 | $user->setGivenName($name[0]); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function isLoggedIn($data) |
| 12 | 12 | {
|
| 13 | - if(isset($data['res'])) |
|
| 13 | + if (isset($data['res'])) |
|
| 14 | 14 | {
|
| 15 | 15 | return $data['res']; |
| 16 | 16 | } |
@@ -280,11 +280,15 @@ discard block |
||
| 280 | 280 | function canLoginWith($provider) |
| 281 | 281 | { |
| 282 | 282 | $hosts = $this->getLoginProviders(); |
| 283 | - if($hosts === false) return false; |
|
| 283 | + if($hosts === false) { |
|
| 284 | + return false; |
|
| 285 | + } |
|
| 284 | 286 | $count = count($hosts); |
| 285 | 287 | for($i = 0; $i < $count; $i++) |
| 286 | 288 | { |
| 287 | - if(strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 289 | + if(strcasecmp($hosts[$i], $provider) === 0) { |
|
| 290 | + return true; |
|
| 291 | + } |
|
| 288 | 292 | } |
| 289 | 293 | return false; |
| 290 | 294 | } |
@@ -607,8 +611,7 @@ discard block |
||
| 607 | 611 | $this->change_pass($data->oldpass, $data->password); |
| 608 | 612 | unset($data->oldpass); |
| 609 | 613 | unset($data->password); |
| 610 | - } |
|
| 611 | - else if(isset($data->hash) && isset($data->password)) |
|
| 614 | + } else if(isset($data->hash) && isset($data->password)) |
|
| 612 | 615 | { |
| 613 | 616 | $this->change_pass($data->hash, $data->password, true); |
| 614 | 617 | return; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @param string $name The name of the group to check if the user is in |
| 33 | 33 | * |
| 34 | - * @return true|false True if the user is in the group, false otherwise |
|
| 34 | + * @return boolean True if the user is in the group, false otherwise |
|
| 35 | 35 | */ |
| 36 | 36 | function isInGroupNamed($name) |
| 37 | 37 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * The name the user should be displayed as |
| 43 | 43 | * |
| 44 | - * @return string The name the user should be displayed as |
|
| 44 | + * @return boolean The name the user should be displayed as |
|
| 45 | 45 | */ |
| 46 | 46 | function getDisplayName() |
| 47 | 47 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * The given (or first) name for the user |
| 53 | 53 | * |
| 54 | - * @return string The user's first name |
|
| 54 | + * @return boolean The user's first name |
|
| 55 | 55 | */ |
| 56 | 56 | function getGivenName() |
| 57 | 57 | { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * The email address for the user |
| 63 | 63 | * |
| 64 | - * @return string The user's email address |
|
| 64 | + * @return boolean The user's email address |
|
| 65 | 65 | */ |
| 66 | 66 | function getEmail() |
| 67 | 67 | { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | /** |
| 72 | 72 | * The user ID for the user |
| 73 | 73 | * |
| 74 | - * @return string The user's ID or username |
|
| 74 | + * @return boolean The user's ID or username |
|
| 75 | 75 | */ |
| 76 | 76 | function getUid() |
| 77 | 77 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * The photo for the user |
| 83 | 83 | * |
| 84 | - * @return string The user's photo as a binary string |
|
| 84 | + * @return boolean The user's photo as a binary string |
|
| 85 | 85 | */ |
| 86 | 86 | function getPhoto() |
| 87 | 87 | { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * The phone number for the user |
| 93 | 93 | * |
| 94 | - * @return false|string The user's phone number |
|
| 94 | + * @return boolean The user's phone number |
|
| 95 | 95 | */ |
| 96 | 96 | function getPhoneNumber() |
| 97 | 97 | { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * The organziation for the user |
| 103 | 103 | * |
| 104 | - * @return false|string The user's organization |
|
| 104 | + * @return boolean The user's organization |
|
| 105 | 105 | */ |
| 106 | 106 | function getOrganization() |
| 107 | 107 | { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * The list of titles for the user |
| 113 | 113 | * |
| 114 | - * @return array The user's title(s) in short format |
|
| 114 | + * @return boolean The user's title(s) in short format |
|
| 115 | 115 | */ |
| 116 | 116 | function getTitles() |
| 117 | 117 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * The list of titles for the user |
| 123 | 123 | * |
| 124 | - * @return array The user's title(s) in user friendly strings |
|
| 124 | + * @return boolean The user's title(s) in user friendly strings |
|
| 125 | 125 | * |
| 126 | 126 | * @SuppressWarnings("StaticAccess") |
| 127 | 127 | */ |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | /** |
| 160 | 160 | * The state the user's mailing address is in |
| 161 | 161 | * |
| 162 | - * @return string The user's state from their mailing address |
|
| 162 | + * @return boolean The user's state from their mailing address |
|
| 163 | 163 | */ |
| 164 | 164 | function getState() |
| 165 | 165 | { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * The city the user's mailing address is in |
| 171 | 171 | * |
| 172 | - * @return string The user's city from their mailing address |
|
| 172 | + * @return boolean The user's city from their mailing address |
|
| 173 | 173 | */ |
| 174 | 174 | function getCity() |
| 175 | 175 | { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | /** |
| 180 | 180 | * The last name for the user |
| 181 | 181 | * |
| 182 | - * @return string The user's last name |
|
| 182 | + * @return boolean The user's last name |
|
| 183 | 183 | */ |
| 184 | 184 | function getLastName() |
| 185 | 185 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * The nick name for the user |
| 191 | 191 | * |
| 192 | - * @return string The user's nick name |
|
| 192 | + * @return boolean The user's nick name |
|
| 193 | 193 | */ |
| 194 | 194 | function getNickName() |
| 195 | 195 | { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | /** |
| 200 | 200 | * The street address for the user |
| 201 | 201 | * |
| 202 | - * @return string The user's street address |
|
| 202 | + * @return boolean The user's street address |
|
| 203 | 203 | */ |
| 204 | 204 | function getAddress() |
| 205 | 205 | { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * The postal (zip) code for the user's mailing address |
| 211 | 211 | * |
| 212 | - * @return string The user's postal code |
|
| 212 | + * @return boolean The user's postal code |
|
| 213 | 213 | */ |
| 214 | 214 | function getPostalCode() |
| 215 | 215 | { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | /** |
| 220 | 220 | * The country the user's mailing address is in |
| 221 | 221 | * |
| 222 | - * @return string The user's country from their mailing address |
|
| 222 | + * @return boolean The user's country from their mailing address |
|
| 223 | 223 | */ |
| 224 | 224 | function getCountry() |
| 225 | 225 | { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * This is the same as Areas in Flipside speak. |
| 233 | 233 | * |
| 234 | - * @return array The user's orgnaiational units |
|
| 234 | + * @return boolean The user's orgnaiational units |
|
| 235 | 235 | */ |
| 236 | 236 | function getOrganizationUnits() |
| 237 | 237 | { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /** |
| 242 | 242 | * The supplemental login types that the user can use to login |
| 243 | 243 | * |
| 244 | - * @return array The user's login providers |
|
| 244 | + * @return boolean The user's login providers |
|
| 245 | 245 | */ |
| 246 | 246 | function getLoginProviders() |
| 247 | 247 | { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * The groups the user is a part of |
| 253 | 253 | * |
| 254 | - * @return false|array The user's Auth\Group structures |
|
| 254 | + * @return boolean The user's Auth\Group structures |
|
| 255 | 255 | */ |
| 256 | 256 | function getGroups() |
| 257 | 257 | { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @param string $provider The hostname for the provider |
| 277 | 277 | * |
| 278 | - * @return true|false true if they can login with the provider, false otherwise |
|
| 278 | + * @return boolean true if they can login with the provider, false otherwise |
|
| 279 | 279 | */ |
| 280 | 280 | function canLoginWith($provider) |
| 281 | 281 | { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @param string $password The new user password |
| 296 | 296 | * |
| 297 | - * @return true|false true if the user's password was changed, false otherwise |
|
| 297 | + * @return boolean true if the user's password was changed, false otherwise |
|
| 298 | 298 | */ |
| 299 | 299 | protected function setPass($password) |
| 300 | 300 | { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * Has the user completely filled out their user profile? |
| 306 | 306 | * |
| 307 | - * @return true|false true if the user's profile is complete, false otherwise |
|
| 307 | + * @return boolean true if the user's profile is complete, false otherwise |
|
| 308 | 308 | */ |
| 309 | 309 | function isProfileComplete() |
| 310 | 310 | { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @param string $password The user's current password |
| 324 | 324 | * |
| 325 | - * @return true|false true if the user's password is correct, false otherwise |
|
| 325 | + * @return boolean true if the user's password is correct, false otherwise |
|
| 326 | 326 | * |
| 327 | 327 | * @SuppressWarnings("UnusedFormalParameter") |
| 328 | 328 | */ |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * |
| 337 | 337 | * @param string $hash The user's reset hash |
| 338 | 338 | * |
| 339 | - * @return true|false true if the user's hash is correct, false otherwise |
|
| 339 | + * @return boolean true if the user's hash is correct, false otherwise |
|
| 340 | 340 | * |
| 341 | 341 | * @SuppressWarnings("UnusedFormalParameter") |
| 342 | 342 | */ |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param string $newpass The user's new password |
| 353 | 353 | * @param boolean $isHash Is $old_pass a password or a hash |
| 354 | 354 | * |
| 355 | - * @return true|false true if the user's password was changed, false otherwise |
|
| 355 | + * @return boolean true if the user's password was changed, false otherwise |
|
| 356 | 356 | */ |
| 357 | 357 | function change_pass($oldpass, $newpass, $isHash=false) |
| 358 | 358 | { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * |
| 377 | 377 | * @param string $name The user's new display name |
| 378 | 378 | * |
| 379 | - * @return true|false true if the user's display name was changed, false otherwise |
|
| 379 | + * @return boolean true if the user's display name was changed, false otherwise |
|
| 380 | 380 | */ |
| 381 | 381 | function setDisplayName($name) |
| 382 | 382 | { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @param string $name The user's new given name |
| 390 | 390 | * |
| 391 | - * @return true|false true if the user's given name was changed, false otherwise |
|
| 391 | + * @return boolean true if the user's given name was changed, false otherwise |
|
| 392 | 392 | */ |
| 393 | 393 | function setGivenName($name) |
| 394 | 394 | { |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @param string $email The user's new email address |
| 402 | 402 | * |
| 403 | - * @return true|false true if the user's email address was changed, false otherwise |
|
| 403 | + * @return boolean true if the user's email address was changed, false otherwise |
|
| 404 | 404 | * |
| 405 | 405 | * @SuppressWarnings("UnusedFormalParameter") |
| 406 | 406 | */ |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * |
| 415 | 415 | * @param string $uid The user's new user ID |
| 416 | 416 | * |
| 417 | - * @return true|false true if the user's ID was changed, false otherwise |
|
| 417 | + * @return boolean true if the user's ID was changed, false otherwise |
|
| 418 | 418 | * |
| 419 | 419 | * @SuppressWarnings("UnusedFormalParameter") |
| 420 | 420 | */ |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * |
| 429 | 429 | * @param string $photo The user's new photo as a binary string |
| 430 | 430 | * |
| 431 | - * @return true|false true if the user's photo was changed, false otherwise |
|
| 431 | + * @return boolean true if the user's photo was changed, false otherwise |
|
| 432 | 432 | * |
| 433 | 433 | * @SuppressWarnings("UnusedFormalParameter") |
| 434 | 434 | */ |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | * |
| 443 | 443 | * @param string $phone The user's new phonew number |
| 444 | 444 | * |
| 445 | - * @return true|false true if the user's phone number was changed, false otherwise |
|
| 445 | + * @return boolean true if the user's phone number was changed, false otherwise |
|
| 446 | 446 | * |
| 447 | 447 | * @SuppressWarnings("UnusedFormalParameter") |
| 448 | 448 | */ |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | * |
| 457 | 457 | * @param string $org The user's new organization |
| 458 | 458 | * |
| 459 | - * @return true|false true if the user's organization was changed, false otherwise |
|
| 459 | + * @return boolean true if the user's organization was changed, false otherwise |
|
| 460 | 460 | * |
| 461 | 461 | * @SuppressWarnings("UnusedFormalParameter") |
| 462 | 462 | */ |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * |
| 471 | 471 | * @param string $titles The user's new titles |
| 472 | 472 | * |
| 473 | - * @return true|false true if the user's titles were changed, false otherwise |
|
| 473 | + * @return boolean true if the user's titles were changed, false otherwise |
|
| 474 | 474 | * |
| 475 | 475 | * @SuppressWarnings("UnusedFormalParameter") |
| 476 | 476 | */ |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @param string $state The user's new state |
| 486 | 486 | * |
| 487 | - * @return true|false true if the user's state was changed, false otherwise |
|
| 487 | + * @return boolean true if the user's state was changed, false otherwise |
|
| 488 | 488 | * |
| 489 | 489 | * @SuppressWarnings("UnusedFormalParameter") |
| 490 | 490 | */ |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | * |
| 499 | 499 | * @param string $city The user's new city |
| 500 | 500 | * |
| 501 | - * @return true|false true if the user's city was changed, false otherwise |
|
| 501 | + * @return boolean true if the user's city was changed, false otherwise |
|
| 502 | 502 | * |
| 503 | 503 | * @SuppressWarnings("UnusedFormalParameter") |
| 504 | 504 | */ |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | * |
| 513 | 513 | * @param string $sn The user's new last name |
| 514 | 514 | * |
| 515 | - * @return true|false true if the user's last name was changed, false otherwise |
|
| 515 | + * @return boolean true if the user's last name was changed, false otherwise |
|
| 516 | 516 | * |
| 517 | 517 | * @SuppressWarnings("UnusedFormalParameter") |
| 518 | 518 | */ |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | * |
| 527 | 527 | * @param string $displayName The user's new nick name |
| 528 | 528 | * |
| 529 | - * @return true|false true if the user's nick name was changed, false otherwise |
|
| 529 | + * @return boolean true if the user's nick name was changed, false otherwise |
|
| 530 | 530 | */ |
| 531 | 531 | function setNickName($displayName) |
| 532 | 532 | { |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | * |
| 539 | 539 | * @param string $address The user's new mailing address |
| 540 | 540 | * |
| 541 | - * @return true|false true if the user's mailing address was changed, false otherwise |
|
| 541 | + * @return boolean true if the user's mailing address was changed, false otherwise |
|
| 542 | 542 | * |
| 543 | 543 | * @SuppressWarnings("UnusedFormalParameter") |
| 544 | 544 | */ |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | * |
| 553 | 553 | * @param string $postalcode The user's new postal code |
| 554 | 554 | * |
| 555 | - * @return true|false true if the user's postal code was changed, false otherwise |
|
| 555 | + * @return boolean true if the user's postal code was changed, false otherwise |
|
| 556 | 556 | * |
| 557 | 557 | * @SuppressWarnings("UnusedFormalParameter") |
| 558 | 558 | */ |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | * |
| 567 | 567 | * @param string $country The user's new country |
| 568 | 568 | * |
| 569 | - * @return true|false true if the user's country was changed, false otherwise |
|
| 569 | + * @return boolean true if the user's country was changed, false otherwise |
|
| 570 | 570 | * |
| 571 | 571 | * @SuppressWarnings("UnusedFormalParameter") |
| 572 | 572 | */ |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @param string $ous The user's new organizations |
| 582 | 582 | * |
| 583 | - * @return true|false true if the user's organizations was changed, false otherwise |
|
| 583 | + * @return boolean true if the user's organizations was changed, false otherwise |
|
| 584 | 584 | * |
| 585 | 585 | * @SuppressWarnings("UnusedFormalParameter") |
| 586 | 586 | */ |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | /** |
| 705 | 705 | * Obtain the user's password reset hash |
| 706 | 706 | * |
| 707 | - * @return string|false A hash if available, false otherwise |
|
| 707 | + * @return boolean A hash if available, false otherwise |
|
| 708 | 708 | */ |
| 709 | 709 | public function getPasswordResetHash() |
| 710 | 710 | { |
@@ -128,26 +128,26 @@ discard block |
||
| 128 | 128 | public function getTitleNames() |
| 129 | 129 | { |
| 130 | 130 | $titles = $this->getTitles(); |
| 131 | - if($titles === false) |
|
| 131 | + if ($titles === false) |
|
| 132 | 132 | { |
| 133 | 133 | return false; |
| 134 | 134 | } |
| 135 | - if(self::$titlenames === null) |
|
| 135 | + if (self::$titlenames === null) |
|
| 136 | 136 | { |
| 137 | 137 | $dataSet = \DataSetFactory::getDataSetByName('profiles'); |
| 138 | 138 | $dataTable = $dataSet['position']; |
| 139 | 139 | $titlenames = $dataTable->read(); |
| 140 | 140 | self::$titlenames = array(); |
| 141 | 141 | $count = count($titlenames); |
| 142 | - for($i = 0; $i < $count; $i++) |
|
| 142 | + for ($i = 0; $i < $count; $i++) |
|
| 143 | 143 | { |
| 144 | 144 | self::$titlenames[$titlenames[$i]['short_name']] = $titlenames[$i]; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | $count = count($titles); |
| 148 | - for($i = 0; $i < $count; $i++) |
|
| 148 | + for ($i = 0; $i < $count; $i++) |
|
| 149 | 149 | { |
| 150 | - if(isset(self::$titlenames[$titles[$i]])) |
|
| 150 | + if (isset(self::$titlenames[$titles[$i]])) |
|
| 151 | 151 | { |
| 152 | 152 | $title = self::$titlenames[$titles[$i]]; |
| 153 | 153 | $titles[$i] = $title['name']; |
@@ -280,11 +280,11 @@ discard block |
||
| 280 | 280 | public function canLoginWith($provider) |
| 281 | 281 | { |
| 282 | 282 | $hosts = $this->getLoginProviders(); |
| 283 | - if($hosts === false) return false; |
|
| 283 | + if ($hosts === false) return false; |
|
| 284 | 284 | $count = count($hosts); |
| 285 | - for($i = 0; $i < $count; $i++) |
|
| 285 | + for ($i = 0; $i < $count; $i++) |
|
| 286 | 286 | { |
| 287 | - if(strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 287 | + if (strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 288 | 288 | } |
| 289 | 289 | return false; |
| 290 | 290 | } |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function isProfileComplete() |
| 310 | 310 | { |
| 311 | - if($this->getCountry() === false || $this->getAddress() === false || |
|
| 311 | + if ($this->getCountry() === false || $this->getAddress() === false || |
|
| 312 | 312 | $this->getPostalCode() === false || $this->getCity() === false || |
| 313 | - $this->getState() === false || $this->getPhoneNumber() === false) |
|
| 313 | + $this->getState() === false || $this->getPhoneNumber() === false) |
|
| 314 | 314 | { |
| 315 | 315 | return false; |
| 316 | 316 | } |
@@ -354,17 +354,17 @@ discard block |
||
| 354 | 354 | * |
| 355 | 355 | * @return true|false true if the user's password was changed, false otherwise |
| 356 | 356 | */ |
| 357 | - public function change_pass($oldpass, $newpass, $isHash=false) |
|
| 357 | + public function change_pass($oldpass, $newpass, $isHash = false) |
|
| 358 | 358 | { |
| 359 | - if($isHash === false && $this->validate_password($oldpass) === false) |
|
| 359 | + if ($isHash === false && $this->validate_password($oldpass) === false) |
|
| 360 | 360 | { |
| 361 | 361 | throw new \Exception('Invalid Password!', 3); |
| 362 | 362 | } |
| 363 | - if($isHash === true && $this->validate_reset_hash($oldpass) === false) |
|
| 363 | + if ($isHash === true && $this->validate_reset_hash($oldpass) === false) |
|
| 364 | 364 | { |
| 365 | 365 | throw new \Exception('Invalid Reset Hash!', 3); |
| 366 | 366 | } |
| 367 | - if($this->setPass($newpass) === false) |
|
| 367 | + if ($this->setPass($newpass) === false) |
|
| 368 | 368 | { |
| 369 | 369 | throw new \Exception('Unable to set password!', 6); |
| 370 | 370 | } |
@@ -602,99 +602,99 @@ discard block |
||
| 602 | 602 | $auth = \AuthProvider::getInstance(); |
| 603 | 603 | $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator'); |
| 604 | 604 | $ldap->get_and_bind_server(true); |
| 605 | - if(isset($data->oldpass) && isset($data->password)) |
|
| 605 | + if (isset($data->oldpass) && isset($data->password)) |
|
| 606 | 606 | { |
| 607 | 607 | $this->change_pass($data->oldpass, $data->password); |
| 608 | 608 | unset($data->oldpass); |
| 609 | 609 | unset($data->password); |
| 610 | 610 | } |
| 611 | - else if(isset($data->hash) && isset($data->password)) |
|
| 611 | + else if (isset($data->hash) && isset($data->password)) |
|
| 612 | 612 | { |
| 613 | 613 | $this->change_pass($data->hash, $data->password, true); |
| 614 | 614 | return; |
| 615 | 615 | } |
| 616 | - if(isset($data->displayName)) |
|
| 616 | + if (isset($data->displayName)) |
|
| 617 | 617 | { |
| 618 | 618 | $this->setDisplayName($data->displayName); |
| 619 | 619 | unset($data->displayName); |
| 620 | 620 | } |
| 621 | - if(isset($data->givenName)) |
|
| 621 | + if (isset($data->givenName)) |
|
| 622 | 622 | { |
| 623 | 623 | $this->setGivenName($data->givenName); |
| 624 | 624 | unset($data->givenName); |
| 625 | 625 | } |
| 626 | - if(isset($data->jpegPhoto)) |
|
| 626 | + if (isset($data->jpegPhoto)) |
|
| 627 | 627 | { |
| 628 | 628 | $this->setPhoto(base64_decode($data->jpegPhoto)); |
| 629 | 629 | unset($data->jpegPhoto); |
| 630 | 630 | } |
| 631 | - if(isset($data->mail)) |
|
| 631 | + if (isset($data->mail)) |
|
| 632 | 632 | { |
| 633 | - if($data->mail !== $this->getEmail()) |
|
| 633 | + if ($data->mail !== $this->getEmail()) |
|
| 634 | 634 | { |
| 635 | 635 | throw new \Exception('Unable to change email!'); |
| 636 | 636 | } |
| 637 | 637 | unset($data->mail); |
| 638 | 638 | } |
| 639 | - if(isset($data->uid)) |
|
| 639 | + if (isset($data->uid)) |
|
| 640 | 640 | { |
| 641 | - if($data->uid !== $this->getUid()) |
|
| 641 | + if ($data->uid !== $this->getUid()) |
|
| 642 | 642 | { |
| 643 | 643 | throw new \Exception('Unable to change uid!'); |
| 644 | 644 | } |
| 645 | 645 | unset($data->uid); |
| 646 | 646 | } |
| 647 | - if(isset($data->mobile)) |
|
| 647 | + if (isset($data->mobile)) |
|
| 648 | 648 | { |
| 649 | 649 | $this->setPhoneNumber($data->mobile); |
| 650 | 650 | unset($data->mobile); |
| 651 | 651 | } |
| 652 | - if(isset($data->o)) |
|
| 652 | + if (isset($data->o)) |
|
| 653 | 653 | { |
| 654 | 654 | $this->setOrganization($data->o); |
| 655 | 655 | unset($data->o); |
| 656 | 656 | } |
| 657 | - if(isset($data->title)) |
|
| 657 | + if (isset($data->title)) |
|
| 658 | 658 | { |
| 659 | 659 | $this->setTitles($data->title); |
| 660 | 660 | unset($data->title); |
| 661 | 661 | } |
| 662 | - if(isset($data->st)) |
|
| 662 | + if (isset($data->st)) |
|
| 663 | 663 | { |
| 664 | 664 | $this->setState($data->st); |
| 665 | 665 | unset($data->st); |
| 666 | 666 | } |
| 667 | - if(isset($data->l)) |
|
| 667 | + if (isset($data->l)) |
|
| 668 | 668 | { |
| 669 | 669 | $this->setCity($data->l); |
| 670 | 670 | unset($data->l); |
| 671 | 671 | } |
| 672 | - if(isset($data->sn)) |
|
| 672 | + if (isset($data->sn)) |
|
| 673 | 673 | { |
| 674 | 674 | $this->setLastName($data->sn); |
| 675 | 675 | unset($data->sn); |
| 676 | 676 | } |
| 677 | - if(isset($data->cn)) |
|
| 677 | + if (isset($data->cn)) |
|
| 678 | 678 | { |
| 679 | 679 | $this->setNickName($data->cn); |
| 680 | 680 | unset($data->cn); |
| 681 | 681 | } |
| 682 | - if(isset($data->postalAddress)) |
|
| 682 | + if (isset($data->postalAddress)) |
|
| 683 | 683 | { |
| 684 | 684 | $this->setAddress($data->postalAddress); |
| 685 | 685 | unset($data->postalAddress); |
| 686 | 686 | } |
| 687 | - if(isset($data->postalCode)) |
|
| 687 | + if (isset($data->postalCode)) |
|
| 688 | 688 | { |
| 689 | 689 | $this->setPostalCode($data->postalCode); |
| 690 | 690 | unset($data->postalCode); |
| 691 | 691 | } |
| 692 | - if(isset($data->c)) |
|
| 692 | + if (isset($data->c)) |
|
| 693 | 693 | { |
| 694 | 694 | $this->setCountry($data->c); |
| 695 | 695 | unset($data->c); |
| 696 | 696 | } |
| 697 | - if(isset($data->ou)) |
|
| 697 | + if (isset($data->ou)) |
|
| 698 | 698 | { |
| 699 | 699 | $this->setOrganizationUnits($data->ou); |
| 700 | 700 | unset($data->ou); |
@@ -749,13 +749,13 @@ discard block |
||
| 749 | 749 | public function getVcard() |
| 750 | 750 | { |
| 751 | 751 | $ret = "BEGIN:VCARD\nVERSION:2.1\n"; |
| 752 | - $ret.= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
| 753 | - $ret.= 'FN:'.$this->getGivenName()."\n"; |
|
| 754 | - $ret.= 'TITLE:'.implode(',', $this->getTitles())."\n"; |
|
| 755 | - $ret.= "ORG: Austin Artistic Reconstruction\n"; |
|
| 756 | - $ret.= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
| 757 | - $ret.= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
| 758 | - $ret.= "END:VCARD\n"; |
|
| 752 | + $ret .= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
| 753 | + $ret .= 'FN:'.$this->getGivenName()."\n"; |
|
| 754 | + $ret .= 'TITLE:'.implode(',', $this->getTitles())."\n"; |
|
| 755 | + $ret .= "ORG: Austin Artistic Reconstruction\n"; |
|
| 756 | + $ret .= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
| 757 | + $ret .= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
| 758 | + $ret .= "END:VCARD\n"; |
|
| 759 | 759 | return $ret; |
| 760 | 760 | } |
| 761 | 761 | } |