本文整理汇总了PHP中hesk_dbQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP hesk_dbQuery函数的具体用法?PHP hesk_dbQuery怎么用?PHP hesk_dbQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hesk_dbQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hesk_iTestDatabaseConnection
function hesk_iTestDatabaseConnection()
{
global $hesk_settings, $hesklang;
$db_success = 1;
$hesk_settings['db_host'] = hesk_input(hesk_POST('host'));
$hesk_settings['db_name'] = hesk_input(hesk_POST('name'));
$hesk_settings['db_user'] = hesk_input(hesk_POST('user'));
$hesk_settings['db_pass'] = hesk_input(hesk_POST('pass'));
// Allow & in password
$hesk_settings['db_pass'] = str_replace('&', '&', $hesk_settings['db_pass']);
// Use MySQLi extension to connect?
$use_mysqli = function_exists('mysqli_connect') ? true : false;
// Start output buffering
ob_start();
// Connect to database
if ($use_mysqli) {
// Do we need a special port? Check and connect to the database
if (strpos($hesk_settings['db_host'], ':')) {
list($hesk_settings['db_host'], $hesk_settings['db_port']) = explode(':', $hesk_settings['db_host']);
$hesk_db_link = mysqli_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass'], $hesk_settings['db_name'], intval($hesk_settings['db_port'])) or $db_success = 0;
} else {
$hesk_db_link = mysqli_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass'], $hesk_settings['db_name']) or $db_success = 0;
}
} else {
$hesk_db_link = mysql_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass']) or $db_success = 0;
// Select database works OK?
if ($db_success == 1 && !mysql_select_db($hesk_settings['db_name'], $hesk_db_link)) {
// No, try to create the database
if (function_exists('mysql_create_db') && mysql_create_db($hesk_settings['db_name'], $hesk_db_link)) {
if (mysql_select_db($hesk_settings['db_name'], $hesk_db_link)) {
$db_success = 1;
} else {
$db_success = 0;
}
} else {
$db_success = 0;
}
}
}
ob_end_clean();
// Any errors?
if (!$db_success) {
global $mysql_log;
$mysql_log = $use_mysqli ? mysqli_connect_error() : mysql_error();
hesk_iDatabase(1);
}
// Check MySQL version
define('MYSQL_VERSION', hesk_dbResult(hesk_dbQuery('SELECT VERSION() AS version')));
if (version_compare(MYSQL_VERSION, REQUIRE_MYSQL_VERSION, '<')) {
hesk_iDatabase(5);
}
return $hesk_db_link;
}
示例2: update_profile
function update_profile()
{
global $hesk_settings, $hesklang, $can_view_unassigned;
/* A security check */
hesk_token_check('POST');
$sql_pass = '';
$sql_username = '';
$hesk_error_buffer = '';
$_SESSION['new']['name'] = hesk_input(hesk_POST('name')) or $hesk_error_buffer .= '<li>' . $hesklang['enter_your_name'] . '</li>';
$_SESSION['new']['email'] = hesk_validateEmail(hesk_POST('email'), 'ERR', 0) or $hesk_error_buffer = '<li>' . $hesklang['enter_valid_email'] . '</li>';
$_SESSION['new']['signature'] = hesk_input(hesk_POST('signature'));
/* Signature */
if (strlen($_SESSION['new']['signature']) > 255) {
$hesk_error_buffer .= '<li>' . $hesklang['signature_long'] . '</li>';
}
/* Admins can change username */
if ($_SESSION['isadmin']) {
$_SESSION['new']['user'] = hesk_input(hesk_POST('user')) or $hesk_error_buffer .= '<li>' . $hesklang['enter_username'] . '</li>';
/* Check for duplicate usernames */
$result = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `user`='" . hesk_dbEscape($_SESSION['new']['user']) . "' AND `id`!='" . intval($_SESSION['id']) . "' LIMIT 1");
if (hesk_dbNumRows($result) != 0) {
$hesk_error_buffer .= '<li>' . $hesklang['duplicate_user'] . '</li>';
} else {
$sql_username = ",`user`='" . hesk_dbEscape($_SESSION['new']['user']) . "'";
}
}
/* Change password? */
$newpass = hesk_input(hesk_POST('newpass'));
$passlen = strlen($newpass);
if ($passlen > 0) {
/* At least 5 chars? */
if ($passlen < 5) {
$hesk_error_buffer .= '<li>' . $hesklang['password_not_valid'] . '</li>';
} else {
$newpass2 = hesk_input(hesk_POST('newpass2'));
if ($newpass != $newpass2) {
$hesk_error_buffer .= '<li>' . $hesklang['passwords_not_same'] . '</li>';
} else {
$v = hesk_Pass2Hash($newpass);
if ($v == '499d74967b28a841c98bb4baaabaad699ff3c079') {
define('WARN_PASSWORD', true);
}
$sql_pass = ',`pass`=\'' . $v . '\'';
}
}
}
/* After reply */
$_SESSION['new']['afterreply'] = intval(hesk_POST('afterreply'));
if ($_SESSION['new']['afterreply'] != 1 && $_SESSION['new']['afterreply'] != 2) {
$_SESSION['new']['afterreply'] = 0;
}
/* Auto-start ticket timer */
$_SESSION['new']['autostart'] = isset($_POST['autostart']) ? 1 : 0;
/* Notifications */
$_SESSION['new']['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) || !$can_view_unassigned ? 0 : 1;
$_SESSION['new']['notify_new_my'] = empty($_POST['notify_new_my']) ? 0 : 1;
$_SESSION['new']['notify_reply_unassigned'] = empty($_POST['notify_reply_unassigned']) || !$can_view_unassigned ? 0 : 1;
$_SESSION['new']['notify_reply_my'] = empty($_POST['notify_reply_my']) ? 0 : 1;
$_SESSION['new']['notify_assigned'] = empty($_POST['notify_assigned']) ? 0 : 1;
$_SESSION['new']['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
$_SESSION['new']['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
/* Any errors? */
if (strlen($hesk_error_buffer)) {
/* Process the session variables */
$_SESSION['new'] = hesk_stripArray($_SESSION['new']);
$hesk_error_buffer = $hesklang['rfm'] . '<br /><br /><ul>' . $hesk_error_buffer . '</ul>';
hesk_process_messages($hesk_error_buffer, 'NOREDIRECT');
} else {
/* Update database */
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET\r\n\t `name`='" . hesk_dbEscape($_SESSION['new']['name']) . "',\r\n\t `email`='" . hesk_dbEscape($_SESSION['new']['email']) . "',\r\n\t\t`signature`='" . hesk_dbEscape($_SESSION['new']['signature']) . "'\r\n {$sql_username}\r\n\t\t{$sql_pass} ,\r\n\t `afterreply`='" . intval($_SESSION['new']['afterreply']) . "' ,\r\n `autostart`='" . intval($_SESSION['new']['autostart']) . "' ,\r\n\t `notify_new_unassigned`='" . intval($_SESSION['new']['notify_new_unassigned']) . "' ,\r\n `notify_new_my`='" . intval($_SESSION['new']['notify_new_my']) . "' ,\r\n `notify_reply_unassigned`='" . intval($_SESSION['new']['notify_reply_unassigned']) . "' ,\r\n `notify_reply_my`='" . intval($_SESSION['new']['notify_reply_my']) . "' ,\r\n `notify_assigned`='" . intval($_SESSION['new']['notify_assigned']) . "' ,\r\n `notify_pm`='" . intval($_SESSION['new']['notify_pm']) . "',\r\n `notify_note`='" . intval($_SESSION['new']['notify_note']) . "'\r\n\t WHERE `id`='" . intval($_SESSION['id']) . "' LIMIT 1");
/* Process the session variables */
$_SESSION['new'] = hesk_stripArray($_SESSION['new']);
/* Update session variables */
foreach ($_SESSION['new'] as $k => $v) {
$_SESSION[$k] = $v;
}
unset($_SESSION['new']);
hesk_process_messages($hesklang['profile_updated_success'], 'profile.php', 'SUCCESS');
}
}
示例3: hesk_printCustomerReplyForm
</tr>
<tr>
<td><img src="img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
<td class="roundcornersbottom"></td>
<td width="7" height="7"><img src="img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
</tr>
</table>
<?php
/* Print "Submit a reply" form? */
if ($ticket['locked'] != 1 && $ticket['status'] != 3 && !$hesk_settings['reply_top']) {
hesk_printCustomerReplyForm();
}
/* If needed update unread replies as read for staff to know */
if (count($unread_replies)) {
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` SET `read` = '1' WHERE `id` IN ('" . implode("','", $unread_replies) . "')");
}
/* Clear unneeded session variables */
hesk_cleanSessionVars('ticket_message');
require_once HESK_PATH . 'inc/footer.inc.php';
/*** START FUNCTIONS ***/
function print_form()
{
global $hesk_settings, $hesklang;
global $hesk_error_buffer, $my_email, $trackingID, $do_remember, $display;
/* Print header */
$hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['view_ticket'];
require_once HESK_PATH . 'inc/header.inc.php';
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
示例4: hesk_dbFetchAssoc
}
$ticket = hesk_dbFetchAssoc($res);
// Demo mode
if (defined('HESK_DEMO')) {
$ticket['email'] = 'hidden@demo.com';
$ticket['ip'] = '127.0.0.1';
}
/* Get category name and ID */
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='{$ticket['category']}' LIMIT 1");
/* If this category has been deleted use the default category with ID 1 */
if (hesk_dbNumRows($res) != 1) {
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='1' LIMIT 1");
}
$category = hesk_dbFetchAssoc($res);
/* Get replies */
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` WHERE `replyto`='{$ticket['id']}' ORDER BY `id` ASC");
$replies = hesk_dbNumRows($res);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php
echo $hesk_settings['hesk_title'];
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php
echo $hesklang['ENCODING'];
?>
">
<style type="text/css">
body, table, td, p
示例5: define
define('HESK_PATH', '../');
/* Get all the required files and functions */
require HESK_PATH . 'hesk_settings.inc.php';
require HESK_PATH . 'inc/common.inc.php';
require HESK_PATH . 'inc/admin_functions.inc.php';
hesk_load_database_functions();
hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();
/* Check permissions for this feature */
hesk_checkPermission('can_view_tickets');
hesk_checkPermission('can_reply_tickets');
hesk_checkPermission('can_edit_tickets');
/* A security check */
hesk_token_check();
/* Ticket ID */
$trackingID = hesk_cleanID() or die($hesklang['int_error'] . ': ' . $hesklang['no_trackID']);
/* New archived status */
if (empty($_GET['locked'])) {
$status = 0;
$tmp = $hesklang['tunlock'];
$revision = sprintf($hesklang['thist6'], hesk_date(), $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
} else {
$status = 1;
$tmp = $hesklang['tlock'];
$revision = sprintf($hesklang['thist5'], hesk_date(), $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
}
/* Update database */
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status`='3',`locked`='{$status}', `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
/* Back to ticket page and show a success message */
hesk_process_messages($tmp, 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . rand(10000, 99999), 'SUCCESS');
示例6: hesk_profile_tab
//.........这里部分代码省略.........
echo $hesklang['confirm_pass'];
?>
:</label>
<input class="form-control" type="password" id="newpass2" name="newpass2" pattern="^\S{6,}$" onchange="this.setCustomValidity(this.validity.patternMismatch ? 'Please enter the same Password as above' : '');" autocomplete="off" size="40" />
</div>
<?php
}
?>
<div class="form-inline" id="profile-information-pwdst-row">
<label class="col-sm-2 control-label"><?php
echo $hesklang['pwdst'];
?>
:</label>
<label style="vertical-align: top;">
<div class="form-control" style="width: 336px;">
<div id="progressBar" style="font-size: 1px; height: 20px; width: 0px; border: 1px solid white;"></div>
</div>
</label>
</div>
<div class="form-inline <?php
if (!isset($_GET['a']) || $_GET['a'] !== "editc") {
echo "hidden";
}
?>
" id="show-hide-kompani">
<label class="col-sm-2 control-label" for=""><?php
echo $hesklang['company'];
?>
:<font class="important">*</font></label>
<select class="form-control" id="select_company_manage_users" name="company_id" style="width: 336px;">
<option></option>
<?php
$res_comp = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'companies` ');
while ($row_comp = mysqli_fetch_array($res_comp)) {
if ($row_comp['active'] == 1) {
$temp_data = array();
$data_contract = hesk_dbQuery('SELECT id FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'contracts` WHERE active=1 AND company_id =' . $row_comp['id']);
while ($row_contract = mysqli_fetch_array($data_contract)) {
$temp_data[] = $row_contract['id'];
}
if (isset($_SESSION[$session_array]['company_id']) && $_SESSION[$session_array]['company_id'] == $row_comp['id']) {
echo '<option value="' . $row_comp['id'] . '" contracts = "' . implode($temp_data, ",") . '" selected="selected">' . $row_comp['company_name'] . '</option>';
} else {
echo '<option value="' . $row_comp['id'] . '" contracts = "' . implode($temp_data, ",") . '" >' . $row_comp['company_name'] . '</option>';
}
} else {
if (isset($_SESSION[$session_array]['company_id']) && $_SESSION[$session_array]['company_id'] == $row_comp['id']) {
echo '<option selected="selected" disabled>' . $row_comp['company_name'] . '</option>';
}
}
}
?>
</select>
</div>
<br/>
<div class="form-inline <?php
if (!isset($_GET['a']) || $_GET['a'] !== "editc") {
echo "hidden";
}
?>
" id="show-hide-kontrata">
<label class="col-sm-2 control-label" for="select-kontrata"><?php
示例7: change_manager
function change_manager()
{
global $hesklang, $hesk_settings;
$catid = hesk_POST('catid');
$newManagerId = hesk_POST('managerid');
hesk_dbQuery('UPDATE `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` SET `manager` = ' . intval($newManagerId) . ' WHERE `id` = ' . intval($catid));
if (hesk_dbAffectedRows() != 1) {
hesk_process_messages($hesklang['int_error'] . ': ' . $hesklang['cat_not_found'], './manage_categories.php');
}
if ($newManagerId == 0) {
// There is no new manager.
return;
}
// Add the category to the user's categories list, if not already present
$currentCatRs = hesk_dbQuery('SELECT `categories` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` WHERE `id` = ' . intval($newManagerId));
$currentCategories = hesk_dbFetchAssoc($currentCatRs);
$categories = explode(',', $currentCategories['categories']);
if (!in_array($catid, $categories)) {
hesk_dbQuery('UPDATE `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` SET `categories` = \'' . $currentCategories['categories'] . ',' . $catid . '\' WHERE `id` = ' . intval($newManagerId));
}
hesk_process_messages($hesklang['manager_updated'], './manage_categories.php', 'SUCCESS');
}
示例8: toggle_type
function toggle_type()
{
global $hesk_settings, $hesklang;
/* A security check */
hesk_token_check();
$catid = intval(hesk_GET('catid')) or hesk_error($hesklang['cat_move_id']);
$_SESSION['selcat2'] = $catid;
if (intval(hesk_GET('s'))) {
$type = 1;
$tmp = $hesklang['cpriv'];
} else {
$type = 0;
$tmp = $hesklang['cpub'];
}
/* Update auto-assign settings */
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `type`='{$type}' WHERE `id`='" . intval($catid) . "' LIMIT 1");
if (hesk_dbAffectedRows() != 1) {
hesk_process_messages($hesklang['int_error'] . ': ' . $hesklang['cat_not_found'], './manage_categories.php');
}
hesk_process_messages($tmp, './manage_categories.php', 'SUCCESS');
}
示例9: mail_list_messages
function mail_list_messages()
{
global $hesk_settings, $hesklang, $admins;
$href = 'mail.php';
$query = '';
if ($hesk_settings['mailtmp']['folder'] == 'outbox') {
$query .= 'folder=outbox&';
}
$query .= 'page=';
$maxresults = 30;
$tmp = intval(hesk_POST('page', 1));
$page = $tmp > 1 ? $tmp : 1;
/* List of private messages */
$res = hesk_dbQuery("SELECT COUNT(*) FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mail` WHERE `" . hesk_dbEscape($hesk_settings['mailtmp']['this']) . "`='" . intval($_SESSION['id']) . "' AND `deletedby`!='" . intval($_SESSION['id']) . "'");
$total = hesk_dbResult($res, 0, 0);
if ($total > 0) {
$pages = ceil($total / $maxresults) or $pages = 1;
if ($page > $pages) {
$page = $pages;
}
$limit_down = $page * $maxresults - $maxresults;
$prev_page = $page - 1 <= 0 ? 0 : $page - 1;
$next_page = $page + 1 > $pages ? 0 : $page + 1;
if ($pages > 1) {
echo $hesklang['pg'] . ': ';
/* List pages */
if ($pages >= 7) {
if ($page > 2) {
echo '<a href="' . $href . '?' . $query . '1"><b>«</b></a> ';
}
if ($prev_page) {
echo '<a href="' . $href . '?' . $query . $prev_page . '"><b>‹</b></a> ';
}
}
for ($i = 1; $i <= $pages; $i++) {
if ($i <= $page + 5 && $i >= $page - 5) {
if ($i == $page) {
echo ' <b>' . $i . '</b> ';
} else {
echo ' <a href="' . $href . '?' . $query . $i . '">' . $i . '</a> ';
}
}
}
if ($pages >= 7) {
if ($next_page) {
echo ' <a href="' . $href . '?' . $query . $next_page . '"><b>›</b></a> ';
}
if ($page < $pages - 1) {
echo ' <a href="' . $href . '?' . $query . $pages . '"><b>»</b></a>';
}
}
echo '<br /> ';
}
// end PAGES > 1
// Get messages from the database
$res = hesk_dbQuery("SELECT `id`, `from`, `to`, `subject`, `dt`, `read` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mail` WHERE `" . hesk_dbEscape($hesk_settings['mailtmp']['this']) . "`='" . intval($_SESSION['id']) . "' AND `deletedby`!='" . intval($_SESSION['id']) . "' ORDER BY `id` DESC LIMIT " . intval($limit_down) . " , " . intval($maxresults) . " ");
?>
<form action="mail.php<?php
if ($hesk_settings['mailtmp']['folder'] == 'outbox') {
echo '?folder=outbox';
}
?>
" name="form1" method="post">
<div class="container table-responsive">
<table class="table table-bordered table-hover" style="background: #E0EEEE;">
<tr>
<th class="admin_white" style="width:1px"><input type="checkbox" name="checkall" value="2" onclick="hesk_changeAll(this)" /></th>
<th class="admin_white" style="text-align:left; white-space:nowrap;"><?php
echo $hesklang['m_sub'];
?>
</th>
<th class="admin_white" style="text-align:left; white-space:nowrap;"><?php
echo $hesk_settings['mailtmp']['m_from'];
?>
</th>
<th class="admin_white" style="text-align:left; white-space:nowrap;"><?php
echo $hesklang['date'];
?>
</th>
</tr>
<?php
$i = 0;
while ($pm = hesk_dbFetchAssoc($res)) {
if ($i) {
$color = "admin_gray";
$i = 0;
} else {
$color = "admin_white";
$i = 1;
}
$pm['subject'] = '<a href="mail.php?a=read&id=' . $pm['id'] . '">' . $pm['subject'] . '</a>';
if ($hesk_settings['mailtmp']['this'] == 'to' && !$pm['read']) {
$pm['subject'] = '<b>' . $pm['subject'] . '</b>';
}
$pm['name'] = isset($admins[$pm[$hesk_settings['mailtmp']['other']]]) ? '<a href="mail.php?a=new&id=' . $pm[$hesk_settings['mailtmp']['other']] . '">' . $admins[$pm[$hesk_settings['mailtmp']['other']]] . '</a>' : ($pm['from'] == 9999 ? '<a href="http://www.hesk.com" target="_blank">HESK.com</a>' : $hesklang['e_udel']);
$pm['dt'] = hesk_dateToString($pm['dt'], 0, 0, 0, true);
echo <<<EOC
//.........这里部分代码省略.........
示例10: hesk_dbQuery
<input name="submitbutton_tickets" type="submit" class="btn btn-default filter-ticket-btn" value="Search"/>
<button name="clearbutton_tickets" onclick="deleteticket_admin();return false;" class="btn btn-default filter-ticket-btn" value="">Clear</button>
</form>
</div> <!--end div i filtrave -->
<?php
if (!isset($_SESSION['hide']['ticket_list'])) {
echo '<br/><br/>
<div class="container open-new-ticket">
<div class="form-inline col-sm-10"><img src="../img/open-tickets.png" alt="open-tickets" /><span id="openTicket">' . $hesklang['open_tickets'] . '</span></div>
<span class="col-sm-2 newTicket"><a href="new_ticket.php"><button type="submit" class="btn btn-default new-ticket-btn">' . $hesklang['nti'] . '</button></a></span>
</div>
';
}
/* Reset default settings? */
if (isset($_GET['reset']) && hesk_token_check()) {
$res = hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `default_list`='' WHERE `id` = '" . intval($_SESSION['id']) . "' LIMIT 1");
$_SESSION['default_list'] = '';
} else {
parse_str($_SESSION['default_list'], $defaults);
$_GET = isset($_GET) && is_array($_GET) ? array_merge($_GET, $defaults) : $defaults;
}
/* Print the list of tickets */
require HESK_PATH . 'inc/print_tickets.inc.php';
/* Print forms for listing and searching tickets */
/*require(HESK_PATH . 'inc/show_search_form.inc.php');*/
} else {
echo '<p><i>' . $hesklang['na_view_tickets'] . '</i></p>';
}
/* Clean unneeded session variables */
hesk_cleanSessionVars('hide');
require_once HESK_PATH . 'inc/footer.inc.php';
示例11: hesk_ticketsByDay
function hesk_ticketsByDay()
{
global $hesk_settings, $hesklang, $date_from, $date_to, $can_run_reports_full;
$tickets = array();
$totals = array('all' => 0, 'resolved' => 0, 'worked' => 0);
$dt = DateArray($date_from, $date_to);
// Pre-populate date values
foreach ($dt as $day) {
$tickets[$day] = array('all' => 0, 'resolved' => 0, 'worked' => '');
}
// SQL query for all
$res = hesk_dbQuery("SELECT DATE(`dt`) AS `mydt`, COUNT(*) AS `cnt`" . ($hesk_settings['time_worked'] ? ", SUM( TIME_TO_SEC(`time_worked`) ) AS `seconds_worked`" : '') . " FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE " . ($can_run_reports_full ? '1' : "`owner` = '" . intval($_SESSION['id']) . "'") . " AND {$hesk_settings['dt_sql']} GROUP BY `mydt`");
// Update ticket values
while ($row = hesk_dbFetchAssoc($res)) {
if (!$hesk_settings['time_worked']) {
$row['seconds_worked'] = 0;
}
$tickets[$row['mydt']]['all'] += $row['cnt'];
$tickets[$row['mydt']]['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($row['seconds_worked']) : 0;
$totals['all'] += $row['cnt'];
$totals['worked'] += $row['seconds_worked'];
}
// SQL query for resolved
$res = hesk_dbQuery("SELECT DATE(`dt`) AS `mydt`, COUNT(*) AS `cnt` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE " . ($can_run_reports_full ? '1' : "`owner` = '" . intval($_SESSION['id']) . "'") . " AND `status`='3' AND {$hesk_settings['dt_sql']} GROUP BY `mydt`");
// Update ticket values
while ($row = hesk_dbFetchAssoc($res)) {
$tickets[$row['mydt']]['resolved'] += $row['cnt'];
$totals['resolved'] += $row['cnt'];
}
// Convert total seconds worked to HH:MM:SS
$totals['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($totals['worked']) : 0;
?>
<table width="100%" cellpadding="5" style="text-align:justify;border-collapse:collapse;padding:10px;">
<tr style="border-bottom:1px solid #000000;">
<td><?php
echo $hesklang['date'];
?>
</td>
<td><?php
echo $hesklang['atik'];
?>
</td>
<td><?php
echo $hesklang['topen'];
?>
</td>
<td><?php
echo $hesklang['closed'];
?>
</td>
<?php
if ($hesk_settings['time_worked']) {
echo '<td>' . $hesklang['ts'] . '</td>';
}
?>
</tr>
<?php
$num_tickets = count($tickets);
if ($num_tickets > 10) {
?>
<tr style="border-bottom:1px solid #000000;">
<td><b><?php
echo $hesklang['totals'];
?>
</b></td>
<td><b><?php
echo $totals['all'];
?>
</b></td>
<td><b><?php
echo $totals['all'] - $totals['resolved'];
?>
</b></td>
<td><b><?php
echo $totals['resolved'];
?>
</b></td>
<?php
if ($hesk_settings['time_worked']) {
echo '<td><b>' . $totals['worked'] . '</b></td>';
}
?>
</tr>
<?php
}
$cls = '';
foreach ($tickets as $k => $d) {
$cls = $cls ? '' : 'style="background:#EEEEE8;"';
?>
<tr <?php
echo $cls;
?>
>
<td><?php
echo hesk_dateToString($k);
?>
</td>
<td><?php
echo $d['all'];
//.........这里部分代码省略.........
示例12: hesk_dbQuery
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<form name="showt" action="show_tickets.php" method="get">
<table class="table" style="border-top: 0 !important" border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td style="border-top: 0px" width="20%" class="alignTop"><b><?php
echo $hesklang['status'];
?>
</b>: </td>
<td style="border-top: 0px" width="80%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<?php
$rowCounter = 1;
$statusRS = hesk_dbQuery('SELECT `ID`, `Key`, `TextColor` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'statuses`');
while ($row = $statusRS->fetch_assoc()) {
if ($rowCounter > 3) {
echo '</tr><tr>';
$rowCounter = 1;
}
echo '<td width=';
if ($rowCounter != 3) {
echo '"33%"';
} else {
echo '"34%"';
}
echo '<label><input type="checkbox" name="s' . $row['ID'] . '" value="1"';
if (isset($status[$row['ID']])) {
echo 'checked="checked"';
}
示例13: hesk_iSaveSettings
function hesk_iSaveSettings()
{
global $hesk_settings, $hesklang;
$spam_question = hesk_generate_SPAM_question();
$hesk_settings['secimg_use'] = empty($_SESSION['set_captcha']) ? 0 : 1;
$hesk_settings['use_spamq'] = empty($_SESSION['use_spamq']) ? 0 : 1;
$hesk_settings['question_ask'] = $spam_question[0];
$hesk_settings['question_ans'] = $spam_question[1];
$hesk_settings['set_attachments'] = empty($_SESSION['set_attachments']) ? 0 : 1;
$hesk_settings['hesk_version'] = HESK_NEW_VERSION;
if (isset($_SERVER['HTTP_HOST'])) {
$hesk_settings['site_url'] = 'http://' . $_SERVER['HTTP_HOST'];
if (isset($_SERVER['REQUEST_URI'])) {
$hesk_settings['hesk_url'] = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('/install/install.php', '', $_SERVER['REQUEST_URI']);
}
}
/* Encode and escape characters */
$set = $hesk_settings;
foreach ($hesk_settings as $k => $v) {
if (is_array($v)) {
continue;
}
$set[$k] = addslashes($v);
}
$set['debug_mode'] = 0;
$set['email_providers'] = count($set['email_providers']) ? "'" . implode("','", $set['email_providers']) . "'" : '';
// Check if PHP version is 5.2.3+ and MySQL is 5.0.7+
$res = hesk_dbQuery('SELECT VERSION() AS version');
$set['db_vrsn'] = version_compare(PHP_VERSION, '5.2.3') >= 0 && version_compare(hesk_dbResult($res), '5.0.7') >= 0 ? 1 : 0;
hesk_iSaveSettingsFile($set);
return true;
}
示例14: foreach
foreach ($hesk_settings['custom_fields'] as $k => $v) {
if ($v['use'] && isset($_POST[$k])) {
if (is_array($_POST[$k])) {
$tmpvar[$k] = '';
foreach ($_POST[$k] as $myCB) {
$tmpvar[$k] .= (is_array($myCB) ? '' : hesk_input($myCB)) . '<br />';
}
$tmpvar[$k] = substr($tmpvar[$k], 0, -6);
} else {
$tmpvar[$k] = hesk_makeURL(nl2br(hesk_input($_POST[$k])));
}
} else {
$tmpvar[$k] = '';
}
}
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET\n\t\t`name`='" . hesk_dbEscape($tmpvar['name']) . "',\n\t\t`email`='" . hesk_dbEscape($tmpvar['email']) . "',\n\t\t`subject`='" . hesk_dbEscape($tmpvar['subject']) . "',\n\t\t`message`='" . hesk_dbEscape($tmpvar['message']) . "',\n\t\t`custom1`='" . hesk_dbEscape($tmpvar['custom1']) . "',\n\t\t`custom2`='" . hesk_dbEscape($tmpvar['custom2']) . "',\n\t\t`custom3`='" . hesk_dbEscape($tmpvar['custom3']) . "',\n\t\t`custom4`='" . hesk_dbEscape($tmpvar['custom4']) . "',\n\t\t`custom5`='" . hesk_dbEscape($tmpvar['custom5']) . "',\n\t\t`custom6`='" . hesk_dbEscape($tmpvar['custom6']) . "',\n\t\t`custom7`='" . hesk_dbEscape($tmpvar['custom7']) . "',\n\t\t`custom8`='" . hesk_dbEscape($tmpvar['custom8']) . "',\n\t\t`custom9`='" . hesk_dbEscape($tmpvar['custom9']) . "',\n\t\t`custom10`='" . hesk_dbEscape($tmpvar['custom10']) . "',\n\t\t`custom11`='" . hesk_dbEscape($tmpvar['custom11']) . "',\n\t\t`custom12`='" . hesk_dbEscape($tmpvar['custom12']) . "',\n\t\t`custom13`='" . hesk_dbEscape($tmpvar['custom13']) . "',\n\t\t`custom14`='" . hesk_dbEscape($tmpvar['custom14']) . "',\n\t\t`custom15`='" . hesk_dbEscape($tmpvar['custom15']) . "',\n\t\t`custom16`='" . hesk_dbEscape($tmpvar['custom16']) . "',\n\t\t`custom17`='" . hesk_dbEscape($tmpvar['custom17']) . "',\n\t\t`custom18`='" . hesk_dbEscape($tmpvar['custom18']) . "',\n\t\t`custom19`='" . hesk_dbEscape($tmpvar['custom19']) . "',\n\t\t`custom20`='" . hesk_dbEscape($tmpvar['custom20']) . "'\n\t\tWHERE `id`='" . intval($ticket['id']) . "' LIMIT 1");
}
unset($tmpvar);
hesk_cleanSessionVars('tmpvar');
hesk_process_messages($hesklang['edt2'], 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999), 'SUCCESS');
}
$ticket['message'] = hesk_msgToPlain($ticket['message'], 0, 0);
/* Print header */
require_once HESK_PATH . 'inc/header.inc.php';
/* Print admin navigation */
require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
?>
<!--
</td>
</tr>-->
示例15: hesk_limitBfAttempts
hesk_limitBfAttempts();
hesk_process_messages($hesklang['ehash'], 'NOREDIRECT');
} else {
// Get info from database
$row = hesk_dbFetchAssoc($res);
// Only allow resetting password from the same IP address that submitted password reset request
if ($row['ip'] != $_SERVER['REMOTE_ADDR']) {
hesk_limitBfAttempts();
hesk_process_messages($hesklang['ehaip'], 'NOREDIRECT');
} else {
// Expire all verification hashes for this user
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "reset_password` WHERE `user`=" . intval($row['user']));
// Load additional required functions
require HESK_PATH . 'inc/admin_functions.inc.php';
// Get user details
$res = hesk_dbQuery('SELECT * FROM `' . $hesk_settings['db_pfix'] . "users` WHERE `id`=" . intval($row['user']) . " LIMIT 1");
$row = hesk_dbFetchAssoc($res);
foreach ($row as $k => $v) {
$_SESSION[$k] = $v;
}
// Set a tag that will be used to expire sessions after username or password change
$_SESSION['session_verify'] = hesk_activeSessionCreateTag($_SESSION['user'], $_SESSION['pass']);
// We don't need the password hash anymore
unset($_SESSION['pass']);
// Clean brute force attempts
hesk_cleanBfAttempts();
// Regenerate session ID (security)
hesk_session_regenerate_id();
// Get allowed categories
if (empty($_SESSION['isadmin'])) {
$_SESSION['categories'] = explode(',', $_SESSION['categories']);