Commit 67147051 authored by floh1111's avatar floh1111

Added reports for summarising notification emails from watches

parent 8f528f72
......@@ -2436,6 +2436,7 @@ lib/refererstats/refererlib.php -text
lib/registration/index.php -text
lib/registration/register_ajax.js -text
lib/registration/registrationlib.php -text
lib/reports.php -text
lib/rss/atom-style.css -text svneol=unset#application/octet-stream
lib/rss/index.php -text
lib/rss/opml.css -text
......@@ -3599,6 +3600,7 @@ templates/mail/newsletter_welcome_subject.tpl -text
templates/mail/notification_subject.tpl -text
templates/mail/password_reminder.tpl -text
templates/mail/password_reminder_subject.tpl -text
templates/mail/report.tpl -text
templates/mail/submission_notification.tpl -text
templates/mail/submission_notification_subject.tpl -text
templates/mail/tellAFriend.tpl -text
......@@ -4618,6 +4620,8 @@ tests/testfile.txt -text
/tiki-user_contacts_prefs.php -text
/tiki-user_information.php -text
/tiki-user_preferences.php -text
/tiki-user_reports.php -text
/tiki-user_reports_send.php -text
/tiki-user_tasks.php -text
/tiki-user_watches.php -text
/tiki-userfiles.php -text
......
......@@ -2674,6 +2674,29 @@ CREATE TABLE tiki_user_watches (
PRIMARY KEY (`user`(50),event,object(100),email(50))
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `tiki_user_reports`;
CREATE TABLE IF NOT EXISTS `tiki_user_reports` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(200) COLLATE latin1_general_ci NOT NULL,
`interval` varchar(20) COLLATE latin1_general_ci NOT NULL,
`view` varchar(8) COLLATE latin1_general_ci NOT NULL,
`type` varchar(5) COLLATE latin1_general_ci NOT NULL,
`time_to_send` datetime NOT NULL,
`always_email` tinyint(1) NOT NULL,
`last_report` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
DROP TABLE IF EXISTS `tiki_user_reports_cache`;
CREATE TABLE IF NOT EXISTS `tiki_user_reports_cache` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(200) COLLATE latin1_general_ci NOT NULL,
`event` varchar(200) COLLATE latin1_general_ci NOT NULL,
`data` text COLLATE latin1_general_ci NOT NULL,
`time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
DROP TABLE IF EXISTS tiki_userfiles;
CREATE TABLE tiki_userfiles (
user varchar(200) NOT NULL default '',
......
......@@ -68,7 +68,7 @@ class ArtLib extends TikiLib {
}
function remove_article($articleId, $article_data='') {
global $smarty, $tikilib, $user;
global $smarty, $tikilib, $user, $prefs;
if ($articleId) {
if (empty($article_data)) $article_data = $this->get_article($articleId);
......@@ -96,6 +96,26 @@ class ArtLib extends TikiLib {
if (!isset($_SERVER["SERVER_NAME"])) {
$_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
}
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Pr�fen ob Reports versendet werden d�rfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$reports->add_report_chache_entries($report_nots, 'article_deleted', array("articleId"=>$articleId, "articleTitle"=>$article_data['title'], "authorName"=>$article_data['authorName'], "user"=>$user));
}
if (count($nots) || is_array($emails)) {
include_once("lib/notifications/notificationemaillib.php");
......@@ -259,6 +279,7 @@ class ArtLib extends TikiLib {
// Clear article image cache because image may just have been changed
$this->delete_image_cache("article",$articleId);
$event = 'article_edited';
$nots = $tikilib->get_event_watches('article_edited', '*');
$nots2 = $tikilib->get_event_watches('topic_article_edited', $topicId);
$smarty->assign('mail_action', 'Edit');
......@@ -285,6 +306,7 @@ class ArtLib extends TikiLib {
}
// workaround to "pass" $topicId to get_event_watches
$GLOBALS["topicId"] = $topicId;
$event = 'article_submitted';
$nots = $tikilib->get_event_watches('article_submitted', '*');
$nots2 = $tikilib->get_event_watches('topic_article_created', $topicId);
$smarty->assign('mail_action', 'New');
......@@ -307,6 +329,27 @@ class ArtLib extends TikiLib {
if (!isset($_SERVER["SERVER_NAME"])) {
$_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
}
include_once ('lib/reports.php');
global $prefs;
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Pr�fen ob Reports versendet werden d�rfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$reports->add_report_chache_entries($report_nots, $event, array("articleId"=>$articleId, "articleTitle"=>$title, "authorName"=>$authorName, "user"=>$user));
}
if (count($nots) || is_array($emails)) {
include_once("lib/notifications/notificationemaillib.php");
......
......@@ -283,6 +283,28 @@ class BlogLib extends TikiLib {
if (!isset($_SERVER["SERVER_NAME"])) {
$_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
}
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Pr�fen ob Reports versendet werden d�rfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$query = "select `title` from `tiki_blogs` where `blogId`=?";
$blogTitle = $this->getOne($query, array((int)$blogId));
$reports->add_report_chache_entries($report_nots, 'blog_post', array("blogId"=>$blogId, "blogTitle"=>$blogTitle, "postId"=>$id, "user"=>$user));
}
if (count($nots)) {
include_once("lib/notifications/notificationemaillib.php");
$smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
......
......@@ -1489,6 +1489,13 @@ class CategLib extends ObjectLib {
function update_object_categories($categories, $objId, $objType, $desc='', $name='', $href='') {
global $prefs, $user;
$old_categories = $this->get_object_categories($objType, $objId);
//Dirty hack to remove the Slash at the end of the ID (Why is there a slash?! Bug is reportet.)
foreach($categories as $key=>$category) {
if($category{strlen($category)-1}=="/")
$categories[$key]=substr($category, 0, -1);
}
// need to prevent categories where user has no perm (but is set by other users with perm) to be wiped out
if ($prefs['feature_category_reinforce'] == "n") {
foreach ($old_categories as $old_cat) {
......
......@@ -2539,7 +2539,7 @@ class Comments extends TikiLib {
// Deal with mail notifications.
include_once('lib/notifications/notificationemaillib.php');
sendForumEmailNotification(empty($params['comments_reply_threadId'])?'forum_post_topic':'forum_post_thread', $params['forumId'], $forum_info, $params['comments_title'], $params['comments_data'], $user, $params['comments_title'], $message_id, $in_reply_to, isset($params['comments_parentId'])?$params['comments_parentId']: $threadId, isset($params['comments_parentId'])?$params['comments_parentId']: 0, isset($params['contributions'])? $params['contributions']: '' );
sendForumEmailNotification(empty($params['comments_reply_threadId'])?'forum_post_topic':'forum_post_thread', $params['forumId'], $forum_info, $params['comments_title'], $params['comments_data'], $user, $params['comments_title'], $message_id, $in_reply_to, isset($params['comments_parentId'])?$params['comments_parentId']: $threadId, isset($params['comments_parentId'])?$params['comments_parentId']: 0, isset($params['contributions'])? $params['contributions']: '', $threadId);
// Set watch if requested
if ($prefs['feature_user_watches'] == 'y') {
if ($user && isset($params['set_thread_watch']) && $params['set_thread_watch'] == 'y') {
......
......@@ -121,7 +121,7 @@ class FileGalLib extends TikiLib {
$smarty->assign('filename', $filename);
$smarty->assign('fdescription', $description);
$this->notify($galleryId, $name, $filename, $description, 'upload file', $user);
$this->notify($galleryId, $name, $filename, $description, 'upload file', $user, $fileId);
return $fileId;
}
......@@ -661,7 +661,7 @@ class FileGalLib extends TikiLib {
return $contents;
}
function notify ($galleryId, $name, $filename, $description, $action, $user) {
function notify ($galleryId, $name, $filename, $description, $action, $user, $fileId=false) {
global $prefs;
if ($prefs['feature_user_watches'] == 'y') {
// Deal with mail notifications.
......@@ -670,7 +670,7 @@ class FileGalLib extends TikiLib {
$machine = $this->httpPrefix(). dirname( $foo["path"]);
$galleryName = $this->getOne("select `name` from `tiki_file_galleries` where `galleryId`=?",array($galleryId));
sendFileGalleryEmailNotification('file_gallery_changed', $galleryId, $galleryName, $name, $filename, $description, $action, $user);
sendFileGalleryEmailNotification('file_gallery_changed', $galleryId, $galleryName, $name, $filename, $description, $action, $user, $fileId);
}
}
/* lock a file */
......
......@@ -898,17 +898,38 @@ class ImageGalsLib extends TikiLib {
refresh_index('images', $imageId);
}
$this->notify($imageId, $galleryId, $name, $filename, $description, isset($gal_info['name'])?$gal_info['name']: '', $user);
$this->notify($imageId, $galleryId, $name, $filename, $description, isset($gal_info['name'])?$gal_info['name']: '', 'upload image', $user);
return $imageId;
}
function notify($imageId, $galleryId, $name, $filename, $description, $galleryName, $user) {
global $prefs;
function notify($imageId, $galleryId, $name, $filename, $description, $galleryName, $action, $user) {
global $prefs, $smarty, $tikilib;
if ($prefs['feature_user_watches'] == 'y') {
$event = 'image_gallery_changed';
$nots = $this->get_event_watches($event, $galleryId);
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Pr�fen ob Reports versendet werden d�rfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$reports->add_report_chache_entries($report_nots, $event, array("imageId"=>$imageId, "imageName"=>$name, "fileName"=>$filename, "galleryId"=>$galleryId, "galleryName"=>$galleryName, "action"=>$action, "user"=>$user));
}
include_once('lib/notifications/notificationemaillib.php');
global $smarty, $tikilib;
$nots = $this->get_event_watches('image_gallery_changed', $galleryId);
$smarty->assign_by_ref('galleryId', $galleryId);
$smarty->assign_by_ref('galleryName', $galleryName);
$smarty->assign_by_ref('mail_date', date('U'));
......@@ -945,11 +966,13 @@ class ImageGalsLib extends TikiLib {
$this->rotate_image($id, 90);
}
function remove_image($id) {
function remove_image($id, $user) {
global $prefs;
$path = $this->getOne("select `path` from `tiki_images` where `imageId`=?",array($id));
$imageInfo = $this->get_image_info($id);
$gal_info = $this->get_gallery($imageInfo['galleryId']);
if ($path) {
@unlink ($prefs['gal_use_dir'] . $path);
......@@ -967,6 +990,7 @@ class ImageGalsLib extends TikiLib {
$query = "delete from `tiki_images_data` where `imageId`=?";
$result = $this->query($query,array((int)$id));
$this->remove_object('image', $id);
$this->notify($imageInfo['imageId'], $imageInfo['galleryId'], $imageInfo['name'], $imageInfo['filename'], $imageInfo['description'], isset($gal_info['name'])?$gal_info['name']: '', 'remove image', $user);
return true;
}
......
......@@ -9,7 +9,7 @@
* \param $topicName name of the parent topic
*/
function sendForumEmailNotification($event, $object, $forum_info, $title, $data, $author, $topicName, $messageId='', $inReplyTo='', $threadId, $parentId, $contributions='' ) {
function sendForumEmailNotification($event, $object, $forum_info, $title, $data, $author, $topicName, $messageId='', $inReplyTo='', $threadId, $parentId, $contributions='', $postId='') {
global $tikilib, $prefs, $smarty, $userlib;
// Per-forum From address overrides global default.
......@@ -101,6 +101,25 @@ function sendForumEmailNotification($event, $object, $forum_info, $title, $data,
$not['language'] = $defaultLanguage;
$nots[] = $not;
}
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Prfen ob Reports versendet werden drfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$reports->add_report_chache_entries($report_nots, $event, array("forumId"=>$forum_info['forumId'], "forumName"=>$forum_info['name'], "topicId"=>$threadId, "threadId"=>$postId, "threadName"=>$topicName, "user"=>$author));
}
if (count($nots)) {
include_once('lib/webmail/tikimaillib.php');
......@@ -161,13 +180,14 @@ function sendWikiEmailNotification($event, $pageName, $edit_user, $edit_comment,
if ($prefs['feature_user_watches'] == 'y') {
$nots = $tikilib->get_event_watches($event, $pageName);
}
if ($prefs['feature_user_watches'] == 'y' && $event == 'wiki_page_changed') {
global $structlib; include_once('lib/structures/structlib.php');
$nots2 = $structlib->get_watches($pageName);
if (!empty($nots2)) {
$nots = array_merge($nots, $nots2);
}
if ($prefs['wiki_watch_editor'] != "y") {
for ($i = count($nots) - 1; $i >=0; --$i)
if ($nots[$i]['user'] == $edit_user) {
......@@ -175,10 +195,12 @@ function sendWikiEmailNotification($event, $pageName, $edit_user, $edit_comment,
break;
}
}
foreach (array_keys($nots) as $i) {
$nots[$i]['language'] = $tikilib->get_user_preference($nots[$i]['user'], "language", $defaultLanguage);
}
}
if ($prefs['feature_user_watches'] == 'y' && $event == 'wiki_page_created' && $structure_parent_id) {
global $structlib; include_once('lib/structures/structlib.php');
$nots = array_merge( $nots, $structlib->get_watches('', $structure_parent_id) );
......@@ -209,6 +231,26 @@ function sendWikiEmailNotification($event, $pageName, $edit_user, $edit_comment,
if ($edit_user=='') $edit_user = tra('Anonymous');
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Prfen ob Reports versendet werden drfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$reports->add_report_chache_entries($report_nots, $event, array("pageName"=>$pageName, "object"=>$pageName, "editUser"=>$edit_user, "editComment"=>$edit_comment, "oldVer"=>$oldver));
}
if (count($nots)) {
$edit_data = TikiLib::htmldecode($edit_data);
include_once('lib/mail/maillib.php');
......@@ -329,7 +371,7 @@ function sendErrorEmailNotification($errno, $errstr, $errfile='?', $errline= '?'
"$errfile, Line $errline\n$err($errno)\n$errstr");
}
function sendFileGalleryEmailNotification($event, $galleryId, $galleryName, $name, $filename, $description, $action, $user) {
function sendFileGalleryEmailNotification($event, $galleryId, $galleryName, $name, $filename, $description, $action, $user, $fileId) {
global $tikilib, $prefs, $smarty, $userlib;
$nots = array();
......@@ -342,6 +384,26 @@ function sendFileGalleryEmailNotification($event, $galleryId, $galleryName, $nam
$nots[$i]['language'] = $tikilib->get_user_preference($nots[$i]['user'], "language", $defaultLanguage);
}
}
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Prfen ob Reports versendet werden drfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$reports->add_report_chache_entries($report_nots, $event, array("name"=>$name, "fileId"=>$fileId, "fileName"=>$filename, "galleryId"=>$galleryId, "galleryName"=>$galleryName, "action"=>$action, "user"=>$user));
}
if (count($nots)) {
include_once('lib/webmail/tikimaillib.php');
......@@ -376,7 +438,7 @@ function sendFileGalleryEmailNotification($event, $galleryId, $galleryName, $nam
* oldCategoryName, oldCategoryPath, oldDescription, oldParendId, oldParentName,
* objectName, objectType, objectUrl
*/
function sendCategoryEmailNotification($values) {
function sendCategoryEmailNotification($values) {
$event=$values['event'];
$action=$values['action'];
$categoryId=$values['categoryId'];
......@@ -422,6 +484,27 @@ function sendCategoryEmailNotification($values) {
}
}
include_once ('lib/reports.php');
//Reports added by Clemens John <clemens-john@gmx.de> May 19th 2009
//Prfen ob Reports versendet werden drfen
if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
//Benutzer die Reports eingeschaltet haben holen
$report_users = $reports->getUsersForReport();
//Benutzer die Reports eingeschaltet haben in das Report-Array verschieben.
foreach ($nots as $key=>$not) {
if (in_array($not['user'], $report_users)) {
$report_nots[] = $not['user'];
unset($nots[$key]);
}
}
//Daten in den Reportcache schaufeln
$values['user'] = $user;
$reports->add_report_chache_entries($report_nots, $event, $values);
}
if (count($nots)) {
include_once('lib/webmail/tikimaillib.php');
$mail = new TikiMail();
......
This diff is collapsed.
......@@ -1223,6 +1223,7 @@ Style,FontName,FontSize,-,TextColor,BGColor,-,Source",
'feature_user_watches' => 'n',
'feature_group_watches' => 'n',
'feature_user_watches_translations' => 'n',
'feature_daily_report_watches' => 'n',
'feature_workflow' => 'n',
'feature_xmlrpc' => 'n',
'helpurl' => "http://doc.tikiwiki.org/",
......
......@@ -530,7 +530,7 @@ class TikiLib extends TikiDB {
}
return $ret;
}
/*shared*/
function dir_stats() {
$aux = array();
......
Report for {$report_user}.<!--{$report_interval}-Report from {$report_date};-->
Last Report sent on {$report_last_report_date}.
<!--Total changes: {$report_total_changes};-->
<u>Changes in detail:</u>
{$report_body}
{if $mail_contributions}{tr}Contribution{/tr}: {$mail_contributions}{/if}
\ No newline at end of file
......@@ -377,6 +377,10 @@
<span class="checkbox"><input type="checkbox" name="feature_group_watches" {if $prefs.feature_group_watches eq 'y'}checked="checked"{/if}/></span>
<span class="label"> {if $prefs.feature_help eq 'y'}<a href="{$prefs.helpurl}Group+Watches" target="tikihelp" class="tikihelp" title="{tr}Group Watches{/tr}">{/if} {tr}Group Watches{/tr} {if $prefs.feature_help eq 'y'}</a>{/if}</span>
</div>
<div class="half_width">
<span class="checkbox"><input type="checkbox" name="feature_daily_report_watches" {if $prefs.feature_daily_report_watches eq 'y'}checked="checked"{/if}/></span>
<span class="label"> {if $prefs.feature_help eq 'y'}<a href="{$prefs.helpurl}Daily+Reports" target="tikihelp" class="tikihelp" title="{tr}Daily Repors for User Watches{/tr}">{/if} {tr}Daily Reports{/tr} {if $prefs.feature_help eq 'y'}</a>{/if}</span>
</div>
<div class="half_width">
<span class="checkbox"><input type="checkbox" name="feature_user_watches_translations" {if $prefs.feature_user_watches_translations eq 'y'}checked="checked"{/if}/></span>
<span class="label"> {if $prefs.feature_help eq 'y'}<a href="{$prefs.helpurl}User+Watches" target="tikihelp" class="tikihelp" title="{tr}User Watches Translations{/tr}">{/if} {tr}User Watches Translations{/tr} {if $prefs.feature_help eq 'y'}</a>{/if}</span>
......
{* $Id$ *}
{title help="User+Watches"}{tr}User Watches{/tr}{/title}
{title help="User+Watches"}{tr}User Watches and preferences{/tr}{/title}
<h2>Report Preferences</h2>
{if $prefs.feature_daily_report_watches eq 'y'}
{remarksbox type="tip" title="{tr}Tip{/tr}"}{tr}Use "reports" to summarise notifications about objects you are watching.{/tr}{/remarksbox}
<form action="tiki-user_reports.php" method="post" id='formi'>
<input type="hidden" name="report_preferences" value="true"/>
<p><input type="checkbox" name="use_daily_reports" value="true" {if $report_preferences != false}checked{/if}/> Use reports</p>
<p>
Interval in witch you want to get the reports
<select name="interval">
<option value="daily" {if $report_preferences.interval eq "daily"}selected{/if}>{tr}daily{/tr}</option>
<option value="weekly" {if $report_preferences.interval eq "weekly"}selected{/if}>{tr}weekly{/tr}</option>
<option value="monthly" {if $report_preferences.interval eq "monthly"}selected{/if}>{tr}monthly{/tr}</option>
</select>
</p>
<div style="float:left; margin-right: 50px;">
<input type="radio" name="view" value="short" {if $report_preferences.view eq "short"}checked{/if}> Short report<br>
<input type="radio" name="view" value="detailed" {if $report_preferences.view eq "detailed" OR $report_preferences eq false}checked{/if}> Detailed report<br>
</div>
<div style="float:left; margin-right: 50px;">
<input type="radio" name="type" value="html" {if $report_preferences.type eq "html" OR $report_preferences eq false}checked{/if}> HTML-Email<br>
<input type="radio" name="type" value="plain" {if $report_preferences.type eq "plain"}checked{/if}> Plain text<br>
</div>
<div>
<input type="checkbox" name="always_email" value="1" {if $report_preferences.always_email eq 1 OR $report_preferences eq false}checked{/if}/> Send me an email also if nothing happened
</div>
<p><input type="submit" name="submit" value=" {tr}Apply{/tr} "></p>
</form>
{else}
<p>Reports are disabled, only standard reporting is available</p>
{/if}
<h2>Sites you are watching</h2>
{if $prefs.feature_ajax ne 'y' && $prefs.feature_mootools ne 'y'}
{include file=tiki-mytiki_bar.tpl}
......
......@@ -82,6 +82,7 @@ if (isset($_REQUEST["features"])) {
"feature_user_bookmarks",
"feature_user_watches",
"feature_group_watches",
"feature_daily_report_watches",
"feature_user_watches_translations",
"feature_userfiles",
"feature_usermenu",
......
......@@ -166,7 +166,7 @@ if (isset($_REQUEST["remove"])) {
$area = 'delgalimage';
if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$imagegallib->remove_image($_REQUEST["remove"]);
$imagegallib->remove_image($_REQUEST["remove"], $user);
} else {
key_get($area);
}
......
......@@ -140,7 +140,7 @@ if (isset($_REQUEST["remove"])) {
$area = 'delgallery';
if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$imagegallib->remove_image($_REQUEST["remove"]);
$imagegallib->remove_image($_REQUEST["remove"], $user);
} else {
key_get($area);
}
......
<?php
// Copyright (c) 2009, Clemens John
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
include_once ('tiki-setup.php');
if (!$user) {
$smarty->assign('msg', tra("You must log in to use this feature"));
$smarty->assign('errortype', '402');
$smarty->display("error.tpl");
die;
}
if ($prefs['feature_daily_report_watches'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_daily_report_watches");
$smarty->display("error.tpl");
die;
}
include_once ('lib/reports.php');
//Enable User Report
if (isset($_POST['report_preferences']) && $_POST['use_daily_reports']=="true") {
$reports->add_user_report($user,$_POST['interval'],$_POST['view'],$_POST['type'], $_POST['always_email']);
header('Location: tiki-user_watches.php');
die;
}
//Enable User Report
if (isset($_POST['report_preferences']) && $_POST['use_daily_reports']!="true") {
$reports->delete_user_report($user);
header('Location: tiki-user_watches.php');
die;
}
?>
<?php
include_once ('tiki-setup.php');
if ($_SERVER['REMOTE_ADDR'] != "127.0.0.1") {
$smarty->assign('msg', tra("This script can only be called by the server!"));
$smarty->display("error.tpl");
die;
}
if ($prefs['feature_daily_report_watches'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_daily_report_watches");
$smarty->display("error.tpl");
die;
}
include_once ('lib/tikilib.php');
include_once ('lib/wiki/histlib.php');
include_once ('lib/imagegals/imagegallib.php');
include_once ('lib/imagegals/imagegallib.php');
include_once ('lib/reports.php');
foreach ($reports->getUsersForReport() as $key => $user) {
$report_preferences = $reports->get_report_preferences_by_user($user);
$user_data = $userlib->get_user_info($user);
//Wenn keine Emailadresse gesetzt ist, mache nichts und leere den Cache
if (!empty($user_data['email'])) {
//Hole Cache
$report_cache = $reports->get_report_cache_entries_by_user($user, "time ASC");
//Schicke Email wenn: Einträge vorhanden oder always_email = true
if ($report_cache OR (!$report_cache && $report_preferences['always_email']))
$reports->sendEmail($user_data, $report_preferences, $report_cache);
}
//Cache leeren
$reports->deleteUsersReportCache($user_data);
}
?>
\ No newline at end of file
......@@ -8,6 +8,8 @@
$section = 'mytiki';
include_once ('tiki-setup.php');
include_once ('lib/reports.php');
if ($prefs['feature_ajax'] == "y") {
require_once ('lib/ajax/ajaxlib.php');
}
......@@ -168,5 +170,10 @@ user_watches_ajax();
$smarty->assign("mootab",'y');
}
$report_preferences = $reports->get_report_preferences_by_user($user);
if ($report_preferences) {
$smarty->assign_by_ref('report_preferences', $report_preferences);
}
$smarty->assign('mid', 'tiki-user_watches.tpl');
$smarty->display("tiki.tpl");
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