@@ -251,7 +251,7 @@ |
||
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | - $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' . |
|
254 | + $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' . |
|
255 | 255 | Display::return_icon( |
256 | 256 | 'percentage.png', |
257 | 257 | get_lang('EditAllWeights'), |
@@ -9,70 +9,70 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class WSCMError |
11 | 11 | { |
12 | - /** |
|
13 | - * Error handler. This needs to be a class that implements the interface WSErrorHandler |
|
14 | - * |
|
15 | - * @var WSErrorHandler |
|
16 | - */ |
|
17 | - protected static $_handler; |
|
12 | + /** |
|
13 | + * Error handler. This needs to be a class that implements the interface WSErrorHandler |
|
14 | + * |
|
15 | + * @var WSErrorHandler |
|
16 | + */ |
|
17 | + protected static $_handler; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Error code |
|
21 | - * |
|
22 | - * @var int |
|
23 | - */ |
|
24 | - public $code; |
|
19 | + /** |
|
20 | + * Error code |
|
21 | + * |
|
22 | + * @var int |
|
23 | + */ |
|
24 | + public $code; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Error message |
|
28 | - * |
|
29 | - * @var string |
|
30 | - */ |
|
31 | - public $message; |
|
26 | + /** |
|
27 | + * Error message |
|
28 | + * |
|
29 | + * @var string |
|
30 | + */ |
|
31 | + public $message; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Constructor |
|
35 | - * |
|
36 | - * @param int Error code |
|
37 | - * @param string Error message |
|
38 | - */ |
|
39 | - public function __construct($code, $message) |
|
33 | + /** |
|
34 | + * Constructor |
|
35 | + * |
|
36 | + * @param int Error code |
|
37 | + * @param string Error message |
|
38 | + */ |
|
39 | + public function __construct($code, $message) |
|
40 | 40 | { |
41 | - $this->code = $code; |
|
42 | - $this->message = $message; |
|
43 | - } |
|
41 | + $this->code = $code; |
|
42 | + $this->message = $message; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Sets the error handler |
|
47 | - * |
|
48 | - * @param WSErrorHandler Error handler |
|
49 | - */ |
|
50 | - public static function setErrorHandler($handler) |
|
45 | + /** |
|
46 | + * Sets the error handler |
|
47 | + * |
|
48 | + * @param WSErrorHandler Error handler |
|
49 | + */ |
|
50 | + public static function setErrorHandler($handler) |
|
51 | 51 | { |
52 | - if($handler instanceof WSErrorHandler) { |
|
53 | - self::$_handler = $handler; |
|
54 | - } |
|
55 | - } |
|
52 | + if($handler instanceof WSErrorHandler) { |
|
53 | + self::$_handler = $handler; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Returns the error handler |
|
59 | - * |
|
60 | - * @return WSErrorHandler Error handler |
|
61 | - */ |
|
62 | - public static function getErrorHandler() |
|
57 | + /** |
|
58 | + * Returns the error handler |
|
59 | + * |
|
60 | + * @return WSErrorHandler Error handler |
|
61 | + */ |
|
62 | + public static function getErrorHandler() |
|
63 | 63 | { |
64 | - return self::$_handler; |
|
65 | - } |
|
64 | + return self::$_handler; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Transforms the error into an array |
|
69 | - * |
|
70 | - * @return array Associative array with code and message |
|
71 | - */ |
|
72 | - public function toArray() |
|
67 | + /** |
|
68 | + * Transforms the error into an array |
|
69 | + * |
|
70 | + * @return array Associative array with code and message |
|
71 | + */ |
|
72 | + public function toArray() |
|
73 | 73 | { |
74 | - return array('code' => $this->code, 'message' => $this->message); |
|
75 | - } |
|
74 | + return array('code' => $this->code, 'message' => $this->message); |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | */ |
81 | 81 | interface WSCMErrorHandler |
82 | 82 | { |
83 | - /** |
|
84 | - * Handle method |
|
85 | - * |
|
86 | - * @param WSError Error |
|
87 | - */ |
|
88 | - public function handle($error); |
|
83 | + /** |
|
84 | + * Handle method |
|
85 | + * |
|
86 | + * @param WSError Error |
|
87 | + */ |
|
88 | + public function handle($error); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -93,58 +93,58 @@ discard block |
||
93 | 93 | */ |
94 | 94 | class WSCM |
95 | 95 | { |
96 | - /** |
|
97 | - * Chamilo configuration |
|
98 | - * |
|
99 | - * @var array |
|
100 | - */ |
|
101 | - protected $_configuration; |
|
96 | + /** |
|
97 | + * Chamilo configuration |
|
98 | + * |
|
99 | + * @var array |
|
100 | + */ |
|
101 | + protected $_configuration; |
|
102 | 102 | |
103 | - /** |
|
104 | - * Constructor |
|
105 | - */ |
|
106 | - public function __construct() |
|
103 | + /** |
|
104 | + * Constructor |
|
105 | + */ |
|
106 | + public function __construct() |
|
107 | 107 | { |
108 | - $this->_configuration = $GLOBALS['_configuration']; |
|
109 | - } |
|
108 | + $this->_configuration = $GLOBALS['_configuration']; |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Verifies the API key |
|
113 | - * |
|
114 | - * @param string Secret key |
|
115 | - * @return mixed WSError in case of failure, null in case of success |
|
116 | - */ |
|
117 | - protected function verifyKey($secret_key) |
|
111 | + /** |
|
112 | + * Verifies the API key |
|
113 | + * |
|
114 | + * @param string Secret key |
|
115 | + * @return mixed WSError in case of failure, null in case of success |
|
116 | + */ |
|
117 | + protected function verifyKey($secret_key) |
|
118 | 118 | { |
119 | - $ip = trim($_SERVER['REMOTE_ADDR']); |
|
120 | - // if we are behind a reverse proxy, assume it will send the |
|
121 | - // HTTP_X_FORWARDED_FOR header and use this IP instead |
|
122 | - if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
123 | - list($ip1,$ip2) = split(',',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
124 | - $ip = trim($ip1); |
|
125 | - } |
|
126 | - $security_key = $ip.$this->_configuration['security_key']; |
|
119 | + $ip = trim($_SERVER['REMOTE_ADDR']); |
|
120 | + // if we are behind a reverse proxy, assume it will send the |
|
121 | + // HTTP_X_FORWARDED_FOR header and use this IP instead |
|
122 | + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
123 | + list($ip1,$ip2) = split(',',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
124 | + $ip = trim($ip1); |
|
125 | + } |
|
126 | + $security_key = $ip.$this->_configuration['security_key']; |
|
127 | 127 | |
128 | - if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
129 | - return new WSCMError(1, "API key is invalid"); |
|
130 | - } else { |
|
131 | - return null; |
|
132 | - } |
|
133 | - } |
|
128 | + if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
129 | + return new WSCMError(1, "API key is invalid"); |
|
130 | + } else { |
|
131 | + return null; |
|
132 | + } |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
136 | - * Verifies if the user is valid |
|
137 | - * |
|
138 | - * @param <String> $username of the user in chamilo |
|
139 | - * @param <String> $pass of the same user (in MD5 of SHA) |
|
140 | - * |
|
141 | - * return "valid" if username e password are correct! Else, return a message error |
|
142 | - */ |
|
135 | + /** |
|
136 | + * Verifies if the user is valid |
|
137 | + * |
|
138 | + * @param <String> $username of the user in chamilo |
|
139 | + * @param <String> $pass of the same user (in MD5 of SHA) |
|
140 | + * |
|
141 | + * return "valid" if username e password are correct! Else, return a message error |
|
142 | + */ |
|
143 | 143 | |
144 | - public function verifyUserPass($username, $pass) |
|
144 | + public function verifyUserPass($username, $pass) |
|
145 | 145 | { |
146 | - $login = $username; |
|
147 | - $password = $pass; |
|
146 | + $login = $username; |
|
147 | + $password = $pass; |
|
148 | 148 | |
149 | 149 | //lookup the user in the main database |
150 | 150 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
@@ -182,132 +182,132 @@ discard block |
||
182 | 182 | } |
183 | 183 | } |
184 | 184 | return get_lang('InvalidId'); |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * Gets the real user id based on the user id field name and value. |
|
189 | - * Note that if the user id field name is "chamilo_user_id", it will use the user id |
|
190 | - * in the system database |
|
191 | - * |
|
192 | - * @param string User id field name |
|
193 | - * @param string User id value |
|
194 | - * @return mixed System user id if the user was found, WSError otherwise |
|
195 | - */ |
|
196 | - protected function getUserId($user_id_field_name, $user_id_value) |
|
187 | + /** |
|
188 | + * Gets the real user id based on the user id field name and value. |
|
189 | + * Note that if the user id field name is "chamilo_user_id", it will use the user id |
|
190 | + * in the system database |
|
191 | + * |
|
192 | + * @param string User id field name |
|
193 | + * @param string User id value |
|
194 | + * @return mixed System user id if the user was found, WSError otherwise |
|
195 | + */ |
|
196 | + protected function getUserId($user_id_field_name, $user_id_value) |
|
197 | 197 | { |
198 | - if($user_id_field_name == "chamilo_user_id") { |
|
199 | - if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
200 | - return intval($user_id_value); |
|
201 | - } else { |
|
202 | - return new WSCMError(100, "User not found"); |
|
203 | - } |
|
204 | - } else { |
|
205 | - $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
|
206 | - if($user_id == 0) { |
|
207 | - return new WSCMError(100, "User not found"); |
|
208 | - } else { |
|
209 | - return $user_id; |
|
210 | - } |
|
211 | - } |
|
212 | - } |
|
198 | + if($user_id_field_name == "chamilo_user_id") { |
|
199 | + if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
200 | + return intval($user_id_value); |
|
201 | + } else { |
|
202 | + return new WSCMError(100, "User not found"); |
|
203 | + } |
|
204 | + } else { |
|
205 | + $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
|
206 | + if($user_id == 0) { |
|
207 | + return new WSCMError(100, "User not found"); |
|
208 | + } else { |
|
209 | + return $user_id; |
|
210 | + } |
|
211 | + } |
|
212 | + } |
|
213 | 213 | |
214 | - /** |
|
215 | - * Gets the real course id based on the course id field name and value. |
|
216 | - * Note that if the course id field name is "chamilo_course_id", it will use the course id |
|
217 | - * in the system database |
|
218 | - * |
|
219 | - * @param string Course id field name |
|
220 | - * @param string Course id value |
|
221 | - * @return mixed System course id if the course was found, WSError otherwise |
|
222 | - */ |
|
223 | - protected function getCourseId($course_id_field_name, $course_id_value) |
|
214 | + /** |
|
215 | + * Gets the real course id based on the course id field name and value. |
|
216 | + * Note that if the course id field name is "chamilo_course_id", it will use the course id |
|
217 | + * in the system database |
|
218 | + * |
|
219 | + * @param string Course id field name |
|
220 | + * @param string Course id value |
|
221 | + * @return mixed System course id if the course was found, WSError otherwise |
|
222 | + */ |
|
223 | + protected function getCourseId($course_id_field_name, $course_id_value) |
|
224 | 224 | { |
225 | - if($course_id_field_name == "chamilo_course_id") { |
|
226 | - if(CourseManager::get_course_code_from_course_id(intval($course_id_value)) != null) { |
|
227 | - return intval($course_id_value); |
|
228 | - } else { |
|
229 | - return new WSCMError(200, "Course not found"); |
|
230 | - } |
|
231 | - } else { |
|
232 | - $courseId = CourseManager::get_course_code_from_original_id($course_id_value, $course_id_field_name); |
|
233 | - if (empty($courseId)) { |
|
234 | - return new WSCMError(200, "Course not found"); |
|
235 | - } else { |
|
236 | - return $courseId; |
|
237 | - } |
|
238 | - } |
|
239 | - } |
|
225 | + if($course_id_field_name == "chamilo_course_id") { |
|
226 | + if(CourseManager::get_course_code_from_course_id(intval($course_id_value)) != null) { |
|
227 | + return intval($course_id_value); |
|
228 | + } else { |
|
229 | + return new WSCMError(200, "Course not found"); |
|
230 | + } |
|
231 | + } else { |
|
232 | + $courseId = CourseManager::get_course_code_from_original_id($course_id_value, $course_id_field_name); |
|
233 | + if (empty($courseId)) { |
|
234 | + return new WSCMError(200, "Course not found"); |
|
235 | + } else { |
|
236 | + return $courseId; |
|
237 | + } |
|
238 | + } |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Gets the real session id based on the session id field name and value. |
|
243 | - * Note that if the session id field name is "chamilo_session_id", it will use the session id |
|
244 | - * in the system database |
|
245 | - * |
|
246 | - * @param string Session id field name |
|
247 | - * @param string Session id value |
|
248 | - * @return mixed System session id if the session was found, WSError otherwise |
|
249 | - */ |
|
250 | - protected function getSessionId($session_id_field_name, $session_id_value) |
|
251 | - { |
|
252 | - if ($session_id_field_name == "chamilo_session_id") { |
|
253 | - $session = SessionManager::fetch((int)$session_id_value); |
|
254 | - if(!empty($session)) { |
|
255 | - return intval($session_id_value); |
|
256 | - } else { |
|
257 | - return new WSCMError(300, "Session not found"); |
|
258 | - } |
|
259 | - } else { |
|
260 | - $session_id = SessionManager::getSessionIdFromOriginalId( |
|
261 | - $session_id_value, |
|
262 | - $session_id_field_name |
|
263 | - ); |
|
264 | - if($session_id == 0) { |
|
265 | - return new WSCMError(300, "Session not found"); |
|
266 | - } else { |
|
267 | - return $session_id; |
|
268 | - } |
|
269 | - } |
|
270 | - } |
|
241 | + /** |
|
242 | + * Gets the real session id based on the session id field name and value. |
|
243 | + * Note that if the session id field name is "chamilo_session_id", it will use the session id |
|
244 | + * in the system database |
|
245 | + * |
|
246 | + * @param string Session id field name |
|
247 | + * @param string Session id value |
|
248 | + * @return mixed System session id if the session was found, WSError otherwise |
|
249 | + */ |
|
250 | + protected function getSessionId($session_id_field_name, $session_id_value) |
|
251 | + { |
|
252 | + if ($session_id_field_name == "chamilo_session_id") { |
|
253 | + $session = SessionManager::fetch((int)$session_id_value); |
|
254 | + if(!empty($session)) { |
|
255 | + return intval($session_id_value); |
|
256 | + } else { |
|
257 | + return new WSCMError(300, "Session not found"); |
|
258 | + } |
|
259 | + } else { |
|
260 | + $session_id = SessionManager::getSessionIdFromOriginalId( |
|
261 | + $session_id_value, |
|
262 | + $session_id_field_name |
|
263 | + ); |
|
264 | + if($session_id == 0) { |
|
265 | + return new WSCMError(300, "Session not found"); |
|
266 | + } else { |
|
267 | + return $session_id; |
|
268 | + } |
|
269 | + } |
|
270 | + } |
|
271 | 271 | |
272 | - /** |
|
273 | - * Handles an error by calling the WSError error handler |
|
274 | - * |
|
275 | - * @param WSError Error |
|
276 | - */ |
|
277 | - protected function handleError($error) |
|
278 | - { |
|
279 | - $handler = WSCMError::getErrorHandler(); |
|
280 | - $handler->handle($error); |
|
281 | - } |
|
272 | + /** |
|
273 | + * Handles an error by calling the WSError error handler |
|
274 | + * |
|
275 | + * @param WSError Error |
|
276 | + */ |
|
277 | + protected function handleError($error) |
|
278 | + { |
|
279 | + $handler = WSCMError::getErrorHandler(); |
|
280 | + $handler->handle($error); |
|
281 | + } |
|
282 | 282 | |
283 | - /** |
|
284 | - * Gets a successful result |
|
285 | - * |
|
286 | - * @return array Array with a code of 0 and a message 'Operation was successful' |
|
287 | - */ |
|
288 | - protected function getSuccessfulResult() |
|
289 | - { |
|
290 | - return array('code' => 0, 'message' => 'Operation was successful'); |
|
291 | - } |
|
283 | + /** |
|
284 | + * Gets a successful result |
|
285 | + * |
|
286 | + * @return array Array with a code of 0 and a message 'Operation was successful' |
|
287 | + */ |
|
288 | + protected function getSuccessfulResult() |
|
289 | + { |
|
290 | + return array('code' => 0, 'message' => 'Operation was successful'); |
|
291 | + } |
|
292 | 292 | |
293 | - /** |
|
294 | - * Test function. Returns the string success |
|
295 | - * |
|
296 | - * @return string Success |
|
297 | - */ |
|
298 | - public function test() |
|
299 | - { |
|
300 | - return "success"; |
|
301 | - } |
|
293 | + /** |
|
294 | + * Test function. Returns the string success |
|
295 | + * |
|
296 | + * @return string Success |
|
297 | + */ |
|
298 | + public function test() |
|
299 | + { |
|
300 | + return "success"; |
|
301 | + } |
|
302 | 302 | |
303 | - /** |
|
304 | - * *Strictly* reverts PHP's nl2br() effects (whether it was used in XHTML mode or not) |
|
305 | - * @param <type> $string |
|
306 | - * @return <type> $string |
|
307 | - */ |
|
308 | - public function nl2br_revert($string) { |
|
309 | - return preg_replace('`<br(?: /)?>([\\n\\r])`', '$1', $string); |
|
310 | - } |
|
303 | + /** |
|
304 | + * *Strictly* reverts PHP's nl2br() effects (whether it was used in XHTML mode or not) |
|
305 | + * @param <type> $string |
|
306 | + * @return <type> $string |
|
307 | + */ |
|
308 | + public function nl2br_revert($string) { |
|
309 | + return preg_replace('`<br(?: /)?>([\\n\\r])`', '$1', $string); |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | 313 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | 'jpeg' => 'image/jpeg', |
7 | 7 | 'bmp' => 'image/bmp', |
8 | 8 | 'webp' => 'image/webp', |
9 | - 'pdf' => 'application/pdf' |
|
9 | + 'pdf' => 'application/pdf' |
|
10 | 10 | ); |
11 | 11 | |
12 | 12 | ?> |
13 | 13 | \ No newline at end of file |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | - // You must first create a file "savefile_config.php" in this extensions directory and do whatever |
|
3 | - // checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG |
|
4 | - // files to your server which may cause disk space or possibly security problems |
|
5 | - require('savefile_config.php'); |
|
6 | - if (!isset($_POST['output_svg'])) { |
|
7 | - print "You must supply output_svg"; |
|
8 | - exit; |
|
9 | - } |
|
10 | - $svg = $_POST['output_svg']; |
|
11 | - $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows |
|
2 | + // You must first create a file "savefile_config.php" in this extensions directory and do whatever |
|
3 | + // checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG |
|
4 | + // files to your server which may cause disk space or possibly security problems |
|
5 | + require('savefile_config.php'); |
|
6 | + if (!isset($_POST['output_svg'])) { |
|
7 | + print "You must supply output_svg"; |
|
8 | + exit; |
|
9 | + } |
|
10 | + $svg = $_POST['output_svg']; |
|
11 | + $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows |
|
12 | 12 | |
13 | - $fh = fopen($filename, 'w') or die("Can't open file"); |
|
14 | - fwrite($fh, $svg); |
|
15 | - fclose($fh); |
|
13 | + $fh = fopen($filename, 'w') or die("Can't open file"); |
|
14 | + fwrite($fh, $svg); |
|
15 | + fclose($fh); |
|
16 | 16 | ?> |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | //get all files and folders |
17 | 17 | $scan_files = []; |
18 | 18 | if (is_dir($user_disk_path)) { |
19 | - $scan_files = scandir($user_disk_path); |
|
19 | + $scan_files = scandir($user_disk_path); |
|
20 | 20 | } |
21 | 21 | //get all svg and png files |
22 | 22 | $accepted_extensions = array('.svg', '.png'); |
23 | 23 | |
24 | 24 | if (is_array($scan_files) && count($scan_files) > 0) { |
25 | - foreach ($scan_files as & $file) { |
|
26 | - $slideshow_extension = strrchr($file, '.'); |
|
27 | - $slideshow_extension = strtolower($slideshow_extension); |
|
28 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | - $png_svg_files[] =$file; |
|
30 | - } |
|
31 | - } |
|
25 | + foreach ($scan_files as & $file) { |
|
26 | + $slideshow_extension = strrchr($file, '.'); |
|
27 | + $slideshow_extension = strtolower($slideshow_extension); |
|
28 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | + $png_svg_files[] =$file; |
|
30 | + } |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | $style = '<style>'; |
34 | 34 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>'; |
48 | 48 | |
49 | 49 | if (!empty($png_svg_files)) { |
50 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | - echo '<ul>'; |
|
52 | - foreach($png_svg_files as $filename) { |
|
53 | - $image = $user_disk_path.$filename; |
|
50 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | + echo '<ul>'; |
|
52 | + foreach($png_svg_files as $filename) { |
|
53 | + $image = $user_disk_path.$filename; |
|
54 | 54 | |
55 | - if (strpos($filename, "svg")){ |
|
56 | - $new_sizes['width'] = 60; |
|
57 | - $new_sizes['height'] = 60; |
|
58 | - } else { |
|
59 | - $new_sizes = api_resize_image($image, 60, 60); |
|
60 | - } |
|
55 | + if (strpos($filename, "svg")){ |
|
56 | + $new_sizes['width'] = 60; |
|
57 | + $new_sizes['height'] = 60; |
|
58 | + } else { |
|
59 | + $new_sizes = api_resize_image($image, 60, 60); |
|
60 | + } |
|
61 | 61 | |
62 | - echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | - } |
|
64 | - echo '</ul>'; |
|
62 | + echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | + } |
|
64 | + echo '</ul>'; |
|
65 | 65 | } else { |
66 | - Display::display_warning_message(get_lang('NoSVGImages')); |
|
66 | + Display::display_warning_message(get_lang('NoSVGImages')); |
|
67 | 67 | } |
68 | 68 | ?> |
69 | 69 | </body> |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array(); |
35 | 35 | |
36 | 36 | if (count($array_to_search) > 0) { |
37 | - while (list($key) = each($array_to_search)) { |
|
38 | - $all_files[] = basename($array_to_search[$key]['path']); |
|
39 | - } |
|
37 | + while (list($key) = each($array_to_search)) { |
|
38 | + $all_files[] = basename($array_to_search[$key]['path']); |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | //get all svg and png group files |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $groupId))) || $group_properties['doc_state'] == 1 |
71 | 71 | ){ |
72 | 72 | |
73 | - if (!empty($png_svg_files)) { |
|
74 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
75 | - echo '<ul>'; |
|
76 | - foreach($png_svg_files as $filename) { |
|
77 | - $image = $group_disk_path.$filename; |
|
78 | - |
|
79 | - if (strpos($filename, "svg")){ |
|
80 | - $new_sizes['width'] = 60; |
|
81 | - $new_sizes['height'] = 60; |
|
82 | - } else { |
|
83 | - $new_sizes = api_resize_image($image, 60, 60); |
|
84 | - } |
|
73 | + if (!empty($png_svg_files)) { |
|
74 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
75 | + echo '<ul>'; |
|
76 | + foreach($png_svg_files as $filename) { |
|
77 | + $image = $group_disk_path.$filename; |
|
78 | + |
|
79 | + if (strpos($filename, "svg")){ |
|
80 | + $new_sizes['width'] = 60; |
|
81 | + $new_sizes['height'] = 60; |
|
82 | + } else { |
|
83 | + $new_sizes = api_resize_image($image, 60, 60); |
|
84 | + } |
|
85 | 85 | echo '<li style="display:inline; padding:8px;">'; |
86 | 86 | echo '<a href = "'.$group_web_path.$filename.'" alt="'.$filename.'" title="'.$filename.'">'; |
87 | 87 | echo '<img src = "'.$group_web_path.$filename.'" width = "'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
88 | - } |
|
89 | - echo '</ul>'; |
|
90 | - } |
|
88 | + } |
|
89 | + echo '</ul>'; |
|
90 | + } |
|
91 | 91 | } else { |
92 | - echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup')); |
|
92 | + echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup')); |
|
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | </body> |
@@ -23,22 +23,22 @@ discard block |
||
23 | 23 | $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array(); |
24 | 24 | |
25 | 25 | if (count($array_to_search) > 0) { |
26 | - while (list($key) = each($array_to_search)) { |
|
27 | - $all_files[] = basename($array_to_search[$key]['path']); |
|
28 | - } |
|
26 | + while (list($key) = each($array_to_search)) { |
|
27 | + $all_files[] = basename($array_to_search[$key]['path']); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | //get all svg and png files |
32 | 32 | $accepted_extensions = array('.svg', '.png'); |
33 | 33 | |
34 | 34 | if (is_array($all_files) && count($all_files) > 0) { |
35 | - foreach ($all_files as & $file) { |
|
36 | - $slideshow_extension = strrchr($file, '.'); |
|
37 | - $slideshow_extension = strtolower($slideshow_extension); |
|
38 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
39 | - $png_svg_files[] =$file; |
|
40 | - } |
|
41 | - } |
|
35 | + foreach ($all_files as & $file) { |
|
36 | + $slideshow_extension = strrchr($file, '.'); |
|
37 | + $slideshow_extension = strtolower($slideshow_extension); |
|
38 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
39 | + $png_svg_files[] =$file; |
|
40 | + } |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $disk_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images/gallery/'; |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | <?php |
58 | 58 | echo '<h2>'.get_lang('Course').': '.$course_info['name'].'</h2>'; |
59 | 59 | if (!empty($png_svg_files)) { |
60 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
61 | - echo '<ul>'; |
|
62 | - foreach($png_svg_files as $filename) { |
|
63 | - $image=$disk_path.$filename; |
|
64 | - |
|
65 | - if (strpos($filename, "svg")){ |
|
66 | - $new_sizes['width'] = 60; |
|
67 | - $new_sizes['height'] = 60; |
|
68 | - } |
|
69 | - else { |
|
70 | - $new_sizes = api_resize_image($image, 60, 60); |
|
71 | - } |
|
72 | - |
|
73 | - echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
74 | - } |
|
75 | - echo '</ul>'; |
|
60 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
61 | + echo '<ul>'; |
|
62 | + foreach($png_svg_files as $filename) { |
|
63 | + $image=$disk_path.$filename; |
|
64 | + |
|
65 | + if (strpos($filename, "svg")){ |
|
66 | + $new_sizes['width'] = 60; |
|
67 | + $new_sizes['height'] = 60; |
|
68 | + } |
|
69 | + else { |
|
70 | + $new_sizes = api_resize_image($image, 60, 60); |
|
71 | + } |
|
72 | + |
|
73 | + echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
74 | + } |
|
75 | + echo '</ul>'; |
|
76 | 76 | } else { |
77 | - Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); |
|
77 | + Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | </body> |
@@ -46,59 +46,59 @@ discard block |
||
46 | 46 | // Please, do not modify this dirname formatting |
47 | 47 | |
48 | 48 | if (strstr($dir, '..')) { |
49 | - $dir = '/'; |
|
49 | + $dir = '/'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($dir[0] == '.') { |
53 | - $dir = substr($dir, 1); |
|
53 | + $dir = substr($dir, 1); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($dir[0] != '/') { |
57 | - $dir = '/'.$dir; |
|
57 | + $dir = '/'.$dir; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($dir[strlen($dir) - 1] != '/') { |
61 | - $dir .= '/'; |
|
61 | + $dir .= '/'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
65 | 65 | |
66 | 66 | if (!is_dir($filepath)) { |
67 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
68 | - $dir = '/'; |
|
67 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
68 | + $dir = '/'; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $groupId = api_get_group_id(); |
72 | 72 | |
73 | 73 | if (!empty($groupId)) { |
74 | - $interbreadcrumb[] = array ( |
|
74 | + $interbreadcrumb[] = array ( |
|
75 | 75 | "url" => "../group/group_space.php?".api_get_cidreq(), |
76 | 76 | "name" => get_lang('GroupSpace') |
77 | 77 | ); |
78 | - $noPHP_SELF = true; |
|
79 | - $group = GroupManager :: get_group_properties($groupId); |
|
80 | - $path = explode('/', $dir); |
|
81 | - if ('/'.$path[1] != $group['directory']) { |
|
82 | - api_not_allowed(true); |
|
83 | - } |
|
78 | + $noPHP_SELF = true; |
|
79 | + $group = GroupManager :: get_group_properties($groupId); |
|
80 | + $path = explode('/', $dir); |
|
81 | + if ('/'.$path[1] != $group['directory']) { |
|
82 | + api_not_allowed(true); |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $interbreadcrumb[] = array( |
87 | - "url" => "./document.php?".api_get_cidreq(), |
|
88 | - "name" => get_lang('Documents') |
|
87 | + "url" => "./document.php?".api_get_cidreq(), |
|
88 | + "name" => get_lang('Documents') |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | if (!$is_allowed_in_course) { |
92 | - api_not_allowed(true); |
|
92 | + api_not_allowed(true); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || |
96 | - DocumentManager::is_my_shared_folder( |
|
97 | - api_get_user_id(), |
|
98 | - Security::remove_XSS($dir), |
|
99 | - api_get_session_id())) |
|
96 | + DocumentManager::is_my_shared_folder( |
|
97 | + api_get_user_id(), |
|
98 | + Security::remove_XSS($dir), |
|
99 | + api_get_session_id())) |
|
100 | 100 | ) { |
101 | - api_not_allowed(true); |
|
101 | + api_not_allowed(true); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | Event::event_access_tool(TOOL_DOCUMENT); |
107 | 107 | $display_dir = $dir; |
108 | 108 | if (isset ($group)) { |
109 | - $display_dir = explode('/', $dir); |
|
110 | - unset ($display_dir[0]); |
|
111 | - unset ($display_dir[1]); |
|
112 | - $display_dir = implode('/', $display_dir); |
|
109 | + $display_dir = explode('/', $dir); |
|
110 | + unset ($display_dir[0]); |
|
111 | + unset ($display_dir[1]); |
|
112 | + $display_dir = implode('/', $display_dir); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Interbreadcrumb for the current directory root path |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | } else { |
124 | 124 | foreach ($document_data['parents'] as $document_sub_data) { |
125 | 125 | $interbreadcrumb[] = array( |
126 | - 'url' => $document_sub_data['document_url'], |
|
127 | - 'name' => $document_sub_data['title'] |
|
128 | - ); |
|
126 | + 'url' => $document_sub_data['document_url'], |
|
127 | + 'name' => $document_sub_data['title'] |
|
128 | + ); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | Display :: display_header($nameTools, 'Doc'); |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | |
138 | 138 | if (api_browser_support('svg')) { |
139 | 139 | |
140 | - //automatic loading the course language |
|
141 | - $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
142 | - $langsvgedit = api_get_language_isocode(); |
|
143 | - $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
144 | - $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
145 | - $svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit; |
|
146 | - ?> |
|
140 | + //automatic loading the course language |
|
141 | + $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
142 | + $langsvgedit = api_get_language_isocode(); |
|
143 | + $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
144 | + $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
145 | + $svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit; |
|
146 | + ?> |
|
147 | 147 | <script> |
148 | 148 | document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'); |
149 | 149 | function resizeIframe() { |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | |
162 | 162 | <?php |
163 | 163 | echo '<noscript>'; |
164 | - echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0" src="'.$svg_url.'"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'; |
|
165 | - echo '</noscript>'; |
|
164 | + echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0" src="'.$svg_url.'"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'; |
|
165 | + echo '</noscript>'; |
|
166 | 166 | } else { |
167 | - Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
167 | + Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | Display :: display_footer(); |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |