Merge branch 'master' into customdomains

This commit is contained in:
Kyle Drake 2013-07-27 06:08:09 +02:00
commit dc0a88b541
4 changed files with 15 additions and 5 deletions

12
app.rb
View file

@ -35,8 +35,9 @@ get '/?' do
end
get '/browse' do
@current_page = params[:current_page] || 1
@current_page = params[:current_page]
@current_page = @current_page.to_i
@current_page = 1 if @current_page == 0
site_dataset = Site.filter(is_banned: false).filter(site_changed: true).paginate(@current_page, 300)
@ -605,3 +606,12 @@ end
def template_site_title(username)
"#{username.capitalize}#{username[username.length-1] == 's' ? "'" : "'s"} Site"
end
def encoding_fix(file)
begin
Rack::Utils.escape_html file
rescue ArgumentError => e
return Rack::Utils.escape_html(file.force_encoding('BINARY')) if e.message =~ /invalid byte sequence in UTF-8/
fail
end
end