本文整理汇总了PHP中hesk_dbResult函数的典型用法代码示例。如果您正苦于以下问题:PHP hesk_dbResult函数的具体用法?PHP hesk_dbResult怎么用?PHP hesk_dbResult使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hesk_dbResult函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hesk_getCategoryPriority
function hesk_getCategoryPriority($id)
{
global $hesk_settings, $hesklang, $hesk_db_link;
$priority = 3;
// Does the category have a different default priority?
$res = hesk_dbQuery("SELECT `priority` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`=" . intval($id) . " LIMIT 1");
if (hesk_dbNumRows($res) == 1) {
$priority = hesk_dbResult($res);
}
return $priority;
}
示例2: 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;
}
示例3: 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;
}
示例4: hesk_dbTime
function hesk_dbTime()
{
$res = hesk_dbQuery("SELECT NOW()");
return strtotime(hesk_dbResult($res, 0, 0));
}
示例5: hesk_makeURL
$tmpvar[$k] = hesk_makeURL(nl2br(hesk_input(hesk_POST($k))));
$_SESSION["c_{$k}"] = hesk_POST($k);
}
} else {
$tmpvar[$k] = '';
}
}
// Check bans
if (!isset($hesk_error_buffer['email']) && hesk_isBannedEmail($tmpvar['email']) || hesk_isBannedIP($_SERVER['REMOTE_ADDR'])) {
hesk_error($hesklang['baned_e']);
}
// Check maximum open tickets limit
$below_limit = true;
if ($hesk_settings['max_open'] && !isset($hesk_error_buffer['email'])) {
$res = hesk_dbQuery("SELECT COUNT(*) FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `status` IN ('0', '1', '2', '4', '5') AND " . hesk_dbFormatEmail($tmpvar['email']));
$num = hesk_dbResult($res);
if ($num >= $hesk_settings['max_open']) {
$hesk_error_buffer = array('max_open' => sprintf($hesklang['maxopen'], $num, $hesk_settings['max_open']));
$below_limit = false;
}
}
// If we reached max tickets let's save some resources
if ($below_limit) {
// Generate tracking ID
$tmpvar['trackid'] = hesk_createID();
// Attachments
if ($hesk_settings['attachments']['use']) {
require_once HESK_PATH . 'inc/attachments.inc.php';
$attachments = array();
$trackingID = $tmpvar['trackid'];
for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) {
示例6: manage_category
//.........这里部分代码省略.........
echo $hesklang['kb_cat_man'];
?>
</div>
<!-- SUB NAVIGATION -->
<?php
show_subnav('', $catid);
?>
<!-- SUB NAVIGATION -->
<?php
if (!isset($_SESSION['hide']['article_list'])) {
?>
<div class="container category-kb"><?php
echo $hesklang['category'];
?>
: <span class="black"><?php
echo $this_cat['name'];
?>
</span></div>
<br />
<?php
$result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' ORDER BY `sticky` DESC, `art_order` ASC");
$num = hesk_dbNumRows($result);
if ($num == 0) {
echo '<div class="container kb_no_article">' . $hesklang['kb_no_art'] . ' <br/><br/>
<a href="manage_knowledgebase.php?a=add_article&catid=' . $catid . '"><img src="../img/add_article.png" width="16" height="16" alt="' . $hesklang['kb_i_art2'] . '" title="' . $hesklang['kb_i_art2'] . '" border="0" style="border:none;vertical-align:text-bottom" /></a>' . '<a href="manage_knowledgebase.php?a=add_article&catid=' . $catid . '"><b>' . $hesklang['kb_i_art2'] . '</b></a></div>';
} else {
/* Get number of sticky articles */
$res2 = hesk_dbQuery("SELECT COUNT(*) FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' AND `sticky` = '1' ");
$num_sticky = hesk_dbResult($res2);
$num_nosticky = $num - $num_sticky;
?>
<div class="container insertArticle">
<?php
echo '<a href="manage_knowledgebase.php?a=add_article&catid=' . $catid . '"><img src="../img/add_article.png" width="16" height="16" alt="' . $hesklang['kb_i_art2'] . '" title="' . $hesklang['kb_i_art2'] . '" border="0" style="border:none;vertical-align:text-bottom" /></a> <a href="manage_knowledgebase.php?a=add_article&catid=' . $catid . '"><b>' . $hesklang['kb_i_art2'] . '</b></a>';
?>
</div>
<div class="container kb_cat_art_title"><?php
echo $hesklang['kb_cat_art'];
?>
</div>
<div class="container">
<table class="table table-bordered table-responsive kb_cat_art_table">
<tr>
<th class="admin_white"> </th>
<th class="admin_white"><b><i><?php
echo $hesklang['kb_subject'];
?>
</i></b></th>
<th class="admin_white"><b><i><?php
echo $hesklang['kb_type'];
?>
</i></b></th>
<th class="admin_white"><b><i><?php
echo $hesklang['views'];
?>
</i></b></th>
<?php
if ($hesk_settings['kb_rating']) {
?>
示例7: ban_ip
function ban_ip()
{
global $hesk_settings, $hesklang;
// A security check
hesk_token_check();
// Get the ip
$ip = preg_replace('/[^0-9\\.\\-\\/\\*]/', '', hesk_REQUEST('ip'));
$ip_display = str_replace('-', ' - ', $ip);
// Nothing entered?
if (!strlen($ip)) {
hesk_process_messages($hesklang['enterbanip'], 'banned_ips.php');
}
// Convert asterisk to ranges
if (strpos($ip, '*') !== false) {
$ip = str_replace('*', '0', $ip) . '-' . str_replace('*', '255', $ip);
}
$ip_regex = '(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])';
// Is this a single IP address?
if (preg_match('/^' . $ip_regex . '$/', $ip)) {
$ip_from = ip2long($ip);
$ip_to = $ip_from;
} elseif (preg_match('/^' . $ip_regex . '\\-' . $ip_regex . '$/', $ip)) {
list($ip_from, $ip_to) = explode('-', $ip);
$ip_from = ip2long($ip_from);
$ip_to = ip2long($ip_to);
} elseif (preg_match('/^' . $ip_regex . '\\/([0-9]{1,2})$/', $ip, $matches) && $matches[4] >= 0 && $matches[4] <= 32) {
list($ip_from, $ip_to) = hesk_cidr_to_range($ip);
} else {
hesk_process_messages($hesklang['validbanip'], 'banned_ips.php');
}
// Make sure we have valid ranges
if ($ip_from < 0) {
$ip_from += 4294967296.0;
} elseif ($ip_from > 4294967296.0) {
$ip_from = 4294967296.0;
}
if ($ip_to < 0) {
$ip_to += 4294967296.0;
} elseif ($ip_to > 4294967296.0) {
$ip_to = 4294967296.0;
}
// Make sure $ip_to is not lower that $ip_from
if ($ip_to < $ip_from) {
$tmp = $ip_to;
$ip_to = $ip_from;
$ip_from = $tmp;
}
// Is this IP address already banned?
$res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_ips` WHERE {$ip_from} BETWEEN `ip_from` AND `ip_to` AND {$ip_to} BETWEEN `ip_from` AND `ip_to` LIMIT 1");
if (hesk_dbNumRows($res) == 1) {
$_SESSION['ban_ip']['id'] = hesk_dbResult($res);
$hesklang['ipbanexists'] = $ip_to == $ip_from ? sprintf($hesklang['ipbanexists'], long2ip($ip_to)) : sprintf($hesklang['iprbanexists'], long2ip($ip_from) . ' - ' . long2ip($ip_to));
hesk_process_messages($hesklang['ipbanexists'], 'banned_ips.php', 'NOTICE');
}
// Delete any duplicate banned IP or ranges that are within the new banned range
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_ips` WHERE `ip_from` >= {$ip_from} AND `ip_to` <= {$ip_to}");
// Delete temporary bans from logins table
if ($ip_to == $ip_from) {
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logins` WHERE `ip`='" . hesk_dbEscape($ip_display) . "' LIMIT 1");
}
// Redirect either to banned ips or ticket page from now on
$redirect_to = ($trackingID = hesk_cleanID()) ? 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999) : 'banned_ips.php';
// Insert the ip address into database
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_ips` (`ip_from`,`ip_to`,`ip_display`,`banned_by`) VALUES ({$ip_from}, {$ip_to},'" . hesk_dbEscape($ip_display) . "','" . intval($_SESSION['id']) . "')");
// Remember ip that got banned
$_SESSION['ban_ip']['id'] = hesk_dbInsertID();
// Generate success message
$hesklang['ip_banned'] = $ip_to == $ip_from ? sprintf($hesklang['ip_banned'], long2ip($ip_to)) : sprintf($hesklang['ip_rbanned'], long2ip($ip_from) . ' - ' . long2ip($ip_to));
// Show success
hesk_process_messages(sprintf($hesklang['ip_banned'], $ip), $redirect_to, 'SUCCESS');
}
示例8: defined
<td width="200" valign="top"><?php
echo $hesklang['phpv'];
?>
:</td>
<td><?php
echo defined('HESK_DEMO') ? $hesklang['hdemo'] : PHP_VERSION . ' ' . (function_exists('mysqli_connect') ? '(MySQLi)' : '(MySQL)');
?>
</td>
</tr>
<tr>
<td width="200" valign="top"><?php
echo $hesklang['mysqlv'];
?>
:</td>
<td><?php
echo defined('HESK_DEMO') ? $hesklang['hdemo'] : hesk_dbResult(hesk_dbQuery('SELECT VERSION() AS version'));
?>
</td>
</tr>
<tr>
<td width="200" valign="top">/hesk_settings.inc.php</td>
<td>
<?php
if (is_writable(HESK_PATH . 'hesk_settings.inc.php')) {
$enable_save_settings = 1;
echo '<font class="success">' . $hesklang['exists'] . '</font>, <font class="success">' . $hesklang['writable'] . '</font>';
} else {
echo '<font class="success">' . $hesklang['exists'] . '</font>, <font class="error">' . $hesklang['not_writable'] . '</font><br />' . $hesklang['e_settings'];
}
?>
</td>
示例9: hesk_getOwnerName
function hesk_getOwnerName($id)
{
global $hesk_settings, $hesklang;
if (empty($id)) {
return $hesklang['unas'];
}
// If we already have the name no need to query DB another time
if (isset($hesk_settings['user_data'][$id]['name'])) {
return $hesk_settings['user_data'][$id]['name'];
}
$res = hesk_dbQuery("SELECT `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id`='" . intval($id) . "' LIMIT 1");
if (hesk_dbNumRows($res) != 1) {
return $hesklang['unas'];
}
$hesk_settings['user_data'][$id]['name'] = hesk_dbResult($res, 0, 0);
return $hesk_settings['user_data'][$id]['name'];
}
示例10: hesk_printReplyForm
//.........这里部分代码省略.........
<td class="admin_gray">
<?php
echo $hesklang['select_saved'];
?>
:<br />
<select name="saved_replies" onchange="setMessage(this.value)">
<option value="0"> - <?php
echo $hesklang['select_empty'];
?>
- </option>
<?php
echo $can_options;
?>
</select>
</td>
</tr>
</table>
</div>
<?php
}
?>
<p align="center"><?php
echo $hesklang['message'];
?>
: <font class="important">*</font><br />
<span id="HeskMsg"><textarea name="message" id="message" rows="12" cols="72"><?php
// Do we have any message stored in session?
if (isset($_SESSION['ticket_message'])) {
echo stripslashes(hesk_input($_SESSION['ticket_message']));
} else {
$res = hesk_dbQuery("SELECT `message` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "reply_drafts` WHERE `owner`=" . intval($_SESSION['id']) . " AND `ticket`=" . intval($ticket['id']) . " LIMIT 1");
if (hesk_dbNumRows($res) == 1) {
echo hesk_dbResult($res);
}
}
?>
</textarea></span></p>
<?php
/* attachments */
if ($hesk_settings['attachments']['use']) {
?>
<p align="center">
<?php
echo $hesklang['attachments'] . ' (<a href="Javascript:void(0)" onclick="Javascript:hesk_window(\'../file_limits.php\',250,500);return false;">' . $hesklang['ful'] . '</a>):<br />';
for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) {
echo '<input type="file" name="attachment[' . $i . ']" size="50" /><br />';
}
?>
</p>
<?php
}
?>
<div align="center">
<center>
<table>
<tr>
<td>
<?php
if ($ticket['owner'] != $_SESSION['id'] && $can_assign_self) {
if (empty($ticket['owner'])) {
echo '<label><input type="checkbox" name="assign_self" value="1" checked="checked" /> <b>' . $hesklang['asss2'] . '</b></label><br />';
} else {
echo '<label><input type="checkbox" name="assign_self" value="1" /> ' . $hesklang['asss2'] . '</label><br />';
示例11: 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']) > 1000) {
$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 {
$newpass_hash = hesk_Pass2Hash($newpass);
if ($newpass_hash == '499d74967b28a841c98bb4baaabaad699ff3c079') {
define('WARN_PASSWORD', true);
}
$sql_pass = ',`pass`=\'' . $newpass_hash . '\'';
}
}
}
/* After reply */
$_SESSION['new']['afterreply'] = intval(hesk_POST('afterreply'));
if ($_SESSION['new']['afterreply'] != 1 && $_SESSION['new']['afterreply'] != 2) {
$_SESSION['new']['afterreply'] = 0;
}
// Defaults
$_SESSION['new']['autostart'] = isset($_POST['autostart']) ? 1 : 0;
$_SESSION['new']['notify_customer_new'] = isset($_POST['notify_customer_new']) ? 1 : 0;
$_SESSION['new']['notify_customer_reply'] = isset($_POST['notify_customer_reply']) ? 1 : 0;
$_SESSION['new']['show_suggested'] = isset($_POST['show_suggested']) ? 1 : 0;
/* 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\n\t\t`name`='" . hesk_dbEscape($_SESSION['new']['name']) . "',\n\t\t`email`='" . hesk_dbEscape($_SESSION['new']['email']) . "',\n\t\t`signature`='" . hesk_dbEscape($_SESSION['new']['signature']) . "'\n\t\t{$sql_username}\n\t\t{$sql_pass} ,\n\t\t`afterreply`='" . $_SESSION['new']['afterreply'] . "' ,\n\t\t" . ($hesk_settings['time_worked'] ? "`autostart`='" . $_SESSION['new']['autostart'] . "'," : '') . "\n\t\t`notify_customer_new`='" . $_SESSION['new']['notify_customer_new'] . "' ,\n\t\t`notify_customer_reply`='" . $_SESSION['new']['notify_customer_reply'] . "' ,\n\t\t`show_suggested`='" . $_SESSION['new']['show_suggested'] . "' ,\n\t\t`notify_new_unassigned`='" . $_SESSION['new']['notify_new_unassigned'] . "' ,\n\t\t`notify_new_my`='" . $_SESSION['new']['notify_new_my'] . "' ,\n\t\t`notify_reply_unassigned`='" . $_SESSION['new']['notify_reply_unassigned'] . "' ,\n\t\t`notify_reply_my`='" . $_SESSION['new']['notify_reply_my'] . "' ,\n\t\t`notify_assigned`='" . $_SESSION['new']['notify_assigned'] . "' ,\n\t\t`notify_pm`='" . $_SESSION['new']['notify_pm'] . "',\n\t\t`notify_note`='" . $_SESSION['new']['notify_note'] . "'\n\t\tWHERE `id`='" . intval($_SESSION['id']) . "' LIMIT 1");
/* Process the session variables */
$_SESSION['new'] = hesk_stripArray($_SESSION['new']);
// Do we need a new session_veify tag?
if (strlen($sql_username) && strlen($sql_pass)) {
$_SESSION['session_verify'] = hesk_activeSessionCreateTag($_SESSION['new']['user'], $newpass_hash);
} elseif (strlen($sql_pass)) {
$_SESSION['session_verify'] = hesk_activeSessionCreateTag($_SESSION['user'], $newpass_hash);
} elseif (strlen($sql_username)) {
$res = hesk_dbQuery('SELECT `pass` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id` = '" . intval($_SESSION['id']) . "' LIMIT 1");
$_SESSION['session_verify'] = hesk_activeSessionCreateTag($_SESSION['new']['user'], hesk_dbResult($res));
}
/* Update session variables */
foreach ($_SESSION['new'] as $k => $v) {
$_SESSION[$k] = $v;
}
unset($_SESSION['new']);
hesk_cleanSessionVars('as_notify');
hesk_process_messages($hesklang['profile_updated_success'], 'profile.php', 'SUCCESS');
}
}
示例12: hesk_printReplyForm
//.........这里部分代码省略.........
?>
</label>
<select class="form-control" name="saved_replies" onchange="setMessage(this.value)">
<option value="0"> - <?php
echo $hesklang['select_empty'];
?>
- </option>
<?php
echo $can_options;
?>
</select>
</div>
</div>
<?php
}
?>
<div class="form-group">
<label for="message" class="col-sm-3 control-label"><?php
echo $hesklang['message'];
?>
: <font class="important">*</font></label>
<div class="col-sm-9">
<span id="HeskMsg">
<textarea class="form-control" name="message" id="message" rows="12" placeholder="<?php
echo htmlspecialchars($hesklang['message']);
?>
" cols="72"><?php
// Do we have any message stored in session?
if (isset($_SESSION['ticket_message'])) {
echo stripslashes(hesk_input($_SESSION['ticket_message']));
} else {
$res = hesk_dbQuery("SELECT `message` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "reply_drafts` WHERE `owner`=" . intval($_SESSION['id']) . " AND `ticket`=" . intval($ticket['id']) . " LIMIT 1");
if (hesk_dbNumRows($res) == 1) {
echo hesk_dbResult($res);
}
}
?>
</textarea></span>
</div>
</div>
<?php
/* attachments */
if ($hesk_settings['attachments']['use']) {
?>
<div class="form-group">
<label for="attachments" class="col-sm-3 control-label"><?php
echo $hesklang['attachments'];
?>
:</label>
<div class="col-sm-9">
<?php
for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) {
echo '<input type="file" name="attachment[' . $i . ']" size="50" /><br />';
}
echo '<a href="Javascript:void(0)" onclick="Javascript:hesk_window(\'../file_limits.php\',250,500);return false;">' . $hesklang['ful'] . '</a>';
?>
</div>
</div>
<?php
}
?>
<div class="form-group">
<label for="options" class="col-sm-3 control-label"><?php
echo $hesklang['addop'];
?>
:</label>
示例13: hesk_printReplyForm
//.........这里部分代码省略.........
<div class="form-inline admin_gray" style="margin-bottom: 10px;">
<label for="selec-canned-response"><?php
echo $hesklang['select_saved'];
?>
:</label>
<select id="selec-canned-response" name="saved_replies" onchange="setMessage(this.value)">
<option value="0"> - <?php
echo $hesklang['select_empty'];
?>
- </option>
<?php
echo $can_options;
?>
</select>
</div>
</div><!-- end table-track-time-worked-->
<?php
}
?>
<div class="form-inline">
<span class="col-sm-2"><?php
echo $hesklang['message'];
?>
: <font class="important">*</font></span>
<span id="HeskMsg"><textarea name="message" id="message" rows="12" cols="72" class="HeskMsg-addReply form-control">
<?php
// Do we have any message stored in session?
if (isset($_SESSION['ticket_message'])) {
echo stripslashes(hesk_input($_SESSION['ticket_message']));
} else {
$res = hesk_dbQuery("SELECT `message` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "reply_drafts` WHERE `owner`=" . intval($_SESSION['id']) . " AND `ticket`=" . intval($ticket['id']) . " LIMIT 1");
if (hesk_dbNumRows($res) == 1) {
echo hesk_dbResult($res);
}
}
?>
</textarea></span></div>
<br/>
<div class="form-inline">
<?php
/* attachments */
if ($hesk_settings['attachments']['use']) {
?>
<?php
echo '<span class="col-sm-2">' . $hesklang['attachments'] . ':' . '</span>';
echo '<div class="form-group" id="attachments-addReply">';
for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) {
echo '<input id="chooseFile-addReply" type="file" name="attachment[' . $i . ']" size="50" />';
}
echo '<span>(<a href="Javascript:void(0)" onclick="Javascript:hesk_window(\'../file_limits.php\',250,500);return false;">' . $hesklang['ful'] . '</a>)</span>';
echo ' </div>';
?>
<?php
}
?>
</div>
<br/>
<div class="first-table">
<?php
/*if ($ticket['owner'] != $_SESSION['id'] && $can_assign_self)
示例14: 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
//.........这里部分代码省略.........
示例15: hesk_iSaveSettings
function hesk_iSaveSettings()
{
global $hesk_settings, $hesklang;
// Get default settings
$hesk_default = hesk_defaultSettings();
// Set a new version number
$hesk_settings['hesk_version'] = HESK_NEW_VERSION;
// Correct typos in variable names before 2.4
$hesk_settings['smtp_host_port'] = isset($hesk_settings['stmp_host_port']) ? $hesk_settings['stmp_host_port'] : 25;
$hesk_settings['smtp_timeout'] = isset($hesk_settings['stmp_timeout']) ? $hesk_settings['stmp_timeout'] : 10;
$hesk_settings['smtp_user'] = isset($hesk_settings['stmp_user']) ? $hesk_settings['stmp_user'] : '';
$hesk_settings['smtp_password'] = isset($hesk_settings['stmp_password']) ? $hesk_settings['stmp_password'] : '';
// Assign all required values
foreach ($hesk_default as $k => $v) {
if (is_array($v)) {
// Arrays will be processed separately
continue;
}
if (!isset($hesk_settings[$k])) {
$hesk_settings[$k] = $v;
}
}
// Arrays need special care
$hesk_settings['attachments'] = isset($hesk_settings['attachments']) ? $hesk_settings['attachments'] : $hesk_default['attachments'];
$hesk_settings['email_providers'] = isset($hesk_settings['email_providers']) ? $hesk_settings['email_providers'] : $hesk_default['email_providers'];
// Attachments max size must be multiplied by 1024 since version 2.4
if ($hesk_settings['attachments']['max_size'] < 102400) {
$hesk_settings['attachments']['max_size'] = $hesk_settings['attachments']['max_size'] * 1024;
}
// Custom fields
for ($i = 1; $i <= 20; $i++) {
$this_field = 'custom' . $i;
if (isset($hesk_settings['custom_fields'][$this_field]) && $hesk_settings['custom_fields'][$this_field]['use']) {
if (!isset($hesk_settings['custom_fields'][$this_field]['place'])) {
$hesk_settings['custom_fields'][$this_field]['place'] = 0;
$hesk_settings['custom_fields'][$this_field]['type'] = 'text';
$hesk_settings['custom_fields'][$this_field]['value'] = '';
}
$hesk_settings['custom_fields'][$this_field]['name'] = addslashes($hesk_settings['custom_fields'][$this_field]['name']);
$hesk_settings['custom_fields'][$this_field]['value'] = addslashes($hesk_settings['custom_fields'][$this_field]['value']);
} else {
$hesk_settings['custom_fields'][$this_field] = $hesk_default['custom_fields'][$this_field];
}
}
// 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($hesk_settings['email_providers']) ? "'" . implode("','", $hesk_settings['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;
}