NATS Variables
From TMM Wiki
Jump to navigationJump to searchAll input variables coming from surfers ($_REQUEST, $_GET, $_POST, $_COOKIE) are encoded as HTML entities. This secures SQL queries and ensures these variables don't break forms.
Use my_decode_entities(mixed var) to decode a whole array or single variables. Use my_encode_entities(mixed var to encode a whole array or single variables. Both of these functions use call-by-reference.
The following variables are predefined in PHP when someone is logs in:
- $config - Array - The NATS configuration
- $is_admin - Boolean - TRUE if the page you are on is an admin page
- $smarty - Object - The Smarty object used for displaying templates
- $loginid - Integer - The login ID of the user. When an admin overrides to another account, $loginid contains the overridden account's login ID
- $usr_loginid - Integer - The real login ID of the user. Normally the same as $loginid; different when an admin overrides another account
- $usr_username - String - The username of the currently logged in user
- $usr_type - Integer - 0 for standard, 90 for account representative, 95 for entity specific admin, 99 for global admin
- $usr_firstname - String - First name of the currently logged in use.
- $usr_lastname - String - Last name of the currently logged in user
- $usr_fullname - String - Full name of the currently logged in user
- $usr_email - String - E-Mail address of the currently logged in user
- $usr_unencoded - Boolean - Set to TRUE if this user wants unencoded linkcodes
- $overridden - Boolean - TRUE if the admin is overriding another account
The following Smarty variables always exist in templates:
- $script - String - name of the current script
- $is_startpage - Boolean - TRUE if the current script is the start page for this account
- $site_partner - Boolean - TRUE if this account belongs to a site partner
- $fullname - String - Full name of the current account
- $username - String - Username of the current account
- $usr_type - Integer - Same as PHP's $usr_type
To display a template, use Finalize() as shown in the basic file structure examples. This function makes sure the correct headers and footers are added to the page.
Printing Surfer IP Address
Use the following Smarty code: {$smarty.server.REMOTE_ADDR}