/**
  * At the moment it just stores an account. In the future there will be a call to create an account in xmpp server using NodeJS extension
  * @param erLhcoreClassModelXMPPAccount $xmppAccount
  */
 public static function publishXMPPAccount(erLhcoreClassModelXMPPAccount &$xmppAccount)
 {
     if ($xmppAccount->id == 0) {
         erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->registerOperator($xmppAccount);
     } elseif ($xmppAccount->password != '') {
         erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->changeOperatorPassword($xmppAccount);
     }
     // We do not store operators passwords because we do not need them
     if ($xmppAccount->type == erLhcoreClassModelXMPPAccount::USER_TYPE_OPERATOR) {
         $xmppAccount->password = '';
     }
     $xmppAccount->saveThis();
 }
 public function __get($var)
 {
     switch ($var) {
         case 'ctime_front':
             $this->ctime_front = date('Ymd') == date('Ymd', $this->ctime) ? date(erLhcoreClassModule::$dateHourFormat, $this->ctime) : date(erLhcoreClassModule::$dateDateHourFormat, $this->ctime);
             return $this->ctime_front;
             break;
         case 'lactivity_front':
             $this->lactivity_front = date('Ymd') == date('Ymd', $this->lactivity) ? date(erLhcoreClassModule::$dateHourFormat, $this->lactivity) : date(erLhcoreClassModule::$dateDateHourFormat, $this->lactivity);
             return $this->lactivity_front;
             break;
         case 'user':
             $this->user = false;
             if ($this->user_id > 0) {
                 try {
                     $this->user = erLhcoreClassModelUser::fetch($this->user_id, true);
                 } catch (Exception $e) {
                     $this->user = false;
                 }
             }
             return $this->user;
             break;
         case 'username_plain':
             list($this->username_plain) = explode('@', $this->username);
             return $this->username_plain;
             break;
         case 'username_plain_edit':
             list($this->username_plain_edit) = explode('@', $this->username);
             $subdomain = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['subdomain'];
             if ($subdomain != '') {
                 $this->username_plain_edit = $this->str_lreplace('.' . $subdomain, '', $this->username_plain_edit);
             }
             return $this->username_plain_edit;
             break;
         default:
             break;
     }
 }
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/geoadjustment.tpl.php');
$geoData = erLhcoreClassModelChatConfig::fetch('geoadjustment_data');
$data = (array) $geoData->data;
if (isset($_POST['SaveGeoAdjustment'])) {
    $definition = array('use_geo_adjustment' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'AvailableFor' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'OtherCountries' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'HideFor' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'OtherStatus' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'RestStatus' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ApplyWidget' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('xmp/configuration');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('use_geo_adjustment')) {
        $data['use_geo_adjustment'] = true;
    } else {
        $data['use_geo_adjustment'] = false;
    }
    if ($data['use_geo_adjustment']) {
        if ($form->hasValidData('AvailableFor')) {
            $data['available_for'] = $form->AvailableFor;
        } else {
            $data['available_for'] = '';
        }
        if ($form->hasValidData('OtherCountries')) {
            $data['other_countries'] = $form->OtherCountries;
        } else {
            $data['other_countries'] = '';
        }
        if ($form->hasValidData('HideFor')) {
Esempio n. 4
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhtheme/import.tpl.php');
if (ezcInputForm::hasPostData()) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('theme/import');
        exit;
    }
    if (erLhcoreClassSearchHandler::isFile('themefile', array('json'))) {
        $dir = 'var/tmpfiles/';
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('theme.temppath', array('dir' => &$dir));
        erLhcoreClassFileUpload::mkdirRecursive($dir);
        $filename = erLhcoreClassSearchHandler::moveUploadedFile('themefile', $dir);
        $content = file_get_contents($dir . $filename);
        unlink($dir . $filename);
        $data = json_decode($content);
        if ($data !== null) {
            $widgetTheme = new erLhAbstractModelWidgetTheme();
            $data = (array) $data;
            $imgData = array();
            if (isset($data['logo_image_data'])) {
                $imgData['logo_image'] = $data['logo_image_data'];
                unset($data['logo_image_data']);
            }
            if (isset($data['need_help_image_data'])) {
                $imgData['need_help_image'] = $data['need_help_image_data'];
                unset($data['need_help_image_data']);
            }
            if (isset($data['online_image_data'])) {
                $imgData['online_image'] = $data['online_image_data'];
                unset($data['online_image_data']);
Esempio n. 5
0
        $Errors[] = 'Please enter valid date';
    }
    if ($form->hasValidData('AttrInt1')) {
        $Instance->attr_int_1 = $form->AttrInt1;
    }
    if ($form->hasValidData('AttrInt2')) {
        $Instance->attr_int_2 = $form->AttrInt2;
    }
    if ($form->hasValidData('AttrInt3')) {
        $Instance->attr_int_3 = $form->AttrInt3;
    }
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('instance/list');
        exit;
    }
    if (count($Errors) == 0) {
        $Instance->saveThis();
        if (isset($_POST['Save_departament'])) {
            erLhcoreClassModule::redirect('instance/list');
            exit;
        } else {
            $tpl->set('updated', true);
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.editinstance', array('instance' => &$Instance));
$tpl->set('instance', $Instance);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('instance/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instances')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Edit instance') . ' - ' . $Instance->address));
Esempio n. 6
0
    $redirectFull = $redirect != '' ? '/(r)/' . rawurlencode($redirect) : '';
    header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin/user/login') . $redirectFull);
    exit;
}
$tpl = erLhcoreClassTemplate::getInstance('lhuser/login.tpl.php');
$redirect = '';
if (isset($_POST['redirect'])) {
    $redirect = $_POST['redirect'];
    $tpl->set('redirect_url', $redirect);
} else {
    $redirect = rawurldecode($Params['user_parameters_unordered']['r']);
    $tpl->set('redirect_url', $redirect);
}
if (isset($_POST['Login'])) {
    if (!$currentUser->authenticate($_POST['Username'], $_POST['Password'], isset($_POST['rememberMe']) && $_POST['rememberMe'] == 1 ? true : false)) {
        $Error = erTranslationClassLhTranslation::getInstance()->getTranslation('user/login', 'Incorrect username or password');
        $tpl->set('errors', array($Error));
    } else {
        if ($redirect != '') {
            erLhcoreClassModule::redirect(base64_decode($redirect));
        } else {
            erLhcoreClassModule::redirect();
            exit;
        }
    }
}
$pagelayout = erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'login_pagelayout');
if ($pagelayout != null) {
    $Result['pagelayout'] = 'login';
}
$Result['content'] = $tpl->fetch();
Esempio n. 7
0
                    erLhcoreClassChat::getSession()->save($msg);
                }
            }
        }
        // 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));
        // Redirect user
        erLhcoreClassModule::redirect('chat/chatwidgetchat/' . $chat->id . '/' . $chat->hash . $modeAppendTheme . '/(cstarted)/chat_started_by_invitation_cb');
        exit;
    } else {
        $tpl->set('errors', $Errors);
    }
}
// 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));
    $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. 8
0
$tpl = erLhcoreClassTemplate::getInstance('lhform/collected.tpl.php');
$form = erLhAbstractModelForm::fetch((int) $Params['user_parameters']['form_id']);
if (is_numeric($Params['user_parameters_unordered']['id']) && $Params['user_parameters_unordered']['action'] == 'delete') {
    // Delete selected canned message
    try {
        if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
            die('Invalid CSRF Token');
            exit;
        }
        $collected = erLhAbstractModelFormCollected::fetch((int) $Params['user_parameters_unordered']['id']);
        $collected->removeThis();
    } catch (Exception $e) {
        // Do nothing
    }
    erLhcoreClassModule::redirect('form/collected', '/' . $form->id);
    exit;
}
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('form/collected') . '/' . $form->id;
$pages->items_total = erLhAbstractModelFormCollected::getCount(array('filter' => array('form_id' => $form->id)));
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhAbstractModelFormCollected::getList(array('filter' => array('form_id' => $form->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id DESC'));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$tpl->set('form', $form);
$Result['content'] = $tpl->fetch();
Esempio n. 9
0
        }
        if (count($Errors) == 0) {
            $cannedMessage->msg = $form->Message;
            $cannedMessage->user_id = $UserData->id;
            $cannedMessage->saveThis();
            $tpl->set('updated_canned', true);
        } else {
            $tpl->set('errors_canned', $Errors);
        }
    }
    /**
     * Delete canned message
     * */
    if (is_numeric($Params['user_parameters_unordered']['msg']) && $Params['user_parameters_unordered']['action'] == 'delete') {
        if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
            die('Invalid CSRF Token');
            exit;
        }
        try {
            $cannedToDelete = erLhcoreClassModelCannedMsg::fetch($Params['user_parameters_unordered']['msg']);
            if ($cannedToDelete->user_id == $UserData->id) {
                $cannedToDelete->removeThis();
            }
        } catch (Exception $e) {
        }
        erLhcoreClassModule::redirect('user/account', '#canned');
        exit;
    }
    $tpl->set('canned_msg', $cannedMessage);
}
$Result['content'] = $tpl->fetch();
Esempio n. 10
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdocshare/edit.tpl.php');
$docShare = erLhcoreClassModelDocShare::fetch($Params['user_parameters']['id']);
if (isset($_POST['Update'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    $Errors = erLhcoreClassDocShare::validateDocShare($docShare);
    if (count($Errors) == 0) {
        $docShare->saveThis();
        erLhcoreClassDocShare::makeConversion($docShare);
        $tpl->set('updated', true);
    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['Cancel'])) {
    erLhcoreClassModule::redirect('docshare/list');
    exit;
}
$tpl->set('docshare', $docShare);
$docSharer = erLhcoreClassModelChatConfig::fetch('doc_sharer');
$data = (array) $docSharer->data;
$tpl->set('share_data', $data);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('docshare/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('docshare/index', 'Documents sharer')), array('url' => erLhcoreClassDesign::baseurl('docshare/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('docshare/list', 'Documents list')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('docshare/edit', 'Document edit')));
            }
        } 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. 12
0
                    erLhcoreClassChat::getSession()->save($msg);
                    if ($chat->last_msg_id < $msg->id) {
                        $chat->last_msg_id = $msg->id;
                    }
                }
                erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.auto_responder_triggered', array('chat' => &$chat));
                $chat->saveThis();
            }
            erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_started', array('chat' => &$chat, 'msg' => $messageInitial));
            erLhcoreClassChat::updateDepartmentStats($chat->department);
            // Paid chat settings
            if (isset($paidChatSettings)) {
                erLhcoreClassChatPaid::processPaidChatWorkflow(array('chat' => $chat, 'paid_chat_params' => $paidChatSettings));
            }
            // Redirect user
            erLhcoreClassModule::redirect('chat/chat/' . $chat->id . '/' . $chat->hash . $themeAppend);
            exit;
        }
    } else {
        // Show errors only if user is not switching form mode
        if ($Params['user_parameters_unordered']['switchform'] != 'true' && !isset($_POST['switchLang'])) {
            $tpl->set('errors', $Errors);
        }
    }
}
$tpl->set('start_data_fields', $startDataFields);
$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), 'encattr' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'via_encrypted' => 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;
}
Esempio n. 13
0
<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$question = erLhcoreClassQuestionary::getSession()->load('erLhcoreClassModelQuestion', $Params['user_parameters']['id']);
$question->removeThis();
erLhcoreClassModule::redirect('questionary/list');
exit;
Esempio n. 14
0
<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$question = erLhcoreClassModelQuestionOption::fetch((int) $Params['user_parameters']['id']);
$question->removeThis();
erLhcoreClassModule::redirect('questionary/edit', "/{$question->question_id}/(tab)/voting");
exit;
Esempio n. 15
0
            if (erLhcoreClassModelChatConfig::fetch('reopen_as_new')->current_value == 1 || $chat->user_id == 0) {
                // Reset to fresh state to workflow triggers to work
                $chat->status = erLhcoreClassModelChat::STATUS_PENDING_CHAT;
                $chat->nc_cb_executed = 0;
                $chat->na_cb_executed = 0;
                $chat->time = time();
                // Set time to new
            } else {
                $chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;
            }
            $chat->updateThis();
        }
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.user_reopened', array('chat' => &$chat));
        if ($Params['user_parameters_unordered']['mode'] == 'widget') {
            // Redirect user
            erLhcoreClassModule::redirect('chat/chatwidgetchat', '/' . $chat->id . '/' . $chat->hash . $modeAppend . $modeAppendTheme);
            exit;
        } else {
            // Redirect user
            erLhcoreClassModule::redirect('chat/chat', '/' . $chat->id . '/' . $chat->hash . $modeAppendTheme);
            exit;
        }
    } else {
        header('Location: ' . $_SERVER['HTTP_REFERER']);
        exit;
    }
} catch (Exception $e) {
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
exit;
Esempio n. 16
0
<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$ObjectData = erLhcoreClassAbstract::getSession()->load('erLhAbstractModel' . $Params['user_parameters']['identifier'], (int) $Params['user_parameters']['object_id']);
$object_trans = $ObjectData->getModuleTranslations();
if (isset($object_trans['permission']) && !$currentUser->hasAccessTo($object_trans['permission']['module'], $object_trans['permission']['function'])) {
    erLhcoreClassModule::redirect();
    exit;
}
if (method_exists($ObjectData, 'checkPermission')) {
    if ($ObjectData->checkPermission() === false) {
        erLhcoreClassModule::redirect();
        exit;
    }
}
$ObjectData->removeThis();
$cache = CSCacheAPC::getMem();
$cache->increaseCacheVersion('site_attributes_version');
erLhcoreClassModule::redirect('abstract/list', '/' . $Params['user_parameters']['identifier']);
exit;
Esempio n. 17
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhuser/autologinconfig.tpl.php');
$autologinData = erLhcoreClassModelChatConfig::fetch('autologin_data');
$data = (array) $autologinData->data;
if (isset($_POST['StoreAutologinSettings'])) {
    $definition = array('secret_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'enabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/autologinconfig');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    try {
        if ($form->hasValidData('secret_hash') && strlen($form->secret_hash) >= 10) {
            $data['secret_hash'] = $form->secret_hash;
        } else {
            throw new Exception('Please enter secret hash');
        }
        if ($form->hasValidData('enabled') && $form->enabled == true) {
            $data['enabled'] = 1;
        } else {
            $data['enabled'] = 0;
        }
        $autologinData->value = serialize($data);
        $autologinData->saveThis();
        $CacheManager = erConfigClassLhCacheConfig::getInstance();
        $CacheManager->expireCache();
        $tpl->set('updated', 'done');
    } catch (Exception $e) {
             if ($responder->wait_message != '') {
                 $msg = new erLhcoreClassModelmsg();
                 $msg->msg = trim($responder->wait_message);
                 $msg->chat_id = $chat->id;
                 $msg->name_support = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Live Support');
                 $msg->user_id = 1;
                 $msg->time = time() + 5;
                 erLhcoreClassChat::getSession()->save($msg);
                 if ($chat->last_msg_id < $msg->id) {
                     $chat->last_msg_id = $msg->id;
                 }
             }
             $chat->saveThis();
         }
         // Redirect user
         erLhcoreClassModule::redirect('chat/chatwidgetchat', '/' . $chat->id . '/' . $chat->hash . $modeAppend . '/(cstarted)/online_chat_started_cb');
         flush();
         session_write_close();
         if (function_exists('fastcgi_finish_request')) {
             fastcgi_finish_request();
         }
         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_started', array('chat' => &$chat));
         exit;
     }
 } else {
     // Show errors only if user is not switching form mode and not swithing language
     if ($Params['user_parameters_unordered']['switchform'] != 'true' && !isset($_POST['switchLang'])) {
         $tpl->set('errors', $Errors);
     } elseif (isset($_POST['switchLang'])) {
         $Result['additional_post_message'] = 'lhc_lang:' . erLhcoreClassSystem::instance()->WWWDirLang;
     }
Esempio n. 19
0
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token']) || !$currentUser->hasAccessTo('lhdepartament', 'delete') || !$Departament->can_delete) {
        erLhcoreClassModule::redirect('departament/departaments');
        exit;
    }
    $Departament->removeThis();
    erLhcoreClassModule::redirect('departament/departaments');
    exit;
}
if (isset($_POST['Update_departament']) || isset($_POST['Save_departament'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('departament/departaments');
        exit;
    }
    $Errors = erLhcoreClassDepartament::validateDepartment($Departament);
    if (count($Errors) == 0) {
        erLhcoreClassDepartament::getSession()->update($Departament);
        if (isset($_POST['Save_departament'])) {
            erLhcoreClassModule::redirect('departament/departaments');
            exit;
        } else {
            $tpl->set('updated', true);
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
$tpl->set('departament', $Departament);
$tpl->set('currentUser', $currentUser);
$tpl->set('limitDepartments', $userDepartments !== true ? array('filterin' => array('id' => $userDepartments)) : array());
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('departament/departaments'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'departments')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'Edit a department') . ' - ' . $Departament->name));
Esempio n. 20
0
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('department/group');
        exit;
    }
    $Departament_group->removeThis();
    erLhcoreClassModule::redirect('department/group');
    exit;
}
if (isset($_POST['Update_departament']) || isset($_POST['Save_departament'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('department/group');
        exit;
    }
    $Errors = erLhcoreClassDepartament::validateDepartmentGroup($Departament_group);
    if (count($Errors) == 0) {
        $Departament_group->updateThis();
        erLhcoreClassDepartament::validateDepartmentGroupDepartments($Departament_group);
        if (isset($_POST['Save_departament'])) {
            erLhcoreClassModule::redirect('department/group');
            exit;
        } else {
            $tpl->set('updated', true);
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
$tpl->set('departament_group', $Departament_group);
$tpl->set('currentUser', $currentUser);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('department/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments')), array('url' => erLhcoreClassDesign::baseurl('department/group'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'Departments groups')), array('title' => $Departament_group->name));
Esempio n. 21
0
<?php

$cfgSite = erConfigClassLhConfig::getInstance();
$secretHash = $cfgSite->getSetting('site', 'secrethash');
if ($Params['user_parameters']['validation_hash'] == sha1(sha1($Params['user_parameters']['email'] . $secretHash) . $secretHash)) {
    $accept = erLhcoreClassModelChatAccept::fetchByHash($Params['user_parameters']['hash']);
    if ($accept !== false) {
        $chat_id = $accept->chat_id;
        if ($accept->wused == 0) {
            $userID = erLhcoreClassModelUser::fetchUserByEmail($Params['user_parameters']['email'], trim($Params['user_parameters']['email']) != '' ? trim($Params['user_parameters']['email']) : false);
            if ($userID !== false && $accept->ctime > time() - erLhcoreClassModelChatConfig::fetch('accept_chat_link_timeout')->current_value) {
                $accept->wused = 1;
                $accept->saveThis();
                erLhcoreClassUser::instance()->setLoggedUser($userID);
                erLhcoreClassModule::redirect('chat/single', '/' . $chat_id);
                exit;
            } else {
                erLhcoreClassModule::redirect('user/login', '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat_id)));
                exit;
            }
        } else {
            erLhcoreClassModule::redirect('user/login', '/(r)/' . rawurlencode(base64_encode('chat/single/' . $chat_id)));
            exit;
        }
        erLhcoreClassModelChatAccept::cleanup();
    }
}
erLhcoreClassModule::redirect('user/login');
exit;
Esempio n. 22
0
        exit;
    }
    $definition = array('showAllPendingEnabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('showAllPendingEnabled') && $form->showAllPendingEnabled == true) {
        erLhcoreClassModelUserSetting::setSetting('show_all_pending', 1, $UserData->id);
    } else {
        erLhcoreClassModelUserSetting::setSetting('show_all_pending', 0, $UserData->id);
    }
    $tpl->set('account_updated', 'done');
    $tpl->set('tab', 'tab_pending');
}
if (isset($_POST['UpdateDepartaments_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/userlist');
        exit;
    }
    $globalDepartament = array();
    if (isset($_POST['all_departments']) && $_POST['all_departments'] == 'on') {
        $UserData->all_departments = 1;
        $globalDepartament[] = 0;
    } else {
        $UserData->all_departments = 0;
        $globalDepartament[] = -1;
    }
    erLhcoreClassUser::getSession()->update($UserData);
    if (isset($_POST['UserDepartament']) && count($_POST['UserDepartament']) > 0) {
        $globalDepartament = array_merge($_POST['UserDepartament'], $globalDepartament);
    }
    if (count($globalDepartament) > 0) {
Esempio n. 23
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhsystem/smtp.tpl.php');
$smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
$data = (array) $smtpData->data;
if (isset($_POST['StoreSMTPSettings']) || isset($_POST['StoreSMTPSettingsTest'])) {
    $definition = array('host' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'port' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'use_smtp' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('system/smtp');
        exit;
    }
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('host')) {
        $data['host'] = $form->host;
    } else {
        $data['host'] = '';
    }
    if ($form->hasValidData('port')) {
        $data['port'] = $form->port;
    } else {
        $data['port'] = '';
    }
    if ($form->hasValidData('use_smtp') && $form->use_smtp == true) {
        $data['use_smtp'] = 1;
    } else {
        $data['use_smtp'] = 0;
    }
    if ($form->hasValidData('username')) {
        $data['username'] = $form->username;
Esempio n. 24
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhsystem/timezone.tpl.php');
$cfgSite = erConfigClassLhConfig::getInstance();
$timezone = $cfgSite->getSetting('site', 'time_zone');
$date_format = $cfgSite->getSetting('site', 'date_format');
$date_hour_format = $cfgSite->getSetting('site', 'date_hour_format');
$date_date_hour_format = $cfgSite->getSetting('site', 'date_date_hour_format');
if (isset($_POST['StoreTimeZoneSettings'])) {
    $definition = array('TimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'DateFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'DateFullFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'DateHourFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('system/timezone');
        exit;
    }
    $form = new ezcInputForm(INPUT_POST, $definition);
    if ($form->hasValidData('TimeZone')) {
        $timezone = $form->TimeZone;
    } else {
        $timezone = '';
    }
    if ($form->hasValidData('DateFormat')) {
        $date_format = $form->DateFormat;
    } else {
        $date_format = '';
    }
    if ($form->hasValidData('DateFullFormat')) {
        $date_date_hour_format = $form->DateFullFormat;
    } else {
        $date_date_hour_format = '';
    }
    if ($form->hasValidData('DateHourFormat')) {
Esempio n. 25
0
    }
    if (count($Errors) == 0) {
        $Option->option_name = $form->Option;
        $Option->question_id = $Question->id;
        $Option->saveThis();
        // Mark question as it's voting
        $Question->is_voting = 1;
        $Question->saveThis();
        erLhcoreClassModule::redirect('questionary/edit', '/' . $Question->id . '/(tab)/voting');
        exit;
    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['CancelO'])) {
    erLhcoreClassModule::redirect('questionary/edit', '/' . $Question->id . '/(tab)/voting');
    exit;
}
// Answers
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('questionary/edit') . '/' . $Question->id . '/(tab)/answers';
$pages->items_total = erLhcoreClassQuestionary::getCount(array('filter' => array('question_id' => $Question->id)), 'lh_question_answer');
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassQuestionary::getList(array('filter' => array('question_id' => $Question->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page), 'erLhcoreClassModelQuestionAnswer', 'lh_question_answer');
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$tpl->set('question', $Question);
Esempio n. 26
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhtheme/adminnewtheme.tpl.php');
$form = new erLhAbstractModelAdminTheme();
if (ezcInputForm::hasPostData()) {
    $Errors = erLhcoreClassThemeValidator::validateAdminTheme($form);
    if (!empty($Errors)) {
        $tpl->set('errors', $Errors);
    } else {
        $form->saveThis();
        erLhcoreClassModule::redirect('theme/adminthemes');
        exit;
    }
}
$tpl->set('form', $form);
$Result['content'] = $tpl->fetch();
$Result['additional_footer_js'] = '<script src="' . erLhcoreClassDesign::designJS('js/admintheme.form.angular.js') . '"></script>';
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('theme/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('theme/index', 'Themes')), array('url' => erLhcoreClassDesign::baseurl('theme/adminthemes'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('lhtheme/admin', 'Admin themes')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('lhtheme/admin', 'New admin theme')));
Esempio n. 27
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdocshare/configuration.tpl.php');
$docSharer = erLhcoreClassModelChatConfig::fetch('doc_sharer');
$data = (array) $docSharer->data;
if (isset($_POST['StoreConfiguration'])) {
    $definition = array('LibreOfficePath' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'SupportedExtensions' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'PdftoppmPath' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'HttpUserName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'HttpGroupName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'BackgroundProcess' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'MaxFileSize' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 2)), 'PdftoppmLimit' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)));
    $Errors = array();
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('docshare/configuration');
        exit;
    }
    if ($form->hasValidData('LibreOfficePath')) {
        $data['libre_office_path'] = $form->LibreOfficePath;
    } else {
        $data['libre_office_path'] = '/usr/bin/libreoffice';
    }
    if ($form->hasValidData('PdftoppmPath')) {
        $data['pdftoppm_path'] = $form->PdftoppmPath;
    } else {
        $data['pdftoppm_path'] = '/usr/bin/pdftoppm';
    }
    if ($form->hasValidData('PdftoppmLimit')) {
        $data['pdftoppm_limit'] = $form->PdftoppmLimit;
    } else {
        $data['pdftoppm_limit'] = '0';
    }
    if ($form->hasValidData('HttpUserName')) {
        $data['http_user_name'] = $form->HttpUserName;
    }
    erLhcoreClassModelChatOnlineUser::cleanAllRecords();
    erLhcoreClassModule::redirect('chat/onlineusers');
    exit;
}
if (is_numeric($Params['user_parameters_unordered']['deletevisitor']) && $Params['user_parameters_unordered']['deletevisitor'] > 0) {
    if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
        die('Invalid CSRF Token');
        exit;
    }
    try {
        $visitor = erLhcoreClassModelChatOnlineUser::fetch($Params['user_parameters_unordered']['deletevisitor']);
        $visitor->removeThis();
    } catch (Exception $e) {
    }
    erLhcoreClassModule::redirect('chat/onlineusers');
    exit;
}
$is_ajax = isset($Params['user_parameters_unordered']['method']) && $Params['user_parameters_unordered']['method'] == 'ajax';
$timeout = isset($Params['user_parameters_unordered']['timeout']) && is_numeric($Params['user_parameters_unordered']['timeout']) ? (int) $Params['user_parameters_unordered']['timeout'] : 30;
$maxrows = isset($Params['user_parameters_unordered']['maxrows']) && is_numeric($Params['user_parameters_unordered']['maxrows']) ? (int) $Params['user_parameters_unordered']['maxrows'] : 50;
$filter = array('offset' => 0, 'limit' => $maxrows, 'sort' => 'last_visit DESC', 'filtergt' => array('last_visit' => time() - $timeout));
$department = isset($Params['user_parameters_unordered']['department']) && is_numeric($Params['user_parameters_unordered']['department']) ? (int) $Params['user_parameters_unordered']['department'] : false;
if ($department !== false) {
    $filter['filter']['dep_id'] = $department;
}
/**
 * Append user departments filter
 * */
$departmentParams = array();
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
Esempio n. 29
0
<?php

if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
    die('Invalid CSFR Token');
    exit;
}
$faq = erLhcoreClassFaq::getSession()->load('erLhcoreClassModelFaq', $Params['user_parameters']['id']);
erLhcoreClassFaq::getSession()->delete($faq);
erLhcoreClassModule::redirect('faq/list');
exit;
Esempio n. 30
-1
 /**
  * Executes paid chat workflow
  * */
 public static function paidChatWorkflow($params)
 {
     $paidchatData = erLhcoreClassModelChatConfig::fetch('paidchat_data');
     $data = (array) $paidchatData->data;
     $mode = isset($params['mode']) ? $params['mode'] : 'chatwidgetchat';
     if (isset($data['paidchat_enabled']) && $data['paidchat_enabled'] == 1) {
         $secretHash = $data['paidchat_secret_hash'];
         $hashVerify = sha1($secretHash . sha1($secretHash . $params['uparams']['phash']));
         if ($hashVerify == $params['uparams']['pvhash']) {
             $chatExisting = erLhcoreClassModelChatPaid::findOne(array('filter' => array('hash' => $params['uparams']['phash'])));
             if ($chatExisting instanceof erLhcoreClassModelChatPaid) {
                 if ($chatExisting->chat_id > 0 && $chatExisting->chat instanceof erLhcoreClassModelChat) {
                     if ($chatExisting->chat->status == erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
                         if (isset($data['paidchat_read_denied']) && $data['paidchat_read_denied'] == 1) {
                             erLhcoreClassModule::redirect('paidchat/expiredchat', '/' . $chatExisting->id . '/(mode)/widget' . $params['append_mode'] . '/(pchat)/' . $chatExisting->id);
                         } else {
                             erLhcoreClassModule::redirect('chat/' . $mode, '/' . $chatExisting->chat->id . '/' . $chatExisting->chat->hash . '/(mode)/widget' . $params['append_mode'] . '/(pchat)/' . $chatExisting->id);
                         }
                         exit;
                     } else {
                         erLhcoreClassModule::redirect('chat/' . $mode, '/' . $chatExisting->chat->id . '/' . $chatExisting->chat->hash . '/(mode)/widget' . $params['append_mode'] . '/(pchat)/' . $chatExisting->id);
                         exit;
                     }
                 } elseif ($chatExisting->chat_id > 0) {
                     erLhcoreClassModule::redirect('paidchat/removedpaidchat');
                     exit;
                 }
             } else {
                 return array('need_store' => true, 'hash' => $params['uparams']['phash']);
             }
         } else {
             erLhcoreClassModule::redirect('paidchat/invalidhash', '/' . $chatExisting->chat->id . '/' . $chatExisting->chat->hash);
             exit;
         }
     }
     return array('need_store' => false);
 }