Commit 98ceb46d authored by sampaioprimo's avatar sampaioprimo

tiki-user_reports_send.php works without previous configuration

parent e8196e86
......@@ -9,7 +9,7 @@ class reportsLib extends TikiLib
{
//Sends the Email
public function sendEmail($user_data, $report_preferences, $report_cache, $tikiUrl) {
public function sendEmail($user_data, $report_preferences, $report_cache) {
global $prefs, $smarty, $tikilib;
include_once('lib/webmail/tikimaillib.php');
......@@ -26,7 +26,7 @@ class reportsLib extends TikiLib
$smarty->assign('mail_contributions', $contributionlib->print_contributions($contributions));
}
$smarty->assign('report_body', $this->makeHtmlEmailBody($report_cache, $report_preferences, $tikiUrl));
$smarty->assign('report_body', $this->makeHtmlEmailBody($report_cache, $report_preferences));
$mail->setUser($user_data['login']);
if (is_array($report_cache)) {
......@@ -78,8 +78,11 @@ class reportsLib extends TikiLib
return $change_array;
}
public function makeHtmlEmailBody($report_cache, $report_preferences, $tikiUrl) {
global $tikilib, $userlib;
public function makeHtmlEmailBody($report_cache, $report_preferences) {
global $tikilib, $userlib, $base_url;
$tikiUrl = rtrim($base_url, '/');
$change_array = $this->makeChangeArray($report_cache);
$somethingHasHappened = false;
......
......@@ -6,16 +6,16 @@
// $Id$
include_once ('tiki-setup.php');
if ( '127.0.0.1' != $tikilib->get_ip_address() ) {
die("This script can only be called by the server!");
die(tr('This script can only be called by the server!'));
}
if ($prefs['feature_daily_report_watches'] != 'y') {
die("This feature is disabled");
die(tr('This feature is disabled'));
}
include_once ('lib/reportslib.php');
//Complete URL to your Tikiwiki installation without ending slash!
$tikiUrl = "http://localhost/trunktest";
include_once ('lib/reportslib.php');
foreach($reportslib->getUsersForSendingReport() as $key => $user) {
$report_preferences = $reportslib->get_report_preferences_by_user($user);
......@@ -27,7 +27,7 @@ foreach($reportslib->getUsersForSendingReport() as $key => $user) {
$report_cache = $reportslib->get_report_cache_entries_by_user($user, "time ASC");
//Send email if there is a cache or if always_email = true
if ($report_cache OR (!$report_cache && $report_preferences['always_email']))
$reportslib->sendEmail($user_data, $report_preferences, $report_cache, $tikiUrl);
$reportslib->sendEmail($user_data, $report_preferences, $report_cache);
}
//Update Database
$reportslib->updateLastSent($user_data['login']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment