[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> easypopulate_functions.php (source)

   1  <?php
   2  /*
   3    $Id: easypopulate_functions.php,v 2.76a 2006/10/16 22:50:52 surfalot Exp $
   4  
   5    Designed for osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  if (!function_exists(tep_get_uploaded_file)){
  13  function tep_get_uploaded_file($filename) {
  14      if (isset($_FILES[$filename])) {
  15          $uploaded_file = array('name' => $_FILES[$filename]['name'],
  16          'type' => $_FILES[$filename]['type'],
  17          'size' => $_FILES[$filename]['size'],
  18          'tmp_name' => $_FILES[$filename]['tmp_name']);
  19      } elseif (isset($GLOBALS['HTTP_POST_FILES'][$filename])) {
  20          global $HTTP_POST_FILES;
  21  
  22          $uploaded_file = array('name' => $HTTP_POST_FILES[$filename]['name'],
  23          'type' => $HTTP_POST_FILES[$filename]['type'],
  24          'size' => $HTTP_POST_FILES[$filename]['size'],
  25          'tmp_name' => $HTTP_POST_FILES[$filename]['tmp_name']);
  26      } else {
  27          $uploaded_file = array('name' => $GLOBALS[$filename . '_name'],
  28          'type' => $GLOBALS[$filename . '_type'],
  29          'size' => $GLOBALS[$filename . '_size'],
  30          'tmp_name' => $GLOBALS[$filename]);
  31      }
  32  
  33  return $uploaded_file;
  34  }
  35  }
  36  
  37  // the $filename parameter is an array with the following elements:
  38  // name, type, size, tmp_name
  39  function tep_copy_uploaded_file($filename, $target) {
  40      if (substr($target, -1) != '/') $target .= '/';
  41  
  42      $target .= $filename['name'];
  43  
  44      move_uploaded_file($filename['tmp_name'], $target);
  45  }
  46  
  47  ////
  48  // Recursively go through the categories and retreive all sub-categories IDs
  49  // TABLES: categories
  50  if (!function_exists(tep_get_sub_categories)) {
  51    function tep_get_sub_categories(&$categories, $categories_id) {
  52      $sub_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$categories_id . "'");
  53      while ($sub_categories = tep_db_fetch_array($sub_categories_query)) {
  54        if ($sub_categories['categories_id'] == 0) return true;
  55        $categories[sizeof($categories)] = $sub_categories['categories_id'];
  56        if ($sub_categories['categories_id'] != $categories_id) {
  57          tep_get_sub_categories($categories, $sub_categories['categories_id']);
  58        }
  59      }
  60    }
  61  }
  62  
  63  if (!function_exists(tep_get_tax_class_rate)){
  64  function tep_get_tax_class_rate($tax_class_id) {
  65      $tax_multiplier = 0;
  66      $tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " WHERE  tax_class_id = '" . $tax_class_id . "' GROUP BY tax_priority");
  67      if (tep_db_num_rows($tax_query)) {
  68          while ($tax = tep_db_fetch_array($tax_query)) {
  69              $tax_multiplier += $tax['tax_rate'];
  70          }
  71      }
  72      return $tax_multiplier;
  73  }
  74  }
  75  
  76  if (!function_exists(tep_get_tax_title_class_id)){
  77  function tep_get_tax_title_class_id($tax_class_title) {
  78      $classes_query = tep_db_query("select tax_class_id from " . TABLE_TAX_CLASS . " WHERE tax_class_title = '" . $tax_class_title . "'" );
  79      $tax_class_array = tep_db_fetch_array($classes_query);
  80      $tax_class_id = $tax_class_array['tax_class_id'];
  81      return $tax_class_id ;
  82  }
  83  }
  84  
  85  if (!function_exists(print_el)){
  86  function print_el( $item2 ) {
  87      echo " | " . substr(strip_tags($item2), 0, 10);
  88  }
  89  }
  90  
  91  if (!function_exists(print_el1)){
  92  function print_el1( $item2 ) {
  93      echo sprintf("| %'.4s ", substr(strip_tags($item2), 0, 80));
  94  }
  95  }
  96  
  97  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7