public function import_item($stream, $id)
 {
     switch ($id) {
         case 0x0:
         case 0x10:
             $host = $stream->read_str();
             $stream->read_str();
             // Linked URL: http://...
             $dir = $stream->read_str();
             $user = Utf8ToWin($stream->read_str());
             $pass = Utf8ToWin($stream->read_str());
             if (($id & 0x10) > 0) {
                 $is_ssh = $stream->read_dword();
             } else {
                 $is_ssh = 0;
             }
             $this->add_ftp(append_dir(ftp_force_ssh($host, $is_ssh == 1), $dir), $user, $pass);
             break;
         default:
             $this->log->add("ERR_UNKNOWN_ITEM_TYPE");
             return false;
     }
     return true;
 }
Beispiel #2
0
function append_port_dir($host, &$port, &$dir)
{
    return append_dir(append_port($host, $port), $dir);
}
/**
 * Full URL or folder from ROOT.
 */
function site_page($page, $url, $base = null)
{
    $first = @$page[0];
    if ($first === '#') {
        return $page;
    }
    if ($first === '/') {
        if (@$page[1] === '/') {
            return $page;
        }
        if ($base === null) {
            $base = PROTOCOL . DOMAIN;
        }
        return $base . $page;
    }
    if (preg_match('#^[a-z]+://#', $page) === 1) {
        return $page;
    }
    if ($url === null) {
        $url = URL;
    }
    return append_dir(URL, $page);
}