Skip to content

Commit

Permalink
v3.1 - ScanCore to v0.9, PHP-AV v4.1.
Browse files Browse the repository at this point in the history
-v3.1.
-ScanCore to v0.9, PHP-AV v4.1.
-Correct logging location, remove erroneous log directory created alongside ScanCore.
-Improve argument handling.
-Add $AllowStreams config entry to selectivly disable stream formats.
  • Loading branch information
zelon88 committed Jan 5, 2023
1 parent b56d8ae commit bf5bdd3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
// / Valid options are TRUE or FALSE.
// / Default is TRUE.
$AllowUserShare = TRUE;
// / --Allow Stream Formats as Input--
// / If set to TRUE, stream formats will be supported as input, which contain URLs to external sources.
// / If set to FALSE, stream formats will not be supported as input.
// / Valid options are TRUE or FALSE.
// / Default is TRUE.
$AllowStreams = TRUE;
// / --File Deletion Age Theshold--
// / Age in minutes of files to be deleted.
// / Set to 0 to keep files indefinately.
Expand Down
14 changes: 8 additions & 6 deletions convertCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function verifyTime() {
function sanitizeString($Variable, $strict) {
if ($strict) $Variable = htmlentities(trim(str_replace(' ', '_', str_replace('..', '', str_replace('//', '', str_replace(str_split('|\\~#[](){};:$!#^&%@>*<"\'/'), '', $Variable))))), ENT_QUOTES, 'UTF-8');
if (!$strict) $Variable = htmlentities(trim(str_replace(' ', '_', str_replace('..', '', str_replace('//', '', str_replace(str_split('|\\[](){};"\''), '', $Variable))))), ENT_QUOTES, 'UTF-8');
// / Manually clean up sensitive memory. Helps to keep track of variable assignments.
$strict = NULL;
unset($strict);
return $Variable; }
Expand Down Expand Up @@ -102,7 +103,7 @@ function sanitize($Variable, $strict) {
// / A function to load required HRConvert2 files.
function verifyInstallation() {
// / Set variables.
global $Salts1, $Salts2, $Salts3, $Salts4, $Salts5, $Salts6, $URL, $VirusScan, $AllowUserVirusScan, $InstLoc, $ServerRootDir, $ConvertLoc, $LogDir, $ApplicationName, $ApplicationTitle, $SupportedLanguages, $DefaultLanguage, $AllowUserSelectableLanguage, $DeleteThreshold, $Verbose, $MaxLogSize, $Font, $ButtonStyle, $ShowGUI, $ShowFinePrint, $TOSURL, $PPURL, $ScanCoreMemoryLimit, $ScanCoreChunkSize, $ScanCoreDebug, $ScanCoreVerbose, $defaultButtonCode, $greenButtonCode, $blueButtonCode, $redButtonCode, $SpinnerStyle, $SpinnerColor, $URL, $AllowUserShare;
global $Salts1, $Salts2, $Salts3, $Salts4, $Salts5, $Salts6, $URL, $VirusScan, $AllowUserVirusScan, $InstLoc, $ServerRootDir, $ConvertLoc, $LogDir, $ApplicationName, $ApplicationTitle, $SupportedLanguages, $DefaultLanguage, $AllowUserSelectableLanguage, $DeleteThreshold, $Verbose, $MaxLogSize, $Font, $ButtonStyle, $ShowGUI, $ShowFinePrint, $TOSURL, $PPURL, $ScanCoreMemoryLimit, $ScanCoreChunkSize, $ScanCoreDebug, $ScanCoreVerbose, $defaultButtonCode, $greenButtonCode, $blueButtonCode, $redButtonCode, $SpinnerStyle, $SpinnerColor, $URL, $AllowUserShare, $AllowStreams;
$InstallationIsVerified = TRUE;
$ConfigFile = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.php');
$StyleCoreFile = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'styleCore.php');
Expand Down Expand Up @@ -333,10 +334,11 @@ function verifyLanguage() {
// / A function to set the global variables for the session.
function verifyGlobals() {
// / Set variables.
global $URL, $URLEcho, $HRConvertVersion, $Date, $Time, $SesHash, $SesHash2, $SesHash3, $SesHash4, $CoreLoaded, $ConvertDir, $InstLoc, $ConvertTemp, $ConvertTempDir, $ConvertGuiCounter1, $DefaultApps, $RequiredDirs, $RequiredIndexes, $DangerousFiles, $Allowed, $DangerousFiles1, $ArchiveArray, $DearchiveArray, $DocumentArray, $DocArray, $SpreadsheetArray, $PresentationArray, $ImageArray, $MediaArray, $VideoArray, $StreamArray, $DrawingArray, $ModelArray, $ConvertArray, $PDFWorkArr, $ConvertLoc, $DirSep, $SupportedConversionTypes, $Lol, $Lolol, $Append, $PathExt, $ConsolidatedLogFileName, $ConsolidatedLogFile, $Alert, $Alert1, $Alert2, $Alert3, $FCPlural, $FCPlural1, $FCPlural2, $FCPlural3, $UserClamLogFile, $UserClamLogFileName, $UserScanCoreLogFile, $UserScanCoreFileName, $SpinnerStyle, $SpinnerColor, $FullURL, $ServerRootDir;
global $URL, $URLEcho, $HRConvertVersion, $Date, $Time, $SesHash, $SesHash2, $SesHash3, $SesHash4, $CoreLoaded, $ConvertDir, $InstLoc, $ConvertTemp, $ConvertTempDir, $ConvertGuiCounter1, $DefaultApps, $RequiredDirs, $RequiredIndexes, $DangerousFiles, $Allowed, $DangerousFiles1, $ArchiveArray, $DearchiveArray, $DocumentArray, $DocArray, $SpreadsheetArray, $PresentationArray, $ImageArray, $MediaArray, $VideoArray, $StreamArray, $DrawingArray, $ModelArray, $ConvertArray, $PDFWorkArr, $ConvertLoc, $DirSep, $SupportedConversionTypes, $Lol, $Lolol, $Append, $PathExt, $ConsolidatedLogFileName, $ConsolidatedLogFile, $Alert, $Alert1, $Alert2, $Alert3, $FCPlural, $FCPlural1, $FCPlural2, $FCPlural3, $UserClamLogFile, $UserClamLogFileName, $UserScanCoreLogFile, $UserScanCoreFileName, $SpinnerStyle, $SpinnerColor, $FullURL, $ServerRootDir, $AllowStreams;
$HRConvertVersion = 'v3.0';
$CoreLoaded = $GlobalsAreVerified = TRUE;
$SupportedConversionTypes = array('Document', 'Image', 'Model', 'Drawing', 'Video', 'Stream', 'Audio', 'Archive');
$SupportedConversionTypes = array('Document', 'Image', 'Model', 'Drawing', 'Video', 'Audio', 'Archive');
if ($AllowStreams) array_push($SupportedConversionTypes, 'Stream');
$DirSep = DIRECTORY_SEPARATOR;
$Lol = PHP_EOL;
$Lolol = $Lolol;
Expand Down Expand Up @@ -1513,7 +1515,7 @@ function userClamScan($FilesToScan) {
// / A fuction to prepare the execution environment for ScanCore.
function startScanCore($pathname, $UserScanCoreLogFile) {
// / Set variables.
global $InstLoc, $LogDir, $MaxLogSize, $ScanCoreMemoryLimit, $ScanCoreChunkSize, $ScanCoreDebug, $ScanCoreVerbose, $DirSep, $ScanCoreVerbose, $ScanCoreDebug, $Date, $SesHash, $SesHash2;
global $InstLoc, $ConvertDir, $MaxLogSize, $ScanCoreMemoryLimit, $ScanCoreChunkSize, $ScanCoreDebug, $ScanCoreVerbose, $DirSep, $ScanCoreVerbose, $ScanCoreDebug, $Date, $SesHash, $SesHash2;
$ReturnData = $scVerbose = $scDebug = '';
$ScanCoreFile = $InstLoc.$DirSep.'Resources'.$DirSep.'ScanCore'.$DirSep.'scanCore.php';
$scInc = 0;
Expand All @@ -1522,8 +1524,8 @@ function startScanCore($pathname, $UserScanCoreLogFile) {
// / Make sure that ScanCore is installed.
if (!file_exists($ScanCoreFile)) errorEntry('Could not verify the ScanCore Virus Scanner!', 18000, TRUE);
// / The filename for the ScanCore log file.
$scLogFile = $LogDir.$DirSep.'ScanCore_'.$SesHash.'_'.$SesHash2.'_'.$Date.'_'.$scInc.'_Log.txt';
while (file_exists($scLogFile)) $scLogFile = $LogDir.$DirSep.'ScanCore_'.$SesHash.'_'.$SesHash2.'_'.$Date.'_'.$scInc++.'_Log.txt';
$scLogFile = $ConvertDir.$DirSep.'ScanCore_'.$SesHash.'_'.$SesHash2.'_'.$Date.'_'.$scInc.'_Log.txt';
while (file_exists($scLogFile)) $scLogFile = $ConvertDir.$DirSep.'ScanCore_'.$SesHash.'_'.$SesHash2.'_'.$Date.'_'.$scInc++.'_Log.txt';
// / Run ScanCore with the information supplied.
$ReturnData = shell_exec('php '.$ScanCoreFile.' '.$pathname.' -m '.$ScanCoreMemoryLimit.' -c '.$ScanCoreChunkSize.' -lf '.$scLogFile.' -rf '.$UserScanCoreLogFile.' -ml '.$MaxLogSize.' -r'.$scVerbose.$scDebug);
// / Manually clean up sensitive memory. Helps to keep track of variable assignments.
Expand Down
2 changes: 1 addition & 1 deletion versionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@

// / -----------------------------------------------------------------------------------
// / The version of this HRConvert2 installation.
$Version = 'v3.0';
$Version = 'v3.1';
// / -----------------------------------------------------------------------------------

0 comments on commit bf5bdd3

Please sign in to comment.