2 function smarty_function_get_search($params,&$smarty) {
4 $string=escapeshellarg($params['query']);
5 $output=`/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f /storage/data/index.swish-e -w node_name=($string) or node_content=($string)`;
6 // $output2=`/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f /storage/data/index.swish-e -w '$string'`;
7 // echo "/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f /storage/data/index.swish-e -w $string";
8 // $output=$output1.$output2;
9 $output=str_replace($params['query'],"<span class='most_important'>".$params['query']."</span>",$output);
10 preg_match_all("/:::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?)\n/i",$output,$matches);
11 foreach($matches[0] as $key => $value) {
12 preg_match("/(.*?)\.xml/i",$matches[2][$key],$ids);
14 echo "<a href='/id/".$id."'>".$matches[4][$key]."</a> (".$matches[6][$key].")<br>";
15 echo $matches[7][$key]."<br><br>";
16 //echo $matches[5][$key]."<br><br>";
22 $q = "SELECT * FROM nodes WHERE node_system_access!='private' AND template_id=3 AND node_name LIKE '%".
23 str_replace(array("%", "_"), array('\%', '\_'), addslashes($params['query']))."%'";
26 $rec = $set->getRecord();
27 echo "<a href='/id/{$rec[node_id]}'>{$rec[node_name]}</a><br>";
31 if (is_numeric($params['offset'])) $offset=$params['offset'];
34 if (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount'];
35 else $listing_amount=32;
36 $query=Addslashes($params['query']);
37 $q="select * from nodes left join users on users.user_id=nodes.node_creator where node_name like '$query%'";
39 while ($set->next()) {
40 $array[]=$set->getRecord();
42 $smarty->assign('get_search_short',$array);
44 $q="select users.login as login,nodes.*,node_content,match (node_content) against ('$query') as
45 probability from node_content left join users on users.user_id=nodes.node_creator
46 left join nodes on node_content.node_id=nodes.node_id where node_system_access!='private' and match (node_content) against ('$query') order by k desc limit $offset,$listing_amount";
49 while ($set->next()) {
50 $search[]=$set->getRecord();
52 $smarty->assign('get_search',$search);
This page took 0.282204 seconds and 4 git commands to generate.