@@ -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> |
@@ -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> |
@@ -59,44 +59,44 @@ discard block |
||
59 | 59 | /* Please, do not modify this dirname formatting */ |
60 | 60 | |
61 | 61 | if (strstr($dir, '..')) { |
62 | - $dir = '/'; |
|
62 | + $dir = '/'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if ($dir[0] == '.') { |
66 | - $dir = substr($dir, 1); |
|
66 | + $dir = substr($dir, 1); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($dir[0] != '/') { |
70 | - $dir = '/'.$dir; |
|
70 | + $dir = '/'.$dir; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($dir[strlen($dir) - 1] != '/') { |
74 | - $dir .= '/'; |
|
74 | + $dir .= '/'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
78 | 78 | |
79 | 79 | if (!is_dir($filepath)) { |
80 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
81 | - $dir = '/'; |
|
80 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
81 | + $dir = '/'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | //groups //TODO:clean |
85 | 85 | if (!empty($group_id)) { |
86 | - $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace')); |
|
87 | - $group_document = true; |
|
88 | - $noPHP_SELF = true; |
|
86 | + $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace')); |
|
87 | + $group_document = true; |
|
88 | + $noPHP_SELF = true; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
92 | 92 | |
93 | 93 | if (!$is_certificate_mode) |
94 | - $interbreadcrumb[] = array( |
|
95 | - "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
|
96 | - "name" => get_lang('Documents') |
|
97 | - ); |
|
94 | + $interbreadcrumb[] = array( |
|
95 | + "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
|
96 | + "name" => get_lang('Documents') |
|
97 | + ); |
|
98 | 98 | else |
99 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
99 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
100 | 100 | |
101 | 101 | // Interbreadcrumb for the current directory root path |
102 | 102 | if (empty($document_data['parents'])) { |
@@ -111,28 +111,28 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || |
114 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
114 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
115 | 115 | |
116 | 116 | if (!$is_allowedToEdit) { |
117 | - api_not_allowed(true); |
|
117 | + api_not_allowed(true); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | Event::event_access_tool(TOOL_DOCUMENT); |
121 | 121 | |
122 | 122 | Display :: display_header($nameTools, 'Doc'); |
123 | 123 | echo '<div class="actions">'; |
124 | - echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
125 | - echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
124 | + echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
125 | + echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
126 | 126 | echo '</div>'; |
127 | 127 | |
128 | 128 | if (api_browser_support('svg')) { |
129 | - // Automatic loading the course language |
|
130 | - $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
131 | - $langsvgedit = api_get_language_isocode(); |
|
132 | - $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
133 | - $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
134 | - $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; |
|
135 | - ?> |
|
129 | + // Automatic loading the course language |
|
130 | + $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
131 | + $langsvgedit = api_get_language_isocode(); |
|
132 | + $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
133 | + $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
134 | + $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; |
|
135 | + ?> |
|
136 | 136 | <script> |
137 | 137 | 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>'); |
138 | 138 | function resizeIframe() { |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | |
151 | 151 | <?php |
152 | 152 | echo '<noscript>'; |
153 | - 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>'; |
|
154 | - echo '</noscript>'; |
|
153 | + 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>'; |
|
154 | + echo '</noscript>'; |
|
155 | 155 | } else { |
156 | - Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
156 | + Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
157 | 157 | } |
158 | 158 | Display::display_footer(); |
@@ -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 |
@@ -44,167 +44,167 @@ |
||
44 | 44 | |
45 | 45 | class PGTStorage |
46 | 46 | { |
47 | - /** |
|
48 | - * @addtogroup internalPGTStorage |
|
49 | - * @{ |
|
50 | - */ |
|
51 | - |
|
52 | - // ######################################################################## |
|
53 | - // CONSTRUCTOR |
|
54 | - // ######################################################################## |
|
47 | + /** |
|
48 | + * @addtogroup internalPGTStorage |
|
49 | + * @{ |
|
50 | + */ |
|
51 | + |
|
52 | + // ######################################################################## |
|
53 | + // CONSTRUCTOR |
|
54 | + // ######################################################################## |
|
55 | 55 | |
56 | - /** |
|
57 | - * The constructor of the class, should be called only by inherited classes. |
|
58 | - * |
|
59 | - * @param $cas_parent the CASclient instance that creates the current object. |
|
60 | - * |
|
61 | - * @protected |
|
62 | - */ |
|
63 | - function PGTStorage($cas_parent) |
|
56 | + /** |
|
57 | + * The constructor of the class, should be called only by inherited classes. |
|
58 | + * |
|
59 | + * @param $cas_parent the CASclient instance that creates the current object. |
|
60 | + * |
|
61 | + * @protected |
|
62 | + */ |
|
63 | + function PGTStorage($cas_parent) |
|
64 | 64 | { |
65 | - phpCAS::traceBegin(); |
|
66 | - if ( !$cas_parent->isProxy() ) { |
|
67 | - phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); |
|
68 | - } |
|
69 | - phpCAS::traceEnd(); |
|
65 | + phpCAS::traceBegin(); |
|
66 | + if ( !$cas_parent->isProxy() ) { |
|
67 | + phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); |
|
68 | + } |
|
69 | + phpCAS::traceEnd(); |
|
70 | 70 | } |
71 | 71 | |
72 | - // ######################################################################## |
|
73 | - // DEBUGGING |
|
74 | - // ######################################################################## |
|
72 | + // ######################################################################## |
|
73 | + // DEBUGGING |
|
74 | + // ######################################################################## |
|
75 | 75 | |
76 | - /** |
|
77 | - * This virtual method returns an informational string giving the type of storage |
|
78 | - * used by the object (used for debugging purposes). |
|
79 | - * |
|
80 | - * @public |
|
81 | - */ |
|
82 | - function getStorageType() |
|
76 | + /** |
|
77 | + * This virtual method returns an informational string giving the type of storage |
|
78 | + * used by the object (used for debugging purposes). |
|
79 | + * |
|
80 | + * @public |
|
81 | + */ |
|
82 | + function getStorageType() |
|
83 | 83 | { |
84 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
84 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
85 | 85 | } |
86 | 86 | |
87 | - /** |
|
88 | - * This virtual method returns an informational string giving informations on the |
|
89 | - * parameters of the storage.(used for debugging purposes). |
|
90 | - * |
|
91 | - * @public |
|
92 | - */ |
|
93 | - function getStorageInfo() |
|
87 | + /** |
|
88 | + * This virtual method returns an informational string giving informations on the |
|
89 | + * parameters of the storage.(used for debugging purposes). |
|
90 | + * |
|
91 | + * @public |
|
92 | + */ |
|
93 | + function getStorageInfo() |
|
94 | 94 | { |
95 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
95 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
96 | 96 | } |
97 | 97 | |
98 | - // ######################################################################## |
|
99 | - // ERROR HANDLING |
|
100 | - // ######################################################################## |
|
98 | + // ######################################################################## |
|
99 | + // ERROR HANDLING |
|
100 | + // ######################################################################## |
|
101 | 101 | |
102 | - /** |
|
103 | - * string used to store an error message. Written by PGTStorage::setErrorMessage(), |
|
104 | - * read by PGTStorage::getErrorMessage(). |
|
105 | - * |
|
106 | - * @hideinitializer |
|
107 | - * @private |
|
108 | - * @deprecated not used. |
|
109 | - */ |
|
110 | - var $_error_message=FALSE; |
|
111 | - |
|
112 | - /** |
|
113 | - * This method sets en error message, which can be read later by |
|
114 | - * PGTStorage::getErrorMessage(). |
|
115 | - * |
|
116 | - * @param $error_message an error message |
|
117 | - * |
|
118 | - * @protected |
|
119 | - * @deprecated not used. |
|
120 | - */ |
|
121 | - function setErrorMessage($error_message) |
|
102 | + /** |
|
103 | + * string used to store an error message. Written by PGTStorage::setErrorMessage(), |
|
104 | + * read by PGTStorage::getErrorMessage(). |
|
105 | + * |
|
106 | + * @hideinitializer |
|
107 | + * @private |
|
108 | + * @deprecated not used. |
|
109 | + */ |
|
110 | + var $_error_message=FALSE; |
|
111 | + |
|
112 | + /** |
|
113 | + * This method sets en error message, which can be read later by |
|
114 | + * PGTStorage::getErrorMessage(). |
|
115 | + * |
|
116 | + * @param $error_message an error message |
|
117 | + * |
|
118 | + * @protected |
|
119 | + * @deprecated not used. |
|
120 | + */ |
|
121 | + function setErrorMessage($error_message) |
|
122 | 122 | { |
123 | - $this->_error_message = $error_message; |
|
123 | + $this->_error_message = $error_message; |
|
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * This method returns an error message set by PGTStorage::setErrorMessage(). |
|
128 | - * |
|
129 | - * @return boolean error message when set by PGTStorage::setErrorMessage(), FALSE |
|
130 | - * otherwise. |
|
131 | - * |
|
132 | - * @public |
|
133 | - * @deprecated not used. |
|
134 | - */ |
|
135 | - function getErrorMessage() |
|
126 | + /** |
|
127 | + * This method returns an error message set by PGTStorage::setErrorMessage(). |
|
128 | + * |
|
129 | + * @return boolean error message when set by PGTStorage::setErrorMessage(), FALSE |
|
130 | + * otherwise. |
|
131 | + * |
|
132 | + * @public |
|
133 | + * @deprecated not used. |
|
134 | + */ |
|
135 | + function getErrorMessage() |
|
136 | 136 | { |
137 | - return $this->_error_message; |
|
137 | + return $this->_error_message; |
|
138 | 138 | } |
139 | 139 | |
140 | - // ######################################################################## |
|
141 | - // INITIALIZATION |
|
142 | - // ######################################################################## |
|
143 | - |
|
144 | - /** |
|
145 | - * a boolean telling if the storage has already been initialized. Written by |
|
146 | - * PGTStorage::init(), read by PGTStorage::isInitialized(). |
|
147 | - * |
|
148 | - * @hideinitializer |
|
149 | - * @private |
|
150 | - */ |
|
151 | - var $_initialized = FALSE; |
|
152 | - |
|
153 | - /** |
|
154 | - * This method tells if the storage has already been intialized. |
|
155 | - * |
|
156 | - * @return boolean boolean |
|
157 | - * |
|
158 | - * @protected |
|
159 | - */ |
|
160 | - function isInitialized() |
|
140 | + // ######################################################################## |
|
141 | + // INITIALIZATION |
|
142 | + // ######################################################################## |
|
143 | + |
|
144 | + /** |
|
145 | + * a boolean telling if the storage has already been initialized. Written by |
|
146 | + * PGTStorage::init(), read by PGTStorage::isInitialized(). |
|
147 | + * |
|
148 | + * @hideinitializer |
|
149 | + * @private |
|
150 | + */ |
|
151 | + var $_initialized = FALSE; |
|
152 | + |
|
153 | + /** |
|
154 | + * This method tells if the storage has already been intialized. |
|
155 | + * |
|
156 | + * @return boolean boolean |
|
157 | + * |
|
158 | + * @protected |
|
159 | + */ |
|
160 | + function isInitialized() |
|
161 | 161 | { |
162 | - return $this->_initialized; |
|
162 | + return $this->_initialized; |
|
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * This virtual method initializes the object. |
|
167 | - * |
|
168 | - * @protected |
|
169 | - */ |
|
170 | - function init() |
|
165 | + /** |
|
166 | + * This virtual method initializes the object. |
|
167 | + * |
|
168 | + * @protected |
|
169 | + */ |
|
170 | + function init() |
|
171 | 171 | { |
172 | - $this->_initialized = TRUE; |
|
172 | + $this->_initialized = TRUE; |
|
173 | 173 | } |
174 | 174 | |
175 | - // ######################################################################## |
|
176 | - // PGT I/O |
|
177 | - // ######################################################################## |
|
178 | - |
|
179 | - /** |
|
180 | - * This virtual method stores a PGT and its corresponding PGT Iuo. |
|
181 | - * @note Should never be called. |
|
182 | - * |
|
183 | - * @param $pgt the PGT |
|
184 | - * @param $pgt_iou the PGT iou |
|
185 | - * |
|
186 | - * @protected |
|
187 | - */ |
|
188 | - function write($pgt,$pgt_iou) |
|
175 | + // ######################################################################## |
|
176 | + // PGT I/O |
|
177 | + // ######################################################################## |
|
178 | + |
|
179 | + /** |
|
180 | + * This virtual method stores a PGT and its corresponding PGT Iuo. |
|
181 | + * @note Should never be called. |
|
182 | + * |
|
183 | + * @param $pgt the PGT |
|
184 | + * @param $pgt_iou the PGT iou |
|
185 | + * |
|
186 | + * @protected |
|
187 | + */ |
|
188 | + function write($pgt,$pgt_iou) |
|
189 | 189 | { |
190 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
190 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
191 | 191 | } |
192 | 192 | |
193 | - /** |
|
194 | - * This virtual method reads a PGT corresponding to a PGT Iou and deletes |
|
195 | - * the corresponding storage entry. |
|
196 | - * @note Should never be called. |
|
197 | - * |
|
198 | - * @param $pgt_iou the PGT iou |
|
199 | - * |
|
200 | - * @protected |
|
201 | - */ |
|
202 | - function read($pgt_iou) |
|
193 | + /** |
|
194 | + * This virtual method reads a PGT corresponding to a PGT Iou and deletes |
|
195 | + * the corresponding storage entry. |
|
196 | + * @note Should never be called. |
|
197 | + * |
|
198 | + * @param $pgt_iou the PGT iou |
|
199 | + * |
|
200 | + * @protected |
|
201 | + */ |
|
202 | + function read($pgt_iou) |
|
203 | 203 | { |
204 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
204 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
205 | 205 | } |
206 | 206 | |
207 | - /** @} */ |
|
207 | + /** @} */ |
|
208 | 208 | |
209 | 209 | } |
210 | 210 |
@@ -44,231 +44,231 @@ |
||
44 | 44 | |
45 | 45 | class PGTStorageFile extends PGTStorage |
46 | 46 | { |
47 | - /** |
|
48 | - * @addtogroup internalPGTStorageFile |
|
49 | - * @{ |
|
50 | - */ |
|
47 | + /** |
|
48 | + * @addtogroup internalPGTStorageFile |
|
49 | + * @{ |
|
50 | + */ |
|
51 | 51 | |
52 | - /** |
|
53 | - * a string telling where PGT's should be stored on the filesystem. Written by |
|
54 | - * PGTStorageFile::PGTStorageFile(), read by getPath(). |
|
55 | - * |
|
56 | - * @private |
|
57 | - */ |
|
58 | - var $_path; |
|
52 | + /** |
|
53 | + * a string telling where PGT's should be stored on the filesystem. Written by |
|
54 | + * PGTStorageFile::PGTStorageFile(), read by getPath(). |
|
55 | + * |
|
56 | + * @private |
|
57 | + */ |
|
58 | + var $_path; |
|
59 | 59 | |
60 | - /** |
|
61 | - * This method returns the name of the directory where PGT's should be stored |
|
62 | - * on the filesystem. |
|
63 | - * |
|
64 | - * @return the name of a directory (with leading and trailing '/') |
|
65 | - * |
|
66 | - * @private |
|
67 | - */ |
|
68 | - function getPath() |
|
60 | + /** |
|
61 | + * This method returns the name of the directory where PGT's should be stored |
|
62 | + * on the filesystem. |
|
63 | + * |
|
64 | + * @return the name of a directory (with leading and trailing '/') |
|
65 | + * |
|
66 | + * @private |
|
67 | + */ |
|
68 | + function getPath() |
|
69 | 69 | { |
70 | - return $this->_path; |
|
70 | + return $this->_path; |
|
71 | 71 | } |
72 | 72 | |
73 | - /** |
|
74 | - * a string telling the format to use to store PGT's (plain or xml). Written by |
|
75 | - * PGTStorageFile::PGTStorageFile(), read by getFormat(). |
|
76 | - * |
|
77 | - * @private |
|
78 | - */ |
|
79 | - var $_format; |
|
73 | + /** |
|
74 | + * a string telling the format to use to store PGT's (plain or xml). Written by |
|
75 | + * PGTStorageFile::PGTStorageFile(), read by getFormat(). |
|
76 | + * |
|
77 | + * @private |
|
78 | + */ |
|
79 | + var $_format; |
|
80 | 80 | |
81 | - /** |
|
82 | - * This method returns the format to use when storing PGT's on the filesystem. |
|
83 | - * |
|
84 | - * @return a string corresponding to the format used (plain or xml). |
|
85 | - * |
|
86 | - * @private |
|
87 | - */ |
|
88 | - function getFormat() |
|
81 | + /** |
|
82 | + * This method returns the format to use when storing PGT's on the filesystem. |
|
83 | + * |
|
84 | + * @return a string corresponding to the format used (plain or xml). |
|
85 | + * |
|
86 | + * @private |
|
87 | + */ |
|
88 | + function getFormat() |
|
89 | 89 | { |
90 | - return $this->_format; |
|
90 | + return $this->_format; |
|
91 | 91 | } |
92 | 92 | |
93 | - // ######################################################################## |
|
94 | - // DEBUGGING |
|
95 | - // ######################################################################## |
|
93 | + // ######################################################################## |
|
94 | + // DEBUGGING |
|
95 | + // ######################################################################## |
|
96 | 96 | |
97 | - /** |
|
98 | - * This method returns an informational string giving the type of storage |
|
99 | - * used by the object (used for debugging purposes). |
|
100 | - * |
|
101 | - * @return string informational string. |
|
102 | - * @public |
|
103 | - */ |
|
104 | - function getStorageType() |
|
97 | + /** |
|
98 | + * This method returns an informational string giving the type of storage |
|
99 | + * used by the object (used for debugging purposes). |
|
100 | + * |
|
101 | + * @return string informational string. |
|
102 | + * @public |
|
103 | + */ |
|
104 | + function getStorageType() |
|
105 | 105 | { |
106 | - return "file"; |
|
106 | + return "file"; |
|
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * This method returns an informational string giving informations on the |
|
111 | - * parameters of the storage.(used for debugging purposes). |
|
112 | - * |
|
113 | - * @return string informational string. |
|
114 | - * @public |
|
115 | - */ |
|
116 | - function getStorageInfo() |
|
109 | + /** |
|
110 | + * This method returns an informational string giving informations on the |
|
111 | + * parameters of the storage.(used for debugging purposes). |
|
112 | + * |
|
113 | + * @return string informational string. |
|
114 | + * @public |
|
115 | + */ |
|
116 | + function getStorageInfo() |
|
117 | 117 | { |
118 | - return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\''; |
|
118 | + return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\''; |
|
119 | 119 | } |
120 | 120 | |
121 | - // ######################################################################## |
|
122 | - // CONSTRUCTOR |
|
123 | - // ######################################################################## |
|
121 | + // ######################################################################## |
|
122 | + // CONSTRUCTOR |
|
123 | + // ######################################################################## |
|
124 | 124 | |
125 | - /** |
|
126 | - * The class constructor, called by CASClient::SetPGTStorageFile(). |
|
127 | - * |
|
128 | - * @param CASClient $cas_parent the CASClient instance that creates the object. |
|
129 | - * @param string $format the format used to store the PGT's (`plain' and `xml' allowed). |
|
130 | - * @param string $path the path where the PGT's should be stored |
|
131 | - * |
|
132 | - * @public |
|
133 | - */ |
|
134 | - function PGTStorageFile($cas_parent,$format,$path) |
|
125 | + /** |
|
126 | + * The class constructor, called by CASClient::SetPGTStorageFile(). |
|
127 | + * |
|
128 | + * @param CASClient $cas_parent the CASClient instance that creates the object. |
|
129 | + * @param string $format the format used to store the PGT's (`plain' and `xml' allowed). |
|
130 | + * @param string $path the path where the PGT's should be stored |
|
131 | + * |
|
132 | + * @public |
|
133 | + */ |
|
134 | + function PGTStorageFile($cas_parent,$format,$path) |
|
135 | 135 | { |
136 | - phpCAS::traceBegin(); |
|
137 | - // call the ancestor's constructor |
|
138 | - $this->PGTStorage($cas_parent); |
|
136 | + phpCAS::traceBegin(); |
|
137 | + // call the ancestor's constructor |
|
138 | + $this->PGTStorage($cas_parent); |
|
139 | 139 | |
140 | - if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; |
|
141 | - if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; |
|
140 | + if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; |
|
141 | + if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; |
|
142 | 142 | |
143 | - // check that the path is an absolute path |
|
144 | - if (getenv("OS")=="Windows_NT"){ |
|
143 | + // check that the path is an absolute path |
|
144 | + if (getenv("OS")=="Windows_NT"){ |
|
145 | 145 | |
146 | - if (!preg_match('`^[a-zA-Z]:`', $path)) { |
|
147 | - phpCAS::error('an absolute path is needed for PGT storage to file'); |
|
148 | - } |
|
146 | + if (!preg_match('`^[a-zA-Z]:`', $path)) { |
|
147 | + phpCAS::error('an absolute path is needed for PGT storage to file'); |
|
148 | + } |
|
149 | 149 | |
150 | - } |
|
151 | - else |
|
152 | - { |
|
150 | + } |
|
151 | + else |
|
152 | + { |
|
153 | 153 | |
154 | - if ( $path[0] != '/' ) { |
|
155 | - phpCAS::error('an absolute path is needed for PGT storage to file'); |
|
156 | - } |
|
154 | + if ( $path[0] != '/' ) { |
|
155 | + phpCAS::error('an absolute path is needed for PGT storage to file'); |
|
156 | + } |
|
157 | 157 | |
158 | - // store the path (with a leading and trailing '/') |
|
159 | - $path = preg_replace('|[/]*$|','/',$path); |
|
160 | - $path = preg_replace('|^[/]*|','/',$path); |
|
161 | - } |
|
158 | + // store the path (with a leading and trailing '/') |
|
159 | + $path = preg_replace('|[/]*$|','/',$path); |
|
160 | + $path = preg_replace('|^[/]*|','/',$path); |
|
161 | + } |
|
162 | 162 | |
163 | - $this->_path = $path; |
|
164 | - // check the format and store it |
|
165 | - switch ($format) { |
|
166 | - case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN: |
|
163 | + $this->_path = $path; |
|
164 | + // check the format and store it |
|
165 | + switch ($format) { |
|
166 | + case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN: |
|
167 | 167 | case CAS_PGT_STORAGE_FILE_FORMAT_XML: |
168 | - $this->_format = $format; |
|
169 | - break; |
|
170 | - default: |
|
171 | - phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)'); |
|
172 | - } |
|
173 | - phpCAS::traceEnd(); |
|
168 | + $this->_format = $format; |
|
169 | + break; |
|
170 | + default: |
|
171 | + phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)'); |
|
172 | + } |
|
173 | + phpCAS::traceEnd(); |
|
174 | 174 | } |
175 | 175 | |
176 | - // ######################################################################## |
|
177 | - // INITIALIZATION |
|
178 | - // ######################################################################## |
|
176 | + // ######################################################################## |
|
177 | + // INITIALIZATION |
|
178 | + // ######################################################################## |
|
179 | 179 | |
180 | - /** |
|
181 | - * This method is used to initialize the storage. Halts on error. |
|
182 | - * |
|
183 | - * @public |
|
184 | - */ |
|
185 | - function init() |
|
180 | + /** |
|
181 | + * This method is used to initialize the storage. Halts on error. |
|
182 | + * |
|
183 | + * @public |
|
184 | + */ |
|
185 | + function init() |
|
186 | 186 | { |
187 | - phpCAS::traceBegin(); |
|
188 | - // if the storage has already been initialized, return immediatly |
|
189 | - if ( $this->isInitialized() ) |
|
190 | - return; |
|
191 | - // call the ancestor's method (mark as initialized) |
|
192 | - parent::init(); |
|
193 | - phpCAS::traceEnd(); |
|
187 | + phpCAS::traceBegin(); |
|
188 | + // if the storage has already been initialized, return immediatly |
|
189 | + if ( $this->isInitialized() ) |
|
190 | + return; |
|
191 | + // call the ancestor's method (mark as initialized) |
|
192 | + parent::init(); |
|
193 | + phpCAS::traceEnd(); |
|
194 | 194 | } |
195 | 195 | |
196 | - // ######################################################################## |
|
197 | - // PGT I/O |
|
198 | - // ######################################################################## |
|
196 | + // ######################################################################## |
|
197 | + // PGT I/O |
|
198 | + // ######################################################################## |
|
199 | 199 | |
200 | - /** |
|
201 | - * This method returns the filename corresponding to a PGT Iou. |
|
202 | - * |
|
203 | - * @param $pgt_iou the PGT iou. |
|
204 | - * |
|
205 | - * @return string filename |
|
206 | - * @private |
|
207 | - */ |
|
208 | - function getPGTIouFilename($pgt_iou) |
|
200 | + /** |
|
201 | + * This method returns the filename corresponding to a PGT Iou. |
|
202 | + * |
|
203 | + * @param $pgt_iou the PGT iou. |
|
204 | + * |
|
205 | + * @return string filename |
|
206 | + * @private |
|
207 | + */ |
|
208 | + function getPGTIouFilename($pgt_iou) |
|
209 | 209 | { |
210 | - phpCAS::traceBegin(); |
|
211 | - $filename = $this->getPath().$pgt_iou.'.'.$this->getFormat(); |
|
212 | - phpCAS::traceEnd($filename); |
|
213 | - return $filename; |
|
210 | + phpCAS::traceBegin(); |
|
211 | + $filename = $this->getPath().$pgt_iou.'.'.$this->getFormat(); |
|
212 | + phpCAS::traceEnd($filename); |
|
213 | + return $filename; |
|
214 | 214 | } |
215 | 215 | |
216 | - /** |
|
217 | - * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a |
|
218 | - * warning on error. |
|
219 | - * |
|
220 | - * @param $pgt the PGT |
|
221 | - * @param $pgt_iou the PGT iou |
|
222 | - * |
|
223 | - * @public |
|
224 | - */ |
|
225 | - function write($pgt,$pgt_iou) |
|
216 | + /** |
|
217 | + * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a |
|
218 | + * warning on error. |
|
219 | + * |
|
220 | + * @param $pgt the PGT |
|
221 | + * @param $pgt_iou the PGT iou |
|
222 | + * |
|
223 | + * @public |
|
224 | + */ |
|
225 | + function write($pgt,$pgt_iou) |
|
226 | 226 | { |
227 | - phpCAS::traceBegin(); |
|
228 | - $fname = $this->getPGTIouFilename($pgt_iou); |
|
229 | - if ( $f=fopen($fname,"w") ) { |
|
230 | - if ( fputs($f,$pgt) === FALSE ) { |
|
231 | - phpCAS::error('could not write PGT to `'.$fname.'\''); |
|
232 | - } |
|
233 | - fclose($f); |
|
234 | - } else { |
|
235 | - phpCAS::error('could not open `'.$fname.'\''); |
|
236 | - } |
|
237 | - phpCAS::traceEnd(); |
|
227 | + phpCAS::traceBegin(); |
|
228 | + $fname = $this->getPGTIouFilename($pgt_iou); |
|
229 | + if ( $f=fopen($fname,"w") ) { |
|
230 | + if ( fputs($f,$pgt) === FALSE ) { |
|
231 | + phpCAS::error('could not write PGT to `'.$fname.'\''); |
|
232 | + } |
|
233 | + fclose($f); |
|
234 | + } else { |
|
235 | + phpCAS::error('could not open `'.$fname.'\''); |
|
236 | + } |
|
237 | + phpCAS::traceEnd(); |
|
238 | 238 | } |
239 | 239 | |
240 | - /** |
|
241 | - * This method reads a PGT corresponding to a PGT Iou and deletes the |
|
242 | - * corresponding file. |
|
243 | - * |
|
244 | - * @param $pgt_iou the PGT iou |
|
245 | - * |
|
246 | - * @return false|string corresponding PGT, or FALSE on error |
|
247 | - * |
|
248 | - * @public |
|
249 | - */ |
|
250 | - function read($pgt_iou) |
|
240 | + /** |
|
241 | + * This method reads a PGT corresponding to a PGT Iou and deletes the |
|
242 | + * corresponding file. |
|
243 | + * |
|
244 | + * @param $pgt_iou the PGT iou |
|
245 | + * |
|
246 | + * @return false|string corresponding PGT, or FALSE on error |
|
247 | + * |
|
248 | + * @public |
|
249 | + */ |
|
250 | + function read($pgt_iou) |
|
251 | 251 | { |
252 | - phpCAS::traceBegin(); |
|
253 | - $pgt = FALSE; |
|
254 | - $fname = $this->getPGTIouFilename($pgt_iou); |
|
255 | - if ( !($f=fopen($fname,"r")) ) { |
|
256 | - phpCAS::trace('could not open `'.$fname.'\''); |
|
257 | - } else { |
|
258 | - if ( ($pgt=fgets($f)) === FALSE ) { |
|
259 | - phpCAS::trace('could not read PGT from `'.$fname.'\''); |
|
260 | - } |
|
261 | - fclose($f); |
|
262 | - } |
|
252 | + phpCAS::traceBegin(); |
|
253 | + $pgt = FALSE; |
|
254 | + $fname = $this->getPGTIouFilename($pgt_iou); |
|
255 | + if ( !($f=fopen($fname,"r")) ) { |
|
256 | + phpCAS::trace('could not open `'.$fname.'\''); |
|
257 | + } else { |
|
258 | + if ( ($pgt=fgets($f)) === FALSE ) { |
|
259 | + phpCAS::trace('could not read PGT from `'.$fname.'\''); |
|
260 | + } |
|
261 | + fclose($f); |
|
262 | + } |
|
263 | 263 | |
264 | - // delete the PGT file |
|
265 | - @unlink($fname); |
|
264 | + // delete the PGT file |
|
265 | + @unlink($fname); |
|
266 | 266 | |
267 | - phpCAS::traceEnd($pgt); |
|
268 | - return $pgt; |
|
267 | + phpCAS::traceEnd($pgt); |
|
268 | + return $pgt; |
|
269 | 269 | } |
270 | 270 | |
271 | - /** @} */ |
|
271 | + /** @} */ |
|
272 | 272 | |
273 | 273 | } |
274 | 274 |