$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']);
        $html = MediabirdUtility::loadUrl($urlToLoad);
        if ($html == null) {
            echo $COULD_NOT_RETRIEVE_LABEL . $urlToLoad;
        } else {
            echo $html;
        }
예제 #2
0
   mkdir($mediabird_folder);
   if (!file_exists($mediabird_folder)) {
      include_once ('functions/error_functions.php');
      trigger_error('can not make root directory for mediabird plugin in var', E_USER_WARNING);
   }
}

$cache_folder2 = 'var/mediabird/cache/';
if (!file_exists($cache_folder2)) {
   mkdir($cache_folder2);
   if (!file_exists($cache_folder2)) {
      include_once ('functions/error_functions.php');
      trigger_error('can not make cache directory for mediabird plugin', E_USER_WARNING);
   }
}
MediabirdConfig :: $cache_folder = $cache_folder2;

if (!isset ($environment) and isset ($this->_environment)) {
   $environment = $this->_environment;
}

// mail
if ( isset($environment) ) {
   $server_item = $environment->getServerItem();
   if ( isset($server_item) ) {
      $default_sender_address = $server_item->getDefaultSenderAddress();
      if ( !empty($default_sender_address) ) {
         MediabirdConfig :: $no_reply_address = $default_sender_address;
         MediabirdConfig :: $webmaster_address = $default_sender_address;
      }
   }