BillingFox advanced functions

BillingFox advanced functions allows you to use more functions in your hosting billing software installation

Choose a documentation section.

BillingFox advanced functions can help you customize your hosting website faster.

Get current user ID.

You can use the session variable $_SESSION['user_id']. This will return current the user ID.

Copy to clipboard
// Example: <?php $user_id = $_SESSION['user_id']; echo $user_id; ?>
 

Get user information.

Copy to clipboard
// Example: <?php $user_info = getUserVar($_SESSION['user_id']); echo $user_info['username']; ?>

The function getUserVar($USER_ID) will return an associative array with specified user information.

Function parameters
Parameter Type Description
User ID Integer This parameter represents the user ID.
Items in returned array of getUserVar(...):
Item Type Description
user_id Integer This item represents the user ID.
user_id Integer This item represents the user ID.
email String This item represents the user email address.
user_type String This item represents the user type (usually: user, operator, admin, partner).
user_banned Integer (0/1) This item represents the user ban status, if it is set to 1, the user is banned, otherwise it have an active account.
username String This item represents the username.
account_money Decimal This item represents the user account money.
user_invoices Integer This item represents the user created tickets number.
user_tickets Integer This item represents the user created tickets number.
user_domains Integer This item represents the user domains number.
user_services Integer This item represents the user services number.
country String This item represents the user country.
city String This item represents the user city.
state String This item represents the user state.
address String This item represents the user address.
real_name String This item represents the user real name.
phone_number Integer This item represents the user phone number.
zip_code Integer[5] This item represents the user zip / postal code.
user_company String This item represents the user company.
user_ip IP address This item represents the user IP address.
user_verified Integer(0/1) This item represents the user account verification status, if it is set to 1 the account in verified via e-mail, otherwise it is not.
by_affiliate Integer This item represents the user affiliate id, if it is set to -1, the user hasn't been registered via an affiliate link.
age Integer This item represents the user age.
date Date (Y/M/D) This item represents the user registration date.

Get product information.

Copy to clipboard
// Example: <?php $product_info = getProductVar($_GET['product_id']); echo $product_info['svdo_name']; ?>

The function getProductVar($PRODUCT_ID) will return an associative array with specified product information.

Function parameters
Parameter Type Description
Product ID Integer This parameter represents the product ID.
Items in returned array of getProductVar(...):
Item Type Description
product_id Integer This item represents the product ID.
product_topic Integer This item represents the assigned topic ID of the product.
product_type String This item represents the product type.
product_name String This item represents the product name (if it is a domain it will return the domain name).
product_specifications String This item represents the product specifications (usually seen by admin and user).
product_price Decimal This item represents the product price.
product_tax Float This item represents the product tax percent.
product_atax Float This item represents the product activation / setup tax.
product_instant Integer(0/1) This item represents the product instant activation status.
product_hot Integer(0/1) This item represents the product hot (popular) status.
product_on_sale Integer(0/1) This item represents the product sale status.
product_stock Integer This item represents the product stock.
product_sales Integer This item represents the product sales.
product_sale_price Decimal This item represents the product sale price.
svdo_expire_date Date(Y/M/D) This item represents the product expiration date.
product_timeline String This item represents the one-character string that define product renew timeline (d = days, m = months, y = years, o = one-time payment, l = for life).
product_timenumber Integer This item represents the product timeline number (For example: if timeline is equal to "d" and the timenumber is equal to 7, this means the product will have 7 days to expiration).
product_addon String This item represents the product addon.
product_date Date(Y/M/D) This item represents the product creation date.

Get currency symbol.

Copy to clipboard
// Example: <?php $currency_symbol = getCurrencySymbol('EUR'); echo $currency_symbol; // returns "€" ?>

The function getCurrencySymbol($currency) will return an the specified currency symbol as a string.

Function parameters
Parameter Type Description
Currency code String This parameter represents the currency code (EUR, USD, etc...), usually being "WEBSITE_CURRENCY" constant.

The function will return currency symbol of specified currency code, example:

echo getCurrencySymbol('EUR'); will return .

Get domain information.

Copy to clipboard
// Example: <?php $domain_info = getDomainVar($_GET['domain_extension_id']); echo 'Extension: '.$domain_info['domain_name']; ?>

The function getDomainVar($DOMAIN_EXTENSION_ID) will return an associative array with specified domain information.

Function parameters
Parameter Type Description
Domain extension ID Integer This parameter represents the domain extension ID.
Items in returned array of getDomainVar(...):
Item Type Description
domain_id Integer This item represents the domain extension ID.
domain_name String This item represents the domain extension name.
domain_specifications String This item represents the domain extension specifications (usually seen by admin and users).
domain_price Decimal This item represents the domain extension price.
domain_transfer_price Decimal This item represents the domain extension transfer price.
domain_transfer_sale_price Decimal This item represents the domain extension transfer sale price.
domain_transfer_on_sale Decimal This item represents the domain extension transfer sale status.
domain_tax Float This item represents the domain extension tax percent.
domain_atax Float This item represents the domain extension activation / setup tax.
domain_instant Integer(0/1) This item represents the domain extension instant activation status.
domain_hot Integer(0/1) This item represents the domain extension hot (popular) status.
domain_on_sale Integer(0/1) This item represents the domain extension sale status.
domain_stock Integer This item represents the domain extension stock.
domain_sales Integer This item represents the domain extension sales.
domain_sale_price Decimal This item represents the domain extension sale price.
domain_timeline String This item represents the one-character string that define domain extension renew timeline (d = days, m = months, y = years, o = one-time payment, l = for life).
domain_timenumber Integer This item represents the domain extension timeline number (For example: if timeline is equal to "d" and the timenumber is equal to 7, this means the domain extension will have 7 days to expiration).
domain_addon String This item represents the domain extension addon.
domain_date Date(Y/M/D) This item represents the domain extension creation date.

Get deposit order information.

Copy to clipboard
// Example: <?php $deposit_info = getDepositVar($_GET['deposit_id']); echo 'Deposit funds: '.$deposit_info['funds']; ?>

The function getDepositVar($DEPOSIT_ID) will return an associative array with specified deposit information.

Function parameters
Parameter Type Description
Deposit ID Integer This parameter represents the deposit ID.
Items in returned array of getDepositVar(...):
Item Type Description
f_id Integer This item represents the deposit ID.
user Integer This item represents the deposit assigned use ID.
payment_method String This item represents the deposit payment method.
specifications String This item represents the deposit specifications (usually seen by admin).
funds Float This item represents the deposit funds.
approved Integer(0/1) This item represents the deposit approved status (deprecated, it will be removed on a future release).
date Date(Y/M/D) This item represents the deposit creation date.

Add funds in current user account.

Copy to clipboard
// Example: <?php BF_AddFunds($method = 'PaySafeCard', 'Payment PIN: 2034-2352-5475-3433', 3.00, 1); ?>

The function BF_AddFunds($method = 'default', $specifications, $FUNDS, $NeedApproval = 0) will simulate a successful add funds action, it will include the after payment page on success, else it will throw errors in $errors array.

* This function is used internally by BillingFox, is recommended to use it carefully.

Function parameters
Parameter Type Description
Method String The payment method used for deposit.
Specifications String The specifications of deposit (usually seen by admin).
Funds Float The funds of deposit.
Need Approval Integer(0/1) If it is set to 1, the deposit will have to be verified by an admin before adding funds, if it is 0, the funds will be automatically set.

Return the renew payment page.

Copy to clipboard
// Example: <?php BF_getRenewPaymentPage($_POST['payment_option']); ?>

The function BF_getRenewPaymentPage($Payment_Addon_Name) will return the renew payment page via addon name, usually it is used in only one client area page to output renew payment pages.

Function parameters
Parameter Type Description
Payment Option Addon String This parameter represents the payment addon ID, usually it will be populated on payment radio checkbox (POST) selection.

Return the deposit payment page.

Copy to clipboard
// Example: <?php BF_getFundsPaymentPage($_POST['payment_option']); ?>

The function BF_getFundsPaymentPage($Payment_Addon_Name) will return the deposit / funding payment page via addon name, usually it is used in only one client area page to output deposit payment pages.

Function parameters
Parameter Type Description
Payment Option Addon String This parameter represents the payment addon ID, usually it will be populated on payment (select) (POST) selection.

Return the cart payment page.

Copy to clipboard
// Example: <?php BF_getPaymentPage($_POST['payment_option']); ?>

The function BF_getPaymentPage($Payment_Addon_Name) will return the cart payment page via addon name, usually it is used in only one client area page to output cart payment pages.

Function parameters
Parameter Type Description
Payment Option Addon String This parameter represents the payment addon ID, usually it will be populated on payment radio checkbox (POST) selection.

Return (cached) nameservers (1-5) of a domain.

Copy to clipboard
// Example: <?php echo 'BillingFox.net cached nameservers:'; echo getNameservers('billingfox.net', 1); echo getNameservers('billingfox.net', 2); /* Output */ /* BillingFox.net cached nameservers: ns1.thos-host.com ns2.thos-host.com */ ?>

The function getNameservers($DOMAIN, $NAMESERVER_NUMBER) will return the cached* nameservers (from 1 to 5) of a domain.

Function parameters
Parameter Type Description
Domain String This parameter represents the domain name.
Nameserver number Integer This parameter represents the nameserver number (from 1 to 5).
Response from getNameservers(...):
Item Type Description
(A domain nameserver) String Returns the cached nameserver of a domain.

Return website info.

Copy to clipboard
// Example: <?php echo 'Your website name is:'; echo getWebVar('webname'); /* Output */ /* Your website name is: BillingFox */ ?>

The function getWebVar($PARAMETER) will return the specified information about your BillingFox website.

Function parameters
Parameter Type Description
webname String This parameter will return website name (Faster alternative: constant WEBSITE_NAME).
cronjob_mode Integer This parameter will return website cronjob mode. (usually it is set to 1 after installation).
theme String This parameter will return website theme directory name (Faster alternative: constant WEBSITE_THEME).
facebook_link String This parameter will return website Facebook social link.
twitter_link String This parameter will return website Twitter social link.
linkedin_link String This parameter will return website LinkedIn social link.
client_area String This parameter will return website client area directory name (Faster alternative: constant WEBSITE_CLIENT_AREA).
domains Integer This parameter will return website client domains number sold on website.
services Integer This parameter will return website client services number sold on website.
currency String This parameter will return website payment currency (Faster alternative: constant WEBSITE_CURRENCY).
users Integer This parameter will return website registered accounts (Alias for getUserCount()).
creation_date Date This parameter will return website creation (or BillingFox installation) date (Faster alternative: constant WEBSITE_CREATION_DATE).
email_verification Integer (0/1) This parameter will return website email verification status (if users have to validate their email address it should return "1").
total_orders Integer This parameter will return website total orders count.
company String This parameter will return website company name.
maximum_deposit Float This parameter will return website maximum deposit amount (Faster alternative: constant WEBSITE_MAXIMUM_DEPOSIT).
minimum_deposit Float This parameter will return website minimum deposit amount (Faster alternative: constant WEBSITE_MINIMUM_DEPOSIT).
affiliate_percent Integer This parameter will return website affiliate earning percent amount.
affiliate_system Integer This parameter will return website affiliate system status (if the system is activated it should return "1").
maintenance Integer This parameter will return website maintenance system status (if the maintenance is activated it should return "1") (Faster alternative: constant MAINTENANCE).
maintenance_text String This parameter will return website maintenance text.
cash-year Float This parameter will return website earnings from this year.
cash-month Float This parameter will return website earnings from this month.
cash-today Float This parameter will return website earnings from today.
cash-total Float This parameter will return website total earnings.
Response from getWebVar(...):
Item Type Description
(Website info) String/Integer/Float Returns website information.

Simulate a renew payment.

Copy to clipboard
// Example: <?php renewService(1, 'm', 12, 1, 'InstantPayments', 18.00); ?>

The function renewService($timeline, $timenumber, $svdo_id, $user, $method, $price) will simulate a renew payment.

Function parameters
Parameter Type Description
timeline Integer This parameter is the renew service time letter.
timenumber Integer This parameter is the renew service time number.
svdo_id Integer This parameter is the renewed service ID.
user Integer This parameter is the renew user account ID.
method String This parameter is the payment method used for renew.
price Float This parameter is the renew payment price.

Simulate a payment.

Copy to clipboard
// Example: <?php PayAll('PinPayments', $_POST['payment_pin'], 'AllPending'); ?>

The function PayAll($method', $specifications, $CMD) will simulate a renew payment.

Function parameters
Parameter Type Description
method String This parameter is the payment method used for payment.
specifications String This parameter are the additional specifications for the payment, usually they are seen only by the admin.
CMD String This parameter is the additional command used for the payment (Default: "None"), Command can be: "AllPending" [Makes the payment to be on pending, by using this the services will not be activated instantly] and "AlreadyPaid" [You can use this when the payment was processed by an external addon / API, it will ignore services and invoice].

Simulate a deposit.

Copy to clipboard
// Example: <?php BF_AddFunds('FastPay', 'Payment PIN: 0437683762975986', 2.00, 1); ?>

The function BF_AddFunds($method, $specifications, $FUNDS, $NeedApproval) will simulate a deposit.

Function parameters
Parameter Type Description
method String This parameter is the payment method used for deposit.
specifications String This parameter are the additional specifications for the deposit, usually they are seen only by the admin.
FUNDS Float This parameter are the funds for deposit.
NeedApproval Integer (0/1) This parameter is the approval deposit status (if it is set to "1", the deposit must be verified by administrators).

Display info, warning, error and success messages.

Copy to clipboard
// Example: <?php display_infos(); display_infos2(); display_warnings(), display_warnings2(); display_successes(); display_successes2(); ?>

The functions display_infos(); display_infos2(); display_warnings(), display_warnings2(); display_successes(); display_successes2(); will display a HTML code with info, warning, error and success messages from BillingFox, there are 2 for every type of message to let developers have 2 different locations of different messages for every single page. The messages are get from the arrays $info, $info2, $warnings, $warnings2, $errors, $errors2, $successes and $successes2.

Check if an addon is activated / deactivated.


                    // Example:
                    <?php

                    echo addon_activated('PayPal_Gateway');

                    /* Output */

                    /*
                    YES
                    */

                    ?>
                                    

The function addon_activated($ADDON_NAME) will return the addon activation status (YES/NO).

Function parameters
Parameter Type Description
Addon name String This parameter represents the addon name.
Response from addon_activated(...):
Item Type Description
(Addon status) String If the addon is activated it will return YES, if it is not activated, the function will return NO.

Get variable SQL injection protection for main database.

Copy to clipboard
// Example: <?php $variable_to_db = e($variable); ?>

The function e($VARIABLE) will escape the variable string to stop SQL Injection.

Function parameters
Parameter Type Description
Variable String This parameter represents the variable.
Response from e(...):
Item Type Description
(Escaped variable) String Returns the escaped variable to use it safely across database.

Check if an addon is on database.

Copy to clipboard
// Example: <?php echo addon_in_db('PayPal_Gateway'); /* Output */ /* YES */ ?>

The function addon_in_db($ADDON_NAME) will check if an addon is in database (usually used for custom addon installation wizards), returns YES if the addon is on database, and NO if it is not.

Function parameters
Parameter Type Description
Addon name String This parameter represents the addon name.
Response from addon_in_db(...):
Item Type Description
(Addon in database) String If the addon is in database it will return YES, but if it is not, the function will return NO.

Get current user IP.

Copy to clipboard
// Example: <?php echo getUserIP(); /* OUTPUT */ /* (IP ADDRESS) */ ?>

The function getUserIP() will return the current user IP address.

Response returned by getUserIP():
Item Type Description
(IP Address) IP Address The function will return only the current user IP address.

Check for expired services.

Copy to clipboard
// Example: <?php BF_checkExpireProducts_or_domains(); ?>

The function BF_checkExpireProducts_or_domains() will check for expired services on your BillingFox installation, if there's one or more, the status of the service will be set to "Expired".

Get admin area Bootstrap addon buttons.

Copy to clipboard
// Example: <?php echo getAdminAreaButtons(); /* OUTPUT */ /* [HTML CODE] */ ?>

Get addon generated html codes in themes & client areas.

Copy to clipboard
// Example: <?php echo getElement('header'); /* OUTPUT */ /* [HTML CODE] */ ?>
Function parameters
Parameter Type Description
Element String This parameter represents the desired element (Usually: "header", "top", "footer", "header_client_area", "top_client_area", "footer_client_area") (It will use the content/addons/(every active addon)/functions/(Element)).

* It have to be used on client areas & themes.

Get admin area Bootstrap buttons generated by addons.

Copy to clipboard
// Example: <?php listAddonsMenu(); /* OUTPUT */ /* [HTML CODE] */ ?>

The function listAddonsMenu() will return the html code with admin area bootstrap addon manage buttons.

Get payment method radios.

Copy to clipboard
// Example: <?php echo getPaymentMethods(); /* OUTPUT */ /* [HTML CODE] */ ?>

Get service information.

Copy to clipboard
// Example: <?php $sv_info = getServiceVar($_GET['sv_id']); echo $sv_info['svdo_name']; ?>

The function getServiceVar($SERVICE_ID) will return an associative array with specified service information.

Function parameters
Parameter Type Description
Service ID Integer This variable represents the service ID.
Items in returned array of getServiceVar(...):
Item Type Description
svdo_id Integer This item represents the service ID.
svdo_user Integer This item represents the assigned user ID of the service.
svdo_specifications String This item represents the service specifications (usually sent only to admins).
svdo_price Decimal This item represents the service price.
svdo_status String This item represents the service status (Expired, Active, Canceled or Pending).
svdo_informations String This item represents the service information (usually seen by user and admin).
svdo_instant Integer(0/1) This item represents the service instant activation status, if the service was instantly activatet, the assigned number will be 1.
svdo_type String This item represents the service type (For domains it will be automatically assigned as "domain", on other servcices it will have a custom value set on product creation or addon updates).
svdo_payment_method String This item represents the service used payment method.
svdo_hot Integer(0/1) This item represents the service hot (popular) status.
svdo_on_sale Integer(0/1) This item represents the service sale status.
svdo_stock Integer This item represents the service stock.
svdo_sale_price Decimal This item represents the service sale price.
svdo_date Date(Y/M/D) This item represents the service creation date.
svdo_expire_date Date(Y/M/D) This item represents the service expiration date.
svdo_timeline String This item represents the one-character string that define service renew timeline (d = days, m = months, y = years, o = one-time payment, l = for life).
phone_number Integer This item represents the user phone number.
svdo_timenumber Integer This item represents the service timeline number (For example: if timeline is equal to "d" and the timenumber is equal to 7, this means the service will have 7 days to expiration).
svdo_expired Integer(0/1) This item represents the service expiration status.
svdo_renew_price Decimal This item represents the service renew price.
svdo_instant_renew Integer(0/1) This item represents the service instant renew status, if it is set to 1, the service will be instantly activated on payment, so it would not need administration verification.
svdo_WHOIS_protection Integer(0/1) This item represents the service WHOIS protection status.
svdo_special_domain_required Integer(0/1) This item represents the service domain required status.
svdo_special_domain String This item represents the service special assigned domain.
svdo_special_user String This item represents the service special assigned user.
svdo_special_pass String This item represents the service special assigned password.
svdo_special_hostname String This item represents the service special assigned hostname.
svdo_special_ns1pre String This item represents the service special assigned first nameserver prefix.
svdo_special_ns2pre String This item represents the service special assigned second nameserver prefix.
svdo_transfered Integer(0/1) This item represents the service transfered status.
svdo_transfer_epp_code String This item represents the service transfer EPP / AUTH transfer key.
svdo_addon String This item represents the service addon.
svdo_token String This item represents the service randomly generated token.
 

Definitions List

Name Type Description
$_SESSION['user_id'] Integer This variable represents the current user ID (if it is logged in).
$db Integer This is the database connection variable.
WEBSITE_NAME String Returns your website name.
WEBSITE_THEME String Returns your website theme.
WEBSITE_CLIENT_AREA String Returns your website client area.
WEBSITE_CURRENCY String Returns your website currency.
WEBSITE_MINIMUM_DEPOSIT String Returns your website minimum deposit amount.
WEBSITE_MAXIMUM_DEPOSIT String Returns your website maximum deposit amount.
MAINTENANCE Integer (0/1) Returns your website maintenance system status.

Get language list.

Copy to clipboard
// Example: <?php $langs = BF_getLanguageList(); echo $this->BF_print($langs); ?>

The function BF_getLanguageList() will return an associative array your languages information.

Definitions List

Name Type Description
langName String This is the language name.
langFile String This is the language file.
using Boolean Returns if this is the current language.

Check user permissions.

Copy to clipboard
// Example: <?php if(hasPermission($_SESSION['user_type'], 'manage.users')) { echo 'You can manage users.'; } ?>

The function hasPermission(string $user_type, string $permission) will return a boolean.

Get currency position.

Copy to clipboard
// Example: <?php if(getCurrencyPos() == 'left') { echo 'The main currency symbol should be on the left.'; } ?>

Format the price.

Copy to clipboard
// Example: <?php echo format_price(10); // This could return "10€". ?>

The function format_price($price) will return the price along with the correct-positioned currency symbol.

Get rank name by ID.

Copy to clipboard
// Example: <?php echo getRankNameById(1); // This should return the rank name from the one with ID 1. ?>

The function getRankNameById(int $rankID) will return the rank name.

Get rank name by ID.

Copy to clipboard
// Example: <?php BF_addNotice('Your theme requires the ServerFields addon to be active.', 2); ?>

The function BF_addNotice(string $noticeTitle = 'Default notice title', int $noticeLevel = 0) will return a MySQLi query response.

Check if produs has image.

Copy to clipboard
// Example: <?php if(productHasImage(1)) { echo 'The product with ID 1 has an image.'; } ?>

The function productHasImage(int $productID) will return a boolean.

Get product image.

Copy to clipboard
// Example: <?php echo getProductImage(1); // This should return the image from the product with ID 1. ?>

The function getProductImage(int $productID) will return a string with the image source of the specified product.

You can find more advanced functions & definition examples on the right side of the page.

In order to use these functions, you must include the file \install\advanced_func.php

Select from table:
Copy to clipboard
selectTable(string $table, int $identifier = 0); // Example // $users = selectTable('BF_users', 13413); // Returns the table rows, if an error is found the identifier will be used to track the problem.
Generate a CRUD edit panel:
Copy to clipboard
generateEditPanel(string $table = 'BF_users', int $id = 0, string $single_name = 'User', string $primary_key = 'id', array $excludeColumns = array('id')) // Example // generateEditPanel('BF_users', 2, 'User', 'id', array('id')) // Create the edit page for the specified table resource // The $excludeColumns array is used to exclude some columns from the edit panel.
Generate a CRUD create panel:
Copy to clipboard
generateCreatePanel(string $table = 'BF_users', string $single_name = 'User', array $excludeColumns = array('id'), int $identifier = 0, $uploadFileInput = array(), string $primary_key = 'id') // Example // generateCreatePanel('BF_users', 'User', array('id'), 2134, array(), 'id') // Create the create page for the specified table // The $excludeColumns array is used to exclude some columns from the create panel.
Copy to clipboard
<!-- Get custom menu addon list --> <?php $menu = getMenuItems(); if(is_array($menu)) { foreach($menu as $item) { ?> <a href="<?php echo $item['href']; ?>"> <div class="icon menu-item"><?php echo $item['icon']; ?></div> <div class="text menu-item"><?php echo $item['item_display'];?></div> </a> <?php } } ?>