Parcourir la source

modifications pour glpi 9.5

Nathan il y a 4 ans
Parent
commit
e5ecee8def

+ 1 - 1
ajax/dropdownAllItems.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/appliancequery.form.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/appliancequery.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 3 - 3
front/archires.graph.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -43,7 +43,7 @@ $obj    = new $object();
 
 if (isset($_GET["displayview"])) {
    $obj->getFromDB($_GET["plugin_archires_queries_id"]);
-   Html::redirect($CFG_GLPI["root_doc"]."/plugins/archires/front/archires.graph.php?id=".
+   Html::redirect(Plugin::getWebDir('archires')."/front/archires.graph.php?id=".
                   $obj->fields["id"]."&querytype=".$_GET["querytype"]."&plugin_archires_views_id=".
                   $_GET["plugin_archires_views_id"]);
 
@@ -65,7 +65,7 @@ if (isset($_GET["displayview"])) {
       $PluginArchiresPrototype->displayGraph($obj,$plugin_archires_views_id,1);
 
    } else {
-      Html::redirect($CFG_GLPI["root_doc"]."/plugins/archires/front/archires.php");
+      Html::redirect(Plugin::getWebDir('archires')."/front/archires.php");
    }
 
    Html::footer();

+ 1 - 1
front/archires.map.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/archires.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/archires.test.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/config.form.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/locationquery.form.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/locationquery.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/networkequipmentquery.form.php

@@ -20,7 +20,7 @@
  along with Archires. If not, see <http://www.gnu.org/licenses/>.
 
  @package   archires
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/networkequipmentquery.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/view.form.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
front/view.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 3 - 3
hook.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2019 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -32,13 +32,13 @@
 function plugin_archires_install() {
    global $DB;
 
-   include_once (GLPI_ROOT."/plugins/archires/inc/profile.class.php");
+   include_once (Plugin::getWebDir('archires')."/inc/profile.class.php");
    $update = false;
 
 
    if (!$DB->tableExists("glpi_plugin_archires_config")
        && !$DB->tableExists("glpi_plugin_archires_views")) {
-      $DB->runFile(GLPI_ROOT ."/plugins/archires/sql/empty-2.2.sql");
+      $DB->runFile(Plugin::getWebDir('archires')."/sql/empty-2.2.sql");
 
    } else {
       $update = true;

+ 1 - 1
inc/appliancequery.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 2 - 2
inc/archires.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -112,7 +112,7 @@ class PluginArchiresArchires extends CommonDBTM {
 
       echo "<span id='show_$myname$rand'>&nbsp;</span>\n";
       Ajax::updateItemOnSelectEvent($field_id, "show_$myname$rand",
-                                    $CFG_GLPI["root_doc"]."/plugins/archires/ajax/dropdownAllItems.php",
+                                    Plugin::getWebDir('archires')."/ajax/dropdownAllItems.php",
                                     $params);
       return $rand;
    }

+ 2 - 2
inc/imageitem.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/aarchires
@@ -165,7 +165,7 @@ class PluginArchiresImageItem extends CommonDBTM {
                   $name = $typeclass->fields["name"];
                }
                echo "<td>".$name."</td>";
-               echo "<td><img src=\"".$CFG_GLPI["root_doc"]."/plugins/archires/pics/".$ligne["img"].
+               echo "<td><img src=\"".Plugin::getWebDir('archires')."/pics/".$ligne["img"].
                            "\" alt=\"".$ligne["img"]."\" title=\"".$ligne["img"]."\"></td>";
                echo "<td width='10'>";
                echo "</td>";

+ 3 - 4
inc/locationquery.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -335,9 +335,8 @@ class PluginArchiresLocationQuery extends CommonDBTM {
             $query .= " AND `lc`.`id` = `$itemtable`.`locations_id` ";
             if ($this->fields["child"]
                 && !empty($this->fields["locations_id"])) {
-               $query .= " AND " . getRealQueryForTreeItem('glpi_locations',
-                                                           $this->fields["locations_id"],
-                                                           "`lc`.`id`");
+               $id_found = $dbu->getSonsOf('glpi_locations', $this->fields["locations_id"]);
+               $query .= " AND `lc`.`id` IN ('".implode("','", $id_found)."')";                                            
             } else {
                $query .= " AND `lc`.`id` = '".$this->fields["locations_id"]."'";
 

+ 1 - 1
inc/menu.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 2 - 2
inc/networkequipmentquery.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -298,7 +298,7 @@ class PluginArchiresNetworkEquipmentQuery extends CommonDBTM {
                   $query .= "GROUP BY `np`.`id` ORDER BY `np`.`id` ASC ";
 
                   if ($result = $DB->query($query)) {
-                     while ($data = $DB->fetch_array($result)) {
+                     while ($data = $DB->fetchArray($result)) {
 
                         if ($PluginArchiresView->fields["display_state"] != 0) {
                            $devices[$val][$data["items_id"]]["states_id"] = $data["states_id"];

+ 1 - 1
inc/networkinterfacecolor.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
inc/profile.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 8 - 5
inc/prototype.class.php

@@ -1,4 +1,5 @@
 <?php
+
 /*
  * @version $Id: prototype.class.php 234 2019-12-12 14:34:31Z yllen $
  -------------------------------------------------------------------------
@@ -21,7 +22,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -39,7 +40,7 @@ class PluginArchiresPrototype extends CommonDBTM {
 
 
    private static function dotIt($engine, $graph, $format) {
-
+      toolbox::logdebug("dans doIt");
       $out         = '';
       $Path        = realpath(GLPI_PLUGIN_DOC_DIR."/archires");
       $graph_name  = tempnam($Path, "txt");
@@ -355,7 +356,8 @@ class PluginArchiresPrototype extends CommonDBTM {
       $graph .= "<<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
 
       //img
-      $graph .= "<tr><td><img src=\"".realpath(GLPI_ROOT)."/plugins/archires/".$image_name. "\"/>".
+      $srcimage = 'realpath(Plugin::getWebDir("archires")."/".$image_name';
+      $graph .= "<tr><td><img src=".$srcimage."/>".
                 "</td></tr>";
 
       $graph .= "<tr><td> </td></tr><tr><td>".$device["name"];
@@ -499,7 +501,8 @@ class PluginArchiresPrototype extends CommonDBTM {
          if ($format!='svg') {
             $graph .= "<tr><td><img src= '../pics/socket.png' /></td></tr>";
          } else {
-            $graph .= "<tr><td><img src=\"".realpath(GLPI_ROOT)."/plugins/archires/pics/socket.png\"/>".
+            $srcimag = 'realpath(Plugin::getWebDir("archires")."/pics/socket.png"';
+            $graph .= "<tr><td><img src=\'".$srcimag."'/>".
                       "</td></tr>";
          }
          $graph .= "<tr><td HREF=\"".$url_ports.$ID2."\" tooltip=\"".$name2;
@@ -565,7 +568,7 @@ class PluginArchiresPrototype extends CommonDBTM {
       echo "</div>";
 
       if (isset($ID) && !empty($ID)) {
-         echo "<img src='".$CFG_GLPI["root_doc"]."/plugins/archires/front/archires.map.php?id=".$ID.
+         echo "<img src='".Plugin::getWebDir('archires')."/front/archires.map.php?id=".$ID.
                "&amp;querytype=".$querytype."&amp;plugin_archires_views_id=".$plugin_archires_views_id.
                "' alt='' usemap='#G'>";
          echo $graph->createGraph("cmapx", $item, $plugin_archires_views_id);

+ 1 - 1
inc/querytype.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 1 - 1
inc/statecolor.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 3 - 4
inc/view.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -227,8 +227,7 @@ class PluginArchiresView extends CommonDBTM {
       }
       if ($select) {
          // display only
-         echo "<form method='get' name='selecting' action='".$CFG_GLPI["root_doc"].
-               "/plugins/archires/front/archires.graph.php'>";
+         echo "<form method='get' name='selecting' action='".Plugin::getWebDir('archires')."/front/archires.graph.php'>";
          echo "<table class='tab_cadre' cellpadding='5'>";
          echo "<tr class='tab_bg_1'>";
 
@@ -249,7 +248,7 @@ class PluginArchiresView extends CommonDBTM {
          echo "</table>";
          Html::closeForm();
       }
-      echo "<a href='".$CFG_GLPI["root_doc"]."/plugins/archires/front/archires.map.php?format=".
+      echo "<a href='".Plugin::getWebDir('archires')."/front/archires.map.php?format=".
             self::PLUGIN_ARCHIRES_SVG_FORMAT."&amp;id=".$ID."&amp;querytype=".$querytype.
             "&amp;plugin_archires_views_id=".
             $plugin_archires_views_id."'>[".__('SVG')."]</a>";

+ 1 - 1
inc/vlancolor.class.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2018 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires

+ 4 - 15
setup.php

@@ -21,7 +21,7 @@
 
  @package   archires
  @author    Nelly Mahu-Lasson, Xavier Caillaud
- @copyright Copyright (c) 2016-2019 Archires plugin team
+ @copyright Copyright (c) 2016-2021 Archires plugin 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.glpi-project.org/projects/archires
@@ -61,24 +61,13 @@ function plugin_init_archires() {
 function plugin_version_archires() {
 
    return ['name'           => _n('Network Architecture', 'Network Architectures', 2, 'archires'),
-           'version'        => '2.7.0',
+           'version'        => '2.8.0',
            'author'         => 'Xavier Caillaud, Nelly Mahu-Lasson',
            'license'        => 'AGPLv3+',
            'homepage'       => ' https://forge.glpi-project.org/projects/archires',
            'minGlpiVersion' => '9.4',
-           'requirements'   => ['glpi' => ['min' => '9.4',
-                                           'max' => '9.5']]];
-}
-
-
-// Optional : check prerequisites before install : may print errors or add to message after redirect
-function plugin_archires_check_prerequisites() {
-
-   if (version_compare(GLPI_VERSION,'9.4','lt') || version_compare(GLPI_VERSION,'9.5','ge')) {
-      echo "This plugin requires GLPI >= 9.4";
-      return false;
-   }
-   return true;
+           'requirements'   => ['glpi' => ['min' => '9.5',
+                                           'max' => '9.6']]];
 }