X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fsmarty%2Fnode_methodz%2Ffunction.get_search.php;h=8df3d241ba3f79d74488f2e36020af6899e9d83e;hb=673e23209e2e3b9782c037e70156a1a20154a5b9;hp=cf6ee1ede2f870180b953321130d952553232364;hpb=e586807dafc64c3fe152ab518599e6cf3f0f84e1;p=mirrors%2FKyberia-bloodline.git
diff --git a/inc/smarty/node_methodz/function.get_search.php b/inc/smarty/node_methodz/function.get_search.php
index cf6ee1e..8df3d24 100644
--- a/inc/smarty/node_methodz/function.get_search.php
+++ b/inc/smarty/node_methodz/function.get_search.php
@@ -1,55 +1,70 @@
".$params['query']."",$output);
- preg_match_all("/:::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?)\n/i",$output,$matches);
- foreach($matches[0] as $key => $value) {
- preg_match("/(.*?)\.xml/i",$matches[2][$key],$ids);
- $id=$ids[1];
- echo "".$matches[4][$key]." (".$matches[6][$key].")
";
- echo $matches[7][$key]."
";
- //echo $matches[5][$key]."
";
- }
-
-
- global $db, $node;
-
- $q = "SELECT * FROM nodes WHERE node_system_access!='private' AND template_id=3 AND node_name LIKE '%".
- str_replace(array("%", "_"), array('\%', '\_'), addslashes($params['query']))."%'";
- $set=$db->query($q);
- while($set->next()) {
- $rec = $set->getRecord();
- echo "{$rec[node_name]}
";
- }
+function smarty_function_get_search($params,&$smarty) {
+/*
+$string=escapeshellarg($params['query']);
+$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)`;
+//$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'`;
+//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";
+//$output=$output1.$output2;
+$output=str_replace($params['query'],"".$params['query']."",$output);
+preg_match_all("/:::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?)n/i",$output,$matches);
+foreach($matches[0] as $key => $value) {
+preg_match("/(.*?).xml/i",$matches[2][$key],$ids);
+$id=$ids[1];
+echo "".$matches[4][$key]."
+(".$matches[6][$key].")
";
+echo $matches[7][$key]."
";
+//echo $matches[5][$key]."
";
+}
+
+
+global $db, $node;
+
+$q = "SELECT * FROM nodes WHERE node_system_access!='private' AND template_id=3 AND node_name LIKE
+'%".
+str_replace(array("%", "_"), array('%', '_'),
+addslashes($params['query']))."%'";
+$set=$db->query($q);
+while($set->next()) {
+$rec = $set->getRecord();
+echo "{$rec[node_name]}
";
+}
*/
- global $db,$node;
- if (is_numeric($params['offset'])) $offset=$params['offset'];
- else $offset=0;
-
- if (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount'];
- else $listing_amount=32;
- $query=Addslashes($params['query']);
- $q="select * from nodes left join users on users.user_id=nodes.node_creator where node_name like '$query%'";
- $set=$db->query($q);
- while ($set->next()) {
- $array[]=$set->getRecord();
- }
- $smarty->assign('get_search_short',$array);
-
- $q="select users.login as login,nodes.*,node_content,match (node_content) against ('$query') as
-probability from node_content left join users on users.user_id=nodes.node_creator
-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";
-
- $set=$db->query($q);
- while ($set->next()) {
- $search[]=$set->getRecord();
- }
- $smarty->assign('get_search',$search);
+global $db, $node;
+if (is_numeric($params['offset'])) $offset = $params['offset'];
+else $offset = 0;
+
+if (is_numeric($params['listing_amount'])) $listing_amount = $params['listing_amount'];
+else $listing_amount = 32;
+$query = addslashes($params['query']);
+$q = "select users.login, nodes.* from nodes left join users on
+ users.user_id = nodes.node_creator where node_name like '$query%'";
+$set = $db->query($q);
+while ($set->next()) {
+ $array[] = $set->getRecord();
+}
+$smarty->assign('get_search_short',$array);
+
+if ($_POST['orderby'] != ("k" || "node_created" || "probability" ||
+"node_views")) $orderby = "k";
+else $orderby=$_POST['orderby'];
+
+$q = "select users.login as login, users.*, nodes.*, nodes.node_creator,
+ nodes.node_content, match (node_content.node_content) against ('$query') as
+ probability from node_content left join users on node_content.node_id = users.user_id
+ left join nodes on node_content.node_id = nodes.node_id where
+ node_system_access!='private' and match (node_content.node_content)
+ against ('$query') order by $orderby desc limit $offset,$listing_amount";
+
+$set = $db->query($q);
+while ($set->next()) {
+ $search[] = $set->getRecord();
+}
+$smarty->assign('get_search',$search);
}
?>
\ No newline at end of file