Coding standards
Security in ResourceSpace
Developer reference
- Project structure
- Database schema
- Fixed list fields
- Debugging ResourceSpace
- Writing your own plugins
- Context help links
- Custom fields ("user" defined)
- Query caching
- All user permissions
- Client side API calls
- Modals
- Sending user notifications
- Progressive Web App
- Managing (PHP) code dependencies
- Managing (JS) code dependencies
- OpenAPI documentation
- Automated Testing
Database
- Table: activity_log
- Table: annotation
- Table: annotation_node
- Table: api_log
- Table: collection
- Table: collection_keyword
- Table: collection_log
- Table: collection_resource
- Table: collection_savedsearch
- Table: comment
- Table: daily_stat
- Table: dash_tile
- Table: dynamic_tree_node
- Table: external_access_keys
- Table: filter
- Table: filter_rule
- Table: filter_rule_node
- Table: ip_lockout
- Table: job_queue
- Table: keyword
- Table: keyword_related
- Table: mail_log
- Table: message
- Table: node
- Table: node_keyword
- Table: plugins
- Table: preview_size
- Table: report
- Table: report_periodic_emails
- Table: report_periodic_emails_unsubscribe
- Table: request
- Table: research_request
- Table: resource
- Table: resource_alt_files
- Table: resource_custom_access
- Table: resource_dimensions
- Table: resource_keyword
- Table: resource_log
- Table: resource_node
- Table: resource_related
- Table: resource_type
- Table: resource_type_field
- Table: resource_type_field_resource_type
- Table: search_log
- Table: site_text
- Table: slideshow
- Table: sysvars
- Table: tab
- Table: user
- Table: user_collection
- Table: user_dash_tile
- Table: user_message
- Table: user_preferences
- Table: user_rating
- Table: user_report
- Table: user_userlist
- Table: usergroup
- Table: usergroup_collection
- Table: usergroup_dash_tile
User api session functions
get_api_session_destination()
Description
Resolve an allowlisted API credential destination and its delivery mode.Parameters
| Column | Type | Default | Description |
|---|---|---|---|
| $system | string | Destination configuration key. | |
| $url | string|null | Selected callback; required for destinations with multiple URLs. |
Return
| array|false | Destination with a single resolved URL, or false for invalid configuration/input. |
Location
include/user_api_session_functions.php lines 10 to 56
Definition
function get_api_session_destination(string $system, ?string $url = null): array|false
{
global $api_issue_valid_destinations;
$destination = $api_issue_valid_destinations[$system] ?? false;
if (!is_array($destination)) {
return false;
}
$delivery = $destination['delivery'] ?? 'post';
$urls = $destination['url'] ?? [];
$callback = is_array($urls) ? $url : $urls;
if (
!in_array($delivery, ['post', 'redirect_code'], true)
|| !is_string($callback)
|| $callback === ''
|| (is_array($urls) && !in_array($callback, $urls, true))
) {
return false;
}
if ($delivery === 'redirect_code') {
$parts = parse_url($callback);
$stateparam = $destination['stateparam'] ?? '';
if (
strlen($system) > 100
|| !filter_var($callback, FILTER_VALIDATE_URL)
|| preg_match('/[\r\n]/', $callback)
|| $parts === false
|| isset($parts['user']) || isset($parts['pass']) || isset($parts['fragment'])
|| (
($parts['scheme'] ?? '') !== 'https'
&& !(($parts['scheme'] ?? '') === 'http'
&& in_array($parts['host'] ?? '', ['localhost', '127.0.0.1', '[::1]'], true))
)
|| !is_string($stateparam)
|| !preg_match('/\A[A-Za-z_][A-Za-z0-9_]*\z/', $stateparam)
|| in_array($stateparam, ['code', 'error', 'system', 'url', 'submit', 'cancel'], true)
) {
return false;
}
}
$destination['url'] = $callback;
$destination['delivery'] = $delivery;
return $destination;
}
This article was last updated 29th October 2026 18:35 Europe/London time based on the source file dated 29th October 2026 14:30 Europe/London time.