コード例 #1
0
ファイル: swfsize_php5.php プロジェクト: BellyWong/ebtAdmin
 /**
  * Method:search
  */
 public function getSize($doc, $page, $mode)
 {
     $output = array();
     try {
         if ($this->configManager->getConfig('splitmode') == 'true') {
             $swfdoc = $doc . "_" . $page . ".swf";
         } else {
             $swfdoc = $doc . ".swf";
         }
         $swfFilePath = $this->configManager->getConfig('path.swf') . $swfdoc;
         // check for directory traversal & access to non pdf files and absurdely long params
         if (!validSwfParams($swfFilePath, $swfdoc, $page)) {
             return;
         }
         if ($mode == 'width') {
             $command = $this->configManager->getConfig('cmd.query.swfwidth');
         }
         if ($mode == 'height') {
             $command = $this->configManager->getConfig('cmd.query.swfheight');
         }
         $command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf'), $command);
         $command = str_replace("{swffile}", $swfFilePath, $command);
         $return_var = 0;
         exec($command, $output, $return_var);
         if ($return_var == 0) {
             return strip_non_numerics(arrayToString($output));
         } else {
             return "[Error Extracting]";
         }
     } catch (Exception $ex) {
         return $ex;
     }
 }
コード例 #2
0
 /**
  * Method:search
  */
 public function extractText($doc, $page)
 {
     $output = array();
     try {
         // check for directory traversal & access to non pdf files and absurdely long params
         if (!validSwfParams($this->configManager->getConfig('path.swf') . $doc . $page . ".swf", $doc, $page)) {
             return;
         }
         $command = $this->configManager->getConfig('cmd.searching.extracttext');
         $command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf'), $command);
         $command = str_replace("{swffile}", $doc . $page . ".swf", $command);
         $return_var = 0;
         exec($command, $output, $return_var);
         if ($return_var == 0) {
             return arrayToString($output);
         } else {
             return "[Error Extracting]";
         }
     } catch (Exception $ex) {
         return $ex;
     }
 }
コード例 #3
0
ファイル: view.php プロジェクト: BellyWong/ebtAdmin
             if ($resolution != null) {
                 header('Content-Type: image/jpeg');
                 echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, $resolution, 'png', 'jpg'));
             } else {
                 header('Content-Type: image/png');
                 echo file_get_contents($pngFilePath);
             }
         }
     } else {
         if (strlen($messages) == 0 || $messages == "[OK]") {
             $messages = "[Incorrect file specified, please check your path]";
         }
     }
 }
 if ($format == "jpg") {
     if (validSwfParams($swfFilePath, $swfdoc, $page)) {
         if (!file_exists($pngFilePath)) {
             $pngconv = new swfrender();
             $pngconv->renderPage($pdfdoc, $swfdoc, $page, $subfolder);
         }
         if ($configManager->getConfig('allowcache')) {
             setCacheHeaders();
         }
         if (!$configManager->getConfig('allowcache') || $configManager->getConfig('allowcache') && endOrRespond()) {
             header('Content-Type: image/jpeg');
             if (file_exists($jpgCachePath)) {
                 echo file_get_contents($jpgCachePath);
             } else {
                 if ($resolution == null) {
                     echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, 1200, 'png', 'jpg'));
                 } else {