function plugin_init_moreticket()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['add_css']['moreticket'] = 'moreticket.css';
    $PLUGIN_HOOKS['csrf_compliant']['moreticket'] = true;
    $PLUGIN_HOOKS['change_profile']['moreticket'] = array('PluginMoreticketProfile', 'initProfile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginMoreticketProfile', array('addtabon' => 'Profile'));
        if (class_exists('PluginMoreticketProfile')) {
            // only if plugin activated
            $config = new PluginMoreticketConfig();
            if (Session::haveRight("plugin_moreticket", UPDATE)) {
                if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false && ($config->useWaiting() == true || $config->useSolution() == true)) {
                    $PLUGIN_HOOKS['add_javascript']['moreticket'][] = 'scripts/moreticket.js';
                    $PLUGIN_HOOKS['add_javascript']['moreticket'][] = 'scripts/moreticket.js.php';
                }
                $PLUGIN_HOOKS['config_page']['moreticket'] = 'front/config.form.php';
                $PLUGIN_HOOKS['pre_item_update']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'beforeUpdate'));
                $PLUGIN_HOOKS['pre_item_add']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'beforeAdd'));
                $PLUGIN_HOOKS['item_add']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'afterAdd'));
                $PLUGIN_HOOKS['item_update']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'afterUpdate'));
                $PLUGIN_HOOKS['item_empty']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'emptyTicket'));
            }
            if (Session::haveRight('plugin_moreticket', READ)) {
                Plugin::registerClass('PluginMoreticketWaitingTicket', array('addtabon' => 'Ticket'));
                Plugin::registerClass('PluginMoreticketCloseTicket', array('addtabon' => 'Ticket'));
            }
        }
    }
}
 /**
  * Display moreticket-item's tab for each users
  *
  * @param CommonGLPI $item
  * @param int $withtemplate
  * @return array|string
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $config = new PluginMoreticketConfig();
     if (!$withtemplate) {
         if ($item->getType() == 'Ticket' && $config->useWaiting() == true) {
             if ($_SESSION['glpishow_count_on_tabs']) {
                 return self::createTabEntry(self::getTypeName(2), countElementsInTable($this->getTable(), "`tickets_id` = '" . $item->getID() . "'"));
             }
             return self::getTypeName(2);
         }
     }
     return '';
 }
 LICENSE

 This file is part of Moreticket.

 Moreticket is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Moreticket is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Moreticket. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
define('GLPI_ROOT', '../../..');
include GLPI_ROOT . "/inc/includes.php";
//change mimetype
header("Content-type: application/javascript");
//not executed in self-service interface & right verification
if ($_SESSION['glpiactiveprofile']['interface'] == "central") {
    $config = new PluginMoreticketConfig();
    $use_waiting = $config->useWaiting();
    $use_solution = $config->useSolution();
    $solution_status = $config->solutionStatus();
    $params = array('root_doc' => $CFG_GLPI['root_doc'], 'waiting' => CommonITILObject::WAITING, 'closed' => CommonITILObject::CLOSED, 'use_waiting' => $use_waiting, 'use_solution' => $use_solution, 'solution_status' => $solution_status);
    echo "moreticket(" . json_encode($params) . ");";
}