projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix group subscription query link update
[platal.git]
/
include
/
vcard.inc.php
diff --git
a/include/vcard.inc.php
b/include/vcard.inc.php
index
f357f74
..
5dd3b68
100644
(file)
--- a/
include/vcard.inc.php
+++ b/
include/vcard.inc.php
@@
-108,11
+108,13
@@
class VCardIterator implements PlIterator
class VCard
{
class VCard
{
+ static private $windows = false;
private $iterator = null;
public function __construct($users, $photos = true, $freetext = null)
{
$this->iterator = new VCardIterator($photos, $freetext);
private $iterator = null;
public function __construct($users, $photos = true, $freetext = null)
{
$this->iterator = new VCardIterator($photos, $freetext);
+ VCard::$windows = (strpos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false);
if (is_array($users)) {
foreach ($users as $user) {
$this->iterator->add_user($user);
if (is_array($users)) {
foreach ($users as $user) {
$this->iterator->add_user($user);
@@
-124,7
+126,11
@@
class VCard
public static function escape($text)
{
public static function escape($text)
{
- return preg_replace('/[,;]/', '\\\\$0', $text);
+ if (VCard::$windows) {
+ return str_replace(';', '\\\\;', $text);
+ } else {
+ return str_replace(array(';', ','), array('\\\\;', '\\\\,'), $text);
+ }
}
public static function format_adr($params, &$smarty)
}
public static function format_adr($params, &$smarty)
@@
-150,7
+156,10
@@
class VCard
if ($escape) {
$text = VCard::escape($text);
}
if ($escape) {
$text = VCard::escape($text);
}
- return preg_replace("/(\r\n|\n|\r)/", '\n', $text);
+ if (VCard::$windows) {
+ $text = utf8_decode($text);
+ }
+ return str_replace(array("\r\n", "\n", "\r"), '\n', $text);
}
public function do_page(&$page)
}
public function do_page(&$page)