R51404 - in /trunk/emailadmin/inc: class.emailadmin_script.inc.php class.emailadmin_sieve.inc.php

Author: ralfbecker
New Revision: 51404

URL: http://svn.stylite.de/viewvc/egroupware?rev=51404&view=rev
Log:
get arround: PHP Deprecated: Non-static method self::isError() should not be called statically, plus fixing IDE warnings

Modified:
trunk/emailadmin/inc/class.emailadmin_script.inc.php
trunk/emailadmin/inc/class.emailadmin_sieve.inc.php

Modified: trunk/emailadmin/inc/class.emailadmin_script.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/emailadmin/inc/class.emailadmin_script.inc.php?rev=51404&r1=51403&r2=51404&view=diff

— trunk/emailadmin/inc/class.emailadmin_script.inc.php (original)
+++ trunk/emailadmin/inc/class.emailadmin_script.inc.php Mon Jan 26 14:09:38 2015
@@ -101,13 +101,12 @@

	#print "<br><br><br><br>get Script ". $this->name ."<bR>";
  •   if(PEAR::isError($script = $connection->getScript($this->name))) {
    
  •   if(self::isError($script = $connection->getScript($this->name))) {
      	if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": error retrieving script: ".$script->getMessage());
      	return $script;
      }
    
      #print "<br>AAA: Script is ". htmlentities($script) ."<br>";
    
  •   $lines = array();
      $lines = preg_split("/\n/",$script); //,PREG_SPLIT_NO_EMPTY);
    
      $rules = array();
    

@@ -125,8 +124,8 @@

	/* next line should be the recognised encoded head. if not, the script
	 * is of an unrecognised format, and we should not overwrite it. */
  •   $line = array_shift($lines);
    
  •   if (!preg_match("/^# ?Mail(.*)rules for/", $line)){
    
  •   $line1 = array_shift($lines);
    
  •   if (!preg_match("/^# ?Mail(.*)rules for/", $line1)){
      		$this->errstr = 'retrieveRules: encoding not recognised';
      		$this->so = false;
      		if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": encoding not recognised");
    

@@ -136,7 +135,9 @@

	$line = array_shift($lines);
  •   while (isset($line)){
    
  •   while (isset($line))
    
  •   {
    
  •   	$matches = null;
      	if (preg_match("/^ *#(#PSEUDO|rule|vacation|mode|notify)/i",$line,$matches)){
      		$line = rtrim($line);
      		switch ($matches[1]){
    

@@ -182,9 +183,7 @@
if (preg_match("/^ #vacation&&(.)&&(.)&&(.)&&(.)&&(.)/i",$line,$bits) ||
preg_match("/^ #vacation&&(.)&&(.)&&(.)&&(.*)/i",$line,$bits)) {
$vacation[‘days’] = $bits[1];

  •   					$vaddresslist = $bits[2];
    
  •   					$vaddresslist = preg_replace("/\"|\s/","",$vaddresslist);
    
  •   					$vaddresses = array();
    
  •   					$vaddresslist = preg_replace("/\"|\s/","",$bits[2]);
      					$vaddresses = preg_split("/,/",$vaddresslist);
      					$vacation['text'] = $bits[3];
    

@@ -587,11 +586,10 @@
$this->script = $newscript;
//error_log(METHOD.LINE.array2string($newscript));
//print “

$newscript
”; exit;
  •   $scriptfile = $this->name;
      //print "<hr><pre>".htmlentities($newscript)."</pre><hr>";
      $ret = $connection->installScript($this->name, $newscript, true);
    
  •   if (!$ret || PEAR::isError($ret)) {
    
  •   	$this->errstr = 'updateScript: putscript failed: ' . (PEAR::isError($ret)?$ret->message:$connection->errstr);
    
  •   if (!$ret || self::isError($ret)) {
    
  •   	$this->errstr = 'updateScript: putscript failed: ' . (self::isError($ret)?$ret->message:$connection->errstr);
      	error_log(__METHOD__.__LINE__.' # Error: ->'.$this->errstr);
      	error_log(__METHOD__.__LINE__.' # ScriptName:'.$this->name.' Script:'.$newscript);
      	error_log(__METHOD__.__LINE__.' # Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid']);
    

@@ -600,4 +598,25 @@

	return true;
}
  • /**
    • Tell whether a value is a PEAR error.
    • Implemented here to get arround: PHP Deprecated: Non-static method self::isError() should not be called statically
    • @param mixed $data the value to test
    • @param int $code if $data is an error object, return true
    •                    only if $code is a string and
      
    •                    $obj->getMessage() == $code or
      
    •                    $code is an integer and $obj->getCode() == $code
      
    • @access public
    • @return bool true if parameter is an error
  • */
  • protected static function isError($data, $code = null)
  • {
  •   static $pear=null;
    
  •   if (!isset($pear)) $pear = new PEAR();
    
  •   return $pear->isError($data, $code);
    
  • }
    }

Modified: trunk/emailadmin/inc/class.emailadmin_sieve.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/emailadmin/inc/class.emailadmin_sieve.inc.php?rev=51404&r1=51403&r2=51404&view=diff

— trunk/emailadmin/inc/class.emailadmin_sieve.inc.php (original)
+++ trunk/emailadmin/inc/class.emailadmin_sieve.inc.php Mon Jan 26 14:09:38 2015
@@ -195,7 +195,7 @@
$this->_timeout = $timeout;
}

  •   if(PEAR::isError($this->error = $this->connect($sieveHost , $sievePort, $options, $useTLS) ) )
    
  •   if(self::isError($this->error = $this->connect($sieveHost , $sievePort, $options, $useTLS) ) )
      {
      	if ($this->debug)
      	{
    

@@ -215,7 +215,7 @@
$this->supportedAuthMethods = $sieveAuthMethods[$_icServerID];
}

  •   if(PEAR::isError($this->error = $this->login($username, $password, 'LOGIN', $euser) ) )
    
  •   if(self::isError($this->error = $this->login($username, $password, 'LOGIN', $euser) ) )
      {
      	if ($this->debug)
      	{
    

@@ -274,7 +274,7 @@
return PEAR::raiseError(‘Not currently in DISCONNECTED state’, 1);
}

  •   if (PEAR::isError($res = $this->_sock->connect($host, $port, false, ($this->_timeout?$this->_timeout:10), $options))) {
    
  •   if (self::isError($res = $this->_sock->connect($host, $port, false, ($this->_timeout?$this->_timeout:10), $options))) {
           return $res;
       }
    

@@ -282,14 +282,14 @@
$this->_state = NET_SIEVE_STATE_TRANSACTION;
} else {
$this->_state = NET_SIEVE_STATE_AUTHORISATION;

  •        if (PEAR::isError($res = $this->_doCmd())) {
    
  •        if (self::isError($res = $this->_doCmd())) {
               return $res;
           }
       }
    
       // Explicitly ask for the capabilities in case the connection is
       // picked up from an existing connection.
    
  •    if (PEAR::isError($res = $this->_cmdCapability())) {
    
  •    if (self::isError($res = $this->_cmdCapability())) {
           return PEAR::raiseError(
               'Failed to connect, server said: ' . $res->getMessage(), 2
           );
    

@@ -299,7 +299,7 @@
if ($useTLS && !empty($this->_capability[‘starttls’])
&& function_exists(‘stream_socket_enable_crypto’)
) {

  •        if (PEAR::isError($res = $this->_startTLS())) {
    
  •        if (self::isError($res = $this->_startTLS())) {
               return $res;
           }
       }
    

@@ -368,14 +368,14 @@
*/
function _cmdAuthenticate($uid , $pwd , $userMethod = null , $euser = ‘’ )
{

  •    if ( PEAR::isError( $method = $this->_getBestAuthMethod($userMethod) ) ) {
    
  •    if ( self::isError( $method = $this->_getBestAuthMethod($userMethod) ) ) {
           return $method;
       }
       //error_log(__METHOD__.__LINE__.' using AuthMethod: '.$method);
       switch ($method) {
           case 'DIGEST-MD5':
               $result = $this->_authDigestMD5( $uid , $pwd , $euser );
    
  •            if (!PEAR::isError($result))
    
  •            if (!self::isError($result))
      		{
      			break;
      		}
    

@@ -385,7 +385,7 @@
return $this->_cmdAuthenticate($uid , $pwd, null, $euser);
case ‘CRAM-MD5’:
$result = $this->_authCRAMMD5( $uid , $pwd, $euser);

  •            if (!PEAR::isError($result))
    
  •            if (!self::isError($result))
      		{
      			break;
      		}
    

@@ -395,7 +395,7 @@
return $this->_cmdAuthenticate($uid , $pwd, null, $euser);
case ‘LOGIN’:
$result = $this->_authLOGIN( $uid , $pwd , $euser );

  •            if (!PEAR::isError($result))
    
  •            if (!self::isError($result))
      		{
      			break;
      		}
    

@@ -410,16 +410,16 @@
$result = new PEAR_Error( “$method is not a supported authentication method” );
break;
}

  •    if (PEAR::isError($result))
    
  •    if (self::isError($result))
      {
      	return $result;
      }
    
  •   if (PEAR::isError($res = $this->_doCmd())) {
    
  •   if (self::isError($res = $this->_doCmd())) {
           return $res;
       }
    
       // Query the server capabilities again now that we are authenticated.
    
  •    if (PEAR::isError($res = $this->_cmdCapability())) {
    
  •    if (self::isError($res = $this->_cmdCapability())) {
           return PEAR::raiseError(
               'Failed to connect, server said: ' . $res->getMessage(), 2
           );
    

@@ -532,4 +532,25 @@

	return $script;
}
  • /**
    • Tell whether a value is a PEAR error.
    • Implemented here to get arround: PHP Deprecated: Non-static method self::isError() should not be called statically
    • @param mixed $data the value to test
    • @param int $code if $data is an error object, return true
    •                    only if $code is a string and
      
    •                    $obj->getMessage() == $code or
      
    •                    $code is an integer and $obj->getCode() == $code
      
    • @access public
    • @return bool true if parameter is an error
  • */
  • protected static function isError($data, $code = null)
  • {
  •   static $pear=null;
    
  •   if (!isset($pear)) $pear = new PEAR();
    
  •   return $pear->isError($data, $code);
    
  • }
    }

Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs