The author starts out with the right idea: he makes a class which calls a separate configuration file and that class is then called by a third page which does the front-end and/or admin. From there, everything just gets bad.
The first thing I see is that there are HTML templating functions in the “discussion” class. Um, no. If you need to display HTML, then you need to make another class that handles that. If you mix the two, then you have one class that does two jobs, and that defeats the purpose. However, I figured I could rip out the HTML templating functions (as they are most likely only called from the third script that does the actual front-end work) and still have a very usable class with very little work required.
As I dug deeper into the code the first function I see is called getTopics(). Sounds good. The first few lines of the code show SQL queries being generated. I see that PEAR::DB is being used for database access. This is great. Then, what do I see? Inside of getTopics() the author beings calling his HTML templating functions. Um, wrong again. getTopics() should get the topics. There should be another function (maybe, displayTopics()) that actually spits them out. No big deal, I figure. I’ll just store the information that getTopics() is collecting and then, instead of spitting it into the template functions, I’ll just have it return that value.
As I look at the code that actual gathers the data I see the author calling a _linkHTML() function. I search for the function name only to find that this function reads cookies!! Um, what the fuck?! If a function needs some data, and it’s in a class, that data should be passed to it, or set in the class. It certainly shouldn’t be obtained from a global variable equal to a stored cookie that may or may not exist in the final usage of the system. At that point I gave up.
Even though the code is built in a class. It is useless. The class depends on the code and the system working in one particular way. I’m sure the discussion board works just fine. But, this author should have saved himself a lot of time made his code much more efficient and ditched classes all together, because his use of classes absolutely defeats the purpose.
If you need a prebuilt, ready to roll, discussion board, I wouldn’t bother looking at this piece of software. There are thousands of much more feature rich discussion boards out there. If you are looking for a discussion board class, this is most certainly not the place to look.
Move along. Nothing to see here.
See what happens when I let my guard down and begin to think that the state of PHP software isn’t as bad as I think it is? Ugh.