@@ -31,6 +31,9 @@ discard block |
||
| 31 | 31 | include_spip('inc/filtres_alertes'); |
| 32 | 32 | |
| 33 | 33 | // https://code.spip.net/@debut_cadre |
| 34 | +/** |
|
| 35 | + * @param string $style |
|
| 36 | + */ |
|
| 34 | 37 | function debut_cadre($style, $icone = "", $fonction = "", $titre = "", $id = "", $class = "", $padding = true) { |
| 35 | 38 | $style_mapping = array( |
| 36 | 39 | 'r' => 'simple', |
@@ -184,6 +187,10 @@ discard block |
||
| 184 | 187 | function fin_onglet() { return "</ul></div>\n"; } |
| 185 | 188 | |
| 186 | 189 | // https://code.spip.net/@onglet |
| 190 | +/** |
|
| 191 | + * @param string $texte |
|
| 192 | + * @param string $onglet |
|
| 193 | + */ |
|
| 187 | 194 | function onglet($texte, $lien, $onglet_ref, $onglet, $icone = "") { |
| 188 | 195 | return "<li>" |
| 189 | 196 | . ($icone ? http_img_pack($icone, '', " class='cadre-icone'") : '') |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | * Pile complétée par le code à générer |
| 39 | 39 | */ |
| 40 | 40 | function balise_ALERTE_dist($p) { |
| 41 | - $_texte = interprete_argument_balise(1, $p); |
|
| 42 | - $_titre = interprete_argument_balise(2, $p); |
|
| 43 | - $_class = interprete_argument_balise(3, $p); |
|
| 44 | - $_role = interprete_argument_balise(4, $p); |
|
| 45 | - $_id = interprete_argument_balise(5, $p); |
|
| 46 | - $_titre = ($_titre ? ", $_titre" : "''"); |
|
| 47 | - $_class = ($_class ? ", $_class" : ", ''"); |
|
| 48 | - $_role = ($_role ? ", $_role" : ", ''"); |
|
| 49 | - $_id = ($_id ? ", $_id" : ", ''"); |
|
| 50 | - |
|
| 51 | - $f = chercher_filtre('message_alerte'); |
|
| 52 | - $p->code = "$f($_texte$_titre$_class$_role$_id)"; |
|
| 53 | - $p->interdire_scripts = false; |
|
| 54 | - |
|
| 55 | - return $p; |
|
| 41 | + $_texte = interprete_argument_balise(1, $p); |
|
| 42 | + $_titre = interprete_argument_balise(2, $p); |
|
| 43 | + $_class = interprete_argument_balise(3, $p); |
|
| 44 | + $_role = interprete_argument_balise(4, $p); |
|
| 45 | + $_id = interprete_argument_balise(5, $p); |
|
| 46 | + $_titre = ($_titre ? ", $_titre" : "''"); |
|
| 47 | + $_class = ($_class ? ", $_class" : ", ''"); |
|
| 48 | + $_role = ($_role ? ", $_role" : ", ''"); |
|
| 49 | + $_id = ($_id ? ", $_id" : ", ''"); |
|
| 50 | + |
|
| 51 | + $f = chercher_filtre('message_alerte'); |
|
| 52 | + $p->code = "$f($_texte$_titre$_class$_role$_id)"; |
|
| 53 | + $p->interdire_scripts = false; |
|
| 54 | + |
|
| 55 | + return $p; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | * Pile complétée par le code à générer |
| 76 | 76 | */ |
| 77 | 77 | function balise_ALERTE_OUVRIR_dist($p) { |
| 78 | - $_titre = interprete_argument_balise(1, $p); |
|
| 79 | - $_class = interprete_argument_balise(2, $p); |
|
| 80 | - $_role = interprete_argument_balise(3, $p); |
|
| 81 | - $_id = interprete_argument_balise(4, $p); |
|
| 82 | - $_titre = ($_titre ? "$_titre" : "''"); |
|
| 83 | - $_class = ($_class ? ", $_class" : ", ''"); |
|
| 84 | - $_role = ($_role ? ", $_role" : ", ''"); |
|
| 85 | - $_id = ($_id ? ", $_id" : ", ''"); |
|
| 86 | - |
|
| 87 | - $f = chercher_filtre('message_alerte_ouvrir'); |
|
| 88 | - $p->code = "$f($_titre$_class$_role$_id)"; |
|
| 89 | - $p->interdire_scripts = false; |
|
| 90 | - |
|
| 91 | - return $p; |
|
| 78 | + $_titre = interprete_argument_balise(1, $p); |
|
| 79 | + $_class = interprete_argument_balise(2, $p); |
|
| 80 | + $_role = interprete_argument_balise(3, $p); |
|
| 81 | + $_id = interprete_argument_balise(4, $p); |
|
| 82 | + $_titre = ($_titre ? "$_titre" : "''"); |
|
| 83 | + $_class = ($_class ? ", $_class" : ", ''"); |
|
| 84 | + $_role = ($_role ? ", $_role" : ", ''"); |
|
| 85 | + $_id = ($_id ? ", $_id" : ", ''"); |
|
| 86 | + |
|
| 87 | + $f = chercher_filtre('message_alerte_ouvrir'); |
|
| 88 | + $p->code = "$f($_titre$_class$_role$_id)"; |
|
| 89 | + $p->interdire_scripts = false; |
|
| 90 | + |
|
| 91 | + return $p; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | * Pile complétée par le code à générer |
| 111 | 111 | */ |
| 112 | 112 | function balise_ALERTE_FERMER_dist($p) { |
| 113 | - $f = chercher_filtre('message_alerte_fermer'); |
|
| 114 | - $p->code = "$f()"; |
|
| 115 | - $p->interdire_scripts = false; |
|
| 113 | + $f = chercher_filtre('message_alerte_fermer'); |
|
| 114 | + $p->code = "$f()"; |
|
| 115 | + $p->interdire_scripts = false; |
|
| 116 | 116 | |
| 117 | - return $p; |
|
| 117 | + return $p; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function message_alerte(string $texte, string $titre = '', string $class = '', string $role = '', string $id = '') : string { |
| 144 | 144 | |
| 145 | - $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir'); |
|
| 146 | - $message_alerte_fermer = chercher_filtre('message_alerte_fermer'); |
|
| 147 | - $message = |
|
| 148 | - $message_alerte_ouvrir($titre, $class, $role, $id) . |
|
| 149 | - $texte . |
|
| 150 | - $message_alerte_fermer(); |
|
| 145 | + $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir'); |
|
| 146 | + $message_alerte_fermer = chercher_filtre('message_alerte_fermer'); |
|
| 147 | + $message = |
|
| 148 | + $message_alerte_ouvrir($titre, $class, $role, $id) . |
|
| 149 | + $texte . |
|
| 150 | + $message_alerte_fermer(); |
|
| 151 | 151 | |
| 152 | - return $message; |
|
| 152 | + return $message; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -175,53 +175,53 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | function message_alerte_ouvrir(string $titre = '', string $class = '', string $role = '', string $id = '') : string { |
| 177 | 177 | |
| 178 | - $prive = test_espace_prive(); |
|
| 179 | - |
|
| 180 | - // Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter |
|
| 181 | - $types = [ |
|
| 182 | - 'notice', |
|
| 183 | - 'error', |
|
| 184 | - 'success', |
|
| 185 | - 'info', |
|
| 186 | - ]; |
|
| 187 | - $type = array_intersect(explode(' ', $class), $types); |
|
| 188 | - $type = reset($type) ?: 'notice'; |
|
| 189 | - $class = trim(str_replace($types, '', $class) . " $type"); |
|
| 190 | - |
|
| 191 | - // Role |
|
| 192 | - $role = $role ?: 'alert'; |
|
| 193 | - |
|
| 194 | - // Classes |
|
| 195 | - $class_racine = 'msg-alert'; |
|
| 196 | - $clearfix = ($prive ? 'clearfix' : ''); |
|
| 197 | - $class_alerte = "$class_racine $class"; |
|
| 198 | - $class_texte = "${class_racine}__text $clearfix"; |
|
| 199 | - $class_titre = "${class_racine}__heading"; |
|
| 200 | - |
|
| 201 | - // Titre : markup |
|
| 202 | - $titre = trim($titre); |
|
| 203 | - if (strlen($titre)) { |
|
| 204 | - include_spip('inc/filtres'); |
|
| 205 | - // Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon. |
|
| 206 | - $cherche_tag = ($prive ? '<h' : '<'); |
|
| 207 | - $wrap_tag = ($prive ? '<h3>' : '<div>'); |
|
| 208 | - if (strpos($titre, $cherche_tag) !== 0) { |
|
| 209 | - $titre = wrap($titre, $wrap_tag); |
|
| 210 | - } |
|
| 211 | - // puis on ajoute la classe |
|
| 212 | - $titre = ajouter_class($titre, $class_titre); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - // Autres attributs |
|
| 216 | - $attr_id = ($id ? "id=\"$id\"" : ''); |
|
| 217 | - $attr_data = ($type ? "data-$role=\"$type\"" : ''); |
|
| 218 | - |
|
| 219 | - $message = |
|
| 220 | - "<div class=\"$class_alerte\" role=\"$role\" $attr_id $attr_data>" . |
|
| 221 | - $titre . |
|
| 222 | - "<div class=\"$class_texte\">"; |
|
| 223 | - |
|
| 224 | - return $message; |
|
| 178 | + $prive = test_espace_prive(); |
|
| 179 | + |
|
| 180 | + // Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter |
|
| 181 | + $types = [ |
|
| 182 | + 'notice', |
|
| 183 | + 'error', |
|
| 184 | + 'success', |
|
| 185 | + 'info', |
|
| 186 | + ]; |
|
| 187 | + $type = array_intersect(explode(' ', $class), $types); |
|
| 188 | + $type = reset($type) ?: 'notice'; |
|
| 189 | + $class = trim(str_replace($types, '', $class) . " $type"); |
|
| 190 | + |
|
| 191 | + // Role |
|
| 192 | + $role = $role ?: 'alert'; |
|
| 193 | + |
|
| 194 | + // Classes |
|
| 195 | + $class_racine = 'msg-alert'; |
|
| 196 | + $clearfix = ($prive ? 'clearfix' : ''); |
|
| 197 | + $class_alerte = "$class_racine $class"; |
|
| 198 | + $class_texte = "${class_racine}__text $clearfix"; |
|
| 199 | + $class_titre = "${class_racine}__heading"; |
|
| 200 | + |
|
| 201 | + // Titre : markup |
|
| 202 | + $titre = trim($titre); |
|
| 203 | + if (strlen($titre)) { |
|
| 204 | + include_spip('inc/filtres'); |
|
| 205 | + // Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon. |
|
| 206 | + $cherche_tag = ($prive ? '<h' : '<'); |
|
| 207 | + $wrap_tag = ($prive ? '<h3>' : '<div>'); |
|
| 208 | + if (strpos($titre, $cherche_tag) !== 0) { |
|
| 209 | + $titre = wrap($titre, $wrap_tag); |
|
| 210 | + } |
|
| 211 | + // puis on ajoute la classe |
|
| 212 | + $titre = ajouter_class($titre, $class_titre); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + // Autres attributs |
|
| 216 | + $attr_id = ($id ? "id=\"$id\"" : ''); |
|
| 217 | + $attr_data = ($type ? "data-$role=\"$type\"" : ''); |
|
| 218 | + |
|
| 219 | + $message = |
|
| 220 | + "<div class=\"$class_alerte\" role=\"$role\" $attr_id $attr_data>" . |
|
| 221 | + $titre . |
|
| 222 | + "<div class=\"$class_texte\">"; |
|
| 223 | + |
|
| 224 | + return $message; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -235,5 +235,5 @@ discard block |
||
| 235 | 235 | * HTML de fin de l'alerte |
| 236 | 236 | */ |
| 237 | 237 | function message_alerte_fermer() : string { |
| 238 | - return '</div></div>'; |
|
| 238 | + return '</div></div>'; |
|
| 239 | 239 | } |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir'); |
| 146 | 146 | $message_alerte_fermer = chercher_filtre('message_alerte_fermer'); |
| 147 | 147 | $message = |
| 148 | - $message_alerte_ouvrir($titre, $class, $role, $id) . |
|
| 149 | - $texte . |
|
| 148 | + $message_alerte_ouvrir($titre, $class, $role, $id). |
|
| 149 | + $texte. |
|
| 150 | 150 | $message_alerte_fermer(); |
| 151 | 151 | |
| 152 | 152 | return $message; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ]; |
| 187 | 187 | $type = array_intersect(explode(' ', $class), $types); |
| 188 | 188 | $type = reset($type) ?: 'notice'; |
| 189 | - $class = trim(str_replace($types, '', $class) . " $type"); |
|
| 189 | + $class = trim(str_replace($types, '', $class)." $type"); |
|
| 190 | 190 | |
| 191 | 191 | // Role |
| 192 | 192 | $role = $role ?: 'alert'; |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | $attr_data = ($type ? "data-$role=\"$type\"" : ''); |
| 218 | 218 | |
| 219 | 219 | $message = |
| 220 | - "<div class=\"$class_alerte\" role=\"$role\" $attr_id $attr_data>" . |
|
| 221 | - $titre . |
|
| 220 | + "<div class=\"$class_alerte\" role=\"$role\" $attr_id $attr_data>". |
|
| 221 | + $titre. |
|
| 222 | 222 | "<div class=\"$class_texte\">"; |
| 223 | 223 | |
| 224 | 224 | return $message; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | * Pile complétée par le code à générer |
| 45 | 45 | */ |
| 46 | 46 | function balise_BOITE_OUVRIR_dist($p) { |
| 47 | - $_titre = interprete_argument_balise(1, $p); |
|
| 48 | - $_class = interprete_argument_balise(2, $p); |
|
| 49 | - $_head_class = interprete_argument_balise(3, $p); |
|
| 50 | - $_titre = ($_titre ? $_titre : "''"); |
|
| 51 | - $_class = ($_class ? ", $_class" : ", 'simple'"); |
|
| 52 | - $_head_class = ($_head_class ? ", $_head_class" : ''); |
|
| 53 | - |
|
| 54 | - $f = chercher_filtre('boite_ouvrir'); |
|
| 55 | - $p->code = "$f($_titre$_class$_head_class)"; |
|
| 56 | - $p->interdire_scripts = false; |
|
| 57 | - |
|
| 58 | - return $p; |
|
| 47 | + $_titre = interprete_argument_balise(1, $p); |
|
| 48 | + $_class = interprete_argument_balise(2, $p); |
|
| 49 | + $_head_class = interprete_argument_balise(3, $p); |
|
| 50 | + $_titre = ($_titre ? $_titre : "''"); |
|
| 51 | + $_class = ($_class ? ", $_class" : ", 'simple'"); |
|
| 52 | + $_head_class = ($_head_class ? ", $_head_class" : ''); |
|
| 53 | + |
|
| 54 | + $f = chercher_filtre('boite_ouvrir'); |
|
| 55 | + $p->code = "$f($_titre$_class$_head_class)"; |
|
| 56 | + $p->interdire_scripts = false; |
|
| 57 | + |
|
| 58 | + return $p; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | * Pile complétée par le code à générer |
| 76 | 76 | */ |
| 77 | 77 | function balise_BOITE_PIED_dist($p) { |
| 78 | - $_class = interprete_argument_balise(1, $p); |
|
| 79 | - $_class = ($_class ? "$_class" : ''); |
|
| 78 | + $_class = interprete_argument_balise(1, $p); |
|
| 79 | + $_class = ($_class ? "$_class" : ''); |
|
| 80 | 80 | |
| 81 | - $f = chercher_filtre('boite_pied'); |
|
| 82 | - $p->code = "$f($_class)"; |
|
| 83 | - $p->interdire_scripts = false; |
|
| 81 | + $f = chercher_filtre('boite_pied'); |
|
| 82 | + $p->code = "$f($_class)"; |
|
| 83 | + $p->interdire_scripts = false; |
|
| 84 | 84 | |
| 85 | - return $p; |
|
| 85 | + return $p; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | * Pile complétée par le code à générer |
| 103 | 103 | */ |
| 104 | 104 | function balise_BOITE_FERMER_dist($p) { |
| 105 | - $f = chercher_filtre('boite_fermer'); |
|
| 106 | - $p->code = "$f()"; |
|
| 107 | - $p->interdire_scripts = false; |
|
| 105 | + $f = chercher_filtre('boite_fermer'); |
|
| 106 | + $p->code = "$f()"; |
|
| 107 | + $p->interdire_scripts = false; |
|
| 108 | 108 | |
| 109 | - return $p; |
|
| 109 | + return $p; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -128,16 +128,16 @@ discard block |
||
| 128 | 128 | * HTML du début de la boîte |
| 129 | 129 | */ |
| 130 | 130 | function boite_ouvrir($titre, $class = '', $head_class = '', $id = '') { |
| 131 | - $class = "box $class"; |
|
| 132 | - $head_class = "box__header $head_class clearfix"; |
|
| 133 | - // dans l'espace prive, titrer en h3 si pas de balise <hn> |
|
| 134 | - if (test_espace_prive() and strlen($titre) and strpos($titre, '<h') === false) { |
|
| 135 | - $titre = "<h3>$titre</h3>"; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">' |
|
| 139 | - . ($titre ? "<div class=\"$head_class\">$titre<!--/hd--></div>" : '') |
|
| 140 | - . '<div class="box__body clearfix">'; |
|
| 131 | + $class = "box $class"; |
|
| 132 | + $head_class = "box__header $head_class clearfix"; |
|
| 133 | + // dans l'espace prive, titrer en h3 si pas de balise <hn> |
|
| 134 | + if (test_espace_prive() and strlen($titre) and strpos($titre, '<h') === false) { |
|
| 135 | + $titre = "<h3>$titre</h3>"; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">' |
|
| 139 | + . ($titre ? "<div class=\"$head_class\">$titre<!--/hd--></div>" : '') |
|
| 140 | + . '<div class="box__body clearfix">'; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | * HTML de transition vers le pied de la boîte |
| 155 | 155 | */ |
| 156 | 156 | function boite_pied($class = 'act') { |
| 157 | - $class = "box__footer $class"; |
|
| 157 | + $class = "box__footer $class"; |
|
| 158 | 158 | |
| 159 | - return '</div>' |
|
| 160 | - . "<div class=\"$class clearfix\">"; |
|
| 159 | + return '</div>' |
|
| 160 | + . "<div class=\"$class clearfix\">"; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
@@ -172,6 +172,6 @@ discard block |
||
| 172 | 172 | * HTML de fin de la boîte |
| 173 | 173 | */ |
| 174 | 174 | function boite_fermer() { |
| 175 | - return '</div>' |
|
| 176 | - . '</div>'; |
|
| 175 | + return '</div>' |
|
| 176 | + . '</div>'; |
|
| 177 | 177 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | $titre = "<h3>$titre</h3>"; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">' |
|
| 138 | + return '<div class="'.$class.($id ? "\" id=\"$id" : '').'">' |
|
| 139 | 139 | . ($titre ? "<div class=\"$head_class\">$titre<!--/hd--></div>" : '') |
| 140 | 140 | . '<div class="box__body clearfix">'; |
| 141 | 141 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | include_spip('inc/autoriser'); |
@@ -31,79 +31,79 @@ discard block |
||
| 31 | 31 | * Un tableau des sous rubriques |
| 32 | 32 | */ |
| 33 | 33 | function enfant_rub($collection, $debut = 0, $limite = 500) { |
| 34 | - $voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != 'non'); |
|
| 35 | - $logo = ''; |
|
| 36 | - |
|
| 37 | - if ($voir_logo) { |
|
| 38 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 39 | - include_spip('inc/filtres_images_mini'); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $res = array(); |
|
| 43 | - |
|
| 44 | - $result = sql_select( |
|
| 45 | - 'id_rubrique, id_parent, titre, descriptif, lang', |
|
| 46 | - 'spip_rubriques', |
|
| 47 | - 'id_parent='.intval($collection), |
|
| 48 | - '', |
|
| 49 | - '0+titre,titre', |
|
| 50 | - "$debut,$limite" |
|
| 51 | - ); |
|
| 52 | - while ($row = sql_fetch($result)) { |
|
| 53 | - $id_rubrique = $row['id_rubrique']; |
|
| 54 | - $id_parent = $row['id_parent']; |
|
| 55 | - // pour etre sur de passer par tous les traitements |
|
| 56 | - $titre = generer_info_entite($id_rubrique, 'rubrique', 'titre'); |
|
| 57 | - if ('' !== ($rang = recuperer_numero($row['titre']))) { |
|
| 58 | - $rang = "$rang. "; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 62 | - $les_sous_enfants = sous_enfant_rub($id_rubrique); |
|
| 63 | - |
|
| 64 | - changer_typo($row['lang']); |
|
| 65 | - $lang_dir = lang_dir($row['lang']); |
|
| 66 | - $descriptif = propre($row['descriptif']); |
|
| 67 | - |
|
| 68 | - if ($voir_logo) { |
|
| 69 | - if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
|
| 70 | - list($fid, $dir, $nom, $format) = $logo; |
|
| 71 | - $logo = image_reduire("<img src='$fid' alt='' />", 70, 70); |
|
| 72 | - if ($logo) { |
|
| 73 | - $logo = inserer_attribut($logo, 'class', 'logo'); |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 79 | - http_img_pack( |
|
| 80 | - 'auteur-0minirezo-16.png', |
|
| 81 | - '', |
|
| 82 | - " width='16' height='16'", |
|
| 83 | - _T('image_administrer_rubrique') |
|
| 84 | - )) . |
|
| 85 | - " <a dir='$lang_dir'" . |
|
| 86 | - ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 87 | - " href='" . |
|
| 88 | - generer_url_entite($id_rubrique, 'rubrique') . |
|
| 89 | - "'>" . |
|
| 90 | - $rang . $titre |
|
| 91 | - . '</a>' |
|
| 92 | - . (is_string($logo) ? $logo : ''); |
|
| 93 | - |
|
| 94 | - $titre = bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants$id_rubrique") |
|
| 95 | - . (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") |
|
| 96 | - ; |
|
| 97 | - |
|
| 98 | - $res[] = |
|
| 99 | - debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | - $les_sous_enfants . |
|
| 101 | - fin_cadre_sous_rub(true); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite |
|
| 106 | - return $res; |
|
| 34 | + $voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != 'non'); |
|
| 35 | + $logo = ''; |
|
| 36 | + |
|
| 37 | + if ($voir_logo) { |
|
| 38 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 39 | + include_spip('inc/filtres_images_mini'); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $res = array(); |
|
| 43 | + |
|
| 44 | + $result = sql_select( |
|
| 45 | + 'id_rubrique, id_parent, titre, descriptif, lang', |
|
| 46 | + 'spip_rubriques', |
|
| 47 | + 'id_parent='.intval($collection), |
|
| 48 | + '', |
|
| 49 | + '0+titre,titre', |
|
| 50 | + "$debut,$limite" |
|
| 51 | + ); |
|
| 52 | + while ($row = sql_fetch($result)) { |
|
| 53 | + $id_rubrique = $row['id_rubrique']; |
|
| 54 | + $id_parent = $row['id_parent']; |
|
| 55 | + // pour etre sur de passer par tous les traitements |
|
| 56 | + $titre = generer_info_entite($id_rubrique, 'rubrique', 'titre'); |
|
| 57 | + if ('' !== ($rang = recuperer_numero($row['titre']))) { |
|
| 58 | + $rang = "$rang. "; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 62 | + $les_sous_enfants = sous_enfant_rub($id_rubrique); |
|
| 63 | + |
|
| 64 | + changer_typo($row['lang']); |
|
| 65 | + $lang_dir = lang_dir($row['lang']); |
|
| 66 | + $descriptif = propre($row['descriptif']); |
|
| 67 | + |
|
| 68 | + if ($voir_logo) { |
|
| 69 | + if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) { |
|
| 70 | + list($fid, $dir, $nom, $format) = $logo; |
|
| 71 | + $logo = image_reduire("<img src='$fid' alt='' />", 70, 70); |
|
| 72 | + if ($logo) { |
|
| 73 | + $logo = inserer_attribut($logo, 'class', 'logo'); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 79 | + http_img_pack( |
|
| 80 | + 'auteur-0minirezo-16.png', |
|
| 81 | + '', |
|
| 82 | + " width='16' height='16'", |
|
| 83 | + _T('image_administrer_rubrique') |
|
| 84 | + )) . |
|
| 85 | + " <a dir='$lang_dir'" . |
|
| 86 | + ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 87 | + " href='" . |
|
| 88 | + generer_url_entite($id_rubrique, 'rubrique') . |
|
| 89 | + "'>" . |
|
| 90 | + $rang . $titre |
|
| 91 | + . '</a>' |
|
| 92 | + . (is_string($logo) ? $logo : ''); |
|
| 93 | + |
|
| 94 | + $titre = bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants$id_rubrique") |
|
| 95 | + . (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>") |
|
| 96 | + ; |
|
| 97 | + |
|
| 98 | + $res[] = |
|
| 99 | + debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | + $les_sous_enfants . |
|
| 101 | + fin_cadre_sous_rub(true); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite |
|
| 106 | + return $res; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -116,65 +116,65 @@ discard block |
||
| 116 | 116 | * Le contenu du bloc dépliable |
| 117 | 117 | */ |
| 118 | 118 | function sous_enfant_rub($collection2) { |
| 119 | - $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2)); |
|
| 120 | - |
|
| 121 | - $retour = ''; |
|
| 122 | - $pagination = ''; |
|
| 123 | - $debut = 0; |
|
| 124 | - $limite = 500; |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * On ne va afficher que 500 résultats max |
|
| 128 | - * Si > 500 on affiche une pagination |
|
| 129 | - */ |
|
| 130 | - if ($nb > $limite) { |
|
| 131 | - $debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut; |
|
| 132 | - $pagination = chercher_filtre('pagination'); |
|
| 133 | - $pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true, |
|
| 134 | - 'prive') . '</p>'; |
|
| 135 | - $limite = $debut + $limite; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - $result = sql_select( |
|
| 139 | - 'id_rubrique, id_parent, titre, lang', |
|
| 140 | - 'spip_rubriques', |
|
| 141 | - 'id_parent='.intval($collection2), |
|
| 142 | - '', |
|
| 143 | - '0+titre,titre', |
|
| 144 | - "$debut,$limite" |
|
| 145 | - ); |
|
| 146 | - |
|
| 147 | - while ($row = sql_fetch($result)) { |
|
| 148 | - $id_rubrique2 = $row['id_rubrique']; |
|
| 149 | - $titre2 = generer_info_entite( |
|
| 150 | - $id_rubrique2, |
|
| 151 | - 'rubrique', |
|
| 152 | - 'titre' |
|
| 153 | - ); // pour etre sur de passer par tous les traitements |
|
| 154 | - if ('' !== ($rang2 = recuperer_numero($row['titre']))) { |
|
| 155 | - $rang2 = "$rang2. "; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - changer_typo($row['lang']); |
|
| 159 | - $lang_dir = lang_dir($row['lang']); |
|
| 160 | - if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
|
| 161 | - $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite( |
|
| 162 | - $id_rubrique2, |
|
| 163 | - 'rubrique' |
|
| 164 | - ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - $retour = $pagination . $retour . $pagination; |
|
| 169 | - |
|
| 170 | - if (!$retour) { |
|
| 171 | - return ''; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
|
| 175 | - . "\n<ul class='liste-items sous-sous-rub'>\n" |
|
| 176 | - . $retour |
|
| 177 | - . "</ul>\n" . fin_block() . "\n\n"; |
|
| 119 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2)); |
|
| 120 | + |
|
| 121 | + $retour = ''; |
|
| 122 | + $pagination = ''; |
|
| 123 | + $debut = 0; |
|
| 124 | + $limite = 500; |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * On ne va afficher que 500 résultats max |
|
| 128 | + * Si > 500 on affiche une pagination |
|
| 129 | + */ |
|
| 130 | + if ($nb > $limite) { |
|
| 131 | + $debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut; |
|
| 132 | + $pagination = chercher_filtre('pagination'); |
|
| 133 | + $pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true, |
|
| 134 | + 'prive') . '</p>'; |
|
| 135 | + $limite = $debut + $limite; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + $result = sql_select( |
|
| 139 | + 'id_rubrique, id_parent, titre, lang', |
|
| 140 | + 'spip_rubriques', |
|
| 141 | + 'id_parent='.intval($collection2), |
|
| 142 | + '', |
|
| 143 | + '0+titre,titre', |
|
| 144 | + "$debut,$limite" |
|
| 145 | + ); |
|
| 146 | + |
|
| 147 | + while ($row = sql_fetch($result)) { |
|
| 148 | + $id_rubrique2 = $row['id_rubrique']; |
|
| 149 | + $titre2 = generer_info_entite( |
|
| 150 | + $id_rubrique2, |
|
| 151 | + 'rubrique', |
|
| 152 | + 'titre' |
|
| 153 | + ); // pour etre sur de passer par tous les traitements |
|
| 154 | + if ('' !== ($rang2 = recuperer_numero($row['titre']))) { |
|
| 155 | + $rang2 = "$rang2. "; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + changer_typo($row['lang']); |
|
| 159 | + $lang_dir = lang_dir($row['lang']); |
|
| 160 | + if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
|
| 161 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite( |
|
| 162 | + $id_rubrique2, |
|
| 163 | + 'rubrique' |
|
| 164 | + ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + $retour = $pagination . $retour . $pagination; |
|
| 169 | + |
|
| 170 | + if (!$retour) { |
|
| 171 | + return ''; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
|
| 175 | + . "\n<ul class='liste-items sous-sous-rub'>\n" |
|
| 176 | + . $retour |
|
| 177 | + . "</ul>\n" . fin_block() . "\n\n"; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -189,44 +189,44 @@ discard block |
||
| 189 | 189 | * Le contenu textuel affiché, la liste des sous rubriques |
| 190 | 190 | */ |
| 191 | 191 | function afficher_enfant_rub($id_rubrique = 0) { |
| 192 | - $pagination = ''; |
|
| 193 | - $debut = 0; |
|
| 194 | - $limite = 500; |
|
| 195 | - |
|
| 196 | - $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)); |
|
| 197 | - |
|
| 198 | - if ($nb > $limite) { |
|
| 199 | - $debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut; |
|
| 200 | - $pagination = chercher_filtre('pagination'); |
|
| 201 | - $pagination = '<br class="nettoyeur"><p class="pagination">' . |
|
| 202 | - $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 203 | - '</p>'; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - $les_enfants = enfant_rub($id_rubrique, $debut, $limite); |
|
| 207 | - |
|
| 208 | - if (!$n = count($les_enfants)) { |
|
| 209 | - return ''; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - if ($n == 1) { |
|
| 213 | - $les_enfants = reset($les_enfants); |
|
| 214 | - $les_enfants2 = ''; |
|
| 215 | - } else { |
|
| 216 | - $n = ceil($n / 2); |
|
| 217 | - $les_enfants2 = implode('', array_slice($les_enfants, $n)); |
|
| 218 | - $les_enfants = implode('', array_slice($les_enfants, 0, $n)); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - $res = |
|
| 222 | - $pagination |
|
| 223 | - . "<div class='gauche'>" |
|
| 224 | - . $les_enfants |
|
| 225 | - . '</div>' |
|
| 226 | - . "<div class='droite'>" |
|
| 227 | - . $les_enfants2 |
|
| 228 | - . '</div>' |
|
| 229 | - . $pagination; |
|
| 230 | - |
|
| 231 | - return $res; |
|
| 192 | + $pagination = ''; |
|
| 193 | + $debut = 0; |
|
| 194 | + $limite = 500; |
|
| 195 | + |
|
| 196 | + $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)); |
|
| 197 | + |
|
| 198 | + if ($nb > $limite) { |
|
| 199 | + $debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut; |
|
| 200 | + $pagination = chercher_filtre('pagination'); |
|
| 201 | + $pagination = '<br class="nettoyeur"><p class="pagination">' . |
|
| 202 | + $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 203 | + '</p>'; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + $les_enfants = enfant_rub($id_rubrique, $debut, $limite); |
|
| 207 | + |
|
| 208 | + if (!$n = count($les_enfants)) { |
|
| 209 | + return ''; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + if ($n == 1) { |
|
| 213 | + $les_enfants = reset($les_enfants); |
|
| 214 | + $les_enfants2 = ''; |
|
| 215 | + } else { |
|
| 216 | + $n = ceil($n / 2); |
|
| 217 | + $les_enfants2 = implode('', array_slice($les_enfants, $n)); |
|
| 218 | + $les_enfants = implode('', array_slice($les_enfants, 0, $n)); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + $res = |
|
| 222 | + $pagination |
|
| 223 | + . "<div class='gauche'>" |
|
| 224 | + . $les_enfants |
|
| 225 | + . '</div>' |
|
| 226 | + . "<div class='droite'>" |
|
| 227 | + . $les_enfants2 |
|
| 228 | + . '</div>' |
|
| 229 | + . $pagination; |
|
| 230 | + |
|
| 231 | + return $res; |
|
| 232 | 232 | } |
@@ -75,19 +75,18 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : |
|
| 79 | - http_img_pack( |
|
| 78 | + $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : http_img_pack( |
|
| 80 | 79 | 'auteur-0minirezo-16.png', |
| 81 | 80 | '', |
| 82 | 81 | " width='16' height='16'", |
| 83 | 82 | _T('image_administrer_rubrique') |
| 84 | - )) . |
|
| 85 | - " <a dir='$lang_dir'" . |
|
| 86 | - ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') . |
|
| 87 | - " href='" . |
|
| 88 | - generer_url_entite($id_rubrique, 'rubrique') . |
|
| 89 | - "'>" . |
|
| 90 | - $rang . $titre |
|
| 83 | + )). |
|
| 84 | + " <a dir='$lang_dir'". |
|
| 85 | + ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='".$row['lang']."'" : ''). |
|
| 86 | + " href='". |
|
| 87 | + generer_url_entite($id_rubrique, 'rubrique'). |
|
| 88 | + "'>". |
|
| 89 | + $rang.$titre |
|
| 91 | 90 | . '</a>' |
| 92 | 91 | . (is_string($logo) ? $logo : ''); |
| 93 | 92 | |
@@ -96,8 +95,8 @@ discard block |
||
| 96 | 95 | ; |
| 97 | 96 | |
| 98 | 97 | $res[] = |
| 99 | - debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) . |
|
| 100 | - $les_sous_enfants . |
|
| 98 | + debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre). |
|
| 99 | + $les_sous_enfants. |
|
| 101 | 100 | fin_cadre_sous_rub(true); |
| 102 | 101 | } |
| 103 | 102 | } |
@@ -128,10 +127,10 @@ discard block |
||
| 128 | 127 | * Si > 500 on affiche une pagination |
| 129 | 128 | */ |
| 130 | 129 | if ($nb > $limite) { |
| 131 | - $debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut; |
|
| 130 | + $debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut; |
|
| 132 | 131 | $pagination = chercher_filtre('pagination'); |
| 133 | - $pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true, |
|
| 134 | - 'prive') . '</p>'; |
|
| 132 | + $pagination = '<p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true, |
|
| 133 | + 'prive').'</p>'; |
|
| 135 | 134 | $limite = $debut + $limite; |
| 136 | 135 | } |
| 137 | 136 | |
@@ -158,14 +157,14 @@ discard block |
||
| 158 | 157 | changer_typo($row['lang']); |
| 159 | 158 | $lang_dir = lang_dir($row['lang']); |
| 160 | 159 | if (autoriser('voir', 'rubrique', $id_rubrique2)) { |
| 161 | - $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite( |
|
| 160 | + $retour .= "\n<li class='item' dir='$lang_dir'><a href='".generer_url_entite( |
|
| 162 | 161 | $id_rubrique2, |
| 163 | 162 | 'rubrique' |
| 164 | - ) . "'>" . $rang2 . $titre2 . "</a></li>\n"; |
|
| 163 | + )."'>".$rang2.$titre2."</a></li>\n"; |
|
| 165 | 164 | } |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | - $retour = $pagination . $retour . $pagination; |
|
| 167 | + $retour = $pagination.$retour.$pagination; |
|
| 169 | 168 | |
| 170 | 169 | if (!$retour) { |
| 171 | 170 | return ''; |
@@ -174,7 +173,7 @@ discard block |
||
| 174 | 173 | return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2") |
| 175 | 174 | . "\n<ul class='liste-items sous-sous-rub'>\n" |
| 176 | 175 | . $retour |
| 177 | - . "</ul>\n" . fin_block() . "\n\n"; |
|
| 176 | + . "</ul>\n".fin_block()."\n\n"; |
|
| 178 | 177 | } |
| 179 | 178 | |
| 180 | 179 | /** |
@@ -196,10 +195,10 @@ discard block |
||
| 196 | 195 | $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)); |
| 197 | 196 | |
| 198 | 197 | if ($nb > $limite) { |
| 199 | - $debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut; |
|
| 198 | + $debut = _request('debut_rubrique'.$id_rubrique) ? _request('debut_rubrique'.$id_rubrique) : $debut; |
|
| 200 | 199 | $pagination = chercher_filtre('pagination'); |
| 201 | - $pagination = '<br class="nettoyeur"><p class="pagination">' . |
|
| 202 | - $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') . |
|
| 200 | + $pagination = '<br class="nettoyeur"><p class="pagination">'. |
|
| 201 | + $pagination($nb, '_rubrique'.$id_rubrique, $debut, $limite, true, 'prive'). |
|
| 203 | 202 | '</p>'; |
| 204 | 203 | } |
| 205 | 204 | |