Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

set_slideshow()

Parameters

ColumnTypeDefaultDescription
$ref
$homepage_show 1
$featured_collections_show 1
$login_show 0

Location

include/slideshow_functions.php lines 13 to 64

Definition

 
function set_slideshow($ref$homepage_show 1$featured_collections_show 1$login_show 0)
    {
    if(
        (!
is_null($ref) && !is_numeric($ref))
        || !
is_numeric($homepage_show)
        || !
is_numeric($featured_collections_show)
        || !
is_numeric($login_show))
        {
        return 
false;
        }

    
$ref = ((int) $ref $ref null);

    
$query "
        INSERT INTO slideshow (ref, homepage_show, featured_collections_show, login_show)
             VALUES (?, ?, ?, ?)
                 ON DUPLICATE KEY
             UPDATE homepage_show = ?,
                    featured_collections_show = ?,
                    login_show = ?"
;
    
$query_params = array(
        
"i",$ref,
        
"i",$homepage_show,
        
"i",$featured_collections_show,
        
"i",$login_show,
        
"i",$homepage_show,
        
"i",$featured_collections_show,
        
"i",$login_show,
    );

    
ps_query($query,$query_params);

    
// Clear cache
    
clear_query_cache("slideshow");

    
$new_ref sql_insert_id();
    if(
is_null($ref) && $new_ref != 0)
        {
        
log_activity("Added new slideshow image"LOG_CODE_CREATEDnull'slideshow''ref'$new_ref);

        return 
$new_ref;
        }
    elseif(!
is_null($ref) && $new_ref != && $ref == $new_ref)
        {
        
log_activity("Updated slideshow image"LOG_CODE_EDITEDnull'slideshow''ref'$ref);

        return 
$new_ref;
        }


    return 
false;
    }

This article was last updated 23rd July 2024 21:35 Europe/London time based on the source file dated 15th April 2024 14:55 Europe/London time.