[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r16603: {check} add showLogo(), now when a user passes ?logo= with any value (check/trunk/cgi-bin)
Author: ioerror
Date: 2008-08-19 21:37:41 -0400 (Tue, 19 Aug 2008)
New Revision: 16603
Modified:
check/trunk/cgi-bin/TorCheck.py
Log:
add showLogo(), now when a user passes ?logo= with any value, the logo is hidden.
Examples:
TorCheck.py?logo=0 # hidden
TorCheck.py # shows Tor logo
It would be fine to pass something explicit such as hide:
TorCheck.py?logo=hide
Modified: check/trunk/cgi-bin/TorCheck.py
===================================================================
--- check/trunk/cgi-bin/TorCheck.py 2008-08-19 23:04:19 UTC (rev 16602)
+++ check/trunk/cgi-bin/TorCheck.py 2008-08-20 01:37:41 UTC (rev 16603)
@@ -19,7 +19,7 @@
"""
__program__ = 'TorCheck.py'
-__version__ = '20080529.02'
+__version__ = '20080819.01'
__url__ = 'https://tor-svn.freehaven.net/svn/check/'
__author__ = 'Jacob Appelbaum <jacob@xxxxxxxxxxxxx>'
__copyright__ = 'Copyright (c) 2008, Jacob Appelbaum'
@@ -125,6 +125,16 @@
# Fall back to default
return default_locale
+def showLogo(req):
+ # By default, we'll show a logo
+ show_logo = True
+ formSubmission=util.FieldStorage(req)
+ hide_logo = formSubmission.getfirst("logo", None)
+ # hide_logo isn't cleaned - do not use it for anything else
+ if hide_logo:
+ return False
+ return show_logo
+
def parseLang(req):
user_supplied_lang = None
formSubmission=util.FieldStorage(req)
@@ -184,13 +194,15 @@
req.write('<body>\n')
parseLang(req)
+ hideLogo = showLogo(req)
req.write('<center>\n')
if UsingTor == 0:
req.write('\n')
- req.write('<img alt="' + _("Congratulations. You are using Tor.") + \
- '" src="https://check.torproject.org/images/tor-on.png">\n<br>')
+ if hideLogo:
+ req.write('<img alt="' + _("Congratulations. You are using Tor.") + \
+ '" src="https://check.torproject.org/images/tor-on.png">\n<br>')
req.write('<h1 style="color: #0A0">\n')
req.write(_('Congratulations. You are using Tor.'))
req.write('<br>\n<br>\n')
@@ -201,8 +213,9 @@
# This is the case where we have an NXDOMAIN and they aren't using Tor
elif UsingTor == 1:
req.write('\n')
- req.write('<img alt="' + _("Sorry. You are not using Tor.") + '" '\
- 'src="https://check.torproject.org/images/tor-off.png">\n<br>')
+ if hideLogo:
+ req.write('<img alt="' + _("Sorry. You are not using Tor.") + '" '\
+ 'src="https://check.torproject.org/images/tor-off.png">\n<br>')
req.write('<h1 style="color: #A00">')
req.write(_('Sorry. You are not using Tor.'))
req.write('<br>\n<br>\n')