@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if ($objet == 'rubrique') { |
| 117 | 117 | // si c'est une rubrique-secteur contenant des breves, demander la |
| 118 | 118 | // confirmation du deplacement |
| 119 | - $contient_breves = sql_countsel('spip_breves', "id_rubrique=" . intval($id_objet)); |
|
| 119 | + $contient_breves = sql_countsel('spip_breves', "id_rubrique=".intval($id_objet)); |
|
| 120 | 120 | |
| 121 | 121 | if ($contient_breves > 0) { |
| 122 | 122 | $scb = ($contient_breves > 1 ? 's' : ''); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | )); |
| 128 | 128 | $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
| 129 | 129 | . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
| 130 | - . $scb . |
|
| 130 | + . $scb. |
|
| 131 | 131 | "</label></div></div>\n"; |
| 132 | 132 | } else { |
| 133 | 133 | $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | $form .= $confirm; |
| 137 | 137 | if ($actionable) { |
| 138 | 138 | if (strpos($form, '<select') !== false) { |
| 139 | - $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 140 | - . '<input class="fondo" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 139 | + $form .= "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>" |
|
| 140 | + . '<input class="fondo" type="submit" value="'._T('bouton_choisir').'"/>' |
|
| 141 | 141 | . "</div>"; |
| 142 | 142 | } |
| 143 | - $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 143 | + $form = "<input type='hidden' name='editer_$objet' value='oui' />\n".$form; |
|
| 144 | 144 | if ($action = charger_fonction("editer_$objet", "action", true)) { |
| 145 | 145 | $form = generer_action_auteur("editer_$objet", $id_objet, self(), $form, |
| 146 | 146 | " method='post' class='submit_plongeur'"); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | include_spip('inc/presentation'); |
| 158 | 158 | |
| 159 | - return debut_cadre_couleur($logo, true, "", $titre) . $form . fin_cadre_couleur(true); |
|
| 159 | + return debut_cadre_couleur($logo, true, "", $titre).$form.fin_cadre_couleur(true); |
|
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ($statut == 'nouveau') { |
| 232 | 232 | if ($attente) { |
| 233 | 233 | $statut = $attente; |
| 234 | - $plus = " (" . _T('info_statut_auteur_a_confirmer') . ")"; |
|
| 234 | + $plus = " ("._T('info_statut_auteur_a_confirmer').")"; |
|
| 235 | 235 | } else { |
| 236 | 236 | return _T('info_statut_auteur_a_confirmer'); |
| 237 | 237 | } |
@@ -244,16 +244,16 @@ discard block |
||
| 244 | 244 | '5poubelle' => _T('texte_statut_poubelle'), // bouh |
| 245 | 245 | ); |
| 246 | 246 | if (isset($recom[$statut])) { |
| 247 | - return $recom[$statut] . $plus; |
|
| 247 | + return $recom[$statut].$plus; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // retrouver directement par le statut sinon |
| 251 | 251 | if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
| 252 | 252 | if (isset($recom[$t])) { |
| 253 | - return $recom[$t] . $plus; |
|
| 253 | + return $recom[$t].$plus; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - return _T($t) . $plus; |
|
| 256 | + return _T($t).$plus; |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // si on a pas reussi a le traduire, retournons la chaine telle quelle |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
| 374 | 374 | $in = !count($GLOBALS['connect_id_rubrique']) |
| 375 | 375 | ? '' |
| 376 | - : (" AND " . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 376 | + : (" AND ".sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 377 | 377 | |
| 378 | 378 | // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
| 379 | 379 | if ($objet == 'rubrique') { |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | return ''; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - return propre("[->" . $virtuel . "]"); |
|
| 410 | + return propre("[->".$virtuel."]"); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $args = param_low_sec($op, $args, $lang, 'rss'); |
| 436 | 436 | $url = generer_url_public('rss', $args); |
| 437 | 437 | |
| 438 | - return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 438 | + return "<a style='float: ".$GLOBALS['spip_lang_right'].";' href='$url'>$clic</a>"; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | ); |
| 508 | 508 | |
| 509 | 509 | if ($alertes = array_filter($alertes)) { |
| 510 | - return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 510 | + return "<div class='wrap-messages-alertes'><div class='messages-alertes'>". |
|
| 511 | 511 | join(' | ', $alertes) |
| 512 | 512 | . "</div></div>"; |
| 513 | 513 | } |
@@ -541,13 +541,13 @@ discard block |
||
| 541 | 541 | */ |
| 542 | 542 | function afficher_plus_info($lien, $titre = "+", $titre_lien = "") { |
| 543 | 543 | $titre = attribut_html($titre); |
| 544 | - $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 545 | - http_img_pack("information-16.png", $titre) . "</a>"; |
|
| 544 | + $icone = "\n<a href='$lien' title='$titre' class='plus_info'>". |
|
| 545 | + http_img_pack("information-16.png", $titre)."</a>"; |
|
| 546 | 546 | |
| 547 | 547 | if (!$titre_lien) { |
| 548 | 548 | return $icone; |
| 549 | 549 | } else { |
| 550 | - return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 550 | + return $icone."\n<a href='$lien'>$titre_lien</a>"; |
|
| 551 | 551 | } |
| 552 | 552 | } |
| 553 | 553 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Filtres |
| 17 | 17 | */ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/filtres_boites'); |
@@ -40,27 +40,27 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function parametres_css_prive() { |
| 42 | 42 | |
| 43 | - $args = array(); |
|
| 44 | - $args['v'] = $GLOBALS['spip_version_code']; |
|
| 45 | - $args['p'] = substr(md5($GLOBALS['meta']['plugin']), 0, 4); |
|
| 46 | - $args['themes'] = implode(',', lister_themes_prives()); |
|
| 47 | - $args['ltr'] = $GLOBALS['spip_lang_left']; |
|
| 48 | - // un md5 des menus : si un menu change il faut maj la css |
|
| 49 | - $args['md5b'] = (function_exists('md5_boutons_plugins') ? md5_boutons_plugins() : ''); |
|
| 43 | + $args = array(); |
|
| 44 | + $args['v'] = $GLOBALS['spip_version_code']; |
|
| 45 | + $args['p'] = substr(md5($GLOBALS['meta']['plugin']), 0, 4); |
|
| 46 | + $args['themes'] = implode(',', lister_themes_prives()); |
|
| 47 | + $args['ltr'] = $GLOBALS['spip_lang_left']; |
|
| 48 | + // un md5 des menus : si un menu change il faut maj la css |
|
| 49 | + $args['md5b'] = (function_exists('md5_boutons_plugins') ? md5_boutons_plugins() : ''); |
|
| 50 | 50 | |
| 51 | - $c = isset($GLOBALS['visiteur_session']['prefs']['couleur']) |
|
| 52 | - ? $GLOBALS['visiteur_session']['prefs']['couleur'] |
|
| 53 | - : 9; |
|
| 51 | + $c = isset($GLOBALS['visiteur_session']['prefs']['couleur']) |
|
| 52 | + ? $GLOBALS['visiteur_session']['prefs']['couleur'] |
|
| 53 | + : 9; |
|
| 54 | 54 | |
| 55 | - $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 56 | - parse_str($couleurs($c), $c); |
|
| 57 | - $args = array_merge($args, $c); |
|
| 55 | + $couleurs = charger_fonction('couleurs', 'inc'); |
|
| 56 | + parse_str($couleurs($c), $c); |
|
| 57 | + $args = array_merge($args, $c); |
|
| 58 | 58 | |
| 59 | - if (_request('var_mode') == 'recalcul' or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')) { |
|
| 60 | - $args['var_mode'] = 'recalcul'; |
|
| 61 | - } |
|
| 59 | + if (_request('var_mode') == 'recalcul' or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')) { |
|
| 60 | + $args['var_mode'] = 'recalcul'; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return http_build_query($args); |
|
| 63 | + return http_build_query($args); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -83,79 +83,79 @@ discard block |
||
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | 85 | function chercher_rubrique( |
| 86 | - $titre, |
|
| 87 | - $id_objet, |
|
| 88 | - $id_parent, |
|
| 89 | - $objet, |
|
| 90 | - $id_secteur, |
|
| 91 | - $restreint, |
|
| 92 | - $actionable = false, |
|
| 93 | - $retour_sans_cadre = false |
|
| 86 | + $titre, |
|
| 87 | + $id_objet, |
|
| 88 | + $id_parent, |
|
| 89 | + $objet, |
|
| 90 | + $id_secteur, |
|
| 91 | + $restreint, |
|
| 92 | + $actionable = false, |
|
| 93 | + $retour_sans_cadre = false |
|
| 94 | 94 | ) { |
| 95 | 95 | |
| 96 | - include_spip('inc/autoriser'); |
|
| 97 | - if (intval($id_objet) && !autoriser('modifier', $objet, $id_objet)) { |
|
| 98 | - return ""; |
|
| 99 | - } |
|
| 100 | - if (!sql_countsel('spip_rubriques')) { |
|
| 101 | - return ""; |
|
| 102 | - } |
|
| 103 | - $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc'); |
|
| 104 | - $form = $chercher_rubrique($id_parent, $objet, $restreint, ($objet == 'rubrique') ? $id_objet : 0); |
|
| 105 | - |
|
| 106 | - if ($id_parent == 0) { |
|
| 107 | - $logo = "racine-24.png"; |
|
| 108 | - } elseif ($id_secteur == $id_parent) { |
|
| 109 | - $logo = "secteur-24.png"; |
|
| 110 | - } else { |
|
| 111 | - $logo = "rubrique-24.png"; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - $confirm = ""; |
|
| 115 | - if ($objet == 'rubrique') { |
|
| 116 | - // si c'est une rubrique-secteur contenant des breves, demander la |
|
| 117 | - // confirmation du deplacement |
|
| 118 | - $contient_breves = sql_countsel('spip_breves', "id_rubrique=" . intval($id_objet)); |
|
| 119 | - |
|
| 120 | - if ($contient_breves > 0) { |
|
| 121 | - $scb = ($contient_breves > 1 ? 's' : ''); |
|
| 122 | - $scb = _T('avis_deplacement_rubrique', |
|
| 123 | - array( |
|
| 124 | - 'contient_breves' => $contient_breves, |
|
| 125 | - 'scb' => $scb |
|
| 126 | - )); |
|
| 127 | - $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
|
| 128 | - . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
|
| 129 | - . $scb . |
|
| 130 | - "</label></div></div>\n"; |
|
| 131 | - } else { |
|
| 132 | - $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - $form .= $confirm; |
|
| 136 | - if ($actionable) { |
|
| 137 | - if (strpos($form, '<select') !== false) { |
|
| 138 | - $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 139 | - . '<input class="fondo" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 140 | - . "</div>"; |
|
| 141 | - } |
|
| 142 | - $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 143 | - if ($action = charger_fonction("editer_$objet", "action", true)) { |
|
| 144 | - $form = generer_action_auteur("editer_$objet", $id_objet, self(), $form, |
|
| 145 | - " method='post' class='submit_plongeur'"); |
|
| 146 | - } else { |
|
| 147 | - $form = generer_action_auteur("editer_objet", "$objet/$id_objet", self(), $form, |
|
| 148 | - " method='post' class='submit_plongeur'"); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if ($retour_sans_cadre) { |
|
| 153 | - return $form; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - include_spip('inc/presentation'); |
|
| 157 | - |
|
| 158 | - return debut_cadre_couleur($logo, true, "", $titre) . $form . fin_cadre_couleur(true); |
|
| 96 | + include_spip('inc/autoriser'); |
|
| 97 | + if (intval($id_objet) && !autoriser('modifier', $objet, $id_objet)) { |
|
| 98 | + return ""; |
|
| 99 | + } |
|
| 100 | + if (!sql_countsel('spip_rubriques')) { |
|
| 101 | + return ""; |
|
| 102 | + } |
|
| 103 | + $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc'); |
|
| 104 | + $form = $chercher_rubrique($id_parent, $objet, $restreint, ($objet == 'rubrique') ? $id_objet : 0); |
|
| 105 | + |
|
| 106 | + if ($id_parent == 0) { |
|
| 107 | + $logo = "racine-24.png"; |
|
| 108 | + } elseif ($id_secteur == $id_parent) { |
|
| 109 | + $logo = "secteur-24.png"; |
|
| 110 | + } else { |
|
| 111 | + $logo = "rubrique-24.png"; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + $confirm = ""; |
|
| 115 | + if ($objet == 'rubrique') { |
|
| 116 | + // si c'est une rubrique-secteur contenant des breves, demander la |
|
| 117 | + // confirmation du deplacement |
|
| 118 | + $contient_breves = sql_countsel('spip_breves', "id_rubrique=" . intval($id_objet)); |
|
| 119 | + |
|
| 120 | + if ($contient_breves > 0) { |
|
| 121 | + $scb = ($contient_breves > 1 ? 's' : ''); |
|
| 122 | + $scb = _T('avis_deplacement_rubrique', |
|
| 123 | + array( |
|
| 124 | + 'contient_breves' => $contient_breves, |
|
| 125 | + 'scb' => $scb |
|
| 126 | + )); |
|
| 127 | + $confirm .= "\n<div class='confirmer_deplacement verdana2'>" |
|
| 128 | + . "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>" |
|
| 129 | + . $scb . |
|
| 130 | + "</label></div></div>\n"; |
|
| 131 | + } else { |
|
| 132 | + $confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n"; |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + $form .= $confirm; |
|
| 136 | + if ($actionable) { |
|
| 137 | + if (strpos($form, '<select') !== false) { |
|
| 138 | + $form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>" |
|
| 139 | + . '<input class="fondo" type="submit" value="' . _T('bouton_choisir') . '"/>' |
|
| 140 | + . "</div>"; |
|
| 141 | + } |
|
| 142 | + $form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form; |
|
| 143 | + if ($action = charger_fonction("editer_$objet", "action", true)) { |
|
| 144 | + $form = generer_action_auteur("editer_$objet", $id_objet, self(), $form, |
|
| 145 | + " method='post' class='submit_plongeur'"); |
|
| 146 | + } else { |
|
| 147 | + $form = generer_action_auteur("editer_objet", "$objet/$id_objet", self(), $form, |
|
| 148 | + " method='post' class='submit_plongeur'"); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if ($retour_sans_cadre) { |
|
| 153 | + return $form; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + include_spip('inc/presentation'); |
|
| 157 | + |
|
| 158 | + return debut_cadre_couleur($logo, true, "", $titre) . $form . fin_cadre_couleur(true); |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -170,21 +170,21 @@ discard block |
||
| 170 | 170 | * @return bool |
| 171 | 171 | */ |
| 172 | 172 | function avoir_visiteurs($past = false, $accepter = true) { |
| 173 | - if ($GLOBALS['meta']["forums_publics"] == 'abo') { |
|
| 174 | - return true; |
|
| 175 | - } |
|
| 176 | - if ($accepter and $GLOBALS['meta']["accepter_visiteurs"] <> 'non') { |
|
| 177 | - return true; |
|
| 178 | - } |
|
| 179 | - if (sql_countsel('spip_articles', "accepter_forum='abo'")) { |
|
| 180 | - return true; |
|
| 181 | - } |
|
| 182 | - if (!$past) { |
|
| 183 | - return false; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - return sql_countsel('spip_auteurs', |
|
| 187 | - "statut NOT IN ('0minirezo','1comite', '5poubelle') |
|
| 173 | + if ($GLOBALS['meta']["forums_publics"] == 'abo') { |
|
| 174 | + return true; |
|
| 175 | + } |
|
| 176 | + if ($accepter and $GLOBALS['meta']["accepter_visiteurs"] <> 'non') { |
|
| 177 | + return true; |
|
| 178 | + } |
|
| 179 | + if (sql_countsel('spip_articles', "accepter_forum='abo'")) { |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 182 | + if (!$past) { |
|
| 183 | + return false; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + return sql_countsel('spip_auteurs', |
|
| 187 | + "statut NOT IN ('0minirezo','1comite', '5poubelle') |
|
| 188 | 188 | AND (statut<>'nouveau' OR prefs NOT IN ('0minirezo','1comite', '5poubelle'))"); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -201,18 +201,18 @@ discard block |
||
| 201 | 201 | * @return array |
| 202 | 202 | */ |
| 203 | 203 | function statuts_articles_visibles($statut_auteur) { |
| 204 | - static $auth = array(); |
|
| 205 | - if (!isset($auth[$statut_auteur])) { |
|
| 206 | - $auth[$statut_auteur] = array(); |
|
| 207 | - $statuts = array_column(sql_allfetsel('distinct statut', 'spip_articles'), 'statut'); |
|
| 208 | - foreach ($statuts as $s) { |
|
| 209 | - if (autoriser('voir', 'article', 0, array('statut' => $statut_auteur), array('statut' => $s))) { |
|
| 210 | - $auth[$statut_auteur][] = $s; |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - return $auth[$statut_auteur]; |
|
| 204 | + static $auth = array(); |
|
| 205 | + if (!isset($auth[$statut_auteur])) { |
|
| 206 | + $auth[$statut_auteur] = array(); |
|
| 207 | + $statuts = array_column(sql_allfetsel('distinct statut', 'spip_articles'), 'statut'); |
|
| 208 | + foreach ($statuts as $s) { |
|
| 209 | + if (autoriser('voir', 'article', 0, array('statut' => $statut_auteur), array('statut' => $s))) { |
|
| 210 | + $auth[$statut_auteur][] = $s; |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + return $auth[$statut_auteur]; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -226,38 +226,38 @@ discard block |
||
| 226 | 226 | * @return string |
| 227 | 227 | */ |
| 228 | 228 | function traduire_statut_auteur($statut, $attente = "") { |
| 229 | - $plus = ""; |
|
| 230 | - if ($statut == 'nouveau') { |
|
| 231 | - if ($attente) { |
|
| 232 | - $statut = $attente; |
|
| 233 | - $plus = " (" . _T('info_statut_auteur_a_confirmer') . ")"; |
|
| 234 | - } else { |
|
| 235 | - return _T('info_statut_auteur_a_confirmer'); |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - $recom = array( |
|
| 240 | - "info_administrateurs" => _T('item_administrateur_2'), |
|
| 241 | - "info_redacteurs" => _T('intem_redacteur'), |
|
| 242 | - "info_visiteurs" => _T('item_visiteur'), |
|
| 243 | - '5poubelle' => _T('texte_statut_poubelle'), // bouh |
|
| 244 | - ); |
|
| 245 | - if (isset($recom[$statut])) { |
|
| 246 | - return $recom[$statut] . $plus; |
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - // retrouver directement par le statut sinon |
|
| 250 | - if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
|
| 251 | - if (isset($recom[$t])) { |
|
| 252 | - return $recom[$t] . $plus; |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - return _T($t) . $plus; |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - // si on a pas reussi a le traduire, retournons la chaine telle quelle |
|
| 259 | - // c'est toujours plus informatif que rien du tout |
|
| 260 | - return $statut; |
|
| 229 | + $plus = ""; |
|
| 230 | + if ($statut == 'nouveau') { |
|
| 231 | + if ($attente) { |
|
| 232 | + $statut = $attente; |
|
| 233 | + $plus = " (" . _T('info_statut_auteur_a_confirmer') . ")"; |
|
| 234 | + } else { |
|
| 235 | + return _T('info_statut_auteur_a_confirmer'); |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + $recom = array( |
|
| 240 | + "info_administrateurs" => _T('item_administrateur_2'), |
|
| 241 | + "info_redacteurs" => _T('intem_redacteur'), |
|
| 242 | + "info_visiteurs" => _T('item_visiteur'), |
|
| 243 | + '5poubelle' => _T('texte_statut_poubelle'), // bouh |
|
| 244 | + ); |
|
| 245 | + if (isset($recom[$statut])) { |
|
| 246 | + return $recom[$statut] . $plus; |
|
| 247 | + } |
|
| 248 | + |
|
| 249 | + // retrouver directement par le statut sinon |
|
| 250 | + if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) { |
|
| 251 | + if (isset($recom[$t])) { |
|
| 252 | + return $recom[$t] . $plus; |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + return _T($t) . $plus; |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + // si on a pas reussi a le traduire, retournons la chaine telle quelle |
|
| 259 | + // c'est toujours plus informatif que rien du tout |
|
| 260 | + return $statut; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -268,28 +268,28 @@ discard block |
||
| 268 | 268 | * @return string |
| 269 | 269 | */ |
| 270 | 270 | function afficher_qui_edite($id_objet, $objet) { |
| 271 | - static $qui = array(); |
|
| 272 | - if (isset($qui[$objet][$id_objet])) { |
|
| 273 | - return $qui[$objet][$id_objet]; |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - if ($GLOBALS['meta']['articles_modif'] == 'non') { |
|
| 277 | - return $qui[$objet][$id_objet] = ''; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - include_spip('inc/drapeau_edition'); |
|
| 281 | - $modif = mention_qui_edite($id_objet, $objet); |
|
| 282 | - if (!$modif) { |
|
| 283 | - return $qui[$objet][$id_objet] = ''; |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - include_spip('base/objets'); |
|
| 287 | - $infos = lister_tables_objets_sql(table_objet_sql($objet)); |
|
| 288 | - if (isset($infos['texte_signale_edition'])) { |
|
| 289 | - return $qui[$objet][$id_objet] = _T($infos['texte_signale_edition'], $modif); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - return $qui[$objet][$id_objet] = _T('info_qui_edite', $modif); |
|
| 271 | + static $qui = array(); |
|
| 272 | + if (isset($qui[$objet][$id_objet])) { |
|
| 273 | + return $qui[$objet][$id_objet]; |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + if ($GLOBALS['meta']['articles_modif'] == 'non') { |
|
| 277 | + return $qui[$objet][$id_objet] = ''; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + include_spip('inc/drapeau_edition'); |
|
| 281 | + $modif = mention_qui_edite($id_objet, $objet); |
|
| 282 | + if (!$modif) { |
|
| 283 | + return $qui[$objet][$id_objet] = ''; |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + include_spip('base/objets'); |
|
| 287 | + $infos = lister_tables_objets_sql(table_objet_sql($objet)); |
|
| 288 | + if (isset($infos['texte_signale_edition'])) { |
|
| 289 | + return $qui[$objet][$id_objet] = _T($infos['texte_signale_edition'], $modif); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + return $qui[$objet][$id_objet] = _T('info_qui_edite', $modif); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -307,57 +307,57 @@ discard block |
||
| 307 | 307 | * @return array |
| 308 | 308 | */ |
| 309 | 309 | function auteurs_lister_statuts($quoi = 'tous', $en_base = true) { |
| 310 | - if (!defined('AUTEURS_MIN_REDAC')) { |
|
| 311 | - define('AUTEURS_MIN_REDAC', "0minirezo,1comite,5poubelle"); |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - switch ($quoi) { |
|
| 315 | - case "redacteurs": |
|
| 316 | - $statut = AUTEURS_MIN_REDAC; |
|
| 317 | - $statut = explode(',', $statut); |
|
| 318 | - if ($en_base) { |
|
| 319 | - $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 320 | - $retire = array_diff($statut, $check); |
|
| 321 | - $statut = array_diff($statut, $retire); |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - return array_unique($statut); |
|
| 325 | - break; |
|
| 326 | - case "visiteurs": |
|
| 327 | - $statut = array(); |
|
| 328 | - $exclus = AUTEURS_MIN_REDAC; |
|
| 329 | - $exclus = explode(',', $exclus); |
|
| 330 | - if (!$en_base) { |
|
| 331 | - // prendre aussi les statuts de la table des status qui ne sont pas dans le define |
|
| 332 | - $statut = array_diff(array_values($GLOBALS['liste_des_statuts']), $exclus); |
|
| 333 | - } |
|
| 334 | - $s_complement = array_column( |
|
| 335 | - sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $exclus, 'NOT')), |
|
| 336 | - 'statut' |
|
| 337 | - ); |
|
| 338 | - |
|
| 339 | - return array_unique(array_merge($statut, $s_complement)); |
|
| 340 | - break; |
|
| 341 | - default: |
|
| 342 | - case "tous": |
|
| 343 | - $statut = array_values($GLOBALS['liste_des_statuts']); |
|
| 344 | - $s_complement = array_column( |
|
| 345 | - sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut, 'NOT')), |
|
| 346 | - 'statut' |
|
| 347 | - ); |
|
| 348 | - $statut = array_merge($statut, $s_complement); |
|
| 349 | - if ($en_base) { |
|
| 350 | - $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 351 | - $retire = array_diff($statut, $check); |
|
| 352 | - $statut = array_diff($statut, $retire); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - return array_unique($statut); |
|
| 356 | - break; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - // on arrive jamais ici |
|
| 360 | - return array_values($GLOBALS['liste_des_statuts']); |
|
| 310 | + if (!defined('AUTEURS_MIN_REDAC')) { |
|
| 311 | + define('AUTEURS_MIN_REDAC', "0minirezo,1comite,5poubelle"); |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + switch ($quoi) { |
|
| 315 | + case "redacteurs": |
|
| 316 | + $statut = AUTEURS_MIN_REDAC; |
|
| 317 | + $statut = explode(',', $statut); |
|
| 318 | + if ($en_base) { |
|
| 319 | + $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 320 | + $retire = array_diff($statut, $check); |
|
| 321 | + $statut = array_diff($statut, $retire); |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + return array_unique($statut); |
|
| 325 | + break; |
|
| 326 | + case "visiteurs": |
|
| 327 | + $statut = array(); |
|
| 328 | + $exclus = AUTEURS_MIN_REDAC; |
|
| 329 | + $exclus = explode(',', $exclus); |
|
| 330 | + if (!$en_base) { |
|
| 331 | + // prendre aussi les statuts de la table des status qui ne sont pas dans le define |
|
| 332 | + $statut = array_diff(array_values($GLOBALS['liste_des_statuts']), $exclus); |
|
| 333 | + } |
|
| 334 | + $s_complement = array_column( |
|
| 335 | + sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $exclus, 'NOT')), |
|
| 336 | + 'statut' |
|
| 337 | + ); |
|
| 338 | + |
|
| 339 | + return array_unique(array_merge($statut, $s_complement)); |
|
| 340 | + break; |
|
| 341 | + default: |
|
| 342 | + case "tous": |
|
| 343 | + $statut = array_values($GLOBALS['liste_des_statuts']); |
|
| 344 | + $s_complement = array_column( |
|
| 345 | + sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut, 'NOT')), |
|
| 346 | + 'statut' |
|
| 347 | + ); |
|
| 348 | + $statut = array_merge($statut, $s_complement); |
|
| 349 | + if ($en_base) { |
|
| 350 | + $check = array_column(sql_allfetsel('DISTINCT statut', 'spip_auteurs', sql_in('statut', $statut)), 'statut'); |
|
| 351 | + $retire = array_diff($statut, $check); |
|
| 352 | + $statut = array_diff($statut, $retire); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + return array_unique($statut); |
|
| 356 | + break; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + // on arrive jamais ici |
|
| 360 | + return array_values($GLOBALS['liste_des_statuts']); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -373,28 +373,28 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | function trouver_rubrique_creer_objet($id_rubrique, $objet) { |
| 375 | 375 | |
| 376 | - if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
|
| 377 | - $in = !count($GLOBALS['connect_id_rubrique']) |
|
| 378 | - ? '' |
|
| 379 | - : (" AND " . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 380 | - |
|
| 381 | - // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
|
| 382 | - if ($objet == 'rubrique') { |
|
| 383 | - $id_rubrique = 0; |
|
| 384 | - } else { |
|
| 385 | - $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', "id_parent=0$in", '', "id_rubrique DESC", 1); |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - if (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique)) { |
|
| 389 | - // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
|
| 390 | - $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0"); |
|
| 391 | - while (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique) && $row_rub = sql_fetch($res)) { |
|
| 392 | - $id_rubrique = $row_rub['id_rubrique']; |
|
| 393 | - } |
|
| 394 | - } |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - return $id_rubrique; |
|
| 376 | + if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) { |
|
| 377 | + $in = !count($GLOBALS['connect_id_rubrique']) |
|
| 378 | + ? '' |
|
| 379 | + : (" AND " . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique'])); |
|
| 380 | + |
|
| 381 | + // on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement |
|
| 382 | + if ($objet == 'rubrique') { |
|
| 383 | + $id_rubrique = 0; |
|
| 384 | + } else { |
|
| 385 | + $id_rubrique = sql_getfetsel('id_rubrique', 'spip_rubriques', "id_parent=0$in", '', "id_rubrique DESC", 1); |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + if (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique)) { |
|
| 389 | + // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises |
|
| 390 | + $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0"); |
|
| 391 | + while (!autoriser("creer{$objet}dans", 'rubrique', $id_rubrique) && $row_rub = sql_fetch($res)) { |
|
| 392 | + $id_rubrique = $row_rub['id_rubrique']; |
|
| 393 | + } |
|
| 394 | + } |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + return $id_rubrique; |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -405,12 +405,12 @@ discard block |
||
| 405 | 405 | * @return string |
| 406 | 406 | */ |
| 407 | 407 | function lien_article_virtuel($virtuel) { |
| 408 | - include_spip('inc/lien'); |
|
| 409 | - if (!$virtuel = virtuel_redirige($virtuel)) { |
|
| 410 | - return ''; |
|
| 411 | - } |
|
| 408 | + include_spip('inc/lien'); |
|
| 409 | + if (!$virtuel = virtuel_redirige($virtuel)) { |
|
| 410 | + return ''; |
|
| 411 | + } |
|
| 412 | 412 | |
| 413 | - return propre("[->" . $virtuel . "]"); |
|
| 413 | + return propre("[->" . $virtuel . "]"); |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | |
@@ -433,12 +433,12 @@ discard block |
||
| 433 | 433 | * Code HTML du lien |
| 434 | 434 | */ |
| 435 | 435 | function bouton_spip_rss($op, $args = array(), $lang = '', $title = 'RSS') { |
| 436 | - include_spip('inc/acces'); |
|
| 437 | - $clic = http_img_pack('feed.png', 'RSS', '', $title); |
|
| 438 | - $args = param_low_sec($op, $args, $lang, 'rss'); |
|
| 439 | - $url = generer_url_public('rss', $args); |
|
| 436 | + include_spip('inc/acces'); |
|
| 437 | + $clic = http_img_pack('feed.png', 'RSS', '', $title); |
|
| 438 | + $args = param_low_sec($op, $args, $lang, 'rss'); |
|
| 439 | + $url = generer_url_public('rss', $args); |
|
| 440 | 440 | |
| 441 | - return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 441 | + return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>"; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | |
@@ -450,70 +450,70 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | function alertes_auteur($id_auteur) { |
| 452 | 452 | |
| 453 | - $alertes = array(); |
|
| 454 | - |
|
| 455 | - if (isset($GLOBALS['meta']['message_crash_tables']) |
|
| 456 | - and autoriser('detruire', null, null, $id_auteur) |
|
| 457 | - ) { |
|
| 458 | - include_spip('genie/maintenance'); |
|
| 459 | - if ($msg = message_crash_tables()) { |
|
| 460 | - $alertes[] = $msg; |
|
| 461 | - } |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - if (isset($GLOBALS['meta']['message_crash_plugins']) |
|
| 465 | - and $GLOBALS['meta']['message_crash_plugins'] |
|
| 466 | - and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 467 | - and is_array($msg = unserialize($GLOBALS['meta']['message_crash_plugins'])) |
|
| 468 | - ) { |
|
| 469 | - $msg = implode(', ', array_map('joli_repertoire', array_keys($msg))); |
|
| 470 | - $alertes[] = _T('plugins_erreur', array('plugins' => $msg)); |
|
| 471 | - } |
|
| 472 | - |
|
| 473 | - $a = isset($GLOBALS['meta']['message_alertes_auteurs']) ? $GLOBALS['meta']['message_alertes_auteurs'] : ''; |
|
| 474 | - if ($a |
|
| 475 | - and is_array($a = unserialize($a)) |
|
| 476 | - and count($a) |
|
| 477 | - ) { |
|
| 478 | - $update = false; |
|
| 479 | - if (isset($a[$GLOBALS['visiteur_session']['statut']])) { |
|
| 480 | - $alertes = array_merge($alertes, $a[$GLOBALS['visiteur_session']['statut']]); |
|
| 481 | - unset($a[$GLOBALS['visiteur_session']['statut']]); |
|
| 482 | - $update = true; |
|
| 483 | - } |
|
| 484 | - if (isset($a[''])) { |
|
| 485 | - $alertes = array_merge($alertes, $a['']); |
|
| 486 | - unset($a['']); |
|
| 487 | - $update = true; |
|
| 488 | - } |
|
| 489 | - if ($update) { |
|
| 490 | - ecrire_meta("message_alertes_auteurs", serialize($a)); |
|
| 491 | - } |
|
| 492 | - } |
|
| 493 | - |
|
| 494 | - if (isset($GLOBALS['meta']['plugin_erreur_activation']) |
|
| 495 | - and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 496 | - ) { |
|
| 497 | - include_spip('inc/plugin'); |
|
| 498 | - $alertes[] = plugin_donne_erreurs(); |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - $alertes = pipeline( |
|
| 502 | - 'alertes_auteur', |
|
| 503 | - array( |
|
| 504 | - 'args' => array( |
|
| 505 | - 'id_auteur' => $id_auteur, |
|
| 506 | - 'exec' => _request('exec'), |
|
| 507 | - ), |
|
| 508 | - 'data' => $alertes |
|
| 509 | - ) |
|
| 510 | - ); |
|
| 511 | - |
|
| 512 | - if ($alertes = array_filter($alertes)) { |
|
| 513 | - return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 514 | - join(' | ', $alertes) |
|
| 515 | - . "</div></div>"; |
|
| 516 | - } |
|
| 453 | + $alertes = array(); |
|
| 454 | + |
|
| 455 | + if (isset($GLOBALS['meta']['message_crash_tables']) |
|
| 456 | + and autoriser('detruire', null, null, $id_auteur) |
|
| 457 | + ) { |
|
| 458 | + include_spip('genie/maintenance'); |
|
| 459 | + if ($msg = message_crash_tables()) { |
|
| 460 | + $alertes[] = $msg; |
|
| 461 | + } |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + if (isset($GLOBALS['meta']['message_crash_plugins']) |
|
| 465 | + and $GLOBALS['meta']['message_crash_plugins'] |
|
| 466 | + and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 467 | + and is_array($msg = unserialize($GLOBALS['meta']['message_crash_plugins'])) |
|
| 468 | + ) { |
|
| 469 | + $msg = implode(', ', array_map('joli_repertoire', array_keys($msg))); |
|
| 470 | + $alertes[] = _T('plugins_erreur', array('plugins' => $msg)); |
|
| 471 | + } |
|
| 472 | + |
|
| 473 | + $a = isset($GLOBALS['meta']['message_alertes_auteurs']) ? $GLOBALS['meta']['message_alertes_auteurs'] : ''; |
|
| 474 | + if ($a |
|
| 475 | + and is_array($a = unserialize($a)) |
|
| 476 | + and count($a) |
|
| 477 | + ) { |
|
| 478 | + $update = false; |
|
| 479 | + if (isset($a[$GLOBALS['visiteur_session']['statut']])) { |
|
| 480 | + $alertes = array_merge($alertes, $a[$GLOBALS['visiteur_session']['statut']]); |
|
| 481 | + unset($a[$GLOBALS['visiteur_session']['statut']]); |
|
| 482 | + $update = true; |
|
| 483 | + } |
|
| 484 | + if (isset($a[''])) { |
|
| 485 | + $alertes = array_merge($alertes, $a['']); |
|
| 486 | + unset($a['']); |
|
| 487 | + $update = true; |
|
| 488 | + } |
|
| 489 | + if ($update) { |
|
| 490 | + ecrire_meta("message_alertes_auteurs", serialize($a)); |
|
| 491 | + } |
|
| 492 | + } |
|
| 493 | + |
|
| 494 | + if (isset($GLOBALS['meta']['plugin_erreur_activation']) |
|
| 495 | + and autoriser('configurer', '_plugins', null, $id_auteur) |
|
| 496 | + ) { |
|
| 497 | + include_spip('inc/plugin'); |
|
| 498 | + $alertes[] = plugin_donne_erreurs(); |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + $alertes = pipeline( |
|
| 502 | + 'alertes_auteur', |
|
| 503 | + array( |
|
| 504 | + 'args' => array( |
|
| 505 | + 'id_auteur' => $id_auteur, |
|
| 506 | + 'exec' => _request('exec'), |
|
| 507 | + ), |
|
| 508 | + 'data' => $alertes |
|
| 509 | + ) |
|
| 510 | + ); |
|
| 511 | + |
|
| 512 | + if ($alertes = array_filter($alertes)) { |
|
| 513 | + return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" . |
|
| 514 | + join(' | ', $alertes) |
|
| 515 | + . "</div></div>"; |
|
| 516 | + } |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /** |
@@ -523,9 +523,9 @@ discard block |
||
| 523 | 523 | * @return string |
| 524 | 524 | */ |
| 525 | 525 | function filtre_afficher_enfant_rub_dist($id_rubrique) { |
| 526 | - include_spip('inc/presenter_enfants'); |
|
| 526 | + include_spip('inc/presenter_enfants'); |
|
| 527 | 527 | |
| 528 | - return afficher_enfant_rub(intval($id_rubrique)); |
|
| 528 | + return afficher_enfant_rub(intval($id_rubrique)); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | /** |
@@ -543,15 +543,15 @@ discard block |
||
| 543 | 543 | * @return string |
| 544 | 544 | */ |
| 545 | 545 | function afficher_plus_info($lien, $titre = "+", $titre_lien = "") { |
| 546 | - $titre = attribut_html($titre); |
|
| 547 | - $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 548 | - http_img_pack("information-16.png", $titre) . "</a>"; |
|
| 549 | - |
|
| 550 | - if (!$titre_lien) { |
|
| 551 | - return $icone; |
|
| 552 | - } else { |
|
| 553 | - return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 554 | - } |
|
| 546 | + $titre = attribut_html($titre); |
|
| 547 | + $icone = "\n<a href='$lien' title='$titre' class='plus_info'>" . |
|
| 548 | + http_img_pack("information-16.png", $titre) . "</a>"; |
|
| 549 | + |
|
| 550 | + if (!$titre_lien) { |
|
| 551 | + return $icone; |
|
| 552 | + } else { |
|
| 553 | + return $icone . "\n<a href='$lien'>$titre_lien</a>"; |
|
| 554 | + } |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | |
@@ -570,18 +570,18 @@ discard block |
||
| 570 | 570 | * @return array |
| 571 | 571 | */ |
| 572 | 572 | function lister_objets_lies($objet_source, $objet, $id_objet, $objet_lien) { |
| 573 | - $res = lister_objets_liens($objet_source, $objet, $id_objet, $objet_lien); |
|
| 574 | - if (!count($res)) { |
|
| 575 | - return []; |
|
| 576 | - } |
|
| 577 | - $r = reset($res); |
|
| 578 | - if (isset($r['rang_lien'])) { |
|
| 579 | - $l = array_column($res, 'rang_lien', $objet_source); |
|
| 580 | - asort($l); |
|
| 581 | - $l = array_keys($l); |
|
| 582 | - } else { |
|
| 583 | - $l = array_column($res, $objet_source); |
|
| 584 | - } |
|
| 585 | - return $l; |
|
| 573 | + $res = lister_objets_liens($objet_source, $objet, $id_objet, $objet_lien); |
|
| 574 | + if (!count($res)) { |
|
| 575 | + return []; |
|
| 576 | + } |
|
| 577 | + $r = reset($res); |
|
| 578 | + if (isset($r['rang_lien'])) { |
|
| 579 | + $l = array_column($res, 'rang_lien', $objet_source); |
|
| 580 | + asort($l); |
|
| 581 | + $l = array_keys($l); |
|
| 582 | + } else { |
|
| 583 | + $l = array_column($res, $objet_source); |
|
| 584 | + } |
|
| 585 | + return $l; |
|
| 586 | 586 | } |
| 587 | 587 | |
@@ -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 | include_spip('inc/texte'); |
@@ -43,223 +43,223 @@ discard block |
||
| 43 | 43 | // http://code.spip.net/@public_composer_dist |
| 44 | 44 | function public_composer_dist($squelette, $mime_type, $gram, $source, $connect = '') { |
| 45 | 45 | |
| 46 | - $nom = calculer_nom_fonction_squel($squelette, $mime_type, $connect); |
|
| 47 | - |
|
| 48 | - // si deja en memoire (INCLURE a repetition) c'est bon. |
|
| 49 | - if (function_exists($nom)) { |
|
| 50 | - return $nom; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 54 | - $GLOBALS['debug_objets']['courant'] = $nom; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 58 | - |
|
| 59 | - // si squelette est deja compile et perenne, le charger |
|
| 60 | - if (!squelette_obsolete($phpfile, $source)) { |
|
| 61 | - include_once $phpfile; |
|
| 62 | - #if (!squelette_obsolete($phpfile, $source) |
|
| 63 | - # AND lire_fichier ($phpfile, $skel_code, |
|
| 64 | - # array('critique' => 'oui', 'phpcheck' => 'oui'))){ |
|
| 65 | - ## eval('?'.'>'.$skel_code); |
|
| 66 | - # spip_log($skel_code, 'comp') |
|
| 67 | - #} |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 71 | - include_once $lib; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // tester si le eval ci-dessus a mis le squelette en memoire |
|
| 75 | - |
|
| 76 | - if (function_exists($nom)) { |
|
| 77 | - return $nom; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // charger le source, si possible, et compiler |
|
| 81 | - $skel_code = ''; |
|
| 82 | - if (lire_fichier($source, $skel)) { |
|
| 83 | - $compiler = charger_fonction('compiler', 'public'); |
|
| 84 | - $skel_code = $compiler($skel, $nom, $gram, $source, $connect); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // Ne plus rien faire si le compilateur n'a pas pu operer. |
|
| 88 | - if (!$skel_code) { |
|
| 89 | - return false; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - foreach ($skel_code as $id => $boucle) { |
|
| 93 | - $f = $boucle->return; |
|
| 94 | - if (@eval("return true; $f ;") === false) { |
|
| 95 | - // Code syntaxiquement faux (critere etc mal programme') |
|
| 96 | - $msg = _T('zbug_erreur_compilation'); |
|
| 97 | - erreur_squelette($msg, $boucle); |
|
| 98 | - // continuer pour trouver d'autres fautes eventuelles |
|
| 99 | - // mais prevenir que c'est mort |
|
| 100 | - $nom = ''; |
|
| 101 | - } |
|
| 102 | - // Contexte de compil inutile a present |
|
| 103 | - // (mais la derniere valeur de $boucle est utilisee ci-dessous) |
|
| 104 | - $skel_code[$id] = $f; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $code = ''; |
|
| 108 | - if ($nom) { |
|
| 109 | - // Si le code est bon, concatener et mettre en cache |
|
| 110 | - if (function_exists($nom)) { |
|
| 111 | - $code = squelette_traduit($skel, $source, $phpfile, $skel_code); |
|
| 112 | - } else { |
|
| 113 | - // code semantiquement faux: bug du compilateur |
|
| 114 | - // $boucle est en fait ici la fct principale du squelette |
|
| 115 | - $msg = _T('zbug_erreur_compilation'); |
|
| 116 | - erreur_squelette($msg, $boucle); |
|
| 117 | - $nom = ''; |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 122 | - |
|
| 123 | - // Tracer ce qui vient d'etre compile |
|
| 124 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 125 | - |
|
| 126 | - // si c'est ce que demande le debusqueur, lui passer la main |
|
| 127 | - if ($GLOBALS['debug_objets']['sourcefile'] |
|
| 128 | - and (_request('var_mode_objet') == $nom) |
|
| 129 | - and (_request('var_mode_affiche') == 'code') |
|
| 130 | - ) { |
|
| 131 | - erreur_squelette(); |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - return $nom ? $nom : false; |
|
| 46 | + $nom = calculer_nom_fonction_squel($squelette, $mime_type, $connect); |
|
| 47 | + |
|
| 48 | + // si deja en memoire (INCLURE a repetition) c'est bon. |
|
| 49 | + if (function_exists($nom)) { |
|
| 50 | + return $nom; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 54 | + $GLOBALS['debug_objets']['courant'] = $nom; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 58 | + |
|
| 59 | + // si squelette est deja compile et perenne, le charger |
|
| 60 | + if (!squelette_obsolete($phpfile, $source)) { |
|
| 61 | + include_once $phpfile; |
|
| 62 | + #if (!squelette_obsolete($phpfile, $source) |
|
| 63 | + # AND lire_fichier ($phpfile, $skel_code, |
|
| 64 | + # array('critique' => 'oui', 'phpcheck' => 'oui'))){ |
|
| 65 | + ## eval('?'.'>'.$skel_code); |
|
| 66 | + # spip_log($skel_code, 'comp') |
|
| 67 | + #} |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 71 | + include_once $lib; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // tester si le eval ci-dessus a mis le squelette en memoire |
|
| 75 | + |
|
| 76 | + if (function_exists($nom)) { |
|
| 77 | + return $nom; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // charger le source, si possible, et compiler |
|
| 81 | + $skel_code = ''; |
|
| 82 | + if (lire_fichier($source, $skel)) { |
|
| 83 | + $compiler = charger_fonction('compiler', 'public'); |
|
| 84 | + $skel_code = $compiler($skel, $nom, $gram, $source, $connect); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // Ne plus rien faire si le compilateur n'a pas pu operer. |
|
| 88 | + if (!$skel_code) { |
|
| 89 | + return false; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + foreach ($skel_code as $id => $boucle) { |
|
| 93 | + $f = $boucle->return; |
|
| 94 | + if (@eval("return true; $f ;") === false) { |
|
| 95 | + // Code syntaxiquement faux (critere etc mal programme') |
|
| 96 | + $msg = _T('zbug_erreur_compilation'); |
|
| 97 | + erreur_squelette($msg, $boucle); |
|
| 98 | + // continuer pour trouver d'autres fautes eventuelles |
|
| 99 | + // mais prevenir que c'est mort |
|
| 100 | + $nom = ''; |
|
| 101 | + } |
|
| 102 | + // Contexte de compil inutile a present |
|
| 103 | + // (mais la derniere valeur de $boucle est utilisee ci-dessous) |
|
| 104 | + $skel_code[$id] = $f; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $code = ''; |
|
| 108 | + if ($nom) { |
|
| 109 | + // Si le code est bon, concatener et mettre en cache |
|
| 110 | + if (function_exists($nom)) { |
|
| 111 | + $code = squelette_traduit($skel, $source, $phpfile, $skel_code); |
|
| 112 | + } else { |
|
| 113 | + // code semantiquement faux: bug du compilateur |
|
| 114 | + // $boucle est en fait ici la fct principale du squelette |
|
| 115 | + $msg = _T('zbug_erreur_compilation'); |
|
| 116 | + erreur_squelette($msg, $boucle); |
|
| 117 | + $nom = ''; |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
|
| 122 | + |
|
| 123 | + // Tracer ce qui vient d'etre compile |
|
| 124 | + $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 125 | + |
|
| 126 | + // si c'est ce que demande le debusqueur, lui passer la main |
|
| 127 | + if ($GLOBALS['debug_objets']['sourcefile'] |
|
| 128 | + and (_request('var_mode_objet') == $nom) |
|
| 129 | + and (_request('var_mode_affiche') == 'code') |
|
| 130 | + ) { |
|
| 131 | + erreur_squelette(); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + return $nom ? $nom : false; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | function squelette_traduit($squelette, $sourcefile, $phpfile, $boucles) { |
| 139 | 139 | |
| 140 | - // Le dernier index est '' (fonction principale) |
|
| 141 | - $noms = substr(join(', ', array_keys($boucles)), 0, -2); |
|
| 142 | - if (CODE_COMMENTE) { |
|
| 143 | - $code = " |
|
| 140 | + // Le dernier index est '' (fonction principale) |
|
| 141 | + $noms = substr(join(', ', array_keys($boucles)), 0, -2); |
|
| 142 | + if (CODE_COMMENTE) { |
|
| 143 | + $code = " |
|
| 144 | 144 | /* |
| 145 | 145 | * Squelette : $sourcefile |
| 146 | 146 | * Date : " . gmdate("D, d M Y H:i:s", @filemtime($sourcefile)) . " GMT |
| 147 | 147 | * Compile : " . gmdate("D, d M Y H:i:s", time()) . " GMT |
| 148 | 148 | * " . (!$boucles ? "Pas de boucle" : ("Boucles : " . $noms)) . " |
| 149 | 149 | */ "; |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n?" . '>'; |
|
| 153 | - if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
|
| 154 | - ecrire_fichier($phpfile, $code); |
|
| 155 | - } |
|
| 152 | + $code = '<' . "?php\n" . $code . join('', $boucles) . "\n?" . '>'; |
|
| 153 | + if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
|
| 154 | + ecrire_fichier($phpfile, $code); |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - return $code; |
|
| 157 | + return $code; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Le squelette compile est-il trop vieux ? |
| 161 | 161 | // http://code.spip.net/@squelette_obsolete |
| 162 | 162 | function squelette_obsolete($skel, $squelette) { |
| 163 | - static $date_change = null; |
|
| 164 | - // ne verifier la date de mes_fonctions et mes_options qu'une seule fois |
|
| 165 | - // par hit |
|
| 166 | - if (is_null($date_change)) { |
|
| 167 | - if (@file_exists($fonc = 'mes_fonctions.php')) { |
|
| 168 | - $date_change = @filemtime($fonc); |
|
| 169 | - } # compatibilite |
|
| 170 | - if (defined('_FILE_OPTIONS')) { |
|
| 171 | - $date_change = max($date_change, @filemtime(_FILE_OPTIONS)); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - return ( |
|
| 176 | - (defined('_VAR_MODE') and in_array(_VAR_MODE, array('recalcul', 'preview', 'debug'))) |
|
| 177 | - or !@file_exists($skel) |
|
| 178 | - or ((@file_exists($squelette) ? @filemtime($squelette) : 0) |
|
| 179 | - > ($date = @filemtime($skel))) |
|
| 180 | - or ($date_change > $date) |
|
| 181 | - ); |
|
| 163 | + static $date_change = null; |
|
| 164 | + // ne verifier la date de mes_fonctions et mes_options qu'une seule fois |
|
| 165 | + // par hit |
|
| 166 | + if (is_null($date_change)) { |
|
| 167 | + if (@file_exists($fonc = 'mes_fonctions.php')) { |
|
| 168 | + $date_change = @filemtime($fonc); |
|
| 169 | + } # compatibilite |
|
| 170 | + if (defined('_FILE_OPTIONS')) { |
|
| 171 | + $date_change = max($date_change, @filemtime(_FILE_OPTIONS)); |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + return ( |
|
| 176 | + (defined('_VAR_MODE') and in_array(_VAR_MODE, array('recalcul', 'preview', 'debug'))) |
|
| 177 | + or !@file_exists($skel) |
|
| 178 | + or ((@file_exists($squelette) ? @filemtime($squelette) : 0) |
|
| 179 | + > ($date = @filemtime($skel))) |
|
| 180 | + or ($date_change > $date) |
|
| 181 | + ); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Activer l'invalideur de session |
| 185 | 185 | // http://code.spip.net/@invalideur_session |
| 186 | 186 | function invalideur_session(&$Cache, $code = null) { |
| 187 | - $Cache['session'] = spip_session(); |
|
| 187 | + $Cache['session'] = spip_session(); |
|
| 188 | 188 | |
| 189 | - return $code; |
|
| 189 | + return $code; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | // http://code.spip.net/@analyse_resultat_skel |
| 194 | 194 | function analyse_resultat_skel($nom, $cache, $corps, $source = '') { |
| 195 | - static $filtres = array(); |
|
| 196 | - $headers = array(); |
|
| 197 | - |
|
| 198 | - // Recupere les < ?php header('Xx: y'); ? > pour $page['headers'] |
|
| 199 | - // note: on essaie d'attrapper aussi certains de ces entetes codes |
|
| 200 | - // "a la main" dans les squelettes, mais evidemment sans exhaustivite |
|
| 201 | - if (stripos($corps, 'header') !== false |
|
| 202 | - and preg_match_all( |
|
| 203 | - '/(<[?]php\s+)@?header\s*\(\s*.([^:\'"]*):?\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims', |
|
| 204 | - $corps, $regs, PREG_SET_ORDER) |
|
| 205 | - ) { |
|
| 206 | - foreach ($regs as $r) { |
|
| 207 | - $corps = str_replace($r[0], '', $corps); |
|
| 208 | - # $j = Content-Type, et pas content-TYPE. |
|
| 209 | - $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
|
| 210 | - |
|
| 211 | - if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
|
| 212 | - $headers[$j] .= "|" . $r[3]; |
|
| 213 | - } else { |
|
| 214 | - $headers[$j] = $r[3]; |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - // S'agit-il d'un resultat constant ou contenant du code php |
|
| 219 | - $process_ins = ( |
|
| 220 | - strpos($corps, '<' . '?') === false |
|
| 221 | - or |
|
| 222 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 223 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 224 | - ) |
|
| 225 | - ? 'html' |
|
| 226 | - : 'php'; |
|
| 227 | - |
|
| 228 | - $skel = array( |
|
| 229 | - 'squelette' => $nom, |
|
| 230 | - 'source' => $source, |
|
| 231 | - 'process_ins' => $process_ins, |
|
| 232 | - 'invalideurs' => $cache, |
|
| 233 | - 'entetes' => $headers, |
|
| 234 | - 'duree' => isset($headers['X-Spip-Cache']) ? intval($headers['X-Spip-Cache']) : 0 |
|
| 235 | - ); |
|
| 236 | - |
|
| 237 | - // traiter #FILTRE{} et filtres |
|
| 238 | - if (!isset($filtres[$nom])) { |
|
| 239 | - $filtres[$nom] = pipeline('declarer_filtres_squelettes', array('args' => $skel, 'data' => array())); |
|
| 240 | - } |
|
| 241 | - if (count($filtres[$nom]) or (isset($headers['X-Spip-Filtre']) and strlen($headers['X-Spip-Filtre']))) { |
|
| 242 | - include_spip('public/sandbox'); |
|
| 243 | - $corps = sandbox_filtrer_squelette($skel, $corps, |
|
| 244 | - strlen($headers['X-Spip-Filtre']) ? explode('|', $headers['X-Spip-Filtre']) : array(), $filtres[$nom]); |
|
| 245 | - unset($headers['X-Spip-Filtre']); |
|
| 246 | - |
|
| 247 | - if ($process_ins == 'html') { |
|
| 248 | - $skel['process_ins'] = ( |
|
| 249 | - strpos($corps, '<' . '?') === false |
|
| 250 | - or |
|
| 251 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 252 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 253 | - ) |
|
| 254 | - ? 'html' |
|
| 255 | - : 'php'; |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - $skel['entetes'] = $headers; |
|
| 260 | - $skel['texte'] = $corps; |
|
| 261 | - |
|
| 262 | - return $skel; |
|
| 195 | + static $filtres = array(); |
|
| 196 | + $headers = array(); |
|
| 197 | + |
|
| 198 | + // Recupere les < ?php header('Xx: y'); ? > pour $page['headers'] |
|
| 199 | + // note: on essaie d'attrapper aussi certains de ces entetes codes |
|
| 200 | + // "a la main" dans les squelettes, mais evidemment sans exhaustivite |
|
| 201 | + if (stripos($corps, 'header') !== false |
|
| 202 | + and preg_match_all( |
|
| 203 | + '/(<[?]php\s+)@?header\s*\(\s*.([^:\'"]*):?\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims', |
|
| 204 | + $corps, $regs, PREG_SET_ORDER) |
|
| 205 | + ) { |
|
| 206 | + foreach ($regs as $r) { |
|
| 207 | + $corps = str_replace($r[0], '', $corps); |
|
| 208 | + # $j = Content-Type, et pas content-TYPE. |
|
| 209 | + $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
|
| 210 | + |
|
| 211 | + if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
|
| 212 | + $headers[$j] .= "|" . $r[3]; |
|
| 213 | + } else { |
|
| 214 | + $headers[$j] = $r[3]; |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + // S'agit-il d'un resultat constant ou contenant du code php |
|
| 219 | + $process_ins = ( |
|
| 220 | + strpos($corps, '<' . '?') === false |
|
| 221 | + or |
|
| 222 | + (strpos($corps, '<' . '?xml') !== false and |
|
| 223 | + strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 224 | + ) |
|
| 225 | + ? 'html' |
|
| 226 | + : 'php'; |
|
| 227 | + |
|
| 228 | + $skel = array( |
|
| 229 | + 'squelette' => $nom, |
|
| 230 | + 'source' => $source, |
|
| 231 | + 'process_ins' => $process_ins, |
|
| 232 | + 'invalideurs' => $cache, |
|
| 233 | + 'entetes' => $headers, |
|
| 234 | + 'duree' => isset($headers['X-Spip-Cache']) ? intval($headers['X-Spip-Cache']) : 0 |
|
| 235 | + ); |
|
| 236 | + |
|
| 237 | + // traiter #FILTRE{} et filtres |
|
| 238 | + if (!isset($filtres[$nom])) { |
|
| 239 | + $filtres[$nom] = pipeline('declarer_filtres_squelettes', array('args' => $skel, 'data' => array())); |
|
| 240 | + } |
|
| 241 | + if (count($filtres[$nom]) or (isset($headers['X-Spip-Filtre']) and strlen($headers['X-Spip-Filtre']))) { |
|
| 242 | + include_spip('public/sandbox'); |
|
| 243 | + $corps = sandbox_filtrer_squelette($skel, $corps, |
|
| 244 | + strlen($headers['X-Spip-Filtre']) ? explode('|', $headers['X-Spip-Filtre']) : array(), $filtres[$nom]); |
|
| 245 | + unset($headers['X-Spip-Filtre']); |
|
| 246 | + |
|
| 247 | + if ($process_ins == 'html') { |
|
| 248 | + $skel['process_ins'] = ( |
|
| 249 | + strpos($corps, '<' . '?') === false |
|
| 250 | + or |
|
| 251 | + (strpos($corps, '<' . '?xml') !== false and |
|
| 252 | + strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 253 | + ) |
|
| 254 | + ? 'html' |
|
| 255 | + : 'php'; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + $skel['entetes'] = $headers; |
|
| 260 | + $skel['texte'] = $corps; |
|
| 261 | + |
|
| 262 | + return $skel; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
| 274 | 274 | if ($lang_select) lang_select(); |
| 275 | 275 | ?' |
| 276 | - . '>'); |
|
| 276 | + . '>'); |
|
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | 279 | * Synthétise une balise dynamique : crée l'appel à l'inclusion |
@@ -293,17 +293,17 @@ discard block |
||
| 293 | 293 | * Code PHP pour inclure le squelette de la balise dynamique |
| 294 | 294 | **/ |
| 295 | 295 | function synthetiser_balise_dynamique($nom, $args, $file, $context_compil) { |
| 296 | - if (strncmp($file, "/", 1) !== 0) { |
|
| 297 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 298 | - } |
|
| 299 | - $r = sprintf(CODE_INCLURE_BALISE, |
|
| 300 | - $file, |
|
| 301 | - $context_compil[4] ? $context_compil[4] : '', |
|
| 302 | - $nom, |
|
| 303 | - join(', ', array_map('argumenter_squelette', $args)), |
|
| 304 | - join(', ', array_map('_q', $context_compil))); |
|
| 305 | - |
|
| 306 | - return $r; |
|
| 296 | + if (strncmp($file, "/", 1) !== 0) { |
|
| 297 | + $file = './" . _DIR_RACINE . "' . $file; |
|
| 298 | + } |
|
| 299 | + $r = sprintf(CODE_INCLURE_BALISE, |
|
| 300 | + $file, |
|
| 301 | + $context_compil[4] ? $context_compil[4] : '', |
|
| 302 | + $nom, |
|
| 303 | + join(', ', array_map('argumenter_squelette', $args)), |
|
| 304 | + join(', ', array_map('_q', $context_compil))); |
|
| 305 | + |
|
| 306 | + return $r; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -321,16 +321,16 @@ discard block |
||
| 321 | 321 | **/ |
| 322 | 322 | function argumenter_squelette($v) { |
| 323 | 323 | |
| 324 | - if (!is_array($v)) { |
|
| 325 | - return "'" . texte_script($v) . "'"; |
|
| 326 | - } else { |
|
| 327 | - $out = array(); |
|
| 328 | - foreach ($v as $k => $val) { |
|
| 329 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 330 | - } |
|
| 324 | + if (!is_array($v)) { |
|
| 325 | + return "'" . texte_script($v) . "'"; |
|
| 326 | + } else { |
|
| 327 | + $out = array(); |
|
| 328 | + foreach ($v as $k => $val) { |
|
| 329 | + $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | - return 'array(' . join(", ", $out) . ')'; |
|
| 333 | - } |
|
| 332 | + return 'array(' . join(", ", $out) . ')'; |
|
| 333 | + } |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | |
@@ -361,69 +361,69 @@ discard block |
||
| 361 | 361 | * Code PHP d'exécutant l'inclusion du squelette (ou texte) de la balise dynamique |
| 362 | 362 | **/ |
| 363 | 363 | function executer_balise_dynamique($nom, $args, $context_compil) { |
| 364 | - $nomfonction = $nom; |
|
| 365 | - $nomfonction_generique = ""; |
|
| 366 | - |
|
| 367 | - // Calculer un nom générique (ie. 'formulaire_' dans 'formulaire_editer_article') |
|
| 368 | - if (false !== ($p = strpos($nom, "_"))) { |
|
| 369 | - $nomfonction_generique = substr($nom, 0, $p + 1); |
|
| 370 | - } |
|
| 371 | - |
|
| 372 | - if (!$fonction_balise = charger_fonction($nomfonction, 'balise', true)) { |
|
| 373 | - if ($nomfonction_generique and $fonction_balise = charger_fonction($nomfonction_generique, 'balise', true)) { |
|
| 374 | - // et injecter en premier arg le nom de la balise |
|
| 375 | - array_unshift($args, $nom); |
|
| 376 | - $nomfonction = $nomfonction_generique; |
|
| 377 | - } |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - if (!$fonction_balise) { |
|
| 381 | - $msg = array('zbug_balise_inexistante', array('from' => 'CVT', 'balise' => $nom)); |
|
| 382 | - erreur_squelette($msg, $context_compil); |
|
| 383 | - |
|
| 384 | - return ''; |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - // retrouver le fichier qui a déclaré la fonction |
|
| 388 | - // même si la fonction dynamique est déclarée dans un fichier de fonctions. |
|
| 389 | - // Attention sous windows, getFileName() retourne un antislash. |
|
| 390 | - $reflector = new ReflectionFunction($fonction_balise); |
|
| 391 | - $file = str_replace('\\', '/', $reflector->getFileName()); |
|
| 392 | - if (strncmp($file, str_replace('\\', '/', _ROOT_RACINE), strlen(_ROOT_RACINE)) === 0) { |
|
| 393 | - $file = substr($file, strlen(_ROOT_RACINE)); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - // Y a-t-il une fonction de traitement des arguments ? |
|
| 397 | - $f = 'balise_' . $nomfonction . '_stat'; |
|
| 398 | - |
|
| 399 | - $r = !function_exists($f) ? $args : $f($args, $context_compil); |
|
| 400 | - |
|
| 401 | - if (!is_array($r)) { |
|
| 402 | - return $r; |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - // verifier que la fonction dyn est la, |
|
| 406 | - // sinon se replier sur la generique si elle existe |
|
| 407 | - if (!function_exists('balise_' . $nomfonction . '_dyn')) { |
|
| 408 | - if ($nomfonction_generique |
|
| 409 | - and $file = include_spip("balise/" . strtolower($nomfonction_generique)) |
|
| 410 | - and function_exists('balise_' . $nomfonction_generique . '_dyn') |
|
| 411 | - ) { |
|
| 412 | - // et lui injecter en premier arg le nom de la balise |
|
| 413 | - array_unshift($r, $nom); |
|
| 414 | - $nomfonction = $nomfonction_generique; |
|
| 415 | - if (!_DIR_RESTREINT) { |
|
| 416 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 417 | - } |
|
| 418 | - } else { |
|
| 419 | - $msg = array('zbug_balise_inexistante', array('from' => 'CVT', 'balise' => $nom)); |
|
| 420 | - erreur_squelette($msg, $context_compil); |
|
| 421 | - |
|
| 422 | - return ''; |
|
| 423 | - } |
|
| 424 | - } |
|
| 425 | - |
|
| 426 | - return synthetiser_balise_dynamique($nomfonction, $r, $file, $context_compil); |
|
| 364 | + $nomfonction = $nom; |
|
| 365 | + $nomfonction_generique = ""; |
|
| 366 | + |
|
| 367 | + // Calculer un nom générique (ie. 'formulaire_' dans 'formulaire_editer_article') |
|
| 368 | + if (false !== ($p = strpos($nom, "_"))) { |
|
| 369 | + $nomfonction_generique = substr($nom, 0, $p + 1); |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + if (!$fonction_balise = charger_fonction($nomfonction, 'balise', true)) { |
|
| 373 | + if ($nomfonction_generique and $fonction_balise = charger_fonction($nomfonction_generique, 'balise', true)) { |
|
| 374 | + // et injecter en premier arg le nom de la balise |
|
| 375 | + array_unshift($args, $nom); |
|
| 376 | + $nomfonction = $nomfonction_generique; |
|
| 377 | + } |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + if (!$fonction_balise) { |
|
| 381 | + $msg = array('zbug_balise_inexistante', array('from' => 'CVT', 'balise' => $nom)); |
|
| 382 | + erreur_squelette($msg, $context_compil); |
|
| 383 | + |
|
| 384 | + return ''; |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + // retrouver le fichier qui a déclaré la fonction |
|
| 388 | + // même si la fonction dynamique est déclarée dans un fichier de fonctions. |
|
| 389 | + // Attention sous windows, getFileName() retourne un antislash. |
|
| 390 | + $reflector = new ReflectionFunction($fonction_balise); |
|
| 391 | + $file = str_replace('\\', '/', $reflector->getFileName()); |
|
| 392 | + if (strncmp($file, str_replace('\\', '/', _ROOT_RACINE), strlen(_ROOT_RACINE)) === 0) { |
|
| 393 | + $file = substr($file, strlen(_ROOT_RACINE)); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + // Y a-t-il une fonction de traitement des arguments ? |
|
| 397 | + $f = 'balise_' . $nomfonction . '_stat'; |
|
| 398 | + |
|
| 399 | + $r = !function_exists($f) ? $args : $f($args, $context_compil); |
|
| 400 | + |
|
| 401 | + if (!is_array($r)) { |
|
| 402 | + return $r; |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + // verifier que la fonction dyn est la, |
|
| 406 | + // sinon se replier sur la generique si elle existe |
|
| 407 | + if (!function_exists('balise_' . $nomfonction . '_dyn')) { |
|
| 408 | + if ($nomfonction_generique |
|
| 409 | + and $file = include_spip("balise/" . strtolower($nomfonction_generique)) |
|
| 410 | + and function_exists('balise_' . $nomfonction_generique . '_dyn') |
|
| 411 | + ) { |
|
| 412 | + // et lui injecter en premier arg le nom de la balise |
|
| 413 | + array_unshift($r, $nom); |
|
| 414 | + $nomfonction = $nomfonction_generique; |
|
| 415 | + if (!_DIR_RESTREINT) { |
|
| 416 | + $file = _DIR_RESTREINT_ABS . $file; |
|
| 417 | + } |
|
| 418 | + } else { |
|
| 419 | + $msg = array('zbug_balise_inexistante', array('from' => 'CVT', 'balise' => $nom)); |
|
| 420 | + erreur_squelette($msg, $context_compil); |
|
| 421 | + |
|
| 422 | + return ''; |
|
| 423 | + } |
|
| 424 | + } |
|
| 425 | + |
|
| 426 | + return synthetiser_balise_dynamique($nomfonction, $r, $file, $context_compil); |
|
| 427 | 427 | |
| 428 | 428 | } |
| 429 | 429 | |
@@ -448,27 +448,27 @@ discard block |
||
| 448 | 448 | * @return null; |
| 449 | 449 | **/ |
| 450 | 450 | function lang_select_public($lang, $lang_select, $titre = null) { |
| 451 | - // Cas 1. forcer_lang = true et pas de critere {lang_select} |
|
| 452 | - if (isset($GLOBALS['forcer_lang']) and $GLOBALS['forcer_lang'] |
|
| 453 | - and $lang_select !== 'oui' |
|
| 454 | - ) { |
|
| 455 | - $lang = $GLOBALS['spip_lang']; |
|
| 456 | - } // Cas 2. l'objet n'a pas de langue definie (ou definie a '') |
|
| 457 | - elseif (!strlen($lang)) { |
|
| 458 | - $lang = $GLOBALS['spip_lang']; |
|
| 459 | - } // Cas 3. l'objet est multilingue ! |
|
| 460 | - elseif ($lang_select !== 'oui' |
|
| 461 | - and strlen($titre) > 10 |
|
| 462 | - and strpos($titre, '<multi>') !== false |
|
| 463 | - and strpos(echappe_html($titre), '<multi>') !== false |
|
| 464 | - ) { |
|
| 465 | - $lang = $GLOBALS['spip_lang']; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - // faire un lang_select() eventuellement sur la langue inchangee |
|
| 469 | - lang_select($lang); |
|
| 470 | - |
|
| 471 | - return; |
|
| 451 | + // Cas 1. forcer_lang = true et pas de critere {lang_select} |
|
| 452 | + if (isset($GLOBALS['forcer_lang']) and $GLOBALS['forcer_lang'] |
|
| 453 | + and $lang_select !== 'oui' |
|
| 454 | + ) { |
|
| 455 | + $lang = $GLOBALS['spip_lang']; |
|
| 456 | + } // Cas 2. l'objet n'a pas de langue definie (ou definie a '') |
|
| 457 | + elseif (!strlen($lang)) { |
|
| 458 | + $lang = $GLOBALS['spip_lang']; |
|
| 459 | + } // Cas 3. l'objet est multilingue ! |
|
| 460 | + elseif ($lang_select !== 'oui' |
|
| 461 | + and strlen($titre) > 10 |
|
| 462 | + and strpos($titre, '<multi>') !== false |
|
| 463 | + and strpos(echappe_html($titre), '<multi>') !== false |
|
| 464 | + ) { |
|
| 465 | + $lang = $GLOBALS['spip_lang']; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + // faire un lang_select() eventuellement sur la langue inchangee |
|
| 469 | + lang_select($lang); |
|
| 470 | + |
|
| 471 | + return; |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | |
@@ -476,21 +476,21 @@ discard block |
||
| 476 | 476 | // il faut le nettoyer car il pourrait etre injecte en SQL |
| 477 | 477 | // http://code.spip.net/@nettoyer_env_doublons |
| 478 | 478 | function nettoyer_env_doublons($envd) { |
| 479 | - foreach ($envd as $table => $liste) { |
|
| 480 | - $n = ''; |
|
| 481 | - foreach (explode(',', $liste) as $val) { |
|
| 482 | - if ($a = intval($val) and $val === strval($a)) { |
|
| 483 | - $n .= ',' . $val; |
|
| 484 | - } |
|
| 485 | - } |
|
| 486 | - if (strlen($n)) { |
|
| 487 | - $envd[$table] = $n; |
|
| 488 | - } else { |
|
| 489 | - unset($envd[$table]); |
|
| 490 | - } |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - return $envd; |
|
| 479 | + foreach ($envd as $table => $liste) { |
|
| 480 | + $n = ''; |
|
| 481 | + foreach (explode(',', $liste) as $val) { |
|
| 482 | + if ($a = intval($val) and $val === strval($a)) { |
|
| 483 | + $n .= ',' . $val; |
|
| 484 | + } |
|
| 485 | + } |
|
| 486 | + if (strlen($n)) { |
|
| 487 | + $envd[$table] = $n; |
|
| 488 | + } else { |
|
| 489 | + unset($envd[$table]); |
|
| 490 | + } |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + return $envd; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /** |
@@ -509,21 +509,21 @@ discard block |
||
| 509 | 509 | * Opérateur trouvé (SELF ou SUBSELECT) sinon false. |
| 510 | 510 | **/ |
| 511 | 511 | function match_self($w) { |
| 512 | - if (is_string($w)) { |
|
| 513 | - return false; |
|
| 514 | - } |
|
| 515 | - if (is_array($w)) { |
|
| 516 | - if (in_array(reset($w), array("SELF", "SUBSELECT"))) { |
|
| 517 | - return $w; |
|
| 518 | - } |
|
| 519 | - foreach (array_filter($w, 'is_array') as $sw) { |
|
| 520 | - if ($m = match_self($sw)) { |
|
| 521 | - return $m; |
|
| 522 | - } |
|
| 523 | - } |
|
| 524 | - } |
|
| 525 | - |
|
| 526 | - return false; |
|
| 512 | + if (is_string($w)) { |
|
| 513 | + return false; |
|
| 514 | + } |
|
| 515 | + if (is_array($w)) { |
|
| 516 | + if (in_array(reset($w), array("SELF", "SUBSELECT"))) { |
|
| 517 | + return $w; |
|
| 518 | + } |
|
| 519 | + foreach (array_filter($w, 'is_array') as $sw) { |
|
| 520 | + if ($m = match_self($sw)) { |
|
| 521 | + return $m; |
|
| 522 | + } |
|
| 523 | + } |
|
| 524 | + } |
|
| 525 | + |
|
| 526 | + return false; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -539,16 +539,16 @@ discard block |
||
| 539 | 539 | * est remplacée par son code. |
| 540 | 540 | **/ |
| 541 | 541 | function remplace_sous_requete($w, $sousrequete) { |
| 542 | - if (is_array($w)) { |
|
| 543 | - if (in_array(reset($w), array("SELF", "SUBSELECT"))) { |
|
| 544 | - return $sousrequete; |
|
| 545 | - } |
|
| 546 | - foreach ($w as $k => $sw) { |
|
| 547 | - $w[$k] = remplace_sous_requete($sw, $sousrequete); |
|
| 548 | - } |
|
| 549 | - } |
|
| 550 | - |
|
| 551 | - return $w; |
|
| 542 | + if (is_array($w)) { |
|
| 543 | + if (in_array(reset($w), array("SELF", "SUBSELECT"))) { |
|
| 544 | + return $sousrequete; |
|
| 545 | + } |
|
| 546 | + foreach ($w as $k => $sw) { |
|
| 547 | + $w[$k] = remplace_sous_requete($sw, $sousrequete); |
|
| 548 | + } |
|
| 549 | + } |
|
| 550 | + |
|
| 551 | + return $w; |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | /** |
@@ -562,17 +562,17 @@ discard block |
||
| 562 | 562 | * - Conditions avec des sous requêtes |
| 563 | 563 | **/ |
| 564 | 564 | function trouver_sous_requetes($where) { |
| 565 | - $where_simples = array(); |
|
| 566 | - $where_sous = array(); |
|
| 567 | - foreach ($where as $k => $w) { |
|
| 568 | - if (match_self($w)) { |
|
| 569 | - $where_sous[$k] = $w; |
|
| 570 | - } else { |
|
| 571 | - $where_simples[$k] = $w; |
|
| 572 | - } |
|
| 573 | - } |
|
| 574 | - |
|
| 575 | - return array($where_simples, $where_sous); |
|
| 565 | + $where_simples = array(); |
|
| 566 | + $where_sous = array(); |
|
| 567 | + foreach ($where as $k => $w) { |
|
| 568 | + if (match_self($w)) { |
|
| 569 | + $where_sous[$k] = $w; |
|
| 570 | + } else { |
|
| 571 | + $where_simples[$k] = $w; |
|
| 572 | + } |
|
| 573 | + } |
|
| 574 | + |
|
| 575 | + return array($where_simples, $where_sous); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | |
@@ -598,258 +598,258 @@ discard block |
||
| 598 | 598 | * @return resource |
| 599 | 599 | */ |
| 600 | 600 | function calculer_select( |
| 601 | - $select = array(), |
|
| 602 | - $from = array(), |
|
| 603 | - $from_type = array(), |
|
| 604 | - $where = array(), |
|
| 605 | - $join = array(), |
|
| 606 | - $groupby = array(), |
|
| 607 | - $orderby = array(), |
|
| 608 | - $limit = '', |
|
| 609 | - $having = array(), |
|
| 610 | - $table = '', |
|
| 611 | - $id = '', |
|
| 612 | - $serveur = '', |
|
| 613 | - $requeter = true |
|
| 601 | + $select = array(), |
|
| 602 | + $from = array(), |
|
| 603 | + $from_type = array(), |
|
| 604 | + $where = array(), |
|
| 605 | + $join = array(), |
|
| 606 | + $groupby = array(), |
|
| 607 | + $orderby = array(), |
|
| 608 | + $limit = '', |
|
| 609 | + $having = array(), |
|
| 610 | + $table = '', |
|
| 611 | + $id = '', |
|
| 612 | + $serveur = '', |
|
| 613 | + $requeter = true |
|
| 614 | 614 | ) { |
| 615 | 615 | |
| 616 | - // retirer les criteres vides: |
|
| 617 | - // {X ?} avec X absent de l'URL |
|
| 618 | - // {par #ENV{X}} avec X absent de l'URL |
|
| 619 | - // IN sur collection vide (ce dernier devrait pouvoir etre fait a la compil) |
|
| 620 | - $menage = false; |
|
| 621 | - foreach ($where as $k => $v) { |
|
| 622 | - if (is_array($v)) { |
|
| 623 | - if ((count($v) >= 2) && ($v[0] == 'REGEXP') && ($v[2] == "'.*'")) { |
|
| 624 | - $op = false; |
|
| 625 | - } elseif ((count($v) >= 2) && ($v[0] == 'LIKE') && ($v[2] == "'%'")) { |
|
| 626 | - $op = false; |
|
| 627 | - } else { |
|
| 628 | - $op = $v[0] ? $v[0] : $v; |
|
| 629 | - } |
|
| 630 | - } else { |
|
| 631 | - $op = $v; |
|
| 632 | - } |
|
| 633 | - if ((!$op) or ($op == 1) or ($op == '0=0')) { |
|
| 634 | - unset($where[$k]); |
|
| 635 | - $menage = true; |
|
| 636 | - } |
|
| 637 | - } |
|
| 638 | - |
|
| 639 | - // evacuer les eventuels groupby vide issus d'un calcul dynamique |
|
| 640 | - $groupby = array_diff($groupby, array('')); |
|
| 641 | - |
|
| 642 | - // remplacer les sous requetes recursives au calcul |
|
| 643 | - list($where_simples, $where_sous) = trouver_sous_requetes($where); |
|
| 644 | - foreach ($where_sous as $k => $w) { |
|
| 645 | - $menage = true; |
|
| 646 | - // on recupere la sous requete |
|
| 647 | - $sous = match_self($w); |
|
| 648 | - if ($sous[0] == 'SELF') { |
|
| 649 | - // c'est une sous requete identique a elle meme sous la forme (SELF,$select,$where) |
|
| 650 | - array_push($where_simples, $sous[2]); |
|
| 651 | - $wheresub = array( |
|
| 652 | - $sous[2], |
|
| 653 | - '0=0' |
|
| 654 | - ); // pour accepter une string et forcer a faire le menage car on a surement simplifie select et where |
|
| 655 | - $jsub = $join; |
|
| 656 | - // trouver les jointures utiles a |
|
| 657 | - // reinjecter dans le where de la sous requete les conditions supplementaires des jointures qui y sont mentionnees |
|
| 658 | - // ie L1.objet='article' |
|
| 659 | - // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
|
| 660 | - $i = 0; |
|
| 661 | - do { |
|
| 662 | - $where[$k] = remplace_sous_requete($w, "(" . calculer_select( |
|
| 663 | - array($sous[1] . " AS id"), |
|
| 664 | - $from, |
|
| 665 | - $from_type, |
|
| 666 | - $wheresub, |
|
| 667 | - $jsub, |
|
| 668 | - array(), array(), '', |
|
| 669 | - $having, $table, $id, $serveur, false) . ")"); |
|
| 670 | - if (!$i) { |
|
| 671 | - $i = 1; |
|
| 672 | - $wherestring = calculer_where_to_string($where[$k]); |
|
| 673 | - foreach ($join as $cle => $wj) { |
|
| 674 | - if (count($wj) == 4 |
|
| 675 | - and strpos($wherestring, "{$cle}.") !== false |
|
| 676 | - ) { |
|
| 677 | - $i = 0; |
|
| 678 | - $wheresub[] = $wj[3]; |
|
| 679 | - unset($jsub[$cle][3]); |
|
| 680 | - } |
|
| 681 | - } |
|
| 682 | - } |
|
| 683 | - } while ($i++ < 1); |
|
| 684 | - } |
|
| 685 | - if ($sous[0] == 'SUBSELECT') { |
|
| 686 | - // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
|
| 687 | - array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
|
| 688 | - $where[$k] = remplace_sous_requete($w, "(" . calculer_select( |
|
| 689 | - $sous[1], # select |
|
| 690 | - $sous[2], #from |
|
| 691 | - array(), #from_type |
|
| 692 | - $sous[3] ? (is_array($sous[3]) ? $sous[3] : array($sous[3])) : array(), |
|
| 693 | - #where, qui peut etre de la forme string comme dans sql_select |
|
| 694 | - array(), #join |
|
| 695 | - $sous[4] ? $sous[4] : array(), #groupby |
|
| 696 | - $sous[5] ? $sous[5] : array(), #orderby |
|
| 697 | - $sous[6], #limit |
|
| 698 | - $sous[7] ? $sous[7] : array(), #having |
|
| 699 | - $table, $id, $serveur, false |
|
| 700 | - ) . ")"); |
|
| 701 | - } |
|
| 702 | - array_pop($where_simples); |
|
| 703 | - } |
|
| 704 | - |
|
| 705 | - foreach ($having as $k => $v) { |
|
| 706 | - if ((!$v) or ($v == 1) or ($v == '0=0')) { |
|
| 707 | - unset($having[$k]); |
|
| 708 | - } |
|
| 709 | - } |
|
| 710 | - |
|
| 711 | - // Installer les jointures. |
|
| 712 | - // Retirer celles seulement utiles aux criteres finalement absents mais |
|
| 713 | - // parcourir de la plus recente a la moins recente pour pouvoir eliminer Ln |
|
| 714 | - // si elle est seulement utile a Ln+1 elle meme inutile |
|
| 715 | - |
|
| 716 | - $afrom = array(); |
|
| 717 | - $equiv = array(); |
|
| 718 | - $k = count($join); |
|
| 719 | - foreach (array_reverse($join, true) as $cledef => $j) { |
|
| 720 | - $cle = $cledef; |
|
| 721 | - // le format de join est : |
|
| 722 | - // array(table depart, cle depart [,cle arrivee[,condition optionnelle and ...]]) |
|
| 723 | - $join[$cle] = array_values($join[$cle]); // recalculer les cles car des unset ont pu perturber |
|
| 724 | - if (count($join[$cle]) == 2) { |
|
| 725 | - $join[$cle][] = $join[$cle][1]; |
|
| 726 | - } |
|
| 727 | - if (count($join[$cle]) == 3) { |
|
| 728 | - $join[$cle][] = ''; |
|
| 729 | - } |
|
| 730 | - list($t, $c, $carr, $and) = $join[$cle]; |
|
| 731 | - // si le nom de la jointure n'a pas ete specifiee, on prend Lx avec x sont rang dans la liste |
|
| 732 | - // pour compat avec ancienne convention |
|
| 733 | - if (is_numeric($cle)) { |
|
| 734 | - $cle = "L$k"; |
|
| 735 | - } |
|
| 736 | - if (!$menage |
|
| 737 | - or isset($afrom[$cle]) |
|
| 738 | - or calculer_jointnul($cle, $select) |
|
| 739 | - or calculer_jointnul($cle, array_diff_key($join, array($cle => $join[$cle]))) |
|
| 740 | - or calculer_jointnul($cle, $having) |
|
| 741 | - or calculer_jointnul($cle, $where_simples) |
|
| 742 | - ) { |
|
| 743 | - // corriger les references non explicites dans select |
|
| 744 | - // ou groupby |
|
| 745 | - foreach ($select as $i => $s) { |
|
| 746 | - if ($s == $c) { |
|
| 747 | - $select[$i] = "$cle.$c AS $c"; |
|
| 748 | - break; |
|
| 749 | - } |
|
| 750 | - } |
|
| 751 | - foreach ($groupby as $i => $g) { |
|
| 752 | - if ($g == $c) { |
|
| 753 | - $groupby[$i] = "$cle.$c"; |
|
| 754 | - break; |
|
| 755 | - } |
|
| 756 | - } |
|
| 757 | - // on garde une ecriture decomposee pour permettre une simplification ulterieure si besoin |
|
| 758 | - // sans recours a preg_match |
|
| 759 | - // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
|
| 760 | - $afrom[$t][$cle] = array( |
|
| 761 | - "\n" . |
|
| 762 | - (isset($from_type[$cle]) ? $from_type[$cle] : "INNER") . " JOIN", |
|
| 763 | - $from[$cle], |
|
| 764 | - "AS $cle", |
|
| 765 | - "ON (", |
|
| 766 | - "$cle.$c", |
|
| 767 | - "=", |
|
| 768 | - "$t.$carr", |
|
| 769 | - ($and ? "AND " . $and : "") . |
|
| 770 | - ")" |
|
| 771 | - ); |
|
| 772 | - if (isset($afrom[$cle])) { |
|
| 773 | - $afrom[$t] = $afrom[$t] + $afrom[$cle]; |
|
| 774 | - unset($afrom[$cle]); |
|
| 775 | - } |
|
| 776 | - $equiv[] = $carr; |
|
| 777 | - } else { |
|
| 778 | - unset($join[$cledef]); |
|
| 779 | - } |
|
| 780 | - unset($from[$cle]); |
|
| 781 | - $k--; |
|
| 782 | - } |
|
| 783 | - |
|
| 784 | - if (count($afrom)) { |
|
| 785 | - // Regarder si la table principale ne sert finalement a rien comme dans |
|
| 786 | - //<BOUCLE3(MOTS){id_article}{id_mot}> class='on'</BOUCLE3> |
|
| 787 | - //<BOUCLE2(MOTS){id_article} />#TOTAL_BOUCLE<//B2> |
|
| 788 | - //<BOUCLE5(RUBRIQUES){id_mot}{tout} />#TOTAL_BOUCLE<//B5> |
|
| 789 | - // ou dans |
|
| 790 | - //<BOUCLE8(HIERARCHIE){id_rubrique}{tout}{type='Squelette'}{inverse}{0,1}{lang_select=non} />#TOTAL_BOUCLE<//B8> |
|
| 791 | - // qui comporte plusieurs jointures |
|
| 792 | - // ou dans |
|
| 793 | - // <BOUCLE6(ARTICLES){id_mot=2}{statut==.*} />#TOTAL_BOUCLE<//B6> |
|
| 794 | - // <BOUCLE7(ARTICLES){id_mot>0}{statut?} />#TOTAL_BOUCLE<//B7> |
|
| 795 | - // penser a regarder aussi la clause orderby pour ne pas simplifier abusivement |
|
| 796 | - // <BOUCLE9(ARTICLES){recherche truc}{par titre}>#ID_ARTICLE</BOUCLE9> |
|
| 797 | - // penser a regarder aussi la clause groubpy pour ne pas simplifier abusivement |
|
| 798 | - // <BOUCLE10(EVENEMENTS){id_rubrique} />#TOTAL_BOUCLE<//B10> |
|
| 799 | - |
|
| 800 | - $t = key($from); |
|
| 801 | - $c = current($from); |
|
| 802 | - reset($from); |
|
| 803 | - $e = '/\b(' . "$t\\." . join("|" . $t . '\.', $equiv) . ')\b/'; |
|
| 804 | - if (!(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
|
| 805 | - calculer_jointnul($t, $select, $e) or |
|
| 806 | - calculer_jointnul($t, $join, $e) or |
|
| 807 | - calculer_jointnul($t, $where, $e) or |
|
| 808 | - calculer_jointnul($t, $orderby, $e) or |
|
| 809 | - calculer_jointnul($t, $groupby, $e) or |
|
| 810 | - calculer_jointnul($t, $having, $e)) |
|
| 811 | - && count($afrom[$t]) |
|
| 812 | - ) { |
|
| 813 | - $nfrom = reset($afrom[$t]); |
|
| 814 | - $nt = key($afrom[$t]); |
|
| 815 | - unset($from[$t]); |
|
| 816 | - $from[$nt] = $nfrom[1]; |
|
| 817 | - unset($afrom[$t][$nt]); |
|
| 818 | - $afrom[$nt] = $afrom[$t]; |
|
| 819 | - unset($afrom[$t]); |
|
| 820 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 821 | - $t = $nfrom[4]; |
|
| 822 | - $alias = ""; |
|
| 823 | - // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
|
| 824 | - $oldcle = explode('.', $nfrom[6]); |
|
| 825 | - $oldcle = end($oldcle); |
|
| 826 | - $newcle = explode('.', $nfrom[4]); |
|
| 827 | - $newcle = end($newcle); |
|
| 828 | - if ($newcle != $oldcle) { |
|
| 829 | - // si l'ancienne cle etait deja dans le select avec un AS |
|
| 830 | - // reprendre simplement ce AS |
|
| 831 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 832 | - if (preg_match($as, implode(',', $select), $m)) { |
|
| 833 | - $alias = ""; |
|
| 834 | - } else { |
|
| 835 | - $alias = ", " . $nfrom[4] . " AS $oldcle"; |
|
| 836 | - } |
|
| 837 | - } |
|
| 838 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 839 | - $join = remplacer_jointnul($t, $join, $e); |
|
| 840 | - $where = remplacer_jointnul($t, $where, $e); |
|
| 841 | - $having = remplacer_jointnul($t, $having, $e); |
|
| 842 | - $groupby = remplacer_jointnul($t, $groupby, $e); |
|
| 843 | - $orderby = remplacer_jointnul($t, $orderby, $e); |
|
| 844 | - } |
|
| 845 | - $from = reinjecte_joint($afrom, $from); |
|
| 846 | - } |
|
| 847 | - $GLOBALS['debug']['aucasou'] = array($table, $id, $serveur, $requeter); |
|
| 848 | - $r = sql_select($select, $from, $where, |
|
| 849 | - $groupby, array_filter($orderby), $limit, $having, $serveur, $requeter); |
|
| 850 | - unset($GLOBALS['debug']['aucasou']); |
|
| 851 | - |
|
| 852 | - return $r; |
|
| 616 | + // retirer les criteres vides: |
|
| 617 | + // {X ?} avec X absent de l'URL |
|
| 618 | + // {par #ENV{X}} avec X absent de l'URL |
|
| 619 | + // IN sur collection vide (ce dernier devrait pouvoir etre fait a la compil) |
|
| 620 | + $menage = false; |
|
| 621 | + foreach ($where as $k => $v) { |
|
| 622 | + if (is_array($v)) { |
|
| 623 | + if ((count($v) >= 2) && ($v[0] == 'REGEXP') && ($v[2] == "'.*'")) { |
|
| 624 | + $op = false; |
|
| 625 | + } elseif ((count($v) >= 2) && ($v[0] == 'LIKE') && ($v[2] == "'%'")) { |
|
| 626 | + $op = false; |
|
| 627 | + } else { |
|
| 628 | + $op = $v[0] ? $v[0] : $v; |
|
| 629 | + } |
|
| 630 | + } else { |
|
| 631 | + $op = $v; |
|
| 632 | + } |
|
| 633 | + if ((!$op) or ($op == 1) or ($op == '0=0')) { |
|
| 634 | + unset($where[$k]); |
|
| 635 | + $menage = true; |
|
| 636 | + } |
|
| 637 | + } |
|
| 638 | + |
|
| 639 | + // evacuer les eventuels groupby vide issus d'un calcul dynamique |
|
| 640 | + $groupby = array_diff($groupby, array('')); |
|
| 641 | + |
|
| 642 | + // remplacer les sous requetes recursives au calcul |
|
| 643 | + list($where_simples, $where_sous) = trouver_sous_requetes($where); |
|
| 644 | + foreach ($where_sous as $k => $w) { |
|
| 645 | + $menage = true; |
|
| 646 | + // on recupere la sous requete |
|
| 647 | + $sous = match_self($w); |
|
| 648 | + if ($sous[0] == 'SELF') { |
|
| 649 | + // c'est une sous requete identique a elle meme sous la forme (SELF,$select,$where) |
|
| 650 | + array_push($where_simples, $sous[2]); |
|
| 651 | + $wheresub = array( |
|
| 652 | + $sous[2], |
|
| 653 | + '0=0' |
|
| 654 | + ); // pour accepter une string et forcer a faire le menage car on a surement simplifie select et where |
|
| 655 | + $jsub = $join; |
|
| 656 | + // trouver les jointures utiles a |
|
| 657 | + // reinjecter dans le where de la sous requete les conditions supplementaires des jointures qui y sont mentionnees |
|
| 658 | + // ie L1.objet='article' |
|
| 659 | + // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
|
| 660 | + $i = 0; |
|
| 661 | + do { |
|
| 662 | + $where[$k] = remplace_sous_requete($w, "(" . calculer_select( |
|
| 663 | + array($sous[1] . " AS id"), |
|
| 664 | + $from, |
|
| 665 | + $from_type, |
|
| 666 | + $wheresub, |
|
| 667 | + $jsub, |
|
| 668 | + array(), array(), '', |
|
| 669 | + $having, $table, $id, $serveur, false) . ")"); |
|
| 670 | + if (!$i) { |
|
| 671 | + $i = 1; |
|
| 672 | + $wherestring = calculer_where_to_string($where[$k]); |
|
| 673 | + foreach ($join as $cle => $wj) { |
|
| 674 | + if (count($wj) == 4 |
|
| 675 | + and strpos($wherestring, "{$cle}.") !== false |
|
| 676 | + ) { |
|
| 677 | + $i = 0; |
|
| 678 | + $wheresub[] = $wj[3]; |
|
| 679 | + unset($jsub[$cle][3]); |
|
| 680 | + } |
|
| 681 | + } |
|
| 682 | + } |
|
| 683 | + } while ($i++ < 1); |
|
| 684 | + } |
|
| 685 | + if ($sous[0] == 'SUBSELECT') { |
|
| 686 | + // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
|
| 687 | + array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
|
| 688 | + $where[$k] = remplace_sous_requete($w, "(" . calculer_select( |
|
| 689 | + $sous[1], # select |
|
| 690 | + $sous[2], #from |
|
| 691 | + array(), #from_type |
|
| 692 | + $sous[3] ? (is_array($sous[3]) ? $sous[3] : array($sous[3])) : array(), |
|
| 693 | + #where, qui peut etre de la forme string comme dans sql_select |
|
| 694 | + array(), #join |
|
| 695 | + $sous[4] ? $sous[4] : array(), #groupby |
|
| 696 | + $sous[5] ? $sous[5] : array(), #orderby |
|
| 697 | + $sous[6], #limit |
|
| 698 | + $sous[7] ? $sous[7] : array(), #having |
|
| 699 | + $table, $id, $serveur, false |
|
| 700 | + ) . ")"); |
|
| 701 | + } |
|
| 702 | + array_pop($where_simples); |
|
| 703 | + } |
|
| 704 | + |
|
| 705 | + foreach ($having as $k => $v) { |
|
| 706 | + if ((!$v) or ($v == 1) or ($v == '0=0')) { |
|
| 707 | + unset($having[$k]); |
|
| 708 | + } |
|
| 709 | + } |
|
| 710 | + |
|
| 711 | + // Installer les jointures. |
|
| 712 | + // Retirer celles seulement utiles aux criteres finalement absents mais |
|
| 713 | + // parcourir de la plus recente a la moins recente pour pouvoir eliminer Ln |
|
| 714 | + // si elle est seulement utile a Ln+1 elle meme inutile |
|
| 715 | + |
|
| 716 | + $afrom = array(); |
|
| 717 | + $equiv = array(); |
|
| 718 | + $k = count($join); |
|
| 719 | + foreach (array_reverse($join, true) as $cledef => $j) { |
|
| 720 | + $cle = $cledef; |
|
| 721 | + // le format de join est : |
|
| 722 | + // array(table depart, cle depart [,cle arrivee[,condition optionnelle and ...]]) |
|
| 723 | + $join[$cle] = array_values($join[$cle]); // recalculer les cles car des unset ont pu perturber |
|
| 724 | + if (count($join[$cle]) == 2) { |
|
| 725 | + $join[$cle][] = $join[$cle][1]; |
|
| 726 | + } |
|
| 727 | + if (count($join[$cle]) == 3) { |
|
| 728 | + $join[$cle][] = ''; |
|
| 729 | + } |
|
| 730 | + list($t, $c, $carr, $and) = $join[$cle]; |
|
| 731 | + // si le nom de la jointure n'a pas ete specifiee, on prend Lx avec x sont rang dans la liste |
|
| 732 | + // pour compat avec ancienne convention |
|
| 733 | + if (is_numeric($cle)) { |
|
| 734 | + $cle = "L$k"; |
|
| 735 | + } |
|
| 736 | + if (!$menage |
|
| 737 | + or isset($afrom[$cle]) |
|
| 738 | + or calculer_jointnul($cle, $select) |
|
| 739 | + or calculer_jointnul($cle, array_diff_key($join, array($cle => $join[$cle]))) |
|
| 740 | + or calculer_jointnul($cle, $having) |
|
| 741 | + or calculer_jointnul($cle, $where_simples) |
|
| 742 | + ) { |
|
| 743 | + // corriger les references non explicites dans select |
|
| 744 | + // ou groupby |
|
| 745 | + foreach ($select as $i => $s) { |
|
| 746 | + if ($s == $c) { |
|
| 747 | + $select[$i] = "$cle.$c AS $c"; |
|
| 748 | + break; |
|
| 749 | + } |
|
| 750 | + } |
|
| 751 | + foreach ($groupby as $i => $g) { |
|
| 752 | + if ($g == $c) { |
|
| 753 | + $groupby[$i] = "$cle.$c"; |
|
| 754 | + break; |
|
| 755 | + } |
|
| 756 | + } |
|
| 757 | + // on garde une ecriture decomposee pour permettre une simplification ulterieure si besoin |
|
| 758 | + // sans recours a preg_match |
|
| 759 | + // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
|
| 760 | + $afrom[$t][$cle] = array( |
|
| 761 | + "\n" . |
|
| 762 | + (isset($from_type[$cle]) ? $from_type[$cle] : "INNER") . " JOIN", |
|
| 763 | + $from[$cle], |
|
| 764 | + "AS $cle", |
|
| 765 | + "ON (", |
|
| 766 | + "$cle.$c", |
|
| 767 | + "=", |
|
| 768 | + "$t.$carr", |
|
| 769 | + ($and ? "AND " . $and : "") . |
|
| 770 | + ")" |
|
| 771 | + ); |
|
| 772 | + if (isset($afrom[$cle])) { |
|
| 773 | + $afrom[$t] = $afrom[$t] + $afrom[$cle]; |
|
| 774 | + unset($afrom[$cle]); |
|
| 775 | + } |
|
| 776 | + $equiv[] = $carr; |
|
| 777 | + } else { |
|
| 778 | + unset($join[$cledef]); |
|
| 779 | + } |
|
| 780 | + unset($from[$cle]); |
|
| 781 | + $k--; |
|
| 782 | + } |
|
| 783 | + |
|
| 784 | + if (count($afrom)) { |
|
| 785 | + // Regarder si la table principale ne sert finalement a rien comme dans |
|
| 786 | + //<BOUCLE3(MOTS){id_article}{id_mot}> class='on'</BOUCLE3> |
|
| 787 | + //<BOUCLE2(MOTS){id_article} />#TOTAL_BOUCLE<//B2> |
|
| 788 | + //<BOUCLE5(RUBRIQUES){id_mot}{tout} />#TOTAL_BOUCLE<//B5> |
|
| 789 | + // ou dans |
|
| 790 | + //<BOUCLE8(HIERARCHIE){id_rubrique}{tout}{type='Squelette'}{inverse}{0,1}{lang_select=non} />#TOTAL_BOUCLE<//B8> |
|
| 791 | + // qui comporte plusieurs jointures |
|
| 792 | + // ou dans |
|
| 793 | + // <BOUCLE6(ARTICLES){id_mot=2}{statut==.*} />#TOTAL_BOUCLE<//B6> |
|
| 794 | + // <BOUCLE7(ARTICLES){id_mot>0}{statut?} />#TOTAL_BOUCLE<//B7> |
|
| 795 | + // penser a regarder aussi la clause orderby pour ne pas simplifier abusivement |
|
| 796 | + // <BOUCLE9(ARTICLES){recherche truc}{par titre}>#ID_ARTICLE</BOUCLE9> |
|
| 797 | + // penser a regarder aussi la clause groubpy pour ne pas simplifier abusivement |
|
| 798 | + // <BOUCLE10(EVENEMENTS){id_rubrique} />#TOTAL_BOUCLE<//B10> |
|
| 799 | + |
|
| 800 | + $t = key($from); |
|
| 801 | + $c = current($from); |
|
| 802 | + reset($from); |
|
| 803 | + $e = '/\b(' . "$t\\." . join("|" . $t . '\.', $equiv) . ')\b/'; |
|
| 804 | + if (!(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
|
| 805 | + calculer_jointnul($t, $select, $e) or |
|
| 806 | + calculer_jointnul($t, $join, $e) or |
|
| 807 | + calculer_jointnul($t, $where, $e) or |
|
| 808 | + calculer_jointnul($t, $orderby, $e) or |
|
| 809 | + calculer_jointnul($t, $groupby, $e) or |
|
| 810 | + calculer_jointnul($t, $having, $e)) |
|
| 811 | + && count($afrom[$t]) |
|
| 812 | + ) { |
|
| 813 | + $nfrom = reset($afrom[$t]); |
|
| 814 | + $nt = key($afrom[$t]); |
|
| 815 | + unset($from[$t]); |
|
| 816 | + $from[$nt] = $nfrom[1]; |
|
| 817 | + unset($afrom[$t][$nt]); |
|
| 818 | + $afrom[$nt] = $afrom[$t]; |
|
| 819 | + unset($afrom[$t]); |
|
| 820 | + $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 821 | + $t = $nfrom[4]; |
|
| 822 | + $alias = ""; |
|
| 823 | + // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
|
| 824 | + $oldcle = explode('.', $nfrom[6]); |
|
| 825 | + $oldcle = end($oldcle); |
|
| 826 | + $newcle = explode('.', $nfrom[4]); |
|
| 827 | + $newcle = end($newcle); |
|
| 828 | + if ($newcle != $oldcle) { |
|
| 829 | + // si l'ancienne cle etait deja dans le select avec un AS |
|
| 830 | + // reprendre simplement ce AS |
|
| 831 | + $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 832 | + if (preg_match($as, implode(',', $select), $m)) { |
|
| 833 | + $alias = ""; |
|
| 834 | + } else { |
|
| 835 | + $alias = ", " . $nfrom[4] . " AS $oldcle"; |
|
| 836 | + } |
|
| 837 | + } |
|
| 838 | + $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 839 | + $join = remplacer_jointnul($t, $join, $e); |
|
| 840 | + $where = remplacer_jointnul($t, $where, $e); |
|
| 841 | + $having = remplacer_jointnul($t, $having, $e); |
|
| 842 | + $groupby = remplacer_jointnul($t, $groupby, $e); |
|
| 843 | + $orderby = remplacer_jointnul($t, $orderby, $e); |
|
| 844 | + } |
|
| 845 | + $from = reinjecte_joint($afrom, $from); |
|
| 846 | + } |
|
| 847 | + $GLOBALS['debug']['aucasou'] = array($table, $id, $serveur, $requeter); |
|
| 848 | + $r = sql_select($select, $from, $where, |
|
| 849 | + $groupby, array_filter($orderby), $limit, $having, $serveur, $requeter); |
|
| 850 | + unset($GLOBALS['debug']['aucasou']); |
|
| 851 | + |
|
| 852 | + return $r; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | /** |
@@ -860,20 +860,20 @@ discard block |
||
| 860 | 860 | * @return string |
| 861 | 861 | */ |
| 862 | 862 | function calculer_where_to_string($v, $join = 'AND') { |
| 863 | - if (empty($v)) { |
|
| 864 | - return ''; |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - if (!is_array($v)) { |
|
| 868 | - return $v; |
|
| 869 | - } else { |
|
| 870 | - $exp = ""; |
|
| 871 | - if (strtoupper($join) === 'AND') { |
|
| 872 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 873 | - } else { |
|
| 874 | - return $exp . join($join, $v); |
|
| 875 | - } |
|
| 876 | - } |
|
| 863 | + if (empty($v)) { |
|
| 864 | + return ''; |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + if (!is_array($v)) { |
|
| 868 | + return $v; |
|
| 869 | + } else { |
|
| 870 | + $exp = ""; |
|
| 871 | + if (strtoupper($join) === 'AND') { |
|
| 872 | + return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 873 | + } else { |
|
| 874 | + return $exp . join($join, $v); |
|
| 875 | + } |
|
| 876 | + } |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | |
@@ -881,62 +881,62 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | // http://code.spip.net/@calculer_jointnul |
| 883 | 883 | function calculer_jointnul($cle, $exp, $equiv = '') { |
| 884 | - if (!is_array($exp)) { |
|
| 885 | - if ($equiv) { |
|
| 886 | - $exp = preg_replace($equiv, '', $exp); |
|
| 887 | - } |
|
| 888 | - |
|
| 889 | - return preg_match("/\\b$cle\\./", $exp); |
|
| 890 | - } else { |
|
| 891 | - foreach ($exp as $v) { |
|
| 892 | - if (calculer_jointnul($cle, $v, $equiv)) { |
|
| 893 | - return true; |
|
| 894 | - } |
|
| 895 | - } |
|
| 896 | - |
|
| 897 | - return false; |
|
| 898 | - } |
|
| 884 | + if (!is_array($exp)) { |
|
| 885 | + if ($equiv) { |
|
| 886 | + $exp = preg_replace($equiv, '', $exp); |
|
| 887 | + } |
|
| 888 | + |
|
| 889 | + return preg_match("/\\b$cle\\./", $exp); |
|
| 890 | + } else { |
|
| 891 | + foreach ($exp as $v) { |
|
| 892 | + if (calculer_jointnul($cle, $v, $equiv)) { |
|
| 893 | + return true; |
|
| 894 | + } |
|
| 895 | + } |
|
| 896 | + |
|
| 897 | + return false; |
|
| 898 | + } |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | // http://code.spip.net/@reinjecte_joint |
| 902 | 902 | function reinjecte_joint($afrom, $from) { |
| 903 | - $from_synth = array(); |
|
| 904 | - foreach ($from as $k => $v) { |
|
| 905 | - $from_synth[$k] = $from[$k]; |
|
| 906 | - if (isset($afrom[$k])) { |
|
| 907 | - foreach ($afrom[$k] as $kk => $vv) { |
|
| 908 | - $afrom[$k][$kk] = implode(' ', $afrom[$k][$kk]); |
|
| 909 | - } |
|
| 910 | - $from_synth["$k@"] = implode(' ', $afrom[$k]); |
|
| 911 | - unset($afrom[$k]); |
|
| 912 | - } |
|
| 913 | - } |
|
| 914 | - |
|
| 915 | - return $from_synth; |
|
| 903 | + $from_synth = array(); |
|
| 904 | + foreach ($from as $k => $v) { |
|
| 905 | + $from_synth[$k] = $from[$k]; |
|
| 906 | + if (isset($afrom[$k])) { |
|
| 907 | + foreach ($afrom[$k] as $kk => $vv) { |
|
| 908 | + $afrom[$k][$kk] = implode(' ', $afrom[$k][$kk]); |
|
| 909 | + } |
|
| 910 | + $from_synth["$k@"] = implode(' ', $afrom[$k]); |
|
| 911 | + unset($afrom[$k]); |
|
| 912 | + } |
|
| 913 | + } |
|
| 914 | + |
|
| 915 | + return $from_synth; |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | // http://code.spip.net/@remplacer_jointnul |
| 919 | 919 | function remplacer_jointnul($cle, $exp, $equiv = '') { |
| 920 | - if (!is_array($exp)) { |
|
| 921 | - return preg_replace($equiv, $cle, $exp); |
|
| 922 | - } else { |
|
| 923 | - foreach ($exp as $k => $v) { |
|
| 924 | - $exp[$k] = remplacer_jointnul($cle, $v, $equiv); |
|
| 925 | - } |
|
| 926 | - |
|
| 927 | - return $exp; |
|
| 928 | - } |
|
| 920 | + if (!is_array($exp)) { |
|
| 921 | + return preg_replace($equiv, $cle, $exp); |
|
| 922 | + } else { |
|
| 923 | + foreach ($exp as $k => $v) { |
|
| 924 | + $exp[$k] = remplacer_jointnul($cle, $v, $equiv); |
|
| 925 | + } |
|
| 926 | + |
|
| 927 | + return $exp; |
|
| 928 | + } |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | // calcul du nom du squelette |
| 932 | 932 | // http://code.spip.net/@calculer_nom_fonction_squel |
| 933 | 933 | function calculer_nom_fonction_squel($skel, $mime_type = 'html', $connect = '') { |
| 934 | - // ne pas doublonner les squelette selon qu'ils sont calcules depuis ecrire/ ou depuis la racine |
|
| 935 | - if ($l = strlen(_DIR_RACINE) and strncmp($skel, _DIR_RACINE, $l) == 0) { |
|
| 936 | - $skel = substr($skel, strlen(_DIR_RACINE)); |
|
| 937 | - } |
|
| 938 | - |
|
| 939 | - return $mime_type |
|
| 940 | - . (!$connect ? '' : preg_replace('/\W/', "_", $connect)) . '_' |
|
| 941 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 934 | + // ne pas doublonner les squelette selon qu'ils sont calcules depuis ecrire/ ou depuis la racine |
|
| 935 | + if ($l = strlen(_DIR_RACINE) and strncmp($skel, _DIR_RACINE, $l) == 0) { |
|
| 936 | + $skel = substr($skel, strlen(_DIR_RACINE)); |
|
| 937 | + } |
|
| 938 | + |
|
| 939 | + return $mime_type |
|
| 940 | + . (!$connect ? '' : preg_replace('/\W/', "_", $connect)) . '_' |
|
| 941 | + . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 942 | 942 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $GLOBALS['debug_objets']['courant'] = $nom; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php'; |
|
| 57 | + $phpfile = sous_repertoire(_DIR_SKELS, '', false, true).$nom.'.php'; |
|
| 58 | 58 | |
| 59 | 59 | // si squelette est deja compile et perenne, le charger |
| 60 | 60 | if (!squelette_obsolete($phpfile, $source)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | #} |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (file_exists($lib = $squelette . '_fonctions' . '.php')) { |
|
| 70 | + if (file_exists($lib = $squelette.'_fonctions'.'.php')) { |
|
| 71 | 71 | include_once $lib; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | if (defined('_VAR_MODE') and _VAR_MODE == 'debug') { |
| 122 | 122 | |
| 123 | 123 | // Tracer ce qui vient d'etre compile |
| 124 | - $GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code; |
|
| 124 | + $GLOBALS['debug_objets']['code'][$nom.'tout'] = $code; |
|
| 125 | 125 | |
| 126 | 126 | // si c'est ce que demande le debusqueur, lui passer la main |
| 127 | 127 | if ($GLOBALS['debug_objets']['sourcefile'] |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | $code = " |
| 144 | 144 | /* |
| 145 | 145 | * Squelette : $sourcefile |
| 146 | - * Date : " . gmdate("D, d M Y H:i:s", @filemtime($sourcefile)) . " GMT |
|
| 147 | - * Compile : " . gmdate("D, d M Y H:i:s", time()) . " GMT |
|
| 148 | - * " . (!$boucles ? "Pas de boucle" : ("Boucles : " . $noms)) . " |
|
| 146 | + * Date : ".gmdate("D, d M Y H:i:s", @filemtime($sourcefile))." GMT |
|
| 147 | + * Compile : " . gmdate("D, d M Y H:i:s", time())." GMT |
|
| 148 | + * " . (!$boucles ? "Pas de boucle" : ("Boucles : ".$noms))." |
|
| 149 | 149 | */ "; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $code = '<' . "?php\n" . $code . join('', $boucles) . "\n?" . '>'; |
|
| 152 | + $code = '<'."?php\n".$code.join('', $boucles)."\n?".'>'; |
|
| 153 | 153 | if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) { |
| 154 | 154 | ecrire_fichier($phpfile, $code); |
| 155 | 155 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $j = join('-', array_map('ucwords', explode('-', strtolower($r[2])))); |
| 210 | 210 | |
| 211 | 211 | if ($j == 'X-Spip-Filtre' and isset($headers[$j])) { |
| 212 | - $headers[$j] .= "|" . $r[3]; |
|
| 212 | + $headers[$j] .= "|".$r[3]; |
|
| 213 | 213 | } else { |
| 214 | 214 | $headers[$j] = $r[3]; |
| 215 | 215 | } |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | // S'agit-il d'un resultat constant ou contenant du code php |
| 219 | 219 | $process_ins = ( |
| 220 | - strpos($corps, '<' . '?') === false |
|
| 220 | + strpos($corps, '<'.'?') === false |
|
| 221 | 221 | or |
| 222 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 223 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 222 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 223 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 224 | 224 | ) |
| 225 | 225 | ? 'html' |
| 226 | 226 | : 'php'; |
@@ -246,10 +246,10 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | if ($process_ins == 'html') { |
| 248 | 248 | $skel['process_ins'] = ( |
| 249 | - strpos($corps, '<' . '?') === false |
|
| 249 | + strpos($corps, '<'.'?') === false |
|
| 250 | 250 | or |
| 251 | - (strpos($corps, '<' . '?xml') !== false and |
|
| 252 | - strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false) |
|
| 251 | + (strpos($corps, '<'.'?xml') !== false and |
|
| 252 | + strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false) |
|
| 253 | 253 | ) |
| 254 | 254 | ? 'html' |
| 255 | 255 | : 'php'; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | // |
| 268 | 268 | |
| 269 | 269 | /** Code PHP pour inclure une balise dynamique à l'exécution d'une page */ |
| 270 | -define('CODE_INCLURE_BALISE', '<' . '?php |
|
| 270 | +define('CODE_INCLURE_BALISE', '<'.'?php |
|
| 271 | 271 | include_once("%s"); |
| 272 | 272 | if ($lang_select = "%s") $lang_select = lang_select($lang_select); |
| 273 | 273 | inserer_balise_dynamique(balise_%s_dyn(%s), array(%s)); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | **/ |
| 295 | 295 | function synthetiser_balise_dynamique($nom, $args, $file, $context_compil) { |
| 296 | 296 | if (strncmp($file, "/", 1) !== 0) { |
| 297 | - $file = './" . _DIR_RACINE . "' . $file; |
|
| 297 | + $file = './" . _DIR_RACINE . "'.$file; |
|
| 298 | 298 | } |
| 299 | 299 | $r = sprintf(CODE_INCLURE_BALISE, |
| 300 | 300 | $file, |
@@ -322,14 +322,14 @@ discard block |
||
| 322 | 322 | function argumenter_squelette($v) { |
| 323 | 323 | |
| 324 | 324 | if (!is_array($v)) { |
| 325 | - return "'" . texte_script($v) . "'"; |
|
| 325 | + return "'".texte_script($v)."'"; |
|
| 326 | 326 | } else { |
| 327 | 327 | $out = array(); |
| 328 | 328 | foreach ($v as $k => $val) { |
| 329 | - $out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val); |
|
| 329 | + $out [] = argumenter_squelette($k).'=>'.argumenter_squelette($val); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - return 'array(' . join(", ", $out) . ')'; |
|
| 332 | + return 'array('.join(", ", $out).')'; |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Y a-t-il une fonction de traitement des arguments ? |
| 397 | - $f = 'balise_' . $nomfonction . '_stat'; |
|
| 397 | + $f = 'balise_'.$nomfonction.'_stat'; |
|
| 398 | 398 | |
| 399 | 399 | $r = !function_exists($f) ? $args : $f($args, $context_compil); |
| 400 | 400 | |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | // verifier que la fonction dyn est la, |
| 406 | 406 | // sinon se replier sur la generique si elle existe |
| 407 | - if (!function_exists('balise_' . $nomfonction . '_dyn')) { |
|
| 407 | + if (!function_exists('balise_'.$nomfonction.'_dyn')) { |
|
| 408 | 408 | if ($nomfonction_generique |
| 409 | - and $file = include_spip("balise/" . strtolower($nomfonction_generique)) |
|
| 410 | - and function_exists('balise_' . $nomfonction_generique . '_dyn') |
|
| 409 | + and $file = include_spip("balise/".strtolower($nomfonction_generique)) |
|
| 410 | + and function_exists('balise_'.$nomfonction_generique.'_dyn') |
|
| 411 | 411 | ) { |
| 412 | 412 | // et lui injecter en premier arg le nom de la balise |
| 413 | 413 | array_unshift($r, $nom); |
| 414 | 414 | $nomfonction = $nomfonction_generique; |
| 415 | 415 | if (!_DIR_RESTREINT) { |
| 416 | - $file = _DIR_RESTREINT_ABS . $file; |
|
| 416 | + $file = _DIR_RESTREINT_ABS.$file; |
|
| 417 | 417 | } |
| 418 | 418 | } else { |
| 419 | 419 | $msg = array('zbug_balise_inexistante', array('from' => 'CVT', 'balise' => $nom)); |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | $n = ''; |
| 481 | 481 | foreach (explode(',', $liste) as $val) { |
| 482 | 482 | if ($a = intval($val) and $val === strval($a)) { |
| 483 | - $n .= ',' . $val; |
|
| 483 | + $n .= ','.$val; |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | if (strlen($n)) { |
@@ -659,14 +659,14 @@ discard block |
||
| 659 | 659 | // on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction |
| 660 | 660 | $i = 0; |
| 661 | 661 | do { |
| 662 | - $where[$k] = remplace_sous_requete($w, "(" . calculer_select( |
|
| 663 | - array($sous[1] . " AS id"), |
|
| 662 | + $where[$k] = remplace_sous_requete($w, "(".calculer_select( |
|
| 663 | + array($sous[1]." AS id"), |
|
| 664 | 664 | $from, |
| 665 | 665 | $from_type, |
| 666 | 666 | $wheresub, |
| 667 | 667 | $jsub, |
| 668 | 668 | array(), array(), '', |
| 669 | - $having, $table, $id, $serveur, false) . ")"); |
|
| 669 | + $having, $table, $id, $serveur, false).")"); |
|
| 670 | 670 | if (!$i) { |
| 671 | 671 | $i = 1; |
| 672 | 672 | $wherestring = calculer_where_to_string($where[$k]); |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | if ($sous[0] == 'SUBSELECT') { |
| 686 | 686 | // c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having) |
| 687 | 687 | array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ? |
| 688 | - $where[$k] = remplace_sous_requete($w, "(" . calculer_select( |
|
| 688 | + $where[$k] = remplace_sous_requete($w, "(".calculer_select( |
|
| 689 | 689 | $sous[1], # select |
| 690 | 690 | $sous[2], #from |
| 691 | 691 | array(), #from_type |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | $sous[6], #limit |
| 698 | 698 | $sous[7] ? $sous[7] : array(), #having |
| 699 | 699 | $table, $id, $serveur, false |
| 700 | - ) . ")"); |
|
| 700 | + ).")"); |
|
| 701 | 701 | } |
| 702 | 702 | array_pop($where_simples); |
| 703 | 703 | } |
@@ -758,15 +758,15 @@ discard block |
||
| 758 | 758 | // sans recours a preg_match |
| 759 | 759 | // un implode(' ',..) est fait dans reinjecte_joint un peu plus bas |
| 760 | 760 | $afrom[$t][$cle] = array( |
| 761 | - "\n" . |
|
| 762 | - (isset($from_type[$cle]) ? $from_type[$cle] : "INNER") . " JOIN", |
|
| 761 | + "\n". |
|
| 762 | + (isset($from_type[$cle]) ? $from_type[$cle] : "INNER")." JOIN", |
|
| 763 | 763 | $from[$cle], |
| 764 | 764 | "AS $cle", |
| 765 | 765 | "ON (", |
| 766 | 766 | "$cle.$c", |
| 767 | 767 | "=", |
| 768 | 768 | "$t.$carr", |
| 769 | - ($and ? "AND " . $and : "") . |
|
| 769 | + ($and ? "AND ".$and : ""). |
|
| 770 | 770 | ")" |
| 771 | 771 | ); |
| 772 | 772 | if (isset($afrom[$cle])) { |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | $t = key($from); |
| 801 | 801 | $c = current($from); |
| 802 | 802 | reset($from); |
| 803 | - $e = '/\b(' . "$t\\." . join("|" . $t . '\.', $equiv) . ')\b/'; |
|
| 803 | + $e = '/\b('."$t\\.".join("|".$t.'\.', $equiv).')\b/'; |
|
| 804 | 804 | if (!(strpos($t, ' ') or // jointure des le depart cf boucle_doc |
| 805 | 805 | calculer_jointnul($t, $select, $e) or |
| 806 | 806 | calculer_jointnul($t, $join, $e) or |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | unset($afrom[$t][$nt]); |
| 818 | 818 | $afrom[$nt] = $afrom[$t]; |
| 819 | 819 | unset($afrom[$t]); |
| 820 | - $e = '/\b' . preg_quote($nfrom[6]) . '\b/'; |
|
| 820 | + $e = '/\b'.preg_quote($nfrom[6]).'\b/'; |
|
| 821 | 821 | $t = $nfrom[4]; |
| 822 | 822 | $alias = ""; |
| 823 | 823 | // verifier que les deux cles sont homonymes, sinon installer un alias dans le select |
@@ -828,14 +828,14 @@ discard block |
||
| 828 | 828 | if ($newcle != $oldcle) { |
| 829 | 829 | // si l'ancienne cle etait deja dans le select avec un AS |
| 830 | 830 | // reprendre simplement ce AS |
| 831 | - $as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/'; |
|
| 831 | + $as = '/\b'.preg_quote($nfrom[6]).'\s+(AS\s+\w+)\b/'; |
|
| 832 | 832 | if (preg_match($as, implode(',', $select), $m)) { |
| 833 | 833 | $alias = ""; |
| 834 | 834 | } else { |
| 835 | - $alias = ", " . $nfrom[4] . " AS $oldcle"; |
|
| 835 | + $alias = ", ".$nfrom[4]." AS $oldcle"; |
|
| 836 | 836 | } |
| 837 | 837 | } |
| 838 | - $select = remplacer_jointnul($t . $alias, $select, $e); |
|
| 838 | + $select = remplacer_jointnul($t.$alias, $select, $e); |
|
| 839 | 839 | $join = remplacer_jointnul($t, $join, $e); |
| 840 | 840 | $where = remplacer_jointnul($t, $where, $e); |
| 841 | 841 | $having = remplacer_jointnul($t, $having, $e); |
@@ -869,9 +869,9 @@ discard block |
||
| 869 | 869 | } else { |
| 870 | 870 | $exp = ""; |
| 871 | 871 | if (strtoupper($join) === 'AND') { |
| 872 | - return $exp . join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 872 | + return $exp.join(" $join ", array_map('calculer_where_to_string', $v)); |
|
| 873 | 873 | } else { |
| 874 | - return $exp . join($join, $v); |
|
| 874 | + return $exp.join($join, $v); |
|
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | } |
@@ -937,6 +937,6 @@ discard block |
||
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | return $mime_type |
| 940 | - . (!$connect ? '' : preg_replace('/\W/', "_", $connect)) . '_' |
|
| 941 | - . md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : '')); |
|
| 940 | + . (!$connect ? '' : preg_replace('/\W/', "_", $connect)).'_' |
|
| 941 | + . md5($GLOBALS['spip_version_code'].' * '.$skel.(isset($GLOBALS['marqueur_skel']) ? '*'.$GLOBALS['marqueur_skel'] : '')); |
|
| 942 | 942 | } |