""" % (sys.argv[0].replace("/data/project/rightstool/public_html//cgi-bin/", "").replace(".py", ""), Quser, checked)
#Do only if the user has been specified
if Quser!="":
#Getting the wiki list
db = MySQLdb.connect(db='meta_p', host="metawiki.labsdb", user=SQLuser, passwd=SQLpasswd)
cursor = db.cursor()
cursor.execute("SELECT dbname, slice, url FROM wiki WHERE url IS NOT NULL ORDER BY dbname")
#wikis=[[i[0], i[1], i[2]] for i in cursor.fetchall()]
wikis = cursor.fetchall()
#Some more HTML
print """
User rights for %s
""" % Quser
dbhost = "";
#Getting the data from MySQL
for wiki in wikis:
try:
if wiki[1] != dbhost:
db.close()
dbhost = wiki[1]
db = MySQLdb.connect(host=dbhost, user=SQLuser, passwd=SQLpasswd)
cursor = db.cursor()
cursor.execute("USE %s_p;" % wiki[0])
sql = "SELECT ug_group FROM user, user_groups WHERE user_name='%s' AND user_id=ug_user;" % Quser.replace("'", "\\'")
cursor.execute(sql)
result = cursor.fetchall()
rights=[result[i][0] for i in range(0, len(result))]
if stew: tabrig=u'
%s' % (urllib.quote(Quser), wiki[0], u', '.join(rights))
else: tabrig=u", ".join(rights)
if rights!=[]: print """""" % (wiki[2].replace("http://", "https://"), wiki[0], tabrig)
except Exception as e:
print e;
db.close()
print """
"""
print """