Example #1
0
/**
 * @var GeneralSettings
 */
global $Settings;
global $dispatcher;
global $collections_Module;
$Form = new Form(NULL, 'settings_checkchanges');
$Form->begin_form('fform', '', array('onsubmit' => 'var es=this.elements; for( var i=0; i < es.length; i++ ) { es[i].disabled=false; };'));
$Form->add_crumb('globalsettings');
$Form->hidden('ctrl', 'gensettings');
$Form->hidden('action', 'update');
// --------------------------------------------
if ($current_User->check_perm('users', 'edit')) {
    $Form->begin_fieldset(T_('Locking down b2evolution for maintenance, upgrade or server switching...'));
    $Form->checkbox_input('system_lock', $Settings->get('system_lock'), T_('Lock system'), array('note' => T_('check this to prevent login (except for admins) and sending comments/messages. This prevents the DB from receiving updates (other than logging)') . '<br />' . T_('Note: for a more complete lock down, rename the file /conf/_maintenance.html to /conf/maintenance.html (complete lock) or /conf/imaintenance.html (gives access to /install)')));
    $Form->end_fieldset();
}
// --------------------------------------------
$Form->begin_fieldset(T_('Caching'));
$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 skin. See Blog Settings for skin output caching.')));
$Form->end_fieldset();
// --------------------------------------------
$Form->begin_fieldset(T_('Online Help') . get_manual_link('online help'));
$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.')));
$Form->end_fieldset();
// --------------------------------------------
$Form->begin_fieldset(T_('Hit & session logging') . get_manual_link('hit_logging'));
$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'));
// TODO: draw a warning sign if set to off
$Form->radio_input('auto_prune_stats_mode', $Settings->get('auto_prune_stats_mode'), array(array('value' => 'off', 'label' => T_('Off'), 'note' => T_('Not recommended! Your database will grow very large!'), 'onclick' => 'jQuery("#auto_prune_stats_container").hide();'), 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();'), 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'), array('note' => T_('Note: Even if you don\'t log hits, you still need to prune sessions!'), 'lines' => true));
echo '<div id="auto_prune_stats_container">';
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     global $Blog, $Settings, $Session, $redirect_to, $dummy_fields;
     if (is_logged_in()) {
         // No display when user is already registered
         return false;
     }
     if ($Settings->get('newusers_canregister') != 'yes' || !$Settings->get('quick_registration')) {
         // Display error message when quick registration is disabled
         echo '<p class="error">' . T_('Quick registration is currently disabled on this system.') . '</p>';
         return false;
     }
     // Restore the typed in params from the redirected page:
     $widget_param_input_err_messages = $Session->get('param_input_err_messages_' . $this->ID);
     $widget_param_input_values = $Session->get('param_input_values_' . $this->ID);
     if (!empty($widget_param_input_err_messages)) {
         // Convert param errors to global $param_input_err_messages that is used to display an error text under input field
         global $param_input_err_messages;
         $param_input_err_messages = $widget_param_input_err_messages;
     }
     // Clear the temp session vars
     $Session->delete('param_input_err_messages_' . $this->ID);
     $Session->delete('param_input_values_' . $this->ID);
     $Session->dbsave();
     $this->init_display($params);
     if (isset($this->BlockCache)) {
         // Do NOT cache some of these links are using a redirect_to param, which makes it page dependent.
         // Note: also beware of the source param.
         // so this will be cached by the PageCache; there is no added benefit to cache it in the BlockCache
         // (which could have been shared between several pages):
         $this->BlockCache->abort_collect();
     }
     echo $this->disp_params['block_start'];
     $redirect_to = param('redirect_to', 'url', regenerate_url('', '', '', '&'));
     $this->disp_title();
     echo $this->disp_params['block_body_start'];
     if (!empty($this->disp_params['intro'])) {
         // Intro text
         echo '<p>' . $this->disp_params['intro'] . '</p>';
     }
     $Form = new Form(get_secure_htsrv_url() . 'register.php', 'register_form', 'post');
     $Form->begin_form();
     $Form->add_crumb('regform');
     $Form->hidden('action', 'quick_register');
     $Form->hidden('inskin', true);
     $Form->hidden('blog', $Blog->ID);
     $Form->hidden('widget', $this->ID);
     $Form->hidden('redirect_to', $redirect_to);
     // E-mail
     $email_value = isset($widget_param_input_values[$dummy_fields['email']]) ? $widget_param_input_values[$dummy_fields['email']] : '';
     $Form->text_input($dummy_fields['email'], $email_value, 50, T_('Your email'), '', array('maxlength' => 255, 'class' => 'input_text', 'required' => true));
     if ($this->disp_params['ask_firstname'] != 'no') {
         // First name
         $firstname_value = isset($widget_param_input_values['firstname']) ? $widget_param_input_values['firstname'] : '';
         $Form->text_input('firstname', $firstname_value, 18, T_('First name'), '', array('maxlength' => 50, 'class' => 'input_text', 'required' => $this->disp_params['ask_firstname'] == 'required'));
     }
     if ($this->disp_params['ask_lastname'] != 'no') {
         // Last name
         $lastname_value = isset($widget_param_input_values['lastname']) ? $widget_param_input_values['lastname'] : '';
         $Form->text_input('lastname', $lastname_value, 18, T_('Last name'), '', array('maxlength' => 50, 'class' => 'input_text', 'required' => $this->disp_params['ask_lastname'] == 'required'));
     }
     // Submit button
     $Form->begin_fieldset('', array('class' => 'fieldset field_register_btn'));
     $Form->button_input(array('value' => $this->disp_params['button'], 'class' => 'submit'));
     $Form->end_fieldset();
     $Form->end_form();
     echo $this->disp_params['block_body_end'];
     echo $this->disp_params['block_end'];
     if (!empty($widget_param_input_err_messages)) {
         // Clear param errors here because we already display them above
         // Don't display them twice on another widget form
         $param_input_err_messages = NULL;
     }
     return true;
 }
 /**
  * When a comment form gets displayed, we inject our captcha and an input field to
  * enter the answer.
  *
  * The question ID is saved into the user's Session and in the DB table "ip_question".
  *
  * @param array Associative array of parameters
  *   - 'Form': the form where payload should get added (by reference, OPTIONALLY!)
  *   - 'form_use_fieldset':
  *   - 'key': A key that is associated to the caller of the event (string, OPTIONALLY!)
  * @param string Form type ( comment|register|message )
  * @return boolean|NULL true, if displayed; false, if error; NULL if it does not apply
  */
 function CaptchaPayload(&$params, $form_type)
 {
     global $DB, $Session;
     if (!$this->does_apply($params, $form_type)) {
         return;
     }
     $question = $this->CaptchaQuestion();
     if (empty($question)) {
         // No the defined questions
         return;
     }
     $this->debug_log('Question ID is: (' . $this->question_ID . ')');
     if (!isset($params['Form'])) {
         // there's no Form where we add to, but we create our own form:
         $Form = new Form(regenerate_url());
         $Form->begin_form();
     } else {
         $Form =& $params['Form'];
         if (!isset($params['form_use_fieldset']) || $params['form_use_fieldset']) {
             $Form->begin_fieldset();
         }
     }
     $Form->info($this->T_('Captcha question'), $question->cptq_question);
     $Form->text_input('captcha_qstn_' . $this->ID . '_answer', param('captcha_qstn_' . $this->ID . '_answer', 'string', ''), 10, $this->T_('Captcha answer'), $this->T_('Please answer on question above.'));
     if (!isset($params['Form'])) {
         // there's no Form where we add to, but our own form:
         $Form->end_form(array(array('submit', 'submit', $this->T_('Validate me'), 'ActionButton')));
     } else {
         if (!isset($params['form_use_fieldset']) || $params['form_use_fieldset']) {
             $Form->end_fieldset();
         }
     }
     return true;
 }
Example #4
0
/**
 * Display user activate info form content
 *
 * @param Object activateinfo Form
 */
function display_activateinfo($params)
{
    global $current_User, $Settings, $UserSettings, $Plugins;
    global $secure_htsrv_url, $rsc_path, $rsc_url, $dummy_fields;
    if (!is_logged_in()) {
        // if this happens, it means the code is not correct somewhere before this
        debug_die("You must log in to see this page.");
    }
    // init force request new email address param
    $force_request = param('force_request', 'boolean', false);
    // get last activation email timestamp from User Settings
    $last_activation_email_date = $UserSettings->get('last_activation_email', $current_User->ID);
    if ($force_request || empty($last_activation_email_date)) {
        // notification email was not sent yet, or user needs another one ( forced request )
        $params = array_merge(array('form_action' => $secure_htsrv_url . 'login.php', 'form_name' => 'form_validatemail', 'form_class' => 'fform', 'form_layout' => 'fieldset', 'inskin' => false), $params);
        $Form = new Form($params['form_action'], $params['form_name'], 'post', $params['form_layout']);
        $Form->begin_form($params['form_class']);
        $Form->add_crumb('validateform');
        $Form->hidden('action', 'req_validatemail');
        $Form->hidden('redirect_to', $params['redirect_to']);
        if ($params['inskin']) {
            $Form->hidden('inskin', $params['inskin']);
            $Form->hidden('blog', $params['blog']);
        }
        $Form->hidden('req_validatemail_submit', 1);
        // to know if the form has been submitted
        $Form->begin_fieldset();
        echo '<ol>';
        echo '<li>' . T_('Please confirm your email address below:') . '</li>';
        echo '</ol>';
        // set email text input content only if this is not a forced request. This way the user may have bigger chance to write a correct email address.
        $user_email = $force_request ? '' : $current_User->email;
        // fp> note: 45 is the max length for evopress skin.
        $Form->text_input($dummy_fields['email'], $user_email, 45, T_('Your email'), '', array('maxlength' => 255, 'class' => 'input_text', 'required' => true));
        $Form->end_fieldset();
        // Submit button:
        $submit_button = array(array('name' => 'submit', 'value' => T_('Send me a new activation email now!'), 'class' => 'submit'));
        $Form->buttons_input($submit_button);
        if (!$params['inskin']) {
            $Plugins->trigger_event('DisplayValidateAccountFormFieldset', array('Form' => &$Form));
        }
        $Form->end_form();
        return;
    }
    // get notification email from general Settings
    $notification_email = $Settings->get('notification_sender_email');
    // convert date to timestamp
    $last_activation_email_ts = mysql2timestamp($last_activation_email_date);
    // get difference between local time and server time
    $time_difference = $Settings->get('time_difference');
    // get last activation email local date and time
    $last_email_date = date(locale_datefmt(), $last_activation_email_ts + $time_difference);
    $last_email_time = date(locale_shorttimefmt(), $last_activation_email_ts + $time_difference);
    $user_email = $current_User->email;
    echo '<ol start="1" class="expanded">';
    $instruction = sprintf(T_('Open your email account for %s and find a message we sent you on %s at %s with the following title:'), $user_email, $last_email_date, $last_email_time);
    echo '<li>' . $instruction . '<br /><b>' . sprintf(T_('Activate your account: %s'), $current_User->login) . '</b>';
    $request_validation_url = 'href="' . regenerate_url('', 'force_request=1&validate_required=true&redirect_to=' . $params['redirect_to']) . '"';
    echo '<p>' . sprintf(T_('NOTE: If you don\'t find it, check your "Junk", "Spam" or "Unsolicited email" folders. If you really can\'t find it, <a %s>request a new activation email</a>.'), $request_validation_url) . '</p></li>';
    echo '<li>' . sprintf(T_('Add us (%s) to your contacts to make sure you receive future email notifications, especially when someone sends you a private message.'), '<b><span class="nowrap">' . $notification_email . '</span></b>') . '</li>';
    echo '<li><b class="red">' . T_('Click on the activation link in the email.') . '</b>';
    echo '<p>' . T_('If this does not work, please copy/paste that link into the address bar of your browser.') . '</p>';
    echo '<p>' . sprintf(T_('If you need assistance, please send an email to %s'), '<b><a href="mailto:"' . $notification_email . '"><span class="nowrap">' . $notification_email . '</span></a></b>') . '</p></li>';
    echo '</ol>';
    if ((strpos($user_email, '@hotmail.') || strpos($user_email, '@live.') || strpos($user_email, '@msn.')) && file_exists($rsc_path . 'img/login_help/hotmail-validation.png')) {
        // The user is on hotmail and we have a help screen to show him: (needs to be localized and include correct site name)
        echo '<div class="center" style="margin: 2em auto"><img src="' . $rsc_url . 'img/login_help/hotmail-validation.png" /></div>';
    }
}
Example #5
0
        foreach ($user_avatars as $uLink) {
            echo $uLink->get_tag(array('before_image' => '<div class="avatartag">', 'before_image_legend' => NULL, 'after_image_legend' => NULL, 'image_size' => 'crop-top-80x80', 'image_link_to' => 'original', 'image_link_title' => $User->login, 'image_link_rel' => 'lightbox[user]'));
        }
        echo '</div>';
    }
}
// Load the user fields:
$User->userfields_load();
// fp> TODO: have some clean iteration support
$group_ID = 0;
foreach ($User->userfields as $userfield) {
    if ($group_ID != $userfield->ufgp_ID) {
        // Start new group
        if ($group_ID > 0) {
            // End previous group
            $profileForm->end_fieldset();
        }
        $profileForm->begin_fieldset($userfield->ufgp_name, array('id' => 'fieldset_user_fields'));
    }
    if ($userfield->ufdf_type == 'text') {
        // convert textarea values
        $userfield->uf_varchar = nl2br($userfield->uf_varchar);
    }
    $userfield_icon = '';
    if (!empty($userfield->ufdf_icon_name)) {
        // Icon
        $userfield_icon = '<span class="' . $userfield->ufdf_icon_name . ' ufld_' . $userfield->ufdf_code . ' ufld__textcolor"></span> ';
    }
    $profileForm->info($userfield_icon . $userfield->ufdf_name, $userfield->uf_varchar);
    $group_ID = $userfield->ufgp_ID;
}