Skip to content

Commit

Permalink
all the stuff living on prod
Browse files Browse the repository at this point in the history
all the stuff living on prod
  • Loading branch information
michael-grace authored Jul 18, 2023
2 parents 7cbb233 + 039f576 commit e5931d9
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion schema/api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ type Track implements Node & MyRadioObject {
outro: Int
clean: Boolean
digitised: Boolean!
length: Duration
length: String #Duration
genre: String # TODO enum
digitisedBy: User
lastEditedTime: DateTime
Expand Down
3 changes: 2 additions & 1 deletion schema/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"\\MyRadio\\NIPSWeb\\NIPSWeb_ManagedPlaylist": "nipswebPlaylist",
"\\MyRadio\\NIPSWeb\\NIPSWeb_TimeslotItem": "timeslotItem",
"\\MyRadio\\NIPSWeb\\NIPSWeb_ManagedItem": "nipswebItem",
"\\MyRadio\\Config": "config"
"\\MyRadio\\Config": "config",
"\\MyRadio\\ServiceAPI\\Profile": "profile"
},
"specs": {
"quote": {
Expand Down
2 changes: 0 additions & 2 deletions src/Classes/Daemons/MyRadio_PlaylistsDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public static function run($force = false)
if (!$force && self::getVal($hourkey) > time() - 3500) {
return;
}

self::updateMostPlayedPlaylist();
self::updateNewestUploadsPlaylist();
self::updateRandomTracksPlaylist();
Expand Down Expand Up @@ -242,7 +241,6 @@ private static function updateNewestUploadsPlaylist()
if (!self::playlistGenPrepare('newest-auto')) {
return;
}

self::playlistGenCommit(
'newest-auto',
NIPSWeb_AutoPlaylist::findByName('Newest Tracks')->getTracks()
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/Daemons/MyRadio_PodcastDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function run()

if (!empty($podcasts)) {
//Encode the first podcast.
dlog('Converting Podcast '.$podcasts[0]->getID().'...', 3);
dlog('Converting Podcast '.$podcasts[0]->getMeta('title').'...', 3);
$podcasts[0]->convert();
dlog('Conversion complete.', 3);
}
Expand Down
9 changes: 7 additions & 2 deletions src/Classes/MyRadio/MyRadioLDAPAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ public function __destruct()
*/
public function validateCredentials($user, $password)
{
$myruser = MyRadio_User::findByEmail($user);
if ($myruser == null) {
return false;
}
$eduroam = $myruser->getEduroam();
# Check that it looks like a legit user first.
if (!empty(Config::$auth_ldap_regex) && !preg_match(Config::$auth_ldap_regex, $user)) {
if (!empty(Config::$auth_ldap_regex) && !preg_match(Config::$auth_ldap_regex, $eduroam)) {
return false;
}
if (@ldap_bind($this->ldap_handle, 'uid='.$user.','.Config::$auth_ldap_root, $password)) {
if (@ldap_bind($this->ldap_handle, 'uid='.$eduroam.','.Config::$auth_ldap_root, $password)) {
return MyRadio_User::findByEmail($user);
} else {
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/MyRadioEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private static function create($to, $subject, $body, $from = null, $timestamp =

private function getHeader()
{
$headers = ['MIME-Version: 1.0'];
$headers = ['MIME-Version: 1.0', 'Content-Transfer-Encoding: quoted-printable'];

if ($this->from !== null) {
$headers[] = 'From: '.$this->from->getName().' <'.$this->from->getPublicEmail().'>';
Expand Down Expand Up @@ -222,7 +222,7 @@ public function send()
if (!mail(
$user->getName() . ' <' . $user->getEmail() . '>',
$u_subject,
$u_message,
quoted_printable_encode($u_message),
$this->getHeader()
)) {
continue;
Expand Down
1 change: 0 additions & 1 deletion src/Classes/NIPSWeb/NIPSWeb_ManagedItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public static function cacheItem($tmp_path)

$getID3 = new \getID3();
$fileInfo = $getID3->analyze(Config::$audio_upload_tmp_dir.'/'.$filename);

//The entire $fileInfo array will break Session.
$_SESSION['uploadInfo'][$filename] = [
'fileformat' => $fileInfo['fileformat'],
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/ServiceAPI/MyRadio_Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ public static function getTerm($termid)
*/
public static function isTerm()
{
//$timeslot = self::getCurrentTimeslot($time, $filter);
return true;
return (!empty(self::getTerms(true)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Classes/ServiceAPI/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function getMembersForYear($year)
self::wakeup();

return self::$db->fetchAll(
'SELECT member.memberid, sname || \', \' || fname AS name, l_college.descr AS college, paid
'SELECT member.memberid, sname || \', \' || fname AS name, l_college.descr AS college, paid, email, eduroam
FROM member INNER JOIN (SELECT * FROM member_year WHERE year = $1) AS member_year
ON ( member.memberid = member_year.memberid ), l_college
WHERE member.college = l_college.collegeid
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/MyRadio/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
)->setTemplate('MyRadio/login.twig');

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['myradio_login-user'])) {
//Submitted
//Submitted
$status = null;
$data = $form->readValues();

Expand Down
6 changes: 4 additions & 2 deletions src/Controllers/MyRadio/pwChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@
throw new MyRadioException('Password reset token required.', 400);
} else {
$db = Database::getInstance();
$tokenStr = $_REQUEST[$var];
$tokenStr = str_replace(["\r", "\n"], ['',''], $tokenStr);
$token = $db->fetchOne(
'SELECT * FROM myury.password_reset_token
WHERE token=$1 AND expires > NOW() AND used IS NULL',
[$_REQUEST[$var]]
[$tokenStr]
);

if (empty($token)) {
throw new MyRadioException('Password reset token invalid. It may have expired or already been used.', 400);
throw new MyRadioException('Password reset token invalid. It may have expired or already been used. Alternatively, try removing the %0D%0A from the URL. If you\'re joining computing team, maybe you could help us solve that bug', 400);
} else {
$form->addField(
new MyRadioFormField(
Expand Down
2 changes: 2 additions & 0 deletions src/Controllers/Profile/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
'url' => URLUtils::makeURL('Profile', 'view', ['memberid' => $v['memberid']]),
'value' => $v['name'],
];
unset($members[$k]['email']);
unset($members[$k]['eduroam']);
}

CoreUtils::getTemplateObject()->setTemplate('table.twig')
Expand Down
2 changes: 2 additions & 0 deletions src/Controllers/Profile/listPrevious.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
'url' => URLUtils::makeURL('Profile', 'view', ['memberid' => $v['memberid']]),
'value' => $v['name'],
];
unset($members[$k]['email']);
unset($members[$k]['eduroam']);
}

CoreUtils::getTemplateObject()->setTemplate('table.twig')
Expand Down
3 changes: 3 additions & 0 deletions src/Public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ body:not(.nonav) {
border-color: #2D425F;
border: none;
}
.navbar-ury-pink {
background-color: #fc03df;
}
.navbar-ury .navbar-brand {
color: #ffffff;
padding: 10px 15px; /** added to center the logo **/
Expand Down
1 change: 1 addition & 0 deletions src/Templates/MyRadio/getOnAir.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</li>

<!--Apply for a Show-->
<!-- debug: {{studio_demoed}}, {{paid}}, {{contract_signed}} -->
<li {% if not (studio_demoed and paid and contract_signed) %} class="menu-checklist-disabled"{% endif %}>
<a href="{% if not (studio_demoed and paid) %}javascript:{% else %}{{MyRadio.makeURL(config, 'Scheduler', 'myShows')}}{% endif %}"
title="{% if not has_show %}You've passed all the stages of training. Now it's time to apply for your very first show! {%
Expand Down
5 changes: 4 additions & 1 deletion src/Templates/NIPSWeb/playout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
</span>

<br>
<input type="checkbox" id="playout-check">
<input type="checkbox" disabled id="playout-check">
<label for="playout-check">Automatically Play My Show</label>

<br>
<div class="alert alert-warning"><b>Sorry, we deprecated this. RIP AutoPlayout 2020-2023</div>

<script type="text/javascript" src="{{baseurl}}js/nipsweb.playout.js"></script>
{% include 'parts/base_foot.twig' %}
</body>
Expand Down
6 changes: 5 additions & 1 deletion src/Templates/parts/nav.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% import 'macros.twig' as MyRadio %}
{% if nonav == false %}
{% if name == 'Alex Towells' %}
<nav class="navbar navbar-ury navbar-ury-pink navbar-fixed-top" role="navigation">
{% else %}
<nav class="navbar navbar-ury navbar-fixed-top" role="navigation">
{% endif %}
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
Expand Down Expand Up @@ -49,4 +53,4 @@
</div>
</div>
</nav>
{% endif %}
{% endif %}

0 comments on commit e5931d9

Please sign in to comment.