Description: update deprecated/removed PHP functions Origin: upstream, http://email.uoa.gr/avelsieve/changeset/1091 , http://email.uoa.gr/avelsieve/changeset/1113 Bug: http://email.uoa.gr/avelsieve/ticket/269 Bug-Debian: http://bugs.debian.org/701182 Author: avel Reviewed-by: gregor herrmann <gregoa@debian.org> Last-Update: 2013-02-24 Applied-Upstream: yes, cf. Origin --- a/include/managesieve.lib.php +++ b/include/managesieve.lib.php @@ -139,13 +139,13 @@ unset($this->error_raw); $this->line=fgets($this->fp,1024); - $this->token = split(" ", $this->line, 2); + $this->token = preg_split('/ /', $this->line, 2); if($this->token[0] == "NO"){ /* we need to try and extract the error code from here. There are two possibilites: one, that it will take the form of: NO ("yyyyy") "zzzzzzz" or, two, NO {yyyyy} "zzzzzzzzzzz" */ $this->x = 0; - list($this->ltoken, $this->mtoken, $this->rtoken) = split(" ", $this->line." ", 3); + list($this->ltoken, $this->mtoken, $this->rtoken) = preg_split('/ /', $this->line." ", 3); if($this->mtoken[0] == "{"){ while($this->mtoken[$this->x] != "}" or $this->err_len < 1){ $this->err_len = substr($this->mtoken, 1, $this->x); @@ -233,7 +233,7 @@ atleast true for timsieved as it sits in 2.1.16, if someone has a BYE (REFERRAL ...) example for later timsieved please forward it to me and I'll code it in proper-like! - mloftis@wgops.com */ - $this->reftok = split(" ", $this->token[1], 3); + $this->reftok = preg_split('/ /', $this->token[1], 3); $this->refsv = substr($this->reftok[1], 0, -2); $this->refsv = substr($this->refsv, 1); @@ -438,7 +438,7 @@ //response. They repsond as follows: "Cyrus timsieved v1.0.0" "SASL={PLAIN,........}" //So, if we see IMPLEMENTATION in the first line, then we are done. - if(ereg("IMPLEMENTATION",$this->line)) + if(preg_match('/IMPLEMENTATION/',$this->line)) { //we're on the Cyrus V2 or Cyrus V3 sieve server while(sieve::status($this->line) == F_DATA){ @@ -454,7 +454,7 @@ } else { $this->cap_type="auth"; } - $this->modules = split(" ", $this->item[1]); + $this->modules = preg_split('/ /', $this->item[1]); if(is_array($this->modules)){ foreach($this->modules as $m) $this->capabilities[$this->cap_type][strtolower($m)]=true; @@ -488,7 +488,7 @@ $this->modules = substr($this->item[1], strpos($this->item[1], "{"),strlen($this->item[1])-1); //then split again at the ", " stuff. - $this->modules = split($this->modules, ", "); + $this->modules = preg_split('/, /', $this->modules); //fill up our $this->modules property if(is_array($this->modules)){ @@ -884,7 +884,7 @@ $cap_type="auth"; } - $this->modules = split(' ', $this->item[1]); + $this->modules = preg_split('/ /', $this->item[1]); if(is_array($this->modules)){ foreach($this->modules as $m) { $this->capabilities[$cap_type][strtolower($m)]=true; --- a/include/html_main.inc.php +++ b/include/html_main.inc.php @@ -227,7 +227,7 @@ */ function clear_avelsieve_messages() { if(isset($_SESSION['comm'])) { - session_unregister('comm'); + unset($_SESSION['comm']); } } --- a/include/html_rulestable.inc.php +++ b/include/html_rulestable.inc.php @@ -161,7 +161,7 @@ */ function rules_confirmation_text() { $out = $this->retrieve_avelsieve_messages(); - session_unregister('comm'); + unset($_SESSION['comm']); return $out; } --- a/setup.php +++ b/setup.php @@ -183,7 +183,7 @@ if($box == 'Junk' || $box == 'INBOX.Junk') { return true; } - $parts = split(str_replace('.', '\.',$delimiter), $box); + $parts = preg_split('/'.str_replace('.', '\.',$delimiter).'/', $box); if(sizeof($parts) > 1 && ($parts[0] == 'Junk' || $parts[1] == 'Junk')) { return true; } --- a/addrule.php +++ b/addrule.php @@ -41,9 +41,9 @@ if(isset($_POST['cancel'])) { unset($_SESSION['newrule']); - session_unregister('newrule'); unset($part); - session_unregister('part'); + if (isset($_SESSION['part'])) + unset($_SESSION['part']); header("Location: ./table.php"); exit; } @@ -250,8 +250,8 @@ $_SESSION['comm']['new'] = true; /* Remove addrule.php stuff */ - session_unregister('newrule'); - session_unregister('part'); + unset($_SESSION['newrule']); + unset($_SESSION['part']); /* go to table.php */ session_write_close(); --- a/table.php +++ b/table.php @@ -120,7 +120,7 @@ $s->delete('phpscript'); } */ } - session_unregister('rules'); + unset($_SESSION['rules']); header("Location: $location/../../src/options.php\n\n"); // header("Location: $location/../../src/options.php?optpage=avelsieve\n\n"); @@ -364,7 +364,7 @@ if (isset($_SESSION['returnnewrule'])) { /* There is a new rule to be added */ $newrule = $_SESSION['returnnewrule']; - session_unregister('returnnewrule'); + unset($_SESSION['returnnewrule']); $rules[] = $newrule; $haschanged = true; }