oxajax.php

Go to the documentation of this file.
00001 <?php
00002 
00003 if (!defined('OX_IS_ADMIN')) {
00004     define('OX_IS_ADMIN', true);
00005 }
00006 
00007 if (!defined('OX_ADMIN_DIR')) {
00008     define('OX_ADMIN_DIR', dirname(__FILE__));
00009 }
00010 
00011 require_once dirname(__FILE__) . "/../bootstrap.php";
00012 
00013 // processing ..
00014 $blAjaxCall = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
00015 if ($blAjaxCall) {
00016 
00017 
00018     // Setting error reporting mode
00019     error_reporting(E_ALL ^ E_NOTICE);
00020 
00021     $myConfig = oxRegistry::getConfig();
00022 
00023     // Includes Utility module.
00024     $sUtilModule = $myConfig->getConfigParam('sUtilModule');
00025     if ($sUtilModule && file_exists(getShopBasePath() . "modules/" . $sUtilModule)) {
00026         include_once getShopBasePath() . "modules/" . $sUtilModule;
00027     }
00028 
00029     $myConfig->setConfigParam('blAdmin', true);
00030 
00031     // authorization
00032     if (!(oxRegistry::getSession()->checkSessionChallenge() && count(oxRegistry::get("oxUtilsServer")->getOxCookie()) && oxRegistry::getUtils()->checkAccessRights())) {
00033         header("location:index.php");
00034         oxRegistry::getUtils()->showMessageAndExit("");
00035     }
00036 
00037     if ($sContainer = oxRegistry::getConfig()->getRequestParameter('container')) {
00038 
00039         $sContainer = trim(strtolower(basename($sContainer)));
00040 
00041         try {
00042             $oAjaxComponent = oxNew($sContainer . '_ajax');
00043         } catch (oxSystemComponentException $oCe) {
00044             $sFile = 'inc/' . $sContainer . '.inc.php';
00045             if (file_exists($sFile)) {
00046                 $aColumns = array();
00047                 include_once $sFile;
00048                 $oAjaxComponent = new ajaxcomponent($aColumns);
00049                 $oAjaxComponent->init($aColumns);
00050             } else {
00051                 $oEx = oxNew('oxFileException');
00052                 $oEx->setMessage('EXCEPTION_FILENOTFOUND');
00053                 $oEx->setFileName($sFile);
00054                 $oEx->debugOut();
00055                 throw $oEx;
00056             }
00057         }
00058 
00059         $oAjaxComponent->setName($sContainer);
00060         $oAjaxComponent->processRequest(oxRegistry::getConfig()->getRequestParameter('fnc'));
00061 
00062     } else {
00063 
00064     }
00065 
00066     $myConfig->pageClose();
00067 
00068     // closing session handlers
00069     // session_write_close();
00070     return;
00071 }