-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass.service.php
More file actions
272 lines (244 loc) · 7.9 KB
/
Copy pathclass.service.php
File metadata and controls
272 lines (244 loc) · 7.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?php
/**
* KeepInTouch
*
* @author Ralf Hertsch <ralf.hertsch@phpmanufaktur.de>
* @link http://phpmanufaktur.de
* @copyright 2010 - 2012
* @license MIT License (MIT) http://www.opensource.org/licenses/MIT
*/
// include class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION'))
include(WB_PATH.'/framework/class.secure.php');
}
else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
}
else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
// end include class.secure.php
require_once(WB_PATH.'/modules/'.basename(dirname(__FILE__)).'/initialize.php');
global $parser;
if (!is_object($parser)) $parser = new Dwoo();
class kitService {
const request_action = 'stact';
const action_default = 'def';
private $page_link = '';
private $img_url = '';
private $template_path = '';
private $help_path = '';
private $error = '';
private $message = '';
public function __construct() {
global $dbCfg;
$this->page_link = ADMIN_URL.'/admintools/tool.php?tool=kit';
$this->template_path = WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/htt/' ;
$this->help_path = WB_PATH . '/modules/' . basename(dirname(__FILE__)) . '/languages/' ;
$this->img_url = WB_URL.'/modules/'.basename(dirname(__FILE__)).'/img/';
} // __construct()
/**
* Set $this->error to $error
*
* @param STR $error
*/
public function setError($error) {
$this->error = $error;
} // setError()
/**
* Get Error from $this->error;
*
* @return STR $this->error
*/
public function getError() {
return $this->error;
} // getError()
/**
* Check if $this->error is empty
*
* @return BOOL
*/
public function isError() {
return (bool) !empty($this->error);
} // isError
/**
* Reset Error to empty String
*/
public function clearError() {
$this->error = '';
}
/** Set $this->message to $message
*
* @param STR $message
*/
public function setMessage($message='') {
$this->message = $message;
} // setMessage()
/**
* Get Message from $this->message;
*
* @return STR $this->message
*/
public function getMessage() {
return $this->message;
} // getMessage()
/**
* Check if $this->message is empty
*
* @return BOOL
*/
public function isMessage() {
return (bool) !empty($this->message);
} // isMessage
/**
* Verhindert XSS Cross Site Scripting
*
* @param REFERENCE $_REQUEST Array
* @return $request
*/
public function xssPrevent(&$request) {
if (is_string($request)) {
$request = html_entity_decode($request);
$request = strip_tags($request);
$request = trim($request);
$request = stripslashes($request);
}
return $request;
} // xssPrevent()
public function action() {
// ACHTUNG: erlaubte HTML Felder muessen auch in $kitBackend->action() angegeben werden !!!
$html_allowed = array();
foreach ($_REQUEST as $key => $value) {
if (!in_array($key, $html_allowed)) {
$_REQUEST[$key] = $this->xssPrevent($value);
}
}
isset($_REQUEST[self::request_action]) ? $action = $_REQUEST[self::request_action] : $action = self::action_default;
switch ($action):
default:
return $this->dlgStart();
break;
endswitch;
return true;
} // action();
/**
* Return Release of Module
*
* @return FLOAT
*/
private function getRelease() {
// read info.php into array
$info_text = file(WB_PATH.'/modules/'.basename(dirname(__FILE__)).'/info.php');
if ($info_text == false) {
return -1;
}
// walk through array
foreach ($info_text as $item) {
if (strpos($item, '$module_version') !== false) {
// split string $module_version
$value = explode('=', $item);
// return floatval
return floatval(preg_replace('([\'";,\(\)[:space:][:alpha:]])', '', $value[1]));
}
}
return -1;
} // getRelease()
/**
* Show Informations about KeepInTouch
* @return STR Information
*/
private function getKITinfo() {
global $parser;
$data = array(
'logo' => $this->img_url.'keepintouch-298-55.png',
'release' => sprintf('Release %01.2f', $this->getRelease()),
'register' => ''
);
return $parser->get($this->template_path.'backend.start.license.info.htt', $data);
} // getLicenseInfo()
private function getInfoBox() {
if ($this->isMessage()) {
return sprintf('<div id="kit_info_box">%s</div>', $this->getMessage());
}
// Abfrage externer Infoserver fehlt noch...
return '';
}
public function dlgStart() {
global $parser;
$menu_items = '';
$row = new Dwoo_Template_File($this->template_path.'backend.start.menu.item.htt');
// Alle Kontakte
$data = array('icon' => sprintf('<a href="%s&%s=%s"><img src="%s" alt="%s" width="80" height="81" /></a>',
$this->page_link,
kitBackend::request_action,
kitBackend::action_list,
$this->img_url.'tango/x-office-address-book.png',
kit_tab_list),
'info' => kit_start_list);
$menu_items .= $parser->get($row, $data);
// Kontakt bearbeiten
$data = array('icon' => sprintf('<a href="%s&%s=%s"><img src="%s" alt="%s" width="80" height="80" /></a>',
$this->page_link,
kitBackend::request_action,
kitBackend::action_contact,
$this->img_url.'tango/contact-new.png',
kit_tab_contact),
'info' => kit_start_contact);
$menu_items .= $parser->get($row, $data);
// Gruppen E-Mail
$data = array('icon' => sprintf('<a href="%s&%s=%s"><img src="%s" alt="%s" width="80" height="80" /></a>',
$this->page_link,
kitBackend::request_action,
kitBackend::action_email,
$this->img_url.'tango/group-mail.png',
kit_tab_contact),
'info' => kit_start_email);
$menu_items .= $parser->get($row, $data);
// Newsletter
$data = array('icon' => sprintf('<a href="%s&%s=%s"><img src="%s" alt="%s" width="80" height="80" /></a>',
$this->page_link,
kitBackend::request_action,
kitBackend::action_newsletter,
$this->img_url.'tango/newsletter.png',
kit_tab_newsletter),
'info' => kit_start_newsletter);
$menu_items .= $parser->get($row, $data);
// Einstellungen
$data = array('icon' => sprintf('<a href="%s&%s=%s"><img src="%s" alt="%s" width="80" height="80" /></a>',
$this->page_link,
kitBackend::request_action,
kitBackend::action_cfg,
$this->img_url.'tango/configuration.png',
kit_tab_cfg_general),
'info' => kit_start_config);
$menu_items .= $parser->get($row, $data);
// Hilfe
$data = array('icon' => sprintf('<a href="%s&%s=%s"><img src="%s" alt="%s" width="80" height="80" /></a>',
$this->page_link,
kitBackend::request_action,
kitBackend::action_help,
$this->img_url.'tango/help.png',
kit_tab_help),
'info' => kit_start_help);
$menu_items .= $parser->get($row, $data);
$license_info = $this->getKITInfo();
$kit_info = $this->getInfoBox();
$data = array(
'menu_items' => $menu_items,
'license_info' => $license_info,
'kit_info' => $kit_info
);
return $parser->get($this->template_path.'backend.start.htt', $data);
} // dlgStart()
} // class kitService
?>