Subversion-Projekte lars-tiefland.ci

Revision

Revision 394 | Revision 396 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * @author Lars Tiefland
 * @copyright 2016
 */

function getPath($root, $return_locked_folders = false)
{
        $CI = &get_instance();
        $ini = $GLOBALS['INI'];
        $treeRoot = -1;
        if ($ini["treeRoot"])
        {
                $treeRoot = $ini["treeRoot"];
        }

        //check if memory table exsists
        $path = array();
        $father = $root;
        while ($father != -1 && !is_null($father))
        {
                $sql = "
            SELECT
                *
            FROM
                directory
            WHERE
                ID=$father
            AND
                language='".$ini["language"]."'
        ";
                $status_sql = "
            AND
                status=0
        ";
                if ($return_locked_folders === false)
                {
                        $sql .= $status_sql;
                }
                $res = $CI->db->query($sql);
                $row = $res->row_array();
                if (!is_array($row))
                {
                        return array();
                }
                $father = $row["Father"];
                foreach (array(
                        "",
                        "2",
                        "3") as $i)
                {
                        if ($row["bild_url".$i])
                        {
                                $row["bild_url".$i."_beurer"] = $ini['itemContainerKorrektur']["imagePath".$i].
                                        $row["bild_url".$i];
                                $row["bild_url".$i] = "<img src=".$ini['itemContainerKorrektur']["imagePath".$i].
                                        $row["bild_url".$i]." >";
                        }
                        else
                        {
                                $row["bild_url".$i] = "";
                        }
                }
                $path[] = $row;
        }
        $path = array_reverse($path);
        if ($path[0]["Father"] != $treeRoot)
        {
                unset($path[0]);
        }
        return $path;

}

    function str2url( $txt, $isFilename = false )
    {
        //$txt = strtolower( $txt );
        if ( (isset($_SESSION['charsett'])&&$_SESSION["charset"] == "utf-8") || ( isset( $GLOBALS["INI"]["dbConnect"]["db_is_utf8"] ) &&
            $GLOBALS["INI"]["dbConnect"]["db_is_utf8"] == 1 ) )
        {

            $txt = utf8_decode( $txt );

        }
        $txt = str_replace( "<br>", "", $txt );
        $txt = str_replace( "€", "EUR", $txt );
        $txt = str_replace( ":", "", $txt );
        $txt = str_replace( "®", "", $txt );
        $txt = str_replace( "–", "", $txt );
        $txt = str_replace( "\\", "-", $txt );
        $txt = str_replace( "²", "2", $txt );
        $txt = str_replace( "³", "3", $txt );
        $txt = str_replace( "°", "", $txt );
        $txt = str_replace( "*", "", $txt );
        $txt = str_replace( "Ä", "AE", $txt );
        $txt = str_replace( "ä", "ae", $txt );
        $txt = str_replace( "Ö", "OE", $txt );
        $txt = str_replace( "ö", "oe", $txt );
        $txt = str_replace( "Ü", "UE", $txt );
        $txt = str_replace( "ü", "ue", $txt );
        $txt = str_replace( "á", "a", $txt );
        $txt = str_replace( "Á", "A", $txt );
        $txt = str_replace( "à", "a", $txt );
        $txt = str_replace( "À", "A", $txt );
        $txt = str_replace( "â", "a", $txt );
        $txt = str_replace( "Â", "A", $txt );
        $txt = str_replace( "é", "e", $txt );
        $txt = str_replace( "É", "E", $txt );
        $txt = str_replace( "è", "e", $txt );
        $txt = str_replace( "È", "E", $txt );
        $txt = str_replace( "ê", "e", $txt );
        $txt = str_replace( "Ê", "E", $txt );
        $txt = str_replace( "ë", "e", $txt );
        $txt = str_replace( "Ë", "E", $txt );
        $txt = str_replace( "í", "i", $txt );
        $txt = str_replace( "Í", "I", $txt );
        $txt = str_replace( "ì", "i", $txt );
        $txt = str_replace( "Ì", "I", $txt );
        $txt = str_replace( "î", "i", $txt );
        $txt = str_replace( "Î", "I", $txt );
        $txt = str_replace( "ï", "i", $txt );
        $txt = str_replace( "ó", "o", $txt );
        $txt = str_replace( "Ó", "O", $txt );
        $txt = str_replace( "ò", "o", $txt );
        $txt = str_replace( "Ò", "O", $txt );
        $txt = str_replace( "ô", "o", $txt );
        $txt = str_replace( "Ô", "O", $txt );
        $txt = str_replace( "õ", "o", $txt );
        $txt = str_replace( "Õ", "O", $txt );
        $txt = str_replace( "Š", "S", $txt );
        $txt = str_replace( "Ú", "U", $txt );
        $txt = str_replace( "ú", "u", $txt );
        $txt = str_replace( " ", "-", $txt );
        $txt = str_replace( "'", "", $txt );
        $txt = str_replace( "!", "-", $txt );
        $txt = str_replace( "%", "", $txt );
        $txt = str_replace( "ß", "ss", $txt );
        $txt = str_replace( "@", "-", $txt );
        $txt = str_replace( "|", "", $txt );
        $txt = str_replace( "=", "-", $txt );
        $txt = str_replace( "+", "-", $txt );
        $txt = str_replace( "/", "-", $txt );

        if ( $isFilename === false )
        {
            $txt = str_replace( ".", "-", $txt );
        }
        $txt = preg_replace( "/[\(\)\"<94>´`',\/&\<\>#\s;\*<84><93>\?<99>\[\]]/", "-", $txt );
        $txt = preg_replace( "/-{2,}/", "-", $txt );
        //$txt = preg_replace( '/[^a-z0-9\-\.]/i', '', $txt );
        $txt = preg_replace( "/-$/", "", $txt );
        if ( (isset($_SESSION['charsett'])&&$_SESSION["charset"] == "utf-8") || ( isset( $GLOBALS["INI"]["dbConnect"]["db_is_utf8"] ) &&
            $GLOBALS["INI"]["dbConnect"]["db_is_utf8"] == 1 ) )
        {

            $txt = utf8_encode( $txt );

        }
        return $txt;
    }

?>