<?php
global $czpf_plugin;

function send_error_die($msg){
	die(json_encode(array('R'=>'ERR','MSG'=>$msg)));
}

if(!isset($_REQUEST['object_type']) ){
	send_error_die('Error in data');
}

if(!isset($_REQUEST['tmp_site_user']) || !is_numeric($_REQUEST['tmp_site_user']) ){
	send_error_die('Error in data');
}


add_action( 'init', 'create_post_typess' );	

function create_post_typess(){
	require_once(RHCCZPF_PATH.'inc/class.object_controler.php');
	$czpf_class_object_controler = new czpf_class_object_controler(RHCCZPF_URL);
	$czpf_class_object_controler->check_up_user_id = $_REQUEST['tmp_site_user'];
	
	$_GET['paged'] = $_REQUEST['paged'];
	
	
	$tmp_data_1 = '';
	$tmp_data_2 = '';
	
	$return_data = $czpf_class_object_controler->extra_generate_list($_REQUEST['object_type'],'extend');
	if(!empty($return_data[0])){
		$tmp_data_1 = $return_data[0];
	} else {
		$tmp_data_1 = '';
	}

	if(!empty($return_data[1])){
		$tmp_data_2 = $return_data[1];
	} else {
		$tmp_data_2 = '';
	}
	
	
	die(json_encode(array('R'=>'OK','data1'=>$tmp_data_1,'data2'=>$tmp_data_2,'paged'=>$_REQUEST['paged'],'buttonobject'=>$_REQUEST['object_type'])));
}
?>