20 include_once
"search-helper.php";
27 protected $MaxPerPage = 100;
31 function __construct()
33 $this->Name =
"search";
34 $this->Title = _(
"Search");
35 $this->MenuList =
"Search";
36 $this->MenuOrder = 90;
37 $this->Dependency = array(
"browse");
40 parent::__construct();
42 $this->uploadDao = $GLOBALS[
'container']->get(
'dao.upload');
45 function PostInitialize()
47 $this->
State = PLUGIN_STATE_READY;
56 menu_insert(
"Main::" . $this->MenuList,$this->MenuOrder,$this->Name,$this->MenuTarget);
65 menu_insert(
"Browse::Search", 1, $URI, $this->MenuList);
80 $Count = count($UploadtreeRecs);
82 $Outbuf .= _(
"No matching files.\n");
85 if (($Page > 0) || ($Count >= $this->MaxPerPage)) {
87 $PageChoices =
MenuEndlessPage($Page, ($Count >= $this->MaxPerPage), $Uri) .
89 $Outbuf .= $PageChoices;
93 $Outbuf .=
UploadtreeFileList($UploadtreeRecs,
"browse",
"view",$Page*$this->MaxPerPage + 1);
96 $Outbuf .= $PageChoices;
108 if ($this->
State != PLUGIN_STATE_READY) {
111 if ($this->OutputType !=
'HTML') {
122 $this->vars[
'pathOfItem'] =
Dir2Browse($this->Name, $Item, NULL, 1, NULL) .
124 $GETvars .=
"&item=$Item";
128 $GETvars .=
"&searchtype=" . urlencode($searchtype);
129 if ($searchtype ==
'containers') {
130 $this->vars[
"ContainersChecked"] =
"checked=\"checked\"";
131 }
else if ($searchtype ==
'directory') {
132 $this->vars[
"DirectoryChecked"] =
"checked=\"checked\"";
134 $this->vars[
"AllFilesChecked"] =
"checked=\"checked\"";
138 if (! empty($Filename)) {
140 $GETvars .=
"&filename=" . urlencode($Filename);
141 $this->vars[
"Filename"] = $Filename;
147 $GETvars .=
"&tag=" . urlencode($tag);
148 $this->vars[
"tag"] = $tag;
152 if (! empty($SizeMin) && is_numeric($SizeMin) && ($SizeMin >= 0)) {
153 $SizeMin = intval($SizeMin);
155 $GETvars .=
"&sizemin=$SizeMin";
156 $this->vars[
"SizeMin"] = $SizeMin;
160 if (! empty($SizeMax) && is_numeric($SizeMax) && ($SizeMax >= 0)) {
161 $SizeMax = intval($SizeMax);
163 $GETvars .=
"&sizemax=$SizeMax";
164 $this->vars[
"SizeMax"] = $SizeMax;
168 if (! empty($License)) {
170 $GETvars .=
"&license=" . urlencode($License);
171 $this->vars[
"License"] = $License;
175 if (! empty($Copyright)) {
177 $GETvars .=
"©right=" . urlencode($Copyright);
178 $this->vars[
"Copyright"] = $Copyright;
183 $this->vars[
"postUrl"] =
Traceback_uri() .
"?mod=" . self::getName();
185 if ($CriteriaCount) {
189 $UploadtreeRecsResult = GetResults($Item, $Filename, $tag, $Page, $SizeMin,
190 $SizeMax, $searchtype, $License, $Copyright, $this->uploadDao,
191 Auth::getGroupId(), $PG_CONN);
194 "The indented search results are same files in different folders");
195 $html .=
"<H4>$message</H4>\n";
196 $text = $UploadtreeRecsResult[1] .
" " . _(
"Files matching");
197 $html .=
"<H2>$text " . htmlentities($Filename) .
"</H2>\n";
198 $html .= $this->
HTMLResults($UploadtreeRecsResult[0], $Page, $GETvars,
199 $License, $Copyright);
200 $this->vars[
"result"] = $html;
204 public function getTemplateName()
206 return "ui-search.html.twig";
211 $NewPlugin->Initialize();
Dir2Browse($Mod, $UploadtreePk, $LinkLast=NULL, $ShowBox=1, $ShowMicro=NULL, $Enumerate=-1, $PreText='', $PostText='', $uploadtree_tablename="uploadtree")
Get an html linked string of a file browse path.
Traceback_uri()
Get the URI without query to this location.
UploadtreeFileList($Listing, $IfDirPlugin, $IfFilePlugin, $Count=-1, $ShowPhrase=0)
Given an array of pfiles/uploadtree, sorted by pfile, list all of the breadcrumbs for each file...
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
HTMLResults($UploadtreeRecs, $Page, $GETvars)
print search results to stdout
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Output()
Display the loaded menu and plugins.
This is the Plugin class. All plugins should:
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
Traceback_parm_keep($List)
Create a new URI, keeping only these items.
RegisterMenus()
Customize submenus.