Skip to content

Commit 70747b9

Browse files
author
mcramer
committed
- Changed compatibility of extended (old) default themes
- Implemented immediate change of theme on selection - Fixed error message on incompatible theme
1 parent 2339ee8 commit 70747b9

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

interface/web/dashboard/dashboard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@
9494
$info = array();
9595

9696
if(isset($_SESSION['show_info_msg'])) {
97-
$info[] = array('info_msg' => $_SESSION['show_info_msg']);
97+
$info[] = array('info_msg' => '<p>'.$_SESSION['show_info_msg'].'</p>');
9898
unset($_SESSION['show_info_msg']);
9999
}
100100
if(isset($_SESSION['show_error_msg'])) {
101-
$app->tpl->setloop('error', array(array('error_msg' => $_SESSION['show_error_msg'])));
101+
$app->tpl->setloop('error', array(array('error_msg' => '<p>'.$_SESSION['show_error_msg'].'</p>')));
102102
unset($_SESSION['show_error_msg']);
103103
}
104104

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.5
1+
3.0.4.6
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.5
1+
3.0.4.6
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.5
1+
3.0.4.6

interface/web/tools/interface_settings.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
$app->load('tform_actions');
5050

5151
class page_action extends tform_actions {
52-
52+
var $_theme_changed = false;
53+
5354
function onLoad() {
5455
global $app, $conf, $tform_def_file;
5556

@@ -80,6 +81,7 @@ function onBeforeInsert() {
8081
if(!in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
8182
$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
8283
}
84+
$this->updateSessionTheme();
8385
}
8486

8587
function onInsert() {
@@ -94,8 +96,38 @@ function onBeforeUpdate() {
9496
if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
9597
$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
9698
}
99+
$this->updateSessionTheme();
97100
}
101+
102+
function updateSessionTheme() {
103+
global $app, $conf;
104+
105+
if($this->dataRecord['app_theme'] != 'default') {
106+
$tmp_path = ISPC_THEMES_PATH."/".$this->dataRecord['app_theme'];
107+
if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ISPC_VERSION") || trim(file_get_contents($tmp_path."/ISPC_VERSION")) != ISPC_APP_VERSION) {
108+
// fall back to default theme if this one is not compatible with current ispc version
109+
$this->dataRecord['app_theme'] = 'default';
110+
}
111+
}
112+
if($this->dataRecord['app_theme'] != $_SESSION['s']['user']['theme']) $this->_theme_changed = true;
113+
$_SESSION['s']['theme'] = $this->dataRecord['app_theme'];
114+
$_SESSION['s']['user']['theme'] = $_SESSION['s']['theme'];
115+
$_SESSION['s']['user']['app_theme'] = $_SESSION['s']['theme'];
116+
}
98117

118+
function onAfterInsert() {
119+
$this->onAfterUpdate();
120+
}
121+
function onAfterUpdate() {
122+
if($this->_theme_changed == true) {
123+
// not the best way, but it works
124+
header('Content-Type: text/html');
125+
print '<script type="text/javascript">document.location.reload();</script>';
126+
exit;
127+
}
128+
else parent::onShow();
129+
}
130+
99131

100132
}
101133

0 commit comments

Comments
 (0)