[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 源代码 class.installer_version_manager.php

Zen Cart 源代码 class.installer_version_manager.php




下载文件

文件名: class.installer_version_manager.php
文件类型: PHP文件
文件大小: 35.24 KiB
MD5: 5f4a1994db5a1cdbbde6077f7df400ff

class.installer_version_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * Version Manager Class
  4.  *
  5.  * This class is used during the installation and upgrade processes
  6.  * @package Installer
  7.  * @access private
  8.  * @copyright Copyright 2003-2012 Zen Cart Development Team
  9.  * @copyright Portions Copyright 2003 osCommerce
  10.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  11.  * @version GIT: $Id: Author: DrByte  Tue Aug 28 17:13:32 2012 -0400 Modified in v1.5.1 $
  12.  */
  13.  
  14.  
  15.  
  16. /*////////////////////////////////////////////////////////////////////////////////////////////////////////////
  17. ////  HOW TO UPDATE FOR NEW RELEASES:
  18. ////  a. in function zen_database() below, set the $this->latest_version appropriately
  19. ////  b. in function check_check_all_versions(), update:
  20. ////     i)  add a line to call a new check_versionXXXX() function
  21. ////     ii) add another IF statement to set the displayed version text ($retVal)
  22. ////  c. add a new check_versionXXXX() function to the end of the class (BEFORE the closing } in the file)
  23. ////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
  24.  
  25.   class versionManager extends base{
  26.     var $latest_version, $found_version, $zdb_configuration_table_found;
  27.  
  28.     function versionManager() {
  29.       /**
  30.        * The version that this edition of the installer is designed to support
  31.        */
  32.       $this->latest_version = '1.5.1';
  33.  
  34.       /**
  35.        * Check to see if the configuration table can be found...thus validating the installation, in part.
  36.        */
  37.       $this->zdb_configuration_table_found = $this->check_configuration_table();
  38.       /**
  39.        * Check to see which versions are successfully detected
  40.        */
  41.       $this->found_version = $this->check_check_all_versions();
  42.     }
  43.  
  44.     function check_configuration_table() {
  45.       global $db_test;
  46. // Check to see if any Zen Cart tables exist
  47.       $tables = $db_test->Execute("SHOW TABLES like '".DB_PREFIX."configuration'");
  48.        if (ZC_UPG_DEBUG==true) echo 'ZEN-Configuration (should be 1) = '. $tables->RecordCount() .'<br>';
  49.        if ($tables->RecordCount() > 0) {
  50.          return true;
  51.        }
  52.     }
  53.  
  54.     function check_check_all_versions() {
  55.       if (!$this->zdb_configuration_table_found) return false;
  56.       $this->version110 = $this->check_version_110();
  57.       $this->version111 = $this->check_version_111();
  58.       $this->version112 = $this->check_version_112();  // no way to determine
  59.       $this->version113 = $this->check_version_113();  // there were no db changes for 1.1.3
  60.       $this->version114 = $this->check_version_114();
  61.       $this->version1141 = $this->check_version_1141();
  62.       $this->version120 = $this->check_version_120();
  63.       $this->version121 = $this->check_version_121();
  64.       $this->version122 = $this->check_version_122();
  65.       $this->version123 = $this->check_version_123();
  66.       $this->version124 = $this->check_version_124();
  67.       $this->delete_bad_1_2_4_index_key();
  68.       $this->version125 = $this->check_version_125();
  69.       $this->version126 = $this->check_version_126();
  70.       $this->version127 = $this->check_version_127();
  71.       $this->version130 = $this->check_version_130();
  72.       $this->version1301 = $this->check_version_1301();
  73.       $this->version1302 = $this->check_version_1302();
  74.       $this->version135 = $this->check_version_135();
  75.       $this->version136 = $this->check_version_136();
  76.       $this->version137 = $this->check_version_137();
  77.       $this->version138 = $this->check_version_138();
  78.       $this->version139 = $this->check_version_139();
  79.       $this->version150 = $this->check_version_150();
  80.       $this->version151 = $this->check_version_151();
  81.  
  82.         if ($this->version110 == true)  $retVal = '1.1.0';
  83.         if ($this->version111 == true)  $retVal = '1.1.1';
  84.         if ($this->version112 == true)  $retVal = '1.1.2 or 1.1.3';
  85.         if ($this->version114 == true)  $retVal = '1.1.4';
  86.         if ($this->version1141 == true) $retVal = '1.1.4-patch1';
  87.         if ($this->version120 == true)  $retVal = '1.2.0';
  88.         if ($this->version121 == true)  $retVal = '1.2.1';
  89.         if ($this->version122 == true)  $retVal = '1.2.2';
  90.         if ($this->version123 == true)  $retVal = '1.2.3';
  91.         if ($this->version124 == true)  $retVal = '1.2.4';
  92.         if ($this->version125 == true)  $retVal = '1.2.5';
  93.         if ($this->version126 == true)  $retVal = '1.2.6';
  94.         if ($this->version127 == true)  $retVal = '1.2.7';
  95.         if ($this->version130 == true)  $retVal = '1.3.0';
  96.         if ($this->version1301 == true) $retVal = '1.3.0.1';
  97.         if ($this->version1302 == true) $retVal = '1.3.0.2';
  98.         if ($this->version135 == true) $retVal = '1.3.5';
  99.         if ($this->version136 == true) $retVal = '1.3.6';
  100.         if ($this->version137 == true) $retVal = '1.3.7';
  101.         if ($this->version138 == true) $retVal = '1.3.8';
  102.         if ($this->version139 == true) $retVal = '1.3.9';
  103.         if ($this->version150 == true) $retVal = '1.5.0';
  104.         if ($this->version151 == true) $retVal = '1.5.1';
  105.  
  106.       return $retVal;
  107.     }
  108.  
  109.     function check_version_110() {
  110.       global $db_test;
  111.       // first test to see if they have run the 1.1 upgrade script   (v1.0.4 to v.1.1.1)
  112.       $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "files_uploaded'");
  113.        if (ZC_UPG_DEBUG==true) echo '104-Table (should be 1) = '. $tables->RecordCount() .'<br>';
  114.        if ($tables->RecordCount() > 0) {
  115.           return true;
  116.       }
  117.     } //end of 1.1.0 check
  118.  
  119.     function check_version_111() {
  120.       global $db_test;
  121.       // test to see if they have run the 1.1 -> 1.1.1 bugfix update
  122.       $got_v1_1_1 = false;
  123.       $sql = "SELECT count(*) as count FROM " . DB_PREFIX . "configuration WHERE configuration_key = 'CATEGORIES_COUNT_ZERO'";
  124.       $result = $db_test->Execute($sql);
  125.       if (ZC_UPG_DEBUG==true) echo 'v111-count (should be 1) =' . $result->fields['count'] .'<br>';
  126.       if ($result->fields['count'] > '0') {
  127.         $got_v1_1_1 = true;
  128.       }
  129.       return $got_v1_1_1;
  130.     } //end of 1.1.1 check
  131.  
  132.     function check_version_112() {
  133.       global $db_test;
  134.       if (ZC_UPG_DEBUG==true) echo '112-unknown-no way to determine<br>';
  135.       return true;
  136.     } //end of 1.1.2 check
  137.  
  138.     function check_version_113(){
  139.     // there were no critical SQL changes from v1.1.2 to v1.1.3 -- just to change a default, but such change shouldn't
  140.     // be necessary if the installed shop/store is already functional, unless can't get free-shipping for 0-weight to work
  141.       if (ZC_UPG_DEBUG==true) echo '113-unknown-no way to determine<br>';
  142.       return true;
  143.     }
  144.  
  145.     function check_version_114(){
  146.       global $db_test;
  147.       // test to see if they have run the 1.1.2 -> 1.1.4 update
  148.       $sql = "show fields from " . DB_PREFIX . "customers_basket_attributes";   // could we use "describe" as well ?
  149.       $result = $db_test->Execute($sql);
  150.       while (!$result->EOF) {
  151.       if (ZC_UPG_DEBUG==true) echo "114-fields (need products_options_sort_order) =" . $result->fields['Field'] . '<br>';
  152.        if  ($result->fields['Field'] == 'products_options_sort_order') {
  153.          if ($result->fields['Type'] == 'text')  {
  154.            $got_v1_1_4 = true;
  155.          }
  156.        }
  157.         $result->MoveNext();
  158.       }
  159.       return $got_v1_1_4;
  160.     } //end of 1.1.4 check
  161.  
  162.     function check_version_1141() {
  163.       global $db_test;
  164.       // test to see if they have run the 1.1.4 -> PATCH1 update
  165.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='SHIPPING_BOX_WEIGHT'";   // could use "describe" as well ?
  166.       $result = $db_test->Execute($sql);
  167.       while (!$result->EOF) {
  168.       if (ZC_UPG_DEBUG==true) echo "114patch-fields=" . $result->fields['configuration_title'] . '<br>';
  169.         if  ($result->fields['configuration_title'] == '小包裹包装材料 - 百分比+重量') {
  170.            $got_v1_1_4_patch1 = true;
  171.         }
  172.         $result->MoveNext();
  173.       }
  174.       return $got_v1_1_4_patch1;
  175.     } // end 1.1.4-patch1 check
  176.  
  177.     function check_version_120() {
  178.       global $db_test;
  179.       // test to see if the v1.1.4->v1.2.0 upgrade has been completed
  180.       //1st check for v1.20
  181.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='TUTORIAL_STATUS'";
  182.       $result = $db_test->Execute($sql);
  183.       $got_v1_2_0a = true;  // set true -- if value found (but should be deleted), then set to false.
  184.         while (!$result->EOF) {
  185.           if (ZC_UPG_DEBUG==true) echo "120a-configtitle=" . $result->fields['configuration_title'] . '<br>';
  186.           if  ($result->fields['configuration_title'] != '') {
  187.             $got_v1_2_0a = false;
  188.           }
  189.           $result->MoveNext();
  190.         }
  191.       //2nd check for v1.20
  192.       $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "product_type_layout'");
  193.       if (ZC_UPG_DEBUG==true) echo '120b-Table= '. $tables->RecordCount() .'<br>';
  194.       if ($tables->RecordCount() > 0) {
  195.         $got_v1_2_0b = true;
  196.       }
  197.       //3rd check for v1.20
  198.       $sql = "select configuration_group_title, configuration_group_description from " . DB_PREFIX . "configuration_group WHERE configuration_group_id = '13'";
  199.       $result = $db_test->Execute($sql);
  200.       while (!$result->EOF) {
  201.         if (ZC_UPG_DEBUG==true) echo "120c-cfggroup13=attrb ==" . $result->fields['configuration_group_title'] . '<br>';
  202.         if ($result->fields['configuration_group_title'] == '属性设置') {
  203.           $got_v1_2_0c = true;
  204.         }
  205.         $result->MoveNext();
  206.       }
  207.      //4th check for v1.20
  208.      $sql = "show fields from " . DB_PREFIX . "categories";
  209.       $result = $db_test->Execute($sql);
  210.       while (!$result->EOF) {
  211.         if (ZC_UPG_DEBUG==true) echo "120d-fields=" . $result->fields['Field'] . '<br>';
  212.         if ($result->fields['Field'] == 'categories_status') {
  213.           if ($result->fields['Type'] == 'tinyint(1)')  {
  214.             $got_v1_2_0d = true;
  215.           }
  216.         }
  217.         $result->MoveNext();
  218.       }
  219.       //5th check for v1.20
  220.       $sql = "show fields from " . DB_PREFIX . "customers";
  221.       $result = $db_test->Execute($sql);
  222.       while (!$result->EOF) {
  223.         if (ZC_UPG_DEBUG==true) echo "120e-fields=" . $result->fields['Field'] . '<br>';
  224.         if  ($result->fields['Field'] == 'customers_nick' || $result->fields['Field'] == 'customers_group_pricing' || $result->fields['Field'] == 'customers_email_format') {
  225.           $got_v1_2_0e = true;
  226.         }
  227.         $result->MoveNext();
  228.       }
  229.       //6th check for v1.20
  230.       $sql = "show fields from " . DB_PREFIX . "products";
  231.       $result = $db_test->Execute($sql);
  232.       while (!$result->EOF) {
  233.       if (ZC_UPG_DEBUG==true) echo "120f-fields=" . $result->fields['Field'] . '<br>';
  234.         if  ($result->fields['Field'] == 'master_categories_id') {
  235.           $got_v1_2_0f = true;
  236.         }
  237.         $result->MoveNext();
  238.       }
  239.  
  240.       //7th check for v1.2.0
  241.       $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "project_version'");
  242.       if ($tables->RecordCount() > 0) {
  243.       $sql = "SELECT project_version_major, project_version_minor from " . DB_PREFIX . "project_version WHERE project_version_key = 'Zen-Cart Main'";
  244.       $result = $db_test->Execute($sql);
  245.       if (ZC_UPG_DEBUG==true) echo "120g-project_version=" . $result->fields['project_version_major'] . '.' . $result->fields['project_version_minor'] . '<br>';
  246.       if ($result->fields['project_version_major']=='1' && $result->fields['project_version_minor']>='2') $got_v1_2_0g = true;
  247.       } //end project_version
  248.  
  249.       // evaluate all 6 checks
  250.       if ($got_v1_2_0a && $got_v1_2_0b && $got_v1_2_0c && $got_v1_2_0d && $got_v1_2_0e && $got_v1_2_0f) {
  251.         $got_v1_2_0 = true;
  252.         if (ZC_UPG_DEBUG==true) echo '已有 1.2.0<br>';
  253.       }
  254.       return $got_v1_2_0;
  255.     } // end 1.2.0 check
  256.  
  257.  
  258.     function check_version_121() {
  259.       global $db_test;
  260.       $got_v1_2_1a = false;
  261.       $got_v1_2_1b = false;
  262.  
  263.       // test to see if the v1.2.0->v1.2.1 upgrade has been completed
  264.       $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "project_version'");
  265.       if ($tables->RecordCount() > 0) {
  266.         //1st check for v1.2.1
  267.         $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='DISPLAY_PRICE_WITH_TAX_ADMIN'";
  268.         $result = $db_test->Execute($sql);
  269.         if (ZC_UPG_DEBUG==true) echo "121a-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  270.         if ($result->RecordCount()>0) $got_v1_2_1a = true;
  271.       }
  272.  
  273.       //2nd check for v1.2.1
  274.       $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "products_discount_quantity'");
  275.       if ($tables->RecordCount() > 0) {
  276.         $sql = "show fields from " . DB_PREFIX . "products_discount_quantity";
  277.         $result = $db_test->Execute($sql);
  278.         while (!$result->EOF) {
  279.           if (ZC_UPG_DEBUG==true) echo "121b-fields-'discount_qty'->FLOAT=" . $result->fields['Field'] . '->' . $result->fields['Type'] . '<br>';
  280.           if  ($result->fields['Field'] == 'discount_qty') {
  281.             if (strtoupper($result->fields['Type']) == 'FLOAT')  {
  282.               $got_v1_2_1b = true;
  283.             }
  284.           }
  285.           $result->MoveNext();
  286.         }
  287.       }
  288.  
  289.       if (ZC_UPG_DEBUG==true) {
  290.         echo '1.2.1a='.$got_v1_2_1a.'<br>';
  291.         echo '1.2.1b='.$got_v1_2_1b.'<br>';
  292.       }
  293.       // evaluate all 3 checks
  294.       if ($got_v1_2_1a && $got_v1_2_1b) {
  295.         $got_v1_2_1 = true;
  296.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.1<br>';
  297.       }
  298.       return $got_v1_2_1;
  299.     } //end of 1.2.1 check
  300.  
  301.  
  302.     function check_version_122() {
  303.       global $db_test;
  304.       // 1.2.2 checks
  305.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='SEND_EXTRA_ORDER_EMAILS_TO'";
  306.       $result = $db_test->Execute($sql);
  307.       if (ZC_UPG_DEBUG==true) echo "122a-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  308.       if  ($result->fields['configuration_title'] == '发送订单确认电子邮件的复件到') {
  309.         $got_v1_2_2a = true;
  310.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.2<br>';
  311.       }
  312.       return $got_v1_2_2a;
  313.     } //end of 1.2.2 check
  314.  
  315.     function check_version_123() {
  316.       global $db_test;
  317.       //1st check for v1.2.3
  318.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key = 'DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID'";
  319.       $result = $db_test->Execute($sql);
  320.       if (ZC_UPG_DEBUG==true) echo "123a-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  321.       if  ($result->fields['configuration_title'] == '缺省的金额为零的订单状态') {
  322.         $got_v1_2_3 = true;
  323.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.3<br>';
  324.       }
  325.       return $got_v1_2_3;
  326.     } //end of 1.2.3 check
  327.  
  328.     function check_version_124() {
  329.       global $db_test;
  330.       //1st check for v1.2.4
  331.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='PRODUCTS_MANUFACTURERS_STATUS'";
  332.       $result = $db_test->Execute($sql);
  333.       if (ZC_UPG_DEBUG==true) echo "124a-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  334.       if  ($result->fields['configuration_title'] == '厂商列表 - 检验商品存在') {
  335.         $got_v1_2_4 = true;
  336.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.4<br>';
  337.       }
  338.       return $got_v1_2_4;
  339.     } //end of 1.2.4 check
  340.  
  341.     function delete_bad_1_2_4_index_key() {
  342.       global $db_test;
  343.       // THE FOLLOWING SIMPLY CHECKS FOR THE EXTRA INDEX KEY AND REMOVES IT:
  344.       $tables = $db_test->Execute("SHOW TABLES like '".DB_PREFIX."project_version_history'");
  345.       if ($tables->RecordCount() > 0) {
  346.         $sql = "show index from " . DB_PREFIX . "project_version_history";
  347.         $result = $db_test->Execute($sql);
  348.         while (!$result->EOF) {
  349.           if (ZC_UPG_DEBUG==true) echo "INDEX TEST-'project_version_history'=" . $result->fields['Key_name'] . ' (vs project_version_key)' . '<br>';
  350.           if  ($result->fields['Key_name'] == 'project_version_key') {
  351.             if (ZC_UPG_DEBUG==true) echo 'Index on project_version_key found. Deleting.<br>';
  352.             $db_test->Execute("drop index project_version_key on " . DB_PREFIX . "project_version_history");
  353.             return true;
  354.           }
  355.           $result->MoveNext();
  356.         }
  357.       }
  358.     }
  359.  
  360.     function check_version_125() {
  361.       global $db_test;
  362.       //1st check for v1.2.5
  363.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='SESSION_IP_TO_HOST_ADDRESS'";
  364.       $result = $db_test->Execute($sql);
  365.       if (ZC_UPG_DEBUG==true) echo "125a-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  366.       if  ($result->fields['configuration_title'] == 'IP到主机名转换') {
  367.         $got_v1_2_5a = true;
  368.       }
  369.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='MAX_DISPLAY_PRODUCTS_TO_CATEGORIES_COLUMNS'";
  370.       $result = $db_test->Execute($sql);
  371.       if (ZC_UPG_DEBUG==true) echo "125b-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  372.       if  ($result->fields['configuration_title'] == '商品链接多个分类的显示') {
  373.         $got_v1_2_5b = true;
  374.       }
  375.       //3rd check for v1.2.5
  376.         $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "meta_tags_products_description'");
  377.          if (ZC_UPG_DEBUG==true) echo '125c-Table= '. $tables->RecordCount() .'<br>';
  378.          if ($tables->RecordCount() > 0) {
  379.            $got_v1_2_5c = true;
  380.          }
  381.       //4th check for v1.2.5
  382.       $sql = "show fields from " . DB_PREFIX . "whos_online";
  383.       $result = $db_test->Execute($sql);
  384.       while (!$result->EOF) {
  385.         if (ZC_UPG_DEBUG==true) echo "125d-fields-'user_agent'->VARCHAR=" . $result->fields['Field'] . '->' . $result->fields['Type'] . '<br>';
  386.         if  ($result->fields['Field'] == 'user_agent') {
  387.           if (strstr(strtoupper($result->fields['Type']),'VARCHAR'))  {
  388.             $got_v1_2_5d = true;
  389.           }
  390.         }
  391.       $result->MoveNext();
  392.       }
  393.  
  394.       if (ZC_UPG_DEBUG==true) {
  395.         echo '1.2.5a='.$got_v1_2_5a.'<br>';
  396.         echo '1.2.5b='.$got_v1_2_5b.'<br>';
  397.         echo '1.2.5c='.$got_v1_2_5c.'<br>';
  398.         echo '1.2.5d='.$got_v1_2_5d.'<br>';
  399.       }
  400.       // evaluate all 4 1.2.5 checks
  401.       if ($got_v1_2_5a && $got_v1_2_5b && $got_v1_2_5c && $got_v1_2_5d) {
  402.         $got_v1_2_5 = true;
  403.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.5<br>';
  404.       }
  405.       return $got_v1_2_5;
  406.     } // end 1.2.5 check
  407.  
  408.  
  409.     function check_version_126() {
  410.       global $db_test;
  411.       //check for v1.2.6
  412.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='CATEGORIES_TABS_STATUS'";
  413.       $result = $db_test->Execute($sql);
  414.       if (ZC_UPG_DEBUG==true) echo "126-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  415.       if  ($result->fields['configuration_title'] == '分类标签菜单 打开/关闭') {
  416.         $got_v1_2_6 = true;
  417.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.6<br>';
  418.       }
  419.       return $got_v1_2_6;
  420.     }  // end 1.2.6 check
  421.  
  422.  
  423.     function check_version_127() {
  424.       global $db_test;
  425.       //check for v1.2.7
  426.       $sql = "select configuration_description from " . DB_PREFIX . "configuration where configuration_key='SHOW_VERSION_UPDATE_IN_HEADER'";
  427.       $result = $db_test->Execute($sql);
  428.       if (ZC_UPG_DEBUG==true) echo "127a-configkey_check=" . $result->fields['configuration_description'] . '<br>';
  429.       if  ($result->fields['configuration_description'] == '自动显示是否有Zen Cart新版本。打开该选项有时会降低管理页面打开时间。(显示于登录后的主索引页面和服务器信息页面)') {
  430.         $got_v1_2_7a = true;
  431.       }
  432.       //check #2
  433.       $sql = "select configuration_description from " . DB_PREFIX . "configuration where configuration_key='SHOW_SHOPPING_CART_BOX_STATUS'";
  434.       $result = $db_test->Execute($sql);
  435.       if (ZC_UPG_DEBUG==true) echo "127b-configkey_check=" . $result->fields['configuration_description'] . '<br>';
  436.       if  ($result->fields['configuration_description'] == '是否显示购物车边框<br />0= 总是显示<br />1= 满的时候<br />2= 满的时候,但查看购物车时不显示') {
  437.         $got_v1_2_7b = true;
  438.       }
  439.       if (ZC_UPG_DEBUG==true) {
  440.         echo '1.2.7a='.$got_v1_2_7a.'<br>';
  441.         echo '1.2.7b='.$got_v1_2_7b.'<br>';
  442.       }
  443.       // evaluate all 1.2.7 checks
  444.       if ($got_v1_2_7a && $got_v1_2_7b) {
  445.         $got_v1_2_7 = true;
  446.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.2.7<br>';
  447.       }
  448.       return $got_v1_2_7;
  449.     }  // end 1.2.7 check
  450.  
  451.  
  452.     function check_version_130() {
  453.       global $db_test;
  454.       //1st check for v1.3.0
  455.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='DEFINE_BREADCRUMB_STATUS'";
  456.       $result = $db_test->Execute($sql);
  457.       if (ZC_UPG_DEBUG==true) echo "130a-configkey_check DEFINE_BREADCRUMB_STATUS =" . $result->fields['configuration_title'] . '<br>';
  458.       if  ($result->fields['configuration_title'] == '导航条') {
  459.         $got_v1_3_0a = true;
  460.       }
  461.       //2nd check for v1.3.0
  462.       $tables = $db_test->Execute("SHOW TABLES like '".DB_PREFIX."ezpages'");
  463.       if ($tables->RecordCount() > 0) {
  464.         $sql = "show index from " . DB_PREFIX . "ezpages";
  465.         $result = $db_test->Execute($sql);
  466.         while (!$result->EOF) {
  467.           if (ZC_UPG_DEBUG==true) echo "1.3.0b-Index check on ezpages=" . $result->fields['Key_name'] . '->' . $result->fields['Column_name'] . '<br>';
  468.           if  ($result->fields['Column_name'] == 'pages_id') {
  469.             $got_v1_3_0b = true;
  470.           }
  471.           $result->MoveNext();
  472.         }
  473.       }
  474.       //3rd check for v1.3.0
  475.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='EZPAGES_STATUS_HEADER'";
  476.       $result = $db_test->Execute($sql);
  477.       if (ZC_UPG_DEBUG==true) echo "130c-configkey_check=" . $result->fields['configuration_title'] . '<br>';
  478.       if  ($result->fields['configuration_title'] == '简易页面 - 页眉') {
  479.         $got_v1_3_0c = true;
  480.       }
  481.       //4th check for 1.3.0
  482.       $tables = $db_test->Execute("SHOW TABLES like '".DB_PREFIX."meta_tags_categories_description'");
  483.       if ($tables->RecordCount() > 0) {
  484.         $sql = "show index from " . DB_PREFIX . "meta_tags_categories_description";
  485.         $result = $db_test->Execute($sql);
  486.         while (!$result->EOF) {
  487.           if (ZC_UPG_DEBUG==true) echo "1.3.0d-Index check on meta_tags_categories_description=" . $result->fields['Key_name'] . '->' . $result->fields['Column_name'] . '<br>';
  488.           if  ($result->fields['Column_name'] == 'categories_id') {
  489.             $got_v1_3_0d = true;
  490.           }
  491.           $result->MoveNext();
  492.         }
  493.       }
  494.       //5th check for v1.3.0
  495.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='EMAIL_SEND_MUST_BE_STORE'";
  496.       $result = $db_test->Execute($sql);
  497.       if (ZC_UPG_DEBUG==true) echo "130e-configkey_check EMAIL_SEND_MUST_BE_STORE =" . $result->fields['configuration_title'] . '<br>';
  498.       if  ($result->fields['configuration_title'] == '电子邮件必须从现有域名发送') {
  499.         $got_v1_3_0e = true;
  500.       }
  501.       //6th check for v1.3.0
  502.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='IMAGE_USE_CSS_BUTTONS'";
  503.       $result = $db_test->Execute($sql);
  504.       if (ZC_UPG_DEBUG==true) echo "130f-configkey_check IMAGE_USE_CSS_BUTTONS =" . $result->fields['configuration_title'] . '<br>';
  505.       if  ($result->fields['configuration_title'] == 'CSS按钮') {
  506.         $got_v1_3_0f = true;
  507.       }
  508.  
  509.       if (ZC_UPG_DEBUG==true) {
  510.         echo '1.3.0a='.$got_v1_3_0a.'<br>';
  511.         echo '1.3.0b='.$got_v1_3_0b.'<br>';
  512.         echo '1.3.0c='.$got_v1_3_0c.'<br>';
  513.         echo '1.3.0d='.$got_v1_3_0d.'<br>';
  514.         echo '1.3.0e='.$got_v1_3_0e.'<br>';
  515.         echo '1.3.0f='.$got_v1_3_0f.'<br>';
  516.       }
  517.       // evaluate all 1.3.0 checks
  518.       if ($got_v1_3_0a && $got_v1_3_0b && $got_v1_3_0c && $got_v1_3_0d && $got_v1_3_0e && $got_v1_3_0f  ) {
  519.         $got_v1_3_0 = true;
  520.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.3.0<br>';
  521.       }
  522.       return $got_v1_3_0;
  523.     } //end of 1.3.0 check
  524.  
  525.  
  526.     function check_version_1301() {
  527.       global $db_test;
  528.       //1st check for v1.3.0.1
  529.       $sql = "select configuration_group_id from " . DB_PREFIX . "configuration where configuration_key='SHOW_ACCOUNT_LINKS_ON_SITE_MAP'";
  530.       $result = $db_test->Execute($sql);
  531.       if (ZC_UPG_DEBUG==true) echo "1301-configkey_check SHOW_ACCOUNT_LINKS_ON_SITE_MAP =" . $result->fields['configuration_group_id'] . '<br>';
  532.       if  ($result->fields['configuration_group_id'] == '19') {
  533.         $got_v1_3_0_1 = true;
  534.         if (ZC_UPG_DEBUG==true) {
  535.           echo '<br>已有 1.3.0.1<br>';
  536.         }
  537.       }
  538.       return $got_v1_3_0_1;
  539.     } //end of 1.3.0.1 check
  540.  
  541.  
  542.     function check_version_1302() {
  543.       global $db_test;
  544.       //1st check for v1.3.0.2
  545.       $sql = "select sort_order from " . DB_PREFIX . "configuration where configuration_key='SHOW_ACCOUNT_LINKS_ON_SITE_MAP'";
  546.       $result = $db_test->Execute($sql);
  547.       if (ZC_UPG_DEBUG==true) echo "1302-configkey_check SHOW_ACCOUNT_LINKS_ON_SITE_MAP =" . $result->fields['sort_order'] . '<br>';
  548.       if  ($result->fields['sort_order'] == 115) {
  549.         $got_v1_3_0_2 = true;
  550.         if (ZC_UPG_DEBUG==true) {
  551.           echo '<br>已有 1.3.0.2<br>';
  552.         }
  553.       }
  554.       return $got_v1_3_0_2;
  555.     } //end of 1.3.0.2 check
  556.  
  557.     function check_version_135() {
  558.       global $db_test;
  559.       $got_v1_3_5 = false;
  560.       $got_v1_3_5a = false;
  561.       $got_v1_3_5b = false;
  562.       //1st check for v1.3.5
  563.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='PRODUCT_LIST_PRICE_BUY_NOW'";
  564.       $result = $db_test->Execute($sql);
  565.       if (ZC_UPG_DEBUG==true) echo "135a-configkey_check PRODUCT_LIST_PRICE_BUY_NOW =" . $result->fields['configuration_title'] . '<br>';
  566.       if  ($result->fields['configuration_title'] == '显示添加到购物车按钮 (0=关; 1=开; 2=开,且可以输入数量)') {
  567.         $got_v1_3_5a = true;
  568.       }
  569.       //2nd check for v1.3.5
  570.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='PRODUCT_LIST_ALPHA_SORTER'";
  571.       $result = $db_test->Execute($sql);
  572.       if (ZC_UPG_DEBUG==true) echo "135b-configkey_check PRODUCT_LIST_ALPHA_SORTER =" . $result->fields['configuration_title'] . '<br>';
  573.       if  ($result->fields['configuration_title'] == '商品列表中显示字母过滤选择') {
  574.         $got_v1_3_5b = true;
  575.       }
  576.  
  577.       if (ZC_UPG_DEBUG==true) {
  578.         echo '1.3.5a='.$got_v1_3_5a.'<br>';
  579.         echo '1.3.5b='.$got_v1_3_5b.'<br>';
  580.       }
  581.       // evaluate all 1.3.5 checks
  582.       if ($got_v1_3_5a && $got_v1_3_5b ) {
  583.         $got_v1_3_5 = true;
  584.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.3.5<br>';
  585.       }
  586.       return $got_v1_3_5;
  587.     } //end of 1.3.5 check
  588.  
  589.     function check_version_136() {
  590.       global $db_test;
  591.       $got_v1_3_6 = false;
  592.       $got_v1_3_6a = false;
  593.       $got_v1_3_6b = false;
  594.       //1st check for v1.3.6
  595.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='META_TAG_INCLUDE_MODEL'";
  596.       $result = $db_test->Execute($sql);
  597.       if (ZC_UPG_DEBUG==true) echo "136a-configkey_check META_TAG_INCLUDE_MODEL =" . $result->fields['configuration_title'] . '<br>';
  598.       if  ($result->fields['configuration_title'] == '元标签 - 标题含商品型号') {
  599.         $got_v1_3_6a = true;
  600.       }
  601.       //2nd check for v1.3.6
  602.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='SHOW_SHOPPING_CART_EMPTY_UPCOMING'";
  603.       $result = $db_test->Execute($sql);
  604.       if (ZC_UPG_DEBUG==true) echo "136b-configkey_check SHOW_SHOPPING_CART_EMPTY_UPCOMING =" . $result->fields['configuration_title'] . '<br>';
  605.       if  ($result->fields['configuration_title'] == '在空购物车页面显示预售商品') {
  606.         $got_v1_3_6b = true;
  607.       }
  608.  
  609.       if (ZC_UPG_DEBUG==true) {
  610.         echo '1.3.6a='.$got_v1_3_6a.'<br>';
  611.         echo '1.3.6b='.$got_v1_3_6b.'<br>';
  612.       }
  613.       // evaluate all 1.3.6 checks
  614.       if ($got_v1_3_6a && $got_v1_3_6b ) {
  615.         $got_v1_3_6 = true;
  616.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.3.6<br>';
  617.       }
  618.       return $got_v1_3_6;
  619.     } //end of 1.3.6 check
  620.  
  621.  
  622.  
  623.     function check_version_137() {
  624.       global $db_test;
  625.       $got_v1_3_7 = false;
  626.       $got_v1_3_7a = false;
  627.       $got_v1_3_7b = false;
  628.       //1st check for v1.3.7
  629.       $sql = "select configuration_description from " . DB_PREFIX . "configuration where configuration_key='DEFINE_BREADCRUMB_STATUS'";
  630.       $result = $db_test->Execute($sql);
  631.       if (ZC_UPG_DEBUG==true) echo "137a-configdesc_check DEFINE_BREADCRUMB_STATUS =" . $result->fields['configuration_description'] . '<br>';
  632.       if  ($result->fields['configuration_description'] == '是否显示导航条<br />0= 关<br />1= 开<br />2= 仅不显示在首页') {
  633.         $got_v1_3_7a = true;
  634.       }
  635.       //2nd check for v1.3.7
  636.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='USE_SPLIT_LOGIN_MODE'";
  637.       $result = $db_test->Execute($sql);
  638.       if (ZC_UPG_DEBUG==true) echo "137b-configkey_check USE_SPLIT_LOGIN_MODE =" . $result->fields['configuration_title'] . '<br>';
  639.       if  ($result->fields['configuration_title'] == '分开登录页面') {
  640.         $got_v1_3_7b = true;
  641.       }
  642.  
  643.       if (ZC_UPG_DEBUG==true) {
  644.         echo '1.3.7a='.$got_v1_3_7a.'<br>';
  645.         echo '1.3.7b='.$got_v1_3_7b.'<br>';
  646.       }
  647.       // evaluate all 1.3.7 checks
  648.       if ($got_v1_3_7a && $got_v1_3_7b ) {
  649.         $got_v1_3_7 = true;
  650.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.3.7<br>';
  651.       }
  652.       return $got_v1_3_7;
  653.     } //end of 1.3.7 check
  654.  
  655.  
  656.  
  657.     function check_version_138() {
  658.       global $db_test;
  659.       $got_v1_3_8 = false;
  660.       $got_v1_3_8a = false;
  661.       $got_v1_3_8b = false;
  662.       //1st check for v1.3.8
  663.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key = 'SHOW_SHOPPING_CART_COMBINED'";
  664.       $result = $db_test->Execute($sql);
  665.       if (ZC_UPG_DEBUG==true) echo "138a-configtitle_check SHOW_SHOPPING_CART_COMBINED =" . $result->fields['configuration_title'] . '<br>';
  666.       if  ($result->fields['configuration_title'] == '登录时提醒合并购物车') {
  667.         $got_v1_3_8a = true;
  668.       }
  669.       //2nd check for v1.3.8
  670.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key = 'MAX_RANDOM_SELECT_FEATURED_PRODUCTS'";
  671.       $result = $db_test->Execute($sql);
  672.       if (ZC_UPG_DEBUG==true) echo "138b-configkey_check MAX_RANDOM_SELECT_FEATURED_PRODUCTS =" . $result->fields['configuration_title'] . '<br>';
  673.       if  ($result->fields['configuration_title'] == '边框中随机推荐商品数量') {
  674.         $got_v1_3_8b = true;
  675.       }
  676.  
  677.       if (ZC_UPG_DEBUG==true) {
  678.         echo '1.3.8a='.$got_v1_3_8a.'<br>';
  679.         echo '1.3.8b='.$got_v1_3_8b.'<br>';
  680.       }
  681.       // evaluate all 1.3.8 checks
  682.       if ($got_v1_3_8a && $got_v1_3_8b ) {
  683.         $got_v1_3_8 = true;
  684.         if (ZC_UPG_DEBUG==true) echo '<br>已有 1.3.8<br>';
  685.       }
  686.       return $got_v1_3_8;
  687.     } //end of 1.3.8 check
  688.  
  689.  
  690.  
  691.     function check_version_139() {
  692.       global $db_test;
  693.       $got_v1_3_9 = false;
  694.       $got_v1_3_9a = false;
  695.       $got_v1_3_9b = false;
  696.       //1st check for v1.3.9
  697.       $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key = 'SHOW_SPLIT_TAX_CHECKOUT'";
  698.       $result = $db_test->Execute($sql);
  699.       if (ZC_UPG_DEBUG==true) echo "139a-configtitle_check SHOW_SPLIT_TAX_CHECKOUT =" . $result->fields['configuration_title'] . '<br>';
  700.       if  ($result->fields['configuration_title'] == '分开显示税项') {
  701.         $got_v1_3_9a = true;
  702.       }
  703.       //2nd check for v1.3.9
  704.       $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "authorizenet'");
  705.       if ($tables->RecordCount() > 0) {
  706.         $sql = "show fields from " . DB_PREFIX . "authorizenet";
  707.         $result = $db_test->Execute($sql);
  708.         while (!$result->EOF) {
  709.           if (ZC_UPG_DEBUG==true) echo "139b-fields-'transaction_id'->bigint=" . $result->fields['Field'] . '->' . $result->fields['Type'] . '<br>';
  710.           if  ($result->fields['Field'] == 'transaction_id') {
  711.             if (strstr(strtoupper($result->fields['Type']),'BIGINT'))  {
  712.               $got_v1_3_9b = true;
  713.             }
  714.           }
  715.         $result->MoveNext();
  716.         }
  717.       }
  718.  
  719.       if (ZC_UPG_DEBUG==true) {
  720.         echo '1.3.9a='.$got_v1_3_9a.'<br>';
  721.         echo '1.3.9b='.$got_v1_3_9b.'<br>';
  722.       }
  723.       // evaluate all 1.3.9 checks
  724.       if ($got_v1_3_9a && $got_v1_3_9b ) {
  725.         $got_v1_3_9 = true;
  726.         if (ZC_UPG_DEBUG==true) echo '<br>Got 1.3.9<br><br>';
  727.       }
  728.       return $got_v1_3_9;
  729.     } //end of 1.3.9 check
  730.  
  731.  
  732.  
  733.  
  734.     function check_version_150() {
  735.       global $db_test;
  736.       $got_v1_5_0 = false;
  737.       $got_v1_5_0a = false;
  738.       $got_v1_5_0b = false;
  739.       //1st check for v1.5.0
  740.       $sql = "show fields from " . DB_PREFIX . "admin";
  741.       $result = $db_test->Execute($sql);
  742.       while (!$result->EOF) {
  743.         if (ZC_UPG_DEBUG==true) echo "150-fields-'reset_token'" . $result->fields['Field'] . '->' . $result->fields['Type'] . '<br>';
  744.         if  ($result->fields['Field'] == 'reset_token') {
  745.           $got_v1_5_0a = true;
  746.         }
  747.         $result->MoveNext();
  748.       }
  749.       //2nd check for v1.5.0
  750.       $sql = "show fields from " . DB_PREFIX . "admin";
  751.       $result = $db_test->Execute($sql);
  752.       while (!$result->EOF) {
  753.         if (ZC_UPG_DEBUG==true) echo "150-fields-'last_failed_ip'" . $result->fields['Field'] . '->' . $result->fields['Type'] . '<br>';
  754.         if  ($result->fields['Field'] == 'last_failed_ip') {
  755.           $got_v1_5_0b = true;
  756.         }
  757.         $result->MoveNext();
  758.       }
  759.       if (ZC_UPG_DEBUG==true) {
  760.         echo '1.5.0a='.$got_v1_5_0a.'<br>';
  761.         echo '1.5.0b='.$got_v1_5_0b.'<br>';
  762.       }
  763.       // evaluate all 1.5.0 checks
  764.       if ($got_v1_5_0a && $got_v1_5_0b ) {
  765.         $got_v1_5_0 = true;
  766.         if (ZC_UPG_DEBUG==true) echo 'Got 1.5.0<br><br>';
  767.       }
  768.       return $got_v1_5_0;
  769.     } //end of 1.5.0 check
  770.  
  771.  
  772.     function check_version_151() {
  773.       global $db_test;
  774.       $got_v1_5_1 = false;
  775.       $sql = "show fields from " . DB_PREFIX . "admin_activity_log";
  776.       $result = $db_test->Execute($sql);
  777.       while (!$result->EOF && !$got_v1_5_1) {
  778.         if (ZC_UPG_DEBUG==true) echo "151-fields-'ip_address TEST: '" . $result->fields['Field'] . '->' . $result->fields['Type'] . '<br>';
  779.         if  ($result->fields['Field'] == 'ip_address' && strtoupper($result->fields['Type']) == 'VARCHAR(45)') {
  780.           $got_v1_5_1 = true;
  781.           if (ZC_UPG_DEBUG==true) echo 'Got 1.5.1<br><br>';
  782.         }
  783.         $result->MoveNext();
  784.       }
  785.       return $got_v1_5_1;
  786.     } //end of 1.5.1 check
  787.  
  788.  
  789.  
  790.  
  791.   } // end class
  792.  
  793.  


cron