From 48a545ea4d192afb31e8b960d2247b4cb0e16495 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 30 Jun 2021 14:07:47 +0800 Subject: [PATCH] * Adjust code. --- module/doc/model.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index fc6444b57b..b375a0e1cb 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -526,7 +526,7 @@ class docModel extends model ->remove('comment,files,labels,uid,contactListMenu') ->get(); if($doc->contentType == 'markdown') $doc->content = $this->post->content; - if($doc->acl == 'private') $doc->users = $oldDoc->addedBy; + if(!empty($doc->acl) and $doc->acl == 'private') $doc->users = $oldDoc->addedBy; $oldDocContent = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->eq($docID)->andWhere('version')->eq($oldDoc->version)->fetch(); if($oldDocContent) @@ -539,10 +539,14 @@ class docModel extends model if($oldDocContent->type == 'markdown') $doc->content = str_replace('>', '>', $doc->content); } - $lib = $this->getLibByID($doc->lib); + $lib = !empty($doc->lib) ? $this->getLibByID($doc->lib) : ''; $doc = $this->loadModel('file')->processImgURL($doc, $this->config->doc->editor->edit['id'], $this->post->uid); - $doc->product = $lib->product; - $doc->execution = $lib->execution; + if(!empty($lib)) + { + $doc->product = $lib->product; + $doc->execution = $lib->execution; + } + if(isset($doc->type) and $doc->type == 'url') $doc->content = $doc->url; unset($doc->url);