OpenID Authentication Plugin for vBulletin 4

Recently I volunteered to help fix an existing project or develop an OpenID authentication plugin for the vBulletin platform. The group in need was UbuntuForums.org and I would have never known if it hadn’t been for Jorge Castro’s public request for help.

The Story

The existing plugin had been developed specifically for vBulletin 3.x, however, they are (as of writing this) in the process of upgrading their forums to vBulletin 4 especially wanted OpenID to be available when they make the upgrade. That’s where I came in.

Canonical, the company behind Ubuntu, provided me with necessary software licenses for vBulletin 4 and from there it was a lot of late nights attempting to simply get a successful OpenID process to occur.

Working a full time job doesn’t make projects like this as easy as I remember them once being… Nonetheless I was able to successful port the plugin to vB4 where there were several significant differences that took me some time to address and to be honest, the previous code was a bit more complicated to follow than it should have been.

One major change from vB3 to vB4 was the way templates work. I’d never worked with vBulletin before, but I’ve had an extensive amount of experience with phpBB and bbPress in the past. After getting over the frustration of how vBulletin prefers to store ALL template information (in the database rather than pull from template files) I was ready to begin the repair process.

Continue reading “OpenID Authentication Plugin for vBulletin 4”

Debugging PHP in Ubuntu using Eclipse

This guide walks you through the necessary steps to configure the Eclipse IDE for PHP debugging. This can be very handy, especially when you’re trying to resolve an issue in a complex PHP application or plug-in.

Things you’ll need

  • Eclipse
  • Eclipse PHP Development Tools (PDT)
  • Xdebug
Assumptions
This article assumes that you are configuring Eclipse and Xdebug for development on a localhost web server. If you are not, be sure to make appropriate adjustments to accommodation your needs. Likely the only changes you will need to make will be differences in connecting to your server verses localhost.

Quick Overview

For those that are unaware, Eclipse is a very popular IDE for developing in Java. However, Eclipse is much more powerful than that and can in fact easily be used for developing in many other languages including PHP.

Xdebug is a brilliant debugging extension designed for use with PHP. Once configured, Xdebug will allow you to remotely connect to your web server… or in my case connect to my development localhost web server. Rather than using crude echo and logging techniques to debug your PHP code, Xdebug allows you to literally step through and inspect values and function flows in real-time.

Continue reading “Debugging PHP in Ubuntu using Eclipse”

Solution To WordPress getimagesize() Error

If you’ve for whatever reason noticed that your WordPress website is generating errors similar to the following then I may have a solution for you.

Warning: getimagesize(/home/.some-dir/example.com/folder/httpd.www/wp-content/uploads/some-image.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/.some-dir/example.com/folder/httpd.www/wp-content/blah/blah/blah.php on line 123

I noticed that some pages that generated image information were printing errors out on my pages with private server file structures included. Generally you don’t want to see this printed out to the public. 😉

I’m not guaranteeing a fix for you, but rather what worked for me.

If you are getting an error link the one that I’ve listed above, more specifically the “failed to open stream: No such file or directory,” then you may be about to fix it in only a few minor steps.

Things you will need:

  • FTP (I use FileZilla)
  • phpMyAdmin
  • Ability to add a new plugin to your site
  • Patience

Procedure

Single quotes must be the normal ascii quotes. Chances are, if you copy and paste from my blog, they will be the wrong type so double check that as it could give you problems. 😉

  1. First and foremost, make sure to backup your entire database to a safe place. I’m not liable in the case that you don’t backup your database and this procedure borks your blog (or any other case for that matter). 😉
  2. Create a new file named “abstest.php” and upload it to your blog’s root directory after entering the following code into it:
    <?php define('ABSPATH', dirname(__FILE__).'/'); echo ABSPATH; ?>
  3. Open a new browser tab and navigate to “http://www.your-website.com/abstest.php“. You should find a short page with the printout of your servers absolute path.
  4. Check that the path provided by this test file matches the base path printed out by the getimagesize() error exactly. In my case, my server had changed slightly so the differences were similar to the following:
    /home/.some-dir/example.com/folder/httpd.www/
    /home/example.com/folder/httpd.www/
  5. If you find a mismatch, then you’ve found your problem and the rest is simple. If not, then my tips will most likely not solve your particular WordPress error(s).
  6. If you’ve found a mismatch, then continue: Open a new browser tab and navigate to your phpMyAdmin interface. Select your WordPress database, then click Search. I searched all tables for a match of the path that was different, in my case it was “.some-dir/“.
  7. If there are matches found then you need to click the SQL tab at the top (preferably in a new tab) and paste the following (making sure to edit it to match the table and fields you need) and run it to find and replace that changed part of the path.
    update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
    For more information on SQL find and replace, either search Google or read this.
  8. After replacing all of the affected tables and strings, your images should be properly address. You’re not done yet though.
  9. Open WordPress Plugins and add/install a plugin named “Regenerate Thumbnails“. After installing it, make sure to activate it. 😉
  10. In your Admin panel, find the Tools menu and expand it. You should see a menu item labeled “Regen. Thumbnails”…click it. This will open a page with a start button. Clicking this button will begin the process of correcting your thumbnail dimensions as well as other metadata. It will take some time depending on the number of thumbnails you have accumulated.
  11. After the progress bar reaches 100% it will notify you that it is complete. You’re all done! You may need to clear your cache to refresh any pages that still generate the previous error message.

If you had any problems with the above mentioned procedure, I would suggest restoring your database using your backup copy and either trying again, paying someone to do it for you or just forgetting about it. 😉

If it works then great! If not then sorry you’ve wasted your time. It worked for me, so maybe it will work for you as well. 😀

WP-UserAgent v0.9 Released

I’ve just released an update for the WordPress plugin WP-UserAgent. The update changelog is as follows:

v0.9

  • Added detection for Venenux GNU Linux and Oracle Linux.
  • Added detection for Laconica and MovableType trackbacks.
  • Cleaned some of the code for trackback detections.

You can find out more about WP-UserAgent as well as a download from the main page.

Online Alarm Clock back online!

online alarm clockSince I recently made the switch to WordPress, I have been busy reorganizing my entire website and making it a bit stronger. I’ve taken on the task of recoding a majority of the Online Alarm Clock that I coded a couple of years ago.

I want to improve the back-end before I redo the front-end and cause more trouble. 😛 I’ve already simplified a large portion of the code, but my next task is to go in and eliminate ridiculous processes where some code might be repeated several times instead of being dynamic.

Once I get the back-end worked out a little more and cleaned up, I’m planning to publish the code as an Open Source package under a GNU license. Much similar to the way you would setup a forum (phpBB) or a blog (WordPress) on your site.

The package will be minimized as much as possible, but I’ll be sure to have plenty of information in the Readme.txt file. 😉 Besides, the setup will be super easy. Just a typical config file that you will need to enter your database connection information into so users can be stored and alarms can be saved. 😉 Requirements will basically just be PHP and MySQL (not sure which versions are compatible just yet though).

After I get the back-end all worked out, I’ll start working on some user interface templates and an admin control panel. I’m also thinking I should make a control panel for end-users so they can select themes, customize their own themes and anything else I can think of (or that’s suggested).

If you want to see what this Online Alarm Clock is then go check it out for your self! You can register for free and have an alarm to watch all of the online videos you want when you wake up!

If you’re interested in getting the Online Alarm Clock for your own site then you should check out the Google project that I started for it! You can download the package as soon as I get the first one ready, report issues that you find in the code and even track reported issues by others!

What’s New..

Well, I think you’ll all find this useful at one point or another. I’ve implemented editing for user comments, finally. I’ve been meaning to do this for a while and correcting some errors here and there, but now you can correct your own or add more to your comment. However, there are just a few things you will need to know:

  1. You will not have the option to edit your comment unless your ip address is the same one that was used when you posted the comment. It is best to edit the comment soon after originally posting it since ip addresses do change frequently for some.
  2. You cannot edit your comment after a specific time period from originally posting it. I will use a 48 hour interval to start out with. This interval may change, but I’ll keep you up to date.

Off to finish F.R.I.E.N.D.S. on TBS!

UPDATE:
Quoting is also an option now! Both of these features rely on javascript and will be improved greatly in the near future. They are just kind of 1.0 versions I guess, or maybe alpha. 😉 Enjoy.

New site design under way..

I’ve been working on redesigning the site a bit so it doesn’t feel so cluttered. I’m not finished yet and still have a bit of cleaning up to do. However, I wanted to get some comments, feedback and constructive criticism. Please let me know the goods and the bads. If you can..please give a suggestion or 20. 😀

I don’t want to officially launch the design yet, so I’m waiting for reviews. I’m curious if it’s better or worse and what is better or worse about it. I haven’t gone as far as setting up cookies or passing the css tag, so the style sheet will only apply on pages with css=2 appended to them. If you view another page and would like to see how it looks with the style sheet then just add ?css=2 at the end and press enter. Here are some links to get started..

https://www.kyleabaker.com/?css=2
https://www.kyleabaker.com/archive.php?css=2
https://www.kyleabaker.com/news.php?news=71&css=2

Check them while their hot! I’ll be removing this feature/option soon and these links will be disabled. 😉

UPDATE:
New design is up. I’m still tweaking it and working in the comments and suggestions. Thanks for the feedback!

Screenshots now use on-the-fly thumbnails

phpI finally got around to implementing thumbnails for the screenshots to the right and in the gallery! Basically, instead of loading full screen images (which take ages to load on a slow internet connection) you are now loading images that have been shrunk from the originals down to the size that you see so no bandwidth is wasted and you see them load much faster!

Here is how it works:
The script that I’m using takes a src param and a width param. [You’ll see this if you’re viewing the source of the images. 😉 ] The src (or source) param is the path to the original full size image. Once the source or path to the image has been established, the script shrinks and caches (saves or stores) the image on the server and then sends it to you. This makes my job of maintaining screenshots much easier!

Just thought you ought to know. 😉 You most likely would never have known that these images were served to you on-the-fly and are not actually stored on the server in the sizes that you see. Just a neat little php trick!

If you’re interested in the script that I used you can find it at phpthumb.sourceforge.net/. It’s open source and updated fairly often (just enough so it’s not out of date, lol).

Enjoy the faster page loads!