某些云笔记出现各种问题,已经不敢用了,现在我使用Typecho搭建了自己的私人笔记,自己管理自己的笔记最放心。用Typecho搭建的笔记,如果不希望泄露笔记内容,有两个简单的解决办法,第一个是将每一篇笔记都设置为私密的,第二个是对整个笔记做http basic认证,只有自己能访问。
Typecho文章默认是按创建时间排序的,如果只是自己访问,将文章改为按更改时间排序管理起来更方便。
1.将前台文章列表改为按修改时间排序
修改var/Widget/Archive.php
的1399行,将$select->order('table.contents.created', Typecho_Db::SORT_DESC)
中的created
改为modified
。
2.将后台的文章管理列表改为按修改时间排序
修改var/Widget/Contents/Post/Admin.php
的176行,将$select->order('table.contents.created', Typecho_Db::SORT_DESC)
中的created
改为modified
。
3.将后台文章列表中文章的时间由创建时间改为修改时间
修改admin/manage-posts.php
的149行
<?php $posts->dateWord(); ?>
改为
<?php $modifyDate = new Typecho_Date($posts->modified); ?>
<?php echo $modifyDate->word(); ?>
4.保存文章后每次都回到列表页的第一页
修改var/Widget/Contents/Post/Edit.php
的761行
$this->response->redirect(Typecho_Common::url('manage-posts.php?' . $pageQuery, $this->options->adminUrl));
改为
$this->response->redirect(Typecho_Common::url('manage-posts.php?page=1', $this->options->adminUrl));
默认主题修改以上4处就可以了,如果使用的其他主题,还要看具体的主题代码,例如handsome主题还要修改模板自带的index.php,将created
改为modified
。
修改前:
$endSelect = $restPostSelect->order('table.contents.created', Typecho_Db::SORT_DESC);
$rest_posts = $db->fetchAll($restPostSelect->order('table.contents.created', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize));
修改后:
$endSelect = $restPostSelect->order('table.contents.modified', Typecho_Db::SORT_DESC);
$rest_posts = $db->fetchAll($restPostSelect->order('table.contents.modified', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize));
handsome主题还要修改index.php的什么代码啊...不太懂
已经加上