if (!file_exists(MediabirdConfig::$uploads_folder . $auth->userId)) {
    make_mod_upload_directory(1);
    make_upload_directory("1/moddata/studynotes/uploads/" . $auth->userId);
    // we store our images in a subfolder in here
}
MediabirdConfig::$cache_folder = $CFG->dataroot . DIRECTORY_SEPARATOR . "temp" . DIRECTORY_SEPARATOR . "studynotes" . DIRECTORY_SEPARATOR;
if (!file_exists(MediabirdConfig::$cache_folder)) {
    make_upload_directory("temp/studynotes");
}
if (isset($action)) {
    if ($action == "changePass" || $action == "deleteAccount") {
        exit;
    }
    if ($action == "load") {
        $urlToLoad = MediabirdUtility::getArgNoSlashes($_GET['url']);
        $html = MediabirdUtility::loadUrl($urlToLoad);
        if ($html == null) {
            echo $COULD_NOT_RETRIEVE_LABEL . $urlToLoad;
        } else {
            echo $html;
        }
    } else {
        echo studynotes_handle_session($action, $auth);
    }
    exit;
}
add_to_log($course->id, "studynotes", "view", "view.php?id={$cm->id}", "{$studynotes->id}");
//set up plugins and markers from settings
if (isset($CFG->studynotes_markers_available) && strlen($CFG->studynotes_markers_available) > 0) {
    $markersRaw = explode(",", $CFG->studynotes_markers_available);
    $markers = array();