38 lines
826 B
PHP
38 lines
826 B
PHP
<?php
|
|
// File name: formreg.inc.php
|
|
// Description: PHP subroutine to handle form registry
|
|
// Date: 2006-11-14
|
|
// Author: imacat <imacat@pristine.com.tw>
|
|
// Copyright: Copyright (C) 2004-2007 Pristine Communications
|
|
|
|
// Settings
|
|
$_FORMREG = array();
|
|
|
|
// register_form: Register a form
|
|
function register_form($form, $path)
|
|
{
|
|
global $_FORMREG;
|
|
// The counter
|
|
static $n = 0;
|
|
// Define the form
|
|
if (!defined($form)) {
|
|
// Find the next index that is not used
|
|
while (array_key_exists($n, $_FORMREG)) {
|
|
$n++;
|
|
}
|
|
define($form, $n);
|
|
}
|
|
$_FORMREG[$n] = $path;
|
|
return;
|
|
}
|
|
|
|
// get_registered_form: Get a registered form
|
|
function get_registered_form($form)
|
|
{
|
|
global $_FORMREG;
|
|
return array_key_exists($form, $_FORMREG)?
|
|
$_FORMREG[$form]: null;
|
|
}
|
|
|
|
?>
|