Beispiel #1
0
 private function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     cmsCore::loadLanguage('components/blogs');
     cmsCore::loadLib('tags');
     cmsCore::loadLib('karma');
 }
Beispiel #2
0
 public function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     $this->config = cmsCore::getInstance()->loadComponentConfig('clubs');
     cmsCore::loadLanguage('components/clubs');
     cmsCore::loadLib('karma');
 }
Beispiel #3
0
 /**
  * Инициализирует почтовый транспорт по настройкам
  * из глобального конфига сайта
  * @return \cmsMailer
  */
 public function initTransport()
 {
     $config = cmsConfig::getInstance();
     // PHP mail()
     if ($config->mail_transport == 'mail') {
         return $this;
     }
     // SMTP Server
     if ($config->mail_transport == 'smtp') {
         cmsCore::loadLib('phpmailer/class.smtp', 'SMTP');
         $this->mailer->IsSMTP();
         $this->mailer->Host = $config->mail_smtp_server;
         $this->mailer->Port = $config->mail_smtp_port;
         $this->mailer->SMTPAuth = (bool) $config->mail_smtp_auth;
         $this->mailer->SMTPKeepAlive = true;
         $this->mailer->Username = $config->mail_smtp_user;
         $this->mailer->Password = $config->mail_smtp_pass;
         if (!empty($config->mail_smtp_enc)) {
             $this->mailer->SMTPSecure = $config->mail_smtp_enc;
         }
         return $this;
     }
     // SendMail
     if ($config->mail_transport == 'sendmail') {
         $this->mailer->IsSendmail();
         return $this;
     }
 }
Beispiel #4
0
 public function __construct()
 {
     $config = cmsConfig::getInstance();
     cmsCore::loadLib('phpmailer/class.phpmailer', 'PHPMailer');
     $this->mailer = new PHPMailer();
     $this->mailer->CharSet = 'UTF-8';
     $this->initTransport()->setFrom($config->mail_from)->setBodyText(LANG_MAIL_DEFAULT_ALT);
 }
Beispiel #5
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
         // подключаем хелпер основного шаблона
         if (!cmsCore::includeFile('templates/' . self::$instance->getName() . '/assets/helper.php')) {
             cmsCore::loadLib('template.helper');
         }
     }
     return self::$instance;
 }
Beispiel #6
0
 public function __construct() {
     $this->query  = self::getQuery();
     $this->look   = cmsCore::request('look', 'str', 'allwords');
     $this->page   = cmsCore::request('page', 'int', 1);
     $this->from_pubdate = cmsCore::request('from_pubdate', 'str', '');
     $this->order_by_date = cmsCore::request('order_by_date', array(0, 1), 0);
     $this->from_component = self::getComponentsArrayForSearch();
     $this->config = cmsCore::getInstance()->loadComponentConfig('search');
     cmsCore::loadLib('tags');
     $this->getComponentsWithSupportSearch();
     $this->parametrs_array = $this->gatherAnArrayOfQueryParametrs();
     cmsCore::loadLanguage('other/sphinx');
 }
Beispiel #7
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();
    }
}
Beispiel #8
0
 function __construct($name = '')
 {
     $config = cmsConfig::getInstance();
     $this->name = $name ? $name : $config->template;
     $this->setLayout('main');
     $this->title = $config->sitename;
     $is_no_def_meta = isset($config->is_no_meta) ? $config->is_no_meta : false;
     if (!$is_no_def_meta) {
         $this->metakeys = $config->metakeys;
         $this->metadesc = $config->metadesc;
     }
     $this->path = $config->root_path . 'templates/' . $this->name;
     $this->options = $this->getOptions();
     if (!cmsCore::includeFile('templates/' . $this->name . '/assets/helper.php')) {
         cmsCore::loadLib('template.helper');
     }
 }
Beispiel #9
0
 /**
  * Преобразует YAML в массив
  * @param string $yaml
  * @return array
  */
 public static function yamlToArray($yaml)
 {
     cmsCore::loadLib('spyc.class');
     return Spyc::YAMLLoadString($yaml);
 }
Beispiel #10
0
 private function __construct(){
     cmsCore::loadLib('tags');
     cmsCore::loadLanguage('components/photos');
 }
Beispiel #11
0
<?php

// Определяем корень
define('PATH', dirname(__FILE__));
define('ROOT', $_SERVER['DOCUMENT_ROOT']);
// Устанавливаем кодировку
mb_internal_encoding('UTF-8');
// Подключаем автозагрузчик классов
require_once PATH . '/system/config/autoload.php';
// Устанавливаем обработчик автозагрузки классов
spl_autoload_register('autoLoadCoreClass');
// Инициализируем конфиг
$config = cmsConfig::getInstance();
// Загружаем локализацию
cmsCore::loadLanguage();
// Устанавливаем часовую зону
date_default_timezone_set($config->time_zone);
// Подключаем все необходимые классы и библиотеки
cmsCore::loadLib('html.helper');
cmsCore::loadLib('strings.helper');
cmsCore::loadLib('files.helper');
// Инициализируем ядро
$core = cmsCore::getInstance();
// Подключаем базу
$core->connectDB();
// Запускаем кеш
cmsCache::getInstance()->start();
Beispiel #12
0
 public function __construct()
 {
     $this->inDB = cmsDatabase::getInstance();
     cmsCore::loadLib('tags');
     $this->config = cmsCore::getInstance()->loadComponentConfig('catalog');
 }
Beispiel #13
0
 public function __construct() {
     $this->config = cmsCore::getInstance()->loadComponentConfig('photos');
     cmsCore::loadLib('karma');
     cmsCore::loadLanguage('components/photos');
 }
Beispiel #14
0
 public function __construct() {
     $this->config = cmsCore::getInstance()->loadComponentConfig('content');
     cmsCore::loadLib('tags');
     cmsCore::loadLib('karma');
 }
Beispiel #15
0
 private function __construct(){
     cmsCore::loadLanguage('components/blogs');
     cmsCore::loadLib('tags');
     cmsCore::loadLib('karma');
 }
Beispiel #16
0
 public function actionIndex()
 {
     header('X-Frame-Options: DENY');
     // $original_url для кириллических доменов
     $url = $original_url = urldecode($this->request->get('url', ''));
     if (!$url) {
         cmsCore::error404();
     }
     if ($this->request->isAjax()) {
         cmsCore::error404();
     }
     $url_host = parse_url($url, PHP_URL_HOST);
     if (!$url_host) {
         cmsCore::error404();
     }
     if (!empty($this->options['is_check_refer'])) {
         if (empty($_SERVER['HTTP_REFERER'])) {
             cmsCore::error404();
         }
         if (strpos($_SERVER['HTTP_REFERER'], $this->cms_config->protocol . $_SERVER['HTTP_HOST']) !== 0) {
             cmsCore::error404();
         }
     }
     // кириллические домены
     if (preg_match('/^[а-яё]+/iu', $url_host)) {
         cmsCore::loadLib('idna_convert.class');
         $IDN = new idna_convert();
         $host = $IDN->encode($url_host);
         $url = str_ireplace($url_host, $host, $url);
     }
     // ссылки, по которым редиректить сразу
     if (!empty($this->options['no_redirect_list_array'])) {
         if (in_array($url_host, $this->options['no_redirect_list_array'], true)) {
             $this->redirect($url);
         }
     }
     // флаг бана домена
     $is_domain_banned = false;
     // флаг того, что домен в нашем черном списке
     $is_domain_in_black_list = false;
     // сначала проверяем черный список
     if (!empty($this->options['black_list_array'])) {
         if (in_array($url_host, $this->options['black_list_array'])) {
             $is_domain_banned = true;
             $is_domain_in_black_list = true;
         }
     }
     // если пользователь поставил "печеньку"
     if (!$is_domain_in_black_list && $this->cms_user->is_logged && cmsUser::getCookie('allow_redirect')) {
         $this->redirect($url);
     }
     // теперь проверяем ссылку
     if (!$is_domain_banned && function_exists('curl_init') && !empty($this->options['is_check_link'])) {
         if (empty($this->options['white_list_array']) || $this->options['white_list_array'] && !in_array($url_host, $this->options['white_list_array'])) {
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, 'https://api.vk.com/method/utils.checkLink?url=' . $url);
             curl_setopt($ch, CURLOPT_HEADER, false);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_TIMEOUT, 2);
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
             curl_setopt($ch, CURLOPT_USERAGENT, 'InstantCMS/2.0 +' . cmsConfig::get('host'));
             $data = json_decode(curl_exec($ch), true);
             if (!isset($data['error']) && isset($data['response'])) {
                 $is_domain_banned = $data['response']['status'] == 'banned';
                 $url = $data['response']['link'];
             }
         }
     }
     return $this->cms_template->render('index', array('url' => $url, 'user' => $this->cms_user, 'original_url' => $original_url, 'is_domain_banned' => $is_domain_banned, 'is_domain_in_black_list' => $is_domain_in_black_list, 'sitename' => cmsConfig::get('sitename'), 'host' => cmsConfig::get('host'), 'redirect_time' => $this->options['redirect_time']));
 }
Beispiel #17
0
//                                                                            //
//                           InstantCMS v1.10.4                               //
//                        http://www.instantcms.ru/                           //
//                                                                            //
//                   written by InstantCMS Team, 2007-2014                    //
//                produced by InstantSoft, (www.instantsoft.ru)               //
//                                                                            //
//                        LICENSED BY GNU/GPL v2                              //
//                                                                            //
/******************************************************************************/
define('PATH', $_SERVER['DOCUMENT_ROOT']);
include PATH . '/core/ajax/ajax_core.php';
if (!$inUser->id) {
    cmsCore::halt();
}
cmsCore::loadLib('karma');
$post_id = cmsCore::request('post_id', 'int');
$vote = cmsCore::request('vote', 'int');
if (!$post_id || abs($vote) != 1) {
    cmsCore::halt();
}
$user_id = $inDB->get_field('cms_forum_posts', "id='{$post_id}'", 'user_id');
if (!$user_id) {
    cmsCore::halt();
}
if ($inUser->id != $user_id) {
    cmsSubmitKarma('forum_post', $post_id, $vote);
}
$karma = cmsKarma('forum_post', $post_id);
if ($karma['points'] > 0) {
    $karma['points'] = '<span class="cmm_good">+' . $karma['points'] . '</span>';
Beispiel #18
0
    public function deletePhoto($photo_id) {

        cmsCore::loadLib('tags');

        $sql = "SELECT imageurl FROM cms_user_photos WHERE id = '{$photo_id}'";
        $result = $this->inDB->query($sql);

        if ($this->inDB->num_rows($result)){
            $photo = $this->inDB->fetch_assoc($result);
            @unlink(PATH.'/images/users/photos/'.$photo['imageurl']);
            @unlink(PATH.'/images/users/photos/small/'.$photo['imageurl']);
            @unlink(PATH.'/images/users/photos/medium/'.$photo['imageurl']);
            $this->inDB->query("DELETE FROM cms_user_photos WHERE id = $photo_id") ;
            cmsCore::deleteComments('userphoto', $photo_id);
			cmsActions::removeObjectLog('add_user_photo', $photo_id);
            cmsClearTags('userphoto', $photo_id);
        }

        return true;

    }
Beispiel #19
0
function applet_tree()
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inPage = cmsPage::getInstance();
    cmsCore::loadLib('tags');
    global $_LANG;
    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');
    $GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/content.js"></script>';
    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('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content');
        $toolmenu[] = 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;
        $hide_cats = cmsCore::request('hide_cats', 'int', 0);
        $cats = $model->getCatsTree();
        if ($category_id) {
            $model->whereCatIs($category_id);
        }
        if ($title_part) {
            $inDB->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
        }
        if ($only_hidden) {
            $inDB->where('con.published = 0');
        }
        $inDB->orderBy($orderby, $orderto);
        $inDB->limitPage($page, $perpage);
        $total = $model->getArticlesCount(false);
        $items = $model->getArticlesList(false);
        $pages = ceil($total / $perpage);
        $tpl_file = 'admin/content.php';
        $tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
        include $tpl_dir . $tpl_file;
    }
}
Beispiel #20
0
} else {
    error_reporting(E_ALL);
}
// Проверяем, что система установлена
if (!$config->isReady()) {
    $root = str_replace(str_replace(DIRECTORY_SEPARATOR, '/', realpath(ROOT)), '', str_replace(DIRECTORY_SEPARATOR, '/', PATH));
    header('location:' . $root . '/install/');
    die;
}
// Устанавливаем часовую зону
date_default_timezone_set($config->time_zone);
// Подключаем все необходимые классы и библиотеки
cmsCore::loadLib('html.helper');
cmsCore::loadLib('strings.helper');
cmsCore::loadLib('files.helper');
cmsCore::loadLib('spyc.class');
// Инициализируем ядро
$core = cmsCore::getInstance();
// Загружаем локализацию
cmsCore::loadLanguage();
// устанавливаем локаль языка
if (function_exists('lang_setlocale')) {
    lang_setlocale();
}
// Подключаем базу
$core->connectDB();
if (!$core->db->ready()) {
    cmsCore::error(ERR_DATABASE_CONNECT, $core->db->connectError());
}
// Запускаем кеш
cmsCache::getInstance()->start();
Beispiel #21
0
    $inPage->addPathway($_LANG['PHOTOALBUMS']);
    //Отдаем в шаблон
    cmsPage::initTemplate('components', 'com_users_albums')->assign('albums', $albums)->assign('my_profile', $my_profile)->assign('user', $usr)->display('com_users_albums.tpl');
}
/////////////////////////////// VIEW PHOTO /////////////////////////////////////////////////////////////////////////////////////////
if ($pdo == 'viewphoto') {
    if (!$inUser->id && !$model->config['sw_guest']) {
        cmsUser::goToLogin();
    }
    $photoid = cmsCore::request('photoid', 'int', 0);
    $myprofile = $inUser->id == $id;
    $usr = cmsUser::getShortUserData($id);
    if (!$usr) {
        cmsCore::error404();
    }
    cmsCore::loadLib('tags');
    $sql = "SELECT p.*, a.title as album, pr.gender\n            FROM cms_user_photos p\n\t\t\tINNER JOIN cms_user_albums a ON a.id = p.album_id\n\t\t\tINNER JOIN cms_user_profiles pr ON pr.user_id = p.user_id\n            WHERE p.id = '{$photoid}' AND p.user_id = '{$id}' LIMIT 1";
    $result = $inDB->query($sql);
    if (!$inDB->num_rows($result)) {
        cmsCore::error404();
    }
    $photo = $inDB->fetch_assoc($result);
    $inPage->setTitle($photo['title']);
    $inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
    $inPage->addPathway($_LANG['PHOTOALBUMS'], '/users/' . $usr['id'] . '/photoalbum.html');
    $inPage->addPathway($photo['album'], '/users/' . $usr['login'] . '/photos/private' . $photo['album_id'] . '.html');
    $inPage->addPathway($photo['title']);
    $photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], true, false, false);
    $photo['genderlink'] = cmsUser::getGenderLink($usr['id'], $usr['nickname'], $photo['gender'], $usr['login']);
    $photo['filesize'] = round(filesize(PATH . '/images/users/photos/medium/' . $photo['imageurl']) / 1024, 2);
    //ссылки на предыдущую и следующую фотографии
Beispiel #22
0
 public function parseCode($content)
 {
     cmsCore::loadLib('geshi/geshi', 'GeSHi');
     $geshi = new GeSHi(trim($content), 'php');
     return $geshi->parse_code();
 }
Beispiel #23
0
if (!$config->isReady()) {
    $root = str_replace(str_replace(DIRECTORY_SEPARATOR, '/', realpath(ROOT)), '', str_replace(DIRECTORY_SEPARATOR, '/', PATH));
    header('location:' . $root . '/install/');
    die;
}
// Загружаем локализацию
cmsCore::loadLanguage();
// устанавливаем локаль языка
if (function_exists('lang_setlocale')) {
    lang_setlocale();
}
// Устанавливаем часовую зону
date_default_timezone_set($config->time_zone);
// Подключаем все необходимые классы и библиотеки
cmsCore::loadLib('html.helper');
cmsCore::loadLib('strings.helper');
cmsCore::loadLib('files.helper');
cmsCore::loadLib('spyc.class');
// подключаем хелпер шаблона, если он есть
if (!cmsCore::includeFile('templates/' . $config->template . '/assets/helper.php')) {
    cmsCore::loadLib('template.helper');
}
// Инициализируем ядро
$core = cmsCore::getInstance();
// Подключаем базу
$core->connectDB();
if (!$core->db->ready()) {
    cmsCore::error(ERR_DATABASE_CONNECT, $core->db->connectError());
}
// Запускаем кеш
cmsCache::getInstance()->start();
Beispiel #24
0
 private static function loadDeviceType()
 {
     $device_type = (string) cmsUser::getCookie('device_type');
     if (!$device_type || !in_array($device_type, self::$device_types, true)) {
         cmsCore::loadLib('mobile_detect.class');
         $detect = new Mobile_Detect();
         $device_type = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'mobile' : 'desktop';
         cmsUser::setCookie('device_type', $device_type, 31536000);
         // на 1 год
     }
     self::$device_type = $device_type;
 }