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

    created = false

    if params[:id].nil? or params[:id].empty?
      @item = Item.new_info(0)
      @item.attributes = params[:item]
      @item.user_id = @login_user.id
      @item.title = t('paren.no_title')

      [:image0, :image1].each do |img|

        next if params[img].nil? or params[img][:file].size == 0

        @item.save!
        created = true
        break
      end
    else
      @item = Item.find(params[:id])
    end

    modified = false

    item_images = @item.images_without_content
    [:image0, :image1].each do |img|
      next if params[img].nil? or params[img][:file].nil? or params[img][:file].size == 0
      image = Image.new
      image.item_id = @item.id
      image.file = params[img][:file]
      image.title = params[img][:title]
      image.memo = params[img][:memo]
      image.xorder = item_images.length
      image.save!

      modified = true
      item_images << image
    end

    if modified and !created
      @item.update_attribute(:updated_at, Time.now)
    end

    render(:partial => 'ajax_item_image', :layout => false)

  rescue => evar
    Log.add_error(request, evar)

    @image = Image.new
    @image.errors.add_to_base(evar.to_s[0, 256])

    render(:partial => 'ajax_item_image', :layout => false)
  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.