public static function Start()
  {
    global $_SERVER;
    if (!phoxy_conf()["is_ajax_request"] && phoxy_conf()["api_csrf_prevent"])
      die("Request aborted due API direct CSRF warning");

    if (phoxy_conf()["buffered_output"])
      ob_start();

    global $_GET;
    $get_param = phoxy::Config()["get_api_param"];
    $file = $_GET[$get_param];
    unset($_GET[$get_param]);

    if ($file === 'htaccess')
      exit('Rewrite engine work SUCCESS');

    try
    {
      include_once('rpc_string_parser.php');
      $parser = new \phoxy\rpc_string_parser();

      global $_phoxy_process_obj;
      $_phoxy_process_obj = $obj = $parser->GetRpcObject($file, $_GET);
      $a = $obj['obj'];

      $method = $obj['method'];
      if (is_string($method))
        $method = [$method, []];

      $result = $a->APICall($method[0], $method[1]);
    } catch (phoxy_protected_call_error $e)
    {
      $error = $e->result;

      if (!isset($error['error']))
        $error['phoxy_comment'] = "Phoxy caught soft error. Look inside network log";


      $result = new phoxy_return_worker($error);
    }

    $prepared = (string)$result;

    if (phoxy_conf()["buffered_output"])
    {
      $buffered_output = ob_get_contents();
      ob_end_clean();
    }

    if (phoxy_conf()["debug_api"] && !phoxy_conf()["is_ajax_request"])
    {
      echo "<h1>Result</h1>\n";
      var_dump($result->obj);
    }
    else
      header('Content-Type: application/json; charset=utf-8');

    if (!phoxy_conf()["debug_api"] || phoxy_conf()["is_ajax_request"])
      echo $prepared;
    else if (phoxy_conf()["buffered_output"])
      echo "\n<hr><h1>Log</h1>\n{$buffered_output}";
  }
public static function Start()
  {
    global $_SERVER;
    if (!phoxy_conf()["is_ajax_request"] && phoxy_conf()["api_csrf_prevent"])
      die("Request aborted due API direct CSRF warning");

    if (phoxy_conf()["buffered_output"])
      ob_start();

    global $_GET;
    $get_param = phoxy::Config()["get_api_param"];
    $file = $_GET[$get_param];
    unset($_GET[$get_param]);

    if ($file === 'htaccess')
      exit('Rewrite engine work SUCCESS');

    try
    {
      include_once('rpc_string_parser.php');
      $parser = new \phoxy\rpc_string_parser();

      global $_phoxy_process_obj;
      $_phoxy_process_obj = $obj = $parser->GetRpcObject($file, $_GET);
      $a = $obj['obj'];

      $method = $obj['method'];
      if (is_string($method))
        $method = [$method, []];

      $result = $a->APICall($method[0], $method[1]);
    } catch (phoxy_protected_call_error $e)
    {
      $error = $e->result;

      if (!isset($error['error']))
        $error['phoxy_comment'] = "Phoxy caught soft error. Look inside network log";


      $result = new phoxy_return_worker($error);
    }

    $prepared = (string)$result;

    if (phoxy_conf()["buffered_output"])
    {
      $buffered_output = ob_get_contents();
      ob_end_clean();
    }

    if (phoxy_conf()["debug_api"] && !phoxy_conf()["is_ajax_request"])
    {
      echo "<h1>Result</h1>\n";
      var_dump($result->obj);
    }
    else
      header('Content-Type: application/json; charset=utf-8');

    if (!phoxy_conf()["debug_api"] || phoxy_conf()["is_ajax_request"])
      echo $prepared;
    else if (phoxy_conf()["buffered_output"])
      echo "\n<hr><h1>Log</h1>\n{$buffered_output}";
  }
public static function Start ( ) { global $ _SERVER ; if ( ! phoxy_conf ( ) [ "is_ajax_request" ] && phoxy_conf ( ) [ "api_csrf_prevent" ] ) die ( "Request aborted due API direct CSRF warning" ) ; if ( phoxy_conf ( ) [ "buffered_output" ] ) ob_start ( ) ; global $ _GET ; $ get_param = phoxy :: Config ( ) [ "get_api_param" ] ; $ file = $ _GET [ $ get_param ] ; unset ( $ _GET [ $ get_param ] ) ; if ( $ file === 'htaccess' ) exit ( 'Rewrite engine work SUCCESS' ) ; try { include_once ( 'rpc_string_parser.php' ) ; $ parser = new \ phoxy \ rpc_string_parser ( ) ; global $ _phoxy_process_obj ; $ _phoxy_process_obj = $ obj = $ parser -> GetRpcObject ( $ file , $ _GET ) ; $ a = $ obj [ 'obj' ] ; $ method = $ obj [ 'method' ] ; if ( is_string ( $ method ) ) $ method = [ $ method , [ ] ] ; $ result = $ a -> APICall ( $ method [ 0 ] , $ method [ 1 ] ) ; } catch ( phoxy_protected_call_error $ e ) { $ error = $ e -> result ; if ( ! isset ( $ error [ 'error' ] ) ) $ error [ 'phoxy_comment' ] = "Phoxy caught soft error. Look inside network log" ; $ result = new phoxy_return_worker ( $ error ) ; } $ prepared = ( string ) $ result ; if ( phoxy_conf ( ) [ "buffered_output" ] ) { $ buffered_output = ob_get_contents ( ) ; ob_end_clean ( ) ; } if ( phoxy_conf ( ) [ "debug_api" ] && ! phoxy_conf ( ) [ "is_ajax_request" ] ) { echo "<h1>Result</h1>\n" ; var_dump ( $ result -> obj ) ; } else header ( 'Content-Type: application/json; charset=utf-8' ) ; if ( ! phoxy_conf ( ) [ "debug_api" ] || phoxy_conf ( ) [ "is_ajax_request" ] ) echo $ prepared ; else if ( phoxy_conf ( ) [ "buffered_output" ] ) echo "\n<hr><h1>Log</h1>\n{$buffered_output}" ; }
Begin default phoxy behaviour
Begin default phoxy behaviour