From 5715f5fe3954a2112f443964244747dfd6d31937 Mon Sep 17 00:00:00 2001 From: mcramer <m.cramer@pixcept.de> Date: Wed, 05 Sep 2012 07:48:32 -0400 Subject: [PATCH] - Implemented check for theme compatibility - Implemented session message system (template modifications pending) - Updated ISPC SVN version number to 3.0.5 --- install/tpl/config.inc.php.master | 2 interface/web/mailuser/index.php | 8 ++++ interface/web/login/lib/lang/en.lng | 2 + interface/web/client/form/client.tform.php | 4 + interface/web/admin/form/users.tform.php | 4 + interface/web/dashboard/dashboard.php | 10 +++++ interface/web/login/index.php | 13 ++++++ interface/web/themes/default_combobox/ISPC_VERSION | 1 install/sql/ispconfig3.sql | 2 interface/lib/classes/tform_actions.inc.php | 8 ++++ interface/web/index.php | 10 +++++ interface/web/themes/default_no_navimg/ISPC_VERSION | 1 interface/web/login/lib/lang/de.lng | 1 interface/web/themes/default-304/ISPC_VERSION | 1 interface/lib/classes/listform_actions.inc.php | 9 ++++ interface/web/tools/form/tpl_default.tform.php | 4 + interface/web/client/form/client_circle.tform.php | 4 + interface/web/client/form/reseller.tform.php | 4 + interface/web/tools/form/interface_settings.tform.php | 4 + interface/web/themes/default_64_navimg/ISPC_VERSION | 1 20 files changed, 84 insertions(+), 9 deletions(-) diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 5777459..2058408 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -2130,6 +2130,6 @@ -- 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 ff6e6a4..de512a4 100644 --- a/install/tpl/config.inc.php.master +++ b/install/tpl/config.inc.php.master @@ -56,7 +56,7 @@ //** 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 c895658..66a9f2c 100644 --- a/interface/lib/classes/listform_actions.inc.php +++ b/interface/lib/classes/listform_actions.inc.php @@ -278,6 +278,15 @@ $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 d536f4b..52ebe16 100644 --- a/interface/lib/classes/tform_actions.inc.php +++ b/interface/lib/classes/tform_actions.inc.php @@ -491,6 +491,14 @@ $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 9bc255b..96ed417 100644 --- a/interface/web/admin/form/users.tform.php +++ b/interface/web/admin/form/users.tform.php @@ -100,7 +100,9 @@ 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 a846219..32a31fb 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -73,7 +73,9 @@ 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 96cb0da..bb5a140 100644 --- a/interface/web/client/form/client_circle.tform.php +++ b/interface/web/client/form/client_circle.tform.php @@ -73,7 +73,9 @@ 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 0c669ec..f437b2e 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -61,7 +61,9 @@ 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 7c0ea7b..f744f8d 100644 --- a/interface/web/dashboard/dashboard.php +++ b/interface/web/dashboard/dashboard.php @@ -93,6 +93,16 @@ */ $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 f0a9635..a7d2965 100644 --- a/interface/web/index.php +++ b/interface/web/index.php @@ -51,6 +51,16 @@ $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 726411b..a99a775 100644 --- a/interface/web/login/index.php +++ b/interface/web/login/index.php @@ -65,7 +65,7 @@ $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 @@ 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 57024e9..e969bf0 100644 --- a/interface/web/login/lib/lang/de.lng +++ b/interface/web/login/lib/lang/de.lng @@ -20,4 +20,5 @@ $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.<br />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 be17146..37b4a19 100644 --- a/interface/web/login/lib/lang/en.lng +++ b/interface/web/login/lib/lang/en.lng @@ -24,4 +24,6 @@ $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.<br />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 aba8eaa..a67fb74 100644 --- a/interface/web/mailuser/index.php +++ b/interface/web/mailuser/index.php @@ -38,6 +38,14 @@ $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 0000000..bb19ac3 --- /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 0000000..7da3c16 --- /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 0000000..7da3c16 --- /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 0000000..7da3c16 --- /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 47292f9..e992c33 100644 --- a/interface/web/tools/form/interface_settings.tform.php +++ b/interface/web/tools/form/interface_settings.tform.php @@ -113,7 +113,9 @@ 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 8a16bed..e4d1b62 100644 --- a/interface/web/tools/form/tpl_default.tform.php +++ b/interface/web/tools/form/tpl_default.tform.php @@ -113,7 +113,9 @@ 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; + } } } } -- Gitblit v1.9.1