diff --git a/src/messenger/webim/client.php b/src/messenger/webim/client.php index 7106813d..ea4a9c4d 100644 --- a/src/messenger/webim/client.php +++ b/src/messenger/webim/client.php @@ -89,10 +89,9 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { } if(!has_online_operators($groupid)) { - $page = array(); - setup_logo($group); + // Create page array $page = array_merge_recursive( - $page, + setup_logo($group), setup_leavemessage($visitor['name'],$email,$firstmessage,$groupid,$groupname,$info,$referrer) ); expand("styles/dialogs", getchatstyle(), "leavemessage.tpl"); @@ -102,10 +101,9 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { $invitation_state = invitation_state($_SESSION['visitorid']); $visitor_is_invited = Settings::get('enabletracking') && $invitation_state['invited'] && !$invitation_state['threadid']; if(Settings::get('enablepresurvey') == '1' && !(isset($_POST['survey']) && $_POST['survey'] == 'on') && !$visitor_is_invited) { - $page = array(); - setup_logo($group); + // Create page array $page = array_merge_recursive( - $page, + setup_logo($group), setup_survey($visitor['name'], $email, $groupid, $info, $referrer) ); expand("styles/dialogs", getchatstyle(), "survey.tpl"); diff --git a/src/messenger/webim/leavemessage.php b/src/messenger/webim/leavemessage.php index 9e1ea739..66e19dec 100644 --- a/src/messenger/webim/leavemessage.php +++ b/src/messenger/webim/leavemessage.php @@ -101,9 +101,9 @@ if(Settings::get("enablecaptcha") == "1" && can_show_captcha()) { if( count($errors) > 0 ) { $page = array_merge_recursive( $page, + setup_logo($group), setup_leavemessage($visitor_name,$email,$message,$groupid,$groupname,$info,$referrer) ); - setup_logo($group); expand("styles/dialogs", getchatstyle(), "leavemessage.tpl"); exit; } @@ -137,6 +137,9 @@ if($inbox_mail) { webim_mail($inbox_mail, $email, $subject, $body); } -setup_logo($group); +$page = array_merge_recursive( + $page, + setup_logo($group) +); expand("styles/dialogs", getchatstyle(), "leavemessagesent.tpl"); ?> \ No newline at end of file diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index ddddb9ee..36aaa232 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -128,13 +128,30 @@ function needsFramesrc() return strstr($useragent, "safari/"); } -function setup_logo($group = NULL) -{ - global $page; +/** + * Prepare logo data + * + * @param array $group Group info + * @return array Array of logo data + */ +function setup_logo($group = NULL) { + $data = array(); + $toplevelgroup = (!$group)?array():get_top_level_group($group); - $page['ct.company.name'] = topage(empty($toplevelgroup['vctitle'])?Settings::get('title'):$toplevelgroup['vctitle']); - $page['ct.company.chatLogoURL'] = topage(empty($toplevelgroup['vclogo'])?Settings::get('logo'):$toplevelgroup['vclogo']); - $page['webimHost'] = topage(empty($toplevelgroup['vchosturl'])?Settings::get('hosturl'):$toplevelgroup['vchosturl']); + + $data['ct.company.name'] = topage(empty($toplevelgroup['vctitle']) + ? Settings::get('title') + : $toplevelgroup['vctitle']); + + $data['ct.company.chatLogoURL'] = topage(empty($toplevelgroup['vclogo']) + ? Settings::get('logo') + : $toplevelgroup['vclogo']); + + $data['webimHost'] = topage(empty($toplevelgroup['vchosturl']) + ? Settings::get('hosturl') + : $toplevelgroup['vchosturl']); + + return $data; } /** @@ -284,7 +301,10 @@ function setup_chatview(Thread $thread) { ); // Setup logo - setup_logo($group); + $data = array_merge_recursive( + $data, + setup_logo($group) + ); // Set enter key shortcut if (Settings::get('sendmessagekey') == 'enter') { diff --git a/src/messenger/webim/mail.php b/src/messenger/webim/mail.php index ac525efe..76977827 100644 --- a/src/messenger/webim/mail.php +++ b/src/messenger/webim/mail.php @@ -47,7 +47,10 @@ if( count($errors) > 0 ) { $page['ct.chatThreadId'] = $thread->id; $page['ct.token'] = $thread->lastToken; $page['level'] = ""; - setup_logo($group); + $page = array_merge_recursive( + $page, + setup_logo($group) + ); expand("styles/dialogs", getchatstyle(), "mail.tpl"); exit; } @@ -67,7 +70,10 @@ $body = getstring2( webim_mail($email, $webim_mailbox, $subject, $body); -setup_logo($group); +$page = array_merge_recursive( + $page, + setup_logo($group) +); expand("styles/dialogs", getchatstyle(), "mailsent.tpl"); exit; ?> \ No newline at end of file diff --git a/src/messenger/webim/operator/redirect.php b/src/messenger/webim/operator/redirect.php index 70500a05..fe308858 100644 --- a/src/messenger/webim/operator/redirect.php +++ b/src/messenger/webim/operator/redirect.php @@ -106,7 +106,10 @@ if (isset($_GET['nextGroup'])) { } } -setup_logo(); +$page = array_merge_recursive( + $page, + setup_logo() +); if (count($errors) > 0) { expand("../styles/dialogs", getchatstyle(), "error.tpl"); } else {