Properties

$version

$version : 

BaaS version

This one will never be exposed to the outside world.

Type

— BaaS Version number

$build

$build : 

BaaS build

This one will never be exposed to the outside world.

Type

— BaaS build number

$APIVer

$APIVer : 

Set API Version

The API Version which we'll use to connect to.

Type

— API Version

$debugmode

$debugmode : 

Debugmode

Type

— set debug mode

$emailAddress

$emailAddress : 

email address

Type

— set email address

$BaaSAddress

$BaaSAddress : 

BaaS address

Type

— set email address

$sessionTime

$sessionTime : 

Time befor resetting the maximum retries

Type

— time to reset session token

$bindSessionToIP

$bindSessionToIP : 

Bind Session to IP?

Type

— Bind Session to IP?

$translate

$translate : 

Automatic translation

Type

— set automatic translation on(auto)/off

$APIKey

$APIKey : 

API Key

Type

— the API key

$triesMaximum

$triesMaximum : 

Maximum retries

Type

— maximum tries

$triesTime

$triesTime : 

Time befor resetting the maximum retries

Type

— time to reset maximum tries

$BFfile

$BFfile : 

Save file location.

Type

— File location

$blockFilePath

$blockFilePath : 

Save file directory.

Type

— Directory location

$isAdmin

$isAdmin : 

is current user an Admin?

Type

— is it a admin

$isCLI

$isCLI : 

Are we running on a cli (command line interface)

Type

— is it a cli?

$error

$error : 

Is there a error

Type

— is there a error

$errorMessage

$errorMessage : 

What is the error message

Type

— error message

$saveFilesToDatabase

$saveFilesToDatabase : 

Save files to database?

Type

— Save files to the database?

$dbConfig

$dbConfig : 

Database Configuration

Type

— database configuration

$protocol

$protocol : 

HTTP Protocol

Type

— The protocol

$errorCode

$errorCode : string|array

return HTTP codes

Type

string|array — Return this error codes

$defaultFields

$defaultFields : string|array

Defaults fields

The fields which may be missing on insertion

Type

string|array — Return this error codes

$defaultTables

$defaultTables : string|array

Defaults tables

The default tables for running BaaS

Type

string|array — Default tables

$extensions

$extensions : string|array

Extensions

We'll support extensions

Type

string|array — Extensions array

$userRegistrationDisabled

$userRegistrationDisabled : 

userRegistrationDisabled

Is the user registration disabled?

Type

— userRegistrationDisabled?

$userLoginDisabled

$userLoginDisabled : 

userLoginDisabled

Is the user login disabled?

Type

— userLoginDisabled?

Methods

setDatabase()

setDatabase(  type,   hostOrPath,   databaseName,   username,   password) : 

Set database configuration

Parameters

type

mysql/sqlite

hostOrPath

Host or Path name

databaseName

Database name

username

username

password

Password

Returns

attachExtension()

attachExtension(  extensionURL,   extensionCall,   needsAPIKey = true) : 

attach Extension

Parameters

extensionURL

Extension url (in regex)

extensionCall

extensionClass::myFunction

needsAPIKey

Do we need a API Key to run this?

Returns

setDebugmode()

setDebugmode(  status) 

Set the debugmode

Parameters

status

On or Off

setSessionTime()

setSessionTime(  sessionTimeValue) 

Set the lifetime of a (user) session

Parameters

sessionTimeValue

Time string like "+1 month"

setBindToIP()

setBindToIP(  bindToIPValue) 

Set bind to IP on/off

Parameters

bindToIPValue

On or Off (default false)

setEmailAddress()

setEmailAddress(  emailAddress) 

Set the email address

Parameters

emailAddress

email address

setRegisteredAPIKey()

setRegisteredAPIKey(  newAPIKey) 

Set the API Key

Parameters

newAPIKey

API Key

setMaximumInvalidTries()

setMaximumInvalidTries(  setMaximumTries) 

Set Maximum tries

Parameters

setMaximumTries

Maximum tries

setTriesTime()

setTriesTime(  setTriesTime) 

Set Maximum tries (in time)

Parameters

setTriesTime

Time in strtotime format

databaseType()

databaseType() : 

get Database Type

Returns

Database Type

serve()

serve() : mixed|string

Serve the BaaS Server.

Returns

mixed|string —

Page contents (JSON/HTML)

__sleep()

__sleep() : mixed|string|int

Fix for Travis CI

Returns

mixed|string|int —

empty.

__wakeup()

__wakeup() : 

Fix for Travis CI

Returns

shared()

shared() : 

Creates a Shared Instance

Returns

Instance

__construct()

__construct() 

Construct the class.

tableFromSQLString()

tableFromSQLString(  sqlQuery) : 

Get tablename from SQL Query.

Supported:

    SELECT WHATEVER FROM WHERE  ...
    INSERT * INTO X VALUES ()
    DELETE FROM X WHERE ...
    CREATE TABLE X ()

Parameters

sqlQuery

The SQL Query

Returns

the table name

tableExists()

tableExists(  tableName) 

Does our table exists?

Parameters

tableName

table name

invalidRequest()

invalidRequest(  request = Unknown) : 

Invalid request

Parameters

request

the type/value

Returns

JSON Error.

query()

query(  query) : 

SQL query

Parameters

query

the SQL Query

Returns

escapeString()

escapeString(  insecureInput) : 

Escape SQL query

Parameters

insecureInput

the unsecure SQL Query

Returns

the (more)secure SQL Query

queryWithParameters()

queryWithParameters(  query, array|string  parameters) : 

SQL Query with parameters

Parameters

query

Query text

array|string parameters

Query parameters

Returns

Query executed

getTableFields()

getTableFields( tableName,  asJSON = false) : array|string

Get table fields (columns)

Parameters

tableName
asJSON

Returns

array|string —

Fieldnames

isTheServerAvailable()

isTheServerAvailable(  serverAddr) : mixed|string

Is the server available?

Parameters

serverAddr

Server address

Returns

mixed|string —

Offline/Online

handleException()

handleException(  exception) : mixed|string

Deal with exceptions.

Parameters

exception

throwed exception

Returns

mixed|string —

JSON String with error (if available)

setHTTPStatusCode()

setHTTPStatusCode(  code = 200,  returnAsText = false) 

Set the HTTP Status Code

Parameters

code

HTTP Status Code

returnAsText

hashPassword()

hashPassword( password) 

Hash a password.

Parameters

password

setAttempt()

setAttempt(  IPAddress) 

Set invalid attempt

Parameters

IPAddress

the ip address

resetOldAttempts()

resetOldAttempts() 

Reset old login attempts

userCreate()

userCreate(  userID) : 

Create user

Parameters

userID

The user's id

Returns

JSON Data.

userExists()

userExists(  userID) : 

Does the user exists?

Parameters

userID

The user's id

Returns

JSON Data.

userRemove()

userRemove(  userID) : 

Remove user

Parameters

userID

The user's id

Returns

JSON Data.

userLogin()

userLogin(  userID) : 

Login user

Parameters

userID

The user's id

Returns

JSON Data.

sessionCreate()

sessionCreate(  sessionID) : 

create session

Parameters

sessionID

The session ID

Returns

JSON Data.

sessionInvalidate()

sessionInvalidate(  sessionID) : 

invalidate session

Parameters

sessionID

The session ID

Returns

JSON Data.

sessionAdminInvalidateAll()

sessionAdminInvalidateAll(  sessionID) : 

[Administrator] invalidate all sessions

Parameters

sessionID

The session ID

Returns

JSON Data.

userAdminLoginEnabled()

userAdminLoginEnabled(  status) : 

[Administrator] is login enabled?

Parameters

status

The status

Returns

JSON Data.

userAdminRegisterEnabled()

userAdminRegisterEnabled(  status) : 

[Administrator] is register enabled?

Parameters

status

The status

Returns

JSON Data.

userAdminStatus()

userAdminStatus(  userID) : 

[Administrator] set User status

Parameters

userID

The user's id

Returns

JSON Data.

userReset()

userReset(  userID) : 

Reset userpassword

Parameters

userID

The user's id

Returns

JSON Data.

userActivate()

userActivate(  userID) : 

Activate user

Parameters

userID

The user's id

Returns

JSON Data.

fileExists()

fileExists(  fileID,   asBoolean = false) : 

File Exists

Parameters

fileID

File identifier

asBoolean

Return as Boolean?

Returns

JSON Data.

fileDownload()

fileDownload(  fileID) : 

File Download

Parameters

fileID

File identifier

Returns

JSON Data.

fileRemove()

fileRemove(  fileID) : 

File Remove

Parameters

fileID

File identifier

Returns

JSON Data.

fileUpload()

fileUpload(  fileID) : 

File Upload

Parameters

fileID

File identifier

Returns

JSON Data.

checkFileExtension()

checkFileExtension( fileData) 

Parameters

fileData

userDatabaseSetup()

userDatabaseSetup() : 

Setup user database

Returns

fileDatabaseSetup()

fileDatabaseSetup() : 

Setup file database

Returns

sessionDatabaseSetup()

sessionDatabaseSetup() : 

Setup Session database

Returns

tableCreate()

tableCreate(  tableName) : 

Create table

Parameters

tableName

the table name

Returns

tableEmpty()

tableEmpty(  tableName) : 

Empty table

Parameters

tableName

the table name

Returns

tableRemove()

tableRemove(  tableName) : 

Remove table

Parameters

tableName

the table name

Returns

tableRename()

tableRename(  tableName) : 

Rename table

Parameters

tableName

the table name

Returns

DBAdmin()

DBAdmin(  task = index) : 

Create the Database Admin Web Interface

Parameters

task

Task to execute.

Returns

Database Admin Webinterface

isLoggedInAsAdmin()

isLoggedInAsAdmin(  destroy = false) : 

Is the current user a admin?

Parameters

destroy

Destroy session?

Returns

Logged in state

rowCreate()

rowCreate( action) : array|string

Create row

Parameters

action

Returns

array|string —

Fieldnames

diagnosis()

diagnosis( key) 

Diagnosis for problems

Parameters

key