Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php namespace and mysql and ice binding PR #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions authenticator/mumble-sso-auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
import MySQLdb, ConfigParser

import Ice
Ice.loadSlice('/usr/share/slice/Murmur.ice')
#Ice.loadSlice('/usr/share/slice/Murmur.ice')

Ice.loadSlice("--all -I/usr/share/Ice-3.5.1/slice/ /usr/share/slice/Murmur.ice")

# ^ Sometimes the import of ice files fail. Try enforce an include path like that:
# Ice.loadSlice("--all -I/usr/share/Ice-3.5.1/slice/ /usr/share/slice/Murmur.ice")

import Murmur

# -------------------------------------------------------------------------------
Expand Down Expand Up @@ -94,7 +98,7 @@ def authenticate(self, name, pw, certificates, certhash, cerstrong, out_newname)
# ---- Check Bans

c = db.cursor(MySQLdb.cursors.DictCursor)
c.execute("SELECT * FROM ban WHERE filter = %s", ('alliance-' + str(alliance_id)))
c.execute("SELECT * FROM ban WHERE filter = %s", ('alliance-' + str(alliance_id),))
row = c.fetchone()
c.close()

Expand All @@ -103,7 +107,7 @@ def authenticate(self, name, pw, certificates, certhash, cerstrong, out_newname)
return (-1, None, None)

c = db.cursor(MySQLdb.cursors.DictCursor)
c.execute("SELECT * FROM ban WHERE filter = %s", ('corporation-' + str(corporation_id)))
c.execute("SELECT * FROM ban WHERE filter = %s", ('corporation-' + str(corporation_id),))
row = c.fetchone()
c.close()

Expand All @@ -112,7 +116,7 @@ def authenticate(self, name, pw, certificates, certhash, cerstrong, out_newname)
return (-1, None, None)

c = db.cursor(MySQLdb.cursors.DictCursor)
c.execute("SELECT * FROM ban WHERE filter = %s", ('character-' + str(character_id)))
c.execute("SELECT * FROM ban WHERE filter = %s", ('character-' + str(character_id),))
row = c.fetchone()
c.close()

Expand All @@ -123,17 +127,17 @@ def authenticate(self, name, pw, certificates, certhash, cerstrong, out_newname)
# ---- Retrieve tickers

c = db.cursor(MySQLdb.cursors.DictCursor)
c.execute("SELECT * FROM ticker WHERE filter = %s", ('alliance-' + str(alliance_id)))
c.execute("SELECT * FROM ticker WHERE filter = %s", ('alliance-' + str(alliance_id),))
rowa = c.fetchone()
c.close()

c = db.cursor(MySQLdb.cursors.DictCursor)
c.execute("SELECT * FROM ticker WHERE filter = %s", ('corporation-' + str(corporation_id)))
c.execute("SELECT * FROM ticker WHERE filter = %s", ('corporation-' + str(corporation_id),))
rowc = c.fetchone()
c.close()

ticker_alliance = '-----' if not rowa else rowa['text'];
ticker_corporation = '-----' if not rowc else rowc['text'];
ticker_alliance = '' if not rowa else rowa['text'];
ticker_corporation = '' if not rowc else rowc['text'];

if restrict_access_by_ticker == '1' and not (rowa or rowc):
print("Fail: {0} access requires one known ticker: {1} {2} {3} / {4} {5} {6}").format(name, corporation_id, ticker_corporation, corporation_name, alliance_id, ticker_alliance, alliance_name)
Expand All @@ -155,7 +159,7 @@ def authenticate(self, name, pw, certificates, certhash, cerstrong, out_newname)
return (character_id, nick, groups)

except Exception, e:
print("Fail: {0}".format(e))
print("EX-Fail: {0}".format(e))
return (-1, None, None)
finally:
if db:
Expand Down Expand Up @@ -220,7 +224,7 @@ def setTexture(self, id, texture, current = None):
if(server.id() != server_id):
continue

print("Binding to server: {0} {1}".format(id, server))
print("Binding to server #{0}: {1}".format(server_id, server))
serverR = Murmur.ServerUpdatingAuthenticatorPrx.uncheckedCast(adapter.addWithUUID(ServerAuthenticatorI(server, adapter)))
server.setAuthenticator(serverR)
break
Expand Down
2 changes: 1 addition & 1 deletion webroot/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function sso_update() {
$_SESSION['error_message'] = 'Failed to retrieve character details.';
return false;
}
$apiInfo = new SimpleXMLElement($result);
$apiInfo = new \SimpleXMLElement($result);
$row = $apiInfo->result->rowset->row->attributes();

$character_name = (string)$row->characterName;
Expand Down