[DEV] Email reports
Geplaatst: 06 dec 2004, 15:26
Deze mod heeft PseudoCron nodig.
Geupdate naar 0.0.2
Code: Selecteer alles
##############################################################
## MOD Title: Email Reports
## MOD Author: bast < bas.timmer@gmail.com > (Bas) http://btweb.no-ip.biz:30000/
## MOD Description: This mod sends reports by email.
## MOD Version: 0.0.2
##
## Installation Level: Easy
## Installation Time: 5 minutes
## Files To Edit: includes/pseudocron.php
## includes/usercp_register.php
## Included Files:
## Generator: MOD Studio 3.0 Alpha 1 [mod functions 0.2.1677.25348]
##############################################################
## 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 MOD requires PseudoCron by Xore (http://www.phpbb.com/phpBB/viewtopic.php?t=127388)
##############################################################
## MOD History:
##
## 2004-12-06 - Version 0.0.1
##
## - First test-release.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cronreport', NOW());
#
#-----[ OPEN ]------------------------------------------
#
includes/pseudocron.php
#
#-----[ FIND ]------------------------------------------
#
default:
if ( $mode == "pseudocron")
{
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// mod: Email Reports
//
case cron_next($i):
if ( cron_email() )
{
if ( $mode == "pseudocron")
{
updatepseudocronstatus();
}
$cronstatus++;
}
return false;
break;
//
// end mod: Email Reports
//
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
# Verander wel het $adres!
// mod: Email Reports
function cron_email()
{
global $db, $board_config;
$adres = "je.email@adres.com";
$file = $phpbb_root_path . "report.txt";
$updatetime = $board_config['cronreport'];
if (!$updatetime <= filemtime($file)) {
if (!mail($adres, "Rapport van " . time(), file_get_contents($file))) {
message_die(GENERAL_ERROR, "Error emailing report", '', __LINE__, __FILE__);
} else {
//message_die(GENERAL_ERROR, "updatetime comparision: ".($updatetime <= filemtime($file))."<br />".$updatetime, '', __LINE__, __FILE__);
unlink($file . ".bak");
$filep = fopen($file . ".bak", "w");
fwrite($filep, "blaaaaaaaaaaaaaaaat");
fclose($filep);
$filep = fopen($file, "w");
fclose($filep);
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = ".time()."
WHERE config_name = 'cronreport'";
$db->sql_query($sql);
// copy($file, $file.".bak");
}
}
return true;
}
// end mod: email reports
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
{
$user_actkey = gen_rand_string(true);
$key_len = 54 - (strlen($server_url));
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// mod: Email Reports
if (!file_exists($phpbb_root_path."report.txt")) {
$reportfile = fopen($phpbb_root_path."report.txt", "w");
} else {
$reportfile = fopen($phpbb_root_path."report.txt", "a");
}
copy($phpbb_root_path."report.txt", $phpbb_root_path."report.txt.bak");
fwrite($reportfile, "==================\r\n");
fwrite($reportfile, "Nieuwe registratie\r\n");
fwrite($reportfile, "==================\r\n");
fwrite($reportfile, "Gebruikersnaam: ".str_replace("\'", "''", $username)."\r\nGebruikers id: ".$user_id."\r\n=====\r\nEINDE\r\n=====\r\n");
fclose($reportfile);
// end mod: Email Reports
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM