Email Digests

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
48
59%
Very Good
17
21%
Good
9
11%
Fair
2
2%
Poor
6
7%
 
Total votes: 82

Indemnity_83
Registered User
Posts: 152
Joined: Sat Apr 10, 2004 9:40 pm
Location: California, United States
Contact:

Post by Indemnity_83 » Tue Apr 13, 2004 6:10 pm

What about your cron script, do you send the file to the php processor, or do you have the script open the mail_digest.php as a web page.

It just seems odd to have to do the whole path to the root. My thoughts are that the diffrence is in whether you use a command like the following:

Code: Select all

00 * * * * /usr/local/bin/php /home/mhamill/mail_digests.php
Or something more like

Code: Select all

00 * * * * wget --delete-after http://www.potomactavern.org/protected_scripts/mail_digests.php --http-user=??? --http-passwd=???
My thoughts are that the latter suggestion may still work with the ../ (parent directory) paramater. Just a thought though.
INDEMNITY
a legal exemption from liability for damages.
BLOG | DORMLIFE

User avatar
snkhan
Registered User
Posts: 110
Joined: Sun Aug 03, 2003 6:34 pm
Location: United Kingdom
Contact:

Post by snkhan » Tue Apr 13, 2004 6:51 pm

Thanks for the template indemnity. If it helps. I am running tghe digest script like this:

Code: Select all

0 * * * * /usr/local/bin/lynx -auth user:password --dump http://www.thekhans.me.uk/secure/mail_digests.php
I had to hard code the path in, as mail_digests.php is stored in a protected directory.

Just out of curiosity, what does the 'delete-after' command in your cron do?

Thanks,


saj
snkhan.co.uk

User avatar
MarkDHamill
Registered User
Posts: 3954
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Post by MarkDHamill » Tue Apr 13, 2004 7:25 pm

I'm not using wget, so perhaps seperate guidance should be used for that environment.

I found in my environment that cron did not seem to be able to find the php interpreter in the environment path, so I had to hardcode the absolute path to it. Mail_digests.php is not designed to return HTML but it will as you know return certain information to standard output, which can appear in the web browser.

User avatar
snkhan
Registered User
Posts: 110
Joined: Sun Aug 03, 2003 6:34 pm
Location: United Kingdom
Contact:

Post by snkhan » Tue Apr 13, 2004 7:46 pm

Hi Mark and indemnity,

What about placing the forum name like so:

{Thread name} in {Forum Name}

You can see something similar to this in my RSS phpBB thing below;

RSS thing Look towards the bottom of the page.

Everything is working nicely now, I've decided that all digest emails are sent in the subSilver theme.

Perhaps the only improvment I can think off is making the vertical allignment of the name and post time to top (valign="top"). But I'll try to incorporate this myself.

Thanks for the great MOD!

saj
snkhan.co.uk

Indemnity_83
Registered User
Posts: 152
Joined: Sat Apr 10, 2004 9:40 pm
Location: California, United States
Contact:

Post by Indemnity_83 » Tue Apr 13, 2004 8:44 pm

snkhan,

I'll likely use your suggestion for the forum name, anything else would have to break away from the standard layouts from the subSilver (and most other) theme.

About making the username valign top, I'll include that in the finished version. If you want to make the change quickly on yours (I'm assuming you know HTML). you can find the <td> tag and its associated stuff on line 339 of the code I posted. Just simply add the valign='top' somewhere in the opening tag.

Thanks for the suggestions!
INDEMNITY
a legal exemption from liability for damages.
BLOG | DORMLIFE

Indemnity_83
Registered User
Posts: 152
Joined: Sat Apr 10, 2004 9:40 pm
Location: California, United States
Contact:

Post by Indemnity_83 » Tue Apr 13, 2004 9:01 pm

snkhan wrote: ...Just out of curiosity, what does the '--delete-after' command in your cron do?


the wget command actually downloads and stores the page in the working directory, so the --delete-after swtich tells wget to remove the file from the working directory after it gets it. Otherwise I have the possibilty of filling up my web space with a million copies of the output from mail_digests.php. It could be handy though to leaveout the --delete-after switch when debuging, it should leave a text file with he output of the script. So you could see that screen that says "x digests sent", even when using a cron job. good way to see if its firing when you want it to also.

using wget is a little bit of a trick to getting something like this to work. Because what it does is it asks the web server for the page, and the web server does the pocessing, instead of the method Mark had recomened which sends the mail_digests directly to the php processor. I have no idea what the pro's and con's to each method is. I dont know enough about the inner workings to give a good answer. But I knew how to use wget, and I didn't know where my host had the php processor at. So it was easier for me.
INDEMNITY
a legal exemption from liability for damages.
BLOG | DORMLIFE

User avatar
snkhan
Registered User
Posts: 110
Joined: Sun Aug 03, 2003 6:34 pm
Location: United Kingdom
Contact:

Post by snkhan » Tue Apr 13, 2004 9:02 pm

Thanks for the update. Yes I made the changes on lines 393+ .
Just for cosmetic reasons, I also changed the following;

Code: Select all

<span class="siteText">{L_SALUTATION} {SALUTATION} </span>
in the HTML.tpl file

I changed the class to siteText, as the cat class was not displaying as nicely. I also changed the CSS class of {DISCLAIMER} to copyright, and it looks a lot nicer now.

saj
snkhan.co.uk

Indemnity_83
Registered User
Posts: 152
Joined: Sat Apr 10, 2004 9:40 pm
Location: California, United States
Contact:

Post by Indemnity_83 » Tue Apr 13, 2004 9:20 pm

good calls on both class changes, especially the sitetext one. Thats a much better font.
INDEMNITY
a legal exemption from liability for damages.
BLOG | DORMLIFE

User avatar
MarkDHamill
Registered User
Posts: 3954
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Post by MarkDHamill » Wed Apr 14, 2004 11:11 am

A suggestion and one I tried to adhere to in my development: make sure the resulting HTML when using default .tpl files is XHTML 1.0 or greater compliant, since this is the W3C recommendation. Things like <th align="top"> are probably not compliant anymore, and these would be pushed to the stylesheet.

What you can do is look at the result (in this case of digests.php), save the HTML source doing a View/Source and upload it using the file upload interface with validator.w3.org.

User avatar
tekguru
Registered User
Posts: 139
Joined: Thu Jul 03, 2003 1:33 pm

Post by tekguru » Wed Apr 14, 2004 7:52 pm

One problem I noted today with the new code, I logged a friend at work into my forum to get him to sign up for the digest, and included in the list forums was the 'Administrators' forum, which is set up for ADMIN access only.

Any ideas why this might be happening? No ideas if he will get the messages from the area.

If anyone wishes to verify I can set up a dummy test account.

User avatar
tekguru
Registered User
Posts: 139
Joined: Thu Jul 03, 2003 1:33 pm

Post by tekguru » Wed Apr 14, 2004 7:54 pm

I've also noticed that the links in the footer are linking to 'blkank', have I missed a setting?

User avatar
MarkDHamill
Registered User
Posts: 3954
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Post by MarkDHamill » Wed Apr 14, 2004 11:53 pm

Unless your friend has administrator privileges, he probably can't get messages from that forum.. (I assume you set the forum for administrators only.) The software only presents for subscription those forums for which a user has been granted access

Come to think about it, I never code anything to check for admininstrator privileges. The code looks for forums open to registered users, and also adds those forums for which they have specifically been granted user privileges. But it shouldn't matter since an administrator should have permissions to view all forums automatically.

You don't want a user who should not read messages in a protected forum to see in email that which they cannot view when they come to the site. This would be a security problem.

You should not be able to subscribe a user for a digest unless you log in as them.

I'm not sure about the footer issue. It sounds like maybe a type in mail_digests.tpl.

User avatar
tekguru
Registered User
Posts: 139
Joined: Thu Jul 03, 2003 1:33 pm

Post by tekguru » Thu Apr 15, 2004 4:34 am

WEll to test the problem (this is using hte HTML code from Indemnity_83) I created a new user last night with very basic privs and went into the Digest, the option was there to subscribe to the 'Site Admin' forum, I selected it and placed a test message in the Admin forum to give a test base.

This morning a digest was here for the user and the Admin forum test message was included. :cry:

Any ideas what areas I need to check?

User avatar
tekguru
Registered User
Posts: 139
Joined: Thu Jul 03, 2003 1:33 pm

Post by tekguru » Thu Apr 15, 2004 5:15 am

On further checking the code used in forums.php to check AUTH levels is:

Code: Select all

    //
    // Obtain list of moderators of each forum
    // First users, then groups ... broken into two queries
    //
    $sql = "SELECT aa.forum_id, u.user_id, u.username
        FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
        WHERE aa.auth_mod = " . TRUE . "
            AND g.group_single_user = 1
            AND ug.group_id = aa.group_id
            AND g.group_id = aa.group_id
            AND u.user_id = ug.user_id
        GROUP BY u.user_id, u.username, aa.forum_id
        ORDER BY aa.forum_id, u.user_id";
    if ( !($result = $db->sql_query($sql)) )
    {
        message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
    }

    $forum_moderators = array();
    while( $row = $db->sql_fetchrow($result) )
    {
        $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
    }

    $sql = "SELECT aa.forum_id, g.group_id, g.group_name
        FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
        WHERE aa.auth_mod = " . TRUE . "
            AND g.group_single_user = 0
            AND g.group_type <> " . GROUP_HIDDEN . "
            AND ug.group_id = aa.group_id
            AND g.group_id = aa.group_id
        GROUP BY g.group_id, g.group_name, aa.forum_id
        ORDER BY aa.forum_id, g.group_id";
    if ( !($result = $db->sql_query($sql)) )
    {
        message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
    }

    while( $row = $db->sql_fetchrow($result) )
    {
        $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
    }
and that in digests:

Code: Select all

		// Now we need to add to our forums array other forums that may be private for which
		// the user has access.

		$sql = 'SELECT DISTINCT a.forum_id, f.forum_name, c.cat_order, f.forum_order
			FROM ' . AUTH_ACCESS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . FORUMS_TABLE . ' f, ' . CATEGORIES_TABLE . ' c
			WHERE ug.user_id = ' . $userdata['user_id']
			. ' AND ug.user_pending = 0 
			AND a.group_id = ug.group_id AND 
			a.forum_id = f.forum_id AND f.cat_id = c.cat_id';

		if ( !($result = $db->sql_query($sql)))
		{
			message_die(GENERAL_ERROR, 'Could not query forum information', '', __LINE__, __FILE__, $sql);
		}

		while ($row = $db->sql_fetchrow ($result)) 
		{ 
			$forum_ids [$i] = $row['forum_id'];
			$forum_names [$i] = $row['forum_name'];
			$cat_orders [$i] = $row['cat_order'];
			$forum_orders [$i] = $row['forum_order'];
			$i++;
		}
		$i--;
The permissions on the forum are to allow designated MODs only access of which of course the test user isn't a MOD. I've verified the user can not acces the Admin forum from within the site. Does this help at all? I can of course provide an complete copy of forum.php if needed as quite a few MODs have been applied to the forum itself.

masterdavid
Registered User
Posts: 222
Joined: Tue Jul 08, 2003 1:26 pm

Post by masterdavid » Thu Apr 15, 2004 3:43 pm

I have observed that there is a problem with the links in the disclaimer portion of the mail. I changed it to something like this:

Code: Select all

$lang['digest_disclaimer_html'] = '\r\nThis digest is being sent to registered members of <a href="%s">%s</a> forums and only because you explicitly requested it. %s is completely commercial free. Your email address is never disclosed to outside parties. See our <a href="%sfaq.%s">FAQ</a> for more information on our privacy policies. You can change or delete your subscription by logging into %s from the <a href="%sdigests.%s">Digest Page</a>. (You must be logged in to change your digest settings.) If you have questions or feedback on the format of this digest please send it to the <a href="mailto:%s">%s Webmaster</a>.';

Code: Select all

'DISCLAIMER' => ($html) ? sprintf($lang['digest_disclaimer_html'], $siteURL, $board_config['sitename'], $board_config['sitename'], $siteURL, $phpEx, $board_config['sitename'], $siteURL, $phpEx, $board_config['board_email'], $board_config['sitename'])  : sprintf($lang['digest_disclaimer_text'], $board_config['sitename'], $board_config['sitename'], $board_config['sitename'], $board_config['board_email'])
Please take a look at this part.

Post Reply

Return to “[2.0.x] MOD Database Releases”