Basic Enterprise Application Realm

Basic Enterprise Application Realm Documentation

  • 1 PHP Reference
    • 1.1 Introduction
    • 1.2 shared_lib.php
    • 1.3 ac_tables.php
    • 1.4 ac_email.php
  • 2 Javascript Reference
    • 2.1 Introduction
    • 2.2 ac_ajax
    • 2.3 ac_event
    • 2.4 ac_filter
    • 2.5 ac_menu
    • 2.6 ac_panel
    • 2.7 ac_select
    • 2.8 ac_toc
  • 3 Forms
    • 3.1 Introduction
    • 3.2 How It Works
    • 3.3 AJAX
    • 3.4 form_processor_v2
    • 3.5 form_processor

1.1 Introduction

January 22nd, 2026

BEAR is built on PHP without any additional customised modules. However, a design goal is to enforce a consistent and highly supportable framework through the use of several shared libraries with user-facing content suffixed with .acx. The framework provides native support for a number of features. Features of the PHP framework include:

  • User-facing content is PHP files suffixed with the .acx extension. Non user-facing code files should still use the .php extension.
  • Extended use of shared memory for fast access to resources such as includes and configuration data.
  • Handling for multilingual site structures.
  • Secure and flexible SQL driven user session tracking.
  • RBAC (Role Based Access Controls).
  • Predefined interface for form validation.
  • System to system connectivity via the SWAPI protocol.
  • Detailed event logging.
  • User defined tracing.
  • Consistent user-facing page header and footer output.

This reference provides information on the functions and classes that are part of BEAR in addition to some best practices and guidelines.

BEAR is flexible enough to allow users to write PHP in any way they wish without the use of any of the built-in libraries. In that respect, BEAR can be used as a simple web server with PHP.

1.1.1 Location of the PHP shared library

The PHP library is made up of a master library file located in the CGI directory of the BEAR application server at /bear/web_applications/cgi/shared_lib.php/ and several other files located in the shared library directory at /bear/web_applications/cgi/shared_lib. PHP already knows to look for files in the CGI directory so references to include PHP class files do not require absolute paths. For example, regardless of the location of a user-facing .acx page in your site structure, you can always include the main shared library with the code:

include_once('shared_lib.php');

Or you can include one of the other shared library files like this:

include_once('shared_lib/ac_tables.php');

1.1.2 A note about shared_lib.php

This is the backbone of BEAR and there are few classes that can function without it. Therefore it has been pre-included in those files. Generally, you only need to include this file if your code does not reference another class that already calls it. If in doubt, you can reference it with the following code which will load it only if it has not already been loaded:

include_once('shared_lib.php');

Because session handling is handled by shared_lib.php, this file (or a class file that references it) must be loaded before the first byte of data is sent to the browser.

1.1.3 PHP Classes

The following classes are fully documented and considered ready for general use.

Class Introduced Functionality
shared_lib 2007-04-22 Provides user tracking with RBAC controls; event logging; tracing; access to shared memory and more.
ac_config 2019-08-17 Manages arbitrary application settings that require a large number of configuration options with backup, restore, and shadow copies.
ac_datetime 2011-12-22 Locale specific handling of dates and timestamps for any calendar . Never get incorrectly formatted or bad time zone offset again.
ac_email 2015-02-10 Multilingual email transmission with support for email templates, attachments, HTML and plain text.
ac_flat_file_parser 2019-12-25 Parses flat files of any size to extract data. Copes with multi line and variable line records. This is the toolbox for any complex flat file.
ac_graphs 2013-01-01 Draws graphs and charts from a supplied data set and generates PNG data.
ac_markdown 2021-09-12 Powerful markdown rendering to HTML with customizable style sheets.
ac_tables 2013-11-20 Lightweight non SQL based session-less database. Supports locking, password protection, and simple queries on portable table files up to 2GiB. Greatly raises the threshold at which a full RDBMS is required.
error_handler 2013-11-02 Handles errors according to preconfigured macros for distributing to email or syslog.
form_processor 2015-02-17 The backbone of handling form submission processing and status changes. This handles the backend generic portion of form processing that is not client (GUI, API etc) aware.
html_forms 2015-02-17 Interprets data from form_processor for browser-based clients.
sql 2013-11-15 Fully managed abstraction layer for interfacing with MySQL/MariaDB with built-in transaction handling.
swapi_c 2015-03-08 A client for making SWAPI calls like local functions.
swapi 2013-10-16 exposes any local function as a SWAPI API function.
write_ini_file 2013-10-27 Does exactly what it says. Takes any array between 1 and 2 levels deep and converts it to an INI file.
previous: none next: shared_lib.php