christophe le drean 1 year ago
parent 9b679f0d3d
commit 1219e647da

@ -1,25 +1,27 @@
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function action_zotspip_forcer_maj_dist(){
$securiser_action = charger_fonction('securiser_action', 'inc');
$arg = $securiser_action();
include_spip('inc/zotspip');
zotspip_nettoyer();
if (zotspip_maj_items(true)<0) {
$continuer = true;
while($continuer)
if (zotspip_maj_items()>=0)
$continuer = false;
}
// Redirection
if ($redirect = _request('redirect')) {
include_spip('inc/headers');
redirige_par_entete($redirect.'&maj=ok');
}
}
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function action_zotspip_forcer_maj_dist() {
$securiser_action = charger_fonction('securiser_action', 'inc');
$arg = $securiser_action();
include_spip('inc/zotspip');
zotspip_nettoyer();
if (zotspip_maj_items(true) < 0) {
$continuer = true;
while ($continuer) {
if (zotspip_maj_items() >= 0) {
$continuer = false;
}
}
}
// Redirection
if ($redirect = _request('redirect')) {
include_spip('inc/headers');
redirige_par_entete($redirect . '&maj=ok');
}
}

@ -4,139 +4,139 @@ if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function zotspip_declarer_tables_interfaces($interface){
function zotspip_declarer_tables_interfaces($interface) {
// 'spip_' dans l'index de $tables_principales
$interface['table_des_tables']['zitems']='zitems';
$interface['table_des_tables']['zcollections']='zcollections';
$interface['table_des_tables']['ztags']='ztags';
$interface['table_des_tables']['zcreators']='zcreators';
$interface['table_des_tables']['zitems'] = 'zitems';
$interface['table_des_tables']['zcollections'] = 'zcollections';
$interface['table_des_tables']['ztags'] = 'ztags';
$interface['table_des_tables']['zcreators'] = 'zcreators';
//-- Jointures ----------------------------------------------------
$interface['tables_jointures']['spip_zitems'][]= 'ztags';
$interface['tables_jointures']['spip_zitems'][]= 'zcreators';
$interface['tables_jointures']['spip_zitems'][]= 'zitems_zcollections';
$interface['tables_jointures']['spip_zcollections'][]= 'zitems_zcollections';
$interface['tables_jointures']['spip_ztags'][]= 'zitems';
$interface['tables_jointures']['spip_zcreators'][]= 'zitems';
$interface['tables_jointures']['spip_zitems'][] = 'ztags';
$interface['tables_jointures']['spip_zitems'][] = 'zcreators';
$interface['tables_jointures']['spip_zitems'][] = 'zitems_zcollections';
$interface['tables_jointures']['spip_zcollections'][] = 'zitems_zcollections';
$interface['tables_jointures']['spip_ztags'][] = 'zitems';
$interface['tables_jointures']['spip_zcreators'][] = 'zitems';
return $interface;
}
function zotspip_declarer_tables_objets_sql($tables){
function zotspip_declarer_tables_objets_sql($tables) {
//-- Table zitems -----------------------------------------------------------
$tables['spip_zitems'] = array(
$tables['spip_zitems'] = [
'type' => 'zitem',
'principale' => 'oui',
'texte_objet' => 'zotero:zitem_singulier',
'texte_objets' => 'zotero:zitem_pluriel',
'icone_objet' => 'zotero',
'editable' => false,
'field' => array(
"id_zitem" => "varchar(16) DEFAULT '' NOT NULL",
"id_parent" => "varchar(16) DEFAULT '' NOT NULL",
"type_ref" => "varchar(255) DEFAULT '' NOT NULL",
"annee" => "smallint(6)",
"titre" => "text DEFAULT '' NOT NULL",
"auteurs" => "text DEFAULT '' NOT NULL",
"resume" => "mediumtext DEFAULT '' NOT NULL",
"date" => "varchar(255) DEFAULT '' NOT NULL",
"pages" => "varchar(255) DEFAULT '' NOT NULL",
"publication" => "text DEFAULT '' NOT NULL",
"editeur" => "text DEFAULT '' NOT NULL",
"collection" => "varchar(255) DEFAULT '' NOT NULL",
"conference" => "text DEFAULT '' NOT NULL",
"type_doc" => "text DEFAULT '' NOT NULL",
"volume" => "varchar(255) DEFAULT '' NOT NULL",
"numero" => "varchar(255) DEFAULT '' NOT NULL",
"doi" => "varchar(255) DEFAULT '' NOT NULL",
"isbn" => "varchar(255) DEFAULT '' NOT NULL",
"issn" => "varchar(255) DEFAULT '' NOT NULL",
"url" => "text DEFAULT '' NOT NULL",
"extras" => "text DEFAULT '' NOT NULL",
"mimetype" => "varchar(255) DEFAULT '' NOT NULL",
"poids" => "bigint",
"fichier" => "text DEFAULT '' NOT NULL",
"json" => "mediumtext DEFAULT '' NOT NULL",
"csljson" => "mediumtext DEFAULT '' NOT NULL",
"updated" => "varchar(50) DEFAULT '' NOT NULL",
"date_ajout"=> "varchar(50) DEFAULT '' NOT NULL"
),
'key' => array(
"PRIMARY KEY" => "id_zitem",
"KEY id_parent" => "id_parent"
)
);
'field' => [
'id_zitem' => "varchar(16) DEFAULT '' NOT NULL",
'id_parent' => "varchar(16) DEFAULT '' NOT NULL",
'type_ref' => "varchar(255) DEFAULT '' NOT NULL",
'annee' => 'smallint(6)',
'titre' => "text DEFAULT '' NOT NULL",
'auteurs' => "text DEFAULT '' NOT NULL",
'resume' => "mediumtext DEFAULT '' NOT NULL",
'date' => "varchar(255) DEFAULT '' NOT NULL",
'pages' => "varchar(255) DEFAULT '' NOT NULL",
'publication' => "text DEFAULT '' NOT NULL",
'editeur' => "text DEFAULT '' NOT NULL",
'collection' => "varchar(255) DEFAULT '' NOT NULL",
'conference' => "text DEFAULT '' NOT NULL",
'type_doc' => "text DEFAULT '' NOT NULL",
'volume' => "varchar(255) DEFAULT '' NOT NULL",
'numero' => "varchar(255) DEFAULT '' NOT NULL",
'doi' => "varchar(255) DEFAULT '' NOT NULL",
'isbn' => "varchar(255) DEFAULT '' NOT NULL",
'issn' => "varchar(255) DEFAULT '' NOT NULL",
'url' => "text DEFAULT '' NOT NULL",
'extras' => "text DEFAULT '' NOT NULL",
'mimetype' => "varchar(255) DEFAULT '' NOT NULL",
'poids' => 'bigint',
'fichier' => "text DEFAULT '' NOT NULL",
'json' => "mediumtext DEFAULT '' NOT NULL",
'csljson' => "mediumtext DEFAULT '' NOT NULL",
'updated' => "varchar(50) DEFAULT '' NOT NULL",
'date_ajout' => "varchar(50) DEFAULT '' NOT NULL"
],
'key' => [
'PRIMARY KEY' => 'id_zitem',
'KEY id_parent' => 'id_parent'
]
];
return $tables;
}
function zotspip_declarer_tables_auxiliaires($tables_auxiliaires){
function zotspip_declarer_tables_auxiliaires($tables_auxiliaires) {
//-- Table zcollections -----------------------------------------------------------
$zcollections = array(
"id_zcollection" => "varchar(16) DEFAULT '' NOT NULL",
"id_parent" => "varchar(16) DEFAULT '' NOT NULL",
"zcollection" => "text DEFAULT '' NOT NULL",
"updated" => "varchar(50) DEFAULT '' NOT NULL"
);
$zcollections_cles = array(
"PRIMARY KEY" => "id_zcollection",
"KEY id_parent" => "id_parent"
);
$tables_auxiliaires['spip_zcollections'] = array(
$zcollections = [
'id_zcollection' => "varchar(16) DEFAULT '' NOT NULL",
'id_parent' => "varchar(16) DEFAULT '' NOT NULL",
'zcollection' => "text DEFAULT '' NOT NULL",
'updated' => "varchar(50) DEFAULT '' NOT NULL"
];
$zcollections_cles = [
'PRIMARY KEY' => 'id_zcollection',
'KEY id_parent' => 'id_parent'
];
$tables_auxiliaires['spip_zcollections'] = [
'field' => &$zcollections,
'key' => &$zcollections_cles
);
];
//-- Table zcreators -----------------------------------------------------------
$zcreators = array(
"auteur" => "varchar(150) DEFAULT '' NOT NULL",
"id_zitem" => "varchar(16) DEFAULT '' NOT NULL",
"role" => "varchar(30) DEFAULT '' NOT NULL",
"rang" => "smallint DEFAULT '1' NOT NULL"
);
$zcreators_cles = array(
"PRIMARY KEY" => "auteur, id_zitem, role",
"KEY auteur" => "auteur"
);
$tables_auxiliaires['spip_zcreators'] = array(
$zcreators = [
'auteur' => "varchar(150) DEFAULT '' NOT NULL",
'id_zitem' => "varchar(16) DEFAULT '' NOT NULL",
'role' => "varchar(30) DEFAULT '' NOT NULL",
'rang' => "smallint DEFAULT '1' NOT NULL"
];
$zcreators_cles = [
'PRIMARY KEY' => 'auteur, id_zitem, role',
'KEY auteur' => 'auteur'
];
$tables_auxiliaires['spip_zcreators'] = [
'field' => &$zcreators,
'key' => &$zcreators_cles
);
];
//-- Table ztags -----------------------------------------------------------
$ztags = array(
"tag" => "varchar(255) DEFAULT '' NOT NULL",
"id_zitem" => "varchar(16) DEFAULT '' NOT NULL"
);
$ztags = [
'tag' => "varchar(255) DEFAULT '' NOT NULL",
'id_zitem' => "varchar(16) DEFAULT '' NOT NULL"
];
$ztags_cles = array(
"PRIMARY KEY" => "tag, id_zitem",
"KEY tag" => "tag"
);
$ztags_cles = [
'PRIMARY KEY' => 'tag, id_zitem',
'KEY tag' => 'tag'
];
$tables_auxiliaires['spip_ztags'] = array(
$tables_auxiliaires['spip_ztags'] = [
'field' => &$ztags,
'key' => &$ztags_cles
);
];
//-- Table zitems_zcollections -----------------------------------------------------------
$zitems_zcollections = array(
"id_zitem" => "varchar(16) DEFAULT '' NOT NULL",
"id_zcollection" => "varchar(16) DEFAULT '' NOT NULL"
);
$zitems_zcollections = [
'id_zitem' => "varchar(16) DEFAULT '' NOT NULL",
'id_zcollection' => "varchar(16) DEFAULT '' NOT NULL"
];
$zitems_zcollections_cles = array(
"PRIMARY KEY" => "id_zitem, id_zcollection",
"KEY id_zcollection" => "id_zcollection"
);
$zitems_zcollections_cles = [
'PRIMARY KEY' => 'id_zitem, id_zcollection',
'KEY id_zcollection' => 'id_zcollection'
];
$tables_auxiliaires['spip_zitems_zcollections'] = array(
$tables_auxiliaires['spip_zitems_zcollections'] = [
'field' => &$zitems_zcollections,
'key' => &$zitems_zcollections_cles
);
];
return $tables_auxiliaires;
}

@ -4,27 +4,27 @@ if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function formulaires_generer_langue_zotero_charger_dist(){
$valeurs = array(
'source'=>'',
function formulaires_generer_langue_zotero_charger_dist() {
$valeurs = [
'source' => '',
'code' => ''
);
];
return $valeurs;
}
function formulaires_generer_langue_zotero_traiter_dist(){
function formulaires_generer_langue_zotero_traiter_dist() {
$source = trim(_request('source'));
$source = explode("\n",$source);
$source = explode("\n", $source);
$code = '';
foreach ($source as $ligne) {
if(strpos($ligne,'=')) {
$ligne = explode ('=',$ligne);
if (strpos($ligne, '=')) {
$ligne = explode('=', $ligne);
$ligne[0] = trim($ligne[0]);
$ligne[1] = trim($ligne[1]);
$code .= "'".strtolower(str_replace('.','_',$ligne[0]))."' => '".str_replace("'","\\'",$ligne[1])."',\n";
$code .= "'" . strtolower(str_replace('.', '_', $ligne[0])) . "' => '" . str_replace("'", "\\'", $ligne[1]) . "',\n";
}
}
$code = trim($code);
$code = substr($code,0,-1);
set_request('code',$code);
$code = substr($code, 0, -1);
set_request('code', $code);
}

@ -4,39 +4,40 @@ if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function formulaires_maj_zotspip_charger_dist(){
$zotspip_maj = isset($GLOBALS['meta']['zotspip_maj']) ? unserialize($GLOBALS['meta']['zotspip_maj']) : array('forcer' => false);
function formulaires_maj_zotspip_charger_dist() {
$zotspip_maj = isset($GLOBALS['meta']['zotspip_maj']) ? unserialize($GLOBALS['meta']['zotspip_maj']) : ['forcer' => false];
$avancement = '';
if (isset($zotspip_maj['step']) & $zotspip_maj['step']=='items') {
if (isset($zotspip_maj['step']) & $zotspip_maj['step'] == 'items') {
$zotspip_maj_items = unserialize($GLOBALS['meta']['zotspip_maj_items']);
$avancement = _T('zotspip:plusieurs_references_sync',array('nb'=>isset($zotspip_maj_items['start'])?$zotspip_maj_items['start']:0));
$avancement = _T('zotspip:plusieurs_references_sync', ['nb' => isset($zotspip_maj_items['start']) ? $zotspip_maj_items['start'] : 0]);
}
if (isset($zotspip_maj['step']) & $zotspip_maj['step']=='collections') {
if (isset($zotspip_maj['step']) & $zotspip_maj['step'] == 'collections') {
$zotspip_maj_collections = unserialize($GLOBALS['meta']['zotspip_maj_collections']);
$avancement = _T('zotspip:plusieurs_collections_sync',array('nb'=>isset($zotspip_maj_collections['start'])?$zotspip_maj_collections['start']:0));
$avancement = _T('zotspip:plusieurs_collections_sync', ['nb' => isset($zotspip_maj_collections['start']) ? $zotspip_maj_collections['start'] : 0]);
}
if (isset($zotspip_maj['step']) & $zotspip_maj['step']=='nettoyage') {
if (isset($zotspip_maj['step']) & $zotspip_maj['step'] == 'nettoyage') {
$avancement = _T('zotspip:nettoyage');
}
$contexte = array(
'forcer'=> $zotspip_maj['forcer'] ? 'on' : '',
$contexte = [
'forcer' => $zotspip_maj['forcer'] ? 'on' : '',
'sync' => isset($zotspip_maj['step']) ? 'on' : '',
'avancement' => $avancement
);
];
return $contexte;
}
function formulaires_maj_zotspip_traiter_dist(){
function formulaires_maj_zotspip_traiter_dist() {
include_spip('inc/zotspip');
$forcer = (_request('sync_complete')) ? true : false;
$id_zcollection = _request('zcollection');
$cont = zotspip_maj($forcer, $id_zcollection);
if ($cont==0)
return array('message_erreur' => _T('zotspip:erreur_connexion'));
if ($cont>0) {
return array('message_ok' => _T('zotspip:synchronisation_effectuee'));
if ($cont == 0) {
return ['message_erreur' => _T('zotspip:erreur_connexion')];
}
if ($cont > 0) {
return ['message_ok' => _T('zotspip:synchronisation_effectuee')];
}
}

@ -1,10 +1,10 @@
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function genie_maj_schema_zotero_dist($t) {
include_spip('inc/zotspip');
return zotspip_maj_schema_zotero();
}
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function genie_maj_schema_zotero_dist($t) {
include_spip('inc/zotspip');
return zotspip_maj_schema_zotero();
}

@ -1,10 +1,10 @@
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function genie_maj_zotspip_dist($t) {
include_spip('inc/zotspip');
return zotspip_maj();
}
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function genie_maj_zotspip_dist($t) {
include_spip('inc/zotspip');
return zotspip_maj();
}

File diff suppressed because it is too large Load Diff

@ -8,57 +8,57 @@ include_spip('inc/meta');
include_spip('inc/zotspip');
// Installation et mise à jour
function zotspip_upgrade($nom_meta_base_version, $version_cible){
$maj = array();
function zotspip_upgrade($nom_meta_base_version, $version_cible) {
$maj = [];
$maj['create'] = array(
array('maj_tables',array('spip_zitems','spip_zcollections','spip_zcreators','spip_ztags','spip_zitems_zcollections')),
array('zotspip_installer_schema_zotero')
);
$maj['create'] = [
['maj_tables',['spip_zitems','spip_zcollections','spip_zcreators','spip_ztags','spip_zitems_zcollections']],
['zotspip_installer_schema_zotero']
];
$maj['0.2'] = array(
array('maj_tables',array('spip_zitems')),
array('zotspip_maj_items',true,5)
);
$maj['0.2'] = [
['maj_tables',['spip_zitems']],
['zotspip_maj_items',true,5]
];
$maj['0.3'] = array(
array('sql_alter',"TABLE spip_zitems CHANGE type type_ref varchar(255) DEFAULT '' NOT NULL")
);
$maj['0.3'] = [
['sql_alter',"TABLE spip_zitems CHANGE type type_ref varchar(255) DEFAULT '' NOT NULL"]
];
$maj['0.4'] = array(
array('maj_tables',array('spip_zcreators')),
array('zotspip_maj_items',true,5)
);
$maj['0.4'] = [
['maj_tables',['spip_zcreators']],
['zotspip_maj_items',true,5]
];
include_spip('base/upgrade');
maj_plugin($nom_meta_base_version, $version_cible, $maj);
}
// Désinstallation
function zotspip_vider_tables($nom_meta_version_base){
function zotspip_vider_tables($nom_meta_version_base) {
include_spip('base/abstract_sql');
// On efface les tables du plugin
sql_drop_table('spip_zitems');
sql_drop_table('spip_zcollections');
sql_drop_table('spip_zcreators');
sql_drop_table('spip_ztags');
sql_drop_table('spip_zitems_zcollections');
// On efface la version enregistrée
effacer_meta($nom_meta_version_base);
// On efface la configuration et l'état de la synchronisation
effacer_meta('zotspip');
effacer_meta('zotspip_maj_items');
// On efface les fichiers distants
include_spip('inc/invalideur');
purger_repertoire(_DIR_VAR."cache-zotspip/");
purger_repertoire(_DIR_VAR . 'cache-zotspip/');
include_spip('inc/flock');
spip_unlink(_DIR_VAR."cache-zotspip/");
spip_unlink(_DIR_VAR . 'cache-zotspip/');
// On efface le schema Zotero
supprimer_fichier(_DIR_TMP . 'schema_zotero.php');
}
@ -66,10 +66,10 @@ function zotspip_vider_tables($nom_meta_version_base){
// Installer le schéma de données Zotero (schéma mis à jour le 13 mars 2016)
// On le fait manuellement car la fonction de mise à jour doit être appelée au moins 4-5 fois pour couvrir tous les types
// La mise à jour se fera en tâche CRON
function zotspip_installer_schema_zotero(){
$schema = array(
function zotspip_installer_schema_zotero() {
$schema = [
'itemTypes' =>
array(
[
0 => 'artwork',
1 => 'audioRecording',
2 => 'bill',
@ -105,9 +105,9 @@ function zotspip_installer_schema_zotero(){
32 => 'thesis',
33 => 'videoRecording',
34 => 'webpage',
),
],
'itemFields' =>
array(
[
0 => 'numPages',
1 => 'numberOfVolumes',
2 => 'abstractNote',
@ -209,11 +209,11 @@ function zotspip_installer_schema_zotero(){
98 => 'volume',
99 => 'websiteTitle',
100 => 'websiteType',
),
],
'itemTypeFields' =>
array(
[
'artwork' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'artworkMedium',
@ -229,9 +229,9 @@ function zotspip_installer_schema_zotero(){
12 => 'accessDate',
13 => 'rights',
14 => 'extra',
),
],
'audioRecording' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'audioRecordingFormat',
@ -253,9 +253,9 @@ function zotspip_installer_schema_zotero(){
18 => 'accessDate',
19 => 'rights',
20 => 'extra',
),
],
'bill' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'billNumber',
@ -273,9 +273,9 @@ function zotspip_installer_schema_zotero(){
14 => 'shortTitle',
15 => 'rights',
16 => 'extra',
),
],
'blogPost' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'blogTitle',
@ -287,9 +287,9 @@ function zotspip_installer_schema_zotero(){
8 => 'shortTitle',
9 => 'rights',
10 => 'extra',
),
],
'book' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'series',
@ -312,9 +312,9 @@ function zotspip_installer_schema_zotero(){
19 => 'callNumber',
20 => 'rights',
21 => 'extra',
),
],
'bookSection' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'bookTitle',
@ -338,9 +338,9 @@ function zotspip_installer_schema_zotero(){
20 => 'callNumber',
21 => 'rights',
22 => 'extra',
),
],
'case' =>
array(
[
0 => 'caseName',
1 => 'abstractNote',
2 => 'reporter',
@ -356,9 +356,9 @@ function zotspip_installer_schema_zotero(){
12 => 'accessDate',
13 => 'rights',
14 => 'extra',
),
],
'computerProgram' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'seriesTitle',
@ -378,9 +378,9 @@ function zotspip_installer_schema_zotero(){
16 => 'callNumber',
17 => 'accessDate',
18 => 'extra',
),
],
'conferencePaper' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'date',
@ -403,9 +403,9 @@ function zotspip_installer_schema_zotero(){
19 => 'callNumber',
20 => 'rights',
21 => 'extra',
),
],
'dictionaryEntry' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'dictionaryTitle',
@ -429,9 +429,9 @@ function zotspip_installer_schema_zotero(){
20 => 'callNumber',
21 => 'rights',
22 => 'extra',
),
],
'document' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'publisher',
@ -446,9 +446,9 @@ function zotspip_installer_schema_zotero(){
11 => 'callNumber',
12 => 'rights',
13 => 'extra',
),
],
'email' =>
array(
[
0 => 'subject',
1 => 'abstractNote',
2 => 'date',
@ -458,9 +458,9 @@ function zotspip_installer_schema_zotero(){
6 => 'language',
7 => 'rights',
8 => 'extra',
),
],
'encyclopediaArticle' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'encyclopediaTitle',
@ -484,9 +484,9 @@ function zotspip_installer_schema_zotero(){
20 => 'callNumber',
21 => 'rights',
22 => 'extra',
),
],
'film' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'distributor',
@ -504,9 +504,9 @@ function zotspip_installer_schema_zotero(){
14 => 'callNumber',
15 => 'rights',
16 => 'extra',
),
],
'forumPost' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'forumTitle',
@ -518,9 +518,9 @@ function zotspip_installer_schema_zotero(){
8 => 'accessDate',
9 => 'rights',
10 => 'extra',
),
],
'hearing' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'committee',
@ -539,9 +539,9 @@ function zotspip_installer_schema_zotero(){
15 => 'accessDate',
16 => 'rights',
17 => 'extra',
),
],
'instantMessage' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'date',
@ -551,9 +551,9 @@ function zotspip_installer_schema_zotero(){
6 => 'accessDate',
7 => 'rights',
8 => 'extra',
),
],
'interview' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'date',
@ -568,9 +568,9 @@ function zotspip_installer_schema_zotero(){
11 => 'callNumber',
12 => 'rights',
13 => 'extra',
),
],
'journalArticle' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'publicationTitle',
@ -594,9 +594,9 @@ function zotspip_installer_schema_zotero(){
20 => 'callNumber',
21 => 'rights',
22 => 'extra',
),
],
'letter' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'letterType',
@ -611,9 +611,9 @@ function zotspip_installer_schema_zotero(){
11 => 'callNumber',
12 => 'rights',
13 => 'extra',
),
],
'magazineArticle' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'publicationTitle',
@ -632,9 +632,9 @@ function zotspip_installer_schema_zotero(){
15 => 'callNumber',
16 => 'rights',
17 => 'extra',
),
],
'manuscript' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'manuscriptType',
@ -651,9 +651,9 @@ function zotspip_installer_schema_zotero(){
13 => 'callNumber',
14 => 'rights',
15 => 'extra',
),
],
'map' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'mapType',
@ -674,9 +674,9 @@ function zotspip_installer_schema_zotero(){
17 => 'callNumber',
18 => 'rights',
19 => 'extra',
),
],
'newspaperArticle' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'publicationTitle',
@ -696,11 +696,11 @@ function zotspip_installer_schema_zotero(){
16 => 'callNumber',
17 => 'rights',
18 => 'extra',
),
],
'note' =>
array(),
[],
'patent' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'place',
@ -721,9 +721,9 @@ function zotspip_installer_schema_zotero(){
17 => 'accessDate',
18 => 'rights',
19 => 'extra',
),
],
'podcast' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'seriesTitle',
@ -736,9 +736,9 @@ function zotspip_installer_schema_zotero(){
9 => 'shortTitle',
10 => 'rights',
11 => 'extra',
),
],
'presentation' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'presentationType',
@ -751,9 +751,9 @@ function zotspip_installer_schema_zotero(){
9 => 'shortTitle',
10 => 'rights',
11 => 'extra',
),
],
'radioBroadcast' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'programTitle',
@ -773,9 +773,9 @@ function zotspip_installer_schema_zotero(){
16 => 'callNumber',
17 => 'rights',
18 => 'extra',
),
],
'report' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'reportNumber',
@ -795,9 +795,9 @@ function zotspip_installer_schema_zotero(){
16 => 'callNumber',
17 => 'rights',
18 => 'extra',
),
],
'statute' =>
array(
[
0 => 'nameOfAct',
1 => 'abstractNote',
2 => 'code',
@ -814,9 +814,9 @@ function zotspip_installer_schema_zotero(){
13 => 'accessDate',
14 => 'rights',
15 => 'extra',
),
],
'tvBroadcast' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'programTitle',
@ -836,9 +836,9 @@ function zotspip_installer_schema_zotero(){
16 => 'callNumber',
17 => 'rights',
18 => 'extra',
),
],
'thesis' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'thesisType',
@ -856,9 +856,9 @@ function zotspip_installer_schema_zotero(){
14 => 'callNumber',
15 => 'rights',
16 => 'extra',
),
],
'videoRecording' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'videoRecordingFormat',
@ -880,9 +880,9 @@ function zotspip_installer_schema_zotero(){
18 => 'callNumber',
19 => 'rights',
20 => 'extra',
),
],
'webpage' =>
array(
[
0 => 'title',
1 => 'abstractNote',
2 => 'websiteTitle',
@ -894,239 +894,239 @@ function zotspip_installer_schema_zotero(){
8 => 'language',
9 => 'rights',
10 => 'extra',
),
),
],
],
'creatorTypes' =>
array(
[
'artwork' =>
array(
[
0 => 'artist',
1 => 'contributor',
),
],
'audioRecording' =>
array(
[
0 => 'performer',
1 => 'composer',
2 => 'contributor',
3 => 'wordsBy',
),
],
'bill' =>
array(
[
0 => 'sponsor',
1 => 'contributor',
2 => 'cosponsor',
),
],
'blogPost' =>
array(
[
0 => 'author',
1 => 'commenter',
2 => 'contributor',
),
],
'book' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'editor',
3 => 'seriesEditor',
4 => 'translator',
),
],
'bookSection' =>
array(
[
0 => 'author',
1 => 'bookAuthor',
2 => 'contributor',
3 => 'editor',
4 => 'seriesEditor',
5 => 'translator',
),
],
'case' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'counsel',
),
],
'computerProgram' =>
array(
[
0 => 'programmer',
1 => 'contributor',
),
],
'conferencePaper' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'editor',
3 => 'seriesEditor',
4 => 'translator',
),
],
'dictionaryEntry' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'editor',
3 => 'seriesEditor',
4 => 'translator',
),
],
'document' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'editor',
3 => 'reviewedAuthor',
4 => 'translator',
),
],
'email' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'recipient',
),
],
'encyclopediaArticle' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'editor',
3 => 'seriesEditor',
4 => 'translator',
),
],
'film' =>
array(
[
0 => 'director',
1 => 'contributor',
2 => 'producer',
3 => 'scriptwriter',
),
],
'forumPost' =>
array(
[
0 => 'author',
1 => 'contributor',
),
],
'hearing' =>
array(
[
0 => 'contributor',
),
],
'instantMessage' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'recipient',
),
],
'interview' =>
array(
[
0 => 'interviewee',
1 => 'contributor',
2 => 'interviewer',
3 => 'translator',
),
],
'journalArticle' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'editor',
3 => 'reviewedAuthor',
4 => 'translator',
),
],
'letter' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'recipient',
),
],
'magazineArticle' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'reviewedAuthor',
3 => 'translator',
),
],
'manuscript' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'translator',
),
],
'map' =>
array(
[
0 => 'cartographer',
1 => 'contributor',
2 => 'seriesEditor',
),
],
'newspaperArticle' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'reviewedAuthor',
3 => 'translator',
),
],
'note' =>
array(),
[],
'patent' =>
array(
[
0 => 'inventor',
1 => 'attorneyAgent',
2 => 'contributor',
),
],
'podcast' =>
array(
[
0 => 'podcaster',
1 => 'contributor',
2 => 'guest',
),
],
'presentation' =>
array(
[
0 => 'presenter',
1 => 'contributor',
),
],
'radioBroadcast' =>
array(
[
0 => 'director',
1 => 'castMember',
2 => 'contributor',
3 => 'guest',
4 => 'producer',
5 => 'scriptwriter',
),
],
'report' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'seriesEditor',
3 => 'translator',
),
],
'statute' =>
array(
[
0 => 'author',
1 => 'contributor',
),
],
'tvBroadcast' =>
array(
[
0 => 'director',
1 => 'castMember',
2 => 'contributor',
3 => 'guest',
4 => 'producer',
5 => 'scriptwriter',
),
],
'thesis' =>
array(
[
0 => 'author',
1 => 'contributor',
),
],
'videoRecording' =>
array(
[
0 => 'director',
1 => 'castMember',
2 => 'contributor',
3 => 'producer',
4 => 'scriptwriter',
),
],
'webpage' =>
array(
[
0 => 'author',
1 => 'contributor',
2 => 'translator',
),
),
);
],
],
];
// Sauver le schéma en cache
ecrire_fichier_securise(_DIR_TMP . 'schema_zotero.php', serialize($schema));

@ -4,7 +4,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function zotspip_autoriser(){
function zotspip_autoriser() {
}
function autoriser_zotspip_menu_dist($faire, $type, $id, $qui, $opt) {
@ -18,15 +18,20 @@ function autoriser_zitems_menu_dist($faire, $type, $id, $qui, $opt) {
function autoriser_zotero_modifier_dist($faire, $type, $id, $qui, $opt) {
include_spip('inc/config');
$config = lire_config('zotspip/autoriser_modif_zotero');
if (!$config)
if (!$config) {
return false;
if ($config=='webmestre')
}
if ($config == 'webmestre') {
return autoriser('webmestre');
if ($config=='admin')
return $qui['statut'] == '0minirezo' AND !$qui['restreint'];
if ($config=='admin_restreint')
return $qui['statut'] == '0minirezo' AND !$qui['restreint'];
if ($config=='redacteur')
return $qui['statut'] == '0minirezo' OR $qui['statut'] == '1comite';
}
if ($config == 'admin') {
return $qui['statut'] == '0minirezo' and !$qui['restreint'];
}
if ($config == 'admin_restreint') {
return $qui['statut'] == '0minirezo' and !$qui['restreint'];
}
if ($config == 'redacteur') {
return $qui['statut'] == '0minirezo' or $qui['statut'] == '1comite';
}
return false;
}
}

@ -1,11 +1,11 @@
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function zotspip_taches_generales_cron($taches){
$taches['maj_zotspip'] = 3600*4; // toutes les 4 heures
$taches['maj_schema_zotero'] = 3600*24*30; // une fois par mois
return $taches;
}
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function zotspip_taches_generales_cron($taches) {
$taches['maj_zotspip'] = 3600 * 4; // toutes les 4 heures
$taches['maj_schema_zotero'] = 3600 * 24 * 30; // une fois par mois
return $taches;
}

@ -6,7 +6,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
// Cette balise teste si la connexion à Zotero fonctionne
function balise_TESTER_CONNEXION_ZOTERO_dist($p) {
$p->code = "zotspip_tester_connexion_zotero()";
$p->code = 'zotspip_tester_connexion_zotero()';
return $p;
}
@ -23,24 +23,24 @@ function balise_REFERENCE_dist($p) {
$csljson = champ_sql('csljson', $p);
$annee = champ_sql('annee', $p);
$_lang = champ_sql('lang', $p);
$style = interprete_argument_balise(1,$p);
$souligne = interprete_argument_balise(2,$p);
$style = interprete_argument_balise(1, $p);
$souligne = interprete_argument_balise(2, $p);
$date = champ_sql('date', $p);
if (!$style) {
$style='""';
$style = '""';
}
if (!$souligne) {
$souligne='array()';
$souligne = 'array()';
}
$p->code = "zotspip_calculer_reference($csljson,$annee,$style,$souligne,$date,htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang']))";
return $p;
}
function zotspip_calculer_reference($csljson,$annee,$style,$souligne,$date,$lang) {
function zotspip_calculer_reference($csljson, $annee, $style, $souligne, $date, $lang) {
include_spip('lib/citeproc-php/CiteProc');
include_spip('inc/config');
static $citeproc = array();
static $citeproc = [];
if (!$style) {
include_spip('inc/config');
$style = lire_config('zotspip/csl_defaut') ? lire_config('zotspip/csl_defaut') : 'apa';
@ -50,28 +50,36 @@ function zotspip_calculer_reference($csljson,$annee,$style,$souligne,$date,$lang
if (isset($data->issued->raw) && lire_config('zotspip/corriger_date')) { // Correction de la date de publication (si fournie brute et si option activée)
unset($data->issued->raw);
// Gestion des cas où la date est de la forme yyyy-mm ou yyyy-mm-dd
if (preg_match('#^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})$#',trim($date),$matches))
$data->issued->{'date-parts'} = array(array($matches[1],$matches[2],$matches[3]));
elseif (preg_match('#^([0-9]{4})-([0-9]{1,2})$#',trim($date),$matches))
$data->issued->{'date-parts'} = array(array($matches[1],$matches[2]));
else
$data->issued->{'date-parts'} = array(array($annee));
if (preg_match('#^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})$#', trim($date), $matches)) {
$data->issued->{'date-parts'} = [[$matches[1],$matches[2],$matches[3]]];
} elseif (preg_match('#^([0-9]{4})-([0-9]{1,2})$#', trim($date), $matches)) {
$data->issued->{'date-parts'} = [[$matches[1],$matches[2]]];
} else { $data->issued->{'date-parts'} = [[$annee]];
}
}
if (!is_array($souligne)) $souligne = explode(';',$souligne);
if (!is_array($souligne)) { $souligne = explode(';', $souligne);
}
if (count($souligne)){
if (count($souligne)) {
foreach ($souligne as $aut_souligne) {
if(!strpos($aut_souligne,',')) $aut_souligne .= ', ';
$aut_souligne = explode(',',$aut_souligne);
if (is_array($data->author))
foreach ($data->author as $cle => $author)
if ($author->family == trim($aut_souligne[0]) && $author->given == trim($aut_souligne[1]))
$data->author[$cle]->family = '§§'.$data->author[$cle]->family.'§§';
if (is_array($data->editor))
foreach ($data->editor as $cle => $editor)
if ($editor->family == trim($aut_souligne[0]) && $editor->given == trim($aut_souligne[1]))
$data->editor[$cle]->family = '§§'.$data->editor[$cle]->family.'§§';
if (!strpos($aut_souligne, ',')) { $aut_souligne .= ', ';
}
$aut_souligne = explode(',', $aut_souligne);
if (is_array($data->author)) {
foreach ($data->author as $cle => $author) {
if ($author->family == trim($aut_souligne[0]) && $author->given == trim($aut_souligne[1])) {
$data->author[$cle]->family = '§§' . $data->author[$cle]->family . '§§';
}
}
}
if (is_array($data->editor)) {
foreach ($data->editor as $cle => $editor) {
if ($editor->family == trim($aut_souligne[0]) && $editor->given == trim($aut_souligne[1])) {
$data->editor[$cle]->family = '§§' . $data->editor[$cle]->family . '§§';
}
}
}
}
}
@ -80,39 +88,40 @@ function zotspip_calculer_reference($csljson,$annee,$style,$souligne,$date,$lang
$csl = spip_file_get_contents(find_in_path("csl/$style.csl"));
// Si le style demande n'est pas disponible, message d'erreur et se rabattre sur apa.csl
if (!$csl) {
erreur_squelette(_T('zotspip:message_erreur_style_csl',array('style'=>$style)));
$csl = spip_file_get_contents(find_in_path("csl/apa.csl"));
erreur_squelette(_T('zotspip:message_erreur_style_csl', ['style' => $style]));
$csl = spip_file_get_contents(find_in_path('csl/apa.csl'));
}
$citeproc[$style] = new citeproc($csl,$lang);
$citeproc[$style] = new citeproc($csl, $lang);
}
$ret = $citeproc[$style]->render($data, 'bibliography');
if (count($souligne))
$ret = preg_replace(',§§(.+)§§,U','<span style="text-decoration:underline;">$1</span>',$ret);
if (count($souligne)) {
$ret = preg_replace(',§§(.+)§§,U', '<span style="text-decoration:underline;">$1</span>', $ret);
}
return $ret;
}
// Lister les styles CSL disponibles
function balise_LISTER_CSL_dist($p) {
$p->code = "zotspip_lister_csl()";
$p->code = 'zotspip_lister_csl()';
return $p;
}
function zotspip_lister_csl(){
function zotspip_lister_csl() {
static $liste_csl = null;
if (is_null($liste_csl)){
$liste_csl = array();
$match = ".+[.]csl$";
if (is_null($liste_csl)) {
$liste_csl = [];
$match = '.+[.]csl$';
$liste = find_all_in_path('csl/', $match);
if (count($liste)){
foreach($liste as $fichier=>$chemin) {
if (count($liste)) {
foreach ($liste as $fichier => $chemin) {
$style = spip_file_get_contents($chemin);
$csl = substr($fichier,0,-4);
if (preg_match('#\<title\>(.*)\</title\>#',$style,$matches))
$csl = substr($fichier, 0, -4);
if (preg_match('#\<title\>(.*)\</title\>#', $style, $matches)) {
$liste_csl[$csl] = $matches[1];
else
$liste_csl[$csl] = $csl;
} else { $liste_csl[$csl] = $csl;
}
}
}
}
@ -121,35 +130,40 @@ function zotspip_lister_csl(){
// Traduire le type de reference
function zotspip_traduire_type($type) {
return ($type!='') ? _T('zotero:itemtypes_'.strtolower($type)) : '';
return ($type != '') ? _T('zotero:itemtypes_' . strtolower($type)) : '';
}
// Traduire le champ Zotero
function zotspip_traduire_champ($champ) {
return ($champ!='') ? _T('zotero:itemfields_'.strtolower($champ)) : '';
return ($champ != '') ? _T('zotero:itemfields_' . strtolower($champ)) : '';
}
// Traduire le type d'auteur
function zotspip_traduire_createur($type) {
return ($type!='') ? _T('zotero:creatortypes_'.strtolower($type)) : '';
return ($type != '') ? _T('zotero:creatortypes_' . strtolower($type)) : '';
}
// Fonction utilisée dans pre_typo pour traiter les raccourcis [ref=xxxx]
function zotspip_traiter_raccourci_ref_dist($texte) {
$texte = preg_replace('#\[ref=(.*)\]#U','[[&#32;<ref|id=$1>]]',$texte);
$texte = preg_replace('#\[ref=(.*)\]#U', '[[&#32;<ref|id=$1>]]', $texte);
return $texte;
}
// Afficher l'icône du document
// On peut optionnellement ajouter mimetype et fichier pour distinguer les icônes dans le cadre des pièces jointes
function zotspip_icone_type($type, $mimetype=NULL, $fichier=NULL) {
function zotspip_icone_type($type, $mimetype = null, $fichier = null) {
$alt = zotspip_traduire_type($type);
if ($type=='attachment' && !is_null($fichier) && !$fichier) $type = 'attachment-web-link'; // Si fichier n'est pas renseigné, c'est un lien sur le web
if ($type=='attachment' && $fichier && $mimetype=='text/html') $type = 'attachment-snapshot';
if ($type=='attachment' && $fichier && $mimetype=='application/pdf') $type = 'attachment-pdf';
if ($type == 'attachment' && !is_null($fichier) && !$fichier) { $type = 'attachment-web-link'; // Si fichier n'est pas renseigné, c'est un lien sur le web
}
if ($type == 'attachment' && $fichier && $mimetype == 'text/html') { $type = 'attachment-snapshot';
}
if ($type == 'attachment' && $fichier && $mimetype == 'application/pdf') { $type = 'attachment-pdf';
}
$chemin = find_in_path("images/zotero/$type.svg");
if (!$chemin) $chemin = find_in_path("images/zotero/$type.png");
if (!$chemin) $chemin = find_in_path("images/zotero/item.png");
if (!$chemin) { $chemin = find_in_path("images/zotero/$type.png");
}
if (!$chemin) { $chemin = find_in_path('images/zotero/item.png');
}
return "<img src=\"$chemin\" height=\"16\" width=\"16\" alt=\"$alt\"/>";
}
@ -162,71 +176,76 @@ function balise_ZITEM_DETAILS_dist($p) {
function zotspip_calculer_zitem_details($json) {
$ret = '<table class="zitem_details spip">';
$data = json_decode($json,true);
if (!is_array($data)) return '';
$data = json_decode($json, true);
if (!is_array($data)) { return '';
}
foreach ($data as $champ => $valeur) {
if ($champ=='itemType')
$ret .= "<tr><td class=\"champ\"><strong>".zotspip_traduire_champ($champ)."</strong></td><td class=\"valeur\">".zotspip_traduire_type($valeur)."</td></tr>";
elseif ($champ=='creators')
foreach ($valeur as $creator)
$ret .= "<tr><td class=\"champ\"><strong>".zotspip_traduire_createur($creator['creatorType'])."</strong></td><td class=\"valeur\">".(isset($creator['name'])?$creator['name']:($creator['lastName'].(isset($creator['firstName'])?', '.$creator['firstName']:'')))."</td></tr>";
elseif ($champ=='tags' && count($valeur)>0) {
$tags = array();
foreach ($valeur as $tag)
if ($champ == 'itemType') {
$ret .= '<tr><td class="champ"><strong>' . zotspip_traduire_champ($champ) . '</strong></td><td class="valeur">' . zotspip_traduire_type($valeur) . '</td></tr>';
} elseif ($champ == 'creators') {
foreach ($valeur as $creator) {
$ret .= '<tr><td class="champ"><strong>' . zotspip_traduire_createur($creator['creatorType']) . '</strong></td><td class="valeur">' . (isset($creator['name']) ? $creator['name'] : ($creator['lastName'] . (isset($creator['firstName']) ? ', ' . $creator['firstName'] : ''))) . '</td></tr>';
}
} elseif ($champ == 'tags' && count($valeur) > 0) {
$tags = [];
foreach ($valeur as $tag) {
$tags[] = $tag['tag'];
$tags = implode(' &middot; ',$tags);
$ret .= "<tr><td class=\"champ\"><strong>"._T('zotero:itemfields_tags')."</strong></td><td class=\"valeur\">$tags</td></tr>";
}
$tags = implode(' &middot; ', $tags);
$ret .= '<tr><td class="champ"><strong>' . _T('zotero:itemfields_tags') . "</strong></td><td class=\"valeur\">$tags</td></tr>";
}
elseif ($champ=='mimeType')
elseif ($champ == 'mimeType') {
$ret .= "<tr><td class=\"champ\"><strong>MIME</strong></td><td class=\"valeur\">$valeur</td></tr>";
elseif ($champ=='url')
$ret .= "<tr><td class=\"champ\"><strong>".zotspip_traduire_champ($champ)."</strong></td><td class=\"valeur\"><a href=\"$valeur\">$valeur</a></td></tr>";
elseif ($valeur)
$ret .= "<tr><td class=\"champ\"><strong>".zotspip_traduire_champ($champ)."</strong></td><td class=\"valeur\">$valeur</td></tr>";
} elseif ($champ == 'url') {
$ret .= '<tr><td class="champ"><strong>' . zotspip_traduire_champ($champ) . "</strong></td><td class=\"valeur\"><a href=\"$valeur\">$valeur</a></td></tr>";
} elseif ($valeur) {
$ret .= '<tr><td class="champ"><strong>' . zotspip_traduire_champ($champ) . "</strong></td><td class=\"valeur\">$valeur</td></tr>";
}
}
$ret .= '</table>';
return $ret;
}
// Exporte les items dans le format demandé
function zotspip_export ($id, $format) {
if (is_array($id)) $id = implode(',',$id);
function zotspip_export($id, $format) {
if (is_array($id)) { $id = implode(',', $id);
}
include_spip('inc/zotspip');
return zotero_get("items/?itemKey=$id&format=$format");
}
// Renvoie le content-type correspondant à un format d'export
function zotspip_content_type ($format) {
function zotspip_content_type($format) {
switch ($format) {
case 'bibtex':
$ctype = "application/x-bibtex";
$ctype = 'application/x-bibtex';
break;
case 'mods':
$ctype = "application/mods+xml";
$ctype = 'application/mods+xml';
break;
case 'refer':
$ctype = "application/x-research-info-systems" ;
$ctype = 'application/x-research-info-systems' ;
break;
case 'rdf_bibliontology':
case 'rdf_dc':
case 'rdf_zotero':
$ctype = "application/rdf+xml";
$ctype = 'application/rdf+xml';
break;
case 'ris':
$ctype = "application/x-research-info-systems";
$ctype = 'application/x-research-info-systems';
break;
case 'wikipedia':
$ctype = "text/x-wiki";
$ctype = 'text/x-wiki';
break;
default: