Icy Phoenix


Documentation And How To - CONVERSION - How To Convert phpBB 3 Code To Icy Phoenix [NOT VALID FOR IP 2.0]



Mighty Gorgon [ Sat 22 Aug, 2009 23:40 ]
Post subject: 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 includes folder and include it where needed:

FIND:
Code: [Hide] [Select]
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);


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



____________________________

CONVERSION GUIDE
____________________________






Files Header

FIND
Code: [Hide] [Select]
<?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
*
*/

/**
*/
?>


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





Global Var

FIND
Code: [Hide] [Select]
<?php
if (!defined('IN_PHPBB'))
{
exit;
}
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
if (!defined('IN_ICYPHOENIX'))
{
die(
'Hacking attempt');
}
?>





Global Page Startup

FIND
Code: [Hide] [Select]
<?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();
?>


REPLACE WITH
Code: [Hide] [Select]
<?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
?>





Language Inclusion

FIND
Code: [Hide] [Select]
<?php
$user
->add_lang(array('YOUR_LANG_FILE'));
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
include(IP_ROOT_PATH . 'language/lang_' . $board_config['default_lang'] . '/YOUR_LANG_FILE.' . PHP_EXT);
?>





Some Vars

FIND
Code: [Hide] [Select]
<?php
$phpbb_root_path
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
IP_ROOT_PATH
?>



FIND
Code: [Hide] [Select]
<?php
$phpEx
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
PHP_EXT
?>



FIND
Code: [Hide] [Select]
<?php
"{$phpbb_root_path}index.$phpEx"
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
IP_ROOT_PATH
. 'index.' . PHP_EXT
?>



FIND (SIMILAR)
Code: [Hide] [Select]
<?php
$user
->data['user_id']
?>


REPLACE WITH (SIMILAR)
Code: [Hide] [Select]
<?php
$userdata
['user_id']
?>



FIND (SIMILAR)
Code: [Hide] [Select]
<?php
$user
->data['is_registered']
?>


REPLACE WITH (SIMILAR)
Code: [Hide] [Select]
<?php
$userdata
['session_logged_in']
?>



FIND (SIMILAR)
Code: [Hide] [Select]
<?php
$config
['CONFIG_VAR']
?>


REPLACE WITH (SIMILAR)
Code: [Hide] [Select]
<?php
$board_config
['CONFIG_VAR']
?>



FIND (SIMILAR)
Code: [Hide] [Select]
<?php
$user
->lang['LANG_TEXT']
?>


REPLACE WITH (SIMILAR)
Code: [Hide] [Select]
<?php
$lang
['LANG_TEXT']
?>





Page Header

FIND
Code: [Hide] [Select]
<?php
page_header
($l_title);
?>


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





Page Body

FIND
Code: [Hide] [Select]
<?php
$template
->set_filenames(array('body' => 'foo_body.html'));
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
$template
->set_filenames(array('body' => 'foo_body.tpl'));
$template->pparse('body');
?>





Page Footer

FIND
Code: [Hide] [Select]
<?php
page_footer
();
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
include(IP_ROOT_PATH . 'includes/page_tail.' . PHP_EXT);
?>





Die Message

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

FIND
Code: [Hide] [Select]
<?php
trigger_error
('LANG_VAR_MESSAGE');
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
message_die
(GENERAL_MESSAGE, $lang['LANG_VAR_MESSAGE'], $lang['LANG_VAR_TITLE'], __LINE__, __FILE__)
?>





Basic SQL Query

FIND
Code: [Hide] [Select]
<?php
$result
= $db->sql_query($sql);
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
$result
= $db->sql_query($sql);
if(!
$result)
{
message_die(...);
}
?>





Login

FIND
Code: [Hide] [Select]
<?php
login_box
("foo.$phpEx?var=my_var", $user->lang['LOGIN_FOO']);
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
redirect
(append_sid(LOGIN_MG . '?redirect=foo.' . PHP_EXT . '&var=my_var', true))
?>





AUTH

FIND
Code: [Hide] [Select]
<?php
if ($auth->acl_get('f_reply', $forum_id))
{
//do something
}
?>


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



FIND
Code: [Hide] [Select]
<?php
if ($auth->acl_get('a_foo'))
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
if($userdata['user_level'] == ADMIN)
?>






Dates

FIND
Code: [Hide] [Select]
<?php
$user
->format_date($your_timestamp);
?>


REPLACE WITH
Code: [Hide] [Select]
<?php
create_date_ip
($board_config['default_dateformat'], $your_timestamp, $board_config['board_timezone']);
?>


spydie [ Sat 22 Aug, 2009 23:59 ]
Post subject: Re: How To Convert PhpBB 3 Code To Icy Phoenix
Big thank´s for this useful Doc. MG

There´s some thing´s i could´nt solve in a mod i´m trying to port,
But with this i think i can solve it.

Thank´s again MG

Edit :

question: what to do with the html-files that use to come with PhpBB3 Mod´s.

Just rename them to tpl or what ?


DWho [ Tue 25 Aug, 2009 11:09 ]
Post subject: Re: How To Convert PhpBB 3 Code To Icy Phoenix
spydie wrote: [View Post]


question: what to do with the html-files that use to come with PhpBB3 Mod´s.

Just rename them to tpl or what ?


yep without having tested thats what i would do....


thanks MG a very useful topic... will save a lot of problems...



spydie [ Tue 25 Aug, 2009 11:16 ]
Post subject: Re: How To Convert PhpBB 3 Code To Icy Phoenix
thank´s DWho.

FYI i´ve allready done it and it work´s


DWho [ Tue 25 Aug, 2009 12:40 ]
Post subject: Re: How To Convert PhpBB 3 Code To Icy Phoenix
spydie wrote: [View Post]
thank´s DWho.

FYI i´ve allready done it and it work´s


cool



Mighty Gorgon [ Thu 27 Aug, 2009 20:52 ]
Post subject: Re: How To Convert phpBB 3 Code To Icy Phoenix
I've also added a file that you can use to convert some standard phpBB 3 vars, functions or classes... so if you forget to convert something, or don't know how to do that... with this class you may hopefully solve some problems.

If course... it would be better to manually convert what needed... but just in case you don't have the skill...

If someone uses it, please let me know...


spydie [ Thu 27 Aug, 2009 20:56 ]
Post subject: Re: How To Convert PhpBB 3 Code To Icy Phoenix
thank´s MG . I´ll give this a try, cause i´m still stuck with this countdown date stuff

Edit:

Got to do this because the server want let me post before another 6 hrs.

Hi MG

Gave your little function script a try on my local test enviorment.

something funny happend.

get 5 errors from common file

I took an original PHPBB3 script off the MOD i´m trying to port, just for testing your script.

Put the include in all necesary files, went to my local server, and called the page up .

result was :

Quote:
Warning: include(IP_ROOT_PATHctracker/engines/ct_security.PHP_EXT) [function.include]: failed to open stream: No such file or directory in H:\wamp\www\ip_1.3\common.php on line 153

Warning: include() [function.include]: Failed opening 'IP_ROOT_PATHctracker/engines/ct_security.PHP_EXT' for inclusion (include_path='.;C:\php5\pear') in H:\wamp\www\ip_1.3\common.php on line 153

Warning: include(IP_ROOT_PATHconfig.PHP_EXT) [function.include]: failed to open stream: No such file or directory in H:\wamp\www\ip_1.3\common.php on line 257

Warning: include() [function.include]: Failed opening 'IP_ROOT_PATHconfig.PHP_EXT' for inclusion (include_path='.;C:\php5\pear') in H:\wamp\www\ip_1.3\common.php on line 257

Warning: Cannot modify header information - headers already sent by (output started at H:\wamp\www\ip_1.3\common.php:153) in H:\wamp\www\ip_1.3\common.php on line 261


glitchies [ Sat 29 Aug, 2009 06:08 ]
Post subject: Re: How To Convert PhpBB 3 Code To Icy Phoenix
i gave that script thingy a try and i get
Code: [Hide] [Select]
Parse error: syntax error, unexpected ')' in public_html/forums/functions_phpbb3_to_ip.php on line 242


my problem is that i dont know enough about php to know why... and because i dont know enough, is why i tried to use it. (lets just say i know enough to have messed up my forums enough times to know why and how i break things, and can usually fix them) I am trying to use this to get a phpbb3 mod working, but i will head over to the right forum to ask my questions about that.


Mighty Gorgon [ Sat 29 Aug, 2009 09:10 ]
Post subject: Re: How To Convert phpBB 3 Code To Icy Phoenix
I have updated the attachment... please try again.


spydie, you didn't define the constants in your file... check IP_ROOT_PATH and PHP_EXT.


spydie [ Sat 29 Aug, 2009 12:30 ]
Post subject: Re: CONVERSION - How To Convert PhpBB 3 Code To Icy Phoenix
outsch

thanks MG


sollord [ Mon 19 Oct, 2009 03:25 ]
Post subject: Re: CONVERSION - How To Convert PhpBB 3 Code To Icy Phoenix
Silly question but isn't replacing the phpbb copyright or any copyright for that matter with your own as this how to guide shows a gpl violation?


DWho [ Mon 19 Oct, 2009 12:10 ]
Post subject: Re: CONVERSION - How To Convert PhpBB 3 Code To Icy Phoenix
sollord wrote: [View Post]
Silly question but isn't replacing the phpbb copyright or any copyright for that matter with your own as this how to guide shows a gpl violation?


you are not replacing the phpbb copyright ... you are making a mod that is ported from phpbb... as phpbb.com "states you can remove our copyright notices form your forum but please do not ask for support..."

though that is totally irrelavant from porting a mod from phpbb to icyphoenix... as all icyphoenix sites have phpbb copyright in the footer on every page..



Mighty Gorgon [ Wed 21 Oct, 2009 00:39 ]
Post subject: Re: CONVERSION - How To Convert phpBB 3 Code To Icy Phoenix
Please note that I have not removed phpBB copyright which is still printed in the footer, and that is the copyright that should not be removed.

The commented string is only for developmental purpose, and all edits in the header are just performed to have all file corrected identified by the SVN system.

Original phpBB copyright is untouched and is still in page footer where it has to be.


spydie [ Thu 22 Oct, 2009 00:25 ]
Post subject: Re: CONVERSION - How To Convert PhpBB 3 Code To Icy Phoenix
question MG

what to do with this salt thing in PhpBB3 mods?

I´ve tried just deleting that line but that does´nt work like i want it


Mighty Gorgon [ Thu 22 Oct, 2009 09:20 ]
Post subject: Re: CONVERSION - How To Convert phpBB 3 Code To Icy Phoenix
Do you mean the form salt?

Open a new topic with an example and I'll help there.


lasqqqw1 [ Sun 16 May, 2010 23:01 ]
Post subject: Re: CONVERSION - How To Convert PhpBB 3 Code To Icy Phoenix
thank´s MG .
I´ll give this a try,...




Powered by Icy Phoenix