Merge pull request #306 from mkoch227/update-installation

Update installer, fix status issues, fix TinyMCE issues
merge-requests/2/head
Mike Koch 9 years ago
commit 61fae1013a

@ -1943,7 +1943,7 @@ function hesk_printReplyForm() {
function hesk_printCanned()
{
global $hesklang, $hesk_settings, $can_reply, $ticket;
global $hesklang, $hesk_settings, $can_reply, $ticket, $modsForHesk_settings;
/* Can user reply to tickets? */
if ( ! $can_reply)
@ -1972,13 +1972,19 @@ function hesk_printCanned()
while ($mysaved = hesk_dbFetchRow($res))
{
$can_options .= '<option value="' . $mysaved[0] . '">' . $mysaved[1]. "</option>\n";
echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n";
if ($modsForHesk_settings['rich_text_for_tickets']) {
echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved[2]))."';\n";
} else {
echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n";
}
}
?>
function setMessage(msgid)
{
var isHtml = <?php echo hesk_jsString($modsForHesk_settings['rich_text_for_tickets']); ?>;
var myMsg=myMsgTxt[msgid];
if (myMsg == '')
@ -2021,12 +2027,23 @@ function hesk_printCanned()
{
if (document.getElementById('moderep').checked)
{
document.getElementById('HeskMsg').innerHTML='<textarea class="form-control" name="message" id="message" rows="12" cols="72">'+myMsg+'</textarea>';
if (isHtml){
tinymce.get("message").setContent('');
tinymce.get("message").execCommand('mceInsertRawHTML', false, myMsg);
} else {
document.getElementById('message').value = myMsg;
}
}
else
{
var oldMsg = document.getElementById('message').value;
document.getElementById('HeskMsg').innerHTML='<textarea class="form-control" name="message" id="message" rows="12" cols="72">'+oldMsg+myMsg+'</textarea>';
if (isHtml) {
var oldMsg = tinymce.get("message").getContent();
tinymce.get("message").setContent('');
tinymce.get("message").execCommand('mceInsertRawHTML', false, oldMsg + myMsg);
} else {
var oldMsg = document.getElementById('message').value;
document.getElementById('message').value = oldMsg + myMsg;
}
}
}
else

@ -159,8 +159,12 @@ function hesk_insertAtCursor(myField, myValue) {
$options .= '>'.$mysaved['title'].'</option>';
$javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n";
$javascript_titles.='myTitle['.$mysaved['id'].']=\''.addslashes($mysaved['title'])."';\n";
if ($modsForHesk_settings['rich_text_for_tickets']) {
$javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved['message']) )."';\n";
} else {
$javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n";
}
echo '
<tr>

@ -644,8 +644,13 @@ function createStatus() {
$row = hesk_dbFetchRow($res);
$my_order = $row[0]+10;
$insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Key`, `TextColor`, `IsClosed`, `Closable`, `sort`)
VALUES ('STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")";
// Get the next status id
$res = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `ID` DESC LIMIT 1");
$row = hesk_dbFetchAssoc($res);
$nextId = $row['ID'] + 1;
$insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`ID`, `Key`, `TextColor`, `IsClosed`, `Closable`, `sort`)
VALUES (".intval($nextId).", 'STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")";
hesk_dbQuery($insert);
$newStatusId = hesk_dbInsertID();

@ -563,7 +563,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
while ($mysaved = hesk_dbFetchRow($res))
{
$can_options .= '<option value="' . $mysaved[0] . '">' . $mysaved[1]. "</option>\n";
echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n";
if ($modsForHesk_settings['rich_text_for_tickets']) {
echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved[2]))."';\n";
} else {
echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n";
}
echo 'mySubjectTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[1]))."';\n";
}

@ -1962,10 +1962,11 @@ function mfh_getDisplayTextForStatusId($statusId) {
$statusRs = hesk_dbQuery("SELECT `text`, `Key`, `language` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `statuses`
LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` ON `status_id` = `statuses`.`ID`
AND `language` = '".hesk_dbEscape($hesk_settings['language'])."'
WHERE `statuses`.`ID` = ".intval($statusId));
$statusRec = hesk_dbFetchAssoc($statusRs);
if ($statusRec['language'] == $hesk_settings['language'] && $statusRec['text'] != NULL) {
if ($statusRec['text'] != NULL) {
// We found a record. Use the text field
return $statusRec['text'];
} else {

@ -37,7 +37,7 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
// We will be installing this HESK version:
define('HESK_NEW_VERSION','2.6.4');
define('MODS_FOR_HESK_NEW_VERSION','2.3.2');
define('MODS_FOR_HESK_NEW_VERSION','2.4.0');
define('REQUIRE_PHP_VERSION','5.0.0');
define('REQUIRE_MYSQL_VERSION','5.0.7');

@ -45,6 +45,9 @@ if ($version == 1) {
execute231Scripts();
} elseif ($version == 232) {
execute232Scripts();
} elseif ($version == 240) {
execute240Scripts();
execute240FileUpdate();
} else {
$response = 'The version "'.$version.'" was not recognized. Check the value submitted and try again.';
print $response;

@ -58,6 +58,9 @@ function echoInitialVersionRows($version) {
if ($version < 232) {
printRow('v2.3.2');
}
if ($version < 240) {
printRow('v2.4.0');
}
}
function printRow($version) {
@ -107,7 +110,7 @@ function printRow($version) {
<?php echoInitialVersionRows($startingVersion); ?>
</tbody>
</table>
<?php if ($startingVersion < 200) { ?>
<?php if ($startingVersion < 240) { ?>
<table class="table table-striped" style="table-layout: fixed">
<thead>
<tr>
@ -116,10 +119,12 @@ function printRow($version) {
</tr>
</thead>
<tbody>
<?php if ($startingVersion < 200): ?>
<tr id="row-banmigrate">
<td>Migrate IP / Email Bans</td>
<td><i id="spinner-banmigrate" class="fa fa-spinner"></i> <span id="span-banmigrate">Waiting...</span></td>
</tr>
<?php endif; ?>
<tr id="row-initialize-statuses">
<td>Initialize Statuses</td>
<td><i id="spinner-initialize-statuses" class="fa fa-spinner"></i> <span id="span-initialize-statuses">Waiting...</span></td>

@ -47,6 +47,9 @@ function processUpdates(startingVersion) {
} else if (startingVersion < 232) {
startVersionUpgrade('232');
executeUpdate(232, '232', '2.3.2');
} else if (startingVersion < 240) {
startVersionUpgrade('240');
executeUpdate(240, '240', '2.4.0');
} else {
installationFinished();
}

@ -137,6 +137,17 @@ hesk_dbConnect();
}
?>
<div class="row">
<div class="col-md-3 col-sm-12">
<?php
if ($version == '2.3.2') {
$v232btn = 'btn-success';
$disableAllExcept = '232';
} else {
$v232btn = 'btn-default';
}
?>
<a id="232" class="btn <?php echo $v232btn; ?> btn-block disablable" href="installModsForHesk.php?v=232">v2.3.2</a>
</div>
<div class="col-md-3 col-sm-12">
<?php
if ($version == '2.3.1') {
@ -170,6 +181,9 @@ hesk_dbConnect();
?>
<a id="221" class="btn <?php echo $v221btn; ?> btn-block disablable" href="installModsForHesk.php?v=221">v2.2.1</a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3 col-sm-12">
<?php
if ($version == '2.2.0') {
@ -181,9 +195,6 @@ hesk_dbConnect();
?>
<a id="220" class="btn <?php echo $v220btn; ?> btn-block disablable" href="installModsForHesk.php?v=220">v2.2.0</a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3 col-sm-12">
<?php
if ($version == '2.1.1') {
@ -217,6 +228,9 @@ hesk_dbConnect();
?>
<a id="201" class="btn <?php echo $v201btn; ?> btn-block disablable" href="installModsForHesk.php?v=201">v2.0.1</a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3 col-sm-12">
<?php
if ($version == '2.0.0') {
@ -228,9 +242,6 @@ hesk_dbConnect();
?>
<a id="200" class="btn <?php echo $v200btn; ?> btn-block disablable" href="installModsForHesk.php?v=200">v2.0.0</a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3 col-sm-12">
<?php
if ($version == '1.7.0') {
@ -265,12 +276,12 @@ hesk_dbConnect();
?>
<a id="160" class="btn <?php echo $v160btn; ?> btn-block disablable" href="installModsForHesk.php?v=160">v1.6.0</a>
</div>
<div class="col-md-3 col-sm-12">
<a id="150" class="btn btn-default btn-block disablable" href="installModsForHesk.php?v=150">v1.5.0</a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3 col-sm-12">
<a id="150" class="btn btn-default btn-block disablable" href="installModsForHesk.php?v=150">v1.5.0</a>
</div>
<div class="col-md-3 col-sm-12">
<a id="141" class="btn btn-default btn-block disablable" href="installModsForHesk.php?v=141">v1.4.1</a>
</div>
@ -280,6 +291,9 @@ hesk_dbConnect();
<div class="col-md-3 col-sm-12">
<a id="130" class="btn btn-default btn-block disablable" href="installModsForHesk.php?v=130">v1.3.0</a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3 col-sm-12">
<a id="124" class="btn btn-default btn-block disablable" href="installModsForHesk.php?v=124">v1.2.4</a>
</div>

@ -1,7 +1,5 @@
<?php
define('IN_SCRIPT', 1);
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
function executeQuery($sql) {
global $hesk_last_query;
@ -564,13 +562,13 @@ function execute240Scripts() {
`show` ENUM('0','1') NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
executeQuery("INSERT INTO `hesk_quick_help_sections` (`location`, `show`)
executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections` (`location`, `show`)
VALUES ('create_ticket', '1')");
executeQuery("INSERT INTO `hesk_quick_help_sections` (`location`, `show`)
executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections` (`location`, `show`)
VALUES ('view_ticket_form', '1')");
executeQuery("INSERT INTO `hesk_quick_help_sections` (`location`, `show`)
executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections` (`location`, `show`)
VALUES ('view_ticket', '1')");
executeQuery("INSERT INTO `hesk_quick_help_sections` (`location`, `show`)
executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections` (`location`, `show`)
VALUES ('knowledgebase', '1')");
// Setup status improvement tables
@ -578,8 +576,7 @@ function execute240Scripts() {
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`language` VARCHAR(200) NOT NULL,
`text` VARCHAR(200) NOT NULL,
`status_id` INT NOT NULL,
PRIMARY KEY (`id`)) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
`status_id` INT NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ADD COLUMN `sort` INT");
$statusesRs = executeQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `ID` ASC");
$i = 10;
@ -599,19 +596,25 @@ function execute240Scripts() {
function initializeXrefTable() {
global $hesk_settings, $hesklang;
hesk_dbConnect();
$languages = array();
foreach ($hesk_settings['languages'] as $key => $value) {
$languages[$key] = $hesk_settings['languages'][$key]['folder'];
}
$statusesRs = executeQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`");
$oldSetting = $hesk_settings['can_sel_lang'];
$hesk_settings['can_sel_lang'] = 1;
while ($row = hesk_dbFetchAssoc($statusesRs)) {
foreach ($languages as $language => $languageCode) {
hesk_setLanguage($language);
$sql = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`)
VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($hesklang[$row['Key']])."', ".intval($row['ID']).")";
executeQuery($sql);
}
}
$hesk_settings['can_sel_lang'] = $oldSetting;
hesk_resetLanguage();
}
function execute240FileUpdate() {

@ -78,6 +78,10 @@ function removeOtherColumns() {
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` DROP COLUMN `manager`");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` DROP COLUMN `permission_template`");
executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates`");
executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections`");
executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref`");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` DROP COLUMN `download_count`");
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_attachments` DROP COLUMN `download_count`");
// These queries are ran in case someone used an unfortunate installation they may have not properly cleaned up tables

Loading…
Cancel
Save