IPB

You are currently browsing the archive for the IPB category.

Originally posted at IPS:
One of the biggest discussions we had during Invision Power Board 3.0’s planning was whether or not to drop support for PHP 4 and require a minimum of PHP 5. The advantages of using only PHP 5 were numerous and we really felt like we could increase security and efficiency by taking advantage of the new PHP 5 features. This decision became much easier when we learned that PHP 4 was no longer being developed.

To really see the benefit of using PHP 5, one must first consider how Invision Power Board’s new framework is made possible by PHP 5.

Although Invision Power Board 1 and 2 were loosely based on the ‘front controller’ design pattern, it had no real framework to hang the code on. The closest it had to one was the ‘ipsclass’ super-class.

‘ipsclass’ was a convenient method of transporting various classes and functions around Invision Power Board. Convenient, but not ideal. One had to pass this ’super-class’ from class to class forcing PHP 4 to use a reference (and being severely punished when forgetting!). This super-class contained almost all the ‘core’ functionality of Invision Power Board. Member, input and database objects were attached along with numerous other classes and functions. None of which was ordered in any logical format.

We have recoded Invision Power Board 3.0’s framework from the ground up. We have done away with the ‘ipsclass’ super-class and employed the ‘Controller -> Command -> View’ pattern. This allows us to quickly add new code and to allow fast refactoring of our existing code. This pattern is built upon the ‘IPS Registry’. This is a singleton class which maintains interfaces to several other registry objects (database, request, settings and member). Each of these objects maintains a clear place within the registry. This allows us to pass core data through the different levels of our pattern. Other functions from ‘ipsclass’ are moved into singtons: “IPSLib”; disparate functions that do not belong elsewhere, “IPSText”; functions for parsing and cleaning text, “IPSCookie”; functions to handle cookie management and “IPSMember”; functions that deal with loading, saving and parsing members. This offers a clear structure with clear boundries for each singleton class. Being singletons, you do not need to pass or reference the class in other files.

Here’s an example:

IPB 2.3 Code
print $this->ipsclass->input['name'];
$value = $this->ipsclass->settings['board_name']
$id = $this->ipsclass->member['id'];
$this->ipsclass->input['f'] = 2;

print $this->ipsclass->get_cookie('foo');
$text = $this->ipsclass->txt_alphanumerical_clean( $text );
print $this->ipsclass->class_forums->build_info();

IPB 3.0 Code
print $this->request->getField('name');
$value = $this->settings->getSetting('board_name');
$id = $this->member->getProperty('member_id');
$this->request->setField( 'f', 2 );

print IPSCookie::get('foo');
$text = IPSText::alphanumerical_clean( $text );
print $this->registry->getClass('class_forums')->build_info();

It’s worth noting that we have also applied the ArrayAccess interface to the registry, so you may access them like so:
print $this->request['name'];
$this->settings['board_name'];

Although the code examples use $this->request, $this->member, etc, these are set up in a constructor. You would pass the IPS Registry singleton into the class. Here’s a typical constructor:
function __construct( ipsRegistry $registry )
{
$this->registry = $registry;
$this->member = $registry->member();
$this->request = $registry->request();
$this->settings = $registry->settings();
$this->DB = $registry->DB();
}

You could also access the ipsRegistry class directly, although this is strongly discouraged:
[code]print ipsRegistry::instance()->request()->getField(’name’);[/code]
PHP 5 offers a much better OOP (object orientated programming) environment where references are assigned automatically. You can also chain along functions, which we make great use of. This allows us to do some neat trickery, like so:

IPB 2.3 Code
$this->ipsclass->load_template('skin_boards');
print $this->ipsclass->compiled_templates['skin_boards']->board_index( $data );

IPB 3.0 Code
print $this->registry->getClass('output')->getTemplate('boards')->board_index($data);

You’ll note that you no longer have to implicitly load the template anymore. This is handled within the ‘getTemplate’ function if it’s not already loaded. This object is then returned for use to chain onto ‘board_index()’. This simple adjustment of code makes for less manual code and less room for error.

We are also making great use of PHP 5 abstract classes and interfaces to define extensible classes. This will make it much easier and clearer for others writing their own additions to Invision Power Board. Having a clear interface to work with will reduce errors in development and formalize how you may access Invision Power Boards class structures.

The ‘controller -> command’ structure is built so that you may add new modules and sections dynamically without the need to change a single line of code elsewhere in the script. Modification authors can just drop in new folders and Invision Power Board will run them when called correctly via a URL. The controller makes use of variables in a URL and safely loads a command file if a matching command file is located. For example: “appcomponent=core&module=global&section=login” is mapped to “applications/core/modules_public/global/login.php”. We make use of the Reflection class functions to ensure that any potential command file is a sub-class of the controller to prevent the risk of tampering.

We’ve barely scratched the surface, but it’s clear that Invision Power Board 3’s framework is very powerful and code-efficient. This is only made possible by the advancements in PHP 5 that we’ve taken full advantage of.

My Name Is IPB

I got this via Josh and I think it’s pretty cool.

One of our customers, TelevisionWithoutPity.com was recently mentioned in a My Name is Earl episode.

Television Without Pity has been lucky enough to have its fair share of “shout-outs” and references from TV shows but the one on this week’s My Name is Earl really takes the cake.

The writing staff really planned ahead on this one. The TWoP user “whojackie” — who has been a member on the TWoP forums since 2005 — appeared as a character on the show and made a reference to the posters on the TWoP forums. That alone would be cool enough but that’s not the whole story here.

Read the full story here.

Well, what a month.

It seems that just about every hacking group under the sun has been having a pop at Invision Power Board over the last few months.

I remember back in the good old days an email was sent to you informing of any potential vulnerability before it was made public allowing you to fix the problem and send out patches to your customers and users. Now that’s extremely rare and more often than not the exploit is automated via a perl or PHP script which is then distributed to all the underground hacking groups which is posted on their forums for any moronic script kiddie to download and take down soccor mom boards for their own amusement.

With the risk of sounding like a whiny computer nerd, it’s tough being a web programmer these days. The dangerous balance of features versus security is very tough to maintain. A small mistake in your regex can potentially allow shell access to your server and a badly formed SQL query can allow your admin sessions to be taken. We’re seeing stuff that simply wasn’t possible a few years back thanks to the changes and developments in PHP and MySQL. “UNION SELECT” allows queries to be joined making a missing INTVAL() another notch on a hackers mouse cord.

IPB has become a very high profile target. Our customers include some of the biggest brands in the world (AMD, Sony, EMI, Warner Bros, etc) so it’s an obvious target for hackers. Also, our code is sold as readable source and not compiled which allows everyone to see the inner workings and work out possible weaknesses.

Of course, the responsibility lays firmly at the feet of the developers
writing the code. It’s our job to make hacker’s lives as difficult as
possible and with that in mind, we’ve made some huge changes to the IPB
2.2.0 codebase. I don’t want to say too much other than every single
exploit type that IPB has suffered with recently will no longer be
possible. These changes have been made at the very core of the program so we’re not simply papering over the cracks.

Mac Format (UK) magazine reviewed Invision Power Board 2.1.5 for their June ‘06 issue and awards it 4.5 stars (out of 5).

There are several features that really make Invision Power Board 2 stand out from other pre-built forums which you’ll appreciate if problems occur. People may start leaving unwanted or libellous posts, which can lead the discussion away from the original subject or get you, as the administrator, in trouble. This is where the protective administrative features of the Invision Power Board win out over the bare bones forums every time.

Scanned Article (400k JPEG)

IPB, IPC and IPD

So far this week I’ve managed a little bit of everything.

The biggest achievement being adding the IP.Converge installer. Rikki designed and Josh wrote a fairly generic IPS installer framework which I’ve tweaked for IP.Converge. It’s a really nice system that will be used for IPB and IPD to give a familiar look and feel to our products.

I’ve adjusted it so that most of the database population is done via XML files to reduce the amount of “raw” SQL commands in an insert.php file. Manual inserts can be tricky when database schematics change, etc. IP.Converge only has one such manual insert SQL command which makes things much easier to maintain.

IPB 2.2 continues nicely. IP.Converge integration is totally finished and the new ACP in place. IP.Dynamic rolls on well, too. I’ve added a few “system” type tools to make maintenance easier. IP.Dynamic has certain ’system’ pages (log in form, registration form, etc) and these can now be updated from a single XML file.

Keep an eye out for some announcements next week.

IP.Converge Installer

Invision Power Board (IPB) 2.2 has been in spec form for a few months. We paused IPB 2.2 when we worked on IP.Converge. This wasn’t done for lack of manpower - quite contrary, we have four full time developers and two part time developers - it was done so that we could see how much needed to be changed to enabled IP.Converge.

Now that IP.Converge is due to go into beta testing stages this week, IPB 2.2 development has continued. Naturally, it’s already IP.Converge-ready and the log in modules framework has been extended to allow IP.Converve to be used without the need for special IPB-Converge hacks which makes the code nice and clean.

The first thing I wanted to do is update the IPB 2.2 ACP to use the new IPS style (Nexus, Dynamic, Converge). Although we don’t intended to radically change the front-end skin, we felt the ACP skin needed to be updated so that our products retain some continuity.

Here’s a screenshot of the IPB 2.2 ACP as it stands today.

Expect more IPB 2.2 news over the coming weeks.

So, the final piece of the IPB 2.1.0 puzzle has been dropped into place: the portal overhaul.

There are two major changes. One being that it’s now just another run-time module within the IPB framework. This means that there’s no separate index.php file for it and there’s no way for it to be run as a separate entity. This makes IPB -> IP.Dynamic integration much easier. For those who don’t wish to run IP.Dynamic but still want a front page in other folder other than their forum’s directory, then the supplied index.php file which contains a simple header redirect to the forum’s installation will suffice.

The other change is the removal of hard-coded features and the introduction of a simple plug-in system. Basically, you can now specifiy special tags which correspond with a particular portal plug in. A portal plug in is a run-time file and a configuration file. This means that blog owners will be able to show recently updated blogs on their portal and gallery owners random images and such - all without touching a line of code. It’s a simple case of “drop in and forget”. Mod authors can write their own modules to add functionality without needing to edit any IPB code.

Hurrah.

acp-portalplugins.jpg

It’s still early days, but here’s something I’ve thrown together this afternoon.

Originally, I was going to write a quick and dirty script to compare two ipb_template.xml files together and show a list of differences. I would re-format those differences and post them with a release announcement showing exactly which template bits had changed and which HTML bits had changed.

I then considered how useful this would be in a general sense. Wouldn’t it be nice if you could upload any ipb_template.xml file and have it compared to the current master HTML templates? Not only is this useful for just comparing changes between version releases, it’s also handy to generate a list of the actual HTML edits to your own custom skins for safe keeping.

This is the result. It’s fairly scrappy at the moment and the interface will be cleaned up as well as previous comparison results saved to the DB for hard reference.

This feature didn’t take too long to put together as I had already written a difference engine for IP.Dynamic - although the current difference engine won’t work for safe_mode enabled folks; something that will be working on as our adventure continues.

ACP Diff Overview (JPG)
ACP Diff View Bit (JPG)

[IPB 2.1] API

A party inside?
A persons IQ?

Nope. Application Programming Interface. This exciting term encapsulates the ability to interfere with a program without having intimate knowledge of the program’s code. Good idea, I say.

With this in mind, I’ve started work on IPB 2.1’s API. Now, fundamentally IPB has core classes, of which an API layer is wrapped around then and then another layer wrapped around that called ‘HTTP-API’. The HTTP-API wrapper will allow one to fire off commands via the wonders of POST or GET. When correctly configured, you’ll be able to update your member’s signature with a command as insanely easy as “httpapi.php?api=members&-save-signature=hax&id=32&apikey=hilariously
longkeyhere’. This further abstracts one from the realities of getting one’s hands dirty with nasty old PHP code.

However, before we get all carried away with that, we first need a good solid API structure which interfaces with the IPS classes without re-creating too much code. Our utopian fantasy would involve lots of naked women, I mean, it would involve being able to write a whole suite of API classes and then write a framework called IPB that uses them. However, this is still a relatively distant dream simply because the average forum system is one big bad-ass hack. Programming theory and the reality of cramming 350 accounts on a P4 web server don’t often run along the same lines. The average forum system (and indeed, the average web application) takes advantage of several short-cuts to reduce the number of loaded classes and queries. This isn’t ideal but the having your program banned is less desirable.

So, I’ve had to suffer a little duplication. Originally I had planned to make the Posts API directly load class_post.php functions but class_post.php is only really set up to deal with the current logged in member (something that will be addressed in IPB 3.0) and thus not useable. Fortunately, I’ve been able to make use of class_post in other areas, such as topic rebuilding, forum rebuilding, stats rebuilding, topic tracking and forum tracking meaning the only real duplication we have is with the actual data insertion. Good enough until I go through the code during IPB 3.0’s development cycle.

Here’s how easy it is to add a reply to a post:

$api = new api_topics_and_posts();
$api->set_author_by_name(’matt’);
$api->set_post_content(”Hello World! :D”);
$api->set_topic_id( 100 );
$api->create_new_reply();

And topics…

$api->set_author_by_name(’matt’);
$api->set_post_content(”Hello World! :D”);
$api->set_forum_id( 10 );
$api->set_topic_title(’Hello World’);
$api->create_new_topic();

I’ve finally finished this feature off. Hoo-rah.

I’ve renamed it to "ACP Restriction Permissions" as it better suits the way the interface works. Basically, any admin in a group which has ACP access has full unrestricted access to the ACP. This only changes when they are added to the restrictions list. When first added, they don’t have access to any area of the ACP.

The restrictions can be at tab level (Management, Look and Feel, etc), root feature level (Members, Forums, Template Editing, etc) and at sub-feature level (Add member, edit members, add forums, recount forums, etc) or a mixture of all three.

This means that if you just want an admin to manage skins, you can do this at the "Look and Feel" tab level. If you also wish to only allow them to edit existing skin sets, you can do so at feature and sub-feature level.

I won’t bore you with how it works, back-end and database wise; apart from saying the actual PHP sources are picked through for permission checks and the database is built up from that which makes developing easier as I don’t have to manually keep a list up to date.

The front end is mostly javascript and Ajax. I think this is a good example of how Ajax can take what would otherwise be a complex interface and make it much easier. Without such a system you’d have to rely on a series of page loads and a lot more PHP work to save state between pages.

You’ll notice that the sub-feature level rows are auto-saved when another tab or feature tab is clicked. There is an optional manual save which turns red when a change has been made.

acp-perms.mov (Quicktime .mov 4.8mb)

UPDATED (12-July-05: New interface components) acp-perms2.mov (Quicktime .mov 2.2mb)

UPDATED (Again: Added quick links to allow perms for entire section) acp-perms.jpg

I get some some perverse enjoyment from bug fixing. I think it’s because I’m able to be very productive in a very short space of time. There’s few things as rewarding as knocking off a few dozen bug reports before lunch. For the most part the bugs we get reported are relatively minor and trivial which allows me to whip through them.

So far, the IPB 2.1 alpha release has gone very well. I’m surprised by the low number of reported bugs but this is tempered with the fact that it was only released to our customers, and only installable by those customers who had the free time, will and zend optimizer installed. Even still, I’m pleased with how well its gone.

It’s unusual for us to release an alpha. I wanted to make this release because of all the new toys IPB 2.1 brings and early testing of the client side scripting will save us a major headache later on. I could have labelled it a "beta" but, unlike some project managers, I prefer to wait until the feature set is all but complete.

I really don’t think it’ll be long before we hit the first "proper" beta release. The few bugs reported so far combined with the few sections left to complete should see a release within the next few weeks and I don’t anticipate a very long beta testing phase.

All in all, IPB 2.1 is shaping up to be a great release and I’m interested to see what the modification community make of the new back-end code and components system.

I’ve almost finished this section of IPB off (the last major feature before the first alpha "technology preview" release) and I’m fairly pleased with its implementation.

In a nutshell, it allows one to add different methods of authenticating the username / password combo when a member logs in. There are two options available. Pass-Through and On-Fail.

Pass-Through simply queries the non-IPB authentication modules for each log in attempt. If the username and password doesn’t authorise, we return a fail and the member is told their log in attempt failed. If the authentication was approved and a member (linked via username) is found in the IPB database, the member is loaded and returned. If a member is not found in the IPB database, then (assuming this log in auth module allows member creation) IPB starts the process of creating the member in the IPB DB which is finished when the member completes their (First log in) form.

On-Fail will attempt to authorise via IPBs database first. If a member is found and the authorisation is processed, then the member is returned. If there is no member found, then the non-IPB module is queried as per pass-through.

In addition, one can replace the log in form with their own HTML or add HTML to the log in form (for alternative log in methods, such as PassPort). One can also enter a URL for the member to manage their account (changing password, etc) and a URL to register. This is ideal if you want to keep all your registrations in an existing site / CMS.

Each log in module comes with three files: "auth.php" which is the module which performs the authentication. "conf.php" a configuration file to accept SQL details and such (didn’t think that it was wise to use the settings database to store sensitive info ) and "acp.php" a file which manages the installation and other ACP tasks relating to that log in module suite.

All in all, I think this is a very flexible system and will open IPB right up for use on large corporate sites with an existing membership database and small sites where an existing product is already being used.

Of course, it also allows us to complete our "Converge" project - although this has gone through several key changes over the past six months or so. Expect more Converge news soon.

First movie: This shows a phpBB user (from a test DB I had installed) logging into IPB for the first time. Note how they are asked to complete a "Your first log in" form.
abs-login.mov (Quicktime .mov 1.1mb)

Second movie: Not terribly exciting, but shows the ACP controls for the different pre-installed log in types. Note several are flagged as "not installed" this is because the install script hasn’t been run which asks for LDAP and SQL details and thus are not able to be selected until the install program has been run.
acp-loginauth.mov (Quicktime .mov 4.8mb)

I figured I’d take a quick movie of the "new" registration form which takes advantage of Ajax to check the usernames and email address haven’t already been used in a registration (and are not banned by the admin).

I think it’s a nice way of letting the user know about any errors and should save them a whole bunch of submit.. edit…submit…edit…submit cycles which quickly get frustrating.

One day, all web forms will be like this.

Reg-Form.mov (Quicktime .mov 1.1mb)

This is a pretty legitimate use of javascript and ajax that doesn’t take too long to implement but makes completing forms a lot easier.

Basically, javascript checks to make sure that the field is not empty and doesn’t contain illegal characters. Ajax enabled browsers also fire a check to the DB to see if the input already exists in the database.

The output needs a litle cleaning up but it’s a pretty nice time-saving feature that also appears on the IPB 2.1 registration pages.

(The display name feature is there because of the abstracted log in procedures IPB 2.1 allows and is optional and can be turned off by the admin. The admin can also set how many name changes are allowed per 24 hour period. Also, the name changes are tracked and the ‘name change’ history can be shown to other members on the profile page).

Edit: Now has a "tick" and "cross" images to visually enhance which fields are correct or incorrect.

UCP-NameChange.mov ( Quicktime .mov, 388k )

I’ve just about finished off the ACP template editing interface.

I’ve polished some of the code and removed a few frame refreshes in favour of dynamically assigning images to denote whether they’ve been edited or not. I’ve also added in an Ajax function (where available) to revert the template bits without the need for a frame refresh.

I’ve also added in the ability to edit multiple templates at once. Just click the template bit rows of the ones you want to edit and hit the "Edit Selected" button. It all loads in the same page and, unlike IPB 2.0, it’ll only save the template bits which have been altered.

Now I’m off to complete what could be the biggest feature in IPB 2.1…

ACP-Templates III (Quicktime .mov, 5.7mb)

I’ve revisited the "inline topic editing"; the feature that allows one to edit the topic’s title when viewing them as a list in a forum.

Currently, one has to double click on the topic’s table cell to activate the edit function. This is rather unfriendly. I had considered adding an "inline edit" icon somewhere but that would take away some of the "Desktop OS"-ness of the feature.

With desktop applications, we double click the icon or text to launch the application. Unfortnately, we only click once to lauch a web page. This incongruent interface means that we cannot directly emulate a desktop application unless we required a double click to load a topic. This would, of course, be silly. It’s too late to reinvent the internet and requiring a double click would be akin to asking one to hold a mouse upside down.

To make matters worse, when one right clicks a link, the browser’s pop-up menu is expected to appear. To change this behaviour would remove the browser’s features and confuse the end user. As we’re unable to modify the right-click menu, we can’t do much with that.

I did notice, however, that when one wishes to rename a file in Windows or Macintosh, you simply click-pause-click or click-hold-click. Of course, this is of no use to a web based application because after a single click you expect the page to load.

I decided to opt for a simple ‘click-hold’. After 1500 milliseconds (1.5 seconds) of holding, the link changes to the text input box allowing one to edit the topic title. This isn’t a totally natural interface request, but due to the limitations and the discordant nature of web/desktop applications, it’s a workable solution. This solution doesn’t interfere with a single click and doesn’t interfere with the browser’s right-click menu. I only need to ensure that this won’t interfere with screen-readers and other devices designed to make browsing easier for those with disabilities.

It was pretty easy to achieve really. Just a few link events (mousedown, mouseup) and a timer to check how long the mouse has been held down for. A setTimeout loop ensures that the time is constantly checked until the mousebutton is released.

Check out the result below.

Topic-Editing.mov (Quicktime .mov 1.7mb)

I’ve just about finished the new template editing interface albeit with a few rough corners and bugs to iron out.

I think this is a good mix of javascript techniques; both traditional and AJAX. The Ajax is used to generate a list of "suggested" matches when searching for templates. When you click the "go" button after finding a template to load, the three panes open automatically.

Hurrah for javascript.

ACP-Finished-Templates.mov
(Quicktime .mov 5.7mb)

Ajax is probably the most used and most misunderstood buzzword at the moment.

Ever since Google threw together their map and google suggest service web developers have been trying to jump on the band-wagon and throw Ajax at everything that moves.

Hey, so I’m on the band-wagon but at least I know when to stop!

Although still very much in progress, the movie below shows the new template editing interface. The great thing about it is that there’s not a single blob of ajax in there. It’s all done via iFrames which means that it works on every modern javascript enabled browser.

The new interface makes finding template bits a snap and as it’s all on one screen you don’t have to keep clicking between pages.

I am going to tidy up the actual editing interface and add a "save" button that uses Ajax so one doesn’t have to refresh, but other than that, it’s ajax free.

Hurrah!

ACP-Snazzy Templates (Quicktime .mov 4.3mb)

When I first started added the ajax (XMLHttpRequest) functions to allow one to edit topic titles I thought about creating an interface to allow one to edit posts inline.

I rolled it around in my head for a while and decided that it probably wasn’t needed and I wanted to make sure I wasn’t throwing this technology around just for the sake of it (*cough* instant quick reply *cough*).

I usually get a feel for the need for a feature by how many times I wished it was on our corporate board. I make a fair amount of posts over there and I seem to have been struck down recently by a severe batch of "typo-itis"; a strange condition that leaves one with the impression that their fingers have been moved slightly to the left of their usual position which makes striking the correct keys in the correct order a rather hit-and-miss task.

Two days of constantly editing my posts was all that I needed to convince me to add this feature. I’ve added a little movie of it below. Don’t worry about the interface, it’s a little scrappy and will be cleaned up and made "purdy" at some point before final. I know that the first thing people are going to ask is "Can you put in a WYSIWYG editor?" followed by "Can you add a smilie pop up window and BBCode legend?". The answer to those questions and anything along those lines is a resounding "No". This is "quick edit"; a place to quickly make corrections to an existing post. If you want full editing capabilities, then hit the ol’ "Edit" button.

The great thing about this feature is that the back-end only took a few minutes to write. IPB uses a OOP structure and as such it was a simple case of loading the edit post module and running it through there. A minor change to the core routines to display a friendly XML error instead of the classic HTML error page was the only ‘big’ change required.

Ajax-Post.mov (Quicktime .mov 2.7mb)

The BBC have always managed to get their websites "right". They invest heavily into their websites and their sites are regularly mentioned when good design and good content management are discussed.

Now, the BBC are inviting fellow web developers backstage.

backstage.bbc.co.uk is the BBC’s new developer network, providing content feeds for anyone to build with.  Alternatively, share your ideas on new ways to use BBC content. This is your BBC.  We want to help you play.

In a nutshell, they’re inviting us to use their syndicated content in new and innovative ways. I’ve said before that I love finding new ways to apply "old" technology and this project is just that.

The timing couldn’t be better. We’ve submitted IPB 2.1’s RSS import feature as a feature prototype and set up a test forum for importing RSS feeds on our corporate board.

Sorry about the blog title. That phrase has been rattling around in my head for a few days and I had to exorcise it.

Moving on….

I’ve coined a phrase: RSS-Link (Lindy prefers RSSync which he came up with) which applies to a technique which is now possible with IPB 2.1.

I’ve set up an RSS export on my dev forum, and set up an RSS import on the IPS forums. I post in a certain forum on my dev board, and when the RSS export is updated, it’s imported into the IPS forums.

Although replies and such are still handled locally, it’s a neat little system when you want to share topics across two installations. In effect, RSS is merely a transport method for duplicating content. I guess that’s what web development is all about. Don’t expose the end user to the technology - just give them a nice interface and a will to use it.

RSS Link in action (.mov 2.9mb)

As you probably know, I’m a MacTard, so I was pretty pleased when my copy of Tiger arrived this morning. (OK, I’m not that much of a MacTard that I had it on pre-order for 18 months). After much "oooh" and "aaaah" at the new Mail client, the new Dashboard and the new "Spotlight" search (and trying without success to turn off the blurry new font smoothing) I figured I’d have a crack at the WYSIWYG editor for Safari which is something I’ve been very keen to do since I heard that Safari 2.0 feature contenteditable support and designMode support.

Other developers who’ve found this blog entry via Google hoping to find example code or hints on how to get a WYSIWYG environment for Safari 2.0 can simply read the instructions below.

Don’t bother.

There is one pretty big flaw in Safari 2.0. When you highlight some text, and then click a button, the text is de-selected. This makes it impossible to use a normal WYSIWYG interface. I managed to get it running by hitting CMD + i and CMD + b but that’s about it. You can also drag images into the editing area and move them about (although they disappear with alarming regularity) however, anything else (color, size, etc) is impossible as you have to click something outside the editing screen.

Worse still, is that even if you did manage to get around that problem (and I really can’t think of one bar rewriting the entire editor) the support is minimal. Forget lists and indents, they aren’t supported in Safari’s execCommand library.

I concluded that I’d have to start from scratch with the WYSIWYG and when I’d finished I’d only have minimal support. So it came down to this equation: time > results.

(If some developer comes along with example code or a link to prove that it can be done, I’ll claim this blog entry was designed to do just that and pretend it was all part of my evil plan and won’t admit to my shortcomings as a developer)

Now, how in Job’s name do I revert to 10.3’s font smoothing…..

I’ve finished the basics of the "RSS" import system and I’m quietly pleased with the implementation. You simply choose an RSS feed, tell IPB which forum to post them into and let it do the rest. It stores the "guid" of each imported RSS item (or if there isn’t a guid, the RSS title) so you won’t get duplicates. The RSS import is checked every "x" minutes and if new items are found, they are posted automatically.

Now, on first thought you may ask "What would I do with an RSS import?" well, many things:

1) Import news from other sources into your news forums. Ideal for techie sites.
2) Import news from your own syndicated sources. Manage news in your CMS (IP.Dynamic?) and have it auto post to your forums.
3) Import your blogs into a forum - consolidate all those content sources.
4) Use it as an internal method of moving data around. Export calendar events as RSS, and import them as topics…

I’ve added some screenies to show the news I stole from CNN and the ACP interface.

To do: Allow the admin to select the format of the "show source link in post" and allow the admin to determine whether she wishes these new imported topics to be moderated (shown as invisible) or closed when first imported.

CNN News (Note the "More News" links)
IPB Forum
ACP: RSS Import Form

It triggers the forum subscriptions as normal and always attempts to use the RSS item pubDate where possible. That’s why the news is in a different order on my test forum when compared to the CNN site. They actually have it ordered incorrectly.

Another day, another feature completed for IPB 2.1.

My attention has been turned to the RSS manager; specifically the RSS export manager.

It allows you to set up your own streams using your own criteria and these will be selectable to the viewer via a "Syndication" link (and most likely via HTML link refs in the HTML source).

I won’t babble on about it, the movie says enough.

Tomorrow will see the RSS import center work start. I plan to allow RSS feeds to be read and posted in a forum of your choice. That’s the plan, anyhow.

ACP: RSS Manager (Quicktime .mov, 4.5mb)

My Assistant

I’ve spent the last few days refining some of the ‘Ajax’ features in IPB 2.1.

We’ve had some great and productive feedback from our customers on the new features and this feedback has motivated the change.

Ajax capable folks now get a floating ‘div’ MyAssistant that’s draggable instead of a new pop up window. This has several tabs each powered by Ajax. (Random thought: I bet sales of a certain cleaning product have gone up in the last few months).

This effectively centralizes all the ajax driven components. I’ve removed the ajax pop-ups from the "View New Posts" and "New Messages" links.

When ajax powered members receive a new PM, their My Assistant is automatically opened and a new tab appears "New PMs" which is already opened. This combines the PM notification with the My Assistant and removes the semi-transparent notification which had a luke-warm reception. Non-ajax folks will get the ‘old’ IPB 2.0 PM notification albeit in IPB blues instead of reds.

The search is an interesting addition. The first reaction is bound to be "Hey, that’s got to be a resource hog" but consider the following: Initial verification is done via javascript which saves a PHP process to determine if the entered keywords are of a correct length and format. You get to see how many matches there are before viewing the results. The current IPB search is in two stages split by a meta redirect. The first part does the search and returns the post IDs and stores them in a search results table. The second stage grabs these post IDs and builds the topic listing. One may consider that "x" matches is insufficient before searching again thus saving the second half of the usual search routine. The resulting HTML is cached in JS (the blob of text, not the page of results) so that if you search for the same thing twice, it doesn’t invoke a PHP request.

Of course, screen shots just don’t cut it anymore, so here’s another (?:adult) movie.

My Assistant in action (Quicktime .mov 3.9mb)

Persisent topic marking has been something that’s often been requested across various forums. Until now, most systems relied on cookies to mimic a reliable system. To a point, this is fine but the usual problems with cookies plague the system; unreliable storage, easy corruption and them not being shared across computers.

IPB 2.0.0 introduced a semi-DB method where topics that you’ve read were added to a database but this didn’t do anything for forum markers which still relied on a mixture of cookies and your last visit date (which itself is problematic).

IPB 2.1 has a system where both the read topics and forum marker information is stored in the database.

Now, before you run for the hills shouting "bloat, inefficient, it’ll make IPB too slow!" - you might want to understand how the system works.

The system is based around Remco’s wonderful system for the Invision Blog software. It’s hard to convert the code into English, so I won’t bother. Suffice to say that it doesn’t take up much more resources than IPB 2.0.0s system and in fact, it’s probably a touch more efficient. Infrequently it needs to determine how many topics are unread in the forum and it runs a COUNT(*) query on the topics table. This is all indexed so full table scans, temporary tables and filesorts are all avoided. It doesn’t do this on every page view and I estimate that it will only do it for 10% of the topics you’ll read. It avoids the need to query the database for topics you’ve read which avoids a rather nasty ‘range’ query. I’ve also removed the filesort operation when in the forum view, so overall IPB 2.1 should be more efficient than IPB 2.0.3 even with this new marking system.

This system also means that you don’t have to view a forum first to get your unread topics synchronised. If there was only one new post/topic in the forum and you went straight to it from the board index and went back to the board index, the forum marker will be marked as read.

Naturally, for those who wish to squeeze every ounce of performance out of their board, this system can be switched off and it’ll go back to using cookies.

In other news, a less exciting use of Ajax has been implemented in the ACP. It’s rather basic at the moment, but it’s a nice little touch to avoid large page refreshes. I’ve included a little movie of this feature in action. I might make the final implementation much more fancy with each row written with a cross or other icon and convert it to a tick when it’s complete.

I think that there’s a fair bit of bandwidth to be saved using this method. Oh, and to that crazy guy over on the vB forums who is determined to prove that anything with Ajax in it is massively bloated and likely to crash your browser. Wise up, dude. It’s just a few lines of javascript, it’s not loading a java sized program into your memory.

I’ve also added a little movie of IPB 2.1’s wonderful new inline editing and moderation. It just doesn’t get easier than this to manage your forums.

ACP Ajax refresh (Quicktime .mov file, 1mb)
In-line moderation and editing (Quicktime .mov file, 4.8mb)
Working in the ACP (Quicktime .mov file, 5.1mb)

About Me

Me
I'm a web developer (PHP / MySQL / DOM) based in the UK. I am the co-founder and C.S.A of Invision Power Services, Inc.

Last.fm Chart

XBox Live

Spam Monitor