<?php /** * addon header_php.php * * @package page * @copyright Copyright 2009 Liquid System Technology, Inc. * @author Koji Sasaki * @copyright Portions Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: header_php.php $ */ // This should be first line of the script: $zco_notifier->notify('NOTIFY_HEADER_START_ADDON'); $perse_page_module = zen_addOnModules_persePageModule($_GET['module']); $page_class = $perse_page_module['class']; $page_method = $perse_page_module['method']; // check module page enable $enable_module_page = false; $enabled_modules = zen_addOnModules_get_enabled_modules(); if (in_array($page_class, $enabled_modules) && method_exists($page_class, $page_method)) { $enable_module_page = true; } if (!$enable_module_page) { if (MISSING_PAGE_CHECK == 'On' || MISSING_PAGE_CHECK == 'true') { $redirect_page = FILENAME_DEFAULT; } elseif (MISSING_PAGE_CHECK == 'Page Not Found') { $redirect_page = FILENAME_PAGE_NOT_FOUND; } zen_redirect(zen_href_link($redirect_page));
function getPageJScript($page) { $return = false; if ($page == FILENAME_ADDON) { $perse_page_module = zen_addOnModules_persePageModule($_GET['module']); $page_class = $perse_page_module['class']; $page_method = $perse_page_module['method']; } if (method_exists($this, $page_method) && $page_class == $this->code) { $module = $this->code; $js = $this->_getTemplateDir($page_method . '.js', $page, 'jscript') . '/' . $page_method . '.js'; $js_php = $this->_getTemplateDir($page_method . '.php', $page, 'jscript') . '/' . $page_method . '.php'; ob_start(); if (file_exists($js)) { echo '<script type="text/javascript" src="' . $js . '"></script>' . "\n"; } if (file_exists($js_php)) { require $js_php; } $return = ob_get_contents(); ob_end_clean(); } return $return; }
function zen_addOnModules_get_layout_location_blocks($layout_location, $page) { global $db, $layout_location_blocks, $template_dir; $return = false; if (!is_array($layout_location_blocks)) { $layout_location_blocks = array(); } if (!is_array($layout_location_blocks[$layout_location])) { $layout_location_blocks[$layout_location] = array(); } $module_names = ''; $enabled_addon_modules = zen_addOnModules_get_enabled_modules(); $enabled_addon_modules[] = 'sideboxes'; if (count($enabled_addon_modules) > 0) { for ($i = 0, $n = count($enabled_addon_modules); $i < $n; $i++) { $class = $enabled_addon_modules[$i]; $module_names .= " '" . zen_db_prepare_input($class) . "',"; } $module_names = trim($module_names, ','); $query = "\n SELECT\n *\n FROM " . TABLE_BLOCKS . "\n WHERE module IN (" . $module_names . ")\n AND status = 1\n AND location = :location\n AND template = :template\n ORDER BY sort_order, block\n ;"; $query = $db->bindVars($query, ':location', $layout_location, 'string'); $query = $db->bindVars($query, ':template', $template_dir, 'string'); $result = $db->Execute($query); while (!$result->EOF) { $module = $result->fields['module']; $block = $result->fields['block']; $pages = $result->fields['pages']; $visible = $result->fields['visible']; $display = false; if ($pages == '') { $display = true; } else { if ($page == FILENAME_DEFAULT) { if (isset($_GET['cPath'])) { global $current_category_id; $page = zen_has_category_subcategories($current_category_id) ? FILENAME_DEFAULT . '_categories' : FILENAME_DEFAULT . '_products'; } if (isset($_GET['manufacturers_id'])) { $page = FILENAME_DEFAULT . '_products'; } } if ($page == FILENAME_ADDON) { $perse_page_module = zen_addOnModules_persePageModule($_GET['module']); $page = $perse_page_module['class'] . '#' . $perse_page_module['method']; } $page_match = zen_addOnModules_page_match($pages, $page); if ($visible == 1 && $page_match || $visible == 0 && !$page_match) { $display = true; } } if ($display) { $layout_location_blocks[$layout_location][] = array('module' => $module, 'block' => $block, 'css_selector' => $result->fields['css_selector'], 'insert_position' => $result->fields['insert_position']); } $result->MoveNext(); } } return $layout_location_blocks; }