X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilter%2Ftheme_filter.php;h=7c241fc3b488624ffc59c7e364aa3db9d36a6062;hb=d1922ab361b5e104b7c14b28c76d1c47651635ef;hp=6c2ea26107d88b5e9f6a0243f214c9bae6601d03;hpb=2379934be6a196a54f4155bb8e24c49b20736969;p=mailer.git diff --git a/inc/filter/theme_filter.php b/inc/filter/theme_filter.php index 6c2ea26107..7c241fc3b4 100644 --- a/inc/filter/theme_filter.php +++ b/inc/filter/theme_filter.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2016 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -42,20 +42,21 @@ if (!defined('__SECURITY')) { // Filter for generic handling of theme change function FILTER_HANDLE_THEME_CHANGE ($filterData) { - // Check if new theme is selcted //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - if ((isPostRequestElementSet('new_theme')) && (postRequestElement('new_theme') != getCurrentTheme())) { + + // Check if new theme is selcted + if ((isPostRequestElementSet('new_theme')) && (postRequestElement('new_theme') != getCurrentTheme()) && (isThemeReadable(postRequestElement('new_theme')))) { // Set new theme for guests $newTheme = postRequestElement('new_theme'); // Change to new theme - setTheme($newTheme); + setMailerTheme($newTheme); // Remove current from array - removeIncludeFromPool('theme', sprintf("theme/%s/theme.php", getCurrentTheme())); + removeIncludeFromPool('theme', sprintf('theme/%s/theme.php', getCurrentTheme())); // Add new theme - addIncludeToPool('theme', sprintf("theme/%s/theme.php", $newTheme)); + addIncludeToPool('theme', sprintf('theme/%s/theme.php', $newTheme)); // Redirect to same URL redirectToRequestUri(); @@ -68,20 +69,35 @@ function FILTER_HANDLE_THEME_CHANGE ($filterData) { // Filter for settings theme from user profile, must be executed only if FILTER_FETCH_USER_DATA() ran before function FILTER_SET_USERS_THEME ($filterData) { - // Is the user data valid? //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Is the user data valid? if (!isMember()) { // Do only run for logged in members - debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.'); + reportBug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.'); } // END - if // Change to new theme - setTheme(getUserData('curr_theme')); + setMailerTheme(getUserData('curr_theme')); // Return data //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; } +// Filter for adding SQL columns on user registration about current theme +function FILTER_THEME_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Okay, add design here + addExtraRegistrationColumns(', `curr_theme`'); + addExtraRegistrationData(", '{%%pipe,getCurrentTheme%%}'"); + + // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=
'.print_r($filterData,TRUE).'
'; + return $filterData; +} + // [EOF] ?>