11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/ishapi/sites_controller.rb', line 11
def show
if params[:domain].include?(".json")
domain = params[:domain][0...-5]
else
domain = params[:domain]
end
@site = ::Site.find_by :domain => domain, :lang => :en
authorize! :show, @site
if @site.is_private
if !params[:accessToken]
render :json => { :status => :unauthorized}, :status => :unauthorized
return
end
access_token = params[:accessToken]
@graph = Koala::Facebook::API.new( access_token, ::FB[@site.domain][:secret] )
@profile = @graph.get_object "me", :fields => 'email'
if @site.private_user_emails.include?( @profile['email'] )
;
else
render :json => { :status => :unauthorized}, :status => :unauthorized
render :status => :unauthorized
end
end
@galleries = @site.galleries.limit( 10 )
@newsitems = @site.newsitems.limit(10)
@reports = @site.reports.limit( 10 )
@langs = ::Site.where( :domain => domain ).map( &:lang )
@feature_tags = @site.tags.where( :is_feature => true )
end
|