summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2020-04-11 17:12:09 +0800
committerBigCoke233 <hi@guhub.cn>2020-04-11 17:12:09 +0800
commit6bd243b6f91b2223617a3bc5f2f578336ca37c70 (patch)
treea746ad5e8792a1b280bb09a34c6b842ea1d64b6e
parentcc6d146981eab5fd389308b9e621503f4719f3df (diff)
:apple: Fix: 修复无法备份,优化后台样式
-rw-r--r--archive.php4
-rw-r--r--assets/css/setting.miracles.css75
-rw-r--r--includes/head.php2
-rw-r--r--index.php2
-rwxr-xr-xlibs/Options.php125
5 files changed, 123 insertions, 85 deletions
diff --git a/archive.php b/archive.php
index 4287178..4c0d797 100644
--- a/archive.php
+++ b/archive.php
@@ -9,7 +9,7 @@ $this->need('includes/header.php');
<p style="text-align:center">居然没有找到相关内容</p>
<?php endif; ?>
<?php while($this->next()): ?>
- <div class="post-item ">
+ <div class="post-item">
<div class="container-fluid"><div class="row">
<div class="col-md-6 post-banner-box">
<a href="<?php $this->permalink(); ?>" class="post-link">
@@ -35,7 +35,7 @@ $this->need('includes/header.php');
</div>
</div></div>
</div>
- <br />
+ <br />
<?php endwhile; ?>
<div class="post-pagenav">
<span class="post-pagenav-left"><?php $this->pageLink('<i class="iconfont icon-chevron-left"></i>'); ?></span>
diff --git a/assets/css/setting.miracles.css b/assets/css/setting.miracles.css
index e2bf856..e89430d 100644
--- a/assets/css/setting.miracles.css
+++ b/assets/css/setting.miracles.css
@@ -55,24 +55,47 @@ hr {
transform-origin: bottom left;
}
-.miracles-backup-alert {
- position: fixed;
- top: 0;
- right: 0;
- left: 0;
- padding: 15px 0;
- background: #4d90fe;
+.tongzhi {
+ bottom: 0;
+ left: 50%;
+ transform: translate(-50%, 0px);
+ z-index: 10;
+ padding: 1em;
+ position: fixed;
+ color: #fff;
+ background: rgba(50,50,50,.95);
+ border-radius: 2px;
+ margin: 0 auto 1em auto;
+ box-shadow: 0 2px 6px gray;
+ transition: .2s;
+ -webkit-animation: slideDown 0.2s ease forwards;
+ animation: slideDown 0.3s ease forwards;
+ max-width: 520px;
text-align: center;
- transition: all .2s;
+ font-size: 1.06em
}
-.miracles-backup-alert,.miracles-backup-alert a {
- color: #fff;
+@-webkit-keyframes slideDown {
+ 0%{
+ bottom: -100px;
+ }
+ 25%{
+ bottom: -50px;
+ }
+ 50%{
+ bottom: 0;
+ }
+ 100%{
+ bottom: 50px;
+ }
}
-.miracles-backup-button {
+.miracles-backup-div {
margin: 15px 0;
- margin-bottom: 0;
+ margin-bottom: 0
+}
+
+.miracles-backup-button {
padding: 6px 10px;
border: none;
border-radius: 2px;
@@ -81,8 +104,7 @@ hr {
-moz-box-shadow: 0 1px 1px #000;
box-shadow: 0 1px 1px #000;
color: #fff;
-}[action="?MiraclesBackup"] {
- margin-top: -10px;
+ cursor: pointer;
}
.miracles-para-attention {
@@ -92,14 +114,6 @@ hr {
color: #fff;
}
-iframe.miracles-news {
- margin: 0 -8px;
- margin-top: -5px;
- width: 100%;
- height: 60px;
- border: none;
-}
-
::-webkit-scrollbar {
width: 6px;
height: 5px;
@@ -160,17 +174,14 @@ iframe.miracles-news {
}
.typecho-option .btn {
- width: 100%;
- display: block;
- height: 50px;
- background: #000;
- text-align: center;
- font-size: 18px;
position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- border-radius: 0;
+ bottom: 15px;
+ right: 15px;
+ border-radius: 4px;
+ background: #000;
+ box-shadow: 0 0 6px #bababa;
+ padding: 8px 14px;
+ font-size: 1.1em
}
.wmd-button-row {
diff --git a/includes/head.php b/includes/head.php
index 1bf7ecd..7d65937 100644
--- a/includes/head.php
+++ b/includes/head.php
@@ -48,7 +48,7 @@
generate_require($css_files,"css",$this->options->CDN?"https://cdn.jsdelivr.net/gh/BigCoke233/miracles@":"");
?>
<!-- icon font -->
- <link rel="stylesheet" href="//at.alicdn.com/t/font_1165190_ky62cv8oj6i.css" />
+ <link rel="stylesheet" href="//at.alicdn.com/t/font_1165190_1djdjjwge4m.css" />
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:300|Noto+Serif+SC&display=swap" rel="stylesheet">
<style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat}<?php $this->options->cssEcho(); ?></style>
diff --git a/index.php b/index.php
index c2de313..dd4309c 100644
--- a/index.php
+++ b/index.php
@@ -53,7 +53,7 @@ $this->need('includes/header.php');
</div>
</div></div>
</div>
- <br />
+ <br />
<?php endwhile; ?>
<!-- 文章分页 -->
<div class="post-pagenav">
diff --git a/libs/Options.php b/libs/Options.php
index b74fb86..13ec8ea 100755
--- a/libs/Options.php
+++ b/libs/Options.php
@@ -8,51 +8,41 @@ function themeConfig($form) {
* 主题设置备份
* From https://qqdie.com/archives/typecho-templates-backup-and-restore.html
*/
+ $str1 = explode('/themes/', Helper::options()->themeUrl);
+ $str2 = explode('/', $str1[1]);
+ $name=$str2[0];
$db = Typecho_Db::get();
- $sjdq=$db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:Miracles'));
- $ysj = $sjdq['value'];
- if(isset($_POST['type'])){
- if($_POST["type"]=="备份设置"){
- if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:MiraclesBackup'))){
- $update = $db->update('table.options')->rows(array('value'=>$ysj))->where('name = ?', 'theme:MiraclesBackup');
- $updateRows= $db->query($update);
- echo '<div class="miracles-backup-alert">备份已更新,即将自动刷新。如过您的浏览器没有自动跳转请点击';?><a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div><script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 2500);</script>
-<?php }else{
- if($ysj){
- $insert = $db->insert('table.options')
- ->rows(array('name' => 'theme:MiraclesBackup','user' => '0','value' => $ysj));
- $insertId = $db->query($insert);
- echo '<div class="miracles-backup-alert">备份完成,即将自动刷新。如过您的浏览器没有自动跳转请点击';
-?><a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div><script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 2500);</script>
-<?php
- }
+ $sjdq=$db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name));
+ $ysj = $sjdq['value'];
+ if(isset($_POST['type'])){
+ if($_POST["type"]=="备份模板设置数据"){
+ if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
+ $update = $db->update('table.options')->rows(array('value'=>$ysj))->where('name = ?', 'theme:'.$name.'bf');
+ $updateRows= $db->query($update);
+ }else{
+ if($ysj){
+ $insert = $db->insert('table.options')
+ ->rows(array('name' => 'theme:'.$name.'bf','user' => '0','value' => $ysj));
+ $insertId = $db->query($insert);
+ }
+ }
}
- }
- if($_POST["type"]=="还原设置"){
- if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:MiraclesBackup'))){
- $sjdub=$db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:MiraclesBackup'));
- $bsj = $sjdub['value'];
- $update = $db->update('table.options')->rows(array('value'=>$bsj))->where('name = ?', 'theme:Miracles');
- $updateRows= $db->query($update);
- echo '<div class="miracles-backup-alert">检测到模板备份数据,恢复完成,即将自动刷新。如过您的浏览器没有自动跳转请点击';
-?><a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div><script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 2000);</script>
-<?php
- }else{
- echo '<div class="miracles-backup-alert">没有模板备份数据,恢复不了哦!</div>';
+ if($_POST["type"]=="还原模板设置数据"){
+ if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
+ $sjdub=$db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'));
+ $bsj = $sjdub['value'];
+ $update = $db->update('table.options')->rows(array('value'=>$bsj))->where('name = ?', 'theme:'.$name);
+ $updateRows= $db->query($update);
+ }
}
+ if($_POST["type"]=="删除备份数据"){
+ if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
+ $delete = $db->delete('table.options')->where ('name = ?', 'theme:'.$name.'bf');
+ $deletedRows = $db->query($delete);
+ }
}
- if($_POST["type"]=="删除设置备份"){
- if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:MiraclesBackup'))){
- $delete = $db->delete('table.options')->where ('name = ?', 'theme:MiraclesBackup');
- $deletedRows = $db->query($delete);
- echo '<div class="miracles-backup-alert">删除成功,请等待自动刷新,如果等不到请点击';
-?><a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div><script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 2500);</script>
-<?php
- }else{
- echo '<div class="miracles-backup-alert">备份不存在!</div>';
- }
- }
-}
+ }
+
/**
* 设置样式+面板
@@ -66,14 +56,51 @@ function themeConfig($form) {
<p>欢迎使用 Miracles 主题,目前版本是:'. $ver .'<br>
作者博客:<a href="https://guhub.cn">Eltrac\'s</a> |
帮助文档:<a href="https://www.notion.so/thememiracles/c7c631e21b3345caa2a09bd2fb5dd4b2">WIKI</a> |
- 问题反馈:<a href="https://github.com/BigCoke233/miracles/issues">issues</a>
- </p>
- <form class="protected" action="?MiraclesBackup" method="post">
- <input type="submit" name="type" class="miracles-backup-button backup" value="备份设置" />&nbsp;&nbsp;
- <input type="submit" name="type" class="miracles-backup-button recover" value="还原设置" />&nbsp;&nbsp;
- <input type="submit" name="type" class="miracles-backup-button delete" value="删除设置备份" />
- </form>
- </div>';
+ 问题反馈:<a href="https://github.com/BigCoke233/miracles/issues">issues</a></p>
+ <form class="protected miracles-backup-div" action="?'.$name.'bf" method="post">
+ <input type="submit" name="type" class="miracles-backup-button" value="备份模板设置数据" />&nbsp;&nbsp;
+ <input type="submit" name="type" class="miracles-backup-button" value="还原模板设置数据" />&nbsp;&nbsp;
+ <input type="submit" name="type" class="miracles-backup-button" value="删除备份数据" />
+ </form>';
+ //备份数据提示
+ if($_POST["type"]=="备份模板设置数据"){
+ if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
+ echo '<div class="tongzhi col-mb-12 home">备份已更新,请等待自动刷新!如果等不到请点击';
+ ?><a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
+<script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 1500);</script><?php
+ }else{
+ echo '<div class="tongzhi col-mb-12 home">备份完成,请等待自动刷新!如果等不到请点击';
+?> <a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
+<script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 1500);</script><?php
+ }
+ }
+ //还原数据提示
+ if($_POST["type"]=="还原模板设置数据"){
+ if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
+ echo '<div class="tongzhi col-mb-12 home">检测到模板备份数据,恢复完成,请等待自动刷新!如果等不到请点击';
+ ?> <a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
+<script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 1500);</script>
+<?php
+ }else{
+ echo '<div class="tongzhi col-mb-12 home">没有模板备份数据,恢复不了哦!</div>';
+ }
+ }
+ //删除数据提示
+ if($_POST["type"]=="删除备份数据"){
+ if($db->fetchRow($db->select()->from ('table.options')->where ('name = ?', 'theme:'.$name.'bf'))){
+ echo '<div class="tongzhi col-mb-12 home">删除成功,请等待自动刷新,如果等不到请点击';
+?>
+<a href="<?php Helper::options()->adminUrl('options-theme.php'); ?>">这里</a></div>
+<script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 1500);</script>
+<?php
+ }else{
+ echo '<div class="tongzhi col-mb-12 home">备份已经被删除了</div>';
+ ?><script language="JavaScript">window.setTimeout("location=\'<?php Helper::options()->adminUrl('options-theme.php'); ?>\'", 1500);</script><?php
+ }
+ }
+
+ echo '<br></div>';
+
/**
* 设置项