1 | <?php |
---|
2 | # ***** BEGIN LICENSE BLOCK ***** |
---|
3 | # |
---|
4 | # This file is part of DL Manager. |
---|
5 | # Copyright 2008,2010 Moe (http://gniark.net/) and Tomtom (http://blog.zenstyle.fr) |
---|
6 | # |
---|
7 | # DL Manager is free software; you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation; either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # DL Manager is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | # |
---|
20 | # Images are from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ |
---|
21 | # |
---|
22 | # ***** END LICENSE BLOCK ***** |
---|
23 | |
---|
24 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
25 | |
---|
26 | $settings =& $core->blog->settings; |
---|
27 | |
---|
28 | try |
---|
29 | { |
---|
30 | if (!empty($_POST['saveconfig'])) |
---|
31 | { |
---|
32 | $settings->setNameSpace('dlmanager'); |
---|
33 | $settings->put('dlmanager_active',!empty($_POST['dlmanager_active']), |
---|
34 | 'boolean','Enable DL Manager'); |
---|
35 | $settings->put('dlmanager_hide_urls',!empty($_POST['dlmanager_hide_urls']), |
---|
36 | 'boolean','Hide files URLs'); |
---|
37 | $settings->put('dlmanager_counter',!empty($_POST['dlmanager_counter']), |
---|
38 | 'boolean','Enable download counter'); |
---|
39 | $settings->put('dlmanager_attachment_url',!empty($_POST['dlmanager_attachment_url']), |
---|
40 | 'boolean','Redirect attachments links to DL Manager'); |
---|
41 | |
---|
42 | if ((isset($_POST['dlmanager_nb_per_page'])) |
---|
43 | && (abs((integer) $_POST['dlmanager_nb_per_page']) > 0)) |
---|
44 | { |
---|
45 | $nb_per_page = abs((integer) $_POST['dlmanager_nb_per_page']); |
---|
46 | } |
---|
47 | else |
---|
48 | { |
---|
49 | $nb_per_page = 20; |
---|
50 | } |
---|
51 | $settings->put('dlmanager_nb_per_page',$nb_per_page, |
---|
52 | 'integer','Files per page'); |
---|
53 | $settings->put('dlmanager_enable_sort',!empty($_POST['dlmanager_enable_sort']), |
---|
54 | 'boolean','Allow visitors to choose how to sort files'); |
---|
55 | $settings->put('dlmanager_file_sort', |
---|
56 | (!empty($_POST['dlmanager_file_sort']) ? $_POST['dlmanager_file_sort'] : ''), |
---|
57 | 'string','file sort'); |
---|
58 | $settings->put('dlmanager_root', |
---|
59 | (!empty($_POST['dlmanager_root']) ? $_POST['dlmanager_root'] : ''), |
---|
60 | 'string', 'root directory'); |
---|
61 | |
---|
62 | # empty the cache |
---|
63 | $core->blog->triggerBlog(); |
---|
64 | |
---|
65 | http::redirect($p_url.'&saveconfig=1'); |
---|
66 | } |
---|
67 | } |
---|
68 | catch (Exception $e) |
---|
69 | { |
---|
70 | $core->error->add($e->getMessage()); |
---|
71 | } |
---|
72 | |
---|
73 | if (isset($_GET['saveconfig'])) |
---|
74 | { |
---|
75 | $msg = __('Configuration successfully updated.'); |
---|
76 | } |
---|
77 | |
---|
78 | ?> |
---|
79 | <html> |
---|
80 | <head> |
---|
81 | <title><?php echo __('Download Manager'); ?></title> |
---|
82 | </head> |
---|
83 | <body> |
---|
84 | |
---|
85 | <h2><?php echo html::escapeHTML($core->blog->name).' › '.__('Download Manager'); ?></h2> |
---|
86 | |
---|
87 | <?php |
---|
88 | if (!empty($msg)) {echo '<p class="message">'.$msg.'</p>';} |
---|
89 | ?> |
---|
90 | |
---|
91 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
92 | <fieldset> |
---|
93 | <legend><?php echo __('Download manager'); ?></legend> |
---|
94 | <p> |
---|
95 | <?php echo form::checkbox('dlmanager_active',1, |
---|
96 | $core->blog->settings->dlmanager_active); ?> |
---|
97 | <label class="classic" for="dlmanager_active"> |
---|
98 | <?php printf(__('Enable the %s'),__('Download manager')); ?> |
---|
99 | </label> |
---|
100 | </p> |
---|
101 | <p class="form-note"> |
---|
102 | <?php printf(__('The %s display media on a public page.'), |
---|
103 | __('Download manager')); ?> |
---|
104 | </p> |
---|
105 | <p> |
---|
106 | <?php echo form::checkbox('dlmanager_hide_urls',1, |
---|
107 | $core->blog->settings->dlmanager_hide_urls); ?> |
---|
108 | <label class="classic" for="dlmanager_hide_urls"> |
---|
109 | <?php echo __('Hide URLs of images, mp3, flv, mp4 and m4v files'); ?> |
---|
110 | </label> |
---|
111 | </p> |
---|
112 | <p class="form-note"> |
---|
113 | <?php printf(__('The images, mp3, flv, mp4 and m4v files will be served without revealing their URLs in %1$s and %2$s tags.'), |
---|
114 | '<code>'.'<img />'.'</code>','<code>'.'<object></object>'.'</code>'); |
---|
115 | echo ' '; |
---|
116 | printf(__('The public directory (or its subdirectories) can be in a restricted area or protected by a %1$s file containing %2$s.'), |
---|
117 | '<strong>.htaccess</strong>','<strong>Deny from all</strong>'); ?> |
---|
118 | </p> |
---|
119 | <p> |
---|
120 | <?php echo form::checkbox('dlmanager_counter',1, |
---|
121 | $core->blog->settings->dlmanager_counter); ?> |
---|
122 | <label class="classic" for="dlmanager_counter"> |
---|
123 | <?php echo __('Enable the download counter'); ?> |
---|
124 | </label> |
---|
125 | </p> |
---|
126 | <p> |
---|
127 | <?php echo form::checkbox('dlmanager_attachment_url',1, |
---|
128 | $core->blog->settings->dlmanager_attachment_url); ?> |
---|
129 | <label class="classic" for="dlmanager_attachment_url"> |
---|
130 | <?php printf(__('Redirect attachments links to %s'), |
---|
131 | __('Download manager')); ?> |
---|
132 | </label> |
---|
133 | </p> |
---|
134 | <p class="form-note"> |
---|
135 | <?php echo __('When downloading an attachment, the download counter will be increased.'); |
---|
136 | echo ' '; |
---|
137 | printf(__('This will redefine the %s tag.'), |
---|
138 | '<strong>{{tpl:AttachmentURL}}</strong>'); |
---|
139 | echo ' '; |
---|
140 | printf(__('The attachments must be located in the root of %s'), |
---|
141 | __('Download manager')); |
---|
142 | ?> |
---|
143 | </p> |
---|
144 | <p> |
---|
145 | <label class="classic" for="dlmanager_nb_per_page"> |
---|
146 | <?php echo __('Files per page:'); ?> |
---|
147 | </label> |
---|
148 | <?php echo form::field('dlmanager_nb_per_page',7,7, |
---|
149 | (($core->blog->settings->dlmanager_nb_per_page) |
---|
150 | ? $core->blog->settings->dlmanager_nb_per_page : 20)); ?> |
---|
151 | </p> |
---|
152 | <p> |
---|
153 | <?php echo form::checkbox('dlmanager_enable_sort',1, |
---|
154 | $core->blog->settings->dlmanager_enable_sort); ?> |
---|
155 | <label class="classic" for="dlmanager_enable_sort"> |
---|
156 | <?php echo __('Allow visitors to choose how to sort files'); ?> |
---|
157 | </label> |
---|
158 | </p> |
---|
159 | <p> |
---|
160 | <label for="dlmanager_file_sort"> |
---|
161 | <?php echo __('Sort files:'). |
---|
162 | form::combo('dlmanager_file_sort',dlManager::getSortValues(true), |
---|
163 | $core->blog->settings->dlmanager_file_sort); ?> |
---|
164 | </label> |
---|
165 | </p> |
---|
166 | <p class="form-note"> |
---|
167 | <?php echo __('Leave blank to disable this feature.'); ?> |
---|
168 | </p> |
---|
169 | <p> |
---|
170 | <label for="dlmanager_root"> |
---|
171 | <?php printf(__('Define root of %s:'),__('Download manager')); |
---|
172 | echo form::combo('dlmanager_root',dlManager::listDirs(false,true), |
---|
173 | $core->blog->settings->dlmanager_root); ?> |
---|
174 | </label> |
---|
175 | </p> |
---|
176 | <p class="form-note"> |
---|
177 | <?php echo __('Leave blank to disable this feature.').' '; |
---|
178 | printf(__('This will change the root of the %s page and of the widget.'), |
---|
179 | __('Download manager')); |
---|
180 | echo ' '; |
---|
181 | printf(__('If you change this setting, reconfigure the %s widget.'), |
---|
182 | __('Download manager')); ?> |
---|
183 | </p> |
---|
184 | <p> |
---|
185 | <!-- filemanager->$exclude_list is protected --> |
---|
186 | <?php printf( |
---|
187 | __('Files can be excluded from %1$s by editing %2$s in %3$s.'), |
---|
188 | __('Download manager'),'<strong>media_exclusion</strong>','<strong>about:config</strong>'); |
---|
189 | echo ' '; |
---|
190 | printf(__('For example, to exclude %1$s and %2$s files: %3$s'), |
---|
191 | 'PNG','JPG','<code>/\.(png|jpg)/i</code>'); ?> |
---|
192 | </p> |
---|
193 | <p> |
---|
194 | <?php printf(__('URL of the %s page:'),__('Download manager')); ?> |
---|
195 | <br /> |
---|
196 | <code><?php echo dlManager::pageURL(); ?></code> |
---|
197 | </p> |
---|
198 | <p> |
---|
199 | <a href="<?php echo dlManager::pageURL(); ?>"> |
---|
200 | <?php printf(__('View the %s page'),__('Download manager')); ?></a> |
---|
201 | </p> |
---|
202 | </fieldset> |
---|
203 | |
---|
204 | <p><?php echo $core->formNonce(); ?></p> |
---|
205 | <p><input type="submit" name="saveconfig" value="<?php echo __('Save configuration'); ?>" /></p> |
---|
206 | </form> |
---|
207 | |
---|
208 | <?php dcPage::helpBlock('dlManager_widget');?> |
---|
209 | |
---|
210 | </body> |
---|
211 | </html> |
---|