summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@gentoo.org>2006-02-07 07:49:02 +0000
committerGunnar Wrobel <wrobel@gentoo.org>2006-02-07 07:49:02 +0000
commit0555597c28fd4610b7464fb9a7ccee750913c94d (patch)
tree4c6e49ed918506ed7f93fd3553b6805b7023f7fb /www-apps
parentFixed digest to modified package (diff)
downloadoverlay-0555597c28fd4610b7464fb9a7ccee750913c94d.tar.gz
overlay-0555597c28fd4610b7464fb9a7ccee750913c94d.tar.bz2
overlay-0555597c28fd4610b7464fb9a7ccee750913c94d.zip
Upgraded contact plugin. Renamed ebuild 1.3
svn path=/stable/; revision=653
Diffstat (limited to 'www-apps')
-rw-r--r--www-apps/pyblosxom-plugins/Manifest14
-rw-r--r--www-apps/pyblosxom-plugins/files/contact.py176
-rw-r--r--www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3 (renamed from www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.2.1)0
-rw-r--r--www-apps/pyblosxom-plugins/pyblosxom-plugins-1.3.ebuild (renamed from www-apps/pyblosxom-plugins/pyblosxom-plugins-1.2.1.ebuild)0
4 files changed, 45 insertions, 145 deletions
diff --git a/www-apps/pyblosxom-plugins/Manifest b/www-apps/pyblosxom-plugins/Manifest
index 147c00b..e80fc38 100644
--- a/www-apps/pyblosxom-plugins/Manifest
+++ b/www-apps/pyblosxom-plugins/Manifest
@@ -1,15 +1,15 @@
-MD5 de6a2a634cd8474fc643ee50d5cb485b pyblosxom-plugins-1.2.1.ebuild 966
-MD5 3ae49161534556018d226f514ef68195 files/hardcodedates.py 2036
MD5 3d89ed013ed90e7afff11e8e3a57ebf4 files/comments.py 25302
-MD5 548dee82839a94879bb3f7eab221b5cf files/contact.py 11534
+MD5 312ea07fd22be59502a491769dbe4d24 files/contact.py 8323
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-pyblosxom-plugins-1.3 0
MD5 2b01a7bfae3b1e961b9c3e006d0c3f06 files/getstamps.py 1330
+MD5 3ae49161534556018d226f514ef68195 files/hardcodedates.py 2036
MD5 13427211867bdf6231ec8d9ab1a585cc files/logrequest.py 2248
-MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-pyblosxom-plugins-1.2.1 0
-MD5 d30d5cf286b0a3bfb42f1af7029854fc files/pycategories.py 7740
MD5 3a489e93c5a569beaff1aeba02b6dc20 files/nospam.py 6364
-MD5 78f0af45b70b019c7ef0236175db6f30 files/rss2renderer.py 8777
+MD5 d30d5cf286b0a3bfb42f1af7029854fc files/pycategories.py 7740
MD5 dad8289c1e561ffec042f661873e4ed4 files/pyguest.py 10951
-MD5 1bd704ad5a8e5fd621b84a6ab2ec9d32 files/wbglast10summary.py.html 4862
+MD5 78f0af45b70b019c7ef0236175db6f30 files/rss2renderer.py 8777
MD5 551595972432681869214de6b21dc0aa files/rss2renderer.py.html 41245
MD5 9d08ee37ee648e2e1541b51333db0fe6 files/session.py 11214
MD5 2fcbddb5246ec1f79ec0557cbe56bdad files/wbglast10summary.py 1094
+MD5 1bd704ad5a8e5fd621b84a6ab2ec9d32 files/wbglast10summary.py.html 4862
+MD5 de6a2a634cd8474fc643ee50d5cb485b pyblosxom-plugins-1.3.ebuild 966
diff --git a/www-apps/pyblosxom-plugins/files/contact.py b/www-apps/pyblosxom-plugins/files/contact.py
index d3fcf38..993fe5c 100644
--- a/www-apps/pyblosxom-plugins/files/contact.py
+++ b/www-apps/pyblosxom-plugins/files/contact.py
@@ -31,7 +31,7 @@ __license__ = "GPL 2+"
# Python imports
-import urlparse
+
# Pyblosxom imports
from Pyblosxom.renderers.blosxom import Renderer
@@ -46,143 +46,39 @@ MESSAGE_KEY = "contact_error_message"
_form_fields = ['name', 'email', 'subject', 'message']
_default_template = """
+<style type="text/css">
+<!--
+#contactForm label {
+ float: left;
+ width: 25%;
+ padding-top: 3px;
+ margin-bottom: 5px;
+ }
+#contactForm input, textarea {
+ width: 70%;
+ margin-right: 10px;
+ margin-bottom: 5px;
+ }
+-->
+</style>
<div>
-<h2>Contact me</h2>
+<h3>Contact me</h3>
<div style="display:block;">$contact_error_message</div>
<form name="contactForm" id="contactForm" method="post" action="$base_url$contact_urltrigger">
-<div class="contactLine">
- <div class="contactLabel">
- <label class="contactLine" for="name" title="Your name">Name</label>
- </div>
- <input type="text" name="name" id="name" value="$contact_name" /><br />
-</div>
-<div class="contactLine">
- <div class="contactLabel">
- <label class="contactLine" for="email" title="Your email address">Email</label>
- </div>
- <input type="text" name="email" id="email" value="$contact_email" /><br />
-</div>
-<div class="contactLine">
- <div class="contactLabel">
- <label class="contactLine" for="subject" title="Subject of your message">Subject</label>
- </div>
- <input class="contactLine" type="text" name="subject" id="subject" value="$contact_subject" /><br />
-</div>
-<div class="contactText">
- <div class="contactLabel">
- <label class="contactText" for="message" title="Your message">Message</label>
- </div>
- <textarea name="message" id="message" style="height:150px;">$contact_message</textarea><br />
-</div>
-<div class="contactSubmit">
- <div class="contactButton">
- <input class="contactSubmit" type="submit" value="Send" style="width:auto; margin-right:0;" />
- </div>
- <div class="contactButton">
- <input class="contactSubmit" type="reset" value="Reset" style="width:auto; margin-right:0;" />
- </div>
-</div>
+<label for="name" title="Your name">Name</label>
+<input type="text" name="name" id="name" value="$contact_name" /><br />
+<label for="email" title="Your email address">Email</label>
+<input type="text" name="email" id="email" value="$contact_email" /><br />
+<label for="subject" title="Subject of your message">Subject</label>
+<input type="text" name="subject" id="subject" value="$contact_subject" /><br />
+<label for="message" title="Your message">Message</label>
+<textarea name="message" id="message" style="height:150px;">$contact_message</textarea><br />
+<input type="submit" value="Send" style="width:auto; margin-right:0;" />
+<input type="reset" value="Reset" style="width:auto; margin-right:0;" />
</form>
</div>
"""
-################################################################################
-##
-## Helper functions
-##
-################################################################################
-
-rfc822_specials = '()<>@,;:\\"[]'
-
-def isAddressValid(addr):
- '''
- Taken from
-
- http://www.secureprogramming.com/?action=view&feature=recipes&recipeid=1
-
- Posted by Matt Messier on Tue, Sep 02, 2003 (06:19 PM) GMT
-
- >>> isAddressValid('djfhdfh')
- 0
- >>> isAddressValid('djfhdfh@test.com')
- 8
- >>> isAddressValid('dj@fhdfh@test.com')
- 0
- >>> isAddressValid('dj\@fhdfh@test.com')
- 0
- >>> isAddressValid('dj"@"fhdfh@test.com')
- 0
- >>> isAddressValid('dj" "fhdfh@test.com')
- 0
- >>> isAddressValid('dj\" \"fhdfh@test.com')
- 0
- >>> isAddressValid('dj." ".fhdfh@test.com')
- 13
- >>> isAddressValid('dj."@ ".fhdfh@test.com')
- 14
- >>> isAddressValid('dj."@<> ".fhdfh@test.com')
- 16
- >>> isAddressValid('dj."@<>ü ".fhdfh@test.com')
- 0
- >>> isAddressValid('dj<>fhdfh@test.com')
- 0
- >>> isAddressValid('dj\<\>fhdfh@test.com')
- 0
- >>> isAddressValid('dj\ fhdfh@test.com')
- 0
- >>> isAddressValid('dj\\ fhdfh@test.com')
- 0
- >>> isAddressValid('djfhdfh@test.com.de')
- 8
- >>> isAddressValid('djfhdfh@test.co<m.de')
- 0
- '''
- # Ported from Recipe 3.9 in Secure Programming Cookbook for C and C++ by
- # John Viega and Matt Messier (O'Reilly 2003)
-
- # First we validate the name portion (name@domain)
- c = 0
- while c < len(addr):
- if addr[c] == '"' and (not c or addr[c - 1] == '.' or addr[c - 1] == '"'):
- c = c + 1
- while c < len(addr):
- if addr[c] == '"':
- c = c + 1
- break
- if addr[c] == '\\' and addr[c + 1] == ' ':
- c = c + 2
- continue
- if ord(addr[c]) < 32 or ord(addr[c]) >= 127: return 0
- c = c + 1
- else: return 0
- if addr[c] == '@': break
- if addr[c] != '.': return 0
- c = c + 1
- continue
- if addr[c] == '@': break
- if ord(addr[c]) <= 32 or ord(addr[c]) >= 127: return 0
- if addr[c] in rfc822_specials: return 0
- c = c + 1
- if not c or addr[c - 1] == '.': return 0
-
- # Next we validate the domain portion (name@domain)
- domain = c = c + 1
- if domain >= len(addr): return 0
- count = 0
- while c < len(addr):
- if addr[c] == '.':
- if c == domain or addr[c - 1] == '.': return 0
- count = count + 1
- if ord(addr[c]) <= 32 or ord(addr[c]) >= 127: return 0
- if addr[c] in rfc822_specials: return 0
- c = c + 1
-
- ## The final return statement was modified to return the split point
- ## (position of @) so that the email can split in its two subsections.
- if count >= 1:
- return domain
-
-
def verify_installation(request):
config = request.getConfiguration()
retval = 1
@@ -206,16 +102,24 @@ class ContactRenderer(Renderer):
def render(self, header=1):
config = self._request.getConfiguration()
data = self._request.getData()
+ http = self._request.getHttp()
- # root_datadir is normaly set after the cb_pathinfo callback.
+ # path_info and root_datadir are normaly set after the cb_pathinfo callback.
# but if a plugin implements cb_handle (as this one does),
# cb_pathinfo is never called.
# if root_datadir is not set and flavourdir is not set in config.py
# an exception is thrown in BlosxomRenderer._getFlavour.
# so set root_datadir here explicitly to prevent that.
+ if not 'path_info' in data:
+ if http.get('PATH_INFO', ''):
+ path_info = http['PATH_INFO'].split('/')
+ path_info = [x for x in path_info if x != '']
+ data['path_info'] = list(path_info)
+
if not 'root_datadir' in data:
data['root_datadir'] = config['datadir']
+
# initialize flavour
self.flavour = self._getFlavour(data.get('flavour', 'html'))
data['content-type'] = self.flavour['content_type'].strip()
@@ -263,7 +167,7 @@ def _handle_post(request):
error_messages = []
if not 'HTTP_REFERER' in http or \
- not http['HTTP_REFERER'].startswith('://'.join(urlparse.urlsplit(config['base_url'])[0:1])):
+ not http['HTTP_REFERER'].startswith(config['base_url']):
data[MESSAGE_KEY] = "Posting from foreign hosts not allowed.<br />\nUse the form below to send your message."
return
@@ -277,10 +181,6 @@ def _handle_post(request):
parser.feed(form[field].value)
email[field] = parser.gettext()
- if 'email' in email.keys() and not isAddressValid(email['email']):
- error = True
- error_messages.append("Invalid email address '%s'. Cannot deliver your message!" % email['email'])
-
if error:
data[MESSAGE_KEY] = "<br />\n".join(error_messages)
_remember_email(email, data)
@@ -380,7 +280,6 @@ def cb_handle(args):
def cb_end(args):
- # cleanup
request = args['request']
data = request.getData()
if INIT_KEY in data:
@@ -388,3 +287,4 @@ def cb_end(args):
if MESSAGE_KEY in data:
del data[MESSAGE_KEY]
+
diff --git a/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.2.1 b/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3
index e69de29..e69de29 100644
--- a/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.2.1
+++ b/www-apps/pyblosxom-plugins/files/digest-pyblosxom-plugins-1.3
diff --git a/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.2.1.ebuild b/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.3.ebuild
index 820a907..820a907 100644
--- a/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.2.1.ebuild
+++ b/www-apps/pyblosxom-plugins/pyblosxom-plugins-1.3.ebuild