Gibt die URL zum Verzeichnis zurück

das root Verzeichnis muss angegeben werden
URL hat keinen Trailingslash! aber einen slash davor
18078
public function getURL(Dir $relativeDir = NULL) {
    if (!isset($relativeDir)) $relativeDir = new Dir('.'.DIRECTORY_SEPARATOR);
    
    $rel = clone $this;
    $rel->makeRelativeTo($relativeDir);
    $pa = $rel->getPathArray();
    unset($pa[0]);
    
    return '/'.implode('/',array_map('rawurlencode',$pa)); 
  }
836942
public static function get_blacklist( )
    {
        $arrBlacklist = array();                // Default: alle Datentabellen werden gesichert

        if( isset( $GLOBALS['TL_CONFIG']['backupdb_blacklist'] ) && (trim($GLOBALS['TL_CONFIG']['backupdb_blacklist']) != '') ) {
            $arrBlacklist = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['backupdb_blacklist']));
        }

        return $arrBlacklist;
    }
405080
private static URL stripTrailingSlash(URL url) {
        String externalForm = url.toExternalForm();
        if (externalForm.endsWith("/")) {
            externalForm = externalForm.substring(0, externalForm.length() - 1);
            try {
                url = new URL(externalForm);
            } catch (MalformedURLException e) {
                // will never happen.
            }
        }
        return url;
    }
815252
function url(s) {
  // http://www.w3.org/TR/css3-values/#uris
  // Parentheses, commas, whitespace characters, single quotes (') and double
  // quotes (") appearing in a URI must be escaped with a backslash
  var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1');
  // WebKit has a bug when it comes to URLs that end with \
  // https://bugs.webkit.org/show_bug.cgi?id=28885
  if (/\\\\$/.test(s2)) {
    // Add a space to work around the WebKit bug.
    s2 += ' ';
  }
  return 'url("' + s2 + '")';
}
793810
function (url) {
                if (!url)
                    return "";

                var urlParts = url.split("/"),
                    newPath = "";

                for (var i = 0, len = urlParts.length; i < len; i++) {
                    var part = urlParts[i];

                    if (!part || part.length === 0
                        || part.indexOf(":") != -1
                        || part === "."
                        || part === ".."
                        || part === "null"
                        || part === "undefined") {
                        continue;
                    }

                    if (newPath.length !== 0) {
                        newPath = newPath + "/";
                    }

                    newPath = newPath + part;
                }

                return newPath;
            }
1179256
public function run()
	{
		// Input a digit >0 ?
		if ( 0 == (int)$this->intBID )
		{
		    if ( 0 == (int)$this->intDEFBID ) 
		    {
		        header('HTTP/1.1 501 Not Implemented');
		    	throw new \ErrorException('Invalid Banner ID (' . \Input::get('bid') . ')',2,1,basename(__FILE__),__LINE__);
		    }
		}

		//Banner oder Kategorie Banner (Default Banner)
		if ( 0 < (int)$this->intBID ) 
		{
			//normaler Banner
			$banner_not_viewed = false;
    		// Check whether the Banner ID exists
    		$objBanners = \Database::getInstance()
                                ->prepare("SELECT 
                                                tb.id
                                              , tb.banner_url
                                              , tb.banner_jumpTo
                                              , tbs.banner_clicks
                                           FROM 
                                                tl_banner tb
                                              , tl_banner_stat tbs
                                           WHERE 
                                                tb.id=tbs.id 
                                           AND 
                                                tb.id=?")
                                ->execute($this->intBID);
    		
    		if (!$objBanners->next()) 
    		{
    			$objBanners = \Database::getInstance()
                                    ->prepare("SELECT 
                                                    tb.id
                                                  , tb.banner_url
                                                  , tb.banner_jumpTo
                                               FROM 
                                                    tl_banner tb
                                               WHERE 
                                                    tb.id=?")
                                    ->execute($this->intBID);
	    		
	    		if (!$objBanners->next()) 
	    		{
	    			header('HTTP/1.1 501 Not Implemented');
	    			throw new \ErrorException('Banner ID not found',2,1,basename(__FILE__),__LINE__);
	    		} 
	    		else 
	    		{
	    			$banner_not_viewed = true;
	    		}
    		}
    		
			$banner_stat_update = false;
		    if ($this->checkUserAgent()       === false 
		     && $this->checkBot()             === false 
		     && $this->getSetReClickBlocker() === false
		       ) 
		    { 
		    	// keine User Agent Filterung
		    	// kein Bot
		    	// kein ReClick 
		    	$banner_stat_update = true;
		    }
		    
		    if ($banner_stat_update === true) 
		    {
                if ($banner_not_viewed === false) 
                {
                	//Update
                	$tstamp = time();
	                $banner_clicks = $objBanners->banner_clicks + 1;
	                \Database::getInstance()->prepare("UPDATE 
                                                            tl_banner_stat 
                                                       SET 
                                                            tstamp=?
                                                          , banner_clicks=? 
                                                       WHERE 
                                                            id=?")
                                            ->executeUncached($tstamp, $banner_clicks, $this->intBID);
    			} 
    			else 
    			{
    				//Insert
    				 $arrSet = array
		            (
		                'id'     => $this->intBID,
		                'tstamp' => time(),
		                'banner_clicks' => 1
		            );
				    \Database::getInstance()->prepare("INSERT IGNORE INTO tl_banner_stat %s")
                                            ->set($arrSet)
                                            ->execute();
    			}
		    }
    		
    		//Banner Ziel per Page?
            if ($objBanners->banner_jumpTo >0) 
            {
            	//url generieren
            	$objBannerNextPage = \Database::getInstance()
                                            ->prepare("SELECT 
                                                            id
                                                          , alias 
                                                       FROM 
                                                            tl_page 
                                                       WHERE 
                                                            id=?")
                                            ->limit(1)
                                            ->execute($objBanners->banner_jumpTo);
            	
            	if ($objBannerNextPage->numRows)
            	{
           	        $objPage = \PageModel::findWithDetails($objBanners->banner_jumpTo); 
                    $objBanners->banner_url = \Controller::generateFrontendUrl($objBannerNextPage->fetchAssoc(),
                                                                               null,
                                                                               $objPage->rootLanguage);
            	} 
            }
            $banner_redirect = $this->getRedirectType($this->intBID);
        } 
        else 
        {
            // Default Banner from Category
            // Check whether the Banner ID exists
    		$objBanners = \Database::getInstance()
                                ->prepare("SELECT 
                                                id
                                              , banner_default_url AS banner_url
                                           FROM 
                                                tl_banner_category
                                           WHERE 
                                                id=?")
                                ->execute($this->intDEFBID);
    		
            if (!$objBanners->next()) 
            {
                header('HTTP/1.1 501 Not Implemented');
            	throw new \ErrorException('Default Banner ID not found',2,1,basename(__FILE__),__LINE__);
            }
            $banner_redirect = '303';
        }

		$banner_url = ampersand($objBanners->banner_url);
		// 301 Moved Permanently
		// 302 Found
		// 303 See Other
		// 307 Temporary Redirect (ab Contao 3.1)
		$this->redirect($banner_url, $banner_redirect); 
	}
1250926
function(str) {
            var root, error = null;

            i = j = current = 0;
            chunks = [];
            input = str.replace(/\r\n/g, '\n');
            if (env.filename) {
                that.env.inputs[env.filename] = input;
            }

            // Split the input into chunks.
            chunks = (function (chunks) {
                var j = 0,
                    skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
                    comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
                    string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
                    level = 0,
                    match,
                    chunk = chunks[0],
                    inParam;

                for (var i = 0, c, cc; i < input.length;) {
                    skip.lastIndex = i;
                    match = skip.exec(input);
                    if (match) {
                        if (match.index === i) {
                            i += match[0].length;
                            chunk.push(match[0]);
                        }
                    }
                    c = input.charAt(i);
                    comment.lastIndex = string.lastIndex = i;

                    match = string.exec(input)
                    if (match) {
                        if (match.index === i) {
                            i += match[0].length;
                            chunk.push(match[0]);
                            continue;
                        }
                    }

                    if (!inParam && c === '/') {
                        cc = input.charAt(i + 1);
                        if (cc === '/' || cc === '*') {
                            match = comment.exec(input);
                            if (match) {
                                if (match.index === i) {
                                    i += match[0].length;
                                    chunk.push(match[0]);
                                    continue;
                                }
                            }
                        }
                    }

                    switch (c) {
                        case '{':
                            if (!inParam) {
                                level ++;
                            }
                            else {
                                inParam = false;
                            }
                            chunk.push(c);
                            break;
                        case '}':
                            if (!inParam) {
                                level --;
                                chunk.push(c);
                                chunks[++j] = chunk = [];
                            }
                            else {
                                inParam = false;
                                chunk.push(c);
                            }
                            break;
                        case '(':
                            if (!inParam) {
                                inParam = true;
                            }
                            else {
                                inParam = false;
                            }
                            chunk.push(c);
                            break;
                        case ')':
                            if (inParam) {
                                inParam = false;
                            }
                            chunk.push(c);
                            break;
                        default:
                            chunk.push(c);
                    }

                    i++;
                }
                if (level !== 0) {
                    error = {
                        index: i - 1,
                        message: (level > 0) ? "missing closing `}`" : "missing opening `{`",
                        filename: env.filename
                    };
                }

                return chunks.map(function (c) { return c.join(''); });
            })([[]]);

            if (error) {
                util.error(env, error);
                throw new Error('N/A');
            }

            // Start with the primary rule.
            // The whole syntax tree is held under a Ruleset node,
            // with the `root` property set to true, so no `{}` are
            // output.
            root = new tree.Ruleset([], $(this.parsers.primary));
            root.root = true;

            // Get an array of Ruleset objects, flattened
            // and sorted according to specificitySort
            root.toList = (function() {
                return function(env) {
                    env.frames = env.frames || [];


                    // call populates Invalid-caused errors
                    var definitions = this.flatten([], [], env);
                    definitions.sort(specificitySort);
                    return definitions;
                };
            })();

            // Sort rules by specificity: this function expects selectors to be
            // split already.
            //
            // Written to be used as a .sort(Function);
            // argument.
            //
            // [1, 0, 0, 467] > [0, 0, 1, 520]
            var specificitySort = function(a, b) {
                var as = a.specificity;
                var bs = b.specificity;

                if (as[0] != bs[0]) return bs[0] - as[0];
                if (as[1] != bs[1]) return bs[1] - as[1];
                if (as[2] != bs[2]) return bs[2] - as[2];
                return bs[3] - as[3];
            };

            return root;
        }
444491
public function callbackSubmit()
    {

        $email       = $this->form->value("email");
        $password    = $this->form->value("password");

        $user = new User();
        $user->setDb($this->di->get("db"));
        $res = $user->verifyPassword($email, $password);

        if (!$res) {
            $this->form->rememberValues();
            $this->form->addOutput("Användarnamnet eller lösenordet stämmer inte överens.", "flash");

            return false;
        }

        if (!$user->isActive($email)) {
            $this->form->addOutput("Kontot är inte aktiverat.", "flash");
            return false;
        }

        $this->di->get("session")->set("user", $user->email);
        $this->di->get("session")->set("userid", $user->id);


        $this->di->get("response")->redirect("user");
        return true;
    }
83280
static public function RemoveEscapes( $name ) {

	    // alle Anführungszeichen entfernen, wenn sie am Anfang und am Ende auftauchen

	    $name = trim( $name );

	    $chr_start = substr( $name, 0, 1 );

	    if ( $chr_start == '"' ) {

		if ( substr( $name, -1, 1 ) == '"' ) {

		    $name = substr( $name, 1, strlen( $name ) - 2  );

		}

	    } elseif ( $chr_start == "'" ) {

		if ( substr( $name, -1, 1 ) == "'" ) {

		    $name = substr( $name, 1, strlen( $name ) - 2  );

		}


	    } elseif ( $chr_start == '`' ) {


		if ( substr( $name, -1, 1 ) == '`' ) {

		    $name = substr( $name, 1, strlen( $name ) - 2  );

		}


	    }

/*
	    if ( ( substr( $name, 0, 1 ) == '"' ) || ( substr( $name, 0, 1 ) == "'" ) ) {
		if ( ( substr( $name, strlen( $name ) - 1, 1 ) == '"' ) || ( substr( $name, strlen( $name) -1 , 1 ) == "'" ) ) {

		    $name = substr( $name, 1 );
		    $name = substr( $name, 0, strlen( $name) - 1 );

		}
	    }
*/

	    return trim( $name );

	}
1213527
function getUrlVars(string) {
  var vars = [],
    hash,
    hashes,
    str = string.toString();

  if (str.match('&#038;')) {
    str = str.replace("&#038;", "&");
  } else if (str.match('&#38;')) {
    str = str.replace("&#38;", "&");
  } else if (str.match('&amp;')) {
    str = str.replace("&amp;", "&");
  }
  if (str.match('#')) {
    str = str.split('#')[0];
  }
  hashes = str.slice(str.indexOf('?') + 1).split('&');

  for(var i = 0; i < hashes.length; i++) {
    hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
  }

  return vars;
}
553452
function(){
		/* "ものを動かしたように描画する"でなければinputLineと同じ */
		if(this.puzzle.execConfig('dispmove')){
			this.inputMoveLine();
			return;
		}
		
		var pos, border;
		if(!this.board.borderAsLine){
			pos = this.getpos(0);
			if(this.prevPos.equals(pos)){ return;}
			border = this.prevPos.getnb(pos);
		}
		else{
			pos = this.getpos(0.35);
			if(this.prevPos.equals(pos)){ return;}
			border = this.prevPos.getborderobj(pos);
		}
		
		if(!border.isnull){
			if(this.inputData===null){ this.inputData=(border.isLine()?0:1);}
			if     (this.inputData===1){ border.setLine();}
			else if(this.inputData===0){ border.removeLine();}
			border.draw();
		}
		this.prevPos = pos;
	}
880210
@SuppressWarnings("unchecked")
    public synchronized void themenLaden() {
        Duration.counterStart(THEME_SEARCH_TEXT);
        LinkedHashSet<String> senderSet = new LinkedHashSet<>(21);
        // der erste Sender ist ""
        senderSet.add("");

        for (DatenFilm film : this) {
            senderSet.add(film.arr[DatenFilm.FILM_SENDER]);
        }
        sender = senderSet.toArray(new String[senderSet.size()]);
        senderSet.clear();

        //für den Sender "" sind alle Themen im themenPerSender[0]
        final int senderLength = sender.length;
        themenPerSender = new String[senderLength][];
        TreeSet<String>[] tree = (TreeSet<String>[]) new TreeSet<?>[senderLength];
        HashSet<String>[] hashSet = (HashSet<String>[]) new HashSet<?>[senderLength];
        for (int i = 0; i < tree.length; ++i) {
            tree[i] = new TreeSet<>(de.mediathekview.mlib.tool.GermanStringSorter.getInstance());
            tree[i].add("");
            hashSet[i] = new HashSet<>();
        }

        //alle Themen
        String filmThema, filmSender;
        for (DatenFilm film : this) {
            filmSender = film.arr[DatenFilm.FILM_SENDER];
            filmThema = film.arr[DatenFilm.FILM_THEMA];
            //hinzufügen
            if (!hashSet[0].contains(filmThema)) {
                hashSet[0].add(filmThema);
                tree[0].add(filmThema);
            }
            for (int i = 1; i < senderLength; ++i) {
                if (filmSender.equals(sender[i])) {
                    if (!hashSet[i].contains(filmThema)) {
                        hashSet[i].add(filmThema);
                        tree[i].add(filmThema);
                    }
                }
            }
        }
        for (int i = 0; i < themenPerSender.length; ++i) {
            themenPerSender[i] = tree[i].toArray(new String[tree[i].size()]);
            tree[i].clear();
            hashSet[i].clear();
        }
        Duration.counterStop(THEME_SEARCH_TEXT);
    }
619802
function(url) {

         var parts = url.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/);
         var result = {
             url : parts[0],
             scheme : parts[1],
             host : parts[3],
             port : parts[4],
             path : parts[5],
             query : parts[6],
             fragment : parts[7],
         };
         result.root =
            result.scheme + '://' +
            result.host +
            (result.port ? ':' + result.port : '');

         return result;

    }
450998
public function make($options=NULL) {
    if (is_int($options)) {
      $parent = ($options & self::PARENT) == self::PARENT;
      $assert = ($options & self::ASSERT_EXISTS) == self::ASSERT_EXISTS;
    } else {
      // legacy option
      $parent = (mb_strpos($options,'-p') !== FALSE);
      $assert = FALSE;
    }
      
    if (!$this->exists()) {
      $ret = @mkdir((string) $this, $this->getDefaultMod(), $parent);
      if ($ret == FALSE) {
        throw new Exception('Fehler beim erstellen des Verzeichnisses: '.$this);
      }
    } else {
      if (!$assert) {
        throw new Exception('Verzeichnis '.$this.' kann nicht erstellt werden, da es schon existiert');
      }
    }

    return $this;
  }
1132077
public boolean propagateValue(String destPath, String value, boolean tryToCreate, boolean allowOverwrite) {
        boolean ret = false;

        if (destPath.equals(getPath())) {
            if (value != null && value.equals("requested"))
                this.haveRequestTag = true;
            else
                throw new HBCI_Exception(HBCIUtils.getLocMsg("EXCMSG_INVVALUE", new Object[]{destPath, value}));
            ret = true;
        } else {
            // damit überspringen wir gleich elemente, bei denen es mit
            // sicherheit nicht funktionieren kann
            if (destPath.startsWith(getPath())) {
                for (MultipleSyntaxElements l : childContainers) {
                    if (l.propagateValue(destPath, value, tryToCreate, allowOverwrite)) {
                        ret = true;
                        break;
                    }
                }

                if (!ret && tryToCreate) {
                    // der Wert konnte nicht gesetzt werden -> möglicherweise
                    // existiert ja nur der entsprechende child-container noch
                    // nicht
                    log.trace(getPath() + ": could not set value for " + destPath);

                    // Namen des fehlenden Elementes ermitteln
                    String subPath = destPath.substring(getPath().length() + 1);
                    log.trace("  subpath is " + subPath);
                    int dotPos = subPath.indexOf('.');
                    if (dotPos == -1) {
                        dotPos = subPath.length();
                    }
                    String subType = subPath.substring(0, dotPos);
                    log.trace("  subname is " + subType);
                    int counterPos = subType.indexOf('_');
                    if (counterPos != -1) {
                        subType = subType.substring(0, counterPos);
                    }
                    log.trace("  subType is " + subType);

                    // hier überprüfen, ob es wirklich noch keinen child-container
                    // mit diesem Namen gibt. Wenn z.B. der pfad msg.gv.ueb.kik.blz
                    // gesucht wird und msg.gv schon existiert, wird diese methode
                    // hier in msg.gv ausgeführt. wenn sie fehlschlägt (z.b. weil
                    // tatsächlich kein .ueb.kik.blz angelegt werden kann), wird false
                    // ("can not propagate") zurückgegeben. im übergeordneten modul
                    // (msg) soll dann nicht versucht werden, das nächste sub-element
                    // (gv) anzulegen - dieser test merkt, dass es "gv" schon gibt
                    boolean found = false;
                    for (MultipleSyntaxElements c : childContainers) {
                        if (c.getName().equals(subType)) {
                            found = true;
                            break;
                        }
                    }

                    if (!found) {
                        // jetzt durch alle child-elemente des definierenden XML-Knotens
                        // loopen und den ref-Knoten suchen, der das fehlende Element
                        // beschreibt
                        int newChildIdx = 0;
                        Node ref;
                        found = false;
                        for (ref = def.getFirstChild(); ref != null; ref = ref.getNextSibling()) {
                            if (ref.getNodeType() == Node.ELEMENT_NODE) {
                                String type = ((Element) ref).getAttribute("type");
                                String name = ((Element) ref).getAttribute("name");
                                if (name.length() == 0) {
                                    name = type;
                                }
                                if (name.equals(subType)) {
                                    found = true;
                                    break;
                                }
                                newChildIdx++;
                            }
                        }

                        if (found) {
                            // entsprechenden child-container erzeugen
                            MultipleSyntaxElements child = createNewChildContainer(ref, document);
                            child.setParent(this);
                            child.setSyntaxIdx(newChildIdx);

                            if (getElementTypeName().equals("MSG"))
                                log.trace("child container " + child.getPath() + " has syntaxIdx=" + child.getSyntaxIdx());

                            // aktuelle child-container-liste durchlaufen und den neu
                            // erzeugten child-container dort richtig einsortieren
                            int newPosi = 0;
                            for (MultipleSyntaxElements c : childContainers) {
                                if (c.getSyntaxIdx() > newChildIdx) {
                                    // der gerade betrachtete child-container hat einen idx
                                    // gröÃer als den des einzufügenden elementes, also wird
                                    // sich diese position gemerkt und das element hier eingefügt
                                    break;
                                }
                                newPosi++;
                            }
                            log.trace("  inserting child container with syntaxIdx " + newChildIdx + " at position " + newPosi);
                            childContainers.add(newPosi, child);

                            // now try to propagate the value to the newly created child
                            ret = child.propagateValue(destPath, value, tryToCreate, allowOverwrite);
                        }
                    } else {
                        log.trace("  subtype " + subType + " already existing - will not try to create");
                    }
                }
            }
        }

        return ret;
    }
136693
public function getPath($path, $flags = 0x000000) {
    if (($flags & self::RELATIVE) === self::RELATIVE) {
      $path = $this->dir.ltrim($path,'\\/');
    }
    
    if (($flags & self::VALIDATE) === self::VALIDATE) {
      if (($rPath = realpath($path)) !== FALSE) {
        $path = $rPath;
      } else {
        throw new Exception('Pfad: '.$path.' konnte nicht gefunden werden',self::VALIDATE);
      }
    }
    
    return $this->ts($path);
  }
1331002
def _url_chunk_join(self, *args):
        """"""
        # Strip slashes from either side of each path piece.
        pathlets = map(lambda s: s.strip('/'), args)
        # Remove empty pieces.
        pathlets = filter(None, pathlets)
        url = '/'.join(pathlets)
        # If this is a directory, add a trailing slash.
        if args[-1].endswith('/'):
            url = '%s/' % url
        return url