THE CLASS ITSELF
File: cart-boxx/index.php
Description: The Cart Boxx base engine, a $_CB object of class CartBoxx will be initiated in index.php by default.
THE BASICS
Description: Loads all the configuration and connect to database.
Description: Creates a standard JSON system message. Used in every function and API call.
[STRING] $module – Related module
[STRING] $msg – Message to display
[ARRAY/STRING] $more – More information, for example, array of user data.
[BOOL] $halt – Halt the process and throw out system message? Default false.
None, but will set $_CB->sysmsg used in API calls and processes.
- cb-status – 1 for success, 0 for fail
- cb-mod – The related module that caused an error or responded successfully
- cb-msg – The system/error message
- cb-more – Container for extra data, for example, user data on an API call to fetch users
Description: Checks if Cart Boxx already has extended the specified module.
Description: Extend specified module to Cart Boxx. Will look for the physical file in cart-boxx/core/lib/LIB-$branch.php, extend it to $_CB->$branch = new $branch().
THE BASICS
Description: Get/set system config from database
[BOOL] $set – If true, will directly define(CONFIG_KEY,CONFIG_VALUE). If false, this function will return the config values in an array.
[ARRAY] If $set is false, this will return an array of config data.
Description: Get config by key
Description: Update the configuration in the database
CRYPTO
Description: Encrypts the given plain text – Use this for passwords and sensitive data.
[STRING] $cipher – Encryption method to use. Default AES-128-ECB.
[STRING] $key – Secret Key. Defaults to SECRET_KEY set in config.php
Description: Decrypts the given cipher text.
[STRING] $cipher – Encryption method to use. Default AES-128-ECB.
[STRING] $key – Secret Key. Defaults to SECRET_KEY set in config.php
EVERYTHING ELSE
Description: Sends an email
[STRING] $subject – Subject of email
[STRING] $msg – The email message
[BOOL] $debug – If true, will save to a file cart-boxx/mail.txt. Default false.
Description: Creates a random string.
Description: For pagination use – Calculates the total number of pages.
[INT] PER_PAGE must be defined
Description: Used for pagination, automatically generates a trailing “LIMIT X,Y” SQL.
[INT] PER_PAGE must be defined
$page = 2;
$sql = “SELECT * FROM `users`”;
$sql .= $_CB->slimit(2);