Пример #1
0
function lti_parse_request($wp)
{
    if (is_basic_lti_request()) {
        global $wpdb;
        /*$secret = lti_get_secret_from_consumer_key();
        		$consumer_key = $_POST[ 'oauth_consumer_key' ] ;*/
        //$db_connector = LTI_Data_Connector::getDataConnector('', 'none');
        get_lti_hash();
        // initialise the remote login hash
        // oritgigo: These two lines made it possible to connect to the database
        mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
        mysql_select_db(DB_NAME);
        $db_connector = LTI_Data_Connector::getDataConnector($wpdb->base_prefix);
        $consumer = new LTI_Tool_Consumer($consumer_key, $db_connector);
        $tool = new LTI_Tool_Provider('lti_do_actions', $db_connector);
        $tool->execute();
    }
}
Пример #2
0
function lti_parse_request($wp)
{
    // Note: we should use the base_prefix always as when in site
    // blogs the prefix changes to prefixblog_id_, i.e. wp_60_
    global $wpdb;
    if (empty($_POST['lti_message_type'])) {
        return FALSE;
    }
    // Clear any existing session variables for this plugin
    lti_reset_session();
    // Deal with magic quotes before they cause OAuth to fail
    lti_strip_magic_quotes();
    // Do the necessary
    $tool = new LTI_Tool_Provider('lti_do_connect', array($wpdb->base_prefix));
    $tool->setParameterConstraint('resource_link_id', TRUE, 40);
    $tool->setParameterConstraint('user_id', TRUE);
    // Get settings and check whether sharing is enabled.
    $tool->allowSharing = TRUE;
    $tool->execute();
    exit;
}