コード例 #1
0
ファイル: index.php プロジェクト: Kmartynov/cms
function bbcode_custom($text = '')
{
    $text = preg_replace_callback('~\\[pre(.*?)\\](.*?)\\[\\/pre\\]~si', 'bbcode_pre_callback', $text);
    $preg = array('~\\[b (.*?)\\](.*?)\\[\\/b\\]~si' => '<strong $1>$2</strong>', '~\\[b\\](.*?)\\[\\/b\\]~si' => '<strong>$1</strong>', '~\\[bold (.*?)\\](.*?)\\[\\/bold\\]~si' => '<b $1>$2</b>', '~\\[bold\\](.*?)\\[\\/bold\\]~si' => '<b>$1</b>', '~\\[i (.*?)\\](.*?)\\[\\/i\\]~si' => '<em$1>$2</em>', '~\\[i\\](.*?)\\[\\/i\\]~si' => '<em>$1</em>', '~\\[italic (.*?)\\](.*?)\\[\\/italic\\]~si' => '<i$1>$2</i>', '~\\[italic\\](.*?)\\[\\/italic\\]~si' => '<i>$1</i>', '~\\[del (.*?)\\](.*?)\\[\\/del\\]~si' => '<del $1>$2</del>', '~\\[del\\](.*?)\\[\\/del\\]~si' => '<del>$1</del>', '~\\[s (.*?)\\](.*?)\\[\\/s\\]~si' => '<s $1>$2</s>', '~\\[s\\](.*?)\\[\\/s\\]~si' => '<s>$1</s>', '~\\[u (.*?)\\](.*?)\\[\\/u\\]~si' => '<u $1>$2</u>', '~\\[u\\](.*?)\\[\\/u\\]~si' => '<u>$1</u>', '~\\[sub\\](.*?)\\[\\/sub\\]~si' => '<sub>$1</sub>', '~\\[sup\\](.*?)\\[\\/sup\\]~si' => '<sup>$1</sup>', '~\\[small\\](.*?)\\[\\/small\\]~si' => '<small>$1</small>', '~\\[color=(.*?)\\](.*?)\\[\\/color\\]~si' => '<span style="color:$1">$2</span>', '~\\[size=(.*?)\\](.*?)\\[\\/size\\]~si' => '<span style="font-size:$1">$2</span>', '~\\[div=(.*?)\\](.*?)\\[\\/div\\]~si' => '<div style="$1">$2</div>', '~\\[span=(.*?)\\](.*?)\\[\\/span\\]~si' => '<span style="$1">$2</span>', '~\\[left (.*?)\\](.*?)\\[\\/left\\]~si' => '<div style="text-align: left; $1">$2</div>', '~\\[left\\](.*?)\\[\\/left\\]~si' => '<div style="text-align: left;">$1</div>', '~\\[right (.*?)\\](.*?)\\[\\/right\\]~si' => '<div style="text-align: right; $1">$2</div>', '~\\[right\\](.*?)\\[\\/right\\]~si' => '<div style="text-align: right;">$1</div>', '~\\[center (.*?)\\](.*?)\\[\\/center\\]~si' => '<div style="text-align: center; $1">$2</div>', '~\\[center\\](.*?)\\[\\/center\\]~si' => '<div style="text-align: center;">$1</div>', '~\\[justify (.*?)\\](.*?)\\[\\/justify\\]~si' => '<div style="text-align: justify; $1">$2</div>', '~\\[justify\\](.*?)\\[\\/justify\\]~si' => '<div style="text-align: justify;">$1</div>', '~\\[p\\](.*?)\\[\\/p\\]~si' => '<p>$1</p>', '~\\[p=(.*?)\\](.*?)\\[\\/p\\]~si' => '<p style="$1">$2</p>', '~\\[p (.*?)\\](.*?)\\[\\/p\\]~si' => '<p $1>$2</p>', '~\\[p\\((.*?)\\)\\](.*?)\\[\\/p\\]~si' => '<p class="$1">$2</p>', '~\\[pleft\\](.*?)\\[\\/pleft\\]~si' => '<p style="text-align: left;">$1</p>', '~\\[pright\\](.*?)\\[\\/pright\\]~si' => '<p style="text-align: right;">$1</p>', '~\\[pcenter\\](.*?)\\[\\/pcenter\\]~si' => '<p style="text-align: center;">$1</p>', '~\\[pjustify\\](.*?)\\[\\/pjustify\\]~si' => '<p style="text-align: justify;">$1</p>', '~\\[abbr\\](.*?)\\[\\/abbr\\]~si' => '<abbr>$1</abbr>', '~\\[abbr (.*?)\\](.*?)\\[\\/abbr\\]~si' => '<abbr title="$1">$2</abbr>', '~\\[q\\](.*?)\\[\\/q\\]~si' => '<q>$1</q>', '~\\[q (.*?)\\](.*?)\\[\\/q\\]~si' => '<q $1">$2</q>', '~\\[cite\\](.*?)\\[\\/cite\\]~si' => '<cite>$1</cite>', '~\\[cite (.*?)\\](.*?)\\[\\/cite\\]~si' => '<cite $1">$2</cite>', '~\\[address\\](.*?)\\[\\/address\\]~si' => '<address>$1</address>', '~\\[address (.*?)\\](.*?)\\[\\/address\\]~si' => '<address $1">$2</address>', '~\\[dfn\\](.*?)\\[\\/dfn\\]~si' => '<dfn>$1</dfn>', '~\\[dfn (.*?)\\](.*?)\\[\\/dfn\\]~si' => '<dfn $1">$2</dfn>', '~\\[dl\\](.*?)\\[\\/dl\\]~si' => '<dl>$1</dl>', '~\\[dl (.*?)\\](.*?)\\[\\/dl\\]~si' => '<dl $1">$2</dl>', '~\\[dt\\](.*?)\\[\\/dt\\]~si' => '<dt>$1</dt>', '~\\[dt (.*?)\\](.*?)\\[\\/dt\\]~si' => '<dt $1">$2</dt>', '~\\[dd\\](.*?)\\[\\/dd\\]~si' => '<dd>$1</dd>', '~\\[dd (.*?)\\](.*?)\\[\\/dd\\]~si' => '<dd $1">$2</dd>', '~\\[ins\\](.*?)\\[\\/ins\\]~si' => '<ins>$1</ins>', '~\\[ins (.*?)\\](.*?)\\[\\/ins\\]~si' => '<ins $1">$2</ins>', '~\\[hr\\]~si' => '<hr>', '~\\[line\\]~si' => '<hr>', '~\\[table\\]~si' => '<table>', '~\\[table (.*?)\\]~si' => '<table $1>', '~\\[\\/table\\]~si' => '</table>', '~\\[tr\\]~si' => '<tr>', '~\\[tr (.*?)\\]~si' => '<tr $1>', '~\\[\\/tr\\]~si' => '</tr>', '~\\[td\\]~si' => '<td>', '~\\[td (.*?)\\]~si' => '<td $1>', '~\\[\\/td\\]~si' => '</td>', '~\\[th\\]~si' => '<th>', '~\\[th (.*?)\\]~si' => '<th $1>', '~\\[\\/th\\]~si' => '</th>', '~\\[\\*\\](.*?)\\[\\/\\*\\]~si' => '<li>$1</li>', '~\\[\\*\\]~si' => '<li>', '~\\[ul\\](.*?)\\[\\/ul\\]~si' => "<ul>\$1</li></ul>", '~\\[list\\](.*?)\\[\\/list\\]~si' => "<ul>\$1</li></ul>", '~\\[ol\\](.*?)\\[\\/ol\\]~si' => '<ol>$1</li></ol>', '~\\[li\\]~si' => '<li>', '~\\[li (.*?)\\]~si' => '<li $1>', '~\\[\\/li\\]~si' => '</li>', '~\\[h1\\](.*?)\\[\\/h1\\]~si' => '<h1>$1</h1>', '~\\[h1\\((.[^ ]*?)\\)\\](.*?)\\[\\/h1\\]~si' => '<h1 class="$1">$2</h1>', '~\\[h1 (.*?)\\](.*?)\\[\\/h1\\]~si' => '<h1 $1>$2</h1>', '~\\[h2\\](.*?)\\[\\/h2\\]~si' => '<h2>$1</h2>', '~\\[h2\\((.[^ ]*?)\\)\\](.*?)\\[\\/h2\\]~si' => '<h2 class="$1">$2</h2>', '~\\[h2 (.*?)\\](.*?)\\[\\/h2\\]~si' => '<h2 $1>$2</h2>', '~\\[h3\\](.*?)\\[\\/h3\\]~si' => '<h3>$1</h3>', '~\\[h3\\((.[^ ]*?)\\)\\](.*?)\\[\\/h3\\]~si' => '<h3 class="$1">$2</h3>', '~\\[h3 (.*?)\\](.*?)\\[\\/h3\\]~si' => '<h3 $1>$2</h3>', '~\\[h4\\](.*?)\\[\\/h4\\]~si' => '<h4>$1</h4>', '~\\[h4\\((.[^ ]*?)\\)\\](.*?)\\[\\/h4\\]~si' => '<h4 class="$1">$2</h4>', '~\\[h4 (.*?)\\](.*?)\\[\\/h4\\]~si' => '<h4 $1>$2</h4>', '~\\[h5\\](.*?)\\[\\/h5\\]~si' => '<h5>$1</h5>', '~\\[h5\\((.[^ ]*?)\\)\\](.*?)\\[\\/h5\\]~si' => '<h5 class="$1">$2</h5>', '~\\[h5 (.*?)\\](.*?)\\[\\/h5\\]~si' => '<h5 $1>$2</h5>', '~\\[h6\\](.*?)\\[\\/h6\\]~si' => '<h6>$1</h6>', '~\\[h6\\((.[^ ]*?)\\)\\](.*?)\\[\\/h6\\]~si' => '<h6 class="$1">$2</h6>', '~\\[h6 (.*?)\\](.*?)\\[\\/h6\\]~si' => '<h6 $1>$2</h6>', '~\\[code\\](.*?)\\[\\/code\\]~si' => '<code>$1</code>', '~\\[url\\](.*?)\\[\\/url\\]~si' => '<a href="$1">$1</a>', '~\\[url=(.[^ ]*?)\\](.*?)\\[\\/url\\]~si' => '<a href="$1">$2</a>', '~\\[url=(.[^\\s]*?) (.*?)\\](.*?)\\[\\/url\\]~si' => '<a href="$1" $2>$3</a>', '~\\[url (.*?)\\](.*?)\\[\\/url\\]~si' => '<a href="$2" $1>$2</a>', '~\\[imgleft=(.*?)x(.*?)\\](.*?)\\[\\/imgleft\\]~si' => '<img src="$3" style="float: left; margin: 0 10px 0 0; width: $1px; height: $2px">', '~\\[imgleft\\](.*?)\\[\\/imgleft\\]~si' => '<img src="$1" style="float: left; margin: 0 10px 0 0;">', '~\\[imgleft (.*?)\\](.*?)\\[\\/imgleft\\]~si' => '<img src="$2" title="$1" alt="$1" style="float: left; margin: 0 10px 0 0;">', '~\\[imgright=(.*?)x(.*?)\\](.*?)\\[\\/imgright\\]~si' => '<img src="$3" style="float: right; margin: 0 0 0 10px; width: $1px; height: $2px">', '~\\[imgright\\](.*?)\\[\\/imgright\\]~si' => '<img src="$1" style="float: right; margin: 0 0 0 10px;">', '~\\[imgright (.*?)\\](.*?)\\[\\/imgright\\]~si' => '<img src="$2" title="$1" alt="$1" style="float: right; margin: 0 0 0 10px;">', '~\\[imgcenter\\](.*?)\\[\\/imgcenter\\]~si' => '<div style="text-align: center"><img src="$1"></div>', '~\\[imgcenter (.*?)\\](.*?)\\[\\/imgcenter\\]~si' => '<div style="text-align: center"><img src="$2" title="$1" alt="$1"></div>', '~\\[imgmini=_(.*?)\\](.*?)\\[\\/imgmini\\]~si' => '<a href="$2" target="_blank" class="lightbox"><img src="$1"></a>', '~\\[imgmini=(.*?)\\](.*?)\\[\\/imgmini\\]~si' => '<a href="$2"><img src="$1" class="lightbox"></a>', '~\\[img=(.*?)x(.*?)\\](.*?)\\[\\/img\\]~si' => '<img src="$3" style="width: $1px; height: $2px">', '~\\[img (.*?)\\](.*?)\\[\\/img\\]~si' => '<img src="$2" title="$1" alt="$1">', '~\\[img\\](.*?)\\[\\/img\\]~si' => '<img src="$1" title="" alt="">', '~\\[img\\((.[^ ]*?)\\)\\](.*?)\\[\\/img\\]~si' => '<img src="$2" alt="" class="$1">', '~\\[img\\((.[^ ]*?)\\) (.*?)\\](.*?)\\[\\/img\\]~si' => '<img src="$3" alt="$2" title="$2" class="$1">', '~\\[quote\\](.*?)\\[\\/quote\\]~si' => '<blockquote>$1</blockquote>', '~\\[quote=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\\](.*?)\\[\\/quote\\]~si' => '<blockquote><strong class="src">$1:</strong>$2</blockquote>', '~\\[div\\((.*?)\\)\\](.*?)\\[\\/div\\]~si' => '<div class="$1">$2</div>', '~\\[div (.*?)\\](.*?)\\[\\/div\\]~si' => '<div $1>$2</div>', '~\\[div\\((.*?)\\) (.*?)\\](.*?)\\[\\/div\\]~si' => '<div class="$1" $2>$3</div>', '~\\[span\\((.*?)\\)\\](.*?)\\[\\/span\\]~si' => '<span class="$1">$2</span>', '~\\[span (.*?)\\](.*?)\\[\\/span\\]~si' => '<span $1>$2</span>', '~\\[span\\((.*?)\\) (.*?)\\](.*?)\\[\\/span\\]~si' => '<span class="$1" $2>$3</span>', '~\\[getinfo siteurl\\]~si' => getinfo('siteurl'), '~\\[getinfo template_url\\]~si' => getinfo('template_url'), '~\\[getinfo uploads_url\\]~si' => getinfo('uploads_url'), '~\\[getinfo shared_url\\]~si' => getinfo('shared_url'));
    if (strpos($text, '[text-demo]') !== false) {
        if (file_exists(getinfo('plugins_dir') . 'bbcode/text-demo.txt')) {
            $text_demo = file_get_contents(getinfo('plugins_dir') . 'bbcode/text-demo.txt');
            $text = str_replace('[text-demo]', $text_demo, $text);
        }
    }
    if (strpos($text, '[text-normalize]') !== false) {
        if (file_exists(getinfo('plugins_dir') . 'bbcode/text-normalize.txt')) {
            $text_normalize = file_get_contents(getinfo('plugins_dir') . 'bbcode/text-normalize.txt');
            $text = str_replace('[text-normalize]', $text_normalize, $text);
        }
    }
    $text = preg_replace(array_keys($preg), array_values($preg), $text);
    # другие сложные патерны и замены
    // создание ul/li списка по принципу меню
    $pattern = '~\\[create_list\\((.*?)\\)\\](.*?)\\[/create_list\\]~si';
    // с указаным css-классом
    $text = preg_replace_callback($pattern, 'bbcode_create_list_callback', $text);
    $pattern = '~\\[create_list\\](.*?)\\[/create_list\\]~si';
    // без класса
    $text = preg_replace_callback($pattern, 'bbcode_create_list_callback', $text);
    // [show Вопрос] текст [/show]
    $pattern = '~\\[show (.*?)\\](.*?)\\[\\/show\\]~si';
    $text = preg_replace_callback($pattern, 'bbcode_show_callback', $text);
    // по хуку bbcode можно выполнить свои замены
    $text = mso_hook('bbcode', $text);
    // pr($text, 1);
    return $text;
}
コード例 #2
0
ファイル: index.php プロジェクト: Kmartynov/cms
function cron_custom($args = array())
{
    $options = mso_get_option('plugin_cron', 'plugins', array());
    if (!isset($options['slug'])) {
        $options['slug'] = 'cron';
    }
    if (mso_segment(1) == $options['slug']) {
        mso_hook('cron');
        # это крон, выполняем его хук
        die('Cron done');
        # после крона всегда останавливаем выполнение
    } else {
        return $args;
    }
}
コード例 #3
0
ファイル: index.php プロジェクト: rb2/MaxSite-CMS
function editor_jw($args = array())
{
    global $MSO;
    $editor_config['url'] = $MSO->config['admin_plugins_url'] . 'editor_jw/';
    $editor_config['dir'] = $MSO->config['admin_plugins_dir'] . 'editor_jw/';
    // if (isset($args['content'])) $editor_config['content'] = mso_text_to_html($args['content']);
    if (isset($args['content'])) {
        $editor_config['content'] = $args['content'];
    } else {
        $editor_config['content'] = '';
    }
    if (!$editor_config['content']) {
        $editor_config['content'] = '<br>';
    }
    $editor_config['content'] = mso_hook('editor_content', $editor_config['content']);
    if (isset($args['do'])) {
        $editor_config['do'] = $args['do'];
    } else {
        $editor_config['do'] = '';
    }
    if (isset($args['posle'])) {
        $editor_config['posle'] = $args['posle'];
    } else {
        $editor_config['posle'] = '';
    }
    if (isset($args['action'])) {
        $editor_config['action'] = ' action="' . $args['action'] . '"';
    } else {
        $editor_config['action'] = '';
    }
    if (isset($args['height'])) {
        $editor_config['height'] = (int) $args['action'];
    } else {
        $editor_options = mso_get_option('editor_options', 'admin', array());
        if (isset($editor_options['editor_height'])) {
            $editor_config['height'] = (int) $editor_options['editor_height'];
        } else {
            $editor_config['height'] = 400;
        }
        if ($editor_config['height'] < 100) {
            $editor_config['height'] = 400;
        }
    }
    mso_hook_add('admin_head', 'editor_jw_admin_header');
    require $editor_config['dir'] . 'editor.php';
}
コード例 #4
0
ファイル: index.php プロジェクト: buyvolov/cms
function comment_button_custom($arg = array())
{
    $options = mso_get_option('plugin_comment_button', 'plugins', array());
    if (!isset($options['show_buttons']) or !trim($options['show_buttons'])) {
        $options['show_buttons'] = 'b|i|u|s|blockquote|pre';
    }
    $buttons = array_map('trim', preg_split("/[\\s,\\|]+/", trim($options['show_buttons'])));
    echo '<p class="comment_button">
' . (!in_array('b', $buttons) ? '' : '	<button type="button" class="comment_button_b" title="' . tf('Полужирный') . '" onClick="addText(\'<b>\', \'</b>\') ">B</button>') . '
' . (!in_array('i', $buttons) ? '' : '	<button type="button" class="comment_button_i" title="' . tf('Курсив') . '" onClick="addText(\'<i>\', \'</i>\') ">I</button>') . '
' . (!in_array('u', $buttons) ? '' : '	<button type="button" class="comment_button_u" title="' . tf('Подчеркнутый') . '" onClick="addText(\'<u>\', \'</u>\') ">U</button>') . '
' . (!in_array('s', $buttons) ? '' : '	<button type="button" class="comment_button_s" title="' . tf('Зачеркнутый') . '" onClick="addText(\'<s>\', \'</s>\') ">S</button>') . '
' . (!in_array('blockquote', $buttons) ? '' : '	<button type="button" class="comment_button_blockquote" title="' . tf('Цитата') . '" onClick="addText(\'<blockquote>\', \'</blockquote>\') ">' . t('Цитата') . '</button>') . '
' . (!in_array('pre', $buttons) ? '' : '	<button type="button" class="comment_button_pre" title="' . tf('Код или преформатированный текст') . '" onclick="addText(\'<pre>\', \'</pre>\') ">' . t('Код') . '</button>') . '
' . mso_hook('comment_button_more') . '
	</p>';
}
コード例 #5
0
ファイル: menu.php プロジェクト: rb2/MaxSite-CMS
            $menu .= NR . 'admin/template_options | Настройка шаблона';
            $menu .= NR . 'http://max-3000.com/page/faq | ЧАВО для новичков';
            $menu .= NR . 'http://max-3000.com/help | Центр помощи';
            $menu .= NR . 'http://forum.max-3000.com/ | Форум поддержки';
            $menu .= NR . 'logout | Выход';
            $menu .= NR . ']';
            return $menu;
        }
        mso_hook_add('main_menu_custom', '_my_users_main_menu_custom');
    } elseif (is_login_comuser()) {
        function _my_comusers_main_menu_custom($menu = '')
        {
            $comuser = is_login_comuser();
            $menu .= NR . '[';
            if ($comuser['comusers_nik']) {
                $menu .= NR . '# | ' . $comuser['comusers_nik'];
            } else {
                $menu .= NR . '# | Ваши ссылки';
            }
            $menu .= NR . 'users/' . $comuser['comusers_id'] . ' | Своя страница';
            $menu .= NR . 'http://max-3000.com/page/faq | ЧАВО для новичков';
            $menu .= NR . 'http://max-3000.com/help | Центр помощи';
            $menu .= NR . 'http://forum.max-3000.com/ | Форум поддержки';
            $menu .= NR . 'logout | Выход';
            $menu .= NR . ']';
            return $menu;
        }
        mso_hook_add('main_menu_custom', '_my_comusers_main_menu_custom');
    }
    mso_hook('main_menu');
}
コード例 #6
0
ファイル: index.php プロジェクト: Kmartynov/cms
function range_url_init($arg = array())
{
    global $MSO;
    $options = mso_get_option('plugin_range_url', 'plugins', array());
    // главное зеркало сайта
    if (isset($options['siteurl_enable']) and $options['siteurl_enable'] and isset($options['siteurl']) and $options['siteurl']) {
        if ($MSO->config['site_url'] != $options['siteurl']) {
            mso_redirect($options['siteurl'] . mso_current_url(), true, 301);
        }
    }
    $current_url = mso_current_url();
    // текущий адрес
    if ($current_url === '') {
        return $arg;
    }
    // главная
    // отдельно правило для главной
    // если это home, но без next, то 301-редиректим на главную
    if (mso_segment(1) == 'home' and mso_segment(2) != 'next') {
        mso_redirect('', false, 301);
    }
    if (!isset($options['templates'])) {
        $options['templates'] = '';
    }
    $templates = explode("\n", trim($options['templates']));
    // разобъем по строкам
    if (!isset($options['page_404_redirect'])) {
        $options['page_404_redirect'] = 0;
    }
    if (!isset($options['page_404_header'])) {
        $options['page_404_header'] = 1;
    }
    if (!isset($options['default-templates'])) {
        $options['default-templates'] = true;
    }
    if ($options['default-templates']) {
        // в шаблоны добавим дефолтные адреса
        array_push($templates, '(page_404)', '(contact)', '(logout)', '(login)', '(password-recovery)', '(loginform)', '(loginform)(*)', '(require-maxsite)', '(require-maxsite)(*)', '(ajax)', '(ajax)(*)', '(remote)', '(sitemap)', '(sitemap)(next)(*)', '(sitemap)(cat)', '(sitemap)(cat)(next)(*)', '(home)(next)(*)', '(category)(*)', '(category)(*)(next)(*)', '(page)(*)', '(page)(*)(next)(*)', '(tag)(*)', '(tag)(*)(next)(*)', '(archive)', '(archive)(*)', '(archive)(*)(next)(*)', '(archive)(*)(*)', '(archive)(*)(*)(next)(*)', '(archive)(*)(*)(*)', '(archive)(*)(*)(*)(next)(*)', '(author)(*)', '(author)(*)(next)(*)', '(users)', '(users)(*)', '(users)(*)(edit)', '(users)(*)(lost)', '(search)(*)', '(search)(*)(next)(*)', '(comments)', '(comments)(*)', '(comments)(*)(next)(*)', '(dc)(*)', '(guestbook)', '(guestbook)(next)(*)', '(gallery)', '(gallery)(*)');
    }
    $templates = mso_hook('range_url', $templates);
    // можно добавить свои шаблоны url
    if (!isset($options['min-count-segment'])) {
        $options['min-count-segment'] = 1;
    }
    // минимальное количество сегментов
    $options['min-count-segment'] = (int) $options['min-count-segment'];
    if (count(explode('/', $current_url)) <= $options['min-count-segment']) {
        return $arg;
    }
    // адрес имеет менее N сегментов
    $allow = false;
    // результат
    foreach ($templates as $template) {
        $template = trim($template);
        if (!$template) {
            continue;
        }
        $reg = str_replace('(*)', '(.[^/]*)', $template);
        $reg = '~' . str_replace(')(', '){1}/(', $reg) . '\\z~siu';
        //pr($current_url);
        //pr($reg);
        if (preg_match($reg, $current_url)) {
            $allow = true;
            break;
        }
    }
    // pr($allow);
    if (!$allow) {
        if ($options['page_404_header']) {
            @header('HTTP/1.0 404 Not Found');
        }
        if ($options['page_404_redirect']) {
            mso_redirect('page_404');
        } else {
            $MSO->data['type'] = 'page_404';
        }
    }
    return $arg;
}
コード例 #7
0
ファイル: preview-ajax.php プロジェクト: rb2/MaxSite-CMS
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
if ($post = mso_check_post(array('data'))) {
    $output = $post['data'];
    $output = trim($output);
    $output = str_replace(chr(10), "<br>", $output);
    $output = str_replace(chr(13), "", $output);
    $output = mso_hook('content', $output);
    $output = mso_hook('content_auto_tag', $output);
    $output = mso_hook('content_balance_tags', $output);
    $output = mso_hook('content_out', $output);
    $output = mso_hook('content_content', $output);
    // стили вначале подключаем базу из preview.css
    $css_link = '<link rel="stylesheet" href="' . getinfo('plugins_url') . 'editor_markitup/preview.css" type="text/css" media="screen">';
    // теперь остальные по алгоритму default 2
    $css_link .= NT . '<link rel="stylesheet" href="';
    if (file_exists(getinfo('template_dir') . 'css/css.php')) {
        $css_link .= getinfo('template_url') . 'css/css.php';
    } else {
        if (file_exists(getinfo('template_dir') . 'css/my_style.css')) {
            $css_link .= getinfo('template_url') . 'css/my_style.css';
        } else {
            if (file_exists(getinfo('template_dir') . 'css/style-all-mini.css')) {
                $css_link .= getinfo('template_url') . 'css/style-all-mini.css';
            } elseif (file_exists(getinfo('template_dir') . 'css/style-all.css')) {
                $css_link .= getinfo('template_url') . 'css/style-all.css';
            } else {
                $css_link .= getinfo('templates_url') . 'default/css/style-all-mini.css';
コード例 #8
0
ファイル: index.php プロジェクト: Kmartynov/cms
function random_pages_widget_custom($options = array(), $num = 1)
{
    $out = '';
    if (!isset($options['header'])) {
        $options['header'] = '';
    }
    if (!isset($options['count'])) {
        $options['count'] = 3;
    }
    if (!isset($options['page_type'])) {
        $options['page_type'] = 'blog';
    }
    if (!isset($options['page_content'])) {
        $options['page_content'] = false;
    }
    $CI =& get_instance();
    if (!$options['page_content']) {
        $CI->db->select('page_slug, page_title');
    } else {
        $CI->db->select('page_slug, page_content');
    }
    //$CI->db->where('page_date_publish <', date('Y-m-d H:i:s'));
    $CI->db->where('page_date_publish < ', 'NOW()', false);
    $CI->db->where('page_status', 'publish');
    if ($options['page_type']) {
        $CI->db->where('page_type_name', $options['page_type']);
    }
    $CI->db->join('page_type', 'page_type.page_type_id = page.page_type_id');
    $CI->db->from('page');
    $CI->db->order_by('page_id', 'random');
    $CI->db->limit($options['count']);
    $query = $CI->db->get();
    if ($query->num_rows() > 0) {
        $pages = $query->result_array();
        if (!$options['page_content']) {
            $link = '<a href="' . getinfo('siteurl') . 'page/';
            $out .= '<ul class="mso-widget-list">' . NR;
            foreach ($pages as $page) {
                $out .= '<li>' . $link . $page['page_slug'] . '">' . $page['page_title'] . '</a>' . '</li>' . NR;
            }
            $out .= '</ul>' . NR;
        } else {
            $out .= '<div class="mso-random_pages">' . NR;
            foreach ($pages as $page) {
                $out .= '<div class="mso-random_pages-page">' . mso_hook('content', $page['page_content']) . '</div>' . NR;
            }
            $out .= '</div>' . NR;
        }
        if ($options['header']) {
            $out = $options['header'] . $out;
        }
    }
    return $out;
}
コード例 #9
0
ファイル: _menu.php プロジェクト: Kmartynov/cms
    // $menu .= NR . '---';
    // $menu .= NR . 'http://max-3000.com/page/faq | ЧАВО для новичков';
    // $menu .= NR . 'http://max-3000.com/help | Центр помощи';
    // $menu .= NR . 'http://forum.max-3000.com/ | Форум поддержки';
    if (function_exists('ushka')) {
        $menu .= NR . ushka('main-menu-admin');
    }
    $menu .= NR . '---';
    $menu .= NR . 'logout | Выход | | | i-unlock';
    $menu .= NR . ']';
} elseif (is_login_comuser()) {
    $comuser = is_login_comuser();
    $menu .= NR . '[';
    if ($comuser['comusers_nik']) {
        $menu .= NR . '# | ' . $comuser['comusers_nik'] . ' | Своя страница | | i-user';
    } else {
        $menu .= NR . '# | Ваши ссылки';
    }
    $menu .= NR . 'users/' . $comuser['comusers_id'] . ' | Своя страница';
    $menu .= mso_hook('main_menu_add_comuser');
    $menu .= NR . '---';
    $menu .= NR . 'logout | Выход';
    $menu .= NR . ']';
}
if ($menu) {
    echo mso_menu_build($menu, 'selected', false);
}
?>
	</ul></nav>
</div></div><!-- div.wrap div.MainMenu -->
コード例 #10
0
ファイル: functions-edit.php プロジェクト: LeonisX/cms
function mso_edit_page($data)
{
    global $MSO;
    $CI =& get_instance();
    $data = mso_xss_clean_data($data, array('user_login', 'password', 'page_id_autor', 'page_title', 'page_slug', 'page_password', 'page_date_publish', 'page_type_id', 'page_id_parent', 'page_status'));
    if (isset($data['user_login'])) {
        $user_login = $data['user_login'];
    } else {
        $user_login = $MSO->data['session']['users_login'];
    }
    if (isset($data['password'])) {
        $password = $data['password'];
    } else {
        $password = $MSO->data['session']['users_password'];
    }
    if (!isset($data['page_id_autor'])) {
        $data['page_id_autor'] = $MSO->data['session']['users_id'];
    }
    # проверка доступа этому пользователю с этим паролем и этим разрешением
    if (!mso_check_user_password($user_login, $password, 'admin_page_edit')) {
        return array('result' => 0, 'description' => 'Login/password incorrect');
    }
    # получаем данные пользователя, который отправил запрос
    $user_data = mso_get_user_data($user_login, $password);
    $page_id = (int) $data['page_id'];
    // проверим, чтобы это было число
    $page_id1 = (int) $page_id;
    if ((string) $page_id != (string) $page_id1) {
        $page_id = false;
    }
    // ошибочный id
    if (!$page_id) {
        return array('result' => 0, 'description' => 'Page ID incorrect');
    }
    // есть ли вообще такая страница?
    $CI->db->select('page_id');
    $CI->db->where(array('page_id' => $page_id));
    $query = $CI->db->get('page');
    if ($query->num_rows() == 0) {
        // нет такого
        return array('result' => 0, 'description' => 'Page ID incorrect');
    }
    $page_title = $data['page_title'];
    $page_content = $data['page_content'];
    // короткая ссылка
    $page_slug = isset($data['page_slug']) ? mso_slug($data['page_slug']) : false;
    if (!$page_slug) {
        if ($page_title) {
            $page_slug = mso_slug($page_title);
        } else {
            $page_slug = 'no-title';
        }
        if (!$page_slug) {
            $page_slug = 'no-title';
        }
    }
    // $page_slug нужно проверить на существование
    // если есть, то нужно добавить скажем их кол-во+1
    // при этом исключаем саму редактируемую страницу
    $CI->db->select('page_slug');
    $CI->db->where('page_id != ', $page_id);
    $query = $CI->db->get('page');
    // получили все slug
    if ($query->num_rows() > 0) {
        $all = array();
        // сделаем массив всех слаг
        foreach ($query->result_array() as $row) {
            $all[] = $row['page_slug'];
        }
        $count = 0;
        // начальное приращения слага
        $in = in_array($page_slug, $all);
        // признак вхождения -
        while ($in) {
            $count++;
            $in = in_array($page_slug . '-' . $count, $all);
        }
        if ($count) {
            $page_slug = $page_slug . '-' . $count;
        }
    }
    $page_password = isset($data['page_password']) ? mso_strip($data['page_password']) : '';
    // дата публикации
    $page_date_publish = isset($data['page_date_publish']) ? $data['page_date_publish'] : false;
    # дата последней модификации страницы
    $page_last_modified = date('Y-m-d H:i:s');
    $page_type_id = isset($data['page_type_id']) ? $data['page_type_id'] : '1';
    $page_id_parent = isset($data['page_id_parent']) ? $data['page_id_parent'] : '0';
    $page_status = isset($data['page_status']) ? $data['page_status'] : 'publish';
    if ($page_status != 'publish' and $page_status != 'draft' and $page_status != 'private') {
        $page_status = 'publish';
    }
    // если стоит разрешение admin_page_publish, то статус не меняем
    // иначе ставим только draft
    if (!mso_check_allow('admin_page_publish', $user_data['users_id'])) {
        $page_status = 'draft';
    }
    $page_comment_allow = isset($data['page_comment_allow']) ? (int) $data['page_comment_allow'] : '1';
    $page_ping_allow = isset($data['page_ping_allow']) ? (int) $data['page_ping_allow'] : '1';
    $page_feed_allow = isset($data['page_feed_allow']) ? (int) $data['page_feed_allow'] : '1';
    $page_menu_order = isset($data['page_menu_order']) ? (int) $data['page_menu_order'] : 0;
    $page_id_autor = isset($data['page_id_autor']) ? (int) $data['page_id_autor'] : 0;
    // нужно проверить вообще есть ли такой юзер $page_id_autor
    $CI->db->select('users_id');
    $CI->db->from('users');
    $CI->db->where(array('users_id' => $page_id_autor));
    $query = $CI->db->get();
    if (!$query->num_rows()) {
        // нет
        $page_id_autor = 0;
    }
    if ($page_id_autor != $user_data['users_id']) {
        if (!mso_check_allow('edit_page_author', $user_data['users_id'], false)) {
            $page_id_autor = $user_data['users_id'];
        }
    }
    $ins_data = array('page_type_id' => $page_type_id, 'page_id_parent' => $page_id_parent, 'page_id_autor' => $page_id_autor, 'page_title' => $page_title, 'page_content' => $page_content, 'page_status' => $page_status, 'page_slug' => $page_slug, 'page_password' => $page_password, 'page_comment_allow' => $page_comment_allow, 'page_ping_allow' => $page_ping_allow, 'page_feed_allow' => $page_feed_allow, 'page_last_modified' => $page_last_modified, 'page_menu_order' => $page_menu_order);
    if ($page_date_publish) {
        $ins_data['page_date_publish'] = $page_date_publish;
    }
    $CI->db->where(array('page_id' => $page_id));
    $res = $CI->db->update('page', $ins_data) ? '1' : '0';
    # $CI->db->cache_delete_all();
    if ($res) {
        $id = $page_id;
        // добавим теперь рубрики
        // вначале удалим все записи из рубрик с этим page_id
        $CI->db->where(array('page_id' => $page_id, 'links_id' => '0'));
        // чтобы линки не грохнуть
        $CI->db->delete('cat2obj');
        // рубрики указаны в виде номеров через запятую
        $page_id_cat = isset($data['page_id_cat']) ? $data['page_id_cat'] : '';
        $page_id_cat = mso_explode($page_id_cat);
        // в массив
        foreach ($page_id_cat as $key => $val) {
            $ins_data = array('page_id' => $id, 'category_id' => $val);
            $CI->db->insert('cat2obj', $ins_data);
            # $CI->db->cache_delete_all();
        }
        // $page_tags = метка
        // метки - это мета данные
        // дефолтные данные
        $def_data = array('meta_key' => 'tags', 'meta_id_obj' => $id, 'meta_table' => 'page');
        // вначале грохнем старые, потом добавим новые
        $CI->db->where($def_data);
        $CI->db->delete('meta');
        // получим существующие метки
        $CI->db->select('meta_id');
        $CI->db->where($def_data);
        $query = $CI->db->get('meta');
        if (!$query->num_rows()) {
            // значит инсерт
            $page_tags = isset($data['page_tags']) ? $data['page_tags'] : '';
            $tags = mso_explode($page_tags, false, false);
            // в массив - не только числа
            foreach ($tags as $key => $val) {
                $ins_data = $def_data;
                $ins_data['meta_value'] = $val;
                $CI->db->insert('meta', $ins_data);
                # $CI->db->cache_delete_all();
            }
        }
        // опции - мета
        require_once getinfo('common_dir') . 'meta.php';
        $page_meta_options = isset($data['page_meta_options']) ? $data['page_meta_options'] : '';
        // title##VALUE##титул##METAFIELD##description##VALUE##описание##METAFIELD##keywords##VALUE##ключи##METAFIELD##
        $page_meta_options = explode('##METAFIELD##', $page_meta_options);
        // вначале удалим все мета этой записи
        //$where_in = array(); // здесь meta_key
        //foreach ($page_meta_options as $key=>$val)
        //{
        //	if (trim($val))
        //	{
        //		$meta_temp = explode('##VALUE##', $val);
        //		$where_in[] = trim($meta_temp[0]);
        //	}
        //}
        // вначале грохнем старые, потом добавим новые
        //$CI->db->where( array('meta_id_obj' => $id, 'meta_table' => 'page') );
        //$CI->db->where_in('meta_key', $where_in );
        //$CI->db->delete('meta');
        // теперь тоже самое, только добавляем через insert
        foreach ($page_meta_options as $key => $val) {
            if (trim($val)) {
                $meta_temp = explode('##VALUE##', $val);
                $meta_key = trim($meta_temp[0]);
                $meta_value = trim($meta_temp[1]);
                mso_add_meta($meta_key, $id, 'page', $meta_value);
                //$CI->db->insert('meta', array('meta_key'=>$meta_key, 'meta_value'=>$meta_value,
                //							  'meta_table' => 'page', 'meta_id_obj' => $id) );
            }
        }
        // результат возвращается в виде массива
        $res = array($id, $page_slug, $page_status, $page_password, $page_date_publish);
        $response = array('result' => $res, 'description' => 'Updating page');
        mso_flush_cache();
        // сбросим кэш
    } else {
        $response = array('result' => 0, 'description' => 'Error inserting page');
    }
    if ($response['result']) {
        mso_hook('edit_page', $response['result']);
        mso_hook('edit_page_' . $page_status);
    }
    return $response;
}
コード例 #11
0
ファイル: template.php プロジェクト: Kmartynov/cms
<link rel="stylesheet" href="<?php 
echo $admin_css;
?>
">
<?php 
echo $admin_css_profile;
echo mso_load_jquery();
mso_hook('admin_head');
mso_hook('admin_head_css');
?>
</head>
<body class="admin-<?php 
echo mso_segment(2);
?>
"><?php 
mso_hook('admin_body_start');
?>

<div class="visible-tablet-phone">
	<div class="flex flex-wrap-phone flex-vcenter pad10-rl my-nav-panel-tablet">
		<div class="flex-grow0 pad5-t">
			<a href="http://max-3000.com/"><img src="<?php 
echo $admin_template_url . 'assets/images/maxsitelogo.fw.png';
?>
" alt="" title="MaxSite CMS" class="mar10-b mar10-r"></a>
			<a href="<?php 
echo getinfo('site_url');
?>
" class="my-q-site" title="<?php 
echo t('Переход к сайту');
?>
コード例 #12
0
ファイル: index.php プロジェクト: LeonisX/cms
function xml_sitemap_custom($args = array())
{
    /* Настройки по-умолчанию */
    $options = mso_get_option('plugin_xml_sitemap', 'plugins', array());
    if (!isset($options['page_hide'])) {
        $options['page_hide'] = '';
    }
    $options['page_hide'] = mso_explode($options['page_hide']);
    if (!isset($options['page_cats_hide'])) {
        $options['page_cats_hide'] = '';
    }
    $options['page_cats_hide'] = mso_explode($options['page_cats_hide']);
    if (!isset($options['categories_show'])) {
        $options['categories_show'] = '';
    }
    $options['categories_show'] = mso_explode($options['categories_show']);
    if (!isset($options['tags_show'])) {
        $options['tags_show'] = true;
    }
    if (!isset($options['comusers_show'])) {
        $options['comusers_show'] = true;
    }
    if (!isset($options['users_show'])) {
        $options['users_show'] = true;
    }
    if (!isset($options['freq_priority'])) {
        $options['freq_priority'] = 'home | daily | 1 ' . NR . 'notblog | monthly | 0.7 ' . NR . 'blog | weekly | 0.5 ' . NR . 'category | weekly | 0.3 ' . NR . 'tag | weekly | 0.3 ' . NR . 'comuser | weekly | 0.3 ' . NR . 'user | weekly | 0.3 ';
    }
    $fp = explode(NR, trim($options['freq_priority']));
    $options['freq_priority'] = array();
    foreach ($fp as $ln) {
        $params = array_map('trim', explode('|', trim($ln)));
        $options['freq_priority'][$params[0]] = array('changefreq' => $params[1], 'priority' => $params[2]);
    }
    // создание sitemap.xml
    // $t = "\t"; // табулятор для отступа
    $t = '';
    // отступ для красоты
    $CI =& get_instance();
    $CI->load->helper('file');
    // хелпер для работы с файлами
    // временная зона сайта в формат +03:00 из 3.00
    $time_zone = getinfo('time_zone');
    // 3.00 -11.00;
    $znak = (int) $time_zone >= 0 ? '+' : '-';
    $time_zone = abs($time_zone);
    if ($time_zone == 0) {
        $time_zone = '0.0';
    }
    $time_zone = trim(str_replace('.', ' ', $time_zone));
    $time_z = explode(' ', $time_zone);
    if (!isset($time_z[0])) {
        $time_z[0] = '0';
    }
    if (!isset($time_z[1])) {
        $time_z[1] = '0';
    }
    if ($time_z[0] < 10) {
        $time_z[0] = '0' . $time_z[0];
    }
    if ($time_z[1] < 10) {
        $time_z[1] = '0' . $time_z[1];
    }
    $time_zone = $znak . $time_z[0] . ':' . $time_z[1];
    $url = getinfo('siteurl');
    $out = '<' . '?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>' . $url . '</loc>
<lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . $time_zone . '</lastmod>
<changefreq>' . $options['freq_priority']['home']['changefreq'] . '</changefreq>
<priority>' . $options['freq_priority']['home']['priority'] . '</priority>
</url>
';
    // временная зона для запросов с page_date_publish
    $tz = getinfo('time_zone');
    if ($tz < 10 and $tz > 0) {
        $tz = '0' . $tz;
    } elseif ($tz > -10 and $tz < 0) {
        $tz = '0' . $time_zone;
        $tz = str_replace('0-', '-0', $time_zone);
    } else {
        $tz = '00.00';
    }
    $tz = str_replace('.', ':', $tz);
    // страницы не blog
    $CI->db->select('page.page_id, page_slug, page_date_publish');
    if (count($options['page_cats_hide']) > 0) {
        $CI->db->join('cat2obj', 'cat2obj.page_id = page.page_id', 'left');
        $CI->db->where_not_in('category_id', $options['page_cats_hide']);
    }
    if (count($options['page_hide']) > 0) {
        $CI->db->where_not_in('page.page_id', $options['page_hide']);
    }
    $CI->db->where('page_type_name !=', 'blog');
    $CI->db->where('page_status', 'publish');
    $CI->db->where('page_date_publish < ', 'DATE_ADD(NOW(), INTERVAL "' . $tz . '" HOUR_MINUTE)', false);
    //$CI->db->where('page_date_publish <', mso_date_convert('Y-m-d H:i:s', date('Y-m-d H:i:s')));
    $CI->db->join('page_type', 'page_type.page_type_id = page.page_type_id', 'left');
    $CI->db->order_by('page_date_publish', 'desc');
    $CI->db->group_by('page.page_id');
    $query = $CI->db->get('page');
    if ($query->num_rows() > 0) {
        foreach ($query->result_array() as $row) {
            $date = str_replace(' ', 'T', $row['page_date_publish']) . $time_zone;
            $out .= $t . '<url>' . NR;
            $out .= $t . $t . '<loc>' . $url . 'page/' . $row['page_slug'] . '</loc>' . NR;
            $out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
            $out .= $t . $t . '<changefreq>' . $options['freq_priority']['notblog']['changefreq'] . '</changefreq>' . NR;
            $out .= $t . $t . '<priority>' . $options['freq_priority']['notblog']['priority'] . '</priority>' . NR;
            $out .= $t . '</url>' . NR;
        }
    }
    // страницы
    $CI->db->select('page.page_id, page_slug, page_date_publish');
    if (count($options['page_cats_hide']) > 0) {
        $CI->db->join('cat2obj', 'cat2obj.page_id = page.page_id', 'left');
        $CI->db->where_not_in('category_id', $options['page_cats_hide']);
    }
    if (count($options['page_hide']) > 0) {
        $CI->db->where_not_in('page.page_id', $options['page_hide']);
    }
    $CI->db->where('page_type_name', 'blog');
    $CI->db->where('page_status', 'publish');
    $CI->db->where('page_date_publish < ', 'DATE_ADD(NOW(), INTERVAL "' . $tz . '" HOUR_MINUTE)', false);
    $CI->db->join('page_type', 'page_type.page_type_id = page.page_type_id', 'left');
    $CI->db->group_by('page.page_id');
    $CI->db->order_by('page_date_publish', 'desc');
    $query = $CI->db->get('page');
    if ($query->num_rows() > 0) {
        foreach ($query->result_array() as $row) {
            $date = str_replace(' ', 'T', $row['page_date_publish']) . $time_zone;
            $out .= $t . '<url>' . NR;
            $out .= $t . $t . '<loc>' . $url . 'page/' . $row['page_slug'] . '</loc>' . NR;
            $out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
            $out .= $t . $t . '<changefreq>' . $options['freq_priority']['blog']['changefreq'] . '</changefreq>' . NR;
            $out .= $t . $t . '<priority>' . $options['freq_priority']['blog']['priority'] . '</priority>' . NR;
            $out .= $t . '</url>' . NR;
        }
    }
    // рубрики
    if (count($options['categories_show']) > 0) {
        $CI->db->or_where_in('category_id', $options['categories_show']);
    }
    $CI->db->where('category_type', 'page');
    $query = $CI->db->get('category');
    if ($query->num_rows() > 0) {
        $date = date('Y-m-d') . 'T' . date('H:i:s') . $time_zone;
        foreach ($query->result_array() as $row) {
            // $date = str_replace(' ', 'T', date('Y-m-d')) . $time_zone;
            $out .= $t . '<url>' . NR;
            $out .= $t . $t . '<loc>' . $url . 'category/' . $row['category_slug'] . '</loc>' . NR;
            $out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
            $out .= $t . $t . '<changefreq>' . $options['freq_priority']['category']['changefreq'] . '</changefreq>' . NR;
            $out .= $t . $t . '<priority>' . $options['freq_priority']['category']['priority'] . '</priority>' . NR;
            $out .= $t . '</url>' . NR;
        }
    }
    // все метки
    if ($options['tags_show']) {
        require_once getinfo('common_dir') . 'meta.php';
        $alltags = mso_get_all_tags_page();
        foreach ($alltags as $tag => $count) {
            $out .= $t . '<url>' . NR;
            $out .= $t . $t . '<loc>' . $url . 'tag/' . htmlentities(urlencode($tag)) . '</loc>' . NR;
            $out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
            $out .= $t . $t . '<changefreq>' . $options['freq_priority']['tag']['changefreq'] . '</changefreq>' . NR;
            $out .= $t . $t . '<priority>' . $options['freq_priority']['tag']['priority'] . '</priority>' . NR;
            $out .= $t . '</url>' . NR;
        }
    }
    // и все комюзеры
    if ($options['comusers_show']) {
        $CI->db->select('comusers_id');
        $query = $CI->db->get('comusers');
        if ($query->num_rows() > 0) {
            foreach ($query->result_array() as $row) {
                $out .= $t . '<url>' . NR;
                $out .= $t . $t . '<loc>' . $url . 'users/' . $row['comusers_id'] . '</loc>' . NR;
                $out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
                $out .= $t . $t . '<changefreq>' . $options['freq_priority']['comuser']['changefreq'] . '</changefreq>' . NR;
                $out .= $t . $t . '<priority>' . $options['freq_priority']['comuser']['priority'] . '</priority>' . NR;
                $out .= $t . '</url>' . NR;
            }
        }
    }
    // и все юзеры
    if ($options['users_show']) {
        $CI->db->select('users_id');
        $query = $CI->db->get('users');
        if ($query->num_rows() > 0) {
            foreach ($query->result_array() as $row) {
                $out .= $t . '<url>' . NR;
                $out .= $t . $t . '<loc>' . $url . 'author/' . $row['users_id'] . '</loc>' . NR;
                $out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
                $out .= $t . $t . '<changefreq>' . $options['freq_priority']['user']['changefreq'] . '</changefreq>' . NR;
                $out .= $t . $t . '<priority>' . $options['freq_priority']['user']['priority'] . '</priority>' . NR;
                $out .= $t . '</url>' . NR;
            }
        }
    }
    $out .= mso_hook('xml_sitemap');
    # хук, если нужно добавить свои данные
    $out .= NR . '</urlset>' . NR;
    $fn = getinfo('FCPATH') . 'sitemap.xml';
    write_file($fn, $out);
    return $args;
    // для обеспечения цепочки хуков
}
コード例 #13
0
ファイル: index.php プロジェクト: Kmartynov/cms
function multipage_pagination()
{
    if (!is_type('page')) {
        return true;
    }
    global $multipage_pagination;
    if (isset($multipage_pagination)) {
        $options = mso_get_option('plugin_multipage', 'plugins', array());
        if (isset($options['before_pag'])) {
            echo $options['before_pag'];
        }
        mso_hook('pagination', $multipage_pagination);
        if (isset($options['after_pag'])) {
            echo $options['after_pag'];
        }
    }
}
コード例 #14
0
ファイル: main.php プロジェクト: rb2/MaxSite-CMS
    }
    if ($fn = get_component_fn('default_footer_component5')) {
        require $fn;
    }
}
if (function_exists('ushka')) {
    echo ushka('footer-end');
}
if (file_exists(getinfo('template_dir') . 'custom/footer-end.php')) {
    require getinfo('template_dir') . 'custom/footer-end.php';
}
?>
			</div><!-- div class="footer-wrap" -->
		</div><!-- div class="footer" -->
	</div><!-- div class="all-wrap" -->
</div><!-- div class="all" -->

<?php 
if (file_exists(getinfo('template_dir') . 'custom/body-end.php')) {
    require getinfo('template_dir') . 'custom/body-end.php';
}
?>
			
<?php 
if (function_exists('ushka')) {
    echo ushka('google_analytics');
    echo ushka('body_end');
}
mso_hook('body_end');
?>
</body></html>
コード例 #15
0
ファイル: template.php プロジェクト: rb2/MaxSite-CMS
			<style type="text/css">
				html .ddsmoothmenu{height: 1%;} /*Holly Hack for IE7 and below*/
			</style>
		<![endif]-->
		<?php 
echo mso_load_jquery();
?>
		<?php 
echo mso_load_jquery('ddsmoothmenu.js');
?>
		<script type="text/javascript" src="<?php 
echo $admin_scripts;
?>
"></script>
		<?php 
mso_hook('admin_head');
?>
	</head>
	<body>
		<div id="container">
			<div class="admin-header">
				
				<div class="navline">
					<h1><a href="<?php 
echo getinfo('siteurl');
?>
"><?php 
echo mso_get_option('name_site', 'general');
?>
</a> &#8594; <?php 
echo $admin_header;
コード例 #16
0
ファイル: common.php プロジェクト: rettebinu/cms
function mso_find_ts_file($fn, $default = false)
{
    $fn1 = getinfo('template_dir') . $fn;
    // путь в шаблоне
    $fn2 = getinfo('shared_dir') . $fn;
    // путь в shared
    // если указан хук custom_ts_file, то вначале его обрабатываем
    // хук должен вернуть иполное имя файла
    if (mso_hook_present('custom_ts_file') and $fn3 = mso_hook('custom_ts_file', $fn) and file_exists($fn3)) {
        return $fn3;
    } elseif (file_exists($fn1)) {
        return $fn1;
    } elseif (file_exists($fn2)) {
        return $fn2;
    } else {
        return $default;
    }
}
コード例 #17
0
ファイル: page.php プロジェクト: buyvolov/cms
function mso_page_content_end()
{
    mso_hook('content_end');
    # хук на конец блока
}
コード例 #18
0
ファイル: category.php プロジェクト: nicothin/nicothin_ru
    // сделаем запрос за записями этой рубрики
    $par = array('type' => false, 'cat_id' => $cat_id, 'limit' => mso_get_option('limit_post', 'templates', '10'), 'cut' => mso_get_option('more', 'templates', 'Читать полностью »'), 'type' => false, 'content' => false, 'get_page_count_comments' => false);
    $pages = mso_get_pages($par, $pagination);
    // pr($pages);
    // определим метаданные
    mso_head_meta('title', $cat_name . ' - ' . getinfo('name_site'));
    mso_head_meta('description', $cat_descr);
    mso_head_meta('keywords', $cat_descr);
    $admin_link = '';
    if (is_login()) {
        $admin_link = ' <a href="' . getinfo('siteurl') . 'admin/page_edit/' . $page['page_id'] . '">Редактировать</a>';
    }
    // переменные, которые проверяются в шапке
    $header_title = $cat_name;
    $header_subtitle = $cat_descr;
    $breadcrumbs = '<a href="' . getinfo('siteurl') . '">' . getinfo('name_site') . '</a> → <a href="' . getinfo('siteurl') . 'category/' . $cat_url . '">' . $cat_name . '</a>';
    // подключим шапку
    require_once getinfo('template_dir') . 'page_header.php';
    echo '<div class="posts" role="main">';
    // pr($pages);
    // подключим выводящий файл
    require_once getinfo('template_dir') . 'type/echo_page.php';
    // место для пагинации
    mso_hook('pagination', $pagination);
    echo '</div>';
    // подключим подвал
    require_once getinfo('template_dir') . 'page_footer.php';
} else {
    require_once getinfo('template_dir') . 'type/404.php';
}
# end file
コード例 #19
0
ファイル: editor.php プロジェクト: Kmartynov/cms
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
# опции редактора в виде массива
$_options = array('tags_sort' => array('type' => 'select', 'values' => t('0||По количеству записей (обратно) # 1||По количеству записей # 2||По алфавиту # 3||По алфавиту (обратно)'), 'name' => t('Сортировка меток'), 'description' => t('Используется для отображения облака меток'), 'default' => '0'), 'tags_count' => array('type' => 'text', 'name' => t('Количество меток'), 'description' => t('Используется для отображения облака меток'), 'default' => '20'), 'comment_allow_checked' => array('type' => 'select', 'values' => '1||Отмечать # 0||Не отмечать', 'name' => t('Разрешить комментирование'), 'description' => t('Отмечать опцию «Разрешить комментирование» по-умолчанию'), 'default' => '1'), 'feed_allow_checked' => array('type' => 'select', 'values' => '1||Отмечать # 0||Не отмечать', 'name' => t('Разрешить публикацию RSS'), 'description' => t('Отмечать опцию «Публикация в RSS» по-умолчанию'), 'default' => '1'), 'editor_height' => array('type' => 'text', 'name' => t('Высота текстового редактора'), 'description' => t('Укажите высоту редактора в пикселах. Значение по-умолчанияю 400'), 'default' => '400'), 'cat_height' => array('type' => 'text', 'name' => t('Высота блока рубрик'), 'description' => t('Укажите максимальную высоту блока рубрик в пикселах. При превышении этого значения, появятся полосы скроллинга. Если указать 0, то высота не ограничивается. Значение по-умолчанияю - 0.'), 'default' => '0'), 'preview' => array('type' => 'checkbox', 'name' => t('Предварительный просмотр записи разместить под текстовым редактором'), 'description' => 'Иначе просмотр будет выведен в новом окне браузера', 'default' => '0'), 'previewautorefresh' => array('type' => 'checkbox', 'name' => t('Автоматическое обновление предпросмотра записи'), 'description' => t('Обновление произойдет при нажатии Enter'), 'default' => '0'), 'temp' => array('type' => 'info', 'title' => t('Отображение блоков', 'plugins')), 'page_status' => array('type' => 'checkbox', 'name' => t('Отображать блок статуса страницы'), 'description' => '', 'default' => '1'), 'page_files' => array('type' => 'checkbox', 'name' => 'Отображать ссылку на Загрузки', 'description' => '', 'default' => '1'), 'page_all_parent' => array('type' => 'checkbox', 'name' => 'Отображать блок родительской страницы', 'description' => '', 'default' => '1'));
# если нужно подключить свои опции используйте хук editor_options
$_options = mso_hook('editor_options', $_options);
# отображение опций
mso_admin_plugin_options('editor_options', 'admin', $_options, t('Настройки редактора'), t('Выберите нужные опции редактора'), false, false);
コード例 #20
0
ファイル: template.php プロジェクト: buyvolov/cms
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>';
}
コード例 #21
0
ファイル: admin.php プロジェクト: rettebinu/cms
        echo '<h2 class="bor-solid-b bor-gray400 mar20-b mar20-t i-rss">' . t('Новости MaxSite CMS') . '</h2>';
        foreach ($rss as $item) {
            // title link category description date_timestamp pubdate
            // if (!isset($item['category'])) $item['category'] = '-';
            echo '<h5><a href="' . $item['link'] . '">' . $item['title'] . '</a> - ' . date('d.m.Y', $item['date_timestamp']) . '</h5>';
            echo '<p>' . $item['description'] . '</p>';
            echo '<hr class="dotted mar0-t">';
        }
    }
}
if (mso_check_allow('admin_home')) {
    $show_clear_cache = true;
    if ($post = mso_check_post(array('f_session_id', 'f_submit_clear_cache'))) {
        mso_checkreferer();
        $show_clear_cache = false;
        mso_flush_cache();
        // сбросим кэш
        // echo '<p>' . t('Кэш удален') . '</p><br>';
        mso_redirect('admin/home');
    }
    if ($show_clear_cache) {
        echo '<form method="post">' . mso_form_session('f_session_id');
        if ($show_clear_cache) {
            echo '<p><button type="submit" name="f_submit_clear_cache" class="button i-stack-overflow">' . t('Сбросить кэш системы') . '</button></p>';
        }
        echo '</form>';
    }
}
//if (mso_check_allow('admin_home'))
mso_hook('admin_home');
# end of file
コード例 #22
0
ファイル: sitemap.php プロジェクト: Kmartynov/cms
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
if ($fn = mso_find_ts_file('main/main-start.php')) {
    require $fn;
}
echo '<div class="mso-type-sitemap"><div class="mso-page-only">';
echo '<header><h1 class="mso-type-sitemap">' . tf('Карта сайта (архив)') . '</h1></header>';
echo '<div class="mso-page-content mso-type-sitemap-content">';
if ($f = mso_page_foreach('sitemap')) {
    require $f;
} else {
    if (function_exists('sitemap')) {
        echo sitemap();
    } else {
        echo mso_hook('sitemap');
    }
}
echo '</div></div></div><!-- mso-page-content mso-type-sitemap-content mso-page-only mso-type-sitemap -->';
if ($f = mso_page_foreach('sitemap-posle')) {
    require $f;
}
if ($fn = mso_find_ts_file('main/main-end.php')) {
    require $fn;
}
# end file
コード例 #23
0
ファイル: form.php プロジェクト: Kmartynov/cms
									<td><strong>' . t('Родительская страница') . '</strong></td>
									<td>' . $all_pages . '</td>
								</tr>
								<tr>
									<td><strong>' . t('Дата публикации') . '</strong></td>
									<td><input name="f_date_change" id="f_date_change" type="checkbox" ' . $f_date_change . '> ' . t('Изменить дату') . '
									
									<a href="#" style="font-size: 1.5em; text-decoration: none;" id="set_current_time" title="' . t('Установить текущее время компьютера') . '">&#9685;</a>
									
									<br>' . $date_y . ' ' . $date_m . ' ' . $date_d . '
										&nbsp;&nbsp; — &nbsp;&nbsp;' . $time_h . ' : ' . $time_m . ' : ' . $time_s . '
										<br><em>' . $date_time . '</em></td>
								</tr>
								</tbody>
								</table>
								' . mso_hook('admin_page_form_add_block_2') . '
							
							</div><!-- /div.mso-tabs-box.tabs-other -->
							
							<div class="mso-tabs-box all-files">' . $all_files . '</div>
							
						</div>
					
					
				</div>
			</div>
			
			<button type="submit" name="' . $name_submit . '" class="i save">' . t('Сохранить') . '</button>
	
	</div><!-- /div.new_or_edit -->
	';
コード例 #24
0
ファイル: common.php プロジェクト: Kmartynov/cms
function mso_admin_content()
{
    global $MSO;
    $out = mso_hook('admin_content_do');
    if (count($MSO->data['uri_segment']) > 1) {
        $url = $MSO->data['uri_segment'][2];
        if (mso_hook_present('admin_url_' . $url)) {
            $out = mso_hook('admin_url_' . $url, $out);
        } else {
            $out = mso_hook('admin_content_default', $out);
        }
    } else {
        $out = mso_hook('admin_content_default', $out);
    }
    $out = mso_hook('admin_content', $out);
    return $out;
}
コード例 #25
0
ファイル: author.php プロジェクト: rb2/MaxSite-CMS
                mso_page_content($page_content);
                if ($f = mso_page_foreach('info-bottom')) {
                    require $f;
                }
                // подключаем кастомный вывод
                mso_page_content_end();
                echo '<div class="break"></div>';
                mso_page_comments_link(array('page_comment_allow' => $page_comment_allow, 'page_slug' => $page_slug, 'title' => tf('Обсудить') . ' (' . $page_count_comments . ')', 'title_no_link' => tf('Читать комментарии') . ' (' . $page_count_comments . ')', 'do' => '<div class="comments-link"><span>', 'posle' => '</span></div>', 'page_count_comments' => $page_count_comments));
                echo '</div>';
            }
            echo NR . '</div></div><!--div class="page_only"-->' . NR;
        }
    }
    if (!$full_posts) {
        echo '</ul>';
    }
    mso_hook('pagination', $pagination);
} 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
echo NR . '</div><!-- class="type type_author" -->' . NR;
# конечная часть шаблона
require getinfo('template_dir') . 'main-end.php';
コード例 #26
0
ファイル: ratings-post-ajax.php プロジェクト: Kmartynov/cms
        // запишем значение в БД - нужно взять текущее
        // и вычислить среднюю на основе page_rating и page_rating_count
        $CI =& get_instance();
        $CI->db->select('page_rating, page_rating_count, page_slug');
        $CI->db->where('page_id', $slug);
        $CI->db->limit(1);
        $query = $CI->db->get('page');
        if ($query->num_rows() > 0) {
            $row = $query->row();
            $page_rating = $row->page_rating;
            // текущая оценка
            $page_rating_count = $row->page_rating_count;
            // колличество проголосовавших
            // средняя оценка вычисляется как $page_rating деленное на $page_rating_count
            // но в $page_rating хранится сумма всех оценок!
            $page_rating = $page_rating + $rating;
            $page_rating_count++;
            $CI->db->where('page_id', $slug);
            $CI->db->update('page', array('page_rating' => $page_rating, 'page_rating_count' => $page_rating_count));
            # $CI->db->cache_delete_all();
            $CI->db->cache_delete('page', $row->page_slug);
            $CI->db->cache_delete('ajax', base64_encode('plugins/rater/ratings-post.php'));
            // обнуление рейтинга всех записей
            // $CI->db->update('page', array('page_rating'=>0, 'page_rating_count'=>0) );
            $sredn = round($page_rating / $page_rating_count);
            echo '<span>' . t('Ваша оценка:') . '</span> ' . $rating . '<br><span>' . t('Средняя оценка') . '</span>: ' . $sredn . ' ' . t('из') . ' ' . $page_rating_count . ' ' . t('проголосовавших');
            mso_hook('global_cache_all_flush');
            // сбрасываем весь html-кэш
        }
    }
}
コード例 #27
0
ファイル: bb.js.php プロジェクト: rb2/MaxSite-CMS
?>
', className:'preview', call:'preview', key:"E"},
		{name:'<?php 
echo t('Полноэкранный режим редактора (F2)');
?>
', className:'fullscreen', beforeInsert:function(){shsh();} },

		{separator:'---------------' },

		{name:'<?php 
echo t('Помощь по BB-кодам');
?>
', className:'help', beforeInsert:function(){miu.help_bb();} },

		<?php 
mso_hook('editor_markitup_bbcode');
?>

	]
}

miu = {
	save: function(markItUp) 
	{
		data = markItUp.textarea.value;
		$.post(autosaveurl, {"text": data, "id": autosaveid}, 
			function(response) 
			{
				var dd = new Date();
				$('span.autosave-editor').html('<a target="_blank" href="' + response + '"><?php 
echo t('Сохранено в');
コード例 #28
0
ファイル: new.php プロジェクト: Kmartynov/cms
            }
            $all_pages .= NR . '<option ' . $sel . 'value="' . $row['page_id'] . '">' . $row['page_id'] . ' - ' . htmlspecialchars($row['page_title']) . '</option>';
        }
    }
}
$all_pages .= NR . '</select>' . NR;
# мета большие,вынесена в отдельный файл
# из неё получается $all_meta = '<p>Нет</p>';
require $MSO->config['admin_plugins_dir'] . 'admin_page/all_meta.php';
# закладка файлы вынесена отдельно
# её результат — переменная $all_files
require $MSO->config['admin_plugins_dir'] . 'admin_page/all-files.php';
$f_status_draft = $f_status_private = '';
$f_status_publish = 'checked';
$f_return = '<input name="f_return" type="checkbox" title="' . t('После сохранения вернуться к редактированию') . '">';
// checked="checked"
// быстрое сохранение только в режиме редактирования
$f_bsave = '';
# форма вынесена в отдельный файл, поскольку она одна и таже для new и edit
# из неё получается $do и $posle
require $MSO->config['admin_plugins_dir'] . 'admin_page/form.php';
$ad_config = array('action' => '', 'content' => $f_content, 'do' => $do, 'posle' => $posle);
# отображаем редактор
# есть ли хук на редактор: если да, то получаем эту функцию
# если нет, то отображаем стандартный editor_jw
if (mso_hook_present('editor_custom')) {
    mso_hook('editor_custom', $ad_config);
} else {
    editor_markitup($ad_config);
}
# end file
コード例 #29
0
require_once getinfo('common_dir') . 'page.php';
// функции страниц
require_once getinfo('common_dir') . 'category.php';
// функции рубрик
# если нужен RSS
//  if ( mso_segment(1) == 'feed' ) {
//    require_once(getinfo('template_dir') . 'type/rss_home.php');
//    exit();
//  }
// получим GET
// $get = mso_parse_url_get(mso_url_get());
// pr($get['lang']);
// для rss
if (is_feed()) {
    require_once getinfo('template_dir') . 'type/rss.php';
    exit;
    // выходим
}
// подключения типов страниц
if (is_type('home')) {
    require_once getinfo('template_dir') . 'type/home.php';
} elseif (is_type('category')) {
    require_once getinfo('template_dir') . 'type/category.php';
} elseif (is_type('page')) {
    require_once getinfo('template_dir') . 'type/page.php';
} else {
    require_once getinfo('template_dir') . 'type/404.php';
}
# хук глобального кэша
mso_hook('global_cache_end');
# end file
コード例 #30
0
ファイル: common.php プロジェクト: Kmartynov/cms
function mso_dispatcher()
{
    # тип данных
    $type = getinfo('type');
    # для rss используются отдельное подключение
    if (is_feed()) {
        // ищем файл в шаблоне или shared
        if ($f = mso_find_ts_file('type/feed/' . $type . '.php')) {
            return $f;
        } else {
            return mso_find_ts_file('type/feed/home.php');
        }
    }
    # в зависимости от типа данных подключаем нужный файл
    # на page_404 может быть свой хук. Тогда ничего не подключаем
    if ($type == 'page_404' and mso_hook_present('custom_page_404') and mso_hook('custom_page_404')) {
        return false;
    } elseif ($type == 'page_404') {
        $seg = mso_strip(mso_segment(1));
        $fn = 'type/' . $seg . '/' . $seg . '.php';
    } else {
        $fn = 'type/' . $type . '/' . $type . '.php';
    }
    if ($f = mso_find_ts_file($fn)) {
        return $f;
    } else {
        return mso_find_ts_file('type/page_404/page_404.php');
    }
}