@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function path($name = '') |
37 | 37 | { |
38 | - return api_get_path(SYS_PATH) . 'custompages/' . $name; |
|
38 | + return api_get_path(SYS_PATH).'custompages/'.$name; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $file = self::path($page_name . '.php'); |
|
53 | + $file = self::path($page_name.'.php'); |
|
54 | 54 | if (file_exists($file)) { |
55 | 55 | include($file); |
56 | 56 | exit; |
57 | 57 | } else { |
58 | - error_log('CustomPages::displayPage : could not read file ' . $file); |
|
58 | + error_log('CustomPages::displayPage : could not read file '.$file); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | public static function getURLImages($url_id = null) |
70 | 70 | { |
71 | 71 | if (is_null($url_id)) { |
72 | - $url = 'http://' . $_SERVER['HTTP_HOST'] . '/'; |
|
72 | + $url = 'http://'.$_SERVER['HTTP_HOST'].'/'; |
|
73 | 73 | $url_id = UrlManager::get_url_id($url); |
74 | 74 | } |
75 | - $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/'; |
|
75 | + $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/'; |
|
76 | 76 | $images = array(); |
77 | 77 | for ($img_id = 1; $img_id <= 3; $img_id++) { |
78 | - if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) { |
|
79 | - $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png'; |
|
78 | + if (file_exists($url_images_dir.$url_id.'_url_image_'.$img_id.'.png')) { |
|
79 | + $images[] = api_get_path(WEB_PATH).'custompages/url-images/'.$url_id.'_url_image_'.$img_id.'.png'; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $newMessageText = ''; |
356 | 356 | $linkToNewMessage = Display::url( |
357 | 357 | get_lang('SeeMessage'), |
358 | - api_get_path(WEB_CODE_PATH) . 'messages/inbox.php' |
|
358 | + api_get_path(WEB_CODE_PATH).'messages/inbox.php' |
|
359 | 359 | ); |
360 | 360 | break; |
361 | 361 | case self::NOTIFICATION_TYPE_MESSAGE: |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | } |
371 | 371 | $linkToNewMessage = Display::url( |
372 | 372 | get_lang('SeeMessage'), |
373 | - api_get_path(WEB_CODE_PATH) . 'messages/inbox.php' |
|
373 | + api_get_path(WEB_CODE_PATH).'messages/inbox.php' |
|
374 | 374 | ); |
375 | 375 | break; |
376 | 376 | case self::NOTIFICATION_TYPE_INVITATION: |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | $linkToNewMessage = Display::url( |
387 | 387 | get_lang('SeeInvitation'), |
388 | - api_get_path(WEB_CODE_PATH) . 'social/invitations.php' |
|
388 | + api_get_path(WEB_CODE_PATH).'social/invitations.php' |
|
389 | 389 | ); |
390 | 390 | break; |
391 | 391 | case self::NOTIFICATION_TYPE_GROUP: |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | self::navigate($url); |
35 | 35 | } |
36 | 36 | |
37 | - $url = self::www() . $url; |
|
37 | + $url = self::www().$url; |
|
38 | 38 | self::navigate($url); |
39 | 39 | } |
40 | 40 | |
@@ -67,25 +67,25 @@ discard block |
||
67 | 67 | case COURSEMANAGER: |
68 | 68 | $redir = api_get_setting('teacher_page_after_login'); |
69 | 69 | if (!empty($redir)) { |
70 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
70 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
71 | 71 | } |
72 | 72 | break; |
73 | 73 | case STUDENT: |
74 | 74 | $redir = api_get_setting('student_page_after_login'); |
75 | 75 | if (!empty($redir)) { |
76 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
76 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
77 | 77 | } |
78 | 78 | break; |
79 | 79 | case DRH: |
80 | 80 | $redir = api_get_setting('drh_page_after_login'); |
81 | 81 | if (!empty($redir)) { |
82 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
82 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
83 | 83 | } |
84 | 84 | break; |
85 | 85 | case SESSIONADMIN: |
86 | 86 | $redir = api_get_setting('sessionadmin_page_after_login'); |
87 | 87 | if (!empty($redir)) { |
88 | - self::navigate(api_get_path(WEB_PATH) . $redir); |
|
88 | + self::navigate(api_get_path(WEB_PATH).$redir); |
|
89 | 89 | } |
90 | 90 | break; |
91 | 91 | default: |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | $page_after_login = api_get_setting('page_after_login'); |
113 | 113 | if (!empty($page_after_login)) { |
114 | - self::navigate(api_get_path(WEB_PATH) . $page_after_login); |
|
114 | + self::navigate(api_get_path(WEB_PATH).$page_after_login); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $c_id = $c_id ? intval($c_id) : api_get_course_int_id(); |
59 | - $table = Database::get_course_table(TABLE_TOOL_LIST); |
|
59 | + $table = Database::get_course_table(TABLE_TOOL_LIST); |
|
60 | 60 | $sql = "SELECT * from $table |
61 | 61 | WHERE c_id = $c_id and name='$name' |
62 | 62 | LIMIT 1"; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $clean_gradebook = array(); |
114 | 114 | |
115 | 115 | if (!empty($skill_gradebooks_source)) { |
116 | - foreach($skill_gradebooks_source as $source) { |
|
116 | + foreach ($skill_gradebooks_source as $source) { |
|
117 | 117 | $clean_gradebook[] = $source['skill_id']; |
118 | 118 | } |
119 | 119 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $selected_skills = self::get_skills_by_gradebook($gradebook_id); |
193 | 193 | $clean_selected_skills = array(); |
194 | 194 | if (!empty($selected_skills)) { |
195 | - foreach($selected_skills as $skill) { |
|
195 | + foreach ($selected_skills as $skill) { |
|
196 | 196 | $clean_selected_skills[] = $skill['id']; |
197 | 197 | } |
198 | 198 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public static function getUTCDateTimeTypeClass() |
117 | 117 | { |
118 | - return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : |
|
119 | - 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
118 | + return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
120 | 119 | } |
121 | 120 | |
122 | 121 | /** |
@@ -393,7 +392,7 @@ discard block |
||
393 | 392 | |
394 | 393 | if (!empty($params)) { |
395 | 394 | $sql = 'INSERT INTO '.$table_name.' ('.implode(',', $params).') |
396 | - VALUES (:'.implode(', :' ,$params).')'; |
|
395 | + VALUES (:'.implode(', :', $params).')'; |
|
397 | 396 | |
398 | 397 | $statement = self::getManager()->getConnection()->prepare($sql); |
399 | 398 | $result = $statement->execute($attributes); |
@@ -434,7 +433,7 @@ discard block |
||
434 | 433 | foreach ($attributes as $key => $value) { |
435 | 434 | $update_sql .= "$key = :$key "; |
436 | 435 | if ($count < count($attributes)) { |
437 | - $update_sql.=', '; |
|
436 | + $update_sql .= ', '; |
|
438 | 437 | } |
439 | 438 | $count++; |
440 | 439 | } |
@@ -481,7 +480,7 @@ discard block |
||
481 | 480 | if ($columns == '*') { |
482 | 481 | $clean_columns = '*'; |
483 | 482 | } else { |
484 | - $clean_columns = (string)$columns; |
|
483 | + $clean_columns = (string) $columns; |
|
485 | 484 | } |
486 | 485 | } |
487 | 486 | |
@@ -527,9 +526,9 @@ discard block |
||
527 | 526 | foreach ($condition_data as $condition => $value_array) { |
528 | 527 | if (is_array($value_array)) { |
529 | 528 | $clean_values = array(); |
530 | - foreach($value_array as $item) { |
|
529 | + foreach ($value_array as $item) { |
|
531 | 530 | $item = Database::escape_string($item); |
532 | - $clean_values[]= $item; |
|
531 | + $clean_values[] = $item; |
|
533 | 532 | } |
534 | 533 | } else { |
535 | 534 | $value_array = Database::escape_string($value_array); |
@@ -537,23 +536,23 @@ discard block |
||
537 | 536 | } |
538 | 537 | |
539 | 538 | if (!empty($condition) && $clean_values != '') { |
540 | - $condition = str_replace('%',"'@percentage@'", $condition); //replace "%" |
|
541 | - $condition = str_replace("'?'","%s", $condition); |
|
542 | - $condition = str_replace("?","%s", $condition); |
|
539 | + $condition = str_replace('%', "'@percentage@'", $condition); //replace "%" |
|
540 | + $condition = str_replace("'?'", "%s", $condition); |
|
541 | + $condition = str_replace("?", "%s", $condition); |
|
543 | 542 | |
544 | - $condition = str_replace("@%s@","@-@", $condition); |
|
545 | - $condition = str_replace("%s","'%s'", $condition); |
|
546 | - $condition = str_replace("@-@","@%s@", $condition); |
|
543 | + $condition = str_replace("@%s@", "@-@", $condition); |
|
544 | + $condition = str_replace("%s", "'%s'", $condition); |
|
545 | + $condition = str_replace("@-@", "@%s@", $condition); |
|
547 | 546 | |
548 | 547 | // Treat conditions as string |
549 | 548 | $condition = vsprintf($condition, $clean_values); |
550 | - $condition = str_replace('@percentage@','%', $condition); //replace "%" |
|
549 | + $condition = str_replace('@percentage@', '%', $condition); //replace "%" |
|
551 | 550 | $where_return .= $condition; |
552 | 551 | } |
553 | 552 | } |
554 | 553 | |
555 | 554 | if (!empty($where_return)) { |
556 | - $return_value = " WHERE $where_return" ; |
|
555 | + $return_value = " WHERE $where_return"; |
|
557 | 556 | } |
558 | 557 | break; |
559 | 558 | case 'order': |
@@ -565,7 +564,7 @@ discard block |
||
565 | 564 | $new_order_array = explode(',', $order_array); |
566 | 565 | $temp_value = array(); |
567 | 566 | |
568 | - foreach($new_order_array as $element) { |
|
567 | + foreach ($new_order_array as $element) { |
|
569 | 568 | $element = explode(' ', $element); |
570 | 569 | $element = array_filter($element); |
571 | 570 | $element = array_values($element); |
@@ -576,10 +575,10 @@ discard block |
||
576 | 575 | if (in_array($element[1], array('desc', 'asc'))) { |
577 | 576 | $order = $element[1]; |
578 | 577 | } |
579 | - $temp_value[]= $element[0].' '.$order.' '; |
|
578 | + $temp_value[] = $element[0].' '.$order.' '; |
|
580 | 579 | } else { |
581 | 580 | //by default DESC |
582 | - $temp_value[]= $element[0].' DESC '; |
|
581 | + $temp_value[] = $element[0].' DESC '; |
|
583 | 582 | } |
584 | 583 | } |
585 | 584 | if (!empty($temp_value)) { |
@@ -594,7 +593,7 @@ discard block |
||
594 | 593 | if (!empty($limit_array)) { |
595 | 594 | if (count($limit_array) > 1) { |
596 | 595 | $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]); |
597 | - } else { |
|
596 | + } else { |
|
598 | 597 | $return_value .= ' LIMIT '.intval($limit_array[0]); |
599 | 598 | } |
600 | 599 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @since 25/september/2010 |
6 | 6 | */ |
7 | 7 | |
8 | -require_once '../../../inc/global.inc.php';//hack for Chamilo |
|
8 | +require_once '../../../inc/global.inc.php'; //hack for Chamilo |
|
9 | 9 | api_protect_course_script(); |
10 | 10 | api_block_anonymous_users(); |
11 | 11 | if (!isset($_SESSION['draw_dir'])) { |
@@ -19,21 +19,21 @@ discard block |
||
19 | 19 | api_protect_course_script(); |
20 | 20 | api_block_anonymous_users(); |
21 | 21 | |
22 | -if(!isset($_POST['output_svg']) && !isset($_POST['output_png'])) { |
|
23 | - api_not_allowed();//from Chamilo |
|
22 | +if (!isset($_POST['output_svg']) && !isset($_POST['output_png'])) { |
|
23 | + api_not_allowed(); //from Chamilo |
|
24 | 24 | die(); |
25 | 25 | } |
26 | 26 | |
27 | 27 | $file = ''; |
28 | -$suffix = isset($_POST['output_svg'])?'svg':'png'; |
|
28 | +$suffix = isset($_POST['output_svg']) ? 'svg' : 'png'; |
|
29 | 29 | |
30 | -if(isset($_POST['filename']) && strlen($_POST['filename']) > 0) { |
|
30 | +if (isset($_POST['filename']) && strlen($_POST['filename']) > 0) { |
|
31 | 31 | $file = $_POST['filename']; |
32 | 32 | } else { |
33 | 33 | $file = 'image'; |
34 | 34 | } |
35 | 35 | |
36 | -if($suffix == 'svg') { |
|
36 | +if ($suffix == 'svg') { |
|
37 | 37 | $mime = 'image/svg+xml'; |
38 | 38 | $contents = rawurldecode($_POST['output_svg']); |
39 | 39 | } else { |
@@ -44,25 +44,25 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | //get SVG-Edit values |
47 | -$filename=$file;//from svg-edit |
|
48 | -$extension=$suffix;// from svg-edit |
|
49 | -$content=$contents;//from svg-edit |
|
47 | +$filename = $file; //from svg-edit |
|
48 | +$extension = $suffix; // from svg-edit |
|
49 | +$content = $contents; //from svg-edit |
|
50 | 50 | |
51 | -$title = Database::escape_string(str_replace('_',' ',$filename)); |
|
51 | +$title = Database::escape_string(str_replace('_', ' ', $filename)); |
|
52 | 52 | |
53 | 53 | //get Chamilo variables |
54 | 54 | |
55 | -if(!isset($_SESSION['draw_dir']) && !isset($_SESSION['whereami'])) { |
|
56 | - api_not_allowed();//from Chamilo |
|
55 | +if (!isset($_SESSION['draw_dir']) && !isset($_SESSION['whereami'])) { |
|
56 | + api_not_allowed(); //from Chamilo |
|
57 | 57 | die(); |
58 | 58 | } |
59 | 59 | |
60 | 60 | $current_session_id = api_get_session_id(); |
61 | -$groupId = api_get_group_id(); |
|
62 | -$relativeUrlPath=$_SESSION['draw_dir']; |
|
63 | -$currentTool=$_SESSION['whereami']; |
|
61 | +$groupId = api_get_group_id(); |
|
62 | +$relativeUrlPath = $_SESSION['draw_dir']; |
|
63 | +$currentTool = $_SESSION['whereami']; |
|
64 | 64 | $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
65 | -$saveDir=$dirBaseDocuments.$_SESSION['draw_dir']; |
|
65 | +$saveDir = $dirBaseDocuments.$_SESSION['draw_dir']; |
|
66 | 66 | |
67 | 67 | //a bit title security |
68 | 68 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | |
97 | 97 | //checks if the file exists, then rename the new |
98 | -if (file_exists($saveDir.'/'.$filename.$i.'.'.$extension) && $currentTool=='document/createdraw') { |
|
98 | +if (file_exists($saveDir.'/'.$filename.$i.'.'.$extension) && $currentTool == 'document/createdraw') { |
|
99 | 99 | $message = get_lang('FileExistsChangeToSave'); |
100 | 100 | $params = array( |
101 | 101 | 'message' => $message, |
@@ -111,21 +111,21 @@ discard block |
||
111 | 111 | $documentPath = $saveDir.'/'.$drawFileName; |
112 | 112 | |
113 | 113 | //add new document to disk |
114 | -file_put_contents( $documentPath, $contents ); |
|
114 | +file_put_contents($documentPath, $contents); |
|
115 | 115 | |
116 | -if ($currentTool=='document/createdraw') { |
|
116 | +if ($currentTool == 'document/createdraw') { |
|
117 | 117 | //add document to database |
118 | 118 | $doc_id = add_document($_course, $relativeUrlPath.'/'.$drawFileName, 'file', filesize($documentPath), $title); |
119 | 119 | api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id); |
120 | 120 | |
121 | -} elseif($currentTool=='document/editdraw') { |
|
121 | +} elseif ($currentTool == 'document/editdraw') { |
|
122 | 122 | |
123 | 123 | //check path |
124 | - if (!isset($_SESSION['draw_file'])){ |
|
125 | - api_not_allowed();//from Chamilo |
|
124 | + if (!isset($_SESSION['draw_file'])) { |
|
125 | + api_not_allowed(); //from Chamilo |
|
126 | 126 | die(); |
127 | 127 | } |
128 | - if ($_SESSION['draw_file'] == $drawFileName ){ |
|
128 | + if ($_SESSION['draw_file'] == $drawFileName) { |
|
129 | 129 | $document_id = DocumentManager::get_document_id($_course, $relativeUrlPath.'/'.$drawFileName); |
130 | 130 | update_existing_document($_course, $document_id, filesize($documentPath), null); |
131 | 131 | api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $_user['user_id'], $groupId, null, null, null, $current_session_id); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if (!in_array($info['mime'], $allowedMimeTypesBySuffix)) { |
32 | 32 | exit; |
33 | 33 | } |
34 | - $prefix = 'data:' . $info['mime'] . ';base64,'; |
|
34 | + $prefix = 'data:'.$info['mime'].';base64,'; |
|
35 | 35 | } |
36 | 36 | ?> |
37 | 37 | <html xmlns="http://www.w3.org/1999/xhtml"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | top.svgEditor.processFile("<?php |
43 | 43 | |
44 | 44 | // This should be safe since SVG edit does its own filtering (e.g., if an SVG file contains scripts) |
45 | -echo $prefix . base64_encode($output); |
|
45 | +echo $prefix.base64_encode($output); |
|
46 | 46 | |
47 | 47 | ?>", "<?php echo $type; ?>"); |
48 | 48 | </script> |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | * |
10 | 10 | */ |
11 | 11 | exit; |
12 | -function encodeRFC5987ValueChars ($str) { |
|
12 | +function encodeRFC5987ValueChars($str) { |
|
13 | 13 | // See http://tools.ietf.org/html/rfc5987#section-3.2.1 |
14 | 14 | // For better readability within headers, add back the characters escaped by rawurlencode but still allowable |
15 | 15 | // Although RFC3986 reserves "!" (%21), RFC5987 does not |
16 | - return preg_replace_callback('@%(2[1346B]|5E|60|7C)@', function ($matches) { |
|
17 | - return chr('0x' . $matches[1]); |
|
16 | + return preg_replace_callback('@%(2[1346B]|5E|60|7C)@', function($matches) { |
|
17 | + return chr('0x'.$matches[1]); |
|
18 | 18 | }, rawurlencode($str)); |
19 | 19 | } |
20 | 20 | |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | |
29 | 29 | $file = ''; |
30 | 30 | |
31 | -$suffix = '.' . array_search($mime, $allowedMimeTypesBySuffix); |
|
31 | +$suffix = '.'.array_search($mime, $allowedMimeTypesBySuffix); |
|
32 | 32 | |
33 | 33 | if (isset($_POST['filename']) && strlen($_POST['filename']) > 0) { |
34 | - $file = $_POST['filename'] . $suffix; |
|
34 | + $file = $_POST['filename'].$suffix; |
|
35 | 35 | } else { |
36 | - $file = 'image' . $suffix; |
|
36 | + $file = 'image'.$suffix; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if ($suffix == '.svg') { |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | header("Content-Description: File Transfer"); |
49 | 49 | |
50 | 50 | // See http://tools.ietf.org/html/rfc6266#section-4.1 |
51 | -header("Content-Disposition: attachment; filename*=UTF-8''" . encodeRFC5987ValueChars( |
|
51 | +header("Content-Disposition: attachment; filename*=UTF-8''".encodeRFC5987ValueChars( |
|
52 | 52 | // preg_replace('@[\\\\/:*?"<>|]@', '', $file) // If we wanted to strip Windows-disallowed characters server-side (but not a security issue, so we can strip client-side instead) |
53 | 53 | $file |
54 | 54 | )); |
55 | -header("Content-Type: " . $mime); |
|
55 | +header("Content-Type: ".$mime); |
|
56 | 56 | header("Content-Transfer-Encoding: binary"); |
57 | 57 | |
58 | 58 | echo $contents; |