From 9324678b6582491a1f42f5ec6916e7346e9250cd Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 9 Mar 2015 12:09:04 -0400 Subject: [PATCH 01/93] Closes #163 use the language file for "Go back" --- knowledgebase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledgebase.php b/knowledgebase.php index 3777f33d..017473a8 100644 --- a/knowledgebase.php +++ b/knowledgebase.php @@ -457,7 +457,7 @@ function hesk_show_kb_category($catid, $is_search = 0) { { $link = ($thiscat['parent'] == 1) ? 'knowledgebase.php' : 'knowledgebase.php?category='.$thiscat['parent']; echo '

'.$hesklang['kb_cat'].': '.$thiscat['name'].'

-

Go back

+

'.$hesklang['back'].'

'; From 7ea2323e3df9c502d679f1652f626fc0bda72ae9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 9 Mar 2015 16:54:32 -0400 Subject: [PATCH 02/93] Create LICENSE --- LICENSE | 427 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 427 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..62ba2712 --- /dev/null +++ b/LICENSE @@ -0,0 +1,427 @@ +NOTE: This license only applies to Mods for HESK. It does not apply to HESK. + +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. From f93620b09ee98a4f5be1c9635473e8ad9d5afe59 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 9 Mar 2015 21:58:27 -0400 Subject: [PATCH 03/93] Closes #165 Fix layout for security question and reCAPTCHAs --- index.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 04d6bc1f..da9cd76c 100644 --- a/index.php +++ b/index.php @@ -879,7 +879,7 @@ if ( ! isset($_SESSION['c_category']) && ! $hesk_settings['select_cat']) { ?>
- + '; + echo '
'.$hesk_settings['question_ask'].'
'; ?>
+
+
+ -
+
+
+
Date: Mon, 9 Mar 2015 22:16:59 -0400 Subject: [PATCH 04/93] Closes #164 Tweak login UI to allow for longer strings --- admin/index.php | 300 ++++++++++++++++++++------------------- css/hesk_newStyle.php | 7 +- css/hesk_newStyleRTL.php | 7 +- 3 files changed, 163 insertions(+), 151 deletions(-) diff --git a/admin/index.php b/admin/index.php index e7bd3ba2..8138a3ad 100644 --- a/admin/index.php +++ b/admin/index.php @@ -326,171 +326,185 @@ function print_login() hesk_handle_messages(); ?>
- + + From 4a3c9fc98d675ef99677a94a97b3d18125e9347a Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 23 Mar 2015 01:15:26 -0400 Subject: [PATCH 38/93] Add 2.1.1 JavaScript and button to installation page --- install/install_functions.inc.php | 4 +-- install/mods-for-hesk/installModsForHesk.php | 3 ++ install/mods-for-hesk/js/version-scripts.js | 3 ++ install/mods-for-hesk/modsForHesk.php | 31 +++++++++++++------- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index 9b685d63..c709d8f6 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -36,8 +36,8 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: -define('HESK_NEW_VERSION','2.6.1'); -define('MODS_FOR_HESK_NEW_VERSION','2.1.0'); +define('HESK_NEW_VERSION','2.6.2'); +define('MODS_FOR_HESK_NEW_VERSION','2.1.1'); define('REQUIRE_PHP_VERSION','5.0.0'); define('REQUIRE_MYSQL_VERSION','5.0.7'); diff --git a/install/mods-for-hesk/installModsForHesk.php b/install/mods-for-hesk/installModsForHesk.php index 33322d6e..e6ffec4f 100644 --- a/install/mods-for-hesk/installModsForHesk.php +++ b/install/mods-for-hesk/installModsForHesk.php @@ -40,6 +40,9 @@ function echoInitialVersionRows($version) { if ($version < 210) { printRow('v2.1.0'); } + if ($version < 211) { + printRow('v2.1.1'); + } } function printRow($version) { diff --git a/install/mods-for-hesk/js/version-scripts.js b/install/mods-for-hesk/js/version-scripts.js index 8cdd3412..de51148a 100644 --- a/install/mods-for-hesk/js/version-scripts.js +++ b/install/mods-for-hesk/js/version-scripts.js @@ -29,6 +29,9 @@ function processUpdates(startingVersion) { } else if (startingVersion < 210) { startVersionUpgrade('210'); executeUpdate(210, '210', '2.1.0'); + } else if (startingVersion < 211) { + startVersionUpgrade('211'); + executeUpdate(211, '211', '2.1.1'); } else { installationFinished(); } diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php index 4f412e71..342b640b 100644 --- a/install/mods-for-hesk/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -137,6 +137,17 @@ hesk_dbConnect(); } ?>
+
+ + v2.1.0 +
+
+
+
-
-
-
-
- v1.4.0 -


- +
+ No previous installation + +

From 19b2582a19782bd474411454d455b94197ebe339 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 23 Mar 2015 01:23:15 -0400 Subject: [PATCH 39/93] Add 2.1.1 AJAX PHP logic --- .../ajax/install-database-ajax.php | 3 +++ install/mods-for-hesk/sql/installSql.php | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/install/mods-for-hesk/ajax/install-database-ajax.php b/install/mods-for-hesk/ajax/install-database-ajax.php index d5078e4d..5ae4b616 100644 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ b/install/mods-for-hesk/ajax/install-database-ajax.php @@ -30,6 +30,9 @@ if ($version == 1) { } elseif ($version == 210) { execute210Scripts(); execute210FileUpdate(); +} elseif ($version == 211) { + execute211Scripts(); + execute211FileUpdate(); } else { $response = 'The version "'.$version.'" was not recognized. Check the value submitted and try again.'; print $response; diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index d631c8b7..a38e4f60 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -378,4 +378,21 @@ function execute211Scripts() { ADD INDEX ( `openedby` , `firstreplyby` , `closedby` ), ADD INDEX(`dt`)"); executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.1.1' WHERE `Key` = 'modsForHeskVersion'"); -} \ No newline at end of file +} + +function execute211FileUpdate() { + //-- Add the boostrap theme property to modsForHesk_settings.inc.php + $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); + + //-- Only add the additional settings if they aren't already there. + if (strpos($file, 'new_kb_article_visibility') === false) + { + $file .= ' + + //-- Default value for new Knowledgebase article: 0 = Published, 1 = Private, 2 = Draft +$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 From 34d8882421aed92460599677f85ea2fafe53f9a7 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 23 Mar 2015 16:06:57 -0400 Subject: [PATCH 40/93] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9b9df71..74539e19 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License](https://img.shields.io/badge/license-CC--A--SA-blue.svg)](https://github.com/mkoch227/Mods-for-HESK/blob/master/LICENSE) [![Join the chat at https://gitter.im/mkoch227/Mods-for-HESK](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mkoch227/Mods-for-HESK?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -Mods for HESK is a set of modifications for HESK v2.6.1, a free and popular helpdesk solution. +Mods for HESK is a set of modifications for HESK v2.6.2, a free and popular helpdesk solution. ## Features - A new, responsive user interface From 2962d9cf3e51330c34587c42f662e380e496abaa Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 23 Mar 2015 17:34:50 -0400 Subject: [PATCH 41/93] #182 Fixed this bug again for the tenth time... :laughing: --- inc/admin_functions.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/inc/admin_functions.inc.php b/inc/admin_functions.inc.php index 6ba71df4..3f5a022d 100644 --- a/inc/admin_functions.inc.php +++ b/inc/admin_functions.inc.php @@ -715,6 +715,20 @@ function hesk_okCategory($cat,$error=1,$user_isadmin=false,$user_cat=false) function hesk_checkPermission($feature,$showerror=1) { global $hesklang; + /* Check if this is for managing settings */ + if ($feature == 'can_manage_settings') + { + if ($_SESSION['can_manage_settings']) { + return true; + } else { + if ($showerror) { + hesk_error($hesklang['no_permission'].'

 

'.$hesklang['click_login'].''); + } else { + return false; + } + } + } + /* Admins have full access to all features */ if ($_SESSION['isadmin']) { From a4b7e22c1c2bb662356ef91e10cd39dbad6addab Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 29 Mar 2015 23:25:23 -0400 Subject: [PATCH 42/93] Fixes #185 Add true parameter to hesk_date for notes --- admin/admin_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 1acb50bf..6f587417 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1016,7 +1016,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');

-

-

+

-

Date: Sun, 5 Apr 2015 14:22:15 -0400 Subject: [PATCH 43/93] Fixes #183 turn off all notifications when clicking the deactivate icon --- admin/manage_users.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/admin/manage_users.php b/admin/manage_users.php index e7f25edf..6245a89b 100644 --- a/admin/manage_users.php +++ b/admin/manage_users.php @@ -634,7 +634,7 @@ function update_user() $myuser = hesk_validateUserInfo(0,$_SERVER['PHP_SELF']); $myuser['id'] = $tmp; - /* Only active users can be assigned tickets */ + /* Only active users can be assigned tickets. Also turn off all notifications */ if (!$myuser['active']) { $myuser['autoassign'] = 0; $myuser['notify_new_unassigned'] = 0; @@ -955,12 +955,15 @@ function toggle_active() { $active = 1; $tmp = $hesklang['user_activated']; + $notificationSql = ""; } else { $active = 0; $tmp = $hesklang['user_deactivated']; + $notificationSql = ", `autoassign` = 0, `notify_new_unassigned` = 0, `notify_new_my` = 0, `notify_reply_unassigned` = 0, + `notify_reply_my` = 0, `notify_assigned` = 0, `notify_pm` = 0, `notify_note` = 0, `notify_note_unassigned` = 0"; } - hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` SET `active` = '".$active."' WHERE `id` = '".intval($myuser)."'"); + hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` SET `active` = '".$active."'".$notificationSql." WHERE `id` = '".intval($myuser)."'"); if (hesk_dbAffectedRows() != 1) { hesk_process_messages($hesklang['int_error'].': '.$hesklang['user_not_found'],'./manage_users.php'); From c4b039f41c3a16a98f8ac783dfeb019361d2e2bc Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 5 Apr 2015 22:02:50 -0400 Subject: [PATCH 44/93] Fixes #186 fix footer on show_tickets page --- admin/show_tickets.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/admin/show_tickets.php b/admin/show_tickets.php index 4326537c..e128fd87 100644 --- a/admin/show_tickets.php +++ b/admin/show_tickets.php @@ -57,7 +57,7 @@ require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> - +
+
+ From 7ed4d23df41cb6f8b31a8514be82ba1eada0f12a Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 5 Apr 2015 22:03:11 -0400 Subject: [PATCH 45/93] #186 Fix indentation --- admin/show_tickets.php | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/admin/show_tickets.php b/admin/show_tickets.php index e128fd87..0a94c97b 100644 --- a/admin/show_tickets.php +++ b/admin/show_tickets.php @@ -58,30 +58,30 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?>
-
- -
- - -
+
+ +
+ + +
Date: Sun, 5 Apr 2015 22:19:15 -0400 Subject: [PATCH 46/93] Fixes #181 update notify_customer_(new|reply) and show_suggested on profile page --- admin/profile.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/admin/profile.php b/admin/profile.php index 224b1e7b..6c4982ab 100644 --- a/admin/profile.php +++ b/admin/profile.php @@ -255,6 +255,9 @@ function update_profile() { { $_SESSION['new']['afterreply'] = 0; } + $_SESSION['new']['notify_customer_new'] = isset($_POST['notify_customer_new']) ? 1 : 0; + $_SESSION['new']['notify_customer_reply'] = isset($_POST['notify_customer_reply']) ? 1 : 0; + $_SESSION['new']['show_suggested'] = isset($_POST['show_suggested']) ? 1 : 0; /* Auto-start ticket timer */ $_SESSION['new']['autostart'] = isset($_POST['autostart']) ? 1 : 0; @@ -301,7 +304,10 @@ function update_profile() { `notify_assigned`='".intval($_SESSION['new']['notify_assigned'])."' , `notify_pm`='".intval($_SESSION['new']['notify_pm'])."', `notify_note`='".intval($_SESSION['new']['notify_note'])."', - `notify_note_unassigned`='".intval($_SESSION['new']['notify_note_unassigned'])."' + `notify_note_unassigned`='".intval($_SESSION['new']['notify_note_unassigned'])."', + `notify_customer_new`='".$_SESSION['new']['notify_customer_new']."', + `notify_customer_reply`='".$_SESSION['new']['notify_customer_reply']."', + `show_suggested`='".$_SESSION['new']['show_suggested']."' WHERE `id`='".intval($_SESSION['id'])."' LIMIT 1" ); From 9e43cc20e1adf929225bb368c684fb5060560327 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 6 Apr 2015 17:11:22 -0400 Subject: [PATCH 47/93] Got started on the email templates page. Nothing fancy --- admin/manage_email_templates.php | 92 ++++++++++++++++++++++++++++++++ language/en/text.php | 4 ++ 2 files changed, 96 insertions(+) create mode 100644 admin/manage_email_templates.php diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php new file mode 100644 index 00000000..3e8dbad9 --- /dev/null +++ b/admin/manage_email_templates.php @@ -0,0 +1,92 @@ + + +
+ +
+ +
+
\ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index cf5de85e..fde4cf83 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -21,6 +21,10 @@ $hesklang['_COLLATE']='utf8_unicode_ci'; // This is the email break line that will be used in email piping $hesklang['EMAIL_HR']='------ Reply above this line ------'; +// ADDED OR MODIFIED IN Mods for HESK 2.2.0 +$hesklang['email_templates'] = 'Email templates'; +$hesklang['email_templates_intro'] = 'You can edit your plaintext and HTML email templates here.'; + // ADDED OR MODIFIED IN Mods for HESK 2.1.1 $hesklang['new_article_default_type'] = 'Default Type for New Articles'; $hesklang['new_article_default_type_help'] = 'Choose the default type for new knowledgebase articles.'; From bc2f2a67a5753539c9ba9b9707bdf62b149aa228 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 6 Apr 2015 21:16:32 -0400 Subject: [PATCH 48/93] Add some more to email templates --- admin/manage_email_templates.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php index 3e8dbad9..199f3378 100644 --- a/admin/manage_email_templates.php +++ b/admin/manage_email_templates.php @@ -87,6 +87,15 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
- +
+
+

+ + +
+
\ No newline at end of file From 89efb15cd01103c827c513ae3cfdf1400be3b615 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 6 Apr 2015 22:25:09 -0400 Subject: [PATCH 49/93] #169 Now able to dump list of template files and add links for HTML/plaintext --- admin/manage_email_templates.php | 95 ++++++++++++++++++++------------ language/en/text.php | 2 + 2 files changed, 63 insertions(+), 34 deletions(-) diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php index 199f3378..1603ba16 100644 --- a/admin/manage_email_templates.php +++ b/admin/manage_email_templates.php @@ -1,36 +1,4 @@
-
+


$value) { + $languages[$key] = $hesk_settings['languages'][$key]['folder']; + } + + // Get all files, but don't worry about index.htm, .., ., or the html folder as we'll assume they both exist + // We'll also assume the template file exists in all language folders + reset($languages); + $firstKey = key($languages); + $firstDirectory = HESK_PATH . 'language/'.$languages[$firstKey].'/emails'; + $directoryListing = preg_grep('/^([^.])/', scandir($firstDirectory)); + $emailTemplates = array_diff($directoryListing, array('html', 'index.htm')); + ?> + + + + + $value): ?> + + + + + + + + + + + + +
+ +
+
-
\ No newline at end of file +
+ +'; + } else { + $link = sprintf($linkPlaintext, $languageCode, $template); + return + ''; + } + } \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index fde4cf83..d39acb6f 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -24,6 +24,8 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------'; // ADDED OR MODIFIED IN Mods for HESK 2.2.0 $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'; // ADDED OR MODIFIED IN Mods for HESK 2.1.1 $hesklang['new_article_default_type'] = 'Default Type for New Articles'; From 685bf6b008116a5a6b2e816beec0dbb377a6067e Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 7 Apr 2015 00:04:41 -0400 Subject: [PATCH 50/93] #169 In a somewhat broken state. Can't use modals due to TinyMCE not wanting to resize inside of a modal. --- admin/manage_email_templates.php | 117 +++++++++++++++++++++++++------ language/en/text.php | 2 + 2 files changed, 97 insertions(+), 22 deletions(-) diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php index 1603ba16..e51b95b9 100644 --- a/admin/manage_email_templates.php +++ b/admin/manage_email_templates.php @@ -15,9 +15,32 @@ hesk_isLoggedIn(); // TODO Check permissions for this feature +define('WYSIWYG',1); /* Print header */ require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); +if ($modsForHesk_settings['html_emails']) { + echo ''; +} + /* Print main manage users page */ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> @@ -57,7 +80,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
-

- -
+ + '; - } else { - $link = sprintf($linkPlaintext, $languageCode, $template); - return - ''; - } - } \ No newline at end of file +require_once(HESK_PATH . 'inc/footer.inc.php'); +exit(); + +function getTemplateMarkup($template, $languageCode, $html = false) { + global $hesklang; + + $templateId = str_replace('.', '-', $template); + $templateId = str_replace(' ', '-', $templateId); + $languageCodeId = str_replace('.', '-', $languageCode); + $languageCodeId = str_replace(' ', '-', $languageCodeId); + if ($html) { + $markup = ''; + $markup .= ''; + $markup .= ''; + return $markup; + } else { + $markup = ''; + $markup .= ''; + $markup .= ''; + return $markup; + } +} + +function getModalMarkup($template, $languageCode, $html = false) { + global $hesklang; + + $templateId = str_replace('.', '-', $template); + $templateId = str_replace(' ', '-', $templateId); + $languageCodeId = str_replace('.', '-', $languageCode); + $languageCodeId = str_replace(' ', '-', $languageCodeId); + $id = 'modal-html-'.$languageCodeId.'-'.$templateId; + $class = ''; + + if ($html) { + $title = sprintf($hesklang['editing_html_template'], $template); + $content = file_get_contents(HESK_PATH . 'language/'.$languageCode.'/emails/html/'.$template); + $class = 'htmlEditor'; + } else { + $id = str_replace('html-', '', $id); + $title = sprintf($hesklang['editing_template'], $template); + $content = file_get_contents(HESK_PATH . 'language/'.$languageCode.'/emails/'.$template); + } + return ' + '; +} \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index d39acb6f..b202aa23 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -26,6 +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_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 // ADDED OR MODIFIED IN Mods for HESK 2.1.1 $hesklang['new_article_default_type'] = 'Default Type for New Articles'; From 5b68f5f9264afc893adafd3f14a5b22f6fc5d451 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 7 Apr 2015 22:23:28 -0400 Subject: [PATCH 51/93] Can now edit and save email templates :grinning: --- admin/manage_email_templates.php | 197 ++++++++++++++++----- css/hesk_newStyle.php | 4 + language/en/emails/html/category_moved.txt | 11 +- language/en/text.php | 21 ++- 4 files changed, 177 insertions(+), 56 deletions(-) diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php index e51b95b9..1a5baae2 100644 --- a/admin/manage_email_templates.php +++ b/admin/manage_email_templates.php @@ -16,6 +16,21 @@ hesk_isLoggedIn(); // TODO Check permissions for this feature define('WYSIWYG',1); + +// Are we performing an action? +$showEditPanel = false; +if (isset($_GET['action'])) { + if ($_GET['action'] == 'edit') { + $showEditPanel = true; + } +} + +// Are we saving? +if (isset($_POST['action'])) { + if ($_POST['action'] == 'save') { + save(); + } +} /* Print header */ require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); @@ -78,6 +93,90 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
+ +
+
+
+
+

+ +

+
+
+ + + + + +
+ + + + + +
+ +

'.sprintf($hesklang['email_template_directory_not_writable'], $_GET['template']).'

+
'; + } else { + echo ''; + } + ?> + +
+
+
+
+
- $value): ?> - + $languageCode): ?> + @@ -113,15 +212,17 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); + $languageCode): ?> + @@ -130,13 +231,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
- - '; + $markup = ''; $markup .= ''; $markup .= ''; return $markup; } else { - $markup = ''; + $markup = ''; $markup .= ''; $markup .= ''; return $markup; } } -function getModalMarkup($template, $languageCode, $html = false) { +function save() { global $hesklang; - $templateId = str_replace('.', '-', $template); - $templateId = str_replace(' ', '-', $templateId); - $languageCodeId = str_replace('.', '-', $languageCode); - $languageCodeId = str_replace(' ', '-', $languageCodeId); - $id = 'modal-html-'.$languageCodeId.'-'.$templateId; - $class = ''; + $filePath = HESK_PATH . 'language/'.$_POST['language'].'/emails/'.$_POST['template']; + if ($_POST['html'] == '1') { + $filePath = HESK_PATH . 'language/'.$_POST['language'].'/emails/html/'.$_POST['template']; + } - if ($html) { - $title = sprintf($hesklang['editing_html_template'], $template); - $content = file_get_contents(HESK_PATH . 'language/'.$languageCode.'/emails/html/'.$template); - $class = 'htmlEditor'; + $success = file_put_contents($filePath, $_POST['text']); + if ($success === false) { + hesk_process_messages($hesklang[''], 'manage_email_templates.php'); } else { - $id = str_replace('html-', '', $id); - $title = sprintf($hesklang['editing_template'], $template); - $content = file_get_contents(HESK_PATH . 'language/'.$languageCode.'/emails/'.$template); + $message = sprintf($hesklang['email_template_saved'], $_POST['template']); + hesk_process_messages($message,'manage_email_templates.php','SUCCESS'); } - return ' - '; +} + +function getSpecialTagMap() { + global $hesk_settings, $modsForHesk_settings, $hesklang; + + $map = array(); + $map['%%NAME%%'] = $hesklang['customer_name']; + $map['%%EMAIL%%'] = $hesklang['customer_email']; + $map['%%SUBJECT%%'] = $hesklang['ticket_subject']; + $map['%%MESSAGE%%'] = $hesklang['ticket_message']; + $map['%%CREATED%%'] = $hesklang['ticket_created']; + $map['%%UPDATED%%'] = $hesklang['ticket_updated']; + $map['%%TRACK_ID%%'] = $hesklang['ticket_trackID']; + $map['%%TRACK_URL%%'] = $hesklang['ticket_url']; + $map['%%SITE_TITLE%%'] = $hesklang['wbst_title']; + $map['%%SITE_URL%%'] = $hesklang['wbst_url']; + $map['%%CATEGORY%%'] = $hesklang['ticket_category']; + $map['%%OWNER%%'] = $hesklang['ticket_owner']; + $map['%%PRIORITY%%'] = $hesklang['ticket_priority']; + $map['%%STATUS%%'] = $hesklang['ticket_status']; + + $i = 1; + foreach ($hesk_settings['custom_fields'] as $key => $value) { + if ($value['use']) { + $uppercaseKey = strtoupper($key); + $map['%%'.$uppercaseKey.'%%'] = sprintf($hesklang['custom_field_x'], $i++); + } + } + + return $map; } \ No newline at end of file diff --git a/css/hesk_newStyle.php b/css/hesk_newStyle.php index ce577fcc..adda1d59 100644 --- a/css/hesk_newStyle.php +++ b/css/hesk_newStyle.php @@ -390,3 +390,7 @@ button.dropdown-submit { max-width: 80px; cursor: pointer; } + +.plaintext-editor { + font-family: monospace; +} diff --git a/language/en/emails/html/category_moved.txt b/language/en/emails/html/category_moved.txt index a2d87b36..8f254ac9 100644 --- a/language/en/emails/html/category_moved.txt +++ b/language/en/emails/html/category_moved.txt @@ -1,10 +1,7 @@

Hello,

A new support ticket has been moved to your category. Ticket details:

-

Ticket subject: %%SUBJECT%%
-Tracking ID: %%TRACK_ID%%

-

You can manage this ticket here: -%%TRACK_URL%%

-
+

Ticket subject: %%SUBJECT%%
Tracking ID: %%TRACK_ID%%

+

You can manage this ticket here: %%TRACK_URL%%

+

 

Regards,

-%%SITE_TITLE%%
-%%SITE_URL%% \ No newline at end of file +

%%SITE_TITLE%%
%%SITE_URL%%

\ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index b202aa23..2eb3537b 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -26,8 +26,27 @@ $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_template'] = 'Editing plain text template %s'; // %s: The name of the template file (XXXX.txt) +$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['show_special_tags'] = 'Show Special Tags'; +$hesklang['hide_special_tags'] = 'Hide Special Tags'; +$hesklang['special_tag'] = 'Special Tag'; +$hesklang['description'] = 'Description'; +$hesklang['customer_name'] = 'Customer name'; +$hesklang['customer_email'] = 'Customer email'; +$hesklang['ticket_subject'] = 'Ticket subject'; +$hesklang['ticket_message'] = 'Ticket/Reply message'; +$hesklang['ticket_created'] = 'Date and time of ticket submission'; +$hesklang['ticket_updated'] = 'Date and time of ticket last update'; +$hesklang['ticket_url'] = 'Ticket URL address'; +$hesklang['ticket_category'] = 'Ticket category'; +$hesklang['ticket_owner'] = 'Staff member assigned to the ticket'; +$hesklang['ticket_priority'] = 'Ticket priority'; +$hesklang['custom_field_x'] = 'Custom field %s'; // %s: Custom field #1-20 +$hesklang['email_template_saved'] = 'The email template %s has been saved.'; // %s: Template file name +$hesklang['error_saving_template'] = 'An error occurred when trying to save the email template!'; +$hesklang['email_template_directory_not_writable'] = 'The email template %s is not writable by HESK. Please CHMOD it to 0666.'; // %s: template file name + // ADDED OR MODIFIED IN Mods for HESK 2.1.1 $hesklang['new_article_default_type'] = 'Default Type for New Articles'; From 570ab0e54fe874ce9e2459cbe2693bc2df58c000 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 8 Apr 2015 11:41:43 -0400 Subject: [PATCH 52/93] #169 Add can_manage_email_template permission --- admin/manage_email_templates.php | 2 +- inc/admin_functions.inc.php | 12 ++++++++++++ install/mods-for-hesk/sql/installSql.php | 17 ++++++++++++++--- install/mods-for-hesk/sql/uninstallSql.php | 8 ++++++++ language/en/text.php | 4 ++-- 5 files changed, 37 insertions(+), 6 deletions(-) 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'; From 61fed97bfe858e12a34f7887651308c1304dcd15 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 8 Apr 2015 17:09:39 -0400 Subject: [PATCH 53/93] #169 Don't use a dedicated column --- install/mods-for-hesk/sql/installSql.php | 3 --- install/mods-for-hesk/sql/uninstallSql.php | 8 -------- 2 files changed, 11 deletions(-) diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 4f6245c8..84fddf67 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -402,8 +402,5 @@ 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 471edb31..d8f2b7b4 100644 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ b/install/mods-for-hesk/sql/uninstallSql.php @@ -136,12 +136,4 @@ 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 From 0fce992568dd1a3fc6d2a7461c7baa0069db937e Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 8 Apr 2015 17:09:56 -0400 Subject: [PATCH 54/93] #169 Show link to other tools pages --- admin/banned_emails.php | 9 +++++++++ admin/banned_ips.php | 9 +++++++++ admin/manage_users.php | 1 + admin/service_messages.php | 10 ++++++++++ language/en/text.php | 1 + 5 files changed, 30 insertions(+) diff --git a/admin/banned_emails.php b/admin/banned_emails.php index 2151160d..9599d650 100644 --- a/admin/banned_emails.php +++ b/admin/banned_emails.php @@ -89,6 +89,15 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ' . $hesklang['sm_title'] . ' '; } + + // Show a link to email tpl management if user has permission to do so + if (hesk_checkPermission('can_man_email_tpl', 0)) { + echo ' +

  • + '.$hesklang['email_templates'].' +
  • + '; + } ?>
    diff --git a/admin/banned_ips.php b/admin/banned_ips.php index e4599c36..1edc5672 100644 --- a/admin/banned_ips.php +++ b/admin/banned_ips.php @@ -92,6 +92,15 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ' . $hesklang['sm_title'] . ' '; } + + // Show a link to email tpl management if user has permission to do so + if (hesk_checkPermission('can_man_email_tpl', 0)) { + echo ' +
  • + '.$hesklang['email_templates'].' +
  • + '; + } ?>
    diff --git a/admin/manage_users.php b/admin/manage_users.php index 6245a89b..c03e84af 100644 --- a/admin/manage_users.php +++ b/admin/manage_users.php @@ -77,6 +77,7 @@ $hesk_settings['features'] = array( 'can_ban_ips', /* User can ban IP addresses */ 'can_unban_ips', /* User can delete IP bans. Also enables "can_ban_ips" */ 'can_service_msg', /* User can manage service messages shown in customer interface */ +'can_man_email_tpl', /* User can manage email templates */ ); /* Set default values */ diff --git a/admin/service_messages.php b/admin/service_messages.php index df4f374a..30d5155e 100644 --- a/admin/service_messages.php +++ b/admin/service_messages.php @@ -92,6 +92,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); + + '.$hesklang['email_templates'].' + + '; + } + ?>