Use __DIR__ magic constant instead of environment variable
This commit is contained in:
@ -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];
|
||||
}
|
||||
|
Reference in New Issue
Block a user