Skip to content

Commit d7d7617

Browse files
Merge pull request #160 from untrobotics/master
Master
2 parents 21f2e27 + 0523579 commit d7d7617

File tree

23 files changed

+443
-236
lines changed

23 files changed

+443
-236
lines changed

.htaccess

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
2121
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
2222
RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]
2323

24+
RewriteRule ^discord$ /auth/join-discord.php [L]
2425
RewriteRule ^join/discord$ /auth/join-discord.php [L]
2526
RewriteRule ^join/w/discord$ /auth/join-with-authorization-discord.php [L]
2627
RewriteRule ^join/campuslabs$ /auth/join-campuslabs.php [L]
@@ -36,5 +37,8 @@ RewriteRule ^merch/product/([0-9a-f]+)/?(.*) /merch/product.php?id=$1&desc=$2 [L
3637
RewriteRule ^join$ /auth/join.php [L]
3738
RewriteRule ^aero/sponsor$ /downloads/nasa-sli-sponsorship-2022.pdf [R=301,L]
3839

39-
RewriteRule ^b3$ /botathon [R=301,L]
40-
RewriteRule ^b3r$ /botathon/register [R=301,L]
40+
RewriteRule ^b4$ /botathon [R=301,L]
41+
RewriteRule ^b4r$ /botathon/register [R=301,L]
42+
43+
RewriteRule ^b$ /botathon [R=301,L]
44+
RewriteRule ^br$ /botathon/register [R=301,L]

about/index.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require('../template/top.php');
33
require(BASE . '/api/discord/bots/admin.php');
4-
require(BASE . '/api/google/count_majors.php');
4+
//require(BASE . '/api/google/count_majors.php');
55

66
head('About Us', true);
77
?>
@@ -28,7 +28,8 @@
2828
<div class="cell-md-8 cell-lg-7 cell-xl-6">
2929
<div class="inset-md-right-30 inset-lg-right-0">
3030
<h1>What We Do</h1>
31-
<h3>Overview</h3>
31+
<small><em>Last updated: <?php echo date ("F d Y", filemtime(__FILE__)); ?></em></small>
32+
<h3>Overview</h3>
3233
<p>UNT Robotics is a broad engineering student organisation at the <a href="https://www.unt.edu/">University of North Texas</a>.</p>
3334
<p>We focus on developing student's skills in engineering &amp; robotics, which involves a range of beginner workshops, industry talks, robotics-based hackathons, recreational projects and competitions.</p>
3435
<div class="well-custom">

about/our-team.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<div class="range">
3131
<div class="cell-lg-6">
3232
<h1>Our Team</h1>
33+
<small><em>Last updated: <?php echo date ("F d Y", filemtime(__FILE__)); ?></em></small>
3334
<h6>These people are the reason for our success and expertise.</h6>
3435
</div>
3536
</div>

about/our-web-team.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class="icon icon-sm text-primary fa-github"></a>
121121
<div class="cell-md-6">
122122
<div class="inset-xl-right-70 inset-xl-left-70 inset-left-15 inset-right-15">
123123
<h6 id="henry-legay" class="h6-with-small"><a href="#henry-legay">Henry Legay</a>
124-
class="small text-silver-chalice">Team Member</span></h6>
124+
<span class="small text-silver-chalice">Team Member</span></h6>
125125
<p> Henry Legay is a Computer Science Student at UNT focused on web development. He is a
126126
web developer in Robotics with ready applicable experience and a willingness to
127127
learn.</p>

admin/users.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?php
22
require("../template/top.php");
33

4-
$term = $untrobotics->get_current_term();
5-
$year = $untrobotics->get_current_year();
4+
$term = @$_GET['term'];
5+
$year = @$_GET['year'];
6+
if (strlen($term) == 0) {
7+
$term = $untrobotics->get_current_term();
8+
} else {
9+
$term = intval($term);
10+
}
11+
if (empty($year)) {
12+
$year = $untrobotics->get_current_year();
13+
} else {
14+
$year = intval($year);
15+
}
616

717
$q = $db->query("SELECT * FROM dues_payments WHERE dues_term = '$term' AND dues_year = '$year' ORDER BY payment_timestamp DESC");
818

@@ -71,7 +81,10 @@ function getUserInfo($uid) {
7181
</span>
7282
</div>
7383

74-
<strong>Total: <?php echo $q->num_rows; ?></strong>
84+
<strong style="font-size: 18px;">Viewing Term: <?php echo Semester::get_name_from_value($term); ?> - <?php echo $year; ?></strong> --
85+
<a href="?term=<?php echo $untrobotics->get_prev_term($term); ?>&year=<?php echo $year-1; ?>">view previous</a>, <a href="?term=<?php echo $untrobotics->get_next_term($term); ?>&year=<?php echo $year+1; ?>">view next</a>
86+
<br />
87+
Total: <?php echo $q->num_rows; ?>
7588

7689
<table>
7790
<tr>

ajax/botathon-registration.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,52 @@ classification,
7979
if ($q) {
8080
echo 'SUCCESS';
8181
AdminBot::send_message($name . ' has signed up for bothaton. There are ' . botathon_spots_remaining() . ' spots remaining.');
82+
83+
$email_send_status = email(
84+
$email,
85+
"UNT Robotics Botathon Registration",
86+
87+
"<div style=\"position: relative;max-width: 100vw;text-align:center;\">" .
88+
'<img src="cid:untrobotics-email-header">' .
89+
90+
' <div></div>' .
91+
92+
'<div style="text-align: left; width: 500px; display: inline-block;">' .
93+
" <p>Dear " . $name . ",</p>" .
94+
" <p>Thank you for registering for Botathon Season " . BOTATHON_SEASON . "!</p>" .
95+
" <p>If you haven't already, please make sure to join our" .
96+
" <a href=\"https://www.untrobotics.com/discord\"><b>Discord server</b></a> as this is where we will post all of our event-day communications and announcements.</p>" .
97+
"</div>" .
98+
99+
' <div></div>' .
100+
101+
" <p></p>" .
102+
103+
'<div style="text-align: left; width: 500px; display: inline-block;">' .
104+
" <p>If you need any assistance or have any questions, please reach out in our Discord server or email us at <a href=\"mailto:hello@untrobotics.com\">hello@untrobotics.com</a>.</p>" .
105+
'</div>' .
106+
107+
' <div></div>' .
108+
109+
'<div style="text-align: left; width: 500px; display: inline-block;">' .
110+
" <p>All the best,</p>" .
111+
" <p><em>UNT Robotics Leadership</em></p>" .
112+
'</div>' .
113+
114+
"</div>",
115+
116+
"hello@untrobotics.com",
117+
null,
118+
[
119+
[
120+
'content' => base64_encode(file_get_contents(BASE . '/images/unt-robotics-email-header.jpg')),
121+
'type' => 'image/jpeg',
122+
'filename' => 'unt-robotics-email-header.jpg',
123+
'disposition' => 'inline',
124+
'content_id' => 'untrobotics-email-header'
125+
]
126+
]
127+
);
82128
} else {
83129
error_log("Failed to add botathon registration: " . $db->error);
84130
echo 'ERROR';

api/printful/printful.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function get_products($search_string = "") {
9898
if (!empty($search_string)) {
9999
$search_string = "&search=" . $search_string;
100100
}
101-
$products_results = $this->send_request("store/products?limit=5" . $search_string);
101+
$products_results = $this->send_request("store/products?limit=10" . $search_string);
102102
$parsed_products_results = $this->parse_results($products_results);
103103

104104
foreach ($parsed_products_results->get_results() as $product) {

api/sendgrid-inbound/parse.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
require('../../template/top.php');
3+
require(BASE . '/api/discord/bots/admin.php');
4+
5+
AdminBot::send_message('Inbound parse....');
6+
$html = $_POST['html'];
7+
8+
// find mailto
9+
error_log(print_r($html, true));
10+
if (preg_match('@"mailto:(.+?)"@', $html, $email_matches)) {
11+
$email = $email_matches[1];
12+
13+
// retrieve name
14+
preg_match('@<a href="mailto:.+?">(.+?)</a>@', $html, $name_matches);
15+
$name = $name_matches[1];
16+
17+
AdminBot::send_message("{$name} ({$email}) has requested to join UNT Robotics on OrgSync :)");
18+
19+
$token = random_int(100000, 999999);
20+
21+
$q = $db->query("INSERT INTO orgsync_members (`name`, `email`, `source`, `token`)
22+
VALUES
23+
(
24+
'" . $db->real_escape_string($name) . "',
25+
'" . $db->real_escape_string($email) . "',
26+
'" . $db->real_escape_string("orgsync/inbound-parse") . "',
27+
'" . $db->real_escape_string(bin2hex(random_bytes(16))) . "'
28+
)");
29+
30+
AdminBot::send_message("{$name} ({$email}) db write attempt (" . $token . "): " . $db->insert_id . "/" . $db->affected_rows);
31+
32+
$email_send_status = email(
33+
$email,
34+
"UNT Robotics Membership & Welcome!",
35+
36+
"<div style=\"position: relative;max-width: 100vw;text-align:center;\">" .
37+
'<img src="cid:untrobotics-email-header">' .
38+
39+
' <div></div>' .
40+
41+
'<div style="text-align: left; max-width: 500px; display: inline-block;">' .
42+
" <p>Dear " . $name . ",</p>" .
43+
" <p>Welcome to the team!!</p>" .
44+
" <p>Thank you for joining UNT Robotics on orgsync/campuslabs! If you haven't already, please make sure to join our" .
45+
" <a href=\"https://www.untrobotics.com/discord\"><b>Discord server</b></a> as this is where we all chat and conduct most of our projects and teams.</p>" .
46+
" <p>Once you have joined the Discord server, you may be asked for a verification token, your verification token is:</p>" .
47+
"</div>" .
48+
"<div>" .
49+
" <p style='font-size: 20pt; font-weight: 900; margin-top: 10px;'>{$token}</p>" .
50+
'</div>' .
51+
52+
' <div></div>' .
53+
54+
" <p></p>" .
55+
56+
" <p>If you need any assistance, please reach out to <a href=\"mailto:hello@untrobotics.com\">hello@untrobotics.com</a>.</p>" .
57+
58+
' <div></div>' .
59+
60+
'<div style="text-align: left; width: 500px; display: inline-block;">' .
61+
" <p>All the best,</p>" .
62+
" <p><em>UNT Robotics Leadership</em></p>" .
63+
'</div>' .
64+
65+
"</div>",
66+
67+
"hello@untrobotics.com",
68+
null,
69+
[
70+
[
71+
'content' => base64_encode(file_get_contents(BASE . '/images/unt-robotics-email-header.jpg')),
72+
'type' => 'image/jpeg',
73+
'filename' => 'unt-robotics-email-header.jpg',
74+
'disposition' => 'inline',
75+
'content_id' => 'untrobotics-email-header'
76+
]
77+
]
78+
);
79+
80+
if ($email_send_status) {
81+
AdminBot::send_message("Successfully sent e-mail with welcome message (" . var_export($email_send_status, true) . ")");
82+
} else {
83+
AdminBot::send_message("Failed to send e-mail with welcome message...");
84+
}
85+
} else {
86+
AdminBot::send_message('Inbound parse received a suspicious email: ' . file_get_contents("php://input"));
87+
}

auth/join-discord.php

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
11
<?php
2-
header("Location: https://discord.gg/YjcqbYYaPU");
2+
require('../template/top.php');
3+
head('Join us on Discord', true);
4+
5+
$log = var_export($_REQUEST, true);
6+
error_log($log, 3, BASE . '/paypal/logs/pdt-dues.log');
7+
?>
8+
<style>
9+
.alert {
10+
background-color: #4695d9;
11+
color: white;
12+
}
13+
.alert-inline > * {
14+
vertical-align: middle;
15+
}
16+
</style>
17+
18+
<main class="page-content">
19+
<section class="section-50 section-md-75 section-lg-100">
20+
<div class="shell">
21+
<div class="range range-md-justify">
22+
<div class="cell-md-12">
23+
<div class="inset-md-right-30 inset-lg-right-0 text-center">
24+
<h1>Join us on Discord</h1>
25+
26+
<div class="alert alert-info alert-inline">
27+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
28+
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
29+
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
30+
</svg> Note: If the following link says you are 'banned from this guild', please disconnect from campus wifi and try again.
31+
</div>
32+
33+
<div><a class="btn btn-default" href="<?php echo DISCORD_INVITE_URL; ?>">Click here to join our discord server.</a></div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
</section>
39+
</main>
40+
41+
<?php
42+
footer();
43+
?>

auth/reset-password.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
} else if ($password1 !== $password2) {
3535
$error = "The passwords you entered do not match";
3636
break;
37-
} else if ($email != $r['email']) {
37+
} else if (strcasecmp($email, $r['email']) != 0) {
3838
$error = "The e-mail address you entered is not valid for this reset link";
3939
break;
4040
} else {

0 commit comments

Comments
 (0)