@@ -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 | include_spip('inc/headers'); |
| 23 | 23 | |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | * Sortie du buffer |
| 35 | 35 | **/ |
| 36 | 36 | function action_tester_taille_error_handler($output) { |
| 37 | - // on est ici, donc echec lors de la creation de l'image |
|
| 38 | - if (!empty($GLOBALS['redirect'])) { |
|
| 39 | - return redirige_formulaire($GLOBALS['redirect']); |
|
| 40 | - } |
|
| 37 | + // on est ici, donc echec lors de la creation de l'image |
|
| 38 | + if (!empty($GLOBALS['redirect'])) { |
|
| 39 | + return redirige_formulaire($GLOBALS['redirect']); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - return $output; |
|
| 42 | + return $output; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -57,77 +57,77 @@ discard block |
||
| 57 | 57 | **/ |
| 58 | 58 | function action_tester_taille_dist() { |
| 59 | 59 | |
| 60 | - if (!autoriser('configurer')) { |
|
| 61 | - return; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - $taille = _request('arg'); |
|
| 65 | - $taille = explode('-', (string) $taille); |
|
| 66 | - |
|
| 67 | - $GLOBALS['taille_max'] = end($taille); |
|
| 68 | - $GLOBALS['taille_min'] = 0; |
|
| 69 | - if (count($taille) > 1) { |
|
| 70 | - $GLOBALS['taille_min'] = reset($taille); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - // si l'intervalle est assez petit, on garde la valeur min |
|
| 74 | - if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { |
|
| 75 | - $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']); |
|
| 76 | - if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) { |
|
| 77 | - $t *= 0.9; // marge de securite |
|
| 78 | - echo round($t / 1_000_000, 3) . ' Mpx'; |
|
| 79 | - } else { |
|
| 80 | - // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue" |
|
| 81 | - $t = 0; |
|
| 82 | - echo '∞'; |
|
| 83 | - } |
|
| 84 | - ecrire_meta('max_taille_vignettes', $t, 'non'); |
|
| 85 | - die(); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); |
|
| 89 | - |
|
| 90 | - include_spip('inc/filtres'); |
|
| 91 | - // des inclusions representatives d'un hit prive et/ou public pour la conso memoire |
|
| 92 | - include_spip('public/assembler'); |
|
| 93 | - include_spip('public/balises'); |
|
| 94 | - include_spip('public/boucles'); |
|
| 95 | - include_spip('public/cacher'); |
|
| 96 | - include_spip('public/compiler'); |
|
| 97 | - include_spip('public/composer'); |
|
| 98 | - include_spip('public/criteres'); |
|
| 99 | - include_spip('public/interfaces'); |
|
| 100 | - include_spip('public/parametrer'); |
|
| 101 | - include_spip('public/phraser_html'); |
|
| 102 | - include_spip('public/references'); |
|
| 103 | - |
|
| 104 | - include_spip('inc/presentation'); |
|
| 105 | - include_spip('inc/charsets'); |
|
| 106 | - include_spip('inc/documents'); |
|
| 107 | - include_spip('inc/header'); |
|
| 108 | - propre('<doc1>'); // charger propre avec le trairement d'un modele |
|
| 109 | - |
|
| 110 | - $i = _request('i') + 1; |
|
| 111 | - $image_source = chemin_image('test.png'); |
|
| 112 | - $GLOBALS['redirect'] = generer_url_action( |
|
| 113 | - 'tester_taille', |
|
| 114 | - "i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test'] |
|
| 115 | - ); |
|
| 116 | - |
|
| 117 | - ob_start('action_tester_taille_error_handler'); |
|
| 118 | - filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 119 | - $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 120 | - |
|
| 121 | - // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee |
|
| 122 | - // si $GLOBALS['taille_min']==0 (car on est au premier coup) |
|
| 123 | - if ($GLOBALS['taille_min'] == 0) { |
|
| 124 | - $taille = $GLOBALS['taille_max']; |
|
| 125 | - filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 126 | - $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 127 | - } |
|
| 128 | - ob_end_clean(); |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - // on est ici, donc pas de plantage |
|
| 132 | - echo redirige_formulaire($GLOBALS['redirect']); |
|
| 60 | + if (!autoriser('configurer')) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + $taille = _request('arg'); |
|
| 65 | + $taille = explode('-', (string) $taille); |
|
| 66 | + |
|
| 67 | + $GLOBALS['taille_max'] = end($taille); |
|
| 68 | + $GLOBALS['taille_min'] = 0; |
|
| 69 | + if (count($taille) > 1) { |
|
| 70 | + $GLOBALS['taille_min'] = reset($taille); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + // si l'intervalle est assez petit, on garde la valeur min |
|
| 74 | + if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) { |
|
| 75 | + $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']); |
|
| 76 | + if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) { |
|
| 77 | + $t *= 0.9; // marge de securite |
|
| 78 | + echo round($t / 1_000_000, 3) . ' Mpx'; |
|
| 79 | + } else { |
|
| 80 | + // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue" |
|
| 81 | + $t = 0; |
|
| 82 | + echo '∞'; |
|
| 83 | + } |
|
| 84 | + ecrire_meta('max_taille_vignettes', $t, 'non'); |
|
| 85 | + die(); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2); |
|
| 89 | + |
|
| 90 | + include_spip('inc/filtres'); |
|
| 91 | + // des inclusions representatives d'un hit prive et/ou public pour la conso memoire |
|
| 92 | + include_spip('public/assembler'); |
|
| 93 | + include_spip('public/balises'); |
|
| 94 | + include_spip('public/boucles'); |
|
| 95 | + include_spip('public/cacher'); |
|
| 96 | + include_spip('public/compiler'); |
|
| 97 | + include_spip('public/composer'); |
|
| 98 | + include_spip('public/criteres'); |
|
| 99 | + include_spip('public/interfaces'); |
|
| 100 | + include_spip('public/parametrer'); |
|
| 101 | + include_spip('public/phraser_html'); |
|
| 102 | + include_spip('public/references'); |
|
| 103 | + |
|
| 104 | + include_spip('inc/presentation'); |
|
| 105 | + include_spip('inc/charsets'); |
|
| 106 | + include_spip('inc/documents'); |
|
| 107 | + include_spip('inc/header'); |
|
| 108 | + propre('<doc1>'); // charger propre avec le trairement d'un modele |
|
| 109 | + |
|
| 110 | + $i = _request('i') + 1; |
|
| 111 | + $image_source = chemin_image('test.png'); |
|
| 112 | + $GLOBALS['redirect'] = generer_url_action( |
|
| 113 | + 'tester_taille', |
|
| 114 | + "i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test'] |
|
| 115 | + ); |
|
| 116 | + |
|
| 117 | + ob_start('action_tester_taille_error_handler'); |
|
| 118 | + filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 119 | + $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 120 | + |
|
| 121 | + // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee |
|
| 122 | + // si $GLOBALS['taille_min']==0 (car on est au premier coup) |
|
| 123 | + if ($GLOBALS['taille_min'] == 0) { |
|
| 124 | + $taille = $GLOBALS['taille_max']; |
|
| 125 | + filtrer('image_recadre', $image_source, $taille, $taille); |
|
| 126 | + $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']); |
|
| 127 | + } |
|
| 128 | + ob_end_clean(); |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + // on est ici, donc pas de plantage |
|
| 132 | + echo redirige_formulaire($GLOBALS['redirect']); |
|
| 133 | 133 | } |
@@ -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 | /** |
@@ -24,41 +24,41 @@ discard block |
||
| 24 | 24 | **/ |
| 25 | 25 | function action_instituer_langue_rubrique_dist() { |
| 26 | 26 | |
| 27 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 28 | - $arg = $securiser_action(); |
|
| 29 | - $changer_lang = _request('changer_lang'); |
|
| 27 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 28 | + $arg = $securiser_action(); |
|
| 29 | + $changer_lang = _request('changer_lang'); |
|
| 30 | 30 | |
| 31 | - [$id_rubrique, $id_parent] = preg_split('/\W/', (string) $arg); |
|
| 31 | + [$id_rubrique, $id_parent] = preg_split('/\W/', (string) $arg); |
|
| 32 | 32 | |
| 33 | - if ( |
|
| 34 | - $changer_lang |
|
| 35 | - && $id_rubrique > 0 |
|
| 36 | - && $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 37 | - && ($GLOBALS['meta']['multi_secteurs'] == 'non' || $id_parent == 0) |
|
| 38 | - ) { |
|
| 39 | - if ($changer_lang != 'herit') { |
|
| 40 | - sql_updateq( |
|
| 41 | - 'spip_rubriques', |
|
| 42 | - ['lang' => $changer_lang, 'langue_choisie' => 'oui'], |
|
| 43 | - "id_rubrique=$id_rubrique" |
|
| 44 | - ); |
|
| 45 | - } else { |
|
| 46 | - if ($id_parent == 0) { |
|
| 47 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 48 | - } else { |
|
| 49 | - $langue_parent = sql_getfetsel('lang', 'spip_rubriques', "id_rubrique=$id_parent"); |
|
| 50 | - } |
|
| 51 | - sql_updateq( |
|
| 52 | - 'spip_rubriques', |
|
| 53 | - ['lang' => $langue_parent, 'langue_choisie' => 'non'], |
|
| 54 | - "id_rubrique=$id_rubrique" |
|
| 55 | - ); |
|
| 56 | - } |
|
| 57 | - include_spip('inc/rubriques'); |
|
| 58 | - calculer_langues_rubriques(); |
|
| 33 | + if ( |
|
| 34 | + $changer_lang |
|
| 35 | + && $id_rubrique > 0 |
|
| 36 | + && $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 37 | + && ($GLOBALS['meta']['multi_secteurs'] == 'non' || $id_parent == 0) |
|
| 38 | + ) { |
|
| 39 | + if ($changer_lang != 'herit') { |
|
| 40 | + sql_updateq( |
|
| 41 | + 'spip_rubriques', |
|
| 42 | + ['lang' => $changer_lang, 'langue_choisie' => 'oui'], |
|
| 43 | + "id_rubrique=$id_rubrique" |
|
| 44 | + ); |
|
| 45 | + } else { |
|
| 46 | + if ($id_parent == 0) { |
|
| 47 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 48 | + } else { |
|
| 49 | + $langue_parent = sql_getfetsel('lang', 'spip_rubriques', "id_rubrique=$id_parent"); |
|
| 50 | + } |
|
| 51 | + sql_updateq( |
|
| 52 | + 'spip_rubriques', |
|
| 53 | + ['lang' => $langue_parent, 'langue_choisie' => 'non'], |
|
| 54 | + "id_rubrique=$id_rubrique" |
|
| 55 | + ); |
|
| 56 | + } |
|
| 57 | + include_spip('inc/rubriques'); |
|
| 58 | + calculer_langues_rubriques(); |
|
| 59 | 59 | |
| 60 | - // invalider les caches marques de cette rubrique |
|
| 61 | - include_spip('inc/invalideur'); |
|
| 62 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 63 | - } |
|
| 60 | + // invalider les caches marques de cette rubrique |
|
| 61 | + include_spip('inc/invalideur'); |
|
| 62 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -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 | /** |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | 27 | function action_forcer_job_dist() { |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $id_job = $securiser_action(); |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $id_job = $securiser_action(); |
|
| 30 | 30 | |
| 31 | - if ( |
|
| 32 | - ($id_job = (int) $id_job) |
|
| 33 | - && autoriser('forcer', 'job', $id_job) |
|
| 34 | - ) { |
|
| 35 | - include_spip('inc/queue'); |
|
| 36 | - include_spip('inc/genie'); |
|
| 37 | - queue_schedule([$id_job]); |
|
| 38 | - } |
|
| 31 | + if ( |
|
| 32 | + ($id_job = (int) $id_job) |
|
| 33 | + && autoriser('forcer', 'job', $id_job) |
|
| 34 | + ) { |
|
| 35 | + include_spip('inc/queue'); |
|
| 36 | + include_spip('inc/genie'); |
|
| 37 | + queue_schedule([$id_job]); |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -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 | |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | function action_supprimer_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('-', (string) $arg); |
|
| 43 | - [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 42 | + $arg = explode('-', (string) $arg); |
|
| 43 | + [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 44 | 44 | |
| 45 | - include_spip('action/editer_liens'); |
|
| 46 | - objet_dissocier([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 45 | + include_spip('action/editer_liens'); |
|
| 46 | + objet_dissocier([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 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/actions'); |
@@ -28,23 +28,23 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function action_etre_webmestre_dist() { |
| 31 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 32 | - $time = $securiser_action(); |
|
| 31 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 32 | + $time = $securiser_action(); |
|
| 33 | 33 | |
| 34 | - if ( |
|
| 35 | - time() - $time < 15 * 60 |
|
| 36 | - && $GLOBALS['visiteur_session']['statut'] == '0minirezo' |
|
| 37 | - && $GLOBALS['visiteur_session']['webmestre'] !== 'oui' |
|
| 38 | - ) { |
|
| 39 | - $action = _T('info_admin_etre_webmestre'); |
|
| 40 | - $admin = charger_fonction('admin', 'inc'); |
|
| 41 | - // lance la verif par ftp et l'appel |
|
| 42 | - // a base_etre_webmestre_dist quand c'est OK |
|
| 43 | - if ($r = $admin('etre_webmestre', $action)) { |
|
| 44 | - echo $r; |
|
| 45 | - exit; |
|
| 46 | - } |
|
| 47 | - } |
|
| 34 | + if ( |
|
| 35 | + time() - $time < 15 * 60 |
|
| 36 | + && $GLOBALS['visiteur_session']['statut'] == '0minirezo' |
|
| 37 | + && $GLOBALS['visiteur_session']['webmestre'] !== 'oui' |
|
| 38 | + ) { |
|
| 39 | + $action = _T('info_admin_etre_webmestre'); |
|
| 40 | + $admin = charger_fonction('admin', 'inc'); |
|
| 41 | + // lance la verif par ftp et l'appel |
|
| 42 | + // a base_etre_webmestre_dist quand c'est OK |
|
| 43 | + if ($r = $admin('etre_webmestre', $action)) { |
|
| 44 | + echo $r; |
|
| 45 | + exit; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | 55 | function base_etre_webmestre_dist() { |
| 56 | - if ($GLOBALS['visiteur_session']['statut'] == '0minirezo' && $GLOBALS['visiteur_session']['webmestre'] !== 'oui') { |
|
| 57 | - include_spip('action/editer_auteur'); |
|
| 58 | - auteur_instituer($GLOBALS['visiteur_session']['id_auteur'], ['webmestre' => 'oui'], true); |
|
| 59 | - } |
|
| 56 | + if ($GLOBALS['visiteur_session']['statut'] == '0minirezo' && $GLOBALS['visiteur_session']['webmestre'] !== 'oui') { |
|
| 57 | + include_spip('action/editer_auteur'); |
|
| 58 | + auteur_instituer($GLOBALS['visiteur_session']['id_auteur'], ['webmestre' => 'oui'], true); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -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 | /** |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | 35 | function action_ajouter_lien_dist($arg = null) { |
| 36 | - if (is_null($arg)) { |
|
| 37 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 38 | - $arg = $securiser_action(); |
|
| 39 | - } |
|
| 36 | + if (is_null($arg)) { |
|
| 37 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 38 | + $arg = $securiser_action(); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $arg = explode('-', (string) $arg); |
|
| 42 | - [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 41 | + $arg = explode('-', (string) $arg); |
|
| 42 | + [$objet_source, $ids, $objet_lie, $idl] = $arg; |
|
| 43 | 43 | |
| 44 | - include_spip('action/editer_liens'); |
|
| 45 | - objet_associer([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 44 | + include_spip('action/editer_liens'); |
|
| 45 | + objet_associer([$objet_source => $ids], [$objet_lie => $idl]); |
|
| 46 | 46 | } |
@@ -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,53 +35,53 @@ discard block |
||
| 35 | 35 | * ``` |
| 36 | 36 | **/ |
| 37 | 37 | function action_redirect_dist() { |
| 38 | - $type = _request('type'); |
|
| 39 | - $id = (int) _request('id'); |
|
| 40 | - $page = false; |
|
| 38 | + $type = _request('type'); |
|
| 39 | + $id = (int) _request('id'); |
|
| 40 | + $page = false; |
|
| 41 | 41 | |
| 42 | - // verifier le type ou page transmis |
|
| 43 | - if (!preg_match('/^\w+$/', (string) $type)) { |
|
| 44 | - $page = _request('page'); |
|
| 45 | - if (!preg_match('/^\w+$/', (string) $page)) { |
|
| 46 | - return; |
|
| 47 | - } |
|
| 48 | - } |
|
| 42 | + // verifier le type ou page transmis |
|
| 43 | + if (!preg_match('/^\w+$/', (string) $type)) { |
|
| 44 | + $page = _request('page'); |
|
| 45 | + if (!preg_match('/^\w+$/', (string) $page)) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $var_mode = _request('var_mode'); |
|
| 51 | - // forcer la mise a jour de l'url de cet objet ! |
|
| 52 | - if ($var_mode && !defined('_VAR_URLS')) { |
|
| 53 | - define('_VAR_URLS', true); |
|
| 54 | - } |
|
| 50 | + $var_mode = _request('var_mode'); |
|
| 51 | + // forcer la mise a jour de l'url de cet objet ! |
|
| 52 | + if ($var_mode && !defined('_VAR_URLS')) { |
|
| 53 | + define('_VAR_URLS', true); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - $url = $page |
|
| 57 | - ? generer_url_public($page, '', true) |
|
| 58 | - : calculer_url_redirect_entite($type, $id, $var_mode); |
|
| 56 | + $url = $page |
|
| 57 | + ? generer_url_public($page, '', true) |
|
| 58 | + : calculer_url_redirect_entite($type, $id, $var_mode); |
|
| 59 | 59 | |
| 60 | - $status = '302'; |
|
| 61 | - if ($url) { |
|
| 62 | - if ($var_mode) { |
|
| 63 | - $url = parametre_url($url, 'var_mode', $var_mode, '&'); |
|
| 64 | - } |
|
| 60 | + $status = '302'; |
|
| 61 | + if ($url) { |
|
| 62 | + if ($var_mode) { |
|
| 63 | + $url = parametre_url($url, 'var_mode', $var_mode, '&'); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - if ( |
|
| 67 | - $var_mode == 'preview' |
|
| 68 | - && defined('_PREVIEW_TOKEN') |
|
| 69 | - && _PREVIEW_TOKEN |
|
| 70 | - && autoriser('previsualiser') |
|
| 71 | - ) { |
|
| 72 | - include_spip('inc/securiser_action'); |
|
| 73 | - $token = calculer_token_previsu($url); |
|
| 74 | - $url = parametre_url($url, 'var_previewtoken', $token); |
|
| 75 | - } |
|
| 66 | + if ( |
|
| 67 | + $var_mode == 'preview' |
|
| 68 | + && defined('_PREVIEW_TOKEN') |
|
| 69 | + && _PREVIEW_TOKEN |
|
| 70 | + && autoriser('previsualiser') |
|
| 71 | + ) { |
|
| 72 | + include_spip('inc/securiser_action'); |
|
| 73 | + $token = calculer_token_previsu($url); |
|
| 74 | + $url = parametre_url($url, 'var_previewtoken', $token); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - if (_request('status') && _request('status') == '301') { |
|
| 78 | - $status = '301'; |
|
| 79 | - } |
|
| 80 | - } else { |
|
| 81 | - $url = generer_url_public('404', '', true); |
|
| 82 | - } |
|
| 77 | + if (_request('status') && _request('status') == '301') { |
|
| 78 | + $status = '301'; |
|
| 79 | + } |
|
| 80 | + } else { |
|
| 81 | + $url = generer_url_public('404', '', true); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - redirige_par_entete(str_replace('&', '&', (string) $url), '', $status); |
|
| 84 | + redirige_par_entete(str_replace('&', '&', (string) $url), '', $status); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -96,35 +96,35 @@ discard block |
||
| 96 | 96 | * @return string|null |
| 97 | 97 | */ |
| 98 | 98 | function calculer_url_redirect_entite($type, $id, $var_mode) { |
| 99 | - $desc = null; |
|
| 100 | - $publie = null; |
|
| 101 | - $url = null; |
|
| 102 | - // invalider le cache à chaque modif en bdd |
|
| 103 | - $date = 0; |
|
| 104 | - if (isset($GLOBALS['meta']['derniere_modif'])) { |
|
| 105 | - $date = $GLOBALS['meta']['derniere_modif']; |
|
| 106 | - } |
|
| 107 | - $key = "url-$date-$type-$id"; |
|
| 99 | + $desc = null; |
|
| 100 | + $publie = null; |
|
| 101 | + $url = null; |
|
| 102 | + // invalider le cache à chaque modif en bdd |
|
| 103 | + $date = 0; |
|
| 104 | + if (isset($GLOBALS['meta']['derniere_modif'])) { |
|
| 105 | + $date = $GLOBALS['meta']['derniere_modif']; |
|
| 106 | + } |
|
| 107 | + $key = "url-$date-$type-$id"; |
|
| 108 | 108 | |
| 109 | - // Obtenir l’url et si elle est publié du cache memoization |
|
| 110 | - if (function_exists('cache_get') && ($desc = cache_get($key))) { |
|
| 111 | - [$url, $publie] = $desc; |
|
| 112 | - } |
|
| 113 | - // Si on ne l’a pas trouvé, ou si var mode, on calcule l’url et son état publie |
|
| 114 | - if (empty($desc) || $var_mode) { |
|
| 115 | - $publie = objet_test_si_publie($type, $id); |
|
| 116 | - $url = generer_objet_url_absolue($id, $type, '', '', true); |
|
| 117 | - if (function_exists('cache_set')) { |
|
| 118 | - cache_set($key, [$url, $publie], 3600); |
|
| 119 | - } |
|
| 120 | - } |
|
| 109 | + // Obtenir l’url et si elle est publié du cache memoization |
|
| 110 | + if (function_exists('cache_get') && ($desc = cache_get($key))) { |
|
| 111 | + [$url, $publie] = $desc; |
|
| 112 | + } |
|
| 113 | + // Si on ne l’a pas trouvé, ou si var mode, on calcule l’url et son état publie |
|
| 114 | + if (empty($desc) || $var_mode) { |
|
| 115 | + $publie = objet_test_si_publie($type, $id); |
|
| 116 | + $url = generer_objet_url_absolue($id, $type, '', '', true); |
|
| 117 | + if (function_exists('cache_set')) { |
|
| 118 | + cache_set($key, [$url, $publie], 3600); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - // On valide l’url si elle est publiee ; sinon si preview on teste l’autorisation |
|
| 123 | - if ($publie) { |
|
| 124 | - return $url; |
|
| 125 | - } elseif (defined('_VAR_PREVIEW') && _VAR_PREVIEW && autoriser('voir', $type, $id)) { |
|
| 126 | - return $url; |
|
| 127 | - } |
|
| 122 | + // On valide l’url si elle est publiee ; sinon si preview on teste l’autorisation |
|
| 123 | + if ($publie) { |
|
| 124 | + return $url; |
|
| 125 | + } elseif (defined('_VAR_PREVIEW') && _VAR_PREVIEW && autoriser('voir', $type, $id)) { |
|
| 126 | + return $url; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - return; |
|
| 129 | + return; |
|
| 130 | 130 | } |
@@ -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 | /** |
@@ -27,23 +27,23 @@ discard block |
||
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | 29 | function action_confirmer_email_dist() { |
| 30 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 31 | - $arg = $securiser_action(); |
|
| 30 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 31 | + $arg = $securiser_action(); |
|
| 32 | 32 | |
| 33 | - include_spip('inc/filtres'); |
|
| 34 | - if ($GLOBALS['visiteur_session']['id_auteur'] && email_valide($arg)) { |
|
| 35 | - include_spip('action/editer_auteur'); |
|
| 36 | - auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], ['email' => $arg]); |
|
| 37 | - } |
|
| 38 | - // verifier avant de rediriger pour invalider le message de confirmation |
|
| 39 | - // si ca n'a pas marche |
|
| 40 | - if ( |
|
| 41 | - ($redirect = _request('redirect')) && !$arg == sql_getfetsel( |
|
| 42 | - 'email', |
|
| 43 | - 'spip_auteurs', |
|
| 44 | - 'id_auteur=' . (int) $GLOBALS['visiteur_session'] |
|
| 45 | - ) |
|
| 46 | - ) { |
|
| 47 | - $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
|
| 48 | - } |
|
| 33 | + include_spip('inc/filtres'); |
|
| 34 | + if ($GLOBALS['visiteur_session']['id_auteur'] && email_valide($arg)) { |
|
| 35 | + include_spip('action/editer_auteur'); |
|
| 36 | + auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], ['email' => $arg]); |
|
| 37 | + } |
|
| 38 | + // verifier avant de rediriger pour invalider le message de confirmation |
|
| 39 | + // si ca n'a pas marche |
|
| 40 | + if ( |
|
| 41 | + ($redirect = _request('redirect')) && !$arg == sql_getfetsel( |
|
| 42 | + 'email', |
|
| 43 | + 'spip_auteurs', |
|
| 44 | + 'id_auteur=' . (int) $GLOBALS['visiteur_session'] |
|
| 45 | + ) |
|
| 46 | + ) { |
|
| 47 | + $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -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,17 +30,17 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function action_debloquer_edition_dist() { |
| 32 | 32 | |
| 33 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 34 | - $arg = $securiser_action(); |
|
| 33 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 34 | + $arg = $securiser_action(); |
|
| 35 | 35 | |
| 36 | - if ($arg) { |
|
| 37 | - include_spip('inc/drapeau_edition'); |
|
| 38 | - if ($arg == 'tous') { |
|
| 39 | - debloquer_tous($GLOBALS['visiteur_session']['id_auteur']); |
|
| 40 | - } else { |
|
| 41 | - $arg = explode('-', (string) $arg); |
|
| 42 | - [$objet, $id_objet] = $arg; |
|
| 43 | - debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet); |
|
| 44 | - } |
|
| 45 | - } |
|
| 36 | + if ($arg) { |
|
| 37 | + include_spip('inc/drapeau_edition'); |
|
| 38 | + if ($arg == 'tous') { |
|
| 39 | + debloquer_tous($GLOBALS['visiteur_session']['id_auteur']); |
|
| 40 | + } else { |
|
| 41 | + $arg = explode('-', (string) $arg); |
|
| 42 | + [$objet, $id_objet] = $arg; |
|
| 43 | + debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | } |