当前位置: 首页>>代码示例>>PHP>>正文


PHP ezcInputForm::hasValidData方法代码示例

本文整理汇总了PHP中ezcInputForm::hasValidData方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcInputForm::hasValidData方法的具体用法?PHP ezcInputForm::hasValidData怎么用?PHP ezcInputForm::hasValidData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ezcInputForm的用法示例。


在下文中一共展示了ezcInputForm::hasValidData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateAdminTheme

 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;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:55,代码来源:lhthemevalidator.php

示例2: validateSendMail

 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;
 }
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:54,代码来源:lhchatmail.php

示例3: validateSurvey

 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;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:52,代码来源:lhsurveyvalidator.php

示例4: formatFilter

 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;
 }
开发者ID:detain,项目名称:livehelperchat,代码行数:26,代码来源:lhrestapivalidator.php

示例5: validateXMPPAccount

 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;
 }
开发者ID:noikiy,项目名称:xmpp-chat,代码行数:47,代码来源:erlhcoreclassxmppaccountvalidator.php

示例6: validateSurvey

 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;
 }
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:12,代码来源:lhsurveyvalidator.php

示例7: validateFaq

 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;
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:42,代码来源:lhfaq.php

示例8: array

<?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;
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:configuration.php

示例9: ezcInputForm

<?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]';
        }
    }
}
开发者ID:bmdevel,项目名称:ezc,代码行数:15,代码来源:tutorial_example_01_process.php

示例10: array

<?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;
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:smtp.php

示例11: erLhcoreClassModelChatArchiveRange

<?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;
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:23,代码来源:archivechats.php

示例12: array

<?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')) {
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:31,代码来源:timezone.php

示例13: validateDepartment

 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')) {
//.........这里部分代码省略.........
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:101,代码来源:lhdepartament.php

示例14: array

// 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) {
开发者ID:alisadali,项目名称:automated-hosting,代码行数:31,代码来源:new.php

示例15: erLhcoreClassModelFaq

$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'))) {
开发者ID:p4prawin,项目名称:livechat,代码行数:31,代码来源:faqwidget.php


注:本文中的ezcInputForm::hasValidData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。