From 1abaff0cc3e126b87491c83d240257f860b62c15 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 31 Dec 2005 08:44:58 +0000 Subject: [PATCH] Adding field requirement checker --- kernel.php | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/kernel.php b/kernel.php index ad59498..823b896 100644 --- a/kernel.php +++ b/kernel.php @@ -227,7 +227,7 @@ class Shared_Object_Framework var $fields = array( 'sourcepath' => array(REQ_YES, 'fetch_sourcepath', false), 'apppath' => array(REQ_YES, 'fetch_sourcepath', false), - 'webpath' => array(REQ_YES, 'fetch_sourcepath', false), + 'webpath' => array(REQ_NO, 'fetch_sourcepath', false), 'application' => array(REQ_YES, null, false), 'appversion' => array(REQ_NO, null, false), 'debug' => array(REQ_NO, null, false) @@ -327,6 +327,42 @@ class Shared_Object_Framework } } + // ################################################################### + /** + * Makes sure that all of the required fields in ISSO are set before + * any action is done. This will throw an error block describing + * the fields that need to be set if any are missing. + * + * @access protected + */ + function check_isso_fields() + { + $missing = array(); + foreach ($this->fields AS $name => $field) + { + if ($field[0] == REQ_YES AND $field[2] == false) + { + $missing[] = $name; + } + } + + if (count($missing) > 0) + { + $error = 'You are missing required ISSO fields. Please make sure you have set:' . "\n"; + $error .= ''; + + $this->message('Missing Fields', $error, 3); + exit; + } + } + // ################################################################### /** * Prepares a path for being set as the sourcepath @@ -360,6 +396,8 @@ class Shared_Object_Framework */ function &load($framework, $asobject, $globalize = false) { + $this->check_isso_fields(); + // set the object interlock if (!method_exists($GLOBALS['isso:null-framework'], 'load')) { -- 2.22.5