@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/charsets'); # pour le nom de fichier |
@@ -30,45 +30,45 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function action_supprimer_rubrique_dist($id_rubrique = null) { |
| 32 | 32 | |
| 33 | - if (is_null($id_rubrique)) { |
|
| 34 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | - $id_rubrique = $securiser_action(); |
|
| 36 | - } |
|
| 33 | + if (is_null($id_rubrique)) { |
|
| 34 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | + $id_rubrique = $securiser_action(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if (intval($id_rubrique)) { |
|
| 39 | - sql_delete('spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 40 | - // Les admin restreints qui n'administraient que cette rubrique |
|
| 41 | - // deviennent redacteurs |
|
| 42 | - // (il y a sans doute moyen de faire ca avec un having) |
|
| 38 | + if (intval($id_rubrique)) { |
|
| 39 | + sql_delete('spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 40 | + // Les admin restreints qui n'administraient que cette rubrique |
|
| 41 | + // deviennent redacteurs |
|
| 42 | + // (il y a sans doute moyen de faire ca avec un having) |
|
| 43 | 43 | |
| 44 | - $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . intval($id_rubrique)); |
|
| 45 | - while ($r = sql_fetch($q)) { |
|
| 46 | - $id_auteur = $r['id_auteur']; |
|
| 47 | - // degrader avant de supprimer la restriction d'admin |
|
| 48 | - // section critique sur les droits |
|
| 49 | - $n = sql_countsel( |
|
| 50 | - 'spip_auteurs_liens', |
|
| 51 | - "objet='rubrique' AND id_objet!=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 52 | - ); |
|
| 53 | - if (!$n) { |
|
| 54 | - include_spip('action/editer_auteur'); |
|
| 55 | - auteur_modifier($id_auteur, ['statut' => '1comite']); |
|
| 56 | - } |
|
| 57 | - sql_delete( |
|
| 58 | - 'spip_auteurs_liens', |
|
| 59 | - "objet='rubrique' AND id_objet=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 60 | - ); |
|
| 61 | - } |
|
| 62 | - // menu_rubriques devra recalculer |
|
| 63 | - effacer_meta('date_calcul_rubriques'); |
|
| 44 | + $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . intval($id_rubrique)); |
|
| 45 | + while ($r = sql_fetch($q)) { |
|
| 46 | + $id_auteur = $r['id_auteur']; |
|
| 47 | + // degrader avant de supprimer la restriction d'admin |
|
| 48 | + // section critique sur les droits |
|
| 49 | + $n = sql_countsel( |
|
| 50 | + 'spip_auteurs_liens', |
|
| 51 | + "objet='rubrique' AND id_objet!=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 52 | + ); |
|
| 53 | + if (!$n) { |
|
| 54 | + include_spip('action/editer_auteur'); |
|
| 55 | + auteur_modifier($id_auteur, ['statut' => '1comite']); |
|
| 56 | + } |
|
| 57 | + sql_delete( |
|
| 58 | + 'spip_auteurs_liens', |
|
| 59 | + "objet='rubrique' AND id_objet=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 60 | + ); |
|
| 61 | + } |
|
| 62 | + // menu_rubriques devra recalculer |
|
| 63 | + effacer_meta('date_calcul_rubriques'); |
|
| 64 | 64 | |
| 65 | - // Une rubrique supprimable n'avait pas le statut "publie" |
|
| 66 | - // donc rien de neuf pour la rubrique parente |
|
| 67 | - include_spip('inc/rubriques'); |
|
| 68 | - calculer_langues_rubriques(); |
|
| 65 | + // Une rubrique supprimable n'avait pas le statut "publie" |
|
| 66 | + // donc rien de neuf pour la rubrique parente |
|
| 67 | + include_spip('inc/rubriques'); |
|
| 68 | + calculer_langues_rubriques(); |
|
| 69 | 69 | |
| 70 | - // invalider les caches marques de cette rubrique |
|
| 71 | - include_spip('inc/invalideur'); |
|
| 72 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 73 | - } |
|
| 70 | + // invalider les caches marques de cette rubrique |
|
| 71 | + include_spip('inc/invalideur'); |
|
| 72 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | return; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -include_spip('inc/charsets'); # pour le nom de fichier |
|
| 23 | +include_spip('inc/charsets'); # pour le nom de fichier |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Effacer une rubrique |
@@ -36,19 +36,19 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (intval($id_rubrique)) { |
| 39 | - sql_delete('spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 39 | + sql_delete('spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 40 | 40 | // Les admin restreints qui n'administraient que cette rubrique |
| 41 | 41 | // deviennent redacteurs |
| 42 | 42 | // (il y a sans doute moyen de faire ca avec un having) |
| 43 | 43 | |
| 44 | - $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . intval($id_rubrique)); |
|
| 44 | + $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=".intval($id_rubrique)); |
|
| 45 | 45 | while ($r = sql_fetch($q)) { |
| 46 | 46 | $id_auteur = $r['id_auteur']; |
| 47 | 47 | // degrader avant de supprimer la restriction d'admin |
| 48 | 48 | // section critique sur les droits |
| 49 | 49 | $n = sql_countsel( |
| 50 | 50 | 'spip_auteurs_liens', |
| 51 | - "objet='rubrique' AND id_objet!=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 51 | + "objet='rubrique' AND id_objet!=".intval($id_rubrique).' AND id_auteur='.intval($id_auteur) |
|
| 52 | 52 | ); |
| 53 | 53 | if (!$n) { |
| 54 | 54 | include_spip('action/editer_auteur'); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | sql_delete( |
| 58 | 58 | 'spip_auteurs_liens', |
| 59 | - "objet='rubrique' AND id_objet=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 59 | + "objet='rubrique' AND id_objet=".intval($id_rubrique).' AND id_auteur='.intval($id_auteur) |
|
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | // menu_rubriques devra recalculer |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | 28 | function action_relancer_inscription_dist() { |
| 29 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | - $id_auteur = $securiser_action(); |
|
| 29 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | + $id_auteur = $securiser_action(); |
|
| 31 | 31 | |
| 32 | - if (intval($id_auteur) and autoriser('relancer', 'inscription')) { |
|
| 33 | - $auteur = sql_fetsel('prefs, email, nom, statut', 'spip_auteurs', "id_auteur=$id_auteur"); |
|
| 34 | - if ($auteur['statut'] == 'nouveau') { |
|
| 35 | - include_spip('action/inscrire_auteur'); |
|
| 36 | - action_inscrire_auteur_dist($auteur['prefs'], $auteur['email'], $auteur['nom'], ['force_nouveau' => true]); |
|
| 37 | - } |
|
| 38 | - } elseif ($id_auteur === '*' and autoriser('relancer', 'inscription')) { |
|
| 39 | - $auteurs = sql_allfetsel('prefs, email, nom', 'spip_auteurs', "statut='nouveau'"); |
|
| 40 | - if (is_array($auteurs)) { |
|
| 41 | - include_spip('action/inscrire_auteur'); |
|
| 42 | - while ($row = array_pop($auteurs)) { |
|
| 43 | - action_inscrire_auteur_dist($row['prefs'], $row['email'], $row['nom'], ['force_nouveau' => true]); |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - } |
|
| 32 | + if (intval($id_auteur) and autoriser('relancer', 'inscription')) { |
|
| 33 | + $auteur = sql_fetsel('prefs, email, nom, statut', 'spip_auteurs', "id_auteur=$id_auteur"); |
|
| 34 | + if ($auteur['statut'] == 'nouveau') { |
|
| 35 | + include_spip('action/inscrire_auteur'); |
|
| 36 | + action_inscrire_auteur_dist($auteur['prefs'], $auteur['email'], $auteur['nom'], ['force_nouveau' => true]); |
|
| 37 | + } |
|
| 38 | + } elseif ($id_auteur === '*' and autoriser('relancer', 'inscription')) { |
|
| 39 | + $auteurs = sql_allfetsel('prefs, email, nom', 'spip_auteurs', "statut='nouveau'"); |
|
| 40 | + if (is_array($auteurs)) { |
|
| 41 | + include_spip('action/inscrire_auteur'); |
|
| 42 | + while ($row = array_pop($auteurs)) { |
|
| 43 | + action_inscrire_auteur_dist($row['prefs'], $row['email'], $row['nom'], ['force_nouveau' => true]); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | $dir = constant($dir); |
| 70 | 70 | foreach ($infos['install'] as $file) { |
| 71 | - $file = $dir . $plug . '/' . trim($file); |
|
| 71 | + $file = $dir.$plug.'/'.trim($file); |
|
| 72 | 72 | if (file_exists($file)) { |
| 73 | 73 | include_once($file); |
| 74 | 74 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
| 82 | 82 | lire_metas($table); |
| 83 | 83 | } |
| 84 | - $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 84 | + $nom_meta = $infos['prefix'].'_base_version'; |
|
| 85 | 85 | |
| 86 | 86 | // Détermination de la fonction à appeler et de ses arguments |
| 87 | - $f = $infos['prefix'] . '_install'; |
|
| 87 | + $f = $infos['prefix'].'_install'; |
|
| 88 | 88 | if (!function_exists($f)) { |
| 89 | 89 | $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
| 90 | 90 | $arg = $infos; |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
| 169 | 169 | break; |
| 170 | 170 | case 'install': |
| 171 | - if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 171 | + if (function_exists($upgrade = $infos['prefix'].'_upgrade')) { |
|
| 172 | 172 | $upgrade($nom_meta, $version_cible, $table); |
| 173 | 173 | } |
| 174 | 174 | break; |
| 175 | 175 | case 'uninstall': |
| 176 | - if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 176 | + if (function_exists($vider_tables = $infos['prefix'].'_vider_tables')) { |
|
| 177 | 177 | $vider_tables($nom_meta, $table); |
| 178 | 178 | } |
| 179 | 179 | break; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -54,96 +54,96 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | function plugins_installer_dist($plug, $action, $dir_type = '_DIR_PLUGINS') { |
| 56 | 56 | |
| 57 | - // Charger les informations du XML du plugin et vérification de l'existence d'une installation |
|
| 58 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 59 | - $infos = $get_infos($plug, false, constant($dir_type)); |
|
| 60 | - if (!isset($infos['install']) or !$infos['install']) { |
|
| 61 | - return false; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // Passer en chemin absolu si possible, c'est plus efficace |
|
| 65 | - $dir = str_replace('_DIR_', '_ROOT_', $dir_type); |
|
| 66 | - if (!defined($dir)) { |
|
| 67 | - $dir = $dir_type; |
|
| 68 | - } |
|
| 69 | - $dir = constant($dir); |
|
| 70 | - foreach ($infos['install'] as $file) { |
|
| 71 | - $file = $dir . $plug . '/' . trim($file); |
|
| 72 | - if (file_exists($file)) { |
|
| 73 | - include_once($file); |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - // Détermination de la table meta et du nom de la meta plugin |
|
| 78 | - $table = 'meta'; |
|
| 79 | - if (isset($infos['meta']) and ($infos['meta'] !== 'meta')) { |
|
| 80 | - $table = $infos['meta']; |
|
| 81 | - // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
|
| 82 | - lire_metas($table); |
|
| 83 | - } |
|
| 84 | - $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 85 | - |
|
| 86 | - // Détermination de la fonction à appeler et de ses arguments |
|
| 87 | - $f = $infos['prefix'] . '_install'; |
|
| 88 | - if (!function_exists($f)) { |
|
| 89 | - $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
|
| 90 | - $arg = $infos; |
|
| 91 | - // On passe la table et la meta pour éviter de les recalculer dans la fonction appelée |
|
| 92 | - $arg['meta'] = $table; |
|
| 93 | - $arg['nom_meta'] = $nom_meta; |
|
| 94 | - } else { |
|
| 95 | - // Ancienne méthode d'installation - TODO à supprimer à terme |
|
| 96 | - // stupide: info deja dans le nom |
|
| 97 | - $arg = $infos['prefix']; |
|
| 98 | - } |
|
| 99 | - $version = $infos['schema'] ?? ''; |
|
| 100 | - |
|
| 101 | - if (!$f) { |
|
| 102 | - // installation sans operation particuliere |
|
| 103 | - $infos['install_test'] = [true, '']; |
|
| 104 | - return $infos; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // Tester si l'action demandée est nécessaire ou pas. |
|
| 108 | - $test = $f('test', $arg, $version); |
|
| 109 | - if ($action == 'uninstall') { |
|
| 110 | - $test = !$test; |
|
| 111 | - } |
|
| 112 | - // Si deja fait, on ne fait rien et on ne dit rien |
|
| 113 | - if ($test) { |
|
| 114 | - return true; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // Si install et que l'on a la meta d'installation, c'est un upgrade. On le consigne dans $infos |
|
| 118 | - // pour renvoyer le bon message en retour de la fonction. |
|
| 119 | - if ($action == 'install' && !empty($GLOBALS[$table][$nom_meta])) { |
|
| 120 | - $infos['upgrade'] = true; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - // executer l'installation ou l'inverse |
|
| 124 | - // et renvoyer la trace (mais il faudrait passer en AJAX plutot) |
|
| 125 | - ob_start(); |
|
| 126 | - $f($action, $arg, $version); |
|
| 127 | - $aff = ob_get_contents(); |
|
| 128 | - ob_end_clean(); |
|
| 129 | - |
|
| 130 | - // vider le cache des descriptions de tables a chaque (de)installation |
|
| 131 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 132 | - $trouver_table(''); |
|
| 133 | - $infos['install_test'] = [$f('test', $arg, $version), $aff]; |
|
| 134 | - |
|
| 135 | - // Si la table meta n'est pas spip_meta et qu'on est dans la première installation du plugin |
|
| 136 | - // on force la création du fichier cache à la date du moment. |
|
| 137 | - // On relit les metas de la table pour être sur que la globale soit à jour pour touch_meta. |
|
| 138 | - if ( |
|
| 139 | - ($table !== 'meta') |
|
| 140 | - and ($action == 'install') |
|
| 141 | - and empty($infos['upgrade']) |
|
| 142 | - ) { |
|
| 143 | - touch_meta(false, $table); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - return $infos; |
|
| 57 | + // Charger les informations du XML du plugin et vérification de l'existence d'une installation |
|
| 58 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 59 | + $infos = $get_infos($plug, false, constant($dir_type)); |
|
| 60 | + if (!isset($infos['install']) or !$infos['install']) { |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // Passer en chemin absolu si possible, c'est plus efficace |
|
| 65 | + $dir = str_replace('_DIR_', '_ROOT_', $dir_type); |
|
| 66 | + if (!defined($dir)) { |
|
| 67 | + $dir = $dir_type; |
|
| 68 | + } |
|
| 69 | + $dir = constant($dir); |
|
| 70 | + foreach ($infos['install'] as $file) { |
|
| 71 | + $file = $dir . $plug . '/' . trim($file); |
|
| 72 | + if (file_exists($file)) { |
|
| 73 | + include_once($file); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + // Détermination de la table meta et du nom de la meta plugin |
|
| 78 | + $table = 'meta'; |
|
| 79 | + if (isset($infos['meta']) and ($infos['meta'] !== 'meta')) { |
|
| 80 | + $table = $infos['meta']; |
|
| 81 | + // S'assurer que les metas de la table spécifique sont bien accessibles dans la globale |
|
| 82 | + lire_metas($table); |
|
| 83 | + } |
|
| 84 | + $nom_meta = $infos['prefix'] . '_base_version'; |
|
| 85 | + |
|
| 86 | + // Détermination de la fonction à appeler et de ses arguments |
|
| 87 | + $f = $infos['prefix'] . '_install'; |
|
| 88 | + if (!function_exists($f)) { |
|
| 89 | + $f = isset($infos['schema']) ? 'spip_plugin_install' : ''; |
|
| 90 | + $arg = $infos; |
|
| 91 | + // On passe la table et la meta pour éviter de les recalculer dans la fonction appelée |
|
| 92 | + $arg['meta'] = $table; |
|
| 93 | + $arg['nom_meta'] = $nom_meta; |
|
| 94 | + } else { |
|
| 95 | + // Ancienne méthode d'installation - TODO à supprimer à terme |
|
| 96 | + // stupide: info deja dans le nom |
|
| 97 | + $arg = $infos['prefix']; |
|
| 98 | + } |
|
| 99 | + $version = $infos['schema'] ?? ''; |
|
| 100 | + |
|
| 101 | + if (!$f) { |
|
| 102 | + // installation sans operation particuliere |
|
| 103 | + $infos['install_test'] = [true, '']; |
|
| 104 | + return $infos; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // Tester si l'action demandée est nécessaire ou pas. |
|
| 108 | + $test = $f('test', $arg, $version); |
|
| 109 | + if ($action == 'uninstall') { |
|
| 110 | + $test = !$test; |
|
| 111 | + } |
|
| 112 | + // Si deja fait, on ne fait rien et on ne dit rien |
|
| 113 | + if ($test) { |
|
| 114 | + return true; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // Si install et que l'on a la meta d'installation, c'est un upgrade. On le consigne dans $infos |
|
| 118 | + // pour renvoyer le bon message en retour de la fonction. |
|
| 119 | + if ($action == 'install' && !empty($GLOBALS[$table][$nom_meta])) { |
|
| 120 | + $infos['upgrade'] = true; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + // executer l'installation ou l'inverse |
|
| 124 | + // et renvoyer la trace (mais il faudrait passer en AJAX plutot) |
|
| 125 | + ob_start(); |
|
| 126 | + $f($action, $arg, $version); |
|
| 127 | + $aff = ob_get_contents(); |
|
| 128 | + ob_end_clean(); |
|
| 129 | + |
|
| 130 | + // vider le cache des descriptions de tables a chaque (de)installation |
|
| 131 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 132 | + $trouver_table(''); |
|
| 133 | + $infos['install_test'] = [$f('test', $arg, $version), $aff]; |
|
| 134 | + |
|
| 135 | + // Si la table meta n'est pas spip_meta et qu'on est dans la première installation du plugin |
|
| 136 | + // on force la création du fichier cache à la date du moment. |
|
| 137 | + // On relit les metas de la table pour être sur que la globale soit à jour pour touch_meta. |
|
| 138 | + if ( |
|
| 139 | + ($table !== 'meta') |
|
| 140 | + and ($action == 'install') |
|
| 141 | + and empty($infos['upgrade']) |
|
| 142 | + ) { |
|
| 143 | + touch_meta(false, $table); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + return $infos; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -159,25 +159,25 @@ discard block |
||
| 159 | 159 | * @return bool|void |
| 160 | 160 | */ |
| 161 | 161 | function spip_plugin_install($action, $infos, $version_cible) { |
| 162 | - $nom_meta = $infos['nom_meta']; |
|
| 163 | - $table = $infos['meta']; |
|
| 164 | - switch ($action) { |
|
| 165 | - case 'test': |
|
| 166 | - return (isset($GLOBALS[$table]) |
|
| 167 | - and isset($GLOBALS[$table][$nom_meta]) |
|
| 168 | - and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
|
| 169 | - break; |
|
| 170 | - case 'install': |
|
| 171 | - if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 172 | - $upgrade($nom_meta, $version_cible, $table); |
|
| 173 | - } |
|
| 174 | - break; |
|
| 175 | - case 'uninstall': |
|
| 176 | - if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 177 | - $vider_tables($nom_meta, $table); |
|
| 178 | - } |
|
| 179 | - break; |
|
| 180 | - } |
|
| 162 | + $nom_meta = $infos['nom_meta']; |
|
| 163 | + $table = $infos['meta']; |
|
| 164 | + switch ($action) { |
|
| 165 | + case 'test': |
|
| 166 | + return (isset($GLOBALS[$table]) |
|
| 167 | + and isset($GLOBALS[$table][$nom_meta]) |
|
| 168 | + and spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>=')); |
|
| 169 | + break; |
|
| 170 | + case 'install': |
|
| 171 | + if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) { |
|
| 172 | + $upgrade($nom_meta, $version_cible, $table); |
|
| 173 | + } |
|
| 174 | + break; |
|
| 175 | + case 'uninstall': |
|
| 176 | + if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) { |
|
| 177 | + $vider_tables($nom_meta, $table); |
|
| 178 | + } |
|
| 179 | + break; |
|
| 180 | + } |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
@@ -196,29 +196,29 @@ discard block |
||
| 196 | 196 | * @return array Tableau des plugins actifs |
| 197 | 197 | **/ |
| 198 | 198 | function liste_plugin_actifs() { |
| 199 | - $liste = $GLOBALS['meta']['plugin'] ?? ''; |
|
| 200 | - if (!$liste) { |
|
| 201 | - return []; |
|
| 202 | - } |
|
| 203 | - if (!is_array($liste = unserialize($liste))) { |
|
| 204 | - // compatibilite pre 1.9.2, mettre a jour la meta |
|
| 205 | - spip_log("MAJ meta plugin vieille version : $liste", 'plugin'); |
|
| 206 | - $new = true; |
|
| 207 | - [, $liste] = liste_plugin_valides(explode(',', $liste)); |
|
| 208 | - } else { |
|
| 209 | - $new = false; |
|
| 210 | - // compat au moment d'une migration depuis version anterieure |
|
| 211 | - // si pas de dir_type, alors c'est _DIR_PLUGINS |
|
| 212 | - foreach ($liste as $prefix => $infos) { |
|
| 213 | - if (!isset($infos['dir_type'])) { |
|
| 214 | - $liste[$prefix]['dir_type'] = '_DIR_PLUGINS'; |
|
| 215 | - $new = true; |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - } |
|
| 219 | - if ($new) { |
|
| 220 | - ecrire_meta('plugin', serialize($liste)); |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - return $liste; |
|
| 199 | + $liste = $GLOBALS['meta']['plugin'] ?? ''; |
|
| 200 | + if (!$liste) { |
|
| 201 | + return []; |
|
| 202 | + } |
|
| 203 | + if (!is_array($liste = unserialize($liste))) { |
|
| 204 | + // compatibilite pre 1.9.2, mettre a jour la meta |
|
| 205 | + spip_log("MAJ meta plugin vieille version : $liste", 'plugin'); |
|
| 206 | + $new = true; |
|
| 207 | + [, $liste] = liste_plugin_valides(explode(',', $liste)); |
|
| 208 | + } else { |
|
| 209 | + $new = false; |
|
| 210 | + // compat au moment d'une migration depuis version anterieure |
|
| 211 | + // si pas de dir_type, alors c'est _DIR_PLUGINS |
|
| 212 | + foreach ($liste as $prefix => $infos) { |
|
| 213 | + if (!isset($infos['dir_type'])) { |
|
| 214 | + $liste[$prefix]['dir_type'] = '_DIR_PLUGINS'; |
|
| 215 | + $new = true; |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | + if ($new) { |
|
| 220 | + ecrire_meta('plugin', serialize($liste)); |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + return $liste; |
|
| 224 | 224 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | if (is_null($p)) { |
| 51 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 51 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent')." : $plug"]]; |
|
| 52 | 52 | $silence = true; |
| 53 | 53 | } else { |
| 54 | 54 | $arbre = $p; |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | if (isset($arbre['etat'])) { |
| 84 | 84 | $etat = trim(end($arbre['etat'])); |
| 85 | 85 | if (!in_array($etat, $etats)) { |
| 86 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 86 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu')." : '$etat'"; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | if (isset($arbre['options'])) { |
| 90 | 90 | foreach ($arbre['options'] as $optfile) { |
| 91 | 91 | $optfile = trim($optfile); |
| 92 | - if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 92 | + if (!@is_readable($dir_plugins."$plug/$optfile")) { |
|
| 93 | 93 | if (!$silence) { |
| 94 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 94 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | if (isset($arbre['fonctions'])) { |
| 100 | 100 | foreach ($arbre['fonctions'] as $optfile) { |
| 101 | 101 | $optfile = trim($optfile); |
| 102 | - if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 102 | + if (!@is_readable($dir_plugins."$plug/$optfile")) { |
|
| 103 | 103 | if (!$silence) { |
| 104 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 104 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile"; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | // verif que la methode a un nom autorise |
| 136 | 136 | if (in_array(strtolower($action), $liste_methodes_reservees)) { |
| 137 | 137 | if (!$silence) { |
| 138 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 138 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit')." : $action"; |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | if (isset($pipe['inclure'])) { |
| 142 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 142 | + $inclure = $dir_plugins."$plug/".$pipe['inclure']; |
|
| 143 | 143 | if (!@is_readable($inclure)) { |
| 144 | 144 | if (!$silence) { |
| 145 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 145 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $inclure"; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | foreach ($arbre['noisette'] as $k => $nut) { |
| 213 | 213 | $nut = preg_replace(',[.]html$,uims', '', trim($nut)); |
| 214 | 214 | $arbre['noisette'][$k] = $nut; |
| 215 | - if (!@is_readable($dir_plugins . "$plug/$nut.html")) { |
|
| 215 | + if (!@is_readable($dir_plugins."$plug/$nut.html")) { |
|
| 216 | 216 | if (!$silence) { |
| 217 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 217 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $nut"; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -11,225 +11,225 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/xml'); |
| 18 | 18 | include_spip('inc/plugin'); |
| 19 | 19 | |
| 20 | 20 | function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) { |
| 21 | - $needs = null; |
|
| 22 | - $compat_spip = null; |
|
| 23 | - $uses = null; |
|
| 24 | - $paths = null; |
|
| 25 | - $trads = null; |
|
| 26 | - static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 21 | + $needs = null; |
|
| 22 | + $compat_spip = null; |
|
| 23 | + $uses = null; |
|
| 24 | + $paths = null; |
|
| 25 | + $trads = null; |
|
| 26 | + static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 27 | 27 | |
| 28 | - $matches = []; |
|
| 29 | - $silence = false; |
|
| 30 | - $p = null; |
|
| 31 | - // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 32 | - if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 33 | - // version de SPIP |
|
| 34 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 35 | - foreach ($matches as $tag => $sous) { |
|
| 36 | - [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 37 | - if ($tagname == 'plugin' and is_array($sous)) { |
|
| 38 | - // On rajoute la condition sur $n : |
|
| 39 | - // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 40 | - // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 41 | - // de la meme facon. |
|
| 42 | - if ( |
|
| 43 | - !isset($atts['spip']) |
|
| 44 | - or $n == 1 |
|
| 45 | - or plugin_version_compatible($atts['spip'], $vspip, 'spip') |
|
| 46 | - ) { |
|
| 47 | - // on prend la derniere declaration avec ce nom |
|
| 48 | - $p = end($sous); |
|
| 49 | - $compat_spip = $atts['spip'] ?? ''; |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - if (is_null($p)) { |
|
| 55 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 56 | - $silence = true; |
|
| 57 | - } else { |
|
| 58 | - $arbre = $p; |
|
| 59 | - } |
|
| 60 | - if (!is_array($arbre)) { |
|
| 61 | - $arbre = []; |
|
| 62 | - } |
|
| 63 | - // verification de la conformite du plugin avec quelques |
|
| 64 | - // precautions elementaires |
|
| 65 | - if (!isset($arbre['nom'])) { |
|
| 66 | - if (!$silence) { |
|
| 67 | - $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 68 | - } |
|
| 69 | - $arbre['nom'] = ['']; |
|
| 70 | - } |
|
| 71 | - if (!isset($arbre['version'])) { |
|
| 72 | - if (!$silence) { |
|
| 73 | - $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 74 | - } |
|
| 75 | - $arbre['version'] = ['']; |
|
| 76 | - } |
|
| 77 | - if (!isset($arbre['prefix'])) { |
|
| 78 | - if (!$silence) { |
|
| 79 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 80 | - } |
|
| 81 | - $arbre['prefix'] = ['']; |
|
| 82 | - } else { |
|
| 83 | - $prefix = trim(end($arbre['prefix'])); |
|
| 84 | - if (strtoupper($prefix) == 'SPIP' and $plug != './') { |
|
| 85 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 86 | - } |
|
| 87 | - if (isset($arbre['etat'])) { |
|
| 88 | - $etat = trim(end($arbre['etat'])); |
|
| 89 | - if (!in_array($etat, $etats)) { |
|
| 90 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - if (isset($arbre['options'])) { |
|
| 94 | - foreach ($arbre['options'] as $optfile) { |
|
| 95 | - $optfile = trim($optfile); |
|
| 96 | - if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 97 | - if (!$silence) { |
|
| 98 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - if (isset($arbre['fonctions'])) { |
|
| 104 | - foreach ($arbre['fonctions'] as $optfile) { |
|
| 105 | - $optfile = trim($optfile); |
|
| 106 | - if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 107 | - if (!$silence) { |
|
| 108 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - $fonctions = []; |
|
| 114 | - if (isset($arbre['fonctions'])) { |
|
| 115 | - $fonctions = $arbre['fonctions']; |
|
| 116 | - } |
|
| 117 | - $liste_methodes_reservees = [ |
|
| 118 | - '__construct', |
|
| 119 | - '__destruct', |
|
| 120 | - 'plugin', |
|
| 121 | - 'install', |
|
| 122 | - 'uninstall', |
|
| 123 | - strtolower($prefix) |
|
| 124 | - ]; |
|
| 28 | + $matches = []; |
|
| 29 | + $silence = false; |
|
| 30 | + $p = null; |
|
| 31 | + // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 32 | + if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 33 | + // version de SPIP |
|
| 34 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 35 | + foreach ($matches as $tag => $sous) { |
|
| 36 | + [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 37 | + if ($tagname == 'plugin' and is_array($sous)) { |
|
| 38 | + // On rajoute la condition sur $n : |
|
| 39 | + // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 40 | + // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 41 | + // de la meme facon. |
|
| 42 | + if ( |
|
| 43 | + !isset($atts['spip']) |
|
| 44 | + or $n == 1 |
|
| 45 | + or plugin_version_compatible($atts['spip'], $vspip, 'spip') |
|
| 46 | + ) { |
|
| 47 | + // on prend la derniere declaration avec ce nom |
|
| 48 | + $p = end($sous); |
|
| 49 | + $compat_spip = $atts['spip'] ?? ''; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + if (is_null($p)) { |
|
| 55 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 56 | + $silence = true; |
|
| 57 | + } else { |
|
| 58 | + $arbre = $p; |
|
| 59 | + } |
|
| 60 | + if (!is_array($arbre)) { |
|
| 61 | + $arbre = []; |
|
| 62 | + } |
|
| 63 | + // verification de la conformite du plugin avec quelques |
|
| 64 | + // precautions elementaires |
|
| 65 | + if (!isset($arbre['nom'])) { |
|
| 66 | + if (!$silence) { |
|
| 67 | + $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 68 | + } |
|
| 69 | + $arbre['nom'] = ['']; |
|
| 70 | + } |
|
| 71 | + if (!isset($arbre['version'])) { |
|
| 72 | + if (!$silence) { |
|
| 73 | + $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 74 | + } |
|
| 75 | + $arbre['version'] = ['']; |
|
| 76 | + } |
|
| 77 | + if (!isset($arbre['prefix'])) { |
|
| 78 | + if (!$silence) { |
|
| 79 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 80 | + } |
|
| 81 | + $arbre['prefix'] = ['']; |
|
| 82 | + } else { |
|
| 83 | + $prefix = trim(end($arbre['prefix'])); |
|
| 84 | + if (strtoupper($prefix) == 'SPIP' and $plug != './') { |
|
| 85 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 86 | + } |
|
| 87 | + if (isset($arbre['etat'])) { |
|
| 88 | + $etat = trim(end($arbre['etat'])); |
|
| 89 | + if (!in_array($etat, $etats)) { |
|
| 90 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + if (isset($arbre['options'])) { |
|
| 94 | + foreach ($arbre['options'] as $optfile) { |
|
| 95 | + $optfile = trim($optfile); |
|
| 96 | + if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 97 | + if (!$silence) { |
|
| 98 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + if (isset($arbre['fonctions'])) { |
|
| 104 | + foreach ($arbre['fonctions'] as $optfile) { |
|
| 105 | + $optfile = trim($optfile); |
|
| 106 | + if (!@is_readable($dir_plugins . "$plug/$optfile")) { |
|
| 107 | + if (!$silence) { |
|
| 108 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + $fonctions = []; |
|
| 114 | + if (isset($arbre['fonctions'])) { |
|
| 115 | + $fonctions = $arbre['fonctions']; |
|
| 116 | + } |
|
| 117 | + $liste_methodes_reservees = [ |
|
| 118 | + '__construct', |
|
| 119 | + '__destruct', |
|
| 120 | + 'plugin', |
|
| 121 | + 'install', |
|
| 122 | + 'uninstall', |
|
| 123 | + strtolower($prefix) |
|
| 124 | + ]; |
|
| 125 | 125 | |
| 126 | - $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 127 | - $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 128 | - foreach ($arbre['pipeline'] as $pipe) { |
|
| 129 | - if (!isset($pipe['nom'])) { |
|
| 130 | - if (!$silence) { |
|
| 131 | - $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - if (isset($pipe['action'])) { |
|
| 135 | - $action = $pipe['action']; |
|
| 136 | - } else { |
|
| 137 | - $action = $pipe['nom']; |
|
| 138 | - } |
|
| 139 | - // verif que la methode a un nom autorise |
|
| 140 | - if (in_array(strtolower($action), $liste_methodes_reservees)) { |
|
| 141 | - if (!$silence) { |
|
| 142 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - if (isset($pipe['inclure'])) { |
|
| 146 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 147 | - if (!@is_readable($inclure)) { |
|
| 148 | - if (!$silence) { |
|
| 149 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - $necessite = []; |
|
| 155 | - $spip_trouve = false; |
|
| 156 | - if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 157 | - foreach (array_keys($needs) as $tag) { |
|
| 158 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 159 | - if (!isset($att['id'])) { |
|
| 160 | - if (!$silence) { |
|
| 161 | - $arbre['erreur'][] = _T( |
|
| 162 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 163 | - ['attribut' => 'id', 'balise' => $att] |
|
| 164 | - ); |
|
| 165 | - } |
|
| 166 | - } else { |
|
| 167 | - $necessite[] = $att; |
|
| 168 | - } |
|
| 169 | - if (strtolower($att['id']) == 'spip') { |
|
| 170 | - $spip_trouve = true; |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - if ($compat_spip and !$spip_trouve) { |
|
| 175 | - $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 176 | - } |
|
| 177 | - $arbre['necessite'] = $necessite; |
|
| 178 | - $utilise = []; |
|
| 179 | - if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 180 | - foreach (array_keys($uses) as $tag) { |
|
| 181 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | - if (!isset($att['id'])) { |
|
| 183 | - if (!$silence) { |
|
| 184 | - $arbre['erreur'][] = _T( |
|
| 185 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 186 | - ['attribut' => 'id', 'balise' => $att] |
|
| 187 | - ); |
|
| 188 | - } |
|
| 189 | - } else { |
|
| 190 | - $utilise[] = $att; |
|
| 191 | - } |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - $arbre['utilise'] = $utilise; |
|
| 195 | - $procure = []; |
|
| 196 | - if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 197 | - foreach (array_keys($uses) as $tag) { |
|
| 198 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 199 | - $procure[] = $att; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - $arbre['procure'] = $procure; |
|
| 203 | - $path = []; |
|
| 204 | - if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 205 | - foreach (array_keys($paths) as $tag) { |
|
| 206 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 207 | - $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 208 | - $path[] = $att; |
|
| 209 | - } |
|
| 210 | - } else { |
|
| 211 | - $path = [['dir' => '']]; |
|
| 212 | - } // initialiser par defaut |
|
| 213 | - $arbre['path'] = $path; |
|
| 214 | - // exposer les noisettes |
|
| 215 | - if (isset($arbre['noisette'])) { |
|
| 216 | - foreach ($arbre['noisette'] as $k => $nut) { |
|
| 217 | - $nut = preg_replace(',[.]html$,uims', '', trim($nut)); |
|
| 218 | - $arbre['noisette'][$k] = $nut; |
|
| 219 | - if (!@is_readable($dir_plugins . "$plug/$nut.html")) { |
|
| 220 | - if (!$silence) { |
|
| 221 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - } |
|
| 225 | - } |
|
| 226 | - $traduire = []; |
|
| 227 | - if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 228 | - foreach (array_keys($trads) as $tag) { |
|
| 229 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 230 | - $traduire[] = $att; |
|
| 231 | - } |
|
| 232 | - } |
|
| 233 | - $arbre['traduire'] = $traduire; |
|
| 234 | - } |
|
| 126 | + $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 127 | + $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 128 | + foreach ($arbre['pipeline'] as $pipe) { |
|
| 129 | + if (!isset($pipe['nom'])) { |
|
| 130 | + if (!$silence) { |
|
| 131 | + $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + if (isset($pipe['action'])) { |
|
| 135 | + $action = $pipe['action']; |
|
| 136 | + } else { |
|
| 137 | + $action = $pipe['nom']; |
|
| 138 | + } |
|
| 139 | + // verif que la methode a un nom autorise |
|
| 140 | + if (in_array(strtolower($action), $liste_methodes_reservees)) { |
|
| 141 | + if (!$silence) { |
|
| 142 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + if (isset($pipe['inclure'])) { |
|
| 146 | + $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 147 | + if (!@is_readable($inclure)) { |
|
| 148 | + if (!$silence) { |
|
| 149 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + $necessite = []; |
|
| 155 | + $spip_trouve = false; |
|
| 156 | + if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 157 | + foreach (array_keys($needs) as $tag) { |
|
| 158 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 159 | + if (!isset($att['id'])) { |
|
| 160 | + if (!$silence) { |
|
| 161 | + $arbre['erreur'][] = _T( |
|
| 162 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 163 | + ['attribut' => 'id', 'balise' => $att] |
|
| 164 | + ); |
|
| 165 | + } |
|
| 166 | + } else { |
|
| 167 | + $necessite[] = $att; |
|
| 168 | + } |
|
| 169 | + if (strtolower($att['id']) == 'spip') { |
|
| 170 | + $spip_trouve = true; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + if ($compat_spip and !$spip_trouve) { |
|
| 175 | + $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 176 | + } |
|
| 177 | + $arbre['necessite'] = $necessite; |
|
| 178 | + $utilise = []; |
|
| 179 | + if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 180 | + foreach (array_keys($uses) as $tag) { |
|
| 181 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | + if (!isset($att['id'])) { |
|
| 183 | + if (!$silence) { |
|
| 184 | + $arbre['erreur'][] = _T( |
|
| 185 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 186 | + ['attribut' => 'id', 'balise' => $att] |
|
| 187 | + ); |
|
| 188 | + } |
|
| 189 | + } else { |
|
| 190 | + $utilise[] = $att; |
|
| 191 | + } |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + $arbre['utilise'] = $utilise; |
|
| 195 | + $procure = []; |
|
| 196 | + if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 197 | + foreach (array_keys($uses) as $tag) { |
|
| 198 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 199 | + $procure[] = $att; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + $arbre['procure'] = $procure; |
|
| 203 | + $path = []; |
|
| 204 | + if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 205 | + foreach (array_keys($paths) as $tag) { |
|
| 206 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 207 | + $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 208 | + $path[] = $att; |
|
| 209 | + } |
|
| 210 | + } else { |
|
| 211 | + $path = [['dir' => '']]; |
|
| 212 | + } // initialiser par defaut |
|
| 213 | + $arbre['path'] = $path; |
|
| 214 | + // exposer les noisettes |
|
| 215 | + if (isset($arbre['noisette'])) { |
|
| 216 | + foreach ($arbre['noisette'] as $k => $nut) { |
|
| 217 | + $nut = preg_replace(',[.]html$,uims', '', trim($nut)); |
|
| 218 | + $arbre['noisette'][$k] = $nut; |
|
| 219 | + if (!@is_readable($dir_plugins . "$plug/$nut.html")) { |
|
| 220 | + if (!$silence) { |
|
| 221 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | + } |
|
| 226 | + $traduire = []; |
|
| 227 | + if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 228 | + foreach (array_keys($trads) as $tag) { |
|
| 229 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 230 | + $traduire[] = $att; |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | + $arbre['traduire'] = $traduire; |
|
| 234 | + } |
|
| 235 | 235 | } |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | $id = substr(md5($plug), 0, 16); |
| 61 | 61 | $res .= $ligne_plug( |
| 62 | 62 | $url_page, |
| 63 | - str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), |
|
| 63 | + str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), |
|
| 64 | 64 | $actif, |
| 65 | 65 | 'menu-entree' |
| 66 | - ) . "\n"; |
|
| 66 | + )."\n"; |
|
| 67 | 67 | unset($liste_plugins[$key]); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | $chemin = ''; |
| 107 | 107 | if (count($tcom)) { |
| 108 | - $chemin .= implode('/', $tcom) . '/'; |
|
| 108 | + $chemin .= implode('/', $tcom).'/'; |
|
| 109 | 109 | } |
| 110 | 110 | // ouvrir les repertoires jusqu'a la cible |
| 111 | 111 | while ($open = array_shift($ttarg)) { |
| 112 | - $visible = @isset($deplie[$chemin . $open]); |
|
| 113 | - $chemin .= $open . '/'; |
|
| 112 | + $visible = @isset($deplie[$chemin.$open]); |
|
| 113 | + $chemin .= $open.'/'; |
|
| 114 | 114 | $output .= '<li>'; |
| 115 | 115 | $output .= bouton_block_depliable($chemin, $visible); |
| 116 | 116 | $output .= debut_block_depliable($visible); |
@@ -11,110 +11,110 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs) { |
| 18 | - $ligne_plug = charger_fonction('afficher_plugin', 'plugins'); |
|
| 19 | - $racine = basename(_DIR_PLUGINS); |
|
| 20 | - $init_dir = $current_dir = ''; |
|
| 21 | - // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
|
| 22 | - // des qu'un path est deja note deplie on s'arrete |
|
| 23 | - $deplie = [$racine => true]; |
|
| 24 | - $fast_liste_plugins_actifs = []; |
|
| 25 | - foreach ($liste_plugins_actifs as $key => $plug) { |
|
| 26 | - $chemin_plug = chemin_plug($racine, $plug); |
|
| 27 | - $fast_liste_plugins_actifs[$chemin_plug] = true; |
|
| 28 | - $dir = dirname($chemin_plug); |
|
| 29 | - $maxiter = 100; |
|
| 30 | - while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) { |
|
| 31 | - $deplie[$dir] = true; |
|
| 32 | - $dir = dirname($dir); |
|
| 33 | - } |
|
| 34 | - } |
|
| 18 | + $ligne_plug = charger_fonction('afficher_plugin', 'plugins'); |
|
| 19 | + $racine = basename(_DIR_PLUGINS); |
|
| 20 | + $init_dir = $current_dir = ''; |
|
| 21 | + // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
|
| 22 | + // des qu'un path est deja note deplie on s'arrete |
|
| 23 | + $deplie = [$racine => true]; |
|
| 24 | + $fast_liste_plugins_actifs = []; |
|
| 25 | + foreach ($liste_plugins_actifs as $key => $plug) { |
|
| 26 | + $chemin_plug = chemin_plug($racine, $plug); |
|
| 27 | + $fast_liste_plugins_actifs[$chemin_plug] = true; |
|
| 28 | + $dir = dirname($chemin_plug); |
|
| 29 | + $maxiter = 100; |
|
| 30 | + while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) { |
|
| 31 | + $deplie[$dir] = true; |
|
| 32 | + $dir = dirname($dir); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - // index repertoires --> plugin |
|
| 37 | - $dir_index = []; |
|
| 38 | - foreach ($liste_plugins as $key => $plug) { |
|
| 39 | - $liste_plugins[$key] = chemin_plug($racine, $plug); |
|
| 40 | - $dir_index[dirname($liste_plugins[$key])][] = $key; |
|
| 41 | - } |
|
| 36 | + // index repertoires --> plugin |
|
| 37 | + $dir_index = []; |
|
| 38 | + foreach ($liste_plugins as $key => $plug) { |
|
| 39 | + $liste_plugins[$key] = chemin_plug($racine, $plug); |
|
| 40 | + $dir_index[dirname($liste_plugins[$key])][] = $key; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $visible = @isset($deplie[$current_dir]); |
|
| 44 | - $maxiter = 1000; |
|
| 43 | + $visible = @isset($deplie[$current_dir]); |
|
| 44 | + $maxiter = 1000; |
|
| 45 | 45 | |
| 46 | - $res = ''; |
|
| 47 | - while ((is_countable($liste_plugins) ? count($liste_plugins) : 0) && $maxiter--) { |
|
| 48 | - // le rep suivant |
|
| 49 | - $dir = dirname(reset($liste_plugins)); |
|
| 50 | - if ($dir != $current_dir) { |
|
| 51 | - $res .= tree_open_close_dir($current_dir, $dir, $deplie); |
|
| 52 | - } |
|
| 46 | + $res = ''; |
|
| 47 | + while ((is_countable($liste_plugins) ? count($liste_plugins) : 0) && $maxiter--) { |
|
| 48 | + // le rep suivant |
|
| 49 | + $dir = dirname(reset($liste_plugins)); |
|
| 50 | + if ($dir != $current_dir) { |
|
| 51 | + $res .= tree_open_close_dir($current_dir, $dir, $deplie); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // d'abord tous les plugins du rep courant |
|
| 55 | - if (isset($dir_index[$current_dir])) { |
|
| 56 | - foreach ($dir_index[$current_dir] as $key) { |
|
| 57 | - $plug = $liste_plugins[$key]; |
|
| 58 | - $actif = @isset($fast_liste_plugins_actifs[$plug]); |
|
| 59 | - $id = substr(md5($plug), 0, 16); |
|
| 60 | - $res .= $ligne_plug( |
|
| 61 | - $url_page, |
|
| 62 | - str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), |
|
| 63 | - $actif, |
|
| 64 | - 'menu-entree' |
|
| 65 | - ) . "\n"; |
|
| 66 | - unset($liste_plugins[$key]); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - $res .= tree_open_close_dir($current_dir, $init_dir, true); |
|
| 54 | + // d'abord tous les plugins du rep courant |
|
| 55 | + if (isset($dir_index[$current_dir])) { |
|
| 56 | + foreach ($dir_index[$current_dir] as $key) { |
|
| 57 | + $plug = $liste_plugins[$key]; |
|
| 58 | + $actif = @isset($fast_liste_plugins_actifs[$plug]); |
|
| 59 | + $id = substr(md5($plug), 0, 16); |
|
| 60 | + $res .= $ligne_plug( |
|
| 61 | + $url_page, |
|
| 62 | + str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), |
|
| 63 | + $actif, |
|
| 64 | + 'menu-entree' |
|
| 65 | + ) . "\n"; |
|
| 66 | + unset($liste_plugins[$key]); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + $res .= tree_open_close_dir($current_dir, $init_dir, true); |
|
| 71 | 71 | |
| 72 | - return "<ul class='menu-liste plugins'>" |
|
| 73 | - . $res |
|
| 74 | - . '</ul>'; |
|
| 72 | + return "<ul class='menu-liste plugins'>" |
|
| 73 | + . $res |
|
| 74 | + . '</ul>'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | // vraiment n'importe quoi la gestion des chemins des plugins |
| 79 | 79 | // une fonction pour aider... |
| 80 | 80 | function chemin_plug($racine, $plug) { |
| 81 | - return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
|
| 81 | + return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | function tree_open_close_dir(&$current, $target, $deplie = []) { |
| 85 | - if ($current == $target) { |
|
| 86 | - return ''; |
|
| 87 | - } |
|
| 88 | - $tcur = explode('/', $current); |
|
| 89 | - $ttarg = explode('/', $target); |
|
| 90 | - $tcom = []; |
|
| 91 | - $output = ''; |
|
| 92 | - // la partie commune |
|
| 93 | - while (reset($tcur) == reset($ttarg)) { |
|
| 94 | - $tcom[] = array_shift($tcur); |
|
| 95 | - array_shift($ttarg); |
|
| 96 | - } |
|
| 97 | - // fermer les repertoires courant jusqu'au point de fork |
|
| 98 | - while ($close = array_pop($tcur)) { |
|
| 99 | - $output .= "</ul>\n"; |
|
| 100 | - $output .= fin_block(); |
|
| 101 | - $output .= "</li>\n"; |
|
| 102 | - } |
|
| 103 | - $chemin = ''; |
|
| 104 | - if (count($tcom)) { |
|
| 105 | - $chemin .= implode('/', $tcom) . '/'; |
|
| 106 | - } |
|
| 107 | - // ouvrir les repertoires jusqu'a la cible |
|
| 108 | - while ($open = array_shift($ttarg)) { |
|
| 109 | - $visible = @isset($deplie[$chemin . $open]); |
|
| 110 | - $chemin .= $open . '/'; |
|
| 111 | - $output .= '<li>'; |
|
| 112 | - $output .= bouton_block_depliable($chemin, $visible); |
|
| 113 | - $output .= debut_block_depliable($visible); |
|
| 85 | + if ($current == $target) { |
|
| 86 | + return ''; |
|
| 87 | + } |
|
| 88 | + $tcur = explode('/', $current); |
|
| 89 | + $ttarg = explode('/', $target); |
|
| 90 | + $tcom = []; |
|
| 91 | + $output = ''; |
|
| 92 | + // la partie commune |
|
| 93 | + while (reset($tcur) == reset($ttarg)) { |
|
| 94 | + $tcom[] = array_shift($tcur); |
|
| 95 | + array_shift($ttarg); |
|
| 96 | + } |
|
| 97 | + // fermer les repertoires courant jusqu'au point de fork |
|
| 98 | + while ($close = array_pop($tcur)) { |
|
| 99 | + $output .= "</ul>\n"; |
|
| 100 | + $output .= fin_block(); |
|
| 101 | + $output .= "</li>\n"; |
|
| 102 | + } |
|
| 103 | + $chemin = ''; |
|
| 104 | + if (count($tcom)) { |
|
| 105 | + $chemin .= implode('/', $tcom) . '/'; |
|
| 106 | + } |
|
| 107 | + // ouvrir les repertoires jusqu'a la cible |
|
| 108 | + while ($open = array_shift($ttarg)) { |
|
| 109 | + $visible = @isset($deplie[$chemin . $open]); |
|
| 110 | + $chemin .= $open . '/'; |
|
| 111 | + $output .= '<li>'; |
|
| 112 | + $output .= bouton_block_depliable($chemin, $visible); |
|
| 113 | + $output .= debut_block_depliable($visible); |
|
| 114 | 114 | |
| 115 | - $output .= "<ul>\n"; |
|
| 116 | - } |
|
| 117 | - $current = $target; |
|
| 115 | + $output .= "<ul>\n"; |
|
| 116 | + } |
|
| 117 | + $current = $target; |
|
| 118 | 118 | |
| 119 | - return $output; |
|
| 119 | + return $output; |
|
| 120 | 120 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @return array |
| 26 | 26 | */ |
| 27 | 27 | function plugins_infos_paquet($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) { |
| 28 | - static $process = [ // tableau constant |
|
| 28 | + static $process = [// tableau constant |
|
| 29 | 29 | 'debut' => 'paquet_debutElement', |
| 30 | 30 | 'fin' => 'paquet_finElement', |
| 31 | 31 | 'text' => 'paquet_textElement' |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | unset($tree['']); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $tree['slogan'] = $tree['prefix'] . '_slogan'; |
|
| 51 | - $tree['description'] = $tree['prefix'] . '_description'; |
|
| 50 | + $tree['slogan'] = $tree['prefix'].'_slogan'; |
|
| 51 | + $tree['description'] = $tree['prefix'].'_description'; |
|
| 52 | 52 | paquet_readable_files($tree, "$dir_plugins$plug/"); |
| 53 | 53 | if (!$tree['chemin']) { |
| 54 | 54 | $tree['chemin'] = []; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Prendre les messages d'erreur sans les numeros de lignes |
| 81 | 81 | $msg = array_column($vxml->err, 0); |
| 82 | 82 | $t = _T('plugins_erreur', ['plugins' => $plug]); |
| 83 | - array_unshift($msg, $t . " <ul class='erreur_xml'><li>" . reset($msg) . '</li></ul>'); |
|
| 83 | + array_unshift($msg, $t." <ul class='erreur_xml'><li>".reset($msg).'</li></ul>'); |
|
| 84 | 84 | |
| 85 | 85 | return ['erreur' => $msg]; |
| 86 | 86 | } |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | function paquet_readable_files(&$tree, $dir) { |
| 97 | 97 | $prefix = strtolower($tree['prefix']); |
| 98 | 98 | |
| 99 | - $tree['options'] = (is_readable($dir . $f = ($prefix . '_options.php'))) ? [$f] : []; |
|
| 100 | - $tree['fonctions'] = (is_readable($dir . $f = ($prefix . '_fonctions.php'))) ? [$f] : []; |
|
| 101 | - $tree['install'] = (is_readable($dir . $f = ($prefix . '_administrations.php'))) ? [$f] : []; |
|
| 99 | + $tree['options'] = (is_readable($dir.$f = ($prefix.'_options.php'))) ? [$f] : []; |
|
| 100 | + $tree['fonctions'] = (is_readable($dir.$f = ($prefix.'_fonctions.php'))) ? [$f] : []; |
|
| 101 | + $tree['install'] = (is_readable($dir.$f = ($prefix.'_administrations.php'))) ? [$f] : []; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $texte = trim($phraseur->versions[$n]['']); |
| 187 | 187 | $phraseur->versions[$n][''] = ''; |
| 188 | 188 | |
| 189 | - $f = 'info_paquet_' . $name; |
|
| 189 | + $f = 'info_paquet_'.$name; |
|
| 190 | 190 | if (function_exists($f)) { |
| 191 | 191 | $f($phraseur, $attrs, $texte); |
| 192 | 192 | } elseif (!$attrs) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -25,64 +25,64 @@ discard block |
||
| 25 | 25 | * @return array |
| 26 | 26 | */ |
| 27 | 27 | function plugins_infos_paquet($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) { |
| 28 | - static $process = [ // tableau constant |
|
| 29 | - 'debut' => 'paquet_debutElement', |
|
| 30 | - 'fin' => 'paquet_finElement', |
|
| 31 | - 'text' => 'paquet_textElement' |
|
| 32 | - ]; |
|
| 33 | - |
|
| 34 | - $valider_xml = charger_fonction('valider', 'xml'); |
|
| 35 | - $vxml = $valider_xml($desc, false, $process, 'paquet.dtd', 'utf-8'); |
|
| 36 | - if (!$vxml->err) { |
|
| 37 | - // On veut toutes les variantes selon la version de SPIP |
|
| 38 | - if (!$plug) { |
|
| 39 | - return $vxml->versions; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - // compatibilite avec l'existant: |
|
| 43 | - $tree = $vxml->versions['0']; |
|
| 44 | - |
|
| 45 | - // l'arbre renvoie parfois un tag vide... etrange. Pas la peine de garder ca. |
|
| 46 | - if (isset($tree['']) and !strlen($tree[''])) { |
|
| 47 | - unset($tree['']); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - $tree['slogan'] = $tree['prefix'] . '_slogan'; |
|
| 51 | - $tree['description'] = $tree['prefix'] . '_description'; |
|
| 52 | - paquet_readable_files($tree, "$dir_plugins$plug/"); |
|
| 53 | - if (!$tree['chemin']) { |
|
| 54 | - $tree['chemin'] = []; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - // On verifie qu'il existe des balises spip qu'il faudrait rajouter dans |
|
| 58 | - // la structure d'infos du paquet en fonction de la version spip courante |
|
| 59 | - if ((is_countable($vxml->versions) ? count($vxml->versions) : 0) > 1) { |
|
| 60 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 61 | - foreach ($vxml->versions as $_compatibilite => $_version) { |
|
| 62 | - if ( |
|
| 63 | - ($_version['balise'] == 'spip') |
|
| 64 | - and (plugin_version_compatible($_compatibilite, $vspip, 'spip')) |
|
| 65 | - ) { |
|
| 66 | - // on merge les sous-balises de la balise spip compatible avec celles de la |
|
| 67 | - // balise paquet |
|
| 68 | - foreach ($_version as $_index => $_balise) { |
|
| 69 | - if ($_index and $_index != 'balise') { |
|
| 70 | - $tree[$_index] = array_merge($tree[$_index], $_balise); |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - return $tree; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // Prendre les messages d'erreur sans les numeros de lignes |
|
| 81 | - $msg = array_column($vxml->err, 0); |
|
| 82 | - $t = _T('plugins_erreur', ['plugins' => $plug]); |
|
| 83 | - array_unshift($msg, $t . " <ul class='erreur_xml'><li>" . reset($msg) . '</li></ul>'); |
|
| 84 | - |
|
| 85 | - return ['erreur' => $msg]; |
|
| 28 | + static $process = [ // tableau constant |
|
| 29 | + 'debut' => 'paquet_debutElement', |
|
| 30 | + 'fin' => 'paquet_finElement', |
|
| 31 | + 'text' => 'paquet_textElement' |
|
| 32 | + ]; |
|
| 33 | + |
|
| 34 | + $valider_xml = charger_fonction('valider', 'xml'); |
|
| 35 | + $vxml = $valider_xml($desc, false, $process, 'paquet.dtd', 'utf-8'); |
|
| 36 | + if (!$vxml->err) { |
|
| 37 | + // On veut toutes les variantes selon la version de SPIP |
|
| 38 | + if (!$plug) { |
|
| 39 | + return $vxml->versions; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + // compatibilite avec l'existant: |
|
| 43 | + $tree = $vxml->versions['0']; |
|
| 44 | + |
|
| 45 | + // l'arbre renvoie parfois un tag vide... etrange. Pas la peine de garder ca. |
|
| 46 | + if (isset($tree['']) and !strlen($tree[''])) { |
|
| 47 | + unset($tree['']); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + $tree['slogan'] = $tree['prefix'] . '_slogan'; |
|
| 51 | + $tree['description'] = $tree['prefix'] . '_description'; |
|
| 52 | + paquet_readable_files($tree, "$dir_plugins$plug/"); |
|
| 53 | + if (!$tree['chemin']) { |
|
| 54 | + $tree['chemin'] = []; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + // On verifie qu'il existe des balises spip qu'il faudrait rajouter dans |
|
| 58 | + // la structure d'infos du paquet en fonction de la version spip courante |
|
| 59 | + if ((is_countable($vxml->versions) ? count($vxml->versions) : 0) > 1) { |
|
| 60 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 61 | + foreach ($vxml->versions as $_compatibilite => $_version) { |
|
| 62 | + if ( |
|
| 63 | + ($_version['balise'] == 'spip') |
|
| 64 | + and (plugin_version_compatible($_compatibilite, $vspip, 'spip')) |
|
| 65 | + ) { |
|
| 66 | + // on merge les sous-balises de la balise spip compatible avec celles de la |
|
| 67 | + // balise paquet |
|
| 68 | + foreach ($_version as $_index => $_balise) { |
|
| 69 | + if ($_index and $_index != 'balise') { |
|
| 70 | + $tree[$_index] = array_merge($tree[$_index], $_balise); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + return $tree; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // Prendre les messages d'erreur sans les numeros de lignes |
|
| 81 | + $msg = array_column($vxml->err, 0); |
|
| 82 | + $t = _T('plugins_erreur', ['plugins' => $plug]); |
|
| 83 | + array_unshift($msg, $t . " <ul class='erreur_xml'><li>" . reset($msg) . '</li></ul>'); |
|
| 84 | + |
|
| 85 | + return ['erreur' => $msg]; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | * @return void |
| 95 | 95 | */ |
| 96 | 96 | function paquet_readable_files(&$tree, $dir) { |
| 97 | - $prefix = strtolower($tree['prefix']); |
|
| 97 | + $prefix = strtolower($tree['prefix']); |
|
| 98 | 98 | |
| 99 | - $tree['options'] = (is_readable($dir . $f = ($prefix . '_options.php'))) ? [$f] : []; |
|
| 100 | - $tree['fonctions'] = (is_readable($dir . $f = ($prefix . '_fonctions.php'))) ? [$f] : []; |
|
| 101 | - $tree['install'] = (is_readable($dir . $f = ($prefix . '_administrations.php'))) ? [$f] : []; |
|
| 99 | + $tree['options'] = (is_readable($dir . $f = ($prefix . '_options.php'))) ? [$f] : []; |
|
| 100 | + $tree['fonctions'] = (is_readable($dir . $f = ($prefix . '_fonctions.php'))) ? [$f] : []; |
|
| 101 | + $tree['install'] = (is_readable($dir . $f = ($prefix . '_administrations.php'))) ? [$f] : []; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -115,35 +115,35 @@ discard block |
||
| 115 | 115 | * @param array $attrs |
| 116 | 116 | */ |
| 117 | 117 | function paquet_debutElement($phraseur, $name, $attrs) { |
| 118 | - xml_debutElement($phraseur, $name, $attrs); |
|
| 119 | - if ($phraseur->err) { |
|
| 120 | - return; |
|
| 121 | - } |
|
| 122 | - if (($name == 'paquet') or ($name == 'spip')) { |
|
| 123 | - if ($name == 'spip') { |
|
| 124 | - $n = $attrs['compatibilite']; |
|
| 125 | - $attrs = []; |
|
| 126 | - } else { |
|
| 127 | - $n = '0'; |
|
| 128 | - $phraseur->contenu['paquet'] = $attrs; |
|
| 129 | - $attrs['menu'] = []; |
|
| 130 | - $attrs['chemin'] = []; |
|
| 131 | - $attrs['necessite'] = []; |
|
| 132 | - $attrs['lib'] = []; |
|
| 133 | - $attrs['onglet'] = []; |
|
| 134 | - $attrs['procure'] = []; |
|
| 135 | - $attrs['pipeline'] = []; |
|
| 136 | - $attrs['utilise'] = []; |
|
| 137 | - $attrs['style'] = []; |
|
| 138 | - $attrs['script'] = []; |
|
| 139 | - $attrs['genie'] = []; |
|
| 140 | - } |
|
| 141 | - $phraseur->contenu['compatible'] = $n; |
|
| 142 | - $phraseur->versions[$phraseur->contenu['compatible']] = $attrs; |
|
| 143 | - } else { |
|
| 144 | - $phraseur->versions[$phraseur->contenu['compatible']][$name][0] = $attrs; |
|
| 145 | - } |
|
| 146 | - $phraseur->versions[$phraseur->contenu['compatible']][''] = ''; |
|
| 118 | + xml_debutElement($phraseur, $name, $attrs); |
|
| 119 | + if ($phraseur->err) { |
|
| 120 | + return; |
|
| 121 | + } |
|
| 122 | + if (($name == 'paquet') or ($name == 'spip')) { |
|
| 123 | + if ($name == 'spip') { |
|
| 124 | + $n = $attrs['compatibilite']; |
|
| 125 | + $attrs = []; |
|
| 126 | + } else { |
|
| 127 | + $n = '0'; |
|
| 128 | + $phraseur->contenu['paquet'] = $attrs; |
|
| 129 | + $attrs['menu'] = []; |
|
| 130 | + $attrs['chemin'] = []; |
|
| 131 | + $attrs['necessite'] = []; |
|
| 132 | + $attrs['lib'] = []; |
|
| 133 | + $attrs['onglet'] = []; |
|
| 134 | + $attrs['procure'] = []; |
|
| 135 | + $attrs['pipeline'] = []; |
|
| 136 | + $attrs['utilise'] = []; |
|
| 137 | + $attrs['style'] = []; |
|
| 138 | + $attrs['script'] = []; |
|
| 139 | + $attrs['genie'] = []; |
|
| 140 | + } |
|
| 141 | + $phraseur->contenu['compatible'] = $n; |
|
| 142 | + $phraseur->versions[$phraseur->contenu['compatible']] = $attrs; |
|
| 143 | + } else { |
|
| 144 | + $phraseur->versions[$phraseur->contenu['compatible']][$name][0] = $attrs; |
|
| 145 | + } |
|
| 146 | + $phraseur->versions[$phraseur->contenu['compatible']][''] = ''; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * @param string $data |
| 156 | 156 | */ |
| 157 | 157 | function paquet_textElement($phraseur, $data) { |
| 158 | - xml_textElement($phraseur, $data); |
|
| 159 | - if ($phraseur->err or !(trim($data))) { |
|
| 160 | - return; |
|
| 161 | - } |
|
| 162 | - $phraseur->versions[$phraseur->contenu['compatible']][''] .= $data; |
|
| 158 | + xml_textElement($phraseur, $data); |
|
| 159 | + if ($phraseur->err or !(trim($data))) { |
|
| 160 | + return; |
|
| 161 | + } |
|
| 162 | + $phraseur->versions[$phraseur->contenu['compatible']][''] .= $data; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -171,32 +171,32 @@ discard block |
||
| 171 | 171 | * @param string $name |
| 172 | 172 | */ |
| 173 | 173 | function paquet_finElement($phraseur, $name) { |
| 174 | - if ($phraseur->err) { |
|
| 175 | - return; |
|
| 176 | - } |
|
| 177 | - $n = $phraseur->contenu['compatible']; |
|
| 178 | - |
|
| 179 | - if (isset($phraseur->versions[$n][$name][0]) and is_array($phraseur->versions[$n][$name][0])) { |
|
| 180 | - $attrs = $phraseur->versions[$n][$name][0]; |
|
| 181 | - unset($phraseur->versions[$n][$name][0]); |
|
| 182 | - } else { |
|
| 183 | - $attrs = []; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - $texte = trim($phraseur->versions[$n]['']); |
|
| 187 | - $phraseur->versions[$n][''] = ''; |
|
| 188 | - |
|
| 189 | - $f = 'info_paquet_' . $name; |
|
| 190 | - if (function_exists($f)) { |
|
| 191 | - $f($phraseur, $attrs, $texte); |
|
| 192 | - } elseif (!$attrs) { |
|
| 193 | - $phraseur->versions[$n][$name] = $texte; |
|
| 194 | - } else { |
|
| 195 | - // Traitement generique. Si $attrs['nom'] n'existe pas, ce n'est pas normal ici |
|
| 196 | - $phraseur->versions[$n][$name][$attrs['nom']] = $attrs; |
|
| 197 | - # echo("<br>pour $name $n " . $attrs['nom']); var_dump($phraseur->versions[$n]); |
|
| 198 | - } |
|
| 199 | - xml_finElement($phraseur, $name, $attrs); |
|
| 174 | + if ($phraseur->err) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 177 | + $n = $phraseur->contenu['compatible']; |
|
| 178 | + |
|
| 179 | + if (isset($phraseur->versions[$n][$name][0]) and is_array($phraseur->versions[$n][$name][0])) { |
|
| 180 | + $attrs = $phraseur->versions[$n][$name][0]; |
|
| 181 | + unset($phraseur->versions[$n][$name][0]); |
|
| 182 | + } else { |
|
| 183 | + $attrs = []; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + $texte = trim($phraseur->versions[$n]['']); |
|
| 187 | + $phraseur->versions[$n][''] = ''; |
|
| 188 | + |
|
| 189 | + $f = 'info_paquet_' . $name; |
|
| 190 | + if (function_exists($f)) { |
|
| 191 | + $f($phraseur, $attrs, $texte); |
|
| 192 | + } elseif (!$attrs) { |
|
| 193 | + $phraseur->versions[$n][$name] = $texte; |
|
| 194 | + } else { |
|
| 195 | + // Traitement generique. Si $attrs['nom'] n'existe pas, ce n'est pas normal ici |
|
| 196 | + $phraseur->versions[$n][$name][$attrs['nom']] = $attrs; |
|
| 197 | + # echo("<br>pour $name $n " . $attrs['nom']); var_dump($phraseur->versions[$n]); |
|
| 198 | + } |
|
| 199 | + xml_finElement($phraseur, $name, $attrs); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | * @param string $texte |
| 209 | 209 | */ |
| 210 | 210 | function info_paquet_licence($phraseur, $attrs, $texte) { |
| 211 | - if (isset($attrs['lien'])) { |
|
| 212 | - $lien = $attrs['lien']; |
|
| 213 | - } else { |
|
| 214 | - $lien = ''; |
|
| 215 | - } |
|
| 216 | - $n = $phraseur->contenu['compatible']; |
|
| 217 | - $phraseur->versions[$n]['licence'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 211 | + if (isset($attrs['lien'])) { |
|
| 212 | + $lien = $attrs['lien']; |
|
| 213 | + } else { |
|
| 214 | + $lien = ''; |
|
| 215 | + } |
|
| 216 | + $n = $phraseur->contenu['compatible']; |
|
| 217 | + $phraseur->versions[$n]['licence'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | * @param string $texte |
| 227 | 227 | */ |
| 228 | 228 | function info_paquet_chemin($phraseur, $attrs, $texte) { |
| 229 | - $n = $phraseur->contenu['compatible']; |
|
| 230 | - if (isset($attrs['path'])) { |
|
| 231 | - if (isset($attrs['type'])) { |
|
| 232 | - $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path'], 'type' => $attrs['type']]; |
|
| 233 | - } else { |
|
| 234 | - $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path']]; |
|
| 235 | - } |
|
| 236 | - } |
|
| 229 | + $n = $phraseur->contenu['compatible']; |
|
| 230 | + if (isset($attrs['path'])) { |
|
| 231 | + if (isset($attrs['type'])) { |
|
| 232 | + $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path'], 'type' => $attrs['type']]; |
|
| 233 | + } else { |
|
| 234 | + $phraseur->versions[$n]['chemin'][] = ['path' => $attrs['path']]; |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -247,24 +247,24 @@ discard block |
||
| 247 | 247 | * @param string $texte |
| 248 | 248 | */ |
| 249 | 249 | function info_paquet_auteur($phraseur, $attrs, $texte) { |
| 250 | - # echo 'auteur ', $texte; var_dump($attrs); |
|
| 251 | - if (isset($attrs['mail'])) { |
|
| 252 | - if (strpos($attrs['mail'], '@')) { |
|
| 253 | - $attrs['mail'] = str_replace('@', ' AT ', $attrs['mail']); |
|
| 254 | - } |
|
| 255 | - $mail = $attrs['mail']; |
|
| 256 | - } else { |
|
| 257 | - $mail = ''; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - if (isset($attrs['lien'])) { |
|
| 261 | - $lien = $attrs['lien']; |
|
| 262 | - } else { |
|
| 263 | - $lien = ''; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - $n = $phraseur->contenu['compatible']; |
|
| 267 | - $phraseur->versions[$n]['auteur'][] = ['nom' => $texte, 'url' => $lien, 'mail' => $mail]; |
|
| 250 | + # echo 'auteur ', $texte; var_dump($attrs); |
|
| 251 | + if (isset($attrs['mail'])) { |
|
| 252 | + if (strpos($attrs['mail'], '@')) { |
|
| 253 | + $attrs['mail'] = str_replace('@', ' AT ', $attrs['mail']); |
|
| 254 | + } |
|
| 255 | + $mail = $attrs['mail']; |
|
| 256 | + } else { |
|
| 257 | + $mail = ''; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + if (isset($attrs['lien'])) { |
|
| 261 | + $lien = $attrs['lien']; |
|
| 262 | + } else { |
|
| 263 | + $lien = ''; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + $n = $phraseur->contenu['compatible']; |
|
| 267 | + $phraseur->versions[$n]['auteur'][] = ['nom' => $texte, 'url' => $lien, 'mail' => $mail]; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | function info_paquet_credit($phraseur, $attrs, $texte) { |
| 279 | 279 | |
| 280 | - if (isset($attrs['lien'])) { |
|
| 281 | - $lien = $attrs['lien']; |
|
| 282 | - } else { |
|
| 283 | - $lien = ''; |
|
| 284 | - } |
|
| 280 | + if (isset($attrs['lien'])) { |
|
| 281 | + $lien = $attrs['lien']; |
|
| 282 | + } else { |
|
| 283 | + $lien = ''; |
|
| 284 | + } |
|
| 285 | 285 | |
| 286 | - $n = $phraseur->contenu['compatible']; |
|
| 287 | - $phraseur->versions[$n]['credit'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 286 | + $n = $phraseur->contenu['compatible']; |
|
| 287 | + $phraseur->versions[$n]['credit'][] = ['nom' => $texte, 'url' => $lien]; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | * @param string $texte |
| 297 | 297 | */ |
| 298 | 298 | function info_paquet_copyright($phraseur, $attrs, $texte) { |
| 299 | - $n = $phraseur->contenu['compatible']; |
|
| 300 | - $phraseur->versions[$n]['copyright'][] = $texte; |
|
| 299 | + $n = $phraseur->contenu['compatible']; |
|
| 300 | + $phraseur->versions[$n]['copyright'][] = $texte; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | * @param string $texte |
| 310 | 310 | */ |
| 311 | 311 | function info_paquet_paquet($phraseur, $attrs, $texte) { |
| 312 | - $n = 0; |
|
| 313 | - $phraseur->versions[$n]['dtd'] = 'paquet'; |
|
| 314 | - $phraseur->versions[$n]['balise'] = 'paquet'; |
|
| 312 | + $n = 0; |
|
| 313 | + $phraseur->versions[$n]['dtd'] = 'paquet'; |
|
| 314 | + $phraseur->versions[$n]['balise'] = 'paquet'; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | * @param string $texte |
| 324 | 324 | **/ |
| 325 | 325 | function info_paquet_traduire($phraseur, $attrs, $texte) { |
| 326 | - $n = $phraseur->contenu['compatible']; |
|
| 327 | - $phraseur->versions[$n]['traduire'][] = $attrs; |
|
| 326 | + $n = $phraseur->contenu['compatible']; |
|
| 327 | + $phraseur->versions[$n]['traduire'][] = $attrs; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | * @param string $texte |
| 337 | 337 | */ |
| 338 | 338 | function info_paquet_spip($phraseur, $attrs, $texte) { |
| 339 | - $n = $phraseur->contenu['compatible']; |
|
| 340 | - $phraseur->versions[$n]['balise'] = 'spip'; |
|
| 339 | + $n = $phraseur->contenu['compatible']; |
|
| 340 | + $phraseur->versions[$n]['balise'] = 'spip'; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | * @param string $texte |
| 350 | 350 | */ |
| 351 | 351 | function info_paquet_pipeline($phraseur, $attrs, $texte) { |
| 352 | - $n = $phraseur->contenu['compatible']; |
|
| 353 | - $phraseur->versions[$n]['pipeline'][] = $attrs; |
|
| 352 | + $n = $phraseur->contenu['compatible']; |
|
| 353 | + $phraseur->versions[$n]['pipeline'][] = $attrs; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
@@ -363,23 +363,23 @@ discard block |
||
| 363 | 363 | * @param string $texte |
| 364 | 364 | */ |
| 365 | 365 | function info_paquet_style($phraseur, $attrs, $texte) { |
| 366 | - $lien = $chemin = $type = $media = ''; |
|
| 367 | - |
|
| 368 | - include_spip('inc/utils'); |
|
| 369 | - if (tester_url_absolue($attrs['source'])) { |
|
| 370 | - $lien = $attrs['source']; |
|
| 371 | - } else { |
|
| 372 | - $chemin = $attrs['source']; |
|
| 373 | - } |
|
| 374 | - if (isset($attrs['type'])) { |
|
| 375 | - $type = $attrs['type']; |
|
| 376 | - } |
|
| 377 | - if (isset($attrs['media'])) { |
|
| 378 | - $media = $attrs['media']; |
|
| 379 | - } |
|
| 380 | - |
|
| 381 | - $n = $phraseur->contenu['compatible']; |
|
| 382 | - $phraseur->versions[$n]['style'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type, 'media' => $media]; |
|
| 366 | + $lien = $chemin = $type = $media = ''; |
|
| 367 | + |
|
| 368 | + include_spip('inc/utils'); |
|
| 369 | + if (tester_url_absolue($attrs['source'])) { |
|
| 370 | + $lien = $attrs['source']; |
|
| 371 | + } else { |
|
| 372 | + $chemin = $attrs['source']; |
|
| 373 | + } |
|
| 374 | + if (isset($attrs['type'])) { |
|
| 375 | + $type = $attrs['type']; |
|
| 376 | + } |
|
| 377 | + if (isset($attrs['media'])) { |
|
| 378 | + $media = $attrs['media']; |
|
| 379 | + } |
|
| 380 | + |
|
| 381 | + $n = $phraseur->contenu['compatible']; |
|
| 382 | + $phraseur->versions[$n]['style'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type, 'media' => $media]; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
@@ -392,20 +392,20 @@ discard block |
||
| 392 | 392 | * @param string $texte |
| 393 | 393 | */ |
| 394 | 394 | function info_paquet_script($phraseur, $attrs, $texte) { |
| 395 | - $lien = $chemin = $type = $media = ''; |
|
| 396 | - |
|
| 397 | - include_spip('inc/utils'); |
|
| 398 | - if (tester_url_absolue($attrs['source'])) { |
|
| 399 | - $lien = $attrs['source']; |
|
| 400 | - } else { |
|
| 401 | - $chemin = $attrs['source']; |
|
| 402 | - } |
|
| 403 | - if (isset($attrs['type'])) { |
|
| 404 | - $type = $attrs['type']; |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - $n = $phraseur->contenu['compatible']; |
|
| 408 | - $phraseur->versions[$n]['script'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type]; |
|
| 395 | + $lien = $chemin = $type = $media = ''; |
|
| 396 | + |
|
| 397 | + include_spip('inc/utils'); |
|
| 398 | + if (tester_url_absolue($attrs['source'])) { |
|
| 399 | + $lien = $attrs['source']; |
|
| 400 | + } else { |
|
| 401 | + $chemin = $attrs['source']; |
|
| 402 | + } |
|
| 403 | + if (isset($attrs['type'])) { |
|
| 404 | + $type = $attrs['type']; |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + $n = $phraseur->contenu['compatible']; |
|
| 408 | + $phraseur->versions[$n]['script'][] = ['url' => $lien, 'path' => $chemin, 'type' => $type]; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -416,6 +416,6 @@ discard block |
||
| 416 | 416 | * @param string $texte |
| 417 | 417 | */ |
| 418 | 418 | function info_paquet_genie($phraseur, $attrs, $texte) { |
| 419 | - $n = $phraseur->contenu['compatible']; |
|
| 420 | - $phraseur->versions[$n]['genie'][] = $attrs; |
|
| 419 | + $n = $phraseur->contenu['compatible']; |
|
| 420 | + $phraseur->versions[$n]['genie'][] = $attrs; |
|
| 421 | 421 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // numerotons les occurences d'un meme prefix |
| 40 | 40 | $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
| 41 | - $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 41 | + $id = $info['prefix'].$versions[$info['prefix']]; |
|
| 42 | 42 | |
| 43 | 43 | $class = $class_li; |
| 44 | 44 | $class .= $actif ? ' actif' : ''; |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | $prefix = $info['prefix']; |
| 56 | 56 | $dir = "$dir_plugins$plug_file/lang/$prefix"; |
| 57 | 57 | $desc = plugin_propre($info['description'], $dir); |
| 58 | - $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 58 | + $url_stat = parametre_url($url_page, 'plugin', $dir_plugins.$plug_file); |
|
| 59 | 59 | |
| 60 | - $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 61 | - $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 62 | - $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 60 | + $s .= "<strong class='nom'>".typo($info['nom']).'</strong>'; |
|
| 61 | + $s .= " <span class='version'>".$info['version'].'</span>'; |
|
| 62 | + $s .= " <span class='etat'> - ".plugin_etat_en_clair($info['etat']).'</span>'; |
|
| 63 | 63 | $s .= '</div>'; |
| 64 | 64 | |
| 65 | 65 | if ($erreur) { |
| 66 | - $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 66 | + $s .= "<div class='erreur'>".join('<br >', $info['erreur']).'</div>'; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $s .= '</li>'; |
@@ -11,61 +11,61 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/charsets'); |
| 17 | 17 | include_spip('inc/texte'); |
| 18 | 18 | include_spip('plugins/afficher_plugin'); |
| 19 | 19 | |
| 20 | 20 | function plugins_afficher_nom_plugin_dist( |
| 21 | - $url_page, |
|
| 22 | - $plug_file, |
|
| 23 | - $checked, |
|
| 24 | - $actif, |
|
| 25 | - $expose = false, |
|
| 26 | - $class_li = 'item', |
|
| 27 | - $dir_plugins = _DIR_PLUGINS |
|
| 21 | + $url_page, |
|
| 22 | + $plug_file, |
|
| 23 | + $checked, |
|
| 24 | + $actif, |
|
| 25 | + $expose = false, |
|
| 26 | + $class_li = 'item', |
|
| 27 | + $dir_plugins = _DIR_PLUGINS |
|
| 28 | 28 | ) { |
| 29 | - static $id_input = 0; |
|
| 30 | - static $versions = []; |
|
| 29 | + static $id_input = 0; |
|
| 30 | + static $versions = []; |
|
| 31 | 31 | |
| 32 | - $erreur = false; |
|
| 33 | - $s = ''; |
|
| 32 | + $erreur = false; |
|
| 33 | + $s = ''; |
|
| 34 | 34 | |
| 35 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 36 | - $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 35 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 36 | + $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 37 | 37 | |
| 38 | - // numerotons les occurences d'un meme prefix |
|
| 39 | - $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 40 | - $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 38 | + // numerotons les occurences d'un meme prefix |
|
| 39 | + $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 40 | + $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 41 | 41 | |
| 42 | - $class = $class_li; |
|
| 43 | - $class .= $actif ? ' actif' : ''; |
|
| 44 | - $class .= $expose ? ' on' : ''; |
|
| 45 | - $erreur = isset($info['erreur']); |
|
| 46 | - if ($erreur) { |
|
| 47 | - $class .= ' error'; |
|
| 48 | - } |
|
| 49 | - $s .= "<li id='$id' class='$class'>"; |
|
| 42 | + $class = $class_li; |
|
| 43 | + $class .= $actif ? ' actif' : ''; |
|
| 44 | + $class .= $expose ? ' on' : ''; |
|
| 45 | + $erreur = isset($info['erreur']); |
|
| 46 | + if ($erreur) { |
|
| 47 | + $class .= ' error'; |
|
| 48 | + } |
|
| 49 | + $s .= "<li id='$id' class='$class'>"; |
|
| 50 | 50 | |
| 51 | - // Cartouche Resume |
|
| 52 | - $s .= "<div class='resume'>"; |
|
| 51 | + // Cartouche Resume |
|
| 52 | + $s .= "<div class='resume'>"; |
|
| 53 | 53 | |
| 54 | - $prefix = $info['prefix']; |
|
| 55 | - $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 56 | - $desc = plugin_propre($info['description'], $dir); |
|
| 57 | - $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 54 | + $prefix = $info['prefix']; |
|
| 55 | + $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 56 | + $desc = plugin_propre($info['description'], $dir); |
|
| 57 | + $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 58 | 58 | |
| 59 | - $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 60 | - $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 61 | - $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 62 | - $s .= '</div>'; |
|
| 59 | + $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 60 | + $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 61 | + $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 62 | + $s .= '</div>'; |
|
| 63 | 63 | |
| 64 | - if ($erreur) { |
|
| 65 | - $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 66 | - } |
|
| 64 | + if ($erreur) { |
|
| 65 | + $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $s .= '</li>'; |
|
| 68 | + $s .= '</li>'; |
|
| 69 | 69 | |
| 70 | - return $s; |
|
| 70 | + return $s; |
|
| 71 | 71 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | static $filecache = ''; |
| 38 | 38 | |
| 39 | 39 | if ($cache === '') { |
| 40 | - $filecache = _DIR_TMP . 'plugin_xml_cache.gz'; |
|
| 40 | + $filecache = _DIR_TMP.'plugin_xml_cache.gz'; |
|
| 41 | 41 | if (is_file($filecache)) { |
| 42 | 42 | lire_fichier($filecache, $contenu); |
| 43 | 43 | $cache = unserialize($contenu); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if (isset($ret['prefix']) and $ret['prefix'] == 'spip') { |
| 129 | 129 | $ret['procure']['php'] = ['nom' => 'php', 'version' => phpversion()]; |
| 130 | 130 | foreach (get_loaded_extensions() as $ext) { |
| 131 | - $ret['procure']['php:' . $ext] = ['nom' => 'php:' . $ext, 'version' => phpversion($ext)]; |
|
| 131 | + $ret['procure']['php:'.$ext] = ['nom' => 'php:'.$ext, 'version' => phpversion($ext)]; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | $diff = ($ret != $pcache); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -33,110 +33,110 @@ discard block |
||
| 33 | 33 | * @return array |
| 34 | 34 | */ |
| 35 | 35 | function plugins_get_infos_dist($plug = false, $reload = false, $dir = _DIR_PLUGINS, $clean_old = false) { |
| 36 | - $contenu = null; |
|
| 37 | - $res = null; |
|
| 38 | - static $cache = ''; |
|
| 39 | - static $filecache = ''; |
|
| 40 | - |
|
| 41 | - if ($cache === '') { |
|
| 42 | - $filecache = _DIR_TMP . 'plugin_xml_cache.gz'; |
|
| 43 | - if (is_file($filecache)) { |
|
| 44 | - lire_fichier($filecache, $contenu); |
|
| 45 | - $cache = unserialize($contenu); |
|
| 46 | - } |
|
| 47 | - if (!is_array($cache)) { |
|
| 48 | - $cache = []; |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - if (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') { |
|
| 53 | - $reload = true; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - if ($plug === false) { |
|
| 57 | - ecrire_fichier($filecache, serialize($cache)); |
|
| 58 | - |
|
| 59 | - return $cache; |
|
| 60 | - } elseif (is_string($plug)) { |
|
| 61 | - $res = plugins_get_infos_un($plug, $reload, $dir, $cache); |
|
| 62 | - } elseif (is_array($plug)) { |
|
| 63 | - $res = false; |
|
| 64 | - if (!$reload) { |
|
| 65 | - $reload = -1; |
|
| 66 | - } |
|
| 67 | - foreach ($plug as $nom) { |
|
| 68 | - $res |= plugins_get_infos_un($nom, $reload, $dir, $cache); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // Nettoyer le cache des vieux plugins qui ne sont plus la |
|
| 72 | - if ($clean_old and isset($cache[$dir]) and is_countable($cache[$dir]) ? count($cache[$dir]) : 0) { |
|
| 73 | - foreach (array_keys($cache[$dir]) as $p) { |
|
| 74 | - if (!in_array($p, $plug)) { |
|
| 75 | - unset($cache[$dir][$p]); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - if ($res) { |
|
| 81 | - ecrire_fichier($filecache, serialize($cache)); |
|
| 82 | - } |
|
| 83 | - if (!isset($cache[$dir])) { |
|
| 84 | - return []; |
|
| 85 | - } |
|
| 86 | - if (is_string($plug)) { |
|
| 87 | - return $cache[$dir][$plug] ?? []; |
|
| 88 | - } else { |
|
| 89 | - return $cache[$dir]; |
|
| 90 | - } |
|
| 36 | + $contenu = null; |
|
| 37 | + $res = null; |
|
| 38 | + static $cache = ''; |
|
| 39 | + static $filecache = ''; |
|
| 40 | + |
|
| 41 | + if ($cache === '') { |
|
| 42 | + $filecache = _DIR_TMP . 'plugin_xml_cache.gz'; |
|
| 43 | + if (is_file($filecache)) { |
|
| 44 | + lire_fichier($filecache, $contenu); |
|
| 45 | + $cache = unserialize($contenu); |
|
| 46 | + } |
|
| 47 | + if (!is_array($cache)) { |
|
| 48 | + $cache = []; |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + if (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') { |
|
| 53 | + $reload = true; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + if ($plug === false) { |
|
| 57 | + ecrire_fichier($filecache, serialize($cache)); |
|
| 58 | + |
|
| 59 | + return $cache; |
|
| 60 | + } elseif (is_string($plug)) { |
|
| 61 | + $res = plugins_get_infos_un($plug, $reload, $dir, $cache); |
|
| 62 | + } elseif (is_array($plug)) { |
|
| 63 | + $res = false; |
|
| 64 | + if (!$reload) { |
|
| 65 | + $reload = -1; |
|
| 66 | + } |
|
| 67 | + foreach ($plug as $nom) { |
|
| 68 | + $res |= plugins_get_infos_un($nom, $reload, $dir, $cache); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // Nettoyer le cache des vieux plugins qui ne sont plus la |
|
| 72 | + if ($clean_old and isset($cache[$dir]) and is_countable($cache[$dir]) ? count($cache[$dir]) : 0) { |
|
| 73 | + foreach (array_keys($cache[$dir]) as $p) { |
|
| 74 | + if (!in_array($p, $plug)) { |
|
| 75 | + unset($cache[$dir][$p]); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + if ($res) { |
|
| 81 | + ecrire_fichier($filecache, serialize($cache)); |
|
| 82 | + } |
|
| 83 | + if (!isset($cache[$dir])) { |
|
| 84 | + return []; |
|
| 85 | + } |
|
| 86 | + if (is_string($plug)) { |
|
| 87 | + return $cache[$dir][$plug] ?? []; |
|
| 88 | + } else { |
|
| 89 | + return $cache[$dir]; |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | function plugins_get_infos_un($plug, $reload, $dir, &$cache) { |
| 95 | - if (!is_readable($file = "$dir$plug/paquet.xml")) { |
|
| 96 | - return false; |
|
| 97 | - } |
|
| 98 | - $time = intval(@filemtime($file)); |
|
| 99 | - if ($time < 0) { |
|
| 100 | - return false; |
|
| 101 | - } |
|
| 102 | - $md5 = md5_file($file); |
|
| 103 | - |
|
| 104 | - $pcache = $cache[$dir][$plug] ?? ['filemtime' => 0, 'md5_file' => '']; |
|
| 105 | - |
|
| 106 | - // si le cache est valide |
|
| 107 | - if ( |
|
| 108 | - (intval($reload) <= 0) |
|
| 109 | - and ($time > 0) |
|
| 110 | - and ($time <= $pcache['filemtime']) |
|
| 111 | - and $md5 == $pcache['md5_file'] |
|
| 112 | - ) { |
|
| 113 | - return false; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // si on arrive pas a lire le fichier, se contenter du cache |
|
| 117 | - if (!($texte = spip_file_get_contents($file))) { |
|
| 118 | - return false; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - $f = charger_fonction('infos_paquet', 'plugins'); |
|
| 122 | - $ret = $f($texte, $plug, $dir); |
|
| 123 | - $ret['filemtime'] = $time; |
|
| 124 | - $ret['md5_file'] = $md5; |
|
| 125 | - // Si on lit le paquet.xml de SPIP, on rajoute un procure php afin que les plugins puissent |
|
| 126 | - // utiliser un necessite php. SPIP procure donc la version php courante du serveur. |
|
| 127 | - // chaque librairie php est aussi procurée, par exemple 'php:curl'. |
|
| 128 | - if (isset($ret['prefix']) and $ret['prefix'] == 'spip') { |
|
| 129 | - $ret['procure']['php'] = ['nom' => 'php', 'version' => phpversion()]; |
|
| 130 | - foreach (get_loaded_extensions() as $ext) { |
|
| 131 | - $ret['procure']['php:' . $ext] = ['nom' => 'php:' . $ext, 'version' => phpversion($ext)]; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - $diff = ($ret != $pcache); |
|
| 135 | - |
|
| 136 | - if ($diff) { |
|
| 137 | - $cache[$dir][$plug] = $ret; |
|
| 95 | + if (!is_readable($file = "$dir$plug/paquet.xml")) { |
|
| 96 | + return false; |
|
| 97 | + } |
|
| 98 | + $time = intval(@filemtime($file)); |
|
| 99 | + if ($time < 0) { |
|
| 100 | + return false; |
|
| 101 | + } |
|
| 102 | + $md5 = md5_file($file); |
|
| 103 | + |
|
| 104 | + $pcache = $cache[$dir][$plug] ?? ['filemtime' => 0, 'md5_file' => '']; |
|
| 105 | + |
|
| 106 | + // si le cache est valide |
|
| 107 | + if ( |
|
| 108 | + (intval($reload) <= 0) |
|
| 109 | + and ($time > 0) |
|
| 110 | + and ($time <= $pcache['filemtime']) |
|
| 111 | + and $md5 == $pcache['md5_file'] |
|
| 112 | + ) { |
|
| 113 | + return false; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // si on arrive pas a lire le fichier, se contenter du cache |
|
| 117 | + if (!($texte = spip_file_get_contents($file))) { |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + $f = charger_fonction('infos_paquet', 'plugins'); |
|
| 122 | + $ret = $f($texte, $plug, $dir); |
|
| 123 | + $ret['filemtime'] = $time; |
|
| 124 | + $ret['md5_file'] = $md5; |
|
| 125 | + // Si on lit le paquet.xml de SPIP, on rajoute un procure php afin que les plugins puissent |
|
| 126 | + // utiliser un necessite php. SPIP procure donc la version php courante du serveur. |
|
| 127 | + // chaque librairie php est aussi procurée, par exemple 'php:curl'. |
|
| 128 | + if (isset($ret['prefix']) and $ret['prefix'] == 'spip') { |
|
| 129 | + $ret['procure']['php'] = ['nom' => 'php', 'version' => phpversion()]; |
|
| 130 | + foreach (get_loaded_extensions() as $ext) { |
|
| 131 | + $ret['procure']['php:' . $ext] = ['nom' => 'php:' . $ext, 'version' => phpversion($ext)]; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + $diff = ($ret != $pcache); |
|
| 135 | + |
|
| 136 | + if ($diff) { |
|
| 137 | + $cache[$dir][$plug] = $ret; |
|
| 138 | 138 | # echo count($cache[$dir]), $dir,$plug, " $reloadc<br>"; |
| 139 | - } |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - return $diff; |
|
| 141 | + return $diff; |
|
| 142 | 142 | } |
@@ -4,123 +4,123 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Portada del sitio', |
|
| 14 | - 'article' => 'Artículo', |
|
| 15 | - 'articles' => 'Artículos', |
|
| 16 | - 'articles_auteur' => 'Artículos de esta autora o autor', |
|
| 17 | - 'articles_populaires' => 'Los artículos más populares', |
|
| 18 | - 'articles_rubrique' => 'Artículos de esta sección', |
|
| 19 | - 'aucun_article' => 'No hay ningún artículo en esta dirección ', |
|
| 20 | - 'aucun_auteur' => 'No hay autor ni autora en esta dirección ', |
|
| 21 | - 'aucun_site' => 'No hay ningún sitio en esta dirección', |
|
| 22 | - 'aucune_breve' => 'No hay ninguna breve en esta dirección', |
|
| 23 | - 'aucune_rubrique' => 'No hay ninguna sección en esta dirección', |
|
| 24 | - 'auteur' => 'Autor o autora', |
|
| 25 | - 'autres' => 'Otros', |
|
| 26 | - 'autres_breves' => 'Otros breves', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Otros grupos de palabras clave', |
|
| 28 | - 'autres_sites' => 'Otros sitios', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Hola', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Comentar este sitio', |
|
| 35 | - 'contact' => 'Contacto', |
|
| 36 | - 'copie_document_impossible' => 'Imposible copiar el documento', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Fecha', |
|
| 40 | - 'dernier_ajout' => 'Última actualización', |
|
| 41 | - 'dernieres_breves' => 'Últimos breves', |
|
| 42 | - 'derniers_articles' => 'Últimos artículos', |
|
| 43 | - 'derniers_commentaires' => 'Últimos comentarios', |
|
| 44 | - 'derniers_messages_forum' => 'Últimos mensajes publicados en los foros', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Edición en modo texto de', |
|
| 48 | - 'en_reponse' => 'En respuesta a:', |
|
| 49 | - 'en_resume' => 'En resumen', |
|
| 50 | - 'envoyer_message' => 'Enviar un mensaje', |
|
| 51 | - 'espace_prive' => 'Espacio privado', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Formatos aceptados: @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Jerarquía del sitio', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'días', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Conectarse', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'Del mismo autor', |
|
| 67 | - 'meme_rubrique' => 'En la misma sección', |
|
| 68 | - 'memes_auteurs' => 'De los mismos autores', |
|
| 69 | - 'message' => 'Mensaje', |
|
| 70 | - 'messages_forum' => 'Mensajes', |
|
| 71 | - 'messages_recents' => 'Los mensajes más recientes del foro', |
|
| 72 | - 'mots_clef' => 'Palabra clave', |
|
| 73 | - 'mots_clefs' => 'Palabras clave', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Palabras claves en el mismo grupo', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navegación', |
|
| 78 | - 'nom' => 'Nombre', |
|
| 79 | - 'nouveautes' => 'Las novedades', |
|
| 80 | - 'nouveautes_web' => 'Novedades en la web', |
|
| 81 | - 'nouveaux_articles' => 'Nuevos artículos', |
|
| 82 | - 'nouvelles_breves' => 'Nuevas breves', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'Página anterior', |
|
| 86 | - 'page_suivante' => 'Página siguiente', |
|
| 87 | - 'par_auteur' => 'por ', |
|
| 88 | - 'participer_site' => 'Puedes participar en la vida de este sitio y proponer artículos inscribiéndote aqui. De inmediato recibirás un correo electrónico con tus claves de acceso al espacio privado del sitio.', |
|
| 89 | - 'plan_site' => 'Mapa del sitio', |
|
| 90 | - 'popularite' => 'Popularidad', |
|
| 91 | - 'poster_message' => 'Publicar un mensaje', |
|
| 92 | - 'proposer_site' => 'Proponga un sitio para añadir en esta sección:', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'Comentar este artículo', |
|
| 96 | - 'repondre_breve' => 'Comentar esta breve', |
|
| 97 | - 'resultats_recherche' => 'Resultados de la búsqueda', |
|
| 98 | - 'retour_debut_forums' => 'Volver al inicio del foro', |
|
| 99 | - 'rss_abonnement' => 'Copie la siguiente URL en su agregador:', |
|
| 100 | - 'rss_abonnement_titre' => 'Suscribirse', |
|
| 101 | - 'rss_abonnement_titre_page' => 'Suscribirse a', |
|
| 102 | - 'rss_explication' => 'Un feed RSS recoge información actualizada de un sitio. Proporciona el contenido de las entradas, comentarios o un extracto de los mismos, así como un enlace a las versiones completas y alguna otra información. Este feed está pensado para ser leído por un agregador RSS.', |
|
| 103 | - 'rss_explication_titre' => '¿Qué es un feed RSS?', |
|
| 104 | - 'rubrique' => 'Sección', |
|
| 105 | - 'rubriques' => 'Secciones', |
|
| 106 | - |
|
| 107 | - // S |
|
| 108 | - 'signatures_petition' => 'Firmas', |
|
| 109 | - 'site_realise_avec_spip' => 'Sitio desarrollado con SPIP', |
|
| 110 | - 'sites_web' => 'Sitios Web', |
|
| 111 | - 'sous_rubriques' => 'Subsección', |
|
| 112 | - 'spam' => 'Spam', |
|
| 113 | - 'suite' => 'continuar', |
|
| 114 | - 'sur_web' => 'Del web', |
|
| 115 | - 'syndiquer_rubrique' => 'Sindicar esta sección', |
|
| 116 | - 'syndiquer_site' => 'Sindicar el sitio completo', |
|
| 117 | - |
|
| 118 | - // T |
|
| 119 | - 'texte_lettre_information' => 'Este es el boletín de información del sitio', |
|
| 120 | - 'texte_lettre_information_2' => 'Este boletín reseña las novedades publicadas desde ', |
|
| 121 | - |
|
| 122 | - // V |
|
| 123 | - 'ver_imprimer' => 'Versión para imprimir', |
|
| 124 | - 'voir_en_ligne' => 'Ver en línea', |
|
| 125 | - 'voir_squelette' => 'ver el esqueleto de esta página' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Portada del sitio', |
|
| 14 | + 'article' => 'Artículo', |
|
| 15 | + 'articles' => 'Artículos', |
|
| 16 | + 'articles_auteur' => 'Artículos de esta autora o autor', |
|
| 17 | + 'articles_populaires' => 'Los artículos más populares', |
|
| 18 | + 'articles_rubrique' => 'Artículos de esta sección', |
|
| 19 | + 'aucun_article' => 'No hay ningún artículo en esta dirección ', |
|
| 20 | + 'aucun_auteur' => 'No hay autor ni autora en esta dirección ', |
|
| 21 | + 'aucun_site' => 'No hay ningún sitio en esta dirección', |
|
| 22 | + 'aucune_breve' => 'No hay ninguna breve en esta dirección', |
|
| 23 | + 'aucune_rubrique' => 'No hay ninguna sección en esta dirección', |
|
| 24 | + 'auteur' => 'Autor o autora', |
|
| 25 | + 'autres' => 'Otros', |
|
| 26 | + 'autres_breves' => 'Otros breves', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Otros grupos de palabras clave', |
|
| 28 | + 'autres_sites' => 'Otros sitios', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Hola', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Comentar este sitio', |
|
| 35 | + 'contact' => 'Contacto', |
|
| 36 | + 'copie_document_impossible' => 'Imposible copiar el documento', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Fecha', |
|
| 40 | + 'dernier_ajout' => 'Última actualización', |
|
| 41 | + 'dernieres_breves' => 'Últimos breves', |
|
| 42 | + 'derniers_articles' => 'Últimos artículos', |
|
| 43 | + 'derniers_commentaires' => 'Últimos comentarios', |
|
| 44 | + 'derniers_messages_forum' => 'Últimos mensajes publicados en los foros', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Edición en modo texto de', |
|
| 48 | + 'en_reponse' => 'En respuesta a:', |
|
| 49 | + 'en_resume' => 'En resumen', |
|
| 50 | + 'envoyer_message' => 'Enviar un mensaje', |
|
| 51 | + 'espace_prive' => 'Espacio privado', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Formatos aceptados: @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Jerarquía del sitio', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'días', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Conectarse', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'Del mismo autor', |
|
| 67 | + 'meme_rubrique' => 'En la misma sección', |
|
| 68 | + 'memes_auteurs' => 'De los mismos autores', |
|
| 69 | + 'message' => 'Mensaje', |
|
| 70 | + 'messages_forum' => 'Mensajes', |
|
| 71 | + 'messages_recents' => 'Los mensajes más recientes del foro', |
|
| 72 | + 'mots_clef' => 'Palabra clave', |
|
| 73 | + 'mots_clefs' => 'Palabras clave', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Palabras claves en el mismo grupo', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navegación', |
|
| 78 | + 'nom' => 'Nombre', |
|
| 79 | + 'nouveautes' => 'Las novedades', |
|
| 80 | + 'nouveautes_web' => 'Novedades en la web', |
|
| 81 | + 'nouveaux_articles' => 'Nuevos artículos', |
|
| 82 | + 'nouvelles_breves' => 'Nuevas breves', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'Página anterior', |
|
| 86 | + 'page_suivante' => 'Página siguiente', |
|
| 87 | + 'par_auteur' => 'por ', |
|
| 88 | + 'participer_site' => 'Puedes participar en la vida de este sitio y proponer artículos inscribiéndote aqui. De inmediato recibirás un correo electrónico con tus claves de acceso al espacio privado del sitio.', |
|
| 89 | + 'plan_site' => 'Mapa del sitio', |
|
| 90 | + 'popularite' => 'Popularidad', |
|
| 91 | + 'poster_message' => 'Publicar un mensaje', |
|
| 92 | + 'proposer_site' => 'Proponga un sitio para añadir en esta sección:', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'Comentar este artículo', |
|
| 96 | + 'repondre_breve' => 'Comentar esta breve', |
|
| 97 | + 'resultats_recherche' => 'Resultados de la búsqueda', |
|
| 98 | + 'retour_debut_forums' => 'Volver al inicio del foro', |
|
| 99 | + 'rss_abonnement' => 'Copie la siguiente URL en su agregador:', |
|
| 100 | + 'rss_abonnement_titre' => 'Suscribirse', |
|
| 101 | + 'rss_abonnement_titre_page' => 'Suscribirse a', |
|
| 102 | + 'rss_explication' => 'Un feed RSS recoge información actualizada de un sitio. Proporciona el contenido de las entradas, comentarios o un extracto de los mismos, así como un enlace a las versiones completas y alguna otra información. Este feed está pensado para ser leído por un agregador RSS.', |
|
| 103 | + 'rss_explication_titre' => '¿Qué es un feed RSS?', |
|
| 104 | + 'rubrique' => 'Sección', |
|
| 105 | + 'rubriques' => 'Secciones', |
|
| 106 | + |
|
| 107 | + // S |
|
| 108 | + 'signatures_petition' => 'Firmas', |
|
| 109 | + 'site_realise_avec_spip' => 'Sitio desarrollado con SPIP', |
|
| 110 | + 'sites_web' => 'Sitios Web', |
|
| 111 | + 'sous_rubriques' => 'Subsección', |
|
| 112 | + 'spam' => 'Spam', |
|
| 113 | + 'suite' => 'continuar', |
|
| 114 | + 'sur_web' => 'Del web', |
|
| 115 | + 'syndiquer_rubrique' => 'Sindicar esta sección', |
|
| 116 | + 'syndiquer_site' => 'Sindicar el sitio completo', |
|
| 117 | + |
|
| 118 | + // T |
|
| 119 | + 'texte_lettre_information' => 'Este es el boletín de información del sitio', |
|
| 120 | + 'texte_lettre_information_2' => 'Este boletín reseña las novedades publicadas desde ', |
|
| 121 | + |
|
| 122 | + // V |
|
| 123 | + 'ver_imprimer' => 'Versión para imprimir', |
|
| 124 | + 'voir_en_ligne' => 'Ver en línea', |
|
| 125 | + 'voir_squelette' => 'ver el esqueleto de esta página' |
|
| 126 | 126 | ); |