⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 general.php

📁 美国cre loaded 6.2 b2b网站系统升级补丁
💻 PHP
📖 第 1 页 / 共 5 页
字号:
    for ($i=0, $n=sizeof($select_array); $i<$n; $i++) {      $name = ((tep_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value');      $string .= '<br><input type="radio" name="' . $name . '" value="' . $select_array[$i] . '"';      if ($key_value == $select_array[$i]) $string .= ' CHECKED';      $string .= '> ' . $select_array[$i];    }    return $string;  }////// Alias function for module configuration keys  function tep_mod_select_option($select_array, $key_name, $key_value) {    reset($select_array);    while (list($key, $value) = each($select_array)) {      if (is_int($key)) $key = $value;      $string .= '<br><input type="radio" name="configuration[' . $key_name . ']" value="' . $key . '"';      if ($key_value == $key) $string .= ' CHECKED';      $string .= '> ' . $value;    }    return $string;  }////// Retreive server information  function tep_get_system_information() {    global $HTTP_SERVER_VARS;    $db_query = tep_db_query("select now() as datetime");    $db = tep_db_fetch_array($db_query);    list($system, $host, $kernel) = preg_split('/[\s,]+/', @exec('uname -a'), 5);    return array('date' => tep_datetime_short(date('Y-m-d H:i:s')),                 'system' => $system,                 'kernel' => $kernel,                 'host' => $host,                 'ip' => gethostbyname($host),                 'uptime' => @exec('uptime'),                 'http_server' => $HTTP_SERVER_VARS['SERVER_SOFTWARE'],                 'php' => PHP_VERSION,                 'zend' => (function_exists('zend_version') ? zend_version() : ''),                 'db_server' => DB_SERVER,                 'db_ip' => gethostbyname(DB_SERVER),                 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''),                 'db_date' => tep_datetime_short($db['datetime']));  }  function tep_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) {    global $languages_id;    if (!is_array($categories_array)) $categories_array = array();    if ($from == 'product') {      $categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$id . "'");      while ($categories = tep_db_fetch_array($categories_query)) {        if ($categories['categories_id'] == '0') {          $categories_array[$index][] = array('id' => '0', 'text' => TEXT_TOP);        } else {          $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");          $category = tep_db_fetch_array($category_query);          $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']);          if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index);          $categories_array[$index] = array_reverse($categories_array[$index]);        }        $index++;      }    } elseif ($from == 'category') {      $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");      $category = tep_db_fetch_array($category_query);      $categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']);      if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index);    }    return $categories_array;  }  function tep_output_generated_category_path($id, $from = 'category') {    $calculated_category_path_string = '';    $calculated_category_path = tep_generate_category_path($id, $from);    for ($i=0, $n=sizeof($calculated_category_path); $i<$n; $i++) {      for ($j=0, $k=sizeof($calculated_category_path[$i]); $j<$k; $j++) {        $calculated_category_path_string .= $calculated_category_path[$i][$j]['text'] . '&nbsp;&gt;&nbsp;';      }      $calculated_category_path_string = substr($calculated_category_path_string, 0, -16) . '<br>';    }    $calculated_category_path_string = substr($calculated_category_path_string, 0, -4);    if (strlen($calculated_category_path_string) < 1) $calculated_category_path_string = TEXT_TOP;    return $calculated_category_path_string;  }  function tep_get_generated_category_path_ids($id, $from = 'category') {    $calculated_category_path_string = '';    $calculated_category_path = tep_generate_category_path($id, $from);    for ($i=0, $n=sizeof($calculated_category_path); $i<$n; $i++) {      for ($j=0, $k=sizeof($calculated_category_path[$i]); $j<$k; $j++) {        $calculated_category_path_string .= $calculated_category_path[$i][$j]['id'] . '_';      }      $calculated_category_path_string = substr($calculated_category_path_string, 0, -1) . '<br>';    }    $calculated_category_path_string = substr($calculated_category_path_string, 0, -4);    if (strlen($calculated_category_path_string) < 1) $calculated_category_path_string = TEXT_TOP;    return $calculated_category_path_string;  }  function tep_remove_category($category_id) {    $category_image_query = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$category_id . "'");    $category_image = tep_db_fetch_array($category_image_query);    $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where categories_image = '" . tep_db_input($category_image['categories_image']) . "'");    $duplicate_image = tep_db_fetch_array($duplicate_image_query);    if ($duplicate_image['total'] < 2) {      if (file_exists(DIR_FS_CATALOG_IMAGES . $category_image['categories_image'])) {        @unlink(DIR_FS_CATALOG_IMAGES . $category_image['categories_image']);      }    }    tep_db_query("delete from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$category_id . "'");    tep_db_query("delete from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "'");    tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$category_id . "'");    if (USE_CACHE == 'true') {      tep_reset_cache_block('categories');      tep_reset_cache_block('also_purchased');    }  }  function tep_remove_product($product_id) {    $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");    $product_image = tep_db_fetch_array($product_image_query);    $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . tep_db_input($product_image['products_image']) . "'");    $duplicate_image = tep_db_fetch_array($duplicate_image_query);    if ($duplicate_image['total'] < 2) {      if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image'])) {        @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']);      }    }    tep_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "'");    tep_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");    // Eversun mod for sppc and qty price breaks        tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$product_id . "'");// Eversun mod end for sppc and qty price breaks        tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");    tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "'");    tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'");    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . (int)$product_id . "'");    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'");// START: Extra Fields Contribution  DMG    tep_db_query("delete from " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " where products_id = " . (int)$product_id);// END: Extra Fields Contribution    $product_reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where products_id = '" . (int)$product_id . "'");    while ($product_reviews = tep_db_fetch_array($product_reviews_query)) {      tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$product_reviews['reviews_id'] . "'");    }    tep_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . (int)$product_id . "'");    if (USE_CACHE == 'true') {      tep_reset_cache_block('categories');      tep_reset_cache_block('also_purchased');    }  }  function tep_remove_order($order_id, $restock) {    if ($restock == 'on') {      $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");      while ($order = tep_db_fetch_array($order_query)) {        tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'");      }    }    //begin PayPal_Shopping_Cart_IPN 2.8 DMG include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');    paypal_remove_order($order_id);//end PayPal_Shopping_Cart_IPN    tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");    tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");    tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'");    tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'");    tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'");  }  function tep_reset_cache_block($cache_block) {    global $cache_blocks;$dir_cache = DIR_FS_CATALOG . DIR_FS_CACHE ;   // get default template   if (tep_not_null($cptemplate1['template_selected'])) {  define(TEMPLATE_NAME, $cptemplate['template_selected']);    }else if  (tep_not_null(DEFAULT_TEMPLATE)){  define(TEMPLATE_NAME, DEFAULT_TEMPLATE);      } else {    define(TEMPLATE_NAME, 'default');    }     $template_query = tep_db_query("select template_name from " . TABLE_TEMPLATE . "  order by template_name");      while ($template = tep_db_fetch_array($template_query)) {        $template_array=array(template=>template_name);        }        for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {      if ($cache_blocks[$i]['code'] == $cache_block) {        if ($cache_blocks[$i]['multiple']) {          if ($dir = @opendir($dir_cache)) {            while ($cache_file = readdir($dir)) {              $cached_file = $cache_blocks[$i]['file'];              $languages = tep_get_languages();              for ($j=0, $k=sizeof($languages); $j<$k; $j++) {                $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file);                                              for ($j=0, $k=sizeof($template_array); $j<$k; $j++) {                    $cached_file_unlink = ereg_replace('-TEMPLATE_NAME', '-' . $template_array[$j]['template_name'] , $cached_file);                                              if (ereg('^' . $cached_file_unlink, $cache_file)) {                  @unlink($dir_cache . $cache_file);                  }                }              }            }             closedir($dir);          }        } else {          $cached_file = $cache_blocks[$i]['file'];          $languages = tep_get_languages();          for ($i=0, $n=sizeof($languages); $i<$n; $i++) {            $cached_file = ereg_replace('-language', '-' . $languages[$i]['directory'], $cached_file);            @unlink(DIR_FS_CACHE . $cached_file);          }        }        break;      }    }  }  function tep_get_file_permissions($mode) {// determine type    if ( ($mode & 0xC000) == 0xC000) { // unix domain socket      $type = 's';    } elseif ( ($mode & 0x4000) == 0x4000) { // directory      $type = 'd';    } elseif ( ($mode & 0xA000) == 0xA000) { // symbolic link      $type = 'l';    } elseif ( ($mode & 0x8000) == 0x8000) { // regular file      $type = '-';    } elseif ( ($mode & 0x6000) == 0x6000) { //bBlock special file      $type = 'b';    } elseif ( ($mode & 0x2000) == 0x2000) { // character special file      $type = 'c';    } elseif ( ($mode & 0x1000) == 0x1000) { // named pipe      $type = 'p';    } else { // unknown      $type = '?';    }// determine permissions    $owner['read']    = ($mode & 00400) ? 'r' : '-';    $owner['write']   = ($mode & 00200) ? 'w' : '-';    $owner['execute'] = ($mode & 00100) ? 'x' : '-';    $group['read']    = ($mode & 00040) ? 'r' : '-';    $group['write']   = ($mode & 00020) ? 'w' : '-';    $group['execute'] = ($mode & 00010) ? 'x' : '-';    $world['read']    = ($mode & 00004) ? 'r' : '-';    $world['write']   = ($mode & 00002) ? 'w' : '-';    $world['execute'] = ($mode & 00001) ? 'x' : '-';// adjust for SUID, SGID and sticky bit    if ($mode & 0x800 ) $owner['execute'] = ($owner['execute'] == 'x') ? 's' : 'S';    if ($mode & 0x400 ) $group['execute'] = ($group['execute'] == 'x') ? 's' : 'S';    if ($mode & 0x200 ) $world['execute'] = ($world['execute'] == 'x') ? 't' : 'T';    return $type .           $owner['read'] . $owner['write'] . $owner['execute'] .           $group['read'] . $group['write'] . $group['execute'] .           $world['read'] . $world['write'] . $world['execute'];  }  function tep_remove($source) {    global $messageStack, $tep_remove_error;    if (isset($tep_remove_error)) $tep_remove_error = false;    if (is_dir($source)) {      $dir = dir($source);      while ($file = $dir->read()) {        if ( ($file != '.') && ($file != '..') ) {          if (is_writeable($source . '/' . $file)) {            tep_remove($source . '/' . $file);          } else {            $messageStack->add('search', sprintf(ERROR_FILE_NOT_REMOVEABLE, $source . '/' . $file), 'error');            $tep_remove_error = true;          }        }      }      $dir->close();      if (is_writeable($source)) {        rmdir($source);      } else {        $messageStack->add('search', sprintf(ERROR_DIRECTORY_NOT_REMOVEABLE, $source), 'error');        $tep_remove_error = true;      }    } else {      if (is_writeable($source)) {        unlink($source);      } else {        $messageStack->add('search', sprintf(ERROR_FILE_NOT_REMOVEABLE, $source), 'error');        $tep_remove_error = true;      }    }  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -