当前位置: 首页>>代码示例>>PHP>>正文


PHP gzinflate函数代码示例

本文整理汇总了PHP中gzinflate函数的典型用法代码示例。如果您正苦于以下问题:PHP gzinflate函数的具体用法?PHP gzinflate怎么用?PHP gzinflate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了gzinflate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testEncode

 public function testEncode()
 {
     $testString = 'a string to be compressed';
     $result = $this->encoder->encode($testString);
     $uncompressedResult = gzinflate($result);
     $this->assertSame($testString, $uncompressedResult);
 }
开发者ID:brainbits,项目名称:transcoder,代码行数:7,代码来源:DeflateEncoderTest.php

示例2: createAuthnRequestFromHttpRequest

 /**
  * @param Request $httpRequest
  * @return SAML2_AuthnRequest
  * @throws \Exception
  */
 private static function createAuthnRequestFromHttpRequest(Request $httpRequest)
 {
     // the GET parameter is already urldecoded by Symfony, so we should not do it again.
     $samlRequest = base64_decode($httpRequest->get(AuthnRequest::PARAMETER_REQUEST), true);
     if ($samlRequest === false) {
         throw new InvalidRequestException('Failed decoding the request, did not receive a valid base64 string');
     }
     // Catch any errors gzinflate triggers
     $errorNo = $errorMessage = null;
     set_error_handler(function ($number, $message) use(&$errorNo, &$errorMessage) {
         $errorNo = $number;
         $errorMessage = $message;
     });
     $samlRequest = gzinflate($samlRequest);
     restore_error_handler();
     if ($samlRequest === false) {
         throw new InvalidRequestException(sprintf('Failed inflating the request; error "%d": "%s"', $errorNo, $errorMessage));
     }
     // additional security against XXE Processing vulnerability
     $previous = libxml_disable_entity_loader(true);
     $document = SAML2_DOMDocumentFactory::fromString($samlRequest);
     libxml_disable_entity_loader($previous);
     $request = SAML2_Message::fromXML($document->firstChild);
     if (!$request instanceof SAML2_AuthnRequest) {
         throw new RuntimeException(sprintf('The received request is not an AuthnRequest, "%s" received instead', substr(get_class($request), strrpos($request, '_') + 1)));
     }
     return $request;
 }
开发者ID:surfnet,项目名称:stepup-saml-bundle,代码行数:33,代码来源:AuthnRequestFactory.php

示例3: demoapp

 public function demoapp()
 {
     $sharedKey = 'abracadabra';
     $self = 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
     if ($_POST['doit']) {
         $idp = $_POST['idp'];
         if (!$idp) {
             $idp = "sp";
         }
         $request = array('_ID' => sha1(uniqid(mt_rand(), true)), '_Version' => '2.0', '_IssueInstant' => gmdate('Y-m-d\\TH:i:s\\Z', time()), '_Destination' => $self . "/{$idp}/singleSignOnService", '_ForceAuthn' => $_REQUEST['ForceAuthn'] ? 'true' : 'false', '_IsPassive' => $_REQUEST['IsPassive'] ? 'true' : 'false', '_AssertionConsumerServiceURL' => $self . "/main/" . __FUNCTION__, '_AttributeConsumingServiceIndex' => 5, '_ProtocolBinding' => 'JSON-Redirect', 'saml:Issuer' => array('__v' => $self . "/main"));
         foreach ((array) $_REQUEST['IDPList'] as $idp) {
             $idpList[] = array('_ProviderID' => $idp);
         }
         $relayState = 'Dummy RelayState ...';
         if ($idpList) {
             $request['samlp:Scoping']['samlp:IDPList']['samlp:IDPEntry'] = $idpList;
         }
         #$request['samlp:Scoping']['_ProxyCount'] = 2;
         $location = $request['_Destination'];
         $request = "SAMLRequest=" . urlencode(base64_encode(gzdeflate(json_encode($request)))) . ($relayState ? '&RelayState=' . urlencode($relayState) : '');
         $signature = urlencode(base64_encode(sha1($sharedKey . sha1($request))));
         header('Location: ' . $location . "?" . $request . "&Signature=" . $signature);
         print "<a href=\"{$location}?{$request}&Signature={$signature}\">{$location}</a>";
         exit;
     }
     $response = base64_decode($_REQUEST['SAMLResponse']);
     $hSAMLResponse = json_decode(gzinflate($response), 1);
     if ($rs = $_POST['RelayState']) {
         $rs = '&RelayState=' . $rs;
     }
     if ($response && base64_encode(sha1($sharedKey . sha1("jSAMLResponse={$response}{$rs}"))) != $_POST['Signature']) {
         $message = 'Integrity check failed (Sharedkey) ' . $_POST['Signature'] . ' != ' . base64_encode(sha1($sharedKey . sha1("jSAMLResponse={$response}{$rs}")));
     }
     print $this->_server->renderTemplate('demo', array('action' => $self . "/main/demoapp", 'hSAMLResponse' => $hSAMLResponse, 'message' => $message . " RelayState: " . $_GET['RelayState'], 'self' => $self));
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:35,代码来源:DemoServices.php

示例4: init

 /**
  * Get request protocol based on Content-Type
  *
  * @return string default as xmlrpc
  */
 protected function init()
 {
     $ver = phpversion();
     if ($ver[0] >= 5) {
         $data = file_get_contents('php://input');
     } else {
         $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
     }
     if (count($_SERVER) == 0) {
         self::alert('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
     }
     if (isset($_SERVER['HTTP_CONTENT_ENCODING'])) {
         $content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
     } else {
         $content_encoding = '';
     }
     if ($content_encoding != '' && strlen($data)) {
         if ($content_encoding == 'deflate' || $content_encoding == 'gzip') {
             // if decoding works, use it. else assume data wasn't gzencoded
             if (function_exists('gzinflate')) {
                 if ($content_encoding == 'deflate' && ($degzdata = @gzuncompress($data))) {
                     $data = $degzdata;
                 } elseif ($degzdata = @gzinflate(substr($data, 10))) {
                     $data = $degzdata;
                 }
             } else {
                 self::alert('XML-RPC: ' . __METHOD__ . ': Received from client compressed HTTP request and cannot decompress');
             }
         }
     }
     $parsers = php_xmlrpc_decode_xml($data);
     $this->cmd = $parsers->methodname;
     $this->input = php_xmlrpc_decode(new xmlrpcval($parsers->params, 'array'));
 }
开发者ID:ZerGabriel,项目名称:wbb,代码行数:39,代码来源:MbqIoHandleXmlrpc.php

示例5: get

 /**
  * grabs data from the cache and returns it to the user.
  * if data is expired or invalid, returns null.
  *
  * @param string $cacheKey the cache key to set.
  * @return mixed|null
  * @throws FileCacheException
  */
 public function get($cacheKey)
 {
     //make sure key exists in the array.
     $returnVal = null;
     $isValid = $this->isValid($cacheKey);
     if ($isValid === true) {
         $file_contents = "";
         $filename = $this->getFileName($cacheKey);
         //if the cache dir doesn't exist for some reason...
         if (!is_dir($this->cache_dir)) {
             throw new FileCacheException("Could not read cache directory!");
         }
         if (is_file($filename)) {
             $file_contents = file_get_contents($filename);
             if ($this->use_compression) {
                 $file_contents = gzinflate($file_contents);
             }
             $returnVal = unserialize($file_contents);
         }
     } else {
         if ($isValid == -1) {
             $this->expire($cacheKey);
         }
     }
     return $returnVal;
 }
开发者ID:rdcapasso,项目名称:multi-cache,代码行数:34,代码来源:FileCache.php

示例6: decode

 /**
  * (non-PHPdoc).
  *
  * @param string $data
  *
  * @see \Dms\Coding\CodingInterface::decode()
  */
 public function decode($data = null)
 {
     if ($data != null) {
         $this->setData($data);
     }
     return gzinflate($this->data);
 }
开发者ID:buse974,项目名称:dms,代码行数:14,代码来源:Deflate.php

示例7: decryptLink

 public static function decryptLink($link, $ignore_exceptions = false)
 {
     if (preg_match('/^.*?!(?P<data>[0-9a-z_-]+)!(?P<hash>[0-9a-f]+)/i', trim(str_replace('/', '', $link)), $match)) {
         if (hash_hmac(self::HMAC_ALGO, $match['data'], md5(MASTER_KEY)) != $match['hash']) {
             throw new Exception_MegaCrypterLinkException(self::LINK_ERROR);
         } else {
             if (!$ignore_exceptions && BLACKLIST_LEVEL >= self::BLACKLIST_LEVEL_MC && self::isBlacklistedLink($match['data'])) {
                 throw new Exception_MegaCrypterLinkException(self::BLACKLISTED_LINK);
             } else {
                 list($secret, $file_id, $file_key, $pass, $extra, $auth) = explode(self::SEPARATOR, gzinflate(Utils_CryptTools::aesCbcDecrypt(Utils_MiscTools::urlBase64Decode($match['data']), Utils_MiscTools::hex2bin(MASTER_KEY), md5(MASTER_KEY, true))));
                 if (!$ignore_exceptions && BLACKLIST_LEVEL == self::BLACKLIST_LEVEL_MEGA && self::isBlacklistedLink($file_id)) {
                     throw new Exception_MegaCrypterLinkException(self::BLACKLISTED_LINK);
                 } else {
                     if ($extra) {
                         list($extra_info, $hide_name, $expire, $referer, $email, $zombie, $no_expire_token) = explode(self::SEPARATOR_EXTRA, $extra);
                         if (!$ignore_exceptions && !empty($expire) && time() >= $expire) {
                             throw new Exception_MegaCrypterLinkException(self::EXPIRED_LINK);
                         }
                         if (!empty($zombie) && $zombie != $_SERVER['REMOTE_ADDR']) {
                             throw new Exception_MegaCrypterLinkException(self::LINK_ERROR);
                         }
                     }
                     return ['file_id' => $file_id, 'file_key' => $file_key, 'extra_info' => !empty($extra_info) ? base64_decode($extra_info) : false, 'pass' => !empty($pass) ? $pass : false, 'auth' => !empty($auth) ? base64_decode($auth) : false, 'hide_name' => !empty($hide_name), 'expire' => !empty($expire) ? $expire : false, 'no_expire_token' => !empty($no_expire_token), 'referer' => !empty($referer) ? base64_decode($referer) : false, 'email' => !empty($email) ? base64_decode($email) : false, 'zombie' => !empty($zombie) ? $zombie : false, 'secret' => $secret];
                 }
             }
         }
     } else {
         throw new Exception_MegaCrypterLinkException(self::LINK_ERROR);
     }
 }
开发者ID:vaginessa,项目名称:megacrypter,代码行数:30,代码来源:MegaCrypter.php

示例8: act_detectSkuStoreInfo

 function act_detectSkuStoreInfo()
 {
     $skuArr = isset($_POST['skuArr']) ? json_decode(gzinflate($_POST['skuArr'])) : '';
     $storeId = isset($_POST['storeId']) ? $_POST['storeId'] : '';
     if (!is_array($skuArr)) {
         self::$errCode = 401;
         self::$errMsg = "skuArr不是数组!";
         return;
     }
     if (empty($storeId)) {
         self::$errCode = 402;
         self::$errMsg = "storeId不能为空";
         return;
     }
     $sku_str = implode("','", $skuArr);
     $sku_str = "('" . $sku_str . "')";
     $sku_list = OmAvailableModel::getTNameList("wh_sku_location", "sku,actualStock", "where sku in {$sku_str} and actualStock>0 and storeId='{$storeId}'");
     if ($sku_list) {
         $return_info = array();
         foreach ($sku_list as $list) {
             $return_info[] = $list['sku'];
         }
         return json_encode($return_info);
     } else {
         return '';
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:27,代码来源:whOpenApi.action.php

示例9: logoutResponseUrl

 /**
  * Create a valid SAML logout response
  * Based off of Sperantus_SAML2_SP_AuthRequest
  */
 public function logoutResponseUrl($logoutRequest, $returnUrl)
 {
     $id = uniqid('', true);
     $issueInstant = date('Y-m-d\\TH:i:s\\Z');
     $issuer = $this->_token_key;
     $response = @gzinflate(base64_decode($logoutRequest));
     if (!strlen($response)) {
         return FALSE;
     }
     $matches = array();
     preg_match('/ID=\\"(.+?)\\"/', $response, $matches);
     if (!isset($matches[1])) {
         return FALSE;
     }
     $responseTo = $matches[1];
     $request = '
   <samlp:LogoutResponse xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
       ID="' . $id . '" Version="2.0" IssueInstant="' . $issueInstant . '"
       InResponseTo="' . $responseTo . '">
       <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">' . $issuer . '</saml:Issuer>
       <samlp:Status xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
           <samlp:StatusCode  
                xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                Value="urn:oasis:names:tc:SAML:2.0:status:Success">
           </samlp:StatusCode>
      </samlp:Status>
    </samlp:LogoutResponse>';
     return $returnUrl . '?entityid=' . urlencode($this->_consumer_key) . '&SAMLResponse=' . urlencode(base64_encode(gzdeflate($request)));
 }
开发者ID:reachmw,项目名称:schoology_php_sdk,代码行数:33,代码来源:SchoologyApi.class.php

示例10: readChunk

function readChunk($posx, $posz)
{
    global $REGION_DIR;
    // calculate region file to read
    $regionX = floor($posx / 32);
    $regionZ = floor($posz / 32);
    // open region file, seek to header info
    $file = gzopen($REGION_DIR . "r.{$regionX}.{$regionZ}.mcr", 'r');
    $chunkHeaderLoc = 4 * (floormod($posx, 32) + floormod($posz, 32) * 32);
    gzseek($file, $chunkHeaderLoc);
    $info = unpack('C*', gzread($file, 4));
    $chunkDataLoc = $info[1] << 16 | $info[2] << 8 | $info[3];
    // if chunk hasn't been generated, return empty
    if ($chunkDataLoc == 0) {
        return array();
    }
    // seek to data, write to gz and return
    gzseek($file, $chunkDataLoc * 4096);
    $info = unpack('C*', gzread($file, 4));
    $chunkLength = $info[1] << 32 | $info[2] << 16 | $info[3] << 8 | $info[4];
    // read to skip over compression byte
    gzread($file, 1);
    // skip first two bytes for deflate
    gzread($file, 2);
    // leave off last four bytes for deflate
    $chunkLength -= 4;
    $contents = gzread($file, $chunkLength - 1);
    $contents = gzinflate($contents);
    $data = array_merge(unpack("C*", $contents));
    return $data;
}
开发者ID:runvnc,项目名称:MC-Chunk-Loader,代码行数:31,代码来源:readchunk.php

示例11: decode_body

 protected static function decode_body($headers, $str, $eol = "\r\n")
 {
     $tmp = $str;
     $add = strlen($eol);
     $str = '';
     if (isset($headers['transfer-encoding']) && 'chunked' == $headers['transfer-encoding']) {
         do {
             $tmp = ltrim($tmp);
             $pos = strpos($tmp, $eol);
             $len = hexdec(substr($tmp, 0, $pos));
             if (isset($headers['content-encoding'])) {
                 $str .= @gzinflate(substr($tmp, $pos + $add + 10, $len));
             } else {
                 $str .= substr($tmp, $pos + $add, $len);
             }
             $tmp = substr($tmp, $len + $pos + $add);
             $check = trim($tmp);
         } while (!empty($check));
     } else {
         if (isset($headers['content-encoding'])) {
             $str = @gzinflate(substr($tmp, 10));
         } else {
             $str = $tmp;
         }
     }
     return $str;
 }
开发者ID:aprilchild,项目名称:aprilchild,代码行数:27,代码来源:simple_http.php

示例12: __construct

 public function __construct(ServerAPI $api, $server = false)
 {
     $this->api = $api;
     if (substr(self::$chunkHeader, 0, 9) === "base64://") {
         self::$chunkHeader = gzinflate(base64_decode(substr(self::$chunkHeader, 9)));
     }
 }
开发者ID:monster12309,项目名称:SimpleWorlds,代码行数:7,代码来源:SimpleWorlds.php

示例13: decode_gzip

function decode_gzip($data)
{
    if (function_exists('gzdecode')) {
        return gzdecode($data);
    }
    return gzinflate(substr($data, 10, -8));
}
开发者ID:ptcong,项目名称:easyrequest,代码行数:7,代码来源:helpers.php

示例14: genosage

 static function genosage()
 {
     # CHECK THE INIT STATUS
     if (is_dir('./App') and is_dir('./Config') and is_dir('./Cache')) {
         return;
     }
     # > FOLDER
     $sys_folders = array('App', 'App/M', 'App/V', 'App/C', 'Cache', 'Config', 'Public', 'Public/Js', 'Public/Css', 'Public/Img', 'Upload');
     for ($i = 0; $i < count($sys_folders); $i++) {
         if (!is_dir('./' . $sys_folders[$i])) {
             mkdir('./' . $sys_folders[$i], 0777);
         }
     }
     # > CONFIG FILE
     $sys_config_files['core'] = gzinflate(base64_decode('4+VSSc4vSlWwVUgsKkqs1NC05uXihYhFq4cGuDiGuMaHePq6qscClagbGRgaGVgaGqpbw9U4+/t7e7rG+3i6ISm0MDMxMEBS4+js4RofHOmHUGGMkHVxdQp1j/cMgFhhaGSuZwCEQDsUlBVCg10VNHQ0FUL8FYJdAxyDgM5x4eUCAA=='));
     $sys_config_files['auth'] = gzinflate(base64_decode('4+VSSSwtyVCwVUgsKkqs1NC05uXihYhFqzuGhnjE+/upxwKlDaxRhUP8vV394v0cfV3B0urpqXn5xYnpqfEl+dmpeeroqh2dfKAKQ4tTi9ClQ4NdgyCypUDZvMTcVHQVAY7BwRAVBYnFxeX5RSnoKtyD/EMDoG4pyi8tQJf38Xf3hHhFvTgzPS8T7Ea4Ei2wDCQMeLk4gXwFWzsFA14uUIAAAA=='));
     $sys_config_files['database'] = gzinflate(base64_decode('4+VSSUksSUxKLE5VsFVILCpKrNTQtObl4kWIR6u7OMV7+AeHqMcClagbGpnrGQChoZWxsYGZujW6Sj9HX1eIyvTUvPzixPRUTDWhwa5BEDVF+fklmPIBjsHBEHksckGubp4RUBvyitPjQUoA'));
     $sys_config_files['router'] = gzinflate(base64_decode('4+VSKcovLUktUrBVSCwqSqzU0LTm5eKFiUarZ+alpFaox8Klebk41bXUFWztFNQ9QVL6EAW8XCB9cF1axOoAAA=='));
     file_put_contents('./Config/ConCore.php', '<?php' . $sys_config_files['core'] . '?>');
     file_put_contents('./Config/ConRouter.php', '<?php' . $sys_config_files['router'] . '?>');
     file_put_contents('./Config/ConAuth.php', '<?php' . $sys_config_files['auth'] . '?>');
     file_put_contents('./Config/ConDatabase.php', '<?php' . $sys_config_files['database'] . '?>');
     # > APP DEMO
     $sys_app_demo = gzinflate(base64_decode('4+VS5uVSVnAMCPD0c3GN4AVxk3MSi4sVHAsKPPNSUisUUitKUvNSwAK8XNW8XJwFpUk5mckKaaV5ySWZ+XkKmSBlGppAGZAsZ0FRZl5JfJGGukdqTk6+Qnl+UU6KorqmNVCulpOXq5aXCwA='));
     file_put_contents('./App/C/AppIndex.php', '<?php' . $sys_app_demo . '?>');
     # > INIT CPMPLETE
 }
开发者ID:noevil,项目名称:genosage,代码行数:27,代码来源:Init.core.php

示例15: parseResponse

 function parseResponse(&$buff)
 {
     preg_match("/^(.*?)\r\n\r\n(.*?)\$/s", $buff, $match);
     if (isset($match[2])) {
         $this->header = $match[1];
         $this->body = $match[2];
         $headlines = explode("\n", $this->header);
         // this->head
         $status = false;
         //$stop = false;
         foreach ($headlines as $header) {
             if (!$status) {
                 $status = $header;
                 // expecting HTTP/1.1 200 OK
                 if (!strpos($status, "200")) {
                     return false;
                 }
             } else {
                 preg_match("/^([^:]*?):\\s*(.*?)[\r]\$/i", $header, $htmp);
                 if (isset($htmp[2])) {
                     $this->head[strtolower($htmp[1])] = $htmp[2];
                 }
             }
         }
         // inflating gzip'ed pages
         if (isset($this->head["content-encoding"]) && $this->head["content-encoding"] == "gzip" || isset($this->head["vary"]) && strtolower($this->head["vary"]) == "accept-encoding") {
             // Read http://www.php.net/manual/en/function.gzinflate.php
             $this->body = gzinflate(substr($this->body, 10));
         }
     }
 }
开发者ID:markuz,项目名称:planetalinux,代码行数:31,代码来源:network.lib.php


注:本文中的gzinflate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。