示例#1
0
            $success_message = T_('Your comment is now visible by the blog members.');
            break;
        case 'review':
            if (is_logged_in() && $current_User->check_perm('blog_comment!review', 'create', false, $blog)) {
                $success_message = T_('Your comment is now visible by moderators only (+You).');
                break;
            }
        default:
            $success_message = T_('Your comment has been submitted. It will appear once it has been approved.');
            break;
    }
    $Messages->add($success_message, 'success');
    if (!is_logged_in()) {
        if ($Settings->get('newusers_canregister') == 'yes' && $Settings->get('registration_is_public') && $Comment->Item->Blog->get_setting('comments_register')) {
            // Redirect to the registration form
            $Messages->add(T_('ATTENTION: Create a user account now so that other users can contact you after reading your comment.'), 'error');
            $register_user = array('name' => $Comment->author, 'email' => $Comment->author_email);
            $Session->set('core.register_user', $register_user);
            header_redirect(get_user_register_url($Comment->Item->get_url('public_view'), 'reg after comment', false, '&'));
        }
        // Not logged in user. We want him to see his comment has not vanished if he checks back on the Item page
        // before the cache has expired. Invalidate cache for that page:
        // Note: this is approximative and may not cover all URLs where the user expects to see the comment...
        // TODO: fp> solution: touch dates?
        load_class('_core/model/_pagecache.class.php', 'PageCache');
        $PageCache = new PageCache($Comment->Item->Blog);
        $PageCache->invalidate($Comment->Item->get_single_url());
    }
}
header_redirect();
// Will save $Messages into Session
示例#2
0
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     /**
      * @var Blog
      */
     global $Blog;
     global $disp;
     $this->init_display($params);
     // Default link class
     $link_class = $this->disp_params['link_default_class'];
     $blog_ID = intval($this->disp_params['blog_ID']);
     if ($blog_ID > 0) {
         // Try to use blog from widget setting
         $BlogCache =& get_BlogCache();
         $current_Blog =& $BlogCache->get_by_ID($blog_ID, false, false);
     }
     if (empty($current_Blog)) {
         // Blog is not defined in setting or it doesn't exist in DB
         // Use current blog
         $current_Blog =& $Blog;
     }
     if (empty($current_Blog)) {
         // We cannot use this widget without a current collection:
         return false;
     }
     switch ($this->disp_params['link_type']) {
         case 'recentposts':
             $url = $current_Blog->get('recentpostsurl');
             if (is_same_url($url, $Blog->get('url'))) {
                 // This menu item has the same url as front page of blog
                 $EnabledWidgetCache =& get_EnabledWidgetCache();
                 $Widget_array =& $EnabledWidgetCache->get_by_coll_container($current_Blog->ID, NT_('Menu'));
                 if (!empty($Widget_array)) {
                     foreach ($Widget_array as $Widget) {
                         $Widget->init_display($params);
                         if (isset($Widget->param_array, $Widget->param_array['link_type']) && $Widget->param_array['link_type'] == 'home') {
                             // Don't display this menu if 'Blog home' menu item exists with the same url
                             return false;
                         }
                     }
                 }
             }
             $text = T_('Recently');
             if ($disp == 'posts') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'search':
             $url = $current_Blog->get('searchurl');
             $text = T_('Search');
             // Is this the current display?
             if ($disp == 'search') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'arcdir':
             $url = $current_Blog->get('arcdirurl');
             $text = T_('Archives');
             if ($disp == 'arcdir') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'catdir':
             $url = $current_Blog->get('catdirurl');
             $text = T_('Categories');
             if ($disp == 'catdir') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'tags':
             $url = $current_Blog->get('tagsurl');
             $text = T_('Tags');
             if ($disp == 'tags') {
                 // Let's display the link as selected:
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'postidx':
             $url = $current_Blog->get('postidxurl');
             $text = T_('Post index');
             if ($disp == 'postidx') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'mediaidx':
             $url = $current_Blog->get('mediaidxurl');
             $text = T_('Photo index');
             if ($disp == 'mediaidx') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'sitemap':
             $url = $current_Blog->get('sitemapurl');
             $text = T_('Site map');
             if ($disp == 'sitemap') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'latestcomments':
             if (!$current_Blog->get_setting('comments_latest')) {
                 // This page is disabled
                 return false;
             }
             $url = $current_Blog->get('lastcommentsurl');
             $text = T_('Latest comments');
             if ($disp == 'comments') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'owneruserinfo':
             $url = url_add_param($current_Blog->get('userurl'), 'user_ID=' . $current_Blog->owner_user_ID);
             $text = T_('Owner details');
             // Is this the current display?
             global $User;
             if ($disp == 'user' && !empty($User) && $User->ID == $current_Blog->owner_user_ID) {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'ownercontact':
             if (!($url = $current_Blog->get_contact_url(true))) {
                 // user does not allow contact form:
                 return;
             }
             $text = T_('Contact');
             // Is this the current display?
             if ($disp == 'msgform' || isset($_GET['disp']) && $_GET['disp'] == 'msgform') {
                 // Let's display the link as selected
                 // fp> I think it's interesting to select this link , even if the recipient ID is different from the owner
                 // odds are there is no other link to highlight in this case
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'login':
             if (is_logged_in()) {
                 // Don't display this link for already logged in users
                 return false;
             }
             global $Settings;
             $url = get_login_url('menu link', $Settings->get('redirect_to_after_login'), false, $current_Blog->ID);
             if (isset($this->BlockCache)) {
                 // Do NOT cache because some of these links are using a redirect_to param, which makes it page dependent.
                 // 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();
             }
             $text = T_('Log in');
             // Is this the current display?
             if ($disp == 'login') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'logout':
             if (!is_logged_in()) {
                 return false;
             }
             $url = get_user_logout_url($current_Blog->ID);
             $text = T_('Log out');
             break;
         case 'register':
             if (!($url = get_user_register_url(NULL, 'menu link', false, '&', $current_Blog->ID))) {
                 return false;
             }
             if (isset($this->BlockCache)) {
                 // Do NOT cache because 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();
             }
             $text = T_('Register');
             // Is this the current display?
             if ($disp == 'register') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'profile':
             if (!is_logged_in()) {
                 return false;
             }
             $url = get_user_profile_url($current_Blog->ID);
             $text = T_('Edit profile');
             // Is this the current display?  (Edit my Profile)
             if (in_array($disp, array('profile', 'avatar', 'pwdchange', 'userprefs', 'subs'))) {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'avatar':
             if (!is_logged_in()) {
                 return false;
             }
             $url = get_user_avatar_url($current_Blog->ID);
             $text = T_('Profile picture');
             // Note: we never highlight this, it will always highlight 'profile' instead
             break;
         case 'users':
             global $Settings;
             if (!is_logged_in() && !$Settings->get('allow_anonymous_user_list')) {
                 // Don't allow anonymous users to see users list
                 return false;
             }
             $url = $current_Blog->get('usersurl');
             $text = T_('User directory');
             // Is this the current display?
             // Note: If $user_ID is not set, it means we are viewing "My Profile" instead
             global $user_ID;
             if ($disp == 'users' || $disp == 'user' && !empty($user_ID)) {
                 // Let's display the link as selected
                 // Note: we also highlight this for any user profile that is displayed
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'item':
             $ItemCache =& get_ItemCache();
             /**
              * @var Item
              */
             $item_ID = intval($this->disp_params['item_ID']);
             $disp_Item =& $ItemCache->get_by_ID($item_ID, false, false);
             if (empty($disp_Item)) {
                 // Item not found
                 return false;
             }
             $url = $disp_Item->get_permanent_url();
             $text = $disp_Item->title;
             // Is this the current item?
             global $Item;
             if (!empty($Item) && $disp_Item->ID == $Item->ID) {
                 // The current page is currently displaying the Item this link is pointing to
                 // Let's display it as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'url':
             if (empty($this->disp_params['link_href'])) {
                 // Don't display a link if url is empty
                 return false;
             }
             $url = $this->disp_params['link_href'];
             $text = '[URL]';
             // should normally be overriden below...
             // Note: we never highlight this link
             break;
         case 'postnew':
             if (!check_item_perm_create()) {
                 // Don't allow users to create a new post
                 return false;
             }
             $url = url_add_param($current_Blog->get('url'), 'disp=edit');
             $text = T_('Write a new post');
             // Is this the current display?
             if ($disp == 'edit') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'myprofile':
             if (!is_logged_in()) {
                 // Don't show this link for not logged in users
                 return false;
             }
             $url = $current_Blog->get('userurl');
             $text = T_('My profile');
             // Is this the current display?  (Edit my Profile)
             global $user_ID, $current_User;
             // If $user_ID is not set, it means we will fall back to the current user, so it's ok
             // If $user_ID is set, it means we are browsing the directory instead
             if ($disp == 'user' && empty($user_ID)) {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'admin':
             global $current_User;
             if (!(is_logged_in() && $current_User->check_perm('admin', 'restricted') && $current_User->check_status('can_access_admin'))) {
                 // Don't allow admin url for users who have no access to backoffice
                 return false;
             }
             global $admin_url;
             $url = $admin_url;
             $text = T_('Admin') . ' »';
             break;
         case 'home':
         default:
             $url = $current_Blog->get('url');
             $text = T_('Front Page');
             global $is_front;
             if ($disp == 'front' || !empty($is_front)) {
                 // Let's display the link as selected on front page
                 $link_class = $this->disp_params['link_selected_class'];
             }
     }
     // Override default link text?
     if (!empty($this->param_array['link_text'])) {
         // We have a custom link text:
         $text = $this->param_array['link_text'];
     }
     echo $this->disp_params['block_start'];
     echo $this->disp_params['block_body_start'];
     echo $this->disp_params['list_start'];
     if ($link_class == $this->disp_params['link_selected_class']) {
         echo $this->disp_params['item_selected_start'];
     } else {
         echo $this->disp_params['item_start'];
     }
     echo '<a href="' . $url . '" class="' . $link_class . '">' . $text . '</a>';
     if ($link_class == $this->disp_params['link_selected_class']) {
         echo $this->disp_params['item_selected_end'];
     } else {
         echo $this->disp_params['item_end'];
     }
     echo $this->disp_params['list_end'];
     echo $this->disp_params['block_body_end'];
     echo $this->disp_params['block_end'];
     return true;
 }
示例#3
0
 /**
  * Check if user can see comments on this post, which he cannot if they
  * are disabled for the Item or never allowed for the blog.
  *
  * @param boolean true will display why user can't see comments
  * @return boolean
  */
 function can_see_comments($display = false)
 {
     global $Settings, $disp;
     if ($disp == 'terms') {
         // Don't display the comments on page with terms & conditions:
         return false;
     }
     if (!$this->get_type_setting('use_comments')) {
         // Comments are not allowed on this post by post type
         return false;
     }
     if ($this->get_type_setting('allow_disabling_comments') && $this->comment_status == 'disabled') {
         // Comments are disabled on this post
         return false;
     }
     if ($this->check_blog_settings('allow_view_comments')) {
         // User is allowed to see comments
         return true;
     }
     if (!$display) {
         return false;
     }
     $this->load_Blog();
     $number_of_comments = $this->get_number_of_comments('published');
     $allow_view_comments = $this->Blog->get_setting('allow_view_comments');
     $user_can_be_validated = check_user_status('can_be_validated');
     if ($allow_view_comments != 'any' && $user_can_be_validated) {
         // change allow view comments to activated, because user is logged in but the account is not activated, and anomnymous users can't see comments
         $allow_view_comments = 'active_users';
     }
     // Set display text
     switch ($allow_view_comments) {
         case 'active_users':
             // users must activate their accounts before they can see the comments
             if ($number_of_comments == 0) {
                 $display_text = T_('You must activate your account to see the comments.');
             } elseif ($number_of_comments == 1) {
                 $display_text = T_('There is <b>one comment</b> on this post but you must activate your account to see the comments.');
             } else {
                 $display_text = sprintf(T_('There are <b>%s comments</b> on this post but you must activate your account to see the comments.'), $number_of_comments);
             }
             break;
         case 'registered':
             // only registered users can see this post's comments
             if ($number_of_comments == 0) {
                 $display_text = T_('You must be logged in to see the comments.');
             } elseif ($number_of_comments == 1) {
                 $display_text = T_('There is <b>one comment</b> on this post but you must be logged in to see the comments.');
             } else {
                 $display_text = sprintf(T_('There are <b>%s comments</b> on this post but you must be logged in to see the comments.'), $number_of_comments);
             }
             break;
         case 'member':
             // only members can see this post's comments
             if ($number_of_comments == 0) {
                 $display_text = T_('You must be a member of this blog to see the comments.');
             } elseif ($number_of_comments == 1) {
                 $display_text = T_('There is one comment on this post but you must be a member of this blog to see the comments.');
             } else {
                 $display_text = sprintf(T_('There are %s comments on this post but you must be a member of this blog to see the comments.'), $number_of_comments);
             }
             break;
         default:
             // any is already handled, moderators shouldn't get any message
             return false;
     }
     echo '<div class="comment_posting_disabled_msg">';
     if (!is_logged_in()) {
         // user is not logged in at all
         $redirect_to = $this->get_permanent_url() . '#comments';
         $login_link = '<a href="' . get_login_url('cannot see comments', $redirect_to) . '">' . T_('Log in now!') . '</a>';
         echo '<p>' . $display_text . ' ' . $login_link . '</p>';
         if ($Settings->get('newusers_canregister') == 'yes' && $Settings->get('registration_is_public')) {
             // needs to display register link
             echo '<p>' . sprintf(T_('If you have no account yet, you can <a href="%s">register now</a>...<br />(It only takes a few seconds!)'), get_user_register_url($redirect_to, 'reg to see comments')) . '</p>';
         }
     } elseif ($user_can_be_validated) {
         // user is logged in but not activated
         $activateinfo_link = '<a href="' . get_activate_info_url($this->get_permanent_url() . '#comments', '&amp;') . '">' . T_('More info &raquo;') . '</a>';
         echo '<p>' . $display_text . ' ' . $activateinfo_link . '</p>';
     } else {
         // user is activated, but not allowed to view comments
         echo $display_text;
     }
     echo '</div>';
     return false;
 }
示例#4
0
/**
 * Display disabled comment form
 *
 * @param string Blog allow comments settings value
 * @param string Item url, where this comment form should be displayed
 * @param array Skin params
 */
function echo_disabled_comments($allow_comments_value, $item_url, $params = array())
{
    global $Settings, $current_User;
    $params = array_merge(array('comments_disabled_text_member' => T_('You must be a member of this blog to comment.'), 'comments_disabled_text_registered' => T_('You must be logged in to leave a comment.'), 'comments_disabled_text_validated' => T_('You must activate your account before you can leave a comment.'), 'form_comment_text' => T_('Comment text')), $params);
    if (empty($params['form_params'])) {
        $params['form_params'] = array();
    }
    $params['form_params'] = array_merge(array('formstart' => '', 'formend' => '', 'fieldset_begin' => '<fieldset>', 'fieldset_end' => '</fieldset>', 'fieldstart' => '', 'fieldend' => '', 'labelstart' => '<div class="label"><label for="p">', 'labelend' => '</label></div>', 'inputstart' => '<div class="input">', 'inputend' => '</div>'), $params['form_params']);
    switch ($allow_comments_value) {
        case 'member':
            $disabled_text = $params['comments_disabled_text_member'];
            break;
        case 'registered':
            $disabled_text = $params['comments_disabled_text_registered'];
            break;
        default:
            // case any or never, in this case comment form is already displayed, or comments are not allowed at all.
            return;
    }
    $login_link = '';
    $activateinfo_link = '';
    $is_logged_in = is_logged_in();
    if (!$is_logged_in) {
        // user is not logged in
        $login_link = '<a href="' . get_login_url('cannot comment', $item_url) . '">' . T_('Log in now!') . '</a>';
    } elseif ($current_User->check_status('can_be_validated')) {
        // logged in but the account is not activated
        $disabled_text = $params['comments_disabled_text_validated'];
        $activateinfo_link = '<a href="' . get_activate_info_url($item_url) . '">' . T_('More info &raquo;') . '</a>';
    }
    // else -> user is logged in and account was activated
    $register_link = '';
    if (!$is_logged_in && $Settings->get('newusers_canregister')) {
        $register_link = '<p>' . sprintf(T_('If you have no account yet, you can <a href="%s">register now</a>...<br />(It only takes a few seconds!)'), get_user_register_url($item_url, 'reg to post comment')) . '</p>';
    }
    // disabled comment form
    echo '<form class="bComment" action="">';
    echo '<div class="comment_posting_disabled_msg">';
    if ($is_logged_in) {
        echo '<p>' . $disabled_text . ' ' . $activateinfo_link . '</p>';
    } else {
        // not logged in, add login and register links
        echo '<p>' . $disabled_text . ' ' . $login_link . '</p>';
        echo $register_link;
    }
    echo '</div>';
    echo $params['form_params']['formstart'];
    echo $params['form_params']['fieldset_begin'];
    echo $params['form_params']['fieldstart'];
    echo $params['form_params']['labelstart'] . $params['form_comment_text'] . ':' . $params['form_params']['labelend'];
    echo $params['form_params']['inputstart'];
    echo '<textarea id="p" class="bComment form_text_areainput" rows="5" name="p" cols="40" disabled="disabled">' . $disabled_text . '</textarea>';
    echo $params['form_params']['inputend'];
    echo $params['form_params']['fieldend'];
    echo $params['form_params']['fieldset_end'];
    echo $params['form_params']['formend'];
    // margin at the bottom of the form
    echo '<div style="margin-top:10px"></div>';
    echo '</form>';
}
示例#5
0
/**
 * Template tag: Get a link to new user registration
 *
 * @param string
 * @param string
 * @param string
 * @param string
 * @param boolean Display the link, if the user is already logged in? (this is used by the login form)
 * @param string Where to redirect
 * @return string used for source tracking
 */
function get_user_register_link($before = '', $after = '', $link_text = '', $link_title = '#', $disp_when_logged_in = false, $redirect = null, $default_source_string = '')
{
    $register_url = get_user_register_url($redirect, $default_source_string, $disp_when_logged_in);
    if (!$register_url) {
        return false;
    }
    if ($link_text == '') {
        $link_text = T_('Register') . ' &raquo;';
    }
    if ($link_title == '#') {
        $link_title = T_('Register for a new account...');
    }
    $r = $before;
    $r .= '<a href="' . $register_url . '" title="' . $link_title . '">';
    $r .= $link_text;
    $r .= '</a>';
    $r .= $after;
    return $r;
}
示例#6
0
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     /**
      * @var Blog
      */
     global $Blog;
     global $disp;
     $this->init_display($params);
     // Default link class
     $link_class = $this->disp_params['link_default_class'];
     switch ($this->disp_params['link_type']) {
         case 'search':
             $url = $Blog->get('searchurl');
             $text = T_('Search');
             // Is this the current display?
             if ($disp == 'search') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'arcdir':
             $url = $Blog->get('arcdirurl');
             $text = T_('Archives');
             if ($disp == 'arcdir') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'catdir':
             $url = $Blog->get('catdirurl');
             $text = T_('Categories');
             if ($disp == 'catdir') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'postidx':
             $url = $Blog->get('postidxurl');
             $text = T_('Post index');
             if ($disp == 'postidx') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'mediaidx':
             $url = $Blog->get('mediaidxurl');
             $text = T_('Photo index');
             if ($disp == 'mediaidx') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'sitemap':
             $url = $Blog->get('sitemapurl');
             $text = T_('Site map');
             if ($disp == 'sitemap') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'latestcomments':
             if (!$Blog->get_setting('comments_latest')) {
                 // This page is disabled
                 return false;
             }
             $url = $Blog->get('lastcommentsurl');
             $text = T_('Latest comments');
             if ($disp == 'comments') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'owneruserinfo':
             $url = url_add_param($Blog->get('userurl'), 'user_ID=' . $Blog->owner_user_ID);
             $text = T_('Owner details');
             // Is this the current display?
             global $User;
             if ($disp == 'user' && !empty($User) && $User->ID == $Blog->owner_user_ID) {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'ownercontact':
             if (!($url = $Blog->get_contact_url(true))) {
                 // user does not allow contact form:
                 return;
             }
             $text = T_('Contact');
             // Is this the current display?
             if ($disp == 'msgform') {
                 // Let's display the link as selected
                 // fp> I think it's interesting to select this link , even if the recipient ID is different from the owner
                 // odds are there is no other link to highlight in this case
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'login':
             if (is_logged_in()) {
                 return false;
             }
             $url = get_login_url('menu link');
             if (isset($this->BlockCache)) {
                 // Do NOT cache because some of these links are using a redirect_to param, which makes it page dependent.
                 // 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();
             }
             $text = T_('Log in');
             // Is this the current display?
             if ($disp == 'login') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'register':
             if (!($url = get_user_register_url(NULL, 'menu link'))) {
                 return false;
             }
             if (isset($this->BlockCache)) {
                 // Do NOT cache because 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();
             }
             $text = T_('Register');
             // Is this the current display?
             if ($disp == 'register') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'profile':
             if (!is_logged_in()) {
                 return false;
             }
             $url = get_user_profile_url();
             $text = T_('Edit profile');
             // Is this the current display?  (Edit my Profile)
             if (in_array($disp, array('profile', 'avatar', 'pwdchange', 'userprefs', 'subs'))) {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'avatar':
             if (!is_logged_in()) {
                 return false;
             }
             $url = get_user_avatar_url();
             $text = T_('Profile picture');
             // Note: we never highlight this, it will always highlight 'profile' instead
             break;
         case 'users':
             global $Settings;
             if (!is_logged_in() && !$Settings->get('allow_anonymous_user_list')) {
                 // Don't allow anonymous users to see users list
                 return false;
             }
             $url = $Blog->get('usersurl');
             $text = T_('User directory');
             // Is this the current display?
             // Note: If $user_ID is not set, it means we are viewing "My Profile" instead
             global $user_ID;
             if ($disp == 'users' || $disp == 'user' && !empty($user_ID)) {
                 // Let's display the link as selected
                 // Note: we also highlight this for any user profile that is displayed
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'item':
             $ItemCache =& get_ItemCache();
             /**
              * @var Item
              */
             $item_ID = (int) $this->disp_params['item_ID'];
             $disp_Item =& $ItemCache->get_by_ID($item_ID, false, false);
             if (empty($disp_Item)) {
                 // Item not found
                 return false;
             }
             $url = $disp_Item->get_permanent_url();
             $text = $disp_Item->title;
             // Is this the current item?
             global $Item;
             if (!empty($Item) && $disp_Item->ID == $Item->ID) {
                 // The current page is currently displaying the Item this link is pointing to
                 // Let's display it as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'url':
             $url = $this->disp_params['link_href'];
             $text = '[URL]';
             // should normally be overriden below...
             // Note: we never highlight this link
             break;
         case 'postnew':
             if (!check_item_perm_create()) {
                 // Don't allow users to create a new post
                 return false;
             }
             $url = url_add_param($Blog->get('url'), 'disp=edit');
             $text = T_('Write a new post');
             // Is this the current display?
             if ($disp == 'edit') {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'myprofile':
             if (!is_logged_in()) {
                 // Don't show this link for not logged in users
                 return false;
             }
             $url = url_add_param($Blog->get('url'), 'disp=user');
             $text = T_('My profile');
             // Is this the current display?  (Edit my Profile)
             global $user_ID, $current_User;
             // If $user_ID is not set, it means we will fall back to the current user, so it's ok
             // If $user_ID is set, it means we are browsing the directory instead
             if ($disp == 'user' && empty($user_ID)) {
                 // Let's display the link as selected
                 $link_class = $this->disp_params['link_selected_class'];
             }
             break;
         case 'home':
         default:
             $url = $Blog->get('url');
             $text = T_('Home');
     }
     // Override default link text?
     if (!empty($this->param_array['link_text'])) {
         // We have a custom link text:
         $text = $this->param_array['link_text'];
     }
     echo $this->disp_params['block_start'];
     echo $this->disp_params['list_start'];
     echo $this->disp_params['item_start'];
     echo '<a href="' . $url . '" class="' . $link_class . '">' . $text . '</a>';
     echo $this->disp_params['item_end'];
     echo $this->disp_params['list_end'];
     echo $this->disp_params['block_end'];
     return true;
 }