Getting Started

To start, download the latest version of phpOpenFW. Once unpacked, among the Change_Log and License should be two folders, framework and application. As you may have guessed (hopefully) the "framework" folder contains the core framework components. the "application" folder contains a very simple sample application. Look at the contents of the application and notice the folder structure. I will go into detail later what each is for. At this point you can copy the "application" folder to a place on your webserver to begin testing/development. Before you can begin, however, you must have a copy of the framework on the webserver also. Personally, I think it is easier to simply copy the entire "phpOpenFW" folder to a shared library location on the webserver. For example, if your document root is "/var/www/html", maybe the shared location would be as follows: /var/www/html/Library/php/phpOpenFW. The framework can be bundled inside of any application, however, if all applications on a webserver use the same copy of phpOpenFW, it is easier to update once instead of updating each copy of the framework inside each application.

The phpOpenFW Configuration file (config.inc.php)

In the base of each application that uses phpOpenFW must be the file "config.inc.php". This is the configuration file for this particular application and contains all configuration options and data sources. Please note that any indexes set in the $config_arr variable will automatically be inserted in the $_SESSION variable under the same index.

1.1 - Basic Configuration Parameters

Parameter Description Values Default Required?
frame_path The absolute file path to the "framework" directory for phpOpenFW. -- -- Yes
creator Automatically produces a copyright in the data. (//page/copyright) Any string [Empty] No
nav_sort Determines whether the navigation will be sorted using the directory name or the value of $mod_title, which is set in the local.inc.php file. "dir" or "title" "title" No
nav_xml_format Determines the navigation data output style. "numeric", "rewrite", or "long_url" "numeric" No
modules_dir Instructs the application look for its modules in another specified directory. This parameter allows for multiple applications to be hosted out of the same directory and toggled by parsing the URL. The name of a valid module directory relative to the application root directory. "modules" No
time_zone Sets the current timezone for the application. A valid timezone for use with the date_default_timezone_set() function. "EST" No

1.2 - Authentication Parameters

Parameter Description Values Default Required?
auth_data_source The name of the data source to use for authentication. The name of a valid data source or "none" -- Yes
auth_user_table The name of the database table to use for authenticating user logins. -- -- Yes, if data source authentication is being used.
auth_user_field The name of the user ID field to use during authentication. -- -- Yes, if data source authentication is being used.
auth_pass_field The name of the password field to use during authentication. -- -- Yes, if data source authentication is being used.
auth_fname_field The name of the field from which the currently logged in user's first name is stored. -- -- Yes, if data source authentication is being used.
auth_lname_field The name of the field from which the currently logged in user's last name is stored. -- -- Yes, if data source authentication is being used.
add_to_where Adds an additional filter ability for authentication using MySQL or PostgreSQL. A valid SQL "and" clause. (Ex. " and disabled != 1") [Empty] No

1.3 - Data Sources

phpOpenFW can handle multiple data sources, which can be predefined in the configuration file. Please see the sample configuration file below for examples on setting up data sources.

1.4 - Sample config.inc.php


<?php
//*****************************************************
//*****************************************************
// General Settings
//*****************************************************
//*****************************************************

$config_arr = array();

// Path to Framework Directory
$config_arr["frame_path"] = "/var/www/html/Library/php/phpOpenFW/framework";

// Site Title
$config_arr["site_title"] = "Example Title";

// Creator of Site
$config_arr["creator"] = "(Your Company Hear)";

// Theme
$config_arr["theme"] = "default";

// Nav Sort (Values: "dir" or "title" (default))
$config_arr["nav_sort"] = "title";

// Nav XML Format (Values: "numeric" (default), "rewrite", or "long_url")
$config_arr["nav_xml_format"] = "numeric";

// Toggle Error Displaying
ini_set('display_errors'"On");

//*****************************************************
//*****************************************************
// Authentication
// Login Settings
//*****************************************************
//*****************************************************


**** ONLY ONE SET OF AUTHENTICATION PARAMETERS CAN BE USEDALL THREE
**** ARE PROVIDED HERE AS EXAMPLES OF EACH.

//=============
//=============
*** NONE
//=============
//=============

// Data Source to use for authentication
$config_arr["auth_data_source"] = "none";


//=============
//=============
*** LDAP
//=============
//=============

// Data Source to use for authentication
$config_arr["auth_data_source"] = "sample_ldap_ds";

// Database Authentication Parameters
// Users Table, User ID field, and User Password field.
$config_arr["auth_user_table"] = "cn=users,cn=directory";
$config_arr["auth_user_field"] = "uid";
$config_arr["auth_pass_field"] = "userpassword";
$config_arr["auth_fname_field"] = "cn";
$config_arr["auth_lname_field"] = "sn";


//=============
//=============
*** MySQL
//=============
//=============

// Data Source to use for authentication
$config_arr["auth_data_source"] = "sample_mysql_ds";

// Database Authentication Parameters
// Users Table, User ID field, and User Password field.
$config_arr["auth_user_table"] = "users";
$config_arr["auth_user_field"] = "userid";
$config_arr["auth_pass_field"] = "password";
$config_arr["auth_fname_field"] = "first_name";
$config_arr["auth_lname_field"] = "last_name";

//=============
//=============
*** PostgreSQL
//=============
//=============

// Data Source to use for authentication
$config_arr["auth_data_source"] = "sample_pgsql_ds";

// Database Authentication Parameters
// Users Table, User ID field, and User Password field.
$config_arr["auth_user_table"] = "users";
$config_arr["auth_user_field"] = "userid";
$config_arr["auth_pass_field"] = "password";
$config_arr["auth_fname_field"] = "first_name";
$config_arr["auth_lname_field"] = "last_name";

//*****************************************************
//*****************************************************
// Data Sources
//*****************************************************
//*****************************************************

// 1. source name
// 2. type        (ldap, mysql, mysqli, pgsql, oracle, mssql)
// 3. server
// 4. port        (389, 3306, 5432)
// 5. source (table or directory)
// 6. user
// 7. password


$data_arr = array();

//*****************************************************
//*****************************************************
// LDAP Directory
//*****************************************************
//*****************************************************

$i "sample_ldap_ds";
$data_arr[$i]["type"] = "ldap";
$data_arr[$i]["server"] = "ldap.example.com";
$data_arr[$i]["port"] = 389;
$data_arr[$i]["source"] = "dc=example,dc=com";
$data_arr[$i]["user"] = "cn=admin,dc=example,dc=com";
$data_arr[$i]["pass"] = "ldap_pass";

//*****************************************************
//*****************************************************
// PostgreSQL Database
//*****************************************************
//*****************************************************

$i "sample_pgsql_ds";
$data_arr[$i]["type"] = "pgsql";
$data_arr[$i]["server"] = "db.example.com";
$data_arr[$i]["port"] = 5432;
$data_arr[$i]["source"] = "db_name";
$data_arr[$i]["user"] = "db_user";
$data_arr[$i]["pass"] = "db_pass";

//*****************************************************
//*****************************************************
// MySQL Database
//*****************************************************
//*****************************************************

$i "sample_mysql_ds";
$data_arr[$i]["type"] = "mysql";
$data_arr[$i]["server"] = "db.example.com";
$data_arr[$i]["port"] = 3306;
$data_arr[$i]["source"] = "db_name";
$data_arr[$i]["user"] = "db_user";
$data_arr[$i]["pass"] = "db_pass";

?>