function showTabs($options = array())
 {
     global $LANG, $CFG_GLPI;
     // for objects not in table like central
     $ID = 0;
     if (isset($this->fields['id'])) {
         $ID = $this->fields['id'];
     }
     $target = $_SERVER['PHP_SELF'];
     $extraparamhtml = "";
     $extraparam = "";
     $withtemplate = "";
     if (is_array($options) && count($options)) {
         if (isset($options['withtemplate'])) {
             $withtemplate = $options['withtemplate'];
         }
         foreach ($options as $key => $val) {
             $extraparamhtml .= "&{$key}={$val}";
             $extraparam .= "&{$key}={$val}";
         }
     }
     if (empty($withtemplate) && $ID && $this->getType() && $this->displaylist) {
         $glpilistitems =& $_SESSION['glpilistitems'][$this->getType()];
         $glpilisttitle =& $_SESSION['glpilisttitle'][$this->getType()];
         $glpilisturl =& $_SESSION['glpilisturl'][$this->getType()];
         if (empty($glpilisturl)) {
             $glpilisturl = $this->getSearchURL();
         }
         echo "<div id='menu_navigate'>";
         $next = $prev = $first = $last = -1;
         $current = false;
         if (is_array($glpilistitems)) {
             $current = array_search($ID, $glpilistitems);
             if ($current !== false) {
                 if (isset($glpilistitems[$current + 1])) {
                     $next = $glpilistitems[$current + 1];
                 }
                 if (isset($glpilistitems[$current - 1])) {
                     $prev = $glpilistitems[$current - 1];
                 }
                 $first = $glpilistitems[0];
                 if ($first == $ID) {
                     $first = -1;
                 }
                 $last = $glpilistitems[count($glpilistitems) - 1];
                 if ($last == $ID) {
                     $last = -1;
                 }
             }
         }
         $cleantarget = cleanParametersURL($target);
         echo "<ul>";
         echo "<li><a href=\"javascript:showHideDiv('tabsbody','tabsbodyimg','" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png','" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png')\">";
         echo "<img alt='' name='tabsbodyimg' src=\"" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png\">";
         echo "</a></li>";
         echo "<li><a href=\"" . $glpilisturl . "\">";
         if ($glpilisttitle) {
             if (utf8_strlen($glpilisttitle) > $_SESSION['glpidropdown_chars_limit']) {
                 $glpilisttitle = utf8_substr($glpilisttitle, 0, $_SESSION['glpidropdown_chars_limit']) . "&hellip;";
             }
             echo $glpilisttitle;
         } else {
             echo $LANG['common'][53];
         }
         echo "</a>&nbsp;:&nbsp;</li>";
         if ($first > 0) {
             echo "<li><a href='{$cleantarget}?id={$first}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . $LANG['buttons'][55] . "\" title=\"" . $LANG['buttons'][55] . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/first_off.png' alt=\"" . $LANG['buttons'][55] . "\" title=\"" . $LANG['buttons'][55] . "\"></li>";
         }
         if ($prev > 0) {
             echo "<li><a href='{$cleantarget}?id={$prev}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . $LANG['buttons'][12] . "\" title=\"" . $LANG['buttons'][12] . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/left_off.png' alt=\"" . $LANG['buttons'][12] . "\" title=\"" . $LANG['buttons'][12] . "\"></li>";
         }
         if ($current !== false) {
             echo "<li>" . ($current + 1) . "/" . count($glpilistitems) . "</li>";
         }
         if ($next > 0) {
             echo "<li><a href='{$cleantarget}?id={$next}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . $LANG['buttons'][11] . "\" title=\"" . $LANG['buttons'][11] . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/right_off.png' alt=\"" . $LANG['buttons'][11] . "\" title=\"" . $LANG['buttons'][11] . "\"></li>";
         }
         if ($last > 0) {
             echo "<li><a href='{$cleantarget}?id={$last}{$extraparamhtml}'><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/last.png\" alt=\"" . $LANG['buttons'][56] . "\" title=\"" . $LANG['buttons'][56] . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/last_off.png' alt=\"" . $LANG['buttons'][56] . "\" title=\"" . $LANG['buttons'][56] . "\"></li>";
         }
         echo "</ul></div>";
         echo "<div class='sep'></div>";
     }
     echo "<div id='tabspanel' class='center-h'></div>";
     $onglets = $this->defineTabs($options);
     $display_all = true;
     if (isset($onglets['no_all_tab'])) {
         $display_all = false;
         unset($onglets['no_all_tab']);
     }
     $class = $this->getType();
     if ($_SESSION['glpi_use_mode'] == DEBUG_MODE && ($ID > 0 || $this->showdebug) && (method_exists($class, 'showDebug') || in_array($class, $CFG_GLPI["infocom_types"]) || in_array($class, $CFG_GLPI["reservation_types"]))) {
         $onglets[-2] = $LANG['setup'][137];
     }
     if (count($onglets)) {
         $tabpage = $this->getTabsURL();
         $tabs = array();
         foreach ($onglets as $key => $val) {
             $tabs[$key] = array('title' => $val, 'url' => $tabpage, 'params' => "target={$target}&itemtype=" . $this->getType() . "&glpi_tab={$key}&id={$ID}{$extraparam}");
         }
         $plug_tabs = Plugin::getTabs($target, $this, $withtemplate);
         $tabs += $plug_tabs;
         // Not all tab for templates and if only 1 tab
         if ($display_all && empty($withtemplate) && count($tabs) > 1) {
             $tabs[-1] = array('title' => $LANG['common'][66], 'url' => $tabpage, 'params' => "target={$target}&itemtype=" . $this->getType() . "&glpi_tab=-1&id={$ID}{$extraparam}");
         }
         createAjaxTabs('tabspanel', 'tabcontent', $tabs, $this->getType(), "'100%'");
     }
 }
 static function detectRootDoc()
 {
     global $CFG_GLPI;
     if (!isset($CFG_GLPI["root_doc"])) {
         if (!isset($_SERVER['REQUEST_URI'])) {
             $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
         }
         $currentdir = getcwd();
         chdir(GLPI_ROOT);
         $glpidir = str_replace(str_replace('\\', '/', getcwd()), "", str_replace('\\', '/', $currentdir));
         chdir($currentdir);
         $globaldir = cleanParametersURL($_SERVER['REQUEST_URI']);
         $globaldir = preg_replace("/\\/[0-9a-zA-Z\\.\\-\\_]+\\.php/", "", $globaldir);
         $CFG_GLPI["root_doc"] = str_replace($glpidir, "", $globaldir);
         $CFG_GLPI["root_doc"] = preg_replace("/\\/\$/", "", $CFG_GLPI["root_doc"]);
         // urldecode for space redirect to encoded URL : change entity
         $CFG_GLPI["root_doc"] = urldecode($CFG_GLPI["root_doc"]);
     }
 }
  @copyright Copyright (c) 2011-2012 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
    define('GLPI_ROOT', '../../..');
    file_put_contents(GLPI_ROOT . "/files/_log/sql-errors.log", '');
    file_put_contents(GLPI_ROOT . "/files/_log/php-errors.log", '');
    include_once GLPI_ROOT . "/inc/timer.class.php";
    include_once GLPI_ROOT . "/inc/common.function.php";
    // Security of PHP_SELF
    $_SERVER['PHP_SELF'] = cleanParametersURL($_SERVER['PHP_SELF']);
    function glpiautoload($classname)
    {
        global $DEBUG_AUTOLOAD, $CFG_GLPI;
        static $notfound = array();
        // empty classname or non concerted plugin
        if (empty($classname) || is_numeric($classname)) {
            return false;
        }
        $dir = GLPI_ROOT . "/inc/";
        //$classname="PluginExampleProfile";
        if ($plug = isPluginItemType($classname)) {
            $plugname = strtolower($plug['plugin']);
            $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
            $item = strtolower($plug['class']);
            // Is the plugin activate ?