Passed
Push — 1.10.x ( d72f5d...084dcf )
by Angel Fernando Quiroz
453:19 queued 409:58
created
main/document/save_pixlr.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- *	This file allows creating new svg and png documents with an online editor.
5
- *
6
- *	@package chamilo.document
7
- *
8
- * @author Juan Carlos Raña Trabado
9
- * @since 30/january/2011
4
+     *	This file allows creating new svg and png documents with an online editor.
5
+     *
6
+     *	@package chamilo.document
7
+     *
8
+     * @author Juan Carlos Raña Trabado
9
+     * @since 30/january/2011
10 10
 */
11 11
 /**
12
- * Code
13
- */
12
+     * Code
13
+     */
14 14
 require_once '../inc/global.inc.php';
15 15
 
16 16
 api_protect_course_script();
17 17
 api_block_anonymous_users();
18 18
 
19 19
 if ($_user['user_id']!= api_get_user_id() || api_get_user_id()==0 || $_user['user_id']==0) {
20
-	api_not_allowed();
21
-	die();
20
+    api_not_allowed();
21
+    die();
22 22
 }
23 23
 
24 24
 if(!isset($_GET['title']) || !isset($_GET['type']) || !isset($_GET['image'])) {
25
-	api_not_allowed();
26
-	die();
25
+    api_not_allowed();
26
+    die();
27 27
 }
28 28
 
29 29
 if(!isset($_SESSION['paint_dir']) || !isset($_SESSION['whereami']) ){
30
-	api_not_allowed();
31
-	die();
30
+    api_not_allowed();
31
+    die();
32 32
 }
33 33
 
34 34
 //pixlr return
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
 $filename = disable_dangerous_file($filename);
73 73
 
74 74
 if (strlen(trim($filename))==0) {
75
-	 echo "The title is empty";//if title is empty, headers Content-Type = application/octet-stream, then not create a new title here please
76
-	 exit;
75
+        echo "The title is empty";//if title is empty, headers Content-Type = application/octet-stream, then not create a new title here please
76
+        exit;
77 77
 }
78 78
 
79 79
 //check file_get_contents
80 80
 if ($contents === false) {
81
-	echo "I cannot read: ".$urlcontents;
81
+    echo "I cannot read: ".$urlcontents;
82 82
     exit;
83 83
 }
84 84
 
85 85
 // Extension security
86 86
 if($extension!= 'jpg' && $extension!= 'png' && $extension!= 'pxd'){
87
-	die();
87
+    die();
88 88
 }
89 89
 if($extension=='pxd') {
90
-	echo "pxd file type does not supported";// not secure because check security headers and finfo() return  Content-Type = application/octet-stream
90
+    echo "pxd file type does not supported";// not secure because check security headers and finfo() return  Content-Type = application/octet-stream
91 91
     exit;
92 92
 }
93 93
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 $headers = get_headers($urlcontents, 1);
96 96
 $content_type = explode("/", $headers['Content-Type']);
97 97
 if ($content_type[0] != "image") {
98
-	echo "Invalid file type";
99
-	exit;
98
+    echo "Invalid file type";
99
+    exit;
100 100
 }
101 101
 
102 102
 //Verify that the file is an image. Fileinfo method
@@ -114,49 +114,49 @@  discard block
 block discarded – undo
114 114
 $title = $title.'.'.$extension;
115 115
 
116 116
 if($currentTool=='document/createpaint'){
117
-	//check save as and prevent rewrite an older file with same name
118
-	if (0 != $groupId){
117
+    //check save as and prevent rewrite an older file with same name
118
+    if (0 != $groupId){
119 119
         $group_properties  = GroupManager :: get_group_properties($groupId);
120 120
         $groupPath = $group_properties['directory'];
121
-	} else {
122
-		$groupPath ='';
123
-	}
124
-
125
-	if (file_exists($saveDir.'/'.$filename.'.'.$extension)){
126
-		$i = 1;
127
-		while (file_exists($saveDir.'/'.$filename.'_'.$i.'.'.$extension)) $i++;
128
-		$paintFileName = $filename . '_' . $i . '.'.$extension;
129
-		$title = $filename . '_' . $i . '.'.$extension;
130
-	}
131
-
132
-	//
133
-	$documentPath = $saveDir.'/'.$paintFileName;
134
-	//add new document to disk
135
-	file_put_contents( $documentPath, $contents );
136
-	//add document to database
137
-	$doc_id = add_document($_course, $relativeUrlPath.'/'.$paintFileName, 'file', filesize($documentPath), $title);
138
-	api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
121
+    } else {
122
+        $groupPath ='';
123
+    }
124
+
125
+    if (file_exists($saveDir.'/'.$filename.'.'.$extension)){
126
+        $i = 1;
127
+        while (file_exists($saveDir.'/'.$filename.'_'.$i.'.'.$extension)) $i++;
128
+        $paintFileName = $filename . '_' . $i . '.'.$extension;
129
+        $title = $filename . '_' . $i . '.'.$extension;
130
+    }
131
+
132
+    //
133
+    $documentPath = $saveDir.'/'.$paintFileName;
134
+    //add new document to disk
135
+    file_put_contents( $documentPath, $contents );
136
+    //add document to database
137
+    $doc_id = add_document($_course, $relativeUrlPath.'/'.$paintFileName, 'file', filesize($documentPath), $title);
138
+    api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
139 139
 
140 140
 }elseif($currentTool=='document/editpaint'){
141 141
 
142
-	$documentPath = $saveDir.'/'.$paintFileName;
143
-	//add new document to disk
144
-	file_put_contents( $documentPath, $contents );
145
-
146
-	//check path
147
-	if(!isset($_SESSION['paint_file'])){
148
-		api_not_allowed();
149
-		die();
150
-	}
151
-	if($_SESSION['paint_file']==$paintFileName){
152
-		$document_id = DocumentManager::get_document_id($_course, $relativeUrlPath.'/'.$paintFileName);
153
-		update_existing_document($_course, $document_id, filesize($documentPath), null);
154
-		api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $_user['user_id'], $groupId, null, null, null, $current_session_id);
155
-	}else{
156
-		//add a new document
157
-		$doc_id = add_document($_course, $relativeUrlPath.'/'.$paintFileName, 'file', filesize($documentPath), $title);
158
-		api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
159
-	}
142
+    $documentPath = $saveDir.'/'.$paintFileName;
143
+    //add new document to disk
144
+    file_put_contents( $documentPath, $contents );
145
+
146
+    //check path
147
+    if(!isset($_SESSION['paint_file'])){
148
+        api_not_allowed();
149
+        die();
150
+    }
151
+    if($_SESSION['paint_file']==$paintFileName){
152
+        $document_id = DocumentManager::get_document_id($_course, $relativeUrlPath.'/'.$paintFileName);
153
+        update_existing_document($_course, $document_id, filesize($documentPath), null);
154
+        api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $_user['user_id'], $groupId, null, null, null, $current_session_id);
155
+    }else{
156
+        //add a new document
157
+        $doc_id = add_document($_course, $relativeUrlPath.'/'.$paintFileName, 'file', filesize($documentPath), $title);
158
+        api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
159
+    }
160 160
 }
161 161
 
162 162
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 unset($_SESSION['temp_realpath_image']);
172 172
 
173 173
 if (!isset($_SESSION['exit_pixlr'])) {
174
-	$location=api_get_path(WEB_CODE_PATH).'document/document.php';
175
-	echo '<script>window.parent.location.href="'.$location.'"</script>';
176
-	api_not_allowed(true);
174
+    $location=api_get_path(WEB_CODE_PATH).'document/document.php';
175
+    echo '<script>window.parent.location.href="'.$location.'"</script>';
176
+    api_not_allowed(true);
177 177
 } else {
178
-	echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
179
-	$location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
180
-	echo '<script>window.parent.location.href="'.$location.'"</script>';
181
-	unset($_SESSION['exit_pixlr']);
178
+    echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
179
+    $location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
180
+    echo '<script>window.parent.location.href="'.$location.'"</script>';
181
+    unset($_SESSION['exit_pixlr']);
182 182
 }
Please login to merge, or discard this patch.
main/document/create_document.php 1 patch
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- *	This file allows creating new html documents with an online WYSIWYG html editor.
5
- *
6
- *	@package chamilo.document
7
- */
4
+     *	This file allows creating new html documents with an online WYSIWYG html editor.
5
+     *
6
+     *	@package chamilo.document
7
+     */
8 8
 
9 9
 require_once '../inc/global.inc.php';
10 10
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 $is_certificate_mode = false;
78 78
 
79 79
 if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
80
-	$is_certificate_mode = true;
80
+    $is_certificate_mode = true;
81 81
 }
82 82
 
83 83
 if ($is_certificate_mode) {
84
-	$nameTools = get_lang('CreateCertificate');
84
+    $nameTools = get_lang('CreateCertificate');
85 85
 } else {
86
-	$nameTools = get_lang('CreateDocument');
86
+    $nameTools = get_lang('CreateDocument');
87 87
 }
88 88
 
89 89
 /*	Constants and variables */
@@ -136,26 +136,26 @@  discard block
 block discarded – undo
136 136
 
137 137
 // Please, do not modify this dirname formatting
138 138
 if (strstr($dir, '..')) {
139
-	$dir = '/';
139
+    $dir = '/';
140 140
 }
141 141
 
142 142
 if ($dir[0] == '.') {
143
-	$dir = substr($dir, 1);
143
+    $dir = substr($dir, 1);
144 144
 }
145 145
 
146 146
 if ($dir[0] != '/') {
147
-	$dir = '/'.$dir;
147
+    $dir = '/'.$dir;
148 148
 }
149 149
 
150 150
 if ($dir[strlen($dir) - 1] != '/') {
151
-	$dir .= '/';
151
+    $dir .= '/';
152 152
 }
153 153
 
154 154
 if ($is_certificate_mode) {
155
-	$document_id 	= DocumentManager::get_document_id(api_get_course_info(), '/certificates');
156
-	$document_data 	= DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
157
-	$folder_id = $document_data['id'];
158
-	$dir = '/certificates/';
155
+    $document_id 	= DocumentManager::get_document_id(api_get_course_info(), '/certificates');
156
+    $document_data 	= DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
157
+    $folder_id = $document_data['id'];
158
+    $dir = '/certificates/';
159 159
 }
160 160
 
161 161
 $doc_tree  = explode('/', $dir);
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
 
167 167
     // Level correction for group documents.
168 168
     if (!empty($group_properties['directory'])) {
169
-    	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
169
+        $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
170 170
     }
171 171
 }
172 172
 $relative_url = '';
173 173
 for ($i = 0; $i < ($count_dir); $i++) {
174
-	$relative_url .= '../';
174
+    $relative_url .= '../';
175 175
 }
176 176
 
177 177
 if ($relative_url== '') {
178
-	$relative_url = '/';
178
+    $relative_url = '/';
179 179
 }
180 180
 
181 181
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
     'cols-size' => [2, 10, 0],
188 188
     'FullPage' => true,
189 189
     'InDocument' => true,
190
-	'CreateDocumentDir'    => $relative_url,
191
-	'CreateDocumentWebDir' => (empty($group_properties['directory']))
192
-                        		? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
193
-                        		: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
194
-	'BaseHref'             => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
190
+    'CreateDocumentDir'    => $relative_url,
191
+    'CreateDocumentWebDir' => (empty($group_properties['directory']))
192
+                                ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
193
+                                : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
194
+    'BaseHref'             => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
195 195
 );
196 196
 
197 197
 if ($is_certificate_mode) {
@@ -203,36 +203,36 @@  discard block
 block discarded – undo
203 203
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
204 204
 
205 205
 if (!is_dir($filepath)) {
206
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
207
-	$dir = '/';
206
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
207
+    $dir = '/';
208 208
 }
209 209
 
210 210
 $to_group_id = 0;
211 211
 
212 212
 if (!$is_certificate_mode) {
213
-	if (api_is_in_group()) {
214
-		$interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
215
-		$noPHP_SELF = true;
216
-		$to_group_id = api_get_group_id();
217
-		$path = explode('/', $dir);
218
-		if ('/'.$path[1] != $group_properties['directory']) {
219
-			api_not_allowed(true);
220
-		}
221
-	}
222
-	$interbreadcrumb[] = array("url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(), "name" => get_lang('Documents'));
213
+    if (api_is_in_group()) {
214
+        $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
215
+        $noPHP_SELF = true;
216
+        $to_group_id = api_get_group_id();
217
+        $path = explode('/', $dir);
218
+        if ('/'.$path[1] != $group_properties['directory']) {
219
+            api_not_allowed(true);
220
+        }
221
+    }
222
+    $interbreadcrumb[] = array("url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(), "name" => get_lang('Documents'));
223 223
 } else {
224
-	$interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
224
+    $interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
225 225
 }
226 226
 
227 227
 if (!$is_allowed_in_course) {
228
-	api_not_allowed(true);
228
+    api_not_allowed(true);
229 229
 }
230 230
 
231 231
 if (!($is_allowed_to_edit ||
232 232
     $_SESSION['group_member_with_upload_rights'] ||
233 233
     DocumentManager::is_my_shared_folder($userId, $dir, api_get_session_id()))
234 234
 ) {
235
-	api_not_allowed(true);
235
+    api_not_allowed(true);
236 236
 }
237 237
 
238 238
 /*	Header */
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 
241 241
 $display_dir = $dir;
242 242
 if (isset($group_properties)) {
243
-	$display_dir = explode('/', $dir);
244
-	unset($display_dir[0]);
245
-	unset($display_dir[1]);
246
-	$display_dir = implode('/', $display_dir);
243
+    $display_dir = explode('/', $dir);
244
+    unset($display_dir[0]);
245
+    unset($display_dir[1]);
246
+    $display_dir = implode('/', $display_dir);
247 247
 }
248 248
 
249 249
 $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null;
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 $form->addElement('header', $nameTools);
261 261
 
262 262
 if ($is_certificate_mode) {//added condition for certicate in gradebook
263
-	$form->addElement('hidden','certificate','true',array('id'=>'certificate'));
264
-	if (isset($_GET['selectcat'])) {
265
-		$form->addElement('hidden','selectcat', $select_cat);
263
+    $form->addElement('hidden','certificate','true',array('id'=>'certificate'));
264
+    if (isset($_GET['selectcat'])) {
265
+        $form->addElement('hidden','selectcat', $select_cat);
266 266
     }
267 267
 }
268 268
 
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 if ($is_certificate_mode) {
298 298
     $form->addText('title', get_lang('CertificateName'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
299 299
 } else {
300
-	$form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
300
+    $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
301 301
 }
302 302
 
303 303
 // Show read-only box only in groups
304 304
 if (!empty($groupId)) {
305
-	$group[]= $form->createElement('checkbox', 'readonly', '', get_lang('ReadOnly'));
305
+    $group[]= $form->createElement('checkbox', 'readonly', '', get_lang('ReadOnly'));
306 306
 }
307 307
 $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
308 308
 $form->addRule('title', get_lang('FileExists'), 'callback', 'document_exists');
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
 // new document created
318 318
 
319 319
 if (!$is_certificate_mode &&
320
-	!DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
320
+    !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
321 321
 ) {
322
-	$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
322
+    $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
323 323
 
324
-	//$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory')));
324
+    //$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory')));
325 325
         $parent_select = $form->addSelect('curdirpath', get_lang('DestinationDirectory'),null, array('cols-size' => [2, 10, 0]) );
326
-	// Following two conditions copied from document.inc.php::build_directory_selector()
327
-	$folder_titles = array();
326
+    // Following two conditions copied from document.inc.php::build_directory_selector()
327
+    $folder_titles = array();
328 328
 
329 329
     if (is_array($folders)) {
330 330
         $escaped_folders = array();
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
         }
363 363
     }
364 364
 
365
-	if (empty($group_dir)) {
366
-		$parent_select -> addOption(get_lang('HomeDirectory'), '/');
367
-		if (is_array($folders)) {
368
-			foreach ($folders as & $folder) {
369
-				//Hide some folders
370
-				if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
365
+    if (empty($group_dir)) {
366
+        $parent_select -> addOption(get_lang('HomeDirectory'), '/');
367
+        if (is_array($folders)) {
368
+            foreach ($folders as & $folder) {
369
+                //Hide some folders
370
+                if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
371 371
                     continue;
372
-				}
373
-				//Admin setting for Hide/Show the folders of all users
374
-				if (api_get_setting('show_users_folders') == 'false' &&
372
+                }
373
+                //Admin setting for Hide/Show the folders of all users
374
+                if (api_get_setting('show_users_folders') == 'false' &&
375 375
                     (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))
376 376
                 ){
377
-					continue;
378
-				}
379
-				//Admin setting for Hide/Show Default folders to all users
380
-				if (api_get_setting('show_default_folders') == 'false' &&
377
+                    continue;
378
+                }
379
+                //Admin setting for Hide/Show Default folders to all users
380
+                if (api_get_setting('show_default_folders') == 'false' &&
381 381
                     (
382 382
                         $folder == '/images' ||
383 383
                         $folder == '/flash' ||
@@ -387,80 +387,80 @@  discard block
 block discarded – undo
387 387
                         $folder == '/video/flv'
388 388
                     )
389 389
                 ){
390
-					continue;
391
-				}
392
-				//Admin setting for Hide/Show chat history folder
393
-				if (api_get_setting('show_chat_folder') == 'false' &&
390
+                    continue;
391
+                }
392
+                //Admin setting for Hide/Show chat history folder
393
+                if (api_get_setting('show_chat_folder') == 'false' &&
394 394
                     $folder=='/chat_files'
395 395
                 ){
396
-					continue;
397
-				}
396
+                    continue;
397
+                }
398 398
 
399
-				$selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
400
-				$path_parts = explode('/', $folder);
401
-				$folder_titles[$folder] = cut($folder_titles[$folder], 80);
399
+                $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
400
+                $path_parts = explode('/', $folder);
401
+                $folder_titles[$folder] = cut($folder_titles[$folder], 80);
402 402
                 $space_counter =count($path_parts) - 2;
403 403
                 if ($space_counter > 0) {
404 404
                     $label = str_repeat('&nbsp;&nbsp;&nbsp;', $space_counter).' &mdash; '.$folder_titles[$folder];
405 405
                 } else {
406 406
                     $label = ' &mdash; '.$folder_titles[$folder];
407 407
                 }
408
-				$parent_select -> addOption($label, $folder);
409
-				if ($selected != '') {
410
-					$parent_select->setSelected($folder);
411
-				}
412
-			}
413
-		}
414
-	} else {
415
-		foreach ($folders as & $folder) {
416
-			$selected = (substr($dir,0,-1)==$folder) ? ' selected="selected"' : '';
417
-			$label = $folder_titles[$folder];
418
-			if ($folder == $group_dir) {
419
-				$label = '/ ('.get_lang('HomeDirectory').')';
420
-			} else {
421
-				$path_parts = explode('/', str_replace($group_dir, '', $folder));
422
-				$label = cut($label, 80);
423
-				$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
424
-			}
425
-			$parent_select -> addOption($label, $folder);
426
-			if ($selected != '') {
427
-				$parent_select->setSelected($folder);
428
-			}
429
-		}
430
-	}
408
+                $parent_select -> addOption($label, $folder);
409
+                if ($selected != '') {
410
+                    $parent_select->setSelected($folder);
411
+                }
412
+            }
413
+        }
414
+    } else {
415
+        foreach ($folders as & $folder) {
416
+            $selected = (substr($dir,0,-1)==$folder) ? ' selected="selected"' : '';
417
+            $label = $folder_titles[$folder];
418
+            if ($folder == $group_dir) {
419
+                $label = '/ ('.get_lang('HomeDirectory').')';
420
+            } else {
421
+                $path_parts = explode('/', str_replace($group_dir, '', $folder));
422
+                $label = cut($label, 80);
423
+                $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
424
+            }
425
+            $parent_select -> addOption($label, $folder);
426
+            if ($selected != '') {
427
+                $parent_select->setSelected($folder);
428
+            }
429
+        }
430
+    }
431 431
 }
432 432
 
433 433
 $form->addHidden('dirValue', '');
434 434
 
435 435
 if ($is_certificate_mode) {
436
-	$form->addButtonCreate(get_lang('CreateCertificate'));
436
+    $form->addButtonCreate(get_lang('CreateCertificate'));
437 437
 } else {
438
-	$form->addButtonCreate(get_lang('CreateDoc'));
438
+    $form->addButtonCreate(get_lang('CreateDoc'));
439 439
 }
440 440
 
441 441
 $form->setDefaults($defaults);
442 442
 
443 443
 // If form validates -> save the new document
444 444
 if ($form->validate()) {
445
-	$values = $form->exportValues();
446
-	$readonly = isset($values['readonly']) ? 1 : 0;
447
-	$values['title'] = trim($values['title']);
445
+    $values = $form->exportValues();
446
+    $readonly = isset($values['readonly']) ? 1 : 0;
447
+    $values['title'] = trim($values['title']);
448 448
     
449 449
     if (!empty($values['dirValue'])) {
450 450
         $dir = $values['dirValue'];
451 451
     }
452 452
 
453 453
     if ($dir[strlen($dir) - 1] != '/') {
454
-		$dir .= '/';
455
-	}
454
+        $dir .= '/';
455
+    }
456 456
     $filepath = $filepath.$dir;
457 457
 
458 458
     // Setting the filename
459
-	$filename = $values['title'];
460
-	$filename = addslashes(trim($filename));
461
-	$filename = Security::remove_XSS($filename);
462
-	$filename = api_replace_dangerous_char($filename);
463
-	$filename = disable_dangerous_file($filename);
459
+    $filename = $values['title'];
460
+    $filename = addslashes(trim($filename));
461
+    $filename = Security::remove_XSS($filename);
462
+    $filename = api_replace_dangerous_char($filename);
463
+    $filename = disable_dangerous_file($filename);
464 464
     $filename .= DocumentManager::getDocumentSuffix(
465 465
         $_course,
466 466
         api_get_session_id(),
@@ -468,14 +468,14 @@  discard block
 block discarded – undo
468 468
     );
469 469
 
470 470
     // Setting the title
471
-	$title = $values['title'];
471
+    $title = $values['title'];
472 472
 
473 473
     // Setting the extension
474
-	$extension = 'html';
474
+    $extension = 'html';
475 475
 
476
-	$content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
476
+    $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
477 477
 
478
-	/*if (strpos($content, '/css/frames.css') == false) {
478
+    /*if (strpos($content, '/css/frames.css') == false) {
479 479
 		$content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
480 480
 	}*/
481 481
 
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
         exit;
489 489
     }
490 490
 
491
-	if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
492
-		$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
491
+    if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
492
+        $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
493 493
 
494
-		fputs($fp, $content);
495
-		fclose($fp);
496
-		chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
494
+        fputs($fp, $content);
495
+        fclose($fp);
496
+        chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
497 497
 
498 498
         /*
499 499
 		if (!is_dir($filepath.'css')) {
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 			api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
512 512
 		}*/
513 513
 
514
-		$file_size = filesize($filepath.$filename.'.'.$extension);
515
-		$save_file_path = $dir.$filename.'.'.$extension;
514
+        $file_size = filesize($filepath.$filename.'.'.$extension);
515
+        $save_file_path = $dir.$filename.'.'.$extension;
516 516
 
517 517
         $document_id = add_document(
518 518
             $_course,
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
             $readonly
525 525
         );
526 526
 
527
-		if ($document_id) {
528
-			api_item_property_update(
527
+        if ($document_id) {
528
+            api_item_property_update(
529 529
                 $_course,
530 530
                 TOOL_DOCUMENT,
531 531
                 $document_id,
@@ -537,13 +537,13 @@  discard block
 block discarded – undo
537 537
                 null,
538 538
                 $current_session_id
539 539
             );
540
-			// Update parent folders
541
-			item_property_update_on_folder($_course, $dir, $userId);
542
-			$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
543
-			$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
540
+            // Update parent folders
541
+            item_property_update_on_folder($_course, $dir, $userId);
542
+            $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
543
+            $new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
544 544
             $new_title = htmlspecialchars($new_title);
545
-			if ($new_comment || $new_title) {
546
-				$ct = '';
545
+            if ($new_comment || $new_title) {
546
+                $ct = '';
547 547
                 $params = [];
548 548
                 if ($new_comment) {
549 549
                     $params['comment'] = $new_comment;
@@ -558,38 +558,38 @@  discard block
 block discarded – undo
558 558
                         ['c_id = ? AND id = ?' => [$course_id, $document_id]]
559 559
                     );
560 560
                 }
561
-			}
562
-			$dir= substr($dir,0,-1);
563
-			$selectcat = '';
564
-			if (isset($_REQUEST['selectcat']))
565
-				$selectcat = "&selectcat=".Security::remove_XSS($_REQUEST['selectcat']);
566
-			$certificate_condition = '';
567
-			if ($is_certificate_mode) {
568
-				$df = DocumentManager::get_default_certificate_id($_course['code']);
561
+            }
562
+            $dir= substr($dir,0,-1);
563
+            $selectcat = '';
564
+            if (isset($_REQUEST['selectcat']))
565
+                $selectcat = "&selectcat=".Security::remove_XSS($_REQUEST['selectcat']);
566
+            $certificate_condition = '';
567
+            if ($is_certificate_mode) {
568
+                $df = DocumentManager::get_default_certificate_id($_course['code']);
569 569
                 if (!isset($df)) {
570 570
                     DocumentManager::attach_gradebook_certificate ($_course['code'],$document_id);
571
-				}
572
-				$certificate_condition = '&certificate=true&curdirpath=/certificates';
573
-			}
574
-
575
-			header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
576
-			exit();
577
-		} else {
578
-			Display :: display_header($nameTools, 'Doc');
579
-			Display :: display_error_message(get_lang('Impossible'));
580
-			Display :: display_footer();
581
-		}
582
-	} else {
583
-		Display :: display_header($nameTools, 'Doc');
584
-		Display :: display_error_message(get_lang('Impossible'));
585
-		Display :: display_footer();
586
-	}
571
+                }
572
+                $certificate_condition = '&certificate=true&curdirpath=/certificates';
573
+            }
574
+
575
+            header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
576
+            exit();
577
+        } else {
578
+            Display :: display_header($nameTools, 'Doc');
579
+            Display :: display_error_message(get_lang('Impossible'));
580
+            Display :: display_footer();
581
+        }
582
+    } else {
583
+        Display :: display_header($nameTools, 'Doc');
584
+        Display :: display_error_message(get_lang('Impossible'));
585
+        Display :: display_footer();
586
+    }
587 587
 } else {
588
-	// Copied from document.php
589
-	$dir_array = explode('/', $dir);
590
-	$array_len = count($dir_array);
588
+    // Copied from document.php
589
+    $dir_array = explode('/', $dir);
590
+    $array_len = count($dir_array);
591 591
 
592
-	// Breadcrumb for the current directory root path
592
+    // Breadcrumb for the current directory root path
593 593
     if (!empty($document_data)) {
594 594
         if (empty($document_data['parents'])) {
595 595
             $interbreadcrumb[] = array(
@@ -606,31 +606,31 @@  discard block
 block discarded – undo
606 606
         }
607 607
     }
608 608
 
609
-	Display :: display_header($nameTools, "Doc");
610
-	// actions
609
+    Display :: display_header($nameTools, "Doc");
610
+    // actions
611 611
 
612
-	// link back to the documents overview
613
-	if ($is_certificate_mode) {
614
-		$actionsLeft =  '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
612
+    // link back to the documents overview
613
+    if ($is_certificate_mode) {
614
+        $actionsLeft =  '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
615 615
             Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
616 616
         } else {
617
-		$actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
617
+        $actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
618 618
             Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
619 619
         }
620 620
         
621 621
         echo $toolbar = Display::toolbarAction('actions-documents', array(0 => $actionsLeft, 1 => ''));
622 622
                 
623 623
 
624
-	if ($is_certificate_mode) {
625
-		$all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id());
624
+    if ($is_certificate_mode) {
625
+        $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id());
626 626
 
627
-		$str_info = '';
628
-		foreach ($all_information_by_create_certificate[0] as $info_value) {
629
-			$str_info.=$info_value.'<br/>';
630
-		}
631
-		$create_certificate = get_lang('CreateCertificateWithTags');
632
-		Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
633
-	}
627
+        $str_info = '';
628
+        foreach ($all_information_by_create_certificate[0] as $info_value) {
629
+            $str_info.=$info_value.'<br/>';
630
+        }
631
+        $create_certificate = get_lang('CreateCertificateWithTags');
632
+        Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
633
+    }
634 634
     // HTML-editor
635 635
     echo '<div class="row" style="overflow:hidden">
636 636
             <div id="template_col" class="col-md-2">
@@ -647,5 +647,5 @@  discard block
 block discarded – undo
647 647
                 '.$form->returnForm().'
648 648
             </div>
649 649
           </div>';
650
-	Display :: display_footer();
650
+    Display :: display_footer();
651 651
 }
Please login to merge, or discard this patch.
main/document/record_audio.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 $document_data  = array();
24 24
 
25 25
 if (isset($_GET['id'])) {
26
-	$document_data = DocumentManager::get_document_data_by_id(
27
-		$_GET['id'],
28
-		api_get_course_id(),
29
-		true
30
-	);
26
+    $document_data = DocumentManager::get_document_data_by_id(
27
+        $_GET['id'],
28
+        api_get_course_id(),
29
+        true
30
+    );
31 31
 }
32 32
 
33 33
 if (empty($document_data)) {
@@ -46,46 +46,46 @@  discard block
 block discarded – undo
46 46
 // Please, do not modify this dirname formatting
47 47
 
48 48
 if (strstr($dir, '..')) {
49
-	$dir = '/';
49
+    $dir = '/';
50 50
 }
51 51
 
52 52
 if ($dir[0] == '.') {
53
-	$dir = substr($dir, 1);
53
+    $dir = substr($dir, 1);
54 54
 }
55 55
 
56 56
 if ($dir[0] != '/') {
57
-	$dir = '/'.$dir;
57
+    $dir = '/'.$dir;
58 58
 }
59 59
 
60 60
 if ($dir[strlen($dir) - 1] != '/') {
61
-	$dir .= '/';
61
+    $dir .= '/';
62 62
 }
63 63
 
64 64
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
65 65
 
66 66
 if (!is_dir($filepath)) {
67
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
68
-	$dir = '/';
67
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
68
+    $dir = '/';
69 69
 }
70 70
 
71 71
 if (!empty($groupId)) {
72
-	$interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
73
-	$group = GroupManager :: get_group_properties($groupId);
74
-	$path = explode('/', $dir);
75
-	if ('/'.$path[1] != $group['directory']) {
76
-		api_not_allowed(true);
77
-	}
72
+    $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
73
+    $group = GroupManager :: get_group_properties($groupId);
74
+    $path = explode('/', $dir);
75
+    if ('/'.$path[1] != $group['directory']) {
76
+        api_not_allowed(true);
77
+    }
78 78
 }
79 79
 
80 80
 $interbreadcrumb[] = array("url" => "./document.php?id=".$document_id.'&'.api_get_cidreq(), "name" => get_lang('Documents'));
81 81
 
82 82
 if (!$is_allowed_in_course) {
83
-	api_not_allowed(true);
83
+    api_not_allowed(true);
84 84
 }
85 85
 
86 86
 if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
87
-	DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) {
88
-	api_not_allowed(true);
87
+    DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) {
88
+    api_not_allowed(true);
89 89
 }
90 90
 
91 91
 /*	Header */
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 
94 94
 $display_dir = $dir;
95 95
 if (isset ($group)) {
96
-	$display_dir = explode('/', $dir);
97
-	unset ($display_dir[0]);
98
-	unset ($display_dir[1]);
99
-	$display_dir = implode('/', $display_dir);
96
+    $display_dir = explode('/', $dir);
97
+    unset ($display_dir[0]);
98
+    unset ($display_dir[1]);
99
+    $display_dir = implode('/', $display_dir);
100 100
 }
101 101
 
102 102
 // Interbreadcrumb for the current directory root path
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 Display :: display_header($nameTools, 'Doc');
118 118
 
119 119
 echo '<div class="actions">';
120
-		echo '<a href="document.php?'.api_get_cidreq().'&id='.$document_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
120
+        echo '<a href="document.php?'.api_get_cidreq().'&id='.$document_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
121 121
 echo '</div>';
122 122
 
123 123
 ?>
@@ -178,24 +178,24 @@  discard block
 block discarded – undo
178 178
 Display::display_icon('microphone.png', get_lang('PressRecordButton'),'','128');
179 179
 echo '<br/>';
180 180
 echo '<applet id="nanogong" archive="'.api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar" code="gong.NanoGong" width="250" height="95" ALIGN="middle">';
181
-	//echo '<param name="ShowRecordButton" value="false" />'; // default true
182
-	// echo '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
183
-	//echo '<param name="ShowSpeedButton" value="false" />'; // default true
184
-	//echo '<param name="ShowAudioLevel" value="false" />'; //  it displays the audiometer | (default true)
185
-	echo '<param name="ShowTime" value="true" />'; // default false
186
-	//echo '<param name="Color" value="#C0E0FF" />'; // default #FFFFFF
187
-	//echo '<param name="StartTime" value="10.5" />';
188
-	//echo '<param name="EndTime" value="65" />';
189
-	echo '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
190
-	//echo '<param name="SamplingRate" value="32000" />';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
191
-	//echo '<param name="MaxDuration" value="60" />';
192
-	//echo '<param name="SoundFileURL" value="http://somewhere.com/mysoundfile.wav" />';//load a file |(default "")
181
+    //echo '<param name="ShowRecordButton" value="false" />'; // default true
182
+    // echo '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
183
+    //echo '<param name="ShowSpeedButton" value="false" />'; // default true
184
+    //echo '<param name="ShowAudioLevel" value="false" />'; //  it displays the audiometer | (default true)
185
+    echo '<param name="ShowTime" value="true" />'; // default false
186
+    //echo '<param name="Color" value="#C0E0FF" />'; // default #FFFFFF
187
+    //echo '<param name="StartTime" value="10.5" />';
188
+    //echo '<param name="EndTime" value="65" />';
189
+    echo '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
190
+    //echo '<param name="SamplingRate" value="32000" />';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
191
+    //echo '<param name="MaxDuration" value="60" />';
192
+    //echo '<param name="SoundFileURL" value="http://somewhere.com/mysoundfile.wav" />';//load a file |(default "")
193 193
 echo '</applet>';
194 194
 
195 195
 echo '<form name="form_nanogong">';
196
-	echo '<input placeholder="'.get_lang('InputNameHere').'" type="text" id="audio_title">';
197
-	echo '<input id="status" type="hidden" name="status" value="0">';
198
-	echo '<button class="upload" type="submit" value="'.get_lang('Send').'" onClick="submitVoice()" />'.get_lang('Send').'</button>';
196
+    echo '<input placeholder="'.get_lang('InputNameHere').'" type="text" id="audio_title">';
197
+    echo '<input id="status" type="hidden" name="status" value="0">';
198
+    echo '<button class="upload" type="submit" value="'.get_lang('Send').'" onClick="submitVoice()" />'.get_lang('Send').'</button>';
199 199
 echo '</form>';
200 200
 
201 201
 echo '</div>';
Please login to merge, or discard this patch.
main/document/exit_pixlr.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
 unset($_SESSION['temp_realpath_image']);
25 25
 
26 26
 if (!isset($_SESSION['exit_pixlr'])){
27
-	$location=api_get_path(WEB_CODE_PATH).'document/document.php';
28
-	echo '<script>window.parent.location.href="'.$location.'"</script>';
29
-	api_not_allowed(true);
27
+    $location=api_get_path(WEB_CODE_PATH).'document/document.php';
28
+    echo '<script>window.parent.location.href="'.$location.'"</script>';
29
+    api_not_allowed(true);
30 30
 } else {
31
-	echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
32
-	$location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
33
-	echo '<script>window.parent.location.href="'.$location.'"</script>';
34
-	unset($_SESSION['exit_pixlr']);
31
+    echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
32
+    $location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
33
+    echo '<script>window.parent.location.href="'.$location.'"</script>';
34
+    unset($_SESSION['exit_pixlr']);
35 35
 }
Please login to merge, or discard this patch.
main/document/slideshow.inc.php 1 patch
Indentation   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,8 +15,6 @@  discard block
 block discarded – undo
15 15
 	This file has two large sections.
16 16
 	1. code that belongs in document.php, but to avoid clutter I put the code here
17 17
 	2. the function resize_image that handles the image resizing
18
-
19
-
20 18
  *	@author Patrick Cool
21 19
  *	@package chamilo.document
22 20
  *	@todo convert comments to be understandable to phpDocumentor
@@ -34,16 +32,16 @@  discard block
 block discarded – undo
34 32
  *							view is also possible when you choose not to resize the source images
35 33
  */
36 34
 function resize_image($image, $target_width, $target_height, $slideshow = 0) {
37
-	// Modifications by Ivan Tcholakov, 04-MAY-2009.
38
-	$result = array();
39
-	if ( (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing']== 'resizing') or $slideshow == 1) {
40
-		$new_sizes = api_resize_image($image, $target_width, $target_height);
41
-		$result[] = $new_sizes['height'];
42
-		$result[] = $new_sizes['width'];
43
-	} else {		
35
+    // Modifications by Ivan Tcholakov, 04-MAY-2009.
36
+    $result = array();
37
+    if ( (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing']== 'resizing') or $slideshow == 1) {
38
+        $new_sizes = api_resize_image($image, $target_width, $target_height);
39
+        $result[] = $new_sizes['height'];
40
+        $result[] = $new_sizes['width'];
41
+    } else {		
44 42
         $size = api_getimagesize($image);
45
-		$result[] = $size['height'];
46
-		$result[] = $size['width'];
47
-	}
48
-	return $result;
43
+        $result[] = $size['height'];
44
+        $result[] = $size['width'];
45
+    }
46
+    return $result;
49 47
 }
Please login to merge, or discard this patch.
main/resourcelinker/resourcelinker.php 1 patch
Indentation   +462 added lines, -462 removed lines patch added patch discarded remove patch
@@ -79,81 +79,81 @@  discard block
 block discarded – undo
79 79
 */
80 80
 if ($from_learnpath == 'yes')
81 81
 {
82
-	//start from clear every time in LearnPath Builder
83
-	$_SESSION['addedresource'] = null;
84
-	$_SESSION['addedresourceid'] = null;
85
-	$_SESSION['addedresourceassigned'] = null;
86
-	unset ($_SESSION['addedresource']);
87
-	unset ($_SESSION['addedresourceid']);
88
-	unset ($_SESSION['addedresourceassigned']);
82
+    //start from clear every time in LearnPath Builder
83
+    $_SESSION['addedresource'] = null;
84
+    $_SESSION['addedresourceid'] = null;
85
+    $_SESSION['addedresourceassigned'] = null;
86
+    unset ($_SESSION['addedresource']);
87
+    unset ($_SESSION['addedresourceid']);
88
+    unset ($_SESSION['addedresourceassigned']);
89 89
 }
90 90
 
91 91
 // Process a new chapter?
92 92
 if (!empty ($_POST['add_chapter']) && !empty ($_POST['title']))
93 93
 {
94
-	$title = $_POST['title'];
95
-	$description = '';
96
-	if (!empty ($_POST['description']))
97
-	{
98
-		$description = $_POST['description'];
99
-	}
100
-
101
-	// get max display_order so far in this parent chapter
102
-	$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_chapter WHERE learnpath_id = $learnpath_id "." AND parent_chapter_id = $chapter_id";
103
-	$res = Database::query($sql);
104
-	$row = Database::fetch_array($res);
105
-	$max_temp = $row[0];
106
-
107
-	$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_item WHERE "." chapter_id = $chapter_id";
108
-	$res = Database::query($sql);
109
-	$row = Database::fetch_array($res);
110
-	$max_temp2 = $row[0];
111
-	if ($max_temp2 > $max_temp)
112
-	{
113
-		$order = $max_temp2 +1;
114
-	}
115
-	else
116
-	{
117
-		$order = $max_temp +1;
118
-	}
119
-
120
-	$sql = "INSERT INTO $tbl_learnpath_chapter "."(learnpath_id,chapter_name,chapter_description,parent_chapter_id,display_order) "." VALUES "."($learnpath_id, '$title', '$description', $chapter_id, $order )";
121
-	$res = Database::query($sql);
122
-	if ($res !== false)
123
-	{
124
-		$title = '';
125
-		$description = '';
126
-	}
94
+    $title = $_POST['title'];
95
+    $description = '';
96
+    if (!empty ($_POST['description']))
97
+    {
98
+        $description = $_POST['description'];
99
+    }
100
+
101
+    // get max display_order so far in this parent chapter
102
+    $sql = "SELECT MAX(display_order) FROM $tbl_learnpath_chapter WHERE learnpath_id = $learnpath_id "." AND parent_chapter_id = $chapter_id";
103
+    $res = Database::query($sql);
104
+    $row = Database::fetch_array($res);
105
+    $max_temp = $row[0];
106
+
107
+    $sql = "SELECT MAX(display_order) FROM $tbl_learnpath_item WHERE "." chapter_id = $chapter_id";
108
+    $res = Database::query($sql);
109
+    $row = Database::fetch_array($res);
110
+    $max_temp2 = $row[0];
111
+    if ($max_temp2 > $max_temp)
112
+    {
113
+        $order = $max_temp2 +1;
114
+    }
115
+    else
116
+    {
117
+        $order = $max_temp +1;
118
+    }
119
+
120
+    $sql = "INSERT INTO $tbl_learnpath_chapter "."(learnpath_id,chapter_name,chapter_description,parent_chapter_id,display_order) "." VALUES "."($learnpath_id, '$title', '$description', $chapter_id, $order )";
121
+    $res = Database::query($sql);
122
+    if ($res !== false)
123
+    {
124
+        $title = '';
125
+        $description = '';
126
+    }
127 127
 }
128 128
 
129 129
 // This if when a external link is submitted
130 130
 if (!empty ($_POST['external_link_submit']))
131 131
 {
132
-	$add = true;
133
-	if ($add_2_links != "niet toevoegen")
134
-	{
135
-		// add external link to the links table.
136
-		$pos = strpos($external_link, 'ttp:');
137
-		if ($pos == '')
138
-		{
139
-			$external_link = 'http://'.$external_link;
140
-		}
141
-
142
-		$sql = "INSERT INTO $link_table (url, title, category_id) VALUES ('$external_link','$external_link','$add_2_links')";
143
-		$result = Database::query($sql);
144
-		$addedresource[] = "Link";
145
-		$addedresourceid[] = Database::insert_id();
146
-		$_SESSION['addedresource'] = $addedresource;
147
-		$_SESSION['addedresourceid'] = $addedresourceid;
148
-	}
149
-	else
150
-	{
151
-		// do not add external link to the links table
152
-		$addedresource[] = "Externallink";
153
-		$addedresourceid[] = $external_link;
154
-		$_SESSION['addedresource'] = $addedresource;
155
-		$_SESSION['addedresourceid'] = $addedresourceid;
156
-	}
132
+    $add = true;
133
+    if ($add_2_links != "niet toevoegen")
134
+    {
135
+        // add external link to the links table.
136
+        $pos = strpos($external_link, 'ttp:');
137
+        if ($pos == '')
138
+        {
139
+            $external_link = 'http://'.$external_link;
140
+        }
141
+
142
+        $sql = "INSERT INTO $link_table (url, title, category_id) VALUES ('$external_link','$external_link','$add_2_links')";
143
+        $result = Database::query($sql);
144
+        $addedresource[] = "Link";
145
+        $addedresourceid[] = Database::insert_id();
146
+        $_SESSION['addedresource'] = $addedresource;
147
+        $_SESSION['addedresourceid'] = $addedresourceid;
148
+    }
149
+    else
150
+    {
151
+        // do not add external link to the links table
152
+        $addedresource[] = "Externallink";
153
+        $addedresourceid[] = $external_link;
154
+        $_SESSION['addedresource'] = $addedresource;
155
+        $_SESSION['addedresourceid'] = $addedresourceid;
156
+    }
157 157
 }
158 158
 
159 159
 // loading the session variables into local array
@@ -163,107 +163,107 @@  discard block
 block discarded – undo
163 163
 // This is when a resource was added to the session
164 164
 if ($add)
165 165
 {
166
-	// adding the new variable to the local array
167
-	if (empty ($_POST['external_link_submit']))
168
-	{
169
-		//that case is already arranged, see upwards
170
-		$addedresource[] = $content;
171
-		$addedresourceid[] = $add;
172
-	}
173
-	$addedresourceassigned[] = 0;
174
-
175
-	// loading the local array into the session variable
176
-	$_SESSION['addedresource'] = $addedresource;
177
-	$_SESSION['addedresourceid'] = $addedresourceid;
166
+    // adding the new variable to the local array
167
+    if (empty ($_POST['external_link_submit']))
168
+    {
169
+        //that case is already arranged, see upwards
170
+        $addedresource[] = $content;
171
+        $addedresourceid[] = $add;
172
+    }
173
+    $addedresourceassigned[] = 0;
174
+
175
+    // loading the local array into the session variable
176
+    $_SESSION['addedresource'] = $addedresource;
177
+    $_SESSION['addedresourceid'] = $addedresourceid;
178
+
179
+    //---------------------------------------
180
+    //we assign to chapters immediately !
181
+    //---------------------------------------
182
+    $resource_added = false;
183
+    if ($from_learnpath == 'yes')
184
+    {
185
+        $i = 0;
186
+        //calculating the last order of the items of this chapter
187
+        $sql = "SELECT MAX(display_order) FROM $tbl_learnpath_item WHERE chapter_id=$chapter_id";
188
+        $result = Database::query($sql);
189
+        if(Database::num_rows($result)==0){
190
+            $lastorder_item = 0;
191
+        }else{
192
+            $row = Database::fetch_array($result);
193
+            $lastorder_item = ($row[0]);
194
+        }
195
+        $sql = "SELECT MAX(display_order) FROM $tbl_learnpath_chapter WHERE parent_chapter_id=$chapter_id";
196
+        $result = Database::query($sql);
197
+        if(Database::num_rows($result)==0){
198
+            $lastorder_chapter = 0;
199
+        }else{
200
+            $row = Database::fetch_array($result);
201
+            $lastorder_chapter = ($row[0]);
202
+        }
203
+        $lastorder = ($lastorder_chapter>$lastorder_item?$lastorder_chapter+1:$lastorder_item+1);
178 204
 
179
-	//---------------------------------------
180
-	//we assign to chapters immediately !
181
-	//---------------------------------------
182
-	$resource_added = false;
183
-	if ($from_learnpath == 'yes')
184
-	{
185
-		$i = 0;
186
-		//calculating the last order of the items of this chapter
187
-		$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_item WHERE chapter_id=$chapter_id";
188
-		$result = Database::query($sql);
189
-		if(Database::num_rows($result)==0){
190
-			$lastorder_item = 0;
191
-		}else{
192
-			$row = Database::fetch_array($result);
193
-			$lastorder_item = ($row[0]);
194
-		}
195
-		$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_chapter WHERE parent_chapter_id=$chapter_id";
196
-		$result = Database::query($sql);
197
-		if(Database::num_rows($result)==0){
198
-			$lastorder_chapter = 0;
199
-		}else{
200
-			$row = Database::fetch_array($result);
201
-			$lastorder_chapter = ($row[0]);
202
-		}
203
-		$lastorder = ($lastorder_chapter>$lastorder_item?$lastorder_chapter+1:$lastorder_item+1);
204
-
205
-		foreach ($addedresource as $addedresource_item)
206
-		{
207
-			// in the case we added a chapter, add this into the chapters list with the correct parent_id
208
-			if ($addedresource_item == "Chap")
209
-			{
210
-				$sql = "INSERT INTO $tbl_learnpath_chapter ("."'learnpath_id','chapter_name','chapter_description','parent_chapter_id','display_order'".") VALUES (".$learnpath_id.",'".$learnpath_chapter_name."','".$learnpath_chapter_description."',".$chapter_id.",".$lastorder.")";
211
-				Database::query($sql);
212
-			}
213
-
214
-			if (!$addedresourceassigned[$i])
215
-			{
216
-				//not to assign it twice
217
-				if ($addedresource_item == "Ass")
218
-				{
219
-					$addedresource_item = "Assignments";
220
-				}
221
-				if ($addedresource_item == "Drop")
222
-				{
223
-					$addedresource_item = "Dropbox";
224
-				}
225
-				if ($addedresource_item == "Intro")
226
-				{
227
-					$addedresource_item = "Introduction_text";
228
-				}
229
-				if ($addedresource_item == "Course_desc")
230
-				{
231
-					$addedresource_item = "Course_description";
232
-				}
233
-				if ($addedresource_item == "Group")
234
-				{
235
-					$addedresource_item = "Groups";
236
-				}
237
-				if ($addedresource_item == "User")
238
-				{
239
-					$addedresource_item = "Users";
240
-				}
241
-				if ($target == '')
242
-				{
243
-					$target = '_self';
244
-				}
245
-				if ($addedresource_item == 'Link')
246
-				{
247
-					$addedresource_item .= ' '.$target;
248
-				}
249
-				$sql = "INSERT INTO $tbl_learnpath_item (id, chapter_id, item_type, item_id, display_order) VALUES ( '$autoid', '$chapter_id', '$addedresource_item','$addedresourceid[$i]','".$lastorder."')";
250
-				$result = Database::query($sql);
251
-				$addedresourceassigned[$i] = 1;
252
-				$resource_added = true;
253
-			}
254
-			$i ++;
255
-			$lastorder ++;
256
-		}
257
-		//$_SESSION['addedresource']=null;
258
-		//$_SESSION['addedresourceid']=null;
259
-		// cleaning up the session once again
260
-		$_SESSION['addedresource'] = null;
261
-   		$_SESSION['addedresourceid'] = null;
262
-   		$_SESSION['addedresourceassigned'] = null;
263
-   		unset ($_SESSION['addedresource']);
264
-   		unset ($_SESSION['addedresourceid']);
265
-   		unset ($_SESSION['addedresourceassigned']);
266
-	}
205
+        foreach ($addedresource as $addedresource_item)
206
+        {
207
+            // in the case we added a chapter, add this into the chapters list with the correct parent_id
208
+            if ($addedresource_item == "Chap")
209
+            {
210
+                $sql = "INSERT INTO $tbl_learnpath_chapter ("."'learnpath_id','chapter_name','chapter_description','parent_chapter_id','display_order'".") VALUES (".$learnpath_id.",'".$learnpath_chapter_name."','".$learnpath_chapter_description."',".$chapter_id.",".$lastorder.")";
211
+                Database::query($sql);
212
+            }
213
+
214
+            if (!$addedresourceassigned[$i])
215
+            {
216
+                //not to assign it twice
217
+                if ($addedresource_item == "Ass")
218
+                {
219
+                    $addedresource_item = "Assignments";
220
+                }
221
+                if ($addedresource_item == "Drop")
222
+                {
223
+                    $addedresource_item = "Dropbox";
224
+                }
225
+                if ($addedresource_item == "Intro")
226
+                {
227
+                    $addedresource_item = "Introduction_text";
228
+                }
229
+                if ($addedresource_item == "Course_desc")
230
+                {
231
+                    $addedresource_item = "Course_description";
232
+                }
233
+                if ($addedresource_item == "Group")
234
+                {
235
+                    $addedresource_item = "Groups";
236
+                }
237
+                if ($addedresource_item == "User")
238
+                {
239
+                    $addedresource_item = "Users";
240
+                }
241
+                if ($target == '')
242
+                {
243
+                    $target = '_self';
244
+                }
245
+                if ($addedresource_item == 'Link')
246
+                {
247
+                    $addedresource_item .= ' '.$target;
248
+                }
249
+                $sql = "INSERT INTO $tbl_learnpath_item (id, chapter_id, item_type, item_id, display_order) VALUES ( '$autoid', '$chapter_id', '$addedresource_item','$addedresourceid[$i]','".$lastorder."')";
250
+                $result = Database::query($sql);
251
+                $addedresourceassigned[$i] = 1;
252
+                $resource_added = true;
253
+            }
254
+            $i ++;
255
+            $lastorder ++;
256
+        }
257
+        //$_SESSION['addedresource']=null;
258
+        //$_SESSION['addedresourceid']=null;
259
+        // cleaning up the session once again
260
+        $_SESSION['addedresource'] = null;
261
+            $_SESSION['addedresourceid'] = null;
262
+            $_SESSION['addedresourceassigned'] = null;
263
+            unset ($_SESSION['addedresource']);
264
+            unset ($_SESSION['addedresourceid']);
265
+            unset ($_SESSION['addedresourceassigned']);
266
+    }
267 267
 }
268 268
 
269 269
 /*
@@ -278,64 +278,64 @@  discard block
 block discarded – undo
278 278
 */
279 279
 if ($_GET["source_id"])
280 280
 {
281
-	switch ($_GET["source_id"])
282
-	{
283
-		case "1" : // coming from Agenda
284
-			if ($action == "edit")
285
-			{
286
-				$url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
287
-			}
288
-			elseif ($action == "add")
289
-		{
290
-				$url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
291
-			}
292
-			else
293
-			{
294
-				$url = "../calendar/agenda.php?action=add";
295
-			}
296
-			$originaltoolname = get_lang("Agenda");
297
-			$breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
298
-			session_unregister('from_learnpath');
299
-			unset ($from_learnpath);
300
-			break;
301
-		case "2" : // coming from forum: new topic
302
-			$url = "../phpbb/newtopic.php?forum=$source_forum&md5=$md5";
303
-			$originaltoolname = get_lang("ForumAddNewTopic");
304
-			$breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
305
-			session_unregister('from_learnpath');
306
-			unset ($from_learnpath);
307
-			break;
308
-		case "3" : // coming from forum: edit topic
309
-			$url = "../phpbb/editpost.php?post_id=$post_id&topic=$topic&forum=$forum&md5=$md5&originalresource=no";
310
-			$originaltoolname = get_lang("ForumEditTopic");
311
-			$breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
312
-			session_unregister('from_learnpath');
313
-			unset ($from_learnpath);
314
-			break;
315
-		case "4" : // coming from exercises: edit topic
316
-			$url = "../exercice/admin.php?modifyAnswers=$modifyAnswers";
317
-			$originaltoolname = get_lang("ExerciseAnswers");
318
-			$breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
319
-			session_unregister('from_learnpath');
320
-			unset ($from_learnpath);
321
-			break;
322
-		case "5" : // coming from learning path
323
-			$from_learnpath = 'yes';
324
-			Session::write('from_learnpath',$from_learnpath);
325
-			break;
326
-			/*************************************** end add [email protected] *********************************/
327
-
328
-	}
329
-	// We do not come from the learning path. We store the name of the tool & url in a session.
330
-	if ($from_learnpath != 'yes')
331
-	{
332
-		if (!$_SESSION["origintoolurl"] OR $_SESSION["origintoolurl"]<>$interbreadcrumb["url"])
333
-		{
334
-			$_SESSION["origintoolurl"] = $breadcrumbelement["url"];
335
-			$_SESSION["origintoolname"] = $breadcrumbelement["name"];
336
-			$interbreadcrumb = "";
337
-		}
338
-	}
281
+    switch ($_GET["source_id"])
282
+    {
283
+        case "1" : // coming from Agenda
284
+            if ($action == "edit")
285
+            {
286
+                $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
287
+            }
288
+            elseif ($action == "add")
289
+        {
290
+                $url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
291
+            }
292
+            else
293
+            {
294
+                $url = "../calendar/agenda.php?action=add";
295
+            }
296
+            $originaltoolname = get_lang("Agenda");
297
+            $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
298
+            session_unregister('from_learnpath');
299
+            unset ($from_learnpath);
300
+            break;
301
+        case "2" : // coming from forum: new topic
302
+            $url = "../phpbb/newtopic.php?forum=$source_forum&md5=$md5";
303
+            $originaltoolname = get_lang("ForumAddNewTopic");
304
+            $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
305
+            session_unregister('from_learnpath');
306
+            unset ($from_learnpath);
307
+            break;
308
+        case "3" : // coming from forum: edit topic
309
+            $url = "../phpbb/editpost.php?post_id=$post_id&topic=$topic&forum=$forum&md5=$md5&originalresource=no";
310
+            $originaltoolname = get_lang("ForumEditTopic");
311
+            $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
312
+            session_unregister('from_learnpath');
313
+            unset ($from_learnpath);
314
+            break;
315
+        case "4" : // coming from exercises: edit topic
316
+            $url = "../exercice/admin.php?modifyAnswers=$modifyAnswers";
317
+            $originaltoolname = get_lang("ExerciseAnswers");
318
+            $breadcrumbelement = array ("url" => $url, "name" => $originaltoolname);
319
+            session_unregister('from_learnpath');
320
+            unset ($from_learnpath);
321
+            break;
322
+        case "5" : // coming from learning path
323
+            $from_learnpath = 'yes';
324
+            Session::write('from_learnpath',$from_learnpath);
325
+            break;
326
+            /*************************************** end add [email protected] *********************************/
327
+
328
+    }
329
+    // We do not come from the learning path. We store the name of the tool & url in a session.
330
+    if ($from_learnpath != 'yes')
331
+    {
332
+        if (!$_SESSION["origintoolurl"] OR $_SESSION["origintoolurl"]<>$interbreadcrumb["url"])
333
+        {
334
+            $_SESSION["origintoolurl"] = $breadcrumbelement["url"];
335
+            $_SESSION["origintoolname"] = $breadcrumbelement["name"];
336
+            $interbreadcrumb = "";
337
+        }
338
+    }
339 339
 
340 340
 }
341 341
 
@@ -343,26 +343,26 @@  discard block
 block discarded – undo
343 343
 // the information from the session. Else we use the information of the learningpath itself.
344 344
 if ($from_learnpath != 'yes')
345 345
 {
346
-	$nameTools = get_lang('AddResource');
347
-	$interbreadcrumb[] = array ("url" => $_SESSION["origintoolurl"], "name" => $_SESSION["origintoolname"]);
346
+    $nameTools = get_lang('AddResource');
347
+    $interbreadcrumb[] = array ("url" => $_SESSION["origintoolurl"], "name" => $_SESSION["origintoolname"]);
348 348
 }
349 349
 else
350 350
 {
351
-	$learnpath_select_query = "	SELECT * FROM $tbl_learnpath_main
351
+    $learnpath_select_query = "	SELECT * FROM $tbl_learnpath_main
352 352
 		  								WHERE learnpath_id=$learnpath_id";
353
-	$sql_result = Database::query($learnpath_select_query);
354
-	$therow = Database::fetch_array($sql_result);
353
+    $sql_result = Database::query($learnpath_select_query);
354
+    $therow = Database::fetch_array($sql_result);
355 355
 
356
-	$learnpath_chapter_query = "	SELECT * FROM $tbl_learnpath_chapter
356
+    $learnpath_chapter_query = "	SELECT * FROM $tbl_learnpath_chapter
357 357
 		  								WHERE (learnpath_id = '$learnpath_id' and id = '$chapter_id')";
358
-	$sql_result = Database::query($learnpath_chapter_query);
359
-	$therow2 = Database::fetch_array($sql_result);
358
+    $sql_result = Database::query($learnpath_chapter_query);
359
+    $therow2 = Database::fetch_array($sql_result);
360 360
 
361
-	$from_learnpath = 'yes';
362
-	session_register('from_learnpath');
363
-	$interbreadcrumb[] = array ("url" => "../scorm/scormdocument.php", "name" => get_lang('LearningPath'));
364
-	$interbreadcrumb[] = array ("url" => "../learnpath/learnpath_handler.php?learnpath_id=$learnpath_id", "name" => "{$therow['learnpath_name']}");
365
-	$interbreadcrumb[] = array ("url" => api_get_self()."?action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no", "name" => "{$therow2['chapter_name']}");
361
+    $from_learnpath = 'yes';
362
+    session_register('from_learnpath');
363
+    $interbreadcrumb[] = array ("url" => "../scorm/scormdocument.php", "name" => get_lang('LearningPath'));
364
+    $interbreadcrumb[] = array ("url" => "../learnpath/learnpath_handler.php?learnpath_id=$learnpath_id", "name" => "{$therow['learnpath_name']}");
365
+    $interbreadcrumb[] = array ("url" => api_get_self()."?action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no", "name" => "{$therow2['chapter_name']}");
366 366
 
367 367
 }
368 368
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 echo "<h3>".$nameTools;
381 381
 if ($from_learnpath == 'yes')
382 382
 {
383
-	echo get_lang("AddResource")." - {$therow2['chapter_name']}";
383
+    echo get_lang("AddResource")." - {$therow2['chapter_name']}";
384 384
 }
385 385
 echo "</h3>";
386 386
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 $result_select_active=Database::query($sql_select_active);
394 394
 while ($row=Database::fetch_array($result_select_active))
395 395
 {
396
-	$active_modules[]=$row['name'];
396
+    $active_modules[]=$row['name'];
397 397
 }
398 398
 
399 399
 
@@ -536,12 +536,12 @@  discard block
 block discarded – undo
536 536
 
537 537
 if ($from_learnpath != 'yes')
538 538
 {
539
-	echo "<tr><td>&nbsp;</td></tr>";
540
-	echo "<tr><td><b>".get_lang('ResourcesAdded')." (";
541
-	echo count($addedresource);
542
-	echo ")</b></td></tr>";
543
-	echo "<tr><td nowrap><a href=\"".api_get_self()."?showresources=true&action=$action&id=$id&learnpath_id=$learnpath_id&chapter_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('ShowDelete')."</a>";
544
-	echo "</td></tr>";
539
+    echo "<tr><td>&nbsp;</td></tr>";
540
+    echo "<tr><td><b>".get_lang('ResourcesAdded')." (";
541
+    echo count($addedresource);
542
+    echo ")</b></td></tr>";
543
+    echo "<tr><td nowrap><a href=\"".api_get_self()."?showresources=true&action=$action&id=$id&learnpath_id=$learnpath_id&chapter_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('ShowDelete')."</a>";
544
+    echo "</td></tr>";
545 545
 }
546 546
 ?>
547 547
         <tr>
@@ -557,11 +557,11 @@  discard block
 block discarded – undo
557 557
 
558 558
 if ($from_learnpath != 'yes')
559 559
 {
560
-	echo "<form method=\"post\" action=\"{$_SESSION['origintoolurl']}\" style=\"margin: 0px;\"><input type=\"submit\" value=\"".get_lang('Ok')."\"></form>";
560
+    echo "<form method=\"post\" action=\"{$_SESSION['origintoolurl']}\" style=\"margin: 0px;\"><input type=\"submit\" value=\"".get_lang('Ok')."\"></form>";
561 561
 }
562 562
 else
563 563
 {
564
-	echo "<form method=\"get\" action=\"../learnpath/learnpath_handler.php\" style=\"margin: 0px;\"><input type=\"hidden\" name=\"learnpath_id\" value=\"".htmlentities($learnpath_id)."\"><input type=\"submit\" value=\"".'  '.get_lang('Ok').'  '."\"></form>";
564
+    echo "<form method=\"get\" action=\"../learnpath/learnpath_handler.php\" style=\"margin: 0px;\"><input type=\"hidden\" name=\"learnpath_id\" value=\"".htmlentities($learnpath_id)."\"><input type=\"submit\" value=\"".'  '.get_lang('Ok').'  '."\"></form>";
565 565
 }
566 566
 ?>
567 567
 
@@ -577,40 +577,40 @@  discard block
 block discarded – undo
577 577
 
578 578
 if ($resource_added)
579 579
 {
580
-	Display :: display_normal_message(get_lang("ResourceAdded"));
580
+    Display :: display_normal_message(get_lang("ResourceAdded"));
581 581
 }
582 582
 
583 583
 if ($from_learnpath != 'yes')
584 584
 {
585
-	echo count($addedresource)." ".api_strtolower(get_lang('ResourcesAdded'))."<br/>";
585
+    echo count($addedresource)." ".api_strtolower(get_lang('ResourcesAdded'))."<br/>";
586 586
 }
587 587
 //echo "<hr>";
588 588
 
589 589
 // Agenda items -->
590 590
 if ($content == "Agenda")
591 591
 {
592
-	$TABLEAGENDA 			= Database::get_course_table(TABLE_AGENDA);
593
-	$TABLE_ITEM_PROPERTY 	= Database::get_course_table(TABLE_ITEM_PROPERTY);
592
+    $TABLEAGENDA 			= Database::get_course_table(TABLE_AGENDA);
593
+    $TABLE_ITEM_PROPERTY 	= Database::get_course_table(TABLE_ITEM_PROPERTY);
594 594
 
595
-	$sql="SELECT agenda.*, toolitemproperties.*
595
+    $sql="SELECT agenda.*, toolitemproperties.*
596 596
 					FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
597 597
 					WHERE agenda.id = toolitemproperties.ref
598 598
 					AND toolitemproperties.tool='".TOOL_CALENDAR_EVENT."'
599 599
 					AND (toolitemproperties.to_group_id='0' OR toolitemproperties.to_group_id IS NULL)
600 600
 					AND toolitemproperties.visibility='1'";
601 601
 
602
-	$result = Database::query($sql);
603
-
604
-	while ($myrow = Database::fetch_array($result))
605
-	{
606
-		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
607
-		echo "<img src='../img/agenda.gif' alt='agenda'>";
608
-		echo api_convert_and_format_date($myrow["start_date"], null, date_default_timezone_get())."<br />";
609
-		echo "<b>".$myrow["title"]."</b></td></tr><tr><td>";
610
-		echo $myrow["content"]."<br />";
611
-		showorhide_addresourcelink($content, $myrow["id"]);
612
-		echo "</td></tr></table><br />";
613
-	}
602
+    $result = Database::query($sql);
603
+
604
+    while ($myrow = Database::fetch_array($result))
605
+    {
606
+        echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
607
+        echo "<img src='../img/agenda.gif' alt='agenda'>";
608
+        echo api_convert_and_format_date($myrow["start_date"], null, date_default_timezone_get())."<br />";
609
+        echo "<b>".$myrow["title"]."</b></td></tr><tr><td>";
610
+        echo $myrow["content"]."<br />";
611
+        showorhide_addresourcelink($content, $myrow["id"]);
612
+        echo "</td></tr></table><br />";
613
+    }
614 614
 } // end if ($_GET["resource"]=="Agenda")
615 615
 
616 616
 /*
@@ -620,12 +620,12 @@  discard block
 block discarded – undo
620 620
 */
621 621
 if ($content == "chapter")
622 622
 {
623
-	echo '<table><form name="add_chapter" action="'.'" method="POST">'."\n";
624
-	echo '  <tr><td>'.get_lang('Title').'</td><td><input type="text" name="title" value="'.$title.'"></input></td></tr>'."\n";
625
-	echo '  <tr><td>'.get_lang('Description').'</td><td><input type="text" name="description" value="'.$description.'"></input></td></tr>'."\n";
626
-	echo '  <tr><td></td><td><input type="submit" name="add_chapter" value="'.get_lang('AddIt').'"/></td></tr>'."\n";
627
-	echo '</form></table>'."\n";
628
-	//echo "<hr>";
623
+    echo '<table><form name="add_chapter" action="'.'" method="POST">'."\n";
624
+    echo '  <tr><td>'.get_lang('Title').'</td><td><input type="text" name="title" value="'.$title.'"></input></td></tr>'."\n";
625
+    echo '  <tr><td>'.get_lang('Description').'</td><td><input type="text" name="description" value="'.$description.'"></input></td></tr>'."\n";
626
+    echo '  <tr><td></td><td><input type="submit" name="add_chapter" value="'.get_lang('AddIt').'"/></td></tr>'."\n";
627
+    echo '</form></table>'."\n";
628
+    //echo "<hr>";
629 629
 }
630 630
 
631 631
 /*
@@ -640,23 +640,23 @@  discard block
 block discarded – undo
640 640
 //				b. one is a student AND the documents tool is active. Student cannot add documents if the documents tool is inactive (teacher can do this)
641 641
 if ($content == "Document" OR (empty($content) AND (api_is_allowed_to_edit() OR in_array(TOOL_DOCUMENT,$active_modules))) AND !$_GET['showresources'])
642 642
 {
643
-	// setting variables for file locations
644
-	$baseServDir = $_configuration['root_sys'];
645
-	$courseDir = $_course['path']."/document";
646
-	$baseWorkDir = $baseServDir.$courseDir;
647
-	// showing the link to move one folder up (when not in the root folder)
648
-	show_folder_up();
649
-	// showing the blue bar with the path in it when we are not in the root
650
-	if (get_levels($folder))
651
-	{
652
-		echo "<table width=\"100%\"><tr><td bgcolor=\"#4171B5\">";
653
-		echo "<img src=\"../img/opendir.gif\" alt='directory'><font color=\"#ffffff\"><b>";
654
-		echo $folder."</b></font></td></tr></table>";
655
-	}
656
-
657
-	// showing the documents and subfolders of the folder we are in.
658
-	show_documents($folder);
659
-	//echo "<hr>";
643
+    // setting variables for file locations
644
+    $baseServDir = $_configuration['root_sys'];
645
+    $courseDir = $_course['path']."/document";
646
+    $baseWorkDir = $baseServDir.$courseDir;
647
+    // showing the link to move one folder up (when not in the root folder)
648
+    show_folder_up();
649
+    // showing the blue bar with the path in it when we are not in the root
650
+    if (get_levels($folder))
651
+    {
652
+        echo "<table width=\"100%\"><tr><td bgcolor=\"#4171B5\">";
653
+        echo "<img src=\"../img/opendir.gif\" alt='directory'><font color=\"#ffffff\"><b>";
654
+        echo $folder."</b></font></td></tr></table>";
655
+    }
656
+
657
+    // showing the documents and subfolders of the folder we are in.
658
+    show_documents($folder);
659
+    //echo "<hr>";
660 660
 }
661 661
 
662 662
 /*
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
 */
667 667
 if ($content == "Ad_Valvas")
668 668
 {
669
-	$tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
670
-	$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i
669
+    $tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
670
+    $sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i
671 671
 			WHERE
672 672
 				i.tool = '".TOOL_ANNOUNCEMENT."' AND
673 673
 				a.id=i.ref AND
@@ -676,17 +676,17 @@  discard block
 block discarded – undo
676 676
 				i.to_user_id IS NULL
677 677
 			ORDER BY a.display_order ASC";
678 678
 
679
-	$result = Database::query($sql);
680
-	while ($myrow = Database::fetch_array($result))
681
-	{
682
-		echo "<table width=\"100%\"><tr><td>";
683
-		echo "<img src='../img/valves.gif' alt='advalvas'>";
684
-		echo api_convert_and_format_date($myrow["end_date"], DATE_FORMAT_LONG, date_default_timezone_get());
685
-		echo "</td></tr><tr><td>";
686
-		echo $myrow["title"]."<br />";
687
-		showorhide_addresourcelink($content, $myrow["id"]);
688
-		echo "</td></tr></table>";
689
-	}
679
+    $result = Database::query($sql);
680
+    while ($myrow = Database::fetch_array($result))
681
+    {
682
+        echo "<table width=\"100%\"><tr><td>";
683
+        echo "<img src='../img/valves.gif' alt='advalvas'>";
684
+        echo api_convert_and_format_date($myrow["end_date"], DATE_FORMAT_LONG, date_default_timezone_get());
685
+        echo "</td></tr><tr><td>";
686
+        echo $myrow["title"]."<br />";
687
+        showorhide_addresourcelink($content, $myrow["id"]);
688
+        echo "</td></tr></table>";
689
+    }
690 690
 }
691 691
 
692 692
 /*
@@ -696,75 +696,75 @@  discard block
 block discarded – undo
696 696
 */
697 697
 if ($content == "Forum")
698 698
 {
699
-	$TBL_FORUMS 		= Database::get_course_table(TABLE_FORUM);
700
-	$TBL_CATAGORIES 	= Database::get_course_table(TABLE_FORUM_CATEGORY);
701
-	$TBL_FORUMTOPICS 	= Database::get_course_table(TABLE_FORUM_POST);
702
-	$tbl_posts 			= Database::get_course_table(TABLE_FORUM_POST);
703
-	$tbl_posts_text 	= Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE);
704
-
705
-	echo "<table width='100%'>";
699
+    $TBL_FORUMS 		= Database::get_course_table(TABLE_FORUM);
700
+    $TBL_CATAGORIES 	= Database::get_course_table(TABLE_FORUM_CATEGORY);
701
+    $TBL_FORUMTOPICS 	= Database::get_course_table(TABLE_FORUM_POST);
702
+    $tbl_posts 			= Database::get_course_table(TABLE_FORUM_POST);
703
+    $tbl_posts_text 	= Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE);
704
+
705
+    echo "<table width='100%'>";
706
+
707
+    // displaying the categories and the forums
708
+    if (!$forum and !$thread)
709
+    {
710
+        $sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.cat_id=categories.cat_id ORDER BY forums.cat_id DESC";
711
+        $result = Database::query($sql);
712
+        while ($myrow = Database::fetch_array($result))
713
+        {
714
+            if ($myrow["cat_title"] !== $old_cat_title)
715
+            {
716
+                echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow["cat_title"]."</b></font></td></tr>";
717
+            }
718
+            $old_cat_title = $myrow["cat_title"];
719
+            echo "<tr><td><img src='../img/forum.gif'><a href='".api_get_self()."?content=Forum&category=".$myrow["cat_id"]."&forum=".$myrow["forum_id"]."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".$myrow["forum_name"]."</td><td>";
720
+            showorhide_addresourcelink("Forum", $myrow["forum_id"]);
721
+            echo "</td></tr>";
722
+        }
723
+    }
724
+    //displaying all the threads of one forum
725
+    if ($forum)
726
+    {
727
+        // displaying the category title
728
+        $sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
729
+        $result = Database::query($sql);
730
+        $myrow = Database::fetch_array($result);
731
+        echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow["cat_title"]."</b></font></td></tr>";
732
+
733
+        // displaying the forum title
734
+        $sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
735
+        $result = Database::query($sql);
736
+        $myrow = Database::fetch_array($result);
737
+        echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow["forum_name"]."</b></td></tr>";
738
+
739
+        if (!$thread)
740
+        {
741
+            // displaying all the threads of this forum
742
+            $sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
743
+            $result = Database::query($sql);
744
+            while ($myrow = Database::fetch_array($result))
745
+            {
746
+                echo "<tr><td><a href='".api_get_self()."?content=Forum&category=$category&forum=1&thread=".$myrow["topic_id"]."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".$myrow["topic_title"]."</a>  (".$myrow["prenom"]." ".$myrow["nom"].")</td><td>";
747
+                showorhide_addresourcelink("Thread", $myrow["topic_id"]);
748
+                echo "</td></tr>";
749
+            }
750
+        }
751
+        else
752
+        {
753
+            // displaying all the replies
754
+            $sql = "SELECT * FROM ".$tbl_posts." post, ".$tbl_posts_text." post_text WHERE post_text.post_id=post.post_id and post.topic_id=$thread ORDER BY post_text.post_id ASC";
755
+            $result = Database::query($sql);
756
+            while ($myrow = Database::fetch_array($result))
757
+            {
758
+                echo "<tr><td><b>".$myrow["post_title"]."</b><br>";
759
+                echo $myrow["post_text"]."</td>";
760
+                echo "<td>";
761
+                showorhide_addresourcelink("Post", $myrow["post_id"]);
762
+                echo "</td></tr><tr><td colspan='2'><hr noshade></td></tr>";
763
+            }
706 764
 
707
-	// displaying the categories and the forums
708
-	if (!$forum and !$thread)
709
-	{
710
-		$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.cat_id=categories.cat_id ORDER BY forums.cat_id DESC";
711
-		$result = Database::query($sql);
712
-		while ($myrow = Database::fetch_array($result))
713
-		{
714
-			if ($myrow["cat_title"] !== $old_cat_title)
715
-			{
716
-				echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow["cat_title"]."</b></font></td></tr>";
717
-			}
718
-			$old_cat_title = $myrow["cat_title"];
719
-			echo "<tr><td><img src='../img/forum.gif'><a href='".api_get_self()."?content=Forum&category=".$myrow["cat_id"]."&forum=".$myrow["forum_id"]."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".$myrow["forum_name"]."</td><td>";
720
-			showorhide_addresourcelink("Forum", $myrow["forum_id"]);
721
-			echo "</td></tr>";
722
-		}
723
-	}
724
-	//displaying all the threads of one forum
725
-	if ($forum)
726
-	{
727
-		// displaying the category title
728
-		$sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
729
-		$result = Database::query($sql);
730
-		$myrow = Database::fetch_array($result);
731
-		echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow["cat_title"]."</b></font></td></tr>";
732
-
733
-		// displaying the forum title
734
-		$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
735
-		$result = Database::query($sql);
736
-		$myrow = Database::fetch_array($result);
737
-		echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow["forum_name"]."</b></td></tr>";
738
-
739
-		if (!$thread)
740
-		{
741
-			// displaying all the threads of this forum
742
-			$sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
743
-			$result = Database::query($sql);
744
-			while ($myrow = Database::fetch_array($result))
745
-			{
746
-				echo "<tr><td><a href='".api_get_self()."?content=Forum&category=$category&forum=1&thread=".$myrow["topic_id"]."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".$myrow["topic_title"]."</a>  (".$myrow["prenom"]." ".$myrow["nom"].")</td><td>";
747
-				showorhide_addresourcelink("Thread", $myrow["topic_id"]);
748
-				echo "</td></tr>";
749
-			}
750
-		}
751
-		else
752
-		{
753
-			// displaying all the replies
754
-			$sql = "SELECT * FROM ".$tbl_posts." post, ".$tbl_posts_text." post_text WHERE post_text.post_id=post.post_id and post.topic_id=$thread ORDER BY post_text.post_id ASC";
755
-			$result = Database::query($sql);
756
-			while ($myrow = Database::fetch_array($result))
757
-			{
758
-				echo "<tr><td><b>".$myrow["post_title"]."</b><br>";
759
-				echo $myrow["post_text"]."</td>";
760
-				echo "<td>";
761
-				showorhide_addresourcelink("Post", $myrow["post_id"]);
762
-				echo "</td></tr><tr><td colspan='2'><hr noshade></td></tr>";
763
-			}
764
-
765
-		}
766
-	}
767
-	echo "</table>";
765
+        }
766
+    }
767
+    echo "</table>";
768 768
 }
769 769
 
770 770
 /*
@@ -774,57 +774,57 @@  discard block
 block discarded – undo
774 774
 */
775 775
 if ($content == "Link")
776 776
 {
777
-	// including the links language file
778
-	include ("../lang/$language/link.inc.php");
779
-
780
-	$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
781
-	if (($learnpath_id != '') and ($content == 'Link'))
782
-	{
783
-		echo "<form name='learnpath_link'><table>";
784
-		echo "<tr></td><td align='left'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target' onchange='targetfunc()'><option value='_self' ";
785
-		if ($target == '_self')
786
-		{
787
-			echo "selected";
788
-		}
789
-		echo ">".get_lang('SameWindow')."</option><option value='_blank'";
790
-		if ($target == '_blank')
791
-		{
792
-			echo "selected";
793
-		}
794
-		echo ">".get_lang('NewWindow')."</option></select></td></tr></table></form>";
795
-	}
796
-
797
-	// showing the links that are in the root (having no category)
798
-	$sql = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE (l.category_id=0 or l.category_id IS NULL) AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1'";
799
-	$result = Database::query($sql);
800
-	if (Database::num_rows($result) > 0)
801
-	{
802
-		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
803
-		while ($myrow = Database::fetch_array($result))
804
-		{
805
-			echo "<img src='../img/links.gif'>".$myrow["title"];
806
-			echo "<br>";
807
-			showorhide_addresourcelink($content, $myrow["id"]);
808
-			echo "<br><br>";
809
-		}
810
-	}
811
-
812
-	// showing the categories and the links in it.
813
-	$sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
814
-	$resultcategories = Database::query($sqlcategories) or die;
815
-	while ($myrow = @ Database::fetch_array($resultcategories))
816
-	{
817
-		$sql_links = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE l.category_id='".$myrow["id"]."' AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1' ORDER BY l.display_order DESC";
818
-		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow["category_title"]."</i></td></tr></table>";
819
-		$result_links = Database::query($sql_links);
820
-		while ($myrow = Database::fetch_array($result_links))
821
-		{
822
-			echo "<img src='../img/links.gif' />".$myrow["title"];
823
-			echo "<br>";
824
-			showorhide_addresourcelink($content, $myrow["id"]);
825
-			echo "<br><br>";
826
-		}
827
-	}
777
+    // including the links language file
778
+    include ("../lang/$language/link.inc.php");
779
+
780
+    $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
781
+    if (($learnpath_id != '') and ($content == 'Link'))
782
+    {
783
+        echo "<form name='learnpath_link'><table>";
784
+        echo "<tr></td><td align='left'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target' onchange='targetfunc()'><option value='_self' ";
785
+        if ($target == '_self')
786
+        {
787
+            echo "selected";
788
+        }
789
+        echo ">".get_lang('SameWindow')."</option><option value='_blank'";
790
+        if ($target == '_blank')
791
+        {
792
+            echo "selected";
793
+        }
794
+        echo ">".get_lang('NewWindow')."</option></select></td></tr></table></form>";
795
+    }
796
+
797
+    // showing the links that are in the root (having no category)
798
+    $sql = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE (l.category_id=0 or l.category_id IS NULL) AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1'";
799
+    $result = Database::query($sql);
800
+    if (Database::num_rows($result) > 0)
801
+    {
802
+        echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
803
+        while ($myrow = Database::fetch_array($result))
804
+        {
805
+            echo "<img src='../img/links.gif'>".$myrow["title"];
806
+            echo "<br>";
807
+            showorhide_addresourcelink($content, $myrow["id"]);
808
+            echo "<br><br>";
809
+        }
810
+    }
811
+
812
+    // showing the categories and the links in it.
813
+    $sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
814
+    $resultcategories = Database::query($sqlcategories) or die;
815
+    while ($myrow = @ Database::fetch_array($resultcategories))
816
+    {
817
+        $sql_links = "SELECT * FROM ".$link_table." l, ".$item_property_table." ip WHERE l.category_id='".$myrow["id"]."' AND ip.tool = '".TOOL_LINK."' AND l.id=ip.ref AND ip.visibility='1' ORDER BY l.display_order DESC";
818
+        echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow["category_title"]."</i></td></tr></table>";
819
+        $result_links = Database::query($sql_links);
820
+        while ($myrow = Database::fetch_array($result_links))
821
+        {
822
+            echo "<img src='../img/links.gif' />".$myrow["title"];
823
+            echo "<br>";
824
+            showorhide_addresourcelink($content, $myrow["id"]);
825
+            echo "<br><br>";
826
+        }
827
+    }
828 828
 }
829 829
 
830 830
 /*
@@ -834,31 +834,31 @@  discard block
 block discarded – undo
834 834
 */
835 835
 if (($content == "Exercise") or ($content == "HotPotatoes"))
836 836
 {
837
-	$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
838
-	$result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY id ASC");
839
-	while ($myrow = Database::fetch_array($result))
840
-	{
841
-		echo "<img src='../img/quiz.gif'>".$myrow["title"]."<br>";
842
-		showorhide_addresourcelink($content, $myrow["id"]);
843
-		echo "<br><br>";
844
-	}
837
+    $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
838
+    $result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY id ASC");
839
+    while ($myrow = Database::fetch_array($result))
840
+    {
841
+        echo "<img src='../img/quiz.gif'>".$myrow["title"]."<br>";
842
+        showorhide_addresourcelink($content, $myrow["id"]);
843
+        echo "<br><br>";
844
+    }
845
+
846
+    if ($from_learnpath == 'yes')
847
+    {
848
+        $uploadPath = "/HotPotatoes_files";
849
+        $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
850
+        $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
851
+        $sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY id ASC";
852
+        $result = Database::query($sql);
853
+        while ($myrow = Database::fetch_array($result))
854
+        {
855
+            $path = $myrow["path"];
856
+            echo "<img src='../img/jqz.gif'>".GetQuizName($path, $documentPath)."<br>";
857
+            showorhide_addresourcelink("HotPotatoes", $myrow["id"]);
858
+            echo "<br><br>";
845 859
 
846
-	if ($from_learnpath == 'yes')
847
-	{
848
-		$uploadPath = "/HotPotatoes_files";
849
-		$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
850
-		$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
851
-		$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY id ASC";
852
-		$result = Database::query($sql);
853
-		while ($myrow = Database::fetch_array($result))
854
-		{
855
-			$path = $myrow["path"];
856
-			echo "<img src='../img/jqz.gif'>".GetQuizName($path, $documentPath)."<br>";
857
-			showorhide_addresourcelink("HotPotatoes", $myrow["id"]);
858
-			echo "<br><br>";
859
-
860
-		}
861
-	}
860
+        }
861
+    }
862 862
 }
863 863
 
864 864
 /*
@@ -876,10 +876,10 @@  discard block
 block discarded – undo
876 876
       <td align="left"><input name="external_link" type="text" id="external_link" value="http://"></td>
877 877
 	  <?php
878 878
 
879
-	if ($learnpath_id != '')
880
-	{
881
-		echo "</tr><tr><td align='right'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target'><option value='_self'>".get_lang('SameWindow')."</option><option value='_blank'>".get_lang('NewWindow')."</option></select></td>";
882
-	}
879
+    if ($learnpath_id != '')
880
+    {
881
+        echo "</tr><tr><td align='right'>".get_lang('LinkTarget')." :</td><td align='left'><select name='target'><option value='_self'>".get_lang('SameWindow')."</option><option value='_blank'>".get_lang('NewWindow')."</option></select></td>";
882
+    }
883 883
 ?>
884 884
 	</tr>
885 885
     <tr>
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 	  <option value="0"><?php echo get_lang('MainCategory'); ?></option>
892 892
 		<?php
893 893
 
894
-	$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
895
-	$sql = "SELECT * FROM $tbl_categories ORDER BY display_order ASC";
896
-	echo $sql;
897
-	$result = Database::query($sql);
898
-	while ($row = Database::fetch_array($result))
899
-	{
900
-		echo "<option value='".$row["id"]."'>".$row["category_title"]."</option>";
901
-	}
894
+    $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
895
+    $sql = "SELECT * FROM $tbl_categories ORDER BY display_order ASC";
896
+    echo $sql;
897
+    $result = Database::query($sql);
898
+    while ($row = Database::fetch_array($result))
899
+    {
900
+        echo "<option value='".$row["id"]."'>".$row["category_title"]."</option>";
901
+    }
902 902
 ?>
903 903
 
904 904
       </select><?php } ?></td>
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 */
928 928
 if ($content == "Assignment")
929 929
 {
930
-	echo "<a href=".api_get_self()."?content=Ass&add=Ass&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no>".get_lang('AddAssignmentPage')."</a>";
930
+    echo "<a href=".api_get_self()."?content=Ass&add=Ass&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no>".get_lang('AddAssignmentPage')."</a>";
931 931
 }
932 932
 
933 933
 /*
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 */
938 938
 if ($content == "Dropbox")
939 939
 {
940
-	echo "<a href='".api_get_self()."?content=Drop&add=Drop&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('DropboxAdd')."</a>";
940
+    echo "<a href='".api_get_self()."?content=Drop&add=Drop&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('DropboxAdd')."</a>";
941 941
 }
942 942
 
943 943
 /*
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 */
948 948
 if ($content == "Introduction_text")
949 949
 {
950
-	echo "<a href='".api_get_self()."?content=Intro&add=Intro&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('IntroductionTextAdd')."</a>";
950
+    echo "<a href='".api_get_self()."?content=Intro&add=Intro&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('IntroductionTextAdd')."</a>";
951 951
 }
952 952
 
953 953
 /*
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 */
958 958
 if ($content == "Course_description")
959 959
 {
960
-	echo "<a href='".api_get_self()."?content=Course_desc&add=Course_desc&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('CourseDescriptionAdd')."</a>";
960
+    echo "<a href='".api_get_self()."?content=Course_desc&add=Course_desc&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('CourseDescriptionAdd')."</a>";
961 961
 }
962 962
 
963 963
 /*
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 */
968 968
 if ($content == "Groups")
969 969
 {
970
-	echo "<a href='".api_get_self()."?content=Group&add=Group&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('$GroupsAdd')."</a>";
970
+    echo "<a href='".api_get_self()."?content=Group&add=Group&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('$GroupsAdd')."</a>";
971 971
 }
972 972
 
973 973
 /*
@@ -977,13 +977,13 @@  discard block
 block discarded – undo
977 977
 */
978 978
 if ($content == "Users")
979 979
 {
980
-	echo "<a href='".api_get_self()."?content=User&add=User&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('UsersAdd')."</a>";
980
+    echo "<a href='".api_get_self()."?content=User&add=User&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".get_lang('UsersAdd')."</a>";
981 981
 }
982 982
 
983 983
 if ($showresources)
984 984
 {
985
-	//echo "<h4>".get_lang('ResourceAdded')."</h4>";
986
-	display_resources(1);
985
+    //echo "<h4>".get_lang('ResourceAdded')."</h4>";
986
+    display_resources(1);
987 987
 }
988 988
 
989 989
 echo "</td></tr></table>";
Please login to merge, or discard this patch.
main/template/default/auth/courses_list.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 
29 29
 // COURSES WITH CATEGORIES
30 30
 if (!empty($user_course_categories)) {
31
-       foreach ($user_course_categories as $row) {
32
-           echo Display::page_subheader($row['title']);
33
-           echo '<a name="category'.$row['id'].'"></a>';
31
+        foreach ($user_course_categories as $row) {
32
+            echo Display::page_subheader($row['title']);
33
+            echo '<a name="category'.$row['id'].'"></a>';
34 34
 
35
-           if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?>
35
+            if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?>
36 36
             <!-- We display the edit form for the category -->
37 37
 
38 38
             <form name="edit_course_category" method="post" action="courses.php?action=<?php echo $action; ?>">
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
                     </a>
244 244
             <?php } else {
245 245
                     echo Display::display_icon('up_na.png', get_lang('Up'),'',22);
246
-                  }
246
+                    }
247 247
 
248
-                  if ($key < $number_of_courses - 1) { ?>
248
+                    if ($key < $number_of_courses - 1) { ?>
249 249
                     <a href="courses.php?action=<?php echo $action; ?>&amp;move=down&amp;course=<?php echo $course['code']; ?>&amp;category=<?php echo $course['user_course_cat']; ?>&amp;sec_token=<?php echo $stok; ?>">
250 250
                     <?php echo Display::display_icon('down.png', get_lang('Down'),'',22); ?>
251 251
                     </a>
252 252
             <?php } else {
253 253
                     echo Display::display_icon('down_na.png', get_lang('Down'),'',22);
254
-                  }?>
254
+                    }?>
255 255
                 </div>
256 256
                  <div style="float:left; margin-right:10px;">
257 257
                   <!-- cancel subscrioption-->
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     </div>
270 270
               <?php }
271 271
                 }
272
-              ?>
272
+                ?>
273 273
             </td>
274 274
             </tr>
275 275
             <?php
Please login to merge, or discard this patch.
main/group/group_overview.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
                     break;
61 61
             }
62 62
             break;
63
-	}
63
+    }
64 64
 }
65 65
 
66 66
 /*	Header */
Please login to merge, or discard this patch.
main/group/settings.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 
4 4
 /**
5 5
  *	This script displays an area where teachers can edit the group properties and member list.
6
-  *
6
+ *
7 7
  *	@author various contributors
8 8
  *	@author Roan Embrechts (VUB), partial code cleanup, initial virtual course support
9 9
  *	@package chamilo.group
Please login to merge, or discard this patch.