API Documentation
Table of Contents
Namespaces
Interfaces
- IAuthentication
- Authentication method interface.
Classes
- PersoRequest
- A perso request
- Actions
- Actions class
- UserPasswordAuthentication
- Login/pass authentication
- YubiCloudAuthentication
- YubiCloudAuthentication class
- Cache
- Cache caller
- CacheMemcached
- Memcached cache
- CacheVoid
- "blackhole" void cache
- SmartLineCommand
- The SmartLine command base class.
- SmartLine
- This class represents a SmartLine instance
- ShowCommandsSmartLineCommand
- The standard command "showcommands"
- HelpSmartLineCommand
- The standard command "help"
- DebugSmartLineCommand
- Debugger command
- GotoSmartLineCommand
- The goto command
- GUIDSmartLineCommand
- The GUID command
- InviteSmartLineCommand
- The invite command
- ListSmartLineCommand
- The list command
- RequestsSmartLineCommand
- The requests command
- SettingsSmartLineCommand
- The settings command
- UnixTimeSmartLineCommand
- The unixtime command
- VersionSmartLineCommand
- The version command
- WhereAmISmartLineCommand
- The whereami (Where am I?) command
- WhoAmISmartLineCommand
- The whoami (Who am I?) command
- StoryChoice
- Story choice class
- StoryHook
- Story hook class
- DemoStoryHook
- Story hook demo class
- SpatioportStoryHook
- Spatioport story hook class
- StorySection
- Story section class
- Story
- Story class
- TravelPlace
- TravelPlace class
- Travel
- Travel helper class
Constants
- ACCENT = $CurrentUser->session['Skin_accent']
- ALLOW_LOCALHOST = \false
- Determines if localhost calls could be passed.
- Auth_OpenID_RAND_SOURCE = null
- BUFFER_SIZE = 4096
- CACHE_DIR = \Keruald\OmniTools\OS\Environment::getOr('CACHE_DIR', 'cache')
- CONTENT_DIR = \Keruald\OmniTools\OS\Environment::getOr('CONTENT_DIR', 'content')
- CONTENT_USERS_DIR = \Keruald\OmniTools\OS\Environment::getOr('CONTENT_USERS_DIR', \CONTENT_DIR . '/users')
- DIJIT = \true
- This constant indicates we need to load the Dijit (and so Dojo) library.
- DIJIT = \true
- DIJIT = \true
- DOJO = \defined('DIJIT')
- Determines if the dojo library have or not been loaded
- DOJO = \true
- FORMAT_ERROR = \false
- Determines if the error must be formatted.
- GENERAL_ERROR = 117
- GENERAL_ERROR is the constant meaning the error is general, ie not covered by another more specific error constant.
- HACK_ERROR = 99
- HACK_ERROR is the constant meaning access is non authorized to the resource.
- HEADER_PRINTED = \true
- This constant indicates the header have been printed
- LANG = $_SESSION['lang']
- OUTPUT_ERROR = \true
- Determines if error should be printed.
- PERSO_NOT_SELECTED = -7
- Magic number which indicates the user is logged in, but haven't selected its perso.
- PersoSelected = true
- PHOTOS_DIR = \CONTENT_DIR . "/users/_photos"
- PHOTOS_URL = $Config['StaticContentURL'] . '/content/users/_photos'
- SCENE_DIR = \CONTENT_DIR . "/scenes"
- SCENE_DIR = 'content/scenes'
- The directory containing scenes files
- SCENE_URL = $Config['StaticContentURL'] . '/content/scenes'
- SQL_ERROR = 65
- SQL_ERROR is the constant meaning the error is a SQL error.
- STDERR = -1
- STDOUT = 1
- STORIES_DIR = \CONTENT_DIR . "/stories"
- TABLE_API_KEYS = 'api_keys'
- The table where are located the API keys
- TABLE_API_KEYS = $prefix . 'api_keys'
- TABLE_BODIES = $prefix . 'geo_bodies'
- TABLE_COMMENTS = $prefix . 'comments'
- TABLE_CONTENT_FILES = $prefix . 'content_files'
- TABLE_CONTENT_LOCATIONS = $prefix . 'content_locations'
- TABLE_CONTENT_ZONES = $prefix . 'content_zones'
- TABLE_CONTENT_ZONES_LOCATIONS = $prefix . 'content_zones_locations'
- TABLE_LOCATIONS = $prefix . 'geo_locations'
- TABLE_LOG = $prefix . 'log'
- TABLE_LOG_SMARTLINE = $prefix . 'log_smartline'
- TABLE_MESSAGES = $prefix . 'messages'
- TABLE_MOTD = $prefix . 'motd'
- TABLE_PAGES = $prefix . 'pages'
- TABLE_PAGES_EDITS = $prefix . 'pages_edits'
- TABLE_PERSOS = $prefix . 'persos'
- TABLE_PERSOS_FLAGS = $prefix . 'persos_flags'
- TABLE_PERSOS_NOTES = $prefix . 'persos_notes'
- TABLE_PLACES = $prefix . 'geo_places'
- TABLE_PORTS = $prefix . 'ports'
- TABLE_PROFILES = $prefix . 'profiles'
- TABLE_PROFILES_COMMENTS = $prefix . 'profiles_comments'
- TABLE_PROFILES_PHOTOS = $prefix . 'profiles_photos'
- TABLE_PROFILES_TAGS = $prefix . 'profiles_tags'
- TABLE_REGISTRY = $prefix . 'registry'
- TABLE_REQUESTS = $prefix . 'requests'
- TABLE_REQUESTS_REPLIES = $prefix . 'requests_replies'
- TABLE_SESSIONS = $prefix . 'sessions'
- TABLE_SHIPS = $prefix . 'ships'
- TABLE_USERS = $prefix . 'users'
- TABLE_USERS_AUTH = $prefix . 'users_auth'
- TABLE_USERS_INVITES = $prefix . 'users_invites'
- THEME = $CurrentUser->session['Skin']
- URL = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php'
- USER_NOT_LOGGED = -9
- Magic number which indicates the user is not logged in.
Functions
- is_buildable() : bool
- Determines if a specified location is buildable
- get_request_allow_url() : string
- Gets request allow URL
- get_request_deny_url() : string
- Gets request deny URL
- get_request_url() : the
- Gets request URL
- get_section() : StorySection
- Gets section to print to the user
- smarty_modifier_romanize() : string
- Smarty romanize modifier plugin
- smarty_modifier_sector() : string
- Smarty sector modifier plugin
- smarty_modifier_text2html() : string
- Smarty text to HTML modifier plugin
- smarty_modifier_yyyymmdd() : string
- Smarty lower modifier plugin
- toXml() : string
- The main function for converting to an XML document.
- api_output() : mixed
- Outputs API reply, printing it in the specified format.
- cerbere() : mixed
- Checks if credentials are okay and exits if not
- cerbere_die() : never
- Prints a message in raw or API format, then exits.
- loadEnvironment() : mixed
- get_name() : string
- Gets the nickname from the specified perso ID
- get_userid() : int
- Gets the user ID from the specified username
- registry_get() : string
- Gets an information from the application global registry
- registry_set() : void
- Sets an information in the application global registry
- s() : string
- Returns "s" when the $amount request a plural This function is a French plural helper.
- x() : string
- Returns "x" when the $amount request a plural This function is a French plural helper.
- dprint_r() : mixed
- Prints human-readable information about a variable.
- new_guid() : string
- Generates a GUID, or more precisely an UUID
- is_guid() : bool
- Determines if the expression is a valid UUID (a guid without {}).
- get_extension() : string
- Gets file extension
- supralog() : mixed
- Inserts a message into the supralog
- initialize_lang() : void
- Defines the LANG constant, to lang to print
- find_lang() : string
- Gets a common lang spoken by the site and the user's browser
- get_http_accept_languages() : array<string|int, string>
- Gets the languages accepted by the browser, by order of priority.
- lang_load() : void
- Loads specified language Smarty configuration file
- lang_get() : string
- Gets a specified language expression defined in configuration file
- to_unixtime() : int
- Converts a YYYYMMDD or YYYY-MM-DD timestamp to unixtime
- to_timestamp() : string
- Converts a unixtime to the YYYYMMDD or YYYY-MM-DD timestamp format
- get_hypership_time() : string
- Converts a unixtime to the Hypership time format or gets the current hypership time.
- get_url() : string
- Gets the URL matching the specified resource.
- get_page_url() : string
- Gets the current page URL
- get_server_url() : string
- Gets the server URL
- get_current_url() : string
- Gets $_SERVER['PATH_INFO'] or computes the equivalent if not defined.
- get_current_url_fragments() : array<string|int, mixed>
- Gets an array of url fragments to be processed by controller
- get_xhr_hash() : string
- Gets an hash value to check the integrity of URLs in /do.php calls
- get_xhr_hashed_url() : string
- Gets the URL to call do.php, the xmlHttpRequest controller
- get_xhr_url() : string
- Gets the URL to call do.php, the xmlHttpRequest controller
- dieprint_r() : never
- Output a general error, with human-readable information about the specified expression as error message ; terminates the current script.
- message_die() : never
- Outputs an error message and terminates the current script.
- old_message_die() : never
- Outputs an error message and terminates the current script.
- get_openid_consumer() : Auth_OpenID_Consumer
- Gets an Auth_OpenID_Consumer instance
- openid_login() : mixed
- Logs in the user if the OpenID is recognized.
- session_update() : mixed
- nbc() : mixed
- get_info() : mixed
- get_logged_user() : mixed
- set_info() : mixed
- clean_session() : mixed
- Destroys $_SESSION array values, help ID
- login() : mixed
- Logs in user
- logout() : mixed
- Logs out user
- SmartLineHandler() : mixed
- Error handler called during SmartLine command execution.
- log_C() : mixed
- Logs a Smartline command
Constants
ACCENT
public
mixed
ACCENT
= $CurrentUser->session['Skin_accent']
ALLOW_LOCALHOST
Determines if localhost calls could be passed.
public
mixed
ALLOW_LOCALHOST
= \false
If true, any call from localhost is valid. Otherwise, normal security rules are applied.
Auth_OpenID_RAND_SOURCE
public
mixed
Auth_OpenID_RAND_SOURCE
= null
BUFFER_SIZE
public
mixed
BUFFER_SIZE
= 4096
CACHE_DIR
public
mixed
CACHE_DIR
= \Keruald\OmniTools\OS\Environment::getOr('CACHE_DIR', 'cache')
CONTENT_DIR
public
mixed
CONTENT_DIR
= \Keruald\OmniTools\OS\Environment::getOr('CONTENT_DIR', 'content')
CONTENT_USERS_DIR
public
mixed
CONTENT_USERS_DIR
= \Keruald\OmniTools\OS\Environment::getOr('CONTENT_USERS_DIR', \CONTENT_DIR . '/users')
DIJIT
This constant indicates we need to load the Dijit (and so Dojo) library.
public
mixed
DIJIT
= \true
DIJIT
public
mixed
DIJIT
= \true
DIJIT
public
mixed
DIJIT
= \true
DOJO
Determines if the dojo library have or not been loaded
public
mixed
DOJO
= \defined('DIJIT')
If true, there's a code like <script src="js/dojo/dojo/dojo.js"><script> in the
block of the code.DOJO
public
mixed
DOJO
= \true
FORMAT_ERROR
Determines if the error must be formatted.
public
mixed
FORMAT_ERROR
= \false
If true, any error will be sent to api_output ; otherwise, it will be printed as is.
GENERAL_ERROR
GENERAL_ERROR is the constant meaning the error is general, ie not covered by another more specific error constant.
public
mixed
GENERAL_ERROR
= 117
HACK_ERROR
HACK_ERROR is the constant meaning access is non authorized to the resource.
public
mixed
HACK_ERROR
= 99
It encompasses two problematics: the URL points to a resource belonging to another user or for the current user have no access right (for malformed URL, pick instead GENERAL_ERROR) ; the user is anonymous, instead to be logged in.
A suggested way to handle the second problematic is to store in hidden input fields or better in the session the previous form data, and to print a login form.
If you implement this, you don't even need to distinguish between the two cases, as once logged in, the regular HACK_ERROR could also be printed.
HEADER_PRINTED
This constant indicates the header have been printed
public
mixed
HEADER_PRINTED
= \true
LANG
public
mixed
LANG
= $_SESSION['lang']
OUTPUT_ERROR
Determines if error should be printed.
public
mixed
OUTPUT_ERROR
= \true
If true, the error will be printed according the FORMAT_ERROR setting. Otherwise, a blank page will be served.
PERSO_NOT_SELECTED
Magic number which indicates the user is logged in, but haven't selected its perso.
public
mixed
PERSO_NOT_SELECTED
= -7
PersoSelected
public
mixed
PersoSelected
= true
PHOTOS_DIR
public
mixed
PHOTOS_DIR
= \CONTENT_DIR . "/users/_photos"
PHOTOS_URL
public
mixed
PHOTOS_URL
= $Config['StaticContentURL'] . '/content/users/_photos'
SCENE_DIR
public
mixed
SCENE_DIR
= \CONTENT_DIR . "/scenes"
SCENE_DIR
The directory containing scenes files
public
mixed
SCENE_DIR
= 'content/scenes'
SCENE_URL
public
mixed
SCENE_URL
= $Config['StaticContentURL'] . '/content/scenes'
SQL_ERROR
SQL_ERROR is the constant meaning the error is a SQL error.
public
mixed
SQL_ERROR
= 65
As a message_die function parameter, it allows to add SQL specific debug information.
STDERR
public
mixed
STDERR
= -1
STDOUT
public
mixed
STDOUT
= 1
STORIES_DIR
public
mixed
STORIES_DIR
= \CONTENT_DIR . "/stories"
TABLE_API_KEYS
The table where are located the API keys
public
mixed
TABLE_API_KEYS
= 'api_keys'
TABLE_API_KEYS
public
mixed
TABLE_API_KEYS
= $prefix . 'api_keys'
TABLE_BODIES
public
mixed
TABLE_BODIES
= $prefix . 'geo_bodies'
TABLE_COMMENTS
public
mixed
TABLE_COMMENTS
= $prefix . 'comments'
TABLE_CONTENT_FILES
public
mixed
TABLE_CONTENT_FILES
= $prefix . 'content_files'
TABLE_CONTENT_LOCATIONS
public
mixed
TABLE_CONTENT_LOCATIONS
= $prefix . 'content_locations'
TABLE_CONTENT_ZONES
public
mixed
TABLE_CONTENT_ZONES
= $prefix . 'content_zones'
TABLE_CONTENT_ZONES_LOCATIONS
public
mixed
TABLE_CONTENT_ZONES_LOCATIONS
= $prefix . 'content_zones_locations'
TABLE_LOCATIONS
public
mixed
TABLE_LOCATIONS
= $prefix . 'geo_locations'
TABLE_LOG
public
mixed
TABLE_LOG
= $prefix . 'log'
TABLE_LOG_SMARTLINE
public
mixed
TABLE_LOG_SMARTLINE
= $prefix . 'log_smartline'
TABLE_MESSAGES
public
mixed
TABLE_MESSAGES
= $prefix . 'messages'
TABLE_MOTD
public
mixed
TABLE_MOTD
= $prefix . 'motd'
TABLE_PAGES
public
mixed
TABLE_PAGES
= $prefix . 'pages'
TABLE_PAGES_EDITS
public
mixed
TABLE_PAGES_EDITS
= $prefix . 'pages_edits'
TABLE_PERSOS
public
mixed
TABLE_PERSOS
= $prefix . 'persos'
TABLE_PERSOS_FLAGS
public
mixed
TABLE_PERSOS_FLAGS
= $prefix . 'persos_flags'
TABLE_PERSOS_NOTES
public
mixed
TABLE_PERSOS_NOTES
= $prefix . 'persos_notes'
TABLE_PLACES
public
mixed
TABLE_PLACES
= $prefix . 'geo_places'
TABLE_PORTS
public
mixed
TABLE_PORTS
= $prefix . 'ports'
TABLE_PROFILES
public
mixed
TABLE_PROFILES
= $prefix . 'profiles'
TABLE_PROFILES_COMMENTS
public
mixed
TABLE_PROFILES_COMMENTS
= $prefix . 'profiles_comments'
TABLE_PROFILES_PHOTOS
public
mixed
TABLE_PROFILES_PHOTOS
= $prefix . 'profiles_photos'
TABLE_PROFILES_TAGS
public
mixed
TABLE_PROFILES_TAGS
= $prefix . 'profiles_tags'
TABLE_REGISTRY
public
mixed
TABLE_REGISTRY
= $prefix . 'registry'
TABLE_REQUESTS
public
mixed
TABLE_REQUESTS
= $prefix . 'requests'
TABLE_REQUESTS_REPLIES
public
mixed
TABLE_REQUESTS_REPLIES
= $prefix . 'requests_replies'
TABLE_SESSIONS
public
mixed
TABLE_SESSIONS
= $prefix . 'sessions'
TABLE_SHIPS
public
mixed
TABLE_SHIPS
= $prefix . 'ships'
TABLE_USERS
public
mixed
TABLE_USERS
= $prefix . 'users'
TABLE_USERS_AUTH
public
mixed
TABLE_USERS_AUTH
= $prefix . 'users_auth'
TABLE_USERS_INVITES
public
mixed
TABLE_USERS_INVITES
= $prefix . 'users_invites'
THEME
public
mixed
THEME
= $CurrentUser->session['Skin']
URL
public
mixed
URL
= 'http://' . $_SERVER['HTTP_HOST'] . '/index.php'
USER_NOT_LOGGED
Magic number which indicates the user is not logged in.
public
mixed
USER_NOT_LOGGED
= -9
Functions
is_buildable()
Determines if a specified location is buildable
is_buildable(Location $location[, mixed &$error = '' ]) : bool
Parameters
- $location : Location
-
the location to check
- $error : mixed = ''
Tags
Return values
bool —true if the location is buildable ; otherwise, false
get_request_allow_url()
Gets request allow URL
get_request_allow_url(PersoRequest $request) : string
Parameters
- $request : PersoRequest
-
the perso request to confirm
Return values
string —the URL to allow the request
get_request_deny_url()
Gets request deny URL
get_request_deny_url(PersoRequest $request) : string
Parameters
- $request : PersoRequest
-
the perso request to confirm
Return values
string —the URL to deny the request
get_request_url()
Gets request URL
get_request_url(mixed $requestFlag, string $store, string $key, string $value) : the
Parameters
- $requestFlag : mixed
- $store : string
-
'perso' or 'registry'
- $key : string
-
the perso flag or registry key
- $value : string
-
the value to store
Return values
the —request URL
get_section()
Gets section to print to the user
get_section(mixed $story) : StorySection
Parameters
- $story : mixed
Return values
StorySection —the section, or null if not found
smarty_modifier_romanize()
Smarty romanize modifier plugin
smarty_modifier_romanize(mixed $number) : string
Type: modifier
Name: romanize
Purpose: prints a number in roman
Parameters
- $number : mixed
Return values
stringsmarty_modifier_sector()
Smarty sector modifier plugin
smarty_modifier_sector(Location $location) : string
Type: modifier
Name: sector
Purpose: prints the sector from a location
Parameters
- $location : Location
Return values
stringsmarty_modifier_text2html()
Smarty text to HTML modifier plugin
smarty_modifier_text2html(string $string) : string
Type: modifier
Name: text2html
Purpose: HTML representation for Azhàr profiles
Parameters
- $string : string
Tags
Return values
stringsmarty_modifier_yyyymmdd()
Smarty lower modifier plugin
smarty_modifier_yyyymmdd(string $string) : string
Type: modifier
Name: yyyymmdd
Purpose: Appends dashes to yyyymmdd string to output yyyy-mm-dd
Parameters
- $string : string
Tags
Return values
stringtoXml()
The main function for converting to an XML document.
toXml(mixed $data[, string $rootNodeName = 'data' ][, SimpleXMLElement $xml = null ][, string $unknownNodeName = 'unknownNode' ]) : string
Pass in a multidimensional array and this recursively loops through and builds up an XML document.
Parameters
- $data : mixed
- $rootNodeName : string = 'data'
-
What you want the root node to be — defaults to data.
- $xml : SimpleXMLElement = null
-
Should only be used recursively
- $unknownNodeName : string = 'unknownNode'
-
Name to give to unknown (numeric) keys
Return values
string —XML
api_output()
Outputs API reply, printing it in the specified format.
api_output(mixed $reply, string $xmlRoot[, string $xmlChildren = "item" ]) : mixed
The format will be read form $_REQUEST['format'].
Parameters
- $reply : mixed
-
the reply to format
- $xmlRoot : string
-
the XML root element name (optional, default value is 'data').
- $xmlChildren : string = "item"
-
the XML children elements name (optional, will be deducted from the context if omitted, or, if not possible, will be unknownNode)
cerbere()
Checks if credentials are okay and exits if not
cerbere() : mixed
If the credentials aren't valid, it will print an error message if OUTPUT_ERROR is defined and true.
This error message will be formatted through the api_output function if FORMAT_ERROR is defined and true ; otherwise, it will be print as is.
To help debug, you can also define ALLOW_LOCALHOST. If this constant is defined and true, any call from localhost will be accepted, without checking the key.
Tags
cerbere_die()
Prints a message in raw or API format, then exits.
cerbere_die(string $message) : never
The error message will be formatted through api_output if the constant FORMAT_ERROR is defined and true. Otherwise, it will be printed as is.
Parameters
- $message : string
-
The error message to print
Return values
neverloadEnvironment()
loadEnvironment() : mixed
get_name()
Gets the nickname from the specified perso ID
get_name(int $perso_id) : string
Parameters
- $perso_id : int
-
The specified perso ID
Return values
string —The perso's nickname
get_userid()
Gets the user ID from the specified username
get_userid(string $username) : int
Parameters
- $username : string
-
The username
Return values
int —the user ID
registry_get()
Gets an information from the application global registry
registry_get(DatabaseEngine $db, string $key) : string
Parameters
- $db : DatabaseEngine
- $key : string
Return values
stringregistry_set()
Sets an information in the application global registry
registry_set(DatabaseEngine $db, string $key, string $value) : void
Parameters
- $db : DatabaseEngine
- $key : string
-
the registry key
- $value : string
-
the value to store at the specified registry key
s()
Returns "s" when the $amount request a plural This function is a French plural helper.
s(int $amount) : string
Parameters
- $amount : int
Return values
string —'s' if $amount implies a plural ; '' if it implies a singular.
x()
Returns "x" when the $amount request a plural This function is a French plural helper.
x(int $amount) : string
Parameters
- $amount : int
Return values
string —'x' if $amount implies a plural ; '' if it implies a singular.
dprint_r()
Prints human-readable information about a variable.
dprint_r(mixed $expression) : mixed
It behaves like the print_r command, but the output is enclosed in pre tags, to have a preformatted HTML output.
Parameters
- $expression : mixed
-
The expression to be printed
new_guid()
Generates a GUID, or more precisely an UUID
new_guid() : string
Tags
Return values
string —the UUID
is_guid()
Determines if the expression is a valid UUID (a guid without {}).
is_guid(string $expression) : bool
Parameters
- $expression : string
-
the expression to check
Tags
Return values
bool —true if the specified expression is a valid UUID ; otherwise, false.
get_extension()
Gets file extension
get_extension(string $file) : string
Parameters
- $file : string
-
the file to get the extension
Return values
string —the extension from the specified file
supralog()
Inserts a message into the supralog
supralog(string $category, string $message[, string|null $source = null ]) : mixed
Parameters
- $category : string
-
the entry category
- $message : string
-
the message to log
- $source : string|null = null
-
the entry source.
initialize_lang()
Defines the LANG constant, to lang to print
initialize_lang() : void
This information is contained in the session, or if not yet defined, it's to determine according the user's browser preferences.
Tags
find_lang()
Gets a common lang spoken by the site and the user's browser
find_lang([string|null $fallback = null ]) : string
Parameters
- $fallback : string|null = null
-
The language when no common language is found
Tags
Return values
string —The language to use
get_http_accept_languages()
Gets the languages accepted by the browser, by order of priority.
get_http_accept_languages() : array<string|int, string>
This will read the HTTP_ACCEPT_LANGUAGE variable sent by the browser in the HTTP request.
Return values
array<string|int, string> —list of the languages accepted by browser
lang_load()
Loads specified language Smarty configuration file
lang_load(string $file[, mixed|null $sections = null ]) : void
Parameters
- $file : string
-
the file to load
- $sections : mixed|null = null
-
array of section names, single section or null
lang_get()
Gets a specified language expression defined in configuration file
lang_get(string $key) : string
Parameters
- $key : string
-
the configuration key matching the value to get
Return values
string —The value in the configuration file
to_unixtime()
Converts a YYYYMMDD or YYYY-MM-DD timestamp to unixtime
to_unixtime(string $timestamp) : int
Parameters
- $timestamp : string
-
the timestamp to convert
Tags
Return values
int —the unixtime
to_timestamp()
Converts a unixtime to the YYYYMMDD or YYYY-MM-DD timestamp format
to_timestamp([int $unixtime = null ][, int $format = 8 ]) : string
Parameters
- $unixtime : int = null
-
the time to convert
- $format : int = 8
-
8 or 10. If 8 (default), will output YYYYMMDD. If 10, YYYY-MM-DD.
Tags
Return values
string —the timestamp
get_hypership_time()
Converts a unixtime to the Hypership time format or gets the current hypership time.
get_hypership_time([int $unixtime = null ]) : string
Parameters
- $unixtime : int = null
-
The unixtime to convert to HyperShip time. If omitted, the current unixtime.
Tags
Return values
string —The HyperShip time
get_url()
Gets the URL matching the specified resource.
get_url() : string
Example:
$url = get_url('ship', $ship);
echo $url; //if $ship contains S00001, this should print /ship/S00001
Return values
string —the URL matching the specified resource
get_page_url()
Gets the current page URL
get_page_url() : string
Return values
string —the current page URL
get_server_url()
Gets the server URL
get_server_url() : string
Tags
Return values
string —the server URL
get_current_url()
Gets $_SERVER['PATH_INFO'] or computes the equivalent if not defined.
get_current_url() : string
This function allows the entry point controllers to get the current URL in a consistent way, for any redirection configuration
So with /foo/bar, /index.php/foo/bar, /zed/index.php/foo/bar or /zed/foo/bar get_current_url will return /foo/bar
Return values
string —the relevant URL part
get_current_url_fragments()
Gets an array of url fragments to be processed by controller
get_current_url_fragments() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —an array of string, one for each URL fragment
get_xhr_hash()
Gets an hash value to check the integrity of URLs in /do.php calls
get_xhr_hash(array<string|int, mixed> $args) : string
Parameters
- $args : array<string|int, mixed>
-
the args to compute the hash
Return values
string —the hash parameter for your xmlHttpRequest url
get_xhr_hashed_url()
Gets the URL to call do.php, the xmlHttpRequest controller
get_xhr_hashed_url() : string
Return values
string —the xmlHttpRequest url, with an integrity hash
get_xhr_url()
Gets the URL to call do.php, the xmlHttpRequest controller
get_xhr_url() : string
Return values
string —the xmlHttpRequest url
dieprint_r()
Output a general error, with human-readable information about the specified expression as error message ; terminates the current script.
dieprint_r(mixed $expression[, string $title = '' ]) : never
Parameters
- $expression : mixed
-
the expression to be printed
- $title : string = ''
-
the message title (optional, default will be 'Debug')
Tags
Return values
nevermessage_die()
Outputs an error message and terminates the current script.
message_die(int $msg_code[, string $msg_text = '' ][, string $msg_title = '' ][, string $err_line = '' ][, mixed $err_file = '' ][, string $sql = '' ]) : never
Error will be output through Smarty one of the following templates : error_block.tpl if the header have already been printed ; error.tpl if the error occurred before the header were called and printed.
If smarty couldn't be loaded, old_message_die method will be called, which produces a table output.
Parameters
- $msg_code : int
-
an integer constant identifying the error (HACK_ERROR, SQL_ERROR, GENERAL_ERROR)
- $msg_text : string = ''
-
the error message text (optional, but recommended)
- $msg_title : string = ''
-
the error message title (optional)
- $err_line : string = ''
-
the path of file where the error occurred (optional, suggested value is FILE)
- $err_file : mixed = ''
- $sql : string = ''
-
the SQL query (optional, used only if msg_code is SQL_ERROR)
Return values
neverold_message_die()
Outputs an error message and terminates the current script.
old_message_die(int $msg_code[, string $msg_text = '' ][, string $msg_title = '' ][, string $err_line = '' ][, mixed $err_file = '' ][, string $sql = '' ]) : never
This is the message_die method from Espace Win, used on Zed as fallback if Smarty isn't initialized yet. Former "german style" error HTML markups have been removed.
Parameters
- $msg_code : int
-
an integer constant identifying the error (HACK_ERROR, SQL_ERROR, GENERAL_ERROR)
- $msg_text : string = ''
-
the error message text (optional, but recommended)
- $msg_title : string = ''
-
the error message title (optional)
- $err_line : string = ''
-
the path of file where the error occurred (optional, suggested value is FILE)
- $err_file : mixed = ''
- $sql : string = ''
-
the SQL query (optional, used only if msg_code is SQL_ERROR)
Tags
Return values
neverget_openid_consumer()
Gets an Auth_OpenID_Consumer instance
get_openid_consumer() : Auth_OpenID_Consumer
Return values
Auth_OpenID_Consumer —the instance
openid_login()
Logs in the user if the OpenID is recognized.
openid_login(string $url) : mixed
Otherwise, sets an error message.
Parameters
- $url : string
-
The OpenID URL
session_update()
session_update() : mixed
nbc()
nbc() : mixed
get_info()
get_info(mixed $info) : mixed
Parameters
- $info : mixed
get_logged_user()
get_logged_user() : mixed
set_info()
set_info(mixed $info, mixed $value) : mixed
Parameters
- $info : mixed
- $value : mixed
clean_session()
Destroys $_SESSION array values, help ID
clean_session() : mixed
login()
Logs in user
login(mixed $user_id, mixed $username) : mixed
Parameters
- $user_id : mixed
- $username : mixed
logout()
Logs out user
logout() : mixed
SmartLineHandler()
Error handler called during SmartLine command execution.
SmartLineHandler(int $level, string $error, string $file, int $line) : mixed
Any error occurring during command execution will be set in STDERR.
To get an array with all the errors:
$errors = $yourSmartLine->gets_all(STDERR)
Or to prints all the error:
$yourSmartLine->prints_all(STDERR)
Or to pops (gets and deletes) only the last error:
$lastError = $yourSmartLine->gets(STDERR)
Parameters
- $level : int
-
The PHP error level
- $error : string
-
The error description
- $file : string
-
The script where the error occurred
- $line : int
-
The line where the error occurred
Tags
log_C()
Logs a Smartline command
log_C(string $command[, bool $isError = false ]) : mixed
Parameters
- $command : string
-
the command to log
- $isError : bool = false
-
indicates if the command is an error