Beispiel #1
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';
}
Beispiel #2
0
/**
 * Initialize the plugin's hooks
 */
function plugin_init_customfields()
{
    global $PLUGIN_HOOKS, $DB, $ACTIVE_CUSTOMFIELDS_TYPES, $ALL_CUSTOMFIELDS_TYPES;
    $PLUGIN_HOOKS['csrf_compliant']['customfields'] = true;
    $PLUGIN_HOOKS['change_profile']['customfields'] = array('PluginCustomfieldsProfile', 'changeprofile');
    // Register classes
    Plugin::registerClass('PluginCustomfieldsDropdowns');
    Plugin::registerClass('PluginCustomfieldsFields');
    if (isset($_SESSION['glpiID'])) {
        $plugin = new Plugin();
        if ($plugin->isInstalled("customfields") && $plugin->isActivated("customfields")) {
            // enable a tab for reading / setting access rights for the plugin
            Plugin::registerClass('PluginCustomfieldsProfile', array('addtabon' => 'Profile'));
            // Display a menu entry in the main menu if the user has
            // configuration rights
            if (Session::haveRight('config', UPDATE)) {
                //             $PLUGIN_HOOKS['menu_entry']['customfields'] = true;
                $PLUGIN_HOOKS["menu_toadd"]['customfields'] = array('plugins' => 'PluginCustomfieldsConfig');
            }
            // initiate empty dropdowns
            $PLUGIN_HOOKS['item_empty']['customfields'] = array('PluginCustomfieldsDropdownsItem' => 'PluginCustomfieldsDropdownsItem::item_empty');
        }
        // Indicate where the configuration page can be found
        if (Session::haveRight('config', UPDATE)) {
            $PLUGIN_HOOKS['config_page']['customfields'] = 'front/config.form.php';
        }
        // Hook for initialization after initialization of all other plugins
        $PLUGIN_HOOKS['post_init']['customfields'] = 'plugin_customfields_postinit';
    }
}
Beispiel #3
0
function plugin_init_surveyticket()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['surveyticket'] = true;
    if (isset($_SESSION["glpiID"])) {
        $plugin = new Plugin();
        if ($plugin->isActivated('surveyticket')) {
            Plugin::registerClass('PluginSurveyticketProfile', array('addtabon' => array('Profile')));
            $PLUGIN_HOOKS['change_profile']['surveyticket'] = array('PluginSurveyticketProfile', 'changeprofile');
            PluginSurveyticketProfile::changeprofile();
            if (PluginSurveyticketProfile::haveRight("config", 'r')) {
                $PLUGIN_HOOKS['menu_entry']['surveyticket'] = true;
                $PLUGIN_HOOKS['config_page']['surveyticket'] = 'front/menu.php';
            }
            $PLUGIN_HOOKS['post_init']['surveyticket'] = 'plugin_surveyticket_post_init';
        }
        // Icons add, search...
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['add']['questions'] = 'front/question.form.php?add=1';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['search']['questions'] = 'front/question.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['add']['survey'] = 'front/survey.form.php?add=1';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['search']['survey'] = 'front/survey.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['add']['answers'] = 'front/answer.form.php?add=1';
        // Fil ariane
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['questions']['title'] = "Questions";
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['questions']['page'] = '/plugins/surveyticket/front/question.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['answers']['title'] = "Answers";
        //         $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['answers']['page']  = '/plugins/surveyticket/front/answer.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['survey']['title'] = "Surveys";
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['survey']['page'] = '/plugins/surveyticket/front/survey.php';
    }
}
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'));
            }
        }
    }
}
function plugin_init_datainjection()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $INJECTABLE_TYPES;
    $PLUGIN_HOOKS['csrf_compliant']['datainjection'] = true;
    $PLUGIN_HOOKS['migratetypes']['datainjection'] = 'plugin_datainjection_migratetypes_datainjection';
    $plugin = new Plugin();
    if ($plugin->isActivated("datainjection")) {
        Plugin::registerClass('PluginDatainjectionProfile', array('addtabon' => array('Profile')));
        //If directory doesn't exists, create it
        if (!plugin_datainjection_checkDirectories()) {
            @mkdir(PLUGIN_DATAINJECTION_UPLOAD_DIR) or die(sprintf(__('%1$s %2$s'), __("Can't create folder", 'datainjection'), PLUGIN_DATAINJECTION_UPLOAD_DIR));
        }
        if (Session::haveRight('plugin_datainjection_model', READ)) {
            $PLUGIN_HOOKS["menu_toadd"]['datainjection'] = array('tools' => 'PluginDatainjectionMenu');
        }
        $PLUGIN_HOOKS['pre_item_purge']['datainjection'] = array('Profile' => array('PluginDatainjectionProfile', 'purgeProfiles'));
        // Css file
        $PLUGIN_HOOKS['add_css']['datainjection'] = 'css/datainjection.css';
        // Javascript file
        $PLUGIN_HOOKS['add_javascript']['datainjection'] = 'javascript/datainjection.js';
        // Inbtegration with Webservices plugin
        $PLUGIN_HOOKS['webservices']['datainjection'] = 'plugin_datainjection_registerMethods';
        $INJECTABLE_TYPES = array();
    }
}
Beispiel #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_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');
    }
}
Beispiel #8
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';
    }
}
Beispiel #9
0
function plugin_fields_checkFiles()
{
    $plugin = new Plugin();
    if (isset($_SESSION['glpiactiveentities']) && $plugin->isInstalled('fields') && $plugin->isActivated('fields')) {
        Plugin::registerClass('PluginFieldsContainer');
        Plugin::registerClass('PluginFieldsDropdown');
        Plugin::registerClass('PluginFieldsField');
        if (TableExists("glpi_plugin_fields_containers")) {
            $container_obj = new PluginFieldsContainer();
            $containers = $container_obj->find();
            foreach ($containers as $container) {
                $classname = "PluginFields" . ucfirst($container['itemtype'] . preg_replace('/s$/', '', $container['name']));
                if (!class_exists($classname)) {
                    PluginFieldsContainer::generateTemplate($container);
                }
            }
        }
        if (TableExists("glpi_plugin_fields_fields")) {
            $fields_obj = new PluginFieldsField();
            $fields = $fields_obj->find("`type` = 'dropdown'");
            foreach ($fields as $field) {
                PluginFieldsDropdown::create($field);
            }
        }
    }
}
Beispiel #10
0
function plugin_init_barcode()
{
    global $PLUGIN_HOOKS, $LANG, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['barcode'] = true;
    // Params : plugin name - string type - ID - Array of attributes
    Plugin::registerClass('PluginBarcodeDropdown');
    Plugin::registerClass('PluginBarcodeProfile');
    Plugin::registerClass('PluginBarcode');
    $PLUGIN_HOOKS['change_profile']['barcode'] = array('PluginBarcodeProfile', 'changeprofile');
    // Display a menu entry ?
    if (isset($_SESSION["glpi_plugin_barcode_profile"]) && $_SESSION["glpi_plugin_barcode_profile"]["generate"] or isset($_SESSION["glpi_plugin_barcode_profile"]) && $_SESSION["glpi_plugin_barcode_profile"]["config"]) {
        // Right set in change_profile hook
        $PLUGIN_HOOKS['pre_item_purge']['barcode'] = array('Profile' => array('PluginBarcodeProfile', 'cleanProfiles'));
        // Onglets management
        $PLUGIN_HOOKS['headings']['barcode'] = 'plugin_get_headings_barcode';
        $PLUGIN_HOOKS['headings_action']['barcode'] = 'plugin_headings_actions_barcode';
        // Massive Action definition
        $PLUGIN_HOOKS['use_massive_action']['barcode'] = 1;
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['title'] = "Search";
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['page'] = '/plugins/barcode/front/barcode.php';
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['search'] = '/plugins/barcode/front/barcode.php';
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['add'] = '/plugins/barcode/front/barcode.form.php';
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['config'] = '/plugins/barcode/index.php';
        //$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']["<img  src='".$CFG_GLPI["root_doc"]."/pics/menu_showall.png' title='".$LANG['plugin_barcode']["test"]."' alt='".$LANG['plugin_barcode']["test"]."'>"] = '/plugins/barcode/index.php';
        //$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links'][$LANG['plugin_barcode']["test"]] = '/plugins/barcode/index.php';
        $PLUGIN_HOOKS["helpdesk_menu_entry"]['barcode'] = true;
    }
    // Config page
    if (Session::haveRight('config', 'w')) {
        $PLUGIN_HOOKS['config_page']['barcode'] = 'front/config.php';
    }
    //redirect appel http://localhost/glpi/index.php?redirect=plugin_example_2 (ID 2 du form)
    $PLUGIN_HOOKS['redirect_page']['barcode'] = 'barcode.form.php';
}
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';
    }
}
Beispiel #12
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_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';
    }
}
Beispiel #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';
    }
}
Beispiel #15
0
/**
 * Initialize all classes and generic variables of the plugin
 */
function plugin_init_formcreator()
{
    global $PLUGIN_HOOKS;
    // Add specific CSS
    $PLUGIN_HOOKS['add_css']['formcreator'][] = "css/styles.css";
    if (strpos($_SERVER['REQUEST_URI'], "front/helpdesk.public.php") !== false) {
        $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/helpdesk.js';
    } elseif (strpos($_SERVER['REQUEST_URI'], "front/central.php") !== false) {
        $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/homepage.js';
    }
    if (isset($_SESSION['glpiactiveprofile'])) {
        if ($_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') {
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/helpdesk-menu.js';
        }
    }
    $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/forms-validation.js.php';
    // Set the plugin CSRF compliance (required in GLPI 0.84)
    $PLUGIN_HOOKS['csrf_compliant']['formcreator'] = true;
    // Add a link in the main menu plugins for technician and admin panel
    $PLUGIN_HOOKS['menu_entry']['formcreator'] = 'front/formlist.php';
    // Config page
    $plugin = new Plugin();
    $links = array();
    if (Session::haveRight('config', 'w') && $plugin->isActivated("formcreator")) {
        $PLUGIN_HOOKS['config_page']['formcreator'] = 'front/form.php';
        $links['config'] = '/plugins/formcreator/front/form.php';
        $links['add'] = '/plugins/formcreator/front/form.form.php';
    }
    // Set options for pages (title, links, buttons...)
    $links['search'] = '/plugins/formcreator/front/formlist.php';
    $PLUGIN_HOOKS['submenu_entry']['formcreator']['options'] = array('config' => array('title' => __('Setup'), 'page' => '/plugins/formcreator/front/form.php', 'links' => $links), 'options' => array('title' => _n('Form', 'Forms', 2, 'formcreator'), 'links' => $links));
    // Load field class and all its method to manage fields
    Plugin::registerClass('PluginFormcreatorFields');
}
Beispiel #16
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'));
        }
    }
}
Beispiel #17
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');
    }
}
Beispiel #18
0
function plugin_init_pdf()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['pdf'] = true;
    Plugin::registerClass('PluginPdfProfile', array('addtabon' => 'Profile'));
    Plugin::registerClass('PluginPdfPreference', array('addtabon' => 'Preference'));
    $PLUGIN_HOOKS['change_profile']['pdf'] = array('PluginPdfProfile', 'changeprofile');
    $PLUGIN_HOOKS['pre_item_purge']['pdf'] = array('Profile' => array('PluginPdfProfile', 'cleanProfile'));
    $PLUGIN_HOOKS['item_clone']['pdf'] = array('Profile' => array('PluginPdfProfile', 'cloneProfile'));
    $plugin = new Plugin();
    if ($plugin->isActivated("datainjection")) {
        $PLUGIN_HOOKS['menu_entry']['pdf'] = 'front/preference.form.php';
    }
    if (isset($_SESSION["glpi_plugin_pdf_profile"]) && $_SESSION["glpi_plugin_pdf_profile"]["use"]) {
        $PLUGIN_HOOKS['use_massive_action']['pdf'] = 1;
        // Define the type for which we know how to generate PDF :
        $PLUGIN_HOOKS['plugin_pdf']['Computer'] = 'PluginPdfComputer';
        $PLUGIN_HOOKS['plugin_pdf']['Group'] = 'PluginPdfGroup';
        $PLUGIN_HOOKS['plugin_pdf']['KnowbaseItem'] = 'PluginPdfKnowbaseItem';
        $PLUGIN_HOOKS['plugin_pdf']['Monitor'] = 'PluginPdfMonitor';
        $PLUGIN_HOOKS['plugin_pdf']['NetworkEquipment'] = 'PluginPdfNetworkEquipment';
        $PLUGIN_HOOKS['plugin_pdf']['Peripheral'] = 'PluginPdfPeripheral';
        $PLUGIN_HOOKS['plugin_pdf']['Phone'] = 'PluginPdfPhone';
        $PLUGIN_HOOKS['plugin_pdf']['Printer'] = 'PluginPdfPrinter';
        $PLUGIN_HOOKS['plugin_pdf']['Software'] = 'PluginPdfSoftware';
        $PLUGIN_HOOKS['plugin_pdf']['SoftwareLicense'] = 'PluginPdfSoftwareLicense';
        $PLUGIN_HOOKS['plugin_pdf']['SoftwareVersion'] = 'PluginPdfSoftwareVersion';
        $PLUGIN_HOOKS['plugin_pdf']['Ticket'] = 'PluginPdfTicket';
        // End init, when all types are registered by all plugins
        $PLUGIN_HOOKS['post_init']['pdf'] = 'plugin_pdf_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';
    }
}
Beispiel #20
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';
    }
}
function plugin_init_barcode()
{
    global $PLUGIN_HOOKS, $LANG, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['barcode'] = true;
    // Params : plugin name - string type - ID - Array of attributes
    Plugin::registerClass('PluginBarcodeDropdown');
    Plugin::registerClass('PluginBarcodeProfile', array('addtabon' => array('Profile')));
    Plugin::registerClass('PluginBarcode');
    // Display a menu entry ?
    if (Session::haveRight('plugin_barcode_barcode', CREATE) || Session::haveRight('plugin_barcode_config', UPDATE)) {
        $PLUGIN_HOOKS['pre_item_purge']['barcode'] = array('Profile' => array('PluginBarcodeProfile', 'cleanProfiles'));
        // Massive Action definition
        $PLUGIN_HOOKS['use_massive_action']['barcode'] = 1;
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['title'] = "Search";
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['page'] = '/plugins/barcode/front/barcode.php';
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['search'] = '/plugins/barcode/front/barcode.php';
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['add'] = '/plugins/barcode/front/barcode.form.php';
        $PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['config'] = '/plugins/barcode/index.php';
        $PLUGIN_HOOKS["helpdesk_menu_entry"]['barcode'] = true;
    }
    // Config page
    if (Session::haveRight('config', UPDATE)) {
        $PLUGIN_HOOKS['config_page']['barcode'] = 'front/config.php';
    }
    //redirect appel http://localhost/glpi/index.php?redirect=plugin_example_2 (ID 2 du form)
    $PLUGIN_HOOKS['redirect_page']['barcode'] = 'barcode.form.php';
}
Beispiel #22
0
function plugin_init_ticketmail()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['ticketmail'] = true;
    Plugin::registerClass('PluginTicketmailProfile');
    Plugin::registerClass('PluginTicketmailProfile', array('addtabon' => array('Profile', 'Ticket')));
    $PLUGIN_HOOKS['change_profile']['ticketmail'] = array('PluginTicketmailProfile', 'changeProfile');
}
Beispiel #23
0
function plugin_init_autolangue()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['monplugin'] = true;
    $PLUGIN_HOOKS['config_page']['monplugin'] = 'front/config.form.php';
    Plugin::registerClass('PluginAutolangueAutolangue', array('addtabon' => array('Group')));
    Plugin::registerClass('PluginAutolangueConfig');
}
Beispiel #24
0
function plugin_init_escalade()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['escalade'] = true;
    $plugin = new Plugin();
    if (isset($_SESSION['glpiID']) && $plugin->isInstalled('escalade') && $plugin->isActivated('escalade')) {
        //load config in session
        if (TableExists("glpi_plugin_escalade_configs")) {
            PluginEscaladeConfig::loadInSession();
            // == Load js scripts ==
            if (isset($_SESSION['plugins']['escalade']['config'])) {
                $escalade_config = $_SESSION['plugins']['escalade']['config'];
                $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/function.js';
                // on central page
                if (strpos($_SERVER['REQUEST_URI'], "central.php") !== false) {
                    //history and climb feature
                    if ($escalade_config['show_history']) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/central.js.php';
                    }
                }
                // on ticket page (in edition)
                if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false && isset($_GET['id'])) {
                    //history and climb feature
                    if ($escalade_config['show_history']) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/escalade.js.php';
                    }
                    //remove btn feature
                    if (!$escalade_config['remove_delete_group_btn'] || !$escalade_config['remove_delete_user_btn']) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/remove_btn.js.php';
                    }
                    //clone ticket feature
                    if ($escalade_config['cloneandlink_ticket']) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/cloneandlink_ticket.js.php';
                    }
                    //filter group feature
                    if ($escalade_config['use_filter_assign_group']) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/filtergroup.js.php';
                    }
                }
                Plugin::registerClass('PluginEscaladeGroup_Group', array('addtabon' => 'Group'));
                Plugin::registerClass('PluginEscaladeUser', array('addtabon' => array('User')));
            }
        }
        $PLUGIN_HOOKS['add_css']['escalade'][] = 'escalade.css';
        // == Ticket modifications
        $PLUGIN_HOOKS['item_update']['escalade'] = array('Ticket' => 'plugin_escalade_item_update');
        $PLUGIN_HOOKS['item_add']['escalade'] = array('Group_Ticket' => 'plugin_escalade_item_add_group_ticket', 'Ticket_User' => 'plugin_escalade_item_add_user', 'Ticket' => 'plugin_escalade_item_add_ticket');
        $PLUGIN_HOOKS['pre_item_add']['escalade'] = array('Group_Ticket' => 'plugin_escalade_pre_item_add_group_ticket', 'Ticket' => 'plugin_escalade_pre_item_add_ticket');
        $PLUGIN_HOOKS['post_prepareadd']['escalade'] = array('Ticket' => 'plugin_escalade_post_prepareadd_ticket');
        $PLUGIN_HOOKS['item_purge']['escalade'] = array('User' => 'plugin_escalade_item_purge');
        $PLUGIN_HOOKS['item_add']['escalade']['User'] = '******';
        // == Interface links ==
        if (Session::haveRight('config', UPDATE)) {
            $PLUGIN_HOOKS['config_page']['escalade'] = 'front/config.form.php';
        }
        $PLUGIN_HOOKS['use_massive_action']['escalade'] = 1;
    }
}
/**
 * Fonction d'initialisation du plugin
 * @global array $PLUGIN_HOOKS
 */
function plugin_init_reforme()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['config_page']['reforme'] = 'front/config.form.php';
    Plugin::registerClass('PluginReformeReforme', array('addtabon' => array('Computer', 'Plugins', 'Monitor')));
    Plugin::registerClass('PluginReformeProfile', array('addtabon' => array('Profile')));
    $PLUGIN_HOOKS['csrf_compliant']['reforme'] = true;
    Plugin::registerClass('PluginReformeConfigold');
}
Beispiel #26
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';
        }
    }
}
Beispiel #27
0
function plugin_init_apacheauthdbd()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $Plugin = new Plugin();
    $PLUGIN_HOOKS['item_add']['apacheauthdbd'] = $PLUGIN_HOOKS['item_restore']['apacheauthdbd'] = array('User' => 'plugin_item_add_apacheauthdbd_user');
    $PLUGIN_HOOKS['item_update']['apacheauthdbd'] = array('User' => 'plugin_item_update_apacheauthdbd_user');
    $PLUGIN_HOOKS['item_delete']['apacheauthdbd'] = $PLUGIN_HOOKS['item_purge']['apacheauthdbd'] = array('User' => 'plugin_item_delete_apacheauthdbd_user');
    $PLUGIN_HOOKS['csrf_compliant']['apacheauthdbd'] = true;
    Plugin::registerClass('PluginApacheauthdbdUser', array('addtabon' => array('User')));
}
function plugin_init_webservices()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $WEBSERVICE_LINKED_OBJECTS;
    Plugin::registerClass('PluginWebservicesClient');
    $PLUGIN_HOOKS['csrf_compliant']['webservices'] = true;
    $PLUGIN_HOOKS["menu_toadd"]['webservices'] = array('config' => 'PluginWebservicesClient');
    $PLUGIN_HOOKS['webservices']['webservices'] = 'plugin_webservices_registerMethods';
    //Store objects that can be retrieved when querying another object
    $WEBSERVICE_LINKED_OBJECTS = array('with_infocom' => array('help' => 'bool, optional', 'itemtype' => 'Infocom', 'allowed_types' => $CFG_GLPI['infocom_types'], 'class' => 'PluginWebservicesMethodInventaire'), 'with_networkport' => array('help' => 'bool, optional', 'itemtype' => 'NetworkPort', 'allowed_types' => plugin_webservices_getNetworkPortItemtypes(), 'class' => 'PluginWebservicesMethodInventaire'), 'with_phone' => array('help' => 'bool, optional (Computer only)', 'itemtype' => 'Phone', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_printer' => array('help' => 'bool', 'optional (Computer only)', 'itemtype' => 'Printer', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_monitor' => array('help' => 'bool', 'optional (Computer only)', 'itemtype' => 'Monitor', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_peripheral' => array('help' => 'bool', 'optional (Computer only)', 'itemtype' => 'Peripheral', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_document' => array('help' => 'bool', 'optional', 'itemtype' => 'Document', 'allowed_types' => plugin_webservices_getDocumentItemtypes(), 'class' => 'PluginWebservicesMethodInventaire'), 'with_ticket' => array('help' => 'bool', 'optional', 'itemtype' => 'Ticket', 'allowed_types' => plugin_webservices_getTicketItemtypes(), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_tickettask' => array('help' => 'bool', 'optional (Ticket only)', 'itemtype' => 'TicketTask', 'allowed_types' => array('Ticket'), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_ticketfollowup' => array('help' => 'bool', 'optional (Ticket only)', 'itemtype' => 'TicketFollowup', 'allowed_types' => array('Ticket'), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_ticketvalidation' => array('help' => 'bool', 'optional (Ticket only)', 'itemtype' => 'TicketValidation', 'allowed_types' => array('Ticket'), 'class' => 'PluginWebservicesMethodHelpdesk'), 'with_reservation' => array('help' => 'bool', 'itemtype' => 'Reservation', 'allowed_types' => $CFG_GLPI['reservation_types'], 'class' => 'PluginWebservicesMethodInventaire'), 'with_software' => array('help' => 'bool', 'itemtype' => 'Software', 'allowed_types' => array('Computer'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_softwareversion' => array('help' => 'bool', 'itemtype' => 'SoftwareVersion', 'allowed_types' => array('Software'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_softwarelicense' => array('help' => 'bool', 'itemtype' => 'SoftwareLicense', 'allowed_types' => array('Software'), 'class' => 'PluginWebservicesMethodInventaire'), 'with_contract' => array('help' => 'bool', 'itemtype' => 'Contract', 'allowed_types' => $CFG_GLPI['contract_types'], 'class' => 'PluginWebservicesMethodInventaire'));
}
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';
        }
    }
}