From c83168b1f1bf43e24bcf3a5f3fe272d10198ea2a Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 22 Oct 2006 21:16:39 +0000 Subject: [PATCH] avoid the ugly include for varstream, use a dummy VarStream::init() instead. git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1008 839d8a87-29fc-0310-9880-83ba4fa771e5 --- classes/varstream.php | 37 ++++++------------------------------- include/validations/photos.inc.php | 3 ++- modules/carnet/contacts.pdf.inc.php | 17 +++++++++-------- 3 files changed, 17 insertions(+), 40 deletions(-) diff --git a/classes/varstream.php b/classes/varstream.php index 49c31f6..744ca34 100644 --- a/classes/varstream.php +++ b/classes/varstream.php @@ -21,14 +21,9 @@ class VarStream { - // {{{ properties - // Stream handler to read from global variables - var $varname; - var $position; - - // }}} - // {{{ stream_open + private $varname; + private $position; function stream_open($path, $mode, $options, &$opened_path) { @@ -43,16 +38,10 @@ class VarStream return true; } - // }}} - // {{{ stream_close - function stream_close() { } - // }}} - // {{{ stream_read - function stream_read($count) { $ret = substr($GLOBALS[$this->varname], $this->position, $count); @@ -60,9 +49,6 @@ class VarStream return $ret; } - // }}} - // {{{ stream_write - function stream_write($data) { $len = strlen($data); @@ -74,25 +60,16 @@ class VarStream $this->position += $len; } - // }}} - // {{{ stream_eof - function stream_eof() { return $this->position >= strlen($GLOBALS[$this->varname]); } - // }}} - // {{{ stream_tell - function stream_tell() { return $this->position; } - // }}} - // {{{ stream_seek - function stream_seek($offs, $whence) { switch ($whence) { @@ -116,16 +93,14 @@ class VarStream return 0; } - // }}} - // {{{ stream_flush - function stream_flush() { } - // }}} + static function init() + { + stream_wrapper_register('var','VarStream'); + } } -stream_wrapper_register('var','VarStream'); - ?> diff --git a/include/validations/photos.inc.php b/include/validations/photos.inc.php index 6cab17e..95860e3 100644 --- a/include/validations/photos.inc.php +++ b/include/validations/photos.inc.php @@ -54,8 +54,9 @@ class PhotoReq extends Validate { global $page; + VarStream::init(); + // calcul de la taille de l'image - require_once dirname(__FILE__).'/../../classes/varstream.php'; $GLOBALS['photoreq'] = $_data; $image_infos = getimagesize('var://photoreq'); unset ($GLOBALS['photoreq']); diff --git a/modules/carnet/contacts.pdf.inc.php b/modules/carnet/contacts.pdf.inc.php index e50bf96..32617b1 100644 --- a/modules/carnet/contacts.pdf.inc.php +++ b/modules/carnet/contacts.pdf.inc.php @@ -21,18 +21,20 @@ define ('FPDF_FONTPATH', dirname(__FILE__).'/fonts/'); require_once '/usr/share/fpdf/fpdf.php'; -require_once dirname(__FILE__).'/../../classes/varstream.php'; + +VarStream::init(); class ContactsPDF extends FPDF { - var $col = 0; - var $y0; + public $title = "Mes contacts sur Polytechnique.org"; + + private $col = 0; + private $y0; - var $title = "Mes contacts sur Polytechnique.org"; - var $broken = false; - var $error = false; + private $broken = false; + private $error = false; - var $report = 0; + private $report = 0; function ContactsPDF() { @@ -339,7 +341,6 @@ class ContactsPDF extends FPDF return $self; } - } ?> -- 2.1.4