Ticket #4299: hostname_title.patch

File hostname_title.patch, 1.3 kB (added by pnlarsson, 1 year ago)

Patch to put the hostname in the title when SERVERINTITLE is set

  • config.php

    old new  
    399399  $template['module_name'] = $module_name; 
    400400  $template['module_page'] = $module_page; 
    401401  if ($amp_conf['SERVERINTITLE']) { 
    402     $template['title'] = $_SERVER['SERVER_NAME']." FreePBX administration"; 
     402 
     403          // set the servername 
     404          $server_hostname = ''; 
     405                if (isset($_SESSION['session_hostname'])){ 
     406                        $server_hostname = $_SESSION['session_hostname']; 
     407                }else{ 
     408                        if (function_exists(gethostname)){ 
     409                                $server_hostname = trim(gethostname()); 
     410                        }else{ 
     411                                $server_hostname = trim(php_uname('n')); 
     412                        } 
     413                        if ($server_hostname != ''){ 
     414                                $server_hostname = ' (' . substr($server_hostname, 0, 30) . ')'; 
     415                        } 
     416                        $_SESSION['session_hostname'] = $server_hostname; 
     417                } 
     418 
     419    $template['title'] = $_SERVER['SERVER_NAME'] . $server_hostname . ' - FreePBX administration'; 
    403420  } else { 
    404421    $template['title'] = "FreePBX administration"; 
    405422  }