Documentation is available at module_functions.php
- <?php
- function system_start() {
- //performs system startup
- if( !function_exists( 'allowed' ) ) {
- function allowed() { return true; }
- }
- $GLOBALS['errorArray'] = array();
- if( !isset($GLOBALS['core'] ) ) {
- $GLOBALS['core'] = new core;
- $GLOBALS['core']->preload();
- }
- //perform startup for each active module
- $activeModules = $GLOBALS['core']->core_get_active_modules();
- if( count($activeModules) ) {
- foreach( $activeModules as $module ) {
- if( $module['module_name'] != "system_beta_1" && function_exists( $module['module_name']."_start" ) ) {
- eval( $module['module_name']."_start();" );
- }
- if( $module['module_name'] != "system_beta_1" && function_exists( $module['module_name']."_process_post" ) ) {
- eval( $module['module_name']."_process_post();" );
- }
- }
- }
- //system data handling
- system_beta_1_process_post();
- }
- function system_beta_1_module_info() {
- //returns information about the system module
- $object_types['type_set']['table_name'] = 'type_sets';
- $object_types['type_set']['name'] = 'type sets';
- $object_types['type_set']['description'] = 'FIX ME!!!';
- $object_types['type_set']['class_name'] = 'type_set';
- $object_types['type_set']['table'] = array( 'id'=>'int', 'relationship_typeID'=>'int', 'primary_constraintID'=>'int', 'secondary_constraintID'=>'int', 'bi_directional'=>'bool' );
- $object_types['constraint']['table_name'] = 'constraints';
- $object_types['constraint']['name'] = 'constraints';
- $object_types['constraint']['description'] = 'FIX ME!!!';
- $object_types['constraint']['class_name'] = 'constraint';
- $object_types['constraint']['table'] = array( 'id'=>'int', 'name'=>'text', 'description'=>'text', 'object_constraints'=>'text', 'relationship_constraints'=>'text' );
- return array(
- "module_name"=>"system_beta_1",
- "module_description"=>"This is the system module, DO NOT DEACTIVATE except to upgrade to a new system version. Version: Beta 1",
- "module_icon"=>"",
- "module_page"=>"Modules/system_beta_1/system_management.php",
- "module_location"=>"system_beta_1",
- "module_object_types"=> $object_types,
- "system_module"=>"1"
- );
- }
- function system_beta_1_activate_module() {
- //activates the system module
- global $db;
- //locate tables and install if nonexistant
- $db->hide_errors();
- //check object types table
- /*
- $db->get_results("SELECT * FROM object_types");
- if( !$db->col_info ) {
- $db->query("
- CREATE TABLE object_types
- (
- id int,
- name char(30),
- description text,
- table_name text,
- class_name char(30),
- icon text
- )
- ");
- }
- */
- //check system variables table
- $system_settings = array(
- 'table_name' => 'system_settings',
- 'table' => array ( 'name' => 'text', 'value' => 'text' )
- );
- insert_db_table( $system_settings );
- /*
- $db->get_results("SELECT * FROM system_settings");
- if( !$db->col_info ) {
- $db->query("
- CREATE TABLE system_settings
- (
- name text,
- value text
- )
- ");
- //insert initial settings
- $db->query( "
- INSERT INTO system_settings
- VALUES ( 'system_counter', 4 )
- " );*/
- $db->query( "
- INSERT INTO system_settings
- VALUES ( 'object_type_counter', 1 )
- " );
- $db->query( "
- INSERT INTO system_settings
- VALUES ( 'objects_counter', 1 )
- " );
- $db->query( "
- INSERT INTO system_settings
- VALUES ( 'error_log', NULL )
- " );
- //setup object types
- $module_info = system_beta_1_module_info();
- foreach( $module_info['module_object_types'] as $class_name => $object_type ) {
- insert_db_table( $object_type );
- insert_object_type( $object_type );
- /*
- $db->get_results("SELECT * FROM ".$object_type['table_name'] );
- if( !$db->col_info ) {
- $queryString = "CREATE TABLE ".$object_type['table_name']."( ";
- foreach( $object_type['table'] as $field => $fieldType ) {
- $queryString .= $field." ".$fieldType.",";
- }
- $queryString = rtrim($queryString, ",").")";
- $db->query( $queryString );
- $counter = $db->get_var( "SELECT value FROM system_settings WHERE name = 'object_type_counter'" );
- $db->query( "
- INSERT INTO object_types (id, name, description, table_name, class_name, icon )
- VALUES ( '".$counter."', '".$object_type['name']."', '".$object_type['description']."', '".$object_type['table_name']."', '".$class_name."', '' )
- " );
- $db->query( "UPDATE system_settings SET value = '".($counter + 1)."' WHERE name = 'object_type_counter'" );
- }*/
- }
- $GLOBALS['core'] = new core;
- //setup constraints
- $constraintValues = array (
- 'name' => 'is constraint',
- 'description' => 'an object of type "constraint"',
- 'object_constraints' => array( array( 'attribute'=>'type', 'operator'=>'=', 'value'=>'constraints' ) ),
- 'relationship_constraints' => array(),
- );
- $constraint =& new constraint;
- $constraint->verify_set( $constraintValues );
- $db->show_errors();
- $db->query( "UPDATE core_settings SET value = 'Modules/system_beta_1/system_management.php' WHERE name = 'start_page'" );
- return system_beta_1_verify_module();
- }
- function system_beta_1_deactivate_module() {
- //deactivates the system module
- return true;
- }
- function system_beta_1_verify_module() {
- //verifies the integrety of the system module
- return true;
- }
- ?>
Documentation generated on Tue, 24 May 2005 03:58:42 -0400 by phpDocumentor 1.3.0RC3