@@ -27,10 +27,10 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
31 | - { |
|
32 | - $value = implode(null,$value); |
|
33 | - } |
|
30 | + if(is_array($value)) |
|
31 | + { |
|
32 | + $value = implode(null,$value); |
|
33 | + } |
|
34 | 34 | if ((string)$value == '') { |
35 | 35 | return false; |
36 | 36 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | class HTML_QuickForm_Rule_FileName extends HTML_QuickForm_Rule |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param $value array Uploaded file info (from $_FILES) |
|
14 | - * @param null $options |
|
15 | - * @return bool |
|
16 | - */ |
|
17 | - public function validate($value, $options = null) |
|
18 | - { |
|
19 | - if ((isset($elementValue['error']) && $elementValue['error'] == 0) || |
|
20 | - (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { |
|
21 | - return is_uploaded_file($elementValue['tmp_name']); |
|
22 | - } else { |
|
23 | - return false; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * @param $value array Uploaded file info (from $_FILES) |
|
14 | + * @param null $options |
|
15 | + * @return bool |
|
16 | + */ |
|
17 | + public function validate($value, $options = null) |
|
18 | + { |
|
19 | + if ((isset($elementValue['error']) && $elementValue['error'] == 0) || |
|
20 | + (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { |
|
21 | + return is_uploaded_file($elementValue['tmp_name']); |
|
22 | + } else { |
|
23 | + return false; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |
@@ -7,22 +7,22 @@ |
||
7 | 7 | */ |
8 | 8 | class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule |
9 | 9 | { |
10 | - /** |
|
11 | - * @param $value array Uploaded file info (from $_FILES) |
|
12 | - * @param null $options |
|
13 | - * @return bool |
|
14 | - */ |
|
15 | - public function validate($elementValue, $maxSize) |
|
16 | - { |
|
17 | - if (!empty($elementValue['error']) && |
|
18 | - (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
19 | - ) { |
|
20 | - return false; |
|
21 | - } |
|
22 | - if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
23 | - return true; |
|
24 | - } |
|
10 | + /** |
|
11 | + * @param $value array Uploaded file info (from $_FILES) |
|
12 | + * @param null $options |
|
13 | + * @return bool |
|
14 | + */ |
|
15 | + public function validate($elementValue, $maxSize) |
|
16 | + { |
|
17 | + if (!empty($elementValue['error']) && |
|
18 | + (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
19 | + ) { |
|
20 | + return false; |
|
21 | + } |
|
22 | + if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
23 | + return true; |
|
24 | + } |
|
25 | 25 | |
26 | - return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
27 | - } |
|
26 | + return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
27 | + } |
|
28 | 28 | } |
@@ -666,7 +666,7 @@ |
||
666 | 666 | $res = Database::query($sql); |
667 | 667 | $count1 = Database::fetch_object($res); |
668 | 668 | $sql = "SELECT COUNT(*) AS n FROM $user_table as u $table ". |
669 | - "WHERE LENGTH(picture_uri) > 0 $url_condition2"; |
|
669 | + "WHERE LENGTH(picture_uri) > 0 $url_condition2"; |
|
670 | 670 | $res = Database::query($sql); |
671 | 671 | $count2 = Database::fetch_object($res); |
672 | 672 | // #users without picture |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | |
19 | 19 | class OpenGraph implements Iterator |
20 | 20 | { |
21 | - /** |
|
22 | - * There are base schema's based on type, this is just |
|
23 | - * a map so that the schema can be obtained |
|
24 | - * |
|
25 | - */ |
|
21 | + /** |
|
22 | + * There are base schema's based on type, this is just |
|
23 | + * a map so that the schema can be obtained |
|
24 | + * |
|
25 | + */ |
|
26 | 26 | public static $TYPES = array( |
27 | 27 | 'activity' => array('activity', 'sport'), |
28 | 28 | 'business' => array('bar', 'company', 'cafe', 'hotel', 'restaurant'), |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | 'website' => array('blog', 'website'), |
35 | 35 | ); |
36 | 36 | |
37 | - /** |
|
38 | - * Holds all the Open Graph values we've parsed from a page |
|
39 | - * |
|
40 | - */ |
|
37 | + /** |
|
38 | + * Holds all the Open Graph values we've parsed from a page |
|
39 | + * |
|
40 | + */ |
|
41 | 41 | private $_values = array(); |
42 | 42 | |
43 | - /** |
|
44 | - * Fetches a URI and parses it for Open Graph data, returns |
|
45 | - * false on error. |
|
46 | - * |
|
47 | - * @param $URI URI to page to parse for Open Graph data |
|
48 | - * @return OpenGraph |
|
49 | - */ |
|
43 | + /** |
|
44 | + * Fetches a URI and parses it for Open Graph data, returns |
|
45 | + * false on error. |
|
46 | + * |
|
47 | + * @param $URI URI to page to parse for Open Graph data |
|
48 | + * @return OpenGraph |
|
49 | + */ |
|
50 | 50 | static public function fetch($URI) { |
51 | 51 | $curl = curl_init($URI); |
52 | 52 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Parses HTML and extracts Open Graph data, this assumes |
|
74 | - * the document is at least well formed. |
|
75 | - * |
|
76 | - * @param $HTML HTML to parse |
|
77 | - * @return OpenGraph |
|
78 | - */ |
|
72 | + /** |
|
73 | + * Parses HTML and extracts Open Graph data, this assumes |
|
74 | + * the document is at least well formed. |
|
75 | + * |
|
76 | + * @param $HTML HTML to parse |
|
77 | + * @return OpenGraph |
|
78 | + */ |
|
79 | 79 | static private function _parse($HTML) { |
80 | 80 | $old_libxml_error = libxml_use_internal_errors(true); |
81 | 81 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | return $page; |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Helper method to access attributes directly |
|
145 | - * Example: |
|
146 | - * $graph->title |
|
147 | - * |
|
148 | - * @param $key Key to fetch from the lookup |
|
149 | - */ |
|
143 | + /** |
|
144 | + * Helper method to access attributes directly |
|
145 | + * Example: |
|
146 | + * $graph->title |
|
147 | + * |
|
148 | + * @param $key Key to fetch from the lookup |
|
149 | + */ |
|
150 | 150 | public function __get($key) { |
151 | 151 | if (array_key_exists($key, $this->_values)) { |
152 | 152 | return $this->_values[$key]; |
@@ -161,29 +161,29 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - /** |
|
165 | - * Return all the keys found on the page |
|
166 | - * |
|
167 | - * @return array |
|
168 | - */ |
|
164 | + /** |
|
165 | + * Return all the keys found on the page |
|
166 | + * |
|
167 | + * @return array |
|
168 | + */ |
|
169 | 169 | public function keys() { |
170 | 170 | return array_keys($this->_values); |
171 | 171 | } |
172 | 172 | |
173 | - /** |
|
174 | - * Helper method to check an attribute exists |
|
175 | - * |
|
176 | - * @param $key |
|
177 | - */ |
|
173 | + /** |
|
174 | + * Helper method to check an attribute exists |
|
175 | + * |
|
176 | + * @param $key |
|
177 | + */ |
|
178 | 178 | public function __isset($key) { |
179 | 179 | return array_key_exists($key, $this->_values); |
180 | 180 | } |
181 | 181 | |
182 | - /** |
|
183 | - * Will return true if the page has location data embedded |
|
184 | - * |
|
185 | - * @return boolean Check if the page has location data |
|
186 | - */ |
|
182 | + /** |
|
183 | + * Will return true if the page has location data embedded |
|
184 | + * |
|
185 | + * @return boolean Check if the page has location data |
|
186 | + */ |
|
187 | 187 | public function hasLocation() { |
188 | 188 | if (array_key_exists('latitude', $this->_values) && array_key_exists('longitude', $this->_values)) { |
189 | 189 | return true; |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | return $valid_address; |
198 | 198 | } |
199 | 199 | |
200 | - /** |
|
201 | - * Iterator code |
|
202 | - */ |
|
200 | + /** |
|
201 | + * Iterator code |
|
202 | + */ |
|
203 | 203 | private $_position = 0; |
204 | 204 | public function rewind() { reset($this->_values); $this->_position = 0; } |
205 | 205 | public function current() { return current($this->_values); } |
@@ -107,14 +107,14 @@ |
||
107 | 107 | return $resu; |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * @author Sebastien Piraux <[email protected]> |
|
112 | - * @param sql : a sql query (as a string) |
|
113 | - * @return hours_array |
|
114 | - * @desc Return an assoc array. Keys are the hours, values are |
|
115 | - * the number of time this hours was found. |
|
116 | - * key 'total' return the sum of all number of time hours |
|
117 | - * appear |
|
110 | + /** |
|
111 | + * @author Sebastien Piraux <[email protected]> |
|
112 | + * @param sql : a sql query (as a string) |
|
113 | + * @return hours_array |
|
114 | + * @desc Return an assoc array. Keys are the hours, values are |
|
115 | + * the number of time this hours was found. |
|
116 | + * key 'total' return the sum of all number of time hours |
|
117 | + * appear |
|
118 | 118 | */ |
119 | 119 | public static function hoursTab($sql) |
120 | 120 | { |
@@ -5,42 +5,42 @@ |
||
5 | 5 | * @deprecated Don't use this class |
6 | 6 | */ |
7 | 7 | class Rights { |
8 | - private static $rights_cache = array(); |
|
9 | - private static $rights = array ( |
|
10 | - 'show_tabs:reports' => |
|
11 | - array ( |
|
12 | - 'type' => 'const', |
|
13 | - 'const' => 'true' ) |
|
14 | - ); |
|
8 | + private static $rights_cache = array(); |
|
9 | + private static $rights = array ( |
|
10 | + 'show_tabs:reports' => |
|
11 | + array ( |
|
12 | + 'type' => 'const', |
|
13 | + 'const' => 'true' ) |
|
14 | + ); |
|
15 | 15 | |
16 | - // warning the goal of this function is to enforce rights managment in Chamilo |
|
17 | - // thus default return value is always true |
|
18 | - public static function hasRight($handler) { |
|
19 | - if (array_key_exists($handler, self::$rights_cache)) |
|
20 | - return self::$rights_cache[$handler]; |
|
16 | + // warning the goal of this function is to enforce rights managment in Chamilo |
|
17 | + // thus default return value is always true |
|
18 | + public static function hasRight($handler) { |
|
19 | + if (array_key_exists($handler, self::$rights_cache)) |
|
20 | + return self::$rights_cache[$handler]; |
|
21 | 21 | |
22 | - if (!array_key_exists($handler, self::$rights)) |
|
23 | - return true; // handler does not exists |
|
22 | + if (!array_key_exists($handler, self::$rights)) |
|
23 | + return true; // handler does not exists |
|
24 | 24 | |
25 | - if (self::$rights[$handler]['type'] == 'sql') { |
|
26 | - $result = Database::query(self::$rights[$handler]['sql']); |
|
27 | - if (Database::num_rows($result) > 0) |
|
28 | - $result = true; |
|
29 | - else |
|
30 | - $result = false; |
|
31 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
32 | - $result = self::$rights[$handler]['const']; |
|
33 | - else if (self::$rights[$handler]['type'] == 'func') |
|
34 | - $result = self::$rights[$handler]['func'](); |
|
35 | - else // handler type not implemented |
|
36 | - return true; |
|
37 | - self::$rights_cache[$handler] = $result; |
|
38 | - return $result; |
|
39 | - } |
|
25 | + if (self::$rights[$handler]['type'] == 'sql') { |
|
26 | + $result = Database::query(self::$rights[$handler]['sql']); |
|
27 | + if (Database::num_rows($result) > 0) |
|
28 | + $result = true; |
|
29 | + else |
|
30 | + $result = false; |
|
31 | + } else if (self::$rights[$handler]['type'] == 'const') |
|
32 | + $result = self::$rights[$handler]['const']; |
|
33 | + else if (self::$rights[$handler]['type'] == 'func') |
|
34 | + $result = self::$rights[$handler]['func'](); |
|
35 | + else // handler type not implemented |
|
36 | + return true; |
|
37 | + self::$rights_cache[$handler] = $result; |
|
38 | + return $result; |
|
39 | + } |
|
40 | 40 | |
41 | - public static function hasRightClosePageWithError($handler) { |
|
42 | - if (hasRight($handler) == false) |
|
43 | - die("You are not allowed here"); //FIXME |
|
44 | - } |
|
41 | + public static function hasRightClosePageWithError($handler) { |
|
42 | + if (hasRight($handler) == false) |
|
43 | + die("You are not allowed here"); //FIXME |
|
44 | + } |
|
45 | 45 | |
46 | 46 | } |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * @param string $pluginName |
|
177 | - * @param int $urlId |
|
178 | - */ |
|
176 | + * @param string $pluginName |
|
177 | + * @param int $urlId |
|
178 | + */ |
|
179 | 179 | public function uninstall($pluginName, $urlId = null) |
180 | 180 | { |
181 | 181 | if (empty($urlId)) { |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @param string $region |
|
256 | - * @param string $template |
|
257 | - * @param bool $forced |
|
258 | - * |
|
259 | - * @return null|string |
|
260 | - */ |
|
255 | + * @param string $region |
|
256 | + * @param string $template |
|
257 | + * @param bool $forced |
|
258 | + * |
|
259 | + * @return null|string |
|
260 | + */ |
|
261 | 261 | public function load_region($region, $template, $forced = false) |
262 | 262 | { |
263 | 263 | if ($region == 'course_tool_plugin') { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Provides access to various HTTP request elements: GET, POST, FILE, etc paramaters. |
5 | - |
|
6 | 5 | * @license see /license.txt |
7 | 6 | * @deprecated |
8 | 7 | * @author Laurent Opprecht <[email protected]> for the Univesity of Geneva |