-
Notifications
You must be signed in to change notification settings - Fork 53
Silgy functions and macros
Jurek Muszyński edited this page Jul 29, 2020
·
71 revisions
Name | Description |
---|---|
silgy_app_init | Called when application starts |
silgy_app_main | Called after parsing HTTP request header Main entry point for a request |
silgy_app_session_init | Called when new anonymous user session starts |
silgy_app_user_login | Called after successful authentication |
silgy_app_user_logout | Called when downgrading logged in user session to anonymous |
silgy_app_session_done | Called when closing anonymous user session |
silgy_app_done | Called when application shuts down |
Name | Description |
---|---|
silgy_add_message | Adds error message |
silgy_add_to_static_res | Adds string to static resources |
silgy_read_param_int | Reads integer parameter from silgy.conf |
silgy_read_param_str | Reads string parameter from silgy.conf |
silgy_set_auth_level | Sets required authorization level for a resource |
silgy_set_host_res | Assigns separate resource directories to a host |
Name | Description |
---|---|
HOST | Compares request Host with string |
ID | Last part of URI |
QS | Retrieves string value from query string |
QS_TEXT | Retrieves text from query string |
QSB | Retrieves boolean value from query string |
QSD | Retrieves double value from query string |
QSF | Retrieves float value from query string |
QSI | Retrieves integer value from query string |
QSU | Retrieves unsigned integer value from query string |
REQ | Compares the first part of request URI with string |
REQ_BOT | Answers whether request is from a bot |
REQ_DATA | Request payload |
REQ_DELETE | Answers whether request method is DELETE |
REQ_DSK | Answers whether request is from desktop user agent |
REQ_GET | Answers whether request method is GET |
REQ_LANG | User agent primary language |
REQ_METHOD | Request method |
REQ_MOB | Answers whether request is from mobile user agent |
REQ_POST | Answers whether request method is POST |
REQ_PUT | Answers whether request method is PUT |
REQ_URI | Request URI |
URI | Compares request URI with string |
Name | Description |
---|---|
OUT | Appends string to the output (client) buffer |
OUT_BIN | Appends binary data to the output (client) buffer |
OUT_HTML_HEADER | Appends standard HTML header to the output (client) buffer |
OUT_HTML_FOOTER | Appends standard HTML footer to the output (client) buffer |
OUT_MSG_DESCRIPTION | Writes error message to the output (client) buffer |
OUT_SNIPPET | Appends snippet to the output (client) buffer |
OUT_SNIPPET_MD | Translates to HTML and appends markdown snippet to the output (client) buffer |
REDIRECT_TO_LANDING | Redirects browser to landing page |
RES_CONTENT_DISPOSITION | Adds Content-Disposition to response header |
RES_CONTENT_TYPE | Sets response content type |
RES_DONT_CACHE | Prevents response from being cached by browser |
RES_HEADER | Adds HTTP header to response |
RES_KEEP_CONTENT | Prevents response content from being reset on error |
RES_LOCATION | Sets response location and changes its status to 303 |
RES_STATUS | Sets response status |
Name | Description |
---|---|
LOGGED | Tells whether current session is logged in or not |
US | Engine user session structure |
AUS | Application user session structure |
Name | Description |
---|---|
ALWAYS | Write string to log if logLevel > 0 |
ERR | Write string to log as ERROR if logLevel > 0 |
WAR | Write string to log as WARNING if logLevel > 1 |
INF | Write string to log if logLevel > 2 |
DBG | Write string to log if logLevel > 3 |
Name | Description |
---|---|
CALL_ASYNC | Calls asynchronous service |
CALL_ASYNC_NR | Calls asynchronous service without response |
CALL_ASYNC_TM | Calls asynchronous service with specific timeout |
SVC | Compares service name with string |
ASYNC_ERR_CODE | Error code passed from CALL_ASYNC |
Name | Description |
---|---|
silgy_usr_activate | Activates user account |
silgy_usr_add_user | Adds new user account without using current session |
silgy_usr_change_password | Changes user password |
silgy_usr_create_account | Creates user account |
silgy_usr_email_registered | Checks whether email is already registered |
silgy_usr_get_avatar | Retrieves user avatar into output buffer |
silgy_usr_login | Logs user in |
silgy_usr_logout | Logs user out |
silgy_usr_password_quality | Assesses password quality |
silgy_usr_reset_password | Resets user password using the emailed key |
silgy_usr_save_account | Updates user details |
silgy_usr_save_avatar | Saves user avatar |
silgy_usr_send_message | Saves message from user |
silgy_usr_send_passwd_reset_email | Sends password reset link |
silgy_usr_verify_passwd_reset_key | Verifies password reset key |
GET_USER_INT | Gets user setting (integer) |
GET_USER_STR | Gets user setting (string) |
SET_USER_INT | Sets user setting (integer) |
SET_USER_STR | Sets user setting (string) |
Name | Description |
---|---|
CALL_REST | Makes RESTful call using JSON objects |
CALL_REST_RAW | Makes RESTful call using plain strings |
CALL_REST_CONTENT_TYPE | Returns last CALL_REST HTTP response status |
CALL_REST_STATUS | Returns last CALL_REST response Content-Type |
REST_HEADER_PASS | Passes request header onto CALL_REST headers |
REST_HEADER_SET | Adds or overwrites REST header |
REST_HEADER_UNSET | Removes REST header |
REST_HEADERS_RESET | Removes all previously set REST headers |
Name | Description |
---|---|
JSON_ADD_STR | Adds string to JSON object |
JSON_ADD_STR_A | Adds string to JSON array |
JSON_ADD_INT | Adds integer to JSON object |
JSON_ADD_INT_A | Adds integer to JSON array |
JSON_ADD_FLOAT | Adds float to JSON object |
JSON_ADD_FLOAT_A | Adds float to JSON array |
JSON_ADD_BOOL | Adds bool to JSON object |
JSON_ADD_BOOL_A | Adds bool to JSON array |
JSON_ADD_RECORD | Adds JSON record to JSON object |
JSON_ADD_RECORD_A | Adds JSON record to JSON array |
JSON_ADD_ARRAY | Adds JSON array to JSON object |
JSON_ADD_ARRAY_A | Adds JSON array to JSON array |
JSON_COUNT | Returns number of elements in JSON object |
JSON_FROM_STRING | Converts string to JSON object |
JSON_GET_STR | Gets string from JSON object |
JSON_GET_STR_A | Gets string from JSON array |
JSON_GET_INT | Gets integer from JSON object |
JSON_GET_INT_A | Gets integer from JSON array |
JSON_GET_FLOAT | Gets float from JSON object |
JSON_GET_FLOAT_A | Gets float from JSON array |
JSON_GET_BOOL | Gets bool from JSON object |
JSON_GET_BOOL_A | Gets bool from JSON array |
JSON_GET_RECORD | Gets JSON record from JSON object |
JSON_GET_RECORD_A | Gets JSON record from JSON array |
JSON_GET_ARRAY | Gets JSON array from JSON object |
JSON_GET_ARRAY_A | Gets JSON array from JSON array |
JSON_LOG_DBG | Logs JSON object content on DBG level |
JSON_LOG_INF | Logs JSON object content on INF level |
JSON_PRESENT | Checks field presence in JSON object |
JSON_RESET | Removes all elements from JSON object |
JSON_TO_STRING | Converts JSON object to string |
JSON_TO_STRING_PRETTY | Converts JSON object to pretty string |
Name | Description |
---|---|
AMT | Formats amount considering session's or user agent's language |
COPY | Safely copies NULL-terminated string with UTF-8 awareness |
CSRFT_OK | Verifies CSRF token |
CSRFT_OUT_INPUT | Adds hidden input with CSRF token to the form |
CSRFT_REFRESH | Refreshes CSRF token |
MSG | Returns error message considering session's or user agent's language |
MSG_CAT_GREEN | Tells whether error code belongs to messages category |
MSG_CAT_ORANGE | Tells whether error code belongs to warnings category |
MSG_CAT_RED | Tells whether error code belongs to errors category |
md5 | Generates string's MD5 hash |
silgy_admin_info | Renders admin info page |
silgy_convert | Converts string from one CP to another |
silgy_email | Sends an email |
silgy_email_attach | Sends email with attachement |
silgy_filter_strict | Converts string to be suitable for a file name |
silgy_html_esc | HTML-escapes string |
silgy_html_unesc | HTML-unescapes string |
silgy_message | Returns an error message |
silgy_minify | Minifies CSS or JS |
silgy_random | Generates random string |
silgy_render_md | Converts markdown text into HTML |
silgy_sql_esc | SQL-escapes string |
STR | Returns string version depending on session or user agent's language |
urlencode | URI-encodes string |