@@ -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 | |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | function req_sqlite3_dist($addr, $port, $login, $pass, $db = '', $prefixe = '') { |
| 24 | - return req_sqlite_dist($addr, $port, $login, $pass, $db, $prefixe, $sqlite_version = 3); |
|
| 24 | + return req_sqlite_dist($addr, $port, $login, $pass, $db, $prefixe, $sqlite_version = 3); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | function spip_sqlite3_constantes() { |
| 29 | - if (!defined('SPIP_SQLITE3_ASSOC')) { |
|
| 30 | - define('SPIP_SQLITE3_ASSOC', PDO::FETCH_ASSOC); |
|
| 31 | - define('SPIP_SQLITE3_NUM', PDO::FETCH_NUM); |
|
| 32 | - define('SPIP_SQLITE3_BOTH', PDO::FETCH_BOTH); |
|
| 33 | - } |
|
| 29 | + if (!defined('SPIP_SQLITE3_ASSOC')) { |
|
| 30 | + define('SPIP_SQLITE3_ASSOC', PDO::FETCH_ASSOC); |
|
| 31 | + define('SPIP_SQLITE3_NUM', PDO::FETCH_NUM); |
|
| 32 | + define('SPIP_SQLITE3_BOTH', PDO::FETCH_BOTH); |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | function spip_versions_sqlite3() { |
| 37 | - return _sqlite_charger_version(3) ? 3 : false; |
|
| 37 | + return _sqlite_charger_version(3) ? 3 : false; |
|
| 38 | 38 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -11,112 +11,112 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/texte'); |
| 18 | 18 | |
| 19 | 19 | function inc_plonger_dist($id_rubrique, $idom = '', $list = [], $col = 1, $exclu = 0, $do = 'aff') { |
| 20 | 20 | |
| 21 | - if ($list) { |
|
| 22 | - $id_rubrique = $list[$col - 1]; |
|
| 23 | - } |
|
| 21 | + if ($list) { |
|
| 22 | + $id_rubrique = $list[$col - 1]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - $ret = ''; |
|
| 25 | + $ret = ''; |
|
| 26 | 26 | |
| 27 | - # recherche les filles et petites-filles de la rubrique donnee |
|
| 28 | - # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on |
|
| 29 | - # deplace une rubrique, on peut la deplacer partout a partir de la |
|
| 30 | - # racine... sauf vers elle-meme ou sa propre branche) |
|
| 31 | - $ordre = []; |
|
| 32 | - $rub = []; |
|
| 27 | + # recherche les filles et petites-filles de la rubrique donnee |
|
| 28 | + # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on |
|
| 29 | + # deplace une rubrique, on peut la deplacer partout a partir de la |
|
| 30 | + # racine... sauf vers elle-meme ou sa propre branche) |
|
| 31 | + $ordre = []; |
|
| 32 | + $rub = []; |
|
| 33 | 33 | |
| 34 | - $res = sql_select( |
|
| 35 | - 'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant', |
|
| 36 | - 'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)', |
|
| 37 | - 'rub1.id_parent = ' . sql_quote($id_rubrique) . ' |
|
| 34 | + $res = sql_select( |
|
| 35 | + 'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant', |
|
| 36 | + 'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)', |
|
| 37 | + 'rub1.id_parent = ' . sql_quote($id_rubrique) . ' |
|
| 38 | 38 | AND rub1.id_rubrique!=' . sql_quote($exclu) . ' |
| 39 | 39 | AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu) . ')', |
| 40 | - '', |
|
| 41 | - '0+rub1.titre,rub1.titre' |
|
| 42 | - ); |
|
| 40 | + '', |
|
| 41 | + '0+rub1.titre,rub1.titre' |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - while ($row = sql_fetch($res)) { |
|
| 45 | - if (autoriser('voir', 'rubrique', $row['id_rubrique'])) { |
|
| 46 | - $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant']; |
|
| 47 | - if ($row['id_parent'] == $id_rubrique) { |
|
| 48 | - $t = trim(typo(supprimer_numero($row['titre']))); |
|
| 49 | - if ($row['langue_choisie'] != 'oui') { |
|
| 50 | - $t .= ' <small title="' |
|
| 51 | - . traduire_nom_langue($row['lang']) |
|
| 52 | - . '">[' . $row['lang'] . ']</small>'; |
|
| 53 | - } |
|
| 54 | - $ordre[$row['id_rubrique']] = $t; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - $next = $list[$col] ?? 0; |
|
| 59 | - if ($ordre) { |
|
| 60 | - $rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1)); |
|
| 61 | - $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
|
| 62 | - $args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event"; |
|
| 44 | + while ($row = sql_fetch($res)) { |
|
| 45 | + if (autoriser('voir', 'rubrique', $row['id_rubrique'])) { |
|
| 46 | + $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant']; |
|
| 47 | + if ($row['id_parent'] == $id_rubrique) { |
|
| 48 | + $t = trim(typo(supprimer_numero($row['titre']))); |
|
| 49 | + if ($row['langue_choisie'] != 'oui') { |
|
| 50 | + $t .= ' <small title="' |
|
| 51 | + . traduire_nom_langue($row['lang']) |
|
| 52 | + . '">[' . $row['lang'] . ']</small>'; |
|
| 53 | + } |
|
| 54 | + $ordre[$row['id_rubrique']] = $t; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + $next = $list[$col] ?? 0; |
|
| 59 | + if ($ordre) { |
|
| 60 | + $rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1)); |
|
| 61 | + $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
|
| 62 | + $args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event"; |
|
| 63 | 63 | |
| 64 | - foreach ($ordre as $id => $titrebrut) { |
|
| 65 | - $titre = supprimer_numero($titrebrut); |
|
| 64 | + foreach ($ordre as $id => $titrebrut) { |
|
| 65 | + $titre = supprimer_numero($titrebrut); |
|
| 66 | 66 | |
| 67 | - $classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur'); |
|
| 68 | - if (isset($rub[$id]['enfants'])) { |
|
| 69 | - $classe2 = " class='rub-ouverte'"; |
|
| 70 | - $url = "\nhref='$rec&id=$id'"; |
|
| 71 | - } else { |
|
| 72 | - $classe2 = $url = ''; |
|
| 73 | - $url = "\nhref='javascript:void(0)'"; |
|
| 74 | - } |
|
| 67 | + $classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur'); |
|
| 68 | + if (isset($rub[$id]['enfants'])) { |
|
| 69 | + $classe2 = " class='rub-ouverte'"; |
|
| 70 | + $url = "\nhref='$rec&id=$id'"; |
|
| 71 | + } else { |
|
| 72 | + $classe2 = $url = ''; |
|
| 73 | + $url = "\nhref='javascript:void(0)'"; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - $js_func = $do . '_selection_titre'; |
|
| 77 | - $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn " |
|
| 78 | - . (!is_array($list) ? ' false' |
|
| 79 | - : "aff_selection_provisoire($id,$args)") |
|
| 76 | + $js_func = $do . '_selection_titre'; |
|
| 77 | + $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn " |
|
| 78 | + . (!is_array($list) ? ' false' |
|
| 79 | + : "aff_selection_provisoire($id,$args)") |
|
| 80 | 80 | # ce lien provoque la selection (directe) de la rubrique cliquee |
| 81 | 81 | # et l'affichage de son titre dans le bandeau |
| 82 | - . "\"\nondblclick=\"" |
|
| 83 | - . "$js_func(this." |
|
| 84 | - . 'firstChild.nodeValue,' |
|
| 85 | - . $id |
|
| 86 | - . ",'selection_rubrique','id_parent');" |
|
| 87 | - . "\nreturn aff_selection_provisoire($id,$args);" |
|
| 88 | - . '"'; |
|
| 82 | + . "\"\nondblclick=\"" |
|
| 83 | + . "$js_func(this." |
|
| 84 | + . 'firstChild.nodeValue,' |
|
| 85 | + . $id |
|
| 86 | + . ",'selection_rubrique','id_parent');" |
|
| 87 | + . "\nreturn aff_selection_provisoire($id,$args);" |
|
| 88 | + . '"'; |
|
| 89 | 89 | |
| 90 | - $ret .= "<div class='" |
|
| 91 | - . (($id == $next) ? 'item on' : 'item') |
|
| 92 | - . "'><div class='" |
|
| 93 | - . $classe1 |
|
| 94 | - . "'><div$classe2><a" |
|
| 95 | - . $url |
|
| 96 | - . $click |
|
| 97 | - . '>' |
|
| 98 | - . $titre |
|
| 99 | - . '</a></div></div></div>'; |
|
| 100 | - } |
|
| 101 | - } |
|
| 90 | + $ret .= "<div class='" |
|
| 91 | + . (($id == $next) ? 'item on' : 'item') |
|
| 92 | + . "'><div class='" |
|
| 93 | + . $classe1 |
|
| 94 | + . "'><div$classe2><a" |
|
| 95 | + . $url |
|
| 96 | + . $click |
|
| 97 | + . '>' |
|
| 98 | + . $titre |
|
| 99 | + . '</a></div></div></div>'; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - $idom2 = $idom . '_col_' . ($col + 1); |
|
| 104 | - $left = ($col * 250); |
|
| 103 | + $idom2 = $idom . '_col_' . ($col + 1); |
|
| 104 | + $left = ($col * 250); |
|
| 105 | 105 | |
| 106 | - return http_img_pack( |
|
| 107 | - 'loader.svg', |
|
| 108 | - '', |
|
| 109 | - "class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 110 | - . ($left - 30) |
|
| 111 | - . "px; top: 2px; z-index: 2;' id='img_$idom2'" |
|
| 112 | - ) |
|
| 113 | - . "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 114 | - . ($left - 250) |
|
| 115 | - . "px;'>" |
|
| 116 | - . $ret |
|
| 117 | - . "\n</div>\n<div id='$idom2'>" |
|
| 118 | - . ($next |
|
| 119 | - ? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu) |
|
| 120 | - : '') |
|
| 121 | - . "\n</div>"; |
|
| 106 | + return http_img_pack( |
|
| 107 | + 'loader.svg', |
|
| 108 | + '', |
|
| 109 | + "class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 110 | + . ($left - 30) |
|
| 111 | + . "px; top: 2px; z-index: 2;' id='img_$idom2'" |
|
| 112 | + ) |
|
| 113 | + . "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': ' |
|
| 114 | + . ($left - 250) |
|
| 115 | + . "px;'>" |
|
| 116 | + . $ret |
|
| 117 | + . "\n</div>\n<div id='$idom2'>" |
|
| 118 | + . ($next |
|
| 119 | + ? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu) |
|
| 120 | + : '') |
|
| 121 | + . "\n</div>"; |
|
| 122 | 122 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Presentation |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/presentation_mini'); |
@@ -31,141 +31,141 @@ discard block |
||
| 31 | 31 | include_spip('inc/filtres_alertes'); |
| 32 | 32 | |
| 33 | 33 | function debut_cadre($style, $icone = '', $fonction = '', $titre = '', $id = '', $class = '', $padding = true) { |
| 34 | - $fond = null; |
|
| 35 | - $style_mapping = [ |
|
| 36 | - 'r' => 'simple', |
|
| 37 | - 'e' => 'raccourcis', |
|
| 38 | - 'couleur' => 'basic highlight', |
|
| 39 | - 'couleur-foncee' => 'basic highlight', |
|
| 40 | - 'trait-couleur' => 'important', |
|
| 41 | - 'alerte' => 'notice', |
|
| 42 | - 'info' => 'info', |
|
| 43 | - 'sous_rub' => 'simple sous-rub' |
|
| 44 | - ]; |
|
| 45 | - $style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section']; |
|
| 46 | - $c = $style_mapping[$style] ?? 'simple'; |
|
| 47 | - $class = $c . ($class ? " $class" : ''); |
|
| 48 | - if (!$padding) { |
|
| 49 | - $class .= ($class ? ' ' : '') . 'no-padding'; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - //($id?"id='$id' ":"") |
|
| 53 | - if (strlen($icone) > 1) { |
|
| 54 | - if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) { |
|
| 55 | - [$fond, $fonction] = $icone_renommer($icone, $fonction); |
|
| 56 | - } |
|
| 57 | - $size = 24; |
|
| 58 | - if (preg_match('/-([0-9]{1,3})[.](gif|png)$/i', $fond, $match)) { |
|
| 59 | - $size = $match[1]; |
|
| 60 | - } |
|
| 61 | - if ($fonction) { |
|
| 62 | - // 2 images pour composer l'icone : le fond (article) en background, |
|
| 63 | - // la fonction (new) en image |
|
| 64 | - $icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n" . |
|
| 65 | - http_style_background($fond, 'no-repeat center center', $size)); |
|
| 66 | - } else { |
|
| 67 | - $icone = http_img_pack($fond, '', "class='cadre-icone' width='$size' height='$size'"); |
|
| 68 | - } |
|
| 69 | - $titre = $icone . $titre; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id); |
|
| 34 | + $fond = null; |
|
| 35 | + $style_mapping = [ |
|
| 36 | + 'r' => 'simple', |
|
| 37 | + 'e' => 'raccourcis', |
|
| 38 | + 'couleur' => 'basic highlight', |
|
| 39 | + 'couleur-foncee' => 'basic highlight', |
|
| 40 | + 'trait-couleur' => 'important', |
|
| 41 | + 'alerte' => 'notice', |
|
| 42 | + 'info' => 'info', |
|
| 43 | + 'sous_rub' => 'simple sous-rub' |
|
| 44 | + ]; |
|
| 45 | + $style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section']; |
|
| 46 | + $c = $style_mapping[$style] ?? 'simple'; |
|
| 47 | + $class = $c . ($class ? " $class" : ''); |
|
| 48 | + if (!$padding) { |
|
| 49 | + $class .= ($class ? ' ' : '') . 'no-padding'; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + //($id?"id='$id' ":"") |
|
| 53 | + if (strlen($icone) > 1) { |
|
| 54 | + if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) { |
|
| 55 | + [$fond, $fonction] = $icone_renommer($icone, $fonction); |
|
| 56 | + } |
|
| 57 | + $size = 24; |
|
| 58 | + if (preg_match('/-([0-9]{1,3})[.](gif|png)$/i', $fond, $match)) { |
|
| 59 | + $size = $match[1]; |
|
| 60 | + } |
|
| 61 | + if ($fonction) { |
|
| 62 | + // 2 images pour composer l'icone : le fond (article) en background, |
|
| 63 | + // la fonction (new) en image |
|
| 64 | + $icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n" . |
|
| 65 | + http_style_background($fond, 'no-repeat center center', $size)); |
|
| 66 | + } else { |
|
| 67 | + $icone = http_img_pack($fond, '', "class='cadre-icone' width='$size' height='$size'"); |
|
| 68 | + } |
|
| 69 | + $titre = $icone . $titre; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | function fin_cadre() { |
| 76 | - return boite_fermer(); |
|
| 76 | + return boite_fermer(); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | function debut_cadre_relief( |
| 81 | - $icone = '', |
|
| 82 | - $dummy = '', |
|
| 83 | - $fonction = '', |
|
| 84 | - $titre = '', |
|
| 85 | - $id = '', |
|
| 86 | - $class = '' |
|
| 81 | + $icone = '', |
|
| 82 | + $dummy = '', |
|
| 83 | + $fonction = '', |
|
| 84 | + $titre = '', |
|
| 85 | + $id = '', |
|
| 86 | + $class = '' |
|
| 87 | 87 | ) { |
| 88 | - return debut_cadre('r', $icone, $fonction, $titre, $id, $class); |
|
| 88 | + return debut_cadre('r', $icone, $fonction, $titre, $id, $class); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | function fin_cadre_relief() { |
| 92 | - return fin_cadre(); |
|
| 92 | + return fin_cadre(); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | function debut_cadre_enfonce( |
| 96 | - $icone = '', |
|
| 97 | - $dummy = '', |
|
| 98 | - $fonction = '', |
|
| 99 | - $titre = '', |
|
| 100 | - $id = '', |
|
| 101 | - $class = '' |
|
| 96 | + $icone = '', |
|
| 97 | + $dummy = '', |
|
| 98 | + $fonction = '', |
|
| 99 | + $titre = '', |
|
| 100 | + $id = '', |
|
| 101 | + $class = '' |
|
| 102 | 102 | ) { |
| 103 | - return debut_cadre('e', $icone, $fonction, $titre, $id, $class); |
|
| 103 | + return debut_cadre('e', $icone, $fonction, $titre, $id, $class); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | function fin_cadre_enfonce() { |
| 107 | - return fin_cadre(); |
|
| 107 | + return fin_cadre(); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | function debut_cadre_sous_rub( |
| 111 | - $icone = '', |
|
| 112 | - $dummy = '', |
|
| 113 | - $fonction = '', |
|
| 114 | - $titre = '', |
|
| 115 | - $id = '', |
|
| 116 | - $class = '' |
|
| 111 | + $icone = '', |
|
| 112 | + $dummy = '', |
|
| 113 | + $fonction = '', |
|
| 114 | + $titre = '', |
|
| 115 | + $id = '', |
|
| 116 | + $class = '' |
|
| 117 | 117 | ) { |
| 118 | - return debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class); |
|
| 118 | + return debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | function fin_cadre_sous_rub() { |
| 122 | - return fin_cadre(); |
|
| 122 | + return fin_cadre(); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | function debut_cadre_couleur( |
| 126 | - $icone = '', |
|
| 127 | - $dummy = '', |
|
| 128 | - $fonction = '', |
|
| 129 | - $titre = '', |
|
| 130 | - $id = '', |
|
| 131 | - $class = '' |
|
| 126 | + $icone = '', |
|
| 127 | + $dummy = '', |
|
| 128 | + $fonction = '', |
|
| 129 | + $titre = '', |
|
| 130 | + $id = '', |
|
| 131 | + $class = '' |
|
| 132 | 132 | ) { |
| 133 | - return debut_cadre('couleur', $icone, $fonction, $titre, $id, $class); |
|
| 133 | + return debut_cadre('couleur', $icone, $fonction, $titre, $id, $class); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | function fin_cadre_couleur() { |
| 137 | - return fin_cadre(); |
|
| 137 | + return fin_cadre(); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | function debut_cadre_trait_couleur( |
| 141 | - $icone = '', |
|
| 142 | - $dummy = '', |
|
| 143 | - $fonction = '', |
|
| 144 | - $titre = '', |
|
| 145 | - $id = '', |
|
| 146 | - $class = '' |
|
| 141 | + $icone = '', |
|
| 142 | + $dummy = '', |
|
| 143 | + $fonction = '', |
|
| 144 | + $titre = '', |
|
| 145 | + $id = '', |
|
| 146 | + $class = '' |
|
| 147 | 147 | ) { |
| 148 | - return debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class); |
|
| 148 | + return debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | function fin_cadre_trait_couleur() { |
| 152 | - return fin_cadre(); |
|
| 152 | + return fin_cadre(); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | function debut_boite_alerte() { |
| 156 | - return debut_cadre('alerte', '', '', '', '', ''); |
|
| 156 | + return debut_cadre('alerte', '', '', '', '', ''); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | function fin_boite_alerte() { |
| 160 | - return fin_cadre(); |
|
| 160 | + return fin_cadre(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | function debut_boite_info() { |
| 164 | - return debut_cadre('info', '', '', '', '', ''); |
|
| 164 | + return debut_cadre('info', '', '', '', '', ''); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | function fin_boite_info() { |
| 168 | - return fin_cadre(); |
|
| 168 | + return fin_cadre(); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | * @return string Code PHP. |
| 177 | 177 | **/ |
| 178 | 178 | function gros_titre( |
| 179 | - $titre, |
|
| 180 | - $ze_logo = '' |
|
| 179 | + $titre, |
|
| 180 | + $ze_logo = '' |
|
| 181 | 181 | ) { |
| 182 | - return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n"; |
|
| 182 | + return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n"; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // La boite des raccourcis |
| 186 | 186 | // Se place a droite si l'ecran est en mode panoramique. |
| 187 | 187 | function bloc_des_raccourcis($bloc) { |
| 188 | - return creer_colonne_droite() |
|
| 189 | - . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer(); |
|
| 188 | + return creer_colonne_droite() |
|
| 189 | + . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer(); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // |
@@ -196,18 +196,18 @@ discard block |
||
| 196 | 196 | // Fonctions onglets |
| 197 | 197 | // @param string $sous_classe prend la valeur second pour definir les onglet de deuxieme niveau |
| 198 | 198 | function debut_onglet($classe = 'barre_onglet') { |
| 199 | - return "<div class = '$classe clearfix'><ul>\n"; |
|
| 199 | + return "<div class = '$classe clearfix'><ul>\n"; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | function fin_onglet() { |
| 203 | - return "</ul></div>\n"; |
|
| 203 | + return "</ul></div>\n"; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | function onglet($texte, $lien, $onglet_ref, $onglet, $icone = '') { |
| 207 | - return '<li>' |
|
| 208 | - . ($icone ? http_img_pack($icone, '', " class='cadre-icone'") : '') |
|
| 209 | - . lien_ou_expose($lien, $texte, $onglet == $onglet_ref) |
|
| 210 | - . '</li>'; |
|
| 207 | + return '<li>' |
|
| 208 | + . ($icone ? http_img_pack($icone, '', " class='cadre-icone'") : '') |
|
| 209 | + . lien_ou_expose($lien, $texte, $onglet == $onglet_ref) |
|
| 210 | + . '</li>'; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -239,14 +239,14 @@ discard block |
||
| 239 | 239 | * Code HTML du lien |
| 240 | 240 | **/ |
| 241 | 241 | function icone_verticale($texte, $lien, $fond, $fonction = '', $align = '', $javascript = '') { |
| 242 | - // cas d'ajax_action_auteur: faut defaire le boulot |
|
| 243 | - // (il faudrait fusionner avec le cas $javascript) |
|
| 244 | - if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) { |
|
| 245 | - [$x, $lien, $atts, $texte] = $r; |
|
| 246 | - $javascript .= $atts; |
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - return icone_base($lien, $texte, $fond, $fonction, "verticale $align", $javascript); |
|
| 242 | + // cas d'ajax_action_auteur: faut defaire le boulot |
|
| 243 | + // (il faudrait fusionner avec le cas $javascript) |
|
| 244 | + if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) { |
|
| 245 | + [$x, $lien, $atts, $texte] = $r; |
|
| 246 | + $javascript .= $atts; |
|
| 247 | + } |
|
| 248 | + |
|
| 249 | + return icone_base($lien, $texte, $fond, $fonction, "verticale $align", $javascript); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -271,15 +271,15 @@ discard block |
||
| 271 | 271 | * Code HTML du lien |
| 272 | 272 | **/ |
| 273 | 273 | function icone_horizontale($texte, $lien, $fond, $fonction = '', $dummy = '', $javascript = '') { |
| 274 | - $retour = ''; |
|
| 275 | - // cas d'ajax_action_auteur: faut defaire le boulot |
|
| 276 | - // (il faudrait fusionner avec le cas $javascript) |
|
| 277 | - if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) { |
|
| 278 | - [$x, $lien, $atts, $texte] = $r; |
|
| 279 | - $javascript .= $atts; |
|
| 280 | - } |
|
| 274 | + $retour = ''; |
|
| 275 | + // cas d'ajax_action_auteur: faut defaire le boulot |
|
| 276 | + // (il faudrait fusionner avec le cas $javascript) |
|
| 277 | + if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) { |
|
| 278 | + [$x, $lien, $atts, $texte] = $r; |
|
| 279 | + $javascript .= $atts; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - $retour = icone_base($lien, $texte, $fond, $fonction, 'horizontale', $javascript); |
|
| 282 | + $retour = icone_base($lien, $texte, $fond, $fonction, 'horizontale', $javascript); |
|
| 283 | 283 | |
| 284 | - return $retour; |
|
| 284 | + return $retour; |
|
| 285 | 285 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // |
@@ -21,54 +21,54 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | function produire_image_math($tex) { |
| 23 | 23 | |
| 24 | - switch ($GLOBALS['traiter_math']) { |
|
| 25 | - // Attention: mathml desactiv'e pour l'instant |
|
| 26 | - case 'mathml': |
|
| 27 | - $ext = '.xhtml'; |
|
| 28 | - $server = $GLOBALS['mathml_server']; |
|
| 29 | - break; |
|
| 30 | - case 'tex': |
|
| 31 | - $ext = '.png'; |
|
| 32 | - $server = $GLOBALS['tex_server']; |
|
| 33 | - break; |
|
| 34 | - default: |
|
| 35 | - return $tex; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - // Regarder dans le repertoire local des images TeX et blocs MathML |
|
| 39 | - if (!@is_dir($dir_tex = _DIR_VAR . 'cache-TeX/')) { |
|
| 40 | - @mkdir($dir_tex, _SPIP_CHMOD); |
|
| 41 | - } |
|
| 42 | - $fichier = $dir_tex . md5(trim($tex)) . $ext; |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - if (!@file_exists($fichier)) { |
|
| 46 | - // Aller chercher l'image sur le serveur |
|
| 47 | - if ($server) { |
|
| 48 | - spip_log($url = $server . '?' . rawurlencode($tex)); |
|
| 49 | - include_spip('inc/distant'); |
|
| 50 | - recuperer_url($url, ['file' => $fichier]); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - |
|
| 55 | - // Composer la reponse selon presence ou non de l'image |
|
| 56 | - $tex = entites_html($tex); |
|
| 57 | - if (@file_exists($fichier)) { |
|
| 58 | - // MathML |
|
| 59 | - if ($GLOBALS['traiter_math'] == 'mathml') { |
|
| 60 | - return implode('', file($fichier)); |
|
| 61 | - } // TeX |
|
| 62 | - else { |
|
| 63 | - [, , , $size] = @spip_getimagesize($fichier); |
|
| 64 | - $alt = "alt=\"$tex\" title=\"$tex\""; |
|
| 65 | - |
|
| 66 | - return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />"; |
|
| 67 | - } |
|
| 68 | - } else // pas de fichier |
|
| 69 | - { |
|
| 70 | - return "<tt><span class='spip_code' dir='ltr'>$tex</span></tt>"; |
|
| 71 | - } |
|
| 24 | + switch ($GLOBALS['traiter_math']) { |
|
| 25 | + // Attention: mathml desactiv'e pour l'instant |
|
| 26 | + case 'mathml': |
|
| 27 | + $ext = '.xhtml'; |
|
| 28 | + $server = $GLOBALS['mathml_server']; |
|
| 29 | + break; |
|
| 30 | + case 'tex': |
|
| 31 | + $ext = '.png'; |
|
| 32 | + $server = $GLOBALS['tex_server']; |
|
| 33 | + break; |
|
| 34 | + default: |
|
| 35 | + return $tex; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + // Regarder dans le repertoire local des images TeX et blocs MathML |
|
| 39 | + if (!@is_dir($dir_tex = _DIR_VAR . 'cache-TeX/')) { |
|
| 40 | + @mkdir($dir_tex, _SPIP_CHMOD); |
|
| 41 | + } |
|
| 42 | + $fichier = $dir_tex . md5(trim($tex)) . $ext; |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + if (!@file_exists($fichier)) { |
|
| 46 | + // Aller chercher l'image sur le serveur |
|
| 47 | + if ($server) { |
|
| 48 | + spip_log($url = $server . '?' . rawurlencode($tex)); |
|
| 49 | + include_spip('inc/distant'); |
|
| 50 | + recuperer_url($url, ['file' => $fichier]); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + |
|
| 55 | + // Composer la reponse selon presence ou non de l'image |
|
| 56 | + $tex = entites_html($tex); |
|
| 57 | + if (@file_exists($fichier)) { |
|
| 58 | + // MathML |
|
| 59 | + if ($GLOBALS['traiter_math'] == 'mathml') { |
|
| 60 | + return implode('', file($fichier)); |
|
| 61 | + } // TeX |
|
| 62 | + else { |
|
| 63 | + [, , , $size] = @spip_getimagesize($fichier); |
|
| 64 | + $alt = "alt=\"$tex\" title=\"$tex\""; |
|
| 65 | + |
|
| 66 | + return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />"; |
|
| 67 | + } |
|
| 68 | + } else // pas de fichier |
|
| 69 | + { |
|
| 70 | + return "<tt><span class='spip_code' dir='ltr'>$tex</span></tt>"; |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
@@ -103,52 +103,52 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | function traiter_math($letexte, $source = '', $defaire_amp = false) { |
| 105 | 105 | |
| 106 | - $texte_a_voir = $letexte; |
|
| 107 | - while (($debut = strpos($texte_a_voir, '<math>')) !== false) { |
|
| 108 | - if (!$fin = strpos($texte_a_voir, '</math>')) { |
|
| 109 | - $fin = strlen($texte_a_voir); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - $texte_debut = substr($texte_a_voir, 0, $debut); |
|
| 113 | - $texte_milieu = substr( |
|
| 114 | - $texte_a_voir, |
|
| 115 | - $debut + strlen('<math>'), |
|
| 116 | - $fin - $debut - strlen('<math>') |
|
| 117 | - ); |
|
| 118 | - $texte_fin = substr( |
|
| 119 | - $texte_a_voir, |
|
| 120 | - $fin + strlen('</math>'), |
|
| 121 | - strlen($texte_a_voir) |
|
| 122 | - ); |
|
| 123 | - |
|
| 124 | - // Les doubles $$x^2$$ en mode 'div' |
|
| 125 | - while ((preg_match(',[$][$]([^$]+)[$][$],', $texte_milieu, $regs))) { |
|
| 126 | - $expression = $regs[1]; |
|
| 127 | - if ($defaire_amp) { |
|
| 128 | - $expression = str_replace('&', '&', $expression); |
|
| 129 | - } |
|
| 130 | - $echap = "\n<p class=\"spip\" style=\"text-align: center;\">" . produire_image_math($expression) . "</p>\n"; |
|
| 131 | - $pos = strpos($texte_milieu, (string) $regs[0]); |
|
| 132 | - $texte_milieu = substr($texte_milieu, 0, $pos) |
|
| 133 | - . code_echappement($echap, $source) |
|
| 134 | - . substr($texte_milieu, $pos + strlen($regs[0])); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // Les simples $x^2$ en mode 'span' |
|
| 138 | - while ((preg_match(',[$]([^$]+)[$],', $texte_milieu, $regs))) { |
|
| 139 | - $expression = $regs[1]; |
|
| 140 | - if ($defaire_amp) { |
|
| 141 | - $expression = str_replace('&', '&', $expression); |
|
| 142 | - } |
|
| 143 | - $echap = produire_image_math($expression); |
|
| 144 | - $pos = strpos($texte_milieu, (string) $regs[0]); |
|
| 145 | - $texte_milieu = substr($texte_milieu, 0, $pos) |
|
| 146 | - . code_echappement($echap, $source) |
|
| 147 | - . substr($texte_milieu, $pos + strlen($regs[0])); |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - $texte_a_voir = $texte_debut . $texte_milieu . $texte_fin; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - return $texte_a_voir; |
|
| 106 | + $texte_a_voir = $letexte; |
|
| 107 | + while (($debut = strpos($texte_a_voir, '<math>')) !== false) { |
|
| 108 | + if (!$fin = strpos($texte_a_voir, '</math>')) { |
|
| 109 | + $fin = strlen($texte_a_voir); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + $texte_debut = substr($texte_a_voir, 0, $debut); |
|
| 113 | + $texte_milieu = substr( |
|
| 114 | + $texte_a_voir, |
|
| 115 | + $debut + strlen('<math>'), |
|
| 116 | + $fin - $debut - strlen('<math>') |
|
| 117 | + ); |
|
| 118 | + $texte_fin = substr( |
|
| 119 | + $texte_a_voir, |
|
| 120 | + $fin + strlen('</math>'), |
|
| 121 | + strlen($texte_a_voir) |
|
| 122 | + ); |
|
| 123 | + |
|
| 124 | + // Les doubles $$x^2$$ en mode 'div' |
|
| 125 | + while ((preg_match(',[$][$]([^$]+)[$][$],', $texte_milieu, $regs))) { |
|
| 126 | + $expression = $regs[1]; |
|
| 127 | + if ($defaire_amp) { |
|
| 128 | + $expression = str_replace('&', '&', $expression); |
|
| 129 | + } |
|
| 130 | + $echap = "\n<p class=\"spip\" style=\"text-align: center;\">" . produire_image_math($expression) . "</p>\n"; |
|
| 131 | + $pos = strpos($texte_milieu, (string) $regs[0]); |
|
| 132 | + $texte_milieu = substr($texte_milieu, 0, $pos) |
|
| 133 | + . code_echappement($echap, $source) |
|
| 134 | + . substr($texte_milieu, $pos + strlen($regs[0])); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + // Les simples $x^2$ en mode 'span' |
|
| 138 | + while ((preg_match(',[$]([^$]+)[$],', $texte_milieu, $regs))) { |
|
| 139 | + $expression = $regs[1]; |
|
| 140 | + if ($defaire_amp) { |
|
| 141 | + $expression = str_replace('&', '&', $expression); |
|
| 142 | + } |
|
| 143 | + $echap = produire_image_math($expression); |
|
| 144 | + $pos = strpos($texte_milieu, (string) $regs[0]); |
|
| 145 | + $texte_milieu = substr($texte_milieu, 0, $pos) |
|
| 146 | + . code_echappement($echap, $source) |
|
| 147 | + . substr($texte_milieu, $pos + strlen($regs[0])); |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + $texte_a_voir = $texte_debut . $texte_milieu . $texte_fin; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + return $texte_a_voir; |
|
| 154 | 154 | } |
@@ -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 | /** |
@@ -26,70 +26,70 @@ discard block |
||
| 26 | 26 | * @return string Code HTML du cadre dépliable |
| 27 | 27 | **/ |
| 28 | 28 | function cadre_depliable($icone, $titre, $deplie, $contenu, $ids = '', $style_cadre = 'r') { |
| 29 | - $bouton = bouton_block_depliable($titre, $deplie, $ids); |
|
| 30 | - |
|
| 31 | - return |
|
| 32 | - debut_cadre($style_cadre, $icone, '', $bouton, '', '', false) |
|
| 33 | - . debut_block_depliable($deplie, $ids) |
|
| 34 | - . "<div class='cadre_padding'>\n" |
|
| 35 | - . $contenu |
|
| 36 | - . "</div>\n" |
|
| 37 | - . fin_block() |
|
| 38 | - . fin_cadre(); |
|
| 29 | + $bouton = bouton_block_depliable($titre, $deplie, $ids); |
|
| 30 | + |
|
| 31 | + return |
|
| 32 | + debut_cadre($style_cadre, $icone, '', $bouton, '', '', false) |
|
| 33 | + . debut_block_depliable($deplie, $ids) |
|
| 34 | + . "<div class='cadre_padding'>\n" |
|
| 35 | + . $contenu |
|
| 36 | + . "</div>\n" |
|
| 37 | + . fin_block() |
|
| 38 | + . fin_cadre(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function block_parfois_visible($nom, $invite, $masque, $style = '', $visible = false) { |
| 42 | - return "\n" |
|
| 43 | - . bouton_block_depliable($invite, $visible, $nom) |
|
| 44 | - . debut_block_depliable($visible, $nom) |
|
| 45 | - . $masque |
|
| 46 | - . fin_block(); |
|
| 42 | + return "\n" |
|
| 43 | + . bouton_block_depliable($invite, $visible, $nom) |
|
| 44 | + . debut_block_depliable($visible, $nom) |
|
| 45 | + . $masque |
|
| 46 | + . fin_block(); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function debut_block_depliable($deplie, $id = '') { |
| 50 | - $class = ' blocdeplie'; |
|
| 51 | - // si on n'accepte pas js, ne pas fermer |
|
| 52 | - if (!$deplie) { |
|
| 53 | - $class = ' blocreplie'; |
|
| 54 | - } |
|
| 50 | + $class = ' blocdeplie'; |
|
| 51 | + // si on n'accepte pas js, ne pas fermer |
|
| 52 | + if (!$deplie) { |
|
| 53 | + $class = ' blocreplie'; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>"; |
|
| 56 | + return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>"; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | function fin_block() { |
| 60 | - return "<div class='nettoyeur'></div>\n</div>"; |
|
| 60 | + return "<div class='nettoyeur'></div>\n</div>"; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // $texte : texte du bouton |
| 64 | 64 | // $deplie : true (deplie) ou false (plie) ou -1 (inactif) ou 'incertain' pour que le bouton s'auto init au chargement de la page |
| 65 | 65 | // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit) |
| 66 | 66 | function bouton_block_depliable($texte, $deplie, $ids = '') { |
| 67 | - $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); |
|
| 68 | - |
|
| 69 | - $class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie'); |
|
| 70 | - if (strlen($ids)) { |
|
| 71 | - $cible = explode(',', $ids); |
|
| 72 | - $cible = '#' . implode(',#', $cible); |
|
| 73 | - } else { |
|
| 74 | - $cible = "#$bouton_id + div.bloc_depliable"; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - $b = (strpos($texte, '<h') === false ? 'h3' : 'div'); |
|
| 78 | - |
|
| 79 | - return "<$b " |
|
| 80 | - . ($bouton_id ? "id='$bouton_id' " : '') |
|
| 81 | - . "class='titrem$class'" |
|
| 82 | - . (($deplie === -1) |
|
| 83 | - ? '' |
|
| 84 | - : " onmouseover=\"jQuery(this).depliant('$cible');\"" |
|
| 85 | - ) |
|
| 86 | - . '>' |
|
| 87 | - // une ancre pour rendre accessible au clavier le depliage du sous bloc |
|
| 88 | - . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>" |
|
| 89 | - . "$texte</$b>" |
|
| 90 | - . http_script(($deplie === 'incertain') |
|
| 91 | - ? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});" |
|
| 92 | - : ''); |
|
| 67 | + $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8); |
|
| 68 | + |
|
| 69 | + $class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie'); |
|
| 70 | + if (strlen($ids)) { |
|
| 71 | + $cible = explode(',', $ids); |
|
| 72 | + $cible = '#' . implode(',#', $cible); |
|
| 73 | + } else { |
|
| 74 | + $cible = "#$bouton_id + div.bloc_depliable"; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + $b = (strpos($texte, '<h') === false ? 'h3' : 'div'); |
|
| 78 | + |
|
| 79 | + return "<$b " |
|
| 80 | + . ($bouton_id ? "id='$bouton_id' " : '') |
|
| 81 | + . "class='titrem$class'" |
|
| 82 | + . (($deplie === -1) |
|
| 83 | + ? '' |
|
| 84 | + : " onmouseover=\"jQuery(this).depliant('$cible');\"" |
|
| 85 | + ) |
|
| 86 | + . '>' |
|
| 87 | + // une ancre pour rendre accessible au clavier le depliage du sous bloc |
|
| 88 | + . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>" |
|
| 89 | + . "$texte</$b>" |
|
| 90 | + . http_script(($deplie === 'incertain') |
|
| 91 | + ? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});" |
|
| 92 | + : ''); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // |
@@ -97,66 +97,66 @@ discard block |
||
| 97 | 97 | // |
| 98 | 98 | function verif_butineur() { |
| 99 | 99 | |
| 100 | - preg_match(',^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,', $_SERVER['HTTP_USER_AGENT'], $match); |
|
| 101 | - $GLOBALS['browser_name'] = $match[1]; |
|
| 102 | - $GLOBALS['browser_version'] = $match[2]; |
|
| 103 | - $GLOBALS['browser_description'] = $match[3]; |
|
| 104 | - $GLOBALS['browser_layer'] = ' '; // compat avec vieux scripts qui testent la valeur |
|
| 105 | - $GLOBALS['browser_barre'] = ''; |
|
| 106 | - |
|
| 107 | - if (!preg_match(',opera,i', $GLOBALS['browser_description']) && preg_match(',opera,i', $GLOBALS['browser_name'])) { |
|
| 108 | - $GLOBALS['browser_name'] = 'Opera'; |
|
| 109 | - $GLOBALS['browser_version'] = $match[2]; |
|
| 110 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 111 | - } else { |
|
| 112 | - if (preg_match(',opera,i', $GLOBALS['browser_description'])) { |
|
| 113 | - preg_match(',Opera ([^\ ]*),i', $GLOBALS['browser_description'], $match); |
|
| 114 | - $GLOBALS['browser_name'] = 'Opera'; |
|
| 115 | - $GLOBALS['browser_version'] = $match[1]; |
|
| 116 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 117 | - } else { |
|
| 118 | - if (preg_match(',msie,i', $GLOBALS['browser_description'])) { |
|
| 119 | - preg_match(',MSIE ([^;]*),i', $GLOBALS['browser_description'], $match); |
|
| 120 | - $GLOBALS['browser_name'] = 'MSIE'; |
|
| 121 | - $GLOBALS['browser_version'] = $match[1]; |
|
| 122 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.5); |
|
| 123 | - } else { |
|
| 124 | - if ( |
|
| 125 | - preg_match(',KHTML,i', $GLOBALS['browser_description']) && |
|
| 126 | - preg_match(',Safari/([^;]*),', $GLOBALS['browser_description'], $match) |
|
| 127 | - ) { |
|
| 128 | - $GLOBALS['browser_name'] = 'Safari'; |
|
| 129 | - $GLOBALS['browser_version'] = $match[1]; |
|
| 130 | - $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.0); |
|
| 131 | - } else { |
|
| 132 | - if (preg_match(',mozilla,i', $GLOBALS['browser_name']) and $GLOBALS['browser_version'] >= 5) { |
|
| 133 | - // Numero de version pour Mozilla "authentique" |
|
| 134 | - if (preg_match(',rv:([0-9]+\.[0-9]+),', $GLOBALS['browser_description'], $match)) { |
|
| 135 | - $GLOBALS['browser_rev'] = doubleval($match[1]); |
|
| 136 | - } // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.) |
|
| 137 | - else { |
|
| 138 | - if ( |
|
| 139 | - strpos($GLOBALS['browser_description'], 'Gecko') and !strpos( |
|
| 140 | - $GLOBALS['browser_description'], |
|
| 141 | - 'KHTML' |
|
| 142 | - ) |
|
| 143 | - ) { |
|
| 144 | - $GLOBALS['browser_rev'] = 1.4; |
|
| 145 | - } // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.) |
|
| 146 | - else { |
|
| 147 | - $GLOBALS['browser_rev'] = 1.0; |
|
| 148 | - } |
|
| 149 | - } |
|
| 150 | - $GLOBALS['browser_barre'] = $GLOBALS['browser_rev'] >= 1.3; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - if (!$GLOBALS['browser_name']) { |
|
| 158 | - $GLOBALS['browser_name'] = 'Mozilla'; |
|
| 159 | - } |
|
| 100 | + preg_match(',^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,', $_SERVER['HTTP_USER_AGENT'], $match); |
|
| 101 | + $GLOBALS['browser_name'] = $match[1]; |
|
| 102 | + $GLOBALS['browser_version'] = $match[2]; |
|
| 103 | + $GLOBALS['browser_description'] = $match[3]; |
|
| 104 | + $GLOBALS['browser_layer'] = ' '; // compat avec vieux scripts qui testent la valeur |
|
| 105 | + $GLOBALS['browser_barre'] = ''; |
|
| 106 | + |
|
| 107 | + if (!preg_match(',opera,i', $GLOBALS['browser_description']) && preg_match(',opera,i', $GLOBALS['browser_name'])) { |
|
| 108 | + $GLOBALS['browser_name'] = 'Opera'; |
|
| 109 | + $GLOBALS['browser_version'] = $match[2]; |
|
| 110 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 111 | + } else { |
|
| 112 | + if (preg_match(',opera,i', $GLOBALS['browser_description'])) { |
|
| 113 | + preg_match(',Opera ([^\ ]*),i', $GLOBALS['browser_description'], $match); |
|
| 114 | + $GLOBALS['browser_name'] = 'Opera'; |
|
| 115 | + $GLOBALS['browser_version'] = $match[1]; |
|
| 116 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5); |
|
| 117 | + } else { |
|
| 118 | + if (preg_match(',msie,i', $GLOBALS['browser_description'])) { |
|
| 119 | + preg_match(',MSIE ([^;]*),i', $GLOBALS['browser_description'], $match); |
|
| 120 | + $GLOBALS['browser_name'] = 'MSIE'; |
|
| 121 | + $GLOBALS['browser_version'] = $match[1]; |
|
| 122 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.5); |
|
| 123 | + } else { |
|
| 124 | + if ( |
|
| 125 | + preg_match(',KHTML,i', $GLOBALS['browser_description']) && |
|
| 126 | + preg_match(',Safari/([^;]*),', $GLOBALS['browser_description'], $match) |
|
| 127 | + ) { |
|
| 128 | + $GLOBALS['browser_name'] = 'Safari'; |
|
| 129 | + $GLOBALS['browser_version'] = $match[1]; |
|
| 130 | + $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.0); |
|
| 131 | + } else { |
|
| 132 | + if (preg_match(',mozilla,i', $GLOBALS['browser_name']) and $GLOBALS['browser_version'] >= 5) { |
|
| 133 | + // Numero de version pour Mozilla "authentique" |
|
| 134 | + if (preg_match(',rv:([0-9]+\.[0-9]+),', $GLOBALS['browser_description'], $match)) { |
|
| 135 | + $GLOBALS['browser_rev'] = doubleval($match[1]); |
|
| 136 | + } // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.) |
|
| 137 | + else { |
|
| 138 | + if ( |
|
| 139 | + strpos($GLOBALS['browser_description'], 'Gecko') and !strpos( |
|
| 140 | + $GLOBALS['browser_description'], |
|
| 141 | + 'KHTML' |
|
| 142 | + ) |
|
| 143 | + ) { |
|
| 144 | + $GLOBALS['browser_rev'] = 1.4; |
|
| 145 | + } // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.) |
|
| 146 | + else { |
|
| 147 | + $GLOBALS['browser_rev'] = 1.0; |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | + $GLOBALS['browser_barre'] = $GLOBALS['browser_rev'] >= 1.3; |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + if (!$GLOBALS['browser_name']) { |
|
| 158 | + $GLOBALS['browser_name'] = 'Mozilla'; |
|
| 159 | + } |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | verif_butineur(); |
@@ -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 | // Les parametres generaux du site sont dans une table SQL; |
@@ -27,51 +27,51 @@ discard block |
||
| 27 | 27 | define('_META_CACHE_TIME', 1 << 24); |
| 28 | 28 | |
| 29 | 29 | function inc_meta_dist($table = 'meta') { |
| 30 | - $new = null; |
|
| 31 | - // Lire les meta, en cache si present, valide et lisible |
|
| 32 | - // en cas d'install ne pas faire confiance au meta_cache eventuel |
|
| 33 | - $cache = cache_meta($table); |
|
| 30 | + $new = null; |
|
| 31 | + // Lire les meta, en cache si present, valide et lisible |
|
| 32 | + // en cas d'install ne pas faire confiance au meta_cache eventuel |
|
| 33 | + $cache = cache_meta($table); |
|
| 34 | 34 | |
| 35 | - if ( |
|
| 36 | - (!$exec = _request('exec') or !autoriser_sans_cookie($exec)) |
|
| 37 | - and $new = jeune_fichier($cache, _META_CACHE_TIME) |
|
| 38 | - and lire_fichier_securise($cache, $meta) |
|
| 39 | - and $meta = @unserialize($meta) |
|
| 40 | - ) { |
|
| 41 | - $GLOBALS[$table] = $meta; |
|
| 42 | - } |
|
| 35 | + if ( |
|
| 36 | + (!$exec = _request('exec') or !autoriser_sans_cookie($exec)) |
|
| 37 | + and $new = jeune_fichier($cache, _META_CACHE_TIME) |
|
| 38 | + and lire_fichier_securise($cache, $meta) |
|
| 39 | + and $meta = @unserialize($meta) |
|
| 40 | + ) { |
|
| 41 | + $GLOBALS[$table] = $meta; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - if ( |
|
| 45 | - isset($GLOBALS[$table]['touch']) |
|
| 46 | - and ($GLOBALS[$table]['touch'] < time() - _META_CACHE_TIME) |
|
| 47 | - ) { |
|
| 48 | - $GLOBALS[$table] = []; |
|
| 49 | - } |
|
| 50 | - // sinon lire en base |
|
| 51 | - if (!$GLOBALS[$table]) { |
|
| 52 | - $new = !lire_metas($table); |
|
| 53 | - } |
|
| 44 | + if ( |
|
| 45 | + isset($GLOBALS[$table]['touch']) |
|
| 46 | + and ($GLOBALS[$table]['touch'] < time() - _META_CACHE_TIME) |
|
| 47 | + ) { |
|
| 48 | + $GLOBALS[$table] = []; |
|
| 49 | + } |
|
| 50 | + // sinon lire en base |
|
| 51 | + if (!$GLOBALS[$table]) { |
|
| 52 | + $new = !lire_metas($table); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - // renouveller l'alea general si trop vieux ou sur demande explicite |
|
| 56 | - if ( |
|
| 57 | - (test_espace_prive() || isset($_GET['renouvelle_alea'])) |
|
| 58 | - and $GLOBALS[$table] |
|
| 59 | - and (time() > _RENOUVELLE_ALEA + ($GLOBALS['meta']['alea_ephemere_date'] ?? 0)) |
|
| 60 | - ) { |
|
| 61 | - // si on n'a pas l'acces en ecriture sur le cache, |
|
| 62 | - // ne pas renouveller l'alea sinon le cache devient faux |
|
| 63 | - if (supprimer_fichier($cache)) { |
|
| 64 | - include_spip('inc/acces'); |
|
| 65 | - renouvelle_alea(); |
|
| 66 | - $new = false; |
|
| 67 | - } else { |
|
| 68 | - spip_log("impossible d'ecrire dans " . $cache); |
|
| 69 | - } |
|
| 70 | - } |
|
| 71 | - // et refaire le cache si on a du lire en base |
|
| 72 | - if (!$new) { |
|
| 73 | - touch_meta(false, $table); |
|
| 74 | - } |
|
| 55 | + // renouveller l'alea general si trop vieux ou sur demande explicite |
|
| 56 | + if ( |
|
| 57 | + (test_espace_prive() || isset($_GET['renouvelle_alea'])) |
|
| 58 | + and $GLOBALS[$table] |
|
| 59 | + and (time() > _RENOUVELLE_ALEA + ($GLOBALS['meta']['alea_ephemere_date'] ?? 0)) |
|
| 60 | + ) { |
|
| 61 | + // si on n'a pas l'acces en ecriture sur le cache, |
|
| 62 | + // ne pas renouveller l'alea sinon le cache devient faux |
|
| 63 | + if (supprimer_fichier($cache)) { |
|
| 64 | + include_spip('inc/acces'); |
|
| 65 | + renouvelle_alea(); |
|
| 66 | + $new = false; |
|
| 67 | + } else { |
|
| 68 | + spip_log("impossible d'ecrire dans " . $cache); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + // et refaire le cache si on a du lire en base |
|
| 72 | + if (!$new) { |
|
| 73 | + touch_meta(false, $table); |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // fonctions aussi appelees a l'install ==> spip_query en premiere requete |
@@ -79,39 +79,39 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | function lire_metas($table = 'meta') { |
| 81 | 81 | |
| 82 | - if ($result = spip_query("SELECT nom,valeur FROM spip_$table")) { |
|
| 83 | - include_spip('base/abstract_sql'); |
|
| 84 | - $GLOBALS[$table] = []; |
|
| 85 | - while ($row = sql_fetch($result)) { |
|
| 86 | - $GLOBALS[$table][$row['nom']] = $row['valeur']; |
|
| 87 | - } |
|
| 88 | - sql_free($result); |
|
| 82 | + if ($result = spip_query("SELECT nom,valeur FROM spip_$table")) { |
|
| 83 | + include_spip('base/abstract_sql'); |
|
| 84 | + $GLOBALS[$table] = []; |
|
| 85 | + while ($row = sql_fetch($result)) { |
|
| 86 | + $GLOBALS[$table][$row['nom']] = $row['valeur']; |
|
| 87 | + } |
|
| 88 | + sql_free($result); |
|
| 89 | 89 | |
| 90 | - if ( |
|
| 91 | - !isset($GLOBALS[$table]['charset']) |
|
| 92 | - or !$GLOBALS[$table]['charset'] |
|
| 93 | - or $GLOBALS[$table]['charset'] == '_DEFAULT_CHARSET' // hum, correction d'un bug ayant abime quelques install |
|
| 94 | - ) { |
|
| 95 | - ecrire_meta('charset', _DEFAULT_CHARSET, null, $table); |
|
| 96 | - } |
|
| 90 | + if ( |
|
| 91 | + !isset($GLOBALS[$table]['charset']) |
|
| 92 | + or !$GLOBALS[$table]['charset'] |
|
| 93 | + or $GLOBALS[$table]['charset'] == '_DEFAULT_CHARSET' // hum, correction d'un bug ayant abime quelques install |
|
| 94 | + ) { |
|
| 95 | + ecrire_meta('charset', _DEFAULT_CHARSET, null, $table); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - // noter cette table de configuration dans les meta de SPIP |
|
| 99 | - if ($table !== 'meta') { |
|
| 100 | - $liste = []; |
|
| 101 | - if (isset($GLOBALS['meta']['tables_config'])) { |
|
| 102 | - $liste = unserialize($GLOBALS['meta']['tables_config']); |
|
| 103 | - } |
|
| 104 | - if (!$liste) { |
|
| 105 | - $liste = []; |
|
| 106 | - } |
|
| 107 | - if (!in_array($table, $liste)) { |
|
| 108 | - $liste[] = $table; |
|
| 109 | - ecrire_meta('tables_config', serialize($liste)); |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - } |
|
| 98 | + // noter cette table de configuration dans les meta de SPIP |
|
| 99 | + if ($table !== 'meta') { |
|
| 100 | + $liste = []; |
|
| 101 | + if (isset($GLOBALS['meta']['tables_config'])) { |
|
| 102 | + $liste = unserialize($GLOBALS['meta']['tables_config']); |
|
| 103 | + } |
|
| 104 | + if (!$liste) { |
|
| 105 | + $liste = []; |
|
| 106 | + } |
|
| 107 | + if (!in_array($table, $liste)) { |
|
| 108 | + $liste[] = $table; |
|
| 109 | + ecrire_meta('tables_config', serialize($liste)); |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - return $GLOBALS[$table] ?? null; |
|
| 114 | + return $GLOBALS[$table] ?? null; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
@@ -125,22 +125,22 @@ discard block |
||
| 125 | 125 | * Table SQL d'enregistrement des meta. |
| 126 | 126 | **/ |
| 127 | 127 | function touch_meta($antidate = false, $table = 'meta') { |
| 128 | - $file = cache_meta($table); |
|
| 129 | - if (!$antidate or !@touch($file, $antidate)) { |
|
| 130 | - $r = $GLOBALS[$table] ?? []; |
|
| 131 | - if ($table == 'meta') { |
|
| 132 | - unset($r['alea_ephemere']); |
|
| 133 | - unset($r['alea_ephemere_ancien']); |
|
| 134 | - // le secret du site est utilise pour encoder les contextes ajax que l'on considere fiables |
|
| 135 | - // mais le sortir deu cache meta implique une requete sql des qu'on a un form dynamique |
|
| 136 | - // meme si son squelette est en cache |
|
| 137 | - //unset($r['secret_du_site']); |
|
| 138 | - if ($antidate) { |
|
| 139 | - $r['touch'] = $antidate; |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - ecrire_fichier_securise($file, serialize($r)); |
|
| 143 | - } |
|
| 128 | + $file = cache_meta($table); |
|
| 129 | + if (!$antidate or !@touch($file, $antidate)) { |
|
| 130 | + $r = $GLOBALS[$table] ?? []; |
|
| 131 | + if ($table == 'meta') { |
|
| 132 | + unset($r['alea_ephemere']); |
|
| 133 | + unset($r['alea_ephemere_ancien']); |
|
| 134 | + // le secret du site est utilise pour encoder les contextes ajax que l'on considere fiables |
|
| 135 | + // mais le sortir deu cache meta implique une requete sql des qu'on a un form dynamique |
|
| 136 | + // meme si son squelette est en cache |
|
| 137 | + //unset($r['secret_du_site']); |
|
| 138 | + if ($antidate) { |
|
| 139 | + $r['touch'] = $antidate; |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + ecrire_fichier_securise($file, serialize($r)); |
|
| 143 | + } |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | * Table SQL d'enregistrement de la meta. |
| 157 | 157 | **/ |
| 158 | 158 | function effacer_meta($nom, $table = 'meta') { |
| 159 | - // section critique sur le cache: |
|
| 160 | - // l'invalider avant et apres la MAJ de la BD |
|
| 161 | - // c'est un peu moins bien qu'un vrai verrou mais ca suffira |
|
| 162 | - // et utiliser une statique pour eviter des acces disques a repetition |
|
| 163 | - static $touch = []; |
|
| 164 | - $antidate = time() - (_META_CACHE_TIME << 4); |
|
| 165 | - if (!isset($touch[$table])) { |
|
| 166 | - touch_meta($antidate, $table); |
|
| 167 | - } |
|
| 168 | - sql_delete('spip_' . $table, "nom='$nom'", '', 'continue'); |
|
| 169 | - unset($GLOBALS[$table][$nom]); |
|
| 170 | - if (!isset($touch[$table])) { |
|
| 171 | - touch_meta($antidate, $table); |
|
| 172 | - $touch[$table] = false; |
|
| 173 | - } |
|
| 159 | + // section critique sur le cache: |
|
| 160 | + // l'invalider avant et apres la MAJ de la BD |
|
| 161 | + // c'est un peu moins bien qu'un vrai verrou mais ca suffira |
|
| 162 | + // et utiliser une statique pour eviter des acces disques a repetition |
|
| 163 | + static $touch = []; |
|
| 164 | + $antidate = time() - (_META_CACHE_TIME << 4); |
|
| 165 | + if (!isset($touch[$table])) { |
|
| 166 | + touch_meta($antidate, $table); |
|
| 167 | + } |
|
| 168 | + sql_delete('spip_' . $table, "nom='$nom'", '', 'continue'); |
|
| 169 | + unset($GLOBALS[$table][$nom]); |
|
| 170 | + if (!isset($touch[$table])) { |
|
| 171 | + touch_meta($antidate, $table); |
|
| 172 | + $touch[$table] = false; |
|
| 173 | + } |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -191,53 +191,53 @@ discard block |
||
| 191 | 191 | **/ |
| 192 | 192 | function ecrire_meta($nom, $valeur, $importable = null, $table = 'meta') { |
| 193 | 193 | |
| 194 | - static $touch = []; |
|
| 195 | - if (!$nom) { |
|
| 196 | - return; |
|
| 197 | - } |
|
| 198 | - include_spip('base/abstract_sql'); |
|
| 199 | - $res = sql_select('*', 'spip_' . $table, 'nom=' . sql_quote($nom), '', '', '', '', '', 'continue'); |
|
| 200 | - // table pas encore installee, travailler en php seulement |
|
| 201 | - if (!$res) { |
|
| 202 | - $GLOBALS[$table][$nom] = $valeur; |
|
| 194 | + static $touch = []; |
|
| 195 | + if (!$nom) { |
|
| 196 | + return; |
|
| 197 | + } |
|
| 198 | + include_spip('base/abstract_sql'); |
|
| 199 | + $res = sql_select('*', 'spip_' . $table, 'nom=' . sql_quote($nom), '', '', '', '', '', 'continue'); |
|
| 200 | + // table pas encore installee, travailler en php seulement |
|
| 201 | + if (!$res) { |
|
| 202 | + $GLOBALS[$table][$nom] = $valeur; |
|
| 203 | 203 | |
| 204 | - return; |
|
| 205 | - } |
|
| 206 | - $row = sql_fetch($res); |
|
| 207 | - sql_free($res); |
|
| 204 | + return; |
|
| 205 | + } |
|
| 206 | + $row = sql_fetch($res); |
|
| 207 | + sql_free($res); |
|
| 208 | 208 | |
| 209 | - // ne pas invalider le cache si affectation a l'identique |
|
| 210 | - // (tant pis si impt aurait du changer) |
|
| 211 | - if ( |
|
| 212 | - $row and $valeur == $row['valeur'] |
|
| 213 | - and isset($GLOBALS[$table][$nom]) |
|
| 214 | - and $GLOBALS[$table][$nom] == $valeur |
|
| 215 | - ) { |
|
| 216 | - return; |
|
| 217 | - } |
|
| 209 | + // ne pas invalider le cache si affectation a l'identique |
|
| 210 | + // (tant pis si impt aurait du changer) |
|
| 211 | + if ( |
|
| 212 | + $row and $valeur == $row['valeur'] |
|
| 213 | + and isset($GLOBALS[$table][$nom]) |
|
| 214 | + and $GLOBALS[$table][$nom] == $valeur |
|
| 215 | + ) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - $GLOBALS[$table][$nom] = $valeur; |
|
| 220 | - // cf effacer pour comprendre le double touch |
|
| 221 | - $antidate = time() - (_META_CACHE_TIME << 1); |
|
| 222 | - if (!isset($touch[$table])) { |
|
| 223 | - touch_meta($antidate, $table); |
|
| 224 | - } |
|
| 225 | - $r = ['nom' => sql_quote($nom, '', 'text'), 'valeur' => sql_quote($valeur, '', 'text')]; |
|
| 226 | - // Gaffe aux tables sans impt (vieilles versions de SPIP notamment) |
|
| 227 | - // ici on utilise pas sql_updateq et sql_insertq pour ne pas provoquer trop tot |
|
| 228 | - // de lecture des descriptions des tables |
|
| 229 | - if ($importable and isset($row['impt'])) { |
|
| 230 | - $r['impt'] = sql_quote($importable, '', 'text'); |
|
| 231 | - } |
|
| 232 | - if ($row) { |
|
| 233 | - sql_update('spip_' . $table, $r, 'nom=' . sql_quote($nom)); |
|
| 234 | - } else { |
|
| 235 | - sql_insert('spip_' . $table, '(' . join(',', array_keys($r)) . ')', '(' . join(',', array_values($r)) . ')'); |
|
| 236 | - } |
|
| 237 | - if (!isset($touch[$table])) { |
|
| 238 | - touch_meta($antidate, $table); |
|
| 239 | - $touch[$table] = false; |
|
| 240 | - } |
|
| 219 | + $GLOBALS[$table][$nom] = $valeur; |
|
| 220 | + // cf effacer pour comprendre le double touch |
|
| 221 | + $antidate = time() - (_META_CACHE_TIME << 1); |
|
| 222 | + if (!isset($touch[$table])) { |
|
| 223 | + touch_meta($antidate, $table); |
|
| 224 | + } |
|
| 225 | + $r = ['nom' => sql_quote($nom, '', 'text'), 'valeur' => sql_quote($valeur, '', 'text')]; |
|
| 226 | + // Gaffe aux tables sans impt (vieilles versions de SPIP notamment) |
|
| 227 | + // ici on utilise pas sql_updateq et sql_insertq pour ne pas provoquer trop tot |
|
| 228 | + // de lecture des descriptions des tables |
|
| 229 | + if ($importable and isset($row['impt'])) { |
|
| 230 | + $r['impt'] = sql_quote($importable, '', 'text'); |
|
| 231 | + } |
|
| 232 | + if ($row) { |
|
| 233 | + sql_update('spip_' . $table, $r, 'nom=' . sql_quote($nom)); |
|
| 234 | + } else { |
|
| 235 | + sql_insert('spip_' . $table, '(' . join(',', array_keys($r)) . ')', '(' . join(',', array_values($r)) . ')'); |
|
| 236 | + } |
|
| 237 | + if (!isset($touch[$table])) { |
|
| 238 | + touch_meta($antidate, $table); |
|
| 239 | + $touch[$table] = false; |
|
| 240 | + } |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * Nom du fichier cache |
| 250 | 250 | **/ |
| 251 | 251 | function cache_meta($table = 'meta') { |
| 252 | - return ($table == 'meta') ? _FILE_META : (_DIR_CACHE . $table . '.php'); |
|
| 252 | + return ($table == 'meta') ? _FILE_META : (_DIR_CACHE . $table . '.php'); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | * @param string $table |
| 259 | 259 | */ |
| 260 | 260 | function installer_table_meta($table) { |
| 261 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 262 | - if (!$trouver_table("spip_$table")) { |
|
| 263 | - include_spip('base/auxiliaires'); |
|
| 264 | - include_spip('base/create'); |
|
| 265 | - creer_ou_upgrader_table("spip_$table", $GLOBALS['tables_auxiliaires']['spip_meta'], false, false); |
|
| 266 | - $trouver_table(''); |
|
| 267 | - } |
|
| 268 | - lire_metas($table); |
|
| 261 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 262 | + if (!$trouver_table("spip_$table")) { |
|
| 263 | + include_spip('base/auxiliaires'); |
|
| 264 | + include_spip('base/create'); |
|
| 265 | + creer_ou_upgrader_table("spip_$table", $GLOBALS['tables_auxiliaires']['spip_meta'], false, false); |
|
| 266 | + $trouver_table(''); |
|
| 267 | + } |
|
| 268 | + lire_metas($table); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -277,47 +277,47 @@ discard block |
||
| 277 | 277 | * @param bool $force |
| 278 | 278 | */ |
| 279 | 279 | function supprimer_table_meta($table, $force = false) { |
| 280 | - if ($table !== 'meta') { |
|
| 281 | - // Vérifier le contenu restant de la table |
|
| 282 | - $nb_variables = sql_countsel("spip_$table"); |
|
| 280 | + if ($table !== 'meta') { |
|
| 281 | + // Vérifier le contenu restant de la table |
|
| 282 | + $nb_variables = sql_countsel("spip_$table"); |
|
| 283 | 283 | |
| 284 | - // Supprimer si : |
|
| 285 | - // - la table est vide |
|
| 286 | - // - ou limitée à la variable charset |
|
| 287 | - // - ou qu'on force la suppression |
|
| 288 | - if ( |
|
| 289 | - $force |
|
| 290 | - or !$nb_variables |
|
| 291 | - or ( |
|
| 292 | - ($nb_variables == 1) |
|
| 293 | - and isset($GLOBALS[$table]['charset']) |
|
| 294 | - ) |
|
| 295 | - ) { |
|
| 296 | - // Supprimer la table des globaleset de la base |
|
| 297 | - unset($GLOBALS[$table]); |
|
| 298 | - sql_drop_table("spip_$table"); |
|
| 299 | - // Supprimer le fichier cache |
|
| 300 | - include_spip('inc/flock'); |
|
| 301 | - $cache = cache_meta($table); |
|
| 302 | - supprimer_fichier($cache); |
|
| 284 | + // Supprimer si : |
|
| 285 | + // - la table est vide |
|
| 286 | + // - ou limitée à la variable charset |
|
| 287 | + // - ou qu'on force la suppression |
|
| 288 | + if ( |
|
| 289 | + $force |
|
| 290 | + or !$nb_variables |
|
| 291 | + or ( |
|
| 292 | + ($nb_variables == 1) |
|
| 293 | + and isset($GLOBALS[$table]['charset']) |
|
| 294 | + ) |
|
| 295 | + ) { |
|
| 296 | + // Supprimer la table des globaleset de la base |
|
| 297 | + unset($GLOBALS[$table]); |
|
| 298 | + sql_drop_table("spip_$table"); |
|
| 299 | + // Supprimer le fichier cache |
|
| 300 | + include_spip('inc/flock'); |
|
| 301 | + $cache = cache_meta($table); |
|
| 302 | + supprimer_fichier($cache); |
|
| 303 | 303 | |
| 304 | - // vider le cache des tables |
|
| 305 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 306 | - $trouver_table(''); |
|
| 304 | + // vider le cache des tables |
|
| 305 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 306 | + $trouver_table(''); |
|
| 307 | 307 | |
| 308 | - // Supprimer la table de la liste des tables de configuration autres que spip_meta |
|
| 309 | - if (isset($GLOBALS['meta']['tables_config'])) { |
|
| 310 | - $liste = unserialize($GLOBALS['meta']['tables_config']); |
|
| 311 | - $cle = array_search($table, $liste); |
|
| 312 | - if ($cle !== false) { |
|
| 313 | - unset($liste[$cle]); |
|
| 314 | - if ($liste) { |
|
| 315 | - ecrire_meta('tables_config', serialize($liste)); |
|
| 316 | - } else { |
|
| 317 | - effacer_meta('tables_config'); |
|
| 318 | - } |
|
| 319 | - } |
|
| 320 | - } |
|
| 321 | - } |
|
| 322 | - } |
|
| 308 | + // Supprimer la table de la liste des tables de configuration autres que spip_meta |
|
| 309 | + if (isset($GLOBALS['meta']['tables_config'])) { |
|
| 310 | + $liste = unserialize($GLOBALS['meta']['tables_config']); |
|
| 311 | + $cle = array_search($table, $liste); |
|
| 312 | + if ($cle !== false) { |
|
| 313 | + unset($liste[$cle]); |
|
| 314 | + if ($liste) { |
|
| 315 | + ecrire_meta('tables_config', serialize($liste)); |
|
| 316 | + } else { |
|
| 317 | + effacer_meta('tables_config'); |
|
| 318 | + } |
|
| 319 | + } |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | 323 | } |