---------------------------------------------------------
PHP-FUSION 7 - INFUSION DEVELOPMENT KIT
---------------------------------------------------------

PHP-Fusion 7 has an add-in system called Infusions. An infusion provides
a one-click installation which requires absolutely no coding skills from the
end user.

Before you begin working on your infusion, first, think about what you want
to do. Will your infusion be a panel or a seperate page? Does it need it's
own admin panel? Does it require additional database tables? The infusion
system can accommodate all of the aformentioned options.

The crucial part is the name folder which will contain your infusion file.
There are two options, if your infusion is going to be panel based, then your
folder name must end with the phrase '_panel' (without quotes). You don't
need to do this if your infusion does not utilise a panel.

The one important file that must be present in any infusion is the installation
information file 'infusion.php'. This file is automatically detected by the
Infusion admin panel in PHP-Fusion's admin panel . You'll find a descriptive copy
of the infusion.php file in this development kit.

Feel free to seek assistance in our forums at either our mod repository site
phpfusion-mods.com or our mod pre-release and testing center beta.phpfusion-mods.com.

---------------------------------------------------------
INFUSION DEVELOPMENT KIT CONTENTS
---------------------------------------------------------

new_infusion.php		A stand alone page template
new_infusion_panel.php		A side or center panel template
new_infusion_admin.php		An admin panel template
infusion.php			The installation information file
infusion_db.php			Database table definition file

---------------------------------------------------------
DIFFERENCES BETWEEN V6 AND V7
---------------------------------------------------------

PHP Fusion Core 7 Edition has undergone an extensive rewrite, although v6
infusions are not directly compatible with v7, only a few alterations are
required. Here are the most important changes required:

---------------------------------------------------------
1. Changes to infusion.php
---------------------------------------------------------

V7 infusions can have multiple admin panels and navigation links. Each
admin panel and link is specified through an array.

For admin panels we use $inf_adminpanel[] like so:

$inf_adminpanel[1] = array(
	"title" => $locale['xxx_admin1'],
	"image" => "image.gif",
	"panel" => "filename.php",
	"rights" => "XXX"
);

As you can see there are 4 items available:

title - the name of the link shown in the infusions admin panel.
image - the image displayd in the infusions admin panel.
link - the name of the admin panel file.
rights - v7 infusions must have a unique access rights value, can be up
to 4 letters (uppercase only).

Site links are defined in similar fashion using $inf_sitelink[] like so:

$inf_sitelink[1] = array(
	"title" => $locale['xxx_link1'],
	"url" => "filename.php",
	"visibility" => "0"
);

Again there are 3 items available:

title - the name of the link shown in the navigation menu.
url - the name of the infusion panel file.
visibility - defines visibility (0, 101, 102 or 103).

---------------------------------------------------------
2. Header and footer code
---------------------------------------------------------

V7 has a new template engine which requires fewer lines of required code.

V6 page headers comprise of the following code:

Normal page:

require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";

Admin Page:

require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";

---------------------------------------------------------

For v7 these lines become:

Normal Page:

require_once "../../maincore.php";
require_once THEMES."templates/header.php";

Admin Page:

require_once "../../maincore.php";
require_once THEMES."templates/admin_header.php";

---------------------------------------------------------

Footer lines have also been changed in v7.

V6 page footers comprise of the following code:

Normal page:

require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";

Admin Page:

echo "</td>\n";
require_once BASEDIR."footer.php";

---------------------------------------------------------

For v7 these lines become:

Normal Page:

require_once THEMES."templates/footer.php";

Admin Page:

require_once THEMES."templates/admin_footer.php";

---------------------------------------------------------
3. Change to IN_FUSION check
---------------------------------------------------------

Include or panel files check if IN_FUSION has been defined to ensure
that they cannot executed outside of PHP-Fusion, very important for
security. In v6 we used a header redirect but this can be heavy on some
server loads. So, in v7 the header redirect is replace by the die(); command.

Example of the v6 method:

if (!defined("IN_FUSION")) { header("Location: ../../index.php"); exit; }

The new method used in v7:

if (!defined("IN_FUSION")) { die("Access Denied"); }

---------------------------------------------------------
4. Functions dropped from v7
---------------------------------------------------------

A few functions have been dropped in v7:

fallback(); is now merged with redirect();

tablebreak(); has been dropped completely as it is now automatic.

---------------------------------------------------------
5. Use Super Globals
---------------------------------------------------------

With a major emphasis on much improved security, v7 is designed
to run with register globals disabled. This means you must use
super globals $_GET, $_POST, $_COOKIE etc. In basic practice you
would use these in this way:

$_GET is used for variables passed through the address bar or uri.
$_POST is used for hidden variables passed through input forms.

There are a number of other super globals you can use, the above
are the most common ones you are likely to use. Refer to the PHP
manual (http://php.net) for more information.

Dont forget to ensure that you sanitise ALL user input, failure to
do so could result in incidents of hacking which may cause loss
of data or content.

---------------------------------------------------------
6. Multisite
---------------------------------------------------------

A brand new feature in v7 is Multisite. Multisite allows multiple
PHP-Fusion sites to run completely or partially on one database. Core
database tables are defined in includes/multisite.php. Each v7 infusion
has it's own database table name definition file called infusion_db.php.
You'll need to define your table names in this file (example included. 

Examples of accessing the users table in v6:

$result = dbquery("SELECT * FROM ".$db_prefix."users");

$rows = dbcount("(*)", "users");

This is how it's done in v7:

$result = dbquery("SELECT * FROM ".DB_USERS);

$rows = dbcount("(*)", DB_USERS);