Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit d45cb0f

Browse files
author
Nathan Shaaban
committed
Merge branch 'dev' of github.com:ctrlaltf24/assignmentsmanager v1.1.5
2 parents 01ba1b2 + f76b133 commit d45cb0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+604
-450
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
resources/BBCodeParser/
2-
resources/CLNDR-1.4.7/
31
public_html/class/
42
public_html/assets
5-
public_html/resources/
6-
public_html/adminer
3+
public_html/adminer
4+
error_log.txt
5+
public_html/resources/googleAuth/

.gitmodules

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[submodule "resources/JBBCode"]
2+
path = resources/JBBCode
3+
url = https://github.com/jbowens/jBBCode.git
4+
[submodule "public_html/resources/CLNDR"]
5+
path = public_html/resources/CLNDR
6+
url = https://github.com/kylestetz/CLNDR.git
7+
[submodule "public_html/resources/MathJax"]
8+
path = public_html/resources/MathJax
9+
url = https://github.com/mathjax/MathJax.git
10+
[submodule "public_html/resources/sceditor"]
11+
path = public_html/resources/sceditor
12+
url = https://github.com/samclarke/SCEditor.git
13+
[submodule "public_html/resources/googleAuth"]
14+
path = public_html/resources/googleAuth_src
15+
url = https://github.com/googleapis/google-api-php-client.git

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Nathan Shaaban
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Assingments Manager
2+
## Branches
3+
master - this is on production server
4+
staging - this code is ready for testing/should be stable
5+
dev - this code is unstable and is under active development
6+
## Setup
7+
TODO: Make dbs if not found
8+
edit creds in resources.
9+
```bash
10+
git update-index --skip-worktree resources/connectAdmin.php
11+
git update-index --skip-worktree resources/connectRaw.php
12+
```

public_html/demo.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

public_html/fetch/chapter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
$subject=$_GET["subject"];
66
}
77
$chapters = array();
8-
$results=$conn->query("SELECT DISTINCT chapter FROM assignments WHERE subject=\"".$subject."\"");
8+
if(!$results=$conn->query("SELECT DISTINCT chapter FROM assignments WHERE subject=\"".$subject."\"")){
9+
log_error("failed to get chapters","",$conn->error);
10+
}
911
$results->data_seek(0);
1012
while ($row = $results->fetch_assoc()) {
1113
array_push($chapters,$row["chapter"]);
1214
}
1315
$results->close();
14-
$results=$conn->query("SELECT DISTINCT chapter FROM questions WHERE subject=\"".$subject."\"");
16+
if(!$results=$conn->query("SELECT DISTINCT chapter FROM questions WHERE subject=\"".$subject."\"")){
17+
log_error("failed to get chapters","",$conn->error);
18+
}
1519
$results->data_seek(0);
1620
while ($row = $results->fetch_assoc()) {
1721
array_push($chapters,$row["chapter"]);

public_html/fetch/concept.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
$chapter=$_GET["chapter"];
66
}
77
$concepts = array();
8-
$results=$conn->query("SELECT DISTINCT concept FROM assignments WHERE chapter=\"".$chapter."\"");
8+
if(!$results=$conn->query("SELECT DISTINCT concept FROM assignments WHERE chapter=\"".$chapter."\"")){
9+
log_error("failed to get concepts","",$conn->error);
10+
}
911
$results->data_seek(0);
1012
while ($row = $results->fetch_assoc()) {
1113
array_push($concepts,$row["concept"]);
1214
}
1315
$results->close();
14-
$results=$conn->query("SELECT DISTINCT concept FROM questions WHERE chapter=\"".$chapter."\"");
16+
if(!$results=$conn->query("SELECT DISTINCT concept FROM questions WHERE chapter=\"".$chapter."\"")){
17+
log_error("failed to get concepts","",$conn->error);
18+
}
1519
$results->data_seek(0);
1620
while ($row = $results->fetch_assoc()) {
1721
array_push($concepts,$row["concept"]);

public_html/fetch/hint.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,49 @@
55
if (isset($_GET["questionKey"])) {
66
$questionKey = $_GET["questionKey"];
77
} else {
8-
echo "no questionKey";
9-
exit();
8+
log_error("no questionKey","");
109
}
1110
}
1211
if(!isset($assignmentKey)){
1312
if (isset($_GET["assignmentKey"])) {
1413
$assignmentKey = $_GET["assignmentKey"];
1514
} else {
16-
echo "no assignmentKey";
17-
exit();
15+
log_error("no assignmentKey","");
1816
}
1917
}
2018
if(!isset($teacherKey)){
2119
if (isset($_GET["teacherKey"])) {
2220
$teacherKey = $_GET["teacherKey"];
2321
} else {
24-
echo "no teacherKey";
25-
exit();
22+
log_error("no teacherKey","");
2623
}
2724
}
2825
if(!isset($hint_number)){
2926
if (isset($_GET["number"])) {
3027
$hint_number = $_GET["number"];
3128
} else {
32-
echo "no hint number";
33-
exit();
29+
log_error("no hint number","");
3430
}
3531
}
3632
if(!$logged_in) {
37-
echo "Login. I see you found this address and figured out how the hints were retrieved.";
38-
exit();
33+
log_error("Login. I see you found this address and figured out how the hints were retrieved.","");
3934
}
4035
require_once "../../resources/authFunctions.php";
4136
require_once "../../resources/questionFormat.php";
4237
if(questionInAssignment($assignmentKey,$questionKey,$conn,$is_teacher)) {
4338
if(canViewAssignment($assignmentKey,$is_teacher,$conn,$user)) {
44-
$results = $conn->query("SELECT `hints` FROM questions WHERE `key`=$questionKey LIMIT 1");
39+
if(!$results = $conn->query("SELECT `hints` FROM questions WHERE `key`=$questionKey LIMIT 1")){
40+
log_error("failed to get hints","",$conn->error);
41+
}
4542
while ($row = $results->fetch_assoc()) {
4643
$hints = explode(";", $row["hints"]);
4744
foreach (array_keys($hints, "", true) as $key) {
4845
unset($hints[$key]);
4946
}
5047
if (sizeof($hints)+1 != $hint_number) {
51-
$result=$conn->query("SELECT `variables` FROM `variables` WHERE `email`=\"".$user["email"]."\" AND `question`=$questionKey");
48+
if(!$result=$conn->query("SELECT `variables` FROM `variables` WHERE `email`=\"".$user["email"]."\" AND `question`=$questionKey")){
49+
log_error("failed to get variables","",$conn->error);
50+
}
5251
$vars=array();
5352
while($row=$result->fetch_assoc()){
5453
foreach (explode("|",$row["variables"]) as $key => $value){
@@ -58,23 +57,27 @@
5857
}
5958
}
6059
echo format_text_tilde_codes($hints[$hint_number+1],$vars,$teacherKey);//STarts at 1
61-
$result=$conn->query("SELECT `hint` FROM `hints` WHERE `email`=\"".$user["email"]."\" AND `assignmentKey`=$assignmentKey AND `question`=$questionKey AND `hint`=".($hint_number+1));
60+
if(!$result=$conn->query("SELECT `hint` FROM `hints` WHERE `email`=\"".$user["email"]."\" AND `assignmentKey`=$assignmentKey AND `question`=$questionKey AND `hint`=".($hint_number+1))){
61+
log_error("failed to get hints","",$conn->error);
62+
}
6263
$found=false;
6364
while($result->fetch_assoc()){
6465
$found = true;
6566
}
6667
$result->close();
6768
if(!$found) {
68-
$conn->query("INSERT INTO `hints`(`email`, `assignmentKey`, `question`, `hint`, `time`) VALUES (\"" . $user["email"] . "\",$assignmentKey,$questionKey," . ($hint_number + 1) . "," . time() . ")");
69+
if(!$conn->query("INSERT INTO `hints`(`email`, `assignmentKey`, `question`, `hint`, `time`) VALUES (\"" . $user["email"] . "\",$assignmentKey,$questionKey," . ($hint_number + 1) . "," . time() . ")")){
70+
log_error("failed to inser hints","",$conn->error);
71+
}
6972
}
7073
} else {
7174
echo "No more hints";
7275
}
7376
}
7477
$results->close();
7578
} else {
76-
echo "Question not in that assignment silly.";
79+
log_error("Question not in that assignment.","");
7780
}
7881
} else {
79-
echo "Permission Denied";
82+
log_error("Permission Denied","");
8083
}

public_html/fetch/question.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
array_push($whereClause,$key."=\"".$value."\"");
2424
}
2525
}
26-
$results=$conn->query("SELECT * FROM questions WHERE ".($whereClause==array()?"1":join(" AND ",$whereClause)));
26+
if(!$results=$conn->query("SELECT * FROM questions WHERE ".($whereClause==array()?"1":join(" AND ",$whereClause)))){
27+
log_error("failed to get questions","",$conn->error);
28+
}
2729
$results->data_seek(0);
2830
while ($row = $results->fetch_assoc()) {
2931
echo template_option($row["key"],$row["name"]." (".$row["questionType"].") = ".$row["answer"].$row["units"].($row["level"]!=""?(" level = ".$row["level"]):""));

public_html/index.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@
1919
<div class="mdl-cell mdl-cell--8-col-desktop mdl-cell--12-col-tablet mdl-cell--2-offset-desktop">
2020
<h2>Welcome to the site!</h2>
2121
<p>This assignment management system was created for teachers with teachers in mind. It is a work in progress, and strives to be a flexible solution for homework/quiz creation and answer reporting.</p>
22-
<?php if(!isset($demo)||!$demo){?>
23-
<!--<a href="demo.php"><h3>Demo Here</h3></a>-->
24-
<?php } else { ?>
25-
<a href="demo.php"><h3>Go back to regular, non-demo mode</h3></a>
26-
<?php } ?>
2722
<a href="http://class.assignmentsmanager.com"><h3>Go to the class information page.</h3></a>
2823
<h5>Features will include:</h5>
29-
<ul class="demo-list-item mdl-list">
24+
<ul class="mdl-list">
3025
<li class="mdl-list__item">
3126
<span class="mdl-list__item-primary-content">Random numbers in questions</span>
3227
</li>
@@ -39,9 +34,6 @@
3934
<li class="mdl-list__item">
4035
<span class="mdl-list__item-primary-content">Answer reporting</span>
4136
</li>
42-
<li class="mdl-list__item">
43-
<span class="mdl-list__item-primary-content">No IP address long-term storage (small cache is kept to protect users during a session)</span>
44-
</li>
4537
</ul>
4638
</div>
4739
</div>

0 commit comments

Comments
 (0)