pdfviewer.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /****************************
  3. * File : pdfviewer.php
  4. * Author : Cygnusa
  5. * @2018
  6. ****************************/
  7. //SECURITY
  8. if ( ! defined('APPLICATION_PATH')) exit('No direct script access allowed');
  9. //FUNCTION LISTS
  10. class pdfviewer
  11. {
  12. //CONSTRUCT
  13. function __construct($parent)
  14. {
  15. //GET PAGE MESSAGE
  16. $this->pdfviewerFunc($parent);
  17. $parent->response(array('response'=>'failed', 'message' => 'PAGE NOT FOUND'), 404);
  18. }
  19. /* /////////////////////////////// TRAINING //////////////////////////////////////// */
  20. private function pdfviewerFunc($parent)
  21. {
  22. globalfunc::checkMethodType($parent,array('GET'));
  23. globalfunc::checkParamCount($parent,1);
  24. //globalfunc::checkAuthrozation($parent,array('type'=>'user'));
  25. $decode_url= base64_decode(escape_str($parent->params[0]));
  26. //CONNECT S3
  27. $s3=awsfileserver::connectS3();
  28. $obj = new stdClass();
  29. $obj->key_name=$decode_url;
  30. $s3_sign_url=awsfileserver::getS3Url($s3,S3_BUCKET,$obj);
  31. header("Content-type:application/pdf");
  32. header("Access-Control-Allow-Origin: *");
  33. @readfile($s3_sign_url);
  34. exit;
  35. }
  36. /* //////////////////////////////////////////////////////////////////////////////////////////// */
  37. }
  38. ?>