本文整理汇总了PHP中ezcInputForm类的典型用法代码示例。如果您正苦于以下问题:PHP ezcInputForm类的具体用法?PHP ezcInputForm怎么用?PHP ezcInputForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcInputForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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) {
示例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;
示例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')));
示例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')) {
示例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;
示例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;