@@ -625,7 +625,6 @@ discard block |
||
625 | 625 | * The other configuration parameters have not been changed. |
626 | 626 | * |
627 | 627 | * This is how we can get most used paths, for common purpose: |
628 | - |
|
629 | 628 | * api_get_path(REL_PATH) /chamilo/ |
630 | 629 | * api_get_path(REL_COURSE_PATH) /chamilo/courses/ |
631 | 630 | * api_get_path(REL_CODE_PATH) /chamilo/main/ |
@@ -1803,7 +1802,6 @@ discard block |
||
1803 | 1802 | |
1804 | 1803 | /** |
1805 | 1804 | * Returns the current course info array. |
1806 | - |
|
1807 | 1805 | * Now if the course_code is given, the returned array gives info about that |
1808 | 1806 | * particular course, not specially the current one. |
1809 | 1807 | * @param int $id Numeric ID of the course |
@@ -2734,7 +2732,7 @@ discard block |
||
2734 | 2732 | switch ($session_user_status) { |
2735 | 2733 | case 0: |
2736 | 2734 | $session_status['status'] = 'student'; |
2737 | - break; |
|
2735 | + break; |
|
2738 | 2736 | case 2: |
2739 | 2737 | $session_status['status'] = 'coach'; |
2740 | 2738 | break; |
@@ -6492,7 +6490,7 @@ discard block |
||
6492 | 6490 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6493 | 6491 | $libraries = array(); |
6494 | 6492 | if ($include_jqgrid) { |
6495 | - $libraries[]='jqgrid'; |
|
6493 | + $libraries[]='jqgrid'; |
|
6496 | 6494 | } |
6497 | 6495 | return api_get_jquery_libraries_js($libraries); |
6498 | 6496 | } |
@@ -1682,7 +1682,7 @@ discard block |
||
1682 | 1682 | $html .= '<label class="checkbox-inline"> |
1683 | 1683 | <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .' |
1684 | 1684 | </label>'; |
1685 | - $html .= '<label class="checkbox-inline"> |
|
1685 | + $html .= '<label class="checkbox-inline"> |
|
1686 | 1686 | <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .' |
1687 | 1687 | </label>'; |
1688 | 1688 | $html .= '</div>'; |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | </div>'; |
1717 | 1717 | |
1718 | 1718 | echo panel($html, get_lang('Platform'), 'platform'); |
1719 | - ?> |
|
1719 | + ?> |
|
1720 | 1720 | <div class='form-group'> |
1721 | 1721 | <div class="col-sm-6"> |
1722 | 1722 | <button type="submit" class="btn btn-default pull-right" name="step3" value="< <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button> |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (Database::num_rows($result) == 0) { |
214 | 214 | $condition = ''; |
215 | 215 | } else { |
216 | - //great, there is an specific auto launch for this session we leave the $condition |
|
216 | + //great, there is an specific auto launch for this session we leave the $condition |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $lp_data = Database::fetch_array($result,'ASSOC'); |
226 | 226 | if (!empty($lp_data['id'])) { |
227 | 227 | if (api_is_platform_admin() || api_is_allowed_to_edit()) { |
228 | - $show_autolaunch_lp_warning = true; |
|
228 | + $show_autolaunch_lp_warning = true; |
|
229 | 229 | } else { |
230 | 230 | $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
231 | 231 | if (!isset($_SESSION[$session_key])) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | //if (!isset($_SESSION[$forumKey])) { |
255 | 255 | //redirecting to the LP |
256 | 256 | $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&id_session='.$session_id; |
257 | - // $_SESSION[$forumKey] = true; |
|
257 | + // $_SESSION[$forumKey] = true; |
|
258 | 258 | header("Location: $url"); |
259 | 259 | exit; |
260 | 260 | //} |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | if (api_get_setting('course.homepage_view') == 'activity' || |
281 | 281 | api_get_setting('course.homepage_view') == 'activity_big' |
282 | 282 | ) { |
283 | - require 'activity.php'; |
|
283 | + require 'activity.php'; |
|
284 | 284 | } elseif (api_get_setting('course.homepage_view') == '2column') { |
285 | - require '2column.php'; |
|
285 | + require '2column.php'; |
|
286 | 286 | } elseif (api_get_setting('course.homepage_view') == '3column') { |
287 | - require '3column.php'; |
|
287 | + require '3column.php'; |
|
288 | 288 | } elseif (api_get_setting('course.homepage_view') == 'vertical_activity') { |
289 | - require 'vertical_activity.php'; |
|
289 | + require 'vertical_activity.php'; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = '<div id="course_tools">'.$content.'</div>'; |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | $last_access = ''; |
8 | 8 | // get the last time the user accessed the tool |
9 | 9 | if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') { |
10 | - $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
11 | - $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
10 | + $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
11 | + $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
12 | 12 | } else { |
13 | - if (isset($_SESSION[$_course['id']])) { |
|
14 | - $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
15 | - } |
|
13 | + if (isset($_SESSION[$_course['id']])) { |
|
14 | + $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $postAction = isset($_POST['action']) ? $_POST['action'] : null; |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | // Display the form for adding a new dropbox item. |
51 | 51 | if ($action == 'add') { |
52 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
53 | - api_not_allowed(); |
|
54 | - } |
|
52 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
53 | + api_not_allowed(); |
|
54 | + } |
|
55 | 55 | display_add_form( |
56 | 56 | $dropbox_unid, |
57 | 57 | $viewReceivedCategory, |
@@ -61,56 +61,56 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | if (isset($_POST['submitWork'])) { |
64 | - $check = Security::check_token(); |
|
65 | - if ($check) { |
|
64 | + $check = Security::check_token(); |
|
65 | + if ($check) { |
|
66 | 66 | store_add_dropbox(); |
67 | - } |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Display the form for adding a category |
71 | 71 | if ($action == 'addreceivedcategory' || $action == 'addsentcategory') { |
72 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
73 | - api_not_allowed(); |
|
74 | - } |
|
75 | - $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
76 | - display_addcategory_form($categoryName, '', $_GET['action']); |
|
72 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
73 | + api_not_allowed(); |
|
74 | + } |
|
75 | + $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
76 | + display_addcategory_form($categoryName, '', $_GET['action']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Editing a category: displaying the form |
80 | 80 | if ($action == 'editcategory' && isset($_GET['id'])) { |
81 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
82 | - api_not_allowed(); |
|
83 | - } |
|
84 | - if (!$_POST) { |
|
85 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
86 | - api_not_allowed(); |
|
87 | - } |
|
88 | - display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
89 | - } |
|
81 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
82 | + api_not_allowed(); |
|
83 | + } |
|
84 | + if (!$_POST) { |
|
85 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
86 | + api_not_allowed(); |
|
87 | + } |
|
88 | + display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
89 | + } |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // Storing a new or edited category |
93 | 93 | if (isset($_POST['StoreCategory'])) { |
94 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
95 | - api_not_allowed(); |
|
96 | - } |
|
97 | - $return_information = store_addcategory(); |
|
98 | - if ($return_information['type'] == 'confirmation') { |
|
99 | - Display :: display_confirmation_message($return_information['message']); |
|
100 | - } |
|
101 | - if ($return_information['type'] == 'error') { |
|
102 | - Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
103 | - display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
104 | - } |
|
94 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
95 | + api_not_allowed(); |
|
96 | + } |
|
97 | + $return_information = store_addcategory(); |
|
98 | + if ($return_information['type'] == 'confirmation') { |
|
99 | + Display :: display_confirmation_message($return_information['message']); |
|
100 | + } |
|
101 | + if ($return_information['type'] == 'error') { |
|
102 | + Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
103 | + display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | // Move a File |
109 | 109 | if (($action == 'movesent' || $action == 'movereceived') AND isset($_GET['move_id'])) { |
110 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
111 | - api_not_allowed(); |
|
112 | - } |
|
113 | - display_move_form( |
|
110 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
111 | + api_not_allowed(); |
|
112 | + } |
|
113 | + display_move_form( |
|
114 | 114 | str_replace('move', '', $action), |
115 | 115 | $_GET['move_id'], |
116 | 116 | get_dropbox_categories(str_replace('move', '', $action)), |
@@ -121,33 +121,33 @@ discard block |
||
121 | 121 | ); |
122 | 122 | } |
123 | 123 | if (isset($_POST['do_move'])) { |
124 | - Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
124 | + Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // Delete a file |
128 | 128 | if (($action == 'deletereceivedfile' || $action == 'deletesentfile') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
129 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
130 | - api_not_allowed(); |
|
131 | - } |
|
132 | - $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
133 | - if ($action == 'deletereceivedfile') { |
|
134 | - $dropboxfile->deleteReceivedWork($_GET['id']); |
|
135 | - $message = get_lang('ReceivedFileDeleted'); |
|
136 | - } |
|
137 | - if ($action == 'deletesentfile') { |
|
138 | - $dropboxfile->deleteSentWork($_GET['id']); |
|
139 | - $message = get_lang('SentFileDeleted'); |
|
140 | - } |
|
141 | - Display :: display_confirmation_message($message); |
|
129 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
130 | + api_not_allowed(); |
|
131 | + } |
|
132 | + $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
133 | + if ($action == 'deletereceivedfile') { |
|
134 | + $dropboxfile->deleteReceivedWork($_GET['id']); |
|
135 | + $message = get_lang('ReceivedFileDeleted'); |
|
136 | + } |
|
137 | + if ($action == 'deletesentfile') { |
|
138 | + $dropboxfile->deleteSentWork($_GET['id']); |
|
139 | + $message = get_lang('SentFileDeleted'); |
|
140 | + } |
|
141 | + Display :: display_confirmation_message($message); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Delete a category |
145 | 145 | if (($action == 'deletereceivedcategory' || $action == 'deletesentcategory') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
146 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
147 | - api_not_allowed(); |
|
148 | - } |
|
149 | - $message = delete_category($action, $_GET['id']); |
|
150 | - Display :: display_confirmation_message($message); |
|
146 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
147 | + api_not_allowed(); |
|
148 | + } |
|
149 | + $message = delete_category($action, $_GET['id']); |
|
150 | + Display :: display_confirmation_message($message); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | // Do an action on multiple files |
@@ -162,27 +162,27 @@ discard block |
||
162 | 162 | $postAction == 'delete_sent' || |
163 | 163 | $postAction == 'download_sent') |
164 | 164 | ) { |
165 | - $display_message = handle_multiple_actions(); |
|
166 | - Display :: display_normal_message($display_message); |
|
165 | + $display_message = handle_multiple_actions(); |
|
166 | + Display :: display_normal_message($display_message); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Store Feedback |
170 | 170 | |
171 | 171 | if (isset($_POST['feedback'])) { |
172 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
173 | - api_not_allowed(); |
|
174 | - } |
|
175 | - $check = Security::check_token(); |
|
176 | - if ($check) { |
|
177 | - $display_message = store_feedback(); |
|
178 | - Display :: display_normal_message($display_message); |
|
179 | - Security::check_token(); |
|
180 | - } |
|
172 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
173 | + api_not_allowed(); |
|
174 | + } |
|
175 | + $check = Security::check_token(); |
|
176 | + if ($check) { |
|
177 | + $display_message = store_feedback(); |
|
178 | + Display :: display_normal_message($display_message); |
|
179 | + Security::check_token(); |
|
180 | + } |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Error Message |
184 | 184 | if (isset($_GET['error']) AND !empty($_GET['error'])) { |
185 | - Display :: display_normal_message(get_lang($_GET['error'])); |
|
185 | + Display :: display_normal_message(get_lang($_GET['error'])); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $dropbox_data_sent = array(); |
@@ -190,96 +190,96 @@ discard block |
||
190 | 190 | $dropbox_data_recieved = array(); |
191 | 191 | |
192 | 192 | if ($action != 'add') { |
193 | - // Getting all the categories in the dropbox for the given user |
|
194 | - $dropbox_categories = get_dropbox_categories(); |
|
195 | - // Greating the arrays with the categories for the received files and for the sent files |
|
196 | - foreach ($dropbox_categories as $category) { |
|
197 | - if ($category['received'] == '1') { |
|
198 | - $dropbox_received_category[] = $category; |
|
199 | - } |
|
200 | - if ($category['sent'] == '1') { |
|
201 | - $dropbox_sent_category[] = $category; |
|
202 | - } |
|
203 | - } |
|
204 | - |
|
205 | - // ACTIONS |
|
206 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
207 | - //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
208 | - |
|
209 | - // This is for the categories |
|
210 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
211 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
212 | - } else { |
|
213 | - $view_dropbox_category_received = 0; |
|
214 | - } |
|
215 | - |
|
216 | - /* Menu Received */ |
|
217 | - |
|
218 | - if (api_get_session_id() == 0) { |
|
219 | - echo '<div class="actions">'; |
|
220 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
221 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
222 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
223 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
224 | - } else { |
|
225 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
226 | - } |
|
227 | - echo '</div>'; |
|
228 | - } else { |
|
229 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
230 | - echo '<div class="actions">'; |
|
231 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
232 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
233 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
234 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
235 | - } else { |
|
236 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
237 | - } |
|
238 | - echo '</div>'; |
|
239 | - } |
|
240 | - } |
|
241 | - } |
|
242 | - |
|
243 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
244 | - // This is for the categories |
|
245 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
246 | - $view_dropbox_category_sent = $viewSentCategory; |
|
247 | - } else { |
|
248 | - $view_dropbox_category_sent = 0; |
|
249 | - } |
|
250 | - |
|
251 | - /* Menu Sent */ |
|
252 | - |
|
253 | - if (api_get_session_id() == 0) { |
|
254 | - echo '<div class="actions">'; |
|
255 | - if ($view_dropbox_category_sent != 0) { |
|
256 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
257 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
258 | - } else { |
|
259 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
260 | - } |
|
261 | - if (empty($viewSentCategory)) { |
|
262 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
263 | - } |
|
264 | - echo '</div>'; |
|
265 | - } else { |
|
266 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
267 | - echo '<div class="actions">'; |
|
268 | - if ($view_dropbox_category_sent != 0) { |
|
269 | - echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
270 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
271 | - } else { |
|
272 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
273 | - } |
|
274 | - if (empty($viewSentCategory)) { |
|
275 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
276 | - } |
|
277 | - echo '</div>'; |
|
278 | - } |
|
279 | - } |
|
280 | - } |
|
281 | - /* THE MENU TABS */ |
|
282 | - if ($dropbox_cnf['sent_received_tabs']) { |
|
193 | + // Getting all the categories in the dropbox for the given user |
|
194 | + $dropbox_categories = get_dropbox_categories(); |
|
195 | + // Greating the arrays with the categories for the received files and for the sent files |
|
196 | + foreach ($dropbox_categories as $category) { |
|
197 | + if ($category['received'] == '1') { |
|
198 | + $dropbox_received_category[] = $category; |
|
199 | + } |
|
200 | + if ($category['sent'] == '1') { |
|
201 | + $dropbox_sent_category[] = $category; |
|
202 | + } |
|
203 | + } |
|
204 | + |
|
205 | + // ACTIONS |
|
206 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
207 | + //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
208 | + |
|
209 | + // This is for the categories |
|
210 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
211 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
212 | + } else { |
|
213 | + $view_dropbox_category_received = 0; |
|
214 | + } |
|
215 | + |
|
216 | + /* Menu Received */ |
|
217 | + |
|
218 | + if (api_get_session_id() == 0) { |
|
219 | + echo '<div class="actions">'; |
|
220 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
221 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
222 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
223 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
224 | + } else { |
|
225 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
226 | + } |
|
227 | + echo '</div>'; |
|
228 | + } else { |
|
229 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
230 | + echo '<div class="actions">'; |
|
231 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
232 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
233 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
234 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
235 | + } else { |
|
236 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
237 | + } |
|
238 | + echo '</div>'; |
|
239 | + } |
|
240 | + } |
|
241 | + } |
|
242 | + |
|
243 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
244 | + // This is for the categories |
|
245 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
246 | + $view_dropbox_category_sent = $viewSentCategory; |
|
247 | + } else { |
|
248 | + $view_dropbox_category_sent = 0; |
|
249 | + } |
|
250 | + |
|
251 | + /* Menu Sent */ |
|
252 | + |
|
253 | + if (api_get_session_id() == 0) { |
|
254 | + echo '<div class="actions">'; |
|
255 | + if ($view_dropbox_category_sent != 0) { |
|
256 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
257 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
258 | + } else { |
|
259 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
260 | + } |
|
261 | + if (empty($viewSentCategory)) { |
|
262 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
263 | + } |
|
264 | + echo '</div>'; |
|
265 | + } else { |
|
266 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
267 | + echo '<div class="actions">'; |
|
268 | + if ($view_dropbox_category_sent != 0) { |
|
269 | + echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
270 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
271 | + } else { |
|
272 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
273 | + } |
|
274 | + if (empty($viewSentCategory)) { |
|
275 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
276 | + } |
|
277 | + echo '</div>'; |
|
278 | + } |
|
279 | + } |
|
280 | + } |
|
281 | + /* THE MENU TABS */ |
|
282 | + if ($dropbox_cnf['sent_received_tabs']) { |
|
283 | 283 | ?> |
284 | 284 | <ul class="nav nav-tabs"> |
285 | 285 | <li <?php if (!$view || $view == 'sent') { echo 'class="active"'; } ?> > |
@@ -293,150 +293,150 @@ discard block |
||
293 | 293 | </li> |
294 | 294 | </ul> |
295 | 295 | <?php |
296 | - } |
|
296 | + } |
|
297 | 297 | /* RECEIVED FILES */ |
298 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
299 | - // This is for the categories |
|
300 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
301 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
302 | - } else { |
|
303 | - $view_dropbox_category_received = 0; |
|
304 | - } |
|
305 | - |
|
306 | - // Object initialisation |
|
307 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
308 | - // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
309 | - |
|
310 | - // Constructing the array that contains the total number of feedback messages per document. |
|
311 | - $number_feedback = get_total_number_feedback(); |
|
312 | - |
|
313 | - // Sorting and paging options |
|
314 | - $sorting_options = array(); |
|
315 | - $paging_options = array(); |
|
316 | - |
|
317 | - // The headers of the sortable tables |
|
318 | - $column_header = array(); |
|
319 | - $column_header[] = array('', false, ''); |
|
320 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
321 | - $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
322 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
323 | - $column_header[] = array(get_lang('Authors'), true, ''); |
|
324 | - $column_header[] = array(get_lang('LastResent'), true); |
|
325 | - |
|
326 | - if (api_get_session_id() == 0) { |
|
327 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
328 | - } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
329 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
330 | - } |
|
331 | - |
|
332 | - $column_header[] = array('RealDate', true); |
|
333 | - $column_header[] = array('RealSize', true); |
|
334 | - |
|
335 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
336 | - $column_show[] = 1; |
|
337 | - $column_show[] = 1; |
|
338 | - $column_show[] = 1; |
|
339 | - $column_show[] = 1; |
|
340 | - $column_show[] = 1; |
|
341 | - $column_show[] = 1; |
|
342 | - |
|
343 | - if (api_get_session_id() == 0) { |
|
344 | - $column_show[] = 1; |
|
345 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
346 | - $column_show[] = 1; |
|
347 | - } |
|
348 | - $column_show[] = 0; |
|
349 | - |
|
350 | - // Here we change the way how the columns are going to be sort |
|
351 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
352 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
353 | - |
|
354 | - $column_order[3] = 8; |
|
355 | - $column_order[5] = 7; |
|
356 | - |
|
357 | - // The content of the sortable table = the received files |
|
358 | - foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
359 | - $dropbox_file_data = array(); |
|
360 | - if ($view_dropbox_category_received == $dropbox_file->category) { |
|
298 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
299 | + // This is for the categories |
|
300 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
301 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
302 | + } else { |
|
303 | + $view_dropbox_category_received = 0; |
|
304 | + } |
|
305 | + |
|
306 | + // Object initialisation |
|
307 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
308 | + // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
309 | + |
|
310 | + // Constructing the array that contains the total number of feedback messages per document. |
|
311 | + $number_feedback = get_total_number_feedback(); |
|
312 | + |
|
313 | + // Sorting and paging options |
|
314 | + $sorting_options = array(); |
|
315 | + $paging_options = array(); |
|
316 | + |
|
317 | + // The headers of the sortable tables |
|
318 | + $column_header = array(); |
|
319 | + $column_header[] = array('', false, ''); |
|
320 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
321 | + $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
322 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
323 | + $column_header[] = array(get_lang('Authors'), true, ''); |
|
324 | + $column_header[] = array(get_lang('LastResent'), true); |
|
325 | + |
|
326 | + if (api_get_session_id() == 0) { |
|
327 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
328 | + } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
329 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
330 | + } |
|
331 | + |
|
332 | + $column_header[] = array('RealDate', true); |
|
333 | + $column_header[] = array('RealSize', true); |
|
334 | + |
|
335 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
336 | + $column_show[] = 1; |
|
337 | + $column_show[] = 1; |
|
338 | + $column_show[] = 1; |
|
339 | + $column_show[] = 1; |
|
340 | + $column_show[] = 1; |
|
341 | + $column_show[] = 1; |
|
342 | + |
|
343 | + if (api_get_session_id() == 0) { |
|
344 | + $column_show[] = 1; |
|
345 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
346 | + $column_show[] = 1; |
|
347 | + } |
|
348 | + $column_show[] = 0; |
|
349 | + |
|
350 | + // Here we change the way how the columns are going to be sort |
|
351 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
352 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
353 | + |
|
354 | + $column_order[3] = 8; |
|
355 | + $column_order[5] = 7; |
|
356 | + |
|
357 | + // The content of the sortable table = the received files |
|
358 | + foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
359 | + $dropbox_file_data = array(); |
|
360 | + if ($view_dropbox_category_received == $dropbox_file->category) { |
|
361 | 361 | // we only display the files that are in the category that we are in. |
362 | - $dropbox_file_data[] = $dropbox_file->id; |
|
362 | + $dropbox_file_data[] = $dropbox_file->id; |
|
363 | 363 | |
364 | - if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
365 | - $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
366 | - } |
|
364 | + if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
365 | + $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
366 | + } |
|
367 | 367 | |
368 | - // New icon |
|
369 | - $new_icon = ''; |
|
370 | - if ($dropbox_file->last_upload_date > $last_access && |
|
368 | + // New icon |
|
369 | + $new_icon = ''; |
|
370 | + if ($dropbox_file->last_upload_date > $last_access && |
|
371 | 371 | !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]) |
372 | 372 | ) { |
373 | - $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
374 | - } |
|
373 | + $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
374 | + } |
|
375 | 375 | |
376 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
377 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
378 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
376 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
377 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
378 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
379 | 379 | Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description; |
380 | - $file_size = $dropbox_file->filesize; |
|
381 | - $dropbox_file_data[] = format_file_size($file_size); |
|
382 | - $dropbox_file_data[] = $dropbox_file->author; |
|
380 | + $file_size = $dropbox_file->filesize; |
|
381 | + $dropbox_file_data[] = format_file_size($file_size); |
|
382 | + $dropbox_file_data[] = $dropbox_file->author; |
|
383 | 383 | |
384 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
385 | - $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
384 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
385 | + $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
386 | 386 | api_format_date($last_upload_date).'</span>'; |
387 | 387 | |
388 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
388 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
389 | 389 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
390 | 390 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
391 | 391 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'. |
392 | 392 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
393 | 393 | |
394 | - // This is a hack to have an additional row in a sortable table |
|
395 | - |
|
396 | - if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
397 | - $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
398 | - $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
399 | - } |
|
400 | - if (api_get_session_id() == 0) { |
|
401 | - $dropbox_file_data[] = $action_icons; |
|
402 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
403 | - $dropbox_file_data[] = $action_icons; |
|
404 | - } |
|
405 | - $action_icons = ''; |
|
406 | - $dropbox_file_data[] = $last_upload_date; |
|
407 | - $dropbox_file_data[] = $file_size; |
|
408 | - $dropbox_data_recieved[] = $dropbox_file_data; |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - // The content of the sortable table = the categories (if we are not in the root) |
|
413 | - if ($view_dropbox_category_received == 0) { |
|
414 | - foreach ($dropbox_categories as $category) { |
|
415 | - /* Note: This can probably be shortened since the categories |
|
394 | + // This is a hack to have an additional row in a sortable table |
|
395 | + |
|
396 | + if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
397 | + $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
398 | + $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
399 | + } |
|
400 | + if (api_get_session_id() == 0) { |
|
401 | + $dropbox_file_data[] = $action_icons; |
|
402 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
403 | + $dropbox_file_data[] = $action_icons; |
|
404 | + } |
|
405 | + $action_icons = ''; |
|
406 | + $dropbox_file_data[] = $last_upload_date; |
|
407 | + $dropbox_file_data[] = $file_size; |
|
408 | + $dropbox_data_recieved[] = $dropbox_file_data; |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + // The content of the sortable table = the categories (if we are not in the root) |
|
413 | + if ($view_dropbox_category_received == 0) { |
|
414 | + foreach ($dropbox_categories as $category) { |
|
415 | + /* Note: This can probably be shortened since the categories |
|
416 | 416 | for the received files are already in the |
417 | 417 | $dropbox_received_category array;*/ |
418 | - $dropbox_category_data = array(); |
|
419 | - if ($category['received'] == '1') { |
|
420 | - $movelist[$category['cat_id']] = $category['cat_name']; |
|
418 | + $dropbox_category_data = array(); |
|
419 | + if ($category['received'] == '1') { |
|
420 | + $movelist[$category['cat_id']] = $category['cat_name']; |
|
421 | 421 | // This is where the checkbox icon for the files appear |
422 | - $dropbox_category_data[] = $category['cat_id']; |
|
423 | - // The icon of the category |
|
424 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
425 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
426 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
427 | - $dropbox_category_data[] = ''; |
|
428 | - $dropbox_category_data[] = ''; |
|
429 | - $dropbox_category_data[] = ''; |
|
430 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
422 | + $dropbox_category_data[] = $category['cat_id']; |
|
423 | + // The icon of the category |
|
424 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
425 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
426 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
427 | + $dropbox_category_data[] = ''; |
|
428 | + $dropbox_category_data[] = ''; |
|
429 | + $dropbox_category_data[] = ''; |
|
430 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
431 | 431 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
432 | - } |
|
433 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
434 | - $dropbox_data_recieved[] = $dropbox_category_data; |
|
435 | - } |
|
436 | - } |
|
437 | - } |
|
438 | - |
|
439 | - // Displaying the table |
|
432 | + } |
|
433 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
434 | + $dropbox_data_recieved[] = $dropbox_category_data; |
|
435 | + } |
|
436 | + } |
|
437 | + } |
|
438 | + |
|
439 | + // Displaying the table |
|
440 | 440 | $additional_get_parameters = array( |
441 | 441 | 'view' => $view, |
442 | 442 | 'view_received_category' => $viewReceivedCategory, |
@@ -447,15 +447,15 @@ discard block |
||
447 | 447 | 'download_received' => get_lang('Download') |
448 | 448 | ); |
449 | 449 | |
450 | - if (is_array($movelist)) { |
|
451 | - foreach ($movelist as $catid => $catname){ |
|
452 | - $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
453 | - } |
|
454 | - } |
|
450 | + if (is_array($movelist)) { |
|
451 | + foreach ($movelist as $catid => $catname){ |
|
452 | + $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
453 | + } |
|
454 | + } |
|
455 | 455 | |
456 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
457 | - $selectlist = array(); |
|
458 | - } |
|
456 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
457 | + $selectlist = array(); |
|
458 | + } |
|
459 | 459 | echo '<div class="files-table">'; |
460 | 460 | Display::display_sortable_config_table( |
461 | 461 | 'dropbox', |
@@ -469,154 +469,154 @@ discard block |
||
469 | 469 | $selectlist |
470 | 470 | ); |
471 | 471 | echo '</div>'; |
472 | - } |
|
473 | - |
|
474 | - /* SENT FILES */ |
|
475 | - |
|
476 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
477 | - // This is for the categories |
|
478 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
479 | - $view_dropbox_category_sent = $viewSentCategory; |
|
480 | - } else { |
|
481 | - $view_dropbox_category_sent = 0; |
|
482 | - } |
|
483 | - |
|
484 | - // Object initialisation |
|
485 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
486 | - |
|
487 | - // Constructing the array that contains the total number of feedback messages per document. |
|
488 | - $number_feedback = get_total_number_feedback(); |
|
489 | - |
|
490 | - // Sorting and paging options |
|
491 | - $sorting_options = array(); |
|
492 | - $paging_options = array(); |
|
493 | - |
|
494 | - // The headers of the sortable tables |
|
495 | - $column_header = array(); |
|
496 | - |
|
497 | - $column_header[] = array('', false, ''); |
|
498 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
499 | - $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
500 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
501 | - $column_header[] = array(get_lang('SentTo'), true, ''); |
|
502 | - $column_header[] = array(get_lang('LastResent'), true, ''); |
|
503 | - |
|
504 | - if (api_get_session_id() == 0) { |
|
505 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
506 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
507 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
508 | - } |
|
509 | - |
|
510 | - $column_header[] = array('RealDate', true); |
|
511 | - $column_header[] = array('RealSize', true); |
|
512 | - |
|
513 | - $column_show = array(); |
|
514 | - $column_order = array(); |
|
515 | - |
|
516 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
517 | - $column_show[] = 1; |
|
518 | - $column_show[] = 1; |
|
519 | - $column_show[] = 1; |
|
520 | - $column_show[] = 1; |
|
521 | - $column_show[] = 1; |
|
522 | - $column_show[] = 1; |
|
523 | - if (api_get_session_id() == 0) { |
|
524 | - $column_show[] = 1; |
|
525 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
526 | - $column_show[] = 1; |
|
527 | - } |
|
528 | - $column_show[] = 0; |
|
529 | - |
|
530 | - // Here we change the way how the colums are going to be sort |
|
531 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
532 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
533 | - |
|
534 | - $column_order[3] = 8; |
|
535 | - $column_order[5] = 7; |
|
536 | - |
|
537 | - // The content of the sortable table = the received files |
|
538 | - foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
539 | - $dropbox_file_data = array(); |
|
540 | - |
|
541 | - if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
542 | - $dropbox_file_data[] = $dropbox_file->id; |
|
543 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
544 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
545 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
472 | + } |
|
473 | + |
|
474 | + /* SENT FILES */ |
|
475 | + |
|
476 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
477 | + // This is for the categories |
|
478 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
479 | + $view_dropbox_category_sent = $viewSentCategory; |
|
480 | + } else { |
|
481 | + $view_dropbox_category_sent = 0; |
|
482 | + } |
|
483 | + |
|
484 | + // Object initialisation |
|
485 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
486 | + |
|
487 | + // Constructing the array that contains the total number of feedback messages per document. |
|
488 | + $number_feedback = get_total_number_feedback(); |
|
489 | + |
|
490 | + // Sorting and paging options |
|
491 | + $sorting_options = array(); |
|
492 | + $paging_options = array(); |
|
493 | + |
|
494 | + // The headers of the sortable tables |
|
495 | + $column_header = array(); |
|
496 | + |
|
497 | + $column_header[] = array('', false, ''); |
|
498 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
499 | + $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
500 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
501 | + $column_header[] = array(get_lang('SentTo'), true, ''); |
|
502 | + $column_header[] = array(get_lang('LastResent'), true, ''); |
|
503 | + |
|
504 | + if (api_get_session_id() == 0) { |
|
505 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
506 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
507 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
508 | + } |
|
509 | + |
|
510 | + $column_header[] = array('RealDate', true); |
|
511 | + $column_header[] = array('RealSize', true); |
|
512 | + |
|
513 | + $column_show = array(); |
|
514 | + $column_order = array(); |
|
515 | + |
|
516 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
517 | + $column_show[] = 1; |
|
518 | + $column_show[] = 1; |
|
519 | + $column_show[] = 1; |
|
520 | + $column_show[] = 1; |
|
521 | + $column_show[] = 1; |
|
522 | + $column_show[] = 1; |
|
523 | + if (api_get_session_id() == 0) { |
|
524 | + $column_show[] = 1; |
|
525 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
526 | + $column_show[] = 1; |
|
527 | + } |
|
528 | + $column_show[] = 0; |
|
529 | + |
|
530 | + // Here we change the way how the colums are going to be sort |
|
531 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
532 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
533 | + |
|
534 | + $column_order[3] = 8; |
|
535 | + $column_order[5] = 7; |
|
536 | + |
|
537 | + // The content of the sortable table = the received files |
|
538 | + foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
539 | + $dropbox_file_data = array(); |
|
540 | + |
|
541 | + if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
542 | + $dropbox_file_data[] = $dropbox_file->id; |
|
543 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
544 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
545 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
546 | 546 | Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description; |
547 | - $file_size = $dropbox_file->filesize; |
|
548 | - $dropbox_file_data[] = format_file_size($file_size); |
|
547 | + $file_size = $dropbox_file->filesize; |
|
548 | + $dropbox_file_data[] = format_file_size($file_size); |
|
549 | 549 | $receivers_celldata = null; |
550 | - foreach ($dropbox_file->recipients as $recipient) { |
|
551 | - $userInfo = api_get_user_info($recipient['user_id']); |
|
552 | - $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
553 | - } |
|
554 | - $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
555 | - $dropbox_file_data[] = $receivers_celldata; |
|
556 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
557 | - $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
558 | - api_format_date($last_upload_date).'</span>'; |
|
559 | - |
|
560 | - //$dropbox_file_data[] = $dropbox_file->author; |
|
561 | - $receivers_celldata = ''; |
|
562 | - |
|
563 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
550 | + foreach ($dropbox_file->recipients as $recipient) { |
|
551 | + $userInfo = api_get_user_info($recipient['user_id']); |
|
552 | + $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
553 | + } |
|
554 | + $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
555 | + $dropbox_file_data[] = $receivers_celldata; |
|
556 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
557 | + $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
558 | + api_format_date($last_upload_date).'</span>'; |
|
559 | + |
|
560 | + //$dropbox_file_data[] = $dropbox_file->author; |
|
561 | + $receivers_celldata = ''; |
|
562 | + |
|
563 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
564 | 564 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
565 | 565 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
566 | 566 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
567 | - // This is a hack to have an additional row in a sortable table |
|
568 | - if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
569 | - $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
570 | - $action_icons .= "<tr><td colspan=\"2\">"; |
|
571 | - $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
572 | - $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
573 | - } |
|
574 | - $dropbox_file_data[] = $action_icons; |
|
575 | - $dropbox_file_data[] = $last_upload_date; |
|
576 | - $dropbox_file_data[] = $file_size; |
|
577 | - $action_icons = ''; |
|
578 | - $dropbox_data_sent[] = $dropbox_file_data; |
|
579 | - } |
|
580 | - } |
|
567 | + // This is a hack to have an additional row in a sortable table |
|
568 | + if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
569 | + $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
570 | + $action_icons .= "<tr><td colspan=\"2\">"; |
|
571 | + $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
572 | + $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
573 | + } |
|
574 | + $dropbox_file_data[] = $action_icons; |
|
575 | + $dropbox_file_data[] = $last_upload_date; |
|
576 | + $dropbox_file_data[] = $file_size; |
|
577 | + $action_icons = ''; |
|
578 | + $dropbox_data_sent[] = $dropbox_file_data; |
|
579 | + } |
|
580 | + } |
|
581 | 581 | |
582 | 582 | $moveList = array(); |
583 | - // The content of the sortable table = the categories (if we are not in the root) |
|
584 | - if ($view_dropbox_category_sent == 0) { |
|
585 | - foreach ($dropbox_categories as $category) { |
|
586 | - $dropbox_category_data = array(); |
|
583 | + // The content of the sortable table = the categories (if we are not in the root) |
|
584 | + if ($view_dropbox_category_sent == 0) { |
|
585 | + foreach ($dropbox_categories as $category) { |
|
586 | + $dropbox_category_data = array(); |
|
587 | 587 | |
588 | - if ($category['sent'] == '1') { |
|
588 | + if ($category['sent'] == '1') { |
|
589 | 589 | |
590 | 590 | $moveList[$category['cat_id']] = $category['cat_name']; |
591 | - $dropbox_category_data[] = $category['cat_id']; |
|
592 | - // This is where the checkbox icon for the files appear. |
|
593 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
594 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
595 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
596 | - //$dropbox_category_data[] = ''; |
|
597 | - $dropbox_category_data[] = ''; |
|
598 | - //$dropbox_category_data[] = ''; |
|
599 | - $dropbox_category_data[] = ''; |
|
600 | - $dropbox_category_data[] = ''; |
|
601 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
591 | + $dropbox_category_data[] = $category['cat_id']; |
|
592 | + // This is where the checkbox icon for the files appear. |
|
593 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
594 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
595 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
596 | + //$dropbox_category_data[] = ''; |
|
597 | + $dropbox_category_data[] = ''; |
|
598 | + //$dropbox_category_data[] = ''; |
|
599 | + $dropbox_category_data[] = ''; |
|
600 | + $dropbox_category_data[] = ''; |
|
601 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
602 | 602 | Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
603 | 603 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'. |
604 | 604 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
605 | - } |
|
606 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
607 | - $dropbox_data_sent[] = $dropbox_category_data; |
|
608 | - } |
|
609 | - } |
|
610 | - } |
|
611 | - |
|
612 | - // Displaying the table |
|
613 | - $additional_get_parameters = array( |
|
605 | + } |
|
606 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
607 | + $dropbox_data_sent[] = $dropbox_category_data; |
|
608 | + } |
|
609 | + } |
|
610 | + } |
|
611 | + |
|
612 | + // Displaying the table |
|
613 | + $additional_get_parameters = array( |
|
614 | 614 | 'view' => $view, |
615 | 615 | 'view_received_category' => $viewReceivedCategory, |
616 | 616 | 'view_sent_category' => $viewSentCategory |
617 | 617 | ); |
618 | 618 | |
619 | - $selectlist = array( |
|
619 | + $selectlist = array( |
|
620 | 620 | 'delete_received' => get_lang('Delete'), |
621 | 621 | 'download_received' => get_lang('Download') |
622 | 622 | ); |
@@ -627,12 +627,12 @@ discard block |
||
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
631 | - $selectlist = array('download_received' => get_lang('Download')); |
|
632 | - } |
|
630 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
631 | + $selectlist = array('download_received' => get_lang('Download')); |
|
632 | + } |
|
633 | 633 | |
634 | 634 | echo '<div class="files-table">'; |
635 | - Display::display_sortable_config_table( |
|
635 | + Display::display_sortable_config_table( |
|
636 | 636 | 'dropbox', |
637 | 637 | $column_header, |
638 | 638 | $dropbox_data_sent, |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $selectlist |
645 | 645 | ); |
646 | 646 | echo '</div>'; |
647 | - } |
|
647 | + } |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | Display::display_footer(); |
@@ -852,14 +852,14 @@ discard block |
||
852 | 852 | $email = false; |
853 | 853 | } |
854 | 854 | |
855 | - if ($email) { |
|
856 | - $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
857 | - } else { |
|
855 | + if ($email) { |
|
856 | + $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
857 | + } else { |
|
858 | 858 | $condition = "LOWER(username) = '".Database::escape_string($username)."'"; |
859 | 859 | } |
860 | 860 | |
861 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
862 | - $query = "SELECT |
|
861 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
862 | + $query = "SELECT |
|
863 | 863 | user_id AS uid, |
864 | 864 | lastname AS lastName, |
865 | 865 | firstname AS firstName, |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | auth_source |
875 | 875 | FROM $tbl_user |
876 | 876 | WHERE ( $condition AND active = 1) "; |
877 | - $result = Database::query($query); |
|
877 | + $result = Database::query($query); |
|
878 | 878 | $num_rows = Database::num_rows($result); |
879 | 879 | if ($result && $num_rows > 0) { |
880 | 880 | return Database::fetch_assoc($result); |
@@ -44,107 +44,107 @@ discard block |
||
44 | 44 | |
45 | 45 | class BigBlueButtonBN { |
46 | 46 | |
47 | - private $_securitySalt; |
|
48 | - private $_bbbServerBaseUrl; |
|
47 | + private $_securitySalt; |
|
48 | + private $_bbbServerBaseUrl; |
|
49 | 49 | |
50 | - /* ___________ General Methods for the BigBlueButton Class __________ */ |
|
50 | + /* ___________ General Methods for the BigBlueButton Class __________ */ |
|
51 | 51 | |
52 | - function __construct() { |
|
53 | - /* |
|
52 | + function __construct() { |
|
53 | + /* |
|
54 | 54 | Establish just our basic elements in the constructor: |
55 | 55 | */ |
56 | - // BASE CONFIGS - set these for your BBB server in config.php and they will |
|
57 | - // simply flow in here via the constants: |
|
58 | - $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | - $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | - } |
|
61 | - |
|
62 | - private function _processXmlResponse($url){ |
|
63 | - /* |
|
56 | + // BASE CONFIGS - set these for your BBB server in config.php and they will |
|
57 | + // simply flow in here via the constants: |
|
58 | + $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | + $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | + } |
|
61 | + |
|
62 | + private function _processXmlResponse($url){ |
|
63 | + /* |
|
64 | 64 | A private utility method used by other public methods to process XML responses. |
65 | 65 | */ |
66 | - if (extension_loaded('curl')) { |
|
67 | - $ch = curl_init() or die ( curl_error($ch) ); |
|
68 | - $timeout = 10; |
|
69 | - curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | - curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | - curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | - $data = curl_exec( $ch ); |
|
74 | - curl_close( $ch ); |
|
75 | - |
|
76 | - if($data) |
|
77 | - return (new SimpleXMLElement($data)); |
|
78 | - else |
|
79 | - return false; |
|
80 | - } |
|
81 | - return (simplexml_load_file($url)); |
|
82 | - } |
|
83 | - |
|
84 | - private function _requiredParam($param) { |
|
85 | - /* Process required params and throw errors if we don't get values */ |
|
86 | - if ((isset($param)) && ($param != '')) { |
|
87 | - return $param; |
|
88 | - } |
|
89 | - elseif (!isset($param)) { |
|
90 | - throw new Exception('Missing parameter.'); |
|
91 | - } |
|
92 | - else { |
|
93 | - throw new Exception(''.$param.' is required.'); |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - private function _optionalParam($param) { |
|
98 | - /* Pass most optional params through as set value, or set to '' */ |
|
99 | - /* Don't know if we'll use this one, but let's build it in case. */ |
|
100 | - if ((isset($param)) && ($param != '')) { |
|
101 | - return $param; |
|
102 | - } |
|
103 | - else { |
|
104 | - $param = ''; |
|
105 | - return $param; |
|
106 | - } |
|
107 | - } |
|
108 | - |
|
109 | - /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
|
110 | - /* The methods in the following section support the following categories of the BBB API: |
|
66 | + if (extension_loaded('curl')) { |
|
67 | + $ch = curl_init() or die ( curl_error($ch) ); |
|
68 | + $timeout = 10; |
|
69 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | + curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | + $data = curl_exec( $ch ); |
|
74 | + curl_close( $ch ); |
|
75 | + |
|
76 | + if($data) |
|
77 | + return (new SimpleXMLElement($data)); |
|
78 | + else |
|
79 | + return false; |
|
80 | + } |
|
81 | + return (simplexml_load_file($url)); |
|
82 | + } |
|
83 | + |
|
84 | + private function _requiredParam($param) { |
|
85 | + /* Process required params and throw errors if we don't get values */ |
|
86 | + if ((isset($param)) && ($param != '')) { |
|
87 | + return $param; |
|
88 | + } |
|
89 | + elseif (!isset($param)) { |
|
90 | + throw new Exception('Missing parameter.'); |
|
91 | + } |
|
92 | + else { |
|
93 | + throw new Exception(''.$param.' is required.'); |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + private function _optionalParam($param) { |
|
98 | + /* Pass most optional params through as set value, or set to '' */ |
|
99 | + /* Don't know if we'll use this one, but let's build it in case. */ |
|
100 | + if ((isset($param)) && ($param != '')) { |
|
101 | + return $param; |
|
102 | + } |
|
103 | + else { |
|
104 | + $param = ''; |
|
105 | + return $param; |
|
106 | + } |
|
107 | + } |
|
108 | + |
|
109 | + /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
|
110 | + /* The methods in the following section support the following categories of the BBB API: |
|
111 | 111 | -- create |
112 | 112 | -- join |
113 | 113 | -- end |
114 | 114 | */ |
115 | 115 | |
116 | - public function getCreateMeetingUrl($creationParams) { |
|
117 | - /* |
|
116 | + public function getCreateMeetingUrl($creationParams) { |
|
117 | + /* |
|
118 | 118 | USAGE: |
119 | 119 | (see $creationParams array in createMeetingArray method.) |
120 | 120 | */ |
121 | - $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); |
|
122 | - $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); |
|
123 | - // Set up the basic creation URL: |
|
124 | - $creationUrl = $this->_bbbServerBaseUrl."api/create?"; |
|
125 | - // Add params: |
|
126 | - $params = |
|
127 | - 'name='.urlencode($this->_meetingName). |
|
128 | - '&meetingID='.urlencode($this->_meetingId). |
|
129 | - '&attendeePW='.urlencode($creationParams['attendeePw']). |
|
130 | - '&moderatorPW='.urlencode($creationParams['moderatorPw']). |
|
131 | - '&dialNumber='.urlencode($creationParams['dialNumber']). |
|
132 | - '&voiceBridge='.urlencode($creationParams['voiceBridge']). |
|
133 | - '&webVoice='.urlencode($creationParams['webVoice']). |
|
134 | - '&logoutURL='.urlencode($creationParams['logoutUrl']). |
|
135 | - '&maxParticipants='.urlencode($creationParams['maxParticipants']). |
|
136 | - '&record='.urlencode($creationParams['record']). |
|
137 | - '&duration='.urlencode($creationParams['duration']); |
|
138 | - //'&meta_category='.urlencode($creationParams['meta_category']); |
|
139 | - $welcomeMessage = $creationParams['welcomeMsg']; |
|
140 | - if(trim($welcomeMessage)) |
|
141 | - $params .= '&welcome='.urlencode($welcomeMessage); |
|
142 | - // Return the complete URL: |
|
143 | - return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
144 | - } |
|
145 | - |
|
146 | - public function createMeetingWithXmlResponseArray($creationParams) { |
|
147 | - /* |
|
121 | + $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); |
|
122 | + $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); |
|
123 | + // Set up the basic creation URL: |
|
124 | + $creationUrl = $this->_bbbServerBaseUrl."api/create?"; |
|
125 | + // Add params: |
|
126 | + $params = |
|
127 | + 'name='.urlencode($this->_meetingName). |
|
128 | + '&meetingID='.urlencode($this->_meetingId). |
|
129 | + '&attendeePW='.urlencode($creationParams['attendeePw']). |
|
130 | + '&moderatorPW='.urlencode($creationParams['moderatorPw']). |
|
131 | + '&dialNumber='.urlencode($creationParams['dialNumber']). |
|
132 | + '&voiceBridge='.urlencode($creationParams['voiceBridge']). |
|
133 | + '&webVoice='.urlencode($creationParams['webVoice']). |
|
134 | + '&logoutURL='.urlencode($creationParams['logoutUrl']). |
|
135 | + '&maxParticipants='.urlencode($creationParams['maxParticipants']). |
|
136 | + '&record='.urlencode($creationParams['record']). |
|
137 | + '&duration='.urlencode($creationParams['duration']); |
|
138 | + //'&meta_category='.urlencode($creationParams['meta_category']); |
|
139 | + $welcomeMessage = $creationParams['welcomeMsg']; |
|
140 | + if(trim($welcomeMessage)) |
|
141 | + $params .= '&welcome='.urlencode($welcomeMessage); |
|
142 | + // Return the complete URL: |
|
143 | + return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
144 | + } |
|
145 | + |
|
146 | + public function createMeetingWithXmlResponseArray($creationParams) { |
|
147 | + /* |
|
148 | 148 | USAGE: |
149 | 149 | $creationParams = array( |
150 | 150 | 'name' => 'Meeting Name', -- A name for the meeting (or username) |
@@ -162,34 +162,34 @@ discard block |
||
162 | 162 | 'meta_category' => '', -- Use to pass additional info to BBB server. See API docs to enable. |
163 | 163 | ); |
164 | 164 | */ |
165 | - $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
|
165 | + $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
|
166 | 166 | |
167 | 167 | if ($xml) { |
168 | - if($xml->meetingID) |
|
169 | - return array( |
|
170 | - 'returncode' => $xml->returncode, |
|
171 | - 'message' => $xml->message, |
|
172 | - 'messageKey' => $xml->messageKey, |
|
173 | - 'meetingId' => $xml->meetingID, |
|
174 | - 'attendeePw' => $xml->attendeePW, |
|
175 | - 'moderatorPw' => $xml->moderatorPW, |
|
176 | - 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, |
|
177 | - 'createTime' => $xml->createTime |
|
178 | - ); |
|
179 | - else |
|
180 | - return array( |
|
181 | - 'returncode' => $xml->returncode, |
|
182 | - 'message' => $xml->message, |
|
183 | - 'messageKey' => $xml->messageKey |
|
184 | - ); |
|
185 | - } |
|
186 | - else { |
|
187 | - return null; |
|
188 | - } |
|
189 | - } |
|
190 | - |
|
191 | - public function getJoinMeetingURL($joinParams) { |
|
192 | - /* |
|
168 | + if($xml->meetingID) |
|
169 | + return array( |
|
170 | + 'returncode' => $xml->returncode, |
|
171 | + 'message' => $xml->message, |
|
172 | + 'messageKey' => $xml->messageKey, |
|
173 | + 'meetingId' => $xml->meetingID, |
|
174 | + 'attendeePw' => $xml->attendeePW, |
|
175 | + 'moderatorPw' => $xml->moderatorPW, |
|
176 | + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, |
|
177 | + 'createTime' => $xml->createTime |
|
178 | + ); |
|
179 | + else |
|
180 | + return array( |
|
181 | + 'returncode' => $xml->returncode, |
|
182 | + 'message' => $xml->message, |
|
183 | + 'messageKey' => $xml->messageKey |
|
184 | + ); |
|
185 | + } |
|
186 | + else { |
|
187 | + return null; |
|
188 | + } |
|
189 | + } |
|
190 | + |
|
191 | + public function getJoinMeetingURL($joinParams) { |
|
192 | + /* |
|
193 | 193 | NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API |
194 | 194 | doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL |
195 | 195 | that's returned from this method and simply send your users off to that URL in your code. |
@@ -203,249 +203,249 @@ discard block |
||
203 | 203 | 'webVoiceConf' => '' -- OPTIONAL - string |
204 | 204 | ); |
205 | 205 | */ |
206 | - $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); |
|
207 | - $this->_username = $this->_requiredParam($joinParams['username']); |
|
208 | - $this->_password = $this->_requiredParam($joinParams['password']); |
|
209 | - // Establish the basic join URL: |
|
210 | - $joinUrl = $this->_bbbServerBaseUrl."api/join?"; |
|
211 | - // Add parameters to the URL: |
|
212 | - $params = |
|
213 | - 'meetingID='.urlencode($this->_meetingId). |
|
214 | - '&fullName='.urlencode($this->_username). |
|
215 | - '&password='.urlencode($this->_password). |
|
216 | - '&userID='.urlencode($joinParams['userID']). |
|
217 | - '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); |
|
218 | - // Only use createTime if we really want to use it. If it's '', then don't pass it: |
|
219 | - if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { |
|
220 | - $params .= '&createTime='.urlencode($joinParams['createTime']); |
|
221 | - } |
|
222 | - // Return the URL: |
|
223 | - return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); |
|
224 | - } |
|
225 | - |
|
226 | - public function getEndMeetingURL($endParams) { |
|
227 | - /* USAGE: |
|
206 | + $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); |
|
207 | + $this->_username = $this->_requiredParam($joinParams['username']); |
|
208 | + $this->_password = $this->_requiredParam($joinParams['password']); |
|
209 | + // Establish the basic join URL: |
|
210 | + $joinUrl = $this->_bbbServerBaseUrl."api/join?"; |
|
211 | + // Add parameters to the URL: |
|
212 | + $params = |
|
213 | + 'meetingID='.urlencode($this->_meetingId). |
|
214 | + '&fullName='.urlencode($this->_username). |
|
215 | + '&password='.urlencode($this->_password). |
|
216 | + '&userID='.urlencode($joinParams['userID']). |
|
217 | + '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); |
|
218 | + // Only use createTime if we really want to use it. If it's '', then don't pass it: |
|
219 | + if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { |
|
220 | + $params .= '&createTime='.urlencode($joinParams['createTime']); |
|
221 | + } |
|
222 | + // Return the URL: |
|
223 | + return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); |
|
224 | + } |
|
225 | + |
|
226 | + public function getEndMeetingURL($endParams) { |
|
227 | + /* USAGE: |
|
228 | 228 | $endParams = array ( |
229 | 229 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
230 | 230 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
231 | 231 | ); |
232 | 232 | */ |
233 | - $this->_meetingId = $this->_requiredParam($endParams['meetingId']); |
|
234 | - $this->_password = $this->_requiredParam($endParams['password']); |
|
235 | - $endUrl = $this->_bbbServerBaseUrl."api/end?"; |
|
236 | - $params = |
|
237 | - 'meetingID='.urlencode($this->_meetingId). |
|
238 | - '&password='.urlencode($this->_password); |
|
239 | - return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); |
|
240 | - } |
|
241 | - |
|
242 | - public function endMeetingWithXmlResponseArray($endParams) { |
|
243 | - /* USAGE: |
|
233 | + $this->_meetingId = $this->_requiredParam($endParams['meetingId']); |
|
234 | + $this->_password = $this->_requiredParam($endParams['password']); |
|
235 | + $endUrl = $this->_bbbServerBaseUrl."api/end?"; |
|
236 | + $params = |
|
237 | + 'meetingID='.urlencode($this->_meetingId). |
|
238 | + '&password='.urlencode($this->_password); |
|
239 | + return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); |
|
240 | + } |
|
241 | + |
|
242 | + public function endMeetingWithXmlResponseArray($endParams) { |
|
243 | + /* USAGE: |
|
244 | 244 | $endParams = array ( |
245 | 245 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
246 | 246 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
247 | 247 | ); |
248 | 248 | */ |
249 | - $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); |
|
250 | - if ($xml) { |
|
251 | - return array( |
|
252 | - 'returncode' => $xml->returncode, |
|
253 | - 'message' => $xml->message, |
|
254 | - 'messageKey' => $xml->messageKey |
|
255 | - ); |
|
256 | - } |
|
257 | - else { |
|
258 | - return null; |
|
259 | - } |
|
260 | - |
|
261 | - } |
|
262 | - |
|
263 | - /* __________________ BBB MONITORING METHODS _________________ */ |
|
264 | - /* The methods in the following section support the following categories of the BBB API: |
|
249 | + $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); |
|
250 | + if ($xml) { |
|
251 | + return array( |
|
252 | + 'returncode' => $xml->returncode, |
|
253 | + 'message' => $xml->message, |
|
254 | + 'messageKey' => $xml->messageKey |
|
255 | + ); |
|
256 | + } |
|
257 | + else { |
|
258 | + return null; |
|
259 | + } |
|
260 | + |
|
261 | + } |
|
262 | + |
|
263 | + /* __________________ BBB MONITORING METHODS _________________ */ |
|
264 | + /* The methods in the following section support the following categories of the BBB API: |
|
265 | 265 | -- isMeetingRunning |
266 | 266 | -- getMeetings |
267 | 267 | -- getMeetingInfo |
268 | 268 | */ |
269 | 269 | |
270 | - public function getIsMeetingRunningUrl($meetingId) { |
|
271 | - /* USAGE: |
|
270 | + public function getIsMeetingRunningUrl($meetingId) { |
|
271 | + /* USAGE: |
|
272 | 272 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
273 | 273 | */ |
274 | - $this->_meetingId = $this->_requiredParam($meetingId); |
|
275 | - $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; |
|
276 | - $params = |
|
277 | - 'meetingID='.urlencode($this->_meetingId); |
|
278 | - return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); |
|
279 | - } |
|
280 | - |
|
281 | - public function isMeetingRunningWithXmlResponseArray($meetingId) { |
|
282 | - /* USAGE: |
|
274 | + $this->_meetingId = $this->_requiredParam($meetingId); |
|
275 | + $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; |
|
276 | + $params = |
|
277 | + 'meetingID='.urlencode($this->_meetingId); |
|
278 | + return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); |
|
279 | + } |
|
280 | + |
|
281 | + public function isMeetingRunningWithXmlResponseArray($meetingId) { |
|
282 | + /* USAGE: |
|
283 | 283 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
284 | 284 | */ |
285 | - $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
|
286 | - if($xml) { |
|
287 | - return array( |
|
288 | - 'returncode' => $xml->returncode, |
|
289 | - 'running' => $xml->running // -- Returns true/false. |
|
290 | - ); |
|
291 | - } |
|
292 | - else { |
|
293 | - return null; |
|
294 | - } |
|
295 | - |
|
296 | - } |
|
297 | - |
|
298 | - public function getGetMeetingsUrl() { |
|
299 | - /* Simply formulate the getMeetings URL |
|
285 | + $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
|
286 | + if($xml) { |
|
287 | + return array( |
|
288 | + 'returncode' => $xml->returncode, |
|
289 | + 'running' => $xml->running // -- Returns true/false. |
|
290 | + ); |
|
291 | + } |
|
292 | + else { |
|
293 | + return null; |
|
294 | + } |
|
295 | + |
|
296 | + } |
|
297 | + |
|
298 | + public function getGetMeetingsUrl() { |
|
299 | + /* Simply formulate the getMeetings URL |
|
300 | 300 | We do this in a separate function so we have the option to just get this |
301 | 301 | URL and print it if we want for some reason. |
302 | 302 | */ |
303 | - $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); |
|
304 | - return $getMeetingsUrl; |
|
305 | - } |
|
303 | + $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); |
|
304 | + return $getMeetingsUrl; |
|
305 | + } |
|
306 | 306 | |
307 | - public function getMeetingsWithXmlResponseArray() { |
|
308 | - /* USAGE: |
|
307 | + public function getMeetingsWithXmlResponseArray() { |
|
308 | + /* USAGE: |
|
309 | 309 | We don't need to pass any parameters with this one, so we just send the query URL off to BBB |
310 | 310 | and then handle the results that we get in the XML response. |
311 | 311 | */ |
312 | - $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
|
313 | - if($xml) { |
|
314 | - // If we don't get a success code, stop processing and return just the returncode: |
|
315 | - if ($xml->returncode != 'SUCCESS') { |
|
316 | - $result = array( |
|
317 | - 'returncode' => $xml->returncode |
|
318 | - ); |
|
319 | - return $result; |
|
320 | - } |
|
321 | - elseif ($xml->messageKey == 'noMeetings') { |
|
322 | - /* No meetings on server, so return just this info: */ |
|
323 | - $result = array( |
|
324 | - 'returncode' => $xml->returncode, |
|
325 | - 'messageKey' => $xml->messageKey, |
|
326 | - 'message' => $xml->message |
|
327 | - ); |
|
328 | - return $result; |
|
329 | - } |
|
330 | - else { |
|
331 | - // In this case, we have success and meetings. First return general response: |
|
332 | - $result = array( |
|
333 | - 'returncode' => $xml->returncode, |
|
334 | - 'messageKey' => $xml->messageKey, |
|
335 | - 'message' => $xml->message |
|
336 | - ); |
|
337 | - // Then interate through meeting results and return them as part of the array: |
|
338 | - foreach ($xml->meetings->meeting as $m) { |
|
339 | - $result[] = array( |
|
340 | - 'meetingId' => $m->meetingID, |
|
341 | - 'meetingName' => $m->meetingName, |
|
342 | - 'createTime' => $m->createTime, |
|
343 | - 'attendeePw' => $m->attendeePW, |
|
344 | - 'moderatorPw' => $m->moderatorPW, |
|
345 | - 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded, |
|
346 | - 'running' => $m->running |
|
347 | - ); |
|
348 | - } |
|
349 | - return $result; |
|
350 | - } |
|
351 | - } |
|
352 | - else { |
|
353 | - return null; |
|
354 | - } |
|
355 | - |
|
356 | - } |
|
357 | - |
|
358 | - public function getMeetingInfoUrl($infoParams) { |
|
359 | - /* USAGE: |
|
312 | + $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
|
313 | + if($xml) { |
|
314 | + // If we don't get a success code, stop processing and return just the returncode: |
|
315 | + if ($xml->returncode != 'SUCCESS') { |
|
316 | + $result = array( |
|
317 | + 'returncode' => $xml->returncode |
|
318 | + ); |
|
319 | + return $result; |
|
320 | + } |
|
321 | + elseif ($xml->messageKey == 'noMeetings') { |
|
322 | + /* No meetings on server, so return just this info: */ |
|
323 | + $result = array( |
|
324 | + 'returncode' => $xml->returncode, |
|
325 | + 'messageKey' => $xml->messageKey, |
|
326 | + 'message' => $xml->message |
|
327 | + ); |
|
328 | + return $result; |
|
329 | + } |
|
330 | + else { |
|
331 | + // In this case, we have success and meetings. First return general response: |
|
332 | + $result = array( |
|
333 | + 'returncode' => $xml->returncode, |
|
334 | + 'messageKey' => $xml->messageKey, |
|
335 | + 'message' => $xml->message |
|
336 | + ); |
|
337 | + // Then interate through meeting results and return them as part of the array: |
|
338 | + foreach ($xml->meetings->meeting as $m) { |
|
339 | + $result[] = array( |
|
340 | + 'meetingId' => $m->meetingID, |
|
341 | + 'meetingName' => $m->meetingName, |
|
342 | + 'createTime' => $m->createTime, |
|
343 | + 'attendeePw' => $m->attendeePW, |
|
344 | + 'moderatorPw' => $m->moderatorPW, |
|
345 | + 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded, |
|
346 | + 'running' => $m->running |
|
347 | + ); |
|
348 | + } |
|
349 | + return $result; |
|
350 | + } |
|
351 | + } |
|
352 | + else { |
|
353 | + return null; |
|
354 | + } |
|
355 | + |
|
356 | + } |
|
357 | + |
|
358 | + public function getMeetingInfoUrl($infoParams) { |
|
359 | + /* USAGE: |
|
360 | 360 | $infoParams = array( |
361 | 361 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
362 | 362 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
363 | 363 | ); |
364 | 364 | */ |
365 | - $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); |
|
366 | - $this->_password = $this->_requiredParam($infoParams['password']); |
|
367 | - $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; |
|
368 | - $params = |
|
369 | - 'meetingID='.urlencode($this->_meetingId). |
|
370 | - '&password='.urlencode($this->_password); |
|
371 | - return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); |
|
372 | - } |
|
373 | - |
|
374 | - public function getMeetingInfoWithXmlResponseArray($infoParams) { |
|
375 | - /* USAGE: |
|
365 | + $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); |
|
366 | + $this->_password = $this->_requiredParam($infoParams['password']); |
|
367 | + $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; |
|
368 | + $params = |
|
369 | + 'meetingID='.urlencode($this->_meetingId). |
|
370 | + '&password='.urlencode($this->_password); |
|
371 | + return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); |
|
372 | + } |
|
373 | + |
|
374 | + public function getMeetingInfoWithXmlResponseArray($infoParams) { |
|
375 | + /* USAGE: |
|
376 | 376 | $infoParams = array( |
377 | 377 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
378 | 378 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
379 | 379 | ); |
380 | 380 | */ |
381 | - $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
|
382 | - if($xml) { |
|
383 | - // If we don't get a success code or messageKey, find out why: |
|
384 | - if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
385 | - $result = array( |
|
386 | - 'returncode' => $xml->returncode, |
|
387 | - 'messageKey' => $xml->messageKey, |
|
388 | - 'message' => $xml->message |
|
389 | - ); |
|
390 | - return $result; |
|
391 | - } |
|
392 | - else { |
|
393 | - // In this case, we have success and meeting info: |
|
394 | - $result = array( |
|
395 | - 'returncode' => $xml->returncode, |
|
396 | - 'meetingName' => $xml->meetingName, |
|
397 | - 'meetingId' => $xml->meetingID, |
|
398 | - 'createTime' => $xml->createTime, |
|
399 | - 'voiceBridge' => $xml->voiceBridge, |
|
400 | - 'attendeePw' => $xml->attendeePW, |
|
401 | - 'moderatorPw' => $xml->moderatorPW, |
|
402 | - 'running' => $xml->running, |
|
403 | - 'recording' => $xml->recording, |
|
404 | - 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, |
|
405 | - 'startTime' => $xml->startTime, |
|
406 | - 'endTime' => $xml->endTime, |
|
407 | - 'participantCount' => $xml->participantCount, |
|
408 | - 'maxUsers' => $xml->maxUsers, |
|
409 | - 'moderatorCount' => $xml->moderatorCount, |
|
410 | - ); |
|
411 | - // Then interate through attendee results and return them as part of the array: |
|
412 | - foreach ($xml->attendees->attendee as $a) { |
|
413 | - $result[] = array( |
|
414 | - 'userId' => $a->userID, |
|
415 | - 'fullName' => $a->fullName, |
|
416 | - 'role' => $a->role |
|
417 | - ); |
|
418 | - } |
|
419 | - return $result; |
|
420 | - } |
|
421 | - } |
|
422 | - else { |
|
423 | - return null; |
|
424 | - } |
|
425 | - |
|
426 | - } |
|
427 | - |
|
428 | - /* __________________ BBB RECORDING METHODS _________________ */ |
|
429 | - /* The methods in the following section support the following categories of the BBB API: |
|
381 | + $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
|
382 | + if($xml) { |
|
383 | + // If we don't get a success code or messageKey, find out why: |
|
384 | + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
385 | + $result = array( |
|
386 | + 'returncode' => $xml->returncode, |
|
387 | + 'messageKey' => $xml->messageKey, |
|
388 | + 'message' => $xml->message |
|
389 | + ); |
|
390 | + return $result; |
|
391 | + } |
|
392 | + else { |
|
393 | + // In this case, we have success and meeting info: |
|
394 | + $result = array( |
|
395 | + 'returncode' => $xml->returncode, |
|
396 | + 'meetingName' => $xml->meetingName, |
|
397 | + 'meetingId' => $xml->meetingID, |
|
398 | + 'createTime' => $xml->createTime, |
|
399 | + 'voiceBridge' => $xml->voiceBridge, |
|
400 | + 'attendeePw' => $xml->attendeePW, |
|
401 | + 'moderatorPw' => $xml->moderatorPW, |
|
402 | + 'running' => $xml->running, |
|
403 | + 'recording' => $xml->recording, |
|
404 | + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, |
|
405 | + 'startTime' => $xml->startTime, |
|
406 | + 'endTime' => $xml->endTime, |
|
407 | + 'participantCount' => $xml->participantCount, |
|
408 | + 'maxUsers' => $xml->maxUsers, |
|
409 | + 'moderatorCount' => $xml->moderatorCount, |
|
410 | + ); |
|
411 | + // Then interate through attendee results and return them as part of the array: |
|
412 | + foreach ($xml->attendees->attendee as $a) { |
|
413 | + $result[] = array( |
|
414 | + 'userId' => $a->userID, |
|
415 | + 'fullName' => $a->fullName, |
|
416 | + 'role' => $a->role |
|
417 | + ); |
|
418 | + } |
|
419 | + return $result; |
|
420 | + } |
|
421 | + } |
|
422 | + else { |
|
423 | + return null; |
|
424 | + } |
|
425 | + |
|
426 | + } |
|
427 | + |
|
428 | + /* __________________ BBB RECORDING METHODS _________________ */ |
|
429 | + /* The methods in the following section support the following categories of the BBB API: |
|
430 | 430 | -- getRecordings |
431 | 431 | -- publishRecordings |
432 | 432 | -- deleteRecordings |
433 | 433 | */ |
434 | 434 | |
435 | - public function getRecordingsUrl($recordingParams) { |
|
436 | - /* USAGE: |
|
435 | + public function getRecordingsUrl($recordingParams) { |
|
436 | + /* USAGE: |
|
437 | 437 | $recordingParams = array( |
438 | 438 | 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids |
439 | 439 | ); |
440 | 440 | */ |
441 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; |
|
442 | - $params = 'meetingID='.urlencode($recordingParams['meetingId']); |
|
443 | - return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); |
|
441 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; |
|
442 | + $params = 'meetingID='.urlencode($recordingParams['meetingId']); |
|
443 | + return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); |
|
444 | 444 | |
445 | - } |
|
445 | + } |
|
446 | 446 | |
447 | - public function getRecordingsWithXmlResponseArray($recordingParams) { |
|
448 | - /* USAGE: |
|
447 | + public function getRecordingsWithXmlResponseArray($recordingParams) { |
|
448 | + /* USAGE: |
|
449 | 449 | $recordingParams = array( |
450 | 450 | 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids |
451 | 451 | ); |
@@ -453,121 +453,121 @@ discard block |
||
453 | 453 | when creating a meeting, it will kick users out after the duration. Should |
454 | 454 | probably be required in user code when 'recording' is set to true. |
455 | 455 | */ |
456 | - $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
|
457 | - if($xml) { |
|
458 | - // If we don't get a success code or messageKey, find out why: |
|
459 | - if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
460 | - $result = array( |
|
461 | - 'returncode' => $xml->returncode, |
|
462 | - 'messageKey' => $xml->messageKey, |
|
463 | - 'message' => $xml->message |
|
464 | - ); |
|
465 | - return $result; |
|
466 | - } |
|
467 | - else { |
|
468 | - // In this case, we have success and recording info: |
|
469 | - $result = array( |
|
470 | - 'returncode' => $xml->returncode, |
|
471 | - 'messageKey' => $xml->messageKey, |
|
472 | - 'message' => $xml->message |
|
473 | - ); |
|
474 | - |
|
475 | - foreach ($xml->recordings->recording as $r) { |
|
476 | - $result[] = array( |
|
477 | - 'recordId' => $r->recordID, |
|
478 | - 'meetingId' => $r->meetingID, |
|
479 | - 'name' => $r->name, |
|
480 | - 'published' => $r->published, |
|
481 | - 'startTime' => $r->startTime, |
|
482 | - 'endTime' => $r->endTime, |
|
483 | - 'playbackFormatType' => $r->playback->format->type, |
|
484 | - 'playbackFormatUrl' => $r->playback->format->url, |
|
485 | - 'playbackFormatLength' => $r->playback->format->length, |
|
486 | - 'metadataTitle' => $r->metadata->title, |
|
487 | - 'metadataSubject' => $r->metadata->subject, |
|
488 | - 'metadataDescription' => $r->metadata->description, |
|
489 | - 'metadataCreator' => $r->metadata->creator, |
|
490 | - 'metadataContributor' => $r->metadata->contributor, |
|
491 | - 'metadataLanguage' => $r->metadata->language, |
|
492 | - // Add more here as needed for your app depending on your |
|
493 | - // use of metadata when creating recordings. |
|
494 | - ); |
|
495 | - } |
|
496 | - return $result; |
|
497 | - } |
|
498 | - } |
|
499 | - else { |
|
500 | - return null; |
|
501 | - } |
|
502 | - } |
|
503 | - |
|
504 | - public function getPublishRecordingsUrl($recordingParams) { |
|
505 | - /* USAGE: |
|
456 | + $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
|
457 | + if($xml) { |
|
458 | + // If we don't get a success code or messageKey, find out why: |
|
459 | + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
460 | + $result = array( |
|
461 | + 'returncode' => $xml->returncode, |
|
462 | + 'messageKey' => $xml->messageKey, |
|
463 | + 'message' => $xml->message |
|
464 | + ); |
|
465 | + return $result; |
|
466 | + } |
|
467 | + else { |
|
468 | + // In this case, we have success and recording info: |
|
469 | + $result = array( |
|
470 | + 'returncode' => $xml->returncode, |
|
471 | + 'messageKey' => $xml->messageKey, |
|
472 | + 'message' => $xml->message |
|
473 | + ); |
|
474 | + |
|
475 | + foreach ($xml->recordings->recording as $r) { |
|
476 | + $result[] = array( |
|
477 | + 'recordId' => $r->recordID, |
|
478 | + 'meetingId' => $r->meetingID, |
|
479 | + 'name' => $r->name, |
|
480 | + 'published' => $r->published, |
|
481 | + 'startTime' => $r->startTime, |
|
482 | + 'endTime' => $r->endTime, |
|
483 | + 'playbackFormatType' => $r->playback->format->type, |
|
484 | + 'playbackFormatUrl' => $r->playback->format->url, |
|
485 | + 'playbackFormatLength' => $r->playback->format->length, |
|
486 | + 'metadataTitle' => $r->metadata->title, |
|
487 | + 'metadataSubject' => $r->metadata->subject, |
|
488 | + 'metadataDescription' => $r->metadata->description, |
|
489 | + 'metadataCreator' => $r->metadata->creator, |
|
490 | + 'metadataContributor' => $r->metadata->contributor, |
|
491 | + 'metadataLanguage' => $r->metadata->language, |
|
492 | + // Add more here as needed for your app depending on your |
|
493 | + // use of metadata when creating recordings. |
|
494 | + ); |
|
495 | + } |
|
496 | + return $result; |
|
497 | + } |
|
498 | + } |
|
499 | + else { |
|
500 | + return null; |
|
501 | + } |
|
502 | + } |
|
503 | + |
|
504 | + public function getPublishRecordingsUrl($recordingParams) { |
|
505 | + /* USAGE: |
|
506 | 506 | $recordingParams = array( |
507 | 507 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
508 | 508 | 'publish' => 'true', -- REQUIRED - boolean: true/false |
509 | 509 | ); |
510 | 510 | */ |
511 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; |
|
512 | - $params = |
|
513 | - 'recordID='.urlencode($recordingParams['recordId']). |
|
514 | - '&publish='.urlencode($recordingParams['publish']); |
|
515 | - return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); |
|
511 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; |
|
512 | + $params = |
|
513 | + 'recordID='.urlencode($recordingParams['recordId']). |
|
514 | + '&publish='.urlencode($recordingParams['publish']); |
|
515 | + return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); |
|
516 | 516 | |
517 | - } |
|
517 | + } |
|
518 | 518 | |
519 | - public function publishRecordingsWithXmlResponseArray($recordingParams) { |
|
520 | - /* USAGE: |
|
519 | + public function publishRecordingsWithXmlResponseArray($recordingParams) { |
|
520 | + /* USAGE: |
|
521 | 521 | $recordingParams = array( |
522 | 522 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
523 | 523 | 'publish' => 'true', -- REQUIRED - boolean: true/false |
524 | 524 | ); |
525 | 525 | */ |
526 | - $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
|
527 | - if($xml) { |
|
528 | - return array( |
|
529 | - 'returncode' => $xml->returncode, |
|
530 | - 'published' => $xml->published // -- Returns true/false. |
|
531 | - ); |
|
532 | - } |
|
533 | - else { |
|
534 | - return null; |
|
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - } |
|
539 | - |
|
540 | - public function getDeleteRecordingsUrl($recordingParams) { |
|
541 | - /* USAGE: |
|
526 | + $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
|
527 | + if($xml) { |
|
528 | + return array( |
|
529 | + 'returncode' => $xml->returncode, |
|
530 | + 'published' => $xml->published // -- Returns true/false. |
|
531 | + ); |
|
532 | + } |
|
533 | + else { |
|
534 | + return null; |
|
535 | + } |
|
536 | + |
|
537 | + |
|
538 | + } |
|
539 | + |
|
540 | + public function getDeleteRecordingsUrl($recordingParams) { |
|
541 | + /* USAGE: |
|
542 | 542 | $recordingParams = array( |
543 | 543 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
544 | 544 | ); |
545 | 545 | */ |
546 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; |
|
547 | - $params = |
|
548 | - 'recordID='.urlencode($recordingParams['recordId']); |
|
549 | - return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); |
|
550 | - } |
|
551 | - |
|
552 | - public function deleteRecordingsWithXmlResponseArray($recordingParams) { |
|
553 | - /* USAGE: |
|
546 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; |
|
547 | + $params = |
|
548 | + 'recordID='.urlencode($recordingParams['recordId']); |
|
549 | + return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); |
|
550 | + } |
|
551 | + |
|
552 | + public function deleteRecordingsWithXmlResponseArray($recordingParams) { |
|
553 | + /* USAGE: |
|
554 | 554 | $recordingParams = array( |
555 | 555 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
556 | 556 | ); |
557 | 557 | */ |
558 | 558 | |
559 | - $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
|
560 | - if($xml) { |
|
561 | - return array( |
|
562 | - 'returncode' => $xml->returncode, |
|
563 | - 'deleted' => $xml->deleted // -- Returns true/false. |
|
564 | - ); |
|
565 | - } |
|
566 | - else { |
|
567 | - return null; |
|
568 | - } |
|
569 | - |
|
570 | - } |
|
559 | + $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
|
560 | + if($xml) { |
|
561 | + return array( |
|
562 | + 'returncode' => $xml->returncode, |
|
563 | + 'deleted' => $xml->deleted // -- Returns true/false. |
|
564 | + ); |
|
565 | + } |
|
566 | + else { |
|
567 | + return null; |
|
568 | + } |
|
569 | + |
|
570 | + } |
|
571 | 571 | |
572 | 572 | |
573 | 573 |
@@ -170,37 +170,37 @@ discard block |
||
170 | 170 | */ |
171 | 171 | function my_rename($file_path, $new_file_name) { |
172 | 172 | |
173 | - $save_dir = getcwd(); |
|
174 | - $path = dirname($file_path); |
|
175 | - $old_file_name = basename($file_path); |
|
176 | - $new_file_name = api_replace_dangerous_char($new_file_name); |
|
177 | - |
|
178 | - // If no extension, take the old one |
|
179 | - if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
180 | - $new_file_name .= substr($old_file_name, $dotpos); |
|
181 | - } |
|
182 | - |
|
183 | - // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
184 | - // This is useful for folder names, where otherwise '.' would be sticky |
|
185 | - |
|
186 | - // Extension PHP is not allowed, change to PHPS |
|
187 | - $new_file_name = php2phps($new_file_name); |
|
188 | - |
|
189 | - if ($new_file_name == $old_file_name) { |
|
190 | - return $old_file_name; |
|
191 | - } |
|
192 | - |
|
193 | - if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
194 | - return false; |
|
195 | - } |
|
196 | - // On a Windows server, it would be better not to do the above check |
|
197 | - // because it succeeds for some new names resembling the old name. |
|
198 | - // But on Unix/Linux the check must be done because rename overwrites. |
|
199 | - |
|
200 | - chdir($path); |
|
201 | - $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
202 | - chdir($save_dir); |
|
203 | - return $res; |
|
173 | + $save_dir = getcwd(); |
|
174 | + $path = dirname($file_path); |
|
175 | + $old_file_name = basename($file_path); |
|
176 | + $new_file_name = api_replace_dangerous_char($new_file_name); |
|
177 | + |
|
178 | + // If no extension, take the old one |
|
179 | + if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
180 | + $new_file_name .= substr($old_file_name, $dotpos); |
|
181 | + } |
|
182 | + |
|
183 | + // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
184 | + // This is useful for folder names, where otherwise '.' would be sticky |
|
185 | + |
|
186 | + // Extension PHP is not allowed, change to PHPS |
|
187 | + $new_file_name = php2phps($new_file_name); |
|
188 | + |
|
189 | + if ($new_file_name == $old_file_name) { |
|
190 | + return $old_file_name; |
|
191 | + } |
|
192 | + |
|
193 | + if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
194 | + return false; |
|
195 | + } |
|
196 | + // On a Windows server, it would be better not to do the above check |
|
197 | + // because it succeeds for some new names resembling the old name. |
|
198 | + // But on Unix/Linux the check must be done because rename overwrites. |
|
199 | + |
|
200 | + chdir($path); |
|
201 | + $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
202 | + chdir($save_dir); |
|
203 | + return $res; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -217,38 +217,38 @@ discard block |
||
217 | 217 | */ |
218 | 218 | function move($source, $target, $forceMove = false, $moveContent = false) |
219 | 219 | { |
220 | - if (check_name_exist($source)) { |
|
221 | - $file_name = basename($source); |
|
220 | + if (check_name_exist($source)) { |
|
221 | + $file_name = basename($source); |
|
222 | 222 | $isWindowsOS = api_is_windows_os(); |
223 | 223 | $canExec = function_exists('exec'); |
224 | 224 | |
225 | - /* File case */ |
|
226 | - if (is_file($source)) { |
|
227 | - if ($forceMove && !$isWindowsOS && $canExec) { |
|
228 | - exec('mv ' . $source . ' ' . $target . '/' . $file_name); |
|
229 | - } else { |
|
230 | - copy($source, $target . '/' . $file_name); |
|
231 | - unlink($source); |
|
232 | - } |
|
233 | - return true; |
|
234 | - } elseif (is_dir($source)) { |
|
235 | - /* Directory */ |
|
236 | - if ($forceMove && !$isWindowsOS && $canExec) { |
|
237 | - if ($moveContent) { |
|
238 | - $base = basename($source); |
|
239 | - exec('mv '.$source.'/* '.$target.$base.'/'); |
|
240 | - exec('rm -rf '.$source); |
|
241 | - } else { |
|
242 | - exec('mv $source $target'); |
|
243 | - } |
|
244 | - } else { |
|
245 | - copyDirTo($source, $target); |
|
246 | - } |
|
247 | - return true; |
|
248 | - } |
|
249 | - } else { |
|
250 | - return false; |
|
251 | - } |
|
225 | + /* File case */ |
|
226 | + if (is_file($source)) { |
|
227 | + if ($forceMove && !$isWindowsOS && $canExec) { |
|
228 | + exec('mv ' . $source . ' ' . $target . '/' . $file_name); |
|
229 | + } else { |
|
230 | + copy($source, $target . '/' . $file_name); |
|
231 | + unlink($source); |
|
232 | + } |
|
233 | + return true; |
|
234 | + } elseif (is_dir($source)) { |
|
235 | + /* Directory */ |
|
236 | + if ($forceMove && !$isWindowsOS && $canExec) { |
|
237 | + if ($moveContent) { |
|
238 | + $base = basename($source); |
|
239 | + exec('mv '.$source.'/* '.$target.$base.'/'); |
|
240 | + exec('rm -rf '.$source); |
|
241 | + } else { |
|
242 | + exec('mv $source $target'); |
|
243 | + } |
|
244 | + } else { |
|
245 | + copyDirTo($source, $target); |
|
246 | + } |
|
247 | + return true; |
|
248 | + } |
|
249 | + } else { |
|
250 | + return false; |
|
251 | + } |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | * @param string $filename filename |
280 | 280 | */ |
281 | 281 | function getextension($filename) { |
282 | - $bouts = explode('.', $filename); |
|
283 | - return array(array_pop($bouts), implode('.', $bouts)); |
|
282 | + $bouts = explode('.', $filename); |
|
283 | + return array(array_pop($bouts), implode('.', $bouts)); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | * @param boolean $recursive if true , include subdir in total |
292 | 292 | */ |
293 | 293 | function dirsize($root, $recursive = true) { |
294 | - $dir = @opendir($root); |
|
295 | - $size = 0; |
|
296 | - while ($file = @readdir($dir)) { |
|
297 | - if (!in_array($file, array('.', '..'))) { |
|
298 | - if (is_dir($root.'/'.$file)) { |
|
299 | - $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
300 | - } else { |
|
301 | - $size += @filesize($root.'/'.$file); |
|
302 | - } |
|
303 | - } |
|
304 | - } |
|
305 | - @closedir($dir); |
|
306 | - return $size; |
|
294 | + $dir = @opendir($root); |
|
295 | + $size = 0; |
|
296 | + while ($file = @readdir($dir)) { |
|
297 | + if (!in_array($file, array('.', '..'))) { |
|
298 | + if (is_dir($root.'/'.$file)) { |
|
299 | + $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
300 | + } else { |
|
301 | + $size += @filesize($root.'/'.$file); |
|
302 | + } |
|
303 | + } |
|
304 | + } |
|
305 | + @closedir($dir); |
|
306 | + return $size; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /* CLASS FileManager */ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | class FileManager |
324 | 324 | { |
325 | - /** |
|
325 | + /** |
|
326 | 326 | Returns a list of all directories, except the base dir, |
327 | 327 | of the current course. This function uses recursion. |
328 | 328 | |
@@ -330,131 +330,130 @@ discard block |
||
330 | 330 | |
331 | 331 | @author Roan Embrechts |
332 | 332 | @version 1.0.1 |
333 | - */ |
|
334 | - function list_all_directories($path) |
|
333 | + */ |
|
334 | + function list_all_directories($path) |
|
335 | 335 | { |
336 | - $result_array = array(); |
|
337 | - if (is_dir($path)) { |
|
338 | - $save_dir = getcwd(); |
|
339 | - chdir($path); |
|
340 | - $handle = opendir($path); |
|
341 | - while ($element = readdir($handle)) { |
|
342 | - if ($element == '.' || $element == '..') continue; |
|
336 | + $result_array = array(); |
|
337 | + if (is_dir($path)) { |
|
338 | + $save_dir = getcwd(); |
|
339 | + chdir($path); |
|
340 | + $handle = opendir($path); |
|
341 | + while ($element = readdir($handle)) { |
|
342 | + if ($element == '.' || $element == '..') continue; |
|
343 | 343 | // Skip the current and parent directories |
344 | - if (is_dir($element)) { |
|
345 | - $dir_array[] = $path.'/'.$element; |
|
346 | - } |
|
347 | - } |
|
348 | - closedir($handle); |
|
349 | - // Recursive operation if subdirectories exist |
|
350 | - $dir_number = sizeof($dir_array); |
|
351 | - if ($dir_number > 0) { |
|
352 | - for ($i = 0 ; $i < $dir_number ; $i++) { |
|
353 | - $sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity |
|
354 | - if (is_array($dir_array) && is_array($sub_dir_array)) { |
|
355 | - $dir_array = array_merge($dir_array, $sub_dir_array); // Data merge |
|
356 | - } |
|
357 | - } |
|
358 | - } |
|
359 | - $result_array = $dir_array; |
|
360 | - chdir($save_dir) ; |
|
361 | - } |
|
362 | - return $result_array ; |
|
363 | - } |
|
364 | - |
|
365 | - /** |
|
344 | + if (is_dir($element)) { |
|
345 | + $dir_array[] = $path.'/'.$element; |
|
346 | + } |
|
347 | + } |
|
348 | + closedir($handle); |
|
349 | + // Recursive operation if subdirectories exist |
|
350 | + $dir_number = sizeof($dir_array); |
|
351 | + if ($dir_number > 0) { |
|
352 | + for ($i = 0 ; $i < $dir_number ; $i++) { |
|
353 | + $sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity |
|
354 | + if (is_array($dir_array) && is_array($sub_dir_array)) { |
|
355 | + $dir_array = array_merge($dir_array, $sub_dir_array); // Data merge |
|
356 | + } |
|
357 | + } |
|
358 | + } |
|
359 | + $result_array = $dir_array; |
|
360 | + chdir($save_dir) ; |
|
361 | + } |
|
362 | + return $result_array ; |
|
363 | + } |
|
364 | + |
|
365 | + /** |
|
366 | 366 | This function receives a list of directories. |
367 | 367 | It returns a list of all files in these directories |
368 | 368 | |
369 | 369 | @author Roan Embrechts |
370 | 370 | @version 1.0 |
371 | - */ |
|
372 | - function list_all_files($dir_array) |
|
371 | + */ |
|
372 | + function list_all_files($dir_array) |
|
373 | 373 | { |
374 | - $element_array = array(); |
|
375 | - if (is_dir($dir_array)) { |
|
376 | - |
|
377 | - $save_dir = getcwd(); |
|
378 | - foreach ($dir_array as $directory) { |
|
379 | - chdir($directory); |
|
380 | - $handle = opendir($directory); |
|
381 | - while ($element = readdir($handle)) { |
|
382 | - if ($element == '.' || $element == '..' || $element == '.htaccess') continue; |
|
374 | + $element_array = array(); |
|
375 | + if (is_dir($dir_array)) { |
|
376 | + |
|
377 | + $save_dir = getcwd(); |
|
378 | + foreach ($dir_array as $directory) { |
|
379 | + chdir($directory); |
|
380 | + $handle = opendir($directory); |
|
381 | + while ($element = readdir($handle)) { |
|
382 | + if ($element == '.' || $element == '..' || $element == '.htaccess') continue; |
|
383 | 383 | // Skip the current and parent directories |
384 | - if (!is_dir($element)) { |
|
385 | - $element_array[] = $directory.'/'.$element; |
|
386 | - } |
|
387 | - } |
|
388 | - closedir($handle); |
|
389 | - chdir('..'); |
|
390 | - chdir($save_dir); |
|
391 | - } |
|
392 | - } |
|
393 | - |
|
394 | - return $element_array; |
|
395 | - } |
|
396 | - |
|
397 | - /** |
|
384 | + if (!is_dir($element)) { |
|
385 | + $element_array[] = $directory.'/'.$element; |
|
386 | + } |
|
387 | + } |
|
388 | + closedir($handle); |
|
389 | + chdir('..'); |
|
390 | + chdir($save_dir); |
|
391 | + } |
|
392 | + } |
|
393 | + |
|
394 | + return $element_array; |
|
395 | + } |
|
396 | + |
|
397 | + /** |
|
398 | 398 | Loads contents of file $filename into memory and returns them as a string. |
399 | 399 | Function kept for compatibility with older PHP versions. |
400 | 400 | Function is binary safe (is needed on Windows) |
401 | - */ |
|
402 | - function compat_load_file($file_name) |
|
401 | + */ |
|
402 | + function compat_load_file($file_name) |
|
403 | 403 | { |
404 | - $buffer = ''; |
|
405 | - if (file_exists($file_name)) { |
|
406 | - $fp = fopen($file_name, 'rb'); |
|
407 | - $buffer = fread ($fp, filesize($file_name)); |
|
408 | - fclose ($fp); |
|
409 | - } |
|
410 | - return $buffer; |
|
411 | - } |
|
412 | - |
|
413 | - /** |
|
414 | - * Adds file/folder to document table in database |
|
415 | - * improvement from set_default_settings (see below): |
|
416 | - * take all info from function parameters |
|
417 | - * no global variables needed |
|
418 | - * |
|
419 | - * NOTE $glued_table should already have backticks around it |
|
420 | - * (get it from the database library, and it is done automatically) |
|
421 | - * |
|
422 | - * @param path, filename, filetype, |
|
423 | - $glued_table, default_visibility |
|
404 | + $buffer = ''; |
|
405 | + if (file_exists($file_name)) { |
|
406 | + $fp = fopen($file_name, 'rb'); |
|
407 | + $buffer = fread ($fp, filesize($file_name)); |
|
408 | + fclose ($fp); |
|
409 | + } |
|
410 | + return $buffer; |
|
411 | + } |
|
424 | 412 | |
425 | - * action: Adds an entry to the document table with the default settings. |
|
426 | - * @author Olivier Cauberghe <[email protected]> |
|
427 | - * @author Roan Embrechts |
|
428 | - * @version 1.2 |
|
429 | - */ |
|
430 | - function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v') |
|
413 | + /** |
|
414 | + * Adds file/folder to document table in database |
|
415 | + * improvement from set_default_settings (see below): |
|
416 | + * take all info from function parameters |
|
417 | + * no global variables needed |
|
418 | + * |
|
419 | + * NOTE $glued_table should already have backticks around it |
|
420 | + * (get it from the database library, and it is done automatically) |
|
421 | + * |
|
422 | + * @param path, filename, filetype, |
|
423 | + $glued_table, default_visibility |
|
424 | + * action: Adds an entry to the document table with the default settings. |
|
425 | + * @author Olivier Cauberghe <[email protected]> |
|
426 | + * @author Roan Embrechts |
|
427 | + * @version 1.2 |
|
428 | + */ |
|
429 | + function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v') |
|
431 | 430 | { |
432 | - if (!$default_visibility) $default_visibility = 'v'; |
|
433 | - |
|
434 | - // Make sure path is not wrongly formed |
|
435 | - $upload_path = !empty($upload_path) ? "/$upload_path" : ''; |
|
436 | - |
|
437 | - $endchar = substr($filename, strlen($filename) - 1, 1); |
|
438 | - if ($endchar == "\\" || $endchar == '/') { |
|
439 | - $filename = substr($filename, 0, strlen($filename) - 1); |
|
440 | - } |
|
441 | - |
|
442 | - $full_file_name = $upload_path.'/'.$filename; |
|
443 | - $full_file_name = str_replace("//", '/', $full_file_name); |
|
444 | - |
|
445 | - $sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'"; |
|
446 | - $sql_result = Database::query($sql_query); |
|
447 | - $result = Database::fetch_array($sql_result); |
|
448 | - // Determine which query to execute |
|
449 | - if ($result['number_existing'] > 0) { |
|
450 | - // Entry exists, update |
|
451 | - $query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype' |
|
431 | + if (!$default_visibility) $default_visibility = 'v'; |
|
432 | + |
|
433 | + // Make sure path is not wrongly formed |
|
434 | + $upload_path = !empty($upload_path) ? "/$upload_path" : ''; |
|
435 | + |
|
436 | + $endchar = substr($filename, strlen($filename) - 1, 1); |
|
437 | + if ($endchar == "\\" || $endchar == '/') { |
|
438 | + $filename = substr($filename, 0, strlen($filename) - 1); |
|
439 | + } |
|
440 | + |
|
441 | + $full_file_name = $upload_path.'/'.$filename; |
|
442 | + $full_file_name = str_replace("//", '/', $full_file_name); |
|
443 | + |
|
444 | + $sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'"; |
|
445 | + $sql_result = Database::query($sql_query); |
|
446 | + $result = Database::fetch_array($sql_result); |
|
447 | + // Determine which query to execute |
|
448 | + if ($result['number_existing'] > 0) { |
|
449 | + // Entry exists, update |
|
450 | + $query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype' |
|
452 | 451 | WHERE path='$full_file_name'"; |
453 | - } else { |
|
454 | - // No entry exists, create new one |
|
455 | - $query = "INSERT INTO $glued_table (path,visibility,filetype) |
|
452 | + } else { |
|
453 | + // No entry exists, create new one |
|
454 | + $query = "INSERT INTO $glued_table (path,visibility,filetype) |
|
456 | 455 | VALUES ('$full_file_name','$default_visibility','$filetype')"; |
457 | - } |
|
458 | - Database::query($query); |
|
459 | - } |
|
456 | + } |
|
457 | + Database::query($query); |
|
458 | + } |
|
460 | 459 | } |
@@ -7,22 +7,22 @@ |
||
7 | 7 | */ |
8 | 8 | class SelectLanguage extends HTML_QuickForm_select |
9 | 9 | { |
10 | - /** |
|
11 | - * Class constructor |
|
12 | - */ |
|
13 | - public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) |
|
14 | - { |
|
15 | - parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
16 | - // Get all languages |
|
17 | - $languages = api_get_languages(); |
|
18 | - $this->_options = array(); |
|
19 | - $this->_values = array(); |
|
20 | - foreach ($languages['name'] as $index => $name) { |
|
21 | - if ($languages['folder'][$index] == api_get_setting('platformLanguage')) { |
|
22 | - $this->addOption($name, $languages['folder'][$index], array('selected'=>'selected')); |
|
23 | - } else { |
|
24 | - $this->addOption($name, $languages['folder'][$index]); |
|
25 | - } |
|
26 | - } |
|
27 | - } |
|
10 | + /** |
|
11 | + * Class constructor |
|
12 | + */ |
|
13 | + public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) |
|
14 | + { |
|
15 | + parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
16 | + // Get all languages |
|
17 | + $languages = api_get_languages(); |
|
18 | + $this->_options = array(); |
|
19 | + $this->_values = array(); |
|
20 | + foreach ($languages['name'] as $index => $name) { |
|
21 | + if ($languages['folder'][$index] == api_get_setting('platformLanguage')) { |
|
22 | + $this->addOption($name, $languages['folder'][$index], array('selected'=>'selected')); |
|
23 | + } else { |
|
24 | + $this->addOption($name, $languages['folder'][$index]); |
|
25 | + } |
|
26 | + } |
|
27 | + } |
|
28 | 28 | } |
@@ -91,11 +91,11 @@ |
||
91 | 91 | $pathinfo = pathinfo($header_file); |
92 | 92 | |
93 | 93 | if ($pathinfo['extension']=='swf') { |
94 | - $width='83%'; |
|
95 | - $height='83%'; |
|
94 | + $width='83%'; |
|
95 | + $height='83%'; |
|
96 | 96 | } else { |
97 | - $width='100%'; |
|
98 | - $height='100%'; |
|
97 | + $width='100%'; |
|
98 | + $height='100%'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | echo '<iframe border="0" frameborder="0" scrolling="no" style="width:'.$width.'; height:'.$height.';background-color:#ffffff;" id="mainFrame" name="mainFrame" src="'.$file_url_web.'?'.api_get_cidreq().'&rand='.mt_rand(1, 1000).'"></iframe>'; |