コード例 #1
0
ファイル: HttpAction.class.php プロジェクト: tmlsoft/main
 function createPDF($dirname, $resource_path)
 {
     $outfile = "";
     //接收参数    1、加密文件夹物理路径
     //接收参数    1、加密文件物理路径
     //使用PHPinfo方法。进行路径解析
     $info = pathinfo($resource_path);
     //组装一个文件标示,方便判断文件是否生成
     $lockFile = $info['dirname'] . '/' . $info['filename'] . '.lock';
     //验证标示文件是否存在,判断是否为后台自动生成中,避免第二次点击的时候在重新生成
     if (!file_exists($lockFile)) {
         //生成标示文件
         file_put_contents($lockFile, 'true');
         //执行PDF文件生成
         import('@.ORG.OfficeOnline.OfficeOnlineView');
         $OfficeOnlineView = new OfficeOnlineView();
         $outfile = $OfficeOnlineView->fileCreate($dirname, $resource_path, 'swf/pdf');
         //删除标示文件
         unlink($lockFile);
     }
     return $outfile;
 }
コード例 #2
0
 function playSWF()
 {
     $file_type = "file";
     $socuse = str_replace("\\", "/", base64_decode($_REQUEST['name']));
     $file_path = $resource_path = str_replace("\\", "/", UPLOAD_PATH . $socuse);
     if (!file_exists($file_path)) {
         $this->error('文件不存在!');
     }
     $info = pathinfo($file_path);
     $filesArr = C('TRANSFORM_SWF');
     $filesArr[] = 'pdf';
     $photoArr = C('IMG_file');
     $file_extension_lower = strtolower($info['extension']);
     if (in_array($file_extension_lower, $filesArr)) {
         $file_path = preg_replace("/^([\\s\\S]+)\\/Public/", "../Public", $info["dirname"]);
         $file_path .= '/swf/' . $info['filename'] . '.swf';
         $file_path = @iconv('UTF-8', 'GBK', $file_path);
         if (!file_exists($file_path)) {
             import('@.ORG.OfficeOnline.OfficeOnlineView');
             $OfficeOnlineView = new OfficeOnlineView();
             if ('pdf' == $file_extension_lower) {
                 $OfficeOnlineView->fileCreate($info['dirname'], $resource_path, 'swf');
             } else {
                 $OfficeOnlineView->fileCreate($info['dirname'], $resource_path, 'swf/pdf');
             }
         }
         $this->assign('file_name', $_REQUEST['filename']);
     }
     if (in_array($file_extension_lower, $photoArr)) {
         $file_type = "photo";
     }
     $file_path = preg_replace("/^([\\s\\S]+)\\/Public/", "__PUBLIC__", $file_path);
     $this->assign("file_type", $file_type);
     $this->assign('file_path', $file_path);
     $this->display("Public:playswf");
 }