Example #1
0
function applet_robots()
{
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/robots', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['ROBOTS_TITLE']);
    cpAddPathway($_LANG['ROBOTS_TITLE']);
    $do = cmsCore::request('do', array('edit', 'save'), 'edit');
    if (!file_exists(PATH . '/robots.txt')) {
        $fp = fopen(PATH . '/robots.txt', 'w');
        fwrite($fp, str_replace(array('%domen%', '%host%'), array(str_replace(array('https://', 'http://'), '', cmsCore::c('config')->host), cmsCore::c('config')->host), file_get_contents(PATH . '/includes/default_robots.txt')));
        fclose($fp);
        chmod(PATH . '/robots.txt', 0777);
    }
    if ($do == 'save') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $data = cmsCore::request('robots', 'str');
        $fp = fopen(PATH . '/robots.txt', 'w');
        fwrite($fp, stripcslashes($data) . "\n");
        fclose($fp);
    }
    $robots = file_get_contents(PATH . '/robots.txt');
    cmsCore::c('page')->initTemplate('applets', 'robots')->assign('robots', $robots)->display();
}
Example #2
0
function f_pages(&$text)
{
    if (mb_strpos($text, 'pagebreak') === false) {
        return true;
    }
    $seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    $seolink = preg_replace('/[^a-zа-я-яёіїєґА-ЯЁІЇЄҐ0-9_\\/\\-]/ui', '', $seolink);
    if (!$seolink) {
        return true;
    }
    $regex = '/{(pagebreak)\\s*(.*?)}/iu';
    $pages = preg_split($regex, $text);
    $n = count($pages);
    if ($n <= 1) {
        return true;
    } else {
        $page = cmsCore::request('page', 'int', 1);
        $text = $pages[$page - 1];
        if (!$text) {
            cmsCore::error404();
        }
        cmsCore::loadModel('content');
        $text .= cmsPage::getPagebar($n, $page, 1, cms_model_content::getArticleURL(null, $seolink, '%page%'));
        return true;
    }
}
Example #3
0
function mod_category($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['category_id'])) {
        $cfg['category_id'] = 0;
    }
    if (!isset($cfg['show_subcats'])) {
        $cfg['show_subcats'] = 1;
    }
    if (!isset($cfg['expand_all'])) {
        $cfg['expand_all'] = 1;
    }
    $rootcat = $inDB->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) {
        return false;
    }
    $subcats_list = $model->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
    if (!$subcats_list) {
        return false;
    }
    $current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->assign('current_seolink', $current_seolink)->assign('subcats_list', $subcats_list)->display($cfg['tpl']);
    return true;
}
Example #4
0
function mod_category($mod, $cfg) {
    $cfg = array_merge(
        array(
            'category_id'  => 0,
            'show_subcats' => 1,
            'expand_all'   => 1
        ),
        $cfg
    );
    
    $rootcat = cmsCore::c('db')->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) { return false; }

    $subcats_list = cmsCore::m('content')->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
    
    if (!$subcats_list) { return false; }

    $current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('cfg', $cfg)->
        assign('current_seolink', $current_seolink)->
        assign('subcats_list', $subcats_list)->
        display();

    return true;
}
Example #5
0
function subscribes(){

    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();

    $do = $inCore->do;

//========================================================================================================================//
//========================================================================================================================//
    if ($do=='view'){

        $subscribe  = cmsCore::request('subscribe', 'int', 0);
        $target     = cmsCore::request('target', 'str', '');
        $target_id  = cmsCore::request('target_id', 'int', 0);

        if (!$target_id || !$target){
            cmsCore::error404();
        }

        if ($inUser->id){
            cmsUser::subscribe($inUser->id,  $target, $target_id, $subscribe);
        }

        if(cmsCore::isAjax()){
            cmsCore::jsonOutput(array('subscribe'=>$subscribe));
        } else {
            cmsCore::redirectBack();
        }

    }

}
Example #6
0
function polls()
{
    $model = new cms_model_polls();
    global $_LANG;
    $do = cmsCore::getInstance()->do;
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view') {
        $answer = cmsCore::request('answer', 'str', '');
        $poll_id = cmsCore::request('poll_id', 'int');
        if (!$answer || !$poll_id) {
            if (cmsCore::isAjax()) {
                cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['SELECT_THE_OPTION']));
            } else {
                cmsCore::error404();
            }
        }
        $poll = $model->getPoll($poll_id);
        if (!$poll) {
            cmsCore::jsonOutput(array('error' => true, 'text' => ''));
        }
        if ($model->isUserVoted($poll_id)) {
            cmsCore::jsonOutput(array('error' => true, 'text' => ''));
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::halt();
        }
        $model->votePoll($poll, $answer);
        cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['VOTE_ACCEPTED']));
    }
}
Example #7
0
function applet_filters()
{
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
        cpAccessDenied();
    }
    if (!cmsUser::isAdminCan('admin/filters', $adminAccess)) {
        cpAccessDenied();
    }
    $GLOBALS['cp_page_title'] = $_LANG['AD_FILTERS'];
    cpAddPathway($_LANG['AD_FILTERS'], 'index.php?view=filters');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    if ($do == 'hide') {
        dbHide('cms_filters', $id);
        echo '1';
        exit;
    }
    if ($do == 'show') {
        dbShow('cms_filters', $id);
        echo '1';
        exit;
    }
    if ($do == 'list') {
        $fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
        $fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '250');
        $fields[] = array('title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '');
        $fields[] = array('title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '100');
        $actions = array();
        cpListTable('cms_filters', $fields, $actions);
    }
}
Example #8
0
function applet_filters() {
    global $_LANG;
    
    global $adminAccess;
    
    if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) { cpAccessDenied(); }
    if (!cmsUser::isAdminCan('admin/filters', $adminAccess)) { cpAccessDenied(); }
    
    cmsCore::c('page')->setTitle($_LANG['AD_FILTERS']);
    cpAddPathway($_LANG['AD_FILTERS'], 'index.php?view=filters');

    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);

    if ($do == 'hide') {
        cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '0');
        cmsCore::halt('1');
    }

    if ($do == 'show') {
        cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '1');
        cmsCore::halt('1');
    }

    if ($do == 'list') {
        $fields = array(
            array( 'title' =>  'id', 'field' => 'id', 'width' => '40' ),
            array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '250' ),
            array( 'title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '' ),
            array( 'title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '100' )
        );

        cpListTable('cms_filters', $fields, array());
    }
}
Example #9
0
    public function __construct(){
        $this->config = cmsCore::getInstance()->loadComponentConfig('arhive');

        cmsCore::loadLanguage('components/arhive');
        $this->year  = cmsCore::request('y', 'int', 'all');
        $this->month = sprintf("%02d", cmsCore::request('m', 'int', 'all'));
        $this->day   = sprintf("%02d", cmsCore::request('d', 'int', 'all'));
        $this->setSqlParams();
    }
Example #10
0
function applet_cache()
{
    $target = cmsCore::request('target', 'str', '');
    $target_id = cmsCore::request('id', 'int', 0);
    if (!$target || !$target_id) {
        cmsCore::error404();
    }
    cmsCore::deleteCache($target, $target_id);
    cmsCore::redirectBack();
}
Example #11
0
function applet_templates()
{
    global $adminAccess;
    global $_LANG;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    $do = cmsCore::request('do', array('config', 'save_config'), 'main');
    cmsCore::c('page')->setTitle($_LANG['AD_TEMPLATES_SETTING']);
    cpAddPathway($_LANG['AD_TEMPLATES_SETTING'], 'index.php?view=templates');
    if ($do == 'main') {
        cmsCore::c('page')->initTemplate('applets', 'templates')->assign('templates', cmsCore::getDirsList('/templates'))->display();
    }
    if ($do == 'config') {
        $template = cmsCore::request('template', 'str', '');
        cpAddPathway($_LANG['AD_TEMPLATE'] . ': ' . $template, 'index.php?view=templates&do=config&template=' . $template);
        if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php')) {
            cmsCore::error404();
        }
        include PATH . '/templates/' . $template . '/config.php';
        if (function_exists('get_template_cfg_fields')) {
            $tpl_cfgs = get_template_cfg_fields();
            if (!empty($tpl_cfgs)) {
                $tpl_cfgs_val = cmsCore::getTplCfg($template);
                cmsCore::c('page')->initTemplate('applets', 'templates')->assign('template', $template)->assign('form_gen_form', cmsCore::c('form_gen')->generateForm($tpl_cfgs, $tpl_cfgs_val))->display();
            } else {
                cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_NO_CONFIG'], 'error');
                cmsCore::redirectBack();
            }
        } else {
            cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_ERROR'], 'error');
            cmsCore::redirectBack();
        }
    }
    if ($do == 'save_config') {
        $template = cmsCore::request('template', 'str', '');
        if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php') || !cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        include PATH . '/templates/' . $template . '/config.php';
        if (function_exists('get_template_cfg_fields')) {
            $tpl_cfgs = get_template_cfg_fields();
            if (!empty($tpl_cfgs)) {
                $tpl_cfgs = cmsCore::c('form_gen')->requestForm($tpl_cfgs);
                cmsCore::saveTplCfg($tpl_cfgs, $template);
                cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_SAVED'], 'success');
                cmsCore::redirect('/admin/index.php?view=templates');
            } else {
                cmsCore::error404();
            }
        } else {
            cmsCore::error404();
        }
    }
}
Example #12
0
function applet_cache() {
    $component = cmsCore::request('component', 'str', '');
    $target    = cmsCore::request('target', 'str', '');
    $target_id = cmsCore::request('target_id', 'str', '');

    if (empty($component) || empty($target_id)) { cmsCore::error404(); }
    
    cmsCore::c('cache')->remove($component, $target_id, $target);

    cmsCore::redirectBack();
}
Example #13
0
 /**
  * Проверяет код каптчи
  * @return bool
  */
 public function checkCaptcha()
 {
     $captcha_code = cmsCore::request('captcha_code', 'str', '');
     $captcha_id = cmsCore::request('captcha_id', 'str', '');
     if (!$captcha_id || empty($_SESSION['captcha'][$captcha_id]) || !$captcha_code) {
         return false;
     }
     $real_code = $_SESSION['captcha'][$captcha_id];
     unset($_SESSION['captcha'][$captcha_id]);
     return $real_code === $captcha_code;
 }
Example #14
0
function applet_arhive()
{
    $inCore = cmsCore::getInstance();
    global $_LANG;
    cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES_ARCHIVE']);
    $cfg = $inCore->loadComponentConfig('content');
    $cfg_arhive = $inCore->loadComponentConfig('arhive');
    cpAddPathway($_LANG['AD_ARTICLE_SITE'], 'index.php?view=tree');
    cpAddPathway($_LANG['AD_ARTICLES_ARCHIVE'], 'index.php?view=arhive');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    if ($do == 'saveconfig') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $cfg['source'] = cmsCore::request('source', 'str', '');
        $inCore->saveComponentConfig('arhive', $cfg);
        cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
        cmsCore::redirect('?view=arhive&do=config');
    }
    if ($do == 'config') {
        $toolmenu = array(array('icon' => 'folders.gif', 'title' => $_LANG['AD_LIST_OF_ARTICLES'], 'link' => '?view=arhive'));
        cpToolMenu($toolmenu);
        cpAddPathway($_LANG['AD_SETTINGS'], 'index.php?view=arhive&do=config');
        cmsCore::c('page')->initTemplate('applets', 'arhive')->assign('cfg_arhive', $cfg_arhive)->display();
    }
    if ($do == 'list') {
        $toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETTINGS'], 'link' => '?view=arhive&do=config'), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=arhive&do=delete&multiple=1');"));
        cpToolMenu($toolmenu);
        //TABLE COLUMNS
        $fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_CREATE'], 'field' => 'pubdate', 'width' => '80', 'filter' => 15, 'fdate' => '%d/%m/%Y'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=content&do=edit&id=%id%', 'filter' => 15), array('title' => $_LANG['AD_PARTITION'], 'field' => 'category_id', 'width' => '150', 'filter' => 1, 'prc' => 'cpCatById', 'filterlist' => cpGetList('cms_category')));
        //ACTIONS
        $actions = array(array('title' => $_LANG['AD_TO_ARTICLES_CATALOG'], 'icon' => 'arhive_off.gif', 'link' => '?view=arhive&do=arhive_off&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=content&do=delete&id=%id%', 'confirm' => $_LANG['AD_DELETE_MATERIALS']));
        //Print table
        cpListTable('cms_content', $fields, $actions, 'is_arhive=1');
    }
    if ($do == 'arhive_off') {
        if (cmsCore::inRequest('id')) {
            cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '0');
            cmsCore::redirect('?view=arhive');
        }
    }
    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) {
                cmsCore::m('content')->deleteArticle($id, $cfg['af_delete']);
            }
        } else {
            cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'), $cfg['af_delete']);
        }
        cmsCore::redirect('?view=arhive');
    }
}
Example #15
0
function files()
{
    $inDB = cmsDatabase::getInstance();
    global $_LANG;
    $do = cmsCore::getInstance()->do;
    $model = new cms_model_files();
    //============================================================================//
    // Скачивание
    if ($do == 'view') {
        $fileurl = cmsCore::request('fileurl', 'html', '');
        if (mb_strpos($fileurl, '-') === 0) {
            $fileurl = htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-')));
        }
        $fileurl = cmsCore::strClear($fileurl);
        if (!$fileurl || mb_strstr($fileurl, '..') || strpos($fileurl, '.') === 0) {
            cmsCore::error404();
        }
        if (strpos($fileurl, 'http') === 0) {
            $model->increaseDownloadCount($fileurl);
            cmsCore::redirect($fileurl);
        } elseif (file_exists(PATH . $fileurl)) {
            $model->increaseDownloadCount($fileurl);
            header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
            header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
            header('Location:' . $fileurl);
            cmsCore::halt();
        } else {
            cmsCore::halt($_LANG['FILE_NOT_FOUND']);
        }
    }
    //============================================================================//
    if ($do == 'redirect') {
        $url = str_replace(array('--q--', ' '), array('?', '+'), cmsCore::request('url', 'str', ''));
        if (mb_strpos($url, '-') === 0) {
            $url = htmlspecialchars_decode(base64_decode(ltrim($url, '-')));
        }
        $url = cmsCore::strClear($url);
        if (!$url || mb_strstr($url, '..') || strpos($url, '.') === 0) {
            cmsCore::error404();
        }
        // кириллические домены
        $url_host = parse_url($url, PHP_URL_HOST);
        if (preg_match('/^[а-яё]+/iu', $url_host)) {
            cmsCore::loadClass('idna_convert');
            $IDN = new idna_convert();
            $host = $IDN->encode($url_host);
            $url = str_ireplace($url_host, $host, $url);
        }
        cmsCore::redirect($url);
    }
    //============================================================================//
}
Example #16
0
function applet_help()
{
    $topic = cmsCore::request('topic', 'str', '');
    $help_url = array('components' => 'http://cmsrudi.ru/docs/components', 'modules' => 'http://cmsrudi.ru/docs/modules', 'plugins' => 'http://cmsrudi.ru/docs/plugins');
    $help_url['menu'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BC%D0%B5%D0%BD%D1%8E_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
    $help_url['content'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
    $help_url['cats'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
    $help_url['users'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D0%B8';
    $help_url['config'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
    if (isset($help_url[$topic])) {
        cmsCore::redirect($help_url[$topic]);
    }
    cmsCore::redirect('http://cmsrudi.ru/docs');
}
Example #17
0
    private function check_captcha() {
        $captcha_code = cmsCore::request('captcha_code', 'str', '');
        $captcha_id   = cmsCore::request('captcha_id', 'int', 0);
        
        if (empty($captcha_code) || empty($_SESSION['captcha'][$captcha_id])) {
            return false;
        }
        
        $result = $_SESSION['captcha'][$captcha_id] == $captcha_code;
        
        unset($_SESSION['captcha'][$captcha_id]);

        return $result;
    }
Example #18
0
function applet_robots() {
    global $_LANG;
    global $adminAccess;
    
    if (!cmsUser::isAdminCan('admin/robots', $adminAccess)) { cpAccessDenied(); }
    
    cmsCore::c('page')->setTitle($_LANG['ROBOTS_TITLE']);

    cpAddPathway($_LANG['ROBOTS_TITLE']);

    $do = cmsCore::request('do', array('edit', 'save'), 'edit');

    if (!file_exists(PATH .'/robots.txt')) {
        $fp = fopen(PATH .'/robots.txt', 'w');
        fwrite($fp, str_replace(array('%domen%', '%host%'), array(str_replace(array('https://', 'http://'), '', cmsCore::c('config')->host), cmsCore::c('config')->host), file_get_contents(PATH .'/includes/default_robots.txt')));
        fclose ($fp);
        chmod(PATH .'/robots.txt', 0777);
    }

    if ($do == 'save') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $data = cmsCore::request('robots', 'str');
        
        $fp = fopen(PATH .'/robots.txt', 'w');
        fwrite($fp, stripcslashes($data) ."\n");
        fclose ($fp);
    }

    $robots = file_get_contents(PATH .'/robots.txt');
?>
<form action="" method="post">
    <div style="width:650px;">
        <input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
        
        <div class="form-group">
            <label><?php echo $_LANG['ROBOTS_TXT_DATA']; ?></label>
            <textarea name="robots" class="form-control" style="height: 400px;"><?php echo $robots; ?></textarea>
            <div class="help-block"><?php echo $_LANG['ROBOTS_TXT_INFO']; ?></div>
        </div>
        
        <input type="hidden" name="do" value="save" />
        
        <input type="submit" class="btn btn-primary" name="save" value="<?php echo $_LANG['SAVE']; ?>" />
        <input type="button" class="btn btn-default" name="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.history.back();" />
    </div>
</form>
<?php
}
Example #19
0
function applet_help()
{
    $topic = cmsCore::request('topic', 'str', '');
    $help_url['menu'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BC%D0%B5%D0%BD%D1%8E_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
    $help_url['modules'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8';
    $help_url['content'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
    $help_url['cats'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
    $help_url['components'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BA%D0%BE%D0%BC%D0%BF%D0%BE%D0%BD%D0%B5%D0%BD%D1%82%D1%8B';
    $help_url['users'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D0%B8';
    $help_url['config'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
    if (isset($help_url[$topic])) {
        cmsCore::redirect($help_url[$topic]);
    }
    cmsCore::redirect('http://www.cms.vadyus.com/wiki');
}
Example #20
0
function applet_tree()
{
    $inCore = cmsCore::getInstance();
    cmsCore::loadLib('tags');
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    cmsCore::c('page')->addHeadJS('admin/js/content.js');
    echo '<script>';
    echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_PIECES');
    echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
    echo cmsPage::getLangJS('AD_AND_SUB_CATS');
    echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
    echo '</script>';
    $do = cmsCore::request('do', 'str', 'tree');
    if ($do == 'tree') {
        $toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content'));
        cpToolMenu($toolmenu);
        $only_hidden = cmsCore::request('only_hidden', 'int', 0);
        $category_id = cmsCore::request('cat_id', 'int', 0);
        $base_uri = 'index.php?view=tree';
        $title_part = cmsCore::request('title', 'str', '');
        $def_order = $category_id ? 'con.ordering' : 'pubdate';
        $orderby = cmsCore::request('orderby', 'str', $def_order);
        $orderto = cmsCore::request('orderto', 'str', 'asc');
        $page = cmsCore::request('page', 'int', 1);
        $perpage = 20;
        if ($category_id) {
            cmsCore::m('content')->whereCatIs($category_id);
        }
        if ($title_part) {
            cmsCore::c('db')->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
        }
        if ($only_hidden) {
            cmsCore::c('db')->where('con.published = 0');
        }
        cmsCore::c('db')->orderBy($orderby, $orderto);
        cmsCore::c('db')->limitPage($page, $perpage);
        $total = cmsCore::m('content')->getArticlesCount(false);
        cmsCore::c('page')->initTemplate('applets', 'tree')->assign('hide_cats', cmsCore::request('hide_cats', 'int', 0))->assign('only_hidden', $only_hidden)->assign('base_uri', $base_uri)->assign('category_id', $category_id)->assign('cats', cmsCore::m('content')->getCatsTree())->assign('orderto', $orderto)->assign('orderby', $orderby)->assign('title_part', $title_part)->assign('category_opt', $inCore->getListItemsNS('cms_category', $category_id))->assign('page', $page)->assign('total', $total)->assign('perpage', $perpage)->assign('pages', ceil($total / $perpage))->assign('items', cmsCore::m('content')->getArticlesList(false))->display();
    }
}
Example #21
0
function banners()
{
    $inCore = cmsCore::getInstance();
    $model = new cms_model_banners();
    $do = $inCore->do;
    $banner_id = cmsCore::request('id', 'int', 0);
    //======================================================================================================================//
    if ($do == 'view') {
        $banner = $model->getBanner($banner_id);
        if (!$banner || !$banner['published']) {
            cmsCore::error404();
        }
        $model->clickBanner($banner_id);
        cmsCore::redirect($banner['link']);
    }
}
Example #22
0
function mod_invite($mod, $cfg) {
    global $_LANG;

    $errors      = false;
    $is_redirect = false; // в модуле нельзя использовать cmsCore::redirectBack(), используем костыли ;)

    if (cmsCore::inRequest('send_invite_email')) {
        $is_redirect = true;

        $username = cmsCore::request('username', 'str', '');
        $email    = cmsCore::request('friend_email', 'email', '');

        if (!$username && !cmsCore::c('user')->id) {
            cmsCore::addSessionMessage($_LANG['ERR_NEED_NAME'], 'error'); $errors = true;
        }
        
        if (cmsCore::c('user')->id) {
            $username = cmsCore::c('user')->nickname;
        }

        if (!$email) {
            cmsCore::addSessionMessage($_LANG['ERR_NEED_MAIL'], 'error'); $errors = true;
        }

        if (!$errors) {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }

            $letter = cmsCore::getLanguageTextFile('mail_invite');
            $letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
            $letter = str_replace('{site_url}', HOST, $letter);
            $letter = str_replace('{username}', $username, $letter);

            cmsCore::mailText($email, sprintf($_LANG['INVITE_SUBJECT'], $username), $letter);
            cmsCore::addSessionMessage($_LANG['INVITE_SENDED'], 'success');
        }
    }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('user_id', cmsCore::c('user')->id)->
        assign('is_redirect', $is_redirect)->
        display();

    return true;
}
Example #23
0
function applet_config()
{
    // получаем оригинальный конфиг
    $config = cmsConfig::getDefaultConfig();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_SITE_SETTING']);
    cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
    $do = cmsCore::request('do', 'str', 'list');
    if ($do == 'save') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $newCFG = cmsCore::getArrayFromRequest(array('scheme' => array('scheme', array('http', 'https'), ''), 'sitename' => array('sitename', 'str', ''), 'title_and_sitename' => array('title_and_sitename', 'int', 0), 'title_and_page' => array('title_and_page', 'int', 0), 'hometitle' => array('hometitle', 'str', ''), 'homecom' => array('homecom', 'str', ''), 'com_without_name_in_url' => array('com_without_name_in_url', 'str', ''), 'siteoff' => array('siteoff', 'int', 0), 'only_authorized' => array('only_authorized', 'int', 0), 'debug' => array('debug', 'int', 0), 'offtext' => array('offtext', 'str', ''), 'keywords' => array('keywords', 'str', ''), 'metadesc' => array('metadesc', 'str', ''), 'seourl' => array('seourl', 'int', 0), 'lang' => array('lang', 'str', 'ru'), 'is_change_lang' => array('is_change_lang', 'int', 0), 'sitemail' => array('sitemail', 'str', ''), 'sitemail_name' => array('sitemail_name', 'str', ''), 'wmark' => array('wmark', 'str', ''), 'template' => array('template', 'str', ''), 'admin_template' => array('admin_template', 'str', ''), 'cache' => array('cache', 'int', 0), 'cache_type' => array('cache_type', array('file', 'memcached'), ''), 'memcached_host' => array('memcached_host', 'str', ''), 'memcached_port' => array('memcached_port', 'int', 0), 'combine_css_enable' => array('combine_css_enable', 'int', 0), 'combine_css' => array('combine_css', 'html', ''), 'combine_js_enable' => array('combine_js_enable', 'int', 0), 'combine_js' => array('combine_js', 'html', ''), 'splash' => array('splash', 'int', 0), 'slight' => array('slight', 'int', 0), 'show_pw' => array('show_pw', 'int', 0), 'last_item_pw' => array('last_item_pw', 'int', 0), 'index_pw' => array('index_pw', 'int', 0), 'fastcfg' => array('fastcfg', 'int', 0), 'mailer' => array('mailer', 'str', ''), 'smtpsecure' => array('smtpsecure', 'str', ''), 'smtpauth' => array('smtpauth', 'int', 0), 'smtpuser' => array('smtpuser', 'str', $config['smtpuser']), 'smtppass' => array('smtppass', 'str', $config['smtppass']), 'smtphost' => array('smtphost', 'str', ''), 'smtpport' => array('smtpport', 'int', '25'), 'timezone' => array('timezone', 'str', $config['timezone']), 'user_stats' => array('user_stats', 'int', 0), 'seo_url_count' => array('seo_url_count', 'int', 0), 'max_pagebar_links' => array('max_pagebar_links', 'int', 0), 'allow_ip' => array('allow_ip', 'str', ''), 'iframe_enable' => array('iframe_enable', 'int', 0), 'vk_enable' => array('vk_enable', 'int', 0), 'vk_id' => array('vk_id', 'str', ''), 'vk_private_key' => array('vk_private_key', 'str', '')));
        $newCFG['sitename'] = stripslashes($newCFG['sitename']);
        $newCFG['hometitle'] = stripslashes($newCFG['hometitle']);
        $newCFG['offtext'] = htmlspecialchars($newCFG['offtext'], ENT_QUOTES);
        $newCFG['db_host'] = $config['db_host'];
        $newCFG['db_base'] = $config['db_base'];
        $newCFG['db_user'] = $config['db_user'];
        $newCFG['db_pass'] = $config['db_pass'];
        $newCFG['db_prefix'] = $config['db_prefix'];
        if (cmsConfig::saveToFile($newCFG)) {
            cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
        } else {
            cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
        }
        cmsCore::clearCache();
        cmsCore::redirect('index.php?view=config');
    }
    cpCheckWritable('/includes/config/config.inc.json');
    $result = cmsCore::c('db')->query("SELECT (sum(data_length)+sum(index_length))/1024/1024 as size FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" . $config['db_base'] . "'", true);
    if (!cmsCore::c('db')->error()) {
        $s = cmsCore::c('db')->fetch_assoc($result);
    } else {
        $s['size'] = 0;
    }
    cmsCore::c('page')->initTemplate('applets', 'config')->assign('config', $config)->assign('timezone_opt', cmsCore::getTimeZonesOptions($config['timezone']))->assign('admin_templates', cmsCore::getDirsList('/templates/admin'))->assign('templates', cmsCore::getDirsList('/templates'))->assign('tpl_info', cmsCore::c('page')->getTplInfo(cmsCore::c('page')->template))->assign('components_opt', cmsCore::getListItems('cms_components', $config['com_without_name_in_url'], 'title', 'ASC', 'internal=0', 'link'))->assign('homecom_opt', cmsCore::getListItems('cms_components', $config['homecom'], 'title', 'ASC', 'internal=0', 'link'))->assign('langs', cmsCore::getDirsList('/languages'))->assign('db_size', round($s['size'], 2))->display();
}
Example #24
0
if ($do == 'insert') {
    cmsCore::loadLanguage('plugins/p_inser_video');
    $cfg = $inCore->loadPluginConfig('p_insert_video');
    $domains = explode(',', $cfg['PIV_DOMENS']);
    foreach ($domains as $k=>$v) {
        $v = trim($v);
        if (empty($v)) {
            unset($domains[$k]);
        } else {
            $domains[$k] = $v;
        }
    }
    $domains[] = cmsCore::getHost();
    
    $code = cmsCore::request('code', 'html', '');
    $code = str_replace('&amp;', '&', $code);
    
    if (!empty($code)) {
        // Для очистки кода используем класс Jevix
        cmsCore::c('jevix')->cfgAllowTags(array('iframe','object','param','embed'));
        cmsCore::c('jevix')->cfgSetTagCutWithContent(array('script','style'));

        cmsCore::c('jevix')->cfgAllowTagParams('object', array('width' => '#int', 'height' => '#int', 'data' => array('#domain' => $domains)));
        cmsCore::c('jevix')->cfgAllowTagParams('param', array('name' => '#text', 'value' => '#text'));
        cmsCore::c('jevix')->cfgAllowTagParams('embed', array('src' => array('#domain' => $domains), 'type' => '#text', 'allowscriptaccess' => '#text', 'allowfullscreen' => '#text', 'width' => '#int', 'height' => '#int', 'flashvars' => '#text', 'wmode'=> '#text', 'quality' => '#text'));
        cmsCore::c('jevix')->cfgAllowTagParams('iframe', array('width' => '#int', 'frameborder' => '#int', 'allowfullscreen' => '#int', 'height' => '#int', 'src' => array('#domain' => $domains)));

        cmsCore::c('jevix')->cfgSetTagParamsRequired('iframe', 'src');
        cmsCore::c('jevix')->cfgSetTagParamsRequired('object', 'data');
        cmsCore::c('jevix')->cfgSetTagParamsRequired('embed', 'src');
Example #25
0
function forms()
{
    cmsCore::loadClass('form');
    $do = cmsCore::getInstance()->do;
    global $_LANG;
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view') {
        // Получаем форму
        $form = cmsForm::getFormData(cmsCore::request('form_id', 'int'));
        if (!$form) {
            cmsCore::error404();
        }
        // Получаем данные полей формы
        $form_fields = cmsForm::getFormFields($form['id']);
        // Если полей нет, 404
        if (!$form_fields) {
            cmsCore::error404();
        }
        $errors = array();
        $attachment = array();
        // Получаем данные формы
        // Если не переданы, назад
        $form_input = cmsForm::getFieldsInputValues($form['id']);
        if (!$form_input) {
            $errors[] = $_LANG['FORM_ERROR'];
        }
        // Проверяем значения формы
        foreach ($form_input['errors'] as $field_error) {
            if ($field_error) {
                $errors[] = $field_error;
            }
        }
        // проверяем каптчу
        if (!cmsPage::checkCaptchaCode()) {
            $errors[] = $_LANG['ERR_CAPTCHA'];
        }
        if ($errors) {
            if (cmsCore::isAjax()) {
                cmsCore::jsonOutput(array('error' => true, 'text' => end($errors)));
            } else {
                foreach ($errors as $error) {
                    cmsCore::addSessionMessage($error, 'error');
                }
                cmsCore::redirectBack();
            }
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        // Подготовим начало письма
        $mail_message = '<h3>' . $_LANG['FORM'] . ': ' . $form['title'] . '</h3>';
        // Добавляем заполненные поля в письмо
        foreach ($form_fields as $field) {
            // Значение поля
            $value = $form_input['values'][$field['id']];
            if (!$value) {
                continue;
            }
            if (is_string($value)) {
                $mail_message .= '<h5>' . $field['title'] . '</h5><p>' . $value . '</p>';
            } elseif (is_array($value)) {
                // если массив, значит к форме прикреплен файл
                if ($form['sendto'] == 'mail') {
                    $attachment[] = !empty($value['url']) ? PATH . $value['url'] : '';
                } elseif (!empty($value['url'])) {
                    $mail_message .= '<h5>' . $field['title'] . '</h5><p><a href="' . $value['url'] . '">' . $value['name'] . '</a></p>';
                }
            }
        }
        // Отправляем форму
        if ($form['sendto'] == 'mail') {
            $emails = explode(',', $form['email']);
            if ($emails) {
                foreach ($emails as $email) {
                    cmsCore::mailText(trim($email), cmsConfig::getConfig('sitename') . ': ' . $form['title'], $mail_message, $attachment);
                }
            }
            // удаляем прикрепленные файлы
            foreach ($attachment as $attach) {
                @unlink($attach);
            }
        } else {
            cmsUser::sendMessage(-2, $form['user_id'], $mail_message);
        }
        cmsUser::sessionClearAll();
        if (cmsCore::isAjax()) {
            cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['FORM_IS_SEND']));
        } else {
            cmsCore::addSessionMessage($_LANG['FORM_IS_SEND'], 'info');
            cmsCore::redirectBack();
        }
    }
    //========================================================================================================================//
}
Example #26
0
             $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
         } else {
             cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
             cmsCore::redirectBack();
         }
     }
     $ostatok = '';
     if (isset($_SESSION['editlist'])) {
         $item_id = array_shift($_SESSION['editlist']);
         if (sizeof($_SESSION['editlist']) == 0) {
             unset($_SESSION['editlist']);
         } else {
             $ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
         }
     } else {
         $item_id = cmsCore::request('item_id', 'int', 0);
     }
     $mod = cms_model_banners::getBanner($item_id);
     if (!$mod) {
         cmsCore::error404();
     }
     echo '<h3>' . $mod['title'] . ' ' . $ostatok . '</h3>';
     cpAddPathway($mod['title']);
 }
 ?>
 <?php 
 if ($opt == 'edit') {
     ?>
     <table width="625" border="0" cellspacing="5" class="proptable">
           <tr>
             <td align="center">
Example #27
0
    $sql = "SELECT id, filename FROM cms_user_files WHERE user_id = '{$id}' AND {$fsql}";
    $result = $inDB->query($sql);
    if ($inDB->num_rows($result)) {
        while ($file = $inDB->fetch_assoc($result)) {
            @unlink(PATH . '/upload/userfiles/' . $id . '/' . $file['filename']);
            cmsActions::removeObjectLog('add_file', $file['id']);
        }
        $inDB->query("DELETE FROM cms_user_files WHERE user_id = '{$id}' AND {$fsql}");
    }
    cmsCore::redirect('/users/' . $id . '/files.html');
}
/////////////////////////////// MULTIPLE FILES PUBLISHING /////////////////////////////////////////////////////////////////////////////////////////
if ($fdo == 'pubfilelist') {
    $files = cmsCore::request('files', 'array_int', array());
    if (!$files) {
        cmsCore::error404();
    }
    $allow = cmsCore::request('allow', 'str', 'nobody');
    if (!$inUser->id || $inUser->id != $id && !$inUser->is_admin) {
        cmsCore::error404();
    }
    $a_list = rtrim(implode(',', $files), ',');
    $fsql = '';
    if ($a_list) {
        $fsql .= "id IN ({$a_list})";
    } else {
        $fsql .= '1=0';
    }
    $inDB->query("UPDATE cms_user_files SET allow_who = '{$allow}' WHERE user_id = '{$id}' AND {$fsql}");
    cmsCore::redirect('/users/' . $id . '/files.html');
}
Example #28
0
function applet_content()
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $inDB = cmsDatabase::getInstance();
    global $_LANG;
    //check access
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
        cpAccessDenied();
    }
    $cfg = $inCore->loadComponentConfig('content');
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    $do = cmsCore::request('do', 'str', 'add');
    $id = cmsCore::request('id', 'int', -1);
    if ($do == 'arhive_on') {
        $inDB->query("UPDATE cms_content SET is_arhive = 1 WHERE id = '{$id}'");
        cmsCore::addSessionMessage($_LANG['AD_ARTICLES_TO_ARHIVE'], 'success');
        cmsCore::redirectBack();
    }
    if ($do == 'move') {
        $item_id = cmsCore::request('id', 'int', 0);
        $cat_id = cmsCore::request('cat_id', 'int', 0);
        $dir = $_REQUEST['dir'];
        $step = 1;
        $model->moveItem($item_id, $cat_id, $dir, $step);
        echo '1';
        exit;
    }
    if ($do == 'move_to_cat') {
        $items = cmsCore::request('item', 'array_int');
        $to_cat_id = cmsCore::request('obj_id', 'int', 0);
        if ($items && $to_cat_id) {
            $last_ordering = (int) $inDB->get_field('cms_content', "category_id = '{$to_cat_id}' ORDER BY ordering DESC", 'ordering');
            foreach ($items as $item_id) {
                $article = $model->getArticle($item_id);
                if (!$article) {
                    continue;
                }
                $last_ordering++;
                $model->updateArticle($article['id'], array('category_id' => $to_cat_id, 'ordering' => $last_ordering, 'url' => $article['url'], 'title' => $inDB->escape_string($article['title']), 'id' => $article['id'], 'user_id' => $article['user_id']));
            }
            cmsCore::addSessionMessage($_LANG['AD_ARTICLES_TO'], 'success');
        }
        cmsCore::redirect('?view=tree&cat_id=' . $to_cat_id);
    }
    if ($do == 'show') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                dbShow('cms_content', $id);
            }
            echo '1';
            exit;
        } else {
            dbShowList('cms_content', cmsCore::request('item', 'array_int'));
            cmsCore::redirectBack();
        }
    }
    if ($do == 'hide') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                dbHide('cms_content', $id);
            }
            echo '1';
            exit;
        } else {
            dbHideList('cms_content', cmsCore::request('item', 'array_int'));
            cmsCore::redirectBack();
        }
    }
    if ($do == 'delete') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                $model->deleteArticle($id);
                cmsCore::addSessionMessage($_LANG['AD_ARTICLE_REMOVE'], 'success');
            }
        } else {
            $model->deleteArticles(cmsCore::request('item', 'array_int'));
            cmsCore::addSessionMessage($_LANG['AD_ARTICLES_REMOVE'], 'success');
        }
        cmsCore::redirectBack();
    }
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        if (isset($_REQUEST['id'])) {
            $id = cmsCore::request('id', 'int', 0);
            $article['category_id'] = cmsCore::request('category_id', 'int', 1);
            $article['title'] = cmsCore::request('title', 'str');
            $article['url'] = cmsCore::request('url', 'str');
            $article['showtitle'] = cmsCore::request('showtitle', 'int', 0);
            $article['description'] = cmsCore::request('description', 'html', '');
            $article['description'] = $inDB->escape_string($article['description']);
            $article['content'] = cmsCore::request('content', 'html', '');
            $article['content'] = $inDB->escape_string($article['content']);
            $article['for_img'] = cmsCore::request('for_img', 'html', '');
            $article['for_img'] = $inDB->escape_string($article['for_img']);
            $article['published'] = cmsCore::request('published', 'int', 0);
            $article['showdate'] = cmsCore::request('showdate', 'int', 0);
            $article['showlatest'] = cmsCore::request('showlatest', 'int', 0);
            $article['show_in_new'] = cmsCore::request('show_in_new', 'int', 0);
            //new
            $article['show_in_footer'] = cmsCore::request('show_in_footer', 'int', 0);
            //new
            $article['showpath'] = cmsCore::request('showpath', 'int', 0);
            $article['comments'] = cmsCore::request('comments', 'int', 0);
            $article['canrate'] = cmsCore::request('canrate', 'int', 0);
            $article['add_text'] = cmsCore::request('add_text', 'str');
            $enddate = explode('.', cmsCore::request('enddate', 'str'));
            $article['enddate'] = $enddate[2] . '-' . $enddate[1] . '-' . $enddate[0];
            $article['is_end'] = cmsCore::request('is_end', 'int', 0);
            $article['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
            $article['tags'] = cmsCore::request('tags', 'str');
            $olddate = cmsCore::request('olddate', 'str', '');
            $pubdate = cmsCore::request('pubdate', 'str', '');
            $article['user_id'] = cmsCore::request('user_id', 'int', $inUser->id);
            $article['tpl'] = cmsCore::request('tpl', 'str', 'com_content_read.tpl');
            $date = explode('.', $pubdate);
            $article['pubdate'] = $date[2] . '-' . $date[1] . '-' . $date[0] . ' ' . date('H:i');
            $autokeys = cmsCore::request('autokeys', 'int');
            switch ($autokeys) {
                case 1:
                    $article['meta_keys'] = $inCore->getKeywords($article['content']);
                    $article['meta_desc'] = $article['title'];
                    break;
                case 2:
                    $article['meta_desc'] = strip_tags($article['description']);
                    $article['meta_keys'] = $article['tags'];
                    break;
                case 3:
                    $article['meta_desc'] = cmsCore::request('meta_desc', 'str');
                    $article['meta_keys'] = cmsCore::request('meta_keys', 'str');
                    break;
            }
            $model->updateArticle($id, $article);
            if (!cmsCore::request('is_public', 'int', 0)) {
                $showfor = $_REQUEST['showfor'];
                cmsCore::setAccess($id, $showfor, 'material');
            } else {
                cmsCore::clearAccess($id, 'material');
            }
            if (isset($_SESSION['lang']) && $_SESSION['lang'] != 'ru') {
                $file = 'article' . $id . '_' . $_SESSION['lang'] . '.jpg';
            } else {
                $file = 'article' . $id . '.jpg';
            }
            //$file = 'article'.$id.'.jpg';
            if (cmsCore::request('delete_image', 'int', 0)) {
                @unlink(PATH . "/images/photos/small/{$file}");
                @unlink(PATH . "/images/photos/medium/{$file}");
            } else {
                // Загружаем класс загрузки фото
                cmsCore::loadClass('upload_photo');
                $inUploadPhoto = cmsUploadPhoto::getInstance();
                // Выставляем конфигурационные параметры
                $inUploadPhoto->upload_dir = PATH . '/images/photos/';
                $inUploadPhoto->small_size_w = $model->config['img_small_w'];
                $inUploadPhoto->medium_size_w = $model->config['img_big_w'];
                $inUploadPhoto->thumbsqr = $model->config['img_sqr'];
                $inUploadPhoto->is_watermark = $model->config['watermark'];
                $inUploadPhoto->input_name = 'picture';
                $inUploadPhoto->filename = $file;
                // Процесс загрузки фото
                $inUploadPhoto->uploadPhoto();
            }
            cmsCore::addSessionMessage($_LANG['AD_ARTICLE_SAVE'], 'success');
            if (!isset($_SESSION['editlist']) || @sizeof($_SESSION['editlist']) == 0) {
                cmsCore::redirect('?view=tree&cat_id=' . $article['category_id']);
            } else {
                cmsCore::redirect('?view=content&do=edit');
            }
        }
    }
    if ($do == 'submit') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $article['category_id'] = cmsCore::request('category_id', 'int', 1);
        $article['title'] = cmsCore::request('title', 'str');
        $article['url'] = cmsCore::request('url', 'str');
        $article['showtitle'] = cmsCore::request('showtitle', 'int', 0);
        $article['description'] = cmsCore::request('description', 'html', '');
        $article['description'] = $inDB->escape_string($article['description']);
        $article['content'] = cmsCore::request('content', 'html', '');
        $article['content'] = $inDB->escape_string($article['content']);
        $article['for_img'] = cmsCore::request('for_img', 'html', '');
        $article['for_img'] = $inDB->escape_string($article['for_img']);
        $article['published'] = cmsCore::request('published', 'int', 0);
        $article['showdate'] = cmsCore::request('showdate', 'int', 0);
        $article['showlatest'] = cmsCore::request('showlatest', 'int', 0);
        $article['show_in_new'] = cmsCore::request('show_in_new', 'int', 0);
        //new
        $article['show_in_footer'] = cmsCore::request('show_in_footer', 'int', 0);
        //new
        $article['showpath'] = cmsCore::request('showpath', 'int', 0);
        $article['comments'] = cmsCore::request('comments', 'int', 0);
        $article['canrate'] = cmsCore::request('canrate', 'int', 0);
        $article['add_text'] = cmsCore::request('add_text', 'str');
        $enddate = explode('.', cmsCore::request('enddate', 'str'));
        $article['enddate'] = $enddate[2] . '-' . $enddate[1] . '-' . $enddate[0];
        $article['is_end'] = cmsCore::request('is_end', 'int', 0);
        $article['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
        $article['tags'] = cmsCore::request('tags', 'str');
        $article['pubdate'] = $_REQUEST['pubdate'];
        $date = explode('.', $article['pubdate']);
        $article['pubdate'] = $date[2] . '-' . $date[1] . '-' . $date[0] . ' ' . date('H:i');
        $article['user_id'] = cmsCore::request('user_id', 'int', $inUser->id);
        $article['tpl'] = cmsCore::request('tpl', 'str', 'com_content_read.tpl');
        $autokeys = cmsCore::request('autokeys', 'int');
        switch ($autokeys) {
            case 1:
                $article['meta_keys'] = $inCore->getKeywords($article['content']);
                $article['meta_desc'] = $article['title'];
                break;
            case 2:
                $article['meta_desc'] = strip_tags($article['description']);
                $article['meta_keys'] = $article['tags'];
                break;
            case 3:
                $article['meta_desc'] = cmsCore::request('meta_desc', 'str');
                $article['meta_keys'] = cmsCore::request('meta_keys', 'str');
                break;
        }
        $article['id'] = $model->addArticle($article);
        if (!cmsCore::request('is_public', 'int', 0)) {
            $showfor = $_REQUEST['showfor'];
            if (sizeof($showfor) > 0 && !cmsCore::request('is_public', 'int', 0)) {
                cmsCore::setAccess($article['id'], $showfor, 'material');
            }
        }
        $inmenu = cmsCore::request('createmenu', 'str', '');
        if ($inmenu) {
            createMenuItem($inmenu, $article['id'], $article['title']);
        }
        // Загружаем класс загрузки фото
        cmsCore::loadClass('upload_photo');
        $inUploadPhoto = cmsUploadPhoto::getInstance();
        // Выставляем конфигурационные параметры
        $inUploadPhoto->upload_dir = PATH . '/images/photos/';
        $inUploadPhoto->small_size_w = $model->config['img_small_w'];
        $inUploadPhoto->medium_size_w = $model->config['img_big_w'];
        $inUploadPhoto->thumbsqr = $model->config['img_sqr'];
        $inUploadPhoto->is_watermark = $model->config['watermark'];
        $inUploadPhoto->input_name = 'picture';
        $inUploadPhoto->filename = 'article' . $article['id'] . '.jpg';
        // Процесс загрузки фото
        $inUploadPhoto->uploadPhoto();
        cmsCore::addSessionMessage($_LANG['AD_ARTICLE_ADD'], 'success');
        cmsCore::redirect('?view=tree&cat_id=' . $article['category_id']);
    }
    if ($do == 'add' || $do == 'edit') {
        require '../includes/jwtabs.php';
        $GLOBALS['cp_page_head'][] = jwHeader();
        $toolmenu = array();
        $toolmenu[0]['icon'] = 'save.gif';
        $toolmenu[0]['title'] = $_LANG['SAVE'];
        $toolmenu[0]['link'] = 'javascript:document.addform.submit();';
        $toolmenu[1]['icon'] = 'cancel.gif';
        $toolmenu[1]['title'] = $_LANG['CANCEL'];
        $toolmenu[1]['link'] = 'javascript:history.go(-1);';
        cpToolMenu($toolmenu);
        $menu_list = cpGetList('menu');
        if ($do == 'add') {
            echo '<h3>' . $_LANG['AD_CREATE_ARTICLE'] . '</h3>';
            cpAddPathway($_LANG['AD_CREATE_ARTICLE'], 'index.php?view=content&do=add');
            $mod['category_id'] = (int) $_REQUEST['to'];
            $mod['showpath'] = 1;
            $mod['tpl'] = 'com_content_read.tpl';
        } else {
            if (isset($_REQUEST['item'])) {
                $_SESSION['editlist'] = $_REQUEST['item'];
            }
            $ostatok = '';
            if (isset($_SESSION['editlist'])) {
                $id = array_shift($_SESSION['editlist']);
                if (sizeof($_SESSION['editlist']) == 0) {
                    unset($_SESSION['editlist']);
                } else {
                    $ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
                }
            } else {
                $id = (int) $_REQUEST['id'];
            }
            $sql = "SELECT *, (TO_DAYS(enddate) - TO_DAYS(CURDATE())) as daysleft, DATE_FORMAT(pubdate, '%d.%m.%Y') as pubdate, DATE_FORMAT(enddate, '%d.%m.%Y') as enddate\n\t\t\t\t\t FROM cms_content\n\t\t\t\t\t WHERE id = {$id} LIMIT 1";
            $result = $inDB->query($sql);
            if ($inDB->num_rows($result)) {
                $mod = $inDB->fetch_assoc($result);
            }
            echo '<h3>' . $_LANG['AD_EDIT_ARTICLE'] . $ostatok . '</h3>';
            cpAddPathway($mod['title'], 'index.php?view=content&do=edit&id=' . $mod['id']);
        }
        ?>
    <form id="addform" name="addform" method="post" action="index.php" enctype="multipart/form-data">
        <input type="hidden" name="csrf_token" value="<?php 
        echo cmsUser::getCsrfToken();
        ?>
" />
        <input type="hidden" name="view" value="content" />

        <table class="proptable" width="100%" cellpadding="5" cellspacing="2">
            <tr>

                <!-- главная ячейка -->
                <td valign="top">

                    <table width="100%" cellpadding="0" cellspacing="4" border="0">
                        <tr>
                            <td valign="top">
                                <div><strong><?php 
        echo $_LANG['AD_ARTICLE_NAME'];
        ?>
</strong></div>
                                <div>
                                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                        <tr>
                                            <td><input name="title" type="text" id="title" style="width:100%" value="<?php 
        echo htmlspecialchars($mod['title']);
        ?>
" /></td>
                                            <td style="width:15px;padding-left:10px;padding-right:10px;">
                                                <input type="checkbox" title="<?php 
        echo $_LANG['AD_VIEW_TITLE'];
        ?>
" name="showtitle" <?php 
        if ($mod['showtitle'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
 value="1">
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                            <td width="130" valign="top">
                                <div><strong><?php 
        echo $_LANG['AD_PUBLIC_DATE'];
        ?>
</strong></div>
                                <div>
                                    <input name="pubdate" type="text" id="pubdate" style="width:100px" <?php 
        if (@(!$mod['pubdate'])) {
            echo 'value="' . date('d.m.Y') . '"';
        } else {
            echo 'value="' . $mod['pubdate'] . '"';
        }
        ?>
/>

                                    <input type="hidden" name="olddate" value="<?php 
        echo @$mod['pubdate'];
        ?>
" />
                                </div>
                            </td>
                            <td width="16" valign="bottom" style="padding-bottom:10px">
                                <input type="checkbox" name="showdate" id="showdate" title="<?php 
        echo $_LANG['AD_VIEW_DATE_AND_AUTHOR'];
        ?>
" value="1" <?php 
        if ($mod['showdate'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/>
                            </td>
<!--                             <td width="160" valign="top">
                                <div><strong><?php 
        echo $_LANG['AD_ARTICLE_TEMPLATE'];
        ?>
</strong></div>
                                <div><input name="tpl" type="text" style="width:160px" value="<?php 
        echo @$mod['tpl'];
        ?>
"></div>
                            </td> -->
							  <td width="160" valign="top">
                                <div><strong>Шаблон статьи</strong></div>
								<?php 
        $inConf = cmsConfig::getInstance();
        //задаём имя директории
        $directory = PATH . "/templates/" . $inConf->template . "/components";
        $scan_dir = scandir($directory);
        if (is_dir($directory)) {
            //проверяем наличие директории
            //директория существует
            echo '<select name="tpl">';
            $scan_dir = scandir($directory);
            //сканируем (получаем массив файлов)
            array_shift($scan_dir);
            // удаляем из массива '.'
            array_shift($scan_dir);
            // удаляем из массива '..'
            for ($i = 0; $i < sizeof($scan_dir); $i++) {
                $tpl = explode("_", $scan_dir[$i]);
                if ($_GET['view'] == $tpl['1']) {
                    if ($_GET['view']) {
                        //выводим все файлы
                        if (@$mod["tpl"] == $scan_dir[$i]) {
                            echo '<option selected>' . $scan_dir[$i] . '</option>';
                        } else {
                            echo '<option>' . $scan_dir[$i] . '</option>';
                        }
                    }
                }
            }
            echo '</select>';
        } else {
            echo '<input name="tpl" type="text" style="width:160px" value="' . @$mod["tpl"] . '">';
        }
        ?>
                            </td>

                        </tr>
                    </table>

                    <div><strong><?php 
        echo $_LANG['AD_ARTICLE_NOTICE'];
        ?>
</strong></div>
                    <div><?php 
        $inCore->insertEditor('description', $mod['description'], '200', '100%');
        ?>
</div>

                    <div><strong><?php 
        echo $_LANG['AD_ARTICLE_TEXT'];
        ?>
</strong></div>
                    <?php 
        insertPanel();
        ?>
                    <div><?php 
        $inCore->insertEditor('content', $mod['content'], '400', '100%');
        ?>
</div><!--Editor text in articles-->

                    <div><strong><?php 
        echo $_LANG['AD_ARTICLE_IMG'];
        ?>
</strong></div>
                    <div><?php 
        $inCore->insertEditor('for_img', $mod['for_img'], '200', '100%');
        ?>
</div>

                    <div><strong><?php 
        echo $_LANG['AD_ARTICLE_ADD_TEXT'];
        ?>
</strong></div>
                    <div><input name="add_text" type="text" id="add_text" style="width:99%" value="<?php 
        echo htmlspecialchars($mod['add_text']);
        ?>
" /></div>


                    <div><strong><?php 
        echo $_LANG['AD_ARTICLE_TAGS'];
        ?>
</strong></div>
                    <div><input name="tags" type="text" id="tags" style="width:99%" value="<?php 
        if (isset($mod['id'])) {
            echo cmsTagLine('content', $mod['id'], false);
        }
        ?>
" /></div>

                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist">
                        <tr>
                            <td width="20">
                                <input type="radio" name="autokeys" id="autokeys1" <?php 
        if ($do == 'add' && $cfg['autokeys']) {
            ?>
checked="checked"<?php 
        }
        ?>
 value="1"/>
                            </td>
                            <td>
                                <label for="autokeys1"><strong><?php 
        echo $_LANG['AD_AUTO_GEN_KEY'];
        ?>
</strong></label>
                            </td>
                        </tr>
                        <tr>
                            <td width="20">
                                <input type="radio" name="autokeys" id="autokeys2" value="2"/>
                            </td>
                            <td>
                                <label for="autokeys2"><strong><?php 
        echo $_LANG['AD_TAGS_AS_KEY'];
        ?>
</strong></label>
                            </td>
                        </tr>
                        <tr>
                            <td width="20">
                                <input type="radio" name="autokeys" id="autokeys3" value="3" <?php 
        if ($do == 'edit' || !$cfg['autokeys']) {
            ?>
checked="checked"<?php 
        }
        ?>
/>
                            </td>
                            <td>
                                <label for="autokeys3"><strong><?php 
        echo $_LANG['AD_MANUAL_KEY'];
        ?>
</strong></label>
                            </td>
                        </tr>

                        <?php 
        if ($cfg['af_on'] && $do == 'add') {
            ?>
                        <tr>
                            <td width="20"><input type="checkbox" name="noforum" id="noforum" value="1" /> </td>
                            <td><label for="noforum"><strong><?php 
            echo $_LANG['AD_NO_CREATE_THEME'];
            ?>
</strong></label></td>
                        </tr>
                        <?php 
        }
        ?>
                    </table>

                </td>

                <!-- боковая ячейка -->
                <td width="300" valign="top" style="background:#ECECEC;">

                    <?php 
        ob_start();
        ?>

                    {tab=<?php 
        echo $_LANG['AD_TAB_PUBLISH'];
        ?>
}

                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist">
                        <tr>
                            <td width="20"><input type="checkbox" name="published" id="published" value="1" <?php 
        if ($mod['published'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/></td>
                            <td><label for="published"><strong><?php 
        echo $_LANG['AD_PUBLIC_ARTICLE'];
        ?>
</strong></label></td>
                        </tr>
                    </table>

                    <div style="margin-top:7px">
                        <select name="category_id" size="10" id="category_id" style="width:99%;height:200px">
                            <option value="1" <?php 
        if (@$mod['category_id'] == 1 || !isset($mod['category_id'])) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_ROOT_CATEGORY'];
        ?>
</option>
                            <?php 
        if (isset($mod['category_id'])) {
            echo $inCore->getListItemsNS('cms_category', $mod['category_id']);
        } else {
            echo $inCore->getListItemsNS('cms_category');
        }
        ?>
                        </select>
                    </div>

                    <div style="margin-bottom:10px">
                        <select name="showpath" id="showpath" style="width:99%">
                            <option value="0" <?php 
        if (@(!$mod['showpath'])) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_PATHWAY_NAME_ONLY'];
        ?>
</option>
                            <option value="1" <?php 
        if (@$mod['showpath']) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_PATHWAY_FULL'];
        ?>
</option>
                        </select>
                    </div>

                    <div style="margin-top:15px">
                        <strong><?php 
        echo $_LANG['AD_ARTICLE_URL'];
        ?>
</strong><br/>
                        <div style="color:gray"><?php 
        echo $_LANG['AD_IF_UNKNOWN'];
        ?>
</div>
                    </div>
                    <div>
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td><input type="text" name="url" value="<?php 
        echo $mod['url'];
        ?>
" style="width:100%"/></td>
                                <td width="40" align="center">.html</td>
                            </tr>
                        </table>
                    </div>

                    <div style="margin-top:10px">
                        <strong><?php 
        echo $_LANG['AD_ARTICLE_AUTHOR'];
        ?>
</strong>
                    </div>
                    <div>
                        <select name="user_id" id="user_id" style="width:99%">
                          <?php 
        if (isset($mod['user_id'])) {
            echo $inCore->getListItems('cms_users', $mod['user_id'], 'nickname', 'ASC', 'is_deleted=0 AND is_locked=0', 'id', 'nickname');
        } else {
            echo $inCore->getListItems('cms_users', $inUser->id, 'nickname', 'ASC', 'is_deleted=0 AND is_locked=0', 'id', 'nickname');
        }
        ?>
                        </select>
                    </div>

                    <div style="margin-top:12px"><strong><?php 
        echo $_LANG['AD_PHOTO'];
        ?>
</strong></div>
                    <div style="margin-bottom:10px">
                        <?php 
        if ($do == 'edit') {
            if (isset($_SESSION['lang']) && $_SESSION['lang'] != 'ru') {
                $mod_id = $mod['id'] . '_' . $_SESSION['lang'];
                $id_art = $mod['id'] . '_' . $_SESSION['lang'];
            } else {
                $mod_id = $mod['id'];
                $id_art = $id;
            }
            //if (file_exists(PATH.'/images/photos/small/article'.$mod['id'].'.jpg')){
            if (file_exists(PATH . '/images/photos/small/article' . $mod_id . '.jpg')) {
                ?>
                        <div style="margin-top:3px;margin-bottom:3px;padding:10px;border:solid 1px gray;text-align:center">
                            <?/*php<img src="/images/photos/small/article<?php 
                echo $id;
                ?>
.jpg" border="0" />*/?>
                            <img src="/images/photos/small/article<?php 
                echo $id_art;
                ?>
.jpg" border="0" />
                        </div>
                        <table cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td width="16"><input type="checkbox" id="delete_image" name="delete_image" value="1" /></td>
                                <td><label for="delete_image"><?php 
                echo $_LANG['AD_PHOTO_REMOVE'];
                ?>
</label></td>
                            </tr>
                        </table>
                        <?php 
            }
        }
        ?>
                        <input type="file" name="picture" style="width:100%" />
                    </div>

                    <div style="margin-top:25px"><strong><?php 
        echo $_LANG['AD_PUBLIC_PARAMETRS'];
        ?>
</strong></div>
                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist">
                        <tr>
                            <td width="20"><input type="checkbox" name="show_in_new" id="show_in_new" value="1" <?php 
        if ($mod['show_in_new'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/></td>
                            <td><label for="show_in_new"><?php 
        echo $_LANG['AD_VIEW_NEW_CATS'];
        ?>
</label></td>
                        </tr>
                        <tr>
                            <td width="20"><input type="checkbox" name="show_in_footer" id="show_in_footer" value="1" <?php 
        if ($mod['show_in_footer'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/></td>
                            <td><label for="show_in_footer"><?php 
        echo $_LANG['AD_VIEW_FOOTER'];
        ?>
</label></td>
                        </tr>
                        <tr>
                            <td width="20"><input type="checkbox" name="showlatest" id="showlatest" value="1" <?php 
        if ($mod['showlatest'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/></td>
                            <td><label for="showlatest"><?php 
        echo $_LANG['AD_VIEW_NEW_ARTICLES'];
        ?>
</label></td>
                        </tr>
                        <tr>
                            <td width="20"><input type="checkbox" name="comments" id="comments" value="1" <?php 
        if ($mod['comments'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/></td>
                            <td><label for="comments"><?php 
        echo $_LANG['AD_ENABLE_COMMENTS'];
        ?>
</label></td>
                        </tr>
                        <tr>
                            <td width="20"><input type="checkbox" name="canrate" id="canrate" value="1" <?php 
        if ($mod['canrate']) {
            echo 'checked="checked"';
        }
        ?>
/></td>
                            <td><label for="canrate"><?php 
        echo $_LANG['AD_ENABLE_RATING'];
        ?>
</label></td>
                        </tr>
                    </table>

                    <?php 
        if ($do == 'add') {
            ?>
                        <div style="margin-top:25px">
                            <strong><?php 
            echo $_LANG['AD_CREATE_LINK'];
            ?>
</strong>
                        </div>
                        <div>
                            <select name="createmenu" id="createmenu" style="width:99%">
                                <option value="0" selected="selected"><?php 
            echo $_LANG['AD_DONT_CREATE_LINK'];
            ?>
</option>
                            <?php 
            foreach ($menu_list as $menu) {
                ?>
                                <option value="<?php 
                echo $menu['id'];
                ?>
">
                                    <?php 
                echo $menu['title'];
                ?>
                                </option>
                            <?php 
            }
            ?>
                            </select>
                        </div>
                    <?php 
        }
        ?>

                    {tab=<?php 
        echo $_LANG['AD_DATE'];
        ?>
}

                    <div style="margin-top:5px">
                        <strong><?php 
        echo $_LANG['AD_ARTICLE_TIME'];
        ?>
</strong>
                    </div>
                    <div>
                        <select name="is_end" id="is_end" style="width:99%" onchange="if($(this).val() == 1){ $('#final_time').show(); }else {$('#final_time').hide();}">
                            <option value="0" <?php 
        if (@(!$mod['is_end'])) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_UNLIMITED'];
        ?>
</option>
                            <option value="1" <?php 
        if (@$mod['is_end']) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_TO_FINAL_TIME'];
        ?>
</option>
                        </select>
                    </div>

                    <div id="final_time" <?php 
        if (@(!$mod['is_end'])) {
            echo 'style="display: none"';
        }
        ?>
>
                    <div style="margin-top:20px">
                        <strong><?php 
        echo $_LANG['AD_FINAL_TIME'];
        ?>
</strong><br/>
                        <span class="hinttext"><?php 
        echo $_LANG['AD_CALENDAR_FORMAT'];
        ?>
</span>
                    </div>
                    <div><input name="enddate" type="text" style="width:80%" <?php 
        if (@(!$mod['is_end'])) {
            echo 'value="' . date('d.m.Y') . '"';
        } else {
            echo 'value="' . $mod['enddate'] . '"';
        }
        ?>
id="enddate" /></div></div>


                    {tab=SEO}

                    <div style="margin-top:5px">
                        <strong><?php 
        echo $_LANG['AD_PAGE_TITLE'];
        ?>
</strong><br/>
                        <span class="hinttext"><?php 
        echo $_LANG['AD_IF_UNKNOWN_PAGETITLE'];
        ?>
</span>
                    </div>
                    <div>
                        <input name="pagetitle" type="text" id="pagetitle" style="width:99%" value="<?php 
        if (isset($mod['pagetitle'])) {
            echo htmlspecialchars($mod['pagetitle']);
        }
        ?>
" />
                    </div>

                    <div style="margin-top:20px">
                        <strong><?php 
        echo $_LANG['KEYWORDS'];
        ?>
</strong><br/>
                        <span class="hinttext"><?php 
        echo $_LANG['AD_FROM_COMMA'];
        ?>
</span>
                    </div>
                    <div>
                         <textarea name="meta_keys" style="width:97%" rows="4" id="meta_keys"><?php 
        echo htmlspecialchars($mod['meta_keys']);
        ?>
</textarea>
                    </div>

                    <div style="margin-top:20px">
                        <strong><?php 
        echo $_LANG['DESCRIPTION'];
        ?>
</strong><br/>
                        <span class="hinttext"><?php 
        echo $_LANG['AD_LESS_THAN'];
        ?>
</span>
                    </div>
                    <div>
                         <textarea name="meta_desc" style="width:97%" rows="6" id="meta_desc"><?php 
        echo htmlspecialchars($mod['meta_desc']);
        ?>
</textarea>
                    </div>

                    {tab=<?php 
        echo $_LANG['AD_TAB_ACCESS'];
        ?>
}

                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist" style="margin-top:5px">
                        <tr>
                            <td width="20">
                                <?php 
        $sql = "SELECT * FROM cms_user_groups";
        $result = $inDB->query($sql);
        $style = 'disabled="disabled"';
        $public = 'checked="checked"';
        if ($do == 'edit') {
            $sql2 = "SELECT * FROM cms_content_access WHERE content_id = " . $mod['id'] . " AND content_type = 'material'";
            $result2 = $inDB->query($sql2);
            $ord = array();
            if ($inDB->num_rows($result2)) {
                $public = '';
                $style = '';
                while ($r = $inDB->fetch_assoc($result2)) {
                    $ord[] = $r['group_id'];
                }
            }
        }
        ?>
                                <input name="is_public" type="checkbox" id="is_public" onclick="checkGroupList()" value="1" <?php 
        echo $public;
        ?>
 />
                            </td>
                            <td><label for="is_public"><strong><?php 
        echo $_LANG['AD_SHARE'];
        ?>
</strong></label></td>
                        </tr>
                    </table>
                    <div style="padding:5px">
                        <span class="hinttext">
                            <?php 
        echo $_LANG['AD_IF_NOTED'];
        ?>
                        </span>
                    </div>

                    <div style="margin-top:10px;padding:5px;padding-right:0px;" id="grp">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_GROUPS_VIEW'];
        ?>
</strong><br />
                            <span class="hinttext">
                                <?php 
        echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
        ?>
                            </span>
                        </div>
                        <div>
                            <?php 
        echo '<select style="width: 99%" name="showfor[]" id="showin" size="6" multiple="multiple" ' . $style . '>';
        if ($inDB->num_rows($result)) {
            while ($item = $inDB->fetch_assoc($result)) {
                echo '<option value="' . $item['id'] . '"';
                if ($do == 'edit') {
                    if (inArray($ord, $item['id'])) {
                        echo 'selected="selected"';
                    }
                }
                echo '>';
                echo $item['title'] . '</option>';
            }
        }
        echo '</select>';
        ?>
                        </div>
                    </div>

                    {/tabs}

                    <?php 
        echo jwTabs(ob_get_clean());
        ?>

                </td>

            </tr>
        </table>

        <p>
            <input name="add_mod" type="submit" id="add_mod" <?php 
        if ($do == 'add') {
            echo 'value="' . $_LANG['AD_CREATE_CONTENT'] . '"';
        } else {
            echo 'value="' . $_LANG['AD_SAVE_CONTENT'] . '"';
        }
        ?>
 />
            <input name="back" type="button" id="back" value="<?php 
        echo $_LANG['CANCEL'];
        ?>
" onclick="window.history.back();"/>
            <input name="do" type="hidden" id="do" <?php 
        if ($do == 'add') {
            echo 'value="submit"';
        } else {
            echo 'value="update"';
        }
        ?>
 />
            <?php 
        if ($do == 'edit') {
            echo '<input name="id" type="hidden" value="' . $mod['id'] . '" />';
        }
        ?>
        </p>
    </form>
    <?php 
    }
}
Example #29
0
    if (!cmsCore::inRequest('submit')) {
        $inPage->initAutocomplete();
        $autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
        cmsPage::initTemplate('components', 'com_photos_add1')->assign('no_tags', false)->assign('is_admin', $inUser->is_admin)->assign('cfg', $model->config)->assign('autocomplete_js', $autocomplete_js)->display('com_photos_add1.tpl');
    }
    if (cmsCore::inRequest('submit')) {
        $mod = array();
        $mod['title'] = cmsCore::request('title', 'str', '');
        $mod['description'] = cmsCore::request('description', 'str');
        $mod['is_multi'] = cmsCore::request('only_mod', 'int', 0);
        $mod['tags'] = cmsCore::request('tags', 'str');
        $mod['comments'] = $inUser->is_admin ? cmsCore::request('comments', 'int') : 1;
        if ($model->config['seo_user_access'] || $inUser->is_admin) {
            $mod['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
            $mod['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
            $mod['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
        }
        cmsUser::sessionPut('mod', $mod);
        cmsCore::redirect('/photos/' . $album['id'] . '/submit_photo.html');
    }
}
////////////////// форма загрузки фотографий 2 шаг /////////////////////////////
if ($do_photo == 'submit_photo') {
    $mod = cmsUser::sessionGet('mod');
    if (!$mod) {
        cmsCore::error404();
    }
    $inPage->addPathway($_LANG['ADD_PHOTO'] . ': ' . $_LANG['STEP_2']);
    $inPage->setTitle($_LANG['ADD_PHOTO'] . ': ' . $_LANG['STEP_2']);
    if ($album['uplimit'] && !$inUser->is_admin) {
        $max_limit = true;
Example #30
0
 /**
  * Печатает головную область страницы
  */
 public function printHead()
 {
     $this->addHeadJsLang(array('SEND', 'CONTINUE', 'CLOSE', 'SAVE', 'CANCEL', 'ATTENTION', 'CONFIRM', 'LOADING', 'ERROR', 'ADD', 'SELECT_CITY', 'SELECT'));
     $this->page_head = cmsCore::callEvent('PRINT_PAGE_HEAD', $this->page_head);
     // Если есть пагинация и страница больше первой, добавляем "страница №"
     if ($this->site_cfg->title_and_page) {
         $page = cmsCore::request('page', 'int', 1);
         if ($page > 1) {
             global $_LANG;
             $this->title = $this->title . ' — ' . $_LANG['PAGE'] . ' №' . $page;
         }
     }
     // Заголовок страницы
     echo '<title>', htmlspecialchars($this->title), '</title>', "\n";
     // Ключевые слова
     echo '<meta name="keywords" content="', htmlspecialchars($this->page_keys), '" />', "\n";
     // Описание
     echo '<meta name="description" content="', htmlspecialchars($this->page_desc), '" />', "\n";
     // Изображение
     if ($this->page_img) {
         echo '<link rel="image_src" href="', htmlspecialchars($this->page_img), '" />', "\n";
     }
     //Оставшиеся теги
     foreach ($this->page_head as $value) {
         echo $value, "\n";
     }
     // LANG переменные
     echo '<script type="text/javascript">';
     foreach ($this->page_lang as $value) {
         echo $value;
     }
     echo '</script>', "\n";
 }