Example #1
0
    }
    ?>
	</div>

	<!-- =================================== END OF BLOG C =================================== -->

	<div class="bSideItem">
		<h3><?php 
    echo T_('Misc');
    ?>
</h3>
		<ul>
			<?php 
    // Administrative links:
    user_login_link('<li>', '</li>');
    user_register_link('<li>', '</li>');
    user_admin_link('<li>', '</li>');
    user_profile_link('<li>', '</li>');
    user_subs_link('<li>', '</li>');
    user_logout_link('<li>', '</li>');
    ?>
		</ul>
	</div>

</div>
<!-- InstanceEndEditable --></div>
<div class="footer">
This is a demo page for <a href="http://b2evolution.net/">b2evolution</a>.
<!-- InstanceBeginEditable name="Baseline" -->
<?php 
    echo '</div>';
Example #2
0
?>
"><?php 
echo T_('Archives');
?>
</a>
		</strong>

		<p>
		<?php 
// Display a link to contact the owner of this blog (if owner accepts messages):
$Blog->contact_link(array('before' => ' [', 'after' => '] ', 'text' => T_('Contact'), 'title' => T_('Send a message to the owner of this blog...')));
?>

		<?php 
user_login_link(' [', '] ', '', '#', 'sidebar login link');
user_register_link(' [', '] ', '', '#', false, 'sidebar register link');
user_admin_link(' [', '] ');
user_logout_link(' [', '] ');
?>
		</p>
	</div>

	<hr>

	<?php 
// Please help us promote b2evolution and leave this logo on your blog:
powered_by(array('block_start' => '<div align="center">', 'block_end' => '</div>', 'img_url' => '$rsc$img/powered-by-b2evolution-120t.gif', 'img_width' => 120, 'img_height' => 32));
?>

	<?php 
// ---------------------------- SITE FOOTER INCLUDED HERE ----------------------------
Example #3
0
?>
"><?php 
echo T_('Archives');
?>
</a>
		</strong>

		<p>
		<?php 
// Display a link to contact the owner of this blog (if owner accepts messages):
$Blog->contact_link(array('before' => ' [', 'after' => '] ', 'text' => T_('Contact'), 'title' => T_('Send a message to the owner of this blog...')));
?>

		<?php 
user_login_link(' [', '] ');
user_register_link(' [', '] ');
user_admin_link(' [', '] ');
user_logout_link(' [', '] ');
?>
		</p>
	</div>

	<hr>

	<?php 
// Please help us promote b2evolution and leave this logo on your blog:
powered_by(array('block_start' => '<div align="center">', 'block_end' => '</div>', 'img_url' => '$rsc$img/powered-by-b2evolution-120t.gif', 'img_width' => 120, 'img_height' => 32));
?>

	<?php 
$Hit->log();
Example #4
0
/**
 * Display login form
 *
 * @param array params
 */
function display_login_form($params)
{
    global $Settings, $Plugins, $Session, $Blog, $blog, $dummy_fields;
    global $secure_htsrv_url, $admin_url, $baseurl, $ReqHost, $redirect_to;
    $params = array_merge(array('form_before' => '', 'form_after' => '', 'form_action' => '', 'form_name' => 'login_form', 'form_title' => '', 'form_layout' => '', 'form_class' => 'bComment', 'source' => 'inskin login form', 'inskin' => true, 'inskin_urls' => true, 'login_required' => true, 'validate_required' => NULL, 'redirect_to' => '', 'return_to' => '', 'login' => '', 'action' => '', 'reqID' => '', 'sessID' => '', 'transmit_hashed_password' => false, 'display_abort_link' => true, 'abort_link_position' => 'above_form', 'abort_link_text' => T_('Abort login!'), 'display_reg_link' => false), $params);
    $inskin = $params['inskin'];
    $login = $params['login'];
    $redirect_to = $params['redirect_to'];
    $return_to = $params['return_to'];
    $links = array();
    $form_links = array();
    if ($params['display_abort_link'] && empty($params['login_required']) && $params['action'] != 'req_validatemail' && strpos($return_to, $admin_url) !== 0 && strpos($ReqHost . $return_to, $admin_url) !== 0) {
        // No login required, allow to pass through
        // TODO: dh> validate return_to param?!
        // check if return_to url requires logged in user
        if (empty($return_to) || require_login($return_to, true)) {
            // logged in user require for return_to url
            if (!empty($blog)) {
                // blog is set
                if (empty($Blog)) {
                    $BlogCache =& get_BlogCache();
                    $Blog = $BlogCache->get_by_ID($blog, false);
                }
                // set abort url to Blog url
                $abort_url = $Blog->gen_blogurl();
            } else {
                // set abort login url to base url
                $abort_url = $baseurl;
            }
        } else {
            // logged in user isn't required for return_to url, set abort url to return_to
            $abort_url = $return_to;
        }
        // Gets displayed as link to the location on the login form if no login is required
        $abort_link = '<a href="' . htmlspecialchars(url_rel_to_same_host($abort_url, $ReqHost)) . '">' . $params['abort_link_text'] . '</a>';
        if ($params['abort_link_position'] == 'above_form') {
            // Display an abort link under login form
            $links[] = $abort_link;
        } elseif ($params['abort_link_position'] == 'form_title') {
            // Display an abort link in form title block
            $form_links[] = $abort_link;
        }
    }
    if (!$inskin && is_logged_in()) {
        // if we arrive here, but are logged in, provide an option to logout (e.g. during the email validation procedure)
        $links[] = get_user_logout_link();
    }
    if (count($links)) {
        echo '<div class="evo_form__login_links">' . '<div class="floatright">' . implode($links, ' &middot; ') . '</div>' . '<div class="clear"></div>' . '</div>';
    }
    $form_links = count($form_links) ? '<span class="pull-right">' . implode(' ', $form_links) . '</span>' : '';
    echo str_replace('$form_links$', $form_links, $params['form_before']);
    $Form = new Form($params['form_action'], $params['form_name'], 'post', $params['form_layout']);
    $Form->begin_form($params['form_class']);
    $Form->add_crumb('loginform');
    $source = param('source', 'string', $params['source'] . ' login form');
    $Form->hidden('source', $source);
    $Form->hidden('redirect_to', $redirect_to);
    $Form->hidden('return_to', $return_to);
    if ($inskin || $params['inskin_urls']) {
        // inskin login form
        $Form->hidden('inskin', true);
        $separator = '<br />';
    } else {
        // standard login form
        if (!empty($params['form_title'])) {
            echo '<h4>' . $params['form_title'] . '</h4>';
        }
        $Form->hidden('validate_required', $params['validate_required']);
        if (isset($params['action'], $params['reqID'], $params['sessID']) && $params['action'] == 'validatemail') {
            // the user clicked the link from the "validate your account" email, but has not been logged in; pass on the relevant data:
            $Form->hidden('action', 'validatemail');
            $Form->hidden('reqID', $params['reqID']);
            $Form->hidden('sessID', $params['sessID']);
        }
        $separator = '';
    }
    // check if should transmit hashed password
    if ($params['transmit_hashed_password']) {
        // used by JS-password encryption/hashing:
        $pwd_salt = $Session->get('core.pwd_salt');
        if (empty($pwd_salt)) {
            // Do not regenerate if already set because we want to reuse the previous salt on login screen reloads
            // fp> Question: the comment implies that the salt is reset even on failed login attemps. Why that? I would only have reset it on successful login. Do experts recommend it this way?
            // but if you kill the session you get a new salt anyway, so it's no big deal.
            // At that point, why not reset the salt at every reload? (it may be good to keep it, but I think the reason should be documented here)
            $pwd_salt = generate_random_key(64);
            $Session->set('core.pwd_salt', $pwd_salt, 86400);
            $Session->dbsave();
            // save now, in case there's an error later, and not saving it would prevent the user from logging in.
        }
        $Form->hidden('pwd_salt', $pwd_salt);
        // Add container for the hashed password hidden inputs
        echo '<div id="pwd_hashed_container"></div>';
        // gets filled by JS
    }
    if ($inskin) {
        $Form->begin_field();
        $Form->text_input($dummy_fields['login'], $params['login'], 18, T_('Login'), $separator . T_('Enter your username (or email address).'), array('maxlength' => 255, 'class' => 'input_text', 'required' => true));
        $Form->end_field();
    } else {
        $Form->text_input($dummy_fields['login'], $params['login'], 18, '', '', array('maxlength' => 255, 'class' => 'input_text', 'input_required' => 'required', 'placeholder' => T_('Username (or email address)')));
    }
    $lost_password_url = get_lostpassword_url($redirect_to, '&amp;', $return_to);
    if (!empty($login)) {
        $lost_password_url = url_add_param($lost_password_url, $dummy_fields['login'] . '=' . rawurlencode($login));
    }
    $pwd_note = '<a href="' . $lost_password_url . '">' . T_('Lost your password?') . '</a>';
    if ($inskin) {
        $Form->begin_field();
        $Form->password_input($dummy_fields['pwd'], '', 18, T_('Password'), array('note' => $pwd_note, 'maxlength' => 70, 'class' => 'input_text', 'required' => true));
        $Form->end_field();
    } else {
        $Form->password_input($dummy_fields['pwd'], '', 18, '', array('placeholder' => T_('Password'), 'note' => $pwd_note, 'maxlength' => 70, 'class' => 'input_text', 'input_required' => 'required'));
    }
    // Allow a plugin to add fields/payload
    $Plugins->trigger_event('DisplayLoginFormFieldset', array('Form' => &$Form));
    // Display registration link after login button
    $register_link = $params['display_reg_link'] ? get_user_register_link('', '', T_('Register') . ' &raquo;', '#', true, $redirect_to, $source, 'btn btn-primary btn-lg pull-right') : '';
    // Submit button(s):
    $submit_buttons = array(array('name' => 'login_action[login]', 'value' => T_('Log in!'), 'class' => 'btn-success btn-lg', 'input_suffix' => $register_link));
    $Form->buttons_input($submit_buttons);
    if ($inskin) {
        $before_register_link = '<div class="login_actions" style="text-align:right; margin: 1em 0 1ex"><strong>';
        $after_register_link = '</strong></div>';
        user_register_link($before_register_link, $after_register_link, T_('No account yet? Register here') . ' &raquo;', '#', true, $redirect_to, $source);
    } else {
        // Passthrough REQUEST data (when login is required after having POSTed something)
        // (Exclusion of 'login_action', 'login', and 'action' has been removed. This should get handled via detection in Form (included_input_field_names),
        //  and "action" is protected via crumbs)
        $Form->hiddens_by_key(remove_magic_quotes($_REQUEST), array('pwd_hashed'));
    }
    $Form->end_form();
    echo $params['form_after'];
    display_login_js_handler($params);
}
Example #5
0
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     $this->init_display($params);
     // User tools:
     echo $this->disp_params['block_start'];
     echo $this->disp_params['block_title_start'];
     echo T_('User tools');
     echo $this->disp_params['block_title_end'];
     echo $this->disp_params['list_start'];
     user_login_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_login_link']);
     user_register_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_register_link']);
     user_admin_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_admin_link']);
     user_profile_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_profile_link']);
     user_subs_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_subs_link']);
     user_logout_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_logout_link']);
     echo $this->disp_params['list_end'];
     echo $this->disp_params['block_end'];
 }