.BANCHO. Set country to unknown for users with hidden country flag
This commit is contained in:
parent
49b36e6acb
commit
82c9d2209b
|
@ -124,14 +124,21 @@ def handle(flaskRequest):
|
|||
|
||||
# Get location and country from ip.zxq.co or database
|
||||
if generalFunctions.stringToBool(glob.conf.config["server"]["localizeusers"]):
|
||||
# Get location and country from IP
|
||||
location = locationHelper.getLocation(requestIP)
|
||||
countryLetters = locationHelper.getCountry(requestIP)
|
||||
country = countryHelper.getCountryID(countryLetters)
|
||||
# Make sure this user has not disabled his country flag
|
||||
if userHelper.getShowCountry(userID) == False:
|
||||
location = [0,0]
|
||||
countryLetters = "XX"
|
||||
country = 0
|
||||
else:
|
||||
# Get location and country from IP
|
||||
location = locationHelper.getLocation(requestIP)
|
||||
countryLetters = locationHelper.getCountry(requestIP)
|
||||
country = countryHelper.getCountryID(countryLetters)
|
||||
else:
|
||||
# Set location to 0,0 and get country from db
|
||||
print("[!] Location skipped")
|
||||
location = [0,0]
|
||||
countryLetters = "XX"
|
||||
country = countryHelper.getCountryID(userHelper.getCountry(userID))
|
||||
|
||||
# Set location and country
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import passwordHelper
|
||||
import gameModes
|
||||
import generalFunctions
|
||||
import glob
|
||||
|
||||
def getID(username):
|
||||
|
@ -284,3 +285,15 @@ def setCountry(userID, country):
|
|||
country -- country letters
|
||||
"""
|
||||
glob.db.execute("UPDATE users_stats SET country = ? WHERE id = ?", [country, userID])
|
||||
|
||||
def getShowCountry(userID):
|
||||
"""
|
||||
Get userID's show country status
|
||||
|
||||
userID -- userID
|
||||
return -- True if country is shown, False if it's hidden
|
||||
"""
|
||||
country = glob.db.fetch("SELECT show_country FROM users_stats WHERE id = ?", [userID])
|
||||
if country == None:
|
||||
return False
|
||||
return generalFunctions.stringToBool(country)
|
||||
|
|
Loading…
Reference in New Issue
Block a user