1 | <?php |
---|
2 | # ***** BEGIN LICENSE BLOCK ***** |
---|
3 | # This file a plugin of DotClear. |
---|
4 | # Copyright (c) Marc Vachette. All rights |
---|
5 | # reserved. |
---|
6 | # |
---|
7 | #Subscription is free software; you can redistribute it and/or modify |
---|
8 | # it under the terms of the Creative Commons License "Attribution" |
---|
9 | # see the page http://creativecommons.org/licenses/by/2.0/ for more information |
---|
10 | # |
---|
11 | # Subscription is distributed in the hope that it will be useful, |
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | # Creative COmmons License for more details. |
---|
15 | # |
---|
16 | # ***** END LICENSE BLOCK ***** |
---|
17 | |
---|
18 | $core->blog->settings->setNamespace('subscription'); |
---|
19 | |
---|
20 | //Liste des SuperUsers (pour affichage des mails) |
---|
21 | $ulist = array(); |
---|
22 | $users = $core->getBlogPermissions($core->blog->id,$core->auth->isSuperAdmin()); |
---|
23 | foreach ($users as $id => $uinfos) { |
---|
24 | $rows = $core->getUser($id)->rows(); |
---|
25 | foreach ($rows as $user) { |
---|
26 | if (!empty($user['user_email'])) { |
---|
27 | $ulist[$user['user_email']] = $user['user_email']; |
---|
28 | } |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | |
---|
33 | if(isset($_POST['notify_mail_adress'])) { |
---|
34 | try { |
---|
35 | $blogs_folder_path = $_POST['blogs_folder_path']; |
---|
36 | $dotclear_folder_path = $_POST['dotclear_folder_path']; |
---|
37 | $notify_mail_adress = $_POST['notify_mail_adress']; |
---|
38 | |
---|
39 | if (empty($_POST['blogs_folder_path'])) { |
---|
40 | throw new Exception(__('No blogs folder path.')); |
---|
41 | } |
---|
42 | |
---|
43 | $core->blog->settings->setNamespace('subscription'); |
---|
44 | |
---|
45 | $core->blog->settings->put('blogs_folder_path', $blogs_folder_path, 'string', 'Blogs storage folder path', true, true); |
---|
46 | $core->blog->settings->put('dotclear_folder_path', $dotclear_folder_path, 'string', 'Dotclear folder path', true, true); |
---|
47 | $core->blog->settings->put('notify_mail_adress', $notify_mail_adress , 'string', 'Email address for notification', true, true); |
---|
48 | |
---|
49 | $core->blog->triggerBlog(); |
---|
50 | |
---|
51 | http::redirect($p_url.'&upd=1'); |
---|
52 | } |
---|
53 | catch (Exception $e) |
---|
54 | { |
---|
55 | $core->error->add($e->getMessage()); |
---|
56 | } |
---|
57 | } |
---|
58 | |
---|
59 | ?> |
---|
60 | |
---|
61 | <html> |
---|
62 | <head> |
---|
63 | <title><?php echo __('Subscription settings'); ?></title> |
---|
64 | |
---|
65 | </head> |
---|
66 | <body> |
---|
67 | |
---|
68 | <?php |
---|
69 | echo '<h2>'.__('Subscription settings').'</h2>'; |
---|
70 | |
---|
71 | if (!empty($_GET['upd'])) { |
---|
72 | echo '<p class="message">'.__('Setting have been successfully updated.').'</p>'; |
---|
73 | } |
---|
74 | |
---|
75 | echo |
---|
76 | '<form action="'.$p_url.'" method="post" enctype="multipart/form-data">'. |
---|
77 | '<fieldset><legend>'.__('Paths').'</legend>'. |
---|
78 | '<p>'.__('Set absolute paths for Doctclear installation and blogs storage folder.').'</p>'. |
---|
79 | '<p><label>'.__('Dotclear path:').' '.form::field('dotclear_folder_path',40,300,$core->blog->settings->dotclear_folder_path).'</label></p>'. |
---|
80 | '<p><label>'.__('Blogs path:').' '.form::field('blogs_folder_path',40,300,$core->blog->settings->blogs_folder_path).'</label></p>'. |
---|
81 | '</fieldset>'. |
---|
82 | '<fieldset><legend>'.__('Email adress for notification').'</legend>'. |
---|
83 | '<p><label>'.__('Adress to notify blog creation to administrator'). |
---|
84 | form::combo('notify_mail_adress',$ulist, $core->blog->settings->notify_mail_adress). |
---|
85 | '</label></p>'. |
---|
86 | |
---|
87 | '</fieldset>'; |
---|
88 | |
---|
89 | /* |
---|
90 | echo |
---|
91 | '<fieldset><legend>'.__('Presentation options').'</legend>'. |
---|
92 | '<p><label class="required" title="'.__('Required field').'">'.__('Page title:').' '. |
---|
93 | form::field('cm_page_title',30,256,html::escapeHTML($page_title)). |
---|
94 | '</label></p>'. |
---|
95 | '<p class="area"><label>'.__('Form caption:').' '. |
---|
96 | form::textarea('cm_form_caption',30,2,html::escapeHTML($form_caption)). |
---|
97 | '</label></p>'. |
---|
98 | '<p class="area"><label class="required" title="'.__('Required field').'">'.__('Confirmation message:').' '. |
---|
99 | form::textarea('cm_msg_success',30,2,html::escapeHTML($msg_success)). |
---|
100 | '</label></p>'. |
---|
101 | '<p class="area"><label class="required" title="'.__('Required field').'">'.__('Error message:').' '. |
---|
102 | form::textarea('cm_msg_error',30,2,html::escapeHTML($msg_error)). |
---|
103 | '</label></p>'. |
---|
104 | '<p class="form-note">'.__('"%s" is the error message.').'</p>'. |
---|
105 | '</fieldset>'; |
---|
106 | */ |
---|
107 | |
---|
108 | echo |
---|
109 | '<p><input type="submit" value="'.__('save').'" />'.$core->formNonce().'</p></form>'; |
---|
110 | |
---|
111 | echo '<p>'.sprintf(__('Don\'t forget to add a <a href="%s">widget</a> linking to your subscription page.'),'plugin.php?p=widgets').'</p>'; |
---|
112 | ?> |
---|
113 | </body> |
---|
114 | </html> |
---|