@@ -167,9 +167,9 @@ |
||
167 | 167 | // possible : number_groups_left > 0 and is group member |
168 | 168 | $possible_users = array(); |
169 | 169 | foreach ($complete_user_list as $index => $user) { |
170 | - if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) { |
|
170 | + if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) { |
|
171 | 171 | $possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; |
172 | - } |
|
172 | + } |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $group_members_element = $form->addElement( |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'. |
45 | 45 | get_lang('No').'</a> <a class="btn btn-danger" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'. |
46 | 46 | get_lang('Yes').'</a></p>'; |
47 | - $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); |
|
47 | + $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $tpl = new Template($tool_name); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | //path for svg-edit save |
47 | 47 | $_SESSION['draw_dir'] = Security::remove_XSS($dir); |
48 | 48 | if ($_SESSION['draw_dir'] == '/') { |
49 | - $_SESSION['draw_dir'] = ''; |
|
49 | + $_SESSION['draw_dir'] = ''; |
|
50 | 50 | } |
51 | 51 | $_SESSION['draw_file'] = basename(Security::remove_XSS($file_path)); |
52 | 52 | $get_file = Security::remove_XSS($file_path); |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | /* Please, do not modify this dirname formatting */ |
63 | 63 | |
64 | 64 | if (strstr($dir, '..')) { |
65 | - $dir = '/'; |
|
65 | + $dir = '/'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | if ($dir[0] == '.') { |
69 | - $dir = substr($dir, 1); |
|
69 | + $dir = substr($dir, 1); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($dir[0] != '/') { |
73 | - $dir = '/'.$dir; |
|
73 | + $dir = '/'.$dir; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if ($dir[strlen($dir) - 1] != '/') { |
77 | - $dir .= '/'; |
|
77 | + $dir .= '/'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
81 | 81 | |
82 | 82 | if (!is_dir($filepath)) { |
83 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
84 | - $dir = '/'; |
|
83 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
84 | + $dir = '/'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | //groups //TODO:clean |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
91 | 91 | 'name' => get_lang('GroupSpace'), |
92 | 92 | ); |
93 | - $group_document = true; |
|
94 | - $noPHP_SELF = true; |
|
93 | + $group_document = true; |
|
94 | + $noPHP_SELF = true; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights || |
120 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
120 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
121 | 121 | |
122 | 122 | if (!$is_allowedToEdit) { |
123 | - api_not_allowed(true); |
|
123 | + api_not_allowed(true); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | Event::event_access_tool(TOOL_DOCUMENT); |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | echo '</div>'; |
135 | 135 | |
136 | 136 | if (api_browser_support('svg')) { |
137 | - //automatic loading the course language |
|
138 | - $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
139 | - $langsvgedit = api_get_language_isocode(); |
|
140 | - $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
141 | - $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
142 | - $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; |
|
143 | - ?> |
|
137 | + //automatic loading the course language |
|
138 | + $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
139 | + $langsvgedit = api_get_language_isocode(); |
|
140 | + $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
141 | + $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
142 | + $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; |
|
143 | + ?> |
|
144 | 144 | <script> |
145 | 145 | 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>'); |
146 | 146 | function resizeIframe() { |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | |
159 | 159 | <?php |
160 | 160 | echo '<noscript>'; |
161 | - 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>'; |
|
162 | - echo '</noscript>'; |
|
161 | + 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>'; |
|
162 | + echo '</noscript>'; |
|
163 | 163 | } else { |
164 | - Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
164 | + Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
165 | 165 | } |
166 | 166 | Display::display_footer(); |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | |
23 | 23 | $document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id(), true); |
24 | 24 | if (empty($document_data)) { |
25 | - if (api_is_in_group()) { |
|
26 | - $group_properties = GroupManager::get_group_properties(api_get_group_id()); |
|
27 | - $document_id = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']); |
|
28 | - $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id()); |
|
29 | - } |
|
25 | + if (api_is_in_group()) { |
|
26 | + $group_properties = GroupManager::get_group_properties(api_get_group_id()); |
|
27 | + $document_id = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']); |
|
28 | + $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id()); |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $document_id = $document_data['id']; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //make some vars |
36 | 36 | $wamidir = $dir; |
37 | 37 | if ($wamidir == "/") { |
38 | - $wamidir = ""; |
|
38 | + $wamidir = ""; |
|
39 | 39 | } |
40 | 40 | $wamiurlplay = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$wamidir."/"; |
41 | 41 | $groupId = api_get_group_id(); |
@@ -45,48 +45,48 @@ discard block |
||
45 | 45 | // Please, do not modify this dirname formatting |
46 | 46 | |
47 | 47 | if (strstr($dir, '..')) { |
48 | - $dir = '/'; |
|
48 | + $dir = '/'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if ($dir[0] == '.') { |
52 | - $dir = substr($dir, 1); |
|
52 | + $dir = substr($dir, 1); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if ($dir[0] != '/') { |
56 | - $dir = '/'.$dir; |
|
56 | + $dir = '/'.$dir; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if ($dir[strlen($dir) - 1] != '/') { |
60 | - $dir .= '/'; |
|
60 | + $dir .= '/'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
64 | 64 | |
65 | 65 | if (!is_dir($filepath)) { |
66 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
67 | - $dir = '/'; |
|
66 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
67 | + $dir = '/'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | //groups //TODO: clean |
71 | 71 | if (!empty($groupId)) { |
72 | - $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace')); |
|
73 | - $noPHP_SELF = true; |
|
74 | - $group = GroupManager :: get_group_properties($groupId); |
|
75 | - $path = explode('/', $dir); |
|
76 | - if ('/'.$path[1] != $group['directory']) { |
|
77 | - api_not_allowed(true); |
|
78 | - } |
|
72 | + $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace')); |
|
73 | + $noPHP_SELF = true; |
|
74 | + $group = GroupManager :: get_group_properties($groupId); |
|
75 | + $path = explode('/', $dir); |
|
76 | + if ('/'.$path[1] != $group['directory']) { |
|
77 | + api_not_allowed(true); |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $interbreadcrumb[] = array("url" => "./document.php?id=".$document_id.'&'.api_get_cidreq(), "name" => get_lang('Documents')); |
82 | 82 | |
83 | 83 | if (!api_is_allowed_in_course()) { |
84 | - api_not_allowed(true); |
|
84 | + api_not_allowed(true); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if (!($is_allowed_to_edit || $groupRights || |
88 | - DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) { |
|
89 | - api_not_allowed(true); |
|
88 | + DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) { |
|
89 | + api_not_allowed(true); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /* Header */ |
@@ -94,26 +94,26 @@ discard block |
||
94 | 94 | |
95 | 95 | $display_dir = $dir; |
96 | 96 | if (isset ($group)) { |
97 | - $display_dir = explode('/', $dir); |
|
98 | - unset ($display_dir[0]); |
|
99 | - unset ($display_dir[1]); |
|
100 | - $display_dir = implode('/', $display_dir); |
|
97 | + $display_dir = explode('/', $dir); |
|
98 | + unset ($display_dir[0]); |
|
99 | + unset ($display_dir[1]); |
|
100 | + $display_dir = implode('/', $display_dir); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Interbreadcrumb for the current directory root path |
104 | 104 | $counter = 0; |
105 | 105 | if (isset($document_data['parents'])) { |
106 | - foreach($document_data['parents'] as $document_sub_data) { |
|
107 | - //fixing double group folder in breadcrumb |
|
108 | - if (api_get_group_id()) { |
|
109 | - if ($counter == 0) { |
|
110 | - $counter++; |
|
111 | - continue; |
|
112 | - } |
|
113 | - } |
|
114 | - $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); |
|
115 | - $counter++; |
|
116 | - } |
|
106 | + foreach($document_data['parents'] as $document_sub_data) { |
|
107 | + //fixing double group folder in breadcrumb |
|
108 | + if (api_get_group_id()) { |
|
109 | + if ($counter == 0) { |
|
110 | + $counter++; |
|
111 | + continue; |
|
112 | + } |
|
113 | + } |
|
114 | + $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); |
|
115 | + $counter++; |
|
116 | + } |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | //make some vars |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>'; |
126 | 126 | |
127 | 127 | $actions = Display::toolbarButton( |
128 | - get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), |
|
129 | - 'document.php?' . api_get_cidreq() . "&id=$document_id", |
|
130 | - 'arrow-left', |
|
131 | - 'default', |
|
132 | - [], |
|
133 | - false |
|
128 | + get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), |
|
129 | + 'document.php?' . api_get_cidreq() . "&id=$document_id", |
|
130 | + 'arrow-left', |
|
131 | + 'default', |
|
132 | + [], |
|
133 | + false |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $template = new Template($nameTools); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | //make some vars |
38 | 38 | $webcamdir=$dir; |
39 | 39 | if($webcamdir=="/"){ |
40 | - $webcamdir=""; |
|
40 | + $webcamdir=""; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -46,49 +46,49 @@ 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 ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace')); |
|
75 | - $noPHP_SELF = true; |
|
76 | - $group = GroupManager :: get_group_properties($groupId); |
|
77 | - $path = explode('/', $dir); |
|
78 | - if ('/'.$path[1] != $group['directory']) { |
|
79 | - api_not_allowed(true); |
|
80 | - } |
|
74 | + $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace')); |
|
75 | + $noPHP_SELF = true; |
|
76 | + $group = GroupManager :: get_group_properties($groupId); |
|
77 | + $path = explode('/', $dir); |
|
78 | + if ('/'.$path[1] != $group['directory']) { |
|
79 | + api_not_allowed(true); |
|
80 | + } |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $interbreadcrumb[] = array ("url" => "./document.php?id=".$document_id."&".api_get_cidreq(), "name" => get_lang('Documents')); |
84 | 84 | |
85 | 85 | if (!api_is_allowed_in_course()) { |
86 | - api_not_allowed(true); |
|
86 | + api_not_allowed(true); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | if (!($is_allowed_to_edit || $groupRights || |
90 | - DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) { |
|
91 | - api_not_allowed(true); |
|
90 | + DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) { |
|
91 | + api_not_allowed(true); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /* Header */ |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | $display_dir = $dir; |
98 | 98 | if (isset ($group)) { |
99 | - $display_dir = explode('/', $dir); |
|
100 | - unset ($display_dir[0]); |
|
101 | - unset ($display_dir[1]); |
|
102 | - $display_dir = implode('/', $display_dir); |
|
99 | + $display_dir = explode('/', $dir); |
|
100 | + unset ($display_dir[0]); |
|
101 | + unset ($display_dir[1]); |
|
102 | + $display_dir = implode('/', $display_dir); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // Interbreadcrumb for the current directory root path |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | Display :: display_header($nameTools, 'Doc'); |
125 | 125 | echo '<div class="actions">'; |
126 | 126 | echo '<a href="document.php?id='.$document_id.'">'. |
127 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
127 | + Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
128 | 128 | echo '</div>'; |
129 | 129 | ?> |
130 | 130 |
@@ -52,26 +52,26 @@ discard block |
||
52 | 52 | // Please, do not modify this dirname formatting |
53 | 53 | |
54 | 54 | if (strstr($dir, '..')) { |
55 | - $dir = '/'; |
|
55 | + $dir = '/'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if ($dir[0] == '.') { |
59 | - $dir = substr($dir, 1); |
|
59 | + $dir = substr($dir, 1); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($dir[0] != '/') { |
63 | - $dir = '/'.$dir; |
|
63 | + $dir = '/'.$dir; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if ($dir[strlen($dir) - 1] != '/') { |
67 | - $dir .= '/'; |
|
67 | + $dir .= '/'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
71 | 71 | |
72 | 72 | if (!is_dir($filepath)) { |
73 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
74 | - $dir = '/'; |
|
73 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
74 | + $dir = '/'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $groupId = api_get_group_id(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | if (!($is_allowed_to_edit || $groupRights || |
102 | - DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
102 | + DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
103 | 103 | ) { |
104 | 104 | api_not_allowed(true); |
105 | 105 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // Interbreadcrumb for the current directory root path |
118 | 118 | if (empty($document_data['parents'])) { |
119 | - $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
119 | + $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
120 | 120 | } else { |
121 | 121 | foreach ($document_data['parents'] as $document_sub_data) { |
122 | 122 | $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | $locktitle="false"; |
150 | 150 | |
151 | 151 | if ($_SERVER['HTTP_HOST']=="localhost") { |
152 | - $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
153 | - if (!file_exists($path_and_file)) { |
|
154 | - $crossdomain='<?xml version="1.0"?> |
|
152 | + $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
153 | + if (!file_exists($path_and_file)) { |
|
154 | + $crossdomain='<?xml version="1.0"?> |
|
155 | 155 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
156 | 156 | <cross-domain-policy> |
157 | 157 | <allow-access-from domain="cdn.pixlr.com" /> |
158 | 158 | <site-control permitted-cross-domain-policies="master-only"/> |
159 | 159 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
160 | 160 | </cross-domain-policy>';//more open domain="*" |
161 | - @file_put_contents($path_and_file, $crossdomain); |
|
162 | - } |
|
161 | + @file_put_contents($path_and_file, $crossdomain); |
|
162 | + } |
|
163 | 163 | $credentials = "true"; |
164 | 164 | } else { |
165 | 165 | $credentials = "false"; |
@@ -65,44 +65,44 @@ discard block |
||
65 | 65 | /* Please, do not modify this dirname formatting */ |
66 | 66 | |
67 | 67 | if (strstr($dir, '..')) { |
68 | - $dir = '/'; |
|
68 | + $dir = '/'; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($dir[0] == '.') { |
72 | - $dir = substr($dir, 1); |
|
72 | + $dir = substr($dir, 1); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($dir[0] != '/') { |
76 | - $dir = '/'.$dir; |
|
76 | + $dir = '/'.$dir; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if ($dir[strlen($dir) - 1] != '/') { |
80 | - $dir .= '/'; |
|
80 | + $dir .= '/'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
84 | 84 | |
85 | 85 | if (!is_dir($filepath)) { |
86 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
87 | - $dir = '/'; |
|
86 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
87 | + $dir = '/'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | //groups //TODO:clean |
91 | 91 | if (!empty($groupId)) { |
92 | - $interbreadcrumb[] = array( |
|
93 | - 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
|
94 | - 'name' => get_lang('GroupSpace'), |
|
95 | - ); |
|
96 | - $group_document = true; |
|
97 | - $noPHP_SELF = true; |
|
92 | + $interbreadcrumb[] = array( |
|
93 | + 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
|
94 | + 'name' => get_lang('GroupSpace'), |
|
95 | + ); |
|
96 | + $group_document = true; |
|
97 | + $noPHP_SELF = true; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
101 | 101 | |
102 | 102 | if (!$is_certificate_mode) |
103 | - $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents')); |
|
103 | + $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents')); |
|
104 | 104 | else |
105 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
105 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
106 | 106 | |
107 | 107 | // Interbreadcrumb for the current directory root path |
108 | 108 | if (empty($document_data['parents'])) { |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights || |
120 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
120 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
121 | 121 | |
122 | 122 | if (!$is_allowedToEdit) { |
123 | - api_not_allowed(true); |
|
123 | + api_not_allowed(true); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | Event::event_access_tool(TOOL_DOCUMENT); |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | $locktitle="false"; |
153 | 153 | |
154 | 154 | if ($_SERVER['HTTP_HOST']=="localhost") { |
155 | - $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
156 | - if (!file_exists($path_and_file)) { |
|
157 | - $crossdomain='<?xml version="1.0"?> |
|
155 | + $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
156 | + if (!file_exists($path_and_file)) { |
|
157 | + $crossdomain='<?xml version="1.0"?> |
|
158 | 158 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
159 | 159 | <cross-domain-policy> |
160 | 160 | <allow-access-from domain="cdn.pixlr.com" /> |
161 | 161 | <site-control permitted-cross-domain-policies="master-only"/> |
162 | 162 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
163 | 163 | </cross-domain-policy>';//more open domain="*" |
164 | - @file_put_contents($path_and_file, $crossdomain); |
|
165 | - } |
|
166 | - $credentials="true"; |
|
164 | + @file_put_contents($path_and_file, $crossdomain); |
|
165 | + } |
|
166 | + $credentials="true"; |
|
167 | 167 | } |
168 | 168 | else { |
169 | - $credentials="false"; |
|
169 | + $credentials="false"; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | //make temp images |
@@ -179,23 +179,23 @@ discard block |
||
179 | 179 | $htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess'; |
180 | 180 | if (!file_exists($htaccess)) { |
181 | 181 | |
182 | - $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
182 | + $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
183 | 183 | |
184 | - $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w'); |
|
185 | - if ($fp) { |
|
186 | - fwrite($fp, $htaccess_content); |
|
187 | - fclose($fp); |
|
188 | - } |
|
184 | + $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w'); |
|
185 | + if ($fp) { |
|
186 | + fwrite($fp, $htaccess_content); |
|
187 | + fclose($fp); |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html'; |
192 | 192 | if (!file_exists($html_index)) { |
193 | - $html_index_content="<html><head></head><body></body></html>"; |
|
194 | - $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w'); |
|
195 | - if ($fp) { |
|
196 | - fwrite($fp, $html_index_content); |
|
197 | - fclose($fp); |
|
198 | - } |
|
193 | + $html_index_content="<html><head></head><body></body></html>"; |
|
194 | + $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w'); |
|
195 | + if ($fp) { |
|
196 | + fwrite($fp, $html_index_content); |
|
197 | + fclose($fp); |
|
198 | + } |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | //encript temp name file |
@@ -48,59 +48,59 @@ discard block |
||
48 | 48 | // Please, do not modify this dirname formatting |
49 | 49 | |
50 | 50 | if (strstr($dir, '..')) { |
51 | - $dir = '/'; |
|
51 | + $dir = '/'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | if ($dir[0] == '.') { |
55 | - $dir = substr($dir, 1); |
|
55 | + $dir = substr($dir, 1); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if ($dir[0] != '/') { |
59 | - $dir = '/'.$dir; |
|
59 | + $dir = '/'.$dir; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($dir[strlen($dir) - 1] != '/') { |
63 | - $dir .= '/'; |
|
63 | + $dir .= '/'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
67 | 67 | |
68 | 68 | if (!is_dir($filepath)) { |
69 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
70 | - $dir = '/'; |
|
69 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
70 | + $dir = '/'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $groupId = api_get_group_id(); |
74 | 74 | |
75 | 75 | if (!empty($groupId)) { |
76 | - $interbreadcrumb[] = array ( |
|
76 | + $interbreadcrumb[] = array ( |
|
77 | 77 | "url" => "../group/group_space.php?".api_get_cidreq(), |
78 | 78 | "name" => get_lang('GroupSpace') |
79 | 79 | ); |
80 | - $noPHP_SELF = true; |
|
81 | - $group = GroupManager :: get_group_properties($groupId); |
|
82 | - $path = explode('/', $dir); |
|
83 | - if ('/'.$path[1] != $group['directory']) { |
|
84 | - api_not_allowed(true); |
|
85 | - } |
|
80 | + $noPHP_SELF = true; |
|
81 | + $group = GroupManager :: get_group_properties($groupId); |
|
82 | + $path = explode('/', $dir); |
|
83 | + if ('/'.$path[1] != $group['directory']) { |
|
84 | + api_not_allowed(true); |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $interbreadcrumb[] = array( |
89 | - "url" => "./document.php?".api_get_cidreq(), |
|
90 | - "name" => get_lang('Documents') |
|
89 | + "url" => "./document.php?".api_get_cidreq(), |
|
90 | + "name" => get_lang('Documents') |
|
91 | 91 | ); |
92 | 92 | |
93 | 93 | if (!api_is_allowed_in_course()) { |
94 | - api_not_allowed(true); |
|
94 | + api_not_allowed(true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if (!($is_allowed_to_edit || $groupRights || |
98 | - DocumentManager::is_my_shared_folder( |
|
99 | - api_get_user_id(), |
|
100 | - Security::remove_XSS($dir), |
|
101 | - api_get_session_id())) |
|
98 | + DocumentManager::is_my_shared_folder( |
|
99 | + api_get_user_id(), |
|
100 | + Security::remove_XSS($dir), |
|
101 | + api_get_session_id())) |
|
102 | 102 | ) { |
103 | - api_not_allowed(true); |
|
103 | + api_not_allowed(true); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | Event::event_access_tool(TOOL_DOCUMENT); |
109 | 109 | $display_dir = $dir; |
110 | 110 | if (isset ($group)) { |
111 | - $display_dir = explode('/', $dir); |
|
112 | - unset ($display_dir[0]); |
|
113 | - unset ($display_dir[1]); |
|
114 | - $display_dir = implode('/', $display_dir); |
|
111 | + $display_dir = explode('/', $dir); |
|
112 | + unset ($display_dir[0]); |
|
113 | + unset ($display_dir[1]); |
|
114 | + $display_dir = implode('/', $display_dir); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // Interbreadcrumb for the current directory root path |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | } else { |
126 | 126 | foreach ($document_data['parents'] as $document_sub_data) { |
127 | 127 | $interbreadcrumb[] = array( |
128 | - 'url' => $document_sub_data['document_url'], |
|
129 | - 'name' => $document_sub_data['title'] |
|
130 | - ); |
|
128 | + 'url' => $document_sub_data['document_url'], |
|
129 | + 'name' => $document_sub_data['title'] |
|
130 | + ); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | Display :: display_header($nameTools, 'Doc'); |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | |
140 | 140 | if (api_browser_support('svg')) { |
141 | 141 | |
142 | - //automatic loading the course language |
|
143 | - $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
144 | - $langsvgedit = api_get_language_isocode(); |
|
145 | - $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
146 | - $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
147 | - $svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit; |
|
148 | - ?> |
|
142 | + //automatic loading the course language |
|
143 | + $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
144 | + $langsvgedit = api_get_language_isocode(); |
|
145 | + $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
146 | + $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
147 | + $svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit; |
|
148 | + ?> |
|
149 | 149 | <script> |
150 | 150 | 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>'); |
151 | 151 | function resizeIframe() { |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | |
164 | 164 | <?php |
165 | 165 | echo '<noscript>'; |
166 | - 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>'; |
|
167 | - echo '</noscript>'; |
|
166 | + 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>'; |
|
167 | + echo '</noscript>'; |
|
168 | 168 | } else { |
169 | - Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
169 | + Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | Display :: display_footer(); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $sessionId = api_get_session_id(); |
62 | 62 | |
63 | 63 | if (api_is_in_group()) { |
64 | - $group_properties = GroupManager::get_group_properties($group_id); |
|
64 | + $group_properties = GroupManager::get_group_properties($group_id); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $dir = '/'; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $_GET['id'], |
74 | 74 | api_get_course_id(), |
75 | 75 | true, |
76 | - 0 |
|
76 | + 0 |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | if (!empty($sessionId) && empty($document_data)) { |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - $document_id = $document_data['id']; |
|
89 | - $file = $document_data['path']; |
|
90 | - $parent_id = DocumentManager::get_document_id($course_info, dirname($file)); |
|
91 | - $dir = dirname($document_data['path']); |
|
92 | - $dir_original = $dir; |
|
93 | - $doc = basename($file); |
|
94 | - $readonly = $document_data['readonly']; |
|
88 | + $document_id = $document_data['id']; |
|
89 | + $file = $document_data['path']; |
|
90 | + $parent_id = DocumentManager::get_document_id($course_info, dirname($file)); |
|
91 | + $dir = dirname($document_data['path']); |
|
92 | + $dir_original = $dir; |
|
93 | + $doc = basename($file); |
|
94 | + $readonly = $document_data['readonly']; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if (empty($document_data)) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // Level correction for group documents. |
115 | 115 | if (!empty($group_properties['directory'])) { |
116 | - $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
116 | + $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
117 | 117 | } |
118 | 118 | $relative_url = ''; |
119 | 119 | for ($i = 0; $i < ($count_dir); $i++) { |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | ); |
136 | 136 | |
137 | 137 | if ($is_certificate_mode) { |
138 | - $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
139 | - $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
140 | - $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
138 | + $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
139 | + $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
140 | + $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $groupRights || |
144 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId); |
|
144 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId); |
|
145 | 145 | $noPHP_SELF = true; |
146 | 146 | |
147 | 147 | /* Other initialization code */ |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
155 | 155 | 'name' => get_lang('GroupSpace'), |
156 | 156 | ); |
157 | - $group_document = true; |
|
158 | - $noPHP_SELF = true; |
|
157 | + $group_document = true; |
|
158 | + $noPHP_SELF = true; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (!$is_certificate_mode) { |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | |
190 | 190 | //TODO:check the below code and his funcionality |
191 | 191 | if (!api_is_allowed_to_edit()) { |
192 | - if (DocumentManager::check_readonly($course_info, $user_id, $file)) { |
|
193 | - api_not_allowed(); |
|
194 | - } |
|
192 | + if (DocumentManager::check_readonly($course_info, $user_id, $file)) { |
|
193 | + api_not_allowed(); |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /* MAIN TOOL CODE */ |
@@ -199,18 +199,18 @@ discard block |
||
199 | 199 | /* Code to change the comment */ |
200 | 200 | |
201 | 201 | if (isset($_POST['comment'])) { |
202 | - // Fixing the path if it is wrong |
|
203 | - $comment = trim($_POST['comment']); |
|
204 | - $title = trim($_POST['title']); |
|
202 | + // Fixing the path if it is wrong |
|
203 | + $comment = trim($_POST['comment']); |
|
204 | + $title = trim($_POST['title']); |
|
205 | 205 | |
206 | 206 | // Just in case see BT#3525 |
207 | 207 | if (empty($title)) { |
208 | - $title = $document_data['title']; |
|
209 | - } |
|
208 | + $title = $document_data['title']; |
|
209 | + } |
|
210 | 210 | |
211 | - if (empty($title)) { |
|
212 | - $title = get_document_title($_POST['filename']); |
|
213 | - } |
|
211 | + if (empty($title)) { |
|
212 | + $title = get_document_title($_POST['filename']); |
|
213 | + } |
|
214 | 214 | |
215 | 215 | if (!empty($document_id)) { |
216 | 216 | $params = [ |
@@ -222,43 +222,43 @@ discard block |
||
222 | 222 | $params, |
223 | 223 | ['c_id = ? AND id = ?' => [$course_id, $document_id]] |
224 | 224 | ); |
225 | - Display::addFlash(Display::return_message(get_lang('fileModified'))); |
|
225 | + Display::addFlash(Display::return_message(get_lang('fileModified'))); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | 229 | /* WYSIWYG HTML EDITOR - Program Logic */ |
230 | 230 | if ($is_allowed_to_edit) { |
231 | - if (isset($_POST['formSent']) && $_POST['formSent'] == 1) { |
|
231 | + if (isset($_POST['formSent']) && $_POST['formSent'] == 1) { |
|
232 | 232 | |
233 | - $filename = stripslashes($_POST['filename']); |
|
233 | + $filename = stripslashes($_POST['filename']); |
|
234 | 234 | $extension = $_POST['extension']; |
235 | - $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null; |
|
236 | - $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY); |
|
235 | + $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null; |
|
236 | + $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY); |
|
237 | 237 | |
238 | 238 | if ($dir == '/') { |
239 | 239 | $dir = ''; |
240 | 240 | } |
241 | 241 | |
242 | - $file = $dir.'/'.$filename.'.'.$extension; |
|
243 | - $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
244 | - $read_only_flag = empty($read_only_flag) ? 0 : 1; |
|
242 | + $file = $dir.'/'.$filename.'.'.$extension; |
|
243 | + $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
244 | + $read_only_flag = empty($read_only_flag) ? 0 : 1; |
|
245 | 245 | |
246 | - if (empty($filename)) { |
|
246 | + if (empty($filename)) { |
|
247 | 247 | Display::addFlash(Display::return_message(get_lang('NoFileName'), 'warning')); |
248 | - } else { |
|
248 | + } else { |
|
249 | 249 | |
250 | - $file_size = filesize($document_data['absolute_path']); |
|
250 | + $file_size = filesize($document_data['absolute_path']); |
|
251 | 251 | |
252 | - if ($read_only_flag == 0) { |
|
253 | - if (!empty($content)) { |
|
254 | - if ($fp = @fopen($document_data['absolute_path'], 'w')) { |
|
255 | - // For flv player, change absolute path temporarily to prevent from erasing it in the following lines |
|
256 | - $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content); |
|
257 | - fputs($fp, $content); |
|
258 | - fclose($fp); |
|
252 | + if ($read_only_flag == 0) { |
|
253 | + if (!empty($content)) { |
|
254 | + if ($fp = @fopen($document_data['absolute_path'], 'w')) { |
|
255 | + // For flv player, change absolute path temporarily to prevent from erasing it in the following lines |
|
256 | + $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content); |
|
257 | + fputs($fp, $content); |
|
258 | + fclose($fp); |
|
259 | 259 | |
260 | 260 | $filepath = $document_data['absolute_parent_path']; |
261 | - /* |
|
261 | + /* |
|
262 | 262 | if (!is_dir($filepath.'css')) { |
263 | 263 | mkdir($filepath.'css', api_get_permissions_for_new_directories()); |
264 | 264 | $doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css'); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | ); |
289 | 289 | }*/ |
290 | 290 | |
291 | - /*if (!is_file($filepath.'css/frames.css')) { |
|
291 | + /*if (!is_file($filepath.'css/frames.css')) { |
|
292 | 292 | $platform_theme = api_get_setting('stylesheets'); |
293 | 293 | if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) { |
294 | 294 | copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css'); |
@@ -326,54 +326,54 @@ discard block |
||
326 | 326 | } |
327 | 327 | }*/ |
328 | 328 | |
329 | - // "WHAT'S NEW" notification: update table item_property |
|
330 | - $document_id = DocumentManager::get_document_id($_course, $file); |
|
331 | - |
|
332 | - if ($document_id) { |
|
333 | - update_existing_document( |
|
334 | - $_course, |
|
335 | - $document_id, |
|
336 | - $file_size, |
|
337 | - $read_only_flag |
|
338 | - ); |
|
339 | - api_item_property_update( |
|
340 | - $_course, |
|
341 | - TOOL_DOCUMENT, |
|
342 | - $document_id, |
|
343 | - 'DocumentUpdated', |
|
344 | - api_get_user_id(), |
|
345 | - null, |
|
346 | - null, |
|
347 | - null, |
|
348 | - null, |
|
349 | - $sessionId |
|
350 | - ); |
|
351 | - // Update parent folders |
|
352 | - item_property_update_on_folder( |
|
353 | - $_course, |
|
354 | - $dir, |
|
355 | - api_get_user_id() |
|
356 | - ); |
|
357 | - header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':'')); |
|
358 | - exit; |
|
359 | - } else { |
|
329 | + // "WHAT'S NEW" notification: update table item_property |
|
330 | + $document_id = DocumentManager::get_document_id($_course, $file); |
|
331 | + |
|
332 | + if ($document_id) { |
|
333 | + update_existing_document( |
|
334 | + $_course, |
|
335 | + $document_id, |
|
336 | + $file_size, |
|
337 | + $read_only_flag |
|
338 | + ); |
|
339 | + api_item_property_update( |
|
340 | + $_course, |
|
341 | + TOOL_DOCUMENT, |
|
342 | + $document_id, |
|
343 | + 'DocumentUpdated', |
|
344 | + api_get_user_id(), |
|
345 | + null, |
|
346 | + null, |
|
347 | + null, |
|
348 | + null, |
|
349 | + $sessionId |
|
350 | + ); |
|
351 | + // Update parent folders |
|
352 | + item_property_update_on_folder( |
|
353 | + $_course, |
|
354 | + $dir, |
|
355 | + api_get_user_id() |
|
356 | + ); |
|
357 | + header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':'')); |
|
358 | + exit; |
|
359 | + } else { |
|
360 | 360 | Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning')); |
361 | - } |
|
362 | - } else { |
|
361 | + } |
|
362 | + } else { |
|
363 | 363 | Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning')); |
364 | - } |
|
365 | - } else { |
|
366 | - if ($document_id) { |
|
364 | + } |
|
365 | + } else { |
|
366 | + if ($document_id) { |
|
367 | 367 | update_existing_document($_course, $document_id, $file_size, $read_only_flag); |
368 | - } |
|
369 | - } |
|
370 | - } else { |
|
368 | + } |
|
369 | + } |
|
370 | + } else { |
|
371 | 371 | if ($document_id) { |
372 | 372 | update_existing_document($_course, $document_id, $file_size, $read_only_flag); |
373 | 373 | } |
374 | - } |
|
375 | - } |
|
376 | - } |
|
374 | + } |
|
375 | + } |
|
376 | + } |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | // Replace relative paths by absolute web paths (e.g. './' => 'http://www.chamilo.org/courses/ABC/document/') |
@@ -428,35 +428,35 @@ discard block |
||
428 | 428 | $groupInfo['iid'] |
429 | 429 | ) |
430 | 430 | ) { |
431 | - $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq(); |
|
431 | + $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq(); |
|
432 | 432 | if ($is_certificate_mode) { |
433 | 433 | $action .= '&curdirpath=/certificates&selectcat=1'; |
434 | 434 | } |
435 | - $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical')); |
|
436 | - |
|
437 | - // Form title |
|
438 | - $form->addElement('header', $nameTools); |
|
439 | - $form->addElement('hidden', 'filename'); |
|
440 | - $form->addElement('hidden', 'extension'); |
|
441 | - $form->addElement('hidden', 'file_path'); |
|
442 | - $form->addElement('hidden', 'commentPath'); |
|
443 | - $form->addElement('hidden', 'showedit'); |
|
444 | - $form->addElement('hidden', 'origin'); |
|
445 | - $form->addElement('hidden', 'origin_opt'); |
|
435 | + $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical')); |
|
436 | + |
|
437 | + // Form title |
|
438 | + $form->addElement('header', $nameTools); |
|
439 | + $form->addElement('hidden', 'filename'); |
|
440 | + $form->addElement('hidden', 'extension'); |
|
441 | + $form->addElement('hidden', 'file_path'); |
|
442 | + $form->addElement('hidden', 'commentPath'); |
|
443 | + $form->addElement('hidden', 'showedit'); |
|
444 | + $form->addElement('hidden', 'origin'); |
|
445 | + $form->addElement('hidden', 'origin_opt'); |
|
446 | 446 | $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus')); |
447 | 447 | |
448 | - $defaults['title'] = $document_data['title']; |
|
448 | + $defaults['title'] = $document_data['title']; |
|
449 | 449 | |
450 | - $form->addElement('hidden', 'formSent'); |
|
451 | - $defaults['formSent'] = 1; |
|
450 | + $form->addElement('hidden', 'formSent'); |
|
451 | + $defaults['formSent'] = 1; |
|
452 | 452 | |
453 | - $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
453 | + $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
454 | 454 | |
455 | - // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. |
|
456 | - // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 |
|
457 | - $defaults['content'] = str_replace('<!--[', '<!-- [', $content); |
|
455 | + // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. |
|
456 | + // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 |
|
457 | + $defaults['content'] = str_replace('<!--[', '<!-- [', $content); |
|
458 | 458 | |
459 | - // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. |
|
459 | + // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. |
|
460 | 460 | |
461 | 461 | $showSystemFolders = api_get_course_setting('show_system_folders'); |
462 | 462 | $condition = stripos($dir, '/HotPotatoes_files') === false; |
@@ -464,44 +464,44 @@ discard block |
||
464 | 464 | $condition = true; |
465 | 465 | } |
466 | 466 | |
467 | - if (($extension == 'htm' || $extension == 'html') && $condition) { |
|
468 | - if (empty($readonly) && $readonly == 0) { |
|
467 | + if (($extension == 'htm' || $extension == 'html') && $condition) { |
|
468 | + if (empty($readonly) && $readonly == 0) { |
|
469 | 469 | $form->addHtmlEditor('content', '', true, true, $editorConfig); |
470 | - } |
|
471 | - } |
|
470 | + } |
|
471 | + } |
|
472 | 472 | |
473 | - if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { |
|
474 | - // Updated on field |
|
473 | + if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { |
|
474 | + // Updated on field |
|
475 | 475 | $display_date = date_to_str_ago($last_edit_date). |
476 | - ' <span class="dropbox_date">'.api_format_date(api_get_local_time($last_edit_date)).'</span>'; |
|
477 | - $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); |
|
478 | - } |
|
476 | + ' <span class="dropbox_date">'.api_format_date(api_get_local_time($last_edit_date)).'</span>'; |
|
477 | + $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); |
|
478 | + } |
|
479 | 479 | |
480 | - $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); |
|
480 | + $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); |
|
481 | 481 | |
482 | - if ($owner_id == api_get_user_id() || api_is_platform_admin()) { |
|
483 | - $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); |
|
484 | - if ($readonly == 1) { |
|
485 | - $checked->setChecked(true); |
|
486 | - } |
|
487 | - } |
|
482 | + if ($owner_id == api_get_user_id() || api_is_platform_admin()) { |
|
483 | + $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); |
|
484 | + if ($readonly == 1) { |
|
485 | + $checked->setChecked(true); |
|
486 | + } |
|
487 | + } |
|
488 | 488 | |
489 | - if ($is_certificate_mode) { |
|
490 | - $form->addButtonUpdate(get_lang('SaveCertificate')); |
|
489 | + if ($is_certificate_mode) { |
|
490 | + $form->addButtonUpdate(get_lang('SaveCertificate')); |
|
491 | 491 | } else { |
492 | - $form->addButtonUpdate(get_lang('SaveDocument')); |
|
492 | + $form->addButtonUpdate(get_lang('SaveDocument')); |
|
493 | 493 | } |
494 | 494 | |
495 | - $defaults['filename'] = $filename; |
|
496 | - $defaults['extension'] = $extension; |
|
497 | - $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null; |
|
498 | - $defaults['commentPath'] = $file; |
|
499 | - $defaults['renameTo'] = $file_name; |
|
500 | - $defaults['comment'] = $document_data['comment']; |
|
501 | - $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null; |
|
502 | - $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null; |
|
495 | + $defaults['filename'] = $filename; |
|
496 | + $defaults['extension'] = $extension; |
|
497 | + $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null; |
|
498 | + $defaults['commentPath'] = $file; |
|
499 | + $defaults['renameTo'] = $file_name; |
|
500 | + $defaults['comment'] = $document_data['comment']; |
|
501 | + $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null; |
|
502 | + $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null; |
|
503 | 503 | |
504 | - $form->setDefaults($defaults); |
|
504 | + $form->setDefaults($defaults); |
|
505 | 505 | |
506 | 506 | show_return( |
507 | 507 | $parent_id, |
@@ -511,25 +511,25 @@ discard block |
||
511 | 511 | $is_certificate_mode |
512 | 512 | ); |
513 | 513 | |
514 | - if ($is_certificate_mode) { |
|
515 | - $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
|
516 | - api_get_user_id(), |
|
517 | - api_get_course_id() |
|
518 | - ); |
|
519 | - $str_info = ''; |
|
520 | - foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
521 | - $str_info .= $info_value.'<br/>'; |
|
522 | - } |
|
523 | - $create_certificate=get_lang('CreateCertificateWithTags'); |
|
524 | - Display::display_normal_message( |
|
525 | - $create_certificate.': <br /><br />'.$str_info, |
|
526 | - false |
|
527 | - ); |
|
528 | - } |
|
529 | - |
|
530 | - if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){ |
|
531 | - Display::display_warning_message(get_lang('BrowserDontSupportsSVG')); |
|
532 | - } |
|
514 | + if ($is_certificate_mode) { |
|
515 | + $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
|
516 | + api_get_user_id(), |
|
517 | + api_get_course_id() |
|
518 | + ); |
|
519 | + $str_info = ''; |
|
520 | + foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
521 | + $str_info .= $info_value.'<br/>'; |
|
522 | + } |
|
523 | + $create_certificate=get_lang('CreateCertificateWithTags'); |
|
524 | + Display::display_normal_message( |
|
525 | + $create_certificate.': <br /><br />'.$str_info, |
|
526 | + false |
|
527 | + ); |
|
528 | + } |
|
529 | + |
|
530 | + if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){ |
|
531 | + Display::display_warning_message(get_lang('BrowserDontSupportsSVG')); |
|
532 | + } |
|
533 | 533 | // HTML-editor |
534 | 534 | echo '<div class="page-create"> |
535 | 535 | <div class="row" style="overflow:hidden"> |
@@ -556,26 +556,26 @@ discard block |
||
556 | 556 | */ |
557 | 557 | function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc) |
558 | 558 | { |
559 | - $file_name_for_change = $base_work_dir.$dir.$source_file; |
|
559 | + $file_name_for_change = $base_work_dir.$dir.$source_file; |
|
560 | 560 | $rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file |
561 | - $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API |
|
562 | - |
|
563 | - if ($rename_to) { |
|
564 | - if (isset($dir) && $dir != '') { |
|
565 | - $source_file = $dir.$source_file; |
|
566 | - $new_full_file_name = dirname($source_file).'/'.$rename_to; |
|
567 | - } else { |
|
568 | - $source_file = '/'.$source_file; |
|
569 | - $new_full_file_name = '/'.$rename_to; |
|
570 | - } |
|
571 | - |
|
572 | - update_db_info('update', $source_file, $new_full_file_name); // fileManage API |
|
561 | + $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API |
|
562 | + |
|
563 | + if ($rename_to) { |
|
564 | + if (isset($dir) && $dir != '') { |
|
565 | + $source_file = $dir.$source_file; |
|
566 | + $new_full_file_name = dirname($source_file).'/'.$rename_to; |
|
567 | + } else { |
|
568 | + $source_file = '/'.$source_file; |
|
569 | + $new_full_file_name = '/'.$rename_to; |
|
570 | + } |
|
571 | + |
|
572 | + update_db_info('update', $source_file, $new_full_file_name); // fileManage API |
|
573 | 573 | Display::addFlash(Display::return_message(get_lang('fileModified'))); |
574 | 574 | |
575 | - return true; |
|
576 | - } else { |
|
575 | + return true; |
|
576 | + } else { |
|
577 | 577 | Display::addFlash(Display::return_message(get_lang('FileExists'))); |
578 | - } |
|
578 | + } |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | //return button back to |
@@ -586,32 +586,32 @@ discard block |
||
586 | 586 | global $parent_id; |
587 | 587 | $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id; |
588 | 588 | |
589 | - if ($is_certificate_mode) { |
|
590 | - $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); |
|
591 | - $actionsLeft .= '<a href="document.php?curdirpath='. $selectedCategory .'&selectcat=' . $selectedCategory .'">'. |
|
589 | + if ($is_certificate_mode) { |
|
590 | + $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); |
|
591 | + $actionsLeft .= '<a href="document.php?curdirpath='. $selectedCategory .'&selectcat=' . $selectedCategory .'">'. |
|
592 | 592 | Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
593 | 593 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>'; |
594 | - } elseif($call_from_tool=='slideshow') { |
|
595 | - $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'. |
|
594 | + } elseif($call_from_tool=='slideshow') { |
|
595 | + $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'. |
|
596 | 596 | Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('ViewSlideshow'),'',ICON_SIZE_MEDIUM).'</a>'; |
597 | - } elseif($call_from_tool=='editdraw') { |
|
598 | - $actionsLeft .= '<a href="'.$url.'">'. |
|
597 | + } elseif($call_from_tool=='editdraw') { |
|
598 | + $actionsLeft .= '<a href="'.$url.'">'. |
|
599 | 599 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
600 | - $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>'; |
|
601 | - } elseif($call_from_tool=='editodf') { |
|
600 | + $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>'; |
|
601 | + } elseif($call_from_tool=='editodf') { |
|
602 | 602 | $actionsLeft .= '<a href="'.$url.'">'. |
603 | 603 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
604 | 604 | $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Write'), array(), 32).'</a>'; |
605 | 605 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>'; |
606 | 606 | } elseif($call_from_tool=='editpaint'){ |
607 | - $actionsLeft .= '<a href="'.$url.'">'. |
|
607 | + $actionsLeft .= '<a href="'.$url.'">'. |
|
608 | 608 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), array(), ICON_SIZE_MEDIUM).'</a>'; |
609 | - $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>'; |
|
610 | - } else { |
|
611 | - $actionsLeft .= '<a href="'.$url.'">'. |
|
609 | + $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>'; |
|
610 | + } else { |
|
611 | + $actionsLeft .= '<a href="'.$url.'">'. |
|
612 | 612 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
613 | 613 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>'; |
614 | - } |
|
614 | + } |
|
615 | 615 | |
616 | 616 | echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft)); |
617 | 617 | } |