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


PHP http::RestoreCookies方法代码示例

本文整理汇总了PHP中http::RestoreCookies方法的典型用法代码示例。如果您正苦于以下问题:PHP http::RestoreCookies方法的具体用法?PHP http::RestoreCookies怎么用?PHP http::RestoreCookies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在http的用法示例。


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

示例1:

 /**
  * @param http $http
  */
 function _auth($http)
 {
     $cooks = core::lib('sape_cacher')->get('cookie', $this->_acc->id);
     if ($cooks == sape_cacher::NOTFOUND) {
         $cooks = false;
     }
     if ($cooks) {
         $http->RestoreCookies($cooks, 1);
         $http->prolongate_cookie(14);
         $this->_authed = true;
     } else {
         if (!$this->_in_login) {
             $this->login();
         }
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:19,代码来源:moswar.php

示例2: getGlobalSetting

 function step4()
 {
     $clang = $this->getController()->lang;
     $buildnumber = Yii::app()->getConfig("buildnumber");
     $tempdir = Yii::app()->getConfig("tempdir");
     $updatekey = Yii::app()->getConfig("updatekey");
     $updatebuild = Yii::app()->getConfig("updatebuild");
     $rootdir = Yii::app()->getConfig("rootdir");
     $publicdir = Yii::app()->getConfig("publicdir");
     $tempdir = Yii::app()->getConfig("tempdir");
     $aDatabasetype = Yii::app()->db->getDriverName();
     // Request the list with changed files from the server
     $updatekey = getGlobalSetting('updatekey');
     $aData = array('clang' => $clang);
     if (!isset(Yii::app()->session['updateinfo'])) {
         if ($updateinfo['error'] == 1) {
             setGlobalSetting('updatekey', '');
         }
     } else {
         $updateinfo = Yii::app()->session['updateinfo'];
     }
     // this is the last step - Download the zip file, unpack it and replace files accordingly
     // Create DB and file backups now
     $downloaderror = false;
     $http = new http();
     // Allow redirects
     $http->follow_redirect = 1;
     /* Connection timeout */
     $http->timeout = 0;
     /* Data transfer timeout */
     $http->data_timeout = 0;
     $http->user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
     $http->GetRequestArguments("http://update.limesurvey.org/updates/download/{$updateinfo['downloadid']}", $arguments);
     $http->RestoreCookies(Yii::app()->session['updatesession']);
     $error = $http->Open($arguments);
     $error = $http->SendRequest($arguments);
     $http->ReadReplyHeaders($headers);
     if ($headers['content-type'] == 'text/html') {
         @unlink($tempdir . '/update.zip');
     } else {
         if ($error == '') {
             $body = '';
             $pFile = fopen($tempdir . '/update.zip', 'w');
             for (;;) {
                 $error = $http->ReadReplyBody($body, 100000);
                 if ($error != "" || strlen($body) == 0) {
                     break;
                 }
                 fwrite($pFile, $body);
             }
             fclose($pFile);
         } else {
             print $error;
         }
     }
     // Now remove all files that are to be deleted according to update process
     foreach ($updateinfo['files'] as $afile) {
         if ($afile['type'] == 'D' && file_exists($rootdir . $afile['file'])) {
             if (is_file($rootdir . $afile['file'])) {
                 unlink($rootdir . $afile['file']);
             } else {
                 rmdirr($rootdir . $afile['file']);
             }
             echo sprintf($clang->gT('File deleted: %s'), $afile['file']) . '<br />';
         }
     }
     //Now unzip the new files over the existing ones.
     $new_files = false;
     if (file_exists($tempdir . '/update.zip')) {
         Yii::app()->loadLibrary("admin/pclzip/pclzip");
         $archive = new PclZip($tempdir . '/update.zip');
         if ($archive->extract(PCLZIP_OPT_PATH, $rootdir . '/', PCLZIP_OPT_REPLACE_NEWER) == 0) {
             die("Error : " . $archive->errorInfo(true));
         } else {
             $new_files = true;
             unlink($tempdir . '/update.zip');
         }
     } else {
         $downloaderror = true;
     }
     $aData['new_files'] = $new_files;
     $aData['downloaderror'] = $downloaderror;
     //  PclTraceDisplay();
     // Now we have to update version.php
     if (!$downloaderror) {
         @ini_set('auto_detect_line_endings', true);
         $versionlines = file($rootdir . '/application/config/version.php');
         $handle = fopen($rootdir . '/application/config/version.php', "w");
         foreach ($versionlines as $line) {
             if (strpos($line, 'buildnumber') !== false) {
                 $line = '$config[\'buildnumber\'] = ' . Yii::app()->session['updateinfo']['toversion'] . ';' . "\r\n";
             }
             fwrite($handle, $line);
         }
         fclose($handle);
     }
     setGlobalSetting('updatelastcheck', '1980-01-01 00:00');
     setGlobalSetting('updateavailable', '0');
     setGlobalSetting('updatebuild', '');
     setGlobalSetting('updateversion', '');
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:update.php


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