[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/admin/includes/functions/ -> compatibility.php (source)

   1  <?php
   2  //

   3  // +----------------------------------------------------------------------+

   4  // |zen-cart Open Source E-commerce                                       |

   5  // +----------------------------------------------------------------------+

   6  // | Copyright (c) 2003 The zen-cart developers                           |

   7  // |                                                                      |

   8  // | http://www.zen-cart.com/index.php                                    |

   9  // |                                                                      |

  10  // | Portions Copyright (c) 2003 osCommerce                               |

  11  // +----------------------------------------------------------------------+

  12  // | This source file is subject to version 2.0 of the GPL license,       |

  13  // | that is bundled with this package in the file LICENSE, and is        |

  14  // | available through the world-wide-web at the following url:           |

  15  // | http://www.zen-cart.com/license/2_0.txt.                             |

  16  // | If you did not receive a copy of the zen-cart license and are unable |

  17  // | to obtain it through the world-wide-web, please send a note to       |

  18  // | license@zen-cart.com so we can mail you a copy immediately.          |

  19  // +----------------------------------------------------------------------+

  20  //  $Id: compatibility.php 1969 2005-09-13 06:57:21Z drbyte $

  21  //

  22  
  23  ////

  24  // Recursively handle magic_quotes_gpc turned off.

  25  // This is due to the possibility of have an array in

  26  // $HTTP_xxx_VARS

  27  // Ie, products attributes

  28    function do_magic_quotes_gpc(&$ar) {
  29      if (!is_array($ar)) return false;
  30  
  31      while (list($key, $value) = each($ar)) {
  32        if (is_array($value)) {
  33          do_magic_quotes_gpc($value);
  34        } else {
  35          $ar[$key] = addslashes($value);
  36        }
  37      }
  38    }
  39  
  40  // $HTTP_xxx_VARS are always set on php4

  41    if (!is_array($_GET)) $_GET = array();
  42    if (!is_array($_POST)) $_POST = array();
  43    if (!is_array($_COOKIE)) $_COOKIE = array();
  44  
  45  // handle magic_quotes_gpc turned off.

  46    if (!get_magic_quotes_gpc()) {
  47      do_magic_quotes_gpc($_GET);
  48      do_magic_quotes_gpc($_POST);
  49      do_magic_quotes_gpc($_COOKIE);
  50    }
  51  
  52    if (!function_exists('is_numeric')) {
  53      function is_numeric($param) {
  54        return ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $param);
  55      }
  56    }
  57  
  58    if (!function_exists('is_uploaded_file')) {
  59      function is_uploaded_file($filename) {
  60        if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
  61          $tmp_file = dirname(tempnam('', ''));
  62        }
  63  
  64        if (strchr($tmp_file, '/')) {
  65          if (substr($tmp_file, -1) != '/') $tmp_file .= '/';
  66        } elseif (strchr($tmp_file, '\\')) {
  67          if (substr($tmp_file, -1) != '\\') $tmp_file .= '\\';
  68        }
  69  
  70        return file_exists($tmp_file . basename($filename));
  71      }
  72    }
  73  
  74    if (!function_exists('move_uploaded_file')) {
  75      function move_uploaded_file($file, $target) {
  76        return copy($file, $target);
  77      }
  78    }
  79  
  80    if (!function_exists('checkdnsrr')) {
  81      function checkdnsrr($host, $type) {
  82        if(zen_not_null($host) && zen_not_null($type)) {
  83          @exec("nslookup -type=$type $host", $output);
  84          while(list($k, $line) = each($output)) {
  85            if(eregi("^$host", $line)) {
  86              return true;
  87            }
  88          }
  89        }
  90        return false;
  91      }
  92    }
  93  
  94    if (!function_exists('in_array')) {
  95      function in_array($lookup_value, $lookup_array) {
  96        reset($lookup_array);
  97        while (list($key, $value) = each($lookup_array)) {
  98          if ($value == $lookup_value) return true;
  99        }
 100  
 101        return false;
 102      }
 103    }
 104  
 105    if (!function_exists('array_merge')) {
 106      function array_merge($array1, $array2, $array3 = '') {
 107        if ($array3 == '') $array3 = array();
 108  
 109        while (list($key, $val) = each($array1)) $array_merged[$key] = $val;
 110        while (list($key, $val) = each($array2)) $array_merged[$key] = $val;
 111  
 112        if (sizeof($array3) > 0) while (list($key, $val) = each($array3)) $array_merged[$key] = $val;
 113  
 114        return (array)$array_merged;
 115      }
 116    }
 117  
 118    if (!function_exists('array_shift')) {
 119      function array_shift(&$array) {
 120        $i = 0;
 121        $shifted_array = array();
 122        reset($array);
 123        while (list($key, $value) = each($array)) {
 124          if ($i > 0) {
 125            $shifted_array[$key] = $value;
 126          } else {
 127            $return = $array[$key];
 128          }
 129          $i++;
 130        }
 131        $array = $shifted_array;
 132  
 133        return $return;
 134      }
 135    }
 136  
 137    if (!function_exists('array_reverse')) {
 138      function array_reverse($array) {
 139        $reversed_array = array();
 140  
 141        for ($i=sizeof($array)-1; $i>=0; $i--) {
 142          $reversed_array[] = $array[$i];
 143        }
 144  
 145        return $reversed_array;
 146      }
 147    }
 148  
 149    if (!function_exists('array_slice')) {
 150      function array_slice($array, $offset, $length = '0') {
 151        $length = abs($length);
 152  
 153        if ($length == 0) {
 154          $high = sizeof($array);
 155        } else {
 156          $high = $offset+$length;
 157        }
 158  
 159        for ($i=$offset; $i<$high; $i++) {
 160          $new_array[$i-$offset] = $array[$i];
 161        }
 162  
 163        return $new_array;
 164      }
 165    }
 166  
 167  /////////////////////////////////////////

 168  // remove in v1.3

 169  //

 170  // disabled

 171  /*

 172    if (!function_exists('fmod')) {

 173      function fmod($zf_x, $zf_y) {

 174        $zp_i = floor($zf_x/$zf_y);

 175        return $zf_x - $zp_i/$zf_y;

 176      }

 177    }

 178  */
 179  // mange for values < 1

 180    if (!function_exists('fmod')) {
 181      function fmod($x2, $y2) {
 182        $i2 = fmod($x2*1000,$y2*1000);
 183        return $i2;
 184      }
 185    }
 186  /////////////////////////////////////////

 187  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics