Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

save_filter()

Description

Save filter, will return existing filter ID if text matches already migrated

Parameters

ColumnTypeDefaultDescription
$filter int - ID of filter
$filter_name int - Name of filter
$filter_condition int - One of RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY

Return

boolean | integer - false, or ID of filter

Location

include/search_functions.php lines 3077 to 3099

Definition

 
function save_filter($filter,$filter_name,$filter_condition)
    {
    if(!
in_array($filter_condition, array(RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY)))
        {
        return 
false;
        }

    if(
$filter != 0)
        {
        if(!
is_numeric($filter))
            {
            return 
false;
            }
        
ps_query("UPDATE filter SET name=?, filter_condition=? WHERE ref = ?",array("s",$filter_name,"s",$filter_condition,"i",$filter));
        }
    else
        {
        
ps_query("INSERT INTO filter (name, filter_condition) VALUES (?,?)",array("s",$filter_name,"s",$filter_condition));
        return 
sql_insert_id();
        }

    return 
$filter;
    }

This article was last updated 11th December 2024 12:35 Europe/London time based on the source file dated 27th November 2024 09:40 Europe/London time.