Completed
Pull Request — 1.11.x (#1339)
by José
73:57 queued 34:43
created
main/lp/resourcelinker.inc.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
             $ext = strtolower($ext[sizeof($ext)-1]);
289 289
             $myrow['path'] = rawurlencode($myrow['path']);
290 290
 
291
-			$array_ext = array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png');
291
+            $array_ext = array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png');
292 292
 
293
-			if (api_browser_support('svg')) {
294
-				$array_ext[] = 'svg';
295
-			}
296
-			if (api_browser_support('ogg')) {
297
-				$array_ext[] = 'ogg';
298
-			}
293
+            if (api_browser_support('svg')) {
294
+                $array_ext[] = 'svg';
295
+            }
296
+            if (api_browser_support('ogg')) {
297
+                $array_ext[] = 'ogg';
298
+            }
299 299
 
300 300
             $in_frames = in_array($ext, $array_ext);
301 301
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             $result = Database::query($sql);
403 403
             $row = Database::fetch_array($result);
404 404
             if ($row['title'] != '') {
405
-                 $myrow['content'] = $row['title'];
405
+                    $myrow['content'] = $row['title'];
406 406
             }
407 407
             $desc = $row['description'];
408 408
             $ann_id = $row['item_id'];
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             $myrow = Database::fetch_array($result);
509 509
 
510 510
             if ($builder == 'builder') { $origin = 'builder'; }
511
-              // This is needed for the exercise_submit.php can delete the session info about tests.
511
+                // This is needed for the exercise_submit.php can delete the session info about tests.
512 512
 
513 513
             $sql = "select * from $tbl_lp_item where id=$id_in_path";
514 514
             $result = Database::query($sql);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
             $name = GetQuizName($path, $documentPath);
560 560
 
561 561
             if ($builder == 'builder') { $origin='builder'; }
562
-              // This is needed for the exercise_submit.php can delete the session info about tests.
562
+                // This is needed for the exercise_submit.php can delete the session info about tests.
563 563
 
564 564
             $sql = "select * from $tbl_lp_item where id=$id_in_path";
565 565
             $result = Database::query($sql);	$row = Database::fetch_array($result);
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
             $myrow = Database::fetch_array($result);
1123 1123
 
1124 1124
             if ($builder == 'builder') { $origin = 'builder'; }
1125
-              // This is needed for the exercise_submit.php can delete the session info about tests.
1125
+                // This is needed for the exercise_submit.php can delete the session info about tests.
1126 1126
 
1127 1127
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
1128 1128
             $result = Database::query($sql);	$row = Database::fetch_array($result);
@@ -1352,10 +1352,10 @@  discard block
 block discarded – undo
1352 1352
  */
1353 1353
 function delete_all_resources_type($type)
1354 1354
 {
1355
-  $course_id = api_get_course_int_id();
1356
-  $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
1357
-  $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'";
1358
-  Database::query($sql);
1355
+    $course_id = api_get_course_int_id();
1356
+    $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
1357
+    $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'";
1358
+    Database::query($sql);
1359 1359
 }
1360 1360
 
1361 1361
 /**
Please login to merge, or discard this patch.
main/inc/ajax/course_home.ajax.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
             echo json_encode($response_data);
64 64
         }
65 65
         break;
66
-	case 'show_course_information' :
67
-		require_once '../global.inc.php';
66
+    case 'show_course_information' :
67
+        require_once '../global.inc.php';
68 68
 
69
-		// Get the name of the database course.
70
-		$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
71
-		$course_info = api_get_course_info($_GET['code']);
69
+        // Get the name of the database course.
70
+        $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
71
+        $course_info = api_get_course_info($_GET['code']);
72 72
 
73 73
         if (
74 74
             api_get_setting('course_catalog_hide_private') === 'true' &&
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
             break;
79 79
         }
80 80
 
81
-		$sql = "SELECT * FROM $tbl_course_description
81
+        $sql = "SELECT * FROM $tbl_course_description
82 82
 		        WHERE c_id = ".$course_info['real_id']." AND session_id = 0
83 83
 		        ORDER BY id";
84
-		$result = Database::query($sql);
85
-		if (Database::num_rows($result) > 0 ) {
86
-		    while ($description = Database::fetch_object($result)) {
87
-			    $descriptions[$description->id] = $description;
88
-		    }
84
+        $result = Database::query($sql);
85
+        if (Database::num_rows($result) > 0 ) {
86
+            while ($description = Database::fetch_object($result)) {
87
+                $descriptions[$description->id] = $description;
88
+            }
89 89
             // Function that displays the details of the course description in html.
90
-		    echo CourseManager::get_details_course_description_html(
90
+            echo CourseManager::get_details_course_description_html(
91 91
                 $descriptions,
92 92
                 api_get_system_encoding(),
93 93
                 false
94 94
             );
95
-		} else {
96
-		    echo get_lang('NoDescription');
97
-		}
98
-	    break;
95
+        } else {
96
+            echo get_lang('NoDescription');
97
+        }
98
+        break;
99 99
     case 'session_courses_lp_default':
100 100
         /**
101 101
          * @todo this functions need to belong to a class or a special
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $sidx  = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
111 111
         $sord  = $_REQUEST['sord'];    //asc or desc
112 112
         if (!in_array($sord, array('asc','desc'))) {
113
-        	$sord = 'desc';
113
+            $sord = 'desc';
114 114
         }
115 115
         $session_id  = intval($_REQUEST['session_id']);
116 116
         $course_id   = intval($_REQUEST['course_id']);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     $my_session_list[] = $item['id_session'];
125 125
             }
126 126
             if (!in_array($session_id, $my_session_list)) {
127
-            	break;
127
+                break;
128 128
             }
129 129
         }
130 130
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                     $date = '-';
446 446
                 }
447 447
 
448
-                 //Checking LP publicated and expired_on dates
448
+                    //Checking LP publicated and expired_on dates
449 449
                 if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') {
450 450
                     if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
451 451
                         continue;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
         echo json_encode($response);
501 501
         break;
502
-	default:
503
-		echo '';
502
+    default:
503
+        echo '';
504 504
 }
505 505
 exit;
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_user.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 $newstudents = $evaluation[0]->get_not_subscribed_students();
19 19
 
20 20
 if (count($newstudents) == '0') {
21
-	header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
22
-	exit;
21
+    header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
22
+    exit;
23 23
 }
24 24
 $add_user_form = new EvalForm(
25 25
     EvalForm :: TYPE_ADD_USERS_TO_EVAL,
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 
68 68
 $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('Gradebook'));
69 69
 $interbreadcrumb[]= array(
70
-	'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
71
-	'name' => get_lang('ViewResult')
70
+    'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
71
+    'name' => get_lang('ViewResult')
72 72
 );
73 73
 Display :: display_header(get_lang('AddUserToEval'));
74 74
 if (isset ($_GET['erroroneuser'])){
75
-	Display :: display_warning_message(get_lang('AtLeastOneUser'),false);
75
+    Display :: display_warning_message(get_lang('AtLeastOneUser'),false);
76 76
 }
77 77
 DisplayGradebook :: display_header_result($evaluation[0], null, 0,0);
78 78
 echo '<div class="main">';
Please login to merge, or discard this patch.
main/dropbox/dropbox_class.inc.php 1 patch
Indentation   +422 added lines, -422 removed lines patch added patch discarded remove patch
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }
80 80
 
81
-	/**
82
-	 * private function creating a new work object
83
-	 *
84
-	 * @param int $uploader_id
85
-	 * @param string $title
86
-	 * @param string $description
87
-	 * @param string $author
88
-	 * @param string $filename
89
-	 * @param int $filesize
90
-	 *
91
-	 * @todo 	$author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads)
92
-	 * 			As a consequence this parameter can be removed
93
-	 */
94
-	public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize)
81
+    /**
82
+     * private function creating a new work object
83
+     *
84
+     * @param int $uploader_id
85
+     * @param string $title
86
+     * @param string $description
87
+     * @param string $author
88
+     * @param string $filename
89
+     * @param int $filesize
90
+     *
91
+     * @todo 	$author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads)
92
+     * 			As a consequence this parameter can be removed
93
+     */
94
+    public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize)
95 95
     {
96 96
         $dropbox_cnf = getDropboxConf();
97 97
 
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
         // Check if object exists already. If it does, the old object is used
110 110
         // with updated information (authors, description, upload_date)
111 111
         $this->isOldWork = false;
112
-		$sql = "SELECT id, upload_date FROM ".$dropbox_cnf['tbl_file']."
112
+        $sql = "SELECT id, upload_date FROM ".$dropbox_cnf['tbl_file']."
113 113
 				WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'";
114 114
         $result = Database::query($sql);
115
-		$res = Database::fetch_array($result);
116
-		if ($res) {
117
-			$this->isOldWork = true;
118
-		}
119
-		// Insert or update the dropbox_file table and set the id property
120
-		if ($this->isOldWork) {
121
-			$this->id = $res['id'];
122
-			$this->upload_date = $res['upload_date'];
115
+        $res = Database::fetch_array($result);
116
+        if ($res) {
117
+            $this->isOldWork = true;
118
+        }
119
+        // Insert or update the dropbox_file table and set the id property
120
+        if ($this->isOldWork) {
121
+            $this->id = $res['id'];
122
+            $this->upload_date = $res['upload_date'];
123 123
 
124 124
             $params = [
125 125
                 'filesize' => $this->filesize,
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
                 ['c_id = ? AND id = ?' => [$course_id, $this->id]]
137 137
             );
138 138
 
139
-		} else {
140
-			$this->upload_date = $this->last_upload_date;
141
-			$params = [
139
+        } else {
140
+            $this->upload_date = $this->last_upload_date;
141
+            $params = [
142 142
                 'c_id' => $course_id,
143 143
                 'uploader_id' => $this->uploader_id,
144 144
                 'filename' => $this->filename,
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
                 'last_upload_date' => $this->last_upload_date,
151 151
                 'session_id' => api_get_session_id(),
152 152
                 'cat_id' => 0
153
-			];
153
+            ];
154 154
 
155
-			$this->id = Database::insert($dropbox_cnf['tbl_file'], $params);
156
-			if ($this->id) {
157
-				$sql = "UPDATE ".$dropbox_cnf['tbl_file']." SET id = iid WHERE iid = {$this->id}";
158
-				Database::query($sql);
159
-			}
160
-		}
155
+            $this->id = Database::insert($dropbox_cnf['tbl_file'], $params);
156
+            if ($this->id) {
157
+                $sql = "UPDATE ".$dropbox_cnf['tbl_file']." SET id = iid WHERE iid = {$this->id}";
158
+                Database::query($sql);
159
+            }
160
+        }
161 161
 
162 162
         $sql = "SELECT count(file_id) as count
163 163
         		FROM ".$dropbox_cnf['tbl_person']."
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
                     VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")";
172 172
             Database::query($sql);
173 173
         }
174
-	}
175
-
176
-	/**
177
-	 * private function creating existing object by retreiving info from db
178
-	 *
179
-	 * @param int $id
180
-	 */
181
-	public function _createExistingWork($id)
174
+    }
175
+
176
+    /**
177
+     * private function creating existing object by retreiving info from db
178
+     *
179
+     * @param int $id
180
+     */
181
+    public function _createExistingWork($id)
182 182
     {
183
-	    $course_id = api_get_course_int_id();
183
+        $course_id = api_get_course_int_id();
184 184
         $dropbox_cnf = getDropboxConf();
185 185
 
186 186
         $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -231,52 +231,52 @@  discard block
 block discarded – undo
231 231
             }
232 232
             $this->feedback2= $feedback2;
233 233
         }
234
-	}
234
+    }
235 235
 }
236 236
 
237 237
 class Dropbox_SentWork extends Dropbox_Work
238 238
 {
239
-	public $recipients;	//array of ['id']['name'] arrays
240
-
241
-	/**
242
-	 * Constructor calls private functions to create a new work or retreive an existing work from DB
243
-	 * depending on the number of parameters
244
-	 *
245
-	 * @param unknown_type $arg1
246
-	 * @param unknown_type $arg2
247
-	 * @param unknown_type $arg3
248
-	 * @param unknown_type $arg4
249
-	 * @param unknown_type $arg5
250
-	 * @param unknown_type $arg6
251
-	 * @param unknown_type $arg7
252
-	 * @return Dropbox_SentWork
253
-	 */
254
-	public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null)
239
+    public $recipients;	//array of ['id']['name'] arrays
240
+
241
+    /**
242
+     * Constructor calls private functions to create a new work or retreive an existing work from DB
243
+     * depending on the number of parameters
244
+     *
245
+     * @param unknown_type $arg1
246
+     * @param unknown_type $arg2
247
+     * @param unknown_type $arg3
248
+     * @param unknown_type $arg4
249
+     * @param unknown_type $arg5
250
+     * @param unknown_type $arg6
251
+     * @param unknown_type $arg7
252
+     * @return Dropbox_SentWork
253
+     */
254
+    public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null)
255 255
     {
256
-		if (func_num_args() > 1) {
257
-		    $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7);
258
-		} else {
259
-			$this->_createExistingSentWork($arg1);
260
-		}
261
-	}
262
-
263
-	/**
264
-	 * private function creating a new SentWork object
265
-	 *
266
-	 * @param int $uploader_id
267
-	 * @param string $title
268
-	 * @param string $description
269
-	 * @param string $author
270
-	 * @param string $filename
271
-	 * @param int $filesize
272
-	 * @param array $recipient_ids
273
-	 */
274
-	public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids)
256
+        if (func_num_args() > 1) {
257
+            $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7);
258
+        } else {
259
+            $this->_createExistingSentWork($arg1);
260
+        }
261
+    }
262
+
263
+    /**
264
+     * private function creating a new SentWork object
265
+     *
266
+     * @param int $uploader_id
267
+     * @param string $title
268
+     * @param string $description
269
+     * @param string $author
270
+     * @param string $filename
271
+     * @param int $filesize
272
+     * @param array $recipient_ids
273
+     */
274
+    public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids)
275 275
     {
276 276
         $dropbox_cnf = getDropboxConf();
277 277
         $_course = api_get_course_info();
278 278
 
279
-		// Call constructor of Dropbox_Work object
279
+        // Call constructor of Dropbox_Work object
280 280
         parent::__construct(
281 281
             $uploader_id,
282 282
             $title,
@@ -286,31 +286,31 @@  discard block
 block discarded – undo
286 286
             $filesize
287 287
         );
288 288
 
289
-		$course_id = api_get_course_int_id();
290
-
291
-		// Do sanity checks on recipient_ids array & property fillin
292
-		// The sanity check for ex-coursemembers is already done in base constructor
293
-		settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type
289
+        $course_id = api_get_course_int_id();
294 290
 
295
-		$justSubmit = false;
296
-		if ( is_int($recipient_ids)) {
297
-			$justSubmit = true;
298
-			$recipient_ids = array($recipient_ids + $this->id);
299
-		} elseif ( count($recipient_ids) == 0) {
300
-			$justSubmit = true;
301
-			$recipient_ids = array($uploader_id);
302
-		}
291
+        // Do sanity checks on recipient_ids array & property fillin
292
+        // The sanity check for ex-coursemembers is already done in base constructor
293
+        settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type
294
+
295
+        $justSubmit = false;
296
+        if ( is_int($recipient_ids)) {
297
+            $justSubmit = true;
298
+            $recipient_ids = array($recipient_ids + $this->id);
299
+        } elseif ( count($recipient_ids) == 0) {
300
+            $justSubmit = true;
301
+            $recipient_ids = array($uploader_id);
302
+        }
303 303
 
304
-		if (! is_array($recipient_ids) || count($recipient_ids) == 0) {
305
-			die(get_lang('GeneralError').' (code 209)');
306
-		}
304
+        if (! is_array($recipient_ids) || count($recipient_ids) == 0) {
305
+            die(get_lang('GeneralError').' (code 209)');
306
+        }
307 307
 
308
-		foreach ($recipient_ids as $rec) {
309
-			if (empty($rec)) die(get_lang('GeneralError').' (code 210)');
310
-			//if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course
311
-				//this check is done when validating submitted data
312
-			$this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec));
313
-		}
308
+        foreach ($recipient_ids as $rec) {
309
+            if (empty($rec)) die(get_lang('GeneralError').' (code 210)');
310
+            //if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course
311
+                //this check is done when validating submitted data
312
+            $this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec));
313
+        }
314 314
 
315 315
         $table_post = $dropbox_cnf['tbl_post'];
316 316
         $table_person = $dropbox_cnf['tbl_person'];
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
         $user  = api_get_user_id();
320 320
         $now = api_get_utc_datetime();
321 321
 
322
-		// Insert data in dropbox_post and dropbox_person table for each recipient
323
-		foreach ($this->recipients as $rec) {
322
+        // Insert data in dropbox_post and dropbox_person table for each recipient
323
+        foreach ($this->recipients as $rec) {
324 324
             $file_id = (int)$this->id;
325 325
             $user_id = (int)$rec['id'];
326
-			$sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id)
326
+            $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id)
327 327
                     VALUES ($course_id, $file_id, $user_id, $session_id, '$now', 0)";
328
-	        Database::query($sql);
328
+            Database::query($sql);
329 329
             // If work already exists no error is generated
330 330
 
331 331
             /**
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
                 }
343 343
             }
344 344
 
345
-			// Update item_property table for each recipient
346
-			if (($ownerid = $this->uploader_id) > $dropbox_cnf['mailingIdBase']) {
347
-			    $ownerid = getUserOwningThisMailing($ownerid);
348
-			}
349
-			if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) {
350
-			    $recipid = $ownerid;  // mailing file recipient = mailing id, not a person
351
-			}
345
+            // Update item_property table for each recipient
346
+            if (($ownerid = $this->uploader_id) > $dropbox_cnf['mailingIdBase']) {
347
+                $ownerid = getUserOwningThisMailing($ownerid);
348
+            }
349
+            if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) {
350
+                $recipid = $ownerid;  // mailing file recipient = mailing id, not a person
351
+            }
352 352
             api_item_property_update(
353 353
                 $_course,
354 354
                 TOOL_DROPBOX,
@@ -358,91 +358,91 @@  discard block
 block discarded – undo
358 358
                 null,
359 359
                 $recipid
360 360
             );
361
-		}
362
-	}
363
-
364
-	/**
365
-	 * private function creating existing object by retreiving info from db
366
-	 *
367
-	 * @param unknown_type $id
368
-	 */
369
-	public function _createExistingSentWork($id)
361
+        }
362
+    }
363
+
364
+    /**
365
+     * private function creating existing object by retreiving info from db
366
+     *
367
+     * @param unknown_type $id
368
+     */
369
+    public function _createExistingSentWork($id)
370 370
     {
371 371
         $dropbox_cnf = getDropboxConf();
372 372
         $id = intval($id);
373 373
 
374
-		$course_id = api_get_course_int_id();
374
+        $course_id = api_get_course_int_id();
375 375
 
376
-		// Call constructor of Dropbox_Work object
377
-		parent::__construct($id);
376
+        // Call constructor of Dropbox_Work object
377
+        parent::__construct($id);
378 378
 
379
-		// Fill in recipients array
380
-		$this->recipients = array();
381
-		$sql = "SELECT dest_user_id, feedback_date, feedback
379
+        // Fill in recipients array
380
+        $this->recipients = array();
381
+        $sql = "SELECT dest_user_id, feedback_date, feedback
382 382
 				FROM ".$dropbox_cnf['tbl_post']."
383 383
 				WHERE c_id = $course_id AND file_id = ".intval($id)."";
384 384
         $result = Database::query($sql);
385
-		while ($res = Database::fetch_array($result, 'ASSOC')) {
386
-			// Check for deleted users
387
-			$dest_user_id = $res['dest_user_id'];
388
-			$user_info = api_get_user_info($dest_user_id);
389
-			//$this->category = $res['cat_id'];
390
-			if (!$user_info) {
391
-				$this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', ''));
392
-			} else {
393
-				$this->recipients[] = array(
385
+        while ($res = Database::fetch_array($result, 'ASSOC')) {
386
+            // Check for deleted users
387
+            $dest_user_id = $res['dest_user_id'];
388
+            $user_info = api_get_user_info($dest_user_id);
389
+            //$this->category = $res['cat_id'];
390
+            if (!$user_info) {
391
+                $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', ''));
392
+            } else {
393
+                $this->recipients[] = array(
394 394
                     'id' => $dest_user_id,
395 395
                     'name' => $user_info['complete_name'],
396 396
                     'user_id' => $dest_user_id,
397
-				    'feedback_date' => $res['feedback_date'],
397
+                    'feedback_date' => $res['feedback_date'],
398 398
                     'feedback' => $res['feedback']
399 399
                 );
400
-			}
401
-		}
402
-	}
400
+            }
401
+        }
402
+    }
403 403
 }
404 404
 
405 405
 class Dropbox_Person
406 406
 {
407
-	// The receivedWork and the sentWork arrays are sorted.
408
-	public $receivedWork;	// an array of Dropbox_Work objects
409
-	public $sentWork;		// an array of Dropbox_SentWork objects
410
-
411
-	public $userId = 0;
412
-	public $isCourseAdmin = false;
413
-	public $isCourseTutor = false;
414
-	public $_orderBy = '';	// private property that determines by which field
415
-
416
-	/**
417
-	 * Constructor for recreating the Dropbox_Person object
418
-	 *
419
-	 * @param int $userId
420
-	 * @param bool $isCourseAdmin
421
-	 * @param bool $isCourseTutor
422
-	 * @return Dropbox_Person
423
-	 */
424
-	public function __construct($userId, $isCourseAdmin, $isCourseTutor)
407
+    // The receivedWork and the sentWork arrays are sorted.
408
+    public $receivedWork;	// an array of Dropbox_Work objects
409
+    public $sentWork;		// an array of Dropbox_SentWork objects
410
+
411
+    public $userId = 0;
412
+    public $isCourseAdmin = false;
413
+    public $isCourseTutor = false;
414
+    public $_orderBy = '';	// private property that determines by which field
415
+
416
+    /**
417
+     * Constructor for recreating the Dropbox_Person object
418
+     *
419
+     * @param int $userId
420
+     * @param bool $isCourseAdmin
421
+     * @param bool $isCourseTutor
422
+     * @return Dropbox_Person
423
+     */
424
+    public function __construct($userId, $isCourseAdmin, $isCourseTutor)
425 425
     {
426
-	    $course_id = api_get_course_int_id();
426
+        $course_id = api_get_course_int_id();
427 427
 
428
-		// Fill in properties
428
+        // Fill in properties
429 429
         $this->userId = $userId;
430 430
         $this->isCourseAdmin = $isCourseAdmin;
431 431
         $this->isCourseTutor = $isCourseTutor;
432 432
         $this->receivedWork = array();
433 433
         $this->sentWork = array();
434 434
 
435
-		// Note: perhaps include an ex coursemember check to delete old files
435
+        // Note: perhaps include an ex coursemember check to delete old files
436 436
 
437
-		$session_id = api_get_session_id();
438
-		$condition_session = api_get_session_condition($session_id);
437
+        $session_id = api_get_session_id();
438
+        $condition_session = api_get_session_condition($session_id);
439 439
 
440
-		$post_tbl = Database::get_course_table(TABLE_DROPBOX_POST);
441
-		$person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON);
442
-		$file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE);
440
+        $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST);
441
+        $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON);
442
+        $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE);
443 443
 
444 444
         // Find all entries where this person is the recipient
445
-		$sql = "SELECT DISTINCT r.file_id, r.cat_id
445
+        $sql = "SELECT DISTINCT r.file_id, r.cat_id
446 446
                 FROM $post_tbl r
447 447
                 INNER JOIN $person_tbl p
448 448
                     ON (r.file_id = p.file_id AND r.c_id = $course_id AND p.c_id = $course_id )
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
                      r.dest_user_id = ".intval($this->userId)." $condition_session ";
452 452
 
453 453
         $result = Database::query($sql);
454
-		while ($res = Database::fetch_array($result)) {
455
-			$temp = new Dropbox_Work($res['file_id']);
456
-			$temp->category = $res['cat_id'];
457
-			$this->receivedWork[] = $temp;
458
-		}
459
-		// Find all entries where this person is the sender/uploader
454
+        while ($res = Database::fetch_array($result)) {
455
+            $temp = new Dropbox_Work($res['file_id']);
456
+            $temp->category = $res['cat_id'];
457
+            $this->receivedWork[] = $temp;
458
+        }
459
+        // Find all entries where this person is the sender/uploader
460 460
         $sql = "SELECT DISTINCT f.id
461 461
 				FROM $file_tbl f
462 462
 				INNER JOIN $person_tbl p
@@ -467,261 +467,261 @@  discard block
 block discarded – undo
467 467
                     $condition_session
468 468
                 ";
469 469
         $result = Database::query($sql);
470
-		while ($res = Database::fetch_array($result)) {
471
-			$this->sentWork[] = new Dropbox_SentWork($res['id']);
472
-		}
473
-	}
474
-
475
-	/**
476
-	 * This private method is used by the usort function in  the
477
-	 * orderSentWork and orderReceivedWork methods.
478
-	 * It compares 2 work-objects by 1 of the properties of that object, dictated by the
479
-	 * private property _orderBy
480
-	 *
481
-	 * @param unknown_type $a
482
-	 * @param unknown_type $b
483
-	 * @return int -1, 0 or 1 dependent of the result of the comparison.
484
-	 */
485
-	function _cmpWork($a, $b)
470
+        while ($res = Database::fetch_array($result)) {
471
+            $this->sentWork[] = new Dropbox_SentWork($res['id']);
472
+        }
473
+    }
474
+
475
+    /**
476
+     * This private method is used by the usort function in  the
477
+     * orderSentWork and orderReceivedWork methods.
478
+     * It compares 2 work-objects by 1 of the properties of that object, dictated by the
479
+     * private property _orderBy
480
+     *
481
+     * @param unknown_type $a
482
+     * @param unknown_type $b
483
+     * @return int -1, 0 or 1 dependent of the result of the comparison.
484
+     */
485
+    function _cmpWork($a, $b)
486 486
     {
487
-		$sort = $this->_orderBy;
488
-		$aval = $a->$sort;
489
-		$bval = $b->$sort;
490
-		if ($sort == 'recipients') {
491
-		    // The recipients property is an array so we do the comparison based
492
-		    // on the first item of the recipients array
493
-		    $aval = $aval[0]['name'];
494
-			$bval = $bval[0]['name'];
495
-		}
496
-		if ($sort == 'filesize') {    // Filesize is not a string, so we use other comparison technique
497
-			return $aval < $bval ? -1 : 1;
498
-		} elseif ($sort == 'title') { // Natural order for sorting titles is more "human-friendly"
499
-			return api_strnatcmp($aval, $bval);
500
-		} else {
501
-		    return api_strcasecmp($aval, $bval);
502
-		}
503
-	}
504
-
505
-	/**
506
-	 * A method that sorts the objects in the sentWork array, dependent on the $sort parameter.
507
-	 * $sort can be lastDate, firstDate, title, size, ...
508
-	 *
509
-	 * @param unknown_type $sort
510
-	 */
511
-	function orderSentWork($sort)
487
+        $sort = $this->_orderBy;
488
+        $aval = $a->$sort;
489
+        $bval = $b->$sort;
490
+        if ($sort == 'recipients') {
491
+            // The recipients property is an array so we do the comparison based
492
+            // on the first item of the recipients array
493
+            $aval = $aval[0]['name'];
494
+            $bval = $bval[0]['name'];
495
+        }
496
+        if ($sort == 'filesize') {    // Filesize is not a string, so we use other comparison technique
497
+            return $aval < $bval ? -1 : 1;
498
+        } elseif ($sort == 'title') { // Natural order for sorting titles is more "human-friendly"
499
+            return api_strnatcmp($aval, $bval);
500
+        } else {
501
+            return api_strcasecmp($aval, $bval);
502
+        }
503
+    }
504
+
505
+    /**
506
+     * A method that sorts the objects in the sentWork array, dependent on the $sort parameter.
507
+     * $sort can be lastDate, firstDate, title, size, ...
508
+     *
509
+     * @param unknown_type $sort
510
+     */
511
+    function orderSentWork($sort)
512 512
     {
513
-		switch($sort) {
514
-			case 'lastDate':
515
-				$this->_orderBy = 'last_upload_date';
516
-				break;
517
-			case 'firstDate':
518
-				$this->_orderBy = 'upload_date';
519
-				break;
520
-			case 'title':
521
-				$this->_orderBy = 'title';
522
-				break;
523
-			case 'size':
524
-				$this->_orderBy = 'filesize';
525
-				break;
526
-			case 'author':
527
-				$this->_orderBy = 'author';
528
-				break;
529
-			case 'recipient':
530
-				$this->_orderBy = 'recipients';
531
-				break;
532
-			default:
533
-				$this->_orderBy = 'last_upload_date';
534
-		}
535
-
536
-		usort($this->sentWork, array($this, '_cmpWork'));
537
-	}
538
-
539
-	/**
540
-	 * method that sorts the objects in the receivedWork array, dependent on the $sort parameter.
541
-	 * $sort can be lastDate, firstDate, title, size, ...
542
-	 * @param unknown_type $sort
543
-	 */
544
-	function orderReceivedWork($sort)
513
+        switch($sort) {
514
+            case 'lastDate':
515
+                $this->_orderBy = 'last_upload_date';
516
+                break;
517
+            case 'firstDate':
518
+                $this->_orderBy = 'upload_date';
519
+                break;
520
+            case 'title':
521
+                $this->_orderBy = 'title';
522
+                break;
523
+            case 'size':
524
+                $this->_orderBy = 'filesize';
525
+                break;
526
+            case 'author':
527
+                $this->_orderBy = 'author';
528
+                break;
529
+            case 'recipient':
530
+                $this->_orderBy = 'recipients';
531
+                break;
532
+            default:
533
+                $this->_orderBy = 'last_upload_date';
534
+        }
535
+
536
+        usort($this->sentWork, array($this, '_cmpWork'));
537
+    }
538
+
539
+    /**
540
+     * method that sorts the objects in the receivedWork array, dependent on the $sort parameter.
541
+     * $sort can be lastDate, firstDate, title, size, ...
542
+     * @param unknown_type $sort
543
+     */
544
+    function orderReceivedWork($sort)
545 545
     {
546
-		switch($sort) {
547
-			case 'lastDate':
548
-				$this->_orderBy = 'last_upload_date';
549
-				break;
550
-			case 'firstDate':
551
-				$this->_orderBy = 'upload_date';
552
-				break;
553
-			case 'title':
554
-				$this->_orderBy = 'title';
555
-				break;
556
-			case 'size':
557
-				$this->_orderBy = 'filesize';
558
-				break;
559
-			case 'author':
560
-				$this->_orderBy = 'author';
561
-				break;
562
-			case 'sender':
563
-				$this->_orderBy = 'uploaderName';
564
-				break;
565
-			default:
566
-				$this->_orderBy = 'last_upload_date';
567
-		}
568
-
569
-		usort($this->receivedWork, array($this, '_cmpWork'));
570
-	}
571
-
572
-	/**
573
-	 * Deletes all the received work of this person
574
-	 */
575
-	public function deleteAllReceivedWork()
546
+        switch($sort) {
547
+            case 'lastDate':
548
+                $this->_orderBy = 'last_upload_date';
549
+                break;
550
+            case 'firstDate':
551
+                $this->_orderBy = 'upload_date';
552
+                break;
553
+            case 'title':
554
+                $this->_orderBy = 'title';
555
+                break;
556
+            case 'size':
557
+                $this->_orderBy = 'filesize';
558
+                break;
559
+            case 'author':
560
+                $this->_orderBy = 'author';
561
+                break;
562
+            case 'sender':
563
+                $this->_orderBy = 'uploaderName';
564
+                break;
565
+            default:
566
+                $this->_orderBy = 'last_upload_date';
567
+        }
568
+
569
+        usort($this->receivedWork, array($this, '_cmpWork'));
570
+    }
571
+
572
+    /**
573
+     * Deletes all the received work of this person
574
+     */
575
+    public function deleteAllReceivedWork()
576 576
     {
577
-	    $course_id = api_get_course_int_id();
577
+        $course_id = api_get_course_int_id();
578 578
         $dropbox_cnf = getDropboxConf();
579
-		// Delete entries in person table concerning received works
580
-		foreach ($this->receivedWork as $w) {
579
+        // Delete entries in person table concerning received works
580
+        foreach ($this->receivedWork as $w) {
581 581
             $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']."
582 582
 			        WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'";
583
-			Database::query($sql);
584
-		}
583
+            Database::query($sql);
584
+        }
585 585
         // Check for unused files
586
-		removeUnusedFiles();
587
-	}
588
-
589
-	/**
590
-	 * Deletes all the received categories and work of this person
591
-	 * @param integer $id
592
-	 */
593
-	public function deleteReceivedWorkFolder($id)
586
+        removeUnusedFiles();
587
+    }
588
+
589
+    /**
590
+     * Deletes all the received categories and work of this person
591
+     * @param integer $id
592
+     */
593
+    public function deleteReceivedWorkFolder($id)
594 594
     {
595 595
         $dropbox_cnf = getDropboxConf();
596 596
         $course_id = api_get_course_int_id();
597 597
 
598
-		$id = intval($id);
599
-		$sql = "DELETE FROM ".$dropbox_cnf['tbl_file']."
598
+        $id = intval($id);
599
+        $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']."
600 600
 		        WHERE c_id = $course_id AND cat_id = '".$id."' ";
601
-		if (!Database::query($sql)) return false;
602
-		$sql = "DELETE FROM ".$dropbox_cnf['tbl_category']."
601
+        if (!Database::query($sql)) return false;
602
+        $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']."
603 603
 		        WHERE c_id = $course_id AND cat_id = '".$id."' ";
604
-		if (!Database::query($sql)) return false;
605
-		$sql = "DELETE FROM ".$dropbox_cnf['tbl_post']."
604
+        if (!Database::query($sql)) return false;
605
+        $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']."
606 606
 		        WHERE c_id = $course_id AND cat_id = '".$id."' ";
607
-		if (!Database::query($sql)) return false;
608
-		return true;
609
-	}
610
-
611
-	/**
612
-	 * Deletes a received dropbox file of this person with id=$id
613
-	 *
614
-	 * @param integer $id
615
-	 */
616
-	public function deleteReceivedWork($id)
607
+        if (!Database::query($sql)) return false;
608
+        return true;
609
+    }
610
+
611
+    /**
612
+     * Deletes a received dropbox file of this person with id=$id
613
+     *
614
+     * @param integer $id
615
+     */
616
+    public function deleteReceivedWork($id)
617 617
     {
618
-	    $course_id = api_get_course_int_id();
618
+        $course_id = api_get_course_int_id();
619 619
         $dropbox_cnf = getDropboxConf();
620
-		$id = intval($id);
621
-
622
-		// index check
623
-		$found = false;
624
-		foreach ($this->receivedWork as $w) {
625
-			if ($w->id == $id) {
626
-			   $found = true;
627
-			   break;
628
-			}
629
-		}
630
-
631
-		if (!$found) {
632
-			if (!$this->deleteReceivedWorkFolder($id)) {
633
-				die(get_lang('GeneralError').' (code 216)');
634
-			}
635
-		}
636
-		// Delete entries in person table concerning received works
620
+        $id = intval($id);
621
+
622
+        // index check
623
+        $found = false;
624
+        foreach ($this->receivedWork as $w) {
625
+            if ($w->id == $id) {
626
+                $found = true;
627
+                break;
628
+            }
629
+        }
630
+
631
+        if (!$found) {
632
+            if (!$this->deleteReceivedWorkFolder($id)) {
633
+                die(get_lang('GeneralError').' (code 216)');
634
+            }
635
+        }
636
+        // Delete entries in person table concerning received works
637 637
         $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']."
638 638
                 WHERE c_id = $course_id AND user_id = '".$this->userId."' AND file_id ='".$id."'";
639
-		Database::query($sql);
640
-		removeUnusedFiles();	// Check for unused files
641
-	}
642
-
643
-	/**
644
-	 * Deletes all the sent dropbox files of this person
645
-	 */
646
-	public function deleteAllSentWork()
639
+        Database::query($sql);
640
+        removeUnusedFiles();	// Check for unused files
641
+    }
642
+
643
+    /**
644
+     * Deletes all the sent dropbox files of this person
645
+     */
646
+    public function deleteAllSentWork()
647 647
     {
648
-	    $course_id = api_get_course_int_id();
648
+        $course_id = api_get_course_int_id();
649 649
         $dropbox_cnf = getDropboxConf();
650
-		//delete entries in person table concerning sent works
651
-		foreach ($this->sentWork as $w) {
650
+        //delete entries in person table concerning sent works
651
+        foreach ($this->sentWork as $w) {
652 652
             $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']."
653 653
                     WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'";
654
-			Database::query($sql);
655
-			removeMoreIfMailing($w->id);
656
-		}
657
-		removeUnusedFiles();	// Check for unused files
658
-	}
659
-
660
-	/**
661
-	 * Deletes a sent dropbox file of this person with id=$id
662
-	 *
663
-	 * @param unknown_type $id
664
-	 */
665
-	public function deleteSentWork($id)
654
+            Database::query($sql);
655
+            removeMoreIfMailing($w->id);
656
+        }
657
+        removeUnusedFiles();	// Check for unused files
658
+    }
659
+
660
+    /**
661
+     * Deletes a sent dropbox file of this person with id=$id
662
+     *
663
+     * @param unknown_type $id
664
+     */
665
+    public function deleteSentWork($id)
666 666
     {
667
-	    $course_id = api_get_course_int_id();
667
+        $course_id = api_get_course_int_id();
668 668
         $dropbox_cnf = getDropboxConf();
669 669
 
670
-		$id = intval($id);
671
-
672
-		// index check
673
-		$found = false;
674
-		foreach ($this->sentWork as $w) {
675
-			if ($w->id == $id) {
676
-			   $found = true;
677
-			   break;
678
-			}
679
-		}
680
-		if (!$found) {
681
-			if (!$this->deleteReceivedWorkFolder($id)) {
682
-				die(get_lang('GeneralError').' (code 219)');
683
-			}
684
-		}
685
-		//$file_id = $this->sentWork[$index]->id;
686
-		// Delete entries in person table concerning sent works
670
+        $id = intval($id);
671
+
672
+        // index check
673
+        $found = false;
674
+        foreach ($this->sentWork as $w) {
675
+            if ($w->id == $id) {
676
+                $found = true;
677
+                break;
678
+            }
679
+        }
680
+        if (!$found) {
681
+            if (!$this->deleteReceivedWorkFolder($id)) {
682
+                die(get_lang('GeneralError').' (code 219)');
683
+            }
684
+        }
685
+        //$file_id = $this->sentWork[$index]->id;
686
+        // Delete entries in person table concerning sent works
687 687
         $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']."
688 688
                 WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'";
689
-		Database::query($sql);
690
-		removeMoreIfMailing($id);
691
-		removeUnusedFiles();	// Check for unused files
692
-	}
693
-
694
-	/**
695
-	 * Updates feedback for received work of this person with id=$id
696
-	 *
697
-	 * @param string $id
698
-	 * @param string $text
699
-	 */
700
-	public function updateFeedback($id, $text)
689
+        Database::query($sql);
690
+        removeMoreIfMailing($id);
691
+        removeUnusedFiles();	// Check for unused files
692
+    }
693
+
694
+    /**
695
+     * Updates feedback for received work of this person with id=$id
696
+     *
697
+     * @param string $id
698
+     * @param string $text
699
+     */
700
+    public function updateFeedback($id, $text)
701 701
     {
702
-	    $course_id = api_get_course_int_id();
702
+        $course_id = api_get_course_int_id();
703 703
         $_course = api_get_course_info();
704 704
         $dropbox_cnf = getDropboxConf();
705 705
 
706
-		$id = intval($id);
707
-
708
-		// index check
709
-		$found = false;
710
-		$wi = -1;
711
-		foreach ($this->receivedWork as $w) {
712
-			$wi++;
713
-			if ($w->id == $id){
714
-			   $found = true;
715
-			   break;
716
-			}  // foreach (... as $wi -> $w) gives error 221! (no idea why...)
717
-		}
718
-		if (!$found) {
719
-			die(get_lang('GeneralError').' (code 221)');
720
-		}
721
-
722
-		$feedback_date = api_get_utc_datetime();
723
-		$this->receivedWork[$wi]->feedback_date = $feedback_date;
724
-		$this->receivedWork[$wi]->feedback = $text;
706
+        $id = intval($id);
707
+
708
+        // index check
709
+        $found = false;
710
+        $wi = -1;
711
+        foreach ($this->receivedWork as $w) {
712
+            $wi++;
713
+            if ($w->id == $id){
714
+                $found = true;
715
+                break;
716
+            }  // foreach (... as $wi -> $w) gives error 221! (no idea why...)
717
+        }
718
+        if (!$found) {
719
+            die(get_lang('GeneralError').' (code 221)');
720
+        }
721
+
722
+        $feedback_date = api_get_utc_datetime();
723
+        $this->receivedWork[$wi]->feedback_date = $feedback_date;
724
+        $this->receivedWork[$wi]->feedback = $text;
725 725
 
726 726
         $params = [
727 727
             'feedback_date' => $feedback_date,
@@ -739,11 +739,11 @@  discard block
 block discarded – undo
739 739
             ]
740 740
         );
741 741
 
742
-		// Update item_property table
742
+        // Update item_property table
743 743
 
744
-		if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf['mailingIdBase']) {
745
-		    $ownerid = getUserOwningThisMailing($ownerid);
746
-		}
744
+        if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf['mailingIdBase']) {
745
+            $ownerid = getUserOwningThisMailing($ownerid);
746
+        }
747 747
         api_item_property_update(
748 748
             $_course,
749 749
             TOOL_DROPBOX,
@@ -754,31 +754,31 @@  discard block
 block discarded – undo
754 754
             $ownerid
755 755
         );
756 756
 
757
-	}
757
+    }
758 758
 
759
-	/**
760
-	 * Filter the received work
761
-	 * @param string $type
762
-	 * @param string $value
763
-	 */
764
-	public function filter_received_work($type, $value)
759
+    /**
760
+     * Filter the received work
761
+     * @param string $type
762
+     * @param string $value
763
+     */
764
+    public function filter_received_work($type, $value)
765 765
     {
766 766
         $dropbox_cnf = getDropboxConf();
767
-    	$new_received_work = array();
768
-		foreach ($this->receivedWork as $work) {
769
-			switch ($type) {
770
-				case 'uploader_id':
771
-					if ($work->uploader_id == $value ||
772
-						($work->uploader_id > $dropbox_cnf['mailingIdBase'] &&
767
+        $new_received_work = array();
768
+        foreach ($this->receivedWork as $work) {
769
+            switch ($type) {
770
+                case 'uploader_id':
771
+                    if ($work->uploader_id == $value ||
772
+                        ($work->uploader_id > $dropbox_cnf['mailingIdBase'] &&
773 773
                         getUserOwningThisMailing($work->uploader_id) == $value)
774 774
                     ) {
775
-						$new_received_work[] = $work;
776
-					}
777
-					break;
778
-				default:
779
-					$new_received_work[] = $work;
780
-			}
781
-		}
782
-		$this->receivedWork = $new_received_work;
783
-	}
775
+                        $new_received_work[] = $work;
776
+                    }
777
+                    break;
778
+                default:
779
+                    $new_received_work[] = $work;
780
+            }
781
+        }
782
+        $this->receivedWork = $new_received_work;
783
+    }
784 784
 }
Please login to merge, or discard this patch.
main/messages/view_message.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
 require_once '../inc/global.inc.php';
8 8
 api_block_anonymous_users();
9 9
 if (api_get_setting('allow_message_tool')!='true') {
10
-	api_not_allowed();
10
+    api_not_allowed();
11 11
 }
12 12
 
13 13
 if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') {
14
-	$this_section = SECTION_SOCIAL;
15
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
16
-	$interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
14
+    $this_section = SECTION_SOCIAL;
15
+    $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
16
+    $interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
17 17
 } else {
18
-	$this_section = SECTION_MYPROFILE;
19
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
18
+    $this_section = SECTION_MYPROFILE;
19
+    $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
20 20
 }
21 21
 
22 22
 $social_right_content = '';
23 23
 
24 24
 if (isset($_GET['f']) && $_GET['f']=='social') {
25
-	$social_parameter = '?f=social';
25
+    $social_parameter = '?f=social';
26 26
 } else {
27
-	if (api_get_setting('extended_profile') == 'true') {
28
-		$social_right_content .= '<div class="actions">';
27
+    if (api_get_setting('extended_profile') == 'true') {
28
+        $social_right_content .= '<div class="actions">';
29 29
 
30
-		if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') {
31
-			$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
30
+        if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') {
31
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
32 32
                 Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
33
-		}
34
-		if (api_get_setting('allow_message_tool') === 'true') {
35
-		    $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
33
+        }
34
+        if (api_get_setting('allow_message_tool') === 'true') {
35
+            $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
36 36
                 Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
37 37
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
38 38
                 Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
39 39
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
40 40
                 Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
41
-		}
42
-		$social_right_content .= '</div>';
43
-	}
41
+        }
42
+        $social_right_content .= '</div>';
43
+    }
44 44
 }
45 45
 
46 46
 if (empty($_GET['id'])) {
Please login to merge, or discard this patch.
main/course_info/delete_course.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     $message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'.
45 45
         get_lang('No').'</a>&nbsp;<a class="btn btn-danger" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'.
46 46
         get_lang('Yes').'</a></p>';
47
-	$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
47
+    $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
48 48
 }
49 49
 Display :: display_header($tool_name, 'Settings');
50 50
 echo Display::page_header($tool_name);
Please login to merge, or discard this patch.
main/course_info/download.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 $this_section = SECTION_COURSES;
11 11
 
12 12
 if (isset($_GET['session']) && $_GET['session']) {
13
-	$archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/';
14
-	$_cid = true;
15
-	$is_courseAdmin = true;
13
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/';
14
+    $_cid = true;
15
+    $is_courseAdmin = true;
16 16
 } else {
17
-	$archive_path = api_get_path(SYS_ARCHIVE_PATH);
17
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH);
18 18
 }
19 19
 
20 20
 $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null;
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 list($extension) = getextension($archive_file);
24 24
 
25 25
 if (empty($extension) || !file_exists($archive_path.$archive_file)) {
26
-	exit;
26
+    exit;
27 27
 }
28 28
 
29 29
 $extension = strtolower($extension);
30 30
 $content_type = '';
31 31
 
32 32
 if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
33
-	$content_type = 'application/force-download';
33
+    $content_type = 'application/force-download';
34 34
 } elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
35
-	$content_type = 'application/force-download';
35
+    $content_type = 'application/force-download';
36 36
 }
37 37
 
38 38
 if (empty($content_type)) {
Please login to merge, or discard this patch.
main/course_description/add.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  discard block
 block discarded – undo
20 20
 $i=1;
21 21
 echo '<div class="actions" style="margin-bottom:30px">';
22 22
 echo '<a href="index.php?'.api_get_cidreq().'">'.
23
-	Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
24
-	'</a>';
23
+    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
24
+    '</a>';
25 25
 ksort($categories);
26 26
 foreach ($categories as $id => $title) {
27
-	if ($i == ADD_BLOCK) {
28
-		echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
29
-			Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
30
-		break;
31
-	} else {
32
-		echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
33
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
34
-		$i++;
35
-	}
27
+    if ($i == ADD_BLOCK) {
28
+        echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
29
+            Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
30
+        break;
31
+    } else {
32
+        echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
33
+            Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
34
+        $i++;
35
+    }
36 36
 }
37 37
 echo '</div>';
38 38
 
39 39
 // error messages
40 40
 if (isset($error) && intval($error) == 1) {
41
-	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
41
+    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
42 42
 }
43 43
 
44 44
 // default header title form
45 45
 $header = '';
46 46
 $description_type = intval($description_type);
47 47
 if ($description_type >= ADD_BLOCK) {
48
-	$header = $default_description_titles[ADD_BLOCK];
48
+    $header = $default_description_titles[ADD_BLOCK];
49 49
 }
50 50
 
51 51
 // display form
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 
74 74
 // display default questions
75 75
 if (isset ($question[$description_type])) {
76
-	$message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
77
-	$message .= $question[$description_type];
78
-	Display::display_normal_message($message, false);
76
+    $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
77
+    $message .= $question[$description_type];
78
+    Display::display_normal_message($message, false);
79 79
 }
80 80
 $form->display();
Please login to merge, or discard this patch.
main/inc/lib/export.lib.inc.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
     }
116 116
 
117 117
     /**
118
-    * Export tabular data to XML-file
119
-    * @param array  Simple array of data to put in XML
120
-    * @param string Name of file to be given to the user
121
-    * @param string Name of common tag to place each line in
122
-    * @param string Name of the root element. A root element should always be given.
123
-    * @param string Encoding in which the data is provided
124
-    */
118
+     * Export tabular data to XML-file
119
+     * @param array  Simple array of data to put in XML
120
+     * @param string Name of file to be given to the user
121
+     * @param string Name of common tag to place each line in
122
+     * @param string Name of the root element. A root element should always be given.
123
+     * @param string Encoding in which the data is provided
124
+     */
125 125
     public static function arrayToXml(
126 126
         $data,
127 127
         $filename = 'export',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         foreach ($data as $row) {
201 201
             $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
202 202
             if (is_array($row['value'])) {
203
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
203
+                $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
204 204
                 $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
205 205
             } else {
206 206
                 $string .= $row['value'];
Please login to merge, or discard this patch.