<?php
/**
  @licence GPL 2005-2011  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  24/04/11, 16:39
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
  @brief page call for action ajax

  Appel des element modulaires, page de centralisation des appels

  Forme:
    GET = action_type=products&action_class=special&action_method=edit_products
*/
  /* */
  $ID=false;
  if(isset($_GET['pID']))$ID=(int)tep_sanitize_string($_GET['pID']);


  $actions['action'] = $action;
  $actions['display_file']='';
  /* Le type products/categories/account/home */
  $actions['action_type']=(isset($_GET['action_type']))? tep_sanitize_string($_GET['action_type']) : '';
  /* Le module */
  $actions['action_class']=(isset($_GET['action_class']))? tep_sanitize_string($_GET['action_class']) : '';
  /* LA methode */
  $actions['action_method']=(isset($_GET['action_method']))? tep_sanitize_string($_GET['action_method']) : '';


  $post_exe=false;

  /**
      @remarks
      generic init in appli top
  */
  if($actions['action_type']=='generic')  $aca_modules=$generic_modules;

  /**
      @remarks Init class type pages for call methode no static

  */
  elseif(!class_exists($actions['action_type']) && $actions['action_type']=='pages' && file_exists(DIR_WS_MODULES.'pages/'.$actions['action_class'].'.php')){
    include (DIR_WS_MODULES.'pages/'.$actions['action_class'].'.php');
    $class=$actions['action_class'];
    $modules = new $class;
    $modules->$actions['action_method']();
  }

  /**
      @remarks Init class type (products/categories/content)
      class in modules page :  modules/pages/xxx.php
      class name : xxxACA
  */
  elseif(!class_exists($actions['action_type']) && file_exists(DIR_WS_MODULES.'pages/'.$actions['action_type'].'.php')){
    include (DIR_WS_MODULES.'pages/'.$actions['action_type'].'.php');
    $class=$actions['action_type'].'ACA';
    $aca_modules = new $class;
    $post_exe=true;
  }

  /**
      @remarks Init class type,
      /classes/aca.xxx.php
      name: xxx
  */
  else{
    include (DIR_WS_CLASSES.'aca.'.$actions['action_type'].'.php');
    $aca_modules = new $actions['action_type'];
    $post_exe=false;
  }
  /**
    A module has asked to privately take care of this action, check if class and method exist and run it.
  */
  if ($post_exe && (isset($aca_modules->modules[$actions['action_class']])) && ($box=$aca_modules->modules[$actions['action_class']]->check_action($actions)) !=false)
    if (!empty($actions['action_method']) && method_exists($aca_modules->modules[$actions['action_class']],$actions['action_method'] )){
      $box = new box;
      $box=$aca_modules->modules[$actions['action_class']]->$actions['action_method']($box,(int)$ID);
    }
  else $box='';

?>