@@ -4,123 +4,123 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Home', |
|
| 14 | - 'article' => 'Articolo', |
|
| 15 | - 'articles' => 'Articoli', |
|
| 16 | - 'articles_auteur' => 'Articoli di questo autore', |
|
| 17 | - 'articles_populaires' => 'Articoli più letti', |
|
| 18 | - 'articles_rubrique' => 'Articoli di questa rubrica', |
|
| 19 | - 'aucun_article' => 'Non ci sono articoli a questo indirizzo', |
|
| 20 | - 'aucun_auteur' => 'Non ci sono autori a questo indirizzo', |
|
| 21 | - 'aucun_site' => 'Non ci sono siti a questo indirizzo', |
|
| 22 | - 'aucune_breve' => 'Non ci sono brevi a questo indirizzo', |
|
| 23 | - 'aucune_rubrique' => 'Non ci sono rubriche a questo indirizzo', |
|
| 24 | - 'auteur' => 'Autore', |
|
| 25 | - 'autres' => 'Altri', |
|
| 26 | - 'autres_breves' => 'Altre brevi', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Altri gruppi di parole chiave', |
|
| 28 | - 'autres_sites' => 'Altri siti', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Salve', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Commenta questo sito', |
|
| 35 | - 'contact' => 'Contatti', |
|
| 36 | - 'copie_document_impossible' => 'Impossibile copiare il documento', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Data', |
|
| 40 | - 'dernier_ajout' => 'Ultimo aggiornamento', |
|
| 41 | - 'dernieres_breves' => 'Ultime brevi', |
|
| 42 | - 'derniers_articles' => 'Ultimi articoli', |
|
| 43 | - 'derniers_commentaires' => 'Ultimi commenti', |
|
| 44 | - 'derniers_messages_forum' => 'Ultimi messaggi pubblicati nei forum', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Versione solo testo di', |
|
| 48 | - 'en_reponse' => 'In risposta a:', |
|
| 49 | - 'en_resume' => 'Riassunto', |
|
| 50 | - 'envoyer_message' => 'Invia un messaggio', |
|
| 51 | - 'espace_prive' => 'Area riservata', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Formati accettati: @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Mappa del sito', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'giorni', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Connettersi', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'Dello stesso autore', |
|
| 67 | - 'meme_rubrique' => 'Nella stessa rubrica', |
|
| 68 | - 'memes_auteurs' => 'Degli stessi autori', |
|
| 69 | - 'message' => 'Messaggio', |
|
| 70 | - 'messages_forum' => 'Messaggi', |
|
| 71 | - 'messages_recents' => 'Messaggi più recenti del forum', |
|
| 72 | - 'mots_clef' => 'Parola chiave', |
|
| 73 | - 'mots_clefs' => 'Parole chiave', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Parole chiave nello stesso gruppo', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navigazione', |
|
| 78 | - 'nom' => 'Cognome', |
|
| 79 | - 'nouveautes' => 'Le novità', |
|
| 80 | - 'nouveautes_web' => 'Novità sul Web', |
|
| 81 | - 'nouveaux_articles' => 'Nuovi articoli', |
|
| 82 | - 'nouvelles_breves' => 'Nuove brevi', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'pagina precedente', |
|
| 86 | - 'page_suivante' => 'pagina successiva', |
|
| 87 | - 'par_auteur' => 'di ', |
|
| 88 | - 'participer_site' => 'È possibile partecipare alla vita di questo sito e proporre degli articoli iscrivendosi qui sotto. Verrà spedito immediatamente un email con il codice di accesso all’area riservata del sito.', |
|
| 89 | - 'plan_site' => 'Mappa del sito', |
|
| 90 | - 'popularite' => 'Popolarità', |
|
| 91 | - 'poster_message' => 'Inviare un messaggio', |
|
| 92 | - 'proposer_site' => 'È possibile proporre un sito da aggiungere a questa rubrica:', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'Rispondere all’articolo', |
|
| 96 | - 'repondre_breve' => 'Rispondere a questa breve', |
|
| 97 | - 'resultats_recherche' => 'Risultati della ricerca', |
|
| 98 | - 'retour_debut_forums' => 'Tornare all’inizio dei forum', |
|
| 99 | - 'rss_abonnement' => 'Copia il seguente URL nel tuo aggregatore RSS:', |
|
| 100 | - 'rss_abonnement_titre' => 'Sottoscrivi', |
|
| 101 | - 'rss_abonnement_titre_page' => 'Per sottoscrivere', |
|
| 102 | - 'rss_explication' => 'Un feed RSS raccoglie informazioni di aggiornamento per un sito. Fornisce il contenuto dei post o dei commenti o un estratto da essi, nonché un collegamento alle versioni complete e alcune altre informazioni. Questo feed deve essere letto da un aggregatore RSS.', |
|
| 103 | - 'rss_explication_titre' => 'Cos’è un flusso RSS?', |
|
| 104 | - 'rubrique' => 'Rubrica', |
|
| 105 | - 'rubriques' => 'Rubriche', |
|
| 106 | - |
|
| 107 | - // S |
|
| 108 | - 'signatures_petition' => 'Firme', |
|
| 109 | - 'site_realise_avec_spip' => 'Sito realizzato con SPIP', |
|
| 110 | - 'sites_web' => 'Siti Web', |
|
| 111 | - 'sous_rubriques' => 'Sottorubriche', |
|
| 112 | - 'spam' => 'Spam', |
|
| 113 | - 'suite' => 'segue', |
|
| 114 | - 'sur_web' => 'Sul Web', |
|
| 115 | - 'syndiquer_rubrique' => 'Mettere in syndication questa rubrica', |
|
| 116 | - 'syndiquer_site' => 'Mettere in syndication tutto il sito', |
|
| 117 | - |
|
| 118 | - // T |
|
| 119 | - 'texte_lettre_information' => 'Newsletter del sito', |
|
| 120 | - 'texte_lettre_information_2' => 'Questo sito contiene articoli pubblicati a partire dal ', |
|
| 121 | - |
|
| 122 | - // V |
|
| 123 | - 'ver_imprimer' => 'Versione per la stampa', |
|
| 124 | - 'voir_en_ligne' => 'Vedi on line', |
|
| 125 | - 'voir_squelette' => 'visualizza il modello di questa pagina' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Home', |
|
| 14 | + 'article' => 'Articolo', |
|
| 15 | + 'articles' => 'Articoli', |
|
| 16 | + 'articles_auteur' => 'Articoli di questo autore', |
|
| 17 | + 'articles_populaires' => 'Articoli più letti', |
|
| 18 | + 'articles_rubrique' => 'Articoli di questa rubrica', |
|
| 19 | + 'aucun_article' => 'Non ci sono articoli a questo indirizzo', |
|
| 20 | + 'aucun_auteur' => 'Non ci sono autori a questo indirizzo', |
|
| 21 | + 'aucun_site' => 'Non ci sono siti a questo indirizzo', |
|
| 22 | + 'aucune_breve' => 'Non ci sono brevi a questo indirizzo', |
|
| 23 | + 'aucune_rubrique' => 'Non ci sono rubriche a questo indirizzo', |
|
| 24 | + 'auteur' => 'Autore', |
|
| 25 | + 'autres' => 'Altri', |
|
| 26 | + 'autres_breves' => 'Altre brevi', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Altri gruppi di parole chiave', |
|
| 28 | + 'autres_sites' => 'Altri siti', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Salve', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Commenta questo sito', |
|
| 35 | + 'contact' => 'Contatti', |
|
| 36 | + 'copie_document_impossible' => 'Impossibile copiare il documento', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Data', |
|
| 40 | + 'dernier_ajout' => 'Ultimo aggiornamento', |
|
| 41 | + 'dernieres_breves' => 'Ultime brevi', |
|
| 42 | + 'derniers_articles' => 'Ultimi articoli', |
|
| 43 | + 'derniers_commentaires' => 'Ultimi commenti', |
|
| 44 | + 'derniers_messages_forum' => 'Ultimi messaggi pubblicati nei forum', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Versione solo testo di', |
|
| 48 | + 'en_reponse' => 'In risposta a:', |
|
| 49 | + 'en_resume' => 'Riassunto', |
|
| 50 | + 'envoyer_message' => 'Invia un messaggio', |
|
| 51 | + 'espace_prive' => 'Area riservata', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Formati accettati: @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Mappa del sito', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'giorni', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Connettersi', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'Dello stesso autore', |
|
| 67 | + 'meme_rubrique' => 'Nella stessa rubrica', |
|
| 68 | + 'memes_auteurs' => 'Degli stessi autori', |
|
| 69 | + 'message' => 'Messaggio', |
|
| 70 | + 'messages_forum' => 'Messaggi', |
|
| 71 | + 'messages_recents' => 'Messaggi più recenti del forum', |
|
| 72 | + 'mots_clef' => 'Parola chiave', |
|
| 73 | + 'mots_clefs' => 'Parole chiave', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Parole chiave nello stesso gruppo', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navigazione', |
|
| 78 | + 'nom' => 'Cognome', |
|
| 79 | + 'nouveautes' => 'Le novità', |
|
| 80 | + 'nouveautes_web' => 'Novità sul Web', |
|
| 81 | + 'nouveaux_articles' => 'Nuovi articoli', |
|
| 82 | + 'nouvelles_breves' => 'Nuove brevi', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'pagina precedente', |
|
| 86 | + 'page_suivante' => 'pagina successiva', |
|
| 87 | + 'par_auteur' => 'di ', |
|
| 88 | + 'participer_site' => 'È possibile partecipare alla vita di questo sito e proporre degli articoli iscrivendosi qui sotto. Verrà spedito immediatamente un email con il codice di accesso all’area riservata del sito.', |
|
| 89 | + 'plan_site' => 'Mappa del sito', |
|
| 90 | + 'popularite' => 'Popolarità', |
|
| 91 | + 'poster_message' => 'Inviare un messaggio', |
|
| 92 | + 'proposer_site' => 'È possibile proporre un sito da aggiungere a questa rubrica:', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'Rispondere all’articolo', |
|
| 96 | + 'repondre_breve' => 'Rispondere a questa breve', |
|
| 97 | + 'resultats_recherche' => 'Risultati della ricerca', |
|
| 98 | + 'retour_debut_forums' => 'Tornare all’inizio dei forum', |
|
| 99 | + 'rss_abonnement' => 'Copia il seguente URL nel tuo aggregatore RSS:', |
|
| 100 | + 'rss_abonnement_titre' => 'Sottoscrivi', |
|
| 101 | + 'rss_abonnement_titre_page' => 'Per sottoscrivere', |
|
| 102 | + 'rss_explication' => 'Un feed RSS raccoglie informazioni di aggiornamento per un sito. Fornisce il contenuto dei post o dei commenti o un estratto da essi, nonché un collegamento alle versioni complete e alcune altre informazioni. Questo feed deve essere letto da un aggregatore RSS.', |
|
| 103 | + 'rss_explication_titre' => 'Cos’è un flusso RSS?', |
|
| 104 | + 'rubrique' => 'Rubrica', |
|
| 105 | + 'rubriques' => 'Rubriche', |
|
| 106 | + |
|
| 107 | + // S |
|
| 108 | + 'signatures_petition' => 'Firme', |
|
| 109 | + 'site_realise_avec_spip' => 'Sito realizzato con SPIP', |
|
| 110 | + 'sites_web' => 'Siti Web', |
|
| 111 | + 'sous_rubriques' => 'Sottorubriche', |
|
| 112 | + 'spam' => 'Spam', |
|
| 113 | + 'suite' => 'segue', |
|
| 114 | + 'sur_web' => 'Sul Web', |
|
| 115 | + 'syndiquer_rubrique' => 'Mettere in syndication questa rubrica', |
|
| 116 | + 'syndiquer_site' => 'Mettere in syndication tutto il sito', |
|
| 117 | + |
|
| 118 | + // T |
|
| 119 | + 'texte_lettre_information' => 'Newsletter del sito', |
|
| 120 | + 'texte_lettre_information_2' => 'Questo sito contiene articoli pubblicati a partire dal ', |
|
| 121 | + |
|
| 122 | + // V |
|
| 123 | + 'ver_imprimer' => 'Versione per la stampa', |
|
| 124 | + 'voir_en_ligne' => 'Vedi on line', |
|
| 125 | + 'voir_squelette' => 'visualizza il modello di questa pagina' |
|
| 126 | 126 | ); |
@@ -4,123 +4,123 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Accueil', |
|
| 14 | - 'article' => 'Article', |
|
| 15 | - 'articles' => 'Articles', |
|
| 16 | - 'articles_auteur' => 'Articles de cette autrice', |
|
| 17 | - 'articles_populaires' => 'Articles les plus populaires', |
|
| 18 | - 'articles_rubrique' => 'Articles de cette rubrique', |
|
| 19 | - 'aucun_article' => 'Il n’y a pas d’article à cette adresse', |
|
| 20 | - 'aucun_auteur' => 'Il n’y a pas d’autrice à cette adresse', |
|
| 21 | - 'aucun_site' => 'Il n’y a pas de site à cette adresse', |
|
| 22 | - 'aucune_breve' => 'Il n’y a pas de brève à cette adresse', |
|
| 23 | - 'aucune_rubrique' => 'Il n’y a pas de rubrique à cette adresse', |
|
| 24 | - 'auteur' => 'Autrice', |
|
| 25 | - 'autres' => 'Autres', |
|
| 26 | - 'autres_breves' => 'Autres brèves', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Autres groupes de mots-clés', |
|
| 28 | - 'autres_sites' => 'Autres sites', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Bonjour', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Commenter ce site', |
|
| 35 | - 'contact' => 'Contact', |
|
| 36 | - 'copie_document_impossible' => 'Impossible de copier le document', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Date', |
|
| 40 | - 'dernier_ajout' => 'Dernier ajout', |
|
| 41 | - 'dernieres_breves' => 'Dernières brèves', |
|
| 42 | - 'derniers_articles' => 'Derniers articles', |
|
| 43 | - 'derniers_commentaires' => 'Derniers commentaires', |
|
| 44 | - 'derniers_messages_forum' => 'Derniers messages publiés dans les forums', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Édition en mode texte de', |
|
| 48 | - 'en_reponse' => 'En réponse à :', |
|
| 49 | - 'en_resume' => 'En résumé', |
|
| 50 | - 'envoyer_message' => 'Envoyer un message', |
|
| 51 | - 'espace_prive' => 'Espace privé', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Formats acceptés : @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Hiérarchie du site', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'jours', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Se connecter', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'De la même autrice', |
|
| 67 | - 'meme_rubrique' => 'Dans la même rubrique', |
|
| 68 | - 'memes_auteurs' => 'Des mêmes autrices', |
|
| 69 | - 'message' => 'Message', |
|
| 70 | - 'messages_forum' => 'Messages', |
|
| 71 | - 'messages_recents' => 'Messages de forums les plus récents', |
|
| 72 | - 'mots_clef' => 'Mot-clé', |
|
| 73 | - 'mots_clefs' => 'Mots-clés', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Mots-clés dans le même groupe', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navigation', |
|
| 78 | - 'nom' => 'Nom', |
|
| 79 | - 'nouveautes' => 'Les nouveautés', |
|
| 80 | - 'nouveautes_web' => 'Nouveautés sur le Web', |
|
| 81 | - 'nouveaux_articles' => 'Nouveaux articles', |
|
| 82 | - 'nouvelles_breves' => 'Nouvelles brèves', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'page précédente', |
|
| 86 | - 'page_suivante' => 'page suivante', |
|
| 87 | - 'par_auteur' => 'par ', |
|
| 88 | - 'participer_site' => 'Vous pouvez participer à la vie de ce site et proposer vos propres articles en vous inscrivant ci-dessous. Vous recevrez immédiatement un email vous indiquant vos codes d’accès à l’espace privé du site.', |
|
| 89 | - 'plan_site' => 'Plan du site', |
|
| 90 | - 'popularite' => 'Popularité', |
|
| 91 | - 'poster_message' => 'Poster un message', |
|
| 92 | - 'proposer_site' => 'Vous pouvez proposer un site à ajouter dans cette rubrique :', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'Répondre à cet article', |
|
| 96 | - 'repondre_breve' => 'Répondre à cette brève', |
|
| 97 | - 'resultats_recherche' => 'Résultats de la recherche', |
|
| 98 | - 'retour_debut_forums' => 'Retour au début des forums', |
|
| 99 | - 'rss_abonnement' => 'Copiez l’URL suivante dans votre agrégateur :', |
|
| 100 | - 'rss_abonnement_titre' => 'S’abonner', |
|
| 101 | - 'rss_abonnement_titre_page' => 'S’abonner à', |
|
| 102 | - 'rss_explication' => 'Un fil RSS recueille les informations de mise à jour d’un site. Il fournit le contenu des billets ou des commentaires ou un extrait de ceux-ci, ainsi qu’un lien vers les versions complètes et quelques autres informations. Ce fil a pour vocation d’être lu par un agrégateur RSS.', |
|
| 103 | - 'rss_explication_titre' => 'Qu’est-ce qu’un flux RSS ?', |
|
| 104 | - 'rubrique' => 'Rubrique', |
|
| 105 | - 'rubriques' => 'Rubriques', |
|
| 106 | - |
|
| 107 | - // S |
|
| 108 | - 'signatures_petition' => 'Signatures', |
|
| 109 | - 'site_realise_avec_spip' => 'Site réalisé avec SPIP', |
|
| 110 | - 'sites_web' => 'Sites Web', |
|
| 111 | - 'sous_rubriques' => 'Sous-rubriques', |
|
| 112 | - 'spam' => 'Spam', |
|
| 113 | - 'suite' => 'suite', |
|
| 114 | - 'sur_web' => 'Sur le Web', |
|
| 115 | - 'syndiquer_rubrique' => 'Syndiquer cette rubrique', |
|
| 116 | - 'syndiquer_site' => 'Syndiquer tout le site', |
|
| 117 | - |
|
| 118 | - // T |
|
| 119 | - 'texte_lettre_information' => 'Voici la lettre d’information du site', |
|
| 120 | - 'texte_lettre_information_2' => 'Cette lettre recense les nouveautés publiées depuis', |
|
| 121 | - |
|
| 122 | - // V |
|
| 123 | - 'ver_imprimer' => 'Version à imprimer', |
|
| 124 | - 'voir_en_ligne' => 'Voir en ligne', |
|
| 125 | - 'voir_squelette' => 'voir le squelette de cette page' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Accueil', |
|
| 14 | + 'article' => 'Article', |
|
| 15 | + 'articles' => 'Articles', |
|
| 16 | + 'articles_auteur' => 'Articles de cette autrice', |
|
| 17 | + 'articles_populaires' => 'Articles les plus populaires', |
|
| 18 | + 'articles_rubrique' => 'Articles de cette rubrique', |
|
| 19 | + 'aucun_article' => 'Il n’y a pas d’article à cette adresse', |
|
| 20 | + 'aucun_auteur' => 'Il n’y a pas d’autrice à cette adresse', |
|
| 21 | + 'aucun_site' => 'Il n’y a pas de site à cette adresse', |
|
| 22 | + 'aucune_breve' => 'Il n’y a pas de brève à cette adresse', |
|
| 23 | + 'aucune_rubrique' => 'Il n’y a pas de rubrique à cette adresse', |
|
| 24 | + 'auteur' => 'Autrice', |
|
| 25 | + 'autres' => 'Autres', |
|
| 26 | + 'autres_breves' => 'Autres brèves', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Autres groupes de mots-clés', |
|
| 28 | + 'autres_sites' => 'Autres sites', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Bonjour', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Commenter ce site', |
|
| 35 | + 'contact' => 'Contact', |
|
| 36 | + 'copie_document_impossible' => 'Impossible de copier le document', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Date', |
|
| 40 | + 'dernier_ajout' => 'Dernier ajout', |
|
| 41 | + 'dernieres_breves' => 'Dernières brèves', |
|
| 42 | + 'derniers_articles' => 'Derniers articles', |
|
| 43 | + 'derniers_commentaires' => 'Derniers commentaires', |
|
| 44 | + 'derniers_messages_forum' => 'Derniers messages publiés dans les forums', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Édition en mode texte de', |
|
| 48 | + 'en_reponse' => 'En réponse à :', |
|
| 49 | + 'en_resume' => 'En résumé', |
|
| 50 | + 'envoyer_message' => 'Envoyer un message', |
|
| 51 | + 'espace_prive' => 'Espace privé', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Formats acceptés : @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Hiérarchie du site', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'jours', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Se connecter', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'De la même autrice', |
|
| 67 | + 'meme_rubrique' => 'Dans la même rubrique', |
|
| 68 | + 'memes_auteurs' => 'Des mêmes autrices', |
|
| 69 | + 'message' => 'Message', |
|
| 70 | + 'messages_forum' => 'Messages', |
|
| 71 | + 'messages_recents' => 'Messages de forums les plus récents', |
|
| 72 | + 'mots_clef' => 'Mot-clé', |
|
| 73 | + 'mots_clefs' => 'Mots-clés', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Mots-clés dans le même groupe', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navigation', |
|
| 78 | + 'nom' => 'Nom', |
|
| 79 | + 'nouveautes' => 'Les nouveautés', |
|
| 80 | + 'nouveautes_web' => 'Nouveautés sur le Web', |
|
| 81 | + 'nouveaux_articles' => 'Nouveaux articles', |
|
| 82 | + 'nouvelles_breves' => 'Nouvelles brèves', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'page précédente', |
|
| 86 | + 'page_suivante' => 'page suivante', |
|
| 87 | + 'par_auteur' => 'par ', |
|
| 88 | + 'participer_site' => 'Vous pouvez participer à la vie de ce site et proposer vos propres articles en vous inscrivant ci-dessous. Vous recevrez immédiatement un email vous indiquant vos codes d’accès à l’espace privé du site.', |
|
| 89 | + 'plan_site' => 'Plan du site', |
|
| 90 | + 'popularite' => 'Popularité', |
|
| 91 | + 'poster_message' => 'Poster un message', |
|
| 92 | + 'proposer_site' => 'Vous pouvez proposer un site à ajouter dans cette rubrique :', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'Répondre à cet article', |
|
| 96 | + 'repondre_breve' => 'Répondre à cette brève', |
|
| 97 | + 'resultats_recherche' => 'Résultats de la recherche', |
|
| 98 | + 'retour_debut_forums' => 'Retour au début des forums', |
|
| 99 | + 'rss_abonnement' => 'Copiez l’URL suivante dans votre agrégateur :', |
|
| 100 | + 'rss_abonnement_titre' => 'S’abonner', |
|
| 101 | + 'rss_abonnement_titre_page' => 'S’abonner à', |
|
| 102 | + 'rss_explication' => 'Un fil RSS recueille les informations de mise à jour d’un site. Il fournit le contenu des billets ou des commentaires ou un extrait de ceux-ci, ainsi qu’un lien vers les versions complètes et quelques autres informations. Ce fil a pour vocation d’être lu par un agrégateur RSS.', |
|
| 103 | + 'rss_explication_titre' => 'Qu’est-ce qu’un flux RSS ?', |
|
| 104 | + 'rubrique' => 'Rubrique', |
|
| 105 | + 'rubriques' => 'Rubriques', |
|
| 106 | + |
|
| 107 | + // S |
|
| 108 | + 'signatures_petition' => 'Signatures', |
|
| 109 | + 'site_realise_avec_spip' => 'Site réalisé avec SPIP', |
|
| 110 | + 'sites_web' => 'Sites Web', |
|
| 111 | + 'sous_rubriques' => 'Sous-rubriques', |
|
| 112 | + 'spam' => 'Spam', |
|
| 113 | + 'suite' => 'suite', |
|
| 114 | + 'sur_web' => 'Sur le Web', |
|
| 115 | + 'syndiquer_rubrique' => 'Syndiquer cette rubrique', |
|
| 116 | + 'syndiquer_site' => 'Syndiquer tout le site', |
|
| 117 | + |
|
| 118 | + // T |
|
| 119 | + 'texte_lettre_information' => 'Voici la lettre d’information du site', |
|
| 120 | + 'texte_lettre_information_2' => 'Cette lettre recense les nouveautés publiées depuis', |
|
| 121 | + |
|
| 122 | + // V |
|
| 123 | + 'ver_imprimer' => 'Version à imprimer', |
|
| 124 | + 'voir_en_ligne' => 'Voir en ligne', |
|
| 125 | + 'voir_squelette' => 'voir le squelette de cette page' |
|
| 126 | 126 | ); |
@@ -4,123 +4,123 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Página inicial do sítio', |
|
| 14 | - 'article' => 'Artigo', |
|
| 15 | - 'articles' => 'Artigos', |
|
| 16 | - 'articles_auteur' => 'Artigos deste autor', |
|
| 17 | - 'articles_populaires' => 'Artigos mais populares', |
|
| 18 | - 'articles_rubrique' => 'Artigos desta rubrica', |
|
| 19 | - 'aucun_article' => 'Nenhum artigo neste endereço', |
|
| 20 | - 'aucun_auteur' => 'Nenhum autor neste endereço', |
|
| 21 | - 'aucun_site' => 'Nenhum sítio neste endereço', |
|
| 22 | - 'aucune_breve' => 'Nenhuma notícia neste endereço', |
|
| 23 | - 'aucune_rubrique' => 'Nenhuma rubrica neste endereço', |
|
| 24 | - 'auteur' => 'Autor', |
|
| 25 | - 'autres' => 'Outros', |
|
| 26 | - 'autres_breves' => 'Outras notícias', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Outros grupos de palavras-chave', |
|
| 28 | - 'autres_sites' => 'Outros sítios', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Bom dia', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Comentar este sítio', |
|
| 35 | - 'contact' => 'Contacto', |
|
| 36 | - 'copie_document_impossible' => 'Impossível copiar este documento', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Data', |
|
| 40 | - 'dernier_ajout' => 'Última actualização', |
|
| 41 | - 'dernieres_breves' => 'Últimas notícias', |
|
| 42 | - 'derniers_articles' => 'Últimos artigos', |
|
| 43 | - 'derniers_commentaires' => 'Últimos comentários', |
|
| 44 | - 'derniers_messages_forum' => 'Últimas mensagens publicadas nos fóruns', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Edição apenas em modo de texto', |
|
| 48 | - 'en_reponse' => 'Em resposta a :', |
|
| 49 | - 'en_resume' => 'Em resumo', |
|
| 50 | - 'envoyer_message' => 'Enviar uma mensagem', |
|
| 51 | - 'espace_prive' => 'Área privada', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Formatos válidos : @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Mapa do sítio', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'dias', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Entrar', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'Do mesmo autor', |
|
| 67 | - 'meme_rubrique' => 'Na mesma rubrica', |
|
| 68 | - 'memes_auteurs' => 'Dos mesmos autores', |
|
| 69 | - 'message' => 'Mensagem', |
|
| 70 | - 'messages_forum' => 'Mensagens de fórum', |
|
| 71 | - 'messages_recents' => 'Mensagens de fóruns mais recentes', |
|
| 72 | - 'mots_clef' => 'Palavra-chave', |
|
| 73 | - 'mots_clefs' => 'Palavras-chave', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Palavras-chave no mesmo grupo', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navegação', |
|
| 78 | - 'nom' => 'Nome', |
|
| 79 | - 'nouveautes' => 'As novidades', |
|
| 80 | - 'nouveautes_web' => 'Novidades na Web', |
|
| 81 | - 'nouveaux_articles' => 'Novos artigos', |
|
| 82 | - 'nouvelles_breves' => 'Novas notícias', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'página anterior', |
|
| 86 | - 'page_suivante' => 'página seguinte', |
|
| 87 | - 'par_auteur' => 'por', |
|
| 88 | - 'participer_site' => 'Pode participar na vida deste sítio e propor os seus próprios artigos, inscrevendo-se mais abaixo. Receberá imediatamente um email com os seus códigos de acesso ao espaço privado do sítio.', |
|
| 89 | - 'plan_site' => 'Mapa do sítio', |
|
| 90 | - 'popularite' => 'Popularidade', |
|
| 91 | - 'poster_message' => 'Enviar uma mensagem', |
|
| 92 | - 'proposer_site' => 'Você pode propor um sítio a adicionar a esta rubrica :', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'Comentar este artigo', |
|
| 96 | - 'repondre_breve' => 'Comentar esta notícia', |
|
| 97 | - 'resultats_recherche' => 'Resultados da pesquisa', |
|
| 98 | - 'retour_debut_forums' => 'Regresso ao início dos fóruns', |
|
| 99 | - 'rss_abonnement' => 'Copie o seguinte URL para o seu agregador de conteúdos:', |
|
| 100 | - 'rss_abonnement_titre' => 'Subscrever', |
|
| 101 | - 'rss_abonnement_titre_page' => 'Subscrever', |
|
| 102 | - 'rss_explication' => 'Um "feed" RSS recolhe informação actualizada a partir de um sítio. Fornece o conteúdo das publicações ou comentários ou um extracto dos mesmos, bem como um link para as versões completas e outras informações. Este "feed" destina-se a ser lido por um agregador RSS.', |
|
| 103 | - 'rss_explication_titre' => 'O que é um "feed RSS"?', |
|
| 104 | - 'rubrique' => 'Rubrica', |
|
| 105 | - 'rubriques' => 'Rubricas', |
|
| 106 | - |
|
| 107 | - // S |
|
| 108 | - 'signatures_petition' => 'Assinaturas', |
|
| 109 | - 'site_realise_avec_spip' => 'Sítio realizado com SPIP', |
|
| 110 | - 'sites_web' => 'Sítios Web', |
|
| 111 | - 'sous_rubriques' => 'Sub-rubricas', |
|
| 112 | - 'spam' => 'Spam', |
|
| 113 | - 'suite' => 'continuação', |
|
| 114 | - 'sur_web' => 'Na Web', |
|
| 115 | - 'syndiquer_rubrique' => 'Subscrever esta rubrica', |
|
| 116 | - 'syndiquer_site' => 'Subscrever todo o sítio', |
|
| 117 | - |
|
| 118 | - // T |
|
| 119 | - 'texte_lettre_information' => 'Eis a carta de informação do sítio', |
|
| 120 | - 'texte_lettre_information_2' => 'Este sítio contém novos itens publicados desde', |
|
| 121 | - |
|
| 122 | - // V |
|
| 123 | - 'ver_imprimer' => 'Versão para imprimir', |
|
| 124 | - 'voir_en_ligne' => 'Ver online', |
|
| 125 | - 'voir_squelette' => 'exibir o modelo desta página' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Página inicial do sítio', |
|
| 14 | + 'article' => 'Artigo', |
|
| 15 | + 'articles' => 'Artigos', |
|
| 16 | + 'articles_auteur' => 'Artigos deste autor', |
|
| 17 | + 'articles_populaires' => 'Artigos mais populares', |
|
| 18 | + 'articles_rubrique' => 'Artigos desta rubrica', |
|
| 19 | + 'aucun_article' => 'Nenhum artigo neste endereço', |
|
| 20 | + 'aucun_auteur' => 'Nenhum autor neste endereço', |
|
| 21 | + 'aucun_site' => 'Nenhum sítio neste endereço', |
|
| 22 | + 'aucune_breve' => 'Nenhuma notícia neste endereço', |
|
| 23 | + 'aucune_rubrique' => 'Nenhuma rubrica neste endereço', |
|
| 24 | + 'auteur' => 'Autor', |
|
| 25 | + 'autres' => 'Outros', |
|
| 26 | + 'autres_breves' => 'Outras notícias', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Outros grupos de palavras-chave', |
|
| 28 | + 'autres_sites' => 'Outros sítios', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Bom dia', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Comentar este sítio', |
|
| 35 | + 'contact' => 'Contacto', |
|
| 36 | + 'copie_document_impossible' => 'Impossível copiar este documento', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Data', |
|
| 40 | + 'dernier_ajout' => 'Última actualização', |
|
| 41 | + 'dernieres_breves' => 'Últimas notícias', |
|
| 42 | + 'derniers_articles' => 'Últimos artigos', |
|
| 43 | + 'derniers_commentaires' => 'Últimos comentários', |
|
| 44 | + 'derniers_messages_forum' => 'Últimas mensagens publicadas nos fóruns', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Edição apenas em modo de texto', |
|
| 48 | + 'en_reponse' => 'Em resposta a :', |
|
| 49 | + 'en_resume' => 'Em resumo', |
|
| 50 | + 'envoyer_message' => 'Enviar uma mensagem', |
|
| 51 | + 'espace_prive' => 'Área privada', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Formatos válidos : @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Mapa do sítio', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'dias', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Entrar', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'Do mesmo autor', |
|
| 67 | + 'meme_rubrique' => 'Na mesma rubrica', |
|
| 68 | + 'memes_auteurs' => 'Dos mesmos autores', |
|
| 69 | + 'message' => 'Mensagem', |
|
| 70 | + 'messages_forum' => 'Mensagens de fórum', |
|
| 71 | + 'messages_recents' => 'Mensagens de fóruns mais recentes', |
|
| 72 | + 'mots_clef' => 'Palavra-chave', |
|
| 73 | + 'mots_clefs' => 'Palavras-chave', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Palavras-chave no mesmo grupo', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navegação', |
|
| 78 | + 'nom' => 'Nome', |
|
| 79 | + 'nouveautes' => 'As novidades', |
|
| 80 | + 'nouveautes_web' => 'Novidades na Web', |
|
| 81 | + 'nouveaux_articles' => 'Novos artigos', |
|
| 82 | + 'nouvelles_breves' => 'Novas notícias', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'página anterior', |
|
| 86 | + 'page_suivante' => 'página seguinte', |
|
| 87 | + 'par_auteur' => 'por', |
|
| 88 | + 'participer_site' => 'Pode participar na vida deste sítio e propor os seus próprios artigos, inscrevendo-se mais abaixo. Receberá imediatamente um email com os seus códigos de acesso ao espaço privado do sítio.', |
|
| 89 | + 'plan_site' => 'Mapa do sítio', |
|
| 90 | + 'popularite' => 'Popularidade', |
|
| 91 | + 'poster_message' => 'Enviar uma mensagem', |
|
| 92 | + 'proposer_site' => 'Você pode propor um sítio a adicionar a esta rubrica :', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'Comentar este artigo', |
|
| 96 | + 'repondre_breve' => 'Comentar esta notícia', |
|
| 97 | + 'resultats_recherche' => 'Resultados da pesquisa', |
|
| 98 | + 'retour_debut_forums' => 'Regresso ao início dos fóruns', |
|
| 99 | + 'rss_abonnement' => 'Copie o seguinte URL para o seu agregador de conteúdos:', |
|
| 100 | + 'rss_abonnement_titre' => 'Subscrever', |
|
| 101 | + 'rss_abonnement_titre_page' => 'Subscrever', |
|
| 102 | + 'rss_explication' => 'Um "feed" RSS recolhe informação actualizada a partir de um sítio. Fornece o conteúdo das publicações ou comentários ou um extracto dos mesmos, bem como um link para as versões completas e outras informações. Este "feed" destina-se a ser lido por um agregador RSS.', |
|
| 103 | + 'rss_explication_titre' => 'O que é um "feed RSS"?', |
|
| 104 | + 'rubrique' => 'Rubrica', |
|
| 105 | + 'rubriques' => 'Rubricas', |
|
| 106 | + |
|
| 107 | + // S |
|
| 108 | + 'signatures_petition' => 'Assinaturas', |
|
| 109 | + 'site_realise_avec_spip' => 'Sítio realizado com SPIP', |
|
| 110 | + 'sites_web' => 'Sítios Web', |
|
| 111 | + 'sous_rubriques' => 'Sub-rubricas', |
|
| 112 | + 'spam' => 'Spam', |
|
| 113 | + 'suite' => 'continuação', |
|
| 114 | + 'sur_web' => 'Na Web', |
|
| 115 | + 'syndiquer_rubrique' => 'Subscrever esta rubrica', |
|
| 116 | + 'syndiquer_site' => 'Subscrever todo o sítio', |
|
| 117 | + |
|
| 118 | + // T |
|
| 119 | + 'texte_lettre_information' => 'Eis a carta de informação do sítio', |
|
| 120 | + 'texte_lettre_information_2' => 'Este sítio contém novos itens publicados desde', |
|
| 121 | + |
|
| 122 | + // V |
|
| 123 | + 'ver_imprimer' => 'Versão para imprimir', |
|
| 124 | + 'voir_en_ligne' => 'Ver online', |
|
| 125 | + 'voir_squelette' => 'exibir o modelo desta página' |
|
| 126 | 126 | ); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | // de connexion, et tout risque d'ambiguite |
| 91 | 91 | if (!isset($nom_cache_desc_sql[$serveur][$objets_sql])) { |
| 92 | 92 | $nom_cache_desc_sql[$serveur][$objets_sql] = |
| 93 | - _DIR_CACHE . 'sql_desc_' |
|
| 93 | + _DIR_CACHE.'sql_desc_' |
|
| 94 | 94 | . ($serveur ? "{$serveur}_" : '') |
| 95 | - . substr(md5($connexion['db'] . ':' . $connexion['prefixe'] . ":$objets_sql"), 0, 8) |
|
| 95 | + . substr(md5($connexion['db'].':'.$connexion['prefixe'].":$objets_sql"), 0, 8) |
|
| 96 | 96 | . '.txt'; |
| 97 | 97 | // nouveau nom de cache = nouvelle version en memoire |
| 98 | 98 | unset($connexion['tables']); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ($connexion['spip_connect_version']) { |
| 121 | 121 | if ($table_spip and isset($GLOBALS['table_des_tables'][$nom])) { |
| 122 | 122 | $nom = $GLOBALS['table_des_tables'][$nom]; |
| 123 | - $nom_sql = 'spip_' . $nom; |
|
| 123 | + $nom_sql = 'spip_'.$nom; |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | // meme si pas d'abreviation declaree, trouver la table spip_$nom |
| 148 | 148 | // si c'est une table principale, |
| 149 | 149 | // puisqu'on le fait aussi pour les tables auxiliaires |
| 150 | - elseif ($nom_sql == $nom and isset($GLOBALS['tables_principales']['spip_' . $nom])) { |
|
| 151 | - $nom_sql = 'spip_' . $nom; |
|
| 150 | + elseif ($nom_sql == $nom and isset($GLOBALS['tables_principales']['spip_'.$nom])) { |
|
| 151 | + $nom_sql = 'spip_'.$nom; |
|
| 152 | 152 | $fdesc = &$GLOBALS['tables_principales'][$nom_sql]; |
| 153 | 153 | } elseif ( |
| 154 | 154 | isset($GLOBALS['tables_auxiliaires'][$n = $nom]) |
| 155 | - or isset($GLOBALS['tables_auxiliaires'][$n = 'spip_' . $nom]) |
|
| 155 | + or isset($GLOBALS['tables_auxiliaires'][$n = 'spip_'.$nom]) |
|
| 156 | 156 | ) { |
| 157 | 157 | $nom_sql = $n; |
| 158 | 158 | $fdesc = &$GLOBALS['tables_auxiliaires'][$n]; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ) { |
| 169 | 169 | if (!$fdesc) { |
| 170 | 170 | $log_level = $options['log_missing'] ? _LOG_INFO_IMPORTANTE : _LOG_DEBUG; |
| 171 | - spip_log("trouver_table: table inconnue '$serveur' '$nom'", 'base' . $log_level); |
|
| 171 | + spip_log("trouver_table: table inconnue '$serveur' '$nom'", 'base'.$log_level); |
|
| 172 | 172 | |
| 173 | 173 | return null; |
| 174 | 174 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $desc['exist'] = true; |
| 181 | 181 | // gerer le cas des cles vides (echec de l'analyse sur une vue par exemple) |
| 182 | 182 | // pour recuperer la declaration de lister_tables_objets_sql() si il y en a une |
| 183 | - if (! $desc['key']) { |
|
| 183 | + if (!$desc['key']) { |
|
| 184 | 184 | spip_log("trouver_table: table sans cle '$serveur' '$nom'", 'base'); |
| 185 | 185 | unset($desc['key']); |
| 186 | 186 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if (!isset($desc['key']) && !empty($fdesc['key'])) { |
| 198 | 198 | $desc['key'] = $fdesc['key']; |
| 199 | 199 | } |
| 200 | - if (! isset($desc['key'])) { |
|
| 200 | + if (!isset($desc['key'])) { |
|
| 201 | 201 | $desc['key'] = []; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\SQL\Tables |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | include_spip('base/objets'); |
| 22 | 22 | |
@@ -68,154 +68,154 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | **/ |
| 70 | 70 | function base_trouver_table_dist($nom, $serveur = '', $table_spip = true, array $options = []) { |
| 71 | - $desc_cache = null; |
|
| 72 | - static $nom_cache_desc_sql = []; |
|
| 73 | - |
|
| 74 | - if ( |
|
| 75 | - !spip_connect($serveur) |
|
| 76 | - or !preg_match('/^[a-zA-Z0-9._-]*/', $nom) |
|
| 77 | - ) { |
|
| 78 | - return null; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $options = $options + [ |
|
| 82 | - // si false, baissera le niveau de log si une table demandée n’existe pas |
|
| 83 | - 'log_missing' => true, |
|
| 84 | - ]; |
|
| 85 | - |
|
| 86 | - $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
|
| 87 | - $objets_sql = lister_tables_objets_sql('::md5'); |
|
| 88 | - |
|
| 89 | - // le nom du cache depend du serveur mais aussi du nom de la db et du prefixe |
|
| 90 | - // ce qui permet une auto invalidation en cas de modif manuelle du fichier |
|
| 91 | - // de connexion, et tout risque d'ambiguite |
|
| 92 | - if (!isset($nom_cache_desc_sql[$serveur][$objets_sql])) { |
|
| 93 | - $nom_cache_desc_sql[$serveur][$objets_sql] = |
|
| 94 | - _DIR_CACHE . 'sql_desc_' |
|
| 95 | - . ($serveur ? "{$serveur}_" : '') |
|
| 96 | - . substr(md5($connexion['db'] . ':' . $connexion['prefixe'] . ":$objets_sql"), 0, 8) |
|
| 97 | - . '.txt'; |
|
| 98 | - // nouveau nom de cache = nouvelle version en memoire |
|
| 99 | - unset($connexion['tables']); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - // un appel avec $nom vide est une demande explicite de vidange du cache des descriptions |
|
| 103 | - if (!$nom) { |
|
| 104 | - spip_unlink($nom_cache_desc_sql[$serveur][$objets_sql]); |
|
| 105 | - $connexion['tables'] = []; |
|
| 106 | - |
|
| 107 | - return null; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - $nom_sql = $nom; |
|
| 111 | - if (preg_match('/\.(.*)$/', $nom, $s)) { |
|
| 112 | - $nom_sql = $s[1]; |
|
| 113 | - } else { |
|
| 114 | - $nom_sql = $nom; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - $fdesc = $desc = ''; |
|
| 118 | - $connexion = &$GLOBALS['connexions'][$serveur ?: 0]; |
|
| 119 | - |
|
| 120 | - // base sous SPIP: gerer les abreviations explicites des noms de table |
|
| 121 | - if ($connexion['spip_connect_version']) { |
|
| 122 | - if ($table_spip and isset($GLOBALS['table_des_tables'][$nom])) { |
|
| 123 | - $nom = $GLOBALS['table_des_tables'][$nom]; |
|
| 124 | - $nom_sql = 'spip_' . $nom; |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - // si c'est la premiere table qu'on cherche |
|
| 129 | - // et si on est pas explicitement en recalcul |
|
| 130 | - // on essaye de recharger le cache des decriptions de ce serveur |
|
| 131 | - // dans le fichier cache |
|
| 132 | - if ( |
|
| 133 | - !isset($connexion['tables'][$nom_sql]) |
|
| 134 | - and defined('_VAR_MODE') and _VAR_MODE !== 'recalcul' |
|
| 135 | - and (!isset($connexion['tables']) or !$connexion['tables']) |
|
| 136 | - ) { |
|
| 137 | - if ( |
|
| 138 | - lire_fichier($nom_cache_desc_sql[$serveur][$objets_sql], $desc_cache) |
|
| 139 | - and $desc_cache = unserialize($desc_cache) |
|
| 140 | - ) { |
|
| 141 | - $connexion['tables'] = $desc_cache; |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - if ($table_spip and !isset($connexion['tables'][$nom_sql])) { |
|
| 145 | - if (isset($GLOBALS['tables_principales'][$nom_sql])) { |
|
| 146 | - $fdesc = $GLOBALS['tables_principales'][$nom_sql]; |
|
| 147 | - } |
|
| 148 | - // meme si pas d'abreviation declaree, trouver la table spip_$nom |
|
| 149 | - // si c'est une table principale, |
|
| 150 | - // puisqu'on le fait aussi pour les tables auxiliaires |
|
| 151 | - elseif ($nom_sql == $nom and isset($GLOBALS['tables_principales']['spip_' . $nom])) { |
|
| 152 | - $nom_sql = 'spip_' . $nom; |
|
| 153 | - $fdesc = &$GLOBALS['tables_principales'][$nom_sql]; |
|
| 154 | - } elseif ( |
|
| 155 | - isset($GLOBALS['tables_auxiliaires'][$n = $nom]) |
|
| 156 | - or isset($GLOBALS['tables_auxiliaires'][$n = 'spip_' . $nom]) |
|
| 157 | - ) { |
|
| 158 | - $nom_sql = $n; |
|
| 159 | - $fdesc = &$GLOBALS['tables_auxiliaires'][$n]; |
|
| 160 | - } # table locale a cote de SPIP, comme non SPIP: |
|
| 161 | - } |
|
| 162 | - if (!isset($connexion['tables'][$nom_sql])) { |
|
| 163 | - // La *vraie* base a la priorite |
|
| 164 | - $exists = sql_table_exists($nom_sql, $table_spip, $serveur); |
|
| 165 | - if ( |
|
| 166 | - !$exists |
|
| 167 | - or !$desc = sql_showtable($nom_sql, $table_spip, $serveur) |
|
| 168 | - or !$desc['field'] |
|
| 169 | - ) { |
|
| 170 | - if (!$fdesc) { |
|
| 171 | - $log_level = $options['log_missing'] ? _LOG_INFO_IMPORTANTE : _LOG_DEBUG; |
|
| 172 | - spip_log("trouver_table: table inconnue '$serveur' '$nom'", 'base' . $log_level); |
|
| 173 | - |
|
| 174 | - return null; |
|
| 175 | - } |
|
| 176 | - // on ne sait pas lire la structure de la table : |
|
| 177 | - // on retombe sur la description donnee dans les fichiers spip |
|
| 178 | - $desc = $fdesc; |
|
| 179 | - $desc['exist'] = false; |
|
| 180 | - } else { |
|
| 181 | - $desc['exist'] = true; |
|
| 182 | - // gerer le cas des cles vides (echec de l'analyse sur une vue par exemple) |
|
| 183 | - // pour recuperer la declaration de lister_tables_objets_sql() si il y en a une |
|
| 184 | - if (! $desc['key']) { |
|
| 185 | - spip_log("trouver_table: table sans cle '$serveur' '$nom'", 'base'); |
|
| 186 | - unset($desc['key']); |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - $desc['table'] = $desc['table_sql'] = $nom_sql; |
|
| 191 | - $desc['connexion'] = $serveur; |
|
| 192 | - |
|
| 193 | - // charger les infos declarees pour cette table |
|
| 194 | - // en lui passant les infos connues |
|
| 195 | - // $desc est prioritaire pour la description de la table |
|
| 196 | - $desc = array_merge(lister_tables_objets_sql($nom_sql, $desc), $desc); |
|
| 197 | - // s'assurer qu'on a toujours un 'key' |
|
| 198 | - if (!isset($desc['key']) && !empty($fdesc['key'])) { |
|
| 199 | - $desc['key'] = $fdesc['key']; |
|
| 200 | - } |
|
| 201 | - if (! isset($desc['key'])) { |
|
| 202 | - $desc['key'] = []; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - // si tables_objets_sql est bien fini d'init, on peut cacher |
|
| 206 | - $connexion['tables'][$nom_sql] = $desc; |
|
| 207 | - $res = &$connexion['tables'][$nom_sql]; |
|
| 208 | - // une nouvelle table a ete decrite |
|
| 209 | - // mettons donc a jour le cache des descriptions de ce serveur |
|
| 210 | - if (is_writeable(_DIR_CACHE)) { |
|
| 211 | - ecrire_fichier($nom_cache_desc_sql[$serveur][$objets_sql], serialize($connexion['tables']), true); |
|
| 212 | - } |
|
| 213 | - } else { |
|
| 214 | - $res = &$connexion['tables'][$nom_sql]; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - // toujours retourner $nom dans id_table |
|
| 218 | - $res['id_table'] = $nom; |
|
| 219 | - |
|
| 220 | - return $res; |
|
| 71 | + $desc_cache = null; |
|
| 72 | + static $nom_cache_desc_sql = []; |
|
| 73 | + |
|
| 74 | + if ( |
|
| 75 | + !spip_connect($serveur) |
|
| 76 | + or !preg_match('/^[a-zA-Z0-9._-]*/', $nom) |
|
| 77 | + ) { |
|
| 78 | + return null; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $options = $options + [ |
|
| 82 | + // si false, baissera le niveau de log si une table demandée n’existe pas |
|
| 83 | + 'log_missing' => true, |
|
| 84 | + ]; |
|
| 85 | + |
|
| 86 | + $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
|
| 87 | + $objets_sql = lister_tables_objets_sql('::md5'); |
|
| 88 | + |
|
| 89 | + // le nom du cache depend du serveur mais aussi du nom de la db et du prefixe |
|
| 90 | + // ce qui permet une auto invalidation en cas de modif manuelle du fichier |
|
| 91 | + // de connexion, et tout risque d'ambiguite |
|
| 92 | + if (!isset($nom_cache_desc_sql[$serveur][$objets_sql])) { |
|
| 93 | + $nom_cache_desc_sql[$serveur][$objets_sql] = |
|
| 94 | + _DIR_CACHE . 'sql_desc_' |
|
| 95 | + . ($serveur ? "{$serveur}_" : '') |
|
| 96 | + . substr(md5($connexion['db'] . ':' . $connexion['prefixe'] . ":$objets_sql"), 0, 8) |
|
| 97 | + . '.txt'; |
|
| 98 | + // nouveau nom de cache = nouvelle version en memoire |
|
| 99 | + unset($connexion['tables']); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + // un appel avec $nom vide est une demande explicite de vidange du cache des descriptions |
|
| 103 | + if (!$nom) { |
|
| 104 | + spip_unlink($nom_cache_desc_sql[$serveur][$objets_sql]); |
|
| 105 | + $connexion['tables'] = []; |
|
| 106 | + |
|
| 107 | + return null; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + $nom_sql = $nom; |
|
| 111 | + if (preg_match('/\.(.*)$/', $nom, $s)) { |
|
| 112 | + $nom_sql = $s[1]; |
|
| 113 | + } else { |
|
| 114 | + $nom_sql = $nom; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + $fdesc = $desc = ''; |
|
| 118 | + $connexion = &$GLOBALS['connexions'][$serveur ?: 0]; |
|
| 119 | + |
|
| 120 | + // base sous SPIP: gerer les abreviations explicites des noms de table |
|
| 121 | + if ($connexion['spip_connect_version']) { |
|
| 122 | + if ($table_spip and isset($GLOBALS['table_des_tables'][$nom])) { |
|
| 123 | + $nom = $GLOBALS['table_des_tables'][$nom]; |
|
| 124 | + $nom_sql = 'spip_' . $nom; |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + // si c'est la premiere table qu'on cherche |
|
| 129 | + // et si on est pas explicitement en recalcul |
|
| 130 | + // on essaye de recharger le cache des decriptions de ce serveur |
|
| 131 | + // dans le fichier cache |
|
| 132 | + if ( |
|
| 133 | + !isset($connexion['tables'][$nom_sql]) |
|
| 134 | + and defined('_VAR_MODE') and _VAR_MODE !== 'recalcul' |
|
| 135 | + and (!isset($connexion['tables']) or !$connexion['tables']) |
|
| 136 | + ) { |
|
| 137 | + if ( |
|
| 138 | + lire_fichier($nom_cache_desc_sql[$serveur][$objets_sql], $desc_cache) |
|
| 139 | + and $desc_cache = unserialize($desc_cache) |
|
| 140 | + ) { |
|
| 141 | + $connexion['tables'] = $desc_cache; |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + if ($table_spip and !isset($connexion['tables'][$nom_sql])) { |
|
| 145 | + if (isset($GLOBALS['tables_principales'][$nom_sql])) { |
|
| 146 | + $fdesc = $GLOBALS['tables_principales'][$nom_sql]; |
|
| 147 | + } |
|
| 148 | + // meme si pas d'abreviation declaree, trouver la table spip_$nom |
|
| 149 | + // si c'est une table principale, |
|
| 150 | + // puisqu'on le fait aussi pour les tables auxiliaires |
|
| 151 | + elseif ($nom_sql == $nom and isset($GLOBALS['tables_principales']['spip_' . $nom])) { |
|
| 152 | + $nom_sql = 'spip_' . $nom; |
|
| 153 | + $fdesc = &$GLOBALS['tables_principales'][$nom_sql]; |
|
| 154 | + } elseif ( |
|
| 155 | + isset($GLOBALS['tables_auxiliaires'][$n = $nom]) |
|
| 156 | + or isset($GLOBALS['tables_auxiliaires'][$n = 'spip_' . $nom]) |
|
| 157 | + ) { |
|
| 158 | + $nom_sql = $n; |
|
| 159 | + $fdesc = &$GLOBALS['tables_auxiliaires'][$n]; |
|
| 160 | + } # table locale a cote de SPIP, comme non SPIP: |
|
| 161 | + } |
|
| 162 | + if (!isset($connexion['tables'][$nom_sql])) { |
|
| 163 | + // La *vraie* base a la priorite |
|
| 164 | + $exists = sql_table_exists($nom_sql, $table_spip, $serveur); |
|
| 165 | + if ( |
|
| 166 | + !$exists |
|
| 167 | + or !$desc = sql_showtable($nom_sql, $table_spip, $serveur) |
|
| 168 | + or !$desc['field'] |
|
| 169 | + ) { |
|
| 170 | + if (!$fdesc) { |
|
| 171 | + $log_level = $options['log_missing'] ? _LOG_INFO_IMPORTANTE : _LOG_DEBUG; |
|
| 172 | + spip_log("trouver_table: table inconnue '$serveur' '$nom'", 'base' . $log_level); |
|
| 173 | + |
|
| 174 | + return null; |
|
| 175 | + } |
|
| 176 | + // on ne sait pas lire la structure de la table : |
|
| 177 | + // on retombe sur la description donnee dans les fichiers spip |
|
| 178 | + $desc = $fdesc; |
|
| 179 | + $desc['exist'] = false; |
|
| 180 | + } else { |
|
| 181 | + $desc['exist'] = true; |
|
| 182 | + // gerer le cas des cles vides (echec de l'analyse sur une vue par exemple) |
|
| 183 | + // pour recuperer la declaration de lister_tables_objets_sql() si il y en a une |
|
| 184 | + if (! $desc['key']) { |
|
| 185 | + spip_log("trouver_table: table sans cle '$serveur' '$nom'", 'base'); |
|
| 186 | + unset($desc['key']); |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + $desc['table'] = $desc['table_sql'] = $nom_sql; |
|
| 191 | + $desc['connexion'] = $serveur; |
|
| 192 | + |
|
| 193 | + // charger les infos declarees pour cette table |
|
| 194 | + // en lui passant les infos connues |
|
| 195 | + // $desc est prioritaire pour la description de la table |
|
| 196 | + $desc = array_merge(lister_tables_objets_sql($nom_sql, $desc), $desc); |
|
| 197 | + // s'assurer qu'on a toujours un 'key' |
|
| 198 | + if (!isset($desc['key']) && !empty($fdesc['key'])) { |
|
| 199 | + $desc['key'] = $fdesc['key']; |
|
| 200 | + } |
|
| 201 | + if (! isset($desc['key'])) { |
|
| 202 | + $desc['key'] = []; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + // si tables_objets_sql est bien fini d'init, on peut cacher |
|
| 206 | + $connexion['tables'][$nom_sql] = $desc; |
|
| 207 | + $res = &$connexion['tables'][$nom_sql]; |
|
| 208 | + // une nouvelle table a ete decrite |
|
| 209 | + // mettons donc a jour le cache des descriptions de ce serveur |
|
| 210 | + if (is_writeable(_DIR_CACHE)) { |
|
| 211 | + ecrire_fichier($nom_cache_desc_sql[$serveur][$objets_sql], serialize($connexion['tables']), true); |
|
| 212 | + } |
|
| 213 | + } else { |
|
| 214 | + $res = &$connexion['tables'][$nom_sql]; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + // toujours retourner $nom dans id_table |
|
| 218 | + $res['id_table'] = $nom; |
|
| 219 | + |
|
| 220 | + return $res; |
|
| 221 | 221 | } |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if (!is_null($options['range'])) { |
| 56 | 56 | spip_livrer_fichier_partie($fichier, $options['range']); |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | spip_livrer_fichier_entier($fichier); |
| 60 | 59 | } |
| 61 | 60 | } |
@@ -86,8 +85,7 @@ discard block |
||
| 86 | 85 | header('Expires: 0'); // set expiration time |
| 87 | 86 | header('Pragma: public'); |
| 88 | 87 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 89 | - } |
|
| 90 | - else { |
|
| 88 | + } else { |
|
| 91 | 89 | $f = basename($fichier); |
| 92 | 90 | header("Content-Disposition: inline; filename=\"$f\";"); |
| 93 | 91 | header('Expires: ' . $expires); // set expiration time |
@@ -154,8 +152,7 @@ discard block |
||
| 154 | 152 | } |
| 155 | 153 | |
| 156 | 154 | $cr_header = sprintf('Content-Range: bytes %d-%d/%d', $byteOffset, $finishBytes, $fileSize); |
| 157 | - } |
|
| 158 | - else { |
|
| 155 | + } else { |
|
| 159 | 156 | // si pas de range valide, on delegue a la methode d'envoi complet |
| 160 | 157 | spip_livrer_fichier_entier($fichier); |
| 161 | 158 | // redondant, mais facilite la comprehension du code |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Fichier |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -36,28 +36,28 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function spip_livrer_fichier($fichier, $content_type = 'application/octet-stream', $options = []) { |
| 38 | 38 | |
| 39 | - $defaut = [ |
|
| 40 | - 'attachment' => false, |
|
| 41 | - 'expires' => 3600, |
|
| 42 | - 'range' => null |
|
| 43 | - ]; |
|
| 44 | - $options = array_merge($defaut, $options); |
|
| 45 | - if (is_numeric($options['expires']) and $options['expires'] > 0) { |
|
| 46 | - $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT'; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) { |
|
| 50 | - $options['range'] = $_SERVER['HTTP_RANGE']; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - spip_livrer_fichier_entetes($fichier, $content_type, $options['attachment'] && !$options['range'], $options['expires']); |
|
| 54 | - |
|
| 55 | - if (!is_null($options['range'])) { |
|
| 56 | - spip_livrer_fichier_partie($fichier, $options['range']); |
|
| 57 | - } |
|
| 58 | - else { |
|
| 59 | - spip_livrer_fichier_entier($fichier); |
|
| 60 | - } |
|
| 39 | + $defaut = [ |
|
| 40 | + 'attachment' => false, |
|
| 41 | + 'expires' => 3600, |
|
| 42 | + 'range' => null |
|
| 43 | + ]; |
|
| 44 | + $options = array_merge($defaut, $options); |
|
| 45 | + if (is_numeric($options['expires']) and $options['expires'] > 0) { |
|
| 46 | + $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT'; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) { |
|
| 50 | + $options['range'] = $_SERVER['HTTP_RANGE']; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + spip_livrer_fichier_entetes($fichier, $content_type, $options['attachment'] && !$options['range'], $options['expires']); |
|
| 54 | + |
|
| 55 | + if (!is_null($options['range'])) { |
|
| 56 | + spip_livrer_fichier_partie($fichier, $options['range']); |
|
| 57 | + } |
|
| 58 | + else { |
|
| 59 | + spip_livrer_fichier_entier($fichier); |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -70,35 +70,35 @@ discard block |
||
| 70 | 70 | * @param int|string $expires |
| 71 | 71 | */ |
| 72 | 72 | function spip_livrer_fichier_entetes($fichier, $content_type = 'application/octet-stream', $attachment = false, $expires = 0) { |
| 73 | - // toujours envoyer un content type, meme vide ! |
|
| 74 | - header('Accept-Ranges: bytes'); |
|
| 75 | - header('Content-Type: ' . $content_type); |
|
| 76 | - |
|
| 77 | - if ($fs = stat($fichier) |
|
| 78 | - and !empty($fs['size']) |
|
| 79 | - and !empty($fs['mtime'])) { |
|
| 80 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $fs['mtime']) . " GMT"); |
|
| 81 | - header(sprintf('Etag: "%x-%x"', $fs['size'], str_pad($fs['mtime'], 16, "0"))); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if ($attachment) { |
|
| 85 | - $f = basename($fichier); |
|
| 86 | - // ce content-type est necessaire pour eviter des corruptions de zip dans ie6 |
|
| 87 | - header('Content-Type: application/octet-stream'); |
|
| 88 | - |
|
| 89 | - header("Content-Disposition: attachment; filename=\"$f\";"); |
|
| 90 | - header('Content-Transfer-Encoding: binary'); |
|
| 91 | - |
|
| 92 | - // fix for IE caching or PHP bug issue |
|
| 93 | - header('Expires: 0'); // set expiration time |
|
| 94 | - header('Pragma: public'); |
|
| 95 | - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
| 96 | - } |
|
| 97 | - else { |
|
| 98 | - $f = basename($fichier); |
|
| 99 | - header("Content-Disposition: inline; filename=\"$f\";"); |
|
| 100 | - header('Expires: ' . $expires); // set expiration time |
|
| 101 | - } |
|
| 73 | + // toujours envoyer un content type, meme vide ! |
|
| 74 | + header('Accept-Ranges: bytes'); |
|
| 75 | + header('Content-Type: ' . $content_type); |
|
| 76 | + |
|
| 77 | + if ($fs = stat($fichier) |
|
| 78 | + and !empty($fs['size']) |
|
| 79 | + and !empty($fs['mtime'])) { |
|
| 80 | + header("Last-Modified: " . gmdate("D, d M Y H:i:s", $fs['mtime']) . " GMT"); |
|
| 81 | + header(sprintf('Etag: "%x-%x"', $fs['size'], str_pad($fs['mtime'], 16, "0"))); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if ($attachment) { |
|
| 85 | + $f = basename($fichier); |
|
| 86 | + // ce content-type est necessaire pour eviter des corruptions de zip dans ie6 |
|
| 87 | + header('Content-Type: application/octet-stream'); |
|
| 88 | + |
|
| 89 | + header("Content-Disposition: attachment; filename=\"$f\";"); |
|
| 90 | + header('Content-Transfer-Encoding: binary'); |
|
| 91 | + |
|
| 92 | + // fix for IE caching or PHP bug issue |
|
| 93 | + header('Expires: 0'); // set expiration time |
|
| 94 | + header('Pragma: public'); |
|
| 95 | + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
| 96 | + } |
|
| 97 | + else { |
|
| 98 | + $f = basename($fichier); |
|
| 99 | + header("Content-Disposition: inline; filename=\"$f\";"); |
|
| 100 | + header('Expires: ' . $expires); // set expiration time |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -106,20 +106,20 @@ discard block |
||
| 106 | 106 | * @param string $fichier |
| 107 | 107 | */ |
| 108 | 108 | function spip_livrer_fichier_entier($fichier) { |
| 109 | - if (!file_exists($fichier)) { |
|
| 110 | - throw new \Exception(sprintf('File not found: %s', $fichier)); |
|
| 111 | - } |
|
| 109 | + if (!file_exists($fichier)) { |
|
| 110 | + throw new \Exception(sprintf('File not found: %s', $fichier)); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - if (!is_readable($fichier)) { |
|
| 114 | - throw new \Exception(sprintf('File not readable: %s', $fichier)); |
|
| 115 | - } |
|
| 113 | + if (!is_readable($fichier)) { |
|
| 114 | + throw new \Exception(sprintf('File not readable: %s', $fichier)); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - if ($size = filesize($fichier)) { |
|
| 118 | - header(sprintf('Content-Length: %d', $size)); |
|
| 119 | - } |
|
| 117 | + if ($size = filesize($fichier)) { |
|
| 118 | + header(sprintf('Content-Length: %d', $size)); |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - readfile($fichier); |
|
| 122 | - exit(); |
|
| 121 | + readfile($fichier); |
|
| 122 | + exit(); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -132,98 +132,98 @@ discard block |
||
| 132 | 132 | * @throws Exception |
| 133 | 133 | */ |
| 134 | 134 | function spip_livrer_fichier_partie($fichier, $range = null) { |
| 135 | - if (!file_exists($fichier)) { |
|
| 136 | - throw new \Exception(sprintf('File not found: %s', $fichier)); |
|
| 137 | - } |
|
| 135 | + if (!file_exists($fichier)) { |
|
| 136 | + throw new \Exception(sprintf('File not found: %s', $fichier)); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - if (!is_readable($fichier)) { |
|
| 140 | - throw new \Exception(sprintf('File not readable: %s', $fichier)); |
|
| 141 | - } |
|
| 139 | + if (!is_readable($fichier)) { |
|
| 140 | + throw new \Exception(sprintf('File not readable: %s', $fichier)); |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | - // Par defaut on envoie tout |
|
| 145 | - $byteOffset = 0; |
|
| 146 | - $byteLength = $fileSize = filesize($fichier); |
|
| 144 | + // Par defaut on envoie tout |
|
| 145 | + $byteOffset = 0; |
|
| 146 | + $byteLength = $fileSize = filesize($fichier); |
|
| 147 | 147 | |
| 148 | 148 | |
| 149 | - // Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451" |
|
| 150 | - if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) { |
|
| 151 | - ### Offset signifies where we should begin to read the file |
|
| 152 | - $byteOffset = (int)$match[1]; |
|
| 149 | + // Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451" |
|
| 150 | + if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) { |
|
| 151 | + ### Offset signifies where we should begin to read the file |
|
| 152 | + $byteOffset = (int)$match[1]; |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | - ### Length is for how long we should read the file according to the browser, and can never go beyond the file size |
|
| 156 | - if (isset($match[2])) { |
|
| 157 | - $finishBytes = (int)$match[2]; |
|
| 158 | - $byteLength = $finishBytes + 1; |
|
| 159 | - } else { |
|
| 160 | - $finishBytes = $fileSize - 1; |
|
| 161 | - } |
|
| 155 | + ### Length is for how long we should read the file according to the browser, and can never go beyond the file size |
|
| 156 | + if (isset($match[2])) { |
|
| 157 | + $finishBytes = (int)$match[2]; |
|
| 158 | + $byteLength = $finishBytes + 1; |
|
| 159 | + } else { |
|
| 160 | + $finishBytes = $fileSize - 1; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - $cr_header = sprintf('Content-Range: bytes %d-%d/%d', $byteOffset, $finishBytes, $fileSize); |
|
| 164 | - } |
|
| 165 | - else { |
|
| 166 | - // si pas de range valide, on delegue a la methode d'envoi complet |
|
| 167 | - spip_livrer_fichier_entier($fichier); |
|
| 168 | - // redondant, mais facilite la comprehension du code |
|
| 169 | - exit(); |
|
| 170 | - } |
|
| 163 | + $cr_header = sprintf('Content-Range: bytes %d-%d/%d', $byteOffset, $finishBytes, $fileSize); |
|
| 164 | + } |
|
| 165 | + else { |
|
| 166 | + // si pas de range valide, on delegue a la methode d'envoi complet |
|
| 167 | + spip_livrer_fichier_entier($fichier); |
|
| 168 | + // redondant, mais facilite la comprehension du code |
|
| 169 | + exit(); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - // Remove headers that might unnecessarily clutter up the output |
|
| 173 | - header_remove('Cache-Control'); |
|
| 174 | - header_remove('Pragma'); |
|
| 172 | + // Remove headers that might unnecessarily clutter up the output |
|
| 173 | + header_remove('Cache-Control'); |
|
| 174 | + header_remove('Pragma'); |
|
| 175 | 175 | |
| 176 | - // partial content |
|
| 177 | - header('HTTP/1.1 206 Partial content'); |
|
| 178 | - header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 176 | + // partial content |
|
| 177 | + header('HTTP/1.1 206 Partial content'); |
|
| 178 | + header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 179 | 179 | |
| 180 | 180 | |
| 181 | - $byteRange = $byteLength - $byteOffset; |
|
| 181 | + $byteRange = $byteLength - $byteOffset; |
|
| 182 | 182 | |
| 183 | - header(sprintf('Content-Length: %d', $byteRange)); |
|
| 183 | + header(sprintf('Content-Length: %d', $byteRange)); |
|
| 184 | 184 | |
| 185 | - // Variable containing the buffer |
|
| 186 | - $buffer = ''; |
|
| 187 | - // Just a reasonable buffer size |
|
| 188 | - $bufferSize = 512 * 16; |
|
| 189 | - // Contains how much is left to read of the byteRange |
|
| 190 | - $bytePool = $byteRange; |
|
| 185 | + // Variable containing the buffer |
|
| 186 | + $buffer = ''; |
|
| 187 | + // Just a reasonable buffer size |
|
| 188 | + $bufferSize = 512 * 16; |
|
| 189 | + // Contains how much is left to read of the byteRange |
|
| 190 | + $bytePool = $byteRange; |
|
| 191 | 191 | |
| 192 | - if (!$handle = fopen($fichier, 'r')) { |
|
| 193 | - throw new \Exception(sprintf('Could not get handle for file %s', $fichier)); |
|
| 194 | - } |
|
| 192 | + if (!$handle = fopen($fichier, 'r')) { |
|
| 193 | + throw new \Exception(sprintf('Could not get handle for file %s', $fichier)); |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - if (fseek($handle, $byteOffset, SEEK_SET) == -1) { |
|
| 197 | - throw new \Exception(sprintf('Could not seek to byte offset %d', $byteOffset)); |
|
| 198 | - } |
|
| 196 | + if (fseek($handle, $byteOffset, SEEK_SET) == -1) { |
|
| 197 | + throw new \Exception(sprintf('Could not seek to byte offset %d', $byteOffset)); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | 200 | |
| 201 | - while ($bytePool > 0) { |
|
| 202 | - // How many bytes we request on this iteration |
|
| 203 | - $chunkSizeRequested = min($bufferSize, $bytePool); |
|
| 201 | + while ($bytePool > 0) { |
|
| 202 | + // How many bytes we request on this iteration |
|
| 203 | + $chunkSizeRequested = min($bufferSize, $bytePool); |
|
| 204 | 204 | |
| 205 | - // Try readin $chunkSizeRequested bytes from $handle and put data in $buffer |
|
| 206 | - $buffer = fread($handle, $chunkSizeRequested); |
|
| 205 | + // Try readin $chunkSizeRequested bytes from $handle and put data in $buffer |
|
| 206 | + $buffer = fread($handle, $chunkSizeRequested); |
|
| 207 | 207 | |
| 208 | - // Store how many bytes were actually read |
|
| 209 | - $chunkSizeActual = strlen($buffer); |
|
| 208 | + // Store how many bytes were actually read |
|
| 209 | + $chunkSizeActual = strlen($buffer); |
|
| 210 | 210 | |
| 211 | - // If we didn't get any bytes that means something unexpected has happened since $bytePool should be zero already |
|
| 212 | - if ($chunkSizeActual == 0) { |
|
| 213 | - // For production servers this should go in your php error log, since it will break the output |
|
| 214 | - trigger_error('Chunksize became 0', E_USER_WARNING); |
|
| 215 | - break; |
|
| 216 | - } |
|
| 211 | + // If we didn't get any bytes that means something unexpected has happened since $bytePool should be zero already |
|
| 212 | + if ($chunkSizeActual == 0) { |
|
| 213 | + // For production servers this should go in your php error log, since it will break the output |
|
| 214 | + trigger_error('Chunksize became 0', E_USER_WARNING); |
|
| 215 | + break; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - // Decrease byte pool with amount of bytes that were read during this iteration |
|
| 219 | - $bytePool -= $chunkSizeActual; |
|
| 218 | + // Decrease byte pool with amount of bytes that were read during this iteration |
|
| 219 | + $bytePool -= $chunkSizeActual; |
|
| 220 | 220 | |
| 221 | - // Write the buffer to output |
|
| 222 | - print $buffer; |
|
| 221 | + // Write the buffer to output |
|
| 222 | + print $buffer; |
|
| 223 | 223 | |
| 224 | - // Try to output the data to the client immediately |
|
| 225 | - flush(); |
|
| 226 | - } |
|
| 224 | + // Try to output the data to the client immediately |
|
| 225 | + flush(); |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - exit(); |
|
| 228 | + exit(); |
|
| 229 | 229 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ]; |
| 44 | 44 | $options = array_merge($defaut, $options); |
| 45 | 45 | if (is_numeric($options['expires']) and $options['expires'] > 0) { |
| 46 | - $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT'; |
|
| 46 | + $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']).' GMT'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) { |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | function spip_livrer_fichier_entetes($fichier, $content_type = 'application/octet-stream', $attachment = false, $expires = 0) { |
| 73 | 73 | // toujours envoyer un content type, meme vide ! |
| 74 | 74 | header('Accept-Ranges: bytes'); |
| 75 | - header('Content-Type: ' . $content_type); |
|
| 75 | + header('Content-Type: '.$content_type); |
|
| 76 | 76 | |
| 77 | 77 | if ($fs = stat($fichier) |
| 78 | 78 | and !empty($fs['size']) |
| 79 | 79 | and !empty($fs['mtime'])) { |
| 80 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $fs['mtime']) . " GMT"); |
|
| 80 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $fs['mtime'])." GMT"); |
|
| 81 | 81 | header(sprintf('Etag: "%x-%x"', $fs['size'], str_pad($fs['mtime'], 16, "0"))); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | else { |
| 98 | 98 | $f = basename($fichier); |
| 99 | 99 | header("Content-Disposition: inline; filename=\"$f\";"); |
| 100 | - header('Expires: ' . $expires); // set expiration time |
|
| 100 | + header('Expires: '.$expires); // set expiration time |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | // Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451" |
| 150 | 150 | if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) { |
| 151 | 151 | ### Offset signifies where we should begin to read the file |
| 152 | - $byteOffset = (int)$match[1]; |
|
| 152 | + $byteOffset = (int) $match[1]; |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | ### Length is for how long we should read the file according to the browser, and can never go beyond the file size |
| 156 | 156 | if (isset($match[2])) { |
| 157 | - $finishBytes = (int)$match[2]; |
|
| 157 | + $finishBytes = (int) $match[2]; |
|
| 158 | 158 | $byteLength = $finishBytes + 1; |
| 159 | 159 | } else { |
| 160 | 160 | $finishBytes = $fileSize - 1; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | // partial content |
| 177 | 177 | header('HTTP/1.1 206 Partial content'); |
| 178 | - header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 178 | + header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | $byteRange = $byteLength - $byteOffset; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | // Si l'article est publie, invalider les caches et demander sa reindexation |
| 109 | - $t = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 109 | + $t = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id_article)); |
|
| 110 | 110 | $invalideur = $indexation = false; |
| 111 | 111 | if ($t == 'publie') { |
| 112 | 112 | $invalideur = "id='article/$id_article'"; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $id_article, |
| 120 | 120 | [ |
| 121 | 121 | 'data' => $set, |
| 122 | - 'nonvide' => ['titre' => _T('info_nouvel_article') . ' ' . _T('info_numero_abbreviation') . $id_article], |
|
| 122 | + 'nonvide' => ['titre' => _T('info_nouvel_article').' '._T('info_numero_abbreviation').$id_article], |
|
| 123 | 123 | 'invalideur' => $invalideur, |
| 124 | 124 | 'indexation' => $indexation, |
| 125 | 125 | 'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } elseif (autoriser('modifier', 'article', $id_article) and $s != 'publie') { |
| 310 | 310 | $statut = $champs['statut'] = $s; |
| 311 | 311 | } else { |
| 312 | - spip_log("editer_article $id_article refus " . join(' ', $c)); |
|
| 312 | + spip_log("editer_article $id_article refus ".join(' ', $c)); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // En cas de publication, fixer la date a "maintenant" |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | isset($c['id_parent']) |
| 335 | 335 | and $id_parent = $c['id_parent'] |
| 336 | 336 | and $id_parent != $id_rubrique |
| 337 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 337 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique='.intval($id_parent))) |
|
| 338 | 338 | ) { |
| 339 | 339 | $champs['id_rubrique'] = $id_parent; |
| 340 | 340 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | // Si on deplace l'article |
| 436 | 436 | // changer aussi son secteur et sa langue (si heritee) |
| 437 | 437 | if (isset($champs['id_rubrique'])) { |
| 438 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 438 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique='.sql_quote($champs['id_rubrique'])); |
|
| 439 | 439 | |
| 440 | 440 | $langue = $row_rub['lang']; |
| 441 | 441 | $champs['id_secteur'] = $row_rub['id_secteur']; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | sql_fetsel( |
| 444 | 444 | '1', |
| 445 | 445 | 'spip_articles', |
| 446 | - 'id_article=' . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 446 | + 'id_article='.intval($id_article)." AND langue_choisie<>'oui' AND lang<>".sql_quote($langue) |
|
| 447 | 447 | ) |
| 448 | 448 | ) { |
| 449 | 449 | $champs['lang'] = $langue; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | return; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - sql_updateq('spip_articles', $champs, 'id_article=' . intval($id_article)); |
|
| 457 | + sql_updateq('spip_articles', $champs, 'id_article='.intval($id_article)); |
|
| 458 | 458 | |
| 459 | 459 | // Changer le statut des rubriques concernees |
| 460 | 460 | |
@@ -475,6 +475,6 @@ discard block |
||
| 475 | 475 | foreach ($plus as $n => $t) { |
| 476 | 476 | $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", '', $t); |
| 477 | 477 | } |
| 478 | - set_request('texte', join('', $plus) . _request('texte')); |
|
| 478 | + set_request('texte', join('', $plus)._request('texte')); |
|
| 479 | 479 | } |
| 480 | 480 | } |
@@ -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 | /** |
@@ -39,36 +39,36 @@ discard block |
||
| 39 | 39 | * Liste (identifiant de l'article, texte d'erreur éventuel) |
| 40 | 40 | */ |
| 41 | 41 | function action_editer_article_dist($arg = null) { |
| 42 | - include_spip('inc/autoriser'); |
|
| 43 | - $err = ''; |
|
| 44 | - if (is_null($arg)) { |
|
| 45 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 46 | - $arg = $securiser_action(); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - // si id_article n'est pas un nombre, c'est une creation |
|
| 50 | - // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 51 | - if (!$id_article = intval($arg)) { |
|
| 52 | - $id_parent = _request('id_parent'); |
|
| 53 | - if (!$id_parent) { |
|
| 54 | - $err = _L("creation interdite d'un article sans rubrique"); |
|
| 55 | - } elseif (!autoriser('creerarticledans', 'rubrique', $id_parent)) { |
|
| 56 | - $err = _T('info_creerdansrubrique_non_autorise'); |
|
| 57 | - } else { |
|
| 58 | - $id_article = article_inserer($id_parent); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - // Enregistre l'envoi dans la BD |
|
| 63 | - if ($id_article > 0) { |
|
| 64 | - $err = article_modifier($id_article); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if ($err) { |
|
| 68 | - spip_log("echec editeur article: $err", _LOG_ERREUR); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - return [$id_article, $err]; |
|
| 42 | + include_spip('inc/autoriser'); |
|
| 43 | + $err = ''; |
|
| 44 | + if (is_null($arg)) { |
|
| 45 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 46 | + $arg = $securiser_action(); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + // si id_article n'est pas un nombre, c'est une creation |
|
| 50 | + // mais on verifie qu'on a toutes les donnees qu'il faut. |
|
| 51 | + if (!$id_article = intval($arg)) { |
|
| 52 | + $id_parent = _request('id_parent'); |
|
| 53 | + if (!$id_parent) { |
|
| 54 | + $err = _L("creation interdite d'un article sans rubrique"); |
|
| 55 | + } elseif (!autoriser('creerarticledans', 'rubrique', $id_parent)) { |
|
| 56 | + $err = _T('info_creerdansrubrique_non_autorise'); |
|
| 57 | + } else { |
|
| 58 | + $id_article = article_inserer($id_parent); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + // Enregistre l'envoi dans la BD |
|
| 63 | + if ($id_article > 0) { |
|
| 64 | + $err = article_modifier($id_article); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if ($err) { |
|
| 68 | + spip_log("echec editeur article: $err", _LOG_ERREUR); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + return [$id_article, $err]; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -90,50 +90,50 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function article_modifier($id_article, $set = null) { |
| 92 | 92 | |
| 93 | - // unifier $texte en cas de texte trop long |
|
| 94 | - trop_longs_articles(); |
|
| 95 | - |
|
| 96 | - include_spip('inc/modifier'); |
|
| 97 | - include_spip('inc/filtres'); |
|
| 98 | - $c = collecter_requests( |
|
| 99 | - // include list |
|
| 100 | - objet_info('article', 'champs_editables'), |
|
| 101 | - // exclude list |
|
| 102 | - ['date', 'statut', 'id_parent'], |
|
| 103 | - // donnees eventuellement fournies |
|
| 104 | - $set |
|
| 105 | - ); |
|
| 106 | - |
|
| 107 | - // Si l'article est publie, invalider les caches et demander sa reindexation |
|
| 108 | - $t = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 109 | - $invalideur = $indexation = false; |
|
| 110 | - if ($t == 'publie') { |
|
| 111 | - $invalideur = "id='article/$id_article'"; |
|
| 112 | - $indexation = true; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - if ( |
|
| 116 | - $err = objet_modifier_champs( |
|
| 117 | - 'article', |
|
| 118 | - $id_article, |
|
| 119 | - [ |
|
| 120 | - 'data' => $set, |
|
| 121 | - 'nonvide' => ['titre' => _T('info_nouvel_article') . ' ' . _T('info_numero_abbreviation') . $id_article], |
|
| 122 | - 'invalideur' => $invalideur, |
|
| 123 | - 'indexation' => $indexation, |
|
| 124 | - 'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 125 | - ], |
|
| 126 | - $c |
|
| 127 | - ) |
|
| 128 | - ) { |
|
| 129 | - return $err; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - // Modification de statut, changement de rubrique ? |
|
| 133 | - $c = collecter_requests(['date', 'statut', 'id_parent'], [], $set); |
|
| 134 | - $err = article_instituer($id_article, $c); |
|
| 135 | - |
|
| 136 | - return $err; |
|
| 93 | + // unifier $texte en cas de texte trop long |
|
| 94 | + trop_longs_articles(); |
|
| 95 | + |
|
| 96 | + include_spip('inc/modifier'); |
|
| 97 | + include_spip('inc/filtres'); |
|
| 98 | + $c = collecter_requests( |
|
| 99 | + // include list |
|
| 100 | + objet_info('article', 'champs_editables'), |
|
| 101 | + // exclude list |
|
| 102 | + ['date', 'statut', 'id_parent'], |
|
| 103 | + // donnees eventuellement fournies |
|
| 104 | + $set |
|
| 105 | + ); |
|
| 106 | + |
|
| 107 | + // Si l'article est publie, invalider les caches et demander sa reindexation |
|
| 108 | + $t = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id_article)); |
|
| 109 | + $invalideur = $indexation = false; |
|
| 110 | + if ($t == 'publie') { |
|
| 111 | + $invalideur = "id='article/$id_article'"; |
|
| 112 | + $indexation = true; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + if ( |
|
| 116 | + $err = objet_modifier_champs( |
|
| 117 | + 'article', |
|
| 118 | + $id_article, |
|
| 119 | + [ |
|
| 120 | + 'data' => $set, |
|
| 121 | + 'nonvide' => ['titre' => _T('info_nouvel_article') . ' ' . _T('info_numero_abbreviation') . $id_article], |
|
| 122 | + 'invalideur' => $invalideur, |
|
| 123 | + 'indexation' => $indexation, |
|
| 124 | + 'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif |
|
| 125 | + ], |
|
| 126 | + $c |
|
| 127 | + ) |
|
| 128 | + ) { |
|
| 129 | + return $err; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + // Modification de statut, changement de rubrique ? |
|
| 133 | + $c = collecter_requests(['date', 'statut', 'id_parent'], [], $set); |
|
| 134 | + $err = article_instituer($id_article, $c); |
|
| 135 | + |
|
| 136 | + return $err; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -169,120 +169,120 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function article_inserer($id_rubrique, $set = null) { |
| 171 | 171 | |
| 172 | - // Si id_rubrique vaut 0 ou n'est pas definie, creer l'article |
|
| 173 | - // dans la premiere rubrique racine |
|
| 174 | - if (!$id_rubrique = intval($id_rubrique)) { |
|
| 175 | - $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 176 | - $id_rubrique = $row['id_rubrique']; |
|
| 177 | - } else { |
|
| 178 | - $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - // eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue |
|
| 182 | - // cas de id_rubrique = -1 par exemple avec plugin "pages" |
|
| 183 | - $id_secteur = $row['id_secteur'] ?? 0; |
|
| 184 | - $lang_rub = $row['lang'] ?? ''; |
|
| 185 | - |
|
| 186 | - $lang = ''; |
|
| 187 | - $choisie = 'non'; |
|
| 188 | - // La langue a la creation : si les liens de traduction sont autorises |
|
| 189 | - // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 190 | - // ou a defaut celle de la rubrique |
|
| 191 | - // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 192 | - if ( |
|
| 193 | - !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 194 | - 'spip_articles', |
|
| 195 | - explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 196 | - ) |
|
| 197 | - ) { |
|
| 198 | - lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 199 | - if ( |
|
| 200 | - in_array( |
|
| 201 | - $GLOBALS['spip_lang'], |
|
| 202 | - explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 203 | - ) |
|
| 204 | - ) { |
|
| 205 | - $lang = $GLOBALS['spip_lang']; |
|
| 206 | - $choisie = 'oui'; |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - if (!$lang) { |
|
| 211 | - $choisie = 'non'; |
|
| 212 | - $lang = $lang_rub ?: $GLOBALS['meta']['langue_site']; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $champs = [ |
|
| 216 | - 'id_rubrique' => $id_rubrique, |
|
| 217 | - 'id_secteur' => $id_secteur, |
|
| 218 | - 'statut' => 'prepa', |
|
| 219 | - 'date' => date('Y-m-d H:i:s'), |
|
| 220 | - 'lang' => $lang, |
|
| 221 | - 'langue_choisie' => $choisie |
|
| 222 | - ]; |
|
| 223 | - |
|
| 224 | - if ($set) { |
|
| 225 | - $champs = array_merge($champs, $set); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // Envoyer aux plugins |
|
| 229 | - $champs = pipeline( |
|
| 230 | - 'pre_insertion', |
|
| 231 | - [ |
|
| 232 | - 'args' => [ |
|
| 233 | - 'table' => 'spip_articles', |
|
| 234 | - ], |
|
| 235 | - 'data' => $champs |
|
| 236 | - ] |
|
| 237 | - ); |
|
| 238 | - |
|
| 239 | - $id_article = sql_insertq('spip_articles', $champs); |
|
| 240 | - |
|
| 241 | - // controler si le serveur n'a pas renvoye une erreur |
|
| 242 | - if ($id_article > 0) { |
|
| 243 | - $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 244 | - $GLOBALS['visiteur_session']['id_auteur'] |
|
| 245 | - : _request('id_auteur')); |
|
| 246 | - if ($id_auteur) { |
|
| 247 | - include_spip('action/editer_auteur'); |
|
| 248 | - auteur_associer($id_auteur, ['article' => $id_article]); |
|
| 249 | - } |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - pipeline( |
|
| 253 | - 'post_insertion', |
|
| 254 | - [ |
|
| 255 | - 'args' => [ |
|
| 256 | - 'table' => 'spip_articles', |
|
| 257 | - 'id_objet' => $id_article |
|
| 258 | - ], |
|
| 259 | - 'data' => $champs |
|
| 260 | - ] |
|
| 261 | - ); |
|
| 172 | + // Si id_rubrique vaut 0 ou n'est pas definie, creer l'article |
|
| 173 | + // dans la premiere rubrique racine |
|
| 174 | + if (!$id_rubrique = intval($id_rubrique)) { |
|
| 175 | + $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1'); |
|
| 176 | + $id_rubrique = $row['id_rubrique']; |
|
| 177 | + } else { |
|
| 178 | + $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + // eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue |
|
| 182 | + // cas de id_rubrique = -1 par exemple avec plugin "pages" |
|
| 183 | + $id_secteur = $row['id_secteur'] ?? 0; |
|
| 184 | + $lang_rub = $row['lang'] ?? ''; |
|
| 185 | + |
|
| 186 | + $lang = ''; |
|
| 187 | + $choisie = 'non'; |
|
| 188 | + // La langue a la creation : si les liens de traduction sont autorises |
|
| 189 | + // dans les rubriques, on essaie avec la langue de l'auteur, |
|
| 190 | + // ou a defaut celle de la rubrique |
|
| 191 | + // Sinon c'est la langue de la rubrique qui est choisie + heritee |
|
| 192 | + if ( |
|
| 193 | + !empty($GLOBALS['meta']['multi_objets']) and in_array( |
|
| 194 | + 'spip_articles', |
|
| 195 | + explode(',', $GLOBALS['meta']['multi_objets']) |
|
| 196 | + ) |
|
| 197 | + ) { |
|
| 198 | + lang_select($GLOBALS['visiteur_session']['lang']); |
|
| 199 | + if ( |
|
| 200 | + in_array( |
|
| 201 | + $GLOBALS['spip_lang'], |
|
| 202 | + explode(',', $GLOBALS['meta']['langues_multilingue']) |
|
| 203 | + ) |
|
| 204 | + ) { |
|
| 205 | + $lang = $GLOBALS['spip_lang']; |
|
| 206 | + $choisie = 'oui'; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + if (!$lang) { |
|
| 211 | + $choisie = 'non'; |
|
| 212 | + $lang = $lang_rub ?: $GLOBALS['meta']['langue_site']; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $champs = [ |
|
| 216 | + 'id_rubrique' => $id_rubrique, |
|
| 217 | + 'id_secteur' => $id_secteur, |
|
| 218 | + 'statut' => 'prepa', |
|
| 219 | + 'date' => date('Y-m-d H:i:s'), |
|
| 220 | + 'lang' => $lang, |
|
| 221 | + 'langue_choisie' => $choisie |
|
| 222 | + ]; |
|
| 223 | + |
|
| 224 | + if ($set) { |
|
| 225 | + $champs = array_merge($champs, $set); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // Envoyer aux plugins |
|
| 229 | + $champs = pipeline( |
|
| 230 | + 'pre_insertion', |
|
| 231 | + [ |
|
| 232 | + 'args' => [ |
|
| 233 | + 'table' => 'spip_articles', |
|
| 234 | + ], |
|
| 235 | + 'data' => $champs |
|
| 236 | + ] |
|
| 237 | + ); |
|
| 238 | + |
|
| 239 | + $id_article = sql_insertq('spip_articles', $champs); |
|
| 240 | + |
|
| 241 | + // controler si le serveur n'a pas renvoye une erreur |
|
| 242 | + if ($id_article > 0) { |
|
| 243 | + $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ? |
|
| 244 | + $GLOBALS['visiteur_session']['id_auteur'] |
|
| 245 | + : _request('id_auteur')); |
|
| 246 | + if ($id_auteur) { |
|
| 247 | + include_spip('action/editer_auteur'); |
|
| 248 | + auteur_associer($id_auteur, ['article' => $id_article]); |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + pipeline( |
|
| 253 | + 'post_insertion', |
|
| 254 | + [ |
|
| 255 | + 'args' => [ |
|
| 256 | + 'table' => 'spip_articles', |
|
| 257 | + 'id_objet' => $id_article |
|
| 258 | + ], |
|
| 259 | + 'data' => $champs |
|
| 260 | + ] |
|
| 261 | + ); |
|
| 262 | 262 | |
| 263 | - // Appeler une notification |
|
| 264 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 265 | - $notifications( |
|
| 266 | - 'article_inserer', |
|
| 267 | - $id_article, |
|
| 268 | - [ |
|
| 269 | - 'id_parent' => $id_rubrique, |
|
| 270 | - 'champs' => $champs, |
|
| 271 | - ] |
|
| 272 | - ); |
|
| 273 | - $notifications( |
|
| 274 | - 'objet_inserer', |
|
| 275 | - $id_article, |
|
| 276 | - [ |
|
| 277 | - 'objet' => 'article', |
|
| 278 | - 'id_objet' => $id_article, |
|
| 279 | - 'id_parent' => $id_rubrique, |
|
| 280 | - 'champs' => $champs, |
|
| 281 | - ] |
|
| 282 | - ); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - return $id_article; |
|
| 263 | + // Appeler une notification |
|
| 264 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 265 | + $notifications( |
|
| 266 | + 'article_inserer', |
|
| 267 | + $id_article, |
|
| 268 | + [ |
|
| 269 | + 'id_parent' => $id_rubrique, |
|
| 270 | + 'champs' => $champs, |
|
| 271 | + ] |
|
| 272 | + ); |
|
| 273 | + $notifications( |
|
| 274 | + 'objet_inserer', |
|
| 275 | + $id_article, |
|
| 276 | + [ |
|
| 277 | + 'objet' => 'article', |
|
| 278 | + 'id_objet' => $id_article, |
|
| 279 | + 'id_parent' => $id_rubrique, |
|
| 280 | + 'champs' => $champs, |
|
| 281 | + ] |
|
| 282 | + ); |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + return $id_article; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -310,153 +310,153 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | function article_instituer($id_article, $c, $calcul_rub = true) { |
| 312 | 312 | |
| 313 | - include_spip('inc/autoriser'); |
|
| 314 | - include_spip('inc/rubriques'); |
|
| 315 | - include_spip('inc/modifier'); |
|
| 316 | - |
|
| 317 | - $row = sql_fetsel('statut, date, id_rubrique', 'spip_articles', "id_article=$id_article"); |
|
| 318 | - $id_rubrique = $row['id_rubrique']; |
|
| 319 | - $statut_ancien = $statut = $row['statut']; |
|
| 320 | - $date_ancienne = $date = $row['date']; |
|
| 321 | - $champs = []; |
|
| 322 | - |
|
| 323 | - $d = $c['date'] ?? null; |
|
| 324 | - $s = $c['statut'] ?? $statut; |
|
| 325 | - |
|
| 326 | - // cf autorisations dans inc/instituer_article |
|
| 327 | - if ($s != $statut or ($d and $d != $date)) { |
|
| 328 | - if (autoriser('publierdans', 'rubrique', $id_rubrique)) { |
|
| 329 | - $statut = $champs['statut'] = $s; |
|
| 330 | - } elseif (autoriser('modifier', 'article', $id_article) and $s != 'publie') { |
|
| 331 | - $statut = $champs['statut'] = $s; |
|
| 332 | - } else { |
|
| 333 | - spip_log("editer_article $id_article refus " . join(' ', $c)); |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - // En cas de publication, fixer la date a "maintenant" |
|
| 337 | - // sauf si $c commande autre chose |
|
| 338 | - // ou si l'article est deja date dans le futur |
|
| 339 | - // En cas de proposition d'un article (mais pas depublication), idem |
|
| 340 | - if ( |
|
| 341 | - $champs['statut'] == 'publie' |
|
| 342 | - or ($champs['statut'] == 'prop' and ($d or !in_array($statut_ancien, ['publie', 'prop']))) |
|
| 343 | - ) { |
|
| 344 | - if ($d or strtotime($d = $date) > time()) { |
|
| 345 | - $champs['date'] = $date = $d; |
|
| 346 | - } else { |
|
| 347 | - $champs['date'] = $date = date('Y-m-d H:i:s'); |
|
| 348 | - } |
|
| 349 | - } |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - // Verifier que la rubrique demandee existe et est differente |
|
| 353 | - // de la rubrique actuelle |
|
| 354 | - if ( |
|
| 355 | - isset($c['id_parent']) |
|
| 356 | - and $id_parent = $c['id_parent'] |
|
| 357 | - and $id_parent != $id_rubrique |
|
| 358 | - and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 359 | - ) { |
|
| 360 | - $champs['id_rubrique'] = $id_parent; |
|
| 361 | - |
|
| 362 | - // si l'article etait publie |
|
| 363 | - // et que le demandeur n'est pas admin de la rubrique de destination |
|
| 364 | - // repasser l'article en statut 'propose'. |
|
| 365 | - if ( |
|
| 366 | - $statut == 'publie' |
|
| 367 | - and !autoriser('publierdans', 'rubrique', $id_parent) |
|
| 368 | - ) { |
|
| 369 | - $champs['statut'] = 'prop'; |
|
| 370 | - } |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - // Envoyer aux plugins |
|
| 374 | - $champs = pipeline( |
|
| 375 | - 'pre_edition', |
|
| 376 | - [ |
|
| 377 | - 'args' => [ |
|
| 378 | - 'table' => 'spip_articles', |
|
| 379 | - 'id_objet' => $id_article, |
|
| 380 | - 'action' => 'instituer', |
|
| 381 | - 'statut_ancien' => $statut_ancien, |
|
| 382 | - 'date_ancienne' => $date_ancienne, |
|
| 383 | - ], |
|
| 384 | - 'data' => $champs |
|
| 385 | - ] |
|
| 386 | - ); |
|
| 387 | - |
|
| 388 | - if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 389 | - return ''; |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - // Envoyer les modifs. |
|
| 393 | - editer_article_heritage($id_article, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 394 | - |
|
| 395 | - // Invalider les caches |
|
| 396 | - include_spip('inc/invalideur'); |
|
| 397 | - suivre_invalideur("id='article/$id_article'"); |
|
| 398 | - |
|
| 399 | - if ($date) { |
|
| 400 | - $t = strtotime($date); |
|
| 401 | - $p = @$GLOBALS['meta']['date_prochain_postdate']; |
|
| 402 | - if ($t > time() and (!$p or ($t < $p))) { |
|
| 403 | - ecrire_meta('date_prochain_postdate', $t); |
|
| 404 | - } |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - // Pipeline |
|
| 408 | - pipeline( |
|
| 409 | - 'post_edition', |
|
| 410 | - [ |
|
| 411 | - 'args' => [ |
|
| 412 | - 'table' => 'spip_articles', |
|
| 413 | - 'id_objet' => $id_article, |
|
| 414 | - 'action' => 'instituer', |
|
| 415 | - 'statut_ancien' => $statut_ancien, |
|
| 416 | - 'date_ancienne' => $date_ancienne, |
|
| 417 | - ], |
|
| 418 | - 'data' => $champs |
|
| 419 | - ] |
|
| 420 | - ); |
|
| 421 | - |
|
| 422 | - // Notifications |
|
| 423 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 424 | - $notifications( |
|
| 425 | - 'article_instituer', |
|
| 426 | - $id_article, |
|
| 427 | - [ |
|
| 428 | - 'statut' => $statut, |
|
| 429 | - 'statut_ancien' => $statut_ancien, |
|
| 430 | - 'date' => $date, |
|
| 431 | - 'date_ancienne' => $date_ancienne, |
|
| 432 | - 'id_parent_ancien' => $id_rubrique, |
|
| 433 | - 'champs' => $champs, |
|
| 434 | - ] |
|
| 435 | - ); |
|
| 436 | - $notifications( |
|
| 437 | - 'objet_instituer', |
|
| 438 | - $id_article, |
|
| 439 | - [ |
|
| 440 | - 'objet' => 'article', |
|
| 441 | - 'id_objet' => $id_article, |
|
| 442 | - 'statut' => $statut, |
|
| 443 | - 'statut_ancien' => $statut_ancien, |
|
| 444 | - 'date' => $date, |
|
| 445 | - 'date_ancienne' => $date_ancienne, |
|
| 446 | - 'id_parent_ancien' => $id_rubrique, |
|
| 447 | - 'champs' => $champs, |
|
| 448 | - ] |
|
| 449 | - ); |
|
| 313 | + include_spip('inc/autoriser'); |
|
| 314 | + include_spip('inc/rubriques'); |
|
| 315 | + include_spip('inc/modifier'); |
|
| 316 | + |
|
| 317 | + $row = sql_fetsel('statut, date, id_rubrique', 'spip_articles', "id_article=$id_article"); |
|
| 318 | + $id_rubrique = $row['id_rubrique']; |
|
| 319 | + $statut_ancien = $statut = $row['statut']; |
|
| 320 | + $date_ancienne = $date = $row['date']; |
|
| 321 | + $champs = []; |
|
| 322 | + |
|
| 323 | + $d = $c['date'] ?? null; |
|
| 324 | + $s = $c['statut'] ?? $statut; |
|
| 325 | + |
|
| 326 | + // cf autorisations dans inc/instituer_article |
|
| 327 | + if ($s != $statut or ($d and $d != $date)) { |
|
| 328 | + if (autoriser('publierdans', 'rubrique', $id_rubrique)) { |
|
| 329 | + $statut = $champs['statut'] = $s; |
|
| 330 | + } elseif (autoriser('modifier', 'article', $id_article) and $s != 'publie') { |
|
| 331 | + $statut = $champs['statut'] = $s; |
|
| 332 | + } else { |
|
| 333 | + spip_log("editer_article $id_article refus " . join(' ', $c)); |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + // En cas de publication, fixer la date a "maintenant" |
|
| 337 | + // sauf si $c commande autre chose |
|
| 338 | + // ou si l'article est deja date dans le futur |
|
| 339 | + // En cas de proposition d'un article (mais pas depublication), idem |
|
| 340 | + if ( |
|
| 341 | + $champs['statut'] == 'publie' |
|
| 342 | + or ($champs['statut'] == 'prop' and ($d or !in_array($statut_ancien, ['publie', 'prop']))) |
|
| 343 | + ) { |
|
| 344 | + if ($d or strtotime($d = $date) > time()) { |
|
| 345 | + $champs['date'] = $date = $d; |
|
| 346 | + } else { |
|
| 347 | + $champs['date'] = $date = date('Y-m-d H:i:s'); |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + // Verifier que la rubrique demandee existe et est differente |
|
| 353 | + // de la rubrique actuelle |
|
| 354 | + if ( |
|
| 355 | + isset($c['id_parent']) |
|
| 356 | + and $id_parent = $c['id_parent'] |
|
| 357 | + and $id_parent != $id_rubrique |
|
| 358 | + and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent))) |
|
| 359 | + ) { |
|
| 360 | + $champs['id_rubrique'] = $id_parent; |
|
| 361 | + |
|
| 362 | + // si l'article etait publie |
|
| 363 | + // et que le demandeur n'est pas admin de la rubrique de destination |
|
| 364 | + // repasser l'article en statut 'propose'. |
|
| 365 | + if ( |
|
| 366 | + $statut == 'publie' |
|
| 367 | + and !autoriser('publierdans', 'rubrique', $id_parent) |
|
| 368 | + ) { |
|
| 369 | + $champs['statut'] = 'prop'; |
|
| 370 | + } |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + // Envoyer aux plugins |
|
| 374 | + $champs = pipeline( |
|
| 375 | + 'pre_edition', |
|
| 376 | + [ |
|
| 377 | + 'args' => [ |
|
| 378 | + 'table' => 'spip_articles', |
|
| 379 | + 'id_objet' => $id_article, |
|
| 380 | + 'action' => 'instituer', |
|
| 381 | + 'statut_ancien' => $statut_ancien, |
|
| 382 | + 'date_ancienne' => $date_ancienne, |
|
| 383 | + ], |
|
| 384 | + 'data' => $champs |
|
| 385 | + ] |
|
| 386 | + ); |
|
| 387 | + |
|
| 388 | + if (!(is_countable($champs) ? count($champs) : 0)) { |
|
| 389 | + return ''; |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + // Envoyer les modifs. |
|
| 393 | + editer_article_heritage($id_article, $id_rubrique, $statut_ancien, $champs, $calcul_rub); |
|
| 394 | + |
|
| 395 | + // Invalider les caches |
|
| 396 | + include_spip('inc/invalideur'); |
|
| 397 | + suivre_invalideur("id='article/$id_article'"); |
|
| 398 | + |
|
| 399 | + if ($date) { |
|
| 400 | + $t = strtotime($date); |
|
| 401 | + $p = @$GLOBALS['meta']['date_prochain_postdate']; |
|
| 402 | + if ($t > time() and (!$p or ($t < $p))) { |
|
| 403 | + ecrire_meta('date_prochain_postdate', $t); |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + // Pipeline |
|
| 408 | + pipeline( |
|
| 409 | + 'post_edition', |
|
| 410 | + [ |
|
| 411 | + 'args' => [ |
|
| 412 | + 'table' => 'spip_articles', |
|
| 413 | + 'id_objet' => $id_article, |
|
| 414 | + 'action' => 'instituer', |
|
| 415 | + 'statut_ancien' => $statut_ancien, |
|
| 416 | + 'date_ancienne' => $date_ancienne, |
|
| 417 | + ], |
|
| 418 | + 'data' => $champs |
|
| 419 | + ] |
|
| 420 | + ); |
|
| 421 | + |
|
| 422 | + // Notifications |
|
| 423 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 424 | + $notifications( |
|
| 425 | + 'article_instituer', |
|
| 426 | + $id_article, |
|
| 427 | + [ |
|
| 428 | + 'statut' => $statut, |
|
| 429 | + 'statut_ancien' => $statut_ancien, |
|
| 430 | + 'date' => $date, |
|
| 431 | + 'date_ancienne' => $date_ancienne, |
|
| 432 | + 'id_parent_ancien' => $id_rubrique, |
|
| 433 | + 'champs' => $champs, |
|
| 434 | + ] |
|
| 435 | + ); |
|
| 436 | + $notifications( |
|
| 437 | + 'objet_instituer', |
|
| 438 | + $id_article, |
|
| 439 | + [ |
|
| 440 | + 'objet' => 'article', |
|
| 441 | + 'id_objet' => $id_article, |
|
| 442 | + 'statut' => $statut, |
|
| 443 | + 'statut_ancien' => $statut_ancien, |
|
| 444 | + 'date' => $date, |
|
| 445 | + 'date_ancienne' => $date_ancienne, |
|
| 446 | + 'id_parent_ancien' => $id_rubrique, |
|
| 447 | + 'champs' => $champs, |
|
| 448 | + ] |
|
| 449 | + ); |
|
| 450 | 450 | |
| 451 | - // Rétro-compat |
|
| 452 | - $notifications( |
|
| 453 | - 'instituerarticle', |
|
| 454 | - $id_article, |
|
| 455 | - ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 456 | - ); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - return ''; // pas d'erreur |
|
| 451 | + // Rétro-compat |
|
| 452 | + $notifications( |
|
| 453 | + 'instituerarticle', |
|
| 454 | + $id_article, |
|
| 455 | + ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne] |
|
| 456 | + ); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + return ''; // pas d'erreur |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -481,37 +481,37 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | function editer_article_heritage($id_article, $id_rubrique, $statut, $champs, $cond = true) { |
| 483 | 483 | |
| 484 | - // Si on deplace l'article |
|
| 485 | - // changer aussi son secteur et sa langue (si heritee) |
|
| 486 | - if (isset($champs['id_rubrique'])) { |
|
| 487 | - $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 488 | - |
|
| 489 | - $langue = $row_rub['lang']; |
|
| 490 | - $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 491 | - if ( |
|
| 492 | - sql_fetsel( |
|
| 493 | - '1', |
|
| 494 | - 'spip_articles', |
|
| 495 | - 'id_article=' . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 496 | - ) |
|
| 497 | - ) { |
|
| 498 | - $champs['lang'] = $langue; |
|
| 499 | - } |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - if (!$champs) { |
|
| 503 | - return; |
|
| 504 | - } |
|
| 505 | - |
|
| 506 | - sql_updateq('spip_articles', $champs, 'id_article=' . intval($id_article)); |
|
| 507 | - |
|
| 508 | - // Changer le statut des rubriques concernees |
|
| 509 | - |
|
| 510 | - if ($cond) { |
|
| 511 | - include_spip('inc/rubriques'); |
|
| 512 | - $postdate = ($GLOBALS['meta']['post_dates'] == 'non' and isset($champs['date']) and (strtotime($champs['date']) < time())) ? $champs['date'] : false; |
|
| 513 | - calculer_rubriques_if($id_rubrique, $champs, ['statut_ancien' => $statut], $postdate); |
|
| 514 | - } |
|
| 484 | + // Si on deplace l'article |
|
| 485 | + // changer aussi son secteur et sa langue (si heritee) |
|
| 486 | + if (isset($champs['id_rubrique'])) { |
|
| 487 | + $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique'])); |
|
| 488 | + |
|
| 489 | + $langue = $row_rub['lang']; |
|
| 490 | + $champs['id_secteur'] = $row_rub['id_secteur']; |
|
| 491 | + if ( |
|
| 492 | + sql_fetsel( |
|
| 493 | + '1', |
|
| 494 | + 'spip_articles', |
|
| 495 | + 'id_article=' . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue) |
|
| 496 | + ) |
|
| 497 | + ) { |
|
| 498 | + $champs['lang'] = $langue; |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + if (!$champs) { |
|
| 503 | + return; |
|
| 504 | + } |
|
| 505 | + |
|
| 506 | + sql_updateq('spip_articles', $champs, 'id_article=' . intval($id_article)); |
|
| 507 | + |
|
| 508 | + // Changer le statut des rubriques concernees |
|
| 509 | + |
|
| 510 | + if ($cond) { |
|
| 511 | + include_spip('inc/rubriques'); |
|
| 512 | + $postdate = ($GLOBALS['meta']['post_dates'] == 'non' and isset($champs['date']) and (strtotime($champs['date']) < time())) ? $champs['date'] : false; |
|
| 513 | + calculer_rubriques_if($id_rubrique, $champs, ['statut_ancien' => $statut], $postdate); |
|
| 514 | + } |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -520,10 +520,10 @@ discard block |
||
| 520 | 520 | * @return void |
| 521 | 521 | */ |
| 522 | 522 | function trop_longs_articles() { |
| 523 | - if (is_array($plus = _request('texte_plus'))) { |
|
| 524 | - foreach ($plus as $n => $t) { |
|
| 525 | - $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", '', $t); |
|
| 526 | - } |
|
| 527 | - set_request('texte', join('', $plus) . _request('texte')); |
|
| 528 | - } |
|
| 523 | + if (is_array($plus = _request('texte_plus'))) { |
|
| 524 | + foreach ($plus as $n => $t) { |
|
| 525 | + $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", '', $t); |
|
| 526 | + } |
|
| 527 | + set_request('texte', join('', $plus) . _request('texte')); |
|
| 528 | + } |
|
| 529 | 529 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $credentials_ldap = ['ldap_dn' => $dn, 'ldap_password' => $pass]; |
| 69 | 69 | |
| 70 | 70 | // Si l'utilisateur figure deja dans la base, y recuperer les infos |
| 71 | - $r = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login) . " AND source='ldap'", '', '', '', '', $serveur); |
|
| 71 | + $r = sql_fetsel('*', 'spip_auteurs', 'login='.sql_quote($login)." AND source='ldap'", '', '', '', '', $serveur); |
|
| 72 | 72 | |
| 73 | 73 | if ($r) { |
| 74 | 74 | return array_merge($r, $credentials_ldap); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($r) { |
| 93 | 93 | return array_merge( |
| 94 | 94 | $credentials_ldap, |
| 95 | - sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . intval($r), '', '', '', '', $serveur) |
|
| 95 | + sql_fetsel('*', 'spip_auteurs', 'id_auteur='.intval($r), '', '', '', '', $serveur) |
|
| 96 | 96 | ); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $connexion = spip_connect($serveur); |
| 122 | 122 | if (!is_array($connexion['ldap'])) { |
| 123 | 123 | if ($connexion['authentification']['ldap']) { |
| 124 | - $f = _DIR_CONNECT . $connexion['authentification']['ldap']; |
|
| 124 | + $f = _DIR_CONNECT.$connexion['authentification']['ldap']; |
|
| 125 | 125 | unset($GLOBALS['ldap_link']); |
| 126 | 126 | if (is_readable($f)) { |
| 127 | 127 | include_once($f); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | if (!ldap_bind($link, $dn, session_get('ldap_password'))) { |
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | - $encoded_pass = '{MD5}' . base64_encode(pack('H*', md5($new_pass))); |
|
| 337 | + $encoded_pass = '{MD5}'.base64_encode(pack('H*', md5($new_pass))); |
|
| 338 | 338 | $success = ldap_mod_replace($link, $dn, ['userPassword' => $encoded_pass]); |
| 339 | 339 | |
| 340 | 340 | return $success; |
@@ -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 | // Authentifie via LDAP et retourne la ligne SQL decrivant l'utilisateur si ok |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | // Attributs LDAP correspondants a ceux de SPIP, notamment pour le login |
| 26 | 26 | // ne pas ecraser une definition perso dans mes_options |
| 27 | 27 | if (!isset($GLOBALS['ldap_attributes']) or !is_array($GLOBALS['ldap_attributes'])) { |
| 28 | - $GLOBALS['ldap_attributes'] = [ |
|
| 29 | - 'login' => ['sAMAccountName', 'uid', 'login', 'userid', 'cn', 'sn'], |
|
| 30 | - 'nom' => 'cn', |
|
| 31 | - 'email' => 'mail', |
|
| 32 | - 'bio' => 'description' |
|
| 33 | - ]; |
|
| 28 | + $GLOBALS['ldap_attributes'] = [ |
|
| 29 | + 'login' => ['sAMAccountName', 'uid', 'login', 'userid', 'cn', 'sn'], |
|
| 30 | + 'nom' => 'cn', |
|
| 31 | + 'email' => 'mail', |
|
| 32 | + 'bio' => 'description' |
|
| 33 | + ]; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -56,50 +56,50 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | function auth_ldap_dist($login, $pass, $serveur = '', $phpauth = false) { |
| 58 | 58 | |
| 59 | - #spip_log("ldap $login " . ($pass ? "mdp fourni" : "mdp absent")); |
|
| 60 | - |
|
| 61 | - // Utilisateur connu ? |
|
| 62 | - // si http auth, inutile de reauthentifier: cela |
|
| 63 | - // ne marchera pas avec auth http autre que basic. |
|
| 64 | - $checkpass = isset($_SERVER['REMOTE_USER']) ? false : true; |
|
| 65 | - if (!($dn = auth_ldap_search($login, $pass, $checkpass, $serveur))) { |
|
| 66 | - return []; |
|
| 67 | - } |
|
| 68 | - $credentials_ldap = ['ldap_dn' => $dn, 'ldap_password' => $pass]; |
|
| 69 | - |
|
| 70 | - // Si l'utilisateur figure deja dans la base, y recuperer les infos |
|
| 71 | - $r = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login) . " AND source='ldap'", '', '', '', '', $serveur); |
|
| 72 | - |
|
| 73 | - if ($r) { |
|
| 74 | - return array_merge($r, $credentials_ldap); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - // sinon importer les infos depuis LDAP, |
|
| 78 | - |
|
| 79 | - if ( |
|
| 80 | - $GLOBALS['meta']['ldap_statut_import'] |
|
| 81 | - and $desc = auth_ldap_retrouver($dn, [], $serveur) |
|
| 82 | - ) { |
|
| 83 | - // rajouter le statut indique a l'install |
|
| 84 | - $desc['statut'] = $GLOBALS['meta']['ldap_statut_import']; |
|
| 85 | - $desc['login'] = $login; |
|
| 86 | - $desc['source'] = 'ldap'; |
|
| 87 | - $desc['pass'] = ''; |
|
| 88 | - |
|
| 89 | - $r = sql_insertq('spip_auteurs', $desc, [], $serveur); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - if ($r) { |
|
| 93 | - return array_merge( |
|
| 94 | - $credentials_ldap, |
|
| 95 | - sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . intval($r), '', '', '', '', $serveur) |
|
| 96 | - ); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - // sinon echec |
|
| 100 | - spip_log("Creation de l'auteur '$login' impossible"); |
|
| 101 | - |
|
| 102 | - return []; |
|
| 59 | + #spip_log("ldap $login " . ($pass ? "mdp fourni" : "mdp absent")); |
|
| 60 | + |
|
| 61 | + // Utilisateur connu ? |
|
| 62 | + // si http auth, inutile de reauthentifier: cela |
|
| 63 | + // ne marchera pas avec auth http autre que basic. |
|
| 64 | + $checkpass = isset($_SERVER['REMOTE_USER']) ? false : true; |
|
| 65 | + if (!($dn = auth_ldap_search($login, $pass, $checkpass, $serveur))) { |
|
| 66 | + return []; |
|
| 67 | + } |
|
| 68 | + $credentials_ldap = ['ldap_dn' => $dn, 'ldap_password' => $pass]; |
|
| 69 | + |
|
| 70 | + // Si l'utilisateur figure deja dans la base, y recuperer les infos |
|
| 71 | + $r = sql_fetsel('*', 'spip_auteurs', 'login=' . sql_quote($login) . " AND source='ldap'", '', '', '', '', $serveur); |
|
| 72 | + |
|
| 73 | + if ($r) { |
|
| 74 | + return array_merge($r, $credentials_ldap); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + // sinon importer les infos depuis LDAP, |
|
| 78 | + |
|
| 79 | + if ( |
|
| 80 | + $GLOBALS['meta']['ldap_statut_import'] |
|
| 81 | + and $desc = auth_ldap_retrouver($dn, [], $serveur) |
|
| 82 | + ) { |
|
| 83 | + // rajouter le statut indique a l'install |
|
| 84 | + $desc['statut'] = $GLOBALS['meta']['ldap_statut_import']; |
|
| 85 | + $desc['login'] = $login; |
|
| 86 | + $desc['source'] = 'ldap'; |
|
| 87 | + $desc['pass'] = ''; |
|
| 88 | + |
|
| 89 | + $r = sql_insertq('spip_auteurs', $desc, [], $serveur); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + if ($r) { |
|
| 93 | + return array_merge( |
|
| 94 | + $credentials_ldap, |
|
| 95 | + sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . intval($r), '', '', '', '', $serveur) |
|
| 96 | + ); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + // sinon echec |
|
| 100 | + spip_log("Creation de l'auteur '$login' impossible"); |
|
| 101 | + |
|
| 102 | + return []; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -113,36 +113,36 @@ discard block |
||
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | 115 | function auth_ldap_connect($serveur = '') { |
| 116 | - include_spip('base/connect_sql'); |
|
| 117 | - static $connexions_ldap = []; |
|
| 118 | - if (isset($connexions_ldap[$serveur])) { |
|
| 119 | - return $connexions_ldap[$serveur]; |
|
| 120 | - } |
|
| 121 | - $connexion = spip_connect($serveur); |
|
| 122 | - if (!is_array($connexion['ldap'])) { |
|
| 123 | - if ($connexion['authentification']['ldap']) { |
|
| 124 | - $f = _DIR_CONNECT . $connexion['authentification']['ldap']; |
|
| 125 | - unset($GLOBALS['ldap_link']); |
|
| 126 | - if (is_readable($f)) { |
|
| 127 | - include_once($f); |
|
| 128 | - }; |
|
| 129 | - if (isset($GLOBALS['ldap_link'])) { |
|
| 130 | - $connexion['ldap'] = [ |
|
| 131 | - 'link' => $GLOBALS['ldap_link'], |
|
| 132 | - 'base' => $GLOBALS['ldap_base'] |
|
| 133 | - ]; |
|
| 134 | - } else { |
|
| 135 | - spip_log("connection LDAP $serveur mal definie dans $f"); |
|
| 136 | - } |
|
| 137 | - if (isset($GLOBALS['ldap_champs'])) { |
|
| 138 | - $connexion['ldap']['attributes'] = $GLOBALS['ldap_champs']; |
|
| 139 | - } |
|
| 140 | - } else { |
|
| 141 | - spip_log("connection LDAP $serveur inconnue"); |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - return $connexions_ldap[$serveur] = $connexion['ldap']; |
|
| 116 | + include_spip('base/connect_sql'); |
|
| 117 | + static $connexions_ldap = []; |
|
| 118 | + if (isset($connexions_ldap[$serveur])) { |
|
| 119 | + return $connexions_ldap[$serveur]; |
|
| 120 | + } |
|
| 121 | + $connexion = spip_connect($serveur); |
|
| 122 | + if (!is_array($connexion['ldap'])) { |
|
| 123 | + if ($connexion['authentification']['ldap']) { |
|
| 124 | + $f = _DIR_CONNECT . $connexion['authentification']['ldap']; |
|
| 125 | + unset($GLOBALS['ldap_link']); |
|
| 126 | + if (is_readable($f)) { |
|
| 127 | + include_once($f); |
|
| 128 | + }; |
|
| 129 | + if (isset($GLOBALS['ldap_link'])) { |
|
| 130 | + $connexion['ldap'] = [ |
|
| 131 | + 'link' => $GLOBALS['ldap_link'], |
|
| 132 | + 'base' => $GLOBALS['ldap_base'] |
|
| 133 | + ]; |
|
| 134 | + } else { |
|
| 135 | + spip_log("connection LDAP $serveur mal definie dans $f"); |
|
| 136 | + } |
|
| 137 | + if (isset($GLOBALS['ldap_champs'])) { |
|
| 138 | + $connexion['ldap']['attributes'] = $GLOBALS['ldap_champs']; |
|
| 139 | + } |
|
| 140 | + } else { |
|
| 141 | + spip_log("connection LDAP $serveur inconnue"); |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + return $connexions_ldap[$serveur] = $connexion['ldap']; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -156,52 +156,52 @@ discard block |
||
| 156 | 156 | * Le login trouvé ou chaine vide si non trouvé |
| 157 | 157 | */ |
| 158 | 158 | function auth_ldap_search($login, $pass, $checkpass = true, $serveur = '') { |
| 159 | - // Securite anti-injection et contre un serveur LDAP laxiste |
|
| 160 | - $login_search = preg_replace('/[^-@._\s\d\w]/', '', $login); |
|
| 161 | - if (!strlen($login_search) or ($checkpass and !strlen($pass))) { |
|
| 162 | - return ''; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - // verifier la connexion |
|
| 166 | - if (!$ldap = auth_ldap_connect($serveur)) { |
|
| 167 | - return ''; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - $ldap_link = $ldap['link'] ?? null; |
|
| 171 | - $ldap_base = $ldap['base'] ?? null; |
|
| 172 | - $desc = !empty($ldap['attributes']) ? $ldap['attributes'] : $GLOBALS['ldap_attributes']; |
|
| 173 | - |
|
| 174 | - $logins = is_array($desc['login']) ? $desc['login'] : [$desc['login']]; |
|
| 175 | - |
|
| 176 | - // Tenter une recherche pour essayer de retrouver le DN |
|
| 177 | - foreach ($logins as $att) { |
|
| 178 | - $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", ['dn']); |
|
| 179 | - $info = @ldap_get_entries($ldap_link, $result); |
|
| 180 | - // Ne pas accepter les resultats si plus d'une entree |
|
| 181 | - // (on veut un attribut unique) |
|
| 182 | - |
|
| 183 | - if (is_array($info) and $info['count'] == 1) { |
|
| 184 | - $dn = $info[0]['dn']; |
|
| 185 | - if (!$checkpass) { |
|
| 186 | - return $dn; |
|
| 187 | - } |
|
| 188 | - if (@ldap_bind($ldap_link, $dn, $pass)) { |
|
| 189 | - return $dn; |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - if ($checkpass and !isset($dn)) { |
|
| 195 | - // Si echec, essayer de deviner le DN |
|
| 196 | - foreach ($logins as $att) { |
|
| 197 | - $dn = "$att=$login_search, $ldap_base"; |
|
| 198 | - if (@ldap_bind($ldap_link, $dn, $pass)) { |
|
| 199 | - return "$att=$login_search, $ldap_base"; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - return ''; |
|
| 159 | + // Securite anti-injection et contre un serveur LDAP laxiste |
|
| 160 | + $login_search = preg_replace('/[^-@._\s\d\w]/', '', $login); |
|
| 161 | + if (!strlen($login_search) or ($checkpass and !strlen($pass))) { |
|
| 162 | + return ''; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + // verifier la connexion |
|
| 166 | + if (!$ldap = auth_ldap_connect($serveur)) { |
|
| 167 | + return ''; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + $ldap_link = $ldap['link'] ?? null; |
|
| 171 | + $ldap_base = $ldap['base'] ?? null; |
|
| 172 | + $desc = !empty($ldap['attributes']) ? $ldap['attributes'] : $GLOBALS['ldap_attributes']; |
|
| 173 | + |
|
| 174 | + $logins = is_array($desc['login']) ? $desc['login'] : [$desc['login']]; |
|
| 175 | + |
|
| 176 | + // Tenter une recherche pour essayer de retrouver le DN |
|
| 177 | + foreach ($logins as $att) { |
|
| 178 | + $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", ['dn']); |
|
| 179 | + $info = @ldap_get_entries($ldap_link, $result); |
|
| 180 | + // Ne pas accepter les resultats si plus d'une entree |
|
| 181 | + // (on veut un attribut unique) |
|
| 182 | + |
|
| 183 | + if (is_array($info) and $info['count'] == 1) { |
|
| 184 | + $dn = $info[0]['dn']; |
|
| 185 | + if (!$checkpass) { |
|
| 186 | + return $dn; |
|
| 187 | + } |
|
| 188 | + if (@ldap_bind($ldap_link, $dn, $pass)) { |
|
| 189 | + return $dn; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + if ($checkpass and !isset($dn)) { |
|
| 195 | + // Si echec, essayer de deviner le DN |
|
| 196 | + foreach ($logins as $att) { |
|
| 197 | + $dn = "$att=$login_search, $ldap_base"; |
|
| 198 | + if (@ldap_bind($ldap_link, $dn, $pass)) { |
|
| 199 | + return "$att=$login_search, $ldap_base"; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + return ''; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -213,40 +213,40 @@ discard block |
||
| 213 | 213 | * @return array |
| 214 | 214 | */ |
| 215 | 215 | function auth_ldap_retrouver($dn, $desc = [], $serveur = '') { |
| 216 | - // Lire les infos sur l'utilisateur a partir de son DN depuis LDAP |
|
| 216 | + // Lire les infos sur l'utilisateur a partir de son DN depuis LDAP |
|
| 217 | 217 | |
| 218 | - if (!$ldap = auth_ldap_connect($serveur)) { |
|
| 219 | - spip_log("ldap $serveur injoignable"); |
|
| 218 | + if (!$ldap = auth_ldap_connect($serveur)) { |
|
| 219 | + spip_log("ldap $serveur injoignable"); |
|
| 220 | 220 | |
| 221 | - return []; |
|
| 222 | - } |
|
| 221 | + return []; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - $ldap_link = $ldap['link']; |
|
| 225 | - if (!$desc) { |
|
| 226 | - $desc = $ldap['attributes'] ?: $GLOBALS['ldap_attributes']; |
|
| 227 | - unset($desc['login']); |
|
| 228 | - } |
|
| 229 | - $result = @ldap_read($ldap_link, $dn, 'objectClass=*', array_values($desc)); |
|
| 224 | + $ldap_link = $ldap['link']; |
|
| 225 | + if (!$desc) { |
|
| 226 | + $desc = $ldap['attributes'] ?: $GLOBALS['ldap_attributes']; |
|
| 227 | + unset($desc['login']); |
|
| 228 | + } |
|
| 229 | + $result = @ldap_read($ldap_link, $dn, 'objectClass=*', array_values($desc)); |
|
| 230 | 230 | |
| 231 | - if (!$result) { |
|
| 232 | - return []; |
|
| 233 | - } |
|
| 231 | + if (!$result) { |
|
| 232 | + return []; |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - // Recuperer les donnees du premier (unique?) compte de l'auteur |
|
| 236 | - $val = @ldap_get_entries($ldap_link, $result); |
|
| 237 | - if (!is_array($val) or !is_array($val[0])) { |
|
| 238 | - return []; |
|
| 239 | - } |
|
| 240 | - $val = $val[0]; |
|
| 235 | + // Recuperer les donnees du premier (unique?) compte de l'auteur |
|
| 236 | + $val = @ldap_get_entries($ldap_link, $result); |
|
| 237 | + if (!is_array($val) or !is_array($val[0])) { |
|
| 238 | + return []; |
|
| 239 | + } |
|
| 240 | + $val = $val[0]; |
|
| 241 | 241 | |
| 242 | - // Convertir depuis UTF-8 (jeu de caracteres par defaut) |
|
| 243 | - include_spip('inc/charsets'); |
|
| 242 | + // Convertir depuis UTF-8 (jeu de caracteres par defaut) |
|
| 243 | + include_spip('inc/charsets'); |
|
| 244 | 244 | |
| 245 | - foreach ($desc as $k => $v) { |
|
| 246 | - $desc[$k] = importer_charset($val[strtolower($v)][0], 'utf-8'); |
|
| 247 | - } |
|
| 245 | + foreach ($desc as $k => $v) { |
|
| 246 | + $desc[$k] = importer_charset($val[strtolower($v)][0], 'utf-8'); |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - return $desc; |
|
| 249 | + return $desc; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @return string |
| 259 | 259 | */ |
| 260 | 260 | function auth_ldap_retrouver_login($login, $serveur = '') { |
| 261 | - return auth_ldap_search($login, '', false, $serveur) ? $login : ''; |
|
| 261 | + return auth_ldap_search($login, '', false, $serveur) ? $login : ''; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | * Message d'erreur si login non valide, chaîne vide sinon |
| 279 | 279 | */ |
| 280 | 280 | function auth_ldap_verifier_pass($login, $new_pass, $id_auteur = 0, $serveur = '') { |
| 281 | - include_spip('auth/spip'); |
|
| 281 | + include_spip('auth/spip'); |
|
| 282 | 282 | |
| 283 | - return auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur); |
|
| 283 | + return auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * ``` |
| 302 | 302 | */ |
| 303 | 303 | function auth_ldap_autoriser_modifier_pass($serveur = '') { |
| 304 | - return true; |
|
| 304 | + return true; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -319,23 +319,23 @@ discard block |
||
| 319 | 319 | * Informe du succès ou de l'echec du changement du mot de passe |
| 320 | 320 | */ |
| 321 | 321 | function auth_ldap_modifier_pass($login, $new_pass, $id_auteur, $serveur = '') { |
| 322 | - if (is_null($new_pass) or auth_ldap_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') { |
|
| 323 | - return false; |
|
| 324 | - } |
|
| 325 | - if (!$ldap = auth_ldap_connect($serveur)) { |
|
| 326 | - return false; |
|
| 327 | - } |
|
| 328 | - $link = $ldap['link']; |
|
| 329 | - include_spip('inc/session'); |
|
| 330 | - $dn = session_get('ldap_dn'); |
|
| 331 | - if ('' == $dn) { |
|
| 332 | - return false; |
|
| 333 | - } |
|
| 334 | - if (!ldap_bind($link, $dn, session_get('ldap_password'))) { |
|
| 335 | - return false; |
|
| 336 | - } |
|
| 337 | - $encoded_pass = '{MD5}' . base64_encode(pack('H*', md5($new_pass))); |
|
| 338 | - $success = ldap_mod_replace($link, $dn, ['userPassword' => $encoded_pass]); |
|
| 339 | - |
|
| 340 | - return $success; |
|
| 322 | + if (is_null($new_pass) or auth_ldap_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') { |
|
| 323 | + return false; |
|
| 324 | + } |
|
| 325 | + if (!$ldap = auth_ldap_connect($serveur)) { |
|
| 326 | + return false; |
|
| 327 | + } |
|
| 328 | + $link = $ldap['link']; |
|
| 329 | + include_spip('inc/session'); |
|
| 330 | + $dn = session_get('ldap_dn'); |
|
| 331 | + if ('' == $dn) { |
|
| 332 | + return false; |
|
| 333 | + } |
|
| 334 | + if (!ldap_bind($link, $dn, session_get('ldap_password'))) { |
|
| 335 | + return false; |
|
| 336 | + } |
|
| 337 | + $encoded_pass = '{MD5}' . base64_encode(pack('H*', md5($new_pass))); |
|
| 338 | + $success = ldap_mod_replace($link, $dn, ['userPassword' => $encoded_pass]); |
|
| 339 | + |
|
| 340 | + return $success; |
|
| 341 | 341 | } |
@@ -21,193 +21,193 @@ |
||
| 21 | 21 | // par souci de compatiilite). |
| 22 | 22 | |
| 23 | 23 | if (isset($GLOBALS['_INC_PUBLIC']) and $GLOBALS['_INC_PUBLIC']) { |
| 24 | - echo recuperer_fond($fond, $contexte_inclus, [], _request('connect') ?? ''); |
|
| 24 | + echo recuperer_fond($fond, $contexte_inclus, [], _request('connect') ?? ''); |
|
| 25 | 25 | } else { |
| 26 | - $GLOBALS['_INC_PUBLIC'] = 1; |
|
| 27 | - define('_PIPELINE_SUFFIX', test_espace_prive() ? '_prive' : ''); |
|
| 28 | - |
|
| 29 | - // Faut-il initialiser SPIP ? (oui dans le cas general) |
|
| 30 | - if (!defined('_DIR_RESTREINT_ABS')) { |
|
| 31 | - if ( |
|
| 32 | - defined('_DIR_RESTREINT') |
|
| 33 | - and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 34 | - ) { |
|
| 35 | - include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 36 | - } else { |
|
| 37 | - die('inc_version absent ?'); |
|
| 38 | - } |
|
| 39 | - } // $fond defini dans le fichier d'appel ? |
|
| 40 | - |
|
| 41 | - else { |
|
| 42 | - if (isset($fond) and !_request('fond')) { |
|
| 43 | - } // fond demande dans l'url par page=xxxx ? |
|
| 44 | - else { |
|
| 45 | - if (isset($_GET[_SPIP_PAGE])) { |
|
| 46 | - $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 47 | - |
|
| 48 | - // Securite |
|
| 49 | - if ( |
|
| 50 | - strstr($fond, '/') |
|
| 51 | - and !( |
|
| 52 | - isset($GLOBALS['visiteur_session']) // pour eviter d'evaluer la suite pour les anonymes |
|
| 53 | - and include_spip('inc/autoriser') |
|
| 54 | - and autoriser('webmestre')) |
|
| 55 | - ) { |
|
| 56 | - include_spip('inc/minipres'); |
|
| 57 | - echo minipres(); |
|
| 58 | - exit; |
|
| 59 | - } |
|
| 60 | - // l'argument Page a priorite sur l'argument action |
|
| 61 | - // le cas se presente a cause des RewriteRule d'Apache |
|
| 62 | - // qui permettent d'ajouter un argument dans la QueryString |
|
| 63 | - // mais pas d'en retirer un en conservant les autres. |
|
| 64 | - if (isset($_GET['action']) and $_GET['action'] === $fond) { |
|
| 65 | - unset($_GET['action']); |
|
| 66 | - } |
|
| 67 | - # sinon, fond par defaut |
|
| 68 | - } else { |
|
| 69 | - // sinon fond par defaut (cf. assembler.php) |
|
| 70 | - $fond = pipeline('detecter_fond_par_defaut', ''); |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - $tableau_des_temps = []; |
|
| 76 | - |
|
| 77 | - // Particularites de certains squelettes |
|
| 78 | - if ($fond == 'login') { |
|
| 79 | - $forcer_lang = true; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - if ( |
|
| 83 | - isset($forcer_lang) and $forcer_lang and ($forcer_lang !== 'non') |
|
| 84 | - and !_request('action') |
|
| 85 | - and $_SERVER['REQUEST_METHOD'] != 'POST' |
|
| 86 | - ) { |
|
| 87 | - include_spip('inc/lang'); |
|
| 88 | - verifier_lang_url(); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $lang = !isset($_GET['lang']) ? '' : lang_select($_GET['lang']); |
|
| 92 | - |
|
| 93 | - // Charger l'aiguilleur des traitements derogatoires |
|
| 94 | - // (action en base SQL, formulaires CVT, AJax) |
|
| 95 | - if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
|
| 96 | - include_spip('public/aiguiller'); |
|
| 97 | - if ( |
|
| 98 | - // cas des appels actions ?action=xxx |
|
| 99 | - traiter_appels_actions() |
|
| 100 | - or |
|
| 101 | - // cas des hits ajax sur les inclusions ajax |
|
| 102 | - traiter_appels_inclusions_ajax() |
|
| 103 | - or |
|
| 104 | - // cas des formulaires charger/verifier/traiter |
|
| 105 | - traiter_formulaires_dynamiques() |
|
| 106 | - ) { |
|
| 107 | - // lancer les taches sur affichage final, comme le cron |
|
| 108 | - // mais sans rien afficher |
|
| 109 | - $GLOBALS['html'] = false; // ne rien afficher |
|
| 110 | - pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 111 | - exit; // le hit est fini ! |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // Il y a du texte a produire, charger le metteur en page |
|
| 116 | - include_spip('public/assembler'); |
|
| 117 | - $page = assembler($fond, _request('connect') ?? ''); |
|
| 118 | - |
|
| 119 | - if (isset($page['status'])) { |
|
| 120 | - include_spip('inc/headers'); |
|
| 121 | - http_response_code($page['status']); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - // Content-Type ? |
|
| 125 | - if (!isset($page['entetes']['Content-Type'])) { |
|
| 126 | - $charset = $GLOBALS['meta']['charset'] ?? 'utf-8'; |
|
| 127 | - $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 128 | - $html = true; |
|
| 129 | - } else { |
|
| 130 | - $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // Tester si on est admin et il y a des choses supplementaires a dire |
|
| 134 | - // type tableau pour y mettre des choses au besoin. |
|
| 135 | - $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? [1] : []; |
|
| 136 | - |
|
| 137 | - // affiche-t-on les boutons d'administration ? voir f_admin() |
|
| 138 | - $affiche_boutons_admin = ($html and ( |
|
| 139 | - (isset($_COOKIE['spip_admin']) and (!isset($flag_preserver) or !$flag_preserver)) |
|
| 140 | - or ($debug and include_spip('inc/autoriser') and autoriser('debug')) |
|
| 141 | - or (defined('_VAR_PREVIEW') and _VAR_PREVIEW) |
|
| 142 | - )); |
|
| 143 | - |
|
| 144 | - if ($affiche_boutons_admin) { |
|
| 145 | - include_spip('balise/formulaire_admin'); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - // Execution de la page calculee |
|
| 150 | - |
|
| 151 | - // traitements sur les entetes avant envoi |
|
| 152 | - // peut servir pour le plugin de stats |
|
| 153 | - $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - // eval $page et affecte $res |
|
| 157 | - include _ROOT_RESTREINT . 'public/evaluer_page.php'; |
|
| 158 | - envoyer_entetes($page['entetes']); |
|
| 159 | - if ($res === false) { |
|
| 160 | - include_spip('inc/autoriser'); |
|
| 161 | - $err = _T('zbug_erreur_execution_page'); |
|
| 162 | - if (autoriser('webmestre')) { |
|
| 163 | - $err .= "\n<hr />\n" |
|
| 164 | - . highlight_string($page['codephp'], true) |
|
| 165 | - . "\n<hr />\n"; |
|
| 166 | - } |
|
| 167 | - $msg = [$err]; |
|
| 168 | - erreur_squelette($msg); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - // |
|
| 172 | - // Envoyer le resultat apres post-traitements |
|
| 173 | - // |
|
| 174 | - // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
|
| 175 | - // cf. public/assembler.php) |
|
| 176 | - echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | - |
|
| 178 | - if ($lang) { |
|
| 179 | - lang_select(); |
|
| 180 | - } |
|
| 181 | - // l'affichage de la page a pu lever des erreurs (inclusion manquante) |
|
| 182 | - // il faut tester a nouveau |
|
| 183 | - $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? [1] : []; |
|
| 184 | - |
|
| 185 | - // Appel au debusqueur en cas d'erreurs ou de demande de trace |
|
| 186 | - // at last |
|
| 187 | - if ($debug) { |
|
| 188 | - // en cas d'erreur, retester l'affichage |
|
| 189 | - if ($html and ($affiche_boutons_admin or $debug)) { |
|
| 190 | - $var_mode_affiche = _request('var_mode_affiche'); |
|
| 191 | - $var_mode_objet = _request('var_mode_objet'); |
|
| 192 | - $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ''); |
|
| 193 | - echo erreur_squelette(false); |
|
| 194 | - } |
|
| 195 | - } else { |
|
| 196 | - if ( |
|
| 197 | - isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 198 | - and $GLOBALS['meta']['date_prochain_postdate'] <= time() |
|
| 199 | - ) { |
|
| 200 | - include_spip('inc/rubriques'); |
|
| 201 | - calculer_prochain_postdate(true); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - // Effectuer une tache de fond ? |
|
| 205 | - // si _DIRECT_CRON_FORCE est present, on force l'appel |
|
| 206 | - if (defined('_DIRECT_CRON_FORCE')) { |
|
| 207 | - cron(); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - // sauver le cache chemin si necessaire |
|
| 211 | - save_path_cache(); |
|
| 212 | - } |
|
| 26 | + $GLOBALS['_INC_PUBLIC'] = 1; |
|
| 27 | + define('_PIPELINE_SUFFIX', test_espace_prive() ? '_prive' : ''); |
|
| 28 | + |
|
| 29 | + // Faut-il initialiser SPIP ? (oui dans le cas general) |
|
| 30 | + if (!defined('_DIR_RESTREINT_ABS')) { |
|
| 31 | + if ( |
|
| 32 | + defined('_DIR_RESTREINT') |
|
| 33 | + and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 34 | + ) { |
|
| 35 | + include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 36 | + } else { |
|
| 37 | + die('inc_version absent ?'); |
|
| 38 | + } |
|
| 39 | + } // $fond defini dans le fichier d'appel ? |
|
| 40 | + |
|
| 41 | + else { |
|
| 42 | + if (isset($fond) and !_request('fond')) { |
|
| 43 | + } // fond demande dans l'url par page=xxxx ? |
|
| 44 | + else { |
|
| 45 | + if (isset($_GET[_SPIP_PAGE])) { |
|
| 46 | + $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 47 | + |
|
| 48 | + // Securite |
|
| 49 | + if ( |
|
| 50 | + strstr($fond, '/') |
|
| 51 | + and !( |
|
| 52 | + isset($GLOBALS['visiteur_session']) // pour eviter d'evaluer la suite pour les anonymes |
|
| 53 | + and include_spip('inc/autoriser') |
|
| 54 | + and autoriser('webmestre')) |
|
| 55 | + ) { |
|
| 56 | + include_spip('inc/minipres'); |
|
| 57 | + echo minipres(); |
|
| 58 | + exit; |
|
| 59 | + } |
|
| 60 | + // l'argument Page a priorite sur l'argument action |
|
| 61 | + // le cas se presente a cause des RewriteRule d'Apache |
|
| 62 | + // qui permettent d'ajouter un argument dans la QueryString |
|
| 63 | + // mais pas d'en retirer un en conservant les autres. |
|
| 64 | + if (isset($_GET['action']) and $_GET['action'] === $fond) { |
|
| 65 | + unset($_GET['action']); |
|
| 66 | + } |
|
| 67 | + # sinon, fond par defaut |
|
| 68 | + } else { |
|
| 69 | + // sinon fond par defaut (cf. assembler.php) |
|
| 70 | + $fond = pipeline('detecter_fond_par_defaut', ''); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + $tableau_des_temps = []; |
|
| 76 | + |
|
| 77 | + // Particularites de certains squelettes |
|
| 78 | + if ($fond == 'login') { |
|
| 79 | + $forcer_lang = true; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + if ( |
|
| 83 | + isset($forcer_lang) and $forcer_lang and ($forcer_lang !== 'non') |
|
| 84 | + and !_request('action') |
|
| 85 | + and $_SERVER['REQUEST_METHOD'] != 'POST' |
|
| 86 | + ) { |
|
| 87 | + include_spip('inc/lang'); |
|
| 88 | + verifier_lang_url(); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $lang = !isset($_GET['lang']) ? '' : lang_select($_GET['lang']); |
|
| 92 | + |
|
| 93 | + // Charger l'aiguilleur des traitements derogatoires |
|
| 94 | + // (action en base SQL, formulaires CVT, AJax) |
|
| 95 | + if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
|
| 96 | + include_spip('public/aiguiller'); |
|
| 97 | + if ( |
|
| 98 | + // cas des appels actions ?action=xxx |
|
| 99 | + traiter_appels_actions() |
|
| 100 | + or |
|
| 101 | + // cas des hits ajax sur les inclusions ajax |
|
| 102 | + traiter_appels_inclusions_ajax() |
|
| 103 | + or |
|
| 104 | + // cas des formulaires charger/verifier/traiter |
|
| 105 | + traiter_formulaires_dynamiques() |
|
| 106 | + ) { |
|
| 107 | + // lancer les taches sur affichage final, comme le cron |
|
| 108 | + // mais sans rien afficher |
|
| 109 | + $GLOBALS['html'] = false; // ne rien afficher |
|
| 110 | + pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 111 | + exit; // le hit est fini ! |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // Il y a du texte a produire, charger le metteur en page |
|
| 116 | + include_spip('public/assembler'); |
|
| 117 | + $page = assembler($fond, _request('connect') ?? ''); |
|
| 118 | + |
|
| 119 | + if (isset($page['status'])) { |
|
| 120 | + include_spip('inc/headers'); |
|
| 121 | + http_response_code($page['status']); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + // Content-Type ? |
|
| 125 | + if (!isset($page['entetes']['Content-Type'])) { |
|
| 126 | + $charset = $GLOBALS['meta']['charset'] ?? 'utf-8'; |
|
| 127 | + $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 128 | + $html = true; |
|
| 129 | + } else { |
|
| 130 | + $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // Tester si on est admin et il y a des choses supplementaires a dire |
|
| 134 | + // type tableau pour y mettre des choses au besoin. |
|
| 135 | + $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? [1] : []; |
|
| 136 | + |
|
| 137 | + // affiche-t-on les boutons d'administration ? voir f_admin() |
|
| 138 | + $affiche_boutons_admin = ($html and ( |
|
| 139 | + (isset($_COOKIE['spip_admin']) and (!isset($flag_preserver) or !$flag_preserver)) |
|
| 140 | + or ($debug and include_spip('inc/autoriser') and autoriser('debug')) |
|
| 141 | + or (defined('_VAR_PREVIEW') and _VAR_PREVIEW) |
|
| 142 | + )); |
|
| 143 | + |
|
| 144 | + if ($affiche_boutons_admin) { |
|
| 145 | + include_spip('balise/formulaire_admin'); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + // Execution de la page calculee |
|
| 150 | + |
|
| 151 | + // traitements sur les entetes avant envoi |
|
| 152 | + // peut servir pour le plugin de stats |
|
| 153 | + $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + // eval $page et affecte $res |
|
| 157 | + include _ROOT_RESTREINT . 'public/evaluer_page.php'; |
|
| 158 | + envoyer_entetes($page['entetes']); |
|
| 159 | + if ($res === false) { |
|
| 160 | + include_spip('inc/autoriser'); |
|
| 161 | + $err = _T('zbug_erreur_execution_page'); |
|
| 162 | + if (autoriser('webmestre')) { |
|
| 163 | + $err .= "\n<hr />\n" |
|
| 164 | + . highlight_string($page['codephp'], true) |
|
| 165 | + . "\n<hr />\n"; |
|
| 166 | + } |
|
| 167 | + $msg = [$err]; |
|
| 168 | + erreur_squelette($msg); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + // |
|
| 172 | + // Envoyer le resultat apres post-traitements |
|
| 173 | + // |
|
| 174 | + // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
|
| 175 | + // cf. public/assembler.php) |
|
| 176 | + echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | + |
|
| 178 | + if ($lang) { |
|
| 179 | + lang_select(); |
|
| 180 | + } |
|
| 181 | + // l'affichage de la page a pu lever des erreurs (inclusion manquante) |
|
| 182 | + // il faut tester a nouveau |
|
| 183 | + $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? [1] : []; |
|
| 184 | + |
|
| 185 | + // Appel au debusqueur en cas d'erreurs ou de demande de trace |
|
| 186 | + // at last |
|
| 187 | + if ($debug) { |
|
| 188 | + // en cas d'erreur, retester l'affichage |
|
| 189 | + if ($html and ($affiche_boutons_admin or $debug)) { |
|
| 190 | + $var_mode_affiche = _request('var_mode_affiche'); |
|
| 191 | + $var_mode_objet = _request('var_mode_objet'); |
|
| 192 | + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ''); |
|
| 193 | + echo erreur_squelette(false); |
|
| 194 | + } |
|
| 195 | + } else { |
|
| 196 | + if ( |
|
| 197 | + isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 198 | + and $GLOBALS['meta']['date_prochain_postdate'] <= time() |
|
| 199 | + ) { |
|
| 200 | + include_spip('inc/rubriques'); |
|
| 201 | + calculer_prochain_postdate(true); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + // Effectuer une tache de fond ? |
|
| 205 | + // si _DIRECT_CRON_FORCE est present, on force l'appel |
|
| 206 | + if (defined('_DIRECT_CRON_FORCE')) { |
|
| 207 | + cron(); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + // sauver le cache chemin si necessaire |
|
| 211 | + save_path_cache(); |
|
| 212 | + } |
|
| 213 | 213 | } |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | if (!defined('_DIR_RESTREINT_ABS')) { |
| 31 | 31 | if ( |
| 32 | 32 | defined('_DIR_RESTREINT') |
| 33 | - and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 33 | + and @file_exists(_ROOT_RESTREINT.'inc_version.php') |
|
| 34 | 34 | ) { |
| 35 | - include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 35 | + include_once _ROOT_RESTREINT.'inc_version.php'; |
|
| 36 | 36 | } else { |
| 37 | 37 | die('inc_version absent ?'); |
| 38 | 38 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } // fond demande dans l'url par page=xxxx ? |
| 44 | 44 | else { |
| 45 | 45 | if (isset($_GET[_SPIP_PAGE])) { |
| 46 | - $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 46 | + $fond = (string) $_GET[_SPIP_PAGE]; |
|
| 47 | 47 | |
| 48 | 48 | // Securite |
| 49 | 49 | if ( |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | // lancer les taches sur affichage final, comme le cron |
| 108 | 108 | // mais sans rien afficher |
| 109 | 109 | $GLOBALS['html'] = false; // ne rien afficher |
| 110 | - pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 110 | + pipeline('affichage_final'._PIPELINE_SUFFIX, ''); |
|
| 111 | 111 | exit; // le hit est fini ! |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Content-Type ? |
| 125 | 125 | if (!isset($page['entetes']['Content-Type'])) { |
| 126 | 126 | $charset = $GLOBALS['meta']['charset'] ?? 'utf-8'; |
| 127 | - $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 127 | + $page['entetes']['Content-Type'] = 'text/html; charset='.$charset; |
|
| 128 | 128 | $html = true; |
| 129 | 129 | } else { |
| 130 | 130 | $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | // traitements sur les entetes avant envoi |
| 152 | 152 | // peut servir pour le plugin de stats |
| 153 | - $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 153 | + $page['entetes'] = pipeline('affichage_entetes_final'._PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | // eval $page et affecte $res |
| 157 | - include _ROOT_RESTREINT . 'public/evaluer_page.php'; |
|
| 157 | + include _ROOT_RESTREINT.'public/evaluer_page.php'; |
|
| 158 | 158 | envoyer_entetes($page['entetes']); |
| 159 | 159 | if ($res === false) { |
| 160 | 160 | include_spip('inc/autoriser'); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // |
| 174 | 174 | // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
| 175 | 175 | // cf. public/assembler.php) |
| 176 | - echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 176 | + echo pipeline('affichage_final'._PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | 177 | |
| 178 | 178 | if ($lang) { |
| 179 | 179 | lang_select(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | if ($html and ($affiche_boutons_admin or $debug)) { |
| 190 | 190 | $var_mode_affiche = _request('var_mode_affiche'); |
| 191 | 191 | $var_mode_objet = _request('var_mode_objet'); |
| 192 | - $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ''); |
|
| 192 | + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet.'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ''); |
|
| 193 | 193 | echo erreur_squelette(false); |
| 194 | 194 | } |
| 195 | 195 | } else { |
@@ -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 | |
| 17 | 17 | |
@@ -21,28 +21,28 @@ discard block |
||
| 21 | 21 | * @param array $arbre |
| 22 | 22 | */ |
| 23 | 23 | function plugins_extraire_pipelines_dist(&$arbre) { |
| 24 | - $pipes = null; |
|
| 25 | - $tag = null; |
|
| 26 | - $pipeline = []; |
|
| 27 | - if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 28 | - foreach ($pipes as $tag => $p) { |
|
| 29 | - if (!is_array($p[0])) { |
|
| 30 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 31 | - $pipeline[] = $att; |
|
| 32 | - } else { |
|
| 33 | - foreach ($p as $pipe) { |
|
| 34 | - $att = []; |
|
| 35 | - if (is_array($pipe)) { |
|
| 36 | - foreach ($pipe as $k => $t) { |
|
| 37 | - $att[$k] = trim(end($t)); |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - $pipeline[] = $att; |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - unset($arbre[$tag]); |
|
| 45 | - } |
|
| 24 | + $pipes = null; |
|
| 25 | + $tag = null; |
|
| 26 | + $pipeline = []; |
|
| 27 | + if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 28 | + foreach ($pipes as $tag => $p) { |
|
| 29 | + if (!is_array($p[0])) { |
|
| 30 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 31 | + $pipeline[] = $att; |
|
| 32 | + } else { |
|
| 33 | + foreach ($p as $pipe) { |
|
| 34 | + $att = []; |
|
| 35 | + if (is_array($pipe)) { |
|
| 36 | + foreach ($pipe as $k => $t) { |
|
| 37 | + $att[$k] = trim(end($t)); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + $pipeline[] = $att; |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + unset($arbre[$tag]); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $pipeline; |
|
| 47 | + return $pipeline; |
|
| 48 | 48 | } |