Skip to content

Commit

Permalink
v0.4.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Apr 29, 2020
1 parent 65cca0d commit 6f027b3
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 811 deletions.
10 changes: 9 additions & 1 deletion _includes/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ function threadedComments($comments, $options)
</div>
<div class="comment-time"><?php $comments->date('y-m-d'); ?></div>
<?php $comments->content(); ?>
<div class="comment-reply"><?php $comments->reply('<i data-feather="message-square"></i> 回复') ?></div>
<div class="comment-reply">
<?php
if(in_array(get_user_group(), ['administrator', 'editor'])):
Typecho_Widget::widget('Widget_Security')->to($security);
?>
<a href="<?php $security->index('/action/comments-edit?do=delete&coid='.$comments->coid); ?>"><i data-feather="trash"></i> 删除</a>
<?php endif ?>
<?php $comments->reply('<i data-feather="message-square"></i> 回复') ?>
</div>
</div>
<hr />
</div>
Expand Down
11 changes: 6 additions & 5 deletions _includes/nav.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<div class="card card-nav">
<div class="search">
<form>
<div class="input-group">
<div id="site-search" class="input-group" action="<?php $this->options->siteUrl(); echo 'search/'; ?>">
<div class="input-group-prepend">
<div class="input-group-text"><i data-feather="search"></i></div>
</div>
<input type="text" class="form-control" placeholder="搜索">
</div>
</form>
</div>

<div class="profile">
Expand All @@ -23,7 +21,7 @@
<img class="shadow" src="<?php $this->options->avatar(); ?>">
<?php endif ?>
<?php if($this->user->hasLogin()): ?>
<p class="profile-name"><?php echo $this->user->screenName ?></p><p class="profile-title"><?php echo get_user_title($this->user->screenName) ?></p>
<p class="profile-name"><?php echo $this->user->screenName ?></p><p class="profile-title"><?php echo get_user_title() ?></p>
<?php elseif($this->is('post')): ?>
<p class="profile-name"><?php $this->author(); ?></p><p class="profile-title">作者</p>
<?php elseif($this->options->owner): ?>
Expand Down Expand Up @@ -56,7 +54,10 @@
<div data-tab="folder">
<nav class="nav flex-column nav-pills">
<a class="nav-link <?php if(Typecho_Router::getPathInfo() == '/archive/')echo 'active' ?>"
href="/archive/">全部文章</a>
href="<?php
if(Typecho_Router::get('Morecho_archive_page') === NULL) echo '/archive.html/';
else echo '/archive/';
?>">全部文章</a>
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
<?php while($categories->next()): ?>
<a class="nav-link <?php echo $this->is('category', $categories->slug)?'active':''; ?>"
Expand Down
5 changes: 4 additions & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
if($this->is('tag')){
$url = Typecho_Router::getPathInfo();
if(substr($url, -1) == '/')$url = substr($url, 0, strlen($url)-1);
Header("Location: ".$this->options->siteUrl.'archive.html?tag='.trim(strrchr($url, '/'),'/'));
if(Typecho_Router::get('Morecho_archive_page') === NULL)
Header("Location: ".$this->options->siteUrl.'archive.html/?tag='.trim(strrchr($url, '/'),'/'));
else
Header("Location: ".$this->options->siteUrl.'archive/?tag='.trim(strrchr($url, '/'),'/'));
}

$GLOBALS['is_archive'] = true;
Expand Down
25 changes: 12 additions & 13 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,20 @@ function get_last_update(){
}
}

function get_user_title($name){
function get_user_group($name = NULL){
$options = Helper::options();
$db = Typecho_Db::get();
$profile = $db->fetchRow($db->select('group', 'name', 'screenName')->from('table.users')->where('name=? OR screenName=?', $name, $name));
if($name === NULL)
$profile = $db->fetchRow($db->select('group', 'uid')->from('table.users')->where('uid = ?', intval(Typecho_Cookie::get('__typecho_uid'))));
else
$profile = $db->fetchRow($db->select('group', 'name', 'screenName')->from('table.users')->where('name=? OR screenName=?', $name, $name));
if(sizeof($profile) == 0) return isset($options->groupTitleV) ? $options->groupTitleV: '';
switch($profile['group']){
return $profile['group'];
}

function get_user_title($name = NULL){
$options = Helper::options();
switch(get_user_group($name)){
case 'administrator':
return isset($options->groupTitleA) ? $options->groupTitleA: ''; break;
case 'editor':
Expand Down Expand Up @@ -224,15 +232,6 @@ public function render($prevWord = 'PREV', $nextWord = 'NEXT', $splitPage = 3, $
}
}

/**
* 文章页面列表组件
*
* @author qining
* @category typecho
* @package Widget
* @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org)
* @license GNU General Public License 2.0
*/
class Widget_Contents_Post_List extends Widget_Abstract_Contents
{
/**
Expand All @@ -256,4 +255,4 @@ public function execute()

$this->db->fetchAll($select, array($this, 'push'));
}
}
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package Morecho Theme
* @author MuZhou233
* @version 0.4.2.2
* @version 0.4.2.3
* @link https://typecho.mosar.in
*/

Expand Down
10 changes: 10 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ $(function(){
}).blur(function(){
$('.search').removeClass('active');
})
$('#site-search input').bind('keydown',function(event){
if(event.keyCode == "13")
{
window.location.href = $('#site-search').attr('action') + $('#site-search input').val();
}
});
$('#site-search div').click(function(){
if($('#site-search input').val().length !== 0)
window.location.href = $('#site-search').attr('action') + $('#site-search input').val();
})

$('.card-sidebar-control').click(function(){
if($('.sidebar').hasClass('active'))
Expand Down
7 changes: 4 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,17 @@ a.toc-link:hover {
.comment-list .comment-reply-cancel{
opacity: 0;
float: right;
background-color: #007bff;
padding: .125em .25em;
border-radius: .25em;
transition: all .3s ease 0s;
}
.comment-list .comment-reply a,
.comment-list .comment-reply-cancel a{
background-color: #007bff;
border-radius: .25em;
position: relative;
color: #fff;
z-index: 12;
padding: .125em .25em;
margin-right: .25em;
}
.comment-list .comment-body:hover .comment-reply{
opacity: 1;
Expand Down
Loading

0 comments on commit 6f027b3

Please sign in to comment.