Example #1
0
function fixup_string($string)
{
    global $config;
    // fixup #1: $myurl -> http[s]://ip_address:port/
    $https = "";
    $port = $config['system']['webguiport'];
    if ($port != "443" and $port != "80") {
        $urlport = ":" . $port;
    } else {
        $urlport = "";
    }
    if ($config['system']['webguiproto'] == "https") {
        $https = "s";
    }
    $myurl = "http" . $https . "://" . getenv("HTTP_HOST") . $urlport;
    $newstring = str_replace("\$myurl", $myurl, $string);
    $string = $newstring;
    // fixup #2: $wanip
    $curwanip = get_current_wan_address();
    $newstring = str_replace("\$wanip", $curwanip, $string);
    $string = $newstring;
    // fixup #3: $lanip
    $lancfg = $config['interfaces']['lan'];
    $lanip = $lancfg['ipaddr'];
    $newstring = str_replace("\$lanip", $lanip, $string);
    $string = $newstring;
    // fixup #4: fix'r'up here.
    return $newstring;
}
					<?php 
    echo $textss . $backend['desc'] . $textse;
    ?>
                  </td>
                  <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?php 
    echo $i;
    ?>
';">
<?php 
    echo $textss;
    if ($backend['extaddr'] == "any") {
        echo "0.0.0.0";
    } elseif ($backend['extaddr']) {
        echo $backend['extaddr'];
    } else {
        echo get_current_wan_address('wan');
    }
    echo ":" . $backend['port'];
    echo $textse;
    ?>
                  </td>
                  <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?php 
    echo $i;
    ?>
';">
					<?php 
    echo $textss . $backend['type'] . $textse;
    ?>
                  </td>
                  <td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?php 
    echo $i;
Example #3
0
function fixup_string($string)
{
    global $config, $myurl;
    $newstring = $string;
    // fixup #1: $myurl -> http[s]://ip_address:port/
    switch ($config['system']['webguiproto']) {
        case "http":
            $proto = "http";
            break;
        case "https":
            $proto = "https";
            break;
        default:
            $proto = "http";
            break;
    }
    $port = $config['system']['webguiport'];
    if ($port != "") {
        if ($port == "443" and $proto != "https" or $port == "80" and $proto != "http") {
            $urlport = ":" . $port;
        } elseif ($port != "80" and $port != "443") {
            $urlport = ":" . $port;
        } else {
            $urlport = "";
        }
    }
    $myurl = $proto . "://" . $config['interfaces']['lan']['ipaddr'] . $urlport . "/";
    $newstring = str_replace("\$myurl", $myurl, $newstring);
    // fixup #2: $wanip
    $curwanip = get_current_wan_address();
    $newstring = str_replace("\$wanip", $curwanip, $newstring);
    // fixup #3: $lanip
    $lanip = $config['interfaces']['lan']['ipaddr'];
    $newstring = str_replace("\$lanip", $lanip, $newstring);
    // fixup #4: fix'r'up here.
    return $newstring;
}