Beispiel #1
0
 /**
  * Generate a tag url on this blog
  */
 function gen_tag_url($tag, $paged = 1, $glue = '&')
 {
     $link_type = $this->get_setting('tag_links');
     switch ($link_type) {
         case 'param':
             $r = url_add_param($this->gen_blogurl(), 'tag=' . urlencode($tag));
             $tag_posts_per_page = $this->get_setting('tag_posts_per_page');
             if (!empty($tag_posts_per_page) && $tag_posts_per_page != $this->get_setting('posts_per_page')) {
                 // We want a specific post per page count:
                 $r = url_add_param($r, 'posts=' . $tag_posts_per_page, $glue);
             }
             break;
         case 'semicol':
         default:
             $tag_prefix = $this->get_setting('tag_prefix');
             if (!empty($tag_prefix)) {
                 $r = url_add_tail($this->gen_blogurl(), '/' . $tag_prefix . '/' . urlencode($tag) . ';');
             } else {
                 $r = url_add_tail($this->gen_blogurl(), '/' . urlencode($tag) . ';');
             }
     }
     if ($paged > 1) {
         // We want a specific page:
         $r = url_add_param($r, 'paged=' . $paged, $glue);
     }
     return $r;
 }
 /**
  * Generate a link to the post in the category
  *
  * @param string base url to use
  * @param string glue between url params
  */
 function get_chapter_url($blogurl = '', $glue = '&')
 {
     if (empty($blogurl)) {
         $this->get_Blog();
         $blogurl = $this->Blog->gen_blogurl();
     }
     $main_Chapter =& $this->get_main_Chapter();
     $permalink = url_add_tail($blogurl, '/' . $main_Chapter->get_url_path());
     return $permalink . '#item_' . $this->ID;
 }
            }
            // ------------------ COMMENT INCLUDED HERE ------------------
            skin_include($params['comment_template'], array('Comment' => &$Comment, 'comment_start' => $params['comment_start'], 'comment_end' => $params['comment_end'], 'author_link_text' => $params['author_link_text'], 'link_to' => $params['link_to']));
            // Note: You can customize the default item feedback by copying the generic
            // /skins/_item_comment.inc.php file into the current skin folder.
            // ---------------------- END OF COMMENT ---------------------
            if ($Blog->get_setting('threaded_comments')) {
                // Display the comment replies
                display_comment_replies($Comment->ID, $params);
            }
        }
        // End of comment list loop.
        echo $params['comment_list_end'];
        if ($Blog->get_setting('paged_comments')) {
            // Prev/Next page navigation
            $CommentList->page_links(array('page_url' => url_add_tail($Item->get_permanent_url(), '#comments')));
        }
        // Restore "redir" param
        forget_param('redir');
        // _______________________________________________________________
        // Display count of comments to be moderated:
        $Item->feedback_moderation('feedbacks', '<div class="moderation_msg"><p>', '</p></div>', '', T_('This post has 1 feedback awaiting moderation... %s'), T_('This post has %d feedbacks awaiting moderation... %s'));
        // _______________________________________________________________
    }
}
// ------------------ COMMENT FORM INCLUDED HERE ------------------
if ($Blog->get_ajax_form_enabled()) {
    $json_params = array('action' => 'get_comment_form', 'p' => $Item->ID, 'blog' => $Blog->ID, 'disp' => $disp, 'params' => $params);
    display_ajax_form($json_params);
} else {
    skin_include('_item_comment_form.inc.php', $params);
Beispiel #4
0
/**
 * Get global title matching filter params
 *
 * Outputs the title of the category when you load the page with <code>?cat=</code>
 * Display "Archive Directory" title if it has been requested
 * Display "Latest comments" title if these have been requested
 * Display "Statistics" title if these have been requested
 * Display "User profile" title if it has been requested
 *
 * @todo single month: Respect locales datefmt
 * @todo single post: posts do no get proper checking (wether they are in the requested blog or wether their permissions match user rights,
 * thus the title sometimes gets displayed even when it should not. We need to pre-query the ItemList instead!!
 * @todo make it complete with all possible params!
 *
 * @param array params
 *        - "auto_pilot": "seo_title": Use the SEO title autopilot. (Default: "none")
 */
function get_request_title($params = array())
{
    global $MainList, $preview, $disp, $action, $current_User, $Blog, $admin_url;
    $r = array();
    $params = array_merge(array('auto_pilot' => 'none', 'title_before' => '', 'title_after' => '', 'title_none' => '', 'title_single_disp' => true, 'title_single_before' => '#', 'title_single_after' => '#', 'title_page_disp' => true, 'title_page_before' => '#', 'title_page_after' => '#', 'glue' => ' - ', 'format' => 'htmlbody', 'arcdir_text' => T_('Archive Directory'), 'catdir_text' => T_('Category Directory'), 'mediaidx_text' => T_('Photo Index'), 'postidx_text' => T_('Post Index'), 'search_text' => T_('Search'), 'sitemap_text' => T_('Site Map'), 'msgform_text' => T_('Sending a message'), 'messages_text' => T_('Messages'), 'contacts_text' => T_('Contacts'), 'login_text' => T_('Login '), 'register_text' => T_('Register'), 'req_validatemail' => T_('Account activation'), 'account_activation' => T_('Account activation'), 'lostpassword_text' => T_('Lost password?'), 'profile_text' => T_('User Profile'), 'avatar_text' => T_('Profile picture'), 'pwdchange_text' => T_('Password change'), 'userprefs_text' => T_('User preferences'), 'user_text' => T_('User: %s'), 'users_text' => T_('Users'), 'closeaccount_text' => T_('Close account'), 'subs_text' => T_('Notifications'), 'comments_text' => T_('Latest Comments'), 'feedback-popup_text' => T_('Feedback'), 'edit_text_create' => T_('New post'), 'edit_text_update' => T_('Editing post'), 'edit_text_copy' => T_('Duplicating post'), 'edit_comment_text' => T_('Editing comment'), 'front_text' => '', 'posts_text' => '#', 'useritems_text' => T_('User posts'), 'usercomments_text' => T_('User comments')), $params);
    if ($params['auto_pilot'] == 'seo_title') {
        // We want to use the SEO title autopilot. Do overrides:
        $params['format'] = 'htmlhead';
        $params['title_after'] = $params['glue'] . $Blog->get('name');
        $params['title_single_after'] = '';
        $params['title_page_after'] = '';
        $params['title_none'] = $Blog->dget('name', 'htmlhead');
    }
    $before = $params['title_before'];
    $after = $params['title_after'];
    switch ($disp) {
        case 'arcdir':
            // We are requesting the archive directory:
            $r[] = $params['arcdir_text'];
            break;
        case 'catdir':
            // We are requesting the archive directory:
            $r[] = $params['catdir_text'];
            break;
        case 'mediaidx':
            $r[] = $params['mediaidx_text'];
            break;
        case 'postidx':
            $r[] = $params['postidx_text'];
            break;
        case 'sitemap':
            $r[] = $params['sitemap_text'];
            break;
        case 'search':
            $r[] = $params['search_text'];
            break;
        case 'comments':
            // We are requesting the latest comments:
            global $Item;
            if (isset($Item)) {
                $r[] = sprintf($params['comments_text'] . T_(' on %s'), $Item->get('title'));
            } else {
                $r[] = $params['comments_text'];
            }
            break;
        case 'feedback-popup':
            // We are requesting the comments on a specific post:
            // Should be in first position
            $Item =& $MainList->get_by_idx(0);
            $r[] = sprintf($params['feedback-popup_text'] . T_(' on %s'), $Item->get('title'));
            break;
        case 'profile':
            // We are requesting the user profile:
            $r[] = $params['profile_text'];
            break;
        case 'avatar':
            // We are requesting the user avatar:
            $r[] = $params['avatar_text'];
            break;
        case 'pwdchange':
            // We are requesting the user change password:
            $r[] = $params['pwdchange_text'];
            break;
        case 'userprefs':
            // We are requesting the user preferences:
            $r[] = $params['userprefs_text'];
            break;
        case 'subs':
            // We are requesting the subscriptions screen:
            $r[] = $params['subs_text'];
            break;
        case 'msgform':
            // We are requesting the message form:
            $r[] = $params['msgform_text'];
            break;
        case 'threads':
        case 'messages':
            // We are requesting the messages form
            $thrd_ID = param('thrd_ID', 'integer', 0);
            if (empty($thrd_ID)) {
                $r[] = $params['messages_text'];
            } else {
                // We get a thread title by ID
                load_class('messaging/model/_thread.class.php', 'Thread');
                $ThreadCache =& get_ThreadCache();
                if ($Thread = $ThreadCache->get_by_ID($thrd_ID, false)) {
                    // Thread exists and we get a title
                    if ($params['auto_pilot'] == 'seo_title') {
                        // Display thread title only for tag <title>
                        $r[] = $Thread->title;
                    }
                } else {
                    // Bad request with not existing thread
                    $r[] = strip_tags($params['messages_text']);
                }
            }
            break;
        case 'contacts':
            // We are requesting the message form:
            $r[] = $params['contacts_text'];
            break;
        case 'login':
            // We are requesting the login form:
            if ($action == 'req_validatemail') {
                $r[] = $params['req_validatemail'];
            } else {
                $r[] = $params['login_text'];
            }
            break;
        case 'register':
            // We are requesting the registration form:
            $r[] = $params['register_text'];
            break;
        case 'activateinfo':
            // We are requesting the activate info form:
            $r[] = $params['account_activation'];
            break;
        case 'lostpassword':
            // We are requesting the lost password form:
            $r[] = $params['lostpassword_text'];
            break;
        case 'single':
        case 'page':
            // We are displaying a single message:
            if ($preview) {
                // We are requesting a post preview:
                $r[] = T_('PREVIEW');
            } elseif ($params['title_' . $disp . '_disp'] && isset($MainList)) {
                $r = array_merge($r, $MainList->get_filter_titles(array('visibility', 'hide_future'), $params));
            }
            if ($params['title_' . $disp . '_before'] != '#') {
                $before = $params['title_' . $disp . '_before'];
            }
            if ($params['title_' . $disp . '_after'] != '#') {
                $after = $params['title_' . $disp . '_after'];
            }
            break;
        case 'user':
            // We are requesting the user page:
            $user_ID = param('user_ID', 'integer', 0);
            $UserCache =& get_UserCache();
            $User =& $UserCache->get_by_ID($user_ID, false, false);
            $user_login = $User ? $User->get('login') : '';
            $r[] = sprintf($params['user_text'], $user_login);
            break;
        case 'users':
            $r[] = $params['users_text'];
            break;
        case 'closeaccount':
            $r[] = $params['closeaccount_text'];
            break;
        case 'edit':
            $action = param_action();
            // Edit post by switching into 'In skin' mode from Back-office
            $p = param('p', 'integer', 0);
            // Edit post from Front-office
            $cp = param('cp', 'integer', 0);
            // Copy post from Front-office
            if ($action == 'edit_switchtab' || $p > 0) {
                // Edit post
                $title = $params['edit_text_update'];
            } else {
                if ($cp > 0) {
                    // Copy post
                    $title = $params['edit_text_copy'];
                } else {
                    // Create post
                    $title = $params['edit_text_create'];
                }
            }
            if ($params['auto_pilot'] != 'seo_title') {
                // Add advanced edit and close icon
                global $edited_Item;
                if (!empty($edited_Item) && $edited_Item->ID > 0) {
                    // Set the cancel editing url as permanent url of the item
                    $cancel_url = $edited_Item->get_permanent_url();
                } else {
                    // Set the cancel editing url to home page of the blog
                    $cancel_url = $Blog->gen_blogurl();
                }
                $title .= '<span class="title_action_icons">';
                if ($current_User->check_perm('admin', 'normal')) {
                    global $advanced_edit_link;
                    $title .= action_icon(T_('Go to advanced edit screen'), 'edit', $advanced_edit_link['href'], ' ' . T_('Advanced editing'), NULL, 3, array('onclick' => $advanced_edit_link['onclick']));
                }
                $title .= action_icon(T_('Cancel editing'), 'close', $cancel_url, ' ' . T_('Cancel editing'), NULL, 3);
                $title .= '</span>';
            }
            $r[] = $title;
            break;
        case 'edit_comment':
            global $comment_Item, $edited_Comment;
            $title = $params['edit_comment_text'];
            if ($params['auto_pilot'] != 'seo_title') {
                // Add advanced edit and close icon
                $title .= '<span class="title_action_icons">';
                if ($current_User->check_perm('admin', 'normal')) {
                    $advanced_edit_url = url_add_param($admin_url, 'ctrl=comments&amp;action=edit&amp;blog=' . $Blog->ID . '&amp;comment_ID=' . $edited_Comment->ID);
                    $title .= action_icon(T_('Go to advanced edit screen'), 'edit', $advanced_edit_url, ' ' . T_('Advanced editing'), NULL, 3, array('onclick' => 'return switch_edit_view();'));
                }
                if (empty($comment_Item)) {
                    $comment_Item =& $edited_Comment->get_Item();
                }
                if (!empty($comment_Item)) {
                    $title .= action_icon(T_('Cancel editing'), 'close', url_add_tail($comment_Item->get_permanent_url(), '#c' . $edited_Comment->ID), ' ' . T_('Cancel editing'), NULL, 3);
                }
                $title .= '</span>';
            }
            $r[] = $title;
            break;
        case 'useritems':
            // We are requesting the user items list:
            $r[] = $params['useritems_text'];
            break;
        case 'usercomments':
            // We are requesting the user comments list:
            $r[] = $params['usercomments_text'];
            break;
        default:
            if (isset($MainList)) {
                $r = array_merge($r, $MainList->get_filter_titles(array('visibility', 'hide_future'), $params));
            }
            break;
    }
    if (!empty($r)) {
        // We have at leats one title match:
        $r = implode($params['glue'], $r);
        if (!empty($r)) {
            // This is in case we asked for an empty title (e-g for search)
            $r = $before . format_to_output($r, $params['format']) . $after;
        }
    } elseif (!empty($params['title_none'])) {
        $r = $params['title_none'];
    } else {
        // never return array()
        $r = '';
    }
    return $r;
}
 function disp_feedback_list($type = 'comment', $params = array())
 {
     global $Blog, $Item, $app_version;
     $type_list = array($type);
     if (version_compare($app_version, '4.0') < 0) {
         // b2evo 3
         //array_walk($type_list, function(&$v){ $v = "'$v'"; });
         foreach ($type_list as $v) {
             $type_list_fixed[] = "'{$v}'";
         }
         $CommentList = new CommentList(NULL, implode(',', $type_list_fixed), array('published'), $Item->ID, '', 'ASC');
     } else {
         // b2evo 4
         $type = substr($type, 0, 1);
         $CommentList = new CommentList2($Blog, $Blog->get_setting('comments_per_page'), 'CommentCache', $type . '_');
         // Filter list:
         $CommentList->set_default_filters(array('types' => $type_list, 'statuses' => array('published'), 'post_ID' => $Item->ID, 'order' => $Blog->get_setting('comments_orderdir')));
         $CommentList->load_from_Request();
         // Get ready for display (runs the query):
         $CommentList->display_init();
     }
     if ($CommentList->result_num_rows < 1) {
         return;
     }
     forget_param('c');
     forget_param('tb');
     forget_param('pb');
     forget_param('disp');
     forget_param('more');
     forget_param('title');
     if (method_exists($CommentList, 'page_links') && $Blog->get_setting('paged_comments')) {
         // Navigation
         $CommentList->page_links(array('page_url' => url_add_tail($Item->get_permanent_url(), '#post-tabs'), 'block_start' => '<div class="comment-navigation clearfix">', 'block_end' => '</div>', 'prev_text' => '&laquo;', 'next_text' => '&raquo;'));
         $nav_displayed = 1;
     }
     echo $params['comment_list_start'];
     while ($Comment =& $CommentList->get_next()) {
         // Loop through comments:
         // ------------------ COMMENT INCLUDED HERE ------------------
         skin_include($params['comment_template'], array('Comment' => &$Comment, 'comment_start' => $params['comment_start'], 'comment_end' => $params['comment_end'], 'link_to' => $params['link_to']));
         // ---------------------- END OF COMMENT ---------------------
     }
     // End of comment list loop.
     echo $params['comment_list_end'];
     if (!empty($nav_displayed)) {
         // Navigation
         $CommentList->page_links(array('page_url' => url_add_tail($Item->get_permanent_url(), '#post-tabs'), 'block_start' => '<div class="comment-navigation clearfix">', 'block_end' => '</div>', 'prev_text' => '&laquo;', 'next_text' => '&raquo;'));
     }
 }
Beispiel #6
0
/**
 * Get a link with task title
 *
 * @param object Item
 * @param boolean Display country flag
 * @param boolean Display status banner
 * @return string Link
 */
function task_title_link($Item, $display_flag = true, $display_status = false)
{
    global $current_User, $admin_url;
    $col = '';
    if ($display_status && is_logged_in()) {
        // Display status
        $col .= $Item->get_status(array('format' => 'styled'));
    }
    if ($display_flag) {
        // Display country flag
        $col .= locale_flag($Item->locale, 'w16px', 'flag', '', false) . ' ';
    }
    $Item->get_Blog();
    if (is_admin_page()) {
        // Url to item page in backoffice
        $item_url = $admin_url . '?ctrl=items&amp;blog=' . $Item->get_blog_ID() . '&amp;p=' . $Item->ID;
    } else {
        // Url to item page in frontoffice
        $item_url = $Item->get_permanent_url();
    }
    if ($Item->Blog->get_setting('allow_comments') != 'never') {
        // The current blog can have comments:
        $nb_comments = generic_ctp_number($Item->ID, 'feedback');
        $comments_url = is_admin_page() ? $item_url : url_add_tail($item_url, '#comments');
        $col .= '<a href="' . $comments_url . '" title="' . sprintf(T_('%d feedbacks'), $nb_comments) . '" class="">';
        if ($nb_comments) {
            $col .= get_icon('comments');
        } else {
            $col .= get_icon('nocomment');
        }
        $col .= '</a> ';
    }
    $col .= '<a href="' . $item_url . '" class="" title="' . T_('View this post...') . '">' . $Item->dget('title') . '</a></strong>';
    return $col;
}
$disp_params = array_merge(array('disp_edit_categories' => true, 'edit_form_params' => array('formstart' => '<table class="bForums" width="100%" cellspacing="1" cellpadding="2" border="0"><tr><th colspan="2">' . T_('Editing reply') . '</th></tr>', 'formend' => '</table>', 'fieldset_begin' => '<tr class="top"><td colspan="2">', 'fieldset_end' => '</td></tr>', 'fieldstart' => '<tr>', 'fieldend' => '</tr>', 'labelstart' => '<td class="left"><strong>', 'labelend' => '</strong></td>', 'inputstart' => '<td class="row2 left">', 'inputend' => '</td>', 'infostart' => '<td class="row2 left">', 'infoend' => '</td>', 'buttonsstart' => '<tr><td colspan="2">', 'buttonsend' => '</td></tr>', 'output' => true), 'categories_name' => T_('Appears in'), 'category_name' => T_('Forum'), 'category_main_title' => T_('Main forum'), 'category_extra_title' => T_('Additional forum'), 'textarea_lines' => 16, 'form_comment_text' => T_('Comment content')), $display_params);
// BREADCRUMBS
echo '<div class="post_panel">';
$comment_Item =& $edited_Comment->get_Item();
$main_Chapter =& $comment_Item->get_main_Chapter();
$Skin->display_breadcrumbs($main_Chapter->ID);
echo '</div><div class="clear"></div>';
$Form = new Form($form_action, 'comment_edit', 'post');
$Form->switch_template_parts($disp_params['edit_form_params']);
$Form->begin_form('inskin', '', $display_params);
$Form->add_crumb('comment');
$Form->hidden('blog', $Blog->ID);
$Form->hidden('mname', 'collections');
$Form->hidden('action_type', 'comment');
$Form->hidden('comment_ID', $edited_Comment->ID);
$Form->hidden('redirect_to', url_add_tail($comment_Item->get_permanent_url(), '#c' . $edited_Comment->ID));
$Form->info(T_('In response to'), $comment_Item->get_title());
if ($edited_Comment->get_author_User()) {
    $Form->info(T_('Author'), $edited_Comment->get_author());
} else {
    $Form->text_input('newcomment_author', $edited_Comment->author, 20, T_('Author'), '', array('maxlength' => 100, 'style' => 'width: 99%;'));
    $Form->text_input('newcomment_author_email', $edited_Comment->author_email, 20, T_('Email'), '', array('maxlength' => 100, 'style' => 'width: 99%;'));
    $Form->text_input('newcomment_author_url', $edited_Comment->author_url, 20, T_('Website URL'), '', array('maxlength' => 100, 'style' => 'width: 99%;'));
}
ob_start();
echo '<div class="comment_toolbars">';
// CALL PLUGINS NOW:
$Plugins->trigger_event('AdminDisplayToolbar', array('target_type' => 'Comment', 'edit_layout' => NULL, 'Comment' => $edited_Comment));
echo '</div>';
$plugins_toolbar = ob_get_clean();
$Form->switch_template_parts(array('inputstart' => '<td class="row2 left">' . $plugins_toolbar));
Beispiel #8
0
 /**
  * Get a param.
  *
  * @param string Parameter name
  * @return false|string The value as string or false in case of error (e.g. media dir is disabled).
  */
 function get($parname)
 {
     global $xmlsrv_url, $baseurl, $basepath, $media_url, $current_User, $Settings, $Debuglog;
     switch ($parname) {
         case 'blogurl':
             // Deprecated
         // Deprecated
         case 'link':
             // Deprecated
         // Deprecated
         case 'url':
             return $this->gen_blogurl('default');
         case 'baseurl':
             return $this->gen_baseurl();
         case 'baseurlroot':
             return $this->get_baseurl_root();
         case 'lastcommentsurl':
             return url_add_param($this->gen_blogurl(), 'disp=comments');
         case 'searchurl':
             return url_add_param($this->gen_blogurl(), 'disp=search');
         case 'arcdirurl':
             return url_add_param($this->gen_blogurl(), 'disp=arcdir');
         case 'catdirurl':
             return url_add_param($this->gen_blogurl(), 'disp=catdir');
         case 'postidxurl':
             return url_add_param($this->gen_blogurl(), 'disp=postidx');
         case 'mediaidxurl':
             return url_add_param($this->gen_blogurl(), 'disp=mediaidx');
         case 'sitemapurl':
             return url_add_param($this->gen_blogurl(), 'disp=sitemap');
         case 'msgformurl':
             return url_add_param($this->gen_blogurl(), 'disp=msgform');
         case 'userurl':
             return url_add_param($this->gen_blogurl(), 'disp=user');
         case 'usersurl':
             return url_add_param($this->gen_blogurl(), 'disp=users');
         case 'loginurl':
             return url_add_param($this->gen_blogurl(), 'disp=login');
         case 'subsurl':
             return url_add_param($this->gen_blogurl(), 'disp=subs#subs');
         case 'helpurl':
             if ($this->get_setting('help_link') == 'slug') {
                 return url_add_tail($this->gen_blogurl(), '/help');
             } else {
                 return url_add_param($this->gen_blogurl(), 'disp=help');
             }
         case 'skin_ID':
             return $this->get_skin_ID();
         case 'description':
             // RSS wording
         // RSS wording
         case 'shortdesc':
             return $this->shortdesc;
         case 'rdf_url':
             return $this->get_item_feed_url('_rdf');
         case 'rss_url':
             return $this->get_item_feed_url('_rss');
         case 'rss2_url':
             return $this->get_item_feed_url('_rss2');
         case 'atom_url':
             return $this->get_item_feed_url('_atom');
         case 'comments_rdf_url':
             return $this->get_comment_feed_url('_rdf');
         case 'comments_rss_url':
             return $this->get_comment_feed_url('_rss');
         case 'comments_rss2_url':
             return $this->get_comment_feed_url('_rss2');
         case 'comments_atom_url':
             return $this->get_comment_feed_url('_atom');
         case 'rsd_url':
             return $this->get_local_xmlsrv_url() . 'rsd.php?blog=' . $this->ID;
             /* Add the html for a blog-specified stylesheet
              * All stylesheets will be included if the blog settings allow it
              * and the file "style.css" exists. CSS rules say that the latter style sheets can
              * override earlier stylesheets.
              */
         /* Add the html for a blog-specified stylesheet
          * All stylesheets will be included if the blog settings allow it
          * and the file "style.css" exists. CSS rules say that the latter style sheets can
          * override earlier stylesheets.
          */
         case 'blog_css':
             if ($this->allowblogcss && file_exists($this->get_media_dir(false) . 'style.css')) {
                 return '<link rel="stylesheet" href="' . $this->get_media_url() . 'style.css" type="text/css" />';
             } else {
                 return '';
             }
             /* Add the html for a user-specified stylesheet
              * All stylesheets will be included if the blog settings allow it
              * and the file "style.css" exists. CSS rules say that the latter style sheets can
              * override earlier stylesheets. A user-specified stylesheet will
              * override a blog-specified stylesheet which will override a skin stylesheet.
              */
         /* Add the html for a user-specified stylesheet
          * All stylesheets will be included if the blog settings allow it
          * and the file "style.css" exists. CSS rules say that the latter style sheets can
          * override earlier stylesheets. A user-specified stylesheet will
          * override a blog-specified stylesheet which will override a skin stylesheet.
          */
         case 'user_css':
             if ($this->allowusercss && isset($current_User) && file_exists($current_User->get_media_dir(false) . 'style.css')) {
                 return '<link rel="stylesheet" href="' . $current_User->get_media_url() . 'style.css" type="text/css" />';
             } else {
                 return '';
             }
         default:
             // All other params:
             return parent::get($parname);
     }
 }
Beispiel #9
0
 /**
  * Generate the URL to access the category.
  *
  * @param string|NULL 'param_num', 'subchap', 'chapters'
  * @param string|NULL url to use
  * @param integer category page to link to, default:1
  * @param integer|NULL number of posts per page (used for param_num only)
  * @param string glue between url params
  */
 function get_permanent_url($link_type = NULL, $blogurl = NULL, $paged = 1, $chapter_posts_per_page = NULL, $glue = '&amp;')
 {
     global $DB, $cacheweekly, $Settings;
     if (empty($link_type)) {
         // Use default from settings:
         $this->get_Blog();
         $link_type = $this->Blog->get_setting('chapter_links');
     }
     if (empty($blogurl)) {
         $this->get_Blog();
         $blogurl = $this->Blog->gen_blogurl();
     }
     switch ($link_type) {
         case 'param_num':
             $r = url_add_param($blogurl, 'cat=' . $this->ID, $glue);
             if (empty($chapter_posts_per_page)) {
                 // Use default from Blog
                 $this->get_Blog();
                 $chapter_posts_per_page = $this->Blog->get_setting('chapter_posts_per_page');
             }
             if (!empty($chapter_posts_per_page) && $chapter_posts_per_page != $this->Blog->get_setting('posts_per_page')) {
                 // We want a specific post per page count:
                 $r = url_add_param($r, 'posts=' . $chapter_posts_per_page, $glue);
             }
             break;
         case 'subchap':
             $this->get_Blog();
             $category_prefix = $this->Blog->get_setting('category_prefix');
             if (!empty($category_prefix)) {
                 $r = url_add_tail($blogurl, '/' . $category_prefix . '/' . $this->urlname . '/');
             } else {
                 $r = url_add_tail($blogurl, '/' . $this->urlname . '/');
             }
             break;
         case 'chapters':
         default:
             $this->get_Blog();
             $category_prefix = $this->Blog->get_setting('category_prefix');
             if (!empty($category_prefix)) {
                 $r = url_add_tail($blogurl, '/' . $category_prefix . '/' . $this->get_url_path());
             } else {
                 $r = url_add_tail($blogurl, '/' . $this->get_url_path());
             }
             break;
     }
     if ($paged > 1) {
         $r = url_add_param($r, 'paged=' . $paged, $glue);
     }
     return $r;
 }
Beispiel #10
0
 /**
  * Get the item tiny url
  * @return string the tiny url on success, empty string otherwise
  */
 function get_tinyurl()
 {
     if (($tinyslug = $this->get_tinyslug()) == false) {
         return '';
     }
     $Blog =& $this->get_Blog();
     return url_add_tail($Blog->get('url'), '/' . $tinyslug);
 }
Beispiel #11
0
	if( this.value == 'prefix-only' )
		jQuery('#tag_prefix').closest('fieldset').andSelf().addClass('field_required');
	else
		jQuery('#tag_prefix').closest('fieldset').andSelf().removeClass('field_required');
} ).filter(":checked").click();

// Set text of span.tag_links_tag_prefix according to this field, defaulting to "tag" for "prefix-only".
jQuery("#tag_prefix").keyup( function() {
	jQuery("span.tag_links_tag_prefix").each(
		function() {
			var newval = ((jQuery("#tag_prefix").val().length || jQuery(this).closest("div").find("input[type=radio]").attr("value") != "prefix-only") ? jQuery("#tag_prefix").val() : "tag");
			if( newval.length ) newval += "/";
			jQuery(this).text( newval );
		}
	) } ).keyup();
</script>


<?php 
$Form->begin_fieldset(T_('Other filtered pages') . get_manual_link('other_filtered_pages_seo'));
$Form->checkbox('filtered_noindex', $edited_Blog->get_setting('filtered_noindex'), T_('Other filtered posts pages'), T_('META NOINDEX') . ' - ' . T_('Filtered by keyword search, by author, etc.'));
$Form->radio('filtered_content', $edited_Blog->get_setting('filtered_content'), array(array('excerpt', T_('Post excerpts')), array('normal', T_('Standard post contents (stopping at "&lt;!-- more -->")')), array('full', T_('Full post contents (including after "&lt;!-- more -->")'))), T_('Post contents'), true);
$Form->end_fieldset();
$Form->begin_fieldset(T_('Other pages') . get_manual_link('other_pages_seo'));
$Form->checkbox('feedback-popup_noindex', $edited_Blog->get_setting('feedback-popup_noindex'), T_('Comment popups'), T_('META NOINDEX') . ' - ' . T_('For skins with comment popups only.'));
$Form->checkbox('msgform_noindex', $edited_Blog->get_setting('msgform_noindex'), T_('Contact forms'), T_('META NOINDEX') . ' - ' . T_('WARNING: Letting search engines index contact forms will attract spam.'));
$Form->checkbox('special_noindex', $edited_Blog->get_setting('special_noindex'), T_('Other special pages'), T_('META NOINDEX') . ' - ' . T_('Pages with no index setting of their own... yet.'));
$Form->radio('404_response', $edited_Blog->get_setting('404_response'), array(array('200', T_('200 "OK" response')), array('301', T_('301 redirect to main page')), array('302', T_('302 redirect to main page')), array('303', T_('303 redirect to main page')), array('404', T_('404 "Not found" response')), array('410', T_('410 "Gone" response'))), T_('404 "Not Found" response'), true);
$Form->radio('help_link', $edited_Blog->get_setting('help_link'), array(array('param', T_('Use param') . ': ?disp=help', T_('E-g: ') . url_add_param($blogurl, '<strong>disp=help</strong>')), array('slug', T_('Use extra-path') . ': ' . '/help', T_('E-g: ') . url_add_tail($blogurl, '<strong>/help</strong>'))), T_('Help page'), true);
$Form->end_fieldset();
$Form->end_form(array(array('submit', 'submit', T_('Save !'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton')));
Beispiel #12
0
{
	// Disable tag_prefix, if "param" is used.
	jQuery('#tag_prefix').attr("disabled", this.value == 'param' ? "disabled" : "");
	// Disable tag_rel_attrib, if "prefix-only" is not used.
	jQuery('#tag_rel_attrib').attr("disabled", this.value == 'prefix-only' ? "" : "disabled");

	// NOTE: dh> ".closest('fieldset').andSelf()" is required for the add-field_required-class-to-fieldset-hack. Remove as appropriate.
	if( this.value == 'prefix-only' )
		jQuery('#tag_prefix').closest('fieldset').andSelf().addClass('field_required');
	else
		jQuery('#tag_prefix').closest('fieldset').andSelf().removeClass('field_required');
} ).filter(":checked").click();

// Set text of span.tag_links_tag_prefix according to this field, defaulting to "tag" for "prefix-only".
jQuery("#tag_prefix").keyup( function() {
	jQuery("span.tag_links_tag_prefix").each(
		function() {
			var newval = ((jQuery("#tag_prefix").val().length || jQuery(this).closest("div").find("input[type=radio]").attr("value") != "prefix-only") ? jQuery("#tag_prefix").val() : "tag");
			if( newval.length ) newval += "/";
			jQuery(this).text( newval );
		}
	) } ).keyup();
</script>


<?php 
$Form->begin_fieldset(T_('Single post URLs'));
$Form->radio('single_links', $edited_Blog->get_setting('single_links'), array(array('param_num', T_('Use param: post ID'), T_('E-g: ') . url_add_param($blogurl, '<strong>p=123&amp;more=1</strong>')), array('param_title', T_('Use param: post title'), T_('E-g: ') . url_add_param($blogurl, '<strong>title=post-title&amp;more=1</strong>')), array('short', T_('Use extra-path: post title'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/post-title</strong>')), array('y', T_('Use extra-path: year'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/2006/post-title</strong>')), array('ym', T_('Use extra-path: year & month'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/2006/12/post-title</strong>')), array('ymd', T_('Use extra-path: year, month & day'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/2006/12/31/post-title</strong>')), array('subchap', T_('Use extra-path: sub-category'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/subcat/post-title</strong>')), array('chapters', T_('Use extra-path: category path'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/cat/subcat/post-title</strong>'))), T_('Single post URLs'), true);
$Form->end_fieldset();
$Form->buttons(array(array('submit', 'submit', T_('Save !'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton')));
$Form->end_form();
            // /skins/_item_comment.inc.php file into the current skin folder.
            // ---------------------- END OF COMMENT ---------------------
            if ($Blog->get_setting('threaded_comments')) {
                // Display the comment replies
                display_comment_replies($Comment->ID, $params);
            }
            $comment_number++;
        }
        // End of comment list loop.
        if (!$params['nav_bottom_inside']) {
            // To use comments page navigation after list
            echo $params['comment_list_end'];
        }
        if ($params['disp_nav_bottom'] && $Blog->get_setting('paged_comments')) {
            // Prev/Next page navigation
            $CommentList->page_links(array_merge(array('page_url' => url_add_tail($Item->get_permanent_url(), '#comments'), 'block_start' => $params['nav_block_start'], 'block_end' => $params['nav_block_end'], 'prev_text' => $params['nav_prev_text'], 'next_text' => $params['nav_next_text'], 'prev_class' => $params['nav_prev_class'], 'next_class' => $params['nav_next_class']), $params['pagination']));
        }
        if ($params['nav_bottom_inside']) {
            // To use comments page navigation inside list (Useful for table markup)
            echo $params['comment_list_end'];
        }
        // Restore "redir" param
        forget_param('redir');
        // _______________________________________________________________
        // Display count of comments to be moderated:
        $Item->feedback_moderation('feedbacks', '<p class="alert alert-info">', '</p>', '', T_('This post has 1 feedback awaiting moderation... %s'), T_('This post has %d feedbacks awaiting moderation... %s'));
        // _______________________________________________________________
    }
    echo '</section>';
}
// ------------------ COMMENT FORM INCLUDED HERE ------------------
Beispiel #14
0
    ?>
		<script type="text/javascript">
			<!--
			var fldset = document.getElementById( 'category_prefix_container' );
			fldset.style.display = 'none';
			//-->
		</script>
		<?php 
}
$Form->checkbox('canonical_cat_urls', $edited_Blog->get_setting('canonical_cat_urls'), T_('Make canonical'), T_('301 redirect to canonical URL'));
$Form->checkbox('chapter_noindex', $edited_Blog->get_setting('chapter_noindex'), T_('Indexing'), T_('META NOINDEX'));
$Form->text('chapter_posts_per_page', $edited_Blog->get_setting('chapter_posts_per_page'), 4, T_('Posts per page'), T_('Leave empty to use blog default') . ' (' . $edited_Blog->get_setting('posts_per_page') . ')', 4);
$Form->checkbox('catdir_noindex', $edited_Blog->get_setting('catdir_noindex'), T_('Category directory'), T_('META NOINDEX'));
$Form->end_fieldset();
$Form->begin_fieldset(T_('Tag pages') . get_manual_link('tag_pages_seo'));
$Form->radio('tag_links', $edited_Blog->get_setting('tag_links'), array(array('param', T_('Use param'), T_('E-g: ') . url_add_param($blogurl, '<strong>tag=mytag</strong>'), '', 'onclick="show_hide_tag_prefix(this);"'), array('semicol', T_('Use extra-path'), T_('E-g: ') . url_add_tail($blogurl, '<strong>/mytag;</strong>'), '', 'onclick="show_hide_tag_prefix(this);"')), T_('Tag page URLs'), true);
echo '<div id="tag_prefix_container">';
$Form->text_input('tag_prefix', $edited_Blog->get_setting('tag_prefix'), 30, T_('Prefix'), T_('An optional prefix to be added to the URLs of the tag pages'), array('maxlength' => 120));
echo '</div>';
if ($edited_Blog->get_setting('tag_links') == 'param') {
    ?>
	<script type="text/javascript">
		<!--
		var fldset = document.getElementById( 'tag_prefix_container' );
		fldset.style.display = 'none';
		//-->
	</script>
	<?php 
}
$Form->checkbox('canonical_tag_urls', $edited_Blog->get_setting('canonical_tag_urls'), T_('Make canonical'), T_('301 redirect to canonical URL'));
$Form->checkbox('tag_noindex', $edited_Blog->get_setting('tag_noindex'), T_('Indexing'), T_('META NOINDEX'));
Beispiel #15
0
 /**
  * Get a param.
  *
  * @param string Parameter name
  * @param array Additional params
  * @return false|string The value as string or false in case of error (e.g. media dir is disabled).
  */
 function get($parname, $params = array())
 {
     global $xmlsrv_url, $baseurl, $basepath, $media_url, $current_User, $Settings, $Debuglog;
     if (gettype($params) != 'array') {
         debug_die('wrong $params');
     }
     $params = array_merge(array('glue' => '&amp;', 'url_suffix' => ''), $params);
     switch ($parname) {
         case 'blogurl':
             // Deprecated
         // Deprecated
         case 'link':
             // Deprecated
         // Deprecated
         case 'url':
             return $this->gen_blogurl('default');
         case 'baseurl':
             return $this->gen_baseurl();
         case 'baseurlroot':
             return $this->get_baseurl_root();
         case 'recentpostsurl':
             $disp_param = 'posts';
             break;
         case 'lastcommentsurl':
             $disp_param = 'comments';
             break;
         case 'searchurl':
             $disp_param = 'search';
             break;
         case 'arcdirurl':
             $disp_param = 'arcdir';
             break;
         case 'catdirurl':
             $disp_param = 'catdir';
             break;
         case 'postidxurl':
             $disp_param = 'postidx';
             break;
         case 'mediaidxurl':
             $disp_param = 'mediaidx';
             break;
         case 'sitemapurl':
             $disp_param = 'sitemap';
             break;
         case 'msgformurl':
             $disp_param = 'msgform';
             break;
         case 'profileurl':
             $disp_param = 'profile';
             break;
         case 'avatarurl':
             $disp_param = 'avatar';
             break;
         case 'pwdchangeurl':
             $disp_param = 'pwdchange';
             break;
         case 'userprefsurl':
             $disp_param = 'userprefs';
             break;
         case 'subsurl':
             $disp_param = 'subs';
             $params['url_suffix'] .= '#subs';
             break;
         case 'userurl':
             $disp_param = 'user';
             break;
         case 'usersurl':
             $disp_param = 'users';
             break;
         case 'tagsurl':
             $disp_param = 'tags';
             break;
         case 'termsurl':
             $disp_param = 'terms';
             break;
         case 'loginurl':
         case 'registerurl':
         case 'lostpasswordurl':
         case 'activateinfourl':
         case 'access_requires_loginurl':
             $url_disp = str_replace('url', '', $parname);
             if ($login_Blog =& get_setting_Blog('login_blog_ID')) {
                 // Use special blog for login/register actions if it is defined in general settings
                 return url_add_param($login_Blog->gen_blogurl(), 'disp=' . $url_disp, $params['glue']);
             } else {
                 // Use login/register urls of this blog
                 return url_add_param($this->gen_blogurl(), 'disp=' . $url_disp, $params['glue']);
             }
         case 'threadsurl':
             $disp_param = 'threads';
             break;
         case 'messagesurl':
             $disp_param = 'messages';
             break;
         case 'contactsurl':
             $disp_param = 'contacts';
             break;
         case 'helpurl':
             if ($this->get_setting('help_link') == 'slug') {
                 return url_add_tail($this->gen_blogurl(), '/help');
             } else {
                 $disp_param = 'help';
                 break;
             }
         case 'skin_ID':
             return $this->get_skin_ID();
         case 'description':
             // RSS wording
         // RSS wording
         case 'shortdesc':
             return $this->shortdesc;
         case 'rdf_url':
             return $this->get_item_feed_url('_rdf');
         case 'rss_url':
             return $this->get_item_feed_url('_rss');
         case 'rss2_url':
             return $this->get_item_feed_url('_rss2');
         case 'atom_url':
             return $this->get_item_feed_url('_atom');
         case 'comments_rdf_url':
             return $this->get_comment_feed_url('_rdf');
         case 'comments_rss_url':
             return $this->get_comment_feed_url('_rss');
         case 'comments_rss2_url':
             return $this->get_comment_feed_url('_rss2');
         case 'comments_atom_url':
             return $this->get_comment_feed_url('_atom');
         case 'rsd_url':
             return $this->get_local_xmlsrv_url() . 'rsd.php?blog=' . $this->ID;
             /* Add the html for a blog-specified stylesheet
              * All stylesheets will be included if the blog settings allow it
              * and the file "style.css" exists. CSS rules say that the latter style sheets can
              * override earlier stylesheets.
              */
         /* Add the html for a blog-specified stylesheet
          * All stylesheets will be included if the blog settings allow it
          * and the file "style.css" exists. CSS rules say that the latter style sheets can
          * override earlier stylesheets.
          */
         case 'blog_css':
             if ($this->allowblogcss && file_exists($this->get_media_dir(false) . 'style.css')) {
                 return '<link rel="stylesheet" href="' . $this->get_media_url() . 'style.css" type="text/css" />';
             } else {
                 return '';
             }
             /* Add the html for a user-specified stylesheet
              * All stylesheets will be included if the blog settings allow it
              * and the file "style.css" exists. CSS rules say that the latter style sheets can
              * override earlier stylesheets. A user-specified stylesheet will
              * override a blog-specified stylesheet which will override a skin stylesheet.
              */
         /* Add the html for a user-specified stylesheet
          * All stylesheets will be included if the blog settings allow it
          * and the file "style.css" exists. CSS rules say that the latter style sheets can
          * override earlier stylesheets. A user-specified stylesheet will
          * override a blog-specified stylesheet which will override a skin stylesheet.
          */
         case 'user_css':
             if ($this->allowusercss && isset($current_User) && file_exists($current_User->get_media_dir(false) . 'style.css')) {
                 return '<link rel="stylesheet" href="' . $current_User->get_media_url() . 'style.css" type="text/css" />';
             } else {
                 return '';
             }
         default:
             // All other params:
             return parent::get($parname);
     }
     if (!empty($disp_param)) {
         // Get url depending on value of param 'disp'
         $this_Blog =& $this;
         if (in_array($disp_param, array('threads', 'messages', 'contacts', 'msgform', 'user', 'profile', 'avatar', 'pwdchange', 'userprefs', 'subs'))) {
             // Check if we can use this blog for messaging actions or we should use spec blog
             if ($msg_Blog =& get_setting_Blog('msg_blog_ID')) {
                 // Use special blog for messaging actions if it is defined in general settings
                 $this_Blog =& $msg_Blog;
             }
         }
         if ($this_Blog->get_setting('front_disp') == $disp_param) {
             // Get home page of this blog because front page displays current disp
             $url = $this_Blog->gen_blogurl('default');
         } else {
             // Add disp param to blog's url when current disp is not a front page
             $url = url_add_param($this_Blog->gen_blogurl(), 'disp=' . $disp_param, $params['glue']);
         }
         if (!empty($params['url_suffix'])) {
             // Append url suffix
             $url = url_add_param($url, $params['url_suffix'], $params['glue']);
         }
         return $url;
     }
 }