https://www.icyphoenix.com/viewtopic.php?f=4&t=6353&p=43307#p43307
-----------------------------------
Mighty Gorgon
Sat 22 Aug, 2009 23:40

CONVERSION - How To Convert phpBB 3 Code To Icy Phoenix [NOT VALID FOR IP 2.0]
-----------------------------------
Hi all,
here is a small guide on how to adapt some phpBB 3 code to Icy Phoenix.

This how to doesn't include all possible code and combination, but it is just a small reference on the core vars and functions you are likely to find on almost every phpBB 3 page.

This guide may also result useful when trying to port phpBB 3 MODs to Icy Phoenix.

I have also added a file that could help you into the converting process, by automatically converting some basic phpBB 3 vars, functions and classes into Icy Phoenix ones. This file will be included in standard package of Icy Phoenix for the benefit of all who want to use it.

How to use the file?

Put it into [b]includes[/b] folder and include it where needed:

FIND:
[codeblock]define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);[/codeblock]

ADD AFTER:
[codeblock]include(IP_ROOT_PATH . 'includes/functions_phpbb3_to_ip.' . PHP_EXT);[/codeblock]


____________________________

[b]CONVERSION GUIDE[/b]
____________________________


[hr]


[b]Files Header[/b]

FIND
[codeblock syntax=php]<?php
/**
*
* @package phpBB3
* @version $Id: index.php 8987 2008-10-09 14:17:02Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
?>[/codeblock]

[hr]

[b]Global Var[/b]

FIND
[codeblock syntax=php]<?php
if (!defined('IN_PHPBB'))
{
	exit;
}
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
if (!defined('IN_ICYPHOENIX'))
{
	die('Hacking attempt');
}
?>[/codeblock]

[hr]

[b]Global Page Startup[/b]

FIND
[codeblock syntax=php]<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);

// Start session management
$userdata = session_pagestart($user_ip);
init_userprefs($userdata);
// End session management
?>[/codeblock]

[hr]

[b]Language Inclusion[/b]

FIND
[codeblock syntax=php]<?php
$user->add_lang(array('YOUR_LANG_FILE'));
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
include(IP_ROOT_PATH . 'language/lang_' . $board_config['default_lang'] . '/YOUR_LANG_FILE.' . PHP_EXT);
?>[/codeblock]

[hr]

[b]Some Vars[/b]

FIND
[codeblock syntax=php]<?php
$phpbb_root_path
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
IP_ROOT_PATH
?>[/codeblock]


FIND
[codeblock syntax=php]<?php
$phpEx
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
PHP_EXT
?>[/codeblock]


FIND
[codeblock syntax=php]<?php
"{$phpbb_root_path}index.$phpEx"
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
IP_ROOT_PATH . 'index.' . PHP_EXT
?>[/codeblock]


FIND (SIMILAR)
[codeblock syntax=php]<?php
$user->data['user_id']
?>[/codeblock]

REPLACE WITH (SIMILAR)
[codeblock syntax=php]<?php
$userdata['user_id']
?>[/codeblock]


FIND (SIMILAR)
[codeblock syntax=php]<?php
$user->data['is_registered']
?>[/codeblock]

REPLACE WITH (SIMILAR)
[codeblock syntax=php]<?php
$userdata['session_logged_in']
?>[/codeblock]


FIND (SIMILAR)
[codeblock syntax=php]<?php
$config['CONFIG_VAR']
?>[/codeblock]

REPLACE WITH (SIMILAR)
[codeblock syntax=php]<?php
$board_config['CONFIG_VAR']
?>[/codeblock]


FIND (SIMILAR)
[codeblock syntax=php]<?php
$user->lang['LANG_TEXT']
?>[/codeblock]

REPLACE WITH (SIMILAR)
[codeblock syntax=php]<?php
$lang['LANG_TEXT']
?>[/codeblock]

[hr]

[b]Page Header[/b]

FIND
[codeblock syntax=php]<?php
page_header($l_title);
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
$page_title = $l_title;
$meta_description = '';
$meta_keywords = '';
include(IP_ROOT_PATH . 'includes/page_header.' . PHP_EXT);
?>[/codeblock]

[hr]

[b]Page Body[/b]

FIND
[codeblock syntax=php]<?php
$template->set_filenames(array('body' => 'foo_body.html'));
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
$template->set_filenames(array('body' => 'foo_body.tpl'));
$template->pparse('body');
?>[/codeblock]

[hr]

[b]Page Footer[/b]

FIND
[codeblock syntax=php]<?php
page_footer();
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
include(IP_ROOT_PATH . 'includes/page_tail.' . PHP_EXT);
?>[/codeblock]

[hr]

[b]Die Message[/b]

Please note that [b]trigger_error[/b] has been implemented also in Icy Phoenix so you don't necessarily need to replace this.

FIND
[codeblock syntax=php]<?php
trigger_error('LANG_VAR_MESSAGE');
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
message_die(GENERAL_MESSAGE, $lang['LANG_VAR_MESSAGE'], $lang['LANG_VAR_TITLE'], __LINE__, __FILE__)
?>[/codeblock]

[hr]

[b]Basic SQL Query[/b]

FIND
[codeblock syntax=php]<?php
$result = $db->sql_query($sql);
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
$result = $db->sql_query($sql);
if(!$result)
{
	message_die(...);
}
?>[/codeblock]

[hr]

[b]Login[/b]

FIND
[codeblock syntax=php]<?php
login_box("foo.$phpEx?var=my_var", $user->lang['LOGIN_FOO']);
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
redirect(append_sid(LOGIN_MG . '?redirect=foo.' . PHP_EXT . '&var=my_var', true))
?>[/codeblock]

[hr]

[b]AUTH[/b]

FIND
[codeblock syntax=php]<?php
if ($auth->acl_get('f_reply', $forum_id))
{
	//do something
}
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
if($is_auth['auth_reply'])
{
	//do something
}
?>[/codeblock]


FIND
[codeblock syntax=php]<?php
if ($auth->acl_get('a_foo'))
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
if($userdata['user_level'] == ADMIN)
?>[/codeblock]

[hr]


[b]Dates[/b]

FIND
[codeblock syntax=php]<?php
$user->format_date($your_timestamp);
?>[/codeblock]

REPLACE WITH
[codeblock syntax=php]<?php
create_date_ip($board_config['default_dateformat'], $your_timestamp, $board_config['board_timezone']);
?>[/codeblock]


