@@ -36,17 +36,17 @@ function extractFiles($directory, $request_files, $lib_extraction)
36
36
// separated by "|" to be used in regular expressions. They are also
37
37
// used as keys in an array that will contain the paths of all the
38
38
// extracted files.
39
- $ EXTENSIONS = array ("c " , "cpp " , "h " , "inc " , "ino " , "o " , "S " );
39
+ $ allowedExtensions = array ("c " , "cpp " , "h " , "inc " , "ino " , "o " , "S " );
40
40
$ files = array ();
41
- foreach ($ EXTENSIONS as $ ext )
41
+ foreach ($ allowedExtensions as $ ext )
42
42
$ files [$ ext ] = array ();
43
- $ EXTENSIONS = implode ("| " , $ EXTENSIONS );
43
+ $ allowedExtensions = implode ("| " , $ allowedExtensions );
44
44
// Matches filename that end with an appropriate extension. The name
45
45
// without the extension is stored in registerd 1, the extension itself
46
46
// in register 2.
47
47
//
48
48
// Examples: foo.c bar.cpp
49
- $ REGEX = "/(.*)\.( $ EXTENSIONS )$/ " ;
49
+ $ extensionsRegex = "/(.*)\.( $ allowedExtensions )$/ " ;
50
50
51
51
if (!file_exists ($ directory ))
52
52
mkdir ($ directory , 0777 , true );
@@ -57,7 +57,7 @@ function extractFiles($directory, $request_files, $lib_extraction)
57
57
$ content = $ file ["content " ];
58
58
$ ignore = false ;
59
59
60
- $ failure_response = array (
60
+ $ failureResponse = array (
61
61
"success " => false ,
62
62
"step " => 1 ,
63
63
"message " => "Failed to extract file ' $ filename'. " );
@@ -66,7 +66,7 @@ function extractFiles($directory, $request_files, $lib_extraction)
66
66
// serious security risk.
67
67
$ directories = explode ("/ " , "$ directory/ $ filename " );
68
68
if (in_array (".. " , $ directories ))
69
- return $ failure_response ;
69
+ return $ failureResponse ;
70
70
71
71
if (strpos ($ filename , DIRECTORY_SEPARATOR ))
72
72
{
@@ -84,12 +84,12 @@ function extractFiles($directory, $request_files, $lib_extraction)
84
84
}
85
85
86
86
if (file_put_contents ("$ directory/ $ filename " , $ content ) === false )
87
- return $ failure_response ;
87
+ return $ failureResponse ;
88
88
89
89
if ($ ignore )
90
90
continue ;
91
91
92
- if (preg_match ($ REGEX , $ filename , $ matches ))
92
+ if (preg_match ($ extensionsRegex , $ filename , $ matches ))
93
93
$ files [$ matches [2 ]][] = "$ directory/ $ matches [1 ]" ;
94
94
else
95
95
error_log (__FUNCTION__ ."(): Unhandled file extension ' $ filename' " );
0 commit comments