Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
fullsearch.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Full Text Search document
8  *
9  * @author Anakeen
10  * @version $Id: fullsearch.php,v 1.10 2008/01/04 17:56:37 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.SearchDoc.php");
18 include_once ("FDL/Class.DocSearch.php");
19 
20 include_once ("FDL/freedom_util.php");
21 /**
22  * Fulltext Search document
23  * @param Action &$action current action
24  * @global keyword string Http var : word to search in any values
25  * @global famid int Http var : restrict to this family identioficator
26  * @global start int Http var : page number
27  * @global dirid int Http var : search identifier
28  */
30 {
31 
32  $dbaccess = $action->dbaccess;
33  $famid = GetHttpVars("famid", 0);
34  $keyword = GetHttpVars("_se_key", GetHttpVars("keyword")); // keyword to search
35  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/DHTMLapi.js");
36  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/AnchorPosition.js");
37  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/geometry.js");
38  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/resizeimg.js");
39  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/subwindow.js");
40  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FGSEARCH/Layout/fullsearch.js");
41  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/lib/jquery/jquery.js", false);
42  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FREEDOM/Layout/editdsearch.js");
43  $action->parent->AddJsRef($action->GetParam("CORE_STANDURL") . "app=FDL&action=EDITJS");
44  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FDL/Layout/edittable.js");
45  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FGSEARCH/Layout/fulleditdsearch.js");
46 
47  $action->parent->AddCssRef("FGSEARCH:fullsearch.css", true);
48 
49  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/resizeimg.js");
50 
51  $action->lay->eset("key", $keyword);
52  $action->lay->set("searchWords", $action->getParam("FGSEARCH_SEARCHMODE", "words") === "words");
53  if (!is_numeric($famid)) $famid = getFamIdFromName($dbaccess, $famid);
54 
55  createSearchEngine($action);
56  /* $bfam = array(); */
57  $tclassdoc = getNonSystemFamilies($dbaccess, $action->user->id, "TABLE");
58  $selectclass = array();
59  foreach ($tclassdoc as $k => $cdoc) {
60  $selectclass[$k]["idcdoc"] = $cdoc["initid"];
61  $selectclass[$k]["classname"] = $cdoc["title"];
62  $selectclass[$k]["famselect"] = ($cdoc["initid"] == $famid) ? "selected" : "";
63  }
64  $action->lay->SetBlockData("SELECTCLASS", $selectclass);
65  $action->lay->set("searchtitle", _("General search"));
66  $action->lay->set("guideKeyword", _("search dynacase documents"));
67  $action->lay->set("initKeyword", ($keyword == "" ? true : false));
68 }
69 
71 {
72  global $_SERVER;
73  $tfiles = array(
74  "freedom-os.xml",
75  "freedom.src",
76  "freedom.gif",
77  "freedom.xml"
78  );
79  $script = $_SERVER["SCRIPT_FILENAME"];
80  $dirname = dirname($script);
81  $base = dirname($_SERVER["SCRIPT_NAME"]);
82  $host = $_SERVER["HTTP_HOST"];
83  $action->lay->set("HOST", $host);
84  $newpath = $host . $base;
85  foreach ($tfiles as $k => $v) {
86  $out = $dirname . "/var/cache/image/" . $host . "-" . $v;
87  if (!file_exists($out)) {
88  $src = "$dirname/moz-searchplugin/$v";
89  if (file_exists($src)) {
90  $content = file_get_contents($src);
91  $destsrc = str_replace(array(
92  "localhost/freedom",
93  "SearchTitle",
94  "orifile"
95  ) , array(
96  $newpath,
97  $action->getParam("CORE_CLIENT") ,
98  $host . "-" . $v
99  ) , $content);
100  file_put_contents($out, $destsrc);
101  }
102  }
103  }
104 }
fullsearch(Action &$action)
Definition: fullsearch.php:29
global $action
getNonSystemFamilies($dbaccess, $userid, $qtype="TABLE")
Definition: Lib.Dir.php:952
$dirname
Definition: vault_init.php:25
createSearchEngine(Action &$action)
Definition: fullsearch.php:70
getFamIdFromName($dbaccess, $name)
global $_SERVER
getParam($name, $def="")
$keyword
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen