From 5715f5fe3954a2112f443964244747dfd6d31937 Mon Sep 17 00:00:00 2001 From: mcramer Date: Wed, 5 Sep 2012 11:48:32 +0000 Subject: [PATCH] - Implemented check for theme compatibility - Implemented session message system (template modifications pending) - Updated ISPC SVN version number to 3.0.5 --- install/sql/ispconfig3.sql | 2 +- install/tpl/config.inc.php.master | 2 +- interface/lib/classes/listform_actions.inc.php | 9 +++++++++ interface/lib/classes/tform_actions.inc.php | 8 ++++++++ interface/web/admin/form/users.tform.php | 4 +++- interface/web/client/form/client.tform.php | 4 +++- interface/web/client/form/client_circle.tform.php | 4 +++- interface/web/client/form/reseller.tform.php | 4 +++- interface/web/dashboard/dashboard.php | 10 ++++++++++ interface/web/index.php | 10 ++++++++++ interface/web/login/index.php | 13 ++++++++++++- interface/web/login/lib/lang/de.lng | 1 + interface/web/login/lib/lang/en.lng | 2 ++ interface/web/mailuser/index.php | 8 ++++++++ interface/web/themes/default-304/ISPC_VERSION | 1 + interface/web/themes/default_64_navimg/ISPC_VERSION | 1 + interface/web/themes/default_combobox/ISPC_VERSION | 1 + interface/web/themes/default_no_navimg/ISPC_VERSION | 1 + .../web/tools/form/interface_settings.tform.php | 4 +++- interface/web/tools/form/tpl_default.tform.php | 4 +++- 20 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 interface/web/themes/default-304/ISPC_VERSION create mode 100644 interface/web/themes/default_64_navimg/ISPC_VERSION create mode 100644 interface/web/themes/default_combobox/ISPC_VERSION create mode 100644 interface/web/themes/default_no_navimg/ISPC_VERSION diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 5777459ce..205840800 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -2130,6 +2130,6 @@ INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, -- Dumping data for table `sys_config` -- -INSERT INTO sys_config VALUES ('1','db','db_version','3.0.4.5'); +INSERT INTO sys_config VALUES ('1','db','db_version','3.0.5'); SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master index ff6e6a49a..de512a4a0 100644 --- a/install/tpl/config.inc.php.master +++ b/install/tpl/config.inc.php.master @@ -56,7 +56,7 @@ $revision = str_replace(array('Revision:','$',' '), '', $svn_revision); //** Application define('ISPC_APP_TITLE', 'ISPConfig'); -define('ISPC_APP_VERSION', '3.0.4.5'); +define('ISPC_APP_VERSION', '3.0.5'); define('DEVSYSTEM', 0); diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php index c8956580b..66a9f2c33 100644 --- a/interface/lib/classes/listform_actions.inc.php +++ b/interface/lib/classes/listform_actions.inc.php @@ -278,6 +278,15 @@ class listform_actions { $app->tpl->setVar($app->listform->wordbook); $app->tpl->setVar('form_action', $app->listform->listDef['file']); + if(isset($_SESSION['show_info_msg'])) { + $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']); + unset($_SESSION['show_info_msg']); + } + if(isset($_SESSION['show_error_msg'])) { + $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']); + unset($_SESSION['show_error_msg']); + } + //* Parse the templates and send output to the browser $this->onShowEnd(); } diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php index d536f4b36..52ebe162f 100644 --- a/interface/lib/classes/tform_actions.inc.php +++ b/interface/lib/classes/tform_actions.inc.php @@ -491,6 +491,14 @@ class tform_actions { $app->tpl->setVar('form_navibar',$navibar); } + if(isset($_SESSION['show_info_msg'])) { + $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']); + unset($_SESSION['show_info_msg']); + } + if(isset($_SESSION['show_error_msg'])) { + $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']); + unset($_SESSION['show_error_msg']); + } // loading plugins $this->loadPlugins($this->active_tab); diff --git a/interface/web/admin/form/users.tform.php b/interface/web/admin/form/users.tform.php index 9bc255b67..96ed417d0 100644 --- a/interface/web/admin/form/users.tform.php +++ b/interface/web/admin/form/users.tform.php @@ -100,7 +100,9 @@ $handle = @opendir(ISPC_THEMES_PATH); while ($file = @readdir ($handle)) { if (substr($file, 0, 1) != '.') { if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; + if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) { + $themes_list[$file] = $file; + } } } } diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index a8462194b..32a31fb76 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -73,7 +73,9 @@ $handle = @opendir(ISPC_THEMES_PATH); while ($file = @readdir ($handle)) { if (substr($file, 0, 1) != '.') { if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; + if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) { + $themes_list[$file] = $file; + } } } } diff --git a/interface/web/client/form/client_circle.tform.php b/interface/web/client/form/client_circle.tform.php index 96cb0da5a..bb5a140f3 100644 --- a/interface/web/client/form/client_circle.tform.php +++ b/interface/web/client/form/client_circle.tform.php @@ -73,7 +73,9 @@ $handle = @opendir(ISPC_THEMES_PATH); while ($file = @readdir ($handle)) { if (substr($file, 0, 1) != '.') { if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; + if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) { + $themes_list[$file] = $file; + } } } } diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index 0c669ece4..f437b2e92 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -61,7 +61,9 @@ $handle = @opendir(ISPC_THEMES_PATH); while ($file = @readdir ($handle)) { if (substr($file, 0, 1) != '.') { if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; + if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) { + $themes_list[$file] = $file; + } } } } diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php index 7c0ea7bca..f744f8d26 100644 --- a/interface/web/dashboard/dashboard.php +++ b/interface/web/dashboard/dashboard.php @@ -93,6 +93,16 @@ $app->tpl->setVar('welcome_user', $welcome); */ $info = array(); +if(isset($_SESSION['show_info_msg'])) { + $info[] = array('info_msg' => $_SESSION['show_info_msg']); + unset($_SESSION['show_info_msg']); +} +if(isset($_SESSION['show_error_msg'])) { + $app->tpl->setloop('error', array(array('error_msg' => $_SESSION['show_error_msg']))); + unset($_SESSION['show_error_msg']); +} + + /* * Check the ISPConfig-Version (only for the admin) */ diff --git a/interface/web/index.php b/interface/web/index.php index f0a9635ea..a7d2965e1 100644 --- a/interface/web/index.php +++ b/interface/web/index.php @@ -51,6 +51,16 @@ if($sys_config['tab_change_discard'] == 'y') { $app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt')); } +if(isset($_SESSION['show_info_msg'])) { + $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']); + unset($_SESSION['show_info_msg']); +} +if(isset($_SESSION['show_error_msg'])) { + $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']); + unset($_SESSION['show_error_msg']); +} + + $app->tpl_defaults(); $app->tpl->pparse(); ?> \ No newline at end of file diff --git a/interface/web/login/index.php b/interface/web/login/index.php index 726411bfd..a99a77546 100644 --- a/interface/web/login/index.php +++ b/interface/web/login/index.php @@ -65,7 +65,7 @@ class login_index { $maintenance_mode_error = $app->lng('error_maintenance_mode'); } - //* Login Form was send + //* Login Form was sent if(count($_POST) > 0) { //** Check variables @@ -197,6 +197,17 @@ class login_index { include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php'); $_SESSION['s']['module'] = $module; } + + // check if the user theme is valid + if($_SESSION['s']['user']['theme'] != 'default') { + $tmp_path = ISPC_THEMES_PATH."/".$_SESSION['s']['user']['theme']; + if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ISPC_VERSION") || trim(file_get_contents($tmp_path."/ISPC_VERSION")) != ISPC_APP_VERSION) { + // fall back to default theme if this one is not compatible with current ispc version + $_SESSION['s']['user']['theme'] = 'default'; + $_SESSION['s']['theme'] = 'default'; + $_SESSION['show_error_msg'] = $app->lng('theme_not_compatible'); + } + } $app->plugin->raiseEvent('login',$this); diff --git a/interface/web/login/lib/lang/de.lng b/interface/web/login/lib/lang/de.lng index 57024e981..e969bf01f 100644 --- a/interface/web/login/lib/lang/de.lng +++ b/interface/web/login/lib/lang/de.lng @@ -20,4 +20,5 @@ $wb['pw_reset_txt'] = 'Passwort zurücksetzen'; $wb['pw_button_txt'] = 'Passwort zusenden'; $wb['email_txt'] = 'E-Mail'; $wb['error_maintenance_mode'] = 'Diese ISPConfig-Installation wird gerade gewartet. Wir sind in Kürze wieder für Sie da. Vielen Dank für Ihre Geduld.'; +$wb['theme_not_compatible'] = 'Das gewählte Theme ist mit dieser ISPConfig Version nicht kompatibel. Bitte prüfen Sie, ob ein Update des Themes verfügbar ist.
Es wurde nun automatisch das Standard-Theme aktiviert.'; ?> diff --git a/interface/web/login/lib/lang/en.lng b/interface/web/login/lib/lang/en.lng index be171463a..37b4a19d4 100644 --- a/interface/web/login/lib/lang/en.lng +++ b/interface/web/login/lib/lang/en.lng @@ -24,4 +24,6 @@ $wb['pw_button_txt'] = "Resend password"; $wb['email_txt'] = "Email"; $wb['error_maintenance_mode'] = 'This ISPConfig installation is currently under maintenance. We should be back shortly. Thank you for your patience.'; + +$wb['theme_not_compatible'] = 'The chosen theme is not compatible with the current ISPConfig version. Please check for a new version of the theme.
The default theme as been activated automatically.'; ?> \ No newline at end of file diff --git a/interface/web/mailuser/index.php b/interface/web/mailuser/index.php index aba8eaa09..a67fb74ae 100644 --- a/interface/web/mailuser/index.php +++ b/interface/web/mailuser/index.php @@ -38,6 +38,14 @@ $app->tpl->setVar($rec2); $app->tpl->setVar('msg',$msg); $app->tpl->setVar('error',$error); +if(isset($_SESSION['show_info_msg'])) { + $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']); + unset($_SESSION['show_info_msg']); +} +if(isset($_SESSION['show_error_msg'])) { + $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']); + unset($_SESSION['show_error_msg']); +} diff --git a/interface/web/themes/default-304/ISPC_VERSION b/interface/web/themes/default-304/ISPC_VERSION new file mode 100644 index 000000000..bb19ac367 --- /dev/null +++ b/interface/web/themes/default-304/ISPC_VERSION @@ -0,0 +1 @@ +3.0.4.6 \ No newline at end of file diff --git a/interface/web/themes/default_64_navimg/ISPC_VERSION b/interface/web/themes/default_64_navimg/ISPC_VERSION new file mode 100644 index 000000000..7da3c1687 --- /dev/null +++ b/interface/web/themes/default_64_navimg/ISPC_VERSION @@ -0,0 +1 @@ +3.0.5 \ No newline at end of file diff --git a/interface/web/themes/default_combobox/ISPC_VERSION b/interface/web/themes/default_combobox/ISPC_VERSION new file mode 100644 index 000000000..7da3c1687 --- /dev/null +++ b/interface/web/themes/default_combobox/ISPC_VERSION @@ -0,0 +1 @@ +3.0.5 \ No newline at end of file diff --git a/interface/web/themes/default_no_navimg/ISPC_VERSION b/interface/web/themes/default_no_navimg/ISPC_VERSION new file mode 100644 index 000000000..7da3c1687 --- /dev/null +++ b/interface/web/themes/default_no_navimg/ISPC_VERSION @@ -0,0 +1 @@ +3.0.5 \ No newline at end of file diff --git a/interface/web/tools/form/interface_settings.tform.php b/interface/web/tools/form/interface_settings.tform.php index 47292f9da..e992c3321 100644 --- a/interface/web/tools/form/interface_settings.tform.php +++ b/interface/web/tools/form/interface_settings.tform.php @@ -113,7 +113,9 @@ $handle = @opendir(ISPC_THEMES_PATH); while ($file = @readdir ($handle)) { if (substr($file, 0, 1) != '.') { if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; + if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) { + $themes_list[$file] = $file; + } } } } diff --git a/interface/web/tools/form/tpl_default.tform.php b/interface/web/tools/form/tpl_default.tform.php index 8a16bed3e..e4d1b6273 100644 --- a/interface/web/tools/form/tpl_default.tform.php +++ b/interface/web/tools/form/tpl_default.tform.php @@ -113,7 +113,9 @@ $handle = @opendir(ISPC_THEMES_PATH); while ($file = @readdir ($handle)) { if (substr($file, 0, 1) != '.') { if(@is_dir(ISPC_THEMES_PATH."/$file")) { - $themes_list[$file] = $file; + if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) { + $themes_list[$file] = $file; + } } } } -- GitLab