def display_data(url):
page_init()
deletable = None
db = get_db()
cur = db.cursor()
cur.execute('SELECT '+database_fields+' FROM playerinfo WHERE url='+app.sqlesc+'',(url,))
data = cur.fetchall()
if len(data) != 1:
g.error = _('There is nothing here... is this URL correct?')
if str(url) != 'favicon.ico':
cur.execute('INSERT INTO errors (ip, time, notes) VALUES ('+app.sqlesc+','+app.sqlesc+','+app.sqlesc+')',(request.environ['REMOTE_ADDR'],time.time(),str(len(data))+' cur.fetchall() for url:'+str(url)))
db.commit()
return render_template("error.html", **page_args())
else:
cur.execute('UPDATE playerinfo SET views=views+1 WHERE url='+app.sqlesc+'',(url,))
db.commit()
datadict = {}
for k, key in enumerate(sorted(database_structure_dict.keys())):
if key != 'farm_info':
datadict[key] = data[0][k]
claimable = False
deletable = False
if datadict['owner_id'] == None:
if url in session and url+'del_token' in session and session[url] == datadict['md5'] and session[url+'del_token'] == datadict['del_token']:
if logged_in():
claimable = True
else:
deletable = True
elif logged_in() and str(datadict['owner_id']) == str(get_logged_in_user()):
deletable = True
# other_saves, gallery_set = get_others(datadict['url'],datadict['date'],datadict['map_url'])
other_saves, gallery_set = get_others(datadict['url'],get_date(datadict),datadict['map_url'])
for item in ['money','totalMoneyEarned','statsStepsTaken','millisecondsPlayed']:
if item == 'millisecondsPlayed':
datadict[item] = "{:,}".format(round(float((int(datadict[item])/1000)/3600.0),1))
else:
datadict[item] = "{:,}".format(datadict[item])
datadict['animals'] = None if datadict['animals']=='{}' else json.loads(datadict['animals'])
datadict['portrait_info'] = json.loads(datadict['portrait_info'])
friendships = sorted([[friendship[11:],datadict[friendship]] for friendship in sorted(database_structure_dict.keys()) if friendship.startswith('friendships') and datadict[friendship]!=None],key=lambda x: x[1])[::-1]
kills = sorted([[kill[27:].replace('_',' '),datadict[kill]] for kill in sorted(database_structure_dict.keys()) if kill.startswith('statsSpecificMonstersKilled') and datadict[kill]!=None],key=lambda x: x[1])[::-1]
if datadict['imgur_json']!=None:
datadict['imgur_json'] = json.loads(datadict['imgur_json'])
# passworded = True if datadict['del_password'] != None else False
# passworded=passworded, removed from next line
claimables = find_claimables()
vote = json.dumps({url:get_votes(url)})
if logged_in() == False and len(claimables) > 1 and request.cookies.get('no_signup')!='true':
flash({'message':'
'+_("It looks like you have uploaded multiple files, but are not logged in: if you sign up or sign in you can link these uploads, enable savegame sharing, and one-click-post farm renders to imgur!")+'
'.format(url_for('signup'),url_for('login')),'cookie_controlled':'no_signup'})return render_template("profile.html", deletable=deletable, claimable=claimable, claimables=claimables, vote=vote,data=datadict, kills=kills, friendships=friendships, others=other_saves, gallery_set=gallery_set, **page_args())