PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

alerts.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/alerts.php'
View Content
<?php
// This guard is used to ensure that users can't hit this outside of actual HESK code
if (!defined('IN_SCRIPT')) {
    die();
}

function hesk3_show_messages($messages) {
    $style_to_class = array(
        '0' => 'white',
        '1' => 'green',
        '2' => 'blue', // Info has no CSS class
        '3' => 'orange',
        '4' => 'red'
    );
    $style_to_ada_role = array(
        '0' => 'log',
        '1' => 'status',
        '2' => 'status',
        '3' => 'alert',
        '4' => 'alert'
    );
    foreach ($messages as $message):
    ?>
    <div class="main__content notice-flash">
        <div role="<?php echo $style_to_ada_role[$message['style']]; ?>" class="notification <?php echo $style_to_class[$message['style']]; ?> browser-default">
            <p><b><?php echo $message['title']; ?></b></p>
            <?php echo $message['message']; ?>
        </div>
    </div>
<?php
    endforeach;
}
attachments.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/attachments.php'
View Content
<?php
require_once(HESK_PATH . 'inc/attachments.inc.php');

// This guard is used to ensure that users can't hit this outside of actual HESK code
if (!defined('IN_SCRIPT')) {
    die();
}

function hesk3_output_drag_and_drop_attachment_holder($id = 'filedrop') {
    global $hesk_settings;

    if ($hesk_settings['attachments']['use']) {
        build_dropzone_markup(false, $id, 1, false);
    }
}

function hesk3_output_drag_and_drop_script($failed_attachments_key, $id = 'filedrop') {
    global $hesk_settings;

    if ($hesk_settings['attachments']['use']) {
        display_dropzone_field(HESK_PATH . 'upload_attachment.php', false, $id);

        dropzone_display_existing_files(hesk_SESSION_array($failed_attachments_key), $id);
        hesk_cleanSessionVars($failed_attachments_key);
    }
}
custom-fields.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/custom-fields.php'
View Content
<?php
// This guard is used to ensure that users can't hit this outside of actual HESK code
if (!defined('IN_SCRIPT')) {
    die();
}

function hesk3_output_custom_fields($customFields) {
    global $hesk_settings, $hesklang;

    foreach ($customFields as $customField) {
        switch ($customField['type']) {
            case 'radio':
                ?>
                <div class="form-group <?php echo $customField['iserror'] ? 'isError' : '' ?>">
                    <label class="label <?php echo $customField['req'] ? 'required' : '' ?>">
                        <?php echo $customField['name:']; ?>
                    </label>
                    <?php
                    $i = 1000;
                    foreach ($customField['value']['options'] as $option):
                        ?>
                        <div class="radio-custom">
                            <input type="radio" name="<?php echo $customField['name'] ?>"
                                   id="<?php echo $customField['name'].$i; ?>"
                                   value="<?php echo $option['value']; ?>"
                                   <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                                   <?php echo $option['selected'] ? 'checked' : ''; ?>>
                            <label for="<?php echo $customField['name'].$i; ?>">
                                <?php echo $option['value']; ?>
                            </label>
                        </div>
                    <?php
                        $i++;
                    endforeach; ?>
                </div>
            <?php
                break;
            case 'select':
                ?>
                <section class="param blue-select">
                    <span class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['name:']; ?></span>
                        <select name="<?php echo $customField['name']; ?>" id="<?php echo $customField['name']; ?>" class="<?php echo $customField['iserror'] ? 'isError' : '' ?>" <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>>
                            <?php if (!empty($customField['value']['show_select'])): ?>
                            <option value=""><?php echo $hesklang['select']; ?></option>
                            <?php
                            endif;
                            $i = 2000;
                            foreach ($customField['value']['options'] as $option):
                            ?>
                            <option <?php echo $option['selected'] ? 'selected' : '' ?>><?php echo $option['value']; ?></option>
                            <?php
                                $i++;
                            endforeach; ?>
                        </select>
                </section>
            <?php
                break;
            case 'checkbox':
                ?>
                <section class="param checkboxs <?php echo $customField['iserror'] ? 'isError' : '' ?>">
                    <label class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['name:']; ?></label>
                    <?php
                    $i = 3000;
                    foreach ($customField['value']['options'] as $option):
                        ?>
                    <div class="checkbox-custom">
                        <input type="checkbox" id="<?php echo $customField['name'].$i; ?>"
                               name="<?php echo $customField['name']; ?>[]" value="<?php echo $option['value']; ?>"
                               <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                               <?php if ($customField['iserror']): ?>class="isError"<?php endif; ?>
                            <?php echo $option['selected'] ? 'checked' : ''; ?>>
                        <label for="<?php echo $customField['name'].$i; ?>"><?php echo $option['value']; ?></label>
                    </div>
                        <?php
                        $i++;
                    endforeach;
                    ?>
                </section>
                <?php
                break;
            case 'textarea':
                ?>
                <div class="form-group">
                    <label class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['name:']; ?></label>
                    <textarea name="<?php echo $customField['name']; ?>"
                              rows="<?php echo intval($customField['value']['rows']); ?>"
                              cols="<?php echo intval($customField['value']['cols']); ?>"
                              class="form-control <?php if ($customField['iserror']): ?><?php endif; ?>"
                              <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                              <?php echo $customField['req'] ? 'required' : '' ?>><?php echo $customField['original_value']; ?></textarea>
                </div>
            <?php
                break;
            case 'date':
                if (is_string($customField['original_value']) && ($dd = hesk_datepicker_get_date($customField['original_value']))) {
                    $hesk_settings['datepicker']['#'.$customField['name']]['timestamp'] = $dd->getTimestamp();
                }
                ?>
                <!--[if !IE]><!-->
                <section class="param calendar">
                    <label class="label <?php echo $customField['req'] ? 'required' : '' ?> <?php if ($customField['iserror']) echo 'isErrorStr'; ?>"><?php echo $customField['name:']; ?></label>
                    <div class="calendar--button" aria-label="<?php echo $hesklang['date']; ?>">
                        <button type="button">
                            <svg class="icon icon-calendar" aria-label="<?php echo $hesklang['date']; ?>">
                                <use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-calendar"></use>
                            </svg>
                        </button>
                        <input name="<?php echo $customField['name']; ?>"
                               id="<?php echo $customField['name']; ?>"
                               value="<?php echo $customField['original_value']; ?>"
                               aria-label="<?php echo $hesklang['date']; ?>"
                               <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                               type="text"
                               class="datepicker">
                    </div>
                    <div class="calendar--value" <?php if ($customField['original_value']) { ?>style="display: block"<?php } ?>>
                        <span <?php if ($customField['iserror'] && ! empty($customField['original_value'])) echo 'class="isErrorStr"'; ?>><?php echo $customField['original_value']; ?></span>
                        <i class="close">
                            <svg class="icon icon-close">
                                <use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-close"></use>
                            </svg>
                        </i>
                    </div>
                </section>
                <!--<![endif]-->
                <!--[if IE]>
                <div class="form-group">
                    <label class="label <?php echo $customField['req'] ? 'required' : '' ?>">
                        <?php echo $customField['name:']; ?>
                    </label>
                    <input type="text" class="form-control <?php if ($customField['iserror']) { ?>isError<?php } ?>"
                           value="<?php echo $customField['original_value']; ?>"
                           name="<?php echo $customField['name']; ?>"
                           <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                           <?php echo $customField['req'] ? 'required' : '' ?>>
                    <label class="label">
                        <?php echo $hesklang['d_format']; ?>: <?php echo date($customField['value']['date_format'], mktime(0, 0, 0, 12, 30, date('Y'))); ?>
                    </label>
                </div>
                <![endif]-->
            <?php
                break;
            case 'email':
                $suggest = $hesk_settings['detect_typos'] ?
                    'onblur="HESK_FUNCTIONS.suggestEmail(\''.$customField['name'].'\', \''.$customField['name'].'_suggestions\', 0'.($customField['value']['multiple'] ? ',1' : '').')"' :
                    '';
                ?>
                <div class="form-group">
                    <label class="label <?php echo $customField['req'] ? 'required' : '' ?>">
                        <?php echo $customField['name:']; ?>
                    </label>
                    <input type="<?php echo $customField['value']['multiple'] ? 'text' : 'email'; ?>"
                           id="<?php echo $customField['name']; ?>"
                           class="form-control"
                           value="<?php echo $customField['original_value']; ?>"
                           name="<?php echo $customField['name']; ?>"
                           aria-label="<?php echo $hesklang['email']; ?>"
                           <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                           <?php echo $customField['req'] ? 'required' : '' ?>
                            <?php echo $suggest; ?>>
                    <div id="<?php echo $customField['name']; ?>_suggestions" class="email-suggestion"></div>
                </div>
            <?php
                break;
            case 'hidden':
                ?>
                <input type="hidden"
                       name="<?php echo $customField['name']; ?>"
                       <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                       value="<?php echo $customField['value']['default_value']; ?>">
            <?php
                break;
            default:
                ?>
                <div class="form-group">
                    <label for="<?php echo $customField['name']; ?>" class="label <?php echo $customField['req'] ? 'required' : '' ?>">
                        <?php echo $customField['name:']; ?>
                    </label>
                    <input type="text" class="form-control <?php if ($customField['iserror']) { ?>isError<?php } ?>"
                           value="<?php echo $customField['value']['default_value']; ?>"
                           name="<?php echo $customField['name']; ?>"
                           id="<?php echo $customField['name']; ?>"
                           maxlength="<?php echo intval($customField['value']['max_length']); ?>"
                           <?php echo $hesk_settings['disable_autofill_customer'] ? 'autocomplete="off" aria-autocomplete="none"' : ''; ?>
                           <?php echo $customField['req'] ? 'required' : '' ?>>
                </div>
            <?php
                break;
        }
    }
}

function hesk3_output_custom_fields_for_display($customFields) {
    foreach ($customFields as $customField)
    {
        switch ($customField['type'])
        {
            case 'email':
                $customField['value'] = '<a href="mailto:'.$customField['value'].'" aria-label="Mail to">'.$customField['value'].'</a>';
                break;
            case 'date':
                $customField['value'] = hesk_custom_date_display_format($customField['value'], $customField['date_format']);
                break;
        }

        echo '
            <div>
                <span class="custom-field-title">'.$customField['name:'].'</span>
                <span>'.$customField['value'].'</span>
            </div>
            ';
    }
}
kb-search.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/kb-search.php'
View Content
<?php
// This guard is used to ensure that users can't hit this outside of actual HESK code
if (!defined('IN_SCRIPT')) {
    die();
}

function displayKbSearch() {
    global $hesk_settings, $hesklang;

    if ($hesk_settings['kb_search'] && $hesk_settings['kb_enable']): ?>
        <form action="knowledgebase.php" method="get" style="display: inline; margin: 0;" name="searchform">
            <div class="search__form">
                <div class="form-group">
                    <button class="btn search__submit" aria-label="<?php echo $hesklang['search']; ?>">
                        <svg class="icon icon-search">
                            <use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-search"></use>
                        </svg>
                    </button>
                    <input id="kb_search" name="search" class="form-control" for="searchform" type="text" aria-label="<?php echo $hesklang['search_for_articles']; ?>" placeholder="<?php echo $hesklang['search_for_articles']; ?>">
                    <?php if ($hesk_settings['kb_search'] === 1): ?>
                        <button id="search-button" type="submit" class="btn btn-full"><?php echo $hesklang['search']; ?></button>
                    <?php endif; ?>
                </div>
                <div class="kb-suggestions boxed">
                    <h6><?php echo $hesklang['sc']; ?>:</h6>
                    <ul id="kb-suggestion-list" class="type--list">
                    </ul>
                </div>
            </div>
        </form>
    <?php
    endif;
}

function outputSearchStyling() {
    global $hesk_settings;

    if (!$hesk_settings['kb_search'] || !$hesk_settings['kb_enable']) return;

    if ($hesk_settings['kb_search'] === 1): ?>
        #kb_search {
            width: 70%;
        }
        #search-button {
            width: 30%;
            margin-left: 10px;
            height: inherit;
        }
        <?php
    endif;
}

function outputSearchJavascript() {
    global $hesk_settings, $hesklang;

    if (!$hesk_settings['kb_search'] || !$hesk_settings['kb_enable']) return;

    ?>
    <script>
        var noArticlesFoundText = <?php echo json_encode($hesklang['nsfo']); ?>;

        document.addEventListener("DOMContentLoaded", function() {
            HESK_FUNCTIONS.getKbSearchSuggestions($('#kb_search'), function(data) {
                $('.kb-suggestions').show();
                var $suggestionList = $('#kb-suggestion-list');
                $suggestionList.html('');
                var format = '<a href="knowledgebase.php?article={0}" class="suggest-preview">' +
                    '<span class="icon-in-circle" aria-hidden="true">' +
                    '<svg class="icon icon-knowledge">' +
                    '<use xlink:href="./theme/hesk3/customer/img/sprite.svg#icon-knowledge"></use>' +
                    '</svg>' +
                    '</span>' +
                    '<div class="suggest-preview__text">' +
                    '<p class="suggest-preview__title">{1}</p>' +
                    '<p>{2}</p>' +
                    '</div>' +
                    '</a>';
                var results = false;
                $.each(data, function() {
                    results = true;
                    $('#kb-suggestion-list').append(format.replace('{0}', this.id).replace('{1}', this.subject).replace('{2}', this.contentPreview));
                });

                if (!results) {
                    $suggestionList.append('<li class="no-articles-found">' + noArticlesFoundText + '</li>');
                }
            });
        });
    </script>
    <?php
}
my-tickets-search.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/my-tickets-search.php'
View Content
<?php
// This guard is used to ensure that users can't hit this outside of actual HESK code
if (!defined('IN_SCRIPT')) {
    die();
}

function displayMyTicketsSearch($searchType, $searchCriteria) {
    global $hesklang;
    ?>

        <form action="my_tickets.php" method="get" aria-label="<?php echo $hesklang['customer_my_tickets_search_for_tickets']; ?>" style="display: inline; margin: 0;" name="searchform">
            <div class="search__form">
                <div class="form-group">
                    <button class="btn search__submit" aria-label="<?php echo $hesklang['customer_my_tickets_search_for_tickets']; ?>">
                        <svg class="icon icon-search">
                            <use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-search"></use>
                        </svg>
                    </button>
                    <input id="kb_search" name="search" class="form-control" type="text"
                           placeholder="<?php echo $hesklang['customer_my_tickets_search_for_tickets']; ?>"
                           aria-label="<?php echo $hesklang['customer_my_tickets_search_for_tickets']; ?>"
                           value="<?php echo stripslashes($searchCriteria); ?>">
                    <select name="search-by" id="search-by">
                        <option value="trackid" <?php if ($searchType === 'trackid') { echo 'selected'; } ?>><?php echo $hesklang['trackID']; ?></option>
                        <option value="subject" <?php if ($searchType === 'subject') { echo 'selected'; } ?>><?php echo $hesklang['subject']; ?></option>
                        <option value="message" <?php if ($searchType === 'message') { echo 'selected'; } ?>><?php echo $hesklang['message']; ?></option>
                    </select>
                    <button id="search-button" type="submit" class="btn btn-full"><?php echo $hesklang['search']; ?></button>
                </div>
            </div>
        </form>
    <?php
}

function outputSearchJavascript() {
    global $hesklang;
    ?>
    <script>
        $('#search-by').selectize({
            onInitialize: function () {
                var $input = this.$control; // Selectize input container
                $input.attr({
                    "role": "combobox",
                    "aria-expanded": "false",
                    "aria-label": "<?php echo $hesklang['wsel']; ?>", // Adjust label as needed
                    "aria-controls": this.$dropdown.attr("id"), // Links input to dropdown
                    "tabindex": "0" // Ensure it is focusable
                });
                this.$dropdown.attr("role", "listbox"); // Dropdown should be a listbox
                this.$dropdown.find("[data-value]").attr("role", "option"); // Each item is an option
            },
            onDropdownOpen: function ($dropdown) {
                this.$control.attr("aria-expanded", "true");
            },
            onDropdownClose: function ($dropdown) {
                this.$control.attr("aria-expanded", "false");
            }
        });
    </script>
    <?php
}
pager.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/pager.php'
View Content
<?php
function output_pager($totalPages, $currentPage, $queryUrl) {
    global $hesklang;

    $prev_page = ($currentPage - 1 <= 0) ? 0 : $currentPage - 1;
    $next_page = ($currentPage + 1 > $totalPages) ? 0 : $totalPages + 1;
    $query_param = $queryUrl === '' ? '?' : '&';

    if ($totalPages <= 1) {
        return;
    }

    /* List pages */
    if ($totalPages >= 7) {
        if ($currentPage > 2) {
            echo '
                        <a href="'.$queryUrl.$query_param.'page-number=1" class="btn pagination__nav-btn">
                            <svg class="icon icon-chevron-left" style="margin-right:-6px">
                              <use xlink:href="'. TEMPLATE_PATH .'img/sprite.svg#icon-chevron-left"></use>
                            </svg>
                            <svg class="icon icon-chevron-left">
                              <use xlink:href="'. TEMPLATE_PATH .'img/sprite.svg#icon-chevron-left"></use>
                            </svg>
                            '.$hesklang['pager_first'].'
                        </a>';
        }

        if ($prev_page) {
            echo '
                        <a href="'.$queryUrl.$query_param.'page-number='.$prev_page.'" class="btn pagination__nav-btn">
                            <svg class="icon icon-chevron-left">
                              <use xlink:href="'. TEMPLATE_PATH .'img/sprite.svg#icon-chevron-left"></use>
                            </svg>
                            '.$hesklang['pager_previous'].'
                        </a>';
        }
    }

    echo '<ul class="pagination__list">';
    for ($i=1; $i<=$totalPages; $i++) {
        if ($i <= ($currentPage+5) && $i >= ($currentPage-5)) {
            if ($i == $currentPage) {
                echo '
                            <li class="pagination__item is-current">
                              <a href="javascript:" class="pagination__link">'.$i.'</a>
                            </li>';
            } else {
                echo '
                            <li class="pagination__item ">
                              <a href="'.$queryUrl.$query_param.'page-number='.$i.'" class="pagination__link">'.$i.'</a>
                            </li>';
            }
        }
    }
    echo '</ul>';

    if ($totalPages >= 7) {
        if ($next_page) {
            echo '
                        <a href="'.$queryUrl.$query_param.'page-number='.$next_page.'" class="btn pagination__nav-btn">
                            '.$hesklang['pager_next'].'
                            <svg class="icon icon-chevron-right">
                              <use xlink:href="'. TEMPLATE_PATH .'img/sprite.svg#icon-chevron-right"></use>
                            </svg>
                        </a>';
        }

        if ($currentPage < ($totalPages - 1)) {
            echo '
                        <a href="'.$queryUrl.$query_param.'page-number='.$totalPages.'" class="btn pagination__nav-btn">
                            '.$hesklang['pager_last'].'
                            <svg class="icon icon-chevron-right">
                              <use xlink:href="'. TEMPLATE_PATH .'img/sprite.svg#icon-chevron-right"></use>
                            </svg>
                            <svg class="icon icon-chevron-right" style="margin-left:-6px">
                              <use xlink:href="'. TEMPLATE_PATH .'img/sprite.svg#icon-chevron-right"></use>
                            </svg>
                        </a>';
        }
    }
}
rating.php
wget 'https://sme10.lists2.roe3.org/hesk/theme/hesk3/customer/util/rating.php'
View Content
<?php
// This guard is used to ensure that users can't hit this outside of actual HESK code
if (!defined('IN_SCRIPT')) {
    die();
}

function hesk3_get_customer_rating($num) {
    $rounded_num = intval(hesk_round_to_half($num) * 10);

    return '
    <div class="star-rate rate-'. $rounded_num .'">
        <svg class="icon icon-star-stroke">
            <use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-star-stroke"></use>
        </svg>
        <div class="star-filled">
            <svg class="icon icon-star-filled">
                <use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-star-filled"></use>
            </svg>
        </div>
    </div>';
}