-
Notifications
You must be signed in to change notification settings - Fork 0
/
videos-search.php
84 lines (67 loc) · 2.24 KB
/
videos-search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
$q=$_REQUEST['input'];
if (empty($q)) {
print("No Result Found");
exit();
}
if($_SERVER['HTTP_HOST']=='localhost')
{
include 'C:\sphinx2210\api\sphinxapi.php';
}
else if($_SERVER['HTTP_HOST']=='MYSERVER.com')
{
include '/etc/sphinx/sphinxapi.php';
}
else
{
include '/etc/sphinx/sphinxapi.php';
}
// Build search query
$cl2 = new SphinxClient();
if($_SERVER['HTTP_HOST']=='localhost')
{
$cl2->SetServer( "localhost", 3312 );
}
else
{
$cl2->SetServer( "localhost", 9312 );
}
$cl2->SetLimits(0, 250);
$cl2->SetMatchMode( SPH_MATCH_EXTENDED );
$cl2->SetRankingMode ( SPH_RANK_SPH04 );
// Execute the query
$q2 = '"' . $cl2->EscapeString($_REQUEST['input']) . '"/1';
if($_REQUEST['lang_name']=='en')
$indexer_name = 'drupal_videos_search';
else
$indexer_name = 'drupal_videos_search_arabic';
$searchresults2 = $cl2->Query($q2, $indexer_name);
if (!isset($searchresults2["matches"]) ) {
print("No Result Found");
exit();
}
$prot = $_SERVER['HTTP_HOST'];
$path_val=$_REQUEST['path_base'];
$protocol_val = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
$arrVideo = array();
foreach($searchresults2["matches"] as $match2)
{
$entry2 = array("title_video" => "", "description_video" => "", "link_video" => "", "thumbnail_video" => "");
if(isset($match2["attrs"]))
{
$entry2["description_video"] = (isset($match2["attrs"]["description"]) ? $match2["attrs"]["description"] : "");
$entry2["link_video"] = (isset($match2["attrs"]) ? $match2["attrs"]["link"]: "");
$entry2["title_video"] = (isset($match2["attrs"]["title"]) ? $match2["attrs"]["title"] : "");
$entry2["thumbnail_video"] = (isset($match2["attrs"]["thumbnail_path"]) ? $match2["attrs"]["thumbnail_path"] : "");
echo "<div class='single-video-result'>
<a onclick='videoIframe(this)' src='$entry2[link_video]' target=_blank >
<img src='$entry2[thumbnail_video]' width=50px height=50px > <p>".$entry2["title_video"]."</p></a></div>";
// print($entry2["link_video"]) ;
}
$arrTitleAndBundle2[] = $entry2;
}
echo '<div id="videoIframe" class="search-modal">
<span class="close searchclose" id="searchclose"><i class="icon-close"></i></span>
<div id="iframe"></div>
</div>' ;
?>