forked from dsjoerg/ggtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayers_controller.rb
More file actions
40 lines (31 loc) · 1.04 KB
/
players_controller.rb
File metadata and controls
40 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
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
class PlayersController < ApplicationController
def show
@identity = ESDB::Identity.find(params[:id])
not_found and return if !@identity
escaped_name = nil
escaped_name = CGI.escape params[:name] unless params[:name].nil?
# Was someone a naughty boy or girl and mess up the name?
redirect_to :action => 'show', :id => params[:id], :name => @identity.name unless ( @identity.name == params[:name] || @identity.name == escaped_name )
@prolevel = 0
account = Account.find_by_esdb_id(@identity.id)
if account.present?
# Is the user a pro user?
if account.user.pro?
@prolevel = account.user.prolevel
end
end
gon.identity = @identity.to_hash
end
def give_one_month_ggtracker_pro
not_found and return if !superuser?
account = Account.find_by_esdb_id(params[:id])
user = account.user
not_found and return if user.prolevel.present?
user.prolevel = 1
user.pro_cancelled_at = Time.now
user.save!
redirect_to action: :show
end
def index
end
end