Skip to content
Snippets Groups Projects
  • Thane de Loth's avatar
    7042e6c8
    Adopt translation work from Thane de Loth · 7042e6c8
    Thane de Loth authored
    Multilanguage Support via gettext
    
    - added gettext encapsulations to all texts i thought necessary
    - added fallback function for the case that the gettext extension isn't loaded
    - added browser language detection
    - added gettext to the list of optional extensions in setup
    - rewritten some of the texts to use sprintf instead of appending strings
    - added german translation file
    - removed mark_overdue-confirm from cannedresponses.inc.php
    
    extend multi language support and a fex fixes
    
    - Better detection of translation files
    - Added functionality to redirect language codes (see redirecting
    language codes)
    - Ticket Status can be translated
    - The Datepicker can be translated
    - Extended functionality of 'testlang.php' to show what language code is
    used to translate
    
    Forgotten to apply a patch from RC5 to RC6
    
    - Forgotten to change $var to $vars in line 380 of class.mailfetch.php
    - Removed unneeded comment
    
    Added php_gettext as primary translation engine
    
    - Added php_gettext support (thanks to Danilo Segan and Steven
    Armstrong)
    - php_gettext is now the primary translation engine
    - Extended language detection functionality
    
    Add error/misconfiguration checks and fix undefined variables
    7042e6c8
    History
    Adopt translation work from Thane de Loth
    Thane de Loth authored
    Multilanguage Support via gettext
    
    - added gettext encapsulations to all texts i thought necessary
    - added fallback function for the case that the gettext extension isn't loaded
    - added browser language detection
    - added gettext to the list of optional extensions in setup
    - rewritten some of the texts to use sprintf instead of appending strings
    - added german translation file
    - removed mark_overdue-confirm from cannedresponses.inc.php
    
    extend multi language support and a fex fixes
    
    - Better detection of translation files
    - Added functionality to redirect language codes (see redirecting
    language codes)
    - Ticket Status can be translated
    - The Datepicker can be translated
    - Extended functionality of 'testlang.php' to show what language code is
    used to translate
    
    Forgotten to apply a patch from RC5 to RC6
    
    - Forgotten to change $var to $vars in line 380 of class.mailfetch.php
    - Removed unneeded comment
    
    Added php_gettext as primary translation engine
    
    - Added php_gettext support (thanks to Danilo Segan and Steven
    Armstrong)
    - php_gettext is now the primary translation engine
    - Extended language detection functionality
    
    Add error/misconfiguration checks and fix undefined variables
ajax.kbase.php 2.08 KiB
<?php
/*********************************************************************
    ajax.kbase.php

    AJAX interface for knowledge base related...allowed methods.

    Peter Rotich <peter@osticket.com>
    Copyright (c)  2006-2013 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
if(!defined('INCLUDE_DIR')) die('!');


class KbaseAjaxAPI extends AjaxController {

    function cannedResp($id, $format='text') {
        global $thisstaff, $cfg;

        include_once(INCLUDE_DIR.'class.canned.php');

        if(!$id || !($canned=Canned::lookup($id)) || !$canned->isEnabled())
            Http::response(404, 'No such premade reply');

        if (!$cfg->isHtmlThreadEnabled())
            $format .= '.plain';

        return $canned->getFormattedResponse($format);
    }

    function faq($id, $format='html') {
        //XXX: user ajax->getThisStaff() (nolint)
        global $thisstaff;
        include_once(INCLUDE_DIR.'class.faq.php');

        if(!($faq=FAQ::lookup($id)))
            return null;

        //TODO: $fag->getJSON() for json format. (nolint)
        $resp = sprintf(
                '<div style="width:650px;">
                 <strong>%s</strong><div class="thread-body">%s</div>
                 <div class="clear"></div>
                 <div class="faded">'.__('Last updated %s').'</div>
                 <hr>
                 <a href="faq.php?id=%d">'.__('View').'</a> | <a href="faq.php?id=%d">'.__('Attachments (%d)').'</a>',
                $faq->getQuestion(),
                $faq->getAnswerWithImages(),
                Format::db_daydatetime($faq->getUpdateDate()),
                $faq->getId(),
                $faq->getId(),
                $faq->getNumAttachments());
        if($thisstaff && $thisstaff->canManageFAQ()) {
            $resp.=sprintf(' | <a href="faq.php?id=%d&a=edit">'.__('Edit').'</a>',$faq->getId());

        }
        $resp.='</div>';

        return $resp;
    }
}
?>