Archive for June, 2006

Server Move

7 Comments

It didn’t take too long for somebody to hassle me after they’d notice SurfiOnline (and other sub domains) were down. The reason? They were being moved to the new MyBB server.

The new MyBB server is exactly the same as the old one, 2.8ghz P4, 80gb HDD with the differences being now 2gb RAM, 500gb extra data transfer per month, Debian being the operating system in use, and $8 cheaper than before. I purchased it at the beginning of the month through a sale LayeredTech had running for double the RAM.

People who are hosted whom I haven’t already spoken to will need to contact me to reset their passwords for FTP/SFTP services.

The only site which is being served off the old server now is the MyBB site - and will be moved by the end of the month.

June 9th, 2006 7 Comments

Today Tomorrow, The Production Set

6 Comments

So this semester at College, we’ve had to produce a 10 minute documentary or other video as part of our assessment. In a group of three, we drafted a television show which is a take off of Australia’s “Today Tonight”, called “Today Tomorrow”. In the show we take a look at the safety (well - insecurities) of MySpace.

Last night we got around to shooting the studio shots with our presenter. We’ll be making use of the green screen to use a technique called chroma keying to replace the background with a shot of Sydney for the final product. The studio was constructed in a class room with the green screens, a three point lighting set up (a fourth was added to help remove shadows from the screen), the camera and laptop - to record/pass through audio.

A couple of photos from the night:

DSC02977
DSC02978
DSC02979
DSC02980


June 6th, 2006 6 Comments

Writing Modifications for MyBB 1.2

23 Comments

So as the time comes closer to the MyBB release, I guess it’s time to tell you guys that we will have broken a lot of older code modifications and plugins due to the extensive changes in MyBB 1.2. Each and every template has also changed to conform to our new standards.

This is a short guide on how to ensure your code modifications and plugins are ready for MyBB and what changes will be required for your modifications to work with 1.2 as well as other code based changes.

Function Calls

One of the major changes is that most of the functions within MyBB have renamed to make more sense and make them more understandable when reading the code.

Example changes include:

  • outputpage becomes output_page
  • getparentlist becomes get_parent_list
  • nopermission becomes error_no_permission
  • ismod becomes is_moderator
  • updateforumcount becomes update_forum_count

Generally, underscores are used to break the function name up so it becomes readable. Most functions are prefixed with a verb such as output, update, get, do, format, or build. You’ll need to check functions.php closer to the release for the new names of functions.

The other change in regards to function calls is that several are now deprecated and no longer exist within MyBB. postify, domecode, domycode are examples of these functions which no longer exist and have been replaced in some way, shape or form (The post parser is now a class)

Accessing Internal MyBB Variables

The $settings and $mybbuser variables became deprecated in MyBB 1.0, however we left in support for them due to the vast number of modifications still using them.

MyBB 1.2 no longer contains these references, and only supports accessing them through the MyBB class variable ($mybb). For example:

  • $settings becomes $mybb->settings
  • $mybbuser becomes $mybb->user

Get and Post Variables

Introduced with 1.0 along with the MyBB core class was a standardised way of accessing input (Get and Post) variables as well as having common variables such as thread ID (tid) and pid (post ID) automatically filtered for bad input. We also had in place code which would not kill global variables such as $tid, $pid assigned from Get or Post input when register_globals was turned on within PHP and the KILL_GLOBALS constant was not defined.

Up until 1.2, if you still followed old coding conventions with register_globals turned on, this would have worked. You are now required to either use $_GET, $_POST or preferably $mybb->input to fetch incoming data.

Variables within Templates

We were sloppy in MyBB with variables (specifically arrays) in templates. We still used $example[hi] instead of $example['hi'] because our template parser (using eval) did not support this. MyBB 1.2 now uses, by default, variables enclosed within curly braces such as {$example['hi']}. The same applies for class variables.

Database Querying

MyBB 1.0 introduced $db->update_query and $db->insert_query methods for inserting data into a table within a database. We’ve further extended the database abstraction layer by adding a few more methods:

  • fetch_field - Fetch one specific field from a row being queried
  • simple_select - Used to perform a simple select query (with no joins) on a table
  • delete_query - Used to perform a delete query on a table in a database
  • escape_string - Replaces addslashes, escapes data before being used in a query
  • get_version - Returns the version number of the database server being used

That is just a handful of some of the new methods available in the release. You should make proper use of them when necessary to ensure your queries are cross compatible with different database engines. This release also includes a MySQLi database abstraction layer which is used in preference over MySQL if your server supports it.

Good Clean Code and Coding Standards

The MyBB coding standards have basically been rewritten to conform to stricter policies making code easier to read and write.

  • Code should be commented so that a user can understand what is happening
  • Functions should be descriptively named, contain underscores to break words and contain PHPDoc headers
  • Queries are now split on to multiple lines allowing you to quickly identify what is selected, from where, where joins are and the conditions/limits of the query

Full coding standards will be released along side the MyBB 1.2 release.

This is just a small overview of what has changed with MyBB 1.2. It is by no means a comprehensive guide and things will probably still change before the release.

I’ve probably managed to scare a few people off now by stating that most modifications will not work without further code changes, but MyBB 1.2 brings in many, many and even more advantages and features than any other MyBB release and you should be looking forward to it. It is a huge step for us, and probably you too.

June 2nd, 2006 23 Comments