~quam-plures-core/quam-plures/fix-auto_p_plugin

« back to all changes in this revision

Viewing changes to qp_inc/settings/views/_general.form.php

  • Committer: EdB
  • Date: 2013-03-18 19:30:14 UTC
  • mfrom: (7602.1.58 quam-plures)
  • Revision ID: 1912webworks@gmail.com-20130318193014-qogr0c0lwd5ix8lj
quam-plures/qp5_colls-blogs_chaps-cats

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/**
3
3
 * This file implements the UI view for the general settings.
4
 
 *
5
 
 * This file is part of Quam Plures - {@link http://quamplures.net/}
6
 
 * See also {@link https://launchpad.net/quam-plures}.
7
 
 *
8
 
 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
9
 
 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
10
 
 *
11
 
 * {@internal License choice
12
 
 * - If you have received this file as part of a package, please find the license.txt file in
13
 
 *   the same folder or the closest folder above for complete license terms.
14
 
 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
15
 
 *   then you must choose one of the following licenses before using the file:
16
 
 *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
17
 
 *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
18
 
 * }}
19
 
 *
20
 
 * {@internal Open Source relicensing agreement:
21
 
 * }}
22
 
 *
23
 
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
24
 
 * @author fplanque: Francois PLANQUE.
25
 
 * @author blueyed: Daniel HAHLER.
26
 
 *
27
 
 * @package pond
 
4
 * @author {@link http://www.hackingquamplures.com/ Lee Turner}
 
5
 * @author {@link http://wonderwinds.com/ Ed Bennett}
 
6
 * @author {@link http://fplanque.net/ Francois PLANQUE}
 
7
 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}
 
8
 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
 
9
 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
 
10
 * @package settings
28
11
 */
29
 
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
 
12
if(!defined('QP_MAIN_INIT')) die('fail');
30
13
 
31
 
/**
32
 
 * @var User
33
 
 */
 
14
global $app_baseurl;
34
15
global $current_User;
35
 
 
36
 
/**
37
 
 * @var GeneralSettings
38
 
 */
 
16
global $dispatcher;
39
17
global $Settings;
40
18
 
41
 
global $dispatcher;
42
 
 
43
 
global $app_baseurl;
44
 
 
45
19
$Form = new Form( NULL, 'settings_checkchanges' );
46
 
 
47
20
$Form->begin_form( 'fform', T_('General Settings'),
48
 
        // enable all form elements on submit (so values get sent):
49
 
        array( 'onsubmit'=>'var es=this.elements; for( var i=0; i < es.length; i++ ) { es[i].disabled=false; };' ) );
50
 
 
51
 
$Form->hidden( 'ctrl', 'settings' );
 
21
        // enable all form elements on submit (so values get sent)
 
22
        array( 'onsubmit' => 'var es=this.elements; for( var i=0; i < es.length; i++ ) { es[i].disabled=false; };' ) );
 
23
$Form->hidden_ctrl();
52
24
$Form->hidden( 'action', 'update' );
53
25
$Form->hidden( 'tab', 'general' );
54
26
 
55
 
$Form->begin_fieldset( get_manual_link( 'blog_by_email' ).T_('Blog by email') );
56
 
        $Form->checkbox_input( 'eblog_enabled', $Settings->get( 'eblog_enabled' ), T_('Enable Blog by email'),
57
 
                array( 'note' => sprintf(T_('Note: This feature needs the php_imap extension (currently %s).' ), extension_loaded( 'imap' ) ? T_('loaded') : T_('NOT loaded')), 'onclick' =>
58
 
                        'document.getElementById("eblog_section").style.display = (this.checked==true ? "" : "none") ;' ) );
59
 
        // fp> TODO: this is IMPOSSIBLE to turn back on when you have no javascript!!! :((
60
 
        echo '<div id="eblog_section" style="'.( $Settings->get( 'eblog_enabled' ) ? '' : 'display:none' ).'">';
61
 
                $Form->select_input_array( 'eblog_method', $Settings->get( 'eblog_method' ), array( 'pop3' => T_('POP3'), 'imap' => T_('IMAP'), ), // TRANS: E-Mail retrieval method
62
 
                        T_('Retrieval method'), T_('Choose a method to retrieve the emails.') );
63
 
                $Form->text_input( 'eblog_server_host', $Settings->get( 'eblog_server_host' ), 40, T_('Mail Server'), T_('Hostname or IP address of your incoming mail server.'), array( 'maxlength' => 255 ) );
64
 
                $Form->text_input( 'eblog_server_port', $Settings->get( 'eblog_server_port' ), 5, T_('Port Number'), T_('Port number of your incoming mail server (Defaults: pop3: 110 imap: 143).'), array( 'maxlength' => 6 ) );
65
 
                $Form->radio( 'eblog_encrypt', $Settings->get( 'eblog_encrypt' ), array(
66
 
                                                                                                                                                        array( 'none', T_('None'), ),
67
 
                                                                                                                                                        array( 'ssl', T_('SSL'), ),
68
 
                                                                                                                                                        array( 'tls', T_('TLS'), ),
69
 
                                                                                                                                                ), T_('Encryption method') );
70
 
                $Form->text_input( 'eblog_username', $Settings->get( 'eblog_username' ), 15, T_('Account Name'), T_('User name for authenticating to your mail server.'), array( 'maxlength' => 255 ) );
71
 
                $Form->password_input( 'eblog_password', $Settings->get( 'eblog_password' ),15,T_('Password'), array( 'maxlength' => 255, 'note' => T_('Password for authenticating to your mail server.') ) );
72
 
                //TODO: have a drop down list of available blogs and categories
73
 
                $Form->text_input( 'eblog_default_category', $Settings->get( 'eblog_default_category' ), 5, T_('Default Category ID'), T_('By default emailed posts will have this category.'), array( 'maxlength' => 6 ) );
74
 
                $Form->text_input( 'eblog_subject_prefix', $Settings->get( 'eblog_subject_prefix' ), 15, T_('Subject Prefix'), T_('Email subject must start with this prefix to be imported.'), array( 'maxlength' => 255 ) );
75
 
                // eblog test links
76
 
                $getmailurl = $app_baseurl.'qp_srvc/getmail.php?test=';
77
 
                $Form->info_field(
78
 
                        T_('Perform Server Test'),
79
 
                        ' <a id="eblog_test" target="_blank" href="'.$getmailurl.'1" onclick=\'return pop_up_window( "'.$getmailurl.'1", "getmail" )\'>[ ' . T_('connection') . ' ]</a>'
80
 
                        .' <a id="eblog_test" target="_blank" href="'.$getmailurl.'2" onclick=\'return pop_up_window( "'.$getmailurl.'2", "getmail" )\'>[ ' . T_('messages') . ' ]</a>'
81
 
                        .' <a id="eblog_test" target="_blank" href="'.$getmailurl.'3" onclick=\'return pop_up_window( "'.$getmailurl.'3", "getmail" )\'>[ ' . T_('verbose') . ' ]</a>',
82
 
                        array() );
83
 
//              $Form->info_field ('','<a id="eblog_test_email" href="#" onclick=\'return pop_up_window( "' . $srvc_url . 'getmail.php?test=email", "getmail" )\'>' . T_('Test email') . '</a>',array());
84
 
                // special show / hide link
85
 
                $Form->info_field('', get_link_showhide( 'eblog_show_more','eblog_section_more', T_('Hide extra options'), T_('Show extra options...') ) );
86
 
                // TODO: provide Non-JS functionality
87
 
                echo '<div id="eblog_section_more" style="display:none">';
88
 
                        $Form->checkbox( 'eblog_novalidatecert', $Settings->get( 'eblog_novalidatecert' ), T_('Do not validate certificate'), T_('Do not validate the certificate from the TLS/SSL server. Check this if you are using a self-signed certificate.') );
89
 
                        $Form->checkbox( 'eblog_add_imgtag', $Settings->get( 'eblog_add_imgtag' ), T_('Add &lt;img&gt; tags'), T_('Display image attachments using &lt;img&gt; tags (instead of creating a link).'));
90
 
                        $Form->checkbox( 'AutoBR', $Settings->get( 'AutoBR' ), T_('Email Auto-BR'), T_('Add &lt;BR /&gt; tags to mail posts.') );
91
 
                        $Form->text_input( 'eblog_body_terminator', $Settings->get( 'eblog_body_terminator' ), 15, T_('Body Terminator'), T_('Starting from this string, everything will be ignored, including this string.'), array( 'maxlength' => 255 )  );
92
 
                        $Form->checkbox_input( 'eblog_test_mode', $Settings->get( 'eblog_test_mode' ), T_('Test Mode'), array( 'note' => T_('Check to run Blog by Email in test mode.' ) ) );
93
 
                        /* tblue> this isn't used/implemented at the moment
94
 
                        $Form->checkbox_input( 'eblog_phonemail', $Settings->get( 'eblog_phonemail' ), T_('Phone Email *'),
95
 
                                array( 'note' => 'Some mobile phone email services will send identical subject &amp; content on the same line. If you use such a service, check this option, and indicate a separator string when you compose your message, you\'ll type your subject then the separator string then you type your login:password, then the separator, then content.' ) );
96
 
                        $Form->text_input( 'eblog_phonemail_separator', $Settings->get( 'eblog_phonemail_separator' ), 15, T_('Phonemail Separator'), '',
97
 
                                                                                                array( 'maxlength' => 255 ) );*/
98
 
                echo '</div>';
99
 
        echo '</div>';
100
 
$Form->end_fieldset();
101
 
 
102
 
// --------------------------------------------
103
 
 
104
 
$Form->begin_fieldset( get_manual_link( 'categories-global' ).T_('Categories (global)'), array( 'id'=>'categories') );
105
 
        $Form->checkbox_input( 'allow_moving_chapters', $Settings->get( 'allow_moving_chapters' ), T_('Allow moving categories'), array( 'note' => T_('Check to allow moving categories accross blogs. (Caution: can break pre-existing permalinks!)' ) ) );
106
 
        $Form->radio_input( 'chapter_ordering', $Settings->get( 'chapter_ordering' ), array(
107
 
                                        array( 'value'=>'alpha', 'label'=>T_('Alphabetical') ),
108
 
                                        array( 'value'=>'manual', 'label'=>T_('Manual ') ),
109
 
                         ), T_('Ordering of categories') );
110
 
$Form->end_fieldset();
111
 
 
112
 
// --------------------------------------------
113
 
 
 
27
// Blog by email
 
28
$Form->begin_fieldset( T_('Blog by email') );
 
29
$Form->checkbox_input( 'eblog_enabled', $Settings->get( 'eblog_enabled' ), T_('Enable Blog by email'), array(
 
30
        'note' => sprintf( T_('Note: This feature needs the php_imap extension (currently %s).' ),
 
31
        extension_loaded( 'imap' ) ? T_('loaded') : T_('NOT loaded') ),
 
32
        'onclick' => 'document.getElementById("eblog_section").style.display = (this.checked==true ? "" : "none") ;' ) );
 
33
echo '<div id="eblog_section" style="'.( $Settings->get( 'eblog_enabled' ) ? '' : 'display:none' ).'">';
 
34
$Form->select_input_array( 'eblog_method', $Settings->get( 'eblog_method' ), array( 'pop3' => T_('POP3'), 'imap' => T_('IMAP'), ), // TRANS: E-Mail retrieval method
 
35
        T_('Retrieval method'), T_('Choose a method to retrieve the emails.') );
 
36
$Form->text_input( 'eblog_server_host', $Settings->get( 'eblog_server_host' ), 40, T_('Mail Server'), T_('Hostname or IP address of your incoming mail server.'), array( 'maxlength' => 255 ) );
 
37
$Form->text_input( 'eblog_server_port', $Settings->get( 'eblog_server_port' ), 5, T_('Port Number'), T_('Port number of your incoming mail server (Defaults: pop3: 110 imap: 143).'), array( 'maxlength' => 6 ) );
 
38
$Form->radio( 'eblog_encrypt', $Settings->get( 'eblog_encrypt' ), array( array( 'none', T_('None'), ), array( 'ssl', T_('SSL'), ), array( 'tls', T_('TLS'), ), ), T_('Encryption method') );
 
39
$Form->text_input( 'eblog_username', $Settings->get( 'eblog_username' ), 15, T_('Account Name'), T_('User name for authenticating to your mail server.'), array( 'maxlength' => 255 ) );
 
40
$Form->password_input( 'eblog_password', $Settings->get( 'eblog_password' ),15,T_('Password'), array( 'maxlength' => 255, 'note' => T_('Password for authenticating to your mail server.') ) );
 
41
$Form->text_input( 'eblog_default_category', $Settings->get( 'eblog_default_category' ), 5, T_('Default Category ID'), T_('By default emailed posts will have this category.'), array( 'maxlength' => 6 ) );
 
42
$Form->text_input( 'eblog_subject_prefix', $Settings->get( 'eblog_subject_prefix' ), 15, T_('Subject Prefix'), T_('Email subject must start with this prefix to be imported.'), array( 'maxlength' => 255 ) );
 
43
 
 
44
// eblog test links
 
45
$getmailurl = $app_baseurl.'qp_srvc/getmail.php?test=';
 
46
$Form->info_field( T_('Perform Server Test'),
 
47
        ' <a id="eblog_test" target="_blank" href="'.$getmailurl.'1" onclick=\'return pop_up_window( "'.$getmailurl.'1", "getmail" )\'>['.T_('connection').']</a>'
 
48
        .' <a id="eblog_test" target="_blank" href="'.$getmailurl.'2" onclick=\'return pop_up_window( "'.$getmailurl.'2", "getmail" )\'>['.T_('messages').']</a>'
 
49
        .' <a id="eblog_test" target="_blank" href="'.$getmailurl.'3" onclick=\'return pop_up_window( "'.$getmailurl.'3", "getmail" )\'>['.T_('verbose').']</a>',
 
50
        array() );
 
51
// $Form->info_field ('','<a id="eblog_test_email" href="#" onclick=\'return pop_up_window( "'.$srvc_url.'getmail.php?test=email", "getmail" )\'>'.T_('Test email').'</a>',array());
 
52
 
 
53
// special show / hide link
 
54
$Form->info_field('', get_link_showhide( 'eblog_show_more','eblog_section_more', T_('Hide extra options'), T_('Show extra options...') ) );
 
55
echo '<div id="eblog_section_more" style="display:none">';
 
56
$Form->checkbox( 'eblog_novalidatecert', $Settings->get( 'eblog_novalidatecert' ), T_('Do not validate certificate'), T_('Do not validate the certificate from the TLS/SSL server. Check this if you are using a self-signed certificate.') );
 
57
$Form->checkbox( 'eblog_add_imgtag', $Settings->get( 'eblog_add_imgtag' ), T_('Add &lt;img&gt; tags'), T_('Display image attachments using &lt;img&gt; tags (instead of creating a link).'));
 
58
$Form->checkbox( 'AutoBR', $Settings->get( 'AutoBR' ), T_('Email Auto-BR'), T_('Add &lt;BR /&gt; tags to mail posts.') );
 
59
$Form->text_input( 'eblog_body_terminator', $Settings->get( 'eblog_body_terminator' ), 15, T_('Body Terminator'), T_('Starting from this string, everything will be ignored, including this string.'), array( 'maxlength' => 255 ) );
 
60
$Form->checkbox_input( 'eblog_test_mode', $Settings->get( 'eblog_test_mode' ), T_('Test Mode'), array( 'note' => T_('Check to run Blog by Email in test mode.' ) ) );
 
61
 
 
62
/*
 
63
tblue> this isn't used/implemented at the moment
 
64
$Form->checkbox_input( 'eblog_phonemail', $Settings->get( 'eblog_phonemail' ), T_('Phone Email *'),
 
65
        array( 'note' => 'Some mobile phone email services will send identical subject &amp; content on the same line. If you use such a service, check this option, and indicate a separator string when you compose your message. 
 
66
                You will type your subject then the separator string then you type your login:password, then the separator, then content.' ) );
 
67
$Form->text_input( 'eblog_phonemail_separator', $Settings->get( 'eblog_phonemail_separator' ), 15, T_('Phonemail Separator'), '', array( 'maxlength' => 255 ) );
 
68
*/
 
69
 
 
70
echo '</div>';
 
71
echo '</div>';
 
72
$Form->end_fieldset();
 
73
 
 
74
// Categories (global)
 
75
$Form->begin_fieldset( T_('Categories (global)'), array( 'id' => 'categories') );
 
76
$Form->checkbox_input( 'allow_moving_cats', $Settings->get( 'allow_moving_cats' ), T_('Allow moving categories'), array( 'note' => T_('Check to allow moving categories accross blogs. (Caution: can break pre-existing permalinks!)' ) ) );
 
77
$Form->radio_input( 'category_order', $Settings->get( 'category_order' ), array( array( 'value' => 'alpha', 'label' => T_('Alphabetical') ), array( 'value' => 'manual', 'label' => T_('Manual ') ), ), T_('Ordering of categories') );
 
78
$Form->end_fieldset();
 
79
 
 
80
// Default user permissions
114
81
$GroupCache = & get_Cache( 'GroupCache' );
115
 
 
116
 
$Form->begin_fieldset( get_manual_link( 'default-user-permissions' ).T_('Default user permissions') );
117
 
        $Form->checkbox( 'newusers_canregister', $Settings->get( 'newusers_canregister' ), T_('New users can register'), T_('Check to allow new users to register themselves.' ) );
118
 
        $Form->select_object( 'newusers_grp_ID', $Settings->get( 'newusers_grp_ID' ), $GroupCache, T_('Group for new users'), T_('Groups determine user roles and permissions.') );
119
 
        $Form->text_input( 'newusers_level', $Settings->get( 'newusers_level' ), 1, T_('Level for new users'), T_('Levels determine hierarchy of users in blogs.' ), array( 'maxlength'=>1, 'required'=>true ) );
 
82
$Form->begin_fieldset( T_('Default user permissions') );
 
83
$Form->checkbox( 'newusers_canregister', $Settings->get( 'newusers_canregister' ), T_('New users can register'), T_('Check to allow new users to register themselves.' ) );
 
84
$Form->select_object( 'newusers_grp_ID', $Settings->get( 'newusers_grp_ID' ), $GroupCache, T_('Group for new users'), T_('Groups determine user roles and permissions.') );
 
85
$Form->text_input( 'newusers_level', $Settings->get( 'newusers_level' ), 1, T_('Level for new users'), T_('Levels determine hierarchy of users in blogs.' ), array( 'maxlength' => 1, 'required' => true ) );
120
86
$Form->end_fieldset();
121
87
 
122
 
// --------------------------------------------
123
 
 
 
88
// Display options
124
89
$BlogCache = & get_Cache( 'BlogCache' );
125
 
 
126
 
$Form->begin_fieldset( get_manual_link( 'display-options' ).T_('Display options') );
127
 
        $Form->select_input_object( 'default_blog_ID', $Settings->get( 'default_blog_ID' ), $BlogCache, T_('Default blog to display'), array(
128
 
                        'note' => T_('This blog will be displayed on index.php.').' <a href="'.$dispatcher.'?ctrl=collections&action=new">'.T_('Create new blog').' &raquo;</a>',
129
 
                        'allow_none' => true,
130
 
                        'class' => '',
131
 
                        'loop_object_method' => 'get_maxlen_name',
132
 
                        'onchange' => '' ) );
133
 
        $Form->select_input_array( 'default_admin_template', $Settings->get( 'default_admin_template' ), get_admin_templates(), T_('Default admin template'), T_('Select the admin template that all new users will start with.') );
134
 
$Form->end_fieldset();
135
 
 
136
 
// --------------------------------------------
137
 
 
138
 
$Form->begin_fieldset( get_manual_link( 'email-validation' ).T_('Email validation') );
139
 
        $Form->checkbox( 'newusers_mustvalidate', $Settings->get( 'newusers_mustvalidate' ), T_('New users must validate email'), T_('Check to require users to validate their email by clicking a link sent to them.' ) );
140
 
        $Form->checkbox( 'newusers_revalidate_emailchg', $Settings->get( 'newusers_revalidate_emailchg' ), T_('Validate email changes'), T_('Check to require users to re-validate when they change their email address.' ) );
141
 
$Form->end_fieldset();
142
 
 
143
 
// --------------------------------------------
144
 
 
145
 
// online help links "file-manager" and "online-help" need to be combined into "features"
146
 
$Form->begin_fieldset( get_manual_link( 'features' ).T_('Features') );
147
 
        $Form->checkbox_input( 'fm_enabled', $Settings->get( 'fm_enabled' ), T_('Enable filemanager'), array( 'note' => T_('Check to enable the Filemanager.' ) ) );
148
 
        $Form->checkbox_input( 'general_cache_enabled', $Settings->get( 'general_cache_enabled' ), T_('Enable general cache'), array( 'note'=>T_('Cache rendered pages that are not controlled by a template. See Blog Settings for template output caching.') ) );
149
 
        $Form->checkbox_input( 'webhelp_enabled', $Settings->get( 'webhelp_enabled' ), T_('Online Help links'), array( 'note' => T_('Online help links provide context sensitive help to certain features.' ) ) );
150
 
$Form->end_fieldset();
151
 
 
152
 
// --------------------------------------------
153
 
 
154
 
$Form->begin_fieldset( get_manual_link( 'hit-session-logging' ).T_('Hit & session logging') );
155
 
        $Form->checklist( array(
156
 
                        array( 'log_public_hits', 1, T_('on every public page'), $Settings->get( 'log_public_hits' ) ),
157
 
                        array( 'log_admin_hits', 1, T_('on every admin page'), $Settings->get( 'log_admin_hits' ) ) ),
158
 
                'log_hits', T_('Log hits') );
159
 
        // TODO: draw a warning sign if set to off
160
 
        $Form->radio_input( 'auto_prune_stats_mode', $Settings->get( 'auto_prune_stats_mode' ), array(
161
 
                        array(
162
 
                                'value'=>'off',
163
 
                                'label'=>T_('Off'),
164
 
                                'note'=>T_('Not recommended! Your database will grow very large!'),
165
 
                                'onclick'=>'jQuery("#auto_prune_stats_container").hide();' ),
166
 
                        array(
167
 
                                'value'=>'page',
168
 
                                'label'=>T_('On every page'),
169
 
                                'note'=>T_('This is guaranteed to work but uses extra resources with every page displayed.'),
170
 
                                'onclick'=>'jQuery("#auto_prune_stats_container").show();' ),
171
 
                        array(
172
 
                                'value'=>'cron',
173
 
                                'label'=>T_('With a scheduled job'),
174
 
                                'note'=>T_('Recommended if you have your scheduled jobs properly set up.'), 'onclick'=>'jQuery("#auto_prune_stats_container").show();' ) ),
175
 
                T_('Auto pruning'),
176
 
                array( 'note' => T_('Note: Even if you don\'t log hits, you still need to prune sessions!'),
177
 
                'lines' => true ) );
178
 
        echo '<div id="auto_prune_stats_container">';
179
 
        $Form->text_input( 'auto_prune_stats', $Settings->get( 'auto_prune_stats' ), 5, T_('Prune after'), T_('days. How many days of hits & sessions do you want to keep in the database for stats?') );
180
 
        echo '</div>';
181
 
        if( $Settings->get( 'auto_prune_stats_mode' ) == 'off' )
182
 
        { // hide the "days" input field, if mode set to off:
183
 
                echo '<script type="text/javascript">jQuery("#auto_prune_stats_container").hide();</script>';
184
 
        }
185
 
$Form->end_fieldset();
186
 
 
187
 
// --------------------------------------------
188
 
 
189
 
$Form->begin_fieldset( get_manual_link( 'notifications' ).T_('Notifications') );
190
 
        $Form->radio_input( 'outbound_notifications_mode', $Settings->get( 'outbound_notifications_mode' ),
191
 
                array(
192
 
                        array( 'value'=>'off', 'label'=>T_('Off'), 'note'=>T_('No notification about your new content will be sent out.') ),
193
 
                        array( 'value'=>'immediate', 'label'=>T_('Immediate'), 'note'=>T_('This is guaranteed to work but may create an annoying delay after each post.') ),
194
 
                        array( 'value'=>'cron', 'label'=>T_('Asynchronous'), 'note'=>T_('Recommended if you have your scheduled jobs properly set up.') )
195
 
                ),
196
 
                T_('Outbound pings & email notifications'),
197
 
                array( 'lines' => true ) );
198
 
$Form->end_fieldset();
199
 
 
200
 
// --------------------------------------------
201
 
 
202
 
$Form->begin_fieldset( get_manual_link('remote_publishing').T_('Remote publishing') );
203
 
        $Form->checkbox_input( 'general_xmlrpc_b2', $Settings->get('general_xmlrpc_b2'), T_('Enable B2'), array( 'note' => T_('Enable the B2 XML-RPC publishing protocol.') ) );
204
 
        $Form->checkbox_input( 'general_xmlrpc_blogger', $Settings->get('general_xmlrpc_blogger'), T_('Enable Blogger'), array( 'note' => T_('Enable the Blogger XML-RPC publishing protocol.') ) );
205
 
        $Form->checkbox_input( 'general_xmlrpc_metaweblog', $Settings->get('general_xmlrpc_metaweblog'), T_('Enable MetaWeblog'), array( 'note' => T_('Enable the MetaWeblog XML-RPC publishing protocol.') ) );
206
 
        $Form->checkbox_input( 'general_xmlrpc_mt', $Settings->get('general_xmlrpc_mt'), T_('Enable Movable Type'), array( 'note' => T_('Enable the Movable Type XML-RPC publishing protocol.') ) );
207
 
$Form->end_fieldset();
208
 
 
209
 
// --------------------------------------------
210
 
 
211
 
$Form->begin_fieldset( get_manual_link( 'security-options' ).T_('Security options') );
212
 
        $Form->text_input( 'user_minpwdlen', (int)$Settings->get( 'user_minpwdlen' ), 2, T_('Minimum password length'), T_('characters.'), array( 'maxlength'=>2, 'required'=>true ) );
213
 
        $Form->checkbox_input( 'js_passwd_hashing', (bool)$Settings->get( 'js_passwd_hashing' ), T_('Login password hashing'), array( 'note'=>T_('Check to enable the login form to hash the password with Javascript before transmitting it. This provides extra security on non-SSL connections.')) );
214
 
$Form->end_fieldset();
215
 
 
216
 
// --------------------------------------------
217
 
 
218
 
$Form->begin_fieldset( get_manual_link( 'timeouts' ).T_('Timeouts') );
219
 
        // fp>TODO: enhance UI with a general Form method for Days:Hours:Minutes:Seconds
220
 
        $Form->text_input( 'timeout_sessions', $Settings->get( 'timeout_sessions' ), 9, T_('Session timeout'), T_('seconds. How long can a user stay inactive before automatic logout?'), array( 'required'=>true) );
221
 
        // fp>TODO: It may make sense to have a different (smaller) timeout for sessions with no logged user.
222
 
        // fp>This might reduce the size of the Sessions table. But this needs to be checked against the hit logging feature.
223
 
        $Form->text_input( 'reloadpage_timeout', (int)$Settings->get( 'reloadpage_timeout' ), 5,
224
 
                                                                T_('Reload-page timeout'), T_('Time (in seconds) that must pass before a request to the same URI from the same IP and useragent is considered as a new hit.'), array( 'maxlength'=>5, 'required'=>true ) );
225
 
$Form->end_fieldset();
226
 
 
227
 
// --------------------------------------------
 
90
$Form->begin_fieldset( T_('Display options') );
 
91
$Form->select_input_object( 'default_blog_ID', $Settings->get( 'default_blog_ID' ), $BlogCache, T_('Default blog to display'), array(
 
92
        'note' => T_('This blog will be displayed on index.php.').' <a href="'.$dispatcher.'?ctrl=blogs&action=new">'.T_('Create new blog').' &raquo;</a>',
 
93
        'allow_none' => true, 'class' => '', 'loop_object_method' => 'get_maxlen_name', 'onchange' => ''
 
94
) );
 
95
$Form->select_input_array( 'default_admin_template', $Settings->get( 'default_admin_template' ), get_admin_templates(), T_('Default admin template'), T_('Select the admin template that all new users will start with.') );
 
96
$Form->end_fieldset();
 
97
 
 
98
// Email validation
 
99
$Form->begin_fieldset( T_('Email validation') );
 
100
$Form->checkbox( 'newusers_mustvalidate', $Settings->get( 'newusers_mustvalidate' ), T_('New users must validate email'), T_('Check to require users to validate their email by clicking a link sent to them.' ) );
 
101
$Form->checkbox( 'newusers_revalidate_emailchg', $Settings->get( 'newusers_revalidate_emailchg' ), T_('Validate email changes'), T_('Check to require users to re-validate when they change their email address.' ) );
 
102
$Form->end_fieldset();
 
103
 
 
104
// Features
 
105
$Form->begin_fieldset( T_('Features') );
 
106
$Form->checkbox_input( 'fm_enabled', $Settings->get( 'fm_enabled' ), T_('Enable filemanager'), array( 'note' => T_('Check to enable the Filemanager.' ) ) );
 
107
$Form->checkbox_input( 'general_cache_enabled', $Settings->get( 'general_cache_enabled' ), T_('Enable general cache'), array( 'note' => T_('Cache rendered pages that are not controlled by a template. See Blog Settings for template output caching.') ) );
 
108
$Form->end_fieldset();
 
109
 
 
110
// Hit & session logging
 
111
$Form->begin_fieldset( T_('Hit & session logging') );
 
112
$Form->checklist( array( array( 'log_public_hits', 1, T_('on every public page'), $Settings->get( 'log_public_hits' ) ), array( 'log_admin_hits', 1, T_('on every admin page'), $Settings->get( 'log_admin_hits' ) ) ), 'log_hits', T_('Log hits') );
 
113
$Form->radio_input( 'auto_prune_stats_mode', $Settings->get( 'auto_prune_stats_mode' ), array(
 
114
        array( 'value' => 'off', 'label' => T_('Off'), 'note' => T_('Not recommended! Your database will grow very large!'), 'onclick' => 'jQuery("#auto_prune_stats_container").hide();' ),
 
115
        array( 'value' => 'page', 'label' => T_('On every page'), 'note' => T_('This is guaranteed to work but uses extra resources with every page displayed.'), 'onclick' => 'jQuery("#auto_prune_stats_container").show();' ),
 
116
        array( 'value' => 'cron', 'label' => T_('With a scheduled job'), 'note' => T_('Recommended if you have your scheduled jobs properly set up.'), 'onclick' => 'jQuery("#auto_prune_stats_container").show();' ) ), T_('Auto pruning'),
 
117
        array( 'note' => T_('Note: Even if you don\'t log hits, you still need to prune sessions!'),
 
118
        'lines' => true ) );
 
119
echo '<div id="auto_prune_stats_container">';
 
120
$Form->text_input( 'auto_prune_stats', $Settings->get( 'auto_prune_stats' ), 5, T_('Prune after'), T_('days. How many days of hits & sessions do you want to keep in the database for stats?') );
 
121
echo '</div>';
 
122
if( $Settings->get( 'auto_prune_stats_mode' ) == 'off' )
 
123
{
 
124
        // hide the "days" input field, if mode set to off:
 
125
        echo '<script type="text/javascript">jQuery("#auto_prune_stats_container").hide();</script>';
 
126
}
 
127
$Form->end_fieldset();
 
128
 
 
129
// Notifications
 
130
$Form->begin_fieldset( T_('Notifications') );
 
131
$Form->radio_input( 'outbound_notifications_mode', $Settings->get( 'outbound_notifications_mode' ), array(
 
132
                array( 'value' => 'off', 'label' => T_('Off'), 'note' => T_('No notification about your new content will be sent out.') ),
 
133
                array( 'value' => 'immediate', 'label' => T_('Immediate'), 'note' => T_('This is guaranteed to work but may create an annoying delay after each post.') ),
 
134
                array( 'value' => 'cron', 'label' => T_('Asynchronous'), 'note' => T_('Recommended if you have your scheduled jobs properly set up.') )
 
135
        ), T_('Outbound pings & email notifications'), array( 'lines' => true ) );
 
136
$Form->end_fieldset();
 
137
 
 
138
// Remote Publishing
 
139
$Form->begin_fieldset( T_('Remote Publishing') );
 
140
$Form->checkbox_input( 'general_xmlrpc_b2', $Settings->get( 'general_xmlrpc_b2' ), T_('Enable B2'), array( 'note' => T_('Enable the B2 XML-RPC publishing protocol.') ) );
 
141
$Form->checkbox_input( 'general_xmlrpc_blogger', $Settings->get( 'general_xmlrpc_blogger' ), T_('Enable Blogger'), array( 'note' => T_('Enable the Blogger XML-RPC publishing protocol.') ) );
 
142
$Form->checkbox_input( 'general_xmlrpc_metaweblog', $Settings->get( 'general_xmlrpc_metaweblog' ), T_('Enable MetaWeblog'), array( 'note' => T_('Enable the MetaWeblog XML-RPC publishing protocol.') ) );
 
143
$Form->checkbox_input( 'general_xmlrpc_mt', $Settings->get( 'general_xmlrpc_mt' ), T_('Enable Movable Type'), array( 'note' => T_('Enable the Movable Type XML-RPC publishing protocol.') ) );
 
144
$Form->end_fieldset();
 
145
 
 
146
// Security options
 
147
$Form->begin_fieldset( T_('Security options') );
 
148
$Form->text_input( 'user_minpwdlen', (int)$Settings->get( 'user_minpwdlen' ), 2, T_('Minimum password length'), T_('characters.'), array( 'maxlength' => 2, 'required' => true ) );
 
149
$Form->checkbox_input( 'js_passwd_hashing', (bool)$Settings->get( 'js_passwd_hashing' ), T_('Login password hashing'), array( 'note' => T_('Check to enable the login form to hash the password with Javascript before transmitting it. This provides extra security on non-SSL connections.')) );
 
150
$Form->end_fieldset();
 
151
 
 
152
// Timeouts
 
153
$Form->begin_fieldset( T_('Timeouts') );
 
154
// fp>TODO: enhance UI with a general Form method for Days:Hours:Minutes:Seconds
 
155
$Form->text_input( 'timeout_sessions', $Settings->get( 'timeout_sessions' ), 9, T_('Session timeout'), T_('seconds. How long can a user stay inactive before automatic logout?'), array( 'required' => true) );
 
156
// fp>TODO: It may make sense to have a different (smaller) timeout for sessions with no logged user.
 
157
// fp>This might reduce the size of the Sessions table. But this needs to be checked against the hit logging feature.
 
158
$Form->text_input( 'reloadpage_timeout', (int)$Settings->get( 'reloadpage_timeout' ), 5,
 
159
        T_('Reload-page timeout'), T_('Time (in seconds) that must pass before a request to the same URI from the same IP and useragent is considered as a new hit.'), array( 'maxlength' => 5, 'required' => true ) );
 
160
$Form->end_fieldset();
228
161
 
229
162
if( $current_User->check_perm( 'options', 'edit' ) )
230
163
{
231
164
        $Form->end_form( array(
232
 
                        array( 'submit', 'submit', T_('Update'), 'SaveButton' ),
233
 
                        array( 'reset', '', T_('Reset'), 'ResetButton' ),
234
 
                        array( 'submit', 'submit[restore_defaults]', T_('Restore defaults'), 'ResetButton' ),
235
 
                ) );
 
165
                array( 'submit', 'submit', T_('Update'), 'SaveButton' ),
 
166
                array( 'reset', '', T_('Reset'), 'ResetButton' ),
 
167
                array( 'submit', 'submit[restore_defaults]', T_('Restore defaults'), 'ResetButton' ),
 
168
        ) );
236
169
}
237
170
else
238
171
{