app.init.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. $url = "http://dev.vestacp.com:8083/dispatch.php";
  3. $useragent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
  4. $ch = curl_init();
  5. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  6. curl_setopt($ch, CURLOPT_POST, 1);
  7. curl_setopt($ch, CURLOPT_URL,$url);
  8. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
  9. $result= curl_exec ($ch);
  10. curl_close ($ch);
  11. die();
  12. define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
  13. require_once V_ROOT_DIR . 'config/Config.class.php';
  14. require_once V_ROOT_DIR . 'core/utils/Utils.class.php';
  15. require_once V_ROOT_DIR . 'core/VestaSession.class.php';
  16. require_once V_ROOT_DIR . 'core/Vesta.class.php';
  17. require_once V_ROOT_DIR . 'core/exceptions/SystemException.class.php';
  18. require_once V_ROOT_DIR . 'core/exceptions/ProtectionException.class.php';
  19. require_once V_ROOT_DIR . 'core/utils/Message.class.php';
  20. require_once V_ROOT_DIR . 'core/Request.class.php';
  21. require_once V_ROOT_DIR . 'api/AjaxHandler.php';
  22. /**
  23. * App execution
  24. *
  25. * @author Malishev Dima <dima.malishev@gmail.com>
  26. * @author vesta, http://vestacp.com/
  27. * @copyright vesta 2010-2011
  28. */
  29. try {
  30. // Execution
  31. AjaxHandler::makeReply(
  32. AjaxHandler::getInstance()->dispatch(new Request())
  33. );
  34. }
  35. //
  36. // Errors handling
  37. //
  38. catch (SystemException $e) {
  39. AjaxHandler::systemError($e);
  40. }
  41. catch (ProtectionException $e) {
  42. AjaxHandler::protectionError($e);
  43. }
  44. catch (Exception $e) {
  45. AjaxHandler::generalError($e);
  46. }