| 755 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* @author Lars Tiefland
|
|
|
5 |
* @copyright 2016
|
|
|
6 |
*/
|
|
|
7 |
|
|
|
8 |
function getPath($root, $return_locked_folders = false)
|
|
|
9 |
{
|
|
|
10 |
$CI = &get_instance();
|
|
|
11 |
$ini = $GLOBALS['INI'];
|
|
|
12 |
$treeRoot = -1;
|
|
|
13 |
if ($ini["treeRoot"])
|
|
|
14 |
{
|
|
|
15 |
$treeRoot = $ini["treeRoot"];
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
//check if memory table exsists
|
|
|
19 |
$path = array();
|
|
|
20 |
$father = $root;
|
|
|
21 |
while ($father != -1 && !is_null($father))
|
|
|
22 |
{
|
|
|
23 |
$sql = "
|
|
|
24 |
SELECT
|
|
|
25 |
*
|
|
|
26 |
FROM
|
|
|
27 |
directory
|
|
|
28 |
WHERE
|
|
|
29 |
ID=$father
|
|
|
30 |
AND
|
|
|
31 |
language='".$ini["language"]."'
|
|
|
32 |
";
|
|
|
33 |
$status_sql = "
|
|
|
34 |
AND
|
|
|
35 |
status=0
|
|
|
36 |
";
|
|
|
37 |
if ($return_locked_folders === false)
|
|
|
38 |
{
|
|
|
39 |
$sql .= $status_sql;
|
|
|
40 |
}
|
|
|
41 |
$res = $CI->db->query($sql);
|
|
|
42 |
$row = $res->row_array();
|
|
|
43 |
if (!is_array($row))
|
|
|
44 |
{
|
|
|
45 |
return array();
|
|
|
46 |
}
|
|
|
47 |
$father = $row["Father"];
|
|
|
48 |
foreach (array(
|
|
|
49 |
"",
|
|
|
50 |
"2",
|
|
|
51 |
"3") as $i)
|
|
|
52 |
{
|
|
|
53 |
if ($row["bild_url".$i])
|
|
|
54 |
{
|
|
|
55 |
$row["bild_url".$i."_beurer"] = $ini['itemContainerKorrektur']["imagePath".$i].
|
|
|
56 |
$row["bild_url".$i];
|
|
|
57 |
$row["bild_url".$i] = "<img src=".$ini['itemContainerKorrektur']["imagePath".$i].
|
|
|
58 |
$row["bild_url".$i]." >";
|
|
|
59 |
}
|
|
|
60 |
else
|
|
|
61 |
{
|
|
|
62 |
$row["bild_url".$i] = "";
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
$path[] = $row;
|
|
|
66 |
}
|
|
|
67 |
$path = array_reverse($path);
|
|
|
68 |
if ($path[0]["Father"] != $treeRoot)
|
|
|
69 |
{
|
|
|
70 |
unset($path[0]);
|
|
|
71 |
}
|
|
|
72 |
return $path;
|
|
|
73 |
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
function str2url( $txt, $isFilename = false )
|
|
|
77 |
{
|
|
|
78 |
//$txt = strtolower( $txt );
|
|
|
79 |
if ( (isset($_SESSION['charsett'])&&$_SESSION["charset"] == "utf-8") || ( isset( $GLOBALS["INI"]["dbConnect"]["db_is_utf8"] ) &&
|
|
|
80 |
$GLOBALS["INI"]["dbConnect"]["db_is_utf8"] == 1 ) )
|
|
|
81 |
{
|
|
|
82 |
|
|
|
83 |
$txt = utf8_decode( $txt );
|
|
|
84 |
|
|
|
85 |
}
|
|
|
86 |
$txt = str_replace( "<br>", "", $txt );
|
|
|
87 |
$txt = str_replace( "€", "EUR", $txt );
|
|
|
88 |
$txt = str_replace( ":", "", $txt );
|
|
|
89 |
$txt = str_replace( "®", "", $txt );
|
|
|
90 |
$txt = str_replace( "–", "", $txt );
|
|
|
91 |
$txt = str_replace( "\\", "-", $txt );
|
|
|
92 |
$txt = str_replace( "²", "2", $txt );
|
|
|
93 |
$txt = str_replace( "³", "3", $txt );
|
|
|
94 |
$txt = str_replace( "°", "", $txt );
|
|
|
95 |
$txt = str_replace( "*", "", $txt );
|
|
|
96 |
$txt = str_replace( "Ä", "AE", $txt );
|
|
|
97 |
$txt = str_replace( "ä", "ae", $txt );
|
|
|
98 |
$txt = str_replace( "Ö", "OE", $txt );
|
|
|
99 |
$txt = str_replace( "ö", "oe", $txt );
|
|
|
100 |
$txt = str_replace( "Ü", "UE", $txt );
|
|
|
101 |
$txt = str_replace( "ü", "ue", $txt );
|
|
|
102 |
$txt = str_replace( "á", "a", $txt );
|
|
|
103 |
$txt = str_replace( "Á", "A", $txt );
|
|
|
104 |
$txt = str_replace( "à", "a", $txt );
|
|
|
105 |
$txt = str_replace( "À", "A", $txt );
|
|
|
106 |
$txt = str_replace( "â", "a", $txt );
|
|
|
107 |
$txt = str_replace( "Â", "A", $txt );
|
|
|
108 |
$txt = str_replace( "é", "e", $txt );
|
|
|
109 |
$txt = str_replace( "É", "E", $txt );
|
|
|
110 |
$txt = str_replace( "è", "e", $txt );
|
|
|
111 |
$txt = str_replace( "È", "E", $txt );
|
|
|
112 |
$txt = str_replace( "ê", "e", $txt );
|
|
|
113 |
$txt = str_replace( "Ê", "E", $txt );
|
|
|
114 |
$txt = str_replace( "ë", "e", $txt );
|
|
|
115 |
$txt = str_replace( "Ë", "E", $txt );
|
|
|
116 |
$txt = str_replace( "í", "i", $txt );
|
|
|
117 |
$txt = str_replace( "Í", "I", $txt );
|
|
|
118 |
$txt = str_replace( "ì", "i", $txt );
|
|
|
119 |
$txt = str_replace( "Ì", "I", $txt );
|
|
|
120 |
$txt = str_replace( "î", "i", $txt );
|
|
|
121 |
$txt = str_replace( "Î", "I", $txt );
|
|
|
122 |
$txt = str_replace( "ï", "i", $txt );
|
|
|
123 |
$txt = str_replace( "ó", "o", $txt );
|
|
|
124 |
$txt = str_replace( "Ó", "O", $txt );
|
|
|
125 |
$txt = str_replace( "ò", "o", $txt );
|
|
|
126 |
$txt = str_replace( "Ò", "O", $txt );
|
|
|
127 |
$txt = str_replace( "ô", "o", $txt );
|
|
|
128 |
$txt = str_replace( "Ô", "O", $txt );
|
|
|
129 |
$txt = str_replace( "õ", "o", $txt );
|
|
|
130 |
$txt = str_replace( "Õ", "O", $txt );
|
|
|
131 |
$txt = str_replace( "Š", "S", $txt );
|
|
|
132 |
$txt = str_replace( "Ú", "U", $txt );
|
|
|
133 |
$txt = str_replace( "ú", "u", $txt );
|
|
|
134 |
$txt = str_replace( " ", "-", $txt );
|
|
|
135 |
$txt = str_replace( "'", "", $txt );
|
|
|
136 |
$txt = str_replace( "!", "-", $txt );
|
|
|
137 |
$txt = str_replace( "%", "", $txt );
|
|
|
138 |
$txt = str_replace( "ß", "ss", $txt );
|
|
|
139 |
$txt = str_replace( "@", "-", $txt );
|
|
|
140 |
$txt = str_replace( "|", "", $txt );
|
|
|
141 |
$txt = str_replace( "=", "-", $txt );
|
|
|
142 |
$txt = str_replace( "+", "-", $txt );
|
|
|
143 |
$txt = str_replace( "/", "-", $txt );
|
|
|
144 |
|
|
|
145 |
if ( $isFilename === false )
|
|
|
146 |
{
|
|
|
147 |
$txt = str_replace( ".", "-", $txt );
|
|
|
148 |
}
|
|
|
149 |
$txt = preg_replace( "/[\(\)\"”´`',\/&\<\>#\s;\*„“\?™\[\]]/", "-", $txt );
|
|
|
150 |
$txt = preg_replace( "/-{2,}/", "-", $txt );
|
|
|
151 |
$txt = preg_replace( '/[^a-z0-9-.]/i', '', $txt );
|
|
|
152 |
$txt = preg_replace( "/-$/", "", $txt );
|
|
|
153 |
if ( (isset($_SESSION['charsett'])&&$_SESSION["charset"] == "utf-8") || ( isset( $GLOBALS["INI"]["dbConnect"]["db_is_utf8"] ) &&
|
|
|
154 |
$GLOBALS["INI"]["dbConnect"]["db_is_utf8"] == 1 ) )
|
|
|
155 |
{
|
|
|
156 |
|
|
|
157 |
$txt = utf8_encode( $txt );
|
|
|
158 |
|
|
|
159 |
}
|
|
|
160 |
return $txt;
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
?>
|