|
1 |
| -<?php |
2 |
| -/* -- BEGIN LICENSE BLOCK ----------------------------------------------------- |
3 |
| - * This file is part of plugin dcScript for Dotclear 2. |
4 |
| - * Copyright © 2014-2016 Gvx |
5 |
| - * Licensed under the GPL version 2.0 license. |
6 |
| - * (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
7 |
| - * -- END LICENSE BLOCK -----------------------------------------------------*/ |
8 |
| -if(!defined('DC_CONTEXT_ADMIN')) { return; } |
9 |
| - |
10 |
| -dcPage::checkSuper(); |
11 |
| - |
12 |
| -if (isset($_POST['save'])) { |
13 |
| - try { |
14 |
| - $core->dcScript->settings('enabled', !empty($_POST['enabled'])); |
15 |
| - $core->dcScript->settings('header_code_enabled', !empty($_POST['header_code_enabled'])); |
16 |
| - $core->dcScript->settings('footer_code_enabled', !empty($_POST['footer_code_enabled'])); |
17 |
| - $core->dcScript->settings('backup_ext', html::escapeHTML($_POST['backup'])); |
18 |
| - $core->blog->triggerBlog(); |
19 |
| - dcPage::addSuccessNotice(__('Configuration successfully updated.')); |
20 |
| - } catch(exception $e) { |
21 |
| - //$core->error->add($e->getMessage()); |
22 |
| - $core->error->add(__('Unable to save the configuration')); |
23 |
| - } |
24 |
| - if(!empty($_GET['redir']) && strpos($_GET['redir'], 'p='.$core->dcScript->info('id')) === false) { |
25 |
| - $core->error->add(__('Redirection not found')); |
26 |
| - $core->adminurl->redirect('admin.home'); |
27 |
| - } |
28 |
| - http::redirect($_REQUEST['redir']); |
29 |
| -} |
30 |
| - |
31 |
| -echo |
32 |
| - '<div class="fieldset"> |
33 |
| - <h3>'.__('Activation').'</h3> |
34 |
| - <p> |
35 |
| - '.form::checkbox('enabled','1',$core->dcScript->settings('enabled')). |
36 |
| - '<label class="classic" for="enabled"> |
37 |
| - '.sprintf(__('Enable %s on this blog'), html::escapeHTML(__($core->dcScript->info('name')))). |
38 |
| - '</label> |
39 |
| - </p> |
40 |
| - <p class="form-note">'.__('Enable the plugin on this blog.').'</p> |
41 |
| - </div> |
42 |
| - <div id="options"> |
43 |
| - <div class="fieldset"> |
44 |
| - <h3>'.__('Active codes').'</h3> |
45 |
| - <div class="two-cols clear"> |
46 |
| - <div class="col"> |
47 |
| - <p> |
48 |
| - '.form::checkbox('header_code_enabled','1',$core->dcScript->settings('header_code_enabled')) |
49 |
| - .'<label class="classic" for="header_code_enabled">'.__('Enable header code').'</label> |
50 |
| - </p> |
51 |
| - <p class="form-note">'.__('Enable public header code.').'</p> |
52 |
| - </div> |
53 |
| - <div class="col"> |
54 |
| - <p> |
55 |
| - '.form::checkbox('footer_code_enabled','1',$core->dcScript->settings('footer_code_enabled')) |
56 |
| - .'<label class="classic" for="footer_code_enabled">'.__('Enable footer code').'</label> |
57 |
| - </p> |
58 |
| - <p class="form-note">'.__('Enable public footer code.').'</p> |
59 |
| - </div> |
60 |
| - </div> |
61 |
| - <div class="clear"></div> |
62 |
| - </div> |
63 |
| - <div class="fieldset clear"> |
64 |
| - <h3>'.__('Options').'</h3> |
65 |
| - <p> |
66 |
| - <label class="classic" for="backup">'.__('Extension Backup Files').' : </label> |
67 |
| - '.form::field('backup',25,255,$core->dcScript->settings('backup_ext'),'classic').' |
68 |
| - </p> |
69 |
| - <p class="form-note">'.__('Default extension backup files.').'</p> |
70 |
| - </div> |
71 |
| - </div> |
72 |
| -'; |
73 |
| -dcPage::helpBlock('dcScript-config'); |
| 1 | +<?php |
| 2 | +/* -- BEGIN LICENSE BLOCK ----------------------------------------------------- |
| 3 | + * This file is part of plugin dcScript for Dotclear 2. |
| 4 | + * Copyright © 2014-2020Gvx |
| 5 | + * Licensed under the GPL version 2.0 license. |
| 6 | + * (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
| 7 | + * -- END LICENSE BLOCK -----------------------------------------------------*/ |
| 8 | +if(!defined('DC_CONTEXT_ADMIN')) { return; } |
| 9 | + |
| 10 | +dcPage::checkSuper(); |
| 11 | + |
| 12 | +if (isset($_POST['save'])) { |
| 13 | + try { |
| 14 | + $core->dcScript->settings('enabled', !empty($_POST['enabled']), true); |
| 15 | + $core->dcScript->settings('header_code_enabled', !empty($_POST['header_code_enabled']), true); |
| 16 | + $core->dcScript->settings('footer_code_enabled', !empty($_POST['footer_code_enabled']), true); |
| 17 | + $core->dcScript->settings('backup_ext', html::escapeHTML($_POST['backup']), true); |
| 18 | + $core->blog->triggerBlog(); |
| 19 | + dcPage::addSuccessNotice(__('Configuration successfully updated.')); |
| 20 | + } catch(exception $e) { |
| 21 | + //$core->error->add($e->getMessage()); |
| 22 | + $core->error->add(__('Unable to save the configuration')); |
| 23 | + } |
| 24 | + if(!empty($_GET['redir']) && strpos($_GET['redir'], 'p='.$core->dcScript->info('id')) === false) { |
| 25 | + $core->error->add(__('Redirection not found')); |
| 26 | + $core->adminurl->redirect('admin.home'); |
| 27 | + } |
| 28 | + http::redirect($_REQUEST['redir']); |
| 29 | +} |
| 30 | + |
| 31 | +echo |
| 32 | + '<div class="fieldset"> |
| 33 | + <h3>'.__('Activation').'</h3> |
| 34 | + <p> |
| 35 | + '.form::checkbox('enabled','1',$core->dcScript->settings('enabled', null, true)). |
| 36 | + '<label class="classic" for="enabled"> |
| 37 | + '.sprintf(__('Enable %s on this blog'), html::escapeHTML(__($core->dcScript->info('name')))). |
| 38 | + '</label> |
| 39 | + </p> |
| 40 | + <p class="form-note">'.__('Enable the plugin on this blog.').'</p> |
| 41 | + </div> |
| 42 | + <div id="options"> |
| 43 | + <div class="fieldset"> |
| 44 | + <h3>'.__('Active codes').'</h3> |
| 45 | + <div class="two-cols clear"> |
| 46 | + <div class="col"> |
| 47 | + <p> |
| 48 | + '.form::checkbox('header_code_enabled','1',$core->dcScript->settings('header_code_enabled', null, true)) |
| 49 | + .'<label class="classic" for="header_code_enabled">'.__('Enable header code').'</label> |
| 50 | + </p> |
| 51 | + <p class="form-note">'.__('Enable public header code.').'</p> |
| 52 | + </div> |
| 53 | + <div class="col"> |
| 54 | + <p> |
| 55 | + '.form::checkbox('footer_code_enabled','1',$core->dcScript->settings('footer_code_enabled', null, true)) |
| 56 | + .'<label class="classic" for="footer_code_enabled">'.__('Enable footer code').'</label> |
| 57 | + </p> |
| 58 | + <p class="form-note">'.__('Enable public footer code.').'</p> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + <div class="clear"></div> |
| 62 | + </div> |
| 63 | + <div class="fieldset clear"> |
| 64 | + <h3>'.__('Options').'</h3> |
| 65 | + <p> |
| 66 | + <label class="classic" for="backup">'.__('Extension Backup Files').' : </label> |
| 67 | + '.form::field('backup',25,255,$core->dcScript->settings('backup_ext', null, true),'classic').' |
| 68 | + </p> |
| 69 | + <p class="form-note">'.__('Default extension backup files.').'</p> |
| 70 | + </div> |
| 71 | + </div> |
| 72 | +'; |
| 73 | +dcPage::helpBlock('dcScript-config'); |
0 commit comments