Development Wiki

Olympus for phpBB2 users

From phpBB Development Wiki

Looking for something you know in phpBB2 but can't find in Olympus? See if you can find it here - there's not much yet, but of course you can add things that you stumble about.

phpBB2 Code Olympus Code Description
shorter, more readable and it is set to users date formatting automatically
more flexible, $user object contains information which was fomerly stored in global arrays
To check whether a user is logged in or not, you can use this field.
Content of phpbb_config table
$page_title $l_title;
The page title in Olympus must given to a function, it isn't enough to declare a variable anymore.
$template->set_filenames(array('foo_body' => 'foo_body.tpl'));


$phpbb_root_path 'includes/page_tail.'.$phpEx);
$template->set_filenames(array('body' => 'foo_body.html'));

Template files use the .html extension (instead of .tpl in phpBB2). The alias for the main template file must be 'body' because phpBB3 handles template parsing in the new page_footer() function.
display message to user or abort on error.

You don't need to pass __LINE__, __FILE__ and $sql anymore, it's all done for you :-)

$result $db->sql_query($sql);
$result $db->sql_query($sql);
no need to check for database errors anymore :-).

If you want the old behaviour (for queries that might fail under normal conditions), use $db->sql_return_on_error(true) before calling $db->sql_query() be sure to use $db->sql_return_on_error(false) immediately following the query function to set it back to default.

$foo intval($HTTP_POST_VARS['foo']);
$foo intval($HTTP_GET_VARS['foo']);
$foo 0;
$foo request_var('foo'0truetrue);
get values of GET/POST parameters.

The second parameter of request_var() is the default value; you don't need intval() etc. anymore because the passed in valued is automatically converted to the type of the default value. For strings, htmlspecialchars() and trim() is also applied.

The third parameter $multibyte must be set to true if the parameter can contain UTF-8 characters like German umlauts (i.e. always set it when the user can type in the value).

By default, cookie values are excluded by this function. Set the fourth parameter $cookie to true if the value can also come from $_COOKIE.

In phpBB3, you don't manually redirect to login.php anymore, instead you call the function login_box(). You can optionally pass a string which explains the user why they need to login
$is_auth = array();
$is_auth auth(AUTH_ALL$forum_id$userdata$forum_topic_data);
//do something
if ($auth->acl_get('f_reply'$forum_id))
//do something
In phpBB2, every time you call auth() the sql queries are executed so you need to call auth() once and store the result in a variable.

In phpBB3, you can directly call the $auth->... functions; caching is handled automatically by the functions.

if($userdata['user_level'] == ADMIN)
if ($auth->acl_get('a_foo'))
In phpBB3, you don't care about user levels anymore, you directly check whether the user has a certain permission.

$phpbb_root_path './';
$phpbb_root_path '');
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
In phpBB3, there is no anymore.