##############################################################################################################
## MOD Title: Email Digests
## MOD Author: MarkDHamill < mhamill@computer.org > (Mark D. Hamill) http://www.potomactavern.org
## MOD Author, Secondary: Indemmity83 < Indemnity83@dormlife.us > (Kyle D. Klaus) http://www.dormlife.us
## MOD Author, Secondary: david63 < david.wood@pear-tree.org.uk > (David Wood) n/a
## MOD Description: Sends customized email digests of forum messages to subscribers
## MOD Version: 1.3.4
##
## Installation Level: Advanced
## Installation Time: 60 Minutes to several days, depending on whether you need to set up SSH and
##                    your skills at the server operating system command line.
##
## Files To Edit:	constants.php,
##			admin_db_utilities.php,
##			admin_forums.php,
##			admin_groups.php,
##			admin_user_ban.php,
##			admin_users.php,
##			login.php,
##			page_header.php,
##			posting.php,
##			functions_post.php,
##			groupcp.php,
##			lang_main.php,
##			lang_faq.php,
##			usercp_register.php,
##			profile_add_body.tpl,
##			posting_body.tpl,
##			forum_edit_body.tpl,
##			group_edit_body.tpl,
##			groupcp_info_body.tpl,
##			overall_header.tpl,
##
## Included Files:	digests.php,
##			digests_common.php,
##			digests_user_cp.php,
##			install_digests.php,
##			mail_digests.php,
##			admin_digests_management.php,
##			admin_digests_add_users.php,
##			admin_digests_add_groups.php,
##			admin_digests_config.php,
##			admin_digests_confirm.php,
##			admin_digests_dump.php,
##			admin_digests_log.php,
##			admin_digests_mail.php,
##			admin_digests_verify.php,
##			digest_times.php,
##			functions_digests.php,
##			lang_digests.php,
##			mail_digests_confirm.tpl,
##			mail_digests_html.tpl,
##			mail_digests_text.tpl,
##			digests.tpl,
##			digests_management.tpl,
##			digests_config_body.tpl,
##			digests_confirm.tpl,
##			digests_dump.tpl,
##			digests_dump_body.tpl,
##			digests_log.tpl,
##			digests_mail.tpl,
##			digest_times.tpl,
##			digests_user_cp.tpl,
##			digests_verify.tpl,
##			digests_verify_body.tpl,
##			mail_digests.tpl,
##			digest_user_select_body.tpl,
##			icon_mini_digest.gif,
##			logo_digests.gif,
##			batch_scheduling.txt
##
############################################################################################################# 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the latest version of this MOD.
## Downloading this MOD from other sites could cause malicious code to enter into your phpBB Forum. As such,
## phpBB will not offer support for MOD's not offered in our MOD-Database, located at: http://www.phpbb.com/mods/ 
#############################################################################################################
## Author Notes:
##
## This version is for MSSQL only
## Important. Replace [yourservername] with your server name before running this. 
##
## PLEASE FOLLOW THESE STEPS TO INSTALL. Do not rely solely on the instructions at the end.
##
## 1. First READ but DO NOT IMPLEMENT the instructions in batch_scheduling.txt. If this is something
## beyond what you can do do not bother to install the mod, or seek help.
##
## 2.  Create the tables needed by running install_digests.php from your phpBB root directory.
## Warning: this has been tested only with MySQL. If you are using any other database you may need
## to change the SQL to make it work AND potentially change the SQL itself in the other scripts. If anybody
## is using a diffrent database than MySQL and would like to aid in testing, please contact Indemnity83.
##
## 3. If you are upgrading from a previous version make a backup of your tables right now, before doing
## anything. Because of changes to the database structure new tables need to be created and existing data
## imported. As with the MOD itself, the importer is BETA too. For more on upgrading see upgrade.txt
##
## 4. Test to see if the digest user interface is working correctly. Via URL invoke digests.php in 
## your phpBB root folder. Set it up so you receive a digest every hour.
##
## 5. Next, test to see if you can receive an email digest. Via ACP, run the "Mail Digests". You should see
## a text output indicating who received a digest, how many messages were sent and other information, that
## may or may not be usefull, along with a total count of the digests sent and some server date and time
## information. This will help in testing and resolving potential issues. Since this program is normally
## run automatically this information is not seen seen, but you can redirect output to a file if you wish
## (depending on how your server is configured). It may be an idea to turn logging on at this stage so that
## you have a record of what has been happening. If the digest was successfully sent it should appear in
## your email. 
##
## 6. Next enable the batch scheduling feature. Follow in instructions in batch_scheduling.txt and 
## test it. Schedule yourself to receive a digest every hour. Hopefully it will pop into your mailbox
## in an hour of setting up your digest.
##
## 7. If you get errors when you run mail_digests.php you may need to change line 40 to show the absolute
## path to phpBB on your server (e.g. '/subfolder/local/home/mysite/mysite.com/') It is dependant on how
## the server is configured. On some servers it will work with the relative path set but on others it
## needs the absolute path (not sure why!)
##
## Usage notes:
##
## A clone of the 2.0.6 emailer class is used (digest_emailer.php) for the mail_digests.php program. 
## The class was apparently written with no thought that it would be used for sending HTML formatted 
## email. Eventually this problem will be fixed and a future version will go back to using the 
## emailer class. Also, a sniped version of auth() is used to get a listing of forums the user is 
## authorized to read. The auth() function would have worked as-is, however it checks that the user
## is logged in, and thus breaks for the digest use. 
##
## Most users who receive HTML digests using web based email programs like Yahoo! Mail will likely not 
## see cascading style sheets applied to the HTML email unless frames are enabled, with a frame for the 
## content of the email message. In the case of Yahoo! Mail, the message is displayed inside of a table 
## <td> tag. Yahoo! Mail strips out <link> and related tags and appears to shove whatever content is 
## between the <body> and the </body> tags of the email into the cell where the message appears. It
## all still works, just may not look as fancy (but still better than text).
##
## You can use any theme you have installed on your board to theme the digest. By default it will use
## whatever theme the user has set (unless you have an overriding theme set in the ACP). If you want 
## to overide both the board default and the user default (say you always want it to use subSilver, and 
## your boards default is someething else) then you can set OVERIDE_THEME to true, and then set DIGEST_THEME
## to the theme (from the database) of the theme you want to use. Any images will be striped out of the 
## theme, but colors sill stick and if the theme is well put together the colors will be at least close to the
## images that should be covering them. Note that the digest pulls the theme data from the database, NOT a css 
## file. 
##
## Currently the MOD is authored by Indemnity83, but it would definetly not be what it is now without 
## Mark D. Hamill's work to get it going. So my personal thanks go to Mark for the idea, and the oportunity
## to take the MOD even further. 
##
## Some of the code for the User magagement has been taken from the "Admin Userlist" mod by
## wGEric < eric@best-dev.com > (Eric Faerber) http://mods.best-dev.com/ 
##
## The idea, and basis, of the code for "Urgent Digests" and "Test Mode" was done by ChrissySkyking - thanks.
##
## A Note From Mark:
## I would like to thank gregentin, dkklein, rabecasis, pengrus, m_longland, PeteBest and many others for
## Beta testing, their suggestions and improving the code. Without them this software would be much less
## useful AND professional.
##
############################################################## 
## MOD History: 
## 
##   (Look at install_digests_132.txt for MOD History.)
## 
############################################################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#############################################################################################################
# 
#-----[ COPY ]------------------------------------------
#
copy digests.php to digests.php
copy digests_common.php to digests_common.php
copy digests_user_cp.php to digests_user_cp.php
copy install_digests.php to install_digests.php
copy admin/admin_digests_management.php to admin/admin_digests_management.php
copy admin/admin_digests_add_users.php to admin/admin_digests_add_users.php
copy admin/admin_digests_add_groups.php to admin/admin_digests_add_groups.php
copy admin/admin_digests_config.php to admin/admin_digests_config.php
copy admin/admin_digests_confirm.php to admin/admin_digests_confirm.php
copy admin/admin_digests_dump.php to admin/admin_digests_dump.php
copy admin/admin_digests_log.php to admin/admin_digests_log.php
copy admin/admin_digests_mail.php to admin/admin_digests_mail.php
copy admin/admin_digests_verify.php to admin/admin_digests_verify.php
copy admin/digest_times.php to admin/digest_times.php
copy admin/mail_digests.php to admin/mail_digests.php
copy includes/functions_digests.php to includes/functions_digests.php
copy language/lang_english/lang_digests.php to language/lang_english/lang_digests.php
copy language/lang_english/email/mail_digests_confirm.tpl to language/lang_english/email/mail_digests_confirm.tpl
copy language/lang_english/email/mail_digests_html.tpl to language/lang_english/email/mail_digests_html.tpl
copy language/lang_english/email/mail_digests_text.tpl to language/lang_english/email/mail_digests_text.tpl
copy templates/subSilver/digests.tpl to templates/subSilver/digests.tpl
copy templates/subSilver/digests_user_cp.tpl to templates/subSilver/digests_user_cp.tpl
copy templates/subSilver/admin/digests_management.tpl to templates/subSilver/admin/digests_management.tpl
copy templates/subSilver/admin/digests_config_body.tpl to templates/subSilver/admin/digests_config_body.tpl
copy templates/subSilver/admin/digests_confirm.tpl to templates/subSilver/admin/digests_confirm.tpl
copy templates/subSilver/admin/digests_dump.tpl to templates/subSilver/admin/digests_dump.tpl
copy templates/subSilver/admin/digests_dump_body.tpl to templates/subSilver/admin/digests_dump_body.tpl
copy templates/subSilver/admin/digests_log.tpl to templates/subSilver/admin/digests_log.tpl
copy templates/subSilver/admin/digests_mail.tpl to templates/subSilver/admin/digests_mail.tpl
copy templates/subSilver/admin/digest_times.tpl to templates/subSilver/admin/digest_times.tpl
copy templates/subSilver/admin/digests_verify.tpl to templates/subSilver/admin/digests_verify.tpl
copy templates/subSilver/admin/digests_verify_body.tpl to templates/subSilver/admin/digests_verify_body.tpl
copy templates/subSilver/admin/digests_user_lookup_body.tpl to templates/subSilver/admin/digests_user_lookup_body.tpl
copy templates/subSilver/admin/digests_user_select_body.tpl to templates/subSilver/admin/digests_user_select_body.tpl
copy templates/subSilver/admin/mail_digests.tpl to templates/subSilver/admin/mail_digests.tpl
copy templates/subSilver/images/icon_mini_digest.gif to templates/subSilver/images/icon_mini_digest.gif
copy templates/subSilver/images/logo_digests.gif to templates/subSilver/images/logo_digests.gif
#
#-----[ SQL ]--------
#
CREATE TABLE phpbb_digests ( 
	digest_id int NOT NULL IDENTITY (1, 1), 
	digest_name varchar(25) NULL default '', 
	user_id int NOT NULL default '0', 
	digest_type tinyint NOT NULL default '0', 
	digest_activity tinyint NOT NULL default '1', 
	digest_frequency int NOT NULL default '0', 
	last_digest int NOT NULL default '0', 
	digest_format smallint NOT NULL default '0', 
	digest_show_text smallint NOT NULL default '0', 
	digest_show_mine smallint NOT NULL default '0', 
	digest_new_only smallint NOT NULL default '0', 
	digest_send_on_no_messages smallint NOT NULL default '1', 
	digest_moderator tinyint NOT NULL default '0', 
	PRIMARY KEY  (digest_id), 
); 

CREATE TABLE phpbb_digests_forums ( 
	user_id int NOT NULL default '0', 
	forum_id smallint NOT NULL default '0', 
	include_forum tinyint NOT NULL default '1', 
	digest_id int NOT NULL default '0', 
); 

CREATE TABLE phpbb_digests_log ( 
	log_time int NOT NULL default '0', 
	run_type tinyint NOT NULL default '0', 
	user_id int NOT NULL default '0', 
	digest_frequency int NOT NULL default '0', 
	digest_type tinyint NOT NULL default '0', 
	group_id int NOT NULL default '1', 
	log_status int NOT NULL default '0',
	log_posts int NULL default '0';
); 

CREATE TABLE phpbb_digests_config ( 
	config_name varchar(255) NOT NULL default '', 
	config_value varchar(255) NOT NULL default '0', 
	PRIMARY KEY  (config_name), 
); 

INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('activity_threshold', '90');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_daily', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_direct_run', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_exclude', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_hours1', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_hours2', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_hours4', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_hours6', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_hours8', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_hours12', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_monthly', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_urgent', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('allow_weekly', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('auto_subscribe', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('auto_subscribe_group', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('check_user_activity', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_format', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_frequency', '24');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_new_only', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_send_on_no_messages', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_show_mine', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_show_text', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('default_text_length_type', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_date_format', 'D d-M-Y \a\t H:i:s');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_disable_group', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_disable_user', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_logging', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_subject', '');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_theme', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('digest_version', '1.3.4');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('direct_password', '');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('home_page', 'index');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('log_days', '8');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('monthly_day', '28');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('new_sign_up', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('override_theme', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('pm_notify', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('pm_display', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('run_urgent_only', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('run_time', '18');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('short_text_length', '150');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('show_stats', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('supress_cron_output', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('test_mode', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('theme_type', '0');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('urgent_run_required', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('use_system_time', '1');
INSERT INTO phpbb_digests_config (config_name, config_value) VALUES ('weekly_day', '0');

ALTER TABLE iusr_[yourservername].phpbb_users ADD user_digest_status tinyint default '0' NOT NULL; 

ALTER TABLE iusr_[yourservername].phpbb_user_group ADD digest_confirm_date int default '0' NOT NULL; 

ALTER TABLE iusr_[yourservername].phpbb_forums ADD forum_digest tinyint default '1' NOT NULL; 

ALTER TABLE iusr_[yourservername].phpbb_posts ADD urgent_post tinyint;
#
#-----[ OPEN ]------------------------------------------
#
groupcp.php
#
#-----[ FIND ]------------------------------------------
#
$template->pparse('confirm');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
	}
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
else if (isset($HTTP_POST_VARS['digest_confirm']) && $group_id)
{
	$sql = "UPDATE " . USER_GROUP_TABLE . " 
		SET digest_confirm_date = 0 
		WHERE user_id = ". $userdata['user_id'] . "
		AND group_id = $group_id";

	if (!($result = $db->sql_query($sql)))
	{
		message_die(GENERAL_ERROR, 'Could not update digest confirmation', '', __LINE__, __FILE__, $sql);
	}

	redirect(append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id"));
}
else if (isset($HTTP_POST_VARS['digest_options']) && $group_id)
{
		redirect(append_sid($phpbb_root_path . "digests.$phpEx?user_id=$group_id&mode=group&digest_type=1"));

}
#
#-----[ FIND ]------------------------------------------
#
if ( !($group_info = $db->sql_fetchrow($result)) )
	{
		message_die(GENERAL_MESSAGE, $lang['Group_not_exist']); 
	}
#
#-----[ AFTER, ADD ]------------------------------------------
#

	$group_digest = $group_info['group_digest'];
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, ug.user_pending
#
#-----[ IN-LINE FIND ]------------------------------------------
#
ug.user_pending
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, ug.digest_confirm_date
#
#-----[ FIND ]------------------------------------------
#
				$is_group_member = TRUE;
#
#-----[ AFTER, ADD ]------------------------------------------
#

				if ( $group_members[$i]['digest_confirm_date'] != 0 )
				{
					$confirm_outstanding = TRUE;
				}
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('switch_unsubscribe_group_input', array());
#
#-----[ AFTER, ADD ]------------------------------------------
#

if ( $confirm_outstanding )
		{
			$template->assign_block_vars('digest_confirm_input', array());
		}
#
#-----[ FIND ]------------------------------------------
#
'L_UPDATE' => $lang['Update'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
		'L_GROUP_DIGEST' => $lang['Group_digest'],
		'L_DIGEST_OPTIONS' => $lang['Digest_options'],
		'L_DIGEST_CONFIRM' => $lang['Digest_confirm_title'],
#
#-----[ FIND ]------------------------------------------
#
if ( $is_moderator )
	{
		$template->assign_block_vars('switch_mod_option', array());
		$template->assign_block_vars('switch_add_member', array());
#
#-----[ AFTER, ADD ]------------------------------------------
#

		if ($group_digest == TRUE)
		{
			$template->assign_block_vars('switch_digest_option', array());
		}
#
#-----[ OPEN ]------------------------------------------
#
login.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'digests_common.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT user_id, username, user_password, user_active, user_level
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_level
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
,user_digest_status
#
#-----[ FIND ]------------------------------------------
#
if( $session_id )
					{
						$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&amp;', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "index.$phpEx";
#
#-----[ AFTER, ADD ]------------------------------------------
#

						if ($row['user_digest_status'] > 0)
						{
							if (($row['user_digest_status'] == 1) || ($row['user_digest_status'] == 3))
							{
								$sql = "INSERT INTO " . USER_GROUP_TABLE . "
									(group_id, user_id, user_pending)
									VALUES (".$digest_config['auto_subscribe_group'].", ".$row['user_id'].", 0)";

								if (!($result = $db->sql_query($sql)))
								{
									message_die(GENERAL_ERROR, 'Could not insert data into user groups table', '', __LINE__, __FILE__, $sql);
								}
							}

							if (($row['user_digest_status'] == 2) || ($row['user_digest_status'] == 3))
							{
								$url = 'digests.php';
							}

							$sql = "UPDATE " . USERS_TABLE . "
								SET user_digest_status = '0'
								WHERE user_id = ".$row['user_id']."";

							$result = $db->sql_query($sql);
						}
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'digests_common.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );
#
#-----[ AFTER, ADD ]------------------------------------------
#
$urgent_post = ( !empty($HTTP_POST_VARS['urgent_post']) ) ? TRUE : 0;
#
#-----[ FIND ]------------------------------------------
#
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$attach_sig,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 $urgent_post,
#
#-----[ FIND ]------------------------------------------
#
if( $user_sig != '' )
{
	$template->assign_block_vars('switch_signature_checkbox', array());
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ($userdata['session_logged_in'] && $is_auth['auth_read']) 
{ 
	if (($mode != 'editpost') || (($mode == 'editpost') && ($post_info['poster_id'] != ANONYMOUS))) 
	{ 
		$urgent_run = get_urgent_run($userdata['user_id'], $forum_id, $digest_config['allow_urgent']);
		if ($urgent_run == TRUE)
		{
			$template->assign_block_vars('switch_urgent_checkbox', array());
		}
	} 
}

#
#-----[ FIND ]------------------------------------------
#
	'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'L_URGENT_POST' => $lang['Urgent_post'],
#
#-----[ FIND ]------------------------------------------
#
	'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '', 
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'S_URGENT_CHECKED' => ( $urgent_post ) ? 'checked="checked"' : '',
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_db_utilities.php
#
#-----[ FIND ]------------------------------------------
#
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm'
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'confirm'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, 'digests', 'digests_config', 'digests_forums'
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_forums.php
#
#-----[ FIND ]------------------------------------------
#
				$forumstatus = $row['forum_status'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
				$forum_digest = $row['forum_digest'];
#
#-----[ FIND ]------------------------------------------
#
				$forum_id = ''; 
				$prune_enabled = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#				
				$forum_digest = 1; 
#
#-----[ FIND ]------------------------------------------
#
				'L_FORUM_STATUS' => $lang['Forum_status'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
				'L_DIGEST' => $lang['Allow_forum_digest'],
#
#-----[ FIND ]------------------------------------------
#
				'L_DAYS' => $lang['Days'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
				'L_YES' => $lang['Yes'],
				'L_NO' => $lang['No'],

				'FORUM_DIGEST_CHECKED_YES' => ($forum_digest == true) ? 'checked="checked"' : '',			
				'FORUM_DIGEST_CHECKED_NO' => ($forum_digest == false) ? 'checked="checked"' : '',
#
#-----[ FIND ]------------------------------------------
#
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
#
#-----[ IN-LINE FIND ]------------------------------------------
#
forum_status,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 forum_digest,
#
#-----[ FIND ]------------------------------------------
#
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
#
#-----[ IN-LINE FIND ]------------------------------------------
#
intval($HTTP_POST_VARS['forumstatus']) . ",
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 " . intval($HTTP_POST_VARS['forum_digest']) . ",
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
#
#-----[ IN-LINE FIND ]------------------------------------------
#
forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ",
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 forum_digest = " . intval($HTTP_POST_VARS['forum_digest']) . ",
#
#-----[ FIND ]------------------------------------------
#
$sql = "DELETE FROM " . PRUNE_TABLE . "
				WHERE forum_id = $from_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't delete forum prune information!", "", __LINE__, __FILE__, $sql);
			}
#
#-----[ AFTER, ADD ]------------------------------------------
#

			$sql = "DELETE FROM " . DIGEST_FORUMS_TABLE . "
				WHERE forum_id = $from_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't delete digest forum data", "", __LINE__, __FILE__, $sql);
			}
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_groups.php
#
#-----[ FIND ]------------------------------------------
#
$group_info = array (
			'group_name' => '',
			'group_description' => '',
			'group_moderator' => '',
			'group_type' => GROUP_OPEN
#
#-----[ IN-LINE FIND ]------------------------------------------
#
GROUP_OPEN
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
,
			'group_digest' => 0
#
#-----[ FIND ]------------------------------------------
#
		'L_YES' => $lang['Yes'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
		'L_NO' => $lang['No'],
		'L_GROUP_DIGESTS' => $lang['Group_digests'],
		'L_GROUP_DIGESTS_EXPLAIN' => $lang['Group_digest_explain'],
#
#-----[ FIND ]------------------------------------------
#
		'S_GROUP_HIDDEN_CHECKED' => $group_hidden,
#
#-----[ AFTER, ADD ]------------------------------------------
#
		'S_GROUP_DIGEST_YES' => ($group_info['group_digest']) ? 'checked="checked"' : '',
		'S_GROUP_DIGEST_NO' => (!$group_info['group_digest']) ? 'checked="checked"' : '',
#
#-----[ FIND ]------------------------------------------
#
		$group_moderator = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
		$group_digest = isset($HTTP_POST_VARS['group_digest']) ? $HTTP_POST_VARS['group_digest'] : '';
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . GROUPS_TABLE . "
				SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator
#
#-----[ IN-LINE FIND ]------------------------------------------
#
group_moderator = $group_moderator
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_digest = $group_digest
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user
#
#-----[ IN-LINE FIND ]------------------------------------------
#
group_single_user
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_digest
#
#-----[ FIND ]------------------------------------------
#
VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator,	'0'
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'0'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $group_digest
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_user_ban.php
#
#-----[ FIND ]------------------------------------------
#
require('./pagestart.' . $phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'digests_common.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
if ( !$in_banlist )
		{
			$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];

			$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid)
				VALUES (" . $user_list[$i] . ")";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
			}
#
#-----[ AFTER, ADD ]------------------------------------------
#
			digest_ban($user_list[$i], 0);
#
#-----[ FIND ]------------------------------------------
#
if ( isset($HTTP_POST_VARS['unban_user']) )
	{
		$user_list = $HTTP_POST_VARS['unban_user'];

		for($i = 0; $i < count($user_list); $i++)
		{
			if ( $user_list[$i] != -1 )
			{
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($user_list[$i]);
			}
#
#-----[ AFTER, ADD ]------------------------------------------
#
			digest_ban($user_list[$i], 1);
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
			$sql = "DELETE FROM " . BANLIST_TABLE . "
				WHERE ban_userid = $user_id";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
			}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$sql = "DELETE FROM " . DIGEST_TABLE . "
				WHERE user_id = $user_id";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Could not delete user from digests table', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . DIGEST_FORUMS_TABLE . "
				WHERE user_id = $user_id";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Could not delete user from digest forums table', '', __LINE__, __FILE__, $sql);
			}
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
define("BBCODE_UID_LEN", 10);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path . 'includes/functions_digests.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
function smilies_pass($message)
{
	static $orig, $repl;
#
#-----[ AFTER, ADD ]------------------------------------------
#
	$siteURL = get_site_url();
#
#-----[ FIND ]------------------------------------------
#
$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
#
#-----[ REPLACE WITH ]------------------------------------------
#
$repl[] = '<img src="' . $siteURL . '/' . $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('PAGE_TOPIC_OFFSET', 5000);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
define('PAGE_DIGEST', -2025);
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Digests MOD
define('DIGEST_TABLE', $table_prefix.'digests');
define('DIGEST_FORUMS_TABLE', $table_prefix.'digests_forums');
define('DIGEST_CONFIG_TABLE', $table_prefix.'digests_config');
define('DIGEST_LOG_TABLE', $table_prefix.'digests_log');
#
#-----[ OPEN ]------------------------------------------
#
includes/emailer.php
#
#-----[ FIND ]------------------------------------------
#
function send()
#
#-----[ REPLACE WITH ]------------------------------------------
#
function send($is_html = '')
#
#-----[ FIND ]------------------------------------------
#
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : '');
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ($is_html)
		{
 			$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : '');
		}
		else 
		{
			$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : '');
		}
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
function init_userprefs($userdata)
{
	global $board_config, $theme, $images;
	global $template, $lang, $phpEx, $phpbb_root_path;
	global $nav_links;
#
#-----[ REPLACE WITH ]------------------------------------------
#
function init_userprefs($userdata, $mode = '')
{
	global $board_config, $theme, $images;
	global $lang, $phpEx, $phpbb_root_path;
	global $nav_links;

	if ($mode != 'digest')
	{
		global $template;
	}
#
#-----[ FIND ]------------------------------------------
#
if ( $theme = setup_style($userdata['user_style']) )
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $theme = setup_style($userdata['user_style'], $mode) )
#
#-----[ FIND ]------------------------------------------
#
$theme = setup_style($board_config['default_style']);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$theme = setup_style($board_config['default_style'], $mode);
#
#-----[ FIND ]------------------------------------------
#
function setup_style($style)
{
	global $db, $board_config, $template, $images, $phpbb_root_path;
#
#-----[ REPLACE WITH ]------------------------------------------
#
function setup_style($style, $mode = '')
{
	global $db, $board_config, $images, $phpbb_root_path;

	if ($mode != 'digest')
	{
		global $template;
	}
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
&$attach_sig,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 &$urgent_post,
#
#-----[ FIND ]------------------------------------------
#
$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig, urgent_post) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig, $urgent_post)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";
#
#-----[ FIND ]------------------------------------------
#
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">';
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($urgent_post) 
    { 
		$sql = "UPDATE " . DIGEST_CONFIG_TABLE . "
			SET config_value = 1
			WHERE config_name = 'urgent_run_required'";

		if (!$db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Error updating digest config table', '', __LINE__, __FILE__, $sql);
		}
		  
        $message = $lang['Urgent_stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); 
   }    
   else 
   { 
#
#-----[ FIND ]------------------------------------------
#
$message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
#
#-----[ AFTER, ADD ]------------------------------------------
#
}
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
	'L_MEMBERLIST' => $lang['Memberlist'], 
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'L_DIGESTS' => $lang['Digests'], 
#
#-----[ FIND ]------------------------------------------
#
	'U_MEMBERLIST' => append_sid('memberlist.'.$phpEx), 
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'U_DIGESTS' => append_sid('digests_user_cp.'.$phpEx),	
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
//
// Check and initialize some variables if needed
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'digests_common.'.$phpEx);
#
#-----[ FIND ]------------------------------------------
#
	if ( $mode == 'register' )
	{
		$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];

		$allowhtml = ( isset($HTTP_POST_VARS['allowhtml']) ) ? ( ($HTTP_POST_VARS['allowhtml']) ? TRUE : 0 ) : $board_config['allow_html'];
		$allowbbcode = ( isset($HTTP_POST_VARS['allowbbcode']) ) ? ( ($HTTP_POST_VARS['allowbbcode']) ? TRUE : 0 ) : $board_config['allow_bbcode'];
		$allowsmilies = ( isset($HTTP_POST_VARS['allowsmilies']) ) ? ( ($HTTP_POST_VARS['allowsmilies']) ? TRUE : 0 ) : $board_config['allow_smilies'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$digest_auto = (isset($HTTP_POST_VARS['digest_auto'])) ? (($HTTP_POST_VARS['digest_auto']) ? 1 : 0) : $digest_config['auto_subscribe'];
		$digest_new = (isset($HTTP_POST_VARS['digest_new'])) ? (($HTTP_POST_VARS['digest_new']) ? 2 : 0) :  $digest_config['new_sign_up'];
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . USERS_TABLE . "	(user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_allow_pm
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_digest_status
#
#-----[ FIND ]------------------------------------------
#
 $user_lang) . "', $user_style, 0, 1
#
#-----[ IN-LINE FIND ]------------------------------------------
#
 1
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, ".($digest_auto + $digest_new)." 
#
#-----[ FIND ]------------------------------------------
#
	if ( $mode == 'editprofile' )
	{
		$template->assign_block_vars('switch_edit_profile', array());
	}
#
#-----[ AFTER, ADD ]------------------------------------------
#
	
	if ($mode == 'register')
	{
		if ($digest_config['auto_subscribe'] == 1)
		{
			$template->assign_block_vars('switch_auto_subscribe_digest', array());
		}

		if ($digest_config['new_sign_up'] == 1)
		{
			$template->assign_block_vars('switch_new_sign_up', array());
		}
	}
#
#-----[ FIND ]------------------------------------------
#
'SMILIES_STATUS' => $smilies_status,
#
#-----[ AFTER, ADD ]------------------------------------------
#
		'DIGEST_AUTO_YES' => ( $digest_auto ) ? 'checked="checked"' : '',
		'DIGEST_AUTO_NO' => ( !$digest_auto ) ? 'checked="checked"' : '',
		'DIGEST_NEW_YES' => ( $digest_new ) ? 'checked="checked"' : '',
		'DIGEST_NEW_NO' => ( !$digest_new ) ? 'checked="checked"' : '',
#
#-----[ FIND ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
		'L_DIGEST_AUTO' => sprintf($lang['Digest_user_auto'], get_group_name($digest_config['auto_subscribe_group'])),
		'L_DIGEST_NEW' => $lang['Digest_user_new'],
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_faq.php
#
#-----[ FIND ]------------------------------------------
#
//
// This ends the FAQ entries
//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$faq[] = array("--","Email Digests");
$faq[] = array("What are Digests?", "Digests are email messages sent to you periodically with a summary of the postings made here.");
$faq[] = array("Why would I want a digest?", "It makes your life easier. You do not have to explicitly visit this site to see what conversations are going on around here. Just read your digest and if there is a topic that seems of interest, click on it in your email program and start participating! Unsubscribe at any time.");
$faq[] = array("How often are digests sent?", "You pick how often they are sent. You can select the frequency between digests when you set them up. So if its a busy forum, and you always want to be on top setup the digest to be sent every hour. If its a slow forum, and you just want to keep a lazy eye, use something like daily or weekly.");
$faq[] = array("Suppose I do not want summaries of every message here. Can I be selective?", "Yes. You can pick the forum or forums that interest you. By default you will get messages for all forums that you are allowed to access.");
$faq[] = array("Can I have more than one digest?", "Yes, you can have several digests, each with their own frequency - but a forum can only be in one digest. For example you can Forum A & Forum D every hour, you can have Forum G daily, you can have Forum C weekly and you can have Forum B, Forum E & Forum F monthly. This way you will only be notified of postings once.");
$faq[] = array("What email message formats are available?", "We can send you HTML or text. Unless your email program cannot handle HTML (very unusual these days) we suggest HTML. Frankly, text digests look pretty plain and are harder to use. That is the nature of plain text.");
$faq[] = array("Do I get the whole message text in the digest?", "By default you get the first 150 characters of the text, or you can elect to see either all of the message text or just see the topic subject instead. We recommend keeping the default message length because otherwise your digests may get so big as to be unusable. We have also heard that very large digests may be rejected by your ISP or put you over your server storage quota. An excerpt reduces bandwidth and is usually all that is needed. Why? Because each message has a convenient link that will take you to the topic or message of interest.");
$faq[] = array("How do I get started?", "Just click on the Digests link near the top right part of any page. Or if you prefer <a href=\"./digests_user_cp.php\">click here</a>.");
$faq[] = array("Can I unsubscribe?", "Of course! Just go to the same page and check the  \"Delete this digest\" box. Then submit the form. Your subscription, to that digest, will end immediately.");
$faq[] = array("Are digests commercial free?", "Of course. There are no annoying ads nor will there ever be any on our site.");
$faq[] = array("Is my privacy protected?", "Yes, your digest is sent to you at the email address you gave us in your profile. Think of the digest as a special edition newspaper customized just for you. Someone else is likely getting a completely different digest."); 
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#

//
// Digest Mod
//
$lang['Digests'] = 'Email Digests';
$lang['Digest_options'] = 'Digest Options';
$lang['Digest_confirm_title'] = 'Confirm Digest Subscription';
$lang['Digest_user_auto'] = 'Upon successful registration automatically subscribe me into the %s digest group';
$lang['Digest_user_new'] = 'Upon successful registration let me select my digest options';
$lang['Group_digests'] = 'Allow group digests';
$lang['Group_digest_explain'] = 'Set to Yes if you want the group moderator to be able to setup a digest for the members of this group. If set to No then the moderator will not be able to configure a digest.';
$lang['Group_digest'] = 'Group digest';
$lang['Urgent_post'] = 'Check this box if this is an URGENT message (to initiate an immediate Digest mailing). Do NOT abuse this feature.  It could take 30 seconds or more for the confirmation page to appear!  Do not click the SUBMIT button more than once!'; 
$lang['Urgent_stored'] = 'Your Urgent message has been entered successfully and the Urgent Digests will be sent out shortly.'; 
$lang['Allow_forum_digest'] = 'Allow digests for this forum';
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/groupcp_info_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END switch_unsubscribe_group_input -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN digest_confirm_input -->
		<input class="mainoption" type="submit" name="digest_confirm" value="{L_DIGEST_CONFIRM}" />
		<!-- END digest_confirm_input -->
#
#-----[ FIND ]------------------------------------------
#
<!-- END switch_mod_option -->
#
#-----[ AFTER, ADD ]------------------------------------------
#

<!-- BEGIN switch_digest_option -->
	<tr>
		<td class="row1" width="20%"><span class="gen">{L_GROUP_DIGEST}:</span></td>
		<td class="row2"><span class="gen"><input class="mainoption" type="submit" name="digest_options" value="{L_DIGEST_OPTIONS}" /></span></td>
	</tr>
	<!-- END switch_digest_option -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
&nbsp;<a href="{U_GROUP_CP}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" hspace="3" />{L_USERGROUPS}</a>&nbsp;
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{L_USERGROUPS}</a>&nbsp;
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

<!-- BEGIN switch_user_logged_in -->
&nbsp;<a href="{U_DIGESTS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_digest.gif" width="12" height="13" border="0" alt="{L_DIGESTS}" hspace="3" />{L_DIGESTS}</a>&nbsp;
<!-- END switch_user_logged_in -->

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN switch_notify_checkbox -->
		  <tr> 
			<td> 
			  <input type="checkbox" name="notify" {S_NOTIFY_CHECKED} />
			</td>
			<td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td>
		  </tr>
		  <!-- END switch_notify_checkbox -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_urgent_checkbox --> 
		 <tr> 
			<td> 
				<input type="checkbox" name="urgent_post" {S_URGENT_CHECKED}/> 
			</td> 
			<td><span class="gen">{L_URGENT_POST}</span></td> 
		 </tr> 
		  <!-- END switch_urgent_checkbox --> 
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td class="row2"> 
	<input type="radio" name="allowsmilies" value="1" {ALWAYS_ALLOW_SMILIES_YES} />
	<span class="gen">{L_YES}</span>&nbsp;&nbsp; 
	<input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} />
	<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
	
	<!-- BEGIN switch_auto_subscribe_digest -->
	<tr> 
	  <td class="row1"><span class="gen">{L_DIGEST_AUTO}:</span></td>
	  <td class="row2">
		<input type="radio" name="digest_auto" value="1" {DIGEST_AUTO_YES} /><span class="gen">&nbsp;{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="digest_auto" value="0" {DIGEST_AUTO_NO} /><span class="gen">&nbsp;{L_NO}</span></td>
	</tr>
	<!-- END switch_auto_subscribe_digest -->
	
	<!-- BEGIN switch_new_sign_up -->
	<tr> 
	  <td class="row1"><span class="gen">{L_DIGEST_NEW}:</span></td>
	  <td class="row2">
		<input type="radio" name="digest_new" value="2" {DIGEST_NEW_YES} /><span class="gen">&nbsp;{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="digest_new" value="0" {DIGEST_NEW_NO} /><span class="gen">&nbsp;{L_NO}</span></td>
	</tr>
	<!-- END switch_new_sign_up -->

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/forum_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
	<tr> 
	  <td class="row1">{L_FORUM_STATUS}</td>
	  <td class="row2"><select name="forumstatus">{S_STATUS_LIST}</select></td>
	</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#

	<tr> 
      		<td class="row1">{L_DIGEST}</td> 
      		<td valign="top" class="row2"><input type="radio" name="forum_digest" value="1" {FORUM_DIGEST_CHECKED_YES} />{L_YES}&nbsp;&nbsp;<input type="radio" name="forum_digest" value="0" {FORUM_DIGEST_CHECKED_NO} />{L_NO}</td> 
   	</tr>

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/group_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td class="row2" width="62%"> 
		<input type="radio" name="group_type" value="{S_GROUP_OPEN_TYPE}" {S_GROUP_OPEN_CHECKED} /> {L_GROUP_OPEN} &nbsp;&nbsp;<input type="radio" name="group_type" value="{S_GROUP_CLOSED_TYPE}" {S_GROUP_CLOSED_CHECKED} />	{L_GROUP_CLOSED} &nbsp;&nbsp;<input type="radio" name="group_type" value="{S_GROUP_HIDDEN_TYPE}" {S_GROUP_HIDDEN_CHECKED} />	{L_GROUP_HIDDEN}</td> 
	</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#

<tr>
		 <td class="row1" width="38%"><span class="gen">{L_GROUP_DIGESTS}:</span><br /><span class="gensmall">{L_GROUP_DIGESTS_EXPLAIN}</span></td>
		 <td class="row2" width="62%"><input type="radio" name="group_digest" value="0" {S_GROUP_DIGEST_NO} />{L_NO}&nbsp;&nbsp;<input type="radio" name="group_digest" value="1" {S_GROUP_DIGEST_YES} />{L_YES}</td>
	</tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

#
# Now run install_digests.php if not using easymod.
#

# EoM  