lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
PHP: New System Driver
Got rid of a lot of junk DNA in my code. Simpler, though you might not know if by looking at it.

<?php

/*
AMVC Project Driver

File: project_driver.inc.php
Version: 0.6.3
Last Update: Nov 2005
Author: Tom Atwell (klenwell@gmail.com)

NOTES:

for load sequence, see bottom

*/


// 1. Project Settings

$_PROJECT['name'] = 'Test';
$_PROJECT['dirname'] = $_PROJECT['name'];
$_PROJECT['live_host'] = 'www.yoururlhere.com';
$_PROJECT['alpha_host'] = 'www.yoururlhere.com';
$_PROJECT['webmaster'] = 'youremail@address.com';


// 2. Start-Up
require_once('_engine/startup.inc.php');

# 2.1. register project name and driver path (must wait until SESSION is opened in startup)
$_SESSION['active_project']['name'] = $_PROJECT['name'];
$_SESSION['active_project']['driver'] = __FILE__; # must be in this file

# 2.2. silent notice
echo "<!-- {$_SESSION['active_project']['name']} buffer open / session started -->\n";


// 3. Driver Stack (support libraries)

$_AMVC['req_pack'] = array
(
'security' => 'security_pack/_driver.inc.php',
'file' => 'file_pack/_driver.inc.php',
'form' => 'form_pack/_driver.inc.php',
'html' => 'html_pack/_driver.inc.php',
'database' => 'dba_pack/_driver.inc.php',
'uas' => 'uas_pack/_driver.inc.php',
'mail' => 'mail_pack/_driver.inc.php',
'graphics' => 'graphics_pack/_driver.inc.php',
'diagnostic' => 'dx_pack/_driver.inc.php'
);


// 4. Load AMVC Hard Config Data and Version
require_once('_engine/version_config.inc.php');


// 5. Auto-Override Configuration
require_once('_engine/auto_override.inc.php');

# NOTE: before loading this driver, assign config file path to : $OVERRIDE['AMVC']['session_config']


/* 6. LOCAL OVERRIDE CONFIGURATION
*******************************/

// LOCAL settings
if ( $_version == 'local' )
{
# dba override
$CONFIG['DB']['deploy'] = 'quick';

# dba quick deploy
$qdb = 'amvc_test';
#$qdbu = '';
#$qdbp = '';
#$qdbs = 'localhost';

# path corrections
$_URL['AGE'] = 'http://' . $_SERVER['HTTP_HOST'] . '/AMVC/__ROOT_AGE/';
#$_URL['img_bin'] = $_URL['root'] . 'AMVC/__ROOT_img_bin/';
#$_URL['css_bin'] = $_URL['root'] . 'AMVC/__ROOT_css_bin/';
#$_PATH['log_bin'] = $_PATH['AMVC'] . '__ROOT_log_bin' . $_slash;
}


// ALPHA settings
elseif ( $_version == 'alpha' )
{
# DBA override

# path corrections
}


// BETA settings
elseif ( $_version == 'beta' )
{
}


// LIVE settings
elseif ( $_version == 'live' )
{
# echo live visitor
$_live_ip = $_SERVER['REMOTE_ADDR'];
$_live_timestap = gmdate('Y-m-d H:i:s', $_AMVC['META']['session_start']);
echo "<!-- $_live_ip @ $_live_timestap GMT -->\n";
}
/******************************/


// 7. Define Site Constants

# version
define('VERSION', $_version);

# root paths
define('ROOT', $_PATH['root']);
define('DOC_ROOT', $_PATH['root']);
define('PROJECT_ROOT', $_PATH['project_root']);
define('AMVC_ROOT', $_PATH['AMVC']);
define('SUPER_ROOT', $_PATH['super']);

# root urls
define('URL_ROOT', $_URL['root']);
define('AGE_URL', $_URL['AGE']);

# bin directories
define('IMG_BIN', $_URL['img_bin']);
define('CSS_BIN', $_URL['css_bin']);
define('LOG_BIN', $_PATH['log_bin']);

# shorthand syntax
define('EOL', $_eol);
define('INC', $_inc);
define('SLASH', $_slash);

# project
define('PROJECT_TITLE', $_PROJECT['name']);
define('WEBMASTER', $webmaster);

# status codes
define('OK', 1);
define('EDIT', 0);
define('BAD', -1);
define('HACK', -9);
define('EVIL', -666);


// 8. Load Support Library

# configured in : _engine/driver_stack.inc.php

# cycle through drivers
foreach ( $_AMVC['req_pack'] as $_req_file )
{
require_once($_req_file);
}

# load flag
$_AMVC['META']['driver_loaded'] = TRUE;

# silent notice
echo "<!-- AMVC project driver loaded at {$_AMVC['META']['session_start']} A.U. (Anno Unixis) -->\n";



/*
AMVC Project Driver Notes

LOAD SEQUENCE:

1. *Project Settings
2. Start-Up
3. AMVC Meta Settings
4. Load AMVC Hard Config File and Set Version Paths
5. Auto Override
6. *Override Config
7. Define Constants
8. Load Support Library

* Editable section -- i.e., this data will vary between projects. The rest
should not.


at present, all rights reserved

*/
?>