[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 header.php

Zen Cart 源代码 header.php




下载文件

文件名: header.php
文件类型: PHP文件
文件大小: 13.23 KiB
MD5: 85bebc9a02b1a04fc12f0d17dbf3bd40

header.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: header.php 19529 2011-09-19 13:11:40Z wilt $
  8.  */
  9. if (!defined('IS_ADMIN_FLAG')) {
  10.   die('Illegal Access');
  11. }
  12.  
  13.   $version_check_requested = (isset($_GET['vcheck']) && $_GET['vcheck']!='') ? true : false;
  14.  
  15. // Show Languages Dropdown for convenience only if main filename and directory exists
  16. if ((basename($PHP_SELF) != FILENAME_DEFINE_LANGUAGE . '.php') and (basename($PHP_SELF) != FILENAME_PRODUCTS_OPTIONS_NAME . '.php') and empty($action)) {
  17.   $languages_array = array();
  18.   $languages = zen_get_languages();
  19.   if (sizeof($languages) > 1) {
  20.     //$languages_selected = $_GET['language'];
  21.     $languages_selected = $_SESSION['language'];
  22.     $missing_languages='';
  23.     $count = 0;
  24.     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
  25.       $test_directory= DIR_WS_LANGUAGES . $languages[$i]['directory'];
  26.       $test_file= DIR_WS_LANGUAGES . $languages[$i]['directory'] . '.php';
  27.       if ( file_exists($test_file) and file_exists($test_directory) ) {
  28.         $count++;
  29.         $languages_array[] = array('id' => $languages[$i]['code'],
  30.                                  'text' => $languages[$i]['name']);
  31. //        if ($languages[$i]['directory'] == $language) {
  32.         if ($languages[$i]['directory'] == $_SESSION['language']) {
  33.           $languages_selected = $languages[$i]['code'];
  34.         }
  35.       } else {
  36.         $missing_languages .= ' ' . ucfirst($languages[$i]['directory']) . ' ' . $languages[$i]['name'];
  37.       }
  38.     }
  39.  
  40. // if languages in table do not match valid languages show error message
  41.     if ($count != sizeof($languages)) {
  42.       $messageStack->add('MISSING LANGUAGE FILES OR DIRECTORIES ...' . $missing_languages,'caution');
  43.     }
  44.     $hide_languages= false;
  45.   } else {
  46.     $hide_languages= true;
  47.   } // more than one language
  48. } else {
  49.   $hide_languages= true;
  50. } // hide when other language dropdown is used
  51.  
  52. // check database version against source code
  53.   $zv_db_patch_ok = true; // we start with true
  54.   if (WARN_DATABASE_VERSION_PROBLEM != 'false') {
  55.     $result = $db->Execute("SELECT project_version_major, project_version_minor FROM " . TABLE_PROJECT_VERSION . " WHERE project_version_key = 'Zen-Cart Database'");
  56.     $zv_db_patch_level_found = $result->fields['project_version_major']. '.' . $result->fields['project_version_minor'];
  57.     $zv_db_patch_level_expected = EXPECTED_DATABASE_VERSION_MAJOR . '.' . EXPECTED_DATABASE_VERSION_MINOR;
  58.     if ($zv_db_patch_level_expected=='.' || ($zv_db_patch_level_found < $zv_db_patch_level_expected) ) {
  59.       $zv_db_patch_ok = false;
  60.       $messageStack->add(WARNING_DATABASE_VERSION_OUT_OF_DATE, 'warning');
  61.     }
  62.   }
  63. // Check that shipping/payment modules have been defined
  64.   if (zen_get_configuration_key_value('MODULE_PAYMENT_INSTALLED') == '') {
  65.     $messageStack->add(ERROR_PAYMENT_MODULES_NOT_DEFINED, 'caution');
  66.   }
  67.   if (zen_get_configuration_key_value('MODULE_SHIPPING_INSTALLED') == '') {
  68.     $messageStack->add(ERROR_SHIPPING_MODULES_NOT_DEFINED, 'caution');
  69.   }
  70.  
  71. // if welcome email coupon is set and <= 21 days warn shop owner
  72.     if (NEW_SIGNUP_DISCOUNT_COUPON > 0) {
  73.       $zc_welcome_check = $db->Execute("SELECT coupon_expire_date from " . TABLE_COUPONS . " WHERE coupon_id=" . (int)NEW_SIGNUP_DISCOUNT_COUPON);
  74.       $zc_current_date = date('Y-m-d');
  75.       $zc_days_to_expire = zen_date_diff($zc_current_date, $zc_welcome_check->fields['coupon_expire_date']);
  76.       if ($zc_days_to_expire <= 21) {
  77.         $zc_caution_warning = ($zc_days_to_expire <= 5 ? 'warning' : 'caution');
  78.         $messageStack->add(sprintf(WARNING_WELCOME_DISCOUNT_COUPON_EXPIRES_IN, $zc_days_to_expire), $zc_caution_warning);
  79.       }
  80.     }
  81.  
  82. // Alerts for EZ-Pages
  83.   if (EZPAGES_STATUS_HEADER == '2' and strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) {
  84.     $messageStack->add(TEXT_EZPAGES_STATUS_HEADER_ADMIN, 'caution');
  85.   }
  86.   if (EZPAGES_STATUS_FOOTER == '2' and strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) {
  87.     $messageStack->add(TEXT_EZPAGES_STATUS_FOOTER_ADMIN, 'caution');
  88.   }
  89.   if (EZPAGES_STATUS_SIDEBOX == '2' and strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) {
  90.     $messageStack->add(TEXT_EZPAGES_STATUS_SIDEBOX_ADMIN, 'caution');
  91.   }
  92.  
  93. // Editor alerts
  94.   if (HTML_EDITOR_PREFERENCE != 'NONE' && !is_dir(DIR_FS_CATALOG . 'editors')) {
  95.     $messageStack->add(ERROR_EDITORS_FOLDER_NOT_FOUND, 'caution');
  96.   }
  97.  
  98.  
  99. // check activity log size
  100.   if (basename($PHP_SELF) == FILENAME_DEFAULT . '.php') {
  101.     $show_admin_activity_log_link = false;
  102.  
  103.     $chk_admin_log = $db->Execute("select count(log_id) as counter from " . TABLE_ADMIN_ACTIVITY_LOG);
  104.     if ($chk_admin_log->fields['counter'] > 0) {
  105.       if ($chk_admin_log->fields['counter'] > 50000) {
  106.         $show_admin_activity_log_link = true;
  107.         $_SESSION['reset_admin_activity_log'] = true;
  108.         $messageStack->add(WARNING_ADMIN_ACTIVITY_LOG_RECORDS . $chk_admin_log->fields['counter'], 'caution');
  109.       }
  110.  
  111.       $chk_admin_log = $db->Execute("select min(access_date) as access_date from " . TABLE_ADMIN_ACTIVITY_LOG . " where access_date < DATE_SUB(CURDATE(),INTERVAL 60 DAY)");
  112.       if (!empty($chk_admin_log->fields['access_date'])) {
  113.         $show_admin_activity_log_link = true;
  114.         $_SESSION['reset_admin_activity_log'] = true;
  115.         $messageStack->add(WARNING_ADMIN_ACTIVITY_LOG_DATE . date('m-d-Y', strtotime($chk_admin_log->fields['access_date'])), 'caution');
  116.       }
  117.     }
  118.   }
  119.  
  120. // display alerts/error messages, if any
  121.   if ($messageStack->size > 0) {
  122.     echo $messageStack->output();
  123.   }
  124.  
  125. // check version with zen-cart server
  126.   // ignore version-check if INI file setting has been set
  127.   $version_from_ini = '';
  128.   $version_ini_sysinfo = '';
  129.   $version_ini_index_sysinfo = '';
  130.   if (!isset($version_check_sysinfo)) $version_check_sysinfo = false;
  131.   if (!isset($version_check_index))   $version_check_index = false;
  132.  
  133.   if (file_exists(DIR_FS_ADMIN . 'includes/local/skip_version_check.ini')) {
  134.     $lines=@file(DIR_FS_ADMIN . 'includes/local/skip_version_check.ini');
  135.     foreach($lines as $line) {
  136.       if (substr(trim($line),0,14)=='version_check=') $version_from_ini=substr(trim(strtolower(str_replace('version_check=','',$line))),0,3);
  137.       if (substr(trim($line),0,41)=='display_update_link_only_on_sysinfo_page=') $version_ini_sysinfo=trim(strtolower(str_replace('display_update_link_only_on_sysinfo_page=','',$line)));
  138.       if (substr(trim($line),0,46)=='display_update_link_on_index_and_sysinfo_page=') $version_ini_index_sysinfo=trim(strtolower(str_replace('display_update_link_only_on_sysinfo_page=','',$line)));
  139.     }
  140.   }
  141.   // ignore version check if not enabled or if not on main page or sysinfo page
  142.   if ((SHOW_VERSION_UPDATE_IN_HEADER == 'true' && $version_from_ini !='off' && ($version_check_sysinfo==true || $version_check_index==true) && $zv_db_patch_ok == true) || $version_check_requested==true ) {
  143.     $new_version = TEXT_VERSION_CHECK_CURRENT; //set to "current" by default
  144.     $lines = @file(NEW_VERSION_CHECKUP_URL);
  145.     //check for major/minor version info
  146.     if ((trim($lines[0]) > PROJECT_VERSION_MAJOR) || (trim($lines[0]) == PROJECT_VERSION_MAJOR && trim($lines[1]) > PROJECT_VERSION_MINOR)) {
  147.       $new_version = TEXT_VERSION_CHECK_NEW_VER . trim($lines[0]) . '.' . trim($lines[1]) . ' :: ' . $lines[2];
  148.     }
  149.     //check for patch version info
  150.     // first confirm that we're at latest major/minor -- otherwise no need to check patches:
  151.     if (trim($lines[0]) == PROJECT_VERSION_MAJOR && trim($lines[1]) == PROJECT_VERSION_MINOR) {
  152.       //check to see if either patch needs to be applied
  153.       if (trim($lines[3]) > intval(PROJECT_VERSION_PATCH1) || trim($lines[4]) > intval(PROJECT_VERSION_PATCH2)) {
  154.         // reset update message, since we WILL be advising of an available upgrade
  155.         if ($new_version == TEXT_VERSION_CHECK_CURRENT) $new_version = '';
  156.         //check for patch #1
  157.         if (trim($lines[3]) > intval(PROJECT_VERSION_PATCH1)) {
  158. //          if ($new_version != '') $new_version .= '<br />';
  159.           $new_version .= (($new_version != '') ? '<br />' : '') . '<span class="alert">' . TEXT_VERSION_CHECK_NEW_PATCH . trim($lines[0]) . '.' . trim($lines[1]) . ' - ' .TEXT_VERSION_CHECK_PATCH .': [' . trim($lines[3]) . '] :: ' . $lines[5] . '</span>';
  160.         }
  161.         if (trim($lines[4]) > intval(PROJECT_VERSION_PATCH2)) {
  162. //          if ($new_version != '') $new_version .= '<br />';
  163.           $new_version .= (($new_version != '') ? '<br />' : '') . '<span class="alert">' . TEXT_VERSION_CHECK_NEW_PATCH . trim($lines[0]) . '.' . trim($lines[1]) . ' - ' .TEXT_VERSION_CHECK_PATCH .': [' . trim($lines[4]) . '] :: ' . $lines[5] . '</span>';
  164.         }
  165.       }
  166.     }
  167.     // display download link
  168.     if ($new_version != '' && $new_version != TEXT_VERSION_CHECK_CURRENT) $new_version .= '<br /><a href="' . $lines[6] . '" target="_blank">'. TEXT_VERSION_CHECK_DOWNLOAD .'</a>';
  169.   } else {
  170.     // display the "check for updated version" button.  The button link should be the current page and all param's
  171.     $url=(isset($_SERVER['REQUEST_URI'])) ? str_replace(array('<','>'), '', $_SERVER['REQUEST_URI']) : zen_href_link(FILENAME_DEFAULT);
  172.     $url .= (strpos($url,'?')>5) ? '&vcheck=yes' : '?vcheck=yes';
  173.     if ($zv_db_patch_ok == true || $version_check_sysinfo==true ) $new_version = '<a href="' . $url . '">' . zen_image_button('button_check_new_version.gif',IMAGE_CHECK_VERSION) . '</a>';
  174.   }
  175.  
  176. // check GV release queue and alert store owner
  177.   if (SHOW_GV_QUEUE==true) {
  178.     $new_gv_queue= $db->Execute("select * from " . TABLE_COUPON_GV_QUEUE . " where release_flag='N'");
  179.     $new_gv_queue_cnt = 0;
  180.     if ($new_gv_queue->RecordCount() > 0) {
  181.       $new_gv_queue_cnt= $new_gv_queue->RecordCount();
  182.       $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE) . '">' . zen_image_button('button_gift_queue.gif',IMAGE_GIFT_QUEUE) . '</a>';
  183.     }
  184.   }
  185. ?>
  186. <!-- All HEADER_ definitions in the columns below are defined in includes/languages/english.php //-->
  187. <table border="0" width="100%" cellspacing="0" cellpadding="0" class="header">
  188. <?php
  189. // special spacing for alt_nav.php
  190.   if (basename($PHP_SELF) == 'alt_nav.php') {
  191. ?>
  192. <tr><td>&nbsp;</td></tr>
  193. <?php } // alt_nav spacing ?>
  194.   <tr>
  195.     <td align="left" valign="top" height="<?php echo HEADER_LOGO_HEIGHT; ?>" width="<?php echo HEADER_LOGO_WIDTH; ?>"><?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT) . '">' . zen_image(DIR_WS_IMAGES . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></td>
  196.     <td colspan="2" align="left"><table width="100%"><tr>
  197.     <td align="left" class="main" valign="top"><?php if ($new_gv_queue_cnt > 0) echo $goto_gv . '<br />' . sprintf(TEXT_SHOW_GV_QUEUE, $new_gv_queue_cnt); ?></td>
  198. <?php
  199.   if (isset($_SESSION['reset_admin_activity_log']) and ($_SESSION['reset_admin_activity_log'] == true and (basename($PHP_SELF) == FILENAME_DEFAULT . '.php'))) {
  200. ?>
  201.     <td align="center" class="main" valign="top"><?php echo '<a href="' . zen_href_link(FILENAME_ADMIN_ACTIVITY) . '">' . zen_image_button('button_reset.gif', RESET_ADMIN_ACTIVITY_LOG) . '<br />' . RESET_ADMIN_ACTIVITY_LOG . '</a>'; ?></td>
  202. <?php
  203.   }
  204. ?>
  205. <?php
  206.   if ($new_version) {
  207. ?>
  208.     <td align="right" class="main" valign="top"><?php echo $new_version; ?><br /><?php echo '(' . TEXT_CURRENT_VER_IS . ' v' . PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR . (PROJECT_VERSION_PATCH1 != '' ? 'p' . PROJECT_VERSION_PATCH1 : '') . ')'; ?></td>
  209. <?php
  210.   }
  211. ?>
  212.     </tr></table></td>
  213.   </tr>
  214. </table>
  215. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  216.   <tr class="headerBar">
  217.  
  218.     <td class="headerBarContent" align="left">
  219.       <?php
  220.       if (!$hide_languages) {
  221.         echo zen_draw_form('languages', basename($PHP_SELF), '', 'get');
  222.         echo DEFINE_LANGUAGE . '&nbsp;&nbsp;' . (sizeof($languages) > 1 ? zen_draw_pull_down_menu('language', $languages_array, $languages_selected, 'onChange="this.form.submit();"') : '');
  223.         echo zen_hide_session_id();
  224.         echo '</form>';
  225.       } else {
  226.         echo '&nbsp;';
  227.       }
  228.     ?>
  229.     </td>
  230.     <td class="headerBarContent" align="center"><b><?php echo date("r", time()) . 'GMT'  . '&nbsp;[' .  $_SERVER['REMOTE_ADDR'] . ' ]&nbsp;'; ?></b></td>
  231.     <td class="headerBarContent" align="right"><?php echo '
  232.        <a href="' . zen_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '" class="headerLink">' . HEADER_TITLE_TOP . '</a>&nbsp;|&nbsp;
  233.        <a href="' . zen_catalog_href_link() . '" class="headerLink" target="_blank">' . HEADER_TITLE_ONLINE_CATALOG . '</a>&nbsp;|&nbsp;
  234.        <a href="http://www.zen-cart.com/" class="headerLink" target="_blank">' . HEADER_TITLE_SUPPORT_SITE . '</a>&nbsp;|&nbsp;
  235.        <a href="' . zen_href_link(FILENAME_SERVER_INFO) . '" class="headerLink">' . HEADER_TITLE_VERSION . '</a>&nbsp;|&nbsp;
  236.        <a href="' . zen_href_link(FILENAME_ADMIN_ACCOUNT) . '" class="headerLink">' . HEADER_TITLE_ACCOUNT . '</a>&nbsp;|&nbsp;
  237.        <a href="' . zen_href_link(FILENAME_LOGOFF, '', 'SSL') . '" class="headerLink">' . HEADER_TITLE_LOGOFF . '</a>&nbsp;'; ?>
  238.     </td>
  239.   </tr>
  240. </table>
  241. <?php require(DIR_WS_INCLUDES . 'header_navigation.php'); ?>
  242.  


cron