/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // Add 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_js('ajax.js', 'blog'); require_js('functions.js'); require_js('rollovers.js'); // Make sure standard CSS is called ahead of custom CSS generated below: require_css('style.css', 'relative'); // Width switch styles add_headline('<link rel="stylesheet" href="style.css" type="text/css" title="fixed"/>'); add_headline('<link rel="alternate stylesheet" href="fluid.css" type="text/css" title="fluid"/>'); add_headline('<script type="text/javascript" src="rsc/js/styleswitcher.js"></script>'); // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } }
/** * Get ready for displaying the skin. */ function display_init() { require_js('#jquery#'); add_headline('<!--[if lte IE 6]> <script type="text/javascript"> isIE6 = true; isIE = true; </script> <![endif]--> <!--[if gte IE 7]> <script type="text/javascript"> isIE = true; </script> <![endif]-->'); require_js('resources/jquery.mystique.js', true); if ($this->get_setting('fancy_helper')) { require_js('resources/jquery.custom.fancy.js', true); add_headline('<!-- Add Thumbnail helper (this is optional) -->'); require_css('resources/helpers/jquery.fancybox-thumbs.css', true); require_js('resources/helpers/jquery.fancybox-thumbs.js', true); require_css('resources/helpers/jquery.fancybox-buttons.css', true); require_js('resources/helpers/jquery.fancybox-buttons.js', true); } /* <script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script> <script language="javascript" src="/tweet/jquery.tweet.js" type="text/javascript"></script> */ if ($this->get_setting('enable_thumbshots')) { // Display thumbshots add_js_headline('jQuery(document).ready(function() { if( ThumbsLinks = jQuery(".bText a[href^=\'http:\']").not("[href*=\'" + window.location.host + "\']") ) { ThumbshotPopups("thumbshot", ThumbsLinks); } })'); } add_css_headline(' #page {font-family: ' . $this->get_setting('skin_font') . '}'); require_css('resources/color-' . $this->get_setting('skin_color') . '.css', true); // call parent: parent::display_init(); }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // Request some common features that the parent function (Skin::display_init()) knows how to provide: parent::display_init(array('b2evo_base_css', 'colorbox', 'disp_auto')); // $this->require_css( 'style.css' ); // $this->require_css( 'item.css' ); // $this->require_css( 'evopress.bundle.css' ); // Concatenation of the above $this->require_css('evopress.bmin.css'); // Concatenation + Minifaction of the above // Add custom CSS: $custom_css = ''; $head_bg_color_top = $this->get_setting('head_bg_color_top'); $head_bg_color_bottom = $this->get_setting('head_bg_color_bottom'); if (!empty($head_bg_color_top) && !empty($head_bg_color_bottom)) { // Custom Header background color: $custom_css .= '#headerimg {' . "\n" . 'background: linear-gradient( to bottom, ' . $head_bg_color_top . ', ' . $head_bg_color_bottom . ');' . "\n" . '}' . "\n"; } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // Add 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('rsc/css/item.css', 'relative'); require_css('rsc/css/style.css', 'relative'); // Add custom CSS: $custom_css = ''; $html5support = ''; if ($this->get_setting('html5_support') == '1') { // HTML5 Support $html5support .= ' <!--[if IE]> <script src="rsc/js/html5.js"></script> <![endif]--> <link rel="stylesheet" href="rsc/css/html5.css" type="text/css" /> '; } $custom_css = '' . $html5support . "\n"; add_headline($custom_css); // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } }
/** * This function should init the templates - like adding Javascript through the {@link add_headline()} method. */ function init_templates() { global $Hit; // This is included before controller specifc require_css() calls: require_css('basic_styles.css', 'rsc_url'); // the REAL basic styles require_css('basic.css', 'rsc_url'); // Basic styles require_css('results.css', 'rsc_url'); // Results/tables styles require_css('item_base.css', 'rsc_url'); // Default styles for the post CONTENT require_css('fileman.css', 'rsc_url'); // Filemanager styles require_css('admin.global.css', 'rsc_url'); // Basic admin styles require_css('skins_adm/chicago/rsc/css/chicago.css', true); if ($Hit->is_IE()) { require_css('admin_global_ie.css', 'rsc_url'); } // CSS for IE9 add_headline('<!--[if IE 9 ]>'); require_css('ie9.css', 'rsc_url'); add_headline('<![endif]-->'); require_js('#jquery#', 'rsc_url'); require_js('jquery/jquery.raty.min.js', 'rsc_url'); }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // Add 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 // Make sure standard CSS is called ahead of custom CSS generated below: require_css('style.css', true); // Add custom CSS: $custom_css = ''; if ($body_bg_color = $this->get_setting('body_bg_color')) { // Custom Header background color: $custom_css .= ' body { background-color: ' . $body_bg_color . " }\n"; } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } }
/** Plugin Hooks **/ function SkinBeginHtmlHead(&$params) { global $Blog; if ($this->get_coll_setting('sharethis_enabled', $Blog)) { $url = 'http://w.sharethis.com/button/buttons.js'; require_js($url); add_headline('<script type="text/javascript">stLight.options({publisher:"' . $this->get_coll_setting('sharethis_publisher_id', $Blog) . '",onhover: false});</script>'); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // We pass NO params. This gives up the default Skins API v5 behavior. // Add custom CSS: $custom_css = ''; if ($body_bg_color = $this->get_setting('body_bg_color')) { // Custom Header background color: $custom_css .= ' body { background-color: ' . $body_bg_color . " }\n"; } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); require_css('basic_styles.css', 'blog'); // the REAL basic styles require_css('basic.css', 'blog'); // Basic styles require_css('img.css', 'blog'); // Standard image 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('forms.css', 'blog'); // Default form styles require_css('comments.css', 'blog'); // Default comment styles add_headline('<!--[if IE]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->'); if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // We pass NO params. This gives up the default Skins API v5 behavior. // Add custom CSS: $custom_css = ''; // Custom menu styles: $custom_styles = array(); if ($bg_color = $this->get_setting('menu_bg_color')) { // Background color: $custom_styles[] = 'background-color: ' . $bg_color; } if ($text_color = $this->get_setting('menu_text_color')) { // Text color: $custom_styles[] = 'color: ' . $text_color; } if (!empty($custom_styles)) { $custom_css .= ' div.pageHeader { ' . implode(';', $custom_styles) . " }\n"; } // Custom page styles: $custom_styles = array(); if ($bg_color = $this->get_setting('page_bg_color')) { // Background color: $custom_styles[] = 'background-color: ' . $bg_color; } if ($text_color = $this->get_setting('page_text_color')) { // Text color: $custom_styles[] = 'color: ' . $text_color; } if (!empty($custom_styles)) { $custom_css .= ' body { ' . implode(';', $custom_styles) . " }\n"; } // Custom post area styles: $custom_styles = array(); if ($bg_color = $this->get_setting('post_bg_color')) { // Background color: $custom_styles[] = 'background-color: ' . $bg_color; } if ($text_color = $this->get_setting('post_text_color')) { // Text color: $custom_styles[] = 'color: ' . $text_color; } if (!empty($custom_styles)) { $custom_css .= ' div.bDetails { ' . implode(';', $custom_styles) . " }\n"; } global $thumbnail_sizes; $posts_thumb_size = $this->get_setting('posts_thumb_size'); if (isset($thumbnail_sizes[$posts_thumb_size])) { // Make the width of image block as fixed to don't expand it by long post title text $custom_css .= ' .posts_list .bPost { max-width:' . $thumbnail_sizes[$posts_thumb_size][1] . "px }\n"; // Set width & height for block with text "No pictures yet" $custom_css .= ' .posts_list .bPost b { width:' . ($thumbnail_sizes[$posts_thumb_size][1] - 20) . 'px;' . 'height:' . ($thumbnail_sizes[$posts_thumb_size][2] - 20) . 'px' . " }\n"; } $single_thumb_size = $this->get_setting('single_thumb_size'); if (isset($thumbnail_sizes[$single_thumb_size])) { // Make the width of image block as fixed to don't expand it by long post title text $custom_css .= ' .post_images .image_block .image_legend { width:' . $thumbnail_sizes[$single_thumb_size][1] . 'px; max-width:' . $thumbnail_sizes[$single_thumb_size][1] . "px }\n"; // Set width & height for block with text "No pictures yet" /*$custom_css .= ' .posts_list .bPost b { width:'.( $thumbnail_sizes[ $single_thumb_size ][1] - 20 ).'px;' .'height:'.( $thumbnail_sizes[ $single_thumb_size ][2] - 20 ).'px'." }\n";*/ } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
\t\t\t\t\t\t\tif( document.getElementById( idprefix+'_state_'+String(index)) ) \t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\tsetcheckallspan( index, document.getElementById( idprefix+'_state_'+String(index)).checked ); \t\t\t\t\t\t\t} \t\t\t\t\t\t\telse \t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\tsetcheckallspan( index, init ); \t\t\t\t\t\t\t} \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t} \t\t\t} \t\t\t//--> \t\t</script> JS; add_headline($initcheckall_script); } // Add event to the item title field to update document title and init it (important when switching tabs/blogs): global $js_doc_title_prefix; if (isset($js_doc_title_prefix)) { // dynamic document.title handling: $base_title = preg_quote(trim($js_doc_title_prefix)); add_js_headline('jQuery(function(){ var generateTitle = function() { currentPostTitle = jQuery(\'#post_title\').val() document.title = document.title.replace(/(' . $base_title . ').*$/, \'$1 \'+currentPostTitle) } generateTitle() jQuery(\'#post_title\').keyup(generateTitle) })');
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $Messages, $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; }'); } // Add custom CSS: $custom_css = ''; // Font size customization if ($font_size = $this->get_setting('font_size')) { switch ($font_size) { case 'default': // When default font size, no CSS entry $custom_css = ''; break; case 'standard': // When standard layout $custom_css = '.container p, .container ul li, .container div, .container label, .container textarea, .container input { font-size: 16px !important' . " }\n"; $custom_css .= '.container input.search_field { height: 100%' . " }\n"; $custom_css .= '.container h1 { font-size: 38px' . " }\n"; $custom_css .= '.container h2 { font-size: 32px' . " }\n"; $custom_css .= '.container h3 { font-size: 26px' . " }\n"; $custom_css .= '.container h4 { font-size: 18px' . " }\n"; $custom_css .= '.container h5 { font-size: 16px' . " }\n"; $custom_css .= '.container h6 { font-size: 14px' . " }\n"; $custom_css .= '.container .small { font-size: 85% !important' . " }\n"; break; case 'medium': // When default font size, no CSS entry $custom_css = '.container p, .container ul li, .container div, .container label, .container textarea, .container input { font-size: 18px !important' . " }\n"; $custom_css .= '.container input.search_field { height: 100%' . " }\n"; $custom_css .= '.container h1 { font-size: 40px' . " }\n"; $custom_css .= '.container h2 { font-size: 34px' . " }\n"; $custom_css .= '.container h3 { font-size: 28px' . " }\n"; $custom_css .= '.container h4 { font-size: 20px' . " }\n"; $custom_css .= '.container h5 { font-size: 18px' . " }\n"; $custom_css .= '.container h6 { font-size: 16px' . " }\n"; $custom_css .= '.container .small { font-size: 85% !important' . " }\n"; break; case 'large': // When default font size, no CSS entry $custom_css = '.container p, .container ul li, .container div, .container label, .container textarea, .container input { font-size: 20px !important' . " }\n"; $custom_css .= '.container input.search_field { height: 100%' . " }\n"; $custom_css .= '.container h1 { font-size: 42px' . " }\n"; $custom_css .= '.container h2 { font-size: 36px' . " }\n"; $custom_css .= '.container h3 { font-size: 30px' . " }\n"; $custom_css .= '.container h4 { font-size: 22px' . " }\n"; $custom_css .= '.container h5 { font-size: 20px' . " }\n"; $custom_css .= '.container h6 { font-size: 18px' . " }\n"; $custom_css .= '.container .small { font-size: 85% !important' . " }\n"; break; case 'very_large': // When default font size, no CSS entry $custom_css = '.container p, .container ul li, .container div, .container label, .container textarea, .container input { font-size: 22px !important' . " }\n"; $custom_css .= '.container input.search_field { height: 100%' . " }\n"; $custom_css .= '.container h1 { font-size: 44px' . " }\n"; $custom_css .= '.container h2 { font-size: 38px' . " }\n"; $custom_css .= '.container h3 { font-size: 32px' . " }\n"; $custom_css .= '.container h4 { font-size: 24px' . " }\n"; $custom_css .= '.container h5 { font-size: 22px' . " }\n"; $custom_css .= '.container h6 { font-size: 20px' . " }\n"; $custom_css .= '.container .small { font-size: 85% !important' . " }\n"; break; } } if (!empty($custom_css)) { // Function for custom_css: $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $disp; // call parent: parent::display_init(); // We pass NO params. This gives up the default Skins API v5 behavior. // Add custom CSS: $custom_css = ''; if ($color = $this->get_setting('head_bg_color')) { // Custom Header background color: $custom_css .= ' div.pageHeader { background-color: ' . $color . " }\n"; } if ($color = $this->get_setting('head_text_color')) { // Custom Header text color: $custom_css .= ' div.pageHeader, div.pageHeader a { color: ' . $color . " }\n"; } if ($color = $this->get_setting('menu_bg_color')) { // Custom Menu background color: $custom_css .= ' div.top_menu_bg { background-color: ' . $color . " }\n"; } if ($color = $this->get_setting('menu_text_color')) { // Custom Menu text color: $custom_css .= ' div.top_menu a { color: ' . $color . " }\n"; } if ($color = $this->get_setting('footer_bg_color')) { // Custom Footer background color: $custom_css .= ' div#pageFooter { background-color: ' . $color . " }\n"; } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } // Functions to switch between the width sizes require_js('#jquery#', 'blog'); require_js('widthswitcher.js', 'blog'); if (in_array($disp, array('single', 'page', 'comments'))) { // Load jquery UI to animate background color on change comment status or on vote require_js('#jqueryUI#', 'blog'); } }
/** * Registers headlines required to display a bubbletip to the right of plugin help icon. */ function init_plugins_js($relative_to = 'rsc_url') { require_js('#jquery#', $relative_to); // dependency require_js('jquery/jquery.bubbletip.min.js', $relative_to); require_js('plugins.js', $relative_to); require_css('jquery/bubbletip/bubbletip.css', $relative_to); add_headline('<!--[if IE]>'); require_css('jquery/bubbletip/bubbletip-IE.css', $relative_to); add_headline('<![endif]-->'); }
* @version $Id: page.main.php,v 1.8.2.1 2008/04/26 22:28:54 fplanque Exp $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } if (version_compare($app_version, '2.4.1') < 0) { // Older 2.x skins work on newer 2.x b2evo versions, but newer 2.x skins may not work on older 2.x b2evo versions. die('This skin is designed for b2evolution 2.4.1 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); // -------------------------- HTML HEADER INCLUDED HERE -------------------------- add_headline(<<<HEREDOC <style type="text/css" media="screen"> \t#page { background: url("img/kubrickbgwide.jpg") repeat-y top; } </style> HEREDOC ); skin_include('_html_header.inc.php'); // 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 HEADER -------------------------------- ?> <?php // ------------------------- BODY HEADER INCLUDED HERE -------------------------- skin_include('_body_header.inc.php'); // Note: You can customize the default BODY header by copying the generic // /skins/_body_footer.inc.php file into the current skin folder. // ------------------------------- END OF FOOTER --------------------------------
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $disp; // call parent: parent::display_init(); // Add 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('style.css', 'relative'); // Add custom CSS: $custom_css = ''; // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } if ($main_content_headline = $this->get_setting('main_content_headline')) { // Custom introduction title: $custom_css .= 'div#main h1:before { content: "' . $main_content_headline . '" }'; } if ($main_content = $this->get_setting('main_content')) { // Custom inroduction text: $custom_css .= 'div#main p:before { content: "' . $main_content . '" }'; } if (!empty($custom_css)) { if ($disp == 'front') { // Use standard bootstrap style on width <= 640px only for disp=front $custom_css = '@media only screen and (min-width: 641px) { ' . $custom_css . ' }'; } $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
* * @version $Id: index.main.php 4275 2013-07-17 10:52:24Z yura $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } if (version_compare($app_version, '3.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 3.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); // -------------------------- HTML HEADER INCLUDED HERE -------------------------- // Initializations: add_headline('<!--[if IE]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->'); // Include the HTML HEAD: skin_include('_html_header.inc.php'); // Note: You can customize the default HTML header by copying the // _html_header.inc.php file into the current skin folder. // -------------------------------- END OF HEADER -------------------------------- ?> <div class="wrapper"> <div class="wrapper2"> <div class="outerwrap"> <div class="innerwrap"> <div class="PageTop">
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $Messages, $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 = ''; // Limit images by max height: $max_image_height = intval($this->get_setting('max_image_height')); if ($max_image_height > 0) { $custom_css .= '.evo_image_block img { max-height: ' . $max_image_height . 'px; width: auto; }' . "\n"; } // fp> TODO: the following code WORKS but produces UGLY CSS with tons of repetitions. It needs a full rewrite. // ===== Custom page styles: ===== $custom_styles = array(); // Text size <=== THIS IS A WORK IN PROGRESS if ($text_size = $this->get_setting('page_text_size')) { $custom_styles[] = 'font-size: ' . $text_size; } if (!empty($custom_styles)) { $custom_css .= ' body { ' . implode(';', $custom_styles) . " }\n"; } $custom_styles = array(); // Text color if ($text_color = $this->get_setting('page_text_color')) { $custom_styles[] = 'color: ' . $text_color; } if (!empty($custom_styles)) { $custom_css .= ' body { ' . implode(';', $custom_styles) . " }\n"; } // Link color if ($text_color = $this->get_setting('page_link_color')) { $custom_styles[] = 'color: ' . $text_color; } if (!empty($custom_styles)) { $custom_css .= ' body .container a { ' . implode(';', $custom_styles) . " }\n"; $custom_css .= ' ul li a { ' . implode(';', $custom_styles) . " }\n"; $custom_css .= "\tul li a {background-color: transparent;}\n"; $custom_css .= "\t.ufld_icon_links a {color: #fff !important;}\n"; } // Current tab text color if ($text_color = $this->get_setting('current_tab_text_color')) { $custom_styles[] = 'color: ' . $text_color; } if (!empty($custom_styles)) { $custom_css .= ' ul.nav.nav-tabs li a.selected { ' . implode(';', $custom_styles) . " }\n"; } // Page background color if ($bg_color = $this->get_setting('page_bg_color')) { $custom_styles[] = 'background-color: ' . $bg_color; } if (!empty($custom_styles)) { $custom_css .= ' body { ' . implode(';', $custom_styles) . " }\n"; } global $thumbnail_sizes; $posts_thumb_size = $this->get_setting('posts_thumb_size'); if (isset($thumbnail_sizes[$posts_thumb_size])) { // Make the width of image block as fixed to don't expand it by long post title text $custom_css .= ' .posts_list .evo_post { max-width:' . $thumbnail_sizes[$posts_thumb_size][1] . "px }\n"; // Set width & height for block with text "No pictures yet" $custom_css .= ' .posts_list .evo_post b { width:' . ($thumbnail_sizes[$posts_thumb_size][1] - 20) . 'px;' . 'height:' . ($thumbnail_sizes[$posts_thumb_size][2] - 20) . 'px' . " }\n"; } $single_thumb_size = $this->get_setting('single_thumb_size'); if (isset($thumbnail_sizes[$single_thumb_size])) { // Make the width of image block as fixed to don't expand it by long post title text $custom_css .= ' .post_images .single-image .evo_image_legend { width:' . $thumbnail_sizes[$single_thumb_size][1] . 'px; max-width:' . $thumbnail_sizes[$single_thumb_size][1] . "px }\n"; // Set width & height for block with text "No pictures yet" /*$custom_css .= ' .posts_list .evo_post b { width:'.( $thumbnail_sizes[ $single_thumb_size ][1] - 20 ).'px;' .'height:'.( $thumbnail_sizes[ $single_thumb_size ][2] - 20 ).'px'." }\n";*/ } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
/** * Spits out the styles used * * @see Plugin::SkinBeginHtmlHead() */ function SkinBeginHtmlHead() { require_js('functions.js', 'blog'); add_css_headline('/* AstonishMe code plugin styles */' . '.amc0,.amc1,.amc2,.amc3,.amc4,.amc5,.amc6,.amc7,.amc8,.amc9 {' . 'background:url(' . $this->get_plugin_url() . 'img/numbers.gif) no-repeat; }'); require_css($this->get_plugin_url() . 'amcode.css', true); // TODO: dh> move this to a IE-specific file, e.g. add_css_headline, but which is specific for IE // Or easier: fix it with a hack in amcode.css itself?! add_headline('<!--[if IE]>' . '<style type="text/css">' . '/* IE: make sure the last line is not hidden by a scrollbar */' . 'div.codeblock.amc_short table {' . ' margin-bottom: 2ex;' . '}' . '</style>' . '<![endif]-->'); }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { global $Messages, $debug, $disp; // 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: require_js('js/scripts.js', 'relative'); // Include Masonry Grind for Posts and Mediaidx disps if (in_array($disp, array('posts', 'mediaidx', 'catdir'))) { require_js('js/masonry.pkgd.min.js', 'relative'); require_js('js/imagesloaded.pkgd.min.js', 'relative'); add_js_headline("\n\t\t\t\tjQuery( document ).ready( function(\$) {\n\t\t\t\t\t\$( '.grid' ).imagesLoaded().done( function( instance ) {\n\t\t\t\t\t\t\$( '.grid' ).masonry(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// options\n\t\t\t\t\t\t\titemSelector: '.grid-item',\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t"); } // 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 }'); } // Add custom CSS: $custom_css = ''; /** * ============================================================================ * General Customization * ============================================================================ */ if ($links_color = $this->get_setting('links_color')) { $custom_css .= '.container.main-page-content a, #submit_preview_buttons_wrapper .preview, #submit_preview_buttons_wrapper .submit:hover, .filter-submit, .disp_login .control-buttons input.btn-success, .disp_login .control-buttons a.btn-primary:hover, .disp_lostpassword .control-buttons input.btn-primary:hover, .disp_register .control-buttons input.btn-primary:hover, .disp_user .profile_content .profile_column_left .profile_buttons a button.btn, .disp_msgform main .comment-form input.submit:hover, .navbar-brand h3 a, .disp_access_denied .control-buttons input.btn-success, .disp_access_requires_login .control-buttons input.btn-success, .disp_access_requires_login .control-buttons a.btn-primary:hover, .disp_threads.detail_msgform main .comment-form .btn-info, .disp_threads.detail_msgform main .comment-form .btn-primary:hover, .widget_core_org_members a.user_link:hover, .widget_core_coll_subscription .btn:hover { color: ' . $links_color . " }\n"; $custom_css .= ' .widget_core_coll_category_list ul li a:hover, .evo_post__categories a:hover, .evo_post__full .evo_post__full_text .evo_post_more_link a, #submit_preview_buttons_wrapper .preview:hover, .results .fieldset_title .action_icon:hover, .filter-submit:hover, .form_add_contacts .SaveButton, .disp_login .control-buttons input.btn-success:hover, .disp_login .control-buttons a.btn-primary, .disp_lostpassword .control-buttons input.btn-primary, .disp_register .control-buttons input.btn-primary, .disp_user .profile_content .profile_column_left .profile_buttons a button.btn:hover, .disp_threads.detail_msgform main .comment-form input.submit, .disp_access_requires_login .control-buttons input.btn-success:hover, .disp_access_requires_login .control-buttons a.btn-primary, .disp_threads.detail_msgform main .comment-form .btn-info:hover, .disp_threads.detail_msgform main .comment-form .btn-primary { border: 1px solid ' . $links_color . " }\n"; $custom_css .= ' div.compact_search_form .search_submit, .extra-section-btn-wrapper a:hover, .navbar-nav.evo_container__menu .ufld_icon_links:hover:before, .evo_post__full .evo_post__full_text .evo_post_more_link a:hover, .pagination>.active>a, .pagination>.active>a:hover, .pagination>li>a:hover, .pagination>.active>span, .pagination>.active>span:hover, .back-to-top, #submit_preview_buttons_wrapper .submit, .evo_comment__meta_info .badge-meta, .results .fieldset_title .action_icon:hover, .filter-submit:hover, .form_add_contacts .SaveButton, .disp_contacts .filter-submit:hover, .disp_login .control-buttons a.btn-primary, .disp_lostpassword .control-buttons input.btn-primary, .disp_access_requires_login .control-buttons a.btn-primary, .disp_register .control-buttons input.btn-primary, .search_result_score, .disp_user .profile_content .profile_column_left .profile_buttons a button.btn:hover, .disp_threads.detail_msgform main .comment-form input.submit, .header-social-toggle .ufld_icon_links:hover:before, .disp_threads.detail_msgform main .comment-form .btn-primary, .widget_core_coll_subscription .btn, .disp_msgform main .comment-form input.submit { background-color: ' . $links_color . " }\n"; $custom_css .= ' div.compact_search_form .search_submit, .extra-section-btn-wrapper a, p.tag_cloud a:hover, .pagination>.active>span, .pagination>.active>span:hover, .pagination>.active>a, .pagination>li>a:hover, #submit_preview_buttons_wrapper .submit, .form_add_contacts .SaveButton, div.controls input:focus, div.form-control input:focus, textarea.form-control:focus, #login_form input:focus:invalid:focus, #login_form select:focus:invalid:focus, #login_form textarea:focus:invalid:focus, .widget_core_coll_subscription .btn { border-color: ' . $links_color . " }\n"; $custom_css .= '.evo_featured_post { border-left: 5px solid ' . $links_color . " }\n"; // Fix for Gender colors settings if ($this->get_setting('gender_colored') == true) { $custom_css .= '.container.main-page-content a.user.man { color: #00F' . " }\n"; $custom_css .= '.container.main-page-content a.user.woman { color: #e100af' . " }\n"; } } if ($site_bg_color = $this->get_setting('site_bg_color')) { $custom_css .= ' .disp_contacts .filter-submit, .disp_login .control-buttons input.btn-success, .disp_login .control-buttons a.btn-primary:hover, .disp_lostpassword .control-buttons input.btn-primary:hover, .disp_access_requires_login .control-buttons input.btn-success, .disp_access_requires_login .control-buttons a.btn-primary:hover, .disp_register .control-buttons input.btn-primary:hover, .disp_msgform main .comment-form input.submit:hover, .navbar-header .ufld_icon_links a, .navbar-nav .ufld_icon_links a, .disp_threads.detail_msgform main .comment-form .btn-primary:hover, .disp_threads.detail_msgform main .comment-form .btn-info, .widget_core_coll_subscription .btn:hover { background-color: ' . $site_bg_color . " }\n"; $custom_css .= ' .extra-section-btn-wrapper a:hover, .evo_post__full .evo_post__full_text .evo_post_more_link a:hover, .pagination>li>a:hover, .pagination>.active>a, .pagination>.active>a:hover, .back-to-top, .back-to-top:hover, .back-to-top:active, .back-to-top:focus, .back-to-top:visited, .results .fieldset_title .action_icon:hover, .filter-submit:hover, .form_add_contacts .SaveButton, .disp_login .control-buttons a.btn-primary, .disp_lostpassword .control-buttons input.btn-primary, .disp_register .control-buttons input.btn-primary, .disp_access_requires_login .control-buttons a.btn-primary, .search_result_score, .disp_user .profile_content .profile_column_left .profile_buttons a button.btn:hover, .disp_msgform main .comment-form input.submit, #submit_preview_buttons_wrapper .submit { color: ' . $site_bg_color . " }\n"; } if ($site_borders = $this->get_setting('site_borders')) { $custom_css .= ' nav.navbar, .evo_widget h3, .evo_widget h4.panel-title, .widget_core_coll_post_list ul li, .widget_core_coll_comment_list ul li, .widget_core_coll_featured_posts ul li, .widget_core_coll_page_list ul li, .widget_core_coll_related_post_list ul li, .widget_core_coll_item_list ul li, .widget_core_coll_item_list ul li ul li, .widget_core_coll_xml_feeds ul li, .widget_core_coll_xml_feeds div.notes, .widget_core_content_hierarchy ul li, .compact_search_form input.search_field, .widget_plugin_evo_Arch ul li, .arcdir_list_wrapper ul li, .disp_user .profile_content .profile_column_right fieldset.fieldset legend.panel-title { border-bottom: 1px solid ' . $site_borders . " }\n"; $custom_css .= 'nav.navbar div.ufld_icon_links a, .navbar-nav.evo_container__menu .ufld_icon_links:before, .header-search-toggle, .navbar-toggle-hamb, .header-social-toggle .ufld_icon_links:before { border-left: 1px solid ' . $site_borders . " }\n"; $custom_css .= ' .widget_core_coll_category_list ul li a, .evo_post header .categories-icon, .evo_featured_post .categories-icon, .evo_post__categories a, #bCalendarToday, p.tag_cloud a, .pagination>li>a, #submit_preview_buttons_wrapper .preview, .evo_comment, .special_pager_layout li a, .results .fieldset_title .action_icon, .filter-submit, .disp_login .control-buttons input.btn-success { border: 1px solid ' . $site_borders . " }\n"; $custom_css .= ' .widget_plugin_evo_Calr .bCalendarTable th, .widget_plugin_evo_Calr .bCalendarTable td, .navbar-nav.evo_container__menu .ufld_icon_links a.drop-down-social, .header-social-toggle a { border-right: 1px solid ' . $site_borders . '; border-bottom: 1px solid ' . $site_borders . " }\n"; $custom_css .= '.widget_plugin_evo_Calr .bCalendarTable { border-left: 1px solid ' . $site_borders . '; border-top: 1px solid ' . $site_borders . " }\n"; $custom_css .= '#bCalendarToday, .special_pager_layout li a:hover, .results .fieldset_title .action_icon, .filter-submit, .disp_user .profile_content .profile_column_left .profile_buttons a button.btn, .disp_single .evo_comment__meta_info a:hover { background-color: ' . $site_borders . " }\n"; $custom_css .= 'blockquote, .disp_user .profile_content .profile_column_left .profile_buttons a button.btn, .disp_usercomments .results table.table th, .disp_useritems .results table.table th, .disp_single .evo_comment__meta_info a, .disp_access_requires_login .control-buttons input.btn-success, .disp_threads.detail_msgform main .comment-form .btn-info { border-color: ' . $site_borders . " }\n"; $custom_css .= '.evo_comment_avatar img { border: 3px solid ' . $site_borders . " }\n"; $custom_css .= '.comment-form--title { border-top: 3px solid ' . $site_borders . " }\n"; $custom_css .= '.disp_search .widget_core_coll_search_form .extended_search_form .search_field { border-bottom: 2px solid ' . $site_borders . " }\n"; $custom_css .= '.disp_msgform main .comment-form input.submit { border-color: ' . $links_color . " }\n"; } /** * ============================================================================ * Menu Customization * ============================================================================ */ if ($menu_bg_color = $this->get_setting('menu_bg_color')) { $custom_css .= '.collapse.navbar-collapse, .header-main-search-field .search_field, .ufld_icon_links a.drop-down-social, .navbar, .navbar-nav.evo_container__menu .ufld_icon_links a { background-color: ' . $menu_bg_color . " }\n"; } if ($menu_a_color = $this->get_setting('menu_a_color')) { $custom_css .= '.evo_container__menu li a, .navbar-nav.evo_container__menu .ufld_icon_links a, .navbar-header .ufld_icon_links a { color: ' . $menu_a_color . " }\n"; $custom_css .= '.navbar-header span.icon-bar { background-color: ' . $menu_a_color . " }\n"; } if ($nav_social = $this->get_setting('nav_social') == true) { $custom_css .= '.menu-social-toggle { position: absolute ' . " }\n"; if ($nav_search = $this->get_setting('nav_search') == true) { $custom_css .= '.menu-social-toggle { right: 54px ' . " }\n"; } else { $custom_css .= '.menu-social-toggle { right: 0 ' . " }\n"; } } if ($nav_hamb_menu = $this->get_setting('nav_hamb_menu')) { $custom_css .= '@media (max-width: ' . $nav_hamb_menu . "px) {\n\t\t\t\t .navbar-header {float: none;}.navbar-left,.navbar-right {float: none !important;}.navbar-toggle {display: block;}.navbar-collapse {border-top: 1px solid transparent;box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);}.navbar-fixed-top {top: 0;border-width: 0 0 1px;}.navbar-collapse.collapse {display: none!important}.navbar-nav {float: none!important;margin-top: 7.5px;overflow: hidden;}.navbar-nav>li {float: none;margin-left: 15px;}.navbar-nav>li>a {padding-top: 10px;padding-bottom: 10px;}.collapse.in{display:block !important;}.evo_container__menu .header-search-toggle{display: none}.header-search-toggle{position: relative !important}.menu-social-toggle{display: none}.navbar-collapse{border-top: 1px solid " . $site_borders . "}.navbar-nav.evo_container__menu li:last-child{margin-bottom: 17px;}\n\t\t\t\t}\n"; } /** * ============================================================================ * Single page ` * ============================================================================ */ if ($cover_text = $this->get_setting('cover_text')) { $custom_css .= '.spec_cover_image__header { color: ' . $cover_text . " }\n"; $custom_css .= '.spec_cover_image__header .evo_post__categories a:hover { border: 1px solid ' . $cover_text . " }\n"; } if ($cover_links = $this->get_setting('cover_links')) { $custom_css .= '.spec_cover_image__header a { color: ' . $cover_links . " }\n"; } if ($cover_borders = $this->get_setting('cover_borders')) { $custom_css .= ' .spec_cover_image__header .evo_post__categories a, .spec_cover_image__header .evo_post__categories .categories-icon { border: 1px solid ' . $cover_borders . " }\n"; } /** * ============================================================================ * Special sitewide footer layout * ============================================================================ */ if ($this->get_setting('spec_sw_footer') == true) { // if special sitewide footer layout is enabled $custom_css .= 'footer.sitewide_footer { font-size: 14px; letter-spacing: 0.3px; font-family: "Droid Serif", serif; padding: 10px 0; border: none; box-shadow: none; ' . " }\n"; if ($sp_sw_f_bg_col = $this->get_setting('sp_sw_f_bg_col')) { $custom_css .= 'footer.sitewide_footer { background-color: ' . $sp_sw_f_bg_col . " }\n"; } if ($sp_sw_f_col = $this->get_setting('sp_sw_f_col')) { $custom_css .= 'footer.sitewide_footer, footer.sitewide_footer a, footer.sitewide_footer a:hover { color: ' . $sp_sw_f_col . " }\n"; } } /** * ============================================================================ * Sidebar widgets margin-top * ============================================================================ */ if ($this->get_setting('sidebar2_single') == false) { // if Sidebar2 is NOT reserved for disp=single only, then: $custom_css .= '.evo_container__sidebar .evo_widget:nth-child(1) div > h4 { margin-top: 0 !important;' . " }\n"; } else { $custom_css .= '.evo_container__sidebar .evo_widget:nth-child(1) div > h4, .evo_container__sidebar2 .evo_widget:nth-child(1) div > h4 { margin-top: 0 !important;' . " }\n"; } /** * ============================================================================ * Positioned at the end of the file because of the hover style - preventing * wrong style on non-hover color customization * ============================================================================ */ if ($links_color = $this->get_setting('links_color')) { $custom_css .= '#submit_preview_buttons_wrapper .submit:hover { color: ' . $links_color . " !important }\n"; } if (!empty($custom_css)) { // Function for custom_css: $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } }
/** * 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); } }
function SkinBeginHtmlHead(&$params) { global $Item, $Chapter, $Blog, $baseurl; $tw_img = false; $blogdesc = $Blog->longdesc; if (isset($Item) && !empty($Item)) { $id = $Item->ID; // $og_uri = $baseurl .'index.php?p='.$id.'&blog='.$Blog->ID.'&redir=no'; $tw_desc = $Item->excerpt; $tw_title = $Item->title; $tw_img = $this->eo_get_featured_image_url(); } else { if (isset($Chapter) && !empty($Chapter)) { //if we are on category $tw_desc = $Chapter->description; $tw_title = $Chapter->name; } else { // Just in case, for everything else. $tw_desc = $blogdesc; $tw_title = $Blog->name; } } $card_type = $tw_img ? $this->get_coll_setting('card_type', $Blog) : 'summary'; add_headline('<meta name="twitter:card" content="' . $card_type . '">'); add_headline('<meta name="twitter:site" content="' . $this->get_coll_setting('site_id', $Blog) . '">'); add_headline('<meta name="twitter:title" content="' . format_to_output($tw_title, 'htmlattr') . '">'); add_headline('<meta name="twitter:description" content="' . format_to_output($tw_desc, 'htmlattr') . '">'); if ($tw_img) { add_headline('<meta name="twitter:image" content="' . $tw_img . '">'); } }
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // Add 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 // Make sure standard CSS is called ahead of custom CSS generated below: require_css('style.css', 'relative'); // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } add_headline('<link rel="stylesheet" href="rsc/css/style.css" type="text/css" /> <link rel="alternate stylesheet" href="rsc/css/red.css" type="text/css" title="red" /> <link rel="alternate stylesheet" href="rsc/css/blue.css" type="text/css" title="blue" /> <link rel="alternate stylesheet" href="rsc/css/green.css" type="text/css" title="green" /> <link rel="alternate stylesheet" href="rsc/css/brown.css" type="text/css" title="brown" /> <link rel="alternate stylesheet" href="rsc/css/magenta.css" type="text/css" title="magenta" />'); // Add custom CSS: $custom_css = ''; $skincolor = $this->get_setting('skin_color'); $widthstyle = ''; $html5support = ''; if ($this->get_setting('width_style') == 'fixed') { // Fixed Layout $widthstyle .= 'width: 950px !important; /* fixed */'; } if ($this->get_setting('width_style') == 'fluid') { // Fluid Layout $widthstyle .= 'width: 90% !important; /* fluid */'; } if ($this->get_setting('html5_support') == '1') { // HTML5 Support $html5support .= ' <!--[if IE]> <script src="rsc/js/html5.js"></script> <![endif]--> <link rel="stylesheet" href="rsc/css/html5.css" type="text/css" /> '; } $custom_css = '' . $html5support . ' <link rel="stylesheet" href="rsc/css/' . $skincolor . '.css" type="text/css" title="' . $skincolor . '" /> <style type="text/css"> div.widthstyle { ' . $widthstyle . ' } </style> '; add_headline($custom_css); }
/** * 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; }'); } if (in_array($disp, array('front', 'login', 'register', 'lostpassword', 'activateinfo', 'access_denied', 'access_requires_login'))) { global $media_url, $media_path; // Add custom CSS: $custom_css = ''; $bg_image = $this->get_setting('front_bg_image'); if (!empty($bg_image) && file_exists($media_path . $bg_image)) { // Custom body background image: $custom_css .= '#bg_picture { background-image: url(' . $media_url . $bg_image . ") }\n"; } if ($color = $this->get_setting('pict_title_color')) { // Custom title color: $custom_css .= 'body.pictured .main_page_wrapper .widget_core_coll_title h1 a { color: ' . $color . " }\n"; } if ($color = $this->get_setting('pict_muted_color')) { // Custom muted text color: $custom_css .= 'body.pictured .main_page_wrapper .text-muted { color: ' . $color . " }\n"; } if ($color = $this->get_setting('front_bg_color')) { // Custom body background color: $color_transparency = floatval($this->get_setting('front_bg_opacity') / 100); $color = substr($color, 1); if (strlen($color) == '6') { // Color value in format #FFFFFF $color = str_split($color, 2); } else { // Color value in format #FFF $color = str_split($color, 1); foreach ($color as $c => $v) { $color[$c] = $v . $v; } } $custom_css .= '.front_main_content { background-color: rgba(' . implode(',', array_map('hexdec', $color)) . ',' . $color_transparency . ')' . " }\n"; } if ($color = $this->get_setting('front_text_color')) { // Custom text color: $custom_css .= 'body.pictured .front_main_content, body.pictured .front_main_content h1 small, .evo_container__header, .evo_container__page_top { color: ' . $color . " }\n"; } $link_color = $this->get_setting('front_link_color'); $icon_color = $this->get_setting('front_icon_color'); if ($link_color) { // Custom link color: $custom_css .= 'body.pictured .main_page_wrapper .front_main_area a, body.pictured .main_page_wrapper .front_main_area div.evo_withteaser div.item_content > a { color: ' . $link_color . ' } body.pictured .main_page_wrapper .front_main_area div.widget_core_coll_item_list.evo_noexcerpt.evo_withteaser ul li div.item_content > a, body.pictured .main_page_wrapper .front_main_area div.widget_core_coll_post_list.evo_noexcerpt.evo_withteaser ul li div.item_content > a { color: ' . $link_color . " }\n"; } if ($link_color && $icon_color) { // Custom icon color: $custom_css .= 'body.pictured .front_main_content .ufld_icon_links a:not([class*="ufld__textcolor"]):not(:hover) { color: ' . $icon_color . " }\n"; $custom_css .= 'body.pictured .front_main_content .ufld_icon_links a:not([class*="ufld__bgcolor"]):not(:hover) { background-color: ' . $link_color . " }\n"; $custom_css .= 'body.pictured .front_main_content .ufld_icon_links a:hover:not([class*="ufld__hovertextcolor"]) { color: ' . $link_color . " }\n"; $custom_css .= 'body.pictured .front_main_content .ufld_icon_links a:hover:not([class*="ufld__hoverbgcolor"]) { background-color: ' . $icon_color . " }\n"; } if ($width = $this->get_setting('front_width')) { // Custom width for front main area: $custom_css .= 'div.front_main_area { width: ' . $width . " }\n"; } if ($position = $this->get_setting('front_position')) { // Custom width for front main area: if ($position == 'middle') { $custom_css .= 'div.front_main_area { float: none; margin-left: auto; margin-right: auto;' . " }\n"; } elseif ($position == 'right') { $custom_css .= 'div.front_main_area { float: right;' . " }\n"; } } if ($color = $this->get_setting('secondary_text_color')) { // Custom text color on secondary area: $custom_css .= 'section.secondary_area, .widget_core_org_members { color: ' . $color . " !important }\n"; } if (!empty($custom_css)) { if ($disp == 'front') { // Use standard bootstrap style on width <= 640px only for disp=front $custom_css = '@media only screen and (min-width: 641px) { ' . $custom_css . ' }'; } $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } } }
} if (version_compare($app_version, '2.4.1') < 0) { // Older 2.x skins work on newer 2.x b2evo versions, but newer 2.x skins may not work on older 2.x b2evo versions. die('This skin is designed for b2evolution 2.4.1 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); require_css('rsc/nifty_corners.css', true); require_js('rsc/nifty_corners.js', true); add_headline('<script type="text/javascript"> window.onload=function() { if(!NiftyCheck()) return; Rounded("div.outerwrap","all","transparent","#fff",""); Rounded("div.bPosts","all","transparent","#fff",""); Rounded("div.bSideBar","all","transparent","#fff",""); Rounded("div.bTitle","top","#fff","#A477A4","smooth"); } </script>'); // -------------------------- HTML HEADER INCLUDED HERE -------------------------- skin_include('_html_header.inc.php'); // 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 HEADER -------------------------------- ?> <div id="wrapper"> <div class="outerwrap">
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // Add 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 // Make sure standard CSS is called ahead of custom CSS generated below: require_css('style.css', true); // Add custom CSS: $custom_css = ''; if ($color = $this->get_setting('head_bg_color')) { // Custom Header background color: $custom_css .= ' div.pageHeader { background-color: ' . $color . " }\n"; } if ($color = $this->get_setting('head_text_color')) { // Custom Header text color: $custom_css .= ' div.pageHeader, div.pageHeader a { color: ' . $color . " }\n"; } if ($color = $this->get_setting('menu_bg_color')) { // Custom Menu background color: $custom_css .= ' div.top_menu_bg { background-color: ' . $color . " }\n"; } if ($color = $this->get_setting('menu_text_color')) { // Custom Menu text color: $custom_css .= ' div.top_menu a { color: ' . $color . " }\n"; } if ($color = $this->get_setting('footer_bg_color')) { // Custom Footer background color: $custom_css .= ' div#pageFooter { background-color: ' . $color . " }\n"; } if (!empty($custom_css)) { $custom_css = '<style type="text/css"> <!-- ' . $custom_css . ' --> </style>'; add_headline($custom_css); } // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } // Functions to switch between the width sizes require_js('#jquery#', 'blog'); require_js('widthswitcher.js', 'blog'); }
/** * Initialize internal states for the most common skin displays. * * For more specific skins, this function may not be called and * equivalent code may 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; global $Session, $current_User; $Timer->resume('skin_init'); if (empty($disp_detail)) { $disp_detail = $disp; } $Debuglog->add('skin_init: $disp=' . $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 'front': case 'posts': case 'single': case 'page': case 'terms': case 'download': case 'feedback-popup': // We need to load posts for this display: if ($disp == 'terms') { // Initialize the redirect param to know what page redirect after accepting of terms: param('redirect_to', 'url', ''); } // 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'); } if (!empty($MainList) && $MainList->single_post && ($single_Item =& mainlist_get_item())) { // If we are currently viewing a single post // We assume the current user will have read the entire post and all its current comments: $single_Item->update_read_timestamps(true, true); // Restart the items list: $MainList->restart(); } break; case 'search': // Searching post, comments and categories load_funcs('collections/_search.funcs.php'); // Check previous search keywords so it can be displayed in the search input box param('s', 'string', '', true); break; } // SEO stuff & redirects if necessary: $seo_page_type = NULL; switch ($disp) { // CONTENT PAGES: case 'single': case 'page': case 'terms': if ($disp == 'terms' && !$Item) { // Wrong post ID for terms page: global $disp; $disp = '404'; $Messages->add(sprintf(T_('Terms not found. (post ID #%s)'), get_param('p')), 'error'); break; } if (!$preview && empty($Item)) { // No Item, incorrect request and incorrect state of the application, a 404 redirect should have already happened //debug_die( 'Invalid page URL!' ); } if ($disp == 'single') { $seo_page_type = 'Single post page'; } else { $seo_page_type = '"Page" page'; } if (!$preview) { // Check if item has a goal to insert a hit into DB $Item->check_goal(); } // 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, 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 (preg_match('|[&?]tag=([^&A-Z]+)|', $ReqURI, $tag_param)) { // A tag post navigation param is set $extended_url = ''; if ($post_navigation == 'same_tag' && isset($tag_param[1])) { // navigatie through posts from the same tag $tag_names = $Item->get_tags(); if (in_array($tag_param[1], $tag_names)) { // tag param is one of this Item tags $extended_url = $Item->add_navigation_param($canonical_url, $post_navigation, $tag_param[1], '&'); // Set MainList navigation target to the requested tag $MainList->nav_target = $tag_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 'download': if (empty($Item)) { // No Item, incorrect request and incorrect state of the application, a 404 redirect should have already happened debug_die('Invalid page URL!'); } $download_link_ID = param('download', 'integer', 0); // Check if we can allow to download the selected file $LinkCache =& get_LinkCache(); if (!(($download_Link =& $LinkCache->get_by_ID($download_link_ID, false, false)) && ($LinkItem =& $download_Link->get_LinkOwner()) && ($LinkItem->Item && $LinkItem->Item->ID == $Item->ID) && ($download_File =& $download_Link->get_File()) && $download_File->exists())) { // Bad request, Redirect to Item permanent url $Messages->add(T_('The requested file is not available for download.'), 'error'); $canonical_url = $Item->get_permanent_url('', '', '&'); $Debuglog->add('Redirecting to canonical URL [' . $canonical_url . '].'); header_redirect($canonical_url, true); } // Save the downloading Link to the global vars $GLOBALS['download_Link'] =& $download_Link; // Save global $Item to $download_Item, because $Item can be rewritten by function get_featured_Item() in some skins $GLOBALS['download_Item'] =& $Item; init_ajax_forms('blog'); // auto requires jQuery // Initialize JavaScript to download file after X seconds add_js_headline(' jQuery( document ).ready( function () { jQuery( "#download_timer_js" ).show(); } ); var b2evo_download_timer = ' . intval($Blog->get_setting('download_delay')) . '; var downloadInterval = setInterval( function() { jQuery( "#download_timer" ).html( b2evo_download_timer ); if( b2evo_download_timer == 0 ) { // Stop timer and download a file clearInterval( downloadInterval ); jQuery( "#download_help_url" ).show(); } b2evo_download_timer--; }, 1000 );'); // Use meta tag to download file when JavaScript is NOT enabled add_headline('<meta http-equiv="refresh" content="' . intval($Blog->get_setting('download_delay')) . '; url=' . $download_Link->get_download_url(array('type' => 'action')) . '" />'); $seo_page_type = 'Download page'; if ($Blog->get_setting($disp . '_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; case 'posts': init_ajax_forms('blog'); // auto requires jQuery // 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 . '" />'); } } } else { // If the requested chapter was not found display 404 page $Messages->add(T_('The requested chapter was not found')); global $disp; $disp = '404'; break; } } 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 . '" />'); } } } $tag = $MainList->get_active_filter('tags'); if ($post_navigation == 'same_tag' && !empty($tag)) { // Tag is set and post navigation should go through the same tag, set navigation target param $MainList->nav_target = $tag; } } 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; } } } elseif ($Blog->get_setting('front_disp') == 'posts') { // This is the default blog page only if the 'front_disp' is set to 'posts' $disp_detail = 'posts-default'; $seo_page_type = 'Default page'; 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': global $disp; // get expected message form type $msg_type = param('msg_type', 'string', ''); // initialize $recipient_User = NULL; $Comment = NULL; $allow_msgform = NULL; // get possible params $recipient_id = param('recipient_id', 'integer', 0, true); $comment_id = param('comment_id', 'integer', 0, true); $post_id = param('post_id', 'integer', 0, true); $subject = param('subject', 'string', ''); // try to init recipient_User if (!empty($recipient_id)) { $UserCache =& get_UserCache(); $recipient_User =& $UserCache->get_by_ID($recipient_id); } elseif (!empty($comment_id)) { // comment id is set, try to get comment author user $CommentCache =& get_CommentCache(); $Comment = $CommentCache->get_by_ID($comment_id, false); if ($Comment = $CommentCache->get_by_ID($comment_id, false)) { $recipient_User =& $Comment->get_author_User(); if (empty($recipient_User) && $Comment->allow_msgform && is_email($Comment->get_author_email())) { // set allow message form to email because comment author (not registered) accepts email $allow_msgform = 'email'; param('recipient_address', 'string', $Comment->get_author_email()); param('recipient_name', 'string', $Comment->get_author_name()); } } } else { // Recipient was not defined, try set the blog owner as recipient global $Blog; if (empty($Blog)) { // Blog is not set, this is an invalid request debug_die('Invalid send message request!'); } $recipient_User = $Blog->get_owner_User(); } if ($recipient_User) { // recipient User is set // get_msgform_possibility returns NULL (false), only if there is no messaging option between current_User and recipient user $allow_msgform = $recipient_User->get_msgform_possibility(); if ($msg_type == 'email' && $recipient_User->get_msgform_possibility(NULL, 'email') != 'email') { // User doesn't want to receive email messages, Restrict if this was requested by wrong url: $msg_type = ''; } if ($allow_msgform == 'login') { // user must login first to be able to send a message to this User $disp = 'login'; param('action', 'string', 'req_login'); // override redirect to param param('redirect_to', 'url', regenerate_url(), true, true); if (($msg_Blog =& get_setting_Blog('msg_blog_ID')) && $Blog->ID != $msg_Blog->ID) { // Redirect to special blog for messaging actions if it is defined in general settings header_redirect(url_add_param($msg_Blog->get('msgformurl', array('glue' => '&')), 'redirect_to=' . rawurlencode($redirect_to), '&')); } $Messages->add(T_('You must log in before you can contact this user')); } elseif ($allow_msgform == 'PM' && check_user_status('can_be_validated')) { // user is not activated if ($recipient_User->accepts_email()) { // recipient User accepts email allow to send email $allow_msgform = 'email'; $msg_type = 'email'; $activateinfo_link = 'href="' . get_activate_info_url(NULL, '&') . '"'; $Messages->add(sprintf(T_('You must activate your account before you can send a private message to %s. However you can send them an email if you\'d like. <a %s>More info »</a>'), $recipient_User->get('login'), $activateinfo_link), 'warning'); } else { // Redirect to the activate info page for not activated users $Messages->add(T_('You must activate your account before you can contact a user. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } } elseif ($msg_type == 'PM' && $allow_msgform == 'email') { // only email is allowed but user expect private message form if (!empty($current_User) && $recipient_id == $current_User->ID) { $Messages->add(T_('You cannot send a private message to yourself. However you can send yourself an email if you\'d like.'), 'warning'); } else { $Messages->add(sprintf(T_('You cannot send a private message to %s. However you can send them an email if you\'d like.'), $recipient_User->get('login')), 'warning'); } } elseif ($msg_type != 'email' && $allow_msgform == 'PM') { // private message form should be displayed, change display to create new individual thread with the given recipient user // check if creating new PM is allowed if (check_create_thread_limit(true)) { // thread limit reached header_redirect(); // exited here } global $edited_Thread, $edited_Message, $recipients_selected; // Load classes load_class('messaging/model/_thread.class.php', 'Thread'); load_class('messaging/model/_message.class.php', 'Message'); // Set global variable to auto define the FB autocomplete plugin field $recipients_selected = array(array('id' => $recipient_User->ID, 'title' => $recipient_User->login)); init_tokeninput_js('blog'); $disp = 'threads'; $edited_Thread = new Thread(); $edited_Message = new Message(); $edited_Message->Thread =& $edited_Thread; $edited_Thread->recipients = $recipient_User->login; param('action', 'string', 'new', true); param('thrdtype', 'string', 'individual', true); } if ($allow_msgform == 'email') { // set recippient user param set_param('recipient_id', $recipient_User->ID); } } if ($allow_msgform == NULL) { // should be Prevented by UI if (!empty($recipient_User)) { $Messages->add(sprintf(T_('The user "%s" does not want to be contacted through the message form.'), $recipient_User->get('login')), 'error'); } elseif (!empty($Comment)) { $Messages->add(T_('This commentator does not want to get contacted through the message form.'), 'error'); } $blogurl = $Blog->gen_blogurl(); // If it was a front page request or the front page is set to 'msgform' then we must not redirect to the front page because it is forbidden for the current User $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'msgform' ? url_add_param($blogurl, 'disp=403', '&') : $blogurl; header_redirect($redirect_to, 302); // exited here } if ($allow_msgform == 'PM' || $allow_msgform == 'email') { // Some message form is available // Get the suggested subject for the email: if (empty($subject)) { // no subject provided by param: global $DB; if (!empty($comment_id)) { // fp>TODO there should be NO SQL in this file. Make a $ItemCache->get_by_comment_ID(). $row = $DB->get_row(' SELECT post_title FROM T_items__item, T_comments WHERE comment_ID = ' . $DB->quote($comment_id) . ' AND post_ID = comment_item_ID'); if ($row) { $subject = T_('Re:') . ' ' . sprintf(T_('Comment on %s'), $row->post_title); } } if (empty($subject) && !empty($post_id)) { // fp>TODO there should be NO SQL in this file. Use $ItemCache->get_by_ID. $row = $DB->get_row(' SELECT post_title FROM T_items__item WHERE post_ID = ' . $post_id); if ($row) { $subject = T_('Re:') . ' ' . $row->post_title; } } } if ($allow_msgform == 'PM' && isset($edited_Thread)) { $edited_Thread->title = $subject; } else { param('subject', 'string', $subject, true); } } if (($msg_Blog =& get_setting_Blog('msg_blog_ID')) && $Blog->ID != $msg_Blog->ID) { // Redirect to special blog for messaging actions if it is defined in general settings header_redirect($msg_Blog->get('msgformurl', array('glue' => '&'))); } $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': switch ($disp) { case 'messages': // Actions ONLY for disp=messages // fp> The correct place to get thrd_ID is here, because we want it in redirect_to in case we need to ask for login. $thrd_ID = param('thrd_ID', 'integer', '', true); if (!is_logged_in()) { // Redirect to the login page for anonymous users $Messages->add(T_('You must log in to read your messages.')); header_redirect(get_login_url('cannot see messages'), 302); // will have exited } // check if user status allow to view messages if (!$current_User->check_status('can_view_messages')) { // user status does not allow to view messages if ($current_User->check_status('can_be_validated')) { // user is logged in but his/her account is not activate yet $Messages->add(T_('You must activate your account before you can read & send messages. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } $Messages->add('You are not allowed to view Messages!'); header_redirect($Blog->gen_blogurl(), 302); // will have exited } // check if user permissions allow to view messages if (!$current_User->check_perm('perm_messaging', 'reply')) { // Redirect to the blog url for users without messaging permission $Messages->add('You are not allowed to view Messages!'); header_redirect($Blog->gen_blogurl(), 302); // will have exited } if (!empty($thrd_ID)) { // if this thread exists and current user is part of this thread update status because won't be any unread messages on this conversation // we need to mark this early to make sure the unread message count will be correct in the evobar mark_as_read_by_user($thrd_ID, $current_User->ID); } if (($unsaved_message_params = get_message_params_from_session()) !== NULL) { // set Message and Thread saved params from Session global $edited_Message, $action; load_class('messaging/model/_message.class.php', 'Message'); $edited_Message = new Message(); $edited_Message->text = $unsaved_message_params['message']; $edited_Message->original_text = $unsaved_message_params['message_original']; $edited_Message->set_renderers($unsaved_message_params['renderers']); $edited_Message->thread_ID = $thrd_ID; $action = $unsaved_message_params['action']; } break; case 'contacts': // Actions ONLY for disp=contacts if (!is_logged_in()) { // Redirect to the login page for anonymous users $Messages->add(T_('You must log in to manage your contacts.')); header_redirect(get_login_url('cannot see contacts'), 302); // will have exited } if (!$current_User->check_status('can_view_contacts')) { // user is logged in, but his status doesn't allow to view contacts if ($current_User->check_status('can_be_validated')) { // user is logged in but his/her account was not activated yet // Redirect to the account activation page $Messages->add(T_('You must activate your account before you can manage your contacts. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } // Redirect to the blog url for users without messaging permission $Messages->add('You are not allowed to view Contacts!'); $blogurl = $Blog->gen_blogurl(); // If it was a front page request or the front page is set to display 'contacts' then we must not redirect to the front page because it is forbidden for the current User $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'contacts' ? url_add_param($blogurl, 'disp=403', '&') : $blogurl; header_redirect($redirect_to, 302); } if (has_cross_country_restriction('any') && empty($current_User->ctry_ID)) { // User may browse/contact other users only from the same country $Messages->add(T_('Please specify your country before attempting to contact other users.')); header_redirect(get_user_profile_url()); } // Get action parameter from request: $action = param_action(); if (!$current_User->check_perm('perm_messaging', 'reply')) { // Redirect to the blog url for users without messaging permission $Messages->add('You are not allowed to view Contacts!'); $blogurl = $Blog->gen_blogurl(); // If it was a front page request or the front page is set to display 'contacts' then we must not redirect to the front page because it is forbidden for the current User $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'contacts' ? url_add_param($blogurl, 'disp=403', '&') : $blogurl; header_redirect($redirect_to, 302); // will have exited } switch ($action) { case 'add_user': // Add user to contacts list // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('messaging_contacts'); $user_ID = param('user_ID', 'integer', 0); if ($user_ID > 0) { // Add user to contacts if (create_contacts_user($user_ID)) { // Add user to the group $group_ID = param('group_ID', 'string', ''); if ($result = create_contacts_group_users($group_ID, $user_ID, 'group_ID_combo')) { // User has been added to the group $Messages->add(sprintf(T_('User has been added to the «%s» group.'), $result['group_name']), 'success'); } else { // User has been added ONLY to the contacts list $Messages->add('User has been added to your contacts.', 'success'); } } header_redirect($Blog->get('userurl', array('url_suffix' => 'user_ID=' . $user_ID, 'glue' => '&'))); } break; case 'unblock': // Unblock user // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('messaging_contacts'); $user_ID = param('user_ID', 'integer', 0); if ($user_ID > 0) { set_contact_blocked($user_ID, 0); $Messages->add(T_('Contact was unblocked.'), 'success'); } break; case 'remove_user': // Remove user from contacts group // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('messaging_contacts'); $view = param('view', 'string', 'profile'); $user_ID = param('user_ID', 'integer', 0); $group_ID = param('group_ID', 'integer', 0); if ($user_ID > 0 && $group_ID > 0) { // Remove user from selected group if (remove_contacts_group_user($group_ID, $user_ID)) { // User has been removed from the group if ($view == 'contacts') { // Redirect to the contacts list header_redirect($Blog->get('contactsurl', array('glue' => '&'))); } else { // Redirect to the user profile page header_redirect($Blog->get('userurl', array('url_suffix' => 'user_ID=' . $user_ID, 'glue' => '&'))); } } } break; case 'add_group': // Add users to the group // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('messaging_contacts'); $group = param('group', 'string', ''); $users = param('users', 'string', ''); if ($result = create_contacts_group_users($group, $users)) { // Users have been added to the group $Messages->add(sprintf(T_('%d contacts have been added to the «%s» group.'), $result['count_users'], $result['group_name']), 'success'); $redirect_to = $Blog->get('contactsurl', array('glue' => '&')); $item_ID = param('item_ID', 'integer', 0); if ($item_ID > 0) { $redirect_to = url_add_param($redirect_to, 'item_ID=' . $item_ID, '&'); } header_redirect($redirect_to); } break; case 'rename_group': // Rename the group // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('messaging_contacts'); $group_ID = param('group_ID', 'integer', true); if (rename_contacts_group($group_ID)) { $item_ID = param('item_ID', 'integer', 0); $redirect_to = url_add_param($Blog->get('contactsurl', array('glue' => '&')), 'g=' . $group_ID, '&'); if ($item_ID > 0) { $redirect_to = url_add_param($redirect_to, 'item_ID=' . $item_ID, '&'); } $Messages->add(T_('The group has been renamed.'), 'success'); header_redirect($redirect_to); } break; case 'delete_group': // Delete the group // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('messaging_contacts'); $group_ID = param('group_ID', 'integer', true); if (delete_contacts_group($group_ID)) { $item_ID = param('item_ID', 'integer', 0); $redirect_to = $Blog->get('contactsurl', array('glue' => '&')); if ($item_ID > 0) { $redirect_to = url_add_param($redirect_to, 'item_ID=' . $item_ID, '&'); } $Messages->add(T_('The group has been deleted.'), 'success'); header_redirect($redirect_to); } break; } modules_call_method('switch_contacts_actions', array('action' => $action)); break; case 'threads': // Actions ONLY for disp=threads if (!is_logged_in()) { // Redirect to the login page for anonymous users $Messages->add(T_('You must log in to read your messages.')); header_redirect(get_login_url('cannot see messages'), 302); // will have exited } if (!$current_User->check_status('can_view_threads')) { // user status does not allow to view threads if ($current_User->check_status('can_be_validated')) { // user is logged in but his/her account is not activate yet $Messages->add(T_('You must activate your account before you can read & send messages. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } $Messages->add('You are not allowed to view Messages!'); $blogurl = $Blog->gen_blogurl(); // If it was a front page request or the front page is set to display 'threads' then we must not redirect to the front page because it is forbidden for the current User $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'threads' ? url_add_param($blogurl, 'disp=404', '&') : $blogurl; header_redirect($redirect_to, 302); // will have exited } if (!$current_User->check_perm('perm_messaging', 'reply')) { // Redirect to the blog url for users without messaging permission $Messages->add('You are not allowed to view Messages!'); $blogurl = $Blog->gen_blogurl(); // If it was a front page request or the front page is set to display 'threads' then we must not redirect to the front page because it is forbidden for the current User $redirect_to = is_front_page() || $Blog->get_setting('front_disp') == 'threads' ? url_add_param($blogurl, 'disp=403', '&') : $blogurl; header_redirect($redirect_to, 302); // will have exited } $action = param('action', 'string', 'view'); if ($action == 'new') { // Before new message form is displayed ... if (has_cross_country_restriction('contact') && empty($current_User->ctry_ID)) { // Cross country contact restriction is enabled, but user country is not set yet $Messages->add(T_('Please specify your country before attempting to contact other users.')); header_redirect(get_user_profile_url()); } elseif (check_create_thread_limit(true)) { // don't allow to create new thread, because the new thread limit was already reached set_param('action', 'view'); } } // Load classes load_class('messaging/model/_thread.class.php', 'Thread'); load_class('messaging/model/_message.class.php', 'Message'); // Get action parameter from request: $action = param_action('view'); switch ($action) { case 'new': // Check permission: $current_User->check_perm('perm_messaging', 'reply', true); global $edited_Thread, $edited_Message; $edited_Thread = new Thread(); $edited_Message = new Message(); $edited_Message->Thread =& $edited_Thread; modules_call_method('update_new_thread', array('Thread' => &$edited_Thread)); if (($unsaved_message_params = get_message_params_from_session()) !== NULL) { // set Message and Thread saved params from Session $edited_Message->text = $unsaved_message_params['message']; $edited_Message->original_text = $unsaved_message_params['message_original']; $edited_Message->set_renderers($unsaved_message_params['renderers']); $edited_Thread->title = $unsaved_message_params['subject']; $edited_Thread->recipients = $unsaved_message_params['thrd_recipients']; $edited_Message->Thread = $edited_Thread; global $thrd_recipients_array, $thrdtype, $action, $creating_success; $thrd_recipients_array = $unsaved_message_params['thrd_recipients_array']; $thrdtype = $unsaved_message_params['thrdtype']; $action = $unsaved_message_params['action']; $creating_success = !empty($unsaved_message_params['creating_success']) ? $unsaved_message_params['creating_success'] : false; } else { if (empty($edited_Thread->recipients)) { $edited_Thread->recipients = param('thrd_recipients', 'string', ''); } if (empty($edited_Thread->title)) { $edited_Thread->title = param('subject', 'string', ''); } } break; default: // Check permission: $current_User->check_perm('perm_messaging', 'reply', true); break; } break; } // Actions for disp = messages, contacts, threads: if (($msg_Blog =& get_setting_Blog('msg_blog_ID')) && $Blog->ID != $msg_Blog->ID) { // Redirect to special blog for messaging actions if it is defined in general settings $blog_url_params = array('glue' => '&'); if (!empty($thrd_ID)) { // Don't forget the important param on redirect $blog_url_params['url_suffix'] = 'thrd_ID=' . $thrd_ID; } header_redirect($msg_Blog->get($disp . 'url', $blog_url_params)); } // just in case some robot would be logged in: $seo_page_type = 'Messaging module'; $robots_index = false; // Display messages depending on user email status display_user_email_status_message(); break; case 'login': global $Plugins, $transmit_hashed_password; if (is_logged_in()) { // User is already logged in if ($current_User->check_status('can_be_validated')) { // account is not active yet, redirect to the account activation page $Messages->add(T_('You are logged in but your account is not activated. You will find instructions about activating your account below:')); header_redirect(get_activate_info_url(), 302); // will have exited } // User is already logged in, redirect to "redirect_to" page $Messages->add(T_('You are already logged in.'), 'note'); $redirect_to = param('redirect_to', 'url', NULL); if (empty($redirect_to)) { // If empty redirect to referer page $redirect_to = ''; } header_redirect($redirect_to, 302); // will have exited } if (($login_Blog =& get_setting_Blog('login_blog_ID')) && $Blog->ID != $login_Blog->ID) { // Redirect to special blog for login/register actions if it is defined in general settings header_redirect($login_Blog->get('loginurl', array('glue' => '&'))); } $seo_page_type = 'Login form'; $robots_index = false; 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); } if (($login_Blog =& get_setting_Blog('login_blog_ID')) && $Blog->ID != $login_Blog->ID) { // Redirect to special blog for login/register actions if it is defined in general settings header_redirect($login_Blog->get('registerurl', array('glue' => '&'))); } $seo_page_type = 'Register form'; $robots_index = false; // Check invitation code if it exists and registration is enabled global $display_invitation; $display_invitation = check_invitation_code(); 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); } if (($login_Blog =& get_setting_Blog('login_blog_ID')) && $Blog->ID != $login_Blog->ID) { // Redirect to special blog for login/register actions if it is defined in general settings header_redirect($login_Blog->get('lostpasswordurl', array('glue' => '&'))); } $seo_page_type = 'Lost password form'; $robots_index = false; break; case 'activateinfo': if (!is_logged_in()) { // Redirect to the login page for anonymous users $Messages->add(T_('You must log in before you can activate your account.')); header_redirect(get_login_url('cannot see messages'), 302); // will have exited } if (!$current_User->check_status('can_be_validated')) { // don't display activateinfo screen $after_email_validation = $Settings->get('after_email_validation'); if ($after_email_validation == 'return_to_original') { // we want to return to original page after account activation // check if Session 'validatemail.redirect_to' param is still set $redirect_to = $Session->get('core.validatemail.redirect_to'); if (empty($redirect_to)) { // Session param is empty try to get general redirect_to param $redirect_to = param('redirect_to', 'url', ''); } else { // cleanup validateemail.redirect_to param from session $Session->delete('core.validatemail.redirect_to'); } } else { // go to after email validation url which is set in the user general settings form $redirect_to = $after_email_validation; } if (empty($redirect_to) || preg_match('#disp=activateinfo#', $redirect_to)) { // redirect_to is pointing to the activate info display or is empty // redirect to referer page $redirect_to = ''; } if ($current_User->check_status('is_validated')) { $Messages->add(T_('Your account has already been activated.')); } header_redirect($redirect_to, 302); // will have exited } if (($login_Blog =& get_setting_Blog('login_blog_ID')) && $Blog->ID != $login_Blog->ID) { // Redirect to special blog for login/register actions if it is defined in general settings header_redirect($login_Blog->get('activateinfourl', array('glue' => '&'))); } break; case 'profile': case 'avatar': $action = param_action(); if ($action == 'crop' && is_logged_in()) { // Check data for crop action: global $current_User, $cropped_File; $file_ID = param('file_ID', 'integer'); if (!($cropped_File = $current_User->get_File_by_ID($file_ID, $error_code))) { // Current user cannot crop this file set_param('action', ''); } } 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; } // Display messages depending on user email status display_user_email_status_message(); break; case 'users': if (!is_logged_in() && !$Settings->get('allow_anonymous_user_list')) { // 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 the user directory.')); header_redirect(get_login_url('cannot see user'), 302); // will have exited } if (is_logged_in() && !check_user_status('can_view_users')) { // user status doesn't permit to view users list 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 the user directory. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } // set where to redirect $error_redirect_to = empty($Blog) ? $baseurl : $Blog->gen_blogurl(); $Messages->add(T_('Your account status currently does not permit to view the user directory.')); header_redirect($error_redirect_to, 302); // will have exited } if (has_cross_country_restriction('users', 'list') && empty($current_User->ctry_ID)) { // User may browse other users only from the same country $Messages->add(T_('Please specify your country before attempting to contact other users.')); header_redirect(get_user_profile_url()); } $seo_page_type = 'Users list'; $robots_index = false; break; case '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); // 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 $user_available_by_group_level = true; if (!empty($user_ID)) { $UserCache =& get_UserCache(); if ($User =& $UserCache->get_by_ID($user_ID, false)) { // If user exists we can check if the anonymous users have an access to view the user by group level limitation $User->get_Group(); $user_available_by_group_level = $User->Group->level >= $Settings->get('allow_anonymous_user_level_min') && $User->Group->level <= $Settings->get('allow_anonymous_user_level_max'); } } if (!$Settings->get('allow_anonymous_user_profiles') || !$user_available_by_group_level || empty($user_ID)) { // If this user is not available for anonymous users $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(); $User =& $UserCache->get_by_ID($user_ID, false); if (empty($User)) { $Messages->add(T_('The requested user does not exist!')); header_redirect($error_redirect_to); // will have exited } if ($User->check_status('is_closed')) { $Messages->add(T_('The requested user account is closed!')); header_redirect($error_redirect_to); // will have exited } if (has_cross_country_restriction('any')) { if (empty($current_User->ctry_ID)) { // Current User country is not set $Messages->add(T_('Please specify your country before attempting to contact other users.')); header_redirect(get_user_profile_url()); // will have exited } if (has_cross_country_restriction('users', 'profile') && $current_User->ctry_ID !== $User->ctry_ID) { // Current user country is different then edited user country and cross country user browsing is not enabled. $Messages->add(T_('You don\'t have permission to view this user profile.')); header_redirect(url_add_param($error_redirect_to, 'disp=403', '&')); // will have exited } } } // Initialize users list from session cache in order to display prev/next links: // It is used to navigate between users load_class('users/model/_userlist.class.php', 'UserList'); global $UserList; $UserList = new UserList(); $UserList->memorize = false; $UserList->load_from_Request(); $seo_page_type = 'User display'; break; case 'edit': global $current_User, $post_ID; // Post ID, go from $_GET when we edit a post from Front-office // or from $_POST when we switch from Back-office $post_ID = param('p', 'integer', empty($post_ID) ? 0 : $post_ID, true); if (!is_logged_in()) { // Redirect to the login page if not logged in and allow anonymous user setting is OFF $redirect_to = url_add_param($Blog->gen_blogurl(), 'disp=edit'); $Messages->add(T_('You must log in to create & edit posts.')); header_redirect(get_login_url('cannot edit posts', $redirect_to), 302); // will have exited } if (!$current_User->check_status('can_edit_post')) { if ($current_User->check_status('can_be_validated')) { // user is logged in but his/her account was not activated yet // Redirect to the account activation page $Messages->add(T_('You must activate your account before you can create & edit posts. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } // Redirect to the blog url for users without messaging permission $Messages->add(T_('You are not allowed to create & edit posts!')); header_redirect($Blog->gen_blogurl(), 302); } // user logged in and the account was activated check_item_perm_edit($post_ID); if (!blog_has_cats($Blog->ID)) { // No categories are in this blog $error_message = T_('Since this blog has no categories, you cannot post into it.'); if ($current_User->check_perm('blog_cats', 'edit', false, $Blog->ID)) { // If current user has a permission to create a category global $admin_url; $error_message .= ' ' . sprintf(T_('You must <a %s>create categories</a> first.'), 'href="' . $admin_url . '?ctrl=chapters&blog=' . $Blog->ID . '"'); } $Messages->add($error_message, 'error'); header_redirect($Blog->gen_blogurl(), 302); } // Prepare the 'In-skin editing': init_inskin_editing(); break; case 'edit_comment': global $current_User, $edited_Comment, $comment_Item, $Item, $comment_title, $comment_content, $display_params; // comment ID $comment_ID = param('c', 'integer', 0, true); if (!is_logged_in()) { // Redirect to the login page if not logged in and allow anonymous user setting is OFF $redirect_to = url_add_param($Blog->gen_blogurl(), 'disp=edit_comment'); $Messages->add(T_('You must log in to edit comments.')); header_redirect(get_login_url('cannot edit comments', $redirect_to), 302); // will have exited } if (!$current_User->check_status('can_edit_comment')) { if ($current_User->check_status('can_be_validated')) { // user is logged in but his/her account was not activated yet // Redirect to the account activation page $Messages->add(T_('You must activate your account before you can edit comments. <b>See below:</b>')); header_redirect(get_activate_info_url(), 302); // will have exited } // Redirect to the blog url for users without messaging permission $Messages->add('You are not allowed to edit comments!'); header_redirect($Blog->gen_blogurl(), 302); } if (empty($comment_ID)) { // Can't edit a not exisiting comment $Messages->add('Invalid comment edit URL!'); global $disp; $disp = 404; break; } $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, $edited_Comment->get_renderers_validated(), $params); $Item = $comment_Item; $display_params = array(); break; case 'useritems': case 'usercomments': global $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 } } $display_params = !empty($Skin) ? $Skin->get_template('Results') : NULL; if ($disp == 'useritems') { // Init items list global $user_ItemList; $useritems_Blog = NULL; $user_ItemList = new ItemList2($useritems_Blog, NULL, NULL, NULL, 'ItemCache', 'useritems_'); $user_ItemList->load_from_Request(); $user_ItemList->set_filters(array('authors' => $user_ID), true, true); $user_ItemList->query(); } else { // Init comments list global $user_CommentList; $user_CommentList = new CommentList2(NULL, NULL, 'CommentCache', 'usercmts_'); $user_CommentList->load_from_Request(); $user_CommentList->set_filters(array('author_IDs' => $user_ID), true, true); $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'; } break; case 'closeaccount': global $current_User; if (!$Settings->get('account_close_enabled') || is_logged_in() && $current_User->check_perm('users', 'edit', false) || !is_logged_in() && !$Session->get('account_closing_success')) { // If an account closing page is disabled - Display 404 page with error message // Don't allow admins close own accounts from front office // Don't display this message for not logged in users, except of one case to display a bye message after account closing global $disp; $disp = '404'; } elseif ($Session->get('account_closing_success')) { // User has closed the account global $account_closing_success; $account_closing_success = $Session->get('account_closing_success'); // Unset this temp session var to don't display the message twice $Session->delete('account_closing_success'); if (is_logged_in()) { // log out current User logout(); } } break; case 'tags': $seo_page_type = 'Tags'; if ($Blog->get_setting($disp . '_noindex')) { // We prefer robots not to index these pages: $robots_index = false; } break; } $Debuglog->add('skin_init: $disp=' . $disp . ' / $disp_detail=' . $disp_detail . ' / $seo_page_type=' . $seo_page_type, 'skins'); // Make this switch block special only for 404 page switch ($disp) { 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; } global $Hit, $check_browser_version; if ($check_browser_version && $Hit->get_browser_version() > 0 && $Hit->is_IE(9, '<')) { // Display info message if browser IE < 9 version and it is allowed by config var: global $debug; $Messages->add(T_('Your web browser is too old. For this site to work correctly, we recommend you use a more recent browser.'), 'note'); if ($debug) { $Messages->add('User Agent: ' . $Hit->get_user_agent(), '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(); } }
* @subpackage evopress */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } if (version_compare($app_version, '4.0.0-dev') < 0) { // Older 2.x skins work on newer 2.x b2evo versions, but newer 2.x skins may not work on older 2.x b2evo versions. die('This skin is designed for b2evolution 4.0.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); // -------------------------- HTML HEADER INCLUDED HERE -------------------------- add_headline(<<<HEREDOC <style type="text/css" media="screen"> \t#page.page-left, #page.page-right{background-image:none} </style> HEREDOC ); skin_include('_html_header.inc.php', array()); // -------------------------------- END OF HEADER -------------------------------- ?> <?php // ------------------------- 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 HEADER -------------------------------- ?>
/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // Add 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('style.css', 'relative'); // Add custom CSS: $custom_css = ''; require_css('rsc/nifty_corners.css', true, 'Nifty Corners'); require_css('rsc/nifty_print.css', true, 'Print', 'print'); require_js('rsc/nifty_corners.js', true); $custom_js = <<<HEREDOC \t<script type="text/javascript"> \t\t<!-- \t\twindow.onload=function() \t\t{ \t\t\tif(!NiftyCheck()) \t\t\t\t\treturn; \t\t\tRounded("div.outerwrap","all","transparent","#fff",""); \t\t\tRounded("div.posts","all","transparent","#fff",""); \t\t\tRounded("div.bSideBar","all","transparent","#fff",""); \t\t\tRounded("div.bTitle","top","#fff","#0099cc","smooth"); \t\t} \t\t// --> \t</script> HEREDOC; add_headline($custom_js); // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images: if ($this->get_setting("colorbox")) { require_js_helper('colorbox', 'blog'); } }
/** * 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(); } }