function plugin_init_addressing()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['addressing'] = true;
    //   $PLUGIN_HOOKS['change_profile']['addressing'] = array('PluginAddressingProfile', 'changeProfile');
    //   $PLUGIN_HOOKS['pre_item_purge']['addressing'] = array('Profile' => array('PluginAddressingProfile',
    //                                                                            'purgeProfiles'));
    Plugin::registerClass('PluginAddressingProfile', array('addtabon' => array('Profile')));
    if (Session::getLoginUserID()) {
        if (Session::haveRight('plugin_addressing', READ)) {
            $PLUGIN_HOOKS["menu_toadd"]['addressing'] = array('tools' => 'PluginAddressingMenu');
        }
        if (Session::haveRight('plugin_addressing', UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['addressing'] = 1;
        }
        // Config page
        if (Session::haveRight("config", UPDATE)) {
            $PLUGIN_HOOKS['config_page']['addressing'] = 'front/config.form.php';
        }
        // Add specific files to add to the header : javascript or css
        $PLUGIN_HOOKS['add_css']['addressing'] = "addressing.css";
        $PLUGIN_HOOKS['add_javascript']['addressing'] = 'addressing.js';
        $PLUGIN_HOOKS['post_init']['addressing'] = array('PluginAddressingPing_Equipment', 'postinit');
    }
}
Exemple #2
0
function plugin_init_positions()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['positions'] = true;
    $PLUGIN_HOOKS['change_profile']['positions'] = array('PluginPositionsProfile', 'initProfile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginPositionsProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginPositionsPosition', array('addtabon' => 'Location'));
        if (Session::haveRight("plugin_positions", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['positions'] = 1;
            $PLUGIN_HOOKS['config_page']['positions'] = 'front/config.form.php';
        }
        if (Session::haveRight("plugin_positions", READ)) {
            $PLUGIN_HOOKS['helpdesk_menu_entry']['positions'] = '/front/map.form.php';
            $PLUGIN_HOOKS['menu_toadd']['positions'] = array('tools' => 'PluginPositionsMenu');
        }
        // Add specific files to add to the header : javascript or css
        $PLUGIN_HOOKS['add_javascript']['positions'] = array("lib/plupload/plupload.full.js", "lib/extjs/adapter/ext/ext-base.js", "lib/extjs/ext-all.js", "upload.js", "positions.js", "geoloc.js", "lib/canvas/canvasXpress.min.js", "lib/canvas/ext-canvasXpress.js", "lib/canvas/color-field.js");
        //css
        $PLUGIN_HOOKS['add_css']['positions'] = array("positions.css", "lib/canvas/color-field.css", "lib/extjs/resources/css/ext-all.css");
        if (class_exists('PluginTreeviewConfig')) {
            $PLUGIN_HOOKS['treeview_params']['positions'] = array('PluginPositionsPosition', 'showPositionTreeview');
        }
    }
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['positions'] = 'plugin_positions_postinit';
}
 static function beforeUpdate(Problem $problem)
 {
     if (!is_array($problem->input) || !count($problem->input)) {
         // Already cancel by another plugin
         return false;
     }
     //    Toolbox::logDebug("PluginBehaviorsProblem::beforeUpdate(), Problem=", $problem);
     $config = PluginBehaviorsConfig::getInstance();
     // Check is the connected user is a tech
     if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('problem', UPDATE)) {
         return false;
         // No check
     }
     $soltyp = isset($problem->input['solutiontypes_id']) ? $problem->input['solutiontypes_id'] : $problem->fields['solutiontypes_id'];
     // Wand to solve/close the problem
     if (isset($problem->input['solutiontypes_id']) && $problem->input['solutiontypes_id'] || isset($problem->input['solution']) && $problem->input['solution'] || isset($problem->input['status']) && in_array($problem->input['status'], array_merge(Problem::getSolvedStatusArray(), Problem::getClosedStatusArray()))) {
         if ($config->getField('is_problemsolutiontype_mandatory')) {
             if (!$soltyp) {
                 unset($problem->input['status']);
                 unset($problem->input['solution']);
                 unset($problem->input['solutiontypes_id']);
                 Session::addMessageAfterRedirect(__('You cannot close a problem without solution type', 'behaviors'), true, ERROR);
             }
         }
     }
 }
Exemple #4
0
function plugin_init_environment()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['environment'] = true;
    $PLUGIN_HOOKS['change_profile']['environment'] = array('PluginEnvironmentProfile', 'changeProfile');
    $key = array_search("environment", $_SESSION['glpi_plugins']);
    if ($key == false) {
        $_SESSION["glpi_plugin_environment_installed"] = 0;
        $_SESSION["glpi_plugin_environment_appliances"] = 0;
        $_SESSION["glpi_plugin_environment_webapplications"] = 0;
        $_SESSION["glpi_plugin_environment_certificates"] = 0;
        $_SESSION["glpi_plugin_environment_accounts"] = 0;
        $_SESSION["glpi_plugin_environment_domains"] = 0;
        $_SESSION["glpi_plugin_environment_databases"] = 0;
        $_SESSION["glpi_plugin_environment_badges"] = 0;
    }
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginEnvironmentProfile', array('addtabon' => 'Profile'));
        if (plugin_environment_haveRight("environment", "r") && isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            $PLUGIN_HOOKS['menu_entry']['environment'] = 'front/environment.php';
        }
        if (class_exists('PluginEnvironmentProfile')) {
            // only if plugin activated
            //Clean Plugin on Profile delete
            $PLUGIN_HOOKS['pre_item_purge']['environment'] = array('Profile' => array('PluginEnvironmentProfile', 'purgeProfiles'));
        }
    }
}
Exemple #5
0
function plugin_init_routetables()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['routetables'] = true;
    $PLUGIN_HOOKS['change_profile']['routetables'] = array('PluginRoutetablesProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['routetables'] = true;
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginRoutetablesRoutetable', array('document_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true));
        Plugin::registerClass('PluginRoutetablesProfile', array('addtabon' => 'Profile'));
        // Display a menu entry ?
        if (plugin_routetables_haveRight("routetables", "r")) {
            $PLUGIN_HOOKS['menu_entry']['routetables'] = 'front/routetable.php';
            $PLUGIN_HOOKS['submenu_entry']['routetables']['search'] = 'front/routetable.php';
        }
        if (plugin_routetables_haveRight("routetables", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['routetables']['add'] = 'front/routetable.form.php?new=1';
            $PLUGIN_HOOKS['use_massive_action']['routetables'] = 1;
        }
        // Import from Data_Injection plugin
        $PLUGIN_HOOKS['migratetypes']['routetables'] = 'plugin_datainjection_migratetypes_routetables';
        if (class_exists('PluginRoutetablesRoutetable_Item')) {
            // only if plugin activated
            $PLUGIN_HOOKS['pre_item_purge']['routetables'] = array('Profile' => array('PluginRoutetablesProfile', 'purgeProfiles'));
            $PLUGIN_HOOKS['plugin_datainjection_populate']['routetables'] = 'plugin_datainjection_populate_routetables';
        }
        // End init, when all types are registered
        $PLUGIN_HOOKS['post_init']['routetables'] = 'plugin_routetables_postinit';
    }
}
Exemple #6
0
function plugin_init_consumables()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['consumables'] = true;
    $PLUGIN_HOOKS['change_profile']['consumables'] = array('PluginConsumablesProfile', 'initProfile');
    $PLUGIN_HOOKS['add_css']['consumables'] = array('consumables.css');
    $PLUGIN_HOOKS['add_javascript']['consumables'][] = 'consumables.js';
    if (Session::getLoginUserID()) {
        if (class_exists('PluginConsumablesField')) {
            foreach (PluginconsumablesField::$types as $item) {
                if (isset($_SERVER['REQUEST_URI']) && strpos(strtolower($_SERVER['REQUEST_URI']), strtolower($item)) !== false) {
                    $PLUGIN_HOOKS['add_javascript']['consumables'][] = 'consumables.js.php';
                }
            }
        }
        Plugin::registerClass('PluginConsumablesProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginConsumablesRequest', array('addtabon' => 'User', 'notificationtemplates_types' => true));
        Plugin::registerClass('PluginConsumablesRequest', array('addtabon' => 'ConsumableItem'));
        $PLUGIN_HOOKS['item_add']['consumables'] = array('ConsumableItem' => array('PluginConsumablesField', 'postAddConsumable'));
        $PLUGIN_HOOKS['pre_item_update']['consumables'] = array('ConsumableItem' => array('PluginConsumablesField', 'preUpdateConsumable'));
        if (Session::haveRight("plugin_consumables", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['consumables'] = 1;
        }
        if (Session::haveRight("plugin_consumables", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['consumables'] = array('plugins' => 'PluginConsumablesMenu');
            $PLUGIN_HOOKS['helpdesk_menu_entry']['consumables'] = '/front/wizard.php';
        }
        // Post item purge
        $PLUGIN_HOOKS['item_purge']['consumables'] = array('ConsumableItem' => 'plugin_item_purge_consumables');
    }
}
function plugin_init_badges()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['badges'] = true;
    $PLUGIN_HOOKS['assign_to_ticket']['badges'] = true;
    $PLUGIN_HOOKS['change_profile']['badges'] = array('PluginBadgesProfile', 'initProfile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginBadgesBadge', array('linkuser_types' => true, 'document_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'notificationtemplates_types' => true));
        Plugin::registerClass('PluginBadgesProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginBadgesConfig', array('addtabon' => 'CronTask'));
        if (class_exists('PluginResourcesResource')) {
            PluginResourcesResource::registerType('PluginBadgesBadge');
        }
        $plugin = new Plugin();
        if (!$plugin->isActivated('environment') && Session::haveRight("plugin_badges", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['badges'] = array('assets' => 'PluginBadgesMenu');
        }
        if (Session::haveRight("plugin_badges", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['badges'] = 1;
        }
        if (class_exists('PluginBadgesBadge')) {
            // only if plugin activated
            $PLUGIN_HOOKS['plugin_datainjection_populate']['badges'] = 'plugin_datainjection_populate_badges';
        }
        // Import from Data_Injection plugin
        $PLUGIN_HOOKS['migratetypes']['badges'] = 'plugin_datainjection_migratetypes_badges';
    }
}
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'));
            }
        }
    }
}
Exemple #9
0
/**
 * Function Init
 */
function plugin_init_uninstall()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $UNINSTALL_TYPES, $UNINSTALL_DIRECT_CONNECTIONS_TYPE;
    $PLUGIN_HOOKS['csrf_compliant']['uninstall'] = true;
    Plugin::registerClass('PluginUninstallPreference', array('addtabon' => array('Preference')));
    Plugin::registerClass('PluginUninstallProfile', array('addtabon' => array('Profile')));
    $plugin = new Plugin();
    if ($plugin->isActivated('uninstall')) {
        $UNINSTALL_TYPES = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer');
        $UNINSTALL_DIRECT_CONNECTIONS_TYPE = array('Monitor', 'Peripheral', 'Phone', 'Printer');
        if (Session::getLoginUserID()) {
            if (Session::haveRight(PluginUninstallProfile::$rightname, READ)) {
                $PLUGIN_HOOKS['use_massive_action']['uninstall'] = true;
                if (Session::haveRight('uninstall:profile', READ)) {
                    // Add link in GLPI plugins list :
                    $PLUGIN_HOOKS["menu_toadd"]['uninstall'] = array('admin' => 'PluginUninstallModel');
                    // add to 'Admin' menu :
                    $PLUGIN_HOOKS['config_page']['uninstall'] = "front/model.php";
                }
                //Item actions
                $PLUGIN_HOOKS['item_update']['uninstall'] = array('PluginUninstallModel' => array('PluginUninstallPreference', 'afterUpdateModel'));
                $PLUGIN_HOOKS['item_delete']['uninstall'] = array('PluginUninstallModel' => array('PluginUninstallPreference', 'beforeItemPurge'));
                $PLUGIN_HOOKS['pre_item_purge']['uninstall'] = array('User' => array('PluginUninstallPreference', 'beforeItemPurge'));
            }
        }
        $PLUGIN_HOOKS['post_init']['uninstall'] = 'plugin_uninstall_postinit';
    }
}
function plugin_init_certificates()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['certificates'] = true;
    $PLUGIN_HOOKS['change_profile']['certificates'] = array('PluginCertificatesProfile', 'initProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['certificates'] = true;
    if (Session::getLoginUserID()) {
        // Params : plugin name - string type - number - attributes
        Plugin::registerClass('PluginCertificatesCertificate', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'contract_types' => true, 'notificationtemplates_types' => true));
        Plugin::registerClass('PluginCertificatesConfig', array('addtabon' => 'CronTask'));
        Plugin::registerClass('PluginCertificatesProfile', array('addtabon' => 'Profile'));
        if (class_exists('PluginAccountsAccount')) {
            PluginAccountsAccount::registerType('PluginCertificatesCertificate');
        }
        $plugin = new Plugin();
        if (!$plugin->isActivated('environment') && Session::haveRight("plugin_certificates", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['certificates'] = array('assets' => 'PluginCertificatesMenu');
        }
        if (Session::haveRight("plugin_certificates", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['certificates'] = 1;
        }
        // End init, when all types are registered
        $PLUGIN_HOOKS['post_init']['certificates'] = 'plugin_certificates_postinit';
    }
}
 static function afterAdd(Group_Ticket $item)
 {
     global $DB;
     //Toolbox::logDebug(__METHOD__, $item);
     $config = PluginBehaviorsConfig::getInstance();
     if ($config->getField('add_notif')) {
         if ($item->getField('type') == CommonITILActor::ASSIGN) {
             $ticket = new Ticket();
             if ($ticket->getFromDB($item->getField('tickets_id'))) {
                 NotificationEvent::raiseEvent('plugin_behaviors_ticketnewgrp', $ticket);
             }
         }
     }
     // Check is the connected user is a tech
     if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('own_ticket', 1)) {
         return false;
         // No check
     }
     $config = PluginBehaviorsConfig::getInstance();
     if ($config->getField('single_tech_mode') != 0 && $item->input['type'] == CommonITILActor::ASSIGN) {
         $crit = array('tickets_id' => $item->input['tickets_id'], 'type' => CommonITILActor::ASSIGN);
         foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
             if ($data['id'] != $item->getID()) {
                 $gu = new Group_Ticket();
                 $gu->delete($data);
             }
         }
         if ($config->getField('single_tech_mode') == 2) {
             foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
                 $gu = new Ticket_User();
                 $gu->delete($data);
             }
         }
     }
 }
Exemple #12
0
function plugin_init_typology()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['add_css']['typology'] = 'typology.css';
    $PLUGIN_HOOKS['csrf_compliant']['typology'] = true;
    $PLUGIN_HOOKS['change_profile']['typology'] = array('PluginTypologyProfile', 'changeProfile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginTypologyProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginTypologyTypology', array('notificationtemplates_types' => true));
        // Display a menu entry ?
        if (plugin_typology_haveRight("typology", "r")) {
            // menu entry
            $PLUGIN_HOOKS['menu_entry']['typology'] = 'front/typology.php';
            // search link
            $PLUGIN_HOOKS['submenu_entry']['typology']['search'] = 'front/typology.php';
            $PLUGIN_HOOKS['redirect_page']['typology'] = 'front/typology.form.php';
        }
        if (plugin_typology_haveRight("typology", "w")) {
            //add link
            $PLUGIN_HOOKS['submenu_entry']['typology']['add'] = 'front/typology.form.php';
            //use massiveaction in the plugin
            $PLUGIN_HOOKS['use_massive_action']['typology'] = 1;
            $PLUGIN_HOOKS['redirect_page']['typology'] = 'front/typology.form.php';
        }
        Plugin::registerClass('PluginTypologyRuleTypologyCollection', array('rulecollections_types' => true));
        if (class_exists('PluginBehaviorsCommon')) {
            PluginBehaviorsCommon::addCloneType('PluginTypologyRuleTypology', 'PluginBehaviorsRule');
        }
        $PLUGIN_HOOKS['post_init']['typology'] = 'plugin_typology_postinit';
    }
}
Exemple #13
0
function plugin_init_addressing()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['addressing'] = true;
    $PLUGIN_HOOKS['change_profile']['addressing'] = array('PluginAddressingProfile', 'changeProfile');
    $PLUGIN_HOOKS['pre_item_purge']['addressing'] = array('Profile' => array('PluginAddressingProfile', 'purgeProfiles'));
    Plugin::registerClass('PluginAddressingProfile', array('addtabon' => array('Profile')));
    if (Session::getLoginUserID()) {
        if (plugin_addressing_haveRight("addressing", "r")) {
            $PLUGIN_HOOKS['menu_entry']['addressing'] = 'front/addressing.php';
            $PLUGIN_HOOKS['submenu_entry']['addressing']['search'] = 'front/addressing.php';
        }
        if (plugin_addressing_haveRight("addressing", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['addressing']['add'] = 'front/addressing.form.php?new=1';
            $PLUGIN_HOOKS['use_massive_action']['addressing'] = 1;
        }
        // Config page
        if (Session::haveRight("config", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['addressing']['config'] = 'front/config.form.php';
            $PLUGIN_HOOKS['config_page']['addressing'] = 'front/config.form.php';
        }
        // Add specific files to add to the header : javascript or css
        //$PLUGIN_HOOKS['add_javascript']['example']="example.js";
        $PLUGIN_HOOKS['add_css']['addressing'] = "addressing.css";
        $PLUGIN_HOOKS['add_javascript']['addressing'] = 'addressing.js';
        $PLUGIN_HOOKS['post_init']['addressing'] = array('PluginAddressingPing_Equipment', 'postinit');
    }
}
Exemple #14
0
function plugin_init_ideabox()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['ideabox'] = true;
    $PLUGIN_HOOKS['change_profile']['ideabox'] = array('PluginIdeaboxProfile', 'changeProfile');
    $PLUGIN_HOOKS['pre_item_purge']['ideabox'] = array('Profile' => array('PluginIdeaboxProfile', 'purgeProfiles'));
    $PLUGIN_HOOKS['plugin_datainjection_populate']['ideabox'] = 'plugin_datainjection_populate_ideabox';
    $PLUGIN_HOOKS['assign_to_ticket']['ideabox'] = true;
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginIdeaboxIdeabox', array('massiveaction_noupdate_types' => true, 'notificationtemplates_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'linkuser_types' => true, 'document_types' => true));
        Plugin::registerClass('PluginIdeaboxComment', array('notificationtemplates_types' => true));
        Plugin::registerClass('PluginIdeaboxProfile', array('addtabon' => 'Profile'));
        // Display a menu entry ?
        if (plugin_ideabox_haveRight("ideabox", "r")) {
            $PLUGIN_HOOKS['menu_entry']['ideabox'] = 'front/ideabox.php';
            $PLUGIN_HOOKS['helpdesk_menu_entry']['ideabox'] = '/front/ideabox.php';
            $PLUGIN_HOOKS['submenu_entry']['ideabox']['search'] = 'front/ideabox.php';
            $PLUGIN_HOOKS['redirect_page']['ideabox'] = "front/ideabox.form.php";
        }
        if (plugin_ideabox_haveRight("ideabox", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['ideabox']['add'] = 'front/ideabox.form.php';
            $PLUGIN_HOOKS['use_massive_action']['ideabox'] = 1;
        }
        $PLUGIN_HOOKS['migratetypes']['ideabox'] = 'plugin_datainjection_migratetypes_ideabox';
    }
}
function plugin_init_databases()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['databases'] = true;
    $PLUGIN_HOOKS['change_profile']['databases'] = array('PluginDatabasesProfile', 'initProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['databases'] = true;
    //$PLUGIN_HOOKS['assign_to_ticket_dropdown']['databases'] = true;
    //$PLUGIN_HOOKS['assign_to_ticket_itemtype']['databases'] = array('PluginDatabasesDatabase_Item');
    Plugin::registerClass('PluginDatabasesDatabase', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'addtabon' => 'Supplier'));
    Plugin::registerClass('PluginDatabasesProfile', array('addtabon' => 'Profile'));
    //Plugin::registerClass('PluginDatabasesDatabase_Item',
    //                      array('ticket_types' => true));
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginDatabasesDatabase');
    }
    if (Session::getLoginUserID()) {
        $plugin = new Plugin();
        if (!$plugin->isActivated('environment') && Session::haveRight("plugin_databases", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['databases'] = array('assets' => 'PluginDatabasesMenu');
        }
        if (Session::haveRight("plugin_databases", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['databases'] = 1;
        }
        if (class_exists('PluginDatabasesDatabase_Item')) {
            // only if plugin activated
            $PLUGIN_HOOKS['plugin_datainjection_populate']['databases'] = 'plugin_datainjection_populate_databases';
        }
        // End init, when all types are registered
        $PLUGIN_HOOKS['post_init']['databases'] = 'plugin_databases_postinit';
        // Import from Data_Injection plugin
        $PLUGIN_HOOKS['migratetypes']['databases'] = 'plugin_datainjection_migratetypes_databases';
    }
}
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if (in_array($item->getType(), array('Preference', 'User'))) {
         $pref = new self();
         $user_id = $item->getType() == 'Preference' ? Session::getLoginUserID() : $item->getID();
         $pref->showForm($user_id);
     }
     return true;
 }
Exemple #17
0
function plugin_init_archires()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['archires'] = true;
    Plugin::registerClass('PluginArchiresProfile', array('addtabon' => array('Profile')));
    $PLUGIN_HOOKS['change_profile']['archires'] = array('PluginArchiresProfile', 'changeProfile');
    $PLUGIN_HOOKS['pre_item_purge']['archires'] = array('Profile' => array('PluginArchiresProfile', 'purgeProfiles'));
    if (Session::getLoginUserID()) {
        if (plugin_archires_haveRight("archires", "r")) {
            $PLUGIN_HOOKS['menu_entry']['archires'] = 'front/archires.php';
            //summary
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['summary']['title'] = __('Summary', 'archires');
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['summary']['page'] = '/plugins/archires/front/archires.php';
            //views
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['title'] = _n('View', 'Views', 2);
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['page'] = '/plugins/archires/front/view.php';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['links']['search'] = '/plugins/archires/front/view.php';
            //locations
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['title'] = __('Location');
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['page'] = '/plugins/archires/front/locationquery.php';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['links']['search'] = '/plugins/archires/front/locationquery.php';
            //networkequipments
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['title'] = _n('Network equipment', 'Network equipments', 1, 'archires');
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['page'] = '/plugins/archires/front/networkequipmentquery.php';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['links']['search'] = '/plugins/archires/front/networkequipmentquery.php';
            //appliances
            if (class_exists('PluginAppliancesAppliance')) {
                $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['title'] = PluginAppliancesAppliance::getTypeName(1);
                $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['page'] = '/plugins/archires/front/appliancequery.php';
                $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['links']['search'] = '/plugins/archires/front/appliancequery.php';
            }
        }
        if (plugin_archires_haveRight("archires", "w")) {
            //summary
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['links']['add'] = '/plugins/archires/front/view.form.php?new=1';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['links']['config'] = '/plugins/archires/front/config.form.php';
            //locations
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['links']['add'] = '/plugins/archires/front/locationquery.form.php?new=1';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['links']['config'] = '/plugins/archires/front/config.form.php';
            //networkequipments
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['links']['add'] = '/plugins/archires/front/networkequipmentquery.form.php?new=1';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['links']['config'] = '/plugins/archires/front/config.form.php';
            //appliances
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['links']['add'] = '/plugins/archires/front/appliancequery.form.php?new=1';
            $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['links']['config'] = '/plugins/archires/front/config.form.php';
            if (Session::haveRight("config", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['archires']['config'] = 'front/config.form.php';
            }
            $PLUGIN_HOOKS['use_massive_action']['archires'] = 1;
        }
        // Config page
        if (plugin_archires_haveRight("archires", "w") || Session::haveRight("config", "w")) {
            $PLUGIN_HOOKS['config_page']['archires'] = 'front/config.form.php';
        }
    }
}
 /**
  * Set a parameter in the HTTP session
  *
  * @param $param     the parameter
  * @param $results   the value to store
  *
  * @return nothing
  **/
 static function setParam($param, $results)
 {
     if (in_array($param, array('results', 'error_lines'))) {
         $fic = Session::getLoginUserID() . '_' . $param . '_' . microtime(true);
         file_put_contents(GLPI_DOC_DIR . '/_tmp/' . $fic, $results);
         $_SESSION['datainjection'][$param] = $fic;
     } else {
         $_SESSION['datainjection'][$param] = $results;
     }
 }
 static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $job, $private)
 {
     global $CFG_GLPI, $DB;
     $ID = $job->getField('id');
     //////////////Tasks///////////
     $RESTRICT = "";
     if (!$private) {
         // Don't show private'
         $RESTRICT = " AND `is_private` = '0' ";
     } else {
         if (!Session::haveRight("show_full_ticket", "1")) {
             // No right, only show connected user private one
             $RESTRICT = " AND (`is_private` = '0'\n                          OR `users_id` ='" . Session::getLoginUserID() . "' ) ";
         }
     }
     $query = "SELECT *\n                FROM `glpi_tickettasks`\n                WHERE `tickets_id` = '{$ID}'\n                      {$RESTRICT}\n                ORDER BY `date` DESC";
     $result = $DB->query($query);
     if (!$DB->numrows($result)) {
         $pdf->setColumnsSize(100);
         $pdf->displayLine(__('No task found.'));
     } else {
         $pdf->displayTitle("<b>" . TicketTask::getTypeName($DB->numrows($result) . "</b>"));
         $pdf->setColumnsSize(20, 20, 20, 20, 20);
         $pdf->displayTitle("<b><i>" . __('Type') . "</i></b>", "<b><i>" . __('Date') . "</i></b>", "<b><i>" . __('Duration') . "</i></b>", "<b><i>" . __('Writer') . "</i></b>", "<b><i>" . __('Planning') . "</i></b>");
         while ($data = $DB->fetch_array($result)) {
             $actiontime = Html::timestampToString($data['actiontime'], false);
             $planification = '';
             if (empty($data['begin'])) {
                 if (isset($data["state"])) {
                     $planification = Planning::getState($data["state"]) . "<br>";
                 }
                 $planification .= _e('None');
             } else {
                 if (isset($data["state"])) {
                     $planification = sprintf(__('%1$s: %2$s'), _x('item', 'State'), Planning::getState($data["state"]));
                 }
                 $planificiation = sprintf(__('%1$s - %2$s'), $planification, Html::convDateTime($data["begin"]) . " -> " . Html::convDateTime($data["end"]));
                 $planificiation = sprintf(__('%1$s - %2$s'), $planification, sprintf(__('%1$s  %2$s'), __('By'), getUserName($data["users_id_tech"])));
             }
             if ($data['taskcategories_id']) {
                 $lib = Dropdown::getDropdownName('glpi_taskcategories', $data['taskcategories_id']);
             } else {
                 $lib = '';
             }
             if ($data['is_private']) {
                 $lib = sprintf(__('%1$s (%2$s)'), $lib, __('Private'));
             }
             toolbox::logdebug("lib", $data);
             $pdf->displayLine(Html::clean($lib), Html::convDateTime($data["date"]), Html::timestampToString($data["actiontime"], 0), Html::clean(getUserName($data["users_id"])), Html::clean($planification), 1);
             $pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Description') . "</i></b>", Html::clean($data["content"]), 1));
         }
     }
     $pdf->displaySpace();
 }
Exemple #20
0
function plugin_init_mreporting()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['redirect_page']['mreporting'] = 'front/download.php';
    /* CRSF */
    $PLUGIN_HOOKS['csrf_compliant']['mreporting'] = true;
    /* Profile */
    $PLUGIN_HOOKS['change_profile']['mreporting'] = array('PluginMreportingProfile', 'changeProfile');
    Plugin::registerClass('PluginMreportingNotification', array('notificationtemplates_types' => true));
    //Plugin::registerClass('PluginMreportingNotificationTargetNotification');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginMreportingProfile', array('addtabon' => 'Profile'));
        if ($_SESSION['glpiactiveprofile']['interface'] != "helpdesk") {
            Plugin::registerClass('PluginMreportingPreference', array('addtabon' => array('Preference')));
        }
        /* Reports Link */
        if (plugin_mreporting_haveRight("reports", "r")) {
            $menu_entry = "front/central.php";
            $PLUGIN_HOOKS['menu_entry']['mreporting'] = $menu_entry;
            $PLUGIN_HOOKS['submenu_entry']['mreporting']['search'] = $menu_entry;
        }
        /* Configuration Link */
        if (plugin_mreporting_haveRight("config", "w")) {
            $config_entry = 'front/config.php';
            $PLUGIN_HOOKS['config_page']['mreporting'] = $config_entry;
            $PLUGIN_HOOKS['submenu_entry']['mreporting']['config'] = $config_entry;
            $PLUGIN_HOOKS['submenu_entry']['mreporting']['options']['config']['links']['config'] = '/plugins/mreporting/' . $config_entry;
            $PLUGIN_HOOKS['submenu_entry']['mreporting']['options']['config']['links']['add'] = '/plugins/mreporting/front/config.form.php';
        }
        /* Show Reports in standart stats page */
        if (class_exists('PluginMreportingCommon')) {
            $mreporting_common = new PluginMreportingCommon();
            $reports = $mreporting_common->getAllReports();
            if ($reports !== false) {
                foreach ($reports as $report) {
                    foreach ($report['functions'] as $func) {
                        $PLUGIN_HOOKS['stats']['mreporting'][$func['min_url_graph']] = $func['title'];
                    }
                }
            }
        }
    }
    if (class_exists('PluginMreportingProfile')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['mreporting'] = array('Profile' => array('PluginMreportingProfile', 'purgeProfiles'));
    }
    // Add specific files to add to the header : javascript
    $PLUGIN_HOOKS['add_javascript']['mreporting'][] = "lib/protovis/protovis.min.js";
    $PLUGIN_HOOKS['add_javascript']['mreporting'][] = "lib/protovis-msie/protovis-msie.min.js";
    $PLUGIN_HOOKS['add_javascript']['mreporting'][] = "lib/protovis-extjs-tooltips.js";
    //Add specific files to add to the header : css
    $PLUGIN_HOOKS['add_css']['mreporting'] = array("mreporting.css");
}
function plugin_init_environment()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['environment'] = true;
    $PLUGIN_HOOKS['change_profile']['environment'] = array('PluginEnvironmentProfile', 'initProfile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginEnvironmentProfile', array('addtabon' => 'Profile'));
        if (Session::haveRight("plugin_environment", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['environment'] = array('assets' => 'PluginEnvironmentDisplay');
        }
    }
}
function plugin_init_simcard()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $LANG;
    $PLUGIN_HOOKS['csrf_compliant']['simcard'] = true;
    $plugin = new Plugin();
    if ($plugin->isInstalled('simcard') && $plugin->isActivated('simcard')) {
        //load changeprofile function
        $PLUGIN_HOOKS['change_profile']['simcard'] = array('PluginSimcardProfile', 'changeProfile');
        $PLUGIN_HOOKS['assign_to_ticket']['simcard'] = true;
        $PLUGIN_HOOKS['pre_item_purge']['simcard'] = array('Profile' => array('PluginSimcardsProfile', 'purgeProfiles'));
        $PLUGIN_HOOKS['plugin_datainjection_populate']['simcard'] = 'plugin_datainjection_populate_simcard';
        $PLUGIN_HOOKS['item_purge']['simcard'] = array();
        foreach (PluginSimcardSimcard_Item::getClasses() as $type) {
            $PLUGIN_HOOKS['item_purge']['simcard'][$type] = 'plugin_item_purge_simcard';
        }
        Plugin::registerClass('PluginSimcardSimcard_Item', array('addtabon' => PluginSimcardSimcard_Item::getClasses()));
        Plugin::registerClass('PluginSimcardProfile', array('addtabon' => 'Profile'));
        // Params : plugin name - string type - number - class - table - form page
        Plugin::registerClass('PluginSimcardSimcard', array('linkgroup_types' => true, 'linkuser_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'infocom_types' => true, 'unicity_types' => true, 'reservation_types' => true));
        array_push($CFG_GLPI['state_types'], 'PluginSimcardSimcard');
        //if glpi is loaded
        if (Session::getLoginUserID()) {
            // Display a menu entry ?
            //if (Session::haveRight("simcard", "r")) {
            if (PluginSimcardSimcard::canCreate() || PluginSimcardSimcard::canUpdate() || PluginSimcardSimcard::canDelete() || PluginSimcardSimcard::canView()) {
                //menu entry
                //$PLUGIN_HOOKS['menu_entry']['simcard'] = 'front/simcard.php';
                $PLUGIN_HOOKS['menu_toadd']['simcard'] = array('assets' => 'PluginSimcardSimcard');
                //search link
                //$PLUGIN_HOOKS['submenu_entry']['simcard']['options']['simcard']['links']['search']
                //   = '/plugins/simcard/front/simcard.php';
                //add simcard to items details
                $PLUGIN_HOOKS['headings']['simcard'] = 'plugin_get_headings_simcard';
                $PLUGIN_HOOKS['headings_action']['simcard'] = 'plugin_headings_actions_simcard';
                $PLUGIN_HOOKS['headings_actionpdf']['simcard'] = 'plugin_headings_actionpdf_simcard';
            }
            //if (Session::haveRight("simcard", "w")) {
            if (PluginSimcardSimcard::canCreate()) {
                //add link
                //             $PLUGIN_HOOKS['submenu_entry']['simcard']['options']['simcard']['links']['add']
                //                = '/front/setup.templates.php?itemtype=PluginSimcardSimcard&add=1';
                //             $PLUGIN_HOOKS['submenu_entry']['simcard']['options']['simcard']['links']['template']
                //                = '/front/setup.templates.php?itemtype=PluginSimcardSimcard&add=0';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['simcard'] = 1;
            }
            // Import from Data_Injection plugin
            $PLUGIN_HOOKS['migratetypes']['simcard'] = 'plugin_datainjection_migratetypes_simcard';
            $PLUGIN_HOOKS['menu']['simcard'] = true;
            $PLUGIN_HOOKS['post_init']['simcard'] = 'plugin_simcard_postinit';
        }
    }
}
function plugin_init_purgelogs()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['purgelogs'] = true;
    $plugin = new Plugin();
    if ($plugin->isInstalled('purgelogs') && $plugin->isActivated('purgelogs')) {
        //if glpi is loaded
        if (Session::getLoginUserID() && Session::haveRight("config", UPDATE)) {
            $PLUGIN_HOOKS['config_page']['purgelogs'] = 'front/config.form.php';
        }
    }
}
Exemple #24
0
 /**
  * Check if I have the right $right to module $module 
  *
  * @param $module Module to check (typology)
  * @param $right Right to check
  *
  * @return Nothing : display error if not permit
  **/
 static function checkRight($module, $right)
 {
     global $CFG_GLPI;
     if (!plugin_typology_haveRight($module, $right)) {
         // Gestion timeout session
         if (!Session::getLoginUserID()) {
             Html::redirect($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         Html::displayRightError();
     }
 }
Exemple #25
0
function plugin_init_sccm()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $plugin = new Plugin();
    $PLUGIN_HOOKS['csrf_compliant']['sccm'] = true;
    $PLUGIN_HOOKS['menu_entry']['sccm'] = false;
    if ($plugin->isActivated("sccm") && Session::getLoginUserID()) {
        if (Session::haveRight("config", UPDATE)) {
            $PLUGIN_HOOKS['config_page']['sccm'] = "front/config.form.php";
            $PLUGIN_HOOKS["menu_toadd"]['sccm'] = array('config' => 'PluginSccmMenu');
        }
    }
}
Exemple #26
0
function plugin_init_utilitaires()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['utilitaires'] = true;
    $PLUGIN_HOOKS['change_profile']['utilitaires'] = array('PluginUtilitairesProfile', 'changeProfile');
    //Clean Plugin on Profile delete
    $PLUGIN_HOOKS['pre_item_purge']['utilitaires'] = array('Profile' => array('PluginUtilitairesProfile', 'purgeProfiles'));
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginUtilitairesProfile', array('addtabon' => 'Profile'));
        if (plugin_utilitaires_haveRight("utilitaires", "w")) {
            $PLUGIN_HOOKS['menu_entry']['utilitaires'] = 'front/utilitaire.php';
        }
    }
}
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     global $CFG_GLPI;
     if ($item->getType() == 'User') {
         $ID = $item->getField('id');
     } else {
         if ($item->getType() == 'Preference') {
             $ID = Session::getLoginUserID();
         }
     }
     $self = new self();
     $self->showForm($ID);
     return true;
 }
Exemple #28
0
function plugin_init_racks()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['racks'] = true;
    $PLUGIN_HOOKS['change_profile']['racks'] = array('PluginRacksProfile', 'changeProfile');
    if (class_exists('PluginRacksRack')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['racks'] = array('Profile' => array('PluginRacksProfile', 'purgeProfiles'));
    }
    Plugin::registerClass('PluginRacksRack', array('document_types' => true, 'unicity_types' => true, 'linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'infocom_types' => true));
    Plugin::registerClass('PluginRacksProfile', array('addtabon' => 'Profile'));
    if (class_exists('PluginAppliancesAppliance')) {
        PluginAppliancesAppliance::registerType('PluginRacksRack');
    }
    if (class_exists('PluginManufacturersimportsConfig')) {
        PluginManufacturersimportsConfig::registerType('PluginRacksRack');
    }
    if (class_exists('PluginTreeviewConfig')) {
        PluginTreeviewConfig::registerType('PluginRacksRack');
        $PLUGIN_HOOKS['treeview']['PluginRacksRack'] = '../racks/pics/racks.png';
    }
    if (class_exists('PluginPositionsPosition')) {
        PluginPositionsPosition::registerType('PluginRacksRack');
    }
    if (Session::getLoginUserID()) {
        // Display a menu entry ?
        if (plugin_racks_haveRight("racks", "r")) {
            $PLUGIN_HOOKS['menu_entry']['racks'] = 'front/rack.php';
            $PLUGIN_HOOKS['submenu_entry']['racks']['search'] = 'front/rack.php';
            $PLUGIN_HOOKS['submenu_entry']['racks']['add'] = 'front/setup.templates.php?add=1';
        }
        if (plugin_racks_haveRight("model", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['racks']['template'] = 'front/setup.templates.php?add=0';
            $PLUGIN_HOOKS['submenu_entry']['racks']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' title=\"" . __('Equipments models specifications', 'racks') . "\" alt=\"" . __('Equipments models specifications', 'racks') . "\">"] = 'front/itemspecification.php';
        }
        if (plugin_racks_haveRight("racks", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['racks']['config'] = 'front/config.form.php';
            $PLUGIN_HOOKS['use_massive_action']['racks'] = 1;
        }
        // Config page
        if (plugin_racks_haveRight("racks", "w") || Session::haveRight("config", "w")) {
            $PLUGIN_HOOKS['config_page']['racks'] = 'front/config.form.php';
        }
        // Add specific files to add to the header : javascript or css
        //$PLUGIN_HOOKS['add_javascript']['example']="example.js";
        $PLUGIN_HOOKS['add_css']['racks'] = "racks.css";
        $PLUGIN_HOOKS['post_init']['racks'] = 'plugin_racks_postinit';
        $PLUGIN_HOOKS['reports']['racks'] = array('front/report.php' => __("Report - Bays management", "racks"));
    }
}
 /**
  * Is the current user have right to update the current satisfaction
  *
  * @return boolean
  **/
 function canUpdateItem()
 {
     $ticket = new Ticket();
     if (!$ticket->getFromDB($this->fields['tickets_id'])) {
         return false;
     }
     // you can't change if your answer > 12h
     if (!is_null($this->fields['date_answered']) && strtotime("now") - strtotime($this->fields['date_answered']) > 12 * HOUR_TIMESTAMP) {
         return false;
     }
     if ($ticket->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) || $ticket->fields["users_id_recipient"] === Session::getLoginUserID() || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::REQUESTER, $_SESSION["glpigroups"])) {
         return true;
     }
     return false;
 }
function plugin_init_additionalalerts()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['additionalalerts'] = true;
    $PLUGIN_HOOKS['change_profile']['additionalalerts'] = array('PluginAdditionalalertsProfile', 'initProfile');
    Plugin::registerClass('PluginAdditionalalertsInfocomAlert', array('notificationtemplates_types' => true, 'addtabon' => 'CronTask'));
    Plugin::registerClass('PluginAdditionalalertsOcsAlert', array('notificationtemplates_types' => true, 'addtabon' => 'CronTask'));
    Plugin::registerClass('PluginAdditionalalertsProfile', array('addtabon' => 'Profile'));
    Plugin::registerClass('PluginAdditionalalertsConfig', array('addtabon' => array('NotificationMailSetting', 'Entity')));
    if (Session::getLoginUserID()) {
        // Display a menu entry ?
        if (Session::haveRight("plugin_additionalalerts", READ)) {
            $PLUGIN_HOOKS["menu_toadd"]['additionalalerts'] = array('config' => 'PluginAdditionalalertsMenu');
        }
    }
}