Esempio n. 1
0
function tep_display_banner($banner)
{
    global $request_type;
    if (is_array($banner)) {
        if (tep_not_null($banner['banners_html_text'])) {
            $banner_string = $banner['banners_html_text'];
        } else {
            $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '">' . tep_image(($request_type == 'SSL' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';
        }
        tep_update_banner_display_count($banner['banners_id']);
        return $banner_string;
    }
}
Esempio n. 2
0
function tep_display_banner($action, $identifier)
{
    $OSCOM_Db = Registry::get('Db');
    $banner = null;
    if ($action == 'dynamic') {
        $Qcheck = $OSCOM_Db->prepare('select banners_id from :table_banners where banners_group = :banners_group and status = 1 limit 1');
        $Qcheck->bindValue(':banners_group', $identifier);
        $Qcheck->execute();
        if ($Qcheck->fetch() !== false) {
            $Qbanner = $OSCOM_Db->prepare('select banners_id, banners_title, banners_image, banners_html_text from :table_banners where banners_group = :banners_group and status = 1 order by rand() limit 1');
            $Qbanner->bindValue(':banners_group', $identifier);
            $Qbanner->execute();
            $banner = $Qbanner->fetch();
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $Qbanner = $OSCOM_Db->prepare('select banners_id, banners_title, banners_image, banners_html_text from :table_banners where banners_id = :banners_id and status = 1');
            $Qbanner->bindInt(':banners_id', $identifier);
            $Qbanner->execute();
            if ($Qbanner->fetch() !== false) {
                $banner = $Qbanner->toArray();
            }
        }
    }
    $output = '';
    if (isset($banner)) {
        if (!empty($banner['banners_html_text'])) {
            $output = $banner['banners_html_text'];
        } else {
            $output = '<a href="' . OSCOM::link('redirect.php', 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . HTML::image(OSCOM::linkImage($banner['banners_image']), $banner['banners_title']) . '</a>';
        }
        tep_update_banner_display_count($banner['banners_id']);
    }
    return $output;
}
Esempio n. 3
0
function tep_display_banner($action, $identifier)
{
    if ($action == 'dynamic') {
        $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
        $banners = tep_db_fetch_array($banners_query);
        if ($banners['count'] > 0) {
            $banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
        } else {
            return '<strong>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</strong>';
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int) $identifier . "'");
            if (tep_db_num_rows($banner_query)) {
                $banner = tep_db_fetch_array($banner_query);
            } else {
                return '<strong>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</strong>';
            }
        }
    } else {
        return '<strong>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</strong>';
    }
    if (tep_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';
    }
    tep_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}