Skip to content

Commit 3153a33

Browse files
author
alexweissman
committed
secure functions
Array to allow more than one file containing secure functions
1 parent e1b3bf3 commit 3153a33

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

models/authorization.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,16 @@ function securePage($file){
334334
}
335335

336336
function fetchSecureFunctions(){
337+
global $files_secure_functions;
337338
# The Regular Expression for Function Declarations
338339
$functionFinder = '/function[\s\n]+(\S+)[\s\n]*\(/';
339340
# Init an Array to hold the Function Names
340341
$functionArray = array();
341-
# Load the Content of the PHP File
342-
$fileContents = file_get_contents( FILE_SECURE_FUNCTIONS );
342+
# Load the Content of the secure function files
343+
$fileContents = "";
344+
foreach($files_secure_functions as $file){
345+
$fileContents .= file_get_contents( $file );
346+
}
343347

344348
# Apply the Regular Expression to the PHP File Contents
345349
preg_match_all( $functionFinder , $fileContents , $functionArray );

models/config.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ function logAllErrors($errno, $errstr, $errfile, $errline, array $errcontext) {
8484
defined("MAIL_TEMPLATES")
8585
or define("MAIL_TEMPLATES", dirname(__FILE__) . "/mail-templates/");
8686

87-
defined("FILE_SECURE_FUNCTIONS")
88-
or define("FILE_SECURE_FUNCTIONS", dirname(__FILE__) . "/secure_functions.php");
87+
// Include paths for files containing secure functions
88+
$files_secure_functions = array(
89+
dirname(__FILE__) . "/secure_functions.php"
90+
);
8991

9092
// Include paths for pages to add to site page management
9193
$page_include_paths = array(

0 commit comments

Comments
 (0)