[BETA] Dead Man's Switch

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Mon Oct 06, 2008 7:04 pm

BETA: Created ModX package!

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Fri Oct 10, 2008 2:39 pm

Hi Martin,

is it possible that the following line...

Code: Select all

		mail($dead_man_recipients, $dead_man_subject, $dead_man_content, 'From: ' . $dead_man_sender  . "\r\n" . 'Bcc: ' . dead_man_sender);
... is missing a "$" before

Code: Select all

dead_man_sender);
I will test your MOD this weekend. Guess it shouldn't be a problem to set $dead_man_days to 0.2 which is about five hours.

Have a nice weekend
Wolfgang

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Fri Oct 10, 2008 2:47 pm

Version 0.0.2
  • Send a reminder email to the founder three days before pulling the switch
IPB_Refugee, I noticed that error myself a few minutes ago *g* - Thanks anyway! :D

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Fri Oct 10, 2008 3:55 pm

I like your code but I still have to look at it more carefully. E.g. I'm not sure about

Code: Select all

			if ($row['user_lastvisit'] + $dead_man_days * 86400 < time())
yet. I thought the mail should be sent when $row['user_lastvisit'] + $dead_man_days * 86400 > time()
There's a similar part in case 'checking' that I'll have to think about again.

Regards
Wolfgang

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Fri Oct 10, 2008 4:02 pm

IPB_Refugee wrote:yet. I thought the mail should be sent when $row['user_lastvisit'] + $dead_man_days * 86400 > time()
No, as you'll see as I'll make an example:

$lastvisit = 0 (now)
$deadmandays = 13 (about two weeks)

Cycle now: $lastvisit + $deadmandays = 13 > 0

Cycle in a week: $lastvisit + $deadmandays = 13 > 7

Cycle in about two weeks: $lastvisit + $deadmandays = 13 < 14 :arrow: Pull Switch!

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Fri Oct 10, 2008 4:20 pm

Hm,

$row['user_lastvisit'] = 1223655000; // == now according to redio.info/werkzeuge/unix_timestamp.html
$deadmandays = 13; //after 1224778200 the mail should be sent

Cycle in 12 days (22.October 2008, 18:10:00): 1224691800 < 1224778200 -> no mail should be sent
Cycle in 14 days: 1224864600 > 1224778200 // mail has already been sent

But as I said, I'll have to think about it once again.

Regards
Wolfgang

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Fri Oct 10, 2008 4:33 pm

IPB_Refugee wrote:mail has already been sent
You have to think of it as "mail is to be sent".

"Has already been sent" is determined by $config['dead_man'].

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Sun Oct 12, 2008 5:19 pm

Hi Martin,

I wanted a simple but good solution to be able to test your MOD, and for improving my PHP skills I tried to do some coding. :oops: It's not completely tested yet but maybe you (or another interested person) could take a look at it:

*** link removed - please go with Martin's version of this MOD! ***

Have a nice evening
Wolfgang

EDIT:

Bug fix included regarding // Save the user from pointing to a file that does not exist (see next post)
Please note that I consider my version of the MOD as development quality until I have fully tested it. Use it at your own risk or simply go with Martin's MOD. :)
Last edited by IPB_Refugee on Sun Oct 19, 2008 11:19 pm, edited 2 times in total.

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Sun Oct 12, 2008 9:11 pm

Bug found which affects both versions - MartectX's original one and my one from the post above!

I store my deadman.txt file in

http://www.example.com/store/deadman.txt

Therefore I set

Code: Select all

$dead_man_file = 'store/deadman.txt';
But when I tried to access the ACP, I got the error message
Invalid $dead_man_file
Changing

Code: Select all

$dead_man_file = 'store/deadman.txt';
to

Code: Select all

$dead_man_file = '/store/deadman.txt';
didn't help. But here is a bugfix:

Change

Code: Select all

if (isset($dead_man_file) && !file_exists($dead_man_file))
to

Code: Select all

if (isset($dead_man_file) && !file_exists($phpbb_root_path . $dead_man_file))
in deadman.php.

Regards
Wolfgang

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Mon Oct 13, 2008 8:49 am

Ah, thanks for that, IPB_Refugee, I'll incorporate this change later the day.

For your modified version: Why are you frequently purging the cache?

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Mon Oct 13, 2008 11:24 am

Version 0.0.3
  • Send a reminder pm to the founder detailing the reset of the switch

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Mon Oct 13, 2008 12:38 pm

MartectX wrote:For your modified version: Why are you frequently purging the cache?
Not frequently - just when major changes have been made (especially changing to test mode and back). I do it because I don't really trust Olympus' caching system in this case. :oops:

Regards
Wolfgang

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Mon Oct 13, 2008 10:11 pm

MartectX wrote:Send a reminder pm to the founder detailing the reset of the switch
I don't know how useful this feature really is. When the founder has not been visiting his/her board for 28 days (the default value), why should it be better to send him/her the reminder via PM instead of an alert email?

Probably the founder does not have access to the world wide web anymore...
It would be an interesting idea to send the reminder (additionally) via SMS. But I don't know if that's possible.

Regards
Wolfgang

EDIT:

Maybe the line

Code: Select all

$dead_man_content = file_get_contents($dead_man_file);
should be changed to

Code: Select all

$dead_man_content = file_get_contents($phpbb_root_path . $dead_man_file);
too. Really don't know and didn't test it yet... What do you think?

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [BETA] Dead Man's Switch

Post by MartectX » Tue Oct 14, 2008 7:35 am

IPB_Refugee wrote:I don't know how useful this feature really is. When the founder has not been visiting his/her board for 28 days (the default value), why should it be better to send him/her the reminder via PM instead of an alert email?
It's better because the reset of the switch is only viable once the founder logged on again. If that's not the case the switch would instantly send another emergency email.
IPB_Refugee wrote:Maybe the line

Code: Select all

$dead_man_content = file_get_contents($dead_man_file);
should be changed to

Code: Select all

$dead_man_content = file_get_contents($phpbb_root_path . $dead_man_file);
too. Really don't know and didn't test it yet... What do you think?
That's the case as of 0.0.3.

User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [BETA] Dead Man's Switch

Post by IPB_Refugee » Tue Oct 14, 2008 8:58 pm

MartectX wrote:It's better because the reset of the switch is only viable once the founder logged on again. If that's not the case the switch would instantly send another emergency email.
I see.
MartectX wrote:That's the case as of 0.0.3.
Thank you! (I haven't looked at the code of 0.0.3 yet because I'd like to stay with my version of your MOD.)

Locked

Return to “[3.0.x] MODs in Development”

Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot] and 24 guests