@@ -12,6 +12,9 @@ |
||
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | +/** |
|
| 16 | + * @param integer $version_cible |
|
| 17 | + */ |
|
| 15 | 18 | function v019_pre193($version_installee, $version_cible) |
| 16 | 19 | { |
| 17 | 20 | // Syndication : ajout de l'option resume=oui/non et de la langue |
@@ -14,58 +14,58 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | function v019_pre193($version_installee, $version_cible) |
| 16 | 16 | { |
| 17 | - // Syndication : ajout de l'option resume=oui/non et de la langue |
|
| 18 | - if (upgrade_vers(1.901, $version_installee, $version_cible)) { |
|
| 19 | - spip_query("ALTER TABLE spip_syndic ADD `resume` VARCHAR(3) DEFAULT 'oui'"); |
|
| 20 | - spip_query("ALTER TABLE spip_syndic_articles ADD `lang` VARCHAR(10) DEFAULT '' NOT NULL"); |
|
| 21 | - maj_version(1.901); |
|
| 22 | - } |
|
| 17 | + // Syndication : ajout de l'option resume=oui/non et de la langue |
|
| 18 | + if (upgrade_vers(1.901, $version_installee, $version_cible)) { |
|
| 19 | + spip_query("ALTER TABLE spip_syndic ADD `resume` VARCHAR(3) DEFAULT 'oui'"); |
|
| 20 | + spip_query("ALTER TABLE spip_syndic_articles ADD `lang` VARCHAR(10) DEFAULT '' NOT NULL"); |
|
| 21 | + maj_version(1.901); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - // Syndication : ajout de source, url_source, tags |
|
| 25 | - if (upgrade_vers(1.902, $version_installee, $version_cible)) { |
|
| 26 | - spip_query("ALTER TABLE spip_syndic_articles ADD `url_source` TINYTEXT DEFAULT '' NOT NULL"); |
|
| 27 | - spip_query("ALTER TABLE spip_syndic_articles ADD `source` TINYTEXT DEFAULT '' NOT NULL"); |
|
| 28 | - spip_query("ALTER TABLE spip_syndic_articles ADD `tags` TEXT DEFAULT '' NOT NULL"); |
|
| 29 | - maj_version(1.902); |
|
| 30 | - } |
|
| 24 | + // Syndication : ajout de source, url_source, tags |
|
| 25 | + if (upgrade_vers(1.902, $version_installee, $version_cible)) { |
|
| 26 | + spip_query("ALTER TABLE spip_syndic_articles ADD `url_source` TINYTEXT DEFAULT '' NOT NULL"); |
|
| 27 | + spip_query("ALTER TABLE spip_syndic_articles ADD `source` TINYTEXT DEFAULT '' NOT NULL"); |
|
| 28 | + spip_query("ALTER TABLE spip_syndic_articles ADD `tags` TEXT DEFAULT '' NOT NULL"); |
|
| 29 | + maj_version(1.902); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - // URLs propres des sites (sait-on jamais) |
|
| 33 | - // + oubli des KEY url_propre sur les auteurs si installation neuve |
|
| 34 | - if (upgrade_vers(1.903, $version_installee, $version_cible)) { |
|
| 35 | - spip_query("ALTER TABLE spip_syndic ADD `url_propre` VARCHAR(255) NOT NULL"); |
|
| 36 | - spip_query("ALTER TABLE spip_syndic ADD INDEX `url_propre` (`url_propre`)"); |
|
| 37 | - spip_query("ALTER TABLE spip_auteurs ADD INDEX `url_propre` (`url_propre`)"); |
|
| 38 | - maj_version(1.903); |
|
| 39 | - } |
|
| 32 | + // URLs propres des sites (sait-on jamais) |
|
| 33 | + // + oubli des KEY url_propre sur les auteurs si installation neuve |
|
| 34 | + if (upgrade_vers(1.903, $version_installee, $version_cible)) { |
|
| 35 | + spip_query("ALTER TABLE spip_syndic ADD `url_propre` VARCHAR(255) NOT NULL"); |
|
| 36 | + spip_query("ALTER TABLE spip_syndic ADD INDEX `url_propre` (`url_propre`)"); |
|
| 37 | + spip_query("ALTER TABLE spip_auteurs ADD INDEX `url_propre` (`url_propre`)"); |
|
| 38 | + maj_version(1.903); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - // suppression des anciennes tables temporaires des visites |
|
| 42 | - // (maintenant stockees sous forme de fichiers) |
|
| 43 | - if (upgrade_vers(1.904, $version_installee, $version_cible)) { |
|
| 44 | - spip_query("DROP TABLE IF EXISTS spip_visites_temp"); |
|
| 45 | - spip_query("DROP TABLE IF EXISTS spip_referers_temp"); |
|
| 46 | - maj_version(1.904); |
|
| 47 | - } |
|
| 41 | + // suppression des anciennes tables temporaires des visites |
|
| 42 | + // (maintenant stockees sous forme de fichiers) |
|
| 43 | + if (upgrade_vers(1.904, $version_installee, $version_cible)) { |
|
| 44 | + spip_query("DROP TABLE IF EXISTS spip_visites_temp"); |
|
| 45 | + spip_query("DROP TABLE IF EXISTS spip_referers_temp"); |
|
| 46 | + maj_version(1.904); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - // fusion des 10 tables index en une seule |
|
| 50 | - // pour fonctions futures evoluees du moteur de recherche |
|
| 51 | - if (upgrade_vers(1.905, $version_installee, $version_cible)) { |
|
| 52 | - // agrandir le champ "valeur" de spip_meta pour pouvoir y stocker |
|
| 53 | - // des choses plus sympa |
|
| 54 | - spip_query("ALTER TABLE spip_meta DROP INDEX `valeur`"); |
|
| 55 | - spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT"); |
|
| 56 | - // table des correspondances table->id_table |
|
| 57 | - $liste_tables = array(); |
|
| 58 | - $liste_tables[1]='spip_articles'; |
|
| 59 | - $liste_tables[2]='spip_auteurs'; |
|
| 60 | - $liste_tables[3]='spip_breves'; |
|
| 61 | - $liste_tables[4]='spip_documents'; |
|
| 62 | - $liste_tables[5]='spip_forum'; |
|
| 63 | - $liste_tables[6]='spip_mots'; |
|
| 64 | - $liste_tables[7]='spip_rubriques'; |
|
| 65 | - $liste_tables[8]='spip_signatures'; |
|
| 66 | - $liste_tables[9]='spip_syndic'; |
|
| 49 | + // fusion des 10 tables index en une seule |
|
| 50 | + // pour fonctions futures evoluees du moteur de recherche |
|
| 51 | + if (upgrade_vers(1.905, $version_installee, $version_cible)) { |
|
| 52 | + // agrandir le champ "valeur" de spip_meta pour pouvoir y stocker |
|
| 53 | + // des choses plus sympa |
|
| 54 | + spip_query("ALTER TABLE spip_meta DROP INDEX `valeur`"); |
|
| 55 | + spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT"); |
|
| 56 | + // table des correspondances table->id_table |
|
| 57 | + $liste_tables = array(); |
|
| 58 | + $liste_tables[1]='spip_articles'; |
|
| 59 | + $liste_tables[2]='spip_auteurs'; |
|
| 60 | + $liste_tables[3]='spip_breves'; |
|
| 61 | + $liste_tables[4]='spip_documents'; |
|
| 62 | + $liste_tables[5]='spip_forum'; |
|
| 63 | + $liste_tables[6]='spip_mots'; |
|
| 64 | + $liste_tables[7]='spip_rubriques'; |
|
| 65 | + $liste_tables[8]='spip_signatures'; |
|
| 66 | + $liste_tables[9]='spip_syndic'; |
|
| 67 | 67 | |
| 68 | - ecrire_meta('index_table', serialize($liste_tables)); |
|
| 68 | + ecrire_meta('index_table', serialize($liste_tables)); |
|
| 69 | 69 | |
| 70 | 70 | ## devenu inutile car suppression totale de l'indexation |
| 71 | 71 | /* |
@@ -96,207 +96,207 @@ discard block |
||
| 96 | 96 | spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_syndic` as id_objet,'9' as `id_table FROM spip_index_syndic"); |
| 97 | 97 | spip_query("DROP TABLE IF EXISTS spip_index_syndic"); |
| 98 | 98 | */ |
| 99 | - maj_version(1.905); |
|
| 100 | - } |
|
| 99 | + maj_version(1.905); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | - // cette table est desormais geree par le plugin "podcast_client", on la |
|
| 104 | - // supprime si le plugin n'est pas active ; risque inherent a l'utilisation |
|
| 105 | - // de versions alpha :-) |
|
| 106 | - if (upgrade_vers(1.906, $version_installee, $version_cible)) { |
|
| 107 | - if (!@in_array('podcast_client', $GLOBALS['plugins'])) { |
|
| 108 | - spip_query("DROP TABLE spip_documents_syndic"); |
|
| 109 | - } |
|
| 110 | - maj_version(1.906); |
|
| 111 | - } |
|
| 112 | - if (upgrade_vers(1.907, $version_installee, $version_cible)) { |
|
| 113 | - spip_query("ALTER TABLE spip_forum ADD INDEX `idx` (`idx`)"); |
|
| 114 | - maj_version(1.907); |
|
| 115 | - } |
|
| 116 | - // Oups ! on stockait les tags de syndication sous la forme rel="category" |
|
| 117 | - // au lieu de rel="directory" - http://microformats.org/wiki/rel-directory |
|
| 118 | - if (upgrade_vers(1.908, $version_installee, $version_cible)) { |
|
| 119 | - spip_query("UPDATE spip_syndic_articles SET `tags` = REPLACE(`tags`, 'rel=\"category\">', 'rel=\"directory\">') WHERE `tags` like '%category%'"); |
|
| 120 | - maj_version(1.908); |
|
| 121 | - } |
|
| 122 | - if (upgrade_vers(1.909, $version_installee, $version_cible)) { |
|
| 123 | - spip_query("ALTER IGNORE TABLE spip_mots_articles ADD PRIMARY KEY (`id_article`, `id_mot`)"); |
|
| 124 | - spip_query("ALTER IGNORE TABLE spip_mots_breves ADD PRIMARY KEY (`id_breve`, `id_mot`)"); |
|
| 125 | - spip_query("ALTER IGNORE TABLE spip_mots_rubriques ADD PRIMARY KEY (`id_rubrique`, `id_mot`)"); |
|
| 126 | - spip_query("ALTER IGNORE TABLE spip_mots_syndic ADD PRIMARY KEY (`id_syndic`, `id_mot`)"); |
|
| 127 | - spip_query("ALTER IGNORE TABLE spip_mots_documents ADD PRIMARY KEY (`id_document`, `id_mot`)"); |
|
| 128 | - spip_query("ALTER IGNORE TABLE spip_mots_forum ADD PRIMARY KEY (`id_forum`, `id_mot`)"); |
|
| 129 | - maj_version(1.909); |
|
| 130 | - } |
|
| 103 | + // cette table est desormais geree par le plugin "podcast_client", on la |
|
| 104 | + // supprime si le plugin n'est pas active ; risque inherent a l'utilisation |
|
| 105 | + // de versions alpha :-) |
|
| 106 | + if (upgrade_vers(1.906, $version_installee, $version_cible)) { |
|
| 107 | + if (!@in_array('podcast_client', $GLOBALS['plugins'])) { |
|
| 108 | + spip_query("DROP TABLE spip_documents_syndic"); |
|
| 109 | + } |
|
| 110 | + maj_version(1.906); |
|
| 111 | + } |
|
| 112 | + if (upgrade_vers(1.907, $version_installee, $version_cible)) { |
|
| 113 | + spip_query("ALTER TABLE spip_forum ADD INDEX `idx` (`idx`)"); |
|
| 114 | + maj_version(1.907); |
|
| 115 | + } |
|
| 116 | + // Oups ! on stockait les tags de syndication sous la forme rel="category" |
|
| 117 | + // au lieu de rel="directory" - http://microformats.org/wiki/rel-directory |
|
| 118 | + if (upgrade_vers(1.908, $version_installee, $version_cible)) { |
|
| 119 | + spip_query("UPDATE spip_syndic_articles SET `tags` = REPLACE(`tags`, 'rel=\"category\">', 'rel=\"directory\">') WHERE `tags` like '%category%'"); |
|
| 120 | + maj_version(1.908); |
|
| 121 | + } |
|
| 122 | + if (upgrade_vers(1.909, $version_installee, $version_cible)) { |
|
| 123 | + spip_query("ALTER IGNORE TABLE spip_mots_articles ADD PRIMARY KEY (`id_article`, `id_mot`)"); |
|
| 124 | + spip_query("ALTER IGNORE TABLE spip_mots_breves ADD PRIMARY KEY (`id_breve`, `id_mot`)"); |
|
| 125 | + spip_query("ALTER IGNORE TABLE spip_mots_rubriques ADD PRIMARY KEY (`id_rubrique`, `id_mot`)"); |
|
| 126 | + spip_query("ALTER IGNORE TABLE spip_mots_syndic ADD PRIMARY KEY (`id_syndic`, `id_mot`)"); |
|
| 127 | + spip_query("ALTER IGNORE TABLE spip_mots_documents ADD PRIMARY KEY (`id_document`, `id_mot`)"); |
|
| 128 | + spip_query("ALTER IGNORE TABLE spip_mots_forum ADD PRIMARY KEY (`id_forum`, `id_mot`)"); |
|
| 129 | + maj_version(1.909); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - if (upgrade_vers(1.910, $version_installee, $version_cible)) { |
|
| 133 | - spip_query("ALTER IGNORE TABLE spip_auteurs_articles ADD PRIMARY KEY (`id_auteur`, `id_article`)"); |
|
| 134 | - spip_query("ALTER IGNORE TABLE spip_auteurs_rubriques ADD PRIMARY KEY (`id_auteur`, `id_rubrique`)"); |
|
| 135 | - spip_query("ALTER IGNORE TABLE spip_auteurs_messages ADD PRIMARY KEY (`id_auteur`, `id_message`)"); |
|
| 136 | - maj_version(1.910); |
|
| 137 | - } |
|
| 132 | + if (upgrade_vers(1.910, $version_installee, $version_cible)) { |
|
| 133 | + spip_query("ALTER IGNORE TABLE spip_auteurs_articles ADD PRIMARY KEY (`id_auteur`, `id_article`)"); |
|
| 134 | + spip_query("ALTER IGNORE TABLE spip_auteurs_rubriques ADD PRIMARY KEY (`id_auteur`, `id_rubrique`)"); |
|
| 135 | + spip_query("ALTER IGNORE TABLE spip_auteurs_messages ADD PRIMARY KEY (`id_auteur`, `id_message`)"); |
|
| 136 | + maj_version(1.910); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - if (upgrade_vers(1.911, $version_installee, $version_cible)) { |
|
| 139 | + if (upgrade_vers(1.911, $version_installee, $version_cible)) { |
|
| 140 | 140 | |
| 141 | - spip_query("ALTER IGNORE TABLE spip_auteurs_articles DROP INDEX `id_auteur`"); |
|
| 142 | - spip_query("ALTER IGNORE TABLE spip_auteurs_rubriques DROP INDEX `id_auteur`"); |
|
| 143 | - spip_query("ALTER IGNORE TABLE spip_auteurs_messages DROP INDEX `id_auteur`"); |
|
| 144 | - spip_query("ALTER IGNORE TABLE spip_mots_articles DROP INDEX `id_article`"); |
|
| 145 | - spip_query("ALTER IGNORE TABLE spip_mots_breves DROP INDEX `id_breve`"); |
|
| 146 | - spip_query("ALTER IGNORE TABLE spip_mots_rubriques DROP INDEX `id_rubrique`"); |
|
| 147 | - spip_query("ALTER IGNORE TABLE spip_mots_syndic DROP INDEX `id_syndic`"); |
|
| 148 | - spip_query("ALTER IGNORE TABLE spip_mots_forum DROP INDEX `id_forum`"); |
|
| 149 | - spip_query("ALTER IGNORE TABLE spip_mots_documents DROP INDEX `id_document`"); |
|
| 141 | + spip_query("ALTER IGNORE TABLE spip_auteurs_articles DROP INDEX `id_auteur`"); |
|
| 142 | + spip_query("ALTER IGNORE TABLE spip_auteurs_rubriques DROP INDEX `id_auteur`"); |
|
| 143 | + spip_query("ALTER IGNORE TABLE spip_auteurs_messages DROP INDEX `id_auteur`"); |
|
| 144 | + spip_query("ALTER IGNORE TABLE spip_mots_articles DROP INDEX `id_article`"); |
|
| 145 | + spip_query("ALTER IGNORE TABLE spip_mots_breves DROP INDEX `id_breve`"); |
|
| 146 | + spip_query("ALTER IGNORE TABLE spip_mots_rubriques DROP INDEX `id_rubrique`"); |
|
| 147 | + spip_query("ALTER IGNORE TABLE spip_mots_syndic DROP INDEX `id_syndic`"); |
|
| 148 | + spip_query("ALTER IGNORE TABLE spip_mots_forum DROP INDEX `id_forum`"); |
|
| 149 | + spip_query("ALTER IGNORE TABLE spip_mots_documents DROP INDEX `id_document`"); |
|
| 150 | 150 | # 18 juillet 2007: table depreciee |
| 151 | 151 | # spip_query("ALTER IGNORE TABLE spip_caches DROP INDEX fichier"); |
| 152 | - maj_version(1.911); |
|
| 153 | - } |
|
| 152 | + maj_version(1.911); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - // Le logo du site n'est plus le logo par defaut des rubriques |
|
| 156 | - // mais pour assurer la compatibilite ascendante, on le duplique |
|
| 157 | - if (upgrade_vers(1.912, $version_installee, $version_cible)) { |
|
| 158 | - @copy(_DIR_LOGOS.'rubon0.gif', _DIR_LOGOS.'siteon0.gif'); |
|
| 159 | - @copy(_DIR_LOGOS.'ruboff0.gif', _DIR_LOGOS.'siteoff0.gif'); |
|
| 160 | - @copy(_DIR_LOGOS.'rubon0.jpg', _DIR_LOGOS.'siteon0.jpg'); |
|
| 161 | - @copy(_DIR_LOGOS.'ruboff0.jpg', _DIR_LOGOS.'siteoff0.jpg'); |
|
| 162 | - @copy(_DIR_LOGOS.'rubon0.png', _DIR_LOGOS.'siteon0.png'); |
|
| 163 | - @copy(_DIR_LOGOS.'ruboff0.png', _DIR_LOGOS.'siteoff0.png'); |
|
| 164 | - maj_version(1.912); |
|
| 165 | - } |
|
| 155 | + // Le logo du site n'est plus le logo par defaut des rubriques |
|
| 156 | + // mais pour assurer la compatibilite ascendante, on le duplique |
|
| 157 | + if (upgrade_vers(1.912, $version_installee, $version_cible)) { |
|
| 158 | + @copy(_DIR_LOGOS.'rubon0.gif', _DIR_LOGOS.'siteon0.gif'); |
|
| 159 | + @copy(_DIR_LOGOS.'ruboff0.gif', _DIR_LOGOS.'siteoff0.gif'); |
|
| 160 | + @copy(_DIR_LOGOS.'rubon0.jpg', _DIR_LOGOS.'siteon0.jpg'); |
|
| 161 | + @copy(_DIR_LOGOS.'ruboff0.jpg', _DIR_LOGOS.'siteoff0.jpg'); |
|
| 162 | + @copy(_DIR_LOGOS.'rubon0.png', _DIR_LOGOS.'siteon0.png'); |
|
| 163 | + @copy(_DIR_LOGOS.'ruboff0.png', _DIR_LOGOS.'siteoff0.png'); |
|
| 164 | + maj_version(1.912); |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | - // suppression de auteur_modif qui n'est plus utilise nulle part |
|
| 168 | - if (upgrade_vers(1.913, $version_installee, $version_cible)) { |
|
| 169 | - spip_query("ALTER TABLE spip_articles DROP `auteur_modif`"); |
|
| 170 | - maj_version(1.913); |
|
| 171 | - } |
|
| 167 | + // suppression de auteur_modif qui n'est plus utilise nulle part |
|
| 168 | + if (upgrade_vers(1.913, $version_installee, $version_cible)) { |
|
| 169 | + spip_query("ALTER TABLE spip_articles DROP `auteur_modif`"); |
|
| 170 | + maj_version(1.913); |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - // Ajout de SVG |
|
| 174 | - if (upgrade_vers(1.914, $version_installee, $version_cible)) { |
|
| 175 | - spip_query("INSERT IGNORE INTO spip_types_documents (`extension`, `titre`, `inclus`) VALUES ('svg', 'Scalable Vector Graphics', 'embed')"); |
|
| 176 | - spip_query("UPDATE spip_types_documents SET `mime_type`='image/svg+xml' WHERE `extension`='svg'"); |
|
| 177 | - maj_version(1.914); |
|
| 178 | - } |
|
| 173 | + // Ajout de SVG |
|
| 174 | + if (upgrade_vers(1.914, $version_installee, $version_cible)) { |
|
| 175 | + spip_query("INSERT IGNORE INTO spip_types_documents (`extension`, `titre`, `inclus`) VALUES ('svg', 'Scalable Vector Graphics', 'embed')"); |
|
| 176 | + spip_query("UPDATE spip_types_documents SET `mime_type`='image/svg+xml' WHERE `extension`='svg'"); |
|
| 177 | + maj_version(1.914); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - // Ajout de plein de type mime |
|
| 181 | - if (upgrade_vers(1.915, $version_installee, $version_cible)) { |
|
| 182 | - maj_version(1.915); |
|
| 183 | - } |
|
| 184 | - // refaire l'upgrade 1.905 qui a pu foirer en partie a cause de la requete ALTER sur spip_meta |
|
| 185 | - if (upgrade_vers(1.916, $version_installee, $version_cible)) { |
|
| 186 | - // agrandir le champ "valeur" de spip_meta pour pouvoir y stocker |
|
| 187 | - // des choses plus sympa |
|
| 188 | - spip_query("ALTER TABLE spip_meta DROP INDEX `valeur`"); |
|
| 189 | - spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT"); |
|
| 180 | + // Ajout de plein de type mime |
|
| 181 | + if (upgrade_vers(1.915, $version_installee, $version_cible)) { |
|
| 182 | + maj_version(1.915); |
|
| 183 | + } |
|
| 184 | + // refaire l'upgrade 1.905 qui a pu foirer en partie a cause de la requete ALTER sur spip_meta |
|
| 185 | + if (upgrade_vers(1.916, $version_installee, $version_cible)) { |
|
| 186 | + // agrandir le champ "valeur" de spip_meta pour pouvoir y stocker |
|
| 187 | + // des choses plus sympa |
|
| 188 | + spip_query("ALTER TABLE spip_meta DROP INDEX `valeur`"); |
|
| 189 | + spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT"); |
|
| 190 | 190 | #8/08/07 plus d'indexation dans le core |
| 191 | - //include_spip('inc/indexation'); |
|
| 192 | - //update_index_tables(); |
|
| 193 | - maj_version(1.916); |
|
| 194 | - } |
|
| 195 | - if (upgrade_vers(1.917, $version_installee, $version_cible)) { |
|
| 196 | - spip_query("ALTER TABLE spip_documents DROP `inclus`"); |
|
| 197 | - maj_version(1.917); |
|
| 198 | - } |
|
| 191 | + //include_spip('inc/indexation'); |
|
| 192 | + //update_index_tables(); |
|
| 193 | + maj_version(1.916); |
|
| 194 | + } |
|
| 195 | + if (upgrade_vers(1.917, $version_installee, $version_cible)) { |
|
| 196 | + spip_query("ALTER TABLE spip_documents DROP `inclus`"); |
|
| 197 | + maj_version(1.917); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | - // Permettre d'enregistrer un numero IP dans les revisions d'articles |
|
| 201 | - // a la place de l'id_auteur |
|
| 202 | - if (upgrade_vers(1.918, $version_installee, $version_cible)) { |
|
| 203 | - spip_query("ALTER TABLE spip_versions CHANGE `id_auteur` `id_auteur` VARCHAR(23)"); |
|
| 204 | - maj_version(1.918); |
|
| 205 | - } |
|
| 200 | + // Permettre d'enregistrer un numero IP dans les revisions d'articles |
|
| 201 | + // a la place de l'id_auteur |
|
| 202 | + if (upgrade_vers(1.918, $version_installee, $version_cible)) { |
|
| 203 | + spip_query("ALTER TABLE spip_versions CHANGE `id_auteur` `id_auteur` VARCHAR(23)"); |
|
| 204 | + maj_version(1.918); |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - if (upgrade_vers(1.919, $version_installee, $version_cible)) { |
|
| 208 | - spip_query("ALTER TABLE spip_ajax_fonc DROP `id_auteur`"); |
|
| 209 | - maj_version('1.919'); |
|
| 210 | - } |
|
| 207 | + if (upgrade_vers(1.919, $version_installee, $version_cible)) { |
|
| 208 | + spip_query("ALTER TABLE spip_ajax_fonc DROP `id_auteur`"); |
|
| 209 | + maj_version('1.919'); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - if (upgrade_vers(1.920, $version_installee, $version_cible)) { |
|
| 213 | - spip_query("ALTER IGNORE TABLE spip_documents_articles ADD PRIMARY KEY (`id_article`, `id_document`)"); |
|
| 214 | - spip_query("ALTER IGNORE TABLE spip_documents_breves ADD PRIMARY KEY (`id_breve`, `id_document`)"); |
|
| 215 | - spip_query("ALTER IGNORE TABLE spip_documents_rubriques ADD PRIMARY KEY (`id_rubrique`, `id_document`)"); |
|
| 216 | - spip_query("ALTER IGNORE TABLE spip_documents_articles DROP INDEX `id_article`"); |
|
| 217 | - spip_query("ALTER IGNORE TABLE spip_documents_breves DROP INDEX `id_breve`"); |
|
| 218 | - spip_query("ALTER IGNORE TABLE spip_documents_rubriques DROP INDEX `id_rubrique`"); |
|
| 219 | - maj_version('1.920'); |
|
| 220 | - } |
|
| 221 | - if (upgrade_vers(1.922, $version_installee, $version_cible)) { |
|
| 222 | - spip_query("ALTER TABLE spip_meta ADD `impt` ENUM('non', 'oui') DEFAULT 'oui' NOT NULL AFTER `valeur`"); |
|
| 223 | - $meta_serveur = array('version_installee','adresse_site','alea_ephemere_ancien','alea_ephemere','alea_ephemere_date','langue_site','langues_proposees','date_calcul_rubriques','derniere_modif','optimiser_table','drapeau_edition','creer_preview','taille_preview','creer_htpasswd','creer_htaccess','gd_formats_read','gd_formats', |
|
| 224 | - 'netpbm_formats','formats_graphiques','image_process','plugin_header','plugin'); |
|
| 225 | - foreach($meta_serveur as $nom) |
|
| 226 | - spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom)); |
|
| 227 | - maj_version('1.922'); |
|
| 228 | - } |
|
| 229 | - if (upgrade_vers(1.923, $version_installee, $version_cible)) { |
|
| 230 | - if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])){ |
|
| 231 | - $IMPORT_tables_noimport = unserialize($GLOBALS['meta']['IMPORT_tables_noimport']); |
|
| 232 | - foreach ($IMPORT_tables_noimport as $key=>$table) |
|
| 233 | - if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 234 | - ecrire_meta('IMPORT_tables_noimport',serialize($IMPORT_tables_noimport),'non'); |
|
| 235 | - } |
|
| 236 | - maj_version('1.923'); |
|
| 237 | - } |
|
| 212 | + if (upgrade_vers(1.920, $version_installee, $version_cible)) { |
|
| 213 | + spip_query("ALTER IGNORE TABLE spip_documents_articles ADD PRIMARY KEY (`id_article`, `id_document`)"); |
|
| 214 | + spip_query("ALTER IGNORE TABLE spip_documents_breves ADD PRIMARY KEY (`id_breve`, `id_document`)"); |
|
| 215 | + spip_query("ALTER IGNORE TABLE spip_documents_rubriques ADD PRIMARY KEY (`id_rubrique`, `id_document`)"); |
|
| 216 | + spip_query("ALTER IGNORE TABLE spip_documents_articles DROP INDEX `id_article`"); |
|
| 217 | + spip_query("ALTER IGNORE TABLE spip_documents_breves DROP INDEX `id_breve`"); |
|
| 218 | + spip_query("ALTER IGNORE TABLE spip_documents_rubriques DROP INDEX `id_rubrique`"); |
|
| 219 | + maj_version('1.920'); |
|
| 220 | + } |
|
| 221 | + if (upgrade_vers(1.922, $version_installee, $version_cible)) { |
|
| 222 | + spip_query("ALTER TABLE spip_meta ADD `impt` ENUM('non', 'oui') DEFAULT 'oui' NOT NULL AFTER `valeur`"); |
|
| 223 | + $meta_serveur = array('version_installee','adresse_site','alea_ephemere_ancien','alea_ephemere','alea_ephemere_date','langue_site','langues_proposees','date_calcul_rubriques','derniere_modif','optimiser_table','drapeau_edition','creer_preview','taille_preview','creer_htpasswd','creer_htaccess','gd_formats_read','gd_formats', |
|
| 224 | + 'netpbm_formats','formats_graphiques','image_process','plugin_header','plugin'); |
|
| 225 | + foreach($meta_serveur as $nom) |
|
| 226 | + spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom)); |
|
| 227 | + maj_version('1.922'); |
|
| 228 | + } |
|
| 229 | + if (upgrade_vers(1.923, $version_installee, $version_cible)) { |
|
| 230 | + if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])){ |
|
| 231 | + $IMPORT_tables_noimport = unserialize($GLOBALS['meta']['IMPORT_tables_noimport']); |
|
| 232 | + foreach ($IMPORT_tables_noimport as $key=>$table) |
|
| 233 | + if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 234 | + ecrire_meta('IMPORT_tables_noimport',serialize($IMPORT_tables_noimport),'non'); |
|
| 235 | + } |
|
| 236 | + maj_version('1.923'); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - if (upgrade_vers(1.924, $version_installee, $version_cible)) { |
|
| 240 | - spip_query('DROP TABLE spip_ajax_fonc'); |
|
| 241 | - maj_version('1.924'); |
|
| 242 | - } |
|
| 239 | + if (upgrade_vers(1.924, $version_installee, $version_cible)) { |
|
| 240 | + spip_query('DROP TABLE spip_ajax_fonc'); |
|
| 241 | + maj_version('1.924'); |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - if (upgrade_vers(1.925, $version_installee, $version_cible)) { |
|
| 245 | - include_spip('inc/flock'); |
|
| 246 | - /* deplacement des sessions */ |
|
| 247 | - $f_session = preg_files('data', 'session_'); |
|
| 248 | - $repertoire = _DIR_SESSIONS; |
|
| 249 | - if(!@file_exists($repertoire)) { |
|
| 250 | - $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 251 | - $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 252 | - } |
|
| 253 | - foreach($f_session as $f) { |
|
| 254 | - $d = basename($f); |
|
| 255 | - @copy($f, $repertoire.$d); |
|
| 256 | - } |
|
| 257 | - /* deplacement des visites */ |
|
| 258 | - $f_visites = preg_files('data/visites'); |
|
| 259 | - $repertoire = sous_repertoire(_DIR_TMP, 'visites'); |
|
| 260 | - foreach($f_visites as $f) { |
|
| 261 | - $d = basename($f); |
|
| 262 | - @copy($f, $repertoire.$d); |
|
| 263 | - } |
|
| 264 | - /* deplacement des upload */ |
|
| 265 | - $auteurs = array(); |
|
| 266 | - $req = spip_query("SELECT `login` FROM spip_auteurs WHERE `statut` = '0minirezo'"); |
|
| 267 | - while($row = sql_fetch($req)) |
|
| 268 | - $auteurs[] = $row['login']; |
|
| 269 | - $f_upload = preg_files('upload', -1, 10000, $auteurs); |
|
| 270 | - $repertoire = _DIR_TRANSFERT; |
|
| 271 | - if(!@file_exists($repertoire)) { |
|
| 272 | - $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 273 | - $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 274 | - } |
|
| 275 | - foreach($auteurs as $login) { |
|
| 276 | - if(is_dir('upload/'.$login)) |
|
| 277 | - $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
|
| 278 | - } |
|
| 279 | - foreach($f_upload as $f) { |
|
| 280 | - @copy($f, _DIR_TMP.$f); |
|
| 281 | - } |
|
| 282 | - /* deplacement des dumps */ |
|
| 283 | - $f_session = preg_files('data', 'dump'); |
|
| 284 | - $repertoire = _DIR_DUMP; |
|
| 285 | - if(!@file_exists($repertoire)) { |
|
| 286 | - $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 287 | - $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 288 | - } |
|
| 289 | - foreach($f_session as $f) { |
|
| 290 | - $d = basename($f); |
|
| 291 | - @copy($f, $repertoire.$d); |
|
| 292 | - } |
|
| 293 | - maj_version('1.925'); |
|
| 294 | - } |
|
| 295 | - // Ajout de MP4 |
|
| 296 | - if (upgrade_vers(1.926, $version_installee, $version_cible)) { |
|
| 297 | - spip_query("INSERT IGNORE INTO spip_types_documents (`extension`, `titre`, `inclus`) VALUES ('mp4', 'MPEG4', 'embed')"); |
|
| 298 | - spip_query("UPDATE spip_types_documents SET `mime_type`='application/mp4' WHERE `extension`='mp4'"); |
|
| 299 | - maj_version('1.926'); |
|
| 300 | - } |
|
| 244 | + if (upgrade_vers(1.925, $version_installee, $version_cible)) { |
|
| 245 | + include_spip('inc/flock'); |
|
| 246 | + /* deplacement des sessions */ |
|
| 247 | + $f_session = preg_files('data', 'session_'); |
|
| 248 | + $repertoire = _DIR_SESSIONS; |
|
| 249 | + if(!@file_exists($repertoire)) { |
|
| 250 | + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 251 | + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 252 | + } |
|
| 253 | + foreach($f_session as $f) { |
|
| 254 | + $d = basename($f); |
|
| 255 | + @copy($f, $repertoire.$d); |
|
| 256 | + } |
|
| 257 | + /* deplacement des visites */ |
|
| 258 | + $f_visites = preg_files('data/visites'); |
|
| 259 | + $repertoire = sous_repertoire(_DIR_TMP, 'visites'); |
|
| 260 | + foreach($f_visites as $f) { |
|
| 261 | + $d = basename($f); |
|
| 262 | + @copy($f, $repertoire.$d); |
|
| 263 | + } |
|
| 264 | + /* deplacement des upload */ |
|
| 265 | + $auteurs = array(); |
|
| 266 | + $req = spip_query("SELECT `login` FROM spip_auteurs WHERE `statut` = '0minirezo'"); |
|
| 267 | + while($row = sql_fetch($req)) |
|
| 268 | + $auteurs[] = $row['login']; |
|
| 269 | + $f_upload = preg_files('upload', -1, 10000, $auteurs); |
|
| 270 | + $repertoire = _DIR_TRANSFERT; |
|
| 271 | + if(!@file_exists($repertoire)) { |
|
| 272 | + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 273 | + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 274 | + } |
|
| 275 | + foreach($auteurs as $login) { |
|
| 276 | + if(is_dir('upload/'.$login)) |
|
| 277 | + $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
|
| 278 | + } |
|
| 279 | + foreach($f_upload as $f) { |
|
| 280 | + @copy($f, _DIR_TMP.$f); |
|
| 281 | + } |
|
| 282 | + /* deplacement des dumps */ |
|
| 283 | + $f_session = preg_files('data', 'dump'); |
|
| 284 | + $repertoire = _DIR_DUMP; |
|
| 285 | + if(!@file_exists($repertoire)) { |
|
| 286 | + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 287 | + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 288 | + } |
|
| 289 | + foreach($f_session as $f) { |
|
| 290 | + $d = basename($f); |
|
| 291 | + @copy($f, $repertoire.$d); |
|
| 292 | + } |
|
| 293 | + maj_version('1.925'); |
|
| 294 | + } |
|
| 295 | + // Ajout de MP4 |
|
| 296 | + if (upgrade_vers(1.926, $version_installee, $version_cible)) { |
|
| 297 | + spip_query("INSERT IGNORE INTO spip_types_documents (`extension`, `titre`, `inclus`) VALUES ('mp4', 'MPEG4', 'embed')"); |
|
| 298 | + spip_query("UPDATE spip_types_documents SET `mime_type`='application/mp4' WHERE `extension`='mp4'"); |
|
| 299 | + maj_version('1.926'); |
|
| 300 | + } |
|
| 301 | 301 | } |
| 302 | 302 | ?> |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT"); |
| 56 | 56 | // table des correspondances table->id_table |
| 57 | 57 | $liste_tables = array(); |
| 58 | - $liste_tables[1]='spip_articles'; |
|
| 59 | - $liste_tables[2]='spip_auteurs'; |
|
| 60 | - $liste_tables[3]='spip_breves'; |
|
| 61 | - $liste_tables[4]='spip_documents'; |
|
| 62 | - $liste_tables[5]='spip_forum'; |
|
| 63 | - $liste_tables[6]='spip_mots'; |
|
| 64 | - $liste_tables[7]='spip_rubriques'; |
|
| 65 | - $liste_tables[8]='spip_signatures'; |
|
| 66 | - $liste_tables[9]='spip_syndic'; |
|
| 58 | + $liste_tables[1] = 'spip_articles'; |
|
| 59 | + $liste_tables[2] = 'spip_auteurs'; |
|
| 60 | + $liste_tables[3] = 'spip_breves'; |
|
| 61 | + $liste_tables[4] = 'spip_documents'; |
|
| 62 | + $liste_tables[5] = 'spip_forum'; |
|
| 63 | + $liste_tables[6] = 'spip_mots'; |
|
| 64 | + $liste_tables[7] = 'spip_rubriques'; |
|
| 65 | + $liste_tables[8] = 'spip_signatures'; |
|
| 66 | + $liste_tables[9] = 'spip_syndic'; |
|
| 67 | 67 | |
| 68 | 68 | ecrire_meta('index_table', serialize($liste_tables)); |
| 69 | 69 | |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | if (upgrade_vers(1.922, $version_installee, $version_cible)) { |
| 222 | 222 | spip_query("ALTER TABLE spip_meta ADD `impt` ENUM('non', 'oui') DEFAULT 'oui' NOT NULL AFTER `valeur`"); |
| 223 | - $meta_serveur = array('version_installee','adresse_site','alea_ephemere_ancien','alea_ephemere','alea_ephemere_date','langue_site','langues_proposees','date_calcul_rubriques','derniere_modif','optimiser_table','drapeau_edition','creer_preview','taille_preview','creer_htpasswd','creer_htaccess','gd_formats_read','gd_formats', |
|
| 224 | - 'netpbm_formats','formats_graphiques','image_process','plugin_header','plugin'); |
|
| 225 | - foreach($meta_serveur as $nom) |
|
| 223 | + $meta_serveur = array('version_installee', 'adresse_site', 'alea_ephemere_ancien', 'alea_ephemere', 'alea_ephemere_date', 'langue_site', 'langues_proposees', 'date_calcul_rubriques', 'derniere_modif', 'optimiser_table', 'drapeau_edition', 'creer_preview', 'taille_preview', 'creer_htpasswd', 'creer_htaccess', 'gd_formats_read', 'gd_formats', |
|
| 224 | + 'netpbm_formats', 'formats_graphiques', 'image_process', 'plugin_header', 'plugin'); |
|
| 225 | + foreach ($meta_serveur as $nom) |
|
| 226 | 226 | spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom)); |
| 227 | 227 | maj_version('1.922'); |
| 228 | 228 | } |
| 229 | 229 | if (upgrade_vers(1.923, $version_installee, $version_cible)) { |
| 230 | - if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])){ |
|
| 230 | + if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])) { |
|
| 231 | 231 | $IMPORT_tables_noimport = unserialize($GLOBALS['meta']['IMPORT_tables_noimport']); |
| 232 | 232 | foreach ($IMPORT_tables_noimport as $key=>$table) |
| 233 | - if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 234 | - ecrire_meta('IMPORT_tables_noimport',serialize($IMPORT_tables_noimport),'non'); |
|
| 233 | + if ($table == 'spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 234 | + ecrire_meta('IMPORT_tables_noimport', serialize($IMPORT_tables_noimport), 'non'); |
|
| 235 | 235 | } |
| 236 | 236 | maj_version('1.923'); |
| 237 | 237 | } |
@@ -246,47 +246,47 @@ discard block |
||
| 246 | 246 | /* deplacement des sessions */ |
| 247 | 247 | $f_session = preg_files('data', 'session_'); |
| 248 | 248 | $repertoire = _DIR_SESSIONS; |
| 249 | - if(!@file_exists($repertoire)) { |
|
| 249 | + if (!@file_exists($repertoire)) { |
|
| 250 | 250 | $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
| 251 | 251 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 252 | 252 | } |
| 253 | - foreach($f_session as $f) { |
|
| 253 | + foreach ($f_session as $f) { |
|
| 254 | 254 | $d = basename($f); |
| 255 | 255 | @copy($f, $repertoire.$d); |
| 256 | 256 | } |
| 257 | 257 | /* deplacement des visites */ |
| 258 | 258 | $f_visites = preg_files('data/visites'); |
| 259 | 259 | $repertoire = sous_repertoire(_DIR_TMP, 'visites'); |
| 260 | - foreach($f_visites as $f) { |
|
| 260 | + foreach ($f_visites as $f) { |
|
| 261 | 261 | $d = basename($f); |
| 262 | 262 | @copy($f, $repertoire.$d); |
| 263 | 263 | } |
| 264 | 264 | /* deplacement des upload */ |
| 265 | 265 | $auteurs = array(); |
| 266 | 266 | $req = spip_query("SELECT `login` FROM spip_auteurs WHERE `statut` = '0minirezo'"); |
| 267 | - while($row = sql_fetch($req)) |
|
| 267 | + while ($row = sql_fetch($req)) |
|
| 268 | 268 | $auteurs[] = $row['login']; |
| 269 | 269 | $f_upload = preg_files('upload', -1, 10000, $auteurs); |
| 270 | 270 | $repertoire = _DIR_TRANSFERT; |
| 271 | - if(!@file_exists($repertoire)) { |
|
| 271 | + if (!@file_exists($repertoire)) { |
|
| 272 | 272 | $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
| 273 | 273 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 274 | 274 | } |
| 275 | - foreach($auteurs as $login) { |
|
| 276 | - if(is_dir('upload/'.$login)) |
|
| 275 | + foreach ($auteurs as $login) { |
|
| 276 | + if (is_dir('upload/'.$login)) |
|
| 277 | 277 | $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
| 278 | 278 | } |
| 279 | - foreach($f_upload as $f) { |
|
| 279 | + foreach ($f_upload as $f) { |
|
| 280 | 280 | @copy($f, _DIR_TMP.$f); |
| 281 | 281 | } |
| 282 | 282 | /* deplacement des dumps */ |
| 283 | 283 | $f_session = preg_files('data', 'dump'); |
| 284 | 284 | $repertoire = _DIR_DUMP; |
| 285 | - if(!@file_exists($repertoire)) { |
|
| 285 | + if (!@file_exists($repertoire)) { |
|
| 286 | 286 | $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
| 287 | 287 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 288 | 288 | } |
| 289 | - foreach($f_session as $f) { |
|
| 289 | + foreach ($f_session as $f) { |
|
| 290 | 290 | $d = basename($f); |
| 291 | 291 | @copy($f, $repertoire.$d); |
| 292 | 292 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | function v019_pre193($version_installee, $version_cible) |
| 16 | 18 | { |
@@ -222,15 +224,17 @@ discard block |
||
| 222 | 224 | spip_query("ALTER TABLE spip_meta ADD `impt` ENUM('non', 'oui') DEFAULT 'oui' NOT NULL AFTER `valeur`"); |
| 223 | 225 | $meta_serveur = array('version_installee','adresse_site','alea_ephemere_ancien','alea_ephemere','alea_ephemere_date','langue_site','langues_proposees','date_calcul_rubriques','derniere_modif','optimiser_table','drapeau_edition','creer_preview','taille_preview','creer_htpasswd','creer_htaccess','gd_formats_read','gd_formats', |
| 224 | 226 | 'netpbm_formats','formats_graphiques','image_process','plugin_header','plugin'); |
| 225 | - foreach($meta_serveur as $nom) |
|
| 226 | - spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom)); |
|
| 227 | + foreach($meta_serveur as $nom) { |
|
| 228 | + spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom)); |
|
| 229 | + } |
|
| 227 | 230 | maj_version('1.922'); |
| 228 | 231 | } |
| 229 | 232 | if (upgrade_vers(1.923, $version_installee, $version_cible)) { |
| 230 | 233 | if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])){ |
| 231 | 234 | $IMPORT_tables_noimport = unserialize($GLOBALS['meta']['IMPORT_tables_noimport']); |
| 232 | - foreach ($IMPORT_tables_noimport as $key=>$table) |
|
| 233 | - if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 235 | + foreach ($IMPORT_tables_noimport as $key=>$table) { |
|
| 236 | + if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 237 | + } |
|
| 234 | 238 | ecrire_meta('IMPORT_tables_noimport',serialize($IMPORT_tables_noimport),'non'); |
| 235 | 239 | } |
| 236 | 240 | maj_version('1.923'); |
@@ -264,8 +268,9 @@ discard block |
||
| 264 | 268 | /* deplacement des upload */ |
| 265 | 269 | $auteurs = array(); |
| 266 | 270 | $req = spip_query("SELECT `login` FROM spip_auteurs WHERE `statut` = '0minirezo'"); |
| 267 | - while($row = sql_fetch($req)) |
|
| 268 | - $auteurs[] = $row['login']; |
|
| 271 | + while($row = sql_fetch($req)) { |
|
| 272 | + $auteurs[] = $row['login']; |
|
| 273 | + } |
|
| 269 | 274 | $f_upload = preg_files('upload', -1, 10000, $auteurs); |
| 270 | 275 | $repertoire = _DIR_TRANSFERT; |
| 271 | 276 | if(!@file_exists($repertoire)) { |
@@ -273,8 +278,9 @@ discard block |
||
| 273 | 278 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 274 | 279 | } |
| 275 | 280 | foreach($auteurs as $login) { |
| 276 | - if(is_dir('upload/'.$login)) |
|
| 277 | - $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
|
| 281 | + if(is_dir('upload/'.$login)) { |
|
| 282 | + $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
|
| 283 | + } |
|
| 278 | 284 | } |
| 279 | 285 | foreach($f_upload as $f) { |
| 280 | 286 | @copy($f, _DIR_TMP.$f); |
@@ -51,6 +51,10 @@ |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // http://doc.spip.org/@affiche_block_initiale |
| 54 | +/** |
|
| 55 | + * @param string $initiale |
|
| 56 | + * @param string $block |
|
| 57 | + */ |
|
| 54 | 58 | function affiche_block_initiale($initiale,$block,$block_actif){ |
| 55 | 59 | if (strlen($block)){ |
| 56 | 60 | return "<li class='item'>" |
@@ -26,78 +26,78 @@ |
||
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | 28 | function plugins_afficher_liste_dist($url_page,$liste_plugins, $liste_plugins_checked, $liste_plugins_actifs, $dir_plugins=_DIR_PLUGINS,$afficher_un = 'afficher_plugin'){ |
| 29 | - $get_infos = charger_fonction('get_infos','plugins'); |
|
| 30 | - $ligne_plug = charger_fonction($afficher_un,'plugins'); |
|
| 29 | + $get_infos = charger_fonction('get_infos','plugins'); |
|
| 30 | + $ligne_plug = charger_fonction($afficher_un,'plugins'); |
|
| 31 | 31 | |
| 32 | - $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 32 | + $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 33 | 33 | |
| 34 | - $all_infos = pipeline('filtrer_liste_plugins', |
|
| 35 | - array( |
|
| 36 | - 'args'=>array( |
|
| 37 | - 'liste_plugins'=>$liste_plugins, |
|
| 38 | - 'liste_plugins_checked'=>$liste_plugins_checked, |
|
| 39 | - 'liste_plugins_actifs'=>$liste_plugins_actifs, |
|
| 40 | - 'dir_plugins'=>$dir_plugins), |
|
| 41 | - 'data'=>$all_infos |
|
| 42 | - ) |
|
| 43 | - ); |
|
| 34 | + $all_infos = pipeline('filtrer_liste_plugins', |
|
| 35 | + array( |
|
| 36 | + 'args'=>array( |
|
| 37 | + 'liste_plugins'=>$liste_plugins, |
|
| 38 | + 'liste_plugins_checked'=>$liste_plugins_checked, |
|
| 39 | + 'liste_plugins_actifs'=>$liste_plugins_actifs, |
|
| 40 | + 'dir_plugins'=>$dir_plugins), |
|
| 41 | + 'data'=>$all_infos |
|
| 42 | + ) |
|
| 43 | + ); |
|
| 44 | 44 | |
| 45 | - $liste_plugins = array_flip($liste_plugins); |
|
| 46 | - foreach($liste_plugins as $chemin => $v) { |
|
| 47 | - // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 48 | - if (isset($all_infos[$chemin])){ |
|
| 49 | - $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 50 | - } |
|
| 51 | - else { |
|
| 52 | - unset($liste_plugins[$chemin]); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - asort($liste_plugins); |
|
| 56 | - $exposed = urldecode(_request('plugin')); |
|
| 45 | + $liste_plugins = array_flip($liste_plugins); |
|
| 46 | + foreach($liste_plugins as $chemin => $v) { |
|
| 47 | + // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 48 | + if (isset($all_infos[$chemin])){ |
|
| 49 | + $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 50 | + } |
|
| 51 | + else { |
|
| 52 | + unset($liste_plugins[$chemin]); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + asort($liste_plugins); |
|
| 56 | + $exposed = urldecode(_request('plugin')); |
|
| 57 | 57 | |
| 58 | - $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 59 | - $fast_liste_plugins_actifs = array(); |
|
| 60 | - $fast_liste_plugins_checked = array(); |
|
| 61 | - if (is_array($liste_plugins_actifs)) |
|
| 62 | - $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 63 | - if (is_array($liste_plugins_checked)) |
|
| 64 | - $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 58 | + $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 59 | + $fast_liste_plugins_actifs = array(); |
|
| 60 | + $fast_liste_plugins_checked = array(); |
|
| 61 | + if (is_array($liste_plugins_actifs)) |
|
| 62 | + $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 63 | + if (is_array($liste_plugins_checked)) |
|
| 64 | + $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 65 | 65 | |
| 66 | - $res = ''; |
|
| 67 | - $block = ''; |
|
| 68 | - $initiale = ''; |
|
| 69 | - $block_actif = false; |
|
| 70 | - foreach($liste_plugins as $plug => $nom){ |
|
| 71 | - if (($i=substr($nom,0,1))!==$initiale){ |
|
| 72 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale,$block,$block_actif): $block; |
|
| 73 | - $initiale = $i; |
|
| 74 | - $block = ''; |
|
| 75 | - $block_actif = false; |
|
| 76 | - } |
|
| 77 | - // le rep suivant |
|
| 78 | - $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 79 | - $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 80 | - $block_actif = $block_actif | $actif; |
|
| 81 | - $expose = ($exposed AND ($exposed==$plug OR $exposed==$dir_plugins . $plug OR $exposed==substr($dir_plugins,strlen(_DIR_RACINE)) . $plug)); |
|
| 82 | - $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins)."\n"; |
|
| 83 | - } |
|
| 84 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale,$block,$block_actif): $block; |
|
| 85 | - $class = basename($dir_plugins); |
|
| 86 | - return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ""; |
|
| 66 | + $res = ''; |
|
| 67 | + $block = ''; |
|
| 68 | + $initiale = ''; |
|
| 69 | + $block_actif = false; |
|
| 70 | + foreach($liste_plugins as $plug => $nom){ |
|
| 71 | + if (($i=substr($nom,0,1))!==$initiale){ |
|
| 72 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale,$block,$block_actif): $block; |
|
| 73 | + $initiale = $i; |
|
| 74 | + $block = ''; |
|
| 75 | + $block_actif = false; |
|
| 76 | + } |
|
| 77 | + // le rep suivant |
|
| 78 | + $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 79 | + $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 80 | + $block_actif = $block_actif | $actif; |
|
| 81 | + $expose = ($exposed AND ($exposed==$plug OR $exposed==$dir_plugins . $plug OR $exposed==substr($dir_plugins,strlen(_DIR_RACINE)) . $plug)); |
|
| 82 | + $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins)."\n"; |
|
| 83 | + } |
|
| 84 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale,$block,$block_actif): $block; |
|
| 85 | + $class = basename($dir_plugins); |
|
| 86 | + return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ""; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | // http://doc.spip.org/@affiche_block_initiale |
| 91 | 91 | function affiche_block_initiale($initiale,$block,$block_actif){ |
| 92 | - if (strlen($block)){ |
|
| 93 | - return "<li class='item'>" |
|
| 94 | - . bouton_block_depliable($initiale,$block_actif?true:false) |
|
| 95 | - . debut_block_depliable($block_actif) |
|
| 96 | - . "<ul>$block</ul>" |
|
| 97 | - . fin_block() |
|
| 98 | - . "</li>"; |
|
| 99 | - } |
|
| 100 | - return ""; |
|
| 92 | + if (strlen($block)){ |
|
| 93 | + return "<li class='item'>" |
|
| 94 | + . bouton_block_depliable($initiale,$block_actif?true:false) |
|
| 95 | + . debut_block_depliable($block_actif) |
|
| 96 | + . "<ul>$block</ul>" |
|
| 97 | + . fin_block() |
|
| 98 | + . "</li>"; |
|
| 99 | + } |
|
| 100 | + return ""; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | ?> |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | include_spip('inc/charsets'); |
| 15 | 17 | |
| 16 | 18 | /** |
@@ -47,8 +49,7 @@ discard block |
||
| 47 | 49 | // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
| 48 | 50 | if (isset($all_infos[$chemin])){ |
| 49 | 51 | $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
| 50 | - } |
|
| 51 | - else { |
|
| 52 | + } else { |
|
| 52 | 53 | unset($liste_plugins[$chemin]); |
| 53 | 54 | } |
| 54 | 55 | } |
@@ -58,10 +59,12 @@ discard block |
||
| 58 | 59 | $block_par_lettre = false;//count($liste_plugins)>10; |
| 59 | 60 | $fast_liste_plugins_actifs = array(); |
| 60 | 61 | $fast_liste_plugins_checked = array(); |
| 61 | - if (is_array($liste_plugins_actifs)) |
|
| 62 | - $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 63 | - if (is_array($liste_plugins_checked)) |
|
| 64 | - $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 62 | + if (is_array($liste_plugins_actifs)) { |
|
| 63 | + $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 64 | + } |
|
| 65 | + if (is_array($liste_plugins_checked)) { |
|
| 66 | + $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 67 | + } |
|
| 65 | 68 | |
| 66 | 69 | $res = ''; |
| 67 | 70 | $block = ''; |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | * @param string $afficher_un |
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | -function plugins_afficher_liste_dist($url_page,$liste_plugins, $liste_plugins_checked, $liste_plugins_actifs, $dir_plugins=_DIR_PLUGINS,$afficher_un = 'afficher_plugin'){ |
|
| 29 | - $get_infos = charger_fonction('get_infos','plugins'); |
|
| 30 | - $ligne_plug = charger_fonction($afficher_un,'plugins'); |
|
| 28 | +function plugins_afficher_liste_dist($url_page, $liste_plugins, $liste_plugins_checked, $liste_plugins_actifs, $dir_plugins = _DIR_PLUGINS, $afficher_un = 'afficher_plugin') { |
|
| 29 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 30 | + $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 31 | 31 | |
| 32 | 32 | $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
| 33 | 33 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | $liste_plugins = array_flip($liste_plugins); |
| 46 | - foreach($liste_plugins as $chemin => $v) { |
|
| 46 | + foreach ($liste_plugins as $chemin => $v) { |
|
| 47 | 47 | // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
| 48 | - if (isset($all_infos[$chemin])){ |
|
| 48 | + if (isset($all_infos[$chemin])) { |
|
| 49 | 49 | $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
| 50 | 50 | } |
| 51 | 51 | else { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | asort($liste_plugins); |
| 56 | 56 | $exposed = urldecode(_request('plugin')); |
| 57 | 57 | |
| 58 | - $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 58 | + $block_par_lettre = false; //count($liste_plugins)>10; |
|
| 59 | 59 | $fast_liste_plugins_actifs = array(); |
| 60 | 60 | $fast_liste_plugins_checked = array(); |
| 61 | 61 | if (is_array($liste_plugins_actifs)) |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | $block = ''; |
| 68 | 68 | $initiale = ''; |
| 69 | 69 | $block_actif = false; |
| 70 | - foreach($liste_plugins as $plug => $nom){ |
|
| 71 | - if (($i=substr($nom,0,1))!==$initiale){ |
|
| 72 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale,$block,$block_actif): $block; |
|
| 70 | + foreach ($liste_plugins as $plug => $nom) { |
|
| 71 | + if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 72 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 73 | 73 | $initiale = $i; |
| 74 | 74 | $block = ''; |
| 75 | 75 | $block_actif = false; |
@@ -78,20 +78,20 @@ discard block |
||
| 78 | 78 | $actif = isset($fast_liste_plugins_actifs[$plug]); |
| 79 | 79 | $checked = isset($fast_liste_plugins_checked[$plug]); |
| 80 | 80 | $block_actif = $block_actif | $actif; |
| 81 | - $expose = ($exposed AND ($exposed==$plug OR $exposed==$dir_plugins . $plug OR $exposed==substr($dir_plugins,strlen(_DIR_RACINE)) . $plug)); |
|
| 81 | + $expose = ($exposed AND ($exposed == $plug OR $exposed == $dir_plugins.$plug OR $exposed == substr($dir_plugins, strlen(_DIR_RACINE)).$plug)); |
|
| 82 | 82 | $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins)."\n"; |
| 83 | 83 | } |
| 84 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale,$block,$block_actif): $block; |
|
| 84 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 85 | 85 | $class = basename($dir_plugins); |
| 86 | 86 | return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ""; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | // http://doc.spip.org/@affiche_block_initiale |
| 91 | -function affiche_block_initiale($initiale,$block,$block_actif){ |
|
| 92 | - if (strlen($block)){ |
|
| 91 | +function affiche_block_initiale($initiale, $block, $block_actif) { |
|
| 92 | + if (strlen($block)) { |
|
| 93 | 93 | return "<li class='item'>" |
| 94 | - . bouton_block_depliable($initiale,$block_actif?true:false) |
|
| 94 | + . bouton_block_depliable($initiale, $block_actif ?true:false) |
|
| 95 | 95 | . debut_block_depliable($block_actif) |
| 96 | 96 | . "<ul>$block</ul>" |
| 97 | 97 | . fin_block() |
@@ -69,11 +69,19 @@ |
||
| 69 | 69 | // vraiment n'importe quoi la gestion des chemins des plugins |
| 70 | 70 | // une fonction pour aider... |
| 71 | 71 | // http://doc.spip.org/@chemin_plug |
| 72 | +/** |
|
| 73 | + * @param string $racine |
|
| 74 | + * |
|
| 75 | + * @return string |
|
| 76 | + */ |
|
| 72 | 77 | function chemin_plug($racine, $plug) { |
| 73 | 78 | return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | 81 | // http://doc.spip.org/@tree_open_close_dir |
| 82 | +/** |
|
| 83 | + * @param string $target |
|
| 84 | + */ |
|
| 77 | 85 | function tree_open_close_dir(&$current,$target,$deplie=array()){ |
| 78 | 86 | if ($current == $target) return ""; |
| 79 | 87 | $tcur = explode("/",$current); |
@@ -14,55 +14,55 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // http://doc.spip.org/@affiche_arbre_plugins |
| 16 | 16 | function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs){ |
| 17 | - $ligne_plug = charger_fonction('afficher_plugin','plugins'); |
|
| 18 | - $racine = basename(_DIR_PLUGINS); |
|
| 19 | - $init_dir = $current_dir = ""; |
|
| 20 | - // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
|
| 21 | - // des qu'un path est deja note deplie on s'arrete |
|
| 22 | - $deplie = array($racine=>true); |
|
| 23 | - $fast_liste_plugins_actifs=array(); |
|
| 24 | - foreach($liste_plugins_actifs as $key=>$plug){ |
|
| 25 | - $chemin_plug = chemin_plug($racine, $plug); |
|
| 26 | - $fast_liste_plugins_actifs[$chemin_plug]=true; |
|
| 27 | - $dir = dirname($chemin_plug);$maxiter=100; |
|
| 28 | - while(strlen($dir) && !isset($deplie[$dir]) && $dir!=$racine && $maxiter-->0){ |
|
| 29 | - $deplie[$dir] = true; |
|
| 30 | - $dir = dirname($dir); |
|
| 31 | - } |
|
| 32 | - } |
|
| 17 | + $ligne_plug = charger_fonction('afficher_plugin','plugins'); |
|
| 18 | + $racine = basename(_DIR_PLUGINS); |
|
| 19 | + $init_dir = $current_dir = ""; |
|
| 20 | + // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
|
| 21 | + // des qu'un path est deja note deplie on s'arrete |
|
| 22 | + $deplie = array($racine=>true); |
|
| 23 | + $fast_liste_plugins_actifs=array(); |
|
| 24 | + foreach($liste_plugins_actifs as $key=>$plug){ |
|
| 25 | + $chemin_plug = chemin_plug($racine, $plug); |
|
| 26 | + $fast_liste_plugins_actifs[$chemin_plug]=true; |
|
| 27 | + $dir = dirname($chemin_plug);$maxiter=100; |
|
| 28 | + while(strlen($dir) && !isset($deplie[$dir]) && $dir!=$racine && $maxiter-->0){ |
|
| 29 | + $deplie[$dir] = true; |
|
| 30 | + $dir = dirname($dir); |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - // index repertoires --> plugin |
|
| 35 | - $dir_index=array(); |
|
| 36 | - foreach($liste_plugins as $key=>$plug){ |
|
| 37 | - $liste_plugins[$key] = chemin_plug($racine, $plug); |
|
| 38 | - $dir_index[dirname($liste_plugins[$key])][] = $key; |
|
| 39 | - } |
|
| 34 | + // index repertoires --> plugin |
|
| 35 | + $dir_index=array(); |
|
| 36 | + foreach($liste_plugins as $key=>$plug){ |
|
| 37 | + $liste_plugins[$key] = chemin_plug($racine, $plug); |
|
| 38 | + $dir_index[dirname($liste_plugins[$key])][] = $key; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $visible = @isset($deplie[$current_dir]); |
|
| 42 | - $maxiter=1000; |
|
| 41 | + $visible = @isset($deplie[$current_dir]); |
|
| 42 | + $maxiter=1000; |
|
| 43 | 43 | |
| 44 | - $res = ''; |
|
| 45 | - while (count($liste_plugins) && $maxiter--){ |
|
| 46 | - // le rep suivant |
|
| 47 | - $dir = dirname(reset($liste_plugins)); |
|
| 48 | - if ($dir != $current_dir) |
|
| 49 | - $res .= tree_open_close_dir($current_dir,$dir,$deplie); |
|
| 44 | + $res = ''; |
|
| 45 | + while (count($liste_plugins) && $maxiter--){ |
|
| 46 | + // le rep suivant |
|
| 47 | + $dir = dirname(reset($liste_plugins)); |
|
| 48 | + if ($dir != $current_dir) |
|
| 49 | + $res .= tree_open_close_dir($current_dir,$dir,$deplie); |
|
| 50 | 50 | |
| 51 | - // d'abord tous les plugins du rep courant |
|
| 52 | - if (isset($dir_index[$current_dir])) |
|
| 53 | - foreach($dir_index[$current_dir] as $key){ |
|
| 54 | - $plug = $liste_plugins[$key]; |
|
| 55 | - $actif = @isset($fast_liste_plugins_actifs[$plug]); |
|
| 56 | - $id = substr(md5($plug),0,16); |
|
| 57 | - $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif, 'menu-entree') . "\n"; |
|
| 58 | - unset($liste_plugins[$key]); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - $res .= tree_open_close_dir($current_dir,$init_dir, true); |
|
| 51 | + // d'abord tous les plugins du rep courant |
|
| 52 | + if (isset($dir_index[$current_dir])) |
|
| 53 | + foreach($dir_index[$current_dir] as $key){ |
|
| 54 | + $plug = $liste_plugins[$key]; |
|
| 55 | + $actif = @isset($fast_liste_plugins_actifs[$plug]); |
|
| 56 | + $id = substr(md5($plug),0,16); |
|
| 57 | + $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif, 'menu-entree') . "\n"; |
|
| 58 | + unset($liste_plugins[$key]); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + $res .= tree_open_close_dir($current_dir,$init_dir, true); |
|
| 62 | 62 | |
| 63 | - return "<ul class='menu-liste plugins'>" |
|
| 64 | - . $res |
|
| 65 | - . "</ul>"; |
|
| 63 | + return "<ul class='menu-liste plugins'>" |
|
| 64 | + . $res |
|
| 65 | + . "</ul>"; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -70,42 +70,42 @@ discard block |
||
| 70 | 70 | // une fonction pour aider... |
| 71 | 71 | // http://doc.spip.org/@chemin_plug |
| 72 | 72 | function chemin_plug($racine, $plug) { |
| 73 | - return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
|
| 73 | + return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug"); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // http://doc.spip.org/@tree_open_close_dir |
| 77 | 77 | function tree_open_close_dir(&$current,$target,$deplie=array()){ |
| 78 | - if ($current == $target) return ""; |
|
| 79 | - $tcur = explode("/",$current); |
|
| 80 | - $ttarg = explode("/",$target); |
|
| 81 | - $tcom = array(); |
|
| 82 | - $output = ""; |
|
| 83 | - // la partie commune |
|
| 84 | - while (reset($tcur)==reset($ttarg)){ |
|
| 85 | - $tcom[] = array_shift($tcur); |
|
| 86 | - array_shift($ttarg); |
|
| 87 | - } |
|
| 88 | - // fermer les repertoires courant jusqu'au point de fork |
|
| 89 | - while($close = array_pop($tcur)){ |
|
| 90 | - $output .= "</ul>\n"; |
|
| 91 | - $output .= fin_block(); |
|
| 92 | - $output .= "</li>\n"; |
|
| 93 | - } |
|
| 94 | - $chemin = ""; |
|
| 95 | - if (count($tcom)) |
|
| 96 | - $chemin .= implode("/",$tcom)."/"; |
|
| 97 | - // ouvrir les repertoires jusqu'a la cible |
|
| 98 | - while($open = array_shift($ttarg)){ |
|
| 99 | - $visible = @isset($deplie[$chemin.$open]); |
|
| 100 | - $chemin .= $open . "/"; |
|
| 101 | - $output .= "<li>"; |
|
| 102 | - $output .= bouton_block_depliable($chemin,$visible); |
|
| 103 | - $output .= debut_block_depliable($visible); |
|
| 78 | + if ($current == $target) return ""; |
|
| 79 | + $tcur = explode("/",$current); |
|
| 80 | + $ttarg = explode("/",$target); |
|
| 81 | + $tcom = array(); |
|
| 82 | + $output = ""; |
|
| 83 | + // la partie commune |
|
| 84 | + while (reset($tcur)==reset($ttarg)){ |
|
| 85 | + $tcom[] = array_shift($tcur); |
|
| 86 | + array_shift($ttarg); |
|
| 87 | + } |
|
| 88 | + // fermer les repertoires courant jusqu'au point de fork |
|
| 89 | + while($close = array_pop($tcur)){ |
|
| 90 | + $output .= "</ul>\n"; |
|
| 91 | + $output .= fin_block(); |
|
| 92 | + $output .= "</li>\n"; |
|
| 93 | + } |
|
| 94 | + $chemin = ""; |
|
| 95 | + if (count($tcom)) |
|
| 96 | + $chemin .= implode("/",$tcom)."/"; |
|
| 97 | + // ouvrir les repertoires jusqu'a la cible |
|
| 98 | + while($open = array_shift($ttarg)){ |
|
| 99 | + $visible = @isset($deplie[$chemin.$open]); |
|
| 100 | + $chemin .= $open . "/"; |
|
| 101 | + $output .= "<li>"; |
|
| 102 | + $output .= bouton_block_depliable($chemin,$visible); |
|
| 103 | + $output .= debut_block_depliable($visible); |
|
| 104 | 104 | |
| 105 | - $output .= "<ul>\n"; |
|
| 106 | - } |
|
| 107 | - $current = $target; |
|
| 108 | - return $output; |
|
| 105 | + $output .= "<ul>\n"; |
|
| 106 | + } |
|
| 107 | + $current = $target; |
|
| 108 | + return $output; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | ?> |
@@ -13,52 +13,52 @@ discard block |
||
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | 15 | // http://doc.spip.org/@affiche_arbre_plugins |
| 16 | -function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs){ |
|
| 17 | - $ligne_plug = charger_fonction('afficher_plugin','plugins'); |
|
| 16 | +function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs) { |
|
| 17 | + $ligne_plug = charger_fonction('afficher_plugin', 'plugins'); |
|
| 18 | 18 | $racine = basename(_DIR_PLUGINS); |
| 19 | 19 | $init_dir = $current_dir = ""; |
| 20 | 20 | // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif |
| 21 | 21 | // des qu'un path est deja note deplie on s'arrete |
| 22 | 22 | $deplie = array($racine=>true); |
| 23 | - $fast_liste_plugins_actifs=array(); |
|
| 24 | - foreach($liste_plugins_actifs as $key=>$plug){ |
|
| 23 | + $fast_liste_plugins_actifs = array(); |
|
| 24 | + foreach ($liste_plugins_actifs as $key=>$plug) { |
|
| 25 | 25 | $chemin_plug = chemin_plug($racine, $plug); |
| 26 | - $fast_liste_plugins_actifs[$chemin_plug]=true; |
|
| 27 | - $dir = dirname($chemin_plug);$maxiter=100; |
|
| 28 | - while(strlen($dir) && !isset($deplie[$dir]) && $dir!=$racine && $maxiter-->0){ |
|
| 26 | + $fast_liste_plugins_actifs[$chemin_plug] = true; |
|
| 27 | + $dir = dirname($chemin_plug); $maxiter = 100; |
|
| 28 | + while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) { |
|
| 29 | 29 | $deplie[$dir] = true; |
| 30 | 30 | $dir = dirname($dir); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // index repertoires --> plugin |
| 35 | - $dir_index=array(); |
|
| 36 | - foreach($liste_plugins as $key=>$plug){ |
|
| 35 | + $dir_index = array(); |
|
| 36 | + foreach ($liste_plugins as $key=>$plug) { |
|
| 37 | 37 | $liste_plugins[$key] = chemin_plug($racine, $plug); |
| 38 | 38 | $dir_index[dirname($liste_plugins[$key])][] = $key; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $visible = @isset($deplie[$current_dir]); |
| 42 | - $maxiter=1000; |
|
| 42 | + $maxiter = 1000; |
|
| 43 | 43 | |
| 44 | 44 | $res = ''; |
| 45 | - while (count($liste_plugins) && $maxiter--){ |
|
| 45 | + while (count($liste_plugins) && $maxiter--) { |
|
| 46 | 46 | // le rep suivant |
| 47 | 47 | $dir = dirname(reset($liste_plugins)); |
| 48 | 48 | if ($dir != $current_dir) |
| 49 | - $res .= tree_open_close_dir($current_dir,$dir,$deplie); |
|
| 49 | + $res .= tree_open_close_dir($current_dir, $dir, $deplie); |
|
| 50 | 50 | |
| 51 | 51 | // d'abord tous les plugins du rep courant |
| 52 | 52 | if (isset($dir_index[$current_dir])) |
| 53 | - foreach($dir_index[$current_dir] as $key){ |
|
| 53 | + foreach ($dir_index[$current_dir] as $key) { |
|
| 54 | 54 | $plug = $liste_plugins[$key]; |
| 55 | 55 | $actif = @isset($fast_liste_plugins_actifs[$plug]); |
| 56 | - $id = substr(md5($plug),0,16); |
|
| 57 | - $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif, 'menu-entree') . "\n"; |
|
| 56 | + $id = substr(md5($plug), 0, 16); |
|
| 57 | + $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif, 'menu-entree')."\n"; |
|
| 58 | 58 | unset($liste_plugins[$key]); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | - $res .= tree_open_close_dir($current_dir,$init_dir, true); |
|
| 61 | + $res .= tree_open_close_dir($current_dir, $init_dir, true); |
|
| 62 | 62 | |
| 63 | 63 | return "<ul class='menu-liste plugins'>" |
| 64 | 64 | . $res |
@@ -74,32 +74,32 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // http://doc.spip.org/@tree_open_close_dir |
| 77 | -function tree_open_close_dir(&$current,$target,$deplie=array()){ |
|
| 77 | +function tree_open_close_dir(&$current, $target, $deplie = array()) { |
|
| 78 | 78 | if ($current == $target) return ""; |
| 79 | - $tcur = explode("/",$current); |
|
| 80 | - $ttarg = explode("/",$target); |
|
| 79 | + $tcur = explode("/", $current); |
|
| 80 | + $ttarg = explode("/", $target); |
|
| 81 | 81 | $tcom = array(); |
| 82 | 82 | $output = ""; |
| 83 | 83 | // la partie commune |
| 84 | - while (reset($tcur)==reset($ttarg)){ |
|
| 84 | + while (reset($tcur) == reset($ttarg)) { |
|
| 85 | 85 | $tcom[] = array_shift($tcur); |
| 86 | 86 | array_shift($ttarg); |
| 87 | 87 | } |
| 88 | 88 | // fermer les repertoires courant jusqu'au point de fork |
| 89 | - while($close = array_pop($tcur)){ |
|
| 89 | + while ($close = array_pop($tcur)) { |
|
| 90 | 90 | $output .= "</ul>\n"; |
| 91 | 91 | $output .= fin_block(); |
| 92 | 92 | $output .= "</li>\n"; |
| 93 | 93 | } |
| 94 | 94 | $chemin = ""; |
| 95 | 95 | if (count($tcom)) |
| 96 | - $chemin .= implode("/",$tcom)."/"; |
|
| 96 | + $chemin .= implode("/", $tcom)."/"; |
|
| 97 | 97 | // ouvrir les repertoires jusqu'a la cible |
| 98 | - while($open = array_shift($ttarg)){ |
|
| 98 | + while ($open = array_shift($ttarg)) { |
|
| 99 | 99 | $visible = @isset($deplie[$chemin.$open]); |
| 100 | - $chemin .= $open . "/"; |
|
| 100 | + $chemin .= $open."/"; |
|
| 101 | 101 | $output .= "<li>"; |
| 102 | - $output .= bouton_block_depliable($chemin,$visible); |
|
| 102 | + $output .= bouton_block_depliable($chemin, $visible); |
|
| 103 | 103 | $output .= debut_block_depliable($visible); |
| 104 | 104 | |
| 105 | 105 | $output .= "<ul>\n"; |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // http://doc.spip.org/@affiche_arbre_plugins |
| 16 | 18 | function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs){ |
@@ -45,13 +47,15 @@ discard block |
||
| 45 | 47 | while (count($liste_plugins) && $maxiter--){ |
| 46 | 48 | // le rep suivant |
| 47 | 49 | $dir = dirname(reset($liste_plugins)); |
| 48 | - if ($dir != $current_dir) |
|
| 49 | - $res .= tree_open_close_dir($current_dir,$dir,$deplie); |
|
| 50 | + if ($dir != $current_dir) { |
|
| 51 | + $res .= tree_open_close_dir($current_dir,$dir,$deplie); |
|
| 52 | + } |
|
| 50 | 53 | |
| 51 | 54 | // d'abord tous les plugins du rep courant |
| 52 | - if (isset($dir_index[$current_dir])) |
|
| 53 | - foreach($dir_index[$current_dir] as $key){ |
|
| 55 | + if (isset($dir_index[$current_dir])) { |
|
| 56 | + foreach($dir_index[$current_dir] as $key){ |
|
| 54 | 57 | $plug = $liste_plugins[$key]; |
| 58 | + } |
|
| 55 | 59 | $actif = @isset($fast_liste_plugins_actifs[$plug]); |
| 56 | 60 | $id = substr(md5($plug),0,16); |
| 57 | 61 | $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif, 'menu-entree') . "\n"; |
@@ -75,7 +79,9 @@ discard block |
||
| 75 | 79 | |
| 76 | 80 | // http://doc.spip.org/@tree_open_close_dir |
| 77 | 81 | function tree_open_close_dir(&$current,$target,$deplie=array()){ |
| 78 | - if ($current == $target) return ""; |
|
| 82 | + if ($current == $target) { |
|
| 83 | + return ""; |
|
| 84 | + } |
|
| 79 | 85 | $tcur = explode("/",$current); |
| 80 | 86 | $ttarg = explode("/",$target); |
| 81 | 87 | $tcom = array(); |
@@ -92,8 +98,9 @@ discard block |
||
| 92 | 98 | $output .= "</li>\n"; |
| 93 | 99 | } |
| 94 | 100 | $chemin = ""; |
| 95 | - if (count($tcom)) |
|
| 96 | - $chemin .= implode("/",$tcom)."/"; |
|
| 101 | + if (count($tcom)) { |
|
| 102 | + $chemin .= implode("/",$tcom)."/"; |
|
| 103 | + } |
|
| 97 | 104 | // ouvrir les repertoires jusqu'a la cible |
| 98 | 105 | while($open = array_shift($ttarg)){ |
| 99 | 106 | $visible = @isset($deplie[$chemin.$open]); |
@@ -21,6 +21,9 @@ discard block |
||
| 21 | 21 | // Compatibilite : on utilise stripos/strripos() qui n'existent pas en php4 |
| 22 | 22 | if (!function_exists('strripos')) { |
| 23 | 23 | // http://doc.spip.org/@strripos |
| 24 | + /** |
|
| 25 | + * @param string $aiguille |
|
| 26 | + */ |
|
| 24 | 27 | function strripos($botte, $aiguille) { |
| 25 | 28 | if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@is', |
| 26 | 29 | $botte, $regs)) { |
@@ -31,6 +34,9 @@ discard block |
||
| 31 | 34 | } |
| 32 | 35 | if (!function_exists('stripos')) { |
| 33 | 36 | // http://doc.spip.org/@stripos |
| 37 | + /** |
|
| 38 | + * @param string $aiguille |
|
| 39 | + */ |
|
| 34 | 40 | function stripos($botte, $aiguille) { |
| 35 | 41 | if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@isU', |
| 36 | 42 | $botte, $regs)) { |
@@ -21,54 +21,54 @@ |
||
| 21 | 21 | // Compatibilite : on utilise stripos/strripos() qui n'existent pas en php4 |
| 22 | 22 | if (!function_exists('strripos')) { |
| 23 | 23 | // http://doc.spip.org/@strripos |
| 24 | - function strripos($botte, $aiguille) { |
|
| 25 | - if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@is', |
|
| 26 | - $botte, $regs)) { |
|
| 27 | - return strlen($regs[1]); |
|
| 28 | - } |
|
| 29 | - return false; |
|
| 30 | - } |
|
| 24 | + function strripos($botte, $aiguille) { |
|
| 25 | + if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@is', |
|
| 26 | + $botte, $regs)) { |
|
| 27 | + return strlen($regs[1]); |
|
| 28 | + } |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 31 | 31 | } |
| 32 | 32 | if (!function_exists('stripos')) { |
| 33 | 33 | // http://doc.spip.org/@stripos |
| 34 | - function stripos($botte, $aiguille) { |
|
| 35 | - if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@isU', |
|
| 36 | - $botte, $regs)) { |
|
| 37 | - return strlen($regs[1]); |
|
| 38 | - } |
|
| 39 | - return false; |
|
| 40 | - } |
|
| 34 | + function stripos($botte, $aiguille) { |
|
| 35 | + if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@isU', |
|
| 36 | + $botte, $regs)) { |
|
| 37 | + return strlen($regs[1]); |
|
| 38 | + } |
|
| 39 | + return false; |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // http://doc.spip.org/@affiche_boutons_admin |
| 44 | 44 | function affiche_boutons_admin($contenu) { |
| 45 | - include_spip('inc/filtres'); |
|
| 45 | + include_spip('inc/filtres'); |
|
| 46 | 46 | |
| 47 | - // Inserer le css d'admin |
|
| 48 | - $css = "<link rel='stylesheet' href='".url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 49 | - . "' type='text/css' />\n"; |
|
| 50 | - if ($f = find_in_path('spip_admin_perso.css')) |
|
| 51 | - $css .= "<link rel='stylesheet' href='" |
|
| 52 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 47 | + // Inserer le css d'admin |
|
| 48 | + $css = "<link rel='stylesheet' href='".url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 49 | + . "' type='text/css' />\n"; |
|
| 50 | + if ($f = find_in_path('spip_admin_perso.css')) |
|
| 51 | + $css .= "<link rel='stylesheet' href='" |
|
| 52 | + . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 53 | 53 | |
| 54 | - ($pos = stripos($contenu, '</head>')) |
|
| 55 | - || ($pos = stripos($contenu, '<body>')) |
|
| 56 | - || ($pos = 0); |
|
| 57 | - $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 54 | + ($pos = stripos($contenu, '</head>')) |
|
| 55 | + || ($pos = stripos($contenu, '<body>')) |
|
| 56 | + || ($pos = 0); |
|
| 57 | + $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | - // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 61 | - $boutons_admin = inclure_balise_dynamique( |
|
| 62 | - balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 63 | - false); |
|
| 60 | + // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 61 | + $boutons_admin = inclure_balise_dynamique( |
|
| 62 | + balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 63 | + false); |
|
| 64 | 64 | |
| 65 | - ($pos = strripos($contenu, '</body>')) |
|
| 66 | - || ($pos = strripos($contenu, '</html>')) |
|
| 67 | - || ($pos = strlen($contenu)); |
|
| 68 | - $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 65 | + ($pos = strripos($contenu, '</body>')) |
|
| 66 | + || ($pos = strripos($contenu, '</html>')) |
|
| 67 | + || ($pos = strlen($contenu)); |
|
| 68 | + $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - return $contenu; |
|
| 71 | + return $contenu; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | ?> |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if (!function_exists('strripos')) { |
| 23 | 23 | // http://doc.spip.org/@strripos |
| 24 | 24 | function strripos($botte, $aiguille) { |
| 25 | - if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@is', |
|
| 25 | + if (preg_match('@^(.*)'.preg_quote($aiguille, '@').'@is', |
|
| 26 | 26 | $botte, $regs)) { |
| 27 | 27 | return strlen($regs[1]); |
| 28 | 28 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | if (!function_exists('stripos')) { |
| 33 | 33 | // http://doc.spip.org/@stripos |
| 34 | 34 | function stripos($botte, $aiguille) { |
| 35 | - if (preg_match('@^(.*)' . preg_quote($aiguille, '@') . '@isU', |
|
| 35 | + if (preg_match('@^(.*)'.preg_quote($aiguille, '@').'@isU', |
|
| 36 | 36 | $botte, $regs)) { |
| 37 | 37 | return strlen($regs[1]); |
| 38 | 38 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | . "' type='text/css' />\n"; |
| 50 | 50 | if ($f = find_in_path('spip_admin_perso.css')) |
| 51 | 51 | $css .= "<link rel='stylesheet' href='" |
| 52 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 52 | + . url_absolue(direction_css($f))."' type='text/css' />\n"; |
|
| 53 | 53 | |
| 54 | 54 | ($pos = stripos($contenu, '</head>')) |
| 55 | 55 | || ($pos = stripos($contenu, '<body>')) |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | // Inserer la feuille de style selon les normes, dans le <head> |
| 17 | 19 | // puis les boutons |
@@ -47,9 +49,10 @@ discard block |
||
| 47 | 49 | // Inserer le css d'admin |
| 48 | 50 | $css = "<link rel='stylesheet' href='".url_absolue(direction_css(find_in_path('spip_admin.css'))) |
| 49 | 51 | . "' type='text/css' />\n"; |
| 50 | - if ($f = find_in_path('spip_admin_perso.css')) |
|
| 51 | - $css .= "<link rel='stylesheet' href='" |
|
| 52 | + if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 53 | + $css .= "<link rel='stylesheet' href='" |
|
| 52 | 54 | . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
| 55 | + } |
|
| 53 | 56 | |
| 54 | 57 | ($pos = stripos($contenu, '</head>')) |
| 55 | 58 | || ($pos = stripos($contenu, '<body>')) |
@@ -71,6 +71,9 @@ |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | +/** |
|
| 75 | + * @param string $nom |
|
| 76 | + */ |
|
| 74 | 77 | function phraser_logo_faux_filtres($nom) |
| 75 | 78 | { |
| 76 | 79 | switch($nom) { |
@@ -24,65 +24,65 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | function phraser_vieux_logos(&$p) |
| 26 | 26 | { |
| 27 | - if ($p->param[0][0]) |
|
| 28 | - $args = array(''); |
|
| 29 | - else { |
|
| 30 | - $args = array_shift($p->param); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - foreach($p->param as $couple) { |
|
| 34 | - $nom = trim($couple[0]); |
|
| 35 | - if ($nom == '') {array_shift($p->param); break;} |
|
| 36 | - $r = phraser_logo_faux_filtres($nom); |
|
| 37 | - if ($r === 0) { |
|
| 38 | - $c = new Texte; |
|
| 39 | - $c->texte = $nom; |
|
| 40 | - $args[] = array($c); |
|
| 41 | - array_shift($p->param); |
|
| 42 | - spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 43 | - } elseif ($r === 2) { |
|
| 44 | - $p->etoile = '**'; |
|
| 45 | - array_shift($p->param); |
|
| 46 | - spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 47 | - } elseif ($r === 1) { |
|
| 48 | - array_shift($p->param); |
|
| 49 | - $p->etoile = '*'; |
|
| 50 | - spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 51 | - |
|
| 52 | - } elseif (preg_match("/^".NOM_DE_CHAMP.'(.*)$/sS', $nom, $m)) { |
|
| 53 | - $champ = new Champ(); |
|
| 54 | - $champ->nom_boucle = $m[2]; |
|
| 55 | - $champ->nom_champ = $m[3]; |
|
| 56 | - $champ->etoile = $m[5]; |
|
| 57 | - $champ = array($champ); |
|
| 58 | - if ($m[6]) { |
|
| 59 | - $r = new Texte; |
|
| 60 | - $r->texte = $m[6]; |
|
| 61 | - $champ[]= $r; |
|
| 62 | - } |
|
| 63 | - $args[]= $champ; |
|
| 64 | - array_shift($p->param); |
|
| 65 | - spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 66 | - |
|
| 67 | - } // le cas else est la seule incompatibilite |
|
| 68 | - |
|
| 69 | - } |
|
| 70 | - array_unshift($p->param, $args); |
|
| 27 | + if ($p->param[0][0]) |
|
| 28 | + $args = array(''); |
|
| 29 | + else { |
|
| 30 | + $args = array_shift($p->param); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + foreach($p->param as $couple) { |
|
| 34 | + $nom = trim($couple[0]); |
|
| 35 | + if ($nom == '') {array_shift($p->param); break;} |
|
| 36 | + $r = phraser_logo_faux_filtres($nom); |
|
| 37 | + if ($r === 0) { |
|
| 38 | + $c = new Texte; |
|
| 39 | + $c->texte = $nom; |
|
| 40 | + $args[] = array($c); |
|
| 41 | + array_shift($p->param); |
|
| 42 | + spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 43 | + } elseif ($r === 2) { |
|
| 44 | + $p->etoile = '**'; |
|
| 45 | + array_shift($p->param); |
|
| 46 | + spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 47 | + } elseif ($r === 1) { |
|
| 48 | + array_shift($p->param); |
|
| 49 | + $p->etoile = '*'; |
|
| 50 | + spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 51 | + |
|
| 52 | + } elseif (preg_match("/^".NOM_DE_CHAMP.'(.*)$/sS', $nom, $m)) { |
|
| 53 | + $champ = new Champ(); |
|
| 54 | + $champ->nom_boucle = $m[2]; |
|
| 55 | + $champ->nom_champ = $m[3]; |
|
| 56 | + $champ->etoile = $m[5]; |
|
| 57 | + $champ = array($champ); |
|
| 58 | + if ($m[6]) { |
|
| 59 | + $r = new Texte; |
|
| 60 | + $r->texte = $m[6]; |
|
| 61 | + $champ[]= $r; |
|
| 62 | + } |
|
| 63 | + $args[]= $champ; |
|
| 64 | + array_shift($p->param); |
|
| 65 | + spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
|
| 66 | + |
|
| 67 | + } // le cas else est la seule incompatibilite |
|
| 68 | + |
|
| 69 | + } |
|
| 70 | + array_unshift($p->param, $args); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | function phraser_logo_faux_filtres($nom) |
| 75 | 75 | { |
| 76 | - switch($nom) { |
|
| 77 | - case 'top': |
|
| 78 | - case 'left': |
|
| 79 | - case 'right': |
|
| 80 | - case 'center': |
|
| 81 | - case 'bottom': return 0; |
|
| 82 | - case 'lien': return 1; |
|
| 83 | - case 'fichier': return 2; |
|
| 84 | - default: return $nom; |
|
| 85 | - } |
|
| 76 | + switch($nom) { |
|
| 77 | + case 'top': |
|
| 78 | + case 'left': |
|
| 79 | + case 'right': |
|
| 80 | + case 'center': |
|
| 81 | + case 'bottom': return 0; |
|
| 82 | + case 'lien': return 1; |
|
| 83 | + case 'fichier': return 2; |
|
| 84 | + default: return $nom; |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -90,64 +90,64 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | function phraser_vieux_emb(&$p) |
| 92 | 92 | { |
| 93 | - if (!is_array($p->param)) |
|
| 94 | - $p->param=array(); |
|
| 95 | - |
|
| 96 | - // Produire le premier argument {emb} |
|
| 97 | - $texte = new Texte; |
|
| 98 | - $texte->texte='emb'; |
|
| 99 | - $param = array('', array($texte)); |
|
| 100 | - |
|
| 101 | - // Transformer les filtres en arguments |
|
| 102 | - for ($i=0; $i<count($p->param); $i++) { |
|
| 103 | - if ($p->param[$i][0]) { |
|
| 104 | - if (!strstr($p->param[$i][0], '=')) |
|
| 105 | - break;# on a rencontre un vrai filtre, c'est fini |
|
| 106 | - $texte = new Texte; |
|
| 107 | - $texte->texte=$p->param[$i][0]; |
|
| 108 | - $param[] = array($texte); |
|
| 109 | - } |
|
| 110 | - array_shift($p->param); |
|
| 111 | - } |
|
| 112 | - array_unshift($p->param, $param); |
|
| 113 | - spip_log('balise EMBED_DOCUMENT obsolete', 'vieilles_defs'); |
|
| 114 | - $p->nom_champ = 'MODELE'; |
|
| 93 | + if (!is_array($p->param)) |
|
| 94 | + $p->param=array(); |
|
| 95 | + |
|
| 96 | + // Produire le premier argument {emb} |
|
| 97 | + $texte = new Texte; |
|
| 98 | + $texte->texte='emb'; |
|
| 99 | + $param = array('', array($texte)); |
|
| 100 | + |
|
| 101 | + // Transformer les filtres en arguments |
|
| 102 | + for ($i=0; $i<count($p->param); $i++) { |
|
| 103 | + if ($p->param[$i][0]) { |
|
| 104 | + if (!strstr($p->param[$i][0], '=')) |
|
| 105 | + break;# on a rencontre un vrai filtre, c'est fini |
|
| 106 | + $texte = new Texte; |
|
| 107 | + $texte->texte=$p->param[$i][0]; |
|
| 108 | + $param[] = array($texte); |
|
| 109 | + } |
|
| 110 | + array_shift($p->param); |
|
| 111 | + } |
|
| 112 | + array_unshift($p->param, $param); |
|
| 113 | + spip_log('balise EMBED_DOCUMENT obsolete', 'vieilles_defs'); |
|
| 114 | + $p->nom_champ = 'MODELE'; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Vieux formulaire de recherch |
| 118 | 118 | |
| 119 | 119 | function phraser_vieux_recherche($p) |
| 120 | 120 | { |
| 121 | - if ($p->param[0][0]) { |
|
| 122 | - $c = new Texte; |
|
| 123 | - $c->texte = $p->param[0][0]; |
|
| 124 | - $p->param[0][1] = array($c); |
|
| 125 | - $p->param[0][0] = ''; |
|
| 126 | - $p->fonctions = array(); |
|
| 127 | - spip_log('FORMULAIRE_RECHERCHE avec filtre ' . $c->texte, 'vieilles_defs'); |
|
| 128 | - } |
|
| 121 | + if ($p->param[0][0]) { |
|
| 122 | + $c = new Texte; |
|
| 123 | + $c->texte = $p->param[0][0]; |
|
| 124 | + $p->param[0][1] = array($c); |
|
| 125 | + $p->param[0][0] = ''; |
|
| 126 | + $p->fonctions = array(); |
|
| 127 | + spip_log('FORMULAIRE_RECHERCHE avec filtre ' . $c->texte, 'vieilles_defs'); |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Gerer la notation [(#EXPOSER|on,off)] |
| 132 | 132 | function phraser_vieux_exposer($p) |
| 133 | 133 | { |
| 134 | - if ($a = $p->fonctions) { |
|
| 135 | - preg_match("#([^,]*)(,(.*))?#", $a[0][0], $regs); |
|
| 136 | - $args = array(); |
|
| 137 | - if ($regs[1]) { |
|
| 138 | - $a = new Texte; |
|
| 139 | - $a->texte = $regs[1]; |
|
| 140 | - $args = array('', array($a)); |
|
| 141 | - if ($regs[3]) { |
|
| 142 | - $a = new Texte; |
|
| 143 | - $a->texte = $regs[3]; |
|
| 144 | - $args[] = array($a); |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - $p->param[0] = $args; |
|
| 148 | - $p->fonctions = array(); |
|
| 149 | - $p->nom_champ = 'EXPOSE'; |
|
| 150 | - } |
|
| 134 | + if ($a = $p->fonctions) { |
|
| 135 | + preg_match("#([^,]*)(,(.*))?#", $a[0][0], $regs); |
|
| 136 | + $args = array(); |
|
| 137 | + if ($regs[1]) { |
|
| 138 | + $a = new Texte; |
|
| 139 | + $a->texte = $regs[1]; |
|
| 140 | + $args = array('', array($a)); |
|
| 141 | + if ($regs[3]) { |
|
| 142 | + $a = new Texte; |
|
| 143 | + $a->texte = $regs[3]; |
|
| 144 | + $args[] = array($a); |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + $p->param[0] = $args; |
|
| 148 | + $p->fonctions = array(); |
|
| 149 | + $p->nom_champ = 'EXPOSE'; |
|
| 150 | + } |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | function phraser_vieux_modele($p) {normaliser_args_inclumodel($p);} |
@@ -155,46 +155,46 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | function normaliser_args_inclumodel($p) |
| 157 | 157 | { |
| 158 | - $params = $p->param; |
|
| 159 | - if (!$params) return; |
|
| 160 | - $args = $params[0]; |
|
| 161 | - if ($args[0]) return; // filtre immediat |
|
| 162 | - array_shift($p->param); |
|
| 163 | - foreach ($p->param as $l) { |
|
| 164 | - if (!array_shift($l)) { |
|
| 165 | - $args = array_merge($args, $l); |
|
| 166 | - array_shift($p->param); |
|
| 167 | - } else break; // filtre |
|
| 168 | - } |
|
| 169 | - array_unshift($p->param, $args); |
|
| 158 | + $params = $p->param; |
|
| 159 | + if (!$params) return; |
|
| 160 | + $args = $params[0]; |
|
| 161 | + if ($args[0]) return; // filtre immediat |
|
| 162 | + array_shift($p->param); |
|
| 163 | + foreach ($p->param as $l) { |
|
| 164 | + if (!array_shift($l)) { |
|
| 165 | + $args = array_merge($args, $l); |
|
| 166 | + array_shift($p->param); |
|
| 167 | + } else break; // filtre |
|
| 168 | + } |
|
| 169 | + array_unshift($p->param, $args); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | function normaliser_inclure($champ) |
| 173 | 173 | { |
| 174 | - normaliser_args_inclumodel($champ); |
|
| 175 | - $l = $champ->param[0]; |
|
| 176 | - if (is_array($l) AND !$l[0]) { |
|
| 177 | - foreach ($l as $k => $p) { |
|
| 178 | - if ($p AND $p[0]->type == 'texte' AND !strpos($p[0]->texte,'=')) { |
|
| 179 | - $p[0]->texte = trim($p[0]->texte); |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - foreach ($l as $k => $p) { |
|
| 183 | - if (!$p OR $p[0]->type != 'texte' OR |
|
| 184 | - !preg_match('/^fond\s*=\s*(.*)$/',$p[0]->texte, $r)) |
|
| 185 | - continue; |
|
| 186 | - |
|
| 187 | - if ($r[1]) |
|
| 188 | - $p[0]->texte = $r[1]; |
|
| 189 | - else unset($p[0]); |
|
| 190 | - $champ->texte = $p; |
|
| 191 | - unset($champ->param[0][$k]); |
|
| 192 | - if (count($champ->param[0]) ==1) |
|
| 193 | - array_shift($champ->param); |
|
| 194 | - return; |
|
| 195 | - } |
|
| 196 | - } |
|
| 197 | - spip_log("inclure sans fond ni fichier"); |
|
| 174 | + normaliser_args_inclumodel($champ); |
|
| 175 | + $l = $champ->param[0]; |
|
| 176 | + if (is_array($l) AND !$l[0]) { |
|
| 177 | + foreach ($l as $k => $p) { |
|
| 178 | + if ($p AND $p[0]->type == 'texte' AND !strpos($p[0]->texte,'=')) { |
|
| 179 | + $p[0]->texte = trim($p[0]->texte); |
|
| 180 | + } |
|
| 181 | + } |
|
| 182 | + foreach ($l as $k => $p) { |
|
| 183 | + if (!$p OR $p[0]->type != 'texte' OR |
|
| 184 | + !preg_match('/^fond\s*=\s*(.*)$/',$p[0]->texte, $r)) |
|
| 185 | + continue; |
|
| 186 | + |
|
| 187 | + if ($r[1]) |
|
| 188 | + $p[0]->texte = $r[1]; |
|
| 189 | + else unset($p[0]); |
|
| 190 | + $champ->texte = $p; |
|
| 191 | + unset($champ->param[0][$k]); |
|
| 192 | + if (count($champ->param[0]) ==1) |
|
| 193 | + array_shift($champ->param); |
|
| 194 | + return; |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + spip_log("inclure sans fond ni fichier"); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | ?> |
@@ -74,14 +74,14 @@ |
||
| 74 | 74 | function phraser_logo_faux_filtres($nom) |
| 75 | 75 | { |
| 76 | 76 | switch($nom) { |
| 77 | - case 'top': |
|
| 78 | - case 'left': |
|
| 79 | - case 'right': |
|
| 80 | - case 'center': |
|
| 81 | - case 'bottom': return 0; |
|
| 82 | - case 'lien': return 1; |
|
| 83 | - case 'fichier': return 2; |
|
| 84 | - default: return $nom; |
|
| 77 | + case 'top': |
|
| 78 | + case 'left': |
|
| 79 | + case 'right': |
|
| 80 | + case 'center': |
|
| 81 | + case 'bottom': return 0; |
|
| 82 | + case 'lien': return 1; |
|
| 83 | + case 'fichier': return 2; |
|
| 84 | + default: return $nom; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | $args = array_shift($p->param); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - foreach($p->param as $couple) { |
|
| 33 | + foreach ($p->param as $couple) { |
|
| 34 | 34 | $nom = trim($couple[0]); |
| 35 | - if ($nom == '') {array_shift($p->param); break;} |
|
| 35 | + if ($nom == '') {array_shift($p->param); break; } |
|
| 36 | 36 | $r = phraser_logo_faux_filtres($nom); |
| 37 | 37 | if ($r === 0) { |
| 38 | 38 | $c = new Texte; |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | if ($m[6]) { |
| 59 | 59 | $r = new Texte; |
| 60 | 60 | $r->texte = $m[6]; |
| 61 | - $champ[]= $r; |
|
| 61 | + $champ[] = $r; |
|
| 62 | 62 | } |
| 63 | - $args[]= $champ; |
|
| 63 | + $args[] = $champ; |
|
| 64 | 64 | array_shift($p->param); |
| 65 | 65 | spip_log("filtre de logo obsolete $nom", 'vieilles_defs'); |
| 66 | 66 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | function phraser_logo_faux_filtres($nom) |
| 75 | 75 | { |
| 76 | - switch($nom) { |
|
| 76 | + switch ($nom) { |
|
| 77 | 77 | case 'top': |
| 78 | 78 | case 'left': |
| 79 | 79 | case 'right': |
@@ -91,20 +91,20 @@ discard block |
||
| 91 | 91 | function phraser_vieux_emb(&$p) |
| 92 | 92 | { |
| 93 | 93 | if (!is_array($p->param)) |
| 94 | - $p->param=array(); |
|
| 94 | + $p->param = array(); |
|
| 95 | 95 | |
| 96 | 96 | // Produire le premier argument {emb} |
| 97 | 97 | $texte = new Texte; |
| 98 | - $texte->texte='emb'; |
|
| 98 | + $texte->texte = 'emb'; |
|
| 99 | 99 | $param = array('', array($texte)); |
| 100 | 100 | |
| 101 | 101 | // Transformer les filtres en arguments |
| 102 | - for ($i=0; $i<count($p->param); $i++) { |
|
| 102 | + for ($i = 0; $i < count($p->param); $i++) { |
|
| 103 | 103 | if ($p->param[$i][0]) { |
| 104 | 104 | if (!strstr($p->param[$i][0], '=')) |
| 105 | - break;# on a rencontre un vrai filtre, c'est fini |
|
| 105 | + break; # on a rencontre un vrai filtre, c'est fini |
|
| 106 | 106 | $texte = new Texte; |
| 107 | - $texte->texte=$p->param[$i][0]; |
|
| 107 | + $texte->texte = $p->param[$i][0]; |
|
| 108 | 108 | $param[] = array($texte); |
| 109 | 109 | } |
| 110 | 110 | array_shift($p->param); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $p->param[0][1] = array($c); |
| 125 | 125 | $p->param[0][0] = ''; |
| 126 | 126 | $p->fonctions = array(); |
| 127 | - spip_log('FORMULAIRE_RECHERCHE avec filtre ' . $c->texte, 'vieilles_defs'); |
|
| 127 | + spip_log('FORMULAIRE_RECHERCHE avec filtre '.$c->texte, 'vieilles_defs'); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -function phraser_vieux_modele($p) {normaliser_args_inclumodel($p);} |
|
| 154 | -function phraser_vieux_inclu($p) {normaliser_args_inclumodel($p);} |
|
| 153 | +function phraser_vieux_modele($p) {normaliser_args_inclumodel($p); } |
|
| 154 | +function phraser_vieux_inclu($p) {normaliser_args_inclumodel($p); } |
|
| 155 | 155 | |
| 156 | 156 | function normaliser_args_inclumodel($p) |
| 157 | 157 | { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | if ($args[0]) return; // filtre immediat |
| 162 | 162 | array_shift($p->param); |
| 163 | 163 | foreach ($p->param as $l) { |
| 164 | - if (!array_shift($l)) { |
|
| 164 | + if (!array_shift($l)) { |
|
| 165 | 165 | $args = array_merge($args, $l); |
| 166 | 166 | array_shift($p->param); |
| 167 | 167 | } else break; // filtre |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | $l = $champ->param[0]; |
| 176 | 176 | if (is_array($l) AND !$l[0]) { |
| 177 | 177 | foreach ($l as $k => $p) { |
| 178 | - if ($p AND $p[0]->type == 'texte' AND !strpos($p[0]->texte,'=')) { |
|
| 178 | + if ($p AND $p[0]->type == 'texte' AND !strpos($p[0]->texte, '=')) { |
|
| 179 | 179 | $p[0]->texte = trim($p[0]->texte); |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | foreach ($l as $k => $p) { |
| 183 | 183 | if (!$p OR $p[0]->type != 'texte' OR |
| 184 | - !preg_match('/^fond\s*=\s*(.*)$/',$p[0]->texte, $r)) |
|
| 184 | + !preg_match('/^fond\s*=\s*(.*)$/', $p[0]->texte, $r)) |
|
| 185 | 185 | continue; |
| 186 | 186 | |
| 187 | 187 | if ($r[1]) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | else unset($p[0]); |
| 190 | 190 | $champ->texte = $p; |
| 191 | 191 | unset($champ->param[0][$k]); |
| 192 | - if (count($champ->param[0]) ==1) |
|
| 192 | + if (count($champ->param[0]) == 1) |
|
| 193 | 193 | array_shift($champ->param); |
| 194 | 194 | return; |
| 195 | 195 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // Les fonctions de ce fichier sont appelees en certains points |
| 16 | 18 | // de l'analyseur syntaxique afin de normaliser de vieilles syntaxes, |
@@ -24,9 +26,9 @@ discard block |
||
| 24 | 26 | |
| 25 | 27 | function phraser_vieux_logos(&$p) |
| 26 | 28 | { |
| 27 | - if ($p->param[0][0]) |
|
| 28 | - $args = array(''); |
|
| 29 | - else { |
|
| 29 | + if ($p->param[0][0]) { |
|
| 30 | + $args = array(''); |
|
| 31 | + } else { |
|
| 30 | 32 | $args = array_shift($p->param); |
| 31 | 33 | } |
| 32 | 34 | |
@@ -90,8 +92,9 @@ discard block |
||
| 90 | 92 | |
| 91 | 93 | function phraser_vieux_emb(&$p) |
| 92 | 94 | { |
| 93 | - if (!is_array($p->param)) |
|
| 94 | - $p->param=array(); |
|
| 95 | + if (!is_array($p->param)) { |
|
| 96 | + $p->param=array(); |
|
| 97 | + } |
|
| 95 | 98 | |
| 96 | 99 | // Produire le premier argument {emb} |
| 97 | 100 | $texte = new Texte; |
@@ -101,8 +104,10 @@ discard block |
||
| 101 | 104 | // Transformer les filtres en arguments |
| 102 | 105 | for ($i=0; $i<count($p->param); $i++) { |
| 103 | 106 | if ($p->param[$i][0]) { |
| 104 | - if (!strstr($p->param[$i][0], '=')) |
|
| 105 | - break;# on a rencontre un vrai filtre, c'est fini |
|
| 107 | + if (!strstr($p->param[$i][0], '=')) { |
|
| 108 | + break; |
|
| 109 | + } |
|
| 110 | + # on a rencontre un vrai filtre, c'est fini |
|
| 106 | 111 | $texte = new Texte; |
| 107 | 112 | $texte->texte=$p->param[$i][0]; |
| 108 | 113 | $param[] = array($texte); |
@@ -156,15 +161,23 @@ discard block |
||
| 156 | 161 | function normaliser_args_inclumodel($p) |
| 157 | 162 | { |
| 158 | 163 | $params = $p->param; |
| 159 | - if (!$params) return; |
|
| 164 | + if (!$params) { |
|
| 165 | + return; |
|
| 166 | + } |
|
| 160 | 167 | $args = $params[0]; |
| 161 | - if ($args[0]) return; // filtre immediat |
|
| 168 | + if ($args[0]) { |
|
| 169 | + return; |
|
| 170 | + } |
|
| 171 | + // filtre immediat |
|
| 162 | 172 | array_shift($p->param); |
| 163 | 173 | foreach ($p->param as $l) { |
| 164 | 174 | if (!array_shift($l)) { |
| 165 | 175 | $args = array_merge($args, $l); |
| 166 | 176 | array_shift($p->param); |
| 167 | - } else break; // filtre |
|
| 177 | + } else { |
|
| 178 | + break; |
|
| 179 | + } |
|
| 180 | + // filtre |
|
| 168 | 181 | } |
| 169 | 182 | array_unshift($p->param, $args); |
| 170 | 183 | } |
@@ -181,16 +194,20 @@ discard block |
||
| 181 | 194 | } |
| 182 | 195 | foreach ($l as $k => $p) { |
| 183 | 196 | if (!$p OR $p[0]->type != 'texte' OR |
| 184 | - !preg_match('/^fond\s*=\s*(.*)$/',$p[0]->texte, $r)) |
|
| 185 | - continue; |
|
| 197 | + !preg_match('/^fond\s*=\s*(.*)$/',$p[0]->texte, $r)) { |
|
| 198 | + continue; |
|
| 199 | + } |
|
| 186 | 200 | |
| 187 | - if ($r[1]) |
|
| 188 | - $p[0]->texte = $r[1]; |
|
| 189 | - else unset($p[0]); |
|
| 201 | + if ($r[1]) { |
|
| 202 | + $p[0]->texte = $r[1]; |
|
| 203 | + } else { |
|
| 204 | + unset($p[0]); |
|
| 205 | + } |
|
| 190 | 206 | $champ->texte = $p; |
| 191 | 207 | unset($champ->param[0][$k]); |
| 192 | - if (count($champ->param[0]) ==1) |
|
| 193 | - array_shift($champ->param); |
|
| 208 | + if (count($champ->param[0]) ==1) { |
|
| 209 | + array_shift($champ->param); |
|
| 210 | + } |
|
| 194 | 211 | return; |
| 195 | 212 | } |
| 196 | 213 | } |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | * http://doc.spip.org/@tester_redirection |
| 184 | 184 | * |
| 185 | 185 | * @param string $fond |
| 186 | - * @param array $contexte |
|
| 186 | + * @param string $contexte |
|
| 187 | 187 | * @param string $connect |
| 188 | 188 | * @return array|bool |
| 189 | 189 | */ |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | // NB: mes_fonctions peut initialiser $dossier_squelettes (old-style) |
| 18 | 18 | // donc il faut l'inclure "en globals" |
| 19 | 19 | if ($f = find_in_path('mes_fonctions.php')) { |
| 20 | - global $dossier_squelettes; |
|
| 21 | - include_once(_ROOT_CWD . $f); |
|
| 20 | + global $dossier_squelettes; |
|
| 21 | + include_once(_ROOT_CWD . $f); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (@is_readable(_CACHE_PLUGINS_FCT)) { |
| 25 | - // chargement optimise precompile |
|
| 26 | - include_once(_CACHE_PLUGINS_FCT); |
|
| 25 | + // chargement optimise precompile |
|
| 26 | + include_once(_CACHE_PLUGINS_FCT); |
|
| 27 | 27 | } |
| 28 | 28 | if (test_espace_prive ()) |
| 29 | - include_spip('inc/filtres_ecrire'); |
|
| 29 | + include_spip('inc/filtres_ecrire'); |
|
| 30 | 30 | |
| 31 | 31 | # Determine le squelette associe a une requete |
| 32 | 32 | # et l'applique sur le contexte, le nom du cache et le serveur |
@@ -43,158 +43,158 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // http://doc.spip.org/@public_parametrer_dist |
| 45 | 45 | function public_parametrer_dist($fond, $contexte='', $cache='', $connect='') { |
| 46 | - static $composer,$styliser,$notes=null; |
|
| 47 | - $page = tester_redirection($fond, $contexte, $connect); |
|
| 48 | - if ($page) return $page; |
|
| 49 | - |
|
| 50 | - if (isset($contexte['lang'])) |
|
| 51 | - $lang = $contexte['lang']; |
|
| 52 | - elseif (!isset($lang)) |
|
| 53 | - $lang = $GLOBALS['meta']['langue_site']; |
|
| 54 | - |
|
| 55 | - $select = ((!isset($GLOBALS['forcer_lang']) OR !$GLOBALS['forcer_lang']) AND $lang <> $GLOBALS['spip_lang']); |
|
| 56 | - if ($select) $select = lang_select($lang); |
|
| 57 | - |
|
| 58 | - $debug = (defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
|
| 59 | - |
|
| 60 | - if (!$styliser) |
|
| 61 | - $styliser = charger_fonction('styliser', 'public'); |
|
| 62 | - list($skel,$mime_type, $gram, $sourcefile) = |
|
| 63 | - $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect); |
|
| 64 | - |
|
| 65 | - if ($skel) { |
|
| 66 | - |
|
| 67 | - // sauver le nom de l'eventuel squelette en cours d'execution |
|
| 68 | - // (recursion possible a cause des modeles) |
|
| 69 | - if ($debug) { |
|
| 70 | - $courant = @$GLOBALS['debug_objets']['courant']; |
|
| 71 | - $GLOBALS['debug_objets']['contexte'][$sourcefile] = $contexte; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // charger le squelette en specifiant les langages cibles et source |
|
| 75 | - // au cas il faudrait le compiler (source posterieure au resultat) |
|
| 76 | - |
|
| 77 | - if (!$composer) |
|
| 78 | - $composer = charger_fonction('composer', 'public'); |
|
| 79 | - $fonc = $composer($skel, $mime_type, $gram, $sourcefile, $connect); |
|
| 80 | - } |
|
| 81 | - else |
|
| 82 | - $fonc = ''; |
|
| 83 | - |
|
| 84 | - if (!$fonc) { // squelette inconnu (==='') ou faux (===false) |
|
| 85 | - $page = $fonc; |
|
| 86 | - } |
|
| 87 | - else { |
|
| 88 | - // Preparer l'appel de la fonction principale du squelette |
|
| 89 | - |
|
| 90 | - spip_timer($a = 'calcul page '.rand(0,1000)); |
|
| 91 | - |
|
| 92 | - // On cree un marqueur de notes unique lie a cette composition |
|
| 93 | - // et on enregistre l'etat courant des globales de notes... |
|
| 94 | - if (is_null($notes)) |
|
| 95 | - $notes = charger_fonction('notes', 'inc', true); |
|
| 96 | - if ($notes) |
|
| 97 | - $notes('','empiler'); |
|
| 98 | - |
|
| 99 | - // Rajouter d'office ces deux parametres |
|
| 100 | - // (mais vaudrait mieux que le compilateur sache le simuler |
|
| 101 | - // car ca interdit l'usage de criteres conditionnels dessus). |
|
| 102 | - if (!isset($contexte['date'])) { |
|
| 103 | - $contexte['date'] = date("Y-m-d H:i:s"); |
|
| 104 | - $contexte['date_default'] = true; |
|
| 105 | - } else $contexte['date'] = normaliser_date($contexte['date'], true); |
|
| 106 | - |
|
| 107 | - if (!isset($contexte['date_redac'])) { |
|
| 108 | - $contexte['date_redac'] = date("Y-m-d H:i:s"); |
|
| 109 | - $contexte['date_redac_default'] = true; |
|
| 110 | - } else $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true); |
|
| 111 | - |
|
| 112 | - // Passer le nom du cache pour produire sa destruction automatique |
|
| 113 | - $page = $fonc(array('cache' => $cache), array($contexte)); |
|
| 114 | - |
|
| 115 | - // Restituer les globales de notes telles qu'elles etaient avant l'appel |
|
| 116 | - // Si l'inclus n'a pas affiche ses notes, tant pis (elles *doivent* |
|
| 117 | - // etre dans son resultat, autrement elles ne seraient pas prises en |
|
| 118 | - // compte a chaque calcul d'un texte contenant un modele, mais seulement |
|
| 119 | - // quand le modele serait calcule, et on aurait des resultats incoherents) |
|
| 120 | - if ($notes) |
|
| 121 | - $notes('','depiler'); |
|
| 122 | - |
|
| 123 | - // reinjecter en dynamique la pile des notes |
|
| 124 | - // si il y a des inclure dynamiques |
|
| 125 | - // si la pile n'est pas vide |
|
| 126 | - // la generalisation de cette injection permettrait de corriger le point juste au dessus |
|
| 127 | - // en faisant remonter les notes a l'incluant (A tester et valider avant application) |
|
| 128 | - if ($notes) |
|
| 129 | - $page['notes'] = $notes('','sauver_etat'); |
|
| 130 | - |
|
| 131 | - // spip_log: un joli contexte |
|
| 132 | - $infos = array(); |
|
| 133 | - foreach (array_filter($contexte) as $var => $val) { |
|
| 134 | - if (is_array($val)) $val = serialize($val); |
|
| 135 | - if (strlen("$val") > 30) |
|
| 136 | - $val = substr("$val", 0,27).'..'; |
|
| 137 | - if (strstr($val,' ')) |
|
| 138 | - $val = "'$val'"; |
|
| 139 | - $infos[] = $var.'='.$val; |
|
| 140 | - } |
|
| 141 | - $profile = spip_timer($a); |
|
| 142 | - spip_log("calcul ($profile) [$skel] " |
|
| 143 | - . join(', ', $infos) |
|
| 144 | - .' ('.strlen($page['texte']).' octets)'); |
|
| 145 | - |
|
| 146 | - if (defined('_CALCUL_PROFILER') AND intval($profile)>_CALCUL_PROFILER){ |
|
| 147 | - spip_log("calcul ($profile) [$skel] " |
|
| 148 | - . join(', ', $infos) |
|
| 149 | - .' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'],"profiler"._LOG_AVERTISSEMENT); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if ($debug) { |
|
| 153 | - // si c'est ce que demande le debusqueur, lui passer la main |
|
| 154 | - $t = strlen($page['texte']) ? $page['texte'] : " "; |
|
| 155 | - $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t; |
|
| 156 | - $GLOBALS['debug_objets']['courant'] = $courant; |
|
| 157 | - $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile; |
|
| 158 | - if ($GLOBALS['debug_objets']['sourcefile'] |
|
| 159 | - AND (_request('var_mode_objet') == $fonc) |
|
| 160 | - AND (_request('var_mode_affiche') == 'resultat')) { |
|
| 161 | - erreur_squelette(); |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - // Si #CACHE{} n'etait pas la, le mettre a $delais |
|
| 165 | - if (!isset($page['entetes']['X-Spip-Cache'])){ |
|
| 166 | - // Dans l'espace prive ou dans un modeles/ on pose un cache 0 par defaut |
|
| 167 | - // si aucun #CACHE{} specifie |
|
| 168 | - // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme |
|
| 169 | - // entre public et prive |
|
| 170 | - if (test_espace_prive() OR strncmp($fond,'modeles/',8)==0) |
|
| 171 | - $page['entetes']['X-Spip-Cache'] = 0; |
|
| 172 | - else |
|
| 173 | - $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais'])?$GLOBALS['delais']:36000; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - $page['contexte'] = $contexte; |
|
| 46 | + static $composer,$styliser,$notes=null; |
|
| 47 | + $page = tester_redirection($fond, $contexte, $connect); |
|
| 48 | + if ($page) return $page; |
|
| 49 | + |
|
| 50 | + if (isset($contexte['lang'])) |
|
| 51 | + $lang = $contexte['lang']; |
|
| 52 | + elseif (!isset($lang)) |
|
| 53 | + $lang = $GLOBALS['meta']['langue_site']; |
|
| 54 | + |
|
| 55 | + $select = ((!isset($GLOBALS['forcer_lang']) OR !$GLOBALS['forcer_lang']) AND $lang <> $GLOBALS['spip_lang']); |
|
| 56 | + if ($select) $select = lang_select($lang); |
|
| 57 | + |
|
| 58 | + $debug = (defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
|
| 59 | + |
|
| 60 | + if (!$styliser) |
|
| 61 | + $styliser = charger_fonction('styliser', 'public'); |
|
| 62 | + list($skel,$mime_type, $gram, $sourcefile) = |
|
| 63 | + $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect); |
|
| 64 | + |
|
| 65 | + if ($skel) { |
|
| 66 | + |
|
| 67 | + // sauver le nom de l'eventuel squelette en cours d'execution |
|
| 68 | + // (recursion possible a cause des modeles) |
|
| 69 | + if ($debug) { |
|
| 70 | + $courant = @$GLOBALS['debug_objets']['courant']; |
|
| 71 | + $GLOBALS['debug_objets']['contexte'][$sourcefile] = $contexte; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // charger le squelette en specifiant les langages cibles et source |
|
| 75 | + // au cas il faudrait le compiler (source posterieure au resultat) |
|
| 76 | + |
|
| 77 | + if (!$composer) |
|
| 78 | + $composer = charger_fonction('composer', 'public'); |
|
| 79 | + $fonc = $composer($skel, $mime_type, $gram, $sourcefile, $connect); |
|
| 80 | + } |
|
| 81 | + else |
|
| 82 | + $fonc = ''; |
|
| 83 | + |
|
| 84 | + if (!$fonc) { // squelette inconnu (==='') ou faux (===false) |
|
| 85 | + $page = $fonc; |
|
| 86 | + } |
|
| 87 | + else { |
|
| 88 | + // Preparer l'appel de la fonction principale du squelette |
|
| 89 | + |
|
| 90 | + spip_timer($a = 'calcul page '.rand(0,1000)); |
|
| 91 | + |
|
| 92 | + // On cree un marqueur de notes unique lie a cette composition |
|
| 93 | + // et on enregistre l'etat courant des globales de notes... |
|
| 94 | + if (is_null($notes)) |
|
| 95 | + $notes = charger_fonction('notes', 'inc', true); |
|
| 96 | + if ($notes) |
|
| 97 | + $notes('','empiler'); |
|
| 98 | + |
|
| 99 | + // Rajouter d'office ces deux parametres |
|
| 100 | + // (mais vaudrait mieux que le compilateur sache le simuler |
|
| 101 | + // car ca interdit l'usage de criteres conditionnels dessus). |
|
| 102 | + if (!isset($contexte['date'])) { |
|
| 103 | + $contexte['date'] = date("Y-m-d H:i:s"); |
|
| 104 | + $contexte['date_default'] = true; |
|
| 105 | + } else $contexte['date'] = normaliser_date($contexte['date'], true); |
|
| 106 | + |
|
| 107 | + if (!isset($contexte['date_redac'])) { |
|
| 108 | + $contexte['date_redac'] = date("Y-m-d H:i:s"); |
|
| 109 | + $contexte['date_redac_default'] = true; |
|
| 110 | + } else $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true); |
|
| 111 | + |
|
| 112 | + // Passer le nom du cache pour produire sa destruction automatique |
|
| 113 | + $page = $fonc(array('cache' => $cache), array($contexte)); |
|
| 114 | + |
|
| 115 | + // Restituer les globales de notes telles qu'elles etaient avant l'appel |
|
| 116 | + // Si l'inclus n'a pas affiche ses notes, tant pis (elles *doivent* |
|
| 117 | + // etre dans son resultat, autrement elles ne seraient pas prises en |
|
| 118 | + // compte a chaque calcul d'un texte contenant un modele, mais seulement |
|
| 119 | + // quand le modele serait calcule, et on aurait des resultats incoherents) |
|
| 120 | + if ($notes) |
|
| 121 | + $notes('','depiler'); |
|
| 122 | + |
|
| 123 | + // reinjecter en dynamique la pile des notes |
|
| 124 | + // si il y a des inclure dynamiques |
|
| 125 | + // si la pile n'est pas vide |
|
| 126 | + // la generalisation de cette injection permettrait de corriger le point juste au dessus |
|
| 127 | + // en faisant remonter les notes a l'incluant (A tester et valider avant application) |
|
| 128 | + if ($notes) |
|
| 129 | + $page['notes'] = $notes('','sauver_etat'); |
|
| 130 | + |
|
| 131 | + // spip_log: un joli contexte |
|
| 132 | + $infos = array(); |
|
| 133 | + foreach (array_filter($contexte) as $var => $val) { |
|
| 134 | + if (is_array($val)) $val = serialize($val); |
|
| 135 | + if (strlen("$val") > 30) |
|
| 136 | + $val = substr("$val", 0,27).'..'; |
|
| 137 | + if (strstr($val,' ')) |
|
| 138 | + $val = "'$val'"; |
|
| 139 | + $infos[] = $var.'='.$val; |
|
| 140 | + } |
|
| 141 | + $profile = spip_timer($a); |
|
| 142 | + spip_log("calcul ($profile) [$skel] " |
|
| 143 | + . join(', ', $infos) |
|
| 144 | + .' ('.strlen($page['texte']).' octets)'); |
|
| 145 | + |
|
| 146 | + if (defined('_CALCUL_PROFILER') AND intval($profile)>_CALCUL_PROFILER){ |
|
| 147 | + spip_log("calcul ($profile) [$skel] " |
|
| 148 | + . join(', ', $infos) |
|
| 149 | + .' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'],"profiler"._LOG_AVERTISSEMENT); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if ($debug) { |
|
| 153 | + // si c'est ce que demande le debusqueur, lui passer la main |
|
| 154 | + $t = strlen($page['texte']) ? $page['texte'] : " "; |
|
| 155 | + $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t; |
|
| 156 | + $GLOBALS['debug_objets']['courant'] = $courant; |
|
| 157 | + $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile; |
|
| 158 | + if ($GLOBALS['debug_objets']['sourcefile'] |
|
| 159 | + AND (_request('var_mode_objet') == $fonc) |
|
| 160 | + AND (_request('var_mode_affiche') == 'resultat')) { |
|
| 161 | + erreur_squelette(); |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + // Si #CACHE{} n'etait pas la, le mettre a $delais |
|
| 165 | + if (!isset($page['entetes']['X-Spip-Cache'])){ |
|
| 166 | + // Dans l'espace prive ou dans un modeles/ on pose un cache 0 par defaut |
|
| 167 | + // si aucun #CACHE{} specifie |
|
| 168 | + // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme |
|
| 169 | + // entre public et prive |
|
| 170 | + if (test_espace_prive() OR strncmp($fond,'modeles/',8)==0) |
|
| 171 | + $page['entetes']['X-Spip-Cache'] = 0; |
|
| 172 | + else |
|
| 173 | + $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais'])?$GLOBALS['delais']:36000; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + $page['contexte'] = $contexte; |
|
| 177 | 177 | |
| 178 | - // faire remonter le fichier source |
|
| 179 | - static $js_inclus = false; |
|
| 180 | - if (defined('_VAR_INCLURE') AND _VAR_INCLURE){ |
|
| 181 | - $page['sourcefile'] = $sourcefile; |
|
| 182 | - $page['texte'] = |
|
| 183 | - "<div class='inclure_blocs'><h6>".$page['sourcefile']."</h6>".$page['texte']."</div>" |
|
| 184 | - . ($js_inclus?"":"<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
|
| 185 | - $js_inclus = true; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - // Si un modele contenait #SESSION, on note l'info dans $page |
|
| 189 | - if (isset($GLOBALS['cache_utilise_session'])) { |
|
| 190 | - $page['invalideurs']['session'] = $GLOBALS['cache_utilise_session']; |
|
| 191 | - unset($GLOBALS['cache_utilise_session']); |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - if ($select) lang_select(); |
|
| 196 | - |
|
| 197 | - return $page; |
|
| 178 | + // faire remonter le fichier source |
|
| 179 | + static $js_inclus = false; |
|
| 180 | + if (defined('_VAR_INCLURE') AND _VAR_INCLURE){ |
|
| 181 | + $page['sourcefile'] = $sourcefile; |
|
| 182 | + $page['texte'] = |
|
| 183 | + "<div class='inclure_blocs'><h6>".$page['sourcefile']."</h6>".$page['texte']."</div>" |
|
| 184 | + . ($js_inclus?"":"<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
|
| 185 | + $js_inclus = true; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + // Si un modele contenait #SESSION, on note l'info dans $page |
|
| 189 | + if (isset($GLOBALS['cache_utilise_session'])) { |
|
| 190 | + $page['invalideurs']['session'] = $GLOBALS['cache_utilise_session']; |
|
| 191 | + unset($GLOBALS['cache_utilise_session']); |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + if ($select) lang_select(); |
|
| 196 | + |
|
| 197 | + return $page; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
@@ -212,36 +212,36 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function tester_redirection($fond, $contexte, $connect) |
| 214 | 214 | { |
| 215 | - if ($fond == 'article' |
|
| 216 | - AND $id_article = intval($contexte['id_article'])) { |
|
| 217 | - include_spip('public/quete'); // pour quete_virtuel et ses dependances |
|
| 218 | - $m = quete_virtuel($id_article, $connect); |
|
| 219 | - if (strlen($m)) { |
|
| 220 | - include_spip('inc/texte'); |
|
| 221 | - // les navigateurs pataugent si l'URL est vide |
|
| 222 | - if ($url = virtuel_redirige($m, true)){ |
|
| 223 | - // passer en url absolue car cette redirection pourra |
|
| 224 | - // etre utilisee dans un contexte d'url qui change |
|
| 225 | - // y compris url arbo |
|
| 226 | - $status = 302; |
|
| 227 | - if (defined('_STATUS_REDIRECTION_VIRTUEL')) |
|
| 228 | - $status=_STATUS_REDIRECTION_VIRTUEL; |
|
| 229 | - if (!preg_match(',^\w+:,', $url)) { |
|
| 230 | - include_spip('inc/filtres_mini'); |
|
| 231 | - $url = url_absolue($url); |
|
| 232 | - } |
|
| 233 | - $url = str_replace('&', '&', $url); |
|
| 234 | - return array('texte' => "<" |
|
| 235 | - . "?php include_spip('inc/headers');redirige_par_entete('" |
|
| 236 | - . texte_script($url) |
|
| 237 | - . "','',$status);" |
|
| 238 | - . "?" . ">", |
|
| 239 | - 'process_ins' => 'php', |
|
| 240 | - 'status' => $status); |
|
| 241 | - } |
|
| 242 | - } |
|
| 243 | - } |
|
| 244 | - return false; |
|
| 215 | + if ($fond == 'article' |
|
| 216 | + AND $id_article = intval($contexte['id_article'])) { |
|
| 217 | + include_spip('public/quete'); // pour quete_virtuel et ses dependances |
|
| 218 | + $m = quete_virtuel($id_article, $connect); |
|
| 219 | + if (strlen($m)) { |
|
| 220 | + include_spip('inc/texte'); |
|
| 221 | + // les navigateurs pataugent si l'URL est vide |
|
| 222 | + if ($url = virtuel_redirige($m, true)){ |
|
| 223 | + // passer en url absolue car cette redirection pourra |
|
| 224 | + // etre utilisee dans un contexte d'url qui change |
|
| 225 | + // y compris url arbo |
|
| 226 | + $status = 302; |
|
| 227 | + if (defined('_STATUS_REDIRECTION_VIRTUEL')) |
|
| 228 | + $status=_STATUS_REDIRECTION_VIRTUEL; |
|
| 229 | + if (!preg_match(',^\w+:,', $url)) { |
|
| 230 | + include_spip('inc/filtres_mini'); |
|
| 231 | + $url = url_absolue($url); |
|
| 232 | + } |
|
| 233 | + $url = str_replace('&', '&', $url); |
|
| 234 | + return array('texte' => "<" |
|
| 235 | + . "?php include_spip('inc/headers');redirige_par_entete('" |
|
| 236 | + . texte_script($url) |
|
| 237 | + . "','',$status);" |
|
| 238 | + . "?" . ">", |
|
| 239 | + 'process_ins' => 'php', |
|
| 240 | + 'status' => $status); |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | + } |
|
| 244 | + return false; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | ?> |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | // donc il faut l'inclure "en globals" |
| 19 | 19 | if ($f = find_in_path('mes_fonctions.php')) { |
| 20 | 20 | global $dossier_squelettes; |
| 21 | - include_once(_ROOT_CWD . $f); |
|
| 21 | + include_once(_ROOT_CWD.$f); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (@is_readable(_CACHE_PLUGINS_FCT)) { |
| 25 | 25 | // chargement optimise precompile |
| 26 | 26 | include_once(_CACHE_PLUGINS_FCT); |
| 27 | 27 | } |
| 28 | -if (test_espace_prive ()) |
|
| 28 | +if (test_espace_prive()) |
|
| 29 | 29 | include_spip('inc/filtres_ecrire'); |
| 30 | 30 | |
| 31 | 31 | # Determine le squelette associe a une requete |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | # En cas d'erreur process_ins est absent et texte est un tableau de 2 chaines |
| 43 | 43 | |
| 44 | 44 | // http://doc.spip.org/@public_parametrer_dist |
| 45 | -function public_parametrer_dist($fond, $contexte='', $cache='', $connect='') { |
|
| 46 | - static $composer,$styliser,$notes=null; |
|
| 45 | +function public_parametrer_dist($fond, $contexte = '', $cache = '', $connect = '') { |
|
| 46 | + static $composer, $styliser, $notes = null; |
|
| 47 | 47 | $page = tester_redirection($fond, $contexte, $connect); |
| 48 | 48 | if ($page) return $page; |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if (!$styliser) |
| 61 | 61 | $styliser = charger_fonction('styliser', 'public'); |
| 62 | - list($skel,$mime_type, $gram, $sourcefile) = |
|
| 62 | + list($skel, $mime_type, $gram, $sourcefile) = |
|
| 63 | 63 | $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect); |
| 64 | 64 | |
| 65 | 65 | if ($skel) { |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | else { |
| 88 | 88 | // Preparer l'appel de la fonction principale du squelette |
| 89 | 89 | |
| 90 | - spip_timer($a = 'calcul page '.rand(0,1000)); |
|
| 90 | + spip_timer($a = 'calcul page '.rand(0, 1000)); |
|
| 91 | 91 | |
| 92 | 92 | // On cree un marqueur de notes unique lie a cette composition |
| 93 | 93 | // et on enregistre l'etat courant des globales de notes... |
| 94 | 94 | if (is_null($notes)) |
| 95 | 95 | $notes = charger_fonction('notes', 'inc', true); |
| 96 | 96 | if ($notes) |
| 97 | - $notes('','empiler'); |
|
| 97 | + $notes('', 'empiler'); |
|
| 98 | 98 | |
| 99 | 99 | // Rajouter d'office ces deux parametres |
| 100 | 100 | // (mais vaudrait mieux que le compilateur sache le simuler |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | // compte a chaque calcul d'un texte contenant un modele, mais seulement |
| 119 | 119 | // quand le modele serait calcule, et on aurait des resultats incoherents) |
| 120 | 120 | if ($notes) |
| 121 | - $notes('','depiler'); |
|
| 121 | + $notes('', 'depiler'); |
|
| 122 | 122 | |
| 123 | 123 | // reinjecter en dynamique la pile des notes |
| 124 | 124 | // si il y a des inclure dynamiques |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | // la generalisation de cette injection permettrait de corriger le point juste au dessus |
| 127 | 127 | // en faisant remonter les notes a l'incluant (A tester et valider avant application) |
| 128 | 128 | if ($notes) |
| 129 | - $page['notes'] = $notes('','sauver_etat'); |
|
| 129 | + $page['notes'] = $notes('', 'sauver_etat'); |
|
| 130 | 130 | |
| 131 | 131 | // spip_log: un joli contexte |
| 132 | 132 | $infos = array(); |
| 133 | 133 | foreach (array_filter($contexte) as $var => $val) { |
| 134 | 134 | if (is_array($val)) $val = serialize($val); |
| 135 | 135 | if (strlen("$val") > 30) |
| 136 | - $val = substr("$val", 0,27).'..'; |
|
| 137 | - if (strstr($val,' ')) |
|
| 136 | + $val = substr("$val", 0, 27).'..'; |
|
| 137 | + if (strstr($val, ' ')) |
|
| 138 | 138 | $val = "'$val'"; |
| 139 | 139 | $infos[] = $var.'='.$val; |
| 140 | 140 | } |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | . join(', ', $infos) |
| 144 | 144 | .' ('.strlen($page['texte']).' octets)'); |
| 145 | 145 | |
| 146 | - if (defined('_CALCUL_PROFILER') AND intval($profile)>_CALCUL_PROFILER){ |
|
| 146 | + if (defined('_CALCUL_PROFILER') AND intval($profile) > _CALCUL_PROFILER) { |
|
| 147 | 147 | spip_log("calcul ($profile) [$skel] " |
| 148 | 148 | . join(', ', $infos) |
| 149 | - .' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'],"profiler"._LOG_AVERTISSEMENT); |
|
| 149 | + .' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'], "profiler"._LOG_AVERTISSEMENT); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if ($debug) { |
| 153 | 153 | // si c'est ce que demande le debusqueur, lui passer la main |
| 154 | 154 | $t = strlen($page['texte']) ? $page['texte'] : " "; |
| 155 | - $GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t; |
|
| 155 | + $GLOBALS['debug_objets']['resultat'][$fonc.'tout'] = $t; |
|
| 156 | 156 | $GLOBALS['debug_objets']['courant'] = $courant; |
| 157 | 157 | $GLOBALS['debug_objets']['profile'][$sourcefile] = $profile; |
| 158 | 158 | if ($GLOBALS['debug_objets']['sourcefile'] |
@@ -162,26 +162,26 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | // Si #CACHE{} n'etait pas la, le mettre a $delais |
| 165 | - if (!isset($page['entetes']['X-Spip-Cache'])){ |
|
| 165 | + if (!isset($page['entetes']['X-Spip-Cache'])) { |
|
| 166 | 166 | // Dans l'espace prive ou dans un modeles/ on pose un cache 0 par defaut |
| 167 | 167 | // si aucun #CACHE{} specifie |
| 168 | 168 | // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme |
| 169 | 169 | // entre public et prive |
| 170 | - if (test_espace_prive() OR strncmp($fond,'modeles/',8)==0) |
|
| 170 | + if (test_espace_prive() OR strncmp($fond, 'modeles/', 8) == 0) |
|
| 171 | 171 | $page['entetes']['X-Spip-Cache'] = 0; |
| 172 | 172 | else |
| 173 | - $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais'])?$GLOBALS['delais']:36000; |
|
| 173 | + $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais']) ? $GLOBALS['delais'] : 36000; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $page['contexte'] = $contexte; |
| 177 | 177 | |
| 178 | 178 | // faire remonter le fichier source |
| 179 | 179 | static $js_inclus = false; |
| 180 | - if (defined('_VAR_INCLURE') AND _VAR_INCLURE){ |
|
| 180 | + if (defined('_VAR_INCLURE') AND _VAR_INCLURE) { |
|
| 181 | 181 | $page['sourcefile'] = $sourcefile; |
| 182 | 182 | $page['texte'] = |
| 183 | 183 | "<div class='inclure_blocs'><h6>".$page['sourcefile']."</h6>".$page['texte']."</div>" |
| 184 | - . ($js_inclus?"":"<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
|
| 184 | + . ($js_inclus ? "" : "<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>"); |
|
| 185 | 185 | $js_inclus = true; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | if (strlen($m)) { |
| 220 | 220 | include_spip('inc/texte'); |
| 221 | 221 | // les navigateurs pataugent si l'URL est vide |
| 222 | - if ($url = virtuel_redirige($m, true)){ |
|
| 222 | + if ($url = virtuel_redirige($m, true)) { |
|
| 223 | 223 | // passer en url absolue car cette redirection pourra |
| 224 | 224 | // etre utilisee dans un contexte d'url qui change |
| 225 | 225 | // y compris url arbo |
| 226 | 226 | $status = 302; |
| 227 | 227 | if (defined('_STATUS_REDIRECTION_VIRTUEL')) |
| 228 | - $status=_STATUS_REDIRECTION_VIRTUEL; |
|
| 228 | + $status = _STATUS_REDIRECTION_VIRTUEL; |
|
| 229 | 229 | if (!preg_match(',^\w+:,', $url)) { |
| 230 | 230 | include_spip('inc/filtres_mini'); |
| 231 | 231 | $url = url_absolue($url); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | . "?php include_spip('inc/headers');redirige_par_entete('" |
| 236 | 236 | . texte_script($url) |
| 237 | 237 | . "','',$status);" |
| 238 | - . "?" . ">", |
|
| 238 | + . "?".">", |
|
| 239 | 239 | 'process_ins' => 'php', |
| 240 | 240 | 'status' => $status); |
| 241 | 241 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | include_spip('inc/lang'); |
| 16 | 18 | |
@@ -25,8 +27,9 @@ discard block |
||
| 25 | 27 | // chargement optimise precompile |
| 26 | 28 | include_once(_CACHE_PLUGINS_FCT); |
| 27 | 29 | } |
| 28 | -if (test_espace_prive ()) |
|
| 30 | +if (test_espace_prive ()) { |
|
| 29 | 31 | include_spip('inc/filtres_ecrire'); |
| 32 | +} |
|
| 30 | 33 | |
| 31 | 34 | # Determine le squelette associe a une requete |
| 32 | 35 | # et l'applique sur le contexte, le nom du cache et le serveur |
@@ -45,20 +48,26 @@ discard block |
||
| 45 | 48 | function public_parametrer_dist($fond, $contexte='', $cache='', $connect='') { |
| 46 | 49 | static $composer,$styliser,$notes=null; |
| 47 | 50 | $page = tester_redirection($fond, $contexte, $connect); |
| 48 | - if ($page) return $page; |
|
| 51 | + if ($page) { |
|
| 52 | + return $page; |
|
| 53 | + } |
|
| 49 | 54 | |
| 50 | - if (isset($contexte['lang'])) |
|
| 51 | - $lang = $contexte['lang']; |
|
| 52 | - elseif (!isset($lang)) |
|
| 53 | - $lang = $GLOBALS['meta']['langue_site']; |
|
| 55 | + if (isset($contexte['lang'])) { |
|
| 56 | + $lang = $contexte['lang']; |
|
| 57 | + } elseif (!isset($lang)) { |
|
| 58 | + $lang = $GLOBALS['meta']['langue_site']; |
|
| 59 | + } |
|
| 54 | 60 | |
| 55 | 61 | $select = ((!isset($GLOBALS['forcer_lang']) OR !$GLOBALS['forcer_lang']) AND $lang <> $GLOBALS['spip_lang']); |
| 56 | - if ($select) $select = lang_select($lang); |
|
| 62 | + if ($select) { |
|
| 63 | + $select = lang_select($lang); |
|
| 64 | + } |
|
| 57 | 65 | |
| 58 | 66 | $debug = (defined('_VAR_MODE') && _VAR_MODE == 'debug'); |
| 59 | 67 | |
| 60 | - if (!$styliser) |
|
| 61 | - $styliser = charger_fonction('styliser', 'public'); |
|
| 68 | + if (!$styliser) { |
|
| 69 | + $styliser = charger_fonction('styliser', 'public'); |
|
| 70 | + } |
|
| 62 | 71 | list($skel,$mime_type, $gram, $sourcefile) = |
| 63 | 72 | $styliser($fond, $contexte, $GLOBALS['spip_lang'], $connect); |
| 64 | 73 | |
@@ -74,27 +83,29 @@ discard block |
||
| 74 | 83 | // charger le squelette en specifiant les langages cibles et source |
| 75 | 84 | // au cas il faudrait le compiler (source posterieure au resultat) |
| 76 | 85 | |
| 77 | - if (!$composer) |
|
| 78 | - $composer = charger_fonction('composer', 'public'); |
|
| 86 | + if (!$composer) { |
|
| 87 | + $composer = charger_fonction('composer', 'public'); |
|
| 88 | + } |
|
| 79 | 89 | $fonc = $composer($skel, $mime_type, $gram, $sourcefile, $connect); |
| 90 | + } else { |
|
| 91 | + $fonc = ''; |
|
| 80 | 92 | } |
| 81 | - else |
|
| 82 | - $fonc = ''; |
|
| 83 | 93 | |
| 84 | 94 | if (!$fonc) { // squelette inconnu (==='') ou faux (===false) |
| 85 | 95 | $page = $fonc; |
| 86 | - } |
|
| 87 | - else { |
|
| 96 | + } else { |
|
| 88 | 97 | // Preparer l'appel de la fonction principale du squelette |
| 89 | 98 | |
| 90 | 99 | spip_timer($a = 'calcul page '.rand(0,1000)); |
| 91 | 100 | |
| 92 | 101 | // On cree un marqueur de notes unique lie a cette composition |
| 93 | 102 | // et on enregistre l'etat courant des globales de notes... |
| 94 | - if (is_null($notes)) |
|
| 95 | - $notes = charger_fonction('notes', 'inc', true); |
|
| 96 | - if ($notes) |
|
| 97 | - $notes('','empiler'); |
|
| 103 | + if (is_null($notes)) { |
|
| 104 | + $notes = charger_fonction('notes', 'inc', true); |
|
| 105 | + } |
|
| 106 | + if ($notes) { |
|
| 107 | + $notes('','empiler'); |
|
| 108 | + } |
|
| 98 | 109 | |
| 99 | 110 | // Rajouter d'office ces deux parametres |
| 100 | 111 | // (mais vaudrait mieux que le compilateur sache le simuler |
@@ -102,12 +113,16 @@ discard block |
||
| 102 | 113 | if (!isset($contexte['date'])) { |
| 103 | 114 | $contexte['date'] = date("Y-m-d H:i:s"); |
| 104 | 115 | $contexte['date_default'] = true; |
| 105 | - } else $contexte['date'] = normaliser_date($contexte['date'], true); |
|
| 116 | + } else { |
|
| 117 | + $contexte['date'] = normaliser_date($contexte['date'], true); |
|
| 118 | + } |
|
| 106 | 119 | |
| 107 | 120 | if (!isset($contexte['date_redac'])) { |
| 108 | 121 | $contexte['date_redac'] = date("Y-m-d H:i:s"); |
| 109 | 122 | $contexte['date_redac_default'] = true; |
| 110 | - } else $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true); |
|
| 123 | + } else { |
|
| 124 | + $contexte['date_redac'] = normaliser_date($contexte['date_redac'], true); |
|
| 125 | + } |
|
| 111 | 126 | |
| 112 | 127 | // Passer le nom du cache pour produire sa destruction automatique |
| 113 | 128 | $page = $fonc(array('cache' => $cache), array($contexte)); |
@@ -117,25 +132,31 @@ discard block |
||
| 117 | 132 | // etre dans son resultat, autrement elles ne seraient pas prises en |
| 118 | 133 | // compte a chaque calcul d'un texte contenant un modele, mais seulement |
| 119 | 134 | // quand le modele serait calcule, et on aurait des resultats incoherents) |
| 120 | - if ($notes) |
|
| 121 | - $notes('','depiler'); |
|
| 135 | + if ($notes) { |
|
| 136 | + $notes('','depiler'); |
|
| 137 | + } |
|
| 122 | 138 | |
| 123 | 139 | // reinjecter en dynamique la pile des notes |
| 124 | 140 | // si il y a des inclure dynamiques |
| 125 | 141 | // si la pile n'est pas vide |
| 126 | 142 | // la generalisation de cette injection permettrait de corriger le point juste au dessus |
| 127 | 143 | // en faisant remonter les notes a l'incluant (A tester et valider avant application) |
| 128 | - if ($notes) |
|
| 129 | - $page['notes'] = $notes('','sauver_etat'); |
|
| 144 | + if ($notes) { |
|
| 145 | + $page['notes'] = $notes('','sauver_etat'); |
|
| 146 | + } |
|
| 130 | 147 | |
| 131 | 148 | // spip_log: un joli contexte |
| 132 | 149 | $infos = array(); |
| 133 | 150 | foreach (array_filter($contexte) as $var => $val) { |
| 134 | - if (is_array($val)) $val = serialize($val); |
|
| 135 | - if (strlen("$val") > 30) |
|
| 136 | - $val = substr("$val", 0,27).'..'; |
|
| 137 | - if (strstr($val,' ')) |
|
| 138 | - $val = "'$val'"; |
|
| 151 | + if (is_array($val)) { |
|
| 152 | + $val = serialize($val); |
|
| 153 | + } |
|
| 154 | + if (strlen("$val") > 30) { |
|
| 155 | + $val = substr("$val", 0,27).'..'; |
|
| 156 | + } |
|
| 157 | + if (strstr($val,' ')) { |
|
| 158 | + $val = "'$val'"; |
|
| 159 | + } |
|
| 139 | 160 | $infos[] = $var.'='.$val; |
| 140 | 161 | } |
| 141 | 162 | $profile = spip_timer($a); |
@@ -167,10 +188,11 @@ discard block |
||
| 167 | 188 | // si aucun #CACHE{} specifie |
| 168 | 189 | // le contexte implicite qui conditionne le cache assure qu'on retombe pas sur le meme |
| 169 | 190 | // entre public et prive |
| 170 | - if (test_espace_prive() OR strncmp($fond,'modeles/',8)==0) |
|
| 171 | - $page['entetes']['X-Spip-Cache'] = 0; |
|
| 172 | - else |
|
| 173 | - $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais'])?$GLOBALS['delais']:36000; |
|
| 191 | + if (test_espace_prive() OR strncmp($fond,'modeles/',8)==0) { |
|
| 192 | + $page['entetes']['X-Spip-Cache'] = 0; |
|
| 193 | + } else { |
|
| 194 | + $page['entetes']['X-Spip-Cache'] = isset($GLOBALS['delais'])?$GLOBALS['delais']:36000; |
|
| 195 | + } |
|
| 174 | 196 | } |
| 175 | 197 | |
| 176 | 198 | $page['contexte'] = $contexte; |
@@ -192,7 +214,9 @@ discard block |
||
| 192 | 214 | } |
| 193 | 215 | } |
| 194 | 216 | |
| 195 | - if ($select) lang_select(); |
|
| 217 | + if ($select) { |
|
| 218 | + lang_select(); |
|
| 219 | + } |
|
| 196 | 220 | |
| 197 | 221 | return $page; |
| 198 | 222 | } |
@@ -224,8 +248,9 @@ discard block |
||
| 224 | 248 | // etre utilisee dans un contexte d'url qui change |
| 225 | 249 | // y compris url arbo |
| 226 | 250 | $status = 302; |
| 227 | - if (defined('_STATUS_REDIRECTION_VIRTUEL')) |
|
| 228 | - $status=_STATUS_REDIRECTION_VIRTUEL; |
|
| 251 | + if (defined('_STATUS_REDIRECTION_VIRTUEL')) { |
|
| 252 | + $status=_STATUS_REDIRECTION_VIRTUEL; |
|
| 253 | + } |
|
| 229 | 254 | if (!preg_match(',^\w+:,', $url)) { |
| 230 | 255 | include_spip('inc/filtres_mini'); |
| 231 | 256 | $url = url_absolue($url); |
@@ -36,6 +36,9 @@ |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // http://doc.spip.org/@trace_query_chrono |
| 39 | +/** |
|
| 40 | + * @param string $m2 |
|
| 41 | + */ |
|
| 39 | 42 | function trace_query_chrono($m1, $m2, $query, $result, $serveur='') |
| 40 | 43 | { |
| 41 | 44 | static $tt = 0, $nb=0; |
@@ -15,135 +15,135 @@ |
||
| 15 | 15 | // http://doc.spip.org/@trace_query_start |
| 16 | 16 | function trace_query_start() |
| 17 | 17 | { |
| 18 | - static $trace = '?'; |
|
| 19 | - if ($trace === '?') { |
|
| 20 | - include_spip('inc/autoriser'); |
|
| 21 | - // gare au bouclage sur calcul de droits au premier appel |
|
| 22 | - // A fortiori quand on demande une trace |
|
| 23 | - $trace = isset($_GET['var_profile']) AND (autoriser('debug')); |
|
| 24 | - } |
|
| 25 | - return $trace ? microtime() : 0; |
|
| 18 | + static $trace = '?'; |
|
| 19 | + if ($trace === '?') { |
|
| 20 | + include_spip('inc/autoriser'); |
|
| 21 | + // gare au bouclage sur calcul de droits au premier appel |
|
| 22 | + // A fortiori quand on demande une trace |
|
| 23 | + $trace = isset($_GET['var_profile']) AND (autoriser('debug')); |
|
| 24 | + } |
|
| 25 | + return $trace ? microtime() : 0; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // http://doc.spip.org/@trace_query_end |
| 29 | 29 | function trace_query_end($query, $start, $result, $erreur, $serveur=''){ |
| 30 | - if ($start) |
|
| 31 | - trace_query_chrono($start, microtime(), $query, $result, $serveur); |
|
| 32 | - // tracer les erreurs, sauf pour select, c'est fait dans abstract_sql |
|
| 33 | - if ($erreur AND !preg_match('/^select\b/i', $query)) |
|
| 34 | - erreur_squelette(array(sql_errno($serveur), $erreur, $query)); |
|
| 35 | - return $result; |
|
| 30 | + if ($start) |
|
| 31 | + trace_query_chrono($start, microtime(), $query, $result, $serveur); |
|
| 32 | + // tracer les erreurs, sauf pour select, c'est fait dans abstract_sql |
|
| 33 | + if ($erreur AND !preg_match('/^select\b/i', $query)) |
|
| 34 | + erreur_squelette(array(sql_errno($serveur), $erreur, $query)); |
|
| 35 | + return $result; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // http://doc.spip.org/@trace_query_chrono |
| 39 | 39 | function trace_query_chrono($m1, $m2, $query, $result, $serveur='') |
| 40 | 40 | { |
| 41 | - static $tt = 0, $nb=0; |
|
| 42 | - global $tableau_des_temps; |
|
| 43 | - |
|
| 44 | - include_spip('inc/filtres_mini'); |
|
| 45 | - |
|
| 46 | - $x = _request('var_mode_objet'); |
|
| 47 | - if (isset($GLOBALS['debug']['aucasou'])) { |
|
| 48 | - list(, $boucle, $serveur, $contexte) = $GLOBALS['debug']['aucasou']; |
|
| 49 | - if ($x AND !preg_match("/$boucle\$/", $x)) |
|
| 50 | - return; |
|
| 51 | - if ($serveur) $boucle .= " ($serveur)"; |
|
| 52 | - $boucle = "<b>$boucle</b>"; |
|
| 53 | - } else { |
|
| 54 | - if ($x) return; |
|
| 55 | - $boucle = $contexte = ''; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - list($usec, $sec) = explode(" ", $m1); |
|
| 59 | - list($usec2, $sec2) = explode(" ", $m2); |
|
| 60 | - $dt = $sec2 + $usec2 - $sec - $usec; |
|
| 61 | - $tt += $dt; |
|
| 62 | - $nb++; |
|
| 63 | - |
|
| 64 | - $q = preg_replace('/([a-z)`])\s+([A-Z])/', "$1\n<br />$2",spip_htmlentities($query)); |
|
| 65 | - $e = sql_explain($query, $serveur); |
|
| 66 | - $r = str_replace('Resource id ','',(is_object($result)?get_class($result):$result)); |
|
| 67 | - $tableau_des_temps[] = array($dt, $nb, $boucle, $q, $e, $r, $contexte); |
|
| 41 | + static $tt = 0, $nb=0; |
|
| 42 | + global $tableau_des_temps; |
|
| 43 | + |
|
| 44 | + include_spip('inc/filtres_mini'); |
|
| 45 | + |
|
| 46 | + $x = _request('var_mode_objet'); |
|
| 47 | + if (isset($GLOBALS['debug']['aucasou'])) { |
|
| 48 | + list(, $boucle, $serveur, $contexte) = $GLOBALS['debug']['aucasou']; |
|
| 49 | + if ($x AND !preg_match("/$boucle\$/", $x)) |
|
| 50 | + return; |
|
| 51 | + if ($serveur) $boucle .= " ($serveur)"; |
|
| 52 | + $boucle = "<b>$boucle</b>"; |
|
| 53 | + } else { |
|
| 54 | + if ($x) return; |
|
| 55 | + $boucle = $contexte = ''; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + list($usec, $sec) = explode(" ", $m1); |
|
| 59 | + list($usec2, $sec2) = explode(" ", $m2); |
|
| 60 | + $dt = $sec2 + $usec2 - $sec - $usec; |
|
| 61 | + $tt += $dt; |
|
| 62 | + $nb++; |
|
| 63 | + |
|
| 64 | + $q = preg_replace('/([a-z)`])\s+([A-Z])/', "$1\n<br />$2",spip_htmlentities($query)); |
|
| 65 | + $e = sql_explain($query, $serveur); |
|
| 66 | + $r = str_replace('Resource id ','',(is_object($result)?get_class($result):$result)); |
|
| 67 | + $tableau_des_temps[] = array($dt, $nb, $boucle, $q, $e, $r, $contexte); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | function chrono_requete($temps) |
| 72 | 72 | { |
| 73 | - $total = 0; |
|
| 74 | - $hors = "<i>" . _T('zbug_hors_compilation') . "</i>"; |
|
| 75 | - $t = $q = $n = $d = array(); |
|
| 76 | - // Totaliser les temps et completer le Explain |
|
| 77 | - foreach ($temps as $key => $v) { |
|
| 78 | - list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v; |
|
| 79 | - if (is_array($contexte)) { |
|
| 80 | - $k = ($contexte[0] . " $boucle"); |
|
| 81 | - include_spip('public/compiler'); |
|
| 82 | - $env = reconstruire_contexte_compil($contexte); |
|
| 83 | - } else $k = $env = $boucle; |
|
| 84 | - |
|
| 85 | - $total += $dt; |
|
| 86 | - $t[$key] = $dt; |
|
| 87 | - $q[$key] = $nb; |
|
| 88 | - $d[$k]+= $dt; |
|
| 89 | - if ($k) @++$n[$k]; |
|
| 90 | - |
|
| 91 | - if (!is_array($explain)) |
|
| 92 | - $explain = array(); |
|
| 93 | - foreach($explain as $j => $v) { |
|
| 94 | - $explain[$j] = "<tr><th>$j</th><td>" |
|
| 95 | - . str_replace(';','<br />',$v) |
|
| 96 | - . "</td></tr>"; |
|
| 97 | - } |
|
| 98 | - $e = "<table class='explain'>" |
|
| 99 | - . "<caption>" |
|
| 100 | - . $query |
|
| 101 | - . "</caption>" |
|
| 102 | - . "<tr><th>Time</th><td>$dt</td></tr>" |
|
| 103 | - . "<tr><th>Order</th><td>$nb</td></tr>" |
|
| 104 | - . "<tr><th>Res</th><td>$res</td></tr>" |
|
| 105 | - . join('', $explain) |
|
| 106 | - . "</table>"; |
|
| 107 | - |
|
| 108 | - $temps[$key] = array($e, $env, $k); |
|
| 109 | - } |
|
| 110 | - // Trier par temps d'execution decroissant |
|
| 111 | - array_multisort($t, SORT_DESC, $q, $temps); |
|
| 112 | - arsort($d); |
|
| 113 | - $i = 1; |
|
| 114 | - $t = array(); |
|
| 115 | - // Fabriquer les liens de navigations dans le tableau des temps |
|
| 116 | - foreach($temps as $k => $v) { |
|
| 117 | - $titre = strip_tags($v[2]); |
|
| 118 | - $href = quote_amp($GLOBALS['REQUEST_URI'])."#req$i"; |
|
| 119 | - |
|
| 120 | - $t[$v[2]][]= "<span class='spip-debug-arg'> " |
|
| 121 | - . "<a title='$titre' href='$href'>$i</a>" |
|
| 122 | - . '</span>' |
|
| 123 | - . ((count($t[$v[2]]) % 10 == 9) ? "<br />" : ''); |
|
| 124 | - $i++; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - if ($d['']) { |
|
| 128 | - $d[$hors] = $d['']; |
|
| 129 | - $n[$hors] = $n['']; |
|
| 130 | - $t[$hors] = $t['']; |
|
| 131 | - } |
|
| 132 | - unset($d['']); |
|
| 133 | - // Fabriquer le tableau des liens de navigation dans le grand tableau |
|
| 134 | - foreach ($d as $k => $v) { |
|
| 135 | - $d[$k] = $n[$k] . "</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 136 | - . join('',$t[$k]); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - $navigation = array(_T('zbug_statistiques'), |
|
| 140 | - "<tr><td>" |
|
| 141 | - . join("</td></tr>\n<tr><td>", $d) |
|
| 142 | - . "</td></tr>\n" |
|
| 143 | - . (# _request('var_mode_objet') ? '' : |
|
| 144 | - ("<tr><td>" . count($temps) . "</td><td>" . _T('info_total') . '</td><td class="time">' . $total . "</td><td></td></tr>"))); |
|
| 73 | + $total = 0; |
|
| 74 | + $hors = "<i>" . _T('zbug_hors_compilation') . "</i>"; |
|
| 75 | + $t = $q = $n = $d = array(); |
|
| 76 | + // Totaliser les temps et completer le Explain |
|
| 77 | + foreach ($temps as $key => $v) { |
|
| 78 | + list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v; |
|
| 79 | + if (is_array($contexte)) { |
|
| 80 | + $k = ($contexte[0] . " $boucle"); |
|
| 81 | + include_spip('public/compiler'); |
|
| 82 | + $env = reconstruire_contexte_compil($contexte); |
|
| 83 | + } else $k = $env = $boucle; |
|
| 84 | + |
|
| 85 | + $total += $dt; |
|
| 86 | + $t[$key] = $dt; |
|
| 87 | + $q[$key] = $nb; |
|
| 88 | + $d[$k]+= $dt; |
|
| 89 | + if ($k) @++$n[$k]; |
|
| 90 | + |
|
| 91 | + if (!is_array($explain)) |
|
| 92 | + $explain = array(); |
|
| 93 | + foreach($explain as $j => $v) { |
|
| 94 | + $explain[$j] = "<tr><th>$j</th><td>" |
|
| 95 | + . str_replace(';','<br />',$v) |
|
| 96 | + . "</td></tr>"; |
|
| 97 | + } |
|
| 98 | + $e = "<table class='explain'>" |
|
| 99 | + . "<caption>" |
|
| 100 | + . $query |
|
| 101 | + . "</caption>" |
|
| 102 | + . "<tr><th>Time</th><td>$dt</td></tr>" |
|
| 103 | + . "<tr><th>Order</th><td>$nb</td></tr>" |
|
| 104 | + . "<tr><th>Res</th><td>$res</td></tr>" |
|
| 105 | + . join('', $explain) |
|
| 106 | + . "</table>"; |
|
| 107 | + |
|
| 108 | + $temps[$key] = array($e, $env, $k); |
|
| 109 | + } |
|
| 110 | + // Trier par temps d'execution decroissant |
|
| 111 | + array_multisort($t, SORT_DESC, $q, $temps); |
|
| 112 | + arsort($d); |
|
| 113 | + $i = 1; |
|
| 114 | + $t = array(); |
|
| 115 | + // Fabriquer les liens de navigations dans le tableau des temps |
|
| 116 | + foreach($temps as $k => $v) { |
|
| 117 | + $titre = strip_tags($v[2]); |
|
| 118 | + $href = quote_amp($GLOBALS['REQUEST_URI'])."#req$i"; |
|
| 119 | + |
|
| 120 | + $t[$v[2]][]= "<span class='spip-debug-arg'> " |
|
| 121 | + . "<a title='$titre' href='$href'>$i</a>" |
|
| 122 | + . '</span>' |
|
| 123 | + . ((count($t[$v[2]]) % 10 == 9) ? "<br />" : ''); |
|
| 124 | + $i++; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + if ($d['']) { |
|
| 128 | + $d[$hors] = $d['']; |
|
| 129 | + $n[$hors] = $n['']; |
|
| 130 | + $t[$hors] = $t['']; |
|
| 131 | + } |
|
| 132 | + unset($d['']); |
|
| 133 | + // Fabriquer le tableau des liens de navigation dans le grand tableau |
|
| 134 | + foreach ($d as $k => $v) { |
|
| 135 | + $d[$k] = $n[$k] . "</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 136 | + . join('',$t[$k]); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + $navigation = array(_T('zbug_statistiques'), |
|
| 140 | + "<tr><td>" |
|
| 141 | + . join("</td></tr>\n<tr><td>", $d) |
|
| 142 | + . "</td></tr>\n" |
|
| 143 | + . (# _request('var_mode_objet') ? '' : |
|
| 144 | + ("<tr><td>" . count($temps) . "</td><td>" . _T('info_total') . '</td><td class="time">' . $total . "</td><td></td></tr>"))); |
|
| 145 | 145 | |
| 146 | - return array($temps, $navigation); |
|
| 146 | + return array($temps, $navigation); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | ?> |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // http://doc.spip.org/@trace_query_start |
| 16 | 18 | function trace_query_start() |
@@ -27,11 +29,13 @@ discard block |
||
| 27 | 29 | |
| 28 | 30 | // http://doc.spip.org/@trace_query_end |
| 29 | 31 | function trace_query_end($query, $start, $result, $erreur, $serveur=''){ |
| 30 | - if ($start) |
|
| 31 | - trace_query_chrono($start, microtime(), $query, $result, $serveur); |
|
| 32 | + if ($start) { |
|
| 33 | + trace_query_chrono($start, microtime(), $query, $result, $serveur); |
|
| 34 | + } |
|
| 32 | 35 | // tracer les erreurs, sauf pour select, c'est fait dans abstract_sql |
| 33 | - if ($erreur AND !preg_match('/^select\b/i', $query)) |
|
| 34 | - erreur_squelette(array(sql_errno($serveur), $erreur, $query)); |
|
| 36 | + if ($erreur AND !preg_match('/^select\b/i', $query)) { |
|
| 37 | + erreur_squelette(array(sql_errno($serveur), $erreur, $query)); |
|
| 38 | + } |
|
| 35 | 39 | return $result; |
| 36 | 40 | } |
| 37 | 41 | |
@@ -46,12 +50,17 @@ discard block |
||
| 46 | 50 | $x = _request('var_mode_objet'); |
| 47 | 51 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 48 | 52 | list(, $boucle, $serveur, $contexte) = $GLOBALS['debug']['aucasou']; |
| 49 | - if ($x AND !preg_match("/$boucle\$/", $x)) |
|
| 50 | - return; |
|
| 51 | - if ($serveur) $boucle .= " ($serveur)"; |
|
| 53 | + if ($x AND !preg_match("/$boucle\$/", $x)) { |
|
| 54 | + return; |
|
| 55 | + } |
|
| 56 | + if ($serveur) { |
|
| 57 | + $boucle .= " ($serveur)"; |
|
| 58 | + } |
|
| 52 | 59 | $boucle = "<b>$boucle</b>"; |
| 53 | 60 | } else { |
| 54 | - if ($x) return; |
|
| 61 | + if ($x) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 55 | 64 | $boucle = $contexte = ''; |
| 56 | 65 | } |
| 57 | 66 | |
@@ -80,16 +89,21 @@ discard block |
||
| 80 | 89 | $k = ($contexte[0] . " $boucle"); |
| 81 | 90 | include_spip('public/compiler'); |
| 82 | 91 | $env = reconstruire_contexte_compil($contexte); |
| 83 | - } else $k = $env = $boucle; |
|
| 92 | + } else { |
|
| 93 | + $k = $env = $boucle; |
|
| 94 | + } |
|
| 84 | 95 | |
| 85 | 96 | $total += $dt; |
| 86 | 97 | $t[$key] = $dt; |
| 87 | 98 | $q[$key] = $nb; |
| 88 | 99 | $d[$k]+= $dt; |
| 89 | - if ($k) @++$n[$k]; |
|
| 100 | + if ($k) { |
|
| 101 | + @++$n[$k]; |
|
| 102 | + } |
|
| 90 | 103 | |
| 91 | - if (!is_array($explain)) |
|
| 92 | - $explain = array(); |
|
| 104 | + if (!is_array($explain)) { |
|
| 105 | + $explain = array(); |
|
| 106 | + } |
|
| 93 | 107 | foreach($explain as $j => $v) { |
| 94 | 108 | $explain[$j] = "<tr><th>$j</th><td>" |
| 95 | 109 | . str_replace(';','<br />',$v) |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // http://doc.spip.org/@trace_query_end |
| 29 | -function trace_query_end($query, $start, $result, $erreur, $serveur=''){ |
|
| 29 | +function trace_query_end($query, $start, $result, $erreur, $serveur = '') { |
|
| 30 | 30 | if ($start) |
| 31 | 31 | trace_query_chrono($start, microtime(), $query, $result, $serveur); |
| 32 | 32 | // tracer les erreurs, sauf pour select, c'est fait dans abstract_sql |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // http://doc.spip.org/@trace_query_chrono |
| 39 | -function trace_query_chrono($m1, $m2, $query, $result, $serveur='') |
|
| 39 | +function trace_query_chrono($m1, $m2, $query, $result, $serveur = '') |
|
| 40 | 40 | { |
| 41 | - static $tt = 0, $nb=0; |
|
| 41 | + static $tt = 0, $nb = 0; |
|
| 42 | 42 | global $tableau_des_temps; |
| 43 | 43 | |
| 44 | 44 | include_spip('inc/filtres_mini'); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | $tt += $dt; |
| 62 | 62 | $nb++; |
| 63 | 63 | |
| 64 | - $q = preg_replace('/([a-z)`])\s+([A-Z])/', "$1\n<br />$2",spip_htmlentities($query)); |
|
| 65 | - $e = sql_explain($query, $serveur); |
|
| 66 | - $r = str_replace('Resource id ','',(is_object($result)?get_class($result):$result)); |
|
| 64 | + $q = preg_replace('/([a-z)`])\s+([A-Z])/', "$1\n<br />$2", spip_htmlentities($query)); |
|
| 65 | + $e = sql_explain($query, $serveur); |
|
| 66 | + $r = str_replace('Resource id ', '', (is_object($result) ?get_class($result) : $result)); |
|
| 67 | 67 | $tableau_des_temps[] = array($dt, $nb, $boucle, $q, $e, $r, $contexte); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | function chrono_requete($temps) |
| 72 | 72 | { |
| 73 | 73 | $total = 0; |
| 74 | - $hors = "<i>" . _T('zbug_hors_compilation') . "</i>"; |
|
| 74 | + $hors = "<i>"._T('zbug_hors_compilation')."</i>"; |
|
| 75 | 75 | $t = $q = $n = $d = array(); |
| 76 | 76 | // Totaliser les temps et completer le Explain |
| 77 | 77 | foreach ($temps as $key => $v) { |
| 78 | 78 | list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v; |
| 79 | 79 | if (is_array($contexte)) { |
| 80 | - $k = ($contexte[0] . " $boucle"); |
|
| 80 | + $k = ($contexte[0]." $boucle"); |
|
| 81 | 81 | include_spip('public/compiler'); |
| 82 | 82 | $env = reconstruire_contexte_compil($contexte); |
| 83 | 83 | } else $k = $env = $boucle; |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | $total += $dt; |
| 86 | 86 | $t[$key] = $dt; |
| 87 | 87 | $q[$key] = $nb; |
| 88 | - $d[$k]+= $dt; |
|
| 88 | + $d[$k] += $dt; |
|
| 89 | 89 | if ($k) @++$n[$k]; |
| 90 | 90 | |
| 91 | 91 | if (!is_array($explain)) |
| 92 | 92 | $explain = array(); |
| 93 | - foreach($explain as $j => $v) { |
|
| 93 | + foreach ($explain as $j => $v) { |
|
| 94 | 94 | $explain[$j] = "<tr><th>$j</th><td>" |
| 95 | - . str_replace(';','<br />',$v) |
|
| 95 | + . str_replace(';', '<br />', $v) |
|
| 96 | 96 | . "</td></tr>"; |
| 97 | 97 | } |
| 98 | 98 | $e = "<table class='explain'>" |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | $i = 1; |
| 114 | 114 | $t = array(); |
| 115 | 115 | // Fabriquer les liens de navigations dans le tableau des temps |
| 116 | - foreach($temps as $k => $v) { |
|
| 116 | + foreach ($temps as $k => $v) { |
|
| 117 | 117 | $titre = strip_tags($v[2]); |
| 118 | 118 | $href = quote_amp($GLOBALS['REQUEST_URI'])."#req$i"; |
| 119 | 119 | |
| 120 | - $t[$v[2]][]= "<span class='spip-debug-arg'> " |
|
| 120 | + $t[$v[2]][] = "<span class='spip-debug-arg'> " |
|
| 121 | 121 | . "<a title='$titre' href='$href'>$i</a>" |
| 122 | 122 | . '</span>' |
| 123 | - . ((count($t[$v[2]]) % 10 == 9) ? "<br />" : ''); |
|
| 123 | + . ((count($t[$v[2]]) % 10 == 9) ? "<br />" : ''); |
|
| 124 | 124 | $i++; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | unset($d['']); |
| 133 | 133 | // Fabriquer le tableau des liens de navigation dans le grand tableau |
| 134 | 134 | foreach ($d as $k => $v) { |
| 135 | - $d[$k] = $n[$k] . "</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 136 | - . join('',$t[$k]); |
|
| 135 | + $d[$k] = $n[$k]."</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>" |
|
| 136 | + . join('', $t[$k]); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $navigation = array(_T('zbug_statistiques'), |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | . join("</td></tr>\n<tr><td>", $d) |
| 142 | 142 | . "</td></tr>\n" |
| 143 | 143 | . (# _request('var_mode_objet') ? '' : |
| 144 | - ("<tr><td>" . count($temps) . "</td><td>" . _T('info_total') . '</td><td class="time">' . $total . "</td><td></td></tr>"))); |
|
| 144 | + ("<tr><td>".count($temps)."</td><td>"._T('info_total').'</td><td class="time">'.$total."</td><td></td></tr>"))); |
|
| 145 | 145 | |
| 146 | 146 | return array($temps, $navigation); |
| 147 | 147 | } |
@@ -139,6 +139,9 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // http://doc.spip.org/@analyser_dtd_comment |
| 142 | +/** |
|
| 143 | + * @param string $dtd |
|
| 144 | + */ |
|
| 142 | 145 | function analyser_dtd_comment($dtd, &$dtc, $grammaire){ |
| 143 | 146 | // ejecter les commentaires, surtout quand ils contiennent du code. |
| 144 | 147 | // Option /s car sur plusieurs lignes parfois |
@@ -149,6 +152,9 @@ discard block |
||
| 149 | 152 | } |
| 150 | 153 | |
| 151 | 154 | // http://doc.spip.org/@analyser_dtd_pi |
| 155 | +/** |
|
| 156 | + * @param string $dtd |
|
| 157 | + */ |
|
| 152 | 158 | function analyser_dtd_pi($dtd, &$dtc, $grammaire){ |
| 153 | 159 | if (!preg_match('/^<\?.*?>\s*(.*)$/s', $dtd, $m)) |
| 154 | 160 | return -10; |
@@ -156,6 +162,9 @@ discard block |
||
| 156 | 162 | } |
| 157 | 163 | |
| 158 | 164 | // http://doc.spip.org/@analyser_dtd_lexeme |
| 165 | +/** |
|
| 166 | + * @param string $dtd |
|
| 167 | + */ |
|
| 159 | 168 | function analyser_dtd_lexeme($dtd, &$dtc, $grammaire){ |
| 160 | 169 | |
| 161 | 170 | if (!preg_match(_REGEXP_ENTITY_DEF,$dtd, $m)) |
@@ -181,6 +190,9 @@ discard block |
||
| 181 | 190 | // ca ne depasse pas 3 ici. |
| 182 | 191 | |
| 183 | 192 | // http://doc.spip.org/@analyser_dtd_data |
| 193 | +/** |
|
| 194 | + * @param string $dtd |
|
| 195 | + */ |
|
| 184 | 196 | function analyser_dtd_data($dtd, &$dtc, $grammaire){ |
| 185 | 197 | |
| 186 | 198 | if (!preg_match(_REGEXP_INCLUDE_USE,$dtd,$m)) |
@@ -196,6 +208,9 @@ discard block |
||
| 196 | 208 | } |
| 197 | 209 | |
| 198 | 210 | // http://doc.spip.org/@analyser_dtd_notation |
| 211 | +/** |
|
| 212 | + * @param string $dtd |
|
| 213 | + */ |
|
| 199 | 214 | function analyser_dtd_notation($dtd, &$dtc, $grammaire){ |
| 200 | 215 | if (!preg_match('/^<!NOTATION.*?>\s*(.*)$/s',$dtd, $m)) |
| 201 | 216 | return -8; |
@@ -204,6 +219,9 @@ discard block |
||
| 204 | 219 | } |
| 205 | 220 | |
| 206 | 221 | // http://doc.spip.org/@analyser_dtd_entity |
| 222 | +/** |
|
| 223 | + * @param string $dtd |
|
| 224 | + */ |
|
| 207 | 225 | function analyser_dtd_entity($dtd, &$dtc, $grammaire) |
| 208 | 226 | { |
| 209 | 227 | if (!preg_match(_REGEXP_ENTITY_DECL, $dtd, $m)) |
@@ -253,6 +271,9 @@ discard block |
||
| 253 | 271 | // Fin du controle en finElement |
| 254 | 272 | |
| 255 | 273 | // http://doc.spip.org/@analyser_dtd_element |
| 274 | +/** |
|
| 275 | + * @param string $dtd |
|
| 276 | + */ |
|
| 256 | 277 | function analyser_dtd_element($dtd, &$dtc, $grammaire) |
| 257 | 278 | { |
| 258 | 279 | if (!preg_match('/^<!ELEMENT\s+([^>\s]+)([^>]*)>\s*(.*)$/s', $dtd, $m)) |
@@ -295,6 +316,9 @@ discard block |
||
| 295 | 316 | |
| 296 | 317 | |
| 297 | 318 | // http://doc.spip.org/@analyser_dtd_attlist |
| 319 | +/** |
|
| 320 | + * @param string $dtd |
|
| 321 | + */ |
|
| 298 | 322 | function analyser_dtd_attlist($dtd, &$dtc, $grammaire) |
| 299 | 323 | { |
| 300 | 324 | if (!preg_match('/^<!ATTLIST\s+(\S+)\s+([^>]*)>\s*(.*)/s', $dtd, $m)) |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | include_spip('base/abstract_sql'); |
| 16 | 16 | |
| 17 | +/** |
|
| 18 | + * @param string $cible |
|
| 19 | + */ |
|
| 17 | 20 | function is_url_prive($cible){ |
| 18 | 21 | include_spip('inc/filtres_mini'); |
| 19 | 22 | $path = parse_url(tester_url_absolue($cible)?$cible:url_absolue($cible)); |
@@ -15,87 +15,87 @@ discard block |
||
| 15 | 15 | include_spip('base/abstract_sql'); |
| 16 | 16 | |
| 17 | 17 | function is_url_prive($cible){ |
| 18 | - include_spip('inc/filtres_mini'); |
|
| 19 | - $path = parse_url(tester_url_absolue($cible)?$cible:url_absolue($cible)); |
|
| 20 | - $path = (isset($path['path'])?$path['path']:''); |
|
| 21 | - return strncmp(substr($path,-strlen(_DIR_RESTREINT_ABS)), _DIR_RESTREINT_ABS, strlen(_DIR_RESTREINT_ABS))==0; |
|
| 18 | + include_spip('inc/filtres_mini'); |
|
| 19 | + $path = parse_url(tester_url_absolue($cible)?$cible:url_absolue($cible)); |
|
| 20 | + $path = (isset($path['path'])?$path['path']:''); |
|
| 21 | + return strncmp(substr($path,-strlen(_DIR_RESTREINT_ABS)), _DIR_RESTREINT_ABS, strlen(_DIR_RESTREINT_ABS))==0; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | function formulaires_login_charger_dist($cible="",$login="",$prive=null) |
| 25 | 25 | { |
| 26 | - $erreur = _request('var_erreur'); |
|
| 27 | - |
|
| 28 | - if (!$login) $login = strval(_request('var_login')); |
|
| 29 | - // si on est deja identifie |
|
| 30 | - if (!$login AND isset($GLOBALS['visiteur_session']['login'])) { |
|
| 31 | - $login = $GLOBALS['visiteur_session']['login']; |
|
| 32 | - } |
|
| 33 | - // ou si on a un cookie admin |
|
| 34 | - if (!$login) { |
|
| 35 | - if (isset($_COOKIE['spip_admin']) |
|
| 36 | - AND preg_match(",^@(.*)$,", $_COOKIE['spip_admin'], $regs)) |
|
| 37 | - $login = $regs[1]; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - include_spip('inc/auth'); |
|
| 41 | - $row = auth_informer_login($login); |
|
| 42 | - |
|
| 43 | - // Construire l'environnement du squelette |
|
| 44 | - // Ne pas proposer de "rester connecte quelques jours" |
|
| 45 | - // si la duree de l'alea est inferieure a 12 h (valeur par defaut) |
|
| 26 | + $erreur = _request('var_erreur'); |
|
| 27 | + |
|
| 28 | + if (!$login) $login = strval(_request('var_login')); |
|
| 29 | + // si on est deja identifie |
|
| 30 | + if (!$login AND isset($GLOBALS['visiteur_session']['login'])) { |
|
| 31 | + $login = $GLOBALS['visiteur_session']['login']; |
|
| 32 | + } |
|
| 33 | + // ou si on a un cookie admin |
|
| 34 | + if (!$login) { |
|
| 35 | + if (isset($_COOKIE['spip_admin']) |
|
| 36 | + AND preg_match(",^@(.*)$,", $_COOKIE['spip_admin'], $regs)) |
|
| 37 | + $login = $regs[1]; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + include_spip('inc/auth'); |
|
| 41 | + $row = auth_informer_login($login); |
|
| 42 | + |
|
| 43 | + // Construire l'environnement du squelette |
|
| 44 | + // Ne pas proposer de "rester connecte quelques jours" |
|
| 45 | + // si la duree de l'alea est inferieure a 12 h (valeur par defaut) |
|
| 46 | 46 | |
| 47 | - $valeurs = array( |
|
| 48 | - 'var_login' => $login, |
|
| 49 | - 'editable' => !$row, |
|
| 50 | - 'cnx' => isset($row['cnx']) ? $row['cnx'] : '', |
|
| 51 | - 'auth_http' => login_auth_http(), |
|
| 52 | - 'rester_connecte' => ((_RENOUVELLE_ALEA < 12*3600)? '' : ' '), |
|
| 53 | - '_logo' => isset($row['logo']) ? $row['logo'] : '', |
|
| 54 | - '_alea_actuel' => isset($row['alea_actuel'])?$row['alea_actuel']:'', |
|
| 55 | - '_alea_futur' => isset($row['alea_futur'])?$row['alea_futur']:'', |
|
| 56 | - '_pipeline' => 'affiche_formulaire_login', // faire passer le formulaire dans un pipe dedie pour les methodes auth |
|
| 57 | - ); |
|
| 58 | - |
|
| 59 | - if ($erreur OR !isset($GLOBALS['visiteur_session']['id_auteur']) OR !$GLOBALS['visiteur_session']['id_auteur']) |
|
| 60 | - $valeurs['editable'] = true; |
|
| 61 | - |
|
| 62 | - if (is_null($prive) ? is_url_prive($cible) : $prive) { |
|
| 63 | - include_spip('inc/autoriser'); |
|
| 64 | - $loge = autoriser('ecrire'); |
|
| 65 | - } |
|
| 66 | - else |
|
| 67 | - $loge = (isset($GLOBALS['visiteur_session']['auth']) AND $GLOBALS['visiteur_session']['auth'] != ''); |
|
| 68 | - |
|
| 69 | - // Si on est connecte, appeler traiter() |
|
| 70 | - // et lancer la redirection si besoin |
|
| 71 | - if (!$valeurs['editable'] AND $loge) { |
|
| 72 | - $traiter = charger_fonction('traiter','formulaires/login'); |
|
| 73 | - $res = $traiter($cible, $login, $prive); |
|
| 74 | - $valeurs = array_merge($valeurs,$res); |
|
| 75 | - |
|
| 76 | - if (isset($res['redirect']) and $res['redirect']){ |
|
| 77 | - include_spip('inc/headers'); |
|
| 78 | - # preparer un lien pour quand redirige_formulaire ne fonctionne pas |
|
| 79 | - $m = redirige_formulaire($res['redirect']); |
|
| 80 | - $valeurs['_deja_loge'] = inserer_attribut( |
|
| 81 | - "<a>" . _T('login_par_ici') . "</a>$m", |
|
| 82 | - 'href', $res['redirect'] |
|
| 83 | - ); |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - // en cas d'echec de cookie, inc_auth a renvoye vers le script de |
|
| 87 | - // pose de cookie ; s'il n'est pas la, c'est echec cookie |
|
| 88 | - // s'il est la, c'est probablement un bookmark sur bonjour=oui, |
|
| 89 | - // et pas un echec cookie. |
|
| 90 | - if ($erreur == 'cookie') $valeurs['echec_cookie'] = ' '; |
|
| 91 | - elseif ($erreur){ |
|
| 92 | - // une erreur d'un SSO indique dans la redirection vers ici |
|
| 93 | - // mais il faut se proteger de toute tentative d'injection malveilante |
|
| 94 | - include_spip('inc/texte'); |
|
| 95 | - $valeurs['message_erreur'] = safehtml($erreur); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - return $valeurs; |
|
| 47 | + $valeurs = array( |
|
| 48 | + 'var_login' => $login, |
|
| 49 | + 'editable' => !$row, |
|
| 50 | + 'cnx' => isset($row['cnx']) ? $row['cnx'] : '', |
|
| 51 | + 'auth_http' => login_auth_http(), |
|
| 52 | + 'rester_connecte' => ((_RENOUVELLE_ALEA < 12*3600)? '' : ' '), |
|
| 53 | + '_logo' => isset($row['logo']) ? $row['logo'] : '', |
|
| 54 | + '_alea_actuel' => isset($row['alea_actuel'])?$row['alea_actuel']:'', |
|
| 55 | + '_alea_futur' => isset($row['alea_futur'])?$row['alea_futur']:'', |
|
| 56 | + '_pipeline' => 'affiche_formulaire_login', // faire passer le formulaire dans un pipe dedie pour les methodes auth |
|
| 57 | + ); |
|
| 58 | + |
|
| 59 | + if ($erreur OR !isset($GLOBALS['visiteur_session']['id_auteur']) OR !$GLOBALS['visiteur_session']['id_auteur']) |
|
| 60 | + $valeurs['editable'] = true; |
|
| 61 | + |
|
| 62 | + if (is_null($prive) ? is_url_prive($cible) : $prive) { |
|
| 63 | + include_spip('inc/autoriser'); |
|
| 64 | + $loge = autoriser('ecrire'); |
|
| 65 | + } |
|
| 66 | + else |
|
| 67 | + $loge = (isset($GLOBALS['visiteur_session']['auth']) AND $GLOBALS['visiteur_session']['auth'] != ''); |
|
| 68 | + |
|
| 69 | + // Si on est connecte, appeler traiter() |
|
| 70 | + // et lancer la redirection si besoin |
|
| 71 | + if (!$valeurs['editable'] AND $loge) { |
|
| 72 | + $traiter = charger_fonction('traiter','formulaires/login'); |
|
| 73 | + $res = $traiter($cible, $login, $prive); |
|
| 74 | + $valeurs = array_merge($valeurs,$res); |
|
| 75 | + |
|
| 76 | + if (isset($res['redirect']) and $res['redirect']){ |
|
| 77 | + include_spip('inc/headers'); |
|
| 78 | + # preparer un lien pour quand redirige_formulaire ne fonctionne pas |
|
| 79 | + $m = redirige_formulaire($res['redirect']); |
|
| 80 | + $valeurs['_deja_loge'] = inserer_attribut( |
|
| 81 | + "<a>" . _T('login_par_ici') . "</a>$m", |
|
| 82 | + 'href', $res['redirect'] |
|
| 83 | + ); |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + // en cas d'echec de cookie, inc_auth a renvoye vers le script de |
|
| 87 | + // pose de cookie ; s'il n'est pas la, c'est echec cookie |
|
| 88 | + // s'il est la, c'est probablement un bookmark sur bonjour=oui, |
|
| 89 | + // et pas un echec cookie. |
|
| 90 | + if ($erreur == 'cookie') $valeurs['echec_cookie'] = ' '; |
|
| 91 | + elseif ($erreur){ |
|
| 92 | + // une erreur d'un SSO indique dans la redirection vers ici |
|
| 93 | + // mais il faut se proteger de toute tentative d'injection malveilante |
|
| 94 | + include_spip('inc/texte'); |
|
| 95 | + $valeurs['message_erreur'] = safehtml($erreur); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + return $valeurs; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -104,116 +104,116 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | function login_auth_http() |
| 106 | 106 | { |
| 107 | - if (!$GLOBALS['ignore_auth_http'] |
|
| 108 | - AND _request('var_erreur')=='cookie' |
|
| 109 | - AND (!isset($_COOKIE['spip_session']) OR $_COOKIE['spip_session'] != 'test_echec_cookie') |
|
| 110 | - AND (($GLOBALS['flag_sapi_name'] AND preg_match(",apache,i", @php_sapi_name())) |
|
| 111 | - OR preg_match(",^Apache.* PHP,", $_SERVER['SERVER_SOFTWARE'])) |
|
| 112 | - // Attention dans le cas 'intranet' la proposition de se loger |
|
| 113 | - // par auth_http peut conduire a l'echec. |
|
| 114 | - AND !(isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW']))) |
|
| 115 | - |
|
| 116 | - return generer_url_action('cookie',"",false,true); |
|
| 117 | - else return ''; |
|
| 107 | + if (!$GLOBALS['ignore_auth_http'] |
|
| 108 | + AND _request('var_erreur')=='cookie' |
|
| 109 | + AND (!isset($_COOKIE['spip_session']) OR $_COOKIE['spip_session'] != 'test_echec_cookie') |
|
| 110 | + AND (($GLOBALS['flag_sapi_name'] AND preg_match(",apache,i", @php_sapi_name())) |
|
| 111 | + OR preg_match(",^Apache.* PHP,", $_SERVER['SERVER_SOFTWARE'])) |
|
| 112 | + // Attention dans le cas 'intranet' la proposition de se loger |
|
| 113 | + // par auth_http peut conduire a l'echec. |
|
| 114 | + AND !(isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW']))) |
|
| 115 | + |
|
| 116 | + return generer_url_action('cookie',"",false,true); |
|
| 117 | + else return ''; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | function formulaires_login_verifier_dist($cible="",$login="",$prive=null){ |
| 121 | 121 | |
| 122 | - $session_login = _request('var_login'); |
|
| 123 | - $session_password = _request('password'); |
|
| 124 | - $session_remember = _request('session_remember'); |
|
| 125 | - |
|
| 126 | - if (!$session_login) { |
|
| 127 | - # pas de login saisi ! |
|
| 128 | - return array('var_login' => _T('info_obligatoire')); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - // appeler auth_identifier_login qui va : |
|
| 132 | - // - renvoyer un string si echec (message d'erreur) |
|
| 133 | - // - un array decrivant l'auteur identifie si possible |
|
| 134 | - // - rediriger vers un SSO qui renverra in fine sur action/auth qui finira l'authentification |
|
| 135 | - include_spip('inc/auth'); |
|
| 136 | - $auteur = auth_identifier_login($session_login, $session_password); |
|
| 137 | - // on arrive ici si on ne s'est pas identifie avec un SSO |
|
| 138 | - if (!is_array($auteur)) { |
|
| 139 | - $erreurs = array(); |
|
| 140 | - if (is_string($auteur)) |
|
| 141 | - $erreurs['var_login'] = $auteur; |
|
| 142 | - include_spip('inc/cookie'); |
|
| 143 | - spip_setcookie("spip_admin", "", time() - 3600); |
|
| 144 | - if (strlen($session_password)) |
|
| 145 | - $erreurs['password'] = _T('login_erreur_pass'); |
|
| 146 | - // sinon c'est un login en deux passe old style (ou js en panne) |
|
| 147 | - // pas de message d'erreur |
|
| 148 | - else |
|
| 149 | - $erreurs['password'] = ' '; |
|
| 150 | - return |
|
| 151 | - $erreurs; |
|
| 152 | - } |
|
| 153 | - // on a ete authentifie, construire la session |
|
| 154 | - // en gerant la duree demandee pour son cookie |
|
| 155 | - if ($session_remember !== NULL) |
|
| 156 | - $auteur['cookie'] = $session_remember; |
|
| 157 | - auth_loger($auteur); |
|
| 158 | - |
|
| 159 | - return (is_null($prive) ? is_url_prive($cible) : $prive) |
|
| 160 | - ? login_autoriser() : array(); |
|
| 122 | + $session_login = _request('var_login'); |
|
| 123 | + $session_password = _request('password'); |
|
| 124 | + $session_remember = _request('session_remember'); |
|
| 125 | + |
|
| 126 | + if (!$session_login) { |
|
| 127 | + # pas de login saisi ! |
|
| 128 | + return array('var_login' => _T('info_obligatoire')); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + // appeler auth_identifier_login qui va : |
|
| 132 | + // - renvoyer un string si echec (message d'erreur) |
|
| 133 | + // - un array decrivant l'auteur identifie si possible |
|
| 134 | + // - rediriger vers un SSO qui renverra in fine sur action/auth qui finira l'authentification |
|
| 135 | + include_spip('inc/auth'); |
|
| 136 | + $auteur = auth_identifier_login($session_login, $session_password); |
|
| 137 | + // on arrive ici si on ne s'est pas identifie avec un SSO |
|
| 138 | + if (!is_array($auteur)) { |
|
| 139 | + $erreurs = array(); |
|
| 140 | + if (is_string($auteur)) |
|
| 141 | + $erreurs['var_login'] = $auteur; |
|
| 142 | + include_spip('inc/cookie'); |
|
| 143 | + spip_setcookie("spip_admin", "", time() - 3600); |
|
| 144 | + if (strlen($session_password)) |
|
| 145 | + $erreurs['password'] = _T('login_erreur_pass'); |
|
| 146 | + // sinon c'est un login en deux passe old style (ou js en panne) |
|
| 147 | + // pas de message d'erreur |
|
| 148 | + else |
|
| 149 | + $erreurs['password'] = ' '; |
|
| 150 | + return |
|
| 151 | + $erreurs; |
|
| 152 | + } |
|
| 153 | + // on a ete authentifie, construire la session |
|
| 154 | + // en gerant la duree demandee pour son cookie |
|
| 155 | + if ($session_remember !== NULL) |
|
| 156 | + $auteur['cookie'] = $session_remember; |
|
| 157 | + auth_loger($auteur); |
|
| 158 | + |
|
| 159 | + return (is_null($prive) ? is_url_prive($cible) : $prive) |
|
| 160 | + ? login_autoriser() : array(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | function login_autoriser() |
| 164 | 164 | { |
| 165 | - include_spip('inc/autoriser'); |
|
| 166 | - if (!autoriser('ecrire')){ |
|
| 167 | - $h = generer_url_action('logout','logout=prive&url='.urlencode(self())); |
|
| 168 | - return array('message_erreur' => "<h1>" |
|
| 169 | - ._T('avis_erreur_visiteur') |
|
| 170 | - ."</h1><p>" |
|
| 171 | - ._T('texte_erreur_visiteur') |
|
| 172 | - ."</p><p class='retour'>[<a href='$h'>" |
|
| 173 | - ._T('icone_deconnecter')."</a>]</p>"); |
|
| 174 | - } |
|
| 175 | - return array(); |
|
| 165 | + include_spip('inc/autoriser'); |
|
| 166 | + if (!autoriser('ecrire')){ |
|
| 167 | + $h = generer_url_action('logout','logout=prive&url='.urlencode(self())); |
|
| 168 | + return array('message_erreur' => "<h1>" |
|
| 169 | + ._T('avis_erreur_visiteur') |
|
| 170 | + ."</h1><p>" |
|
| 171 | + ._T('texte_erreur_visiteur') |
|
| 172 | + ."</p><p class='retour'>[<a href='$h'>" |
|
| 173 | + ._T('icone_deconnecter')."</a>]</p>"); |
|
| 174 | + } |
|
| 175 | + return array(); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | function formulaires_login_traiter_dist($cible="",$login="",$prive=null){ |
| 179 | - $res = array(); |
|
| 180 | - // Si on se connecte dans l'espace prive, |
|
| 181 | - // ajouter "bonjour" (repere a peu pres les cookies desactives) |
|
| 182 | - if (is_null($prive) ? is_url_prive($cible) : $prive) { |
|
| 183 | - $cible = parametre_url($cible, 'bonjour', 'oui', '&'); |
|
| 184 | - } |
|
| 185 | - if ($cible=='@page_auteur') |
|
| 186 | - $cible = generer_url_entite($GLOBALS['auteur_session']['id_auteur'],'auteur'); |
|
| 187 | - |
|
| 188 | - if ($cible) { |
|
| 189 | - $cible = parametre_url($cible, 'var_login', '', '&'); |
|
| 190 | - |
|
| 191 | - // transformer la cible absolue en cible relative |
|
| 192 | - // pour pas echouer quand la meta adresse_site est foireuse |
|
| 193 | - if (strncmp($cible,$u = url_de_base(),strlen($u))==0){ |
|
| 194 | - $cible = "./".substr($cible,strlen($u)); |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - // si c'est une url absolue, refuser la redirection |
|
| 198 | - // sauf si cette securite est levee volontairement par le webmestre |
|
| 199 | - elseif (tester_url_absolue($cible) AND !defined('_AUTORISER_LOGIN_ABS_REDIRECT')) { |
|
| 200 | - $cible = ""; |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - // Si on est connecte, envoyer vers la destination |
|
| 205 | - if ($cible AND ($cible!=self('&')) AND ($cible!=self())) { |
|
| 206 | - if (!headers_sent() AND !$_GET['var_mode']) { |
|
| 207 | - include_spip('inc/headers'); |
|
| 208 | - $res['redirect'] = $cible; |
|
| 209 | - } else { |
|
| 210 | - $res['message_ok'] = inserer_attribut( |
|
| 211 | - "<a>" . _T('login_par_ici') . "</a>", |
|
| 212 | - 'href', $cible |
|
| 213 | - ); |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - return $res; |
|
| 179 | + $res = array(); |
|
| 180 | + // Si on se connecte dans l'espace prive, |
|
| 181 | + // ajouter "bonjour" (repere a peu pres les cookies desactives) |
|
| 182 | + if (is_null($prive) ? is_url_prive($cible) : $prive) { |
|
| 183 | + $cible = parametre_url($cible, 'bonjour', 'oui', '&'); |
|
| 184 | + } |
|
| 185 | + if ($cible=='@page_auteur') |
|
| 186 | + $cible = generer_url_entite($GLOBALS['auteur_session']['id_auteur'],'auteur'); |
|
| 187 | + |
|
| 188 | + if ($cible) { |
|
| 189 | + $cible = parametre_url($cible, 'var_login', '', '&'); |
|
| 190 | + |
|
| 191 | + // transformer la cible absolue en cible relative |
|
| 192 | + // pour pas echouer quand la meta adresse_site est foireuse |
|
| 193 | + if (strncmp($cible,$u = url_de_base(),strlen($u))==0){ |
|
| 194 | + $cible = "./".substr($cible,strlen($u)); |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + // si c'est une url absolue, refuser la redirection |
|
| 198 | + // sauf si cette securite est levee volontairement par le webmestre |
|
| 199 | + elseif (tester_url_absolue($cible) AND !defined('_AUTORISER_LOGIN_ABS_REDIRECT')) { |
|
| 200 | + $cible = ""; |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + // Si on est connecte, envoyer vers la destination |
|
| 205 | + if ($cible AND ($cible!=self('&')) AND ($cible!=self())) { |
|
| 206 | + if (!headers_sent() AND !$_GET['var_mode']) { |
|
| 207 | + include_spip('inc/headers'); |
|
| 208 | + $res['redirect'] = $cible; |
|
| 209 | + } else { |
|
| 210 | + $res['message_ok'] = inserer_attribut( |
|
| 211 | + "<a>" . _T('login_par_ici') . "</a>", |
|
| 212 | + 'href', $cible |
|
| 213 | + ); |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + return $res; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | ?> |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | include_spip('base/abstract_sql'); |
| 16 | 18 | |
@@ -25,7 +27,9 @@ discard block |
||
| 25 | 27 | { |
| 26 | 28 | $erreur = _request('var_erreur'); |
| 27 | 29 | |
| 28 | - if (!$login) $login = strval(_request('var_login')); |
|
| 30 | + if (!$login) { |
|
| 31 | + $login = strval(_request('var_login')); |
|
| 32 | + } |
|
| 29 | 33 | // si on est deja identifie |
| 30 | 34 | if (!$login AND isset($GLOBALS['visiteur_session']['login'])) { |
| 31 | 35 | $login = $GLOBALS['visiteur_session']['login']; |
@@ -33,8 +37,9 @@ discard block |
||
| 33 | 37 | // ou si on a un cookie admin |
| 34 | 38 | if (!$login) { |
| 35 | 39 | if (isset($_COOKIE['spip_admin']) |
| 36 | - AND preg_match(",^@(.*)$,", $_COOKIE['spip_admin'], $regs)) |
|
| 37 | - $login = $regs[1]; |
|
| 40 | + AND preg_match(",^@(.*)$,", $_COOKIE['spip_admin'], $regs)) { |
|
| 41 | + $login = $regs[1]; |
|
| 42 | + } |
|
| 38 | 43 | } |
| 39 | 44 | |
| 40 | 45 | include_spip('inc/auth'); |
@@ -56,15 +61,16 @@ discard block |
||
| 56 | 61 | '_pipeline' => 'affiche_formulaire_login', // faire passer le formulaire dans un pipe dedie pour les methodes auth |
| 57 | 62 | ); |
| 58 | 63 | |
| 59 | - if ($erreur OR !isset($GLOBALS['visiteur_session']['id_auteur']) OR !$GLOBALS['visiteur_session']['id_auteur']) |
|
| 60 | - $valeurs['editable'] = true; |
|
| 64 | + if ($erreur OR !isset($GLOBALS['visiteur_session']['id_auteur']) OR !$GLOBALS['visiteur_session']['id_auteur']) { |
|
| 65 | + $valeurs['editable'] = true; |
|
| 66 | + } |
|
| 61 | 67 | |
| 62 | 68 | if (is_null($prive) ? is_url_prive($cible) : $prive) { |
| 63 | 69 | include_spip('inc/autoriser'); |
| 64 | 70 | $loge = autoriser('ecrire'); |
| 65 | - } |
|
| 66 | - else |
|
| 67 | - $loge = (isset($GLOBALS['visiteur_session']['auth']) AND $GLOBALS['visiteur_session']['auth'] != ''); |
|
| 71 | + } else { |
|
| 72 | + $loge = (isset($GLOBALS['visiteur_session']['auth']) AND $GLOBALS['visiteur_session']['auth'] != ''); |
|
| 73 | + } |
|
| 68 | 74 | |
| 69 | 75 | // Si on est connecte, appeler traiter() |
| 70 | 76 | // et lancer la redirection si besoin |
@@ -87,8 +93,9 @@ discard block |
||
| 87 | 93 | // pose de cookie ; s'il n'est pas la, c'est echec cookie |
| 88 | 94 | // s'il est la, c'est probablement un bookmark sur bonjour=oui, |
| 89 | 95 | // et pas un echec cookie. |
| 90 | - if ($erreur == 'cookie') $valeurs['echec_cookie'] = ' '; |
|
| 91 | - elseif ($erreur){ |
|
| 96 | + if ($erreur == 'cookie') { |
|
| 97 | + $valeurs['echec_cookie'] = ' '; |
|
| 98 | + } elseif ($erreur){ |
|
| 92 | 99 | // une erreur d'un SSO indique dans la redirection vers ici |
| 93 | 100 | // mais il faut se proteger de toute tentative d'injection malveilante |
| 94 | 101 | include_spip('inc/texte'); |
@@ -111,11 +118,13 @@ discard block |
||
| 111 | 118 | OR preg_match(",^Apache.* PHP,", $_SERVER['SERVER_SOFTWARE'])) |
| 112 | 119 | // Attention dans le cas 'intranet' la proposition de se loger |
| 113 | 120 | // par auth_http peut conduire a l'echec. |
| 114 | - AND !(isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW']))) |
|
| 115 | - |
|
| 121 | + AND !(isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW']))) { |
|
| 122 | + |
|
| 116 | 123 | return generer_url_action('cookie',"",false,true); |
| 117 | - else return ''; |
|
| 118 | -} |
|
| 124 | + } else { |
|
| 125 | + return ''; |
|
| 126 | + } |
|
| 127 | + } |
|
| 119 | 128 | |
| 120 | 129 | function formulaires_login_verifier_dist($cible="",$login="",$prive=null){ |
| 121 | 130 | |
@@ -137,23 +146,27 @@ discard block |
||
| 137 | 146 | // on arrive ici si on ne s'est pas identifie avec un SSO |
| 138 | 147 | if (!is_array($auteur)) { |
| 139 | 148 | $erreurs = array(); |
| 140 | - if (is_string($auteur)) |
|
| 141 | - $erreurs['var_login'] = $auteur; |
|
| 149 | + if (is_string($auteur)) { |
|
| 150 | + $erreurs['var_login'] = $auteur; |
|
| 151 | + } |
|
| 142 | 152 | include_spip('inc/cookie'); |
| 143 | 153 | spip_setcookie("spip_admin", "", time() - 3600); |
| 144 | - if (strlen($session_password)) |
|
| 145 | - $erreurs['password'] = _T('login_erreur_pass'); |
|
| 154 | + if (strlen($session_password)) { |
|
| 155 | + $erreurs['password'] = _T('login_erreur_pass'); |
|
| 156 | + } |
|
| 146 | 157 | // sinon c'est un login en deux passe old style (ou js en panne) |
| 147 | 158 | // pas de message d'erreur |
| 148 | - else |
|
| 149 | - $erreurs['password'] = ' '; |
|
| 159 | + else { |
|
| 160 | + $erreurs['password'] = ' '; |
|
| 161 | + } |
|
| 150 | 162 | return |
| 151 | 163 | $erreurs; |
| 152 | 164 | } |
| 153 | 165 | // on a ete authentifie, construire la session |
| 154 | 166 | // en gerant la duree demandee pour son cookie |
| 155 | - if ($session_remember !== NULL) |
|
| 156 | - $auteur['cookie'] = $session_remember; |
|
| 167 | + if ($session_remember !== NULL) { |
|
| 168 | + $auteur['cookie'] = $session_remember; |
|
| 169 | + } |
|
| 157 | 170 | auth_loger($auteur); |
| 158 | 171 | |
| 159 | 172 | return (is_null($prive) ? is_url_prive($cible) : $prive) |
@@ -182,8 +195,9 @@ discard block |
||
| 182 | 195 | if (is_null($prive) ? is_url_prive($cible) : $prive) { |
| 183 | 196 | $cible = parametre_url($cible, 'bonjour', 'oui', '&'); |
| 184 | 197 | } |
| 185 | - if ($cible=='@page_auteur') |
|
| 186 | - $cible = generer_url_entite($GLOBALS['auteur_session']['id_auteur'],'auteur'); |
|
| 198 | + if ($cible=='@page_auteur') { |
|
| 199 | + $cible = generer_url_entite($GLOBALS['auteur_session']['id_auteur'],'auteur'); |
|
| 200 | + } |
|
| 187 | 201 | |
| 188 | 202 | if ($cible) { |
| 189 | 203 | $cible = parametre_url($cible, 'var_login', '', '&'); |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | include_spip('base/abstract_sql'); |
| 16 | 16 | |
| 17 | -function is_url_prive($cible){ |
|
| 17 | +function is_url_prive($cible) { |
|
| 18 | 18 | include_spip('inc/filtres_mini'); |
| 19 | - $path = parse_url(tester_url_absolue($cible)?$cible:url_absolue($cible)); |
|
| 20 | - $path = (isset($path['path'])?$path['path']:''); |
|
| 21 | - return strncmp(substr($path,-strlen(_DIR_RESTREINT_ABS)), _DIR_RESTREINT_ABS, strlen(_DIR_RESTREINT_ABS))==0; |
|
| 19 | + $path = parse_url(tester_url_absolue($cible) ? $cible : url_absolue($cible)); |
|
| 20 | + $path = (isset($path['path']) ? $path['path'] : ''); |
|
| 21 | + return strncmp(substr($path, -strlen(_DIR_RESTREINT_ABS)), _DIR_RESTREINT_ABS, strlen(_DIR_RESTREINT_ABS)) == 0; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -function formulaires_login_charger_dist($cible="",$login="",$prive=null) |
|
| 24 | +function formulaires_login_charger_dist($cible = "", $login = "", $prive = null) |
|
| 25 | 25 | { |
| 26 | 26 | $erreur = _request('var_erreur'); |
| 27 | 27 | |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | 'editable' => !$row, |
| 50 | 50 | 'cnx' => isset($row['cnx']) ? $row['cnx'] : '', |
| 51 | 51 | 'auth_http' => login_auth_http(), |
| 52 | - 'rester_connecte' => ((_RENOUVELLE_ALEA < 12*3600)? '' : ' '), |
|
| 52 | + 'rester_connecte' => ((_RENOUVELLE_ALEA < 12 * 3600) ? '' : ' '), |
|
| 53 | 53 | '_logo' => isset($row['logo']) ? $row['logo'] : '', |
| 54 | - '_alea_actuel' => isset($row['alea_actuel'])?$row['alea_actuel']:'', |
|
| 55 | - '_alea_futur' => isset($row['alea_futur'])?$row['alea_futur']:'', |
|
| 54 | + '_alea_actuel' => isset($row['alea_actuel']) ? $row['alea_actuel'] : '', |
|
| 55 | + '_alea_futur' => isset($row['alea_futur']) ? $row['alea_futur'] : '', |
|
| 56 | 56 | '_pipeline' => 'affiche_formulaire_login', // faire passer le formulaire dans un pipe dedie pour les methodes auth |
| 57 | 57 | ); |
| 58 | 58 | |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | // Si on est connecte, appeler traiter() |
| 70 | 70 | // et lancer la redirection si besoin |
| 71 | 71 | if (!$valeurs['editable'] AND $loge) { |
| 72 | - $traiter = charger_fonction('traiter','formulaires/login'); |
|
| 72 | + $traiter = charger_fonction('traiter', 'formulaires/login'); |
|
| 73 | 73 | $res = $traiter($cible, $login, $prive); |
| 74 | - $valeurs = array_merge($valeurs,$res); |
|
| 74 | + $valeurs = array_merge($valeurs, $res); |
|
| 75 | 75 | |
| 76 | - if (isset($res['redirect']) and $res['redirect']){ |
|
| 76 | + if (isset($res['redirect']) and $res['redirect']) { |
|
| 77 | 77 | include_spip('inc/headers'); |
| 78 | 78 | # preparer un lien pour quand redirige_formulaire ne fonctionne pas |
| 79 | 79 | $m = redirige_formulaire($res['redirect']); |
| 80 | 80 | $valeurs['_deja_loge'] = inserer_attribut( |
| 81 | - "<a>" . _T('login_par_ici') . "</a>$m", |
|
| 81 | + "<a>"._T('login_par_ici')."</a>$m", |
|
| 82 | 82 | 'href', $res['redirect'] |
| 83 | 83 | ); |
| 84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | // s'il est la, c'est probablement un bookmark sur bonjour=oui, |
| 89 | 89 | // et pas un echec cookie. |
| 90 | 90 | if ($erreur == 'cookie') $valeurs['echec_cookie'] = ' '; |
| 91 | - elseif ($erreur){ |
|
| 91 | + elseif ($erreur) { |
|
| 92 | 92 | // une erreur d'un SSO indique dans la redirection vers ici |
| 93 | 93 | // mais il faut se proteger de toute tentative d'injection malveilante |
| 94 | 94 | include_spip('inc/texte'); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | function login_auth_http() |
| 106 | 106 | { |
| 107 | 107 | if (!$GLOBALS['ignore_auth_http'] |
| 108 | - AND _request('var_erreur')=='cookie' |
|
| 108 | + AND _request('var_erreur') == 'cookie' |
|
| 109 | 109 | AND (!isset($_COOKIE['spip_session']) OR $_COOKIE['spip_session'] != 'test_echec_cookie') |
| 110 | 110 | AND (($GLOBALS['flag_sapi_name'] AND preg_match(",apache,i", @php_sapi_name())) |
| 111 | 111 | OR preg_match(",^Apache.* PHP,", $_SERVER['SERVER_SOFTWARE'])) |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | // par auth_http peut conduire a l'echec. |
| 114 | 114 | AND !(isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW']))) |
| 115 | 115 | |
| 116 | - return generer_url_action('cookie',"",false,true); |
|
| 116 | + return generer_url_action('cookie', "", false, true); |
|
| 117 | 117 | else return ''; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | -function formulaires_login_verifier_dist($cible="",$login="",$prive=null){ |
|
| 120 | +function formulaires_login_verifier_dist($cible = "", $login = "", $prive = null) { |
|
| 121 | 121 | |
| 122 | 122 | $session_login = _request('var_login'); |
| 123 | 123 | $session_password = _request('password'); |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | function login_autoriser() |
| 164 | 164 | { |
| 165 | 165 | include_spip('inc/autoriser'); |
| 166 | - if (!autoriser('ecrire')){ |
|
| 167 | - $h = generer_url_action('logout','logout=prive&url='.urlencode(self())); |
|
| 166 | + if (!autoriser('ecrire')) { |
|
| 167 | + $h = generer_url_action('logout', 'logout=prive&url='.urlencode(self())); |
|
| 168 | 168 | return array('message_erreur' => "<h1>" |
| 169 | 169 | ._T('avis_erreur_visiteur') |
| 170 | 170 | ."</h1><p>" |
@@ -175,23 +175,23 @@ discard block |
||
| 175 | 175 | return array(); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | -function formulaires_login_traiter_dist($cible="",$login="",$prive=null){ |
|
| 178 | +function formulaires_login_traiter_dist($cible = "", $login = "", $prive = null) { |
|
| 179 | 179 | $res = array(); |
| 180 | 180 | // Si on se connecte dans l'espace prive, |
| 181 | 181 | // ajouter "bonjour" (repere a peu pres les cookies desactives) |
| 182 | 182 | if (is_null($prive) ? is_url_prive($cible) : $prive) { |
| 183 | 183 | $cible = parametre_url($cible, 'bonjour', 'oui', '&'); |
| 184 | 184 | } |
| 185 | - if ($cible=='@page_auteur') |
|
| 186 | - $cible = generer_url_entite($GLOBALS['auteur_session']['id_auteur'],'auteur'); |
|
| 185 | + if ($cible == '@page_auteur') |
|
| 186 | + $cible = generer_url_entite($GLOBALS['auteur_session']['id_auteur'], 'auteur'); |
|
| 187 | 187 | |
| 188 | 188 | if ($cible) { |
| 189 | 189 | $cible = parametre_url($cible, 'var_login', '', '&'); |
| 190 | 190 | |
| 191 | 191 | // transformer la cible absolue en cible relative |
| 192 | 192 | // pour pas echouer quand la meta adresse_site est foireuse |
| 193 | - if (strncmp($cible,$u = url_de_base(),strlen($u))==0){ |
|
| 194 | - $cible = "./".substr($cible,strlen($u)); |
|
| 193 | + if (strncmp($cible, $u = url_de_base(), strlen($u)) == 0) { |
|
| 194 | + $cible = "./".substr($cible, strlen($u)); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // si c'est une url absolue, refuser la redirection |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // Si on est connecte, envoyer vers la destination |
| 205 | - if ($cible AND ($cible!=self('&')) AND ($cible!=self())) { |
|
| 205 | + if ($cible AND ($cible != self('&')) AND ($cible != self())) { |
|
| 206 | 206 | if (!headers_sent() AND !$_GET['var_mode']) { |
| 207 | 207 | include_spip('inc/headers'); |
| 208 | 208 | $res['redirect'] = $cible; |
| 209 | 209 | } else { |
| 210 | 210 | $res['message_ok'] = inserer_attribut( |
| 211 | - "<a>" . _T('login_par_ici') . "</a>", |
|
| 211 | + "<a>"._T('login_par_ici')."</a>", |
|
| 212 | 212 | 'href', $cible |
| 213 | 213 | ); |
| 214 | 214 | } |