@@ -69,6 +69,9 @@ |
||
69 | 69 | return $data[0]['hint']; |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @return string |
|
74 | + */ |
|
72 | 75 | private function get_answer() |
73 | 76 | { |
74 | 77 | $dataset = DataSetFactory::get_data_set('profiles'); |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | { |
37 | 37 | $dataset = DataSetFactory::getDataSetByName('profiles'); |
38 | 38 | $datatable = $dataset['captcha']; |
39 | - return $datatable->create(array('question'=>$question,'hint'=>$hint,'answer'=>$answer)); |
|
39 | + return $datatable->create(array('question'=>$question, 'hint'=>$hint, 'answer'=>$answer)); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function __construct() |
43 | 43 | { |
44 | 44 | $this->validIDs = FlipsideCAPTCHA::get_valid_captcha_ids(); |
45 | - $this->random_id = mt_rand(0, count($this->validIDs)-1); |
|
45 | + $this->random_id = mt_rand(0, count($this->validIDs) - 1); |
|
46 | 46 | $this->random_id = $this->validIDs[$this->random_id]; |
47 | 47 | } |
48 | 48 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | |
85 | 85 | public function is_answer_right($answer) |
86 | 86 | { |
87 | - return strcasecmp($this->get_answer(),$answer) == 0; |
|
87 | + return strcasecmp($this->get_answer(), $answer) == 0; |
|
88 | 88 | } |
89 | 89 | |
90 | - public function draw_captcha($explination=true, $return=false, $ownForm=false) |
|
90 | + public function draw_captcha($explination = true, $return = false, $ownForm = false) |
|
91 | 91 | { |
92 | 92 | $string = ''; |
93 | 93 | |
94 | 94 | if($ownForm) |
95 | 95 | { |
96 | - $string.= '<form id="flipcaptcha" name="flipcaptcha">'; |
|
96 | + $string .= '<form id="flipcaptcha" name="flipcaptcha">'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $string .= '<label for="captcha" class="col-sm-2 control-label">'.$this->get_question().'</label><div class="col-sm-10"><input class="form-control" type="text" id="captcha" name="captcha" placeholder="'.$this->get_hint().'" required/></div>'; |
100 | 100 | if($ownForm) |
101 | 101 | { |
102 | - $string.='</form>'; |
|
102 | + $string .= '</form>'; |
|
103 | 103 | } |
104 | 104 | if($explination) |
105 | 105 | { |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /** |
38 | 38 | * Serialize the object into a format consumable by json_encode |
39 | 39 | * |
40 | - * @return mixed The object in a more serialized format |
|
40 | + * @return SerializableObject The object in a more serialized format |
|
41 | 41 | */ |
42 | 42 | public function jsonSerialize() |
43 | 43 | { |
@@ -12,11 +12,17 @@ |
||
12 | 12 | if($string !== false) $this->process_filter_string($string); |
13 | 13 | } |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $needle |
|
17 | + */ |
|
15 | 18 | static function str_startswith($haystack, $needle) |
16 | 19 | { |
17 | 20 | return substr($haystack, 0, strlen($needle)) === $needle; |
18 | 21 | } |
19 | 22 | |
23 | + /** |
|
24 | + * @param boolean $string |
|
25 | + */ |
|
20 | 26 | protected function process_filter_string($string) |
21 | 27 | { |
22 | 28 | if(self::str_startswith($string, 'substringof') || self::str_startswith($string, 'contains') || |
@@ -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) |
@@ -17,6 +17,9 @@ |
||
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $sql |
|
22 | + */ |
|
20 | 23 | function _get_row_count_for_query($sql) |
21 | 24 | { |
22 | 25 | $stmt = $this->pdo->query($sql); |
@@ -134,9 +134,9 @@ |
||
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) |
@@ -6,6 +6,9 @@ |
||
6 | 6 | protected $dataset; |
7 | 7 | protected $tablename; |
8 | 8 | |
9 | + /** |
|
10 | + * @param SQLDataSet $dataset |
|
11 | + */ |
|
9 | 12 | function __construct($dataset, $tablename) |
10 | 13 | { |
11 | 14 | $this->dataset = $dataset; |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | $ret = $this->dataset->read($this->tablename, $where, 'COUNT(*)'); |
66 | 66 | if($ret === false || !isset($ret[0]) || !isset($ret[0]['COUNT(*)'])) |
67 | 67 | { |
68 | - return false; |
|
68 | + return false; |
|
69 | 69 | } |
70 | 70 | else |
71 | 71 | { |
72 | - return $ret[0]['COUNT(*)']; |
|
72 | + return $ret[0]['COUNT(*)']; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | function update($filter, $data) |
95 | 95 | { |
96 | - $where = $filter->to_sql_string(); |
|
97 | - return $this->dataset->update($this->tablename, $where, $data); |
|
96 | + $where = $filter->to_sql_string(); |
|
97 | + return $this->dataset->update($this->tablename, $where, $data); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function create($data) |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Who is this email going to |
74 | 74 | * |
75 | - * @return array The recipients of the email |
|
75 | + * @return string The recipients of the email |
|
76 | 76 | */ |
77 | 77 | public function getToAddresses() |
78 | 78 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * Who is this email going to (CC) |
84 | 84 | * |
85 | - * @return array The recipients of the email |
|
85 | + * @return string The recipients of the email |
|
86 | 86 | */ |
87 | 87 | public function getCCAddresses() |
88 | 88 | { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * Who is this email going to (BCC) |
94 | 94 | * |
95 | - * @return array The recipients of the email |
|
95 | + * @return string The recipients of the email |
|
96 | 96 | */ |
97 | 97 | public function getBCCAddresses() |
98 | 98 | { |
@@ -12,6 +12,9 @@ |
||
12 | 12 | return false; |
13 | 13 | } |
14 | 14 | |
15 | + /** |
|
16 | + * @param Email $email |
|
17 | + */ |
|
15 | 18 | public function sendEmail($email) |
16 | 19 | { |
17 | 20 | return false; |
@@ -117,6 +117,9 @@ discard block |
||
117 | 117 | $this->connect = false; |
118 | 118 | } |
119 | 119 | |
120 | + /** |
|
121 | + * @param string $password |
|
122 | + */ |
|
120 | 123 | function bind($cn=null, $password=null) |
121 | 124 | { |
122 | 125 | $res = false; |
@@ -199,6 +202,9 @@ discard block |
||
199 | 202 | return $ret; |
200 | 203 | } |
201 | 204 | |
205 | + /** |
|
206 | + * @param boolean $filter |
|
207 | + */ |
|
202 | 208 | private function filterToString($filter) |
203 | 209 | { |
204 | 210 | if($filter === false) |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->ds = ldap_connect($this->connect); |
77 | 77 | } |
78 | 78 | |
79 | - private function getConnectString($name, $proto=false) |
|
79 | + private function getConnectString($name, $proto = false) |
|
80 | 80 | { |
81 | 81 | if(strstr($name, ':') !== false) |
82 | 82 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return $name; |
90 | 90 | } |
91 | 91 | |
92 | - function connect($name, $proto=false) |
|
92 | + function connect($name, $proto = false) |
|
93 | 93 | { |
94 | 94 | $connectStr = $this->getConnectString($name, $proto); |
95 | 95 | if($this->ds !== null) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $this->connect = false; |
118 | 118 | } |
119 | 119 | |
120 | - function bind($cn=null, $password=null) |
|
120 | + function bind($cn = null, $password = null) |
|
121 | 121 | { |
122 | 122 | $res = false; |
123 | 123 | if($this->ds === null) |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return $filter->to_ldap_string(); |
215 | 215 | } |
216 | 216 | |
217 | - function read($baseDN, $filter=false, $single=false, $attributes=false) |
|
217 | + function read($baseDN, $filter = false, $single = false, $attributes = false) |
|
218 | 218 | { |
219 | 219 | $filterStr = $this->filterToString($filter); |
220 | 220 | if($this->ds === null) |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | return $res; |
262 | 262 | } |
263 | 263 | |
264 | - function count($baseDN, $filter=false) |
|
264 | + function count($baseDN, $filter = false) |
|
265 | 265 | { |
266 | 266 | $filterStr = $this->filterToString($filter); |
267 | 267 | if($this->ds === null) |
@@ -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; |
@@ -179,7 +179,10 @@ |
||
179 | 179 | $count = count($groups); |
180 | 180 | for($i = 0; $i < $count; $i++) |
181 | 181 | { |
182 | - if($groups[$i] === false || $groups[$i] === null) continue; |
|
182 | + if($groups[$i] === false || $groups[$i] === null) |
|
183 | + { |
|
184 | + continue; |
|
185 | + } |
|
183 | 186 | array_push($data, new LDAPGroup($groups[$i])); |
184 | 187 | } |
185 | 188 | $users = $this->server->read($this->server->user_base, $userFilter, false, $select); |