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

📄 general.php

📁 每个RFC 3261信息头有一个相应的存取标识. 但是,许多信息头拥有同样的形式。 例如。To和From的信息头都是由显示名和一个URI组成。 To和From信息头用来管理与处理NameAddr实例的
💻 PHP
📖 第 1 页 / 共 4 页
字号:
    $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(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source . '/' . $file), 'error');            $tep_remove_error = true;          }        }      }      $dir->close();      if (is_writeable($source)) {        rmdir($source);      } else {        $messageStack->add(sprintf(ERROR_DIRECTORY_NOT_REMOVEABLE, $source), 'error');        $tep_remove_error = true;      }    } else {      if (is_writeable($source)) {        unlink($source);      } else {        $messageStack->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source), 'error');        $tep_remove_error = true;      }    }  }////// Output the tax percentage with optional padded decimals  function tep_display_tax_value($value, $padding = TAX_DECIMAL_PLACES) {    if (strpos($value, '.')) {      $loop = true;      while ($loop) {        if (substr($value, -1) == '0') {          $value = substr($value, 0, -1);        } else {          $loop = false;          if (substr($value, -1) == '.') {            $value = substr($value, 0, -1);          }        }      }    }    if ($padding > 0) {      if ($decimal_pos = strpos($value, '.')) {        $decimals = strlen(substr($value, ($decimal_pos+1)));        for ($i=$decimals; $i<$padding; $i++) {          $value .= '0';        }      } else {        $value .= '.';        for ($i=0; $i<$padding; $i++) {          $value .= '0';        }      }    }    return $value;  }  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {    if (SEND_EMAILS != 'true') return false;    // Instantiate a new mail object    $message = new email(array('X-Mailer: osCommerce'));    // Build the text version    $text = strip_tags($email_text);    if (EMAIL_USE_HTML == 'true') {      $message->add_html($email_text, $text);    } else {      $message->add_text($text);    }    // Send message    $message->build_message();    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);  }  function tep_get_tax_class_title($tax_class_id) {    if ($tax_class_id == '0') {      return TEXT_NONE;    } else {      $classes_query = tep_db_query("select tax_class_title from " . TABLE_TAX_CLASS . " where tax_class_id = '" . (int)$tax_class_id . "'");      $classes = tep_db_fetch_array($classes_query);      return $classes['tax_class_title'];    }  }  function tep_banner_image_extension() {    if (function_exists('imagetypes')) {      if (imagetypes() & IMG_PNG) {        return 'png';      } elseif (imagetypes() & IMG_JPG) {        return 'jpg';      } elseif (imagetypes() & IMG_GIF) {        return 'gif';      }    } elseif (function_exists('imagecreatefrompng') && function_exists('imagepng')) {      return 'png';    } elseif (function_exists('imagecreatefromjpeg') && function_exists('imagejpeg')) {      return 'jpg';    } elseif (function_exists('imagecreatefromgif') && function_exists('imagegif')) {      return 'gif';    }    return false;  }////// Wrapper function for round() for php3 compatibility  function tep_round($value, $precision) {    if (PHP_VERSION < 4) {      $exp = pow(10, $precision);      return round($value * $exp) / $exp;    } else {      return round($value, $precision);    }  }////// Add tax to a products price  function tep_add_tax($price, $tax) {    global $currencies;    if (DISPLAY_PRICE_WITH_TAX == 'true') {      return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_calculate_tax($price, $tax);    } else {      return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);    }  }// Calculates Tax rounding the result  function tep_calculate_tax($price, $tax) {    global $currencies;    return tep_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);  }////// Returns the tax rate for a zone / class// TABLES: tax_rates, zones_to_geo_zones  function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {    global $customer_zone_id, $customer_country_id;    if ( ($country_id == -1) && ($zone_id == -1) ) {      if (!tep_session_is_registered('customer_id')) {        $country_id = STORE_COUNTRY;        $zone_id = STORE_ZONE;      } else {        $country_id = $customer_country_id;        $zone_id = $customer_zone_id;      }    }    $tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za ON tr.tax_zone_id = za.geo_zone_id left join " . TABLE_GEO_ZONES . " tz ON tz.geo_zone_id = tr.tax_zone_id WHERE (za.zone_country_id IS NULL OR za.zone_country_id = '0' OR za.zone_country_id = '" . (int)$country_id . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . (int)$zone_id . "') AND tr.tax_class_id = '" . (int)$class_id . "' GROUP BY tr.tax_priority");    if (tep_db_num_rows($tax_query)) {      $tax_multiplier = 0;      while ($tax = tep_db_fetch_array($tax_query)) {        $tax_multiplier += $tax['tax_rate'];      }      return $tax_multiplier;    } else {      return 0;    }  }////// Returns the tax rate for a tax class// TABLES: tax_rates  function tep_get_tax_rate_value($class_id) {    $tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " where tax_class_id = '" . (int)$class_id . "' group by tax_priority");    if (tep_db_num_rows($tax_query)) {      $tax_multiplier = 0;      while ($tax = tep_db_fetch_array($tax_query)) {        $tax_multiplier += $tax['tax_rate'];      }      return $tax_multiplier;    } else {      return 0;    }  }  function tep_call_function($function, $parameter, $object = '') {    if ($object == '') {      return call_user_func($function, $parameter);    } elseif (PHP_VERSION < 4) {      return call_user_method($function, $object, $parameter);    } else {      return call_user_func(array($object, $function), $parameter);    }  }  function tep_get_zone_class_title($zone_class_id) {    if ($zone_class_id == '0') {      return TEXT_NONE;    } else {      $classes_query = tep_db_query("select geo_zone_name from " . TABLE_GEO_ZONES . " where geo_zone_id = '" . (int)$zone_class_id . "'");      $classes = tep_db_fetch_array($classes_query);      return $classes['geo_zone_name'];    }  }  function tep_cfg_pull_down_zone_classes($zone_class_id, $key = '') {    $name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');    $zone_class_array = array(array('id' => '0', 'text' => TEXT_NONE));    $zone_class_query = tep_db_query("select geo_zone_id, geo_zone_name from " . TABLE_GEO_ZONES . " order by geo_zone_name");    while ($zone_class = tep_db_fetch_array($zone_class_query)) {      $zone_class_array[] = array('id' => $zone_class['geo_zone_id'],                                  'text' => $zone_class['geo_zone_name']);    }    return tep_draw_pull_down_menu($name, $zone_class_array, $zone_class_id);  }  function tep_cfg_pull_down_order_statuses($order_status_id, $key = '') {    global $languages_id;    $name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');    $statuses_array = array(array('id' => '0', 'text' => TEXT_DEFAULT));    $statuses_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "' order by orders_status_name");    while ($statuses = tep_db_fetch_array($statuses_query)) {      $statuses_array[] = array('id' => $statuses['orders_status_id'],                                'text' => $statuses['orders_status_name']);    }    return tep_draw_pull_down_menu($name, $statuses_array, $order_status_id);  }  function tep_get_order_status_name($order_status_id, $language_id = '') {    global $languages_id;    if ($order_status_id < 1) return TEXT_DEFAULT;    if (!is_numeric($language_id)) $language_id = $languages_id;    $status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . (int)$order_status_id . "' and language_id = '" . (int)$language_id . "'");    $status = tep_db_fetch_array($status_query);    return $status['orders_status_name'];  }////// Return a random value  function tep_rand($min = null, $max = null) {    static $seeded;    if (!$seeded) {      mt_srand((double)microtime()*1000000);      $seeded = true;    }    if (isset($min) && isset($max)) {      if ($min >= $max) {        return $min;      } else {        return mt_rand($min, $max);      }    } else {      return mt_rand();    }  }// nl2br() prior PHP 4.2.0 did not convert linefeeds on all OSs (it only converted \n)  function tep_convert_linefeeds($from, $to, $string) {    if ((PHP_VERSION < "4.0.5") && is_array($from)) {      return ereg_replace('(' . implode('|', $from) . ')', $to, $string);    } else {      return str_replace($from, $to, $string);    }  }  function tep_string_to_int($string) {    return (int)$string;  }////// Parse and secure the cPath parameter values  function tep_parse_category_path($cPath) {// make sure the category IDs are integers    $cPath_array = array_map('tep_string_to_int', explode('_', $cPath));// make sure no duplicate category IDs exist which could lock the server in a loop    $tmp_array = array();    $n = sizeof($cPath_array);    for ($i=0; $i<$n; $i++) {      if (!in_array($cPath_array[$i], $tmp_array)) {        $tmp_array[] = $cPath_array[$i];      }    }    return $tmp_array;  }?>

⌨️ 快捷键说明

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