#13344 dashboard remove dashboardId on public link
This commit is contained in:
parent
aaa3761a86
commit
31f4124083
|
@ -994,6 +994,27 @@ class Manager implements PublicLogin
|
||||||
ui_require_css_file('modal');
|
ui_require_css_file('modal');
|
||||||
ui_require_css_file('form');
|
ui_require_css_file('form');
|
||||||
|
|
||||||
|
$hash_aux = get_parameter('hash');
|
||||||
|
if (empty($dashboardId)) {
|
||||||
|
$dashboards = $this->getDashboards();
|
||||||
|
$dashboards = array_reduce(
|
||||||
|
$dashboards,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['id']] = $item['name'];
|
||||||
|
return $carry;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($dashboards as $key => $layout) {
|
||||||
|
$hash_compare = self::generatePublicHash($key);
|
||||||
|
if (hash_equals($hash_aux, $hash_compare)) {
|
||||||
|
$this->dashboardId = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->dashboardId === 0
|
if ($this->dashboardId === 0
|
||||||
|| $this->deleteDashboard === true
|
|| $this->deleteDashboard === true
|
||||||
|| $this->copyDashboard === true
|
|| $this->copyDashboard === true
|
||||||
|
@ -1164,11 +1185,10 @@ class Manager implements PublicLogin
|
||||||
[
|
[
|
||||||
'dashboards' => $dashboards,
|
'dashboards' => $dashboards,
|
||||||
'ajaxController' => $this->ajaxController,
|
'ajaxController' => $this->ajaxController,
|
||||||
'dashboardId' => $this->dashboardId,
|
|
||||||
'refr' => $this->refr,
|
'refr' => $this->refr,
|
||||||
'url' => $this->url,
|
'url' => $this->url,
|
||||||
'dashboardName' => $this->dashboardFields['name'],
|
'dashboardName' => $this->dashboardFields['name'],
|
||||||
'hash' => self::generatePublicHash(),
|
'hash' => self::generatePublicHash($this->dashboardId),
|
||||||
'publicLink' => $this->publicLink,
|
'publicLink' => $this->publicLink,
|
||||||
'dashboardGroup' => $this->dashboardFields['id_group'],
|
'dashboardGroup' => $this->dashboardFields['id_group'],
|
||||||
'dashboardUser' => $this->dashboardFields['id_user'],
|
'dashboardUser' => $this->dashboardFields['id_user'],
|
||||||
|
@ -1210,7 +1230,7 @@ class Manager implements PublicLogin
|
||||||
'updateDashboard' => $this->updateDashboard,
|
'updateDashboard' => $this->updateDashboard,
|
||||||
'cellIdCreate' => \get_parameter('cellIdCreate', 0),
|
'cellIdCreate' => \get_parameter('cellIdCreate', 0),
|
||||||
'class' => (($config['public_dashboard'] === true) ? quotemeta(__CLASS__) : ''),
|
'class' => (($config['public_dashboard'] === true) ? quotemeta(__CLASS__) : ''),
|
||||||
'hash' => (($config['public_dashboard'] === true) ? self::generatePublicHash() : ''),
|
'hash' => (($config['public_dashboard'] === true) ? self::generatePublicHash($this->dashboardId) : ''),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,12 +27,23 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Button for display full screen mode.
|
// Button for display full screen mode.
|
||||||
|
use PandoraFMS\Dashboard\Manager;
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if (empty($dashboardId)) {
|
||||||
|
foreach ($dashboards as $key => $layout) {
|
||||||
|
$hash_compare = Manager::generatePublicHash($key);
|
||||||
|
if (hash_equals($hash, $hash_compare)) {
|
||||||
|
$dashboardId = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$queryFull = [
|
$queryFull = [
|
||||||
'dashboardId' => $dashboardId,
|
'refr' => $refr,
|
||||||
'refr' => $refr,
|
'pure' => 1,
|
||||||
'pure' => 1,
|
'hash' => $hash,
|
||||||
];
|
];
|
||||||
$urlFull = $url.'&'.http_build_query($queryFull);
|
$urlFull = $url.'&'.http_build_query($queryFull);
|
||||||
$fullscreen['text'] = '<a id="full_screen_link" href="'.$urlFull.'">';
|
$fullscreen['text'] = '<a id="full_screen_link" href="'.$urlFull.'">';
|
||||||
|
@ -124,10 +135,9 @@ $slides['text'] .= '</a>';
|
||||||
|
|
||||||
// Public Url.
|
// Public Url.
|
||||||
$queryPublic = [
|
$queryPublic = [
|
||||||
'dashboardId' => $dashboardId,
|
'hash' => $hash,
|
||||||
'hash' => $hash,
|
'id_user' => $config['id_user'],
|
||||||
'id_user' => $config['id_user'],
|
'pure' => 1,
|
||||||
'pure' => 1,
|
|
||||||
];
|
];
|
||||||
$publicUrl = ui_get_full_url(
|
$publicUrl = ui_get_full_url(
|
||||||
'operation/dashboard/public_dashboard.php?'.http_build_query($queryPublic)
|
'operation/dashboard/public_dashboard.php?'.http_build_query($queryPublic)
|
||||||
|
|
Loading…
Reference in New Issue