コード例 #1
1
 static function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1, $types, $locations_id = -1, $action = 'showItem')
 {
     global $DB, $CFG_GLPI;
     $rand = mt_rand();
     $plugin = new Plugin();
     echo "<table border='0'><tr><td>\n";
     if ($myname == 'type') {
         $newtypes = array_flip($types);
         unset($newtypes['Location']);
         unset($newtypes['Netpoint']);
         if ($plugin->isActivated("resources")) {
             unset($newtypes['PluginResourcesResource']);
         }
         $types = array_flip($newtypes);
     }
     $rand = Dropdown::showItemTypes($myname, $types, array('emptylabel' => Dropdown::EMPTY_VALUE, 'width' => 150));
     $params = array('type' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'action' => $action, 'entity_restrict' => $entity_restrict, 'locations_id' => $locations_id);
     Ajax::updateItemOnSelectEvent("dropdown_{$myname}{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
     echo "</td><td>\n";
     echo "<span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
     echo "</td></tr></table>\n";
     if ($value > 0) {
         echo "<script type='text/javascript' >\n";
         echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';";
         echo "</script>\n";
         $params["typetable"] = $value_type;
         Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
     }
     return $rand;
 }
コード例 #2
0
ファイル: setup.php プロジェクト: nicholaseduardo/formcreator
/**
 * 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');
}
コード例 #3
0
ファイル: setup.php プロジェクト: blerohellec/customfields
/**
 * 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';
    }
}
コード例 #4
0
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';
    }
}
コード例 #5
0
ファイル: setup.php プロジェクト: pluginsGLPI/uninstall
/**
 * 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';
    }
}
コード例 #6
0
ファイル: archires.class.php プロジェクト: geldarr/hack-space
 static function showSummary()
 {
     echo "<div class='center'><table class='tab_cadre' cellpadding='5' width='50%'>";
     echo "<tr><th>" . __('Summary') . "</th></tr>";
     if (countElementsInTable('glpi_plugin_archires_views', "`entities_id`='" . $_SESSION["glpiactive_entity"] . "'") > 0) {
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='view.php'>" . PluginArchiresView::getTypeName(2) . "</a>";
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='locationquery.php'>" . sprintf(__('%1$s - %2$s'), self::getTypeName(1), PluginArchiresLocationQuery::getTypeName(1)) . "</a>";
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='networkequipmentquery.php'>" . sprintf(__('%1$s - %2$s'), self::getTypeName(1), PluginArchiresNetworkEquipmentQuery::getTypeName(1)) . "</a>";
         echo "</td></tr>";
         $plugin = new Plugin();
         if ($plugin->isActivated("appliances")) {
             echo "<tr class='tab_bg_1'><td>";
             echo "<a href='appliancequery.php'>" . sprintf(__('%1$s - %2$s'), self::getTypeName(1), PluginAppliancesAppliance::getTypeName(1)) . "</a>";
             echo "</td></tr>";
         }
     } else {
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='view.form.php?new=1'>" . __('Add view', 'archires') . "</a>";
         echo "</td></tr>";
     }
     echo "</table></div>";
 }
コード例 #7
0
ファイル: setup.php プロジェクト: publik1974/fields
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);
            }
        }
    }
}
コード例 #8
0
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';
    }
}
コード例 #9
0
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();
    }
}
コード例 #10
0
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';
    }
}
コード例 #11
0
ファイル: setup.php プロジェクト: geldarr/hack-space
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';
    }
}
コード例 #12
0
ファイル: setup.php プロジェクト: geldarr/hack-space
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';
    }
}
コード例 #13
0
ファイル: setup.php プロジェクト: korial29/escalade
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;
    }
}
コード例 #14
0
ファイル: hook.php プロジェクト: geldarr/hack-space
function plugin_ticketmail_getPluginsDatabaseRelations()
{
    $plugin = new Plugin();
    if ($plugin->isActivated("ticketmail")) {
        return array("glpi_profiles" => array("glpi_plugin_ticketmail_profiles" => "id"));
    } else {
        return array();
    }
}
コード例 #15
0
ファイル: hook.php プロジェクト: geldarr/hack-space
function plugin_environment_getDatabaseRelations()
{
    $plugin = new Plugin();
    if ($plugin->isActivated("environment")) {
        return array("glpi_profiles" => array("glpi_plugin_environment_profiles" => "profiles_id"));
    } else {
        return array();
    }
}
コード例 #16
0
ファイル: hook.php プロジェクト: geldarr/hack-space
function plugin_utilitaires_getDatabaseRelations()
{
    $plugin = new Plugin();
    if ($plugin->isActivated("utilitaires")) {
        return array("glpi_profiles" => array("glpi_plugin_utilitaires_profiles" => "profiles_id"));
    } else {
        return array();
    }
}
コード例 #17
0
ファイル: hook.php プロジェクト: InfotelGLPI/tasklists
function plugin_tasklists_getDropdown()
{
    $plugin = new Plugin();
    if ($plugin->isActivated("tasklists")) {
        return array('PluginTasklistsTaskType' => PluginTasklistsTaskType::getTypeName(2));
    } else {
        return array();
    }
}
コード例 #18
0
ファイル: hook.php プロジェクト: geldarr/hack-space
function plugin_vip_getPluginsDatabaseRelations()
{
    $plugin = new Plugin();
    if ($plugin->isActivated("vip")) {
        return array("glpi_profiles" => array("glpi_plugin_vip_profiles" => "id"), "glpi_groups" => array("glpi_plugin_vip_groups" => "id"), "glpi_tickets" => array("glpi_plugin_vip_tickets" => "id"));
    } else {
        return array();
    }
}
コード例 #19
0
ファイル: setup.php プロジェクト: jcr0ch4/formcreator
/**
 * Initialize all classes and generic variables of the plugin
 */
function plugin_init_formcreator()
{
    global $PLUGIN_HOOKS;
    // Set the plugin CSRF compliance (required since GLPI 0.84)
    $PLUGIN_HOOKS['csrf_compliant']['formcreator'] = true;
    $plugin = new Plugin();
    if (isset($_SESSION['glpiID']) && $plugin->isInstalled('formcreator') && $plugin->isActivated('formcreator')) {
        // Massive Action definition
        $PLUGIN_HOOKS['use_massive_action']['formcreator'] = 1;
        // If user have acces to one form or more, add link
        $form_table = getTableForItemType('PluginFormcreatorForm');
        $table_fp = getTableForItemType('PluginFormcreatorFormprofiles');
        $where = getEntitiesRestrictRequest("", $form_table, "", "", true, false);
        $query = "SELECT COUNT({$form_table}.id)\n                     FROM {$form_table}\n                     WHERE {$form_table}.`is_active` = 1\n                     AND {$form_table}.`is_deleted` = 0\n                     AND {$form_table}.`helpdesk_home` = 1\n                     AND ({$form_table}.`language` = '{$_SESSION['glpilanguage']}' OR {$form_table}.`language` = '')\n                     AND {$where}\n                     AND ({$form_table}.`access_rights` != " . PluginFormcreatorForm::ACCESS_RESTRICTED . " OR {$form_table}.`id` IN (\n                        SELECT plugin_formcreator_forms_id\n                        FROM {$table_fp}\n                        WHERE plugin_formcreator_profiles_id = " . (int) $_SESSION['glpiactiveprofile']['id'] . "))";
        $result = $GLOBALS['DB']->query($query);
        list($nb) = $GLOBALS['DB']->fetch_array($result);
        if ($nb > 0) {
            $PLUGIN_HOOKS['menu_toadd']['formcreator']['helpdesk'] = 'PluginFormcreatorFormlist';
        }
        if (strpos($_SERVER['REQUEST_URI'], "plugins/formcreator") !== false || strpos($_SERVER['REQUEST_URI'], "central.php") !== false || isset($_SESSION['glpiactiveprofile']) && $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') {
            // Add specific CSS
            $PLUGIN_HOOKS['add_css']['formcreator'][] = "css/styles.css";
            $PLUGIN_HOOKS['add_css']['formcreator'][] = 'lib/pqselect/pqselect.min.css';
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'lib/pqselect/pqselect.min.js';
            // Add specific JavaScript
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/forms-validation.js.php';
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/scripts.js.php';
        }
        // 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('entity', UPDATE)) {
            $PLUGIN_HOOKS['config_page']['formcreator'] = 'front/form.php';
            $PLUGIN_HOOKS['menu_toadd']['formcreator']['admin'] = 'PluginFormcreatorForm';
            $links['config'] = '/plugins/formcreator/front/form.php';
            $links['add'] = '/plugins/formcreator/front/form.form.php';
        }
        $img = '<img  src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/check.png"
                  title="' . __('Forms waiting for validation', 'formcreator') . '" alt="Waiting forms list" />';
        $links[$img] = '/plugins/formcreator/front/formanswer.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');
        // Notification
        Plugin::registerClass('PluginFormcreatorFormanswer', array('notificationtemplates_types' => true));
        if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE && isset($_SESSION['glpimenu'])) {
            unset($_SESSION['glpimenu']);
        }
    }
}
コード例 #20
0
ファイル: setup.php プロジェクト: pluginsGLPI/order
function plugin_init_order()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $ORDER_TYPES;
    Plugin::registerClass('PluginOrderProfile');
    $PLUGIN_HOOKS['csrf_compliant']['order'] = true;
    /* Init current profile */
    $PLUGIN_HOOKS['change_profile']['order'] = array('PluginOrderProfile', 'initProfile');
    $plugin = new Plugin();
    if ($plugin->isActivated('order')) {
        $PLUGIN_HOOKS['migratetypes']['order'] = 'plugin_order_migratetypes';
        $PLUGIN_HOOKS['assign_to_ticket']['order'] = true;
        //Itemtypes in use for an order
        $ORDER_TYPES = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Printer', 'Phone', 'ConsumableItem', 'CartridgeItem', 'Contract', 'PluginOrderOther', 'SoftwareLicense');
        $CFG_GLPI['plugin_order_types'] = $ORDER_TYPES;
        $PLUGIN_HOOKS['pre_item_purge']['order'] = array('Profile' => array('PluginOrderProfile', 'purgeProfiles'), 'DocumentCategory' => array('PluginOrderDocumentCategory', 'purgeItem'));
        $PLUGIN_HOOKS['pre_item_update']['order'] = array('Infocom' => array('PluginOrderOrder_Item', 'updateItem'), 'Contract' => array('PluginOrderOrder_Item', 'updateItem'));
        $PLUGIN_HOOKS['item_add']['order'] = array('Document' => array('PluginOrderOrder', 'addDocumentCategory'));
        include_once GLPI_ROOT . "/plugins/order/inc/order_item.class.php";
        foreach (PluginOrderOrder_Item::getClasses(true) as $type) {
            $PLUGIN_HOOKS['item_purge']['order'][$type] = 'plugin_item_purge_order';
        }
        Plugin::registerClass('PluginOrderOrder', array('document_types' => true, 'unicity_types' => true, 'notificationtemplates_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'contract_types' => true, 'linkuser_types' => true, 'addtabon' => array('Budget')));
        Plugin::registerClass('PluginOrderReference', array('document_types' => true));
        Plugin::registerClass('PluginOrderProfile', array('addtabon' => array('Profile')));
        $values['notificationtemplates_types'] = true;
        //If the new infocom display hook (introduced in 9.1) is available, use it !
        if (method_exists('Infocom', 'addPluginInfos')) {
            $PLUGIN_HOOKS['infocom']['order'] = array('PluginOrderOrder_Item', 'showForInfocom');
        } else {
            $values['addtabon'] = PluginOrderOrder_Item::getClasses(true);
        }
        Plugin::registerClass('PluginOrderOrder_Item', $values);
        if (PluginOrderOrder::canView()) {
            Plugin::registerClass('PluginOrderDocumentCategory', array('addtabon' => array('DocumentCategory')));
            Plugin::registerClass('PluginOrderOrder_Supplier', array('addtabon' => array('Supplier')));
            Plugin::registerClass('PluginOrderPreference', array('addtabon' => array('Preference')));
        }
        /*if glpi is loaded */
        if (Session::getLoginUserID()) {
            $PLUGIN_HOOKS['add_css']['order'][] = 'order.css';
            /* link to the config page in plugins menu */
            if (Session::haveRight("config", UPDATE)) {
                $PLUGIN_HOOKS['config_page']['order'] = 'front/config.form.php';
            }
            if (PluginOrderOrder::canView() || PluginOrderReference::canView() || PluginOrderBill::canView()) {
                $PLUGIN_HOOKS['menu_toadd']['order']['management'] = 'PluginOrderMenu';
            }
            $PLUGIN_HOOKS['assign_to_ticket']['order'] = true;
            $PLUGIN_HOOKS['use_massive_action']['order'] = 1;
            $PLUGIN_HOOKS['plugin_datainjection_populate']['order'] = "plugin_datainjection_populate_order";
        }
    }
}
コード例 #21
0
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';
        }
    }
}
コード例 #22
0
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';
        }
    }
}
コード例 #23
0
function plugin_init_accounts()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['accounts'] = true;
    $PLUGIN_HOOKS['assign_to_ticket']['accounts'] = true;
    $PLUGIN_HOOKS['change_profile']['accounts'] = array('PluginAccountsProfile', 'initProfile');
    if (Session::getLoginUserID()) {
        // Params : plugin name - string type - number - attributes
        Plugin::registerClass('PluginAccountsAccount', array('linkgroup_types' => true, 'linkuser_types' => true, 'linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'notificationtemplates_types' => true, 'header_types' => true));
        Plugin::registerClass('PluginAccountsConfig', array('addtabon' => 'CronTask'));
        Plugin::registerClass('PluginAccountsProfile', array('addtabon' => 'Profile'));
        $plugin = new Plugin();
        if (!$plugin->isActivated('environment') && Session::haveRight("plugin_accounts", READ)) {
            $PLUGIN_HOOKS["menu_toadd"]['accounts'] = array('admin' => 'PluginAccountsMenu');
            $PLUGIN_HOOKS['helpdesk_menu_entry']['accounts'] = '/front/account.php';
        }
        if ($plugin->isActivated('environment') && Session::haveRight("plugin_accounts", READ)) {
            $PLUGIN_HOOKS['helpdesk_menu_entry']['accounts'] = '/front/account.php';
        }
        if (Session::haveRight("plugin_accounts", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['accounts'] = 1;
        }
        $PLUGIN_HOOKS['redirect_page']['accounts'] = "front/account.form.php";
        //Clean Plugin on Profile delete
        if (class_exists('PluginAccountsAccount_Item')) {
            // only if plugin activated
            $PLUGIN_HOOKS['plugin_datainjection_populate']['accounts'] = 'plugin_datainjection_populate_accounts';
        }
        // Add specific files to add to the header : javascript or css
        $PLUGIN_HOOKS['add_javascript']['accounts'][] = "scripts/getparameter.js";
        $PLUGIN_HOOKS['add_javascript']['accounts'][] = "scripts/crypt.js";
        if (strpos($_SERVER['REQUEST_URI'], "front/account.form.php") !== false) {
            $PLUGIN_HOOKS['add_javascript']['accounts'][] = "scripts/account.form.js";
        }
        $PLUGIN_HOOKS['add_javascript']['accounts'][] = "lib/lightcrypt.js";
        $PLUGIN_HOOKS['migratetypes']['accounts'] = 'plugin_datainjection_migratetypes_accounts';
        // End init, when all types are registered
        $PLUGIN_HOOKS['post_init']['accounts'] = 'plugin_accounts_postinit';
    }
}
コード例 #24
0
ファイル: setup.php プロジェクト: rjmontenegro/sccm
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');
        }
    }
}
コード例 #25
0
ファイル: setup.php プロジェクト: geldarr/hack-space
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'])) {
                if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false || strpos($_SERVER['REQUEST_URI'], "central.php") !== false) {
                    //history and climb feature
                    if ($_SESSION['plugins']['escalade']['config']['show_history'] == true && $_SESSION['plugins']['escalade']['config']['remove_group'] == true) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/escalade.js.php';
                    }
                }
                if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false) {
                    //remove btn feature
                    $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/remove_btn.js.php';
                    //clone ticket feature
                    if ($_SESSION['plugins']['escalade']['config']['cloneandlink_ticket'] == true) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/cloneandlink_ticket.js.php';
                    }
                    //assign me feature
                    if ($_SESSION['plugins']['escalade']['config']['assign_me_ticket'] == true) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/assign_me.js.php';
                    }
                    //filter group feature
                    if ($_SESSION['plugins']['escalade']['config']['use_filter_assign_group'] == true) {
                        $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/filtergroup.js.php';
                    }
                }
                Plugin::registerClass('PluginEscaladeGroup_Group', array('addtabon' => 'Group'));
            }
        }
        $PLUGIN_HOOKS['add_css']['escalade'][] = 'style.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');
        // == Interface links ==
        if (Session::haveRight('config', 'w')) {
            $config_page = 'front/config.form.php';
            $PLUGIN_HOOKS['config_page']['escalade'] = $config_page;
            $PLUGIN_HOOKS['submenu_entry']['escalade']['config'] = $config_page;
            $PLUGIN_HOOKS['submenu_entry']['escalade']['options']['config']['links']['config'] = '/plugins/escalade/' . $config_page;
        }
    }
}
コード例 #26
0
ファイル: setup.php プロジェクト: geldarr/hack-space
function plugin_init_minixmpp()
{
    global $PLUGIN_HOOKS;
    $plugin = new Plugin();
    if ($plugin->isActivated("minixmpp")) {
        $PluginMinixmppConfig = new PluginMinixmppConfig();
        $PluginMinixmppConfig->init();
    }
    $PLUGIN_HOOKS['csrf_compliant']['minixmpp'] = true;
    if (Session::haveRight("config", "w")) {
        $PLUGIN_HOOKS['config_page']['minixmpp'] = 'front/config.form.php';
    }
    $PLUGIN_HOOKS['add_javascript']['minixmpp'] = array('js/jquery.min.js', 'js/minijappix.js');
}
コード例 #27
0
ファイル: hook.php プロジェクト: rambeau/genericobject
function plugin_genericobject_getDropdown()
{
    $dropdowns = array();
    $plugin = new Plugin();
    if ($plugin->isActivated("genericobject")) {
        foreach (getAllDatasFromTable(getTableForItemType('PluginGenericobjectType'), "`is_active`='1'") as $itemtype) {
            foreach (PluginGenericobjectType::getDropdownForItemtype($itemtype['itemtype']) as $table) {
                $dropdown_itemtype = getItemTypeForTable($table);
                $dropdowns[$dropdown_itemtype] = $dropdown_itemtype::getTypeName();
            }
        }
    }
    return $dropdowns;
}
コード例 #28
0
function plugin_init_news()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['news'] = true;
    $PLUGIN_HOOKS['add_javascript']['news'] = 'scripts/alert.php';
    $PLUGIN_HOOKS['add_css']['news'] = 'css/styles.css';
    $PLUGIN_HOOKS['change_profile']['news'] = array('PluginNewsProfile', 'changeProfile');
    Plugin::registerClass('PluginNewsProfile', array('addtabon' => 'Profile'));
    $plugin = new Plugin();
    if (isset($_SESSION['glpiID']) && $plugin->isInstalled('news') && $plugin->isActivated('news')) {
        if (Session::haveRight('plugin_news', READ)) {
            $PLUGIN_HOOKS['menu_toadd']['news'] = array('tools' => 'PluginNewsAlert');
        }
    }
}
コード例 #29
0
ファイル: setup.php プロジェクト: pluginsGLPI/moreldap
function plugin_init_moreldap()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $LANG;
    $PLUGIN_HOOKS['csrf_compliant']['moreldap'] = true;
    $plugin = new Plugin();
    if ($plugin->isInstalled("moreldap") && $plugin->isActivated("moreldap")) {
        //Add a tab on AuthLDAP items
        Plugin::registerClass('PluginMoreldapAuthLDAP', array('addtabon' => 'AuthLDAP'));
        // request more attributes from LDAP
        // $PLUGIN_HOOKS['retrieve_more_field_from_ldap']['moreldap'] = "plugin_retrieve_more_field_from_ldap_moreldap";
        // Retrieve others datas from LDAP
        $PLUGIN_HOOKS['item_add']['moreldap'] = array('User' => 'plugin_moreldap_item_add_or_update_user');
        $PLUGIN_HOOKS['item_update']['moreldap'] = array('User' => 'plugin_moreldap_item_add_or_update_user');
    }
}
コード例 #30
0
ファイル: setup.php プロジェクト: geldarr/hack-space
function plugin_init_escalation()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['change_profile']['escalation'] = array('PluginEscalationProfile', 'changeprofile');
    $PLUGIN_HOOKS['csrf_compliant']['escalation'] = true;
    // After escalation, if user can't see the ticket (dan't see all ticket right), it redirect to ticket list
    if (isset($_SERVER['HTTP_REFERER']) and strstr($_SERVER['HTTP_REFERER'], "escalation/front/group_group.form.php")) {
        if (isset($_GET['id'])) {
            $ticket = new Ticket();
            $ticket->getFromDB($_GET['id']);
            if (!$ticket->canViewItem()) {
                // Can't see ticket, go in ticket list
                $ticket->redirectToList();
            }
        }
    }
    if (isset($_SESSION["glpiID"])) {
        $plugin = new Plugin();
        if ($plugin->isActivated('escalation')) {
            Plugin::registerClass('PluginEscalationProfile', array('addtabon' => array('Profile')));
            Plugin::registerClass('PluginEscalationTicketCopy', array('addtabon' => array('Ticket')));
            Plugin::registerClass('PluginEscalationConfig', array('addtabon' => array('Entity')));
            Plugin::registerClass('PluginEscalationGroup_Group', array('addtabon' => array('Ticket', 'Group')));
            $PLUGIN_HOOKS['menu_entry']['escalation'] = false;
            PluginEscalationGroup_Group::convertNewTicket();
            // limit group
            $peConfig = new PluginEscalationConfig();
            if ($peConfig->getValue('limitgroup', $_SESSION['glpidefault_entity']) == '1') {
                if (strpos($_SERVER['PHP_SELF'], "ticket.form.php") && !isset($_GET['id'])) {
                    $group = new Group();
                    $a_groups = array();
                    $a_groups[0] = Dropdown::EMPTY_VALUE;
                    foreach ($_SESSION['glpigroups'] as $groups_id) {
                        $group->getFromDB($groups_id);
                        $a_groups[$groups_id] = $group->getName();
                    }
                    $_SESSION['plugin_escalation_requestergroups'] = $a_groups;
                    register_shutdown_function('plugin_escalation_on_exit');
                    ob_start();
                }
            }
            // end limit group
        }
        $PLUGIN_HOOKS['pre_item_add']['escalation'] = array('Ticket' => array('PluginEscalationGroup_Group', 'selectGroupOnAdd'));
        $PLUGIN_HOOKS['item_add']['escalation'] = array('Ticket' => array('PluginEscalationTicketCopy', 'finishAdd'));
        //         $PLUGIN_HOOKS['pre_item_update']['escalation'] = array('Ticket' => array('PluginEscalationGroup_Group', 'notMultiple'));
    }
}