mirror of
https://github.com/typecho/typecho.git
synced 2025-03-20 01:49:40 +01:00
修正一堆bug
This commit is contained in:
parent
4eb811e95e
commit
f8340044ae
@ -71,7 +71,7 @@ $stat = Typecho_Widget::widget('Widget_Stat');
|
||||
<td>
|
||||
<a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>"><?php $posts->title(); ?></a>
|
||||
<?php
|
||||
if ($posts->hasSaved() || 'post_draft' == $posts->type) {
|
||||
if ($posts->hasSaved || 'post_draft' == $posts->type) {
|
||||
echo '<em>(' . _t('草稿') . ')</em>';
|
||||
} else if ('waiting' == $posts->status) {
|
||||
echo '<em>(' . _t('待审核') . ')</em>';
|
||||
|
@ -128,6 +128,7 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page);
|
||||
<?php
|
||||
include 'copyright.php';
|
||||
include 'common-js.php';
|
||||
include 'form-js.php';
|
||||
include 'write-js.php';
|
||||
include 'file-upload-js.php';
|
||||
|
||||
|
@ -58,7 +58,7 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
|
||||
<div class="col-mb-12 col-tb-3">
|
||||
<section class="typecho-post-option">
|
||||
<label for="date" class="typecho-label"><?php _e('发布日期'); ?></label>
|
||||
<p><input class="typecho-date w-100" type="text" name="date" id="date" value="<?php $post->date(); ?>" /></p>
|
||||
<p><input class="typecho-date w-100" type="text" name="date" id="date" value="<?php $post->have() ? $post->date('Y-m-d H:i') : ''; ?>" /></p>
|
||||
</section>
|
||||
|
||||
<section class="typecho-post-option category-option">
|
||||
@ -144,6 +144,7 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
|
||||
<?php
|
||||
include 'copyright.php';
|
||||
include 'common-js.php';
|
||||
include 'form-js.php';
|
||||
include 'write-js.php';
|
||||
include 'file-upload-js.php';
|
||||
|
||||
|
@ -345,10 +345,10 @@ class Widget_Abstract_Contents extends Widget_Abstract
|
||||
$result = $slug;
|
||||
|
||||
/** 对草稿的slug做特殊处理 */
|
||||
$draft = $this->db->fetchObject($this->db->select('status', 'parent')
|
||||
$draft = $this->db->fetchObject($this->db->select('type', 'parent')
|
||||
->from('table.contents')->where('cid = ?', $cid));
|
||||
|
||||
if ('draft' == $draft->status && $draft->parent) {
|
||||
if ('_draft' == substr($draft->type, -6) && $draft->parent) {
|
||||
$result = '@' . $result;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user