Пример #1
0
 private function _setUploadFolder () {
    $current_user_item = $this->_environment->getCurrentUserItem();
    $own_room = $this->_commsy_user_item->getOwnRoom();
    if ( isset($own_room) ) {
       $upload_folder_id = $own_room->getItemID();
       unset($own_room);
       if ( !empty($upload_folder_id) ) {
          $uploads_folder2 = 'var/mediabird/'.$upload_folder_id.'/';
          if ( !file_exists($uploads_folder2) ) {
             mkdir($uploads_folder2);
             if ( !file_exists($uploads_folder2) ) {
                include_once('functions/error_functions.php');
                trigger_error('can not make uploads directory for mediabird plugin',E_USER_WARNING);
             }
          }
       }
    }
    MediabirdConfig::$uploads_folder = 'var/mediabird/';
    $this->userSubfolder = $upload_folder_id;
 }
        $account_link->system = "moodle";
        insert_record("studynotes_account_links", $account_link, false);
    } else {
        error(get_string('error_linking', 'studynotes'));
    }
}
$auth = new MediabirdMoodleAuth($mbuser);
//set up config
MediabirdConfig::$latex_path = $CFG->studynotes_latex_path;
MediabirdConfig::$convert_path = $CFG->studynotes_dvipng_path;
//set up proxy
if (isset($CFG->proxyhost) && strlen($CFG->proxyhost) > 0 && (!isset($CFG->proxytype) || $CFG->proxytype == 'HTTP')) {
    MediabirdConfig::$proxy_address = $CFG->proxyhost;
    MediabirdConfig::$proxy_port = $CFG->proxyport;
}
MediabirdConfig::$uploads_folder = $CFG->dataroot . DIRECTORY_SEPARATOR . "1" . DIRECTORY_SEPARATOR . "moddata" . DIRECTORY_SEPARATOR . "studynotes" . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR;
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']);