InfotelGLPI / mydashboard

Plugin mydashboard for GLPI
http://blogglpi.infotel.com/
GNU General Public License v2.0
42 stars 19 forks source link

API crash with GLPI 9.4.5 #95

Closed rk4an closed 4 years ago

rk4an commented 4 years ago

Hi,

This plugin crash the GLPI API: https://github.com/glpi-project/glpi/issues/7161

At first request with a new session-token we get a redirect to auth page from /var/www/html/glpi/plugins/mydashboard/front/menu.php

Thanks

tsmr commented 4 years ago

Hello which version ? Can you try with 1.7.7 version ?

rk4an commented 4 years ago

We already have 1.7.7 version

tsmr commented 4 years ago

Can you try to change this line : https://github.com/InfotelGLPI/mydashboard/blob/9c0b46301b62fdb22415826a114b12b6d5f27559/setup.php#L90

if (isset($_SERVER['HTTP_REFERER'])
                && strpos($_SERVER['HTTP_REFERER'], 'redirect') !== false
                && strpos($_SERVER['REQUEST_URI'], 'apirest.php') === false) {
               $_SESSION["glpi_plugin_mydashboard_loaded"] = 1;
            }
rk4an commented 4 years ago

I already have this portion of code in this file and line number.

It same that #75 (who was closed but no fix)

Tell me what test I can do to help you.

Thanks,

tsmr commented 4 years ago

For test, if you comment https://github.com/InfotelGLPI/mydashboard/blob/9c0b46301b62fdb22415826a114b12b6d5f27559/setup.php#L93

/*
if (isset($_SESSION["glpi_plugin_mydashboard_loaded"])
                && $_SESSION["glpi_plugin_mydashboard_loaded"] == 0) {

               if (strpos($_SERVER['REQUEST_URI'], 'central.php?redirect') === false) {
                  if(Session::getCurrentInterface() == 'central'){
                     if (!$_SESSION['glpiactiveprofile']['create_ticket_on_login']) {
                        $_SESSION["glpi_plugin_mydashboard_loaded"] = 1;
                        Html::redirect($CFG_GLPI['root_doc'] . "/plugins/mydashboard/front/menu.php");

                     } else if (!$plugin->isActivated("servicecatalog")
                                || Session::haveRight("plugin_servicecatalog", 1)) {
                        $_SESSION["glpi_plugin_mydashboard_loaded"] = 1;
                        Html::redirect($CFG_GLPI['root_doc'] . "/plugins/mydashboard/front/menu.php");

                     } else if (!$_SESSION['glpiactiveprofile']['create_ticket_on_login']) {
                        $_SESSION["glpi_plugin_mydashboard_loaded"] = 1;
                        Html::redirect($CFG_GLPI['root_doc'] . "/plugins/mydashboard/front/menu.php");
                     }
                  }
               }
            }*/

It's OK ?

rk4an commented 4 years ago

Yes it works if the code is comment

tsmr commented 4 years ago

Have you in your preferences Mydashboard : Replace central interface to Yes ?

If yes can you uncomment & unactivate it into preferences & test ?

rk4an commented 4 years ago

I just apply your last commit and all works now, thanks!