<?php

//ini_set('display_errors',1);
//error_reporting(E_ALL);

session_start();

$output = array( 'data' => array(), 'msg' => '' );

//load config
$root_path = dirname( __FILE__ );
require$root_path . '/config.php';

//load language file
if( file_exists( $root_path . '/languages/' . $config['lang'] . '.php' ) ){
    $lang_file = $root_path . '/languages/' . $config['lang'] . '.php';
}else{
    $lang_file = $root_path . '/languages/en.php';
}
require $lang_file;

//load class
require_once $root_path . '/videoeditor.class.php';
$videoEditor = new videoEditor( $config );

//action name
$action = !empty( $_POST['action'] ) && !is_array( $_POST['action'] ) ? trim( $_POST['action'] ) : '';

//call method
if( method_exists( $videoEditor, 'action_' . $action ) ){
    
    $options = array();
    
    call_user_func( array( &$videoEditor, 'action_' . $action ), $options );
    
    $output = $videoEditor->output;
    
}

echo json_encode( $output );
