diff --git a/include/class.api.php b/include/class.api.php index 4c78d5bbc2729972a6efb36b8dddf0f42a1fb966..0fd2c17e3f0ab552513c775e5f2f93ee52bc1e7f 100644 --- a/include/class.api.php +++ b/include/class.api.php @@ -247,7 +247,7 @@ class ApiController { global $ost; foreach ($data as $key=>$info) { - if (is_array($structure) and is_array($info)) { + if (is_array($structure) && (is_array($info) || $info instanceof ArrayAccess)) { $search = (isset($structure[$key]) && !is_numeric($key)) ? $key : "*"; if (isset($structure[$search])) { $this->validateRequestStructure($info, $structure[$search], "$prefix$key/", $strict); diff --git a/include/class.client.php b/include/class.client.php index 0913820009d7f27e35b8d11d0d9989f50fd54b16..7dc764d1c8cfe4b59e083abf270089d26ac781e4 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -137,8 +137,7 @@ abstract class TicketUser { } function isOwner() { - return ($this->user - && $this->user->getId() == $this->getTicket()->getOwnerId()); + return $this instanceof TicketOwner; } function flagGuest() { diff --git a/include/class.forms.php b/include/class.forms.php index 7bb15a901d0564a41beffd04428f25fd1c2144fa..81689a7261a7eeadebf76d6f163cc8f93a8ecc9a 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -722,6 +722,14 @@ class TextareaField extends FormField { return (!$value) ? $value : Format::html2text($value); } + function parse($value) { + $config = $this->getConfiguration(); + if ($config['html']) + return Format::sanitize($value); + else + return $value; + } + } class PhoneField extends FormField { @@ -1641,8 +1649,10 @@ class TextareaWidget extends Widget { $cols = "cols=\"{$config['cols']}\""; if (isset($config['length']) && $config['length']) $maxlength = "maxlength=\"{$config['length']}\""; - if (isset($config['html']) && $config['html']) + if (isset($config['html']) && $config['html']) { $class = 'class="richtext no-bar small"'; + $this->value = Format::viewableImages($this->value); + } ?> <span style="display:inline-block;width:100%"> <textarea <?php echo $rows." ".$cols." ".$maxlength." ".$class @@ -1790,13 +1800,13 @@ class CheckboxWidget extends Widget { if (!isset($this->value)) $this->value = $this->field->get('default'); ?> - <input type="checkbox" name="<?php echo $this->name; ?>[]" <?php + <input style="vertical-align:top;" type="checkbox" name="<?php echo $this->name; ?>[]" <?php if ($this->value) echo 'checked="checked"'; ?> value="<?php echo $this->field->get('id'); ?>"/> <?php if ($config['desc']) { ?> <em style="display:inline-block"><?php - echo Format::htmlchars($config['desc']); ?></em> + echo Format::viewableImages($config['desc']); ?></em> <?php } } diff --git a/include/class.thread.php b/include/class.thread.php index f7751f78e7f9d6b2a66fee694cdeb943f321ee86..eef0e6b7a6c2c969fea0bc454bf9247aa402b95c 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -428,11 +428,11 @@ Class ThreadEntry { if (!($ticket = $this->getTicket())) return null; - if ($ticket->getOwnerId() == $ticket->getUserId()) + if ($ticket->getOwnerId() == $this->getUserId()) $this->user = new TicketOwner( User::lookup($this->getUserId()), $ticket); else - $this->user = Collborator::lookup(array( + $this->user = Collaborator::lookup(array( 'userId'=>$this->getUserId(), 'ticketId'=>$this->getTicketId())); } diff --git a/include/class.ticket.php b/include/class.ticket.php index 4e4c56f696a275ffe3aedd4c627316a77d847bd1..6e0a07583b0758a88f5bfb1a77d7a7b5f47a6e0a 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1121,7 +1121,7 @@ class Ticket { $options = array('inreplyto' => $entry->getEmailMessageId(), 'thread' => $entry); foreach ($recipients as $recipient) { - if ($uid == $recipient->getId()) continue; + if ($uid == $recipient->getUserId()) continue; $options['references'] = $entry->getEmailReferencesForUser($recipient); $notice = $this->replaceVars($msg, array('recipient' => $recipient)); $email->send($recipient->getEmail(), $notice['subj'], $notice['body'], $attachments,