public static function validateAdminTheme(erLhAbstractModelAdminTheme &$clickform)
 {
     $definition = array('Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'header_content' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'header_css' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'static_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_js_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_js_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_css_content_name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'static_css_content_hash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     $currentUser = erLhcoreClassUser::instance();
     if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'Invalid CSRF token!');
     }
     if (!$form->hasValidData('Name') || $form->Name == '') {
         $Errors['Name'] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'Please enter a name');
     } else {
         $clickform->name = $form->Name;
     }
     if ($form->hasValidData('header_content')) {
         $clickform->header_content = $form->header_content;
     }
     if ($form->hasValidData('header_css')) {
         $clickform->header_css = $form->header_css;
     }
     $resourcesArray = array('static_content', 'static_js_content', 'static_css_content');
     $supportedExtensions = array('zip', 'doc', 'docx', 'ttf', 'pdf', 'xls', 'ico', 'gif', 'xlsx', 'jpg', 'jpeg', 'png', 'bmp', 'rar', '7z', 'css', 'js', 'eot', 'woff', 'woff2', 'svg');
     // Validate resources
     foreach ($resourcesArray as $resource) {
         if ($form->hasValidData($resource . '_hash') && !empty($form->{$resource . '_hash'})) {
             $customFields = $currentStaticResources = $clickform->{$resource . '_array'};
             foreach ($form->{$resource . '_hash'} as $key => $customFieldType) {
                 if (!erLhcoreClassSearchHandler::isFile($resource . '_file_' . $key, $supportedExtensions) && !isset($currentStaticResources[$key]['file'])) {
                     $Errors[$resource . '_file_' . $key] = erTranslationClassLhTranslation::getInstance()->getTranslation('icclicktocallform/form', 'File not chosen for') . (isset($form->{$resource . '_name'}[$key]) ? ' - ' . htmlspecialchars($form->{$resource . '_name'}[$key]) : '');
                 }
             }
             // If there is no errors upload files
             if (empty($Errors)) {
                 foreach ($form->{$resource . '_hash'} as $key => $customFieldType) {
                     $customFields[$key]['name'] = $form->{$resource . '_name'}[$key];
                     $customFields[$key]['hash'] = $key;
                     if (erLhcoreClassSearchHandler::isFile($resource . '_file_' . $key, $supportedExtensions)) {
                         // Check there is already uploaded file and remove it
                         $clickform->removeResource($resource, $key);
                         // Store new file if required
                         $dir = 'var/storageadmintheme/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $clickform->id . '/';
                         erLhcoreClassChatEventDispatcher::getInstance()->dispatch('admintheme.filedir', array('dir' => &$dir, 'storage_id' => $clickform->id));
                         erLhcoreClassFileUpload::mkdirRecursive($dir);
                         $customFields[$key]['file'] = erLhcoreClassSearchHandler::moveUploadedFile($resource . '_file_' . $key, $dir . '/', '.');
                         $customFields[$key]['file_dir'] = $dir;
                     }
                 }
                 $clickform->{$resource} = json_encode($customFields, JSON_HEX_APOS);
             }
         } else {
             $clickform->{$resource} = '';
         }
     }
     return $Errors;
 }
示例#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;
 }
 public static function validateSurvey(erLhAbstractModelSurveyItem &$surveyItem, erLhAbstractModelSurvey $survey)
 {
     include erLhcoreClassDesign::designtpl('lhsurvey/forms/fields_names.tpl.php');
     $definition = array();
     for ($i = 0; $i < 16; $i++) {
         foreach ($sortOptions as $keyOption => $sortOption) {
             if ($survey->{$keyOption . '_pos'} == $i && $survey->{$keyOption . '_enabled'}) {
                 if ($sortOption['type'] == 'stars') {
                     $definition[$sortOption['field'] . 'Evaluate'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1, 'max_range' => $survey->{$sortOption}['field']));
                 } elseif ($sortOption['type'] == 'question') {
                     $definition[$sortOption['field'] . 'Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
                 } elseif ($sortOption['type'] == 'question_options') {
                     $definition[$sortOption['field'] . 'EvaluateOption'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
                 }
             }
         }
     }
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     for ($i = 0; $i < 16; $i++) {
         foreach ($sortOptions as $keyOption => $sortOption) {
             if ($survey->{$keyOption . '_pos'} == $i && $survey->{$keyOption . '_enabled'}) {
                 if ($sortOption['type'] == 'stars') {
                     if (!$form->hasValidData($sortOption['field'] . 'Evaluate')) {
                         if ($survey->{$keyOption . '_req'} == 1) {
                             $Errors[] = '"' . htmlspecialchars(trim($survey->{$keyOption . '_title'})) . '" : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                         }
                     } else {
                         $surveyItem->{$sortOption['field']} = $form->{$sortOption['field'] . 'Evaluate'};
                     }
                 } elseif ($sortOption['type'] == 'question') {
                     if (!$form->hasValidData($sortOption['field'] . 'Question') || $form->{$sortOption['field'] . 'Question'} == '' && $survey->{$keyOption . '_req'} == 1) {
                         // @todo Make possible to choose field type in the future
                         $Errors[] = '"' . htmlspecialchars(trim($survey->{$keyOption})) . '" : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                     } else {
                         $surveyItem->{$sortOption['field']} = $form->{$sortOption['field'] . 'Question'};
                     }
                 } elseif ($sortOption['type'] == 'question_options') {
                     if (!$form->hasValidData($sortOption['field'] . 'EvaluateOption')) {
                         if ($survey->{$keyOption . '_req'} == 1) {
                             $Errors[] = '"' . htmlspecialchars(trim($survey->{$sortOption['field']})) . '" : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
                         }
                     } else {
                         $surveyItem->{$sortOption['field']} = $form->{$sortOption['field'] . 'EvaluateOption'};
                     }
                 }
             }
         }
     }
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('survey.validate', array('survey' => &$survey, 'survey_item' => &$surveyItem, 'errors' => &$Errors));
     return $Errors;
 }
 public static function formatFilter($validAttributes)
 {
     $definition = array();
     foreach ($validAttributes as $attributeType => $attributes) {
         foreach ($attributes as $userAttribute => $definitionField) {
             $definition[$userAttribute] = $definitionField['validator'];
         }
     }
     $form = new ezcInputForm(INPUT_GET, $definition);
     $filter = array();
     foreach ($validAttributes as $attributeType => $attributes) {
         foreach ($attributes as $userAttribute => $definitionField) {
             if ($form->hasValidData($userAttribute)) {
                 if ($definitionField['type'] == 'filter') {
                     $filter['filter'][$definitionField['field']] = $form->{$userAttribute};
                 } elseif ($definitionField['type'] == 'general') {
                     $filter[$definitionField['field']] = $form->{$userAttribute};
                 }
             }
         }
     }
     $filter['limit'] = isset($filter['limit']) ? $filter['limit'] : 20;
     $filter['offset'] = isset($filter['offset']) ? $filter['offset'] : 0;
     $filter['smart_select'] = true;
     return $filter;
 }
 public static function validateXMPPAccount(erLhcoreClassModelXMPPAccount &$xmppAccount)
 {
     $definition = array('username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'user_id' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1)), 'sendmessage' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     // Username is available only for new accounts
     if ($xmppAccount->id == 0) {
         if (!$form->hasValidData('username') || $form->username == '') {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Please enter a username');
         } else {
             if (strpos($form->username, 'visitor') === false) {
                 if (preg_match('/[^a-z_0-9]/i', $form->username)) {
                     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Not allowed characters detected');
                 } elseif ($form->username != 'admin') {
                     $subdomain = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['subdomain'];
                     $xmppAccount->username = $form->username . ($subdomain != '' ? '.' . $subdomain : '') . '@' . erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['xmpp_host'];
                 } else {
                     $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Admin is reserved username and can not be used');
                 }
             } else {
                 $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Username cannot start with visitor keyword');
             }
         }
     }
     if ($xmppAccount->id == 0) {
         if (!$form->hasValidData('password') || $form->password == '') {
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Please enter a password');
         } else {
             $xmppAccount->password = $form->password;
         }
     } else {
         if ($form->hasValidData('password') && $form->password != '') {
             $xmppAccount->password = $form->password;
         }
     }
     if ($form->hasValidData('user_id')) {
         $xmppAccount->user_id = $form->user_id;
     } else {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/operatorvalidator', 'Please choose opeator id!');
     }
     if ($form->hasValidData('sendmessage') && $form->sendmessage == true) {
         $xmppAccount->sendmessage = 1;
     } else {
         $xmppAccount->sendmessage = 0;
     }
     return $Errors;
 }
 public static function validateSurvey(erLhAbstractModelSurveyItem &$surveyItem, erLhAbstractModelSurvey $survey)
 {
     $definition = array('StarsValue' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1, 'max_range' => $survey->max_stars)));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('StarsValue')) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please choose a star');
     } else {
         $surveyItem->stars = $form->StarsValue;
     }
     return $Errors;
 }
示例#7
0
 public static function validateFaq(&$faq)
 {
     $definition = array('answer' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'question' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'URL' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Identifier' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ActiveFAQ' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('answer') || $form->answer == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter answer!');
     } else {
         $faq->answer = $form->answer;
     }
     if ($form->hasValidData('Identifier') && $form->Identifier != '') {
         if (mb_strlen($form->Identifier) <= 10) {
             $faq->identifier = $form->Identifier;
         } else {
             $faq->identifier = $form->Identifier;
             $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Identifier has to be shorter than 10 characters!');
         }
     } else {
         $faq->identifier = '';
     }
     if ($form->hasValidData('Email')) {
         $faq->email = $form->Email;
     } else {
         $faq->email = '';
     }
     if (!$form->hasValidData('question') || $form->question == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter question!');
     } else {
         $faq->question = $form->question;
     }
     if ($form->hasValidData('URL')) {
         $faq->url = $form->URL;
     } else {
         $faq->url = '';
     }
     if ($form->hasValidData('ActiveFAQ') && $form->ActiveFAQ == true) {
         $faq->active = 1;
     } else {
         $faq->active = 0;
     }
     return $Errors;
 }
<?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;
<?php

if (ezcInputForm::hasGetData()) {
    $form = new ezcInputForm(INPUT_GET, $definition);
    foreach ($definition as $name => $dummy) {
        $propertyName = "property_{$name}";
        $propertyWarningName = "warning_{$name}";
        if ($form->hasValidData($name)) {
            ${$propertyName} = $form->{$name};
        } else {
            ${$propertyName} = htmlspecialchars($form->getUnsafeRawData($name));
            ${$propertyWarningName} = '[invalid]';
        }
    }
}
示例#10
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;
示例#11
0
<?php

if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
    echo json_encode(array('error' => 'true', 'result' => 'Invalid CSFR Token'));
    exit;
}
$archive = new erLhcoreClassModelChatArchiveRange();
$definition = array('id' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1)));
$form = new ezcInputForm(INPUT_POST, $definition);
$Errors = array();
if (!$form->hasValidData('id')) {
    echo json_encode(array('error' => 'true', 'result' => 'Invalid archive ID'));
    exit;
} else {
    $archiveChat = erLhcoreClassModelChatArchiveRange::fetch($form->id);
    $status = $archiveChat->process();
    $tpl = erLhcoreClassTemplate::getInstance('lhchatarchive/archivechats.tpl.php');
    $tpl->set('status', $status);
    $tpl->set('archive', $archiveChat);
    $status['result'] = $tpl->fetch();
    echo json_encode($status);
}
exit;
示例#12
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')) {
示例#13
0
 public static function validateDepartment(erLhcoreClassModelDepartament &$department)
 {
     $definition = array('Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPRecipients' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPRecipientsGroup' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Identifier' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'Priority' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'TansferDepartmentID' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1)), 'TransferTimeout' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5)), 'delay_lm' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5)), 'mod' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'tud' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'wed' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'thd' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'frd' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'sad' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'sud' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'OnlineHoursActive' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Disabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Hidden' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'inform_close' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'inform_unread' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'nc_cb_execute' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'na_cb_execute' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'AutoAssignActive' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'VisibleIfOnline' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'MaxNumberActiveChats' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'MaxWaitTimeoutSeconds' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'StartHour' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 24)), 'StartHourMinit' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 60)), 'inform_unread_delay' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5)), 'EndHour' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 24)), 'EndHourMinit' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'mx_range' => 60)), 'inform_delay' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'inform_options' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('Name') || $form->Name == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('departament/edit', 'Please enter a department name');
     } else {
         $department->name = $form->Name;
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhdepartment', 'actautoassignment')) {
         if ($form->hasValidData('AutoAssignActive') && $form->AutoAssignActive == true) {
             $department->active_balancing = 1;
         } else {
             $department->active_balancing = 0;
         }
         if ($form->hasValidData('MaxNumberActiveChats')) {
             $department->max_active_chats = $form->MaxNumberActiveChats;
         } else {
             $department->max_active_chats = 0;
         }
         if ($form->hasValidData('MaxWaitTimeoutSeconds')) {
             $department->max_timeout_seconds = $form->MaxWaitTimeoutSeconds;
         } else {
             $department->max_timeout_seconds = 0;
         }
     }
     if (erLhcoreClassUser::instance()->hasAccessTo('lhdepartment', 'actworkflow')) {
         if ($form->hasValidData('TansferDepartmentID')) {
             $department->department_transfer_id = $form->TansferDepartmentID;
         } else {
             $department->department_transfer_id = 0;
         }
         if ($form->hasValidData('TransferTimeout')) {
             $department->transfer_timeout = $form->TransferTimeout;
         } else {
             $department->transfer_timeout = 0;
         }
         if ($form->hasValidData('nc_cb_execute') && $form->nc_cb_execute == true) {
             $department->nc_cb_execute = 1;
         } else {
             $department->nc_cb_execute = 0;
         }
         if ($form->hasValidData('na_cb_execute') && $form->na_cb_execute == true) {
             $department->na_cb_execute = 1;
         } else {
             $department->na_cb_execute = 0;
         }
     }
     if ($form->hasValidData('Identifier')) {
         $department->identifier = $form->Identifier;
     }
     if ($form->hasValidData('delay_lm')) {
         $department->delay_lm = $form->delay_lm;
     } else {
         $department->delay_lm = 0;
     }
     if ($form->hasValidData('Email')) {
         $partsEmail = explode(',', $form->Email);
         $validatedEmail = array();
         foreach ($partsEmail as $email) {
             if (filter_var(trim($email), FILTER_VALIDATE_EMAIL)) {
                 $validatedEmail[] = trim($email);
             }
         }
         $department->email = implode(',', $validatedEmail);
     } else {
         $department->email = '';
     }
     if ($form->hasValidData('XMPPRecipients')) {
         $department->xmpp_recipients = $form->XMPPRecipients;
     } else {
         $department->xmpp_recipients = '';
     }
     if ($form->hasValidData('XMPPRecipientsGroup')) {
         $department->xmpp_group_recipients = $form->XMPPRecipientsGroup;
     } else {
         $department->xmpp_group_recipients = '';
     }
     if ($form->hasValidData('Priority')) {
         $department->priority = $form->Priority;
     } else {
         $department->priority = 0;
     }
     if ($form->hasValidData('inform_close') && $form->inform_close === true) {
         $department->inform_close = 1;
     } else {
         $department->inform_close = 0;
     }
     if ($form->hasValidData('inform_unread') && $form->inform_unread === true) {
         $department->inform_unread = 1;
     } else {
         $department->inform_unread = 0;
     }
     if ($form->hasValidData('VisibleIfOnline') && $form->VisibleIfOnline === true) {
         $department->visible_if_online = 1;
     } else {
         $department->visible_if_online = 0;
     }
     if ($form->hasValidData('inform_unread_delay')) {
         $department->inform_unread_delay = $form->inform_unread_delay;
     } elseif ($department->inform_unread == 1) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('departament/edit', 'Minimum 5 seconds');
     } else {
         $department->inform_unread_delay = 0;
     }
     if ($form->hasValidData('Disabled') && $form->Disabled === true) {
         $department->disabled = 1;
     } else {
         $department->disabled = 0;
     }
     if ($form->hasValidData('Hidden') && $form->Hidden === true) {
         $department->hidden = 1;
     } else {
         $department->hidden = 0;
     }
     if ($form->hasValidData('mod') && $form->mod === true) {
         $department->mod = 1;
     } else {
         $department->mod = 0;
     }
     if ($form->hasValidData('tud') && $form->tud === true) {
         $department->tud = 1;
     } else {
         $department->tud = 0;
     }
     if ($form->hasValidData('wed') && $form->wed === true) {
         $department->wed = 1;
     } else {
         $department->wed = 0;
     }
     if ($form->hasValidData('thd') && $form->thd === true) {
         $department->thd = 1;
     } else {
         $department->thd = 0;
     }
     if ($form->hasValidData('frd') && $form->frd === true) {
         $department->frd = 1;
     } else {
         $department->frd = 0;
     }
     if ($form->hasValidData('sad') && $form->sad === true) {
         $department->sad = 1;
     } else {
         $department->sad = 0;
     }
     if ($form->hasValidData('sud') && $form->sud === true) {
         $department->sud = 1;
     } else {
         $department->sud = 0;
     }
     if ($form->hasValidData('OnlineHoursActive') && $form->OnlineHoursActive === true) {
         $department->online_hours_active = 1;
     } else {
         $department->online_hours_active = 0;
     }
     if ($form->hasValidData('inform_options')) {
         $department->inform_options = serialize($form->inform_options);
         $department->inform_options_array = $form->inform_options;
     } else {
         $department->inform_options = serialize(array());
     }
     if ($form->hasValidData('StartHour')) {
         $startHour = $form->StartHour;
     } else {
         $startHour = 0;
     }
     if ($form->hasValidData('EndHour')) {
         $endHour = $form->EndHour;
     } else {
         $endHour = 0;
     }
     if ($form->hasValidData('StartHourMinit')) {
         $StartHourMinit = str_pad($form->StartHourMinit, 2, '0', STR_PAD_LEFT);
     } else {
         $StartHourMinit = '00';
     }
     if ($form->hasValidData('EndHourMinit')) {
         $endHourMinit = str_pad($form->EndHourMinit, 2, '0', STR_PAD_LEFT);
     } else {
         $endHourMinit = '00';
     }
     $department->start_hour = $startHour . $StartHourMinit;
     $department->end_hour = $endHour . $endHourMinit;
     if ($form->hasValidData('inform_delay')) {
         $department->inform_delay = $form->inform_delay;
     } else {
         $department->inform_delay = 0;
     }
     if ($department->id > 0 && $department->department_transfer_id == $department->id) {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('departament/edit', 'Transfer department has to be different one than self');
     }
     return $Errors;
 }
示例#14
0
// Allow extensions to setup default attributes
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.new_instance', array('instance' => &$Instance));
$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['Save_departament'])) {
    $definition = array('Address' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Request' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'RequestUsed' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'Status' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'Expires' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'DateFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'DateHourFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'DateAndHourFormat' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'FrontSiteaccess' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'Language' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerMaxRequest' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerMaxInstance' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerSecretHash' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ResellerRequest' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'Reseller' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'files_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'atranslations_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'cobrowse_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'forms_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'cannedmsg_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'faq_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'feature_1_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'feature_2_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'feature_3_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'reporting_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'chatbox_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'browseoffers_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'questionnaire_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'proactive_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'screenshot_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'blocked_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'footprint_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'previouschats_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'autoresponder_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'chatremarks_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'geoadjustment_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'onlinevisitortrck_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'speech_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'transfer_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'operatorschat_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'chat_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'xmpp_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'offline_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'sugarcrm_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'cobrowse_forms_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'AttrInt1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'AttrInt2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'AttrInt3' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'max_operators' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'one_per_account' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'fullAddress' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'full_xmpp_chat_supported' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'ClientData' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('speech_supported') && $form->speech_supported == true) {
        $Instance->speech_supported = 1;
    } else {
        $Instance->speech_supported = 0;
    }
    if ($form->hasValidData('one_per_account') && $form->one_per_account == true) {
        $Instance->one_per_account = 1;
    } else {
        $Instance->one_per_account = 0;
    }
    if ($form->hasValidData('fullAddress') && $form->fullAddress == true) {
        $Instance->full_domain = 1;
    } else {
        $Instance->full_domain = 0;
    }
    if ($form->hasValidData('full_xmpp_chat_supported') && $form->full_xmpp_chat_supported == true) {
示例#15
0
$item_new = new erLhcoreClassModelFaq();
if (isset($_POST['send'])) {
    $definition = array('question' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'url' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
    if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
        // Start session if required only
        $currentUser = erLhcoreClassUser::instance();
        $hashCaptcha = isset($_SESSION[$_SERVER['REMOTE_ADDR']]['form']) ? $_SESSION[$_SERVER['REMOTE_ADDR']]['form'] : null;
        $nameField = 'captcha_' . $hashCaptcha;
    } else {
        // Captcha stuff
        $nameField = 'captcha_' . sha1(erLhcoreClassIPDetect::getIP() . $_POST['tscaptcha'] . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
    }
    $definition[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!$form->hasValidData('question') || $form->question == '') {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/faqwidget', 'Please enter a question!');
    } else {
        $item_new->question = $form->question;
    }
    if ($form->hasValidData('url')) {
        $item_new->url = $form->url;
    }
    if ($form->hasValidData('email')) {
        $item_new->email = $form->email;
    } elseif (erLhcoreClassModelChatConfig::fetch('faq_email_required')->current_value == 1 && !$form->hasValidData('email')) {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/faqwidget', 'Please enter your email address!');
    }
    $item_new->identifier = $identifier;
    if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
        if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600 || $hashCaptcha != sha1($_SERVER['REMOTE_ADDR'] . $form->{$nameField} . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'))) {
示例#16
0
 public static function validateNickChange(&$chat)
 {
     $definition = array('Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'UserNick' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserPhone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('Email') && $_POST['Email'] != '') {
         $Errors['email'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter a valid email address');
     } elseif ($form->hasValidData('Email')) {
         $chat->email = $form->Email;
     }
     if ($form->hasValidData('UserNick') && $form->UserNick != '' && strlen($form->UserNick) > 50) {
         $Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 50 characters');
     }
     if ($form->hasValidData('UserPhone')) {
         $chat->phone = $form->UserPhone;
     }
     if ($form->hasValidData('UserNick') && $form->UserNick != '') {
         $chat->nick = $form->UserNick;
     } else {
         $Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your name');
     }
     return $Errors;
 }
 * Override
 * */
try {
    $chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
} catch (Exception $e) {
    $chat = false;
}
if ((int) erLhcoreClassModelChatConfig::fetch('disable_send')->current_value == 1) {
    exit;
}
if (is_object($chat) && $chat->hash == $Params['user_parameters']['hash'] && ($chat->status == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT || erLhcoreClassChat::canReopen($chat, true))) {
    if (ezcInputForm::hasPostData()) {
        $definition = array('email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'));
        $form = new ezcInputForm(INPUT_POST, $definition);
        $Errors = array();
        if (!$form->hasValidData('email')) {
            $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Wrong email address');
        }
        if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !isset($_POST['csfr_token']) || $_POST['csfr_token'] != $_SERVER['HTTP_X_CSRFTOKEN']) {
            $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Invalid CSRF token!');
        }
        if (empty($Errors)) {
            $tpl = erLhcoreClassTemplate::getInstance('lhchat/sendmail.tpl.php');
            $mailTemplate = erLhAbstractModelEmailTemplate::fetch(3);
            erLhcoreClassChatMail::prepareSendMail($mailTemplate);
            $mailTemplate->recipient = $form->email;
            $messages = array_reverse(erLhcoreClassModelmsg::getList(array('customfilter' => array('user_id != -1'), 'limit' => 500, '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);
        $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;
    }
    if ($form->hasValidData('req') && !empty($form->req)) {
        $inputData->values_req = $form->req;
    }
    if ($form->hasValidData('value') && !empty($form->value)) {
        $inputData->value_items = $form->value;
    }
    if ($form->hasValidData('hattr') && !empty($form->hattr)) {
        $inputData->hattr = $form->hattr;
    }
    if ($form->hasValidData('type') && !empty($form->type)) {
示例#19
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')));
示例#20
0
 if (is_numeric($Params['user_parameters_unordered']['msg']) && $Params['user_parameters_unordered']['action'] == '') {
     $cannedMessage = erLhcoreClassModelCannedMsg::fetch($Params['user_parameters_unordered']['msg']);
     if ($cannedMessage->user_id != $UserData->id) {
         erLhcoreClassModule::redirect('user/account', '#canned');
         exit;
     }
 }
 if (isset($_POST['Cancel_canned_action'])) {
     erLhcoreClassModule::redirect('user/account', '#canned');
     exit;
 }
 if (isset($_POST['Save_canned_action'])) {
     $definition = array('Message' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Position' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'Delay' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0)), 'AutoSend' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('Message') || $form->Message == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Please enter canned message');
     }
     if ($form->hasValidData('Position')) {
         $cannedMessage->position = $form->Position;
     }
     if ($form->hasValidData('Delay')) {
         $cannedMessage->delay = $form->Delay;
     }
     if ($form->hasValidData('AutoSend') && $form->AutoSend == true) {
         $cannedMessage->auto_send = 1;
     } else {
         $cannedMessage->auto_send = 0;
     }
     if (count($Errors) == 0) {
         $cannedMessage->msg = $form->Message;
示例#21
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) {
示例#22
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhuser/new.tpl.php');
$UserData = new erLhcoreClassModelUser();
$UserDepartaments = isset($_POST['UserDepartament']) ? $_POST['UserDepartament'] : array();
$show_all_pending = 0;
if (isset($_POST['Update_account'])) {
    $definition = array('Password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Password1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Surname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserDisabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'HideMyStatus' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'UserInvisible' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'showAllPendingEnabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'JobTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'DefaultGroup' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', null, FILTER_REQUIRE_ARRAY), 'Skype' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'));
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/new');
        exit;
    }
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!$form->hasValidData('Email')) {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/new', 'Wrong email address');
    }
    if (!$form->hasValidData('Name') || $form->Name == '') {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/new', 'Please enter a name');
    }
    if ($form->hasValidData('Surname') && $form->Surname != '') {
        $UserData->surname = $form->Surname;
    } else {
        $UserData->surname = '';
    }
    if ($form->hasValidData('JobTitle') && $form->JobTitle != '') {
        $UserData->job_title = $form->JobTitle;
    } else {
        $UserData->job_title = '';
    }
    if ($form->hasValidData('UserTimeZone') && $form->UserTimeZone != '') {
示例#23
0
        $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;
    }
    if ($form->hasValidData('req') && !empty($form->req)) {
        $inputData->values_req = $form->req;
    }
    if ($form->hasValidData('value') && !empty($form->value)) {
        $inputData->value_items = $form->value;
    }
    if ($form->hasValidData('hattr') && !empty($form->hattr)) {
        $inputData->hattr = $form->hattr;
    }
    if ($form->hasValidData('type') && !empty($form->type)) {
示例#24
0
 public static function validateChatbox(&$chatbox)
 {
     $definition = array('ManagerName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ChatboxName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Identifier' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'ActiveChatbox' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
     $form = new ezcInputForm(INPUT_POST, $definition);
     $Errors = array();
     if (!$form->hasValidData('ManagerName') || $form->ManagerName == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter a manager name!');
     } else {
         $chatbox->chat->nick = $form->ManagerName;
     }
     if (!$form->hasValidData('ChatboxName') || $form->ChatboxName == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter a chatbox name!');
     } else {
         $chatbox->name = $form->ChatboxName;
     }
     if (!$form->hasValidData('Identifier') || $form->Identifier == '') {
         $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/view', 'Please enter a chatbox identifier!');
     } else {
         $chatbox->identifier = $form->Identifier;
     }
     if ($form->hasValidData('ActiveChatbox') && $form->ActiveChatbox == true) {
         $chatbox->active = 1;
     } else {
         $chatbox->active = 0;
     }
     return $Errors;
 }
示例#25
0
    if ($form->hasValidData('ResellerRequest')) {
        $Instance->reseller_request = $form->ResellerRequest;
    }
    if ($form->hasValidData('Reseller') && $form->Reseller == true) {
        $Instance->is_reseller = $form->Reseller;
    } else {
        $Instance->is_reseller = false;
    }
    $Instance->saveThis();
    $tpl->set('updated', true);
}
if (isset($_POST['Update_departament']) || isset($_POST['Save_departament'])) {
    $definition = array('Address' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ClientTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Suspended' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Terminate' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'Request' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'RequestUsed' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'Expires' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string'), 'AttrInt1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'AttrInt2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'AttrInt3' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('Address')) {
        $Instance->address = $form->Address;
    }
    if ($form->hasValidData('ClientTitle')) {
        $Instance->client_title = $form->ClientTitle;
    }
    if ($form->hasValidData('Email')) {
        $Instance->email = $form->Email;
    } else {
        $Errors[] = 'Please enter valid e-mail';
    }
    if ($form->hasValidData('Request')) {
        $Instance->request = $form->Request;
    }
    if ($form->hasValidData('Suspended') && $form->Suspended == true) {
        $Instance->suspended = 1;
示例#26
0
     } else {
         $tpl->set('db_username', $form->DatabaseUsername);
         $tpl->set('db_password', $form->DatabasePassword);
         $tpl->set('db_host', $form->DatabaseHost);
         $tpl->set('db_port', $form->DatabasePort);
         $tpl->set('db_name', $form->DatabaseDatabaseName);
         $tpl->set('errors', $Errors);
         $tpl->setFile('lhinstall/install2.tpl.php');
     }
     break;
 case '3':
     $Errors = array();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $definition = array('AdminUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'AdminPassword' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'AdminPassword1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'AdminEmail' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'validate_email'), 'AdminName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'AdminSurname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'DefaultDepartament' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'string'));
         $form = new ezcInputForm(INPUT_POST, $definition);
         if (!$form->hasValidData('AdminUsername') || $form->AdminUsername == '') {
             $Errors[] = 'Please enter admin username';
         }
         if ($form->hasValidData('AdminUsername') && $form->AdminUsername != '' && strlen($form->AdminUsername) > 40) {
             $Errors[] = 'Maximum 40 characters for admin username';
         }
         if (!$form->hasValidData('AdminPassword') || $form->AdminPassword == '') {
             $Errors[] = 'Please enter admin password';
         }
         if ($form->hasValidData('AdminPassword') && $form->AdminPassword != '' && strlen($form->AdminPassword) > 40) {
             $Errors[] = 'Maximum 40 characters for admin password';
         }
         if ($form->hasValidData('AdminPassword') && $form->AdminPassword != '' && strlen($form->AdminPassword) <= 40 && $form->AdminPassword1 != $form->AdminPassword) {
             $Errors[] = 'Passwords missmatch';
         }
         if (!$form->hasValidData('AdminEmail')) {
示例#27
0
文件: edit.php 项目: sirromas/medical
    } else {
        $tpl->set('errors', $Errors);
    }
}
// Voting tab actions
$Option = (int) $Params['user_parameters_unordered']['option_id'] > 0 ? erLhcoreClassModelQuestionOption::fetch((int) $Params['user_parameters_unordered']['option_id']) : new erLhcoreClassModelQuestionOption();
if (isset($_POST['UpdateO'])) {
    $tab = 'voting';
    $definition = array('Option' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Priority' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'));
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    if (!$form->hasValidData('Option') || $form->Option == '') {
        $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Please enter an option!');
    }
    if ($form->hasValidData('Priority')) {
        $Option->priority = $form->Priority;
    } else {
        $Option->priority = 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');
 public static function renderInputTypeTextarea($params)
 {
     $value = '';
     if (ezcInputForm::hasPostData()) {
         $validationFields = array();
         $validationFields[$params['name']] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
         $form = new ezcInputForm(INPUT_POST, $validationFields);
         $Errors = array();
         if (!$form->hasValidData($params['name']) || isset($params['required']) && $params['required'] == 'required' && $form->{$params['name']} == '') {
             self::$errors[] = (isset($params['name_literal']) ? $params['name_literal'] : $params['name']) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('form/fill', 'is required');
         } elseif ($form->hasValidData($params['name'])) {
             $value = $form->{$params['name']};
             self::$collectedInfo[$params['name']] = array('definition' => $params, 'value' => $form->{$params['name']});
         }
     } else {
         if (isset(self::$collectedInfo[$params['name']]['value'])) {
             $value = self::$collectedInfo[$params['name']]['value'];
         } else {
             $value = isset($params['value']) ? $params['value'] : '';
         }
     }
     $placeholder = isset($params['placeholder']) ? ' placeholder="' . htmlspecialchars($params['placeholder']) . '" ' : '';
     return "<textarea name=\"{$params['name']}\" {$placeholder}>" . htmlspecialchars($value) . "</textarea>";
 }
示例#29
0
<?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')) {
示例#30
0
        } else {
            $tpl->set('updated', true);
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['UpdatePending_account'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('user/account');
        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;