From 50d87c29631f294c1fffb05ae91403f200931ae4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 10 Jan 2015 13:04:51 +0000 Subject: [PATCH] fixed not working seek in stream-wrapper, caused by sw interface uses true/false while fseek uses 0/-1 --- phpgwapi/inc/class.egw_framework.inc.php | 2 +- phpgwapi/inc/class.filesystem_stream_wrapper.inc.php | 8 ++++---- phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php | 8 ++++---- phpgwapi/inc/class.vfs_stream_wrapper.inc.php | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 6d25dfb586..c872476a15 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -207,7 +207,7 @@ abstract class egw_framework // - "connect-src 'self'" allows ajax requests only to self // - "style-src 'self' 'unsave-inline'" allows only self and inline style, which we need // - "frame-src 'self' manual.egroupware.org" allows frame and iframe content only for self or manual.egroupware.org - $frame_src = array("'self'", 'manual.egroupware.org'); + $frame_src = array("'self'", 'manual.egroupware.org', 'www.egroupware.org'); if (($additional = $this->_get_csp_frame_src())) $frame_src = array_unique(array_merge($frame_src, $additional)); $csp = "script-src 'self' ".self::csp_script_src_attrs(). diff --git a/phpgwapi/inc/class.filesystem_stream_wrapper.inc.php b/phpgwapi/inc/class.filesystem_stream_wrapper.inc.php index dc45a62758..8be319a0e4 100644 --- a/phpgwapi/inc/class.filesystem_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.filesystem_stream_wrapper.inc.php @@ -250,14 +250,14 @@ class filesystem_stream_wrapper implements iface_stream_wrapper * See fseek() for more information about these parameters. * * @param integer $offset - * @param integer $whence SEEK_SET - Set position equal to offset bytes - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) + * @param integer $whence SEEK_SET - 0 - Set position equal to offset bytes + * SEEK_CUR - 1 - Set position to current location plus offset. + * SEEK_END - 2 - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) * @return boolean TRUE if the position was updated, FALSE otherwise. */ function stream_seek ( $offset, $whence ) { - return fseek($this->opened_stream,$offset,$whence); + return !fseek($this->opened_stream,$offset,$whence); // fseek returns 0 on success and -1 on failure } /** diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index 323960baf1..eb6a5c0906 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -478,9 +478,9 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper * See fseek() for more information about these parameters. * * @param integer $offset - * @param integer $whence SEEK_SET - Set position equal to offset bytes - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) + * @param integer $whence SEEK_SET - 0 - Set position equal to offset bytes + * SEEK_CUR - 1 - Set position to current location plus offset. + * SEEK_END - 2 - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) * @return boolean TRUE if the position was updated, FALSE otherwise. */ function stream_seek ( $offset, $whence ) @@ -489,7 +489,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper if (is_resource($this->opened_stream)) { - return fseek($this->opened_stream,$offset,$whence); + return !fseek($this->opened_stream,$offset,$whence); // fseek returns 0 on success and -1 on failure } return false; } diff --git a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php index 441c27f52b..6aae8f2ab8 100644 --- a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php @@ -411,14 +411,14 @@ class vfs_stream_wrapper implements iface_stream_wrapper * See fseek() for more information about these parameters. * * @param integer $offset - * @param integer $whence SEEK_SET - Set position equal to offset bytes - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) + * @param integer $whence SEEK_SET - 0 - Set position equal to offset bytes + * SEEK_CUR - 1 - Set position to current location plus offset. + * SEEK_END - 2 - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) * @return boolean TRUE if the position was updated, FALSE otherwise. */ function stream_seek ( $offset, $whence ) { - return fseek($this->opened_stream,$offset,$whence); + return !fseek($this->opened_stream,$offset,$whence); // fseek returns 0 on success and -1 on failure } /**