automated search fix

This commit is contained in:
SJ 2014-01-26 22:25:02 +01:00
parent c124e0b4dd
commit 394b771a13

View File

@ -2,7 +2,6 @@
$webuidir = ""; $webuidir = "";
$search_expression = ""; $search_expression = "";
$title = "automated search";
$page = 0; $page = 0;
$sort = "date"; $sort = "date";
@ -113,6 +112,8 @@ Registry::set('language', $language);
extract($language->data); 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); }
@ -158,6 +159,7 @@ Registry::set('import_status', $import_status);
$data = array( $data = array(
'page' => 0, 'page' => 0,
'id' => 0,
'sort' => $sort, 'sort' => $sort,
'order' => $order, 'order' => $order,
'type' => 'search', 'type' => 'search',
@ -179,6 +181,7 @@ if($auto_search == 1)
foreach ($queries as $query) { foreach ($queries as $query) {
$data['search'] = $query['query']; $data['search'] = $query['query'];
$data['id'] = $query['id'];
do_search($data, $automated_search_recipients); do_search($data, $automated_search_recipients);
} }
@ -192,6 +195,7 @@ 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;
$search = new ModelSearchSearch(); $search = new ModelSearchSearch();
$mail = new ModelMailMail(); $mail = new ModelMailMail();
@ -209,7 +213,7 @@ 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)) . "?=" . EOL; $msg .= "Subject: =?UTF-8?Q?" . preg_replace("/\n/", "", my_qp_encode($title . " " . $data['id'])) . "?=" . 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;