30 |
mathias |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | Lesser General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: bbc_requete_media.fonct.php,v 1.3 2004/09/15 10:32:30 jpm Exp $
|
|
|
23 |
/**
|
|
|
24 |
* Fonctions de création de la requête sur un média.
|
|
|
25 |
*
|
|
|
26 |
* Contient une fonction créant la requête d'intérogation de la base de données.
|
|
|
27 |
* Valable pour le paramètre "media".
|
|
|
28 |
*
|
|
|
29 |
*@package BiblioBota-Consultation
|
|
|
30 |
*@subpackage Fonctions
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@author Jean-Charles GRANGER <tela@vecteur.org>
|
|
|
33 |
//Autres auteurs :
|
|
|
34 |
*@author Jean-Pascal MILCENT <jpm@clapas.org>
|
|
|
35 |
*@copyright Tela-Botanica 2000-2004
|
|
|
36 |
*@version $Revision: 1.3 $ $Date: 2004/09/15 10:32:30 $
|
|
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
38 |
*/
|
2 |
jp_milcent |
39 |
|
30 |
mathias |
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
// | ENTETE du PROGRAMME |
|
|
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
46 |
// | LISTE de FONCTIONS |
|
|
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
48 |
|
|
|
49 |
/** Fonction mkquery() - Créé une requête intérogeant la base de donnée.
|
|
|
50 |
*
|
|
|
51 |
* Fonction créant la requête d'intérogation de la base de données pour le
|
|
|
52 |
* paramêtre "media".
|
|
|
53 |
*
|
|
|
54 |
* @return string la requête permettant de récupérer les média.
|
2 |
jp_milcent |
55 |
*/
|
|
|
56 |
function mkquery()
|
|
|
57 |
{
|
|
|
58 |
global $tbl;
|
|
|
59 |
global $TabFinder;
|
|
|
60 |
global $nbr_total;
|
|
|
61 |
global $var_biblio;
|
|
|
62 |
global $query_dom;
|
|
|
63 |
global $plugin_store;
|
|
|
64 |
|
|
|
65 |
// si limit_domain vaut 1, alors on réduit les recherches au seul domaine botanique
|
|
|
66 |
|
|
|
67 |
if ($var_biblio['limit_domain'] == 1) {
|
|
|
68 |
$add_from_dom = ', '.$tbl['domaine'].', '.$tbl['domaine_lk'];
|
|
|
69 |
// lien domaines -- table de jointure domaines
|
30 |
mathias |
70 |
$add_limit_dom = ' AND ('.$tbl['domaine'].'.B_D_ID = '.$tbl['domaine_lk'].'.B_DL_IDDOM)';
|
2 |
jp_milcent |
71 |
// lien articles -- table de jointure domaines
|
|
|
72 |
$add_limit_dom .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['domaine_lk'].'.B_DL_IDITEM)';
|
|
|
73 |
$add_limit_dom .= ' AND '.$tbl['domaine'].'.B_D_ID = 1';
|
|
|
74 |
} else {
|
30 |
mathias |
75 |
$add_from_dom = ', '.$tbl['domaine'].', '.$tbl['domaine_lk'];
|
2 |
jp_milcent |
76 |
// lien domaines -- table de jointure domaines
|
30 |
mathias |
77 |
$add_limit_dom = ' AND ('.$tbl['domaine'].'.B_D_ID = '.$tbl['domaine_lk'].'.B_DL_IDDOM)';
|
2 |
jp_milcent |
78 |
// lien articles -- table de jointure domaines
|
|
|
79 |
$add_limit_dom .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['domaine_lk'].'.B_DL_IDITEM)';
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
/*
|
|
|
83 |
Pour une implémentation d'une recherche sur TOUTE LA TABLE ARTICLES
|
|
|
84 |
il faut une requête spéciale qui fasse une jointure à la fois avec les
|
|
|
85 |
tables structure-coll-serie-fasc-art et les tables str-art-media... gasp...
|
|
|
86 |
*/
|
|
|
87 |
|
|
|
88 |
/* si la variable de catégorie / type vaut 0, il n'y a pas affinage de la requête par catégorie */
|
|
|
89 |
|
|
|
90 |
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
|
|
|
91 |
// On demande ici les articles : mise en place des réducteurs
|
|
|
92 |
$add_select = 'B_C_CRAI, '.$tbl['serie'].'.*, B_C_NOMCOMPLET, B_C_ABREGE, B_F_NUMERO, B_F_TITRE, B_F_DATE, B_A_PAGEDEBUT, B_A_PAGEFIN, ';
|
|
|
93 |
// $add_select = $tbl['collection'].".B_C_CRAI, ".$tbl['serie'].".*, ".$tbl['collection'].".B_C_NOMCOMPLET, ".$tbl['collection'].".B_C_ABREGE, ".$tbl['fascicule'].".B_F_TITRE, ".$tbl['fascicule'].".B_F_DATE, ".$tbl['article'].".B_A_PAGEDEBUT, ".$tbl['article'].".B_A_PAGEFIN, ";
|
|
|
94 |
$add_from = $tbl['collection'].' LEFT JOIN '.$tbl['str'].' ON B_C_LKSTR = B_S_IDSTR, '.$tbl['fascicule'].', '.$tbl['serie'].', '.$tbl['article'].',';
|
|
|
95 |
// jointure coll - serie
|
|
|
96 |
$special_join = ' AND ('.$tbl['collection'].'.B_C_CRAI = '.$tbl['serie'].'.B_SER_CRAICOLL)';
|
|
|
97 |
// jointure serie - fasc
|
|
|
98 |
$special_join .= ' AND ('.$tbl['serie'].'.B_SER_CRAICOLL = '.$tbl['fascicule'].'.B_F_CRAICOLL)';
|
|
|
99 |
$special_join .= ' AND ('.$tbl['serie'].'.B_SER_IDSERIE = '.$tbl['fascicule'].'.B_F_CRAISERIE)';
|
|
|
100 |
// jointure fasc - item
|
|
|
101 |
$special_join .= ' AND ('.$tbl['fascicule'].'.B_F_CRAICOLL = '.$tbl['article'].'.B_A_CRAICOLL)';
|
|
|
102 |
$special_join .= ' AND ('.$tbl['fascicule'].'.B_F_CRAISERIE = '.$tbl['article'].'.B_A_CRAISERIE)';
|
|
|
103 |
$special_join .= ' AND ('.$tbl['fascicule'].'.B_F_NUMERO = '.$tbl['article'].'.B_A_CRAIFASC)';
|
|
|
104 |
// jointure item - article
|
|
|
105 |
$special_join .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['article'].'.B_A_IDART)';
|
|
|
106 |
|
|
|
107 |
// réducteur de catégorie (collections) categ
|
30 |
mathias |
108 |
if ($TabFinder['categ'] != '') {
|
2 |
jp_milcent |
109 |
$add_to_query = ' AND ('.$tbl['article'].'.B_A_CRAICOLL like "'.$TabFinder['categ'].'%")';
|
30 |
mathias |
110 |
} else {
|
|
|
111 |
$add_to_query = '';
|
2 |
jp_milcent |
112 |
}
|
|
|
113 |
} else {
|
|
|
114 |
// On demande ici les livres et médias
|
|
|
115 |
$add_select = $tbl['media'].'.*, '.$tbl['monnaie'].'.*, ';
|
30 |
mathias |
116 |
// Ajout du FROM
|
2 |
jp_milcent |
117 |
$add_from = $tbl['media'].' LEFT JOIN '.$tbl['str'].' ON B_M_LKSTR = B_S_IDSTR, '.$tbl['monnaie'].', ';
|
30 |
mathias |
118 |
// lien media -- article
|
|
|
119 |
$special_join = ' AND ('.$tbl['media'].'.B_M_IDMEDIA = '.$tbl['item'].'.B_I_IDITEM)';
|
2 |
jp_milcent |
120 |
// lien media -- monnaie
|
|
|
121 |
$special_join .= ' AND ('.$tbl['media'].'.B_M_LKMONNAIE = '.$tbl['monnaie'].'.GEN_MON_IDMONNAIE)';
|
|
|
122 |
//pas de réducteur de catégorie pour les livres
|
|
|
123 |
$add_to_query = '';
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
// Compte Total : comptage du nombre de données de la table
|
|
|
127 |
// d'abord, créer les critères de sélection physiques et logiques.
|
|
|
128 |
if (($TabFinder['categ_3'] == '') || (BB_ARGUMENT_REGROUPEMENT == 'article')) {
|
30 |
mathias |
129 |
if ((!empty($query_dom['log']))) {
|
|
|
130 |
$create_log = $query_dom['log'];
|
|
|
131 |
} else {
|
|
|
132 |
$create_log = '';
|
2 |
jp_milcent |
133 |
}
|
30 |
mathias |
134 |
} else {
|
|
|
135 |
$create_log = 'B_I_TYPLOG = '.$TabFinder['categ_3'];
|
2 |
jp_milcent |
136 |
}
|
|
|
137 |
|
|
|
138 |
if ($TabFinder['categ_2'] == '') {
|
30 |
mathias |
139 |
if ((!empty($query_dom['phy']))) {
|
2 |
jp_milcent |
140 |
$create_phy = $query_dom['phy'];
|
30 |
mathias |
141 |
} else {
|
|
|
142 |
$create_phy = '';
|
2 |
jp_milcent |
143 |
}
|
30 |
mathias |
144 |
} else {
|
|
|
145 |
$create_phy = 'B_I_TYPPHY = '.$TabFinder['categ_2'];
|
2 |
jp_milcent |
146 |
}
|
|
|
147 |
|
|
|
148 |
if (($create_phy != "")&&($create_log != "")) {
|
|
|
149 |
$create_logphy = "$create_log AND $create_phy";
|
|
|
150 |
} else if (($create_phy != "")||($create_log != "")) {
|
|
|
151 |
$create_logphy = "$create_log$create_phy";
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
// Création du corps de la requête
|
|
|
155 |
|
|
|
156 |
// Création du SELECT général
|
|
|
157 |
$normal_query = "SELECT DISTINCT $add_select B_D_ID, B_D_LABEL, B_S_IDSTR, B_S_NOM, B_AS_LIBELLE, ".$tbl['item'].".*, ".$tbl['item_typlog'].".*, ".$tbl['item_typphy'].".* ";
|
|
|
158 |
|
|
|
159 |
// Création du FROM général
|
|
|
160 |
$normal_query .= " FROM $add_from ".$tbl['saisie'].", ".$tbl['item'].", ".$tbl['item_typlog'].", ".$tbl['item_typphy']."$add_from_dom";
|
|
|
161 |
|
|
|
162 |
// Création du WHERE
|
|
|
163 |
$normal_query .= " WHERE $create_logphy ";
|
|
|
164 |
$normal_query .= " AND B_I_CACHER = 0 ";
|
|
|
165 |
|
|
|
166 |
if (($TabFinder['typque'] == 0)&&($TabFinder['chaine'] != "")) {
|
|
|
167 |
// le mode de moteur demandé est : expression exacte
|
|
|
168 |
$normal_query .= " AND (";
|
|
|
169 |
// on vérifie si la chaine est entre crochets
|
|
|
170 |
$check_method = ereg("\[*\]",$TabFinder['chaine']);
|
|
|
171 |
if ($check_method == 1) {
|
|
|
172 |
// si oui, on utilise le FULL TEXT
|
|
|
173 |
$TabFinder['chaine'] = ereg_replace("\[","",$TabFinder['chaine']);
|
|
|
174 |
$TabFinder['chaine'] = ereg_replace("\]","",$TabFinder['chaine']);
|
|
|
175 |
|
|
|
176 |
$normal_query .= "MATCH(B_I_TITRE) against ('".$TabFinder['chaine']."')";
|
|
|
177 |
$normal_query .= " OR MATCH(B_I_RESUMCLE) against ('".$TabFinder['chaine']."')";
|
|
|
178 |
$normal_query .= " OR ".$tbl['item'].".B_I_COMMENT like '%".$TabFinder['chaine']."%'";
|
|
|
179 |
} else {
|
|
|
180 |
// si non, on utilise la methode classique
|
|
|
181 |
$normal_query .= $tbl['item'].".B_I_TITRE like '%".$TabFinder['chaine']."%'";
|
|
|
182 |
$normal_query .= " OR ".$tbl['item'].".B_I_RESUMCLE like '%".$TabFinder['chaine']."%'";
|
|
|
183 |
$normal_query .= " OR ".$tbl['item'].".B_I_COMMENT like '%".$TabFinder['chaine']."%'";
|
|
|
184 |
}
|
|
|
185 |
$normal_query .= ")";
|
|
|
186 |
} else if (($TabFinder['chaine'] != "")&&($TabFinder['typque'] == 1)) {
|
|
|
187 |
// le mode du moteur demandé est : chaque terme
|
|
|
188 |
|
|
|
189 |
$result_from_ex = explode (" ", $TabFinder['chaine']);
|
|
|
190 |
|
|
|
191 |
if (($result_from_ex != "")&&(count($result_from_ex)>=1)) {
|
|
|
192 |
$i_ex = 0;
|
|
|
193 |
|
|
|
194 |
$normal_query .= " AND (";
|
|
|
195 |
while ($i_ex < count($result_from_ex)) {
|
|
|
196 |
// on vérifie si la chaine est entre crochets
|
|
|
197 |
$check_method = ereg("\[*\]",$result_from_ex[$i_ex]);
|
|
|
198 |
|
|
|
199 |
if ($check_method == 1) {
|
|
|
200 |
$result_from_ex[$i_ex] = ereg_replace("\[","",$result_from_ex[$i_ex]);
|
|
|
201 |
$result_from_ex[$i_ex] = ereg_replace("\]","",$result_from_ex[$i_ex]);
|
|
|
202 |
// si oui, on utilise le FULL TEXT
|
|
|
203 |
$normal_query .= "MATCH(B_I_TITRE) against ('";
|
|
|
204 |
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
|
|
|
205 |
$normal_query .= "') OR ";
|
|
|
206 |
|
|
|
207 |
$normal_query .= "MATCH(B_I_RESUMCLE) against ('";
|
|
|
208 |
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
|
|
|
209 |
$normal_query .= "') OR ";
|
|
|
210 |
|
|
|
211 |
$normal_query .= "B_I_COMMENT like '%";
|
|
|
212 |
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
|
|
|
213 |
$normal_query .= "%'";
|
|
|
214 |
|
|
|
215 |
if ($i_ex < (count($result_from_ex)-1)) $normal_query .= ") AND (";
|
|
|
216 |
} else {
|
|
|
217 |
// si non, on procède à une recherche classique
|
|
|
218 |
$normal_query .= $tbl['item'].".B_I_TITRE like '%";
|
|
|
219 |
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
|
|
|
220 |
$normal_query .= "%' OR ";
|
|
|
221 |
$normal_query .= $tbl['item'].".B_I_RESUMCLE like '%";
|
|
|
222 |
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
|
|
|
223 |
$normal_query .= "%' OR ";
|
|
|
224 |
|
|
|
225 |
$normal_query .= $tbl['item'].".B_I_COMMENT like '%";
|
|
|
226 |
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
|
|
|
227 |
$normal_query .= "%'";
|
|
|
228 |
|
|
|
229 |
if ($i_ex < (count($result_from_ex)-1)) $normal_query .= ") AND (";
|
|
|
230 |
}
|
|
|
231 |
|
|
|
232 |
$i_ex++;
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
$normal_query .= ") ";
|
|
|
236 |
}
|
|
|
237 |
}
|
|
|
238 |
|
|
|
239 |
/* ajout, si nécessaire, de la contrainte categ */
|
|
|
240 |
|
|
|
241 |
if (($TabFinder['categ'] != '') && (BB_ARGUMENT_REGROUPEMENT == 'media')) {
|
30 |
mathias |
242 |
if ($TabFinder['categ'] == 'VIDE') {
|
2 |
jp_milcent |
243 |
$normal_query .= ' AND (B_M_EDITEUR is null OR B_M_EDITEUR = "")';
|
30 |
mathias |
244 |
} else {
|
|
|
245 |
$normal_query .= ' AND (B_M_EDITEUR like "%'.$TabFinder['categ'].'%")';
|
2 |
jp_milcent |
246 |
}
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
// Création des jointures
|
|
|
250 |
$normal_query .= " AND (".$tbl['saisie'].".B_AS_ID = ".$tbl['item'].".B_I_AUTEURSAISIE)"; // lien article -- type phy
|
|
|
251 |
$normal_query .= " AND (".$tbl['item'].".B_I_TYPPHY = ".$tbl['item_typphy'].".B_IP_ID)"; // lien article -- type phy
|
|
|
252 |
$normal_query .= " AND (".$tbl['item'].".B_I_TYPLOG = ".$tbl['item_typlog'].".B_IL_ID)"; // lien article -- type log
|
|
|
253 |
$normal_query .= " $add_limit_dom"; // si limitation au domaine principal
|
|
|
254 |
|
|
|
255 |
$normal_query.= $special_join;
|
|
|
256 |
|
|
|
257 |
// Si TabFinder['auteur'] est non vide : on ajoute le critère de sélection
|
|
|
258 |
|
|
|
259 |
if ($TabFinder['auteur'] != '') {
|
|
|
260 |
$tmp_auteur = explode(' ', $TabFinder['auteur']);
|
|
|
261 |
|
|
|
262 |
$normal_query .= ' AND (';
|
|
|
263 |
|
|
|
264 |
for ($tmp=0;$tmp<count($tmp_auteur);$tmp++) {
|
|
|
265 |
$normal_query .= $tbl['item'].'.B_I_AUTEURS like "%'.$tmp_auteur[$tmp].'%"';
|
30 |
mathias |
266 |
if ( $tmp < (count($tmp_auteur) - 1) ) {
|
|
|
267 |
$normal_query .= ' AND ';
|
2 |
jp_milcent |
268 |
}
|
|
|
269 |
}
|
|
|
270 |
$normal_query .= ')';
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
// Si TabFinder['geo'] est non vide :
|
|
|
274 |
// 1- si TabFinder['chaine'] est vide on n'ajoute pas de AND
|
|
|
275 |
// 2- s'il n'est pas vide on ajoute AND
|
|
|
276 |
|
|
|
277 |
if ($TabFinder['geo'] != '') {
|
30 |
mathias |
278 |
if ($TabFinder['geo'] == '1' || $TabFinder['geo'] == '2' || $TabFinder['geo'] == '3' || $TabFinder['geo'] == '4'
|
2 |
jp_milcent |
279 |
|| $TabFinder['geo'] == '5' || $TabFinder['geo'] == '6' || $TabFinder['geo'] == '7' || $TabFinder['geo'] == '8' || $TabFinder['geo'] == '9' ) {
|
|
|
280 |
$TabFinder['geo'] = '0'.$TabFinder['geo'];
|
|
|
281 |
$TabFinder['geo'] = ereg_replace('00', '0', $TabFinder['geo']);
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
$normal_query .= " AND (".$tbl['item'].".B_I_GEO like '%".$TabFinder['geo']."%' ";
|
|
|
285 |
|
|
|
286 |
/* ajout de la jointure dpt */
|
|
|
287 |
|
|
|
288 |
$comp_geo = "select * from ".$tbl['dpt']." where GFD_NAME like '%".$TabFinder['geo']."%'";
|
|
|
289 |
$comp_do = mysql_query($comp_geo) or die("<B>Erreur de requete GEO :</B> $comp_geo.");
|
|
|
290 |
$comp_num = mysql_num_rows($comp_do);
|
|
|
291 |
|
|
|
292 |
if ($comp_num > 0) {
|
|
|
293 |
$i = 1;
|
|
|
294 |
|
|
|
295 |
while ($row = mysql_fetch_object($comp_do)) {
|
|
|
296 |
$tmp_stock = $row->GFD_ID;
|
|
|
297 |
|
|
|
298 |
if ($tmp_stock != '') {
|
30 |
mathias |
299 |
if ($tmp_stock == '1' || $tmp_stock == '2' || $tmp_stock == '3' || $tmp_stock == '4' ||
|
2 |
jp_milcent |
300 |
$tmp_stock == '5' || $tmp_stock == '6' || $tmp_stock == '7' || $tmp_stock == '8' || $tmp_stock == '9' ) {
|
|
|
301 |
$tmp_stock = '0'.$tmp_stock;
|
|
|
302 |
$tmp_stock = ereg_replace('00', '0', $tmp_stock);
|
|
|
303 |
}
|
|
|
304 |
|
30 |
mathias |
305 |
if ($i == 1) {
|
|
|
306 |
$normal_query .= ' OR (';
|
2 |
jp_milcent |
307 |
}
|
|
|
308 |
$normal_query .= $tbl['item'].'.B_I_GEO like "%'.$tmp_stock.'%"';
|
30 |
mathias |
309 |
if ($i < $comp_num) {
|
|
|
310 |
$normal_query .= ' OR ';
|
2 |
jp_milcent |
311 |
}
|
30 |
mathias |
312 |
if ($i == $comp_num) {
|
|
|
313 |
$normal_query .= ') ';
|
2 |
jp_milcent |
314 |
}
|
|
|
315 |
$i++;
|
|
|
316 |
}
|
|
|
317 |
}
|
|
|
318 |
}
|
|
|
319 |
mysql_free_result($comp_do);
|
|
|
320 |
$normal_query .= ') ';
|
|
|
321 |
}
|
|
|
322 |
|
|
|
323 |
// traitement du réducteur SINCE (fonction de la date)
|
|
|
324 |
|
|
|
325 |
if ($TabFinder['since'] != '') {
|
|
|
326 |
$since_var = explode('/', $TabFinder['since']);
|
|
|
327 |
|
30 |
mathias |
328 |
if (empty($since_var[0])) {
|
|
|
329 |
$since_var[0] = '';
|
2 |
jp_milcent |
330 |
}
|
30 |
mathias |
331 |
if (empty($since_var[1])) {
|
|
|
332 |
$since_var[1] = '';
|
2 |
jp_milcent |
333 |
}
|
30 |
mathias |
334 |
if (empty($since_var[2])) {
|
|
|
335 |
$since_var[2] = '';
|
2 |
jp_milcent |
336 |
}
|
|
|
337 |
|
|
|
338 |
$timestamp = mktime (NULL,NULL,NULL,$since_var[1],$since_var[0],$since_var[2]);
|
|
|
339 |
|
|
|
340 |
$normal_query .= ' AND B_I_MAJFICHE > '.$timestamp;
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
// Création de l'ordre de tri
|
|
|
344 |
$order_query = " ORDER BY ".$TabFinder['sort'];
|
|
|
345 |
|
30 |
mathias |
346 |
// Affectation de la requête à la variable qui va l'envoyer au moteur
|
|
|
347 |
if (empty($plugin_store['query_add_query'])) {
|
|
|
348 |
$plugin_store['query_add_query'] = '';
|
2 |
jp_milcent |
349 |
}
|
|
|
350 |
|
|
|
351 |
$unreq = $normal_query.' '.$add_to_query.' '.$plugin_store['query_add_query'].' '.$order_query;
|
|
|
352 |
|
30 |
mathias |
353 |
// Débogage de la requête
|
|
|
354 |
//trigger_error($unreq, E_USER_WARNING);
|
2 |
jp_milcent |
355 |
|
|
|
356 |
return $unreq;
|
30 |
mathias |
357 |
}
|
|
|
358 |
|
|
|
359 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
2 |
jp_milcent |
360 |
*
|
30 |
mathias |
361 |
* $Log: bbc_requete_media.fonct.php,v $
|
|
|
362 |
* Revision 1.3 2004/09/15 10:32:30 jpm
|
|
|
363 |
* Suppression d'une ligne après la balise de fermeture php.
|
|
|
364 |
*
|
|
|
365 |
* Revision 1.2 2004/09/14 10:18:17 jpm
|
|
|
366 |
* Mise en forme et amélioration du code.
|
|
|
367 |
* Passage au XHTML strict.
|
|
|
368 |
*
|
|
|
369 |
* Revision 1.1 2004/09/10 18:44:02 jpm
|
|
|
370 |
* Ajout des fichiers de gestion du moteur de recherche des médias.
|
|
|
371 |
*
|
|
|
372 |
*
|
|
|
373 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
2 |
jp_milcent |
374 |
*/
|
|
|
375 |
?>
|