@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/minipres'); |
@@ -41,27 +41,27 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | **/ |
| 43 | 43 | function exec_install_dist() { |
| 44 | - $etape = _request('etape'); |
|
| 45 | - $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
|
| 44 | + $etape = _request('etape'); |
|
| 45 | + $deja = (_FILE_CONNECT && analyse_fichier_connection(_FILE_CONNECT)); |
|
| 46 | 46 | |
| 47 | - // Si deja installe, on n'a plus le droit qu'a l'etape chmod |
|
| 48 | - // pour chgt post-install ou aux etapes supplementaires |
|
| 49 | - // de declaration de base externes. |
|
| 50 | - // Mais alors il faut authentifier car ecrire/index.php l'a omis |
|
| 47 | + // Si deja installe, on n'a plus le droit qu'a l'etape chmod |
|
| 48 | + // pour chgt post-install ou aux etapes supplementaires |
|
| 49 | + // de declaration de base externes. |
|
| 50 | + // Mais alors il faut authentifier car ecrire/index.php l'a omis |
|
| 51 | 51 | |
| 52 | - if ($deja && in_array($etape, ['chmod', 'sup1', 'sup2'])) { |
|
| 53 | - $auth = charger_fonction('auth', 'inc'); |
|
| 54 | - if (!$auth()) { |
|
| 55 | - verifier_visiteur(); |
|
| 56 | - $deja = (!autoriser('configurer')); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - if ($deja) { |
|
| 60 | - // Rien a faire ici |
|
| 61 | - echo minipres(); |
|
| 62 | - } else { |
|
| 63 | - include_spip('base/create'); |
|
| 64 | - $fonc = charger_fonction("etape_$etape", 'install'); |
|
| 65 | - $fonc(); |
|
| 66 | - } |
|
| 52 | + if ($deja && in_array($etape, ['chmod', 'sup1', 'sup2'])) { |
|
| 53 | + $auth = charger_fonction('auth', 'inc'); |
|
| 54 | + if (!$auth()) { |
|
| 55 | + verifier_visiteur(); |
|
| 56 | + $deja = (!autoriser('configurer')); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + if ($deja) { |
|
| 60 | + // Rien a faire ici |
|
| 61 | + echo minipres(); |
|
| 62 | + } else { |
|
| 63 | + include_spip('base/create'); |
|
| 64 | + $fonc = charger_fonction("etape_$etape", 'install'); |
|
| 65 | + $fonc(); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/actions'); |
@@ -29,70 +29,70 @@ discard block |
||
| 29 | 29 | **/ |
| 30 | 30 | function exec_upgrade_dist() { |
| 31 | 31 | |
| 32 | - if (!_FILE_CONNECT) { |
|
| 33 | - redirige_url_ecrire('install'); |
|
| 34 | - } |
|
| 32 | + if (!_FILE_CONNECT) { |
|
| 33 | + redirige_url_ecrire('install'); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - // Si reinstallation necessaire, message ad hoc |
|
| 37 | - if (_request('reinstall') == 'oui') { |
|
| 38 | - include_spip('inc/minipres'); |
|
| 39 | - $r = minipres( |
|
| 40 | - _T('titre_page_upgrade'), |
|
| 41 | - '<p><b>' |
|
| 42 | - . _T('texte_nouvelle_version_spip_1') |
|
| 43 | - . '</b><p> ' |
|
| 44 | - . _T( |
|
| 45 | - 'texte_nouvelle_version_spip_2', |
|
| 46 | - ['connect' => '<tt>' . _FILE_CONNECT . '</tt>'] |
|
| 47 | - ) |
|
| 48 | - . generer_form_ecrire( |
|
| 49 | - 'upgrade', |
|
| 50 | - "<input type='hidden' name='reinstall' value='non' />", |
|
| 51 | - '', |
|
| 52 | - _T('bouton_relancer_installation') |
|
| 53 | - ) |
|
| 54 | - ); |
|
| 55 | - echo $r; |
|
| 56 | - } elseif (_request('fin')) { |
|
| 57 | - include_spip('inc/plugin'); |
|
| 58 | - actualise_plugins_actifs(); |
|
| 59 | - include_spip('inc/headers'); |
|
| 60 | - $res = generer_url_ecrire('admin_plugin', 'var_mode=recalcul'); |
|
| 61 | - echo redirige_formulaire($res); |
|
| 62 | - } else { |
|
| 63 | - if (!isset($GLOBALS['meta']['version_installee'])) { |
|
| 64 | - $GLOBALS['meta']['version_installee'] = 0.0; |
|
| 65 | - } else { |
|
| 66 | - $GLOBALS['meta']['version_installee'] = |
|
| 67 | - (double) str_replace(',', '.', (string) $GLOBALS['meta']['version_installee']); |
|
| 68 | - } |
|
| 69 | - # NB: str_replace car, sur club-internet, il semble que version_installe soit |
|
| 70 | - # enregistree au format '1,812' et non '1.812' |
|
| 36 | + // Si reinstallation necessaire, message ad hoc |
|
| 37 | + if (_request('reinstall') == 'oui') { |
|
| 38 | + include_spip('inc/minipres'); |
|
| 39 | + $r = minipres( |
|
| 40 | + _T('titre_page_upgrade'), |
|
| 41 | + '<p><b>' |
|
| 42 | + . _T('texte_nouvelle_version_spip_1') |
|
| 43 | + . '</b><p> ' |
|
| 44 | + . _T( |
|
| 45 | + 'texte_nouvelle_version_spip_2', |
|
| 46 | + ['connect' => '<tt>' . _FILE_CONNECT . '</tt>'] |
|
| 47 | + ) |
|
| 48 | + . generer_form_ecrire( |
|
| 49 | + 'upgrade', |
|
| 50 | + "<input type='hidden' name='reinstall' value='non' />", |
|
| 51 | + '', |
|
| 52 | + _T('bouton_relancer_installation') |
|
| 53 | + ) |
|
| 54 | + ); |
|
| 55 | + echo $r; |
|
| 56 | + } elseif (_request('fin')) { |
|
| 57 | + include_spip('inc/plugin'); |
|
| 58 | + actualise_plugins_actifs(); |
|
| 59 | + include_spip('inc/headers'); |
|
| 60 | + $res = generer_url_ecrire('admin_plugin', 'var_mode=recalcul'); |
|
| 61 | + echo redirige_formulaire($res); |
|
| 62 | + } else { |
|
| 63 | + if (!isset($GLOBALS['meta']['version_installee'])) { |
|
| 64 | + $GLOBALS['meta']['version_installee'] = 0.0; |
|
| 65 | + } else { |
|
| 66 | + $GLOBALS['meta']['version_installee'] = |
|
| 67 | + (double) str_replace(',', '.', (string) $GLOBALS['meta']['version_installee']); |
|
| 68 | + } |
|
| 69 | + # NB: str_replace car, sur club-internet, il semble que version_installe soit |
|
| 70 | + # enregistree au format '1,812' et non '1.812' |
|
| 71 | 71 | |
| 72 | - // Erreur downgrade |
|
| 73 | - // (cas de double installation de fichiers SPIP sur une meme base) |
|
| 74 | - if ($GLOBALS['spip_version_base'] < $GLOBALS['meta']['version_installee']) { |
|
| 75 | - $commentaire = _T('info_mise_a_niveau_base_2'); |
|
| 76 | - } // Commentaire standard upgrade |
|
| 77 | - else { |
|
| 78 | - $commentaire = _T('texte_mise_a_niveau_base_1'); |
|
| 79 | - } |
|
| 72 | + // Erreur downgrade |
|
| 73 | + // (cas de double installation de fichiers SPIP sur une meme base) |
|
| 74 | + if ($GLOBALS['spip_version_base'] < $GLOBALS['meta']['version_installee']) { |
|
| 75 | + $commentaire = _T('info_mise_a_niveau_base_2'); |
|
| 76 | + } // Commentaire standard upgrade |
|
| 77 | + else { |
|
| 78 | + $commentaire = _T('texte_mise_a_niveau_base_1'); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - $commentaire .= '<br />[' . $GLOBALS['meta']['version_installee'] . '/' . $GLOBALS['spip_version_base'] . ']'; |
|
| 81 | + $commentaire .= '<br />[' . $GLOBALS['meta']['version_installee'] . '/' . $GLOBALS['spip_version_base'] . ']'; |
|
| 82 | 82 | |
| 83 | - $_POST['reinstall'] = 'non'; // pour copy_request dans admin |
|
| 84 | - include_spip('inc/headers'); |
|
| 85 | - $admin = charger_fonction('admin', 'inc'); |
|
| 86 | - $res = $admin('upgrade', _T('info_mise_a_niveau_base'), $commentaire); |
|
| 87 | - if ($res) { |
|
| 88 | - echo $res; |
|
| 89 | - } else { |
|
| 90 | - // effacer les alea pour forcer leur relecture |
|
| 91 | - // si jamais ils ont change pendant l'upgrade |
|
| 92 | - unset($GLOBALS['meta']['alea_ephemere']); |
|
| 93 | - unset($GLOBALS['meta']['alea_ephemere_ancien']); |
|
| 94 | - $res = redirige_action_auteur('purger', 'cache', 'upgrade', 'fin=oui', true); |
|
| 95 | - echo redirige_formulaire($res); |
|
| 96 | - } |
|
| 97 | - } |
|
| 83 | + $_POST['reinstall'] = 'non'; // pour copy_request dans admin |
|
| 84 | + include_spip('inc/headers'); |
|
| 85 | + $admin = charger_fonction('admin', 'inc'); |
|
| 86 | + $res = $admin('upgrade', _T('info_mise_a_niveau_base'), $commentaire); |
|
| 87 | + if ($res) { |
|
| 88 | + echo $res; |
|
| 89 | + } else { |
|
| 90 | + // effacer les alea pour forcer leur relecture |
|
| 91 | + // si jamais ils ont change pendant l'upgrade |
|
| 92 | + unset($GLOBALS['meta']['alea_ephemere']); |
|
| 93 | + unset($GLOBALS['meta']['alea_ephemere_ancien']); |
|
| 94 | + $res = redirige_action_auteur('purger', 'cache', 'upgrade', 'fin=oui', true); |
|
| 95 | + echo redirige_formulaire($res); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | . '</b><p> ' |
| 44 | 44 | . _T( |
| 45 | 45 | 'texte_nouvelle_version_spip_2', |
| 46 | - ['connect' => '<tt>' . _FILE_CONNECT . '</tt>'] |
|
| 46 | + ['connect' => '<tt>'._FILE_CONNECT.'</tt>'] |
|
| 47 | 47 | ) |
| 48 | 48 | . generer_form_ecrire( |
| 49 | 49 | 'upgrade', |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $commentaire = _T('texte_mise_a_niveau_base_1'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $commentaire .= '<br />[' . $GLOBALS['meta']['version_installee'] . '/' . $GLOBALS['spip_version_base'] . ']'; |
|
| 81 | + $commentaire .= '<br />['.$GLOBALS['meta']['version_installee'].'/'.$GLOBALS['spip_version_base'].']'; |
|
| 82 | 82 | |
| 83 | 83 | $_POST['reinstall'] = 'non'; // pour copy_request dans admin |
| 84 | 84 | include_spip('inc/headers'); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -26,23 +26,23 @@ discard block |
||
| 26 | 26 | * @uses ajax_retour() |
| 27 | 27 | **/ |
| 28 | 28 | function exec_plonger_dist() { |
| 29 | - include_spip('inc/actions'); |
|
| 29 | + include_spip('inc/actions'); |
|
| 30 | 30 | |
| 31 | - $rac = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) _request('rac')); |
|
| 32 | - $id = (int) _request('id'); |
|
| 33 | - $exclus = (int) _request('exclus'); |
|
| 34 | - $col = (int) _request('col'); |
|
| 35 | - $do = _request('do'); |
|
| 36 | - if (preg_match('/^\w*$/', (string) $do)) { |
|
| 37 | - if (!$do) { |
|
| 38 | - $do = 'aff'; |
|
| 39 | - } |
|
| 31 | + $rac = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) _request('rac')); |
|
| 32 | + $id = (int) _request('id'); |
|
| 33 | + $exclus = (int) _request('exclus'); |
|
| 34 | + $col = (int) _request('col'); |
|
| 35 | + $do = _request('do'); |
|
| 36 | + if (preg_match('/^\w*$/', (string) $do)) { |
|
| 37 | + if (!$do) { |
|
| 38 | + $do = 'aff'; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $plonger = charger_fonction('plonger', 'inc'); |
|
| 42 | - $r = $plonger($id, spip_htmlentities($rac), [], $col, $exclus, $do); |
|
| 43 | - } else { |
|
| 44 | - $r = ''; |
|
| 45 | - } |
|
| 41 | + $plonger = charger_fonction('plonger', 'inc'); |
|
| 42 | + $r = $plonger($id, spip_htmlentities($rac), [], $col, $exclus, $do); |
|
| 43 | + } else { |
|
| 44 | + $r = ''; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - ajax_retour($r); |
|
| 47 | + ajax_retour($r); |
|
| 48 | 48 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | $GLOBALS['delais'] = 0;// pas de cache ! |
| 29 | 29 | // Securite |
| 30 | 30 | if (strstr((string) $fond, '/')) { |
| 31 | - if ( |
|
| 32 | - !include_spip('inc/autoriser') |
|
| 33 | - || !autoriser('webmestre') |
|
| 34 | - ) { |
|
| 35 | - include_spip('inc/minipres'); |
|
| 36 | - echo minipres(); |
|
| 37 | - exit; |
|
| 38 | - } |
|
| 31 | + if ( |
|
| 32 | + !include_spip('inc/autoriser') |
|
| 33 | + || !autoriser('webmestre') |
|
| 34 | + ) { |
|
| 35 | + include_spip('inc/minipres'); |
|
| 36 | + echo minipres(); |
|
| 37 | + exit; |
|
| 38 | + } |
|
| 39 | 39 | } else { |
| 40 | - $fond = "prive/squelettes/$fond"; |
|
| 40 | + $fond = "prive/squelettes/$fond"; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // quelques inclusions et ini prealables |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * @todo supprimer cette fonction vide ? |
| 50 | 50 | **/ |
| 51 | 51 | function shutdown_error() { |
| 52 | - // si on arrive ici avec un tampon non ferme : erreur fatale |
|
| 53 | - /* if (ob_get_level()){ |
|
| 52 | + // si on arrive ici avec un tampon non ferme : erreur fatale |
|
| 53 | + /* if (ob_get_level()){ |
|
| 54 | 54 | // envoyer tous les tampons |
| 55 | 55 | while (ob_get_level()) |
| 56 | 56 | ob_end_flush(); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | $fond = _request('exec'); |
| 28 | -$GLOBALS['delais'] = 0;// pas de cache ! |
|
| 28 | +$GLOBALS['delais'] = 0; // pas de cache ! |
|
| 29 | 29 | // Securite |
| 30 | 30 | if (strstr((string) $fond, '/')) { |
| 31 | 31 | if ( |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 10 | - return; |
|
| 10 | + return; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | include_spip('inc/actions'); |
@@ -21,23 +21,23 @@ discard block |
||
| 21 | 21 | * @uses ajax_retour() |
| 22 | 22 | */ |
| 23 | 23 | function exec_info_plugin_dist() { |
| 24 | - if (!autoriser('configurer', '_plugins')) { |
|
| 25 | - include_spip('inc/minipres'); |
|
| 26 | - echo minipres(); |
|
| 27 | - } else { |
|
| 28 | - $plug = _DIR_RACINE . htmlspecialchars((string) _request('plugin')); |
|
| 29 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | - $dir = ''; |
|
| 31 | - if (str_starts_with($plug, (string) _DIR_PLUGINS)) { |
|
| 32 | - $dir = _DIR_PLUGINS; |
|
| 33 | - } elseif (str_starts_with($plug, (string) _DIR_PLUGINS_DIST)) { |
|
| 34 | - $dir = _DIR_PLUGINS_DIST; |
|
| 35 | - } |
|
| 36 | - if ($dir) { |
|
| 37 | - $plug = substr($plug, strlen((string) $dir)); |
|
| 38 | - } |
|
| 39 | - $info = $get_infos($plug, false, $dir); |
|
| 40 | - $afficher_plugin = charger_fonction('afficher_plugin', 'plugins'); |
|
| 41 | - ajax_retour(affiche_bloc_plugin($plug, $info, $dir)); |
|
| 42 | - } |
|
| 24 | + if (!autoriser('configurer', '_plugins')) { |
|
| 25 | + include_spip('inc/minipres'); |
|
| 26 | + echo minipres(); |
|
| 27 | + } else { |
|
| 28 | + $plug = _DIR_RACINE . htmlspecialchars((string) _request('plugin')); |
|
| 29 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | + $dir = ''; |
|
| 31 | + if (str_starts_with($plug, (string) _DIR_PLUGINS)) { |
|
| 32 | + $dir = _DIR_PLUGINS; |
|
| 33 | + } elseif (str_starts_with($plug, (string) _DIR_PLUGINS_DIST)) { |
|
| 34 | + $dir = _DIR_PLUGINS_DIST; |
|
| 35 | + } |
|
| 36 | + if ($dir) { |
|
| 37 | + $plug = substr($plug, strlen((string) $dir)); |
|
| 38 | + } |
|
| 39 | + $info = $get_infos($plug, false, $dir); |
|
| 40 | + $afficher_plugin = charger_fonction('afficher_plugin', 'plugins'); |
|
| 41 | + ajax_retour(affiche_bloc_plugin($plug, $info, $dir)); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | include_spip('inc/minipres'); |
| 26 | 26 | echo minipres(); |
| 27 | 27 | } else { |
| 28 | - $plug = _DIR_RACINE . htmlspecialchars((string) _request('plugin')); |
|
| 28 | + $plug = _DIR_RACINE.htmlspecialchars((string) _request('plugin')); |
|
| 29 | 29 | $get_infos = charger_fonction('get_infos', 'plugins'); |
| 30 | 30 | $dir = ''; |
| 31 | 31 | if (str_starts_with($plug, (string) _DIR_PLUGINS)) { |
@@ -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 | include_spip('inc/actions'); |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @uses ajax_retour() |
| 32 | 32 | **/ |
| 33 | 33 | function exec_rechercher_dist() { |
| 34 | - $id = (int) _request('id'); |
|
| 35 | - $exclus = (int) _request('exclus'); |
|
| 36 | - $rac = spip_htmlentities(_request('rac')); |
|
| 37 | - $type = _request('type'); |
|
| 38 | - $do = _request('do'); |
|
| 39 | - $r = preg_match('/^\w*$/', (string) $do) ? exec_rechercher_args($id, $type, $exclus, $rac, $do) : ''; |
|
| 40 | - ajax_retour($r); |
|
| 34 | + $id = (int) _request('id'); |
|
| 35 | + $exclus = (int) _request('exclus'); |
|
| 36 | + $rac = spip_htmlentities(_request('rac')); |
|
| 37 | + $type = _request('type'); |
|
| 38 | + $do = _request('do'); |
|
| 39 | + $r = preg_match('/^\w*$/', (string) $do) ? exec_rechercher_args($id, $type, $exclus, $rac, $do) : ''; |
|
| 40 | + ajax_retour($r); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -54,61 +54,61 @@ discard block |
||
| 54 | 54 | * @return string |
| 55 | 55 | **/ |
| 56 | 56 | function exec_rechercher_args($id, $type, $exclus, $rac, $do) { |
| 57 | - if (!$do) { |
|
| 58 | - $do = 'aff'; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - $points = $rub = []; |
|
| 62 | - |
|
| 63 | - $where = preg_split(',\s+,', $type); |
|
| 64 | - if ($where) { |
|
| 65 | - foreach ($where as $k => $v) { |
|
| 66 | - $where[$k] = "'%" . substr(str_replace('%', '\%', sql_quote($v, '', 'string')), 1, -1) . "%'"; |
|
| 67 | - } |
|
| 68 | - $where_titre = ('(titre LIKE ' . implode(' AND titre LIKE ', $where) . ')'); |
|
| 69 | - $where_desc = ('(descriptif LIKE ' . implode(' AND descriptif LIKE ', $where) . ')'); |
|
| 70 | - $where_id = ('(id_rubrique = ' . (int) $type . ')'); |
|
| 71 | - |
|
| 72 | - if ($exclus) { |
|
| 73 | - include_spip('inc/rubriques'); |
|
| 74 | - $where_exclus = ' AND ' . sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 75 | - } else { |
|
| 76 | - $where_exclus = ''; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - foreach ( |
|
| 80 | - [ |
|
| 81 | - 3 => $where_titre, |
|
| 82 | - 2 => $where_desc, |
|
| 83 | - 1 => $where_id, |
|
| 84 | - ] as $point => $recherche |
|
| 85 | - ) { |
|
| 86 | - $res = sql_select('id_rubrique, id_parent, titre', 'spip_rubriques', "$recherche$where_exclus"); |
|
| 87 | - while ($row = sql_fetch($res)) { |
|
| 88 | - $id_rubrique = $row['id_rubrique']; |
|
| 89 | - if (!isset($rub[$id_rubrique])) { |
|
| 90 | - $rub[$id_rubrique] = []; |
|
| 91 | - } |
|
| 92 | - $rub[$id_rubrique]['titre'] = typo($row['titre']); |
|
| 93 | - $rub[$id_rubrique]['id_parent'] = $row['id_parent']; |
|
| 94 | - if (!isset($points[$id_rubrique])) { |
|
| 95 | - $points[$id_rubrique] = 0; |
|
| 96 | - } |
|
| 97 | - $points[$id_rubrique] += $point; |
|
| 98 | - } |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ($points) { |
|
| 103 | - arsort($points); |
|
| 104 | - $style = " style='background-image: url(" . chemin_image('secteur-12.png') . ")'"; |
|
| 105 | - foreach ($rub as $k => $v) { |
|
| 106 | - $rub[$k]['atts'] = ($v['id_parent'] ? $style : '') |
|
| 107 | - . " class='petite-rubrique'"; |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - return (proposer_item($points, $rub, $rac, $type, $do)); |
|
| 57 | + if (!$do) { |
|
| 58 | + $do = 'aff'; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + $points = $rub = []; |
|
| 62 | + |
|
| 63 | + $where = preg_split(',\s+,', $type); |
|
| 64 | + if ($where) { |
|
| 65 | + foreach ($where as $k => $v) { |
|
| 66 | + $where[$k] = "'%" . substr(str_replace('%', '\%', sql_quote($v, '', 'string')), 1, -1) . "%'"; |
|
| 67 | + } |
|
| 68 | + $where_titre = ('(titre LIKE ' . implode(' AND titre LIKE ', $where) . ')'); |
|
| 69 | + $where_desc = ('(descriptif LIKE ' . implode(' AND descriptif LIKE ', $where) . ')'); |
|
| 70 | + $where_id = ('(id_rubrique = ' . (int) $type . ')'); |
|
| 71 | + |
|
| 72 | + if ($exclus) { |
|
| 73 | + include_spip('inc/rubriques'); |
|
| 74 | + $where_exclus = ' AND ' . sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 75 | + } else { |
|
| 76 | + $where_exclus = ''; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + foreach ( |
|
| 80 | + [ |
|
| 81 | + 3 => $where_titre, |
|
| 82 | + 2 => $where_desc, |
|
| 83 | + 1 => $where_id, |
|
| 84 | + ] as $point => $recherche |
|
| 85 | + ) { |
|
| 86 | + $res = sql_select('id_rubrique, id_parent, titre', 'spip_rubriques', "$recherche$where_exclus"); |
|
| 87 | + while ($row = sql_fetch($res)) { |
|
| 88 | + $id_rubrique = $row['id_rubrique']; |
|
| 89 | + if (!isset($rub[$id_rubrique])) { |
|
| 90 | + $rub[$id_rubrique] = []; |
|
| 91 | + } |
|
| 92 | + $rub[$id_rubrique]['titre'] = typo($row['titre']); |
|
| 93 | + $rub[$id_rubrique]['id_parent'] = $row['id_parent']; |
|
| 94 | + if (!isset($points[$id_rubrique])) { |
|
| 95 | + $points[$id_rubrique] = 0; |
|
| 96 | + } |
|
| 97 | + $points[$id_rubrique] += $point; |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ($points) { |
|
| 103 | + arsort($points); |
|
| 104 | + $style = " style='background-image: url(" . chemin_image('secteur-12.png') . ")'"; |
|
| 105 | + foreach ($rub as $k => $v) { |
|
| 106 | + $rub[$k]['atts'] = ($v['id_parent'] ? $style : '') |
|
| 107 | + . " class='petite-rubrique'"; |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + return (proposer_item($points, $rub, $rac, $type, $do)); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
@@ -131,37 +131,37 @@ discard block |
||
| 131 | 131 | **/ |
| 132 | 132 | function proposer_item($ids, $titles, $rac, $type, $do) { |
| 133 | 133 | |
| 134 | - if (!$ids) { |
|
| 135 | - return "<br /><br /><div style='padding: 5px; color: red;'><b>" |
|
| 136 | - . spip_htmlentities($type) |
|
| 137 | - . '</b> : ' . _T('avis_aucun_resultat') . '</div>'; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - $ret = ''; |
|
| 141 | - $info = generer_url_ecrire('informer', "type=rubrique&rac=$rac&id="); |
|
| 142 | - |
|
| 143 | - $onClick = "aff_selection(this.firstChild.title,'$rac" . "_selection','$info', event)"; |
|
| 144 | - |
|
| 145 | - $ondbClick = "$do(this.firstChild.firstChild.nodeValue,this.firstChild.title,'selection_rubrique', 'id_parent');"; |
|
| 146 | - |
|
| 147 | - foreach (array_keys($ids) as $id) { |
|
| 148 | - $titre = strtr( |
|
| 149 | - str_replace("'", '’', str_replace('"', '"', (string) textebrut($titles[$id]['titre']))), |
|
| 150 | - "\n\r", |
|
| 151 | - ' ' |
|
| 152 | - ); |
|
| 153 | - |
|
| 154 | - $ret .= "<div class='highlight off'\nonclick=\"changerhighlight(this); " |
|
| 155 | - . $onClick |
|
| 156 | - . "\"\nondblclick=\"" |
|
| 157 | - . $ondbClick |
|
| 158 | - . $onClick |
|
| 159 | - . ' "><div' |
|
| 160 | - . $titles[$id]['atts'] |
|
| 161 | - . " title='$id'> " |
|
| 162 | - . $titre |
|
| 163 | - . '</div></div>'; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - return $ret; |
|
| 134 | + if (!$ids) { |
|
| 135 | + return "<br /><br /><div style='padding: 5px; color: red;'><b>" |
|
| 136 | + . spip_htmlentities($type) |
|
| 137 | + . '</b> : ' . _T('avis_aucun_resultat') . '</div>'; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + $ret = ''; |
|
| 141 | + $info = generer_url_ecrire('informer', "type=rubrique&rac=$rac&id="); |
|
| 142 | + |
|
| 143 | + $onClick = "aff_selection(this.firstChild.title,'$rac" . "_selection','$info', event)"; |
|
| 144 | + |
|
| 145 | + $ondbClick = "$do(this.firstChild.firstChild.nodeValue,this.firstChild.title,'selection_rubrique', 'id_parent');"; |
|
| 146 | + |
|
| 147 | + foreach (array_keys($ids) as $id) { |
|
| 148 | + $titre = strtr( |
|
| 149 | + str_replace("'", '’', str_replace('"', '"', (string) textebrut($titles[$id]['titre']))), |
|
| 150 | + "\n\r", |
|
| 151 | + ' ' |
|
| 152 | + ); |
|
| 153 | + |
|
| 154 | + $ret .= "<div class='highlight off'\nonclick=\"changerhighlight(this); " |
|
| 155 | + . $onClick |
|
| 156 | + . "\"\nondblclick=\"" |
|
| 157 | + . $ondbClick |
|
| 158 | + . $onClick |
|
| 159 | + . ' "><div' |
|
| 160 | + . $titles[$id]['atts'] |
|
| 161 | + . " title='$id'> " |
|
| 162 | + . $titre |
|
| 163 | + . '</div></div>'; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + return $ret; |
|
| 167 | 167 | } |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | $where = preg_split(',\s+,', $type); |
| 64 | 64 | if ($where) { |
| 65 | 65 | foreach ($where as $k => $v) { |
| 66 | - $where[$k] = "'%" . substr(str_replace('%', '\%', sql_quote($v, '', 'string')), 1, -1) . "%'"; |
|
| 66 | + $where[$k] = "'%".substr(str_replace('%', '\%', sql_quote($v, '', 'string')), 1, -1)."%'"; |
|
| 67 | 67 | } |
| 68 | - $where_titre = ('(titre LIKE ' . implode(' AND titre LIKE ', $where) . ')'); |
|
| 69 | - $where_desc = ('(descriptif LIKE ' . implode(' AND descriptif LIKE ', $where) . ')'); |
|
| 70 | - $where_id = ('(id_rubrique = ' . (int) $type . ')'); |
|
| 68 | + $where_titre = ('(titre LIKE '.implode(' AND titre LIKE ', $where).')'); |
|
| 69 | + $where_desc = ('(descriptif LIKE '.implode(' AND descriptif LIKE ', $where).')'); |
|
| 70 | + $where_id = ('(id_rubrique = '.(int) $type.')'); |
|
| 71 | 71 | |
| 72 | 72 | if ($exclus) { |
| 73 | 73 | include_spip('inc/rubriques'); |
| 74 | - $where_exclus = ' AND ' . sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 74 | + $where_exclus = ' AND '.sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 75 | 75 | } else { |
| 76 | 76 | $where_exclus = ''; |
| 77 | 77 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | if ($points) { |
| 103 | 103 | arsort($points); |
| 104 | - $style = " style='background-image: url(" . chemin_image('secteur-12.png') . ")'"; |
|
| 104 | + $style = " style='background-image: url(".chemin_image('secteur-12.png').")'"; |
|
| 105 | 105 | foreach ($rub as $k => $v) { |
| 106 | 106 | $rub[$k]['atts'] = ($v['id_parent'] ? $style : '') |
| 107 | 107 | . " class='petite-rubrique'"; |
@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | if (!$ids) { |
| 135 | 135 | return "<br /><br /><div style='padding: 5px; color: red;'><b>" |
| 136 | 136 | . spip_htmlentities($type) |
| 137 | - . '</b> : ' . _T('avis_aucun_resultat') . '</div>'; |
|
| 137 | + . '</b> : '._T('avis_aucun_resultat').'</div>'; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $ret = ''; |
| 141 | 141 | $info = generer_url_ecrire('informer', "type=rubrique&rac=$rac&id="); |
| 142 | 142 | |
| 143 | - $onClick = "aff_selection(this.firstChild.title,'$rac" . "_selection','$info', event)"; |
|
| 143 | + $onClick = "aff_selection(this.firstChild.title,'$rac"."_selection','$info', event)"; |
|
| 144 | 144 | |
| 145 | 145 | $ondbClick = "$do(this.firstChild.firstChild.nodeValue,this.firstChild.title,'selection_rubrique', 'id_parent');"; |
| 146 | 146 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package SPIP\Core\Rubriques |
| 16 | 16 | **/ |
| 17 | 17 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 18 | - return; |
|
| 18 | + return; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | include_spip('inc/actions'); |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | * @uses ajax_retour() |
| 28 | 28 | **/ |
| 29 | 29 | function exec_selectionner_dist() { |
| 30 | - $id = (int) _request('id'); |
|
| 31 | - $exclus = (int) _request('exclus'); |
|
| 32 | - $type = _request('type'); |
|
| 33 | - $rac = _request('racine'); |
|
| 34 | - $do = _request('do'); |
|
| 35 | - if (preg_match('/^\w*$/', (string) $do)) { |
|
| 36 | - if (!$do) { |
|
| 37 | - $do = 'aff'; |
|
| 38 | - } |
|
| 30 | + $id = (int) _request('id'); |
|
| 31 | + $exclus = (int) _request('exclus'); |
|
| 32 | + $type = _request('type'); |
|
| 33 | + $rac = _request('racine'); |
|
| 34 | + $do = _request('do'); |
|
| 35 | + if (preg_match('/^\w*$/', (string) $do)) { |
|
| 36 | + if (!$do) { |
|
| 37 | + $do = 'aff'; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $selectionner = charger_fonction('selectionner', 'inc'); |
|
| 40 | + $selectionner = charger_fonction('selectionner', 'inc'); |
|
| 41 | 41 | |
| 42 | - $r = $selectionner($id, 'choix_parent', $exclus, $rac, $type != 'breve', $do); |
|
| 43 | - } else { |
|
| 44 | - $r = ''; |
|
| 45 | - } |
|
| 46 | - ajax_retour($r); |
|
| 42 | + $r = $selectionner($id, 'choix_parent', $exclus, $rac, $type != 'breve', $do); |
|
| 43 | + } else { |
|
| 44 | + $r = ''; |
|
| 45 | + } |
|
| 46 | + ajax_retour($r); |
|
| 47 | 47 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/config'); |
@@ -36,26 +36,26 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function exec_admin_plugin_dist($retour = '') { |
| 38 | 38 | |
| 39 | - if (!autoriser('configurer', '_plugins')) { |
|
| 40 | - include_spip('inc/minipres'); |
|
| 41 | - echo minipres(); |
|
| 42 | - } else { |
|
| 43 | - // on fait la verif du path avant tout, |
|
| 44 | - // et l'installation des qu'on est dans la colonne principale |
|
| 45 | - // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 46 | - // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 47 | - $new = actualise_plugins_actifs(); |
|
| 48 | - if ($new && _request('actualise') < 2) { |
|
| 49 | - include_spip('inc/headers'); |
|
| 50 | - if (isset($GLOBALS['fichier_php_compile_recent'])) { |
|
| 51 | - // attendre eventuellement l'invalidation du cache opcode |
|
| 52 | - spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']); |
|
| 53 | - } |
|
| 54 | - redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise') + 1, '&')); |
|
| 55 | - } else { |
|
| 56 | - admin_plug_args(_request('voir'), _request('erreur'), _request('format')); |
|
| 57 | - } |
|
| 58 | - } |
|
| 39 | + if (!autoriser('configurer', '_plugins')) { |
|
| 40 | + include_spip('inc/minipres'); |
|
| 41 | + echo minipres(); |
|
| 42 | + } else { |
|
| 43 | + // on fait la verif du path avant tout, |
|
| 44 | + // et l'installation des qu'on est dans la colonne principale |
|
| 45 | + // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 46 | + // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 47 | + $new = actualise_plugins_actifs(); |
|
| 48 | + if ($new && _request('actualise') < 2) { |
|
| 49 | + include_spip('inc/headers'); |
|
| 50 | + if (isset($GLOBALS['fichier_php_compile_recent'])) { |
|
| 51 | + // attendre eventuellement l'invalidation du cache opcode |
|
| 52 | + spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']); |
|
| 53 | + } |
|
| 54 | + redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise') + 1, '&')); |
|
| 55 | + } else { |
|
| 56 | + admin_plug_args(_request('voir'), _request('erreur'), _request('format')); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -80,132 +80,132 @@ discard block |
||
| 80 | 80 | * Format d'affichage (liste ou arborescence) |
| 81 | 81 | **/ |
| 82 | 82 | function admin_plug_args($quoi, $erreur, $format) { |
| 83 | - $lpf = null; |
|
| 84 | - $lcpas = null; |
|
| 85 | - $lcpaffichesup = null; |
|
| 86 | - if (!$quoi) { |
|
| 87 | - $quoi = 'actifs'; |
|
| 88 | - } |
|
| 89 | - // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite |
|
| 90 | - // format brut par plugin |
|
| 91 | - $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); |
|
| 92 | - // format resume mis en forme |
|
| 93 | - $erreur_activation = plugin_donne_erreurs(); |
|
| 94 | - $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 95 | - echo $commencer_page(_T('icone_admin_plugin'), 'configuration', 'plugin'); |
|
| 96 | - |
|
| 97 | - echo debut_gauche(); |
|
| 98 | - echo recuperer_fond('prive/squelettes/navigation/configurer', ['exec' => 'admin_plugin']); |
|
| 99 | - |
|
| 100 | - echo pipeline( |
|
| 101 | - 'affiche_gauche', |
|
| 102 | - [ |
|
| 103 | - 'args' => ['exec' => 'admin_plugin'], |
|
| 104 | - 'data' => afficher_librairies() |
|
| 105 | - ] |
|
| 106 | - ); |
|
| 107 | - |
|
| 108 | - echo debut_droite(); |
|
| 109 | - echo gros_titre(_T('icone_admin_plugin'), ''); |
|
| 110 | - |
|
| 111 | - // Barre d'onglets de premier niveau |
|
| 112 | - echo barre_onglets('plugins', 'plugins_actifs'); |
|
| 113 | - // Barre d'onglets de second niveau |
|
| 114 | - $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; |
|
| 115 | - echo debut_onglet('onglets_simple second'); |
|
| 116 | - echo onglet(_T('plugins_tous_liste'), generer_url_ecrire('admin_plugin', 'voir=tous'), 'admin_plugin', $onglet2); |
|
| 117 | - echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire('admin_plugin'), 'plugins_actifs', $onglet2); |
|
| 118 | - echo fin_onglet(); |
|
| 119 | - |
|
| 120 | - // message d'erreur au retour d'une operation |
|
| 121 | - if ($erreur) { |
|
| 122 | - echo "<div class='error'>" . spip_htmlspecialchars($erreur) . '</div>'; |
|
| 123 | - } |
|
| 124 | - if ($erreur_activation) { |
|
| 125 | - echo "<div class='error'>$erreur_activation</div>"; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs |
|
| 129 | - $actifs = (array) unserialize($GLOBALS['meta']['plugin']); |
|
| 130 | - $lcpa = $actifs + (array) unserialize($GLOBALS['meta']['plugin_attente']); |
|
| 131 | - |
|
| 132 | - // Les affichages se basent sur le repertoire, pas sur le nom |
|
| 133 | - $actifs = liste_chemin_plugin($actifs, ''); |
|
| 134 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 135 | - $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); |
|
| 136 | - } |
|
| 137 | - $lcpa = liste_chemin_plugin($lcpa); |
|
| 138 | - |
|
| 139 | - // on installe les plugins maintenant, |
|
| 140 | - // cela permet aux scripts d'install de faire des affichages (moches...) |
|
| 141 | - plugin_installes_meta(); |
|
| 142 | - |
|
| 143 | - echo "<div class='liste-plugins formulaire_spip'>"; |
|
| 144 | - echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); |
|
| 145 | - |
|
| 146 | - if ($quoi !== 'actifs') { |
|
| 147 | - $lpf = liste_plugin_files(); |
|
| 148 | - if ($lpf) { |
|
| 149 | - echo '<p>' . _T('texte_presente_plugin') . '</p>'; |
|
| 150 | - } else { |
|
| 151 | - if (!@is_dir(_DIR_PLUGINS)) { |
|
| 152 | - echo '<p>' . _T('plugin_info_automatique_ftp', ['rep' => joli_repertoire(_DIR_PLUGINS)]) |
|
| 153 | - . ' — ' . _T('plugin_info_automatique_creer') . '</p>'; |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - $lcpaffiche = $lpf; |
|
| 157 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 158 | - $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); |
|
| 159 | - } |
|
| 160 | - } else { |
|
| 161 | - // la liste |
|
| 162 | - // $quoi=='actifs' |
|
| 163 | - $lcpaffiche = $lcpa; |
|
| 164 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 165 | - $lcpaffichesup = $lcpas; |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - if ($quoi == 'actifs' || $lpf) { |
|
| 170 | - $nb = is_countable($lcpa) ? count($lcpa) : 0; |
|
| 171 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 172 | - $nb += is_countable($lcpas) ? count($lcpas) : 0; |
|
| 173 | - } |
|
| 174 | - echo '<h3>' . sinon( |
|
| 175 | - singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 176 | - _T('plugins_actif_aucun') |
|
| 177 | - ) . '</h3>'; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - if (empty($format)) { |
|
| 181 | - $format = 'liste'; |
|
| 182 | - } elseif (!in_array($format, ['liste', 'repertoires'])) { |
|
| 183 | - $format = 'repertoires'; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - $afficher = charger_fonction("afficher_$format", 'plugins'); |
|
| 187 | - $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); |
|
| 188 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 189 | - $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - if ($corps) { |
|
| 193 | - $corps .= "\n<div class='boutons' style='display:none;'>" |
|
| 194 | - . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 195 | - . "' />" |
|
| 196 | - . '</div>'; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); |
|
| 200 | - |
|
| 201 | - echo fin_cadre_trait_couleur(); |
|
| 202 | - |
|
| 203 | - if ($quoi == 'actifs') { |
|
| 204 | - echo affiche_les_plugins_verrouilles($actifs); |
|
| 205 | - } |
|
| 206 | - echo '</div>'; |
|
| 207 | - |
|
| 208 | - echo http_script(" |
|
| 83 | + $lpf = null; |
|
| 84 | + $lcpas = null; |
|
| 85 | + $lcpaffichesup = null; |
|
| 86 | + if (!$quoi) { |
|
| 87 | + $quoi = 'actifs'; |
|
| 88 | + } |
|
| 89 | + // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite |
|
| 90 | + // format brut par plugin |
|
| 91 | + $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); |
|
| 92 | + // format resume mis en forme |
|
| 93 | + $erreur_activation = plugin_donne_erreurs(); |
|
| 94 | + $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 95 | + echo $commencer_page(_T('icone_admin_plugin'), 'configuration', 'plugin'); |
|
| 96 | + |
|
| 97 | + echo debut_gauche(); |
|
| 98 | + echo recuperer_fond('prive/squelettes/navigation/configurer', ['exec' => 'admin_plugin']); |
|
| 99 | + |
|
| 100 | + echo pipeline( |
|
| 101 | + 'affiche_gauche', |
|
| 102 | + [ |
|
| 103 | + 'args' => ['exec' => 'admin_plugin'], |
|
| 104 | + 'data' => afficher_librairies() |
|
| 105 | + ] |
|
| 106 | + ); |
|
| 107 | + |
|
| 108 | + echo debut_droite(); |
|
| 109 | + echo gros_titre(_T('icone_admin_plugin'), ''); |
|
| 110 | + |
|
| 111 | + // Barre d'onglets de premier niveau |
|
| 112 | + echo barre_onglets('plugins', 'plugins_actifs'); |
|
| 113 | + // Barre d'onglets de second niveau |
|
| 114 | + $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; |
|
| 115 | + echo debut_onglet('onglets_simple second'); |
|
| 116 | + echo onglet(_T('plugins_tous_liste'), generer_url_ecrire('admin_plugin', 'voir=tous'), 'admin_plugin', $onglet2); |
|
| 117 | + echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire('admin_plugin'), 'plugins_actifs', $onglet2); |
|
| 118 | + echo fin_onglet(); |
|
| 119 | + |
|
| 120 | + // message d'erreur au retour d'une operation |
|
| 121 | + if ($erreur) { |
|
| 122 | + echo "<div class='error'>" . spip_htmlspecialchars($erreur) . '</div>'; |
|
| 123 | + } |
|
| 124 | + if ($erreur_activation) { |
|
| 125 | + echo "<div class='error'>$erreur_activation</div>"; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs |
|
| 129 | + $actifs = (array) unserialize($GLOBALS['meta']['plugin']); |
|
| 130 | + $lcpa = $actifs + (array) unserialize($GLOBALS['meta']['plugin_attente']); |
|
| 131 | + |
|
| 132 | + // Les affichages se basent sur le repertoire, pas sur le nom |
|
| 133 | + $actifs = liste_chemin_plugin($actifs, ''); |
|
| 134 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 135 | + $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); |
|
| 136 | + } |
|
| 137 | + $lcpa = liste_chemin_plugin($lcpa); |
|
| 138 | + |
|
| 139 | + // on installe les plugins maintenant, |
|
| 140 | + // cela permet aux scripts d'install de faire des affichages (moches...) |
|
| 141 | + plugin_installes_meta(); |
|
| 142 | + |
|
| 143 | + echo "<div class='liste-plugins formulaire_spip'>"; |
|
| 144 | + echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); |
|
| 145 | + |
|
| 146 | + if ($quoi !== 'actifs') { |
|
| 147 | + $lpf = liste_plugin_files(); |
|
| 148 | + if ($lpf) { |
|
| 149 | + echo '<p>' . _T('texte_presente_plugin') . '</p>'; |
|
| 150 | + } else { |
|
| 151 | + if (!@is_dir(_DIR_PLUGINS)) { |
|
| 152 | + echo '<p>' . _T('plugin_info_automatique_ftp', ['rep' => joli_repertoire(_DIR_PLUGINS)]) |
|
| 153 | + . ' — ' . _T('plugin_info_automatique_creer') . '</p>'; |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + $lcpaffiche = $lpf; |
|
| 157 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 158 | + $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); |
|
| 159 | + } |
|
| 160 | + } else { |
|
| 161 | + // la liste |
|
| 162 | + // $quoi=='actifs' |
|
| 163 | + $lcpaffiche = $lcpa; |
|
| 164 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 165 | + $lcpaffichesup = $lcpas; |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + if ($quoi == 'actifs' || $lpf) { |
|
| 170 | + $nb = is_countable($lcpa) ? count($lcpa) : 0; |
|
| 171 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 172 | + $nb += is_countable($lcpas) ? count($lcpas) : 0; |
|
| 173 | + } |
|
| 174 | + echo '<h3>' . sinon( |
|
| 175 | + singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 176 | + _T('plugins_actif_aucun') |
|
| 177 | + ) . '</h3>'; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + if (empty($format)) { |
|
| 181 | + $format = 'liste'; |
|
| 182 | + } elseif (!in_array($format, ['liste', 'repertoires'])) { |
|
| 183 | + $format = 'repertoires'; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + $afficher = charger_fonction("afficher_$format", 'plugins'); |
|
| 187 | + $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); |
|
| 188 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 189 | + $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + if ($corps) { |
|
| 193 | + $corps .= "\n<div class='boutons' style='display:none;'>" |
|
| 194 | + . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 195 | + . "' />" |
|
| 196 | + . '</div>'; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); |
|
| 200 | + |
|
| 201 | + echo fin_cadre_trait_couleur(); |
|
| 202 | + |
|
| 203 | + if ($quoi == 'actifs') { |
|
| 204 | + echo affiche_les_plugins_verrouilles($actifs); |
|
| 205 | + } |
|
| 206 | + echo '</div>'; |
|
| 207 | + |
|
| 208 | + echo http_script(" |
|
| 209 | 209 | jQuery(function(){ |
| 210 | 210 | jQuery('.plugins li.item a[rel=info]').click(function(){ |
| 211 | 211 | var li = jQuery(this).parents('li').eq(0); |
@@ -231,15 +231,15 @@ discard block |
||
| 231 | 231 | }); |
| 232 | 232 | "); |
| 233 | 233 | |
| 234 | - echo pipeline( |
|
| 235 | - 'affiche_milieu', |
|
| 236 | - [ |
|
| 237 | - 'args' => ['exec' => 'admin_plugin'], |
|
| 238 | - 'data' => '' |
|
| 239 | - ] |
|
| 240 | - ); |
|
| 234 | + echo pipeline( |
|
| 235 | + 'affiche_milieu', |
|
| 236 | + [ |
|
| 237 | + 'args' => ['exec' => 'admin_plugin'], |
|
| 238 | + 'data' => '' |
|
| 239 | + ] |
|
| 240 | + ); |
|
| 241 | 241 | |
| 242 | - echo fin_gauche(), fin_page(); |
|
| 242 | + echo fin_gauche(), fin_page(); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -253,23 +253,23 @@ discard block |
||
| 253 | 253 | * Code HTML |
| 254 | 254 | **/ |
| 255 | 255 | function affiche_les_plugins_verrouilles($actifs) { |
| 256 | - if ((!$liste = liste_plugin_files(_DIR_PLUGINS_DIST))) { |
|
| 257 | - return ''; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 261 | - $liste = $afficher(self(), $liste, [], $actifs, _DIR_PLUGINS_DIST); |
|
| 262 | - |
|
| 263 | - return |
|
| 264 | - "<div id='plugins_dist'>" |
|
| 265 | - . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
|
| 266 | - . '<p>' |
|
| 267 | - . _T('plugin_info_plugins_dist_1', ['plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST)]) |
|
| 268 | - . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 269 | - . '</p>' |
|
| 270 | - . $liste |
|
| 271 | - . fin_cadre_trait_couleur() |
|
| 272 | - . "</div>\n"; |
|
| 256 | + if ((!$liste = liste_plugin_files(_DIR_PLUGINS_DIST))) { |
|
| 257 | + return ''; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 261 | + $liste = $afficher(self(), $liste, [], $actifs, _DIR_PLUGINS_DIST); |
|
| 262 | + |
|
| 263 | + return |
|
| 264 | + "<div id='plugins_dist'>" |
|
| 265 | + . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
|
| 266 | + . '<p>' |
|
| 267 | + . _T('plugin_info_plugins_dist_1', ['plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST)]) |
|
| 268 | + . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 269 | + . '</p>' |
|
| 270 | + . $liste |
|
| 271 | + . fin_cadre_trait_couleur() |
|
| 272 | + . "</div>\n"; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -281,18 +281,18 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | function afficher_librairies() { |
| 283 | 283 | |
| 284 | - if (!$libs = liste_librairies()) { |
|
| 285 | - return ''; |
|
| 286 | - } |
|
| 287 | - ksort($libs); |
|
| 288 | - $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
|
| 289 | - $res .= '<dl>'; |
|
| 290 | - foreach ($libs as $lib => $rep) { |
|
| 291 | - $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 292 | - } |
|
| 293 | - $res .= '</dl>'; |
|
| 294 | - |
|
| 295 | - return $res . fin_cadre_enfonce(); |
|
| 284 | + if (!$libs = liste_librairies()) { |
|
| 285 | + return ''; |
|
| 286 | + } |
|
| 287 | + ksort($libs); |
|
| 288 | + $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
|
| 289 | + $res .= '<dl>'; |
|
| 290 | + foreach ($libs as $lib => $rep) { |
|
| 291 | + $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 292 | + } |
|
| 293 | + $res .= '</dl>'; |
|
| 294 | + |
|
| 295 | + return $res . fin_cadre_enfonce(); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -303,22 +303,22 @@ discard block |
||
| 303 | 303 | * Tableau (nom de la lib => repertoire , ...) |
| 304 | 304 | */ |
| 305 | 305 | function liste_librairies() { |
| 306 | - $libs = []; |
|
| 307 | - foreach (array_reverse(creer_chemin()) as $d) { |
|
| 308 | - if ( |
|
| 309 | - is_dir($dir = $d . 'lib/') |
|
| 310 | - && ($t = opendir($dir)) |
|
| 311 | - ) { |
|
| 312 | - while (($f = readdir($t)) !== false) { |
|
| 313 | - if ( |
|
| 314 | - $f[0] != '.' |
|
| 315 | - && is_dir("$dir/$f") |
|
| 316 | - ) { |
|
| 317 | - $libs[$f] = $dir; |
|
| 318 | - } |
|
| 319 | - } |
|
| 320 | - } |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - return $libs; |
|
| 306 | + $libs = []; |
|
| 307 | + foreach (array_reverse(creer_chemin()) as $d) { |
|
| 308 | + if ( |
|
| 309 | + is_dir($dir = $d . 'lib/') |
|
| 310 | + && ($t = opendir($dir)) |
|
| 311 | + ) { |
|
| 312 | + while (($f = readdir($t)) !== false) { |
|
| 313 | + if ( |
|
| 314 | + $f[0] != '.' |
|
| 315 | + && is_dir("$dir/$f") |
|
| 316 | + ) { |
|
| 317 | + $libs[$f] = $dir; |
|
| 318 | + } |
|
| 319 | + } |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + return $libs; |
|
| 324 | 324 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // message d'erreur au retour d'une operation |
| 121 | 121 | if ($erreur) { |
| 122 | - echo "<div class='error'>" . spip_htmlspecialchars($erreur) . '</div>'; |
|
| 122 | + echo "<div class='error'>".spip_htmlspecialchars($erreur).'</div>'; |
|
| 123 | 123 | } |
| 124 | 124 | if ($erreur_activation) { |
| 125 | 125 | echo "<div class='error'>$erreur_activation</div>"; |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | if ($quoi !== 'actifs') { |
| 147 | 147 | $lpf = liste_plugin_files(); |
| 148 | 148 | if ($lpf) { |
| 149 | - echo '<p>' . _T('texte_presente_plugin') . '</p>'; |
|
| 149 | + echo '<p>'._T('texte_presente_plugin').'</p>'; |
|
| 150 | 150 | } else { |
| 151 | 151 | if (!@is_dir(_DIR_PLUGINS)) { |
| 152 | - echo '<p>' . _T('plugin_info_automatique_ftp', ['rep' => joli_repertoire(_DIR_PLUGINS)]) |
|
| 153 | - . ' — ' . _T('plugin_info_automatique_creer') . '</p>'; |
|
| 152 | + echo '<p>'._T('plugin_info_automatique_ftp', ['rep' => joli_repertoire(_DIR_PLUGINS)]) |
|
| 153 | + . ' — '._T('plugin_info_automatique_creer').'</p>'; |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | $lcpaffiche = $lpf; |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | if (defined('_DIR_PLUGINS_SUPPL')) { |
| 172 | 172 | $nb += is_countable($lcpas) ? count($lcpas) : 0; |
| 173 | 173 | } |
| 174 | - echo '<h3>' . sinon( |
|
| 174 | + echo '<h3>'.sinon( |
|
| 175 | 175 | singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
| 176 | 176 | _T('plugins_actif_aucun') |
| 177 | - ) . '</h3>'; |
|
| 177 | + ).'</h3>'; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (empty($format)) { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | if ($corps) { |
| 193 | 193 | $corps .= "\n<div class='boutons' style='display:none;'>" |
| 194 | - . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 194 | + . "<input type='submit' class='submit save' value='"._T('bouton_enregistrer') |
|
| 195 | 195 | . "' />" |
| 196 | 196 | . '</div>'; |
| 197 | 197 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
| 266 | 266 | . '<p>' |
| 267 | 267 | . _T('plugin_info_plugins_dist_1', ['plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST)]) |
| 268 | - . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 268 | + . '<br />'._T('plugin_info_plugins_dist_2') |
|
| 269 | 269 | . '</p>' |
| 270 | 270 | . $liste |
| 271 | 271 | . fin_cadre_trait_couleur() |
@@ -288,11 +288,11 @@ discard block |
||
| 288 | 288 | $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
| 289 | 289 | $res .= '<dl>'; |
| 290 | 290 | foreach ($libs as $lib => $rep) { |
| 291 | - $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 291 | + $res .= "<dt>$lib</dt><dd>".joli_repertoire($rep)."</dd>\n"; |
|
| 292 | 292 | } |
| 293 | 293 | $res .= '</dl>'; |
| 294 | 294 | |
| 295 | - return $res . fin_cadre_enfonce(); |
|
| 295 | + return $res.fin_cadre_enfonce(); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $libs = []; |
| 307 | 307 | foreach (array_reverse(creer_chemin()) as $d) { |
| 308 | 308 | if ( |
| 309 | - is_dir($dir = $d . 'lib/') |
|
| 309 | + is_dir($dir = $d.'lib/') |
|
| 310 | 310 | && ($t = opendir($dir)) |
| 311 | 311 | ) { |
| 312 | 312 | while (($f = readdir($t)) !== false) { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | **/ |
| 17 | 17 | |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -30,43 +30,43 @@ discard block |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur = '') { |
| 33 | - if ($changer_lang) { |
|
| 34 | - $table_objet_sql = table_objet_sql($objet); |
|
| 35 | - $id_table_objet = id_table_objet($objet); |
|
| 36 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 37 | - $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 33 | + if ($changer_lang) { |
|
| 34 | + $table_objet_sql = table_objet_sql($objet); |
|
| 35 | + $id_table_objet = id_table_objet($objet); |
|
| 36 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 37 | + $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 38 | 38 | |
| 39 | - $set = []; |
|
| 40 | - if (isset($desc['field']['langue_choisie'])) { |
|
| 41 | - $set['langue_choisie'] = 'oui'; |
|
| 42 | - } |
|
| 39 | + $set = []; |
|
| 40 | + if (isset($desc['field']['langue_choisie'])) { |
|
| 41 | + $set['langue_choisie'] = 'oui'; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - if ($changer_lang != 'herit') { |
|
| 45 | - $set['lang'] = $changer_lang; |
|
| 46 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . (int) $id, [], $serveur); |
|
| 47 | - include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 48 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 49 | - calculer_langues_rubriques(); |
|
| 50 | - } |
|
| 51 | - $langues = calculer_langues_utilisees($serveur); |
|
| 52 | - ecrire_meta('langues_utilisees', $langues); |
|
| 53 | - } else { |
|
| 54 | - $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . (int) $id_rubrique); |
|
| 55 | - if (!$langue_parent) { |
|
| 56 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 57 | - } |
|
| 58 | - $changer_lang = $langue_parent; |
|
| 59 | - $set['lang'] = $changer_lang; |
|
| 60 | - if (isset($set['langue_choisie'])) { |
|
| 61 | - $set['langue_choisie'] = 'non'; |
|
| 62 | - } |
|
| 63 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . (int) $id, [], $serveur); |
|
| 64 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 65 | - include_spip('inc/rubriques'); |
|
| 66 | - calculer_langues_rubriques(); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - } |
|
| 44 | + if ($changer_lang != 'herit') { |
|
| 45 | + $set['lang'] = $changer_lang; |
|
| 46 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . (int) $id, [], $serveur); |
|
| 47 | + include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 48 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 49 | + calculer_langues_rubriques(); |
|
| 50 | + } |
|
| 51 | + $langues = calculer_langues_utilisees($serveur); |
|
| 52 | + ecrire_meta('langues_utilisees', $langues); |
|
| 53 | + } else { |
|
| 54 | + $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . (int) $id_rubrique); |
|
| 55 | + if (!$langue_parent) { |
|
| 56 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 57 | + } |
|
| 58 | + $changer_lang = $langue_parent; |
|
| 59 | + $set['lang'] = $changer_lang; |
|
| 60 | + if (isset($set['langue_choisie'])) { |
|
| 61 | + $set['langue_choisie'] = 'non'; |
|
| 62 | + } |
|
| 63 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . (int) $id, [], $serveur); |
|
| 64 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 65 | + include_spip('inc/rubriques'); |
|
| 66 | + calculer_langues_rubriques(); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - return $changer_lang; |
|
| 71 | + return $changer_lang; |
|
| 72 | 72 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | if ($changer_lang != 'herit') { |
| 45 | 45 | $set['lang'] = $changer_lang; |
| 46 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . (int) $id, [], $serveur); |
|
| 46 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=".(int) $id, [], $serveur); |
|
| 47 | 47 | include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
| 48 | 48 | if ($table_objet_sql == 'spip_rubriques') { |
| 49 | 49 | calculer_langues_rubriques(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $langues = calculer_langues_utilisees($serveur); |
| 52 | 52 | ecrire_meta('langues_utilisees', $langues); |
| 53 | 53 | } else { |
| 54 | - $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . (int) $id_rubrique); |
|
| 54 | + $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.(int) $id_rubrique); |
|
| 55 | 55 | if (!$langue_parent) { |
| 56 | 56 | $langue_parent = $GLOBALS['meta']['langue_site']; |
| 57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if (isset($set['langue_choisie'])) { |
| 61 | 61 | $set['langue_choisie'] = 'non'; |
| 62 | 62 | } |
| 63 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . (int) $id, [], $serveur); |
|
| 63 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=".(int) $id, [], $serveur); |
|
| 64 | 64 | if ($table_objet_sql == 'spip_rubriques') { |
| 65 | 65 | include_spip('inc/rubriques'); |
| 66 | 66 | calculer_langues_rubriques(); |