Skip to content

Commit

Permalink
hotfix for lowercasing only protocols,refs #17
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Oct 21, 2021
1 parent 3a12b77 commit 61e3399
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions controllers/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public function admin_change_playerdata_action()
if (!$error) {
$livestream_config['loginname'] = $loginname;
$livestream_config['password'] = $password;
$livestream_config['sender_url'] = trim(strtolower($sender_url));
$livestream_config['player_url'] = trim(strtolower($player_url));
$livestream_config['sender_url'] = $sender_url;
$livestream_config['player_url'] = $player_url;
if ($use_opencast && $this->plugin->checkOpenCast()) {
$livestream_config['oc_player_url'] = trim(strtolower($oc_player_url));
$livestream_config['oc_player_url'] = $oc_player_url;
$livestream_config['use_opencast'] = true;
} else {
$livestream_config['use_opencast'] = false;
Expand Down
17 changes: 13 additions & 4 deletions controllers/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public function teacher_action()
if ($mode == MODE_DEFAULT) {
$this->player_username = $livestream_config['loginname'];
$this->player_password = $livestream_config['password'];
$this->sender_url = str_replace(URLPLACEHOLDER, Context::getId(), trim(strtolower($livestream_config['sender_url'])));
$this->player_url = str_replace(URLPLACEHOLDER, Context::getId(), trim(strtolower($livestream_config['player_url'])));
$this->sender_url = str_replace(URLPLACEHOLDER, Context::getId(), $this->lowercaseURLProtocol($livestream_config['sender_url']));
$this->player_url = str_replace(URLPLACEHOLDER, Context::getId(), $this->lowercaseURLProtocol($livestream_config['player_url']));

$this->countdown_activated = intval($livestream->countdown_activated);

Expand Down Expand Up @@ -168,7 +168,7 @@ public function student_action()

if ($mode == MODE_DEFAULT) {
$this->show_player = true;
$this->player_url = str_replace(URLPLACEHOLDER, Context::getId(), trim(strtolower($livestream_config['player_url'])));
$this->player_url = str_replace(URLPLACEHOLDER, Context::getId(), $this->lowercaseURLProtocol($livestream_config['player_url']));
$this->mode = $mode;

// countdown
Expand Down Expand Up @@ -208,7 +208,7 @@ public function student_action()
$this->show_player = true;
$refresh_in_seconds = $todays_session[LIVE]['refresh_seconds'];
$this->termin = $todays_session[LIVE]['termin'];
$this->player_url= str_replace(URLPLACEHOLDER, $todays_session[LIVE]['capture_agent'], trim(strtolower($livestream_config['oc_player_url'])));
$this->player_url = str_replace(URLPLACEHOLDER, $todays_session[LIVE]['capture_agent'], $this->lowercaseURLProtocol($livestream_config['oc_player_url']));
}

if (isset($todays_session[PENDING])) {
Expand Down Expand Up @@ -539,4 +539,13 @@ private function CheckSessionProgress($livestream)
}
return $session_info;
}

private function lowercaseURLProtocol($url) {
$url_explode = explode('://', $url);
if ($url_explode) {
$url = strtolower($url_explode[0]) . '://' . $url_explode[1];
}
return $url;
}
}

0 comments on commit 61e3399

Please sign in to comment.