InfotelGLPI/mydashboard

API crash with GLPI 9.4.5

rk4an opened this issue · 8 comments

rk4an commented

Hi,

This plugin crash the GLPI API: glpi-project/glpi#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

Hello which version ? Can you try with 1.7.7 version ?

rk4an commented

We already have 1.7.7 version

tsmr commented

Can you try to change this line :

&& strpos($_SERVER['REQUEST_URI'], 'apirest.php') === false) {

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

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

For test, if you comment

if (isset($_SESSION["glpi_plugin_mydashboard_loaded"])

/*
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

Yes it works if the code is comment

tsmr commented

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

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

rk4an commented

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