}
        } else {
            $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_START_ON_KEY_UP;
        }
        // Set chat attributes for transfer workflow logic
        if ($chat->department !== false && $chat->department->department_transfer_id > 0) {
            $chat->transfer_if_na = 1;
            $chat->transfer_timeout_ts = time();
            $chat->transfer_timeout_ac = $chat->department->transfer_timeout;
        }
        $chat->last_msg_id = $msg->id;
        $chat->last_user_msg_time = time();
        $chat->saveThis();
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_started', array('chat' => &$chat, 'msg' => $messageInitial));
        erLhcoreClassChat::updateDepartmentStats($chat->department);
        $Result = erLhcoreClassModule::reRun(erLhcoreClassDesign::baseurlRerun('chat/chatwidgetchat') . '/' . $chat->id . '/' . $chat->hash . $modeAppendTheme . '/(cstarted)/chat_started_by_invitation_cb');
        return true;
    } else {
        $tpl->set('errors', $Errors);
    }
}
$tpl->set('start_data_fields', $startDataFields);
// User this only if not post
if (!ezcInputForm::hasPostData()) {
    $definition = array('name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'value' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'type' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'size' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'req' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'sh' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'hattr' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'value_items_admin' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'via_hidden' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
    $form = new ezcInputForm(INPUT_GET, $definition);
    if ($form->hasValidData('name') && !empty($form->name)) {
        $inputData->name_items = $form->name;
    }
    if ($form->hasValidData('sh') && !empty($form->sh)) {
        $inputData->value_show = $form->sh;
Esempio n. 2
0
    list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['hash']);
    $sound = is_numeric($Params['user_parameters_unordered']['sound']) ? '/(sound)/' . $Params['user_parameters_unordered']['sound'] : '';
    try {
        $chat = erLhcoreClassModelChat::fetch($chatID);
        if ($chat->status == erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
            // Reopen chat automatically if possible
            if (erLhcoreClassModelChatConfig::fetch('automatically_reopen_chat')->current_value == 1 && erLhcoreClassModelChatConfig::fetch('reopen_chat_enabled')->current_value == 1 && erLhcoreClassModelChatConfig::fetch('allow_reopen_closed')->current_value == 1 && erLhcoreClassChat::canReopen($chat) !== false) {
                $sound = is_numeric($Params['user_parameters_unordered']['sound']) ? '/(sound)/' . $Params['user_parameters_unordered']['sound'] : '';
                erLhcoreClassModule::redirect('chat/reopen', '/' . $chatID . '/' . $hash . '/(mode)/widget' . $modeAppend . $modeAppendTheme . $sound);
                exit;
            }
        }
    } catch (Exception $e) {
    }
    // Rerun module
    $Result = erLhcoreClassModule::reRun(erLhcoreClassDesign::baseurlRerun('chat/chatwidgetchat') . '/' . $chatID . '/' . $hash . $modeAppend . $modeAppendTheme . $sound);
    return true;
}
$tpl = erLhcoreClassTemplate::getInstance('lhchat/chatwidget.tpl.php');
$tpl->set('referer', '');
$tpl->set('referer_site', '');
$tpl->set('theme', $theme);
$disabled_department = false;
if (is_array($Params['user_parameters_unordered']['department']) && erLhcoreClassModelChatConfig::fetch('hide_disabled_department')->current_value == 1) {
    try {
        erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
        $departments = erLhcoreClassModelDepartament::getList(array('filterin' => array('id' => $Params['user_parameters_unordered']['department'])));
        $disabledAll = true;
        foreach ($departments as $department) {
            if ($department->disabled == 0) {
                $disabledAll = false;