This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
tuxbliki/app/controllers/node.rb

29 lines
1005 B
Ruby
Raw Normal View History

2008-06-27 00:13:15 -04:00
class Node < Application
def index
redirect('/')
end
def show
page = Page.find_by_nid(params[:id])
2008-09-01 13:30:48 -04:00
raise NotFound unless page or params[:id] == 'feed'
purl = url(:page, :id => page.name.gsub(/ /, '_')) rescue ''
purl = url(:controller => :feeds, :action => :rss, :format => :xml) if params[:id] == 'feed'
2008-06-27 00:13:15 -04:00
Merb.logger.info("Permenant Redirect Drupal Node to #{purl}")
self.status = 301
headers['Location'] = purl
return "<html><body>You are being <a href=\"#{purl}\">redirected</a>.</body></html>"
end
2008-07-03 02:12:27 -04:00
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
2008-09-01 13:30:48 -04:00
end