redirects for chora

master
Coleman 2008-07-03 01:12:27 -05:00
parent 27443066a4
commit 37bd5cbb83
2 changed files with 17 additions and 1 deletions

View File

@ -12,4 +12,16 @@ class Node < Application
headers['Location'] = purl
return "<html><body>You are being <a href=\"#{purl}\">redirected</a>.</body></html>"
end
def chora
if params[:program] and params[:program] =~ /PenguinCoder|tuxwiki/i
raise NotFound
end
safe_program = params[:program].gsub(/\W/, '').downcase
gurl = "http://github.com/penguincoder/#{safe_program}"
Merb.logger.info("Permenant Chora redirect for #{safe_program}")
self.status = 301
headers['Location'] = gurl
return "<html><body>You are being <a href=\"#{gurl}\">redirected</a>.</body></html>"
end
end

View File

@ -1,9 +1,13 @@
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |r|
r.match('/node/:id').to(
r.match('/node/(node/)?:id').to(
:controller => 'node',
:action => 'show'
)
r.match('/horde/chora/:phpaction.php/:program').to(
:controller => 'node',
:action => 'chora'
)
r.resources :pages
r.resources :comments
r.resources :tags