@@ -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 | /** |
@@ -25,41 +25,41 @@ discard block |
||
| 25 | 25 | **/ |
| 26 | 26 | function action_instituer_langue_rubrique_dist() { |
| 27 | 27 | |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $arg = $securiser_action(); |
|
| 30 | - $changer_lang = _request('changer_lang'); |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $arg = $securiser_action(); |
|
| 30 | + $changer_lang = _request('changer_lang'); |
|
| 31 | 31 | |
| 32 | - [$id_rubrique, $id_parent] = preg_split('/\W/', $arg); |
|
| 32 | + [$id_rubrique, $id_parent] = preg_split('/\W/', $arg); |
|
| 33 | 33 | |
| 34 | - if ( |
|
| 35 | - $changer_lang |
|
| 36 | - and $id_rubrique > 0 |
|
| 37 | - and $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 38 | - and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0) |
|
| 39 | - ) { |
|
| 40 | - if ($changer_lang != 'herit') { |
|
| 41 | - sql_updateq( |
|
| 42 | - 'spip_rubriques', |
|
| 43 | - ['lang' => $changer_lang, 'langue_choisie' => 'oui'], |
|
| 44 | - "id_rubrique=$id_rubrique" |
|
| 45 | - ); |
|
| 46 | - } else { |
|
| 47 | - if ($id_parent == 0) { |
|
| 48 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 49 | - } else { |
|
| 50 | - $langue_parent = sql_getfetsel('lang', 'spip_rubriques', "id_rubrique=$id_parent"); |
|
| 51 | - } |
|
| 52 | - sql_updateq( |
|
| 53 | - 'spip_rubriques', |
|
| 54 | - ['lang' => $langue_parent, 'langue_choisie' => 'non'], |
|
| 55 | - "id_rubrique=$id_rubrique" |
|
| 56 | - ); |
|
| 57 | - } |
|
| 58 | - include_spip('inc/rubriques'); |
|
| 59 | - calculer_langues_rubriques(); |
|
| 34 | + if ( |
|
| 35 | + $changer_lang |
|
| 36 | + and $id_rubrique > 0 |
|
| 37 | + and $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 38 | + and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0) |
|
| 39 | + ) { |
|
| 40 | + if ($changer_lang != 'herit') { |
|
| 41 | + sql_updateq( |
|
| 42 | + 'spip_rubriques', |
|
| 43 | + ['lang' => $changer_lang, 'langue_choisie' => 'oui'], |
|
| 44 | + "id_rubrique=$id_rubrique" |
|
| 45 | + ); |
|
| 46 | + } else { |
|
| 47 | + if ($id_parent == 0) { |
|
| 48 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 49 | + } else { |
|
| 50 | + $langue_parent = sql_getfetsel('lang', 'spip_rubriques', "id_rubrique=$id_parent"); |
|
| 51 | + } |
|
| 52 | + sql_updateq( |
|
| 53 | + 'spip_rubriques', |
|
| 54 | + ['lang' => $langue_parent, 'langue_choisie' => 'non'], |
|
| 55 | + "id_rubrique=$id_rubrique" |
|
| 56 | + ); |
|
| 57 | + } |
|
| 58 | + include_spip('inc/rubriques'); |
|
| 59 | + calculer_langues_rubriques(); |
|
| 60 | 60 | |
| 61 | - // invalider les caches marques de cette rubrique |
|
| 62 | - include_spip('inc/invalideur'); |
|
| 63 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 64 | - } |
|
| 61 | + // invalider les caches marques de cette rubrique |
|
| 62 | + include_spip('inc/invalideur'); |
|
| 63 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -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 | |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | 37 | function action_supprimer_lien_dist($arg = null) { |
| 38 | - if (is_null($arg)) { |
|
| 39 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 40 | - $arg = $securiser_action(); |
|
| 41 | - } |
|
| 38 | + if (is_null($arg)) { |
|
| 39 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 40 | + $arg = $securiser_action(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $arg = explode('-', $arg); |
|
| 44 | - [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 43 | + $arg = explode('-', $arg); |
|
| 44 | + [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 45 | 45 | |
| 46 | - include_spip('action/editer_liens'); |
|
| 47 | - objet_dissocier([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 46 | + include_spip('action/editer_liens'); |
|
| 47 | + objet_dissocier([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 48 | 48 | } |
@@ -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 | include_spip('inc/headers'); |
| 24 | 24 | |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * Sortie du buffer |
| 36 | 36 | **/ |
| 37 | 37 | function action_tester_taille_error_handler($output) { |
| 38 | - // on est ici, donc echec lors de la creation de l'image |
|
| 39 | - if (!empty($GLOBALS['redirect'])) { |
|
| 40 | - return redirige_formulaire($GLOBALS['redirect']); |
|
| 41 | - } |
|
| 38 | + // on est ici, donc echec lors de la creation de l'image |
|
| 39 | + if (!empty($GLOBALS['redirect'])) { |
|
| 40 | + return redirige_formulaire($GLOBALS['redirect']); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - return $output; |
|
| 43 | + return $output; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -58,77 +58,77 @@ discard block |
||
| 58 | 58 | **/ |
| 59 | 59 | function action_tester_taille_dist() { |
| 60 | 60 | |
| 61 | - if (!autoriser('configurer')) { |
|
| 62 | - return; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - $taille = _request('arg'); |
|
| 66 | - $taille = explode('-', $taille); |
|
| 67 | - |
|
| 68 | - $GLOBALS['taille_max'] = end($taille); |
|
| 69 | - $GLOBALS['taille_min'] = 0; |
|
| 70 | - if (count($taille) > 1) { |
|
| 71 | - $GLOBALS['taille_min'] = reset($taille); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // si l'intervalle est assez petit, on garde la valeur min |
|
| 75 | - if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { |
|
| 76 | - $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']); |
|
| 77 | - if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) { |
|
| 78 | - $t = $t * 0.9; // marge de securite |
|
| 79 | - echo round($t / 1_000_000, 3) . ' Mpx'; |
|
| 80 | - } else { |
|
| 81 | - // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue" |
|
| 82 | - $t = 0; |
|
| 83 | - echo '∞'; |
|
| 84 | - } |
|
| 85 | - ecrire_meta('max_taille_vignettes', $t, 'non'); |
|
| 86 | - die(); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); |
|
| 90 | - |
|
| 91 | - include_spip('inc/filtres'); |
|
| 92 | - // des inclusions representatives d'un hit prive et/ou public pour la conso memoire |
|
| 93 | - include_spip('public/assembler'); |
|
| 94 | - include_spip('public/balises'); |
|
| 95 | - include_spip('public/boucles'); |
|
| 96 | - include_spip('public/cacher'); |
|
| 97 | - include_spip('public/compiler'); |
|
| 98 | - include_spip('public/composer'); |
|
| 99 | - include_spip('public/criteres'); |
|
| 100 | - include_spip('public/interfaces'); |
|
| 101 | - include_spip('public/parametrer'); |
|
| 102 | - include_spip('public/phraser_html'); |
|
| 103 | - include_spip('public/references'); |
|
| 104 | - |
|
| 105 | - include_spip('inc/presentation'); |
|
| 106 | - include_spip('inc/charsets'); |
|
| 107 | - include_spip('inc/documents'); |
|
| 108 | - include_spip('inc/header'); |
|
| 109 | - propre('<doc1>'); // charger propre avec le trairement d'un modele |
|
| 110 | - |
|
| 111 | - $i = _request('i') + 1; |
|
| 112 | - $image_source = chemin_image('test.png'); |
|
| 113 | - $GLOBALS['redirect'] = generer_url_action( |
|
| 114 | - 'tester_taille', |
|
| 115 | - "i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test'] |
|
| 116 | - ); |
|
| 117 | - |
|
| 118 | - ob_start('action_tester_taille_error_handler'); |
|
| 119 | - filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 120 | - $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 121 | - |
|
| 122 | - // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee |
|
| 123 | - // si $GLOBALS['taille_min']==0 (car on est au premier coup) |
|
| 124 | - if ($GLOBALS['taille_min'] == 0) { |
|
| 125 | - $taille = $GLOBALS['taille_max']; |
|
| 126 | - filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 127 | - $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 128 | - } |
|
| 129 | - ob_end_clean(); |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - // on est ici, donc pas de plantage |
|
| 133 | - echo redirige_formulaire($GLOBALS['redirect']); |
|
| 61 | + if (!autoriser('configurer')) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + $taille = _request('arg'); |
|
| 66 | + $taille = explode('-', $taille); |
|
| 67 | + |
|
| 68 | + $GLOBALS['taille_max'] = end($taille); |
|
| 69 | + $GLOBALS['taille_min'] = 0; |
|
| 70 | + if (count($taille) > 1) { |
|
| 71 | + $GLOBALS['taille_min'] = reset($taille); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // si l'intervalle est assez petit, on garde la valeur min |
|
| 75 | + if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { |
|
| 76 | + $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']); |
|
| 77 | + if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) { |
|
| 78 | + $t = $t * 0.9; // marge de securite |
|
| 79 | + echo round($t / 1_000_000, 3) . ' Mpx'; |
|
| 80 | + } else { |
|
| 81 | + // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue" |
|
| 82 | + $t = 0; |
|
| 83 | + echo '∞'; |
|
| 84 | + } |
|
| 85 | + ecrire_meta('max_taille_vignettes', $t, 'non'); |
|
| 86 | + die(); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); |
|
| 90 | + |
|
| 91 | + include_spip('inc/filtres'); |
|
| 92 | + // des inclusions representatives d'un hit prive et/ou public pour la conso memoire |
|
| 93 | + include_spip('public/assembler'); |
|
| 94 | + include_spip('public/balises'); |
|
| 95 | + include_spip('public/boucles'); |
|
| 96 | + include_spip('public/cacher'); |
|
| 97 | + include_spip('public/compiler'); |
|
| 98 | + include_spip('public/composer'); |
|
| 99 | + include_spip('public/criteres'); |
|
| 100 | + include_spip('public/interfaces'); |
|
| 101 | + include_spip('public/parametrer'); |
|
| 102 | + include_spip('public/phraser_html'); |
|
| 103 | + include_spip('public/references'); |
|
| 104 | + |
|
| 105 | + include_spip('inc/presentation'); |
|
| 106 | + include_spip('inc/charsets'); |
|
| 107 | + include_spip('inc/documents'); |
|
| 108 | + include_spip('inc/header'); |
|
| 109 | + propre('<doc1>'); // charger propre avec le trairement d'un modele |
|
| 110 | + |
|
| 111 | + $i = _request('i') + 1; |
|
| 112 | + $image_source = chemin_image('test.png'); |
|
| 113 | + $GLOBALS['redirect'] = generer_url_action( |
|
| 114 | + 'tester_taille', |
|
| 115 | + "i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test'] |
|
| 116 | + ); |
|
| 117 | + |
|
| 118 | + ob_start('action_tester_taille_error_handler'); |
|
| 119 | + filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 120 | + $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 121 | + |
|
| 122 | + // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee |
|
| 123 | + // si $GLOBALS['taille_min']==0 (car on est au premier coup) |
|
| 124 | + if ($GLOBALS['taille_min'] == 0) { |
|
| 125 | + $taille = $GLOBALS['taille_max']; |
|
| 126 | + filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 127 | + $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 128 | + } |
|
| 129 | + ob_end_clean(); |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + // on est ici, donc pas de plantage |
|
| 133 | + echo redirige_formulaire($GLOBALS['redirect']); |
|
| 134 | 134 | } |
@@ -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 | /** |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | function action_ajouter_lien_dist($arg = null) { |
| 37 | - if (is_null($arg)) { |
|
| 38 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | - $arg = $securiser_action(); |
|
| 40 | - } |
|
| 37 | + if (is_null($arg)) { |
|
| 38 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 39 | + $arg = $securiser_action(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $arg = explode('-', $arg); |
|
| 43 | - [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 42 | + $arg = explode('-', $arg); |
|
| 43 | + [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 44 | 44 | |
| 45 | - include_spip('action/editer_liens'); |
|
| 46 | - objet_associer([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 45 | + include_spip('action/editer_liens'); |
|
| 46 | + objet_associer([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 47 | 47 | } |
@@ -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 | /** |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function action_debloquer_edition_dist() { |
| 33 | 33 | |
| 34 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | - $arg = $securiser_action(); |
|
| 34 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | + $arg = $securiser_action(); |
|
| 36 | 36 | |
| 37 | - if ($arg) { |
|
| 38 | - include_spip('inc/drapeau_edition'); |
|
| 39 | - if ($arg == 'tous') { |
|
| 40 | - debloquer_tous($GLOBALS['visiteur_session']['id_auteur']); |
|
| 41 | - } else { |
|
| 42 | - $arg = explode('-', $arg); |
|
| 43 | - [$objet, $id_objet] = $arg; |
|
| 44 | - debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet); |
|
| 45 | - } |
|
| 46 | - } |
|
| 37 | + if ($arg) { |
|
| 38 | + include_spip('inc/drapeau_edition'); |
|
| 39 | + if ($arg == 'tous') { |
|
| 40 | + debloquer_tous($GLOBALS['visiteur_session']['id_auteur']); |
|
| 41 | + } else { |
|
| 42 | + $arg = explode('-', $arg); |
|
| 43 | + [$objet, $id_objet] = $arg; |
|
| 44 | + debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/actions'); |
@@ -33,93 +33,93 @@ discard block |
||
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | 35 | function action_cookie_dist($set_cookie_admin = null, $change_session = null) { |
| 36 | - $redirect_echec = $redirect = null; |
|
| 37 | - $test_echec_cookie = null; |
|
| 38 | - $url = ''; |
|
| 39 | - if (is_null($set_cookie_admin)) { |
|
| 40 | - $set_cookie_admin = _request('cookie_admin'); |
|
| 41 | - $change_session = _request('change_session'); |
|
| 42 | - $test_echec_cookie = _request('test_echec_cookie'); |
|
| 36 | + $redirect_echec = $redirect = null; |
|
| 37 | + $test_echec_cookie = null; |
|
| 38 | + $url = ''; |
|
| 39 | + if (is_null($set_cookie_admin)) { |
|
| 40 | + $set_cookie_admin = _request('cookie_admin'); |
|
| 41 | + $change_session = _request('change_session'); |
|
| 42 | + $test_echec_cookie = _request('test_echec_cookie'); |
|
| 43 | 43 | |
| 44 | - // La cible de notre operation de connexion |
|
| 45 | - $url = securiser_redirect_action(_request('url')); |
|
| 46 | - $redirect = $url ?: generer_url_ecrire('accueil'); |
|
| 47 | - $redirect_echec = _request('url_echec'); |
|
| 48 | - if (!isset($redirect_echec)) { |
|
| 49 | - if (strpos($redirect, (string) _DIR_RESTREINT_ABS) !== false) { |
|
| 50 | - $redirect_echec = generer_url_public('login', '', true); |
|
| 51 | - } else { |
|
| 52 | - $redirect_echec = $redirect; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - } |
|
| 44 | + // La cible de notre operation de connexion |
|
| 45 | + $url = securiser_redirect_action(_request('url')); |
|
| 46 | + $redirect = $url ?: generer_url_ecrire('accueil'); |
|
| 47 | + $redirect_echec = _request('url_echec'); |
|
| 48 | + if (!isset($redirect_echec)) { |
|
| 49 | + if (strpos($redirect, (string) _DIR_RESTREINT_ABS) !== false) { |
|
| 50 | + $redirect_echec = generer_url_public('login', '', true); |
|
| 51 | + } else { |
|
| 52 | + $redirect_echec = $redirect; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - // rejoue le cookie pour renouveler spip_session |
|
| 59 | - if ($change_session == 'oui') { |
|
| 60 | - $session = charger_fonction('session', 'inc'); |
|
| 61 | - $session(true); |
|
| 62 | - spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']); |
|
| 63 | - http_response_code(204); // No Content |
|
| 64 | - return; |
|
| 65 | - } |
|
| 58 | + // rejoue le cookie pour renouveler spip_session |
|
| 59 | + if ($change_session == 'oui') { |
|
| 60 | + $session = charger_fonction('session', 'inc'); |
|
| 61 | + $session(true); |
|
| 62 | + spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']); |
|
| 63 | + http_response_code(204); // No Content |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - // tentative de connexion en auth_http |
|
| 68 | - if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) { |
|
| 69 | - include_spip('inc/auth'); |
|
| 70 | - if ( |
|
| 71 | - @$_SERVER['PHP_AUTH_USER'] |
|
| 72 | - and @$_SERVER['PHP_AUTH_PW'] |
|
| 73 | - and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) |
|
| 74 | - ) { |
|
| 75 | - auth_loger($auteur); |
|
| 76 | - redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 77 | - } else { |
|
| 78 | - ask_php_auth( |
|
| 79 | - _T('info_connexion_refusee'), |
|
| 80 | - _T('login_login_pass_incorrect'), |
|
| 81 | - _T('login_retour_site'), |
|
| 82 | - 'url=' . rawurlencode($redirect), |
|
| 83 | - _T('login_nouvelle_tentative'), |
|
| 84 | - (strpos($url, (string) _DIR_RESTREINT_ABS) !== false) |
|
| 85 | - ); |
|
| 86 | - } |
|
| 87 | - } else { |
|
| 88 | - // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 89 | - // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 90 | - // le cas echeant. |
|
| 91 | - if ($test_echec_cookie == 'oui') { |
|
| 92 | - spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 93 | - if ($redirect) { |
|
| 94 | - $redirect = parametre_url( |
|
| 95 | - parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), |
|
| 96 | - 'url', |
|
| 97 | - rawurlencode($redirect), |
|
| 98 | - '&' |
|
| 99 | - ); |
|
| 100 | - } |
|
| 101 | - } else { |
|
| 102 | - $cook = $_COOKIE['spip_admin'] ?? ''; |
|
| 103 | - // Suppression cookie d'admin ? |
|
| 104 | - if ($set_cookie_admin == 'non') { |
|
| 105 | - if ($cook) { |
|
| 106 | - spip_setcookie('spip_admin', $cook, [ |
|
| 107 | - 'expires' => time() - 3600 * 24 |
|
| 108 | - ]); |
|
| 109 | - } |
|
| 110 | - } // Ajout de cookie d'admin |
|
| 111 | - else { |
|
| 112 | - if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) { |
|
| 113 | - spip_setcookie('spip_admin', $set_cookie_admin, [ |
|
| 114 | - 'expires' => time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA) |
|
| 115 | - ]); |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - } |
|
| 67 | + // tentative de connexion en auth_http |
|
| 68 | + if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) { |
|
| 69 | + include_spip('inc/auth'); |
|
| 70 | + if ( |
|
| 71 | + @$_SERVER['PHP_AUTH_USER'] |
|
| 72 | + and @$_SERVER['PHP_AUTH_PW'] |
|
| 73 | + and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) |
|
| 74 | + ) { |
|
| 75 | + auth_loger($auteur); |
|
| 76 | + redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 77 | + } else { |
|
| 78 | + ask_php_auth( |
|
| 79 | + _T('info_connexion_refusee'), |
|
| 80 | + _T('login_login_pass_incorrect'), |
|
| 81 | + _T('login_retour_site'), |
|
| 82 | + 'url=' . rawurlencode($redirect), |
|
| 83 | + _T('login_nouvelle_tentative'), |
|
| 84 | + (strpos($url, (string) _DIR_RESTREINT_ABS) !== false) |
|
| 85 | + ); |
|
| 86 | + } |
|
| 87 | + } else { |
|
| 88 | + // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 89 | + // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 90 | + // le cas echeant. |
|
| 91 | + if ($test_echec_cookie == 'oui') { |
|
| 92 | + spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 93 | + if ($redirect) { |
|
| 94 | + $redirect = parametre_url( |
|
| 95 | + parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), |
|
| 96 | + 'url', |
|
| 97 | + rawurlencode($redirect), |
|
| 98 | + '&' |
|
| 99 | + ); |
|
| 100 | + } |
|
| 101 | + } else { |
|
| 102 | + $cook = $_COOKIE['spip_admin'] ?? ''; |
|
| 103 | + // Suppression cookie d'admin ? |
|
| 104 | + if ($set_cookie_admin == 'non') { |
|
| 105 | + if ($cook) { |
|
| 106 | + spip_setcookie('spip_admin', $cook, [ |
|
| 107 | + 'expires' => time() - 3600 * 24 |
|
| 108 | + ]); |
|
| 109 | + } |
|
| 110 | + } // Ajout de cookie d'admin |
|
| 111 | + else { |
|
| 112 | + if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) { |
|
| 113 | + spip_setcookie('spip_admin', $set_cookie_admin, [ |
|
| 114 | + 'expires' => time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA) |
|
| 115 | + ]); |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - // Redirection finale |
|
| 122 | - if ($redirect) { |
|
| 123 | - redirige_par_entete($redirect, true); |
|
| 124 | - } |
|
| 121 | + // Redirection finale |
|
| 122 | + if ($redirect) { |
|
| 123 | + redirige_par_entete($redirect, true); |
|
| 124 | + } |
|
| 125 | 125 | } |
@@ -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 | /** |
@@ -30,155 +30,155 @@ discard block |
||
| 30 | 30 | * redirige sur l'image ainsi créée (sinon sur une image d'echec). |
| 31 | 31 | **/ |
| 32 | 32 | function action_tester_dist() { |
| 33 | - $arg = _request('arg'); |
|
| 34 | - |
|
| 35 | - $gd_formats = []; |
|
| 36 | - $gd_formats_read_gif = ''; |
|
| 37 | - // verifier les formats acceptes par GD |
|
| 38 | - if ($arg == 'gd1') { |
|
| 39 | - // Si GD est installe et php >= 4.0.2 |
|
| 40 | - if (function_exists('imagetypes')) { |
|
| 41 | - if (imagetypes() & IMG_GIF) { |
|
| 42 | - $gd_formats[] = 'gif'; |
|
| 43 | - } else { |
|
| 44 | - # Attention GD sait lire le gif mais pas forcement l'ecrire |
|
| 45 | - if (function_exists('ImageCreateFromGIF')) { |
|
| 46 | - $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif'); |
|
| 47 | - if ($srcImage) { |
|
| 48 | - $gd_formats_read_gif = ',gif'; |
|
| 49 | - ImageDestroy($srcImage); |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - if (imagetypes() & IMG_JPG) { |
|
| 55 | - $gd_formats[] = 'jpg'; |
|
| 56 | - } |
|
| 57 | - if (imagetypes() & IMG_PNG) { |
|
| 58 | - $gd_formats[] = 'png'; |
|
| 59 | - } |
|
| 60 | - if (imagetypes() & IMG_WEBP) { |
|
| 61 | - $gd_formats[] = 'webp'; |
|
| 62 | - } |
|
| 63 | - } else { |
|
| 64 | - # ancienne methode de detection des formats, qui en plus |
|
| 65 | - # est bugguee car elle teste les formats en lecture |
|
| 66 | - # alors que la valeur deduite sert a identifier |
|
| 67 | - # les formats disponibles en ecriture... (cf. inc_logos) |
|
| 68 | - |
|
| 69 | - if (function_exists('ImageCreateFromJPEG')) { |
|
| 70 | - $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg'); |
|
| 71 | - if ($srcImage) { |
|
| 72 | - $gd_formats[] = 'jpg'; |
|
| 73 | - ImageDestroy($srcImage); |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - if (function_exists('ImageCreateFromGIF')) { |
|
| 77 | - $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif'); |
|
| 78 | - if ($srcImage) { |
|
| 79 | - $gd_formats[] = 'gif'; |
|
| 80 | - ImageDestroy($srcImage); |
|
| 81 | - } |
|
| 82 | - } |
|
| 83 | - if (function_exists('ImageCreateFromPNG')) { |
|
| 84 | - $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png'); |
|
| 85 | - if ($srcImage) { |
|
| 86 | - $gd_formats[] = 'png'; |
|
| 87 | - ImageDestroy($srcImage); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - if (function_exists('ImageCreateFromWEBP')) { |
|
| 91 | - $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp'); |
|
| 92 | - if ($srcImage) { |
|
| 93 | - $gd_formats[] = 'webp'; |
|
| 94 | - ImageDestroy($srcImage); |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - if (! empty($gd_formats)) { |
|
| 100 | - $gd_formats = join(',', $gd_formats); |
|
| 101 | - } |
|
| 102 | - ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif); |
|
| 103 | - ecrire_meta('gd_formats', $gd_formats); |
|
| 104 | - } // verifier les formats netpbm |
|
| 105 | - else { |
|
| 106 | - if ($arg == 'netpbm') { |
|
| 107 | - if (!defined('_PNMSCALE_COMMAND')) { |
|
| 108 | - define('_PNMSCALE_COMMAND', 'pnmscale'); |
|
| 109 | - } // Securite : mes_options.php peut preciser le chemin absolu |
|
| 110 | - if (_PNMSCALE_COMMAND == '') { |
|
| 111 | - return; |
|
| 112 | - } |
|
| 113 | - $netpbm_formats = []; |
|
| 114 | - |
|
| 115 | - $jpegtopnm_command = str_replace( |
|
| 116 | - 'pnmscale', |
|
| 117 | - 'jpegtopnm', |
|
| 118 | - _PNMSCALE_COMMAND |
|
| 119 | - ); |
|
| 120 | - $pnmtojpeg_command = str_replace( |
|
| 121 | - 'pnmscale', |
|
| 122 | - 'pnmtojpeg', |
|
| 123 | - _PNMSCALE_COMMAND |
|
| 124 | - ); |
|
| 125 | - |
|
| 126 | - $vignette = _ROOT_IMG_PACK . 'test.jpg'; |
|
| 127 | - $dest = _DIR_VAR . 'test-jpg.jpg'; |
|
| 128 | - $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 129 | - spip_log($commande); |
|
| 130 | - exec($commande); |
|
| 131 | - if ($taille = @getimagesize($dest)) { |
|
| 132 | - if ($taille[1] == 10) { |
|
| 133 | - $netpbm_formats[] = 'jpg'; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - $giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND); |
|
| 137 | - $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND); |
|
| 138 | - $vignette = _ROOT_IMG_PACK . 'test.gif'; |
|
| 139 | - $dest = _DIR_VAR . 'test-gif.jpg'; |
|
| 140 | - $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 141 | - spip_log($commande); |
|
| 142 | - exec($commande); |
|
| 143 | - if ($taille = @getimagesize($dest)) { |
|
| 144 | - if ($taille[1] == 10) { |
|
| 145 | - $netpbm_formats[] = 'gif'; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND); |
|
| 150 | - $vignette = _ROOT_IMG_PACK . 'test.png'; |
|
| 151 | - $dest = _DIR_VAR . 'test-gif.jpg'; |
|
| 152 | - $commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 153 | - spip_log($commande); |
|
| 154 | - exec($commande); |
|
| 155 | - if ($taille = @getimagesize($dest)) { |
|
| 156 | - if ($taille[1] == 10) { |
|
| 157 | - $netpbm_formats[] = 'png'; |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - ecrire_meta('netpbm_formats', join(',', $netpbm_formats ?: [])); |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - // et maintenant envoyer la vignette de tests |
|
| 166 | - if (in_array($arg, ['gd1', 'gd2', 'imagick', 'convert', 'netpbm'])) { |
|
| 167 | - include_spip('inc/filtres'); |
|
| 168 | - include_spip('inc/filtres_images_mini'); |
|
| 169 | - $taille_preview = 150; |
|
| 170 | - $image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg'); |
|
| 171 | - |
|
| 172 | - $image['fichier_dest'] = _DIR_VAR . "test_$arg"; |
|
| 173 | - |
|
| 174 | - if ( |
|
| 175 | - $preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true) |
|
| 176 | - and ($preview['width'] * $preview['height'] > 0) |
|
| 177 | - ) { |
|
| 178 | - redirige_par_entete($preview['fichier']); |
|
| 179 | - } |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - # image echec |
|
| 183 | - redirige_par_entete(chemin_image('echec-reducteur-xx.svg')); |
|
| 33 | + $arg = _request('arg'); |
|
| 34 | + |
|
| 35 | + $gd_formats = []; |
|
| 36 | + $gd_formats_read_gif = ''; |
|
| 37 | + // verifier les formats acceptes par GD |
|
| 38 | + if ($arg == 'gd1') { |
|
| 39 | + // Si GD est installe et php >= 4.0.2 |
|
| 40 | + if (function_exists('imagetypes')) { |
|
| 41 | + if (imagetypes() & IMG_GIF) { |
|
| 42 | + $gd_formats[] = 'gif'; |
|
| 43 | + } else { |
|
| 44 | + # Attention GD sait lire le gif mais pas forcement l'ecrire |
|
| 45 | + if (function_exists('ImageCreateFromGIF')) { |
|
| 46 | + $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif'); |
|
| 47 | + if ($srcImage) { |
|
| 48 | + $gd_formats_read_gif = ',gif'; |
|
| 49 | + ImageDestroy($srcImage); |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + if (imagetypes() & IMG_JPG) { |
|
| 55 | + $gd_formats[] = 'jpg'; |
|
| 56 | + } |
|
| 57 | + if (imagetypes() & IMG_PNG) { |
|
| 58 | + $gd_formats[] = 'png'; |
|
| 59 | + } |
|
| 60 | + if (imagetypes() & IMG_WEBP) { |
|
| 61 | + $gd_formats[] = 'webp'; |
|
| 62 | + } |
|
| 63 | + } else { |
|
| 64 | + # ancienne methode de detection des formats, qui en plus |
|
| 65 | + # est bugguee car elle teste les formats en lecture |
|
| 66 | + # alors que la valeur deduite sert a identifier |
|
| 67 | + # les formats disponibles en ecriture... (cf. inc_logos) |
|
| 68 | + |
|
| 69 | + if (function_exists('ImageCreateFromJPEG')) { |
|
| 70 | + $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg'); |
|
| 71 | + if ($srcImage) { |
|
| 72 | + $gd_formats[] = 'jpg'; |
|
| 73 | + ImageDestroy($srcImage); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + if (function_exists('ImageCreateFromGIF')) { |
|
| 77 | + $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif'); |
|
| 78 | + if ($srcImage) { |
|
| 79 | + $gd_formats[] = 'gif'; |
|
| 80 | + ImageDestroy($srcImage); |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | + if (function_exists('ImageCreateFromPNG')) { |
|
| 84 | + $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png'); |
|
| 85 | + if ($srcImage) { |
|
| 86 | + $gd_formats[] = 'png'; |
|
| 87 | + ImageDestroy($srcImage); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + if (function_exists('ImageCreateFromWEBP')) { |
|
| 91 | + $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp'); |
|
| 92 | + if ($srcImage) { |
|
| 93 | + $gd_formats[] = 'webp'; |
|
| 94 | + ImageDestroy($srcImage); |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + if (! empty($gd_formats)) { |
|
| 100 | + $gd_formats = join(',', $gd_formats); |
|
| 101 | + } |
|
| 102 | + ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif); |
|
| 103 | + ecrire_meta('gd_formats', $gd_formats); |
|
| 104 | + } // verifier les formats netpbm |
|
| 105 | + else { |
|
| 106 | + if ($arg == 'netpbm') { |
|
| 107 | + if (!defined('_PNMSCALE_COMMAND')) { |
|
| 108 | + define('_PNMSCALE_COMMAND', 'pnmscale'); |
|
| 109 | + } // Securite : mes_options.php peut preciser le chemin absolu |
|
| 110 | + if (_PNMSCALE_COMMAND == '') { |
|
| 111 | + return; |
|
| 112 | + } |
|
| 113 | + $netpbm_formats = []; |
|
| 114 | + |
|
| 115 | + $jpegtopnm_command = str_replace( |
|
| 116 | + 'pnmscale', |
|
| 117 | + 'jpegtopnm', |
|
| 118 | + _PNMSCALE_COMMAND |
|
| 119 | + ); |
|
| 120 | + $pnmtojpeg_command = str_replace( |
|
| 121 | + 'pnmscale', |
|
| 122 | + 'pnmtojpeg', |
|
| 123 | + _PNMSCALE_COMMAND |
|
| 124 | + ); |
|
| 125 | + |
|
| 126 | + $vignette = _ROOT_IMG_PACK . 'test.jpg'; |
|
| 127 | + $dest = _DIR_VAR . 'test-jpg.jpg'; |
|
| 128 | + $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 129 | + spip_log($commande); |
|
| 130 | + exec($commande); |
|
| 131 | + if ($taille = @getimagesize($dest)) { |
|
| 132 | + if ($taille[1] == 10) { |
|
| 133 | + $netpbm_formats[] = 'jpg'; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + $giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND); |
|
| 137 | + $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND); |
|
| 138 | + $vignette = _ROOT_IMG_PACK . 'test.gif'; |
|
| 139 | + $dest = _DIR_VAR . 'test-gif.jpg'; |
|
| 140 | + $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 141 | + spip_log($commande); |
|
| 142 | + exec($commande); |
|
| 143 | + if ($taille = @getimagesize($dest)) { |
|
| 144 | + if ($taille[1] == 10) { |
|
| 145 | + $netpbm_formats[] = 'gif'; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND); |
|
| 150 | + $vignette = _ROOT_IMG_PACK . 'test.png'; |
|
| 151 | + $dest = _DIR_VAR . 'test-gif.jpg'; |
|
| 152 | + $commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 153 | + spip_log($commande); |
|
| 154 | + exec($commande); |
|
| 155 | + if ($taille = @getimagesize($dest)) { |
|
| 156 | + if ($taille[1] == 10) { |
|
| 157 | + $netpbm_formats[] = 'png'; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + ecrire_meta('netpbm_formats', join(',', $netpbm_formats ?: [])); |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + // et maintenant envoyer la vignette de tests |
|
| 166 | + if (in_array($arg, ['gd1', 'gd2', 'imagick', 'convert', 'netpbm'])) { |
|
| 167 | + include_spip('inc/filtres'); |
|
| 168 | + include_spip('inc/filtres_images_mini'); |
|
| 169 | + $taille_preview = 150; |
|
| 170 | + $image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg'); |
|
| 171 | + |
|
| 172 | + $image['fichier_dest'] = _DIR_VAR . "test_$arg"; |
|
| 173 | + |
|
| 174 | + if ( |
|
| 175 | + $preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true) |
|
| 176 | + and ($preview['width'] * $preview['height'] > 0) |
|
| 177 | + ) { |
|
| 178 | + redirige_par_entete($preview['fichier']); |
|
| 179 | + } |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + # image echec |
|
| 183 | + redirige_par_entete(chemin_image('echec-reducteur-xx.svg')); |
|
| 184 | 184 | } |
@@ -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 | /** |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function action_desinstaller_plugin_dist() { |
| 34 | 34 | |
| 35 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | - $arg = $securiser_action(); |
|
| 37 | - [$dir_plugins, $plugin] = explode('::', $arg); |
|
| 38 | - $dir_type = '_DIR_PLUGINS'; |
|
| 39 | - if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) { |
|
| 40 | - $dir_type = '_DIR_PLUGINS_SUPPL'; |
|
| 41 | - } |
|
| 42 | - $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 43 | - $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 44 | - if ($infos and !$infos['install_test'][0]) { |
|
| 45 | - include_spip('inc/plugin'); |
|
| 46 | - ecrire_plugin_actifs([$plugin], false, 'enleve'); |
|
| 47 | - $erreur = ''; |
|
| 48 | - } else { |
|
| 49 | - $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 50 | - } |
|
| 51 | - if ($redirect = _request('redirect')) { |
|
| 52 | - include_spip('inc/headers'); |
|
| 53 | - if ($erreur) { |
|
| 54 | - $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 55 | - } |
|
| 56 | - $redirect = str_replace('&', '&', $redirect); |
|
| 57 | - redirige_par_entete($redirect); |
|
| 58 | - } |
|
| 35 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | + $arg = $securiser_action(); |
|
| 37 | + [$dir_plugins, $plugin] = explode('::', $arg); |
|
| 38 | + $dir_type = '_DIR_PLUGINS'; |
|
| 39 | + if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) { |
|
| 40 | + $dir_type = '_DIR_PLUGINS_SUPPL'; |
|
| 41 | + } |
|
| 42 | + $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 43 | + $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 44 | + if ($infos and !$infos['install_test'][0]) { |
|
| 45 | + include_spip('inc/plugin'); |
|
| 46 | + ecrire_plugin_actifs([$plugin], false, 'enleve'); |
|
| 47 | + $erreur = ''; |
|
| 48 | + } else { |
|
| 49 | + $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 50 | + } |
|
| 51 | + if ($redirect = _request('redirect')) { |
|
| 52 | + include_spip('inc/headers'); |
|
| 53 | + if ($erreur) { |
|
| 54 | + $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 55 | + } |
|
| 56 | + $redirect = str_replace('&', '&', $redirect); |
|
| 57 | + redirige_par_entete($redirect); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -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 | |
@@ -54,84 +54,84 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | function balise_LOGO__dist($p) { |
| 56 | 56 | |
| 57 | - preg_match(',^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs); |
|
| 58 | - $type = strtolower($regs[1]); |
|
| 59 | - $suite_logo = $regs[2]; |
|
| 60 | - |
|
| 61 | - // cas de #LOGO_SITE_SPIP |
|
| 62 | - if ($type == 'site_spip') { |
|
| 63 | - $type = 'site'; |
|
| 64 | - $_id_objet = "\"'0'\""; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - $id_objet = id_table_objet($type); |
|
| 68 | - if (!isset($_id_objet)) { |
|
| 69 | - $_id_objet = champ_sql($id_objet, $p); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $fichier = ($p->etoile === '**') ? -1 : 0; |
|
| 73 | - $coord = []; |
|
| 74 | - $align = $lien = ''; |
|
| 75 | - $mode_logo = ''; |
|
| 76 | - |
|
| 77 | - if ($p->param and !$p->param[0][0]) { |
|
| 78 | - $params = $p->param[0]; |
|
| 79 | - array_shift($params); |
|
| 80 | - foreach ($params as $a) { |
|
| 81 | - if ($a[0]->type === 'texte') { |
|
| 82 | - $n = $a[0]->texte; |
|
| 83 | - if (is_numeric($n)) { |
|
| 84 | - $coord[] = $n; |
|
| 85 | - } elseif (in_array($n, ['top', 'left', 'right', 'center', 'bottom'])) { |
|
| 86 | - $align = $n; |
|
| 87 | - } elseif (in_array($n, ['auto', 'icone', 'apercu', 'vignette'])) { |
|
| 88 | - $mode_logo = $n; |
|
| 89 | - } |
|
| 90 | - } else { |
|
| 91 | - $lien = calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $coord_x = !$coord ? 0 : intval(array_shift($coord)); |
|
| 97 | - $coord_y = !$coord ? 0 : intval(array_shift($coord)); |
|
| 98 | - |
|
| 99 | - if ($p->etoile === '*') { |
|
| 100 | - include_spip('balise/url_'); |
|
| 101 | - $lien = generer_generer_url_arg($type, $p, $_id_objet); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : ''; |
|
| 105 | - if ($type == 'document') { |
|
| 106 | - $qconnect = _q($connect); |
|
| 107 | - $doc = "quete_document($_id_objet, $qconnect)"; |
|
| 108 | - if ($fichier) { |
|
| 109 | - $code = "quete_logo_file($doc, $qconnect)"; |
|
| 110 | - } else { |
|
| 111 | - $code = "quete_logo_document($doc, " . ($lien ?: "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 112 | - } |
|
| 113 | - // (x=non-faux ? y : '') pour affecter x en retournant y |
|
| 114 | - if ($p->descr['documents']) { |
|
| 115 | - $code = '(($doublons["documents"] .= ",". ' |
|
| 116 | - . $_id_objet |
|
| 117 | - . ") ? $code : '')"; |
|
| 118 | - } |
|
| 119 | - } elseif ($connect) { |
|
| 120 | - $code = "''"; |
|
| 121 | - spip_log('Les logos distants ne sont pas prevus'); |
|
| 122 | - } else { |
|
| 123 | - $code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0} |
|
| 127 | - if ($coord_x or $coord_y) { |
|
| 128 | - $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))"; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $p->code = $code; |
|
| 132 | - $p->interdire_scripts = false; |
|
| 133 | - |
|
| 134 | - return $p; |
|
| 57 | + preg_match(',^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs); |
|
| 58 | + $type = strtolower($regs[1]); |
|
| 59 | + $suite_logo = $regs[2]; |
|
| 60 | + |
|
| 61 | + // cas de #LOGO_SITE_SPIP |
|
| 62 | + if ($type == 'site_spip') { |
|
| 63 | + $type = 'site'; |
|
| 64 | + $_id_objet = "\"'0'\""; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + $id_objet = id_table_objet($type); |
|
| 68 | + if (!isset($_id_objet)) { |
|
| 69 | + $_id_objet = champ_sql($id_objet, $p); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $fichier = ($p->etoile === '**') ? -1 : 0; |
|
| 73 | + $coord = []; |
|
| 74 | + $align = $lien = ''; |
|
| 75 | + $mode_logo = ''; |
|
| 76 | + |
|
| 77 | + if ($p->param and !$p->param[0][0]) { |
|
| 78 | + $params = $p->param[0]; |
|
| 79 | + array_shift($params); |
|
| 80 | + foreach ($params as $a) { |
|
| 81 | + if ($a[0]->type === 'texte') { |
|
| 82 | + $n = $a[0]->texte; |
|
| 83 | + if (is_numeric($n)) { |
|
| 84 | + $coord[] = $n; |
|
| 85 | + } elseif (in_array($n, ['top', 'left', 'right', 'center', 'bottom'])) { |
|
| 86 | + $align = $n; |
|
| 87 | + } elseif (in_array($n, ['auto', 'icone', 'apercu', 'vignette'])) { |
|
| 88 | + $mode_logo = $n; |
|
| 89 | + } |
|
| 90 | + } else { |
|
| 91 | + $lien = calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $coord_x = !$coord ? 0 : intval(array_shift($coord)); |
|
| 97 | + $coord_y = !$coord ? 0 : intval(array_shift($coord)); |
|
| 98 | + |
|
| 99 | + if ($p->etoile === '*') { |
|
| 100 | + include_spip('balise/url_'); |
|
| 101 | + $lien = generer_generer_url_arg($type, $p, $_id_objet); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : ''; |
|
| 105 | + if ($type == 'document') { |
|
| 106 | + $qconnect = _q($connect); |
|
| 107 | + $doc = "quete_document($_id_objet, $qconnect)"; |
|
| 108 | + if ($fichier) { |
|
| 109 | + $code = "quete_logo_file($doc, $qconnect)"; |
|
| 110 | + } else { |
|
| 111 | + $code = "quete_logo_document($doc, " . ($lien ?: "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 112 | + } |
|
| 113 | + // (x=non-faux ? y : '') pour affecter x en retournant y |
|
| 114 | + if ($p->descr['documents']) { |
|
| 115 | + $code = '(($doublons["documents"] .= ",". ' |
|
| 116 | + . $_id_objet |
|
| 117 | + . ") ? $code : '')"; |
|
| 118 | + } |
|
| 119 | + } elseif ($connect) { |
|
| 120 | + $code = "''"; |
|
| 121 | + spip_log('Les logos distants ne sont pas prevus'); |
|
| 122 | + } else { |
|
| 123 | + $code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0} |
|
| 127 | + if ($coord_x or $coord_y) { |
|
| 128 | + $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))"; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $p->code = $code; |
|
| 132 | + $p->interdire_scripts = false; |
|
| 133 | + |
|
| 134 | + return $p; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -158,20 +158,20 @@ discard block |
||
| 158 | 158 | * Code compilé retournant le chemin du logo ou le code HTML du logo. |
| 159 | 159 | **/ |
| 160 | 160 | function logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $_lien, $p, $suite) { |
| 161 | - $code = "quete_logo('$id_objet', '" . |
|
| 162 | - (($suite == '_SURVOL') ? 'off' : |
|
| 163 | - (($suite == '_NORMAL') ? 'on' : 'ON')) . |
|
| 164 | - "', $_id_objet," . |
|
| 165 | - (($suite == '_RUBRIQUE') ? |
|
| 166 | - champ_sql('id_rubrique', $p) : |
|
| 167 | - (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) . |
|
| 168 | - ', ' . intval($fichier) . ')'; |
|
| 169 | - |
|
| 170 | - if ($fichier) { |
|
| 171 | - return $code; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - $align = preg_replace(',\W,', '', $align); |
|
| 175 | - |
|
| 176 | - return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')'; |
|
| 161 | + $code = "quete_logo('$id_objet', '" . |
|
| 162 | + (($suite == '_SURVOL') ? 'off' : |
|
| 163 | + (($suite == '_NORMAL') ? 'on' : 'ON')) . |
|
| 164 | + "', $_id_objet," . |
|
| 165 | + (($suite == '_RUBRIQUE') ? |
|
| 166 | + champ_sql('id_rubrique', $p) : |
|
| 167 | + (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) . |
|
| 168 | + ', ' . intval($fichier) . ')'; |
|
| 169 | + |
|
| 170 | + if ($fichier) { |
|
| 171 | + return $code; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + $align = preg_replace(',\W,', '', $align); |
|
| 175 | + |
|
| 176 | + return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')'; |
|
| 177 | 177 | } |