Exemple #1
0
 function update_config_from_form()
 {
     global $dbh;
     parent::update_config_from_form();
     global $repo_name, $admin_email, $included_sets, $repositoryIdentifier, $chunksize, $token_lifeduration, $cache_complete_records, $cache_complete_records_seconds, $link_status_to_deletion, $linked_status_to_deletion, $allow_gzip_compression, $baseURL, $include_items, $suppr_feuille_xslt;
     global $deletion_management, $deletion_management_transient_duration;
     //les trucs faciles
     $this->config["repo_name"] = stripslashes($repo_name);
     $this->config["admin_email"] = stripslashes($admin_email);
     $this->config["repositoryIdentifier"] = stripslashes($repositoryIdentifier);
     $this->config["chunksize"] = $chunksize + 0;
     $this->config["token_lifeduration"] = $token_lifeduration + 0;
     $this->config["cache_complete_records"] = isset($cache_complete_records);
     $this->config["cache_complete_records_seconds"] = $cache_complete_records_seconds + 0;
     $this->config["link_status_to_deletion"] = isset($link_status_to_deletion);
     $this->config["linked_status_to_deletion"] = $linked_status_to_deletion + 0;
     $this->config["allow_gzip_compression"] = isset($allow_gzip_compression);
     $this->config["baseURL"] = stripslashes($baseURL);
     $this->config["include_items"] = isset($include_items);
     $this->config["deletion_management"] = $deletion_management;
     $this->config["deletion_management_transient_duration"] = $deletion_management_transient_duration * 1;
     if (!$_FILES['feuille_xslt']['error']) {
         $this->config['feuille_xslt'] = file_get_contents($_FILES['feuille_xslt']['tmp_name']);
         $this->config['feuille_xslt_name'] = $_FILES['feuille_xslt']['name'];
     }
     if ($suppr_feuille_xslt) {
         $this->config['feuille_xslt'] = "";
         $this->config['feuille_xslt_name'] = "";
     }
     $this->config['include_links'] = array();
     $this->config['include_links']['genere_lien'] = 0;
     global $include_path, $class_path;
     require_once $class_path . '/export_param.class.php';
     $e_param = new export_param(EXP_GLOBAL_CONTEXT);
     $this->config['include_links'] = $e_param->get_parametres(EXP_OAI_CONTEXT);
     //Vérifions que le statut proposé existe bien
     $sql = "SELECT COUNT(1) > 0 FROM notice_statut WHERE id_notice_statut = " . ($linked_status_to_deletion + 0);
     $status_exists = pmb_mysql_result(pmb_mysql_query($sql, $dbh), 0, 0);
     if (!$status_exists) {
         $this->config["linked_status_to_deletion"] = 0;
     }
     if (!$this->config["cache_complete_records_seconds"]) {
         $this->config["cache_complete_records_seconds"] = 86400;
     }
     if ($this->config["deletion_management"] == 1 && !$this->config["deletion_management_transient_duration"]) {
         $this->config["deletion_management"] = 0;
     }
     //et maintenant les sets
     if (!is_array($included_sets)) {
         $included_sets = array($included_sets);
     }
     array_walk($included_sets, create_function('&$a', '$a+=0;'));
     //Virons ce qui n'est pas entier
     //Virons ce qui n'est pas un index de set de notice
     $sql = "SELECT connector_out_set_id FROM connectors_out_sets WHERE connector_out_set_type IN (" . implode(",", $this->allowed_set_types) . ") AND connector_out_set_id IN (" . implode(",", $included_sets) . ')';
     $res = pmb_mysql_query($sql, $dbh);
     $this->config["included_sets"] = array();
     while ($row = pmb_mysql_fetch_assoc($res)) {
         $this->config["included_sets"][] = $row["connector_out_set_id"];
     }
     //Vérifions que les formats autorisés proposés existent bien
     $allowed_paths = array();
     $admin_convert_catalog = external_services_converter_notices::get_export_possibilities();
     foreach ($admin_convert_catalog as $aconvert) {
         $allowed_paths[] = $aconvert["path"];
     }
     global $allowed_admin_convert_paths;
     if (!is_array($allowed_admin_convert_paths)) {
         $allowed_admin_convert_paths = array($allowed_admin_convert_paths);
     }
     $this->config["allowed_admin_convert_paths"] = array();
     foreach ($allowed_admin_convert_paths as $apath) {
         if (!in_array($apath, $allowed_paths)) {
             continue;
         }
         $this->config["allowed_admin_convert_paths"][] = $apath;
     }
     return;
 }