function Verify($fileName, $pwdString, &$keyString, &$arErrors) { $fileName = Trim($fileName); if (StrLen($fileName) <= 0) { $arErrors[] = GetMessage("MFC1_FILE_NOT_SET") . ". "; return false; } $pwdString = Trim($pwdString); if (StrLen($pwdString) <= 0) { $arErrors[] = GetMessage("MFC1_PWD_NOT_SET") . ". "; return false; } $fileString = CFileCheckerUtil::GetFileContents($fileName); if (StrLen($fileString) <= 0) { $arErrors[] = GetMessage("MFC1_EMPTY_FILE") . ". "; return false; } if (preg_match("#<" . "\\?[\\s]*define\\(\"BX_INTEGRITY_VALUE\",[\\s]*'([^']*?)'\\);?[\\s]*\\?" . ">#i", $fileString, $arMatches)) { $data = $arMatches[1]; if (StrLen($data) > 0) { $fileString = preg_replace("#<" . "\\?[\\s]*define\\(\"BX_INTEGRITY_VALUE\",[\\s]*'[^']*?'\\);?[\\s]*\\?" . ">#i", "", $fileString); $currentCRC = sprintf("%u", crc32($fileString)); if ($arIntegrityParams = CFileCheckerSubscriber::__GetIntegrityParams($data, $pwdString)) { if ($arIntegrityParams["CRC"] != $currentCRC) { $arErrors[] .= GetMessage("MFC1_CRC_NOT_CORRECT") . ". "; return false; } else { $keyString = $arIntegrityParams["KEY"]; $keyString = CFileCheckerUtil::decrypt($keyString, CFileChecker::getIntegrityKey()); return true; } } else { $arErrors[] .= GetMessage("MFC1_NO_CRC") . ". "; return false; } } else { $arErrors[] .= GetMessage("MFC1_NO_CRC") . ". "; return false; } } else { $arErrors[] .= GetMessage("MFC1_NO_CRC_NOT_SET") . ". "; return false; } return false; }