正在显示
4 个修改的文件
包含
23 行增加
和
10 行删除
@@ -363,11 +363,24 @@ if (!function_exists('hsv2rgb')) { | @@ -363,11 +363,24 @@ if (!function_exists('hsv2rgb')) { | ||
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | -if (!function_exists('cors_request_check')) { | 366 | +if (!function_exists('check_nav_active')) { |
367 | /** | 367 | /** |
368 | * 跨域检测 | 368 | * 跨域检测 |
369 | */ | 369 | */ |
370 | - function cors_request_check() | 370 | + function check_nav_active($url, $classname = 'active') |
371 | + { | ||
372 | + $auth = \app\common\library\Auth::instance(); | ||
373 | + $requestUrl = $auth->getRequestUri(); | ||
374 | + $url = ltrim($url, '/'); | ||
375 | + return $requestUrl === str_replace(".", "/", $url) ? $classname : ''; | ||
376 | + } | ||
377 | +} | ||
378 | + | ||
379 | +if (!function_exists('check_cors_request')) { | ||
380 | + /** | ||
381 | + * 跨域检测 | ||
382 | + */ | ||
383 | + function check_cors_request() | ||
371 | { | 384 | { |
372 | if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN']) { | 385 | if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN']) { |
373 | $info = parse_url($_SERVER['HTTP_ORIGIN']); | 386 | $info = parse_url($_SERVER['HTTP_ORIGIN']); |
@@ -92,7 +92,7 @@ class Api | @@ -92,7 +92,7 @@ class Api | ||
92 | protected function _initialize() | 92 | protected function _initialize() |
93 | { | 93 | { |
94 | //跨域请求检测 | 94 | //跨域请求检测 |
95 | - cors_request_check(); | 95 | + check_cors_request(); |
96 | 96 | ||
97 | //移除HTML标签 | 97 | //移除HTML标签 |
98 | $this->request->filter('trim,strip_tags,htmlspecialchars'); | 98 | $this->request->filter('trim,strip_tags,htmlspecialchars'); |
1 | <?php | 1 | <?php |
2 | $cdnurl = function_exists('config') ? config('view_replace_str.__CDN__') : ''; | 2 | $cdnurl = function_exists('config') ? config('view_replace_str.__CDN__') : ''; |
3 | -$publicurl = function_exists('config') ? config('view_replace_str.__PUBLIC__') : '/'; | 3 | +$publicurl = function_exists('config') ? (config('view_replace_str.__PUBLIC__')?:'/') : '/'; |
4 | $debug = function_exists('config') ? config('app_debug') : false; | 4 | $debug = function_exists('config') ? config('app_debug') : false; |
5 | 5 | ||
6 | $lang = [ | 6 | $lang = [ |
@@ -98,4 +98,4 @@ $langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang)); | @@ -98,4 +98,4 @@ $langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang)); | ||
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | </body> | 100 | </body> |
101 | -</html> | ||
101 | +</html> |
@@ -2,10 +2,10 @@ | @@ -2,10 +2,10 @@ | ||
2 | {:hook('user_sidenav_before')} | 2 | {:hook('user_sidenav_before')} |
3 | <ul class="list-group"> | 3 | <ul class="list-group"> |
4 | <li class="list-group-heading">{:__('Member center')}</li> | 4 | <li class="list-group-heading">{:__('Member center')}</li> |
5 | - <li class="list-group-item {:$config['actionname']=='index'?'active':''}"> <a href="{:url('user/index')}"><i class="fa fa-user-circle fa-fw"></i> {:__('User center')}</a> </li> | ||
6 | - <li class="list-group-item {:$config['actionname']=='profile'?'active':''}"> <a href="{:url('user/profile')}"><i class="fa fa-user-o fa-fw"></i> {:__('Profile')}</a> </li> | ||
7 | - <li class="list-group-item {:$config['actionname']=='changepwd'?'active':''}"> <a href="{:url('user/changepwd')}"><i class="fa fa-key fa-fw"></i> {:__('Change password')}</a> </li> | ||
8 | - <li class="list-group-item {:$config['actionname']=='logout'?'active':''}"> <a href="{:url('user/logout')}"><i class="fa fa-sign-out fa-fw"></i> {:__('Sign out')}</a> </li> | 5 | + <li class="list-group-item {:check_nav_active('user/index')}"> <a href="{:url('user/index')}"><i class="fa fa-user-circle fa-fw"></i> {:__('User center')}</a> </li> |
6 | + <li class="list-group-item {:check_nav_active('user/profile')}"> <a href="{:url('user/profile')}"><i class="fa fa-user-o fa-fw"></i> {:__('Profile')}</a> </li> | ||
7 | + <li class="list-group-item {:check_nav_active('user/changepwd')}"> <a href="{:url('user/changepwd')}"><i class="fa fa-key fa-fw"></i> {:__('Change password')}</a> </li> | ||
8 | + <li class="list-group-item {:check_nav_active('user/logout')}"> <a href="{:url('user/logout')}"><i class="fa fa-sign-out fa-fw"></i> {:__('Sign out')}</a> </li> | ||
9 | </ul> | 9 | </ul> |
10 | {:hook('user_sidenav_after')} | 10 | {:hook('user_sidenav_after')} |
11 | -</div> | ||
11 | +</div> |
-
请 注册 或 登录 后发表评论