/** * Get a login URL for the user. * * @param string $backurl The URL to go to on failure. * @param string $fronturl The URL to go to on success. * @return string|bool The url, false on failure. */ public function get_login_url($backurl = false, $forwardurl = false) { $xml = xml_gen::get_user_login_url($this->webexid); $webex = new \mod_webexactivity\webex(); if (!($response = $webex->get_response($xml, $this))) { return false; } $returnurl = $response['use:userLoginURL']['0']['#']; $returnurl = str_replace('+', '%2B', $returnurl); if ($backurl) { $encoded = urlencode($backurl); $returnurl = str_replace('&BU=', '&BU=' . $encoded, $returnurl); } if ($forwardurl) { $encoded = urlencode($forwardurl); $returnurl = str_replace('&MU=GoBack', '&MU=' . $encoded, $returnurl); } return $returnurl; }