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 |
|---|---|---|
create_date(
| $user->format_date($your_timestamp);
| shorter, more readable and it is set to users date formatting automatically |
$userdata['user_id']
|
$user->data['user_id']
| more flexible, $user object contains information which was fomerly stored in global arrays |
$userdata['session_logged_in']
| $user->data['is_registered']
| To check whether a user is logged in or not, you can use this field. |
$board_config
| $config
| Content of phpbb_config table |
$page_title = $l_title;
| page_header($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'));
| $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. |
message_die('foo', 'foo', __LINE__, __FILE__)
| trigger_error('LANG_VAR');
| 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 |
if(isset($HTTP_POST_VARS['foo']))
| $foo = request_var('foo', 0, true, true);
| 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. |
redirect(append_sid("login.$phpEx?redirect=foo.$phpEx", true));
| login_box("foo.$phpEx", $user->lang['LOGIN_FOO']);
| 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();
| if ($auth->acl_get('f_reply', $forum_id))
| 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 = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
| In phpBB3, there is no extension.inc anymore. |

