close() public method

Ends the current session and store session data.
public close ( ) : void
return void
コード例 #1
0
ファイル: FilePresenter.php プロジェクト: venne/files
 public function actionImage()
 {
     if (substr($this->url, 0, 7) === self::DIRECTORY_CACHE . '/') {
         $this->cached = true;
         $this->url = substr($this->url, 7);
     }
     if (($entity = $this->fileRepository->findOneBy(array('path' => $this->url))) === null) {
         throw new \Nette\Application\BadRequestException(sprintf('File \'%s\' does not exist.', $this->url));
     }
     $image = Image::fromFile($entity->getFilePath());
     $this->session->close();
     // resize
     if ($this->size && $this->size !== 'default') {
         if (strpos($this->size, 'x') !== false) {
             $format = explode('x', $this->size);
             $width = $format[0] !== '?' ? $format[0] : null;
             $height = $format[1] !== '?' ? $format[1] : null;
             $image->resize($width, $height, $this->format !== 'default' ? $this->format : Image::FIT);
         }
     }
     if (!$this->type) {
         $this->type = substr($entity->getName(), strrpos($entity->getName(), '.'));
     }
     $type = $this->type === 'jpg' ? Image::JPEG : $this->type === 'gif' ? Image::GIF : Image::PNG;
     $file = sprintf('%s/%s/%s/%s/%s/%s', $this->cacheDir, self::DIRECTORY_CACHE, $this->size, $this->format, $this->type, $entity->getPath());
     $dir = dirname($file);
     umask(00);
     @mkdir($dir, 0777, true);
     $image->save($file, 90, $type);
     $image->send($type, 90);
 }
コード例 #2
0
ファイル: ChatControl.php プロジェクト: venne/comments
 /**
  * @param int $id
  */
 public function handleCheck($id)
 {
     $this->session->close();
     $this->redrawControl('check');
     $this->template->last = $newerThan = $this->commentDao->find($id);
     for ($x = 0; $x < 100; $x++) {
         if ($this->countNewComments($newerThan)) {
             $this->template->new = $this->getNewComments($newerThan);
             $this->template->last = end($this->template->new);
             $this->redrawControl('new');
             break;
         }
         sleep(1);
     }
 }