[Allow filtering of statistics per domain allowed for login account Adrian Georgescu **20191210161806 Ignore-this: 6707c4c4d3240fcaf8b36928f1645bac ] hunk ./library/media_sessions.php 118 + hunk ./library/media_sessions.php 127 - if (!in_array($domain1, $this->allowedDomains) && !in_array($domain2, $this->allowedDomains)) { + $may_display = false; + foreach ($this->allowedDomains as $allow_domain) { + if ($this->endsWith($domain1, $allow_domain)) { + $may_display = true; + break; + } + if ($this->endsWith($domain2, $allow_domain)) { + $may_display = true; + break; + } + } + if (!$may_display) { hunk ./library/media_sessions.php 283 - $this->showSummary(); + if (!$this->allowedDomains) { + $this->showSummary(); + } hunk ./library/media_sessions.php 754 + + public function endsWith($string, $endString) + { + $len = strlen($endString); + if ($len == 0) { + return true; + } + return (substr($string, -$len) === $endString); + } hunk ./network_status.phtml 14 -$perm->check("statistics"); +$perm->check("admin"); hunk ./phplib/local.inc 530 - "readonly" => 512 + "readonly" => 512, + "sessions" => 1024 hunk ./phplib/local.inc 1200 - if ($perm->have_perm("statistics")) { + if ($perm->have_perm("sessions")) { + print "
  • Sessions
  • "; + } + + if ($perm->have_perm("admin")) { hunk ./phplib/local.inc 1208 -
  • Sessions
  • "; - print " hunk ./phplib/local.inc 1209 - } - - if ($perm->have_perm("admin")) {