Tuesday, July 26. 2005Removing Serendipity's NL2BR Plugin
I've been getting tired of fighting Serendipity's NL2BR Plugin, which automatically inserts line breaks in blog entries. It got difficult to format things like source code.
This blog entry contains a useful piece of SQL to update your previous entries. Then it's just a matter of disabling the NL2BR Plugin.
After going through those steps, my blog appears to look the same, and now I don't have to worry about the NL2BR problems anymore.
Integrating other sites with PHPBB
I have been working on integrating a PHPBB forum with an established site for a client. Their site has a pre-existing user base and sign-in method, and I didn't want to disturb that.
This knowledge base article at phpbb.com details the basics of bringing PHPBB sessions into your other code. It includes common.php, which, if you read the source code, includes everything and the kitchen sink for PHPBB: general functions, template code, authenticaion/permissions code, etc. I decided to try to trim it down, as the only "feature" I needed from PHPBB on the main site was to keep a PHPBB session alive while the user used the main part of the website. This looks like more code than suggested in the PHPBB KB article, but it's really less code overall, and it seems to work.
define('IN_PHPBB', true);
$phpbb_root_path = '/somepath/'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'config.'.$phpEx); $ip_sep = explode('.',$_SERVER['REMOTE_ADDR']); $user_ip=sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); include($phpbb_root_path . 'includes/constants.'.$phpEx); include($phpbb_root_path . 'includes/sessions.'.$phpEx); include($phpbb_root_path . 'includes/db.'.$phpEx); $strSQL = "SELECT config_name, config_value FROM " . CONFIG_TABLE . " WHERE config_name IN ('cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'session_length');"; if( !($result = $db->sql_query($strSQL)) ) { die('Could not query config information'); } while ( $row = $db->sql_fetchrow($result) ) { $board_config[$row['config_name']] = $row['config_value']; } $userdata = array(); $userdata = session_pagestart($user_ip, PAGE_INDEX); This method is working OK for me so far. I've got several other steps to really get things integrated. One problem is that the existing site's code uses a global variable to access the database known as $db, and guess what, so does PHPBB, but they're not compatible. I'm also toying with the idea of stripping out PHPBB's existing session code and replacing it with my own which will connect the main site and the forum. I need to see how well PHPBB's session code is written and if it's mostly separated from the rest of the PHPBB code. But you might give this code a shot if you want to work with PHPBB's sessions. Update 2006-04-12: I had to update this code to work with PHPBB 2.0.20. I also changed the PHPBB message_die() function to PHP's die() function since I'm not including it from the PHPBB functions. Saturday, July 23. 2005Capital One Magnets - the new AOL CDs?
Anyone else getting a lot of these things? My wife and I keep getting credit card offers from Capital One. Included in the envelope are cheap refrigerator magnets. We received two more today and now there are 6 on the fridge, and I think we've already trashed one or two. Are these becoming the new AOL CDs? Soon we'll see websites showing all the artistic applications for these magnets.
Update 2005-09-30: We're up to 10 of these magnets. I need to see about opting out of credit card offers.
(Page 1 of 1, totaling 3 entries)
|
CategoriesQuicksearchSyndicate This Blog |