30if (!defined(
'NOCSRFCHECK')) {
31 define(
'NOCSRFCHECK', 1);
33if (!defined(
'NOTOKENRENEWAL')) {
34 define(
'NOTOKENRENEWAL', 1);
37if (!defined(
'NOREQUIREMENU')) {
38 define(
'NOREQUIREMENU', 1);
42require_once
'../main.inc.php';
45 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
48$langs->loadLangs(array(
"main",
"other"));
50$action =
GETPOST(
'action',
'aZ09');
60if ($action ==
'redirect') {
61 global $dolibarr_main_url_root;
69 $tmpurlrootwithouthttp = preg_replace(
'/^http(s?):\/\//i',
'', DOL_MAIN_URL_ROOT);
73 $url = preg_replace(
'/'.preg_quote($dolibarr_main_url_root,
'/').
'/',
'', $url);
74 $url = preg_replace(
'/'.preg_quote(DOL_MAIN_URL_ROOT,
'/').
'/',
'', $url);
75 $url = preg_replace(
'/'.preg_quote($tmpurlrootwithouthttp,
'/').
'/',
'', $url);
76 $urlrelativeforredirect = (DOL_URL_ROOT.(preg_match(
'/\//', $url) ?
'' :
'/').$url);
80 dol_syslog(
"Ask search form to redirect on URL: ".$urlrelativeforredirect);
81 header(
"Location: ".$urlrelativeforredirect);
91if (empty($dolibarr_nocache) &&
GETPOST(
'cache',
'int')) {
92 header(
'Cache-Control: max-age='.
GETPOST(
'cache',
'int').
', public');
94 header(
'Expires: '.gmdate(
'D, d M Y H:i:s',
dol_now(
'gmt') +
GETPOST(
'cache',
'int')).
' GMT');
96 header(
'Pragma: token=public');
99 header(
'Cache-Control: no-cache');
102$title = $langs->trans(
"Search");
105$head =
'<!-- Quick access -->'.
"\n";
107$arrayofcss = array();
108top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
119$hookmanager->initHooks(array(
'searchform'));
124if ($conf->use_javascript_ajax && 1 == 2) {
125 if (!is_object($form)) {
126 $form =
new Form($db);
129 $searchform .=
'<br><br>'.$form->selectArrayAjax(
'searchselectcombo', DOL_URL_ROOT.
'/core/ajax/selectsearchbox.php', $selected,
'',
'', 0, 1,
'minwidth300', 1, $langs->trans(
"Search"), 0);
132 $showtitlebefore =
GETPOST(
'showtitlebefore',
'int');
133 $arrayresult = array();
134 include DOL_DOCUMENT_ROOT.
'/core/ajax/selectsearchbox.php';
137 $accesskeyalreadyassigned = array();
138 foreach ($arrayresult as $key => $val) {
139 $tmp = explode(
'?', $val[
'url']);
140 $urlaction = $tmp[0];
141 $keysearch =
'search_all';
144 if (empty($accesskeyalreadyassigned[$val[
'label'][0]])) {
145 $accesskey = $val[
'label'][0];
146 $accesskeyalreadyassigned[$accesskey] = $accesskey;
149 $searchform .=
printSearchForm($urlaction, $urlaction, $val[
'label'],
'minwidth200', $keysearch, $accesskey, $key, $val[
'img'], $showtitlebefore, ($i > 0 ? 0 : 1));
157$parameters = array(
'searchform'=>$searchform);
158$reshook = $hookmanager->executeHooks(
'printSearchForm', $parameters);
159if (empty($reshook)) {
160 $searchform .= $hookmanager->resPrint;
162 $searchform = $hookmanager->resPrint;
165$searchform .=
'<br>';
169$ret .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" class="searchform nowraponall tagtr">';
170$ret .=
'<input type="hidden" name="token" value="'.newToken().
'">';
171$ret .=
'<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).
'">';
172$ret .=
'<input type="hidden" name="action" value="redirect">';
173$ret .=
'<div class="tagtd">';
174$ret .=
img_picto(
'',
'url',
'',
false, 0, 0,
'',
'paddingright width20');
175$ret .=
'<input type="text" class="flat minwidth200"';
176$ret .=
' style="background-repeat: no-repeat; background-position: 3px;"';
177$ret .=
' placeholder="'.strip_tags($langs->trans(
"OrPasteAnURL")).
'"';
178$ret .=
' name="url" id="url" />';
179$ret .=
'<button type="submit" class="button bordertransp" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
180$ret .=
'<span class="fa fa-search"></span>';
190print
"<!-- Begin SearchForm -->\n";
191print
'<div class="center"><div class="center" style="padding: 6px;">';
192print
'<style>.menu_titre { padding-top: 7px; }</style>';
193print
'<div id="blockvmenusearch" class="tagtable center searchpage">'.
"\n";
197print
"\n<!-- End SearchForm -->\n";
201print
'</body></html>'.
"\n";
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sanitizeUrl($stringtoclean, $type=1)
Clean a string to use it as an URL (into a href or src attribute)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='', $img='', $showtitlebefore=0, $autofocus=0)
Show a search area.