devine952 Posted June 8, 2005 Posted June 8, 2005 Hi all, two great contribs out there Banner Manager and the less well known os6tm_banner_manager I've got os6tm_banner_manager working great. Super contrib by Joss. Anyhow I am looking at translating the original French post and contributing it to OsC as soon as I can get both to work together. Right now I am getting parse error unexpected $ line 173 in the functions/banner.php file I have no clue what this means, hopefully it is obvious to someone looking at the pasted code below. Rob <?php /* $Id: banner.php,v 1.12 2003/06/20 00:12:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ //// // Sets the status of a banner function tep_set_banner_status($banners_id, $status) { if ($status == '1') { return tep_db_query("update " . TABLE_BANNERS . " set status = '1', date_status_change = now(), date_scheduled = NULL where banners_id = '" . (int)$banners_id . "'"); } elseif ($status == '0') { return tep_db_query("update " . TABLE_BANNERS . " set status = '0', date_status_change = now() where banners_id = '" . (int)$banners_id . "'"); } else { return -1; } } //// // Auto activate banners function tep_activate_banners() { $banners_query = tep_db_query("select banners_id, date_scheduled from " . TABLE_BANNERS . " where date_scheduled != ''"); if (tep_db_num_rows($banners_query)) { while ($banners = tep_db_fetch_array($banners_query)) { if (date('Y-m-d H:i:s') >= $banners['date_scheduled']) { tep_set_banner_status($banners['banners_id'], '1'); } } } } //// // Auto expire banners function tep_expire_banners() { $banners_query = tep_db_query("select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id"); if (tep_db_num_rows($banners_query)) { while ($banners = tep_db_fetch_array($banners_query)) { if (tep_not_null($banners['expires_date'])) { if (date('Y-m-d H:i:s') >= $banners['expires_date']) { tep_set_banner_status($banners['banners_id'], '0'); } } elseif (tep_not_null($banners['expires_impressions'])) { if ( ($banners['expires_impressions'] > 0) && ($banners['banners_shown'] >= $banners['expires_impressions']) ) { tep_set_banner_status($banners['banners_id'], '0'); } } } } } //// // Display a banner from the specified group or banner id ($identifier) function tep_display_banner($action, $identifier) { global $my_page_ssl; // added for webmakers - start switch (true) { case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='on' ): $my_banner_filter=" and banners_on_ssl= " . "'1' "; break; case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='off' ): $my_banner_filter=''; break; case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='on' ): $my_banner_filter=" and banners_on_ssl= " . "'2' "; break; case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='off' ): $my_banner_filter=''; break; } // added for Webmakers - end if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' " . $my_banner_filter . " and banners_group = '" . $identifier . "'"); //added " . $my_banner_filter . " webmakers $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, banners_open_new_windows, banners_on_ssl from " . TABLE_BANNERS . " where status = '1' " . $my_banner_filter . " and banners_group = '" . $identifier . "'"); // added for webmakers , banners_open_new_windows, banners_on_ssl and further " . $my_banner_filter . " } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; } } 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, banners_open_new_windows, banners_on_ssl from " . TABLE_BANNERS . " where status = '1' " . $my_banner_filter . " and banners_id = '" . $identifier . "'"); // added for Webmakers , banners_open_new_windows, banners_on_ssl and " . $my_banner_filter . " if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; } } } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { // WebMakers.com Added: Banner Manager if ( $banner['banners_open_new_windows'] =='1' ) { $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>'; } else { // Webmakers end of added $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; // deleted for webmakers target="_blank" } tep_update_banner_display_count($banner['banners_id']); return $banner_string; } //// // Check to see if a banner exists function tep_banner_exists($action, $identifier) { //added for os6tm banner manager global $current_category_id, $my_page_ssl, $HTTP_GET_VARS; // WebMakers.com Added: Banner Manager $my_page_ssl switch (true) { case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='on' ): $my_banner_filter=" and banners_on_ssl= " . "'1' "; break; case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='off' ): $my_banner_filter=''; break; case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='on' ): $my_banner_filter=" and banners_on_ssl= " . "'2' "; break; case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='off' ): $my_banner_filter=''; break; } // end of add in webmakers // if ($HTTP_GET_VARS['manufacturers_id'] == '') { if ($action == 'dynamic') { return tep_random_select("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text, b.banners_open_new_windows from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where status = '1' " . $my_banner_filter . " and banners_group = '" . $identifier . "' and btc.categories_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); // added , b.banners_open_new_windows for webmakers and further " . $my_banner_filter . " } elseif ($action == 'static') { //added for os6tm banner manager $banner_query = tep_db_query("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text, b.banners_open_new_windows from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where status = '1' " . $my_banner_filter . " and banners_id = '" . $identifier . "' and btc.categories_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); // added for webmakers , b.banners_open_new_windows and further " . $my_banner_filter . " return tep_db_fetch_array($banner_query); } else { return false; } } //} //// // Update the banner display statistics function tep_update_banner_display_count($banner_id) { $banner_check_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int)$banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')"); $banner_check = tep_db_fetch_array($banner_check_query); if ($banner_check['count'] > 0) { tep_db_query("update " . TABLE_BANNERS_HISTORY . " set banners_shown = banners_shown + 1 where banners_id = '" . (int)$banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')"); } else { tep_db_query("insert into " . TABLE_BANNERS_HISTORY . " (banners_id, banners_shown, banners_history_date) values ('" . (int)$banner_id . "', 1, now())"); } } //// // Update the banner click statistics function tep_update_banner_click_count($banner_id) { tep_db_query("update " . TABLE_BANNERS_HISTORY . " set banners_clicked = banners_clicked + 1 where banners_id = '" . (int)$banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')"); } ?> Quote
devine952 Posted June 8, 2005 Author Posted June 8, 2005 this is the error message Parse error: parse error, unexpected $ in /home/wspilo2/public_html/catalog/includes/functions/banner.php on line 173 I deactivated the if ($HTTP_GET_VARS['manufacturers_id'] == '') { line 139 but it makes no difference, I get the same error with it or without it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.