Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_search.php
CommitLineData
e586807d 1<?php
b42b2bf9
H
2function smarty_function_get_search($params,&$smarty) {
3/*
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
6/storage/data/index.swish-e -w node_name=($string) or node_content=($string)`;
7//$output2=`/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f
8/storage/data/index.swish-e -w '$string'`;
9//echo "/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f
10/storage/data/index.swish-e -w $string";
11//$output=$output1.$output2;
12$output=str_replace($params['query'],"<span
13class='most_important'>".$params['query']."</span>",$output);
14preg_match_all("/:::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?)n/i",$output,$matches);
15foreach($matches[0] as $key => $value) {
16preg_match("/(.*?).xml/i",$matches[2][$key],$ids);
17$id=$ids[1];
18echo "<a href='/id/".$id."'>".$matches[4][$key]."</a>
19(".$matches[6][$key].")<br>";
20echo $matches[7][$key]."<br><br>";
21//echo $matches[5][$key]."<br><br>";
22}
23
24
25global $db, $node;
26
27$q = "SELECT * FROM nodes WHERE node_system_access!='private' AND template_id=3 AND node_name LIKE
28'%".
29str_replace(array("%", "_"), array('%', '_'),
30addslashes($params['query']))."%'";
31$set=$db->query($q);
32while($set->next()) {
33$rec = $set->getRecord();
34echo "<a href='/id/{$rec[node_id]}'>{$rec[node_name]}</a><br>";
35}
e586807d 36*/
b42b2bf9
H
37global $db, $node;
38if (is_numeric($params['offset'])) $offset = $params['offset'];
39else $offset = 0;
40
41if (is_numeric($params['listing_amount'])) $listing_amount = $params['listing_amount'];
42else $listing_amount = 32;
43$query = addslashes($params['query']);
44$q = "select users.login, nodes.* from nodes left join users on
45 users.user_id = nodes.node_creator where node_name like '$query%'";
46$set = $db->query($q);
47while ($set->next()) {
48 $array[] = $set->getRecord();
49}
50$smarty->assign('get_search_short',$array);
51
52if ($_POST['orderby'] != ("k" || "node_created" || "probability" ||
53"node_views")) $orderby = "k";
54else $orderby=$_POST['orderby'];
55
56$q = "select users.login as login, users.*, nodes.*, nodes.node_creator,
57 nodes.node_content, match (node_content.node_content) against ('$query') as
58 probability from node_content left join users on node_content.node_id = users.user_id
59 left join nodes on node_content.node_id = nodes.node_id where
60 node_system_access!='private' and match (node_content.node_content)
61 against ('$query') order by $orderby desc limit $offset,$listing_amount";
62
63$set = $db->query($q);
64while ($set->next()) {
65 $search[] = $set->getRecord();
66}
e586807d 67
b42b2bf9 68$smarty->assign('get_search',$search);
e586807d
H
69}
70?>
This page took 0.190539 seconds and 4 git commands to generate.