/** * Get the database ID of this model instance. * * @return integer */ public function id() { return $this->orm->id(); }
if (!$launch) { return false; } $launchkeys = array("course_id" => $crs->id(), "user_id" => $usr->id()); if ($org && $org->id()) { $launchkeys[org_id] = $org->id(); } else { // Make sure to never get a org with a primary key of -1 $launchkeys[org_id] = -1; } $launch->read($launchkeys); $launch->setall($launchkeys); // Set the foreign keys $launch->setall($_REQUEST, '/^launch_/'); $launchpassword = md5(uniqid(rand(), true)); if ($launch->id()) { $launch->update(); DPRT("Updated launch={$launch->id}()"); } else { $launch->insert(); DPRT("Added launch={$launch->id}()"); } // Log this digest $reqstr = mysql_real_escape_string(print_r($_REQUEST, TRUE)); $quer = "insert into lti_digest (created_at, digest, request) values (NOW(), '{$digest}', '{$reqstr}');"; mysql_query($quer); // Time to return a response, we either return a web service // response, debug outtput, or redirect back to ourselves $theurl = $_SERVER[SCRIPT_URI]; $theuri = $_SERVER[REQUEST_URI]; $i = strpos($theuri, '?');
if ($_REQUEST[lti_launch_id]) { $launchid = $_REQUEST[lti_launch_id]; } else { if (!empty($_SESSION['lti_launch_id'])) { $launchid = $_SESSION[lti_launch_id]; } else { unset($_SESSION['lti_launch_id']); redirect_login(); $launchid = false; } } if ($launchid) { $launch = new ORM("launch", false, "lti_launch"); if (!$launch) { throw new Exception("LTI Runtime - Datebase unable to instance user"); } $launch->get($launchid); if (!$launch->id()) { throw new Exception("LTI Runtime - Launch session not found"); } $launchdata = $launch->data(); $_SESSION['lti_launch_id'] = $launch->id(); if ($launch && $launch->data()) { $LTI = new LTIObject($launch->data()); } } } catch (Exception $e) { DPRT($e->getMessage()); redirect_login(); $LTI = false; }