Use __DIR__ magic constant instead of environment variable

This commit is contained in:
2018-01-18 02:26:14 -05:00
parent 6dff727f35
commit 1ad482978d
3 changed files with 4 additions and 8 deletions

View File

@ -155,12 +155,11 @@ function SendToMailHandler($input, $params) {
//See if this email address is associated with a particular project
function ParseSenderEmail($from) {
$filePath = getenv('FILEPATH');
$project = $email = NULL;
if(preg_match("/\b([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})\b/i", $from, $matches)) {
$email = $matches[1];
}
if (($handle = fopen($filePath . "/" . "data/usermap.csv", 'r')) !== FALSE) {
if (($handle = fopen(__DIR__ . "/" . "data/usermap.csv", 'r')) !== FALSE) {
while (($data = fgetcsv($handle, 1000)) !== FALSE) {
$users[$data[0]] = $data[1];
}
@ -172,12 +171,11 @@ function ParseSenderEmail($from) {
}
function ParseSenderDomain($email) {
$filePath = getenv('FILEPATH');
$domain = $project = NULL;
if(preg_match("/@(.*)\b/", $email, $matches)) {
$domain = $matches[1];
}
if (($handle = fopen($filePath . "/" . "data/domainmap.csv", 'r')) !== FALSE) {
if (($handle = fopen(__DIR__ . "/" . "data/domainmap.csv", 'r')) !== FALSE) {
while (($data = fgetcsv($handle, 1000)) !== FALSE) {
$domains[$data[0]] = $data[1];
}