Skip to content

Commit

Permalink
Control Panel part load fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sergejey committed Aug 23, 2021
1 parent 6277775 commit d07f44b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
19 changes: 16 additions & 3 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@
include_once("./lib/loader.php");
endMeasure('loader');

include_once(DIR_MODULES . "panel.class.php");

$session = new session("prj");

include_once("./load_settings.php");

if (isset($_GET['part_load']) && checkFromCache('reload:'.md5($_SERVER['REQUEST_URI']))) {
$res = array();
$res['TITLE'] = '';
$res['CONTENT'] = '';
$res['NEED_RELOAD'] = 1;
echo json_encode($res);
exit;
}

include_once(DIR_MODULES . "panel.class.php");
$session = new session("prj");
include_once(DIR_MODULES . "control_modules/control_modules.class.php");

$cl = new control_modules();
Expand Down Expand Up @@ -115,6 +124,10 @@
$result=json_encode($res);
}

if ($res['NEED_RELOAD']) {
saveToCache('reload:'.md5($_SERVER['REQUEST_URI']),1);
}

header("HTTP/1.0: 200 OK\n");
header('Content-Type: text/html; charset=utf-8');
echo $result;exit;
Expand Down
4 changes: 2 additions & 2 deletions lib/jTemplate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,17 +755,17 @@ public function parseVariables(&$res, &$hash)
// [#VARIABLE#] - general variables
if (preg_match_all('/\[#(\w+?)#\]/', $res, $matches, PREG_PATTERN_ORDER)) {
$count_matches_1 = count($matches[1]);

for ($i = 0; $i < $count_matches_1; $i++) {
if (!isset($hash[$matches[1][$i]])) $hash[$matches[1][$i]]='';
$res = str_replace($matches[0][$i], $this->templateSafe($hash[$matches[1][$i]]), $res);
}
}

// [#VARIABLE.VALUE#] - hash variables
if (preg_match_all('/\[#(\w+?)\.(\w+?)#\]/', $res, $matches, PREG_PATTERN_ORDER)) {
$count_matches_1 = count($matches[1]);

for ($i = 0; $i < $count_matches_1; $i++) {
if (!isset($hash[$matches[1][$i]][$matches[2][$i]])) $hash[$matches[1][$i]][$matches[2][$i]]='';
$res = str_replace($matches[0][$i], $this->templateSafe($hash[$matches[1][$i]][$matches[2][$i]]), $res);
}
}
Expand Down
11 changes: 7 additions & 4 deletions templates/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,12 @@ <h4 style="font-weight: bold;"><#LANG_NEWDASH_PRELOAD_HEADER#></h4>
</script>



<div id="partLoadContent" style="margin-bottom: 50px;">
<style>
#partLoadContent {
margin-bottom: 50px;
}
</style>
<div id="partLoadContent">
<div class="visible-xs">
<div class="row" style="margin: 0 15px;">
<div class="col-12" style="margin-bottom: 10px;">
Expand Down Expand Up @@ -1146,8 +1150,7 @@ <h4 class="panel-title">
[#else AUTHORIZED#]
[#module name="control_access" action="enter" instance="auth"#]
[#endif AUTHORIZED#]
</div>
<!--partloadend-->
</div><!--partloadend-->

<script language="javascript">
//Показ консоли
Expand Down

0 comments on commit d07f44b

Please sign in to comment.