Author: ralfbecker
New Revision: 51008
URL: http://svn.stylite.de/viewvc/egroupware?rev=51008&view=rev
Log:
fix some PHP 5.6 Deprecated and IDE warnings
Modified:
trunk/phpgwapi/inc/HTTP/WebDAV/Server.php
trunk/phpgwapi/inc/horde/Horde/String.php
Modified: trunk/phpgwapi/inc/HTTP/WebDAV/Server.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/HTTP/WebDAV/Server.php?rev=51008&r1=51007&r2=51008&view=diff
— trunk/phpgwapi/inc/HTTP/WebDAV/Server.php (original)
+++ trunk/phpgwapi/inc/HTTP/WebDAV/Server.php Mon Dec 15 10:08:12 2014
@@ -190,7 +190,7 @@
*
* dispatch WebDAV HTTP request to the apropriate method handler
*
-
* @param $prefix=null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php
-
function ServeRequest($prefix=null)* @param $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php * @return void */
@@ -213,18 +213,19 @@
// seem to pass ‘?’ unencoded, so we need to extract the path info out
// of the request URI ourselves
// if request URI contains a full url, remove schema and domain -
$matches = null; if (preg_match('|^https?://[^/]+(/.*)$|', $path_info=$this->_SERVER["REQUEST_URI"], $matches)) { $path_info = $matches[1]; }
-
$path_info = substr($path_info, strlen($this->_SERVER["SCRIPT_NAME"]));
-
$path_info_raw = substr($path_info, strlen($this->_SERVER["SCRIPT_NAME"])); // just in case the path came in empty ...
-
if (empty($path_info)) { -
$path_info = "/"; -
} -
$path_info = $this->_urldecode($path_info);
-
if (empty($path_info_raw)) { -
$path_info_raw = "/"; -
} -
$path_info = self::_urldecode($path_info_raw); if ($prefix && strpos($path_info, $prefix) === 0) {
@@ -237,7 +238,7 @@
// set path
// $_SERVER['PATH_INFO'] is already urldecoded
-
//$this->path = $this->_urldecode($path_info);
-
//$this->path = self::_urldecode($path_info); // quote '#' (e.g. OpenOffice uses this for lock-files) $this->path = strtr($path_info,array( '%' => '%25',
@@ -306,7 +307,6 @@
} else { // method not found/implemented
if ($this->_SERVER[“REQUEST_METHOD”] == “LOCK”) {
$error = ‘412 Precondition failed’;
-
; } else { $error = '405 Method not allowed'; header("Allow: ".join(", ", $this->_allow())); // tell client what's allowed
@@ -650,7 +650,7 @@
/**
* PROPFIND method handler
*
-
* @param string $handler='PROPFIND' allows to use method eg. for CalDAV REPORT
-
function http_PROPFIND($handler=‘PROPFIND’)* @param string $handler ='PROPFIND' allows to use method eg. for CalDAV REPORT * @return void */
@@ -691,7 +691,7 @@
if (is_array($lock) && count($lock)) {
$created = isset($lock[‘created’]) ? $lock[‘created’] : time();
$modified = isset($lock[‘modified’]) ? $lock[‘modified’] : time();
-
$files['files'][] = array("path" => $this->_slashify($this->path),
-
$files['files'][] = array("path" => self::_slashify($this->path), "props" => array($this->mkprop("displayname", $this->path), $this->mkprop("creationdate", $created), $this->mkprop("getlastmodified", $modified),
@@ -917,10 +917,10 @@
/* TODO right now the user implementation has to make sure
collections end in a slash, this should be done in here
by checking the resource attribute */
-
$href = $this->_mergePaths($this->base_uri, $path);
-
$href_raw = $this->_mergePaths($this->base_uri, $path); /* minimal urlencoding is needed for the resource path */
-
$href = $this->_urlencode($href);
-
$href = $this->_urlencode($href_raw); if ($this->crrnd) {
@@ -1240,7 +1240,7 @@
* we can NOT send Content-Length headers, as the have to reflect size
* AFTER applying compression/transfer encoding.
*
-
- @param boolean $set=null
-
- @param boolean $set =null
-
@return boolean true if we use compression, false otherwise
/
public static function use_compression($set=null)
@@ -1322,7 +1322,7 @@
. (isset($options[‘size’]) ? $options[‘size’] : ""));
while ($size && !feof($options[‘stream’])) {
$buffer = fread($options[‘stream’], 4096);
-
$size -= $this->bytes($buffer);
-
$size -= self::bytes($buffer); echo $buffer; } } else {
@@ -1358,7 +1358,7 @@
fseek($options[‘stream’], $from, SEEK_SET);
while ($size && !feof($options[‘stream’])) {
$buffer = fread($options[‘stream’], 4096);
-
$size -= $this->bytes($buffer);
-
$size -= self::bytes($buffer); echo $buffer; } }
@@ -1376,7 +1376,7 @@
if (is_array($options[‘data’])) {
// reply to partial request
} else {
-
if (!self::use_compression()) header("Content-Length: ".$this->bytes($options['data']));
-
if (!self::use_compression()) header("Content-Length: ".self::bytes($options['data'])); echo $options['data']; } }
@@ -1406,6 +1406,7 @@
if (isset($this->_SERVER[‘HTTP_RANGE’])) {
// we only support standard "bytes" range specifications for now
-
$matches = null; if (preg_match('/bytes\s*=\s*(.+)/', $this->_SERVER['HTTP_RANGE'], $matches)) { $options["ranges"] = array();
@@ -1613,6 +1614,7 @@
// single byte range requests are supported
// the header format is also specified in RFC 2616 14.16
// TODO we have to ensure that implementations support this or send 501 instead
-
$matches = null; if (!preg_match('@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $val, $matches)) { $this->http_status('400 bad request'); echo 'The service does only support single byte ranges';
@@ -1623,7 +1625,7 @@
if (is_numeric($matches[3])) {
$range[‘total_length’] = $matches[3];
}
-
$option['ranges'][] = $range;
-
$options['ranges'][] = $range; // TODO make sure the implementation supports partial POST // this has to be done in advance to avoid data being overwritten
@@ -1792,6 +1794,7 @@
// single byte range requests are supported
// the header format is also specified in RFC 2616 14.16
// TODO we have to ensure that implementations support this or send 501 instead
-
$matches = null; if (!preg_match('@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $val, $matches)) { $this->http_status("400 bad request"); echo "The service does only support single byte ranges";
@@ -2156,7 +2159,7 @@
}
$content .= ‘</’.($this->crrnd?’’:‘D:’).“error>\n”;
}
-
if (!self::use_compression()) header("Content-Length: ".$this->bytes($content));
-
}if (!self::use_compression()) header("Content-Length: ".self::bytes($content)); if ($content) echo $options['content'];
@@ -2189,7 +2192,7 @@
$http_host.= “:”.$url[“port”];
} else {
// only path given, set host to self
-
$http_host == $http_header_host;
-
$http_host = $http_header_host; } if ($http_host == $http_header_host &&
@@ -2267,7 +2270,7 @@
* @praram boolen property raw-flag
* @return array property array
*/
- function mkprop()
- public static function mkprop()
{
$args = func_get_args();
switch (count($args)) {
@@ -2323,7 +2326,7 @@- @param void
-
@return string a new UUID
*/
- function _new_uuid()
- public static function _new_uuid()
{
// use uuid extension from PECL if available
if (function_exists(“uuid_create”)) {
@@ -2353,9 +2356,9 @@- @param void
-
@return string new RFC2518 opaque lock token
*/
- function _new_locktoken()
- {
-
return "opaquelocktoken:".HTTP_WebDAV_Server::_new_uuid();
-
public static function _new_locktoken()
-
{
-
return "opaquelocktoken:".self::_new_uuid();}
// }}}
@@ -2558,6 +2561,7 @@
*/
function _check_uri_condition($uri, $condition)
{ -
unset($uri); // not used, but required by function signature // not really implemented here, // implementations must override
@@ -2694,7 +2698,7 @@
* @param string URL to encode
* @return string encoded URL
*/
- function _urlencode($url)
- public static function _urlencode($url)
{
// cadaver (and probably all neon using agents) need a more complete url encoding
// otherwise special chars like “$,()’” in filenames do NOT work
@@ -2724,7 +2728,7 @@- @param string URL to decode
-
@return string decoded URL
*/
- function _urldecode($path)
- public static function _urldecode($path)
{
return rawurldecode($path);
}
@@ -2850,10 +2854,10 @@- @param string directory path
-
@returns string directory path wiht trailing slash
*/
- function _slashify($path)
- public static function _slashify($path)
{
//error_log(METHOD." called with $path");
-
if ($path[$this->bytes($path)-1] != '/') {
-
if ($path[self::bytes($path)-1] != '/') { //error_log(__METHOD__." added slash at the end of path"); $path = $path."/"; }
@@ -2866,10 +2870,10 @@
* @param string directory path
* @returns string directory path wihtout trailing slash
*/
- function _unslashify($path)
- public static function _unslashify($path)
{
//error_log(METHOD." called with $path");
-
if ($path[$this->bytes($path)-1] == '/') {
-
if ($path[self::bytes($path)-1] == '/') { $path = substr($path, 0, -1); //error_log(__METHOD__." removed slash at the end of path"); }
@@ -2883,14 +2887,14 @@
* @param string child path
* @return string merged path
*/
- function _mergePaths($parent, $child)
- public static function _mergePaths($parent, $child)
{
//error_log(“merge called :\n$parent \n$child\n” . function_backtrace());
//error_log(“merge :\n”.print_r($this->_mergePaths($this->_SERVER[“SCRIPT_NAME”], $this->path)true));
if ($child{0} == ‘/’) {
-
return $this->_unslashify($parent).$child;
-
return self::_unslashify($parent).$child; } else {
-
return $this->_slashify($parent).$child;
-
}return self::_slashify($parent).$child; }
@@ -2900,9 +2904,9 @@
* @param string $str
* @return int
*/
- function bytes($str)
- {
-
static $func_overload;
- public static function bytes($str)
- {
-
static $func_overload=null; if (is_null($func_overload)) {
@@ -2918,4 +2922,3 @@
- c-basic-offset: 4
- End:
*/
-?>
Modified: trunk/phpgwapi/inc/horde/Horde/String.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/horde/Horde/String.php?rev=51008&r1=51007&r2=51008&view=diff
— trunk/phpgwapi/inc/horde/Horde/String.php (original)
+++ trunk/phpgwapi/inc/horde/Horde/String.php Mon Dec 15 10:08:12 2014
@@ -28,7 +28,7 @@
*
* @see Util::extensionExists()
*/
- function extensionExists($ext)
- public static function extensionExists($ext)
{
static $cache = array();
@@ -45,7 +45,7 @@
*
* @param string $charset The charset to use as the default one.
*/
- function setDefaultCharset($charset)
- public static function setDefaultCharset($charset)
{
$GLOBALS[’_HORDE_STRING_CHARSET’] = $charset;
if (String::extensionExists(‘mbstring’) &&
@@ -73,7 +73,7 @@
*-
@return mixed The converted input data.
*/
-
@return mixed The converted input data.
- function convertCharset($input, $from, $to = null)
-
public static function convertCharset($input, $from, $to = null)
{
/* Don’t bother converting numbers. */
if (is_numeric($input)) {
@@ -127,7 +127,7 @@
}/**
-
* Internal function used to do charset conversion.
-
* Internal public static function used to do charset conversion. * * @access private *
@@ -137,7 +137,7 @@
*
* @return string The converted string.
*/
- function _convertCharset($input, $from, $to)
-
public static function _convertCharset($input, $from, $to)
{
$output = ‘’;
$from_check = (($from == ‘iso-8859-1’) || ($from == ‘us-ascii’));
@@ -145,7 +145,7 @@/* Use utf8_[en|de]code() if possible and if the string isn't too * large (less than 16 MB = 16 * 1024 * 1024 = 16777216 bytes) - these
-
* functions use more memory. */
-
* public static functions use more memory. */ if (strlen($input) < 16777216 || !(String::extensionExists('iconv') || String::extensionExists('mbstring'))) { if ($from_check && ($to == 'utf-8')) { return utf8_encode($input);
@@ -201,7 +201,7 @@
*
* @return string The string with lowercase characters
*/
- function lower($string, $locale = false, $charset = null)
- public static function lower($string, $locale = false, $charset = null)
{
static $lowers;
@@ -246,7 +246,7 @@
*
* @return string The string with uppercase characters
*/
- function upper($string, $locale = false, $charset = null)
- public static function upper($string, $locale = false, $charset = null)
{
static $uppers;
@@ -291,7 +291,7 @@
*
* @return string The capitalized string.
*/
- function ucfirst($string, $locale = false, $charset = null)
- public static function ucfirst($string, $locale = false, $charset = null)
{
if ($locale) {
$first = String::substr($string, 0, 1, $charset);
@@ -316,7 +316,7 @@
*-
@return string The string’s part.
*/
-
@return string The string’s part.
- function substr($string, $start, $length = null, $charset = null)
- public static function substr($string, $start, $length = null, $charset = null)
{
if (is_null($length)) {
$length = String::length($string, $charset) - $start;
@@ -367,7 +367,7 @@
*-
@return string The string’s part.
*/
-
@return string The string’s part.
- function length($string, $charset = null)
- public static function length($string, $charset = null)
{
if (is_null($charset)) {
$charset = $GLOBALS[’_HORDE_STRING_CHARSET’];
@@ -400,7 +400,7 @@
*-
@return integer The position of first occurrence.
*/
-
@return integer The position of first occurrence.
- function pos($haystack, $needle, $offset = 0, $charset = null)
- public static function pos($haystack, $needle, $offset = 0, $charset = null)
{
if (String::extensionExists(‘mbstring’)) {
if (is_null($charset)) {
@@ -434,7 +434,7 @@
*-
@return string The padded string.
*/
-
@return string The padded string.
- function pad($input, $length, $pad = ’ ', $type = STR_PAD_RIGHT,
- public static function pad($input, $length, $pad = ’ ', $type = STR_PAD_RIGHT,
$charset = null)
{
$mb_length = String::length($input, $charset);
@@ -491,7 +491,7 @@
*-
@return string String containing the wrapped text.
*/
-
@return string String containing the wrapped text.
- function wordwrap($string, $width = 75, $break = “\n”, $cut = false,
- public static function wordwrap($string, $width = 75, $break = “\n”, $cut = false,
$charset = null, $line_folding = false)
{
/* Get the user’s default character set if none passed in. */
@@ -560,7 +560,7 @@
*-
@return string String containing the wrapped text.
*/
-
@return string String containing the wrapped text.
- function wrap($text, $length = 80, $break_char = “\n”, $charset = null,
- public static function wrap($text, $length = 80, $break_char = “\n”, $charset = null,
$quote = false)
{
$paragraphs = array();
@@ -593,7 +593,7 @@
*-
@return boolean True if the parameter was alphabetic only.
*/
-
@return boolean True if the parameter was alphabetic only.
- function isAlpha($string, $charset = null)
- public static function isAlpha($string, $charset = null)
{
if (!String::extensionExists(‘mbstring’)) {
return ctype_alpha($string);
@@ -625,7 +625,7 @@
*-
@return boolean True if the parameter was lowercase.
*/
-
@return boolean True if the parameter was lowercase.
- function isLower($string, $charset = null)
- public static function isLower($string, $charset = null)
{
return ((String::lower($string, true, $charset) === $string) &&
String::isAlpha($string, $charset));
@@ -640,7 +640,7 @@
*-
@return boolean True if the parameter was uppercase.
*/
-
@return boolean True if the parameter was uppercase.
- function isUpper($string, $charset = null)
- public static function isUpper($string, $charset = null)
{
return ((String::upper($string, true, $charset) === $string) &&
String::isAlpha($string, $charset));
@@ -658,7 +658,7 @@
*-
@return array The matches array from the first regex that matches.
*/
-
@return array The matches array from the first regex that matches.
- function regexMatch($text, $regex, $charset = null)
-
public static function regexMatch($text, $regex, $charset = null)
{
if (!empty($charset)) {
$regex = String::convertCharset($regex, $charset, ‘utf-8’);
@@ -680,17 +680,17 @@
}/**
-
* Workaround charsets that don't work with mbstring functions.
-
* Workaround charsets that don't work with mbstring public static functions. * * @access private * * @param string $charset The original charset. *
-
* @return string The charset to use with mbstring functions. -
*/ - function _mbstringCharset($charset)
- {
-
/* mbstring functions do not handle the 'ks_c_5601-1987' &
-
* @return string The charset to use with mbstring public static functions. -
*/ - public static function _mbstringCharset($charset)
- {
-
/* mbstring public static functions do not handle the 'ks_c_5601-1987' & * 'ks_c_5601-1989' charsets. However, these charsets are used, for * example, by various versions of Outlook to send Korean characters. * Use UHC (CP949) encoding instead. See, e.g.,
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs