/** * Generate hash to check. * * Generates a two-factor hash based on key and time which can then be compared to the value entered. * * @since 1.2.0 * * @access private * * @param string $key the key to encode * @param mixed $time timestamp * * @return string the hash */ private function get_code( $key, $time = false ) { require_once( dirname( __FILE__ ) . '/lib/base32.php' ); $base = new Base32(); $secret = $base->toString( $key ); if ( false === $time ) { $time = floor( time() / 30 ); } $timestamp = pack( 'N*', 0 ) . pack( 'N*', $time ); $hash = hash_hmac( 'sha1', $timestamp, $secret, true ); $offset = ord( $hash[19] ) & 0xf; $code = ( ( ( ord( $hash[ $offset + 0 ] ) & 0x7f ) << 24 ) | ( ( ord( $hash[ $offset + 1 ] ) & 0xff ) << 16 ) | ( ( ord( $hash[ $offset + 2 ] ) & 0xff ) << 8 ) | ( ord( $hash[ $offset + 3 ] ) & 0xff ) ) % pow( 10, 6 ); return str_pad( $code, 6, '0', STR_PAD_LEFT ); }
if (true === $min_errorLogger) { require_once 'FirePHP.php'; $min_errorLogger = FirePHP::getInstance(true); } Minify_Logger::setLogger($min_errorLogger); } // check for URI versioning if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) { $min_serveOptions['maxAge'] = 31536000; } // Base32 Decode URL Components if ($min_encodeURL) { include '../system/library/base32.php'; $base32_encode = new Base32(); $parts = explode('/', str_replace($_SERVER['REQUEST_QUERY'], '', $_SERVER['REQUEST_URI'])); $fbase = $base32_encode->toString($parts[count($parts) - 2]); if (substr($fbase, 0, 2) == 'f=') { $_GET['f'] = str_replace('f=', '', $fbase); } $bbase = $base32_encode->toString($parts[count($parts) - 3]); if (substr($bbase, 0, 2) == 'b=') { $_GET['b'] = str_replace('b=', '', $bbase); } } if (isset($_GET['f'])) { $_GET['f'] = str_replace("", '', (string) $_GET['f']); } if (isset($_GET['b'])) { $_GET['b'] = str_replace("", '', (string) $_GET['b']); } if (isset($_GET['f'])) {