* Code for bug #34060.

This commit is contained in:
caoyanyi
2023-04-12 11:23:05 +08:00
parent 493e4a8589
commit 1b9bbe097d
2 changed files with 5 additions and 4 deletions
+1 -2
View File
@@ -1142,12 +1142,11 @@ class doc extends control
public function view($docID = 0, $version = 0, $appendLib = 0)
{
$doc = $this->doc->getById($docID);
if(!$doc)
if(!$doc or !isset($doc->id))
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found'));
return print(js::error($this->lang->notFound) . js::locate($this->inlink('index')));
}
if(!$this->doc->checkPrivDoc($doc)) return $this->accessDenied();
$lib = $this->doc->getLibById($doc->lib);
if(!empty($lib) and $lib->deleted == '1') $appendLib = $doc->id;
+4 -2
View File
@@ -766,7 +766,7 @@ class docModel extends model
echo(js::alert($this->lang->doc->accessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) return print(js::locate(inlink('index')));
return print(js::locate('back'));
helper::end(print(js::locate('back')));
}
$docs = $this->processCollector(array($doc->id => $doc));
@@ -1320,6 +1320,8 @@ class docModel extends model
*/
public function checkPrivDoc($object)
{
if(!isset($object->lib)) return false;
$libType = $this->dao->select('type')->from(TABLE_DOCLIB)->where('id')->eq($object->lib)->fetch('type');
if($this->app->user->admin and $libType != 'mine') return true;
@@ -2807,7 +2809,7 @@ class docModel extends model
public function checkAutoloadPage($doc)
{
$autoloadPage = true;
if(!empty($doc) and $doc->type == 'url')
if(isset($doc->type) and $doc->type == 'url')
{
if(empty($doc->content)) return false;