@@ -18,206 +18,206 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $GLOBALS['codes_langues'] = [ |
| 25 | - 'aa' => 'Afar', |
|
| 26 | - 'ab' => 'Abkhazian', |
|
| 27 | - 'af' => 'Afrikaans', |
|
| 28 | - 'am' => 'Amharic', |
|
| 29 | - 'an' => 'Aragonés', |
|
| 30 | - 'ar' => 'عربي', |
|
| 31 | - 'as' => 'Assamese', |
|
| 32 | - 'ast' => 'asturianu', |
|
| 33 | - 'ay' => 'Aymara', |
|
| 34 | - 'az' => 'Azərbaycan dili', |
|
| 35 | - 'ba' => 'Bashkir', |
|
| 36 | - 'be' => 'Беларуская', |
|
| 37 | - 'ber_tam' => 'Tamazigh', |
|
| 38 | - 'ber_tam_tfng' => 'Tamazigh tifinagh', |
|
| 39 | - 'bg' => 'български', |
|
| 40 | - 'bh' => 'Bihari', |
|
| 41 | - 'bi' => 'Bislama', |
|
| 42 | - 'bm' => 'Bambara', |
|
| 43 | - 'bn' => 'Bengali; Bangla', |
|
| 44 | - 'bo' => 'Tibetan', |
|
| 45 | - 'br' => 'brezhoneg', |
|
| 46 | - 'bs' => 'bosanski', |
|
| 47 | - 'ca' => 'català', |
|
| 48 | - 'co' => 'corsu', |
|
| 49 | - 'cpf' => 'Kréol réyoné', |
|
| 50 | - 'cpf_dom' => 'Kreyòl', |
|
| 51 | - 'cpf_hat' => 'Kreyòl (Peyi Dayiti)', |
|
| 52 | - 'cs' => 'čeština', |
|
| 53 | - 'cy' => 'Cymraeg', # welsh, gallois |
|
| 54 | - 'da' => 'dansk', |
|
| 55 | - 'de' => 'Deutsch', |
|
| 56 | - 'dz' => 'Bhutani', |
|
| 57 | - 'el' => 'ελληνικά', |
|
| 58 | - 'en' => 'English', |
|
| 59 | - 'en_hx' => 'H4ck3R', |
|
| 60 | - 'en_sm' => 'Smurf', |
|
| 61 | - 'eo' => 'Esperanto', |
|
| 62 | - 'es' => 'Español', |
|
| 63 | - 'es_co' => 'Colombiano', |
|
| 64 | - 'es_mx_pop' => 'Mexicano a lo güey', |
|
| 65 | - 'et' => 'eesti', |
|
| 66 | - 'eu' => 'euskara', |
|
| 67 | - 'fa' => 'فارسى', |
|
| 68 | - 'ff' => 'Fulah', // peul |
|
| 69 | - 'fi' => 'suomi', |
|
| 70 | - 'fj' => 'Fiji', |
|
| 71 | - 'fo' => 'føroyskt', |
|
| 72 | - 'fon' => 'fongbè', |
|
| 73 | - 'fr' => 'français', |
|
| 74 | - 'fr_fem' => 'français féminin', |
|
| 75 | - 'fr_sc' => 'schtroumpf', |
|
| 76 | - 'fr_lpc' => 'langue parlée complétée', |
|
| 77 | - 'fr_lsf' => 'langue des signes française', |
|
| 78 | - 'fr_spl' => 'français simplifié', |
|
| 79 | - 'fr_tu' => 'français copain', |
|
| 80 | - 'fy' => 'Frisian', |
|
| 81 | - 'ga' => 'Irish', |
|
| 82 | - 'gd' => 'Scots Gaelic', |
|
| 83 | - 'gl' => 'galego', |
|
| 84 | - 'gn' => 'Guarani', |
|
| 85 | - 'grc' => 'Ἀρχαία Ἑλληνική', // grec ancien |
|
| 86 | - 'gu' => 'Gujarati', |
|
| 87 | - 'ha' => 'Hausa', |
|
| 88 | - 'hac' => 'ک-هۆرامی', //"Kurdish-Horami" |
|
| 89 | - 'hbo' => 'עברית־התנך', // hebreu classique ou biblique |
|
| 90 | - 'haz' => 'هزاره گی', |
|
| 91 | - 'he' => 'עברית', |
|
| 92 | - 'hi' => 'हिंदी', |
|
| 93 | - 'hr' => 'hrvatski', |
|
| 94 | - 'hu' => 'magyar', |
|
| 95 | - 'hy' => 'Հայերեն',// Arménien |
|
| 96 | - 'ia' => 'Interlingua', |
|
| 97 | - 'id' => 'Indonesia', |
|
| 98 | - 'ie' => 'Interlingue', |
|
| 99 | - 'ik' => 'Inupiak', |
|
| 100 | - 'is' => 'íslenska', |
|
| 101 | - 'it' => 'italiano', |
|
| 102 | - 'it_fem' => 'italiana', |
|
| 103 | - 'iu' => 'Inuktitut', |
|
| 104 | - 'ja' => '日本語', |
|
| 105 | - 'jv' => 'Javanese', |
|
| 106 | - 'ka' => 'ქართული', |
|
| 107 | - 'kk' => 'қазақ тілі', // Kazakh |
|
| 108 | - 'kl' => 'kalaallisut', |
|
| 109 | - 'km' => 'ភាសាខ្មែរ',// Khmer |
|
| 110 | - 'kn' => 'Kannada', |
|
| 111 | - 'ko' => '한국어', |
|
| 112 | - 'kok' => 'कोंकणी', |
|
| 113 | - 'ks' => 'Kashmiri', |
|
| 114 | - 'ku' => 'کوردی', |
|
| 115 | - 'ky' => 'Kirghiz', |
|
| 116 | - 'la' => 'lingua latina', |
|
| 117 | - 'lb' => 'Lëtzebuergesch', |
|
| 118 | - 'ln' => 'Lingala', |
|
| 119 | - 'lo' => 'ພາສາລາວ', # lao |
|
| 120 | - 'lt' => 'lietuvių', |
|
| 121 | - 'lu' => 'luba-katanga', |
|
| 122 | - 'lv' => 'latviešu', |
|
| 123 | - 'man' => 'mandingue', # a traduire en mandingue |
|
| 124 | - 'mfv' => 'manjak', # ISO-639-3 |
|
| 125 | - 'mg' => 'Malagasy', |
|
| 126 | - 'mi' => 'Maori', |
|
| 127 | - 'mk' => 'македонски јазик', |
|
| 128 | - 'ml' => 'Malayalam', |
|
| 129 | - 'mn' => 'Монгол хэл', |
|
| 130 | - 'mo' => 'Moldavian', |
|
| 131 | - 'mos' => 'Moré', |
|
| 132 | - 'mr' => 'मराठी', |
|
| 133 | - 'ms' => 'Bahasa Malaysia', |
|
| 134 | - 'mt' => 'Maltese', |
|
| 135 | - 'my' => 'Burmese', |
|
| 136 | - 'na' => 'Nauru', |
|
| 137 | - 'nap' => 'napulitano', |
|
| 138 | - 'ne' => 'Nepali', |
|
| 139 | - 'nqo' => "N'ko", // www.manden.org |
|
| 140 | - 'nl' => 'Nederlands', |
|
| 141 | - 'no' => 'norsk', |
|
| 142 | - 'nb' => 'norsk bokmål', |
|
| 143 | - 'nn' => 'norsk nynorsk', |
|
| 144 | - 'oc' => 'òc', |
|
| 145 | - 'oc_lnc' => 'òc lengadocian', |
|
| 146 | - 'oc_ni' => 'òc niçard', |
|
| 147 | - 'oc_ni_la' => 'òc niçard (larg)', |
|
| 148 | - 'oc_ni_mis' => 'òc nissart (mistralenc)', |
|
| 149 | - 'oc_prv' => 'òc provençau', |
|
| 150 | - 'oc_gsc' => 'òc gascon', |
|
| 151 | - 'oc_lms' => 'òc lemosin', |
|
| 152 | - 'oc_auv' => 'òc auvernhat', |
|
| 153 | - 'oc_va' => 'òc vivaroaupenc', |
|
| 154 | - 'om' => '(Afan) Oromo', |
|
| 155 | - 'or' => 'Oriya', |
|
| 156 | - 'pa' => 'Punjabi', |
|
| 157 | - 'pbb' => 'Nasa Yuwe', |
|
| 158 | - 'pl' => 'polski', |
|
| 159 | - 'prs' => 'دری', // ISO-639-3 Dari (Afghanistan) |
|
| 160 | - 'ps' => 'پښتو', |
|
| 161 | - 'pt' => 'Português', |
|
| 162 | - 'pt_br' => 'Português do Brasil', |
|
| 163 | - 'qu' => 'Quechua', |
|
| 164 | - 'rm' => 'Rhaeto-Romance', |
|
| 165 | - 'rn' => 'Kirundi', |
|
| 166 | - 'ro' => 'română', |
|
| 167 | - 'roa' => "ch'ti", |
|
| 168 | - 'ru' => 'русский', |
|
| 169 | - 'rw' => 'Kinyarwanda', |
|
| 170 | - 'sa' => 'संस्कृत', |
|
| 171 | - 'sc' => 'sardu', |
|
| 172 | - 'scn' => 'sicilianu', |
|
| 173 | - 'sd' => 'Sindhi', |
|
| 174 | - 'sg' => 'Sangho', |
|
| 175 | - 'sh' => 'srpskohrvastski', |
|
| 176 | - 'sh_latn' => 'srpskohrvastski', |
|
| 177 | - 'sh_cyrl' => 'Српскохрватски', |
|
| 178 | - 'si' => 'Sinhalese', |
|
| 179 | - 'sk' => 'slovenčina', // (Slovakia) |
|
| 180 | - 'sl' => 'slovenščina', // (Slovenia) |
|
| 181 | - 'sm' => 'Samoan', |
|
| 182 | - 'sn' => 'Shona', |
|
| 183 | - 'so' => 'Somali', |
|
| 184 | - 'sq' => 'shqip', |
|
| 185 | - 'sr' => 'српски', |
|
| 186 | - 'src' => 'sardu logudorésu', // sarde cf 'sc' |
|
| 187 | - 'sro' => 'sardu campidanésu', |
|
| 188 | - 'ss' => 'Siswati', |
|
| 189 | - 'st' => 'Sesotho', |
|
| 190 | - 'su' => 'Sundanese', |
|
| 191 | - 'sv' => 'svenska', |
|
| 192 | - 'sw' => 'Kiswahili', |
|
| 193 | - 'ta' => 'தமிழ்', // Tamil |
|
| 194 | - 'te' => 'Telugu', |
|
| 195 | - 'tg' => 'Tajik', |
|
| 196 | - 'th' => 'ไทย', |
|
| 197 | - 'ti' => 'Tigrinya', |
|
| 198 | - 'tk' => 'Turkmen', |
|
| 199 | - 'tl' => 'Tagalog', |
|
| 200 | - 'tn' => 'Setswana', |
|
| 201 | - 'to' => 'Tonga', |
|
| 202 | - 'tr' => 'Türkçe', |
|
| 203 | - 'ts' => 'Tsonga', |
|
| 204 | - 'tt' => 'Татар', |
|
| 205 | - 'tw' => 'Twi', |
|
| 206 | - 'ty' => 'reo mā`ohi', // tahitien |
|
| 207 | - 'ug' => 'Uighur', |
|
| 208 | - 'uk' => 'українська', |
|
| 209 | - 'ur' => 'ٱردو', |
|
| 210 | - 'uz' => "O'zbekcha", |
|
| 211 | - 'vi' => 'Tiếng Việt', |
|
| 212 | - 'vo' => 'Volapuk', |
|
| 213 | - 'wa' => 'walon', |
|
| 214 | - 'wo' => 'Wolof', |
|
| 215 | - 'xh' => 'Xhosa', |
|
| 216 | - 'yi' => 'Yiddish', |
|
| 217 | - 'yo' => 'Yoruba', |
|
| 218 | - 'za' => 'Zhuang', |
|
| 219 | - 'zh' => '中文', // chinois (ecriture simplifiee) |
|
| 220 | - 'zh_tw' => '台灣中文', // chinois taiwan (ecr. traditionnelle) |
|
| 221 | - 'zu' => 'Zulu' |
|
| 25 | + 'aa' => 'Afar', |
|
| 26 | + 'ab' => 'Abkhazian', |
|
| 27 | + 'af' => 'Afrikaans', |
|
| 28 | + 'am' => 'Amharic', |
|
| 29 | + 'an' => 'Aragonés', |
|
| 30 | + 'ar' => 'عربي', |
|
| 31 | + 'as' => 'Assamese', |
|
| 32 | + 'ast' => 'asturianu', |
|
| 33 | + 'ay' => 'Aymara', |
|
| 34 | + 'az' => 'Azərbaycan dili', |
|
| 35 | + 'ba' => 'Bashkir', |
|
| 36 | + 'be' => 'Беларуская', |
|
| 37 | + 'ber_tam' => 'Tamazigh', |
|
| 38 | + 'ber_tam_tfng' => 'Tamazigh tifinagh', |
|
| 39 | + 'bg' => 'български', |
|
| 40 | + 'bh' => 'Bihari', |
|
| 41 | + 'bi' => 'Bislama', |
|
| 42 | + 'bm' => 'Bambara', |
|
| 43 | + 'bn' => 'Bengali; Bangla', |
|
| 44 | + 'bo' => 'Tibetan', |
|
| 45 | + 'br' => 'brezhoneg', |
|
| 46 | + 'bs' => 'bosanski', |
|
| 47 | + 'ca' => 'català', |
|
| 48 | + 'co' => 'corsu', |
|
| 49 | + 'cpf' => 'Kréol réyoné', |
|
| 50 | + 'cpf_dom' => 'Kreyòl', |
|
| 51 | + 'cpf_hat' => 'Kreyòl (Peyi Dayiti)', |
|
| 52 | + 'cs' => 'čeština', |
|
| 53 | + 'cy' => 'Cymraeg', # welsh, gallois |
|
| 54 | + 'da' => 'dansk', |
|
| 55 | + 'de' => 'Deutsch', |
|
| 56 | + 'dz' => 'Bhutani', |
|
| 57 | + 'el' => 'ελληνικά', |
|
| 58 | + 'en' => 'English', |
|
| 59 | + 'en_hx' => 'H4ck3R', |
|
| 60 | + 'en_sm' => 'Smurf', |
|
| 61 | + 'eo' => 'Esperanto', |
|
| 62 | + 'es' => 'Español', |
|
| 63 | + 'es_co' => 'Colombiano', |
|
| 64 | + 'es_mx_pop' => 'Mexicano a lo güey', |
|
| 65 | + 'et' => 'eesti', |
|
| 66 | + 'eu' => 'euskara', |
|
| 67 | + 'fa' => 'فارسى', |
|
| 68 | + 'ff' => 'Fulah', // peul |
|
| 69 | + 'fi' => 'suomi', |
|
| 70 | + 'fj' => 'Fiji', |
|
| 71 | + 'fo' => 'føroyskt', |
|
| 72 | + 'fon' => 'fongbè', |
|
| 73 | + 'fr' => 'français', |
|
| 74 | + 'fr_fem' => 'français féminin', |
|
| 75 | + 'fr_sc' => 'schtroumpf', |
|
| 76 | + 'fr_lpc' => 'langue parlée complétée', |
|
| 77 | + 'fr_lsf' => 'langue des signes française', |
|
| 78 | + 'fr_spl' => 'français simplifié', |
|
| 79 | + 'fr_tu' => 'français copain', |
|
| 80 | + 'fy' => 'Frisian', |
|
| 81 | + 'ga' => 'Irish', |
|
| 82 | + 'gd' => 'Scots Gaelic', |
|
| 83 | + 'gl' => 'galego', |
|
| 84 | + 'gn' => 'Guarani', |
|
| 85 | + 'grc' => 'Ἀρχαία Ἑλληνική', // grec ancien |
|
| 86 | + 'gu' => 'Gujarati', |
|
| 87 | + 'ha' => 'Hausa', |
|
| 88 | + 'hac' => 'ک-هۆرامی', //"Kurdish-Horami" |
|
| 89 | + 'hbo' => 'עברית־התנך', // hebreu classique ou biblique |
|
| 90 | + 'haz' => 'هزاره گی', |
|
| 91 | + 'he' => 'עברית', |
|
| 92 | + 'hi' => 'हिंदी', |
|
| 93 | + 'hr' => 'hrvatski', |
|
| 94 | + 'hu' => 'magyar', |
|
| 95 | + 'hy' => 'Հայերեն',// Arménien |
|
| 96 | + 'ia' => 'Interlingua', |
|
| 97 | + 'id' => 'Indonesia', |
|
| 98 | + 'ie' => 'Interlingue', |
|
| 99 | + 'ik' => 'Inupiak', |
|
| 100 | + 'is' => 'íslenska', |
|
| 101 | + 'it' => 'italiano', |
|
| 102 | + 'it_fem' => 'italiana', |
|
| 103 | + 'iu' => 'Inuktitut', |
|
| 104 | + 'ja' => '日本語', |
|
| 105 | + 'jv' => 'Javanese', |
|
| 106 | + 'ka' => 'ქართული', |
|
| 107 | + 'kk' => 'қазақ тілі', // Kazakh |
|
| 108 | + 'kl' => 'kalaallisut', |
|
| 109 | + 'km' => 'ភាសាខ្មែរ',// Khmer |
|
| 110 | + 'kn' => 'Kannada', |
|
| 111 | + 'ko' => '한국어', |
|
| 112 | + 'kok' => 'कोंकणी', |
|
| 113 | + 'ks' => 'Kashmiri', |
|
| 114 | + 'ku' => 'کوردی', |
|
| 115 | + 'ky' => 'Kirghiz', |
|
| 116 | + 'la' => 'lingua latina', |
|
| 117 | + 'lb' => 'Lëtzebuergesch', |
|
| 118 | + 'ln' => 'Lingala', |
|
| 119 | + 'lo' => 'ພາສາລາວ', # lao |
|
| 120 | + 'lt' => 'lietuvių', |
|
| 121 | + 'lu' => 'luba-katanga', |
|
| 122 | + 'lv' => 'latviešu', |
|
| 123 | + 'man' => 'mandingue', # a traduire en mandingue |
|
| 124 | + 'mfv' => 'manjak', # ISO-639-3 |
|
| 125 | + 'mg' => 'Malagasy', |
|
| 126 | + 'mi' => 'Maori', |
|
| 127 | + 'mk' => 'македонски јазик', |
|
| 128 | + 'ml' => 'Malayalam', |
|
| 129 | + 'mn' => 'Монгол хэл', |
|
| 130 | + 'mo' => 'Moldavian', |
|
| 131 | + 'mos' => 'Moré', |
|
| 132 | + 'mr' => 'मराठी', |
|
| 133 | + 'ms' => 'Bahasa Malaysia', |
|
| 134 | + 'mt' => 'Maltese', |
|
| 135 | + 'my' => 'Burmese', |
|
| 136 | + 'na' => 'Nauru', |
|
| 137 | + 'nap' => 'napulitano', |
|
| 138 | + 'ne' => 'Nepali', |
|
| 139 | + 'nqo' => "N'ko", // www.manden.org |
|
| 140 | + 'nl' => 'Nederlands', |
|
| 141 | + 'no' => 'norsk', |
|
| 142 | + 'nb' => 'norsk bokmål', |
|
| 143 | + 'nn' => 'norsk nynorsk', |
|
| 144 | + 'oc' => 'òc', |
|
| 145 | + 'oc_lnc' => 'òc lengadocian', |
|
| 146 | + 'oc_ni' => 'òc niçard', |
|
| 147 | + 'oc_ni_la' => 'òc niçard (larg)', |
|
| 148 | + 'oc_ni_mis' => 'òc nissart (mistralenc)', |
|
| 149 | + 'oc_prv' => 'òc provençau', |
|
| 150 | + 'oc_gsc' => 'òc gascon', |
|
| 151 | + 'oc_lms' => 'òc lemosin', |
|
| 152 | + 'oc_auv' => 'òc auvernhat', |
|
| 153 | + 'oc_va' => 'òc vivaroaupenc', |
|
| 154 | + 'om' => '(Afan) Oromo', |
|
| 155 | + 'or' => 'Oriya', |
|
| 156 | + 'pa' => 'Punjabi', |
|
| 157 | + 'pbb' => 'Nasa Yuwe', |
|
| 158 | + 'pl' => 'polski', |
|
| 159 | + 'prs' => 'دری', // ISO-639-3 Dari (Afghanistan) |
|
| 160 | + 'ps' => 'پښتو', |
|
| 161 | + 'pt' => 'Português', |
|
| 162 | + 'pt_br' => 'Português do Brasil', |
|
| 163 | + 'qu' => 'Quechua', |
|
| 164 | + 'rm' => 'Rhaeto-Romance', |
|
| 165 | + 'rn' => 'Kirundi', |
|
| 166 | + 'ro' => 'română', |
|
| 167 | + 'roa' => "ch'ti", |
|
| 168 | + 'ru' => 'русский', |
|
| 169 | + 'rw' => 'Kinyarwanda', |
|
| 170 | + 'sa' => 'संस्कृत', |
|
| 171 | + 'sc' => 'sardu', |
|
| 172 | + 'scn' => 'sicilianu', |
|
| 173 | + 'sd' => 'Sindhi', |
|
| 174 | + 'sg' => 'Sangho', |
|
| 175 | + 'sh' => 'srpskohrvastski', |
|
| 176 | + 'sh_latn' => 'srpskohrvastski', |
|
| 177 | + 'sh_cyrl' => 'Српскохрватски', |
|
| 178 | + 'si' => 'Sinhalese', |
|
| 179 | + 'sk' => 'slovenčina', // (Slovakia) |
|
| 180 | + 'sl' => 'slovenščina', // (Slovenia) |
|
| 181 | + 'sm' => 'Samoan', |
|
| 182 | + 'sn' => 'Shona', |
|
| 183 | + 'so' => 'Somali', |
|
| 184 | + 'sq' => 'shqip', |
|
| 185 | + 'sr' => 'српски', |
|
| 186 | + 'src' => 'sardu logudorésu', // sarde cf 'sc' |
|
| 187 | + 'sro' => 'sardu campidanésu', |
|
| 188 | + 'ss' => 'Siswati', |
|
| 189 | + 'st' => 'Sesotho', |
|
| 190 | + 'su' => 'Sundanese', |
|
| 191 | + 'sv' => 'svenska', |
|
| 192 | + 'sw' => 'Kiswahili', |
|
| 193 | + 'ta' => 'தமிழ்', // Tamil |
|
| 194 | + 'te' => 'Telugu', |
|
| 195 | + 'tg' => 'Tajik', |
|
| 196 | + 'th' => 'ไทย', |
|
| 197 | + 'ti' => 'Tigrinya', |
|
| 198 | + 'tk' => 'Turkmen', |
|
| 199 | + 'tl' => 'Tagalog', |
|
| 200 | + 'tn' => 'Setswana', |
|
| 201 | + 'to' => 'Tonga', |
|
| 202 | + 'tr' => 'Türkçe', |
|
| 203 | + 'ts' => 'Tsonga', |
|
| 204 | + 'tt' => 'Татар', |
|
| 205 | + 'tw' => 'Twi', |
|
| 206 | + 'ty' => 'reo mā`ohi', // tahitien |
|
| 207 | + 'ug' => 'Uighur', |
|
| 208 | + 'uk' => 'українська', |
|
| 209 | + 'ur' => 'ٱردو', |
|
| 210 | + 'uz' => "O'zbekcha", |
|
| 211 | + 'vi' => 'Tiếng Việt', |
|
| 212 | + 'vo' => 'Volapuk', |
|
| 213 | + 'wa' => 'walon', |
|
| 214 | + 'wo' => 'Wolof', |
|
| 215 | + 'xh' => 'Xhosa', |
|
| 216 | + 'yi' => 'Yiddish', |
|
| 217 | + 'yo' => 'Yoruba', |
|
| 218 | + 'za' => 'Zhuang', |
|
| 219 | + 'zh' => '中文', // chinois (ecriture simplifiee) |
|
| 220 | + 'zh_tw' => '台灣中文', // chinois taiwan (ecr. traditionnelle) |
|
| 221 | + 'zu' => 'Zulu' |
|
| 222 | 222 | |
| 223 | 223 | ]; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | 'cpf_dom' => 'Kreyòl', |
| 51 | 51 | 'cpf_hat' => 'Kreyòl (Peyi Dayiti)', |
| 52 | 52 | 'cs' => 'čeština', |
| 53 | - 'cy' => 'Cymraeg', # welsh, gallois |
|
| 53 | + 'cy' => 'Cymraeg', # welsh, gallois |
|
| 54 | 54 | 'da' => 'dansk', |
| 55 | 55 | 'de' => 'Deutsch', |
| 56 | 56 | 'dz' => 'Bhutani', |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'hi' => 'हिंदी', |
| 93 | 93 | 'hr' => 'hrvatski', |
| 94 | 94 | 'hu' => 'magyar', |
| 95 | - 'hy' => 'Հայերեն',// Arménien |
|
| 95 | + 'hy' => 'Հայերեն', // Arménien |
|
| 96 | 96 | 'ia' => 'Interlingua', |
| 97 | 97 | 'id' => 'Indonesia', |
| 98 | 98 | 'ie' => 'Interlingue', |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'ka' => 'ქართული', |
| 107 | 107 | 'kk' => 'қазақ тілі', // Kazakh |
| 108 | 108 | 'kl' => 'kalaallisut', |
| 109 | - 'km' => 'ភាសាខ្មែរ',// Khmer |
|
| 109 | + 'km' => 'ភាសាខ្មែរ', // Khmer |
|
| 110 | 110 | 'kn' => 'Kannada', |
| 111 | 111 | 'ko' => '한국어', |
| 112 | 112 | 'kok' => 'कोंकणी', |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | 'sh_latn' => 'srpskohrvastski', |
| 177 | 177 | 'sh_cyrl' => 'Српскохрватски', |
| 178 | 178 | 'si' => 'Sinhalese', |
| 179 | - 'sk' => 'slovenčina', // (Slovakia) |
|
| 180 | - 'sl' => 'slovenščina', // (Slovenia) |
|
| 179 | + 'sk' => 'slovenčina', // (Slovakia) |
|
| 180 | + 'sl' => 'slovenščina', // (Slovenia) |
|
| 181 | 181 | 'sm' => 'Samoan', |
| 182 | 182 | 'sn' => 'Shona', |
| 183 | 183 | 'so' => 'Somali', |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('base/abstract_sql'); |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | // |
| 24 | 24 | |
| 25 | 25 | function inc_lien_dist( |
| 26 | - $lien, |
|
| 27 | - $texte = '', |
|
| 28 | - $class = '', |
|
| 29 | - $title = '', |
|
| 30 | - $hlang = '', |
|
| 31 | - $rel = '', |
|
| 32 | - $connect = '', |
|
| 33 | - $env = [] |
|
| 26 | + $lien, |
|
| 27 | + $texte = '', |
|
| 28 | + $class = '', |
|
| 29 | + $title = '', |
|
| 30 | + $hlang = '', |
|
| 31 | + $rel = '', |
|
| 32 | + $connect = '', |
|
| 33 | + $env = [] |
|
| 34 | 34 | ) { |
| 35 | - return $lien; |
|
| 35 | + return $lien; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Regexp des raccourcis, aussi utilisee pour la fusion de sauvegarde Spip |
@@ -44,30 +44,30 @@ discard block |
||
| 44 | 44 | // https://code.spip.net/@expanser_liens |
| 45 | 45 | function expanser_liens($t, $connect = '', $env = []) { |
| 46 | 46 | |
| 47 | - $t = pipeline('pre_liens', $t); |
|
| 47 | + $t = pipeline('pre_liens', $t); |
|
| 48 | 48 | |
| 49 | - // on passe a traiter_modeles la liste des liens reperes pour lui permettre |
|
| 50 | - // de remettre le texte d'origine dans les parametres du modele |
|
| 51 | - $t = traiter_modeles($t, false, false, $connect); |
|
| 49 | + // on passe a traiter_modeles la liste des liens reperes pour lui permettre |
|
| 50 | + // de remettre le texte d'origine dans les parametres du modele |
|
| 51 | + $t = traiter_modeles($t, false, false, $connect); |
|
| 52 | 52 | |
| 53 | - return $t; |
|
| 53 | + return $t; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Meme analyse mais pour eliminer les liens |
| 57 | 57 | // et ne laisser que leur titre, a expliciter si ce n'est fait |
| 58 | 58 | // https://code.spip.net/@nettoyer_raccourcis_typo |
| 59 | 59 | function nettoyer_raccourcis_typo($texte, $connect = '') { |
| 60 | - return $texte; |
|
| 60 | + return $texte; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Repere dans la partie texte d'un raccourci [texte->...] |
| 64 | 64 | // la langue et la bulle eventuelles |
| 65 | 65 | // https://code.spip.net/@traiter_raccourci_lien_atts |
| 66 | 66 | function traiter_raccourci_lien_atts($texte) { |
| 67 | - $bulle = ''; |
|
| 68 | - $hlang = ''; |
|
| 67 | + $bulle = ''; |
|
| 68 | + $hlang = ''; |
|
| 69 | 69 | |
| 70 | - return [trim($texte), $bulle, $hlang]; |
|
| 70 | + return [trim($texte), $bulle, $hlang]; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | define('_RACCOURCI_CHAPO', '/^(\W*)(\W*)(\w*\d+([?#].*)?)$/'); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | 85 | function virtuel_redirige($virtuel, $url = false) { |
| 86 | - return $virtuel; |
|
| 86 | + return $virtuel; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // Cherche un lien du type [->raccourci 123] |
@@ -97,122 +97,122 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // https://code.spip.net/@calculer_url |
| 99 | 99 | function calculer_url($ref, $texte = '', $pour = 'url', $connect = '', $echappe_typo = true) { |
| 100 | - $r = traiter_lien_implicite($ref, $texte, $pour, $connect, $echappe_typo); |
|
| 100 | + $r = traiter_lien_implicite($ref, $texte, $pour, $connect, $echappe_typo); |
|
| 101 | 101 | |
| 102 | - return $r ? $r : traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
|
| 102 | + return $r ? $r : traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS'); |
| 106 | 106 | |
| 107 | 107 | // https://code.spip.net/@traiter_lien_explicite |
| 108 | 108 | function traiter_lien_explicite($ref, $texte = '', $pour = 'url', $connect = '', $echappe_typo = true) { |
| 109 | - if (preg_match(_EXTRAIRE_LIEN, $ref)) { |
|
| 110 | - return ($pour != 'tout') ? '' : ['', '', '', '']; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - $lien = entites_html(trim($ref)); |
|
| 114 | - |
|
| 115 | - // Liens explicites |
|
| 116 | - if (!$texte) { |
|
| 117 | - $texte = str_replace('"', '', $lien); |
|
| 118 | - // evite l'affichage de trops longues urls. |
|
| 119 | - $lien_court = charger_fonction('lien_court', 'inc'); |
|
| 120 | - $texte = $lien_court($texte); |
|
| 121 | - if ($echappe_typo) { |
|
| 122 | - $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - // petites corrections d'URL |
|
| 127 | - if (preg_match('/^www\.[^@]+$/S', $lien)) { |
|
| 128 | - $lien = 'http://' . $lien; |
|
| 129 | - } else { |
|
| 130 | - if (strpos($lien, '@') && email_valide($lien)) { |
|
| 131 | - if (!$texte) { |
|
| 132 | - $texte = $lien; |
|
| 133 | - } |
|
| 134 | - $lien = 'mailto:' . $lien; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - if ($pour == 'url') { |
|
| 139 | - return $lien; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - if ($pour == 'titre') { |
|
| 143 | - return $texte; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - return ['url' => $lien, 'titre' => $texte]; |
|
| 109 | + if (preg_match(_EXTRAIRE_LIEN, $ref)) { |
|
| 110 | + return ($pour != 'tout') ? '' : ['', '', '', '']; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + $lien = entites_html(trim($ref)); |
|
| 114 | + |
|
| 115 | + // Liens explicites |
|
| 116 | + if (!$texte) { |
|
| 117 | + $texte = str_replace('"', '', $lien); |
|
| 118 | + // evite l'affichage de trops longues urls. |
|
| 119 | + $lien_court = charger_fonction('lien_court', 'inc'); |
|
| 120 | + $texte = $lien_court($texte); |
|
| 121 | + if ($echappe_typo) { |
|
| 122 | + $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + // petites corrections d'URL |
|
| 127 | + if (preg_match('/^www\.[^@]+$/S', $lien)) { |
|
| 128 | + $lien = 'http://' . $lien; |
|
| 129 | + } else { |
|
| 130 | + if (strpos($lien, '@') && email_valide($lien)) { |
|
| 131 | + if (!$texte) { |
|
| 132 | + $texte = $lien; |
|
| 133 | + } |
|
| 134 | + $lien = 'mailto:' . $lien; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + if ($pour == 'url') { |
|
| 139 | + return $lien; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + if ($pour == 'titre') { |
|
| 143 | + return $texte; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + return ['url' => $lien, 'titre' => $texte]; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, $connect = '') { |
| 150 | - if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 151 | - $url = $f($texte, $id); |
|
| 152 | - } else { |
|
| 153 | - $url = glossaire_std($texte); |
|
| 154 | - } |
|
| 150 | + if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 151 | + $url = $f($texte, $id); |
|
| 152 | + } else { |
|
| 153 | + $url = glossaire_std($texte); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - return $url; |
|
| 156 | + return $url; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | // https://code.spip.net/@traiter_lien_implicite |
| 160 | 160 | function traiter_lien_implicite($ref, $texte = '', $pour = 'url', $connect = '') { |
| 161 | - if (!($match = typer_raccourci($ref))) { |
|
| 162 | - return false; |
|
| 163 | - } |
|
| 164 | - @list($type, , $id, , $args, , $ancre) = $match; |
|
| 165 | - // attention dans le cas des sites le lien doit pointer non pas sur |
|
| 166 | - // la page locale du site, mais directement sur le site lui-meme |
|
| 167 | - if ($f = charger_fonction("implicite_$type", 'liens', true)) { |
|
| 168 | - $url = $f($texte, $id, $type, $args, $ancre, $connect); |
|
| 169 | - } |
|
| 170 | - if (!$url) { |
|
| 171 | - $url = generer_url_entite($id, $type, $args, $ancre, $connect ? $connect : null); |
|
| 172 | - } |
|
| 173 | - if (!$url) { |
|
| 174 | - return false; |
|
| 175 | - } |
|
| 176 | - if (is_array($url)) { |
|
| 177 | - @list($type, $id) = $url; |
|
| 178 | - $url = generer_url_entite($id, $type, $args, $ancre, $connect ? $connect : null); |
|
| 179 | - } |
|
| 180 | - if ($pour === 'url') { |
|
| 181 | - return $url; |
|
| 182 | - } |
|
| 183 | - $r = traiter_raccourci_titre($id, $type, $connect); |
|
| 184 | - if ($r) { |
|
| 185 | - $r['class'] = ($type == 'site') ? 'spip_out' : 'spip_in'; |
|
| 186 | - } |
|
| 187 | - if ($texte = trim($texte)) { |
|
| 188 | - $r['titre'] = $texte; |
|
| 189 | - } |
|
| 190 | - if (!@$r['titre']) { |
|
| 191 | - $r['titre'] = _T($type) . " $id"; |
|
| 192 | - } |
|
| 193 | - if ($pour == 'titre') { |
|
| 194 | - return $r['titre']; |
|
| 195 | - } |
|
| 196 | - $r['url'] = $url; |
|
| 197 | - |
|
| 198 | - // dans le cas d'un lien vers un doc, ajouter le type='mime/type' |
|
| 199 | - if ( |
|
| 200 | - $type == 'document' |
|
| 201 | - and $mime = sql_getfetsel( |
|
| 202 | - 'mime_type', |
|
| 203 | - 'spip_types_documents', |
|
| 204 | - 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 205 | - '', |
|
| 206 | - '', |
|
| 207 | - '', |
|
| 208 | - '', |
|
| 209 | - $connect |
|
| 210 | - ) |
|
| 211 | - ) { |
|
| 212 | - $r['mime'] = $mime; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - return $r; |
|
| 161 | + if (!($match = typer_raccourci($ref))) { |
|
| 162 | + return false; |
|
| 163 | + } |
|
| 164 | + @list($type, , $id, , $args, , $ancre) = $match; |
|
| 165 | + // attention dans le cas des sites le lien doit pointer non pas sur |
|
| 166 | + // la page locale du site, mais directement sur le site lui-meme |
|
| 167 | + if ($f = charger_fonction("implicite_$type", 'liens', true)) { |
|
| 168 | + $url = $f($texte, $id, $type, $args, $ancre, $connect); |
|
| 169 | + } |
|
| 170 | + if (!$url) { |
|
| 171 | + $url = generer_url_entite($id, $type, $args, $ancre, $connect ? $connect : null); |
|
| 172 | + } |
|
| 173 | + if (!$url) { |
|
| 174 | + return false; |
|
| 175 | + } |
|
| 176 | + if (is_array($url)) { |
|
| 177 | + @list($type, $id) = $url; |
|
| 178 | + $url = generer_url_entite($id, $type, $args, $ancre, $connect ? $connect : null); |
|
| 179 | + } |
|
| 180 | + if ($pour === 'url') { |
|
| 181 | + return $url; |
|
| 182 | + } |
|
| 183 | + $r = traiter_raccourci_titre($id, $type, $connect); |
|
| 184 | + if ($r) { |
|
| 185 | + $r['class'] = ($type == 'site') ? 'spip_out' : 'spip_in'; |
|
| 186 | + } |
|
| 187 | + if ($texte = trim($texte)) { |
|
| 188 | + $r['titre'] = $texte; |
|
| 189 | + } |
|
| 190 | + if (!@$r['titre']) { |
|
| 191 | + $r['titre'] = _T($type) . " $id"; |
|
| 192 | + } |
|
| 193 | + if ($pour == 'titre') { |
|
| 194 | + return $r['titre']; |
|
| 195 | + } |
|
| 196 | + $r['url'] = $url; |
|
| 197 | + |
|
| 198 | + // dans le cas d'un lien vers un doc, ajouter le type='mime/type' |
|
| 199 | + if ( |
|
| 200 | + $type == 'document' |
|
| 201 | + and $mime = sql_getfetsel( |
|
| 202 | + 'mime_type', |
|
| 203 | + 'spip_types_documents', |
|
| 204 | + 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 205 | + '', |
|
| 206 | + '', |
|
| 207 | + '', |
|
| 208 | + '', |
|
| 209 | + $connect |
|
| 210 | + ) |
|
| 211 | + ) { |
|
| 212 | + $r['mime'] = $mime; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + return $r; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // analyse des raccourcis issus de [TITRE->RACCOURCInnn] et connexes |
@@ -221,41 +221,41 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | // https://code.spip.net/@typer_raccourci |
| 223 | 223 | function typer_raccourci($lien) { |
| 224 | - if (!preg_match(_RACCOURCI_URL, $lien, $match)) { |
|
| 225 | - return []; |
|
| 226 | - } |
|
| 227 | - $f = $match[1]; |
|
| 228 | - // valeur par defaut et alias historiques |
|
| 229 | - if (!$f) { |
|
| 230 | - $f = 'article'; |
|
| 231 | - } else { |
|
| 232 | - if ($f == 'art') { |
|
| 233 | - $f = 'article'; |
|
| 234 | - } else { |
|
| 235 | - if ($f == 'br') { |
|
| 236 | - $f = 'breve'; |
|
| 237 | - } else { |
|
| 238 | - if ($f == 'rub') { |
|
| 239 | - $f = 'rubrique'; |
|
| 240 | - } else { |
|
| 241 | - if ($f == 'aut') { |
|
| 242 | - $f = 'auteur'; |
|
| 243 | - } else { |
|
| 244 | - if ($f == 'doc' or $f == 'im' or $f == 'img' or $f == 'image' or $f == 'emb') { |
|
| 245 | - $f = 'document'; |
|
| 246 | - } else { |
|
| 247 | - if (preg_match('/^br..?ve$/S', $f)) { |
|
| 248 | - $f = 'breve'; |
|
| 249 | - } |
|
| 250 | - } |
|
| 251 | - } |
|
| 252 | - } |
|
| 253 | - } |
|
| 254 | - } |
|
| 255 | - } # accents :( |
|
| 256 | - $match[0] = $f; |
|
| 257 | - |
|
| 258 | - return $match; |
|
| 224 | + if (!preg_match(_RACCOURCI_URL, $lien, $match)) { |
|
| 225 | + return []; |
|
| 226 | + } |
|
| 227 | + $f = $match[1]; |
|
| 228 | + // valeur par defaut et alias historiques |
|
| 229 | + if (!$f) { |
|
| 230 | + $f = 'article'; |
|
| 231 | + } else { |
|
| 232 | + if ($f == 'art') { |
|
| 233 | + $f = 'article'; |
|
| 234 | + } else { |
|
| 235 | + if ($f == 'br') { |
|
| 236 | + $f = 'breve'; |
|
| 237 | + } else { |
|
| 238 | + if ($f == 'rub') { |
|
| 239 | + $f = 'rubrique'; |
|
| 240 | + } else { |
|
| 241 | + if ($f == 'aut') { |
|
| 242 | + $f = 'auteur'; |
|
| 243 | + } else { |
|
| 244 | + if ($f == 'doc' or $f == 'im' or $f == 'img' or $f == 'image' or $f == 'emb') { |
|
| 245 | + $f = 'document'; |
|
| 246 | + } else { |
|
| 247 | + if (preg_match('/^br..?ve$/S', $f)) { |
|
| 248 | + $f = 'breve'; |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | + } # accents :( |
|
| 256 | + $match[0] = $f; |
|
| 257 | + |
|
| 258 | + return $match; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -270,25 +270,25 @@ discard block |
||
| 270 | 270 | * } |
| 271 | 271 | **/ |
| 272 | 272 | function traiter_raccourci_titre($id, $type, $connect = null) { |
| 273 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 274 | - $desc = $trouver_table(table_objet($type)); |
|
| 275 | - if (!($desc and $s = $desc['titre'])) { |
|
| 276 | - return []; |
|
| 277 | - } |
|
| 278 | - $_id = $desc['key']['PRIMARY KEY']; |
|
| 279 | - $r = sql_fetsel($s, $desc['table'], "$_id=$id", '', '', '', '', $connect); |
|
| 280 | - if (!$r) { |
|
| 281 | - return []; |
|
| 282 | - } |
|
| 283 | - $r['titre'] = supprimer_numero($r['titre']); |
|
| 284 | - if (!$r['titre'] and !empty($r['surnom'])) { |
|
| 285 | - $r['titre'] = $r['surnom']; |
|
| 286 | - } |
|
| 287 | - if (!isset($r['lang'])) { |
|
| 288 | - $r['lang'] = ''; |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - return $r; |
|
| 273 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 274 | + $desc = $trouver_table(table_objet($type)); |
|
| 275 | + if (!($desc and $s = $desc['titre'])) { |
|
| 276 | + return []; |
|
| 277 | + } |
|
| 278 | + $_id = $desc['key']['PRIMARY KEY']; |
|
| 279 | + $r = sql_fetsel($s, $desc['table'], "$_id=$id", '', '', '', '', $connect); |
|
| 280 | + if (!$r) { |
|
| 281 | + return []; |
|
| 282 | + } |
|
| 283 | + $r['titre'] = supprimer_numero($r['titre']); |
|
| 284 | + if (!$r['titre'] and !empty($r['surnom'])) { |
|
| 285 | + $r['titre'] = $r['surnom']; |
|
| 286 | + } |
|
| 287 | + if (!isset($r['lang'])) { |
|
| 288 | + $r['lang'] = ''; |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + return $r; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // traite les modeles (dans la fonction typo), en remplacant |
@@ -300,124 +300,124 @@ discard block |
||
| 300 | 300 | // https://code.spip.net/@traiter_modeles |
| 301 | 301 | |
| 302 | 302 | define( |
| 303 | - '_RACCOURCI_MODELE', |
|
| 304 | - '(<([a-z_-]{3,})' # <modele |
|
| 305 | - . '\s*([0-9]*)\s*' # id |
|
| 306 | - . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
|
| 307 | - . '\s*/?' . '>)' # fin du modele > |
|
| 308 | - . '\s*(<\/a>)?' # eventuel </a> |
|
| 303 | + '_RACCOURCI_MODELE', |
|
| 304 | + '(<([a-z_-]{3,})' # <modele |
|
| 305 | + . '\s*([0-9]*)\s*' # id |
|
| 306 | + . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
|
| 307 | + . '\s*/?' . '>)' # fin du modele > |
|
| 308 | + . '\s*(<\/a>)?' # eventuel </a> |
|
| 309 | 309 | ); |
| 310 | 310 | |
| 311 | 311 | define('_RACCOURCI_MODELE_DEBUT', '@^' . _RACCOURCI_MODELE . '@isS'); |
| 312 | 312 | |
| 313 | 313 | // https://code.spip.net/@traiter_modeles |
| 314 | 314 | function traiter_modeles($texte, $doublons = false, $echap = '', $connect = '', $liens = null, $env = []) { |
| 315 | - // preserver la compatibilite : true = recherche des documents |
|
| 316 | - if ($doublons === true) { |
|
| 317 | - $doublons = ['documents' => ['doc', 'emb', 'img']]; |
|
| 318 | - } |
|
| 319 | - // detecter les modeles (rapide) |
|
| 320 | - if ( |
|
| 321 | - strpos($texte, '<') !== false and |
|
| 322 | - preg_match_all('/<[a-z_-]{3,}\s*[0-9|]+/iS', $texte, $matches, PREG_SET_ORDER) |
|
| 323 | - ) { |
|
| 324 | - include_spip('public/assembler'); |
|
| 325 | - $wrap_embed_html = charger_fonction('wrap_embed_html', 'inc', true); |
|
| 326 | - foreach ($matches as $match) { |
|
| 327 | - // Recuperer l'appel complet (y compris un eventuel lien) |
|
| 328 | - |
|
| 329 | - $a = strpos($texte, $match[0]); |
|
| 330 | - preg_match( |
|
| 331 | - _RACCOURCI_MODELE_DEBUT, |
|
| 332 | - substr($texte, $a), |
|
| 333 | - $regs |
|
| 334 | - ); |
|
| 335 | - $regs[] = ''; // s'assurer qu'il y a toujours un 5e arg, eventuellement vide |
|
| 336 | - list(, $mod, $type, $id, $params, $fin) = $regs; |
|
| 337 | - if ( |
|
| 338 | - $fin and |
|
| 339 | - preg_match( |
|
| 340 | - '/<a\s[^<>]*>\s*$/i', |
|
| 341 | - substr($texte, 0, $a), |
|
| 342 | - $r |
|
| 343 | - ) |
|
| 344 | - ) { |
|
| 345 | - $lien = [ |
|
| 346 | - 'href' => extraire_attribut($r[0], 'href'), |
|
| 347 | - 'class' => extraire_attribut($r[0], 'class'), |
|
| 348 | - 'mime' => extraire_attribut($r[0], 'type'), |
|
| 349 | - 'title' => extraire_attribut($r[0], 'title'), |
|
| 350 | - 'hreflang' => extraire_attribut($r[0], 'hreflang') |
|
| 351 | - ]; |
|
| 352 | - $n = strlen($r[0]); |
|
| 353 | - $a -= $n; |
|
| 354 | - $cherche = $n + strlen($regs[0]); |
|
| 355 | - } else { |
|
| 356 | - $lien = false; |
|
| 357 | - $cherche = strlen($mod); |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - // calculer le modele |
|
| 361 | - # hack indexation |
|
| 362 | - if ($doublons) { |
|
| 363 | - $texte .= preg_replace(',[|][^|=]*,s', ' ', $params); |
|
| 364 | - } # version normale |
|
| 365 | - else { |
|
| 366 | - // si un tableau de liens a ete passe, reinjecter le contenu d'origine |
|
| 367 | - // dans les parametres, plutot que les liens echappes |
|
| 368 | - if (!is_null($liens)) { |
|
| 369 | - $params = str_replace($liens[0], $liens[1], $params); |
|
| 370 | - } |
|
| 371 | - $modele = inclure_modele($type, $id, $params, $lien, $connect, $env); |
|
| 372 | - // en cas d'echec, |
|
| 373 | - // si l'objet demande a une url, |
|
| 374 | - // creer un petit encadre vers elle |
|
| 375 | - if ($modele === false) { |
|
| 376 | - if (!$lien) { |
|
| 377 | - $lien = traiter_lien_implicite("$type$id", '', 'tout', $connect); |
|
| 378 | - } |
|
| 379 | - if ($lien) { |
|
| 380 | - $modele = '<a href="' |
|
| 381 | - . $lien['url'] |
|
| 382 | - . '" class="spip_modele' |
|
| 383 | - . '">' |
|
| 384 | - . sinon($lien['titre'], _T('ecrire:info_sans_titre')) |
|
| 385 | - . '</a>'; |
|
| 386 | - } else { |
|
| 387 | - $modele = ''; |
|
| 388 | - if (test_espace_prive()) { |
|
| 389 | - $modele = entites_html(substr($texte, $a, $cherche)); |
|
| 390 | - if (!is_null($liens)) { |
|
| 391 | - $modele = '<pre>' . str_replace($liens[0], $liens[1], $modele) . '</pre>'; |
|
| 392 | - } |
|
| 393 | - } |
|
| 394 | - } |
|
| 395 | - } |
|
| 396 | - // le remplacer dans le texte |
|
| 397 | - if ($modele !== false) { |
|
| 398 | - $modele = protege_js_modeles($modele); |
|
| 399 | - if ($wrap_embed_html) { |
|
| 400 | - $modele = $wrap_embed_html($mod, $modele); |
|
| 401 | - } |
|
| 402 | - $rempl = code_echappement($modele, $echap); |
|
| 403 | - $texte = substr($texte, 0, $a) |
|
| 404 | - . $rempl |
|
| 405 | - . substr($texte, $a + $cherche); |
|
| 406 | - } |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - // hack pour tout l'espace prive |
|
| 410 | - if (((!_DIR_RESTREINT) or ($doublons)) and ($id)) { |
|
| 411 | - foreach ($doublons ? $doublons : ['documents' => ['doc', 'emb', 'img']] as $quoi => $modeles) { |
|
| 412 | - if (in_array($type, $modeles)) { |
|
| 413 | - $GLOBALS["doublons_{$quoi}_inclus"][] = $id; |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - } |
|
| 419 | - |
|
| 420 | - return $texte; |
|
| 315 | + // preserver la compatibilite : true = recherche des documents |
|
| 316 | + if ($doublons === true) { |
|
| 317 | + $doublons = ['documents' => ['doc', 'emb', 'img']]; |
|
| 318 | + } |
|
| 319 | + // detecter les modeles (rapide) |
|
| 320 | + if ( |
|
| 321 | + strpos($texte, '<') !== false and |
|
| 322 | + preg_match_all('/<[a-z_-]{3,}\s*[0-9|]+/iS', $texte, $matches, PREG_SET_ORDER) |
|
| 323 | + ) { |
|
| 324 | + include_spip('public/assembler'); |
|
| 325 | + $wrap_embed_html = charger_fonction('wrap_embed_html', 'inc', true); |
|
| 326 | + foreach ($matches as $match) { |
|
| 327 | + // Recuperer l'appel complet (y compris un eventuel lien) |
|
| 328 | + |
|
| 329 | + $a = strpos($texte, $match[0]); |
|
| 330 | + preg_match( |
|
| 331 | + _RACCOURCI_MODELE_DEBUT, |
|
| 332 | + substr($texte, $a), |
|
| 333 | + $regs |
|
| 334 | + ); |
|
| 335 | + $regs[] = ''; // s'assurer qu'il y a toujours un 5e arg, eventuellement vide |
|
| 336 | + list(, $mod, $type, $id, $params, $fin) = $regs; |
|
| 337 | + if ( |
|
| 338 | + $fin and |
|
| 339 | + preg_match( |
|
| 340 | + '/<a\s[^<>]*>\s*$/i', |
|
| 341 | + substr($texte, 0, $a), |
|
| 342 | + $r |
|
| 343 | + ) |
|
| 344 | + ) { |
|
| 345 | + $lien = [ |
|
| 346 | + 'href' => extraire_attribut($r[0], 'href'), |
|
| 347 | + 'class' => extraire_attribut($r[0], 'class'), |
|
| 348 | + 'mime' => extraire_attribut($r[0], 'type'), |
|
| 349 | + 'title' => extraire_attribut($r[0], 'title'), |
|
| 350 | + 'hreflang' => extraire_attribut($r[0], 'hreflang') |
|
| 351 | + ]; |
|
| 352 | + $n = strlen($r[0]); |
|
| 353 | + $a -= $n; |
|
| 354 | + $cherche = $n + strlen($regs[0]); |
|
| 355 | + } else { |
|
| 356 | + $lien = false; |
|
| 357 | + $cherche = strlen($mod); |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + // calculer le modele |
|
| 361 | + # hack indexation |
|
| 362 | + if ($doublons) { |
|
| 363 | + $texte .= preg_replace(',[|][^|=]*,s', ' ', $params); |
|
| 364 | + } # version normale |
|
| 365 | + else { |
|
| 366 | + // si un tableau de liens a ete passe, reinjecter le contenu d'origine |
|
| 367 | + // dans les parametres, plutot que les liens echappes |
|
| 368 | + if (!is_null($liens)) { |
|
| 369 | + $params = str_replace($liens[0], $liens[1], $params); |
|
| 370 | + } |
|
| 371 | + $modele = inclure_modele($type, $id, $params, $lien, $connect, $env); |
|
| 372 | + // en cas d'echec, |
|
| 373 | + // si l'objet demande a une url, |
|
| 374 | + // creer un petit encadre vers elle |
|
| 375 | + if ($modele === false) { |
|
| 376 | + if (!$lien) { |
|
| 377 | + $lien = traiter_lien_implicite("$type$id", '', 'tout', $connect); |
|
| 378 | + } |
|
| 379 | + if ($lien) { |
|
| 380 | + $modele = '<a href="' |
|
| 381 | + . $lien['url'] |
|
| 382 | + . '" class="spip_modele' |
|
| 383 | + . '">' |
|
| 384 | + . sinon($lien['titre'], _T('ecrire:info_sans_titre')) |
|
| 385 | + . '</a>'; |
|
| 386 | + } else { |
|
| 387 | + $modele = ''; |
|
| 388 | + if (test_espace_prive()) { |
|
| 389 | + $modele = entites_html(substr($texte, $a, $cherche)); |
|
| 390 | + if (!is_null($liens)) { |
|
| 391 | + $modele = '<pre>' . str_replace($liens[0], $liens[1], $modele) . '</pre>'; |
|
| 392 | + } |
|
| 393 | + } |
|
| 394 | + } |
|
| 395 | + } |
|
| 396 | + // le remplacer dans le texte |
|
| 397 | + if ($modele !== false) { |
|
| 398 | + $modele = protege_js_modeles($modele); |
|
| 399 | + if ($wrap_embed_html) { |
|
| 400 | + $modele = $wrap_embed_html($mod, $modele); |
|
| 401 | + } |
|
| 402 | + $rempl = code_echappement($modele, $echap); |
|
| 403 | + $texte = substr($texte, 0, $a) |
|
| 404 | + . $rempl |
|
| 405 | + . substr($texte, $a + $cherche); |
|
| 406 | + } |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + // hack pour tout l'espace prive |
|
| 410 | + if (((!_DIR_RESTREINT) or ($doublons)) and ($id)) { |
|
| 411 | + foreach ($doublons ? $doublons : ['documents' => ['doc', 'emb', 'img']] as $quoi => $modeles) { |
|
| 412 | + if (in_array($type, $modeles)) { |
|
| 413 | + $GLOBALS["doublons_{$quoi}_inclus"][] = $id; |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + } |
|
| 419 | + |
|
| 420 | + return $texte; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | // |
@@ -425,15 +425,15 @@ discard block |
||
| 425 | 425 | // |
| 426 | 426 | // https://code.spip.net/@traiter_raccourci_ancre |
| 427 | 427 | function traiter_raccourci_ancre($letexte) { |
| 428 | - return $letexte; |
|
| 428 | + return $letexte; |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // https://code.spip.net/@traiter_raccourci_glossaire |
| 432 | 432 | function traiter_raccourci_glossaire($texte) { |
| 433 | - return $texte; |
|
| 433 | + return $texte; |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // https://code.spip.net/@glossaire_std |
| 437 | 437 | function glossaire_std($terme) { |
| 438 | - return $terme; |
|
| 438 | + return $terme; |
|
| 439 | 439 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return $r ? $r : traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | -define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS'); |
|
| 105 | +define('_EXTRAIRE_LIEN', ',^\s*(?:'._PROTOCOLES_STD.'):?/?/?\s*$,iS'); |
|
| 106 | 106 | |
| 107 | 107 | // https://code.spip.net/@traiter_lien_explicite |
| 108 | 108 | function traiter_lien_explicite($ref, $texte = '', $pour = 'url', $connect = '', $echappe_typo = true) { |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | $lien_court = charger_fonction('lien_court', 'inc'); |
| 120 | 120 | $texte = $lien_court($texte); |
| 121 | 121 | if ($echappe_typo) { |
| 122 | - $texte = '<html>' . quote_amp($texte) . '</html>'; |
|
| 122 | + $texte = '<html>'.quote_amp($texte).'</html>'; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // petites corrections d'URL |
| 127 | 127 | if (preg_match('/^www\.[^@]+$/S', $lien)) { |
| 128 | - $lien = 'http://' . $lien; |
|
| 128 | + $lien = 'http://'.$lien; |
|
| 129 | 129 | } else { |
| 130 | 130 | if (strpos($lien, '@') && email_valide($lien)) { |
| 131 | 131 | if (!$texte) { |
| 132 | 132 | $texte = $lien; |
| 133 | 133 | } |
| 134 | - $lien = 'mailto:' . $lien; |
|
| 134 | + $lien = 'mailto:'.$lien; |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, $connect = '') { |
| 150 | - if (function_exists($f = 'glossaire_' . $ancre)) { |
|
| 150 | + if (function_exists($f = 'glossaire_'.$ancre)) { |
|
| 151 | 151 | $url = $f($texte, $id); |
| 152 | 152 | } else { |
| 153 | 153 | $url = glossaire_std($texte); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | if (!($match = typer_raccourci($ref))) { |
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | - @list($type, , $id, , $args, , $ancre) = $match; |
|
| 164 | + @list($type,, $id,, $args,, $ancre) = $match; |
|
| 165 | 165 | // attention dans le cas des sites le lien doit pointer non pas sur |
| 166 | 166 | // la page locale du site, mais directement sur le site lui-meme |
| 167 | 167 | if ($f = charger_fonction("implicite_$type", 'liens', true)) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $r['titre'] = $texte; |
| 189 | 189 | } |
| 190 | 190 | if (!@$r['titre']) { |
| 191 | - $r['titre'] = _T($type) . " $id"; |
|
| 191 | + $r['titre'] = _T($type)." $id"; |
|
| 192 | 192 | } |
| 193 | 193 | if ($pour == 'titre') { |
| 194 | 194 | return $r['titre']; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | and $mime = sql_getfetsel( |
| 202 | 202 | 'mime_type', |
| 203 | 203 | 'spip_types_documents', |
| 204 | - 'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')', |
|
| 204 | + 'extension IN ('.sql_get_select('extension', 'spip_documents', 'id_document='.sql_quote($id)).')', |
|
| 205 | 205 | '', |
| 206 | 206 | '', |
| 207 | 207 | '', |
@@ -304,11 +304,11 @@ discard block |
||
| 304 | 304 | '(<([a-z_-]{3,})' # <modele |
| 305 | 305 | . '\s*([0-9]*)\s*' # id |
| 306 | 306 | . '([|](?:<[^<>]*>|[^>])*?)?' # |arguments (y compris des tags <...>) |
| 307 | - . '\s*/?' . '>)' # fin du modele > |
|
| 307 | + . '\s*/?'.'>)' # fin du modele > |
|
| 308 | 308 | . '\s*(<\/a>)?' # eventuel </a> |
| 309 | 309 | ); |
| 310 | 310 | |
| 311 | -define('_RACCOURCI_MODELE_DEBUT', '@^' . _RACCOURCI_MODELE . '@isS'); |
|
| 311 | +define('_RACCOURCI_MODELE_DEBUT', '@^'._RACCOURCI_MODELE.'@isS'); |
|
| 312 | 312 | |
| 313 | 313 | // https://code.spip.net/@traiter_modeles |
| 314 | 314 | function traiter_modeles($texte, $doublons = false, $echap = '', $connect = '', $liens = null, $env = []) { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | if (test_espace_prive()) { |
| 389 | 389 | $modele = entites_html(substr($texte, $a, $cherche)); |
| 390 | 390 | if (!is_null($liens)) { |
| 391 | - $modele = '<pre>' . str_replace($liens[0], $liens[1], $modele) . '</pre>'; |
|
| 391 | + $modele = '<pre>'.str_replace($liens[0], $liens[1], $modele).'</pre>'; |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function inc_config_dist() { |
| 31 | - actualise_metas(liste_metas()); |
|
| 31 | + actualise_metas(liste_metas()); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -45,34 +45,34 @@ discard block |
||
| 45 | 45 | * Liste (table, casier, sous_casier) |
| 46 | 46 | */ |
| 47 | 47 | function expliquer_config($cfg) { |
| 48 | - // par defaut, sur la table des meta |
|
| 49 | - $table = 'meta'; |
|
| 50 | - $casier = null; |
|
| 51 | - $sous_casier = []; |
|
| 52 | - $cfg = explode('/', $cfg); |
|
| 53 | - |
|
| 54 | - // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide '' |
|
| 55 | - if (!reset($cfg) and count($cfg) > 1) { |
|
| 56 | - array_shift($cfg); |
|
| 57 | - $table = array_shift($cfg); |
|
| 58 | - if (!isset($GLOBALS[$table])) { |
|
| 59 | - lire_metas($table); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - // si on a demande #CONFIG{/meta,'',0} |
|
| 64 | - if (count($cfg)) { |
|
| 65 | - // pas sur un appel vide '' |
|
| 66 | - if ('' !== ($c = array_shift($cfg))) { |
|
| 67 | - $casier = $c; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - if (count($cfg)) { |
|
| 72 | - $sous_casier = $cfg; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - return [$table, $casier, $sous_casier]; |
|
| 48 | + // par defaut, sur la table des meta |
|
| 49 | + $table = 'meta'; |
|
| 50 | + $casier = null; |
|
| 51 | + $sous_casier = []; |
|
| 52 | + $cfg = explode('/', $cfg); |
|
| 53 | + |
|
| 54 | + // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide '' |
|
| 55 | + if (!reset($cfg) and count($cfg) > 1) { |
|
| 56 | + array_shift($cfg); |
|
| 57 | + $table = array_shift($cfg); |
|
| 58 | + if (!isset($GLOBALS[$table])) { |
|
| 59 | + lire_metas($table); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + // si on a demande #CONFIG{/meta,'',0} |
|
| 64 | + if (count($cfg)) { |
|
| 65 | + // pas sur un appel vide '' |
|
| 66 | + if ('' !== ($c = array_shift($cfg))) { |
|
| 67 | + $casier = $c; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + if (count($cfg)) { |
|
| 72 | + $sous_casier = $cfg; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + return [$table, $casier, $sous_casier]; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -100,65 +100,65 @@ discard block |
||
| 100 | 100 | * Contenu de la configuration obtenue |
| 101 | 101 | */ |
| 102 | 102 | function lire_config($cfg = '', $def = null, $unserialize = true) { |
| 103 | - // lire le stockage sous la forme /table/valeur |
|
| 104 | - // ou valeur qui est en fait implicitement /meta/valeur |
|
| 105 | - // ou casier/valeur qui est en fait implicitement /meta/casier/valeur |
|
| 106 | - |
|
| 107 | - // traiter en priorite le cas simple et frequent |
|
| 108 | - // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni : |
|
| 109 | - if ($cfg and strpbrk($cfg, '/:') === false) { |
|
| 110 | - $r = isset($GLOBALS['meta'][$cfg]) ? |
|
| 111 | - ((!$unserialize |
|
| 112 | - // ne pas essayer de deserialiser autre chose qu'une chaine |
|
| 113 | - or !is_string($GLOBALS['meta'][$cfg]) |
|
| 114 | - // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee |
|
| 115 | - or strpos($GLOBALS['meta'][$cfg], ':') === false |
|
| 116 | - or ($t = @unserialize($GLOBALS['meta'][$cfg])) === false) ? $GLOBALS['meta'][$cfg] : $t) |
|
| 117 | - : $def; |
|
| 118 | - |
|
| 119 | - return $r; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - // Brancher sur methodes externes si besoin |
|
| 123 | - if ($cfg and $p = strpos($cfg, '::')) { |
|
| 124 | - $methode = substr($cfg, 0, $p); |
|
| 125 | - $lire_config = charger_fonction($methode, 'lire_config'); |
|
| 126 | - |
|
| 127 | - return $lire_config(substr($cfg, $p + 2), $def, $unserialize); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - list($table, $casier, $sous_casier) = expliquer_config($cfg); |
|
| 131 | - |
|
| 132 | - if (!isset($GLOBALS[$table])) { |
|
| 133 | - return $def; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - $r = $GLOBALS[$table]; |
|
| 137 | - |
|
| 138 | - // si on a demande #CONFIG{/meta,'',0} |
|
| 139 | - if (!$casier) { |
|
| 140 | - return $unserialize ? $r : serialize($r); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // casier principal : |
|
| 144 | - // le deserializer si demande |
|
| 145 | - // ou si on a besoin |
|
| 146 | - // d'un sous casier |
|
| 147 | - $r = isset($r[$casier]) ? $r[$casier] : null; |
|
| 148 | - if (($unserialize or count($sous_casier)) and $r and is_string($r)) { |
|
| 149 | - $r = (($t = @unserialize($r)) === false ? $r : $t); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - // aller chercher le sous_casier |
|
| 153 | - while (!is_null($r) and $casier = array_shift($sous_casier)) { |
|
| 154 | - $r = isset($r[$casier]) ? $r[$casier] : null; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - if (is_null($r)) { |
|
| 158 | - return $def; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - return $r; |
|
| 103 | + // lire le stockage sous la forme /table/valeur |
|
| 104 | + // ou valeur qui est en fait implicitement /meta/valeur |
|
| 105 | + // ou casier/valeur qui est en fait implicitement /meta/casier/valeur |
|
| 106 | + |
|
| 107 | + // traiter en priorite le cas simple et frequent |
|
| 108 | + // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni : |
|
| 109 | + if ($cfg and strpbrk($cfg, '/:') === false) { |
|
| 110 | + $r = isset($GLOBALS['meta'][$cfg]) ? |
|
| 111 | + ((!$unserialize |
|
| 112 | + // ne pas essayer de deserialiser autre chose qu'une chaine |
|
| 113 | + or !is_string($GLOBALS['meta'][$cfg]) |
|
| 114 | + // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee |
|
| 115 | + or strpos($GLOBALS['meta'][$cfg], ':') === false |
|
| 116 | + or ($t = @unserialize($GLOBALS['meta'][$cfg])) === false) ? $GLOBALS['meta'][$cfg] : $t) |
|
| 117 | + : $def; |
|
| 118 | + |
|
| 119 | + return $r; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + // Brancher sur methodes externes si besoin |
|
| 123 | + if ($cfg and $p = strpos($cfg, '::')) { |
|
| 124 | + $methode = substr($cfg, 0, $p); |
|
| 125 | + $lire_config = charger_fonction($methode, 'lire_config'); |
|
| 126 | + |
|
| 127 | + return $lire_config(substr($cfg, $p + 2), $def, $unserialize); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + list($table, $casier, $sous_casier) = expliquer_config($cfg); |
|
| 131 | + |
|
| 132 | + if (!isset($GLOBALS[$table])) { |
|
| 133 | + return $def; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + $r = $GLOBALS[$table]; |
|
| 137 | + |
|
| 138 | + // si on a demande #CONFIG{/meta,'',0} |
|
| 139 | + if (!$casier) { |
|
| 140 | + return $unserialize ? $r : serialize($r); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // casier principal : |
|
| 144 | + // le deserializer si demande |
|
| 145 | + // ou si on a besoin |
|
| 146 | + // d'un sous casier |
|
| 147 | + $r = isset($r[$casier]) ? $r[$casier] : null; |
|
| 148 | + if (($unserialize or count($sous_casier)) and $r and is_string($r)) { |
|
| 149 | + $r = (($t = @unserialize($r)) === false ? $r : $t); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + // aller chercher le sous_casier |
|
| 153 | + while (!is_null($r) and $casier = array_shift($sous_casier)) { |
|
| 154 | + $r = isset($r[$casier]) ? $r[$casier] : null; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + if (is_null($r)) { |
|
| 158 | + return $def; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + return $r; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @return mixed |
| 173 | 173 | */ |
| 174 | 174 | function lire_config_metapack_dist($cfg = '', $def = null, $unserialize = true) { |
| 175 | - return lire_config($cfg, $def, $unserialize); |
|
| 175 | + return lire_config($cfg, $def, $unserialize); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
@@ -184,98 +184,98 @@ discard block |
||
| 184 | 184 | * @return bool |
| 185 | 185 | */ |
| 186 | 186 | function ecrire_config($cfg, $store) { |
| 187 | - // Brancher sur methodes externes si besoin |
|
| 188 | - if ($cfg and $p = strpos($cfg, '::')) { |
|
| 189 | - $methode = substr($cfg, 0, $p); |
|
| 190 | - $ecrire_config = charger_fonction($methode, 'ecrire_config'); |
|
| 191 | - |
|
| 192 | - return $ecrire_config(substr($cfg, $p + 2), $store); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - list($table, $casier, $sous_casier) = expliquer_config($cfg); |
|
| 196 | - // il faut au moins un casier pour ecrire |
|
| 197 | - if (!$casier) { |
|
| 198 | - return false; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - // trouvons ou creons le pointeur sur le casier |
|
| 202 | - $st = isset($GLOBALS[$table][$casier]) ? $GLOBALS[$table][$casier] : null; |
|
| 203 | - if (!is_array($st) and ($sous_casier or is_array($store))) { |
|
| 204 | - $st = unserialize($st); |
|
| 205 | - if ($st === false) { |
|
| 206 | - // ne rien creer si c'est une demande d'effacement |
|
| 207 | - if (is_null($store)) { |
|
| 208 | - return false; |
|
| 209 | - } |
|
| 210 | - $st = []; |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - // si on a affaire a un sous caiser |
|
| 215 | - // il faut ecrire au bon endroit sans perdre les autres sous casier freres |
|
| 216 | - if ($c = $sous_casier) { |
|
| 217 | - $sc = &$st; |
|
| 218 | - $pointeurs = []; |
|
| 219 | - while (count($c) and $cc = array_shift($c)) { |
|
| 220 | - // creer l'entree si elle n'existe pas |
|
| 221 | - if (!isset($sc[$cc])) { |
|
| 222 | - // si on essaye d'effacer une config qui n'existe pas |
|
| 223 | - // ne rien creer mais sortir |
|
| 224 | - if (is_null($store)) { |
|
| 225 | - return false; |
|
| 226 | - } |
|
| 227 | - $sc[$cc] = []; |
|
| 228 | - } |
|
| 229 | - $pointeurs[$cc] = &$sc; |
|
| 230 | - $sc = &$sc[$cc]; |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - // si c'est une demande d'effacement |
|
| 234 | - if (is_null($store)) { |
|
| 235 | - $c = $sous_casier; |
|
| 236 | - $sous = array_pop($c); |
|
| 237 | - // effacer, et remonter pour effacer les parents vides |
|
| 238 | - do { |
|
| 239 | - unset($pointeurs[$sous][$sous]); |
|
| 240 | - } while ($sous = array_pop($c) and !count($pointeurs[$sous][$sous])); |
|
| 241 | - |
|
| 242 | - // si on a vide tous les sous casiers, |
|
| 243 | - // et que le casier est vide |
|
| 244 | - // vider aussi la meta |
|
| 245 | - if (!$sous and !count($st)) { |
|
| 246 | - $st = null; |
|
| 247 | - } |
|
| 248 | - } // dans tous les autres cas, on ecrase |
|
| 249 | - else { |
|
| 250 | - $sc = $store; |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - // Maintenant que $st est modifiee |
|
| 254 | - // reprenons la comme valeur a stocker dans le casier principal |
|
| 255 | - $store = $st; |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - if (is_null($store)) { |
|
| 259 | - if (is_null($st) and !$sous_casier) { |
|
| 260 | - return false; |
|
| 261 | - } // la config n'existait deja pas ! |
|
| 262 | - effacer_meta($casier, $table); |
|
| 263 | - supprimer_table_meta($table); // supprimons la table (si elle est bien vide) |
|
| 264 | - } // les meta ne peuvent etre que des chaines : il faut serializer le reste |
|
| 265 | - else { |
|
| 266 | - if (!isset($GLOBALS[$table])) { |
|
| 267 | - installer_table_meta($table); |
|
| 268 | - } |
|
| 269 | - // si ce n'est pas une chaine |
|
| 270 | - // il faut serializer |
|
| 271 | - if (!is_string($store)) { |
|
| 272 | - $store = serialize($store); |
|
| 273 | - } |
|
| 274 | - ecrire_meta($casier, $store, null, $table); |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - // verifier que lire_config($cfg)==$store ? |
|
| 278 | - return true; |
|
| 187 | + // Brancher sur methodes externes si besoin |
|
| 188 | + if ($cfg and $p = strpos($cfg, '::')) { |
|
| 189 | + $methode = substr($cfg, 0, $p); |
|
| 190 | + $ecrire_config = charger_fonction($methode, 'ecrire_config'); |
|
| 191 | + |
|
| 192 | + return $ecrire_config(substr($cfg, $p + 2), $store); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + list($table, $casier, $sous_casier) = expliquer_config($cfg); |
|
| 196 | + // il faut au moins un casier pour ecrire |
|
| 197 | + if (!$casier) { |
|
| 198 | + return false; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + // trouvons ou creons le pointeur sur le casier |
|
| 202 | + $st = isset($GLOBALS[$table][$casier]) ? $GLOBALS[$table][$casier] : null; |
|
| 203 | + if (!is_array($st) and ($sous_casier or is_array($store))) { |
|
| 204 | + $st = unserialize($st); |
|
| 205 | + if ($st === false) { |
|
| 206 | + // ne rien creer si c'est une demande d'effacement |
|
| 207 | + if (is_null($store)) { |
|
| 208 | + return false; |
|
| 209 | + } |
|
| 210 | + $st = []; |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + // si on a affaire a un sous caiser |
|
| 215 | + // il faut ecrire au bon endroit sans perdre les autres sous casier freres |
|
| 216 | + if ($c = $sous_casier) { |
|
| 217 | + $sc = &$st; |
|
| 218 | + $pointeurs = []; |
|
| 219 | + while (count($c) and $cc = array_shift($c)) { |
|
| 220 | + // creer l'entree si elle n'existe pas |
|
| 221 | + if (!isset($sc[$cc])) { |
|
| 222 | + // si on essaye d'effacer une config qui n'existe pas |
|
| 223 | + // ne rien creer mais sortir |
|
| 224 | + if (is_null($store)) { |
|
| 225 | + return false; |
|
| 226 | + } |
|
| 227 | + $sc[$cc] = []; |
|
| 228 | + } |
|
| 229 | + $pointeurs[$cc] = &$sc; |
|
| 230 | + $sc = &$sc[$cc]; |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + // si c'est une demande d'effacement |
|
| 234 | + if (is_null($store)) { |
|
| 235 | + $c = $sous_casier; |
|
| 236 | + $sous = array_pop($c); |
|
| 237 | + // effacer, et remonter pour effacer les parents vides |
|
| 238 | + do { |
|
| 239 | + unset($pointeurs[$sous][$sous]); |
|
| 240 | + } while ($sous = array_pop($c) and !count($pointeurs[$sous][$sous])); |
|
| 241 | + |
|
| 242 | + // si on a vide tous les sous casiers, |
|
| 243 | + // et que le casier est vide |
|
| 244 | + // vider aussi la meta |
|
| 245 | + if (!$sous and !count($st)) { |
|
| 246 | + $st = null; |
|
| 247 | + } |
|
| 248 | + } // dans tous les autres cas, on ecrase |
|
| 249 | + else { |
|
| 250 | + $sc = $store; |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + // Maintenant que $st est modifiee |
|
| 254 | + // reprenons la comme valeur a stocker dans le casier principal |
|
| 255 | + $store = $st; |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + if (is_null($store)) { |
|
| 259 | + if (is_null($st) and !$sous_casier) { |
|
| 260 | + return false; |
|
| 261 | + } // la config n'existait deja pas ! |
|
| 262 | + effacer_meta($casier, $table); |
|
| 263 | + supprimer_table_meta($table); // supprimons la table (si elle est bien vide) |
|
| 264 | + } // les meta ne peuvent etre que des chaines : il faut serializer le reste |
|
| 265 | + else { |
|
| 266 | + if (!isset($GLOBALS[$table])) { |
|
| 267 | + installer_table_meta($table); |
|
| 268 | + } |
|
| 269 | + // si ce n'est pas une chaine |
|
| 270 | + // il faut serializer |
|
| 271 | + if (!is_string($store)) { |
|
| 272 | + $store = serialize($store); |
|
| 273 | + } |
|
| 274 | + ecrire_meta($casier, $store, null, $table); |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + // verifier que lire_config($cfg)==$store ? |
|
| 278 | + return true; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
@@ -289,14 +289,14 @@ discard block |
||
| 289 | 289 | * @return bool |
| 290 | 290 | */ |
| 291 | 291 | function ecrire_config_metapack_dist($cfg, $store) { |
| 292 | - // cas particulier en metapack:: |
|
| 293 | - // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre |
|
| 294 | - // intacte en sortie ... |
|
| 295 | - if (is_string($store) and strpos($store, ':') and unserialize($store)) { |
|
| 296 | - $store = serialize($store); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - return ecrire_config($cfg, $store); |
|
| 292 | + // cas particulier en metapack:: |
|
| 293 | + // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre |
|
| 294 | + // intacte en sortie ... |
|
| 295 | + if (is_string($store) and strpos($store, ':') and unserialize($store)) { |
|
| 296 | + $store = serialize($store); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + return ecrire_config($cfg, $store); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | * @return bool |
| 307 | 307 | */ |
| 308 | 308 | function effacer_config($cfg) { |
| 309 | - ecrire_config($cfg, null); |
|
| 309 | + ecrire_config($cfg, null); |
|
| 310 | 310 | |
| 311 | - return true; |
|
| 311 | + return true; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -325,71 +325,71 @@ discard block |
||
| 325 | 325 | * @return array |
| 326 | 326 | */ |
| 327 | 327 | function lister_configurer($exclure = []) { |
| 328 | - return []; |
|
| 329 | - |
|
| 330 | - // lister les pages de config deja dans les menus |
|
| 331 | - $deja = []; |
|
| 332 | - foreach ($exclure as $id => $b) { |
|
| 333 | - $url = ($b['url'] ? $b['url'] : $id); |
|
| 334 | - if (!$b['url'] or !isset($exclure[$url])) { |
|
| 335 | - if (strncmp($url, 'configurer_', 11) == 0) { |
|
| 336 | - $deja[$url] = $b; |
|
| 337 | - } elseif ($b['url'] == 'configurer' and preg_match(',cfg=([a-z0-9_]+),i', $b['args'], $match)) { |
|
| 338 | - $deja['configurer_' . $match[1]] = $b; |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - $exclure = $exclure + $deja; |
|
| 343 | - |
|
| 344 | - $icone_defaut = 'images/configuration-16.png'; |
|
| 345 | - $liste = []; |
|
| 346 | - $skels = []; |
|
| 347 | - $forms = []; |
|
| 348 | - |
|
| 349 | - // trouver toutes les pages configurer_xxx de l'espace prive |
|
| 350 | - // et construire un tableau des entrees qui ne sont pas dans $deja |
|
| 351 | - $pages = find_all_in_path('prive/squelettes/contenu/', 'configurer_.*[.]' . _EXTENSION_SQUELETTES . '$'); |
|
| 352 | - |
|
| 353 | - foreach ($pages as $page) { |
|
| 354 | - $configurer = basename($page, '.' . _EXTENSION_SQUELETTES); |
|
| 355 | - if (!isset($exclure[$configurer])) { |
|
| 356 | - $liste[$configurer] = [ |
|
| 357 | - 'parent' => 'bando_configuration', |
|
| 358 | - 'url' => $configurer, |
|
| 359 | - 'titre' => _T("configurer:{$configurer}_titre"), |
|
| 360 | - 'icone' => find_in_theme($i = "images/{$configurer}-16.png") ? $i : $icone_defaut, |
|
| 361 | - ]; |
|
| 362 | - } |
|
| 363 | - $skels[$configurer] = $page; |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - // analyser la liste des $skels pour voir les #FORMULAIRE_CONFIGURER_ inclus |
|
| 367 | - foreach ($skels as $file) { |
|
| 368 | - $forms = array_merge($forms, lister_formulaires_configurer($file)); |
|
| 369 | - } |
|
| 370 | - $forms = array_flip($forms); |
|
| 371 | - |
|
| 372 | - // trouver tous les formulaires/configurer_ |
|
| 373 | - // et construire un tableau des entrees |
|
| 374 | - $pages = find_all_in_path('formulaires/', 'configurer_.*[.]' . _EXTENSION_SQUELETTES . '$'); |
|
| 375 | - foreach ($pages as $page) { |
|
| 376 | - $configurer = basename($page, '.' . _EXTENSION_SQUELETTES); |
|
| 377 | - if ( |
|
| 378 | - !isset($forms[$configurer]) |
|
| 379 | - and !isset($liste[$configurer]) |
|
| 380 | - and !isset($exclure[$configurer]) |
|
| 381 | - ) { |
|
| 382 | - $liste[$configurer] = [ |
|
| 383 | - 'parent' => 'bando_configuration', |
|
| 384 | - 'url' => 'configurer', |
|
| 385 | - 'args' => 'cfg=' . substr($configurer, 11), |
|
| 386 | - 'titre' => _T("configurer:{$configurer}_titre"), |
|
| 387 | - 'icone' => find_in_theme($i = "images/{$configurer}-16.png") ? $i : $icone_defaut, |
|
| 388 | - ]; |
|
| 389 | - } |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - return $liste; |
|
| 328 | + return []; |
|
| 329 | + |
|
| 330 | + // lister les pages de config deja dans les menus |
|
| 331 | + $deja = []; |
|
| 332 | + foreach ($exclure as $id => $b) { |
|
| 333 | + $url = ($b['url'] ? $b['url'] : $id); |
|
| 334 | + if (!$b['url'] or !isset($exclure[$url])) { |
|
| 335 | + if (strncmp($url, 'configurer_', 11) == 0) { |
|
| 336 | + $deja[$url] = $b; |
|
| 337 | + } elseif ($b['url'] == 'configurer' and preg_match(',cfg=([a-z0-9_]+),i', $b['args'], $match)) { |
|
| 338 | + $deja['configurer_' . $match[1]] = $b; |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + $exclure = $exclure + $deja; |
|
| 343 | + |
|
| 344 | + $icone_defaut = 'images/configuration-16.png'; |
|
| 345 | + $liste = []; |
|
| 346 | + $skels = []; |
|
| 347 | + $forms = []; |
|
| 348 | + |
|
| 349 | + // trouver toutes les pages configurer_xxx de l'espace prive |
|
| 350 | + // et construire un tableau des entrees qui ne sont pas dans $deja |
|
| 351 | + $pages = find_all_in_path('prive/squelettes/contenu/', 'configurer_.*[.]' . _EXTENSION_SQUELETTES . '$'); |
|
| 352 | + |
|
| 353 | + foreach ($pages as $page) { |
|
| 354 | + $configurer = basename($page, '.' . _EXTENSION_SQUELETTES); |
|
| 355 | + if (!isset($exclure[$configurer])) { |
|
| 356 | + $liste[$configurer] = [ |
|
| 357 | + 'parent' => 'bando_configuration', |
|
| 358 | + 'url' => $configurer, |
|
| 359 | + 'titre' => _T("configurer:{$configurer}_titre"), |
|
| 360 | + 'icone' => find_in_theme($i = "images/{$configurer}-16.png") ? $i : $icone_defaut, |
|
| 361 | + ]; |
|
| 362 | + } |
|
| 363 | + $skels[$configurer] = $page; |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + // analyser la liste des $skels pour voir les #FORMULAIRE_CONFIGURER_ inclus |
|
| 367 | + foreach ($skels as $file) { |
|
| 368 | + $forms = array_merge($forms, lister_formulaires_configurer($file)); |
|
| 369 | + } |
|
| 370 | + $forms = array_flip($forms); |
|
| 371 | + |
|
| 372 | + // trouver tous les formulaires/configurer_ |
|
| 373 | + // et construire un tableau des entrees |
|
| 374 | + $pages = find_all_in_path('formulaires/', 'configurer_.*[.]' . _EXTENSION_SQUELETTES . '$'); |
|
| 375 | + foreach ($pages as $page) { |
|
| 376 | + $configurer = basename($page, '.' . _EXTENSION_SQUELETTES); |
|
| 377 | + if ( |
|
| 378 | + !isset($forms[$configurer]) |
|
| 379 | + and !isset($liste[$configurer]) |
|
| 380 | + and !isset($exclure[$configurer]) |
|
| 381 | + ) { |
|
| 382 | + $liste[$configurer] = [ |
|
| 383 | + 'parent' => 'bando_configuration', |
|
| 384 | + 'url' => 'configurer', |
|
| 385 | + 'args' => 'cfg=' . substr($configurer, 11), |
|
| 386 | + 'titre' => _T("configurer:{$configurer}_titre"), |
|
| 387 | + 'icone' => find_in_theme($i = "images/{$configurer}-16.png") ? $i : $icone_defaut, |
|
| 388 | + ]; |
|
| 389 | + } |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + return $liste; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | |
@@ -403,35 +403,35 @@ discard block |
||
| 403 | 403 | * Liste des formulaires trouvés |
| 404 | 404 | **/ |
| 405 | 405 | function lister_formulaires_configurer($file) { |
| 406 | - $forms = []; |
|
| 407 | - |
|
| 408 | - lire_fichier($file, $skel); |
|
| 409 | - if (preg_match_all(',#FORMULAIRE_(CONFIGURER_[A-Z0-9_]*),', $skel, $matches, PREG_SET_ORDER)) { |
|
| 410 | - $matches = array_map('end', $matches); |
|
| 411 | - $matches = array_map('strtolower', $matches); |
|
| 412 | - $forms = array_merge($forms, $matches); |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - // evaluer le fond en lui passant un exec coherent pour que les pipelines le reconnaissent |
|
| 416 | - // et reperer les formulaires CVT configurer_xx insereres par les plugins via pipeline |
|
| 417 | - $config = basename(substr($file, 0, -strlen('.' . _EXTENSION_SQUELETTES))); |
|
| 418 | - spip_log('Calcul de ' . "prive/squelettes/contenu/$config"); |
|
| 419 | - $fond = recuperer_fond("prive/squelettes/contenu/$config", ['exec' => $config]); |
|
| 420 | - |
|
| 421 | - // passer dans le pipeline affiche_milieu pour que les plugins puissent ajouter leur formulaires... |
|
| 422 | - // et donc que l'on puisse les referencer aussi ! |
|
| 423 | - $fond = pipeline('affiche_milieu', ['args' => ['exec' => $config], 'data' => $fond]); |
|
| 424 | - |
|
| 425 | - // recuperer les noms des formulaires presents. |
|
| 426 | - if (is_array($inputs = extraire_balises($fond, 'input'))) { |
|
| 427 | - foreach ($inputs as $i) { |
|
| 428 | - if (extraire_attribut($i, 'name') == 'formulaire_action') { |
|
| 429 | - $forms[] = ($c = extraire_attribut($i, 'value')); |
|
| 430 | - } |
|
| 431 | - } |
|
| 432 | - } |
|
| 433 | - |
|
| 434 | - return $forms; |
|
| 406 | + $forms = []; |
|
| 407 | + |
|
| 408 | + lire_fichier($file, $skel); |
|
| 409 | + if (preg_match_all(',#FORMULAIRE_(CONFIGURER_[A-Z0-9_]*),', $skel, $matches, PREG_SET_ORDER)) { |
|
| 410 | + $matches = array_map('end', $matches); |
|
| 411 | + $matches = array_map('strtolower', $matches); |
|
| 412 | + $forms = array_merge($forms, $matches); |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + // evaluer le fond en lui passant un exec coherent pour que les pipelines le reconnaissent |
|
| 416 | + // et reperer les formulaires CVT configurer_xx insereres par les plugins via pipeline |
|
| 417 | + $config = basename(substr($file, 0, -strlen('.' . _EXTENSION_SQUELETTES))); |
|
| 418 | + spip_log('Calcul de ' . "prive/squelettes/contenu/$config"); |
|
| 419 | + $fond = recuperer_fond("prive/squelettes/contenu/$config", ['exec' => $config]); |
|
| 420 | + |
|
| 421 | + // passer dans le pipeline affiche_milieu pour que les plugins puissent ajouter leur formulaires... |
|
| 422 | + // et donc que l'on puisse les referencer aussi ! |
|
| 423 | + $fond = pipeline('affiche_milieu', ['args' => ['exec' => $config], 'data' => $fond]); |
|
| 424 | + |
|
| 425 | + // recuperer les noms des formulaires presents. |
|
| 426 | + if (is_array($inputs = extraire_balises($fond, 'input'))) { |
|
| 427 | + foreach ($inputs as $i) { |
|
| 428 | + if (extraire_attribut($i, 'name') == 'formulaire_action') { |
|
| 429 | + $forms[] = ($c = extraire_attribut($i, 'value')); |
|
| 430 | + } |
|
| 431 | + } |
|
| 432 | + } |
|
| 433 | + |
|
| 434 | + return $forms; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | |
@@ -449,58 +449,58 @@ discard block |
||
| 449 | 449 | * Couples nom de la `meta` => valeur par défaut |
| 450 | 450 | */ |
| 451 | 451 | function liste_metas() { |
| 452 | - return pipeline('configurer_liste_metas', [ |
|
| 453 | - 'nom_site' => _T('info_mon_site_spip'), |
|
| 454 | - 'slogan_site' => '', |
|
| 455 | - 'adresse_site' => preg_replace(',/$,', '', url_de_base()), |
|
| 456 | - 'descriptif_site' => '', |
|
| 457 | - 'activer_logos' => 'oui', |
|
| 458 | - 'activer_logos_survol' => 'non', |
|
| 459 | - 'articles_surtitre' => 'non', |
|
| 460 | - 'articles_soustitre' => 'non', |
|
| 461 | - 'articles_descriptif' => 'non', |
|
| 462 | - 'articles_chapeau' => 'non', |
|
| 463 | - 'articles_texte' => 'oui', |
|
| 464 | - 'articles_ps' => 'non', |
|
| 465 | - 'articles_redac' => 'non', |
|
| 466 | - 'post_dates' => 'non', |
|
| 467 | - 'articles_urlref' => 'non', |
|
| 468 | - 'articles_redirection' => 'non', |
|
| 469 | - 'creer_preview' => 'non', |
|
| 470 | - 'taille_preview' => 150, |
|
| 471 | - 'articles_modif' => 'non', |
|
| 472 | - |
|
| 473 | - 'rubriques_descriptif' => 'non', |
|
| 474 | - 'rubriques_texte' => 'oui', |
|
| 475 | - |
|
| 476 | - 'accepter_inscriptions' => 'non', |
|
| 477 | - 'accepter_visiteurs' => 'non', |
|
| 478 | - 'prevenir_auteurs' => 'non', |
|
| 479 | - 'suivi_edito' => 'non', |
|
| 480 | - 'adresse_suivi' => '', |
|
| 481 | - 'adresse_suivi_inscription' => '', |
|
| 482 | - 'adresse_neuf' => '', |
|
| 483 | - 'jours_neuf' => '', |
|
| 484 | - 'quoi_de_neuf' => 'non', |
|
| 485 | - 'preview' => ',0minirezo,1comite,', |
|
| 486 | - |
|
| 487 | - 'syndication_integrale' => 'oui', |
|
| 488 | - 'charset' => _DEFAULT_CHARSET, |
|
| 489 | - 'dir_img' => substr(_DIR_IMG, strlen(_DIR_RACINE)), |
|
| 490 | - |
|
| 491 | - 'multi_rubriques' => 'non', |
|
| 492 | - 'multi_secteurs' => 'non', |
|
| 493 | - 'gerer_trad' => 'non', |
|
| 494 | - 'langues_multilingue' => '', |
|
| 495 | - |
|
| 496 | - 'version_html_max' => 'html4', |
|
| 497 | - |
|
| 498 | - 'type_urls' => 'page', |
|
| 499 | - |
|
| 500 | - 'email_envoi' => '', |
|
| 501 | - 'email_webmaster' => '', |
|
| 502 | - 'auto_compress_http' => 'non', |
|
| 503 | - ]); |
|
| 452 | + return pipeline('configurer_liste_metas', [ |
|
| 453 | + 'nom_site' => _T('info_mon_site_spip'), |
|
| 454 | + 'slogan_site' => '', |
|
| 455 | + 'adresse_site' => preg_replace(',/$,', '', url_de_base()), |
|
| 456 | + 'descriptif_site' => '', |
|
| 457 | + 'activer_logos' => 'oui', |
|
| 458 | + 'activer_logos_survol' => 'non', |
|
| 459 | + 'articles_surtitre' => 'non', |
|
| 460 | + 'articles_soustitre' => 'non', |
|
| 461 | + 'articles_descriptif' => 'non', |
|
| 462 | + 'articles_chapeau' => 'non', |
|
| 463 | + 'articles_texte' => 'oui', |
|
| 464 | + 'articles_ps' => 'non', |
|
| 465 | + 'articles_redac' => 'non', |
|
| 466 | + 'post_dates' => 'non', |
|
| 467 | + 'articles_urlref' => 'non', |
|
| 468 | + 'articles_redirection' => 'non', |
|
| 469 | + 'creer_preview' => 'non', |
|
| 470 | + 'taille_preview' => 150, |
|
| 471 | + 'articles_modif' => 'non', |
|
| 472 | + |
|
| 473 | + 'rubriques_descriptif' => 'non', |
|
| 474 | + 'rubriques_texte' => 'oui', |
|
| 475 | + |
|
| 476 | + 'accepter_inscriptions' => 'non', |
|
| 477 | + 'accepter_visiteurs' => 'non', |
|
| 478 | + 'prevenir_auteurs' => 'non', |
|
| 479 | + 'suivi_edito' => 'non', |
|
| 480 | + 'adresse_suivi' => '', |
|
| 481 | + 'adresse_suivi_inscription' => '', |
|
| 482 | + 'adresse_neuf' => '', |
|
| 483 | + 'jours_neuf' => '', |
|
| 484 | + 'quoi_de_neuf' => 'non', |
|
| 485 | + 'preview' => ',0minirezo,1comite,', |
|
| 486 | + |
|
| 487 | + 'syndication_integrale' => 'oui', |
|
| 488 | + 'charset' => _DEFAULT_CHARSET, |
|
| 489 | + 'dir_img' => substr(_DIR_IMG, strlen(_DIR_RACINE)), |
|
| 490 | + |
|
| 491 | + 'multi_rubriques' => 'non', |
|
| 492 | + 'multi_secteurs' => 'non', |
|
| 493 | + 'gerer_trad' => 'non', |
|
| 494 | + 'langues_multilingue' => '', |
|
| 495 | + |
|
| 496 | + 'version_html_max' => 'html4', |
|
| 497 | + |
|
| 498 | + 'type_urls' => 'page', |
|
| 499 | + |
|
| 500 | + 'email_envoi' => '', |
|
| 501 | + 'email_webmaster' => '', |
|
| 502 | + 'auto_compress_http' => 'non', |
|
| 503 | + ]); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | /** |
@@ -511,43 +511,43 @@ discard block |
||
| 511 | 511 | * @return void |
| 512 | 512 | */ |
| 513 | 513 | function actualise_metas($liste_meta) { |
| 514 | - $meta_serveur = |
|
| 515 | - [ |
|
| 516 | - 'version_installee', |
|
| 517 | - 'adresse_site', |
|
| 518 | - 'alea_ephemere_ancien', |
|
| 519 | - 'alea_ephemere', |
|
| 520 | - 'alea_ephemere_date', |
|
| 521 | - 'langue_site', |
|
| 522 | - 'langues_proposees', |
|
| 523 | - 'date_calcul_rubriques', |
|
| 524 | - 'derniere_modif', |
|
| 525 | - 'optimiser_table', |
|
| 526 | - 'drapeau_edition', |
|
| 527 | - 'creer_preview', |
|
| 528 | - 'taille_preview', |
|
| 529 | - 'creer_htpasswd', |
|
| 530 | - 'creer_htaccess', |
|
| 531 | - 'gd_formats_read', |
|
| 532 | - 'gd_formats', |
|
| 533 | - 'netpbm_formats', |
|
| 534 | - 'formats_graphiques', |
|
| 535 | - 'image_process', |
|
| 536 | - 'plugin_header', |
|
| 537 | - 'plugin' |
|
| 538 | - ]; |
|
| 539 | - // verifier le impt=non |
|
| 540 | - sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur)); |
|
| 541 | - |
|
| 542 | - foreach ($liste_meta as $nom => $valeur) { |
|
| 543 | - if (empty($GLOBALS['meta'][$nom])) { |
|
| 544 | - ecrire_meta($nom, $valeur); |
|
| 545 | - } |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - include_spip('inc/rubriques'); |
|
| 549 | - $langues = calculer_langues_utilisees(); |
|
| 550 | - ecrire_meta('langues_utilisees', $langues); |
|
| 514 | + $meta_serveur = |
|
| 515 | + [ |
|
| 516 | + 'version_installee', |
|
| 517 | + 'adresse_site', |
|
| 518 | + 'alea_ephemere_ancien', |
|
| 519 | + 'alea_ephemere', |
|
| 520 | + 'alea_ephemere_date', |
|
| 521 | + 'langue_site', |
|
| 522 | + 'langues_proposees', |
|
| 523 | + 'date_calcul_rubriques', |
|
| 524 | + 'derniere_modif', |
|
| 525 | + 'optimiser_table', |
|
| 526 | + 'drapeau_edition', |
|
| 527 | + 'creer_preview', |
|
| 528 | + 'taille_preview', |
|
| 529 | + 'creer_htpasswd', |
|
| 530 | + 'creer_htaccess', |
|
| 531 | + 'gd_formats_read', |
|
| 532 | + 'gd_formats', |
|
| 533 | + 'netpbm_formats', |
|
| 534 | + 'formats_graphiques', |
|
| 535 | + 'image_process', |
|
| 536 | + 'plugin_header', |
|
| 537 | + 'plugin' |
|
| 538 | + ]; |
|
| 539 | + // verifier le impt=non |
|
| 540 | + sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur)); |
|
| 541 | + |
|
| 542 | + foreach ($liste_meta as $nom => $valeur) { |
|
| 543 | + if (empty($GLOBALS['meta'][$nom])) { |
|
| 544 | + ecrire_meta($nom, $valeur); |
|
| 545 | + } |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + include_spip('inc/rubriques'); |
|
| 549 | + $langues = calculer_langues_utilisees(); |
|
| 550 | + ecrire_meta('langues_utilisees', $langues); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | |
@@ -569,18 +569,18 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | function appliquer_modifs_config($purger_skel = false) { |
| 571 | 571 | |
| 572 | - foreach (liste_metas() as $i => $v) { |
|
| 573 | - if (($x = _request($i)) !== null) { |
|
| 574 | - ecrire_meta($i, $x); |
|
| 575 | - } elseif (!isset($GLOBALS['meta'][$i])) { |
|
| 576 | - ecrire_meta($i, $v); |
|
| 577 | - } |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - if ($purger_skel) { |
|
| 581 | - include_spip('inc/invalideur'); |
|
| 582 | - purger_repertoire(_DIR_SKELS); |
|
| 583 | - } |
|
| 572 | + foreach (liste_metas() as $i => $v) { |
|
| 573 | + if (($x = _request($i)) !== null) { |
|
| 574 | + ecrire_meta($i, $x); |
|
| 575 | + } elseif (!isset($GLOBALS['meta'][$i])) { |
|
| 576 | + ecrire_meta($i, $v); |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + if ($purger_skel) { |
|
| 581 | + include_spip('inc/invalideur'); |
|
| 582 | + purger_repertoire(_DIR_SKELS); |
|
| 583 | + } |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | /** |
@@ -591,21 +591,21 @@ discard block |
||
| 591 | 591 | * @return string |
| 592 | 592 | */ |
| 593 | 593 | function appliquer_adresse_site($adresse_site) { |
| 594 | - if ($adresse_site !== null) { |
|
| 595 | - if (!strlen($adresse_site)) { |
|
| 596 | - $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1; |
|
| 597 | - $adresse_site = url_de_base(); |
|
| 598 | - } |
|
| 599 | - $adresse_site = preg_replace(',/?\s*$,', '', $adresse_site); |
|
| 594 | + if ($adresse_site !== null) { |
|
| 595 | + if (!strlen($adresse_site)) { |
|
| 596 | + $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1; |
|
| 597 | + $adresse_site = url_de_base(); |
|
| 598 | + } |
|
| 599 | + $adresse_site = preg_replace(',/?\s*$,', '', $adresse_site); |
|
| 600 | 600 | |
| 601 | - if (!tester_url_absolue($adresse_site)) { |
|
| 602 | - $adresse_site = "http://$adresse_site"; |
|
| 603 | - } |
|
| 601 | + if (!tester_url_absolue($adresse_site)) { |
|
| 602 | + $adresse_site = "http://$adresse_site"; |
|
| 603 | + } |
|
| 604 | 604 | |
| 605 | - $adresse_site = entites_html($adresse_site); |
|
| 605 | + $adresse_site = entites_html($adresse_site); |
|
| 606 | 606 | |
| 607 | - ecrire_meta('adresse_site', $adresse_site); |
|
| 608 | - } |
|
| 607 | + ecrire_meta('adresse_site', $adresse_site); |
|
| 608 | + } |
|
| 609 | 609 | |
| 610 | - return $adresse_site; |
|
| 610 | + return $adresse_site; |
|
| 611 | 611 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | if (strncmp($url, 'configurer_', 11) == 0) { |
| 336 | 336 | $deja[$url] = $b; |
| 337 | 337 | } elseif ($b['url'] == 'configurer' and preg_match(',cfg=([a-z0-9_]+),i', $b['args'], $match)) { |
| 338 | - $deja['configurer_' . $match[1]] = $b; |
|
| 338 | + $deja['configurer_'.$match[1]] = $b; |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | } |
@@ -348,10 +348,10 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | // trouver toutes les pages configurer_xxx de l'espace prive |
| 350 | 350 | // et construire un tableau des entrees qui ne sont pas dans $deja |
| 351 | - $pages = find_all_in_path('prive/squelettes/contenu/', 'configurer_.*[.]' . _EXTENSION_SQUELETTES . '$'); |
|
| 351 | + $pages = find_all_in_path('prive/squelettes/contenu/', 'configurer_.*[.]'._EXTENSION_SQUELETTES.'$'); |
|
| 352 | 352 | |
| 353 | 353 | foreach ($pages as $page) { |
| 354 | - $configurer = basename($page, '.' . _EXTENSION_SQUELETTES); |
|
| 354 | + $configurer = basename($page, '.'._EXTENSION_SQUELETTES); |
|
| 355 | 355 | if (!isset($exclure[$configurer])) { |
| 356 | 356 | $liste[$configurer] = [ |
| 357 | 357 | 'parent' => 'bando_configuration', |
@@ -371,9 +371,9 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | // trouver tous les formulaires/configurer_ |
| 373 | 373 | // et construire un tableau des entrees |
| 374 | - $pages = find_all_in_path('formulaires/', 'configurer_.*[.]' . _EXTENSION_SQUELETTES . '$'); |
|
| 374 | + $pages = find_all_in_path('formulaires/', 'configurer_.*[.]'._EXTENSION_SQUELETTES.'$'); |
|
| 375 | 375 | foreach ($pages as $page) { |
| 376 | - $configurer = basename($page, '.' . _EXTENSION_SQUELETTES); |
|
| 376 | + $configurer = basename($page, '.'._EXTENSION_SQUELETTES); |
|
| 377 | 377 | if ( |
| 378 | 378 | !isset($forms[$configurer]) |
| 379 | 379 | and !isset($liste[$configurer]) |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $liste[$configurer] = [ |
| 383 | 383 | 'parent' => 'bando_configuration', |
| 384 | 384 | 'url' => 'configurer', |
| 385 | - 'args' => 'cfg=' . substr($configurer, 11), |
|
| 385 | + 'args' => 'cfg='.substr($configurer, 11), |
|
| 386 | 386 | 'titre' => _T("configurer:{$configurer}_titre"), |
| 387 | 387 | 'icone' => find_in_theme($i = "images/{$configurer}-16.png") ? $i : $icone_defaut, |
| 388 | 388 | ]; |
@@ -414,8 +414,8 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | // evaluer le fond en lui passant un exec coherent pour que les pipelines le reconnaissent |
| 416 | 416 | // et reperer les formulaires CVT configurer_xx insereres par les plugins via pipeline |
| 417 | - $config = basename(substr($file, 0, -strlen('.' . _EXTENSION_SQUELETTES))); |
|
| 418 | - spip_log('Calcul de ' . "prive/squelettes/contenu/$config"); |
|
| 417 | + $config = basename(substr($file, 0, -strlen('.'._EXTENSION_SQUELETTES))); |
|
| 418 | + spip_log('Calcul de '."prive/squelettes/contenu/$config"); |
|
| 419 | 419 | $fond = recuperer_fond("prive/squelettes/contenu/$config", ['exec' => $config]); |
| 420 | 420 | |
| 421 | 421 | // passer dans le pipeline affiche_milieu pour que les plugins puissent ajouter leur formulaires... |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('base/serial'); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * en droit de l'éliminer |
| 28 | 28 | */ |
| 29 | 29 | if (!defined('_AGE_CACHE_ATIME')) { |
| 30 | - define('_AGE_CACHE_ATIME', 3600); |
|
| 30 | + define('_AGE_CACHE_ATIME', 3600); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -40,31 +40,31 @@ discard block |
||
| 40 | 40 | * @return int Taille approximative en octets |
| 41 | 41 | **/ |
| 42 | 42 | function taille_du_cache() { |
| 43 | - # check dirs until we reach > 500 files |
|
| 44 | - $t = 0; |
|
| 45 | - $n = 0; |
|
| 46 | - $time = isset($GLOBALS['meta']['cache_mark']) ? $GLOBALS['meta']['cache_mark'] : 0; |
|
| 47 | - for ($i = 0; $i < 256; $i++) { |
|
| 48 | - $dir = _DIR_CACHE . sprintf('%02s', dechex($i)); |
|
| 49 | - if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { |
|
| 50 | - while (($f = readdir($d)) !== false) { |
|
| 51 | - if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) { |
|
| 52 | - $n++; |
|
| 53 | - if ($a['mtime'] >= $time) { |
|
| 54 | - if ($a['blocks'] > 0) { |
|
| 55 | - $t += 512 * $a['blocks']; |
|
| 56 | - } else { |
|
| 57 | - $t += $a['size']; |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - if ($n > 500) { |
|
| 64 | - return intval(256 * $t / (1 + $i)); |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - return $t; |
|
| 43 | + # check dirs until we reach > 500 files |
|
| 44 | + $t = 0; |
|
| 45 | + $n = 0; |
|
| 46 | + $time = isset($GLOBALS['meta']['cache_mark']) ? $GLOBALS['meta']['cache_mark'] : 0; |
|
| 47 | + for ($i = 0; $i < 256; $i++) { |
|
| 48 | + $dir = _DIR_CACHE . sprintf('%02s', dechex($i)); |
|
| 49 | + if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { |
|
| 50 | + while (($f = readdir($d)) !== false) { |
|
| 51 | + if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) { |
|
| 52 | + $n++; |
|
| 53 | + if ($a['mtime'] >= $time) { |
|
| 54 | + if ($a['blocks'] > 0) { |
|
| 55 | + $t += 512 * $a['blocks']; |
|
| 56 | + } else { |
|
| 57 | + $t += $a['size']; |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + if ($n > 500) { |
|
| 64 | + return intval(256 * $t / (1 + $i)); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + return $t; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -91,30 +91,30 @@ discard block |
||
| 91 | 91 | * Inutilisé |
| 92 | 92 | **/ |
| 93 | 93 | function inc_suivre_invalideur_dist($cond, $modif = true) { |
| 94 | - if (!$modif) { |
|
| 95 | - return; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - // determiner l'objet modifie : forum, article, etc |
|
| 99 | - if (preg_match(',["\']([a-z_]+)[/"\'],', $cond, $r)) { |
|
| 100 | - $objet = objet_type($r[1]); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - // stocker la date_modif_$objet (ne sert a rien pour le moment) |
|
| 104 | - if (isset($objet)) { |
|
| 105 | - ecrire_meta('derniere_modif_' . $objet, time()); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - // si $derniere_modif_invalide est un array('article', 'rubrique') |
|
| 109 | - // n'affecter la meta que si un de ces objets est modifie |
|
| 110 | - if (is_array($GLOBALS['derniere_modif_invalide'])) { |
|
| 111 | - if (in_array($objet, $GLOBALS['derniere_modif_invalide'])) { |
|
| 112 | - ecrire_meta('derniere_modif', time()); |
|
| 113 | - } |
|
| 114 | - } // sinon, cas standard, toujours affecter la meta |
|
| 115 | - else { |
|
| 116 | - ecrire_meta('derniere_modif', time()); |
|
| 117 | - } |
|
| 94 | + if (!$modif) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + // determiner l'objet modifie : forum, article, etc |
|
| 99 | + if (preg_match(',["\']([a-z_]+)[/"\'],', $cond, $r)) { |
|
| 100 | + $objet = objet_type($r[1]); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + // stocker la date_modif_$objet (ne sert a rien pour le moment) |
|
| 104 | + if (isset($objet)) { |
|
| 105 | + ecrire_meta('derniere_modif_' . $objet, time()); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + // si $derniere_modif_invalide est un array('article', 'rubrique') |
|
| 109 | + // n'affecter la meta que si un de ces objets est modifie |
|
| 110 | + if (is_array($GLOBALS['derniere_modif_invalide'])) { |
|
| 111 | + if (in_array($objet, $GLOBALS['derniere_modif_invalide'])) { |
|
| 112 | + ecrire_meta('derniere_modif', time()); |
|
| 113 | + } |
|
| 114 | + } // sinon, cas standard, toujours affecter la meta |
|
| 115 | + else { |
|
| 116 | + ecrire_meta('derniere_modif', time()); |
|
| 117 | + } |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -139,50 +139,50 @@ discard block |
||
| 139 | 139 | * Nombre de fichiers supprimés |
| 140 | 140 | **/ |
| 141 | 141 | function purger_repertoire($dir, $options = []) { |
| 142 | - if (!is_dir($dir) or !is_readable($dir)) { |
|
| 143 | - return; |
|
| 144 | - } |
|
| 145 | - $handle = opendir($dir); |
|
| 146 | - if (!$handle) { |
|
| 147 | - return; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - $total = 0; |
|
| 151 | - |
|
| 152 | - while (($fichier = @readdir($handle)) !== false) { |
|
| 153 | - // Eviter ".", "..", ".htaccess", ".svn" etc & CACHEDIR.TAG |
|
| 154 | - if ($fichier[0] == '.' or $fichier == 'CACHEDIR.TAG') { |
|
| 155 | - continue; |
|
| 156 | - } |
|
| 157 | - $chemin = "$dir/$fichier"; |
|
| 158 | - if (is_file($chemin)) { |
|
| 159 | - if ( |
|
| 160 | - (!isset($options['atime']) or (@fileatime($chemin) < $options['atime'])) |
|
| 161 | - and (!isset($options['mtime']) or (@filemtime($chemin) < $options['mtime'])) |
|
| 162 | - ) { |
|
| 163 | - supprimer_fichier($chemin); |
|
| 164 | - $total++; |
|
| 165 | - } |
|
| 166 | - } else { |
|
| 167 | - if (is_dir($chemin)) { |
|
| 168 | - $opts = $options; |
|
| 169 | - if (isset($options['limit'])) { |
|
| 170 | - $opts['limit'] = $options['limit'] - $total; |
|
| 171 | - } |
|
| 172 | - $total += purger_repertoire($chemin, $opts); |
|
| 173 | - if (isset($options['subdir']) && $options['subdir']) { |
|
| 174 | - spip_unlink($chemin); |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - if (isset($options['limit']) and $total >= $options['limit']) { |
|
| 180 | - break; |
|
| 181 | - } |
|
| 182 | - } |
|
| 183 | - closedir($handle); |
|
| 184 | - |
|
| 185 | - return $total; |
|
| 142 | + if (!is_dir($dir) or !is_readable($dir)) { |
|
| 143 | + return; |
|
| 144 | + } |
|
| 145 | + $handle = opendir($dir); |
|
| 146 | + if (!$handle) { |
|
| 147 | + return; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + $total = 0; |
|
| 151 | + |
|
| 152 | + while (($fichier = @readdir($handle)) !== false) { |
|
| 153 | + // Eviter ".", "..", ".htaccess", ".svn" etc & CACHEDIR.TAG |
|
| 154 | + if ($fichier[0] == '.' or $fichier == 'CACHEDIR.TAG') { |
|
| 155 | + continue; |
|
| 156 | + } |
|
| 157 | + $chemin = "$dir/$fichier"; |
|
| 158 | + if (is_file($chemin)) { |
|
| 159 | + if ( |
|
| 160 | + (!isset($options['atime']) or (@fileatime($chemin) < $options['atime'])) |
|
| 161 | + and (!isset($options['mtime']) or (@filemtime($chemin) < $options['mtime'])) |
|
| 162 | + ) { |
|
| 163 | + supprimer_fichier($chemin); |
|
| 164 | + $total++; |
|
| 165 | + } |
|
| 166 | + } else { |
|
| 167 | + if (is_dir($chemin)) { |
|
| 168 | + $opts = $options; |
|
| 169 | + if (isset($options['limit'])) { |
|
| 170 | + $opts['limit'] = $options['limit'] - $total; |
|
| 171 | + } |
|
| 172 | + $total += purger_repertoire($chemin, $opts); |
|
| 173 | + if (isset($options['subdir']) && $options['subdir']) { |
|
| 174 | + spip_unlink($chemin); |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + if (isset($options['limit']) and $total >= $options['limit']) { |
|
| 180 | + break; |
|
| 181 | + } |
|
| 182 | + } |
|
| 183 | + closedir($handle); |
|
| 184 | + |
|
| 185 | + return $total; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
@@ -194,17 +194,17 @@ discard block |
||
| 194 | 194 | // https://code.spip.net/@retire_cache |
| 195 | 195 | function retire_cache($cache) { |
| 196 | 196 | |
| 197 | - if ( |
|
| 198 | - preg_match( |
|
| 199 | - ',^([0-9a-f]/)?([0-9]+/)?[0-9a-f]+\.cache(\.gz)?$,i', |
|
| 200 | - $cache |
|
| 201 | - ) |
|
| 202 | - ) { |
|
| 203 | - // supprimer le fichier (de facon propre) |
|
| 204 | - supprimer_fichier(_DIR_CACHE . $cache); |
|
| 205 | - } else { |
|
| 206 | - spip_log("Nom de fichier cache incorrect : $cache"); |
|
| 207 | - } |
|
| 197 | + if ( |
|
| 198 | + preg_match( |
|
| 199 | + ',^([0-9a-f]/)?([0-9]+/)?[0-9a-f]+\.cache(\.gz)?$,i', |
|
| 200 | + $cache |
|
| 201 | + ) |
|
| 202 | + ) { |
|
| 203 | + // supprimer le fichier (de facon propre) |
|
| 204 | + supprimer_fichier(_DIR_CACHE . $cache); |
|
| 205 | + } else { |
|
| 206 | + spip_log("Nom de fichier cache incorrect : $cache"); |
|
| 207 | + } |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // Supprimer les caches marques "x" |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | // la meta est toujours false ; mais evitons un bug si elle est appellee |
| 213 | 213 | // https://code.spip.net/@retire_caches |
| 214 | 214 | function inc_retire_caches_dist($chemin = '') { |
| 215 | - if (isset($GLOBALS['meta']['invalider_caches'])) { |
|
| 216 | - effacer_meta('invalider_caches'); |
|
| 217 | - } # concurrence |
|
| 215 | + if (isset($GLOBALS['meta']['invalider_caches'])) { |
|
| 216 | + effacer_meta('invalider_caches'); |
|
| 217 | + } # concurrence |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | ####################################################################### |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | ## |
| 226 | 226 | |
| 227 | 227 | function retire_caches($chemin = '') { |
| 228 | - if ($retire_caches = charger_fonction('retire_caches', 'inc', true)) { |
|
| 229 | - return $retire_caches($chemin); |
|
| 230 | - } |
|
| 228 | + if ($retire_caches = charger_fonction('retire_caches', 'inc', true)) { |
|
| 229 | + return $retire_caches($chemin); |
|
| 230 | + } |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | |
@@ -236,10 +236,10 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // https://code.spip.net/@calcul_invalideurs |
| 238 | 238 | function calcul_invalideurs($corps, $primary, &$boucles, $id_boucle) { |
| 239 | - if ($calcul_invalideurs = charger_fonction('calcul_invalideurs', 'inc', true)) { |
|
| 240 | - return $calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 241 | - } |
|
| 242 | - return $corps; |
|
| 239 | + if ($calcul_invalideurs = charger_fonction('calcul_invalideurs', 'inc', true)) { |
|
| 240 | + return $calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 241 | + } |
|
| 242 | + return $corps; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
@@ -249,27 +249,27 @@ discard block |
||
| 249 | 249 | // |
| 250 | 250 | // https://code.spip.net/@supprime_invalideurs |
| 251 | 251 | function supprime_invalideurs() { |
| 252 | - if ($supprime_invalideurs = charger_fonction('supprime_invalideurs', 'inc', true)) { |
|
| 253 | - return $supprime_invalideurs(); |
|
| 254 | - } |
|
| 252 | + if ($supprime_invalideurs = charger_fonction('supprime_invalideurs', 'inc', true)) { |
|
| 253 | + return $supprime_invalideurs(); |
|
| 254 | + } |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | // Calcul des pages : noter dans la base les liens d'invalidation |
| 259 | 259 | // https://code.spip.net/@maj_invalideurs |
| 260 | 260 | function maj_invalideurs($fichier, &$page) { |
| 261 | - if ($maj_invalideurs = charger_fonction('maj_invalideurs', 'inc', true)) { |
|
| 262 | - return $maj_invalideurs($fichier, $page); |
|
| 263 | - } |
|
| 261 | + if ($maj_invalideurs = charger_fonction('maj_invalideurs', 'inc', true)) { |
|
| 262 | + return $maj_invalideurs($fichier, $page); |
|
| 263 | + } |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
| 267 | 267 | // les invalideurs sont de la forme "objet/id_objet" |
| 268 | 268 | // https://code.spip.net/@insere_invalideur |
| 269 | 269 | function insere_invalideur($inval, $fichier) { |
| 270 | - if ($insere_invalideur = charger_fonction('insere_invalideur', 'inc', true)) { |
|
| 271 | - return $insere_invalideur($inval, $fichier); |
|
| 272 | - } |
|
| 270 | + if ($insere_invalideur = charger_fonction('insere_invalideur', 'inc', true)) { |
|
| 271 | + return $insere_invalideur($inval, $fichier); |
|
| 272 | + } |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | // |
@@ -277,16 +277,16 @@ discard block |
||
| 277 | 277 | // |
| 278 | 278 | // https://code.spip.net/@applique_invalideur |
| 279 | 279 | function applique_invalideur($depart) { |
| 280 | - if ($applique_invalideur = charger_fonction('applique_invalideur', 'inc', true)) { |
|
| 281 | - return $applique_invalideur($depart); |
|
| 282 | - } |
|
| 280 | + if ($applique_invalideur = charger_fonction('applique_invalideur', 'inc', true)) { |
|
| 281 | + return $applique_invalideur($depart); |
|
| 282 | + } |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // |
| 286 | 286 | // Invalider les caches liés à telle condition |
| 287 | 287 | // |
| 288 | 288 | function suivre_invalideur($cond, $modif = true) { |
| 289 | - if ($suivre_invalideur = charger_fonction('suivre_invalideur', 'inc', true)) { |
|
| 290 | - return $suivre_invalideur($cond, $modif); |
|
| 291 | - } |
|
| 289 | + if ($suivre_invalideur = charger_fonction('suivre_invalideur', 'inc', true)) { |
|
| 290 | + return $suivre_invalideur($cond, $modif); |
|
| 291 | + } |
|
| 292 | 292 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $n = 0; |
| 46 | 46 | $time = isset($GLOBALS['meta']['cache_mark']) ? $GLOBALS['meta']['cache_mark'] : 0; |
| 47 | 47 | for ($i = 0; $i < 256; $i++) { |
| 48 | - $dir = _DIR_CACHE . sprintf('%02s', dechex($i)); |
|
| 48 | + $dir = _DIR_CACHE.sprintf('%02s', dechex($i)); |
|
| 49 | 49 | if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { |
| 50 | 50 | while (($f = readdir($d)) !== false) { |
| 51 | 51 | if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // stocker la date_modif_$objet (ne sert a rien pour le moment) |
| 104 | 104 | if (isset($objet)) { |
| 105 | - ecrire_meta('derniere_modif_' . $objet, time()); |
|
| 105 | + ecrire_meta('derniere_modif_'.$objet, time()); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // si $derniere_modif_invalide est un array('article', 'rubrique') |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | ) |
| 202 | 202 | ) { |
| 203 | 203 | // supprimer le fichier (de facon propre) |
| 204 | - supprimer_fichier(_DIR_CACHE . $cache); |
|
| 204 | + supprimer_fichier(_DIR_CACHE.$cache); |
|
| 205 | 205 | } else { |
| 206 | 206 | spip_log("Nom de fichier cache incorrect : $cache"); |
| 207 | 207 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Filtres |
| 17 | 17 | */ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/filtres_boites'); |
@@ -41,27 +41,27 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function parametres_css_prive() { |
| 43 | 43 | |
| 44 | - $args = []; |
|
| 45 | - $args['v'] = $GLOBALS['spip_version_code']; |
|
| 46 | - $args['p'] = substr(md5($GLOBALS['meta']['plugin']), 0, 4); |
|
| 47 | - $args['themes'] = implode(',', lister_themes_prives()); |
|
| 48 | - $args['ltr'] = $GLOBALS['spip_lang_left']; |
|
| 49 | - // un md5 des menus : si un menu change il faut maj la css |
|
| 50 | - $args['md5b'] = (function_exists('md5_boutons_plugins') ? md5_boutons_plugins() : ''); |
|
| 44 | + $args = []; |
|
| 45 | + $args['v'] = $GLOBALS['spip_version_code']; |
|
| 46 | + $args['p'] = substr(md5($GLOBALS['meta']['plugin']), 0, 4); |
|
| 47 | + $args['themes'] = implode(',', lister_themes_prives()); |
|
| 48 | + $args['ltr'] = $GLOBALS['spip_lang_left']; |
|
| 49 | + // un md5 des menus : si un menu change il faut maj la css |
|
| 50 | + $args['md5b'] = (function_exists('md5_boutons_plugins') ? md5_boutons_plugins() : ''); |
|
| 51 | 51 | |
| 52 | - $c = isset($GLOBALS['visiteur_session']['prefs']['couleur']) |
|
| 53 | - ? $GLOBALS['visiteur_session']['prefs']['couleur'] |
|
| 54 | - : 2; |
|
| 52 | + $c = isset($GLOBALS['visiteur_session']['prefs']['couleur']) |
|
| 53 | + ? $GLOBALS['visiteur_session']['prefs']['couleur'] |
|
| 54 | + : 2; |
|
| 55 | 55 | |
| 56 | - $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 57 | - parse_str($couleurs($c), $c); |
|
| 58 | - $args = array_merge($args, $c); |
|
| 56 | + $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 57 | + parse_str($couleurs($c), $c); |
|
| 58 | + $args = array_merge($args, $c); |
|
| 59 | 59 | |
| 60 | - if (_request('var_mode') == 'recalcul' or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')) { |
|
| 61 | - $args['var_mode'] = 'recalcul'; |
|
| 62 | - } |
|
| 60 | + if (_request('var_mode') == 'recalcul' or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')) { |
|
| 61 | + $args['var_mode'] = 'recalcul'; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return http_build_query($args); |
|
| 64 | + return http_build_query($args); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -84,91 +84,91 @@ discard block |
||
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | 86 | function chercher_rubrique( |
| 87 | - $titre, |
|
| 88 | - $id_objet, |
|
| 89 | - $id_parent, |
|
| 90 | - $objet, |
|
| 91 | - $id_secteur, |
|
| 92 | - $restreint, |
|
| 93 | - $actionable = false, |
|
| 94 | - $retour_sans_cadre = false |
|
| 87 | + $titre, |
|
| 88 | + $id_objet, |
|
| 89 | + $id_parent, |
|
| 90 | + $objet, |
|
| 91 | + $id_secteur, |
|
| 92 | + $restreint, |
|
| 93 | + $actionable = false, |
|
| 94 | + $retour_sans_cadre = false |
|
| 95 | 95 | ) { |
| 96 | 96 | |
| 97 | - include_spip('inc/autoriser'); |
|
| 98 | - if (intval($id_objet) && !autoriser('modifier', $objet, $id_objet)) { |
|
| 99 | - return ''; |
|
| 100 | - } |
|
| 101 | - if (!sql_countsel('spip_rubriques')) { |
|
| 102 | - return ''; |
|
| 103 | - } |
|
| 104 | - $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc'); |
|
| 105 | - $form = $chercher_rubrique($id_parent, $objet, $restreint, ($objet == 'rubrique') ? $id_objet : 0); |
|
| 106 | - |
|
| 107 | - if ($id_parent == 0) { |
|
| 108 | - $logo = 'racine-24.png'; |
|
| 109 | - } elseif ($id_secteur == $id_parent) { |
|
| 110 | - $logo = 'secteur-24.png'; |
|
| 111 | - } else { |
|
| 112 | - $logo = 'rubrique-24.png'; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $confirm = ''; |
|
| 116 | - if ($objet == 'rubrique') { |
|
| 117 | - // si c'est une rubrique-secteur contenant des breves, demander la |
|
| 118 | - // confirmation du deplacement |
|
| 119 | - $contient_breves = sql_countsel('spip_breves', 'id_rubrique=' . intval($id_objet)); |
|
| 120 | - |
|
| 121 | - if ($contient_breves > 0) { |
|
| 122 | - $scb = ($contient_breves > 1 ? 's' : ''); |
|
| 123 | - $scb = _T( |
|
| 124 | - 'avis_deplacement_rubrique', |
|
| 125 | - [ |
|
| 126 | - 'contient_breves' => $contient_breves, |
|
| 127 | - 'scb' => $scb |
|
| 128 | - ] |
|
| 129 | - ); |
|
| 130 | - $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
|
| 131 | - . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
|
| 132 | - . $scb . |
|
| 133 | - "</label></div></div>\n"; |
|
| 134 | - } else { |
|
| 135 | - $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - $form .= $confirm; |
|
| 139 | - if ($actionable) { |
|
| 140 | - if (strpos($form, '<select') !== false) { |
|
| 141 | - $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 142 | - . '<input class="fondo submit btn" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 143 | - . '</div>'; |
|
| 144 | - } |
|
| 145 | - $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 146 | - if ($action = charger_fonction("editer_$objet", 'action', true)) { |
|
| 147 | - $form = generer_action_auteur( |
|
| 148 | - "editer_$objet", |
|
| 149 | - $id_objet, |
|
| 150 | - self(), |
|
| 151 | - $form, |
|
| 152 | - " method='post' class='submit_plongeur'" |
|
| 153 | - ); |
|
| 154 | - } else { |
|
| 155 | - $form = generer_action_auteur( |
|
| 156 | - 'editer_objet', |
|
| 157 | - "$objet/$id_objet", |
|
| 158 | - self(), |
|
| 159 | - $form, |
|
| 160 | - " method='post' class='submit_plongeur'" |
|
| 161 | - ); |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - if ($retour_sans_cadre) { |
|
| 166 | - return $form; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - include_spip('inc/presentation'); |
|
| 170 | - |
|
| 171 | - return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur(true); |
|
| 97 | + include_spip('inc/autoriser'); |
|
| 98 | + if (intval($id_objet) && !autoriser('modifier', $objet, $id_objet)) { |
|
| 99 | + return ''; |
|
| 100 | + } |
|
| 101 | + if (!sql_countsel('spip_rubriques')) { |
|
| 102 | + return ''; |
|
| 103 | + } |
|
| 104 | + $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc'); |
|
| 105 | + $form = $chercher_rubrique($id_parent, $objet, $restreint, ($objet == 'rubrique') ? $id_objet : 0); |
|
| 106 | + |
|
| 107 | + if ($id_parent == 0) { |
|
| 108 | + $logo = 'racine-24.png'; |
|
| 109 | + } elseif ($id_secteur == $id_parent) { |
|
| 110 | + $logo = 'secteur-24.png'; |
|
| 111 | + } else { |
|
| 112 | + $logo = 'rubrique-24.png'; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $confirm = ''; |
|
| 116 | + if ($objet == 'rubrique') { |
|
| 117 | + // si c'est une rubrique-secteur contenant des breves, demander la |
|
| 118 | + // confirmation du deplacement |
|
| 119 | + $contient_breves = sql_countsel('spip_breves', 'id_rubrique=' . intval($id_objet)); |
|
| 120 | + |
|
| 121 | + if ($contient_breves > 0) { |
|
| 122 | + $scb = ($contient_breves > 1 ? 's' : ''); |
|
| 123 | + $scb = _T( |
|
| 124 | + 'avis_deplacement_rubrique', |
|
| 125 | + [ |
|
| 126 | + 'contient_breves' => $contient_breves, |
|
| 127 | + 'scb' => $scb |
|
| 128 | + ] |
|
| 129 | + ); |
|
| 130 | + $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
|
| 131 | + . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
|
| 132 | + . $scb . |
|
| 133 | + "</label></div></div>\n"; |
|
| 134 | + } else { |
|
| 135 | + $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + $form .= $confirm; |
|
| 139 | + if ($actionable) { |
|
| 140 | + if (strpos($form, '<select') !== false) { |
|
| 141 | + $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 142 | + . '<input class="fondo submit btn" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 143 | + . '</div>'; |
|
| 144 | + } |
|
| 145 | + $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 146 | + if ($action = charger_fonction("editer_$objet", 'action', true)) { |
|
| 147 | + $form = generer_action_auteur( |
|
| 148 | + "editer_$objet", |
|
| 149 | + $id_objet, |
|
| 150 | + self(), |
|
| 151 | + $form, |
|
| 152 | + " method='post' class='submit_plongeur'" |
|
| 153 | + ); |
|
| 154 | + } else { |
|
| 155 | + $form = generer_action_auteur( |
|
| 156 | + 'editer_objet', |
|
| 157 | + "$objet/$id_objet", |
|
| 158 | + self(), |
|
| 159 | + $form, |
|
| 160 | + " method='post' class='submit_plongeur'" |
|
| 161 | + ); |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + if ($retour_sans_cadre) { |
|
| 166 | + return $form; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + include_spip('inc/presentation'); |
|
| 170 | + |
|
| 171 | + return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur(true); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -182,24 +182,24 @@ discard block |
||
| 182 | 182 | * @return bool |
| 183 | 183 | */ |
| 184 | 184 | function avoir_visiteurs($past = false, $accepter = true) { |
| 185 | - if ($GLOBALS['meta']['forums_publics'] == 'abo') { |
|
| 186 | - return true; |
|
| 187 | - } |
|
| 188 | - if ($accepter and $GLOBALS['meta']['accepter_visiteurs'] <> 'non') { |
|
| 189 | - return true; |
|
| 190 | - } |
|
| 191 | - if (sql_countsel('spip_articles', "accepter_forum='abo'")) { |
|
| 192 | - return true; |
|
| 193 | - } |
|
| 194 | - if (!$past) { |
|
| 195 | - return false; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - return sql_countsel( |
|
| 199 | - 'spip_auteurs', |
|
| 200 | - "statut NOT IN ('0minirezo','1comite', '5poubelle') |
|
| 185 | + if ($GLOBALS['meta']['forums_publics'] == 'abo') { |
|
| 186 | + return true; |
|
| 187 | + } |
|
| 188 | + if ($accepter and $GLOBALS['meta']['accepter_visiteurs'] <> 'non') { |
|
| 189 | + return true; |
|
| 190 | + } |
|
| 191 | + if (sql_countsel('spip_articles', "accepter_forum='abo'")) { |
|
| 192 | + return true; |
|
| 193 | + } |
|
| 194 | + if (!$past) { |
|
| 195 | + return false; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + return sql_countsel( |
|
| 199 | + 'spip_auteurs', |
|
| 200 | + "statut NOT IN ('0minirezo','1comite', '5poubelle') |
|
| 201 | 201 | AND (statut<>'nouveau' OR prefs NOT IN ('0minirezo','1comite', '5poubelle'))" |
| 202 | - ); |
|
| 202 | + ); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -215,18 +215,18 @@ discard block |
||
| 215 | 215 | * @return array |
| 216 | 216 | */ |
| 217 | 217 | function statuts_articles_visibles($statut_auteur) { |
| 218 | - static $auth = []; |
|
| 219 | - if (!isset($auth[$statut_auteur])) { |
|
| 220 | - $auth[$statut_auteur] = []; |
|
| 221 | - $statuts = array_column(sql_allfetsel('distinct statut', 'spip_articles'), 'statut'); |
|
| 222 | - foreach ($statuts as $s) { |
|
| 223 | - if (autoriser('voir', 'article', 0, ['statut' => $statut_auteur], ['statut' => $s])) { |
|
| 224 | - $auth[$statut_auteur][] = $s; |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - return $auth[$statut_auteur]; |
|
| 218 | + static $auth = []; |
|
| 219 | + if (!isset($auth[$statut_auteur])) { |
|
| 220 | + $auth[$statut_auteur] = []; |
|
| 221 | + $statuts = array_column(sql_allfetsel('distinct statut', 'spip_articles'), 'statut'); |
|
| 222 | + foreach ($statuts as $s) { |
|
| 223 | + if (autoriser('voir', 'article', 0, ['statut' => $statut_auteur], ['statut' => $s])) { |
|
| 224 | + $auth[$statut_auteur][] = $s; |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + return $auth[$statut_auteur]; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -240,38 +240,38 @@ discard block |
||
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | 242 | function traduire_statut_auteur($statut, $attente = '') { |
| 243 | - $plus = ''; |
|
| 244 | - if ($statut == 'nouveau') { |
|
| 245 | - if ($attente) { |
|
| 246 | - $statut = $attente; |
|
| 247 | - $plus = ' (' . _T('info_statut_auteur_a_confirmer') . ')'; |
|
| 248 | - } else { |
|
| 249 | - return _T('info_statut_auteur_a_confirmer'); |
|
| 250 | - } |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - $recom = [ |
|
| 254 | - 'info_administrateurs' => _T('item_administrateur_2'), |
|
| 255 | - 'info_redacteurs' => _T('intem_redacteur'), |
|
| 256 | - 'info_visiteurs' => _T('item_visiteur'), |
|
| 257 | - '5poubelle' => _T('texte_statut_poubelle'), // bouh |
|
| 258 | - ]; |
|
| 259 | - if (isset($recom[$statut])) { |
|
| 260 | - return $recom[$statut] . $plus; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - // retrouver directement par le statut sinon |
|
| 264 | - if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
|
| 265 | - if (isset($recom[$t])) { |
|
| 266 | - return $recom[$t] . $plus; |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - return _T($t) . $plus; |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - // si on a pas reussi a le traduire, retournons la chaine telle quelle |
|
| 273 | - // c'est toujours plus informatif que rien du tout |
|
| 274 | - return $statut; |
|
| 243 | + $plus = ''; |
|
| 244 | + if ($statut == 'nouveau') { |
|
| 245 | + if ($attente) { |
|
| 246 | + $statut = $attente; |
|
| 247 | + $plus = ' (' . _T('info_statut_auteur_a_confirmer') . ')'; |
|
| 248 | + } else { |
|
| 249 | + return _T('info_statut_auteur_a_confirmer'); |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + $recom = [ |
|
| 254 | + 'info_administrateurs' => _T('item_administrateur_2'), |
|
| 255 | + 'info_redacteurs' => _T('intem_redacteur'), |
|
| 256 | + 'info_visiteurs' => _T('item_visiteur'), |
|
| 257 | + '5poubelle' => _T('texte_statut_poubelle'), // bouh |
|
| 258 | + ]; |
|
| 259 | + if (isset($recom[$statut])) { |
|
| 260 | + return $recom[$statut] . $plus; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + // retrouver directement par le statut sinon |
|
| 264 | + if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
|
| 265 | + if (isset($recom[$t])) { |
|
| 266 | + return $recom[$t] . $plus; |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + return _T($t) . $plus; |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + // si on a pas reussi a le traduire, retournons la chaine telle quelle |
|
| 273 | + // c'est toujours plus informatif que rien du tout |
|
| 274 | + return $statut; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -282,28 +282,28 @@ discard block |
||
| 282 | 282 | * @return string |
| 283 | 283 | */ |
| 284 | 284 | function afficher_qui_edite($id_objet, $objet) { |
| 285 | - static $qui = []; |
|
| 286 | - if (isset($qui[$objet][$id_objet])) { |
|
| 287 | - return $qui[$objet][$id_objet]; |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - if ($GLOBALS['meta']['articles_modif'] == 'non') { |
|
| 291 | - return $qui[$objet][$id_objet] = ''; |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - include_spip('inc/drapeau_edition'); |
|
| 295 | - $modif = mention_qui_edite($id_objet, $objet); |
|
| 296 | - if (!$modif) { |
|
| 297 | - return $qui[$objet][$id_objet] = ''; |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - include_spip('base/objets'); |
|
| 301 | - $infos = lister_tables_objets_sql(table_objet_sql($objet)); |
|
| 302 | - if (isset($infos['texte_signale_edition'])) { |
|
| 303 | - return $qui[$objet][$id_objet] = _T($infos['texte_signale_edition'], $modif); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - return $qui[$objet][$id_objet] = _T('info_qui_edite', $modif); |
|
| 285 | + static $qui = []; |
|
| 286 | + if (isset($qui[$objet][$id_objet])) { |
|
| 287 | + return $qui[$objet][$id_objet]; |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + if ($GLOBALS['meta']['articles_modif'] == 'non') { |
|
| 291 | + return $qui[$objet][$id_objet] = ''; |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + include_spip('inc/drapeau_edition'); |
|
| 295 | + $modif = mention_qui_edite($id_objet, $objet); |
|
| 296 | + if (!$modif) { |
|
| 297 | + return $qui[$objet][$id_objet] = ''; |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + include_spip('base/objets'); |
|
| 301 | + $infos = lister_tables_objets_sql(table_objet_sql($objet)); |
|
| 302 | + if (isset($infos['texte_signale_edition'])) { |
|
| 303 | + return $qui[$objet][$id_objet] = _T($infos['texte_signale_edition'], $modif); |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + return $qui[$objet][$id_objet] = _T('info_qui_edite', $modif); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -321,57 +321,57 @@ discard block |
||
| 321 | 321 | * @return array |
| 322 | 322 | */ |
| 323 | 323 | function auteurs_lister_statuts($quoi = 'tous', $en_base = true) { |
| 324 | - if (!defined('AUTEURS_MIN_REDAC')) { |
|
| 325 | - define('AUTEURS_MIN_REDAC', '0minirezo,1comite,5poubelle'); |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - switch ($quoi) { |
|
| 329 | - case 'redacteurs': |
|
| 330 | - $statut = AUTEURS_MIN_REDAC; |
|
| 331 | - $statut = explode(',', $statut); |
|
| 332 | - if ($en_base) { |
|
| 333 | - $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 334 | - $retire = array_diff($statut, $check); |
|
| 335 | - $statut = array_diff($statut, $retire); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - return array_unique($statut); |
|
| 339 | - break; |
|
| 340 | - case 'visiteurs': |
|
| 341 | - $statut = []; |
|
| 342 | - $exclus = AUTEURS_MIN_REDAC; |
|
| 343 | - $exclus = explode(',', $exclus); |
|
| 344 | - if (!$en_base) { |
|
| 345 | - // prendre aussi les statuts de la table des status qui ne sont pas dans le define |
|
| 346 | - $statut = array_diff(array_values($GLOBALS['liste_des_statuts']), $exclus); |
|
| 347 | - } |
|
| 348 | - $s_complement = array_column( |
|
| 349 | - sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $exclus, 'NOT')), |
|
| 350 | - 'statut' |
|
| 351 | - ); |
|
| 352 | - |
|
| 353 | - return array_unique(array_merge($statut, $s_complement)); |
|
| 354 | - break; |
|
| 355 | - default: |
|
| 356 | - case 'tous': |
|
| 357 | - $statut = array_values($GLOBALS['liste_des_statuts']); |
|
| 358 | - $s_complement = array_column( |
|
| 359 | - sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut, 'NOT')), |
|
| 360 | - 'statut' |
|
| 361 | - ); |
|
| 362 | - $statut = array_merge($statut, $s_complement); |
|
| 363 | - if ($en_base) { |
|
| 364 | - $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 365 | - $retire = array_diff($statut, $check); |
|
| 366 | - $statut = array_diff($statut, $retire); |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - return array_unique($statut); |
|
| 370 | - break; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - // on arrive jamais ici |
|
| 374 | - return array_values($GLOBALS['liste_des_statuts']); |
|
| 324 | + if (!defined('AUTEURS_MIN_REDAC')) { |
|
| 325 | + define('AUTEURS_MIN_REDAC', '0minirezo,1comite,5poubelle'); |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + switch ($quoi) { |
|
| 329 | + case 'redacteurs': |
|
| 330 | + $statut = AUTEURS_MIN_REDAC; |
|
| 331 | + $statut = explode(',', $statut); |
|
| 332 | + if ($en_base) { |
|
| 333 | + $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 334 | + $retire = array_diff($statut, $check); |
|
| 335 | + $statut = array_diff($statut, $retire); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + return array_unique($statut); |
|
| 339 | + break; |
|
| 340 | + case 'visiteurs': |
|
| 341 | + $statut = []; |
|
| 342 | + $exclus = AUTEURS_MIN_REDAC; |
|
| 343 | + $exclus = explode(',', $exclus); |
|
| 344 | + if (!$en_base) { |
|
| 345 | + // prendre aussi les statuts de la table des status qui ne sont pas dans le define |
|
| 346 | + $statut = array_diff(array_values($GLOBALS['liste_des_statuts']), $exclus); |
|
| 347 | + } |
|
| 348 | + $s_complement = array_column( |
|
| 349 | + sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $exclus, 'NOT')), |
|
| 350 | + 'statut' |
|
| 351 | + ); |
|
| 352 | + |
|
| 353 | + return array_unique(array_merge($statut, $s_complement)); |
|
| 354 | + break; |
|
| 355 | + default: |
|
| 356 | + case 'tous': |
|
| 357 | + $statut = array_values($GLOBALS['liste_des_statuts']); |
|
| 358 | + $s_complement = array_column( |
|
| 359 | + sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut, 'NOT')), |
|
| 360 | + 'statut' |
|
| 361 | + ); |
|
| 362 | + $statut = array_merge($statut, $s_complement); |
|
| 363 | + if ($en_base) { |
|
| 364 | + $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 365 | + $retire = array_diff($statut, $check); |
|
| 366 | + $statut = array_diff($statut, $retire); |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + return array_unique($statut); |
|
| 370 | + break; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + // on arrive jamais ici |
|
| 374 | + return array_values($GLOBALS['liste_des_statuts']); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -387,28 +387,28 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | function trouver_rubrique_creer_objet($id_rubrique, $objet) { |
| 389 | 389 | |
| 390 | - if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
|
| 391 | - $in = !count($GLOBALS['connect_id_rubrique']) |
|
| 392 | - ? '' |
|
| 393 | - : (' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 394 | - |
|
| 395 | - // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
|
| 396 | - if ($objet == 'rubrique') { |
|
| 397 | - $id_rubrique = 0; |
|
| 398 | - } else { |
|
| 399 | - $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', "id_parent=0$in", '', 'id_rubrique DESC', 1); |
|
| 400 | - } |
|
| 401 | - |
|
| 402 | - if (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique)) { |
|
| 403 | - // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
|
| 404 | - $res = sql_select('id_rubrique', 'spip_rubriques', 'id_parent=0'); |
|
| 405 | - while (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique) && $row_rub = sql_fetch($res)) { |
|
| 406 | - $id_rubrique = $row_rub['id_rubrique']; |
|
| 407 | - } |
|
| 408 | - } |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - return $id_rubrique; |
|
| 390 | + if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
|
| 391 | + $in = !count($GLOBALS['connect_id_rubrique']) |
|
| 392 | + ? '' |
|
| 393 | + : (' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 394 | + |
|
| 395 | + // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
|
| 396 | + if ($objet == 'rubrique') { |
|
| 397 | + $id_rubrique = 0; |
|
| 398 | + } else { |
|
| 399 | + $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', "id_parent=0$in", '', 'id_rubrique DESC', 1); |
|
| 400 | + } |
|
| 401 | + |
|
| 402 | + if (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique)) { |
|
| 403 | + // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
|
| 404 | + $res = sql_select('id_rubrique', 'spip_rubriques', 'id_parent=0'); |
|
| 405 | + while (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique) && $row_rub = sql_fetch($res)) { |
|
| 406 | + $id_rubrique = $row_rub['id_rubrique']; |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + return $id_rubrique; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -419,12 +419,12 @@ discard block |
||
| 419 | 419 | * @return string |
| 420 | 420 | */ |
| 421 | 421 | function lien_article_virtuel($virtuel) { |
| 422 | - include_spip('inc/lien'); |
|
| 423 | - if (!$virtuel = virtuel_redirige($virtuel)) { |
|
| 424 | - return ''; |
|
| 425 | - } |
|
| 422 | + include_spip('inc/lien'); |
|
| 423 | + if (!$virtuel = virtuel_redirige($virtuel)) { |
|
| 424 | + return ''; |
|
| 425 | + } |
|
| 426 | 426 | |
| 427 | - return propre('[->' . $virtuel . ']'); |
|
| 427 | + return propre('[->' . $virtuel . ']'); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | |
@@ -447,12 +447,12 @@ discard block |
||
| 447 | 447 | * Code HTML du lien |
| 448 | 448 | */ |
| 449 | 449 | function bouton_spip_rss($op, $args = [], $lang = '', $title = 'RSS') { |
| 450 | - include_spip('inc/acces'); |
|
| 451 | - $clic = http_img_pack('rss-16.png', 'RSS', '', $title); |
|
| 452 | - $args = param_low_sec($op, $args, $lang, 'rss'); |
|
| 453 | - $url = generer_url_public('rss', $args); |
|
| 450 | + include_spip('inc/acces'); |
|
| 451 | + $clic = http_img_pack('rss-16.png', 'RSS', '', $title); |
|
| 452 | + $args = param_low_sec($op, $args, $lang, 'rss'); |
|
| 453 | + $url = generer_url_public('rss', $args); |
|
| 454 | 454 | |
| 455 | - return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 455 | + return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | |
@@ -464,74 +464,74 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | function alertes_auteur($id_auteur) { |
| 466 | 466 | |
| 467 | - $alertes = []; |
|
| 468 | - |
|
| 469 | - if ( |
|
| 470 | - isset($GLOBALS['meta']['message_crash_tables']) |
|
| 471 | - and autoriser('detruire', null, null, $id_auteur) |
|
| 472 | - ) { |
|
| 473 | - include_spip('genie/maintenance'); |
|
| 474 | - if ($msg = message_crash_tables()) { |
|
| 475 | - $alertes[] = $msg; |
|
| 476 | - } |
|
| 477 | - } |
|
| 478 | - |
|
| 479 | - if ( |
|
| 480 | - isset($GLOBALS['meta']['message_crash_plugins']) |
|
| 481 | - and $GLOBALS['meta']['message_crash_plugins'] |
|
| 482 | - and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 483 | - and is_array($msg = unserialize($GLOBALS['meta']['message_crash_plugins'])) |
|
| 484 | - ) { |
|
| 485 | - $msg = implode(', ', array_map('joli_repertoire', array_keys($msg))); |
|
| 486 | - $alertes[] = _T('plugins_erreur', ['plugins' => $msg]); |
|
| 487 | - } |
|
| 488 | - |
|
| 489 | - $a = isset($GLOBALS['meta']['message_alertes_auteurs']) ? $GLOBALS['meta']['message_alertes_auteurs'] : ''; |
|
| 490 | - if ( |
|
| 491 | - $a |
|
| 492 | - and is_array($a = unserialize($a)) |
|
| 493 | - and count($a) |
|
| 494 | - ) { |
|
| 495 | - $update = false; |
|
| 496 | - if (isset($a[$GLOBALS['visiteur_session']['statut']])) { |
|
| 497 | - $alertes = array_merge($alertes, $a[$GLOBALS['visiteur_session']['statut']]); |
|
| 498 | - unset($a[$GLOBALS['visiteur_session']['statut']]); |
|
| 499 | - $update = true; |
|
| 500 | - } |
|
| 501 | - if (isset($a[''])) { |
|
| 502 | - $alertes = array_merge($alertes, $a['']); |
|
| 503 | - unset($a['']); |
|
| 504 | - $update = true; |
|
| 505 | - } |
|
| 506 | - if ($update) { |
|
| 507 | - ecrire_meta('message_alertes_auteurs', serialize($a)); |
|
| 508 | - } |
|
| 509 | - } |
|
| 510 | - |
|
| 511 | - if ( |
|
| 512 | - isset($GLOBALS['meta']['plugin_erreur_activation']) |
|
| 513 | - and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 514 | - ) { |
|
| 515 | - include_spip('inc/plugin'); |
|
| 516 | - $alertes[] = plugin_donne_erreurs(); |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - $alertes = pipeline( |
|
| 520 | - 'alertes_auteur', |
|
| 521 | - [ |
|
| 522 | - 'args' => [ |
|
| 523 | - 'id_auteur' => $id_auteur, |
|
| 524 | - 'exec' => _request('exec'), |
|
| 525 | - ], |
|
| 526 | - 'data' => $alertes |
|
| 527 | - ] |
|
| 528 | - ); |
|
| 529 | - |
|
| 530 | - if ($alertes = array_filter($alertes)) { |
|
| 531 | - return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 532 | - join(' | ', $alertes) |
|
| 533 | - . '</div></div>'; |
|
| 534 | - } |
|
| 467 | + $alertes = []; |
|
| 468 | + |
|
| 469 | + if ( |
|
| 470 | + isset($GLOBALS['meta']['message_crash_tables']) |
|
| 471 | + and autoriser('detruire', null, null, $id_auteur) |
|
| 472 | + ) { |
|
| 473 | + include_spip('genie/maintenance'); |
|
| 474 | + if ($msg = message_crash_tables()) { |
|
| 475 | + $alertes[] = $msg; |
|
| 476 | + } |
|
| 477 | + } |
|
| 478 | + |
|
| 479 | + if ( |
|
| 480 | + isset($GLOBALS['meta']['message_crash_plugins']) |
|
| 481 | + and $GLOBALS['meta']['message_crash_plugins'] |
|
| 482 | + and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 483 | + and is_array($msg = unserialize($GLOBALS['meta']['message_crash_plugins'])) |
|
| 484 | + ) { |
|
| 485 | + $msg = implode(', ', array_map('joli_repertoire', array_keys($msg))); |
|
| 486 | + $alertes[] = _T('plugins_erreur', ['plugins' => $msg]); |
|
| 487 | + } |
|
| 488 | + |
|
| 489 | + $a = isset($GLOBALS['meta']['message_alertes_auteurs']) ? $GLOBALS['meta']['message_alertes_auteurs'] : ''; |
|
| 490 | + if ( |
|
| 491 | + $a |
|
| 492 | + and is_array($a = unserialize($a)) |
|
| 493 | + and count($a) |
|
| 494 | + ) { |
|
| 495 | + $update = false; |
|
| 496 | + if (isset($a[$GLOBALS['visiteur_session']['statut']])) { |
|
| 497 | + $alertes = array_merge($alertes, $a[$GLOBALS['visiteur_session']['statut']]); |
|
| 498 | + unset($a[$GLOBALS['visiteur_session']['statut']]); |
|
| 499 | + $update = true; |
|
| 500 | + } |
|
| 501 | + if (isset($a[''])) { |
|
| 502 | + $alertes = array_merge($alertes, $a['']); |
|
| 503 | + unset($a['']); |
|
| 504 | + $update = true; |
|
| 505 | + } |
|
| 506 | + if ($update) { |
|
| 507 | + ecrire_meta('message_alertes_auteurs', serialize($a)); |
|
| 508 | + } |
|
| 509 | + } |
|
| 510 | + |
|
| 511 | + if ( |
|
| 512 | + isset($GLOBALS['meta']['plugin_erreur_activation']) |
|
| 513 | + and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 514 | + ) { |
|
| 515 | + include_spip('inc/plugin'); |
|
| 516 | + $alertes[] = plugin_donne_erreurs(); |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + $alertes = pipeline( |
|
| 520 | + 'alertes_auteur', |
|
| 521 | + [ |
|
| 522 | + 'args' => [ |
|
| 523 | + 'id_auteur' => $id_auteur, |
|
| 524 | + 'exec' => _request('exec'), |
|
| 525 | + ], |
|
| 526 | + 'data' => $alertes |
|
| 527 | + ] |
|
| 528 | + ); |
|
| 529 | + |
|
| 530 | + if ($alertes = array_filter($alertes)) { |
|
| 531 | + return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 532 | + join(' | ', $alertes) |
|
| 533 | + . '</div></div>'; |
|
| 534 | + } |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | /** |
@@ -541,9 +541,9 @@ discard block |
||
| 541 | 541 | * @return string |
| 542 | 542 | */ |
| 543 | 543 | function filtre_afficher_enfant_rub_dist($id_rubrique) { |
| 544 | - include_spip('inc/presenter_enfants'); |
|
| 544 | + include_spip('inc/presenter_enfants'); |
|
| 545 | 545 | |
| 546 | - return afficher_enfant_rub(intval($id_rubrique)); |
|
| 546 | + return afficher_enfant_rub(intval($id_rubrique)); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
@@ -561,15 +561,15 @@ discard block |
||
| 561 | 561 | * @return string |
| 562 | 562 | */ |
| 563 | 563 | function afficher_plus_info($lien, $titre = '+', $titre_lien = '') { |
| 564 | - $titre = attribut_html($titre); |
|
| 565 | - $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 566 | - http_img_pack('information-16.png', $titre) . '</a>'; |
|
| 567 | - |
|
| 568 | - if (!$titre_lien) { |
|
| 569 | - return $icone; |
|
| 570 | - } else { |
|
| 571 | - return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 572 | - } |
|
| 564 | + $titre = attribut_html($titre); |
|
| 565 | + $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 566 | + http_img_pack('information-16.png', $titre) . '</a>'; |
|
| 567 | + |
|
| 568 | + if (!$titre_lien) { |
|
| 569 | + return $icone; |
|
| 570 | + } else { |
|
| 571 | + return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 572 | + } |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | |
@@ -588,17 +588,17 @@ discard block |
||
| 588 | 588 | * @return array |
| 589 | 589 | */ |
| 590 | 590 | function lister_objets_lies($objet_source, $objet, $id_objet, $objet_lien) { |
| 591 | - $res = lister_objets_liens($objet_source, $objet, $id_objet, $objet_lien); |
|
| 592 | - if (!count($res)) { |
|
| 593 | - return []; |
|
| 594 | - } |
|
| 595 | - $r = reset($res); |
|
| 596 | - if (isset($r['rang_lien'])) { |
|
| 597 | - $l = array_column($res, 'rang_lien', $objet_source); |
|
| 598 | - asort($l); |
|
| 599 | - $l = array_keys($l); |
|
| 600 | - } else { |
|
| 601 | - $l = array_column($res, $objet_source); |
|
| 602 | - } |
|
| 603 | - return $l; |
|
| 591 | + $res = lister_objets_liens($objet_source, $objet, $id_objet, $objet_lien); |
|
| 592 | + if (!count($res)) { |
|
| 593 | + return []; |
|
| 594 | + } |
|
| 595 | + $r = reset($res); |
|
| 596 | + if (isset($r['rang_lien'])) { |
|
| 597 | + $l = array_column($res, 'rang_lien', $objet_source); |
|
| 598 | + asort($l); |
|
| 599 | + $l = array_keys($l); |
|
| 600 | + } else { |
|
| 601 | + $l = array_column($res, $objet_source); |
|
| 602 | + } |
|
| 603 | + return $l; |
|
| 604 | 604 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if ($objet == 'rubrique') { |
| 117 | 117 | // si c'est une rubrique-secteur contenant des breves, demander la |
| 118 | 118 | // confirmation du deplacement |
| 119 | - $contient_breves = sql_countsel('spip_breves', 'id_rubrique=' . intval($id_objet)); |
|
| 119 | + $contient_breves = sql_countsel('spip_breves', 'id_rubrique='.intval($id_objet)); |
|
| 120 | 120 | |
| 121 | 121 | if ($contient_breves > 0) { |
| 122 | 122 | $scb = ($contient_breves > 1 ? 's' : ''); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | ); |
| 130 | 130 | $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
| 131 | 131 | . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
| 132 | - . $scb . |
|
| 132 | + . $scb. |
|
| 133 | 133 | "</label></div></div>\n"; |
| 134 | 134 | } else { |
| 135 | 135 | $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | $form .= $confirm; |
| 139 | 139 | if ($actionable) { |
| 140 | 140 | if (strpos($form, '<select') !== false) { |
| 141 | - $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 142 | - . '<input class="fondo submit btn" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 141 | + $form .= "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 142 | + . '<input class="fondo submit btn" type="submit" value="'._T('bouton_choisir').'"/>' |
|
| 143 | 143 | . '</div>'; |
| 144 | 144 | } |
| 145 | - $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 145 | + $form = "<input type='hidden' name='editer_$objet' value='oui' />\n".$form; |
|
| 146 | 146 | if ($action = charger_fonction("editer_$objet", 'action', true)) { |
| 147 | 147 | $form = generer_action_auteur( |
| 148 | 148 | "editer_$objet", |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | include_spip('inc/presentation'); |
| 170 | 170 | |
| 171 | - return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur(true); |
|
| 171 | + return debut_cadre_couleur($logo, true, '', $titre).$form.fin_cadre_couleur(true); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | if ($statut == 'nouveau') { |
| 245 | 245 | if ($attente) { |
| 246 | 246 | $statut = $attente; |
| 247 | - $plus = ' (' . _T('info_statut_auteur_a_confirmer') . ')'; |
|
| 247 | + $plus = ' ('._T('info_statut_auteur_a_confirmer').')'; |
|
| 248 | 248 | } else { |
| 249 | 249 | return _T('info_statut_auteur_a_confirmer'); |
| 250 | 250 | } |
@@ -257,16 +257,16 @@ discard block |
||
| 257 | 257 | '5poubelle' => _T('texte_statut_poubelle'), // bouh |
| 258 | 258 | ]; |
| 259 | 259 | if (isset($recom[$statut])) { |
| 260 | - return $recom[$statut] . $plus; |
|
| 260 | + return $recom[$statut].$plus; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // retrouver directement par le statut sinon |
| 264 | 264 | if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
| 265 | 265 | if (isset($recom[$t])) { |
| 266 | - return $recom[$t] . $plus; |
|
| 266 | + return $recom[$t].$plus; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return _T($t) . $plus; |
|
| 269 | + return _T($t).$plus; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // si on a pas reussi a le traduire, retournons la chaine telle quelle |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
| 391 | 391 | $in = !count($GLOBALS['connect_id_rubrique']) |
| 392 | 392 | ? '' |
| 393 | - : (' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 393 | + : (' AND '.sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 394 | 394 | |
| 395 | 395 | // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
| 396 | 396 | if ($objet == 'rubrique') { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | return ''; |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - return propre('[->' . $virtuel . ']'); |
|
| 427 | + return propre('[->'.$virtuel.']'); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $args = param_low_sec($op, $args, $lang, 'rss'); |
| 453 | 453 | $url = generer_url_public('rss', $args); |
| 454 | 454 | |
| 455 | - return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 455 | + return "<a style='float: ".$GLOBALS['spip_lang_right'].";' href='$url'>$clic</a>"; |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | ); |
| 529 | 529 | |
| 530 | 530 | if ($alertes = array_filter($alertes)) { |
| 531 | - return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 531 | + return "<div class='wrap-messages-alertes'><div class='messages-alertes'>". |
|
| 532 | 532 | join(' | ', $alertes) |
| 533 | 533 | . '</div></div>'; |
| 534 | 534 | } |
@@ -562,13 +562,13 @@ discard block |
||
| 562 | 562 | */ |
| 563 | 563 | function afficher_plus_info($lien, $titre = '+', $titre_lien = '') { |
| 564 | 564 | $titre = attribut_html($titre); |
| 565 | - $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 566 | - http_img_pack('information-16.png', $titre) . '</a>'; |
|
| 565 | + $icone = "\n<a href='$lien' title='$titre' class='plus_info'>". |
|
| 566 | + http_img_pack('information-16.png', $titre).'</a>'; |
|
| 567 | 567 | |
| 568 | 568 | if (!$titre_lien) { |
| 569 | 569 | return $icone; |
| 570 | 570 | } else { |
| 571 | - return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 571 | + return $icone."\n<a href='$lien'>$titre_lien</a>"; |
|
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/filtres'); |
@@ -46,56 +46,56 @@ discard block |
||
| 46 | 46 | **/ |
| 47 | 47 | function inc_selectionner_dist($sel, $idom = '', $exclus = 0, $aff_racine = false, $recur = true, $do = 'aff') { |
| 48 | 48 | |
| 49 | - if ($recur) { |
|
| 50 | - $recur = mini_hier($sel); |
|
| 51 | - } else { |
|
| 52 | - $sel = 0; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - if ($aff_racine) { |
|
| 56 | - $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
|
| 57 | - $idom3 = $idom . '_selection'; |
|
| 58 | - |
|
| 59 | - $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;"; |
|
| 60 | - |
|
| 61 | - $ondbClick = strtr( |
|
| 62 | - str_replace( |
|
| 63 | - "'", |
|
| 64 | - '’', |
|
| 65 | - str_replace( |
|
| 66 | - '"', |
|
| 67 | - '"', |
|
| 68 | - textebrut(_T('info_racine_site')) |
|
| 69 | - ) |
|
| 70 | - ), |
|
| 71 | - "\n\r", |
|
| 72 | - ' ' |
|
| 73 | - ); |
|
| 74 | - |
|
| 75 | - $js_func = $do . '_selection_titre'; |
|
| 76 | - $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');"; |
|
| 77 | - |
|
| 78 | - $aff_racine = "<div class='petit-item petite-racine item'>" |
|
| 79 | - . "<a href='#'" |
|
| 80 | - . 'onclick="' |
|
| 81 | - . $onClick |
|
| 82 | - . "\"\nondbclick=\"" |
|
| 83 | - . $ondbClick |
|
| 84 | - . $onClick |
|
| 85 | - . '">' |
|
| 86 | - . _T('info_racine_site') |
|
| 87 | - . '</a></div>'; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - $url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do"); |
|
| 91 | - |
|
| 92 | - $plonger = charger_fonction('plonger', 'inc'); |
|
| 93 | - $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do); |
|
| 94 | - |
|
| 95 | - // url completee par la fonction JS onkeypress_rechercher |
|
| 96 | - $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type="); |
|
| 97 | - |
|
| 98 | - return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init); |
|
| 49 | + if ($recur) { |
|
| 50 | + $recur = mini_hier($sel); |
|
| 51 | + } else { |
|
| 52 | + $sel = 0; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + if ($aff_racine) { |
|
| 56 | + $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
|
| 57 | + $idom3 = $idom . '_selection'; |
|
| 58 | + |
|
| 59 | + $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;"; |
|
| 60 | + |
|
| 61 | + $ondbClick = strtr( |
|
| 62 | + str_replace( |
|
| 63 | + "'", |
|
| 64 | + '’', |
|
| 65 | + str_replace( |
|
| 66 | + '"', |
|
| 67 | + '"', |
|
| 68 | + textebrut(_T('info_racine_site')) |
|
| 69 | + ) |
|
| 70 | + ), |
|
| 71 | + "\n\r", |
|
| 72 | + ' ' |
|
| 73 | + ); |
|
| 74 | + |
|
| 75 | + $js_func = $do . '_selection_titre'; |
|
| 76 | + $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');"; |
|
| 77 | + |
|
| 78 | + $aff_racine = "<div class='petit-item petite-racine item'>" |
|
| 79 | + . "<a href='#'" |
|
| 80 | + . 'onclick="' |
|
| 81 | + . $onClick |
|
| 82 | + . "\"\nondbclick=\"" |
|
| 83 | + . $ondbClick |
|
| 84 | + . $onClick |
|
| 85 | + . '">' |
|
| 86 | + . _T('info_racine_site') |
|
| 87 | + . '</a></div>'; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + $url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do"); |
|
| 91 | + |
|
| 92 | + $plonger = charger_fonction('plonger', 'inc'); |
|
| 93 | + $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do); |
|
| 94 | + |
|
| 95 | + // url completee par la fonction JS onkeypress_rechercher |
|
| 96 | + $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type="); |
|
| 97 | + |
|
| 98 | + return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,58 +113,58 @@ discard block |
||
| 113 | 113 | **/ |
| 114 | 114 | function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') { |
| 115 | 115 | |
| 116 | - $idom1 = $idom . '_champ_recherche'; |
|
| 117 | - $idom2 = $idom . '_principal'; |
|
| 118 | - $idom3 = $idom . '_selection'; |
|
| 119 | - $idom4 = $idom . '_col_1'; |
|
| 120 | - $idom5 = 'img_' . $idom4; |
|
| 121 | - $idom6 = $idom . '_fonc'; |
|
| 122 | - |
|
| 123 | - return "<div id='$idom'>" |
|
| 124 | - . "<a id='$idom6' style='visibility: hidden;'" |
|
| 125 | - . ($url_init ? "\nhref='$url_init'" : '') |
|
| 126 | - . '></a>' |
|
| 127 | - . "<div class='recherche_rapide_parent formulaire_recherche'>" |
|
| 128 | - . http_img_pack( |
|
| 129 | - 'loader.svg', |
|
| 130 | - '', |
|
| 131 | - "class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'" |
|
| 132 | - ) |
|
| 133 | - . '' |
|
| 134 | - . "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'" |
|
| 135 | - // eliminer Return car il provoque la soumission (balise unique) |
|
| 136 | - // et eliminer Tab pour la navigation au clavier |
|
| 137 | - // ce serait encore mieux de ne le faire que s'il y a encore plusieurs |
|
| 138 | - // resultats retournes par la recherche |
|
| 139 | - . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\"" |
|
| 140 | - // lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier) |
|
| 141 | - . "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value," |
|
| 142 | - // la destination de la recherche |
|
| 143 | - . "'$idom4'" |
|
| 116 | + $idom1 = $idom . '_champ_recherche'; |
|
| 117 | + $idom2 = $idom . '_principal'; |
|
| 118 | + $idom3 = $idom . '_selection'; |
|
| 119 | + $idom4 = $idom . '_col_1'; |
|
| 120 | + $idom5 = 'img_' . $idom4; |
|
| 121 | + $idom6 = $idom . '_fonc'; |
|
| 122 | + |
|
| 123 | + return "<div id='$idom'>" |
|
| 124 | + . "<a id='$idom6' style='visibility: hidden;'" |
|
| 125 | + . ($url_init ? "\nhref='$url_init'" : '') |
|
| 126 | + . '></a>' |
|
| 127 | + . "<div class='recherche_rapide_parent formulaire_recherche'>" |
|
| 128 | + . http_img_pack( |
|
| 129 | + 'loader.svg', |
|
| 130 | + '', |
|
| 131 | + "class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'" |
|
| 132 | + ) |
|
| 133 | + . '' |
|
| 134 | + . "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'" |
|
| 135 | + // eliminer Return car il provoque la soumission (balise unique) |
|
| 136 | + // et eliminer Tab pour la navigation au clavier |
|
| 137 | + // ce serait encore mieux de ne le faire que s'il y a encore plusieurs |
|
| 138 | + // resultats retournes par la recherche |
|
| 139 | + . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\"" |
|
| 140 | + // lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier) |
|
| 141 | + . "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value," |
|
| 142 | + // la destination de la recherche |
|
| 143 | + . "'$idom4'" |
|
| 144 | 144 | # . "this.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.id" |
| 145 | - . ",'" |
|
| 146 | - // l'url effectuant la recherche |
|
| 147 | - . $url |
|
| 148 | - . "'," |
|
| 149 | - // le noeud contenant un gif anime |
|
| 150 | - // . "'idom5'" |
|
| 151 | - . 'this.parentNode.previousSibling.firstChild' |
|
| 152 | - . ",'" |
|
| 153 | - // la valeur de l'attribut Name a remplir |
|
| 154 | - . $name |
|
| 155 | - . "','" |
|
| 156 | - // noeud invisible memorisant l'URL initiale (pour re-initialisation) |
|
| 157 | - . $idom6 |
|
| 158 | - . "')\"" |
|
| 159 | - . ' />' |
|
| 160 | - . "\n</div>" |
|
| 161 | - . ($racine ? "<div>$racine</div>" : '') |
|
| 162 | - . "<div id='" |
|
| 163 | - . $idom2 |
|
| 164 | - . "'><div id='$idom4'" |
|
| 165 | - . " class=''>" |
|
| 166 | - . $liste |
|
| 167 | - . "</div></div>\n<div id='$idom3'></div></div>\n"; |
|
| 145 | + . ",'" |
|
| 146 | + // l'url effectuant la recherche |
|
| 147 | + . $url |
|
| 148 | + . "'," |
|
| 149 | + // le noeud contenant un gif anime |
|
| 150 | + // . "'idom5'" |
|
| 151 | + . 'this.parentNode.previousSibling.firstChild' |
|
| 152 | + . ",'" |
|
| 153 | + // la valeur de l'attribut Name a remplir |
|
| 154 | + . $name |
|
| 155 | + . "','" |
|
| 156 | + // noeud invisible memorisant l'URL initiale (pour re-initialisation) |
|
| 157 | + . $idom6 |
|
| 158 | + . "')\"" |
|
| 159 | + . ' />' |
|
| 160 | + . "\n</div>" |
|
| 161 | + . ($racine ? "<div>$racine</div>" : '') |
|
| 162 | + . "<div id='" |
|
| 163 | + . $idom2 |
|
| 164 | + . "'><div id='$idom4'" |
|
| 165 | + . " class=''>" |
|
| 166 | + . $liste |
|
| 167 | + . "</div></div>\n<div id='$idom3'></div></div>\n"; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | **/ |
| 177 | 177 | function mini_hier($id_rubrique) { |
| 178 | 178 | |
| 179 | - $liste = $id_rubrique; |
|
| 180 | - $id_rubrique = intval($id_rubrique); |
|
| 181 | - while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) { |
|
| 182 | - $liste = $id_rubrique . ",$liste"; |
|
| 183 | - } |
|
| 179 | + $liste = $id_rubrique; |
|
| 180 | + $id_rubrique = intval($id_rubrique); |
|
| 181 | + while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) { |
|
| 182 | + $liste = $id_rubrique . ",$liste"; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - return explode(',', "0,$liste"); |
|
| 185 | + return explode(',', "0,$liste"); |
|
| 186 | 186 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if ($aff_racine) { |
| 56 | 56 | $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id="); |
| 57 | - $idom3 = $idom . '_selection'; |
|
| 57 | + $idom3 = $idom.'_selection'; |
|
| 58 | 58 | |
| 59 | 59 | $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;"; |
| 60 | 60 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | ' ' |
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | - $js_func = $do . '_selection_titre'; |
|
| 75 | + $js_func = $do.'_selection_titre'; |
|
| 76 | 76 | $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');"; |
| 77 | 77 | |
| 78 | 78 | $aff_racine = "<div class='petit-item petite-racine item'>" |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | **/ |
| 114 | 114 | function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') { |
| 115 | 115 | |
| 116 | - $idom1 = $idom . '_champ_recherche'; |
|
| 117 | - $idom2 = $idom . '_principal'; |
|
| 118 | - $idom3 = $idom . '_selection'; |
|
| 119 | - $idom4 = $idom . '_col_1'; |
|
| 120 | - $idom5 = 'img_' . $idom4; |
|
| 121 | - $idom6 = $idom . '_fonc'; |
|
| 116 | + $idom1 = $idom.'_champ_recherche'; |
|
| 117 | + $idom2 = $idom.'_principal'; |
|
| 118 | + $idom3 = $idom.'_selection'; |
|
| 119 | + $idom4 = $idom.'_col_1'; |
|
| 120 | + $idom5 = 'img_'.$idom4; |
|
| 121 | + $idom6 = $idom.'_fonc'; |
|
| 122 | 122 | |
| 123 | 123 | return "<div id='$idom'>" |
| 124 | 124 | . "<a id='$idom6' style='visibility: hidden;'" |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | . http_img_pack( |
| 129 | 129 | 'loader.svg', |
| 130 | 130 | '', |
| 131 | - "class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'" |
|
| 131 | + "class='loader' style='visibility: hidden;float:".$GLOBALS['spip_lang_right']."' id='$idom5'" |
|
| 132 | 132 | ) |
| 133 | 133 | . '' |
| 134 | - . "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'" |
|
| 134 | + . "<input style='width: 10em;float:".$GLOBALS['spip_lang_right'].";' type='text' class='text search' id='$idom1' placeholder='"._T('info_rechercher')."'" |
|
| 135 | 135 | // eliminer Return car il provoque la soumission (balise unique) |
| 136 | 136 | // et eliminer Tab pour la navigation au clavier |
| 137 | 137 | // ce serait encore mieux de ne le faire que s'il y a encore plusieurs |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $liste = $id_rubrique; |
| 180 | 180 | $id_rubrique = intval($id_rubrique); |
| 181 | - while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) { |
|
| 182 | - $liste = $id_rubrique . ",$liste"; |
|
| 181 | + while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = '.$id_rubrique)) { |
|
| 182 | + $liste = $id_rubrique.",$liste"; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return explode(',', "0,$liste"); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Notifications |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function inc_notifications_dist($quoi, $id = 0, $options = []) { |
| 35 | 35 | |
| 36 | - // charger les fichiers qui veulent ajouter des definitions |
|
| 37 | - // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ... |
|
| 38 | - pipeline('notifications', ['args' => ['quoi' => $quoi, 'id' => $id, 'options' => $options]]); |
|
| 36 | + // charger les fichiers qui veulent ajouter des definitions |
|
| 37 | + // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ... |
|
| 38 | + pipeline('notifications', ['args' => ['quoi' => $quoi, 'id' => $id, 'options' => $options]]); |
|
| 39 | 39 | |
| 40 | - if ($notification = charger_fonction($quoi, 'notifications', true)) { |
|
| 41 | - spip_log("$notification($quoi,$id" |
|
| 42 | - . ($options ? ',' . serialize($options) : '') |
|
| 43 | - . ')', 'notifications'); |
|
| 44 | - $notification($quoi, $id, $options); |
|
| 45 | - } |
|
| 40 | + if ($notification = charger_fonction($quoi, 'notifications', true)) { |
|
| 41 | + spip_log("$notification($quoi,$id" |
|
| 42 | + . ($options ? ',' . serialize($options) : '') |
|
| 43 | + . ')', 'notifications'); |
|
| 44 | + $notification($quoi, $id, $options); |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | * @param array $exclure |
| 57 | 57 | */ |
| 58 | 58 | function notifications_nettoyer_emails(&$emails, $exclure = []) { |
| 59 | - // filtrer et unifier |
|
| 60 | - $emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails)))); |
|
| 61 | - if ($exclure and count($exclure)) { |
|
| 62 | - // nettoyer les exclusions d'abord |
|
| 63 | - notifications_nettoyer_emails($exclure); |
|
| 64 | - // faire un diff |
|
| 65 | - $emails = array_diff($emails, $exclure); |
|
| 66 | - } |
|
| 59 | + // filtrer et unifier |
|
| 60 | + $emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails)))); |
|
| 61 | + if ($exclure and count($exclure)) { |
|
| 62 | + // nettoyer les exclusions d'abord |
|
| 63 | + notifications_nettoyer_emails($exclure); |
|
| 64 | + // faire un diff |
|
| 65 | + $emails = array_diff($emails, $exclure); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -78,90 +78,90 @@ discard block |
||
| 78 | 78 | * @param string $headers |
| 79 | 79 | */ |
| 80 | 80 | function notifications_envoyer_mails($emails, $texte, $sujet = '', $from = '', $headers = '') { |
| 81 | - // rien a faire si pas de texte ! |
|
| 82 | - if (!strlen($texte)) { |
|
| 83 | - return; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - // si on ne specifie qu'un email, le mettre dans un tableau |
|
| 87 | - if (!is_array($emails)) { |
|
| 88 | - $emails = explode(',', $emails); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - notifications_nettoyer_emails($emails); |
|
| 92 | - |
|
| 93 | - // tester si le mail est deja en html |
|
| 94 | - if ( |
|
| 95 | - strpos($texte, '<') !== false // eviter les tests suivants si possible |
|
| 96 | - and $ttrim = trim($texte) |
|
| 97 | - and substr($ttrim, 0, 1) == '<' |
|
| 98 | - and substr($ttrim, -1, 1) == '>' |
|
| 99 | - and stripos($ttrim, '</html>') !== false |
|
| 100 | - ) { |
|
| 101 | - if (!strlen($sujet)) { |
|
| 102 | - // dans ce cas on ruse un peu : extraire le sujet du title |
|
| 103 | - if (preg_match(',<title>(.*)</title>,Uims', $texte, $m)) { |
|
| 104 | - $sujet = $m[1]; |
|
| 105 | - } else { |
|
| 106 | - // fallback, on prend le body si on le trouve |
|
| 107 | - if (preg_match(',<body[^>]*>(.*)</body>,Uims', $texte, $m)) { |
|
| 108 | - $ttrim = $m[1]; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // et on extrait la premiere ligne de vrai texte... |
|
| 112 | - // nettoyer le html et les retours chariots |
|
| 113 | - $ttrim = textebrut($ttrim); |
|
| 114 | - $ttrim = str_replace("\r\n", "\r", $ttrim); |
|
| 115 | - $ttrim = str_replace("\r", "\n", $ttrim); |
|
| 116 | - // decouper |
|
| 117 | - $ttrim = explode("\n", trim($ttrim)); |
|
| 118 | - // extraire la premiere ligne de texte brut |
|
| 119 | - $sujet = array_shift($ttrim); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - // si besoin on ajoute le content-type dans les headers |
|
| 124 | - if (stripos($headers, 'Content-Type') === false) { |
|
| 125 | - $headers .= "Content-Type: text/html\n"; |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - // si le sujet est vide, extraire la premiere ligne du corps |
|
| 130 | - // du mail qui est donc du texte |
|
| 131 | - if (!strlen($sujet)) { |
|
| 132 | - // nettoyer un peu les retours chariots |
|
| 133 | - $texte = str_replace("\r\n", "\r", $texte); |
|
| 134 | - $texte = str_replace("\r", "\n", $texte); |
|
| 135 | - // decouper |
|
| 136 | - $texte = explode("\n", trim($texte)); |
|
| 137 | - // extraire la premiere ligne |
|
| 138 | - $sujet = array_shift($texte); |
|
| 139 | - $texte = trim(implode("\n", $texte)); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); |
|
| 143 | - foreach ($emails as $email) { |
|
| 144 | - // passer dans un pipeline qui permet un ajout eventuel |
|
| 145 | - // (url de suivi des notifications par exemple) |
|
| 146 | - $envoi = pipeline( |
|
| 147 | - 'notifications_envoyer_mails', |
|
| 148 | - [ |
|
| 149 | - 'email' => $email, |
|
| 150 | - 'sujet' => $sujet, |
|
| 151 | - 'texte' => $texte, |
|
| 152 | - 'from' => $from, |
|
| 153 | - 'headers' => $headers, |
|
| 154 | - ] |
|
| 155 | - ); |
|
| 156 | - $email = $envoi['email']; |
|
| 157 | - |
|
| 158 | - job_queue_add( |
|
| 159 | - 'envoyer_mail', |
|
| 160 | - ">$email : " . $envoi['sujet'], |
|
| 161 | - [$email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']], |
|
| 162 | - 'inc/' |
|
| 163 | - ); |
|
| 164 | - } |
|
| 81 | + // rien a faire si pas de texte ! |
|
| 82 | + if (!strlen($texte)) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + // si on ne specifie qu'un email, le mettre dans un tableau |
|
| 87 | + if (!is_array($emails)) { |
|
| 88 | + $emails = explode(',', $emails); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + notifications_nettoyer_emails($emails); |
|
| 92 | + |
|
| 93 | + // tester si le mail est deja en html |
|
| 94 | + if ( |
|
| 95 | + strpos($texte, '<') !== false // eviter les tests suivants si possible |
|
| 96 | + and $ttrim = trim($texte) |
|
| 97 | + and substr($ttrim, 0, 1) == '<' |
|
| 98 | + and substr($ttrim, -1, 1) == '>' |
|
| 99 | + and stripos($ttrim, '</html>') !== false |
|
| 100 | + ) { |
|
| 101 | + if (!strlen($sujet)) { |
|
| 102 | + // dans ce cas on ruse un peu : extraire le sujet du title |
|
| 103 | + if (preg_match(',<title>(.*)</title>,Uims', $texte, $m)) { |
|
| 104 | + $sujet = $m[1]; |
|
| 105 | + } else { |
|
| 106 | + // fallback, on prend le body si on le trouve |
|
| 107 | + if (preg_match(',<body[^>]*>(.*)</body>,Uims', $texte, $m)) { |
|
| 108 | + $ttrim = $m[1]; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + // et on extrait la premiere ligne de vrai texte... |
|
| 112 | + // nettoyer le html et les retours chariots |
|
| 113 | + $ttrim = textebrut($ttrim); |
|
| 114 | + $ttrim = str_replace("\r\n", "\r", $ttrim); |
|
| 115 | + $ttrim = str_replace("\r", "\n", $ttrim); |
|
| 116 | + // decouper |
|
| 117 | + $ttrim = explode("\n", trim($ttrim)); |
|
| 118 | + // extraire la premiere ligne de texte brut |
|
| 119 | + $sujet = array_shift($ttrim); |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + // si besoin on ajoute le content-type dans les headers |
|
| 124 | + if (stripos($headers, 'Content-Type') === false) { |
|
| 125 | + $headers .= "Content-Type: text/html\n"; |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + // si le sujet est vide, extraire la premiere ligne du corps |
|
| 130 | + // du mail qui est donc du texte |
|
| 131 | + if (!strlen($sujet)) { |
|
| 132 | + // nettoyer un peu les retours chariots |
|
| 133 | + $texte = str_replace("\r\n", "\r", $texte); |
|
| 134 | + $texte = str_replace("\r", "\n", $texte); |
|
| 135 | + // decouper |
|
| 136 | + $texte = explode("\n", trim($texte)); |
|
| 137 | + // extraire la premiere ligne |
|
| 138 | + $sujet = array_shift($texte); |
|
| 139 | + $texte = trim(implode("\n", $texte)); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); |
|
| 143 | + foreach ($emails as $email) { |
|
| 144 | + // passer dans un pipeline qui permet un ajout eventuel |
|
| 145 | + // (url de suivi des notifications par exemple) |
|
| 146 | + $envoi = pipeline( |
|
| 147 | + 'notifications_envoyer_mails', |
|
| 148 | + [ |
|
| 149 | + 'email' => $email, |
|
| 150 | + 'sujet' => $sujet, |
|
| 151 | + 'texte' => $texte, |
|
| 152 | + 'from' => $from, |
|
| 153 | + 'headers' => $headers, |
|
| 154 | + ] |
|
| 155 | + ); |
|
| 156 | + $email = $envoi['email']; |
|
| 157 | + |
|
| 158 | + job_queue_add( |
|
| 159 | + 'envoyer_mail', |
|
| 160 | + ">$email : " . $envoi['sujet'], |
|
| 161 | + [$email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']], |
|
| 162 | + 'inc/' |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | * @return string |
| 178 | 178 | */ |
| 179 | 179 | function email_notification_objet($id_objet, $type_objet, $modele) { |
| 180 | - $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email |
|
| 181 | - $id_type = id_table_objet($type_objet); |
|
| 180 | + $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email |
|
| 181 | + $id_type = id_table_objet($type_objet); |
|
| 182 | 182 | |
| 183 | - return recuperer_fond($modele, [$id_type => $id_objet, 'id' => $id_objet]); |
|
| 183 | + return recuperer_fond($modele, [$id_type => $id_objet, 'id' => $id_objet]); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return string |
| 196 | 196 | */ |
| 197 | 197 | function email_notification_article($id_article, $modele) { |
| 198 | - $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email |
|
| 198 | + $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email |
|
| 199 | 199 | |
| 200 | - return recuperer_fond($modele, ['id_article' => $id_article]); |
|
| 200 | + return recuperer_fond($modele, ['id_article' => $id_article]); |
|
| 201 | 201 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | if ($notification = charger_fonction($quoi, 'notifications', true)) { |
| 41 | 41 | spip_log("$notification($quoi,$id" |
| 42 | - . ($options ? ',' . serialize($options) : '') |
|
| 42 | + . ($options ? ','.serialize($options) : '') |
|
| 43 | 43 | . ')', 'notifications'); |
| 44 | 44 | $notification($quoi, $id, $options); |
| 45 | 45 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | job_queue_add( |
| 159 | 159 | 'envoyer_mail', |
| 160 | - ">$email : " . $envoi['sujet'], |
|
| 160 | + ">$email : ".$envoi['sujet'], |
|
| 161 | 161 | [$email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']], |
| 162 | 162 | 'inc/' |
| 163 | 163 | ); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Mail |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
@@ -31,27 +31,27 @@ discard block |
||
| 31 | 31 | * - la normalisation de la dernière adresse donnée sinon |
| 32 | 32 | **/ |
| 33 | 33 | function inc_email_valide_dist($adresses) { |
| 34 | - // eviter d'injecter n'importe quoi dans preg_match |
|
| 35 | - if (!is_string($adresses)) { |
|
| 36 | - return false; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - // Si c'est un spammeur autant arreter tout de suite |
|
| 40 | - if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) { |
|
| 41 | - spip_log("Tentative d'injection de mail : $adresses"); |
|
| 42 | - |
|
| 43 | - return false; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - foreach (explode(',', $adresses) as $v) { |
|
| 47 | - // nettoyer certains formats |
|
| 48 | - // "Marie Toto <[email protected]>" |
|
| 49 | - $adresse = trim(preg_replace(',^[^<>"]*<([^<>"]+)>$,i', "\\1", $v)); |
|
| 50 | - // RFC 822 |
|
| 51 | - if (!preg_match('#^[^()<>@,;:\\"/[:space:]]+(@([-_0-9a-z]+\.)*[-_0-9a-z]+)$#i', $adresse)) { |
|
| 52 | - return false; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - return $adresse; |
|
| 34 | + // eviter d'injecter n'importe quoi dans preg_match |
|
| 35 | + if (!is_string($adresses)) { |
|
| 36 | + return false; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + // Si c'est un spammeur autant arreter tout de suite |
|
| 40 | + if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) { |
|
| 41 | + spip_log("Tentative d'injection de mail : $adresses"); |
|
| 42 | + |
|
| 43 | + return false; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + foreach (explode(',', $adresses) as $v) { |
|
| 47 | + // nettoyer certains formats |
|
| 48 | + // "Marie Toto <[email protected]>" |
|
| 49 | + $adresse = trim(preg_replace(',^[^<>"]*<([^<>"]+)>$,i', "\\1", $v)); |
|
| 50 | + // RFC 822 |
|
| 51 | + if (!preg_match('#^[^()<>@,;:\\"/[:space:]]+(@([-_0-9a-z]+\.)*[-_0-9a-z]+)$#i', $adresse)) { |
|
| 52 | + return false; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + return $adresse; |
|
| 57 | 57 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Logos |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -37,34 +37,34 @@ discard block |
||
| 37 | 37 | **/ |
| 38 | 38 | function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on', $compat_old_logos = true) { |
| 39 | 39 | |
| 40 | - $mode = preg_replace(',\W,', '', $mode); |
|
| 41 | - if ($mode) { |
|
| 42 | - // chercher dans la base |
|
| 43 | - $mode_document = 'logo' . $mode; |
|
| 44 | - $objet = objet_type($_id_objet); |
|
| 45 | - $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode=' . sql_quote($mode_document) . ' AND L.objet=' . sql_quote($objet) . ' AND id_objet=' . intval($id)); |
|
| 46 | - if ($doc) { |
|
| 47 | - include_spip('inc/documents'); |
|
| 48 | - $d = get_spip_doc($doc['fichier']); |
|
| 49 | - return [$d, _DIR_IMG, basename($d), $doc['extension'], @filemtime($d), $doc]; |
|
| 50 | - } |
|
| 40 | + $mode = preg_replace(',\W,', '', $mode); |
|
| 41 | + if ($mode) { |
|
| 42 | + // chercher dans la base |
|
| 43 | + $mode_document = 'logo' . $mode; |
|
| 44 | + $objet = objet_type($_id_objet); |
|
| 45 | + $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode=' . sql_quote($mode_document) . ' AND L.objet=' . sql_quote($objet) . ' AND id_objet=' . intval($id)); |
|
| 46 | + if ($doc) { |
|
| 47 | + include_spip('inc/documents'); |
|
| 48 | + $d = get_spip_doc($doc['fichier']); |
|
| 49 | + return [$d, _DIR_IMG, basename($d), $doc['extension'], @filemtime($d), $doc]; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - # deprecated TODO remove |
|
| 53 | - if ($compat_old_logos) { |
|
| 54 | - # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
|
| 55 | - $type = type_du_logo($_id_objet); |
|
| 56 | - $nom = $type . $mode . intval($id); |
|
| 52 | + # deprecated TODO remove |
|
| 53 | + if ($compat_old_logos) { |
|
| 54 | + # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
|
| 55 | + $type = type_du_logo($_id_objet); |
|
| 56 | + $nom = $type . $mode . intval($id); |
|
| 57 | 57 | |
| 58 | - foreach ($GLOBALS['formats_logos'] as $format) { |
|
| 59 | - if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 60 | - return [$d, _DIR_LOGOS, $nom, $format, @filemtime($d)]; |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 58 | + foreach ($GLOBALS['formats_logos'] as $format) { |
|
| 59 | + if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 60 | + return [$d, _DIR_LOGOS, $nom, $format, @filemtime($d)]; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - # coherence de type pour servir comme filtre (formulaire_login) |
|
| 67 | - return []; |
|
| 66 | + # coherence de type pour servir comme filtre (formulaire_login) |
|
| 67 | + return []; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | * @deprecated 4.0 MAIS NE PAS SUPPRIMER CAR SERT POUR L'UPGRADE des logos et leur mise en base |
| 84 | 84 | **/ |
| 85 | 85 | function type_du_logo($_id_objet) { |
| 86 | - return isset($GLOBALS['table_logos'][$_id_objet]) |
|
| 87 | - ? $GLOBALS['table_logos'][$_id_objet] |
|
| 88 | - : objet_type(preg_replace(',^id_,', '', $_id_objet)); |
|
| 86 | + return isset($GLOBALS['table_logos'][$_id_objet]) |
|
| 87 | + ? $GLOBALS['table_logos'][$_id_objet] |
|
| 88 | + : objet_type(preg_replace(',^id_,', '', $_id_objet)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Exceptions standards (historique) |
| 92 | 92 | $GLOBALS['table_logos'] = [ |
| 93 | - 'id_article' => 'art', |
|
| 94 | - 'id_auteur' => 'aut', |
|
| 95 | - 'id_rubrique' => 'rub', |
|
| 96 | - 'id_groupe' => 'groupe', |
|
| 93 | + 'id_article' => 'art', |
|
| 94 | + 'id_auteur' => 'aut', |
|
| 95 | + 'id_rubrique' => 'rub', |
|
| 96 | + 'id_groupe' => 'groupe', |
|
| 97 | 97 | ]; |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | $mode = preg_replace(',\W,', '', $mode); |
| 41 | 41 | if ($mode) { |
| 42 | 42 | // chercher dans la base |
| 43 | - $mode_document = 'logo' . $mode; |
|
| 43 | + $mode_document = 'logo'.$mode; |
|
| 44 | 44 | $objet = objet_type($_id_objet); |
| 45 | - $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode=' . sql_quote($mode_document) . ' AND L.objet=' . sql_quote($objet) . ' AND id_objet=' . intval($id)); |
|
| 45 | + $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode='.sql_quote($mode_document).' AND L.objet='.sql_quote($objet).' AND id_objet='.intval($id)); |
|
| 46 | 46 | if ($doc) { |
| 47 | 47 | include_spip('inc/documents'); |
| 48 | 48 | $d = get_spip_doc($doc['fichier']); |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | if ($compat_old_logos) { |
| 54 | 54 | # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
| 55 | 55 | $type = type_du_logo($_id_objet); |
| 56 | - $nom = $type . $mode . intval($id); |
|
| 56 | + $nom = $type.$mode.intval($id); |
|
| 57 | 57 | |
| 58 | 58 | foreach ($GLOBALS['formats_logos'] as $format) { |
| 59 | - if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 59 | + if (@file_exists($d = (_DIR_LOGOS.$nom.'.'.$format))) { |
|
| 60 | 60 | return [$d, _DIR_LOGOS, $nom, $format, @filemtime($d)]; |
| 61 | 61 | } |
| 62 | 62 | } |