Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add site title handling for devices, racks and locations #3627

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
108 changes: 61 additions & 47 deletions functions/classes/class.Common.php
Expand Up @@ -2090,64 +2090,78 @@ public function get_site_title ($get) {
if (isset($get['page'])) {
// dashboard
if ($get['page']=="dashboard") {
return $this->settings->siteTitle." "._("Dashboard");
return $this->settings->siteTitle." "._("Dashboard");
}
// install, upgrade
elseif ($get['page']=="temp_share" || $get['page']=="request_ip" || $get['page']=="opensearch") {
$title[] = ucwords(escape_input($get['page']));
$title[] = ucwords(escape_input($get['page']));
}
// sections, subnets
elseif ($get['page']=="subnets" || $get['page']=="folder") {
// subnets
$title[] = _("Subnets");

// section
if (isset($get['section'])) {
$se = $this->fetch_object ("sections", "id", escape_input($get['section']));
if($se!==false) {
$title[] = $se->name;
}
}
// subnet
if (isset($get['subnetId'])) {
$sn = $this->fetch_object ("subnets", "id", escape_input($get['subnetId']));
if($sn!==false) {
if($sn->isFolder) {
$title[] = $sn->description;
// subnets
$title[] = _("Subnets");

// section
if (isset($get['section'])) {
$se = $this->fetch_object ("sections", "id", escape_input($get['section']));
if($se!==false) {
$title[] = $se->name;
}
}
// subnet
if (isset($get['subnetId'])) {
$sn = $this->fetch_object ("subnets", "id", escape_input($get['subnetId']));
if($sn!==false) {
if($sn->isFolder) {
$title[] = $sn->description;
}
else {
$sn->description = strlen($sn->description)>0 ? " (".$sn->description.")" : "";
$title[] = $this->transform_address($sn->subnet, "dotted")."/".$sn->mask.$sn->description;
}
}
}
// ip address
if (isset($get['ipaddrid'])) {
$ip = $this->fetch_object ("ipaddresses", "id", escape_input($get['ipaddrid']));
if($ip!==false) {
$title[] = $this->transform_address($ip->ip_addr, "dotted");
}
}
else {
$sn->description = strlen($sn->description)>0 ? " (".$sn->description.")" : "";
$title[] = $this->transform_address($sn->subnet, "dotted")."/".$sn->mask.$sn->description;
}
}
}
// ip address
if (isset($get['ipaddrid'])) {
$ip = $this->fetch_object ("ipaddresses", "id", escape_input($get['ipaddrid']));
if($ip!==false) {
$title[] = $this->transform_address($ip->ip_addr, "dotted");
}
}
}
// tools, admin
elseif ($get['page']=="tools" || $get['page']=="administration") {
$title[] = ucwords(escape_input($get['page']));
// subpage
if (isset($get['section'])) {
$title[] = ucwords(escape_input($get['section']));
}
if (isset($get['subnetId'])) {
// vland domain
if($get['section']=="vlan") {
$se = $this->fetch_object ("vlanDomains", "id", escape_input($get['subnetId']));
if($se!==false) {
$title[] = $se->name." domain";
$title[] = ucwords(escape_input($get['page']));
// subpage
if (isset($get['section'])) {
$title[] = ucwords(escape_input($get['section']));
}
if (isset($get['subnetId'])) {
// vland domain
if($get['section']=="vlan") {
$se = $this->fetch_object ("vlanDomains", "id", escape_input($get['subnetId']));
if($se!==false) {
$title[] = $se->name." domain";
}
}
elseif($get['section']=="devices") {
$devicename = $this->fetch_object ("devices", "id", escape_input($get['subnetId']))->hostname;
$title[] = $devicename;
}
elseif($get['section']=="racks") {
$rack = $this->fetch_object ("racks", "id", escape_input($get['subnetId']));
$location = $this->fetch_object ("locations", "id", escape_input($rack->location));
$title[] = $location->name;
$title[] = $rack->name;
}
elseif($get['section']=="locations") {
$se = $this->fetch_object ("locations", "id", escape_input($get['subnetId']));
$title[] = $se->name;
}
else {
$title[] = ucwords(escape_input($get['subnetId']));
}
}
}
else {
$title[] = ucwords(escape_input($get['subnetId']));
}
}
}
else {
$title[] = ucwords(escape_input($get['page']));
Expand Down