* use htmlspecialchars instead of htmlentities

git-svn-id: svn://netflint.net/xmpphp@17 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
fritzy 2008-04-06 22:50:29 +00:00
parent d4876b1702
commit 912a17ac07
2 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ class XMLObj {
$str .= "<{$this->name} xmlns='{$this->ns}' "; $str .= "<{$this->name} xmlns='{$this->ns}' ";
foreach($this->attrs as $key => $value) { foreach($this->attrs as $key => $value) {
if($key != 'xmlns') { if($key != 'xmlns') {
$value = htmlentities($value); $value = htmlspecialchars($value);
$str .= "$key='$value' "; $str .= "$key='$value' ";
} }
} }
@ -57,7 +57,7 @@ class XMLObj {
foreach($this->subs as $sub) { foreach($this->subs as $sub) {
$str .= $sub->tostring(); $str .= $sub->tostring();
} }
$body = htmlentities($this->data); $body = htmlspecialchars($this->data);
$str .= "$body</{$this->name}>"; $str .= "$body</{$this->name}>";
return $str; return $str;
} }

View File

@ -56,9 +56,9 @@ class XMPP extends XMLStream {
} }
function message($to, $body, $type='chat', $subject=Null) { function message($to, $body, $type='chat', $subject=Null) {
$to = htmlentities($to); $to = htmlspecialchars($to);
$body = htmlentities($body); $body = htmlspecialchars($body);
$subject = htmlentities($subject); $subject = htmlspecialchars($subject);
$out = "<message from='{$this->fulljid}' to='$to' type='$type'>"; $out = "<message from='{$this->fulljid}' to='$to' type='$type'>";
if($subject) $out .= "<subject>$subject</subject>"; if($subject) $out .= "<subject>$subject</subject>";
$out .= "<body>$body</body></message>"; $out .= "<body>$body</body></message>";
@ -66,8 +66,8 @@ class XMPP extends XMLStream {
} }
function presence($status=Null, $show='available', $to=Null) { function presence($status=Null, $show='available', $to=Null) {
$to = htmlentities($to); $to = htmlspecialchars($to);
$status = htmlentities($status); $status = htmlspecialchars($status);
if($show == 'unavailable') $type = 'unavailable'; if($show == 'unavailable') $type = 'unavailable';
$out = "<presence"; $out = "<presence";
if($to) $out .= " to='$to'"; if($to) $out .= " to='$to'";