forked from github/server
noch ein paar mehr fixes und anpassungen
This commit is contained in:
parent
1bcb841fcb
commit
0ff5b6eaed
|
@ -10,7 +10,6 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# specify the filename of the template file
|
# specify the filename of the template file
|
||||||
scripturl="http://eressea.upb.de/cgi-bin/eressea/eressea-confirm.py"
|
|
||||||
HTMLTemplate = "eressea.html"
|
HTMLTemplate = "eressea.html"
|
||||||
DefaultTitle = "Eressea Anmeldung"
|
DefaultTitle = "Eressea Anmeldung"
|
||||||
dbname = "eressea"
|
dbname = "eressea"
|
||||||
|
|
|
@ -13,7 +13,6 @@ import smtplib
|
||||||
from whrandom import choice
|
from whrandom import choice
|
||||||
|
|
||||||
# specify the filename of the template file
|
# specify the filename of the template file
|
||||||
scripturl="http://eressea.upb.de/cgi-bin/eressea/eressea-register.py"
|
|
||||||
HTMLTemplate = "eressea.html"
|
HTMLTemplate = "eressea.html"
|
||||||
MailTemplate="register.mail"
|
MailTemplate="register.mail"
|
||||||
DefaultTitle = "Eressea Anmeldung"
|
DefaultTitle = "Eressea Anmeldung"
|
||||||
|
@ -23,7 +22,7 @@ locale="de"
|
||||||
smtpserver = 'localhost'
|
smtpserver = 'localhost'
|
||||||
db=None
|
db=None
|
||||||
game_id=0 # Eressea Main game
|
game_id=0 # Eressea Main game
|
||||||
tutorial_id=None #
|
tutorial_id=None # 1 to active, None to disable tutorials
|
||||||
|
|
||||||
# define a new function called Display
|
# define a new function called Display
|
||||||
# it takes one parameter - a string to Display
|
# it takes one parameter - a string to Display
|
||||||
|
|
|
@ -16,7 +16,7 @@ def genpasswd():
|
||||||
newpasswd = newpasswd + choice(chars)
|
newpasswd = newpasswd + choice(chars)
|
||||||
return newpasswd
|
return newpasswd
|
||||||
|
|
||||||
query = "select distinct u.email, s.id, s.password, r.name, u.locale, s.bonus from users u, races r, subscriptions s left join userips i on u.id=i.user left join bannedips b on i.ip=b.ip where s.user=u.id and b.ip is NULL and u.status='CONFIRMED' and r.race=s.race and s.game="+str(game_id)+" and r.locale='de' order by u.id"
|
query = "select distinct u.email, s.id, s.password, r.name, u.locale, s.bonus from users u, races r, subscriptions s left join userips i on u.id=i.user left join bannedips b on i.ip=b.ip where s.user=u.id and b.ip is NULL and s.status='CONFIRMED' and r.race=s.race and s.game="+str(game_id)+" and r.locale='de' order by u.id"
|
||||||
db=MySQLdb.connect(db=dbname)
|
db=MySQLdb.connect(db=dbname)
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
|
|
|
@ -21,9 +21,10 @@ MailTemplate="templates/register.mail"
|
||||||
smtpserver='localhost'
|
smtpserver='localhost'
|
||||||
server=smtplib.SMTP(smtpserver)
|
server=smtplib.SMTP(smtpserver)
|
||||||
patchdir='/home/eressea/eressea-rsync'
|
patchdir='/home/eressea/eressea-rsync'
|
||||||
|
game_id=0
|
||||||
|
|
||||||
def Patch():
|
def Patch():
|
||||||
i = cursor.execute("select name, patch from games where id=0")
|
i = cursor.execute("select name, patch from games where id="+str(game_id))
|
||||||
name, patch = cursor.fetchone()
|
name, patch = cursor.fetchone()
|
||||||
print "Auswertung für " + name + " Patch Level " + str(int(patch)) + ", Runde "+str(lastturn)
|
print "Auswertung für " + name + " Patch Level " + str(int(patch)) + ", Runde "+str(lastturn)
|
||||||
while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
|
while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
|
||||||
|
@ -50,13 +51,25 @@ def Send(email, custid, firstname, password, position, locale):
|
||||||
return
|
return
|
||||||
|
|
||||||
Patch()
|
Patch()
|
||||||
cursor.execute("update users set status='EXPIRED' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='WAITING'")
|
print "must update this. only partially done"
|
||||||
cursor.execute("update users set status='WAITING' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='CONFIRMED'")
|
sys.exit(-1)
|
||||||
users = cursor.execute("select firstname, locale, email, id, password from users where status='WAITING' order by id")
|
|
||||||
|
|
||||||
position=0
|
# remove all illegal and banned users:
|
||||||
|
users = cursor.execute("SELECT s.id from users u, subscriptions s where u.id=s.user and u.status in ('BANNED', 'ILLEGAL')")
|
||||||
while users:
|
while users:
|
||||||
users=users-1
|
users=users-1
|
||||||
|
sid = cursor.fetchone()[0]
|
||||||
|
update.execute("UPDATE subscriptions set status='EXPIRED' WHERE id="+str(int(sid)))
|
||||||
|
|
||||||
|
# espire all users without confirmation. reset waiting list.
|
||||||
|
cursor.execute("update subscriptions set status='EXPIRED' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='WAITING'")
|
||||||
|
cursor.execute("update subscriptions set status='WAITING' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='CONFIRMED'")
|
||||||
|
|
||||||
|
# remind everyone who is left on the waiting list.
|
||||||
|
waiting = cursor.execute("select firstname, locale, email, u.id, s.password from users u, subscriptions s where u.id=s.users and s.status='WAITING'")
|
||||||
|
position=0
|
||||||
|
while waiting:
|
||||||
|
waiting=waiting-1
|
||||||
position=position+1
|
position=position+1
|
||||||
firstname, locale, email, custid, password = cursor.fetchone()
|
firstname, locale, email, custid, password = cursor.fetchone()
|
||||||
print "Sending reminder email to "+str(int(custid))+" "+email
|
print "Sending reminder email to "+str(int(custid))+" "+email
|
||||||
|
|
Loading…
Reference in New Issue