1 - Command Interface

Connect to MySQL or MariaDB in DbFace

DbFace Command Interface

2 - Configuration

DbFace provides many configuration items to make it work as you like.

DbFace provides many configuration items to make it work as you like.

You can change the logo at the left top area. The default is text: DbFace. Image (HTML code) is allowed here. for example:

<img src="//www.dbface.com/logo.png"/>

will place the logo image at the left top.

Language

We are working on supporting more languages now.

If you want DbFace supports your local language, you can download the language file and translate every entries into your language, and sent it to support@dbface.com. After confirmation, we will make this language file to your DbFace instance.

IP Whitelist


If your have a fixed IP or IP ranges, we recommend you set the IP whitelist. After setting the white list, the non-white list IP addresses access to your account or sub-account will be rejected. To set or modify the whitelist, please log in as an administrator, the current user information click on the small window in the upper right corner of the “Settings” button to open the “System Settings” tab, Fill IP whitelist, save the changes take effect.

192.168.0.1-192.168.0.24,211.157.2.99′

you may have known, only 192.168.0.1 ~ 192.168.0.24 and 211.157.2.99 allowed to access the service.

The ip whitelist supports different formats. Network ranges can be specified as:

  1. Wildcard format: 1.2.3.*
  2. CIDR format: 1.2.3/24 OR 1.2.3.4/255.255.255.0
  3. Start-End IP format: 1.2.3.0-1.2.3.255

!!! note If you set your current IP to non-whitelist eventually, you will not be able to access DbFace. Please contact support@dbface.com to request to reset your whitelist information.

Skin

You can choose 12 color skins. Try them and choose the skin you like.

The default menu position is left, you can also make the menu at top position.

Welcome page

Welcome page is used for Users sub accounts. You can also set an application report in the welcome page.

Embed Protection key

At some cases, you need protection for embedded charts. Ideally should be option so checks if authenticated. Only want logged in sessions on you site to see embedded. However don’t want to have users go to dbface but instead should be through our admin backend on site.

You can open config/config.inc.php file, and edit

$config['embed_session_key'] = FALSE;

to

$config['embed_session_key'] = 'YOUR-PROTECTION-KEY';

You need to add the following key into session to allow your website to embed dbface applications

$_SESSION['_EMBED_KEY'] = 'YOUR-PROTECTION-KEY';

This configuration only available on On-premise version.

Disable SQL Edit application

SQL Edit application allow you create application that modify database tables vis SQL Query, if you do not want this application feature, you can disable in server configuration file.

Open config/config.inc.php and edit:

$config['disable_sql_edit_application'] = TRUE;

Disable PHP application

PHP application allows you create applications that can do anything on your webserver. You might want to disable this feature for security reason.

Open config/config.inc.php and edit:

$config['disable_phpreport'] = TRUE;

Disable public access parameters

You can enable access global parameters defined in DbFace publicly. If you do not want this feature, you can disable in the server config file.

Open config/config.inc.php and edit:

$config['disable_public_access_parameters'] = TRUE;

config/hooks.php

We also provides many options to allow you customization on the server side. You can open config/hooks.php file and write your own hook functions to customize the DbFace behavior.

_hook_fc_start_

This function allows you inject any initialize code into DbFace.

function _hook_fc_start_() {
  date_default_timezone_set('America/Los_Angeles');
  define('ENVIRONMENT', 'production');
}

config/functions.php

Define your functions in config/functions.php, all functions defined in this file can be accessed in cloud codes or PHP report applications.

<?php
  // define your custom functions here
  // all functions can be used in the Cloud Code
  

3 - Context Selector

Connect to MySQL or MariaDB in DbFace

4 - Data Dictionary

Connect to MySQL or MariaDB in DbFace

5 - DbFace Plugins

Connect to MySQL or MariaDB in DbFace

Plugins

A plugin is a piece of software containing a group of functions that can be added to a DbFace application. They can extend functionality or add new features to your DbFace applications.

DbFace plugins are written in the PHP programming language and integrate seamlessly with DbFace.

Register Plugins

At the Settings Panel, switch to Script tab, and click Application Plugin to list all available plugins. register dbface plugins

Create Plugin

How Plugins works?

Each DbFace application plugin contains a getSubscribedEvents function, DbFace will call this function to initialize the plugin, and call the event function when executing at that point in core. Here is an example.

<?php
class HelloworldPlugin extends Plugin {
  public static function getSubscribedEvents()
    {
        return [
            'onAppQueryResult'  => ['onQueryResult', 0],
            'onPageInitialized' => ['onPageInitialized', 0],
            'onPageEnd' => ['onPageEnd', 0],
            'onShutDown' => ['onShutDown', 0]
        ];
    }

    function onPageInitialized($event) {
      return $event;
    }
    
    function onPageEnd($event) {
      return $event;
    }
    
    function onShutDown() {
    }
    
    function onQueryResult($event) {
      $fields = $event->offsetGet('fields');
      $data = $event->offsetGet('data');
      
      // append fields
      $new_data = array();
      foreach($fields as $field => $v) {
        $new_data[$field] = 'test';
      }
      $data[] = $new_data;
      
      $event['data'] = $data;
     
      return $event;
    }
}

Plugin Hooks Interface

When DbFace running at a specific point in the execution of Core, DbFace will fire an event to run plugins. Plugins can hook at this point, get all data in event parameter, modify data, and write back the modified data into the event return object.

onApplicationInitialized

onPluginInitialized

onAppTemplateInitialized

onAppQueryResult

Use this hook to modify the result set of application query result. The following plugin will modify all data to test. You can also append new field at this point.

function onQueryResult($event) {
  $fields = $event->offsetGet('fields');
  $data = $event->offsetGet('data');
  
  // append fields
  $new_data = array();
  foreach($fields as $field => $v) {
    $new_data[$field] = 'test';
  }
  $data[] = $new_data;
  
  $event['data'] = $data;
  
  return $event;
}

onSortFields

Use this hook to sort fields for tabular report.

onChartData

onShutDown

6 - Extra Tools

Connect to MySQL or MariaDB in DbFace

DbFace brings a set of built-in tools to help you make applications easier.

7 - SQL workshop

Connect to MySQL or MariaDB in DbFace

Many DbFace users request to add a SQL workshop for database connections, so they can test SQL scripts on the fly. you can find SQL Workshop in the database connections section.

Here is a video that shows how the SQL workshop work.

Open SQL workshop

To open SQL workshop, click the “SQL Workshop” button in the connection list table. Open SQL workshop in DbFace

You will enter the SQL workshop page. SQL workshop in DbFace

SQL Terminal

Click this button to open the SQL Terminal tool, SQL Terminal provides a easy way to fire SQL query.

Query Builder

Quer builder helps you drag to generate SQL query, so you do not require handy work to create SQL query.

Publish

Publish the SQL Query to exchange marketplace, so you can pick it later in the application builder interface.

Tag SQL Query

You can name the SQL query in the SQL Editor. All named SQL Queries will be listed in the tagged group. Double click the SQL query in the tagged group will copy the SQL Query into the SQL Editor. SQL workshop in DbFace

You can pick out the Tagged SQL query in the application builder page in the Script Library dialog.

8 - config.inc.php

Raw configuration for webmaster.

The config.inc file

The config.inc file, found in your user/data directory contains special settings for to your own DbFace installation. This file is unique to your installation and it’s the only file in the script that you need to edit.

!!! tip “Enterprise Plan” If you are using Enterprise Plan, please edit the config.inc.php file and send to support@dbface.com. We will be arranged to upload the config.inc.php file to your DbFace installation.

; ini file to config dbface installation
// Auto detect the Base URL
$config['dbface_app_url_base'] = FALSE;
// use the default timezone
$config['default_timezone'] = date_default_timezone_get();
// the default schema cache is never expired (seconds) 0: disable cache
$config['cache_schema'] = 3600;
// report never auto expired (seconds), 3600 means 1 hour, 0: disable cache
$config['cache_app'] = 3600;
// the sql query cache ttl
$config['cache_sql_query'] = 600;
// the app process will be termiated 60s
$config['ExecTimeLimit'] = 60;
// Max memory 64M for each app execution
$config['MemoryLimit'] = "64M";
// the generate app access URL ttl, false: never expired, number: timeout to expired
$config['ttl_access_url'] = FALSE;
// hide the online support widget
$config['enable_onlinesupport'] = TRUE;
// if use the database to store session data
$config['sess_use_database']	= FALSE;
if ($config['sess_use_database']) {
  $config['sess_save_path'] = 'df_sessions';
} else {
  // session save path, comment this, if you want use the default folder in php.ini
  $config['sess_save_path'] = FCPATH.'user'.DIRECTORY_SEPARATOR. "cache";
}
// default category name
$config['default_category_name'] = 'Default';
// default data category name
$config['default_data_category_name'] = 'Data';
// menu style: normal or horizontal
// you can also overwrite this settings in System Settings (dropped)
$config['menu_style'] = 'normal';
// Use your Google Appkey to generate Google Map
$config['google.appkey'] = 'AIzaSyBImzyugJzPWt1cQC0bWbUznaVUIc805eU';
// the max rows for picked sample data
$config['max_sample_rows'] = 100;
// Enable error_report, the error does not include any app data
$config['enable_error_report'] = TRUE;
// define the default title of DbFace
$config['df.title'] = 'DbFace - Online Application Builder for Any Data Source.';
// the assets URL
if ($config['production']) {
  $config['df.static'] = "//d3krtd5frfbrx5.cloudfront.net/assets/v79";
  // thirdparts assets URL, set this to gain better performance
  $config['assets_base_url'] = '//d3krtd5frfbrx5.cloudfront.net/assets/v79';
} else{
  $config['df.static'] = "./static";
  // thirdparts assets URL, set this to gain better performance
  $config['assets_base_url'] = './static';
}
$config['product_assets_url'] = '//d3krtd5frfbrx5.cloudfront.net/assets/v79';
// DbFace will use third part cdn to improve js loading performance
$config['use_assets_cdn'] = TRUE;
// product base URL, if FALSE, we will detect automatically based on the installation
$config['product_base_url'] = FALSE;
// checkpoint max_size bytes
$config['cp_max_size'] = 1024;
// enable / disable gravatar
$config['enable_gravatar'] = TRUE;
// disable PHP report
$config['disable_phpreport'] = FALSE;
// hide edit application
$config['disable_sql_edit_application'] = FALSE;
$config['disable_public_access_parameters'] = FALSE;
$config['Access-Control-Allow-Origin'] = FALSE;
// DbFace only access public schema, you can also switch to other schema for pgsql database only
// Since V6.6, you can add schema option for pgsql database
$config['pgsql_default_schema'] = FALSE;
// if password mismatch 3 times, the ip will blocked 24 hours, set FALSE disable this feature
$config['daily_retry_login_times'] = 50;
$config['daily_retry_login_time_duration'] = 86400;
// the max num of last opened apps
$config['history_app_num'] = 6;
// max favorite num
$config['favorite_app_num'] = 10;
// enable ipwhitelist, set to FALSE to disable ip whitelist check
$config['enable_ipwhitelist'] = TRUE;
// If you want to use DbFace to create database for you, enable this
// let dbface create database in your hostdb
$config['enable_createdatabase'] = TRUE;
// AUTO: for self host, dbface will use sqlite3, otherwise will use the hostdb conguration.
$config['hostdb'] = 'AUTO';
// whether creating new database user for the newly created database
$config['create_sperated_user_for_hostdb'] = TRUE;
// the created database user host, % for any location, or set ip address for security
// $config['hostdb_user_host'] = 'localhost';
// predefined variables
$config['predefined_variables'] = FALSE;
// Login logo settings
// position: left | right | center | hidden, hidden will hide the navbar at login page
// array(
//   'url' => '//www.dbface.com',
//   'position' => 'right',
//   'img' => $config['df.static'].'/website/dbface_logo.png'
// );
$config['login_logo_settings'] = FALSE;
// Additional css files (for remote customization theme)
// you can get the css url from DbFace Support Team (Licensed User + Gold Support)
// the css file will include to override the default style
$config['customer_additonal_css'] = FALSE;
// default tooltip border width
$config['chart_tooltip_border_width'] = 1;
// allow forget password on the login page for all users
$config['allow_reset_password_on_premise'] = TRUE;

// USE CAUTIOUS
// force reset the username & password to this entry string
// if you have forgot the admin password, please set this entry to reset password
// and do not forget recover to false 
// sample
// $config['force_reset_accounts'] = array(
//   array('email'=> 'admin@dbface.com', 'passowrd'=> 'my new password')
// );
$config['force_reset_accounts'] = FALSE;
// MongoDb list collection parameters
$config['mongo_options_listCollection'] = array(
);
// crontab schedule date timezone
$config['crontab_schedule_timezone'] = date_default_timezone_get();
// crontab execution key
$config['crontab_execution_key'] = '6193rW3iTjXo7N3S27t2I2GA6OJjo03S';
// world map name map
$config['worldmap_namemap'] = array(
);
// The email settings for sending reports or notification
// The function mail() in Cloud Code also use this settings
// we already binding a public smtp settings, if it not work for you, please use your own 
// mail server settings
// uncomment the email_settings email_settings_from will override the default smtp server
/*
$config['email_settings'] = array(
  'useragent'	=> 'dbface',
	'protocol'=> 'mail',
  'mailpath' => '/usr/sbin/sendmail',
	'smtp_host'=> '',
	'smtp_user'=> '',
	'smtp_pass'=> '',
	'smtp_port' => '25',
  'crlf' => '\r\n',
  'newline' => "\r\n",
  'mailtype' => 'html',
  'smtp_crypto' => "ssl",
  'validate' => false,
  'charset' => 'utf-8',
  'wordwrap' => true
);
*/
$config['email_settings_from'] = array(
  'from'=> 'support@dbface.com',
  'name'=> 'DbFace',
  'reply' => 'support@dbface.com'
);
// capture service URL
// If you have Gold Support, you can use your own capture service
$config['capture_service_url'] = "http://capture.dbface.com:8891/";
// capture app access key
$config['app_access_key'] = 'dbface@accesskey!j';
// default ttl (seconds) for URL parameter
$config['default_parameter_ttl'] = 3600;
// check update automatically
$config['check_update'] = TRUE;

// internal db that store mongodb and plugin cached data
// set to FALSE to use the default sqlite3 implementation
// The user should be able to create new database
/*
$config['internal_cache_db'] = array(
  'dsn'	=> '',
  'hostname'=> 'cache_db_host',
  'username'=> 'root',
  'password'=> '',
  'database'=> 'mysql',
  'dbdriver' => 'mysqli',
  'dbprefix' => '',
  'pconnect' => TRUE,
  'db_debug' => TRUE,
  'cache_on' => FALSE,
  'cachedir' => '',
  'char_set'=> 'utf8',
  'dbcollat' => 'utf8_general_ci',
  'swap_pre' => '',
  'autoinit' => FALSE,
  'stricton' => FALSE,
  'failover' => array()
);
$config['internal_cache_db_by_connid'] = array(
);
*/
$config['internal_cache_db'] = FALSE;
// enable Tsv format, use excel to open the csv file, use UTF-16LE encoding, if set to FALSE, use UTF-8
$config['csv_excel_compatible'] = TRUE;
if ($config['csv_excel_compatible']) {
  $config['export_csv_settings'] = array(
    'delimiter' => "\t",
    'newline' => "\n",
    'enclosure' => '"'
  );
} else {
  $config['export_csv_settings'] = array(
    'delimiter' => ",",
    'newline' => "\n",
    'enclosure' => '"'
  );
}
// enable or disable command api, default FALSE
// command api allow user to create account or other jobs via /cmd/action URL
$config['enable_command_api'] = FALSE;
// This field should not empty if enabled command api, appenc key=$command_security_key to let DbFace protect the command api
$config['command_security_key'] = '';
// check user access app permission
$config['strict_check_user_permission'] = TRUE;
// Form date and datetime format
$config['form_date_format'] = 'YYYY-MM-DD';
$config['form_datetime_format'] = 'YYYY-MM-DD HH:mm:ss';
// disable google analytics
$config['disable_analytics'] = TRUE;
// invite colleage email subject
$config['invite_colleages_subject'] = 'Welcome to DbFace - It is amazing to have you on board!';
// app max revision
$config['max_app_revision'] = 50;
// use this config to encrypt the connection password
// set to FALSE, will use plain text to store the connection password
$config['db_password_encrypt'] = TRUE;
// use for encrypt/decrypt the connection password, if FALSE or empty, people will find the database connection password without encrypt in sqlite3 file
$config['connection_encrypt_key'] = 'dbface.conn.2018';
// enable/disable dbface api
$config['feature_dbface_api'] = TRUE;
// enable context selector in the menu bar
// administrator and developer can select connection id as context
$config['enable_conn_context_selector'] = TRUE;
// cron job executor: pageview or crontab (default crontab)
$config['cronjob_executor'] = 'crontab';
// cron job executor interval seconds
$config['cronjob_executor_interval'] = 600;
// enable mobile access
$config['enable_mobile_viewer_access'] = TRUE;
// account access url ttl
$config['account_access_url_ttl'] = 86400;
//
$config['chain_app_access_key'] = '6193rW3iTjXo7N3S27t2I2GA6OJjo03S';
// email titles
$config['email_title_forgotpassword'] = 'DbFace password';
// use estimate row count for mysql innodb large tables
$config['estimate_table_rows_for_innodb'] = FALSE;
// directory for saving snapshots, FALSE: disable this feature
$config['snapshot_dir'] = USERPATH.'snapshots'.DIRECTORY_SEPARATOR;
// proxy to connect remote database, used in connected: Google Big Query
$config['https_proxy'] = '127.0.0.1:1080';
// Table Row Action Header
$config['row_actions_header'] = 'Actions';
// IP2LOCATION_DATABASE
define('IP2LOCATION_DATABASE', USERPATH . 'data'.DIRECTORY_SEPARATOR.'IP2LOCATION-LITE-DB3.BIN');

9 - Customization

Page customization.

Header Template

You can define javascript code, javascript includes, style codes in Header template to customize and extend DbFace. DbFace will simply include the header template content in HEAD tag.

!!! Tip Style codes in header template will overwrite the default settings.

Header template : customization in DbFace

To define your own Header template

  • STEP1: Expand the Settings menu
  • STEP2: Click “Customization” menu
  • STEP3: Edit the Header Template
  • STEP4: Click the “Save Changes” button to save your header template.

How to save header template in DbFace

Functions(javascript)

Functions section allows you define your own javascript codes for DbFace. These functions are loaded globally, it means you can use them in every applications.

Define javascript functions in DbFace

To define your own Javascript Functions

  • STEP1: Expand the Settings menu
  • STEP2: Click “Customization” menu
  • STEP3: Select the “Functions(Javascript Tab)” and enter your code there
  • STEP4: Click the “Save Changes” button to save your Functions.

We do not offer CSS/Javascript support or training directly, but there are a TON of great resources on the web to get you started into learning more about HTML, CSS and Javascript. There is a learning curve, but they are very valuable and reusable skill.

!!! tip “Tips & Tricks” You can find more tips and tricks for customization at our knowledge base.

10 - Backup & Restore

DbFace backup and restore.

All your works in DbFace are saved in user directory. For on-premises installation, you can simply backup and restore user directory to continue all the work in DbFace.

Backup DbFace

For On-premises installation and Enterprise plan, you can backup all your work in DbFace and restore it later.

To get started, click the Preference menu in the left, select the “System Settings” tab, scroll to the “Backup & Restore” section. Backup and restore dbface pane Click “Download Backup” button, DbFace will generate a zip file that contains all your work in DbFace, save the zip file locally.

Restore DbFace

At the “Backup & Restore” pane, click the “Select files” button and choose a backup file of DbFace. DbFace will restore to the backup state.

Please notice, all your work in DbFace after the backup date will be lost.

11 - Database Structure

Database Structure.