Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

set_slideshow()

Parameters

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

Location

include/slideshow_functions.php lines 13 to 61

Definition

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

    
$ref_escaped = ((int) $ref "'" escape_check($ref) . "'" 'NULL');
    
$resource_ref = ((int) $resource_ref "'" escape_check($resource_ref) . "'" 'NULL');
    
$homepage_show escape_check($homepage_show);
    
$featured_collections_show escape_check($featured_collections_show);
    
$login_show escape_check($login_show);

    
$query "
        INSERT INTO slideshow (ref, resource_ref, homepage_show, featured_collections_show, login_show)
             VALUES (
{$ref_escaped}{$resource_ref}, '{$homepage_show}', '{$featured_collections_show}', '{$login_show}')
                 ON DUPLICATE KEY
             UPDATE resource_ref = 
{$resource_ref},
                    homepage_show = '
{$homepage_show}',
                    featured_collections_show = '
{$featured_collections_show}',
                    login_show = '
{$login_show}'";

    
sql_query($query);

    
// 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;
        }
    else if(!
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 29th November 2020 05:05 Europe/London time based on the source file dated 8th June 2020 12:35 Europe/London time.