-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
9,469 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php | ||
include 'config.php'; | ||
require_once 'vendor/autoload.php'; | ||
use PHPMailer\PHPMailer\PHPMailer; | ||
|
||
date_default_timezone_set("$timezone"); | ||
$today=date("Y-m-d"); | ||
$dateminus=date('Y-m-d', strtotime("-$howmanydays days")); | ||
|
||
// show beginning header | ||
$message = "<H2>" .$service_body_name. " CHANGES</H2>Changes for last $howmanydays day(s) from " .date("l jS \of F Y h:i A") . "<br><hr>"; | ||
|
||
$url = $bmlt_server. "/client_interface/xml/?switcher=GetChanges&start_date=" .$dateminus. "&end_date=" .$today. "&service_body_id=" .$service_body_id; | ||
|
||
// get xml file contents | ||
$xml = simplexml_load_file($url); | ||
|
||
if (empty($xml)) { | ||
// if no changes found do nothing | ||
} | ||
|
||
else { | ||
// loop begins | ||
foreach($xml->row as $row) { | ||
if( strpos( $row->meeting_name, '_YAP_' ) !== false ) { | ||
// dont show YAP data | ||
} | ||
else { | ||
// begin new paragraph | ||
$message .= "<p>"; | ||
|
||
// show Date | ||
$message .= "<strong>Date:</strong> ".$row->date_string." - "; | ||
|
||
// show Change Type | ||
$change_type=$row->change_type; | ||
if ($change_type == "comdef_change_type_change") { $change_type = "Change"; } | ||
if ($change_type == "comdef_change_type_delete") { $change_type = "DELETE"; } | ||
if ($change_type == "comdef_change_type_new") { $change_type = "New"; } | ||
$message .= "<strong>Change Type:</strong> ".$change_type."<br/>"; | ||
|
||
// show Meeting ID | ||
$message .= "<strong>Meeting (ID) Name:</strong> (".$row->meeting_id.") " .$row->meeting_name."<br/>"; | ||
|
||
// show User Name | ||
$message .= "<strong>User Name:</strong> ".$row->user_name."<br/>"; | ||
|
||
// Show Service Body | ||
$message .= "<strong>Service Body:</strong> ".$row->service_body_name."</br><OL>"; | ||
|
||
// show details | ||
$details=$row->details; | ||
// remove root_server_uri info | ||
$details = str_replace(". root_server_uri was added as \"https:\" "," ",$details); | ||
// Remove last . at end of details | ||
$details = preg_replace('/.$/',"",$details); | ||
// Remove the weird #@-@# from the format codes | ||
$details = str_replace("#@-@#"," ",$details); | ||
// protect email . from being replaced with </br> tag | ||
$details = preg_replace_callback( | ||
'/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})/', | ||
function ($email) { | ||
return str_replace(".","~DOT~",$email[0]); | ||
}, | ||
$details | ||
); | ||
// Look for Latittude and Longitude, change . to ~DOT~ This must happen so we can then find the individual changes and add <li> | ||
$details = preg_replace_callback( | ||
'/from \"[0-9]+\./', | ||
function ($matches) { | ||
return str_replace(".","~DOT~",$matches[0]); | ||
}, | ||
$details | ||
); | ||
$details = preg_replace_callback( | ||
'/to \"[0-9]+\./', | ||
function ($matches) { | ||
return str_replace(".","~DOT~",$matches[0]); | ||
}, | ||
$details | ||
); | ||
$details = preg_replace_callback( | ||
'/from \"-+[0-9]+\./', | ||
function ($matches) { | ||
return str_replace(".","~DOT~",$matches[0]); | ||
}, | ||
$details | ||
); | ||
$details = preg_replace_callback( | ||
'/to \"-+[0-9]+\./', | ||
function ($matches) { | ||
return str_replace(".","~DOT~",$matches[0]); | ||
}, | ||
$details | ||
); | ||
|
||
// Change all the . to <LI> | ||
$details = str_replace(".","<LI>",$details); | ||
|
||
//Change all the ~DOT~ back to . | ||
$details = str_replace("~DOT~",".",$details); | ||
// $details = str_replace("from \"-75</br>"," from \"-75.",$details); | ||
$message .= "<strong>Details:</strong><LI> ".$details."</OL>"; | ||
$message .= "</p> <hr>"; | ||
// end paragraph | ||
} | ||
} | ||
// loop ends | ||
$message .= "END of BMLT Changes"; | ||
//echo $message; // for testing | ||
|
||
//Send Email | ||
$mail = new PHPMailer(true); | ||
$mail->isSMTP(); | ||
$mail->Host = $smtp_host; | ||
$mail->SMTPAuth = true; | ||
$mail->Username = $smtp_username; | ||
$mail->Password = $smtp_password; | ||
$mail->SMTPSecure = $smtp_secure; | ||
if ($smtp_alt_port) { | ||
$mail->Port = $smtp_alt_port; | ||
} elseif ($smtp_secure == 'tls') { | ||
$mail->Port = 587; | ||
} elseif ($smtp_secure == 'ssl') { | ||
$mail->Port = 465; | ||
} | ||
$mail->setFrom($smtp_from_address, $smtp_from_name); | ||
$mail->isHTML(true); | ||
$mail->addAddress($smtp_to_address, $smtp_to_name); | ||
$mail->Body = $message; | ||
$mail->Subject = $smtp_email_subject; | ||
$mail->send(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"require": { | ||
"phpmailer/phpmailer": "6.0.5" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,24 @@ | ||
<?php | ||
static $bmlt_server = 'http://crna.org/main_server'; | ||
static $timezone = 'America/New_York'; | ||
static $service_body_name = 'Carolina Region'; | ||
static $service_body_shortname = 'CRNA'; | ||
static $service_body_website = 'http://crna.org'; | ||
static $bmlt_server = ''; | ||
static $service_body_name = ''; | ||
static $service_body_shortname = ''; | ||
static $service_body_website = ''; | ||
static $service_body_id = '1'; // the BMLT parent service body id number | ||
static $howmanydays = '30'; // this should be set to the same number of days your cron job is set to | ||
|
||
|
||
|
||
//static $from_name = 'Service Body Admin'; | ||
//static $from_email = '[email protected]'; | ||
|
||
static $smtp_to_name = ''; | ||
static $smtp_to_address = ''; | ||
static $smtp_email_subject = 'Service Body BMLT Changes'; | ||
|
||
static $smtp_host = ''; // the smtp server | ||
static $smtp_username = ''; // the smtp username | ||
static $smtp_password = ''; // the smtp password | ||
static $smtp_secure = ''; // either ssl (port 486) or more securely tls (port 587) | ||
static $smtp_from_address = ''; // the address where the email will be sent from | ||
static $smtp_from_name = ''; // the label name on the from address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
mv config.php ../ | ||
git pull origin master | ||
mv ../config.php . |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
// autoload.php @generated by Composer | ||
|
||
require_once __DIR__ . '/composer/autoload_real.php'; | ||
|
||
return ComposerAutoloaderInit211839d18b0c3e24c5457707508f819b::getLoader(); |
Oops, something went wrong.