Duplicator - Bootloader |
version: » dup-installer-bootlog__[HASH].txt |
setHTTPHeaders(); $this->targetRoot = self::setSafePath(dirname(__FILE__)); // clean log file $this->log('', true); $archive_filepath = $this->getArchiveFilePath(); $this->origDupInstFolder = self::INSTALLER_DIR_NAME; $this->targetDupInstFolder = filter_input(INPUT_GET, 'dup_folder', FILTER_SANITIZE_SPECIAL_CHARS, array( "options" => array( "default" => self::INSTALLER_DIR_NAME, ), 'flags' => FILTER_FLAG_STRIP_HIGH)); $this->isCustomDupFolder = $this->origDupInstFolder !== $this->targetDupInstFolder; $this->targetDupInst = $this->targetRoot . '/' . $this->targetDupInstFolder; $this->manualExtractFileName = 'dup-manual-extract__' . self::PACKAGE_HASH; if ($this->isCustomDupFolder) { $this->extractionTmpFolder = $this->getTempDir($this->targetRoot); } else { $this->extractionTmpFolder = $this->targetRoot; } DUPX_CSRF::init($this->targetDupInst, self::PACKAGE_HASH); //ARCHIVE_SIZE will be blank with a root filter so we can estimate //the default size of the package around 17.5MB (18088000) $archiveActualSize = @file_exists($archive_filepath) ? @filesize($archive_filepath) : false; $archiveActualSize = ($archiveActualSize !== false) ? $archiveActualSize : 0; $this->hasZipArchive = class_exists('ZipArchive'); $this->hasShellExecUnzip = $this->getUnzipFilePath() != null ? true : false; $this->archiveExpectedSize = strlen(self::ARCHIVE_SIZE) ? self::ARCHIVE_SIZE : 0; $this->archiveActualSize = $archiveActualSize; if ($this->archiveExpectedSize > 0) { $this->archiveRatio = (((1.0) * $this->archiveActualSize) / $this->archiveExpectedSize) * 100; } else { $this->archiveRatio = 100; } } /** * * @return self */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } /** * Makes sure no caching mechanism is used during install * * @return void */ private function setHTTPHeaders() { header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } /** * Return temp dir * * @param string $path path string * * @return boolean|string */ private function getTempDir($path) { $tempfile = tempnam($path, 'dup-installer_tmp_'); if (file_exists($tempfile)) { unlink($tempfile); mkdir($tempfile); if (is_dir($tempfile)) { return $tempfile; } } return false; } /** * Check php version * * @return void */ public static function phpVersionCheck() { if (version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '>=')) { return true; } $match = null; if (preg_match("#^\d+(\.\d+)*#", PHP_VERSION, $match)) { $phpVersion = $match[0]; } else { $phpVersion = PHP_VERSION; } ?>
This server is running PHP: . A minimum of PHP
is required.
Contact your hosting provider or server administrator and let them know you would like to upgrade your PHP version.
' . htmlspecialchars($log_message) . ''); break; case E_NOTICE: case E_WARNING: default: $log_message = self::getMessage($errno, $errstr, $errfile, $errline); DUPX_Bootstrap::getInstance()->log($log_message); break; } } /** * Get message from error * * @param int $errno errno * @param string $errstr message * @param string $errfile file * @param int $errline line * * @return string */ private static function getMessage($errno, $errstr, $errfile, $errline) { $result = '[PHP ERR]'; switch ($errno) { case E_ERROR: $result .= '[FATAL]'; break; case E_WARNING: $result .= '[WARN]'; break; case E_NOTICE: $result .= '[NOTICE]'; break; default: $result .= '[ISSUE]'; break; } $result .= ' MSG:'; $result .= $errstr; $result .= ' [CODE:' . $errno . '|FILE:' . $errfile . '|LINE:' . $errline . ']'; return $result; } /** * Shutdown handler * * @return void */ public static function shutdown() { if (($error = error_get_last())) { LogHandler::error($error['type'], $error['message'], $error['file'], $error['line']); } } } class DUPX_CSRF { private static $packagHash = null; private static $mainFolder = null; /** * Session var name prefix * @var string */ public static $prefix = '_DUPX_CSRF'; /** * Stores all CSRF values: Key as CSRF name and Val as CRF value * @var array */ private static $CSRFVars = null; /** * Init CSRF * * @param string $mainFolderm main folder * @param string $packageHash hash * * @return void */ public static function init($mainFolderm, $packageHash) { self::$mainFolder = $mainFolderm; self::$packagHash = $packageHash; self::$CSRFVars = null; } /** * Set new CSRF * * @param string $key CSRF Key * @param string $val CSRF Val * * @return Void */ public static function setKeyVal($key, $val) { $CSRFVars = self::getCSRFVars(); $CSRFVars[$key] = $val; self::saveCSRFVars($CSRFVars); self::$CSRFVars = null; } /** * Get CSRF value by passing CSRF key * * @param string $key CSRF key * * @return string|boolean If CSRF value set for give n Key, It returns CRF value otherise returns false */ public static function getVal($key) { $CSRFVars = self::getCSRFVars(); if (isset($CSRFVars[$key])) { return $CSRFVars[$key]; } else { return false; } } /** * Generate DUPX_CSRF value for form * * @param string $form Form name as session key * * @return string token */ public static function generate($form = null) { $keyName = self::getKeyName($form); $existingToken = self::getVal($keyName); if (false !== $existingToken) { $token = $existingToken; } else { $token = DUPX_CSRF::token() . DUPX_CSRF::fingerprint(); } self::setKeyVal($keyName, $token); return $token; } /** * Check DUPX_CSRF value of form * * @param string $token Token * @param string $form Form name as session key * * @return boolean */ public static function check($token, $form = null) { if (empty($form)) { return false; } $keyName = self::getKeyName($form); $CSRFVars = self::getCSRFVars(); if (isset($CSRFVars[$keyName]) && $CSRFVars[$keyName] == $token) { // token OK return true; } return false; } /** Generate token * * @return string */ protected static function token() { $microtime = (int) (microtime(true) * 10000); mt_srand($microtime); $charid = strtoupper(md5(uniqid(rand(), true))); return substr($charid, 0, 8) . substr($charid, 8, 4) . substr($charid, 12, 4) . substr($charid, 16, 4) . substr($charid, 20, 12); } /** Returns "digital fingerprint" of user * * @return string - MD5 hashed data */ protected static function fingerprint() { return strtoupper(md5(implode('|', array($_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'])))); } /** * Generate CSRF Key name * * @param string $form the form name for which CSRF key need to generate * @return string CSRF key */ private static function getKeyName($form) { return DUPX_CSRF::$prefix . '_' . $form; } /** * Get Package hash * * @return string Package hash */ private static function getPackageHash() { if (is_null(self::$packagHash)) { throw new Exception('Not init CSFR CLASS'); } return self::$packagHash; } /** * Get file path where CSRF tokens are stored in JSON encoded format * * @return string file path where CSRF token stored */ private static function getFilePath() { if (is_null(self::$mainFolder)) { throw new Exception('Not init CSFR CLASS'); } $dupInstallerfolderPath = self::$mainFolder; $packageHash = self::getPackageHash(); $fileName = 'dup-installer-csrf__' . $packageHash . '.txt'; $filePath = $dupInstallerfolderPath . '/' . $fileName; return $filePath; } /** * Get all CSRF vars in array format * * @return array Key as CSRF name and value as CSRF value */ private static function getCSRFVars() { if (is_null(self::$CSRFVars)) { $filePath = self::getFilePath(); if (file_exists($filePath)) { $contents = file_get_contents($filePath); if (empty($contents)) { self::$CSRFVars = array(); } else { $CSRFobjs = json_decode($contents); foreach ($CSRFobjs as $key => $value) { self::$CSRFVars[$key] = $value; } } } else { self::$CSRFVars = array(); } } return self::$CSRFVars; } /** * Stores all CSRF vars * * @param array $CSRFVars holds all CSRF key val * @return void */ private static function saveCSRFVars($CSRFVars) { $contents = json_encode($CSRFVars); $filePath = self::getFilePath(); file_put_contents($filePath, $contents); } } /* * * CLASS DEFINITION END ** */ $auto_refresh = isset($_POST['auto-fresh']) ? true : false; DUPX_Bootstrap::phpVersionCheck(); try { $boot = DUPX_Bootstrap::getInstance(); $boot_error = $boot->run(); } catch (Exception $e) { $boot_error = $e->getMessage(); } if ($boot_error == null) { $secure_csrf_token = DUPX_CSRF::generate('secure'); $ctrl_csrf_token = DUPX_CSRF::generate('ctrl-step1'); DUPX_CSRF::setKeyVal('installerOrigCall', DUPX_Bootstrap::getCurrentUrl()); DUPX_CSRF::setKeyVal('installerOrigPath', __FILE__); DUPX_CSRF::setKeyVal('archive', $boot->archive); DUPX_CSRF::setKeyVal('bootloader', $boot->bootloader); DUPX_CSRF::setKeyVal('booturl', '//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); DUPX_CSRF::setKeyVal('bootLogFile', $boot->getBootLogFilePath()); DUPX_CSRF::setKeyVal('package_hash', DUPX_Bootstrap::PACKAGE_HASH); DUPX_CSRF::setKeyVal('secondaryHash', DUPX_Bootstrap::SECONDARY_PACKAGE_HASH); } ?>
Duplicator - Bootloader |
version: » dup-installer-bootlog__[HASH].txt |