update_index();
//check if owner or operator is online and not invisible
$support_online = FALSE;
$core->index->reset();
while ($core->index->next())
{
$guid = $core->index->get("guid");
$status = $core->get_status($guid);
if (
flag($status, CMS_CORE_STATUS_OWNER | CMS_CORE_STATUS_OPERATOR)
&&
(! flag($status, CMS_CORE_STATUS_INVISIBLE))
)
{
$support_online = TRUE;
break;
};
};
//chat window template
$template = "" .
//title
"
" .
"Live Support" .
"
" .
//close button
"
" .
"
" .
//content
"%s" .
"
" .
//move script
"" .
jscript("mv_register(\"div-livesupport\");");
//no operator online
if (! $support_online)
{
//display info
if (CMS_TEMPLATE_EDIT)
echo(sprintf($template,
"",
"The Live Support is only displayed, " .
"if an operator is logged in visibly. " .
"" .
"Click here to log in." .
" " .
"This message is only visible in editing mode."));
return; //exit
};
$query = streq(CMS_USER, "anonymous") ? "?messenger_name=Guest_" . rx(CMS_USERID) : "";
//display chat
echo(sprintf($template,
"document.getElementById('iframe-livesupport').setAttribute('src'," .
"'" . qx(CMS_MODULES_URL) . "messenger.php?messenger_display=disconnect');",
""));
?>