Browse Source

bug fix for cache data not rootDir

master
filesite 5 months ago
parent
commit
10338abb65
  1. 5
      lib/DirScanner.php
  2. 2
      plugins/Common.php
  3. 1
      themes/beauty/controller/ListController.php
  4. 1
      themes/beauty/controller/SiteController.php
  5. 6
      themes/beauty/views/site/index.php
  6. 1
      themes/tajian/controller/ListController.php
  7. 2
      themes/tajian/controller/SiteController.php
  8. 4
      www/img/beauty/refresh.svg
  9. 2
      www/js/beauty.js

5
lib/DirScanner.php

@ -535,6 +535,11 @@ Class DirScanner {
return $this->webRoot; return $this->webRoot;
} }
//设置扫描绝对根目录
public function setRootDir($dir) {
$this->rootDir = realpath($dir);
}
//获取是否开启防盗链 //获取是否开启防盗链
public function isSecureOn() { public function isSecureOn() {
return $this->nginxSecureOn; return $this->nginxSecureOn;

2
plugins/Common.php

@ -535,7 +535,7 @@ Class Common {
"ctime" => time(), "ctime" => time(),
"data" => $data, "data" => $data,
); );
$jsonData = json_encode($cacheData); $jsonData = json_encode($cacheData, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$cacheDir = __DIR__ . '/../runtime/cache/'; $cacheDir = __DIR__ . '/../runtime/cache/';
if (!is_dir($cacheDir)) { if (!is_dir($cacheDir)) {

1
themes/beauty/controller/ListController.php

@ -17,6 +17,7 @@ Class ListController extends Controller {
$scanner = new DirScanner(); $scanner = new DirScanner();
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
$scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$prefix = FSC::$app['config']['theme']; $prefix = FSC::$app['config']['theme'];

1
themes/beauty/controller/SiteController.php

@ -17,6 +17,7 @@ Class SiteController extends Controller {
$scanner = new DirScanner(); $scanner = new DirScanner();
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
$scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$prefix = FSC::$app['config']['theme']; $prefix = FSC::$app['config']['theme'];

6
themes/beauty/views/site/index.php

@ -4,8 +4,9 @@
<!-- Brand and toggle get grouped for better mobile display navbar-inverse--> <!-- Brand and toggle get grouped for better mobile display navbar-inverse-->
<div class="navbar-header"> <div class="navbar-header">
<div class="navbar-toggle"> <div class="navbar-toggle">
<img class="svg icon1 svgimg verMiddle cleanCacheJS" src="/img/beauty/refresh.svg" alt="清空缓存数据" title="刷新缓存数据" style="width:24px">
<img class="svg icon1 svgimg lampJS verMiddle" src="/img/beauty/buld.svg" alt="点击关灯/开灯" title="点击关灯/开灯"> <img class="svg icon1 svgimg lampJS verMiddle" src="/img/beauty/buld.svg" alt="点击关灯/开灯" title="点击关灯/开灯">
<img class="icon1 svg connectmeJS svgimg iconr2 verMiddle" src="/img/beauty/contactUs.svg" alt="联系我们" title="联系我们" /> <img class="icon1 svg connectmeJS svgimg verMiddle" src="/img/beauty/contactUs.svg" alt="联系我们" title="联系我们" />
<button type="button" class="collapsed mr_button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <button type="button" class="collapsed mr_button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
<img class="svg icon1 svgimg verMiddle" src="/img/beauty/navshow.svg" alt="展开列表" title="展开列表"> <img class="svg icon1 svgimg verMiddle" src="/img/beauty/navshow.svg" alt="展开列表" title="展开列表">
@ -42,7 +43,8 @@ eof;
</form> </form>
*/ ?> */ ?>
<div class="nb_right nav navbar-nav navbar-right hidden-xs"> <div class="nb_right nav navbar-nav navbar-right hidden-xs">
<img class="svg icon1 svgimg lampJS verMiddle" src="/img/beauty/buld.svg" alt="点击关灯/开灯" title="点击关灯/开灯"> <img class="svg icon1 svgimg verMiddle cleanCacheJS" src="/img/beauty/refresh.svg" alt="清空缓存数据" title="刷新缓存数据" style="width:24px">
<img class="svg icon1 svgimg iconr2 lampJS verMiddle" src="/img/beauty/buld.svg" alt="点击关灯/开灯" title="点击关灯/开灯">
<img class="icon1 svg connectmeJS svgimg iconr2 verMiddle" src="/img/beauty/contactUs.svg" alt="联系我们" title="联系我们" /> <img class="icon1 svg connectmeJS svgimg iconr2 verMiddle" src="/img/beauty/contactUs.svg" alt="联系我们" title="联系我们" />
</div> </div>
</div><!-- /.navbar-collapse --> </div><!-- /.navbar-collapse -->

1
themes/tajian/controller/ListController.php

@ -17,6 +17,7 @@ Class ListController extends SiteController {
$scanner = new DirScanner(); $scanner = new DirScanner();
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
$scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$prefix = FSC::$app['user_id']; $prefix = FSC::$app['user_id'];

2
themes/tajian/controller/SiteController.php

@ -38,6 +38,7 @@ Class SiteController extends Controller {
$scanner = new DirScanner(); $scanner = new DirScanner();
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
$scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$prefix = FSC::$app['user_id']; $prefix = FSC::$app['user_id'];
@ -368,6 +369,7 @@ Class SiteController extends Controller {
$scanner = new DirScanner(); $scanner = new DirScanner();
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
$scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$prefix = FSC::$app['user_id']; $prefix = FSC::$app['user_id'];

4
www/img/beauty/refresh.svg

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
<g fill="#857e7e" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(8.53333,8.53333)"><path d="M15,3c-2.9686,0 -5.69718,1.08344 -7.79297,2.875c-0.28605,0.22772 -0.42503,0.59339 -0.36245,0.95363c0.06258,0.36023 0.31676,0.6576 0.66286,0.77549c0.3461,0.1179 0.72895,0.03753 0.99842,-0.20959c1.74821,-1.49444 4.01074,-2.39453 6.49414,-2.39453c5.19656,0 9.45099,3.93793 9.95117,9h-2.95117l4,6l4,-6h-3.05078c-0.51129,-6.14834 -5.67138,-11 -11.94922,-11zM4,10l-4,6h3.05078c0.51129,6.14834 5.67138,11 11.94922,11c2.9686,0 5.69718,-1.08344 7.79297,-2.875c0.28605,-0.22772 0.42504,-0.59339 0.36245,-0.95363c-0.06258,-0.36023 -0.31676,-0.6576 -0.66286,-0.7755c-0.3461,-0.1179 -0.72895,-0.03753 -0.99842,0.20959c-1.74821,1.49444 -4.01074,2.39453 -6.49414,2.39453c-5.19656,0 -9.45099,-3.93793 -9.95117,-9h2.95117z"></path></g></g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

2
www/js/beauty.js

@ -104,7 +104,7 @@ if ($('#image_site').get(0)) {
toggleLampshow(lanpnum); toggleLampshow(lanpnum);
} }
$('#image_site .lampJS').click(function () { $('#image_site .lampJS').click(function () {
lanpnum = !lanpnum ? 1 : 0; lanpnum = !lanpnum || lanpnum != 1 ? 1 : 0;
toggleLampshow(lanpnum); toggleLampshow(lanpnum);
saveLanpnumToLocalstorage(lanpnum); saveLanpnumToLocalstorage(lanpnum);
}); });

Loading…
Cancel
Save