PgmReloaded PHP Cross Reference Customer Relationship Management

Source: /pgm/common.inc.php - 73 lines - 2759 bytes - Summary - Text - Print

   1  <?php
   2  // (C) 2005 Matteo Lucarelli <matteo@matteolucarelli.net>
   3  // (C) 2000-2002 Marco Pratesi <marco@pgmarket.net>
   4  // (C) 2000 Ying Zhang (ying@zippydesign.com)
   5  
   6  // common includes used by all the PHP files
   7  require_once  ("config.inc.php");
   8  
   9  include ($CFG["libdir"] . "stdlib.inc.php");
  10  include ($CFG["libdir"] . "phplib/db_" . $CFG["dbms"] . ".inc.php");    // PHPLib...
  11  include ($CFG["libdir"] . "pgm_" . $CFG["dbms"] . ".inc.php");        // PGM extension...
  12  include ($CFG["libdir"] . $CFG["dbms"] . "_common.inc.php");
  13  include ($CFG["libdir"] . "pgm_common.inc.php");
  14  include ($CFG["libdir"] . "pgm_session.inc.php");
  15  include ($CFG["libdir"] . "pgm_users.inc.php");
  16  include ($CFG["libdir"] . "pgm_cart.inc.php");
  17  include ($CFG["libdir"] . "phplib/template.inc.php");
  18  include ($CFG["localedir"] . $CFG["base_lang"] . "/base_lang.inc.php");
  19  
  20  $PGM_SESSION = array();
  21  pgm_session_open($PGM_SESSION, $session_name);
  22  
  23  if (!isset($PGM_SESSION["CART"])) $PGM_SESSION["CART"] = new PGM_Cart();
  24  
  25  if ($CFG["only_one_delivery_zone"]) $PGM_SESSION["zone_id"] = 1;
  26  
  27  if (!isset($PGM_SESSION["lang"])) {
  28      if ($CFG["use_http_accept_language"] && isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
  29          $foolang = explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
  30          if (count($foolang) > 0) {
  31              reset($foolang);
  32              while (list($key, $val) = each($foolang)) {
  33                  $foovect = explode(";", $val);
  34                  $accept_language = str_replace(" ", "", $foovect[0]);
  35                  $accept_language = substr($accept_language, 0, 2);
  36                  if (in_array($accept_language, $CFG["available_languages"])) {
  37                      $PGM_SESSION["lang"] = $accept_language;
  38                      break;
  39                  }
  40              }
  41          }
  42      }
  43      if (!isset($PGM_SESSION["lang"])) {
  44          $PGM_SESSION["lang"] = $CFG["base_lang"];
  45      }
  46  }
  47  if (!isset($PGM_SESSION["i18n"])) {
  48      $PGM_SESSION["i18n"] = $CFG["default_i18n"];
  49  }
  50  $CFG["localelangdir"] = $CFG["localedir"] . $PGM_SESSION["lang"] . "/";
  51  $CFG["globalerror"] = $CFG["localelangdir"] . "global-error.inc.php";
  52  
  53  $ME = qualified_me();
  54  if (!nvl($norefererflag, 0)) {
  55      $PGM_SESSION["REFERER"] = nvl($PGM_SESSION["NEW_REFERER"], "");
  56      $PGM_SESSION["REFERER_AND_QUERY"] = nvl($PGM_SESSION["NEW_REFERER_AND_QUERY"], "");
  57      $PGM_SESSION["NEW_REFERER"] = $ME;
  58      $PGM_SESSION["NEW_REFERER_AND_QUERY"] = $ME;
  59      if (!isset($_SERVER["QUERY_STRING"])) $_SERVER["QUERY_STRING"] = "";    // workaround for a MS IIS bug
  60      if ($_SERVER["QUERY_STRING"] != "") {
  61          $PGM_SESSION["NEW_REFERER_AND_QUERY"] .= "?" . $_SERVER["QUERY_STRING"];
  62      }
  63      if ($PGM_SESSION["REFERER"] == "") {
  64          $PGM_SESSION["REFERER"] = $PGM_SESSION["NEW_REFERER"];
  65      }
  66      if ($PGM_SESSION["REFERER_AND_QUERY"] == "") {
  67          $foobar = str_replace("&amp;", "&", $PGM_SESSION["NEW_REFERER_AND_QUERY"]);
  68          $foobar = str_replace("&", "&amp;", $foobar);
  69          $PGM_SESSION["REFERER_AND_QUERY"] = $foobar;
  70      }
  71  }
  72  
  73  ?>

title

Description

title

Description

title

Description

title

title

Body