Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangpeng96 committed Aug 15, 2022
2 parents 34a64d0 + 17d9dcf commit 71137b7
Show file tree
Hide file tree
Showing 50 changed files with 353 additions and 149 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/Typecho-dev-Ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,3 @@ jobs:
asset_name: typecho.zip
asset_content_type: application/zip
max_releases: 1
- name: Trigger build
run: |
curl -XPOST -H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/typecho/languages/actions/workflows/update.yml/dispatches --data '{"ref": "master"}'
6 changes: 6 additions & 0 deletions .github/workflows/Typecho-release-Ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ jobs:
asset_path: ./typecho.zip
asset_name: typecho.zip
asset_content_type: application/zip
- name: Trigger langs build
run: |
curl -XPOST -H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/typecho/languages/actions/workflows/update.yml/dispatches --data '{"ref": "master"}'
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
*.sublime*
.sass-cache
config.rb
/config.inc.php
/usr/uploads/
/usr/*.db
/usr/plugins/
!/usr/plugins/HelloWorld
/usr/themes/
!/usr/themes/default
prepros.config
config.inc.*
usr/uploads/
usr/*.db
usr/plugins/
!usr/plugins/HelloWorld
usr/themes/*
!usr/themes/default
!usr/themes/classic-22
node_modules/
/tools/tmp/

Expand Down
25 changes: 20 additions & 5 deletions admin/common-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
noticeType : $.cookie(prefix + '__typecho_notice_type'),
highlight : $.cookie(prefix + '__typecho_notice_highlight')
},
path = '<?php echo \Typecho\Cookie::getPath(); ?>';
path = '<?php echo \Typecho\Cookie::getPath(); ?>',
domain = '<?php echo \Typecho\Cookie::getDomain(); ?>',
secure = <?php echo json_encode(\Typecho\Cookie::getSecure()); ?>;

if (!!cookies.notice && 'success|notice|error'.indexOf(cookies.noticeType) >= 0) {
var head = $('.typecho-head-nav'),
Expand Down Expand Up @@ -63,14 +65,13 @@ function checkScroll () {
});
});


$.cookie(prefix + '__typecho_notice', null, {path : path});
$.cookie(prefix + '__typecho_notice_type', null, {path : path});
$.cookie(prefix + '__typecho_notice', null, {path : path, domain: domain, secure: secure});
$.cookie(prefix + '__typecho_notice_type', null, {path : path, domain: domain, secure: secure});
}

if (cookies.highlight) {
$('#' + cookies.highlight).effect('highlight', 1000);
$.cookie(prefix + '__typecho_notice_highlight', null, {path : path});
$.cookie(prefix + '__typecho_notice_highlight', null, {path : path, domain: domain, secure: secure});
}
})();

Expand All @@ -91,6 +92,7 @@ function checkScroll () {

$('#typecho-nav-list ul.root').each(function () {
const ul = $(this), nav = ul.parent();
let focused = false;

ul.on('click touchend', '.parent a', function (e) {
nav.removeClass('noexpanded').addClass('expanded');
Expand All @@ -102,6 +104,19 @@ function checkScroll () {
nav.removeClass('expanded').addClass('noexpanded');
return false;
}));

$('a', ul).focus(function () {
ul.addClass('expanded');
focused = true;
}).blur(function () {
focused = false;

setTimeout(function () {
if (!focused) {
ul.removeClass('expanded');
}
});
});
});

if ($('.typecho-login').length == 0) {
Expand Down
2 changes: 1 addition & 1 deletion admin/copyright.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<a href="http://docs.typecho.org"><?php _e('帮助文档'); ?></a> &bull;
<a href="http://forum.typecho.org"><?php _e('支持论坛'); ?></a> &bull;
<a href="https://github.com/typecho/typecho/issues"><?php _e('报告错误'); ?></a> &bull;
<a href="http://extends.typecho.org"><?php _e('资源下载'); ?></a>
<a href="http://typecho.org/download"><?php _e('资源下载'); ?></a>
</nav>
</div>
6 changes: 3 additions & 3 deletions admin/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
/** Typecho 全局样式 */
html { height: 100%; }

body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; background: #F6F6F3; color: #444; font-size: 87.5%; line-height: 1.5; }
body { font-family: 'Helvetica Neue', Helvetica, Arial, -apple-system, system-ui, sans-serif; background: #F6F6F3; color: #444; font-size: 87.5%; line-height: 1.5; }

a { color: #467B96; text-decoration: none; }

a:hover { color: #499BC3; text-decoration: underline; }

code, pre, .mono { font-family: Menlo, Monaco, Consolas, "Courier New", monospace; }
code, pre, .mono { font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Courier New', -apple-system, system-ui, monospace; }

.p { margin: 1em 0; }

Expand Down Expand Up @@ -172,7 +172,7 @@ select { border: 1px solid #CCC; height: 28px; }

.typecho-head-nav #typecho-nav-list > ul.focus .parent a { font-weight: bold; }

.typecho-head-nav #typecho-nav-list > ul.root:hover .child { display: block; }
.typecho-head-nav #typecho-nav-list > ul.root:hover .child, .typecho-head-nav #typecho-nav-list > ul.root.expanded .child { display: block; }

.typecho-head-nav .operate { float: right; }

Expand Down
1 change: 1 addition & 0 deletions admin/footer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
<?php \Typecho\Plugin::factory('admin/footer.php')->begin(); ?>
</body>
</html>
<?php
Expand Down
4 changes: 2 additions & 2 deletions admin/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if ($user->hasLogin()) {
$response->redirect($options->adminUrl);
}
$rememberName = htmlspecialchars(\Typecho\Cookie::get('__typecho_remember_name'));
$rememberName = htmlspecialchars(\Typecho\Cookie::get('__typecho_remember_name', ''));
\Typecho\Cookie::delete('__typecho_remember_name');

$bodyClass = 'body-100';
Expand All @@ -25,7 +25,7 @@
</p>
<p class="submit">
<button type="submit" class="btn btn-l w-100 primary"><?php _e('登录'); ?></button>
<input type="hidden" name="referer" value="<?php echo htmlspecialchars($request->get('referer')); ?>" />
<input type="hidden" name="referer" value="<?php echo htmlspecialchars($request->get('referer') ?? ''); ?>" />
</p>
<p>
<label for="remember">
Expand Down
2 changes: 1 addition & 1 deletion admin/manage-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
(isset($request->status) ? 'status=' . htmlspecialchars($request->get('status')) : '') .
(isset($request->cid) ? (isset($request->status) ? '&' : '') . 'cid=' . htmlspecialchars($request->get('cid')) : '') : '')); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>" value="<?php echo htmlspecialchars($request->keywords); ?>"<?php if ('' == $request->keywords): ?> onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php endif; ?>/>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>" value="<?php echo htmlspecialchars($request->keywords ?? ''); ?>"<?php if ('' == $request->keywords): ?> onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php endif; ?>/>
<?php if(isset($request->status)): ?>
<input type="hidden" value="<?php echo htmlspecialchars($request->get('status')); ?>" name="status" />
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion admin/manage-medias.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class="i-caret-down"></i></button>
<a href="<?php $options->adminUrl('manage-medias.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>"<?php if ('' == $request->keywords): ?> onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php endif; ?>/>
value="<?php echo htmlspecialchars($request->keywords ?? ''); ?>"<?php if ('' == $request->keywords): ?> onclick="value='';name='keywords';" <?php else: ?> name="keywords"<?php endif; ?>/>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion admin/manage-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class="i-caret-down"></i></button>
<a href="<?php $options->adminUrl('manage-pages.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords"/>
value="<?php echo htmlspecialchars($request->keywords ?? ''); ?>" name="keywords"/>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion admin/manage-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class="i-exlink"></i></a>
<?php endif; ?>
</td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-posts.php?uid=' . $posts->author->uid); ?>"><?php $posts->author(); ?></a>
href="<?php $options->adminUrl('manage-posts.php?__typecho_all_posts=off&uid=' . $posts->author->uid); ?>"><?php $posts->author(); ?></a>
</td>
<td class="kit-hidden-mb"><?php $categories = $posts->categories;
$length = count($categories); ?>
Expand Down
4 changes: 2 additions & 2 deletions admin/manage-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class="i-caret-down"></i></button>
<a href="<?php $options->adminUrl('manage-users.php'); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
<?php endif; ?>
<input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords"/>
value="<?php echo htmlspecialchars($request->keywords ?? ''); ?>" name="keywords"/>
<button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
</div>
</form>
Expand Down Expand Up @@ -64,7 +64,7 @@ class="i-caret-down"></i></button>
<td class="kit-hidden-mb"><input type="checkbox" value="<?php $users->uid(); ?>"
name="uid[]"/></td>
<td class="kit-hidden-mb"><a
href="<?php $options->adminUrl('manage-posts.php?uid=' . $users->uid); ?>"
href="<?php $options->adminUrl('manage-posts.php?__typecho_all_posts=off&uid=' . $users->uid); ?>"
class="balloon-button left size-<?php echo \Typecho\Common::splitByCount($users->postsNum, 1, 10, 20, 50, 100); ?>"><?php $users->postsNum(); ?></a>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion admin/src/scss/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $color-nav-child-focus: #6DA1BB;
font-weight: bold;
}

&.root:hover .child {
&.root:hover .child, &.root.expanded .child {
display: block;
}
}
Expand Down
8 changes: 8 additions & 0 deletions admin/src/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,14 @@ a.operate-reply {
max-width: 100%;
}

@media (max-width: $screen-phone - 1px) {
.comment-edit {
display: flex;
flex-direction: column;
width: 90vw;
}
.comment-edit td:first-child { display: none; }
}

/**
* 评论回复
Expand Down
19 changes: 15 additions & 4 deletions admin/themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ul class="typecho-option-tabs fix-tabs clearfix">
<li class="current"><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('可以使用的外观'); ?></a>
</li>
<?php if (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__): ?>
<?php if (\Widget\Themes\Files::isWriteable()): ?>
<li><a href="<?php $options->adminUrl('theme-editor.php'); ?>"><?php _e('编辑当前外观'); ?></a></li>
<?php endif; ?>
<?php if (\Widget\Themes\Config::isExists()): ?>
Expand All @@ -33,10 +33,21 @@
</thead>

<tbody>
<?php if ($options->missingTheme): ?>
<tr id="theme-<?php $options->missingTheme; ?>" class="current">
<td colspan="2" class="warning">
<p><strong><?php _e('检测到您之前使用的 "%s" 外观文件不存在,您可以重新上传此外观或者启用其他外观。', $options->missingTheme); ?></strong></p>
<ul>
<li><?php _e('重新上传此外观后刷新当前页面,此提示将会消失。'); ?></li>
<li><?php _e('启用新外观后,当前外观的设置数据将被删除。'); ?></li>
</ul>
</td>
</tr>
<?php endif; ?>
<?php \Widget\Themes\Rows::alloc()->to($themes); ?>
<?php while ($themes->next()): ?>
<tr id="theme-<?php $themes->name(); ?>"
class="<?php if ($themes->activated): ?>current<?php endif; ?>">
class="<?php if ($themes->activated && !$options->missingTheme): ?>current<?php endif; ?>">
<td valign="top"><img src="<?php $themes->screen(); ?>"
alt="<?php $themes->name(); ?>"/></td>
<td valign="top">
Expand All @@ -46,9 +57,9 @@ class="<?php if ($themes->activated): ?>current<?php endif; ?>">
<?php if ($themes->version): ?><?php _e('版本'); ?>: <?php $themes->version() ?><?php endif; ?>
</cite>
<p><?php echo nl2br($themes->description); ?></p>
<?php if ($options->theme != $themes->name): ?>
<?php if ($options->theme != $themes->name || $options->missingTheme): ?>
<p>
<?php if (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__): ?>
<?php if (\Widget\Themes\Files::isWriteable()): ?>
<a class="edit"
href="<?php $options->adminUrl('theme-editor.php?theme=' . $themes->name); ?>"><?php _e('编辑'); ?></a> &nbsp;
<?php endif; ?>
Expand Down
4 changes: 2 additions & 2 deletions admin/welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<li><a class="operate-delete" href="<?php $options->adminUrl('profile.php#change-password'); ?>"><?php _e('强烈建议更改你的默认密码'); ?></a></li>
<?php if($user->pass('contributor', true)): ?>
<li><a href="<?php $options->adminUrl('write-post.php'); ?>"><?php _e('撰写第一篇日志'); ?></a></li>
<li><a href="<?php $options->siteUrl(); ?>"><?php _e('查看我的站点'); ?></a></li>
<li><a href="<?php $options->siteUrl(); ?>"><?php $user->pass('administrator', true) ? _e('查看我的站点') : _e('查看网站'); ?></a></li>
<?php else: ?>
<li><a href="<?php $options->siteUrl(); ?>"><?php _e('查看我的站点'); ?></a></li>
<li><a href="<?php $options->siteUrl(); ?>"><?php _e('查看网站'); ?></a></li>
<?php endif; ?>
</ol>
<p><button type="submit" class="btn primary"><?php _e('让我直接开始使用吧 &raquo;'); ?></button></p>
Expand Down
2 changes: 1 addition & 1 deletion admin/write-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function previewData(cid) {

var frame = $('<iframe frameborder="0" class="preview-frame preview-loading"></iframe>')
.attr('src', './preview.php?cid=' + cid)
.attr('sandbox', 'allow-scripts')
.attr('sandbox', 'allow-same-origin allow-scripts')
.appendTo(document.body);

frame.load(function () {
Expand Down
4 changes: 2 additions & 2 deletions admin/write-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class="edit-draft-notice"><?php _e('当前正在编辑的是保存于%s的草稿
if ($page->have()) {
$permalink = str_replace('{cid}', $page->cid, $permalink);
}
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($page->slug) . '" class="mono" />';
$input = '<input type="text" id="slug" name="slug" autocomplete="off" value="' . htmlspecialchars($page->slug ?? '') . '" class="mono" />';
?>
<p class="mono url-slug">
<label for="slug" class="sr-only"><?php _e('网址缩略名'); ?></label>
Expand All @@ -44,7 +44,7 @@ class="edit-draft-notice"><?php _e('当前正在编辑的是保存于%s的草稿
<p>
<label for="text" class="sr-only"><?php _e('页面内容'); ?></label>
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text"
name="text" class="w-100 mono"><?php echo htmlspecialchars($page->text); ?></textarea>
name="text" class="w-100 mono"><?php echo htmlspecialchars($page->text ?? ''); ?></textarea>
</p>

<?php include 'custom-fields.php'; ?>
Expand Down
Loading

0 comments on commit 71137b7

Please sign in to comment.