Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource 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 2560 to 2583

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;    
            }
        
sql_query("UPDATE filter SET name='" escape_check($filter_name). "', filter_condition='{$filter_condition}' WHERE ref = '" escape_check($filter)  . "'");
        }
    else
        {
        
$newfilter sql_query("INSERT INTO filter (name, filter_condition) VALUES ('" escape_check($filter_name). "','{$filter_condition}')");
        
$newfilter sql_insert_id();
        return 
$newfilter;
        }

    return 
$filter;
    }

This article was last updated 30th November 2020 10:05 Europe/London time based on the source file dated 26th November 2020 14:30 Europe/London time.