Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2010-11-22 19:13:15 -06:00
commit 8d7381bb54
2 changed files with 15 additions and 20 deletions

View file

@ -41,11 +41,9 @@ class ApplicationController < ActionController::Base
s.scan( %r(\w{#{n},#{n}}) ).collect {|a| (a.hex * 2/3).to_s(16).rjust(n,'0')}.join
end
def check_authorization
if in_a_web? and authorization_needed? and not authorized?
redirect_to :controller => 'wiki', :action => 'login', :web => @web_name
return false
end
def check_authorization
redirect_to(:controller => 'wiki', :action => 'login',
:web => @web_name) if in_a_web? and authorization_needed? and not authorized?
end
def connect_to_model
@ -55,10 +53,8 @@ class ApplicationController < ActionController::Base
@author = cookies['author'] || 'AnonymousCoward'
if @web_name
@web = @wiki.webs[@web_name]
if @web.nil?
render(:status => 404, :text => "Unknown web '#{@web_name}'", :layout => 'error')
return false
end
render(:status => 404, :text => "Unknown web '#{@web_name}'",
:layout => 'error') if @web.nil?
end
end
@ -252,7 +248,6 @@ class ApplicationController < ActionController::Base
layout = false if %w(tex tex_list).include?(action_name)
headers['Allow'] = 'POST'
render(:status => 405, :text => 'You must use an HTTP POST', :layout => layout)
return false
end
return true
end

View file

@ -88,23 +88,23 @@ class FileController < ApplicationController
protected
def check_authorized
if authorized? or @web.published?
return true
else
unless authorized? or @web.published?
@hide_navigation = true
render(:status => 403, :text => 'This web is private', :layout => true)
return false
end
end
def check_allow_uploads
render(:status => 404, :text => "Web #{params['web'].inspect} not found", :layout => 'error') and return false unless @web
if @web.allow_uploads? and authorized?
return true
if @web
if @web.allow_uploads? and authorized?
return true
else
@hide_navigation = true
render(:status => 403, :text => 'File uploads are blocked by the webmaster', :layout => true)
return false
end
else
@hide_navigation = true
render(:status => 403, :text => 'File uploads are blocked by the webmaster', :layout => true)
return false
render(:status => 404, :text => "Web #{params['web'].inspect} not found", :layout => 'error')
end
end