Example #1
0
$Form->begin_form('fform', $creating ? T_('New scheduled job') : T_('Edit scheduled job'));
$Form->add_crumb('crontask');
$Form->hiddens_by_key(get_memorized('action'));
$Form->hidden('action', $creating ? 'create' : 'update');
$Form->begin_fieldset(T_('Job details') . get_manual_link('scheduled-job-form'));
if ($creating && $action != 'copy') {
    // New cronjob
    $cron_jobs_names = get_cron_jobs_config('name');
    // Exclude these cron jobs from manual creating
    unset($cron_jobs_names['send-post-notifications']);
    unset($cron_jobs_names['send-comment-notifications']);
    $Form->select_input_array('cjob_type', get_param('cjob_type'), $cron_jobs_names, T_('Job type'));
} else {
    // Edit cronjob
    if ($action == 'edit') {
        $Form->info(T_('Job #'), $edited_Cronjob->ID);
    }
    $Form->info(T_('Default job name'), cron_job_name($edited_Cronjob->key, '', $edited_Cronjob->params));
    $Form->text_input('cjob_name', $edited_Cronjob->name, 50, T_('Job name'), '', array('maxlength' => 255));
}
$Form->date_input('cjob_date', date2mysql($edited_Cronjob->start_timestamp), T_('Schedule date'), array('required' => true));
$Form->time_input('cjob_time', date2mysql($edited_Cronjob->start_timestamp), T_('Schedule time'), array('required' => true));
$Form->duration_input('cjob_repeat_after', $edited_Cronjob->repeat_after, T_('Repeat every'), 'days', 'minutes', array('minutes_step' => 1));
$Form->end_fieldset();
if (!$creating) {
    // We can edit only pending cron jobs, Show this field just for info
    $Form->begin_fieldset(T_('Execution details') . get_manual_link('scheduled-job-execution-details'));
    $Form->info(T_('Status'), 'pending');
    $Form->end_fieldset();
}
$Form->end_form(array(array('submit', 'submit', $creating ? T_('Create') : T_('Save Changes!'), 'SaveButton')));
$Form->begin_fieldset(T_('Global Site Settings') . get_manual_link('global-site-settings'));
$Form->text_input('site_code', $Settings->get('site_code'), 10, T_('Site code'), '$instance_name = ' . $instance_name, array('maxlength' => 20));
$Form->color_input('site_color', $Settings->get('site_color'), T_('Site color'), T_('E-g: #ff0000 for red'));
$Form->text_input('notification_short_name', $Settings->get('notification_short_name'), 50, T_('Short site name'), T_('Shared with email settings'), array('maxlength' => 127, 'required' => true));
$Form->text_input('notification_long_name', $Settings->get('notification_long_name'), 50, T_('Long site name'), T_('Shared with email settings'), array('maxlength' => 255));
$Form->text_input('notification_logo', $Settings->get('notification_logo'), 50, T_('Small site logo (URL)'), T_('Shared with email settings'), array('maxlength' => 5000));
$Form->text_input('notification_logo_large', $Settings->get('notification_logo_large'), 50, T_('Large site logo (URL)'), '', array('maxlength' => 5000));
$Form->text_input('site_footer_text', $Settings->get('site_footer_text'), 50, T_('Site footer text'), '', array('maxlength' => 5000));
$Form->checkbox_input('site_skins_enabled', $Settings->get('site_skins_enabled'), T_('Enable site skins'), array('note' => T_('Enables a sitewide header and footer')));
$Form->text_input('site_terms', $Settings->get('site_terms'), 7, T_('Terms & Conditions'), T_('Enter ID of the page containing the terms & conditions.'), array('maxlength' => 11));
$Form->end_fieldset();
// --------------------------------------------
$Form->begin_fieldset(T_('Default collections') . get_manual_link('default-collections'));
$BlogCache =& get_BlogCache();
$create_new_blog_link = ' <a href="' . $admin_url . '?ctrl=collections&action=new">' . T_('Create new collection') . ' &raquo;</a>';
$Form->select_input_object('default_blog_ID', $Settings->get('default_blog_ID'), $BlogCache, get_icon('coll_default') . ' ' . T_('Default collection to display'), array('note' => T_('This collection will be displayed on index.php.') . $create_new_blog_link, 'allow_none' => true, 'loop_object_method' => 'get_maxlen_name'));
$Form->select_input_object('info_blog_ID', $Settings->get('info_blog_ID'), $BlogCache, get_icon('coll_info') . ' ' . T_('Collection for info pages'), array('note' => T_('The pages in this collection will be added to the site menu.') . $create_new_blog_link, 'allow_none' => true, 'loop_object_method' => 'get_maxlen_name'));
$Form->select_input_object('login_blog_ID', $Settings->get('login_blog_ID'), $BlogCache, get_icon('coll_login') . ' ' . T_('Collection for login/registration'), array('note' => T_('This collection will be used for all login/registration functions.') . $create_new_blog_link, 'allow_none' => true, 'loop_object_method' => 'get_maxlen_name'));
$Form->select_input_object('msg_blog_ID', $Settings->get('msg_blog_ID'), $BlogCache, get_icon('coll_message') . ' ' . T_('Collection for profiles/messaging'), array('note' => T_('This collection will be used for all messaging, profile viewing and profile editing functions.') . $create_new_blog_link, 'allow_none' => true, 'loop_object_method' => 'get_maxlen_name'));
$Form->end_fieldset();
// --------------------------------------------
$Form->begin_fieldset(T_('Technical Site Settings') . get_manual_link('technical-site-settings'));
$Form->duration_input('reloadpage_timeout', (int) $Settings->get('reloadpage_timeout'), T_('Reload-page timeout'), 'minutes', 'seconds', array('minutes_step' => 1, 'required' => true));
// $Form->text_input( 'reloadpage_timeout', (int)$Settings->get('reloadpage_timeout'), 5,
// 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 ) );
$Form->checkbox_input('general_cache_enabled', $Settings->get('general_cache_enabled'), get_icon('page_cache_on') . ' ' . T_('Enable general cache'), array('note' => T_('Cache rendered pages that are not controlled by a skin. See Blog Settings for skin output caching.')));
$Form->end_fieldset();
// --------------------------------------------
if ($current_User->check_perm('options', 'edit')) {
    $Form->end_form(array(array('submit', 'submit', T_('Save Changes!'), 'SaveButton')));
}
 */
global $edited_Blog;
$Form = new Form(NULL, 'coll_features_checkchanges');
$Form->begin_form('fform');
$Form->add_crumb('collection');
$Form->hidden_ctrl();
$Form->hidden('action', 'update');
$Form->hidden('tab', 'features');
$Form->hidden('blog', $edited_Blog->ID);
$Form->begin_fieldset(T_('Post list') . get_manual_link('item-list-features'));
$Form->select_input_array('orderby', $edited_Blog->get_setting('orderby'), get_available_sort_options(), T_('Order by'), T_('Default ordering of posts.'));
$Form->select_input_array('orderdir', $edited_Blog->get_setting('orderdir'), array('ASC' => T_('Ascending'), 'DESC' => T_('Descending')), T_('Direction'));
$Form->radio('what_to_show', $edited_Blog->get_setting('what_to_show'), array(array('days', T_('days')), array('posts', T_('posts'))), T_('Display unit'), false, T_('Do you want to restrict on the number of days or the number of posts?'));
$Form->text('posts_per_page', $edited_Blog->get_setting('posts_per_page'), 4, T_('Posts/Days per page'), T_('How many days or posts do you want to display on the home page?'), 4);
$Form->radio('timestamp_min', $edited_Blog->get_setting('timestamp_min'), array(array('yes', T_('yes')), array('no', T_('no')), array('duration', T_('only the last'))), T_('Show past posts'), true);
$Form->duration_input('timestamp_min_duration', $edited_Blog->get_setting('timestamp_min_duration'), '');
$Form->radio('timestamp_max', $edited_Blog->get_setting('timestamp_max'), array(array('yes', T_('yes')), array('no', T_('no')), array('duration', T_('only the next'))), T_('Show future posts'), true);
$Form->duration_input('timestamp_max_duration', $edited_Blog->get_setting('timestamp_max_duration'), '');
$Form->end_fieldset();
$Form->begin_fieldset(T_('Post options') . get_manual_link('blog_features_settings'));
$Form->select_input_array('default_post_status', $edited_Blog->get_setting('default_post_status'), get_visibility_statuses('notes-string'), T_('Default status'), T_('Default status for new posts'));
$Form->radio('require_title', $edited_Blog->get_setting('require_title'), array(array('required', T_('Always'), T_('The blogger must provide a title')), array('optional', T_('Optional'), T_('The blogger can leave the title field empty')), array('none', T_('Never'), T_('No title field'))), T_('Post titles'), true);
$Form->checkbox('allow_html_post', $edited_Blog->get_setting('allow_html_post'), T_('Allow HTML'), T_('Check to allow HTML in posts.') . ' (' . T_('HTML code will pass several sanitization filters.') . ')');
$Form->radio('enable_goto_blog', $edited_Blog->get_setting('enable_goto_blog'), array(array('no', T_('No'), T_('Check this to view list of the posts.')), array('blog', T_('View home page'), T_('Check this to automatically view the blog after publishing a post.')), array('post', T_('View new post'), T_('Check this to automatically view the post page.'))), T_('View blog after publishing'), true);
$Form->radio('editing_goto_blog', $edited_Blog->get_setting('editing_goto_blog'), array(array('no', T_('No'), T_('Check this to view list of the posts.')), array('blog', T_('View home page'), T_('Check this to automatically view the blog after editing a post.')), array('post', T_('View edited post'), T_('Check this to automatically view the post page.'))), T_('View blog after editing'), true);
// FP> TODO:
// -post_url  always('required')|optional|never
// -multilingual:  true|false   or better yet: provide a list to narrow down the active locales
// -tags  always('required')|optional|never
$Form->radio('post_categories', $edited_Blog->get_setting('post_categories'), array(array('one_cat_post', T_('Allow only one category per post')), array('multiple_cat_post', T_('Allow multiple categories per post')), array('main_extra_cat_post', T_('Allow one main + several extra categories')), array('no_cat_post', T_('Don\'t allow category selections'), T_('(Main cat will be assigned automatically)'))), T_('Post category options'), true);
$Form->radio('post_navigation', $edited_Blog->get_setting('post_navigation'), array(array('same_blog', T_('same blog')), array('same_category', T_('same category')), array('same_author', T_('same author'))), T_('Default post by post navigation should stay in'), true, T_('Skins may override this setting!'));
Example #4
0
 */
global $Settings;
/**
 * @var instance of User class
 */
global $current_User;
$current_User->check_perm('users', 'view', true);
$Form = new Form(NULL, 'usersettings_checkchanges');
$Form->begin_form('fform', '');
$Form->add_crumb('usersettings');
$Form->hidden('ctrl', 'usersettings');
$Form->hidden('action', 'update');
$Form->begin_fieldset(T_('Session Settings') . get_manual_link('session-settings'));
$Form->text_input('redirect_to_after_login', $Settings->get('redirect_to_after_login'), 60, T_('After login, redirect to'), T_('Users will be redirected there upon successful login, unless they are in process of doing something.'), array('maxlength' => NULL));
// fp>TODO: enhance UI with a general Form method for Days:Hours:Minutes:Seconds
$Form->duration_input('timeout_sessions', $Settings->get('timeout_sessions'), T_('Session timeout'), 'months', 'seconds', array('minutes_step' => 1, 'required' => true, 'note' => T_('If the user stays inactive for this long, he will have to log in again.')));
// $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) );
// fp>TODO: It may make sense to have a different (smaller) timeout for sessions with no logged user.
// fp>This might reduce the size of the Sessions table. But this needs to be checked against the hit logging feature.
$Form->duration_input('timeout_online', $Settings->get('timeout_online'), T_('Online/Offline timeout'), 'hours', 'seconds', array('minutes_step' => 1, 'required' => true, 'note' => T_('If the user stays inactive for this long, we will no longer display him as "online" and we will start sending him email notifications when things happen while he is away.')));
$Form->end_fieldset();
$Form->begin_fieldset(T_('User latitude') . get_manual_link('user-profile-latitude-settings'));
$Form->checkbox_input('allow_avatars', $Settings->get('allow_avatars', true), T_('Allow profile pictures'), array('note' => T_('Allow users to upload profile pictures.')));
$Form->text_input('uset_min_picture_size', $Settings->get('min_picture_size'), 5, T_('Minimum picture size'), '', array('note' => T_('pixels (width and height)')));
$name_editing_options = array(array('edited-user', T_('Can be edited by user')), array('edited-user-required', T_('Can be edited by user + required')), array('edited-admin', T_('Can be edited by admins only')), array('hidden', T_('Hidden')));
$Form->radio('uset_nickname_editing', $Settings->get('nickname_editing'), $name_editing_options, T_('Nickname'), true);
$Form->radio('uset_firstname_editing', $Settings->get('firstname_editing'), $name_editing_options, T_('Firstname'), true);
$Form->radio('uset_lastname_editing', $Settings->get('lastname_editing'), $name_editing_options, T_('Lastname'), true);
$location_options = array(array('optional', T_('Optional')), array('required', T_('Required')), array('hidden', T_('Hidden')));
$Form->radio('uset_location_country', $Settings->get('location_country'), $location_options, T_('Country'));
$Form->radio('uset_location_region', $Settings->get('location_region'), $location_options, T_('Region'));
    $messaging_options[] = array('enable_email', 1, T_('emails through a message form that will NOT reveal my email address.'), $Settings->get('def_enable_email'));
}
$Form->checklist($messaging_options, 'default_user_msgform', T_('Other users can send me'));
$notify_options = array(array('notify_messages', 1, T_('I receive a private message.'), $Settings->get('def_notify_messages')), array('notify_unread_messages', 1, T_('I have unread private messages for more than 24 hours.'), $Settings->get('def_notify_unread_messages'), false, T_('This notification is sent only once every 3 days.')), array('notify_published_comments', 1, T_('a comment is published on one of <strong>my</strong> posts.'), $Settings->get('def_notify_published_comments')), array('notify_comment_moderation', 1, T_('a comment is posted and I have permissions to moderate it.'), $Settings->get('def_notify_comment_moderation')), array('notify_meta_comments', 1, T_('a meta comment is posted and I have permission to view it.'), $Settings->get('def_notify_meta_comments')), array('notify_post_moderation', 1, T_('a post is created and I have permissions to moderate it.'), $Settings->get('def_notify_post_moderation')));
$Form->checklist($notify_options, 'default_user_notification', T_('Notify me by email whenever'));
$newsletter_options = array(array('newsletter_news', 1, T_('Send me news about this site.') . ' <span class="note">' . T_('Each message contains an easy 1 click unsubscribe link.') . '</span>', $Settings->get('def_newsletter_news')), array('newsletter_ads', 1, T_('I want to receive ADs that may be relevant to my interests.'), $Settings->get('def_newsletter_ads')));
$Form->checklist($newsletter_options, 'default_user_newsletter', T_('Newsletter'));
$Form->text_input('notification_email_limit', $Settings->get('def_notification_email_limit'), 3, T_('Limit notification emails to'), T_('emails per day'), array('maxlength' => 3, 'required' => true));
$Form->text_input('newsletter_limit', $Settings->get('def_newsletter_limit'), 3, T_('Limit newsletters to'), T_('emails per day'), array('maxlength' => 3, 'required' => true));
$Form->end_fieldset();
// --------------------------------------------
$Form->begin_fieldset(T_('Account activation') . get_manual_link('account-activation-settings'), array('id' => 'account_activation'));
$Form->checkbox('newusers_mustvalidate', $Settings->get('newusers_mustvalidate'), T_('New users must activate by email'), T_('Check to require users to activate their account by clicking a link sent to them via email.'));
$Form->checkbox('newusers_revalidate_emailchg', $Settings->get('newusers_revalidate_emailchg'), T_('Reactivate after email change'), T_('Check to require users to re-activate their account when they change their email address.'));
$Form->radio('validation_process', $Settings->get('validation_process'), array(array('secure', T_('Secure account activation process'), T_('Users must validate their account in the same session. Prevents activation of an account by someone else if an incorrect email address is entered. No reminder emails can be sent.')), array('easy', T_('Easy account activation process'), T_('Allows to send reminder emails to unregistered accounts.'))), T_('Activation process'), true);
$Form->duration_input('activate_requests_limit', $Settings->get('activate_requests_limit'), T_('Limit activation email requests to'), 'minutes', 'minutes', array('minutes_step' => 5, 'required' => true, 'note' => T_('Only one activation email can be sent to the same email address in every given minutes.')));
$Form->checkbox('newusers_findcomments', $Settings->get('newusers_findcomments'), T_('Find old comments'), T_('After each activation, find comments left by the user based on the validated email address and attach them to the user account.'));
if ($Settings->get('after_email_validation') == 'return_to_original') {
    // return to original url
    $after_email_validation = 'return_to_original';
    $after_validation_url = $baseurl;
} else {
    // set specific URL
    $after_email_validation = 'specific_url';
    $after_validation_url = $Settings->get('after_email_validation');
}
$Form->radio('after_email_validation', $after_email_validation, array(array('return_to_original', T_('Return to original page')), array('specific_url', T_('Go to specific URL') . ':', '', '<input type="text" id="specific_after_validation_url" class="form_text_input form-control" name="specific_after_validation_url" size="50" maxlength="120" value="' . format_to_output($after_validation_url, 'formvalue') . '"
						onfocus="document.getElementsByName(\'after_email_validation\')[1].checked=true;" />')), T_('After email activation'), true);
$Form->end_fieldset();
// --------------------------------------------
$Form->begin_fieldset(T_('Security options') . get_manual_link('registration-security-settings'));