public function executeRegistration(sfWebRequest $request) { global $CFG; $CFG->current_app->requireMahara(); $wants_url_id = $request->getParameter('url'); if ($wants_url_id) { $wants_url = GcrWantsUrlTable::getInstance()->find($wants_url_id); if ($wants_url) { $url = substr($wants_url->getWantsUrl(), strlen($CFG->current_app->getUrl())); // We need this action primarily so that we can call GcrWantsUrlTable::createWantsUrl // from the institution's domain because it sets a cookie as its means of saving a wantsurl GcrWantsUrlTable::createWantsUrl('registration', $CFG->current_app, $url); $wants_url->delete(); } } $this->redirect($CFG->current_app->getAppUrl() . 'register.php'); }
public function executeClassroom(sfWebRequest $request) { global $CFG; $CFG->current_app->requireMahara(); if (!$CFG->current_app->isLoggedIn()) { GcrWantsUrlTable::createWantsUrl('registration', $CFG->current_app, $CFG->current_app->getRequestUri()); $this->redirect($CFG->current_app->getAppUrl() . 'register.php'); } $this->eschool = false; $short_name = $request->getParameter('eschool'); if ($short_name) { $eschool = Doctrine::getTable('GcrEschool')->findOneByShortName($short_name); if ($eschool->getOrganizationId() == $CFG->current_app->getId()) { $this->eschool = $eschool; } } if (!$this->eschool) { $this->eschool = $CFG->current_app->getDefaultEschool(); } $this->monthly_cost = $this->eschool->getConfigVar('gc_classroom_cost_month'); $this->yearly_cost = $this->eschool->getConfigVar('gc_classroom_cost_year'); if (!$this->monthly_cost || $this->monthly_cost == 0) { if (!$this->yearly_cost || $this->yearly_cost == 0) { $this->redirect($CFG->current_app->getUrl()); } } $this->getResponse()->setTitle('Purchase an eClassroom'); }
public function getInstitutionJumpUrl($wantsurl = false, $institution = false) { if (!$institution) { $institution = $this->getInstitution(); } if ($mhr_auth_instance = $institution->getAuthInstance($this)) { $url = $institution->getAppUrl() . 'auth/xmlrpc/jump.php?wr=' . $this->getAppUrl() . '&ins=' . $mhr_auth_instance->id; if ($wantsurl && strlen($wantsurl) > 1) { $wantsurl = str_replace($this->getUrl(), '', $wantsurl); $gcr_wants_url = GcrWantsUrlTable::createWantsUrl('simple', $this, $wantsurl); $url .= '&wantsurl=/custom/frontend.php%3Furl=' . $gcr_wants_url->getId(); } return $url; } return false; }
<?php require_once '../config.php'; global $CFG; $CFG->current_app->requireLogin(); if (isset($_GET['url'])) { redirect(GcrWantsUrlTable::getRedirectUrl($_GET['url'], true)); } else { redirect($CFG->current_app->getUrl()); }
public function requireLogin() { if (!$this->isLoggedIn()) { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $param_string = ''; } else { $wants_url = GcrWantsUrlTable::createWantsUrl('maharalogin', $this); $param_string = '?' . $wants_url->toGetParam(); } redirect($this->getAppUrl() . $param_string); } }
public function createWantsUrl($redirect_type, $url = false) { return GcrWantsUrlTable::createWantsUrl($redirect_type, $this, $url); }