Example #1
0
function getThisUrl()
{
    $url = '';
    //vbdel start
    $url = serverVariables('server_name');
    //PHP版上面直接获得端口
    if (inStr($url, ':') == false) {
        $url = $url . getPort();
    }
    $url = $url . serverVariables('script_name');
    if (serverVariables('QUERY_STRING') != '') {
        $url = $url . '?' . serverVariables('QUERY_STRING');
    }
    //vbdel end
    $getThisUrl = 'http://' . $url;
    return @$getThisUrl;
}
 /**
  * Compare two urls to see whether they refer to the same file,
  * i.e., having the same protocol, host, port, and path.
  * This method requires that none of its arguments is null. This is
  * guaranteed by the fact that it is only called indirectly
  * by java.net.URL class.
  * @param u1 a URL object
  * @param u2 a URL object
  * @return boolean true if u1 and u2 refer to the same file
  * @since 1.3
  */
 public function sameFile(URL $u1, URL $u2)
 {
     // Compare the protocols.
     if (!($u1 . getProtocol() == $u2 . getProtocol() || $u1 . getProtocol() != null && $u1 . getProtocol() . equalsIgnoreCase($u2 . getProtocol()))) {
         return false;
     }
     // Compare the files.
     if (!($u1 . getFile() == $u2 . getFile() || $u1 . getFile() != null && $u1 . getFile() . equals($u2 . getFile()))) {
         return false;
     }
     // Compare the ports.
     $port1 = $u1 . getPort() != -1 ? $u1 . getPort() : $u1 . handler . getDefaultPort();
     $port2 = $u2 . getPort() != -1 ? $u2 . getPort() : $u2 . handler . getDefaultPort();
     if ($port1 != $port2) {
         return false;
     }
     // Compare the hosts.
     if (!$this->hostsEqual($u1, $u2)) {
         return false;
     }
     return true;
 }
Example #3
0
<?php

require_once 'demo.php';
$factoryMethod = getFactoryMethod($argv);
$text = file_get_contents('./data/where-love-is-there-god-is-also.txt');
//$text = file_get_contents('./data/war-and-peace.txt');
$ts = -microtime(true);
$cplt = \Mufuphlex\Cplt\Factory::$factoryMethod($text, getPort($argv));
echo "\n" . (microtime(true) + $ts) . " - done. Memory usage (current/peak), Kb: " . memory_get_usage(true) . ' / ' . memory_get_peak_usage(true) . "\n";
$cplt->run();
Example #4
0
/**
 * 获取主机路径,兼容多层目录
 */
function getHostInfo()
{
    $phpself = getScriptUrl();
    $installPath = substr($phpself, 0, strrpos($phpself, '/'));
    $sitePath = str_replace('/install', '', $installPath);
    $isHTTPS = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? true : false;
    if ($secure = getIsSecureConnection()) {
        $http = 'https';
    } else {
        $http = 'http';
    }
    if (isset($_SERVER['HTTP_HOST'])) {
        $hostInfo = $http . '://' . $_SERVER['HTTP_HOST'];
    } else {
        $hostInfo = $http . '://' . $_SERVER['SERVER_NAME'];
        $port = $secure ? getSecurePort() : getPort();
        if ($port !== 80 && !$secure || $port !== 443 && $secure) {
            $hostInfo .= ':' . $port;
        }
    }
    $siteurl = $hostInfo . $sitePath;
    return $siteurl;
}
Example #5
0
    $locationID = $_POST["locationID"];
    getLocationByID($locationID, $mysqli);
}
if ($functionname == 'delLocation') {
    $locationID = $_POST["locationID"];
    delLocation($locationID, $mysqli);
}
/*Port*/
if ($functionname == 'setPort') {
    $portID = $_POST["portID"];
    $portName = $_POST["portName"];
    $portLocationID = $_POST["portLocationID"];
    setPort($portID, $portName, $portLocationID, $mysqli);
}
if ($functionname == 'getPort') {
    getPort($mysqli);
}
if ($functionname == 'getPortByID') {
    $portID = $_POST["portID"];
    getPortByID($portID, $mysqli);
}
if ($functionname == 'delPort') {
    $portID = $_POST["portID"];
    delPort($portID, $mysqli);
}
/*Terminal*/
if ($functionname == 'setTerminal') {
    $terminalID = $_POST["terminalID"];
    $terminalName = $_POST["terminalName"];
    $terminalPortID = $_POST["terminalPortID"];
    setTerminal($terminalID, $terminalName, $terminalPortID, $mysqli);