@@ -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,17 +32,17 @@ discard block |
||
| 32 | 32 | * Envoyer en réponse : json contenant toutes les variables publiques de la session |
| 33 | 33 | **/ |
| 34 | 34 | function action_session_dist() { |
| 35 | - if ( |
|
| 36 | - $var = _request('var') |
|
| 37 | - and preg_match(',^[a-z_0-9-]+$,i', $var) |
|
| 38 | - ) { |
|
| 39 | - if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 40 | - include_spip('inc/session'); |
|
| 41 | - session_set('session_' . $var, $val = _request('val')); |
|
| 42 | - #spip_log("autosave:$var:$val",'autosave'); |
|
| 43 | - } |
|
| 44 | - } |
|
| 35 | + if ( |
|
| 36 | + $var = _request('var') |
|
| 37 | + and preg_match(',^[a-z_0-9-]+$,i', $var) |
|
| 38 | + ) { |
|
| 39 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 40 | + include_spip('inc/session'); |
|
| 41 | + session_set('session_' . $var, $val = _request('val')); |
|
| 42 | + #spip_log("autosave:$var:$val",'autosave'); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - # TODO: mode lecture de session ; n'afficher que ce qu'il faut |
|
| 47 | - #echo json_encode($GLOBALS['visiteur_session']); |
|
| 46 | + # TODO: mode lecture de session ; n'afficher que ce qu'il faut |
|
| 47 | + #echo json_encode($GLOBALS['visiteur_session']); |
|
| 48 | 48 | } |
@@ -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 | /** |
@@ -41,54 +41,54 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function action_referencer_traduction_dist($objet, $id_objet, $id_trad) { |
| 43 | 43 | |
| 44 | - // ne rien faire si id_trad est ambigu |
|
| 45 | - if (!is_numeric($id_trad)) { |
|
| 46 | - return false; |
|
| 47 | - } |
|
| 44 | + // ne rien faire si id_trad est ambigu |
|
| 45 | + if (!is_numeric($id_trad)) { |
|
| 46 | + return false; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - $table_objet_sql = table_objet_sql($objet); |
|
| 50 | - $id_table_objet = id_table_objet($objet); |
|
| 49 | + $table_objet_sql = table_objet_sql($objet); |
|
| 50 | + $id_table_objet = id_table_objet($objet); |
|
| 51 | 51 | |
| 52 | - // on a fourni un id_trad : affectation ou modification du groupe de trad |
|
| 53 | - if ($id_trad) { |
|
| 54 | - // selectionner l'objet cible, qui doit etre different de nous-meme, |
|
| 55 | - // et quitter s'il n'existe pas |
|
| 56 | - $id_lier = sql_getfetsel( |
|
| 57 | - 'id_trad', |
|
| 58 | - $table_objet_sql, |
|
| 59 | - "$id_table_objet=" . intval($id_trad) . " AND NOT($id_table_objet=" . intval($id_objet) . ')' |
|
| 60 | - ); |
|
| 61 | - if ($id_lier === null) { |
|
| 62 | - spip_log("echec lien de trad vers objet $objet/$id_objet incorrect ($id_trad)"); |
|
| 52 | + // on a fourni un id_trad : affectation ou modification du groupe de trad |
|
| 53 | + if ($id_trad) { |
|
| 54 | + // selectionner l'objet cible, qui doit etre different de nous-meme, |
|
| 55 | + // et quitter s'il n'existe pas |
|
| 56 | + $id_lier = sql_getfetsel( |
|
| 57 | + 'id_trad', |
|
| 58 | + $table_objet_sql, |
|
| 59 | + "$id_table_objet=" . intval($id_trad) . " AND NOT($id_table_objet=" . intval($id_objet) . ')' |
|
| 60 | + ); |
|
| 61 | + if ($id_lier === null) { |
|
| 62 | + spip_log("echec lien de trad vers objet $objet/$id_objet incorrect ($id_trad)"); |
|
| 63 | 63 | |
| 64 | - return false; |
|
| 65 | - } |
|
| 64 | + return false; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - // $id_lier est le numero du groupe de traduction |
|
| 68 | - // Si l'objet vise n'est pas deja traduit, son identifiant devient |
|
| 69 | - // le nouvel id_trad de ce nouveau groupe et on l'affecte aux deux |
|
| 70 | - // objets |
|
| 71 | - if ($id_lier == 0) { |
|
| 72 | - sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "$id_table_objet IN ($id_trad, $id_objet)"); |
|
| 73 | - } // si id_lier = id_objet alors on veut changer la reference de tout le groupe de trad |
|
| 74 | - elseif ($id_lier == $id_objet) { |
|
| 75 | - sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "id_trad = $id_lier"); |
|
| 76 | - } // sinon ajouter notre objet dans le groupe |
|
| 77 | - else { |
|
| 78 | - sql_updateq($table_objet_sql, ['id_trad' => $id_lier], "$id_table_objet=" . intval($id_objet)); |
|
| 79 | - } |
|
| 80 | - } // on a fourni un id_trad nul : sortir id_objet du groupe de trad |
|
| 81 | - else { |
|
| 82 | - $old_id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$id_table_objet=" . intval($id_objet)); |
|
| 83 | - // supprimer le lien de traduction |
|
| 84 | - sql_updateq($table_objet_sql, ['id_trad' => 0], "$id_table_objet=" . intval($id_objet)); |
|
| 67 | + // $id_lier est le numero du groupe de traduction |
|
| 68 | + // Si l'objet vise n'est pas deja traduit, son identifiant devient |
|
| 69 | + // le nouvel id_trad de ce nouveau groupe et on l'affecte aux deux |
|
| 70 | + // objets |
|
| 71 | + if ($id_lier == 0) { |
|
| 72 | + sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "$id_table_objet IN ($id_trad, $id_objet)"); |
|
| 73 | + } // si id_lier = id_objet alors on veut changer la reference de tout le groupe de trad |
|
| 74 | + elseif ($id_lier == $id_objet) { |
|
| 75 | + sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "id_trad = $id_lier"); |
|
| 76 | + } // sinon ajouter notre objet dans le groupe |
|
| 77 | + else { |
|
| 78 | + sql_updateq($table_objet_sql, ['id_trad' => $id_lier], "$id_table_objet=" . intval($id_objet)); |
|
| 79 | + } |
|
| 80 | + } // on a fourni un id_trad nul : sortir id_objet du groupe de trad |
|
| 81 | + else { |
|
| 82 | + $old_id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$id_table_objet=" . intval($id_objet)); |
|
| 83 | + // supprimer le lien de traduction |
|
| 84 | + sql_updateq($table_objet_sql, ['id_trad' => 0], "$id_table_objet=" . intval($id_objet)); |
|
| 85 | 85 | |
| 86 | - // Verifier si l'ancien groupe ne comporte plus qu'un seul objet. Alors mettre a zero. |
|
| 87 | - $cpt = sql_countsel($table_objet_sql, 'id_trad=' . intval($old_id_trad)); |
|
| 88 | - if ($cpt == 1) { |
|
| 89 | - sql_updateq($table_objet_sql, ['id_trad' => 0], 'id_trad=' . intval($old_id_trad)); |
|
| 90 | - } |
|
| 91 | - } |
|
| 86 | + // Verifier si l'ancien groupe ne comporte plus qu'un seul objet. Alors mettre a zero. |
|
| 87 | + $cpt = sql_countsel($table_objet_sql, 'id_trad=' . intval($old_id_trad)); |
|
| 88 | + if ($cpt == 1) { |
|
| 89 | + sql_updateq($table_objet_sql, ['id_trad' => 0], 'id_trad=' . intval($old_id_trad)); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - return true; |
|
| 93 | + return true; |
|
| 94 | 94 | } |
@@ -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 | /** |
@@ -28,23 +28,23 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function action_confirmer_email_dist() { |
| 31 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 32 | - $arg = $securiser_action(); |
|
| 31 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 32 | + $arg = $securiser_action(); |
|
| 33 | 33 | |
| 34 | - include_spip('inc/filtres'); |
|
| 35 | - if ($GLOBALS['visiteur_session']['id_auteur'] and email_valide($arg)) { |
|
| 36 | - include_spip('action/editer_auteur'); |
|
| 37 | - auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], ['email' => $arg]); |
|
| 38 | - } |
|
| 39 | - // verifier avant de rediriger pour invalider le message de confirmation |
|
| 40 | - // si ca n'a pas marche |
|
| 41 | - if ( |
|
| 42 | - $redirect = _request('redirect') and !$arg == sql_getfetsel( |
|
| 43 | - 'email', |
|
| 44 | - 'spip_auteurs', |
|
| 45 | - 'id_auteur=' . intval($GLOBALS['visiteur_session']) |
|
| 46 | - ) |
|
| 47 | - ) { |
|
| 48 | - $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
|
| 49 | - } |
|
| 34 | + include_spip('inc/filtres'); |
|
| 35 | + if ($GLOBALS['visiteur_session']['id_auteur'] and email_valide($arg)) { |
|
| 36 | + include_spip('action/editer_auteur'); |
|
| 37 | + auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], ['email' => $arg]); |
|
| 38 | + } |
|
| 39 | + // verifier avant de rediriger pour invalider le message de confirmation |
|
| 40 | + // si ca n'a pas marche |
|
| 41 | + if ( |
|
| 42 | + $redirect = _request('redirect') and !$arg == sql_getfetsel( |
|
| 43 | + 'email', |
|
| 44 | + 'spip_auteurs', |
|
| 45 | + 'id_auteur=' . intval($GLOBALS['visiteur_session']) |
|
| 46 | + ) |
|
| 47 | + ) { |
|
| 48 | + $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -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,25 +25,25 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function action_auth_dist() { |
| 27 | 27 | |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $arg = $securiser_action(); |
|
| 30 | - |
|
| 31 | - if (!preg_match(',^(\w+)[/](.+)$,', $arg, $r)) { |
|
| 32 | - spip_log("action_auth_dist $arg pas compris"); |
|
| 33 | - } else { |
|
| 34 | - $auth_methode = $r[1]; |
|
| 35 | - $login = $r[2]; |
|
| 36 | - include_spip('inc/auth'); |
|
| 37 | - $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 38 | - |
|
| 39 | - if (is_string($res)) { // Erreur |
|
| 40 | - $redirect = _request('redirect'); |
|
| 41 | - $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 42 | - include_spip('inc/headers'); |
|
| 43 | - redirige_par_entete($redirect); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 47 | - auth_loger($res); |
|
| 48 | - } |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $arg = $securiser_action(); |
|
| 30 | + |
|
| 31 | + if (!preg_match(',^(\w+)[/](.+)$,', $arg, $r)) { |
|
| 32 | + spip_log("action_auth_dist $arg pas compris"); |
|
| 33 | + } else { |
|
| 34 | + $auth_methode = $r[1]; |
|
| 35 | + $login = $r[2]; |
|
| 36 | + include_spip('inc/auth'); |
|
| 37 | + $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 38 | + |
|
| 39 | + if (is_string($res)) { // Erreur |
|
| 40 | + $redirect = _request('redirect'); |
|
| 41 | + $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 42 | + include_spip('inc/headers'); |
|
| 43 | + redirige_par_entete($redirect); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 47 | + auth_loger($res); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -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,43 +31,43 @@ discard block |
||
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | 33 | function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur = '') { |
| 34 | - if ($changer_lang) { |
|
| 35 | - $table_objet_sql = table_objet_sql($objet); |
|
| 36 | - $id_table_objet = id_table_objet($objet); |
|
| 37 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 38 | - $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 34 | + if ($changer_lang) { |
|
| 35 | + $table_objet_sql = table_objet_sql($objet); |
|
| 36 | + $id_table_objet = id_table_objet($objet); |
|
| 37 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 38 | + $desc = $trouver_table($table_objet_sql, $serveur); |
|
| 39 | 39 | |
| 40 | - $set = []; |
|
| 41 | - if (isset($desc['field']['langue_choisie'])) { |
|
| 42 | - $set['langue_choisie'] = 'oui'; |
|
| 43 | - } |
|
| 40 | + $set = []; |
|
| 41 | + if (isset($desc['field']['langue_choisie'])) { |
|
| 42 | + $set['langue_choisie'] = 'oui'; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if ($changer_lang != 'herit') { |
|
| 46 | - $set['lang'] = $changer_lang; |
|
| 47 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id), '', $serveur); |
|
| 48 | - include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 49 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 50 | - calculer_langues_rubriques(); |
|
| 51 | - } |
|
| 52 | - $langues = calculer_langues_utilisees($serveur); |
|
| 53 | - ecrire_meta('langues_utilisees', $langues); |
|
| 54 | - } else { |
|
| 55 | - $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 56 | - if (!$langue_parent) { |
|
| 57 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 58 | - } |
|
| 59 | - $changer_lang = $langue_parent; |
|
| 60 | - $set['lang'] = $changer_lang; |
|
| 61 | - if (isset($set['langue_choisie'])) { |
|
| 62 | - $set['langue_choisie'] = 'non'; |
|
| 63 | - } |
|
| 64 | - sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id), '', $serveur); |
|
| 65 | - if ($table_objet_sql == 'spip_rubriques') { |
|
| 66 | - include_spip('inc/rubriques'); |
|
| 67 | - calculer_langues_rubriques(); |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - } |
|
| 45 | + if ($changer_lang != 'herit') { |
|
| 46 | + $set['lang'] = $changer_lang; |
|
| 47 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id), '', $serveur); |
|
| 48 | + include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees |
|
| 49 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 50 | + calculer_langues_rubriques(); |
|
| 51 | + } |
|
| 52 | + $langues = calculer_langues_utilisees($serveur); |
|
| 53 | + ecrire_meta('langues_utilisees', $langues); |
|
| 54 | + } else { |
|
| 55 | + $langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 56 | + if (!$langue_parent) { |
|
| 57 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 58 | + } |
|
| 59 | + $changer_lang = $langue_parent; |
|
| 60 | + $set['lang'] = $changer_lang; |
|
| 61 | + if (isset($set['langue_choisie'])) { |
|
| 62 | + $set['langue_choisie'] = 'non'; |
|
| 63 | + } |
|
| 64 | + sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id), '', $serveur); |
|
| 65 | + if ($table_objet_sql == 'spip_rubriques') { |
|
| 66 | + include_spip('inc/rubriques'); |
|
| 67 | + calculer_langues_rubriques(); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return $changer_lang; |
|
| 72 | + return $changer_lang; |
|
| 73 | 73 | } |
@@ -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/charsets'); # pour le nom de fichier |
@@ -30,45 +30,45 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function action_supprimer_rubrique_dist($id_rubrique = null) { |
| 32 | 32 | |
| 33 | - if (is_null($id_rubrique)) { |
|
| 34 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | - $id_rubrique = $securiser_action(); |
|
| 36 | - } |
|
| 33 | + if (is_null($id_rubrique)) { |
|
| 34 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | + $id_rubrique = $securiser_action(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if (intval($id_rubrique)) { |
|
| 39 | - sql_delete('spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 40 | - // Les admin restreints qui n'administraient que cette rubrique |
|
| 41 | - // deviennent redacteurs |
|
| 42 | - // (il y a sans doute moyen de faire ca avec un having) |
|
| 38 | + if (intval($id_rubrique)) { |
|
| 39 | + sql_delete('spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 40 | + // Les admin restreints qui n'administraient que cette rubrique |
|
| 41 | + // deviennent redacteurs |
|
| 42 | + // (il y a sans doute moyen de faire ca avec un having) |
|
| 43 | 43 | |
| 44 | - $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . intval($id_rubrique)); |
|
| 45 | - while ($r = sql_fetch($q)) { |
|
| 46 | - $id_auteur = $r['id_auteur']; |
|
| 47 | - // degrader avant de supprimer la restriction d'admin |
|
| 48 | - // section critique sur les droits |
|
| 49 | - $n = sql_countsel( |
|
| 50 | - 'spip_auteurs_liens', |
|
| 51 | - "objet='rubrique' AND id_objet!=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 52 | - ); |
|
| 53 | - if (!$n) { |
|
| 54 | - include_spip('action/editer_auteur'); |
|
| 55 | - auteur_modifier($id_auteur, ['statut' => '1comite']); |
|
| 56 | - } |
|
| 57 | - sql_delete( |
|
| 58 | - 'spip_auteurs_liens', |
|
| 59 | - "objet='rubrique' AND id_objet=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 60 | - ); |
|
| 61 | - } |
|
| 62 | - // menu_rubriques devra recalculer |
|
| 63 | - effacer_meta('date_calcul_rubriques'); |
|
| 44 | + $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . intval($id_rubrique)); |
|
| 45 | + while ($r = sql_fetch($q)) { |
|
| 46 | + $id_auteur = $r['id_auteur']; |
|
| 47 | + // degrader avant de supprimer la restriction d'admin |
|
| 48 | + // section critique sur les droits |
|
| 49 | + $n = sql_countsel( |
|
| 50 | + 'spip_auteurs_liens', |
|
| 51 | + "objet='rubrique' AND id_objet!=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 52 | + ); |
|
| 53 | + if (!$n) { |
|
| 54 | + include_spip('action/editer_auteur'); |
|
| 55 | + auteur_modifier($id_auteur, ['statut' => '1comite']); |
|
| 56 | + } |
|
| 57 | + sql_delete( |
|
| 58 | + 'spip_auteurs_liens', |
|
| 59 | + "objet='rubrique' AND id_objet=" . intval($id_rubrique) . ' AND id_auteur=' . intval($id_auteur) |
|
| 60 | + ); |
|
| 61 | + } |
|
| 62 | + // menu_rubriques devra recalculer |
|
| 63 | + effacer_meta('date_calcul_rubriques'); |
|
| 64 | 64 | |
| 65 | - // Une rubrique supprimable n'avait pas le statut "publie" |
|
| 66 | - // donc rien de neuf pour la rubrique parente |
|
| 67 | - include_spip('inc/rubriques'); |
|
| 68 | - calculer_langues_rubriques(); |
|
| 65 | + // Une rubrique supprimable n'avait pas le statut "publie" |
|
| 66 | + // donc rien de neuf pour la rubrique parente |
|
| 67 | + include_spip('inc/rubriques'); |
|
| 68 | + calculer_langues_rubriques(); |
|
| 69 | 69 | |
| 70 | - // invalider les caches marques de cette rubrique |
|
| 71 | - include_spip('inc/invalideur'); |
|
| 72 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 73 | - } |
|
| 70 | + // invalider les caches marques de cette rubrique |
|
| 71 | + include_spip('inc/invalideur'); |
|
| 72 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -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 | /** |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | 28 | function action_relancer_inscription_dist() { |
| 29 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | - $id_auteur = $securiser_action(); |
|
| 29 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 30 | + $id_auteur = $securiser_action(); |
|
| 31 | 31 | |
| 32 | - if (intval($id_auteur) and autoriser('relancer', 'inscription')) { |
|
| 33 | - $auteur = sql_fetsel('prefs, email, nom, statut', 'spip_auteurs', "id_auteur=$id_auteur"); |
|
| 34 | - if ($auteur['statut'] == 'nouveau') { |
|
| 35 | - include_spip('action/inscrire_auteur'); |
|
| 36 | - action_inscrire_auteur_dist($auteur['prefs'], $auteur['email'], $auteur['nom'], ['force_nouveau' => true]); |
|
| 37 | - } |
|
| 38 | - } elseif ($id_auteur === '*' and autoriser('relancer', 'inscription')) { |
|
| 39 | - $auteurs = sql_allfetsel('prefs, email, nom', 'spip_auteurs', "statut='nouveau'"); |
|
| 40 | - if (is_array($auteurs)) { |
|
| 41 | - include_spip('action/inscrire_auteur'); |
|
| 42 | - while ($row = array_pop($auteurs)) { |
|
| 43 | - action_inscrire_auteur_dist($row['prefs'], $row['email'], $row['nom'], ['force_nouveau' => true]); |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - } |
|
| 32 | + if (intval($id_auteur) and autoriser('relancer', 'inscription')) { |
|
| 33 | + $auteur = sql_fetsel('prefs, email, nom, statut', 'spip_auteurs', "id_auteur=$id_auteur"); |
|
| 34 | + if ($auteur['statut'] == 'nouveau') { |
|
| 35 | + include_spip('action/inscrire_auteur'); |
|
| 36 | + action_inscrire_auteur_dist($auteur['prefs'], $auteur['email'], $auteur['nom'], ['force_nouveau' => true]); |
|
| 37 | + } |
|
| 38 | + } elseif ($id_auteur === '*' and autoriser('relancer', 'inscription')) { |
|
| 39 | + $auteurs = sql_allfetsel('prefs, email, nom', 'spip_auteurs', "statut='nouveau'"); |
|
| 40 | + if (is_array($auteurs)) { |
|
| 41 | + include_spip('action/inscrire_auteur'); |
|
| 42 | + while ($row = array_pop($auteurs)) { |
|
| 43 | + action_inscrire_auteur_dist($row['prefs'], $row['email'], $row['nom'], ['force_nouveau' => true]); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/charsets'); |
| 17 | 17 | |
@@ -28,91 +28,91 @@ discard block |
||
| 28 | 28 | * @return string |
| 29 | 29 | */ |
| 30 | 30 | function plugins_afficher_liste_dist( |
| 31 | - $url_page, |
|
| 32 | - $liste_plugins, |
|
| 33 | - $liste_plugins_checked, |
|
| 34 | - $liste_plugins_actifs, |
|
| 35 | - $dir_plugins = _DIR_PLUGINS, |
|
| 36 | - $afficher_un = 'afficher_plugin' |
|
| 31 | + $url_page, |
|
| 32 | + $liste_plugins, |
|
| 33 | + $liste_plugins_checked, |
|
| 34 | + $liste_plugins_actifs, |
|
| 35 | + $dir_plugins = _DIR_PLUGINS, |
|
| 36 | + $afficher_un = 'afficher_plugin' |
|
| 37 | 37 | ) { |
| 38 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 39 | - $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 38 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 39 | + $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 40 | 40 | |
| 41 | - $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 41 | + $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 42 | 42 | |
| 43 | - $all_infos = pipeline( |
|
| 44 | - 'filtrer_liste_plugins', |
|
| 45 | - [ |
|
| 46 | - 'args' => [ |
|
| 47 | - 'liste_plugins' => $liste_plugins, |
|
| 48 | - 'liste_plugins_checked' => $liste_plugins_checked, |
|
| 49 | - 'liste_plugins_actifs' => $liste_plugins_actifs, |
|
| 50 | - 'dir_plugins' => $dir_plugins |
|
| 51 | - ], |
|
| 52 | - 'data' => $all_infos |
|
| 53 | - ] |
|
| 54 | - ); |
|
| 43 | + $all_infos = pipeline( |
|
| 44 | + 'filtrer_liste_plugins', |
|
| 45 | + [ |
|
| 46 | + 'args' => [ |
|
| 47 | + 'liste_plugins' => $liste_plugins, |
|
| 48 | + 'liste_plugins_checked' => $liste_plugins_checked, |
|
| 49 | + 'liste_plugins_actifs' => $liste_plugins_actifs, |
|
| 50 | + 'dir_plugins' => $dir_plugins |
|
| 51 | + ], |
|
| 52 | + 'data' => $all_infos |
|
| 53 | + ] |
|
| 54 | + ); |
|
| 55 | 55 | |
| 56 | - $liste_plugins = array_flip($liste_plugins); |
|
| 57 | - foreach ($liste_plugins as $chemin => $v) { |
|
| 58 | - // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 59 | - if (isset($all_infos[$chemin])) { |
|
| 60 | - $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 61 | - } else { |
|
| 62 | - unset($liste_plugins[$chemin]); |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - asort($liste_plugins); |
|
| 66 | - $exposed = urldecode(_request('plugin')); |
|
| 56 | + $liste_plugins = array_flip($liste_plugins); |
|
| 57 | + foreach ($liste_plugins as $chemin => $v) { |
|
| 58 | + // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 59 | + if (isset($all_infos[$chemin])) { |
|
| 60 | + $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 61 | + } else { |
|
| 62 | + unset($liste_plugins[$chemin]); |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + asort($liste_plugins); |
|
| 66 | + $exposed = urldecode(_request('plugin')); |
|
| 67 | 67 | |
| 68 | - $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 69 | - $fast_liste_plugins_actifs = []; |
|
| 70 | - $fast_liste_plugins_checked = []; |
|
| 71 | - if (is_array($liste_plugins_actifs)) { |
|
| 72 | - $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 73 | - } |
|
| 74 | - if (is_array($liste_plugins_checked)) { |
|
| 75 | - $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 76 | - } |
|
| 68 | + $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 69 | + $fast_liste_plugins_actifs = []; |
|
| 70 | + $fast_liste_plugins_checked = []; |
|
| 71 | + if (is_array($liste_plugins_actifs)) { |
|
| 72 | + $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 73 | + } |
|
| 74 | + if (is_array($liste_plugins_checked)) { |
|
| 75 | + $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - $res = ''; |
|
| 79 | - $block = ''; |
|
| 80 | - $initiale = ''; |
|
| 81 | - $block_actif = false; |
|
| 82 | - foreach ($liste_plugins as $plug => $nom) { |
|
| 83 | - if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 84 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 85 | - $initiale = $i; |
|
| 86 | - $block = ''; |
|
| 87 | - $block_actif = false; |
|
| 88 | - } |
|
| 89 | - // le rep suivant |
|
| 90 | - $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 91 | - $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 92 | - $block_actif = $block_actif | $actif; |
|
| 93 | - $expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr( |
|
| 94 | - $dir_plugins, |
|
| 95 | - strlen(_DIR_RACINE) |
|
| 96 | - ) . $plug)); |
|
| 97 | - $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, 'item', $dir_plugins) . "\n"; |
|
| 98 | - } |
|
| 99 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 100 | - $class = basename($dir_plugins); |
|
| 78 | + $res = ''; |
|
| 79 | + $block = ''; |
|
| 80 | + $initiale = ''; |
|
| 81 | + $block_actif = false; |
|
| 82 | + foreach ($liste_plugins as $plug => $nom) { |
|
| 83 | + if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 84 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 85 | + $initiale = $i; |
|
| 86 | + $block = ''; |
|
| 87 | + $block_actif = false; |
|
| 88 | + } |
|
| 89 | + // le rep suivant |
|
| 90 | + $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 91 | + $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 92 | + $block_actif = $block_actif | $actif; |
|
| 93 | + $expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr( |
|
| 94 | + $dir_plugins, |
|
| 95 | + strlen(_DIR_RACINE) |
|
| 96 | + ) . $plug)); |
|
| 97 | + $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, 'item', $dir_plugins) . "\n"; |
|
| 98 | + } |
|
| 99 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 100 | + $class = basename($dir_plugins); |
|
| 101 | 101 | |
| 102 | - return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ''; |
|
| 102 | + return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ''; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | // https://code.spip.net/@affiche_block_initiale |
| 107 | 107 | function affiche_block_initiale($initiale, $block, $block_actif) { |
| 108 | - if (strlen($block)) { |
|
| 109 | - return "<li class='item'>" |
|
| 110 | - . bouton_block_depliable($initiale, $block_actif ? true : false) |
|
| 111 | - . debut_block_depliable($block_actif) |
|
| 112 | - . "<ul>$block</ul>" |
|
| 113 | - . fin_block() |
|
| 114 | - . '</li>'; |
|
| 115 | - } |
|
| 108 | + if (strlen($block)) { |
|
| 109 | + return "<li class='item'>" |
|
| 110 | + . bouton_block_depliable($initiale, $block_actif ? true : false) |
|
| 111 | + . debut_block_depliable($block_actif) |
|
| 112 | + . "<ul>$block</ul>" |
|
| 113 | + . fin_block() |
|
| 114 | + . '</li>'; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - return ''; |
|
| 117 | + return ''; |
|
| 118 | 118 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/charsets'); |
| 17 | 17 | include_spip('inc/texte'); |
@@ -19,54 +19,54 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // https://code.spip.net/@ligne_plug |
| 21 | 21 | function plugins_afficher_nom_plugin_dist( |
| 22 | - $url_page, |
|
| 23 | - $plug_file, |
|
| 24 | - $checked, |
|
| 25 | - $actif, |
|
| 26 | - $expose = false, |
|
| 27 | - $class_li = 'item', |
|
| 28 | - $dir_plugins = _DIR_PLUGINS |
|
| 22 | + $url_page, |
|
| 23 | + $plug_file, |
|
| 24 | + $checked, |
|
| 25 | + $actif, |
|
| 26 | + $expose = false, |
|
| 27 | + $class_li = 'item', |
|
| 28 | + $dir_plugins = _DIR_PLUGINS |
|
| 29 | 29 | ) { |
| 30 | - static $id_input = 0; |
|
| 31 | - static $versions = []; |
|
| 30 | + static $id_input = 0; |
|
| 31 | + static $versions = []; |
|
| 32 | 32 | |
| 33 | - $erreur = false; |
|
| 34 | - $s = ''; |
|
| 33 | + $erreur = false; |
|
| 34 | + $s = ''; |
|
| 35 | 35 | |
| 36 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | - $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 36 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | + $info = $get_infos($plug_file, false, $dir_plugins); |
|
| 38 | 38 | |
| 39 | - // numerotons les occurences d'un meme prefix |
|
| 40 | - $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 41 | - $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 39 | + // numerotons les occurences d'un meme prefix |
|
| 40 | + $versions[$info['prefix']] = isset($versions[$info['prefix']]) ? $versions[$info['prefix']] + 1 : ''; |
|
| 41 | + $id = $info['prefix'] . $versions[$info['prefix']]; |
|
| 42 | 42 | |
| 43 | - $class = $class_li; |
|
| 44 | - $class .= $actif ? ' actif' : ''; |
|
| 45 | - $class .= $expose ? ' on' : ''; |
|
| 46 | - $erreur = isset($info['erreur']); |
|
| 47 | - if ($erreur) { |
|
| 48 | - $class .= ' error'; |
|
| 49 | - } |
|
| 50 | - $s .= "<li id='$id' class='$class'>"; |
|
| 43 | + $class = $class_li; |
|
| 44 | + $class .= $actif ? ' actif' : ''; |
|
| 45 | + $class .= $expose ? ' on' : ''; |
|
| 46 | + $erreur = isset($info['erreur']); |
|
| 47 | + if ($erreur) { |
|
| 48 | + $class .= ' error'; |
|
| 49 | + } |
|
| 50 | + $s .= "<li id='$id' class='$class'>"; |
|
| 51 | 51 | |
| 52 | - // Cartouche Resume |
|
| 53 | - $s .= "<div class='resume'>"; |
|
| 52 | + // Cartouche Resume |
|
| 53 | + $s .= "<div class='resume'>"; |
|
| 54 | 54 | |
| 55 | - $prefix = $info['prefix']; |
|
| 56 | - $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 57 | - $desc = plugin_propre($info['description'], $dir); |
|
| 58 | - $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 55 | + $prefix = $info['prefix']; |
|
| 56 | + $dir = "$dir_plugins$plug_file/lang/$prefix"; |
|
| 57 | + $desc = plugin_propre($info['description'], $dir); |
|
| 58 | + $url_stat = parametre_url($url_page, 'plugin', $dir_plugins . $plug_file); |
|
| 59 | 59 | |
| 60 | - $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 61 | - $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 62 | - $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 63 | - $s .= '</div>'; |
|
| 60 | + $s .= "<strong class='nom'>" . typo($info['nom']) . '</strong>'; |
|
| 61 | + $s .= " <span class='version'>" . $info['version'] . '</span>'; |
|
| 62 | + $s .= " <span class='etat'> - " . plugin_etat_en_clair($info['etat']) . '</span>'; |
|
| 63 | + $s .= '</div>'; |
|
| 64 | 64 | |
| 65 | - if ($erreur) { |
|
| 66 | - $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 67 | - } |
|
| 65 | + if ($erreur) { |
|
| 66 | + $s .= "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>'; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $s .= '</li>'; |
|
| 69 | + $s .= '</li>'; |
|
| 70 | 70 | |
| 71 | - return $s; |
|
| 71 | + return $s; |
|
| 72 | 72 | } |