当前位置: 首页>>代码示例>>PHP>>正文


PHP hesk_dbInsertID函数代码示例

本文整理汇总了PHP中hesk_dbInsertID函数的典型用法代码示例。如果您正苦于以下问题:PHP hesk_dbInsertID函数的具体用法?PHP hesk_dbInsertID怎么用?PHP hesk_dbInsertID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hesk_dbInsertID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hesk_newTicket

function hesk_newTicket($ticket)
{
    global $hesk_settings, $hesklang, $hesk_db_link;
    // If language is not set or default, set it to NULL
    $language = !$hesk_settings['can_sel_lang'] || $hesklang['LANGUAGE'] == HESK_DEFAULT_LANGUAGE ? "NULL" : "'" . hesk_dbEscape($hesklang['LANGUAGE']) . "'";
    // Insert ticket into database
    hesk_dbQuery("\n\tINSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`\n\t(\n\t\t`trackid`,\n\t\t`name`,\n\t\t`email`,\n\t\t`category`,\n\t\t`company_ticket_id`,\n\t\t`contract_ticket_id`,\n\t\t`priority`,\n\t\t`subject`,\n\t\t`message`,\n\t\t`dt`,\n\t\t`lastchange`,\n\t\t`articles`,\n\t\t`ip`,\n\t\t`language`,\n\t\t`openedby`,\n\t\t`owner`,\n\t\t`attachments`,\n\t\t`merged`,\n\t\t`history`,\n\t\t`custom1`,\n\t\t`custom2`,\n\t\t`custom3`,\n\t\t`custom4`,\n\t\t`custom5`,\n\t\t`custom6`,\n\t\t`custom7`,\n\t\t`custom8`,\n\t\t`custom9`,\n\t\t`custom10`,\n\t\t`custom11`,\n\t\t`custom12`,\n\t\t`custom13`,\n\t\t`custom14`,\n\t\t`custom15`,\n\t\t`custom16`,\n\t\t`custom17`,\n\t\t`custom18`,\n\t\t`custom19`,\n\t\t`custom20`\n\t)\n\tVALUES\n\t(\n\t\t'" . hesk_dbEscape($ticket['trackid']) . "',\n\t\t'" . hesk_dbEscape($ticket['name']) . "',\n\t\t'" . hesk_dbEscape($ticket['email']) . "',\n\t\t'" . intval($ticket['category']) . "',\n\t\t'" . hesk_dbEscape($ticket['company_ticket_id']) . "',\n\t\t'" . hesk_dbEscape($ticket['contract_ticket_id']) . "',\n\t\t'" . intval($ticket['priority']) . "',\n\t\t'" . hesk_dbEscape($ticket['subject']) . "',\n\t\t'" . hesk_dbEscape($ticket['message']) . "',\n\t\tNOW(),\n\t\tNOW(),\n\t\t" . (isset($ticket['articles']) ? "'{$ticket['articles']}'" : 'NULL') . ",\n\t\t'" . hesk_dbEscape($_SERVER['REMOTE_ADDR']) . "',\n\t\t{$language},\n\t\t'" . (isset($ticket['openedby']) ? intval($ticket['openedby']) : 0) . "',\n\t\t'" . intval($ticket['owner']) . "',\n\t\t'" . hesk_dbEscape($ticket['attachments']) . "',\n\t\t'',\n\t\t'" . hesk_dbEscape($ticket['history']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom1']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom2']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom3']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom4']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom5']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom6']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom7']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom8']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom9']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom10']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom11']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom12']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom13']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom14']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom15']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom16']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom17']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom18']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom19']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom20']) . "'\n\t)\n\t");
    // Generate the array with ticket info that can be used in emails
    $info = array('email' => $ticket['email'], 'category' => $ticket['category'], 'priority' => $ticket['priority'], 'owner' => $ticket['owner'], 'trackid' => $ticket['trackid'], 'status' => 0, 'name' => $ticket['name'], 'lastreplier' => $ticket['name'], 'subject' => $ticket['subject'], 'message' => $ticket['message'], 'attachments' => $ticket['attachments'], 'dt' => hesk_date(), 'lastchange' => hesk_date(), 'id' => hesk_dbInsertID());
    // Add custom fields to the array
    foreach ($hesk_settings['custom_fields'] as $k => $v) {
        $info[$k] = $v['use'] ? $ticket[$k] : '';
    }
    return hesk_ticketToPlain($info, 1);
}
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:15,代码来源:posting_functions.inc.php

示例2: hesk_newTicket

function hesk_newTicket($ticket, $isVerified = true)
{
    global $hesk_settings, $hesklang, $hesk_db_link;
    // If language is not set or default, set it to NULL.
    if (!isset($ticket['language']) || empty($ticket['language'])) {
        $language = !$hesk_settings['can_sel_lang'] ? HESK_DEFAULT_LANGUAGE : hesk_dbEscape($hesklang['LANGUAGE']);
    } else {
        $language = $ticket['language'];
    }
    // Get the default ticket status for new tickets and set it accordingly
    $defaultNewTicketRs = hesk_dbQuery("SELECT `ID` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `IsNewTicketStatus` = 1");
    $defaultNewTicket = hesk_dbFetchAssoc($defaultNewTicketRs);
    $ticket['status'] = $defaultNewTicket['ID'];
    $tableName = $isVerified ? 'tickets' : 'stage_tickets';
    // Insert ticket into database
    hesk_dbQuery("\n\tINSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . $tableName . "`\n\t(\n\t\t`trackid`,\n\t\t`name`,\n\t\t`email`,\n\t\t`category`,\n\t\t`priority`,\n\t\t`subject`,\n\t\t`message`,\n\t\t`dt`,\n\t\t`lastchange`,\n\t\t`articles`,\n\t\t`ip`,\n\t\t`language`,\n\t\t`openedby`,\n\t\t`owner`,\n\t\t`attachments`,\n\t\t`merged`,\n\t\t`history`,\n\t\t`custom1`,\n\t\t`custom2`,\n\t\t`custom3`,\n\t\t`custom4`,\n\t\t`custom5`,\n\t\t`custom6`,\n\t\t`custom7`,\n\t\t`custom8`,\n\t\t`custom9`,\n\t\t`custom10`,\n\t\t`custom11`,\n\t\t`custom12`,\n\t\t`custom13`,\n\t\t`custom14`,\n\t\t`custom15`,\n\t\t`custom16`,\n\t\t`custom17`,\n\t\t`custom18`,\n\t\t`custom19`,\n\t\t`custom20`,\n\t\t`status`,\n\t\t`latitude`,\n\t\t`longitude`\n\t)\n\tVALUES\n\t(\n\t\t'" . hesk_dbEscape($ticket['trackid']) . "',\n\t\t'" . hesk_dbEscape($ticket['name']) . "',\n\t\t'" . hesk_dbEscape($ticket['email']) . "',\n\t\t'" . intval($ticket['category']) . "',\n\t\t'" . intval($ticket['priority']) . "',\n\t\t'" . hesk_dbEscape($ticket['subject']) . "',\n\t\t'" . hesk_dbEscape($ticket['message']) . "',\n\t\tNOW(),\n\t\tNOW(),\n\t\t" . (isset($ticket['articles']) ? "'{$ticket['articles']}'" : 'NULL') . ",\n\t\t'" . hesk_dbEscape($_SERVER['REMOTE_ADDR']) . "',\n\t\t'" . hesk_dbEscape($language) . "',\n\t\t'" . (isset($ticket['openedby']) ? intval($ticket['openedby']) : 0) . "',\n\t\t'" . intval($ticket['owner']) . "',\n\t\t'" . hesk_dbEscape($ticket['attachments']) . "',\n\t\t'',\n\t\t'" . hesk_dbEscape($ticket['history']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom1']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom2']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom3']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom4']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom5']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom6']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom7']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom8']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom9']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom10']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom11']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom12']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom13']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom14']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom15']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom16']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom17']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom18']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom19']) . "',\n\t\t'" . hesk_dbEscape($ticket['custom20']) . "',\n\t\t'" . intval($ticket['status']) . "',\n\t\t'" . hesk_dbEscape($ticket['latitude']) . "',\n\t\t'" . hesk_dbEscape($ticket['longitude']) . "'\n\t)\n\t");
    // Generate the array with ticket info that can be used in emails
    $info = array('email' => $ticket['email'], 'category' => $ticket['category'], 'priority' => $ticket['priority'], 'owner' => $ticket['owner'], 'trackid' => $ticket['trackid'], 'status' => $ticket['status'], 'name' => $ticket['name'], 'lastreplier' => $ticket['name'], 'subject' => $ticket['subject'], 'message' => $ticket['message'], 'attachments' => $ticket['attachments'], 'dt' => hesk_date(), 'lastchange' => hesk_date(), 'id' => hesk_dbInsertID(), 'language' => $language);
    // Add custom fields to the array
    foreach ($hesk_settings['custom_fields'] as $k => $v) {
        $info[$k] = $v['use'] ? $ticket[$k] : '';
    }
    return hesk_ticketToPlain($info, 1);
}
开发者ID:Orgoth,项目名称:Mods-for-HESK,代码行数:24,代码来源:posting_functions.inc.php

示例3: new_sm

function new_sm()
{
    global $hesk_settings, $hesklang, $listBox;
    global $hesk_error_buffer;
    // A security check
    # hesk_token_check('POST');
    $hesk_error_buffer = array();
    $style = intval(hesk_POST('style', 0));
    if ($style > 4 || $style < 0) {
        $style = 0;
    }
    $type = empty($_POST['type']) ? 0 : 1;
    $title = hesk_input(hesk_POST('title')) or $hesk_error_buffer[] = $hesklang['sm_e_title'];
    $message = hesk_getHTML(hesk_POST('message'));
    // Any errors?
    if (count($hesk_error_buffer)) {
        $_SESSION['new_sm'] = array('style' => $style, 'type' => $type, 'title' => $title, 'message' => hesk_input(hesk_POST('message')));
        $tmp = '';
        foreach ($hesk_error_buffer as $error) {
            $tmp .= "<li>{$error}</li>\n";
        }
        $hesk_error_buffer = $tmp;
        $hesk_error_buffer = $hesklang['rfm'] . '<br /><br /><ul>' . $hesk_error_buffer . '</ul>';
        hesk_process_messages($hesk_error_buffer, 'service_messages.php');
    }
    // Just preview the message?
    if (isset($_POST['sm_preview'])) {
        $_SESSION['preview_sm'] = true;
        $_SESSION['new_sm'] = array('style' => $style, 'type' => $type, 'title' => $title, 'message' => $message);
        header('Location: service_messages.php');
        exit;
    }
    // Get the latest service message order
    $res = hesk_dbQuery("SELECT `order` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` ORDER BY `order` DESC LIMIT 1");
    $row = hesk_dbFetchRow($res);
    $my_order = intval($row[0]) + 10;
    // Insert service message into database
    hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` (`author`,`title`,`message`,`style`,`type`,`order`) VALUES (\n    '" . intval($_SESSION['id']) . "',\n    '" . hesk_dbEscape($title) . "',\n    '" . hesk_dbEscape($message) . "',\n    '{$style}',\n    '{$type}',\n    '{$my_order}'\n    )");
    $_SESSION['smord'] = hesk_dbInsertID();
    hesk_process_messages($hesklang['sm_added'], 'service_messages.php', 'SUCCESS');
}
开发者ID:abuhannan,项目名称:aduan,代码行数:41,代码来源:service_messages.php

示例4: hesk_dbQuery

$res = hesk_dbQuery("SELECT `staffid` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` WHERE `replyto`='{$ticket['id']}' AND `dt` > DATE_SUB(NOW(), INTERVAL 10 MINUTE) ORDER BY `id` ASC");
if (hesk_dbNumRows($res) > 0) {
    $sequential_customer_replies = 0;
    while ($tmp = hesk_dbFetchAssoc($res)) {
        $sequential_customer_replies = $tmp['staffid'] ? 0 : $sequential_customer_replies + 1;
    }
    if ($sequential_customer_replies > 10) {
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logins` (`ip`, `number`) VALUES ('" . hesk_dbEscape($_SERVER['REMOTE_ADDR']) . "', " . intval($hesk_settings['attempt_limit'] + 1) . ")");
        hesk_error(sprintf($hesklang['yhbr'], $hesk_settings['attempt_banmin']), 0);
    }
}
/* Insert attachments */
if ($hesk_settings['attachments']['use'] && !empty($attachments)) {
    foreach ($attachments as $myatt) {
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('{$trackingID}','" . hesk_dbEscape($myatt['saved_name']) . "','" . hesk_dbEscape($myatt['real_name']) . "','" . intval($myatt['size']) . "')");
        $myattachments .= hesk_dbInsertID() . '#' . $myatt['real_name'] . ',';
    }
}
// If staff hasn't replied yet, keep ticket status "New", otherwise set it to "Waiting reply from staff"
$ticket['status'] = $ticket['status'] ? 1 : 0;
/* Update ticket as necessary */
$res = hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `lastchange`=NOW(), `status`='{$ticket['status']}', `replies`=`replies`+1, `lastreplier`='0' WHERE `id`='{$ticket['id']}' LIMIT 1");
if (isset($_SESSION['id']['user'])) {
    $name = $_SESSION['id']['user'];
} else {
    $name = $ticket['name'];
}
// Insert reply into database
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` (`replyto`,`name`,`message`,`dt`,`attachments`) VALUES ({$ticket['id']},'" . hesk_dbEscape($name) . "','" . hesk_dbEscape($message) . "',NOW(),'" . hesk_dbEscape($myattachments) . "')");
/*** Need to notify any staff? ***/
// --> Prepare reply message
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:31,代码来源:reply_ticket.php

示例5: new_cat

function new_cat()
{
    global $hesk_settings, $hesklang;
    /* A security check */
    hesk_token_check('POST');
    /* Options */
    $_SESSION['cat_autoassign'] = hesk_POST('autoassign') == 'Y' ? 1 : 0;
    $_SESSION['cat_type'] = hesk_POST('type') == 'Y' ? 1 : 0;
    // Default priority
    $_SESSION['cat_priority'] = intval(hesk_POST('priority', 3));
    if ($_SESSION['cat_priority'] < 0 || $_SESSION['cat_priority'] > 3) {
        $_SESSION['cat_priority'] = 3;
    }
    /* Category name */
    $catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php');
    /* Do we already have a category with this name? */
    $res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1");
    if (hesk_dbNumRows($res) != 0) {
        $_SESSION['catname'] = $catname;
        hesk_process_messages($hesklang['cndupl'], 'manage_categories.php');
    }
    /* Get the latest cat_order */
    $res = hesk_dbQuery("SELECT `cat_order` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `cat_order` DESC LIMIT 1");
    $row = hesk_dbFetchRow($res);
    $my_order = $row[0] + 10;
    hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}')");
    hesk_cleanSessionVars('catname');
    hesk_cleanSessionVars('cat_autoassign');
    hesk_cleanSessionVars('cat_type');
    hesk_cleanSessionVars('cat_priority');
    $_SESSION['selcat2'] = hesk_dbInsertID();
    hesk_process_messages(sprintf($hesklang['cat_name_added'], '<i>' . stripslashes($catname) . '</i>'), 'manage_categories.php', 'SUCCESS');
}
开发者ID:Orgoth,项目名称:Mods-for-HESK,代码行数:33,代码来源:manage_categories.php

示例6: mail_send

function mail_send()
{
    global $hesk_settings, $hesklang;
    /* A security check */
    hesk_token_check('POST');
    $hesk_error_buffer = '';
    /* Recipient */
    $_SESSION['mail']['to'] = intval(hesk_POST('to'));
    /* Valid recipient? */
    if (empty($_SESSION['mail']['to'])) {
        $hesk_error_buffer .= '<li>' . $hesklang['m_rec'] . '</li>';
    } elseif ($_SESSION['mail']['to'] == $_SESSION['id']) {
        $hesk_error_buffer .= '<li>' . $hesklang['m_inr'] . '</li>';
    } else {
        $res = hesk_dbQuery("SELECT `name`,`email`,`notify_pm` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id`='" . intval($_SESSION['mail']['to']) . "' LIMIT 1");
        $num = hesk_dbNumRows($res);
        if (!$num) {
            $hesk_error_buffer .= '<li>' . $hesklang['m_inr'] . '</li>';
        } else {
            $pm_recipient = hesk_dbFetchAssoc($res);
        }
    }
    /* Subject */
    $_SESSION['mail']['subject'] = hesk_input(hesk_POST('subject')) or $hesk_error_buffer .= '<li>' . $hesklang['m_esu'] . '</li>';
    /* Message */
    $_SESSION['mail']['message'] = hesk_input(hesk_POST('message')) or $hesk_error_buffer .= '<li>' . $hesklang['enter_message'] . '</li>';
    /* Any errors? */
    if (strlen($hesk_error_buffer)) {
        $_SESSION['hide']['list'] = 1;
        $hesk_error_buffer = $hesklang['rfm'] . '<br /><br /><ul>' . $hesk_error_buffer . '</ul>';
        hesk_process_messages($hesk_error_buffer, 'NOREDIRECT');
    } else {
        $_SESSION['mail']['message'] = hesk_makeURL($_SESSION['mail']['message']);
        $_SESSION['mail']['message'] = nl2br($_SESSION['mail']['message']);
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mail` (`from`,`to`,`subject`,`message`,`dt`,`read`) VALUES ('" . intval($_SESSION['id']) . "','" . intval($_SESSION['mail']['to']) . "','" . hesk_dbEscape($_SESSION['mail']['subject']) . "','" . hesk_dbEscape($_SESSION['mail']['message']) . "',NOW(),'0')");
        /* Notify receiver via e-mail? */
        if (isset($pm_recipient) && $pm_recipient['notify_pm']) {
            $pm_id = hesk_dbInsertID();
            $pm = array('name' => hesk_msgToPlain(addslashes($_SESSION['name']), 1, 1), 'subject' => hesk_msgToPlain($_SESSION['mail']['subject'], 1, 1), 'message' => hesk_msgToPlain($_SESSION['mail']['message'], 1, 1), 'id' => $pm_id);
            /* Format email subject and message for recipient */
            $subject = hesk_getEmailSubject('new_pm', $pm, 0);
            $message = hesk_getEmailMessage('new_pm', $pm, 1, 0);
            /* Send e-mail */
            hesk_mail($pm_recipient['email'], $subject, $message);
        }
        unset($_SESSION['mail']);
        hesk_process_messages($hesklang['m_pms'], './mail.php', 'SUCCESS');
    }
}
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:49,代码来源:mail.php

示例7: hesk_email2ticket


//.........这里部分代码省略.........
    $num = 0;
    if ($hesk_settings['attachments']['use'] && isset($results['attachments'][0])) {
        foreach ($results['attachments'] as $k => $v) {
            // Clean attachment names
            $myatt['real_name'] = hesk_cleanFileName($v['orig_name']);
            // Check number of attachments, delete any over max number
            if ($num >= $hesk_settings['attachments']['max_number']) {
                $tmpvar['attachmment_notices'] .= sprintf($hesklang['attnum'], $myatt['real_name']) . "\n";
                continue;
            }
            // Check file extension
            $ext = strtolower(strrchr($myatt['real_name'], "."));
            if (!in_array($ext, $hesk_settings['attachments']['allowed_types'])) {
                $tmpvar['attachmment_notices'] .= sprintf($hesklang['atttyp'], $myatt['real_name']) . "\n";
                continue;
            }
            // Check file size
            $myatt['size'] = $v['size'];
            if ($myatt['size'] > $hesk_settings['attachments']['max_size']) {
                $tmpvar['attachmment_notices'] .= sprintf($hesklang['attsiz'], $myatt['real_name']) . "\n";
                continue;
            }
            // Generate a random file name
            $useChars = 'AEUYBDGHJLMNPQRSTVWXZ123456789';
            $tmp = $useChars[mt_rand(0, 29)];
            for ($j = 1; $j < 10; $j++) {
                $tmp .= $useChars[mt_rand(0, 29)];
            }
            $myatt['saved_name'] = substr($tmpvar['trackid'] . '_' . md5($tmp . $myatt['real_name']), 0, 200) . $ext;
            // Rename the temporary file
            rename($v['stored_name'], HESK_PATH . $hesk_settings['attach_dir'] . '/' . $myatt['saved_name']);
            // Insert into database
            hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('" . hesk_dbEscape($tmpvar['trackid']) . "','" . hesk_dbEscape($myatt['saved_name']) . "','" . hesk_dbEscape($myatt['real_name']) . "','" . intval($myatt['size']) . "')");
            $tmpvar['attachments'] .= hesk_dbInsertID() . '#' . $myatt['real_name'] . ',';
            $num++;
        }
        if (strlen($tmpvar['attachmment_notices'])) {
            $tmpvar['message'] .= "<br /><br />" . hesk_input($hesklang['attrem'], '', '', 1) . "<br />" . nl2br(hesk_input($tmpvar['attachmment_notices'], '', '', 1));
        }
    }
    // Delete the temporary files
    deleteAll($results['tempdir']);
    // If this is a reply add a new reply
    if ($is_reply) {
        // Set last replier name to customer name
        $ticket['lastreplier'] = $tmpvar['name'] == $hesklang['pde'] ? $tmpvar['email'] : $tmpvar['name'];
        // If staff hasn't replied yet, keep ticket status "New", otherwise set it to "Waiting reply from staff"
        $ticket['status'] = $ticket['status'] ? 1 : 0;
        // Update ticket as necessary
        hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `lastchange`=NOW(),`status`='{$ticket['status']}',`replies`=`replies`+1,`lastreplier`='0' WHERE `id`='" . intval($ticket['id']) . "' LIMIT 1");
        // If customer replied, we assume staff replies have been read (no way to be sure if ticket.php hasn't been opened)
        hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` SET `read` = '1' WHERE `replyto` = '" . intval($ticket['id']) . "' AND `staffid` != '0' ");
        // Insert reply into database
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` (`replyto`,`name`,`message`,`dt`,`attachments`) VALUES ('" . intval($ticket['id']) . "','" . hesk_dbEscape($ticket['lastreplier']) . "','" . hesk_dbEscape($tmpvar['message']) . "',NOW(),'" . hesk_dbEscape($tmpvar['attachments']) . "')");
        // --> Prepare reply message
        // 1. Generate the array with ticket info that can be used in emails
        $info = array('email' => $ticket['email'], 'category' => $ticket['category'], 'priority' => $ticket['priority'], 'owner' => $ticket['owner'], 'trackid' => $ticket['trackid'], 'status' => $ticket['status'], 'name' => $ticket['name'], 'lastreplier' => $ticket['lastreplier'], 'subject' => $ticket['subject'], 'message' => stripslashes($tmpvar['message']), 'attachments' => $tmpvar['attachments'], 'dt' => hesk_date($ticket['dt'], true), 'lastchange' => hesk_date($ticket['lastchange'], true), 'id' => $ticket['id']);
        // 2. Add custom fields to the array
        foreach ($hesk_settings['custom_fields'] as $k => $v) {
            $info[$k] = $v['use'] ? $ticket[$k] : '';
        }
        // 3. Make sure all values are properly formatted for email
        $ticket = hesk_ticketToPlain($info, 1, 0);
        // --> Process custom fields before sending
        foreach ($hesk_settings['custom_fields'] as $k => $v) {
            $ticket[$k] = $v['use'] ? hesk_msgToPlain($ticket[$k], 1) : '';
开发者ID:Eximagen,项目名称:helpdesk,代码行数:67,代码来源:pipe_functions.inc.php

示例8: implode

    $tmpvar['articles'] = implode(',', array_unique(array_map('intval', $_POST['suggested'])));
}
// All good now, continue with ticket creation
$tmpvar['owner'] = 0;
$tmpvar['history'] = sprintf($hesklang['thist15'], hesk_date(), $tmpvar['name']);
// Auto assign tickets if aplicable
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
if ($autoassign_owner) {
    $tmpvar['owner'] = $autoassign_owner['id'];
    $tmpvar['history'] .= sprintf($hesklang['thist10'], hesk_date(), $autoassign_owner['name'] . ' (' . $autoassign_owner['user'] . ')');
}
// Insert attachments
if ($hesk_settings['attachments']['use'] && !empty($attachments)) {
    foreach ($attachments as $myatt) {
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('" . hesk_dbEscape($tmpvar['trackid']) . "','" . hesk_dbEscape($myatt['saved_name']) . "','" . hesk_dbEscape($myatt['real_name']) . "','" . intval($myatt['size']) . "')");
        $tmpvar['attachments'] .= hesk_dbInsertID() . '#' . $myatt['real_name'] . ',';
    }
}
// Insert ticket to database
$ticket = hesk_newTicket($tmpvar);
//insert to ERP
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
include 'oe_api.php';
$valid_services = array("SCA" => "project.issue");
//klasat e ERP  me te cilat do te punojme
$params = array();
$params['name'] = hesk_POST('subject');
$params['description'] = hesk_POST('message');
$params['email_from'] = hesk_POST('email');
$params['priority'] = hesk_POST('priority');
$params['categ_id'] = hesk_POST('category');
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:31,代码来源:submit_ticket.php

示例9: new_article

function new_article()
{
    global $hesk_settings, $hesklang, $listBox;
    global $hesk_error_buffer;
    /* A security check */
    # hesk_token_check('POST');
    $_SESSION['hide'] = array('treemenu' => 1, 'new_category' => 1);
    $hesk_error_buffer = array();
    $catid = intval(hesk_POST('catid', 1));
    $type = empty($_POST['type']) ? 0 : (hesk_POST('type') == 2 ? 2 : 1);
    $html = $hesk_settings['kb_wysiwyg'] ? 1 : (empty($_POST['html']) ? 0 : 1);
    $now = hesk_date();
    // Prevent submitting duplicate articles by reloading manage_knowledgebase.php page
    if (isset($_SESSION['article_submitted'])) {
        header('Location:manage_knowledgebase.php?a=manage_cat&catid=' . $catid);
        exit;
    }
    $_SESSION['KB_CATEGORY'] = $catid;
    $subject = hesk_input(hesk_POST('subject')) or $hesk_error_buffer[] = $hesklang['kb_e_subj'];
    if ($html) {
        if (empty($_POST['content'])) {
            $hesk_error_buffer[] = $hesklang['kb_e_cont'];
        }
        $content = hesk_getHTML(hesk_POST('content'));
    } else {
        $content = hesk_input(hesk_POST('content')) or $hesk_error_buffer[] = $hesklang['kb_e_cont'];
        $content = nl2br($content);
        $content = hesk_makeURL($content);
    }
    $sticky = isset($_POST['sticky']) ? 1 : 0;
    $keywords = hesk_input(hesk_POST('keywords'));
    /* Article attachments */
    define('KB', 1);
    require_once HESK_PATH . 'inc/posting_functions.inc.php';
    require_once HESK_PATH . 'inc/attachments.inc.php';
    $attachments = array();
    for ($i = 1; $i <= 3; $i++) {
        $att = hesk_uploadFile($i);
        if (!empty($att)) {
            $attachments[$i] = $att;
        }
    }
    $myattachments = '';
    /* Any errors? */
    if (count($hesk_error_buffer)) {
        // Remove any successfully uploaded attachments
        if ($hesk_settings['attachments']['use']) {
            hesk_removeAttachments($attachments);
        }
        $_SESSION['new_article'] = array('type' => $type, 'html' => $html, 'subject' => $subject, 'content' => hesk_input(hesk_POST('content')), 'keywords' => $keywords, 'sticky' => $sticky);
        $tmp = '';
        foreach ($hesk_error_buffer as $error) {
            $tmp .= "<li>{$error}</li>\n";
        }
        $hesk_error_buffer = $tmp;
        $hesk_error_buffer = $hesklang['rfm'] . '<br /><br /><ul>' . $hesk_error_buffer . '</ul>';
        hesk_process_messages($hesk_error_buffer, 'manage_knowledgebase.php');
    }
    $revision = sprintf($hesklang['revision1'], $now, $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
    /* Add to database */
    if (!empty($attachments)) {
        foreach ($attachments as $myatt) {
            hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_attachments` (`saved_name`,`real_name`,`size`) VALUES ('" . hesk_dbEscape($myatt['saved_name']) . "','" . hesk_dbEscape($myatt['real_name']) . "','" . intval($myatt['size']) . "')");
            $myattachments .= hesk_dbInsertID() . '#' . $myatt['real_name'] . ',';
        }
    }
    /* Get the latest reply_order */
    $res = hesk_dbQuery("SELECT `art_order` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='" . intval($catid) . "' AND `sticky` = '" . intval($sticky) . "' ORDER BY `art_order` DESC LIMIT 1");
    $row = hesk_dbFetchRow($res);
    $my_order = $row[0] + 10;
    /* Insert article into database */
    hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` (`catid`,`dt`,`author`,`subject`,`content`,`keywords`,`type`,`html`,`sticky`,`art_order`,`history`,`attachments`) VALUES (\n    '" . intval($catid) . "',\n    NOW(),\n    '" . intval($_SESSION['id']) . "',\n    '" . hesk_dbEscape($subject) . "',\n    '" . hesk_dbEscape($content) . "',\n    '" . hesk_dbEscape($keywords) . "',\n    '" . intval($type) . "',\n    '" . intval($html) . "',\n    '" . intval($sticky) . "',\n    '" . intval($my_order) . "',\n    '" . hesk_dbEscape($revision) . "',\n    '" . hesk_dbEscape($myattachments) . "'\n    )");
    $_SESSION['artord'] = hesk_dbInsertID();
    // Update category article count
    if ($type == 0) {
        hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` SET `articles`=`articles`+1 WHERE `id`='" . intval($catid) . "'");
    } else {
        if ($type == 1) {
            hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` SET `articles_private`=`articles_private`+1 WHERE `id`='" . intval($catid) . "'");
        } else {
            hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` SET `articles_draft`=`articles_draft`+1 WHERE `id`='" . intval($catid) . "'");
        }
    }
    unset($_SESSION['hide']);
    $_SESSION['article_submitted'] = 1;
    hesk_process_messages($hesklang['your_kb_added'], 'NOREDIRECT', 'SUCCESS');
    $_GET['catid'] = $catid;
    manage_category();
}
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:89,代码来源:manage_knowledgebase.php

示例10: hesk_iUpdateTables

function hesk_iUpdateTables()
{
    global $hesk_settings, $hesklang;
    $update_all_next = 0;
    // Updating version 0.90 to 0.91
    if ($hesk_settings['update_from'] == '0.90') {
        hesk_dbQuery("ALTER TABLE `hesk_users` ADD `notify` CHAR( 1 ) DEFAULT '1' NOT NULL");
        $update_all_next = 1;
    }
    // END version 0.90 to 0.91
    // Updating versions 0.91 through 0.93.1 to 0.94
    if ($update_all_next || $hesk_settings['update_from'] == '0.91-0.93.1') {
        hesk_dbQuery("CREATE TABLE `hesk_attachments` (\r\n\t\t  `att_id` mediumint(8) unsigned NOT NULL auto_increment,\r\n\t\t  `ticket_id` varchar(10) NOT NULL default '',\r\n\t\t  `saved_name` varchar(255) NOT NULL default '',\r\n\t\t  `real_name` varchar(255) NOT NULL default '',\r\n\t\t  `size` int(10) unsigned NOT NULL default '0',\r\n\t\t  PRIMARY KEY  (`att_id`),\r\n\t\t  KEY `ticket_id` (`ticket_id`)\r\n\t\t) ENGINE=MyISAM");
        hesk_dbQuery("CREATE TABLE `hesk_std_replies` (\r\n\t\t`id` smallint(5) unsigned NOT NULL auto_increment,\r\n\t\t`title` varchar(70) NOT NULL default '',\r\n\t\t`message` text NOT NULL,\r\n\t\t`reply_order` smallint(5) unsigned NOT NULL default '0',\r\n\t\tPRIMARY KEY  (`id`)\r\n\t\t) ENGINE=MyISAM");
        hesk_dbQuery("ALTER TABLE `hesk_categories`\r\n\t\tCHANGE `name` `name` varchar(60) NOT NULL default '',\r\n\t\tADD `cat_order` smallint(5) unsigned NOT NULL default '0'");
        hesk_dbQuery("ALTER TABLE `hesk_replies`\r\n\t\tCHANGE `name` `name` varchar(50) NOT NULL default '',\r\n\t\tADD `attachments` TEXT");
        hesk_dbQuery("ALTER TABLE `hesk_tickets`\r\n\t\tCHANGE `name` `name` varchar(50) NOT NULL default '',\r\n\t\tCHANGE `category` `category` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1',\r\n\t\tCHANGE `priority` `priority` enum('1','2','3') NOT NULL default '3',\r\n\t\tCHANGE `subject` `subject` varchar(70) NOT NULL default '',\r\n\t\tADD `lastchange` datetime NOT NULL default '0000-00-00 00:00:00' AFTER `dt`,\r\n\t\tCHANGE `status` `status` enum('0','1','2','3') default '1',\r\n\t\tADD `lastreplier` enum('0','1') NOT NULL default '0',\r\n\t\tADD `archive` enum('0','1') NOT NULL default '0',\r\n\t\tADD `attachments` text,\r\n\t\tADD `custom1` VARCHAR( 255 ) NOT NULL default '',\r\n\t\tADD `custom2` VARCHAR( 255 ) NOT NULL default '',\r\n\t\tADD `custom3` VARCHAR( 255 ) NOT NULL default '',\r\n\t\tADD `custom4` VARCHAR( 255 ) NOT NULL default '',\r\n\t\tADD `custom5` VARCHAR( 255 ) NOT NULL default '',\r\n\t\tADD INDEX `archive` ( `archive` )");
        // Change status of closed tickets to the new "Resolved" status
        hesk_dbQuery("UPDATE `hesk_tickets` SET `status`='3' WHERE `status`='0'");
        // Populate lastchange
        hesk_dbQuery("UPDATE `hesk_tickets` SET `lastchange`=`dt`");
        // Update categories with order values
        $res = hesk_dbQuery("SELECT `id` FROM `hesk_categories`");
        $i = 10;
        while ($mycat = hesk_dbFetchAssoc($res)) {
            hesk_dbQuery("UPDATE `hesk_categories` SET `cat_order`={$i} WHERE `id`=" . intval($mycat['id']) . " LIMIT 1");
            $i += 10;
        }
        $update_all_next = 1;
    }
    // END versions 0.91 through 0.93.1 to 0.94
    // Updating version 0.94 to 0.94.1
    if ($hesk_settings['update_from'] == '0.94') {
        hesk_dbQuery("CREATE TABLE `hesk_attachments` (\r\n\t\t  `att_id` mediumint(8) unsigned NOT NULL auto_increment,\r\n\t\t  `ticket_id` varchar(10) NOT NULL default '',\r\n\t\t  `saved_name` varchar(255) NOT NULL default '',\r\n\t\t  `real_name` varchar(255) NOT NULL default '',\r\n\t\t  `size` int(10) unsigned NOT NULL default '0',\r\n\t\t  PRIMARY KEY  (`att_id`),\r\n\t\t  KEY `ticket_id` (`ticket_id`)\r\n\t\t) ENGINE=MyISAM");
        if ($hesk_settings['attachments']['use']) {
            /* Update attachments for tickets */
            $res = hesk_dbQuery("SELECT * FROM `hesk_tickets` WHERE `attachments` != '' ");
            while ($ticket = hesk_dbFetchAssoc($res)) {
                $att = explode('#####', substr($ticket['attachments'], 0, -5));
                $myattachments = '';
                foreach ($att as $myatt) {
                    $name = substr(strstr($myatt, $ticket['trackid']), 16);
                    $saved_name = strstr($myatt, $ticket['trackid']);
                    $size = filesize($hesk_settings['server_path'] . '/attachments/' . $saved_name);
                    hesk_dbQuery("INSERT INTO `hesk_attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('" . hesk_dbEscape($ticket['trackid']) . "', '" . hesk_dbEscape($saved_name) . "', '" . hesk_dbEscape($name) . "', '" . intval($size) . "')");
                    $myattachments .= hesk_dbInsertID() . '#' . $name . ',';
                }
                hesk_dbQuery("UPDATE `hesk_tickets` SET `attachments` = '" . hesk_dbEscape($myattachments) . "' WHERE `id` = " . intval($ticket['id']) . " LIMIT 1");
            }
            // Update attachments for replies
            $res = hesk_dbQuery("SELECT * FROM `hesk_replies` WHERE `attachments` != '' ");
            while ($ticket = hesk_dbFetchAssoc($res)) {
                $res2 = hesk_dbQuery("SELECT `trackid` FROM `hesk_tickets` WHERE `id` = '" . intval($ticket['replyto']) . "' LIMIT 1");
                $trackingID = hesk_dbResult($res2, 0, 0);
                $att = explode('#####', substr($ticket['attachments'], 0, -5));
                $myattachments = '';
                foreach ($att as $myatt) {
                    $name = substr(strstr($myatt, $trackingID), 16);
                    $saved_name = strstr($myatt, $trackingID);
                    $size = filesize($hesk_settings['server_path'] . '/attachments/' . $saved_name);
                    hesk_dbQuery("INSERT INTO `hesk_attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('" . hesk_dbEscape($trackingID) . "', '" . hesk_dbEscape($saved_name) . "', '" . hesk_dbEscape($name) . "', '" . intval($size) . "')");
                    $myattachments .= hesk_dbInsertID() . '#' . $name . ',';
                }
                hesk_dbQuery("UPDATE `hesk_replies` SET `attachments` = '" . hesk_dbEscape($myattachments) . "' WHERE `id` = " . intval($ticket['id']) . " LIMIT 1");
            }
        }
        // END if attachments use
        $update_all_next = 1;
    }
    // END version 0.94 to 0.94.1
    // Updating version 0.94.1 to 2.0
    if ($update_all_next || $hesk_settings['update_from'] == '0.94.1') {
        hesk_dbQuery("CREATE TABLE `hesk_kb_articles` (\r\n\t\t  `id` smallint(5) unsigned NOT NULL auto_increment,\r\n\t\t  `catid` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `dt` timestamp NOT NULL default CURRENT_TIMESTAMP,\r\n\t\t  `author` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `subject` varchar(255) NOT NULL default '',\r\n\t\t  `content` text NOT NULL,\r\n\t\t  `rating` float NOT NULL default '0',\r\n\t\t  `votes` mediumint(8) unsigned NOT NULL default '0',\r\n\t\t  `views` mediumint(8) unsigned NOT NULL default '0',\r\n\t\t  `type` enum('0','1','2') NOT NULL default '0',\r\n\t\t  `html` enum('0','1') NOT NULL default '0',\r\n\t\t  `art_order` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `history` text NOT NULL,\r\n\t\t  PRIMARY KEY  (`id`),\r\n\t\t  KEY `catid` (`catid`),\r\n\t\t  KEY `type` (`type`),\r\n\t\t  FULLTEXT KEY `subject` (`subject`,`content`)\r\n\t\t) ENGINE=MyISAM");
        hesk_dbQuery("CREATE TABLE `hesk_kb_categories` (\r\n\t\t  `id` smallint(5) unsigned NOT NULL auto_increment,\r\n\t\t  `name` varchar(255) NOT NULL default '',\r\n\t\t  `parent` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `articles` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `cat_order` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `type` enum('0','1') NOT NULL default '0',\r\n\t\t  PRIMARY KEY  (`id`),\r\n\t\t  KEY `type` (`type`)\r\n\t\t) ENGINE=MyISAM");
        hesk_dbQuery("INSERT INTO `hesk_kb_categories` VALUES (1, 'Knowledgebase', 0, 0, 10, '0')");
        hesk_dbQuery("CREATE TABLE `hesk_notes` (\r\n\t\t  `id` mediumint(8) unsigned NOT NULL auto_increment,\r\n\t\t  `ticket` mediumint(8) unsigned NOT NULL default '0',\r\n\t\t  `who` smallint(5) unsigned NOT NULL default '0',\r\n\t\t  `dt` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t  `message` text NOT NULL,\r\n\t\t  PRIMARY KEY  (`id`),\r\n\t\t  KEY `ticketid` (`ticket`)\r\n\t\t) ENGINE=MyISAM");
        $sql = array();
        $sql[] = "ALTER TABLE `hesk_replies` ADD `staffid` SMALLINT UNSIGNED NOT NULL DEFAULT '0'";
        $sql[] = "ALTER TABLE `hesk_replies` ADD `rating` ENUM( '1', '5' ) default NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD INDEX `categories` ( `category` )";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD INDEX `statuses` ( `status` ) ";
        $sql[] = "ALTER TABLE `hesk_tickets` CHANGE `custom1` `custom1` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` CHANGE `custom2` `custom2` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` CHANGE `custom3` `custom3` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` CHANGE `custom4` `custom4` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` CHANGE `custom5` `custom5` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD `custom6` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD `custom7` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD `custom8` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD `custom9` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_tickets` ADD `custom10` text NOT NULL";
        $sql[] = "ALTER TABLE `hesk_users` CHANGE `pass` `pass` CHAR( 40 ) NOT NULL";
        $sql[] = "ALTER TABLE `hesk_users` CHANGE `isadmin` `isadmin` ENUM( '0', '1' ) NOT NULL DEFAULT '0'";
        $sql[] = "ALTER TABLE `hesk_users` CHANGE `notify` `notify` ENUM( '0', '1' ) NOT NULL DEFAULT '1'";
        $sql[] = "ALTER TABLE `hesk_users` ADD `heskprivileges` VARCHAR( 255 ) NOT NULL";
        $sql[] = "ALTER TABLE `hesk_users` ADD `ratingneg` mediumint(8) unsigned NOT NULL default '0'";
        $sql[] = "ALTER TABLE `hesk_users` ADD `ratingpos` mediumint(8) unsigned NOT NULL default '0'";
        $sql[] = "ALTER TABLE `hesk_users` ADD `rating` float NOT NULL default '0'";
        $sql[] = "ALTER TABLE `hesk_users` ADD `replies` mediumint(8) unsigned NOT NULL default '0'";
        $sql[] = "ALTER TABLE `hesk_std_replies` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL";
//.........这里部分代码省略.........
开发者ID:riansopian,项目名称:hesk,代码行数:101,代码来源:update.php

示例11: new_user

function new_user()
{
    global $hesk_settings, $hesklang;
    /* A security check */
    hesk_token_check('POST');
    $myuser = hesk_validateUserInfo();
    /* Can view unassigned tickets? */
    if (in_array('can_view_unassigned', $myuser['features'])) {
        $sql_where = '';
        $sql_what = '';
    } else {
        $sql_where = ' , `notify_new_unassigned`, `notify_reply_unassigned` ';
        $sql_what = " , '0', '0' ";
    }
    /* Categories and Features will be stored as a string */
    $myuser['categories'] = implode(',', $myuser['categories']);
    $myuser['features'] = implode(',', $myuser['features']);
    /* Check for duplicate usernames */
    $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `user` = '" . hesk_dbEscape($myuser['user']) . "' LIMIT 1");
    if (hesk_dbNumRows($result) != 0) {
        hesk_process_messages($hesklang['duplicate_user'], 'manage_users.php');
    }
    /* Admins will have access to all features and categories */
    if ($myuser['isadmin']) {
        $myuser['categories'] = '';
        $myuser['features'] = '';
    }
    hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` (`user`,`pass`,`isadmin`,`name`,`email`,`signature`,`categories`,`autoassign`,`heskprivileges` {$sql_where}) VALUES (\r\n\t'" . hesk_dbEscape($myuser['user']) . "',\r\n\t'" . hesk_dbEscape($myuser['pass']) . "',\r\n\t'" . intval($myuser['isadmin']) . "',\r\n\t'" . hesk_dbEscape($myuser['name']) . "',\r\n\t'" . hesk_dbEscape($myuser['email']) . "',\r\n\t'" . hesk_dbEscape($myuser['signature']) . "',\r\n\t'" . hesk_dbEscape($myuser['categories']) . "',\r\n\t'" . intval($myuser['autoassign']) . "',\r\n\t'" . hesk_dbEscape($myuser['features']) . "'\r\n\t{$sql_what} )");
    $_SESSION['seluser'] = hesk_dbInsertID();
    unset($_SESSION['userdata']);
    hesk_process_messages(sprintf($hesklang['user_added_success'], $myuser['user'], $myuser['cleanpass']), './manage_users.php', 'SUCCESS');
}
开发者ID:riansopian,项目名称:hesk,代码行数:32,代码来源:manage_users.php

示例12: hesk_input

if (isset($_POST['resolved_time'])) {
    $value_resolved_time = hesk_input(hesk_POST('resolved_time'));
} else {
    $value_resolved_time = '';
}
if (!empty($value_contract_name) && !empty($value_company_id) && !empty($value_project_id) && !empty($value_starting_date) && !empty($value_ending_date) && !empty($value_sla) && !empty($value_priority) && !empty($value_reply_time) && !empty($value_resolved_time)) {
    if (isset($_POST['action']) && $_POST['action'] == 'save') {
        if (date("Y-m-d") >= hesk_dbEscape($value_starting_date) && date("Y-m-d") <= hesk_dbEscape($value_ending_date)) {
            $sql = hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "contracts` (\n\t\t\t`id`,\n\t\t\t`contract_name`,\n\t\t\t`company_id`,\n\t\t\t`project_id`,\n\t\t\t`starting_date`,\n\t\t\t`ending_date`,\n\t\t\t`created_by`,\n\t\t\t`sla`,\n\t\t\t`priority`,\n\t\t\t`reply_time`,\n\t\t\t`resolved_time`,\n\t\t\t`active`\n\t\t\t) VALUES (\n\t\t\t'" . hesk_dbEscape($value_id) . "',\n\t\t\t'" . hesk_dbEscape($value_contract_name) . "',\n\t\t\t'" . hesk_dbEscape($value_company_id) . "',\n\t\t\t'" . hesk_dbEscape($value_project_id) . "',\n\t\t\t'" . hesk_dbEscape($value_starting_date) . "',\n\t\t\t'" . hesk_dbEscape($value_ending_date) . "',\n\t\t\t'" . hesk_dbEscape($_SESSION['id']) . "',\n\t\t\t'" . hesk_dbEscape($value_sla) . "',\n\t\t\t'" . hesk_dbEscape($value_priority) . "',\n\t\t\t'" . hesk_dbEscape($value_reply_time) . "',\n\t\t\t'" . hesk_dbEscape($value_resolved_time) . "',\n\t\t\t'" . hesk_dbEscape(1) . "'\n\t\t\t)");
            $id = hesk_dbInsertID();
            foreach ($_POST['staff_id'] as $staff) {
                $sql = hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "userforcontract` (\n\t\t\t\t\t`userId`, `contractId`) VALUES('" . hesk_dbEscape($staff) . "', '" . $id . "')");
            }
        } else {
            $sql = hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "contracts` (\n\t\t\t`id`,\n\t\t\t`contract_name`,\n\t\t\t`company_id`,\n\t\t\t`project_id`,\n\t\t\t`starting_date`,\n\t\t\t`ending_date`,\n\t\t\t`created_by`,\n\t\t\t`sla`,\n\t\t\t`priority`,\n\t\t\t`reply_time`,\n\t\t\t`resolved_time`,\n\t\t\t`active`\n\t\t\t) VALUES (\n\t\t\t'" . hesk_dbEscape($value_id) . "',\n\t\t\t'" . hesk_dbEscape($value_contract_name) . "',\n\t\t\t'" . hesk_dbEscape($value_company_id) . "',\n\t\t\t'" . hesk_dbEscape($value_project_id) . "',\n\t\t\t'" . hesk_dbEscape($value_starting_date) . "',\n\t\t\t'" . hesk_dbEscape($value_ending_date) . "',\n\t\t\t'" . hesk_dbEscape($_SESSION['id']) . "',\n\t\t\t'" . hesk_dbEscape($value_sla) . "',\n\t\t\t'" . hesk_dbEscape($value_priority) . "',\n\t\t\t'" . hesk_dbEscape($value_reply_time) . "',\n\t\t\t'" . hesk_dbEscape($value_resolved_time) . "',\n\t\t\t'" . hesk_dbEscape(0) . "'\n\t\t\t)");
            $id = hesk_dbInsertID();
            foreach ($_POST['staff_id'] as $staff) {
                $sql = hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "userforcontract` (\n\t\t\t\t\t`userId`, `contractId`) VALUES('" . hesk_dbEscape($staff) . "', '" . $id . "')");
            }
        }
    }
}
/* Print header */
require_once HESK_PATH . 'inc/header.inc.php';
/* Print admin navigation */
require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
?>

<div class="container manage-contract-title"><?php 
echo $hesklang['manage_contracts'];
?>
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:31,代码来源:contracts.php

示例13: ban_email

function ban_email()
{
    global $hesk_settings, $hesklang;
    // A security check
    hesk_token_check();
    // Get the email
    $email = strtolower(hesk_input(hesk_REQUEST('email')));
    // Nothing entered?
    if (!strlen($email)) {
        hesk_process_messages($hesklang['enterbanemail'], 'banned_emails.php');
    }
    // Only allow one email to be entered
    $email = ($index = strpos($email, ',')) ? substr($email, 0, $index) : $email;
    $email = ($index = strpos($email, ';')) ? substr($email, 0, $index) : $email;
    // Validate email address
    $hesk_settings['multi_eml'] = 0;
    if (!hesk_validateEmail($email, '', 0) && !verify_email_domain($email)) {
        hesk_process_messages($hesklang['validbanemail'], 'banned_emails.php');
    }
    // Redirect either to banned emails or ticket page from now on
    $redirect_to = ($trackingID = hesk_cleanID()) ? 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999) : 'banned_emails.php';
    // Prevent duplicate rows
    if ($_SESSION['ban_email']['id'] = hesk_isBannedEmail($email)) {
        hesk_process_messages(sprintf($hesklang['emailbanexists'], $email), $redirect_to, 'NOTICE');
    }
    // Insert the email address into database
    hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_emails` (`email`,`banned_by`) VALUES ('" . hesk_dbEscape($email) . "','" . intval($_SESSION['id']) . "')");
    // Remember email that got banned
    $_SESSION['ban_email']['id'] = hesk_dbInsertID();
    // Show success
    hesk_process_messages(sprintf($hesklang['email_banned'], $email), $redirect_to, 'SUCCESS');
}
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:32,代码来源:banned_emails.php

示例14: new_user

function new_user()
{
    global $hesk_settings, $hesklang;
    /* A security check */
    hesk_token_check('POST');
    $myuser = hesk_validateUserInfo();
    /* Categories and Features will be stored as a string */
    $myuser['categories'] = implode(',', $myuser['categories']);
    $myuser['features'] = implode(',', $myuser['features']);
    /* Check for duplicate usernames */
    $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `user` = '" . hesk_dbEscape($myuser['user']) . "' LIMIT 1");
    if (hesk_dbNumRows($result) != 0) {
        hesk_process_messages($hesklang['duplicate_user'], 'manage_users.php');
    }
    /* Admins will have access to all features and categories */
    if ($myuser['isadmin']) {
        $myuser['categories'] = '';
        $myuser['features'] = '';
    }
    hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` (\r\n\t`user`,\r\n\t`pass`,\r\n\t`isadmin`,\r\n\t`name`,\r\n\t`email`,\r\n\t`signature`,\r\n\t`categories`,\r\n\t`autoassign`,\r\n\t`heskprivileges`,\r\n\t`afterreply`,\r\n\t`autostart`,\r\n\t`notify_customer_new`,\r\n\t`notify_customer_reply`,\r\n\t`show_suggested`,\r\n\t`notify_new_unassigned`,\r\n\t`notify_new_my`,\r\n\t`notify_reply_unassigned`,\r\n\t`notify_reply_my`,\r\n\t`notify_assigned`,\r\n\t`notify_pm`,\r\n\t`notify_note`\r\n\t) VALUES (\r\n\t'" . hesk_dbEscape($myuser['user']) . "',\r\n\t'" . hesk_dbEscape($myuser['pass']) . "',\r\n\t'" . intval($myuser['isadmin']) . "',\r\n\t'" . hesk_dbEscape($myuser['name']) . "',\r\n\t'" . hesk_dbEscape($myuser['email']) . "',\r\n\t'" . hesk_dbEscape($myuser['signature']) . "',\r\n\t'" . hesk_dbEscape($myuser['categories']) . "',\r\n\t'" . intval($myuser['autoassign']) . "',\r\n\t'" . hesk_dbEscape($myuser['features']) . "',\r\n\t'" . $myuser['afterreply'] . "' ,\r\n\t'" . $myuser['autostart'] . "' ,\r\n\t'" . $myuser['notify_customer_new'] . "' ,\r\n\t'" . $myuser['notify_customer_reply'] . "' ,\r\n\t'" . $myuser['show_suggested'] . "' ,\r\n\t'" . $myuser['notify_new_unassigned'] . "' ,\r\n\t'" . $myuser['notify_new_my'] . "' ,\r\n\t'" . $myuser['notify_reply_unassigned'] . "' ,\r\n\t'" . $myuser['notify_reply_my'] . "' ,\r\n\t'" . $myuser['notify_assigned'] . "' ,\r\n\t'" . $myuser['notify_pm'] . "',\r\n\t'" . $myuser['notify_note'] . "'\r\n\t)");
    $_SESSION['seluser'] = hesk_dbInsertID();
    unset($_SESSION['userdata']);
    hesk_process_messages(sprintf($hesklang['user_added_success'], $myuser['user'], $myuser['cleanpass']), './manage_users.php', 'SUCCESS');
}
开发者ID:Eximagen,项目名称:helpdesk,代码行数:24,代码来源:manage_users.php

示例15: new_user

function new_user()
{
    global $hesk_settings, $hesklang;
    global $hesk_db_link;
    /* A security check */
    hesk_token_check('POST');
    $myuser = hesk_validateUserInfo(0, $_SERVER['HTTP_REFERER']);
    /* Categories and Features will be stored as a string */
    $myuser['categories'] = implode(',', $myuser['categories']);
    $myuser['features'] = implode(',', $myuser['features']);
    /* user active */
    $user_active = hesk_input(hesk_POST('prof_active'));
    if (empty($user_active)) {
        $user_active = "0";
    }
    /* Check for duplicate usernames */
    if ($myuser['isclient'] == "1") {
        $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "clients` WHERE `user` = '" . hesk_dbEscape($myuser['user']) . "' LIMIT 1");
        if (hesk_dbNumRows($result) != 0) {
            hesk_process_messages($hesklang['duplicate_user'], 'manage_users.php');
        }
    } else {
        $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `user` = '" . hesk_dbEscape($myuser['user']) . "' LIMIT 1");
        if (hesk_dbNumRows($result) != 0) {
            hesk_process_messages($hesklang['duplicate_user'], 'manage_users.php');
        }
    }
    /* Admins will have access to all features and categories */
    if ($myuser['isadmin']) {
        $myuser['categories'] = '';
        $myuser['features'] = '';
    }
    // Check if user is client
    if (hesk_dbEscape($myuser['isclient']) == "1") {
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "clients` (\n\t\t`user`,\n\t\t`pass`,\n\t\t`isclient`,\n\t\t`name`,\n\t\t`email`,\n\t\t`address`,\n\t\t`phonenumber`,\n\t\t`poz_detyres`,\n\t\t`company_id`,\n\t\t`active`,\n\t\t`signature`\n\t\t) VALUES (\n\t\t'" . hesk_dbEscape($myuser['user']) . "',\n\t\t'" . hesk_dbEscape($myuser['pass']) . "',\n\t\t'" . intval($myuser['isclient']) . "',\n\t\t'" . hesk_dbEscape($myuser['name']) . "',\n\t\t'" . hesk_dbEscape($myuser['email']) . "',\n\t\t'" . hesk_dbEscape($myuser['address']) . "',\n\t\t'" . hesk_dbEscape($myuser['phonenumber']) . "',\n\t\t'" . hesk_dbEscape($myuser['poz_detyres']) . "',\n\t\t'" . hesk_dbEscape($myuser['company_id']) . "',\n\t\t'" . hesk_dbEscape($user_active) . "',\n\t\t'" . hesk_dbEscape($myuser['signature']) . "'\n\t\t)");
        $id = hesk_dbInsertID();
        foreach ($_POST['contract_id'] as $contract) {
            $sql = hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "contractforclient` (\n\t\t\t\t\t`contract_Id`, `client_Id`) VALUES('" . hesk_dbEscape($contract) . "', '" . $id . "')");
        }
    } else {
        hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` (\n\t\t`user`,\n\t\t`pass`,\n\t\t`isadmin`,\n\t\t`name`,\n\t\t`email`,\n\t\t`address`,\n\t\t`phonenumber`,\n\t\t`poz_detyres`,\n\t\t`active`,\n\t\t`signature`,\n\t\t`categories`,\n\t\t`autoassign`,\n\t\t`heskprivileges`,\n\t\t`afterreply`,\n\t\t`autostart`,\n\t\t`notify_customer_new`,\n\t\t`notify_customer_reply`,\n\t\t`show_suggested`,\n\t\t`notify_new_unassigned`,\n\t\t`notify_new_my`,\n\t\t`notify_reply_unassigned`,\n\t\t`notify_reply_my`,\n\t\t`notify_assigned`,\n\t\t`notify_pm`,\n\t\t`notify_note`\n\t\t) VALUES (\n\t\t'" . hesk_dbEscape($myuser['user']) . "',\n\t\t'" . hesk_dbEscape($myuser['pass']) . "',\n\t\t'" . intval($myuser['isadmin']) . "',\n\t\t'" . hesk_dbEscape($myuser['name']) . "',\n\t\t'" . hesk_dbEscape($myuser['email']) . "',\n\t\t'" . hesk_dbEscape($myuser['address']) . "',\n\t\t'" . hesk_dbEscape($myuser['phonenumber']) . "',\n\t\t'" . hesk_dbEscape($myuser['poz_detyres']) . "',\n\t\t'" . hesk_dbEscape($user_active) . "',\n\t\t'" . hesk_dbEscape($myuser['signature']) . "',\n\t\t'" . hesk_dbEscape($myuser['categories']) . "',\n\t\t'" . intval($myuser['autoassign']) . "',\n\t\t'" . hesk_dbEscape($myuser['features']) . "',\n\t\t'" . $myuser['afterreply'] . "' ,\n\t\t'" . $myuser['autostart'] . "' ,\n\t\t'" . $myuser['notify_customer_new'] . "' ,\n\t\t'" . $myuser['notify_customer_reply'] . "' ,\n\t\t'" . $myuser['show_suggested'] . "' ,\n\t\t'" . $myuser['notify_new_unassigned'] . "' ,\n\t\t'" . $myuser['notify_new_my'] . "' ,\n\t\t'" . $myuser['notify_reply_unassigned'] . "' ,\n\t\t'" . $myuser['notify_reply_my'] . "' ,\n\t\t'" . $myuser['notify_assigned'] . "' ,\n\t\t'" . $myuser['notify_pm'] . "',\n\t\t'" . $myuser['notify_note'] . "'\n\t\t)");
        $_SESSION['seluser'] = hesk_dbInsertID();
    }
    unset($_SESSION['userdata']);
    hesk_process_messages(sprintf($hesklang['user_added_success'], $myuser['user'], $myuser['cleanpass']), './manage_users.php', 'SUCCESS');
}
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:46,代码来源:manage_users.php


注:本文中的hesk_dbInsertID函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。