<?php /* * @copyright Leyun internet Technology(Shanghai)Co.,Ltd * @license http://www.dzzoffice.com/licenses/license.txt * @package DzzOffice * @link http://www.dzzoffice.com * @author zyx(zyx@dzz.cc) */ if (!defined('IN_DZZ')) { exit('Access Denied'); } $path = dzzdecode($_GET['path']); $str = IO::getFileContent($path); require_once DZZ_ROOT . './dzz/class/class_encode.php'; $p = new Encode_Core(); $code = $p->get_encoding($str); if ($code) { $str = diconv($str, $code, CHARSET); } $str = htmlspecialchars($str); $str = nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $str)); include template('textviewer');
exit(json_encode(array('error' => '文档导入失败'))); } } else { C::t('corpus_class')->delete_by_fid($fid, true); exit(json_encode(array('error' => '文档导入失败'))); } } elseif ($aid > 0) { //文本类文档; if (!($attach = C::t('attachment')->fetch($aid))) { C::t('corpus_class')->delete_by_fid($fid, true); exit(json_encode(array('error' => '文档导入失败'))); } $path = getDzzPath($attach); $message = IO::getFileContent($path); require_once DZZ_ROOT . './dzz/class/class_encode.php'; $p = new Encode_Core(); $code = $p->get_encoding($message); if ($code) { $message = diconv($message, $code, CHARSET); } $message = htmlspecialchars($message); $message = nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message)); if (!($attach = getTxtAttachByMd5($message, $setarr['fname'] . '.dzzdoc'))) { C::t('corpus_class')->delete_by_fid($fid, true); exit(json_encode(array('error' => '文档导入失败'))); } $setarr1 = array('uid' => $_G['uid'], 'username' => $_G['username'], 'aid' => $attach['aid'], 'fid' => $fid); if (!($newdid = C::t('document')->insert($setarr1, array(), 'corpus', $cid))) { C::t('corpus_class')->delete_by_fid($fid, true); exit(json_encode(array('error' => '文档导入失败'))); } else {