Subversion Repositories Applications.papyrus

Rev

Rev 2131 | Rev 2140 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2131 Rev 2133
Line 231... Line 231...
231
}
231
}
Line 232... Line 232...
232
 
232
 
233
function sphinx_search($q = NULL, $page = 1) {
233
function sphinx_search($q = NULL, $page = 1) {
Line -... Line 234...
-
 
234
	if(!$q) return array();
-
 
235
 
-
 
236
	// quelques aliases pour faciliter l'usage sans passer par le full sphinxQL
-
 
237
	// $q = preg_replace('/\<actu\>(.*)/', '\1 @group_id i_spip', $q);
234
	if(!$q) return array();
238
	// $q = preg_replace('/\<eflore\>(.*)/', '\1 @group_id i_bazar|i_coste', $q);
-
 
239
 
-
 
240
	$db = mysql_connect(SPHINX_DSN, NULL, NULL, TRUE);
235
 
241
	// AFAICT, pas de réel risque de SQL-injection du côté de sphinx (au pire, $req = FALSE)
-
 
242
	// et il serait dommage de devoir limiter la puissante syntaxe offerte à l'utilisation
Line 236... Line 243...
236
	$db = mysql_connect(SPHINX_DSN, NULL, NULL, TRUE);
243
	$req = mysql_query(sprintf("SELECT group_id, main_id FROM i_projet, i_spip, i_papyrus, i_bazar, i_coste, i_nvjfl WHERE MATCH('%s') LIMIT 50", $q), $db);
237
	$req = mysql_query(sprintf("SELECT group_id, main_id FROM i_projet, i_spip, i_papyrus, i_bazar, i_coste, i_nvjfl WHERE MATCH('%s') LIMIT 50", $q), $db);
244
	if(!$req) return array();
238
 
245
 
239
	$res = array('spip' => array(), 'bazar' => array(), 'projet' => array(), 'papyrus' => array(), 'coste' => array(), 'nvjfl' => array());
246
	$res = array('spip' => array(), 'bazar' => array(), 'projet' => array(), 'papyrus' => array(), 'coste' => array(), 'nvjfl' => array());