ACTIONGROUP_ADVANCED
public
mixed
ACTIONGROUP_ADVANCED
= 6
public
mixed
ACTIONGROUP_ADVANCED
= 6
public
mixed
ACTIONGROUP_COLLECTION
= 2
public
mixed
ACTIONGROUP_EDIT
= 3
public
mixed
ACTIONGROUP_RESEARCH
= 5
public
mixed
ACTIONGROUP_RESOURCE
= 1
public
mixed
ACTIONGROUP_SHARE
= 4
public
mixed
ACTIONS_EMAIL_MAX_AGE
= 168
public
mixed
API_NATIVE_WHITELIST
= ['add_resource_to_collection', 'collection_add_resources', 'collection_remove_resources', 'create_collection', 'delete_access_keys', 'delete_alternative_file', 'delete_resource', 'delete_tabs', 'do_search', 'get_collections_resource_count', 'get_dash_search_data', 'get_field_options', 'get_users', 'get_user_message', 'relate_all_resources', 'remove_resource_from_collection', 'reorder_featured_collections', 'reorder_tabs', 'save_tab', 'send_collection_to_admin', 'send_user_message', 'update_related_resource', 'toggle_active_state_for_nodes', 'put_resource_data', 'get_processing_message', 'delete_resources_in_collection', 'checkperm', 'faces_set_node', 'update_field']
public
mixed
BLOCKED_STREAM_WRAPPERS
= ['php', 'file']
Types of content you can add to brand guideline pages
public
mixed
BRAND_GUIDELINES_CONTENT_TYPES
= ['text' => 0, 'resource' => 1, 'colour' => 2, 'group' => 100]
public
mixed
BRAND_GUIDELINES_DB_COLS_CONTENT
= columns_in('brand_guidelines_content', null, 'brand_guidelines')
public
mixed
BRAND_GUIDELINES_DB_COLS_PAGES
= columns_in('brand_guidelines_pages', null, 'brand_guidelines')
public
mixed
BRAND_GUIDELINES_URL_MANAGE_CONTENT
= "{$GLOBALS['baseurl']}/plugins/brand_guidelines/pages/manage/content.php"
public
mixed
COLLECTION_REQUEST
= 2
public
mixed
COLLECTION_TYPE_FEATURED
= 3
public
mixed
COLLECTION_TYPE_PUBLIC
= 4
public
mixed
COLLECTION_TYPE_REQUEST
= 6
public
mixed
COLLECTION_TYPE_SELECTION
= 2
public
mixed
COLLECTION_TYPE_SHARE_UPLOAD
= 5
public
mixed
COLLECTION_TYPE_STANDARD
= 0
public
mixed
COLLECTION_TYPE_UPLOAD
= 1
public
mixed
CONTRIBUTIONS_ICON
= '<i aria-hidden="true" class="icon-user-round-plus"></i> '
public
mixed
DATE_RANGE_SEPARATOR
= " / "
public
mixed
DEFAULT_DOWNLOAD_FILENAME_FORMAT
= 'RS%resource_%filename%size.%extension'
public
mixed
DEPRECATED_STARSEARCH
= 0
public
mixed
DOWNLOAD_FILE_LIFETIME
= 14
public
mixed
EMU_SCRIPT_MODE_IMPORT
= 100
public
mixed
EMU_SCRIPT_MODE_SYNC
= 1000
public
mixed
EMU_SCRIPT_SYNC_LOCK
= 'emu_sync_mode_lock'
public
mixed
FACIAL_RECOGNITION_CROP_SIZE_PREFIX
= '_facial_recognition_crop_'
public
mixed
FACIAL_RECOGNITION_PREPARED_IMAGE_EXT
= 'pgm'
public
mixed
FIELD_SORT_METHODS
= ['default' => 0, 'dot-notation' => 1]
public
mixed
FIELD_TYPE_CATEGORY_TREE
= 7
public
mixed
FIELD_TYPE_CHECK_BOX_LIST
= 2
public
mixed
FIELD_TYPE_COLOUR_PREVIEW
= 103
public
mixed
FIELD_TYPE_DATE
= 10
public
mixed
FIELD_TYPE_DATE_AND_OPTIONAL_TIME
= 4
public
mixed
FIELD_TYPE_DATE_RANGE
= 14
public
mixed
FIELD_TYPE_DROP_DOWN_LIST
= 3
public
mixed
FIELD_TYPE_DYNAMIC_KEYWORDS_LIST
= 9
public
mixed
FIELD_TYPE_EXPIRY_DATE
= 6
public
mixed
FIELD_TYPE_NUMERIC
= 101
public
mixed
FIELD_TYPE_RADIO_BUTTONS
= 12
public
mixed
FIELD_TYPE_TEXT_BOX_FORMATTED_AND_TINYMCE
= 8
public
mixed
FIELD_TYPE_TEXT_BOX_LARGE_MULTI_LINE
= 5
public
mixed
FIELD_TYPE_TEXT_BOX_MULTI_LINE
= 1
public
mixed
FIELD_TYPE_TEXT_BOX_SINGLE_LINE
= 0
public
mixed
FIELD_TYPE_TEXT_RICH
= 102
public
mixed
FIELD_TYPE_WARNING_MESSAGE
= 13
public
mixed
FULLTEXT_SEARCH_PREFIX
= '@FULL_TEXT'
public
mixed
FULLTEXT_SEARCH_QUOTES_PLACEHOLDER
= '[QUOTES]'
public
mixed
ICON_CUBE
= '<i class="icon-box" aria-hidden="true"></i> '
public
mixed
ICON_EDIT
= '<i class="icon-pencil" aria-hidden="true"></i> '
public
mixed
ICON_FOLDER
= '<i class="icon-folder" aria-hidden="true"></i> '
public
mixed
ICON_REMOVE
= '<i class="icon-circle-minus" aria-hidden="true"></i> '
Defines the maximum number of instances a Provider with multi-instance support can have.
public
int
IMAGE_BANKS_MAX_INSTANCE_COUNT
= 100
public
mixed
INLINE_VIEWABLE_TYPES
= ['pdf' => 'application/pdf', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'bmp' => 'image/bmp', 'webp' => 'image/webp', 'svg' => 'image/svg+xml', 'txt' => 'text/plain']
public
mixed
JOB_PRIORITY_COMPLETED
= 9
public
mixed
JOB_PRIORITY_IMMEDIATE
= 0
public
mixed
JOB_PRIORITY_SYSTEM
= 2
public
mixed
JOB_PRIORITY_USER
= 1
public
mixed
LIB_OPENSEADRAGON
= '/lib/openseadragon'
public
mixed
LINK_CARET
= '<i aria-hidden="true" class="icon-chevron-right"></i> '
public
mixed
LINK_CARET_BACK
= '<i aria-hidden="true" class="icon-chevron-left"></i> '
public
mixed
LINK_CHEVRON_RIGHT
= '<i aria-hidden="true" class="icon-chevron-right"></i>'
public
mixed
LINK_PLUS
= '<i aria-hidden="true" class="icon-plus"></i> '
public
mixed
LINK_PLUS_CIRCLE
= '<i aria-hidden="true" class="icon-circle-plus"></i> '
public
mixed
LOG_CODE_ACCESS_CHANGED
= 'a'
public
mixed
LOG_CODE_ALTERNATIVE_CREATED
= 'b'
public
mixed
LOG_CODE_COLLECTION_ACCESS_CHANGED
= 'A'
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE
= 'a'
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE_COMMENT
= 'm'
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE_COPIED
= 'c'
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE_RATING
= '*'
public
mixed
LOG_CODE_COLLECTION_BATCH_TRANSFORMED
= 'b'
public
mixed
LOG_CODE_COLLECTION_COLLECTION_DOWNLOADED
= 'Z'
public
mixed
LOG_CODE_COLLECTION_DELETED_ALL_RESOURCES
= 'D'
public
mixed
LOG_CODE_COLLECTION_DELETED_COLLECTION
= 'X'
public
mixed
LOG_CODE_COLLECTION_DELETED_RESOURCE
= 'd'
public
mixed
LOG_CODE_COLLECTION_EDIT_UPLOAD_SHARE
= 'EEU'
public
mixed
LOG_CODE_COLLECTION_EMAILED_COLLECTION
= 'E'
public
mixed
LOG_CODE_COLLECTION_REMOVED_ALL_RESOURCES
= 'R'
public
mixed
LOG_CODE_COLLECTION_REMOVED_RESOURCE
= 'r'
public
mixed
LOG_CODE_COLLECTION_REORDER
= 'O'
public
mixed
LOG_CODE_COLLECTION_SHARED_COLLECTION
= 'S'
public
mixed
LOG_CODE_COLLECTION_SHARED_RESOURCE_WITH
= 's'
public
mixed
LOG_CODE_COLLECTION_SHARED_UPLOAD
= 'SEU'
public
mixed
LOG_CODE_COLLECTION_STOPPED_RESOURCE_ACCESS
= 't'
public
mixed
LOG_CODE_COLLECTION_STOPPED_SHARING_COLLECTION
= 'T'
public
mixed
LOG_CODE_COPIED
= 'C'
public
mixed
LOG_CODE_CREATED
= 'c'
public
mixed
LOG_CODE_CREATED_BY_CHANGED
= 'o'
public
mixed
LOG_CODE_DELETED
= 'x'
public
mixed
LOG_CODE_DELETED_ACCESS_KEY
= 'XK'
public
mixed
LOG_CODE_DELETED_ALTERNATIVE
= 'y'
public
mixed
LOG_CODE_DELETED_PERMANENTLY
= 'xx'
public
mixed
LOG_CODE_DISABLED
= '-'
public
mixed
LOG_CODE_DOWNLOADED
= 'd'
public
mixed
LOG_CODE_EDITED
= 'e'
public
mixed
LOG_CODE_EDITED_RESOURCE
= 'EDT'
public
mixed
LOG_CODE_EMAILED
= 'E'
public
mixed
LOG_CODE_ENABLED
= '+'
public
mixed
LOG_CODE_EXTERNAL_UPLOAD
= 'EUP'
public
mixed
LOG_CODE_FAILED_LOGIN_ATTEMPT
= 'Xl'
public
mixed
LOG_CODE_JOB_ADDED
= 'J'
public
mixed
LOG_CODE_JOB_COMPLETED
= 'JC'
public
mixed
LOG_CODE_JOB_DELETED
= 'JD'
public
mixed
LOG_CODE_LOCKED
= 'X'
public
mixed
LOG_CODE_LOGGED_IN
= 'l'
public
mixed
LOG_CODE_MULTI_EDITED
= 'm'
public
mixed
LOG_CODE_NODE_REVERT
= 'N'
public
mixed
LOG_CODE_REORDERED
= 'R'
public
mixed
LOG_CODE_REPLACED
= 'f'
public
mixed
LOG_CODE_REVERTED_REUPLOADED
= 'r'
public
mixed
LOG_CODE_SET_NO_FILE
= 'NOFIL'
public
mixed
LOG_CODE_STATICSYNC_FILE_MODIFIED
= 'sf'
public
mixed
LOG_CODE_STATUS_CHANGED
= 's'
public
mixed
LOG_CODE_SYSTEM
= 'S'
public
mixed
LOG_CODE_TRANSFORMED
= 't'
public
mixed
LOG_CODE_UNLOCKED
= 'Y'
public
mixed
LOG_CODE_UNSET_NO_FILE
= 'FIL'
public
mixed
LOG_CODE_UNSPECIFIED
= 'U'
public
mixed
LOG_CODE_UPLOADED
= 'u'
public
mixed
LOG_CODE_UPLOADED_PREVIEW
= 'up'
public
mixed
LOG_CODE_USER_OPT_IN
= 'O'
public
mixed
LOG_CODE_VIEWED
= 'v'
public
mixed
LUCIDE_EXTENSIONS
= [
// Images
'png' => 'image',
'jpg' => 'image',
'jpeg' => 'image',
'gif' => 'image',
'svg' => 'image',
'svgz' => 'image',
'tif' => 'image',
'tiff' => 'image',
'bmp' => 'image',
'ico' => 'image',
'psd' => 'image',
'raw' => 'image',
'dng' => 'image',
'cr2' => 'image',
'nef' => 'image',
'orf' => 'image',
'rw2' => 'image',
// Video
'mp4' => 'video',
'mov' => 'video',
'avi' => 'video',
'mkv' => 'video',
'flv' => 'video',
'fla' => 'video',
'wmv' => 'video',
'3gp' => 'video',
'webm' => 'video',
'vob' => 'video',
'm4v' => 'video',
'mxf' => 'video',
// Audio
'mp3' => 'music',
'wav' => 'music',
'aac' => 'music',
'flac' => 'music',
'm4a' => 'music',
'wma' => 'music',
'ogg' => 'music',
'aif' => 'music',
'aiff' => 'music',
// Documents
'pdf' => 'file-text',
'doc' => 'file-text',
'docx' => 'file-text',
'odt' => 'file-text',
'xls' => 'file-spreadsheet',
'xlsx' => 'file-spreadsheet',
'ods' => 'file-spreadsheet',
'ppt' => 'file-chart-pie',
'pptx' => 'file-chart-pie',
'odp' => 'file-chart-pie',
'rtf' => 'file-text',
'txt' => 'file-text',
'md' => 'file-text',
// Code
'php' => 'file-braces',
'html' => 'file-braces',
'htm' => 'file-braces',
'css' => 'file-braces',
'js' => 'file-braces',
'json' => 'file-braces',
'xml' => 'file-braces',
'sql' => 'file-braces',
'sh' => 'file-braces',
'py' => 'file-braces',
'java' => 'file-braces',
'c' => 'file-braces',
'cpp' => 'file-braces',
'rb' => 'file-braces',
'go' => 'file-braces',
// Compressed
'zip' => 'file-archive',
'rar' => 'file-archive',
'7z' => 'file-archive',
'tar' => 'file-archive',
'gz' => 'file-archive',
'bz2' => 'file-archive',
'xz' => 'file-archive',
'iso' => 'file-archive',
// Miscellaneous
'log' => 'file-text',
'cfg' => 'file-text',
'ini' => 'file-text',
'csv' => 'file-spreadsheet',
// Fonts
'ttf' => 'file-type',
'otf' => 'file-type',
'woff' => 'file-type',
'woff2' => 'file-type',
// Default to 'file' for unrecognized extensions
'default' => 'file',
]
public
mixed
MANAGED_REQUEST
= 1
public
mixed
MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX
= '!deprecated'
public
mixed
MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX_CATEGORY_TREE
= "-1,,!deprecated\n"
public
mixed
MPLUS_FIELD_ID
= '__id'
public
mixed
MPLUS_LAST_IMPORT
= 'last_museumplus_import'
public
mixed
MPLUS_LAST_LOG_TRUNCATE
= 'last_museumplus_log_truncate'
public
mixed
MPLUS_LOCK
= 'museumplus_import'
public
mixed
NODE_NAME_STRING_SEPARATOR
= '@@|@@'
public
mixed
NODE_TOKEN_NOT
= '!'
public
mixed
NODE_TOKEN_OR
= '|'
public
mixed
NODE_TOKEN_PREFIX
= '@@'
public
mixed
NON_FIXED_LIST_SINGULAR_RESOURCE_VALUE_FIELD_TYPES
= \array_merge($TEXT_FIELD_TYPES, \array_diff($DATE_FIELD_TYPES, [\FIELD_TYPE_DATE_RANGE]))
public
mixed
NON_PREVIEW_EXTENSIONS
= ['zip', 'fla']
public
mixed
PHP_VERSION_ID
= $version[0] * 10000 + $version[1] * 100 + $version[2]
public
mixed
PHP_VERSION_SUPPORTED
= 80200
public
mixed
REPORT_PLACEHOLDER_NON_CORRELATED_SQL
= '[non_correlated_sql]'
public
mixed
RESOURCE_ACCESS_CONFIDENTIAL
= 2
public
mixed
RESOURCE_ACCESS_CUSTOM_GROUP
= 3
public
mixed
RESOURCE_ACCESS_FULL
= 0
public
mixed
RESOURCE_ACCESS_INVALID_REQUEST
= 99
public
mixed
RESOURCE_ACCESS_RESTRICTED
= 1
public
mixed
RESOURCE_ACCESS_TYPES
= [\RESOURCE_ACCESS_FULL, \RESOURCE_ACCESS_RESTRICTED, \RESOURCE_ACCESS_CONFIDENTIAL, \RESOURCE_ACCESS_CUSTOM_GROUP]
public
mixed
RESOURCE_LOG_APPEND_PREVIOUS
= -1
public
mixed
RESOURCE_PREVIEWS_ALL
= 1
public
mixed
RESOURCE_PREVIEWS_MINIMAL
= 2
public
mixed
RESOURCE_PREVIEWS_NONE
= 0
public
mixed
RESOURCESPACE_BASE_PATH
= \dirname(__DIR__)
public
mixed
RS_FILTER_ALL
= 1
public
mixed
RS_FILTER_ANY
= 3
public
mixed
RS_FILTER_NODE_IN
= 1
public
mixed
RS_FILTER_NODE_NOT_IN
= 0
public
mixed
RS_FILTER_NONE
= 2
public
mixed
RS_SYSTEM_UTILITIES
= ['im-convert' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - convert', 'show_on_check_page' => \true, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'im-identify' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - identify', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'im-composite' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - composite', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'im-mogrify' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - mogrify', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'ghostscript' => ['required' => \true, 'path_var_name' => 'ghostscript_path', 'display_name' => 'Ghostscript', 'show_on_check_page' => \true, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['ghostscript']]]]], 'ffmpeg' => ['required' => \true, 'path_var_name' => 'ffmpeg_path', 'display_name' => 'FFmpeg', 'show_on_check_page' => \true, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['ffmpeg', 'avconv']]]]], 'ffprobe' => ['required' => \true, 'path_var_name' => 'ffmpeg_path', 'display_name' => 'ffprobe', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['ffprobe', 'avprobe']]]]], 'exiftool' => ['required' => \true, 'path_var_name' => 'exiftool_path', 'display_name' => 'ExifTool', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-ver', 'callback' => ['fct_name' => 'check_exiftool_cli_version_found', 'args' => []]]], 'php' => ['required' => \false, 'path_var_name' => 'php_path', 'display_name' => 'PHP', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => '', 'args' => []]]], 'python' => ['required' => \false, 'path_var_name' => 'python_path', 'display_name' => 'Python', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--version', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['Python']]]]], 'opencv' => ['required' => \false, 'path_var_name' => 'python_path', 'display_name' => 'OpenCV (Python module)', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-c "import cv2; print(cv2.__version__)"', 'callback' => ['fct_name' => 'check_numeric_cli_version_found', 'args' => []]]], 'archiver' => ['required' => \false, 'path_var_name' => 'archiver_path', 'display_name' => 'Archiver', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--help', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['zip', '7z', 'tar']]]]], 'fits' => ['required' => \false, 'path_var_name' => 'fits_path', 'display_name' => 'File Information Tool Set (FITS)', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-v', 'callback' => ['fct_name' => 'check_numeric_cli_version_found', 'args' => []]]], 'pdftotext' => ['required' => \false, 'path_var_name' => 'pdftotext_path', 'display_name' => 'pdftotext', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-v', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['pdftotext']]]]], 'blender' => ['required' => \false, 'path_var_name' => 'blender_path', 'display_name' => 'Blender', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-v', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['blender']]]]], 'unoconvert' => ['required' => \false, 'path_var_name' => 'unoconv_path', 'display_name' => 'Unoserver', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--version', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['unoconvert']]]]], 'calibre' => ['required' => \false, 'path_var_name' => 'calibre_path', 'display_name' => 'Calibre', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--version', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['calibre']]]]]]
public
mixed
SENSITIVE_VARIABLE_NAMES
= [
'mysql_server',
'mysql_username',
'mysql_password',
'mysql_db',
'mysql_log_location',
'mysqli_ssl_server_cert',
'mysqli_ssl_ca_cert',
'read_only_db_username',
'read_only_db_password',
'storagedir',
'storageurl',
'email_notify',
'scramble_key',
'scramble_key_old',
'api_scramble_key',
'smtp_username',
'smtp_password',
'homeanim_folder',
'remote_config_url',
'remote_config_key',
'syncdir',
'debug_log_location',
'log_error_messages_url',
'CORS_whitelist',
'facial_recognition_face_recognizer_models_location',
'fstemplate_alt_scramblekey',
// Plugins
'ldapauth_rootdn',
'ldapauth_rootpass',
'ldapauth',
'tms_link_user',
'tms_link_password',
'youtube_publish_username',
'youtube_publish_password',
'vimeo_publish_client_id',
'vimeo_publish_client_secret',
'vimeo_publish_access_token',
'museumplus_api_user',
'museumplus_api_pass',
'emu_email_notify',
]
public
mixed
SEVERITY_CRITICAL
= 0
public
mixed
SEVERITY_NOTICE
= 2
public
mixed
SEVERITY_WARNING
= 1
public
mixed
STATUS_ACTIVE
= 1
public
mixed
STATUS_COMPLETE
= 2
public
mixed
STATUS_DISABLED
= 0
public
mixed
STATUS_ERROR
= 5
public
mixed
STATUS_INPROGRESS
= 3
public
mixed
SUBMITTED_COLLECTION
= 5
public
mixed
SUBMITTED_RESOURCE
= 4
public
mixed
SYSTEM_DATABASE_IDS_CHUNK_SIZE
= 500
public
mixed
SYSTEM_DATABASE_MAX_RETRIES
= 2
public
mixed
SYSTEM_DOWNLOAD_CONFIG_FORCE_OBFUSCATION
= \true
public
mixed
SYSTEM_MAX_PREVIEW_ATTEMPTS
= 5
public
mixed
SYSTEM_REQUIRED_PHP_MODULES
= ['curl' => 'curl_init', 'gd' => 'imagecrop', 'xml' => 'xml_parser_create', 'mbstring' => 'mb_strtoupper', 'intl' => 'locale_get_default', 'json' => 'json_decode', 'zip' => 'zip_open', 'apcu' => 'apcu_fetch', 'dom' => 'dom_import_simplexml', 'mysqli' => 'mysqli_init']
public
mixed
SYSTEM_UPGRADE_LEVEL
= 30
public
mixed
TAG_EDITOR_DELIMITER
= '~'
public
mixed
THEME_IMAGES_NUMBER
= 3
public
mixed
THIS_PROCESS_LOCK
= 'watchedsearchescron'
public
mixed
TINYMCE_VALID_PLUGINS
= ['autolink' => 'Autolink', 'autoresize' => 'Autoresize', 'charmap' => 'Character Map', 'code' => 'Code', 'directionality' => 'Directionality', 'emoticons' => 'Emoticons', 'fullscreen' => 'Full Screen', 'help' => 'Help', 'insertdatetime' => 'Insert Date/Time', 'link' => 'Link', 'lists' => 'Lists', 'advlist' => 'List Styles', 'nonbreaking' => 'Nonbreaking Space', 'preview' => 'Preview', 'quickbars' => 'Quick Toolbars', 'searchreplace' => 'Search and Replace', 'visualblocks' => 'Visual Blocks', 'visualchars' => 'Visual Characters', 'wordcount' => 'Word Count']
public
mixed
TMS_LINK_MODULES_MIGRATED
= 'tms_link_modules_migrated'
public
mixed
UNREGISTER_WRAPPERS
= ['ftp', 'ftps', 'phar']
public
mixed
UPLOAD_ICON
= '<i aria-hidden="true" class="icon-upload"></i> '
public
mixed
USER_REQUEST
= 3
public
mixed
VIEW_IN_BROWSER_EXTENSIONS
= ['pdf', 'mp3']
public
mixed
WORKFLOW_DEFAULT_ICON
= "workflow"
public
mixed
WORKFLOW_DEFAULT_ICONS
= ['-2' => 'clock-arrow-up', '-1' => 'clock-fading', '0' => 'check', '1' => 'file-clock', '2' => 'file-archive', '3' => 'file-x']
Retrieve a list of user actions for the My Actions area.
get_user_actions([bool $countonly = false ][, string $type = "" ][, string $order_by = "date" ][, string $sort = "DESC" ]) : mixed
Return the count of actions instead of the actions themselves
Filter the actions based on action type The available inputs are: resourcereview resourcerequest userrequest
Count or array of actions
Return an SQL statement to find all editable resources in $actions_notify_states.
get_editable_resource_sql() : mixed
Get recent user actions, optionally for all users. For use by action notifications cron job.
get_user_actions_recent(int $minutes, bool $allusers) : array<string|int, mixed>
Return actions that were created in the last $minutes minutes
Return actions for all users? If false, or if the current user does not have the 'a' permission and the current script is not running from CLI then only the currently logged on user's actions will be returned
An array with the user id as the index and the following arrays of sub elements. Included columns are as per get_user_actions()
Filter actions in the provided array to return only those applicable to the given user
actions_filter_by_user(int $actionuser, array<string|int, mixed> $actions) : array<string|int, mixed>
User ref to get actions for
Array of actions as returned by get_user_actions_recent()
Subset of actions for the given user as would be provided by get_user_actions()
Returns a standard AJAX response for unauthorised access
ajax_permission_denied() : void
The function will return a 401 HTTP status code.
Send AJAX response back to the client together with the appropriate HTTP status code
ajax_send_response(int $code, array<string|int, mixed> $response) : void
HTTP status code for this response
Response data (@see other ajax_response_* functions for expected structure)
Send AJAX text/html response back to the client together with the appropriate HTTP status code
ajax_send_text_response(int $code, string $response) : void
HTTP status code for this response
Response data (text/html)
Builds the correct response expected for a success request where there is data to return (e.g getting search results)
ajax_response_ok(array<string|int, mixed> $data) : array<string|int, mixed>
Data to be returned back to the client
Builds the correct response expected for failures.
ajax_response_fail(array<string|int, mixed> $data) : array<string|int, mixed>
When a call is rejected due to invalid data or call conditions, the response data key contains an object explaining what went wrong, typically a hash of validation errors.
Provides details of why the request failed. If the reasons for failure correspond to POST values, the response objects' keys SHOULD correspond to those POST values. If generic, use message key instead (@see ajax_build_message() ).
Builds the correct response expected for a success request where there is no data to return (e.g when deleting a record)
ajax_response_ok_no_data() : array<string|int, mixed>
Returns a standard AJAX response for unauthorised access with a 401 HTTP status code
ajax_unauthorized() : void
Builds a message to be used in an AJAX response
ajax_build_message(string $msg) : array<string|int, mixed>
An end-user message explaining what happened (as a generic message for fails or part of errors)
Returns a message
Get (viewable) "annotate_fields" config. The configs' value is validated (e.g. view access, supported type, active RTF, excluded RT, etc.).
get_annotate_fields() : array<string|int, mixed>
Get all metadata fields which could be used for the annotate feature. Removes inapplicable fields when excluding specific resource types.
get_all_viable_annotate_metadata_fields(array<int, int> $exclude_resource_types) : array<string|int, mixed>
List of Resource types to exclude
Get annotation by ID
getAnnotation(int $ref) : array<string|int, mixed>
Annotation ID
General annotations search functionality
getAnnotations([int $resource = 0 ][, int $resource_type_field = 0 ][, int $user = 0 ][, int $page = 0 ]) : array<string|int, mixed>
Get number of annotations available for a resource.
getResourceAnnotationsCount(int $resource) : int
Note: multi page resources will show the total number (ie. all pages)
Resource ID
Get annotations for a specific resource
getResourceAnnotations(int $resource[, int $page = 0 ]) : array<string|int, mixed>
Resource ID
Page number of a document. Non documents will have 0
Create an array of Annotorious annotation objects which can be JSON encoded and passed directly to Annotorious
getAnnotoriousResourceAnnotations(int $resource[, int $page = 0 ][, array{k?: string} $ctx = [] ]) : array<string|int, mixed>
Resource ID
Page number of a document
Environment context (e.g. external share)
Check if an annotation can be editable (add/ edit + remove) by the user. Please note that Annotorious JS library is treating edit & remove as the same under the "editable" property.
annotationEditable(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Environment context (e.g. external share)
Get all tags of an annotation. Checks if a tag is attached to the resource, allowing the user to search by it which is represented by the virtual column "tag_searchable"
getAnnotationTags(array<string|int, mixed> $annotation) : array<string|int, mixed>
Delete annotation
deleteAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Annotation array as returned by getAnnotation()
Environment context (e.g. external share)
Create new annotations based on Annotorious annotation
createAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool|int
NOTE: Annotorious annotation shape is an array but at the moment they use only the first shape found
Environment context (e.g. external share)
Returns false on failure OR the ref of the newly created annotation
Update (field bound) annotation and its tags, if applicable.
updateAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Text (comment) annotatins can't be updated (same as the comments logic for those with o perm).
Environment context (e.g. external share)
Add relations between annotation and nodes
addAnnotationNodes(int $annotation_ref, array<string|int, mixed> $nodes) : bool
The annotation ID in ResourceSpace
List of node structures get_nodes(). Only the "ref" property is required.
Utility function which allows annotation tags to be prepared (i.e make sure they are all valid nodes) before creating associations between annotations and tags
prepareTags(array<string|int, mixed> $dirty_tags) : array<string|int, mixed>
Original array of tags. These can be (in)valid tags/ new tags. IMPORTANT: a tag should have the same structure as a node
Add annotation count to a search result set
search_add_annotation_count(mixed &$result) : mixed
Get all translations relevant to the Annotorious (RSTagging) plugin.
get_annotorious_lang(array<string, string> $map) : array<string|int, mixed>
Language strings map
Get all ResourceSpace config options relevant for the Annotorious (RSTagging) plugin functionality.
get_annotorious_resourcespace_config() : array<string|int, mixed>
Get list of allowed field types to be configured for the "annotate_fields" option
get_valid_annotate_field_types() : array<string|int, mixed>
Get annotate file path (old annotate plugin logic)
get_annotate_file_path(int $ref, bool $getfilepath, string $extension) : string
Create annotations PDF (old annotate plugin logic)
create_annotated_pdf(int $ref[, bool $is_collection = false ][, string $size = "letter" ][, bool $cleanup = false ][, bool $preview = false ]) : mixed
Utility function to generate a one-off TCPDF variant (with multiRow method)
annotation_pdf_class() : mixed
Check if a resource can be annotated
resource_can_be_annotated(int $ref) : bool
Resource ID
Check if a given resource type is applicable for annotations
resource_type_applicable_for_annotations(int $ref) : bool
Resource type ID
api_do_search(mixed $search[, mixed $restypes = "" ][, mixed $order_by = "relevance" ][, mixed $archive = 0 ][, mixed $fetchrows = -1 ][, mixed $sort = "desc" ][, mixed $offset = 0 ]) : mixed
api_search_get_previews(mixed $search[, mixed $restypes = "" ][, mixed $order_by = "relevance" ][, mixed $archive = 0 ][, mixed $fetchrows = -1 ][, mixed $sort = "desc" ][, mixed $recent_search_daylimit = "" ][, mixed $getsizes = "" ][, mixed $previewext = "jpg" ]) : mixed
api_get_resource_field_data(mixed $resource) : mixed
api_create_resource(mixed $resource_type[, mixed $archive = 999 ][, mixed $url = "" ][, mixed $no_exif = false ][, mixed $revert = false ][, mixed $autorotate = false ][, mixed $metadata = "" ]) : mixed
Provides simple way to update field by passing in simple string values for text fields, comma separated values for fixed list (node) fields, using double quotes to enclose strings and backslash as escape character Uses update_field and add_resource_nodes/delete_resource_nodes
api_update_field(mixed $resource, mixed $field, mixed $value[, mixed $nodevalues = false ]) : mixed
api_delete_resource(mixed $resource) : mixed
api_copy_resource(mixed $from[, mixed $resource_type = -1 ]) : mixed
api_get_resource_log(mixed $resource[, mixed $fetchrows = -1 ]) : mixed
api_update_resource_type(mixed $resource, mixed $type) : mixed
{@see get_resource_path()}
api_get_resource_path(mixed $ref[, mixed $not_used = null ][, mixed $size = "" ][, mixed $generate = true ][, mixed $extension = "jpg" ][, mixed $page = 1 ][, mixed $watermarked = false ][, mixed $alternative = -1 ][, bool $write_metadata = false ]) : mixed
Specify if embedded metadata should be written to the requested file (if applicable).
api_get_resource_data(mixed $resource) : mixed
api_put_resource_data(mixed $resource, array<string|int, mixed> $data) : mixed
api_get_alternative_files(mixed $resource[, mixed $order_by = "" ][, mixed $sort = "" ][, mixed $type = "" ]) : mixed
api_get_resource_types() : mixed
api_add_alternative_file(mixed $resource, mixed $name[, mixed $description = '' ][, mixed $file_name = '' ][, mixed $file_extension = '' ][, mixed $file_size = 0 ][, mixed $alt_type = '' ][, mixed $file = '' ]) : mixed
api_delete_access_keys(mixed $access_keys, mixed $resources, mixed $collections) : mixed
api_delete_alternative_file(mixed $resource, mixed $ref) : mixed
api_upload_file(mixed $ref[, mixed $no_exif = false ][, mixed $revert = false ][, mixed $autorotate = false ][, mixed $file_path = "" ]) : mixed
api_upload_file_by_url(mixed $ref[, mixed $no_exif = false ][, mixed $revert = false ][, mixed $autorotate = false ][, mixed $url = "" ]) : mixed
api_get_related_resources(mixed $ref) : mixed
api_get_field_options(mixed $ref[, mixed $nodeinfo = false ]) : mixed
api_get_nodes(mixed $ref[, mixed $parent = null ][, mixed $recursive = false ][, mixed $offset = null ][, mixed $rows = null ][, mixed $name = "" ][, mixed $use_count = false ][, mixed $order_by_translated_name = false ]) : mixed
api_get_user_collections() : mixed
api_add_resource_to_collection(mixed $resource[, mixed $collection = '' ][, mixed $search = '' ]) : mixed
api_collection_add_resources([mixed $collection = '' ][, mixed $resources = '' ][, mixed $search = '' ][, mixed $selected = false ]) : mixed
api_remove_resource_from_collection(mixed $resource[, mixed $collection = '' ]) : mixed
api_collection_remove_resources([mixed $collection = '' ][, mixed $resources = '' ][, mixed $removeall = false ][, mixed $selected = false ]) : mixed
api_create_collection(mixed $name[, mixed $forupload = false ]) : mixed
api_delete_collection(mixed $ref) : mixed
api_search_public_collections([mixed $search = "" ][, mixed $order_by = "name" ][, mixed $sort = "ASC" ][, mixed $exclude_themes = true ][, mixed $exclude_public = false ]) : mixed
api_set_node(mixed $ref, mixed $resource_type_field, mixed $name[, mixed $parent = '' ][, mixed $order_by = 0 ][, mixed $returnexisting = false ]) : mixed
api_add_resource_nodes(mixed $resource, mixed $nodestring) : mixed
api_add_resource_nodes_multi(mixed $resources, mixed $nodestring) : mixed
api_resource_log_last_rows([mixed $minref = 0 ][, mixed $days = 7 ][, mixed $maxrecords = 0 ][, string $field = '' ][, string $log_code = '' ]) : mixed
api_get_resource_all_image_sizes(mixed $resource) : mixed
api_get_node_id(mixed $value, mixed $resource_type_field) : mixed
api_replace_resource_file(mixed $ref, mixed $file_location[, mixed $no_exif = false ][, mixed $autorotate = false ][, mixed $keep_original = true ]) : mixed
API binding to get_data_by_field function.
api_get_data_by_field(int $ref, int $field) : bool|array<string|int, mixed>
Resource ref
Resource type field ref
API binding to modified get_resource_collections function, as we only want to pass collection ID, name, and description for security purposes.
api_get_resource_collections(int $ref) : bool|array<string|int, mixed>
Resource ref
api_update_related_resource(mixed $ref, mixed $related[, mixed $add = 1 ]) : mixed
api_get_collections_resource_count(string $refs) : mixed
api_get_users([mixed $find = "" ][, mixed $exact_username_match = false ]) : mixed
api_save_collection(int $ref, array<string|int, mixed> $coldata) : mixed
api_get_collection(int $ref) : mixed
api_send_user_message(mixed $users, mixed $text) : mixed
api_get_profile_image(mixed $user) : mixed
api_get_system_status([mixed $basic = false ]) : mixed
api_relate_all_resources(mixed $related) : mixed
api_show_hide_collection(mixed $collection, mixed $show, mixed $user) : mixed
api_send_collection_to_admin(mixed $collection) : mixed
api_reorder_featured_collections(mixed $refs) : mixed
api_get_dash_search_data(mixed $link, mixed $promimg) : mixed
api_reorder_tabs(mixed $refs) : mixed
api_delete_tabs(mixed $refs) : mixed
api_save_tab(mixed $tab) : mixed
api_mark_email_as_invalid(mixed $email) : mixed
api_get_user_message(mixed $ref) : mixed
api_get_users_by_permission(mixed $permissions) : mixed
Upload files using HTTP multipart.
api_upload_multipart(int $ref, bool $no_exif, bool $revert[, bool $previewonly = false ][, int $alternative = 0 ][, bool $autorotate = false ]) : array<string|int, mixed>
Resource ID
Do not extract embedded metadata
Delete all data and re-extract embedded data
Will use the uploaded file to replace preview image only
Use the uploaded file to replace the alternative file with the given ID Note that api_add_alternative_file() must be called first if creating a new alternative file If an $alternative identifier is specified then $previewonly is ignored and set to false
Automatically rotate (correct) images
Returns JSend data back ajax_functions.php if upload failed, otherwise 204 HTTP status
Get metadata field information for all (matching) fields.
api_get_resource_type_fields([string $by_resource_types = '' ][, string $find = '' ][, string $by_types = '' ]) : array<string|int, mixed>
Filter result by resource type. If multiple, use a CSV of resource types.
Filter result by fuzzy searching in different properties (e.g name, title, ref, help text etc)
Filter result by field type (FIELD_TYPE_* constants). If multiple, use a CSV of field types.
Returns the matching fields' information or 403 HTTP status if not authorised
Create metadata field
api_create_resource_type_field(string $name, string $resource_types, int $type) : array<string|int, mixed>
Field name
CSV of applicable resource types for this field. Use 0 (zero) for global, for others \API
Metadata field type. For values, FIELD_TYPE_* constants
Returns JSend data back ajax_functions.php and 200 HTTP status or 403 HTTP status if not authorised
Expose {@see get_featured_collections} to the API
api_get_featured_collections(int $parent) : array<string|int, mixed>
The feature collection parent's ref. Use 0 for obtaining the root ones.
api_get_edit_access(int $resource) : bool
Toggle active state for nodes
api_toggle_active_state_for_nodes(array<string|int, mixed> $refs) : array<string|int, mixed>
List of node IDs
Returns the affected nodes' active state (including empty list) and 403 HTTP status if not authorised.
Expose {@see get_processing_message} to the API
api_get_processing_message() : false|array<string|int, mixed>
Expose {@see checkperm} to the API
api_checkperm(string $perm) : bool
The permissions string to check for.
Expose {@see get_resource_access} to the API
api_get_resource_access(int $resource) : false|int
The reference ID of the resource.
The access level for the resource, or false if a number was not supplied.
Exposing {@see resource_file_readonly} to the API
api_resource_file_readonly(int|numeric-string $ref) : array<string|int, mixed>
Resource ID
Exposing {@see delete_resources_in_collection} to the API
api_delete_resources_in_collection(int $collection) : bool
ID of collection containing resources to be deleted.
Exposing {@see new_user} to the API
api_new_user(string $username[, int $usergroup = 0 ]) : array<string|int, mixed>
Returns JSend data back ajax_functions.php with the ref value (id of new user or false if user already exists / permission denied, or -2 if user limit reached) and 200 HTTP status or 409 HTTP status if an issue is detected.
Exposing {@see save_user} to the API
api_save_user(string $ref, string $data) : array<string|int, mixed>
ID of the user
Data to save in JSON format (optional, will use posted data otherwise)
Returns JSend data back ajax_functions.php and 200 HTTP status or 409 HTTP status with reason in the response
Make resource comments available to the API.
api_get_resource_comments(int $resource_ref[, bool $flat_view = false ]) : array<string|int, mixed>
ID of resource to get comments for.
Provide comments as nested tree view (this is the default mode) or a flat list most recent first. See config: $comments_flat_view
Array of resource comment data. Array will be empty if comments are not enabled on the system or user has insufficient permissions to view comments.
Allow comment to be deleted via the API.
api_delete_comment(int $comment_ref) : bool
Not for comments linked to annotations.
ID of the comment to be deleted.
False if comments are not enabled on the system, user has insufficient permissions or the comment being deleted is linked to an annotation - this will delete only standard comments.
Return a list of reports using the API.
api_get_reports() : array<string|int, mixed>
Reports (name and ID) ordered by name asc. The array will be empty if user has insufficient permissions.
Run report via the API.
api_do_report(int $report_ref[, string $from_date = '' ][, string $to_date = '' ]) : array<string|int, mixed>|bool
Where report includes a "thumbnail" column which would normally display an image on the report, the thumbnail key will contain a base64 encoded thumbnail image in jpg format. A "thumbnail_view_link" key will also be added containing a link to the resource.
ID of the report to run.
Start date for the report period in format YYYY-MM-DD.
End date for the report period in format YYYY-MM-DD.
Array of report data on success or false if user has insufficient permissions or there was an input error.
Return a private scramble key for this user.
get_api_key(int $user) : string|false
The user ID
Check a query is signed correctly.
check_api_key(string $username, string $querystring, string $sign[, string $authmode = "userkey" ]) : bool
The username of the calling user
The query being passed to the API
The signature to check
The type of key being provided (user key or session key)
Execute the specified API function.
execute_api_call(string $query[, bool $pretty = false ]) : bool|string
The query string passed to the API
Should the JSON encoded result be 'pretty' i.e. formatted for reading?
Return the session specific key for the given user.
get_session_api_key(int $user) : string
The user ID
API login function
api_login(string $username, string $password) : string|false
Username
Password to validate
FALSE if invalid, session API key if valid
Validate URL supplied in APIs create resource or upload by URL. Requires the URL hostname to be added in config $api_upload_urls
api_validate_upload_url(string $url) : bool
The full URL.
Returns true if a valid URL is found.
Assert API request is using POST method.
assert_post_request(bool $force) : array<string|int, mixed>
Force the assertion
Returns JSend data back ajax_functions.php if not POST method
Assert API sent the expected content type.
assert_content_type(string $expected, string $received_raw) : array<string|int, mixed>
MIME type
MIME type
Returns JSend data back ajax_functions.php if received Content-Type is unexpected
Return a summary of daily statistics
api_get_daily_stat_summary([int $days = 30 ]) : mixed
The number of days - note max 365 days as only the current and previous year's data is accessed.
Return all collections belonging to or shared with $user
get_user_collections(int $user[, string $find = "" ][, string $order_by = "name" ][, string $sort = "ASC" ][, int $fetchrows = -1 ][, bool $auto_create = true ]) : array<string|int, mixed>
A search string
Column to sort by
ASC or DESC sort order
How many rows to fetch
Create a standard "Default Collection" if one doesn't exist
Returns all data for collection $ref.
get_collection(int $ref[, bool $usecache = false ]) : array<string|int, mixed>|bool
Collection ID
Optionally retrieve from cache
Returns all resources in collection
get_collection_resources(int $collection) : array<string|int, mixed>|bool
ID of collection being requested
Get all resources in a collection without checking permissions or filtering by workflow states.
get_collection_resources_with_data(int $ref) : array<string|int, mixed>
This is useful when you want to get all the resources for further subprocessing (@see render_selected_collection_actions() as an example)
Collection ID
Add resource $resource to collection $collection
add_resource_to_collection(int $resource, int $collection[, bool $smartadd = false ][, string $size = "" ][, string $addtype = "" ][, bool $col_access_control = null ][, array<string|int, mixed> $external_shares = null ][, string $search = '' ][, int $sort_order = null ]) : bool|string
Collection access control. Is user allowed to add to it? You can leave it null to allow this function to determine it but it may have performance issues.
List of external share keys. get_external_shares(). You can leave it null to allow this function to determine it but it will affect performance.
Optionsl search string. Used to update resource_node hit count
Sort order of resource in collection
Remove resource $resource from collection $collection
remove_resource_from_collection(int $resource, int $collection[, bool $smartadd = false ]) : bool|string
Add resource(s) $resources to collection $collection
collection_add_resources(mixed $collection[, mixed $resources = '' ][, mixed $search = '' ][, mixed $selected = false ]) : bool|string
collection_remove_resources
collection_remove_resources(mixed $collection[, mixed $resources = '' ][, mixed $removeall = false ][, mixed $selected = false ]) : bool|string
Is the collection $collection writable by the current user? Returns true if the current user has write access to the given collection.
collection_writeable(int $collection) : bool
Returns true if the current user has read access to the given collection.
collection_readable(int $collection) : bool
Sets the current collection of $user to be $collection
set_user_collection(int $user, int $collection) : void
Creates a new collection for user $userid called $name
create_collection(int $userid, string $name[, bool $allowchanges = 0 ][, bool $cant_delete = 0 ][, int $ref = 0 ][, bool $public = false ][, mixed $extraparams = array() ]) : int
Deletes the collection with reference $ref
delete_collection(int $collection) : bool|void
Adds script to page that refreshes the Collection bar
refresh_collection_frame([int $collection = "" ]) : void
Collection id
Performs a search for featured collections / public collections.
search_public_collections([string $search = "" ][, string $order_by = "name" ][, string $sort = "ASC" ][, bool $exclude_themes = true ][, bool $exclude_public = false ][, bool $include_resources = false ][, bool $override_group_restrict = false ][, int $fetchrows = -1 ]) : array<string|int, mixed>
Search within available collections
do_collections_search(string $search, string $restypes[, int $archive = 0 ][, string $order_by = '' ][, string $sort = "DESC" ][, int $fetchrows = -1 ]) : array<string|int, mixed>
Add a collection to a user's 'My Collections'
add_collection(int $user, int $collection) : bool
ID of user
ID of collection
Remove someone else's collection from a user's My Collections
remove_collection(int $user, int $collection) : mixed
Update the keywords index for this collection
index_collection(int $ref[, string $index_string = '' ]) : int
How many keywords were indexed?
Process the save action when saving a collection
save_collection(int $ref[, array<string|int, mixed> $coldata = array() ]) : false|void
Case insensitive string comparisons using a "natural order" algorithm for collection names
collections_comparator(string $a, string $b) : mixed
Case insensitive string comparisons using a "natural order" algorithm for collection names
collections_comparator_desc(string $a, string $b) : mixed
Returns a list of smart theme headers, which are basically fields with a 'smart theme name' set.
get_smart_theme_headers() : array<string|int, mixed>
get_smart_themes_nodes
get_smart_themes_nodes(int $field, bool $is_category_tree[, int $parent = null ][, array<string|int, mixed> $field_meta = array() ]) : array<string|int, mixed>
E-mail a collection to users
email_collection(mixed $colrefs, string $collectionname, string $fromusername, string $userlist, string $message, string $feedback[, int $access = -1 ][, string $expires = "" ][, string $useremail = "" ][, string $from_name = "" ][, string $cc = "" ][, bool $themeshare = false ][, string $themename = "" ][, string $themeurlsuffix = "" ][, bool $list_recipients = false ][, bool $add_internal_access = false ][, string $group = "" ][, string $sharepwd = "" ]) : string
Generate an external access key to allow external people to view the resources in this collection.
generate_collection_access_key(int $collection[, int $feedback = 0 ][, string $email = "" ][, int $access = -1 ][, string $expires = "" ][, string $group = "" ][, string $sharepwd = "" ][, array<string|int, mixed> $sub_fcs = array() ]) : string
Collection ref -or- collection data structure
List of sub-featured collections IDs (collection_email.php page has logic to determine this which is carried forward to email_collection())
The generated key used for external sharing
Returns all saved searches in a collection
get_saved_searches(int $collection) : array<string|int, mixed>
Add a saved search to a collection
add_saved_search(int $collection) : void
Remove a saved search from a collection
remove_saved_search(int $collection, int $search) : void
Greate a new smart collection using submitted values
add_smart_collection() : void
Get a display friendly name for the given search string Takes a full searchstring of the form 'search=restypes=archive=' and uses search_title_processing to autocreate a more informative title
get_search_title(string $searchstring) : string
Search string
Friendly name for search
Adds all the resources in the provided search to $collection
add_saved_search_items(int $collection[, string $search = "" ][, string $restypes = "" ][, string $archivesearch = "" ][, string $order_by = "relevance" ][, string $sort = "desc" ][, string $daylimit = "" ][, int $res_access = "" ][, bool $editable_only = false ]) : bool
The ID of the resource access level
If true then only editable resources will be added
Returns true or false, can all resources in this collection be edited by the user?
allow_multi_edit(array<string|int, mixed>|int $collection[, array<string|int, mixed> $collectionid = 0 ]) : bool
Collection IDs
Get featured collection resources (including from child nodes). For normal FCs this is using the collection_resource table.
get_featured_collection_resources(array<string|int, mixed> $c, array<string|int, mixed> $ctx) : array<string|int, mixed>
For FC categories, this will check within normal FCs contained by that category. Normally used in combination with generate_featured_collection_image_urls() but useful to determine if a FC category is full of empty FCs.
Collection data structure similar to the one returned by get_featured_collections()
Extra context used to get FC resources (e.g smart FC?, limit on number of resources returned). Context information should take precedence over internal logic (e.g determining the result limit)
Get a list of featured collections based on a higher level featured collection category. This returns all direct/indirect collections under that category.
get_featured_collection_categ_sub_fcs(array<string|int, mixed> $c[, array<string|int, mixed> $ctx = array() ]) : array<string|int, mixed>
Collection data structure
Contextual data (e.g disable access control). This param MUST NOT get exposed over the API
Get preview URLs for a list of resource IDs
generate_featured_collection_image_urls(array<string|int, mixed> $resource_refs) : array<string|int, mixed>
List of resources
List of resource refs and corresponding images URLs
Inserts $resource1 into the position currently occupied by $resource2
swap_collection_order(int $resource1, int $resource2, int $collection) : void
Reorder the items in a collection using $neworder as the order by metric
update_collection_order(array<string|int, mixed> $neworder, int $collection[, int $offset = 0 ]) : void
Array of columns to order by
Return comments and other columns stored in the collection_resource join.
get_collection_resource_comment(int $resource, int $collection) : array<string|int, mixed>|bool
Returns found record data, false otherwise
Save a comment and/or rating for the instance of a resource in a collection.
save_collection_resource_comment(int $resource, int $collection, string $comment, int $rating) : bool
Relates every resource in $collection to $ref
relate_to_collection(int $ref, int $collection) : void
Fetch all the comments for a given collection.
get_collection_comments(int $collection) : array<string|int, mixed>
Sends the feedback to the owner of the collection
send_collection_feedback(int $collection, string $comment) : array<string|int, mixed>|void
Collection ID
Comment text
Copy a collection contents
copy_collection(int $copied, int $current[, bool $remove_existing = false ]) : void
The collection to copy from
The collection to copy to
Should existing items be removed?
Returns true if a collection is a research request
collection_is_research_request(int $collection) : bool
Collection ID
Generates a HTML link for adding a resource to a collection
add_to_collection_link(int $resource[, string $extracode = "" ][, string $size = "" ][, string $class = "" ][, string $view_title = "" ]) : string
ID of resource
Additional code to be run when link is selected IMPORTANT: never use untrusted data here!
Resource size if appropriate
Class to be applied to link
The title of the field, taken from $view_title_field
Render a "remove from collection" link wherever such a function is shown in the UI
remove_from_collection_link(int $resource[, string $class = "" ][, string $onclick = '' ][, bool $notused = false ][, string $view_title = "" ]) : string
Additional onclick code to call before returning false.
No longer used
The title of the field, taken from $view_title_field
Generates a HTML link for adding a changing the current collection
change_collection_link(int $collection) : string
Return all external access given to a collection.
get_collection_external_access(int $collection) : array<string|int, mixed>
Users, emails and dates could be multiple for a given access key, an in this case they are returned comma-separated.
Delete a specific collection access key, withdrawing access via that key to the collection in question
delete_collection_access_key(int $collection, string $access_key) : void
Add a new row to the collection log (e.g. after an action on that collection)
collection_log(int $collection, string $type, int $resource[, string $notes = "" ]) : void
Action type
Return the log for $collection
get_collection_log(int $collection[, int $fetchrows = -1 ]) : array<string|int, mixed>
How many rows to fetch
Returns the maximum access (the most permissive) that the current user has to the resources in $collection.
collection_max_access(int $collection) : int
Returns the minimum access (the least permissive) that the current user has to the resources in $collection.
collection_min_access(int|array<string|int, mixed> $collection) : int
Can be passed a collection ID or the results of a collection search, the result will be the most restrictive access that is found.
Collection ID as an integer or the result of a search as an array
0 - Open, 1 - restricted, 2 - Confidential
Set an existing collection to be public
collection_set_public(int $collection) : bool
ID of collection
Remove all resources from a collection
remove_all_resources_from_collection(int $ref) : void
The collection in question
Retrieve promoted collections to be displayed on the home page.
get_home_page_promoted_collections() : array<string|int, mixed>
This function fetches public collections that are marked for publishing to the home page. It returns an array of collection data, including metadata and thumbnail information for the home page image if one is assigned.
An array of associative arrays representing each promoted collection, with keys:
Return an array of distinct archive/workflow states for resources in $collection
is_collection_approved(int $collection) : array<string|int, mixed>
Update an existing external access share
edit_collection_external_access(string $key[, int $access = -1 ][, string $expires = "" ][, int $group = "" ][, string $sharepwd = "" ][, array<string|int, mixed> $shareopts = array() ]) : bool
External access key
Share access level
Share expiration date
ID of usergroup that share will emulate permissions for
Share password
Array of additional share options "collection" - int collection ID "upload" - bool Set to true if share is an upload link (no visibility of existing resources)
Hide or show a collection from the My Collections area.
show_hide_collection(int $colref[, bool $show = true ][, int $user = "" ]) : bool
Show or hide?
Get an array of collection IDs for the specified ResourceSpace session and user
get_session_collections(string $rs_session[, int $userref = "" ][, bool $create = false ]) : array<string|int, mixed>
Session id - as obtained by get_rs_session_id()
User ID
Create new collection?
Array of collection IDs for the specified sesssion
Update collection to belong to a new user
update_collection_user(int $collection, int $newuser) : bool
Collection ID
User ID to assign collection to
success|failure
Helper function for render_actions(). Compiles actions that are normally valid for collections
compile_collection_actions(array<string|int, mixed> $collection_data, bool $top_actions[, array<string|int, mixed> $resource_data = array() ]) : array<string|int, mixed>
Collection data
Set to true if actions are to be rendered in the search filter bar (above results)
Resource data
Make a filename unique by appending a dupe-string.
makeFilenameUnique(array<string|int, mixed> $base_values, string $filename, string $dupe_string, string $extension[, int $dupe_increment = null ]) : string
Unique filename
Render the new featured collection form
new_featured_collection_form(int $parent) : void
Featured collection parent. Use zero for root featured collection category
Get a themes array
GetThemesFromRequest(int $levels) : array<string|int, mixed>
Number of levels to parse from request
Array containing names of themes matching the syntax used in the collection table i.e. theme, theme2, theme3
collection_download_use_original_filenames_when_downloading(array<string|int, mixed> &$dl_data, string &$filename, int $ref, string $pextension, string &$p, bool $copy) : void
Array of collection download data from process_collection_download() (passed by reference so can be added to)
Filename (passed by reference)
Resource ID
File extension
Path to download file = passed by reference as may be replaced with a copy file
Copy the file from filestore rather than renaming?
Provide resource data/collection_resource data to add to text file during a collection download.
collection_download_process_text_file(array<string|int, mixed> $dl_data, int $ref, string $filename, bool $subbed_original) : string
Array of collection download data passed from process_collection_download()
Resource ID
Has original file been substituted for unavailable size?
Text to append to file
Update the resource log to show the download during a collection download.
collection_download_log_resource_ready(array<string|int, mixed> $dl_data, string $tmpfile, int $ref[, string $email = "" ]) : void
Array of collection download data passed from process_collection_download()
Temp download file path
The resource ID
Email address of downloader
Add PDFs for "data only" types to a zip file during creation.
collection_download_process_data_only_types(array<string|int, mixed> $dl_data, object &$zip) : void
Array of collection download data
Collection zip file
collection_download_process_summary_notes(array<string|int, mixed> &$dl_data, string $filename, mixed &$zip) : mixed
Array of collection download data from process_collection_download() (passed by reference so can be added to)
Resource filename
Collection zip file, false if using TAR
Add a CSV containing resource metadata to a downloaded zip file during creation of the zip.
collection_download_process_csv_metadata_file(array<string|int, mixed> &$dl_data, object &$zip) : void
Array of collection download data from process_collection_download() (passed by reference so can be added to)
Collection zip file
Modifies the filename for downloading as part of the specified collection
collection_download_process_collection_download_name(string &$filename, int $collection, string $size, string $suffix, array<string|int, mixed> $collectiondata) : void
Filename (passed by reference)
Collection ID
Size code e.g scr,pre
String suffix to add (before file extension)
Collection data obtained by get_collection()
Executes the archiver command when downloading a collection.
collection_download_process_archive_command(array<string|int, mixed> &$dl_data, object &$zip, string $filename, mixed &$zipfile) : bool
Array of collection download data from process_collection_download() (passed by reference so can be added to)
Collection zip file
Download filename
Will return true if there is no further work to be done as will be the case for a tar file. False when further processing needed e.g. when producing a zip file.
Remove temporary files created during download by exiftool for adding metadata.
collection_download_clean_temp_files(array<string|int, mixed> $deletion_array) : void
An array of file paths
Delete any resources from collection moved out of users archive status permissions by other users
collection_cleanup_inaccessible_resources(int $collection) : void
ID of collection
Relate all resources in a collection
relate_all_collection(int $collection[, mixed $checkperms = true ]) : bool
ID of collection
Un-relate all resources in a collection
unrelate_all_collection(int $collection[, mixed $checkperms = true ]) : bool
ID of collection
Update collection type for one collection or batch
update_collection_type(int|array<string|int, mixed> $cid, int $type[, mixed $log = true ]) : bool
Collection ID -or- list of collection IDs
Collection type. @see include/definitions.php for available options
Update collection parent for this collection
update_collection_parent(int $cid, int $parent) : bool
Get a users' collection of type SELECTION.
get_user_selection_collection(int $user) : null|int
There can only be one collection of this type per user. If more, the first one found will be used instead.
User ID
Returns NULL if none found or the collection ID
Delete all collections that are not in use e.g. session collections for the anonymous user. Will not affect collections that are public.
delete_old_collections([int $userref = 0 ][, int $days = 30 ]) : int
Get all featured collections
get_all_featured_collections() : array<string|int, mixed>
Get all featured collections by parent node
get_featured_collections(int $parent, array<string|int, mixed> $ctx) : array<string|int, mixed>
The ref of the parent collection. When a featured collection contains another collection, it is then considered a featured collection category and won't have any resources associated with it.
Contextual data (e.g disable access control). This param MUST NOT get exposed over the API
List of featured collections (with data)
Build appropriate SQL (for WHERE clause) to filter out featured collections for the user. The function will use either an IN or NOT IN depending which list is smaller to increase performance of the search
featured_collections_permissions_filter_sql(string $prefix, string $column[, bool $returnstring = false ]) : array<string|int, mixed>|string
SQL WHERE clause element. Mostly should be either WHERE, AND -or- OR depending on the SQL statement this is part of.
SQL column on which to apply the filter for
(temporary) Will return the legacy string version until do_search() and others are migrated to use prepared statements. This can be removed once all functions use prepared statements
Returns "" if user should see all featured collections or a SQL filter (e.g AND ref IN("32", "34") ) with the placholders as the first element and the collection IDs as params for the second - for use in e.g. ps_query(), ps_value()
Access control function used to determine if a featured collection should be accessed by the user
featured_collection_check_access_control(int $c_ref) : bool
Collection ref to be tested
Returns TRUE if user should have access to the featured collection (no parent category prevents this), FALSE otherwise
Helper comparison function for ordering featured collections. It sorts using the order_by property, then based if the collection is a category (using the "has_resource" property), then by name (this takes into account the legacy use of '*' as a prefix to move to the start).
order_featured_collections(array<string|int, mixed> $a, array<string|int, mixed> $b) : Return
First featured collection data structure to compare
Second featured collection data structure to compare
an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
Get featured collection categories
get_featured_collection_categories(int $parent, array<string|int, mixed> $ctx) : array<string|int, mixed>
The ref of the parent collection.
Extra context for get_featured_collections(). Mostly used for overriding access control (e.g on the admin_group_permissions.php where we want to see all available featured collection categories).
Check if a collection is a featured collection category
is_featured_collection_category(array<string|int, mixed> $fc) : bool
A featured collection data structure as returned by get_featured_collections()
Check if a collection is a featured collection category by checking if the collection has been used as a parent. This function will make a DB query to find this out, it does not use existing structures.
is_featured_collection_category_by_children(int $c_ref) : bool
Normally a featured collection is a category if it has no resources. In some circumstances, when it's impossible to determine whether it should be or not, relying on children is another approach.
Collection ID
Validate a collection parent value
validate_collection_parent(int|array<string|int, mixed> $c) : null|int
Collection ref -or- collection data as returned by get_collection()
Get to the root of the branch starting from the leaf featured collection
get_featured_collection_category_branch_by_leaf(int $ref, array<string|int, mixed> $fcs) : array<string|int, mixed>
Collection ref which is considered a leaf of the tree
List of all featured collections
Branch path structure starting from root to the leaf
Process POSTed featured collections categories data for a collection
process_posted_featured_collection_categories(int $depth, array<string|int, mixed> $branch_path) : array<string|int, mixed>
The depth from which to start from. Usually zero.
A full branch path of the collection. get_featured_collection_category_branch_by_leaf()
Returns changes done regarding the collection featured collection category structure. This information then can be provided to save_collection() as: $coldata["featured_collections_changes"]
Find existing featured collection ref using its name and parent
get_featured_collection_ref_by_name(string $name, null|int $parent) : null|int
Featured collection name to search by
The featured collection parent
Move a featured collection branch paths' root to the node determined by the global configuration option $featured_collections_root_collection.
move_featured_collection_branch_path_root(array<string|int, mixed> $branch_path) : array<string|int, mixed>
This temporarily moves the root of the featured collection branch, removing any nodes on the branch from the real root up to the new root.
List of branch path nodes as returned by compute_node_branch_path()
Check if user is allowed to share collection
allow_collection_share(array<string|int, mixed> $c) : bool
Collection data
Return TRUE if user is allowed to share the collection, FALSE otherwise
Check if user is allowed to share featured collection. If the featured collection provided is a category, then this function will return FALSE if at least one sub featured collection has no share access (this is kept consistent with the check for normal collections when checking resources).
allow_featured_collection_share(array<string|int, mixed> $c) : bool
Collection data. You can add "has_resources" and "sub_fcs" keys if you already have this information
Return TRUE if user is allowed to share the featured collection, FALSE otherwise
Filter out featured collections that have a different root path. The function builds internally the path to the root from the provided featured collection ref and then filters out any featured collections that have a different root path.
filter_featured_collections_by_root(array<string|int, mixed> $fcs, int $c_ref[, array<string|int, mixed> $ctx = array() ]) : array<string|int, mixed>
List of featured collections refs to filter out
A root featured collection ref
Contextual data
Get all featured collections branches where the specified resources can be found.
get_featured_collections_by_resources(array<string|int, mixed> $r_refs) : array<string|int, mixed>
List of resource IDs
Returns list of featured collections (categories included) that contain the specified resource(s).
Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).
can_delete_featured_collection(int $ref) : bool
Collection ID
Returns TRUE if the featured collection can be deleted, FALSE otherwise
Remove all instances of the specified character from start of string
strip_prefix_chars(string $string, string $char) : string
String to update
Character to remove
Check access control if user is allowed to upload to a collection.
allow_upload_to_collection(array<string|int, mixed> $c) : bool
Collection data structure
Compute the featured collections allowed based on current access control
compute_featured_collections_access_control() : bool|array<string|int, mixed>
Returns FALSE if user should not see any featured collections (usually means misconfiguration) -or- TRUE if user has access to all featured collections. If some access control is in place, then the return will be an array with all the allowed featured collections
Check if user is allowed to re-order featured collections
can_reorder_featured_collections() : bool
Check if user is authorised to edit a featured collection category
can_edit_featured_collection_category() : bool
Remove all old anonymous collections
cleanup_anonymous_collections([int $limit = 100 ]) : void
Maximum number of collections to delete - if run from browser this is kept low to avoid delays
Check if user is permitted to create an external upload link for the given collection
can_share_upload_link(array<string|int, mixed> $collection_data) : bool
Array of collection data
Check if user can edit an existing upload share
can_edit_upload_share(int $collection, string $uploadkey) : bool
Collection ID of share
External upload key
Creates an upload link for a collection that can be shared
create_upload_link(int $collection, array<string|int, mixed> $shareoptions) : string
Collection ID
Share access key
Generates an external share key based on provided string
generate_share_key(string $string) : string
Generated key
Check if an external upload link is being used
upload_share_active() : mixed
false|int ID of upload collection, or false if not active
Set up external upload share
upload_share_setup(string $key[, array<string|int, mixed> $shareopts = array() ]) : void
access key
Array of share options "collection" - (int) collection ID "user" - (int) user ID of share creator "usergroup" - (int) usergroup ID used for share
Notify the creator of an external upload share that resources have been uploaded
external_upload_notify(int $collection, string $k, int $tempcollection) : void
Ref of external shared collection
External upload access key
Ref of temporay upload collection
Purge all expired shares/**
purge_expired_shares(array<string|int, mixed> $filteropts) : string|int
Array of options to filter shares purged "share_group" - (int) Usergroup ref 'shared as' "share_user" - (int) user ID of share creator "share_type" - (int) 0=view, 1=upload "share_collection" - (int) Collection ID
Check if user has the appropriate access to delete a collection.
can_delete_collection(array<string|int, mixed> $collection_data, int $userref[, int $k = "" ]) : bool
Array of collection details, typically from get_collection()
Id of user
External access key value
Returns true is the collection can be deleted or false if it cannot.
Send collection to administrators - used if $send_collection_to_admin is enabled
send_collection_to_admin(int $collection) : bool
Collection ID
Get the user's default collection, creating one if necessary
get_default_user_collection([bool $setactive = false ]) : int
Set the collection as the user's active collection?
collection ID
Update a smart collection with or without the $smart_collections_async option.
update_smart_collection(int $smartsearch_ref) : void
Id of 'savedsearch'.
Check if the terms have been accepted for the given upload Terms only need to be accepted when uploading through an upload share link If uploading through an upload share link then the accepted terms have been stored in $_COOKIE["acceptedterms"]
check_upload_terms(int $collection, string $k) : bool
Collection ref
Share key
True if external upload share and terms have also been accepted OR if not an external upload False if external upload share and terms have NOT been accepted
Determines whether the current user has permission to create collections.
can_create_collections() : bool
This function checks for specific conditions that would prevent the user from creating collections.
It returns false if any of these conditions are met:
Returns true if the user can create collections; otherwise, false.
Determines whether the current user has permission to view the collection log.
can_view_collection_log(array<string|int, mixed> $collection_data) : bool
Array of collection data, typically from get_collection()
Returns true if the collection log can be viewed by the current user.
Re-order all featured collections at a particular tree depth.
reorder_all_featured_collections_with_parent(int|null $parent) : array<string|int, mixed>
Featured collection IDs list, in the new order
Generate a collection download ZIP file and the download filename
process_collection_download(array<string|int, mixed> $dl_data) : array<string|int, mixed>
Array of collection download options passed from collection_download.php or from the offline job This array will be updated and passed to subsidiary functions to keep track of processed file, generate text etc. Could be moved to an object later [ "filename" => [the name of download file], "collection" => [Collection ID], "collection_resources" => [Resources to include in download], "collectiondata" => [Collection data - from get_collection()], "exiftool_write_option" => [Write exif data?], "useoriginal" => [Use original if requested size not available?], "size" => [Requested Download size ID], "settings_id" => [Index of selected option from $collection_download_settings], "deletion_array" => [Array of paths to delete], "include_csv_file" => [Include metadata CSV file?], "include_alternatives" => [Include alternative files?], "includetext" => Include text file?, "collection_download_tar" => [Generate a TAR file?], "count_data_only_types" => [Count of data only resources], "id" => [Optional unique identifier - [used to create a download.php link that is specific to the user], "k" => External access key from download request if set ];
Array of data about the created file and the download file nam, or the TAR status i.e. [ "filename" => [the name of download file], "path" => [path to the zip file], "completed" => [Set to true if a tar has been sent], ];
Write comments to the database, also deals with hiding and flagging comments
comments_submit() : void
Check all comments that are children of the comment ref provided. If there is a branch made up entirely of hidden comments then remove the branch.
clean_comment_tree(mixed $ref) : int
@param int $ref Ref of the comment that is being deleted.
Number of child comments that are not hidden.
Find the root of a comment tree that the ref provided is a part of
find_root_comment(int $ref) : int|null
ref of a comment
ref of the root comment or null if the comment tree has been completely removed / the comment being checked has already been deleted.
Parse a comment and replace and add links to any user, resource and collection tags
comments_tags_to_links(string $text) : string
The input text e.g. the body of the comment
Display all comments for a resource or collection
comments_show(int $ref[, bool $bcollection_mode = false ]) : void
The reference of the resource or collection
false == show comments for resources, true == show comments for collection
Notify anyone tagged when a new comment is posted
comments_notify_tagged(string $comment, int $from_user[, int $resource = null ][, int $collection = null ]) : void
The comment body
Who posted the comment
If commenting on a resource, the resource ID
If commenting on a collection, the collection ID
Return comments for a resource or collection. There are two options for the output: 1. A flat list of comments ordered by creation date, newest first. Config $comments_flat_view = true 2. A tree view of comments, top level ordered most recent first with lower levels also most recent first while respecting a hierarchy of nested comments. Config $comments_flat_view = false (default) User permissions are also checked to ensure users can view comments. $comments_responses_max_level limits the number of levels returned in the comments tree (only applies when $comments_flat_view = false).
get_comments_by_ref(int $ref[, bool $collection_mode = false ]) : array<string|int, mixed>
Resource or collection ID.
True if the $ref provided is a collection ID. False if $ref providing resource ID (default)
Array of comments sorted per $comments_flat_view. Empty array if user doesn't have permission to to view comments.
Hide or delete a comment or annotation. Comments will be hidden where they have comments below them.
hide_delete_comment(int $comment_to_hide[, bool $allow_annotations = true ]) : bool
If the comment has no comments below it will be deleted. Trees with all hidden comments will also be deleted. Option to disable deletion / hiding of comments created as annotations e.g. to prevent API use.
Reference of the comment to be deleted / hidden.
Should comments created by annotations be deleted / hidden.
True if successful else false.
Renders a select element.
render_select_option(string $fieldname, array<string|int, mixed> $opt_array, mixed $selected[, string $groupby = '' ]) : string
Takes an array of options (as returned from sql_query and returns a valid
select element. The query must have a column aliased as value and label.
Option groups can be created as well with the optional $groupby parameter.
This function retrieves a language field in the form of
$lang['cfg-
$options = sql_select("SELECT name AS label, ref AS value FROM resource_type");
render_select_option('myfield', $options, 18);
Name to use for the field.
Array of options to fill the select with
If matches value the option is marked as selected
Column to group by
HTML output.
Render a yes/no field with the given fieldname.
render_bool_option(string $fieldname, bool $value) : string
This function will use $lang['cfg-
Name of field.
Current field value
HTML Output
Renders a text field for a given field name.
render_text_option(string $fieldname, string $value[, int $size = 20 ][, string $units = '' ]) : string
Uses $lang['cfg-
Name of field
Current field value
Size of text field, optional, defaults to 20
Optional units parameter. Displays to right of text field.
HTML Output
Save/ Update config option for user preference or system config. For user group config see set_usergroup_config_option().
set_config_option(int $user_id, string $param_name, string $param_value[, string $activity_log_note = null ]) : bool
Current user ID. Use NULL for system wide config options
Parameter name
Parameter value
Optional. Allows a note to be recorded in the activity log entry. Helpful to record the origin of the configuration change.
Save or update config option for user group.
set_usergroup_config_option(int $usergroup_id, string $param_name, string $param_value) : bool
User group id
Config parameter name
Config parameter value
Delete entry from the user_preferences table completely (instead of setting to blank via set_config_option).
delete_config_option(array<string|int, mixed> $config_type, string $param_name[, string|null $activity_log_note = null ]) : bool
Used by system preferences page when deleting a file to allow fallback to value (if set) in config.php instead of replacing it with blank from user_preference value.
The type of config to delete supplied as an array. The following are possible: array() - Supply an empty array to delete a system config value. array('user' => 1) - Supply 'user' with the integer user reference to delete a user config value. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to delete a user group config value.
Parameter name
True if preference was deleted else false.
Remove system/user preferences
remove_config_option(int|null $user_id, string $name) : bool
Database user ID
Configuration option (variable) name
Get config option value from the database. This may be a system wide config, a user group preference, a user preference, or the result of overriding a user group preference with a user preference if any are present.
get_config_option(array<string|int, mixed> $config_type, string $name, string &$returned_value[, mixed $default = null ]) : bool
The type of config to retrieve supplied as an array. The following combinations are possible: array() - Supply an empty array to return a system config value. array('usergroup' => 2) - Supply 'usergroup' with the integer user group reference to return a user group config value. array('user' => 1) - Supply 'user' with the integer user reference to return a user config value. array('user' => 1, 'usergroup' => 2) - Supply 'user' with the integer user reference and 'usergroup' with the integer user group reference to return the result of user group config overridden with user preference. Usergroup should always be that of the supplied user. Don't supply parent group as this will be checked.
Parameter name
The config value will be returned through this parameter which is passed by reference. IMPORTANT: it falls back (defaults) to the globally scoped config option value if there's nothing in the database.
Optionally used to set a default that may not be the current global setting e.g. for checking admin resource preferences
Indicates if the config option was found in the database or not.
Get all user refs with a specific configuration option set from database
get_config_option_users(string $option, string $value) : array<string|int, mixed>
Parameter name
Parameter value
Array of user references
Get config option from database for a specific user, system wide or user group.
get_config_options(array<string|int, mixed> $config_type, array<string|int, mixed> &$returned_options) : bool
The type of config to retrieve supplied as an array. The following combinations are possible: array() - Supply an empty array to return a system config value. array('user' => 1) - Supply 'user' with the integer user reference to return user config values. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to return user group config values. Note: Supplying both 'user' and 'usergroup' is invalid.
If a value does exist it will be returned through this parameter which is passed by reference
Check if the usergroup has a parent and the specified inherit flag is in use e.g. user group inherits permissions from parent.
get_usergroup_parent_for_inherit_flag(int $usergroup_id, string $inherit_flag) : int
User group of the current user / user group to test.
Inherit flag to test for.
User group id of parent if found and using supplied inherit flag else returns user group id supplied.
Process configuration options from database either system wide, user group or user specific, setting the global variable.
process_config_options(array<string|int, mixed> $config_type) : void
Three modes are possible: array() - Supply an empty array to load system config values. array('user' => 1) - Supply 'user' with the integer user reference to load user config values. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to load user group config values. Note: Supplying both 'user' and 'usergroup' is invalid. In some scenarios, calling this function twice will be required e.g. load user group config then override with user config. Note: calling this function will not revert user preferences applied previously e.g. during initialisation as a different user. If the current user's preferences shouldn't be shown, consider using $system_wide_config_options to reapply selected system values.
Specify the type of config to be loaded. See details above.
Utility function to "clean" the passed $config. Cleaning consists of two parts: * Suppressing really simple XSS attacks by refusing to allow strings containing the characters "<script" in upper, lower or mixed case.
config_clean(mixed $config) : a
mixed thing to be cleaned.
cleaned version of $config.
Generate arbitrary html
config_html(string $content) : mixed
arbitrary HTML
Return a data structure that will instruct the configuration page generator functions to add arbitrary HTML
config_add_html(string $content) : mixed
Generate an html text entry or password block
config_text_input(string $name, string $label, string $current[, bool $password = false ][, int $width = 420 ][, bool $textarea = false ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : mixed
The name of the configuration variable to be added.
The user text displayed to label the text block. Usually a $lang string.
The current value of the config variable being set.
Whether this is a "normal" text-entry field or a password-style field.
The width of the input field in pixels. Default: 420.
Render as a HTML <textarea>
The title attribute of the element
Enable auto-saving of changes when focus is lost
Whether field is hidden on the page
Help link to be displayed alongside the label.
Generate an HTML form element for input of integer only values. Field will include validation for supplied value being of type int and between supplied min and max values.
config_integer_input(string $name, string $label, string $current, int $min_value, int $max_value[, int $width = 55 ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : void
** While this function can handle client side validation, config_check_valid_option() must be used on save to allow for server side checking of the value. For an example, see pages/admin/admin_system_config.php
The name of the configuration variable to be added.
The user text displayed to label the text block. Usually a $lang string.
The current value of the config variable being set.
Minimum value permitted in field.
Maximum value permitted in field.
The width of the input field in pixels. Default: 55.
The title attribute of the element
Enable auto-saving of changes when focus is lost
Whether field is hidden on the page
Help link to be displayed alongside the label.
Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
config_add_text_input(string $config_var, string $label[, bool $password = false ][, int $width = 420 ][, bool $textarea = false ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : mixed
The name of the configuration variable to be added.
The user text displayed to label the text block. Usually a $lang string.
Whether this is a "normal" text-entry field or a password-style field.
The width of the input field in pixels. Default: 420.
Render as a HTML <textarea>
The title attribute of the element
Enable auto-saving of changes when focus is lost
Whether field is hidden on the page
Help link to be displayed alongside the label.
config_add_integer_input(mixed $config_var, mixed $label, mixed $min_value, mixed $max_value[, mixed $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $hidden = false ][, string $help_link = "" ]) : mixed
Generate a data structure to instruct the configuration page generator to add a hidden input
config_add_hidden_input(string $cf_var_name[, string $cf_var_value = '' ]) : array<string|int, mixed>
Plugins' configuration variable name
Value
Generate an HTML input file with its own form
config_file_input(string $name, string $label, mixed $current, string $form_action[, int $width = 420 ][, mixed $valid_extensions = array() ][, mixed $file_preview = false ][, string $title = null ]) : mixed
HTML input file name attribute
URL where the form should post to
Wdidth of the input file HTML tag. Default - 420
Title to be used for the label title. Default: null. Will display as hover text e.g. "Sets configuration variable: $variable_name" if $title is supplied as null. Use '' (blank) to disable where no text is required.
Return a data structure that will be used to generate the HTML for uploading a file
config_add_file_input(mixed $config_var, string $label, string $form_action[, int $width = 420 ][, array<string|int, mixed> $valid_extensions = array() ][, mixed $file_preview = false ][, string $title = null ]) : mixed
Label for field
URL where the form should post to
Width of the input file HTML tag. Default - 420
Optional array of file extensions that will be validated during upload, see config_process_file_input()
Title to be used for the label title. Default: null. Will display as hover text e.g. "Sets configuration variable: $variable_name" if $title is supplied as null. Use '' (blank) to disable where no text is required.
Generate an html single-select + options block
config_single_select(string $name, string $label, string $current, mixed $choices[, bool $usekeys = true ][, int $width = 420 ][, string $title = null ][, bool $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, bool $reload_page = false ]) : mixed
The name of the select block. Usually the name of the config variable being set.
The user text displayed to label the select block. Usually a $lang string.
The current value of the config variable being set.
Tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
The width of the input field in pixels. Default: 420.
Title to be used for the label title. Default: null
Flag to say whether the there should be an auto save message feedback through JS. Default: false Note: onChange event will call AutoSaveConfigOption([option name])
Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable to the setup page.
config_add_single_select(string $config_var, string $label[, mixed $choices = '' ][, bool $usekeys = true ][, int $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, bool $reload_page = false ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
the width of the input field in pixels. Default: 420.
Generate an html boolean select block
config_boolean_select(string $name, string $label, bool $current[, mixed $choices = '' ][, int $width = 420 ][, string $title = null ][, bool $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, string $help = '' ][, bool $reload_page = false ]) : mixed
The name of the select block. Usually the name of the config variable being set.
The user text displayed to label the select block. Usually a $lang string.
The current value (true or false) of the config variable being set.
The width of the input field in pixels. Default: 420.
Title to be used for the label title. Default: null
Flag to say whether the there should be an auto save message feedback through JS. Default: false Note: onChange event will call AutoSaveConfigOption([option name])
Help text to display for this question
Reload the page after saving, useful for large CSS changes.
Return a data structure that will instruct the configuration page generator functions to add a boolean configuration variable to the setup page.
config_add_boolean_select(string $config_var, string $label[, mixed $choices = '' ][, int $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, string $help = '' ][, bool $reload_page = false ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 420.
Help text to display for this question
Reload the page after saving.
Generate an html checkbox options block
config_checkbox_select(string $name, string $label, mixed $current, mixed $choices[, bool $usekeys = true ][, int $width = 300 ][, int $columns = 1 ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
the name of the checkbox block.
the user text displayed to label the checkbox block. Usually a $lang string.
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
the width of the input field in pixels. Default: 300.
the number of columns to use
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
config_add_checkbox_select(string $config_var, string $label, mixed $choices[, bool $usekeys = true ][, int $width = 300 ][, mixed $columns = 1 ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
the width of the input field in pixels. Default: 300.
config_add_colouroverride_input(mixed $config_var[, mixed $label = '' ][, mixed $default = '' ][, mixed $title = '' ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
Return a data structure that will instruct the configuration page generator functions to add a single RS field-type select configuration variable to the setup page.
config_add_single_ftype_select(string $config_var, string $label[, int $width = 300 ][, int $rtype = false ][, mixed $ftypes = array() ][, mixed $autosave = false ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
optional to specify a resource type to get fields for
Generate an html single-select + options block for selecting one of the RS field types. The selected field type is posted as the value of the "ref" column of the selected field type.
config_single_ftype_select(string $name, string $label, int $current[, int $width = 300 ][, mixed $rtype = false ][, mixed $ftypes = array() ][, mixed $autosave = false ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the current value of the config variable being set
the width of the input field in pixels. Default: 300.
Generate Javascript function used for auto saving individual config options
config_generate_AutoSaveConfigOption_function(string $post_url) : mixed
URL to where the data will be posted
config_process_file_input(array<string|int, mixed> $page_def, mixed $file_location, mixed $redirect_location) : mixed
Generates HTML foreach element found in the page definition
config_generate_html(array<string|int, mixed> $page_def) : mixed
Array of all elements for which we need to generate HTML
Merge all non image configurations
config_merge_non_image_types() : array<string|int, mixed>
Returns merged array of non image configurations.
Retrieves the header image URL based on the user's appearance preference and system configuration.
get_header_image([bool $full = false ][, bool $for_header = false ][, string $force_appearance = "" ]) : string
Whether to return the full URL including the base URL.
Whether the image is being displayed in the header.
Optionally force the appearance mode ('dark' or 'light').
The resolved URL for the header image.
Used to block deletion of 'core' fields. Any variable added to the $corefields array will be checked before a field is deleted and if the field is referenced by one of these core variables the deletion will be blocked
config_register_core_fieldvars([string $source = "BASE" ][, array<string|int, mixed> $varnames = array() ]) : void
Optional origin of variables e.g. 'Transform plugin'
Array of variable names
Used to block deletion of 'core' fields.
config_register_core_field_refs(string $source, array<string|int, mixed> $refs) : mixed
What part (e.g plugin) relies on this list of metadata fields
List of metadata field IDs to prevent being deleted
Run PHP code on array of variables. Used for modifying $GLOBALS.
override_rs_variables_by_eval(array<string|int, mixed> $variables, string $code, string $override_for) : void
Array of variables to apply override on.
Signed string containing the PHP code to run.
Context in which override is being made. Generally this will be 'usergroup' or 'resource_type' config overrides. This ensures we only revert config to its original state for the same origin of the override. For example, if applying resource type specific config, don't revert config changed at the user group level. This also prevents unexpected changes of config whilst pages are being loaded.
Update the resource_type_field - resource_type mappings
update_resource_type_field_resource_types(int $ref, array<string|int, mixed> $resource_types) : void
Resource type field ref
Array of resource type refs
Get all resource_type->resource-type_field associations
get_resource_type_field_resource_types([array<string|int, mixed> $fields = [] ]) : array<string|int, mixed>
Optional array of resource_type_field data returned by get_resource_type_fields()
Array with resource_type_field ID as keys and arrays of resource_type IDs as values
Create a new resource type with the specified name
create_resource_type(mixed $name) : int|bool
Name of new resouce type
ref of new resource type or false if invalid data passed
Save updated resource_type data
save_resource_type(int $ref, array<string|int, mixed> $savedata) : bool
Ref of resource type
Array of column values
Force clear of restype_cache after editing resource type where get_resource_types() needs to pick up the new value.
clear_restype_cache() : void
Get resource_type data
rs_get_resource_type(int $ref) : array<string|int, mixed>
Save resource type field - used on pages/admin/admin_resource_type_field_edit.php
save_resource_type_field(int $ref, array<string|int, mixed> $columns, mixed $postdata) : bool
Field ID
Array of column data
POST'd data
Get the definitions for resource_type_field columns, including properties and display configurations.
get_resource_type_field_columns() : array<string|int, mixed>
An associative array of resource type field column definitions.
Input validation helper function to determine if the $contact_sheet_preview_size config is valid.
is_valid_contact_sheet_preview_size(string $val) : bool
Store a config option that has been removed from the UI so that it will still work until it has been set in config file
save_removed_ui_config(string $option) : bool
Returns true if option been saved, false if not
Check if there is a previously stored value for the given config option.
check_removed_ui_config(string $option[, mixed $default = "" ]) : bool
Intended for options that were previously set in the UI but now need to be set in config.
The default value to set for the config option if not set anywhere
True if the config option is overridden with a stored value from user_preferences, false if not
Return a data structure that will instruct the configuration page generator functions to add a fixed input setting to the setup page. Uses render_fixed_text_question(). Useful for options removed from the UI
config_add_fixed_input(string $label, string $value[, string $helptext = "" ]) : array<string|int, mixed>
The user text displayed to label the text block. Usually a $lang string.
The fixed text value to be displayed
Optional text that will be displayed below the question
Array of data that will be passed to the page generation code
Add config option search to user preferences / system configuration page.
render_config_filter_by_search(string $filter, string $only_modified) : void
Also requires config_filter_by_search() to process results. For examples, see the above pages.
Value from getval("filter", "")
Value from getval("only_modified", "no")
Process values from config search fields, see render_config_filter_by_search() Filter $page_def elements to show only those searched for.
config_filter_by_search(array<string|int, mixed> $page_def, array<string|int, mixed> $config_type, string $find, string $only_modified) : array<string|int, mixed>
Array containing page definition, from functions config_add_ ...
Array representing the type of config to check: array() - empty array for system config array('user' => 1) - key 'user' and int representing user ref to check user preferences array('usergroup' => 2) - key 'usergroup' and int representing usergroup ref to check user group preferences
Value from getval("find", "")
Value from getval("only_modified", "no")
Remove user preferences by resetting to system preferences. Used to display system config or user group config without the current user's preferences changing the values.
config_remove_user_preferences(array<string|int, mixed> $page_def) : void
Array containing page definition, from functions config_add_ ...
Generate a percentage range input
config_percent_range(string $name, string $label, string $current[, int $width = 420 ][, string $title = null ][, string $help_link = "" ]) : mixed
The name of the configuration variable to be added.
The user text displayed to label the text block. Usually a $lang string.
The current value of the config variable being set.
The width of the input field in pixels. Default: 420.
The title attribute of the element
Help link to be displayed alongside the label.
Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
config_add_percent_range(string $config_var, string $label[, int $width = 380 ][, string $title = null ][, string $help_link = "" ]) : mixed
The name of the configuration variable to be added.
The user text displayed to label the text block. Usually a $lang string.
The width of the input field in pixels. Default: 420.
The title attribute of the element
Help link to be displayed alongside the label.
Server side validation for saving values submitted using the page generation functions "config_add_...()" and created with config_generate_html(). For example, the system configuration page.
config_check_valid_option(array<string|int, mixed> $def, mixed $value) : bool
Array containing field definition e.g. from config_add_integer_input()
User submitted value to be checked.
True if the option is valid, else false.
Generates the CSV content of the metadata for resources passed in the array The CSV is echoed to output for direct download or saved to a file
generateResourcesMetadataCSV(array<string|int, mixed> $resources[, bool $personal = false ][, bool $alldata = false ][, string $outputfile = "" ]) : bool|void
array of resource ids to create a CSV for
flag to include only fields expected to include personal data
flag to include extra data from the resource table
optional file path to output CSV to
TRUE if the file has been created, void if the data has been sent as a direct download
Generates the file content when exporting nodes
generateNodesExport(array<string|int, mixed> $field[, mixed $parent = null ][, bool $send_headers = false ]) : mixed
Array containing field information (as retrieved by get_field)
If true, function sends headers used for downloading content. Default is set to false
returns a ref for an existing dash tile in dash_tile table, returns 0 if no existing dash tile
existing_dash_tile([string $url = "" ][, string $link = "" ][, string $title = "" ][, string $text = "" ][, int $reload_interval = 0 ][, int $all_users = 0 ][, int $resource_count = 0 ]) : int
create_dash_tile(mixed $url, mixed $link, mixed $title, mixed $reload_interval, mixed $all_users, mixed $default_order_by, mixed $resource_count[, mixed $text = "" ][, mixed $delete = 1 ][, array<string|int, mixed> $specific_user_groups = array() ]) : mixed
update_dash_tile(mixed $tile, mixed $url, mixed $link, mixed $title, mixed $reload_interval, mixed $all_users, mixed $tile_audience, mixed $current_specific_user_groups, mixed $specific_user_groups, mixed $default_order_by, mixed $resource_count[, mixed $text = "" ][, mixed $delete = 1 ]) : mixed
delete_dash_tile(mixed $tile[, mixed $cascade = true ][, mixed $force = false ]) : mixed
revoke_all_users_flag_cascade_delete(mixed $tile) : mixed
append_default_position() : mixed
reorder_default_dash() : mixed
update_default_dash_tile_order(mixed $tile, mixed $order_by) : mixed
get_tile(mixed $tile) : mixed
all_user_dash_tile_active(mixed $tile) : mixed
existing_tile(mixed $title, mixed $all_users, mixed $url, mixed $link, mixed $reload_interval, mixed $resource_count[, mixed $text = "" ]) : mixed
cleanup_dash_tiles() : mixed
checkTileConfig(mixed $tile, mixed $tile_style) : mixed
checkConfigCustomHomePanels(mixed $tile, mixed $tile_style) : mixed
get_alluser_available_tiles([mixed $tile = "null" ]) : mixed
get_default_dash([mixed $user_group_id = null ][, mixed $edit_mode = false ]) : mixed
get_managed_dash() : mixed
add_usergroup_dash_tile(mixed $usergroup, mixed $tile, mixed $default_order_by) : mixed
append_usergroup_position(mixed $usergroup) : mixed
Reorder dashboard tiles for a specific user group.
reorder_usergroup_dash(int $usergroup) : void
This function retrieves all dashboard tiles assigned to a user group and updates each tile's order in increments of 10.
The user group ID for which dashboard tiles should be reordered.
Update the display order of a specific dashboard tile for a user group.
update_usergroup_dash_tile_order(int $usergroup, int $tile, int $default_order_by) : void
The user group ID to which the dashboard tile belongs.
The ID of the dashboard tile to update.
The new default order position for the tile within the user group's dashboard.
build_usergroup_dash - rebuild the usergroup tiles for either a specific user or all users.
build_usergroup_dash(int $user_group[, int $user_id = 0 ][, int $newtileid = "" ]) : void
If a specific tile is passed e.g. if called from create_dash_tile then we just add it to the end
ID of group to add tile(s) to
ID of individual user to add tile(s) to
ID of a single tile to add on the end
Retrieve user group IDs associated with a specific dashboard tile.
get_tile_user_groups(int $tile_id) : array<string|int, mixed>
This function fetches the IDs of all user groups that have access to a given dashboard tile. Each user group ID is returned as a value in the resulting array.
The ID of the dashboard tile for which to retrieve associated user groups.
An array of user group IDs that are linked to the specified dashboard tile.
Retrieve dashboard tiles available to a specific user group.
get_usergroup_available_tiles(int $user_group_id[, int|string $tile = '' ]) : array<string|int, mixed>
This function returns the tiles that are accessible by a particular user group, optionally filtered by a specific tile ID. The function ensures that the user group ID is numeric and fetches the tiles that are either available to all users or specifically assigned to the provided user group.
The ID of the user group for which to retrieve available tiles.
(optional) Specific tile ID to filter by; if omitted, all available tiles for the user group are returned.
An array of associative arrays, each representing a dashboard tile with keys:
Get usergroup_dash_tile record
get_usergroup_tile(int $tile_id, int $user_group_id) : array<string|int, mixed>
add_user_dash_tile(mixed $user, mixed $tile, mixed $order_by[, mixed $reorder = true ]) : mixed
get_user_tile(mixed $usertile, mixed $user) : mixed
create_new_user_dash(mixed $user) : mixed
update_user_dash_tile_order(mixed $user, mixed $tile, mixed $order_by) : mixed
delete_user_dash_tile(mixed $usertile, mixed $user) : mixed
empty_user_dash(mixed $user[, mixed $purge = true ]) : mixed
reorder_user_dash(mixed $user) : mixed
append_user_position(mixed $user) : mixed
get_user_available_tiles(mixed $user[, mixed $tile = "null" ]) : mixed
get_user_dash(mixed $user) : mixed
Render JavaScript for the dashboard tile delete dialog.
render_delete_dialog_JS([bool $all_users = false ]) : void
This function outputs JavaScript to create and display a jQuery UI dialog for deleting dashboard tiles.
Depending on the $all_users parameter, the dialog may include additional options for deleting default tiles
or managing default dashboard tiles.
(optional) If set to true, additional options are displayed for managing tiles that are
accessible by all users. Default is false.
Outputs JavaScript directly to the page to render the dialog.
parse_dashtile_link(mixed $link) : mixed
build_dash_tile_list(mixed $dtiles_available) : mixed
delete_usergroup_dash_tile(mixed $tile, mixed $group) : mixed
Confirms whether a dash tile type allows for promoted resources
allowPromotedResources(string $tile_type) : bool
Render "Upgrade available" tile for Administrators and Super Admins. This tile cannot be deleted or removed unless ResourceSpace version is up to date
render_upgrade_available_tile(int $user) : void
User ID, normally this is the $userref
Generate HTML and JavaScript for the dashboard tile toolbar.
generate_dash_tile_toolbar(array<string|int, mixed> $tile, string $tile_id[, bool $display_counter = false ]) : void
This function renders a toolbar for a dashboard tile, providing options to delete or edit the tile, based on the user's permissions. The toolbar appears on hover and includes JavaScript functionality to manage tile interactions, including preventing accidental clicks on the tile itself when using the toolbar.
An associative array containing information about the dashboard tile, including:
The unique HTML ID of the tile used for identifying elements in the toolbar.
If true then a counter pill will be rendered opposite the dash tile actions
Build list of resources that can be shown on a dash tile as a background image. Helper function.
dash_tile_featured_collection_get_resources(array<string|int, mixed>|int $c, array<string|int, mixed> $ctx) : array<string|int, mixed>
Collection ref -or- collection data as returned by get_collection()
Contextual data
dash_tile_featured_collection_get_top_resources() : mixed
Validate the type of dash tile and check that the style provided is valid for it.
validate_tile_style(string $type, string $style) : string
Tile type name.
Tile style name.
Will return the style value provided if correct, the first defined style or blank if no styles defined.
Sanitise the url provided when saving a dash tile. This function will take the value obtained by the form and pass it through if valid.
validate_build_url(string $buildurl) : string
If the url supplied is invalid, a blank value will be returned allowing the default standard tile type to be used.
url supplied when dash tile is edited, containing a number of optional parameters.
A valid url or empty string if invalid.
Generate client side logic for doing expensive computation async for retrieving the tile background and total results count.
tltype_srch_generate_js_for_background_and_count(array<string|int, mixed> $tile, string $tile_id, int $tile_width, int $tile_height, int $promoted_image) : mixed
Tile information pages/ajax/dash_tile.php
HTML ID for the container div
Tile width pages/ajax/dash_tile.php
Tile height pages/ajax/dash_tile.php
ID of the promoted resource (for background)
Get images and resource count for search dash tile.
get_dash_search_data([string $link = '' ][, int $promimg = 0 ]) : array<string|int, mixed>
This has to work on a string because the dash tile does not yet exist when on dash creation page For performance this function will return a maximum of 4 images
Tile link URL
Promoted image ref
$searchdata Array containing the count of resources and details of preview images.
Check if current user can edit dash tile. Users shouldn't be able to edit tiles that they can't view and only dash admins should be able to edit shared tiles.
can_edit_tile(int $tileref, int $audience, int $user) : bool
0 for tile available to one user, 1 for all users. Typically obtained from get_tile()
Ref of the user editing the tile.
Will return true if editing is allowed else will return false.
tile_select(mixed $tile_type, mixed $tile_style, mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height) : mixed
Generate the HTML for a graph dash tile.
tile_graph(array<string|int, mixed> $tile, string $tile_id) : void
@param array $tile array usually from get_tile()
string used to identify the tile on the page
tile_config_themeselector(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height) : mixed
Generate HTML for an icon tile, i.e. pending submission, pending review or upload
tile_icon(array<string|int, mixed> $tile, string $tile_id) : void
@param array $tile array usually from get_tile()
string used to identify the tile on the page
Generate HTML for a freetext tile
tile_freetext(array<string|int, mixed> $tile[, string|null $tile_id = null ]) : void
@param array $tile array usually from get_tile()
string used to identify the tile on the page
tile_search_thumbs(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height[, mixed $promoted_image = false ]) : mixed
tile_search_multi_or_blank(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height) : mixed
tile_featured_collection_thumbs(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height, mixed $promoted_image) : mixed
tile_featured_collection_multi(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height, mixed $promoted_image) : mixed
Centralised error handler. Display friendly error messages.
errorhandler(int $errno, string $errstr, string $errfile, int $errline) : void
Check if ResourceSpace has been configured to run with differnt users (read-write and/or read-only)
db_use_multiple_connection_modes() : bool
Used to force the database connection mode before running a particular SQL query
db_set_connection_mode(string $name) : void
NOTE: this will generate a global variable that can be used to determine which mode is currently set.
IMPORTANT: It is the responsibility of each function to clear the current db mode once it finished running the query as the variable is not meant to persist between queries.
The name of the connection mode
Return the current DB connection mode
db_get_connection_mode() : string
Clear the current DB connection mode that is in use to override the current SQL queries.
db_clear_connection_mode() : void
@see db_set_connection_mode() for more details.
Connect to the database using the configured settings.
sql_connect() : void
Indicate that from now on we want to group together DML statements into one transaction.
db_begin_transaction(string $name) : bool
Savepoint name for the transaction.
Returns TRUE on success or FALSE on failure.
Tell the database to commit the current transaction.
db_end_transaction(string $name) : bool
Savepoint name for the transaction.
Returns TRUE on success or FALSE on failure.
Tell the database to rollback the current transaction.
db_rollback_transaction(string $name) : bool
Savepoint name for the transaction.
Returns TRUE on success or FALSE on failure.
Execute a prepared statement and return the results as an array.
ps_query(string $sql[, array<string|int, mixed> $parameters = array() ][, string $cache = "" ][, int $fetchrows = -1 ][, bool $dbstruct = true ][, int $logthis = 2 ][, bool $reconnect = true ][, mixed $fetch_specific_columns = false ]) : array<string|int, mixed>
The SQL to execute
An array of parameters used in the SQL in the order: type, value, type, value... and so on. Types are as follows: i - integer, d - double, s - string, b - BLOB. Example: array("s","This is the first SQL parameter and is a string","d",3.14)
Disk based caching - cache the results on disk, if a cache group is specified. The group allows selected parts of the cache to be cleared by certain operations, for example clearing all cached site content whenever site text is edited.
set we don't have to loop through all the returned rows. We just fetch $fetchrows row but pad the array to the full result set size with empty values.
Set to false to prevent the dbstruct being checked on an error - only set by operations doing exactly that to prevent an infinite loop
No longer used
Copy value as value (flatten / no references)
copy_value(mixed $v) : mixed
Return a single value from a database query, or the default if no rows
ps_value(string $query, array<string|int, mixed> $parameters, mixed $default[, string $cache = "" ]) : string
NOTE: The value returned must have the column name aliased to 'value'
SQL query
SQL parameters with types, as for ps_query()
Default value to return if no rows returned
Cache category (optional)
Like ps_value() but returns an array of all values found
ps_array(string $query[, array<string|int, mixed> $parameters = array() ][, string $cache = "" ]) : array<string|int, mixed>
NOTE: The value returned must have the column name aliased to 'value'
SQL query
SQL parameters with types, as for ps_query()
Cache category (optional)
Return the ID of the previously inserted row.
sql_insert_id() : int
Returns the location of the query cache files
get_query_cache_location() : string
Clear all cached queries for cache group $cache
clear_query_cache(string $cache) : bool
If we've already done this on this page load, don't do it again as it will only add to the load in the case of batch operations.
Check the database structure conforms to that describe in the /dbstruct folder. Usually only happens after a SQL error after which the SQL is retried, thus the database is automatically upgraded.
check_db_structs([bool $verbose = false ]) : void
This function calls CheckDBStruct() for all plugin paths and the core project.
Check the database structure against the text files stored in $path.
CheckDBStruct(string $path[, bool $verbose = false ]) : void
Add tables / columns / data / indices as necessary.
Generate the LIMIT statement for a SQL query
sql_limit(int $offset, int $rows) : string
Specifies the offset of the first row to return
Specifies the maximum number of rows to return
Utility function to obtain the total found rows while paginating the results.
sql_limit_with_total_count(PreparedStatementQuery $query, null|int $rows, null|int $offset[, bool $cachecount = false ][, null|PreparedStatementQuery $countquery = null ]) : array<string|int, mixed>
IMPORTANT: the input query MUST have a deterministic order so it can help with performance and not have an undefined behaviour
SQL query
Specifies the maximum number of rows to return. Usually set by a global configuration option (e.g $default_perpage, $default_perpage_list).
Specifies the offset of the first row to return. Use NULL to not offset.
Use previously cached count if available?
Optional separate query to obtain count, usually without ORDER BY
Returns a:
Query helper to ensure code honours the database schema constraints on text columns.
sql_truncate_text_val(string $v, int $len) : string
IMPORTANT: please use where appropriate! In some cases, truncating may mean losing useful information (e.g contextual data), in which case changing the column type may be a better option.
String value that may require truncating
Desired length (limit as imposed by the database schema). https://www.resourcespace.com/knowledge-base/developers/database_schema
When constructing prepared statements and using e.g. ref in (some list of values), assists in outputting the correct number of parameters.
ps_param_insert(int $count) : string
How many parameters to insert, e.g. 3 returns "?,?,?"
When constructing prepared statements and using e.g. ref in (some list of values), assists in preparing the parameter array.
ps_param_fill(array<string|int, mixed> $array, string $type) : array<string|int, mixed>
The input array, to prepare for output. Will return this array but with type entry inserted before each value.
The column type as per ps_query
Assists in generating parameter arrays where all of the parameters for a given section of sql are the same.
ps_fill_param_array(string $string, string $value, string $type) : array<string|int, mixed>
A portion of sql that contains one or more placeholders
The value that should be used to generate the array of parameters
The column type of $value as per ps_query
Re-order rows in the table
sql_reorder_records(string $table, array<string|int, mixed> $refs) : void
Table name. MUST have an "order_by" column.
List of record IDs in the new desired order
Returns a comma separated list of table columns from the given table. Optionally, will use an alias instead of the table name to prefix the columns. For inclusion in SQL to replace "select *" which is not supported when using prepared statements.
columns_in(string $table[, string $alias = null ][, string $plugin = null ][, bool $return_list = false ]) : string|array<string|int, mixed>
The source table
Optionally, a different alias to use
[DEPRECATED] Specifies that this table is defined in a plugin with the supplied name
Set to true to return a list of column names. Note: the alias is ignored in this mode.
Database helper to chunk a list of IDs
db_chunk_id_list(array<int, int> $refs) : array<int, array<int, int>>
Delete database table records from a list of IDs
db_delete_table_records(string $table, array<int, int> $refs, callable $logger) : bool
return db_delete_table_records(
'brand_guidelines_content',
$refs,
fn($ref) => log_activity(null, LOG_CODE_DELETED, null, 'brand_guidelines_content', 'content', $ref)
);
Example how to not log it:
return db_delete_table_records('brand_guidelines_content', $refs, fn() => null);
Database table name
List of database IDs
True if it executed the query, false otherwise
Check and set the debug log override status for the current user.
check_debug_log_override() : void
This function determines if debug logging should be enabled based on system variables and the user's ID. If a debug override is set for a specific user or globally, and the override has not expired, debug logging will be activated. Expired overrides are removed.
Create a debug log override for a specified user or globally.
create_debug_log_override([int $debug_user = -1 ][, int $debug_expires = 60 ]) : void
This function sets a debug override that enables debug logging for a specified user
or all users if $debug_user is -1. The override is set to expire after a specified
duration in seconds. Any existing override settings are removed before the new values
are inserted.
The user ID for whom to enable debug logging (-1 for all users). Default is -1.
The time in seconds until the debug override expires, starting from the current time. Default is 60 seconds.
Debug called function and its arguments
debug_function_call(string $name, array<string|int, mixed> $args) : bool|void
The best way to use this function is to call it on the first line of a function definition:
function some_test($required, $num, $optional_bool = false) { debug_function_call(FUNCTION, func_get_args());
echo "called some_test" . PHP_EOL;
return;
}
The function name
The "runtime" args
@see debug()
Stringify variables for use in the debug log. This is used more as fallback to json_encode() failing to maintain quick readability of the logs.
debug_stringify(mixed $value) : string
Any value that needs stringified
LOG_CODE_validate(mixed $log_code) : mixed
LOG_CODE_get_all() : mixed
definitions_get_by_prefix(mixed $prefix) : mixed
Takes a search string $search, as provided by the user, and returns a results set of matching resources. If there are no matches, instead returns an array of suggested searches
do_search(string $search[, string $restypes = '' ][, string $order_by = 'relevance' ][, string $archive = '0' ][, int|array<string|int, mixed> $fetchrows = -1 ][, string $sort = 'desc' ][, bool $access_override = false ][, int $starsearch = DEPRECATED_STARSEARCH ][, bool $ignore_filters = false ][, bool $return_disk_usage = false ][, string $recent_search_daylimit = '' ][, string|bool $go = false ][, bool $stats_logging = true ][, bool $return_refs_only = false ][, bool $editable_only = false ][, bool $returnsql = false ][, int $access = null ][, mixed $smartsearch = false ]) : null|string|array<string|int, mixed>|PreparedStatementQuery
Search string
Optionally used to specify which resource types to search for
Allows searching in more than one archive state
Used by smart collections, so that all all applicable resources can be judged regardless of the final access-based results
DEPRECATED_STARSEARCH passed in for backwards compatibility
Paging direction (prev|next)
Log keyword usage
Returns the query as a PreparedStatementQuery instance
Search for resources with this access
resolve_given_nodes(mixed &$search, mixed &$node_bucket, mixed &$node_bucket_not) : mixed
Encrypts data
rsEncrypt(string $data, string $key[, string $keylength = 128 ]) : string
Data to be encypted
Key to use
Optional key length
Encrypted data
Decrypts data
rsDecrypt(string $data, string $key) : false|string
Data to be decrypted
Returns FALSE if MAC check failed, plaintext otherwise
Prior to eval() checks to make sure the code has been signed first, by the offline script / migration script.
eval_check_signed(string $code) : string
The code to check
The code, if correctly signed, or an empty string if not.
Returns a signature for a given block of code.
sign_code(string $code) : string
The code to sign
The signature
Returns a signature for a given block of code.
resign_all_code([bool $confirm = true ][, bool $output = true ][, bool $output_changes_only = false ]) : void
Require user to approve code changes when resigning from the server side.
Display output. $confirm will override this option to provide detail if approval needed.
Output changes only - do not sign code.
Used to compare the user's provided token with the expected value derived from the given identifier
rs_validate_token(string $token_data, string $id) : bool
Used by isValidCSRFToken() Also used on upload_batch to validate an upload session when user cookie not available (i.e. companion uploads)
Encrypted token data
Identifier
Initialize facial recognition functionality.
initFacialRecognition() : bool
IMPORTANT: only one field can be setup for the annotation side and it also MUST be a dynamic keywords list
Crops out a selected area of an image and makes it ready to be used by FaceRecognizer.
prepareFaceImage(string $image_path, string $prepared_image_path, float $x, float $y, float $width, float $height[, bool $overwrite_existing = false ]) : bool
Note: The selected area should follow the normalized coordinate system.
Path of the source image
Path of the prepared image
X position
Y position
Width
Height
Set to TRUE to overwrite existing prepared image (if any exists)
Use FaceRecognizer to predict the association between a face and a label (i.e person name)
faceRecognizerPredict(string $model_file_path, string $test_image_path) : bool|array<string|int, mixed>
Path to the FaceRecognizer model state file
Path to the prepared image we are testing
Return the label ID and probability on successful prediction or FALSE on error
Ensures the filename cannot leave the directory set.
safe_file_name(string $name) : string
Only to be used for internal ResourceSpace paths as only a limited character set is supported
Generate a UID for filnames that can be different from user to user (e.g. contact sheets)
generateUserFilenameUID(int $user_id) : string
Checks if a path is part of a whitelisted list of paths. This applies to both folders and files.
isPathWhitelisted(string $path, array<string|int, mixed> $whitelisted_paths) : bool
Note: the function is not supposed to check/ validate the syntax of the path (ie. UNIX/ Windows)
Path which is going to be checked against whitelisted paths
List of whitelisted paths
Return a checksum for the given file path.
get_checksum(string $path[, bool $forcefull = false ]) : string|false
Path to file
Force use of whole file and ignore $file_checksums_50k setting
Return the checksum value, false otherwise.
Download remote file to the temp filestore location.
temp_local_download_remote_file(string $url[, string $key = "" ]) : string|bool
Source URL
Optional key to use - to prevent conflicts when simultaneous calls use same file name
Returns the new temp filestore location or false otherwise.
Basic check of uploaded file against list of allowed extensions
check_valid_file_extension(array{name: string} $uploadedfile, array<string|int, mixed> $validextensions) : bool
An element from the $_FILES PHP reserved variable
Array of valid extension strings
Is the given extension in the list of blocked extensions? Also ensures extension is no longer than 10 characters due to resource.file_extension database column limit
is_banned_extension(string $extension) : bool
Remove empty folder from path to file. Helpful to remove a temp directory once the file it was created to hold no longer exists.
remove_empty_temp_directory([string $path_to_file = "" ]) : void
This function should be called only once the directory to be removed is empty.
Full path to file in filestore.
Confirm upload path is one of valid paths.
is_valid_upload_path(string $file_path, array<string|int, mixed> $valid_upload_paths) : bool
Upload path.
Array of valid upload paths to test against.
true when path is valid else false
Validate the files on disk that are associated with the given resources
validate_resource_files(array<string|int, mixed> $resources[, array<string|int, mixed> $criteria = [] ]) : array<string|int, mixed>
Array of resource IDs or array of resource data e.g, from search results
Array with an array of callables for each resource with the required return values in order to pass the check e.g. 'file_exists" =>true for a file presence only check
$results An array with resource ID as the index and the results of the check as the value (boolean) e.g. ["1234" => true, "1235" => false]
Check if a given file path is from a valid RS accessible location
is_valid_rs_path(string $path[, array<string|int, mixed> $override_paths = [] ]) : bool
Override checking of the default RS paths to check a specific location only.
Validation helper function to determine if a path base name is unsafe (e.g OS command injection).
is_safe_basename(string $val) : bool
Very strict, limited to specific characters only. Should only be used for filenames originating in ResourceSpace.
High level function which can handle processing file uploads.
process_file_upload(SplFileInfo|array{name: string, full_path: string, type: string, tmp_name: string, error: int, size: int} $source, SplFileInfo $destination, array{allow_extensions?: list, file_move?: "move_uploaded_file"|"rename"|"copy"|"dry_run", mime_file_based_detection?: bool} $processor) : ProcessFileUploadErrorCondition}
Processors which can override different parts of the main logic (e.g. allow specific extensions)
Parse file name (can include path, although it's unnecessary) to prevent known security bypasses associated with extensions, such as: - Double extensions, e.g. .jpg.php - Null bytes, e.g. .php%00.jpg, where .jpg gets truncated and .php becomes the new extension - Using Windows (DOS) 8.3 short path feature where it's possible to replace existing files by using their shortname (e.g. ".htaccess" can be replaced by "HTACCE~1")
parse_filename_extension(string $filename) : string
Delete old files and folders from tempo directory based on the configured $purge_temp_folder_age value Affects filestore/tmp, $storagedir/tmp or the configured $tempdir directory
delete_temp_files() : void
purge_query_cache() : void
Are the arguments set in $archiver_settings["arguments"] permitted? Allows word characters, '@', and '-' only
permitted_archiver_arguments(mixed $string) : bool
Check if a given path is absolute or contains a symlink or junction is_link() does not accurately detect junction links on Windows systems instead we check if the output from stat() and lstat() differ.
check_symlink(string $checkpath) : bool
Retrieve a user-submitted parameter from the browser via post/get/cookies, in that order.
getval(string $param, string $default[, bool $force_numeric = false ][, callable $type_check = null ]) : mixed
The parameter name
A default value to return if no matching parameter was found
Ensure a number is returned. (DEPRECATED)
Validate param type. Default is to check param values are strings.
Escape a value prior to using it in SQL.
escape_check(string $text) : string
IMPORTANT! NO LONGER NEEDED with prepared statements. This is only used when exporting SQL scripts.
For comparing escape_checked strings against mysql content because just doing $text=str_replace("\\","",$text); does not undo escape_check
unescape(mixed $text) : string
Formats a MySQL ISO date
nicedate(mixed $date[, mixed $time = false ][, mixed $wordy = true ][, mixed $offset_tz = false ]) : string
Always use the 'wordy' style from now on as this works better internationally.
Returns an empty string if date not set/invalid
Generates a text representation of the age from a given date
date_to_age(string $datetime) : string
This can be used to give a more user friendly indication of how old something is.
ISO format date which can be a BCE date (ie. with negative year -yyyy)
Returns a string representing the age calculated from $datetime, otherwise an empty string if date is invalid
Generates preview text of a certain line length and count
preview_from_text(string $text, int $line_length, int $line_count[, bool $add_ellipsis = true ]) : string
Can be used for generating previews of text output, such as messages.
The text to generate the preview of, can contain HTML
The number of characters that the preview can have on each line
The number of lines to be generated in the preview
Should ellipsis (...) be added if the original $text exceeds $line_count
Returns a string of the preview text, or an empty string if the preview is unable to be generated
Redirect to the provided URL using a HTTP header Location directive. Exits after redirect
redirect(string $url) : never
URL to redirect to
replace multiple spaces with a single space
trim_spaces(mixed $text) : string
Removes whitespace from the beginning/end of all elements in an array
trim_array(array<string|int, mixed> $array[, string $trimchars = '' ]) : array<string|int, mixed>
Takes a value as returned from a check-list field type and reformats to be more display-friendly.
tidylist(string $list) : string
Check-list fields have a leading comma.
Trims $text to $length if necessary. Tries to trim at a space if possible. Adds three full stops if trimmed.
tidy_trim(string $text, int $length) : string
..
Returns the average length of the strings in an array
average_length(array<string|int, mixed> $array) : float
Returns a list of activity types for which we have stats data (Search, User Session etc.)
get_stats_activity_types() : array<string|int, mixed>
Replace escaped newlines with real newlines.
newlines(string $text) : string
Returns a list of all available editable site text (content). If $find is specified a search is performed across page, name and text fields.
get_all_site_text([string $findpage = "" ][, string $findname = "" ][, string $findtext = "" ]) : array<string|int, mixed>
Returns a specific site text entry.
get_site_text(string $page, string $name, string $getlanguage, string $group) : string
Check if site text section is custom, i.e. deletable.
check_site_text_custom(mixed $page, mixed $name) : bool
Saves the submitted site text changes to the database.
save_site_text(string $page, string $name, string $language, int $group) : void
Return a human-readable string representing $bytes in either KB or MB.
formatfilesize(int $bytes[, bool $html = true ]) : string
file size to format in bytes
if set to true output will include  instead of a space
Converts human readable file size (e.g. 10 MB, 200.20 GB) into bytes.
filesize2bytes(string $str) : int
the result is in bytes
Get the mime type for a file on disk
get_mime_type(string $path[, string $ext = null ][, bool|null $file_based_detection = null ]) : array<string|int, mixed>
Determine the MIME type:
Find matching MIME type(s) for a file extension.
get_mime_types_by_extension(string $extension) : array<int, string>
Get the global MIME types associated with the configured banned extensions.
get_unsafe_mime_types() : array<string|int, mixed>
Convert the permitted resource type extension to MIME type. Used by upload_batch.php
allowed_type_mime(mixed $allowedtype) : string
MIME type e.g. image/jpeg
Send a mail - but correctly encode the message/subject in quoted-printable UTF-8.
send_mail(string $email, string $subject, string $message[, string $from = "" ][, string $reply_to = "" ][, string $html_template = "" ][, array<string|int, mixed> $templatevars = array() ][, string $from_name = "" ][, string $cc = "" ][, string $bcc = "" ][, array<string|int, mixed> $files = array() ]) : mixed
NOTE: $from is the name of the user sending the email, while $from_name is the name that should be put in the header, which can be the system name It is necessary to specify two since in all cases the email should be able to contain the user's name.
Old mail function remains the same to avoid possible issues with phpmailer send_mail_phpmailer allows for the use of text and html (multipart) emails, and the use of email templates in Manage Content.
Email address to send to
Email subject
Message text
From address - defaults to $email_from
Reply to address - defaults to $email_from
Optional template (this is a $lang entry with placeholders)
Used to populate email template placeholders
Email from name
Optional CC addresses
Optional BCC addresses
Optional array of file paths to attach in the format [filename.txt => /path/to/file.txt]
if ($use_phpmailer==true) this function is used instead.
send_mail_phpmailer(string $email, string $subject[, string $message = "" ][, string $from = "" ][, string $reply_to = "" ][, string $html_template = "" ][, array<string|int, mixed> $templatevars = array() ][, string $from_name = "" ][, string $cc = "" ][, string $bcc = "" ][, array<string|int, mixed> $files = array() ]) : void
Mail templates can include lang, server, site_text, and POST variables by default ex ( [lang_mycollections], [server_REMOTE_ADDR], [text_footer] , [message]
additional values must be made available through $templatevars For example, a complex url or image path that may be sent in an email should be added to the templatevars array and passed into send_mail. available templatevars need to be well-documented, and sample templates need to be available.
Email address to send to
Email subject
Message text
From address - defaults to $email_from
Reply to address - defaults to $email_from
Optional template (this is a $lang entry with placeholders)
Used to populate email template placeholders
Email from name
Optional CC addresses
Optional BCC addresses
Optional array of file paths to attach in the format [filename.txt => /path/to/file.txt]
Log email
log_mail(string $email, string $subject, string $sender) : void
Data logged is: Time To address From, User ID or 0 for system emails (cron etc.) Subject
The email address of the sender
Quoted printable encoding is rather simple.
rs_quoted_printable_encode(string $string[, int $linelen = 0 ][, string $linebreak = "=\r\n" ][, int $breaklen = 0 ][, bool $encodecrlf = false ]) : string
Each character in the string $string should be encoded if: Character code is <0x20 (space) Character is = (as it has a special meaning: 0x3d) Character is over ASCII range (>=0x80)
As rs_quoted_printable_encode() but for e-mail subject
rs_quoted_printable_encode_subject(string $string[, string $encoding = 'UTF-8' ]) : string
A generic pager function used by many display lists in ResourceSpace.
pager([bool $break = false ][, bool $scrolltotop = true ][, array<string|int, mixed> $options = array() ]) : void
Requires the following globals to be set or passed inb the $options array $url - Current page url $curpage - Current page $totalpages - Total number of pages
Remove the extension part of a filename
remove_extension(mixed $strName) : string
The filename
The filename minus the extension
Retrieve a list of permitted extensions for the given resource type.
get_allowed_extensions_by_type(int $resource_type) : string
Detect if a path is relative or absolute.
getAbsolutePath(string $path[, bool $create_if_not_exists = false ]) : string
If it is relative, we compute its absolute location by assuming it is relative to the application root (parent folder).
A relative or absolute path
Try to create the path if it does not exists. Default to False.
A absolute path
Find the files present in a folder, and sub-folder.
getFolderContents(string $path[, bool $recurse = true ][, bool $include_hidden = false ]) : array<string|int, mixed>
The path to look into.
Trigger the recursion, default to True.
Trigger the listing of hidden files / hidden directories, default to False.
A list of files present in the inspected folder (paths are relative to the inspected folder path).
Returns filename component of path This version is UTF-8 proof.
mb_basename(string $file) : string
A path.
Returns the base name of the given path.
Remove the extension part of a filename.
strip_extension(string $name[, mixed $use_ext_list = false ]) : string
A file name.
Return the file name without the extension part.
Checks to see if a process lock exists for the given process name.
is_process_lock(string $name) : bool
Name of lock to check
TRUE if a current process lock is in place, false if not
Set a process lock
set_process_lock(string $name) : bool
Clear a process lock
clear_process_lock(string $name) : bool
Custom function for retrieving a file size. A resolution for PHP's issue with large files and filesize().
filesize_unlimited(string $path) : int|bool
The file size in bytes
Strip the leading comma from a string
strip_leading_comma(string $val) : string
Determines where the tmp directory is. There are three options here: 1. tempdir - If set in config.php, use this value.
get_temp_dir([bool $asUrl = false ][, mixed $uniqid = "" ]) : string
Path to the tmp directory.
Converts a path to a url relative to the installation.
convert_path_to_url(string $abs_path) : Url
: The absolute path.
that is the relative path.
Escaping an unsafe command string
escape_command_args(string $cmd, array<string|int, mixed> $args) : string
Unsafe command to run
List of placeholders and their values which will have to be escapedshellarg()d.
Escaped command string
Utility function which works like system(), but returns the complete output string rather than just the last line of it.
run_command(string $command[, bool $geterrors = false ][, array<string|int, mixed> $params = array() ][, int $timeout = 0 ]) : string
Command to run
Set to TRUE to include errors in the output
List of placeholders and their values which will have to be escapedshellarg()d.
Maximum time in seconds before a command is forcibly stopped
Command output
Similar to run_command but returns an array with the resulting output (stdout & stderr) fetched concurrently for improved performance.
run_external(mixed $command) : array<string|int, mixed>
Command to run
Command output
Display a styledalert() modal error and optionally return the browser to the previous page after 2 seconds
error_alert(string $error[, bool $back = true ][, int $code = 403 ]) : void
Error text to display
Return to previous page?
(Optional) HTTP code to return
When displaying metadata, applies trim/wordwrap.
format_display_field(string $value) : string
Formats a string with a collapsible more / less section
format_string_more_link(string $string[, int $max_words_before_more = 30 ]) : string
Render a performance footer with metrics.
draw_performance_footer() : void
Format SQL queries for display purposes Note: these queries are no longer known to be safe from sql injection
format_query(string $query, array<string|int, mixed> $params) : string
Abstracted mysqli_affected_rows()
sql_affected_rows() : mixed
Returns the path to the ImageMagick utilities such as 'convert'.
get_imagemagick_path(string $utilityname, string $exeNames, string &$checked_path) : string
Returns the full path to a utility, if installed or FALSE otherwise.
get_utility_path(string $utilityname[, string &$checked_path = null ]) : string|bool
Note: this function doesn't check that the utility is working.
Returns full path to utility tool or FALSE
Get full path to utility
get_executable_path(string $path, array<string|int, mixed> $executable, string &$checked_path[, bool $check_exe = false ]) : string|bool
Clean up the resource data cache to keep within $cache_array_limit
truncate_cache_arrays() : void
Work out of a string is likely to be in HTML format.
is_html(mixed $string) : bool
Set a cookie.
rs_setcookie(string $name, string $value[, int $daysexpire = 0 ][, string $path = "" ][, string $domain = "" ][, bool $secure = false ][, bool $httponly = true ][, string $samesite = "Strict" ]) : void
Note: The argument $daysexpire is not the same as the argument $expire in the PHP internal function setcookie.
Get an array of all the states that a user has edit access to
get_editable_states(int $userref) : array<string|int, mixed>
Returns true if $html is valid HTML, otherwise an error string describing the problem.
validate_html(mixed $html) : bool|string
Utility function to generate URLs with query strings easier, with the ability to override existing query string parameters when needed.
generateURL(string $url[, array<string|int, mixed> $parameters = array() ][, array<string|int, mixed> $set_params = array() ]) : string
Default query string params (e.g "k", which appears on most of ResourceSpace URLs)
Override existing query string params
Utility function used to move the element of one array from a position to another one in the same array Note: the manipulation is done on the same array
move_array_element(array<string|int, mixed> &$array, int $from_index, int $to_index) : void
Array index we are moving from
Array index we are moving to
Check if a value that may equate to false in PHP is actually a zero
emptyiszero(mixed $value) : bool
Get data for each image that should be used on the slideshow.
get_slideshow_files_data() : array<string|int, mixed>
The format of the returned array should be: Array ( [0] => Array ( [ref] => 1 [resource_ref] => [homepage_show] => 1 [login_show] => 1 [file_path] => /var/www/filestore/system/slideshow_1bf4796ac6f051a/1.jpg [checksum] => 1539875502 )
[1] => Array
(
[ref] => 4
[resource_ref] => 19
[homepage_show] => 1
[login_show] => 0
[file_path] => /var/www/filestore/system/slideshow_1bf4796ac6f051a/4.jpg
[checksum] => 1542818794
[link] => http://localhost/?r=19
)
)
Determines if at least one slideshow image is configured for the login page
is_login_slideshow_enabled() : bool
Returns a sanitised row from the table in a safe form for use in a form value, suitable overwritten by POSTed data if it has been supplied.
form_value_display(array<string|int, mixed> $row, string $name[, string $default = "" ]) : string
Change the user's user group
user_set_usergroup(int $user, int $usergroup) : void
Generates a random string of requested length.
generateSecureKey([int $length = 64 ]) : string
Used to generate initial spider and scramble keys.
Length of desired string of bytes
Random character string
Check if current page is a modal and set global $modal variable if not already set
IsModal() : bool
true if modal, false otherwise
Generates a CSRF token (Encrypted Token Pattern)
generateCSRFToken(string $session_id, string $form_id) : string
The current user session ID
A unique form ID
Token
Checks if CSRF Token is valid
isValidCSRFToken(mixed $token_data, mixed $session_id) : bool
Returns TRUE if token is valid or CSRF is not enabled, FALSE otherwise
Render the CSRF Token input tag
generateFormToken(string $form_id) : void
The id/ name attribute of the form
Render the CSRF Token for AJAX use
generateAjaxToken(string $form_id) : string
The id/ name attribute of the form or just the calling function for this type of request
Create a CSRF token as a JS object
generate_csrf_js_object(string $name) : string
The name of the token identifier (e.g API function called)
JS object with CSRF data (identifier & token) if CSRF is enabled, empty object otherwise
Create an HTML data attribute holding a CSRF token (JS) object
generate_csrf_data_for_api_native_authmode(string $fct_name) : string
The name of the API function called (e.g create_resource)
Enforce using POST requests
enforcePostRequest(bool $ajax) : bool|void
Set to TRUE if request is done via AJAX
Returns true if request method is POST or sends 405 header otherwise
Check if ResourceSpace is up to date or an upgrade is available
is_resourcespace_upgrade_available() : bool
Fetch a count of recently active users
get_recent_users(int $days) : int
How many days to look back
Return the total number of approved
get_total_approved_users() : int
The number of approved users
Return the number of resources in the system with optional filter by archive state
get_total_resources([int|bool $status = false ]) : int
Archive state to filter by if required
Number of resources in the system, filtered by status if provided
Check if script last ran more than the failure notification days Note: Never/ period longer than allowed failure should return false
check_script_last_ran(string $name, int $fail_notify_allowance, string &$last_ran_datetime) : bool
Name of the sysvar to check the record for
How long to allow (in days) before user can consider script has failed
Datetime (string format) when script was last run
Counting errors found in a collection of items. An error is found when an item has an "error" key.
count_errors(array<string|int, mixed> $a) : int
Collection of items that may contain errors.
Function can be used to order a multi-dimensional array using a key and corresponding value
search_array_by_keyvalue(array<string|int, mixed> $array2search, string $search_key, string $search_value, array<string|int, mixed> $return_array) : array<string|int, mixed>
multi-dimensional array in which the key/value pair may be present
key of the key/value pair used for search
value of the key/value pair to search
array to which the matching elements in the search array are pushed - also returned by function
$return_array
Temporary bypass access controls for a particular function
bypass_permissions(array<string|int, mixed> $perms, callable $f[, array<string|int, mixed> $p = array() ]) : mixed
When functions check for permissions internally, in order to keep backwards compatibility it may be better if we temporarily bypass the permissions instead of adding a parameter to the function for this. It will allow developers to keep the code clean.
IMPORTANT: never make this function public to the API.
Example code: $log = bypass_permissions(array("v"), "get_resource_log", array($ref));
Permission list to be bypassed
Callable that we need to bypas permissions for
Parameters to be passed to the callable if required
Set a system variable (which is stored in the sysvars table) - set to null to remove
set_sysvar(mixed $name[, mixed $value = null ][, bool $clear_cache = true ]) : bool
Variable name
String to set a new value; null to remove any existing value.
Set to false to skip the clearing of any cached values (default true).
Get a system variable (which is received from the sysvars table)
get_sysvar(string $name[, string $default = false ]) : string
Returned if no matching variable was found
Plugin architecture. Look for hooks with this name (and corresponding page, if applicable) and run them sequentially.
hook(string $name[, string $pagename = "" ][, array<string|int, mixed> $params = array() ][, bool $last_hook_value_wins = false ]) : mixed
Utilises a cache for significantly better performance. Enable $draw_performance_footer in config.php to see stats.
Performs a string replace once a text-only node is encountered, otherwise loops and calls itself to iterate over child nodes Not intended to be called directly - use html_find_and_replace
html_find_and_replace_node(string $findstring, string $replacestring, DOMNode $node) : void
can be blank if using for removal
Loads HTML fragment into a DOMDocument instance to parse and perform a recursive find/replace on text-only nodes.
html_find_and_replace(string $findstring, string $replacestring, string $html) : string
Returns modified HTML if possible, otherwise the original HTML.
can be blank if using for removal
Utility function to remove unwanted HTML tags and attributes.
strip_tags_and_attributes(string $html[, array<string|int, mixed> $tags = array() ][, array<string|int, mixed> $attributes = array() ]) : mixed
Note: if $html is a full page, developers should allow html and body tags.
HTML string
Extra tags to be allowed
Extra attributes to be allowed
Normally a string however if anything but a string is supplied, return type will be as supplied.
Remove paragraph tags from start and end of text.
strip_paragraph_tags(string $text) : string
Inner paragraph tags are untouched
HTML string
Returns the text without surrounding
and
tags.Helper function to quickly return the inner HTML of a specific tag element from a DOM document.
get_inner_html_from_tag(string $txt, string $tag) : string
Example usage: get_inner_html_from_tag(strip_tags_and_attributes($unsafe_html), "p");
HTML string
DOM document tag element (e.g a, div, p)
Returns the inner HTML of the first tag requested and found. Returns empty string if caller code requested the wrong tag.
Returns the page load time until this point.
show_pagetime() : string
Determines where the debug log will live. Typically, same as tmp dir (See general.php: get_temp_dir().
get_debug_log_dir() : string
Since general.php may not be included, we cannot use that method so I have created this one too.
Output debug information to the debug log, if debugging is enabled.
debug(string $text[, mixed $resource_log_resource_ref = null ][, string $resource_log_code = LOG_CODE_TRANSFORMED ]) : bool
Update the resource log if resource reference passed.
If updating the resource log, the code to use
Recursively removes a directory.
rcRmdir(string $path[, array<string|int, mixed> $ignore = array() ]) : bool
Directory path to remove.
List of directories to ignore.
Update the daily statistics after a loggable event.
daily_stat(string $activity_type, int $object_ref[, int $to_add = 1 ]) : void
The daily_stat table contains a counter for each 'activity type' (i.e. download) for each object (i.e. resource) per day.
Optional, how many counts to add, defaults to 1.
Returns the current page name minus the extension, e.g. "home" for pages/home.php
pagename() : string
pluginname() : string
Returns the site content from the language strings. These will already be overridden with site_text content if present.
text(string $name) : string
Gets a list of site text sections, used for a multi-page help area.
get_section_list(mixed $page) : array<string|int, mixed>
Returns a more friendly user agent string based on the passed user agent. Used in the user area to establish browsers used.
resolve_user_agent(mixed $agent) : string
The user agent string
Returns the current user's IP address, using HTTP proxy headers if present.
get_ip() : string
For a value such as 10M return the kilobyte equivalent such as 10240. Used by check.php
ResolveKB(mixed $value) : string
Trim a filename that is longer than 255 characters while keeping its extension (if present)
trim_filename(string $s) : string
Flip array keys to use one of the keys of the values it contains. All elements (ie values) of the array must contain the key (ie. they are arrays). Helper function to greatly increase search performance on huge PHP arrays.
array_flip_by_value_key(array<string|int, mixed> $a, string $k) : array<string|int, mixed>
Normal use is: array_flip_by_value_key($huge_array, 'ref');
IMPORTANT: make sure that for the key you intend to use all elements will have a unique value set.
Example: Result after calling array_flip_by_value_key($nodes, 'ref'); [20382] => Array ( [ref] => 20382 [name] => Example node [parent] => 20381 )
A values' key to use as an index/key in the main array, ideally an integer
Reshape array using the keys of its values. All values must contain the selected keys.
reshape_array_by_value_keys(array<string|int, mixed> $a, string $k, string $v) : array<string|int, mixed>
Array to reshape
The current elements' key to be used as the KEY in the new array. MUST be unique otherwise elements will be lost
The current elements' key to be used as the VALUE in the new array
Permission check for "j[ref]"
permission_j(int $ref) : bool
Featured collection category ref
Permission check for "-j[ref]"
permission_negative_j(int $ref) : bool
Featured collection sub-category ref
Delete temporary files
cleanup_files(array<string|int, mixed> $files) : void
array of file paths
Validate if value is integer or string integer
is_int_loose(mixed $var) : bool
true if variable resolves to integer value
Helper function to check if value is a positive integer looking type.
is_positive_int_loose(int|float|string $V) : bool
Value to be tested
Helper function to check if value is a positive or zero integer looking type.
is_positive_or_zero_int_loose(int|float|string $V) : bool
Value to be tested
Helper function to check if value is an array containing only positive or zero integer looking types
is_array_of_pos_or_zero_ints(mixed $var) : bool
value to be tested
Helper function to check if a value is able to be cast to a string
is_string_loose(mixed $var) : bool
value to be tested
Input (type) validation helper function for a list of integers (mostly used for IDs). This covers cases when the submitted data is either sent as an actual list (i.e. myInput[]) or when retrieved from the cookie/query string as a CSV.
is_input_list_loose(mixed $val) : bool
User input value to be validated
Helper function to check if a value is able to be cast to a float
is_float_loose(mixed $var) : bool
value to be tested
Does the provided $ip match the string $ip_restrict? Used for restricting user access by IP address.
ip_matches(string $ip, string $ip_restrict) : bool|int
Ensures filename is unique in $filenames array and adds resulting filename to the array
set_unique_filename(string &$filename, array<string|int, mixed> &$filenames) : string
Requested filename to be added. Passed by reference
Array of filenames already in use. Passed by reference
New filename
Build a specific permission closure which can be applied to a list of items.
build_permission(string $perm) : Closure
Permission string to build (e.g f-, F, T, X, XU)
Attempt to validate remote code.
validate_remote_code(string $code) : bool
IMPORTANT: Never use this function or eval() on any code received externally from a source that can't be trusted!
Remote code to validate
Get system status information
get_system_status([bool $basic = false ]) : array<string|int, mixed>
Optional, set to true to perform a quick "system up" check only.
Try and delete a file without triggering a fatal error
try_unlink(string $deletefile) : bool|string
Full path to file
Returns TRUE on success or a string containing error
try_getimagesize(string $filename[, mixed &$image_info = null ]) : mixed
Check filestore folder browseability.
check_filestore_browseability() : array<string|int, mixed>
For security reasons (e.g data breach) the filestore location shouldn't be indexed by the web server (in Apache2 - disable autoindex module)
Returns data structure with following keys:-
Check CLI version found for ImageMagick is as expected.
check_imagemagick_cli_version_found(string $version_output, array<string|int, mixed> $utility) : array<string|int, mixed>
The version output for ImageMagick
Utility structure. RS_SYSTEM_UTILITIES
Returns array as expected by the check.php page
Check CLI version found for Exiftool is as expected.
check_exiftool_cli_version_found(string $version_output, array<string|int, mixed> $utility) : array<string|int, mixed>
The version output for ImageMagick
Utility structure. RS_SYSTEM_UTILITIES
Returns array as expected by the check.php page
Check CLI numeric version found for a utility is as expected.
check_numeric_cli_version_found(string $version_output, array<string|int, mixed> $utility) : array<string|int, mixed>
The version output
Utility structure. RS_SYSTEM_UTILITIES
Returns array as expected by the check.php page
Check CLI version found for a utility is as expected by looking up for its name.
check_utility_cli_version_found_by_name(string $version_output, array<string|int, mixed> $utility, array<string|int, mixed> $lookup_names) : array<string|int, mixed>
The version output for the utility
Utility structure. RS_SYSTEM_UTILITIES
Returns array as expected by the check.php page
Check we're running on the command line, exit otherwise. Security feature for the scripts in /pages/tools/
command_line_only() : void
Helper function to quickly build a list of values, all prefixed the same way.
prefix_value(string $prefix) : Closure
$fieldXs = array_map(prefix_value('field'), [3, 88]);
Prefix value to prepend.
Utility function to check string is a valid date/time with a specific format.
validateDatetime(string $datetime[, string $format = 'Y-m-d H:i:s' ]) : bool
Date/time value
The format that date/time value should be in. https://www.php.net/manual/en/datetimeimmutable.createfromformat.php
string_ends_with(string $haystack, mixed $needle) : mixed
Value to be checked @param string $needle Substing to seach for in the haystack
@return bool True if the haystack ends with the needle otherwise false
Helper function to set the order_by key of an array to zero.
set_order_by_to_zero(array<string|int, mixed> $item) : array<string|int, mixed>
Same item with the order_by key zero.
Helper function to cast functions that only echo things out (e.g render functions) to string type.
cast_echo_to_string(callable $fn[, array<string|int, mixed> $args = [] ]) : string
Function to cast
Provide function's arguments (if applicable)
Helper function to parse input to a list of a particular type.
parse_csv_to_list_of_type(string $csv, callable $type) : array<string|int, mixed>
CSV of raw data
Function checking each CSV item, as required by your context, to determine if it should be allowed in the result set
Remove metadata field properties during execution lockout
execution_lockout_remove_resource_type_field_props(array<string|int, mixed> $rtf) : array<string|int, mixed>
Resource type field data structure
Returns without the relevant properties if execution lockout is enabled
Update global variable watermark to point to the correct file. Watermark set on System Configuration page will override a watermark set in config.php. config.default.php will apply otherwise (blank) so no watermark will be applied.
set_watermark_image() : void
DPI calculations
compute_dpi(mixed $width, mixed $height, mixed &$dpi, mixed &$dpi_unit, mixed &$dpi_w, mixed &$dpi_h) : mixed
MP calculation
compute_megapixel(int $width, int $height) : float
Get size info as a paragraphs HTML tag
get_size_info(array<string|int, mixed> $size[, array<string|int, mixed>|null $originalSize = null ]) : string
Preview size information
Original preview size information
Simple function to check if a given extension is associated with a JPG file
is_jpeg_extension(string $extension) : bool
File extension
Input validation helper function to check a URL is ours (e.g. if it's our base URL). Mostly used for redirect URLs.
url_starts_with(string $base, mixed $val) : bool
The value the URL is expected to start with. Due to the structure of a URL, you can also check for (partial) paths.
URL to check
Input validation helper function to check if a URL is safe (from XSS) in an HTML context.
is_safe_url(mixed $url) : bool
Sanitise URL for HTML rendering purposes.
sanitise_url(string $val) : string
ResourceSpace only works with absolute (via $baseurl) and relative root (via $baseurl_short) URLs.
Untrusted URL
Returns the provided value (URL) if considered safe, "#" otherwise.
Input validation helper function for sorting (ASC/DESC).
validate_sort_value(mixed $val) : bool
User input value to be validated
Input validation helper function for a CSV of integers (mostly used for IDs).
validate_digit_csv(mixed $val) : bool
User input value to be validated
Helper function to get an array of values with a subset of their original keys.
get_sub_array_with(array<string|int, mixed> $keys) : callable
Server side check to backup front end javascript validation.
enforceSharePassword(string $password) : void
Password supplied when creating or editing external share.
Helper function to call the JS CentralSpaceLoad().
js_call_CentralSpaceLoad(string $url) : never
Get expiration date of a given PEM certificate
getCertificateExpiry(string $cert) : string|bool
Certificate text
Expiry date. False if unable to parse certificate
Is the provided colour a valid CSS colour and therefore safe to display?
isValidCssColor(string $colour) : bool
True if a valid colour, false if not
Convert HSL to RGB.
hslToRgb(float $h, float $s, float $l) : array<string|int, mixed>
Hue (0-360).
Saturation (0-1).
Lightness (0-1).
Array with RGB values (0-255).
Check TinyMCE plugin list against an array of valid options The passed list is checked against TINYMCE_VALID_PLUGINS.
check_tinymce_plugins([string $plugins = "" ]) : string
The autoresize plugin is also included by default.
A comma-separated list of plugins for TinyMCE
The list of plugins with any invalid options removed
Check TinyMCE toolbar configuration to ensure it contains only alphanumeric characters, spaces and the pipe (|) symbol.
check_tinymce_toolbar([string $toolbar = "" ]) : string
The requested configuration for the toolbar
The configured toolbar with any invalid characters removed
Return the number of resources in the system that are not ingested into the filestore i.e. with 'file_path' set
get_non_ingested_resources() : int
Number of non-ingested resources in the system
Return URL of the application favicon
get_favicon_url() : string
Favicon URL
Determine what is a manually uploaded preview based off of data in the resource log
is_original_preview(int $ref) : bool
@param int $ref resource ID
returns true if a resource is using its original preview otherwise false.
Return the page title to use for the given page and optionally plugin.
get_page_title(string $page[, string $plugin = "" ]) : string
Page name without any leading filepath or trailing file extension.
Optional. Used to denote which plugin the page is part of.
If a language string is found, returns "%%APPLICATION_NAME%% - %%PAGENAME%%"; otherwise, returns "%%APPLICATION_NAME%%".
Log the bandwidth used by download.php
log_bandwidth(int $bandwidth_usage) : void
Strip Unicode points from a text value.
strip_unicode_points(string $value[, array<int, string> $blocklist = [] ]) : string
Text value subject
List of unicode points (e.g. \x{FEFF}), ranges allowed too (e.g. \x{200B}-\x{200D})
Strip any characters not present in the allow list. Mostly useful for search/indexing purposes where we care more about the words themselves and less about linking or any other type of characters.
allow_unicode_characters(string $text[, array<int, string> $allowlist = [] ]) : string
Initial text value
List of allowed characters. IMPORTANT: it's used to create a regex pattern.
Add or update the value used for paging for the current page to the list of stored pager cookies
set_per_page_cookie(int $per_page) : void
value to be stored
Retrieve the pager cookie for the current page.
get_per_page_cookie() : int
This function also clears the per_page and per_page_list cookies
Parse a comma-separated list of integers and integer ranges into a sorted array.
parse_int_ranges(string $input[, int $max_val = 0 ][, bool $optional = false ][, bool $allow_wildcard = false ]) : array<string|int, mixed>
Accepts input such as:
Comma-separated list of integers and/or ranges (e.g. "1,3-5,10")
Optional upper bound for allowed values. Use 0 for no limit
If true, an empty input string is allowed. If false, empty input is an error
If true, an asterisk can be used as a wildcard (e.g * for all, 10-* for 10 and above)
ok: bool True when parsing succeeds, false when any validation error occurs numbers: int[] Sorted list of unique integers when ok is true and allow_wildcard is false, otherwise empty errors: string[] List of error messages when ok is false, otherwise empty
Build a SQL WHERE fragment and bound parameters from a list of integers and ranges.
build_range_where_condition(string $input, string $field[, int $max_val = 0 ][, bool $allow_wildcard = false ]) : array<string|int, mixed>
Parses a comma-separated input string containing single integers and/or ranges and can take optional wildcards (e.g. "1,3-5,10,12-*") Converts each item into a parameterized SQL condition:
All generated conditions are joined using OR and wrapped in parentheses. Parameters are returned in the order they appear in the WHERE fragment.
Comma-separated list of integers and/or ranges (e.g. "1,3-5,10")
Database column name to use in the generated SQL expressions
Optional upper bound for allowed values. Use 0 for no limit
If true, an asterisk can be used as a wildcard (e.g * for all, 10-* for 10 and above)
ok: bool True when the WHERE clause is successfully built, false on validation errors where: string|null Parenthesized SQL fragment joined with OR when ok is true, otherwise null params: array Ordered list of bind types and values errors: string[] List of error messages when ok is false, otherwise empty
Get an array of all the canvases for the identifier ready for JSON encoding
iiif_get_canvases(int $identifier, array<string|int, mixed> $iiif_results[, bool $sequencekeys = false ]) : array<string|int, mixed>
IIIF identifier (this associates resources via the metadata field set as $iiif_identifier_field
Array of ResourceSpace search results that match the $identifier, sorted
Get the array with each key matching the value set in the metadata field $iiif_sequence_field. By default the array will be sorted but have a 0 based index
Get thumbnail information for the specified resource id ready for IIIF JSON encoding
iiif_get_thumbnail(int $resourceid) : array<string|int, mixed>
Resource ID
Get the image for the specified identifier canvas and resource id
iiif_get_image(int $identifier, int $resourceid, string $position, array<string|int, mixed> $size_info) : array<string|int, mixed>
IIIF identifier (this associates resources via the metadata field set as $iiif_identifier_field
Resource ID
The canvas identifier, i.e position in the sequence. If $iiif_sequence_field is defined
Handle a IIIF error.
iiif_error([int $errorcode = 404 ][, array<string|int, mixed> $errors = array() ]) : void
The error code
An array of errors
is_power_of_two(int $x) : bool
Upload a file from the provided path to the given resource
upload_file(int $ref[, bool $no_exif = false ][, bool $revert = false ][, bool $autorotate = false ][, string $file_path = "" ][, bool $after_upload_processing = false ][, bool $deletesource = true ]) : bool
Resource ID
Do not extract embedded metadata. False by default so data will be extracted
Delete all data and re-extract embedded data
Autorotate images - alters embedded orientation data in uploaded file
Path to file
Set to true will create an offline job to process the file
Delete resource after upload
Extract and process EXIF, IPTC, and FITS metadata for a resource.
extract_exif_comment(int $ref[, string $extension = "" ]) : bool
This function retrieves metadata from an image file, including EXIF, IPTC, and FITS metadata,
and updates the corresponding fields in the database. The process includes support for embedded
geolocation data, handling character encoding, and applying user-configurable options for specific fields.
If ExifTool is available, it is used for more comprehensive metadata extraction. Otherwise, the PHP
exif_read_data function is used as a fallback.
The resource reference ID.
(optional) The file extension for the image, used to validate processing compatibility.
Returns false if the file does not exist; true on successful completion
Convert IPTC metadata text to UTF-8 encoding.
iptc_return_utf8(string $text) : string
This function attempts to detect the character encoding of IPTC metadata text and converts it to UTF-8. If conversion is not possible due to missing libraries or if the encoding is unknown, the text is returned as-is. It uses a predefined list of character encodings for the conversion attempts.
The IPTC metadata text to be converted.
The converted text in UTF-8 encoding, or the original text if conversion fails.
Generate previews for a resource, including thumbnails and alternative image sizes.
create_previews(int $ref[, bool $thumbonly = false ][, string $extension = "jpg" ][, bool $previewonly = false ][, bool $previewbased = false ][, int $alternative = -1 ][, bool $ignoremaxsize = false ][, bool $ingested = false ][, bool $checksum_required = true ][, array<string|int, mixed> $onlysizes = array() ][, bool $no_tiles = false ]) : bool
This function creates or updates image previews for a resource, such as thumbnails, based on the specified parameters. It supports a variety of configurations, including resizing with ImageMagick or GD library, generating checksums, and setting file attributes. If the file size exceeds a specified limit, it can queue the preview generation as an offline job.
The resource ID for which previews are generated.
(optional) If true, only the thumbnail will be generated. Default is false.
(optional) The file extension for the resource. Default is "jpg".
(optional) If true, only preview images will be generated. Default is false.
(optional) If true, previews are generated based on existing previews rather than original files. Default is false.
(optional) If set, specifies an alternative file ID to generate previews for. Default is -1.
(optional) If true, the file size limit for preview generation is ignored. Default is false.
(optional) If true, marks the resource as already ingested into the system. Default is false.
(optional) If true, generates a checksum for the file. Default is true.
(optional) Specifies an array of preview sizes to generate. If empty, all sizes are generated.
(optional) Set to true to prevent creation of preview tiles (if enabled). Tiles would not be created where the preview source is a file created by preview_preprocessing.php.
Returns true if previews were generated successfully; false otherwise.
Calculate and update the mean color values for a resource image.
extract_mean_colour(GdImage $image, int $ref) : void
Calculate and update the mean color values for a resource image.
This function calculates the mean red, green, and blue color values for a given image by sampling pixels in a grid pattern. It adjusts for brightness and excludes grayscale pixels to determine the dominant colors. Additionally, it updates the thumbnail dimensions and color key in the resource record.
The image resource to analyze for mean color.
The resource ID for which the color data is updated.
Update the portrait or landscape orientation field for a resource.
update_portrait_landscape_field(int $ref[, resource|null $image = null ]) : void
This function determines whether a resource image is in portrait, landscape, or square orientation and updates the specified field accordingly. If no image resource is provided, it attempts to load the thumbnail image for the resource.
The resource ID to update.
(optional) An image resource for orientation analysis. If not provided, the function will load the resource thumbnail.
Generate a color key for an image based on dominant colors.
get_colour_key(GdImage $image) : string
This function extracts a color key that represents the dominant colors in an image, similar to a soundex code for colors. It maps the colors in the image to predefined color categories (e.g., black, white, red, etc.), calculates the closest match for each sampled pixel, and returns a five-character color key based on the most frequent colors.
The image resource to analyze.
A five-character string representing the dominant colors in the image.
Apply rotation and gamma adjustments to all preview images of a resource.
tweak_preview_images(int $ref, int $rotateangle, float $gamma[, string $extension = "jpg" ][, int $alternative = -1 ][, string $resource_ext = "" ]) : bool
This function adjusts the preview images of a resource by rotating or applying gamma correction. It primarily modifies the screen resolution preview, then scales and updates other preview sizes accordingly. For video resources, it also rotates snapshot images. Updates to rotation and gamma values are recorded in the database to allow future reconstruction of adjustments.
The resource ID for which previews are tweaked.
The angle in degrees to rotate the preview images.
The gamma correction factor (values > 1 to lighten, values < 1 to darken).
(optional) The file extension for the preview images. Default is "jpg".
(optional) The ID of an alternative file to tweak previews for. Default is -1.
(optional) The file extension of the original resource, used for video snapshot rotation.
Returns false if the main preview file does not exist; otherwise, updates previews and returns true.
Apply rotation and gamma adjustments to all watermarked preview images of a resource.
tweak_wm_preview_images(int $ref, int $rotateangle, float $gamma[, string $extension = "jpg" ][, int $alternative = -1 ]) : bool
This function modifies watermarked preview images by applying a specified rotation angle and gamma correction factor. Each preview size defined in the database is processed, adjusting the watermarked version accordingly. The function resizes and updates each adjusted preview image.
The resource ID for which watermarked previews are tweaked.
The angle in degrees to rotate the watermarked preview images.
The gamma correction factor to apply (values > 1 to lighten, values < 1 to darken).
(optional) The file extension for the preview images. Default is "jpg".
(optional) The ID of an alternative file to tweak previews for. Default is -1.
Returns false if a watermarked file does not exist; otherwise, updates previews and returns true.
Rotate an image resource by a specified angle without using built-in rotation functions.
AltImageRotate(GdImage $src_img, int $angle) : resource
This function manually rotates an image resource by 90, -90, or 180 degrees, creating a new image with the rotated pixels. If the angle is not one of these specified values, the original image is returned unmodified.
The source image resource to rotate.
The angle in degrees to rotate the image (90, -90, or 180).
The rotated image resource, or the original if the angle is unsupported.
Convert a base64-encoded image to a JPEG file.
base64_to_jpeg(string $imageData, string $outputfile) : void
This function decodes a base64-encoded image string and saves it as a JPEG file.
The base64-encoded image data.
The path to save the decoded JPEG file.
Extracts JPG previews from INDD files when these have been set with a preview Note: it requires ExifTool >= 9.50
extract_indd_pages(string $filename) : array<string|int, mixed>|bool
Generate or update the checksum for a resource file.
generate_file_checksum(int $resource, string $extension[, bool $anyway = false ]) : bool
This function calculates a unique checksum for a specified resource file. It either generates the checksum based on file contents and updates the resource record, or clears any existing checksum if the file does not exist. It also sets metadata indicating the checksum's last verification date and integrity status.
The ID of the resource for which the checksum is generated.
The file extension of the resource.
(optional) If true, forces checksum generation regardless of configuration settings.
Returns true if the checksum was generated; false if the file does not exist or was not generated.
Clear the checksum value for a specified resource.
clear_file_checksum(int $resource) : bool
The ID of the resource to clear the checksum for.
Returns true if the checksum was cleared successfully; false if the resource ID is invalid.
Check for duplicate files based on checksum.
check_duplicate_checksum(string $filepath, int $replace_resource) : array<string|int, mixed>
This function calculates the checksum of a file and checks if any existing resources have the same checksum, indicating a possible duplicate. If a duplicate is found and the resource is not marked for replacement, the function returns the list of duplicate resource IDs.
The file path of the file to check.
The resource ID to replace, if applicable, to avoid detecting it as a duplicate.
An array of duplicate resource IDs, or an empty array if no duplicates are found.
Upload and generate previews for a resource.
upload_preview(int $ref) : bool
This function uploads a user-provided preview image for a specified resource, ensuring the file is in JPEG format. After moving the file to its temporary location, it generates previews and cleans up the temporary file if not in use for transcoding.
The resource ID for which the preview is uploaded.
Returns true if the preview upload and processing are successful, false if the file is not in JPEG format.
Extract text from the resource and save to the configured field
extract_text(int $ref, string $extension[, string $path = "" ]) : bool
Resource ref
File extension
Path can be set to use an alternate file, for example, in the case of unoconv
Returns false on error else true.
Get the orientation of an image file using ExifTool.
get_image_orientation(string $file) : int
This function retrieves the orientation metadata of an image file. If orientation information is not available, it attempts to retrieve the rotation metadata. The function uses ExifTool for the extraction and processes the result to return the orientation angle in degrees.
The path to the image file.
The orientation angle in degrees (0, 90, 180, 270), or 0 if no orientation information is available.
Automatically rotate an image based on its orientation metadata.
AutoRotateImage(string $src_image[, int|bool $ref = false ]) : bool
This function uses ImageMagick to rotate an image to the correct orientation. If the image's orientation is determined using ExifTool, the function will rotate the image accordingly. It preserves custom metadata when applicable.
The path to the source image that needs to be rotated.
The resource ID for the image; used to fetch orientation data if needed.
Pass false if no resource ID is available.
Returns true if the image was successfully rotated and saved, or false on failure.
Provides ability to extract the ICC profile for a specified resource/ alternative file
extract_icc_profile(int $ref, string $extension[, int $alternative = -1 ]) : bool
Resource ref
Extension of the file
Resource alternative ref. Default -1 as per get_resource_path() defintion
Extracts the ICC profile from an image file using ImageMagick.
extract_icc(string $infile[, string $ref = '' ]) : bool
This function attempts to extract the ICC profile from the specified image file and saves it as a
separate file with the .icc extension. It checks if the ICC profile already exists and will
remove it before extraction. The function is compatible with both Windows and non-Windows
environments.
The path to the input image file from which to extract the ICC profile.
Optional. The resource ID associated with the image file. Used to determine the output path for the extracted ICC profile.
Returns true if the ICC profile was successfully extracted and saved, or false on failure.
Retrieves the version of ImageMagick installed on the system.
get_imagemagick_version([bool $array = true ]) : mixed
This function checks the version of ImageMagick by executing the convert command.
It can return the version information as either an array or a string, depending on the
value of the $array parameter.
Optional. If set to true, the function returns an array containing the major, minor, revision, and patch version numbers. If false, it returns a version string in the format "major.minor.revision-patch".
Returns an array with version numbers if $array is true, a version string if false, or false if ImageMagick is not installed or the version cannot be determined.
Function used to get new width & height for an image in order to maintain aspect ratio while it will fit within a desired dimension.
calculate_image_dimensions(string $image_path, int $target_width, int $target_height[, bool $enlarge_image = false ]) : array<string|int, mixed>
The full path to the image (can be physical / URL)
Specify whether images smaller than our target should be enlarged or not. Default is FALSE
New dimensions which can be used to resize the image and offset values client code can use for consistent visual display
Upload file from a URL and add it to a resource.
upload_file_by_url(int $ref[, bool $no_exif = false ][, bool $revert = false ][, bool $autorotate = false ][, string $url = "" ][, string $key = "" ]) : bool
Resource ID
=false Don't extract exif data - true to disable extraction
=false Delete all data and re-extract embedded data
=false Autorotate images - alters embedded orientation data in uploaded file
="" File URL
="" Optional key to distinguish betweeen simultaneous requests from same user with same filename
Delete all preview files for specified resource id or resource data array
delete_previews(mixed $resource[, mixed $alternative = -1 ]) : mixed
array|integer Resource array or resource ID to delete preview files for
Get dimensions of image file
getFileDimensions(string $identify_fullpath, string $prefix, string $file, string $extension) : array<string|int, mixed>
path to IM identify command
prefix - used by camera RAW files
path to file
file extension
width and height of image, elements are null if not possible e.g. not an image file
Get SVG size by reading the file and looking for dimensions at either width and height OR at Viewbox attribute(s)
getSvgSize(string $file_path) : array<string|int, mixed>
Path to SVG file (should work with both a physical path and a URL)
where first element is width and second is height represented as strings
Convert SVG length/width dimension to px size at 96DPI
convertSvgLengthToPx(string $length) : int|null
dimension to be converted
dimension in pixels, or null if cannot be converted
Replace preview image with preview image from another resource/alternaive file
replace_preview_from_resource(int $ref, int $previewresource, int $previewalt) : bool
Resource to replace preview image for
Preview source resource ref
Preview source resource alternative ref
Get the source file to use for creating a preview
get_preview_source_file(int $ref, string $extension, bool $previewonly, bool $previewbased, int $alternative, bool $ingested) : string
Resource ID
Resource extension
Create previews only
Use existing preview as source
Alternative file reference
Has file been ingested?
Compute image tile regions based on a scale factor.
compute_tiles_at_scale_factor(int $sf, int $sw, int $sh) : array<string|int, mixed>
IMPORTANT: Please note that the origin position (0,0) is the upper left-most pixel of the image
Scale factor
Source image width
Source image height
Returns array of tile data:
Perform the requested action on the original file to create a new file
transform_file(string $sourcepath, string $outputpath, array<string|int, mixed> $actions) : bool
Path to source file
Array of actions to perform
Image created successfully?
For a given resource reference, remove the video pre size and all snapshots.
remove_video_previews(int $resource) : void
Resource to remove video previews.
Create preview sizes via create_previews() and/or generate jobs as necessary
start_previews(int $ref[, string $extension = "" ]) : int
Resource ID
File extension
0 Preview creation failed 1 All previews have been created 2 Minimal previews created and offline jobs/scripts are required to create the full set of previews/image/video $alternatives
Get an array of preview size IDs to generate
get_sizes_to_generate(string $extension, array<string|int, mixed> $dimensions[, bool $thumbonly = false ][, bool $previewonly = false ][, array<string|int, mixed> $onlysizes = [] ][, bool $no_tiles = false ]) : array<string|int, mixed>|bool
File extension ('hpr' is only required for non-JPG images)
Image source dimensions in format [width,height]
Generate 'thm' and 'col' only
Generate 'scr', 'pre', 'thm' and 'col' only
Array of requested size IDs to generate
Set to true to prevent creation of preview tiles (if enabled). Tiles would not be created where the preview source is a file created by preview_preprocessing.php.
Array of size IDs or false on failure.
Generates alternative image files for a specified resource.
create_image_alternatives(int $ref, array<string|int, mixed> $params[, bool $force = false ]) : bool
This function checks the existing alternative files and creates new ones based on the specified parameters. It can also force the creation of alternatives even if they already exist. It uses ImageMagick to process the images according to the specified configurations.
The resource ID for which alternatives are being generated.
An associative array containing the following keys:
Optional. If set to true, will force the generation of alternative files even if they exist.
Returns true if alternatives were generated successfully, false otherwise.
Input validation helper function for ImageMagick's color values (e.g. blue, #ddddff and rgb(255,255,255))
is_valid_imagemagick_color(string $val) : bool
With $icc_extraction enabled, determine whether we should apply the icc profile that has been found.
can_apply_icc_profile(string $original_file_path) : bool
Note: This doesn't prevent ICC profile extraction.
Path to the original file from which the ICC profile was extracted.
Check if system is using ICC profiles and prepare ImageMagick command for use by transform_file() to enable system wide configuration for $icc_extraction to be applied when transforming a file, such as by format chooser or image tools.
transform_apply_icc_profile(int $ref, string $original_file_path) : array<string|int, mixed>
Resource id.
Path to the original file for the resource.
Generate previews for a resource using ImageMagick.
create_previews_using_im(int $ref[, bool $thumbonly = false ][, string $extension = "jpg" ][, bool $previewonly = false ][, bool $previewbased = false ][, int $alternative = -1 ][, bool $ingested = false ][, array<string|int, mixed> $onlysizes = [] ][, bool $no_tiles = false ]) : bool
This function creates image previews for a resource by leveraging ImageMagick to handle resizing and generating thumbnails, medium, large, and custom-sized previews. It provides flexible options to control the generation process, such as limiting previews to specific sizes, applying watermarks, handling color profiles, and managing alternative files. The function includes extensive support for non-standard image formats and configurations.
The resource ID for which previews are generated.
(optional) If true, only the thumbnail will be generated. Default is false.
(optional) The file extension for the resource. Default is "jpg".
(optional) If true, only preview images will be generated. Default is false.
(optional) If true, previews are generated based on existing previews rather than original files. Default is false.
(optional) Specifies an alternative file ID to generate previews for, if any. Default is -1.
(optional) If true, marks the resource as already ingested into the system. Default is false.
(optional) Specifies an array of preview sizes to generate. If empty, all sizes are generated.
(optional) Set to true to prevent creation of preview tiles (if enabled). Tiles would not be created where the preview source is a file created by preview_preprocessing.php.
Returns true if previews were generated successfully; false otherwise.
Adds a job to the job_queue table.
job_queue_add([string $type = "" ][, array<string|int, mixed> $job_data = array() ][, string $user = "" ][, string $time = "" ][, string $success_text = "" ][, string $failure_text = "" ][, string $job_code = "" ][, int $priority = null ]) : string|int
ID of newly created job or error text
Update the data/status/time of a job queue record.
job_queue_update(int $ref[, array<string|int, mixed> $job_data = array() ][, string $newstatus = "" ][, string $newtime = "" ][, mixed $priority = null ]) : void
Delete a job queue entry if user owns job or user is admin
job_queue_delete(mixed $ref) : void
Gets a list of offline jobs
job_queue_get_jobs([string $type = "" ][, string $status = -1 ][, int $user = "" ][, string $job_code = "" ][, string $job_order_by = "priority" ][, string $job_sort = "asc" ][, string $find = "" ][, bool $returnsql = false ][, int $maxjobs = 0 ][, bool $overdue = false ][, array<string|int, mixed> $find_by_job_ref = [] ]) : mixed
Job type, can be a comma separated list of job types
Job status - see definitions.php
Job user
Unique job code
Column to order by - default is priority
Sort order - ASC or DESC
Search jobs for this string
Return raw SQL
Maximum number of jobs to return
Only return overdue jobs?
Find queued jobs by their ref
Resulting array of requests or an SQL query object
Get details of specified offline job
job_queue_get_job(mixed $ref) : array<string|int, mixed>
Delete all jobs in the specified state
job_queue_purge([int $status = 0 ]) : void
to purge, whole queue will be purged if not set
Run offline job
job_queue_run_job(array<string|int, mixed> $job, bool $clear_process_lock) : string
Metadata of the queued job as returned by job_queue_get_jobs()
Clear process lock for this job
'Process lock', 'Error' or 'Complete'.
Get the default priority for a given job type
get_job_type_priority([string $type = "" ]) : int
Name of job type e.g. 'collection_download'
Build and ensure a writable log file path for a queued job
get_job_queue_log_path([string $type = "" ][, string $job_code = "" ][, string $job_ref = "" ]) : string|false
Job category or queue type used as a subdirectory name
Job identifier used in the log filename
Job reference value used in the log filename
Full path to the log file on success, or false on failure
Resolve a queued job reference to its corresponding log file path
get_job_queue_log_path_by_ref([int $job_ref = 0 ]) : string|false
Job reference
Full path to the job log file on success, or false on failure
Scan a log file from the end and return the most recent line matching a pattern.
get_job_progress_from_log_file([string $path = "" ][, string $pattern = "/\\[PROGRESS\\]/i" ][, int $block_size = 65536 ]) : array<string|int, mixed>
The file is read in fixed-size blocks starting from EOF and scanned backwards line-by-line for the first line that matches the supplied regular expression (by default, lines containing "[PROGRESS]").
On the first read pass, the function also captures the last non-empty line in the file (closest to EOF), regardless of whether it matches the pattern.
Path to the log file to scan
Regular expression used to match progress lines
Number of bytes to read per backward scan iteration
found: string|null The most recent line matching $pattern, or null if none found or if the file could not be read last_line: string|null The last non-empty line in the file, or null if unavailable
Determine whether the current user is allowed to manually trigger background jobs.
job_trigger_permission_check() : bool
The system must have config $offline_job_queue set to true and the user must have 'a', 'f*', 't' and 'v' permissions as well as edit access to all workflow states.
true if the user satisfies all required permissions and workflow access, false otherwise
Determine whether a job type is user triggerable.
triggerable_job_check([string $type = "" ]) : bool
This can stop system jobs from creating unnecessary log files.
true if job is user triggerable, so logging is allowed
update_preview(mixed $ref, mixed $previewbased, mixed $sizes, mixed $delete_existing) : mixed
Translates field names / values using two methods: First it checks if $text exists in the current $lang (after $text is sanitized and $mixedprefix - one by one if an array - and $suffix are added). If not found in the $lang, it tries to translate $text using the i18n_get_translated function.
lang_or_i18n_get_translated(string $text, string $mixedprefix[, string $suffix = "" ]) : string
For field names / values using the i18n syntax, return the version in the current user's language. Format is ~en:Somename~es:Someothername
i18n_get_translated(string|null $text[, string|null $lang_domain = null ]) : string
As an optional fallback if an i18n string is not provided, check the system language translations for a matching translation instead.
Translates collection names
i18n_get_collection_name(mixed $mixedcollection[, string $index = "name" ]) : string
For field names / values using the i18n syntax, return all language versions, as necessary for indexing.
i18n_get_indexable(string $text) : string
The text to process
For a string in the language format, return all translations as an associative array E.g. "en"->"English translation"; "fr"->"French translation"
i18n_get_translations(string $value) : array<string|int, mixed>
A string in the language format
Returns a string with all occurrences of the $mixedplaceholder in $subject replaced with the $mixedreplace.
str_replace_formatted_placeholder(mixed $mixedplaceholder, mixed $mixedreplace, mixed $subject[, mixed $question_mark = false ][, string $separator = ", " ]) : string
If $mixedplaceholder is a string but $mixedreplace is an array, the $mixedreplace is imploded to a string using $separator. The replace values are formatted according to the formatting of the placeholders. The placeholders may be written in UPPERCASE, lowercase or Uppercasefirst. Each placeholder will be replaced by the replace value, written with the same case as the placeholder. It's possible to also include "?" as a placeholder for legacy reasons.
Example #1: str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["originalfileoftype"], true) will search for the three words "%EXTENSION", "%extension" and "%Extension" and also the char "?" in the string $lang["originalfileoftype"]. If the found placeholder is %extension it will be replaced by the value of $resource["file_extension"], written in lowercase. If the found placeholder instead would have been "?" the value would have been written in UPPERCASE.
Example #2: str_replace_formatted_placeholder("%resourcetypes%", $searched_resource_types_names_array, $lang["resourcetypes-collections"], false, $lang["resourcetypes_separator"]) will search for the three words "%RESOURCETYPES%", "%resourcetypes%" and "%Resourcetypes%" in the string $lang["resourcetypes-collections"]. If the found placeholder is %resourcetypes% all elements in $searched_resource_types_names_array will be written in lowercase and separated by $lang["resourcetypes_separator"] before the resulting string will replace the placeholder.
Returns a string with the first LETTER of $string capitalized.
ucfirstletter(mixed $string) : string|array<string|int, mixed>|null
Compare with ucfirst($string) which returns a string with first CHAR of $string capitalized: ucfirstletter("abc") / ucfirstletter("%abc") returns "Abc" / "%Abc" ucfirst("abc") / ucfirst("%abc") returns "Abc" / "%abc"
Search for the first letter ([a-zA-Z]), which may or may not be followed by other characters (.*). Replaces the found substring ('$0') with the same substring but now with the first character capitalized, using ucfirst(). Note the /e modifier: If this modifier is set, preg_replace() does normal substitution of backreferences in the replacement string, evaluates it as PHP code, and uses the result for replacing the search string.
Callback used by ucfirstletter
ucfirstletter_callback(array<string|int, mixed> $matches) : void
Normalize the text if function available
normalize_keyword(string $keyword[, bool $user_language = false ]) : string
Keyword to normalize
Flag to enable normalizing based on the current user language. Some languages consider characters with accents to be different characters and therefore order them after z and other consider them to be the same as the character without the accent. See https://www.php.net/manual/en/class.normalizer.php for more information
Normalized keyword
This function and seems_utf8 are reused from WordPress. See documentation/licenses/wordpress.txt for license information
remove_accents(string $string) : string
Converts all accent characters to ASCII characters.
If there are no accent characters, then the string given is just returned.
Text that might have accent characters
Filtered string with replaced "nice" characters.
Looks for particular patterns to attempt to determine if the provided string is in UTF8 format
seems_utf8(string $str) : bool
True if it's possibly UTF8
Use the browser settings to determine the default / preferred language
http_get_preferred_language([bool $strict_mode = false ]) : string
The language string the user may prefer
Set the user's current language based on get/post/cookie values as appropriate.
setLanguage() : string
The language string set
Load all site text for the given page and language into the global $lang array
lang_load_site_text(array<string|int, mixed> &$lang, string $pagename[, string $language = "" ]) : void
Passed by reference
Pagename
Language
Return an array of all available language strings for the given id, with the language code as the key
i18n_get_all_translations(string $langid) : array<string|int, mixed>
The identifier of the lang string
Merge values for across multiple translation strings.
i18n_merge_translations(array<string|int, mixed> $values) : array<string|int, mixed>
Where a value is missing for a language used elsewhere i18n_get_translated will be used. If no value is provided and no English (en) string is found then blank will be returned.
Example input: ["~en:cheese~fr:fromage","~en:bread~fr:pain"]
Example output: ["~en:cheese, bread","~fr:fromage, pain"]
Translation strings to merge.
Each language string as a comma separated list.
Get the name of a language in your own language plus its native name.
get_display_language(string $language_key, string $language_value) : string
Used for language selection dropdowns.
Key of $languages array, e.g. "fr"
The value (full name) from the $languages array, e.g. "Français"
Simple check to determine if the text string supplied contains i18n language translations.
is_i18n_language_string(string $text) : bool
Returns true if match found e.g. '~en:test~en-US:test'. Returns false if no code is found. e.g. 'test'.
Text string to check e.g. a node name or field value.
Log activity in the system (e.g user deleted a user)
log_activity([string $note = null ][, string $log_code = LOG_CODE_UNSPECIFIED ][, string $value_new = null ][, string $remote_table = null ][, string $remote_column = null ][, string $remote_ref = null ][, string $ref_column_override = null ][, string $value_old = null ][, string $user = null ][, bool $generate_diff = false ]) : void
Notes/comments regarding this activity
User that ran the activity
Log script messages on screen and optionally in a file. If debug_log is enabled, it will also write the message in the debug log file.
logScript(string $message[, resource $file = null ]) : void
Retrieve entries from resource log based on date or references
resource_log_last_rows([int $minref = 0 ][, int $days = 7 ][, int $maxrecords = 0 ][, array<string|int, mixed> $fields = [] ][, array<string|int, mixed> $log_codes = [] ]) : array<string|int, mixed>
(Optional) Minimum ref of resource log entry to return (default 0)
(Optional) Number of days to return. e.g 3 = all results for today, yesterday and the day before. Default = 7 (ignored if minref supplied)
(Optional) Maximum number of records to return. Default = all rows (0)
(Optional) Limit results to particular metadata field(s)
(Optional) Limit results to particular log code(s)
Get activity log entries from log tables (e.g activity_log, resource_log and collection_log)
get_activity_log(string $search, int $offset, int $rows, array<string|int, mixed> $where_statements, string $table, int $table_reference[, bool $count = false ]) : array<string|int, mixed>|int
Search text to filter down results using fuzzy searching
Specifies the offset of the first row to return
Specifies the maximum number of rows to return
Where statements for log tables
Example of where statements:
$where_statements = array(
'activity_log' => "activity_log.user='{$actasuser}' AND ",
'resource_log' => "resource_log.user='{$actasuser}' AND ",
'collection_log' => "collection_log.user='{$actasuser}' AND ",
);
Table name (e.g resource_type_field, user, resource)
ID of the record in the referred table
Switch for if the result should be a single count or the result set
Use resource log to obtain a count of resources downloaded by the specified user in the last X days
get_user_downloads(int $userref, int $user_dl_days) : int
User reference
The number of days to check the resource log for
download count
Add detail of node changes to resource log
log_node_changes(int $resource, array<string|int, mixed> $nodes_new, array<string|int, mixed> $nodes_current[, string $lognote = "" ][, array<string|int, mixed> $nodes_renamed = [] ]) : bool
Note that this function originally required only the added and removed nodes to be passed. This was prior to node reversion changes, which requires the logging of all the existing resource nodes
Resource ID
Array of new node IDs
Array of old node IDs
Optional note to add to log entry
Optional array of old node names with node id as key e.g. [345 => 'oldname',678 => "pastname"]
Success/failure
Log search events
log_search_event(string $search, array<string|int, mixed> $resource_types, array<string|int, mixed> $archive_states, int $result_count) : void
Actual search string do_search()
Resource types filter
Archive states filter
Search result count
Generate a fingerprint which could then be used as a trace ID for event correlation purposes.
generate_trace_id(array<string|int, mixed> $components) : string
Data making up our fingerprint.
Return sum of activity from the daily_stat table for the past month for a given activity_type.
daily_stat_past_month_by_activity(string $activity_type) : int
Sum of activity for the requested type.
Performs the login using the global $username, and $password. Since the "externalauth" hook is allowed to change the credentials later on, the $password_hash needs to be global as well.
perform_login([mixed $loginuser = "" ][, mixed $loginpass = "" ]) : array<string|int, mixed>
Containing the login details ('valid' determines whether or not the login succeeded).
Generates a unique session hash for user authentication.
generate_session_hash(string $password_hash) : string
This function creates a session hash based on either a completely randomized method or a method that combines a password hash with the current date. It ensures that the generated hash is unique by checking against existing sessions in the database.
The hashed password of the user, used for generating the session hash.
Returns a unique session hash.
Set login cookies
set_login_cookies(int $user, string $session_hash[, string $language = "" ][, bool $user_preferences = true ]) : void
User ref
User session hash
Language code (e.g en)
Set colour theme from user preferences
ResourceSpace password hashing
rs_password_hash(string $password) : string|false
Password
Password hash or false on failure
ResourceSpace verify password
rs_password_verify(string $password, string $hash, array<string|int, mixed> $data) : bool
Password
Password hash
Extra data required for matching hash expectations (e.g username, impersonate_user). Key is the variable name, value is the actual value for that variable.
Helper function to get the password hash information (algorithm and options) from the global scope.
get_password_hash_info() : array<string|int, mixed>
Generates OpenStreetMap basemaps for use in a Leaflet map.
leaflet_osm_basemaps() : string
This function defines various tile layers from OpenStreetMap and related providers, setting properties such as caching, retina display support, maximum zoom levels, and attribution for each layer.
JavaScript code that initializes the OSM basemaps for Leaflet.
Generates ESRI basemaps for use in a Leaflet map.
leaflet_esri_basemaps() : string
This function defines various tile layers from ESRI, setting properties such as caching, retina display support, maximum zoom levels, and attribution for each layer.
JavaScript code that initializes the ESRI basemaps for Leaflet.
leaflet_stamen_basemaps() : mixed
Generates Hydda basemaps for use in a Leaflet map.
leaflet_hydda_basemaps() : string
JavaScript code that initializes the Hydda basemaps for Leaflet.
Generates NASA basemaps for use in a Leaflet map.
leaflet_nasa_basemaps() : string
JavaScript code that initializes the NASA basemaps for Leaflet.
Generates USGS basemaps for use in a Leaflet map.
leaflet_usgs_basemaps() : string
JavaScript code that initializes the USGS basemaps for Leaflet.
Generates Thunderforest basemaps for use in a Leaflet map.
leaflet_thunderforest_basemaps() : string
JavaScript code that initializes the Thunderforest basemaps for Leaflet.
leaflet_mapbox_basemaps() : mixed
Generates Mapbox basemaps for use in a Leaflet map.
leaflet_map_zoom(mixed $map_zoom) : string
This function initializes a Mapbox tile layer, requiring an API ID and access token. It also allows configuration for caching, retina display support, and attribution.
JavaScript code that initializes the Mapbox basemap for Leaflet.
Parses the resource polygon string to extract latitude and longitude bounds and formats the polygon string.
leaflet_polygon_parsing(array<string|int, mixed> $fields[, bool $minmax = true ]) : array<string|int, mixed>
The resource fields array containing polygon data.
Flag to determine if minimum and maximum latitude and longitude values should be calculated.
An associative array containing the minimum and maximum latitude and longitude values, as well as the formatted polygon string for Leaflet display.
Validates geolocation coordinates to ensure they are numeric and within acceptable bounds.
leaflet_coordinate_check(mixed $coordinate, string $type) : bool
The coordinate value to check.
The type of coordinate ('latitude' or 'longitude').
True if the coordinate is valid; otherwise, false.
Creates a map color markers legend for Leaflet maps.
leaflet_markers_legend() : void
This function generates HTML for a legend that displays markers with colors corresponding to resource types or custom metadata field values. If a custom metadata field is defined, the legend reflects that; otherwise, it shows the default resource types and their associated colors.
Outputs the HTML for the legend.
Adds map providers for Leaflet maps.
header_add_map_providers() : void
This function generates a JavaScript snippet that defines various tile layer providers for use in Leaflet maps.
It supports OpenStreetMap and ESRI basemaps, as well as custom providers defined in the global variable $geo_leaflet_sources.
The function also includes options for caching tile layers and handling different zoom levels and attribution.
Outputs the HTML and JavaScript for adding map providers to Leaflet.
Checks the current page and includes necessary geolocation libraries for Leaflet maps.
get_geolibraries() : void
This function loads the Leaflet Control Geocoder plugin and checks if the current page requires geolocation capabilities. It also handles polyfills for browser compatibility, specifically for Internet Explorer and Edge.
Outputs the HTML and JavaScript for including geolocation libraries if applicable.
Set bounds for default map view (geo_search.php and geo_edit.php)
set_geo_map_centerview() : void
Outputs the script tag for including additional Leaflet plugins.
get_geo_maps_scripts() : void
This function loads the necessary JavaScript for the Leaflet Marker Cluster library, which helps in managing large sets of markers on Leaflet maps by clustering them for better visualization.
Outputs the script tag for the Marker Cluster plugin.
Gets messages for a given user (returns true if there are messages, false if not) Note that messages are passed by reference.
message_get(array<string|int, mixed> &$messages, int $user[, bool $expired = false ][, bool $seen = false ][, string $sort = "ASC" ][, string $order_by = "ref" ][, int $limit = 0 ]) : bool
Array that will be populated by messages. Passed by reference
User ID
Include expired messages?
Include seen messages?
Sort by message ID in ascending (ASC) or descending (DESC) order
Order of messages returned
Limit the number of messages returned, defaults to 0 which is no limit
Flag to indicate if any messages exist
Add a new resourcespace system message
message_add(mixed $users, string $text[, string $url = "" ][, int $owner = null ][, int $notification_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN ][, int $ttl_seconds = MESSAGE_DEFAULT_TTL_SECONDS ][, int $related_activity = 0 ][, int $related_ref = 0 ]) : void
User ID, or array of user IDs
Message text
URL to include as link in message
ID of message creator/owner
Message type e.g. MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN, MESSAGE_ENUM_NOTIFICATION_TYPE_EMAIL. See definitions.php
Lifetime of message in seconds before expiry
ID of related activity type - see SYSTEM NOTIFICATION TYPES section in definitions.php
Related activity ID - used with type above to delete redundant messages e.g. once a user or resource request has been approved
Remove a message from message table and associated user_messages
message_remove(int $message) : void
Message ID
Mark a message as seen
message_seen(int $message[, int $seen_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN ]) : void
Message ID
Mark a message as unseen
message_unseen(int $message) : void
Message ID
Flags all non-read messages as read for given user and seen type
message_seen_all(int $user[, int $seen_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN ]) : void
User ID
Remove all messages from message and user_message tables that have expired (regardless of read).
message_purge() : void
This will be called from a cron job.
Delete all selected messages
message_deleteselusrmsg(mixed $messages) : void
List of message refs in JSON list format
Mark all selected messages as seen
message_selectedseen(mixed $messages) : void
List of message refs in JSON list format
Mark all selected messages as unseen
message_selectedunseen(mixed $messages) : void
List of message refs in JSON list format
Send a summary of all unread notifications as an email from the standard cron_copy_hitcount
message_send_unread_emails() : bool
Returns false if not due to run
Remove all messages related to a certain activity (e.g. resource request or resource submission) matching the given ref(s)
message_remove_related([int $remote_activity = 0 ][, mixed $remote_refs = array() ]) : void
ID of related activity type - see SYSTEM NOTIFICATION TYPES section in definitions.php
Related activity ID or array of IDs
Send a system notification or email to the system administrators according to preference
system_notification(string $message[, string $url = "" ]) : void
Message text
Optional URL
Get all message refs for a given user
message_getrefs(string $user) : void
User ID
Get all messages between the given user IDs
message_get_conversation(int $user[, array<string|int, mixed> $msgusers = array() ][, array<string|int, mixed> $filteropts = array() ]) : array<string|int, mixed>
Array of other user IDs
Array of extra options to filter and sort messages returned "msgfind" - (string) Text to find "sort_desc" - (bool) Sort by message ID in descending order? False = Ascending "limit" - (int) Maximum number of messages to return
Array of messages
Send a user to user(s) message
send_user_message(array<string|int, mixed> $users, string $text) : bool|string
Array of user IDs or usernames/groupnames from user select
Message text
True if sent ok or error message
Send system notifications to specified users, checking the user preferences first if specified
send_user_notification(array<string|int, mixed> $users, ResourceSpaceUserNotification $notifymessage[, bool $forcemail = false ]) : array<string|int, mixed>
Array of user IDs or array of user details from get_users()
An instance of a ResourceSpaceUserNotification object holding message properties
Force system to send email instead of notification?
Array containing resulting messages - can be used for testing when emails are not being sent This will contain two arrays:- "emails" array of emails sent, with the following elements:- "email" => Email address "subject" => Email subject "body" => Body text
"messages" Array of system messages sent with the following elements :-
"user" => User ID
"message" => message text
"url" => url
Gets the user message for the given ref
get_user_message(int $ref[, bool $checkaccess = true ]) : array<string|int, mixed>|bool
Message ID
Check if user can see the given message?
Array with two elements: 'message' => message text,'url'=> message URL and 'owner' => message owner False if user has no access or the requested message doesn't exist,
Send notifications about file integrity failures
send_integrity_failure_notices(array<string|int, mixed> $failures) : void
Array of resources that have failed integrity check
Limit the length of !list special search url by adding a maximum of 650 characters of resource references per link including separators.
build_specialsearch_list_urls(array<string|int, mixed> $resource_refs) : array<string|int, mixed>
Mail servers may break very long text strings into multiple lines and this will cause the special search to fail. Loading URLs of great length may also cause a Request-URI Too Long error in the browser. Multiple urls will be returned, formatted to include in action dates notifications.
Array containing resource references to include in url.
Array containing 'single' value of url (650 characters of resources or less) and 'multiple' value of url (more than 650 characters of resources).
Run FITS on a file and get the output back
runFitsForFile(string $file_path) : bool|SimpleXMLElement
Physical path to the file
Get metadata value for a FITS field
getFitsMetadataFieldValue(SimpleXMLElement $xml, string $fits_field) : string
FITS metadata XML
A ResourceSpace specific FITS field mapping which allows ResourceSpace to know exactly where to look for that value in XML by converting it to an XPath query string. Example: video.mimeType would point to
Extract FITS metadata from a file for a specific resource.
extractFitsMetadata(string $file_path, int|array<string|int, mixed> $resource) : bool
Path to the file from which you will extract FITS metadata
Resource ID or resource array (as returned by get_resource_data())
Check date conforms to "yyyy-mm-dd hh:mm" format or any valid partital of that e.g. yyyy-mm.
check_date_format(mixed $date) : string
Check datepart conforms to its formatting and error out each section accordingly
check_date_parts(mixed $parts) : string
updates the value of fieldx field further to a metadata field value update
update_fieldx(int $metadata_field_ref) : void
Extract and store dimensions, resolution, and unit (if available) from exif data Exiftool output format (tab delimited): widthxheight resolution unit (e.g., 1440x1080 300 inches)
exiftool_resolution_calc(string $file_path, int $ref[, bool $remove_original = false ]) : void
Path to the original file.
Reference of the resource.
Option to remove the original record. Used by update_resource_dimensions.php
Return array containing data for all required fields that apply to the given resource type.
get_required_fields(int $resource_type) : array<string|int, mixed>
Resource type reference.
For a given resource, return an array of data for required metadata field references which have not been completed.
missing_fields_check(int|array<string|int, mixed> $resource) : array<string|int, mixed>
Required fields shown by a display condition will only be considered required if the display condition is met.
Integer representing the resource reference or array of resource data from get_resource_data().
Considers if checking of missed required fields is required when a resource changes archive state. We'll always allow moving to the $resource_deletion_state and Pending Submission state (-2). Exceptions made to archive states in rse_workflow will be applied.
update_archive_required_fields_check(int|array<string|int, mixed> $resource, int $archive_state) : array<string|int, mixed>
Return will consist of an empty array where no checking is needed or an array of metadata field data where the field is required but was not completed.
Resource ref or array of resource data, likely from get_resource_data().
Destination archive state.
Update the geo location fields (if set) for the given resource(s).
update_geolocation_fields(int|array<string|int, mixed> $resources, string|array<string|int, mixed> $location) : void
User permissions are not checked as this should be used in cases where the user has already edited the location.
The resource ref(s) as a single integer or an array of integers.
The new location to use, a blank string to clear the location from the resource(s). Otherwise an array with two integer values being the latitude and longitude.
migrate_resource_type_field_check(mixed &$resource_type_field) : mixed
migrate_category_tree_to_nodes(mixed $resource_type_field_ref, mixed $category_tree_options) : mixed
migrate_filter(mixed $filtertext[, mixed $allowpartialmigration = false ]) : mixed
Utility function to generate a random UTF8 character
random_char() : string
Utility function to randomly alter date by offset
mix_date(string $fromdate[, int $maxoffset = 30 ]) : string
Utility function to randomly scramble string
mix_text(null|string $string[, bool $recurse = true ]) : string
Text string to scramble
Optionally prevent recursion (maybe called by another mix unction)
Utility function to randomly scramble data array for exporting
alter_data(array<string|int, mixed> &$row, mixed $key[, bool $scramblecolumns = array() ]) : void
Utility function to scramble a URL
mix_url(string $string) : string
Utility function to scramble a filename
mix_filename(string $string) : string
Utility function to scramble an email address
mix_email(string $string) : string
Utility function to escape and replace any empty strings with NULLS for exported SQL scripts
safe_export(null|string $value) : string
Value to check
Get array of tables to export when exporting system config and data
get_export_tables([int $exportcollection = 0 ]) : array<string|int, mixed>
edit_filter_to_restype_permission(mixed $filtertext, mixed $usergroup, mixed $existingperms[, mixed $updatecurrent = false ]) : mixed
Set node - Used for both creating and saving a node in the database.
set_node(int $ref, int $resource_type_field, string $name, int $parent, int $order_by) : bool|int
Use NULL for ref if you just want to insert a new record.
ID of the node. To insert new record ID should be NULL
ID of the metadata field
Node name to be used (international)
ID of the parent of this node (null for non trees)
Value of the order in the list (e.g. 10). To automatically pick next order by use ''.
Delete node. This will fully delete a node and remove any association between the deleted node and resources / keywords.
delete_node(int $ref) : void
ID of the node
Delete all nodes for a resource type field
delete_nodes_for_resource_type_field(mixed $ref) : void
Get a specific node by ref
get_node(int $ref, array<string|int, mixed> &$returned_node[, bool $cache = true ]) : bool
ID of the node
If a value does exist it will be returned through this parameter which is passed by reference
By default this function returns cached data. This may not be appropriate if called after a value has been changed, for example after editing a node name. Set to false to not use cache.
Get all nodes from database for a specific metadata field or parent.
get_nodes([int $resource_type_field = null ][, int $parent = null ][, bool $recursive = false ][, int $offset = null ][, int $rows = null ][, string $name = '' ][, bool $use_count = false ][, bool $order_by_translated_name = false ][, bool $exact_match = false ]) : array<string|int, mixed>
Use $parent = NULL and recursive = TRUE to get all nodes for a category tree field
Use $offset and $rows only when returning a subset.
ID of the metadata field
ID of parent node
Set to true to get children nodes as well. IMPORTANT: this is normally used with category trees, but can also be used with other fixed field types which allow multiple values eg. dynamic keywords list and checkbox list. This allows field type changes to be made between these three types without losing sight of all nodes.
Specifies the offset of the first row to return
Specifies the maximum number of rows to return. IMPORTANT! For non-fixed list fields this is capped at 10000 to avoid out of memory errors
Filter by name of node
Show how many resources use a particular node in the node properties
Flag to order by translated names rather then the order_by column
When $name is supplied, match the exact name only instead of returning matches containing the $name string.
Find and return node details for a list of node IDs.
get_nodes_by_refs(array<string|int, mixed> $refs) : array<string|int, mixed>
List of node IDs
Checks whether a node is parent to other nodes or not
is_parent_node(int $ref[, bool $active_only = false ]) : bool
Node ref
Check only for active (children) nodes
Determine how many level deep a node is. Useful for knowing how much to indent a node
get_tree_node_level(int $ref) : int
Node ref
The depth value of a tree node
Return a row consisting of all ancestor nodes of a given node Example: 1 2 2.3 2.7 2.8.4 2.8.5 2.8.6 2.9 3 Passing in node 5 will return nodes 8,2 in one row
get_all_ancestors_for_node(int $ref, int $level) : array<string|int, mixed>|bool
A tree node
Node depth level (as returned by get_tree_node_level())
Function used to reorder nodes based on an array with nodes in the new order
reorder_node(array<string|int, mixed> $nodes_new_order) : void
Array of nodes
Virtually re-order nodes
reorder_nodes(array<string|int, mixed> $unordered_nodes) : array<string|int, mixed>
Temporarily re-order nodes (mostly) for display purposes
Original nodes array
Renders HTML for adding a new node record in the database
render_new_node_record(string $form_action, bool $is_tree[, int $parent = 0 ][, int $node_depth_level = 0 ][, array<string|int, mixed> $parent_node_options = array() ]) : void
Set the action path of the form
Set to TRUE if the field is category tree type
ID of the parent of this node
When rendering for trees, we need to know how many levels deep we need to render it
Array of node options to be used as parent for new records
Calculate the next order by for a new record
get_node_order_by(int $resource_type_field[, bool $is_tree = false ][, int $parent = null ]) : int
ID of the metadata field
Param to flag whether this is for a tree node
ID of the parent of this node
$order_by
Renders HTML for a tree node
draw_tree_node_table(int $ref, int $resource_type_field, string $name, int $parent, int $order_by[, bool $last_node = false ][, int $use_count = 0 ]) : bool
ID of the node
ID of the metadata field
Node name to be used (international)
ID of the parent of this node
Value of the order in the list (e.g. 10)
Set to true to allow to insert new records after last node in each level
Counter of how many resources use a particular node
Overrides either a field[options] array structure or a flat option array with values derived from nodes.
node_field_options_override(mixed &$field[, int $resource_type_field = null ]) : bool
If a field, then will also add field=>nodes[] sub array ready for field rendering.
Either field array structure or flat options list array
ID of the metadata field, if specified will treat as flat options list
Adds node keyword for indexing purposes
add_node_keyword(int $node, string $keyword, int $position[, mixed $normalize = true ][, mixed $stem = true ]) : bool
ID of the node (from node table) the keyword should be linked to
Keyword to index
The position of the keyword in the string that was indexed
Removes node keyword for indexing purposes
remove_node_keyword(int $node, string $keyword, int $position[, bool $normalized = false ]) : void
ID of the node (from node table) the keyword should be linked to
Keyword to index
The position of the keyword in the string that was indexed
If this keyword is normalized by the time we add it, set as true
Removes all indexed keywords for a specific node ID
remove_all_node_keyword_mappings(int $node) : void
Node ID
Function used to check if a fields' node needs (re-)indexing
check_node_indexed(array<string|int, mixed> $node[, bool $partial_index = false ]) : void
Individual node for a field ( as returned by get_nodes() )
Partially index flag for node keywords
Function used to index node keywords
add_node_keyword_mappings(array<string|int, mixed> $node[, bool|null $partial_index = false ][, bool $is_date = false ][, bool $is_html = false ]) : bool
Individual node for a field ( as returned by get_nodes() )
Partially index flag for node keywords. Use NULL if code doesn't have access to the fields' data
Function used to un-index node keywords
remove_node_keyword_mappings(array<string|int, mixed> $node[, bool|null $partial_index = false ]) : bool
Individual node for a field ( as returned by get_nodes() )
Partially index flag for node keywords. Use NULL if code doesn't have access to the fields' data
Add nodes in array to resource
add_resource_nodes(int $resourceid[, array<string|int, mixed> $nodes = array() ][, bool $checkperms = true ][, bool $logthis = true ]) : bool
Resource ID to add nodes to
Array of node IDs to add
Check permissions before adding?
Log this? Log entries are ideally added when more data on all the changes made is available to make reverts easier.
Add nodes in array to multiple resources. Changes made using this function will not be logged by default.
add_resource_nodes_multi([array<string|int, mixed> $resources = array() ][, array<string|int, mixed> $nodes = array() ][, bool $checkperms = true ][, bool $logthis = false ]) : bool
Array of resource IDs to add nodes to
Array of node IDs to add
Check permissions before adding?
Log this? Log entries are ideally added when more data on all the changes made is available to make reverts easier.
Get nodes associated with a particular resource for all / a specific field (optionally)
get_resource_nodes(int $resource[, int $resource_type_field = null ][, bool $detailed = false ][, bool $node_sort = null ]) : array<string|int, mixed>
Set to true to return full node details (as get_node() does)
Set to SORT_ASC to sort nodes ascending, SORT_DESC sort nodes descending, null means do not sort
Get all resource nodes associated for a specific resource type field.
get_resources_nodes_by_rtf(int $ref) : Generator
Resource type field ID
Delete nodes in array from resource
delete_resource_nodes(int $resourceid[, array<string|int, mixed> $nodes = array() ][, bool $logthis = true ]) : void
Resource ID to add nodes to
Array of node IDs to remove
Log this? Log entries are ideally added when more data on all changes made is available to make reverts easier.
Delete all node relationships matching the passed resource IDs and node IDs.
delete_resource_nodes_multi([array<string|int, mixed> $resources = array() ][, mixed $nodes = array() ]) : void
An array of resource IDs
An integer or array of single/multiple nodes
Delete all node relationships for the given resource.
delete_all_resource_nodes(int $resourceid) : void
The resource ID
Delete all resource node relationships for the given node.
delete_node_resources(int $node) : void
The node ID to remove from all resources.
Copy resource nodes from one resource to another. Only applies for active metadata fields.
copy_resource_nodes(int $resourcefrom, int $resourceto) : void
Resource we are copying data from
Resource we are copying data to
Copy all nodes from one metadata field to another one.
copy_resource_type_field_nodes(int $from, int $to) : bool
Used mostly with copy field functionality
resource_type_field ID FROM which we copy
resource_type_field ID TO which we copy
Get all the parent nodes of the given node, all the way back to the top of the node tree.
get_parent_nodes(int $noderef[, bool $detailed = false ][, bool $include_child = false ]) : array<string|int, mixed>
The child node ID
Return all node data? false by default
Include the passed node in the returned array (easier for resolving tree nodes to paths)? false by default
Array of the parent node IDs
Get the total number of nodes for a specific field
get_nodes_count(int $resource_type_field[, string $name = '' ]) : int
ID of the metadata field
Filter by name of node
Extract option names (in raw form if desired) from a nodes array.
extract_node_options(array<string|int, mixed> $nodes[, bool $i18n = true ][, bool $index_with_node_id = true ]) : array<string|int, mixed>
Array of nodes as returned by get_nodes()
Set to false if you don't need to translate the option name
Set to false if you don't want a map between node ID and its name
Search an array of nodes by name
get_node_by_name(array<string|int, mixed> $nodes, string $name[, bool $i18n = true ]) : array<string|int, mixed>
Useful to avoid querying the database multiple times if we already have a full detail array of nodes
Nodes array as returned by get_nodes()
Filter by name of node
Use the translated option value?
Return a node ID for a given string
get_node_id(string $value, int $resource_type_field) : false|int
The node name to return
The field to search
false = not found integer = node ID of matching keyword.
Comparator function for uasort to allow sorting of node array by translated name
node_translated_name_comparator(array<string|int, mixed> $n1, string $n2) : 0
Node one to compare
Node two to compare
means $n1 equals $n2 <0 means $n1 less than $n2
0 means $n1 greater than $n2
Comparator function for uasort to allow sorting of node array by order_by field
node_orderby_comparator(array<string|int, mixed> $n1, string $n2) : 0
Node one to compare
Node two to compare
means $n1 equals $n2 <0 means $n1 less than $n2
0 means $n1 greater than $n2
This function returns an array containing list of values for a selected field, identified by $field_label, in the multidimensional array $nodes
get_node_elements(array<string|int, mixed> $node_values, array<string|int, mixed> $nodes, string $field_label) : array<string|int, mixed>
$node_values
This function returns a multidimensional array with hierarchy that reflects category tree field hierarchy, using parent and order_by fields
get_node_tree([string $parentId = "" ][, array<string|int, mixed> $nodes = array() ]) : array<string|int, mixed>
$tree - multidimension array containing nodes in correct hierarchical order
This function returns an array of category tree nodes in the hierarchical sequence defined in manage options
get_cattree_nodes_ordered(array<string|int, mixed> $treefield[, int $resource = null ][, array<string|int, mixed> $allnodes = false ]) : array<string|int, mixed>
$flatnodes - the array of nodes returned in correct hierarchical order
This function returns an array of category tree node strings in the hierarchical sequence defined in manage options The returned strings are i18 translated
get_cattree_node_strings(array<string|int, mixed> $nodesordered[, array<string|int, mixed> $strings_are_paths = true ]) : array<string|int, mixed>
$strings - the returned array of node paths or node names
Helper function for building node entry arrays for ordering
cattree_node_creator(int $ref, int $resource_type_field, string $name, int $parent, int $order_by, int $resource, array<string|int, mixed> $children, int $active) : array<string|int, mixed>
Node id
Category tree field id
Node name
Parent node id
Node order by
Resource id
Array of child node ids
Node active state (0 or 1)
Helper function which adds child nodes after each flattened parent node
cattree_node_flatten(array<string|int, mixed> $node) : array<string|int, mixed>
Array of nodes each with a child node array
Array of nodes with child nodes flattened out after their respective parents
This function returns an array of strings that represent the full paths to each tree node passed
get_node_strings(array<string|int, mixed> $resource_nodes[, bool $allnodes = false ][, bool $translate = true ]) : array<string|int, mixed>
$nodestrings - array of strings for all nodes passed in correct hierarchical order
Get to the root of the branch starting from a node.
compute_node_branch_path(array<string|int, mixed> $nodes, int $id) : array<string|int, mixed>
IMPORTANT: the term nodes here is generic, it refers to a tree node structure containing at least ref and parent
List of nodes to search through (MUST contain elements with at least the "ref" index)
Node ref we compute the branch path for
Branch path structure starting from root to the searched node (inclusive)
Find all nodes with parent
compute_nodes_by_parent(array<string|int, mixed> $nodes, int $id) : array<string|int, mixed>
List of nodes to search through (MUST contain elements with at least the "parent" index)
Parent node ref to search by
Get all nodes for given resources and fields. Returns a multidimensional array wth resource IDs as top level indexes and field IDs as second level indexes
get_resource_nodes_batch(array<string|int, mixed> $resources[, array<string|int, mixed> $resource_type_fields = array() ][, bool $detailed = false ][, bool $node_sort = null ]) : array<string|int, mixed>
Set to true to return full node details (as get_node() does)
Set to SORT_ASC to sort nodes ascending, SORT_DESC sort nodes descending, null means do not sort
Process one of the columns whose value is a search string containing nodes (e.g @@228@229, @@555) and mutate input array by adding a new column (named $column + '_node_name') which will hold the nodes found in the search string and their translated names
process_node_search_syntax_to_names(array<string|int, mixed> $R, string $column) : array<string|int, mixed>
Generic type for array (e.g DB results). Each value is a result row.
Record column which needs to be checked and its value converted (if applicable)
Delete unused non-fixed list field nodes with a 1:1 resource association
delete_unused_non_fixed_list_nodes(int $resource_type_field) : mixed
Resource type field (metadata field) ID
Delete invalid node_keyword associations. Note, by invalid, it's meant where the node is missing.
remove_invalid_node_keyword_mappings() : mixed
Delete invalid resource_node associations. Note, by invalid, it's meant where the node is missing.
remove_invalid_resource_node_mappings() : mixed
Get a count of how many resources are using the specified nodes
get_nodes_use_count(array<string|int, mixed> $nodes) : array<string|int, mixed>
Array of node refs
Array of node ref as keys and number of resources using them as the values
Check array of nodes and delete any that relate to non-fixed list fields and are unused
check_delete_nodes(array<string|int, mixed> $nodes) : mixed
Array of node IDs
Delete all keywords for all nodes associated with the specified field
remove_field_keywords(int $field) : void
Field ID
For the specified $resource, increment the hitcount for each node in array
update_resource_node_hitcount(int $resource, array<string|int, mixed> $nodes) : void
Order array of tree nodes into logical order - Each parent followed by its child nodes, all following order_by
order_tree_nodes(array<string|int, mixed> $nodes[, mixed $order_by_translated_name = false ]) : array<string|int, mixed>
Array of detailed nodes
Full nodes in order
Append SQL to an existing node query to obtain the translated names of the node
add_sql_node_language(string &$sql_select, array<string|int, mixed> &$sql_params[, string $alias = "node" ]) : void
SQL query
Array of SQL parameters
Migrate fixed list field data to text field data for a given resource reference. Useful when changing resource type field from a data type that can contain multiple values such as a dynamic keywords field. This script will concatenate the existing values and leave one remaining node for the new text field.
migrate_fixed_to_text(mixed $resource_type_field, mixed $resource, mixed $category_tree[, mixed $separator = ', ' ]) : bool
Resource type field id. ** The field type should have been changed to a text type in advance
Resource reference to be processed.
Was the field data being migrated previously of type category tree? Specifying true will allow the format of category tree branches to be preserved e.g. "level1/value, level2/value"
Default is comma and space e.g. "value1, value2"
True on success else false.
Remove invalid field data from resources, optionally just for the specified resource types and/or fields
cleanup_invalid_nodes([array<string|int, mixed> $fields = [] ][, array<string|int, mixed> $restypes = [] ][, bool $dryrun = false ]) : int
=[] Array of resource_type_field refs
=[] Array of resource_type refs
Don't delete, just return count of rows that will be affected
Count of rows deleted/to delete
Batch update nodes' active state to the database. The same state will apply to all nodes in the list.
update_node_active_state(array<int, int> $refs, bool $active) : void
For logic on which nodes to toggle toggle_active_state_for_nodes()
Node IDs
Should nodes be active or not?
Toggle nodes' active state
toggle_active_state_for_nodes(array<int, int> $refs) : array<int, 0|1>
Node IDs
Toggle category tree nodes' active state
toggle_category_tree_nodes_active_state(int $rtf, array<int, int> $node_refs) : array<int, 0|1>
Resource type field ID
Helper function to check if a node is active Note: a node here requires the "active" key.
node_is_active(array{'active': 0|1} $node) : bool
A node structure with at least the "active" key present
Suggest dynamic keyword nodes. Used by pages/edit_fields/9_ajax/suggest_keywords.php
suggest_dynamic_keyword_nodes(int $field, string $keyword, bool $readonly) : array<string|int, mixed>
Metadata field ID
String to match
Add an option to add new node if no exact match
Returns the path to a pdf template
get_pdf_template_path(string $resource_type[, string $template_name = '' ]) : string
ID of the resource type
Known template name already found in the array
Takes an HTML template suitable for HTML2PDF library and generates a PDF file if successfull
generate_pdf(string $html_template_path, string $filename[, array<string|int, mixed> $bind_placeholders = array() ][, bool $save_on_server = false ][, array<string|int, mixed> $pdf_properties = array() ]) : bool
HTML template path
The file name of the generated PDF file. If this is an actual path, and $save_on_server = true, it will be save on the server
A map of all the values that are meant to replace any placeholders found in the HTML template
If true, PDF file will be saved to the filename path
Properties of the PDF file (e.g. author, title, font, margins)
Returns the path to any template in the system.
get_template_path(string $template_name, string $template_namespace) : string
Returns the path to any templates in the system as long as they are saved in the correct place:
Template names should contain the extension as well (e.g. template_1.php / template_1.html)
The name by which multiple templates are grouped together
Function used to process a template
process_template(string $template_path[, array<string|int, mixed> $bind_placeholders = array() ]) : string
Process template and bind any placeholders. The template should contain (if needed) PHP statements which will will be processed through this function.
The full path to the location of the template (as returned by get_template_path())
A map of all the values that are meant to replace any placeholders found in the template
Process a string (mainly HTML) which contains if statement placeholders and return the processed string
process_if_statements(string $original_string, array<string|int, mixed> $bind_params) : string
Handles [%if var is set%] [%endif%] type of placeholders
Full string containing placeholders
A map of all the values that are meant to replace any placeholders found in the HTML template
Function to convert the user's language into an HTML2PDF supported language.
resolve_pdf_language() : string
Scans the HTML2PDF locale folder to create a list of supported languages to compare against the set user language. Also resolves dialects when possible. Fallback set to 'en'.
Returns an array of available PDF template names *
get_pdf_templates(string $template_namespace) : mixed
The name by which multiple templates are grouped together e.g. contact_sheet
Activate a named plugin.
activate_plugin(string $name) : bool
Parses the plugins directory to look for a pluginname.yaml file and adds the plugin to the plugins database, setting the inst_version field to the version specified in the yaml file.
Name of plugin to be activated.
Returns true if plugin directory was found.
Deactivate a named plugin.
deactivate_plugin(string $name) : void
Blanks the inst_version field in the plugins database, which has the effect of deactivating the plugin while maintaining any configuration that is stored in the database.
Name of plugin to be deativated.
Purge configuration of a plugin.
purge_plugin_config(string $name) : mixed
Replaces config value in plugins table with NULL. Note, this function will operate on an activated plugin as well so its configuration can be 'defaulted' by the plugin's configuration page.
Name of plugin to purge configuration.
Load plugin .yaml file.
get_plugin_yaml(string $plugin[, bool $validate = true ][, bool $translate = true ]) : array<string|int, mixed>|bool
Load a .yaml file for a plugin and return an array of its values.
Name of the plugin
Check that the .yaml file is complete. [optional, default=false]
Translate the contents to the user's selected language (default=true)
Associative array of yaml values. If validate is false, this function will return an array of blank values if a yaml isn't available
A subset json_encode function that only works on $config arrays but has none of the version-to-version variability and other "unusual" behavior of PHP's.
config_json_encode(mixed $config) : string
implementation.
mixed a configuration variables array. This must be an array whose elements are UTF-8 encoded strings, booleans, numbers or arrays of such elements and whose keys are either numbers or UTF-8 encoded strings.
encoded version of $config or null if $config is beyond our capabilities to encode
Utility function to encode the passed string to something that conforms to the json spec for a string. Json doesn't allow strings with double-quotes, backslashes or control characters in them. For double-quote and backslash, the encoding is '\"' and '\\' respectively. The encoding for control characters is of the form '\uxxx' where "xxx" is the UTF-8 4-digit hex value of the encoded character.
config_encode(mixed $input) : an
string the string that needs encoding
encoded version of $input
Return plugin config stored in plugins table for a given plugin name.
get_plugin_config(string $name) : mixed|null
Queries the plugins table for a stored config value and, if found, unserializes the data and returns the result. If config isn't found returns null.
Plugin name
Returns config data or null if no config.
Store a plugin's configuration in the database.
set_plugin_config(string $plugin_name, mixed $config) : mixed
Serializes the $config parameter and stores in the config
and config_json columns of the plugins table.
Plugin name
Configuration variable to store.
Check if a plugin is activated.
is_plugin_activated(mixed $name) : bool
Returns true is a plugin is activated in the plugins database.
Name of plugin to check
Returns true is plugin is activated.
Get active plugins
get_active_plugins() : array<string|int, mixed>
Generate the first half of the "guts" of a plugin setup page from a page definition array. This function deals with processing the POST that comes (usually) as a result of clicking on the Save Configuration button.
config_gen_setup_post(mixed $page_def, mixed $plugin_name) : void|string
The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.
If wishing to store array of values in one config option, in your setup page have something like the following which adds a single definition for each key of your config option: foreach($usergroups as $k => $group) { global $usergroupemails; if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys $page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]" } The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks
mixed an array whose elements are generated by calls to config_add_xxxx functions each of which describes how one of the plugin's configuration variables.
string the name of the plugin for which the function is being invoked.
Returns NULL
Generate the second half of the "guts" of a plugin setup page from a page definition array. The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.
config_gen_setup_html(mixed $page_def, mixed $plugin_name, mixed $upload_status, mixed $plugin_page_heading[, mixed $plugin_page_frontm = '' ]) : mixed
If wishing to ouput array of values for one config option, in your setup page have something like the following which adds a single definition for each key of your config option: foreach($usergroups as $k => $group) { global $usergroupemails; if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys $page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]" } The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks
mixed an array whose elements are generated by calls to config_add_xxxx functions each of which describes how one of the plugin's configuratoin variables.
string the name of the plugin for which the function is being invoked.
string the status string returned by config_get_setup_post().
string the heading to be displayed for the setup page for this plugin, typically a $lang[] variable.
string front matter for the setup page in html format. This material is placed after the page heading and before the form. Default: '' (i.e., no front matter).
Generate an html text section header
config_section_header(string $title, string $description) : mixed
the title of the section.
the user text displayed to describe the section. Usually a $lang string.
Return a data structure that will instruct the configuration page generator functions to add a section header.
config_add_section_header(string $title[, string $description = '' ]) : mixed
the title of the section.
Usually a $lang string.
Return a data structure that will instruct the configuration page generator functions to add a comma-separated list text entry configuration variable to the setup page.
config_add_text_list_input(string $config_var, string $label[, bool $password = false ][, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the text block. Usually a $lang string.
whether this is a "normal" text-entry field or a password-style field. Defaulted to false.
the width of the input field in pixels. Default: 300.
Generate an html multi-select + options block
config_multi_select(string $name, string $label, mixed $current, mixed $choices[, bool $usekeys = true ][, int $width = 300 ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
config_add_multi_select(string $config_var, string $label, mixed $choices[, bool $usekeys = true ][, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
the width of the input field in pixels. Default: 300.
Generate an html single-select block for selecting one of the RS users.
config_single_user_select(string $name, string $label[, int $current = array() ][, int $width = 300 ]) : mixed
The user key (i.e., the value from the "ref" column of the user table) of the selected user is the value posted.
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the current value of the config variable being set.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a single RS user select configuration variable to the setup page.
config_add_single_user_select(string $config_var, string $label[, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html multi-select block for selecting from among RS users.
config_multi_user_select(string $name, string $label[, mixed $current = array() ][, int $width = 420 ]) : mixed
An array consisting of the user keys (i.e., values from the "ref" column of the user table) for the selected users is the value posted.
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
config_add_multi_user_select(string $config_var, string $label[, int $width = 420 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 420.
Generate an html single-select block for selecting from among RS user groups.
config_single_group_select(string $name, string $label[, mixed $current = array() ][, int $width = 300 ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a single RS group select configuration variable to the setup page.
config_add_single_group_select(string $config_var, string $label[, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html multi-select block for selecting from among RS user groups.
config_multi_group_select(string $name, string $label[, mixed $current = array() ][, int $width = 420 ]) : mixed
An array consisting of the group keys (i.e., values from the "ref" column of the usergroup table) for the selected groups is the value posted.
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
config_add_multi_group_select(string $config_var, string $label[, int $width = 420 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html multi-select + options block for selecting multiple RS field types. The selected field type is posted as an array of the values of the "ref" column of the selected field types.
config_multi_ftype_select(string $name, string $label, array<string|int, mixed> $current[, int $width = 300 ][, int $size = 7 ][, int $rtype = false ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
Array holding the current field IDs of the config variable being set
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multiple RS field-type select configuration variable to the setup page.
config_add_multi_ftype_select(string $config_var, string $label[, int $width = 300 ][, mixed $size = 7 ][, mixed $ftype = false ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html single-select + options block for selecting one of the RS resource types. The selected field type is posted as the value of the "ref" column of the selected resource type.
config_single_rtype_select(string $name, string $label, int $current[, int $width = 300 ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the current value of the config variable being set
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a single RS resource-type select configuration variable to the setup page.
config_add_single_rtype_select(string $config_var, string $label[, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html multi-select check boxes block for selecting multiple the RS resource types. The selected field type is posted as an array of the values of the "ref" column of the selected resource types.
config_multi_rtype_select(string $name, string $label, mixed $current[, int $width = 300 ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multiple RS resource-type select configuration variable to the setup page.
config_add_multi_rtype_select(string $config_var, string $label[, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html multi-select check boxes block for selecting multiple the RS archive states.
config_multi_archive_select(string $name, string $label, mixed $current, mixed $choices[, int $width = 300 ]) : mixed
The selections are posted as an array of the archive states archive state.
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multiple RS archive select configuration variable to the setup page.
config_add_multi_archive_select(string $config_var, string $label, mixed $choices[, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the width of the input field in pixels. Default: 300.
Generate an html single-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is the value at the intersection of the selected rown with the column given by the $ixcol variable.
config_db_single_select(string $name, string $label, string $current, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the current value of the config variable being set.
the array of db rows that make up the choices.
the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable whose value is chosen from among the results of a db query to the setup page.
config_add_db_single_select(string $config_var, string $label, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the array of db rows that make up the choices.
the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
the width of the input field in pixels. Default: 300.
Generate an html multi-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is an array of the values of the column given by the $ixcol variable for the rows selected.
config_db_multi_select(string $name, string $label, mixed $current, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
the name of the select block. Usually the name of the config variable being set.
the user text displayed to label the select block. Usually a $lang string.
the array of db rows that make up the choices.
the key in $choices (i.e., the db column) for the value of the choice Defaulted to 'ref'.
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable whose values are chosen from among the results of a db query to the setup page.
config_add_db_multi_select(string $config_var, string $label, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
the name of the configuration variable to be added.
the user text displayed to label the select block. Usually a $lang string.
the array of db rows that make up the choices.
the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
the width of the input field in pixels. Default: 300.
Return a data structure that will instruct the configuration page generator functions to add a hidden configuration variable.
config_add_hidden(string $config_var) : mixed
the name of the configuration variable to be added.
Deprecated -- use config_text_input instead
config_text_field(mixed $name, mixed $label, mixed $value[, mixed $size = '30' ]) : mixed
Deprecated -- use config_multi_user_select instead
config_userselect_field(mixed $name, mixed $label[, mixed $values = array() ]) : mixed
Deprecated -- use config_single_ftype_select instead
config_field_select(mixed $name, mixed $label, mixed $value) : mixed
Deprecated -- use config_boolean_select instead
config_boolean_field(mixed $name, mixed $label, mixed $value) : mixed
Deprecated -- use config_db_multi_select instead
config_custom_select_multi(mixed $name, mixed $label, mixed $available, mixed $values[, mixed $index = 'ref' ][, mixed $nameindex = 'name' ][, mixed $additional = '' ]) : mixed
Deprecated -- use config_single_select instead
config_custom_select(mixed $name, mixed $label, mixed $available, mixed $value) : mixed
get_plugin_css() : mixed
plugin_activate_for_setup(mixed $plugin_name) : mixed
Includes configuration files for a specified plugin.
include_plugin_config(string $plugin_name[, string $config = "" ][, string $config_json = "" ]) : void
The name of the plugin whose configuration files are to be included.
Optional serialized base64-encoded configuration string.
Optional JSON-encoded configuration string.
This function does not return a value; it modifies global variables.
Registers the language files for a specified plugin.
register_plugin_language(string $plugin) : void
The name of the plugin for which to register language files.
This function does not return a value; it modifies the global $lang variable.
Retrieves the file path for a specified plugin.
get_plugin_path(string $plugin[, bool $url = false ]) : string|false
This function checks both the standard plugin directory and the user-uploaded filestore directory to locate the plugin. It can return either the file path on disk or a URL to the plugin based on the provided parameter.
The short name of the plugin to locate.
Optional. If true, return the URL to the plugin instead of the file path. Default is false.
The path to the plugin on disk or the URL to the plugin, or false if the plugin is not found.
Registers a specified plugin by including its hooks and API bindings.
register_plugin(string $plugin) : bool
This function attempts to load hook files specific to the current page, as well as an 'all' hook that is applicable across all pages. Additionally, it loads any API bindings that the plugin may have.
The short name of the plugin to register.
Always returns true after attempting to include the relevant files.
Encode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
plugin_encode_complex_configs(mixed $c) : string
Configuration requiring encoding
Decode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
plugin_decode_complex_configs(string $b64sc) : mixed
Configuration encoded prior with plugin_encode_complex_configs()
Load group specific plugins and reorder plugins list
register_group_access_plugins([int $usergroup = -1 ][, array<string|int, mixed> $plugins = [] ]) : array<string|int, mixed>
Usergroup reference
Enabled Plugins
Load ALL group specific plugins and reorder plugins list This will bypass any group access controls for use with CLI scripts
register_all_group_access_plugins(array<string|int, mixed> $plugins) : array<string|int, mixed>
Enabled Plugins
Render the plugin in the Plugin Manager with options to activate and configure.
RenderPlugin(array<string|int, mixed> $plugin[, bool $active = true ]) : void
An array containing the plugin data, loaded from the plugin table
If true, display options to deactivate and allow group configuration
Renders the HTML for the provided $field for inclusion in a search form, for example the advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated.
render_search_field(mixed $field, mixed $fields[, mixed $value = "" ][, mixed $autoupdate = false ][, mixed $class = "stdwidth" ][, mixed $forsearchbar = false ][, mixed $limit_keywords = array() ][, array<string|int, mixed> $searched_nodes = array() ][, mixed $reset = "" ][, mixed $simpleSearchFieldsAreHidden = false ]) : mixed
$field the field being rendered as an associative array of field data, i.e. one row from the resource_type_field table. $fields the array of fields data, i.e. multiple rows from the resource_type_field table. $name the input name to use in the form (post name) $value the default value to set for this field, if any $reset is non-blank if the caller requires the field to be reset
Array of all the searched nodes previously
Renders sort order functionality as a dropdown box
render_sort_order(array<string|int, mixed> $order_fields, mixed $default_sort_order) : mixed
Renders a dropdown option
render_dropdown_option(mixed $value, mixed $label[, array<string|int, mixed> $data_attr = array() ][, mixed $extra_tag_attributes = '' ]) : mixed
Renders search actions functionality as a dropdown box
render_actions(array<string|int, mixed> $collection_data[, bool $top_actions = true ][, bool $two_line = true ][, string $id = '' ][, array<string|int, mixed> $resource_data = array() ][, bool $optionsonly = false ][, string $forpage = "" ]) : void
Collection data
Set to true if actions are to be rendered in the search filter bar (above results)
Display on two lines
Selector HTML ID
Resource data
Render only options
Specifically target for which page actions apply
render_user_group_multi_select(string $name[, array<string|int, mixed> $current = array() ][, int $size = 10 ][, mixed $style = '' ]) : mixed
Current selected values (eg. array(1, 3) for Admins and Super admins user groups selected)
How many options to show before user has to scroll
Renders a list of user groups
render_user_group_checkbox_select(string $name[, array<string|int, mixed> $current = array() ][, string $style = '' ]) : void
Current selected values (eg. array(1, 3) for Admins and Super admins user groups selected)
CSS styling that will apply to the outer container (ie. table element)
render_text_input_question - Used to display a question with simple text input
render_text_question(string $label, string $input[, string $additionaltext = "" ][, bool $numeric = false ][, mixed $extra = "" ][, mixed $current = "" ][, array<string|int, mixed> $ctx = array() ]) : void
Label of question
Name of input field
Text to to display after input
Set to true to force numeric input
Rendering context. Should be used to inject different elements (e.g set the div class)
render_split_text_question - Used to display a question with two inputs e.g. for a from/to range
render_split_text_question(string $label[, array<string|int, mixed> $inputs = array() ][, string $additionaltext = "" ][, bool $numeric = false ][, mixed $extra = "" ][, mixed $currentvals = array() ]) : mixed
Label of question
Array of input names and labels(eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
(optional) Text to to display after input
Set to true to force numeric input
render_dropdown_question - Used to display a question with a dropdown selector
render_dropdown_question(string $label, string $inputname[, array<string|int, mixed> $options = array() ][, string|array<int, int> $current = "" ][, string $extra = "" ][, array{no_div_class_question?: bool, div_class?: list, div_content?: string, div_extra_attr?: string, input_class?: string, onchange?: string} $ctx = array() ]) : void
IMPORTANT: careful when having to handle untrusted data! If you have to pass it to elements, make sure they're encoded accordingly.
Label of question
Name of input field
Array of options (value and text pairs) (eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
The current selected value. For a multiple selector, a list of currently selected values.
Extra attributes used on the selector element
Rendering context. Should be used to inject different elements (e.g set the div class, add onchange for select).
Render a table row (tr) for a single access key
render_access_key_tr(array<string|int, mixed> $record) : void
Access key record details
Checks whether a specified field should be displayed based on various conditions.
is_field_displayed(array<string|int, mixed> $field) : bool
This function evaluates several criteria to determine if a field is visible in the resource editing interface. It takes into account the field's active status, permissions for viewing and editing, upload conditions, and any custom hooks that may hide the field.
The field configuration array containing information about the field's settings.
Returns true if the field should be displayed; false otherwise.
Displays a field in the resource edit interface.
display_field(int $n, array<string|int, mixed> $field[, bool $newtab = false ][, bool $modal = false ]) : mixed
This function handles the rendering of various types of fields based on their configurations and context. It supports multiple modes, such as batch editing, and adjusts the display based on user permissions, errors from previous saves, and whether the field is being copied from another resource.
The index of the field in the form.
The field configuration array containing settings and metadata for the field.
Indicates if the field should be displayed in a new tab.
Indicates if the field is part of a modal dialog.
Renders a date range input field for resource editing.
render_date_range_field(string $name, string $value[, bool $forsearch = true ][, bool $autoupdate = false ][, array<string|int, mixed> $field = array() ][, string $reset = "" ]) : mixed
This function creates a set of input fields for selecting a start and end date. It supports EDTF format and includes validation for the entered dates. It also provides functionality for handling multiple edit modes and integrates with the autosave feature.
The base name for the input fields.
The value of the date range (in a specific format).
Indicates if the field is being used for a search query.
Indicates if the field should trigger an update on change.
The field configuration array containing settings and metadata for the field.
An optional parameter indicating if the form should be reset.
Renders a full breadcrumbs trail.
renderBreadcrumbs(array<string|int, mixed> $links[, string $pre_links = '' ][, string $class = '' ]) : void
List of link "objects" that create the trail
Pre-rendered links in HTML form
Extra classes for the main container div
Render a blank tile used for call to actions (e.g: on featured collections, a tile for creating new collections)
render_new_featured_collection_cta(string $url, array<string|int, mixed> $ctx) : void
URL
Rendering options determined by the outside context
Renders social media links in order to share a particular link
renderSocialMediaShareLinksForUrl(string $url) : void
The URL to be shared on social media networks
Renders a lock button for a field - used to 'lock' metadata in upload_review_mode
renderLockButton(string $name[, array<string|int, mixed> $locked_fields = array() ]) : void
The field identifier e.g. 'resource_type', '18'
Renders an image, with width and height specified for centering in div
render_resource_image(array<string|int, mixed> $resource, string $img_url[, string $display = "thumbs" ]) : void
An array of resource data from search results
URL to image file
size to use - from search results
Calculations width, height and margin-top property for resource image to display in ResourcePanel
calculate_image_display(array{'thumb_width': positive-int, 'thumb_height': positive-int} $imagedata, string $img_url[, string $display = "thumbs" ]) : array<string|int, mixed>
Returns a tuple of width, height and margin
Render the share options (used on collection_share.php and resource_share.php)
render_share_options([array<string|int, mixed> $shareopts = array() ]) : void
Array of share options. If not set will use the old getval() methods "password" bool Has a password been set for this share? (password will not actually be displayed) "editaccesslevel" int Current access level of share "editexpiration" string Current expiration date "editgroup" int ID of existing share group
Renders a metadata field selector
render_field_selector_question(string $label, string $name, array<string|int, mixed> $ftypes[, string $class = "stdwidth" ][, bool $hidden = false ][, array<string|int, mixed> $current = 0 ]) : void
label for the field
name of form select
Array of integer field type ids to include. See definitions.php. Will return all types if incorrect value or empty array supplied.
array CSS class to apply
optionally hide the question usng CSS display:none
Current selected value
Render a filter bar button
render_filter_bar_button(string $text, string $attr, string $icon) : void
Button text
Button attributes
HTML for icon element (e.g "")
Render "Upload here" button.
render_upload_here_button(array{search: string, restypes: string, archive: string, advsearch?: "true"|""} $search_params[, bool $return_params_only = false ]) : void|array<string|int, mixed>
This applies to search results that are either a special search "!collection" and/or consist of purely the following:
For free text searches this SHOULD NOT work!
Exception to the rule! Rather than render, return the upload here params
Renders the trash bin. This is used to delete dash tiles and remove resources from collections
render_trash(string $type, mixed $deletetext[, mixed $forjs = false ]) : string|void
type of trash_bin
Generates a help icon that opens the relevant Knowledge Base article in a modal
render_help_link([string $page = '' ][, bool $return_string = false ]) : mixed
Knowledge Base article to display, leave blank to show the Knowledge Base homepage
Set to true to return the html as a single line string, False will cause the function to echo the html
if $return_string=true return is string, else void
Render generic Question div (including clearleft)
render_question_div(mixed $id, callable $render_content) : void
Render custom fields (NOT metadata fields)
render_custom_fields(array<string|int, mixed> $cfs) : true
Custom fields information (as returned by process_custom_fields_submission function)
Generates HTML for the "X Selected" in the search results found part pointing to the special collection COLLECTION_TYPE_SELECTION
render_selected_resources_counter(int $i) : string
Counter to display
Returns HTML
Renders the "Edit selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
render_edit_selected_btn() : void
Renders the "Clear selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
render_clear_selected_btn() : void
Render the actions specific to when a user selected resources (using the special "COLLECTION_TYPE_SELECTION" collection)
render_selected_collection_actions() : void
render_user_collection_select([mixed $name = "collection" ][, mixed $collections = array() ][, mixed $selected = 0 ][, mixed $classes = "" ][, mixed $onchangejs = "" ]) : mixed
Render CSRF information as data attributes. Useful to allow JS to run state changing operations
render_csrf_data_attributes(mixed $ident) : mixed
Check display condition for a field.
check_display_condition(int $n, array<string|int, mixed> $field, array<string|int, mixed> $fields, bool $render_js, int $resource_ref) : bool
Question sequence number on the rendered form
Field on which we check display conditions
Resource field data and properties as returned by get_resource_field_data()
Set to TRUE to render the client side code for checking display conditions or FALSE otherwise
Resource reference for which the display condition applies
Returns TRUE if no display condition or if field should be displayed or FALSE if field should not be displayed.
Utility to if collapsable upload options should be displayed
display_upload_options() : bool
display_field_data(array<string|int, mixed> $field[, mixed $valueonly = false ][, mixed $fixedwidth = 452 ]) : mixed
render_fixed_list_as_pills(mixed $nodes) : string
render_resource_lock_link(mixed $ref, mixed $lockuser, mixed $editaccess) : mixed
EditNav - render html for next/back browsing on the resource edit page. Called by SaveAndClearButtons()
EditNav() : void
Render the 'QuestionSubmit' div with the 'Save', 'Clear' and 'Save all with values' locked Buttons - used by the resource edit page
SaveAndClearButtons([string $extraclass = "" ][, bool $requiredfields = false ][, bool $backtoresults = false ]) : void
display_size_option
display_size_option(mixed $sizeID, mixed $sizeName[, mixed $fordropdown = true ][, mixed $selected = false ]) : void
Render the featured collection category selector
render_featured_collection_category_selector(int $parent, array<string|int, mixed> $context) : void
Parent collection ref
Contextual data (e.g depth level to render or the current branch path)
Render featured collections (as tiles on the collections_featured.php page)
render_featured_collections(array<string|int, mixed> $ctx, array<string|int, mixed> $items) : mixed
Context data to allow caller code to decide rendering requirements
List of items to render (featured collection category, actual collection or smart collection)
Render a featured collection (as tiles on the collections_featured.php page)
render_featured_collection(array<string|int, mixed> $ctx, array<string|int, mixed> $fc) : void
Context data to allow caller code to decide rendering requirements
Featured collection data structure
Render the top right menu button ellipsis icon.
render_top_right_menu_btn(array<string|int, mixed> $options) : void
Render a featured collection (category) contextual menu
render_featured_collection_context_menu(string $id, array<string|int, mixed> $options) : void
The HTML identifier for the menu container.
Renders an option in the Permission Manager (admin_group_permissions.php page)
DrawOption(string $permission, string $description[, bool $reverse = false ][, bool $reload = false ][, bool $disabled = false ]) : void
Permission identifier
User friendly description of the permission
Reverse the permission
deprecated - Autosave changes done on this permission
Disable this permission as another supersedes it (greys it out and checks it)
Render featured collections options in the Permission Manager (admin_group_permissions.php page)
render_featured_collections_category_permissions(array<string|int, mixed> $ctx) : void
This function will generate and render the following permissions that target featured collection categories
Context data to allow caller code to start from different tree levels. Supports the following properties: parent and depth
show_upgrade_in_progress message
show_upgrade_in_progress([bool $dbstructonly = false ]) : void
add link to mp3 preview file if resource is a wav file
render_audio_download_link(array<string|int, mixed> $resource, int $ref, string $k, array<string|int, mixed> $ffmpeg_audio_extensions, string $baseurl, array<string|int, mixed> $lang) : mixed
Render a table based on ResourceSpace data to include sorting by various columns
render_table(array<string|int, mixed> $tabledata) : void
Required elements:-
"class" Optional class to add to table div "headers" - Column headings using the identifier as the index,
"orderbyname" - name of variable used on page to determine orderby (used to differentiate from standard search values) "orderby" - Current order by value "sortbyname" - name of variable used on page to determine sort "sort" - Current sort "defaulturl" - Default URL to construct links "modal" - Open links in modal? (false by default) "params" - Current parameters to use in URL "pager" - Pager settings
e.g.
array( "icon"=>"icon-trash-2", "text"=>$lang["action-delete"], "url"=>"", "modal"=>false, "onclick"=>"delete_job(" . $jobs[$n]["ref"] . ");return false;" );
array( "icon"=>"icon-info", "text"=>$lang["job_details"], "url"=>generateURL($baseurl . "/pages/job_details.php",array("job" => $jobs[$n]["ref"])), "modal"=>true, );
Render multimensional array or object to display within table cells
render_array_in_table_cells(array<string|int, mixed> $array) : void
Render the top page error style version
render_top_page_error_style(string $err_msg) : void
Error message
Render a FormHelper. These are used in forms, to provide extra information to the user to a question.
render_question_form_helper(string $txt, string $id, array<string|int, mixed> $ctx) : mixed
Help text
Div ID
Contextual data
Render an HTML hidden input
render_hidden_input(string $name, string $value) : mixed
Input name
Input value
Renders a dropdown for selecting the workflow state of a resource.
render_workflow_state_question([int|null $current = null ][, bool $checkaccess = true ]) : mixed
This function generates a dropdown menu with various workflow states, allowing the user to select the current state of the resource. The available options are based on permission checks and additional states defined globally.
The currently selected state, if any.
Indicates whether to check user permissions for each state.
Renders a question field for setting a share password.
render_share_password_question([bool $blank = true ]) : mixed
This function generates an HTML input field where users can set or change the password for shared access to a resource. It includes functionality to toggle password visibility and indicates if the password is required.
Indicates if the password field should be left blank (default is true).
Get required rows and columns for use when displaying radio buttons in a table
radio_get_layout(array<string|int, mixed> $options) : array<string|int, mixed>
Array of text options
(Number of rows, number of columns)
render_radio_buttons_question - Used to display a question with radio buttons
render_radio_buttons_question(string $label, string $inputname[, array<string|int, mixed> $options = array() ][, string $current = "" ][, string $extra = "" ][, bool $listview = false ][, array<string|int, mixed> $ctx = array() ]) : void
Label of question
Name of input field
Array of options (value and text pairs) (eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
The current selected value
Extra attributes used on the selector element
Show as vertical list? (false for table view)
Rendering context. Should be used to inject different elements (e.g set the div class, add onclick for select)
Render a user message for use in conversation view
render_message([array<string|int, mixed> $message = "" ]) : void
Message data from message_get_conversation()
Render the antispam Question form section
render_antispam_question() : mixed
Renders a 'fixed' text question - not an input but to display information or values that cannot be changed
render_fixed_text_question(string $label, string $text[, string $helptext = "" ][, string $divid = "" ]) : void
Question label
Fixed text
Optional div identifier
Output encoding for HTML context when unsafe input is rendered inside it
escape(string $unsafe) : string
Output encoding for Javascript (JS) context. Allows PHP code to embed data as a JS value by producing a JS-compatible literal for the common JSON types.
encode_js_value(mixed $unsafe) : string
IMPORTANT: encoding failures result in NULL.
HTML aware function to break up long words onto multiple lines for PDF generation where CSS text wrapping can't be used
html_break_long_words(string $html, int $length) : string
HTML/text to be processed
Maximum word length
Renders a Lucide icon selector question Requires lib/lucide/icon_classes.php to be included in the page using the function
render_lucide_icon_selector([string $label = "" ][, string $name = "icon" ][, string $current = "" ]) : void
Input name
Current value
Render all related resources on view page
display_related_resources(array<string|int, mixed> $context) : void
Array with all required info from the view page
Display appropriate field constraint for use on admin_resource_type_field_edit.php e.g. single select/Number
admin_resource_type_field_constraint(int $ref, int $currentvalue) : void
Render metadata field option input on admin_resource_type_field_edit.php
admin_resource_type_field_option(string $propertyname, string $propertytitle, string $helptext, mixed $type, mixed $currentvalue, int $fieldtype, bool $system_date_field) : void
Field property/column name
Title
Help text
Input type (0=text,1=boolean,2=text area)
Current field setting
Field type. See definitions.php
Is this field set as the system $date_field?
Renders a resource type selection dropdown
render_resource_type_selector_question(string $label, string $name[, string $class = "stdwidth" ][, bool $hidden = false ][, int $current = 0 ]) : void
label for the field
name of form select
array CSS class to apply
optionally hide the question usng CSS display:none
Current selected value
Render the Download info for the resource tool (on view page)
add_download_column(int $ref, array<string|int, mixed> $size_info, bool $downloadthissize[, bool $view_in_browser = false ]) : mixed
Resource ref
Preview size information
Should the size be downloadable or requested?
Allow the size to be viewed directly in the browser
Render image on view.php
render_resource_view_image(array<string|int, mixed> $resource, array<string|int, mixed> $context) : void
Resource data
Array with following named elements "access" - Resource access "edit_access" - Resource edit access
Render the resource tools for preview sizes
render_resource_tools_size_download_options(array<string|int, mixed> $resource, array{'download_multisize': bool, "sizes"?: array, 'urlparams': array} $ctx) : void
Resource data - get_resource_data()
Contextual information.
Adds script to display toast notification. Note: Must be included after header.php.
toast_notification(ToastNotificationType $type, string $message) : void
Options are: 'success', 'error' or 'download'. Determines toast notification icon.
Notification text to display.
render_icon_wrapper_component(Icon $name[, IconSize $size = IconSize::Default ]) : void
Render the header's primary navigation. In responsive mode, all the nav links are being overflown.
render_header_links(Icon, force_overflow?: bool} $ctx) : void
Change behaviour based on context (e.g. normal vs responsive)
Helper function for smart featured collections to update $branch_trail with all parent nodes of the selected node
get_smart_fc_branch_trail(int $node, int $tree_node_level, array<string|int, mixed> $field_data, array<string|int, mixed> $general_url_params, array<string|int, mixed> $branch_trail) : array<string|int, mixed>
Node selected
Current level of node in tree
Array of the smart featured collections field data
URL parameters to use with generated href links
Partial array of links to use for renderBreadcrumbs(), only includes the highest level link
$branch_trail Full array of parent nodes and field links
Retrieves the name of a report
get_report_name(array<string|int, mixed> $report) : string
The report array containing at least a 'name' key.
The translated report name.
Retrieves an array of reports from the database.
get_reports() : array<string|int, mixed>
This function queries the database for all reports and processes them by:
get_report_name function.report_has_date.report_has_thumbnail.The reports are always listed in the same order, regardless of the language used.
An array of processed reports, each containing 'ref', 'name', 'contains_date', and 'has_thumbnail' keys.
do_report - Runs the specified report. This is used in a number of ways:- 1) Outputs an HTML table to screen ($download = false) 2) Produces a CSV - for direct download from team_report.php - captured and saved as a CSV file if called by send_periodic_report_emails() and over 100 rows are returned
do_report(int $ref, mixed $from_y, mixed $from_m, mixed $from_d, mixed $to_y, mixed $to_m, mixed $to_d[, mixed $download = true ][, mixed $add_border = false ][, mixed $foremail = false ][, array<string|int, mixed> $search_params = array() ][, bool $results_as_array = false ]) : void|string|array<string|int, mixed>
Report ID
Start year (used for reprts with date placholders)
Start month
Start day
End year
To month
To day
Output as CSV attachment (default)/output directly to client
Optional table border (not for download)
Sending as email?
Search parameters - get_search_params() - will run the report on the search results and replace the '[non_correlated_sql]' placeholder with the search query.
Output is an array containing report rows. Will override other output modes. Useful for the API.
Outputs CSV file, array of report data, returns HTML table or returns an array with path to the CSV file, rows and filename
Creates a new automatic periodic e-mail report
create_periodic_email(mixed $user, mixed $report, mixed $period, mixed $email_days, array<string|int, mixed> $user_groups, array<string|int, mixed> $search_params) : mixed
Sends periodic report emails to users based on configured schedules.
send_periodic_report_emails([bool $echo_out = true ][, bool $toemail = true ]) : void
This function checks for any scheduled reports that need to be sent, either because they are pending or overdue. It gathers the necessary user email addresses, generates the reports, and sends them as emails with attachments if applicable.
Determines whether to output progress messages during processing.
Determines whether to send the reports via email.
Deletes a periodic report for the current user.
delete_periodic_report(int $ref) : bool
This function removes the specified periodic report from the database for the user and also clears any associated unsubscribe (opt out) records.
The reference ID of the periodic report to delete.
Returns true upon successful deletion.
Unsubscribes a user from a specified periodic report.
unsubscribe_user_from_periodic_report(int $user_id, int $periodic_email_id) : bool
This function inserts a record into the unsubscribe table, preventing the specified user from receiving future emails related to the given periodic report.
The ID of the user to unsubscribe.
The ID of the periodic email report to unsubscribe from.
Returns true upon successful unsubscription.
Retrieves the translated version of an activity type.
get_translated_activity_type(string $activity_type) : string
This function takes an activity type string, checks if a corresponding translation exists in the global language array, and returns the translated string if available. If no translation is found, it returns the original activity type.
The activity type in plain text English.
The translated activity type if available; otherwise, the original activity type.
Checks for the presence of date placeholders in a report's SQL query.
report_has_date(string $query) : bool
The report's SQL query.
Returns true if a date placeholder was found else false.
Checks for the presence of date placeholders in a report's sql query using the report's id.
report_has_date_by_id(int $report) : bool
Report id of the report to retrieve the query data from the report table.
Returns true if a date placeholder was found else false.
Check if report has a "thumbnail" column in its SQL query.
report_has_thumbnail(string|null $query) : bool
The reports' SQL query.
Get report date range based on user input
report_process_period(array<string|int, mixed> $info) : array<string|int, mixed>
Information about the period selection. See unit test for example input
Find and replace a reports' query placeholders with their values.
report_process_query_placeholders(string $query, array<string|int, mixed> $placeholders) : string
Reports' SQL query
Map between a placeholder and its actual value
Output the Javascript to build a pie chart in the canvas denoted by $id $data must be in the following format $data = array( "slice_a label" => "slice_a value", "slice_b label" => "slice_b value", );
render_pie_graph(string $id, array<string|int, mixed> $data[, string|null $total = null ]) : void
identifier for the canvas to render the chart in
data to be rendered in the chart
null will mean that the data is complete and an extra field is not required a string can be used to denote the total value to pad the data to
Output the Javascript to build a bar chart in the canvas denoted by $id $data must be in the following format $data = array( "point_a x value" => "point_a y value", "point_b x value" => "point_b y value",
render_bar_graph(string $id, array<string|int, mixed> $data) : void
identifier for the canvas to render the chart in
data to be rendered in the chart
Retrieve a resource request record
get_request(int $request) : mixed
The request record ID
False if not found, the resource record (associative array) if found
Fetch a list of all requests for a user
get_user_requests([bool $excludecompleted = false ][, bool $returnsql = false ]) : mixed
Exclude requests that have already been completed
Return the SQL for the execution rather than the results
Handle the posted request form, when saving a request in the admin area.
save_request(int $request) : bool
The request record ID
Was this successful?
Fetch a list of requests assigned to the logged in user
get_requests([bool $excludecompleted = false ][, bool $excludeassigned = false ][, bool $returnsql = false ]) : mixed
Exclude completed requests?
Exclude assigned requests? (e.g. if the user is able to assign unassigned requests) unless assigned to the logged in user
Return SQL query object instead of the results?
Resulting array of requests or an SQL query object
Email a collection request to the team responsible for dealing with requests. Request mode 0 only (non managed).
email_collection_request(int $ref, mixed $details, mixed $external_email) : bool
Request mode 1 - quests are managed via the administrative interface. Sends an e-mail but also logs the request in the request table.
managed_collection_request(mixed $ref, mixed $details[, mixed $ref_is_resource = false ]) : bool
E-mails a basic resource request for a single resource (posted) to the team (not a managed request)
email_resource_request(mixed $ref, mixed $details) : void|false|string
The resource ID
The request details provided by the user
Get collection of valid custom fields. A valid fields has at least the expected field properties
get_valid_custom_fields(array<string|int, mixed> $fields) : array<string|int, mixed>
IMPORTANT: these fields are not metadata fields - they are configured through config options such as custom_researchrequest_fields
List of custom fields. Often this will simply be the global configuration option (e.g custom_researchrequest_fields)
Generate HTML properties for custom fields. These properties can then be used by other functions like render_custom_fields or process_custom_fields_submission
gen_custom_fields_html_props(array<string|int, mixed> $fields, array<string|int, mixed> $ctx) : array<string|int, mixed>
List of custom fields as returned by get_valid_custom_fields(). Note: At this point code assumes fields have been validated
Contextual information for process_custom_fields_submission()
Returns collection items with the extra "html_properties" key
Process posted custom fields
process_custom_fields_submission(array<string|int, mixed> $fields, bool $submitted, array<string|int, mixed> $ctx) : array<string|int, mixed>
List of custom fields
Processing submitted fields?
Contextual information (e.g. change the prefix for html tags' identifiers)
Returns collection of items with the extra "html_properties" key
Initialisation and system check if configuration is correctly enabled to use the owner field and mappings logic.
can_use_owner_field() : bool
IMPORTANT: during init the globals $owner_field & $owner_field_mappings values will be updated for validation purposes
Return true if the system is configured with a valid $owner_field and numeric $owner_field_mappings, false otherwise.
Get users to notify for requested resources "owned" by particular groups. Configurable using a metadata field ($owner_field) and a defined map ($owner_field_mappings).
get_notification_users_by_owner_field(array<string|int, mixed> $users, array<string|int, mixed> $resources) : array<string|int, mixed>
List of notification users get_notification_users(). Any array structure where each value contains an array with at least a "ref" and "email" keys.
List of resource IDs
Returns user ID (key) and email (value)
Can the logged in user see the request specified?
resource_request_visible(array<string|int, mixed> $request) : bool
Array of request details
Sends a research request by inserting it into the requests table and notifying the relevant users.
send_research_request(array<string|int, mixed> $rr_cfields) : void
This function takes an array of custom fields related to the research request, processes the input data, and sends an email notification to the designated research admins. It gathers resource types, deadlines, contact information, and custom fields, and stores them in the database. It also constructs and sends a notification message with the request details.
An array of custom fields associated with the research request.
This function does not return any value but performs database operations and sends notifications.
Retrieves research requests from the database, optionally filtering by a search term and sorting the results by a specified field.
get_research_requests([string $find = "" ][, string $order_by = "name" ][, string $sort = "ASC" ]) : array<string|int, mixed>
Optional search term to filter research requests by name, description, contact, or reference number.
The field to sort the results by. Valid options are 'ref', 'name', 'created', 'status', or 'assigned_to'.
The sort direction, either 'ASC' or 'DESC'. Defaults to 'ASC'.
An array of research requests that match the search criteria.
Retrieves a research request by its reference number, returning its details including name, description, deadline, contact information, user assignment, status, and custom fields.
get_research_request(int $ref) : array<string|int, mixed>|false
The reference number of the research request to retrieve.
An associative array with the research request details if found, or false if no request exists.
Saves a research request by updating its status and assigned user, sending notifications to the originator if the status changes, and optionally deleting the request or copying existing collection resources.
save_research_request(int $ref) : bool
The reference number of the research request to be saved.
True if the operation was successful, false otherwise.
Retrieves the collection reference associated with a given research request.
get_research_request_collection(int $ref) : int|false
The reference number of the research request.
The collection reference if found, or false if not.
Updates the collection reference associated with a specified research request.
set_research_collection(int $research, int $collection) : void
The reference number of the research request.
The reference number of the collection to associate.
Get resource path / resource URL / download URL for this resource
get_resource_path(int $ref, bool $getfilepath[, string|null $size = '' ][, bool $generate = true ][, string|null $extension = 'jpg' ][, bool $scramble = true ][, int $page = 1 ][, bool $watermarked = false ][, string|null $file_modified = '' ][, int $alternative = -1 ][, bool $includemodified = true ]) : string
IMPORTANT: the download URL should always be used client side (public) whilst filstore path is private for internal use only
Resource ID
Set to TRUE to get the filestore (physical) path
Specify which size of the resource should be returned. Use '' for original file
Generate folder if not found
Extension of the file we are looking for. For original file, this would be the file extension, otherwise use the preview extension (e.g image preview will have JPG while video preview can have MP4 or others)
Set to TRUE to get the scrambled folder (requires scramble key for it to work)
For documents, use the page number we are trying to get the preview of.
Get the watermark version?
Specify when the file was last modified as a Unix timestamp
ID of the alternative file
Show when the file was last modified
resource path / resource URL / download URL
get_resource_data(mixed $ref[, mixed $cache = true ]) : mixed
get_resource_data_batch - get data from resource table for all resource IDs
get_resource_data_batch(mixed $refs) : array<string|int, mixed>
Updates $resource with the name/value pairs in $data - this relates to the resource table column, not metadata.
put_resource_data(int $resource, array<string|int, mixed> $data) : bool
ID of resource
Array of data to be applied to resource
create_resource
create_resource(int $resource_type[, int $archive = 999 ][, int $user = -1 ][, string $origin = '' ][, string $file_extension = '' ][, bool $run_macro = true ]) : mixed
ID of target resource type
ID of target archive state, 999 if archived
User ID, -1 for current user
Source of resource, should not be blank
If specified
Run autocomplete macros, can be disabled if they are run later in process
false if invalid inputs given, integer of resource reference if resource is created
update_hitcount(mixed $ref) : mixed
Save resource data
save_resource_data(int $ref, bool $multi[, string|int $autosave_field = "" ]) : true|array<string|int, mixed>
IMPORTANT: inactive nodes should be left alone (don't add/remove) except when processing fixed list field types that only hold one value (dropdown, radio). Plugins should determine this based on their use cases when hooking.
List of errors if unsuccessful, true otherwise
Set resource defaults. Optional, a list of field IDs can be passed on to only update certain fields.
set_resource_defaults(int $ref[, array<string|int, mixed> $specific_fields = array() ]) : bool
IMPORTANT: this function will always set the resource defaults if any are found. The "client code" is where developers decide whether this should happen
Resource ID
Specific field ID(s) to update
Batch save resources in a collection
save_resource_data_multi(int $collection[, array<string|int, mixed> $editsearch = array() ][, array<string|int, mixed> $postvals = [] ]) : true|array<string|int, mixed>
IMPORTANT: inactive nodes should be left alone (don't add/remove) except when processing fixed list field types that only hold one value (dropdown, radio). Plugins should determine this based on their use cases when hooking.
List of errors if unsuccessful, true otherwise
Updates resource field. Works out the previous value, so this is not efficient if we already know what this previous value is (hence it is not used for edit where multiple fields are saved)
update_field(int $resource, int $field, string $value[, array<string|int, mixed> &$errors = array() ][, bool $log = true ][, bool $nodevalues = false ]) : bool
Resource ID
Field ID
The new value
Any errors that may occur during update
Log this change in the resource log?
Set to TRUE to process the value as a comma separated list of node IDs
email_resource(mixed $resource, mixed $resourcename, mixed $fromusername, mixed $userlist, mixed $message[, mixed $access = -1 ][, mixed $expires = "" ][, mixed $sharepwd = "" ][, mixed $useremail = "" ][, mixed $from_name = "" ][, mixed $cc = "" ][, mixed $list_recipients = false ][, mixed $open_internal_access = false ][, mixed $useraccess = 2 ][, mixed $group = "" ]) : mixed
delete_resource(mixed $ref) : mixed
Returns field data from resource_type_field for the given field
get_resource_type_field(int $field) : bool|array<string|int, mixed>
Resource type field ID
get_resource_field_data
get_resource_field_data(int $ref[, bool $multi = false ][, bool $use_permissions = true ][, int $originalref = null ][, bool $external_access = false ][, bool $ord_by = false ][, bool $forcsv = false ][, bool $translate_value = true ]) : array<string|int, mixed>|bool
Resource ID
Get all fields? False by default (only fields that apply to the given resource type)
Honour user permissions e.g. field access. TRUE by default
Original resource ID to get data for. NULL by default
Only get data permitted to view externally. FALSE by default
Use field order_by setting. FALSE by default (order is by resource type first)
Get data for CSV export (uses \ separator for category tree nodes). FALSE by default
Field value will be translated with i18n_get_translated() unless FALSE supplied.
get_resource_field_data_batch - Get all resource data for the given resources
get_resource_field_data_batch(array<string|int, mixed> $resources[, bool $use_permissions = true ][, bool $external_access = false ][, bool $ord_by = false ][, mixed $exportoptions = array() ]) : array<string|int, mixed>
Returns a multidimensional array with resource IDs as top level keys, then fields (order determined by $ord_by setting) IMPORTANT: This differs from get_resource_field_data() in that only fields containing data will be returned.
e.g. Array ( [119912] => array ( [0] => Array ( [resource] => 119912 [value] => This is the title of resource 119912 [resource_type_field] => 8 [ref] => 8 [name] => title [title] => Title [field_constraint] => 0 [type] => 1)) ....
(either an array of resource ids or an array returned from search results)
Honour user permissions e.g. field access. TRUE by default
Only get data permitted to view externally. FALSE by default
Use field order_by setting. FALSE by default (order is by resource type first)
Array of options as below "csvexport" (bool) - get data for CSV export (uses \ separator for category tree nodes) "personal" (bool) - include data in fields marked as personal "alldata" (bool) - include data in all fields, including technical metadata
Array of resource data organised by resource then metadata field ID
Return an array of resource types that this user has access to
get_resource_types([string $types = "" ][, bool $translate = true ][, bool $ignore_access = false ][, bool $usecache = false ]) : array<string|int, mixed>
Comma separated list to limit the types that are returned by ref, blank string returns all available types
Flag to translate the resource types before returning
Return all resource types regardless of access?#
Return cached result?
Array of resource types limited by T* permissions and optionally by $types
Returns all resources types
get_all_resource_types() : array<string|int, mixed>
No permissions are checked or applied, do not expose this function to the API
Array of resource types ordered by 'order_by' then 'ref'
clear_resource_data(mixed $resource) : mixed
Create a new resource, copying all data from the resource with reference $from.
copy_resource(int $from[, int $resource_type = -1 ][, string $origin = '' ]) : bool|int
Note this copies only the data and not any attached file. It's very unlikely the same file would be in the system twice, however users may want to clone an existing resource to avoid reentering data if the resource is very similar. If $resource_type if specified then the resource type for the new resource will be set to $resource_type rather than simply copied from the $from resource.
ID of resource
ID of resource type
Origin of resource when uploading, leave blank if not an upload
Log resource activity
resource_log(int $resource, string $type, int $field[, string $notes = "" ][, mixed $fromvalue = "" ][, mixed $tovalue = "" ][, int $usage = -1 ][, int $alt_ref = -1 ]) : int
-- resource_log.usageoption
(or false)
Get resource log records. The standard field titles are translated using $lang. Custom field titles are i18n translated.
get_resource_log(int $resource[, int $fetchrows = -1 ][, array<string|int, mixed> $filters = array() ]) : array<string|int, mixed>
Resource ID - set to NULL and specify r.ref=>[id] in the $filters array to retrieve a specific log entry by log ref
If $fetchrows is set we don't have to loop through all the returned rows. @see ps_query()
List of filters to include in the where clause. The key of the array is linked to the available columns in the sql statement so they must match!
get_resource_type_name(mixed $type) : mixed
get_resource_custom_access(mixed $resource) : mixed
Retrieves custom access settings for users and user groups associated with a specific resource.
get_resource_custom_access_users_usergroups(int $resource) : array<string|int, mixed>
This function performs a database query to return a list of custom access rows for a given resource, including the names of user groups and users, the access level, and expiration details.
The resource reference ID for which to retrieve custom access settings.
The result set containing user groups, users, access levels, and expiration information.
Saves custom access settings for a specific resource.
save_resource_custom_access(int $resource) : void
This function retrieves custom access groups associated with the given resource, deletes existing custom access records for that resource, and then inserts new access settings based on user input.
The resource reference ID for which custom access is being set.
Lookup custom access value for a resource
get_custom_access(int $resource, int $usergroup[, bool $return_default = true ]) : mixed
Resource ID.
User group ID.
Return default custom access value RESOURCE_ACCESS_CONFIDENTIAL
False if custom access is disabled or there is no custom access value set for this resource. Int representing custom access level if set; 0 - open, 1 - restricted, 2 - confidential.
Determine the featured collections and public collections a resource is associated with.
get_themes_by_resource(int $ref) : array<string|int, mixed>
Resource ref
update_resource_type(mixed $ref, mixed $type) : mixed
Returns a list of exiftool fields, which are basically fields with an 'exiftool field' set.
get_exiftool_fields(int $resource_type[, string $option_separator = "," ][, bool $skip_translation = false ]) : array<string|int, mixed>
String to separate the node options returned for fixed list fields
Set to true to return the entire untranslated node value rather than the appropriate translation only.
Create a temporary copy of the file in the tmp folder (ie. the usual filestore/tmp/)
createTempFile(string $path, string $uniqid, string $filename) : bool|string
File path
If a uniqid is provided, create a folder within tmp. See get_temp_dir() for more information.
Filename of the new file
Returns FALSE or the file path of the temporary file
Strips metadata from file
stripMetadata(string $file_path) : bool|string
Physical path to file that will have metadata stripped. Use NULL to just get the exiftool command returned instead of running the command on the file
Returns TRUE or the Exiftool command for stripping metadata
Writes metadata to a specified file using ExifTool.
write_metadata(string $path, int $ref[, string $uniqid = "" ]) : string|bool
The file path where the metadata will be written.
The reference ID of the resource associated with the file.
A unique identifier for the temporary file location (optional).
The path to the temporary file if successful, false otherwise.
Delete Exif temp file
delete_exif_tmpfile(string $tmpfile) : mixed
Exif temp file to be deleted
Updates a resource with a new file and its associated metadata.
update_resource(int $r, string $path, string $type, string $title[, bool $ingest = false ][, bool $createPreviews = true ][, string $extension = '' ][, bool $after_upload_processing = false ]) : int|bool
The resource ID to update.
The file path of the new resource.
The type of the resource.
The title for the resource.
Indicates if the resource is being ingested.
Flag to create previews.
The file extension of the new resource.
Indicates if the update is after upload processing.
The resource ID if successful, false otherwise.
Imports a resource from the specified path and updates its details.
import_resource(string $path, string $type, string $title[, bool $ingest = false ][, string $extension = '' ]) : int|bool
This function is used to import resources into the system, particularly through staticsync.php It creates a new resource entry and updates it with the provided file details.
The file path of the resource to import.
The type of the resource being imported.
The title for the imported resource.
Indicates if the resource is being ingested (default is false).
The file extension of the resource (optional).
The newly created resource ID if successful, false otherwise.
Retrieves alternative files associated with a specified resource.
get_alternative_files(int $resource[, string $order_by = "" ][, string $sort = "" ][, string $type = "" ]) : array<string|int, mixed>|bool
The resource ID for which to fetch alternative files.
The field to order the results by (optional).
The sorting direction (ASC or DESC) for the order_by field (optional).
The type of alternative file to filter by (optional).
An array of alternative files if successful, false otherwise.
Search the alternative file records for matching filenames Alternative files can be optionally filtered by the Resource ID or by collection
get_alternative_files_by_filename(string $filename, int $collection, int $min, int $max) : array<string|int, mixed>
Filename of the alternative file(s) to search for
Collection ID to filter resources, use 0 to ignore
Minimum Resource ID to consider, use 0 to ignore
Maximum Resource ID to consider, use 0 to ignore
All matching alternative file records with corresponding: resource ID, filename, file size, extension, name, and description
Add alternative file
add_alternative_file(int $resource, string $name[, string $description = "" ][, string $file_name = "" ][, string $file_extension = "" ][, int $file_size = 0 ][, string $alt_type = '' ]) : int
delete_alternative_file
delete_alternative_file(int $resource, int $ref) : bool
Resource id.
Alternative file id.
Retrieves a specific alternative file associated with a given resource.
get_alternative_file(int $resource, int $ref) : array<string|int, mixed>|bool
The resource ID associated with the alternative file.
The reference ID of the alternative file to retrieve.
An associative array containing the alternative file details if found, false otherwise.
Updates the details of an alternative file in the database.
save_alternative_file(int $resource, int $ref[, array<string|int, mixed> $data = [] ]) : void
The resource ID associated with the alternative file.
The reference ID of the alternative file to update.
Array of data in name=>value format, where name is the resource_alt_files column name. If a column is to be left as is then it must not be included in the array
Saves a user rating for a given resource.
user_rating_save(int $userref, int $ref, int $rating) : void
The reference ID of the user rating the resource.
The reference ID of the resource being rated.
The rating value to be saved (0 to remove rating).
A standard field title is translated using $lang. A custom field title is i18n translated.
get_field(int $field) : bool|array<string|int, mixed>
Resource type field ID
Returns FALSE or record data (array)
Retrieves the keyword that will be indexed for a given field option.
get_keyword_from_option(string $option) : string
This function splits the provided option into keywords and applies stemming if enabled.
The field option to process.
The keyword to be indexed.
Retrieves the access level for the currently logged-in user for a specified resource.
get_resource_access(int|array<string|int, mixed> $resource) : int
The access levels returned are:
The reference ID of the resource or a resource data array.
The access level for the resource.
Retrieves the custom access level for a specific user on a given resource.
get_custom_access_user(int $resource, int $user) : mixed
This function checks the resource_custom_access table to see if the user has any custom access
permissions for the specified resource. It returns the access level if found and still valid;
otherwise, it returns false.
The resource ID to check access for.
The user ID to check for custom access.
The access level if found; false otherwise.
Edits the external access settings for a given resource.
edit_resource_external_access(string $key[, int $access = -1 ][, string $expires = "" ][, string $group = "" ][, string $sharepwd = "" ]) : bool
The external access key to edit.
The new access level; defaults to -1 for no change.
The expiration date for the access key; optional.
The user group to share with; defaults to the current user group if not specified.
The password for accessing the resource; "(unchanged)" means no change.
Returns true if the operation was successful; false if the key is empty.
For the given resource and size, can the current user download it? resource type and access may already be available in the case of search, so pass them along to get_resource_access to avoid extra queries $resource can be a resource-specific search result array.
resource_download_allowed(int $resource, string $size, int $resource_type[, int $alternative = -1 ][, bool $usecache = false ]) : bool
ID of resource
ID of size
ID of resource type
Use alternative?
Use cached result if available?
Check if current user has edit access to a resource. Checks the edit permissions (e0, e-1 etc.) and also the group edit filter which filters edit access based on resource metadata.
get_edit_access(int $resource[, int $status = -999 ][, array<string|int, mixed> &$resourcedata = [] ]) : bool
Resource ID
Archive status ID. Use -999 to use the one from resourcedata argument
In the given filter string, does name/value match? Returns: 0 = no match for name 1 = matched name but value was not present 2 = matched name and value was correct
filter_match(string $filter, string $name, string $value) : int
Sring to for which filtering is to be applied
Name to match
Value to match
Check changes made to a metadata field and create a nice user friendly summary
log_diff(string $fromvalue, string $tovalue) : string
Retrieves a list of all metadata templates for a specified resource type.
get_metadata_templates() : array<string|int, mixed>
An array of metadata templates, each containing the resource reference and its title.
Retrieves a list of collections that a resource is used in for the specified resource reference.
get_resource_collections(int $ref) : array<string|int, mixed>
The resource reference for which to retrieve associated collections.
An array of collections associated with the resource, including user information and resource count.
Retrieves a summary of downloads for a given resource, categorized by usage type.
download_summary(int $resource) : array<string|int, mixed>
This function queries the resource log to count the number of downloads for the specified resource, grouping the results by the usage option.
The resource reference for which to retrieve the download summary.
An array of download summaries, each containing the usage option and the corresponding count.
check_use_watermark([mixed $download_key = "" ][, mixed $resource = "" ]) : mixed
Fill in any blank fields for the resource.
autocomplete_blank_fields(int $resource, bool $force_run[, bool $return_changes = false ][, int $field_ref = 0 ]) : bool|array<string|int, mixed>
IMPORTANT: Auto completing blank fields with inactive options should be allowed (possibly a system misconfiguration). This function will NOT exclude inactive nodes because, for required fields, you might end up having no value after processing the field.
Resource ID
Allow code to force running this function and update the fields even if there is data.
When true an array of fields changed by autocomplete is returned. For example:
Optional parameter to specify which metadata field should be processed. Left blank, all fields will be processed (default behaviour).
Success/fail or array of changes made
get_page_count(mixed $resource[, mixed $alternative = -1 ]) : mixed
Updates the disk usage for a specified resource by calculating the total size of the files in the resource's directory and storing the result in the resource table.
update_disk_usage(int $resource) : bool
This function first checks for the size of the primary resource file and then scans the associated folder to compute the total disk usage, excluding any files in staticsync locations.
The resource reference whose disk usage is to be updated.
Returns true on success, or false if the directory does not exist.
Update disk usage for all resources that have not yet been updated or have not been updated in the past 30 days.
update_disk_usage_cron() : bool|void
Limit to a reasonable amount so that this process is spread over several cron intervals for large data sets.
Returns the total disk space used by all resources on the system
get_total_disk_usage() : int
Calculate if the quota set by $disksize in the configuration has been exceeded.
overquota() : array<string|int, mixed>|bool
True if the system is over quota
Get size of specified image file
get_original_imagesize([int $ref = "" ][, string $path = "" ][, string $extension = "jpg" ][, bool $forcefromfile = false ]) : array<string|int, mixed>|bool
Resource ID
File path
File extension
Get info from file instead of database cache
File size info. Returns false if not available
Generates an external access key for a resource, allowing specified access to a user or group.
generate_resource_access_key(int $resource, int $userref, int $access, string|null $expires, string $email[, string $group = "" ][, string $sharepwd = "" ]) : string|bool
This function creates a unique access key and stores it in the database along with information about the resource, the user, the type of access granted, expiration date, email, and user group. It also hashes the share password if provided.
The resource reference for which the access key is being generated.
The user reference for the user to whom access is granted.
The level of access granted (e.g., full access, restricted).
The expiration date of the access key, formatted as 'Y-m-d'.
The email address associated with the user receiving the access key.
The user group associated with the access, defaults to the current user group if not specified.
The share password, if any, used to secure access.
Returns the generated access key on success, or false if permissions are insufficient.
Retrieves all external access keys granted for a specific resource.
get_resource_external_access(int $resource) : array<string|int, mixed>
This function returns a list of all external access details for the given resource, including users and emails associated with each access key. If the user does not have the elevated 'v' permission, the function will only return access keys associated with the current user. The results are grouped by access key, allowing for multiple users or emails to be returned as comma-separated values.
The reference ID of the resource for which external access is being retrieved.
An array of access details, including access keys, users, emails, expiration dates, and other related information for the specified resource.
delete_resource_access_key(mixed $resource, mixed $access_key) : mixed
resource_type_config_override(mixed $resource_type[, mixed $only_onchange = true ]) : mixed
Update the archive state of resource(s) and log this
update_archive_status(mixed $resource, int $archive[, int|array<string|int, mixed> $existingstates = array() ][, int $collection = 0 ][, mixed $more_notes = "" ]) : void
delete_resources_in_collection(mixed $collection) : mixed
Update related resources - add new related resource(s) or delete existing
update_related_resource(int $ref, mixed $related[, bool $add = true ]) : bool
ID of primary resource
Add relationship? If false this will delete the specified relationships
Check if sharing of resource is permitted
can_share_resource(int $ref[, int $access = "" ]) : bool
ID of resource
Level of resource access (0 - Open 1 - Restricted 2 - Confidential)
Delete all usergroup specific access to resource $ref
delete_resource_custom_access_usergroups(int $ref) : mixed
ID of resource
Truncate the field for insertion into the main resource table field
truncate_join_field_value(string $value) : string
Check whether a resource (of a video type) has any snapshots created.
get_video_snapshots(int $resource_id[, bool $file_path = false ][, bool $count_only = false ][, mixed $includemodified = false ]) : array<string|int, mixed>|int
Snapshots are being created using config option $ffmpeg_snapshot_frames
Resource unique ref
Specify whether the return value should be the file path. Default is FALSE
Set to true if we are only interested in how many snapshots we have. Default is FALSE
Array of all file paths found or number of files found
Check if resource file is read-only because it's part of the filestore template threshold
resource_file_readonly(int|numeric-string $ref) : bool
Resource ID
delete_resource_custom_user_access(mixed $resource, mixed $user) : mixed
get_video_info(mixed $file) : mixed
Provides the ability to copy any metadata field data from one resource to another.
copyAllDataToResource(int $from, int $to[, mixed $resourcedata = false ]) : bool
Resource we are copying data from
The Resource ID that needs updating
Update resource data for 'locked' fields from last edited resource. Used for upload_then_edit
copy_locked_data(array<string|int, mixed> $resource, array<string|int, mixed> $locked_fields, int $lastedited[, bool $save = false ]) : array<string|int, mixed>
$resource - modified resource data array
Update resource metadata for 'locked' fields from last edited resource.
copy_locked_fields(int $ref, array<string|int, mixed> &$fields, array<string|int, mixed> &$all_selected_nodes, array<string|int, mixed> $locked_fields, int $lastedited[, bool $save = false ]) : void
NB: $fields and $all_selected_nodes are passed by reference
Copy related resources from one resource to another
copyRelatedResources(int $from, mixed $to) : void
Resource we are copying related resources from
process_edit_form(mixed $ref, mixed $resource) : mixed
update_timestamp(mixed $resource) : mixed
Get resource file extension from the database or use JPG, for download
get_extension(array<string|int, mixed> $resource, string $size) : string
Preview size as defined in the system
Obtain details of the last resource edited in the given array of resource ids
get_last_resource_edit_array([array<string|int, mixed> $resources = array() ]) : array<string|int, mixed>|false
Array of resource IDs
Array containing details of last edit (resource ID, timestamp and username of user who performed edit)
Get the default archive state for new resources
get_default_archive_state([int $requestedstate = "" ]) : int
(optional) ID of requested archive state
ID of valid user requested archive state, may differ from that requested
Save the original file being replaced, as an alternative file
save_original_file_as_alternative(int $ref) : bool|int
(required) ID of original resource
int = id of new alternative file; false = file not saved
Replace the primary resource file with the file located at the path specified
replace_resource_file(int $ref, mixed $file_location[, mixed $no_exif = false ][, mixed $autorotate = false ][, mixed $keep_original = true ]) : bool
Resource ID to replace
Return all sizes available for a specific resource. Multi page resources should have each page size included as well in the output.
get_resource_all_image_sizes(int $ref) : array<string|int, mixed>
Resource ID
sanitize_date_field_input(mixed $date[, mixed $validate = false ]) : mixed
Create a temporary download key for a specific user or key and resource combination Used when both $watermark_open and $terms_download are enabled
download_link_generate_key(string $id, int $resource) : string
Key identifier e.g. user ID or external access key
Resource ID
Check the download key for a specific user/resource combination
download_link_check_key(string $download_key, int $resource) : string
Download key
Resource ID
Check if a given set of nodes meets the conditions set for the provided filter NOte that all resource_nodes for a resource should be passed to check if a filter is matched
filter_check(mixed $filterid, array<string|int, mixed> $nodes) : bool
Array of nodes
update_node_hitcount_from_search(mixed $resource, mixed $search) : mixed
copy_hitcount_to_live() : mixed
Returns a table of available image sizes for resource $ref. The standard image sizes are translated using $lang. Custom image sizes are i18n translated.
get_image_sizes(int $ref[, bool $internal = false ][, string $extension = "jpg" ][, bool $onlyifexists = true ]) : array<string|int, mixed>
The original image file assumes the name of the 'nearest size (up)' in the table
ID of resource
File extension of image
$return
Return an array of resource references that are related to resource $ref
get_related_resources(int $ref) : array<string|int, mixed>
ID of resource
Get available options for fixed list field types
get_field_options(int $ref[, bool $nodeinfo = false ][, bool $skip_translation = false ]) : array<string|int, mixed>|bool
Metadata field ref
Get full node details?
Do not translate node name. Only relevant if $nodeinfo=false
Array of field options, either as a simple array or with full node details
Get the resource data value for a field and a specific resource or get the specified field for all resources in the system
get_data_by_field(int $resource, int|string $field[, bool $flatten = true ]) : string|array<string|int, mixed>|Generator
Resource ID. Use NULL to retrieve all resources records for the specified field
Resource type field ID. Can also be a shortname.
Should a fixed list field value be flatten to a simple string? Set to FALSE to get the list of nodes
Generator is returned for the old behaviour of returning field data for all resources (for performance). Shouldn't be an issue as long as it's used in foreach loops
get_all_image_sizes([mixed $internal = false ][, mixed $restricted = false ]) : mixed
image_size_restricted_access(mixed $id) : mixed
Returns a list of fields with refs matching the supplied field refs.
get_fields(array<string|int, mixed> $field_refs[, bool $order_by_passed_refs = false ]) : array<string|int, mixed>
Array of field refs
get_hidden_indexed_fields() : mixed
get_OR_fields() : mixed
Returns the HTML necessary to represent a resource with the given extension when no image preview exists.
get_nopreview_html(string $extension[, int $resource_type = null ]) : string
File extension
Optional, the resource type of the resource, used to find an icon at the resource type level if an icon for this extension is not defined.
Gets all metadata fields, optionally for a specified array of resource types
get_resource_type_fields([array<string|int, mixed> $restypes = "" ][, string $field_order_by = "ref" ][, string $field_sort = "asc" ][, string $find = "" ][, array<string|int, mixed> $fieldtypes = array() ][, bool $include_inactive = false ]) : array<string|int, mixed>
Optional array of resource types to check
Order by column
Sort order
Parameter value to search for
List of field types to include
Should inactive resources be checked, default is false
notify_resource_change(mixed $resource) : mixed
add_verbatim_keywords(mixed &$keywords, mixed $string, mixed $resource_type_field[, mixed $called_from_search = false ]) : mixed
Check the current user's edit access to given metadata field ID
metadata_field_edit_access(int $field) : bool
Work out the filename to use, based on the download_filename_format configuration option, when downloading the specified resource file with the given settings
get_download_filename(int $ref, string $size, int $alternative, string $ext) : string
Resource ID
size code
Alternative file ID
File extension
Filename to use
Get resource type ID based on extension $mappings = array(resource_type_id => array(allowed_extensions));
get_resource_type_from_extension(string $extension, array<string|int, mixed> $resource_type_extension_mapping, int $default) : int
Example of mapping array: $mappings = array(2 => array('pdf', 'doc', 'docx', 'epub', 'ppt', 'pptx', 'odt', 'ods', 'tpl'));
Extension we search by (ie. "mp4")
Maps between resource types and extensions
The default value to use in case we can't find it the mappings
Resource type ID
Helper function for Preview tools feature. Checks all necessary permissions or options in order to tell the system whether PreviewTools panel should be displayed
canSeePreviewTools(array<string|int, mixed> $resource) : bool
Resource data structure
Helper function to determine if annotations are to be displayed.
canSeeAnnotationsFields() : array<string|int, mixed>
Array of annotation fields that can be viewed.
Determine if a video alternative was created from $ffmpeg_alternatives settings.
alt_is_ffmpeg_alternative(array<string|int, mixed> $alternative) : bool
Places in this file because get_resource_path relies on it
Record line from resource_alt_files
True means alternative was created from $ffmpeg_alternatives settings
Create a new resource type field with the specified name of the required type
create_resource_type_field(string $name[, int|array<string|int, mixed> $restype = 0 ][, int $type = FIELD_TYPE_TEXT_BOX_SINGLE_LINE ][, string $shortname = "" ][, bool $index = false ]) : bool|int
Check if user has view access to metadata field
metadata_field_view_access(int $field) : bool
Field ref
Utility to get all workflow states available in the system.
get_workflow_states() : array<string|int, mixed>
IMPORTANT: No permissions are being honoured on purpose! If you need to honour permissions @see get_editable_states()
get_workflow_state_names() : array<string|int, mixed>
Delete the specified metadata field. Also delets any node or resource_data rows associated with that field
delete_resource_type_field(int $ref) : bool|string
Metadata field id (ref from resource_type_field)
Returns true on success or text on failure describing error
get_resource_table_joins() : mixed
update_resource_lock(mixed $ref, mixed $lockaction[, mixed $newlockuser = null ][, mixed $accesschecked = false ]) : mixed
get_resource_lock_message(mixed $lockuser) : mixed
Get details of external shares
get_external_shares(array<string|int, mixed> $filteropts) : array<string|int, mixed>
Array of options to filter shares returned "share_group" - (int) Usergroup ref 'shared as' "share_user" - (int) user ID of share creator "share_order_by" - (string) order by column "share_sort" - (string) sortorder (ASC or DESC) "share_type" - (int) 0=view, 1=upload "share_collection" - (int) Collection ID "share_resource" - (int) Resource ID "access_key" - (string) Access key "ignore_permissions"- (bool) Show all shares, irrespective of permissions
Get video duration
get_video_duration(string $file_path) : float
Path to video file
Relate all resources in the passed array with each other
relate_all_resources([array<string|int, mixed> $related = [] ]) : bool
Array of resource IDs
Apply new order to metadata fields
update_resource_type_field_order(array<string|int, mixed> $neworder) : void
Field IDs in new order
Apply a new order to resource types
update_resource_type_order(array<string|int, mixed> $neworder) : void
Resource type IDs in new order
Check if file can be rendered in browser via download.php
allow_in_browser(string $path) : bool
Path to file
Update the value of the fieldXX field on resource table
update_resource_field_column(int $resource, int $field, string $value) : bool
Convert $data_joins (ie fieldX column) value to a user friendly version.
data_joins_field_value_translate_and_csv(string|null $value) : string|null
IMPORTANT: csv in this context simply means user defined separator values (relies on $field_column_string_separator).
Text value will be:-
Text to be processed
Process resource data_joins (ie fieldX columns) values
process_resource_data_joins_values(array<string|int, mixed> $resource, array<string|int, mixed> $resource_table_joins) : array<string|int, mixed>
A resource table record
List of refs for the resource table data_joins. get_resource_table_joins()
Returns the resource record with updated data_joins (ie fieldX columns) values
Check if resource has access denied by its type and for a size.
resource_has_access_denied_by_RT_size(int $resource_type, string $size) : bool
Resource type ref
Preview size ID (not ref).
Revert primary resource file based on log entry data
revert_resource_file(int $resource, array<string|int, mixed> $logentry[, bool $createpreviews = true ]) : bool
Resource ID
Log data from get_resource_log(). Requires rse_version plugin to be enabled
Create previews?
When changing resource type, new resource type specific fields may become available. This function will apply any resource default values for resource type specific fields that were not previously available (i.e. not containing user data). This is used by upload then edit mode after switching resource types and also when locking the resource type with save and next.
apply_resource_default(int $old_resource_type, int $new_resource_type, int $resource) : void
Original resource type.
Resource type being switched to.
Resource id.
Get a related resource to pull images from
related_resource_pull(array<string|int, mixed> $resource) : array<string|int, mixed>|bool
Array of resource data from do_search()
$resdata Array of alternative resource data to use, or false if not configured or no resource image found
Get the largest available preview URL for the given resource and the given array of sizes
get_resource_preview(array<string|int, mixed> $resource[, array<string|int, mixed> $sizes = [] ][, int $access = -1 ][, bool $watermark = false ][, int $page = 1 ][, bool $try_pulled_resource = true ][, int $alt = -1 ]) : array<string|int, mixed>|bool
Array of resource data from get_resource_data() or search results
Array of size IDs to look through, in order of size. If not provided will use all sizes
Resource access
Look for watermarked versions?
Page to look for
Should we try to use an image from a pulled resource if the current resource doesn't have a usable preview
Int ref of alternative file
array, or false if no image is found
Check integrity of primary resource files
check_resources([array<string|int, mixed> $resources = [] ][, bool $presenceonly = false ]) : array<string|int, mixed>
Array of resource data e.g. from search results
Check for file presence only? If false (and if $file_checksums is enabled) then file checksums will be checked
Array of resource IDs that have failed to verify
Get an array of all resources that require files to be validated
get_resources_to_validate([int $days = 0 ]) : array<string|int, mixed>
Return only resources not validated in the last X number of days
Access control check that user can edit (a resource) of a particular Resource Type (RT). Main use is to hide inapplicable RTs.
acl_can_edit_resource_of_type(int $ref) : bool
Resource type ID
Check if current user can upload a preview image
can_upload_preview_image(int $ref) : bool
Resource ID
Check if a resource has a file to derive previews from.
resource_has_preview_source(int $ref, string $extension[, int $alternative = -1 ]) : bool
Resource ID
Resource file extension
Alternative file record ID
Access control check that user can edit a resources 'Contributed by' field
acl_can_edit_contributed_by() : bool
Resolves the most commonly used keyword that sounds like the given keyword.
resolve_soundex(string $keyword) : string|false
This function attempts to find a keyword that phonetically matches the provided keyword using the Soundex algorithm. If no Soundex match is found, it will suggest the most commonly used keyword that starts with the same first few letters.
The keyword to resolve.
Returns the matched keyword if found, or false if no match is found.
Suggests search refinements based on common keywords from a set of resource references.
suggest_refinement(array<string|int, mixed> $refs, string $search) : array<string|int, mixed>
This function analyzes the provided array of resource references and the original search query. It identifies common keywords associated with the specified resources and suggests new search queries by appending these keywords to the original search query, provided they are not already included in it.
An array of resource references to analyze.
The original search query.
An array of suggested search refinements. Returns an empty array if no refinements can be suggested.
Retrieves a list of fields suitable for advanced searching.
get_advanced_search_fields([bool $archive = false ][, string $hiddenfields = "" ]) : array<string|int, mixed>
This function queries the database for resource type fields that are marked for advanced searching. It checks for visibility based on user permissions and whether the fields are hidden from the search. If a designated date field is specified and not already included in the results, it will be added to the beginning of the list if it matches the resource types of the other fields.
Whether to include fields related to archived resources. Defaults to false.
A comma-separated string of field references that should be hidden from the search.
An array of searchable fields that can be used in an advanced search form.
Retrieves a list of fields suitable for advanced searching within collections.
get_advanced_search_collection_fields([bool $archive = false ][, string $hiddenfields = "" ]) : array<string|int, mixed>
This function constructs an array of fields specifically related to collections, including collection title, keywords, and owner. It checks against a list of hidden fields to determine which fields should be included in the return array for advanced searching.
Whether to include fields related to archived collections. Defaults to false.
A comma-separated string of field references that should be hidden from the search.
An array of fields suitable for advanced searching in the context of collections.
Constructs a search query string from the posted search form data.
search_form_to_search_query(array<string|int, mixed> $fields[, bool $fromsearchbar = false ]) : string
This function takes the advanced search form fields and assembles them into a search query string that can be used for a standard search. It processes various input fields, including dates, keywords, and resource IDs, while respecting user permissions and field visibility settings.
An array of fields used in the search form.
Indicates if the search is initiated from a search bar.
The constructed search query string based on the input data.
Refines the search string to eliminate duplicates and ensure proper formatting.
refine_searchstring(string $search) : string
This function addresses several issues related to searching, including:
The original search string to be refined.
The refined search string, with duplicates removed and properly formatted.
Compiles a list of actions based on the provided top actions and search parameters.
compile_search_actions(bool $top_actions) : array<string|int, mixed>
This function generates an array of options for various actions that can be performed on search results, such as saving searches to collections, saving to dashboards, exporting results, editing resources, and running reports. The available actions depend on user permissions and specific conditions.
Indicates whether to include top actions in the options.
An array of action options, each containing value, label, data attributes, category, and order for sorting.
Constructs a SQL filter based on the provided search parameters.
search_filter(string $search, mixed $archive, string $restypes, int $recent_search_daylimit, mixed $access_override, bool $return_disk_usage[, bool $editable_only = false ][, int|null $access = null ][, bool $smartsearch = false ]) : PreparedStatementQuery
This function generates a prepared statement query that can be used to filter search results based on various criteria, including archive status, resource types, user permissions, and more. The function also takes into account user-specific access rights and other configurations to ensure that the returned resources meet the necessary visibility and editability criteria.
The search query string.
Archive states to filter by (can be a comma-separated string).
Resource types to include in the search.
Limit for filtering recent searches by creation date.
If set, overrides access restrictions.
Indicates whether to include disk usage information.
If true, only returns resources that are editable by the user.
The specific access level to filter by (if applicable).
If true, enables smart search features.
A prepared statement object containing the SQL query and parameters.
Processes special searches and constructs a corresponding SQL query.
search_special(string $search, PreparedStatementQuery $sql_join, int $fetchrows, string $sql_prefix, string $sql_suffix, string $order_by, string $orig_order, PreparedStatementQuery $select, PreparedStatementQuery $sql_filter, mixed $archive, bool $return_disk_usage[, bool $return_refs_only = false ][, bool $returnsql = false ]) : mixed
This function handles various special search commands (like viewing the last resources, resources with no downloads, duplicates, collections, etc.) and creates a prepared statement for the query that retrieves the desired resources based on the search parameters. It also incorporates user permissions and other configurations into the search logic.
The search string indicating the type of special search.
The SQL JOIN query to be applied.
The number of rows to fetch.
The prefix for the SQL query.
The suffix for the SQL query.
The order by clause for sorting the results.
The original order specified by the user.
The fields to select in the query.
The SQL WHERE filter to apply.
Archive states to filter by.
Indicates whether to return disk usage information.
If true, returns only resource references.
If true, returns the constructed SQL query instead of executing it.
The results of the special search or false if no special search was matched.
Function used to create a list of nodes found in a search string
resolve_nodes_from_string(string $string) : array<string|int, mixed>
IMPORTANT: use resolve_given_nodes() if you need to detect nodes based on search string format (ie. @@253@@255 and/ or @@!260)
Utility function which helps rebuilding a specific field search string from a node element
rebuild_specific_field_search_from_node(array<string|int, mixed> $node) : string
A node element as returned by get_node() or get_nodes()
search_get_previews(mixed $search[, mixed $restypes = "" ][, mixed $order_by = "relevance" ][, mixed $archive = 0 ][, mixed $fetchrows = -1 ][, mixed $sort = "DESC" ][, mixed $access_override = false ][, mixed $ignore_filters = false ][, mixed $return_disk_usage = false ][, mixed $recent_search_daylimit = "" ][, mixed $go = false ][, mixed $stats_logging = true ][, mixed $return_refs_only = false ][, mixed $editable_only = false ][, mixed $returnsql = false ][, mixed $getsizes = array() ][, mixed $previewextension = "jpg" ]) : mixed
get_upload_here_selected_nodes(mixed $search, array<string|int, mixed> $nodes) : mixed
get the default archive states to search
get_default_search_states() : array<string|int, mixed>
Get the required search filter sql for the given filter for use in do_search()
get_filter_sql(mixed $filterid) : PreparedStatementQuery
split_keywords(mixed $search[, mixed $index = false ][, mixed $partial_index = false ][, mixed $is_date = false ][, mixed $is_html = false ][, mixed $keepquotes = false ][, bool $preserve_separators = false ]) : mixed
Removes characters from a string, for example full stops, prior to keyword splitting - {@see split_keywords()}.
cleanse_string(string $string, bool $preserve_separators[, bool $for_search = false ]) : string
Also makes the string lower case ready for indexing.
Text value which needs to be pre-processed
Set to false to separate keywords when specifying multiple field/keyword pairs (comma and colon)
Set to true if you need certain characters to be preserved during a search (e.g. the wildcard or minus for NOT searches).
Resolve keyword
resolve_keyword(string $keyword[, bool $create = false ][, bool $normalize = true ][, bool $stem = true ]) : int|bool
The keyword to resolve
If keyword not found, should we create it instead?
Should we normalize the keyword before resolving?
Should we use the keywords' stem when resolving?
Returns the keyword reference for $keyword, or false if no such keyword exists.
Generates a list of keywords for indexing, including all possible infixes for each keyword in the provided list.
add_partial_index(array<string|int, mixed> $keywords) : array<string|int, mixed>
This function processes each keyword and, for those without spaces, adds all possible infixes of a specified minimum length to the return array. The resulting array is suitable for indexing in fields that have partial indexing enabled.
An array of keywords to process for partial indexing.
An array of keywords, each with its associated position in the original list.
Suggests complete existing keywords based on a partial search term.
get_suggested_keywords(string $search[, string $ref = "" ]) : array<string|int, mixed>
This function fetches keywords that match the given partial word, returning suggestions from the keyword database. It also considers user permissions by excluding indexed fields that are hidden from the user. Additionally, it can restrict results to a specific resource type field.
The partial keyword to search for.
(optional) The resource type field to restrict suggestions to.
An array of suggested keywords matching the search criteria.
Retrieves keywords related to a given keyword reference.
get_related_keywords(int $keyref) : array<string|int, mixed>
This function checks a cache for related keywords associated with the provided keyword reference. If not found in the cache, it queries the database for related keywords. The relationship can be one-way or bidirectional based on the configuration. It returns an array of related keyword references.
The reference ID of the keyword for which to find related keywords.
An array of related keyword references.
Retrieves keywords and their related keywords, optionally filtered by specific keywords.
get_grouped_related_keywords([string $find = "" ][, string $specific = "" ]) : array<string|int, mixed>
This function returns a list of keywords along with their related keywords grouped together. It can filter the results based on the provided keyword or specific keyword string. The related keywords are returned as a comma-separated string.
An optional keyword to find related keywords for. If specified, it filters the results to include only the related keywords for this keyword.
An optional specific keyword to find. If specified, it filters the results to include only the related keywords for this specific keyword.
An array of keywords and their related keywords grouped together.
Saves the related keywords for a specified keyword.
save_related_keywords(string $keyword, string $related) : bool
This function first resolves the keyword reference for the provided keyword. It then deletes any existing relationships for that keyword and inserts the new related keywords into the database.
The keyword for which related keywords are being saved.
A comma-separated string of related keywords to associate with the specified keyword.
Returns true on success, or false on failure.
Retrieves a list of fields suitable for the simple search box.
get_simple_search_fields() : array<string|int, mixed>
This function gathers all resource type fields that are marked for simple search usage. It includes standard fields and custom fields that have their titles translated. It ensures that only fields with appropriate permissions and those that are either indexed or of a fixed list type are included in the returned array.
An array of fields suitable for simple search, including their titles and other properties, filtered by permissions and search capabilities.
Retrieves a list of fields/properties suitable for search display based on the provided field references.
get_fields_for_search_display(array<string|int, mixed> $field_refs) : array<string|int, mixed>
An array of field references to filter the search display fields.
An array of fields with their properties, including translated titles, that are visible to the user based on permission checks.
Get all defined filters (currently only used for search)
get_filters([string $order = "ref" ][, string $sort = "ASC" ][, string $find = "" ]) : array<string|int, mixed>
column to order by
sort order ("ASC" or "DESC")
text to search for in filter
Get filter summary details
get_filter(int $filterid) : array<string|int, mixed>
ID of filter (from usergroup search_filter_id or user search_filter_oid)
Get filter rules for use in search
get_filter_rules(int $filterid) : array<string|int, mixed>
ID of filter (from usergroup search_filter_id or user search_filter_oid)
Get filter rule
get_filter_rule(int $ruleid) : array<string|int, mixed>
Save filter, will return existing filter ID if text matches already migrated
save_filter(int $filter, int $filter_name, int $filter_condition) : bool|int
Save filter rule, will return existing rule ID if text matches already migrated
save_filter_rule(int $filter_rule, int $filterid, mixed $rule_data) : bool|int
Delete specified filter
delete_filter(int $filter) : bool|array<string|int, mixed>
of users/groups using filter
Delete specified filter_rule
delete_filter_rule(mixed $filter_rule) : bool|int
Copy specified filter_rule
copy_filter(int $filter) : bool|int
Add POST/GET parameters into search string. Moved from pages/search.php
update_search_from_request(string $search) : string
Existing search string without params added
Updated string with params added
Retrieves the default resource types for search functionality.
get_search_default_restypes() : array<string|int, mixed>
This function determines which resource types to include in the search based on the global settings for resource and theme inclusion. If resources are to be included, it checks the default resource types and returns them as an array. If no specific default resource types are defined, it defaults to including "Global." If resources are not to be included, it defaults to "Collections," and if themes are included, "FeaturedCollections" is also added.
An array of default resource types to be used in the search.
Retrieves the selected resource types for the search functionality.
get_selectedtypes() : array<string|int, mixed>
An array of selected resource types for the search.
Renders the buttons for the advanced search form.
render_advanced_search_buttons() : void
This function generates HTML for two buttons: one to reset the search form and clear the submitted search criteria, and another to execute the search.
This function outputs HTML directly and does not return a value.
If a "fieldX" order_by is used, check it's a valid value.
check_order_by_in_table_joins(mixed $order_by) : string
Where the value is invalid, the default 'resourceid' will be used instead.
Order by string if valid else default 'resourceid'
Get collection total resource count for a list of collections
get_collections_resource_count(array<string|int, mixed> $refs) : array<string|int, mixed>
List of collection IDs
Returns table of collections and their total resource count (taking into account access controls). Please note that the returned array might NOT contain keys for all the input IDs (e.g validation failed).
Get all search request parameters. Note that this does not escape the parameters which must be sanitised using e.g. htmlspecialchars() or urlencode() before rendering on page
get_search_params() : mixed
Helper function to check a string is not just the asterisk.
is_not_wildcard_only(string $str) : bool
The string to be checked.
Convert node searches into a friendly syntax. Used by search_title_processing.php
search_title_node_processing(string $string) : string
Search string
Allow $fetchrows as supplied to do_search() to support an integer or array. If integer then search will recieve the number of rows with no offset.
setup_search_chunks(int|array<string|int, mixed> $fetchrows, int &$chunk_offset, int &$search_chunk_size) : void
If array then search will receive the number of rows to return and an offset allowing for chunking of results. $chunk_offset[0] is the offset of the first row to return. $chunk_offset[1] is the number of rows to return in the batch. $chunk_offset[0] will normally be 0 in the first search, increasing by $chunk_offset[1] for each search, generated by an external looping structure. This allows for batches of $chunk_offset[1] search results up to the total size of the search. For an example pages/csv_export_results_metadata.php. This approach can be used to avoid particularly large searches exceeding the PHP memory_limit when processing the data in ps_query().
$fetchrows value passed from do_search() / search_special(). See details above.
Starting position for offset. Default is 0 if none supplied i.e. $fetchrows is int.
Number of rows to return.
Log which keywords are used in a search
log_keyword_usage(array<string|int, mixed> $keywords, mixed $search_result) : mixed
refs of keywords used in a search
Validate and set the order_by for the current search from the requested values passed to do_search()
set_search_order_by(string $search, string $order_by, string $sort) : string
Escape and process a string from ResourceSpace search syntax to regex syntax Wildcards are replaced with '.*?' - any character 0 or more times Multiple keyword matches are split into an OR group Word boundaries are added to avoid unintended wildcards.
prepare_regex_search_string(string $keyword) : string
Keyword string without any field names or special search strings
Processed string ready for RLIKE searches
Utility converter between sumitted date input and ResourceSpace search query
convert_search_form_date_to_search_query(array{ref: int, name: string, type: int} $field[, array{html_field_name?: string} $ctx = [] ]) : string
Field information relevant for the submitted data
The constructed search query string (based on the input/submitted data).
Create/ Update a slideshow image record. Use NULL for $ref to create new records.
set_slideshow(int $ref[, int $resource_ref = null ][, int $homepage_show = 1 ][, int $login_show = 0 ]) : bool|int
ID of the slideshow image. Use NULL to create a new record
ID of the resource this slideshow is related to. Use NULL if no link is required
Set to 1 if slideshow image should appear on the home page
Set to 1 if slideshow image should appear on the login page
Returns ID of the slideshow image(new/ updated), FALSE otherwise
Delete slideshow record
delete_slideshow(int $ref) : bool
ID of the slideshow
Function used to re-order slideshow images
reorder_slideshow_images(array<string|int, mixed> $from, array<string|int, mixed> $to) : bool
Slideshow image data we move FROM
Slideshow image data we move TO
Get the full path for the slideshow image file
get_slideshow_image_file_path(int $ref) : string
ID of the slideshow image
The full path to the slideshow image
Access control check if user is allowed to manage system tabs.
acl_can_manage_tabs() : bool
Get entire tab records for a list of IDs
get_tabs_by_refs(array<string|int, mixed> $refs) : array<string|int, mixed>
List of tab refs
Get tabs (paged) based on some criteria (currently only order by and limit).
get_tabs_with_usage_count(array<string|int, mixed> $criteria) : array<string|int, mixed>
Array holding criteria information (order_by and limit).
Get all tab records, sorted by the order_by column
get_all_tabs() : array<string|int, mixed>
Get list of all tabs sorted based on current configuration. This always adds a fake record (ref #0) to indicate no assignment.
get_tab_name_options() : array<string|int, mixed>
Key is the tabs' ID and value its translated name.
Sort list of tab names (preserving their key ID)
sort_tabs_as_configured(array<string|int, mixed> $tabs) : array<string|int, mixed>
List of tab ID and tab translated name pairs
Create a new system tab record NOTE: order_by should only be set when re-ordering the set by the user. {@see sql_reorder_records('tab', $refs)}
create_tab(array<string|int, mixed> $tab) : bool|int
Return new tab record ID or FALSE otherwise
Delete system tabs.
delete_tabs(array<string|int, mixed> $refs) : bool
IMPORTANT: never allow the "Default" tab (ref #1) to be deleted because this is the fallback location for information that has no association with other tabs.
List of tab IDs
Returns TRUE if it executed the query, FALSE otherwise
Update an existing tab.
save_tab(array<string|int, mixed> $tab) : bool
NOTE: order_by should only be set when re-ordering the set by the user. sql_reorder_records('tab', $refs)
A tab record (type)
Returns TRUE if it executed the query, FALSE otherwise
Generates a random JPEG image for a given resource with random background color and text.
resource_random_jpg(int $resource, int $width, int $height) : bool
This function creates an image of specified dimensions with a random background color and text indicating the resource reference. The image is then saved to the resource's designated path and also triggers the creation of previews for the resource.
The reference ID of the resource for which the image is being created.
The width of the generated image in pixels.
The height of the generated image in pixels.
Returns true on success, indicating that the image was created and saved successfully.
Generate a random image which can be used during testing (e.g to upload, or create previews for)
create_random_image(array<string|int, mixed> $info) : array<string|int, mixed>
Set image parameters:
Returns an "error" key if something went wrong, otherwise provides some useful info (e.g path)
Generate a random video which can be used during testing (e.g to upload, or create previews for)
create_random_video(array<string|int, mixed> $info) : array<string|int, mixed>
Set video parameters:
Returns an "error" key if something went wrong, otherwise provides some useful info (e.g path)
Debug logs for ResourceSpace automated tests
test_log(string $msg) : void
Get the test files' ID (from its file name)
test_get_file_id(string $file) : int
Validate user - check we have a valid user based on SQL criteria e.g. session that is passed in as $user_select_sql Will always return false if matches criteria but the user account is not approved or has expired
validate_user(object $user_select_sql[, bool $getuserdata = true ]) : bool|array<string|int, mixed>
$user_select_sql example u.session=$variable. Joins to usergroup table as g which can be used in criteria
PreparedStatementQuery instance - to validate user usually session hash or key
default true. Return user data as required by authenticate.php
Given an array of user data loaded from the user table, set up all necessary global variables for this user including permissions, current collection, config overrides and so on.
setup_user(array<string|int, mixed> $userdata) : bool
Array of user data obtained by validate_user() from user/usergroup tables
success/failure flag - used for example to prevent certain users from making API calls
Returns a user list. Group or search term is optional. The standard user group names are translated using $lang. Custom user group names are i18n translated.
get_users([int $group = 0 ][, string $find = "" ][, string $order_by = "u.username" ][, bool $usepermissions = false ][, int $fetchrows = -1 ][, string $approvalstate = "" ][, bool $returnsql = false ][, string $selectcolumns = "" ][, bool $exact_username_match = false ]) : array<string|int, mixed>|object
Can be a single group, or a comma separated list of groups used to limit the results If blank, zero or NULL then all users will be returned irrespective of their group
Search string to filter returned results
Return prepared statement object containing sql query and parameters.
Denotes $find must be an exact username
Matching user records Returns an array of user information or prepared statement object containing sql query and parameters.
Returns all the users who have the permission $permission.
get_users_with_permission(string $permission) : array<string|int, mixed>
The standard user group names are translated using $lang. Custom user group names are i18n translated.
The permission code to search for
Matching user records
Retrieve user records by e-mail address
get_user_by_email(string $email) : array<string|int, mixed>
The e-mail address to search for
Matching user records
Retrieve user ID by username
get_user_by_username(string $username) : mixed
The username to search for (will match email if not found)
The matching user ID or false if not found
Returns a list of user groups. The standard user groups are translated using $lang. Custom user groups are i18n translated.
get_usergroups([bool $usepermissions = false ][, string $find = '' ][, bool $id_name_pair_array = false ]) : array<string|int, mixed>
Puts anything starting with 'General Staff Users' - in the English default names - at the top (e.g. General Staff).
Use permissions (user access)
Search string
Return an array of ID->name instead of full records
Matching user group records
Returns the user group corresponding to the $ref. A standard user group name is translated using $lang. A custom user group name is i18n translated.
get_usergroup(int $ref) : mixed
User group ID
False if not found, or the user group record if found.
Return the user group record matching $ref
get_user(int $ref) : array<string|int, mixed>|bool
Function used to update or delete a user.
save_user(string $ref[, array<string|int, mixed> $data = [] ]) : bool|string
Note: data is taken from the submitted form
ID of the user
Data to save (optional, will use posted data otherwise)
True if successful or a descriptive string if there's an issue
E-mail the user the welcome message on account creation.
email_user_welcome(string $email, string $username, int $usergroup) : void
Email password reset link to the user
email_reset_link(string $email[, string $newuser = false ]) : bool|string
Email address of user
Is this a new user account? If so a welcome message template will be used
true if success or error message
Automatically creates a user account The request can be auto approved if $auto_approve_accounts is true Otherwise the approval is managed by admins via notification messages and/or emails
auto_create_user_account([string $hash = "" ]) : bool
Success?
Send user request to admins in form of notification messages and/or emails Send email confirmation to requesting user
email_user_request() : bool
Check to see if the user limit has been reached.
user_limit_reached() : bool
Create a new user *
new_user(string $newuser[, int $usergroup = 0 ]) : bool|int
Returns a list of active users
get_active_users() : array<string|int, mixed>
Sets a new password for the current user.
change_password(string $password) : mixed
True if a success or a descriptive string if there's an issue.
Generate a password using the configured settings.
make_password() : string
The generated password
Send a bulk e-mail using the bulk e-mail tool.
bulk_mail(string $userlist, string $subject, string $text[, string $html = false ][, int $message_type = MESSAGE_ENUM_NOTIFICATION_TYPE_EMAIL ][, string $url = "" ]) : string
The empty string if all OK, a descriptive string if there's an issue.
Returns a user action log for $user.
get_user_log(int $user[, int $fetchrows = -1 ]) : array<string|int, mixed>
Standard field titles are translated using $lang. Custom field titles are i18n translated.
How many rows to fetch?
Given an array or comma separated user list (from the user select include file) turn all Group: entries into fully resolved list of usernames.
resolve_userlist_groups(string|array<string|int, mixed> $userlist) : string
Note that this function can't decode default groupnames containing special characters.
The resolved list
Given a comma separated user list (from the user select include file) turn all Group: entries into fully resolved list of usernames.
resolve_userlist_groups_smart(string $userlist[, bool $return_usernames = false ]) : string
Note that this function can't decode default groupnames containing special characters.
The resolved list
Remove smart lists from the provided user lists.
remove_groups_smart_from_userlist(string|array<string|int, mixed> $ulist) : string
Comma separated list of user list names
The updated list with smart groups removed.
Checks that a password conforms to the configured paramaters.
check_password(string $password) : mixed
The password
True if OK, or a descriptive string if it isn't
For a given comma-separated list of user refs (e.g. returned from a group_concat()), return a string of matching usernames.
resolve_users(string $users) : string
User list - caution, used directly in SQL so must not contain user input
Matching usernames.
Verify a supplied external access key
check_access_key(array<string|int, mixed>|int $resources, string $key[, bool $checkcollection = true ][, bool $is_category = false ]) : bool
Resource ID | Array of resource IDs
The external access key
Check collection access key? true by default but required to prevent infinite recursion
True if checking featured collection category. Silently checks collection resources by preventing excessive updating of external_access_keys. Resource keys will update if collection viewed later.
Valid?
Check access key for a collection. For a featured collection category, the check will be done on all sub featured collections.
check_access_key_collection(int $collection, string $key[, bool $checkresource = true ]) : bool
Collection ID
Access key
Check for resource access key? true by default but required to prevent infinite recursion
Generates a unique username for the given name
make_username(string $name[, string $email = "" ]) : string
The user's full name
Optional email address
The username to use
Returns a list of user groups selectable in the registration . The standard user groups are translated using $lang. Custom user groups are i18n translated.
get_registration_selectable_usergroups() : array<string|int, mixed>
Give the user full access to the given resource. Used when approving requests.
open_access_to_user(int $user, int $resource, string $expires) : bool
Give the user full access to the given resource. Used when approving requests.
open_access_to_group(int $group, int $resource, string $expires) : bool
Grants open access to the user list for the specified resource.
resolve_open_access(string $userlist, int $resource, string $expires) : void
Remove any user-specific access granted by an 'approve'. Used when declining requests.
remove_access_to_user(int $user, int $resource) : bool
Returns true if a user account exists with e-mail address $email
user_email_exists(string $email) : bool
Return an array of emails from a list of usernames and email addresses.
resolve_user_emails(array<string|int, mixed> $user_list) : array<string|int, mixed>
with 'key_required' sibling array preserving the intent of internal/external sharing
Finds all users with matching email and marks them as having an invalid email
mark_email_as_invalid(string $email) : bool
Checks if the email entered is marked as invalid for any users
check_email_invalid(string $email) : bool
true if email is marked invalid for any users with matching email address
Creates a reset key for password reset e-mails
create_password_reset_key(string $username) : string
The user's username
The reset key
For anonymous access - a unique session key to identify the user (e.g. so they can still have their own collections)
get_rs_session_id([bool $create = false ]) : mixed
Create one if it doesn't already exist
False on failure, the key on success
Returns an array of users (refs and emails) for use when sending email notifications (messages that in the past went to $email_notify, which can be emulated by using $email_notify_usergroups)
get_notification_users([string $userpermission = "SYSTEM_ADMIN" ][, int|null $usergroup = null ]) : array<string|int, mixed>
Can be passed a specific user type or an array of permissions Types supported:- SYSTEM_ADMIN RESOURCE_ACCESS RESEARCH_ADMIN USER_ADMIN RESOURCE_ADMIN
Permission string
Optional id of usergroup to find notification users for e.g. the parent group of new user or as defined in $usergroup_approval_mappings
Validates the user entered antispam code
verify_antispam([string $spamcode = "" ][, string $usercode = "" ][, string $spamtime = 0 ]) : bool
The antispam hash to check against
The antispam code the user entered
The antispam timestamp
Return true if the code was successfully validated, otherwise false
Check that access for given external share key is correct
check_share_password(array<string|int, mixed> $key, string $password, string $cookie) : bool
External access key
Share password to check
Share session cookie that has been set previously
Offset a datetime to user local time zone
offset_user_local_timezone(string $datetime, string $format) : string
IMPORTANT: the offset is fixed, there is no calculation for summertime!
A date/time string. @see https://www.php.net/manual/en/datetime.formats.php
The format of the outputted date string. @see https://www.php.net/manual/en/function.date.php
The date in the specified format
Returns whether a user is anonymous or not
checkPermission_anonymoususer() : bool
Does the current user have the ability to administer the dash (the tiles for all users)
checkPermission_dashadmin() : bool
Can the user manage their own dash tiles.
checkPermission_dashuser() : bool
Can the user manage their dash?
checkPermission_dashmanage() : bool
Logic: Home_dash is on, And not the Anonymous user with default dash, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
Can the user create tiles?
checkPermission_dashcreate() : bool
Logic: Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
Check that the user has the $perm permission
checkperm(string $perm) : bool
Do they have the permission?
Check if the current user is allowed to edit user with passed reference
checkperm_user_edit(int $user) : bool
The user to be edited
Check if the current user has sufficient permissions to log in as the specified user
checkperm_login_as_user(mixed $user) : bool
The regex used is to check if the a permission is present in the permission string of the target user
Either a user reference or user array
Determine if this is an internal share access request
internal_share_access() : bool
Save changes to a usergroup or create usergroup
save_usergroup(int $ref, array<string|int, mixed> $groupoptions) : mixed
Group ref. Set to 0 to create a new group
array of options to set for group in the form array("columnname" => $value)
bool|int True to indicate existing group has been updated or ID of newly created group
Copy the permissions string from another usergroup
copy_usergroup_permissions(int $src_id, int $dst_id) : mixed
The group ID to copy from
The group ID to copy to
bool|int True to indicate existing group has been updated or ID of newly created group
Set user's profile image and profile description (bio). Used by ../pages/user/user_profile_edit.php to setup user's profile.
set_user_profile(int $user_ref, string $profile_text, string $image_path) : bool
User id of user who's profile is being set.
User entered profile description text (bio).
Path to temp file created if user chose to upload a profile image.
If an error is encountered saving the profile image return will be false.
Delete a user's profile image. This will first remove the file and then update the db to clear the existing value.
delete_profile_image(mixed $user_ref) : void
User id of the user who's profile image is to be deleted.
Generate the url to the user's profile image. Fetch the url by the user's id or by the profile image filename.
get_profile_image([int $user_ref = "" ][, string $by_image = "" ]) : string
User id of the user who's profile image is requested.
The filename of the profile image to fetch having been collected from the db separately: user.profile_image
The url to the user's profile image if available or blank if not set.
Return user profile for a defined user.
get_profile_text(int $user_ref) : string
User id to fetch profile details for.
Profile details for the requested user.
load language files for all users that need to be notified into an array - use for message and email notification load in default language strings first and then overwrite with preferred language strings
get_languages_notify_users([array<string|int, mixed> $languages = array() ]) : array<string|int, mixed>
$language_strings_all
Generate upload URL - alters based on $upload_then_edit setting and external uploads
get_upload_url([string $collection = "" ][, mixed $k = "" ]) : string
Used to emulate system users when accessing system anonymously or via external shares Sets global array such as $userpermissions, $username and sets any relevant config options
emulate_user(int $user[, int $usergroup = "" ]) : void
User ID
usergroup ID
is_authenticated() : mixed
Returns an array of the user groups the supplied user group acts as an approver for.
get_approver_usergroups([int $usergroup = "" ]) : array<string|int, mixed>
Uses config $usergroup_approval_mappings.
Approving user group
Array of subordinate user group ids.
Returns an array of user groups who act as user request approvers to the user group supplied.
get_usergroup_approvers([int $usergroup = "" ]) : array<string|int, mixed>
Uses config $usergroup_approval_mappings.
Subordinate user group who's approval user group we need to find.
Approval user group ids for supplied user group. Likely one value but its possible to have multiple approving groups.
Retrieve all user records in groups with/without the specified permissions
get_users_by_permission(array<string|int, mixed> $permissions) : array<string|int, mixed>
array of permission strings to check
Matching user records (only returns a subset of columns)
Note that this can't use a straight FIND_IN_SET for permissions since that is case insensitive
Determine whether user is anonymous user
is_anonymous_user() : bool
Retrieve all user records with the user preference specified
get_users_by_preference(string $preference, string $value) : array<string|int, mixed>
Preference to check
Preference value to check for
Array of user refs with the preference set as specified
Get the default notification workflow states for the current user. Used by setup_user() and get_user_actions() if no user preference has been set
get_default_notify_states() : array<string|int, mixed>
Array of workflow state references
Generate a temporary download key for user. Used to enable temporary resource access to a file via download.php so that API can access resources after calling get_resource_path()
generate_temp_download_key(int $user, int $resource, string $size) : string
User ID
Resource ID
Download size to access.
Access key - empty if not permitted
Validate the provided download key to authenticate a download or override an access check.
validate_temp_download_key(int $ref, string $keystring, string $size[, int $expire_seconds = 0 ][, bool $setup_user = true ]) : bool
Resource ID
Key string - includes a nonce prefix
Download size to access.
Optional parameter to set specified expiry time in seconds. Use 0 to set system default.
Set to false where there is no need to initialise the user.
Set up a dummy user with required permissions etc. to pass permission checks if running scripts from the command line
setup_command_line_user([array<string|int, mixed> $setoptions = [] ]) : bool
Update user table to record access by a user
update_user_access([int $user = 0 ][, array<string|int, mixed> $set_values = [] ]) : bool
User ID
Optional array of column names and values to set
Check if the user can manage users.
checkPermission_manage_users() : bool
Get the processing status message for the current user.
get_processing_message() : false|array<string|int, mixed>
set_processing_message(string $message) : mixed
Consider if the current user is able to escalate the permissions of a user to the level of a "super admin".
can_set_admin_usergroup(int $new_usergroup) : bool
Only users with "a" permission should be able to make other users super admins (user groups with "a" permission). Also used to determine if "super admin" level user groups should be displayed.
ID of user group to be set
Checks if the origin matches a whitelist entry, supporting wildcards like "*.example.com".
cors_is_origin_allowed(string $origin, array<string|int, mixed> $whitelist) : bool
@param string $origin The URL to check.
Array of valid URLs - can include wildcards. @return bool True if the origin is allowed, false otherwise.
Delete a user group and associated records.
delete_usergroup(int $usergroup_ref) : bool
Check that this is a real browser by executing JS to set an expected cookie.
browser_check() : mixed
Obfuscates a string using a fixed XOR pattern and encodes it in Base64.
xor_base64_encode(string $str) : string
This function performs a basic transformation by XOR-ing each character of the input with a repeating fixed byte pattern, then encodes the result in Base64. Designed to be mirrored easily in JavaScript for lightweight bot detection.
The input string to obfuscate.
The Base64-encoded, XOR-obfuscated string.
Load site text for a user group. To preserve the original state of global language values, this function will always revert previous changes first.
load_site_text_for_usergroup(int $group) : void
$usergroup value. Normally int however maybe null for activity before login e.g. load user group site text for an activity by supplying a user group id and then return to the defaults by supplying null.
Get video resolution and framerate using FFMpeg
get_video_resolution(string $file) : array<string|int, mixed>
Path to video file
Generate HTML to display subtitles in playback of a video resource.
display_video_subtitles(int $ref, int $access) : void
Resource ID
Resource access level - e.g. 0 for open access
Generate JSON array of VideoJS options to be used in the data-setup attribute
generate_videojs_options(bool $view_as_gif, bool $play_on_hover, array<string|int, mixed> $video_preview_sources) : string|false
True if the video is a GIF file
True if playing video on hover
Array of preview sources, including URL, type and label
HookAction_datesAllInitialise() : mixed
HookAction_datesCronCron() : mixed
HookAction_datesCron_copy_hitcountCron() : mixed
HookAdobe_linkAllInitialise() : mixed
HookAdobe_linkDownloadProvideusercredentials() : mixed
HookAdobe_linkDownloadCookies_notification_bypass() : mixed
HookAdobe_linkDownloadBlockwatermark() : mixed
HookAdobe_linkDownloadAllow_in_browser(mixed $permitted_mime) : mixed
HookAdobe_linkUpload_batchProvideusercredentials() : mixed
HookAdobe_linkUpload_batchCookies_notification_bypass() : mixed
HookAdobe_linkUpload_batchModify_upload_file(mixed $filename, mixed $filepath) : mixed
Replace download links with code to support importing resources into Adobe CC
HookAdobe_linkViewBefore_footer_always() : mixed
HookAdobe_linkViewDownloadbuttonreplace() : mixed
HookAdobe_linkViewOrigdownloadlink() : mixed
HookAdobe_linkViewReplacepreviewlink(string $preview_title) : mixed
adobe_link_genkey(mixed $user, mixed $resource) : mixed
adobe_link_check_credentials() : mixed
HookApi_webhooksEditExtra_edit_buttons() : mixed
HookApi_webhooksEditRedirectaftersave() : mixed
HookApi_webhooksEditUploadreviewabortnext() : mixed
HookApi_webhooksEditRedirectaftersavetemplate() : mixed
HookAutoassign_mrequestsAllAutoassign_individual_requests(mixed $user_ref, mixed $collection_ref, mixed $message, mixed $manage_collection_request) : mixed
HookAutoassign_mrequestsAllAutoassign_collection_requests(mixed $user_ref, mixed $collection_data, mixed $message, mixed $manage_collection_request) : mixed
HookAutoassign_mrequestsAllBypass_end_managed_collection_request(mixed $manage_individual_requests, mixed $collection_id, mixed $request_query, mixed $message, mixed $templatevars, mixed $assigned_to_user, mixed $admin_mail_template, mixed $user_mail_template) : mixed
HookAutoassign_mrequestsAllExport_add_tables() : mixed
HookAutoassign_mrequestsAllOn_delete_user(mixed $ref) : mixed
get_mapped_fields() : mixed
get_mapped_user_by_field(mixed $id, mixed $value) : mixed
HookBrand_guidelinesAdmin_group_permissionsAdditionalperms() : mixed
HookBrand_guidelinesAllInitialise() : mixed
HookBrand_guidelinesAllHandleuserref() : mixed
Render decorator of custom fields used by Brand Guidelines
HookBrand_guidelinesContentRender_custom_fields_default_case_override(array<string|int, mixed> $field) : bool
Custom field structure - process_custom_fields_submission()
Returns true to indicate to ResourceSpace that the core render functionality is being overriden by the plugin (for this field type), false otherwise.
Validate custom fields' submitted input.
HookBrand_guidelinesContentProcess_custom_fields_submission_validator(array<string|int, mixed> $field) : false|string
Return custom fields' type input validation error or false to let ResourceSpace core handling to run.
Ensure we always pass along the Brand Guidelines callback URL, if one was provided.
HookBrand_guidelinesEditEditbeforeheader() : void
Hooks onto the upload review workflow (for upload then edit mode) when "save and next" is carried out and adds the first resource ID (which is supposed to be the last uploaded resource, for brand guidelines) to the manage content callback (redirect URL).
HookBrand_guidelinesEditUploadreviewabortnext() : bool
Hooks onto the edit then upload mode and changes the redirect URL to the provided callback. This will allow the upload_batch page to use it once the file upload has finished.
HookBrand_guidelinesEditRedirectaftersavetemplate() : bool
HookBrand_guidelinesGuidelinesExtra_videojs_content_html(array<string|int, mixed> $ctx) : mixed
Ensure we always pass along the Brand Guidelines callback URL, if one was provided.
HookBrand_guidelinesUpload_batchModify_redirecturl() : mixed
IMPORTANT: Directly within Javascript world on the upload_batch page!
HookBrand_guidelinesUpload_batchPostUploadActions_before_csl_redirurl_js() : void
Complements the following hooks:
HookClipAdmin_group_permissionsAdditionalperms() : mixed
HookClipAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixed
HookClipAllSearch_pipeline_setup(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixed
HookClipAllSearchbarafterbuttons() : mixed
Runs vector generation automatically after preview creation, if configured.
HookClipAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : void
This function is triggered after a resource's preview image has been generated. If configured, it will perform CLIP generation on the main resource file (ignoring alternative files). Progress messages are displayed during processing.
The resource reference ID that has just had previews created.
The alternative file ID, or -1 if processing the main resource.
Flag to indicate if hook has been triggered during full preview creation process
HookClipAllCron() : mixed
HookClipAllBeforedeleteresourcefromdb(mixed $ref) : mixed
Hook into offline jobs list to add custom job
HookClipAllAddtriggerablejob() : array<string|int, mixed>
Array of existing job data with custom job added
HookClipSearchSearch_header_after_actions() : mixed
HookClipViewCustompanels() : mixed
Sends an image file or text input to the CLIP vector service and returns the resulting vector.
get_vector(bool $is_text, string $input, int $ref) : array<string|int, mixed>|false
Whether the input is text (true) or an image file (false).
Either the text string or the path to the image file.
The resource ID (used for logging/debugging purposes only).
Returns a 512-float array representing the CLIP vector, or false if the service failed or returned invalid data.
Generates a simple visual representation of a CLIP vector as a 64-character string. This helps visualise differences between vectors in a human-readable form.
vector_visualise(array<string|int, mixed> $vector) : string
A 512-element array of float values (normalised CLIP vector).
A 64-character string "fingerprint" visualising the vector content.
Generates and stores a CLIP vector for a given resource.
clip_generate_vector(int $ref) : bool
This function:
The resource ID for which to generate the vector.
Returns true on success, or false on failure (e.g., file missing or vector generation error).
Auto-tags and titles a resource using CLIP vector search.
clip_tag(int $resource) : bool
This function sends the resource ID to the external CLIP-based Python service to retrieve suggested keywords and a title based on the resource's content.
It populates:
Global configuration variables (all available on the plugin's setup page)
Resource ID to tag and title.
Always returns true after processing.
clip_generate_missing_vectors(mixed $limit) : mixed
Returns a count of vectors in the system
clip_count_vectors() : int
The total
Returns a count of vectors missing
clip_missing_vectors() : int
The total
Removes orphaned vectors - those that do not have a valid resource specified either because the resource has been removed or because the list of resource types for which vectors are created has been changed.
clip_vector_cleanup() : void
HookConditional_termsAllInitialise() : mixed
HookConditional_termsAllExtra_checks() : mixed
HookConditional_termsCheckAddinstallationcheck() : mixed
HookConditional_termsViewDownloadlink(mixed $baseparams[, mixed $view_in_browser = false ]) : mixed
conditional_terms_config_check() : mixed
api_consentmanager_get_consents(mixed $ref) : mixed
api_consentmanager_delete_consent(mixed $ref) : mixed
api_consentmanager_batch_link_unlink(mixed $consent, mixed $collection, mixed $unlink) : mixed
api_consentmanager_link_consent(mixed $consent, mixed $resource) : mixed
api_consentmanager_unlink_consent(mixed $consent, mixed $resource) : mixed
api_consentmanager_create_consent(mixed $name, mixed $email, mixed $telephone, mixed $consent_usage[, mixed $notes = "" ][, mixed $expires = null ][, mixed $date_of_birth = null ][, mixed $address = null ][, mixed $parent_guardian = null ][, mixed $date_of_consent = null ]) : mixed
api_consentmanager_get_consent(mixed $consent) : mixed
api_consentmanager_update_consent(mixed $consent, mixed $name, mixed $email, mixed $telephone, mixed $consent_usage[, mixed $notes = "" ][, mixed $expires = null ][, mixed $date_of_birth = null ][, mixed $address = null ][, mixed $parent_guardian = null ][, mixed $date_of_consent = null ]) : mixed
api_consentmanager_get_all_consents([mixed $findtext = "" ]) : mixed
api_consentmanager_get_all_consents_by_collection(mixed $collection) : mixed
api_consentmanager_save_file(mixed $consent, mixed $filename) : mixed
HookConsentmanagerAdmin_group_permissionsAdditionalperms() : mixed
HookConsentmanagerAllExport_add_tables() : mixed
HookConsentmanagerAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options, array<string|int, mixed> $collection_data) : mixed
HookConsentmanagerAllHandleuserref() : mixed
HookConsentmanagerAllCron() : mixed
HookConsentmanagerAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixed
HookConsentmanagerEditEndofmetadataaddcustomfield() : mixed
HookConsentmanagerEditAftersaveresourcedata(int|array<string|int, mixed> $ref) : bool|array<string|int, mixed>
HookConsentmanagerEditCopy_locked_data_extra(array<string|int, mixed> $resource, array<string|int, mixed> $locked_fields, int $last_edited[, bool $save = false ]) : bool|array<string|int, mixed>
HookConsentmanagerTeam_homeCustomteamfunction() : mixed
HookConsentmanagerUser_preferencesAdd_user_preference_page_def(mixed $page_def) : mixed
HookConsentmanagerViewCustompanels() : mixed
Check if the user should have read access to a consent record
consentmanager_check_read([int|null $resource = null ]) : bool
Determines if the user has read access for a specific resource or general read permissions.
The ID of the resource to check read access for. If null, checks for general read permissions.
Returns true if the user has the required permissions; false otherwise.
Check if the user should have write access to a consent record
consentmanager_check_write([int|null $resource = null ]) : bool
Determines if the user has write access for a specific resource or general write permissions.
The ID of the resource to check write access for. If null, checks for general write permissions.
Returns true if the user has the required permissions; false otherwise.
Get a list of consents for a given resource
consentmanager_get_consents(int $resource) : array<string|int, mixed>|bool
This function retrieves a list of consent records associated with a specified resource. Each record includes the consent ID, name, expiration date, and consent usage.
The ID of the resource for which to retrieve associated consents.
Returns an array of consents associated with the resource if the user has read access; otherwise, returns false.
Delete a consent record
consentmanager_delete_consent(int $ref) : bool
This function deletes a consent record and its associations with resources
by removing entries from the consent and resource_consent tables.
The ID of the consent record to be deleted.
Returns true if the consent record was successfully deleted, or false if the user does not have write access to the resource.
Create a new consent record
consentmanager_create_consent(string $name, string|null $date_of_birth, string|null $address, string|null $parent_guardian, string $email, string $telephone, string $consent_usage, string $notes, string|null $date_of_consent, string|null $expires, string $created_by) : int|bool
This function creates a new consent record by inserting the provided details
into the consent table. It returns the ID of the newly created consent
record if successful.
The name of the individual giving consent.
The DOB of the individual, formatted as a string. Optional.
The address of the individual. Optional.
The parent or guardian of the individual. Optional.
The email address of the individual.
The telephone number of the individual.
Description of the intended usage for which consent is given.
Any additional notes related to the consent record.
The date the consent applies from.
The expiry date of the consent, formatted as a string.
The ref of the user who created the consent record.
Returns the ID of the new consent record on success, or false if the user does not have write access.
Link a consent record with a resource
consentmanager_link_consent(int $consent, int $resource) : bool
This function links a consent record to a specified resource by inserting
an entry in the resource_consent table. It also logs this action in the
resource's log.
The ID of the consent record to be linked to the resource.
The ID of the resource to which the consent is being linked.
Returns true if the consent was successfully linked, false if the user does not have write access to the resource.
Unlink a consent record from a resource
consentmanager_unlink_consent(int $consent, int $resource) : bool
This function removes the association between a specified consent record and a resource. The action is logged for the resource.
The ID of the consent record to unlink.
The ID of the resource from which to unlink the consent.
Returns true if the consent record is successfully unlinked; returns false if the user does not have write access to the resource.
Link/unlink all resources in a collection with a consent record
consentmanager_batch_link_unlink(int $consent, int $collection, bool $unlink) : bool
This function links or unlinks all resources in a specified collection to/from a given consent record. If unlinking, it removes existing relationships between the consent record and the resources. If linking, it creates new relationships. Each action is logged.
The ID of the consent record to link or unlink.
The ID of the collection containing the resources to process.
Set to true to unlink resources from the consent; set to false to link resources to the consent.
Returns true if the process completes successfully; returns false if an invalid consent ID is provided.
Retrieve a consent record
consentmanager_get_consent(int $consent) : array<string|int, mixed>|bool
This function retrieves the details of a specified consent record, including the subject's name, email, telephone number, consent usage types, notes, expiry date, and file. It also fetches a list of resources associated with the consent.
The ID of the consent record to fetch.
Returns an associative array containing consent details and associated resources if the user has read access; returns false if access is denied or the consent record does not exist.
Update a consent record
consentmanager_update_consent(int $consent, string $name, string|null $date_of_birth, string|null $address, string|null $parent_guardian, string $email, string $telephone, string $consent_usage, string $notes, string|null $date_of_consent, string|null $expires) : bool
This function updates the details of an existing consent record with the provided information. It allows modification of the subject's name, DOB, address, parent/guardian name, email, telephone number, consent usage types, date of consent, notes, and expiry date. It also resets the expiration_notice_sent flag if the expiry date is modified.
The ID of the consent record to update.
The name of the individual giving consent.
The DOB of the individual, formatted as a string. Optional.
The address of the individual. Optional.
The parent or guardian of the individual. Optional.
The email address of the individual.
The telephone number of the individual.
A description of the permitted usage types for the consent.
Additional notes related to the consent record.
The date the consent applies from.
The expiry date of the consent record, formatted as a string.
Returns true if the consent record was successfully updated, or false if the user does not have write access.
Fetch all consent records linked to resources in a collection
consentmanager_get_all_consents_by_collection(int $collection) : array<string|int, mixed>|bool
This function retrieves all consent records that are linked to resources within a specified collection. It returns an array of consents associated with the resources in the collection.
The ID of the collection containing the resources for which to retrieve consent records.
Returns an array of consent records if the user has read access; otherwise, returns false.
Fetch all consent records, optionally filtered by search text
consentmanager_get_all_consents([string $findtext = "" ][, string $consent_status = "all" ]) : array<string|int, mixed>|bool
This function retrieves all consent records from the database. If a search string is provided, it filters the results based on the name of the person associated with each consent record. It can also filter based on consent status e.g all, active (non-expired), expiring (expiring within a configured amount of days), expired. Defaults to returning all.
Optional. A search string to filter the results by the name of the person giving consent. If empty, returns all records.
Status of consent records to return
Returns an array of consent records if the user has read access; otherwise, returns false.
Fetch all consent records grouped by if they are expiring or not
consentmanager_get_all_consents_grouped() : array<string|int, mixed>|bool
Returns an array of consent records if the user has read access; otherwise, returns false.
Save a file associated with a consent record
consentmanager_save_file(int $consent, string $filename, string $filedata) : bool
This function saves a file (typically a consent form or related document) to the file system and updates the associated consent record in the database with the filename. The function checks user permissions and blocks the upload if the file extension is banned.
The ID of the consent record to associate the file with.
The name of the file to be saved (including extension).
The raw file data (contents) to be written to disk.
Returns true if the file was saved and the database updated successfully; returns false if the user lacks permission or the file extension is not allowed.
Fetch all expiring consent records
consentmanager_get_expiring_consents(int $expires_within[, bool $unsent_only = true ]) : array<string|int, mixed>|bool
This function returns an array of consent records that are expiring within so many days. It can optionally be filtered to include records that have not been flagged as having an expiration notification already sent
Number of days that the records are expiring within
Include only records where an expiration notification hasn't been sent
Returns an array of expiring consent records if the user has read access; otherwise, returns false.
Sets expiration notice sent flag on consent records
consentmanager_set_consent_expiration_notice(array<string|int, mixed> $consents) : bool
This function takes an array of consent record references and sets the expiration_notice_sent flag on each one.
An array of consent references
Returns true if the flags were set; otherwise, returns false
Fetch expired consent records
consentmanager_get_expired_consent_resources(int $archive_status) : array<string|int, mixed>|bool
This function returns expired consent records that are not deleted and are not in the passed archive_state
Returns an array of expired consent records; otherwise, returns false.
Process expiring consent records and send a notification/email
consentmanager_process_expiry_notifications() : bool
Returns true if the notification process completes
Process expired consent records and archive them
consentmanager_process_expired_auto_archive() : bool
Returns true if the auto archiving process completes
get_consent_file_path(mixed $ref) : mixed
HookCookies_notificationAllHandleuserref() : mixed
HookCookies_notificationAllAfteruicenter() : mixed
HookCookies_notificationLoginPostlogout() : mixed
HookCookies_notificationAllRemoveuseridcookie() : mixed
HookCsv_uploadTeam_resourceMenuitem() : mixed
Process the uploaded CSV
csv_upload_process(string $filename, array<string|int, mixed> &$meta, array<string|int, mixed> $resource_types, array<string|int, mixed> &$messages, array<string|int, mixed> $csv_set_options[, int $max_error_count = 100 ][, bool $processcsv = false ]) : bool
Path to CSV file
Array of resource types and associated fields returned by meta_get_map() in include/meta_functions.php
Array of resource type data, with the resource type ID as the key
Array to store processing, information and error messages, passed by reference
Array of CSV processsing options, includes CSV column to metadata field mappings and csv mode
Maximum number of fatal errors to accept before aborting
Process data? If false data will be checked without making changes
csv_upload_get_info(mixed $filename, mixed &$messages) : mixed
Append text to csv log file
csv_upload_log(string $logfile, mixed $logtext) : void
path to log file
text to append
Return the resources with the csv value found in the specified field.
get_csv_line_matching_resources(int $field, string $csv_value) : array<string|int, mixed>
Resource type field ref - the field for csv upload to match on.
The value from the csv to match.
Array of resources which have the csv value in the given field.
Checks if a passed csv file is valid for being processed, needs to be UTF-8 and if a BOM is present it will be stripped out before processing.
csv_check_utf8(string $filename) : array<string|int, mixed>
Path to csv file
Return an array with whether the file passed the check and a message
Attempt to strip out BOM from passed csv file if present. Replaces the original file.
csv_strip_bom(string $filename) : bool
Path to csv file
Return whether BOM was able to be stripped or not
meta_get_map() : mixed
HookCsv_user_importTeam_userRender_options_to_create_users() : mixed
Import users from uploaded CSV file or validate file for future use
csv_user_import_process(string $csv_file, string $user_group_id, array<string|int, mixed> &$messages[, bool $processcsv = false ]) : bool
mandatory_columns in csv: 'username', 'email' optional_columns in csv: 'password', 'fullname', 'account_expires', 'comments', 'ip_restrict', 'lang'
Filepath to input file
Usergroup reference to add new users to
Array to store errors or warnings
if true process file else validate file only
Return true if file processed of validated successfully, false if unable to process or validate file
HookCustom_filenameAllUploadfilesuccess(mixed $resource_ref) : mixed
HookDirect_LinkResource_ShareAdditionalshares() : mixed
HookEmbeddocumentAllModified_cors_process() : mixed
HookEmbeddocumentViewAfterresourceactions2() : mixed
HookEmbedslideshowAllExternal_share_view_as_internal_override() : mixed
HookEmbedslideshowCollection_shareExtra_share_options() : mixed
HookEmbedvideoAllDirectdownloadaccess() : mixed
HookEmbedvideoAllModified_cors_process() : mixed
HookEmbedvideoViewAfterresourceactions() : mixed
HookEmuAllInitialise() : mixed
HookEmuAllExtra_checks() : mixed
HookEmuCheckAddinstallationcheck() : mixed
HookEmuCron_copy_hitcountAddplugincronjob() : mixed
HookEmuEditEdithidefield(mixed $field) : mixed
HookEmuEditEditbeforesectionhead() : mixed
HookEmuAllAdditionalvalcheck(mixed $fields, mixed $fields_item) : mixed
HookEmuEditSaveextraresourcedata(mixed $list) : mixed
Emu plugin attaching to the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
HookEmuEditAftersaveresourcedata() : bool|array<string|int, mixed>
Returns FALSE to show hook didn't run -OR- a list of errors. See hook 'aftersaveresourcedata' in resource_functions.php for more info.
When uploading a batch of resources in upload then edit mode, locked fields are copied between resources in the batch.
HookEmuEditcopylockedfieldsaddfields(array<string|int, mixed> $locked_fields, int $origin_resource) : bool|array<string|int, mixed>
If the EMu IRN field was locked and it contained a value, this function will add any fields mapped in the EMu plugin to the list of fields to copy. This allows the EMu data obtained for the first resource to be applied to all without making another call to EMu.
Array of metadata field refs that were locked on edit page (values to apply to all uploads)
Ref of resource to copy the locked field data from.
False if the EMu IRN field wasn't locked or has no value else array containing the updated list of locked fields (those supplied plus any mapped in the EMu plugin).
HookEmuViewRenderfield(mixed $field, mixed $resource) : mixed
Format date for EMu use (similar to the ISO8601 date format except the time zone designator is not included)
emu_format_date(int $timestamp[, string $format = 'c' ]) : string
PHP's date() valid format
Function to retrieve all resources that have their IRN field set to a value and that are within the allowed resource types for an EMu update
get_emu_resources() : array<string|int, mixed>
Get EMu data by using an array of IRNs.
get_emu_data(mixed $emu_api_server, mixed $emu_api_server_port, array<string|int, mixed> $irns, array<string|int, mixed> $emu_rs_mappings) : array<string|int, mixed>
Array of one/ more IRNs to get data by
EMu table-column -> RS field mappings
$return[IRN][Column] = Column value
Example: [74766] => Array ( [ObjTitle] => [ObjName] => mask [ChaAspectRatio] => )
[886159] => Array ( [ObjTitle] => [ObjName] => mask )
Log EMu script history both on screen and in a file
emu_script_log(string $message[, resource $log_file_pointer = null ]) : void
Utility function to figure out emu plugin configuration changed.
check_config_changed() : bool
For example, can be used in cases when we need to check all records again because of new mappings have been added.
Add search criteria to any existing IMuTerms object before doing a search on a module Note: uses $emu_search_criteria which value is basic TexQL (currently only AND and OR are supported, without support for nesting)
add_search_criteria(IMuTerms $imu_terms) : IMuTerms
Any IMuTerms object on which we want to add new search terms
Update resource with the newly imported orginal file from EMu
emu_update_resource(int $ref, int $type, string $file_path) : bool
Resource ID
Resource type ID
Resource original file path
Utility function to get the mapped ResourceSpace field from the mapping we set for emu plugin
emu_get_rs_mapped_field_id(string $column, array<string|int, mixed> $rs_module_column_field_mappings) : int
EMu column that should have a map to a ResourceSpace field
Returns 0 if could not find value
Update a resource with all the information from an EMu record which has mapped fields to ResourceSpace
emu_update_resource_metadata_from_record(int $resource, array<string|int, mixed> $record, array<string|int, mixed> $rs_module_column_field_mappings) : bool
Resource ID
EMu record processed by emu plugin
Update ResourceSpace field based on an EMu record field value (atomic/ non-atomic) Note: non-atomic values will be converted to a CSV value
emu_update_rs_field(int $ref, int $field, string|array<string|int, mixed> $record_value) : bool
Resource ID
Field ID
The value of the record field
Utility function which allows ResourceSpace to convert any EMu record field to an atomic field with its value formatted as CSV
emu_convert_to_atomic(string|array<string|int, mixed> $values) : string
The value client code wants to convert to
CSV formatted string
HookFacesAdmin_group_permissionsAdditionalperms() : mixed
Hook that enables special search syntax to find resources with visually similar faces to a given resource.
HookFacesAllAddspecialsearch(string $search, object $select, object $sql_join, object $sql_filter) : PreparedStatementQuery|false
This hook listens for the special search syntax !face<ID>, where <ID> is the ref of a face
in the resource_face table. It queries an external Python service via HTTP to retrieve a list
of resource references with matching faces above a configurable similarity threshold. The results
are then integrated into ResourceSpace’s standard search mechanism.
The search string input, expected to be in the format '!face<ID>' if this is a search we're interested in.
An object containing the SQL SELECT clause and its parameters.
An object containing any necessary SQL JOIN clauses and parameters.
An object containing additional SQL filter conditions and parameters.
Returns a prepared SQL query to fetch matching resources if
the search matches the !face pattern; otherwise, returns false.
Runs face detection and tagging automatically after preview creation, if configured.
HookFacesAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : void
This function is triggered after a resource's preview image has been generated. If configured, it will perform face detection and/or tagging on the main resource file (ignoring alternative files). Progress messages are displayed during processing.
The resource reference ID that has just had previews created.
The alternative file ID, or -1 if processing the main resource.
Flag to indicate if hook has been triggered during full preview creation process
Add face detection to the cron.
HookFacesAllCron() : void
Hook into offline jobs list to add custom job
HookFacesAllAddtriggerablejob() : array<string|int, mixed>
Array of existing job data with custom job added
Adds a custom panel to the resource view page displaying detected faces and tagging options.
HookFacesViewCustompanels() : bool
This hook is is triggered during the view.php rendering process.
It queries the resource_face table for any faces detected in the current resource, and if found,
renders a table showing cropped face previews along with a dropdown to tag the face with a named person.
It also includes a link to perform a face similarity search (!face<ID>).
Image dimensions are used to correctly crop and scale face previews for display using CSS background properties.
Tagging actions invoke the faces_tag API via JavaScript to persist the selected person name (node) for each face.
Returns false to allow further custom panels to be rendered after this one.
Detects faces in the image associated with a given resource.
faces_detect(int $ref[, bool $force = false ]) : bool
This function attempts to locate a suitable JPEG file for the specified resource.
It then sends the file to the Python FastAPI service. For each detected
face, it records the bounding box, detection score, and face vector into the
resource_face database table. The resource is then marked as processed.
The resource reference ID to process.
Force the processing of this resource, for example when replacing the file or where it was previously not possible to find the file.
Returns true if face detection and storage were successful, or false if the file was missing, the service failed, or invalid data was returned.
Tags detected faces in a given resource based on similarity to existing tagged faces.
faces_tag(int $resource) : bool
This function finds all untagged faces for the specified resource, sends each face to
the Python FastAPI service to find similar known faces, and tags the face with
the most frequently matched metadata node. It also updates the resource_face table
to associate the face with the chosen metadata node.
The resource reference ID to process and tag faces for.
Returns true on successful processing, or false if any service errors or invalid responses are encountered.
API function to update the named person tag for a specific face using the provided node value.
api_faces_set_node(int $resource, int $face, int $node) : bool
Typically triggered when selecting a name from a dropdown, this function assigns a metadata node
(e.g. representing a person) to a face record in the resource_face table by updating the node field.
The unique reference ID of the face to update (from resource_face.ref).
The node ID to assign to the face (typically corresponds to a controlled vocabulary entry).
Returns true on successful update.
Detect faces in resources that have not yet been processed
faces_detect_missing() : int
A count of the resources processed.
Return count of images to process
faces_count_missing() : int
The count
Return a count of the detected faces
faces_count_faces() : int
The count
HookFalcon_linkAllInitialise() : mixed
HookFalcon_linkAllRender_actions_add_collection_option(mixed $top_actions, mixed $options, mixed $collection_data) : mixed
HookFalcon_linkViewAfterresourceactions() : mixed
HookFalcon_linkViewRenderfield(mixed $field) : mixed
Publish resources in the array to falcon.io
falcon_link_publish(array<string|int, mixed> $resources, string $template_text, string $template_tags) : array<string|int, mixed>
Array of resources to publish. Must include named "ref" key with resource ID as value as per search results
Text to use for template description. If not passed will use value from configured $falcon_link_text_field
Comma separated list of tags to add to Falcon template. If not passed will use values from configured $falcon_link_tag_fields
"success" => Overall outcome of publish action "errors" => Array of error messages "results" => Array of resource IDs and associated status messages
Archive resources in falcon.io
falcon_link_archive(array<string|int, mixed> $resources) : array<string|int, mixed>
Array of resources to archive. Must include named "ref" key with resource ID as value as per search results
"success" => Overall outcome of archive action "errors" => Array of error messages "results" => Array of resource IDs and associated status messages
HookFormat_chooserAllGetdownloadurl(mixed $ref, mixed $size, mixed $ext[, mixed $page = 1 ][, mixed $alternative = -1 ][, mixed $usage = -1 ][, mixed $usagecomment = "" ][, mixed $email = "" ]) : mixed
HookFormat_chooserAllReplaceuseoriginal() : mixed
HookFormat_chooserAllSize_is_available(mixed $resource, mixed $path, mixed $size) : mixed
HookFormat_chooserAllReplacedownloadextension(mixed $resource, mixed $extension) : mixed
HookFormat_chooserAllReplacedownloadfile(mixed $resource, mixed $size, mixed $ext, mixed $fileExists) : mixed
HookFormat_chooserAllCollection_download_modify_job([mixed $job_data = array() ]) : mixed
HookFormat_chooserViewAppend_to_download_filename_td(array<string|int, mixed> $resource, string $ns) : mixed
HookFormat_chooserViewAppend_to_resource_tools_size_download_options_script(string $ns, array<string|int, mixed> $allowed_sizes, array<string|int, mixed> $resource) : mixed
HookFormat_chooserViewAppend_to_updateDownloadLink_js(array<string|int, mixed> $resource) : mixed
HookFormat_chooserViewModifySizesArray(mixed $resource, mixed $sizes) : array<string|int, mixed>|false
HookFormat_chooserViewModifyAllowed_Sizes(mixed $resource, mixed $sizes) : array<string|int, mixed>|false
HookFormat_chooserViewModifycheckifexists(array<string|int, mixed> $resource) : bool
Returns the default output file format to use given an optional input format.
getDefaultOutputFormat([mixed $inputFormat = null ]) : mixed
supportsInputFormat(mixed $inputFormat) : mixed
Returns the size record from the database specified by its ID.
getImageFormat(mixed $size) : mixed
Converts the file of the given resource to the new target file with the specified size. The target file format is determined from the suffix of the target file.
convertImage(mixed $resource, mixed $page, mixed $alternative, mixed $target, mixed $width, mixed $height, mixed $profile) : mixed
The original colorspace of the image is retained. If $width and $height are zero, the image keeps its original size.
sendFile(mixed $filename, string $download_filename[, mixed $usage = -1 ][, mixed $usagecomment = "" ][, mixed $email = "" ]) : mixed
Show colour profile selector based on $format_chooser_profiles config
showProfileChooser([string $class = '' ][, string $disabledtext = '' ][, string $ns = '' ]) : void
CSS class for select
Text to disable and hide inputs
Select ID
getProfileFileName(mixed $profile) : mixed
Helper function to run determine if the plugin should take effect.
failed_format_chooser_checks(array<string|int, mixed> $resource) : bool
Resource data
HookGoogle_analyticsAllFootertop() : mixed
HookGoogle_analyticsAllExtra_meta() : mixed
HookGoogle_visionAllInitialise() : mixed
HookGoogle_visionAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : void
Hook into offline jobs list to add custom job
HookGoogle_visionAllAddtriggerablejob() : array<string|int, mixed>
Array of existing job data with custom job added
HookGoogle_visionEditEdithidefield(mixed $field) : mixed
HookGoogle_visionRecreate_previewsBeforescriptaction() : mixed
google_visionProcess(mixed $resource[, mixed $verbose = false ][, mixed $ignore_resource_type_constraint = false ]) : mixed
google_visionTranslate(mixed $labels) : mixed
HookGrant_editAllCustomediteaccess(mixed $ref) : mixed
HookGrant_editAllModifysearcheditable(mixed $editable_filter, mixed $user) : mixed
HookGrant_editAllExport_add_tables() : mixed
HookGrant_editAllModifyDefaultStatusMode() : mixed
HookGrant_editEditeditbeforeheader() : mixed
Needed to prevent user changing the archive stat otherwise a user with temporary edit access to an active resource could change it from active to pending submission
HookGrant_editEditEditstatushide() : bool
HookGrant_editEditAppendcustomfields() : mixed
HookGrant_editViewBeforepermissionscheck() : mixed
HookImage_banksAllExtra_checks() : mixed
HookImage_banksAllSearchfiltertop() : mixed
HookImage_banksAllAdd_folders_to_delete_from_temp(array<string|int, mixed> $folders_scan_list) : mixed
HookImage_banksAllClearsearchcookies() : mixed
HookImage_banksAllSimplesearchfieldsarehidden() : mixed
HookImage_banksSearchSearchaftersearchcookie() : mixed
api_licensemanager_get_licenses(mixed $ref) : mixed
HookLicensemanagerAdmin_group_permissionsAdditionalperms() : mixed
HookLicensemanagerAllExport_add_tables() : mixed
HookLicensemanagerAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options, array<string|int, mixed> $collection_data) : mixed
HookLicensemanagerAllHandleuserref() : mixed
HookLicensemanagerAllCron() : mixed
HookLicensemanagerAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixed
HookLicensemanagerEditEndofmetadataaddcustomfield() : mixed
HookLicensemanagerEditAftersaveresourcedata(int|array<string|int, mixed> $ref) : bool|array<string|int, mixed>
HookLicensemanagerEditCopy_locked_data_extra(array<string|int, mixed> $resource, array<string|int, mixed> $locked_fields, int $last_edited[, bool $save = false ]) : bool|array<string|int, mixed>
HookLicensemanagerTeam_homeCustomteamfunction() : mixed
HookLicensemanagerUser_preferencesAdd_user_preference_page_def(mixed $page_def) : mixed
HookLicensemanagerViewCustompanels() : mixed
get_license_file_path(int $ref) : mixed
Check if the user should have read access to a license record
licensemanager_check_read([int|null $resource = null ]) : bool
Determines if the user has read access for a specific resource or general read permissions.
The ID of the resource to check read access for. If null, checks for general read permissions.
Returns true if the user has the required permissions; false otherwise.
Check if the user should have write access to a license record
licensemanager_check_write([int|null $resource = null ]) : bool
Determines if the user has write access for a specific resource or general write permissions.
The ID of the resource to check write access for. If null, checks for general write permissions.
Returns true if the user has the required permissions; false otherwise.
Get a list of licenses for a given resource
licensemanager_get_licenses(int $resource) : array<string|int, mixed>|bool
This function retrieves a list of license records associated with a specified resource. Each record includes the license details, expiration date, and consent usage.
The ID of the resource for which to retrieve associated licenses.
Returns an array of licenses associated with the resource if the user has read access; otherwise, returns false.
Delete a license record
licensemanager_delete_license(int $ref) : bool
This function deletes a license record and its associations with resources
by removing entries from the license and resource_license tables.
The ID of the license record to be deleted.
Returns true if the license record was successfully deleted, or false if the user does not have write access to the resource.
Link a license record with a resource
licensemanager_link_license(int $license, int $resource) : bool
This function links a license record to a specified resource by inserting
an entry in the resource_license table. It also logs this action in the
resource's log.
The ID of the license record to be linked to the resource.
The ID of the resource to which the license is being linked.
Returns true if the license was successfully linked, false if the user does not have write access to the resource.
Retrieve a license record
licensemanager_get_license(int $license) : array<string|int, mixed>|bool
This function retrieves the details of a specified license record It also fetches a list of resources associated with the license.
The ID of the license record to fetch.
Returns an associative array containing license details and associated resources if the user has read access; returns false if access is denied or the license record does not exist.
Fetch all license records, optionally filtered by search text
licensemanager_get_all_licenses([string $findtext = "" ][, string $license_status = "all" ]) : array<string|int, mixed>|bool
This function retrieves all license records from the database. If a search string is provided, it filters the results based on licensor/licensee/medium/description It can also filter based on license status e.g all, active (non-expired), expiring (expiring within a configured amount of days), expired. Defaults to returning all.
Optional. A search string to filter the results by the licensor/licensee/medium/description of the license. If empty, returns all records.
Status of license records to return
Returns an array of license records if the user has read access; otherwise, returns false.
Fetch all license records grouped by if they are expiring or not
licensemanager_get_all_licenses_grouped() : array<string|int, mixed>|bool
Returns an array of license records if the user has read access; otherwise, returns false.
Fetch all expiring license records
licensemanager_get_expiring_licenses(int $expires_within[, bool $unsent_only = true ]) : array<string|int, mixed>|bool
This function returns an array of license records that are expiring within so many days. It can optionally be filtered to include records that have not been flagged as having an expiration notification already sent
Number of days that the records are expiring within
Include only records where an expiration notification hasn't been sent
Returns an array of expiring license records if the user has read access; otherwise, returns false.
Sets expiration notice sent flag on license records
licensemanager_set_license_expiration_notice(array<string|int, mixed> $licenses) : bool
This function takes an array of license record references and sets the expiration_notice_sent flag on each one.
An array of license references
Returns true if the flags were set; otherwise, returns false
Fetch expired license records
licensemanager_get_expired_license_resources(int $archive_status) : array<string|int, mixed>|bool
This function returns expired license records that are not deleted and are not in the passed archive_state
Returns an array of expired license records; otherwise, returns false.
Process expiring license records and send a notification/email
licensemanager_process_expiry_notifications() : bool
Returns true if the notification process completes
Process expired license records and archive them
licensemanager_process_expired_auto_archive() : bool
Returns true if the auto archiving process completes
HookLightbox_previewAllAdditionalheaderjs() : mixed
HookLightbox_previewAllReplacefullscreenpreviewicon() : mixed
HookLightbox_previewViewRenderbeforerecorddownload(mixed $disable_flag) : mixed
HookLightbox_previewViewGetpreviewurlforsize() : mixed
HookLightbox_previewViewRenderaltthumb
HookLightbox_previewViewRenderaltthumb(int $n, array<string|int, mixed> $altfile) : bool
index value for alternative file
parameters of alternative file to be rendered
HookLightbox_previewViewAftersearchimg() : mixed
getPreviewURLForType(mixed $resource, mixed $type[, mixed $alternative = -1 ][, mixed $page = 1 ]) : mixed
getPreviewURL(mixed $resource[, mixed $alternative = -1 ][, mixed $page = 1 ]) : mixed
addLightBox(mixed $selector[, mixed $url = "" ][, mixed $title = "" ][, mixed $set = "" ]) : mixed
HookMuseumplusAllInitialise() : mixed
HookMuseumplusAllAfter_setup_user() : mixed
MuseumPlus plugin attaching to the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
HookMuseumplusAllAftersaveresourcedata(int|array<string|int, mixed> $R) : bool|array<string|int, mixed>
Generic type for resource ID(s). It will be a resource ref when hook is called from save_resource_data() -OR- a list of resource IDs when called from save_resource_data_multi().
Returns FALSE to show hook didn't run or list of errors. See hook 'aftersaveresourcedata' in resource_functions.php for more info
HookMuseumplusAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixed
HookMuseumplusAllHandleuserref() : mixed
HookMuseumplusAllAfternewresource(mixed $to) : mixed
HookMuseumplusCron_copy_hitcountAddplugincronjob() : mixed
HookMuseumplusViewRenderfield(mixed $field, mixed $resource) : mixed
Execute a cURL request
do_http_request(string $url, string $basic_auth, string $content_type, string $request_method, string $data) : array<string|int, mixed>
URL
Username and password used for basic authentication. MUST follow the "username:password" syntax to work!
Content type header value (e.g application/xml)
HTTP request methods (e.g GET, POST, PUT, DELETE)
Posted data (e.g XML)
Response information such status code (e.g 200), headers and actual body
Helper function to ensure required connection data was provided
mplus_get_connection_data() : array<string|int, mixed>
Send notifications to users regarding MuseumPlus events (e.g script failed)
mplus_notify(array<string|int, mixed> $users, string $message) : bool
List of users' IDs
Notification message
TRUE on success FALSE on failure
Generate a MuseumPlus URL for any module records without having to know the form name
mplus_generate_module_record_url(string $module, int $id) : string
Module name
Module record technical (internal) ID
Returns the generated URL or empty string on failure
Save MuseumPlus modules configuration
mplus_save_module_config(array<string|int, mixed> $cf) : void
Modules configuration to save
For a list of resources, obtain the associated modules' configuration.
mplus_get_associated_module_conf(array<string|int, mixed> $resource_refs, bool $with_values) : array<string|int, mixed>
IMPORTANT: make sure the return of this function is not exposed to the end user when called using the $with_values param.
List of resource IDs
Should associated module configurations include the RS metadata fields values (this applies to module configurations that are using a metadata field - e.g. rs_uid_field or the field mappings).
The associated modules' configuration for each of the resources in the list -or- an empty array.
Find the module configuration using the module name.
mplus_get_cfg_by_module_name(string $n) : array<string|int, mixed>
Module name to search by in the plugin configuration
Returns the module configuration record found. @see $museumplus_modules_saved_config elements for the array structure
Validate a modules' record ID (technical or virtual)
mplus_validate_association(array<string|int, mixed> $ramc, bool $use_technical_id, bool $force) : array<string|int, mixed>
Resources associated module configurations. mplus_get_associated_module_conf()
Validate using the technical ID (ie __id) fieldPath.
Force re-validation even if association state is already known.
Returns the valid resources that have a valid combination of "module name - MpID (virtual or technical)". IMPORTANT: Each returned resource associated module configuration will get mutated with an additional "__id" key which will always hold the technical ID of the module item "linked" to that resource - always use MPLUS_FIELD_ID constant to find this key. An optional "errors" key may be added to the return array to hold any errors the end user should be aware of.
Transpose a resource associated module config array to one ready to be used for batch searching via MuseumPlus API.
mplus_flip_struct_by_module(array<string|int, mixed> $ramc) : array<string|int, mixed>
Utility function for validation & syncing.
Resources associated module configurations. mplus_get_associated_module_conf()
Returns array structure where the key is the module name and value contains information useful for validation/syncing data from MuseumPlus
Compute the MD5 hash for the association between a resource and the combination of "module name - MpID (virtual or technical).
mplus_compute_data_md5(array<string|int, mixed> $resources_data, string $module_name) : array<string|int, mixed>
Utility function which is used to save the data in the resource table, column "museumplus_data_md5" and used to determine if either of the data of interest (module name or MpID) have changed in order to revalidate the association.
Resources data array - key is the resource ref and value is the module item ID (virtual or technical). Example: [23 => '2423432', 24 => 'OB3223-N']
Module name
Log events related to MuseumPlus integration. Any information that can be useful (even a user trying to save a resource)
mplus_log_event(string $msg[, array<string|int, mixed> $ctx = array() ][, string $lvl = 'info' ]) : void
Log message. Max size 255 characters.
Contextual data relevant to the event. Try namespacing the data if needed using keys (e.g http_request - and then the body could contain different aspects: header, body, url etc.). IMPORTANT: make sure to never log sensitive information (e.g MuseumPlus authentication credentials)
Logging level (Options could be: Trace, Debug, Info, Warn, Error, Fatal). Max size 10 characters.
Validate a list of filter names that can be used by {@see mplus_resource_get_association_data()}.
mplus_validate_resource_association_filters(array<string|int, mixed> $f) : array<string|int, mixed>
List of filters. Key is the filter name. The value of a filter is any data type required by that particular filters' parameter (e.g for "byref" filter, the input is a list of refs => array).
Get resource table columns relevant to the MuseumPlus integration
mplus_resource_get_data(array<string|int, mixed> $refs) : array<string|int, mixed>
List of resource IDs
Mark resource failed validating the MuseumPlus association
mplus_resource_mark_validation_failed(array<string|int, mixed> $resources) : void
List of resource IDs (key) and computed MD5 hashes (value). mplus_compute_data_md5()
Mark resource module association as valid. This updates the MD5 hash for the current combination of "module name - MpID" and the valid technical ID retrieved from MuseumPlus.
mplus_resource_update_association(array<string|int, mixed> $resources, array<string|int, mixed> $md5s) : void
List of resource IDs (key) and MuseumPlus technical ID - ie. "__id" - as value.
List of resource IDs (key) and computed MD5 hashes (value). mplus_compute_data_md5()
Clear resource metadata fields that are mapped to any of the modules configured by the plugin.
mplus_resource_clear_metadata(array<string|int, mixed> $refs) : void
List of resource IDs
Get all resources associated with a MuseumPlus module.
mplus_resource_get_association_data(array<string|int, mixed> $filters) : array<string|int, mixed>
Rules to filter results (if applicable). There are "flag" filters (e.g new_and_changed_associations filter) and filters that take arguments (e.g byref)
Build the search XML for MuseumPlus API request body {@see http://docs.zetcom.com/ws/module/search/search_1_4.xsd}
mplus_xml_search_by_fieldpath(string $fp, array<string|int, mixed> $vals, array<string|int, mixed> $sfs) : DOMDocument
Field path used to identify the "linked" modules. This is essentially either the technical ID field (ie. __id) or another virtual field (e.g ObjObjectNumberVrt)
Module record IDs to search for in MuseumPlus. Hash table where key is resource ID and value is the MpID
MuseumPlus modules' fields to return back
Returns XML document with the search criteria
Run an ad-hoc module search using the provided expert search expression {@see http://docs.zetcom.com/ws/#Perform_an_ad-hoc_search_for_modules_items}
mplus_search(string $module_name, DOMDocument $search) : array<string|int, mixed>
Module name
Expert search criteria. mplus_xml_search_by_fieldpath()
Get XML response body received from MuseumPlus search request {@see http://docs.zetcom.com/ws/module/module_1_4.xsd}
mplus_get_response_xml(array<string|int, mixed> $result) : DOMDocument
Search results as returned by mplus_search()
Synchronise (search & import) MuseumPlus module fields to the associated ("linked") resources.
mplus_sync(array<string|int, mixed> $ramc) : void|array<string|int, mixed>
Valid resources with an associated module configuration. mplus_validate_association()
Returns NULL if sync finished (or had nothing to process) -or- list of errors caught during the validation/sync process (NOTE: validation errors get carried forward).
HookNewsHomeHomebeforepanels() : mixed
HookNewsTeam_homeCustomteamfunction() : mixed
get_news([mixed $ref = "" ][, mixed $recent = "" ][, mixed $findtext = "" ]) : mixed
get_news_headlines([mixed $ref = "" ][, mixed $recent = "" ]) : mixed
get_news_ref(mixed $maxmin) : mixed
delete_news(mixed $ref) : mixed
add_news(mixed $date, mixed $title, mixed $body) : mixed
update_news(mixed $ref, mixed $date, mixed $title, mixed $body) : mixed
HookOffline_archiveAllInitialise() : mixed
HookOffline_archiveAllAddplugincronjob() : mixed
HookOffline_archiveTeam_homeCustomteamfunction() : mixed
HookOffline_archiveViewResourceactions() : mixed
HookOffline_archiveViewRenderbeforeresourceview(mixed $resource) : mixed
Run any outstanding offline archive jobs
offline_archive_run_jobs([bool $showoutput = false ]) : bool|array<string|int, mixed>
Display progress?
TRUE if ok, array of messages if any errors encountered
HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumnheader() : mixed
HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumn() : mixed
Add to array of field column data on metadata field editing page
HookOpenai_gptAllModifyresourcetypefieldcolumns(array<string|int, mixed> $fieldcolumns) : array<string|int, mixed>
Existing array of columns
Updated array of columns
Alter rendering of the new columns on the metadata field editing page
HookOpenai_gptAdmin_resource_type_field_editAdmin_field_replace_question(int $ref, string $column, array<string|int, mixed> $column_detail, array<string|int, mixed> $fielddata) : bool
Ref of the metadata field being edited
Name of table column for which input is being rendered
Array of metadata field rendering data from the edit page
Array of metadata field information from get_resource_type_field()
Is standard display rendering being overridden?
Hook into update_field() to process value changes
HookOpenai_gptAllUpdate_field(int $resource, int $field, string $value, string $existing, array<string|int, mixed> $fieldinfo, array<string|int, mixed> $newnodes, array<string|int, mixed> $newvalues) : bool
Resource ID
Metadata field ref
New field value (comma separated for nodes)
Existing field value
Array of metadata field information from get_resource_type_field()
Array of new nodes that have been set
Array of new text values that have been set
Hook into save_resource_data() and save_resource_data_multi() to process value changes
HookOpenai_gptAllAftersaveresourcedata(int|array<string|int, mixed> $r, mixed $all_nodes_to_add, mixed $all_nodes_to_remove, mixed $autosave_field, mixed $fields, mixed $updated_resources) : bool
Resource ID or array of resource IDs
Passed from hook, unused
Passed from hook, unused
Passed from hook, unused
Array of edited field data
Array of resources & fields that have been updated with resources as the top level key and field IDs as subkeys
Hook into image upload to process the image as GPT input *
HookOpenai_gptAllAfterpreviewcreation(int $ref, int $alternative[, bool $generate_all = false ]) : bool
Success if field is updated
Return total token usage for the past 30 days.
HookOpenai_gptAllExtra_checks() : array<string|int, mixed>
Array of data for processing in get_system_status().
Hook into offline jobs list to add custom job
HookOpenai_gptAllAddtriggerablejob() : array<string|int, mixed>
Array of existing job data with custom job added
HookOpenai_gptTeam_homeCustomteamfunctionadmin() : mixed
Send the new field value or image to the OpenAI API in order to update the linked field
openai_gpt_update_field(int|array<string|int, mixed> $resources, array<string|int, mixed> $target_field, array<string|int, mixed> $values[, string $file = "" ]) : bool|array<string|int, mixed>
Resource ID or array of resource IDS
Target metadata field array from get_resource_type_field()
Array of strings from the field currently being processed
Path to image file. If provided will use this file instead of metadata values
Array indicating success/failure True if update successful, false if invalid field or no data returned
Call OpenAI compatibile APIs
openai_gpt_generate_completions(string $endpoint, string $api_key, string $model, array<string|int, mixed> $messages[, float $temperature = 0 ][, int $max_tokens = 2048 ]) : string
Refer to https://beta.openai.com/docs/api-reference for detailed explanation
API endpoint
API key
Model name e.g. "text-davinci-003"
Array of prompt messages to generate response from API. See https://platform.openai.com/docs/guides/chat/introduction for more information
Value between 0 and 1 - higher values means model will take more risks. Default 0.
The maximum number of completions to generate, default 2048
The first API response text output
Return array of resource type field refs for a given openai_gpt_input_field value.
openai_gpt_get_dependent_fields(int $field) : array<string|int, mixed>
ID of GPT input field.
Return an array of resource type field refs for all AI configured fields
openai_gpt_get_configured_fields() : array<string|int, mixed>
Array field references for all AI configured fields
Return a count of tokens used by GPT during the number of days passed as a parameter.
openai_gpt_get_tokens_used(int $days) : int
Defaults to using 30 days if 0 or less is passed.
Count of tokens used in $days days
Return the configured AI provider handles the remote override.
openai_gpt_get_provider() : string
Currently configured AI provider
Return total successful image edits for the past 30 days.
HookOpenai_image_editAllExtra_checks() : array<string|int, mixed>
Array of data for processing in get_system_status().
HookOpenai_image_editViewAfterresourceactions() : mixed
curlprogress(mixed $resource, mixed $download_size, mixed $downloaded, mixed $upload_size, mixed $uploaded) : mixed
HookPdf_splitViewAfterresourceactions() : mixed
HookPropose_changesAllAddtoactions() : mixed
HookPropose_changesAllShowfieldedit(mixed $field) : mixed
HookPropose_changesAllExport_add_tables() : mixed
Add any recent proposed changes to the $newactions array passed from get_user_actions_recent() and return the updated array
HookPropose_changesAlluser_actions_recent(int $minutes, array<string|int, mixed> $newactions) : array<string|int, mixed>
HookPropose_changesAllUpdateactiontypes(mixed $actiontypes) : mixed
HookPropose_changesAllActioneditlink(mixed $action) : mixed
HookPropose_changesCollection_editSavecollectionAdditionalfields() : mixed
HookPropose_changesCollection_editGetcollectionAdditionalfields() : mixed
HookPropose_changesCollection_editAdditionalfields2() : mixed
HookPropose_changesCollection_emailAdditionalemailfield() : mixed
HookPropose_changesCollection_emailAdditional_email_collection(mixed $colrefs, mixed $collectionname, mixed $fromusername, mixed $userlist, mixed $message, mixed $feedback, mixed $access, mixed $expires, mixed $useremail, mixed $from_name, mixed $cc, mixed $themeshare, mixed $themename, mixed $themeurlsuffix, mixed $template, mixed $templatevars) : mixed
HookPropose_changesUser_preferencesAdd_user_preference_page_def(mixed $page_def) : mixed
HookPropose_changesViewAfterresourceactions() : mixed
save_proposed_changes(mixed $ref) : mixed
get_proposed_changes(mixed $ref, mixed $userid) : mixed
delete_proposed_changes(mixed $ref[, mixed $userid = "" ]) : mixed
propose_changes_display_field(mixed $n, mixed $field) : mixed
HookRefineresultsSearchBeforesearchresults() : mixed
HookRefineresultsSearchBeforesearchresultsexpandspace() : mixed
HookRefineresultsSearchSearchstringprocessing() : mixed
HookRefineresultsSearchSearch_header_after_actions() : mixed
HookRemote_assistAllHomeafterwelcometext() : mixed
HookResource_usageViewCustompanels() : mixed
HookRse_search_notificationsAllRender_search_actions_add_option(mixed $options) : mixed
HookRse_search_notificationsAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options) : mixed
HookRse_search_notificationsCron_copy_hitcountAddplugincronjob() : mixed
HookRse_search_notificationsSearchafterResulthints() : mixed
HookRse_search_notificationsUser_homeUser_home_additional_links() : mixed
search_notifications_get(mixed &$results[, mixed $user = "" ][, mixed $enabled_only = true ][, mixed $search = "" ][, mixed $orderby = 1 ][, mixed $orderbydirection = "DESC" ]) : mixed
search_notification_add(mixed $search, mixed $restypes, mixed $archive) : mixed
search_notification_delete(mixed $ref[, mixed $force = false ]) : mixed
search_notification_enable(mixed $ref[, mixed $force = false ]) : mixed
search_notification_disable(mixed $ref[, mixed $force = false ]) : mixed
search_notification_enable_all([mixed $force = false ]) : mixed
search_notification_disable_all([mixed $force = false ]) : mixed
search_notification_process([mixed $owner = -1 ][, mixed $search_saved = -1 ]) : mixed
search_notification_make_url(mixed $watched_search) : mixed
Delete all watched searches by user
search_notification_delete_by_owner(int $user) : void
User ID
render_sortable_header(mixed $title, mixed $col_number) : mixed
HookRse_VersionAllBeforeremoveexistingfile(mixed $ref) : mixed
HookRse_VersionAllUpload_image_after_log_write(mixed $ref, mixed $log_ref) : mixed
HookRse_VersionAllGet_alternative_files_extra_sql(mixed $resource) : mixed
HookRse_versionAllSave_resource_data_multi_extra_modes(mixed $ref, mixed $field, mixed $existing, mixed $postvals, mixed &$errors) : mixed
HookRse_versionAllGet_resource_log_extra_fields() : mixed
HookRse_versionCollection_logLog_extra_columns_header() : mixed
HookRse_versionCollection_logLog_extra_columns_row(mixed $log, array<string|int, mixed> $collection_info) : mixed
HookRse_versionCollection_logCollection_log_extra_fields() : mixed
HookRse_versionEditEdit_all_extra_modes(mixed $field) : mixed
HookRse_versionEditEdit_all_mode_js() : mixed
HookRse_versionEditEdit_all_after_findreplace(mixed $field, mixed $n) : mixed
HookRse_versionEditBefore_status_question() : mixed
HookRse_versionEditSave_resource_data_multi_set_archive_state(mixed $resource_ref, mixed $old_archive) : mixed
HookRse_versionLog_entryLog_entry_processing(mixed $column, mixed $value, mixed $logentry) : mixed
HookRse_workflowAdmin_group_permissionsAdditionalperms() : mixed
HookRse_workflowAdmin_homeCustomadminsetup() : mixed
HookRse_workflowAllInitialise() : mixed
HookRse_workflowAllAfter_update_archive_status(mixed $resource, mixed $archive, mixed $existingstates) : mixed
HookRse_workflowAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options, mixed $collection_data, mixed $urlparams) : mixed
HookRse_workflowAllRender_search_actions_add_option(array<string|int, mixed> $options, array<string|int, mixed> $urlparams) : mixed
HookRse_workflowAllRender_actions_add_option_js_case(mixed $action_selection_id) : mixed
HookRse_workflowAllAfter_setup_user() : mixed
Check if supplied archive state code (e.g. 0 = Active) allows required field checking to be skipped when a resource is moved to this archive state.
HookRse_workflowAllArchive_skip_required_fields(int $archive_state) : mixed
Integer of destination archive state i.e. the state the resource will be moved to.
HookRse_workflowViewPageevaluation() : mixed
HookRse_workflowViewAdditionaldownloadtabs() : mixed
HookRse_workflowViewAdditionaldownloadtabbuttons() : mixed
HookRse_workflowViewReplacetitleprefix(mixed $state) : mixed
Fetch a list of actions from the rse_workflow plugin Action text, name, and button text support i18n translation strings
rse_workflow_get_actions([string|int $status = "" ][, string|int $ref = "" ]) : array<string|int, mixed>
Filter based on statusfrom, onle a single workflow state reference can be passed
Reference ID of action to return a single specific action
SQL results from workflow_actions table. name, text, and buttontext values are translated using i18n translation
rse_workflow_save_action([mixed $ref = "" ]) : mixed
rse_workflow_delete_action(mixed $action) : mixed
rse_workflow_get_archive_states() : mixed
rse_workflow_delete_state(mixed $state, mixed $newstate) : mixed
Validate list of actions for a resource or a batch of resources. For a batch of resources, an action is valid only if using the 'wf' permission is set for that action.
rse_workflow_get_valid_actions(array<string|int, mixed> $actions, bool $use_perms_only) : array<string|int, mixed>
List of workflow actions (@see rse_workflow_get_actions())
Validate actions using edit access (e perm) on the destination state -OR- 'wf' permissions
Validate a workflow action for a particular resource
rse_workflow_validate_action(array<string|int, mixed> $action, array<string|int, mixed> $resource) : bool
Workflow action structure (@see rse_workflow_get_actions())
Resource structure (@see get_resource_data() or do_search())
Compile workflow actions for the unified dropdown actions. This will validate actions using only 'wf' permissions (@see rse_workflow_get_valid_actions)
rse_workflow_compile_actions(array<string|int, mixed> $url_params) : array<string|int, mixed>
Inject any url params if needed. Useful to pass along search params.
Create new workflow state
rse_workflow_create_state(array<string|int, mixed> $data) : bool|array<string|int, mixed>
New workflow state data. Requires at least a 'name' property!
Returns false if it fails or the new state data.
HookRss2AllInitialise() : mixed
HookRss2AllPreheaderoutput() : mixed
HookRss2AllSearchbarbeforebottomlinks() : mixed
HookRss2SearchRender_search_actions_add_option(mixed $options) : mixed
xmlentities(mixed $text) : mixed
HookSensitive_imagesAllAdditionaljoins() : mixed
HookSensitive_imagesAllStopblurbleed() : mixed
SensitiveImageResultsReplace(mixed $collection) : mixed
HookSensitive_imagesSearchResourcethumbtop() : mixed
HookSensitive_imagesCollectionsRendercollectionthumb() : mixed
HookSensitive_imagesViewReplacepreviewlink(string $preview_title) : mixed
HookSimpleldapAllExternalauth(mixed $uname, mixed $pword) : mixed
HooksimpleldapCheckAddinstallationcheck() : mixed
HookSimpleldapTeam_user_editAdditionaluserfields() : mixed
HookSimpleldapTeam_user_editPassword(mixed $user) : mixed
HookSimpleldapTeam_user_editTicktoemailpassword() : mixed
Authenticate to directory by binding and performing LDAP search
simpleldap_authenticate(string $username, string $password) : array<string|int, mixed>|bool
Username
Password
Array of user data or false if failed to authenticate
Helper function to convert received data from LDAP server to UTF-8
simpleldap_to_utf8(string $str) : string
String to convert to UTF8
HookSimplesamlAllInitialise() : mixed
HookSimplesamlAllPreheaderoutput() : mixed
HookSimplesamlAllProvideusercredentials() : mixed
HookSimplesamlAllLoginformlink() : mixed
HookSimplesamlLoginPostlogout() : mixed
HookSimplesamlLoginPostlogout2() : mixed
HookSimplesamlAllCheckuserloggedin() : mixed
Render header navigation links in anonymous mode based on simplasaml configuration
HookSimplesamlAllReplaceheadernav1anon() : mixed
HookSimplesamlCollection_emailReplacecollectionemailredirect() : mixed
HookSimplesamlResource_emailReplaceresourceemailredirect() : mixed
HookSimplesamlAllCheck_access_key() : mixed
HookSimplesamlAllExtra_checks() : mixed
HookSimplesamlAllSsologindefault() : mixed
HookSimplesamlAllCron() : mixed
HooksimplesamlCheckAddinstallationcheck() : mixed
HookSimplesamlTeam_user_editAdditionaluserfields() : mixed
HookSimplesamlTeam_user_editPassword(mixed $user) : mixed
HookSimplesamlTeam_user_editTicktoemailpassword() : mixed
Get the configured path to the root of the SimpleSAML library If $simplesaml_lib_path is not set this will be the [webroot]/plugins/simplesaml/lib folder
simplesaml_get_lib_path() : string
Authenticate user, redfirecting to IdP if necessary
simplesaml_authenticate() : bool
Get SAML attributes
simplesaml_getattributes() : array<string|int, mixed>
Sign out of SAML SP
simplesaml_signout() : void
Check if user has been authenticated by SimpleSAMLPHP
simplesaml_is_authenticated() : bool
simplesaml_getauthdata(mixed $value) : mixed
Notify of a new SAML user with an email address that is already in use by an existing user
simplesaml_duplicate_notify(string $username, int $group, string $email, array<string|int, mixed> $email_matches[, int $newuserid = 0 ]) : void
Username
Usergroup
Array of existing users with matching email
ID of new user if created
Check that the SimpleSAMLphp configuration is valid
simplesaml_config_check() : array{success: bool, error?: string}
Check whether PHP version will cause an error with current SAML config
simplesaml_php_check([bool $with_config = true ]) : bool
Check that the SimpleSAMLphp has been configured.
simplesaml_is_configured() : bool
This is done by either:- a) Adding config, authsources and metadata files manually to the configured lib folder ($simplesaml_lib_path) or b) By setting the options in the $simplesamlconfig variable and then enabling the plugin option 'Use ResourceSpace configuration to set SP configuration and metadata'
Generate a key/certificate pair
simplesaml_generate_keypair(array<string|int, mixed> $dn) : array<string|int, mixed>
Array of certificate attributes with named indexes as below
Array containing paths to private key (.pem) and certificate (.crt) files
Get the name of the saml SP to use
get_saml_sp_name() : string
Get the latest expiration date for the given SAML Identity Provider's certificates
get_saml_metadata_expiry(string $entityid) : string
EntityID of SAML IdP
Expiration date. Empty string if no certificate or IdP is not found.
Get the latest metadata from the configured IdP Metadata URL
simplesaml_update_metadata() : bool|string
True if successful, otherwise error message
Get SAML IdP metadata from sysvars, updating if necessary
get_saml_metadata([bool $retry = true ]) : array<string|int, mixed>|false
Retry if invalid. Default true
Metadata if successful, false if failed
simplesaml_use_idp_metadata_url_mode() : bool
HookSystem_resetAdmin_homeCustomadminfunction() : mixed
Add tesseract processing to the cron.
HookTesseractAllCron() : void
Runs tesseract processing after preview creation.
HookTesseractAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : void
The resource reference ID that has just had previews created.
The alternative file ID, or -1 if processing the main resource.
Flag to indicate if hook has been triggered during full preview creation process
Processes all unprocessed audio/video resources supported by tesseract.
tesseract_process_unprocessed() : int|false
This function:
Returns the number of resources processed, or false if a process lock is active.
Extracts text from an image or scanned document using tesseract OCR.
tesseract_process(int $resource) : bool
Marks the resource as processed by setting tesseract_processed = 1.
The resource ID to process.
True on successful processing, false if any step fails.
HookTms_linkAllInitialise() : mixed
HookTms_linkAllUpdate_field(mixed $resource, mixed $field, mixed $value, mixed $existing) : mixed
HookTms_linkAllAfterpreviewcreation(int $ref[, int $alternative = -1 ][, bool $generate_all = false ]) : void
HookTms_linkCheckAddinstallationcheck() : mixed
HookTms_linkCron_copy_hitcountAddplugincronjob() : mixed
HookTms_linkEditEditbeforesectionhead() : mixed
HookTMS_linkEditEdithidefield(mixed $field) : mixed
HookTms_linkAllAdditionalvalcheck(mixed $fields, mixed $fieldsitem) : mixed
TMS plugin implementing the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
HookTms_linkEditAftersaveresourcedata(int|array<string|int, mixed> $R, mixed $nodes_to_add, mixed $nodes_to_remove, mixed $autosave_field, array<string|int, mixed> $fields, array<string|int, mixed> $updated_resources) : array<string|int, mixed>|bool
Generic type for resource ID(s). It will be a resource ref when hook is called from save_resource_data() -OR- a list of resource IDs when called from save_resource_data_multi().
List of fields that was submitted with the request (contains stale data)
Map of field changes for each resource (if applicable)
Returns bool to show whether the hook ran or not -or- list of errors. See hook 'aftersaveresourcedata' in resource_functions.php for more info
HookTms_linkTeam_homeCustomteamfunctionadmin() : mixed
HookTms_linkViewRenderfield(mixed $field) : mixed
unistr_to_ords(mixed $str[, mixed $encoding = 'UTF-8' ]) : mixed
getEncodingOrder() : mixed
tms_convert_value(mixed $value, mixed $key, array<string|int, mixed> $module) : mixed
tms_link_get_tms_data(mixed $resource[, mixed $tms_object_id = "" ][, mixed $resourcechecksum = "" ][, mixed $onlymodule = "" ]) : mixed
tms_link_get_tms_resources(array<string|int, mixed> $module) : mixed
tms_link_test() : mixed
tms_add_mediaxref(mixed $mediamasterid, mixed $tms_object_id[, mixed $create = true ]) : mixed
tms_link_create_tms_thumbnail(mixed $resource[, mixed $alternative = -1 ]) : mixed
tms_get_mediamasterid Retrieve a list of unused Media Master IDs from the TMS database and return the first available.
tms_get_mediamasterid([bool $create = true ][, int $resource = null ]) : bool|string
If no IDs are found then create a new one and then retry To avoid Media Master IDs being used by multiple resources $tms_link_mediapaths_resource_reference_column can be set. This will store the resource ID in the MediaMaster table when creating the new ID so that it is not used by another Resource
flag to create a new ID if none found
ResourceSpace resource ID
False if no ID found, otherwise the Media Master ID is returned
tms_get_renditionid(mixed $mediamasterid, mixed $resourceid[, mixed $create = true ]) : mixed
tms_get_mediapathid(mixed $path[, mixed $create = true ]) : mixed
tms_update_media_rendition(mixed $mediamasterid, mixed $mediafileid) : mixed
tms_check_thumb(mixed $pathid, mixed $filepath, mixed $filename) : mixed
tms_update_media_rendition_thumb(mixed $mediamasterid, mixed $mediafileid, mixed $pathid, mixed $filepath, mixed $filename) : mixed
tms_add_mediafile(mixed $renditionid, mixed $pathid, mixed $filepath, mixed $relfilepath[, mixed $create = true ]) : mixed
tms_show_data(mixed $table, mixed $columns, mixed $utf16_columns, mixed $conditionsql[, mixed $limit = 10 ]) : mixed
tms_link_check_preview(mixed $ref[, mixed $alternative = -1 ]) : mixed
Save plugins' module saved mappings configuration on an ad-hoc basis
tms_link_save_module_mappings_config(mixed $value) : void
Configuration option new value
tms_link_get_modules_mappings() : mixed
tms_link_encode_modules_mappings() : mixed
tms_link_is_rs_uid_field(mixed $field_ref) : mixed
Split string identifier values on commas with optional whitespace for multiple tms object IDs
tms_link_split_identifiers(string|array<string|int, mixed> $tms_object_id) : array<string|int, mixed>
Redirects the user to the TOTP setup page if their TOTP cookie is invalid or missing.
HookTotpAllPreheaderoutput() : void
This hook runs before the page header output and ensures that users with TOTP enabled are redirected to complete setup or authentication if needed.
Includes the QR code JavaScript library needed for TOTP setup.
HookTotpAllAdditionalheaderjs() : void
This hook appends the necessary JS to the page header.
Adds a TOTP reset checkbox to the user edit form.
HookTotpTeam_user_editAdditionaluserfields() : void
This allows administrators to reset a user's TOTP configuration, e.g. if they have lost their device.
Processes the TOTP reset checkbox and prepares a query to reset the user's TOTP data.
HookTotpTeam_user_editAdditionaluserfieldssave() : PreparedStatementQuery|null
If the reset checkbox was ticked, returns a PreparedStatementQuery that modifies the user save action to clear the user's TOTP fields.
A query to reset TOTP fields, or null if not resetting.
HookTotpAllBeforetermsredirect() : mixed
Validates a TOTP code for the given user reference.
TOTP_validate(string $code, int $user_ref) : bool
The TOTP code to validate.
The user reference.
True if the code is valid, false otherwise.
Generates a daily cookie hash based on the user reference and scramble key.
TOTP_cookie(int $user_ref) : string
The user reference.
A SHA-256 hash used for TOTP cookie validation.
Checks whether TOTP is set up for the specified user.
TOTP_is_user_set_up(int $user_ref) : bool
The user reference.
True if TOTP is set up, false otherwise.
Generates the TOTP secret for the given user.
TOTP_get_secret(int $user_ref) : string
The user reference.
A base32-encoded TOTP secret.
Constructs the otpauth URL for the user's TOTP setup.
TOTP_get_url(int $user_ref) : string
The user reference.
The otpauth URL used to generate a QR code in authenticator apps.
Marks TOTP setup as complete for the specified user.
TOTP_setup_complete(int $user_ref) : void
The user reference.
Retrieves the number of failed TOTP attempts for the user.
TOTP_tries(int $user_ref) : int
The user reference.
The number of TOTP validation attempts.
Increments the TOTP attempt counter for the specified user.
TOTP_increase_tries(int $user_ref) : void
The user reference.
Checks to see if SAML is authenticated for the given user if TOTP can be skipped for SAML users.
TOTP_saml_authenticate() : bool
True if SAML is enabled and authenticates, false otherwise
HookTrack_field_historyViewValue_mod_after_highlight(mixed $field, mixed $value) : mixed
track_field_history_get_field_log(mixed $resource_id, mixed $field_id) : mixed
HookTransformAdmin_manage_slideshowRender_new_element_for_manage_slideshow(array<string|int, mixed> $slideshow_files) : mixed
HookTransformAdmin_manage_slideshowRender_replace_button_for_manage_slideshow(mixed $slideshow_image, array<string|int, mixed> $slideshow_file_info) : mixed
HookTransformAdmin_manage_slideshowRender_replace_slideshow_form_for_manage_slideshow(mixed $replace_slideshow_id) : mixed
HookTransformAllAdditionalheaderjs() : mixed
HookTransformAllRender_actions_add_collection_option(mixed $top_actions, mixed $options, mixed $collection_data, array<string|int, mixed> $urlparams) : mixed
HookTransformAllAdditional_title_pages_array() : mixed
HookTransformAllAdditional_title_pages() : mixed
HookTransformAllreplace_resource_file_extra(mixed $resource) : mixed
HookTransformCollection_editColleditformbottom() : mixed
HookTransformViewAfterresourceactions() : mixed
Intercept ResourceSpace searches and optionally handle them using Typesense.
HookTypesense_searchAllExternal_search(string $search, array<string|int, mixed> $keywords, array<string|int, mixed> $node_bucket, array<string|int, mixed> $node_bucket_not, mixed $restypes, mixed $order_by, array<string|int, mixed> $archive, mixed $fetchrows, string $sort, bool $access_override, bool $ignore_filters, bool $return_disk_usage, string $recent_search_daylimit, bool $return_refs_only, bool $editable_only, bool $returnsql, mixed $access, bool $smartsearch, PreparedStatementQuery $sql_filter, PreparedStatementQuery $sql_join, PreparedStatementQuery $select) : array<string|int, mixed>|false
Returning false allows normal MySQL-based ResourceSpace search processing to continue.
Original search string.
Parsed search keywords.
Included node search buckets.
Excluded node search buckets.
Resource type filter.
Requested sort field.
Archive state filter.
Result limit or chunk details.
Sort direction.
Whether access checks are overridden.
Whether standard filters are ignored.
Whether disk usage totals are requested.
Recent search day limit.
Whether only resource refs should be returned.
Whether only editable resources should be returned.
Whether SQL should be returned instead of results.
Access filter override.
Whether smart search mode is active.
Existing ResourceSpace filter SQL.
Existing ResourceSpace JOIN SQL.
Existing ResourceSpace SELECT SQL.
ResourceSpace-compatible search results, or false to fall back to core search.
Store resources using a node before the node is deleted.
HookTypesense_searchAllBeforenodedelete(int $node) : void
Node ID.
Reindex resources that used a node after the node has been deleted.
HookTypesense_searchAllAfternodedelete(int $node) : void
Node ID.
Reindex resource after metadata has been saved.
HookTypesense_searchAllAftersaveresourcedata() : false
Sync Typesense related keyword synonyms after related keywords have been saved.
HookTypesense_searchAllAfter_save_related_keywords(string $keyword, string $related) : false
Keyword that was updated.
Related keyword string.
Check whether the current ResourceSpace search can be handled by Typesense.
typesense_search_supported(string $search, array<string|int, mixed> $keywords, array<string|int, mixed> $node_bucket, array<string|int, mixed> $node_bucket_not, bool $return_disk_usage, bool $editable_only, bool $returnsql, bool $smartsearch) : bool
The original search string after ResourceSpace preprocessing.
Parsed search keywords.
Included node search buckets.
Excluded node search buckets.
Whether disk usage totals are requested.
Whether only editable resources should be returned.
Whether SQL should be returned instead of results.
Whether smart search mode is active.
True if Typesense can handle the search, otherwise false.
Run a ResourceSpace search using Typesense and return ResourceSpace-compatible results.
typesense_search_do_search(string $search, mixed $restypes, array<string|int, mixed> $archive, mixed $fetchrows, bool $return_refs_only, PreparedStatementQuery $select, string $order_by, string $sort) : array<string|int, mixed>|false
Search string.
Resource type filter.
Archive state filter.
Result limit or chunk details.
Whether only resource refs should be returned.
Existing ResourceSpace SELECT fields.
The order by SQL from the standard ResourceSpace search construction.
ResourceSpace-compatible results, or false to fall back to core search.
Query Typesense and return matching resource refs in relevance order.
typesense_search_get_refs(string $search, mixed $restypes, array<string|int, mixed> $archive, mixed $fetchrows, mixed $order_by, mixed $sort) : array<string|int, mixed>|false
Search string.
Resource type filter.
Archive state filter.
Result limit or chunk details.
Ordered resource refs, or false if Typesense should be bypassed.
Build a Typesense filter expression for simple ResourceSpace filters.
typesense_search_filter_by(mixed $restypes, array<string|int, mixed> $archive) : string
Resource type filter.
Archive state filter.
Typesense filter expression.
Hydrate Typesense resource refs into the standard ResourceSpace search result structure.
typesense_search_hydrate_refs(array<string|int, mixed> $refs, int $total, mixed $fetchrows, bool $return_refs_only, PreparedStatementQuery $select, string $order_by) : array<string|int, mixed>
Ordered resource refs from Typesense.
Total number of matches reported by Typesense.
Result limit or chunk details.
Whether only resource refs should be returned.
Existing ResourceSpace SELECT fields.
The order by SQL from the standard ResourceSpace search construction.
ResourceSpace-compatible search results.
Send a request to the Typesense API.
typesense_search_request(string $method, string $endpoint[, array<string|int, mixed>|null $payload = null ]) : array<string|int, mixed>|false
HTTP method.
API endpoint beginning with a slash.
Optional request payload.
Decoded JSON response, or false on failure.
Ensure that the Typesense resources collection exists.
typesense_search_ensure_collection() : bool
True if the collection exists or was created.
Build a Typesense document for a ResourceSpace resource.
typesense_search_get_document_data(int $resource) : array<string|int, mixed>|false
Resource ID.
Typesense document data, or false if the resource cannot be indexed.
Index a single ResourceSpace resource in Typesense.
typesense_search_index_resource(int $resource) : bool
Resource ID.
True if the resource was indexed successfully.
Delete a resource document from Typesense.
typesense_search_delete_resource(int $resource) : bool
Resource ID.
True if the delete request succeeded.
Reindex all resources that are currently linked to a node.
typesense_search_reindex_node_resources(int $node) : int
Node ID.
Number of resources successfully reindexed.
Reindex resources in batches.
typesense_search_reindex_all([int $limit = 100 ][, int $after = 0 ]) : array<string|int, mixed>
Maximum number of resources to index in this batch.
Only index resources with refs greater than this value.
Batch indexing summary.
Index a Typesense document.
typesense_search_index_document(array<string|int, mixed> $document) : bool
Typesense document data.
True if the document was indexed successfully.
Synchronise ResourceSpace related keywords to Typesense synonyms.
typesense_search_sync_related_keywords() : bool
Creates or updates synonym groups in the configured Typesense collection based on ResourceSpace related keyword relationships so that searches automatically match related terms using OR-style expansion.
True if the sync completed successfully.
HookUser_preferencesuser_change_passwordReplaceuserpreferencesheader() : mixed
HookUser_preferencesuser_change_passwordSaveadditionaluserpreferences() : mixed
HookUser_preferencesuser_change_passwordAdditionaluserpreferences() : mixed
HookVideo_bookendViewAfterresourceactions() : mixed
HookVideo_spliceAllInitialise() : mixed
HookVideo_spliceAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options) : mixed
HookVideo_spliceViewAfterresourceactions() : mixed
generate_merged_video(mixed $videos, mixed $video_splice_type, mixed $target_video_command, mixed $target_video_extension, mixed $target_audio_command, mixed $target_width, mixed $target_height, mixed $target_frame_rate, mixed $description, mixed $auto_populate_video_info, mixed $offline) : mixed
Trim video as requested from pages/trim.php
generate_video_trim(string $target, string $source_video_file, int $resource_ref, string $ffmpeg_start_time, string $ffmpeg_duration_time) : void
Path to the target file. This is the output location for the trim.
Path to the source video file. This file will be the input for the trim.
Ref of the resource to be trimmed.
Start of trim - formatted with gmdate()
Duration of trim - formatted with gmdate()
HookVideo_timestamp_linksViewFooterbottom() : mixed
HookVideo_tracksAllStaticsync_after_alt(mixed $resource[, mixed $altfile = "" ]) : mixed
HookVideo_tracksAllAfter_alt_upload(mixed $resource[, mixed $altfile = "" ]) : mixed
HookVideo_tracksViewModifydownloadbutton() : mixed
HookVideo_tracksViewDownloadbuttonreplace() : mixed
HookVideo_tracksViewAfterresourceactions() : mixed
HookVideo_tracksViewAdditionalresourcetools2(mixed $resource, mixed $access) : mixed
HookVimeo_publishAllInitialise() : mixed
HookVimeo_publishViewAfterresourceactions() : mixed
init_vimeo_api(mixed $client_id, mixed $client_secret, mixed $redirect_uri) : mixed
get_access_token(mixed $client_id, mixed $client_secret, mixed $redirect_uri) : mixed
delete_vimeo_token([mixed $user_ref = 0 ]) : mixed
get_vimeo_user(mixed $client_id, mixed $client_secret, mixed $access_token, array<string|int, mixed> &$vimeo_user_data) : mixed
vimeo_upload(mixed $client_id, mixed $client_secret, mixed $access_token, mixed $ref, mixed $file_path, mixed $rs_vimeo_link_field, mixed &$new_video_id, mixed &$error) : mixed
set_video_information(mixed $client_id, mixed $client_secret, mixed $access_token, mixed $video_id, mixed $parameters) : mixed
HookVm2rsAllInitialise() : mixed
Hookvm2rsUpload_batchUpload_page_bottom() : mixed
isValidVimeoURL(mixed $url) : mixed
Hookvm2rsViewrenderinnerresourcepreview() : mixed
Hookvm2rsViewreplacedownloadoptions() : mixed
HookVr_viewAllInitialise() : mixed
HookVr_viewAllAdditionalheaderjs() : mixed
HookVr_viewAllmodified_Cors_Process() : mixed
HookVr_viewPreviewFullpreviewresultnav() : mixed
HookVr_viewPreviewcustomflvplay() : mixed
HookVr_viewPreviewReplacepreviewimage() : mixed
HookVr_viewViewaftergetresourcedataview(mixed $ref, mixed $resource) : mixed
HookVr_viewViewReplacepreviewlink(string $preview_title) : mixed
HookVr_viewViewRenderinnerresourcepreview() : mixed
Check whether VR view is to be enabled for the specified resource
VrViewUseVR(array<string|int, mixed> $resource) : bool
Resource data array (not resource field data)
VrViewRenderPlayer(mixed $ref, mixed $source[, mixed $isvideo = false ][, mixed $width = 852 ][, mixed $height = 600 ][, mixed $parentdivid = "" ][, mixed $scope = "" ]) : mixed
Add whisper processing to the cron.
HookWhisperAllCron() : void
Prevent downloaded Whisper models from being deleted
HookWhisperAllTemp_block_deletion() : string
Hook into offline jobs list to add custom job
HookWhisperAllAddtriggerablejob() : array<string|int, mixed>
Array of existing job data with custom job added
Processes all unprocessed audio/video resources supported by Whisper.
whisper_process_unprocessed([int $size_limit = 0 ]) : int|false
This function:
The total size of files in GB to be processed in a batch, 0 = no limit
Returns the number of resources processed, or false if a process lock is active.
Converts a media file to audio, transcribes it using Whisper, and stores the transcript in a metadata field.
whisper_process(int $resource) : bool
This function:
whisper_processed = 1.The resource ID to process.
True on successful processing, false if any step fails.
HookYoutube_publishAllInitialise() : mixed
HookYoutube_publishViewAfterresourceactions() : mixed
youtube_publish_initialize() : mixed
get_youtube_authorization_code() : mixed
delete_youtube_tokens() : mixed
upload_video() : mixed
youtube_upload_get_categories() : mixed
Hookyt2rsAllInitialise() : mixed
Hookyt2rsUpload_batchUpload_page_bottom() : mixed
isValidURL(mixed $url) : mixed
Hookyt2rsViewrenderinnerresourcepreview() : mixed
Hookyt2rsViewreplacedownloadoptions() : mixed