Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
afbb262
Initial directory structure.
Oct 11, 2008
6285a11
Checking in basic set of files, generated from autoproject.
Oct 13, 2008
7eba156
Basic set of classes.
Oct 13, 2008
7fd308b
ChangeLog update: PhpbbPassword works now.
Oct 13, 2008
4674f26
Updated project name in comments.
Oct 14, 2008
55beb73
Updated comments, code cleanup in various places.
Oct 14, 2008
9893ddf
Fixed a bug when password is provided as unicode.
Nov 22, 2008
cc82d74
- Fixed views
Nov 24, 2008
3fa1a79
Added a TODO file.
Nov 24, 2008
914c1dd
- Added admin site code
Nov 27, 2008
47af16a
Adding admin interface file.
Nov 27, 2008
cb8e463
Better RSS feeds.
Nov 28, 2008
739e900
Updated admin interface and models.
Nov 29, 2008
11e52b8
Bugfix: added loading of i18n tags to templates.
Nov 29, 2008
175cba3
- Added license note to admin.py
Nov 30, 2008
b3c75f9
- Renamed classes Forum* to Phpbb*.
Nov 30, 2008
9ceb18a
Added localization files with some polish translations.
Nov 30, 2008
76901e9
Better ordering of topics in forum index.
Nov 30, 2008
8981e45
Updated links to forum posts.
Dec 2, 2008
675aa10
Added translation for 'topics'.
Dec 5, 2008
c243b9e
- Updated sitemaps
Dec 9, 2008
5cdff45
Removing 'changefreq' and 'priority' from sitemap.
Dec 16, 2008
0301a92
- Added translation for unanswered topics
Dec 16, 2008
aa0cc0b
Added a random tool to fix MySQL encoding.
Dec 26, 2008
4d99b8c
Removed some Polish from forum templates.
Feb 26, 2009
dd5a996
Model updates.
May 31, 2009
9ce13fc
Add a comment about stupid forum exclusions.
Feb 3, 2012
942cf4e
use a list of blocked forums
Feb 3, 2012
32fe065
do not think we are part of django.contrib; add a comment about missi…
Feb 3, 2012
1a7a420
A bugfix for an import statement and class reference
Feb 3, 2012
003bbf5
Merge remote-tracking branch 'remotes/github/master'
automaciej Feb 3, 2012
604dbcf
Added missed merges.
automaciej Feb 3, 2012
187fcf6
django.contrib.phpbb -> phpbb
mkoloberdin Sep 9, 2011
5c8c77d
Added settings.py, PHPBB_TABLE_PREFIX option
mkoloberdin Sep 9, 2011
1a9bd18
Added setup.py
mkoloberdin Jul 24, 2012
65c08bc
Merge my changes (1, 2, 3)
mkoloberdin Jul 25, 2012
9909d8b
Add a comment about stupid forum exclusions.
Feb 3, 2012
18d2e22
use a list of blocked forums
Feb 3, 2012
4b1b7a8
do not think we are part of django.contrib; add a comment about missi…
Feb 3, 2012
cb0382c
A bugfix for an import statement and class reference
Feb 3, 2012
763267a
Hardcoded BLOCKED_FORUMS -> settings.PHPBB_BLOCKED_FORUMS
mkoloberdin Jul 25, 2012
fc89a2f
user.is_staff = False
mkoloberdin Jul 25, 2012
ef72152
Don't hardcode e.g. blocked forums, use settings
automaciej Jul 26, 2012
df41f66
Add setup.py
automaciej Jul 26, 2012
48035d0
Merge branch 'master' of https://github.com/mkoloberdin/django-phpbb
automaciej Jul 26, 2012
a6eac5c
Rename password_unittest.py to password_test.py
automaciej May 21, 2013
7c00212
README files update
automaciej May 22, 2013
1672b80
Documentation updates.
automaciej May 22, 2013
dfe0388
Rename the default location in url.py.
automaciej May 24, 2013
dca8764
Site-specific updates to views and templates.
automaciej May 25, 2013
58cbe20
Rename bbcode_unittest.py to bbcode_test.py
automaciej May 25, 2013
f2fd77c
Make the unit test files executable.
automaciej May 25, 2013
25f1dc6
Include the forum ID in the external link.
automaciej May 25, 2013
dce7d89
Include the link to the main forum in archive tmpl
automaciej May 25, 2013
3e1610a
Removed site-specific files.
automaciej May 25, 2013
0aa8930
Provide an example URLs configuration.
automaciej May 25, 2013
bccf66b
url.py fix
automaciej May 25, 2013
7b2064f
Cleanup, mostly whitespace fixes.
automaciej May 25, 2013
1824240
Move common querysets to a shared module.
automaciej May 25, 2013
7be99fd
Move common querysets to a shared module.
automaciej May 25, 2013
e59ed7f
Ditch own bbcode parser, use postmarkup.
automaciej May 26, 2013
858adc0
Update to Django 1.6
automaciej Jan 4, 2015
891b622
Use permanent redirects.
automaciej Jan 4, 2015
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Maciej Bliziński <[email protected]>
Olivier Le Thanh Duong <[email protected]>
Empty file removed NEWS
Empty file.
24 changes: 0 additions & 24 deletions README

This file was deleted.

111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---------------------------------------
django-phpbb - Django-PhpBB integration
---------------------------------------

In case of django-phpbb, using it means that when you're coding a Django
application, you have a set of classes and functions at your disposal, providing
a glue between phpBB3 and Django.

## Authentication ##

### A prerequisite: Django authentication ###

First, prerequisites. Make sure your [Django
authentication](http://docs.djangoproject.com/en/dev/topics/auth/#topics-auth)
is working.

If your Django website uses authentication already, you probably have the
following lines in your `urls.py`.

(r'^accounts/login/$', 'django.contrib.auth.views.login', ),
(r'^accounts/logout/$', 'django.contrib.auth.views.logout', ),

If there are no such lines in your `urls.py`, your application probably doesn't
use authentication. Consult the Django documentation for instructions to get
your authentication to work.

## PYTHONPATH ##

The django-phpbb directory must be in PYTHONPATH (or sys.path).

## Adding phpbb3 authentication backend ##

Edit your `settings.py` and make sure the following lines are present:

MIDDLEWARE_CLASSES = (
...
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
...
"django.core.context_processors.auth",
)
INSTALLED_APPS = (
'django.contrib.auth',
...
'phpbb',
)
AUTHENTICATION_BACKENDS = (
'phpbb.backends.PhpbbBackend',
'django.contrib.auth.backends.ModelBackend',
)


Once you've done that, the authentication backend should be enabled and users
should be able to log in using not only Django passwords, but also passwords
checked against the phpbb3 database.

## phpBB3 classes ##

You can access phpBB3 forum objects using provided classes. Look up the source
code to see the details of the classes. (Sorry for not providing any better
documentation at this time.)

Fire up Django shell and try using django-phpbb classes:

./manage.py shell
from django.contrib.phpbb import models as p3m
forum = p3m.PhpbbForum.objects.get(pk=1)
dir(forum)
forum.forum_name
forum.phpbbtopic_set.all()[:5]

## Predefined views ##

You need to have a `base.html` template that django-phpbb's template expect to
extend.

To enable predefined views, add this line to your `urls.py`:

(r'^forum/', include('phpbb.urls')),

Also, make django-phpbb templates available:

TEMPLATE_DIRS = (
...
"/some-directory/django-phpbb/phpbb/templates",
)

_The views currently contain bits and pieces of the original website they've
been cut from. The views are going to be reworked. Consider them more as a guide
to see how you can implement your own forum browsing rather than a complete
solution._

License
-------

Copyright (C) 2008 Maciej Bliziński <[email protected]>
Copyright (C) 2010 Olivier Le Thanh Duong <[email protected]>

django-phpbb is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ To do list:
- Option 1: use http://code.google.com/p/postmarkup/
- Issues: Doesn't support integration with a real phpBB database
- Option 2: port original bbcode[1].
- Add support for access control, at the very least determining which forums
should be publicly visible and which shouldn't.

[1] http://code.phpbb.com/repositories/entry/5/trunk/phpBB/includes/bbcode.php
http://code.phpbb.com/repositories/entry/5/trunk/phpBB/includes/message_parser.php
2 changes: 1 addition & 1 deletion phpbb/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PhpbbAclRoleOptionAdmin(admin.ModelAdmin):
# 'auth_option',
# 'auth_global')
admin.site.register(pm.PhpbbAclOption, PhpbbAclRoleOptionAdmin)
#admin.site.register(pm.PhpbbAclRoleDatum)
# admin.site.register(pm.PhpbbAclRoleDatum)
# Composite keys support needed
# admin.site.register(pm.PhpbbAclGroup)
admin.site.register(pm.PhpbbGroup)
5 changes: 2 additions & 3 deletions phpbb/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PhpbbBackend:

def authenticate(self, username=None, password=None):
"""Authenticate user against phpBB3 database.

Check if the user exists in Django users. If not, create it.
Then authenticate."""
logging.debug("PhpbbBackend::authenticate()")
Expand Down Expand Up @@ -67,7 +67,7 @@ def authenticate(self, username=None, password=None):
logging.info("Creating new Django user '%s'" % username)
if username:
user = User(username = username, password = "")
user.is_staff = True
user.is_staff = False
user.is_superuser = False

user.email = phpbb_user.user_email
Expand Down Expand Up @@ -117,4 +117,3 @@ def has_module_perms(self, user_obj, app_label):
if perm[:perm.index('.')] == app_label:
return True
return False

4 changes: 2 additions & 2 deletions phpbb/bbcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BitField(object):
http://code.phpbb.com/repositories/entry/5/trunk/phpBB/includes/functions_content.php"""
def __init__(self, bitfield=""):
self.data = bitfield.decode("base64")

def get(self, n):
byte = n >> 3
if len(self.data) >= byte + 1:
Expand Down Expand Up @@ -118,7 +118,7 @@ class BbCode(object):
- user is passed to the constructor (on original code, a global variable is
used)
"""

def __init__(self, user, bitfield=""):
self.user = user
if bitfield:
Expand Down
13 changes: 7 additions & 6 deletions phpbb/bbcode_unittest.py → phpbb/bbcode_test.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of django-phpbb, integration between Django and phpBB
# Copyright (C) 2007-2008 Maciej Bliziński
Expand Down Expand Up @@ -57,28 +58,28 @@ def setUp(self):

def testGet0(self):
self.assertEquals(self.b1.get(0), 0)

def testGet3(self):
self.assertEquals(self.b1.get(3), 16)

def testGet4(self):
self.assertEquals(self.b1.get(4), 0)

def testSet0(self):
self.b1.set(0)
self.assertEquals(self.b1.get(0), 128)

def testSet1(self):
self.b1.set(0)
self.assertEquals(self.b1.get_bin(), "10010000")

def testGetBin(self):
self.assertEquals(self.b1.get_bin(), "00010000")

def testGetAllSet(self):
self.b1.set(7)
self.assertEquals(self.b1.get_all_set(), [3, 7])

def testGetBlob(self):
self.assertEquals(self.b1.get_blob(), '\x10')

Expand All @@ -92,7 +93,7 @@ def testMerge(self):
self.assertEquals(b1.get(0), 128)
self.assertEquals(b1.get(1), 64)
del b1, b2

def tearDown(self):
del self.b1

Expand Down
13 changes: 9 additions & 4 deletions phpbb/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@
# Boston, MA 02110-1301 USA

from django.utils.translation import gettext_lazy as _
from django.contrib.syndication.feeds import Feed
from django.contrib.syndication.views import Feed
from models import PhpbbPost
from phpbb import querysets

class LatestPhpbbPosts(Feed):
"""Returns the newest forum posts.

FIXME: Show only public forums. Needs composite primary keys, currently not
supported in Django.

"""
title = u"Forum"
link = "/forum/"
description = _("Newest posts on the forum.")
def items(self):
return (PhpbbPost.objects.order_by('-post_time_int').
exclude(topic__forum__forum_id=15).
exclude(topic__forum__forum_id=6)[:20])
return querysets.postqs.order_by('-post_time_int')[:20]
def item_link(self, obj):
return obj.get_external_url()
Loading