Ejemplo n.º 1
0
cookie_hash = mew.getCookieHash( os.environ )

if ( ("userId" not in cookie_hash) or ("sessionId" not in cookie_hash)  or
     (mew.authenticateSession( cookie_hash["userId"], cookie_hash["sessionId"] ) == 0) ):
  print "Location:login"
  print
  sys.exit(0)

message,messageType = mew.processCookieMessage( cookie, cookie_hash )

userId = cookie_hash["userId"]
userData = mew.getUser( userId )
userName = userData["userName"]

template = mew.slurp_file("template/libraries.html")
tmp_str = template.replace("<!--USER-->", userName )
tmp_str = tmp_str.replace("<!--USERID-->", userId )
tmp_str = tmp_str.replace( "<!--LEFT-->", mew.slurp_file("template/left_template.html") )
tmp_str = tmp_str.replace( "<!--USERINDICATOR-->", mew.userIndicatorString( userId, userName ) )

analytics = mew.slurp_file("template/analytics_template.html")
tmp_str = tmp_str.replace( "<!--ANALYTICS-->", analytics)

tmp_str = mew.replaceTemplateMessage( tmp_str, message, messageType )

print "Content-Type: text/html;charset=utf-8"
print cookie.output()
print
print tmp_str

            cookie_hash["userId"], cookie_hash["sessionId"]) == 0)):
    print "Location:login"
    print
    sys.exit(0)

message, messageType = mew.processCookieMessage(cookie, cookie_hash)

userId = cookie_hash["userId"]
userData = mew.getUser(userId)
userName = userData["userName"]

mew.log("cp")

template = mew.slurp_file("template/usersettings.html")
tmp_str = template.replace("<!--USER-->", userName)
tmp_str = tmp_str.replace("<!--USERID-->", userId)
tmp_str = tmp_str.replace("<!--LEFT-->",
                          mew.slurp_file("template/left_template.html"))
tmp_str = tmp_str.replace("<!--USERINDICATOR-->",
                          mew.userIndicatorString(userId, userName))

analytics = mew.slurp_file("template/analytics_template.html")
tmp_str = tmp_str.replace("<!--ANALYTICS-->", analytics)

tmp_str = mew.replaceTemplateMessage(tmp_str, message, messageType)

print "Content-Type: text/html;charset=utf-8"
print cookie.output()
print
print tmp_str
Ejemplo n.º 3
0
if (("userId" in cookie_hash)
        and ("sessionId" in cookie_hash) and (mew.authenticateSession(
            cookie_hash["userId"], cookie_hash["sessionId"]) != 0)):
    loggedInFlag = True

msg, msgType = mew.processCookieMessage(cookie, cookie_hash)

template = mew.slurp_file("template/signupemailfail.html")
tmp_str = mew.replaceTemplateMessage(template, msg, "nominal")

if loggedInFlag:
    userData = mew.getUser(cookie_hash["userId"])
    userName = userData["userName"]
    tmp_str = tmp_str.replace(
        "<!--USERINDICATOR-->",
        mew.userIndicatorString(cookie_hash["userId"], userName))

    if userData["type"] == "anonymous":
        tmp_str = tmp_str.replace(
            "<!--LEFT-->",
            mew.slurp_file("template/left_template_anonymous.html"))
    else:
        tmp_str = tmp_str.replace(
            "<!--LEFT-->", mew.slurp_file("template/left_template.html"))

else:
    a = "<a href='login'>[Login]</a> &nbsp; &nbsp; &nbsp; &nbsp; Signup"
    tmp_str = tmp_str.replace("<!--USERINDICATOR-->", a)
    tmp_str = tmp_str.replace(
        "<!--LEFT-->", mew.slurp_file("template/left_template_world.html"))