1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Palettes |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['secureDownloads'] = '{type_legend},type,headline;{source_legend},sortBy,metaIgnore;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
15 |
+ |
0 | 16 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,65 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Config |
|
14 |
+ */ |
|
15 |
+$GLOBALS['TL_DCA']['tl_member']['config']['ctable'][] = 'tl_member_secureDownloads'; |
|
16 |
+ |
|
17 |
+/** |
|
18 |
+ * Operations |
|
19 |
+ */ |
|
20 |
+$GLOBALS['TL_DCA']['tl_member']['list']['operations']['secureDownloads'] = array |
|
21 |
+( |
|
22 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member']['secureDownloads'], |
|
23 |
+ 'href' => 'table='.\eSM_secureDownloads\SecureDownloadsModel::getTable(), |
|
24 |
+ 'icon' => 'system/modules/eSM_secureDownloads/assets/images/sec_files.png', |
|
25 |
+ 'button_callback' => array('tl_member_eSM_secureDownloads', 'showDownloads') |
|
26 |
+ |
|
27 |
+); |
|
28 |
+ |
|
29 |
+ |
|
30 |
+class tl_member_eSM_secureDownloads extends \Backend |
|
31 |
+{ |
|
32 |
+ /** |
|
33 |
+ * Import the back end user object |
|
34 |
+ */ |
|
35 |
+ public function __construct() |
|
36 |
+ { |
|
37 |
+ parent::__construct(); |
|
38 |
+ $this->import('BackendUser', 'User'); |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ |
|
42 |
+ /** |
|
43 |
+ * Generate a "showDownloads" button and return it as string |
|
44 |
+ * |
|
45 |
+ * @param array $row |
|
46 |
+ * @param string $href |
|
47 |
+ * @param string $label |
|
48 |
+ * @param string $title |
|
49 |
+ * @param string $icon |
|
50 |
+ * |
|
51 |
+ * @return string |
|
52 |
+ */ |
|
53 |
+ public function showDownloads($row, $href, $label, $title, $icon) |
|
54 |
+ { |
|
55 |
+ if (!$this->User->isAdmin && !$this->User->hasAccess(1,'sec_dl_access')) |
|
56 |
+ { |
|
57 |
+ return ''; |
|
58 |
+ } |
|
59 |
+ |
|
60 |
+ $href .= '&id='.$row['id']; |
|
61 |
+ |
|
62 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'">'.Image::getHtml($icon, $label).'</a> '; |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+} |
|
0 | 66 |
\ No newline at end of file |
1 | 67 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,308 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Table tl_member_secureDownloads |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_DCA']['tl_member_secureDownloads'] = array |
|
15 |
+( |
|
16 |
+ |
|
17 |
+ // Config |
|
18 |
+ 'config' => array |
|
19 |
+ ( |
|
20 |
+ 'dataContainer' => 'Table', |
|
21 |
+ 'ptable' => 'tl_member', |
|
22 |
+ 'closed' => true, |
|
23 |
+ 'ondelete_callback' => array |
|
24 |
+ ( |
|
25 |
+ array('tl_member_secureDownloads','deleteFileCallback') |
|
26 |
+ ), |
|
27 |
+ 'sql' => array |
|
28 |
+ ( |
|
29 |
+ 'keys' => array |
|
30 |
+ ( |
|
31 |
+ 'id' => 'primary', |
|
32 |
+ 'pid' => 'index' |
|
33 |
+ ) |
|
34 |
+ ) |
|
35 |
+ ), |
|
36 |
+ |
|
37 |
+ // List |
|
38 |
+ 'list' => array |
|
39 |
+ ( |
|
40 |
+ 'sorting' => array |
|
41 |
+ ( |
|
42 |
+ 'mode' => 4, |
|
43 |
+ 'fields' => array('ctime'), |
|
44 |
+ 'headerFields' => array('firstname','lastname', 'username','memberno'), |
|
45 |
+ 'disableGrouping' => false, |
|
46 |
+ 'flag' => 6, |
|
47 |
+ 'panelLayout' => 'filter;sort,search,limit', |
|
48 |
+ 'child_record_callback' => array('tl_member_secureDownloads','listDownloads') |
|
49 |
+ ), |
|
50 |
+ 'global_operations' => array |
|
51 |
+ ( |
|
52 |
+ |
|
53 |
+ ), |
|
54 |
+ 'operations' => array |
|
55 |
+ ( |
|
56 |
+ 'edit' => array |
|
57 |
+ ( |
|
58 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member_secureDownloads']['edit'], |
|
59 |
+ 'href' => 'act=edit', |
|
60 |
+ 'icon' => 'edit.gif', |
|
61 |
+ 'button_callback' => array('tl_member_secureDownloads', 'editFile') |
|
62 |
+), |
|
63 |
+ 'delete' => array |
|
64 |
+ ( |
|
65 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member_secureDownloads']['delete'], |
|
66 |
+ 'href' => 'act=delete', |
|
67 |
+ 'icon' => 'delete.gif', |
|
68 |
+ 'button_callback' => array('tl_member_secureDownloads', 'deleteFile') |
|
69 |
+ ), |
|
70 |
+ 'show' => array |
|
71 |
+ ( |
|
72 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member_secureDownloads']['show'], |
|
73 |
+ 'icon' => 'show.gif', |
|
74 |
+ 'button_callback' => array('tl_member_secureDownloads', 'showFile') |
|
75 |
+ ), |
|
76 |
+ ) |
|
77 |
+ ), |
|
78 |
+ |
|
79 |
+ // Palettes |
|
80 |
+ 'palettes' => array |
|
81 |
+ ( |
|
82 |
+ 'default' => '{sec_dl_legend},name' |
|
83 |
+ ), |
|
84 |
+ |
|
85 |
+ // Subpalettes |
|
86 |
+ 'subpalettes' => array |
|
87 |
+ ( |
|
88 |
+ ), |
|
89 |
+ |
|
90 |
+ // Fields |
|
91 |
+ 'fields' => array |
|
92 |
+ ( |
|
93 |
+ 'id' => array |
|
94 |
+ ( |
|
95 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
96 |
+ ), |
|
97 |
+ 'pid' => array |
|
98 |
+ ( |
|
99 |
+ 'foreignKey' => 'tl_member.name', |
|
100 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'", |
|
101 |
+ 'relation' => array('type'=>'belongsTo', 'load'=>'lazy') |
|
102 |
+ ), |
|
103 |
+ 'uuid' => array |
|
104 |
+ ( |
|
105 |
+ 'foreignKey' => 'tl_files.name', |
|
106 |
+ 'sql' => "binary(16) NULL", |
|
107 |
+ 'relation' => array('type'=>'belongsTo', 'load'=>'eager', 'field'=>'uuid') |
|
108 |
+ ), |
|
109 |
+ 'tstamp' => array |
|
110 |
+ ( |
|
111 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
112 |
+ ), |
|
113 |
+ 'ctime' => array |
|
114 |
+ ( |
|
115 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member_secureDownloads']['ctime'], |
|
116 |
+ 'sorting' => true, |
|
117 |
+ 'flag' => 6, |
|
118 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
119 |
+ ), |
|
120 |
+ 'name' => array |
|
121 |
+ ( |
|
122 |
+ 'exclude' => true, |
|
123 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member_secureDownloads']['name'], |
|
124 |
+ 'sorting' => true, |
|
125 |
+ 'flag' => 1, |
|
126 |
+ 'inputType' => 'text', |
|
127 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>255, 'decodeEntities'=>true, 'doNotSaveEmpty'=>true), |
|
128 |
+ 'load_callback' => array |
|
129 |
+ ( |
|
130 |
+ array('tl_member_secureDownloads', 'getFilename') |
|
131 |
+ ), |
|
132 |
+ 'save_callback' => array |
|
133 |
+ ( |
|
134 |
+ array('tl_member_secureDownloads', 'checkFilename') |
|
135 |
+ ), |
|
136 |
+// 'sql' => "varchar(255) NOT NULL default ''" |
|
137 |
+ ), |
|
138 |
+ /*'path' => array |
|
139 |
+ ( |
|
140 |
+ 'sql' => "varchar(1022) NOT NULL default ''", |
|
141 |
+ ),*/ |
|
142 |
+ 'nc_sent' => array |
|
143 |
+ ( |
|
144 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
145 |
+ ), |
|
146 |
+ ) |
|
147 |
+); |
|
148 |
+ |
|
149 |
+ |
|
150 |
+class tl_member_secureDownloads extends \Backend |
|
151 |
+{ |
|
152 |
+ /** |
|
153 |
+ * Import the back end user object |
|
154 |
+ */ |
|
155 |
+ public function __construct() |
|
156 |
+ { |
|
157 |
+ parent::__construct(); |
|
158 |
+ $this->import('BackendUser', 'User'); |
|
159 |
+ } |
|
160 |
+ |
|
161 |
+ public function listDownloads($arrRow) |
|
162 |
+ { |
|
163 |
+ $objSecFile = \SecureDownloadsModel::findByPk($arrRow['id']); |
|
164 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
165 |
+ |
|
166 |
+ return '<div class="tl_content_left">' . ($objFile !== null ? $objFile->name : '') . ' <span style="color:#b3b3b3;padding-left:3px">[' . Date::parse(Config::get('datimFormat'), $arrRow['ctime']) . ']</span></div>'; |
|
167 |
+ } |
|
168 |
+ |
|
169 |
+ public function editFile($row, $href, $label, $title, $icon, $attributes) |
|
170 |
+ { |
|
171 |
+ if (!$this->User->isAdmin && !$this->User->hasAccess(1,'sec_dl_access')) |
|
172 |
+ { |
|
173 |
+ return ''; |
|
174 |
+ } |
|
175 |
+ |
|
176 |
+ $objSecFile = \SecureDownloadsModel::findByPk($row['id']); |
|
177 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
178 |
+ $title = sprintf($GLOBALS['TL_LANG']['tl_member_secureDownloads']['edit'][1],$objFile->name); |
|
179 |
+ |
|
180 |
+ $href .= '&id='.$row['id']; |
|
181 |
+ |
|
182 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'">'.Image::getHtml($icon, $label).'</a> '; |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ public function deleteFile($row, $href, $label, $title, $icon, $attributes) |
|
186 |
+ { |
|
187 |
+ if (!$this->User->isAdmin && !$this->User->hasAccess(1,'sec_dl_access')) |
|
188 |
+ { |
|
189 |
+ return ''; |
|
190 |
+ } |
|
191 |
+ |
|
192 |
+ $objSecFile = \SecureDownloadsModel::findByPk($row['id']); |
|
193 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
194 |
+ $attributes = ' onclick="if(!confirm(\'' . sprintf($GLOBALS['TL_LANG']['MSC']['deleteConfirmFile'],$objFile->name) . '\'))return false;Backend.getScrollOffset()"'; |
|
195 |
+ $title = sprintf($GLOBALS['TL_LANG']['tl_member_secureDownloads']['delete'][1],$objFile->name); |
|
196 |
+ |
|
197 |
+ $href .= '&id='.$row['id']; |
|
198 |
+ |
|
199 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> '; |
|
200 |
+ } |
|
201 |
+ |
|
202 |
+ public function showFile($row, $href, $label, $title, $icon, $attributes) |
|
203 |
+ { |
|
204 |
+ if (Input::get('popup')) |
|
205 |
+ { |
|
206 |
+ return ''; |
|
207 |
+ } |
|
208 |
+ else |
|
209 |
+ { |
|
210 |
+ $objSecFile = \SecureDownloadsModel::findByPk($row['id']); |
|
211 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
212 |
+ $title = sprintf($GLOBALS['TL_LANG']['tl_member_secureDownloads']['show'][1],$objFile->name); |
|
213 |
+ |
|
214 |
+ if ($objFile !== null) |
|
215 |
+ { |
|
216 |
+ return '<a href="contao/popup.php?src=' . base64_encode($objFile->path) . '" title="'.specialchars($title, false, true).'"'.$attributes.' onclick="Backend.openModalIframe({\'width\':600,\'title\':\''.str_replace("'", "\\'", specialchars($objFile->name, false, true)).'\',\'url\':this.href,\'height\':300});return false">'.Image::getHtml($icon, $label).'</a> '; |
|
217 |
+ } else { |
|
218 |
+ return ''; |
|
219 |
+ } |
|
220 |
+ } |
|
221 |
+ } |
|
222 |
+ |
|
223 |
+ public function deleteFileCallback(DataContainer $dc) |
|
224 |
+ { |
|
225 |
+ $objSecFile = \SecureDownloadsModel::findByPk($dc->id); |
|
226 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
227 |
+ |
|
228 |
+ if ($objFile !== null) { |
|
229 |
+ $File = new \File($objFile->path,true); |
|
230 |
+ $File->delete(); |
|
231 |
+ } |
|
232 |
+ } |
|
233 |
+ |
|
234 |
+ public function getFilename($varValue, DataContainer $dc) |
|
235 |
+ { |
|
236 |
+ $objSecFile = \SecureDownloadsModel::findByPk($dc->id); |
|
237 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
238 |
+ |
|
239 |
+ if ($objFile !== null) { |
|
240 |
+ return $objFile->name; |
|
241 |
+ } |
|
242 |
+ |
|
243 |
+ return null; |
|
244 |
+ } |
|
245 |
+ |
|
246 |
+ /** |
|
247 |
+ * Check a file name and romanize it |
|
248 |
+ * |
|
249 |
+ * @param string $varValue |
|
250 |
+ * @param DataContainer|DC_Folder $dc |
|
251 |
+ * |
|
252 |
+ * @return mixed |
|
253 |
+ * |
|
254 |
+ * @throws Exception |
|
255 |
+ */ |
|
256 |
+ public function checkFilename($varValue, DataContainer $dc) |
|
257 |
+ { |
|
258 |
+ $varValue = utf8_romanize($varValue); |
|
259 |
+ $varValue = str_replace('"', '', $varValue); |
|
260 |
+ |
|
261 |
+ if (strpos($varValue, '/') !== false || preg_match('/\.$/', $varValue)) |
|
262 |
+ { |
|
263 |
+ throw new Exception($GLOBALS['TL_LANG']['ERR']['invalidName']); |
|
264 |
+ } |
|
265 |
+ |
|
266 |
+ // Check the length without the file extension |
|
267 |
+ if ($dc->activeRecord && $varValue != '') |
|
268 |
+ { |
|
269 |
+ $intMaxlength = $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['maxlength']; |
|
270 |
+ |
|
271 |
+ if ($dc->activeRecord->type == 'file') |
|
272 |
+ { |
|
273 |
+ $intMaxlength -= (strlen($dc->activeRecord->extension) + 1); |
|
274 |
+ } |
|
275 |
+ |
|
276 |
+ if ($intMaxlength && utf8_strlen($varValue) > $intMaxlength) |
|
277 |
+ { |
|
278 |
+ throw new Exception(sprintf($GLOBALS['TL_LANG']['ERR']['maxlength'], $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['label'][0], $intMaxlength)); |
|
279 |
+ } |
|
280 |
+ } |
|
281 |
+ |
|
282 |
+ $objSecFile = \SecureDownloadsModel::findByPk($dc->id); |
|
283 |
+ $objFile = $objSecFile->getRelated('uuid'); |
|
284 |
+ $File = new \File($objFile->path,true); |
|
285 |
+ |
|
286 |
+ if (!$File->exists()) |
|
287 |
+ { |
|
288 |
+ throw new Exception(sprintf($GLOBALS['TL_LANG']['ERR']['invalidFile'],'1'.$varValue)); |
|
289 |
+ } |
|
290 |
+ |
|
291 |
+ $strDirectory = dirname($objFile->path); |
|
292 |
+ if (!$File->renameTo($strDirectory.'/'.$varValue)) |
|
293 |
+ { |
|
294 |
+ throw new Exception(sprintf($GLOBALS['TL_LANG']['ERR']['invalidFile'],'2'.$varValue)); |
|
295 |
+ } |
|
296 |
+ |
|
297 |
+ if (($objFile = $File->getModel()) !== null) { |
|
298 |
+ $objSecFile = \SecureDownloadsModel::findByPk($dc->id); |
|
299 |
+ |
|
300 |
+ if ($objSecFile !== null){ |
|
301 |
+ $objSecFile->uuid = $objFile->uuid; |
|
302 |
+ $objSecFile->save(); |
|
303 |
+ } |
|
304 |
+ } |
|
305 |
+ |
|
306 |
+ return null; |
|
307 |
+ } |
|
308 |
+} |
0 | 309 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,136 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Palettes |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'secureDownloadsEnabled'; |
|
15 |
+$GLOBALS['TL_DCA']['tl_page']['palettes']['root'] = str_replace(';{publish_legend}', ';{sec_dl_legend},secureDownloadsEnabled;{publish_legend}',$GLOBALS['TL_DCA']['tl_page']['palettes']['root']); |
|
16 |
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secureDownloadsSRC,secureDownloadsTarget,secureDownloadsRegExp,secureDownloadsFields,sd_nc_enable,sd_nc_notification'; |
|
17 |
+ |
|
18 |
+ |
|
19 |
+/** |
|
20 |
+ * Fields |
|
21 |
+ */ |
|
22 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsEnabled'] = array |
|
23 |
+( |
|
24 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsEnabled'], |
|
25 |
+ 'exclude' => true, |
|
26 |
+ 'inputType' => 'checkbox', |
|
27 |
+ 'eval' => array('submitOnChange'=>true), |
|
28 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
29 |
+); |
|
30 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsSRC'] = array |
|
31 |
+( |
|
32 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsSRC'], |
|
33 |
+ 'exclude' => true, |
|
34 |
+ 'inputType' => 'fileTree', |
|
35 |
+ 'eval' => array('mandatory'=>true,'fieldType'=>'radio', 'tl_class'=>'clr'), |
|
36 |
+ 'sql' => 'binary(16) NULL' |
|
37 |
+); |
|
38 |
+ |
|
39 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsTarget'] = array |
|
40 |
+( |
|
41 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsTarget'], |
|
42 |
+ 'exclude' => true, |
|
43 |
+ 'inputType' => 'fileTree', |
|
44 |
+ 'eval' => array('mandatory'=>true,'fieldType'=>'radio', 'tl_class'=>'clr'), |
|
45 |
+ 'sql' => 'binary(16) NULL' |
|
46 |
+); |
|
47 |
+ |
|
48 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsRegExp'] = array |
|
49 |
+( |
|
50 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsRegExp'], |
|
51 |
+ 'exclude' => true, |
|
52 |
+ 'inputType' => 'text', |
|
53 |
+ 'eval' => array('mandatory'=>true,'maxlength'=>64,'preserveTags'=>true,'decodeEntities'=>true), |
|
54 |
+ 'sql' => 'varchar(64) NULL' |
|
55 |
+); |
|
56 |
+ |
|
57 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsFields'] = array |
|
58 |
+( |
|
59 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsFields'], |
|
60 |
+ 'exclude' => true, |
|
61 |
+ 'inputType' => 'checkboxWizard', |
|
62 |
+ 'options_callback' => array('tl_page_eSM_secureDownloads','getMemberProperties'), |
|
63 |
+ 'eval' => array('mandatory'=>true,'multiple'=>true), |
|
64 |
+ 'sql' => 'varchar(255) NULL' |
|
65 |
+); |
|
66 |
+ |
|
67 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_enable'] = array |
|
68 |
+( |
|
69 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['sd_nc_enable'], |
|
70 |
+ 'exclude' => true, |
|
71 |
+ 'inputType' => 'checkbox', |
|
72 |
+ 'eval' => array('tl_class'=>'w50 m12','submitOnChange'=>true), |
|
73 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
74 |
+); |
|
75 |
+ |
|
76 |
+$GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_notification'] = array |
|
77 |
+( |
|
78 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_page']['sd_nc_enable'], |
|
79 |
+ 'exclude' => true, |
|
80 |
+ 'inputType' => 'select', |
|
81 |
+ 'options_callback' => array('tl_page_eSM_secureDownloads', 'getNotificationChoices'), |
|
82 |
+ 'eval' => array('mandatory'=>true,'includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'), |
|
83 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
84 |
+); |
|
85 |
+ |
|
86 |
+class tl_page_eSM_secureDownloads extends \Backend |
|
87 |
+{ |
|
88 |
+ /** |
|
89 |
+ * Import the back end user object |
|
90 |
+ */ |
|
91 |
+ public function __construct() |
|
92 |
+ { |
|
93 |
+ parent::__construct(); |
|
94 |
+ $this->import('BackendUser', 'User'); |
|
95 |
+ } |
|
96 |
+ |
|
97 |
+ /** |
|
98 |
+ * Return all fields of table tl_member |
|
99 |
+ * |
|
100 |
+ * @return array |
|
101 |
+ */ |
|
102 |
+ public function getMemberProperties() |
|
103 |
+ { |
|
104 |
+ $return = array('id'=>'ID'); |
|
105 |
+ |
|
106 |
+ System::loadLanguageFile('tl_member'); |
|
107 |
+ $this->loadDataContainer('tl_member'); |
|
108 |
+ |
|
109 |
+ foreach ($GLOBALS['TL_DCA']['tl_member']['fields'] as $k=>$v) |
|
110 |
+ { |
|
111 |
+ if (is_array($v['label'])) |
|
112 |
+ { |
|
113 |
+ $return[$k] = $GLOBALS['TL_DCA']['tl_member']['fields'][$k]['label'][0]; |
|
114 |
+ } |
|
115 |
+ } |
|
116 |
+ |
|
117 |
+ return $return; |
|
118 |
+ } |
|
119 |
+ |
|
120 |
+ /** |
|
121 |
+ * Get notification choices |
|
122 |
+ * |
|
123 |
+ * @return array |
|
124 |
+ */ |
|
125 |
+ public function getNotificationChoices() |
|
126 |
+ { |
|
127 |
+ $arrChoices = array(); |
|
128 |
+ $objNotifications = \Database::getInstance()->execute("SELECT id,title FROM tl_nc_notification WHERE type='secDownloads_submitted' ORDER BY title"); |
|
129 |
+ |
|
130 |
+ while ($objNotifications->next()) { |
|
131 |
+ $arrChoices[$objNotifications->id] = $objNotifications->title; |
|
132 |
+ } |
|
133 |
+ |
|
134 |
+ return $arrChoices; |
|
135 |
+ } |
|
136 |
+} |
|
0 | 137 |
\ No newline at end of file |
1 | 138 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,30 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Extend a tl_user_group palette |
|
14 |
+ */ |
|
15 |
+$GLOBALS['TL_DCA']['tl_user']['palettes']['extend'] = str_replace(array('{account_legend}', '{account_legend:hide}'), '{sec_dl_legend:hide},sec_dl_access;{account_legend}', $GLOBALS['TL_DCA']['tl_user']['palettes']['extend']); |
|
16 |
+$GLOBALS['TL_DCA']['tl_user']['palettes']['custom'] = str_replace(array('{account_legend}', '{account_legend:hide}'), '{sec_dl_legend:hide},sec_dl_access;{account_legend}', $GLOBALS['TL_DCA']['tl_user']['palettes']['custom']); |
|
17 |
+ |
|
18 |
+ |
|
19 |
+/** |
|
20 |
+ * Add fields to tl_user_group |
|
21 |
+ */ |
|
22 |
+$GLOBALS['TL_DCA']['tl_user']['fields']['sec_dl_access'] = array |
|
23 |
+( |
|
24 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_user']['sec_dl_access'], |
|
25 |
+ 'exclude' => true, |
|
26 |
+ 'filter' => true, |
|
27 |
+ 'inputType' => 'checkbox', |
|
28 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
29 |
+ |
|
30 |
+); |
|
0 | 31 |
\ No newline at end of file |
1 | 32 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,29 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Extend a tl_user_group palette |
|
14 |
+ */ |
|
15 |
+$GLOBALS['TL_DCA']['tl_user_group']['palettes']['default'] = str_replace(array('{alexf_legend}', '{alexf_legend:hide}'), '{sec_dl_legend:hide},sec_dl_access;{alexf_legend}', $GLOBALS['TL_DCA']['tl_user_group']['palettes']['default']); |
|
16 |
+ |
|
17 |
+ |
|
18 |
+/** |
|
19 |
+ * Add fields to tl_user_group |
|
20 |
+ */ |
|
21 |
+$GLOBALS['TL_DCA']['tl_user_group']['fields']['sec_dl_access'] = array |
|
22 |
+( |
|
23 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_user_group']['sec_dl_access'], |
|
24 |
+ 'exclude' => true, |
|
25 |
+ 'filter' => true, |
|
26 |
+ 'inputType' => 'checkbox', |
|
27 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
28 |
+ |
|
29 |
+); |
|
0 | 30 |
\ No newline at end of file |
1 | 31 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+$GLOBALS['TL_LANG']['CTE']['secureDownloads'][0] = 'Sichere Downloads'; |
|
12 |
+$GLOBALS['TL_LANG']['CTE']['secureDownloads'][1] = 'Sichere Downloads für Mitglieder'; |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Misc |
|
16 |
+ */ |
|
17 |
+$GLOBALS['TL_LANG']['MSC']['gotoPage'] = 'Zur Seite "%s"'; |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Frontend modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][0] = 'Seitenliste'; |
|
15 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][1] = 'Erzeugt eine Linkliste mit Unterseiten.'; |
|
0 | 16 |
\ No newline at end of file |
1 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['ctime'][0] = 'Importdatum'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['ctime'][1] = 'Zeigt das Datum an dem die Datei importiert wurde.'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['name'][0] = 'Dateiname'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['name'][1] = 'Der Name der Datei.'; |
|
18 |
+ |
|
19 |
+/** |
|
20 |
+ * Legends |
|
21 |
+ */ |
|
22 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['sec_dl_legend'] = 'Dateinamen-Einstellungen'; |
|
23 |
+ |
|
24 |
+ |
|
25 |
+/** |
|
26 |
+ * Buttons |
|
27 |
+ */ |
|
28 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['edit'][0] = 'Datei umbenennen'; |
|
29 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['edit'][1] = 'Die Datei »%s« umbennnen'; |
|
30 |
+ |
|
31 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['delete'][0] = 'Datei löschen'; |
|
32 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['delete'][1] = 'Die Datei »%s« löschen'; |
|
33 |
+ |
|
34 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['show'][0] = 'Dateiinfo/Download'; |
|
35 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['show'][1] = 'Dateiinformationen für »%s« und Download'; |
|
36 |
+ |
|
37 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['editheader'][0] = 'Mitgliederdetails bearbeiten'; |
|
38 |
+$GLOBALS['TL_LANG']['tl_member_secureDownloads']['editheader'][1] = 'Die Mitgliederdetails bearbeiten'; |
|
0 | 39 |
\ No newline at end of file |
1 | 40 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,11 @@ |
1 |
+<?php |
|
2 |
+/** |
|
3 |
+ * SecureDownloads for Contao |
|
4 |
+ * |
|
5 |
+ * Copyright (c) 2017 Benjamin Roth |
|
6 |
+ * |
|
7 |
+ * @license commercial |
|
8 |
+ */ |
|
9 |
+ |
|
10 |
+$GLOBALS['TL_LANG']['tl_nc_notification']['type']['secDownloads_submitted']['0'] = 'Neue sichere Downloads'; |
|
11 |
+ |
0 | 12 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Files |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsEnabled'][0] = 'Sichere Mitglieder-Downloads aktivieren'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsEnabled'][1] = 'Erlaubt es automatisiert abgesicherte Dateien für Mitglieder zu importieren.'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsSRC'][0] = 'Import-Ordner'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsSRC'][1] = 'Dateien in diesem Ordner werden zyklisch automatisiert verarbeitet.'; |
|
18 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsTarget'][0] = 'Ziel-Ordner'; |
|
19 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsTarget'][1] = 'Die verarbeiteten Dateien werden unterhalb dieses Ordners gespeichert.'; |
|
20 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsRegExp'][0] = 'Automatisierungs-Fragment RegExp(PCRE)'; |
|
21 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsRegExp'][1] = 'Regulärer Ausdruck um ein oder mehrere Zuordnungsfragmente aus dem Dateinamen zu extrahieren.'; |
|
22 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsFields'][0] = 'Fragment-Felder'; |
|
23 |
+$GLOBALS['TL_LANG']['tl_page']['secureDownloadsFields'][1] = 'Felder welche den Fragmenten zugeordnet werden.'; |
|
24 |
+ |
|
25 |
+/** |
|
26 |
+ * Legends |
|
27 |
+ */ |
|
28 |
+$GLOBALS['TL_LANG']['tl_page']['sec_dl_legend'] = 'Sichere Mitglieder-Downloads'; |
0 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Files |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_user']['sec_dl_access'][0] = 'Zugriff auf Mitglieder-Dateien'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_user']['sec_dl_access'][1] = 'Gibt dem User Zugriff auf zugewiesene sichere Dateien von Mitgliedern.'; |
|
16 |
+ |
|
17 |
+/** |
|
18 |
+ * Legends |
|
19 |
+ */ |
|
20 |
+$GLOBALS['TL_LANG']['tl_user']['sec_dl_legend'] = 'Sichere Mitglieder-Downloads'; |
0 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * SecureDownloads for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Files |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_user_group']['sec_dl_access'][0] = 'Zugriff auf Mitglieder-Dateien'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_user_group']['sec_dl_access'][1] = 'Gibt dem User Zugriff auf zugewiesene sichere Dateien von Mitgliedern.'; |
|
16 |
+ |
|
17 |
+/** |
|
18 |
+ * Legends |
|
19 |
+ */ |
|
20 |
+$GLOBALS['TL_LANG']['tl_user_group']['sec_dl_legend'] = 'Sichere Mitglieder-Downloads'; |
0 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,16 @@ |
1 |
+<?php |
|
2 |
+/** |
|
3 |
+ * News notification extension for Contao |
|
4 |
+ * |
|
5 |
+ * Copyright (c) 2016 Benjamin Roth |
|
6 |
+ * |
|
7 |
+ * @link http://www.esales-media.de |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['secDownloads_submitted']['member_email'] = 'E-Mail-Adresse des Mitglieds.'; |
|
12 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['secDownloads_submitted']['member_firstname'] = 'Vorname des Mitglieds.'; |
|
13 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['secDownloads_submitted']['member_lastname'] = 'Nachname des Mitglieds.'; |
|
14 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['secDownloads_submitted']['downloads'] = 'Alle Namen von neuen Dateien.'; |
|
15 |
+$GLOBALS['TL_LANG']['NOTIFICATION_CENTER_TOKEN']['secDownloads_submitted']['downloads_html'] = 'Alle Namen von neuen Dateien. (HTML).'; |
|
16 |
+ |
0 | 15 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Frontend modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][0] = 'Pagelist'; |
|
15 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][1] = 'Generates a link list of subpages.'; |
|
0 | 16 |
\ No newline at end of file |