Exemple #1
0
            //版本比较模式,显示当前版本与前一版本的差异
            $current = $versions[$version];
            if (isset($versions[$version])) {
                $dzzpath = getDzzPath($versions[$version]);
                $str_new = str_replace(array("\r\n", "\r", "\n"), "", IO::getFileContent($dzzpath));
            } else {
                $dzzpath = getDzzPath($document);
                $str_new = str_replace(array("\r\n", "\r", "\n"), "", IO::getFileContent($dzzpath));
            }
            if ($versions[$version - 1]) {
                $dzzpath_old = getDzzPath($versions[$version - 1]);
                $str_old = str_replace(array("\r\n", "\r", "\n"), "", IO::getFileContent($dzzpath_old));
            } else {
                $str_old = $str_new;
            }
            include_once dzz_libfile('class/html_diff', 'document');
            $diff = new html_diff();
            $str = $diff->compare($str_old, $str_new);
        } else {
            $current = $document;
            $dzzpath = getDzzPath($document);
            $str = str_replace(array("\r\n", "\r", "\n"), "", IO::getFileContent($dzzpath));
            $navtitle = $document['subject'];
        }
    } else {
        showmessage('文档不存在或已经删除', dreferer());
    }
    $dicoid = dzzencode($icoid);
    $editperm = perm_check::checkperm('edit', $icoarr);
    include template('document_view');
}
Exemple #2
0
<?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('&nbsp; &nbsp; &nbsp; &nbsp; ', '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $str));
include template('textviewer');
Exemple #3
0
    $return = array('did' => $did, 'autosave' => $autosave, 'icoid' => dzzencode($icoid));
    showmessage('do_success', dreferer(), array('data' => rawurlencode(json_encode($return))), array('showmsg' => true));
} else {
    $navtitle = '';
    $icoid = intval(dzzdecode($_GET['icoid']));
    if ($icoid && ($icoarr = C::t('icos')->fetch_by_icoid($icoid))) {
        if (!perm_check::checkperm('edit', $icoarr)) {
            showmessage('no_privilege');
        }
        $did = $icoarr['did'];
    } else {
        showmessage('文档不存在');
    }
    if ($document = C::t('document')->fetch_by_did($did)) {
        $dzzpath = getDzzPath($document);
        $str = trim(IO::getFileContent($dzzpath));
        $navtitle = $document['subject'];
    } else {
        $navtitle = '新建文档';
    }
    include template('document_edit');
}
function getAidsByMessage($message)
{
    $aids = array();
    if (preg_match_all("/" . rawurlencode('attach::') . "(\\d+)/i", $message, $matches)) {
        $aids = $matches[1];
    }
    if (preg_match_all("/path=\"attach::(\\d+)\"/i", $message, $matches1)) {
        if ($matches1[1]) {
            $aids = array_merge($aids, $matches1[1]);
Exemple #4
0
            $dzzpath = getDzzPath($versions[$version]);
            $str_new = IO::getFileContent($dzzpath);
            //str_replace(array("\r\n", "\r", "\n"), "",io::getFileContent($dzzpath));
        } else {
            $dzzpath = getDzzPath($document);
            $str_new = IO::getFileContent($dzzpath);
            //str_replace(array("\r\n", "\r", "\n"), "",io::getFileContent($dzzpath));
        }
        if ($versions[$version - 1]) {
            $dzzpath_old = getDzzPath($versions[$version - 1]);
            $str_old = IO::getFileContent($dzzpath_old);
            //str_replace(array("\r\n", "\r", "\n"), "",io::getFileContent($dzzpath_old));
        } else {
            $str_old = $str_new;
        }
        include_once dzz_libfile('class/html_diff', 'document');
        $diff = new html_diff();
        $str = $diff->compare($str_old, $str_new);
    } else {
        $current = $document;
        $dzzpath = getDzzPath($document);
        $str = IO::getFileContent($dzzpath);
        //str_replace(array("\r\n", "\r", "\n"), "",IO::getFileContent($dzzpath));
        $navtitle = $document['subject'];
    }
} else {
    $document = $class;
    $document['subject'] = $class['fname'];
    $document['dateline'] = dgmdate($document['dateline'], 'u');
}
include template('list/view');
Exemple #5
0
         } else {
             C::t('document')->delete_by_did($newdid, true);
             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('&nbsp; &nbsp; &nbsp; &nbsp; ', '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $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);
Exemple #6
0
        }
    }
    if (!preg_match("/^(http|ftp|https|mms)\\:\\/\\/.{4,300}\$/i", $link)) {
        topshowmessage('网址格式错误!');
    }
    $icoarr = io_dzz::linktourl($link, $pfid);
} elseif ($_GET['type'] == 'dzzdoc') {
    $aid = empty($_GET['aid']) ? 0 : intval($_GET['aid']);
    $attach = C::t('attachment')->fetch($aid);
    if (!$attach) {
        topshowmessage(lang('message', 'attachment_nonexistence'));
    }
    if (!empty($_GET['filename'])) {
        $attach['filename'] = trim($_GET['filename']);
    }
    $icoarr = IO::upload_by_content(IO::getFileContent('attach::' . $attach['aid']), $pfid, trim($attach['filename'], '.dzzdoc') . '.dzzdoc');
} else {
    $aid = empty($_GET['aid']) ? 0 : intval($_GET['aid']);
    $attach = C::t('attachment')->fetch($aid);
    if (!$attach) {
        topshowmessage(lang('message', 'attachment_nonexistence'));
    }
    if (!empty($_GET['filename'])) {
        $attach['filename'] = trim($_GET['filename']);
    }
    $icoarr = io_dzz::uploadToattachment($attach, $pfid);
}
if (isset($icoarr['error'])) {
    topshowmessage($icoarr['error']);
}
include template('common/header_simple');