1. <?php
  2. /**
  3.  * ezpages sidebox - used to display links to EZ-Pages content
  4.  *
  5.  * @package templateSystem
  6.  * @copyright Copyright 2003-2007 Zen Cart Development Team
  7.  * @copyright Portions Copyright 2003 osCommerce
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version $Id: ezpages.php 6021 2007-03-17 16:34:19Z ajeh $
  10.  */
  11.  
  12. $zco_notifier->notify('NOTIFY_START_EZPAGES_SIDEBOX');
  13. // test if sidebox should display
  14. if (EZPAGES_STATUS_SIDEBOX == '1' or (EZPAGES_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) {
  15. if (isset($var_linksList)) {
  16. unset($var_linksList);
  17. }
  18. $page_query = $db->Execute("select * from " . TABLE_EZPAGES . " where status_sidebox = 1 and sidebox_sort_order > 0 AND site = '".$_SERVER['HTTP_HOST']."' order by sidebox_sort_order, pages_title");
  19. if ($page_query->RecordCount()>0) {
  20. $title = BOX_HEADING_EZPAGES;
  21. $box_id = 'ezpages';
  22. $rows = 0;
  23. while (!$page_query->EOF) {
  24. $rows++;
  25. $page_query_list_sidebox[$rows]['id'] = $page_query->fields['pages_id'];
  26. $page_query_list_sidebox[$rows]['name'] = $page_query->fields['pages_title'];
  27. $page_query_list_sidebox[$rows]['altURL'] = "";
  28. switch (true) {
  29. // external link new window or same window
  30. case ($page_query->fields['alt_url_external'] != ''):
  31. $page_query_list_sidebox[$rows]['altURL'] = $page_query->fields['alt_url_external'];
  32. break;
  33. // internal link new window
  34. case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '1'):
  35. $page_query_list_sidebox[$rows]['altURL'] = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
  36. $page_query->fields['alt_url'] :
  37. ($page_query->fields['alt_url']=='' ? '' : zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' ? 'NONSSL' : 'SSL'), true, true, true));
  38. break;
  39. // internal link same window
  40. case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '0'):
  41. $page_query_list_sidebox[$rows]['altURL'] = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
  42. $page_query->fields['alt_url'] :
  43. ($page_query->fields['alt_url']=='' ? '' : zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' ? 'NONSSL' : 'SSL'), true, true, true));
  44. break;
  45. }
  46. // if altURL is specified, use it; otherwise, use EZPage ID to create link
  47. $page_query_list_sidebox[$rows]['link'] =
  48. zen_href_link(FILENAME_EZPAGES, 'id=' . $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > 0 ? '&chapter=' . $page_query->fields['toc_chapter'] : ''), ($page_query->fields['page_is_ssl']=='0' ? 'NONSSL' : 'SSL'));
  49. $page_query_list_sidebox[$rows]['link'] .= ($page_query->fields['page_open_new_window'] == '1' ? '" target="_blank' : '');
  50.  
  51. print 'id=' . $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > 0 ? '&chapter=' . $page_query->fields['toc_chapter'] : '') . "<br>\n";
  52. $page_query->MoveNext();
  53. }
  54.  
  55. $title_link = false;
  56.  
  57. $var_linksList = $page_query_list_sidebox;
  58.  
  59. require($template->get_template_dir('tpl_ezpages.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_ezpages.php');
  60.  
  61. $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
  62. require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
  63. }
  64. } // test for display
  65.  
  66. $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
  67. ?>
  68. root@lightning /home/greasedl/public_html/incl