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.= "
";
foreach($this->config['tree'] as $pos => $elem){
$result.="
".$elem."
";
}
$result.="
";
$query = "select id_notice_statut, gestion_libelle from notice_statut order by gestion_libelle";
$res = mysql_query($query);
if(mysql_num_rows($res)){
$result .="
";
}
$result.="
";
//Intégration de la gestion de l'interface de l'upload
global $pmb_docnum_in_directory_allow,$pmb_docnum_in_database_allow;
if ($pmb_docnum_in_directory_allow){
$result.= "
";
if ($pmb_docnum_in_database_allow) $result .= " ";
$result .= "
";
$req="select repertoire_id, repertoire_nom from upload_repertoire order by repertoire_nom";
$res = mysql_query($req);
if(mysql_num_rows($res)){
$result.="
";
}
$result .= "
";
$up = new upload_folder($this->config['upload_rep']);
//$nom_chemin = ($up->isHashing() ? $this->explnum_rep_nom : $this->explnum_rep_nom.$this->explnum_path);
if($this->explnum_rep_nom){
$result = str_replace('!!check_base!!','', $result);
$result = str_replace('!!check_up!!','checked', $result);
} else {
$result = str_replace('!!check_base!!','', $result);
$result = str_replace('!!check_up!!','checked', $result);
}
}
return $result;
}
function update_config_from_form() {
global $dbh;
global $included_sets;
global $used_thesaurus;
global $only_with_notices;
global $tree;
global $authentication;
global $write_permission;
global $restricted_empr_write_permission,$restricted_user_write_permission;
global $default_statut;
global $base_uri;
global $id_rep;
global $up_place;
global $allow_web;
parent::update_config_from_form();
$this->config['included_sets'] = $included_sets;
$this->config['used_thesaurus'] = $used_thesaurus;
$this->config['only_with_notices'] = $only_with_notices;
$this->config['tree'] = $tree;
$this->config['authentication']= $authentication;
$this->config['write_permission']= $write_permission;
$this->config['restricted_empr_write_permission'] = $restricted_empr_write_permission;
$this->config['restricted_user_write_permission'] = $restricted_user_write_permission;
$this->config['default_statut'] = $default_statut;
$this->config['base_uri'] = $base_uri;
$this->config['upload_rep'] = $id_rep;
$this->config['up_place'] = $up_place;
$this->config['allow_web'] = $allow_web;
return;
}
}
?>