lylme_spage/admin/set.php

164 lines
10 KiB
PHP
Raw Normal View History

2022-02-19 23:38:30 +08:00
<?php
2022-02-23 21:15:07 +08:00
$title = '网站设置';
2022-02-19 23:38:30 +08:00
include './head.php';
2022-03-26 16:00:22 +08:00
function uploadimg($arr,$uppath,$uptype) {
if((($arr["type"]=="image/jpeg") ||($arr["type"]=="image/jpg") ||($arr["type"]=="image/png")) && $arr["size"] < 10485760 ) {
copy($arr["tmp_name"],ROOT.$uppath);
saveSetting($uptype,'/'.$uppath);
} else if ($arr["size"]==0) {
} else {
echo '<script>alert("上传的图片大小超过10MB或类型不符");history.go(-1);</script>';
}
2022-02-22 03:02:24 +08:00
}
2022-02-19 23:38:30 +08:00
$set=isset($_GET['set'])?$_GET['set']:null;
2022-03-26 16:00:22 +08:00
if($set=='save') {
2022-02-19 23:38:30 +08:00
$title=$_POST['title'];
$logo=$_POST['logo'];
$background=$_POST['background'];
2022-05-02 22:07:01 +08:00
$wapbackground=$_POST['wapbackground'];
2022-02-19 23:38:30 +08:00
$keywords=$_POST['keywords'];
$description=$_POST['description'];
$copyright=$_POST['copyright'];
$icp=$_POST['icp'];
2022-03-26 16:00:22 +08:00
$yan=$_POST['yan'];
$tq=$_POST['tq'];
$wztj=$_POST['wztj'];
$cdnpublic=$_POST['cdnpublic'];
$home_title= $_POST['home-title'];
if($yan=='true') {
saveSetting('yan','true');
} else {
saveSetting('yan','false');
}
if($tq=='true') {
saveSetting('tq','true');
} else {
saveSetting('tq','false');
}
2022-02-19 23:38:30 +08:00
saveSetting('title',$title);
saveSetting('logo',$logo);
saveSetting('background',$background);
2022-05-02 22:07:01 +08:00
saveSetting('wap_background',$wapbackground);
2022-02-19 23:38:30 +08:00
saveSetting('keywords',$keywords);
saveSetting('description',$description);
saveSetting('copyright',$copyright);
saveSetting('icp',$icp);
2022-02-23 19:46:44 +08:00
saveSetting('wztj',$wztj);
2022-03-26 16:00:22 +08:00
saveSetting('cdnpublic',$cdnpublic);
2022-02-23 21:15:07 +08:00
saveSetting('home-title',$home_title);
2022-02-22 03:02:24 +08:00
uploadimg($_FILES["logoimg"],'assets/img/logo.png','logo');
2022-05-02 22:07:01 +08:00
uploadimg($_FILES["wapbackgroundimg"],'assets/img/wapbackground.jpg','wap_background');
2022-03-26 16:00:22 +08:00
uploadimg($_FILES["backgroundimg"],'assets/img/background.jpg','background');
2022-03-12 16:52:26 +08:00
echo '<script>alert("修改成功!");window.location.href="./set.php";</script>';
2022-03-26 16:00:22 +08:00
} else {
?>
2022-04-04 11:30:07 +08:00
<script>
function updatetext(check) {
2022-03-26 16:00:22 +08:00
document.getElementById(check).innerHTML="重新选择";
}
</script>
2022-04-04 11:30:07 +08:00
<!--页面主要内容-->
<main class="lyear-layout-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="tab-content">
<div class="tab-pane active">
<form action="set.php?set=save" method="post" name="edit-form" class="edit-form" enctype="multipart/form-data">
<div class="form-group">
<label for="web_site_title">网站标题</label>
<input class="form-control" type="text" id="web_site_title" name="title" value="<?php echo $conf['title']?>" placeholder="请输入站点标题" required >
</div>
<div class="form-group">
<label for="web_site_logo">网站LOGO</label>
<div class="input-group">
<input type="text" class="form-control" name="logo" id="web_site_logo" value="<?php echo $conf['logo']?>" />
<div class="input-group-btn">
<label class="btn btn-default" for="logoimg" id="checklogo" type="button">选择图片</label >
<input type="file" style="display:none" accept=".png,.jpeg,.jpg" id="logoimg" name="logoimg" onclick = "updatetext('checklogo');"/>
</div>
</div>
<small class="help-block">填写图片的URL默认值<code>./assets/img/logo.png</code><code><?php echo siteurl()?>/assets/img/logo.png</code>或从<code>本地上传</code></small>
</div>
<div class="form-group">
<label for="web_site_background">网站背景</label>
<div class="input-group">
<input type="text" class="form-control" name="background" accept="image/png,image/jpeg" id="web_site_background" value="<?php echo $conf['background']?>" />
<div class="input-group-btn">
<label class="btn btn-default" id="checkbackground" for="backgroundimg" type="button">选择图片</label >
<input type="file" style="display:none" accept="image/png,image/jpeg" id="backgroundimg" name="backgroundimg" onclick = "updatetext('checkbackground');"/>
</div></div>
2022-05-20 23:35:18 +08:00
<small class="help-block">填写图片的URL<code>./assets/img/background.jpg</code><code><?php echo siteurl()?>/assets/img/background.jpg</code>或从<code>本地上传</code><br>设置Bing每日壁纸<a href="https://doc.lylme.com/spage/#/%E8%83%8C%E6%99%AF%E8%AE%BE%E7%BD%AE" target="_blank">查看教程</a><br>注:修改后需要清除浏览器缓存才会改变</small>
2022-04-04 11:30:07 +08:00
</div>
2022-05-02 22:07:01 +08:00
<div class="form-group">
<label for="wap_site_background">手机端背景图片</label>
<div class="input-group">
<input type="text" class="form-control" name="wapbackground" accept="image/png,image/jpeg" id="wap_site_background" value="<?php echo $conf['wap_background']?>" />
<div class="input-group-btn">
<label class="btn btn-default" id="checkwapbackground" for="wapbackgroundimg" type="button">选择图片</label >
<input type="file" style="display:none" accept="image/png,image/jpeg" id="wapbackgroundimg" name="wapbackgroundimg" onclick = "updatetext('checkwapbackground');"/>
</div></div>
2022-05-20 23:35:18 +08:00
<small class="help-block">手机端独立背景留空则使用PC端壁纸<br>:修改后需要清除浏览器缓存才会改变</small>
2022-05-02 22:07:01 +08:00
</div>
2022-04-04 11:30:07 +08:00
<div class="form-group">
<label for="web_site_keywords">站点关键词</label>
<input class="form-control" type="text" id="web_site_keywords" name="keywords" value="<?php echo $conf['keywords']?>" placeholder="请输入站点关键词" >
<small class="help-block">网站搜索引擎关键字</small>
</div>
<div class="form-group">
<label for="web_site_description">站点描述</label>
<textarea class="form-control" id="web_site_description" rows="5" name="description" placeholder="请输入站点描述" ><?php echo $conf['description']?></textarea>
<small class="help-block">网站描述,有利于搜索引擎抓取相关信息</small>
</div>
2022-02-23 19:46:44 +08:00
<div class="form-group">
<label for="web_site_home-title">首页提示语</label>
<textarea type="text" class="form-control" name="home-title" placeholder="请输入首页提示语支持HTML代码"><?php echo $conf['home-title']?></textarea>
2022-05-03 10:37:33 +08:00
<small class="help-block">首页提示语, 仅适用于部分主题<code>支持HTML代码</code></small>
2022-02-23 19:46:44 +08:00
</div>
2022-02-19 23:38:30 +08:00
<div class="form-group">
2022-05-02 22:07:01 +08:00
<label for="web_site_copyright">版权信息</label>
2022-05-03 10:37:33 +08:00
<textarea width="200px" type="text" rows="5" class="form-control" name="copyright" placeholder="请输入版权信息支持HTML代码"><?php echo $conf['copyright']?></textarea>
2022-02-23 19:46:44 +08:00
<small class="help-block">显示在首页底部的版权提示,<code>支持HTML代码</code></small>
2022-02-19 23:38:30 +08:00
</div>
2022-02-23 19:46:44 +08:00
<div class="form-group">
2022-05-02 22:07:01 +08:00
<label for="web_site_wztj">自定义footer</label>
2022-05-03 10:37:33 +08:00
<textarea type="text" rows="5" class="form-control" name="wztj" placeholder="可填写网站统计、引用JS文件等"><?php echo $conf['wztj']?></textarea>
2022-05-20 23:35:18 +08:00
<small class="help-block">站点底部自定义可填写网站统计、JS代码(需要script标签)、CSS代码(需要style标签)<code>支持HTML代码</code> <a href="https://doc.lylme.com/spage/#/footer" target="_blank">查看教程</a></small>
2022-02-23 19:46:44 +08:00
</div>
2022-02-19 23:38:30 +08:00
<div class="form-group">
2022-02-22 03:02:24 +08:00
<label for="web_site_icp">备案号</label>
<input class="form-control" type="text" id="web_site_icp" name="icp" value="<?php echo $conf['icp']?>" placeholder="请输入备案号,留空首页不显示备案信息" >
2022-02-19 23:38:30 +08:00
</div>
2022-04-04 11:30:07 +08:00
<div class="form-group">
<label class="btn-block" for="web_yan_status">随机一言开关</label>
<label class="lyear-switch switch-solid switch-cyan">
2022-05-02 22:07:01 +08:00
<input type="checkbox" <?php if($conf['yan']!='false')echo 'checked="checked"';?> name="yan" value="true">
2022-04-04 11:30:07 +08:00
<span></span>
</label>
2022-05-03 10:37:33 +08:00
<small class="help-block">显示在首页的随机一言,自定义一言文件路径,一行一条<code>/assets/date/date.dat</code> </small>
2022-04-04 11:30:07 +08:00
</div>
<div class="form-group">
<label class="btn-block" for="web_tq_status">天气显示开关</label>
<label class="lyear-switch switch-solid switch-primary">
2022-05-02 22:07:01 +08:00
<input type="checkbox" <?php if($conf['tq']!='false')echo 'checked="checked"';?> name="tq" value="true">
2022-04-04 11:30:07 +08:00
<span></span>
</label>
2022-05-03 10:37:33 +08:00
<small class="help-block">和风天气插件,若不能使用请申请自己的密钥填入,<a href="https://doc.lylme.com/spage/#/%E5%A4%A9%E6%B0%94" target="_blank">查看教程</a><br><code>baisu模板关闭后同时关闭时间显示</code> </small>
2022-04-04 11:30:07 +08:00
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary m-r-5"> </button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!--End 页面主要内容-->
<?php
2022-02-22 03:02:24 +08:00
}
include './footer.php';
2022-02-19 23:38:30 +08:00
?>