@@ -75,8 +75,8 @@ |
||
| 75 | 75 | if(!isset($this->headers['Authorization'])) |
| 76 | 76 | { |
| 77 | 77 | $this->app->user = $this->getUserFromSession(); |
| 78 | - } |
|
| 79 | - else |
|
| 78 | + } |
|
| 79 | + else |
|
| 80 | 80 | { |
| 81 | 81 | $header = $this->headers['Authorization']; |
| 82 | 82 | $this->app->user = $this->getUserFromHeader($header); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | throw new \Exception('No such table '.$name); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - function read($tablename, $where=false, $select='*', $count=false, $skip=false, $sort=false) |
|
| 109 | + function read($tablename, $where = false, $select = '*', $count = false, $skip = false, $sort = false) |
|
| 110 | 110 | { |
| 111 | 111 | if($select === false) |
| 112 | 112 | { |
@@ -115,28 +115,28 @@ discard block |
||
| 115 | 115 | $sql = "SELECT $select FROM $tablename"; |
| 116 | 116 | if($where !== false) |
| 117 | 117 | { |
| 118 | - $sql.=' WHERE '.$where; |
|
| 118 | + $sql .= ' WHERE '.$where; |
|
| 119 | 119 | } |
| 120 | 120 | if($count !== false) |
| 121 | 121 | { |
| 122 | 122 | if($skip === false) |
| 123 | 123 | { |
| 124 | - $sql.=' LIMIT '.(int)$count; |
|
| 124 | + $sql .= ' LIMIT '.(int)$count; |
|
| 125 | 125 | } |
| 126 | 126 | else |
| 127 | 127 | { |
| 128 | - $sql.=" LIMIT $skip, $count"; |
|
| 128 | + $sql .= " LIMIT $skip, $count"; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | if($sort !== false) |
| 132 | 132 | { |
| 133 | - $sql.=' ORDER BY '; |
|
| 133 | + $sql .= ' ORDER BY '; |
|
| 134 | 134 | $tmp = array(); |
| 135 | 135 | foreach($sort as $sort_col=>$dir) |
| 136 | 136 | { |
| 137 | - array_push($tmp, $sort_col.' '.($dir === 1?'ASC':'DESC')); |
|
| 137 | + array_push($tmp, $sort_col.' '.($dir === 1 ? 'ASC' : 'DESC')); |
|
| 138 | 138 | } |
| 139 | - $sql.=implode($tmp,','); |
|
| 139 | + $sql .= implode($tmp, ','); |
|
| 140 | 140 | } |
| 141 | 141 | $stmt = $this->pdo->query($sql, \PDO::FETCH_ASSOC); |
| 142 | 142 | if($stmt === false) |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | //First check for parenthesis... |
| 28 | 28 | if($string[0] === '(' && substr($string, -1) === ')') |
| 29 | 29 | { |
| 30 | - $string = substr($string, 1, strlen($string)-2); |
|
| 30 | + $string = substr($string, 1, strlen($string) - 2); |
|
| 31 | 31 | $parens = true; |
| 32 | 32 | } |
| 33 | 33 | if(preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
@@ -51,19 +51,19 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | if($this->children[$i] === '(' || $this->children[$i] === ')') |
| 53 | 53 | { |
| 54 | - $ret.=$this->children[$i]; |
|
| 54 | + $ret .= $this->children[$i]; |
|
| 55 | 55 | } |
| 56 | 56 | else if($this->children[$i] === 'and') |
| 57 | 57 | { |
| 58 | - $ret.=' AND '; |
|
| 58 | + $ret .= ' AND '; |
|
| 59 | 59 | } |
| 60 | 60 | else if($this->children[$i] === 'or') |
| 61 | 61 | { |
| 62 | - $ret.=' OR '; |
|
| 62 | + $ret .= ' OR '; |
|
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - $ret.=$this->children[$i]->to_sql_string(); |
|
| 66 | + $ret .= $this->children[$i]->to_sql_string(); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | return $ret.$this->sqlAppend; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | else |
| 96 | 96 | { |
| 97 | - $ret.=$this->children[$i]->to_ldap_string(); |
|
| 97 | + $ret .= $this->children[$i]->to_ldap_string(); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | if($count === 1 && $prefix === '') |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | public function addToSQLString($string) |
| 191 | 191 | { |
| 192 | - $this->sqlAppend.=$string; |
|
| 192 | + $this->sqlAppend .= $string; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | public function appendChild($child) |
@@ -35,11 +35,17 @@ discard block |
||
| 35 | 35 | return array(new FilterClause($string)); |
| 36 | 36 | } |
| 37 | 37 | $children = array(); |
| 38 | - if($parens) array_push($children, '('); |
|
| 38 | + if($parens) |
|
| 39 | + { |
|
| 40 | + array_push($children, '('); |
|
| 41 | + } |
|
| 39 | 42 | $children = array_merge($children, self::process_string($clauses[1])); |
| 40 | 43 | array_push($children, trim($clauses[2])); |
| 41 | 44 | $children = array_merge($children, self::process_string($clauses[3])); |
| 42 | - if($parens) array_push($children, ')'); |
|
| 45 | + if($parens) |
|
| 46 | + { |
|
| 47 | + array_push($children, ')'); |
|
| 48 | + } |
|
| 43 | 49 | return $children; |
| 44 | 50 | } |
| 45 | 51 | |
@@ -178,7 +184,10 @@ discard block |
||
| 178 | 184 | $count = count($this->children); |
| 179 | 185 | for($i = 0; $i < $count; $i++) |
| 180 | 186 | { |
| 181 | - if(!is_object($this->children[$i])) continue; |
|
| 187 | + if(!is_object($this->children[$i])) |
|
| 188 | + { |
|
| 189 | + continue; |
|
| 190 | + } |
|
| 182 | 191 | if(strstr($this->children[$i]->var1, $substr) !== false || |
| 183 | 192 | strstr($this->children[$i]->var2, $substr) !== false) |
| 184 | 193 | { |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | public $var2; |
| 8 | 8 | public $op; |
| 9 | 9 | |
| 10 | - function __construct($string=false) |
|
| 10 | + function __construct($string = false) |
|
| 11 | 11 | { |
| 12 | 12 | if($string !== false) $this->process_filter_string($string); |
| 13 | 13 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | case 'substringof': |
| 65 | 65 | case 'contains': |
| 66 | - $str = $this->var1.' LIKE \'%'.trim($this->var2,"'").'%\''; |
|
| 66 | + $str = $this->var1.' LIKE \'%'.trim($this->var2, "'").'%\''; |
|
| 67 | 67 | break; |
| 68 | 68 | default: |
| 69 | 69 | $str = $this->var1.$this->op.$this->var2; |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | case 'substringof': |
| 81 | 81 | case 'contains': |
| 82 | - $str.=$this->var1.$this->op.'*'.trim($this->var2,"'").'*'; |
|
| 82 | + $str .= $this->var1.$this->op.'*'.trim($this->var2, "'").'*'; |
|
| 83 | 83 | break; |
| 84 | 84 | case '!=': |
| 85 | - $str.='!('.$this->var1.'='.$this->var2.')'; |
|
| 85 | + $str .= '!('.$this->var1.'='.$this->var2.')'; |
|
| 86 | 86 | break; |
| 87 | 87 | default: |
| 88 | - $str.=$this->var1.$this->op.$this->var2; |
|
| 88 | + $str .= $this->var1.$this->op.$this->var2; |
|
| 89 | 89 | break; |
| 90 | 90 | } |
| 91 | 91 | return $str.')'; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $case = false; |
| 120 | 120 | if(self::str_startswith($this->var1, 'tolower')) |
| 121 | 121 | { |
| 122 | - $field = substr($this->var1, strpos($this->var1, '(')+1); |
|
| 122 | + $field = substr($this->var1, strpos($this->var1, '(') + 1); |
|
| 123 | 123 | $field = substr($field, 0, strpos($field, ')')); |
| 124 | 124 | $case = true; |
| 125 | 125 | } |
@@ -9,7 +9,10 @@ |
||
| 9 | 9 | |
| 10 | 10 | function __construct($string=false) |
| 11 | 11 | { |
| 12 | - if($string !== false) $this->process_filter_string($string); |
|
| 12 | + if($string !== false) |
|
| 13 | + { |
|
| 14 | + $this->process_filter_string($string); |
|
| 15 | + } |
|
| 13 | 16 | } |
| 14 | 17 | |
| 15 | 18 | static function str_startswith($haystack, $needle) |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | protected $collection; |
| 7 | 7 | protected $namespace; |
| 8 | 8 | |
| 9 | - public function __construct($collection, $collection_name=false) |
|
| 9 | + public function __construct($collection, $collection_name = false) |
|
| 10 | 10 | { |
| 11 | 11 | if($collection_name !== false) |
| 12 | 12 | { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function count($filter=false) |
|
| 21 | + public function count($filter = false) |
|
| 22 | 22 | { |
| 23 | 23 | $criteria = array(); |
| 24 | 24 | if($filter !== false) |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | return $filter->to_mongo_filter(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function search($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
| 51 | + public function search($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
| 52 | 52 | { |
| 53 | 53 | $fields = array(); |
| 54 | 54 | $criteria = $this->getCriteriaFromFilter($filter); |
@@ -56,16 +56,16 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $fields = array_fill_keys($select, 1); |
| 58 | 58 | } |
| 59 | - $cursor = $this->collection->find($criteria, $fields); |
|
| 59 | + $cursor = $this->collection->find($criteria, $fields); |
|
| 60 | 60 | if($params !== false && isset($params['fields'])) |
| 61 | 61 | { |
| 62 | 62 | $cursor->fields($params['fields']); |
| 63 | 63 | } |
| 64 | - if($sort !== false) |
|
| 64 | + if($sort !== false) |
|
| 65 | 65 | { |
| 66 | 66 | $cursor->sort($sort); |
| 67 | 67 | } |
| 68 | - if($skip !== false) |
|
| 68 | + if($skip !== false) |
|
| 69 | 69 | { |
| 70 | 70 | $cursor->skip($skip); |
| 71 | 71 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $cursor->limit($count); |
| 75 | 75 | } |
| 76 | - $ret = array(); |
|
| 76 | + $ret = array(); |
|
| 77 | 77 | foreach($cursor as $doc) |
| 78 | 78 | { |
| 79 | 79 | array_push($ret, $doc); |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | private $data; |
| 7 | 7 | private $auth; |
| 8 | 8 | |
| 9 | - function __construct($data=false, $auth=false) |
|
| 9 | + function __construct($data = false, $auth = false) |
|
| 10 | 10 | { |
| 11 | 11 | $this->data = array(); |
| 12 | 12 | $this->auth = $auth; |
@@ -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,7 +354,7 @@ 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 | 359 | if($isHash === false && $this->validate_password($oldpass) === false) |
| 360 | 360 | { |
@@ -793,17 +793,17 @@ discard block |
||
| 793 | 793 | public function getVcard() |
| 794 | 794 | { |
| 795 | 795 | $ret = "BEGIN:VCARD\nVERSION:2.1\n"; |
| 796 | - $ret.= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
| 797 | - $ret.= 'FN:'.$this->getGivenName()."\n"; |
|
| 796 | + $ret .= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
| 797 | + $ret .= 'FN:'.$this->getGivenName()."\n"; |
|
| 798 | 798 | $titles = $this->getTitles(); |
| 799 | 799 | if($titles !== false) |
| 800 | 800 | { |
| 801 | - $ret.= 'TITLE:'.implode(',', $titles)."\n"; |
|
| 801 | + $ret .= 'TITLE:'.implode(',', $titles)."\n"; |
|
| 802 | 802 | } |
| 803 | - $ret.= "ORG: Austin Artistic Reconstruction\n"; |
|
| 804 | - $ret.= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
| 805 | - $ret.= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
| 806 | - $ret.= "END:VCARD\n"; |
|
| 803 | + $ret .= "ORG: Austin Artistic Reconstruction\n"; |
|
| 804 | + $ret .= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
| 805 | + $ret .= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
| 806 | + $ret .= "END:VCARD\n"; |
|
| 807 | 807 | return $ret; |
| 808 | 808 | } |
| 809 | 809 | } |
@@ -280,11 +280,17 @@ |
||
| 280 | 280 | public function canLoginWith($provider) |
| 281 | 281 | { |
| 282 | 282 | $hosts = $this->getLoginProviders(); |
| 283 | - if($hosts === false) return false; |
|
| 283 | + if($hosts === false) |
|
| 284 | + { |
|
| 285 | + return false; |
|
| 286 | + } |
|
| 284 | 287 | $count = count($hosts); |
| 285 | 288 | for($i = 0; $i < $count; $i++) |
| 286 | 289 | { |
| 287 | - if(strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 290 | + if(strcasecmp($hosts[$i], $provider) === 0) |
|
| 291 | + { |
|
| 292 | + return true; |
|
| 293 | + } |
|
| 288 | 294 | } |
| 289 | 295 | return false; |
| 290 | 296 | } |
@@ -10,7 +10,7 @@ |
||
| 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 | 15 | if($data !== false && !isset($data['extended'])) |
| 16 | 16 | { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @SuppressWarnings("UnusedFormalParameter") |
| 104 | 104 | */ |
| 105 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
| 105 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
| 106 | 106 | { |
| 107 | 107 | return false; |
| 108 | 108 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @SuppressWarnings("UnusedFormalParameter") |
| 122 | 122 | */ |
| 123 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
| 123 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
| 124 | 124 | { |
| 125 | 125 | return false; |
| 126 | 126 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @SuppressWarnings("UnusedFormalParameter") |
| 140 | 140 | */ |
| 141 | - public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
| 141 | + public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
| 142 | 142 | { |
| 143 | 143 | return false; |
| 144 | 144 | } |