@@ -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/presentation'); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @uses exec_puce_statut_args() |
| 31 | 31 | **/ |
| 32 | 32 | function exec_puce_statut_dist(): void { |
| 33 | - exec_puce_statut_args(_request('id'), _request('type')); |
|
| 33 | + exec_puce_statut_args(_request('id'), _request('type')); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | * Type d'objet |
| 50 | 50 | **/ |
| 51 | 51 | function exec_puce_statut_args($id, $type): void { |
| 52 | - $id = (int) $id; |
|
| 53 | - if ( |
|
| 54 | - ($table_objet_sql = table_objet_sql($type)) |
|
| 55 | - && ($d = lister_tables_objets_sql($table_objet_sql)) |
|
| 56 | - && isset($d['statut_textes_instituer']) |
|
| 57 | - && $d['statut_textes_instituer'] |
|
| 58 | - ) { |
|
| 59 | - $prim = id_table_objet($type); |
|
| 60 | - $select = isset($d['field']['id_rubrique']) ? 'id_rubrique,statut' : '0 as id_rubrique,statut'; |
|
| 61 | - $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 62 | - $statut = $r['statut']; |
|
| 63 | - $id_rubrique = $r['id_rubrique']; |
|
| 64 | - } else { |
|
| 65 | - $id_rubrique = $id; |
|
| 66 | - $statut = 'prop'; // arbitraire |
|
| 67 | - } |
|
| 68 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 69 | - ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 52 | + $id = (int) $id; |
|
| 53 | + if ( |
|
| 54 | + ($table_objet_sql = table_objet_sql($type)) |
|
| 55 | + && ($d = lister_tables_objets_sql($table_objet_sql)) |
|
| 56 | + && isset($d['statut_textes_instituer']) |
|
| 57 | + && $d['statut_textes_instituer'] |
|
| 58 | + ) { |
|
| 59 | + $prim = id_table_objet($type); |
|
| 60 | + $select = isset($d['field']['id_rubrique']) ? 'id_rubrique,statut' : '0 as id_rubrique,statut'; |
|
| 61 | + $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 62 | + $statut = $r['statut']; |
|
| 63 | + $id_rubrique = $r['id_rubrique']; |
|
| 64 | + } else { |
|
| 65 | + $id_rubrique = $id; |
|
| 66 | + $statut = 'prop'; // arbitraire |
|
| 67 | + } |
|
| 68 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 69 | + ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 70 | 70 | } |
@@ -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'); |
@@ -28,20 +28,20 @@ discard block |
||
| 28 | 28 | * @uses ajax_retour() |
| 29 | 29 | **/ |
| 30 | 30 | function exec_informer_dist() { |
| 31 | - $id = (int) _request('id'); |
|
| 32 | - $col = (int) _request('col'); |
|
| 33 | - $exclus = (int) _request('exclus'); |
|
| 34 | - $do = _request('do'); |
|
| 31 | + $id = (int) _request('id'); |
|
| 32 | + $col = (int) _request('col'); |
|
| 33 | + $exclus = (int) _request('exclus'); |
|
| 34 | + $do = _request('do'); |
|
| 35 | 35 | |
| 36 | - if (preg_match('/^\w*$/', (string) $do)) { |
|
| 37 | - if (!$do) { |
|
| 38 | - $do = 'aff'; |
|
| 39 | - } |
|
| 36 | + if (preg_match('/^\w*$/', (string) $do)) { |
|
| 37 | + if (!$do) { |
|
| 38 | + $do = 'aff'; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $informer = charger_fonction('informer', 'inc'); |
|
| 42 | - $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 43 | - } else { |
|
| 44 | - $res = ''; |
|
| 45 | - } |
|
| 46 | - ajax_retour($res); |
|
| 41 | + $informer = charger_fonction('informer', 'inc'); |
|
| 42 | + $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 43 | + } else { |
|
| 44 | + $res = ''; |
|
| 45 | + } |
|
| 46 | + ajax_retour($res); |
|
| 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/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 | } |