Update setup_logo function to return data

This commit is contained in:
Dmitriy Simushev 2013-02-18 12:09:53 +00:00
parent 691ce8986c
commit 71a0330a0b
5 changed files with 48 additions and 18 deletions

View File

@ -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");

View File

@ -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");
?>

View File

@ -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') {

View File

@ -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;
?>

View File

@ -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 {