| | |
| | | else { |
| | | $this->resultcode = null; |
| | | // parse response for [APPENDUID 1204196876 3456] |
| | | if (preg_match("/^\[APPENDUID [0-9]+ ([0-9,:*]+)\]/i", $str, $m)) { |
| | | if (preg_match("/^\[APPENDUID [0-9]+ ([0-9]+)\]/i", $str, $m)) { |
| | | $this->data['APPENDUID'] = $m[1]; |
| | | } |
| | | // parse response for [COPYUID 1204196876 3456:3457 123:124] |
| | | else if (preg_match("/^\[COPYUID [0-9]+ ([0-9,:]+) ([0-9,:]+)\]/i", $str, $m)) { |
| | | $this->data['COPYUID'] = array($m[1], $m[2]); |
| | | } |
| | | } |
| | | $this->result = $str; |
| | |
| | | */ |
| | | function enable($extension) |
| | | { |
| | | if (empty($extension)) |
| | | if (empty($extension)) { |
| | | return false; |
| | | } |
| | | |
| | | if (!$this->hasCapability('ENABLE')) |
| | | if (!$this->hasCapability('ENABLE')) { |
| | | return false; |
| | | } |
| | | |
| | | if (!is_array($extension)) |
| | | if (!is_array($extension)) { |
| | | $extension = array($extension); |
| | | } |
| | | |
| | | if (!empty($this->extensions_enabled)) { |
| | | // check if all extensions are already enabled |
| | | $diff = array_diff($extension, $this->extensions_enabled); |
| | | |
| | | if (empty($diff)) { |
| | | return $extension; |
| | | } |
| | | |
| | | // Make sure the mailbox isn't selected, before enabling extension(s) |
| | | if ($this->selected !== null) { |
| | | $this->close(); |
| | | } |
| | | } |
| | | |
| | | list($code, $response) = $this->execute('ENABLE', $extension); |
| | | |
| | |
| | | $response = substr($response, 10); // remove prefix "* ENABLED " |
| | | $result = (array) $this->tokenizeResponse($response); |
| | | |
| | | return $result; |
| | | $this->extensions_enabled = array_unique(array_merge((array)$this->extensions_enabled, $result)); |
| | | |
| | | return $this->extensions_enabled; |
| | | } |
| | | |
| | | return false; |
| | |
| | | */ |
| | | function copy($messages, $from, $to) |
| | | { |
| | | // Clear last COPYUID data |
| | | unset($this->data['COPYUID']); |
| | | |
| | | if (!$this->select($from)) { |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | static function getStructurePartData($structure, $part) |
| | | { |
| | | $part_a = self::getStructurePartArray($structure, $part); |
| | | $data = array(); |
| | | $part_a = self::getStructurePartArray($structure, $part); |
| | | $data = array(); |
| | | |
| | | if (empty($part_a)) { |
| | | if (empty($part_a)) { |
| | | return $data; |
| | | } |
| | | |
| | |
| | | |
| | | static function getStructurePartArray($a, $part) |
| | | { |
| | | if (!is_array($a)) { |
| | | if (!is_array($a)) { |
| | | return false; |
| | | } |
| | | |
| | | if (empty($part)) { |
| | | return $a; |
| | | } |
| | | return $a; |
| | | } |
| | | |
| | | $ctype = is_string($a[0]) && is_string($a[1]) ? $a[0] . '/' . $a[1] : ''; |
| | | |
| | |
| | | $a = $a[8]; |
| | | } |
| | | |
| | | if (strpos($part, '.') > 0) { |
| | | $orig_part = $part; |
| | | $pos = strpos($part, '.'); |
| | | $rest = substr($orig_part, $pos+1); |
| | | $part = substr($orig_part, 0, $pos); |
| | | if (strpos($part, '.') > 0) { |
| | | $orig_part = $part; |
| | | $pos = strpos($part, '.'); |
| | | $rest = substr($orig_part, $pos+1); |
| | | $part = substr($orig_part, 0, $pos); |
| | | |
| | | return self::getStructurePartArray($a[$part-1], $rest); |
| | | } |
| | | return self::getStructurePartArray($a[$part-1], $rest); |
| | | } |
| | | else if ($part > 0) { |
| | | if (is_array($a[$part-1])) |
| | | return $a[$part-1]; |
| | | else |
| | | return $a; |
| | | } |
| | | return (is_array($a[$part-1])) ? $a[$part-1] : $a; |
| | | } |
| | | } |
| | | |
| | | /** |