diff --git a/admin/admin_main.php b/admin/admin_main.php index 48dd7605..c6a2feb9 100644 --- a/admin/admin_main.php +++ b/admin/admin_main.php @@ -1,42 +1,40 @@ install folder from your server for security reasons then refresh this page!');} +if (is_dir(HESK_PATH . 'install')) { + die('Please delete the install folder from your server for security reasons then refresh this page!'); +} /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); @@ -49,8 +47,8 @@ hesk_session_start(); hesk_dbConnect(); hesk_isLoggedIn(); -define('CALENDAR',1); -define('MAIN_PAGE',1); +define('CALENDAR', 1); +define('MAIN_PAGE', 1); /* Print header */ require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); @@ -61,46 +59,40 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
'.$hesklang['na_view_tickets'].'
'; + require(HESK_PATH . 'inc/show_search_form.inc.php'); + } else { + echo '' . $hesklang['na_view_tickets'] . '
'; } $hesk_settings['hesk_license']('HMgPSAxOw0KaWYgKGZpbGVfZXhpc3RzKEhFU0tfUEFUSCAuI @@ -119,24 +111,19 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); F9ub3RpY2UnXS4nXCcpIj4nLiRoZXNrbGFuZ1snc2gnXS4nPC9hPjwvdGQ+PC90cj48L3RhYmxlPjxwP icuJGhlc2tsYW5nWydzdXBwb3J0X3JlbW92ZSddLicuIDxhIGhyZWY9Imh0dHBzOi8vd3d3Lmhlc2suY 29tL2J1eS5waHAiIHRhcmdldD0iX2JsYW5rIj4nLiRoZXNrbGFuZ1snY2xpY2tfaW5mbyddLic8L2E+P - C9wPic7DQp9DQo=',"\112"); + C9wPic7DQp9DQo=', "\112"); echo '- | - | - | - |
---|
+ | + | + | + | $pm[subject] | @@ -623,41 +575,41 @@ function mail_list_messages() EOC; - } // End while - ?> -
---|
- + 0 - else - { - echo '' . $hesklang['npm'] . '
'; + } // END if total > 0 + else { + echo '' . $hesklang['npm'] . '
'; } } // END mail_list_messages() @@ -665,74 +617,74 @@ EOC; function show_new_form() { - global $hesk_settings, $hesklang, $admins; - ?> -
'.$mycat['id'].' | -'.$mycat['name'].' | -'.$priorities[$mycat['priority']]['formatted'].' | -'.$all.' | +' . $mycat['id'] . ' | +' . $mycat['name'] . ' | +' . $priorities[$mycat['priority']]['formatted'] . ' | +' . $all . ' |
-
-
+
+
40% Complete (success)
|
- '.output_user_dropdown($mycat['id'], $mycat['manager'], $users).' | +' . output_user_dropdown($mycat['id'], $mycat['manager'], $users) . ' | - + ' . $autoassign_code . ' ' . $type_code . ' '; - if ($orderBy != 'name' && $num > 1) - { - if ($j == 1) - { - echo' '; - } - elseif ($j == $num) - { - echo' '; - } - else - { - echo' - - + if ($orderBy != 'name' && $num > 1) { + if ($j == 1) { + echo ' '; + } elseif ($j == $num) { + echo ' '; + } else { + echo ' + + '; } } - echo $remove_code.' | + echo $remove_code . '
'.$user['name'].'
'; + return '' . $user['name'] . '
'; } } - return ''.$hesklang['no_manager'].'
'; + return '' . $hesklang['no_manager'] . '
'; } else { $dropdownMarkup = ''; - return '- | - |
---|---|
- | - |
'.sprintf($hesklang['email_template_directory_not_writable'], $_GET['template']).'
++ | + |
---|---|
+ | + |
' . sprintf($hesklang['email_template_directory_not_writable'], $_GET['template']) . '
$languageCode): ?> | ||
---|---|---|
$languageCode): ?> - | - - | ++ + |
- | - | - | - | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
- - | -- - | -- '; - } - ?> - | -
-
+
+
+
-
-
+ |
' . $hesklang['no_ticket_tpl'] . '
'; } else { ?>- | - | |
---|---|---|
+ | + | |
'.$mysaved['title'].' | +' . $mysaved['title'] . ' | '; - if ($num > 1) - { - if ($j == 1) - { - echo' - - '; - } - elseif ($j == $num) - { - echo' '; - } - else - { - echo' - - + if ($num > 1) { + if ($j == 1) { + echo ' + + '; + } elseif ($j == $num) { + echo ' '; + } else { + echo ' + + '; } - } - else - { + } else { echo ''; } echo ' - | +
- | - | - | - - | - - | - |
---|---|---|---|---|---|
+ | + | + | + + | + + | + | $myuser[name] | $myuser[email] | @@ -329,48 +301,47 @@ echo <<'; + } -echo << |
+
- + /* Print main manage users page */ + require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); + ?> - +
*
'.$hesklang['custom_l'].': | - | + | ' . $hesklang['custom_l'] . ': | + | |
'.$hesklang['defw'].': | - | + | ' . $hesklang['defw'] . ': | + |
'.$hesklang['hidden_custom_field_help'].'
+' . $hesklang['hidden_custom_field_help'] . '
'.$hesklang['value_colon'].' | - | + | ' . $hesklang['value_colon'] . ' | + |
'.$hesklang['readonly_custom_field_help'].'
+' . $hesklang['readonly_custom_field_help'] . '
'.$hesklang['value_colon'].' | - | + | ' . $hesklang['value_colon'] . ' | + |
'.$hesklang['rows'].': | - | + | ' . $hesklang['rows'] . ': | + | |
'.$hesklang['cols'].': | - | + | ' . $hesklang['cols'] . ': | + |
'.$hesklang['opt2'].'
-' . $hesklang['opt2'] . '
+'.$hesklang['opt3'].'
+' . $hesklang['opt3'] . '
-'.$hesklang['opt4'].'
-' . $hesklang['opt4'] . '
+'.$hesklang['date_custom_field_text'].'
'; + echo '' . $hesklang['date_custom_field_text'] . '
'; break; case 'multiselect': - $options=str_replace('#HESK#',"\n",$query); + $options = str_replace('#HESK#', "\n", $query); echo ' -'.$hesklang['multiple_select_custom_field_text'].'
-' . $hesklang['multiple_select_custom_field_text'] . '
+'.$hesklang['email_custom_field_help'].'
+' . $hesklang['email_custom_field_help'] . '
'.$hesklang['email_custom_field_label'].': | +' . $hesklang['email_custom_field_label'] . ': |
|
{$hesklang['roo']}
"; + } - /* Populate category counts */ - foreach ($cat as $id => $name) - { - $tickets[$id] = array( - 'num_tickets' => 0, - 'resolved' => 0, - 'all_replies' => 0, - 'staff_replies' => 0, - 'worked' => '', - ); + /* Report type */ + switch ($type) { + case 2: + hesk_ticketsByMonth(); + break; + case 3: + hesk_ticketsByUser(); + break; + case 4: + hesk_ticketsByCategory(); + break; + default: + hesk_ticketsByDay(); } - /* SQL query for category stats */ - $res = hesk_dbQuery("SELECT `category`, COUNT(*) AS `num_tickets`, ".($hesk_settings['time_worked'] ? "SUM( TIME_TO_SEC(`time_worked`) ) AS `seconds_worked`," : '')." SUM(`replies`) AS `all_replies`, SUM(staffreplies) AS `staff_replies` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE {$hesk_settings['dt_sql']} " . ( $can_run_reports_full ? "" : " AND `t1`.`owner` = '" . intval($_SESSION['id']) . "'" ) . " GROUP BY `category`"); - /* Update ticket values */ - while ($row = hesk_dbFetchAssoc($res)) + /*** START FUNCTIONS ***/ + + + function hesk_ticketsByCategory() { - if ( ! $hesk_settings['time_worked']) - { - $row['seconds_worked'] = 0; + global $hesk_settings, $hesklang, $date_from, $date_to, $can_run_reports_full; + + /* List of categories */ + $cat = array(); + $res = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE " . ($can_run_reports_full ? '1' : hesk_myCategories('id')) . " ORDER BY `id` ASC"); + while ($row = hesk_dbFetchAssoc($res)) { + $cat[$row['id']] = $row['name']; } - if (isset($cat[$row['category']])) - { - $tickets[$row['category']]['num_tickets'] += $row['num_tickets']; - $tickets[$row['category']]['all_replies'] += $row['all_replies']; - $tickets[$row['category']]['staff_replies'] += $row['staff_replies']; - $tickets[$row['category']]['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($row['seconds_worked']) : 0; + $tickets = array(); + $totals = array('num_tickets' => 0, 'resolved' => 0, 'all_replies' => 0, 'staff_replies' => 0, 'worked' => 0); + + /* Populate category counts */ + foreach ($cat as $id => $name) { + $tickets[$id] = array( + 'num_tickets' => 0, + 'resolved' => 0, + 'all_replies' => 0, + 'staff_replies' => 0, + 'worked' => '', + ); } - else - { - /* Category deleted */ - if ( ! isset($tickets[9999]) ) - { - $cat[9999] = $hesklang['catd']; - $tickets[9999] = array('num_tickets' => $row['num_tickets'], 'resolved' => 0, 'all_replies' => $row['all_replies'], 'staff_replies' => $row['staff_replies'], 'worked' => $row['seconds_worked']); + + /* SQL query for category stats */ + $res = hesk_dbQuery("SELECT `category`, COUNT(*) AS `num_tickets`, " . ($hesk_settings['time_worked'] ? "SUM( TIME_TO_SEC(`time_worked`) ) AS `seconds_worked`," : '') . " SUM(`replies`) AS `all_replies`, SUM(staffreplies) AS `staff_replies` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE {$hesk_settings['dt_sql']} " . ($can_run_reports_full ? "" : " AND `t1`.`owner` = '" . intval($_SESSION['id']) . "'") . " GROUP BY `category`"); + + /* Update ticket values */ + while ($row = hesk_dbFetchAssoc($res)) { + if (!$hesk_settings['time_worked']) { + $row['seconds_worked'] = 0; } - else - { - $tickets[9999]['num_tickets'] += $row['num_tickets']; - $tickets[9999]['all_replies'] += $row['all_replies']; - $tickets[9999]['staff_replies'] += $row['staff_replies']; - $tickets[9999]['worked'] += $row['seconds_worked']; + + if (isset($cat[$row['category']])) { + $tickets[$row['category']]['num_tickets'] += $row['num_tickets']; + $tickets[$row['category']]['all_replies'] += $row['all_replies']; + $tickets[$row['category']]['staff_replies'] += $row['staff_replies']; + $tickets[$row['category']]['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($row['seconds_worked']) : 0; + } else { + /* Category deleted */ + if (!isset($tickets[9999])) { + $cat[9999] = $hesklang['catd']; + $tickets[9999] = array('num_tickets' => $row['num_tickets'], 'resolved' => 0, 'all_replies' => $row['all_replies'], 'staff_replies' => $row['staff_replies'], 'worked' => $row['seconds_worked']); + } else { + $tickets[9999]['num_tickets'] += $row['num_tickets']; + $tickets[9999]['all_replies'] += $row['all_replies']; + $tickets[9999]['staff_replies'] += $row['staff_replies']; + $tickets[9999]['worked'] += $row['seconds_worked']; + } } + + $totals['num_tickets'] += $row['num_tickets']; + $totals['all_replies'] += $row['all_replies']; + $totals['staff_replies'] += $row['staff_replies']; + $totals['worked'] += $row['seconds_worked']; } - $totals['num_tickets'] += $row['num_tickets']; - $totals['all_replies'] += $row['all_replies']; - $totals['staff_replies'] += $row['staff_replies']; - $totals['worked'] += $row['seconds_worked']; - } + // Get number of resolved tickets + $res = hesk_dbQuery("SELECT COUNT(*) AS `num_tickets` , `category` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `status` IN (SELECT `ID` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `IsClosed` = 1) " . ($can_run_reports_full ? "" : " AND `owner` = '" . intval($_SESSION['id']) . "'") . " AND {$hesk_settings['dt_sql']} GROUP BY `category`"); - // Get number of resolved tickets - $res = hesk_dbQuery("SELECT COUNT(*) AS `num_tickets` , `category` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` IN (SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `IsClosed` = 1) " . ( $can_run_reports_full ? "" : " AND `owner` = '" . intval($_SESSION['id']) . "'" ) . " AND {$hesk_settings['dt_sql']} GROUP BY `category`"); + // Update number of open and resolved tickets + while ($row = hesk_dbFetchAssoc($res)) { + if (isset($cat[$row['category']])) { + $tickets[$row['category']]['resolved'] += $row['num_tickets']; + } else { + // Category deleted + $tickets[9999]['resolved'] += $row['num_tickets']; + } - // Update number of open and resolved tickets - while ($row = hesk_dbFetchAssoc($res)) - { - if (isset($cat[$row['category']])) - { - $tickets[$row['category']]['resolved'] += $row['num_tickets']; - } - else - { - // Category deleted - $tickets[9999]['resolved'] += $row['num_tickets']; + $totals['resolved'] += $row['num_tickets']; } - $totals['resolved'] += $row['num_tickets']; - } - - // Convert total seconds worked to HH:MM:SS - $totals['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($totals['worked']) : 0; - if ( isset($tickets[9999]) ) - { - $tickets[9999]['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($tickets[9999]['worked']) : 0; - } + // Convert total seconds worked to HH:MM:SS + $totals['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($totals['worked']) : 0; + if (isset($tickets[9999])) { + $tickets[9999]['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($tickets[9999]['worked']) : 0; + } - ?> + ?>- | - | - | - | - | - '.$hesklang['ts'].''; - } - ?> - |
---|---|---|---|---|---|
- | - | - | - | - | - '.$totals['worked'].''; - } - ?> - | + | + | + | + | + | + ' . $hesklang['ts'] . ''; + } + ?> + + + 10) { + ?> + |
+ | + | + | + | + | + ' . $totals['worked'] . ''; + } + ?> + |
- | - | - | - | - | - '.$d['worked'].''; - } - ?> - |
- | - | - | - | - | - '.$totals['worked'].''; - } - ?> - |
+ | + | + | + | + | + ' . $d['worked'] . ''; + } + ?> + |
+ | + | + | + | + | + ' . $totals['worked'] . ''; + } + ?> + |
- | - | - | - | - | - '.$hesklang['ts'].''; + |
---|---|---|---|---|---|
+ | + | + | + | + | + ' . $hesklang['ts'] . ''; } - ?> - |
- | - | - | - | - | - '.$totals['worked'].''; - } - ?> - |
+ | + | + | + | + | + ' . $totals['worked'] . ''; + } + ?> + |
- | - | - | - | - | - '.$d['worked'].''; - } - ?> - |
- | - | - | - | - | - '.$totals['worked'].''; - } - ?> - |
+ | + | + | + | + | + ' . $d['worked'] . ''; + } + ?> + |
+ | + | + | + | + | + ' . $totals['worked'] . ''; + } + ?> + |
- | - | - | - '.$hesklang['ts'].''; - } - ?> - |
---|---|---|---|
- | - | - | - '.$totals['worked'].''; - } - ?> - |
- | - | - | - '.$d['worked'].''; - } - ?> - |
- | - | - | - '.$d['worked'].''; - } - ?> - |
- | - | - | - '.$hesklang['ts'].''; - } - ?> - |
---|---|---|---|
- | - | - | - '.$totals['worked'].''; - } - ?> - |
- | - | - | - '.$d['worked'].''; - } - ?> - |
+ | + | + | + ' . $hesklang['ts'] . ''; + } + ?> + |
---|---|---|---|
+ | + | + | + ' . $totals['worked'] . ''; + } + ?> + |
+ | + | + | + ' . $d['worked'] . ''; + } + ?> + |
+ | + | + | + ' . $totals['worked'] . ''; + } + ?> + |
' . $hesklang['no_sm'] . '
'; + } else { // List of staff - if ( ! isset($admins) ) - { + if (!isset($admins)) { $admins = array(); - $res2 = hesk_dbQuery("SELECT `id`,`name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users`"); - while ($row=hesk_dbFetchAssoc($res2)) - { - $admins[$row['id']]=$row['name']; + $res2 = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users`"); + while ($row = hesk_dbFetchAssoc($res2)) { + $admins[$row['id']] = $row['name']; } } ?>- | - | - | - |
---|---|---|---|
+ | + | + | + |
-
-
-
-
- |
- - | - | - 1) - { - if ($k == 1) - { - ?> - - - + + |
+
+
+
+
+ |
+ + | + | + 1) { + if ($k == 1) { + ?> + + + - - - + } elseif ($k == $num) { + ?> + + + - - - - + } else { + ?> + + + + - - - - | -
'.$hesklang['click_login'].''); - } - else - { - return false; + if (isset($_SESSION['heskprivileges']) && strpos($_SESSION['heskprivileges'], $feature) === false) { + if ($showerror) { + hesk_error($hesklang['no_permission'] . '
' . $hesklang['click_login'] . ''); + } else { + return false; } - } - else - { + } else { return true; } diff --git a/inc/attachments.inc.php b/inc/attachments.inc.php index 1fbc89b0..001ec25b 100644 --- a/inc/attachments.inc.php +++ b/inc/attachments.inc.php @@ -1,85 +1,77 @@ $hesk_settings['attachments']['max_size']) - { - return hesk_fileError(sprintf($hesklang['file_too_large'], $file_realname)); - } - else - { - $file_size = $_FILES['attachment']['size'][$i]; - } - - /* Generate a random file name */ - $useChars='AEUYBDGHJLMNPQRSTVWXZ123456789'; - $tmp = uniqid(); - for($j=1;$j<10;$j++) - { - $tmp .= $useChars{mt_rand(0,29)}; - } - - if (defined('KB')) - { - $file_name = substr(md5($tmp . $file_realname), 0, 200) . $ext; } - else - { - $file_name = substr($trackingID . '_' . md5($tmp . $file_realname), 0, 200) . $ext; + + /* Check file size */ + if ($_FILES['attachment']['size'][$i] > $hesk_settings['attachments']['max_size']) { + return hesk_fileError(sprintf($hesklang['file_too_large'], $file_realname)); + } else { + $file_size = $_FILES['attachment']['size'][$i]; + } + + /* Generate a random file name */ + $useChars = 'AEUYBDGHJLMNPQRSTVWXZ123456789'; + $tmp = uniqid(); + for ($j = 1; $j < 10; $j++) { + $tmp .= $useChars{mt_rand(0, 29)}; + } + + if (defined('KB')) { + $file_name = substr(md5($tmp . $file_realname), 0, 200) . $ext; + } else { + $file_name = substr($trackingID . '_' . md5($tmp . $file_realname), 0, 200) . $ext; } // Does the temporary file exist? If not, probably server-side configuration limits have been reached @@ -91,52 +83,50 @@ function hesk_uploadFile($i, $isTicket = true) } */ - /* If upload was successful let's create the headers */ - $directory = $hesk_settings['attach_dir']; - if (!$isTicket) { - $directory = $modsForHesk_settings['kb_attach_dir']; - } - if ( ! move_uploaded_file($_FILES['attachment']['tmp_name'][$i], dirname(dirname(__FILE__)).'/'.$directory.'/'.$file_name)) - { - return hesk_fileError($hesklang['cannot_move_tmp']); - } - - $info = array( - 'saved_name'=> $file_name, - 'real_name' => $file_realname, - 'size' => $file_size - ); - - return $info; + /* If upload was successful let's create the headers */ + $directory = $hesk_settings['attach_dir']; + if (!$isTicket) { + $directory = $modsForHesk_settings['kb_attach_dir']; + } + if (!move_uploaded_file($_FILES['attachment']['tmp_name'][$i], dirname(dirname(__FILE__)) . '/' . $directory . '/' . $file_name)) { + return hesk_fileError($hesklang['cannot_move_tmp']); + } + + $info = array( + 'saved_name' => $file_name, + 'real_name' => $file_realname, + 'size' => $file_size + ); + + return $info; } // End hesk_uploadFile() function hesk_fileError($error) { - global $hesk_settings, $hesklang, $trackingID; + global $hesk_settings, $hesklang, $trackingID; global $hesk_error_buffer; - $hesk_error_buffer['attachments'] = $error; + $hesk_error_buffer['attachments'] = $error; - return false; + return false; } // End hesk_fileError() function hesk_removeAttachments($attachments, $isTicket) { - global $hesk_settings, $hesklang, $modsForHesk_settings; + global $hesk_settings, $hesklang, $modsForHesk_settings; - $directory = $hesk_settings['attach_dir']; - if (!$isTicket) { - $directory = $modsForHesk_settings['kb_attach_dir']; - } + $directory = $hesk_settings['attach_dir']; + if (!$isTicket) { + $directory = $modsForHesk_settings['kb_attach_dir']; + } - $hesk_settings['server_path'] = dirname(dirname(__FILE__)).'/'.$directory.'/'; + $hesk_settings['server_path'] = dirname(dirname(__FILE__)) . '/' . $directory . '/'; - foreach ($attachments as $myatt) - { - hesk_unlink($hesk_settings['server_path'].$myatt['saved_name']); - } + foreach ($attachments as $myatt) { + hesk_unlink($hesk_settings['server_path'] . $myatt['saved_name']); + } - return true; + return true; } // End hesk_removeAttachments() diff --git a/inc/common.inc.php b/inc/common.inc.php index bdcdbc97..62406c11 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -1,66 +1,58 @@
'.$hesklang['warn'].'
'.$hesklang['dmod'].'
' . $hesklang['warn'] . '
' . $hesklang['dmod'] . '
+
- - - + + + -
-
+
- + + = ($half = ($ceil = ceil($num))- 0.5) + 0.25) - { - return $ceil; - } - elseif ($num < $half - 0.25) - { - return floor($num); - } - else - { - return $half; + if ($num >= ($half = ($ceil = ceil($num)) - 0.5) + 0.25) { + return $ceil; + } elseif ($num < $half - 0.25) { + return floor($num); + } else { + return $half; } } // END hesk_round_to_half() -function hesk_dateToString($dt, $returnName=1, $returnTime=0, $returnMonth=0, $from_database=false) +function hesk_dateToString($dt, $returnName = 1, $returnTime = 0, $returnMonth = 0, $from_database = false) { global $hesk_settings, $hesklang; $dt = strtotime($dt); // Adjust MySQL time if different from PHP time - if ($from_database) - { - if ( ! defined('MYSQL_TIME_DIFF') ) - { - define('MYSQL_TIME_DIFF', time()-hesk_dbTime() ); + if ($from_database) { + if (!defined('MYSQL_TIME_DIFF')) { + define('MYSQL_TIME_DIFF', time() - hesk_dbTime()); } - if (MYSQL_TIME_DIFF != 0) - { + if (MYSQL_TIME_DIFF != 0) { $dt += MYSQL_TIME_DIFF; } // Add HESK set time difference - $dt += 3600*$hesk_settings['diff_hours'] + 60*$hesk_settings['diff_minutes']; + $dt += 3600 * $hesk_settings['diff_hours'] + 60 * $hesk_settings['diff_minutes']; // Daylight saving? - if ($hesk_settings['daylight'] && date('I', $dt)) - { + if ($hesk_settings['daylight'] && date('I', $dt)) { $dt += 3600; } } - list($y,$m,$n,$d,$G,$i,$s) = explode('-', date('Y-n-j-w-G-i-s', $dt) ); + list($y, $m, $n, $d, $G, $i, $s) = explode('-', date('Y-n-j-w-G-i-s', $dt)); - $m = $hesklang['m'.$m]; - $d = $hesklang['d'.$d]; + $m = $hesklang['m' . $m]; + $d = $hesklang['d' . $d]; - if ($returnName) - { + if ($returnName) { return "$d, $m $n, $y"; } - if ($returnTime) - { + if ($returnTime) { return "$d, $m $n, $y $G:$i:$s"; } - if ($returnMonth) - { + if ($returnMonth) { return "$m $y"; } return "$m $n, $y"; } // End hesk_dateToString() -function hesk_getFeatureArray() { +function hesk_getFeatureArray() +{ return array( - 'can_view_tickets', /* User can read tickets */ - 'can_reply_tickets', /* User can reply to tickets */ - 'can_del_tickets', /* User can delete tickets */ - 'can_edit_tickets', /* User can edit tickets */ - 'can_merge_tickets', /* User can merge tickets */ - 'can_del_notes', /* User can delete ticket notes posted by other staff members */ - 'can_change_cat', /* User can move ticke to a new category/department */ - 'can_man_kb', /* User can manage knowledgebase articles and categories */ - 'can_man_users', /* User can create and edit staff accounts */ - 'can_man_cat', /* User can manage categories/departments */ - 'can_man_canned', /* User can manage canned responses */ - 'can_man_ticket_tpl', /* User can manage ticket templates */ - 'can_add_archive', /* User can mark tickets as "Tagged" */ - 'can_assign_self', /* User can assign tickets to himself/herself */ - 'can_assign_others', /* User can assign tickets to other staff members */ - 'can_view_unassigned', /* User can view unassigned tickets */ - 'can_view_ass_others', /* User can view tickets that are assigned to other staff */ - 'can_run_reports', /* User can run reports and see statistics (only allowed categories and self) */ + 'can_view_tickets', /* User can read tickets */ + 'can_reply_tickets', /* User can reply to tickets */ + 'can_del_tickets', /* User can delete tickets */ + 'can_edit_tickets', /* User can edit tickets */ + 'can_merge_tickets', /* User can merge tickets */ + 'can_del_notes', /* User can delete ticket notes posted by other staff members */ + 'can_change_cat', /* User can move ticke to a new category/department */ + 'can_man_kb', /* User can manage knowledgebase articles and categories */ + 'can_man_users', /* User can create and edit staff accounts */ + 'can_man_cat', /* User can manage categories/departments */ + 'can_man_canned', /* User can manage canned responses */ + 'can_man_ticket_tpl', /* User can manage ticket templates */ + 'can_add_archive', /* User can mark tickets as "Tagged" */ + 'can_assign_self', /* User can assign tickets to himself/herself */ + 'can_assign_others', /* User can assign tickets to other staff members */ + 'can_view_unassigned', /* User can view unassigned tickets */ + 'can_view_ass_others', /* User can view tickets that are assigned to other staff */ + 'can_run_reports', /* User can run reports and see statistics (only allowed categories and self) */ 'can_run_reports_full', /* User can run reports and see statistics (unrestricted) */ - 'can_export', /* User can export own tickets to Excel */ - 'can_view_online', /* User can view what staff members are currently online */ - 'can_ban_emails', /* User can ban email addresses */ - 'can_unban_emails', /* User can delete email address bans. Also enables "can_ban_emails" */ - '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_export', /* User can export own tickets to Excel */ + 'can_view_online', /* User can view what staff members are currently online */ + 'can_ban_emails', /* User can ban email addresses */ + 'can_unban_emails', /* User can delete email address bans. Also enables "can_ban_emails" */ + '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 */ 'can_man_ticket_statuses', /* User can manage ticket statuses */ 'can_set_manager', /* User can set category managers */ @@ -1955,48 +1737,51 @@ function hesk_getFeatureArray() { ); } -function mfh_doesStatusHaveXrefRecord($statusId, $language) { - global $hesk_settings; +function mfh_doesStatusHaveXrefRecord($statusId, $language) +{ + global $hesk_settings; - $rs = hesk_dbQuery("SELECT 1 FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` - WHERE `language` = '".hesk_dbEscape($language)."' AND `status_id` = ".intval($statusId)); - return hesk_dbNumRows($rs) > 0; + $rs = hesk_dbQuery("SELECT 1 FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` + WHERE `language` = '" . hesk_dbEscape($language) . "' AND `status_id` = " . intval($statusId)); + return hesk_dbNumRows($rs) > 0; } -function mfh_getDisplayTextForStatusId($statusId) { - global $hesklang, $hesk_settings; - - $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['text'] != NULL) { - // We found a record. Use the text field - return $statusRec['text']; - } else { - // Fallback to the language key - return $hesklang[$statusRec['Key']]; - } +function mfh_getDisplayTextForStatusId($statusId) +{ + global $hesklang, $hesk_settings; + + $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['text'] != NULL) { + // We found a record. Use the text field + return $statusRec['text']; + } else { + // Fallback to the language key + return $hesklang[$statusRec['Key']]; + } } -function mfh_getNumberOfDownloadsForAttachment($att_id, $table='attachments') +function mfh_getNumberOfDownloadsForAttachment($att_id, $table = 'attachments') { - global $hesk_settings; + global $hesk_settings; - $res = hesk_dbQuery('SELECT `download_count` FROM `'.hesk_dbEscape($hesk_settings['db_pfix'].$table)."` WHERE `att_id` = ".intval($att_id)); - $rec = hesk_dbFetchAssoc($res); - return $rec['download_count']; + $res = hesk_dbQuery('SELECT `download_count` FROM `' . hesk_dbEscape($hesk_settings['db_pfix'] . $table) . "` WHERE `att_id` = " . intval($att_id)); + $rec = hesk_dbFetchAssoc($res); + return $rec['download_count']; } -function mfh_getSettings() { - global $hesk_settings; +function mfh_getSettings() +{ + global $hesk_settings; - $settings = array(); - $res = hesk_dbQuery("SELECT `Key`, `Value` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` WHERE `Key` <> 'modsForHeskVersion'"); - while ($row = hesk_dbFetchAssoc($res)) { - $settings[$row['Key']] = $row['Value']; - } - return $settings; + $settings = array(); + $res = hesk_dbQuery("SELECT `Key`, `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` <> 'modsForHeskVersion'"); + while ($row = hesk_dbFetchAssoc($res)) { + $settings[$row['Key']] = $row['Value']; + } + return $settings; } \ No newline at end of file diff --git a/inc/email_functions.inc.php b/inc/email_functions.inc.php index f2627b8c..db4599c1 100644 --- a/inc/email_functions.inc.php +++ b/inc/email_functions.inc.php @@ -1,56 +1,51 @@ $v) { + foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use']) { if ($v['type'] == 'email' && !empty($ticket[$k])) { if ($v['value'] == 'cc') { - $emails = explode(',',$ticket[$k]); + $emails = explode(',', $ticket[$k]); array_push($ccEmails, $emails); } elseif ($v['value'] == 'bcc') { - $emails = explode(',',$ticket[$k]); + $emails = explode(',', $ticket[$k]); array_push($bccEmails, $emails); } } @@ -88,32 +83,30 @@ function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $ac function hesk_notifyCustomer($modsForHesk_settings, $email_template = 'new_ticket') { - global $hesk_settings, $hesklang, $ticket; + global $hesk_settings, $hesklang, $ticket; - // Demo mode - if ( defined('HESK_DEMO') ) - { - return true; - } + // Demo mode + if (defined('HESK_DEMO')) { + return true; + } $changedLanguage = false; //Set the user's language according to the ticket. - if (isset($ticket['language']) && $ticket['language'] !== NULL) - { + if (isset($ticket['language']) && $ticket['language'] !== NULL) { hesk_setLanguage($ticket['language']); $changedLanguage = true; } - // Format email subject and message - $subject = hesk_getEmailSubject($email_template,$ticket); - $message = hesk_getEmailMessage($email_template,$ticket,$modsForHesk_settings); - $htmlMessage = hesk_getHtmlMessage($email_template,$ticket, $modsForHesk_settings); - $hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%', $modsForHesk_settings); + // Format email subject and message + $subject = hesk_getEmailSubject($email_template, $ticket); + $message = hesk_getEmailMessage($email_template, $ticket, $modsForHesk_settings); + $htmlMessage = hesk_getHtmlMessage($email_template, $ticket, $modsForHesk_settings); + $hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%', $modsForHesk_settings); // Add Cc / Bcc recipents if needed $ccEmails = array(); $bccEmails = array(); - foreach ($hesk_settings['custom_fields'] as $k=>$v) { + foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use']) { if ($v['type'] == 'email' && !empty($ticket[$k])) { if ($v['value'] == 'cc') { @@ -125,8 +118,8 @@ function hesk_notifyCustomer($modsForHesk_settings, $email_template = 'new_ticke } } - // Send e-mail - hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, $ccEmails, $bccEmails, $hasMessage); + // Send e-mail + hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, $ccEmails, $bccEmails, $hasMessage); // Reset the language if it was changed hesk_resetLanguage(); @@ -138,42 +131,39 @@ function hesk_notifyCustomer($modsForHesk_settings, $email_template = 'new_ticke function hesk_notifyAssignedStaff($autoassign_owner, $email_template, $modsForHesk_settings, $type = 'notify_assigned') { - global $hesk_settings, $hesklang, $ticket; + global $hesk_settings, $hesklang, $ticket; - // Demo mode - if ( defined('HESK_DEMO') ) - { - return true; - } + // Demo mode + if (defined('HESK_DEMO')) { + return true; + } - $ticket['owner'] = intval($ticket['owner']); + $ticket['owner'] = intval($ticket['owner']); /* Need to lookup owner info from the database? */ - if ($autoassign_owner === false) - { - $res = hesk_dbQuery("SELECT `name`, `email`,`language`,`notify_assigned`,`notify_reply_my` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`='" . $ticket['owner'] . "' LIMIT 1"); + if ($autoassign_owner === false) { + $res = hesk_dbQuery("SELECT `name`, `email`,`language`,`notify_assigned`,`notify_reply_my` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id`='" . $ticket['owner'] . "' LIMIT 1"); $autoassign_owner = hesk_dbFetchAssoc($res); - $hesk_settings['user_data'][$ticket['owner']] = $autoassign_owner; + $hesk_settings['user_data'][$ticket['owner']] = $autoassign_owner; - /* If owner selected not to be notified or invalid stop here */ - if ( empty($autoassign_owner[$type]) ) - { - return false; + /* If owner selected not to be notified or invalid stop here */ + if (empty($autoassign_owner[$type])) { + return false; } } - /* Set new language if required */ + /* Set new language if required */ hesk_setLanguage($autoassign_owner['language']); - /* Format email subject and message for staff */ - $subject = hesk_getEmailSubject($email_template,$ticket); - $message = hesk_getEmailMessage($email_template,$ticket,$modsForHesk_settings,1); - $htmlMessage = hesk_getHtmlMessage($email_template,$ticket,$modsForHesk_settings,1); - $hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%', $modsForHesk_settings); + /* Format email subject and message for staff */ + $subject = hesk_getEmailSubject($email_template, $ticket); + $message = hesk_getEmailMessage($email_template, $ticket, $modsForHesk_settings, 1); + $htmlMessage = hesk_getHtmlMessage($email_template, $ticket, $modsForHesk_settings, 1); + $hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%', $modsForHesk_settings); - /* Send email to staff */ - hesk_mail($autoassign_owner['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage); + /* Send email to staff */ + hesk_mail($autoassign_owner['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage); /* Reset language to original one */ hesk_resetLanguage(); @@ -183,94 +173,83 @@ function hesk_notifyAssignedStaff($autoassign_owner, $email_template, $modsForHe } // END hesk_notifyAssignedStaff() -function hesk_notifyStaff($email_template,$sql_where,$modsForHesk_settings,$is_ticket=1) +function hesk_notifyStaff($email_template, $sql_where, $modsForHesk_settings, $is_ticket = 1) { - global $hesk_settings, $hesklang, $ticket; - - // Demo mode - if ( defined('HESK_DEMO') ) - { - return true; - } - - $admins = array(); - - $res = hesk_dbQuery("SELECT `email`,`language`,`isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE $sql_where ORDER BY `language`"); - while ($myuser = hesk_dbFetchAssoc($res)) - { - /* Is this an administrator? */ - if ($myuser['isadmin']) - { - $admins[] = array('email' => $myuser['email'], 'language' => $myuser['language']); - continue; - } - - /* Not admin, is he/she allowed this category? */ - $myuser['categories']=explode(',',$myuser['categories']); - if (in_array($ticket['category'],$myuser['categories'])) - { - $admins[] = array('email' => $myuser['email'], 'language' => $myuser['language']); - continue; + global $hesk_settings, $hesklang, $ticket; + + // Demo mode + if (defined('HESK_DEMO')) { + return true; + } + + $admins = array(); + + $res = hesk_dbQuery("SELECT `email`,`language`,`isadmin`,`categories` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE $sql_where ORDER BY `language`"); + while ($myuser = hesk_dbFetchAssoc($res)) { + /* Is this an administrator? */ + if ($myuser['isadmin']) { + $admins[] = array('email' => $myuser['email'], 'language' => $myuser['language']); + continue; + } + + /* Not admin, is he/she allowed this category? */ + $myuser['categories'] = explode(',', $myuser['categories']); + if (in_array($ticket['category'], $myuser['categories'])) { + $admins[] = array('email' => $myuser['email'], 'language' => $myuser['language']); + continue; } - } + } - if (count($admins) > 0) - { - /* Make sure each user gets email in his/her preferred language */ + if (count($admins) > 0) { + /* Make sure each user gets email in his/her preferred language */ $current_language = 'NONE'; $recipients = array(); - $hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%', $modsForHesk_settings); - - /* Loop through staff */ - foreach ($admins as $admin) - { - /* If admin language is NULL force default HESK language */ - if ( ! $admin['language'] || ! isset($hesk_settings['languages'][$admin['language']]) ) - { - $admin['language'] = HESK_DEFAULT_LANGUAGE; + $hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%', $modsForHesk_settings); + + /* Loop through staff */ + foreach ($admins as $admin) { + /* If admin language is NULL force default HESK language */ + if (!$admin['language'] || !isset($hesk_settings['languages'][$admin['language']])) { + $admin['language'] = HESK_DEFAULT_LANGUAGE; } /* Generate message or add email to the list of recepients */ - if ($admin['language'] == $current_language) - { - /* We already have the message, just add email to the recipients list */ + if ($admin['language'] == $current_language) { + /* We already have the message, just add email to the recipients list */ $recipients[] = $admin['email']; - } - else - { - /* Send email messages in previous languages (if required) */ - if ($current_language != 'NONE') - { - /* Send e-mail to staff */ - hesk_mail(implode(',',$recipients), $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage); + } else { + /* Send email messages in previous languages (if required) */ + if ($current_language != 'NONE') { + /* Send e-mail to staff */ + hesk_mail(implode(',', $recipients), $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage); /* Reset list of email addresses */ $recipients = array(); } - /* Set new language */ - hesk_setLanguage($admin['language']); + /* Set new language */ + hesk_setLanguage($admin['language']); - /* Format staff email subject and message for this language */ - $subject = hesk_getEmailSubject($email_template,$ticket); - $message = hesk_getEmailMessage($email_template,$ticket,$modsForHesk_settings,$is_ticket); - $htmlMessage = hesk_getHtmlMessage($email_template,$ticket,$modsForHesk_settings,$is_ticket); + /* Format staff email subject and message for this language */ + $subject = hesk_getEmailSubject($email_template, $ticket); + $message = hesk_getEmailMessage($email_template, $ticket, $modsForHesk_settings, $is_ticket); + $htmlMessage = hesk_getHtmlMessage($email_template, $ticket, $modsForHesk_settings, $is_ticket); $hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%', $modsForHesk_settings); - /* Add email to the recipients list */ - $recipients[] = $admin['email']; + /* Add email to the recipients list */ + $recipients[] = $admin['email']; - /* Remember the last processed language */ - $current_language = $admin['language']; + /* Remember the last processed language */ + $current_language = $admin['language']; } } /* Send email messages to the remaining staff */ - hesk_mail(implode(',',$recipients), $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage); + hesk_mail(implode(',', $recipients), $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage); - /* Reset language to original one */ - hesk_resetLanguage(); - } + /* Reset language to original one */ + hesk_resetLanguage(); + } return true; @@ -279,20 +258,20 @@ function hesk_notifyStaff($email_template,$sql_where,$modsForHesk_settings,$is_t function hesk_validEmails() { - global $hesklang; + global $hesklang; - return array( + return array( - /*** Emails sent to CLIENT ***/ + /*** Emails sent to CLIENT ***/ - // --> Send reminder about existing tickets - 'forgot_ticket_id' => $hesklang['forgot_ticket_id'], + // --> Send reminder about existing tickets + 'forgot_ticket_id' => $hesklang['forgot_ticket_id'], - // --> Staff replied to a ticket - 'new_reply_by_staff' => $hesklang['new_reply_by_staff'], + // --> Staff replied to a ticket + 'new_reply_by_staff' => $hesklang['new_reply_by_staff'], - // --> New ticket submitted - 'new_ticket' => $hesklang['ticket_received'], + // --> New ticket submitted + 'new_ticket' => $hesklang['ticket_received'], // --> Verify email 'verify_email' => $hesklang['verify_email'], @@ -301,25 +280,25 @@ function hesk_validEmails() 'ticket_closed' => $hesklang['ticket_closed'], - /*** Emails sent to STAFF ***/ + /*** Emails sent to STAFF ***/ - // --> Ticket moved to a new category - 'category_moved' => $hesklang['category_moved'], + // --> Ticket moved to a new category + 'category_moved' => $hesklang['category_moved'], - // --> Client replied to a ticket - 'new_reply_by_customer' => $hesklang['new_reply_by_customer'], + // --> Client replied to a ticket + 'new_reply_by_customer' => $hesklang['new_reply_by_customer'], - // --> New ticket submitted - 'new_ticket_staff' => $hesklang['new_ticket_staff'], + // --> New ticket submitted + 'new_ticket_staff' => $hesklang['new_ticket_staff'], - // --> New ticket assigned to staff - 'ticket_assigned_to_you'=> $hesklang['ticket_assigned_to_you'], + // --> New ticket assigned to staff + 'ticket_assigned_to_you' => $hesklang['ticket_assigned_to_you'], - // --> New private message - 'new_pm' => $hesklang['new_pm'], + // --> New private message + 'new_pm' => $hesklang['new_pm'], - // --> New note by someone to a ticket assigned to you - 'new_note' => $hesklang['new_note'], + // --> New note by someone to a ticket assigned to you + 'new_note' => $hesklang['new_note'], // --> Staff password reset email 'reset_password' => $hesklang['reset_password'], @@ -328,46 +307,42 @@ function hesk_validEmails() } // END hesk_validEmails() -function hesk_mail($to,$subject,$message,$htmlMessage,$modsForHesk_settings,$cc=array(),$bcc=array(),$hasMessageTag = false) +function hesk_mail($to, $subject, $message, $htmlMessage, $modsForHesk_settings, $cc = array(), $bcc = array(), $hasMessageTag = false) { - global $hesk_settings, $hesklang, $ticket; + global $hesk_settings, $hesklang, $ticket; - // Are we in demo mode or are all email fields blank? If so, don't send an email. - if ( defined('HESK_DEMO') + // Are we in demo mode or are all email fields blank? If so, don't send an email. + if (defined('HESK_DEMO') || (($to == NULL || $to == '') && ($cc == NULL || count($cc) == 0) - && ($bcc == NULL || count($bcc) == 0))) - { - return true; - } + && ($bcc == NULL || count($bcc) == 0)) + ) { + return true; + } // Encode subject to UTF-8 - $subject = "=?UTF-8?B?" . base64_encode( hesk_html_entity_decode($subject) ) . "?="; + $subject = "=?UTF-8?B?" . base64_encode(hesk_html_entity_decode($subject)) . "?="; // Auto-generate URLs for HTML-formatted emails $htmlMessage = hesk_makeURL($htmlMessage, '', false); // Setup "name
TO: $to
SUBJECT: $subject
MSG: $message
TO: $to
SUBJECT: $subject
MSG: $message
' . $hesklang['dta'] . ' | '; + ORDER BY `t1`.`dt` DESC LIMIT " . intval($how_many)); + + /* Show number of views? */ + if (hesk_dbNumRows($res) != 0) { + echo ''; + if ($hesk_settings['kb_date']) { + echo ' | ' . $hesklang['dta'] . ' | '; + } } - } - ?> + ?>' . $hesklang['noa'] . ' | '; } /* We have some results, print them out */ $colspan = $hesk_settings['kb_date'] ? '' : 'colspan="2"'; - while ($article = hesk_dbFetchAssoc($res)) - { + while ($article = hesk_dbFetchAssoc($res)) { $icon = 'fa fa-file'; $style = ''; @@ -264,8 +243,8 @@ function hesk_kbLatestArticles($how_many, $index = 1) echo '
---|---|---|
- '.$article['subject'].' + | + ' . $article['subject'] . ' | '; if ($hesk_settings['kb_date']) { echo '' . hesk_date($article['dt'], true) . ' | '; @@ -275,7 +254,7 @@ function hesk_kbLatestArticles($how_many, $index = 1)
- - /> + + /> |
- + |
: | +: + |
|
: |
|
|
: |
- />
+ />
|
|
: |
- - - - + |
|
: | -+ |
+
+
+
+ |
- |
-
+ |
+
- ' . $hesk_settings['possible_ticket_list'][$field] . ''; - } - ?> - | - |
---|
+ ' . $hesk_settings['possible_ticket_list'][$field] . ''; + } + ?> + | + |
---|
' . $hesklang['file_name'] . ' | '; if ($is_staff) { - echo ''.$hesklang['download_count'].' | '; + echo '' . $hesklang['download_count'] . ' | '; } - echo ''.$hesklang['action'].' | + echo '' . $hesklang['action'] . ' | '; echo ''; - foreach ($att as $myatt) - { + foreach ($att as $myatt) { list($att_id, $att_name) = explode('#', $myatt); $fileparts = pathinfo($att_name); @@ -40,28 +38,28 @@ function mfh_listAttachments($attachments='', $reply=0, $is_staff) //-- Get the actual image location and display a thumbnail. It will be linked to a modal to view a larger size. $path = mfh_getSavedNameUrlForAttachment($att_id, $is_staff); if ($path == '') { - echo ''; + echo ''; } else { - echo ' - + echo ' + '; - $download_path = ''; - if ($is_staff) { - $download_path = '../'; - } - echo '
- '.$att_name.' +' . $att_name . ' | ';
if ($is_staff) {
- echo ''.mfh_getNumberOfDownloadsForAttachment($att_id).' | '; + echo '' . mfh_getNumberOfDownloadsForAttachment($att_id) . ' | '; } echo '
';
/* Can edit and delete tickets? */
- $download_path = '';
+ $download_path = '';
if ($is_staff) {
- $download_path = '../';
- if ($can_edit && $can_delete) {
- echo ' ';
- }
+ $download_path = '../';
+ if ($can_edit && $can_delete) {
+ echo ' ';
+ }
}
- echo '
+ echo '
';
- echo '
+ echo '
|
';
@@ -108,10 +106,10 @@ function mfh_getSavedNameUrlForAttachment($att_id, $is_staff)
global $hesk_settings;
//-- Call the DB for the attachment
- $nameRS = hesk_dbQuery("SELECT `saved_name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` WHERE `att_id` = ".hesk_dbEscape($att_id));
+ $nameRS = hesk_dbQuery("SELECT `saved_name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` WHERE `att_id` = " . hesk_dbEscape($att_id));
$name = hesk_dbFetchAssoc($nameRS);
if ($is_staff) {
- $realpath = '../'.$hesk_settings['attach_dir'] . '/' . $name['saved_name'];
+ $realpath = '../' . $hesk_settings['attach_dir'] . '/' . $name['saved_name'];
} else {
$realpath = $hesk_settings['attach_dir'] . '/' . $name['saved_name'];
}
@@ -121,21 +119,21 @@ function mfh_getSavedNameUrlForAttachment($att_id, $is_staff)
function mfh_getFontAwesomeIconForFileExtension($fileExtension)
{
- $imageExtensions = array('jpg','jpeg','png','bmp','gif');
+ $imageExtensions = array('jpg', 'jpeg', 'png', 'bmp', 'gif');
//-- Word, Excel, and PPT file extensions: http://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions
- $wordFileExtensions = array('doc','docx','dotm','dot','docm','docb');
- $excelFileExtensions = array('xls','xlt','xlm','xlsx','xlsm','xltx','xltm');
- $pptFileExtensions = array('ppt','pot','pps','pptx','pptm','potx','potm','ppsx','ppsm','sldx','sldm');
+ $wordFileExtensions = array('doc', 'docx', 'dotm', 'dot', 'docm', 'docb');
+ $excelFileExtensions = array('xls', 'xlt', 'xlm', 'xlsx', 'xlsm', 'xltx', 'xltm');
+ $pptFileExtensions = array('ppt', 'pot', 'pps', 'pptx', 'pptm', 'potx', 'potm', 'ppsx', 'ppsm', 'sldx', 'sldm');
//-- File archive extensions: http://en.wikipedia.org/wiki/List_of_archive_formats
- $archiveFileExtensions = array('tar','gz','zip','rar','7z','bz2','lz','lzma','tgz','tbz2','zipx');
+ $archiveFileExtensions = array('tar', 'gz', 'zip', 'rar', '7z', 'bz2', 'lz', 'lzma', 'tgz', 'tbz2', 'zipx');
//-- Audio file extensions: http://en.wikipedia.org/wiki/Audio_file_format#List_of_formats
- $audioFileExtensions = array('3gp','act','aiff','aac','amr','au','awb','dct','dss','dvf','flac','gsm','iklax','ivs','m4a','m4p','mmf','mp3','mpc','msv','ogg','oga','opus','ra','rm','raw','tta','vox','wav','wma','wv');
+ $audioFileExtensions = array('3gp', 'act', 'aiff', 'aac', 'amr', 'au', 'awb', 'dct', 'dss', 'dvf', 'flac', 'gsm', 'iklax', 'ivs', 'm4a', 'm4p', 'mmf', 'mp3', 'mpc', 'msv', 'ogg', 'oga', 'opus', 'ra', 'rm', 'raw', 'tta', 'vox', 'wav', 'wma', 'wv');
//-- Video file extensions: http://en.wikipedia.org/wiki/Video_file_format#List_of_video_file_formats
- $videoFileExtensions = array('webm','mkv','flv','drc','mng','avi','mov','qt','wmv','yuv','rm','rmvb','asf','mp4','m4p','m4v','mpg','mp2','mpeg','mpe','mpv','m2v','svi','3gp','3g2','mxf','roq','nsv');
+ $videoFileExtensions = array('webm', 'mkv', 'flv', 'drc', 'mng', 'avi', 'mov', 'qt', 'wmv', 'yuv', 'rm', 'rmvb', 'asf', 'mp4', 'm4p', 'm4v', 'mpg', 'mp2', 'mpeg', 'mpe', 'mpv', 'm2v', 'svi', '3gp', '3g2', 'mxf', 'roq', 'nsv');
//-- The only one I know of :D
$pdfFileExtensions = array('pdf');
@@ -145,25 +143,25 @@ function mfh_getFontAwesomeIconForFileExtension($fileExtension)
$icon = 'fa fa-file-';
$fileExtension = strtolower($fileExtension);
if (in_array($fileExtension, $imageExtensions)) {
- $icon.='image-o';
+ $icon .= 'image-o';
} elseif (in_array($fileExtension, $wordFileExtensions)) {
- $icon.='word-o';
+ $icon .= 'word-o';
} elseif (in_array($fileExtension, $excelFileExtensions)) {
- $icon.='excel-o';
+ $icon .= 'excel-o';
} elseif (in_array($fileExtension, $pptFileExtensions)) {
- $icon.='powerpoint-o';
+ $icon .= 'powerpoint-o';
} elseif (in_array($fileExtension, $archiveFileExtensions)) {
- $icon.='archive-o';
+ $icon .= 'archive-o';
} elseif (in_array($fileExtension, $audioFileExtensions)) {
- $icon.='audio-o';
+ $icon .= 'audio-o';
} elseif (in_array($fileExtension, $videoFileExtensions)) {
- $icon.='video-o';
+ $icon .= 'video-o';
} elseif (in_array($fileExtension, $pdfFileExtensions)) {
- $icon.='pdf-o';
+ $icon .= 'pdf-o';
} elseif (in_array($fileExtension, $textFileExtensions)) {
- $icon.='text-o';
+ $icon .= 'text-o';
} else {
- $icon.='o';
+ $icon .= 'o';
}
return $icon;
}
\ No newline at end of file
diff --git a/index.php b/index.php
index b10f6ca1..81fec905 100644
--- a/index.php
+++ b/index.php
@@ -1,40 +1,36 @@
$v)
- {
- if ($v['use'] && isset($_REQUEST[$k]) )
- {
- $_SESSION['c_'.$k] = $_REQUEST[$k];
+ foreach ($hesk_settings['custom_fields'] as $k => $v) {
+ if ($v['use'] && isset($_REQUEST[$k])) {
+ $_SESSION['c_' . $k] = $_REQUEST[$k];
}
}
// Variables for coloring the fields in case of errors
- if ( ! isset($_SESSION['iserror']))
- {
- $_SESSION['iserror'] = array();
- }
+ if (!isset($_SESSION['iserror'])) {
+ $_SESSION['iserror'] = array();
+ }
- if ( ! isset($_SESSION['isnotice']))
- {
- $_SESSION['isnotice'] = array();
- }
+ if (!isset($_SESSION['isnotice'])) {
+ $_SESSION['isnotice'] = array();
+ }
-if ( ! isset($_SESSION['c_category']) && ! $hesk_settings['select_cat'])
- {
- $_SESSION['c_category'] = 0;
+ if (!isset($_SESSION['c_category']) && !$hesk_settings['select_cat']) {
+ $_SESSION['c_category'] = 0;
}
- hesk_cleanSessionVars('already_submitted');
+ hesk_cleanSessionVars('already_submitted');
// Tell header to load reCaptcha API if needed
- if ($hesk_settings['recaptcha_use'] == 2)
- {
- define('RECAPTCHA',1);
+ if ($hesk_settings['recaptcha_use'] == 2) {
+ define('RECAPTCHA', 1);
}
- // Print header
- $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['submit_ticket'];
- require_once(HESK_PATH . 'inc/header.inc.php');
- ?>
+ // Print header
+ $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['submit_ticket'];
+ require_once(HESK_PATH . 'inc/header.inc.php');
+ ?>
-
+
-
-
+
+
|||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | - + function processEmail($msg, $name, $num, $tid_list) + { + global $hesk_settings; + + $msg = str_replace('%%NAME%%', $name, $msg); + $msg = str_replace('%%NUM%%', $num, $msg); + $msg = str_replace('%%LIST_TICKETS%%', $tid_list, $msg); + $msg = str_replace('%%SITE_TITLE%%', hesk_msgToPlain($hesk_settings['site_title'], 1), $msg); + $msg = str_replace('%%SITE_URL%%', $hesk_settings['site_url'], $msg); + return $msg; + } + + ?> diff --git a/install/mods-for-hesk/ajax/install-database-ajax.php b/install/mods-for-hesk/ajax/install-database-ajax.php index dd4a913a..9fb46b90 100644 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ b/install/mods-for-hesk/ajax/install-database-ajax.php @@ -1,6 +1,6 @@ '; - echo ' | '.$version.' | '; - echo 'Waiting... | '; +function printRow($version) +{ + $versionId = str_replace('.', '', $version); + $versionId = str_replace('Pre-', 'p', $versionId); + echo '||||||||||||
' . $version . ' | '; + echo 'Waiting... | '; echo '
Version | -Status | + +
---|
Version | +Status | +
---|
Task | +Status | +
---|---|
Migrate IP / Email Bans | +Waiting... |
Task | -Status | -
---|---|
Migrate IP / Email Bans | -Waiting... | -
Initialize Statuses | -Waiting... | -
Severity | -Message | -
---|
Severity | +Message | +
---|
'+ task +'
was not recognized. Check the value submitted and try again.' + task + '
was not recognized. Check the value submitted and try again.' + task + '
completeDatabase Information / File Permissions | +|
---|---|
Database Host: | ++ |
Database Name: | ++ |
Database User: | ++ |
Database Password: | ++ |
Database Prefix: | ++ |
CREATE, ALTER, DROP Permissions: | +Please check before continuing!* + | +
+ * Mods for HESK is unable to check database permissions automatically. + | +
Database Information / File Permissions | -|
---|---|
Database Host: | -- |
Database Name: | -- |
Database User: | -- |
Database Password: | -- |
Database Prefix: | -- |
CREATE, ALTER, DROP Permissions: | -Please check before continuing!* | -
- * Mods for HESK is unable to check database permissions automatically. - | -
You cannot install/upgrade Mods for HESK until the + requirements on the left have been met.
+ + +Make sure that you have updated / installed + HESK first; otherwise installation will fail!
+What version of Mods for HESK do you currently have installed?
+Mods for HESK has detected that you currently have ' . $version . ' installed. + The button you should click to upgrade has been highlighted for you. However, if + Mods for HESK selected the wrong version, click here to reset them.
'; + echo 'You cannot install/upgrade Mods for HESK until the requirements on the left have been met.
- -Make sure that you have updated / installed HESK first; otherwise installation will fail!
-What version of Mods for HESK do you currently have installed?
-Mods for HESK has detected that you currently have ' . $version . ' installed. - The button you should click to upgrade has been highlighted for you. However, if - Mods for HESK selected the wrong version, click here to reset them.
'; - echo 'Are you sure you want to uninstall Mods for HESK?
-Are you sure you want to uninstall Mods for HESK?
+Severity | -Message | -
---|
Severity | +Message | +
---|
'; - hesk_show_kb_category(1,1); - } - else - { -?> -
- |
-
-
+
|
+
'.$hesklang['attachments'].':
';
- $att=explode(',',substr($article['attachments'], 0, -1));
- foreach ($att as $myatt)
- {
- list($att_id, $att_name) = explode('#', $myatt);
- echo ' '.$att_name.'
';
- }
- echo '
' . $hesklang['attachments'] . ':
';
+ $att = explode(',', substr($article['attachments'], 0, -1));
+ foreach ($att as $myatt) {
+ list($att_id, $att_name) = explode('#', $myatt);
+ echo ' ' . $att_name . '
';
+ }
+ echo '
:
-:
- + - -:
- +:
+ -:
- ++ :
+ '.$hesklang['rating'].' ('.$hesklang['votes'].'): ('.$article['votes'].') + if ($hesk_settings['kb_rating']) { + $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated']; + echo ' +' . $hesklang['rating'] . ' (' . $hesklang['votes'] . '): (' . $article['votes'] . ')
'; - } - ?> -
|
';
- if ($i == $per_col)
- {
- echo ''; - if ($i == $per_col) - { - echo ''; - break; + if ($i == $per_col) { + echo ''; + $i = 0; + } + $i++; + } + /* Finish the table if needed */ + if ($i != 1) { + for ($j = 1; $j <= $per_col; $j++) { + echo ' | '; + if ($i == $per_col) { + echo ''; + break; + } + $i++; + } } - $i++; - } - } - ?> - |
'.$hesklang['noac'].' | '; - } - else - { - while ($article = hesk_dbFetchAssoc($res)) - { - $icon = 'fa fa-file'; - $color = ''; - $style = ''; - - $txt = hesk_kbArticleContentPreview($article['content']); - - if ($article['sticky']) - { - $icon = 'glyphicon glyphicon-pushpin'; - $style = 'style="color: #FF0000"'; - } +
' . $hesklang['noac'] . ' | '; + } else { + while ($article = hesk_dbFetchAssoc($res)) { + $icon = 'fa fa-file'; + $color = ''; + $style = ''; - if ($hesk_settings['kb_rating']) - { - $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated']; - $rat = ''; - } - else - { - $rat = ''; - } + $txt = hesk_kbArticleContentPreview($article['content']); + + if ($article['sticky']) { + $icon = 'glyphicon glyphicon-pushpin'; + $style = 'style="color: #FF0000"'; + } - echo ' + if ($hesk_settings['kb_rating']) { + $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated']; + $rat = ' | '; + } else { + $rat = ''; + } + + echo ' |
-
- '.$article['subject'].'
+
+ ' . $article['subject'] . '
- '.$txt.' + ' . $txt . ' |
- '.$rat.'
+ ' . $rat . '
' . $hesklang['ts'] . ': | ' . $ticket['time_worked'] . ' | ' . $hesklang['ip'] . ': | ' . $ticket['ip'] . ' | @@ -199,10 +184,9 @@ if ( ! empty($_SESSION['id']) ) echo '
' . $hesklang['taso3'] . ' | ' . $ticket['owner'] . ' | '; @@ -218,26 +202,22 @@ echo '||
: | -- + |