mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 23:17:02 +03:00
Resolve #448
This commit is contained in:
parent
d6de75e3b7
commit
ac7eaf3cc1
6 changed files with 16 additions and 19 deletions
|
|
@ -249,7 +249,7 @@ class Component extends Node
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($this->children as $childGroup) {
|
foreach ($this->children as $childGroup) {
|
||||||
foreach ($childGroup as $child) {
|
foreach ($childGroup as $child) {
|
||||||
if ($child instanceof Property && strtoupper($child->group) === $group) {
|
if ($child instanceof Property && $child->group && strtoupper($child->group) === $group) {
|
||||||
$result[] = $child;
|
$result[] = $child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,11 @@ class VCard extends VObject\Document
|
||||||
$this->FN = (string) $this->ORG;
|
$this->FN = (string) $this->ORG;
|
||||||
$repaired = true;
|
$repaired = true;
|
||||||
|
|
||||||
|
// Otherwise, the NICKNAME property may work
|
||||||
|
} elseif (isset($this->NICKNAME)) {
|
||||||
|
$this->FN = (string) $this->NICKNAME;
|
||||||
|
$repaired = true;
|
||||||
|
|
||||||
// Otherwise, the EMAIL property may work
|
// Otherwise, the EMAIL property may work
|
||||||
} elseif (isset($this->EMAIL)) {
|
} elseif (isset($this->EMAIL)) {
|
||||||
$this->FN = (string) $this->EMAIL;
|
$this->FN = (string) $this->EMAIL;
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ class Parameter extends Node
|
||||||
*/
|
*/
|
||||||
public function xmlSerialize(Xml\Writer $writer)
|
public function xmlSerialize(Xml\Writer $writer)
|
||||||
{
|
{
|
||||||
foreach (is_array($this->value) ? $this->value : explode(',', $this->value) as $value) {
|
foreach (explode(',', $this->value) as $value) {
|
||||||
$writer->writeElement('text', $value);
|
$writer->writeElement('text', $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,11 @@ class CalAddress extends Text
|
||||||
return $input;
|
return $input;
|
||||||
}
|
}
|
||||||
list($schema, $everythingElse) = explode(':', $input, 2);
|
list($schema, $everythingElse) = explode(':', $input, 2);
|
||||||
|
$schema = strtolower($schema);
|
||||||
|
if ('mailto' === $schema) {
|
||||||
|
$everythingElse = strtolower($everythingElse);
|
||||||
|
}
|
||||||
|
|
||||||
return strtolower($schema).':'.$everythingElse;
|
return $schema.':'.$everythingElse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,23 +40,11 @@ class StringUtil
|
||||||
*/
|
*/
|
||||||
public static function convertToUTF8($str)
|
public static function convertToUTF8($str)
|
||||||
{
|
{
|
||||||
$encoding = mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'WINDOWS-1252'], true);
|
if (!mb_check_encoding($str, 'UTF-8') && mb_check_encoding($str, 'ISO-8859-1')) {
|
||||||
|
$str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
|
||||||
switch ($encoding) {
|
|
||||||
case 'ISO-8859-1':
|
|
||||||
$newStr = utf8_encode($str);
|
|
||||||
break;
|
|
||||||
/* Unreachable code. Not sure yet how we can improve this
|
|
||||||
* situation.
|
|
||||||
case 'WINDOWS-1252' :
|
|
||||||
$newStr = iconv('cp1252', 'UTF-8', $str);
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
default:
|
|
||||||
$newStr = $str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removing any control characters
|
// Removing any control characters
|
||||||
return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $newStr);
|
return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,5 @@ class Version
|
||||||
/**
|
/**
|
||||||
* Full version number.
|
* Full version number.
|
||||||
*/
|
*/
|
||||||
const VERSION = '4.4.1';
|
const VERSION = '4.4.2';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue