mirror of
https://github.com/typecho/typecho.git
synced 2025-04-21 02:01:52 +02:00
fix query
This commit is contained in:
parent
6b2c5b19e1
commit
7edd3f9659
@ -562,12 +562,12 @@ class Archive extends Contents
|
||||
|
||||
/** 定时发布功能 */
|
||||
if (!$selectPlugged) {
|
||||
if ($this->parameter->preview) {
|
||||
$select = $this->select();
|
||||
} else {
|
||||
$select = $this->select('table.contents.*');
|
||||
|
||||
if (!$this->parameter->preview) {
|
||||
if ('post' == $this->parameter->type || 'page' == $this->parameter->type) {
|
||||
if ($this->user->hasLogin()) {
|
||||
$select = $this->select()->where(
|
||||
$select->where(
|
||||
'table.contents.status = ? OR table.contents.status = ?
|
||||
OR (table.contents.status = ? AND table.contents.authorId = ?)',
|
||||
'publish',
|
||||
@ -576,7 +576,7 @@ class Archive extends Contents
|
||||
$this->user->uid
|
||||
);
|
||||
} else {
|
||||
$select = $this->select()->where(
|
||||
$select->where(
|
||||
'table.contents.status = ? OR table.contents.status = ?',
|
||||
'publish',
|
||||
'hidden'
|
||||
@ -584,14 +584,14 @@ class Archive extends Contents
|
||||
}
|
||||
} else {
|
||||
if ($this->user->hasLogin()) {
|
||||
$select = $this->select()->where(
|
||||
$select->where(
|
||||
'table.contents.status = ? OR (table.contents.status = ? AND table.contents.authorId = ?)',
|
||||
'publish',
|
||||
'private',
|
||||
$this->user->uid
|
||||
);
|
||||
} else {
|
||||
$select = $this->select()->where('table.contents.status = ?', 'publish');
|
||||
$select->where('table.contents.status = ?', 'publish');
|
||||
}
|
||||
}
|
||||
$select->where('table.contents.created < ?', $this->options->time);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Widget\Contents;
|
||||
|
||||
use Typecho\Config;
|
||||
use Typecho\Db\Exception;
|
||||
use Widget\Base\Contents;
|
||||
use Widget\Base\TreeTrait;
|
||||
@ -20,6 +21,18 @@ class From extends Contents
|
||||
___directory as ___treeDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Config $parameter
|
||||
* @return void
|
||||
*/
|
||||
protected function initParameter(Config $parameter)
|
||||
{
|
||||
$parameter->setDefault([
|
||||
'cid' => null,
|
||||
'query' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Widget\Metas;
|
||||
|
||||
use Typecho\Config;
|
||||
use Typecho\Db\Exception;
|
||||
use Widget\Base\Metas;
|
||||
use Widget\Base\TreeTrait;
|
||||
@ -14,6 +15,18 @@ class From extends Metas
|
||||
initParameter as initTreeParameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Config $parameter
|
||||
* @return void
|
||||
*/
|
||||
protected function initParameter(Config $parameter)
|
||||
{
|
||||
$parameter->setDefault([
|
||||
'mid' => null,
|
||||
'query' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
|
Loading…
x
Reference in New Issue
Block a user