autosearch fix

This commit is contained in:
SJ 2014-08-12 21:41:55 +02:00
parent 78f120a130
commit 52a35704f1
2 changed files with 14 additions and 5 deletions

View File

@ -110,9 +110,7 @@ Registry::set('load', $loader);
$language = new Language(); $language = new Language();
Registry::set('language', $language); Registry::set('language', $language);
extract($language->data);
$title = $text_automated_search;
if(ENABLE_SYSLOG == 1) { openlog("piler-automated-search", LOG_PID, LOG_MAIL); } if(ENABLE_SYSLOG == 1) { openlog("piler-automated-search", LOG_PID, LOG_MAIL); }
@ -187,6 +185,7 @@ if($auto_search == 1)
} }
} }
else { else {
$data['id'] = '';
do_search($data, $automated_search_recipients); do_search($data, $automated_search_recipients);
} }
@ -195,7 +194,16 @@ function do_search($data = array(), $automated_search_recipients = array())
global $options; global $options;
global $dry_run; global $dry_run;
global $webuidir; global $webuidir;
global $title; global $search_expression;
global $page_len;
$lang = Registry::get('language');
extract($lang->data);
$page = 0;
$title = $text_automated_search;
if($data['id'] != '') { $title .= $data['id']; }
$search = new ModelSearchSearch(); $search = new ModelSearchSearch();
$mail = new ModelMailMail(); $mail = new ModelMailMail();
@ -213,7 +221,8 @@ function do_search($data = array(), $automated_search_recipients = array())
{ {
$msg = "From: " . SMTP_FROMADDR . EOL; $msg = "From: " . SMTP_FROMADDR . EOL;
$msg .= "To: " . ADMIN_EMAIL . EOL; $msg .= "To: " . ADMIN_EMAIL . EOL;
$msg .= "Subject: =?UTF-8?Q?" . preg_replace("/\n/", "", my_qp_encode($title . " " . $data['id'])) . "?=" . EOL; $msg .= "Date: " . date(DATE_RFC2822) . EOL;
$msg .= "Subject: =?UTF-8?Q?" . preg_replace("/\n/", "", my_qp_encode($title)) . "?=" . EOL;
$msg .= "Message-ID: <" . generate_random_string(25) . '@' . SITE_NAME . ">" . EOL; $msg .= "Message-ID: <" . generate_random_string(25) . '@' . SITE_NAME . ">" . EOL;
$msg .= "MIME-Version: 1.0" . EOL; $msg .= "MIME-Version: 1.0" . EOL;
$msg .= "Content-Type: text/html; charset=\"utf-8\"" . EOL; $msg .= "Content-Type: text/html; charset=\"utf-8\"" . EOL;

View File

@ -12,7 +12,7 @@
<body> <body>
<p style="font-weight: bold; font-size: 18px;"><?php print $text_search_expression; ?>: <?php print $search_expression; ?><br /> <p style="font-weight: bold; font-size: 18px;"><?php print $text_search_expression; ?>: <?php print $search_expression; ?><br />
<?php print $text_date; ?>: <?php print $a['date1']; ?></p> <?php if($a['date1']) { print $text_date; ?>: <?php print $a['date1']; } ?></p>
<?php if($n > 0) { ?> <?php if($n > 0) { ?>
<table id="results" class="table table-striped table-condensed"> <table id="results" class="table table-striped table-condensed">