diff --git a/include/class.staff.php b/include/class.staff.php index 961186e7317d84fac88c613b1635b493929b7131..cf6238fcceed445e810562885875e91fcd027957 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -83,8 +83,12 @@ class Staff extends AuthenticatedUser { return $this->load(); } + function __toString() { + return (string) $this->getName(); + } + function asVar() { - return $this->getName(); + return $this->__toString(); } function getHastable() { diff --git a/include/class.thread.php b/include/class.thread.php index 11005197501f39f61e6733707a98f00d679d49ec..d93f8e289b5f6e3befd4555426a4e0067c4de63e 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -876,7 +876,7 @@ Class ThreadEntry { $poster = $vars['poster']; if ($poster && is_object($poster)) - $poster = $poster->getName(); + $poster = (string) $poster; $sql=' INSERT INTO '.TICKET_THREAD_TABLE.' SET created=NOW() ' .' ,thread_type='.db_input($vars['type']) @@ -962,6 +962,11 @@ class Message extends ThreadEntry { $vars['type'] = 'M'; $vars['body'] = $vars['message']; + if (!$vars['poster'] + && $vars['userId'] + && ($user = User::lookup($vars['userId']))) + $vars['poster'] = (string) $user->getName(); + return ThreadEntry::add($vars); } @@ -1028,6 +1033,11 @@ class Response extends ThreadEntry { if(!$vars['pid'] && $vars['msgId']) $vars['pid'] = $vars['msgId']; + if (!$vars['poster'] + && $vars['staffId'] + && ($staff = Staff::lookup($vars['staffId']))) + $vars['poster'] = (string) $staff->getName(); + return ThreadEntry::add($vars); } diff --git a/open.php b/open.php index 706c9ccd4a31e6febee613c9416acfc19988ef36..f027bb1bca2851907ede5589051d989cdec8fed9 100644 --- a/open.php +++ b/open.php @@ -20,9 +20,8 @@ $errors=array(); if($_POST): $vars = $_POST; $vars['deptId']=$vars['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected. - if($thisclient) { - $vars['name']=$thisclient->getName(); - $vars['email']=$thisclient->getEmail(); + if ($thisclient) { + $vars['uid']=$thisclient->getId(); } elseif($cfg->isCaptchaEnabled()) { if(!$_POST['captcha']) $errors['captcha']='Enter text shown on the image'; diff --git a/tickets.php b/tickets.php index 7105e1054c5c02c82f0cc8c4c618c60434d27af1..6444b9cf4c8ebf0ece82793d46ca4da98c657930 100644 --- a/tickets.php +++ b/tickets.php @@ -43,6 +43,7 @@ if($_POST && is_object($ticket) && $ticket->getId()): //Everything checked out...do the magic. $vars = array( 'userId' => $thisclient->getId(), + 'poster' => (string) $thisclient->getName(), 'message' => $_POST['message']); if($cfg->allowOnlineAttachments() && $_FILES['attachments']) $vars['files'] = AttachmentFile::format($_FILES['attachments'], true);