Example #1
0
 public static function getOutArray()
 {
     if (self::$outArray == null) {
         $tpl = new erLhcoreClassTemplate();
         $smileys = explode('||', $tpl->fetch('lhbbcode/smiley.tpl.php'));
         self::$outArray = $smileys;
     }
     return self::$outArray;
 }
Example #2
0
 public static function validateSendMail(erLhAbstractModelEmailTemplate &$sendMail, &$chat, $params = array())
 {
     $Errors = array();
     $validationFields = array();
     $validationFields['Message'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
     $validationFields['Subject'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
     $validationFields['FromName'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
     $validationFields['FromEmail'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
     $validationFields['ReplyEmail'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
     $validationFields['RecipientEmail'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
     $form = new ezcInputForm(INPUT_POST, $validationFields);
     $Errors = array();
     if (isset($params['archive_mode']) && $params['archive_mode'] == true) {
         $messages = array_reverse(erLhcoreClassChat::getList(array('limit' => 100, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id)), 'erLhcoreClassModelChatArchiveMsg', erLhcoreClassModelChatArchiveRange::$archiveMsgTable));
     } else {
         $messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 100, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
     }
     // Fetch chat messages
     $tpl = new erLhcoreClassTemplate('lhchat/messagelist/plain.tpl.php');
     $tpl->set('chat', $chat);
     $tpl->set('messages', $messages);
     $sendMail->content = str_replace(array('{user_chat_nick}', '{messages_content}'), array($chat->nick, $tpl->fetch()), $sendMail->content);
     if ($form->hasValidData('Message')) {
         $sendMail->content = str_replace('{additional_message}', $form->Message, $sendMail->content);
     }
     $sendMail->content = erLhcoreClassBBCode::parseForMail($sendMail->content);
     if ($form->hasValidData('FromEmail')) {
         $sendMail->from_email = $form->FromEmail;
     }
     if ($form->hasValidData('ReplyEmail')) {
         $sendMail->reply_to = $form->ReplyEmail;
     }
     if ($form->hasValidData('FromName')) {
         $sendMail->from_name = $form->FromName;
     }
     if ($form->hasValidData('Subject')) {
         $sendMail->subject = $form->Subject;
     }
     if ($form->hasValidData('RecipientEmail')) {
         $sendMail->recipient = $form->RecipientEmail;
     } else {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'Please enter recipient e-mail!');
     }
     if (empty($sendMail->from_email)) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'From e-mail is missing!');
     }
     if (empty($sendMail->reply_to)) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'Reply e-mail is missing!');
     }
     if (empty($sendMail->subject)) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'Subject is missing!');
     }
     return $Errors;
 }
<?php

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
header('Content-type: text/javascript');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 8) . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$tpl = erLhcoreClassTemplate::getInstance('lhchat/chatcheckstatus.tpl.php');
if (is_array($Params['user_parameters_unordered']['department'])) {
    erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
    $tpl->set('department', implode('/', $Params['user_parameters_unordered']['department']));
    $tpl->set('department_array', $Params['user_parameters_unordered']['department']);
} else {
    $tpl->set('department', false);
    $tpl->set('department_array', false);
}
$tpl->set('status', $Params['user_parameters_unordered']['status'] == 'true' ? true : false);
if (erLhcoreClassModelChatConfig::fetch('track_is_online')->current_value) {
    $ignorable_ip = erLhcoreClassModelChatConfig::fetch('ignorable_ip')->current_value;
    if ($ignorable_ip == '' || !erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
        if ((string) $Params['user_parameters_unordered']['vid'] != '') {
            $db = ezcDbInstance::get();
            /**
             * Perhaps there is some pending operations for online visitor
             * */
            $stmt = $db->prepare('SELECT operation FROM lh_chat_online_user WHERE vid = :vid');
            $stmt->bindValue(':vid', (string) $Params['user_parameters_unordered']['vid']);
            $stmt->execute();
            $operation = $stmt->fetch(PDO::FETCH_COLUMN);
<?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;
Example #5
0
<?php

try {
    $tpl = erLhcoreClassTemplate::getInstance('lhinstance/invoices.tpl.php');
    $pages = new lhPaginator();
    $pages->items_total = erLhcoreClassModelInstanceInvoice::getCount();
    $pages->translationContext = 'abstract/list';
    $pages->serverURL = erLhcoreClassDesign::baseurl('instance/invoices');
    $pages->setItemsPerPage(20);
    $pages->paginate();
    $tpl->set('pages', $pages);
    $items = array();
    if ($pages->items_total > 0) {
        $items = erLhcoreClassModelInstanceInvoice::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page));
    }
    $tpl->set('items', $items);
    $tpl->set('pages', $pages);
    $Result['content'] = $tpl->fetch();
    $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Invoices')));
} catch (Exception $e) {
    print_r($e);
}
Example #6
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']);
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchatarchive/listarchivechats.tpl.php');
$archive = erLhcoreClassModelChatArchiveRange::fetch($Params['user_parameters']['id']);
if (isset($_GET['doSearch'])) {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'chat_search', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = true;
} else {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'chat_search', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = false;
}
$append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
// Set correct archive tables
$archive->setArchiveTables();
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('chatarchive/listarchivechats') . '/' . $archive->id . $append;
$pages->items_total = erLhcoreClassChat::getCount($filterParams['filter'], erLhcoreClassModelChatArchiveRange::$archiveTable);
$pages->setItemsPerPage(2);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    try {
        $items = erLhcoreClassChat::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'), $filterParams['filter']), 'erLhcoreClassModelChatArchive', erLhcoreClassModelChatArchiveRange::$archiveTable);
    } catch (Exception $e) {
        print_r($e->getMessage());
    }
}
$filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('chatarchive/listarchivechats') . '/' . $archive->id;
$tpl->set('input', $filterParams['input_form']);
$tpl->set('items', $items);
$tpl->set('archive', $archive);
Example #8
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;
Example #9
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) {
Example #10
0
<?php

try {
    $chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
    if ($chat->hash == $Params['user_parameters']['hash']) {
        $msg = erLhcoreClassModelmsg::fetch($Params['user_parameters']['msgid']);
        if ($msg->chat_id == $chat->id) {
            $tpl = erLhcoreClassTemplate::getInstance('lhchat/syncuser.tpl.php');
            $tpl->set('messages', array((array) $msg));
            $tpl->set('chat', $chat);
            $tpl->set('sync_mode', isset($Params['user_parameters_unordered']['mode']) ? $Params['user_parameters_unordered']['mode'] : '');
            echo json_encode(array('msg' => $tpl->fetch(), 'error' => 'f'));
            exit;
        }
    }
} catch (Exception $e) {
}
echo json_encode(array('error' => 't'));
exit;
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/operatorschats.tpl.php');
if (isset($_GET['doSearch'])) {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'chat_search', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = true;
} else {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'chat_search', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = false;
}
if ($Params['user_parameters_unordered']['print'] == 1) {
    $tpl = erLhcoreClassTemplate::getInstance('lhchat/printchats.tpl.php');
    $items = erLhcoreClassChat::getOperatorsChats(10000, 0, $filterParams['filter']);
    $tpl->set('items', $items);
    $Result['content'] = $tpl->fetch();
    $Result['pagelayout'] = 'popup';
    return;
}
if ($Params['user_parameters_unordered']['xls'] == 1) {
    erLhcoreClassChatExport::chatListExportXLS(erLhcoreClassChat::getOperatorsChats(10000, 0, $filterParams['filter']));
    exit;
}
$append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
$pages = new lhPaginator();
$pages->items_total = erLhcoreClassChat::getOperatorsChatsCount($filterParams['filter']);
$pages->translationContext = 'chat/closedchats';
$pages->serverURL = erLhcoreClassDesign::baseurl('chat/operatorschats') . $append;
$pages->paginate();
$tpl->set('pages', $pages);
if ($pages->items_total > 0) {
    $items = erLhcoreClassChat::getOperatorsChats($pages->items_per_page, $pages->low, $filterParams['filter']);
Example #12
0
 /**
  * Open, parse, and return the template file.
  *
  * @param $file string the template file name
  */
 function fetch($fileTemplate = null)
 {
     $instance = erLhcoreClassSystem::instance();
     $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
     if (!$fileTemplate) {
         $fileTemplate = $this->file;
     }
     if ($this->cacheEnabled == true && key_exists(md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port), $this->cacheTemplates)) {
         try {
             return $this->fetchExecute($this->cacheTemplates[md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port)]);
         } catch (Exception $e) {
         }
     }
     $cfg = erConfigClassLhConfig::getInstance();
     $file = erLhcoreClassDesign::designtpl($fileTemplate);
     if ($this->templatecompile == true) {
         $contentFile = php_strip_whitespace($file);
         // Compile templates - 3 level of inclusions
         for ($i = 0; $i < 9; $i++) {
             $Matches = array();
             preg_match_all('/<\\?php(\\s*)include_once\\(erLhcoreClassDesign::designtpl\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
             foreach ($Matches[2] as $key => $Match) {
                 $contentFile = str_replace($Matches[0][$key], php_strip_whitespace(erLhcoreClassDesign::designtpl($Match)), $contentFile);
             }
             //Compile templates inclusions first level.
             $Matches = array();
             preg_match_all('/<\\?php(\\s*)include\\(erLhcoreClassDesign::designtpl\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
             foreach ($Matches[2] as $key => $Match) {
                 $contentFile = str_replace($Matches[0][$key], php_strip_whitespace(erLhcoreClassDesign::designtpl($Match)), $contentFile);
             }
         }
         //Compile image css paths. Etc..
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::design\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $Match) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::design($Match), $contentFile);
         }
         //Compile translations, pure translations
         $Matches = array();
         preg_match_all('/<\\?php echo erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $TranslateContent) {
             $contentFile = str_replace($Matches[0][$key], erTranslationClassLhTranslation::getInstance()->getTranslation($TranslateContent, $Matches[2][$key]), $contentFile);
         }
         //Translations used in logical conditions
         $Matches = array();
         preg_match_all('/erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $TranslateContent) {
             $contentFile = str_replace($Matches[0][$key], '\'' . erTranslationClassLhTranslation::getInstance()->getTranslation($TranslateContent, $Matches[2][$key]) . '\'', $contentFile);
         }
         // Compile url addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurl\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurl(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile url direct addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurldirect\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurldirect(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile url direct addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurlsite\\(\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurlsite(), $contentFile);
         }
         // Compile css url addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::designCSS\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::designCSS(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile css url addresses
         $Matches = array();
         preg_match_all('/<\\?php echo erLhcoreClassDesign::designJS\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::designJS(trim($UrlAddress, '\'')), $contentFile);
         }
         // Compile url addresses in logical operations
         $Matches = array();
         preg_match_all('/erLhcoreClassDesign::baseurl\\((.*?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], '\'' . erLhcoreClassDesign::baseurl(trim($UrlAddress, '\'')) . '\'', $contentFile);
         }
         // Compile url addresses in logical operations
         $Matches = array();
         preg_match_all('/erLhcoreClassDesign::baseurldirect\\((.*?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $contentFile = str_replace($Matches[0][$key], '\'' . erLhcoreClassDesign::baseurldirect(trim($UrlAddress, '\'')) . '\'', $contentFile);
         }
         // Compile config settings, direct output
         $Matches = array();
         preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getSetting\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getSetting($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = $valueConfig;
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile config settings
         $Matches = array();
         preg_match_all('/erConfigClassLhConfig::getInstance\\(\\)->getSetting\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getSetting($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = '\'' . $valueConfig . '\'';
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile override config settings, used in title, description override
         $Matches = array();
         preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getOverrideValue\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getOverrideValue($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = $valueConfig;
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile override config settings
         $Matches = array();
         preg_match_all('/erConfigClassLhConfig::getInstance\\(\\)->getOverrideValue\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getOverrideValue($Matches[2][$key], $Matches[5][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = '\'' . $valueConfig . '\'';
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         $Matches = array();
         preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getDirLanguage\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $UrlAddress) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getDirLanguage($Matches[2][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = $valueConfig;
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         // Compile config settings
         $Matches = array();
         preg_match_all('/erConfigClassLhConfig::getInstance\\(\\)->getDirLanguage\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)/i', $contentFile, $Matches);
         foreach ($Matches[1] as $key => $var) {
             $valueConfig = erConfigClassLhConfig::getInstance()->getDirLanguage($Matches[2][$key]);
             $valueReplace = '';
             if (is_bool($valueConfig)) {
                 $valueReplace = $valueConfig == false ? 'false' : 'true';
             } elseif (is_integer($valueConfig)) {
                 $valueReplace = $valueConfig;
             } elseif (is_array($valueConfig)) {
                 $valueReplace = var_export($valueConfig, true);
             } else {
                 $valueReplace = '\'' . $valueConfig . '\'';
             }
             $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
         }
         if ($this->cacheDbVariables == true) {
             // Compile config completely
             $Matches = array();
             preg_match_all('/<\\?php echo erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->current_value(.*?)\\?\\>/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->current_value;
                 $contentFile = str_replace($Matches[0][$key], $valueConfig, $contentFile);
             }
             // Compile config settings in php scripts
             $Matches = array();
             preg_match_all('/erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->current_value/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->current_value;
                 $valueReplace = '';
                 $valueReplace = '\'' . str_replace("'", "\\'", $valueConfig) . '\'';
                 $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
             }
             // Compile config settings in php scripts
             $Matches = array();
             preg_match_all('/erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->data_value/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->data_value;
                 $valueReplace = var_export($valueConfig, true);
                 $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
             }
             // Compile config settings array
             $Matches = array();
             preg_match_all('/erLhcoreClassModelChatConfig::fetch\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)->data\\[\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\]/i', $contentFile, $Matches);
             foreach ($Matches[1] as $key => $UrlAddress) {
                 $valueConfig = erLhcoreClassModelChatConfig::fetch($Matches[2][$key])->data[$Matches[4][$key]];
                 $valueReplace = '';
                 $valueReplace = '\'' . str_replace("'", "\\'", $valueConfig) . '\'';
                 $contentFile = str_replace($Matches[0][$key], $valueReplace, $contentFile);
             }
         }
         // Compile content language
         $contentFile = str_replace('<?php echo erLhcoreClassSystem::instance()->ContentLanguage?>', erLhcoreClassSystem::instance()->ContentLanguage, $contentFile);
         // Compile siteaccess
         $contentFile = str_replace('erLhcoreClassSystem::instance()->SiteAccess', '\'' . erLhcoreClassSystem::instance()->SiteAccess . '\'', $contentFile);
         // Atomoc template compilation to avoid concurent request compiling and writing to the same file
         $fileName = 'cache/compiledtemplates/' . md5(time() . rand(0, 1000) . microtime() . $file . $instance->WWWDirLang . $instance->Language . $port) . '.php';
         file_put_contents($fileName, erLhcoreClassTemplate::strip_html($contentFile));
         $file = 'cache/compiledtemplates/' . md5($file . $instance->WWWDirLang . $instance->Language . $port) . '.php';
         rename($fileName, $file);
         $this->cacheTemplates[md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port)] = $file;
         $this->storeCache();
     }
     return $this->fetchExecute($file);
 }
Example #13
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')));
Example #14
0
<?php

if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
    echo json_encode(array('error' => 'true', 'result' => 'Invalid CSRF Token'));
    exit;
}
$definition = array('data' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'));
$form = new ezcInputForm(INPUT_POST, $definition);
$Chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
$errorTpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
if (erLhcoreClassChat::hasAccessToRead($Chat)) {
    if ($form->hasValidData('data')) {
        $errors = array();
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_save_remarks', array('chat' => &$Chat, 'errors' => &$errors));
        if (empty($errors)) {
            $Chat->remarks = $form->data;
            $Chat->saveThis();
            echo json_encode(array('error' => 'false'));
            exit;
        } else {
            $errorTpl->set('errors', $errors);
            echo json_encode(array('error' => 'true', 'result' => $errorTpl->fetch()));
            exit;
        }
    } else {
        $errorTpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Form data not valid')));
        echo json_encode(array('error' => 'true', 'result' => $errorTpl->fetch()));
        exit;
    }
} else {
    $errorTpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Has no access to this chat')));
Example #15
0
<?php

$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('form.index', array());
$tpl = erLhcoreClassTemplate::getInstance('lhform/index.tpl.php');
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Form')));
Example #16
0
<?php

$currentUser = erLhcoreClassUser::instance();
$instance = erLhcoreClassSystem::instance();
if ($instance->SiteAccess != 'site_admin') {
    if ($currentUser->isLogged() && !empty($Params['user_parameters_unordered']['r'])) {
        header('Location: ' . erLhcoreClassDesign::baseurldirect('site_admin') . '/' . base64_decode(rawurldecode($Params['user_parameters_unordered']['r'])));
        exit;
    }
    $redirect = rawurldecode($Params['user_parameters_unordered']['r']);
    $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 {
Example #17
0
<?php

// For IE to support headers if chat is installed on different domain
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
$tpl = erLhcoreClassTemplate::getInstance('lhsurvey/fillwidget.tpl.php');
$embedMode = false;
if ((string) $Params['user_parameters_unordered']['mode'] == 'embed') {
    $embedMode = true;
}
if (isset($Params['user_parameters_unordered']['theme']) && (int) $Params['user_parameters_unordered']['theme'] > 0) {
    try {
        $theme = erLhAbstractModelWidgetTheme::fetch($Params['user_parameters_unordered']['theme']);
        $Result['theme'] = $theme;
        $tpl->set('theme', $theme);
    } catch (Exception $e) {
    }
}
try {
    if (is_numeric((string) $Params['user_parameters_unordered']['chatid']) && $Params['user_parameters_unordered']['chatid'] > 0) {
        if ((string) $Params['user_parameters_unordered']['hash'] != '') {
            $hash = $Params['user_parameters_unordered']['hash'];
        }
        if (is_numeric($Params['user_parameters_unordered']['chatid'])) {
            $chat = erLhcoreClassModelChat::fetch($Params['user_parameters_unordered']['chatid']);
        }
    } else {
        if ((string) $Params['user_parameters_unordered']['hash'] != '') {
            list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['hash']);
            $chat = erLhcoreClassModelChat::fetch($chatID);
        }
    }
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/getonlineuserinfo.tpl.php');
$onlineUser = erLhcoreClassModelChatOnlineUser::fetch($Params['user_parameters']['id']);
$tpl->set('online_user', $onlineUser);
echo $tpl->fetch();
exit;
Example #19
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhinstance/edit.tpl.php');
$Instance = erLhcoreClassModelInstance::fetch((int) $Params['user_parameters']['instance_id']);
$cfgSite = erConfigClassLhConfig::getInstance();
$tpl->set('locales', $cfgSite->getSetting('site', 'available_site_access'));
if (isset($_POST['Cancel_departament'])) {
    erLhcoreClassModule::redirect('instance/list');
    exit;
}
$modules = array('reporting_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Statistic supported'), 'atranslations_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Automatic translations supported'), 'cobrowse_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Co-Browse supported'), 'cobrowse_forms_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Co-Browse forms filling supported'), 'forms_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Forms supported'), 'cannedmsg_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Canned messages supported'), 'faq_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'FAQ supported'), 'reporting_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Reporting supported'), 'chatbox_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chatbox supported'), 'browseoffers_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Browse offers supported'), 'questionnaire_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Questionnaire supported'), 'proactive_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Proactive supported'), 'screenshot_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Screenshot supported'), 'blocked_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'User blocking supported'), 'files_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Files supported'), 'sms_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'SMS chat supported'), 'onlinevisitortrck_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Online visitors list supported'), 'geoadjustment_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'GEO adjustment supporte'), 'chatremarks_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat notes supported'), 'autoresponder_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Autoresponder supported'), 'previouschats_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Previous chats supported'), 'footprint_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Footprint supported'), 'chat_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat supported'), 'speech_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Speech supported'), 'transfer_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat transfer supported'), 'operatorschat_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Chat between operators supported'), 'xmpp_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'XMPP supported'), 'offline_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Offline supported'), 'sugarcrm_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'SugarCRM supported'), 'full_xmpp_chat_supported' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Full XMPP chat supported'), 'full_xmpp_visitors_tracking' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Track online visitors in XMPP'));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.features_titles', array('features' => &$modules));
$tpl->set('modules_features', $modules);
if (isset($_POST['ChangePassword'])) {
    $definition = array('InstancePassword' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'InstanceUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('InstancePassword') && $form->InstancePassword != '') {
        $Instance->setPassword($form->InstancePassword);
        $tpl->set('updated', true);
    } else {
        $tpl->set('errors', array('Password was not change'));
    }
    if ($form->hasValidData('InstanceUsername') && $form->InstanceUsername != '') {
        $Instance->setUsername($form->InstanceUsername);
        $tpl->set('updated', true);
    } else {
        $tpl->set('errors', array('Username was not change'));
    }
}
if (isset($_POST['UpdateUsers'])) {
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/listchatconfig.tpl.php');
if ($currentUser->hasAccessTo('lhchat', 'administrateconfig')) {
    if (isset($_POST['UpdateConfig'])) {
        foreach (erLhcoreClassModelChatConfig::getItems() as $item) {
            $ConfigData = erLhcoreClassModelChatConfig::fetch($item->identifier);
            switch ($ConfigData->type) {
                case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_ON:
                    $data = array();
                    foreach (erConfigClassLhConfig::getInstance()->getSetting('site', 'available_site_access') as $siteaccess) {
                        $data[$siteaccess] = $_POST[$item->identifier . 'Value' . $siteaccess];
                    }
                    $ConfigData->value = serialize($data);
                    break;
                case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_OFF:
                    $ConfigData->value = isset($_POST[$item->identifier . 'ValueParam']) ? $_POST[$item->identifier . 'ValueParam'] : 0;
                    break;
                default:
                    break;
            }
            $ConfigData->saveThis();
        }
        // Cleanup cache to recompile templates etc.
        $CacheManager = erConfigClassLhCacheConfig::getInstance();
        $CacheManager->expireCache();
        $tpl->set('updated', 'done');
    }
}
$tpl->set('currentUser', $currentUser);
$Result['content'] = $tpl->fetch();
Example #21
0
<?php

$Question = erLhcoreClassModelQuestion::fetch((int) $Params['user_parameters']['id']);
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('questionary.edit', array('questionary' => $Question));
$tpl = erLhcoreClassTemplate::getInstance('lhquestionary/edit.tpl.php');
$validTabs = array('answers', 'voting');
$tab = in_array((string) $Params['user_parameters_unordered']['tab'], $validTabs) ? (string) $Params['user_parameters_unordered']['tab'] : '';
$tpl->set('tab', $tab);
if (isset($_POST['CancelAction'])) {
    erLhcoreClassModule::redirect('questionary/list');
    exit;
}
if (isset($_POST['UpdateAction']) || isset($_POST['SaveAction'])) {
    $definition = array('Question' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'QuestionIntro' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Location' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Active' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Priority' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'Revote' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!$form->hasValidData('Question') || $form->Question == '') {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Please enter a question!');
    }
    if ($form->hasValidData('QuestionIntro')) {
        $Question->question_intro = $form->QuestionIntro;
    }
    if ($form->hasValidData('Location')) {
        $Question->location = $form->Location;
    } else {
        $Question->location = '';
    }
Example #22
0
<?php

$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);
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/notificationsettings.tpl.php');
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration', 'New chat notification settings')));
Example #24
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhsystem/embedcode.tpl.php');
$cfgSite = erConfigClassLhConfig::getInstance();
$tpl->set('locales', $cfgSite->getSetting('site', 'available_site_access'));
/**
 * Append user departments filter
 * */
$departmentParams = array();
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
if ($userDepartments !== true) {
    $departmentParams['filterin']['id'] = $filter['filterin']['dep_id'] = $userDepartments;
}
$tpl->set('departmentParams', $departmentParams);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'Embed code')));
Example #25
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhfile/list.tpl.php');
if (isset($_GET['doSearch'])) {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'filelist', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = true;
} else {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'filelist', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = false;
}
$append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('file/list') . $append;
$pages->items_total = erLhcoreClassChat::getCount($filterParams['filter'], 'lh_chat_file');
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassChat::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id DESC'), $filterParams['filter']), 'erLhcoreClassModelChatFile', 'lh_chat_file');
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('file/list');
$tpl->set('input', $filterParams['input_form']);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('file/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration', 'List of files')));
Example #26
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdepartament/edit.tpl.php');
$Departament = erLhcoreClassDepartament::getSession()->load('erLhcoreClassModelDepartament', (int) $Params['user_parameters']['departament_id']);
$userDepartments = true;
/**
 * Append user departments filter
 * */
if ($currentUser->hasAccessTo('lhdepartment', 'manageall') !== true) {
    $userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
    if ($userDepartments !== true) {
        if (!in_array($Departament->id, $userDepartments)) {
            erLhcoreClassModule::redirect('departament/departaments');
            exit;
        }
    }
}
if (isset($_POST['Cancel_departament'])) {
    erLhcoreClassModule::redirect('departament/departaments');
    exit;
}
if (isset($_POST['Delete_departament'])) {
    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'])) {
<?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')) {
Example #28
0
<?php

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
$tpl = erLhcoreClassTemplate::getInstance('lhchat/readoperatormessage.tpl.php');
$tpl->set('referer', '');
$tpl->set('referer_site', '');
$userInstance = erLhcoreClassModelChatOnlineUser::handleRequest(array('message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'check_message_operator' => true, 'vid' => (string) $Params['user_parameters_unordered']['vid']));
$tpl->set('visitor', $userInstance);
$inputData = new stdClass();
$inputData->username = '';
$inputData->question = '';
$inputData->email = '';
if (is_array($Params['user_parameters_unordered']['department']) && count($Params['user_parameters_unordered']['department']) == 1) {
    erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
    $inputData->departament_id = array_shift($Params['user_parameters_unordered']['department']);
} else {
    $inputData->departament_id = 0;
}
if (is_array($Params['user_parameters_unordered']['department'])) {
    erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
    $inputData->departament_id_array = $Params['user_parameters_unordered']['department'];
}
$inputData->validate_start_chat = false;
$inputData->operator = (int) $Params['user_parameters_unordered']['operator'];
$inputData->name_items = array();
$inputData->value_items = array();
$inputData->value_types = array();
$inputData->value_sizes = array();
$inputData->hattr = array();
if ((string) $Params['user_parameters_unordered']['vid'] != '') {
    $inputData->vid = (string) $Params['user_parameters_unordered']['vid'];
Example #29
0
<?php

$faq = new erLhcoreClassModelFaq();
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.new', array('faq' => $faq));
$tpl = erLhcoreClassTemplate::getInstance('lhfaq/new.tpl.php');
if (isset($_POST['Save'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    $Errors = erLhcoreClassFaq::validateFaq($faq);
    if (count($Errors) == 0) {
        $faq->saveThis();
        erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.created', array('faq' => &$faq));
        erLhcoreClassModule::redirect('faq/list');
        exit;
    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['Cancel'])) {
    erLhcoreClassModule::redirect('faq/list');
    exit;
}
$tpl->set('faq', $faq);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('faq/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('faq/list', 'FAQ')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('faq/new', 'New question')));
Example #30
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdocshare/index.tpl.php');
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('docshare/index', 'Documents sharer')));