-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetfiltercontent.php
More file actions
executable file
·84 lines (57 loc) · 2.66 KB
/
getfiltercontent.php
File metadata and controls
executable file
·84 lines (57 loc) · 2.66 KB
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
require_once('getfiltercontenthelper.php');
$i = 0;
if ($throwOrHTMLF != "Fulltext"){
if (count($assertionResultArray) > 0)
generateDecks($assertionResultArrayUnique, count($assertionResultArrayUnique));
}else{
if ($keywordsearch != ""){
$PDFArray = array();
$sourceArray = array();
$searchdatasource = "SELECT data_source . * , data_author.first_name, data_author.last_name FROM data_source
LEFT JOIN data_author ON data_source.author_id = data_author.id";
$resultdatasource = mysql_query($searchdatasource);
while ($resultdatarow = mysql_fetch_object($resultdatasource)){
$sourceArray[$resultdatarow->text_id] = "<B>Title:</B> " . $resultdatarow->short_title . "<BR>". "<B>Author:</B> " . $resultdatarow->first_name . " " . $resultdatarow->last_name . "<BR>";
}
$keywordsearchSplitted = split('"', stripslashes(strtolower($keywordsearch)));
$keyWordClause = "";
for ($i = 0; $i < count($keywordsearchSplitted); $i++)
if ($i % 2){
$trimmedkeyword = trim($keywordsearchSplitted[$i]);
if ($trimmedkeyword != ""){
$keyWordClause .= ($keyWordClause == "")? "": "OR";
$keyWordClause .= "(textlookuplines.textline like '%$trimmedkeyword%')";
}
}else{
$trimmedsplitkeyword = split(" ", $keywordsearchSplitted[$i]);
for ($j = 0; $j < count($trimmedsplitkeyword); $j++){
$trimmedkeyword = trim($trimmedsplitkeyword[$j]);
if ($trimmedkeyword != ""){
$keyWordClause .= ($keyWordClause == "")? "": "OR";
$keyWordClause .= "(textlookuplines.textline like '%$trimmedkeyword%')";
}
}
}
$newKeywordSearchQuery = " SELECT textlookup.filename , selectedLines.textline FROM textlookup,
(SELECT textline, lineID
FROM textlookuplines
WHERE ($keyWordClause)) as selectedLines
WHERE textlookup.lineID = selectedLines.lineID
GROUP BY textlookup.lineID";
$textSearchResult = mysql_query($newKeywordSearchQuery);
$i = 0;
while ($textSearchRow = mysql_fetch_object($textSearchResult)){
if (isset($sourceArray[substr($textSearchRow->filename, 0, 6) . ".xml"]))
$authorTitleText = $sourceArray[substr($textSearchRow->filename, 0, 6) . ".xml"];
else
$authorTitleText = "";
$PDFArray[$i++] = array('File' => ($textSearchRow->filename), 'Text' => ($textSearchRow->textline), 'AuthorTitle' => $authorTitleText) ;
}
}
if ($i != 0)
generatePDFs($PDFArray, count($PDFArray));
}
if ($i == 0 && (count($assertionResultArray) < 2))
echo "<BR><H1>No results!</H1><BR>There is no record in our database that fulfills all speficied constraints.<BR>Please try a different combination.";
?>