Subversion-Projekte lars-tiefland.ci

Revision

Revision 2071 | Revision 2118 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 2071 Revision 2072
Zeile 1... Zeile 1...
1
<?php
1
<?php
Zeile 2... Zeile 2...
2
 
2
 
3
// $Id: weban_helper.php 713 2016-09-29 17:39:30Z lars $
3
// $Id: weban_helper.php 713 2016-09-29 17:39:30Z lars $
4
setlocale(LC_TIME, "de_DE.UTF-8");
4
setlocale(LC_TIME, "de_DE.UTF-8");
5
$GLOBALS['ci'] = &get_instance();
-
 
6
$GLOBALS["ci"]->load->library('smartie',null,'smarty');
-
 
7
$GLOBALS["ci"]->load->library('session');
-
 
8
$GLOBALS["ci"]->load->library('database');
-
 
9
$GLOBALS["ci"]->load->library('i18n');
-
 
10
$GLOBALS["ci"]->load->library('form_validation');
-
 
11
$GLOBALS["ci"]->load->library('pagination');
-
 
12
$csrf_name = $GLOBALS["ci"]->security->get_csrf_token_name();
-
 
13
$csrf_value = $GLOBALS["ci"]->security->get_csrf_hash();
-
 
14
$GLOBALS["ci"]->smarty->assign('csrf_name', $csrf_name);
-
 
15
$GLOBALS["ci"]->smarty->assign('csrf_value', $csrf_value);
-
 
16
if (!isset($_SESSION['username']))
-
 
17
{
-
 
18
	if (!isset($_SESSION["redirected"]))
-
 
19
	{
-
 
20
		$_SESSION["redirected"] = true;
-
 
21
		header("Location:/backend/Login/");
-
 
22
		exit;
-
 
23
	}
-
 
24
	return;
-
 
25
}
-
 
26
$web_rechte = array();
-
 
27
$user_rechte = array();
-
 
28
$GLOBALS["ci"]->load->model('termine_model', 'termine');
-
 
29
$termine = $GLOBALS["ci"]->termine->get_list();
-
 
30
$GLOBALS["ci"]->smarty->assign('termine', $termine);
-
 
31
$sql = "SELECT
-
 
32
		*
-
 
33
	FROM
-
 
34
		webs
-
 
35
	WHERE
-
 
36
		domain='".__SHOP__."'
-
 
37
";
-
 
38
$res = $GLOBALS["db_red"]->query($sql);
-
 
39
$GLOBALS["webs"] = $res->row_array();
-
 
40
$base = $_SERVER["DOCUMENT_ROOT"]."/backend/css";
-
 
41
$extra = "/".__SHOP__."/";
-
 
42
$file = "jquery-ui.custom.css";
-
 
43
$css_file = $base.$extra.$file;
-
 
44
if (!file_exists($css_file))
-
 
45
{
-
 
46
	$extra = "/start/";
-
 
47
}
-
 
48
$css_file = "/backend/css".$extra.$file;
-
 
49
$GLOBALS["ci"]->smarty->assign("jquery_ui_css", $css_file);
-
 
50
$GLOBALS["ci"]->smarty->assign("webs", $GLOBALS["webs"]);
-
 
51
 
-
 
52
$sql = "SELECT
-
 
53
		modules.interner_name AS m_name,
-
 
54
		tools.button_name AS t_name,
-
 
55
		properties.interner_name AS p_name,
-
 
56
		webs_properties.Bezeichnung,
-
 
57
		filename
-
 
58
	FROM
-
 
59
		webs,
-
 
60
        webs_properties,
-
 
61
        properties,
-
 
62
        tools,
-
 
63
        modules
-
 
64
    WHERE
-
 
65
        webs.domain='".__SHOP__."'
-
 
66
    AND
-
 
67
        webs_properties.webs=webs.ID
-
 
68
    AND
-
 
69
        webs_properties.properties=properties.ID
-
 
70
    AND
-
 
71
        properties.tools = tools.ID
-
 
72
    AND
-
 
73
        tools.modules = modules.ID
-
 
74
    ORDER BY
-
 
75
        properties.Rang
-
 
76
";
-
 
77
 
-
 
78
$result = $GLOBALS["db_red"]->query($sql);
-
 
79
while ($zeile = $result->unbuffered_row('array'))
-
 
80
{
-
 
81
	//var_dump($zeile);
-
 
82
	//exit;
-
 
83
	if (!$zeile["Bezeichnung"])
-
 
84
	{
-
 
85
		$zeile["Bezeichnung"] = "";
-
 
86
	}
-
 
87
	$zeile["Bezeichnung"] = explode("|", $zeile["Bezeichnung"]);
-
 
88
 
-
 
89
	if (count($zeile["Bezeichnung"]) == 1)
-
 
90
	{
-
 
91
		$zeile["Bezeichnung"] = $zeile["Bezeichnung"][0];
-
 
92
	}
-
 
93
 
-
 
94
	$web_rechte[$zeile["m_name"]][$zeile["t_name"]][$zeile["p_name"]] = $zeile["Bezeichnung"];
-
 
95
}
-
 
96
 
-
 
97
foreach (array_keys($web_rechte) as $a)
-
 
98
{
-
 
99
	foreach (array_keys($web_rechte[$a]) as $b)
-
 
100
	{
-
 
101
		foreach (array_keys($web_rechte[$a][$b]) as $c)
-
 
102
		{
-
 
103
			if (is_array($web_rechte[$a][$b][$c]))
-
 
104
			{
-
 
105
				//if (in_array($_SESSION[language], $web_rechte[$a][$b][$c]))
-
 
106
				{
-
 
107
					$web_rechte[$a][$b][$c] = $web_rechte[$a][$b][$c][array_search($_SESSION["language"],
-
 
108
						array_keys($web_rechte["online_shop"]["language"]))];
-
 
109
				}
-
 
110
				if ($web_rechte[$a][$b][$c] == "./.")
-
 
111
				{
-
 
112
					unset($web_rechte[$a][$b][$c]);
-
 
113
				}
-
 
114
			}
-
 
115
		}
-
 
116
	}
-
 
117
}
-
 
118
 
-
 
119
unset($query);
-
 
120
unset($result);
-
 
121
unset($zeile);
-
 
122
$GLOBALS["ci"]->smarty->assign("web_rechte", $web_rechte);
-
 
123
if ($GLOBALS["ci"]->session->user_data["user"] == "admin")
-
 
124
{
-
 
125
	$user_rechte = $web_rechte;
-
 
126
}
-
 
127
else
-
 
128
{
-
 
129
	$sql = "
-
 
130
		SELECT
-
 
131
			modules.interner_name AS module,
-
 
132
			tools.button_name AS tool,
-
 
133
			properties.interner_name AS property
-
 
134
		FROM
-
 
135
			webs,
-
 
136
			Access,
-
 
137
			webs_properties,
-
 
138
			user_properties,
-
 
139
			properties,
-
 
140
			tools,
-
 
141
			modules
-
 
142
		WHERE
-
 
143
			webs.domain='".__SHOP__."'
-
 
144
		AND
-
 
145
			webs_properties.webs=webs.ID
-
 
146
		AND
-
 
147
			webs_properties.properties=properties.ID
-
 
148
		AND
-
 
149
			Access.user='".$GLOBALS["ci"]->session->user_data["user"]."'
-
 
150
		AND
-
 
151
			user_properties.Access=Access.ID
-
 
152
		AND
-
 
153
			user_properties.properties=properties.ID
-
 
154
		AND
-
 
155
			properties.tools = tools.ID
-
 
156
		AND
-
 
157
			tools.modules = modules.ID
-
 
158
	";
-
 
159
	$result = $GLOBALS["db_red"]->query($sql);
-
 
160
	while ($zeile = $result->unbuffered_row('array'))
-
 
161
	{
-
 
162
		$user_rechte[$zeile["module"]][$zeile["tool"]][$zeile["property"]] = 1;
-
 
163
	}
-
 
164
}
-
 
165
$GLOBALS["ci"]->smarty->assign("user_rechte", $user_rechte);
-
 
166
$query_modules = "SELECT
-
 
167
		*
-
 
168
	FROM
-
 
169
		modules
-
 
170
	ORDER BY
-
 
171
		rang
-
 
172
";
-
 
173
 
-
 
174
$result_modules = $GLOBALS['db_red']->query($query_modules);
-
 
175
while ($zeile_modules = $result_modules->unbuffered_row('array'))
-
 
176
{
-
 
177
	$u_tools = array();
-
 
178
	if (isset($user_rechte[$zeile_modules["interner_name"]]))
-
 
179
	{
-
 
180
		$query_tools = "SELECT
-
 
181
				*
-
 
182
			FROM
-
 
183
				tools
-
 
184
			WHERE
-
 
185
				tools.modules = ".$zeile_modules["ID"]."
-
 
186
			AND
-
 
187
				tools.hidden='false'
-
 
188
			ORDER BY
-
 
189
				tools.rang
-
 
190
		";
-
 
191
 
-
 
192
		$result_tools = $GLOBALS['db_red']->query($query_tools);
-
 
193
		while ($zeile_tools = $result_tools->unbuffered_row('array'))
-
 
194
		{
-
 
195
			if (isset($user_rechte[$zeile_modules["interner_name"]][$zeile_tools["button_name"]]))
-
 
196
			{
-
 
197
				if ($zeile_tools["filename"])
-
 
198
				{
-
 
199
					$images_Pfad = 'images/navigation/';
-
 
200
					$imgsrc = $images_Pfad.'bt_'.$zeile_tools["button_name"].'.gif';
-
 
201
					$imgsrc_f2 = $images_Pfad.'bt_'.$zeile_tools["button_name"].'_f2.gif';
-
 
202
					$u_tools[] = array(
-
 
203
						"ID" => $zeile_tools["ID"],
-
 
204
						"image" => $imgsrc,
-
 
205
						"image_f2" => $imgsrc_f2,
-
 
206
						"filename" => $zeile_tools["filename"],
-
 
207
						"name" => $zeile_tools["name"],
-
 
208
						"icon" => $zeile_tools["icon"],
-
 
209
						);
-
 
210
				}
-
 
211
			}
-
 
212
		}
-
 
213
		if ($u_tools)
-
 
214
		{
-
 
215
			$u_modules[] = array(
-
 
216
				"name" => $zeile_modules["name"],
-
 
217
				"interner_name" => $zeile_modules["interner_name"],
-
 
218
				"ID" => $zeile_modules["ID"],
-
 
219
				"count" => count($user_rechte[$zeile_modules["interner_name"]]),
-
 
220
				"tools" => $u_tools,
-
 
221
				"icon" => $zeile_modules["icon"],
-
 
222
				);
-
 
223
		}
-
 
224
	}
-
 
225
}
-
 
226
$GLOBALS["ci"]->smarty->assign('u_modules', $u_modules);
-
 
227
$GLOBALS["web_rechte"] = $web_rechte;
-
 
228
$GLOBALS["user_rechte"] = $user_rechte;
-
 
229
 
5
$GLOBALS['ci'] = &get_instance();
230
$GLOBALS['order_db'] = $GLOBALS['ci']->load->database('order_db', TRUE);
6
$GLOBALS['order_db'] = $GLOBALS['ci']->load->database('order_db', TRUE);
231
$GLOBALS['db_red'] = $GLOBALS['ci']->load->database('db_red', TRUE);
7
$GLOBALS['db_red'] = $GLOBALS['ci']->load->database('db_red', TRUE);
Zeile 232... Zeile 8...
232
//$GLOBALS['ci']->load->model('artikel_model', 'artikel');
8
//$GLOBALS['ci']->load->model('artikel_model', 'artikel');