diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php index 1a5baae2..4ba41202 100644 --- a/admin/manage_email_templates.php +++ b/admin/manage_email_templates.php @@ -13,7 +13,7 @@ hesk_session_start(); hesk_dbConnect(); hesk_isLoggedIn(); -// TODO Check permissions for this feature +hesk_checkPermission('can_manage_email_templates'); define('WYSIWYG',1); diff --git a/inc/admin_functions.inc.php b/inc/admin_functions.inc.php index 3f5a022d..3cdac183 100644 --- a/inc/admin_functions.inc.php +++ b/inc/admin_functions.inc.php @@ -735,6 +735,18 @@ function hesk_checkPermission($feature,$showerror=1) { return true; } + if ($feature == 'can_manage_email_templates') { + if ($_SESSION['can_manage_email_templates']) { + return true; + } else { + if ($showerror) { + hesk_error($hesklang['no_permission'].'

 

'.$hesklang['click_login'].''); + } else { + return false; + } + } + } + /* Check other staff for permissions */ if (strpos($_SESSION['heskprivileges'], $feature) === false) { diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index a38e4f60..4f6245c8 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -337,8 +337,8 @@ function execute210Scripts() { executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.1.0' WHERE `Key` = 'modsForHeskVersion'"); // Some old tables may not have been dropped during the 2.0.0 upgrade. Check and drop if necessary - executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk['db_pfix'])."denied_ips`"); - executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk['db_pfix'])."denied_emails`"); + executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_ips`"); + executeQuery("DROP TABLE IF EXISTS `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_emails`"); } function execute210FileUpdate() { @@ -395,4 +395,15 @@ $modsForHesk_settings[\'new_kb_article_visibility\'] = 0;'; return file_put_contents(HESK_PATH.'modsForHesk_settings.inc.php', $file); } -// END Version 2.1.1 \ No newline at end of file +// END Version 2.1.1 + +// BEGIN Version 2.2.0 +function execute220Scripts() { + global $hesk_settings; + + hesk_dbConnect(); + + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ADD COLUMN `can_manage_email_templates` ENUM('0','1') NOT NULL DEFAULT '0'"); + executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` SET `can_manage_email_templates` = '1' WHERE `isadmin` = '1'"); + executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.2.0' WHERE `Key` = 'modsForHeskVersion'"); +} \ No newline at end of file diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php index d8f2b7b4..471edb31 100644 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ b/install/mods-for-hesk/sql/uninstallSql.php @@ -136,4 +136,12 @@ function executeMiscellaneousSql() { // These queries are ran in case someone used an unfortunate installation they may have not properly cleaned up tables executeQuery('DROP TABLE IF EXISTS `'.hesk_dbEscape($hesk_settings['db_pfix']).'denied_ips`'); executeQuery('DROP TABLE IF EXISTS `'.hesk_dbEscape($hesk_settings['db_pfix']).'denied_emails`'); +} + +function removeEmailTemplatePermission() { + global $hesk_settings; + + hesk_dbConnect(); + + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` DROP COLUMN `can_manage_email_templates`"); } \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index 2eb3537b..301f2e38 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -26,8 +26,8 @@ $hesklang['email_templates'] = 'Email templates'; $hesklang['email_templates_intro'] = 'You can edit your plaintext and HTML email templates here.'; $hesklang['edit_plain_text_template'] = 'Edit plain text template'; $hesklang['edit_html_template'] = 'Edit HTML template'; -$hesklang['editing_plain_text_template'] = 'Editing plain text template %s'; // %s: The name of the template file (XXXX.txt) -$hesklang['editing_html_template'] = 'Editing HTML template %s'; // %s: The name of the template file +$hesklang['editing_plain_text_template'] = 'Editing plain text template %s'; // %s: The name of the template file, then language name +$hesklang['editing_html_template'] = 'Editing HTML template %s'; // %s: The name of the template file, then language name $hesklang['show_special_tags'] = 'Show Special Tags'; $hesklang['hide_special_tags'] = 'Hide Special Tags'; $hesklang['special_tag'] = 'Special Tag';