<?php
/**
* @package OrdaSoft CCK
* @copyright OrdaSoft.
* @author Andrey Kvasnevskiy(akbet@mail.ru),Roman Akoev (akoevroman@gmail.com)
* @link http://ordasoft.com/cck-content-construction-kit-for-joomla.html
* @description OrdaSoft Joomla CCK - Content Construction Kit
*/

defined('_JEXEC') or die('Restricted access');

////////////////////////GLOBAL VARIABLES DECLARATION///////////////////////
//JPATH_SITE = $GLOBALS['mosConfig_absolute_path'] = JPATH_SITE;
//$mosConfig_live_site = $GLOBALS['mosConfig_live_site'] = JURI::root();

// var_dump('256M' < ini_get('memory_limit'));
//include ordasoft library api  classes
$path = JPATH_ROOT. '/libraries/os_lib/src/os_libMain.php';
if (!file_exists($path)){
  echo "To display the Joomla CCK Component, you need install OrdaSoft Library first <br />"; exit;
} else{
    if (version_compare(JVERSION, "4.0.0", "lt")) {
      auto_include(JPATH_ROOT. '/libraries/os_lib/src');
    }
}
use OrdaSoft\os_lib\os_libMain;
use OrdaSoft\os_lib\os_libPagination;

if( !class_exists("os_libMain") ){
    try{
        $ss = new os_libMain();
    }catch( Exception $e ){
        die("Please reinstall OrdaSoft Joomla CCK Package!");
    }
}
//turn on language files from library
$language = JFactory::getApplication()->getLanguage();
$language->load('os_lib',JPATH_ROOT );

//var_dump($ss);
global $option,
        $Itemid,
        $doc,
        $user,
        $db,
        $os_cck_configuration,
        $limit,
        $limitstart,
        $app,
        $session,
        $jConf;


$app = JFactory::getApplication();
$input = $app->input;
$user = JFactory::getUser();
$doc = JFactory::getDocument();
$db = JFactory::getDBO();
$session = JFactory::getSession();
$os_cck_configuration = JComponentHelper::getParams('com_os_cck');
$Itemid = $input->get('Itemid', 0, 'INT');
$option = $input->get('option', '', 'STRING');



$GLOBALS['input'] = $input;

//check is set task in simplemembershipt
if(isset($_GLOBALS) && isset($_GLOBALS['task']) ){
     $task = $_GLOBALS['task'] ;
}
if (!isset($task))
    $_GLOBALS['task'] = $task = $input->get('task', '', 'STRING');
else {
    $_GLOBALS['task'] = $task;
}

//check is set lid in simplemembershipt
if(isset($_GLOBALS) && isset($_GLOBALS['lid']) ){
     $lid = $_GLOBALS['lid'] ;
}
if (!isset($lid))
    $_GLOBALS['lid'] = $lid = $input->get('lid', 0, 'INT');
else {
    $_GLOBALS['lid'] = $lid;
}

//$lid = $input->get('lid', 0,'INT');
//$task = $input->get('task', '', 'STRING');
$view = $input->get('view', '', 'STRING');
$type = $input->get('type', '', 'STRING');
$catid = $input->get('catid', 0, 'INT');
$eiids = $input->get('eiid', array(0), 'ARRAY');
$jConf = JFactory::getConfig();

//var_dump($view);
// paginations
$limit = $input->get('limit', $os_cck_configuration->get('items_on_page'), 'INT');;
$limitstart = $input->get('limitstart', 0, 'INT');

if($task == "" && $view != "" ) $task = $view ;

///////////END GLOBAL VARIABLES DECLARATIONS///////////////////////

require_once(JPATH_SITE."/components/com_os_cck/functions.php");
require_once(JPATH_SITE."/components/com_os_cck/captcha.php");
require_once(JPATH_SITE."/components/com_os_cck/os_cck.html.php");
require_once(JPATH_SITE."/components/com_os_cck/controller.php");
jimport('joomla.html.pagination');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
jimport('joomla.application.component.helper');

//if(!function_exists("auto_include")){
//  function auto_include($path_to_files)
//    {
//        //for absolut path
//        $component_path = JPath::clean( $path_to_files);
//        if (is_dir($component_path) && ($files_in_folder = JFolder::files($component_path, '^[^-]*\.php$', false, true))) {
//            foreach ($files_in_folder as $i => $file) {
//                require_once($file);
//            }
//        }else{
//            //for relative path
//            $component_path = JPath::clean(JPATH_SITE . $path_to_files);
//            if (is_dir($component_path) && ($files_in_folder = JFolder::files($component_path, '^[^-]*\.php$', false, true))) {
//                foreach ($files_in_folder as $i => $file) {
//                    require_once($file);
//                }
//            }            
//        }
//    }
//}
//
//if(!function_exists("auto_include_with_global")){
//    function auto_include_with_global($path_to_files)
//    {
//        $component_path = JPath::clean(JPATH_SITE . $path_to_files);
//        if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^-]*\.php$', false, true))) {
//            foreach ($component_layouts as $i => $file) {
//                require($file);
//                $file_name = substr($file, strrpos($file, '/')+1);
//                $file_name = explode('.', $file_name);
//                $pos = strripos($file_name[1], '_');
//                $entity_id = substr($file_name[1], $pos+1);
//                $GLOBALS['cck_entity_configuration'][$entity_id] = ${"cck_entity_configuration_$entity_id"};
//            }
//        }
//    }
//}
if (version_compare(JVERSION, "4.0.0", "lt")) {
  auto_include('/libraries/os_lib/src');
}
auto_include_with_global('/administrator/components/com_os_cck/entities_conf');
auto_include('/components/com_os_cck/php');
auto_include('/components/com_os_cck/html');
auto_include('/components/com_os_cck/classes');
$GLOBALS['os_cck_state'] = $os_cck_state = checkOsCckActivation() ;
$db = new os_cckDb();

// echo ':1111111111111111:'; 
// var_dump($task); exit;

if($task == 'cck_layout'){
  if($Itemid){
    $menu = new JTableMenu($db->_db);
    $menu->load($Itemid);
    $params = new JRegistry;
    if($menu->params){
      $params->loadString($menu->params);
    }  

    $layout_type = $params->get('layout_type');
    if($layout_type == 'search'){
      $task = 'show_search';
    }
//    elseif($layout_type == 'request_instance'){
//      $task = 'add_instance';
//    }
    else{
      $task = $layout_type;
    }

    
    $GLOBALS['task'] = $task;
    $input->set('view', $task);
    $input->set('task', $task);
  }
  // var_dump($params);
}
// var_dump($task);

if($input->get('currency', '') != '' && $task != 'changeCurrency'){
    os_cck_site_controller::changeCurrency(false);
}
//var_dump($os_cck_state);
os_cck_initialization();

includeStylesCCK("//cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.css");
includeJavaScriptCCK("//cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.js");
includeStylesCCK( "//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css");
includeStylesCCK("components/com_os_cck/assets/css/front_end_style.css");
includeStylesCCK("components/com_os_cck/assets/css/table_api.css");

$is_added_before = includeJavaScriptCCK("components/com_os_cck/assets/js/jQuerOs-2.2.4.min.js",true);
if( !$is_added_before ) $doc->addScriptDeclaration('jQuerOs=jQuerOs.noConflict();');

includeStylesCCK("components/com_os_cck/assets/css/jquerOs-ui.min.css");
includeJavaScriptCCK("components/com_os_cck/assets/js/jquerOs-ui.min.js");
includeStylesCCK("components/com_os_cck/assets/bootstrap/css/bootstrap-grid_OS.css");

//$doc->addStyleSheet(JURI::root() . "components/com_os_cck/assets/bootstrap/css/bootstrap.css");
includeJavaScriptCCK( "components/com_os_cck/assets/js/functions.js");
includeJavaScriptCCK( "components/com_os_cck/assets/bootstrap/js/bootstrapCCK.js");
includeJavaScriptCCK( "components/com_os_cck/assets/js/os-cck-modal.js");

// $id = intval(mosGetParam($_REQUEST, 'id', 0));

//swiper slider js and css
//$doc->addStylesheet(JUri::root() . "components/com_os_cck/assets/css/swiperCCK.css");
//$doc->addScript(JUri::root() . "components/com_os_cck/assets/js/swiperCCK.js");

//$task = 'displayCckPdf3';
if($option == "com_os_cck" && ($task == 'instance' || $task == 'all_instance' || $task == 'all_categories' || $task == 'category'
        || $task == 'user_instances' || $task == 'calendar' || $task == 'parent_child')){
    if(checkLayoutCacheAccess_cck()){
        
        $controller = JControllerLegacy::getInstance('Os_CCK');
        $controller->execute($task);
        $controller->redirect();
        
        return;
    }
  
  
  
}

// var_dump($controller);

?>


<?php

if(($option == "com_os_cck"  || $option == "com_simplemembership") && $task != 'show_users' && $task != 'my_account' && $task != 'userprolong' && $task != 'advregister' && $task != 'user_prolong' && $task != '' && $task != 'showUsersProfile' && $task != 'accdetail' && $task != 'view_dialogue' && $task != 'send_message' && $task != 'my_messages' && $task != 'login' && $task != 'registration' && $task != 'remindpassword') {
  switch ($task) {
    case 'allcategories':
    case 'all_categories':
    case 'all_categories_pdf':
      Category::listCategories($option, $lid);
    break;
    case 'pay_pal_request':
        os_cck_site_controller::pay_pal_request();
        break;
    case 'getISC':
      $jinput = JFactory::getApplication()->input;

      $title = $jinput->getCmd('title','');
      $location = $jinput->getCmd('location','');
      $event_start = $jinput->getCmd('event_start','');
      $event_end = $jinput->getCmd('event_end','');
      $description = $jinput->getCmd('description','');
      $calendarConstruct = new CalendarUrlConstruct($title, $event_start, $event_end, $description, $location);
      $calendarConstruct->get("File","ICS");

    break;

    case 'category':
    case 'category_pdf':
      Category::showCategory($option, $catid,$lid);
    break;

    case 'user_instances':
    case 'user_instances_pdf':
        if(isset($_GLOBALS['number_of_plugin'])){
            $number_of_plugin = $_GLOBALS['number_of_plugin'];
        }else{
            $number_of_plugin = FALSE;
        }
      Instance::showUserInstances($option, $lid, 0, $number_of_plugin);
    break;
    
    case 'parent_child':
    case 'parent_child_pdf':
        if(isset($_GLOBALS['number_of_plugin'])){
            $number_of_plugin = $_GLOBALS['number_of_plugin'];
        }else{
            $number_of_plugin = FALSE;
        }
      Instance::showParentChildLayout($option, $lid, 0, $number_of_plugin);
    break;

    case 'cart':
      Instance::showCartLayout($option, $lid, 0);
    break;

    case 'paypal':
        if($option == 'com_os_cck'){
            os_cck_site_controller::paypal();
        }
    break;
    
    case 'stripe':
        if($option == 'com_os_cck'){
            os_cck_site_controller::stripe();
        }
    break;

    case 'category_with_map':
      Category::showCategory($option, $catid,$lid);
    break;

    case 'instance':
      Instance::showItem($option, array_pop($eiids), $catid, $lid);
    break;

    case 'instance_manager':
        if($user->id){
            Instance::showInstanceManager('add_instance');
        }else{
            JFactory::getApplication()->enqueueMessage(cck_lang_text("COM_OS_CCK_LOGIN_FIRST"), 'error');
        }
    break;

    case 'edit_instance':
      Instance::editInstance($option, array_pop($eiids));
    break;

    case "publish_instances" :
      Instance::publishInstances($eiids, 1, $option);
    break;

    case "unpublish_instances" :
      Instance::publishInstances($eiids, 0, $option);
    break;

    case "getContent":
      require_once(JPATH_SITE . "/components/com_os_cck/uploader.php");
      break;

    case "approve_instances" :
      Instance::approveInstances($eiids, 1, $option);
    break;

    case "unapprove_instances" :
      Instance::approveInstances($eiids, 0, $option);
    break;

    case "show_rent_request_instances":
      Instance::showInstanceManager('rent_request_instance');
    break;

    case "edit_rent" :
        
      // $eiids = $eiids[0];
      InstanceManagerRent::edit_rent($option, array_pop($eiids));
    break;

    case "save_rent" :
      $eiids = $eiids[0];
      InstanceManagerRent::saveRent($option, $eiids ,$task);
    break;

    case "rent_return" :
      $return_ids = protectInjectionWithoutQuote('return_id','','ARRAY');
      InstanceManagerRent::rent_return($option, $return_ids);
    break;

    case "show_user_rent_history" :
      InstanceManagerRent::users_rent_history($option);
    break;

    case "edit_rent_request_instance":
      Instance::editRentRequestInstance($option, array_pop($eiids));
    break;

    case "decline_rent_requests" :
      Instance::decline_rent_requests($option, $eiids);
    break;

    case "accept_rent_requests" :
      Instance::accept_rent_requests($option, $eiids);
    break;

    case "accept_buy_request" :
      Instance::accept_buy_requests($option, $eiids);
    break;

    case "show_buy_request_instances":
      Instance::showInstanceManager('buy_request_instance');
    break;

    case "edit_buy_request_instance":
      Instance::editBuyRequestInstance($option, array_pop($eiids));
    break;

    case "remove_buy_request_instance" :
      Instance::remove_buy_request_instance($eiids, $option);
    break;

    case 'save_instance':
    case 'apply_instance':
      os_cck_site_controller::saveInstance($option);
      break;

    case 'send_buy_request':
      os_cck_site_controller::send_buy_request($option);
      break;

    case 'all_instance':
    case 'all_instance_pdf':

      $event_date = (protectInjectionWithoutQuote('event_date') && protectInjectionWithoutQuote('event_date') != '')?protectInjectionWithoutQuote('event_date'):false;
      $event_date_field = (protectInjectionWithoutQuote('event_date_field') && protectInjectionWithoutQuote('event_date_field') != '')?protectInjectionWithoutQuote('event_date_field'):false;

      $menu = new JTableMenu($db->_db);
      $menu->load($Itemid);
      $params = new JRegistry;
      if($menu->params){
        $params->loadString($menu->params);
      }  
      $lid = $params->get('all_instance_layout');
      if(!$lid){
        $lid = $params->get('layout');
      }

      if($event_date && $event_date_field){
        $lid = intval(protectInjectionWithoutQuote('lid'));
      }
      
      if(!$lid){
          $lid = intval(protectInjectionWithoutQuote('lid'));
      }
      
      Instance::show_all_instance($option,$lid);
      break;

    case 'calendar':
      $menu = new JTableMenu($db->_db);
      $menu->load($Itemid);
      $params = new JRegistry;
      if($menu->params){
        $params->loadString($menu->params);
      }  
      $lid = $params->get('calendar_layout');
      if(!$lid){
        $lid = $params->get('layout');
      }
      
      Instance::show_calendar($option,$lid);
      break;

    case 'add_instance':
      
      global $params;
      $menu = new JTableMenu($db->_db);
      $menu->load($Itemid);
      $params = new JRegistry;
      if($menu->params){
        $params->loadString($menu->params);
      }  
      $lid = $params->get('request_layout');
      if(!$lid){
        $lid = $params->get('layout');
      }
      if(!$lid){
        $lid = $params->get('layout');
      }
      Instance::editInstance($option, 0, $lid);
      // Instance::show_request_layout($option, $lid,0);
      break;
      
    case 'request_instance':
      
      global $params;
      $menu = new JTableMenu($db->_db);
      $menu->load($Itemid);
      $params = new JRegistry;
      if($menu->params){
        $params->loadString($menu->params);
      }  
      $lid = $params->get('request_layout');
      if(!$lid){
        $lid = $params->get('layout');
      }
      if(!$lid){
        $lid = $params->get('layout');
      }
//      Instance::editInstance($option, 0, $lid);
       Instance::show_request_layout($option, $lid,0);
      break;

    case 'show_request_layout':


      $lid = intval(protectInjectionWithoutQuote('lid'));

      $eiids = protectInjectionWithoutQuote('eiid','','string');
      Instance::show_request_layout($option, $lid,$eiids);
      break;

    case 'send_rent_request':
      os_cck_site_controller::send_rent_request($option);
      break;
    case 'send_request':
      os_cck_site_controller::send_request($option);
      break;

    case 'send_review_request':
      os_cck_site_controller::send_review_request($option);
      break;

    case 'view':
      Instance::showItem($option, $id, $catid);
      break;
      ///
    case 'show_search':
      Category::showSearch($option, $catid, $lid);
      break;
      ///
    case 'secret_image':
      os_cck_site_controller::secretImageCCK($type);
      break;

    case 'ajax_rent_calcualete':
      $rent_from = trim(protectInjectionWithoutQuote("rent_from",''));
      $rent_until = trim(protectInjectionWithoutQuote("rent_until",''));
      $eiids_ajax_rent = intval(protectInjectionWithoutQuote("eiid",''));
      $ceid_ajax_rent = intval(protectInjectionWithoutQuote("ceid",''));
      
      os_cck_site_controller::ajax_rent_calcualete($eiids_ajax_rent,$ceid_ajax_rent,$rent_from,$rent_until);
      break;

    case 'search':

      Instance::search($option, $input->get('categories', array(0), "ARRAY"));
      break;

    case 'checkCaptcha':
      os_cck_site_controller::checkCaptcha();
      break;

    // case 'orderitem':
    //   os_cck_site_controller::orderitem($option);
    //   break;

    // case 'show_rss_categories':
    //   os_cck_site_controller::listRssCategories();
    //   break;

    case 'rent_manage':
      rentManage();
      break;

    case 'reload_captcha':
      $jinput = JFactory::getApplication()->input;
      $captchafName = $jinput->getCmd('captchafName');

      $layout_type = $input->get('captcha_type','','STRING');
      $layout = new os_cckLayout($db->_db);
      $layout->load($lid);
      $layout_params = unserialize($layout->params);

      $layout_html = '';
      $field = new stdClass();
      $field->db_field_name = $captchafName; 

      ob_start();
        require getSiteAddFiledViewPath('com_os_cck', 'captcha_field');
        $html = ob_get_contents();
      ob_end_clean();

      $response = array("html" => $html);
      echo json_encode($response);
      break;

    case "checkFile":
        os_cck_site_controller::checkFile($option);
        break;
    
    case "show_request_instances":
      Instance::showInstanceManager('request_instance');
        break;
    
    case "ajaxCalculatedCurrency":
        os_cck_site_controller::ajaxCalculatedCurrency();
        break;
    
    case "ajaxCalculatedPrice":
        os_cck_site_controller::ajaxCalculatedPrice();
        break;

    case 'getChildSelect':
    //init variables
    $db = new os_cckDb();
    $session = JFactory::getSession();
    $jinput = JFactory::getApplication()->input;
    
    //get post ajax params
    $parent_field = json_decode($jinput->getRaw('field',false));
    $lid = $jinput->getRaw('lid',false);
    $value = $jinput->getRaw('value',false);

    $current_value = $jinput->getRaw('currentValue', false);
    $eiid = $jinput->get('eiid', '', 'STRING');
//    var_dump($eiid);
    if($eiid != ''){
        $entityInstance = new os_cckEntityInstance($db->_db);
        $entityInstance->load($eiid);
    }
//    var_dump($entityInstance);
    $unique_parent_id = json_decode($jinput->getRaw('unique_parent_id',''));
    

    //ger select params
    $params = new JRegistry;
    $params->loadString($parent_field->params);
    //get allowed_values
    $allowed_values = explode('\sprt', $params->get('allowed_value'));
    
    $tmp_values = [];
    foreach ($allowed_values as $value_tmp) {
      $tmp_values[] = explode('|', $value_tmp)[0];
    }
    $allowed_values = $tmp_values;
    //get child_select
    $child_select = explode('|',$params->get('child_select'));

    if(!isset($child_select[$current_value])){
      return;
    }

    $child_fid = $child_select[$current_value];

    $field = $GLOBALS['entityFieldLists'][$parent_field->fk_eid][$child_fid];


    $unique_parent_field = $GLOBALS['entityFieldLists'][$parent_field->fk_eid][$unique_parent_id];
    $layout = new os_cckLayout($db->_db);
    $layout->load($lid);
    //get necessary datas
    $layout_params = unserialize($layout->params);
    $bootstrap_version = $session->get( 'bootstrap','2');
    $layout->layout_html = $layout->getLayoutHtml($bootstrap_version);
    $layout_html = urldecode($layout->layout_html);
    
    $layout_html = str_replace('data-label-styling', 'style',  $layout_html);
    $field_styling = get_field_styles($unique_parent_field, $layout);
    $custom_class = get_field_custom_class($unique_parent_field, $layout);
    $offset_animation = get_field_offset_animation($unique_parent_field, $layout);

    $layout_params['field_styling'] = $field_styling;
    $layout_params['custom_class'] = $custom_class;
    $layout_params['offset_animation'] = $offset_animation;
    $layout_params['custom_fields'] = unserialize($layout->custom_fields);
    $layout_params['fields']['Params_text_select_list_'.$child_fid] = $layout_params['fields']['Params_text_select_list_'.$unique_parent_id];

    if($layout->type == 'search'){
      require getSiteSearchFiledViewPath('com_os_cck', $field->field_type);
    }else{
      require getSiteAddFiledViewPath('com_os_cck', $field->field_type);
    }
    
    break;
    
    case "addInstanceToCart":
        os_cck_site_controller::addInstanceToCart();
        break;
    
    case "removeProductFromCart":
        os_cck_site_controller::removeProductFromCart();
        break;
    
    case "getAjaxPriceDetails":
        os_cck_site_controller::getAjaxPriceDetails();
        break;
    
    case "changeCurrency":
        os_cck_site_controller::changeCurrency();
        break;
    
    case "ajaxCheckCoupon":
        os_cck_site_controller::ajaxCheckCoupon();
        break;
        
    case "fileDownload":
        os_cck_site_controller::fileDownload();
        break;
    case "home_page":
        break;
    
    case "set_package_license":
        $data = protectInjectionWithoutQuote('data', '', 'string');
        setOsCckLicense($data);
        break ;        
    
    case "check_package_state":
        $state = checkOsCckState();
        print_r($state);exit();
        break ;
    
    case "set_app_license_activation":
        setOsCckAppLicenseActivation();
        exit();
        break ;
        
    case "displayCckPdf":
        os_cck_site_controller::displayCckPdf();
        break;

    case "delete_instances" :
        Instance::deleteInstances($eiids, $option);
        break;

    case "2checkout" :
        os_cck_site_controller::twocheckout();
        break;

    case "getBookingCalendarAjax":
        $eiid = $input->get('eiid', '');
        $eid = $input->get('eid', '');
        $month_selected = $input->get('month_selected', '');
        $year_selected = $input->get('year_selected', '');
        $lid = $input->get('lid', '');

        $layout = new os_cckLayout($db->_db);
        $layout->load($lid);
        $layout_params = unserialize($layout->params);

        $show_month = $layout_params['fields']['months_cck_booking_cal'];
        $show_details = $layout_params['fields']['cck_booking_cal_show_day_details'];

        ob_start();
        $calendar = new booking_calendar();
        if($layout_params['fields']['cck_booking_cal_show_month_year']){
            $month_year_html = $calendar->getMonthYearSelect($layout_params['fields']['cck_booking_cal_initial_year'], $layout_params['fields']['cck_booking_cal_final_year']);
            echo $month_year_html;
        }
        $calendar_html = $calendar::getCalendar($month_selected,$year_selected,$eiid,$show_details);
        if(in_array('last', $show_month)) echo $calendar_html->tab1;
        if(in_array('current', $show_month)) echo $calendar_html->tab2;
        if(in_array('next1', $show_month)) echo $calendar_html->tab3;
        if(in_array('next2', $show_month)) echo $calendar_html->tab4;
        
        if($layout_params['fields']['cck_booking_cal_show_nav_butt']){
            $nav_buttons_html = $calendar->getNavButtons();
            echo $nav_buttons_html;
        }
        
        $html = ob_get_contents();
        ob_end_clean();

        $response = array("html" => $html);
        echo json_encode($response);

        // var_dump($html);
        break;
        
    case "changeQuantityCart":
        os_cck_site_controller::changeQuantityCart();
        break;
    
    // case "setLayoutInSessionAjax":  15.10.2025  not undertend why ? - -not work for edite buttomn in layout
    //     $lid = $input->get('lid');
    //     $session->set('last_overall_layout', $lid);
    //     ob_end_clean();
    //     echo json_encode(array('success'=>true));
    //     break;
    
    case "getCalendarAjax":
        
        $month_selected = $input->get('month', '');
        $year_selected = $input->get('year', '');
        $lid = $input->get('lid', '');
        
        

        ob_start();
          Instance::show_calendar($option,$lid);
          $html = ob_get_contents();
        ob_end_clean();

        $response = array("html" => $html);
        echo json_encode($response);

        // var_dump($html);
        break;
    
    case "review_instance":
    case "show_review_instance":
        $app->enqueueMessage(cck_lang_text("COM_OS_CCK_REVIEW_LAYOUT_ERROR"), 'warning');
        break; 
    
    case "payment_notice":
        os_cck_site_controller::payment_notice();
    default:
//    Category::listCategories($catid);
        if($option == "com_os_ckk"){
            throw new \Exception('', 404);
        }

      break;
  }
}
?>
