修正一堆bug
This commit is contained in:
@@ -27,12 +27,8 @@ class Widget_Contents_Page_Admin extends Widget_Contents_Post_Admin
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** 构建基础查询 */
|
||||
$select = $this->select()->where('table.contents.type = ?', 'page');
|
||||
|
||||
/** 过滤状态 */
|
||||
$select->where('table.contents.status = ? OR table.contents.status = ? OR (table.contents.status = ? AND table.contents.parent = 0)',
|
||||
'publish', 'waiting', 'draft');
|
||||
$select = $this->select()->where('table.contents.type = ? OR (table.contents.type = ? AND table.contents.parent = ?)', 'page', 'page_draft', 0);
|
||||
|
||||
/** 过滤标题 */
|
||||
if (NULL != ($keywords = $this->request->keywords)) {
|
||||
|
||||
@@ -35,11 +35,11 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
|
||||
if (!empty($this->request->cid) && 'delete' != $this->request->do
|
||||
&& 'sort' != $this->request->do) {
|
||||
$this->db->fetchRow($this->select()
|
||||
->where('table.contents.type = ?', 'page')
|
||||
->where('table.contents.type = ? OR table.contents.type = ?', 'page', 'page_draft')
|
||||
->where('table.contents.cid = ?', $this->request->filter('int')->cid)
|
||||
->limit(1), array($this, 'push'));
|
||||
|
||||
if ('draft' == $this->status && $this->parent) {
|
||||
if ('page_draft' == $this->status && $this->parent) {
|
||||
$this->response->redirect(Typecho_Common::url('write-page.php?cid=' . $this->parent, $this->options->adminUrl));
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
|
||||
{
|
||||
$contents = $this->request->from('text', 'template', 'allowComment',
|
||||
'allowPing', 'allowFeed', 'slug', 'order');
|
||||
$contents['type'] = 'page';
|
||||
|
||||
$contents['title'] = $this->request->get('title', _t('未命名页面'));
|
||||
$contents['created'] = $this->getCreated();
|
||||
$contents = $this->pluginHandle()->write($contents, $this);
|
||||
|
||||
if ($this->request->is('do=publish')) {
|
||||
if ($this->request->is('do=publish')) {
|
||||
/** 重新发布已经存在的文章 */
|
||||
$contents['type'] = 'page';
|
||||
$this->publish($contents);
|
||||
|
||||
/** 发送ping */
|
||||
@@ -85,6 +85,7 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
|
||||
$this->response->redirect(Typecho_Common::url('manage-pages.php?', $this->options->adminUrl));
|
||||
} else {
|
||||
/** 保存文章 */
|
||||
$contents['type'] = 'page_draft';
|
||||
$this->save($contents);
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
@@ -137,8 +138,8 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
|
||||
/** 删除草稿 */
|
||||
$draft = $this->db->fetchRow($this->db->select('cid')
|
||||
->from('table.contents')
|
||||
->where('table.contents.parent = ? AND table.contents.type = ? AND table.contents.status = ?',
|
||||
$page, 'page', 'draft')
|
||||
->where('table.contents.parent = ? AND table.contents.type = ?',
|
||||
$page, 'page_draft')
|
||||
->limit(1));
|
||||
|
||||
if ($draft) {
|
||||
@@ -177,8 +178,8 @@ class Widget_Contents_Page_Edit extends Widget_Contents_Post_Edit implements Wid
|
||||
/** 删除草稿 */
|
||||
$draft = $this->db->fetchRow($this->db->select('cid')
|
||||
->from('table.contents')
|
||||
->where('table.contents.parent = ? AND table.contents.type = ? AND table.contents.status = ?',
|
||||
$page, 'page', 'draft')
|
||||
->where('table.contents.parent = ? AND table.contents.type = ?',
|
||||
$page, 'page_draft')
|
||||
->limit(1));
|
||||
|
||||
if ($draft) {
|
||||
|
||||
@@ -343,15 +343,15 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
|
||||
*/
|
||||
public function filter(array $value)
|
||||
{
|
||||
if ('post' == $value['type']) {
|
||||
if ('post' == $value['type'] || 'page' == $value['type']) {
|
||||
$draft = $this->db->fetchRow($this->widget('Widget_Abstract_Contents')->select()
|
||||
->where('table.contents.parent = ? AND table.contents.type = ? AND table.contents.status = ?',
|
||||
$value['cid'], 'post_draft', $value['status'])
|
||||
->where('table.contents.parent = ? AND table.contents.type = ?',
|
||||
$value['cid'], $value['type'] . '_draft')
|
||||
->limit(1));
|
||||
|
||||
if (!empty($draft)) {
|
||||
$draft['slug'] = ltrim($draft['slug'], '@');
|
||||
$draft['status'] = $value['status'];
|
||||
$draft['type'] = $value['type'];
|
||||
|
||||
$draft = parent::filter($draft);
|
||||
|
||||
@@ -641,8 +641,8 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg
|
||||
/** 删除草稿 */
|
||||
$draft = $this->db->fetchRow($this->db->select('cid')
|
||||
->from('table.contents')
|
||||
->where('table.contents.parent = ? AND table.contents.type = ? AND table.contents.status = ?',
|
||||
$post, 'post', 'draft')
|
||||
->where('table.contents.parent = ? AND table.contents.type = ?',
|
||||
$post, 'post_draft')
|
||||
->limit(1));
|
||||
|
||||
if ($draft) {
|
||||
|
||||
Reference in New Issue
Block a user