本文整理汇总了PHP中ezcInputForm类的典型用法代码示例。如果您正苦于以下问题:PHP ezcInputForm类的具体用法?PHP ezcInputForm怎么用?PHP ezcInputForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcInputForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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
示例3: 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:nagyistoce,项目名称:livehelperchat,代码行数:54,代码来源:lhchatmail.php
示例4: 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
示例5: 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
示例6: validateChatbox
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;
}
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:27,代码来源:lhchatbox.php
示例7: __construct
public function __construct($inputSource, $definition, $characterEncoding = null, $inputData = null, $useOverride = false)
{
if (($returnValue = ezcInputForm::validateDefinition($definition)) !== true) {
throw new ezcInputFormInvalidDefinitionException($returnValue[1]);
}
$this->definition = $definition;
$this->inputSource = $inputSource;
$this->inputData = $inputData;
if ($inputData === null || count($inputData) == 0) {
$this->parseInput();
} else {
$this->parseInputFromData($useOverride);
}
}
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:14,代码来源:lhform.php
示例8: 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
示例9: 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
示例10: array
<?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) {
开发者ID:sirromas,项目名称:medical,代码行数:31,代码来源:autologinconfig.php
示例11: json_encode
<?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: json_encode
<?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')));
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:saveremarks.php
示例13: 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
示例14: 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
示例15: erLhcoreClassModelQuestionOption
if (isset($_POST['SaveAction'])) {
erLhcoreClassModule::redirect('questionary/list');
exit;
} else {
$tpl->set('updated', true);
}
} 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;
开发者ID:sirromas,项目名称:medical,代码行数:31,代码来源:edit.php
示例16: array
$Instance->reseller_secret_hash = $form->ResellerSecretHash;
}
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;
}
开发者ID:jabaxalapa,项目名称:automated-hosting,代码行数:31,代码来源:edit.php
示例17: __construct
/**
* Constructs a new ezcInputForm for $inputSource with $definition.
*
* This method constructs a new ezcInputForm with three parameters. The
* $inputSource parameter selects the input source and should be one of the
* constants INPUT_GET, INPUT_POST or INPUT_COOKIE. The $definition
* parameter is an array of ezcInputFormDefinitionElement items and
* determines which input variables make up this form (see the example at
* the top of this class). The last parameter, $characterEncoding is the
* character encoding to use while retrieving input variable data. This
* parameter has currently no function as it will depend on PHP 6
* functionality which does not exist yet in the input filter extension.
*
* @throws ezcInputFormVariableMissingException when one of the required
* input variables is missing.
* @throws ezcInputFormInvalidDefinitionException when the definition array
* is invalid or when the input source was invalid.
*
* @param int $inputSource
* @param array(ezcInputFormDefinitionElement) $definition
* @param string $characterEncoding
*/
public function __construct($inputSource, $definition, $characterEncoding = null)
{
if (($returnValue = ezcInputForm::validateDefinition($definition)) !== true) {
throw new ezcInputFormInvalidDefinitionException($returnValue[1]);
}
$this->definition = $definition;
$this->inputSource = $inputSource;
$this->parseInput();
}
开发者ID:bmdevel,项目名称:ezc,代码行数:31,代码来源:input_form.php
示例18: erLhcoreClassModelUser
<?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 != '') {
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:31,代码来源:new.php
示例19: erLhcoreClassModelCannedMsg
* */
$cannedMessage = new erLhcoreClassModelCannedMsg();
if (is_numeric($Params['user_parameters_unordered']['msg']) && $Params['user_parameters_unordered']['
|
请发表评论