getName(), $b->getName());
}
class webdav extends connecteur_out {
function get_config_form() {
//Rien
return '';
}
function update_config_from_form() {
return;
}
function instantiate_source_class($source_id) {
return new webdav_source($this, $source_id, $this->msg);
}
function process($source_id, $pmb_user_id) {
global $class_path;
global $webdav_current_user_id,$webdav_current_user_name;
global $pmb_url_base;
$source_object = $this->instantiate_source_class($source_id);
$webdav_current_user_id=0;
$webdav_current_user_name = "Anonymous";
$rootDir = new Sabre\PMB\Tree($source_object->config);
$server = new Sabre\DAV\Server($rootDir);
if($source_object->config['allow_web']){
$web = new Sabre\PMB\BrowserPlugin();
$server->addPlugin($web);
}
if($source_object->config['authentication'] != "anonymous"){
$auth = new Sabre\PMB\Auth($source_object->config['authentication']);
$authPlugin = new Sabre\DAV\Auth\Plugin($auth,md5($pmb_url_base));
// Adding the plugin to the server
$server->addPlugin($authPlugin);
}
// We're required to set the base uri, it is recommended to put your webdav server on a root of a domain
$server->setBaseUri($source_object->config['base_uri']);
// And off we go!
$server->exec();
}
}
class webdav_source extends connecteur_out_source {
var $onglets = array();
function webdav_source($connector, $id, $msg) {
parent::connecteur_out_source($connector, $id, $msg);
$this->included_sets = isset($this->config["included_sets"]) ? $this->config["included_sets"] : array();
}
function get_config_form() {
global $charset, $msg, $dbh;
global $thesaurus_default;
global $base_path;
if(!$this->config['used_thesaurus']){
$this->config['used_thesaurus'] = $thesaurus_default;
}
if(!$this->config['base_uri']){
$this->config['base_uri'] = "/";
}
if(!$this->config['tree']){
$this->config['tree'] = array();
}
if(!$this->config['restricted_empr_write_permission']){
$this->config['restricted_empr_write_permission'] = array();
}
if(!$this->config['restricted_user_write_permission']){
$this->config['restricted_user_write_permission'] = array();
}
if(!$this->config['upload_rep']){
global $PMBuserid;
$query = "select deflt_upload_repertoire from users where userid = ".$PMBuserid;
$result = mysql_query($query);
if(mysql_num_rows($result)){
$this->config['upload_rep'] = mysql_result($result,0,0);
}else{
$this->config['upload_rep'] = 0;
}
}
$result = parent::get_config_form();
//Included sets
$result.= "