OXID eShop CE  4.10.7
 All Classes Namespaces Files Functions Variables Pages
oxajax.php
Go to the documentation of this file.
1 <?php
2 
3 if (!defined('OX_IS_ADMIN')) {
4  define('OX_IS_ADMIN', true);
5 }
6 
7 if (!defined('OX_ADMIN_DIR')) {
8  define('OX_ADMIN_DIR', dirname(__FILE__));
9 }
10 
11 require_once dirname(__FILE__) . "/../bootstrap.php";
12 
13 // processing ..
14 $blAjaxCall = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
15 if ($blAjaxCall) {
16 
17 
18  // Setting error reporting mode
19  error_reporting(E_ALL ^ E_NOTICE);
20 
22 
23  // Includes Utility module.
24  $sUtilModule = $myConfig->getConfigParam('sUtilModule');
25  if ($sUtilModule && file_exists(getShopBasePath() . "modules/" . $sUtilModule)) {
26  include_once getShopBasePath() . "modules/" . $sUtilModule;
27  }
28 
29  $myConfig->setConfigParam('blAdmin', true);
30 
31  // authorization
32  if (!(oxRegistry::getSession()->checkSessionChallenge() && count(oxRegistry::get("oxUtilsServer")->getOxCookie()) && oxRegistry::getUtils()->checkAccessRights())) {
33  header("location:index.php");
34  oxRegistry::getUtils()->showMessageAndExit("");
35  }
36 
37  if ($sContainer = oxRegistry::getConfig()->getRequestParameter('container')) {
38 
39  $sContainer = trim(strtolower(basename($sContainer)));
40 
41  try {
42  $oAjaxComponent = oxNew($sContainer . '_ajax');
43  } catch (oxSystemComponentException $oCe) {
44  $sFile = 'inc/' . $sContainer . '.inc.php';
45  if (file_exists($sFile)) {
46  $aColumns = array();
47  include_once $sFile;
48  $oAjaxComponent = new ajaxcomponent($aColumns);
49  $oAjaxComponent->init($aColumns);
50  } else {
51  $oEx = oxNew('oxFileException');
52  $oEx->setMessage('EXCEPTION_FILENOTFOUND');
53  $oEx->setFileName($sFile);
54  $oEx->debugOut();
55  throw $oEx;
56  }
57  }
58 
59  $oAjaxComponent->setName($sContainer);
60  $oAjaxComponent->processRequest(oxRegistry::getConfig()->getRequestParameter('fnc'));
61 
62  } else {
63 
64  }
65 
66  $myConfig->pageClose();
67 
68  // closing session handlers
69  // session_write_close();
70  return;
71 }