Ejemplo n.º 1
0
function login_form_widget($num = 1)
{
    $out = '';
    $widget = 'login_form_widget_' . $num;
    // имя для опций = виджет + номер
    $options = mso_get_option($widget, 'plugins', array());
    // получаем опции
    if (is_login()) {
        $out = '<p><strong>' . t('Привет,') . ' ' . getinfo('users_nik') . '!</strong><br>
				[<a href="' . getinfo('siteurl') . 'admin">' . t('управление') . '</a>]
				[<a href="' . getinfo('siteurl') . 'logout' . '">' . t('выйти') . '</a>] 
				</p>';
    } elseif ($comuser = is_login_comuser()) {
        if (!$comuser['comusers_nik']) {
            $cun = t('Привет!');
        } else {
            $cun = t('Привет,') . ' ' . $comuser['comusers_nik'] . '!';
        }
        $out = '<p><strong>' . $cun . '</strong><br>
				[<a href="' . getinfo('siteurl') . 'users/' . $comuser['comusers_id'] . '">' . t('своя страница') . '</a>]
				[<a href="' . getinfo('siteurl') . 'logout' . '">' . t('выйти') . '</a>] 
				</p>';
    } else {
        $after_form = isset($options['after_form']) ? $options['after_form'] : '';
        $out = mso_login_form(array('login' => t('Логин (email):') . ' ', 'password' => t('Пароль:') . ' ', 'submit' => '', 'form_end' => $after_form), getinfo('siteurl') . mso_current_url(), false);
    }
    if ($out) {
        if (isset($options['header']) and $options['header']) {
            $out = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>') . $out;
        }
    }
    return $out;
}
Ejemplo n.º 2
0
function _is_exclude($str)
{
    // исключаемые из списка элементы задаются в custom/set_val_admin.php
    // mso_set_val('editor_files_exclude', array('/node_modules/'));
    $a = mso_get_val('editor_files_exclude', array());
    foreach ($a as $find) {
        if (stripos($str, $find) !== false) {
            return true;
        }
        // найдено вхождение
    }
    return false;
}
Ejemplo n.º 3
0
function picasa_widget($num = 1)
{
    $widget = 'picasa_widget_' . $num;
    // имя для опций = виджет + номер
    $options = mso_get_option($widget, 'plugins', array());
    // получаем опции
    if (isset($options['header']) and $options['header']) {
        $options['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>');
    } else {
        $options['header'] = '';
    }
    return picasa_widget_custom($options, $num);
}
Ejemplo n.º 4
0
function tabs_widget($num = 1)
{
    $widget = 'tabs_widget_' . $num;
    // имя для опций = виджет + номер
    $options = mso_get_option($widget, 'plugins', array());
    // получаем опции
    // заменим заголовок, чтобы был в  h2 class="box"
    if (isset($options['header']) and $options['header']) {
        $options['header'] = mso_get_val('widget_header_start', '<div class="mso-widget-header"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></div>');
    } else {
        $options['header'] = '';
    }
    return tabs_widget_custom($options, $num);
}
Ejemplo n.º 5
0
function dignity_rss_widget($num = 1)
{
    $widget = 'dignity_rss_widget_' . $num;
    // имя для опций = виджет + номер
    $options = mso_get_option($widget, 'plugins', array());
    // получаем опции
    if (isset($options['header']) and $options['header']) {
        $options['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>');
    } else {
        $options['header'] = '';
    }
    if (isset($options['textdo'])) {
        $options['textdo'] = '<p>' . $options['textdo'] . '</p>';
    } else {
        $options['textdo'] = '';
    }
    if (isset($options['feed_url'])) {
        $options['feed_url'] = $options['feed_url'];
    } else {
        $options['feed_url'] = getinfo('rss_url');
    }
    if (isset($options['google_text'])) {
        $options['google_text'] = $options['google_text'];
    } else {
        $options['google_text'] = t('Читать RSS через Google');
    }
    if (isset($options['yandex_text'])) {
        $options['yandex_text'] = $options['yandex_text'];
    } else {
        $options['yandex_text'] = t('Читать RSS через Яндекс');
    }
    if (isset($options['rss_text'])) {
        $options['rss_text'] = $options['rss_text'];
    } else {
        $options['rss_text'] = t('RSS лента');
    }
    if (isset($options['rss_to_email'])) {
        $options['rss_to_email'] = $options['rss_to_email'];
    } else {
        $options['rss_to_email'] = t('RSS-лента на E-Mail');
    }
    if (isset($options['textposle'])) {
        $options['textposle'] = '<p>' . $options['textposle'] . '</p>';
    } else {
        $options['textposle'] = '';
    }
    return dignity_rss_widget_custom($options, $num);
}
Ejemplo n.º 6
0
function text_block_widget($num = 1)
{
    $widget = 'text_block_widget_' . $num;
    // имя для опций = виджет + номер
    $options = mso_get_option($widget, 'plugins', array());
    // получаем опции
    // заменим заголовок, чтобы был в  h2 class="box"
    if (isset($options['header']) and $options['header']) {
        $options['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>');
    } else {
        $options['header'] = '';
    }
    if (!isset($options['text'])) {
        $options['text'] = '';
    }
    if (!isset($options['type'])) {
        $options['type'] = 'html';
    }
    return text_block_widget_custom($options, $num);
}
Ejemplo n.º 7
0
function category_widget($num = 1)
{
    $widget = 'category_widget_' . $num;
    // имя для опций = виджет + номер
    $options = mso_get_option($widget, 'plugins', array());
    // получаем опции
    // заменим заголовок, чтобы был в  h2 class="box"
    if (isset($options['header']) and $options['header']) {
        $options['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>');
    } else {
        $options['header'] = '';
    }
    if (isset($options['include'])) {
        $options['include'] = mso_explode($options['include']);
    } else {
        $options['include'] = array();
    }
    if (isset($options['exclude'])) {
        $options['exclude'] = mso_explode($options['exclude']);
    } else {
        $options['exclude'] = array();
    }
    return category_widget_custom($options, $num);
}
Ejemplo n.º 8
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
mso_set_val('show_thumb', false);
mso_set_val('body_class', mso_get_val('main_class', ''));
mso_set_val('page_content_only', true);
mso_remove_hook('content_end');
mso_remove_hook('head_css');
mso_remove_hook('head');
mso_remove_hook('content');
#end of file
Ejemplo n.º 9
0
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
# основной файл html-структуры
# секция HEAD
if (file_exists(getinfo('template_dir') . 'custom/head-section.php')) {
    require getinfo('template_dir') . 'custom/head-section.php';
} elseif (function_exists('mso_default_head_section')) {
    mso_default_head_section();
}
// подключение через функцию
?>
<body<?php 
echo mso_get_val('body_class') ? ' class="' . mso_get_val('body_class') . '"' : '';
?>
>
<!-- end header -->
<?php 
mso_hook('body_start');
if (function_exists('ushka')) {
    echo ushka('body_start');
}
if (file_exists(getinfo('template_dir') . 'custom/body-start.php')) {
    require getinfo('template_dir') . 'custom/body-start.php';
}
?>

<div class="all">
	<div class="all-wrap">
Ejemplo n.º 10
0
function my_default_head_section()
{
    global $page;
    echo '<!DOCTYPE HTML>
<html' . mso_get_val('head_section_html_add') . '><head>' . mso_hook('head_start') . '
<meta charset="UTF-8">
<title>' . mso_head_meta('title') . '</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="MaxSite CMS">
<meta name="description" content="' . mso_head_meta('description') . '">
<meta name="keywords" content="' . mso_head_meta('keywords') . '">
<meta property="og:title" content="' . mso_head_meta('title') . '">
<meta property="og:description" content="' . mso_head_meta('description') . '">
<meta property="og:url" content="' . mso_link_rel('canonical', '', true) . '">
<link rel="shortcut icon" href="' . getinfo('template_url') . 'assets/images/favicons/' . mso_get_option('default_favicon', 'templates', 'favicon1.png') . '" type="image/x-icon">
';
    if (is_type('page') and isset($page['page_meta']['image_for_page'][0])) {
        echo '<meta property="og:image" content="' . $page['page_meta']['image_for_page'][0] . '">';
    }
    if (mso_get_option('default_canonical', 'templates', 0)) {
        echo mso_link_rel('canonical');
    }
    echo mso_rss();
    if ($fn = mso_fe('custom/head-start.php')) {
        require $fn;
    }
    // autoload файлов
    if ($autoload_css = mso_get_path_files(getinfo('template_dir') . 'assets/css/', getinfo('template_url') . 'assets/css/', true, array('css'))) {
        foreach ($autoload_css as $fn_css) {
            echo '<link rel="stylesheet" href="' . $fn_css . '">' . NR;
        }
    }
    my_out_component_css();
    mso_hook('head_css');
    my_default_out_profiles();
    // своя версия jQuery, если нужно
    if ($j = mso_get_val('jquery_url', false)) {
        echo '<script src="' . $j . '"></script>' . NR;
    } else {
        if (mso_fe('assets/js/jquery.min.js')) {
            echo mso_add_file('assets/js/jquery.min.js');
        } else {
            echo mso_load_jquery();
        }
    }
    mso_hook('head');
    // autoload js-файлов
    if ($autoload_js = mso_get_path_files(getinfo('template_dir') . 'assets/js/autoload/', getinfo('template_url') . 'assets/js/autoload/', true, array('js'))) {
        foreach ($autoload_js as $fn_js) {
            echo '<script src="' . $fn_js . '"></script>' . NR;
        }
    }
    if ($fn = mso_fe('custom/head.php')) {
        require $fn;
    }
    if ($fn = mso_page_foreach('head')) {
        require $fn;
    }
    if (function_exists('ushka')) {
        echo ushka('head');
    }
    if (mso_fe('assets/js/my.js')) {
        echo mso_add_file('assets/js/my.js');
    }
    if ($my_style = mso_get_option('my_style', 'templates', '')) {
        echo NR . '<!-- custom css-my_style -->' . NR . '<style>' . NR . $my_style . '</style>';
    }
    mso_hook('head_end');
    if (function_exists('ushka')) {
        echo ushka('google_analytics_top');
    }
    echo NR . '</head>';
}
Ejemplo n.º 11
0
function twitter_widget_custom($arg, $num)
{
    # параметры ленты
    if (!isset($arg['url'])) {
        $arg['url'] = false;
    }
    if (!isset($arg['count'])) {
        $arg['count'] = 5;
    }
    if (!isset($arg['format'])) {
        $arg['format'] = '<p><strong>%DATE%</strong><br>%TITLE% <a href="%LINK%">&gt;&gt;&gt;</a></p>';
    }
    if (!isset($arg['format_date'])) {
        $arg['format_date'] = 'd/m/Y H:i:s';
    }
    if (!isset($arg['max_word_description'])) {
        $arg['max_word_description'] = false;
    }
    # оформление виджета
    if (!isset($arg['header'])) {
        $arg['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . 'Мой Twitter' . mso_get_val('widget_header_end', '</span></h2>');
    }
    if (!isset($arg['block_start'])) {
        $arg['block_start'] = '<div class="twitter">';
    }
    if (!isset($arg['block_end'])) {
        $arg['block_end'] = '</div>';
    }
    if (!isset($arg['footer'])) {
        $arg['footer'] = '';
    }
    if (!isset($arg['show_nick'])) {
        $arg['show_nick'] = true;
    }
    $rss = @twitter_go($arg['url'], $arg['count'], $arg['format'], $arg['format_date'], $arg['max_word_description'], $arg['show_nick']);
    if ($rss) {
        //$rss = str_replace('maxsite:', '<strong>MaxSite:</strong>', $rss);
        return $arg['header'] . $arg['block_start'] . $rss . $arg['footer'] . $arg['block_end'];
    }
}
Ejemplo n.º 12
0
            echo '<div class="comments_content">' . mso_avatar($comment) . mso_comments_content($comments_content) . '</div>';
        }
        echo '<div class="clearfix"></div>';
        echo '</li>';
        //	pr($comment);
    }
    echo '</ol>';
    echo '</div>' . NR;
}
if ($page_comment_allow and $page_text_ok) {
    // если запрещены комментарии и от анонимов и от комюзеров, то выходим
    if (mso_get_option('allow_comment_anonim', 'general', '1') or mso_get_option('allow_comment_comusers', 'general', '1')) {
        if ($f = mso_page_foreach('page-comment-form-do')) {
            require $f;
        } else {
            echo '<div class="break"></div>' . mso_get_val('leave_a_comment_start', '<h3 class="comments">') . mso_get_option('leave_a_comment', 'templates', tf('Оставьте комментарий!')) . mso_get_val('leave_a_comment_end', '</h3>');
        }
        if ($f = mso_page_foreach('page-comment-form')) {
            require $f;
            // подключаем кастомный вывод
        } else {
            // форма комментариев
            // page-comment-form.php может быть в type своего шаблона
            $fn1 = getinfo('template_dir') . 'type/page-comment-form.php';
            // путь в шаблоне
            $fn2 = getinfo('templates_dir') . 'default/type/page-comment-form.php';
            // путь в default
            if (file_exists($fn1)) {
                require $fn1;
            } elseif (file_exists($fn2)) {
                require $fn2;
Ejemplo n.º 13
0
                if ($fn = mso_find_ts_file('type/page/units/page-comments-other-system.php')) {
                    require $fn;
                }
            } elseif ($fn = mso_find_ts_file('type/page/units/page-comments.php')) {
                require $fn;
            }
        }
        // end foreach
    }
    // else page_content_only
} else {
    if ($f = mso_page_foreach('pages-not-found')) {
        require $f;
        // подключаем кастомный вывод
    } else {
        echo '<h1>' . tf('404. Ничего не найдено...') . '</h1>';
        echo '<p>' . tf('Извините, ничего не найдено') . '</p>';
        echo mso_hook('page_404');
    }
}
// endif $pages
if ($f = mso_page_foreach('page-posle')) {
    require $f;
}
if (!mso_get_val('page_content_only', false)) {
    echo NR . '</div><!-- /div.mso-type-page -->' . NR;
}
if ($fn = mso_find_ts_file('main/main-end.php')) {
    require $fn;
}
# end file
Ejemplo n.º 14
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
$par = array('page_id' => mso_get_option('home_page_id_top', 'templates', '0'), 'cut' => mso_get_option('more', 'templates', 'Читать полностью »'), 'cat_order' => 'category_name', 'cat_order_asc' => 'asc', 'pagination' => false, 'exclude_page_id' => mso_get_val('exclude_page_id'));
// подключаем кастомный вывод, где можно изменить массив параметров $par для своих задач
if ($f = mso_page_foreach('home-top-mso-get-pages')) {
    require $f;
}
$pages = mso_get_pages($par, $temp);
mso_set_val('container_class', 'mso-home-top-page');
mso_set_val('full_format_title_start', '<h1>');
mso_set_val('full_format_title_end', '</h1>');
if ($fn = mso_find_ts_file('type/_def_out/full/full.php')) {
    require $fn;
}
# end file
Ejemplo n.º 15
0
    header('HTTP/1.0 404 Not Found');
}
# начальная часть шаблона
require getinfo('template_dir') . 'main-start.php';
echo NR . '<div class="type type_tag">' . NR;
if ($f = mso_page_foreach('tag-do')) {
    require $f;
} else {
    echo '<h1 class="category">' . htmlspecialchars(mso_segment(2)) . '</h1>';
}
if ($pages) {
    if (mso_get_option('category_show_rss_text', 'templates', 1)) {
        if ($f = mso_page_foreach('tag-show-rss-text')) {
            require $f;
        } else {
            mso_get_val('show_rss_text_start', '<h3 class="category">') . '<a href="' . getinfo('siteurl') . mso_segment(1) . '/' . mso_segment(2) . '/feed">' . tf('Подписаться на эту метку по RSS') . '</a>' . mso_get_val('show_rss_text_end', '</h3>');
        }
    }
    $full_posts = mso_get_option('tag_full_text', 'templates', '1');
    // полные или короткие записи
    if (!$full_posts) {
        echo '<ul class="category">';
    }
    foreach ($pages as $page) {
        // выводим в цикле
        if ($f = mso_page_foreach('tag')) {
            require $f;
            // подключаем кастомный вывод
            continue;
            // следующая итерация
        }
Ejemplo n.º 16
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
$par = array('page_id' => mso_get_option('home_page_id', 'templates', '0'), 'cat_id' => mso_get_option('home_cat_id', 'templates', '0'), 'limit' => mso_get_option('home_limit_post', 'templates', '7'), 'cut' => mso_get_option('more', 'templates', tf('Читать полностью »')), 'cat_order' => 'category_id_parent', 'cat_order_asc' => 'asc', 'exclude_page_id' => mso_get_val('exclude_page_id'), 'order' => mso_get_option('home_order', 'templates', 'page_date_publish'), 'order_asc' => mso_get_option('home_order_asc', 'templates', 'desc'));
// подключаем кастомный вывод, где можно изменить массив параметров $par для своих задач
if ($f = mso_page_foreach('home-mso-get-pages')) {
    require $f;
}
$pages = mso_get_pages($par, $pagination);
mso_set_val('container_class', 'mso-type_home home_full');
mso_set_val('full_format_title_start', '<h1>');
mso_set_val('full_format_title_end', '</h1>');
if ($fn = mso_find_ts_file('type/_def_out/full/full.php')) {
    require $fn;
}
if ($f = mso_page_foreach('home-do-pagination')) {
    require $f;
}
mso_hook('pagination', $pagination);
# end of file
Ejemplo n.º 17
0
<?php

// подключим шапку
require_once getinfo('template_dir') . 'page_header.php';
echo '<div class="posts" role="main">';
$par = array('page_id' => mso_get_option('home_page_id', 'templates', '0'), 'cat_id' => mso_get_option('home_cat_id', 'templates', '0'), 'limit' => mso_get_option('limit_post', 'templates', '10'), 'cut' => mso_get_option('more', 'templates', tf('Читать полностью »')), 'cat_order' => 'category_id_parent', 'cat_order_asc' => 'asc', 'exclude_page_id' => mso_get_val('exclude_page_id'), 'content' => false, 'get_page_count_comments' => false);
// подключаем кастомный вывод, где можно изменить массив параметров $par для своих задач
if ($f = mso_page_foreach('home-mso-get-pages')) {
    require $f;
}
$pages = mso_get_pages($par, $pagination);
// подключим выводящий файл
require_once getinfo('template_dir') . 'type/echo_page.php';
echo '</div>';
// подключим подвал
require_once getinfo('template_dir') . 'page_footer.php';
# end file
Ejemplo n.º 18
0
 *
 * Шаблон вывода: no-sidebar
 * Тот же самый, что и основной main.php, только удалён вывод сайдбара
 */
# основной файл html-структуры
# секция HEAD
if ($fn = mso_fe('custom/head-section.php')) {
    require $fn;
} else {
    mso_default_head_section();
}
// подключение через функцию
?>

<body<?php 
echo mso_get_val('body_class') ? ' class="no-sidebar ' . mso_get_val('body_class') . '"' : '';
?>
>
<!-- end header -->
<?php 
mso_hook('body_start');
if (function_exists('ushka')) {
    echo ushka('body_start');
}
if ($fn = mso_fe('custom/body-start.php')) {
    require $fn;
}
?>

<div class="all"><div class="all-wrap">
	<div class="header-main">
Ejemplo n.º 19
0
function mso_page_other_pages($page_id = 0, $page_categories = array())
{
    if ($bl_title = mso_get_option('page_other_pages', 'templates', tf('Еще записи по теме'))) {
        // алгоритм получения записей
        $algoritm = mso_get_option('page_other_pages_algoritm', 'templates', 'all');
        if ($algoritm == 'lowlewel') {
            $all_cat = mso_cat_array_single();
            // все рубрики
            $bl_page_categories = array();
            // обработаный массив id-level
            foreach ($page_categories as $cat_id) {
                $bl_page_categories[$cat_id] = $all_cat[$cat_id]['level'];
            }
            arsort($bl_page_categories);
            // сортируем в обратном порядке
            $bl_page_categories = array_keys($bl_page_categories);
            // оставляем только ключи (id)
            // если что-то есть, то оставляем только первую рубрику, иначе $page_categories
            if (isset($bl_page_categories[0])) {
                $bl_page_categories = array($bl_page_categories[0]);
            } else {
                $bl_page_categories = $page_categories;
            }
        } else {
            // обычный вывод по всем рубрикам
            $bl_page_categories = $page_categories;
        }
        $bl_pages = mso_get_pages(array('type' => false, 'content' => false, 'pagination' => false, 'custom_type' => 'category', 'categories' => $bl_page_categories, 'exclude_page_id' => array($page_id), 'content' => false, 'limit' => mso_get_option('page_other_pages_limit', 'templates', 7), 'order' => mso_get_option('page_other_pages_order', 'templates', 'page_date_publish'), 'order_asc' => mso_get_option('page_other_pages_order_asc', 'templates', 'random')), $_temp);
        if ($bl_pages) {
            echo '<div class="page_other_pages">' . mso_get_val('page_other_pages_start', '<h3>') . $bl_title . mso_get_val('page_other_pages_end', '</h3>') . '<ul>';
            foreach ($bl_pages as $bl_page) {
                mso_page_title($bl_page['page_slug'], $bl_page['page_title'], '<li>', '</li>', true);
            }
            echo '</ul></div>';
        }
    }
}
Ejemplo n.º 20
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
if (mso_get_option('category_show_rss_text', 'templates', 1)) {
    if ($f = mso_page_foreach('tag-show-rss-text')) {
        require $f;
    } else {
        echo mso_get_val('show_rss_text_start', '<p class="mso-show-rss-text">') . '<a href="' . getinfo('siteurl') . mso_segment(1) . '/' . mso_segment(2) . '/feed">' . tf('Подписаться на эту метку по RSS') . '</a>' . mso_get_val('show_rss_text_end', '</p>');
    }
}
# end of file
Ejemplo n.º 21
0
 * (c) http://max-3000.com/
 */
# Диспетчер опций шаблона
# Сами опции вынесены в ini-файлы каталога options шаблона
# поддерживаются custom/my_options.ini и custom/my_options.php
echo '<h1>' . t('Настройка шаблона') . ' «' . getinfo('template_name') . '»</h1>';
// echo '<p class="info">' . t('Выберите необходимые опции') . '</p>';
// функции для работы с ini-файлом
require_once getinfo('common_dir') . 'inifile.php';
// проверка на обновление POST
if (mso_check_post_ini()) {
    echo '<div class="update">' . t('Обновлено!') . '</div>';
}
$options = array();
// если переменная = true, то подгружаем дефолтные опции из shared/options/default/
if (mso_get_val('get_options_default', true)) {
    // получим список всех файлов из options
    $files = mso_get_path_files(getinfo('shared_dir') . 'options/default/', getinfo('shared_dir') . 'options/default/', true, array('ini'));
    foreach ($files as $file) {
        $add = mso_get_ini_file($file);
        $options = array_merge($options, $add);
    }
}
// получим список всех файлов из options шаблона
$files = mso_get_path_files(getinfo('template_dir') . 'options/', getinfo('template_dir') . 'options/', true, array('ini'));
foreach ($files as $file) {
    $add = mso_get_ini_file($file);
    $options = array_merge($options, $add);
}
if (file_exists(getinfo('template_dir') . 'custom/my_options.php')) {
    require getinfo('template_dir') . 'custom/my_options.php';
Ejemplo n.º 22
0
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
echo NR . '<div class="mso-type-home-cat-block">' . NR;
if ($f = mso_page_foreach('home-cat-block-text-do')) {
    require $f;
}
// нужно считать каждую указанную рубрику и в цикле
// получить для неё все данные и сразу вывести
// параметры для получения страниц - общие для всех
$par = array('limit' => mso_get_option('home_limit_post', 'templates', '7'), 'cut' => mso_get_option('more', 'templates', tf('Читать полностью »')), 'cat_order' => 'category_id_parent', 'cat_order_asc' => 'asc', 'pagination' => false, 'exclude_page_id' => mso_get_val('exclude_page_id'));
$home_cat_block = mso_explode(mso_get_option('home_cat_id', 'templates', '0'));
// в массив
// все блоки можно закэшировать на 15 минут
$key_home_cache = serialize($home_cat_block);
if ($k = mso_get_cache($key_home_cache)) {
    print $k;
} else {
    ob_start();
    if ($home_cat_block) {
        // перебираем рубрики
        foreach ($home_cat_block as $cat_id) {
            if ($f = mso_page_foreach('home-cat-block')) {
                require $f;
                // подключаем кастомный вывод
                continue;
Ejemplo n.º 23
0
/**
*  Система событий
*  
*  @param $event — событие
*  @param $ARGS — массив аргументов
*  
*  Событие — это файл, функция или компонент
*  
*  $EVENT['событие'] = array(
*  		'file' => 'файл'
*  	or
*  		'function' => 'функция'
*  	or
*  		'component' => 'компонент'
*   or
*  		'val' => 'ключ для mso_get_val()'
*   or
*  		'text' => 'любой текст'
*  
*  		'options' => array(опции, если есть)
*  );
*  
*  Sample:
*  
*  In variables.php 
*  		$VAR['event'] = SET_DIR . 'event.php';
*  
*  In text.php
* 		mso_event('layout/top')
*  		mso_event('next-prev')
*  		mso_event('pagination', array(другие опции))
*  
*  In SET_DIR/event.php
*  		$EVENT['layout/top'] = array('file' => SET_DIR . 'layout/top.php');
*  		$EVENT['next-prev'] = array('file' => SET_DIR . 'next-prev.php');
*		$EVENT['pagination'] = array('component' => 'jpaginate', 'options' => array(опции));
*/
function mso_event($event, $args = array())
{
    global $VAR;
    static $ecache = array();
    // кеш для файлов $VAR['event']
    if (!$VAR['event']) {
        return;
    }
    // не задан файл event
    // проверим статичный кеш
    if (isset($ecache[$VAR['event']])) {
        $EVENT = $ecache[$VAR['event']];
    } else {
        if (!file_exists($VAR['event'])) {
            return;
        }
        // нет файла
        require $VAR['event'];
        // подключили файл
        if (isset($EVENT)) {
            // в нём должен быть массив $EVENT
            $ecache[$VAR['event']] = $EVENT;
        } else {
            return;
        }
    }
    // теперь всегда есть $EVENT
    if (isset($EVENT[$event])) {
        // аргументы могут быть заданы как при вызове mso_event, так и в $EVENT
        // приоритет в mso_event
        $OPTIONS = $args;
        if (isset($EVENT[$event]['options'])) {
            // могут быть опции в $EVENT
            $OPTIONS = $EVENT[$event]['options'];
        }
        if (isset($EVENT[$event]['file'])) {
            // в файле будет доступна переменная $OPTIONS
            if ($fn = mso_fe($EVENT[$event]['file'])) {
                require $fn;
            }
        } elseif (isset($EVENT[$event]['function'])) {
            $fu = $EVENT[$event]['function'];
            if (function_exists($fu)) {
                return $fu($OPTIONS);
            }
        } elseif (isset($EVENT[$event]['component'])) {
            mso_component($EVENT[$event]['component'], $OPTIONS);
        } elseif (isset($EVENT[$event]['val'])) {
            return mso_get_val($EVENT[$event]['val']);
        } elseif (isset($EVENT[$event]['text'])) {
            return $EVENT[$event]['text'];
        }
    }
}
Ejemplo n.º 24
0
            mso_set_val('main_file', $fn);
            // выставляем путь к файлу
        } else {
            // возможно указана опця
            // main_template_TYPE
            // опции заданы в ini-файлах
            if ($page_template = mso_get_option('main_template_' . getinfo('type'), 'templates', '')) {
                if ($fn = mso_fe('main/' . $page_template . '/main.php')) {
                    mso_set_val('main_file', $fn);
                    // выставляем путь к файлу
                }
            }
        }
    }
}
$fn_main = mso_get_val('main_file', '');
if ($fn_main and file_exists($fn_main)) {
    $MAIN_FILE = $fn_main;
} else {
    // main.php может находиться в каталоге main/ или в основном каталоге шаблона
    if ($fn = mso_fe('main/main.php')) {
        $fn_main = $fn;
    } else {
        $fn_main = getinfo('template_dir') . 'main.php';
    }
    // может быть задан main-файл по-умолчанию в опции main_template_default
    if ($page_template = mso_get_option('main_template_default', 'templates', '')) {
        if ($fn = mso_fe('main/' . $page_template . '/main.php')) {
            $fn_main = $fn;
            // выставляем путь к файлу
        }
Ejemplo n.º 25
0
function _sql_prev_page()
{
    $CI =& get_instance();
    $CI->db->where('page_date_publish < ', mso_get_val('_sql_next_prev_pages_page_date_publish'));
}
Ejemplo n.º 26
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
# секция HEAD
if ($fn = mso_fe('custom/head-section.php')) {
    require $fn;
} else {
    my_default_head_section();
}
// подключение через функцию
echo '<body' . (mso_get_val('body_class') ? ' class="' . mso_get_val('body_class') . '"' : '') . '>';
mso_hook('body_start');
if (function_exists('ushka')) {
    echo ushka('body_start');
}
if ($fn = mso_fe('custom/body-start.php')) {
    require $fn;
}
if (function_exists('ushka')) {
    echo ushka('header-pre');
}
if ($fn = mso_fe('custom/header-pre.php')) {
    require $fn;
}
# end of file
Ejemplo n.º 27
0
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
# основной файл html-структуры
# секция HEAD
if ($fn = mso_fe('custom/head-section.php')) {
    require $fn;
} else {
    mso_default_head_section();
}
// подключение через функцию
?>

<body class="left-sidebar <?php 
echo mso_get_val('body_class');
?>
">

<!-- end header -->
<?php 
mso_hook('body_start');
if (function_exists('ushka')) {
    echo ushka('body_start');
}
if ($fn = mso_fe('custom/body-start.php')) {
    require $fn;
}
?>

<div class="all"><div class="all-wrap">
Ejemplo n.º 28
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
$par = array('page_id' => mso_get_option('home_page_id', 'templates', '0'), 'cat_id' => mso_get_option('home_cat_id', 'templates', '0'), 'limit' => mso_get_option('home_limit_post', 'templates', '7'), 'cut' => mso_get_option('more', 'templates', tf('Читать полностью »')), 'cat_order' => 'category_id_parent', 'cat_order_asc' => 'asc', 'exclude_page_id' => mso_get_val('exclude_page_id'), 'order' => mso_get_option('home_order', 'templates', 'page_date_publish'), 'order_asc' => mso_get_option('home_order_asc', 'templates', 'desc'));
// подключаем кастомный вывод, где можно изменить массив параметров $par для своих задач
if ($f = mso_page_foreach('home-mso-get-pages')) {
    require $f;
}
$pages = mso_get_pages($par, $pagination);
mso_set_val('container_class', 'mso-type-home mso-home-list');
if (mso_get_option('default_description_home', 'templates', '0')) {
    mso_set_val('list_line_format', '[title] - [date] [meta_description]');
    // заголовок перед списком
    if ($_t = mso_get_val('home_list_header', '<div class="mso-home-header">Последние записи</div>')) {
        echo $_t;
    }
}
if ($fn = mso_find_ts_file('type/_def_out/list/list.php')) {
    require $fn;
}
if ($f = mso_page_foreach('home-do-pagination')) {
    require $f;
}
mso_hook('pagination', $pagination);
# end of file
Ejemplo n.º 29
0
                            echo $p->img($image_for_page, mso_get_option('image_for_page_css_class', 'templates', 'image_for_page'), '', $p->val('page_title'));
                        }
                    }
                }
                $p->content('', '');
                // $p->clearfix();
            }
            // для page возможен свой info-bottom
            if ($f = mso_page_foreach('info-bottom-' . getinfo('type'))) {
                require $f;
            } elseif ($f = mso_page_foreach('info-bottom')) {
                require $f;
            }
            $p->html('<aside>');
            mso_page_content_end();
            $p->clearfix();
            $p->line('[comments]');
            $p->html('</aside>');
            $p->div_end('mso-page-content mso-type-' . getinfo('type') . '-content');
        }
    }
    $p->div_end('mso-page-only', '</article>');
    if ($f = mso_page_foreach(getinfo('type') . '-page-only-end')) {
        require $f;
    }
    $exclude_page_id[] = $p->val('page_id');
}
// end foreach
$p->div_end(mso_get_val('container_class'));
mso_set_val('exclude_page_id', $exclude_page_id);
# end file
Ejemplo n.º 30
0
function last_pages_widget_custom($arg = array(), $num = 1)
{
    if (!isset($arg['count'])) {
        $arg['count'] = 7;
    }
    if (!isset($arg['page_type'])) {
        $arg['page_type'] = 'blog';
    }
    if (!isset($arg['sort'])) {
        $arg['sort'] = 'page_date_publish';
    }
    if (!isset($arg['sort_order'])) {
        $arg['sort_order'] = 'desc';
    }
    if (!isset($arg['date_format'])) {
        $arg['date_format'] = 'd/m/Y';
    }
    if (!isset($arg['format'])) {
        $arg['format'] = '<h4>[TITLE]</h4><p>[DATE] [COMMENTS]</p>[IMG]<p>[TEXT]</p>';
    }
    if (!isset($arg['comments_format'])) {
        $arg['comments_format'] = ' | ' . t('Комментариев: ') . '[COUNT]';
    }
    if (!isset($arg['include_cat'])) {
        $arg['include_cat'] = '';
    }
    if (!isset($arg['img_prev_def'])) {
        $arg['img_prev_def'] = '';
    }
    if (!isset($arg['img_prev_attr'])) {
        $arg['img_prev_attr'] = 'class="b-left w100"';
    }
    if (!isset($arg['max_words'])) {
        $arg['max_words'] = 20;
    }
    if (!isset($arg['text_do'])) {
        $arg['text_do'] = '';
    }
    if (!isset($arg['text_posle'])) {
        $arg['text_posle'] = '';
    }
    if (!isset($arg['header'])) {
        $arg['header'] = mso_get_val('widget_header_start', '<div class="mso-widget-header"><span>') . t('Последние записи') . mso_get_val('widget_header_end', '</span></div>');
    }
    if (!isset($arg['block_start'])) {
        $arg['block_start'] = '';
    }
    if (!isset($arg['block_end'])) {
        $arg['block_end'] = '';
    }
    if ($arg['sort_order'] != 'random') {
        $cache_key = 'last_pages_widget' . serialize($arg) . $num;
        if ($k = mso_get_cache($cache_key)) {
            return $k;
        }
        // да есть в кэше
    }
    $par = array('limit' => $arg['count'], 'cut' => '', 'cat_order' => 'category_name', 'cat_order_asc' => 'asc', 'pagination' => false, 'cat_id' => $arg['include_cat'], 'order' => $arg['sort'], 'order_asc' => $arg['sort_order'], 'type' => $arg['page_type'], 'custom_type' => 'home');
    $pages = mso_get_pages($par, $temp);
    $out = '';
    if ($pages) {
        foreach ($pages as $page) {
            // [TITLE] [DATE] [TEXT] [IMG] [COMMENTS] [URL]
            $title = mso_page_title($page['page_slug'], $page['page_title'], '', '', true, false, 'page');
            $url = getinfo('site_url') . 'page/' . $page['page_slug'];
            $date = mso_page_date($page['page_date_publish'], $arg['date_format'], '', '', false);
            $img = isset($page['page_meta']['image_for_page'][0]) ? $page['page_meta']['image_for_page'][0] : '';
            if (!$img and $arg['img_prev_def']) {
                $img = $arg['img_prev_def'];
            }
            if ($img) {
                $img = '<a href="' . $url . '"><img src="' . $img . '" alt="' . $page['page_title'] . '" ' . $arg['img_prev_attr'] . '></a>';
            }
            if ($page['page_count_comments']) {
                $comments = str_replace('[COUNT]', $page['page_count_comments'], $arg['comments_format']);
            } else {
                $comments = '';
            }
            $text = mso_str_word(strip_tags($page['page_content']), $arg['max_words']) . ' ...';
            $out_page = $arg['format'];
            $out_page = str_replace('[TITLE]', $title, $out_page);
            $out_page = str_replace('[DATE]', $date, $out_page);
            $out_page = str_replace('[COMMENTS]', $comments, $out_page);
            $out_page = str_replace('[URL]', $url, $out_page);
            $out_page = str_replace('[TEXT]', $text, $out_page);
            $out_page = str_replace('[IMG]', $img, $out_page);
            $out .= $out_page;
        }
        $out = $arg['header'] . $arg['block_start'] . $arg['text_do'] . $out . $arg['text_posle'] . $arg['block_end'];
    }
    if ($arg['sort_order'] != 'random') {
        mso_add_cache($cache_key, $out);
    }
    // в кэш
    return $out;
}