/** * Template tag. Initializes internal states for the most common skin displays. * * For more specific skins, this function should not be called and * equivalent code should be customized within the skin. * * @param string What are we going to display. Most of the time the global $disp should be passed. */ function skin_init($disp) { /** * @var Blog */ global $Blog; /** * @var Item */ global $Item; /** * @var Skin */ global $Skin; global $robots_index; global $seo_page_type; global $redir, $ReqURL, $ReqURI, $m, $w, $preview; global $Chapter; global $Debuglog; /** * @var ItemList2 */ global $MainList; /** * This will give more detail when $disp == 'posts'; otherwise it will have the same content as $disp * @var string */ global $disp_detail, $Settings; global $Timer; global $Messages, $PageCache; $Timer->resume('skin_init'); if (empty($disp_detail)) { $disp_detail = $disp; } $Debuglog->add('skin_init: ' . $disp, 'skins'); // This is the main template; it may be used to display very different things. // Do inits depending on current $disp: switch ($disp) { case 'posts': case 'single': case 'page': case 'feedback-popup': case 'search': // We need to load posts for this display: // Note: even if we request the same post as $Item above, the following will do more restrictions (dates, etc.) // Init the MainList object: init_MainList($Blog->get_setting('posts_per_page')); // Init post navigation $post_navigation = $Skin->get_post_navigation(); if (empty($post_navigation)) { $post_navigation = $Blog->get_setting('post_navigation'); } break; } // SEO stuff & redirects if necessary: $seo_page_type = NULL; switch ($disp) { // CONTENT PAGES: case 'single': case 'page': init_ajax_forms(); // auto requires jQuery init_ratings_js(); init_voting_comment_js(); init_scrollwide_js(); // Add jQuery Wide Scroll plugin if ($disp == 'single') { $seo_page_type = 'Single post page'; } else { $seo_page_type = '"Page" page'; } // Check if the post has 'redirected' status: if (!$preview && $Item->status == 'redirected' && $redir == 'yes') { // $redir=no here allows to force a 'single post' URL for commenting // Redirect to the URL specified in the post: $Debuglog->add('Redirecting to post URL [' . $Item->url . '].'); header_redirect($Item->url, true); } // Check if we want to redirect to a canonical URL for the post // Please document encountered problems. if (!$preview && ($Blog->get_setting('canonical_item_urls') && $redir == 'yes' || $Blog->get_setting('relcanonical_item_urls'))) { // We want to redirect to the Item's canonical URL: $canonical_url = $Item->get_permanent_url('', '', '&'); if (preg_match('|[&?](page=\\d+)|', $ReqURI, $page_param)) { // A certain post page has been requested, keep only this param and discard all others: $canonical_url = url_add_param($canonical_url, $page_param[1], '&'); } if (preg_match('|[&?](mode=quote&[qcp]+=\\d+)|', $ReqURI, $page_param)) { // A quote of comment/post, keep only these params and discard all others: $canonical_url = url_add_param($canonical_url, $page_param[1], '&'); } if (!is_same_url($ReqURL, $canonical_url)) { // The requested URL does not look like the canonical URL for this post... // url difference was resolved $url_resolved = false; // Check if the difference is because of an allowed post navigation param if (preg_match('|[&?]cat=(\\d+)|', $ReqURI, $cat_param)) { // A category post navigation param is set $extended_url = ''; if ($post_navigation == 'same_category' && isset($cat_param[1])) { // navigatie through posts from the same category $category_ids = postcats_get_byID($Item->ID); if (in_array($cat_param[1], $category_ids)) { // cat param is one of this Item categories $extended_url = $Item->add_navigation_param($canonical_url, $post_navigation, $cat_param[1], '&'); // Set MainList navigation target to the requested category $MainList->nav_target = $cat_param[1]; } } $url_resolved = is_same_url($ReqURL, $extended_url); } if (!$url_resolved && $Blog->get_setting('canonical_item_urls') && $redir == 'yes' && !$Item->check_cross_post_nav('auto', $Blog->ID)) { // REDIRECT TO THE CANONICAL URL: $Debuglog->add('Redirecting to canonical URL [' . $canonical_url . '].'); header_redirect($canonical_url, true); } else { // Use rel="canoncial": add_headline('<link rel="canonical" href="' . $canonical_url . '" />'); } // EXITED. } } if (!$MainList->result_num_rows) { // There is nothing to display for this page, don't index it! $robots_index = false; } break; case 'posts': init_ajax_forms('blog'); // auto requires jQuery init_scrollwide_js('blog'); // Add jQuery Wide Scroll plugin // fp> if we add this here, we have to exetnd the inner if() // init_ratings_js( 'blog' ); // Get list of active filters: $active_filters = $MainList->get_active_filters(); if (!empty($active_filters)) { // The current page is being filtered... if (array_diff($active_filters, array('page')) == array()) { // This is just a follow "paged" page $disp_detail = 'posts-next'; $seo_page_type = 'Next page'; if ($Blog->get_setting('paged_noindex')) { // We prefer robots not to index category pages: $robots_index = false; } } elseif (array_diff($active_filters, array('cat_array', 'cat_modifier', 'cat_focus', 'posts', 'page')) == array()) { // This is a category page $disp_detail = 'posts-cat'; $seo_page_type = 'Category page'; if ($Blog->get_setting('chapter_noindex')) { // We prefer robots not to index category pages: $robots_index = false; } global $cat, $catsel; if (empty($catsel) && preg_match('~[0-9]+~', $cat)) { // We are on a single cat page: // NOTE: we must have selected EXACTLY ONE CATEGORY through the cat parameter // BUT: - this can resolve to including children // - selecting exactly one cat through catsel[] is NOT OK since not equivalent (will exclude children) // echo 'SINGLE CAT PAGE'; if ($Blog->get_setting('canonical_cat_urls') && $redir == 'yes' || $Blog->get_setting('relcanonical_cat_urls')) { // Check if the URL was canonical: if (!isset($Chapter)) { $ChapterCache =& get_ChapterCache(); /** * @var Chapter */ $Chapter =& $ChapterCache->get_by_ID($MainList->filters['cat_array'][0], false); } if ($Chapter) { if ($Chapter->parent_ID) { // This is a sub-category page (i-e: not a level 1 category) $disp_detail = 'posts-subcat'; } $canonical_url = $Chapter->get_permanent_url(NULL, NULL, $MainList->get_active_filter('page'), NULL, '&'); if (!is_same_url($ReqURL, $canonical_url)) { // fp> TODO: we're going to lose the additional params, it would be better to keep them... // fp> what additional params actually? if ($Blog->get_setting('canonical_cat_urls') && $redir == 'yes') { // REDIRECT TO THE CANONICAL URL: header_redirect($canonical_url, true); } else { // Use rel="canonical": add_headline('<link rel="canonical" href="' . $canonical_url . '" />'); } } } } if ($post_navigation == 'same_category') { // Category is set and post navigation should go through the same category, set navigation target param $MainList->nav_target = $cat; } } } elseif (array_diff($active_filters, array('tags', 'posts', 'page')) == array()) { // This is a tag page $disp_detail = 'posts-tag'; $seo_page_type = 'Tag page'; if ($Blog->get_setting('tag_noindex')) { // We prefer robots not to index tag pages: $robots_index = false; } if ($Blog->get_setting('canonical_tag_urls') && $redir == 'yes' || $Blog->get_setting('relcanonical_tag_urls')) { // Check if the URL was canonical: $canonical_url = $Blog->gen_tag_url($MainList->get_active_filter('tags'), $MainList->get_active_filter('page'), '&'); if (!is_same_url($ReqURL, $canonical_url)) { if ($Blog->get_setting('canonical_tag_urls') && $redir == 'yes') { // REDIRECT TO THE CANONICAL URL: header_redirect($canonical_url, true); } else { // Use rel="canoncial": add_headline('<link rel="canonical" href="' . $canonical_url . '" />'); } } } } elseif (array_diff($active_filters, array('ymdhms', 'week', 'posts', 'page')) == array()) { // This is an archive page // echo 'archive page'; $disp_detail = 'posts-date'; $seo_page_type = 'Date archive page'; if ($Blog->get_setting('canonical_archive_urls') && $redir == 'yes' || $Blog->get_setting('relcanonical_archive_urls')) { // Check if the URL was canonical: $canonical_url = $Blog->gen_archive_url(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2), $w, '&', $MainList->get_active_filter('page')); if (!is_same_url($ReqURL, $canonical_url)) { if ($Blog->get_setting('canonical_archive_urls') && $redir == 'yes') { // REDIRECT TO THE CANONICAL URL: header_redirect($canonical_url, true); } else { // Use rel="canoncial": add_headline('<link rel="canonical" href="' . $canonical_url . '" />'); } } } if ($Blog->get_setting('archive_noindex')) { // We prefer robots not to index archive pages: $robots_index = false; } } else { // Other filtered pages: // pre_dump( $active_filters ); $disp_detail = 'posts-filtered'; $seo_page_type = 'Other filtered page'; if ($Blog->get_setting('filtered_noindex')) { // We prefer robots not to index other filtered pages: $robots_index = false; } } } else { // This is the default blog page $disp_detail = 'posts-default'; $seo_page_type = 'Default page'; if ($Blog->get_setting('canonical_homepage') && $redir == 'yes' || $Blog->get_setting('relcanonical_homepage')) { // Check if the URL was canonical: $canonical_url = $Blog->gen_blogurl(); if (!is_same_url($ReqURL, $canonical_url)) { if ($Blog->get_setting('canonical_homepage') && $redir == 'yes') { // REDIRECT TO THE CANONICAL URL: header_redirect($canonical_url, true); } else { // Use rel="canoncial": add_headline('<link rel="canonical" href="' . $canonical_url . '" />'); } } } if ($Blog->get_setting('default_noindex')) { // We prefer robots not to index archive pages: $robots_index = false; } } break; case 'search': $seo_page_type = 'Search page'; if ($Blog->get_setting('filtered_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; // SPECIAL FEATURE PAGES: // SPECIAL FEATURE PAGES: case 'feedback-popup': $seo_page_type = 'Comment popup'; if ($Blog->get_setting($disp . '_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; case 'arcdir': $seo_page_type = 'Date archive directory'; if ($Blog->get_setting($disp . '_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; case 'catdir': $seo_page_type = 'Category directory'; if ($Blog->get_setting($disp . '_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; case 'msgform': init_ajax_forms('blog'); // auto requires jQuery $seo_page_type = 'Contact form'; if ($Blog->get_setting($disp . '_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; case 'messages': case 'contacts': case 'threads': init_results_js('blog'); // Add functions to work with Results tables // just in case some robot would be logged in: $seo_page_type = 'Messaging module'; $robots_index = false; break; case 'login': global $Plugins, $transmit_hashed_password; $seo_page_type = 'Login form'; $robots_index = false; require_js('functions.js', 'blog'); $transmit_hashed_password = (bool) $Settings->get('js_passwd_hashing') && !(bool) $Plugins->trigger_event_first_true('LoginAttemptNeedsRawPassword'); if ($transmit_hashed_password) { // Include JS for client-side password hashing: require_js('sha1_md5.js', 'blog'); } break; case 'register': if (is_logged_in()) { // If user is logged in the register form should not be displayed. In this case redirect to the blog home page. $Messages->add(T_('You are already logged in.'), 'note'); header_redirect($Blog->gen_blogurl(), false); } $seo_page_type = 'Register form'; $robots_index = false; break; case 'lostpassword': if (is_logged_in()) { // If user is logged in the lost password form should not be displayed. In this case redirect to the blog home page. $Messages->add(T_('You are already logged in.'), 'note'); header_redirect($Blog->gen_blogurl(), false); } $seo_page_type = 'Lost password form'; $robots_index = false; break; case 'profile': global $rsc_url; require_css($rsc_url . 'css/jquery/smoothness/jquery-ui.css'); init_userfields_js('blog'); case 'avatar': case 'pwdchange': case 'userprefs': case 'subs': $seo_page_type = 'Special feature page'; if ($Blog->get_setting('special_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; case 'users': $seo_page_type = 'Users list'; $robots_index = false; global $rsc_url; require_css($rsc_url . 'css/jquery/smoothness/jquery-ui.css'); init_results_js('blog'); // Add functions to work with Results tables break; case 'user': $seo_page_type = 'User display'; if (is_logged_in()) { // Used for combo_box contacts groups require_js('form_extensions.js', 'blog'); } break; case 'edit': init_datepicker_js('blog'); require_js('admin.js', 'blog'); init_inskin_editing('blog'); init_plugins_js('blog'); break; case 'edit_comment': init_plugins_js('blog'); break; case 'useritems': case 'usercomments': global $inc_path, $display_params, $viewed_User; // get user_ID because we want it in redirect_to in case we need to ask for login. $user_ID = param('user_ID', 'integer', true, true); if (empty($user_ID)) { bad_request_die(sprintf(T_('Parameter «%s» is required!'), 'user_ID')); } // set where to redirect in case of error $error_redirect_to = empty($Blog) ? $baseurl : $Blog->gen_blogurl(); if (!is_logged_in()) { // Redirect to the login page if not logged in and allow anonymous user setting is OFF $Messages->add(T_('You must log in to view this user profile.')); header_redirect(get_login_url('cannot see user'), 302); // will have exited } if (is_logged_in() && !check_user_status('can_view_user', $user_ID)) { // user is logged in, but his/her status doesn't permit to view user profile if (check_user_status('can_be_validated')) { // user is logged in but his/her account is not active yet // Redirect to the account activation page $Messages->add(T_('You must activate your account before you can view this user profile. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } $Messages->add(T_('Your account status currently does not permit to view this user profile.')); header_redirect($error_redirect_to, 302); // will have exited } if (!empty($user_ID)) { $UserCache =& get_UserCache(); $viewed_User = $UserCache->get_by_ID($user_ID, false); if (empty($viewed_User)) { $Messages->add(T_('The requested user does not exist!')); header_redirect($error_redirect_to); // will have exited } if ($viewed_User->check_status('is_closed')) { $Messages->add(T_('The requested user account is closed!')); header_redirect($error_redirect_to); // will have exited } } // Require results.css to display thread query results in a table require_css('results.css'); // Results/tables styles // Require functions.js to show/hide a panel with filters require_js('functions.js', 'blog'); // Include this file to expand/collapse the filters panel when JavaScript is disabled require_once $inc_path . '_filters.inc.php'; $display_params = !empty($Skin) ? $Skin->get_template('Results') : NULL; if ($disp == 'useritems') { // Init items list global $user_ItemList; $param_prefix = 'useritems_'; $page = param($param_prefix . 'paged', 'integer', 1); $orderby = param($param_prefix . 'orderby', 'string', $Blog->get_setting('orderby')); $order = param($param_prefix . 'order', 'string', $Blog->get_setting('orderdir')); $useritems_Blog = NULL; $user_ItemList = new ItemList2($useritems_Blog, NULL, NULL, NULL, 'ItemCache', $param_prefix); $user_ItemList->load_from_Request(); $user_ItemList->set_filters(array('page' => $page, 'authors' => $user_ID, 'orderby' => str_replace($param_prefix, '', $orderby), 'order' => str_replace($param_prefix, '', $order))); $user_ItemList->query(); } else { // Init comments list global $user_CommentList; $param_prefix = 'usercmts_'; $page = param($param_prefix . 'paged', 'integer', 1); $orderby = param($param_prefix . 'orderby', 'string', 'date'); $order = param($param_prefix . 'order', 'string', $Blog->get_setting('orderdir')); $user_CommentList = new CommentList2(NULL, NULL, 'CommentCache', $param_prefix); $user_CommentList->load_from_Request(); $user_CommentList->set_filters(array('page' => $page, 'author_IDs' => $user_ID, 'orderby' => str_replace($param_prefix, '', $orderby), 'order' => str_replace($param_prefix, '', $order))); $user_CommentList->query(); } break; case 'comments': if (!$Blog->get_setting('comments_latest')) { // If latest comments page is disabled - Display 404 page with error message $Messages->add(T_('This feature is disabled.'), 'error'); global $disp; $disp = '404'; } else { break; } case '404': // We have a 404 unresolved content error // How do we want do deal with it? skin_404_header(); // This MAY or MAY not have exited -- will exit on 30x redirect, otherwise will return here. // Just in case some dumb robot needs extra directives on this: $robots_index = false; break; } if (!empty($_SERVER['HTTP_USER_AGENT'])) { // Detect IE browser version preg_match('/msie (\\d+)/i', $_SERVER['HTTP_USER_AGENT'], $browser_ie); if (count($browser_ie) == 2 && $browser_ie[1] < 7) { // IE < 7 require_css('ie6.css', 'relative'); $Messages->add(T_('Your web browser is too old. For this site to work correctly, we recommend you use a more recent browser.'), 'note'); } } // dummy var for backward compatibility with versions < 2.4.1 -- prevents "Undefined variable" global $global_Cache, $credit_links; $credit_links = $global_Cache->get('creds'); $Timer->pause('skin_init'); // Check if user is logged in with a not active account, and display an error message if required check_allow_disp($disp); // initialize Blog enabled widgets, before displaying anything init_blog_widgets($Blog->ID); // Initialize displaying.... $Timer->start('Skin:display_init'); $Skin->display_init(); $Timer->pause('Skin:display_init'); // Send default headers: // See comments inside of this function: headers_content_mightcache('text/html'); // In most situations, you do NOT want to cache dynamic content! // Never allow Messages to be cached! if ($Messages->count() && !empty($PageCache)) { // Abort PageCache collect $PageCache->abort_collect(); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $Messages, $disp, $debug; // Request some common features that the parent function (Skin::display_init()) knows how to provide: parent::display_init(array('jquery', 'font_awesome', 'bootstrap', 'bootstrap_evo_css', 'bootstrap_messages', 'style_css', 'colorbox', 'bootstrap_init_tooltips', 'disp_auto')); // Skin specific initializations: // Add custom CSS: $custom_css = ''; // Custom background color: if ($color = $this->get_setting('bg_color')) { $custom_css = 'body { background: ' . $color . " }\n"; } // Custom text color: if ($color = $this->get_setting('text_color')) { $custom_css .= '.main, .content blockquote, .content address, .content p, .content li, .content td, .content dd, .result_content, .search_title, .main textarea { color: ' . $color . " }\n"; } // Custom headings color: if ($color = $this->get_setting('headings_color')) { $custom_css .= '.content h1, .content h2, .content h3, .content h4, .content h5, .content h6, .content cite, .main .title { color: ' . $color . " }\n"; $custom_css .= '.content cite { border-bottom: 2px solid ' . $color . " }\n"; } // Custom link color: if ($color = $this->get_setting('link_color')) { $custom_css .= '.main a, .main .nav > li a, .main .pagination>li>a, .main .panel-default>.panel-heading a, .main .panel-default>.panel-heading .panel-icon, .main .panel-title, .main .evo_post_more_link, .main .evo_comment .panel-heading .evo_comment_title { color: ' . $color . " }\n"; } // Custom link hover color: if ($color = $this->get_setting('link_h_color')) { $custom_css .= '.content a:hover, .color-hover a:hover, .main .nav > li a:hover, .main .pagination>li>a:hover, .main .pagination>li>span:hover, .main .pagination>li.active>span, .main .pager li>a, .main .pager li>span, .profile_column_right .panel-default .panel-heading, .main .panel-title a, .main .evo_post_more_link a, .main .evo_post__excerpt_more_link a, .main .evo_comment .panel-heading a:hover, .main .evo_comment .panel-heading a, profile_column_left h1, .profile_column_left .profile_buttons .btn-primary, .profile_column_left .profile_buttons .btn-primary button, .profile_column_left h1, .main button, .main input.submit, .main input.preview, .main input[type="reset"], .main input[type="submit"] { color: ' . $color . " }\n"; $custom_css .= '#bCalendarToday { background: ' . $color . " }\n"; } // Sections background color: if ($color = $this->get_setting('section_bg')) { $custom_css .= '.main .nav > li a, .main .pager li>a, .main .pager li>span, .featured_post, .main .panel-default>.panel-heading, .main .evo_post_more_link a, .main .evo_post__excerpt_more_link a, .evo_comment_footer small a { background: ' . $color . " }\n"; $custom_css .= '.main .pagination>li>a, .main .pagination>li>span, .small >span, .profile_column_left .profile_buttons .btn-group a, .profile_column_left .profile_buttons p a button, .main .input.submit, .main input[type="button"]:focus, .main input[type="reset"]:focus, .main input[type="submit"]:focus, .main button:active, .main input[type="button"]:active, .main input[type="reset"]:active, .main input[type="submit"]:active, .main input[type="submit"] { background: ' . $color . " !important }\n"; } // Divider color: if ($color = $this->get_setting('divider_color')) { $custom_css .= '.post, .main .panel-group .panel li, .content ul li, .main .evo_comment { border-bottom: 1px solid ' . $color . " }\n"; $custom_css .= '.post, .main .panel-group .panel li ul, .content ul li ul { border-top: 1px solid ' . $color . " }\n"; $custom_css .= 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], textarea, input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, textarea:focus { border: 2px solid ' . $color . " !important }\n"; } // Custom link hover color: if ($color = $this->get_setting('header_bg')) { $custom_css .= '.masterhead { background-color: ' . $color . " }\n"; } // Custom link hover color: if ($color = $this->get_setting('header_color')) { $custom_css .= '.masterhead, .masterhead .widget_core_coll_title a, .masterhead .widget_core_coll_title a:hover { color: ' . $color . "}\n"; } // Limit images by max height: $max_image_height = intval($this->get_setting('max_image_height')); if ($max_image_height > 0) { add_css_headline('.evo_image_block img { max-height: ' . $max_image_height . 'px; width: auto; }'); } // Initialize a template depending on current page switch ($disp) { case 'front': // Init star rating for intro posts: init_ratings_js('blog', true); break; case 'posts': global $cat, $bootstrap_manual_posts_text; // Init star rating for intro posts: init_ratings_js('blog', true); $bootstrap_manual_posts_text = T_('Posts'); if (!empty($cat)) { // Init the <title> for categories page: $ChapterCache =& get_ChapterCache(); if ($Chapter =& $ChapterCache->get_by_ID($cat, false)) { $bootstrap_manual_posts_text = $Chapter->get('name'); } } break; } if ($this->is_left_navigation_visible() && $this->get_setting('left_navigation') == true) { // Include JS code for left navigation panel only when it is displayed: require_js($this->get_url() . 'left_navigation.js'); } // Function for custom css if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
* * @package evoskins * @subpackage manual */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } if (version_compare($app_version, '5.0') < 0) { // Older skins (versions 2.x and above) should work on newer b2evo versions, but newer skins may not work on older b2evo versions. die('This skin is designed for b2evolution 5.0 and above. Please <a href="http://b2evolution.net/downloads/index.html">upgrade your b2evolution</a>.'); } // This is the main template; it may be used to display very different things. // Do inits depending on current $disp: skin_init($disp); // Init star rating for intro posts init_ratings_js('blog', true); // -------------------------- HTML HEADER INCLUDED HERE -------------------------- skin_include('_html_header.inc.php', array('front_text' => '')); // Note: You can customize the default HTML header by copying the generic // /skins/_html_header.inc.php file into the current skin folder. // -------------------------------- END OF HTML HEADER --------------------------- // ---------------------------- SITE HEADER INCLUDED HERE ---------------------------- // If site headers are enabled, they will be included here: siteskin_include('_site_body_header.inc.php'); // ------------------------------- END OF SITE HEADER -------------------------------- // -------------------------- BODY HEADER INCLUDED HERE -------------------------- skin_include('_body_header.inc.php'); // Note: You can customize the default BODY header by copying the generic // /skins/_body_header.inc.php file into the current skin folder. // -------------------------------- END OF BODY HEADER --------------------------- // -------------------------- LEFT NAVIGATION BAR INCLUDED HERE ------------------
header_redirect($Blog->gen_blogurl(), 302); } if (empty($comment_ID)) { // Can't edit a not exisiting comment $Messages->add('Invalid comment edit URL!'); header_redirect($Blog->gen_blogurl(), 302); } $CommentCache =& get_CommentCache(); $edited_Comment =& $CommentCache->get_by_ID($comment_ID); $comment_Item =& $edited_Comment->get_Item(); if (!$current_User->check_perm('comment!CURSTATUS', 'edit', false, $edited_Comment)) { // If User has no permission to edit comments with this comment status: $Messages->add('You are not allowed to edit the previously selected comment!'); header_redirect($Blog->gen_blogurl(), 302); } $comment_title = ''; $comment_content = htmlspecialchars_decode($edited_Comment->content); // Format content for editing, if we were not already in editing... $Plugins_admin =& get_Plugins_admin(); $comment_Item->load_Blog(); $params = array('object_type' => 'Comment', 'object_Blog' => &$comment_Item->Blog); $Plugins_admin->unfilter_contents($comment_title, $comment_content, $comment_Item->get_renderers_validated(), $params); // Require datapicker.css require_css('ui.datepicker.css'); // Require results.css to display attachments as a result table require_css('results.css'); $Item =& $comment_Item; init_ratings_js('blog'); init_datepicker_js('blog'); $display_params = array(); require $ads_current_skin_path . 'index.main.php';
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $Messages, $disp, $debug; // Request some common features that the parent function (Skin::display_init()) knows how to provide: parent::display_init(array('jquery', 'font_awesome', 'bootstrap', 'bootstrap_evo_css', 'bootstrap_messages', 'style_css', 'colorbox', 'bootstrap_init_tooltips', 'disp_auto')); // Skin specific initializations: // Limit images by max height: $max_image_height = intval($this->get_setting('max_image_height')); if ($max_image_height > 0) { add_css_headline('.evo_image_block img { max-height: ' . $max_image_height . 'px; width: auto; }'); } // Initialize a template depending on current page switch ($disp) { case 'front': // Init star rating for intro posts: init_ratings_js('blog', true); break; case 'posts': global $cat, $bootstrap_manual_posts_text; // Init star rating for intro posts: init_ratings_js('blog', true); $bootstrap_manual_posts_text = T_('Posts'); if (!empty($cat)) { // Init the <title> for categories page: $ChapterCache =& get_ChapterCache(); if ($Chapter =& $ChapterCache->get_by_ID($cat, false)) { $bootstrap_manual_posts_text = $Chapter->get('name'); } } break; } if ($this->is_left_navigation_visible()) { // Include JS code for left navigation panel only when it is displayed: require_js($this->get_url() . 'left_navigation.js'); } }
/** * Get ready for displaying the skin. * * This method may register some CSS or JS. * The default implementation can register a few common things that you may request in the $features param. * This is where you'd specify you want to use BOOTSTRAP, etc. * * If this doesn't do what you need you may add functions like the following to your skin's display_init(): * require_js() , require_css() , add_js_headline() * * @param array of possible features you want to include. If empty, will default to {'b2evo_base', 'style', 'colorbox'} for backwards compatibility. */ function display_init($features = array()) { global $debug, $Messages, $disp; if (empty($features)) { // Fall back to v5 default set of features: $features = array('b2evo_base_css', 'style_css', 'colorbox', 'disp_auto'); } // "Temporary" patch to at least have disp_auto unless another disp_xxx was specified. Use 'disp_off' to NOT include anuthing. if (!preg_grep('/disp_.*/', $features)) { $features[] = 'disp_auto'; } // We're NOT using foreach so that the array can continue to grow during parsing: (see 'disp_auto') for ($i = 0; isset($features[$i]); $i++) { // Get next feature to include: $feature = $features[$i]; switch ($feature) { case 'jquery': // Include jQuery: require_js('#jquery#', 'blog'); break; case 'font_awesome': // Initialize font-awesome icons and use them as a priority over the glyphicons, @see get_icon() init_fontawesome_icons('fontawesome-glyphicons'); break; case 'bootstrap': // Include Bootstrap: require_js('#bootstrap#', 'blog'); require_css('#bootstrap_css#', 'blog'); break; case 'bootstrap_theme_css': // Include the Bootstrap Theme CSS: require_css('#bootstrap_theme_css#', 'blog'); break; case 'bootstrap_evo_css': // Include the bootstrap-b2evo_base CSS (NEW / v6 style) - Use this when you use Bootstrap: if ($debug) { // Use readable CSS: // rsc/less/bootstrap-basic_styles.less // rsc/less/bootstrap-basic.less // rsc/less/bootstrap-blog_base.less // rsc/less/bootstrap-item_base.less // rsc/less/bootstrap-evoskins.less require_css('bootstrap-b2evo_base.bundle.css', 'blog'); // CSS concatenation of the above } else { // Use minified CSS: require_css('bootstrap-b2evo_base.bmin.css', 'blog'); // Concatenation + Minifaction of the above } break; case 'bootstrap_init_tooltips': // JS to init Bootstrap tooltips (E.g. on comment form for allowed file extensions): add_js_headline('jQuery( function () { jQuery( \'[data-toggle="tooltip"]\' ).tooltip() } )'); break; case 'bootstrap_messages': // Initialize $Messages Class to use Bootstrap styles: $Messages->set_params(array('class_success' => 'alert alert-dismissible alert-success fade in', 'class_warning' => 'alert alert-dismissible alert-warning fade in', 'class_error' => 'alert alert-dismissible alert-danger fade in', 'class_note' => 'alert alert-dismissible alert-info fade in', 'before_message' => '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span></button>')); break; case 'b2evo_base_css': // Include the b2evo_base CSS (OLD / v5 style) - Use this when you DON'T use Bootstrap: if ($debug) { // Use readable CSS: // require_css( 'basic_styles.css', 'blog' ); // the REAL basic styles // require_css( 'basic.css', 'blog' ); // Basic styles // require_css( 'blog_base.css', 'blog' ); // Default styles for the blog navigation // require_css( 'item_base.css', 'blog' ); // Default styles for the post CONTENT // require_css( 'b2evo_base.bundle.css', 'blog' ); // Concatenation of the above require_css('b2evo_base.bundle.css', 'blog'); // Concatenation + Minifaction of the above } else { // Use minified CSS: require_css('b2evo_base.bmin.css', 'blog'); // Concatenation + Minifaction of the above } break; case 'style_css': // Include the default skin style.css: // You should make sure this is called ahead of any custom generated CSS. if ($this->use_min_css == false || $debug || $this->use_min_css == 'check' && !file_exists(dirname(__FILE__) . '/style.min.css')) { // Use readable CSS: require_css('style.css', 'relative'); // Relative to <base> tag (current skin folder) } else { // Use minified CSS: require_css('style.min.css', 'relative'); // Relative to <base> tag (current skin folder) } break; case 'colorbox': // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting('colorbox')) { // This can be enabled by a setting in skins where it may be relevant require_js_helper('colorbox', 'blog'); } break; case 'disp_auto': // Automatically add a disp_xxx for current $disp: $features[] = 'disp_' . $disp; break; case 'disp_single': // Specific features for disp=single: // Specific features for disp=single: case 'disp_page': // Specific features for disp=page: global $Blog; // Used to init functions for AJAX forms to add a comment: init_ajax_forms('blog'); // Used to set rating for a new comment: init_ratings_js('blog'); // Used to vote on the comments: init_voting_comment_js('blog'); // Used to display a tooltip to the right of plugin help icon: init_plugins_js('blog', $this->get_template('tooltip_plugin')); // Used to autocomplete usernames in textarea: init_autocomplete_usernames_js('blog'); if ($Blog->get_setting('allow_rating_comment_helpfulness')) { // Load jquery UI to animate background color on change comment status or on vote: require_js('#jqueryUI#', 'blog'); } break; case 'disp_users': // Specific features for disp=users: // Used to add new search field "Specific criteria": require_js('#jqueryUI#', 'blog'); require_css('#jqueryUI_css#', 'blog'); // Require results.css to display thread query results in a table: if (!in_array('bootstrap', $features)) { // Only for NON-bootstrap skins require_css('results.css', 'blog'); // Results/tables styles } // Require functions.js to show/hide a panel with filters: require_js('functions.js', 'blog'); // Include this file to expand/collapse the filters panel when JavaScript is disabled global $inc_path; require_once $inc_path . '_filters.inc.php'; break; case 'disp_messages': // Specific features for disp=messages: // Used to display a tooltip to the right of plugin help icon: init_plugins_js('blog', $this->get_template('tooltip_plugin')); // Require results.css to display message query results in a table if (!in_array('bootstrap', $features)) { // Only for NON-bootstrap skins require_css('results.css', 'blog'); // Results/tables styles } // Require functions.js to show/hide a panel with filters: require_js('functions.js', 'blog'); // Include this file to expand/collapse the filters panel when JavaScript is disabled global $inc_path; require_once $inc_path . '_filters.inc.php'; break; case 'disp_contacts': // Specific features for disp=contacts: // Used for combo box "Add all selected contacts to this group": require_js('form_extensions.js', 'blog'); // Require results.css to display contact query results in a table if (!in_array('bootstrap', $features)) { // Only for NON-bootstrap skins require_css('results.css', 'blog'); // Results/tables styles } // Require functions.js to show/hide a panel with filters: require_js('functions.js', 'blog'); // Include this file to expand/collapse the filters panel when JavaScript is disabled global $inc_path; require_once $inc_path . '_filters.inc.php'; break; case 'disp_threads': // Specific features for disp=threads: if (in_array(get_param('action'), array('new', 'create', 'preview'))) { // Used to suggest usernames for the field "Recipients": init_tokeninput_js('blog'); } // Used to display a tooltip to the right of plugin help icon: init_plugins_js('blog', $this->get_template('tooltip_plugin')); // Require results.css to display thread query results in a table: if (!in_array('bootstrap', $features)) { // Only for NON-bootstrap skins require_css('results.css', 'blog'); // Results/tables styles } // Require functions.js to show/hide a panel with filters: require_js('functions.js', 'blog'); // Include this file to expand/collapse the filters panel when JavaScript is disabled global $inc_path; require_once $inc_path . '_filters.inc.php'; break; case 'disp_login': // Specific features for disp=threads: global $Settings, $Plugins; $transmit_hashed_password = (bool) $Settings->get('js_passwd_hashing') && !(bool) $Plugins->trigger_event_first_true('LoginAttemptNeedsRawPassword'); if ($transmit_hashed_password) { // Include JS for client-side password hashing: require_js('build/sha1_md5.bmin.js', 'blog'); } break; case 'disp_profile': // Specific features for disp=profile: // Used to add new user fields: init_userfields_js('blog', $this->get_template('tooltip_plugin')); // Used to crop profile pictures: require_js('#jquery#', 'blog'); require_js('#jcrop#', 'blog'); require_css('#jcrop_css#', 'blog'); break; case 'disp_avatar': // Specific features for disp=avatar: // Used to crop profile pictures: require_js('#jquery#', 'blog'); require_js('#jcrop#', 'blog'); require_css('#jcrop_css#', 'blog'); break; case 'disp_edit': // Specific features for disp=edit: // Require results.css to display attachments as a result table: require_css('results.css'); init_tokeninput_js('blog'); // Used to display a date picker for date form fields: init_datepicker_js('blog'); // Used to display a tooltip to the right of plugin help icon: init_plugins_js('blog', $this->get_template('tooltip_plugin')); // Used to switch to advanced editing: require_js('backoffice.js', 'blog'); // Used to automatically checks the matching extracat when we select a new main cat: require_js('extracats.js', 'blog'); // Used to autocomplete usernames in textarea: init_autocomplete_usernames_js('blog'); break; case 'disp_edit_comment': // Specific features for disp=edit_comment: // Require results.css to display attachments as a result table: require_css('results.css'); // Used to set rating for a new comment: init_ratings_js('blog'); // Used to display a date picker for date form fields: init_datepicker_js('blog'); // Used to display a tooltip to the right of plugin help icon: init_plugins_js('blog', $this->get_template('tooltip_plugin')); // Used to autocomplete usernames in textarea: init_autocomplete_usernames_js('blog'); break; case 'disp_useritems': // Specific features for disp=useritems: // Specific features for disp=useritems: case 'disp_usercomments': // Specific features for disp=usercomments: // Require results.css to display item/comment query results in a table require_css('results.css'); // Results/tables styles // Require functions.js to show/hide a panel with filters require_js('functions.js', 'blog'); // Include this file to expand/collapse the filters panel when JavaScript is disabled global $inc_path; require_once $inc_path . '_filters.inc.php'; break; default: // We no longer want to do this because of 'disp_auto': // debug_die( 'This skin has requested an unknown feature: \''.$feature.'\'. Maybe this skin requires a more recent version of b2evolution.' ); } } }