@@ -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", |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | 'hi' => "हिंदी", |
| 92 | 92 | 'hr' => "hrvatski", |
| 93 | 93 | 'hu' => "magyar", |
| 94 | - 'hy' => "Հայերեն",// Arménien |
|
| 94 | + 'hy' => "Հայերեն", // Arménien |
|
| 95 | 95 | 'ia' => "Interlingua", |
| 96 | 96 | 'id' => "Indonesia", |
| 97 | 97 | 'ie' => "Interlingue", |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'ka' => "ქართული", |
| 106 | 106 | 'kk' => "қазақ тілі", // Kazakh |
| 107 | 107 | 'kl' => "kalaallisut", |
| 108 | - 'km' => "ភាសាខ្មែរ",// Khmer |
|
| 108 | + 'km' => "ភាសាខ្មែរ", // Khmer |
|
| 109 | 109 | 'kn' => "Kannada", |
| 110 | 110 | 'ko' => "한국어", |
| 111 | 111 | 'kok' => "कोंकणी", // Konkani |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | 'sh_latn' => 'srpskohrvastski', |
| 176 | 176 | 'sh_cyrl' => 'Српскохрватски', |
| 177 | 177 | 'si' => "Sinhalese", |
| 178 | - 'sk' => "slovenčina", // (Slovakia) |
|
| 179 | - 'sl' => "slovenščina", // (Slovenia) |
|
| 178 | + 'sk' => "slovenčina", // (Slovakia) |
|
| 179 | + 'sl' => "slovenščina", // (Slovenia) |
|
| 180 | 180 | 'sm' => "Samoan", |
| 181 | 181 | 'sn' => "Shona", |
| 182 | 182 | 'so' => "Somali", |
@@ -19,7 +19,9 @@ |
||
| 19 | 19 | http://www.loc.gov/standards/iso639-2/langcodes.html |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 22 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 23 | + return; |
|
| 24 | +} |
|
| 23 | 25 | |
| 24 | 26 | $GLOBALS['codes_langues'] = array( |
| 25 | 27 | 'aa' => "Afar", |
@@ -22,202 +22,202 @@ |
||
| 22 | 22 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 23 | 23 | |
| 24 | 24 | $GLOBALS['codes_langues'] = array( |
| 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 | - 'he' => "עברית", |
|
| 91 | - 'hi' => "हिंदी", |
|
| 92 | - 'hr' => "hrvatski", |
|
| 93 | - 'hu' => "magyar", |
|
| 94 | - 'hy' => "Հայերեն",// Arménien |
|
| 95 | - 'ia' => "Interlingua", |
|
| 96 | - 'id' => "Indonesia", |
|
| 97 | - 'ie' => "Interlingue", |
|
| 98 | - 'ik' => "Inupiak", |
|
| 99 | - 'is' => "íslenska", |
|
| 100 | - 'it' => "italiano", |
|
| 101 | - 'it_fem' => "italiana", |
|
| 102 | - 'iu' => "Inuktitut", |
|
| 103 | - 'ja' => "日本語", |
|
| 104 | - 'jv' => "Javanese", |
|
| 105 | - 'ka' => "ქართული", |
|
| 106 | - 'kk' => "қазақ тілі", // Kazakh |
|
| 107 | - 'kl' => "kalaallisut", |
|
| 108 | - 'km' => "ភាសាខ្មែរ",// Khmer |
|
| 109 | - 'kn' => "Kannada", |
|
| 110 | - 'ko' => "한국어", |
|
| 111 | - 'kok' => "कोंकणी", // Konkani |
|
| 112 | - 'ks' => "Kashmiri", |
|
| 113 | - 'ku' => "کوردی", |
|
| 114 | - 'ky' => "Kirghiz", |
|
| 115 | - 'la' => "lingua latina", |
|
| 116 | - 'lb' => "Lëtzebuergesch", |
|
| 117 | - 'ln' => "Lingala", |
|
| 118 | - 'lo' => "ພາສາລາວ", # lao |
|
| 119 | - 'lt' => "lietuvių", |
|
| 120 | - 'lu' => "luba-katanga", |
|
| 121 | - 'lv' => "latviešu", |
|
| 122 | - 'man' => "mandingue", # a traduire en mandingue |
|
| 123 | - 'mfv' => "manjak", # ISO-639-3 |
|
| 124 | - 'mg' => "Malagasy", |
|
| 125 | - 'mi' => "Maori", |
|
| 126 | - 'mk' => "македонски јазик", |
|
| 127 | - 'ml' => "Malayalam", |
|
| 128 | - 'mn' => "Монгол хэл", |
|
| 129 | - 'mo' => "Moldavian", |
|
| 130 | - 'mos' => "Moré", |
|
| 131 | - 'mr' => "मराठी", |
|
| 132 | - 'ms' => "Bahasa Malaysia", |
|
| 133 | - 'mt' => "Maltese", |
|
| 134 | - 'my' => "Burmese", |
|
| 135 | - 'na' => "Nauru", |
|
| 136 | - 'nap' => "napulitano", |
|
| 137 | - 'ne' => "Nepali", |
|
| 138 | - 'nqo' => "N'ko", // www.manden.org |
|
| 139 | - 'nl' => "Nederlands", |
|
| 140 | - 'no' => "norsk", |
|
| 141 | - 'nb' => "norsk bokmål", |
|
| 142 | - 'nn' => "norsk nynorsk", |
|
| 143 | - 'oc' => "òc", |
|
| 144 | - 'oc_lnc' => "òc lengadocian", |
|
| 145 | - 'oc_ni' => "òc niçard", |
|
| 146 | - 'oc_ni_la' => "òc niçard (larg)", |
|
| 147 | - 'oc_ni_mis' => "òc nissart (mistralenc)", |
|
| 148 | - 'oc_prv' => "òc provençau", |
|
| 149 | - 'oc_gsc' => "òc gascon", |
|
| 150 | - 'oc_lms' => "òc lemosin", |
|
| 151 | - 'oc_auv' => "òc auvernhat", |
|
| 152 | - 'oc_va' => "òc vivaroaupenc", |
|
| 153 | - 'om' => "(Afan) Oromo", |
|
| 154 | - 'or' => "Oriya", |
|
| 155 | - 'pa' => "Punjabi", |
|
| 156 | - 'pbb' => 'Nasa Yuwe', |
|
| 157 | - 'pl' => "polski", |
|
| 158 | - 'prs' => "دری", // ISO-639-3 Dari (Afghanistan) |
|
| 159 | - 'ps' => "پښتو", |
|
| 160 | - 'pt' => "Português", |
|
| 161 | - 'pt_br' => "Português do Brasil", |
|
| 162 | - 'qu' => "Quechua", |
|
| 163 | - 'rm' => "Rhaeto-Romance", |
|
| 164 | - 'rn' => "Kirundi", |
|
| 165 | - 'ro' => "română", |
|
| 166 | - 'roa' => "ch'ti", |
|
| 167 | - 'ru' => "русский", |
|
| 168 | - 'rw' => "Kinyarwanda", |
|
| 169 | - 'sa' => "संस्कृत", |
|
| 170 | - 'sc' => "sardu", |
|
| 171 | - 'scn' => "sicilianu", |
|
| 172 | - 'sd' => "Sindhi", |
|
| 173 | - 'sg' => "Sangho", |
|
| 174 | - 'sh' => "srpskohrvastski", |
|
| 175 | - 'sh_latn' => 'srpskohrvastski', |
|
| 176 | - 'sh_cyrl' => 'Српскохрватски', |
|
| 177 | - 'si' => "Sinhalese", |
|
| 178 | - 'sk' => "slovenčina", // (Slovakia) |
|
| 179 | - 'sl' => "slovenščina", // (Slovenia) |
|
| 180 | - 'sm' => "Samoan", |
|
| 181 | - 'sn' => "Shona", |
|
| 182 | - 'so' => "Somali", |
|
| 183 | - 'sq' => "shqip", |
|
| 184 | - 'sr' => "српски", |
|
| 185 | - 'src' => 'sardu logudorésu', // sarde cf 'sc' |
|
| 186 | - 'sro' => 'sardu campidanésu', |
|
| 187 | - 'ss' => "Siswati", |
|
| 188 | - 'st' => "Sesotho", |
|
| 189 | - 'su' => "Sundanese", |
|
| 190 | - 'sv' => "svenska", |
|
| 191 | - 'sw' => "Kiswahili", |
|
| 192 | - 'ta' => "தமிழ்", // Tamil |
|
| 193 | - 'te' => "Telugu", |
|
| 194 | - 'tg' => "Tajik", |
|
| 195 | - 'th' => "ไทย", |
|
| 196 | - 'ti' => "Tigrinya", |
|
| 197 | - 'tk' => "Turkmen", |
|
| 198 | - 'tl' => "Tagalog", |
|
| 199 | - 'tn' => "Setswana", |
|
| 200 | - 'to' => "Tonga", |
|
| 201 | - 'tr' => "Türkçe", |
|
| 202 | - 'ts' => "Tsonga", |
|
| 203 | - 'tt' => "Татар", |
|
| 204 | - 'tw' => "Twi", |
|
| 205 | - 'ty' => "reo mā`ohi", // tahitien |
|
| 206 | - 'ug' => "Uighur", |
|
| 207 | - 'uk' => "українська", |
|
| 208 | - 'ur' => "ٱردو", |
|
| 209 | - 'uz' => "O'zbekcha", |
|
| 210 | - 'vi' => "Tiếng Việt", |
|
| 211 | - 'vo' => "Volapuk", |
|
| 212 | - 'wa' => "walon", |
|
| 213 | - 'wo' => "Wolof", |
|
| 214 | - 'xh' => "Xhosa", |
|
| 215 | - 'yi' => "Yiddish", |
|
| 216 | - 'yo' => "Yoruba", |
|
| 217 | - 'za' => "Zhuang", |
|
| 218 | - 'zh' => "中文", // chinois (ecriture simplifiee) |
|
| 219 | - 'zh_tw' => "台灣中文", // chinois taiwan (ecr. traditionnelle) |
|
| 220 | - '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 | + 'he' => "עברית", |
|
| 91 | + 'hi' => "हिंदी", |
|
| 92 | + 'hr' => "hrvatski", |
|
| 93 | + 'hu' => "magyar", |
|
| 94 | + 'hy' => "Հայերեն",// Arménien |
|
| 95 | + 'ia' => "Interlingua", |
|
| 96 | + 'id' => "Indonesia", |
|
| 97 | + 'ie' => "Interlingue", |
|
| 98 | + 'ik' => "Inupiak", |
|
| 99 | + 'is' => "íslenska", |
|
| 100 | + 'it' => "italiano", |
|
| 101 | + 'it_fem' => "italiana", |
|
| 102 | + 'iu' => "Inuktitut", |
|
| 103 | + 'ja' => "日本語", |
|
| 104 | + 'jv' => "Javanese", |
|
| 105 | + 'ka' => "ქართული", |
|
| 106 | + 'kk' => "қазақ тілі", // Kazakh |
|
| 107 | + 'kl' => "kalaallisut", |
|
| 108 | + 'km' => "ភាសាខ្មែរ",// Khmer |
|
| 109 | + 'kn' => "Kannada", |
|
| 110 | + 'ko' => "한국어", |
|
| 111 | + 'kok' => "कोंकणी", // Konkani |
|
| 112 | + 'ks' => "Kashmiri", |
|
| 113 | + 'ku' => "کوردی", |
|
| 114 | + 'ky' => "Kirghiz", |
|
| 115 | + 'la' => "lingua latina", |
|
| 116 | + 'lb' => "Lëtzebuergesch", |
|
| 117 | + 'ln' => "Lingala", |
|
| 118 | + 'lo' => "ພາສາລາວ", # lao |
|
| 119 | + 'lt' => "lietuvių", |
|
| 120 | + 'lu' => "luba-katanga", |
|
| 121 | + 'lv' => "latviešu", |
|
| 122 | + 'man' => "mandingue", # a traduire en mandingue |
|
| 123 | + 'mfv' => "manjak", # ISO-639-3 |
|
| 124 | + 'mg' => "Malagasy", |
|
| 125 | + 'mi' => "Maori", |
|
| 126 | + 'mk' => "македонски јазик", |
|
| 127 | + 'ml' => "Malayalam", |
|
| 128 | + 'mn' => "Монгол хэл", |
|
| 129 | + 'mo' => "Moldavian", |
|
| 130 | + 'mos' => "Moré", |
|
| 131 | + 'mr' => "मराठी", |
|
| 132 | + 'ms' => "Bahasa Malaysia", |
|
| 133 | + 'mt' => "Maltese", |
|
| 134 | + 'my' => "Burmese", |
|
| 135 | + 'na' => "Nauru", |
|
| 136 | + 'nap' => "napulitano", |
|
| 137 | + 'ne' => "Nepali", |
|
| 138 | + 'nqo' => "N'ko", // www.manden.org |
|
| 139 | + 'nl' => "Nederlands", |
|
| 140 | + 'no' => "norsk", |
|
| 141 | + 'nb' => "norsk bokmål", |
|
| 142 | + 'nn' => "norsk nynorsk", |
|
| 143 | + 'oc' => "òc", |
|
| 144 | + 'oc_lnc' => "òc lengadocian", |
|
| 145 | + 'oc_ni' => "òc niçard", |
|
| 146 | + 'oc_ni_la' => "òc niçard (larg)", |
|
| 147 | + 'oc_ni_mis' => "òc nissart (mistralenc)", |
|
| 148 | + 'oc_prv' => "òc provençau", |
|
| 149 | + 'oc_gsc' => "òc gascon", |
|
| 150 | + 'oc_lms' => "òc lemosin", |
|
| 151 | + 'oc_auv' => "òc auvernhat", |
|
| 152 | + 'oc_va' => "òc vivaroaupenc", |
|
| 153 | + 'om' => "(Afan) Oromo", |
|
| 154 | + 'or' => "Oriya", |
|
| 155 | + 'pa' => "Punjabi", |
|
| 156 | + 'pbb' => 'Nasa Yuwe', |
|
| 157 | + 'pl' => "polski", |
|
| 158 | + 'prs' => "دری", // ISO-639-3 Dari (Afghanistan) |
|
| 159 | + 'ps' => "پښتو", |
|
| 160 | + 'pt' => "Português", |
|
| 161 | + 'pt_br' => "Português do Brasil", |
|
| 162 | + 'qu' => "Quechua", |
|
| 163 | + 'rm' => "Rhaeto-Romance", |
|
| 164 | + 'rn' => "Kirundi", |
|
| 165 | + 'ro' => "română", |
|
| 166 | + 'roa' => "ch'ti", |
|
| 167 | + 'ru' => "русский", |
|
| 168 | + 'rw' => "Kinyarwanda", |
|
| 169 | + 'sa' => "संस्कृत", |
|
| 170 | + 'sc' => "sardu", |
|
| 171 | + 'scn' => "sicilianu", |
|
| 172 | + 'sd' => "Sindhi", |
|
| 173 | + 'sg' => "Sangho", |
|
| 174 | + 'sh' => "srpskohrvastski", |
|
| 175 | + 'sh_latn' => 'srpskohrvastski', |
|
| 176 | + 'sh_cyrl' => 'Српскохрватски', |
|
| 177 | + 'si' => "Sinhalese", |
|
| 178 | + 'sk' => "slovenčina", // (Slovakia) |
|
| 179 | + 'sl' => "slovenščina", // (Slovenia) |
|
| 180 | + 'sm' => "Samoan", |
|
| 181 | + 'sn' => "Shona", |
|
| 182 | + 'so' => "Somali", |
|
| 183 | + 'sq' => "shqip", |
|
| 184 | + 'sr' => "српски", |
|
| 185 | + 'src' => 'sardu logudorésu', // sarde cf 'sc' |
|
| 186 | + 'sro' => 'sardu campidanésu', |
|
| 187 | + 'ss' => "Siswati", |
|
| 188 | + 'st' => "Sesotho", |
|
| 189 | + 'su' => "Sundanese", |
|
| 190 | + 'sv' => "svenska", |
|
| 191 | + 'sw' => "Kiswahili", |
|
| 192 | + 'ta' => "தமிழ்", // Tamil |
|
| 193 | + 'te' => "Telugu", |
|
| 194 | + 'tg' => "Tajik", |
|
| 195 | + 'th' => "ไทย", |
|
| 196 | + 'ti' => "Tigrinya", |
|
| 197 | + 'tk' => "Turkmen", |
|
| 198 | + 'tl' => "Tagalog", |
|
| 199 | + 'tn' => "Setswana", |
|
| 200 | + 'to' => "Tonga", |
|
| 201 | + 'tr' => "Türkçe", |
|
| 202 | + 'ts' => "Tsonga", |
|
| 203 | + 'tt' => "Татар", |
|
| 204 | + 'tw' => "Twi", |
|
| 205 | + 'ty' => "reo mā`ohi", // tahitien |
|
| 206 | + 'ug' => "Uighur", |
|
| 207 | + 'uk' => "українська", |
|
| 208 | + 'ur' => "ٱردو", |
|
| 209 | + 'uz' => "O'zbekcha", |
|
| 210 | + 'vi' => "Tiếng Việt", |
|
| 211 | + 'vo' => "Volapuk", |
|
| 212 | + 'wa' => "walon", |
|
| 213 | + 'wo' => "Wolof", |
|
| 214 | + 'xh' => "Xhosa", |
|
| 215 | + 'yi' => "Yiddish", |
|
| 216 | + 'yo' => "Yoruba", |
|
| 217 | + 'za' => "Zhuang", |
|
| 218 | + 'zh' => "中文", // chinois (ecriture simplifiee) |
|
| 219 | + 'zh_tw' => "台灣中文", // chinois taiwan (ecr. traditionnelle) |
|
| 220 | + 'zu' => "Zulu" |
|
| 221 | 221 | |
| 222 | 222 | ); |
| 223 | 223 | |
@@ -29,62 +29,62 @@ discard block |
||
| 29 | 29 | * Un tableau des sous rubriques |
| 30 | 30 | */ |
| 31 | 31 | function enfant_rub($collection,$debut=0,$limite=500){ |
| 32 | - $voir_logo = (isset($GLOBALS['meta']['image_process']) AND $GLOBALS['meta']['image_process'] != "non"); |
|
| 33 | - $logo = ""; |
|
| 32 | + $voir_logo = (isset($GLOBALS['meta']['image_process']) AND $GLOBALS['meta']['image_process'] != "non"); |
|
| 33 | + $logo = ""; |
|
| 34 | 34 | |
| 35 | - if ($voir_logo) { |
|
| 36 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 37 | - include_spip('inc/filtres_images_mini'); |
|
| 38 | - } |
|
| 35 | + if ($voir_logo) { |
|
| 36 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 37 | + include_spip('inc/filtres_images_mini'); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $res = array(); |
|
| 40 | + $res = array(); |
|
| 41 | 41 | |
| 42 | - $result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent=$collection",'', '0+titre,titre',"$debut,$limite"); |
|
| 43 | - while($row=sql_fetch($result)){ |
|
| 44 | - $id_rubrique=$row['id_rubrique']; |
|
| 45 | - $id_parent=$row['id_parent']; |
|
| 46 | - $titre=generer_info_entite($id_rubrique,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
|
| 47 | - if ('' !== ($rang = recuperer_numero($row['titre']))) |
|
| 48 | - $rang = "$rang. "; |
|
| 49 | - |
|
| 50 | - if (autoriser('voir','rubrique',$id_rubrique)){ |
|
| 51 | - |
|
| 52 | - $les_sous_enfants = sous_enfant_rub($id_rubrique); |
|
| 53 | - |
|
| 54 | - changer_typo($row['lang']); |
|
| 55 | - $lang_dir = lang_dir($row['lang']); |
|
| 56 | - $descriptif=propre($row['descriptif']); |
|
| 57 | - |
|
| 58 | - if ($voir_logo) { |
|
| 59 | - if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
|
| 60 | - list($fid, $dir, $nom, $format) = $logo; |
|
| 61 | - $logo = image_reduire("<img src='$fid' alt='' />", 48, 36); |
|
| 62 | - if ($logo) |
|
| 63 | - $logo = inserer_attribut($logo,'class','logo'); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" : |
|
| 68 | - http_img_pack('auteur-0minirezo-16.png', '', " width='16' height='16'", _T('image_administrer_rubrique'))) . |
|
| 69 | - " <a dir='$lang_dir' href='" . |
|
| 70 | - generer_url_entite($id_rubrique,'rubrique') . |
|
| 71 | - "'>". |
|
| 72 | - $rang . $titre . |
|
| 73 | - "</a>"; |
|
| 74 | - |
|
| 75 | - $titre = (is_string($logo) ? $logo : '') . |
|
| 76 | - bouton_block_depliable($lib_bouton,$les_sous_enfants ?false:-1,"enfants$id_rubrique"); |
|
| 77 | - |
|
| 78 | - $res[] = |
|
| 79 | - debut_cadre_sous_rub(($id_parent ? "rubrique-24.png" : "secteur-24.png"), true, "", $titre) . |
|
| 80 | - (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") . |
|
| 81 | - $les_sous_enfants . |
|
| 82 | - fin_cadre_sous_rub(true); |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite |
|
| 87 | - return $res; |
|
| 42 | + $result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent=$collection",'', '0+titre,titre',"$debut,$limite"); |
|
| 43 | + while($row=sql_fetch($result)){ |
|
| 44 | + $id_rubrique=$row['id_rubrique']; |
|
| 45 | + $id_parent=$row['id_parent']; |
|
| 46 | + $titre=generer_info_entite($id_rubrique,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
|
| 47 | + if ('' !== ($rang = recuperer_numero($row['titre']))) |
|
| 48 | + $rang = "$rang. "; |
|
| 49 | + |
|
| 50 | + if (autoriser('voir','rubrique',$id_rubrique)){ |
|
| 51 | + |
|
| 52 | + $les_sous_enfants = sous_enfant_rub($id_rubrique); |
|
| 53 | + |
|
| 54 | + changer_typo($row['lang']); |
|
| 55 | + $lang_dir = lang_dir($row['lang']); |
|
| 56 | + $descriptif=propre($row['descriptif']); |
|
| 57 | + |
|
| 58 | + if ($voir_logo) { |
|
| 59 | + if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
|
| 60 | + list($fid, $dir, $nom, $format) = $logo; |
|
| 61 | + $logo = image_reduire("<img src='$fid' alt='' />", 48, 36); |
|
| 62 | + if ($logo) |
|
| 63 | + $logo = inserer_attribut($logo,'class','logo'); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" : |
|
| 68 | + http_img_pack('auteur-0minirezo-16.png', '', " width='16' height='16'", _T('image_administrer_rubrique'))) . |
|
| 69 | + " <a dir='$lang_dir' href='" . |
|
| 70 | + generer_url_entite($id_rubrique,'rubrique') . |
|
| 71 | + "'>". |
|
| 72 | + $rang . $titre . |
|
| 73 | + "</a>"; |
|
| 74 | + |
|
| 75 | + $titre = (is_string($logo) ? $logo : '') . |
|
| 76 | + bouton_block_depliable($lib_bouton,$les_sous_enfants ?false:-1,"enfants$id_rubrique"); |
|
| 77 | + |
|
| 78 | + $res[] = |
|
| 79 | + debut_cadre_sous_rub(($id_parent ? "rubrique-24.png" : "secteur-24.png"), true, "", $titre) . |
|
| 80 | + (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") . |
|
| 81 | + $les_sous_enfants . |
|
| 82 | + fin_cadre_sous_rub(true); |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite |
|
| 87 | + return $res; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -97,47 +97,47 @@ discard block |
||
| 97 | 97 | * Le contenu du bloc dépliable |
| 98 | 98 | */ |
| 99 | 99 | function sous_enfant_rub($collection2){ |
| 100 | - $nb = sql_countsel('spip_rubriques',"id_parent=$collection2"); |
|
| 100 | + $nb = sql_countsel('spip_rubriques',"id_parent=$collection2"); |
|
| 101 | 101 | |
| 102 | - $retour = ''; |
|
| 103 | - $pagination = ''; |
|
| 104 | - $debut = 0; |
|
| 105 | - $limite = 500; |
|
| 102 | + $retour = ''; |
|
| 103 | + $pagination = ''; |
|
| 104 | + $debut = 0; |
|
| 105 | + $limite = 500; |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * On ne va afficher que 500 résultats max |
|
| 109 | - * Si > 500 on affiche une pagination |
|
| 110 | - */ |
|
| 111 | - if($nb > $limite){ |
|
| 112 | - $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
|
| 113 | - $pagination = chercher_filtre('pagination'); |
|
| 114 | - $pagination = '<p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, 'prive').'</p>'; |
|
| 115 | - $limite = $debut + $limite; |
|
| 116 | - } |
|
| 107 | + /** |
|
| 108 | + * On ne va afficher que 500 résultats max |
|
| 109 | + * Si > 500 on affiche une pagination |
|
| 110 | + */ |
|
| 111 | + if($nb > $limite){ |
|
| 112 | + $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
|
| 113 | + $pagination = chercher_filtre('pagination'); |
|
| 114 | + $pagination = '<p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, 'prive').'</p>'; |
|
| 115 | + $limite = $debut + $limite; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - $result = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2",'', '0+titre,titre',"$debut,$limite"); |
|
| 118 | + $result = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2",'', '0+titre,titre',"$debut,$limite"); |
|
| 119 | 119 | |
| 120 | - while($row=sql_fetch($result)){ |
|
| 121 | - $id_rubrique2=$row['id_rubrique']; |
|
| 122 | - $id_parent2=$row['id_parent']; |
|
| 123 | - $titre2=generer_info_entite($id_rubrique2,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
|
| 124 | - if ('' !== ($rang2 = recuperer_numero($row['titre']))) |
|
| 125 | - $rang2 = "$rang2. "; |
|
| 126 | - |
|
| 127 | - changer_typo($row['lang']); |
|
| 128 | - $lang_dir = lang_dir($row['lang']); |
|
| 129 | - if (autoriser('voir','rubrique',$id_rubrique2)) |
|
| 130 | - $retour.="\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite($id_rubrique2,'rubrique') . "'>".$rang2.$titre2."</a></li>\n"; |
|
| 131 | - } |
|
| 120 | + while($row=sql_fetch($result)){ |
|
| 121 | + $id_rubrique2=$row['id_rubrique']; |
|
| 122 | + $id_parent2=$row['id_parent']; |
|
| 123 | + $titre2=generer_info_entite($id_rubrique2,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
|
| 124 | + if ('' !== ($rang2 = recuperer_numero($row['titre']))) |
|
| 125 | + $rang2 = "$rang2. "; |
|
| 126 | + |
|
| 127 | + changer_typo($row['lang']); |
|
| 128 | + $lang_dir = lang_dir($row['lang']); |
|
| 129 | + if (autoriser('voir','rubrique',$id_rubrique2)) |
|
| 130 | + $retour.="\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite($id_rubrique2,'rubrique') . "'>".$rang2.$titre2."</a></li>\n"; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - $retour = $pagination.$retour.$pagination; |
|
| 133 | + $retour = $pagination.$retour.$pagination; |
|
| 134 | 134 | |
| 135 | - if (!$retour) return ''; |
|
| 135 | + if (!$retour) return ''; |
|
| 136 | 136 | |
| 137 | - return debut_block_depliable($debut > 0 ? true : false,"enfants$collection2") |
|
| 138 | - ."\n<ul class='liste-items sous-sous-rub'>\n" |
|
| 139 | - . $retour |
|
| 140 | - . "</ul>\n".fin_block()."\n\n"; |
|
| 137 | + return debut_block_depliable($debut > 0 ? true : false,"enfants$collection2") |
|
| 138 | + ."\n<ul class='liste-items sous-sous-rub'>\n" |
|
| 139 | + . $retour |
|
| 140 | + . "</ul>\n".fin_block()."\n\n"; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -152,43 +152,43 @@ discard block |
||
| 152 | 152 | * Le contenu textuel affiché, la liste des sous rubriques |
| 153 | 153 | */ |
| 154 | 154 | function afficher_enfant_rub($id_rubrique=0) { |
| 155 | - $pagination = ''; |
|
| 156 | - $debut = 0; |
|
| 157 | - $limite = 500; |
|
| 155 | + $pagination = ''; |
|
| 156 | + $debut = 0; |
|
| 157 | + $limite = 500; |
|
| 158 | 158 | |
| 159 | - $nb = sql_countsel('spip_rubriques',"id_parent=$id_rubrique"); |
|
| 159 | + $nb = sql_countsel('spip_rubriques',"id_parent=$id_rubrique"); |
|
| 160 | 160 | |
| 161 | - if($nb > $limite){ |
|
| 162 | - $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
|
| 163 | - $pagination = chercher_filtre('pagination'); |
|
| 164 | - $pagination = '<br class="nettoyeur"><p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, 'prive').'</p>'; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - $les_enfants = enfant_rub($id_rubrique,$debut,$limite); |
|
| 168 | - |
|
| 169 | - if (!$n = count($les_enfants)) return ""; |
|
| 170 | - |
|
| 171 | - if ($n==1) { |
|
| 172 | - $les_enfants=reset($les_enfants); |
|
| 173 | - $les_enfants2=""; |
|
| 174 | - } |
|
| 175 | - else{ |
|
| 176 | - $n = ceil($n/2); |
|
| 177 | - $les_enfants2 = implode('',array_slice($les_enfants,$n)); |
|
| 178 | - $les_enfants = implode('',array_slice($les_enfants,0,$n)); |
|
| 179 | - } |
|
| 161 | + if($nb > $limite){ |
|
| 162 | + $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
|
| 163 | + $pagination = chercher_filtre('pagination'); |
|
| 164 | + $pagination = '<br class="nettoyeur"><p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, 'prive').'</p>'; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + $les_enfants = enfant_rub($id_rubrique,$debut,$limite); |
|
| 168 | + |
|
| 169 | + if (!$n = count($les_enfants)) return ""; |
|
| 170 | + |
|
| 171 | + if ($n==1) { |
|
| 172 | + $les_enfants=reset($les_enfants); |
|
| 173 | + $les_enfants2=""; |
|
| 174 | + } |
|
| 175 | + else{ |
|
| 176 | + $n = ceil($n/2); |
|
| 177 | + $les_enfants2 = implode('',array_slice($les_enfants,$n)); |
|
| 178 | + $les_enfants = implode('',array_slice($les_enfants,0,$n)); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - $res = |
|
| 182 | - $pagination |
|
| 183 | - . "<div class='gauche'>" |
|
| 184 | - . $les_enfants |
|
| 185 | - . "</div>" |
|
| 186 | - . "<div class='droite'>" |
|
| 187 | - . $les_enfants2 |
|
| 188 | - . "</div>" |
|
| 189 | - . $pagination; |
|
| 190 | - |
|
| 191 | - return $res; |
|
| 181 | + $res = |
|
| 182 | + $pagination |
|
| 183 | + . "<div class='gauche'>" |
|
| 184 | + . $les_enfants |
|
| 185 | + . "</div>" |
|
| 186 | + . "<div class='droite'>" |
|
| 187 | + . $les_enfants2 |
|
| 188 | + . "</div>" |
|
| 189 | + . $pagination; |
|
| 190 | + |
|
| 191 | + return $res; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | ?> |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | include_spip('inc/autoriser'); |
| 17 | 19 | include_spip('inc/presentation'); |
@@ -44,8 +46,9 @@ discard block |
||
| 44 | 46 | $id_rubrique=$row['id_rubrique']; |
| 45 | 47 | $id_parent=$row['id_parent']; |
| 46 | 48 | $titre=generer_info_entite($id_rubrique,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
| 47 | - if ('' !== ($rang = recuperer_numero($row['titre']))) |
|
| 48 | - $rang = "$rang. "; |
|
| 49 | + if ('' !== ($rang = recuperer_numero($row['titre']))) { |
|
| 50 | + $rang = "$rang. "; |
|
| 51 | + } |
|
| 49 | 52 | |
| 50 | 53 | if (autoriser('voir','rubrique',$id_rubrique)){ |
| 51 | 54 | |
@@ -59,8 +62,9 @@ discard block |
||
| 59 | 62 | if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
| 60 | 63 | list($fid, $dir, $nom, $format) = $logo; |
| 61 | 64 | $logo = image_reduire("<img src='$fid' alt='' />", 48, 36); |
| 62 | - if ($logo) |
|
| 63 | - $logo = inserer_attribut($logo,'class','logo'); |
|
| 65 | + if ($logo) { |
|
| 66 | + $logo = inserer_attribut($logo,'class','logo'); |
|
| 67 | + } |
|
| 64 | 68 | } |
| 65 | 69 | } |
| 66 | 70 | |
@@ -121,18 +125,22 @@ discard block |
||
| 121 | 125 | $id_rubrique2=$row['id_rubrique']; |
| 122 | 126 | $id_parent2=$row['id_parent']; |
| 123 | 127 | $titre2=generer_info_entite($id_rubrique2,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
| 124 | - if ('' !== ($rang2 = recuperer_numero($row['titre']))) |
|
| 125 | - $rang2 = "$rang2. "; |
|
| 128 | + if ('' !== ($rang2 = recuperer_numero($row['titre']))) { |
|
| 129 | + $rang2 = "$rang2. "; |
|
| 130 | + } |
|
| 126 | 131 | |
| 127 | 132 | changer_typo($row['lang']); |
| 128 | 133 | $lang_dir = lang_dir($row['lang']); |
| 129 | - if (autoriser('voir','rubrique',$id_rubrique2)) |
|
| 130 | - $retour.="\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite($id_rubrique2,'rubrique') . "'>".$rang2.$titre2."</a></li>\n"; |
|
| 134 | + if (autoriser('voir','rubrique',$id_rubrique2)) { |
|
| 135 | + $retour.="\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite($id_rubrique2,'rubrique') . "'>".$rang2.$titre2."</a></li>\n"; |
|
| 136 | + } |
|
| 131 | 137 | } |
| 132 | 138 | |
| 133 | 139 | $retour = $pagination.$retour.$pagination; |
| 134 | 140 | |
| 135 | - if (!$retour) return ''; |
|
| 141 | + if (!$retour) { |
|
| 142 | + return ''; |
|
| 143 | + } |
|
| 136 | 144 | |
| 137 | 145 | return debut_block_depliable($debut > 0 ? true : false,"enfants$collection2") |
| 138 | 146 | ."\n<ul class='liste-items sous-sous-rub'>\n" |
@@ -166,13 +174,14 @@ discard block |
||
| 166 | 174 | |
| 167 | 175 | $les_enfants = enfant_rub($id_rubrique,$debut,$limite); |
| 168 | 176 | |
| 169 | - if (!$n = count($les_enfants)) return ""; |
|
| 177 | + if (!$n = count($les_enfants)) { |
|
| 178 | + return ""; |
|
| 179 | + } |
|
| 170 | 180 | |
| 171 | 181 | if ($n==1) { |
| 172 | 182 | $les_enfants=reset($les_enfants); |
| 173 | 183 | $les_enfants2=""; |
| 174 | - } |
|
| 175 | - else{ |
|
| 184 | + } else{ |
|
| 176 | 185 | $n = ceil($n/2); |
| 177 | 186 | $les_enfants2 = implode('',array_slice($les_enfants,$n)); |
| 178 | 187 | $les_enfants = implode('',array_slice($les_enfants,0,$n)); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @return array $res |
| 29 | 29 | * Un tableau des sous rubriques |
| 30 | 30 | */ |
| 31 | -function enfant_rub($collection,$debut=0,$limite=500){ |
|
| 31 | +function enfant_rub($collection, $debut = 0, $limite = 500) { |
|
| 32 | 32 | $voir_logo = (isset($GLOBALS['meta']['image_process']) AND $GLOBALS['meta']['image_process'] != "non"); |
| 33 | 33 | $logo = ""; |
| 34 | 34 | |
@@ -39,46 +39,45 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $res = array(); |
| 41 | 41 | |
| 42 | - $result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent=$collection",'', '0+titre,titre',"$debut,$limite"); |
|
| 43 | - while($row=sql_fetch($result)){ |
|
| 44 | - $id_rubrique=$row['id_rubrique']; |
|
| 45 | - $id_parent=$row['id_parent']; |
|
| 46 | - $titre=generer_info_entite($id_rubrique,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
|
| 42 | + $result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent=$collection", '', '0+titre,titre', "$debut,$limite"); |
|
| 43 | + while ($row = sql_fetch($result)) { |
|
| 44 | + $id_rubrique = $row['id_rubrique']; |
|
| 45 | + $id_parent = $row['id_parent']; |
|
| 46 | + $titre = generer_info_entite($id_rubrique, 'rubrique', 'titre'); // pour etre sur de passer par tous les traitements |
|
| 47 | 47 | if ('' !== ($rang = recuperer_numero($row['titre']))) |
| 48 | 48 | $rang = "$rang. "; |
| 49 | 49 | |
| 50 | - if (autoriser('voir','rubrique',$id_rubrique)){ |
|
| 50 | + if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 51 | 51 | |
| 52 | 52 | $les_sous_enfants = sous_enfant_rub($id_rubrique); |
| 53 | 53 | |
| 54 | 54 | changer_typo($row['lang']); |
| 55 | 55 | $lang_dir = lang_dir($row['lang']); |
| 56 | - $descriptif=propre($row['descriptif']); |
|
| 56 | + $descriptif = propre($row['descriptif']); |
|
| 57 | 57 | |
| 58 | 58 | if ($voir_logo) { |
| 59 | 59 | if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
| 60 | 60 | list($fid, $dir, $nom, $format) = $logo; |
| 61 | 61 | $logo = image_reduire("<img src='$fid' alt='' />", 48, 36); |
| 62 | 62 | if ($logo) |
| 63 | - $logo = inserer_attribut($logo,'class','logo'); |
|
| 63 | + $logo = inserer_attribut($logo, 'class', 'logo'); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" : |
|
| 68 | - http_img_pack('auteur-0minirezo-16.png', '', " width='16' height='16'", _T('image_administrer_rubrique'))) . |
|
| 69 | - " <a dir='$lang_dir' href='" . |
|
| 70 | - generer_url_entite($id_rubrique,'rubrique') . |
|
| 67 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" : http_img_pack('auteur-0minirezo-16.png', '', " width='16' height='16'", _T('image_administrer_rubrique'))). |
|
| 68 | + " <a dir='$lang_dir' href='". |
|
| 69 | + generer_url_entite($id_rubrique, 'rubrique'). |
|
| 71 | 70 | "'>". |
| 72 | - $rang . $titre . |
|
| 71 | + $rang.$titre. |
|
| 73 | 72 | "</a>"; |
| 74 | 73 | |
| 75 | - $titre = (is_string($logo) ? $logo : '') . |
|
| 76 | - bouton_block_depliable($lib_bouton,$les_sous_enfants ?false:-1,"enfants$id_rubrique"); |
|
| 74 | + $titre = (is_string($logo) ? $logo : ''). |
|
| 75 | + bouton_block_depliable($lib_bouton, $les_sous_enfants ?false:-1, "enfants$id_rubrique"); |
|
| 77 | 76 | |
| 78 | 77 | $res[] = |
| 79 | - debut_cadre_sous_rub(($id_parent ? "rubrique-24.png" : "secteur-24.png"), true, "", $titre) . |
|
| 80 | - (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") . |
|
| 81 | - $les_sous_enfants . |
|
| 78 | + debut_cadre_sous_rub(($id_parent ? "rubrique-24.png" : "secteur-24.png"), true, "", $titre). |
|
| 79 | + (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>"). |
|
| 80 | + $les_sous_enfants. |
|
| 82 | 81 | fin_cadre_sous_rub(true); |
| 83 | 82 | } |
| 84 | 83 | } |
@@ -96,8 +95,8 @@ discard block |
||
| 96 | 95 | * @return string |
| 97 | 96 | * Le contenu du bloc dépliable |
| 98 | 97 | */ |
| 99 | -function sous_enfant_rub($collection2){ |
|
| 100 | - $nb = sql_countsel('spip_rubriques',"id_parent=$collection2"); |
|
| 98 | +function sous_enfant_rub($collection2) { |
|
| 99 | + $nb = sql_countsel('spip_rubriques', "id_parent=$collection2"); |
|
| 101 | 100 | |
| 102 | 101 | $retour = ''; |
| 103 | 102 | $pagination = ''; |
@@ -108,33 +107,33 @@ discard block |
||
| 108 | 107 | * On ne va afficher que 500 résultats max |
| 109 | 108 | * Si > 500 on affiche une pagination |
| 110 | 109 | */ |
| 111 | - if($nb > $limite){ |
|
| 110 | + if ($nb > $limite) { |
|
| 112 | 111 | $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
| 113 | 112 | $pagination = chercher_filtre('pagination'); |
| 114 | 113 | $pagination = '<p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, 'prive').'</p>'; |
| 115 | 114 | $limite = $debut + $limite; |
| 116 | 115 | } |
| 117 | 116 | |
| 118 | - $result = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2",'', '0+titre,titre',"$debut,$limite"); |
|
| 117 | + $result = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2", '', '0+titre,titre', "$debut,$limite"); |
|
| 119 | 118 | |
| 120 | - while($row=sql_fetch($result)){ |
|
| 121 | - $id_rubrique2=$row['id_rubrique']; |
|
| 122 | - $id_parent2=$row['id_parent']; |
|
| 123 | - $titre2=generer_info_entite($id_rubrique2,'rubrique','titre'); // pour etre sur de passer par tous les traitements |
|
| 119 | + while ($row = sql_fetch($result)) { |
|
| 120 | + $id_rubrique2 = $row['id_rubrique']; |
|
| 121 | + $id_parent2 = $row['id_parent']; |
|
| 122 | + $titre2 = generer_info_entite($id_rubrique2, 'rubrique', 'titre'); // pour etre sur de passer par tous les traitements |
|
| 124 | 123 | if ('' !== ($rang2 = recuperer_numero($row['titre']))) |
| 125 | 124 | $rang2 = "$rang2. "; |
| 126 | 125 | |
| 127 | 126 | changer_typo($row['lang']); |
| 128 | 127 | $lang_dir = lang_dir($row['lang']); |
| 129 | - if (autoriser('voir','rubrique',$id_rubrique2)) |
|
| 130 | - $retour.="\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite($id_rubrique2,'rubrique') . "'>".$rang2.$titre2."</a></li>\n"; |
|
| 128 | + if (autoriser('voir', 'rubrique', $id_rubrique2)) |
|
| 129 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='".generer_url_entite($id_rubrique2, 'rubrique')."'>".$rang2.$titre2."</a></li>\n"; |
|
| 131 | 130 | } |
| 132 | 131 | |
| 133 | 132 | $retour = $pagination.$retour.$pagination; |
| 134 | 133 | |
| 135 | 134 | if (!$retour) return ''; |
| 136 | 135 | |
| 137 | - return debut_block_depliable($debut > 0 ? true : false,"enfants$collection2") |
|
| 136 | + return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
|
| 138 | 137 | ."\n<ul class='liste-items sous-sous-rub'>\n" |
| 139 | 138 | . $retour |
| 140 | 139 | . "</ul>\n".fin_block()."\n\n"; |
@@ -151,31 +150,31 @@ discard block |
||
| 151 | 150 | * @return string $res |
| 152 | 151 | * Le contenu textuel affiché, la liste des sous rubriques |
| 153 | 152 | */ |
| 154 | -function afficher_enfant_rub($id_rubrique=0) { |
|
| 153 | +function afficher_enfant_rub($id_rubrique = 0) { |
|
| 155 | 154 | $pagination = ''; |
| 156 | 155 | $debut = 0; |
| 157 | 156 | $limite = 500; |
| 158 | 157 | |
| 159 | - $nb = sql_countsel('spip_rubriques',"id_parent=$id_rubrique"); |
|
| 158 | + $nb = sql_countsel('spip_rubriques', "id_parent=$id_rubrique"); |
|
| 160 | 159 | |
| 161 | - if($nb > $limite){ |
|
| 160 | + if ($nb > $limite) { |
|
| 162 | 161 | $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
| 163 | 162 | $pagination = chercher_filtre('pagination'); |
| 164 | 163 | $pagination = '<br class="nettoyeur"><p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, 'prive').'</p>'; |
| 165 | 164 | } |
| 166 | 165 | |
| 167 | - $les_enfants = enfant_rub($id_rubrique,$debut,$limite); |
|
| 166 | + $les_enfants = enfant_rub($id_rubrique, $debut, $limite); |
|
| 168 | 167 | |
| 169 | 168 | if (!$n = count($les_enfants)) return ""; |
| 170 | 169 | |
| 171 | - if ($n==1) { |
|
| 172 | - $les_enfants=reset($les_enfants); |
|
| 173 | - $les_enfants2=""; |
|
| 170 | + if ($n == 1) { |
|
| 171 | + $les_enfants = reset($les_enfants); |
|
| 172 | + $les_enfants2 = ""; |
|
| 174 | 173 | } |
| 175 | - else{ |
|
| 176 | - $n = ceil($n/2); |
|
| 177 | - $les_enfants2 = implode('',array_slice($les_enfants,$n)); |
|
| 178 | - $les_enfants = implode('',array_slice($les_enfants,0,$n)); |
|
| 174 | + else { |
|
| 175 | + $n = ceil($n / 2); |
|
| 176 | + $les_enfants2 = implode('', array_slice($les_enfants, $n)); |
|
| 177 | + $les_enfants = implode('', array_slice($les_enfants, 0, $n)); |
|
| 179 | 178 | } |
| 180 | 179 | |
| 181 | 180 | $res = |
@@ -30,69 +30,69 @@ discard block |
||
| 30 | 30 | * @return array couples cles / valeurs des champs du formulaire à charger. |
| 31 | 31 | **/ |
| 32 | 32 | function precharger_objet($type, $id_objet, $id_rubrique=0, $lier_trad=0, $champ_titre = 'titre') { |
| 33 | - global $connect_id_rubrique, $spip_lang; |
|
| 33 | + global $connect_id_rubrique, $spip_lang; |
|
| 34 | 34 | |
| 35 | - $table = table_objet_sql($type); |
|
| 36 | - $_id_objet = id_table_objet($table); |
|
| 37 | - |
|
| 38 | - // si l'objet existe deja, on retourne simplement ses valeurs |
|
| 39 | - if (is_numeric($id_objet)) |
|
| 40 | - return sql_fetsel("*", $table, "$_id_objet=$id_objet"); |
|
| 41 | - |
|
| 42 | - // ici, on demande une creation. |
|
| 43 | - // on prerempli certains elements : les champs si traduction, |
|
| 44 | - // les id_rubrique et id_secteur si l'objet a ces champs |
|
| 45 | - $desc = lister_tables_objets_sql($table); |
|
| 46 | - # il faudrait calculer $champ_titre ici |
|
| 47 | - $is_rubrique = isset($desc['field']['id_rubrique']); |
|
| 48 | - $is_secteur = isset($desc['field']['id_secteur']); |
|
| 49 | - |
|
| 50 | - // si demande de traduction |
|
| 51 | - // on recupere les valeurs de la traduction |
|
| 52 | - if ($lier_trad){ |
|
| 53 | - if ($select = charger_fonction("precharger_traduction_" . $type,'inc',true)) |
|
| 54 | - $row = $select($id_objet, $id_rubrique, $lier_trad); |
|
| 55 | - else |
|
| 56 | - $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
|
| 57 | - } else { |
|
| 58 | - $row[$champ_titre] = ''; |
|
| 59 | - if ($is_rubrique) { |
|
| 60 | - $row['id_rubrique'] = $id_rubrique; |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // calcul de la rubrique |
|
| 65 | - # note : comment faire pour des traductions sur l'objet rubriques ? |
|
| 66 | - if ($is_rubrique) { |
|
| 67 | - // appel du script a la racine, faut choisir |
|
| 68 | - // admin restreint ==> sa premiere rubrique |
|
| 69 | - // autre ==> la derniere rubrique cree |
|
| 70 | - if (!$row['id_rubrique']) { |
|
| 71 | - if ($connect_id_rubrique) |
|
| 72 | - $row['id_rubrique'] = $id_rubrique = current($connect_id_rubrique); |
|
| 73 | - else { |
|
| 74 | - $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "", "", "id_rubrique DESC", 1); |
|
| 75 | - $row['id_rubrique'] = $id_rubrique = $row_rub['id_rubrique']; |
|
| 76 | - } |
|
| 77 | - if (!autoriser('creerarticledans','rubrique',$row['id_rubrique'] )){ |
|
| 78 | - // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
|
| 79 | - $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0"); |
|
| 80 | - while (!autoriser('creerarticledans','rubrique',$row['id_rubrique'] ) && $row_rub = sql_fetch($res)){ |
|
| 81 | - $row['id_rubrique'] = $row_rub['id_rubrique']; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - } |
|
| 35 | + $table = table_objet_sql($type); |
|
| 36 | + $_id_objet = id_table_objet($table); |
|
| 37 | + |
|
| 38 | + // si l'objet existe deja, on retourne simplement ses valeurs |
|
| 39 | + if (is_numeric($id_objet)) |
|
| 40 | + return sql_fetsel("*", $table, "$_id_objet=$id_objet"); |
|
| 41 | + |
|
| 42 | + // ici, on demande une creation. |
|
| 43 | + // on prerempli certains elements : les champs si traduction, |
|
| 44 | + // les id_rubrique et id_secteur si l'objet a ces champs |
|
| 45 | + $desc = lister_tables_objets_sql($table); |
|
| 46 | + # il faudrait calculer $champ_titre ici |
|
| 47 | + $is_rubrique = isset($desc['field']['id_rubrique']); |
|
| 48 | + $is_secteur = isset($desc['field']['id_secteur']); |
|
| 49 | + |
|
| 50 | + // si demande de traduction |
|
| 51 | + // on recupere les valeurs de la traduction |
|
| 52 | + if ($lier_trad){ |
|
| 53 | + if ($select = charger_fonction("precharger_traduction_" . $type,'inc',true)) |
|
| 54 | + $row = $select($id_objet, $id_rubrique, $lier_trad); |
|
| 55 | + else |
|
| 56 | + $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
|
| 57 | + } else { |
|
| 58 | + $row[$champ_titre] = ''; |
|
| 59 | + if ($is_rubrique) { |
|
| 60 | + $row['id_rubrique'] = $id_rubrique; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // calcul de la rubrique |
|
| 65 | + # note : comment faire pour des traductions sur l'objet rubriques ? |
|
| 66 | + if ($is_rubrique) { |
|
| 67 | + // appel du script a la racine, faut choisir |
|
| 68 | + // admin restreint ==> sa premiere rubrique |
|
| 69 | + // autre ==> la derniere rubrique cree |
|
| 70 | + if (!$row['id_rubrique']) { |
|
| 71 | + if ($connect_id_rubrique) |
|
| 72 | + $row['id_rubrique'] = $id_rubrique = current($connect_id_rubrique); |
|
| 73 | + else { |
|
| 74 | + $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "", "", "id_rubrique DESC", 1); |
|
| 75 | + $row['id_rubrique'] = $id_rubrique = $row_rub['id_rubrique']; |
|
| 76 | + } |
|
| 77 | + if (!autoriser('creerarticledans','rubrique',$row['id_rubrique'] )){ |
|
| 78 | + // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
|
| 79 | + $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0"); |
|
| 80 | + while (!autoriser('creerarticledans','rubrique',$row['id_rubrique'] ) && $row_rub = sql_fetch($res)){ |
|
| 81 | + $row['id_rubrique'] = $row_rub['id_rubrique']; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - // recuperer le secteur, pour affecter les bons champs extras |
|
| 88 | - if ($id_rubrique and $is_secteur) { |
|
| 89 | - if (!$row['id_secteur']) { |
|
| 90 | - $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique)); |
|
| 91 | - $row['id_secteur'] = $row_rub; |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - return $row; |
|
| 87 | + // recuperer le secteur, pour affecter les bons champs extras |
|
| 88 | + if ($id_rubrique and $is_secteur) { |
|
| 89 | + if (!$row['id_secteur']) { |
|
| 90 | + $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique)); |
|
| 91 | + $row['id_secteur'] = $row_rub; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + return $row; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -109,58 +109,58 @@ discard block |
||
| 109 | 109 | * @return array couples cles / valeurs des champs du formulaire à charger |
| 110 | 110 | **/ |
| 111 | 111 | function precharger_traduction_objet($type, $id_objet, $id_rubrique=0, $lier_trad=0, $champ_titre = 'titre') { |
| 112 | - $table = table_objet_sql($type); |
|
| 113 | - $_id_objet = id_table_objet($table); |
|
| 114 | - |
|
| 115 | - // Recuperer les donnees de l'objet original |
|
| 116 | - $row = sql_fetsel("*", $table, "$_id_objet=$lier_trad"); |
|
| 117 | - if ($row) { |
|
| 118 | - $row[$champ_titre] = filtrer_entites(_T('info_nouvelle_traduction')).' '.$row[$champ_titre]; |
|
| 119 | - } else { |
|
| 120 | - $row = array(); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - // on met l'objet dans une rubrique si l'objet le peut |
|
| 124 | - $desc = lister_tables_objets_sql($table); |
|
| 125 | - $is_rubrique = isset($desc['field']['id_rubrique']); |
|
| 112 | + $table = table_objet_sql($type); |
|
| 113 | + $_id_objet = id_table_objet($table); |
|
| 114 | + |
|
| 115 | + // Recuperer les donnees de l'objet original |
|
| 116 | + $row = sql_fetsel("*", $table, "$_id_objet=$lier_trad"); |
|
| 117 | + if ($row) { |
|
| 118 | + $row[$champ_titre] = filtrer_entites(_T('info_nouvelle_traduction')).' '.$row[$champ_titre]; |
|
| 119 | + } else { |
|
| 120 | + $row = array(); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + // on met l'objet dans une rubrique si l'objet le peut |
|
| 124 | + $desc = lister_tables_objets_sql($table); |
|
| 125 | + $is_rubrique = isset($desc['field']['id_rubrique']); |
|
| 126 | 126 | |
| 127 | - if ($is_rubrique) { |
|
| 128 | - if ($id_rubrique) { |
|
| 129 | - $row['id_rubrique'] = $id_rubrique; |
|
| 130 | - return $row; |
|
| 131 | - } |
|
| 132 | - $id_rubrique = $row['id_rubrique']; |
|
| 127 | + if ($is_rubrique) { |
|
| 128 | + if ($id_rubrique) { |
|
| 129 | + $row['id_rubrique'] = $id_rubrique; |
|
| 130 | + return $row; |
|
| 131 | + } |
|
| 132 | + $id_rubrique = $row['id_rubrique']; |
|
| 133 | 133 | |
| 134 | 134 | |
| 135 | - // Regler la langue, si possible, sur celle du redacteur |
|
| 136 | - // Cela implique souvent de choisir une rubrique ou un secteur |
|
| 137 | - if (in_array($GLOBALS['spip_lang'], |
|
| 138 | - explode(',', $GLOBALS['meta']['langues_multilingue']))) { |
|
| 139 | - |
|
| 140 | - // Si le menu de langues est autorise sur l'objet, |
|
| 141 | - // on peut changer la langue quelle que soit la rubrique |
|
| 142 | - // donc on reste dans la meme rubrique |
|
| 143 | - if (in_array($table, explode(',',$GLOBALS['meta']['multi_objets']))) { |
|
| 144 | - $row['id_rubrique'] = $row['id_rubrique']; # explicite :-) |
|
| 145 | - |
|
| 146 | - // Sinon, chercher la rubrique la plus adaptee pour |
|
| 147 | - // accueillir l'objet dans la langue du traducteur |
|
| 148 | - } elseif ($is_rubrique and $GLOBALS['meta']['multi_rubriques'] == 'oui') { |
|
| 149 | - if ($GLOBALS['meta']['multi_secteurs'] == 'oui') { |
|
| 150 | - $id_parent = 0; |
|
| 151 | - } else { |
|
| 152 | - // on cherche une rubrique soeur dans la bonne langue |
|
| 153 | - $row_rub = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$id_rubrique"); |
|
| 154 | - $id_parent = $row_rub['id_parent']; |
|
| 155 | - } |
|
| 135 | + // Regler la langue, si possible, sur celle du redacteur |
|
| 136 | + // Cela implique souvent de choisir une rubrique ou un secteur |
|
| 137 | + if (in_array($GLOBALS['spip_lang'], |
|
| 138 | + explode(',', $GLOBALS['meta']['langues_multilingue']))) { |
|
| 139 | + |
|
| 140 | + // Si le menu de langues est autorise sur l'objet, |
|
| 141 | + // on peut changer la langue quelle que soit la rubrique |
|
| 142 | + // donc on reste dans la meme rubrique |
|
| 143 | + if (in_array($table, explode(',',$GLOBALS['meta']['multi_objets']))) { |
|
| 144 | + $row['id_rubrique'] = $row['id_rubrique']; # explicite :-) |
|
| 145 | + |
|
| 146 | + // Sinon, chercher la rubrique la plus adaptee pour |
|
| 147 | + // accueillir l'objet dans la langue du traducteur |
|
| 148 | + } elseif ($is_rubrique and $GLOBALS['meta']['multi_rubriques'] == 'oui') { |
|
| 149 | + if ($GLOBALS['meta']['multi_secteurs'] == 'oui') { |
|
| 150 | + $id_parent = 0; |
|
| 151 | + } else { |
|
| 152 | + // on cherche une rubrique soeur dans la bonne langue |
|
| 153 | + $row_rub = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$id_rubrique"); |
|
| 154 | + $id_parent = $row_rub['id_parent']; |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "lang='".$GLOBALS['spip_lang']."' AND id_parent=$id_parent"); |
|
| 158 | - if ($row_rub) |
|
| 159 | - $row['id_rubrique'] = $row_rub['id_rubrique']; |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - return $row; |
|
| 157 | + $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "lang='".$GLOBALS['spip_lang']."' AND id_parent=$id_parent"); |
|
| 158 | + if ($row_rub) |
|
| 159 | + $row['id_rubrique'] = $row_rub['id_rubrique']; |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + return $row; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * dans la declaration de l'objet |
| 30 | 30 | * @return array couples cles / valeurs des champs du formulaire à charger. |
| 31 | 31 | **/ |
| 32 | -function precharger_objet($type, $id_objet, $id_rubrique=0, $lier_trad=0, $champ_titre = 'titre') { |
|
| 32 | +function precharger_objet($type, $id_objet, $id_rubrique = 0, $lier_trad = 0, $champ_titre = 'titre') { |
|
| 33 | 33 | global $connect_id_rubrique, $spip_lang; |
| 34 | 34 | |
| 35 | 35 | $table = table_objet_sql($type); |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // si demande de traduction |
| 51 | 51 | // on recupere les valeurs de la traduction |
| 52 | - if ($lier_trad){ |
|
| 53 | - if ($select = charger_fonction("precharger_traduction_" . $type,'inc',true)) |
|
| 52 | + if ($lier_trad) { |
|
| 53 | + if ($select = charger_fonction("precharger_traduction_".$type, 'inc', true)) |
|
| 54 | 54 | $row = $select($id_objet, $id_rubrique, $lier_trad); |
| 55 | 55 | else |
| 56 | 56 | $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "", "", "id_rubrique DESC", 1); |
| 75 | 75 | $row['id_rubrique'] = $id_rubrique = $row_rub['id_rubrique']; |
| 76 | 76 | } |
| 77 | - if (!autoriser('creerarticledans','rubrique',$row['id_rubrique'] )){ |
|
| 77 | + if (!autoriser('creerarticledans', 'rubrique', $row['id_rubrique'])) { |
|
| 78 | 78 | // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
| 79 | 79 | $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0"); |
| 80 | - while (!autoriser('creerarticledans','rubrique',$row['id_rubrique'] ) && $row_rub = sql_fetch($res)){ |
|
| 80 | + while (!autoriser('creerarticledans', 'rubrique', $row['id_rubrique']) && $row_rub = sql_fetch($res)) { |
|
| 81 | 81 | $row['id_rubrique'] = $row_rub['id_rubrique']; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | // recuperer le secteur, pour affecter les bons champs extras |
| 88 | 88 | if ($id_rubrique and $is_secteur) { |
| 89 | 89 | if (!$row['id_secteur']) { |
| 90 | - $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique)); |
|
| 90 | + $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=".sql_quote($id_rubrique)); |
|
| 91 | 91 | $row['id_secteur'] = $row_rub; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return array couples cles / valeurs des champs du formulaire à charger |
| 110 | 110 | **/ |
| 111 | -function precharger_traduction_objet($type, $id_objet, $id_rubrique=0, $lier_trad=0, $champ_titre = 'titre') { |
|
| 111 | +function precharger_traduction_objet($type, $id_objet, $id_rubrique = 0, $lier_trad = 0, $champ_titre = 'titre') { |
|
| 112 | 112 | $table = table_objet_sql($type); |
| 113 | 113 | $_id_objet = id_table_objet($table); |
| 114 | 114 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | // Si le menu de langues est autorise sur l'objet, |
| 141 | 141 | // on peut changer la langue quelle que soit la rubrique |
| 142 | 142 | // donc on reste dans la meme rubrique |
| 143 | - if (in_array($table, explode(',',$GLOBALS['meta']['multi_objets']))) { |
|
| 143 | + if (in_array($table, explode(',', $GLOBALS['meta']['multi_objets']))) { |
|
| 144 | 144 | $row['id_rubrique'] = $row['id_rubrique']; # explicite :-) |
| 145 | 145 | |
| 146 | 146 | // Sinon, chercher la rubrique la plus adaptee pour |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | include_spip('inc/autoriser'); // necessaire si appel de l'espace public |
| 16 | 18 | |
@@ -36,8 +38,9 @@ discard block |
||
| 36 | 38 | $_id_objet = id_table_objet($table); |
| 37 | 39 | |
| 38 | 40 | // si l'objet existe deja, on retourne simplement ses valeurs |
| 39 | - if (is_numeric($id_objet)) |
|
| 40 | - return sql_fetsel("*", $table, "$_id_objet=$id_objet"); |
|
| 41 | + if (is_numeric($id_objet)) { |
|
| 42 | + return sql_fetsel("*", $table, "$_id_objet=$id_objet"); |
|
| 43 | + } |
|
| 41 | 44 | |
| 42 | 45 | // ici, on demande une creation. |
| 43 | 46 | // on prerempli certains elements : les champs si traduction, |
@@ -50,10 +53,11 @@ discard block |
||
| 50 | 53 | // si demande de traduction |
| 51 | 54 | // on recupere les valeurs de la traduction |
| 52 | 55 | if ($lier_trad){ |
| 53 | - if ($select = charger_fonction("precharger_traduction_" . $type,'inc',true)) |
|
| 54 | - $row = $select($id_objet, $id_rubrique, $lier_trad); |
|
| 55 | - else |
|
| 56 | - $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
|
| 56 | + if ($select = charger_fonction("precharger_traduction_" . $type,'inc',true)) { |
|
| 57 | + $row = $select($id_objet, $id_rubrique, $lier_trad); |
|
| 58 | + } else { |
|
| 59 | + $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre); |
|
| 60 | + } |
|
| 57 | 61 | } else { |
| 58 | 62 | $row[$champ_titre] = ''; |
| 59 | 63 | if ($is_rubrique) { |
@@ -68,9 +72,9 @@ discard block |
||
| 68 | 72 | // admin restreint ==> sa premiere rubrique |
| 69 | 73 | // autre ==> la derniere rubrique cree |
| 70 | 74 | if (!$row['id_rubrique']) { |
| 71 | - if ($connect_id_rubrique) |
|
| 72 | - $row['id_rubrique'] = $id_rubrique = current($connect_id_rubrique); |
|
| 73 | - else { |
|
| 75 | + if ($connect_id_rubrique) { |
|
| 76 | + $row['id_rubrique'] = $id_rubrique = current($connect_id_rubrique); |
|
| 77 | + } else { |
|
| 74 | 78 | $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "", "", "id_rubrique DESC", 1); |
| 75 | 79 | $row['id_rubrique'] = $id_rubrique = $row_rub['id_rubrique']; |
| 76 | 80 | } |
@@ -155,8 +159,9 @@ discard block |
||
| 155 | 159 | } |
| 156 | 160 | |
| 157 | 161 | $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "lang='".$GLOBALS['spip_lang']."' AND id_parent=$id_parent"); |
| 158 | - if ($row_rub) |
|
| 159 | - $row['id_rubrique'] = $row_rub['id_rubrique']; |
|
| 162 | + if ($row_rub) { |
|
| 163 | + $row['id_rubrique'] = $row_rub['id_rubrique']; |
|
| 164 | + } |
|
| 160 | 165 | } |
| 161 | 166 | } |
| 162 | 167 | } |
@@ -18,88 +18,88 @@ |
||
| 18 | 18 | |
| 19 | 19 | // http://doc.spip.org/@inc_commencer_page_dist |
| 20 | 20 | function inc_commencer_page_dist($titre = "", $rubrique = "accueil", $sous_rubrique = "accueil", $id_rubrique = "",$menu=true,$minipres=false, $alertes = true) { |
| 21 | - global $connect_id_auteur; |
|
| 21 | + global $connect_id_auteur; |
|
| 22 | 22 | |
| 23 | - include_spip('inc/headers'); |
|
| 23 | + include_spip('inc/headers'); |
|
| 24 | 24 | |
| 25 | - http_no_cache(); |
|
| 25 | + http_no_cache(); |
|
| 26 | 26 | |
| 27 | - return init_entete($titre, $id_rubrique, $minipres) |
|
| 28 | - . init_body($rubrique, $sous_rubrique, $id_rubrique,$menu) |
|
| 29 | - . "<div id='page'>" |
|
| 30 | - . auteurs_recemment_connectes($connect_id_auteur) |
|
| 31 | - . ($alertes?alertes_auteur($connect_id_auteur):'') |
|
| 32 | - . '<div class="largeur">'; |
|
| 27 | + return init_entete($titre, $id_rubrique, $minipres) |
|
| 28 | + . init_body($rubrique, $sous_rubrique, $id_rubrique,$menu) |
|
| 29 | + . "<div id='page'>" |
|
| 30 | + . auteurs_recemment_connectes($connect_id_auteur) |
|
| 31 | + . ($alertes?alertes_auteur($connect_id_auteur):'') |
|
| 32 | + . '<div class="largeur">'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // envoi du doctype et du <head><title>...</head> |
| 36 | 36 | // http://doc.spip.org/@init_entete |
| 37 | 37 | function init_entete($titre='', $dummy=0, $minipres=false) { |
| 38 | - include_spip('inc/texte'); |
|
| 39 | - if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) |
|
| 40 | - $nom_site_spip= _T('info_mon_site_spip'); |
|
| 41 | - |
|
| 42 | - $titre = "[" |
|
| 43 | - . $nom_site_spip |
|
| 44 | - . "]" |
|
| 45 | - . ($titre ? " ".textebrut(typo($titre)):""); |
|
| 46 | - |
|
| 47 | - return _DOCTYPE_ECRIRE |
|
| 48 | - . html_lang_attributes() |
|
| 49 | - . "<head>\n" |
|
| 50 | - . init_head($titre, $dummy, $minipres) |
|
| 51 | - . "</head>\n"; |
|
| 38 | + include_spip('inc/texte'); |
|
| 39 | + if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) |
|
| 40 | + $nom_site_spip= _T('info_mon_site_spip'); |
|
| 41 | + |
|
| 42 | + $titre = "[" |
|
| 43 | + . $nom_site_spip |
|
| 44 | + . "]" |
|
| 45 | + . ($titre ? " ".textebrut(typo($titre)):""); |
|
| 46 | + |
|
| 47 | + return _DOCTYPE_ECRIRE |
|
| 48 | + . html_lang_attributes() |
|
| 49 | + . "<head>\n" |
|
| 50 | + . init_head($titre, $dummy, $minipres) |
|
| 51 | + . "</head>\n"; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function init_head($titre='', $dummy=0, $minipres=false) { |
| 55 | - return recuperer_fond("prive/squelettes/head/dist",array('titre'=>$titre,'minipres'=>$minipres?' ':'')); |
|
| 55 | + return recuperer_fond("prive/squelettes/head/dist",array('titre'=>$titre,'minipres'=>$minipres?' ':'')); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // fonction envoyant la double serie d'icones de redac |
| 59 | 59 | // http://doc.spip.org/@init_body |
| 60 | 60 | function init_body($rubrique='accueil', $sous_rubrique='accueil', $id_rubrique='',$menu=true) { |
| 61 | - global $connect_id_auteur, $auth_can_disconnect; |
|
| 61 | + global $connect_id_auteur, $auth_can_disconnect; |
|
| 62 | 62 | |
| 63 | - $res = pipeline('body_prive',"<body class='" |
|
| 64 | - . init_body_class()." "._request('exec')."'" |
|
| 65 | - . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : "") |
|
| 66 | - .'>'); |
|
| 63 | + $res = pipeline('body_prive',"<body class='" |
|
| 64 | + . init_body_class()." "._request('exec')."'" |
|
| 65 | + . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : "") |
|
| 66 | + .'>'); |
|
| 67 | 67 | |
| 68 | - if (!$menu) return $res; |
|
| 68 | + if (!$menu) return $res; |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 71 | + $bandeau = charger_fonction('bandeau', 'inc'); |
|
| 72 | 72 | |
| 73 | - return $res |
|
| 74 | - . $bandeau(); |
|
| 73 | + return $res |
|
| 74 | + . $bandeau(); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | function init_body_class() { |
| 78 | - $GLOBALS['spip_display'] = isset($GLOBALS['visiteur_session']['prefs']['display']) |
|
| 79 | - ? $GLOBALS['visiteur_session']['prefs']['display'] |
|
| 80 | - : 2; |
|
| 81 | - $spip_display_navigation = isset($GLOBALS['visiteur_session']['prefs']['display_navigation']) |
|
| 82 | - ? $GLOBALS['visiteur_session']['prefs']['display_navigation'] |
|
| 83 | - : 'navigation_avec_icones'; |
|
| 84 | - $spip_display_outils = isset($GLOBALS['visiteur_session']['prefs']['display_outils']) |
|
| 85 | - ? ($GLOBALS['visiteur_session']['prefs']['display_outils']?'navigation_avec_outils':'navigation_sans_outils') |
|
| 86 | - : 'navigation_avec_outils'; |
|
| 87 | - $GLOBALS['spip_ecran'] = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : "etroit"; |
|
| 88 | - |
|
| 89 | - $display_class=array(0=>'icones_img_texte'/*init*/,1=>'icones_texte',2=>'icones_img_texte',3=>'icones_img'); |
|
| 90 | - return $GLOBALS['spip_ecran'] . " $spip_display_navigation $spip_display_outils ".$display_class[$GLOBALS['spip_display']]; |
|
| 78 | + $GLOBALS['spip_display'] = isset($GLOBALS['visiteur_session']['prefs']['display']) |
|
| 79 | + ? $GLOBALS['visiteur_session']['prefs']['display'] |
|
| 80 | + : 2; |
|
| 81 | + $spip_display_navigation = isset($GLOBALS['visiteur_session']['prefs']['display_navigation']) |
|
| 82 | + ? $GLOBALS['visiteur_session']['prefs']['display_navigation'] |
|
| 83 | + : 'navigation_avec_icones'; |
|
| 84 | + $spip_display_outils = isset($GLOBALS['visiteur_session']['prefs']['display_outils']) |
|
| 85 | + ? ($GLOBALS['visiteur_session']['prefs']['display_outils']?'navigation_avec_outils':'navigation_sans_outils') |
|
| 86 | + : 'navigation_avec_outils'; |
|
| 87 | + $GLOBALS['spip_ecran'] = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : "etroit"; |
|
| 88 | + |
|
| 89 | + $display_class=array(0=>'icones_img_texte'/*init*/,1=>'icones_texte',2=>'icones_img_texte',3=>'icones_img'); |
|
| 90 | + return $GLOBALS['spip_ecran'] . " $spip_display_navigation $spip_display_outils ".$display_class[$GLOBALS['spip_display']]; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | // http://doc.spip.org/@lien_change_var |
| 95 | 95 | function lien_change_var($lien, $set, $couleur, $coords, $titre, $mouseOver="") { |
| 96 | - $lien = parametre_url($lien, $set, $couleur); |
|
| 97 | - return "\n<area shape='rect' href='$lien' coords='$coords' title=\"$titre\" alt=\"$titre\" $mouseOver />"; |
|
| 96 | + $lien = parametre_url($lien, $set, $couleur); |
|
| 97 | + return "\n<area shape='rect' href='$lien' coords='$coords' title=\"$titre\" alt=\"$titre\" $mouseOver />"; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // http://doc.spip.org/@auteurs_recemment_connectes |
| 101 | 101 | function auteurs_recemment_connectes($id_auteur){ |
| 102 | - return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 102 | + return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | ?> |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // |
| 16 | 18 | // Presentation de l'interface privee, debut du HTML |
@@ -36,8 +38,9 @@ discard block |
||
| 36 | 38 | // http://doc.spip.org/@init_entete |
| 37 | 39 | function init_entete($titre='', $dummy=0, $minipres=false) { |
| 38 | 40 | include_spip('inc/texte'); |
| 39 | - if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) |
|
| 40 | - $nom_site_spip= _T('info_mon_site_spip'); |
|
| 41 | + if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) { |
|
| 42 | + $nom_site_spip= _T('info_mon_site_spip'); |
|
| 43 | + } |
|
| 41 | 44 | |
| 42 | 45 | $titre = "[" |
| 43 | 46 | . $nom_site_spip |
@@ -65,7 +68,9 @@ discard block |
||
| 65 | 68 | . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : "") |
| 66 | 69 | .'>'); |
| 67 | 70 | |
| 68 | - if (!$menu) return $res; |
|
| 71 | + if (!$menu) { |
|
| 72 | + return $res; |
|
| 73 | + } |
|
| 69 | 74 | |
| 70 | 75 | |
| 71 | 76 | $bandeau = charger_fonction('bandeau', 'inc'); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | // |
| 18 | 18 | |
| 19 | 19 | // http://doc.spip.org/@inc_commencer_page_dist |
| 20 | -function inc_commencer_page_dist($titre = "", $rubrique = "accueil", $sous_rubrique = "accueil", $id_rubrique = "",$menu=true,$minipres=false, $alertes = true) { |
|
| 20 | +function inc_commencer_page_dist($titre = "", $rubrique = "accueil", $sous_rubrique = "accueil", $id_rubrique = "", $menu = true, $minipres = false, $alertes = true) { |
|
| 21 | 21 | global $connect_id_auteur; |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/headers'); |
@@ -25,24 +25,24 @@ discard block |
||
| 25 | 25 | http_no_cache(); |
| 26 | 26 | |
| 27 | 27 | return init_entete($titre, $id_rubrique, $minipres) |
| 28 | - . init_body($rubrique, $sous_rubrique, $id_rubrique,$menu) |
|
| 28 | + . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu) |
|
| 29 | 29 | . "<div id='page'>" |
| 30 | 30 | . auteurs_recemment_connectes($connect_id_auteur) |
| 31 | - . ($alertes?alertes_auteur($connect_id_auteur):'') |
|
| 31 | + . ($alertes ?alertes_auteur($connect_id_auteur) : '') |
|
| 32 | 32 | . '<div class="largeur">'; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // envoi du doctype et du <head><title>...</head> |
| 36 | 36 | // http://doc.spip.org/@init_entete |
| 37 | -function init_entete($titre='', $dummy=0, $minipres=false) { |
|
| 37 | +function init_entete($titre = '', $dummy = 0, $minipres = false) { |
|
| 38 | 38 | include_spip('inc/texte'); |
| 39 | 39 | if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) |
| 40 | - $nom_site_spip= _T('info_mon_site_spip'); |
|
| 40 | + $nom_site_spip = _T('info_mon_site_spip'); |
|
| 41 | 41 | |
| 42 | 42 | $titre = "[" |
| 43 | 43 | . $nom_site_spip |
| 44 | 44 | . "]" |
| 45 | - . ($titre ? " ".textebrut(typo($titre)):""); |
|
| 45 | + . ($titre ? " ".textebrut(typo($titre)) : ""); |
|
| 46 | 46 | |
| 47 | 47 | return _DOCTYPE_ECRIRE |
| 48 | 48 | . html_lang_attributes() |
@@ -51,16 +51,16 @@ discard block |
||
| 51 | 51 | . "</head>\n"; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -function init_head($titre='', $dummy=0, $minipres=false) { |
|
| 55 | - return recuperer_fond("prive/squelettes/head/dist",array('titre'=>$titre,'minipres'=>$minipres?' ':'')); |
|
| 54 | +function init_head($titre = '', $dummy = 0, $minipres = false) { |
|
| 55 | + return recuperer_fond("prive/squelettes/head/dist", array('titre'=>$titre, 'minipres'=>$minipres ? ' ' : '')); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // fonction envoyant la double serie d'icones de redac |
| 59 | 59 | // http://doc.spip.org/@init_body |
| 60 | -function init_body($rubrique='accueil', $sous_rubrique='accueil', $id_rubrique='',$menu=true) { |
|
| 60 | +function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) { |
|
| 61 | 61 | global $connect_id_auteur, $auth_can_disconnect; |
| 62 | 62 | |
| 63 | - $res = pipeline('body_prive',"<body class='" |
|
| 63 | + $res = pipeline('body_prive', "<body class='" |
|
| 64 | 64 | . init_body_class()." "._request('exec')."'" |
| 65 | 65 | . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : "") |
| 66 | 66 | .'>'); |
@@ -82,23 +82,23 @@ discard block |
||
| 82 | 82 | ? $GLOBALS['visiteur_session']['prefs']['display_navigation'] |
| 83 | 83 | : 'navigation_avec_icones'; |
| 84 | 84 | $spip_display_outils = isset($GLOBALS['visiteur_session']['prefs']['display_outils']) |
| 85 | - ? ($GLOBALS['visiteur_session']['prefs']['display_outils']?'navigation_avec_outils':'navigation_sans_outils') |
|
| 85 | + ? ($GLOBALS['visiteur_session']['prefs']['display_outils'] ? 'navigation_avec_outils' : 'navigation_sans_outils') |
|
| 86 | 86 | : 'navigation_avec_outils'; |
| 87 | 87 | $GLOBALS['spip_ecran'] = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : "etroit"; |
| 88 | 88 | |
| 89 | - $display_class=array(0=>'icones_img_texte'/*init*/,1=>'icones_texte',2=>'icones_img_texte',3=>'icones_img'); |
|
| 90 | - return $GLOBALS['spip_ecran'] . " $spip_display_navigation $spip_display_outils ".$display_class[$GLOBALS['spip_display']]; |
|
| 89 | + $display_class = array(0=>'icones_img_texte'/*init*/, 1=>'icones_texte', 2=>'icones_img_texte', 3=>'icones_img'); |
|
| 90 | + return $GLOBALS['spip_ecran']." $spip_display_navigation $spip_display_outils ".$display_class[$GLOBALS['spip_display']]; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | // http://doc.spip.org/@lien_change_var |
| 95 | -function lien_change_var($lien, $set, $couleur, $coords, $titre, $mouseOver="") { |
|
| 95 | +function lien_change_var($lien, $set, $couleur, $coords, $titre, $mouseOver = "") { |
|
| 96 | 96 | $lien = parametre_url($lien, $set, $couleur); |
| 97 | 97 | return "\n<area shape='rect' href='$lien' coords='$coords' title=\"$titre\" alt=\"$titre\" $mouseOver />"; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // http://doc.spip.org/@auteurs_recemment_connectes |
| 101 | -function auteurs_recemment_connectes($id_auteur){ |
|
| 101 | +function auteurs_recemment_connectes($id_auteur) { |
|
| 102 | 102 | return recuperer_fond('prive/objets/liste/auteurs_enligne'); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -21,28 +21,28 @@ discard block |
||
| 21 | 21 | * @return array |
| 22 | 22 | */ |
| 23 | 23 | function cvtconf_formulaire_charger($flux){ |
| 24 | - if ( |
|
| 25 | - $form = $flux['args']['form'] |
|
| 26 | - and strncmp($form,'configurer_',11)==0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 27 | - ) { |
|
| 28 | - // Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé |
|
| 29 | - include_spip('inc/autoriser'); |
|
| 30 | - if (!autoriser('configurer', '_'.substr($form,11))) { |
|
| 31 | - return false; |
|
| 32 | - } |
|
| 24 | + if ( |
|
| 25 | + $form = $flux['args']['form'] |
|
| 26 | + and strncmp($form,'configurer_',11)==0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 27 | + ) { |
|
| 28 | + // Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé |
|
| 29 | + include_spip('inc/autoriser'); |
|
| 30 | + if (!autoriser('configurer', '_'.substr($form,11))) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - // S'il n'y a pas de fonction charger(), on génère un contexte automatiquement |
|
| 35 | - if (!charger_fonction("charger","formulaires/$form/",true)) { |
|
| 36 | - $flux['data'] = cvtconf_formulaires_configurer_recense($form); |
|
| 37 | - $flux['data']['editable'] = true; |
|
| 38 | - if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
|
| 39 | - if (!_AJAX) var_dump($flux['data']); |
|
| 40 | - // reinjecter pour la trace au traitement |
|
| 41 | - $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />"; |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - return $flux; |
|
| 34 | + // S'il n'y a pas de fonction charger(), on génère un contexte automatiquement |
|
| 35 | + if (!charger_fonction("charger","formulaires/$form/",true)) { |
|
| 36 | + $flux['data'] = cvtconf_formulaires_configurer_recense($form); |
|
| 37 | + $flux['data']['editable'] = true; |
|
| 38 | + if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
|
| 39 | + if (!_AJAX) var_dump($flux['data']); |
|
| 40 | + // reinjecter pour la trace au traitement |
|
| 41 | + $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />"; |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + return $flux; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | * @return array |
| 53 | 53 | */ |
| 54 | 54 | function cvtconf_formulaire_traiter($flux){ |
| 55 | - if ($form = $flux['args']['form'] |
|
| 56 | - AND strncmp($form,'configurer_',11)==0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 57 | - AND !charger_fonction("traiter","formulaires/$form/",true) // sans fonction traiter() |
|
| 58 | - ) { |
|
| 59 | - $trace = cvtconf_formulaires_configurer_enregistre($form,$flux['args']['args']); |
|
| 60 | - $flux['data'] = array('message_ok'=>_T('config_info_enregistree').$trace,'editable'=>true); |
|
| 61 | - } |
|
| 62 | - return $flux; |
|
| 55 | + if ($form = $flux['args']['form'] |
|
| 56 | + AND strncmp($form,'configurer_',11)==0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 57 | + AND !charger_fonction("traiter","formulaires/$form/",true) // sans fonction traiter() |
|
| 58 | + ) { |
|
| 59 | + $trace = cvtconf_formulaires_configurer_enregistre($form,$flux['args']['args']); |
|
| 60 | + $flux['data'] = array('message_ok'=>_T('config_info_enregistree').$trace,'editable'=>true); |
|
| 61 | + } |
|
| 62 | + return $flux; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -75,29 +75,29 @@ discard block |
||
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | 77 | function cvtconf_formulaires_configurer_enregistre($form,$args){ |
| 78 | - $valeurs = array(); |
|
| 79 | - // charger les valeurs |
|
| 80 | - // ce qui permet de prendre en charge une fonction charger() existante |
|
| 81 | - // qui prend alors la main sur l'auto detection |
|
| 82 | - if ($charger_valeurs = charger_fonction("charger","formulaires/$form/",true)) |
|
| 83 | - $valeurs = call_user_func_array($charger_valeurs,$args); |
|
| 84 | - $valeurs = pipeline( |
|
| 85 | - 'formulaire_charger', |
|
| 86 | - array( |
|
| 87 | - 'args'=>array('form'=>$form,'args'=>$args,'je_suis_poste'=>false), |
|
| 88 | - 'data'=>$valeurs) |
|
| 89 | - ); |
|
| 90 | - // ne pas stocker editable ! |
|
| 91 | - unset($valeurs['editable']); |
|
| 92 | - |
|
| 93 | - // recuperer les valeurs postees |
|
| 94 | - $store = array(); |
|
| 95 | - foreach($valeurs as $k=>$v){ |
|
| 96 | - if (substr($k,0,1)!=='_') |
|
| 97 | - $store[$k] = _request($k); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - return cvtconf_configurer_stocker($form,$valeurs,$store); |
|
| 78 | + $valeurs = array(); |
|
| 79 | + // charger les valeurs |
|
| 80 | + // ce qui permet de prendre en charge une fonction charger() existante |
|
| 81 | + // qui prend alors la main sur l'auto detection |
|
| 82 | + if ($charger_valeurs = charger_fonction("charger","formulaires/$form/",true)) |
|
| 83 | + $valeurs = call_user_func_array($charger_valeurs,$args); |
|
| 84 | + $valeurs = pipeline( |
|
| 85 | + 'formulaire_charger', |
|
| 86 | + array( |
|
| 87 | + 'args'=>array('form'=>$form,'args'=>$args,'je_suis_poste'=>false), |
|
| 88 | + 'data'=>$valeurs) |
|
| 89 | + ); |
|
| 90 | + // ne pas stocker editable ! |
|
| 91 | + unset($valeurs['editable']); |
|
| 92 | + |
|
| 93 | + // recuperer les valeurs postees |
|
| 94 | + $store = array(); |
|
| 95 | + foreach($valeurs as $k=>$v){ |
|
| 96 | + if (substr($k,0,1)!=='_') |
|
| 97 | + $store[$k] = _request($k); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + return cvtconf_configurer_stocker($form,$valeurs,$store); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,25 +113,25 @@ discard block |
||
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | 115 | function cvtconf_definir_configurer_conteneur($form,$valeurs) { |
| 116 | - // stocker en base |
|
| 117 | - // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 118 | - $casier = substr($form,11); |
|
| 119 | - $table = 'meta'; |
|
| 120 | - $prefixe = ''; |
|
| 121 | - $stockage = ''; |
|
| 122 | - |
|
| 123 | - if (isset($valeurs['_meta_casier'])) $casier = $valeurs['_meta_casier']; |
|
| 124 | - if (isset($valeurs['_meta_prefixe'])) $prefixe = $valeurs['_meta_prefixe']; |
|
| 125 | - if (isset($valeurs['_meta_stockage'])) $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 116 | + // stocker en base |
|
| 117 | + // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 118 | + $casier = substr($form,11); |
|
| 119 | + $table = 'meta'; |
|
| 120 | + $prefixe = ''; |
|
| 121 | + $stockage = ''; |
|
| 122 | + |
|
| 123 | + if (isset($valeurs['_meta_casier'])) $casier = $valeurs['_meta_casier']; |
|
| 124 | + if (isset($valeurs['_meta_prefixe'])) $prefixe = $valeurs['_meta_prefixe']; |
|
| 125 | + if (isset($valeurs['_meta_stockage'])) $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 126 | 126 | |
| 127 | - // si on indique juste une table, il faut vider les autres proprietes |
|
| 128 | - // car par defaut on utilise ni casier ni prefixe dans ce cas |
|
| 129 | - if (isset($valeurs['_meta_table'])) { |
|
| 130 | - $table = $valeurs['_meta_table']; |
|
| 131 | - $casier = (isset($valeurs['_meta_casier'])?$valeurs['_meta_casier']:''); |
|
| 132 | - } |
|
| 127 | + // si on indique juste une table, il faut vider les autres proprietes |
|
| 128 | + // car par defaut on utilise ni casier ni prefixe dans ce cas |
|
| 129 | + if (isset($valeurs['_meta_table'])) { |
|
| 130 | + $table = $valeurs['_meta_table']; |
|
| 131 | + $casier = (isset($valeurs['_meta_casier'])?$valeurs['_meta_casier']:''); |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - return array($table,$casier,$prefixe,$stockage); |
|
| 134 | + return array($table,$casier,$prefixe,$stockage); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -142,39 +142,39 @@ discard block |
||
| 142 | 142 | * @return array |
| 143 | 143 | */ |
| 144 | 144 | function cvtconf_formulaires_configurer_recense($form){ |
| 145 | - $valeurs = array('editable'=>' '); |
|
| 146 | - |
|
| 147 | - // sinon cas analyse du squelette |
|
| 148 | - if ($f = find_in_path($form.'.' . _EXTENSION_SQUELETTES, 'formulaires/') |
|
| 149 | - AND lire_fichier($f, $contenu)) { |
|
| 150 | - |
|
| 151 | - for ($i=0;$i<2;$i++) { |
|
| 152 | - // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees |
|
| 153 | - // permet de trouver aussi les name="#GET{truc}" |
|
| 154 | - if ($i==1) $contenu = recuperer_fond("formulaires/$form",$valeurs); |
|
| 155 | - |
|
| 156 | - $balises = array_merge(extraire_balises($contenu,'input'), |
|
| 157 | - extraire_balises($contenu,'textarea'), |
|
| 158 | - extraire_balises($contenu,'select')); |
|
| 159 | - |
|
| 160 | - foreach($balises as $b) { |
|
| 161 | - if ($n = extraire_attribut($b, 'name') |
|
| 162 | - AND preg_match(",^([\w\-]+)(\[\w*\])?$,",$n,$r) |
|
| 163 | - AND !in_array($n,array('formulaire_action','formulaire_action_args')) |
|
| 164 | - AND extraire_attribut($b,'type')!=='submit') { |
|
| 165 | - $valeurs[$r[1]] = ''; |
|
| 166 | - // recuperer les valeurs _meta_xx qui peuvent etre fournies |
|
| 167 | - // en input hidden dans le squelette |
|
| 168 | - if (strncmp($r[1],'_meta_',6)==0) |
|
| 169 | - $valeurs[$r[1]] = extraire_attribut($b,'value'); |
|
| 170 | - } |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - |
|
| 176 | - cvtconf_configurer_lire_meta($form,$valeurs); |
|
| 177 | - return $valeurs; |
|
| 145 | + $valeurs = array('editable'=>' '); |
|
| 146 | + |
|
| 147 | + // sinon cas analyse du squelette |
|
| 148 | + if ($f = find_in_path($form.'.' . _EXTENSION_SQUELETTES, 'formulaires/') |
|
| 149 | + AND lire_fichier($f, $contenu)) { |
|
| 150 | + |
|
| 151 | + for ($i=0;$i<2;$i++) { |
|
| 152 | + // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees |
|
| 153 | + // permet de trouver aussi les name="#GET{truc}" |
|
| 154 | + if ($i==1) $contenu = recuperer_fond("formulaires/$form",$valeurs); |
|
| 155 | + |
|
| 156 | + $balises = array_merge(extraire_balises($contenu,'input'), |
|
| 157 | + extraire_balises($contenu,'textarea'), |
|
| 158 | + extraire_balises($contenu,'select')); |
|
| 159 | + |
|
| 160 | + foreach($balises as $b) { |
|
| 161 | + if ($n = extraire_attribut($b, 'name') |
|
| 162 | + AND preg_match(",^([\w\-]+)(\[\w*\])?$,",$n,$r) |
|
| 163 | + AND !in_array($n,array('formulaire_action','formulaire_action_args')) |
|
| 164 | + AND extraire_attribut($b,'type')!=='submit') { |
|
| 165 | + $valeurs[$r[1]] = ''; |
|
| 166 | + // recuperer les valeurs _meta_xx qui peuvent etre fournies |
|
| 167 | + // en input hidden dans le squelette |
|
| 168 | + if (strncmp($r[1],'_meta_',6)==0) |
|
| 169 | + $valeurs[$r[1]] = extraire_attribut($b,'value'); |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + |
|
| 176 | + cvtconf_configurer_lire_meta($form,$valeurs); |
|
| 177 | + return $valeurs; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -185,24 +185,24 @@ discard block |
||
| 185 | 185 | * @return string |
| 186 | 186 | */ |
| 187 | 187 | function cvtconf_configurer_stocker($form,$valeurs,$store) { |
| 188 | - $trace = ''; |
|
| 189 | - list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
|
| 190 | - // stocker en base |
|
| 191 | - // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 192 | - if (!isset($GLOBALS[$table])) |
|
| 193 | - lire_metas($table); |
|
| 194 | - |
|
| 195 | - $prefixe = ($prefixe?$prefixe.'_':''); |
|
| 196 | - $table = ($table) ? "/$table/" : ""; |
|
| 197 | - $casier = ($casier) ? rtrim($casier,'/').'/' : ""; // slash final, sinon rien |
|
| 188 | + $trace = ''; |
|
| 189 | + list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
|
| 190 | + // stocker en base |
|
| 191 | + // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
|
| 192 | + if (!isset($GLOBALS[$table])) |
|
| 193 | + lire_metas($table); |
|
| 194 | + |
|
| 195 | + $prefixe = ($prefixe?$prefixe.'_':''); |
|
| 196 | + $table = ($table) ? "/$table/" : ""; |
|
| 197 | + $casier = ($casier) ? rtrim($casier,'/').'/' : ""; // slash final, sinon rien |
|
| 198 | 198 | |
| 199 | - foreach($store as $k=>$v){ |
|
| 200 | - ecrire_config("$stockage$table$prefixe$casier$k", $v); |
|
| 201 | - if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
|
| 202 | - $trace .= "<br />table $table : ".$prefixe.$k." = $v;"; |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - return $trace; |
|
| 199 | + foreach($store as $k=>$v){ |
|
| 200 | + ecrire_config("$stockage$table$prefixe$casier$k", $v); |
|
| 201 | + if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
|
| 202 | + $trace .= "<br />table $table : ".$prefixe.$k." = $v;"; |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + return $trace; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -211,23 +211,23 @@ discard block |
||
| 211 | 211 | * @param array $valeurs |
| 212 | 212 | */ |
| 213 | 213 | function cvtconf_configurer_lire_meta($form,&$valeurs) { |
| 214 | - list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
|
| 215 | - |
|
| 216 | - $table = ($table) ? "/$table/" : ""; |
|
| 217 | - $prefixe = ($prefixe?$prefixe.'_':''); |
|
| 218 | - if ($casier) { |
|
| 219 | - $meta = lire_config("$stockage$table$prefixe$casier"); |
|
| 220 | - $prefixe = ''; |
|
| 221 | - } |
|
| 222 | - else { |
|
| 223 | - $table = rtrim($table, '/'); |
|
| 224 | - $meta = lire_config("$stockage$table"); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - foreach($valeurs as $k=>$v){ |
|
| 228 | - if (substr($k,0,1)!=='_') |
|
| 229 | - $valeurs[$k] = (isset($meta[$prefixe.$k])?$meta[$prefixe.$k]:''); |
|
| 230 | - } |
|
| 214 | + list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
|
| 215 | + |
|
| 216 | + $table = ($table) ? "/$table/" : ""; |
|
| 217 | + $prefixe = ($prefixe?$prefixe.'_':''); |
|
| 218 | + if ($casier) { |
|
| 219 | + $meta = lire_config("$stockage$table$prefixe$casier"); |
|
| 220 | + $prefixe = ''; |
|
| 221 | + } |
|
| 222 | + else { |
|
| 223 | + $table = rtrim($table, '/'); |
|
| 224 | + $meta = lire_config("$stockage$table"); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + foreach($valeurs as $k=>$v){ |
|
| 228 | + if (substr($k,0,1)!=='_') |
|
| 229 | + $valeurs[$k] = (isset($meta[$prefixe.$k])?$meta[$prefixe.$k]:''); |
|
| 230 | + } |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | * @param array $flux |
| 21 | 21 | * @return array |
| 22 | 22 | */ |
| 23 | -function cvtconf_formulaire_charger($flux){ |
|
| 23 | +function cvtconf_formulaire_charger($flux) { |
|
| 24 | 24 | if ( |
| 25 | 25 | $form = $flux['args']['form'] |
| 26 | - and strncmp($form,'configurer_',11)==0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 26 | + and strncmp($form, 'configurer_', 11) == 0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 27 | 27 | ) { |
| 28 | 28 | // Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé |
| 29 | 29 | include_spip('inc/autoriser'); |
| 30 | - if (!autoriser('configurer', '_'.substr($form,11))) { |
|
| 30 | + if (!autoriser('configurer', '_'.substr($form, 11))) { |
|
| 31 | 31 | return false; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // S'il n'y a pas de fonction charger(), on génère un contexte automatiquement |
| 35 | - if (!charger_fonction("charger","formulaires/$form/",true)) { |
|
| 35 | + if (!charger_fonction("charger", "formulaires/$form/", true)) { |
|
| 36 | 36 | $flux['data'] = cvtconf_formulaires_configurer_recense($form); |
| 37 | 37 | $flux['data']['editable'] = true; |
| 38 | - if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
|
| 38 | + if (_request('var_mode') == 'configurer' AND autoriser('webmestre')) { |
|
| 39 | 39 | if (!_AJAX) var_dump($flux['data']); |
| 40 | 40 | // reinjecter pour la trace au traitement |
| 41 | 41 | $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />"; |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | * @param array $flux |
| 52 | 52 | * @return array |
| 53 | 53 | */ |
| 54 | -function cvtconf_formulaire_traiter($flux){ |
|
| 54 | +function cvtconf_formulaire_traiter($flux) { |
|
| 55 | 55 | if ($form = $flux['args']['form'] |
| 56 | - AND strncmp($form,'configurer_',11)==0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 57 | - AND !charger_fonction("traiter","formulaires/$form/",true) // sans fonction traiter() |
|
| 56 | + AND strncmp($form, 'configurer_', 11) == 0 // un #FORMULAIRE_CONFIGURER_XXX |
|
| 57 | + AND !charger_fonction("traiter", "formulaires/$form/", true) // sans fonction traiter() |
|
| 58 | 58 | ) { |
| 59 | - $trace = cvtconf_formulaires_configurer_enregistre($form,$flux['args']['args']); |
|
| 60 | - $flux['data'] = array('message_ok'=>_T('config_info_enregistree').$trace,'editable'=>true); |
|
| 59 | + $trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']); |
|
| 60 | + $flux['data'] = array('message_ok'=>_T('config_info_enregistree').$trace, 'editable'=>true); |
|
| 61 | 61 | } |
| 62 | 62 | return $flux; |
| 63 | 63 | } |
@@ -74,17 +74,17 @@ discard block |
||
| 74 | 74 | * arguments de l'appel de la fonction traiter ($args = func_get_args();) |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | -function cvtconf_formulaires_configurer_enregistre($form,$args){ |
|
| 77 | +function cvtconf_formulaires_configurer_enregistre($form, $args) { |
|
| 78 | 78 | $valeurs = array(); |
| 79 | 79 | // charger les valeurs |
| 80 | 80 | // ce qui permet de prendre en charge une fonction charger() existante |
| 81 | 81 | // qui prend alors la main sur l'auto detection |
| 82 | - if ($charger_valeurs = charger_fonction("charger","formulaires/$form/",true)) |
|
| 83 | - $valeurs = call_user_func_array($charger_valeurs,$args); |
|
| 82 | + if ($charger_valeurs = charger_fonction("charger", "formulaires/$form/", true)) |
|
| 83 | + $valeurs = call_user_func_array($charger_valeurs, $args); |
|
| 84 | 84 | $valeurs = pipeline( |
| 85 | 85 | 'formulaire_charger', |
| 86 | 86 | array( |
| 87 | - 'args'=>array('form'=>$form,'args'=>$args,'je_suis_poste'=>false), |
|
| 87 | + 'args'=>array('form'=>$form, 'args'=>$args, 'je_suis_poste'=>false), |
|
| 88 | 88 | 'data'=>$valeurs) |
| 89 | 89 | ); |
| 90 | 90 | // ne pas stocker editable ! |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // recuperer les valeurs postees |
| 94 | 94 | $store = array(); |
| 95 | - foreach($valeurs as $k=>$v){ |
|
| 96 | - if (substr($k,0,1)!=='_') |
|
| 95 | + foreach ($valeurs as $k=>$v) { |
|
| 96 | + if (substr($k, 0, 1) !== '_') |
|
| 97 | 97 | $store[$k] = _request($k); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - return cvtconf_configurer_stocker($form,$valeurs,$store); |
|
| 100 | + return cvtconf_configurer_stocker($form, $valeurs, $store); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -112,26 +112,26 @@ discard block |
||
| 112 | 112 | * @param array $valeurs |
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | -function cvtconf_definir_configurer_conteneur($form,$valeurs) { |
|
| 115 | +function cvtconf_definir_configurer_conteneur($form, $valeurs) { |
|
| 116 | 116 | // stocker en base |
| 117 | 117 | // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
| 118 | - $casier = substr($form,11); |
|
| 118 | + $casier = substr($form, 11); |
|
| 119 | 119 | $table = 'meta'; |
| 120 | 120 | $prefixe = ''; |
| 121 | 121 | $stockage = ''; |
| 122 | 122 | |
| 123 | 123 | if (isset($valeurs['_meta_casier'])) $casier = $valeurs['_meta_casier']; |
| 124 | 124 | if (isset($valeurs['_meta_prefixe'])) $prefixe = $valeurs['_meta_prefixe']; |
| 125 | - if (isset($valeurs['_meta_stockage'])) $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 125 | + if (isset($valeurs['_meta_stockage'])) $stockage = $valeurs['_meta_stockage'].'::'; |
|
| 126 | 126 | |
| 127 | 127 | // si on indique juste une table, il faut vider les autres proprietes |
| 128 | 128 | // car par defaut on utilise ni casier ni prefixe dans ce cas |
| 129 | 129 | if (isset($valeurs['_meta_table'])) { |
| 130 | 130 | $table = $valeurs['_meta_table']; |
| 131 | - $casier = (isset($valeurs['_meta_casier'])?$valeurs['_meta_casier']:''); |
|
| 131 | + $casier = (isset($valeurs['_meta_casier']) ? $valeurs['_meta_casier'] : ''); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - return array($table,$casier,$prefixe,$stockage); |
|
| 134 | + return array($table, $casier, $prefixe, $stockage); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -141,39 +141,39 @@ discard block |
||
| 141 | 141 | * @param string $form |
| 142 | 142 | * @return array |
| 143 | 143 | */ |
| 144 | -function cvtconf_formulaires_configurer_recense($form){ |
|
| 144 | +function cvtconf_formulaires_configurer_recense($form) { |
|
| 145 | 145 | $valeurs = array('editable'=>' '); |
| 146 | 146 | |
| 147 | 147 | // sinon cas analyse du squelette |
| 148 | - if ($f = find_in_path($form.'.' . _EXTENSION_SQUELETTES, 'formulaires/') |
|
| 148 | + if ($f = find_in_path($form.'.'._EXTENSION_SQUELETTES, 'formulaires/') |
|
| 149 | 149 | AND lire_fichier($f, $contenu)) { |
| 150 | 150 | |
| 151 | - for ($i=0;$i<2;$i++) { |
|
| 151 | + for ($i = 0; $i < 2; $i++) { |
|
| 152 | 152 | // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees |
| 153 | 153 | // permet de trouver aussi les name="#GET{truc}" |
| 154 | - if ($i==1) $contenu = recuperer_fond("formulaires/$form",$valeurs); |
|
| 154 | + if ($i == 1) $contenu = recuperer_fond("formulaires/$form", $valeurs); |
|
| 155 | 155 | |
| 156 | - $balises = array_merge(extraire_balises($contenu,'input'), |
|
| 157 | - extraire_balises($contenu,'textarea'), |
|
| 158 | - extraire_balises($contenu,'select')); |
|
| 156 | + $balises = array_merge(extraire_balises($contenu, 'input'), |
|
| 157 | + extraire_balises($contenu, 'textarea'), |
|
| 158 | + extraire_balises($contenu, 'select')); |
|
| 159 | 159 | |
| 160 | - foreach($balises as $b) { |
|
| 160 | + foreach ($balises as $b) { |
|
| 161 | 161 | if ($n = extraire_attribut($b, 'name') |
| 162 | - AND preg_match(",^([\w\-]+)(\[\w*\])?$,",$n,$r) |
|
| 163 | - AND !in_array($n,array('formulaire_action','formulaire_action_args')) |
|
| 164 | - AND extraire_attribut($b,'type')!=='submit') { |
|
| 162 | + AND preg_match(",^([\w\-]+)(\[\w*\])?$,", $n, $r) |
|
| 163 | + AND !in_array($n, array('formulaire_action', 'formulaire_action_args')) |
|
| 164 | + AND extraire_attribut($b, 'type') !== 'submit') { |
|
| 165 | 165 | $valeurs[$r[1]] = ''; |
| 166 | 166 | // recuperer les valeurs _meta_xx qui peuvent etre fournies |
| 167 | 167 | // en input hidden dans le squelette |
| 168 | - if (strncmp($r[1],'_meta_',6)==0) |
|
| 169 | - $valeurs[$r[1]] = extraire_attribut($b,'value'); |
|
| 168 | + if (strncmp($r[1], '_meta_', 6) == 0) |
|
| 169 | + $valeurs[$r[1]] = extraire_attribut($b, 'value'); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | - cvtconf_configurer_lire_meta($form,$valeurs); |
|
| 176 | + cvtconf_configurer_lire_meta($form, $valeurs); |
|
| 177 | 177 | return $valeurs; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -184,21 +184,21 @@ discard block |
||
| 184 | 184 | * @param array $store |
| 185 | 185 | * @return string |
| 186 | 186 | */ |
| 187 | -function cvtconf_configurer_stocker($form,$valeurs,$store) { |
|
| 187 | +function cvtconf_configurer_stocker($form, $valeurs, $store) { |
|
| 188 | 188 | $trace = ''; |
| 189 | - list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
|
| 189 | + list($table, $casier, $prefixe, $stockage) = cvtconf_definir_configurer_conteneur($form, $valeurs); |
|
| 190 | 190 | // stocker en base |
| 191 | 191 | // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
| 192 | 192 | if (!isset($GLOBALS[$table])) |
| 193 | 193 | lire_metas($table); |
| 194 | 194 | |
| 195 | - $prefixe = ($prefixe?$prefixe.'_':''); |
|
| 195 | + $prefixe = ($prefixe ? $prefixe.'_' : ''); |
|
| 196 | 196 | $table = ($table) ? "/$table/" : ""; |
| 197 | - $casier = ($casier) ? rtrim($casier,'/').'/' : ""; // slash final, sinon rien |
|
| 197 | + $casier = ($casier) ? rtrim($casier, '/').'/' : ""; // slash final, sinon rien |
|
| 198 | 198 | |
| 199 | - foreach($store as $k=>$v){ |
|
| 199 | + foreach ($store as $k=>$v) { |
|
| 200 | 200 | ecrire_config("$stockage$table$prefixe$casier$k", $v); |
| 201 | - if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
|
| 201 | + if (_request('var_mode') == 'configurer' AND autoriser('webmestre')) { |
|
| 202 | 202 | $trace .= "<br />table $table : ".$prefixe.$k." = $v;"; |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @param string $form |
| 211 | 211 | * @param array $valeurs |
| 212 | 212 | */ |
| 213 | -function cvtconf_configurer_lire_meta($form,&$valeurs) { |
|
| 214 | - list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
|
| 213 | +function cvtconf_configurer_lire_meta($form, &$valeurs) { |
|
| 214 | + list($table, $casier, $prefixe, $stockage) = cvtconf_definir_configurer_conteneur($form, $valeurs); |
|
| 215 | 215 | |
| 216 | 216 | $table = ($table) ? "/$table/" : ""; |
| 217 | - $prefixe = ($prefixe?$prefixe.'_':''); |
|
| 217 | + $prefixe = ($prefixe ? $prefixe.'_' : ''); |
|
| 218 | 218 | if ($casier) { |
| 219 | 219 | $meta = lire_config("$stockage$table$prefixe$casier"); |
| 220 | 220 | $prefixe = ''; |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | $meta = lire_config("$stockage$table"); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - foreach($valeurs as $k=>$v){ |
|
| 228 | - if (substr($k,0,1)!=='_') |
|
| 229 | - $valeurs[$k] = (isset($meta[$prefixe.$k])?$meta[$prefixe.$k]:''); |
|
| 227 | + foreach ($valeurs as $k=>$v) { |
|
| 228 | + if (substr($k, 0, 1) !== '_') |
|
| 229 | + $valeurs[$k] = (isset($meta[$prefixe.$k]) ? $meta[$prefixe.$k] : ''); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | include_spip('inc/config'); |
| 16 | 18 | |
@@ -36,7 +38,9 @@ discard block |
||
| 36 | 38 | $flux['data'] = cvtconf_formulaires_configurer_recense($form); |
| 37 | 39 | $flux['data']['editable'] = true; |
| 38 | 40 | if (_request('var_mode')=='configurer' AND autoriser('webmestre')){ |
| 39 | - if (!_AJAX) var_dump($flux['data']); |
|
| 41 | + if (!_AJAX) { |
|
| 42 | + var_dump($flux['data']); |
|
| 43 | + } |
|
| 40 | 44 | // reinjecter pour la trace au traitement |
| 41 | 45 | $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />"; |
| 42 | 46 | } |
@@ -79,8 +83,9 @@ discard block |
||
| 79 | 83 | // charger les valeurs |
| 80 | 84 | // ce qui permet de prendre en charge une fonction charger() existante |
| 81 | 85 | // qui prend alors la main sur l'auto detection |
| 82 | - if ($charger_valeurs = charger_fonction("charger","formulaires/$form/",true)) |
|
| 83 | - $valeurs = call_user_func_array($charger_valeurs,$args); |
|
| 86 | + if ($charger_valeurs = charger_fonction("charger","formulaires/$form/",true)) { |
|
| 87 | + $valeurs = call_user_func_array($charger_valeurs,$args); |
|
| 88 | + } |
|
| 84 | 89 | $valeurs = pipeline( |
| 85 | 90 | 'formulaire_charger', |
| 86 | 91 | array( |
@@ -93,8 +98,9 @@ discard block |
||
| 93 | 98 | // recuperer les valeurs postees |
| 94 | 99 | $store = array(); |
| 95 | 100 | foreach($valeurs as $k=>$v){ |
| 96 | - if (substr($k,0,1)!=='_') |
|
| 97 | - $store[$k] = _request($k); |
|
| 101 | + if (substr($k,0,1)!=='_') { |
|
| 102 | + $store[$k] = _request($k); |
|
| 103 | + } |
|
| 98 | 104 | } |
| 99 | 105 | |
| 100 | 106 | return cvtconf_configurer_stocker($form,$valeurs,$store); |
@@ -120,9 +126,15 @@ discard block |
||
| 120 | 126 | $prefixe = ''; |
| 121 | 127 | $stockage = ''; |
| 122 | 128 | |
| 123 | - if (isset($valeurs['_meta_casier'])) $casier = $valeurs['_meta_casier']; |
|
| 124 | - if (isset($valeurs['_meta_prefixe'])) $prefixe = $valeurs['_meta_prefixe']; |
|
| 125 | - if (isset($valeurs['_meta_stockage'])) $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 129 | + if (isset($valeurs['_meta_casier'])) { |
|
| 130 | + $casier = $valeurs['_meta_casier']; |
|
| 131 | + } |
|
| 132 | + if (isset($valeurs['_meta_prefixe'])) { |
|
| 133 | + $prefixe = $valeurs['_meta_prefixe']; |
|
| 134 | + } |
|
| 135 | + if (isset($valeurs['_meta_stockage'])) { |
|
| 136 | + $stockage = $valeurs['_meta_stockage'] . '::'; |
|
| 137 | + } |
|
| 126 | 138 | |
| 127 | 139 | // si on indique juste une table, il faut vider les autres proprietes |
| 128 | 140 | // car par defaut on utilise ni casier ni prefixe dans ce cas |
@@ -151,7 +163,9 @@ discard block |
||
| 151 | 163 | for ($i=0;$i<2;$i++) { |
| 152 | 164 | // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees |
| 153 | 165 | // permet de trouver aussi les name="#GET{truc}" |
| 154 | - if ($i==1) $contenu = recuperer_fond("formulaires/$form",$valeurs); |
|
| 166 | + if ($i==1) { |
|
| 167 | + $contenu = recuperer_fond("formulaires/$form",$valeurs); |
|
| 168 | + } |
|
| 155 | 169 | |
| 156 | 170 | $balises = array_merge(extraire_balises($contenu,'input'), |
| 157 | 171 | extraire_balises($contenu,'textarea'), |
@@ -165,8 +179,9 @@ discard block |
||
| 165 | 179 | $valeurs[$r[1]] = ''; |
| 166 | 180 | // recuperer les valeurs _meta_xx qui peuvent etre fournies |
| 167 | 181 | // en input hidden dans le squelette |
| 168 | - if (strncmp($r[1],'_meta_',6)==0) |
|
| 169 | - $valeurs[$r[1]] = extraire_attribut($b,'value'); |
|
| 182 | + if (strncmp($r[1],'_meta_',6)==0) { |
|
| 183 | + $valeurs[$r[1]] = extraire_attribut($b,'value'); |
|
| 184 | + } |
|
| 170 | 185 | } |
| 171 | 186 | } |
| 172 | 187 | } |
@@ -189,8 +204,9 @@ discard block |
||
| 189 | 204 | list($table,$casier,$prefixe,$stockage) = cvtconf_definir_configurer_conteneur($form,$valeurs); |
| 190 | 205 | // stocker en base |
| 191 | 206 | // par defaut, dans un casier serialize dans spip_meta (idem CFG) |
| 192 | - if (!isset($GLOBALS[$table])) |
|
| 193 | - lire_metas($table); |
|
| 207 | + if (!isset($GLOBALS[$table])) { |
|
| 208 | + lire_metas($table); |
|
| 209 | + } |
|
| 194 | 210 | |
| 195 | 211 | $prefixe = ($prefixe?$prefixe.'_':''); |
| 196 | 212 | $table = ($table) ? "/$table/" : ""; |
@@ -218,15 +234,15 @@ discard block |
||
| 218 | 234 | if ($casier) { |
| 219 | 235 | $meta = lire_config("$stockage$table$prefixe$casier"); |
| 220 | 236 | $prefixe = ''; |
| 221 | - } |
|
| 222 | - else { |
|
| 237 | + } else { |
|
| 223 | 238 | $table = rtrim($table, '/'); |
| 224 | 239 | $meta = lire_config("$stockage$table"); |
| 225 | 240 | } |
| 226 | 241 | |
| 227 | 242 | foreach($valeurs as $k=>$v){ |
| 228 | - if (substr($k,0,1)!=='_') |
|
| 229 | - $valeurs[$k] = (isset($meta[$prefixe.$k])?$meta[$prefixe.$k]:''); |
|
| 243 | + if (substr($k,0,1)!=='_') { |
|
| 244 | + $valeurs[$k] = (isset($meta[$prefixe.$k])?$meta[$prefixe.$k]:''); |
|
| 245 | + } |
|
| 230 | 246 | } |
| 231 | 247 | } |
| 232 | 248 | |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function inc_notifications_dist($quoi, $id=0, $options=array()) { |
| 28 | 28 | |
| 29 | - // charger les fichiers qui veulent ajouter des definitions |
|
| 30 | - // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ... |
|
| 31 | - pipeline('notifications',array('args'=>array('quoi'=>$quoi,'id'=>$id,'options'=>$options))); |
|
| 32 | - |
|
| 33 | - if ($notification = charger_fonction($quoi,'notifications',true)) { |
|
| 34 | - spip_log("$notification($quoi,$id" |
|
| 35 | - .($options?",".serialize($options):"") |
|
| 36 | - .")",'notifications'); |
|
| 37 | - $notification($quoi, $id, $options); |
|
| 38 | - } |
|
| 29 | + // charger les fichiers qui veulent ajouter des definitions |
|
| 30 | + // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ... |
|
| 31 | + pipeline('notifications',array('args'=>array('quoi'=>$quoi,'id'=>$id,'options'=>$options))); |
|
| 32 | + |
|
| 33 | + if ($notification = charger_fonction($quoi,'notifications',true)) { |
|
| 34 | + spip_log("$notification($quoi,$id" |
|
| 35 | + .($options?",".serialize($options):"") |
|
| 36 | + .")",'notifications'); |
|
| 37 | + $notification($quoi, $id, $options); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -48,15 +48,15 @@ discard block |
||
| 48 | 48 | * @param array $exclure |
| 49 | 49 | */ |
| 50 | 50 | function notifications_nettoyer_emails(&$emails, $exclure = array()){ |
| 51 | - // filtrer et unifier |
|
| 52 | - include_spip('inc/filtres'); |
|
| 53 | - $emails = array_unique(array_filter(array_map('email_valide',array_map('trim', $emails)))); |
|
| 54 | - if ($exclure AND count($exclure)){ |
|
| 55 | - // nettoyer les exclusions d'abord |
|
| 56 | - notifications_nettoyer_emails($exclure); |
|
| 57 | - // faire un diff |
|
| 58 | - $emails = array_diff($emails,$exclure); |
|
| 59 | - } |
|
| 51 | + // filtrer et unifier |
|
| 52 | + include_spip('inc/filtres'); |
|
| 53 | + $emails = array_unique(array_filter(array_map('email_valide',array_map('trim', $emails)))); |
|
| 54 | + if ($exclure AND count($exclure)){ |
|
| 55 | + // nettoyer les exclusions d'abord |
|
| 56 | + notifications_nettoyer_emails($exclure); |
|
| 57 | + // faire un diff |
|
| 58 | + $emails = array_diff($emails,$exclure); |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -70,71 +70,71 @@ discard block |
||
| 70 | 70 | * @param string $headers |
| 71 | 71 | */ |
| 72 | 72 | function notifications_envoyer_mails($emails, $texte, $sujet="", $from = "", $headers = ""){ |
| 73 | - // rien a faire si pas de texte ! |
|
| 74 | - if (!strlen($texte)) |
|
| 75 | - return; |
|
| 76 | - |
|
| 77 | - // si on ne specifie qu'un email, le mettre dans un tableau |
|
| 78 | - if (!is_array($emails)) |
|
| 79 | - $emails = explode(',',$emails); |
|
| 80 | - |
|
| 81 | - notifications_nettoyer_emails($emails); |
|
| 82 | - |
|
| 83 | - // tester si le mail est deja en html |
|
| 84 | - if (strpos($texte,"<")!==false // eviter les tests suivants si possible |
|
| 85 | - AND $ttrim = trim($texte) |
|
| 86 | - AND substr($ttrim,0,1)=="<" |
|
| 87 | - AND substr($ttrim,-1,1)==">" |
|
| 88 | - AND stripos($ttrim,"</html>")!==false){ |
|
| 89 | - |
|
| 90 | - if(!strlen($sujet)){ |
|
| 91 | - // dans ce cas on ruse un peu : extraire le sujet du title |
|
| 92 | - if (preg_match(",<title>(.*)</title>,Uims",$texte,$m)) |
|
| 93 | - $sujet = $m[1]; |
|
| 94 | - else { |
|
| 95 | - // fallback, on prend le body si on le trouve |
|
| 96 | - if (preg_match(",<body[^>]*>(.*)</body>,Uims",$texte,$m)) |
|
| 97 | - $ttrim = $m[1]; |
|
| 98 | - |
|
| 99 | - // et on extrait la premiere ligne de vrai texte... |
|
| 100 | - // nettoyer le html et les retours chariots |
|
| 101 | - $ttrim = textebrut($ttrim); |
|
| 102 | - $ttrim = str_replace("\r\n", "\r", $ttrim); |
|
| 103 | - $ttrim = str_replace("\r", "\n", $ttrim); |
|
| 104 | - // decouper |
|
| 105 | - $ttrim = explode("\n",trim($ttrim)); |
|
| 106 | - // extraire la premiere ligne de texte brut |
|
| 107 | - $sujet = array_shift($ttrim); |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // si besoin on ajoute le content-type dans les headers |
|
| 112 | - if (stripos($headers,"Content-Type")===false) |
|
| 113 | - $headers .= "Content-Type: text/html\n"; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // si le sujet est vide, extraire la premiere ligne du corps |
|
| 117 | - // du mail qui est donc du texte |
|
| 118 | - if (!strlen($sujet)){ |
|
| 119 | - // nettoyer un peu les retours chariots |
|
| 120 | - $texte = str_replace("\r\n", "\r", $texte); |
|
| 121 | - $texte = str_replace("\r", "\n", $texte); |
|
| 122 | - // decouper |
|
| 123 | - $texte = explode("\n",trim($texte)); |
|
| 124 | - // extraire la premiere ligne |
|
| 125 | - $sujet = array_shift($texte); |
|
| 126 | - $texte = trim(implode("\n",$texte)); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - $envoyer_mail = charger_fonction('envoyer_mail','inc'); |
|
| 130 | - foreach($emails as $email){ |
|
| 131 | - // passer dans un pipeline qui permet un ajout eventuel |
|
| 132 | - // (url de suivi des notifications par exemple) |
|
| 133 | - $envoi = pipeline('notifications_envoyer_mails',array('email'=>$email,'sujet'=>$sujet,'texte'=>$texte)); |
|
| 134 | - $email = $envoi['email']; |
|
| 135 | - |
|
| 136 | - job_queue_add('envoyer_mail', ">$email : ".$envoi['sujet'], array($email, $envoi['sujet'], $envoi['texte'], $from, $headers), 'inc/'); |
|
| 137 | - } |
|
| 73 | + // rien a faire si pas de texte ! |
|
| 74 | + if (!strlen($texte)) |
|
| 75 | + return; |
|
| 76 | + |
|
| 77 | + // si on ne specifie qu'un email, le mettre dans un tableau |
|
| 78 | + if (!is_array($emails)) |
|
| 79 | + $emails = explode(',',$emails); |
|
| 80 | + |
|
| 81 | + notifications_nettoyer_emails($emails); |
|
| 82 | + |
|
| 83 | + // tester si le mail est deja en html |
|
| 84 | + if (strpos($texte,"<")!==false // eviter les tests suivants si possible |
|
| 85 | + AND $ttrim = trim($texte) |
|
| 86 | + AND substr($ttrim,0,1)=="<" |
|
| 87 | + AND substr($ttrim,-1,1)==">" |
|
| 88 | + AND stripos($ttrim,"</html>")!==false){ |
|
| 89 | + |
|
| 90 | + if(!strlen($sujet)){ |
|
| 91 | + // dans ce cas on ruse un peu : extraire le sujet du title |
|
| 92 | + if (preg_match(",<title>(.*)</title>,Uims",$texte,$m)) |
|
| 93 | + $sujet = $m[1]; |
|
| 94 | + else { |
|
| 95 | + // fallback, on prend le body si on le trouve |
|
| 96 | + if (preg_match(",<body[^>]*>(.*)</body>,Uims",$texte,$m)) |
|
| 97 | + $ttrim = $m[1]; |
|
| 98 | + |
|
| 99 | + // et on extrait la premiere ligne de vrai texte... |
|
| 100 | + // nettoyer le html et les retours chariots |
|
| 101 | + $ttrim = textebrut($ttrim); |
|
| 102 | + $ttrim = str_replace("\r\n", "\r", $ttrim); |
|
| 103 | + $ttrim = str_replace("\r", "\n", $ttrim); |
|
| 104 | + // decouper |
|
| 105 | + $ttrim = explode("\n",trim($ttrim)); |
|
| 106 | + // extraire la premiere ligne de texte brut |
|
| 107 | + $sujet = array_shift($ttrim); |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + // si besoin on ajoute le content-type dans les headers |
|
| 112 | + if (stripos($headers,"Content-Type")===false) |
|
| 113 | + $headers .= "Content-Type: text/html\n"; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // si le sujet est vide, extraire la premiere ligne du corps |
|
| 117 | + // du mail qui est donc du texte |
|
| 118 | + if (!strlen($sujet)){ |
|
| 119 | + // nettoyer un peu les retours chariots |
|
| 120 | + $texte = str_replace("\r\n", "\r", $texte); |
|
| 121 | + $texte = str_replace("\r", "\n", $texte); |
|
| 122 | + // decouper |
|
| 123 | + $texte = explode("\n",trim($texte)); |
|
| 124 | + // extraire la premiere ligne |
|
| 125 | + $sujet = array_shift($texte); |
|
| 126 | + $texte = trim(implode("\n",$texte)); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + $envoyer_mail = charger_fonction('envoyer_mail','inc'); |
|
| 130 | + foreach($emails as $email){ |
|
| 131 | + // passer dans un pipeline qui permet un ajout eventuel |
|
| 132 | + // (url de suivi des notifications par exemple) |
|
| 133 | + $envoi = pipeline('notifications_envoyer_mails',array('email'=>$email,'sujet'=>$sujet,'texte'=>$texte)); |
|
| 134 | + $email = $envoi['email']; |
|
| 135 | + |
|
| 136 | + job_queue_add('envoyer_mail', ">$email : ".$envoi['sujet'], array($email, $envoi['sujet'], $envoi['texte'], $from, $headers), 'inc/'); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * @return string |
| 151 | 151 | */ |
| 152 | 152 | function email_notification_objet($id_objet, $type_objet, $modele) { |
| 153 | - $envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email |
|
| 154 | - $id_type = id_table_objet($type_objet); |
|
| 155 | - return recuperer_fond($modele,array($id_type=>$id_objet,"id"=>$id_objet)); |
|
| 153 | + $envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email |
|
| 154 | + $id_type = id_table_objet($type_objet); |
|
| 155 | + return recuperer_fond($modele,array($id_type=>$id_objet,"id"=>$id_objet)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -166,29 +166,29 @@ discard block |
||
| 166 | 166 | * @return string |
| 167 | 167 | */ |
| 168 | 168 | function email_notification_article($id_article, $modele) { |
| 169 | - $envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email |
|
| 169 | + $envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email |
|
| 170 | 170 | |
| 171 | - return recuperer_fond($modele,array('id_article'=>$id_article)); |
|
| 171 | + return recuperer_fond($modele,array('id_article'=>$id_article)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Compatibilite, ne plus utiliser |
| 175 | 175 | // http://doc.spip.org/@notifier_publication_article |
| 176 | 176 | function notifier_publication_article($id_article) { |
| 177 | - if ($GLOBALS['meta']["suivi_edito"] == "oui") { |
|
| 178 | - $adresse_suivi = $GLOBALS['meta']["adresse_suivi"]; |
|
| 179 | - $texte = email_notification_article($id_article, "notifications/article_publie"); |
|
| 180 | - notifications_envoyer_mails($adresse_suivi, $texte); |
|
| 181 | - } |
|
| 177 | + if ($GLOBALS['meta']["suivi_edito"] == "oui") { |
|
| 178 | + $adresse_suivi = $GLOBALS['meta']["adresse_suivi"]; |
|
| 179 | + $texte = email_notification_article($id_article, "notifications/article_publie"); |
|
| 180 | + notifications_envoyer_mails($adresse_suivi, $texte); |
|
| 181 | + } |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Compatibilite, ne plus utiliser |
| 185 | 185 | // http://doc.spip.org/@notifier_proposition_article |
| 186 | 186 | function notifier_proposition_article($id_article) { |
| 187 | - if ($GLOBALS['meta']["suivi_edito"] == "oui") { |
|
| 188 | - $adresse_suivi = $GLOBALS['meta']["adresse_suivi"]; |
|
| 189 | - $texte = email_notification_article($id_article, "notifications/article_propose"); |
|
| 190 | - notifications_envoyer_mails($adresse_suivi, $texte); |
|
| 191 | - } |
|
| 187 | + if ($GLOBALS['meta']["suivi_edito"] == "oui") { |
|
| 188 | + $adresse_suivi = $GLOBALS['meta']["adresse_suivi"]; |
|
| 189 | + $texte = email_notification_article($id_article, "notifications/article_propose"); |
|
| 190 | + notifications_envoyer_mails($adresse_suivi, $texte); |
|
| 191 | + } |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | ?> |
@@ -24,16 +24,16 @@ discard block |
||
| 24 | 24 | * @param array $options |
| 25 | 25 | * options de notification, interpretees en fonction de la notification |
| 26 | 26 | */ |
| 27 | -function inc_notifications_dist($quoi, $id=0, $options=array()) { |
|
| 27 | +function inc_notifications_dist($quoi, $id = 0, $options = array()) { |
|
| 28 | 28 | |
| 29 | 29 | // charger les fichiers qui veulent ajouter des definitions |
| 30 | 30 | // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ... |
| 31 | - pipeline('notifications',array('args'=>array('quoi'=>$quoi,'id'=>$id,'options'=>$options))); |
|
| 31 | + pipeline('notifications', array('args'=>array('quoi'=>$quoi, 'id'=>$id, 'options'=>$options))); |
|
| 32 | 32 | |
| 33 | - if ($notification = charger_fonction($quoi,'notifications',true)) { |
|
| 33 | + if ($notification = charger_fonction($quoi, 'notifications', true)) { |
|
| 34 | 34 | spip_log("$notification($quoi,$id" |
| 35 | - .($options?",".serialize($options):"") |
|
| 36 | - .")",'notifications'); |
|
| 35 | + .($options ? ",".serialize($options) : "") |
|
| 36 | + .")", 'notifications'); |
|
| 37 | 37 | $notification($quoi, $id, $options); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | * @param array $emails |
| 48 | 48 | * @param array $exclure |
| 49 | 49 | */ |
| 50 | -function notifications_nettoyer_emails(&$emails, $exclure = array()){ |
|
| 50 | +function notifications_nettoyer_emails(&$emails, $exclure = array()) { |
|
| 51 | 51 | // filtrer et unifier |
| 52 | 52 | include_spip('inc/filtres'); |
| 53 | - $emails = array_unique(array_filter(array_map('email_valide',array_map('trim', $emails)))); |
|
| 54 | - if ($exclure AND count($exclure)){ |
|
| 53 | + $emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails)))); |
|
| 54 | + if ($exclure AND count($exclure)) { |
|
| 55 | 55 | // nettoyer les exclusions d'abord |
| 56 | 56 | notifications_nettoyer_emails($exclure); |
| 57 | 57 | // faire un diff |
| 58 | - $emails = array_diff($emails,$exclure); |
|
| 58 | + $emails = array_diff($emails, $exclure); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -69,31 +69,31 @@ discard block |
||
| 69 | 69 | * @param string $from |
| 70 | 70 | * @param string $headers |
| 71 | 71 | */ |
| 72 | -function notifications_envoyer_mails($emails, $texte, $sujet="", $from = "", $headers = ""){ |
|
| 72 | +function notifications_envoyer_mails($emails, $texte, $sujet = "", $from = "", $headers = "") { |
|
| 73 | 73 | // rien a faire si pas de texte ! |
| 74 | 74 | if (!strlen($texte)) |
| 75 | 75 | return; |
| 76 | 76 | |
| 77 | 77 | // si on ne specifie qu'un email, le mettre dans un tableau |
| 78 | 78 | if (!is_array($emails)) |
| 79 | - $emails = explode(',',$emails); |
|
| 79 | + $emails = explode(',', $emails); |
|
| 80 | 80 | |
| 81 | 81 | notifications_nettoyer_emails($emails); |
| 82 | 82 | |
| 83 | 83 | // tester si le mail est deja en html |
| 84 | - if (strpos($texte,"<")!==false // eviter les tests suivants si possible |
|
| 84 | + if (strpos($texte, "<") !== false // eviter les tests suivants si possible |
|
| 85 | 85 | AND $ttrim = trim($texte) |
| 86 | - AND substr($ttrim,0,1)=="<" |
|
| 87 | - AND substr($ttrim,-1,1)==">" |
|
| 88 | - AND stripos($ttrim,"</html>")!==false){ |
|
| 86 | + AND substr($ttrim, 0, 1) == "<" |
|
| 87 | + AND substr($ttrim, -1, 1) == ">" |
|
| 88 | + AND stripos($ttrim, "</html>") !== false) { |
|
| 89 | 89 | |
| 90 | - if(!strlen($sujet)){ |
|
| 90 | + if (!strlen($sujet)) { |
|
| 91 | 91 | // dans ce cas on ruse un peu : extraire le sujet du title |
| 92 | - if (preg_match(",<title>(.*)</title>,Uims",$texte,$m)) |
|
| 92 | + if (preg_match(",<title>(.*)</title>,Uims", $texte, $m)) |
|
| 93 | 93 | $sujet = $m[1]; |
| 94 | 94 | else { |
| 95 | 95 | // fallback, on prend le body si on le trouve |
| 96 | - if (preg_match(",<body[^>]*>(.*)</body>,Uims",$texte,$m)) |
|
| 96 | + if (preg_match(",<body[^>]*>(.*)</body>,Uims", $texte, $m)) |
|
| 97 | 97 | $ttrim = $m[1]; |
| 98 | 98 | |
| 99 | 99 | // et on extrait la premiere ligne de vrai texte... |
@@ -102,35 +102,35 @@ discard block |
||
| 102 | 102 | $ttrim = str_replace("\r\n", "\r", $ttrim); |
| 103 | 103 | $ttrim = str_replace("\r", "\n", $ttrim); |
| 104 | 104 | // decouper |
| 105 | - $ttrim = explode("\n",trim($ttrim)); |
|
| 105 | + $ttrim = explode("\n", trim($ttrim)); |
|
| 106 | 106 | // extraire la premiere ligne de texte brut |
| 107 | 107 | $sujet = array_shift($ttrim); |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // si besoin on ajoute le content-type dans les headers |
| 112 | - if (stripos($headers,"Content-Type")===false) |
|
| 112 | + if (stripos($headers, "Content-Type") === false) |
|
| 113 | 113 | $headers .= "Content-Type: text/html\n"; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // si le sujet est vide, extraire la premiere ligne du corps |
| 117 | 117 | // du mail qui est donc du texte |
| 118 | - if (!strlen($sujet)){ |
|
| 118 | + if (!strlen($sujet)) { |
|
| 119 | 119 | // nettoyer un peu les retours chariots |
| 120 | 120 | $texte = str_replace("\r\n", "\r", $texte); |
| 121 | 121 | $texte = str_replace("\r", "\n", $texte); |
| 122 | 122 | // decouper |
| 123 | - $texte = explode("\n",trim($texte)); |
|
| 123 | + $texte = explode("\n", trim($texte)); |
|
| 124 | 124 | // extraire la premiere ligne |
| 125 | 125 | $sujet = array_shift($texte); |
| 126 | - $texte = trim(implode("\n",$texte)); |
|
| 126 | + $texte = trim(implode("\n", $texte)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $envoyer_mail = charger_fonction('envoyer_mail','inc'); |
|
| 130 | - foreach($emails as $email){ |
|
| 129 | + $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); |
|
| 130 | + foreach ($emails as $email) { |
|
| 131 | 131 | // passer dans un pipeline qui permet un ajout eventuel |
| 132 | 132 | // (url de suivi des notifications par exemple) |
| 133 | - $envoi = pipeline('notifications_envoyer_mails',array('email'=>$email,'sujet'=>$sujet,'texte'=>$texte)); |
|
| 133 | + $envoi = pipeline('notifications_envoyer_mails', array('email'=>$email, 'sujet'=>$sujet, 'texte'=>$texte)); |
|
| 134 | 134 | $email = $envoi['email']; |
| 135 | 135 | |
| 136 | 136 | job_queue_add('envoyer_mail', ">$email : ".$envoi['sujet'], array($email, $envoi['sujet'], $envoi['texte'], $from, $headers), 'inc/'); |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * @return string |
| 151 | 151 | */ |
| 152 | 152 | function email_notification_objet($id_objet, $type_objet, $modele) { |
| 153 | - $envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email |
|
| 153 | + $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email |
|
| 154 | 154 | $id_type = id_table_objet($type_objet); |
| 155 | - return recuperer_fond($modele,array($id_type=>$id_objet,"id"=>$id_objet)); |
|
| 155 | + return recuperer_fond($modele, array($id_type=>$id_objet, "id"=>$id_objet)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | * @return string |
| 167 | 167 | */ |
| 168 | 168 | function email_notification_article($id_article, $modele) { |
| 169 | - $envoyer_mail = charger_fonction('envoyer_mail','inc'); // pour nettoyer_titre_email |
|
| 169 | + $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email |
|
| 170 | 170 | |
| 171 | - return recuperer_fond($modele,array('id_article'=>$id_article)); |
|
| 171 | + return recuperer_fond($modele, array('id_article'=>$id_article)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Compatibilite, ne plus utiliser |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | /** |
@@ -71,12 +73,14 @@ discard block |
||
| 71 | 73 | */ |
| 72 | 74 | function notifications_envoyer_mails($emails, $texte, $sujet="", $from = "", $headers = ""){ |
| 73 | 75 | // rien a faire si pas de texte ! |
| 74 | - if (!strlen($texte)) |
|
| 75 | - return; |
|
| 76 | + if (!strlen($texte)) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 76 | 79 | |
| 77 | 80 | // si on ne specifie qu'un email, le mettre dans un tableau |
| 78 | - if (!is_array($emails)) |
|
| 79 | - $emails = explode(',',$emails); |
|
| 81 | + if (!is_array($emails)) { |
|
| 82 | + $emails = explode(',',$emails); |
|
| 83 | + } |
|
| 80 | 84 | |
| 81 | 85 | notifications_nettoyer_emails($emails); |
| 82 | 86 | |
@@ -89,12 +93,13 @@ discard block |
||
| 89 | 93 | |
| 90 | 94 | if(!strlen($sujet)){ |
| 91 | 95 | // dans ce cas on ruse un peu : extraire le sujet du title |
| 92 | - if (preg_match(",<title>(.*)</title>,Uims",$texte,$m)) |
|
| 93 | - $sujet = $m[1]; |
|
| 94 | - else { |
|
| 96 | + if (preg_match(",<title>(.*)</title>,Uims",$texte,$m)) { |
|
| 97 | + $sujet = $m[1]; |
|
| 98 | + } else { |
|
| 95 | 99 | // fallback, on prend le body si on le trouve |
| 96 | - if (preg_match(",<body[^>]*>(.*)</body>,Uims",$texte,$m)) |
|
| 97 | - $ttrim = $m[1]; |
|
| 100 | + if (preg_match(",<body[^>]*>(.*)</body>,Uims",$texte,$m)) { |
|
| 101 | + $ttrim = $m[1]; |
|
| 102 | + } |
|
| 98 | 103 | |
| 99 | 104 | // et on extrait la premiere ligne de vrai texte... |
| 100 | 105 | // nettoyer le html et les retours chariots |
@@ -109,8 +114,9 @@ discard block |
||
| 109 | 114 | } |
| 110 | 115 | |
| 111 | 116 | // si besoin on ajoute le content-type dans les headers |
| 112 | - if (stripos($headers,"Content-Type")===false) |
|
| 113 | - $headers .= "Content-Type: text/html\n"; |
|
| 117 | + if (stripos($headers,"Content-Type")===false) { |
|
| 118 | + $headers .= "Content-Type: text/html\n"; |
|
| 119 | + } |
|
| 114 | 120 | } |
| 115 | 121 | |
| 116 | 122 | // si le sujet est vide, extraire la premiere ligne du corps |
@@ -14,76 +14,76 @@ |
||
| 14 | 14 | |
| 15 | 15 | function analyse_csv($t) |
| 16 | 16 | { |
| 17 | - $virg = substr_count($t, ','); |
|
| 18 | - $pvirg = substr_count($t, ';'); |
|
| 19 | - $tab = substr_count($t, "\t"); |
|
| 20 | - if ($virg > $pvirg) |
|
| 21 | - { $sep = ','; $hs = ',';} |
|
| 22 | - else { $sep = ';'; $hs = ';'; $virg = $pvirg;} |
|
| 23 | - if ($tab > $virg) {$sep = "\t"; $hs = "\t";} |
|
| 17 | + $virg = substr_count($t, ','); |
|
| 18 | + $pvirg = substr_count($t, ';'); |
|
| 19 | + $tab = substr_count($t, "\t"); |
|
| 20 | + if ($virg > $pvirg) |
|
| 21 | + { $sep = ','; $hs = ',';} |
|
| 22 | + else { $sep = ';'; $hs = ';'; $virg = $pvirg;} |
|
| 23 | + if ($tab > $virg) {$sep = "\t"; $hs = "\t";} |
|
| 24 | 24 | |
| 25 | - $t = preg_replace('/\r?\n/', "\n", |
|
| 26 | - preg_replace('/[\r\n]+/', "\n", $t)); |
|
| 27 | - // un separateur suivi de 3 guillemets attention ! |
|
| 28 | - // attention au ; suceptible d'etre confondu avec un separateur |
|
| 29 | - // on substitue un # et on remplacera a la fin |
|
| 30 | - $t = preg_replace("/([\n$sep])\"\"\"/",'\\1""#',$t); |
|
| 31 | - $t = str_replace('""','"#',$t); |
|
| 32 | - preg_match_all('/"[^"]*"/', $t, $r); |
|
| 33 | - foreach($r[0] as $cell) |
|
| 34 | - $t = str_replace($cell, |
|
| 35 | - str_replace($sep, $hs, |
|
| 36 | - str_replace("\n", "<br />", |
|
| 37 | - substr($cell,1,-1))), |
|
| 38 | - $t); |
|
| 39 | - list($entete, $corps) = explode("\n",$t,2); |
|
| 40 | - $caption = ''; |
|
| 41 | - // sauter la ligne de tete formee seulement de separateurs |
|
| 42 | - if (substr_count($entete, $sep) == strlen($entete)) { |
|
| 43 | - list($entete, $corps) = explode("\n",$corps,2); |
|
| 44 | - } |
|
| 45 | - // si une seule colonne, en faire le titre |
|
| 46 | - if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) { |
|
| 47 | - $caption = "\n||" . $l[1] . "|"; |
|
| 48 | - list($entete, $corps) = explode("\n",$corps,2); |
|
| 49 | - } |
|
| 50 | - // si premiere colonne vide, le raccourci doit quand meme produire <th... |
|
| 51 | - if ($entete[0] == $sep) $entete = ' ' . $entete; |
|
| 25 | + $t = preg_replace('/\r?\n/', "\n", |
|
| 26 | + preg_replace('/[\r\n]+/', "\n", $t)); |
|
| 27 | + // un separateur suivi de 3 guillemets attention ! |
|
| 28 | + // attention au ; suceptible d'etre confondu avec un separateur |
|
| 29 | + // on substitue un # et on remplacera a la fin |
|
| 30 | + $t = preg_replace("/([\n$sep])\"\"\"/",'\\1""#',$t); |
|
| 31 | + $t = str_replace('""','"#',$t); |
|
| 32 | + preg_match_all('/"[^"]*"/', $t, $r); |
|
| 33 | + foreach($r[0] as $cell) |
|
| 34 | + $t = str_replace($cell, |
|
| 35 | + str_replace($sep, $hs, |
|
| 36 | + str_replace("\n", "<br />", |
|
| 37 | + substr($cell,1,-1))), |
|
| 38 | + $t); |
|
| 39 | + list($entete, $corps) = explode("\n",$t,2); |
|
| 40 | + $caption = ''; |
|
| 41 | + // sauter la ligne de tete formee seulement de separateurs |
|
| 42 | + if (substr_count($entete, $sep) == strlen($entete)) { |
|
| 43 | + list($entete, $corps) = explode("\n",$corps,2); |
|
| 44 | + } |
|
| 45 | + // si une seule colonne, en faire le titre |
|
| 46 | + if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) { |
|
| 47 | + $caption = "\n||" . $l[1] . "|"; |
|
| 48 | + list($entete, $corps) = explode("\n",$corps,2); |
|
| 49 | + } |
|
| 50 | + // si premiere colonne vide, le raccourci doit quand meme produire <th... |
|
| 51 | + if ($entete[0] == $sep) $entete = ' ' . $entete; |
|
| 52 | 52 | |
| 53 | - $lignes = explode("\n", $corps); |
|
| 53 | + $lignes = explode("\n", $corps); |
|
| 54 | 54 | |
| 55 | - // retrait des lignes vides finales |
|
| 56 | - while(count($lignes) > 0 |
|
| 57 | - AND preg_match("/^$sep*$/", $lignes[count($lignes)-1])) |
|
| 58 | - unset($lignes[count($lignes)-1]); |
|
| 59 | - // calcul du nombre de colonne a chaque ligne |
|
| 60 | - $nbcols = array(); |
|
| 61 | - $max = $mil = substr_count($entete, $sep); |
|
| 62 | - foreach($lignes as $k=>$v) { |
|
| 63 | - if ($max <> ($nbcols[$k]= substr_count($v, $sep))) { |
|
| 64 | - if ($max > $nbcols[$k]) |
|
| 65 | - $mil = $nbcols[$k]; |
|
| 66 | - else { $mil = $max; $max = $nbcols[$k];} |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - // Si pas le meme nombre, cadrer au nombre max |
|
| 70 | - if ($mil <> $max) |
|
| 71 | - foreach($nbcols as $k=>$v) { |
|
| 72 | - if ($v < $max) $lignes[$k].= str_repeat($sep, $max-$v); |
|
| 73 | - } |
|
| 74 | - // et retirer les colonnes integralement vides |
|
| 75 | - while(true) { |
|
| 76 | - $nbcols = ($entete[strlen($entete)-1]===$sep); |
|
| 77 | - foreach($lignes as $v) $nbcols &= ($v[strlen($v)-1]===$sep); |
|
| 78 | - if (!$nbcols) break; |
|
| 79 | - $entete = substr($entete,0,-1); |
|
| 80 | - foreach($lignes as $k=>$v) $lignes[$k] = substr($v,0,-1); |
|
| 81 | - } |
|
| 55 | + // retrait des lignes vides finales |
|
| 56 | + while(count($lignes) > 0 |
|
| 57 | + AND preg_match("/^$sep*$/", $lignes[count($lignes)-1])) |
|
| 58 | + unset($lignes[count($lignes)-1]); |
|
| 59 | + // calcul du nombre de colonne a chaque ligne |
|
| 60 | + $nbcols = array(); |
|
| 61 | + $max = $mil = substr_count($entete, $sep); |
|
| 62 | + foreach($lignes as $k=>$v) { |
|
| 63 | + if ($max <> ($nbcols[$k]= substr_count($v, $sep))) { |
|
| 64 | + if ($max > $nbcols[$k]) |
|
| 65 | + $mil = $nbcols[$k]; |
|
| 66 | + else { $mil = $max; $max = $nbcols[$k];} |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + // Si pas le meme nombre, cadrer au nombre max |
|
| 70 | + if ($mil <> $max) |
|
| 71 | + foreach($nbcols as $k=>$v) { |
|
| 72 | + if ($v < $max) $lignes[$k].= str_repeat($sep, $max-$v); |
|
| 73 | + } |
|
| 74 | + // et retirer les colonnes integralement vides |
|
| 75 | + while(true) { |
|
| 76 | + $nbcols = ($entete[strlen($entete)-1]===$sep); |
|
| 77 | + foreach($lignes as $v) $nbcols &= ($v[strlen($v)-1]===$sep); |
|
| 78 | + if (!$nbcols) break; |
|
| 79 | + $entete = substr($entete,0,-1); |
|
| 80 | + foreach($lignes as $k=>$v) $lignes[$k] = substr($v,0,-1); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - foreach($lignes as &$l) { |
|
| 84 | - $l = explode($sep, $l); |
|
| 85 | - } |
|
| 86 | - return array(explode($sep, $entete), $lignes); |
|
| 83 | + foreach($lignes as &$l) { |
|
| 84 | + $l = explode($sep, $l); |
|
| 85 | + } |
|
| 86 | + return array(explode($sep, $entete), $lignes); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
@@ -18,69 +18,69 @@ |
||
| 18 | 18 | $pvirg = substr_count($t, ';'); |
| 19 | 19 | $tab = substr_count($t, "\t"); |
| 20 | 20 | if ($virg > $pvirg) |
| 21 | - { $sep = ','; $hs = ',';} |
|
| 22 | - else { $sep = ';'; $hs = ';'; $virg = $pvirg;} |
|
| 23 | - if ($tab > $virg) {$sep = "\t"; $hs = "\t";} |
|
| 21 | + { $sep = ','; $hs = ','; } |
|
| 22 | + else { $sep = ';'; $hs = ';'; $virg = $pvirg; } |
|
| 23 | + if ($tab > $virg) {$sep = "\t"; $hs = "\t"; } |
|
| 24 | 24 | |
| 25 | 25 | $t = preg_replace('/\r?\n/', "\n", |
| 26 | 26 | preg_replace('/[\r\n]+/', "\n", $t)); |
| 27 | 27 | // un separateur suivi de 3 guillemets attention ! |
| 28 | 28 | // attention au ; suceptible d'etre confondu avec un separateur |
| 29 | 29 | // on substitue un # et on remplacera a la fin |
| 30 | - $t = preg_replace("/([\n$sep])\"\"\"/",'\\1""#',$t); |
|
| 31 | - $t = str_replace('""','"#',$t); |
|
| 30 | + $t = preg_replace("/([\n$sep])\"\"\"/", '\\1""#', $t); |
|
| 31 | + $t = str_replace('""', '"#', $t); |
|
| 32 | 32 | preg_match_all('/"[^"]*"/', $t, $r); |
| 33 | - foreach($r[0] as $cell) |
|
| 33 | + foreach ($r[0] as $cell) |
|
| 34 | 34 | $t = str_replace($cell, |
| 35 | 35 | str_replace($sep, $hs, |
| 36 | 36 | str_replace("\n", "<br />", |
| 37 | - substr($cell,1,-1))), |
|
| 37 | + substr($cell, 1, -1))), |
|
| 38 | 38 | $t); |
| 39 | - list($entete, $corps) = explode("\n",$t,2); |
|
| 39 | + list($entete, $corps) = explode("\n", $t, 2); |
|
| 40 | 40 | $caption = ''; |
| 41 | 41 | // sauter la ligne de tete formee seulement de separateurs |
| 42 | 42 | if (substr_count($entete, $sep) == strlen($entete)) { |
| 43 | - list($entete, $corps) = explode("\n",$corps,2); |
|
| 43 | + list($entete, $corps) = explode("\n", $corps, 2); |
|
| 44 | 44 | } |
| 45 | 45 | // si une seule colonne, en faire le titre |
| 46 | 46 | if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) { |
| 47 | - $caption = "\n||" . $l[1] . "|"; |
|
| 48 | - list($entete, $corps) = explode("\n",$corps,2); |
|
| 47 | + $caption = "\n||".$l[1]."|"; |
|
| 48 | + list($entete, $corps) = explode("\n", $corps, 2); |
|
| 49 | 49 | } |
| 50 | 50 | // si premiere colonne vide, le raccourci doit quand meme produire <th... |
| 51 | - if ($entete[0] == $sep) $entete = ' ' . $entete; |
|
| 51 | + if ($entete[0] == $sep) $entete = ' '.$entete; |
|
| 52 | 52 | |
| 53 | 53 | $lignes = explode("\n", $corps); |
| 54 | 54 | |
| 55 | 55 | // retrait des lignes vides finales |
| 56 | - while(count($lignes) > 0 |
|
| 57 | - AND preg_match("/^$sep*$/", $lignes[count($lignes)-1])) |
|
| 58 | - unset($lignes[count($lignes)-1]); |
|
| 56 | + while (count($lignes) > 0 |
|
| 57 | + AND preg_match("/^$sep*$/", $lignes[count($lignes) - 1])) |
|
| 58 | + unset($lignes[count($lignes) - 1]); |
|
| 59 | 59 | // calcul du nombre de colonne a chaque ligne |
| 60 | 60 | $nbcols = array(); |
| 61 | 61 | $max = $mil = substr_count($entete, $sep); |
| 62 | - foreach($lignes as $k=>$v) { |
|
| 63 | - if ($max <> ($nbcols[$k]= substr_count($v, $sep))) { |
|
| 62 | + foreach ($lignes as $k=>$v) { |
|
| 63 | + if ($max <> ($nbcols[$k] = substr_count($v, $sep))) { |
|
| 64 | 64 | if ($max > $nbcols[$k]) |
| 65 | 65 | $mil = $nbcols[$k]; |
| 66 | - else { $mil = $max; $max = $nbcols[$k];} |
|
| 66 | + else { $mil = $max; $max = $nbcols[$k]; } |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | // Si pas le meme nombre, cadrer au nombre max |
| 70 | 70 | if ($mil <> $max) |
| 71 | - foreach($nbcols as $k=>$v) { |
|
| 72 | - if ($v < $max) $lignes[$k].= str_repeat($sep, $max-$v); |
|
| 71 | + foreach ($nbcols as $k=>$v) { |
|
| 72 | + if ($v < $max) $lignes[$k] .= str_repeat($sep, $max - $v); |
|
| 73 | 73 | } |
| 74 | 74 | // et retirer les colonnes integralement vides |
| 75 | - while(true) { |
|
| 76 | - $nbcols = ($entete[strlen($entete)-1]===$sep); |
|
| 77 | - foreach($lignes as $v) $nbcols &= ($v[strlen($v)-1]===$sep); |
|
| 75 | + while (true) { |
|
| 76 | + $nbcols = ($entete[strlen($entete) - 1] === $sep); |
|
| 77 | + foreach ($lignes as $v) $nbcols &= ($v[strlen($v) - 1] === $sep); |
|
| 78 | 78 | if (!$nbcols) break; |
| 79 | - $entete = substr($entete,0,-1); |
|
| 80 | - foreach($lignes as $k=>$v) $lignes[$k] = substr($v,0,-1); |
|
| 79 | + $entete = substr($entete, 0, -1); |
|
| 80 | + foreach ($lignes as $k=>$v) $lignes[$k] = substr($v, 0, -1); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - foreach($lignes as &$l) { |
|
| 83 | + foreach ($lignes as &$l) { |
|
| 84 | 84 | $l = explode($sep, $l); |
| 85 | 85 | } |
| 86 | 86 | return array(explode($sep, $entete), $lignes); |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | function analyse_csv($t) |
| 16 | 18 | { |
@@ -18,8 +20,7 @@ discard block |
||
| 18 | 20 | $pvirg = substr_count($t, ';'); |
| 19 | 21 | $tab = substr_count($t, "\t"); |
| 20 | 22 | if ($virg > $pvirg) |
| 21 | - { $sep = ','; $hs = ',';} |
|
| 22 | - else { $sep = ';'; $hs = ';'; $virg = $pvirg;} |
|
| 23 | + { $sep = ','; $hs = ',';} else { $sep = ';'; $hs = ';'; $virg = $pvirg;} |
|
| 23 | 24 | if ($tab > $virg) {$sep = "\t"; $hs = "\t";} |
| 24 | 25 | |
| 25 | 26 | $t = preg_replace('/\r?\n/', "\n", |
@@ -30,12 +31,13 @@ discard block |
||
| 30 | 31 | $t = preg_replace("/([\n$sep])\"\"\"/",'\\1""#',$t); |
| 31 | 32 | $t = str_replace('""','"#',$t); |
| 32 | 33 | preg_match_all('/"[^"]*"/', $t, $r); |
| 33 | - foreach($r[0] as $cell) |
|
| 34 | - $t = str_replace($cell, |
|
| 34 | + foreach($r[0] as $cell) { |
|
| 35 | + $t = str_replace($cell, |
|
| 35 | 36 | str_replace($sep, $hs, |
| 36 | 37 | str_replace("\n", "<br />", |
| 37 | 38 | substr($cell,1,-1))), |
| 38 | 39 | $t); |
| 40 | + } |
|
| 39 | 41 | list($entete, $corps) = explode("\n",$t,2); |
| 40 | 42 | $caption = ''; |
| 41 | 43 | // sauter la ligne de tete formee seulement de separateurs |
@@ -48,36 +50,46 @@ discard block |
||
| 48 | 50 | list($entete, $corps) = explode("\n",$corps,2); |
| 49 | 51 | } |
| 50 | 52 | // si premiere colonne vide, le raccourci doit quand meme produire <th... |
| 51 | - if ($entete[0] == $sep) $entete = ' ' . $entete; |
|
| 53 | + if ($entete[0] == $sep) { |
|
| 54 | + $entete = ' ' . $entete; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | $lignes = explode("\n", $corps); |
| 54 | 58 | |
| 55 | 59 | // retrait des lignes vides finales |
| 56 | 60 | while(count($lignes) > 0 |
| 57 | - AND preg_match("/^$sep*$/", $lignes[count($lignes)-1])) |
|
| 58 | - unset($lignes[count($lignes)-1]); |
|
| 61 | + AND preg_match("/^$sep*$/", $lignes[count($lignes)-1])) { |
|
| 62 | + unset($lignes[count($lignes)-1]); |
|
| 63 | + } |
|
| 59 | 64 | // calcul du nombre de colonne a chaque ligne |
| 60 | 65 | $nbcols = array(); |
| 61 | 66 | $max = $mil = substr_count($entete, $sep); |
| 62 | 67 | foreach($lignes as $k=>$v) { |
| 63 | 68 | if ($max <> ($nbcols[$k]= substr_count($v, $sep))) { |
| 64 | - if ($max > $nbcols[$k]) |
|
| 65 | - $mil = $nbcols[$k]; |
|
| 66 | - else { $mil = $max; $max = $nbcols[$k];} |
|
| 69 | + if ($max > $nbcols[$k]) { |
|
| 70 | + $mil = $nbcols[$k]; |
|
| 71 | + } else { $mil = $max; $max = $nbcols[$k];} |
|
| 67 | 72 | } |
| 68 | 73 | } |
| 69 | 74 | // Si pas le meme nombre, cadrer au nombre max |
| 70 | - if ($mil <> $max) |
|
| 71 | - foreach($nbcols as $k=>$v) { |
|
| 75 | + if ($mil <> $max) { |
|
| 76 | + foreach($nbcols as $k=>$v) { |
|
| 72 | 77 | if ($v < $max) $lignes[$k].= str_repeat($sep, $max-$v); |
| 78 | + } |
|
| 73 | 79 | } |
| 74 | 80 | // et retirer les colonnes integralement vides |
| 75 | 81 | while(true) { |
| 76 | 82 | $nbcols = ($entete[strlen($entete)-1]===$sep); |
| 77 | - foreach($lignes as $v) $nbcols &= ($v[strlen($v)-1]===$sep); |
|
| 78 | - if (!$nbcols) break; |
|
| 83 | + foreach($lignes as $v) { |
|
| 84 | + $nbcols &= ($v[strlen($v)-1]===$sep); |
|
| 85 | + } |
|
| 86 | + if (!$nbcols) { |
|
| 87 | + break; |
|
| 88 | + } |
|
| 79 | 89 | $entete = substr($entete,0,-1); |
| 80 | - foreach($lignes as $k=>$v) $lignes[$k] = substr($v,0,-1); |
|
| 90 | + foreach($lignes as $k=>$v) { |
|
| 91 | + $lignes[$k] = substr($v,0,-1); |
|
| 92 | + } |
|
| 81 | 93 | } |
| 82 | 94 | |
| 83 | 95 | foreach($lignes as &$l) { |
@@ -20,14 +20,14 @@ |
||
| 20 | 20 | * http://zoumzamzouilam/truc/chose/machin..." |
| 21 | 21 | */ |
| 22 | 22 | function inc_lien_court($url) { |
| 23 | - $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40; |
|
| 24 | - $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35; |
|
| 23 | + $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40; |
|
| 24 | + $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35; |
|
| 25 | 25 | |
| 26 | - if (strlen($url)>$long_url) { |
|
| 27 | - $url = substr($url,0,$coupe_url).'...'; |
|
| 28 | - } |
|
| 26 | + if (strlen($url)>$long_url) { |
|
| 27 | + $url = substr($url,0,$coupe_url).'...'; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - return $url; |
|
| 30 | + return $url; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | ?> |
| 34 | 34 | \ No newline at end of file |
@@ -23,8 +23,8 @@ |
||
| 23 | 23 | $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40; |
| 24 | 24 | $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35; |
| 25 | 25 | |
| 26 | - if (strlen($url)>$long_url) { |
|
| 27 | - $url = substr($url,0,$coupe_url).'...'; |
|
| 26 | + if (strlen($url) > $long_url) { |
|
| 27 | + $url = substr($url, 0, $coupe_url).'...'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return $url; |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /* |
| 16 | 18 | * Cette fonction prend une URL et la raccourcit si elle est trop longue |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | # Les information d'une rubrique selectionnee dans le mini navigateur |
| 16 | 18 | |
@@ -26,19 +28,22 @@ discard block |
||
| 26 | 28 | } else { |
| 27 | 29 | $titre = _T('info_racine_site'); |
| 28 | 30 | } |
| 29 | - } else |
|
| 30 | - $titre = ''; |
|
| 31 | + } else { |
|
| 32 | + $titre = ''; |
|
| 33 | + } |
|
| 31 | 34 | |
| 32 | 35 | $res = ''; |
| 33 | - if ($type == "rubrique" AND $GLOBALS['spip_display'] != 1 AND isset($GLOBALS['meta']['image_process'])) |
|
| 34 | - if ($GLOBALS['meta']['image_process'] != "non") { |
|
| 36 | + if ($type == "rubrique" AND $GLOBALS['spip_display'] != 1 AND isset($GLOBALS['meta']['image_process'])) { |
|
| 37 | + if ($GLOBALS['meta']['image_process'] != "non") { |
|
| 35 | 38 | $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
| 39 | + } |
|
| 36 | 40 | if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
| 37 | 41 | list($fid, $dir, $nom, $format) = $res; |
| 38 | 42 | include_spip('inc/filtres_images_mini'); |
| 39 | 43 | $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
| 40 | - if ($res) |
|
| 41 | - $res = "<div style='float: ".$GLOBALS['spip_lang_right']."; margin-".$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 44 | + if ($res) { |
|
| 45 | + $res = "<div style='float: ".$GLOBALS['spip_lang_right']."; margin-".$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 46 | + } |
|
| 42 | 47 | } |
| 43 | 48 | } |
| 44 | 49 | |
@@ -17,57 +17,57 @@ |
||
| 17 | 17 | // http://doc.spip.org/@inc_informer_dist |
| 18 | 18 | function inc_informer_dist($id, $col, $exclus, $rac, $type, $do='aff') |
| 19 | 19 | { |
| 20 | - include_spip('inc/texte'); |
|
| 21 | - if ($type == "rubrique") { |
|
| 22 | - $row = sql_fetsel("titre, descriptif", "spip_rubriques", "id_rubrique = " . intval($id)); |
|
| 23 | - if ($row) { |
|
| 24 | - $titre = typo($row["titre"]); |
|
| 25 | - $descriptif = propre($row["descriptif"]); |
|
| 26 | - } else { |
|
| 27 | - $titre = _T('info_racine_site'); |
|
| 28 | - } |
|
| 29 | - } else |
|
| 30 | - $titre = ''; |
|
| 20 | + include_spip('inc/texte'); |
|
| 21 | + if ($type == "rubrique") { |
|
| 22 | + $row = sql_fetsel("titre, descriptif", "spip_rubriques", "id_rubrique = " . intval($id)); |
|
| 23 | + if ($row) { |
|
| 24 | + $titre = typo($row["titre"]); |
|
| 25 | + $descriptif = propre($row["descriptif"]); |
|
| 26 | + } else { |
|
| 27 | + $titre = _T('info_racine_site'); |
|
| 28 | + } |
|
| 29 | + } else |
|
| 30 | + $titre = ''; |
|
| 31 | 31 | |
| 32 | - $res = ''; |
|
| 33 | - if ($type == "rubrique" AND $GLOBALS['spip_display'] != 1 AND isset($GLOBALS['meta']['image_process'])) |
|
| 34 | - if ($GLOBALS['meta']['image_process'] != "non") { |
|
| 35 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 36 | - if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
|
| 37 | - list($fid, $dir, $nom, $format) = $res; |
|
| 38 | - include_spip('inc/filtres_images_mini'); |
|
| 39 | - $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
|
| 40 | - if ($res) |
|
| 41 | - $res = "<div style='float: ".$GLOBALS['spip_lang_right']."; margin-".$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 42 | - } |
|
| 43 | - } |
|
| 32 | + $res = ''; |
|
| 33 | + if ($type == "rubrique" AND $GLOBALS['spip_display'] != 1 AND isset($GLOBALS['meta']['image_process'])) |
|
| 34 | + if ($GLOBALS['meta']['image_process'] != "non") { |
|
| 35 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 36 | + if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
|
| 37 | + list($fid, $dir, $nom, $format) = $res; |
|
| 38 | + include_spip('inc/filtres_images_mini'); |
|
| 39 | + $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
|
| 40 | + if ($res) |
|
| 41 | + $res = "<div style='float: ".$GLOBALS['spip_lang_right']."; margin-".$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $rac = spip_htmlentities($rac, ENT_QUOTES); |
|
| 46 | - $do = spip_htmlentities($do, ENT_QUOTES); |
|
| 47 | - $id = intval($id); |
|
| 45 | + $rac = spip_htmlentities($rac, ENT_QUOTES); |
|
| 46 | + $do = spip_htmlentities($do, ENT_QUOTES); |
|
| 47 | + $id = intval($id); |
|
| 48 | 48 | |
| 49 | 49 | # ce lien provoque la selection (directe) de la rubrique cliquee |
| 50 | 50 | # et l'affichage de son titre dans le bandeau |
| 51 | - $titre = strtr(str_replace("'", "’", |
|
| 52 | - str_replace('"', """, textebrut($titre))), |
|
| 53 | - "\n\r", " "); |
|
| 51 | + $titre = strtr(str_replace("'", "’", |
|
| 52 | + str_replace('"', """, textebrut($titre))), |
|
| 53 | + "\n\r", " "); |
|
| 54 | 54 | |
| 55 | - $js_func = $do . '_selection_titre'; |
|
| 56 | - return "<div style='display: none;'>" |
|
| 57 | - . "<input type='text' id='".$rac."_sel' value='$id' />" |
|
| 58 | - . "<input type='text' id='".$rac."_sel2' value=\"" |
|
| 59 | - . entites_html($titre) |
|
| 60 | - . "\" />" |
|
| 61 | - . "</div>" |
|
| 62 | - . "<div class='informer' style='padding: 5px; border-top: 0px;'>" |
|
| 63 | - . (!$res ? '' : $res) |
|
| 64 | - . "<p><b>".safehtml($titre)."</b></p>" |
|
| 65 | - . (!$descriptif ? '' : "<div>".safehtml($descriptif)."</div>") |
|
| 66 | - . "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 67 | - . "<input type='submit' class='fondo' value='" |
|
| 68 | - . _T('bouton_choisir') |
|
| 69 | - . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />" |
|
| 70 | - . "</div>" |
|
| 71 | - . "</div>"; |
|
| 55 | + $js_func = $do . '_selection_titre'; |
|
| 56 | + return "<div style='display: none;'>" |
|
| 57 | + . "<input type='text' id='".$rac."_sel' value='$id' />" |
|
| 58 | + . "<input type='text' id='".$rac."_sel2' value=\"" |
|
| 59 | + . entites_html($titre) |
|
| 60 | + . "\" />" |
|
| 61 | + . "</div>" |
|
| 62 | + . "<div class='informer' style='padding: 5px; border-top: 0px;'>" |
|
| 63 | + . (!$res ? '' : $res) |
|
| 64 | + . "<p><b>".safehtml($titre)."</b></p>" |
|
| 65 | + . (!$descriptif ? '' : "<div>".safehtml($descriptif)."</div>") |
|
| 66 | + . "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 67 | + . "<input type='submit' class='fondo' value='" |
|
| 68 | + . _T('bouton_choisir') |
|
| 69 | + . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />" |
|
| 70 | + . "</div>" |
|
| 71 | + . "</div>"; |
|
| 72 | 72 | } |
| 73 | 73 | ?> |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | # Les information d'une rubrique selectionnee dans le mini navigateur |
| 16 | 16 | |
| 17 | 17 | // http://doc.spip.org/@inc_informer_dist |
| 18 | -function inc_informer_dist($id, $col, $exclus, $rac, $type, $do='aff') |
|
| 18 | +function inc_informer_dist($id, $col, $exclus, $rac, $type, $do = 'aff') |
|
| 19 | 19 | { |
| 20 | 20 | include_spip('inc/texte'); |
| 21 | 21 | if ($type == "rubrique") { |
| 22 | - $row = sql_fetsel("titre, descriptif", "spip_rubriques", "id_rubrique = " . intval($id)); |
|
| 22 | + $row = sql_fetsel("titre, descriptif", "spip_rubriques", "id_rubrique = ".intval($id)); |
|
| 23 | 23 | if ($row) { |
| 24 | 24 | $titre = typo($row["titre"]); |
| 25 | 25 | $descriptif = propre($row["descriptif"]); |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | if ($type == "rubrique" AND $GLOBALS['spip_display'] != 1 AND isset($GLOBALS['meta']['image_process'])) |
| 34 | 34 | if ($GLOBALS['meta']['image_process'] != "non") { |
| 35 | 35 | $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
| 36 | - if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
|
| 36 | + if ($res = $chercher_logo($id, 'id_rubrique', 'on')) { |
|
| 37 | 37 | list($fid, $dir, $nom, $format) = $res; |
| 38 | 38 | include_spip('inc/filtres_images_mini'); |
| 39 | 39 | $res = image_reduire("<img src='$fid' alt='' />", 100, 48); |
| 40 | 40 | if ($res) |
| 41 | - $res = "<div style='float: ".$GLOBALS['spip_lang_right']."; margin-".$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 41 | + $res = "<div style='float: ".$GLOBALS['spip_lang_right']."; margin-".$GLOBALS['spip_lang_right'].": -5px; margin-top: -5px;'>$res</div>"; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | str_replace('"', """, textebrut($titre))), |
| 53 | 53 | "\n\r", " "); |
| 54 | 54 | |
| 55 | - $js_func = $do . '_selection_titre'; |
|
| 55 | + $js_func = $do.'_selection_titre'; |
|
| 56 | 56 | return "<div style='display: none;'>" |
| 57 | 57 | . "<input type='text' id='".$rac."_sel' value='$id' />" |
| 58 | 58 | . "<input type='text' id='".$rac."_sel2' value=\"" |