  def update
    Log.add_info(request, params.inspect)

    return unless request.post?

    attrs = params[:mail_filter]
    if attrs['and_or'] == 'none'
      attrs['and_or'] = nil
      attrs['conditions'] = nil
    else
      filter_conditions = params[:filter_condition]
      condition_entries = []
      filter_conditions.each do |condition_id, entry|
        point, compare, val = entry.split("\n")
        if val.nil? or val.empty?
          condition_entries << [point, compare].join('-')
        else
          condition_entries << [point, compare, val].join('-')
        end
      end
      attrs['conditions'] = condition_entries.join("\n")
    end

    filter_actions = params[:filter_action]
    action_entries = []
    filter_actions.each do |action_id, entry|
      verb, val = entry.split("\n")
      if val.nil? or val.empty?
        action_entries << verb
      else
        action_entries << [verb, val].join('-')
      end
    end
    attrs['actions'] = action_entries.join("\n")

    mail_filter_id = params[:id]
    if mail_filter_id.blank?
      @mail_filter = MailFilter.new(attrs.permit(MailFilter::PERMIT_BASE))
      @mail_filter.mail_account_id = params[:mail_account_id]
    else
      @mail_filter = MailFilter.find(mail_filter_id)

      if @mail_filter.mail_account.user_id != @login_user.id
        flash[:notice] = t('msg.need_to_be_owner')
        redirect_to(:controller => 'desktop', :action => 'show')
        return
      end
    end

    if @mail_filter.id.nil?
      @mail_filter.save!
      flash[:notice] = t('msg.register_success')
    else
      @mail_filter.update_attributes(attrs.permit(MailFilter::PERMIT_BASE))
      flash[:notice] = t('msg.update_success')
    end

    list
    render(:action => 'list', :layout => !request.xhr?)
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.