From aab5ce503aebf4830c5f66ab958b01fb2c9857f0 Mon Sep 17 00:00:00 2001 From: Jeannick94 Date: Wed, 5 May 2021 17:49:16 +0800 Subject: [PATCH 01/19] Mabasa, Samantha, and Nafis - Fixed Bug 201 Unable to download an attachment from a student's submission (file name containing commas) --- Download.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Download.php b/Download.php index 71b49bd..1b6e1f8 100644 --- a/Download.php +++ b/Download.php @@ -8,7 +8,7 @@ session_start(); // 修改这一行设置你的文件下载目录 $file = "./../../lrr_submission".$_GET['file']; -$filename = basename($file); +$filename =basename($file); // 判断文件是否存在 if(!file_exists($file)) die("File does not exist."); @@ -22,8 +22,9 @@ $time = time(); if ( (isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"])) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") { // 发送文件头部 + header("Content-type: $type"); - header("Content-Disposition: attachment;filename=$filename"); + header('Content-Disposition: attachment;filename="'.urldecode($filename).'"' ); header("Content-Transfer-Encoding: binary"); header('Pragma: no-cache'); header('Expires: 0'); From 8b40765c1751c310b89a58c261fbad270300b30a Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 21 May 2021 14:55:55 +0800 Subject: [PATCH 02/19] Download.php: remove the redundant space before the closing parenthesis ')'. --- Download.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Download.php b/Download.php index 1b6e1f8..987a485 100644 --- a/Download.php +++ b/Download.php @@ -8,7 +8,7 @@ session_start(); // 修改这一行设置你的文件下载目录 $file = "./../../lrr_submission".$_GET['file']; -$filename =basename($file); +$filename = basename($file); // 判断文件是否存在 if(!file_exists($file)) die("File does not exist."); @@ -22,9 +22,8 @@ $time = time(); if ( (isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"])) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") { // 发送文件头部 - header("Content-type: $type"); - header('Content-Disposition: attachment;filename="'.urldecode($filename).'"' ); + header('Content-Disposition: attachment;filename="'.urldecode($filename).'"'); header("Content-Transfer-Encoding: binary"); header('Pragma: no-cache'); header('Expires: 0'); From 8fb4c893296c18a2b89856a16355d2ed47d96d0c Mon Sep 17 00:00:00 2001 From: enockkays Date: Fri, 21 May 2021 20:14:43 +0800 Subject: [PATCH 03/19] Enock Jeanick & Omar Bug 189 - students should be able to drop a course. http://118.25.96.118/bugzilla/show_bug.cgi?id=189. We Implemented a button that will enable students to drop a course in case they join a wrong course or something else. --- Course.php | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/Course.php b/Course.php index 60677ce..9af0b0a 100644 --- a/Course.php +++ b/Course.php @@ -99,6 +99,119 @@ if( $_SESSION['user_type'] == "Student") + + + +
  • + + + + + + + + + +
    +
    + +
    +
    + + + + + + + + + + + + +
  • From dd46a636115996c543bc55660f1bd74e8547df2d Mon Sep 17 00:00:00 2001 From: enockkays <32764779+enockkays@users.noreply.github.com> Date: Sat, 12 Jun 2021 17:26:06 +0800 Subject: [PATCH 04/19] Update Course.php Changed the Mysql connection names because at first we used the local server and forgot to change the details when pushing to gitHub. --- Course.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Course.php b/Course.php index 9af0b0a..6ab84f1 100644 --- a/Course.php +++ b/Course.php @@ -144,7 +144,7 @@ if( $_SESSION['user_type'] == "Student") Date: Sat, 12 Jun 2021 19:07:54 +0800 Subject: [PATCH 05/19] Update Course.php --- Course.php | 67 ++++++++++++++++-------------------------------------- 1 file changed, 20 insertions(+), 47 deletions(-) diff --git a/Course.php b/Course.php index 6ab84f1..5ad5d2e 100644 --- a/Course.php +++ b/Course.php @@ -100,17 +100,11 @@ if( $_SESSION['user_type'] == "Student") Marked - - -
  • - - - - - + +
  • + - +
  • - +
    - +
    - + + - - - - - From d5fc7c425ef6c49ea848047001d1dd150c310a28 Mon Sep 17 00:00:00 2001 From: enockkays <32764779+enockkays@users.noreply.github.com> Date: Sat, 12 Jun 2021 19:09:43 +0800 Subject: [PATCH 06/19] Update Course.php --- Course.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Course.php b/Course.php index 5ad5d2e..d7683ef 100644 --- a/Course.php +++ b/Course.php @@ -139,7 +139,7 @@ if( $_SESSION['user_type'] == "Student") Date: Tue, 6 Jul 2021 01:32:17 +0800 Subject: [PATCH 07/19] typo in readme --- Readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.txt b/Readme.txt index 8ed0306..b28306e 100644 --- a/Readme.txt +++ b/Readme.txt @@ -1,5 +1,5 @@ -* Student Regisreation Process is now simplyfied, Student Passport/ID checking process skipped as there is no where find that information currenly. The system now checks Student Passport / National ID from users tables insead of verifying from school databse. +* Student Registration Process is now simplified, Student Passport/ID checking process skipped as there is nowhere find that information currently. The system now checks Student Passport / National ID from users’ tables instead of verifying from school database. -* \ No newline at end of file +* From 2b78896c9b63ee6f9660d091ec4c2a00d862188f Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 21 Jul 2021 21:38:51 +0800 Subject: [PATCH 08/19] README.md: deployment guide. --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 189b8dd..00d505b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,41 @@ Our mission is to make the experience of submitting assignments great for tens o # Installation Instructions -Check file INSTALLATION.md (TBA) for details. + +## Hui's steps + +I spent about two hours on installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS). + +LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04] (https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications. + +LRR uses a database called `lrr`. I need to export existing `lrr` to a plain text file (including many sql commands) and import that text file to the newly created `lrr` database on the new server. +The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.txt`. +The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux] (https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. + +LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files locate). I copied this folder from the existing one. I think it is also OK if you create an empty folder. +We need to set a proper owner and accessibility for `lrr_submission` using the following two commands: +`sudo chown -R www-data:www-data lrr_submission` and `sudo chmod -R g+rw lrr_submission`. Also, remember to change the user name and password in `lrr_submission//KeepItSafe.txt` for the database connection. + +The above steps are preparation work. Now we could clone the LRR's repository to `/var/www/html/`. +Rename LRR to lrr. Change the owner of lrr: `sudo chown -R $USER:$USER /var/www/lrr`. Edit apache configure file: `sudo nano /etc/apache2/sites-available/lrr.conf`. + + + + ServerName lrr + ServerAlias www.lrr.com + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html/lrr + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + +Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo systemctl reload apache2`. +Visit the LRR application by entering this URL: http://121.4.94.30/. + + +## Enock's steps + +Enock has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt). From a7770dc7d48608b5e6ac64c2be21e6e35741eae2 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 21 Jul 2021 21:45:23 +0800 Subject: [PATCH 09/19] README.md: deployment guide (small revision). --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 00d505b..3c2bcf9 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,13 @@ Our mission is to make the experience of submitting assignments great for tens o I spent about two hours on installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS). -LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04] (https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications. +LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications. LRR uses a database called `lrr`. I need to export existing `lrr` to a plain text file (including many sql commands) and import that text file to the newly created `lrr` database on the new server. The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.txt`. -The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux] (https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. +The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. -LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files locate). I copied this folder from the existing one. I think it is also OK if you create an empty folder. +LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files reside). I copied this folder from the existing one. I think it is also OK if you create an empty folder. We need to set a proper owner and accessibility for `lrr_submission` using the following two commands: `sudo chown -R www-data:www-data lrr_submission` and `sudo chmod -R g+rw lrr_submission`. Also, remember to change the user name and password in `lrr_submission//KeepItSafe.txt` for the database connection. @@ -46,7 +46,7 @@ Rename LRR to lrr. Change the owner of lrr: `sudo chown -R $USER:$USER /var/www Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo systemctl reload apache2`. -Visit the LRR application by entering this URL: http://121.4.94.30/. +Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/. ## Enock's steps From 1d8c98514c343065d30988b0d74737f82919f566 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 21 Jul 2021 21:55:04 +0800 Subject: [PATCH 10/19] README.md: FAQ. --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c2bcf9..aa76880 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,11 @@ To submit bug reports or improvement ideas, please ask Hui [lanhui at zjnu.edu.c ## Frequently Asked Questions -Check FAQ.md (TBA) for details. + +1. Q: The web application's front page does not show properly, i.e., elements are not well aligned. + + A: You missed two folders `css` and `font-awesome`. These folders include third-party js or css files and therefore are not included. + From c733251474e68a6b9c40c47ee59849f7cf6dd75c Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 21 Jul 2021 21:58:19 +0800 Subject: [PATCH 11/19] README.md: FAQ (more info). --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa76880..c09b487 100644 --- a/README.md +++ b/README.md @@ -156,9 +156,10 @@ To submit bug reports or improvement ideas, please ask Hui [lanhui at zjnu.edu.c 1. Q: The web application's front page does not show properly, i.e., elements are not well aligned. + A: You missed two folders `css` and `font-awesome`. These folders include third-party js or css files and therefore are not included. - A: You missed two folders `css` and `font-awesome`. These folders include third-party js or css files and therefore are not included. - +1. Q: What if I do not have any information about the `lrr` database? + A: You could use `lrr(1).sql` or `lrr_database.sql`. It seems `lrr(1).sql` is more complete. From 281ba8cc748488305a3e190e8b3aae5a153d1cf7 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 22 Jul 2021 09:31:14 +0800 Subject: [PATCH 12/19] index.php: be more specific on email. --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 0713689..b97837d 100644 --- a/index.php +++ b/index.php @@ -32,7 +32,7 @@ if (isset($_SESSION["user_fullname"])) {
    - Student ID / Email + Student ID / Instructor Email
    Password From 5a76e8fd4a4f450cf7a4daa107e4469bbdc53da9 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 22 Jul 2021 09:43:36 +0800 Subject: [PATCH 13/19] Script.php: bugfix 21 http://118.25.96.118/bugzilla/show_bug.cgi?id=21 --- Script.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Script.php b/Script.php index 851323e..c0ba6a9 100644 --- a/Script.php +++ b/Script.php @@ -414,7 +414,7 @@ if (!empty($_POST["frm_uploadlab"])) { $deadline = $deadlinedate." ".$deadlinetime; - $date = date("Y-m-d H:i"); + $date = date("Y-m-d H:i:s"); @@ -537,7 +537,7 @@ if (!empty($_POST["frm_submitlab"])) { $url = mysqli_real_escape_string($con, $_POST["url"]); $deadline = $deadlinedate." ".$deadlinetime; - $date = date("Y-m-d H:i"); + $date = date("Y-m-d H:i:s"); // GET UPLOADED FILES $labName = mysqli_query($con,"SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID=$lab_id"); @@ -729,7 +729,7 @@ if (!empty($_GET["savemarks"])) { echo " Marks could not be greater than total"; return; } - $date= date("Y-m-d H:i"); + $date= date("Y-m-d H:i:s"); $feedback="
    @$date : ".$feedback; $sql="UPDATE `lab_report_submissions` SET `Marks`='$marks',`Status`='$status'," From f58fba8e45b9f4c14932c79a2e6eb2b3f605157d Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 22 Jul 2021 11:17:43 +0800 Subject: [PATCH 14/19] Script.php: add a few urlencode's. --- Script.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Script.php b/Script.php index c0ba6a9..f153280 100644 --- a/Script.php +++ b/Script.php @@ -633,17 +633,17 @@ if (!empty($_POST["frm_submitlab"])) { $targetfile4 = ""; if(strlen($_FILES['attachment1']['name']) > 2 ) { // why greater than 2??? - $targetfile = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment1']['name']; + $targetfile = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment1']['name']); } if(strlen($_FILES['attachment2']['name']) > 2 ) { - $targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment2']['name']; } + $targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment2']['name']); } if(strlen($_FILES['attachment3']['name']) > 2 ) { - $targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment3']['name'];} + $targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment3']['name']);} if(strlen($_FILES['attachment4']['name']) > 2 ) { - $targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment4']['name']; + $targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment4']['name']); } // When $group_id is not properly initialized, use integer 0 as its value. From 717db846982980db0c6fc2abdb7316d72460c6fc Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 22 Jul 2021 11:20:58 +0800 Subject: [PATCH 15/19] Script.php: add a few rawurlencode's. --- Script.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Script.php b/Script.php index f153280..d1921c7 100644 --- a/Script.php +++ b/Script.php @@ -633,17 +633,17 @@ if (!empty($_POST["frm_submitlab"])) { $targetfile4 = ""; if(strlen($_FILES['attachment1']['name']) > 2 ) { // why greater than 2??? - $targetfile = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment1']['name']); + $targetfile = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment1']['name']); } if(strlen($_FILES['attachment2']['name']) > 2 ) { - $targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment2']['name']); } + $targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment2']['name']); } if(strlen($_FILES['attachment3']['name']) > 2 ) { - $targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment3']['name']);} + $targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment3']['name']);} if(strlen($_FILES['attachment4']['name']) > 2 ) { - $targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".urlencode($_FILES['attachment4']['name']); + $targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment4']['name']); } // When $group_id is not properly initialized, use integer 0 as its value. From 50049bf4433c8d8d103a8f2a15699cdbd5941414 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 22 Jul 2021 22:10:23 +0800 Subject: [PATCH 16/19] Header.php: use head instead of header --- Header.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Header.php b/Header.php index 95dd1c2..6899665 100644 --- a/Header.php +++ b/Header.php @@ -18,8 +18,8 @@ if (mysqli_connect_errno()) { -
    - + + @@ -29,7 +29,7 @@ if (mysqli_connect_errno()) { -
    + From 5cc20395a049a989fc2571161f7c20a370388547 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Sat, 24 Jul 2021 10:27:47 +0800 Subject: [PATCH 17/19] batch_insert.php: indentation looks better now. --- batch_insert.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/batch_insert.php b/batch_insert.php index 00dad1b..20867af 100644 --- a/batch_insert.php +++ b/batch_insert.php @@ -36,13 +36,13 @@ $user = explode(' ', $source2); for($index=0; $index < count($user); $index++) { $result = mysqli_query($conn, "SELECT * FROM `students_data` WHERE Student_ID='$user[$index]'"); if (mysqli_num_rows($result) < 1) { - if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) { + if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) { echo "SQL Error: " . $sql_stmt . "
    " . mysqli_error($conn); - } else { - echo "

    Student number $user[$index] added.

    "; - } + } else { + echo "

    Student number $user[$index] added.

    "; + } } else { - echo "

    Student number $user[$index] already exists.

    "; + echo "

    Student number $user[$index] already exists.

    "; } } From 72dda73043a3d73e9b83b9e7dcba8ba9d15d93ac Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Sat, 24 Jul 2021 10:40:43 +0800 Subject: [PATCH 18/19] Admin.php: better indentation. --- Admin.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Admin.php b/Admin.php index b8bb7ba..954109b 100644 --- a/Admin.php +++ b/Admin.php @@ -143,17 +143,17 @@ if(isset($_SESSION['info_Admin_Users'])) { - - - + + + From 9e267b7bf0b8f2d2a8bf75ca50d296d04bc9ac6f Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Sat, 24 Jul 2021 10:41:43 +0800 Subject: [PATCH 19/19] Admin.php: better information. --- Admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Admin.php b/Admin.php index 954109b..fcbe519 100644 --- a/Admin.php +++ b/Admin.php @@ -146,12 +146,12 @@ if(isset($_SESSION['info_Admin_Users'])) {