1 | <?php |
---|
2 | # ***** BEGIN LICENSE BLOCK ***** |
---|
3 | # |
---|
4 | # This file is part of Subscribe to comments. |
---|
5 | # Copyright 2008,2009 Moe (http://gniark.net/) |
---|
6 | # |
---|
7 | # Subscribe to comments 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 | # Subscribe to comments 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 | # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ |
---|
21 | # |
---|
22 | # Inspired by http://txfx.net/code/wordpress/subscribe-to-comments/ |
---|
23 | # |
---|
24 | # ***** END LICENSE BLOCK ***** |
---|
25 | |
---|
26 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
---|
27 | |
---|
28 | l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/admin'); |
---|
29 | |
---|
30 | # format tables' tbody |
---|
31 | function tbody ($array) |
---|
32 | { |
---|
33 | foreach ($array as $k => $v) |
---|
34 | { |
---|
35 | echo('<tr><td><code>'.$k.'</code></td><td>'.$v['name'].'</td></tr>'); |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | # code for template files |
---|
40 | $post_form = '<tpl:SubscribeToCommentsIsActive> |
---|
41 | <p> |
---|
42 | <label><input type="checkbox" name="subscribeToComments" id="subscribeToComments" |
---|
43 | {{tpl:SubscribeToCommentsFormChecked}} /> |
---|
44 | {{tpl:lang Receive following comments by email}}</label> |
---|
45 | <tpl:SubscribeToCommentsLoggedIf> |
---|
46 | (<strong><a href="{{tpl:SubscribeToCommentsFormLink}}">{{tpl:lang Logged in}}</a></strong>) |
---|
47 | </tpl:SubscribeToCommentsLoggedIf> |
---|
48 | </p> |
---|
49 | </tpl:SubscribeToCommentsIsActive>'; |
---|
50 | |
---|
51 | $post_css = '#comment-form #subscribeToComments { |
---|
52 | width:auto; |
---|
53 | border:0; |
---|
54 | margin:0 5px 0 140px; |
---|
55 | }'; |
---|
56 | |
---|
57 | $post_link = '<tpl:SubscribeToCommentsIsActive> |
---|
58 | <div id="subscribetocomments_block"> |
---|
59 | <h3>{{tpl:lang Subscribe to comments}}</h3> |
---|
60 | <p> |
---|
61 | <a href="{{tpl:SubscribeToCommentsFormLink}}"> |
---|
62 | <!-- # If the subscriber is logged in --> |
---|
63 | <tpl:SubscribeToCommentsLoggedIf> |
---|
64 | {{tpl:lang Subscribe to receive following comments by email or manage subscriptions}} |
---|
65 | </tpl:SubscribeToCommentsLoggedIf> |
---|
66 | <!-- # If the subscriber is not logged in --> |
---|
67 | <tpl:SubscribeToCommentsLoggedIfNot> |
---|
68 | {{tpl:lang Subscribe to receive following comments by email}} |
---|
69 | </tpl:SubscribeToCommentsLoggedIfNot> |
---|
70 | </a> |
---|
71 | </p> |
---|
72 | </div> |
---|
73 | </tpl:SubscribeToCommentsIsActive>'; |
---|
74 | |
---|
75 | # tags to format emails |
---|
76 | $tags_global = array( |
---|
77 | '[blogname]' => array('name'=>__('Blog name'),'tag'=>'%1$s'), |
---|
78 | '[blogurl]' => array('name'=>__('Blog URL'),'tag'=>'%2$s'), |
---|
79 | '[email]' => array('name'=>__('Email address'),'tag'=>'%3$s'), |
---|
80 | '[manageurl]' => array( |
---|
81 | 'name'=> sprintf(__('%s\'s page URL'),__('Subscribe to comments')), |
---|
82 | 'tag'=>'%4$s') |
---|
83 | ); |
---|
84 | $tags_account = array(); |
---|
85 | $tags_subscribe = array( |
---|
86 | '[posttitle]' => array('name'=>__('Post title'),'tag'=>'%5$s'), |
---|
87 | '[posturl]' => array('name'=>__('Post URL'),'tag'=>'%6$s'), |
---|
88 | ); |
---|
89 | $tags_comment = array( |
---|
90 | '[posttitle]' => array('name'=>__('Post title'),'tag'=>'%5$s'), |
---|
91 | '[posturl]' => array('name'=>__('Post URL'),'tag'=>'%6$s'), |
---|
92 | '[commenturl]' => array('name'=>__('URL to new comment'),'tag'=>'%7$s'), |
---|
93 | '[commentauthor]' => array('name'=>__('Comment author'),'tag'=>'%8$s'), |
---|
94 | '[commentcontent]' => array('name'=>__('Comment content'), |
---|
95 | 'tag'=>'%9$s'), |
---|
96 | ); |
---|
97 | $tags_email = array( |
---|
98 | '[newemail]' => array('name'=> |
---|
99 | __('New email address'),'tag'=>'%5$s'), |
---|
100 | '[emailurl]' => array('name'=> |
---|
101 | __('URL to confirm the change of email address'),'tag'=>'%6$s') |
---|
102 | ); |
---|
103 | |
---|
104 | $settings =& $core->blog->settings; |
---|
105 | |
---|
106 | # get languages list to restore settings |
---|
107 | $lang_combo = array(); |
---|
108 | |
---|
109 | $locales = files::getDirList(dirname(__FILE__).'/locales/'); |
---|
110 | |
---|
111 | $langs = l10n::getISOcodes(false,true); |
---|
112 | |
---|
113 | foreach ($locales['dirs'] as $k => $v) |
---|
114 | { |
---|
115 | $lang = basename($v); |
---|
116 | if (array_key_exists($lang,$langs)) |
---|
117 | { |
---|
118 | $lang_combo[$langs[$lang].' '. |
---|
119 | (($lang == $settings->lang) ? __('(blog language)'): '')] = $lang; |
---|
120 | } |
---|
121 | } |
---|
122 | |
---|
123 | unset($locales,$langs); |
---|
124 | |
---|
125 | $msg = ''; |
---|
126 | |
---|
127 | $default_tab = 'settings'; |
---|
128 | |
---|
129 | $available_tags = array(); |
---|
130 | |
---|
131 | $settings->setNameSpace('subscribetocomments'); |
---|
132 | |
---|
133 | try |
---|
134 | { |
---|
135 | # install the plugin |
---|
136 | if (!empty($_POST['enable'])) |
---|
137 | { |
---|
138 | if (!empty($_POST['subscribetocomments_active'])) |
---|
139 | { |
---|
140 | # Enable Subscribe to comments |
---|
141 | $settings->put('subscribetocomments_active', |
---|
142 | true,'boolean','Enable Subscribe to comments'); |
---|
143 | |
---|
144 | # put settings, will set empty settings |
---|
145 | subscribeToComments::setDefaultSettings(false,$settings->lang); |
---|
146 | |
---|
147 | http::redirect($p_url.'&saveconfig=1'); |
---|
148 | } else { |
---|
149 | # Disable Subscribe to comments |
---|
150 | $settings->put('subscribetocomments_active', |
---|
151 | false,'boolean','Enable Subscribe to comments'); |
---|
152 | |
---|
153 | http::redirect($p_url); |
---|
154 | } |
---|
155 | } |
---|
156 | # test email |
---|
157 | elseif (isset($_POST['test'])) |
---|
158 | { |
---|
159 | # mail |
---|
160 | $title = sprintf(__('Test email from your blog - %s'),$core->blog->name); |
---|
161 | $content = sprintf(__('The plugin % works.'),__('Subscribe to comments')); |
---|
162 | subscribeToComments::checkEmail($_POST['test_email']); |
---|
163 | subscribeToComments::mail($_POST['test_email'],$title,$content); |
---|
164 | http::redirect($p_url.'&test=1'); |
---|
165 | } |
---|
166 | # restore default settings |
---|
167 | elseif (isset($_POST['restore'])) |
---|
168 | { |
---|
169 | subscribeToComments::setDefaultSettings(true,$_POST['lang']); |
---|
170 | |
---|
171 | http::redirect($p_url.'&restore=1'); |
---|
172 | } |
---|
173 | # save settings |
---|
174 | elseif (!empty($_POST['saveconfig'])) |
---|
175 | { |
---|
176 | # Enable Subscribe to comments |
---|
177 | $settings->put('subscribetocomments_active', |
---|
178 | (!empty($_POST['subscribetocomments_active'])),'boolean', |
---|
179 | 'Enable Subscribe to comments'); |
---|
180 | |
---|
181 | subscribeToComments::checkEmail( |
---|
182 | $_POST['subscribetocomments_email_from']); |
---|
183 | # Define From: header of outbound emails |
---|
184 | $settings->put('subscribetocomments_email_from', |
---|
185 | $_POST['subscribetocomments_email_from'], |
---|
186 | 'text','Define From: header of outbound emails'); |
---|
187 | |
---|
188 | # Allowed post types |
---|
189 | $settings->put('subscribetocomments_post_types', |
---|
190 | serialize($_POST['post_types']), |
---|
191 | 'string','Allowed post types'); |
---|
192 | |
---|
193 | # Account subject |
---|
194 | $settings->put('subscribetocomments_account_subject', |
---|
195 | subscribeToComments::format($available_tags,$_POST['account_subject'],false,true), |
---|
196 | 'text','Account subject'); |
---|
197 | # Account content |
---|
198 | $settings->put('subscribetocomments_account_content', |
---|
199 | subscribeToComments::format($available_tags,$_POST['account_content'],false,true), |
---|
200 | 'text','Account content'); |
---|
201 | |
---|
202 | $available_tags = $tags_subscribe; |
---|
203 | # Send an email for each subscription |
---|
204 | $settings->put('subscribetocomments_subscribe_active', |
---|
205 | (!empty($_POST['subscribetocomments_subscribe_active'])),'boolean', |
---|
206 | 'Send an email for each subscription'); |
---|
207 | # Subscription subject |
---|
208 | $settings->put('subscribetocomments_subscribe_subject', |
---|
209 | subscribeToComments::format($available_tags,$_POST['subscribe_subject'],false,true),'text','Subscription subject'); |
---|
210 | # Subscription content |
---|
211 | $settings->put('subscribetocomments_subscribe_content', |
---|
212 | subscribeToComments::format($available_tags,$_POST['subscribe_content'],false,true),'text','Subscription content'); |
---|
213 | |
---|
214 | $available_tags = $tags_comment; |
---|
215 | # Comment subject |
---|
216 | $settings->put('subscribetocomments_comment_subject', |
---|
217 | subscribeToComments::format($available_tags,$_POST['comment_subject'],false,true),'text','Comment subject'); |
---|
218 | # Comment content |
---|
219 | $settings->put('subscribetocomments_comment_content', |
---|
220 | subscribeToComments::format($available_tags,$_POST['comment_content'],false,true),'text','Comment content'); |
---|
221 | |
---|
222 | $available_tags = $tags_email; |
---|
223 | # Email subject |
---|
224 | $settings->put('subscribetocomments_email_subject', |
---|
225 | subscribeToComments::format($available_tags,$_POST['email_subject'],false,true),'text','Email subject'); |
---|
226 | # Email content |
---|
227 | $settings->put('subscribetocomments_email_content', |
---|
228 | subscribeToComments::format($available_tags,$_POST['email_content'],false,true),'text','Email content'); |
---|
229 | |
---|
230 | http::redirect($p_url.'&saveconfig=1'); |
---|
231 | } |
---|
232 | elseif (!empty($_POST['saveconfig_display'])) |
---|
233 | { |
---|
234 | # display |
---|
235 | $settings->put('subscribetocomments_tpl_checkbox', |
---|
236 | (!empty($_POST['subscribetocomments_tpl_checkbox'])),'boolean', |
---|
237 | 'Checkbox in comment form'); |
---|
238 | $settings->put('subscribetocomments_tpl_css', |
---|
239 | (!empty($_POST['subscribetocomments_tpl_css'])),'boolean', |
---|
240 | 'Add CSS rule'); |
---|
241 | $settings->put('subscribetocomments_tpl_link', |
---|
242 | (!empty($_POST['subscribetocomments_tpl_link'])),'boolean', |
---|
243 | 'Link to Subscribe to comments page'); |
---|
244 | |
---|
245 | http::redirect($p_url.'&saveconfig=1&tab=display'); |
---|
246 | } |
---|
247 | } |
---|
248 | catch (Exception $e) |
---|
249 | { |
---|
250 | $core->error->add($e->getMessage()); |
---|
251 | } |
---|
252 | |
---|
253 | if (isset($_GET['test'])) |
---|
254 | { |
---|
255 | $msg = __('Test email sent.'); |
---|
256 | } |
---|
257 | elseif (isset($_GET['restore'])) |
---|
258 | { |
---|
259 | $msg = __('Settings restored.'); |
---|
260 | } |
---|
261 | elseif (isset($_GET['saveconfig'])) |
---|
262 | { |
---|
263 | $msg = __('Configuration successfully updated.'); |
---|
264 | } |
---|
265 | |
---|
266 | if (isset($_GET['tab'])) |
---|
267 | { |
---|
268 | $default_tab = $_GET['tab']; |
---|
269 | } |
---|
270 | |
---|
271 | ?> |
---|
272 | <html> |
---|
273 | <head> |
---|
274 | <title><?php echo __('Subscribe to comments'); ?></title> |
---|
275 | <?php echo dcPage::jsPageTabs($default_tab); ?> |
---|
276 | <style type="text/css"> |
---|
277 | p.code { |
---|
278 | border:1px solid #ccc; |
---|
279 | width:100%; |
---|
280 | overflow:auto; |
---|
281 | white-space:pre; |
---|
282 | } |
---|
283 | textarea {width:100%;} |
---|
284 | </style> |
---|
285 | <script type="text/javascript"> |
---|
286 | //<![CDATA[ |
---|
287 | $(document).ready(function() { |
---|
288 | /*$('.checkboxes-helpers').each(function() { |
---|
289 | dotclear.checkboxesHelpers(this); |
---|
290 | });*/ |
---|
291 | $('div.code').hide(); |
---|
292 | $('#display input[type="checkbox"]').each(function() { |
---|
293 | $(this).css({margin:'10px'}); |
---|
294 | $(this).click(function() { |
---|
295 | if ($(this).attr('checked')) { |
---|
296 | $('#'+$(this).attr('id').replace('subscribetocomments','code')).slideUp("slow"); |
---|
297 | } else { |
---|
298 | $('#'+$(this).attr('id').replace('subscribetocomments','code')).slideDown("slow"); |
---|
299 | } |
---|
300 | }); |
---|
301 | }); |
---|
302 | $('#restore_button').click(function() { |
---|
303 | return(window.confirm('<?php echo __('Restore default settings? The old settings will be deleted.'); ?>')); |
---|
304 | }); |
---|
305 | }); |
---|
306 | //]]> |
---|
307 | </script> |
---|
308 | </head> |
---|
309 | <body> |
---|
310 | |
---|
311 | <h2><?php echo html::escapeHTML($core->blog->name).' › '.__('Subscribe to comments'); ?></h2> |
---|
312 | |
---|
313 | <?php |
---|
314 | if (!empty($msg)) {echo '<p class="message">'.$msg.'</p>';} |
---|
315 | if (!$core->plugins->moduleExists('metadata')) { |
---|
316 | echo |
---|
317 | '<div class="error"><strong>'.__('Error:').'</strong><ul><li>'. |
---|
318 | __('Unable to find metadata plugin').'</li></ul></div>'; |
---|
319 | } |
---|
320 | ?> |
---|
321 | |
---|
322 | <?php if (!$settings->subscribetocomments_active) |
---|
323 | { ?> |
---|
324 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
325 | <p><?php echo(__('The plugin is disabled.')); ?></p> |
---|
326 | <p> |
---|
327 | <?php echo(form::checkbox('subscribetocomments_active',1, |
---|
328 | $settings->subscribetocomments_active)); ?> |
---|
329 | <label class="classic" for="subscribetocomments_active"> |
---|
330 | <?php printf(__('Enable %s'),__('Subscribe to comments')); ?></label> |
---|
331 | </p> |
---|
332 | |
---|
333 | <p><?php echo $core->formNonce(); ?></p> |
---|
334 | <p><input type="submit" name="enable" value="<?php echo __('Save configuration'); ?>" /></p> |
---|
335 | </form> |
---|
336 | <?php } else { ?> |
---|
337 | <div class="multi-part" id="settings" title="<?php echo __('Settings'); ?>"> |
---|
338 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
339 | <p> |
---|
340 | <?php echo(form::checkbox('subscribetocomments_active',1, |
---|
341 | $settings->subscribetocomments_active)); ?> |
---|
342 | <label class="classic" for="subscribetocomments_active"> |
---|
343 | <?php printf(__('Enable %s'),__('Subscribe to comments')); ?></label> |
---|
344 | </p> |
---|
345 | <p> |
---|
346 | <label for="subscribetocomments_email_from"> |
---|
347 | <?php echo(__('Define From: header of outbound emails:'). |
---|
348 | form::field('subscribetocomments_email_from',80,80, |
---|
349 | $settings->subscribetocomments_email_from)); ?> |
---|
350 | </label> |
---|
351 | </p> |
---|
352 | |
---|
353 | <h3><?php echo(__('Post types')); ?></h3> |
---|
354 | <p><?php printf(__('Enable %s with the following post types:'), |
---|
355 | __('Subscribe to comments')); ?></p> |
---|
356 | <?php |
---|
357 | $available_post_types = subscribeToComments::getPostTypes(true); |
---|
358 | $post_types = subscribeToComments::getAllowedPostTypes(); |
---|
359 | if (!empty($available_post_types)) |
---|
360 | { |
---|
361 | echo '<ul>'; |
---|
362 | foreach ($available_post_types as $type) |
---|
363 | { |
---|
364 | echo('<li>'.form::checkbox(array('post_types[]',$type),$type, |
---|
365 | in_array($type,$post_types)). |
---|
366 | ' <label class="classic" for="'.$type.'">'.$type. |
---|
367 | '</label></li>'); |
---|
368 | } |
---|
369 | echo '</ul>'; |
---|
370 | } |
---|
371 | else |
---|
372 | { |
---|
373 | echo('<p>'.__('No entry yet. Create a new entry.').'</p>'); |
---|
374 | } |
---|
375 | ?> |
---|
376 | |
---|
377 | <!--<p class="checkboxes-helpers"></p>--> |
---|
378 | |
---|
379 | <h3><?php echo(__('Email formatting')); ?></h3> |
---|
380 | <p><?php echo(__('You can format the emails using the following tags.').' '. |
---|
381 | __('Each tag will be replaced by the associated value.')); ?></p> |
---|
382 | <h3><?php echo(__('Tags available in all the contexts')); ?></h3> |
---|
383 | |
---|
384 | <table class="clear"> |
---|
385 | <thead> |
---|
386 | <tr><th><?php echo(__('Tag')); ?></th><th><?php echo(__('Value')); ?></th></tr> |
---|
387 | </thead> |
---|
388 | <tbody> |
---|
389 | <?php tbody($tags_global); ?> |
---|
390 | </tbody> |
---|
391 | </table> |
---|
392 | |
---|
393 | <fieldset> |
---|
394 | <legend><?php echo(__('Email sent when an account is created or if a subscriber request it')); ?></legend> |
---|
395 | <p> |
---|
396 | <label for="account_subject"><?php echo(__('Subject:'). |
---|
397 | form::field('account_subject',80,255, |
---|
398 | html::escapeHTML(subscribeToComments::format($tags_global, |
---|
399 | subscribeToComments::getSetting('account_subject'),true)))); ?> |
---|
400 | </label> |
---|
401 | </p> |
---|
402 | <p> |
---|
403 | <label for="account_content"><?php echo(__('Content:'). |
---|
404 | form::textarea('account_content',80,15, |
---|
405 | html::escapeHTML(subscribeToComments::format($tags_global, |
---|
406 | subscribeToComments::getSetting('account_content'),true)))); ?> |
---|
407 | </label> |
---|
408 | </p> |
---|
409 | </fieldset> |
---|
410 | |
---|
411 | <fieldset> |
---|
412 | <legend><?php echo(__('Email sent when a subscriber subscribe to the comments of a post')); ?></legend> |
---|
413 | <p> |
---|
414 | <?php echo(form::checkbox('subscribetocomments_subscribe_active',1, |
---|
415 | $settings->subscribetocomments_subscribe_active)); ?> |
---|
416 | <label class="classic" for="subscribetocomments_subscribe_active"> |
---|
417 | <?php echo(__('Send an email for each subscription to the comments of a post')); ?></label> |
---|
418 | </p> |
---|
419 | <h3><?php echo(__('Available tags')); ?></h3> |
---|
420 | <table class="clear"> |
---|
421 | <thead> |
---|
422 | <tr><th><?php echo(__('Tag')); ?></th><th><?php echo(__('Value')); ?></th></tr> |
---|
423 | </thead> |
---|
424 | <tbody> |
---|
425 | <?php tbody($tags_subscribe); ?> |
---|
426 | </tbody> |
---|
427 | </table> |
---|
428 | <p> |
---|
429 | <label for="subscription_subject"><?php echo(__('Subject:'). |
---|
430 | form::field('subscribe_subject',80,255, |
---|
431 | html::escapeHTML(subscribeToComments::format($tags_subscribe, |
---|
432 | subscribeToComments::getSetting('subscribe_subject'),true)))); ?> |
---|
433 | </label> |
---|
434 | </p> |
---|
435 | <p> |
---|
436 | <label for="subscription_content"><?php echo(__('Content:'). |
---|
437 | form::textarea('subscribe_content',80,15, |
---|
438 | html::escapeHTML(subscribeToComments::format($tags_subscribe, |
---|
439 | subscribeToComments::getSetting('subscribe_content'),true)))); ?> |
---|
440 | </label> |
---|
441 | </p> |
---|
442 | </fieldset> |
---|
443 | |
---|
444 | <fieldset> |
---|
445 | <legend><?php echo(__('Email sent when a new comment is published')); ?></legend> |
---|
446 | <h3><?php echo(__('Available tags')); ?></h3> |
---|
447 | <table class="clear"> |
---|
448 | <thead> |
---|
449 | <tr><th><?php echo(__('Tag')); ?></th><th><?php echo(__('Value')); ?></th></tr> |
---|
450 | </thead> |
---|
451 | <tbody> |
---|
452 | <?php tbody($tags_comment); ?> |
---|
453 | </tbody> |
---|
454 | </table> |
---|
455 | <p> |
---|
456 | <label for="comment_subject"><?php echo(__('Subject:'). |
---|
457 | form::field('comment_subject',80,255, |
---|
458 | html::escapeHTML(subscribeToComments::format($tags_comment, |
---|
459 | subscribeToComments::getSetting('comment_subject'),true)))); ?> |
---|
460 | </label> |
---|
461 | </p> |
---|
462 | <p> |
---|
463 | <label for="comment_content"><?php echo(__('Content:'). |
---|
464 | form::textarea('comment_content',80,15, |
---|
465 | html::escapeHTML(subscribeToComments::format($tags_comment, |
---|
466 | subscribeToComments::getSetting('comment_content'),true)))); ?> |
---|
467 | </label> |
---|
468 | </p> |
---|
469 | </fieldset> |
---|
470 | |
---|
471 | <fieldset> |
---|
472 | <legend><?php echo(__('Email sent when a subscriber want to change his email address')); ?></legend> |
---|
473 | <h3><?php echo(__('Available tags')); ?></h3> |
---|
474 | <table class="clear"> |
---|
475 | <thead> |
---|
476 | <tr><th><?php echo(__('Tag')); ?></th><th><?php echo(__('Value')); ?></th></tr> |
---|
477 | </thead> |
---|
478 | <tbody> |
---|
479 | <?php tbody($tags_email); ?> |
---|
480 | </tbody> |
---|
481 | </table> |
---|
482 | <p> |
---|
483 | <label for="email_subject"><?php echo(__('Subject:'). |
---|
484 | form::field('email_subject',80,255, |
---|
485 | html::escapeHTML(subscribeToComments::format($tags_email, |
---|
486 | subscribeToComments::getSetting('email_subject'),true)))); ?> |
---|
487 | </label> |
---|
488 | </p> |
---|
489 | <p> |
---|
490 | <label for="email_content"><?php echo(__('Content:'). |
---|
491 | form::textarea('email_content',80,15, |
---|
492 | html::escapeHTML(subscribeToComments::format($tags_email, |
---|
493 | subscribeToComments::getSetting('email_content'),true)))); ?> |
---|
494 | </label> |
---|
495 | </p> |
---|
496 | </fieldset> |
---|
497 | |
---|
498 | <p><?php echo $core->formNonce(); ?></p> |
---|
499 | <p><input type="submit" name="saveconfig" value="<?php echo __('Save configuration'); ?>" /></p> |
---|
500 | </form> |
---|
501 | </div> |
---|
502 | |
---|
503 | <div class="multi-part" id="display" title="<?php echo __('Display'); ?>"> |
---|
504 | <h3><?php echo(__('Display')); ?></h3> |
---|
505 | <p><?php echo( |
---|
506 | __('This plugin needs to add some code on the post page.').' '. |
---|
507 | __('This can be done automatically by checking the following checkboxes.')); ?></p> |
---|
508 | <p><?php echo(__('If you want to customize the display on the post page (the post.hml file of your theme), uncheck the following checkboxes and follow the instructions under each checkbox:')); ?></p> |
---|
509 | <p><?php printf(__('You can use the plugin <strong>%s</strong> to edit the file <strong>post.html</strong>.'), |
---|
510 | __('Theme Editor')); ?></p> |
---|
511 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
512 | <fieldset> |
---|
513 | <legend><?php printf(__('Install %s on the post page.'), |
---|
514 | __('Subscribe to comments')); ?></legend> |
---|
515 | <p> |
---|
516 | <?php echo(form::checkbox('subscribetocomments_tpl_checkbox',1, |
---|
517 | $settings->subscribetocomments_tpl_checkbox)); ?> |
---|
518 | <label class="classic" for="subscribetocomments_tpl_checkbox"> |
---|
519 | <?php printf(__('Add the <strong>%s</strong> checkbox in the comment form'), |
---|
520 | __('Receive following comments by email')); ?> |
---|
521 | </label> |
---|
522 | </p> |
---|
523 | <div class="code" id="code_tpl_checkbox"> |
---|
524 | <h4><?php echo(__('or')); ?></h4> |
---|
525 | <p><?php echo(__('insert this in the comment form (suggestion: in the <code><fieldset></code> before the <code></form></code> tag):')); ?></p> |
---|
526 | <p class="code"><code><?php |
---|
527 | echo html::escapeHTML($post_form); |
---|
528 | ?></code></p> |
---|
529 | </div> |
---|
530 | |
---|
531 | <hr /> |
---|
532 | |
---|
533 | <p> |
---|
534 | <?php printf(__('If the <strong>%s</strong> checkbox is not displayed correctly and the blog use Blowup or Blue Silence theme, check this:'), |
---|
535 | __('Receive following comments by email')); ?> |
---|
536 | </p> |
---|
537 | <p> |
---|
538 | <?php echo(form::checkbox('subscribetocomments_tpl_css',1, |
---|
539 | $settings->subscribetocomments_tpl_css)); ?> |
---|
540 | <label class="classic" for="subscribetocomments_tpl_css"> |
---|
541 | <?php printf(__('Add a CSS rule to style the <strong>%1$s</strong> checkbox'), |
---|
542 | __('Receive following comments by email')); ?> |
---|
543 | </label> |
---|
544 | </p> |
---|
545 | <div class="code" id="code_tpl_css"> |
---|
546 | <h4><?php echo(__('or')); ?></h4> |
---|
547 | <p><?php echo(__('add this CSS rule at the end of the file <strong>style.css</strong>')); ?></p> |
---|
548 | <p class="code"><code><?php |
---|
549 | echo($post_css); |
---|
550 | ?></code></p> |
---|
551 | </div> |
---|
552 | |
---|
553 | <hr /> |
---|
554 | |
---|
555 | <p> |
---|
556 | <?php echo(form::checkbox('subscribetocomments_tpl_link',1, |
---|
557 | $settings->subscribetocomments_tpl_link)); ?> |
---|
558 | <label class="classic" for="subscribetocomments_tpl_link"> |
---|
559 | <?php printf(__('Add a link to the <strong>%s</strong> page between the comments and the trackbacks'), |
---|
560 | __('Subscribe to comments')); ?> |
---|
561 | </label> |
---|
562 | </p> |
---|
563 | <p><?php printf(__('The code will appear after the %s tag.'), |
---|
564 | '<code><tpl:EntryIf comments_active="1"></code>'); ?></p> |
---|
565 | <div class="code" id="code_tpl_link"> |
---|
566 | <h4><?php echo(__('or')); ?></h4> |
---|
567 | <p><?php echo __('insert this anywhere on the page (suggestion: just after the <code></form></code> tag):'); ?></p> |
---|
568 | <p class="code"><code><?php |
---|
569 | echo html::escapeHTML($post_link); |
---|
570 | ?></code></p> |
---|
571 | </div> |
---|
572 | </fieldset> |
---|
573 | |
---|
574 | <p><?php echo $core->formNonce(); ?></p> |
---|
575 | <p><input type="submit" name="saveconfig_display" value="<?php echo __('Save configuration'); ?>" /></p> |
---|
576 | </form> |
---|
577 | </div> |
---|
578 | |
---|
579 | <div class="multi-part" id="restore" title="<?php echo __('Restore'); ?>"> |
---|
580 | <h3><?php echo(__('Restore default settings')); ?></h3> |
---|
581 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
582 | <p> |
---|
583 | <label for="lang"> |
---|
584 | <?php echo(__('Language:'). |
---|
585 | form::combo('lang',$lang_combo,$settings->lang)); |
---|
586 | ?> |
---|
587 | </label> |
---|
588 | </p> |
---|
589 | <p><?php echo $core->formNonce(); ?></p> |
---|
590 | <p><input type="submit" name="restore" id="restore_button" value="<?php echo __('Restore default settings'); ?>" /></p> |
---|
591 | </form> |
---|
592 | </div> |
---|
593 | |
---|
594 | <div class="multi-part" id="subscribers" title="<?php echo __('Subscribers'); ?>"> |
---|
595 | <h3><?php echo(__('Subscribers')); ?></h3> |
---|
596 | <?php |
---|
597 | $rs = $core->con->select('SELECT email, user_key '. |
---|
598 | 'FROM '.$core->prefix.'comment_subscriber '. |
---|
599 | 'ORDER BY email ASC'); |
---|
600 | |
---|
601 | if ($rs->isEmpty()) |
---|
602 | { |
---|
603 | echo('<p>'.__('no subscriber').'</p>'); |
---|
604 | } |
---|
605 | else |
---|
606 | { |
---|
607 | echo('<ul>'); |
---|
608 | while ($rs->fetch()) |
---|
609 | { |
---|
610 | echo('<li><a href="'. |
---|
611 | subscriber::pageLink($rs->email,$rs->user_key).'">'. |
---|
612 | $rs->email.'</a></li>'); |
---|
613 | } |
---|
614 | echo('</ul>'); |
---|
615 | } |
---|
616 | ?> |
---|
617 | </div> |
---|
618 | |
---|
619 | <div id="help" title="<?php echo __('Help'); ?>"> |
---|
620 | <div class="help-content"> |
---|
621 | <h2><?php echo(__('Help')); ?></h2> |
---|
622 | <p><?php printf(__('%s send notification emails to the subscribers of a post when:'),__('Subscribe to comments')); ?></p> |
---|
623 | <ul> |
---|
624 | <li><?php echo(__('a comment is posted and published immediatly')); ?></li> |
---|
625 | <li><?php echo(__('a pending comment is published')); ?> |
---|
626 | </ul> |
---|
627 | <p><?php echo __('If this weblog is hosted by free.fr, create a <code>/sessions/</code> directory in the root directory of the website.'); ?></p> |
---|
628 | <p><?php echo __('To use this plugin, you have to test if the server can send emails:'); ?></p> |
---|
629 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
630 | <fieldset> |
---|
631 | <legend><?php echo __('Test'); ?></legend> |
---|
632 | <p> |
---|
633 | <label for="test_email"><?php echo(__('Email address')); ?></label> |
---|
634 | <?php echo(form::field('test_email',40,255, |
---|
635 | html::escapeHTML($core->auth->getInfo('user_email')))); ?> |
---|
636 | </p> |
---|
637 | <p><?php printf( |
---|
638 | __('This will send a email, if you don\'t receive it, try to <a href="%s">change the way Dotclear send emails</a>.'), |
---|
639 | 'http://doc.dotclear.net/2.0/admin/install/custom-sendmail'); ?></p> |
---|
640 | <p><?php echo $core->formNonce(); ?></p> |
---|
641 | <p><input type="submit" name="test" value="<?php echo __('Try to send an email'); ?>" /></p> |
---|
642 | </fieldset> |
---|
643 | </form> |
---|
644 | <hr /> |
---|
645 | <p><?php printf(__('Inspired by <a href="%1$s">%2$s</a>'), |
---|
646 | 'http://txfx.net/code/wordpress/subscribe-to-comments/', |
---|
647 | __('Subscribe to comments for WordPress')); ?></p> |
---|
648 | </div> |
---|
649 | </div> |
---|
650 | |
---|
651 | <hr /> |
---|
652 | |
---|
653 | <p> |
---|
654 | <?php printf(__('URL of the %s page:'),__('Subscribe to comments')); ?> |
---|
655 | <br /> |
---|
656 | <code><?php echo(subscribeToComments::url()); ?></code> |
---|
657 | <br /> |
---|
658 | <a href="<?php echo(subscribeToComments::url()); ?>"> |
---|
659 | <?php printf(__('View the %s page'),__('Subscribe to comments')); ?></a> |
---|
660 | </p> |
---|
661 | <?php } ?> |
---|
662 | </body> |
---|
663 | </html> |
---|