Exemple #1
0
function checkNonce($nonce, $created, $digest, $secret, $seconds = -1)
{
    if (!($nonce && $created && $digest && $secret)) {
        DPRT("checkNonce() missing Required Parameter");
        DPRT("nonce={$nonce} created={$created} digest={$digest} secret=*****\n");
        // DPRT("nonce=$nonce created=$created digest=$digest secret=$secret\n");
        return false;
    }
    // Check to see if the timestamp is in range...
    if ($seconds > 0) {
        $d = gmdate("Y-m-d") . "T" . gmdate("H:i:s") . "Z";
        DPRT("Current Time:" . $d);
        DPRT("Created Time:" . $created);
        $dm = strtotime($d);
        $cm = strtotime($created);
        if (!($cm && $dm)) {
            DPRT("Bad Date format");
            return false;
        }
        $diff = abs($dm - $cm);
        DPRT("Time Difference in seconds actual:" . $diff . " acceptible:" . $seconds);
        if ($diff > $seconds) {
            DPRT("Expired");
            return false;
        }
    }
    // Check the nonce to match the secret
    $presha1 = $nonce . $created . $secret;
    // DPRT("Presha1 " . $presha1);
    $x = sha1($presha1, TRUE);
    $y = base64_encode($x);
    DPRT("postsha1 " . $y);
    DPRT("digest " . $digest);
    if ($digest != $y) {
        DPRT("No Match");
        return false;
    }
    DPRT("Match");
    return true;
}
Exemple #2
0
 }
 $theurl = $theurl . 'lti_launch_id=' . $launch->id();
 if ($launch && $launch->data()) {
     $LTI = new LTIObject($launch->data());
     DPRT("User Data");
     DPRTR($LTI->user());
     DPRT("Course Data");
     DPRTR($LTI->course());
     DPRT("Membership Data");
     DPRTR($LTI->memb());
     DPRT("Organization Data");
     DPRTR($LTI->org());
 }
 DPRT("Request Dump");
 DPRTR($_REQUEST);
 DPRT("Server Dump");
 DPRTR($_SERVER);
 dumpDebugLog();
 // The web service response
 if ($_REQUEST[action] == 'launchresolve') {
     print "<launchResponse>\n";
     print "   <status>success</status>\n";
     print "   <type>iframe</type>\n";
     print "   <launchUrl>" . htmlspecialchars($theurl) . "</launchUrl>\n";
     print "   <launchdebug>\n";
     print getDebugLogXML();
     print "   </launchdebug>\n";
     print "</launchResponse>\n";
 } else {
     if ($_REQUEST[action] == 'direct' && !$_REQUEST[ltidebugpause]) {
         if (!headers_sent()) {
Exemple #3
0
    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;
}
Exemple #4
0
 function read($keyvalue)
 {
     if (is_int($keyvalue)) {
         return $this->get($keyvalue);
     }
     $keyname = $this->keyname();
     if ($keyname && !is_string($keyvalue)) {
         DPRT("Model " . $this->modelname() . " requires a locical string key={$keyname} for read");
         return false;
     }
     if (!$keyname && !is_array($keyvalue)) {
         DPRT("Model " . $this->modelname() . " does not support locical key on insert value={$keyvalue}");
         return false;
     }
     if ($keyname && is_string($keyvalue)) {
         $where = "{$this->keyname} = '" . mysql_real_escape_string($keyvalue) . "';";
     } else {
         if (is_array($keyvalue)) {
             $where = $this->makewhere($keyvalue);
         }
     }
     return $this->load_one_object($where);
 }
Exemple #5
0
function DPRTR($obj)
{
    global $DEBUG_LOG_DATA;
    $message = print_r($obj, TRUE);
    DPRT($message);
}