Unibase has tclsh linked in to the binaries and Tcl is our preferred scripting language. Note: Other languages can be used, this isn’t exclusive.
Tcl script are supported by a Tcl package called “unibase”. To use this package simply add “package require unibase” at the start of a Tcl script.
All procedures are in the ::unibase namespace or a subspace of it.
Here are the top level namespaces (alphabetically):
- cookie – manage http cookies
 - getflags – process command flags for Tcl scripts
 - http – http helper proceures
 - httpd – httpd helper procedures
 - recaptchav3 – get the recaptcha key for a URL
 - log – log errors or other info to the system logs
 - session – set up and maintain a Unibase session
 - users – get user details for application security
 
Commands (alphabetically with their namespaces):
- ::unibase::getflags {COMMAND FLAGS}
- process command line arguments in a similar format to standard Linux commands.
 - RETURN
- Processed flags in ::UB_FLAGS
 - Unprocessed arguments in ::UB_FLAGS::_GLOBAL
 - return 1 on success
 - return 0 on error
 
 - ERROR
- Print ::UB_FLAGS::_USAGE:
 
 
 - ::unibase::cookie {}
- Manage cookies
 
 - ::unibase::cookie::unset {COOKIE}
- Unset COOKIE
 
 - ::unibase::http
- http helper functions
 
 - ::unibase::http::content {}
- Output an http Content-Type string and cache-control.
 
 - ::unibase::httpd
- Helper functions for cgi scripts
 
 - ::unibase::httpd::argument {FLAG VARIABLE}
- Add VARIABLE to the flags for a command to be called
 
 - ::unibase::httpd::cookies {}
- Put cookies into the environment
 
 - ::unibase::httpd::header {}
- Same as ::unibase::http::content
 
 - ::unibase::httpd::sessionClear {}
- clear session info in preparation for a new session
 
 - ::unibase::httpd::ubqs {QUERY_STRING}
- decode QUERY_STRING
 
 - ::unibase::recaptchav3::get
- get the private key for a Unibase web application
 
 - ::unibase::recaptcahv3::update {URL KEY}
- update the private key for a Unibase web application
 
 - ::unibase::log
- Add something to the system logs
 
 - ::unibase::log::debug {type msg}
- add a message with key to system logs
 
 - ::unibase::log::log {type msg}
- add a message with key to system logs
 
 - ::unibase::session::create {USER APPLICATION}
- create a new user session in the Unibase session directory
 
 - ::unibase::session::destroy {}
- Destroy the current session file
 
 - ::unibase::session::env {}
- put the current session variables into the environment
 
 - ::unibase::session::json {}
- return the current session variables as JSON
 
 - ::unibase::session::valid {}
- check if the current session is valid
 - A session is valid if the session file exists and the last time accessed is less than the “IDLE_TIME” variable in the session
 
 - ::unibase::session::value {VAR} – get value of a session variable
 - ::unibase::session::var {VAR VALUE} – add var VAR to the session with value VALUE
 - ::unibase::users::attribute {USER APPLICATION ATTRIBUTE} – get an attribute from the users table for USER in application APPLICATION
 - ::unibase::users::password {APPLICATION USER PASSWORD} – check a password for a user using APPLICATION
 - ::unibase::users::salt {PASSWORD} – get salt from a password
 - ::unibase::users::update {USER APPLICATION ATTRIBUTE VALUE} – Update the value of an attribute for a user