@@ -10,29 +10,29 @@ |
||
10 | 10 | * Copyright(c) 2010 Alexis Deveria |
11 | 11 | * |
12 | 12 | */ |
13 | - // Very minimal PHP file, all we do is Base64 encode the uploaded file and |
|
14 | - // return it to the editor |
|
13 | + // Very minimal PHP file, all we do is Base64 encode the uploaded file and |
|
14 | + // return it to the editor |
|
15 | 15 | |
16 | - $type = $_REQUEST['type']; |
|
17 | - if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) { |
|
18 | - exit; |
|
19 | - } |
|
20 | - require('allowedMimeTypes.php'); |
|
16 | + $type = $_REQUEST['type']; |
|
17 | + if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) { |
|
18 | + exit; |
|
19 | + } |
|
20 | + require('allowedMimeTypes.php'); |
|
21 | 21 | |
22 | - $file = $_FILES['svg_file']['tmp_name']; |
|
22 | + $file = $_FILES['svg_file']['tmp_name']; |
|
23 | 23 | |
24 | - $output = file_get_contents($file); |
|
24 | + $output = file_get_contents($file); |
|
25 | 25 | |
26 | - $prefix = ''; |
|
26 | + $prefix = ''; |
|
27 | 27 | |
28 | - // Make Data URL prefix for import image |
|
29 | - if ($type == 'import_img') { |
|
30 | - $info = getimagesize($file); |
|
31 | - if (!in_array($info['mime'], $allowedMimeTypesBySuffix)) { |
|
32 | - exit; |
|
33 | - } |
|
34 | - $prefix = 'data:' . $info['mime'] . ';base64,'; |
|
35 | - } |
|
28 | + // Make Data URL prefix for import image |
|
29 | + if ($type == 'import_img') { |
|
30 | + $info = getimagesize($file); |
|
31 | + if (!in_array($info['mime'], $allowedMimeTypesBySuffix)) { |
|
32 | + exit; |
|
33 | + } |
|
34 | + $prefix = 'data:' . $info['mime'] . ';base64,'; |
|
35 | + } |
|
36 | 36 | ?> |
37 | 37 | <html xmlns="http://www.w3.org/1999/xhtml"> |
38 | 38 | <head> |
@@ -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> |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | */ |
11 | 11 | exit; |
12 | 12 | function encodeRFC5987ValueChars ($str) { |
13 | - // See http://tools.ietf.org/html/rfc5987#section-3.2.1 |
|
14 | - // For better readability within headers, add back the characters escaped by rawurlencode but still allowable |
|
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]); |
|
18 | - }, rawurlencode($str)); |
|
13 | + // See http://tools.ietf.org/html/rfc5987#section-3.2.1 |
|
14 | + // For better readability within headers, add back the characters escaped by rawurlencode but still allowable |
|
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]); |
|
18 | + }, rawurlencode($str)); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | require('allowedMimeTypes.php'); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $mime = !isset($_POST['mime']) || !in_array($_POST['mime'], $allowedMimeTypesBySuffix) ? 'image/svg+xml;charset=UTF-8' : $_POST['mime']; |
24 | 24 | |
25 | 25 | if (!isset($_POST['output_svg']) && !isset($_POST['output_img'])) { |
26 | - die('post fail'); |
|
26 | + die('post fail'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $file = ''; |
@@ -31,17 +31,17 @@ discard block |
||
31 | 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') { |
40 | - $contents = $_POST['output_svg']; |
|
40 | + $contents = $_POST['output_svg']; |
|
41 | 41 | } else { |
42 | - $contents = $_POST['output_img']; |
|
43 | - $pos = (strpos($contents, 'base64,') + 7); |
|
44 | - $contents = base64_decode(substr($contents, $pos)); |
|
42 | + $contents = $_POST['output_img']; |
|
43 | + $pos = (strpos($contents, 'base64,') + 7); |
|
44 | + $contents = base64_decode(substr($contents, $pos)); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | header("Cache-Control: public"); |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | // See http://tools.ietf.org/html/rfc6266#section-4.1 |
51 | 51 | header("Content-Disposition: attachment; filename*=UTF-8''" . encodeRFC5987ValueChars( |
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 | - $file |
|
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 | + $file |
|
54 | 54 | )); |
55 | 55 | header("Content-Type: " . $mime); |
56 | 56 | header("Content-Transfer-Encoding: binary"); |
@@ -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; |
@@ -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 | ?> |
@@ -8,7 +8,7 @@ |
||
8 | 8 | exit; |
9 | 9 | } |
10 | 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 |
|
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 | 13 | $fh = fopen($filename, 'w') or die("Can't open file"); |
14 | 14 | fwrite($fh, $svg); |
@@ -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> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
14 | 14 | |
15 | -$curdirpath='/images/gallery'; //path of library directory |
|
15 | +$curdirpath = '/images/gallery'; //path of library directory |
|
16 | 16 | |
17 | 17 | $course_info = api_get_course_info(); |
18 | 18 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $slideshow_extension = strrchr($file, '.'); |
37 | 37 | $slideshow_extension = strtolower($slideshow_extension); |
38 | 38 | if (in_array($slideshow_extension, $accepted_extensions)) { |
39 | - $png_svg_files[] =$file; |
|
39 | + $png_svg_files[] = $file; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $style = '<style>'; |
48 | 48 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
49 | 49 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/default.css";'; |
50 | -$style .='</style>'; |
|
50 | +$style .= '</style>'; |
|
51 | 51 | |
52 | 52 | ?> |
53 | 53 | <!doctype html> |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | if (!empty($png_svg_files)) { |
60 | 60 | echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
61 | 61 | echo '<ul>'; |
62 | - foreach($png_svg_files as $filename) { |
|
63 | - $image=$disk_path.$filename; |
|
62 | + foreach ($png_svg_files as $filename) { |
|
63 | + $image = $disk_path.$filename; |
|
64 | 64 | |
65 | - if (strpos($filename, "svg")){ |
|
65 | + if (strpos($filename, "svg")) { |
|
66 | 66 | $new_sizes['width'] = 60; |
67 | 67 | $new_sizes['height'] = 60; |
68 | 68 | } |
@@ -65,8 +65,7 @@ |
||
65 | 65 | if (strpos($filename, "svg")){ |
66 | 66 | $new_sizes['width'] = 60; |
67 | 67 | $new_sizes['height'] = 60; |
68 | - } |
|
69 | - else { |
|
68 | + } else { |
|
70 | 69 | $new_sizes = api_resize_image($image, 60, 60); |
71 | 70 | } |
72 | 71 |
@@ -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> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $slideshow_extension = strrchr($file, '.'); |
48 | 48 | $slideshow_extension = strtolower($slideshow_extension); |
49 | 49 | if (in_array($slideshow_extension, $accepted_extensions)) { |
50 | - $png_svg_files[] =$file; |
|
50 | + $png_svg_files[] = $file; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $style = '<style>'; |
56 | 56 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
57 | 57 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/default.css";'; |
58 | -$style .='</style>'; |
|
58 | +$style .= '</style>'; |
|
59 | 59 | |
60 | 60 | ?> |
61 | 61 | <!doctype html> |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | if (( |
69 | 69 | $group_properties['doc_state'] == 2 && |
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 | 73 | if (!empty($png_svg_files)) { |
74 | 74 | echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
75 | 75 | echo '<ul>'; |
76 | - foreach($png_svg_files as $filename) { |
|
76 | + foreach ($png_svg_files as $filename) { |
|
77 | 77 | $image = $group_disk_path.$filename; |
78 | 78 | |
79 | - if (strpos($filename, "svg")){ |
|
79 | + if (strpos($filename, "svg")) { |
|
80 | 80 | $new_sizes['width'] = 60; |
81 | 81 | $new_sizes['height'] = 60; |
82 | 82 | } else { |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | $accepted_extensions = array('.svg', '.png'); |
22 | 22 | |
23 | 23 | if (is_array($scan_files) && count($scan_files) > 0) { |
24 | - foreach ($scan_files as & $file) { |
|
25 | - $slideshow_extension = strrchr($file, '.'); |
|
26 | - $slideshow_extension = strtolower($slideshow_extension); |
|
27 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
28 | - $png_svg_files[] =$file; |
|
29 | - } |
|
30 | - } |
|
24 | + foreach ($scan_files as & $file) { |
|
25 | + $slideshow_extension = strrchr($file, '.'); |
|
26 | + $slideshow_extension = strtolower($slideshow_extension); |
|
27 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
28 | + $png_svg_files[] =$file; |
|
29 | + } |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | $style = '<style>'; |
33 | 33 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>'; |
47 | 47 | |
48 | 48 | if (!empty($png_svg_files)) { |
49 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
50 | - echo '<ul>'; |
|
51 | - foreach($png_svg_files as $filename) { |
|
52 | - $image = $user_disk_path.$filename; |
|
53 | - |
|
54 | - if (strpos($filename, "svg")){ |
|
55 | - $new_sizes['width'] = 60; |
|
56 | - $new_sizes['height'] = 60; |
|
57 | - } else { |
|
58 | - $new_sizes = api_resize_image($image, 60, 60); |
|
59 | - } |
|
60 | - |
|
61 | - 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>'; |
|
62 | - } |
|
63 | - echo '</ul>'; |
|
49 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
50 | + echo '<ul>'; |
|
51 | + foreach($png_svg_files as $filename) { |
|
52 | + $image = $user_disk_path.$filename; |
|
53 | + |
|
54 | + if (strpos($filename, "svg")){ |
|
55 | + $new_sizes['width'] = 60; |
|
56 | + $new_sizes['height'] = 60; |
|
57 | + } else { |
|
58 | + $new_sizes = api_resize_image($image, 60, 60); |
|
59 | + } |
|
60 | + |
|
61 | + 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>'; |
|
62 | + } |
|
63 | + echo '</ul>'; |
|
64 | 64 | } else { |
65 | - Display::display_warning_message(get_lang('NoSVGImages')); |
|
65 | + Display::display_warning_message(get_lang('NoSVGImages')); |
|
66 | 66 | } |
67 | 67 | ?> |
68 | 68 | </body> |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | $slideshow_extension = strrchr($file, '.'); |
26 | 26 | $slideshow_extension = strtolower($slideshow_extension); |
27 | 27 | if (in_array($slideshow_extension, $accepted_extensions)) { |
28 | - $png_svg_files[] =$file; |
|
28 | + $png_svg_files[] = $file; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
32 | 32 | $style = '<style>'; |
33 | 33 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
34 | 34 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/default.css";'; |
35 | -$style .='</style>'; |
|
35 | +$style .= '</style>'; |
|
36 | 36 | |
37 | 37 | ?> |
38 | 38 | <!doctype html> |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | if (!empty($png_svg_files)) { |
49 | 49 | echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
50 | 50 | echo '<ul>'; |
51 | - foreach($png_svg_files as $filename) { |
|
51 | + foreach ($png_svg_files as $filename) { |
|
52 | 52 | $image = $user_disk_path.$filename; |
53 | 53 | |
54 | - if (strpos($filename, "svg")){ |
|
54 | + if (strpos($filename, "svg")) { |
|
55 | 55 | $new_sizes['width'] = 60; |
56 | 56 | $new_sizes['height'] = 60; |
57 | 57 | } else { |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * Generates an HTML Certificate and fills the path_certificate field in the DB |
|
148 | - **/ |
|
147 | + * Generates an HTML Certificate and fills the path_certificate field in the DB |
|
148 | + **/ |
|
149 | 149 | public function generate($params = array()) |
150 | 150 | { |
151 | 151 | // The user directory should be set |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
264 | - * update user info about certificate |
|
265 | - * @param int $cat_id category id |
|
266 | - * @param int $user_id user id |
|
267 | - * @param string $path_certificate the path name of the certificate |
|
268 | - * @return void() |
|
269 | - */ |
|
264 | + * update user info about certificate |
|
265 | + * @param int $cat_id category id |
|
266 | + * @param int $user_id user id |
|
267 | + * @param string $path_certificate the path name of the certificate |
|
268 | + * @return void() |
|
269 | + */ |
|
270 | 270 | public function update_user_info_about_certificate( |
271 | 271 | $cat_id, |
272 | 272 | $user_id, |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Shows the student's certificate (HTML file). If the global setting |
|
372 | - * allow_public_certificates is set to 'false', no certificate can be printed. |
|
373 | - * If the global allow_public_certificates is set to 'true' and the course |
|
374 | - * setting allow_public_certificates is set to 0, no certificate *in this |
|
375 | - * course* can be printed (for anonymous users). Connected users can always |
|
376 | - * print them. |
|
377 | - */ |
|
371 | + * Shows the student's certificate (HTML file). If the global setting |
|
372 | + * allow_public_certificates is set to 'false', no certificate can be printed. |
|
373 | + * If the global allow_public_certificates is set to 'true' and the course |
|
374 | + * setting allow_public_certificates is set to 0, no certificate *in this |
|
375 | + * course* can be printed (for anonymous users). Connected users can always |
|
376 | + * print them. |
|
377 | + */ |
|
378 | 378 | public function show() |
379 | 379 | { |
380 | 380 | // Special rules for anonymous users |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | $scoredisplay = ScoreDisplay :: instance(); |
168 | 168 | $scorecourse = $my_category[0]->calc_score($this->user_id); |
169 | - $scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'); |
|
169 | + $scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable'); |
|
170 | 170 | |
171 | 171 | // Prepare all necessary variables: |
172 | 172 | $organization_name = api_get_setting('Institution'); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $organization_name, $stud_fn.' '.$stud_ln, $my_category[0]->get_name(), |
181 | 181 | $scorecourse_display |
182 | 182 | ); |
183 | - $certif_text = str_replace("\\n","\n", $certif_text); |
|
183 | + $certif_text = str_replace("\\n", "\n", $certif_text); |
|
184 | 184 | |
185 | 185 | //If the gradebook is related to skills we added the skills to the user |
186 | 186 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | // Creating new name |
220 | 220 | $name = md5($this->user_id.$this->certificate_data['cat_id']).'.html'; |
221 | 221 | $my_path_certificate = $this->certification_user_path.$name; |
222 | - $path_certificate ='/'.$name; |
|
222 | + $path_certificate = '/'.$name; |
|
223 | 223 | |
224 | 224 | //Getting QR filename |
225 | 225 | $file_info = pathinfo($path_certificate); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | Display::img($this->certification_web_user_path.$file_info['filename'].'_qr.png', 'QR'), |
231 | 231 | $new_content_html['content'] |
232 | 232 | ); |
233 | - $my_new_content_html = mb_convert_encoding($my_new_content_html,'UTF-8', api_get_system_encoding()); |
|
233 | + $my_new_content_html = mb_convert_encoding($my_new_content_html, 'UTF-8', api_get_system_encoding()); |
|
234 | 234 | |
235 | 235 | $result = @file_put_contents($my_path_certificate, $my_new_content_html); |
236 | 236 | if ($result) { |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | $path_certificate |
274 | 274 | ) { |
275 | 275 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
276 | - if (!UserManager::is_user_certified($cat_id,$user_id)) { |
|
277 | - $sql='UPDATE '.$table_certificate.' SET path_certificate="'.Database::escape_string($path_certificate).'" |
|
276 | + if (!UserManager::is_user_certified($cat_id, $user_id)) { |
|
277 | + $sql = 'UPDATE '.$table_certificate.' SET path_certificate="'.Database::escape_string($path_certificate).'" |
|
278 | 278 | WHERE cat_id="'.intval($cat_id).'" AND user_id="'.intval($user_id).'" '; |
279 | 279 | Database::query($sql); |
280 | 280 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | if (!empty($content)) { |
332 | 332 | foreach ($content as $key => $value) { |
333 | - $my_header = str_replace(array('((', '))') , '', $headers[$key]); |
|
333 | + $my_header = str_replace(array('((', '))'), '', $headers[$key]); |
|
334 | 334 | $final_content[$my_header] = $value; |
335 | 335 | } |
336 | 336 | } |
@@ -358,11 +358,11 @@ discard block |
||
358 | 358 | $final_content['gradebook_institution'].' - '. |
359 | 359 | $final_content['gradebook_sitename'].' - '. |
360 | 360 | get_lang('Certification').$break_space. |
361 | - get_lang('Student'). ': '.$final_content['user_firstname'].' '.$final_content['user_lastname'].$break_space. |
|
362 | - get_lang('Teacher'). ': '.$final_content['teacher_firstname'].' '.$final_content['teacher_lastname'].$break_space. |
|
363 | - get_lang('Date'). ': '.$final_content['date_certificate'].$break_space. |
|
364 | - get_lang('Score'). ': '.$final_content['gradebook_grade'].$break_space. |
|
365 | - 'URL'. ': '.$final_content['certificate_link']; |
|
361 | + get_lang('Student').': '.$final_content['user_firstname'].' '.$final_content['user_lastname'].$break_space. |
|
362 | + get_lang('Teacher').': '.$final_content['teacher_firstname'].' '.$final_content['teacher_lastname'].$break_space. |
|
363 | + get_lang('Date').': '.$final_content['date_certificate'].$break_space. |
|
364 | + get_lang('Score').': '.$final_content['gradebook_grade'].$break_space. |
|
365 | + 'URL'.': '.$final_content['certificate_link']; |
|
366 | 366 | |
367 | 367 | return $text; |
368 | 368 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if (!empty($this->certificate_data['path_certificate'])) { |
416 | 416 | $user_certificate = $this->certification_user_path.basename($this->certificate_data['path_certificate']); |
417 | 417 | if (file_exists($user_certificate)) { |
418 | - header('Content-Type: text/html; charset='. api_get_system_encoding()); |
|
418 | + header('Content-Type: text/html; charset='.api_get_system_encoding()); |
|
419 | 419 | echo @file_get_contents($user_certificate); |
420 | 420 | } |
421 | 421 | } else { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.'; |
20 | 20 | //$PHPMAILER_LANG['provide_address'] = 'You must provide at least one recipient email address.'; |
21 | 21 | $PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية ' . |
22 | - 'فشل في الارسال لكل من : '; |
|
22 | + 'فشل في الارسال لكل من : '; |
|
23 | 23 | $PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; |
24 | 24 | //$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
25 | 25 | //$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | //$PHPMAILER_LANG['invalid_email'] = 'Not sending, email address is invalid: '; |
19 | 19 | $PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.'; |
20 | 20 | //$PHPMAILER_LANG['provide_address'] = 'You must provide at least one recipient email address.'; |
21 | -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية ' . |
|
21 | +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية '. |
|
22 | 22 | 'فشل في الارسال لكل من : '; |
23 | 23 | $PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; |
24 | 24 | //$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; |
@@ -108,24 +108,24 @@ |
||
108 | 108 | */ |
109 | 109 | function utf8_sort($array) |
110 | 110 | { |
111 | - $old_locale = setlocale(LC_ALL, null); |
|
112 | - $code = api_get_language_isocode(); |
|
113 | - $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8'); |
|
114 | - $try_sort = false; |
|
111 | + $old_locale = setlocale(LC_ALL, null); |
|
112 | + $code = api_get_language_isocode(); |
|
113 | + $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8'); |
|
114 | + $try_sort = false; |
|
115 | 115 | |
116 | - foreach($locale_list as $locale) { |
|
117 | - $my_local = setlocale(LC_COLLATE, $locale); |
|
118 | - if ($my_local) { |
|
119 | - $try_sort = true; |
|
120 | - break; |
|
121 | - } |
|
122 | - } |
|
116 | + foreach($locale_list as $locale) { |
|
117 | + $my_local = setlocale(LC_COLLATE, $locale); |
|
118 | + if ($my_local) { |
|
119 | + $try_sort = true; |
|
120 | + break; |
|
121 | + } |
|
122 | + } |
|
123 | 123 | |
124 | - if ($try_sort) { |
|
125 | - uasort($array, 'strcoll'); |
|
126 | - } |
|
127 | - setlocale(LC_COLLATE, $old_locale); |
|
128 | - return $array; |
|
124 | + if ($try_sort) { |
|
125 | + uasort($array, 'strcoll'); |
|
126 | + } |
|
127 | + setlocale(LC_COLLATE, $old_locale); |
|
128 | + return $array; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | { |
111 | 111 | $old_locale = setlocale(LC_ALL, null); |
112 | 112 | $code = api_get_language_isocode(); |
113 | - $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8'); |
|
113 | + $locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8'); |
|
114 | 114 | $try_sort = false; |
115 | 115 | |
116 | - foreach($locale_list as $locale) { |
|
116 | + foreach ($locale_list as $locale) { |
|
117 | 117 | $my_local = setlocale(LC_COLLATE, $locale); |
118 | 118 | if ($my_local) { |
119 | 119 | $try_sort = true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $flatten = array(); |
152 | 152 | array_walk_recursive( |
153 | 153 | $array, |
154 | - function ($value) use (&$flatten) { |
|
154 | + function($value) use (&$flatten) { |
|
155 | 155 | $flatten[] = $value; |
156 | 156 | } |
157 | 157 | ); |