@@ -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 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Constructor |
14 | 14 | */ |
15 | - public function __construct() |
|
15 | + public function __construct() |
|
16 | 16 | { |
17 | 17 | $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE); |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function get_all($where_conditions = array()) |
21 | 21 | { |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Displays the title + grid |
31 | 31 | */ |
32 | - public function display() |
|
32 | + public function display() |
|
33 | 33 | { |
34 | - // action links |
|
35 | - $content = Display::actions(array( |
|
34 | + // action links |
|
35 | + $content = Display::actions(array( |
|
36 | 36 | array( |
37 | 37 | 'url' => 'event_type.php' , |
38 | 38 | 'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM) |
39 | - ) |
|
39 | + ) |
|
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | $content .= Display::grid_html('event_email_template'); |
43 | 43 | return $content; |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | public function get_status_list() |
47 | 47 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'Height' => '250', |
83 | 83 | ) |
84 | 84 | ); |
85 | - $status_list = $this->get_status_list(); |
|
85 | + $status_list = $this->get_status_list(); |
|
86 | 86 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
87 | 87 | if ($action == 'edit') { |
88 | 88 | $form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | $defaults = $this->get($id); |
100 | 100 | |
101 | 101 | if (!empty($defaults['created_at'])) { |
102 | - $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); |
|
102 | + $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); |
|
103 | 103 | } |
104 | 104 | if (!empty($defaults['updated_at'])) { |
105 | - $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); |
|
105 | + $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); |
|
106 | 106 | } |
107 | 107 | $form->setDefaults($defaults); |
108 | 108 | |
109 | 109 | // Setting the rules |
110 | 110 | $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
111 | 111 | |
112 | - return $form; |
|
112 | + return $form; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function get_count() |
@@ -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') { |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * This function shows the content of a table in a grid. |
|
343 | - * Should not be use to edit information (edit/delete rows) only. |
|
344 | - **/ |
|
342 | + * This function shows the content of a table in a grid. |
|
343 | + * Should not be use to edit information (edit/delete rows) only. |
|
344 | + **/ |
|
345 | 345 | public function display_grid() |
346 | 346 | { |
347 | 347 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
791 | 791 | $my_get_direction = $_GET[$tablename.'_direction']; |
792 | 792 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
793 | - $param[$tablename.'_direction'] = 'ASC'; |
|
793 | + $param[$tablename.'_direction'] = 'ASC'; |
|
794 | 794 | } else { |
795 | 795 | $param[$tablename.'_direction'] = $my_get_direction; |
796 | 796 | } |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | if (is_array($row)) { |
918 | 918 | foreach ($row as & $value) { |
919 | 919 | if (empty($value)) { |
920 | - $value = '-'; |
|
920 | + $value = '-'; |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | } |