1 class PicturesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user, :only => []
6 before_filter :authenticate_user, :only => []
7 before_filter :authenticate_resource_reader, :only => [:show, :credit, :search]
9 before_filter :authenticate_admin!, :only => [:list, :browse]
12 @picture = Picture.show(params[:id], @author)
14 respond_to do |format|
15 opt = {:type => @picture.mime_type, :disposition=>"inline"}
16 format.png { send_data(@picture.restore(params[:subdir]), opt ) }
17 format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
18 format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
20 format.json { render :json => @picture.to_json}
25 @picture = Picture.show(params[:id], @author)
27 respond_to do |format|
28 format.html { render :layout => false } # show.html.erb
29 format.json { render :json => @picture.to_json}
34 @pictures = Picture.list_by_md5(params[:md5])
36 respond_to do |format|
38 format.json { render json: @pictures.to_json }
43 @pictures = Picture.all
45 respond_to do |format|
46 format.html { render layout: 'system' }# index.html.erb
47 format.json { render json: @pictures }
52 @picture = Picture.find(params[:id])
54 respond_to do |format|
55 format.html { render layout: 'system' } # show.html.erb
56 format.json { render json: @picture }