/*!
Fetches the http post var integer input and stores it in the data instance.
176231
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
        $useSeconds = ( $contentClassAttribute->attribute( self::USE_SECONDS_FIELD ) == 1 );

        if ( $http->hasPostVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ) and
             $http->hasPostVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ) and
             $http->hasPostVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ) and
             $http->hasPostVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ) and
             $http->hasPostVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ) and
             ( !$useSeconds or $http->hasPostVariable( $base . '_datetime_second_' . $contentObjectAttribute->attribute( 'id' ) ) ) )
        {
            $year   = $http->postVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) );
            $month  = $http->postVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) );
            $day    = $http->postVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) );
            $hour   = $http->postVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) );
            $minute = $http->postVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) );
            $second = $useSeconds ? $http->postVariable( $base . '_datetime_second_' . $contentObjectAttribute->attribute( 'id' ) ) : 0;

            if ( ( $year == '' and $month == '' and $day == '' and
                   $hour == '' and $minute == '' and ( !$useSeconds or $second == '' ) ) or
                 !checkdate( $month, $day, $year ) )
            {
                    $stamp = null;
            }
            else
            {
                $dateTime = new eZDateTime();
                $dateTime->setMDYHMS( $month, $day, $year, $hour, $minute, $second );
                $stamp = $dateTime->timeStamp();
            }

            $contentObjectAttribute->setAttribute( 'data_int', $stamp );
            return true;
        }
        return false;
    }
648084
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        if ( $http->hasPostVariable( $base . "_data_user_login_" . $contentObjectAttribute->attribute( "id" ) ) )
        {
            $login = strip_tags( $http->postVariable( $base . "_data_user_login_" . $contentObjectAttribute->attribute( "id" ) ) );
            $email = $http->hasPostVariable( $base . "_data_user_email_" . $contentObjectAttribute->attribute( "id" ) ) ? $http->postVariable( $base . "_data_user_email_" . $contentObjectAttribute->attribute( "id" ) ) : '';
            $password = $http->hasPostVariable( $base . "_data_user_password_" . $contentObjectAttribute->attribute( "id" ) ) ? $http->postVariable( $base . "_data_user_password_" . $contentObjectAttribute->attribute( "id" ) ) : '';
            $passwordConfirm = $http->hasPostVariable( $base . "_data_user_password_confirm_" . $contentObjectAttribute->attribute( "id" ) ) ? $http->postVariable( $base . "_data_user_password_confirm_" . $contentObjectAttribute->attribute( "id" ) ) : '';

            $contentObjectID = $contentObjectAttribute->attribute( "contentobject_id" );

            $user = $contentObjectAttribute->content();
            if ( $user === null )
            {
                $user = eZUser::create( $contentObjectID );
            }

            $ini = eZINI::instance();
            $generatePasswordIfEmpty = $ini->variable( "UserSettings", "GeneratePasswordIfEmpty" );
            if ( $password == "" )
            {
                if ( $generatePasswordIfEmpty == 'true' )
                {
                    $passwordLength = $ini->variable( "UserSettings", "GeneratePasswordLength" );
                    $password = $user->createPassword( $passwordLength );
                    $passwordConfirm = $password;
                    $http->setSessionVariable( "GeneratedPassword", $password );
                }
                else
                {
                    $password = null;
                }
            }

            eZDebugSetting::writeDebug( 'kernel-user', $password, "password" );
            eZDebugSetting::writeDebug( 'kernel-user', $passwordConfirm, "passwordConfirm" );
            eZDebugSetting::writeDebug( 'kernel-user', $login, "login" );
            eZDebugSetting::writeDebug( 'kernel-user', $email, "email" );
            eZDebugSetting::writeDebug( 'kernel-user', $contentObjectID, "contentObjectID" );
            if ( $password == "_ezpassword" )
            {
                $password = false;
                $passwordConfirm = false;
            }
            else
                $http->setSessionVariable( "GeneratedPassword", $password );

            eZDebugSetting::writeDebug( 'kernel-user', "setInformation run", "ezusertype" );
            $user->setInformation( $contentObjectID, $login, $email, $password, $passwordConfirm );
            $contentObjectAttribute->setContent( $user );
            return true;
        }
        return false;
    }
168876
def post_vars(self):
		
		if self.method() != 'POST':
			raise RuntimeError('Unable to return post vars for non-get method')

		content_type = self.content_type()
		if content_type is None or content_type.lower() != 'application/x-www-form-urlencoded':
			raise RuntimeError('Unable to return post vars with invalid content-type request')

		request_data = self.request_data()
		request_data = request_data.decode() if request_data is not None else ''
		re_search = WWebRequestProto.post_vars_re.search(request_data)
		if re_search is not None:
			return urllib.parse.parse_qs(re_search.group(1), keep_blank_values=1)
557350
function fetchHTTPInput( $http, $base, $event )
    {
        $gatewaysVar = $base . "_event_ezpaymentgateway_gateways_" . $event->attribute( "id" );
        if ( $http->hasPostVariable( $gatewaysVar ) )
        {
            $gatewaysArray = $http->postVariable( $gatewaysVar );
            if ( in_array( '-1', $gatewaysArray ) )
            {
                $gatewaysArray = array( -1 );
            }

            $gatewaysString = implode( ',', $gatewaysArray );
            $event->setAttribute( "data_text1", $gatewaysString );
        }
    }
14281
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        if ( $http->hasPostVariable( $base . "_data_float_" . $contentObjectAttribute->attribute( "id" ) ) )
        {
            $data = $http->postVariable( $base . "_data_float_" . $contentObjectAttribute->attribute( "id" ) );
            $data = str_replace(" ", "", $data );

            if ( !$contentObjectAttribute->validateIsRequired() &&  ( $data == "" ) )
            {
                return eZInputValidator::STATE_ACCEPTED;
            }

            $locale = eZLocale::instance();
            $data = $locale->internalNumber( $data );

            return $this->validateFloatHTTPInput(
                $data, $contentObjectAttribute,
                $contentObjectAttribute->contentClassAttribute()
            );
        }
        return eZInputValidator::STATE_INVALID;
    }
181746
function fixupInput( $http, $base )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            $dataType->fixupObjectAttributeHTTPInput( $http, $base, $this );
    }
731680
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {

        eZMediaType::checkFileUploads();

        $classAttribute = $contentObjectAttribute->contentClassAttribute();
        $player = $classAttribute->attribute( "data_text1" );
        $pluginPage = eZMediaType::pluginPage( $player );

        $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
        $version = $contentObjectAttribute->attribute( "version" );
        $width = $http->postVariable( $base . "_data_media_width_" . $contentObjectAttribute->attribute( "id" ) );
        $height = $http->postVariable( $base . "_data_media_height_" . $contentObjectAttribute->attribute( "id" ) );
        $quality = $http->hasPostVariable( $base . "_data_media_quality_" . $contentObjectAttribute->attribute( "id" ) ) ? $http->postVariable( $base . "_data_media_quality_" . $contentObjectAttribute->attribute( "id" ) ) : null;
        if ( $http->hasPostVariable( $base . "_data_media_controls_" . $contentObjectAttribute->attribute( "id" ) ) )
            $controls = $http->postVariable( $base . "_data_media_controls_" . $contentObjectAttribute->attribute( "id" ) );
        else
            $controls = null;

        $media = eZMedia::fetch( $contentObjectAttributeID, $version );
        if ( $media == null )
        {
           $media = eZMedia::create( $contentObjectAttributeID, $version );
        }

        $media->setAttribute( "contentobject_attribute_id", $contentObjectAttributeID );
        $media->setAttribute( "version", $version );
        $media->setAttribute( "width", $width );
        $media->setAttribute( "height", $height );
        $media->setAttribute( "quality", $quality );
        $media->setAttribute( "controls", $controls );
        $media->setAttribute( "pluginspage", $pluginPage );
        if ( $http->hasPostVariable( $base . "_data_media_is_autoplay_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "is_autoplay", true );
        else
            $media->setAttribute( "is_autoplay", false );
        if ( $http->hasPostVariable( $base . "_data_media_has_controller_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "has_controller", true );
        else
            $media->setAttribute( "has_controller", false );
        if ( $http->hasPostVariable( $base . "_data_media_is_loop_" . $contentObjectAttribute->attribute( "id" ) ) )
            $media->setAttribute( "is_loop", true );
        else
            $media->setAttribute( "is_loop", false );

        $mediaFilePostVarName = $base . "_data_mediafilename_" . $contentObjectAttribute->attribute( "id" );
        if ( eZHTTPFile::canFetch( $mediaFilePostVarName ) )
            $mediaFile = eZHTTPFile::fetch( $mediaFilePostVarName );
        else
            $mediaFile = null;
        if ( $mediaFile instanceof eZHTTPFile )
        {
            $mimeData = eZMimeType::findByFileContents( $mediaFile->attribute( "original_filename" ) );
            $mime = $mimeData['name'];

            if ( $mime == '' )
            {
                $mime = $mediaFile->attribute( "mime_type" );
            }
            $extension = eZFile::suffix( $mediaFile->attribute( "original_filename" ) );
            $mediaFile->setMimeType( $mime );
            if ( !$mediaFile->store( "original", $extension ) )
            {
                eZDebug::writeError( "Failed to store http-file: " . $mediaFile->attribute( "original_filename" ),
                                     "eZMediaType" );
                return false;
            }

            $orig_dir = $mediaFile->storageDir( "original" );
            eZDebug::writeNotice( "dir=$orig_dir" );
            $media->setAttribute( "filename", basename( $mediaFile->attribute( "filename" ) ) );
            $media->setAttribute( "original_filename", $mediaFile->attribute( "original_filename" ) );
            $media->setAttribute( "mime_type", $mime );

            $filePath = $mediaFile->attribute( 'filename' );
            $fileHandler = eZClusterFileHandler::instance();
            $fileHandler->fileStore( $filePath, 'media', true, $mime );
        }
        else if ( $media->attribute( 'filename' ) == '' )
        {
            $media->remove();
            return false;
        }

        $media->store();
        $contentObjectAttribute->setContent( $media );
        return true;
    }
1289689
function validateClassAttributeHTTPInput( $http, $base, $classAttribute )
    {
        $startValueName = $base . self::START_VALUE_VARIABLE . $classAttribute->attribute( "id" );
        $digitsName = $base . self::DIGITS_VARIABLE . $classAttribute->attribute( "id" );

        if ( $http->hasPostVariable( $startValueName ) and
             $http->hasPostVariable( $digitsName ) )
        {
            $startValueValue = str_replace( " ", "", $http->postVariable( $startValueName ) );
            $digitsValue = str_replace( " ", "", $http->postVariable( $digitsName ) );

            $startValueValueState = $this->IntegerValidator->validate( $startValueValue );
            $digitsValueState = $this->IntegerValidator->validate( $digitsValue );

            if ( ( $startValueValueState == eZInputValidator::STATE_ACCEPTED ) and
                 ( $digitsValueState == eZInputValidator::STATE_ACCEPTED ) )
            {
                return eZInputValidator::STATE_ACCEPTED;
            }
            return eZInputValidator::STATE_INTERMEDIATE;
        }
        return eZInputValidator::STATE_INVALID;
    }
75841
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $postVariableName = $base . "_data_object_relation_id_" . $contentObjectAttribute->attribute( "id" );
        $haveData = false;
        if ( $http->hasPostVariable( $postVariableName ) )
        {
            $relatedObjectID = $http->postVariable( $postVariableName );
            if ( $relatedObjectID == '' )
                $relatedObjectID = null;
            $contentObjectAttribute->setAttribute( 'data_int', $relatedObjectID );
            $haveData = true;
        }
        $fuzzyMatchVariableName = $base . "_data_object_relation_fuzzy_match_" . $contentObjectAttribute->attribute( "id" );
        if ( $http->hasPostVariable( $fuzzyMatchVariableName ) )
        {
            $trans = eZCharTransform::instance();

            $fuzzyMatchText = trim( $http->postVariable( $fuzzyMatchVariableName ) );
            if ( $fuzzyMatchText != '' )
            {
                $fuzzyMatchText = $trans->transformByGroup( $fuzzyMatchText, 'lowercase' );
                $classAttribute = $contentObjectAttribute->attribute( 'contentclass_attribute' );
                if ( $classAttribute )
                {
                    $classContent = $classAttribute->content();
                    if ( $classContent['default_selection_node'] )
                    {
                        $nodeID = $classContent['default_selection_node'];
                        $nodeList = eZContentObjectTreeNode::subTreeByNodeID( array( 'Depth' => 1 ), $nodeID );
                        $lastDiff = false;
                        $matchObjectID = false;
                        foreach ( $nodeList as $node )
                        {
                            $name = $trans->transformByGroup( trim( $node->attribute( 'name' ) ), 'lowercase' );
                            $diff = $this->fuzzyTextMatch( $name, $fuzzyMatchText );
                            if ( $diff === false )
                                continue;
                            if ( $diff == 0 )
                            {
                                $matchObjectID = $node->attribute( 'contentobject_id' );
                                break;
                            }
                            if ( $lastDiff === false or
                                 $diff < $lastDiff )
                            {
                                $lastDiff = $diff;
                                $matchObjectID = $node->attribute( 'contentobject_id' );
                            }
                        }
                        if ( $matchObjectID !== false )
                        {
                            $contentObjectAttribute->setAttribute( 'data_int', $matchObjectID );
                            $haveData = true;
                        }
                    }
                }
            }
        }
        return $haveData;
    }
226904
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $postVariableName = $base . "_data_object_relation_list_" . $contentObjectAttribute->attribute( "id" );
        if ( $http->hasPostVariable( $postVariableName ) && !$contentObjectAttribute->validateIsRequired() && $http->postVariable( $postVariableName ) == array( "no_relation" ) )
        {
            return eZInputValidator::STATE_ACCEPTED;
        }

        $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();

        // Check if selection type is not browse
        $classContent = $contentClassAttribute->content();

        if ( $classContent['selection_type'] != 0 )
        {
            if (
                $contentObjectAttribute->validateIsRequired()
                && ( !$http->hasPostVariable( $postVariableName ) || $http->postVariable( $postVariableName ) == array( "no_relation" ) )
            )
            {
                $contentObjectAttribute->setValidationError(
                    ezpI18n::tr(
                        'kernel/classes/datatypes',
                        'Missing objectrelation list input.'
                    )
                );
                return eZInputValidator::STATE_INVALID;
            }
            return eZInputValidator::STATE_ACCEPTED;
        }
        else if ( eZINI::instance()->variable( 'BackwardCompatibilitySettings', 'AdvancedObjectRelationList' ) == "disabled" )
        {
            // If in browse mode and relations have been added using the search field
            // items are stored in the post variable
            if (
                $http->postVariable( $postVariableName ) != array( "no_relation" )
                && count( $http->postVariable( $postVariableName ) ) > 0
            )
            {
                return eZInputValidator::STATE_ACCEPTED;
            }
        }

        // The following code is only there for the support of [BackwardCompatibilitySettings]/AdvancedObjectRelationList
        // which happens only when $classContent['selection_type'] == 0
        $content = $contentObjectAttribute->content();
        if ( $contentObjectAttribute->validateIsRequired() && empty( $content['relation_list'] ) )
        {
            $contentObjectAttribute->setValidationError(
                ezpI18n::tr(
                    'kernel/classes/datatypes',
                    'Missing objectrelation list input.'
                )
            );
            return eZInputValidator::STATE_INVALID;
        }

        $status = eZInputValidator::STATE_ACCEPTED;
        $inputParameters = $contentObjectAttribute->inputParameters();
        $parameters = $contentObjectAttribute->validationParameters();
        if ( isset( $parameters['prefix-name'] ) && $parameters['prefix-name'] )
            $parameters['prefix-name'][] = $contentClassAttribute->attribute( 'name' );
        else
            $parameters['prefix-name'] = array( $contentClassAttribute->attribute( 'name' ) );

        foreach ( $content['relation_list'] as $relationItem )
        {
            if ( !$relationItem['is_modified'] )
            {
                continue;
            }

            $subObjectID = $relationItem['contentobject_id'];
            $object = eZContentObject::fetch( $subObjectID );

            if ( !$object )
            {
                continue;
            }

            $attributes = $object->contentObjectAttributes(
                true,
                $relationItem['contentobject_version'],
                $contentObjectAttribute->attribute( 'language_code' )
            );

            $validationResult = $object->validateInput(
                $attributes,
                $base . '_ezorl_edit_object_' . $subObjectID,
                $inputParameters,
                $parameters
            );
            $content['temp'][$subObjectID] = array(
                'require-fixup' => $validationResult['require-fixup'],
                'attributes' => $attributes,
                'object' => $object,
            );
            foreach ( $validationResult['status-map'] as $statusItem )
            {
                $statusValue = $statusItem['value'];
                if ( $statusValue == eZInputValidator::STATE_INTERMEDIATE && $status == eZInputValidator::STATE_ACCEPTED )
                {
                    $status = eZInputValidator::STATE_INTERMEDIATE;
                }
                else if ( $statusValue == eZInputValidator::STATE_INVALID )
                {
                    $contentObjectAttribute->setHasValidationError( false );
                    $status = eZInputValidator::STATE_INVALID;
                }
            }
        }

        $contentObjectAttribute->setContent( $content );
        return $status;
    }
534783
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        if ( $http->hasPostVariable( $base . '_ezkeyword_data_text_' . $contentObjectAttribute->attribute( 'id' ) ) )
        {
            $data = $http->postVariable( $base . '_ezkeyword_data_text_' . $contentObjectAttribute->attribute( 'id' ) );
            $keyword = new eZKeyword();
            $keyword->initializeKeyword( $data );
            $contentObjectAttribute->setContent( $keyword );
            return true;
        }
        return false;
    }
1035364
function fetchInput( $http, $base )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            return $dataType->fetchObjectAttributeHTTPInput( $http, $base, $this );

        return false;
    }
1136756
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $contentObjectID = $contentObjectAttribute->attribute( "contentobject_id" );

        // check if paex object for the current coID exists, create if needed.
        $paex = $contentObjectAttribute->content();
        if ( $paex === null )
        {
            $paex = eZPaEx::create( $contentObjectID );
        }

        // Set current values as default ones
        $passwordvalidationregexp   = $paex->attribute( 'passwordvalidationregexp' );
        $passwordlifetime           = $paex->attribute( 'passwordlifetime' );
        $expirationnotification     = $paex->attribute( 'expirationnotification' );
        $passwordLastUpdated        = $paex->attribute( 'password_last_updated' );
        $updatechildren             = $paex->attribute( 'updatechildren' );
        $expirationnotificationSent = $paex->attribute( 'expirationnotification_sent' );

        // Update current values with new ones entered in the form if there are any
        if ($http->hasPostVariable( $base . "_data_paex_passwordvalidationregexp_" . $contentObjectAttribute->attribute( "id" ) ) )
        {
            $passwordvalidationregexp = $http->postVariable( $base . "_data_paex_passwordvalidationregexp_" . $contentObjectAttribute->attribute( "id" ) );
        }

        if ($http->hasPostVariable( $base . "_data_paex_passwordlifetime_" . $contentObjectAttribute->attribute( "id" ) ) )
        {
            $passwordlifetime = $http->postVariable( $base . "_data_paex_passwordlifetime_" . $contentObjectAttribute->attribute( "id" ) );
        }

        if ($http->hasPostVariable( $base . "_data_paex_expirationnotification_" . $contentObjectAttribute->attribute( "id" ) ) )
        {
            $expirationnotification = $http->postVariable( $base . "_data_paex_expirationnotification_" . $contentObjectAttribute->attribute( "id" ) );
        }
        // Be sure passwordlifetime is set
        if ( trim( $passwordlifetime ) == '' )
        {
            $passwordlifetime = eZPaEx::NOT_DEFINED;
        }

        // Be sure expirationnotification is set
        if ( trim( $expirationnotification ) == '' )
        {
            $expirationnotification = eZPaEx::NOT_DEFINED;
        }

        // If we are editing a user account set it's password_last_updated as needed.
        if ( $paex->isUser() )
        {
            // Search for password entered in the form
            $newPassword = "";
            foreach ( $http->postVariable( $base . '_id' ) as $coaid )
            {
                if ( $http->hasPostVariable( $base . '_data_user_password_' . $coaid ) )
                {
                    $newPassword = $http->postVariable( $base . '_data_user_password_' . $coaid );
                    break;
                }
            }
            // Check if the password has changed
            if ( trim( $newPassword ) && ( $newPassword != "_ezpassword" ) )
            {
                $currentUserID = eZUser::currentUserID();
                if ( $currentUserID == $contentObjectID )
                {
                    // If self editing, set last_updated to current time
                    $passwordLastUpdated = time();

                    // if audit is enabled password changes should be logged
                    eZAudit::writeAudit( 'user-password-change-self', array( ) );
                }
                else if ( $currentUserID == eZUser::anonymousId() )
                {
                    // register, @see http://issues.ez.no/15391
                    $passwordLastUpdated = time();
                }
                else
                {
                    // If changing other user's password, set last_updated to 0 to force
                    // password change in the next connection
                    $passwordLastUpdated = 0;

                    // if audit is enabled password changes should be logged
                    $targetUser = eZUser::fetch( $contentObjectID );
                    eZAudit::writeAudit( 'user-password-change', array( 'User id' => $targetUser->attribute( 'contentobject_id' ), 'User login' => $targetUser->attribute( 'login' ) ) );
                }
                // Password has changed, reset expirationnotification_sent flag to send again a notification when this new password be about to expire
                $expirationnotificationSent = 0;
            }
        }
        else
        {
            // If we are updating a user group and don't have the updatechildren post var, set updatechildren flag to disabled
            if ($http->hasPostVariable( $base . "_data_paex_updatechildren_" . $contentObjectAttribute->attribute( "id" ) ))
            {
                $updatechildren = $http->postVariable( $base . "_data_paex_updatechildren_" . $contentObjectAttribute->attribute( "id" ) );
            }
            else
            {
                $updatechildren = 0;
            }
        }

		if ( $paex->canEdit() )
        {
            // If user has permission, update full paex object with possible new values
            $paex->setInformation( $contentObjectID, $passwordvalidationregexp, $passwordlifetime, $expirationnotification, $passwordLastUpdated, $updatechildren, $expirationnotificationSent );
        }
        else
        {
            // If user don't have permission to update paex data, only update the password_last_updated and expirationnotification_sent fields
            $paex->setAttribute( 'password_last_updated',$passwordLastUpdated );
            $paex->setAttribute( 'expirationnotification_sent',$expirationnotificationSent );
        }

        $contentObjectAttribute->setContent( $paex );
        return true;
    }
458513
function validateInput( $http, $base,
                            &$inputParameters, $validationParameters = array() )
    {
        $dataType = $this->dataType();
        if ( $dataType )
        {
            $this->setInputParameters( $inputParameters );
            $this->setValidationParameters( $validationParameters );
            $this->IsValid = $dataType->validateObjectAttributeHTTPInput( $http, $base, $this );
            $this->unsetValidationParameters();
            $this->unsetInputParameters();
        }
        return $this->IsValid;
    }
1069518
function insertHTTPFile( $object, $objectVersion, $objectLanguage,
                             $objectAttribute, $httpFile, $mimeData,
                             &$result )
    {
        $result = array( 'errors' => array(),
                         'require_storage' => false );
        $attributeID = $objectAttribute->attribute( 'id' );

        $binary = eZBinaryFile::fetch( $attributeID, $objectVersion );
        if ( $binary === null )
            $binary = eZBinaryFile::create( $attributeID, $objectVersion );

        $httpFile->setMimeType( $mimeData['name'] );

        $suffix = false;
        if ( isset( $mimeData['suffix'] ) )
            $suffix = $mimeData['suffix'];

        $db = eZDB::instance();
        $db->begin();

        if ( !$httpFile->store( "original", $suffix, false ) )
        {
            $result['errors'][] = array( 'description' => ezpI18n::tr( 'kernel/classes/datatypes/ezbinaryfile',
                                                        'Failed to store file %filename. Please contact the site administrator.', null,
                                                        array( '%filename' => $httpFile->attribute( "original_filename" ) ) ) );
            return false;
        }


        $filePath = $binary->attribute( 'filename' );

        $binary->setAttribute( "contentobject_attribute_id", $attributeID );
        $binary->setAttribute( "version", $objectVersion );
        $binary->setAttribute( "filename", basename( $httpFile->attribute( "filename" ) ) );
        $binary->setAttribute( "original_filename", $httpFile->attribute( "original_filename" ) );
        $binary->setAttribute( "mime_type", $mimeData['name'] );

        $binary->store();

        $filePath = $httpFile->attribute( 'filename' );
        $fileHandler = eZClusterFileHandler::instance();
        $fileHandler->fileStore( $filePath, 'binaryfile', true, $mimeData['name'] );
        $objectAttribute->setContent( $binary );

        $db->commit();

        $objectAttribute->setContent( $binary );

        return true;
    }
148074
function initializeFromHTTPFile( $httpFile, $imageAltText = false )
    {
        $this->increaseImageSerialNumber();

        $mimeData = eZMimeType::findByFileContents( $httpFile->attribute( 'filename' ) );
        if ( !$mimeData['is_valid'] )
        {
            $mimeData = eZMimeType::findByName( $httpFile->attribute( 'mime_type' ) );
            if ( !$mimeData['is_valid'] )
            {
                $mimeData = eZMimeType::findByURL( $httpFile->attribute( 'original_filename' ) );
            }
        }
        $this->removeAliases();
        $this->setOriginalAttributeDataValues( $this->ContentObjectAttributeData['id'],
                                               $this->ContentObjectAttributeData['version'],
                                               $this->ContentObjectAttributeData['language_code'] );
        $contentVersion = eZContentObjectVersion::fetchVersion( $this->ContentObjectAttributeData['version'],
                                                                $this->ContentObjectAttributeData['contentobject_id'] );
        $objectName = $this->imageName( $this->ContentObjectAttributeData, $contentVersion );
        $objectPathString = $this->imagePath( $this->ContentObjectAttributeData, $contentVersion, true );

        eZMimeType::changeBaseName( $mimeData, $objectName );
        eZMimeType::changeDirectoryPath( $mimeData, $objectPathString );

        $httpFile->store( false, false, $mimeData );

        $originalFilename = $httpFile->attribute( 'original_filename' );
        return $this->initialize( $mimeData, $originalFilename, $imageAltText );
    }
718835
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        // Check "price inc/ex VAT" and "VAT type" fields.
        $vatTypeID = $http->postVariable( $base . '_ezmultiprice_vat_id_' . $contentObjectAttribute->attribute( 'id' ) );
        $vatExInc = $http->postVariable( $base . '_ezmultiprice_inc_ex_vat_' . $contentObjectAttribute->attribute( 'id' ) );


        if ( $vatExInc == 1 && $vatTypeID == -1 )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                                 'Dynamic VAT cannot be included.' ) );
            return eZInputValidator::STATE_INVALID;
        }

        // Check price.
        if ( $http->hasPostVariable( $base . '_price_array_' . $contentObjectAttribute->attribute( "id" ) ) )
        {
            $customPriceList = $http->postVariable( $base . '_price_array_' . $contentObjectAttribute->attribute( "id" ) );
            foreach ( $customPriceList as $currencyCode => $value )
            {
                if( $contentObjectAttribute->validateIsRequired() || ( $value != '' ) )
                {
                    if ( !preg_match( "#^[0-9]+(.){0,1}[0-9]{0,2}$#", $value ) )
                    {
                        $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                                             "Invalid price for '%currencyCode' currency ",
                                                                             false,
                                                                             array( '%currencyCode' => $currencyCode ) ) );
                        return eZInputValidator::STATE_INVALID;
                    }
                }
            }
        }
        else if ( $contentObjectAttribute->validateIsRequired() )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes', 'Input required' ) );
            return eZInputValidator::STATE_INVALID;
        }

        return eZInputValidator::STATE_ACCEPTED;
    }