Example #1
0
 public function make()
 {
     $params = array();
     $news_count = extension::getInstance()->getConfig('new_count', 'news_new', extension::TYPE_MODULE, 'int');
     if ($news_count < 1) {
         $news_count = 1;
     }
     $stmt = database::getInstance()->con()->prepare("SELECT a.id,a.title,a.link,b.path FROM " . property::getInstance()->get('db_prefix') . "_com_news_entery a," . property::getInstance()->get('db_prefix') . "_com_news_category b\n                        WHERE a.category = b.category_id AND a.display > 0 ORDER BY a.date DESC LIMIT 0,?");
     $stmt->bindParam(1, $news_count, \PDO::PARAM_INT);
     $stmt->execute();
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($result as $row) {
         $full_path = null;
         $image = null;
         if (property::getInstance()->get('use_multi_language')) {
             $full_path .= '/' . language::getInstance()->getUseLanguage();
         }
         $full_path .= '/news/';
         if ($row['path'] != null) {
             $full_path .= $row['path'] . '/';
         }
         $full_path .= $row['link'];
         $serial_title = system::getInstance()->altstripslashes(unserialize($row['title']));
         if (file_exists(root . '/upload/news/poster_' . $row['id'] . '.jpg')) {
             $image = 'poster_' . $row['id'];
         }
         $params['latest'][] = array('title' => $serial_title[language::getInstance()->getUseLanguage()], 'image' => $image, 'pathway' => $full_path);
     }
     $tmp = template::getInstance()->twigRender('modules/news_new/list.tpl', array('local' => $params));
     template::getInstance()->set(template::TYPE_MODULE, 'news_new', $tmp);
 }
Example #2
0
 public function make()
 {
     $params = array();
     // get all menu data - 1 query with 2 left joins is better then 2 query's for each menu.
     $stmt = database::getInstance()->con()->query("SELECT h.*, g.g_id, g.g_name, g.g_url, d.d_name, d.d_url FROM `" . property::getInstance()->get('db_prefix') . "_mod_menu_gitem` as g\n        LEFT OUTER JOIN `" . property::getInstance()->get('db_prefix') . "_mod_menu_ditem` as d ON g.g_id = d.d_owner_gid\n        LEFT OUTER JOIN `" . property::getInstance()->get('db_prefix') . "_mod_menu_header` as h ON h.menu_id = g.g_menu_head_id\n        WHERE h.menu_display = 1\n        ORDER BY g.g_priority ASC, d.d_priority ASC");
     $resultItems = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($resultItems as $row) {
         $serial_hname = unserialize($row['menu_name']);
         $serial_gname = unserialize($row['g_name']);
         $serial_dname = unserialize($row['d_name']);
         $params['modmenu'][$row['menu_id']]['name'] = $serial_hname[language::getInstance()->getUseLanguage()];
         $params['modmenu'][$row['menu_id']]['tag'] = $row['menu_tag'];
         $params['modmenu'][$row['menu_id']]['tpl'] = $row['menu_tpl'];
         $params['modmenu'][$row['menu_id']]['item'][$row['g_id']]['name'] = $serial_gname[language::getInstance()->getUseLanguage()];
         $params['modmenu'][$row['menu_id']]['item'][$row['g_id']]['url'] = $this->urlRelativeToAbsolute($row['g_url']);
         if ($row['d_name'] != null) {
             $params['modmenu'][$row['menu_id']]['item'][$row['g_id']]['depend_array'][] = array('name' => $serial_dname[language::getInstance()->getUseLanguage()], 'url' => $this->urlRelativeToAbsolute($row['d_url']));
         }
     }
     $set_var = array();
     foreach ($params['modmenu'] as $menu) {
         $tag = $menu['tag'];
         $tpl = $menu['tpl'];
         $compile_tpl = template::getInstance()->twigRender('modules/menu/' . $tpl, array('modmenu' => $menu));
         $set_var[$tag] = $compile_tpl;
     }
     template::getInstance()->set(template::TYPE_MODULE, 'menu', $set_var);
 }
Example #3
0
 /**
  * Search and replace URL's for site mirrors
  * @param $text
  * @param bool $special_syntax
  * @return array|mixed
  */
 public function fix($text, $special_syntax = true)
 {
     if (!system::getInstance()->contains(';', property::getInstance()->get('source_url'))) {
         // if only single url is defined
         return $text;
     }
     if (is_array($text)) {
         $result = array();
         foreach ($text as $language => $i_text) {
             $result[$language] = $this->fix($i_text);
         }
         return $result;
     } else {
         if (!$special_syntax) {
             $text = system::getInstance()->nohtml($text);
             $bbobject = extension::getInstance()->call(extension::TYPE_HOOK, 'bbtohtml');
             if (is_object($bbobject)) {
                 $text = $bbobject->nobbcode($text);
             }
         }
         $available_url = system::getInstance()->altexplode(';', property::getInstance()->get('source_url'));
         $used_url = property::getInstance()->get('script_url');
         $result = str_replace($available_url, $used_url, $text);
         if (property::getInstance()->get('user_friendly_url')) {
             // if url/index.php/ is used
             // url/index.php/ to url/
             $no_humanurls = $used_url . '/index.php/';
             $result = str_replace($no_humanurls, $used_url . '/', $result);
         } else {
             // try to set links to non-user friendly model /index.php/lang/ from /lang/
             foreach (language::getInstance()->getAvailable() as $s_lang) {
                 $source_human_urls = $used_url . '/' . $s_lang . '/';
                 $replacement_human_urls = $used_url . '/index.php/' . $s_lang . '/';
                 $result = str_replace($source_human_urls, $replacement_human_urls, $result);
             }
         }
         // if disabled multi-lang
         // /ru/page.html to /page.html, /index.php/ru/page.html to /index.php/page.html
         if (!property::getInstance()->get('use_multi_language')) {
             $to_replace = array();
             $replacement = null;
             foreach (language::getInstance()->getAvailable() as $s_lang) {
                 $to_replace[] = $used_url . '/index.php/' . $s_lang . '/';
                 $to_replace[] = $used_url . '/' . $s_lang . '/';
             }
             if (property::getInstance()->get('user_friendly_url')) {
                 $replacement = $used_url . '/';
             } else {
                 $replacement = $used_url . '/index.php/';
             }
             $result = str_replace($to_replace, $replacement, $result);
         }
         return $result;
     }
 }
Example #4
0
 public function make()
 {
     $params = array();
     $way = router::getInstance()->shiftUriArray();
     $item_per_page = extension::getInstance()->getConfig('count_stream_page', 'stream', extension::TYPE_COMPONENT, 'int');
     if ($item_per_page < 1) {
         $item_per_page = 10;
     }
     $page_index = (int) $way[0];
     $db_index = $page_index * $item_per_page;
     $seo_title = language::getInstance()->get('stream_title');
     if ($page_index > 0) {
         $seo_title .= " - " . $page_index;
     }
     meta::getInstance()->add('title', $seo_title);
     $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_stream ORDER BY `date` DESC LIMIT ?,?");
     $stmt->bindParam(1, $db_index, \PDO::PARAM_INT);
     $stmt->bindParam(2, $item_per_page, \PDO::PARAM_INT);
     $stmt->execute();
     $resultAll = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     $ids = system::getInstance()->extractFromMultyArray('caster_id', $resultAll);
     $load_id = array();
     foreach ($ids as $id) {
         if (system::getInstance()->isInt($id)) {
             $load_id[] = $id;
         }
     }
     user::getInstance()->listload($load_id);
     $urlfix_object = extension::getInstance()->call(extension::TYPE_HOOK, 'urlfixer');
     $bbobject = extension::getInstance()->call(extension::TYPE_HOOK, 'bbtohtml');
     foreach ($resultAll as $row) {
         $url_target = $row['target_object'];
         $text_target = system::getInstance()->nohtml($row['text_preview']);
         if (is_object($urlfix_object)) {
             $url_target = $urlfix_object->fix($url_target);
         }
         if (is_object($bbobject)) {
             $text_target = $bbobject->nobbcode($text_target);
         }
         $params['stream'][] = array('id' => $row['id'], 'type' => $row['type'], 'type_language' => language::getInstance()->get('stream_gtype_' . $row['type']), 'user_id' => $row['caster_id'], 'user_name' => system::getInstance()->isInt($row['caster_id']) ? user::getInstance()->get('nick', $row['caster_id']) : '', 'url' => $url_target, 'text' => $text_target, 'date' => system::getInstance()->todate($row['date'], 'h'));
     }
     $params['pagination'] = template::getInstance()->showFastPagination($page_index, $item_per_page, $this->streamCount(), 'stream');
     $tpl = template::getInstance()->twigRender('components/stream/list.tpl', $params);
     template::getInstance()->set(template::TYPE_CONTENT, 'body', $tpl);
 }
Example #5
0
 private function searchOnPage($query)
 {
     $params = array();
     $queryBuild = '%' . $query . '%';
     $stmt = database::getInstance()->con()->prepare("SELECT title,text,pathway,date FROM " . property::getInstance()->get('db_prefix') . "_com_static WHERE text like ? OR title like ? ORDER BY `date` LIMIT 50");
     $stmt->bindParam(1, $queryBuild, PDO::PARAM_STR);
     $stmt->bindParam(2, $queryBuild, PDO::PARAM_STR);
     $stmt->execute();
     $compiled_body = null;
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $title = unserialize($result['title']);
         $serial_text = unserialize($result['text']);
         $text = system::getInstance()->altsubstr(system::getInstance()->nohtml($serial_text[language::getInstance()->getUseLanguage()]), 0, 200);
         $link = "static/" . $result['pathway'];
         $params['static'][] = array('link' => $link, 'title' => $title[language::getInstance()->getUseLanguage()], 'snippet' => $text, 'date' => system::getInstance()->toDate($result['date'], 'h'));
     }
     return $params;
 }
Example #6
0
 public function make()
 {
     $to = system::getInstance()->get('to');
     $refer = $_SERVER['HTTP_REFERER'];
     if (language::getInstance()->canUse($to) && system::getInstance()->prefixEquals($refer, property::getInstance()->get('url'))) {
         $uri = system::getInstance()->altexplode('/', substr($refer, strlen(property::getInstance()->get('url'))));
         if (!property::getInstance()->get('user_friendly_url')) {
             array_shift($uri);
         }
         array_shift($uri);
         $uri_no_lang = system::getInstance()->altimplode('/', $uri);
         $uri_target = '/' . $to . '/';
         $uri_target .= $uri_no_lang;
         system::getInstance()->redirect($uri_target);
     } else {
         system::getInstance()->redirect();
     }
 }
Example #7
0
 public function make()
 {
     if ($_FILES['upload'] == null) {
         return null;
     }
     $type = (int) system::getInstance()->get('type');
     $result = false;
     $save_folder = false;
     $allow_ext = system::getInstance()->altexplode(';', property::getInstance()->get('upload_allowed_ext'));
     foreach ($allow_ext as $key => $value) {
         // no dots
         $nodot = str_replace('.', '', $value);
         if (system::getInstance()->length($nodot) > 0) {
             $allow_ext[$key] = $nodot;
         }
     }
     switch ($type) {
         case 1:
             if (permission::getInstance()->have('admin/imagebrowser')) {
                 $result = extension::getInstance()->call(extension::TYPE_HOOK, 'file')->uploadImage('/images/', $_FILES['upload']);
                 $save_folder = 'images';
             }
             break;
         case 2:
             if (permission::getInstance()->have('admin/flashbrowser')) {
                 $result = extension::getInstance()->call(extension::TYPE_HOOK, 'file')->uploadFile('/flash/', $_FILES['upload'], array('swf'));
                 $save_folder = 'flash';
             }
             break;
         default:
             if (permission::getInstance()->have('admin/filebrowser')) {
                 $result = extension::getInstance()->call(extension::TYPE_HOOK, 'file')->uploadFile('/other/', $_FILES['upload'], $allow_ext);
                 $save_folder = 'other';
             }
             break;
     }
     if (!$result || !$save_folder) {
         echo '<html><body><script type="text/javascript">window.parent.CKEDITOR.tools.callFunction("' . $_GET['CKEditorFuncNum'] . '", "", "' . language::getInstance()->get('fileupload_api_error') . '");</script></body></html>';
     } else {
         echo '<html><body><script type="text/javascript">window.parent.CKEDITOR.tools.callFunction("' . $_GET['CKEditorFuncNum'] . '", "' . property::getInstance()->get('script_url') . '/upload/' . $save_folder . '/' . $result . '");</script></body></html>';
     }
 }
Example #8
0
 public function make()
 {
     $params = array();
     $params['captcha_full'] = extension::getInstance()->getConfig('captcha_type', 'captcha', 'hooks') == "recaptcha" ? true : false;
     $params['captcha'] = extension::getInstance()->call(extension::TYPE_HOOK, 'captcha')->show();
     if (system::getInstance()->post('dofeedback')) {
         $poster_name = system::getInstance()->nohtml(system::getInstance()->post('topic_name'));
         $topic_title = system::getInstance()->nohtml(system::getInstance()->post('topic_title'));
         $topic_text = system::getInstance()->nohtml(system::getInstance()->post('topic_body'));
         $poster_email = user::getInstance()->get('id') > 0 ? user::getInstance()->get('email') : system::getInstance()->post('topic_email');
         $captcha = system::getInstance()->post('captcha');
         $date = time();
         if (!filter_var($poster_email, FILTER_VALIDATE_EMAIL)) {
             $params['notify']['wrong_email'] = true;
         }
         if (system::getInstance()->length($topic_title) < 3 || system::getInstance()->length($topic_title) > 70) {
             $params['notify']['wrong_title'] = true;
         }
         if (system::getInstance()->length($poster_name) < 3 || system::getInstance()->length($poster_name) > 50) {
             $params['notify']['wrong_name'] = true;
         }
         if (system::getInstance()->length($topic_text) < 10) {
             $params['notify']['wrong_text'] = true;
         }
         if (!extension::getInstance()->call(extension::TYPE_HOOK, 'captcha')->validate($captcha)) {
             $params['notify']['wrong_captcha'] = true;
         }
         if (sizeof($params['notify']) == 0) {
             $stmt = database::getInstance()->con()->prepare("INSERT INTO " . property::getInstance()->get('db_prefix') . "_com_feedback (`from_name`, `from_email`, `title`, `text`, `time`) VALUES (?, ?, ?, ?, ?)");
             $stmt->bindParam(1, $poster_name, PDO::PARAM_STR);
             $stmt->bindParam(2, $poster_email, PDO::PARAM_STR);
             $stmt->bindParam(3, $topic_title, PDO::PARAM_STR);
             $stmt->bindParam(4, $topic_text, PDO::PARAM_STR);
             $stmt->bindParam(5, $date, PDO::PARAM_INT);
             $stmt->execute();
             $params['notify']['success'] = true;
         }
     }
     meta::getInstance()->add('title', language::getInstance()->get('feedback_form_title'));
     $render = template::getInstance()->twigRender('components/feedback/form.tpl', array('local' => $params));
     template::getInstance()->set(template::TYPE_CONTENT, 'body', $render);
 }
Example #9
0
 public function make()
 {
     $params = array();
     if (system::getInstance()->post('submit')) {
         if (admin::getInstance()->saveExtensionConfigs()) {
             $params['notify']['save_success'] = true;
         }
     }
     $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle();
     $params['config']['show_date'] = extension::getInstance()->getConfig('show_date', 'static_on_main', extension::TYPE_MODULE, 'int');
     $params['config']['news_id'] = extension::getInstance()->getConfig('news_id', 'static_on_main', extension::TYPE_MODULE, 'int');
     $stmt = database::getInstance()->con()->prepare("SELECT `id`, `title` FROM " . property::getInstance()->get('db_prefix') . "_com_static ORDER BY `id` DESC");
     $stmt->execute();
     $resultAll = $stmt->fetchAll(PDO::FETCH_ASSOC);
     foreach ($resultAll as $row) {
         $serial_title = unserialize($row['title']);
         $params['staticpages'][] = array('id' => $row['id'], 'title' => $serial_title[language::getInstance()->getUseLanguage()]);
     }
     $stmt = null;
     return template::getInstance()->twigRender('modules/static_on_main/settings.tpl', $params);
 }
Example #10
0
 /**
  * Set in body position static page for $pathway
  * @param string $pathway
  * @param int $id
  * @param boolean $show_date
  * @param boolean $is_main
  * @return string|null
  */
 public function display($pathway, $id = null, $show_date = true, $is_main = false)
 {
     $stmt = null;
     if (is_null($id)) {
         $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_static WHERE pathway = ?");
         $stmt->bindParam(1, $pathway, PDO::PARAM_STR);
         $stmt->execute();
     } else {
         $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_static WHERE id = ?");
         $stmt->bindParam(1, $id, PDO::PARAM_INT);
         $stmt->execute();
     }
     if ($stmt != null && ($result = $stmt->fetch())) {
         $serial_title = unserialize($result['title']);
         $serial_text = unserialize($result['text']);
         $serial_keywords = unserialize($result['keywords']);
         $serial_description = unserialize($result['description']);
         if (system::getInstance()->length($serial_title[language::getInstance()->getUseLanguage()]) < 1 || system::getInstance()->length($serial_text[language::getInstance()->getUseLanguage()]) < 1) {
             return null;
         }
         $urlfix_object = extension::getInstance()->call(extension::TYPE_HOOK, 'urlfixer');
         if (is_object($urlfix_object)) {
             $serial_text = $urlfix_object->fix($serial_text);
         }
         if ($pathway) {
             meta::getInstance()->add('title', $serial_title[language::getInstance()->getUseLanguage()]);
             meta::getInstance()->add('keywords', $serial_keywords[language::getInstance()->getUseLanguage()]);
             meta::getInstance()->add('description', $serial_description[language::getInstance()->getUseLanguage()]);
         }
         $params = array('title' => $serial_title[language::getInstance()->getUseLanguage()], 'text' => $serial_text[language::getInstance()->getUseLanguage()], 'date' => system::getInstance()->toDate($result['date'], 'd'), 'show_date' => $show_date, 'is_main' => $is_main, 'pathway' => property::getInstance()->get('url') . '/static/' . $pathway);
         if (system::getInstance()->get('print') == 'true') {
             template::getInstance()->justPrint(template::getInstance()->twigRender('components/static/print.tpl', array('local' => $params)));
         }
         return template::getInstance()->twigRender('components/static/page.tpl', array('local' => $params));
     }
     return null;
 }
Example #11
0
 public function make()
 {
     $params = array();
     $item_count = extension::getInstance()->getConfig('discus_count', 'news_top_discus', extension::TYPE_MODULE, 'int');
     if ($item_count < 1) {
         $item_count = 1;
     }
     $day_unixlimit = extension::getInstance()->getConfig('discus_days', 'news_top_discus', extension::TYPE_MODULE, 'int');
     $day_unixlimit *= 60 * 60 * 24;
     $day_diff = $day_unixlimit === 0 ? 0 : time() - $day_unixlimit;
     $stmt = database::getInstance()->con()->prepare("SELECT pathway,COUNT(*) as count FROM " . property::getInstance()->get('db_prefix') . "_mod_comments WHERE moderate = 0 AND time >= ? GROUP BY `pathway` ORDER BY count DESC LIMIT 0,?");
     $stmt->bindParam(1, $day_diff, \PDO::PARAM_INT);
     $stmt->bindParam(2, $item_count, \PDO::PARAM_INT);
     $stmt->execute();
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     $article_url = array();
     $article_cat = array();
     $main_cat = false;
     $comment_key_count = array();
     foreach ($result as $item) {
         $comment_key_count[$item['pathway']] = $item['count'];
     }
     foreach (system::getInstance()->extractFromMultyArray('pathway', $result) as $uri_string) {
         $uri = system::getInstance()->altexplode('/', $uri_string);
         if (property::getInstance()->get('use_multi_language')) {
             array_shift($uri);
         }
         // remove /ru/ or /en/.
         array_shift($uri);
         // remove /news/
         if (sizeof($uri) === 1) {
             $article_url[] = system::getInstance()->altimplode('/', $uri);
             $main_cat = true;
         } else {
             $article_url[] = array_pop($uri);
             $article_cat[] = system::getInstance()->altimplode('/', $uri);
         }
     }
     $article_link_list = "'" . system::getInstance()->altimplode('\',\'', $article_url) . "'";
     $article_cat_list = null;
     if ($main_cat) {
         $article_cat_list .= "'',";
     }
     $article_cat_list .= "'" . system::getInstance()->altimplode('\',\'', $article_cat) . "'";
     $stmt = database::getInstance()->con()->query("SELECT a.title,a.link,b.path FROM " . property::getInstance()->get('db_prefix') . "_com_news_entery a," . property::getInstance()->get('db_prefix') . "_com_news_category b\n                        WHERE a.link IN ({$article_link_list}) AND b.path in ({$article_cat_list}) AND a.category = b.category_id");
     $news_result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     $news_data = array();
     foreach ($news_result as $row) {
         $full_path = null;
         if (property::getInstance()->get('use_multi_language')) {
             $full_path .= '/' . language::getInstance()->getUseLanguage();
         }
         $full_path .= '/news/';
         if ($row['path'] != null) {
             $full_path .= $row['path'] . '/';
         }
         $full_path .= $row['link'];
         if ($comment_key_count[$full_path] > 0) {
             $serial_title = unserialize($row['title']);
             $news_data[$full_path] = array('title' => $serial_title[language::getInstance()->getUseLanguage()]);
         }
     }
     foreach ($comment_key_count as $item_path => $item_repeat) {
         if (sizeof($news_data[$item_path]) > 0) {
             $params['top'][] = array('title' => $news_data[$item_path]['title'], 'comments' => $item_repeat, 'pathway' => $item_path);
         }
     }
     $tmp = template::getInstance()->twigRender('modules/news_top_discus/list.tpl', array('local' => $params));
     template::getInstance()->set(template::TYPE_MODULE, 'news_top_discus', $tmp);
 }
Example #12
0
 private function viewFeedMain()
 {
     $params = array();
     $way = router::getInstance()->shiftUriArray();
     meta::getInstance()->add('title', language::getInstance()->get('feed_global_title'));
     $item_per_page = extension::getInstance()->getConfig('item_per_page', 'feed', extension::TYPE_COMPONENT, 'int');
     if ($item_per_page < 1) {
         $item_per_page = 1;
     }
     $index = (int) $way[1];
     $db_index = $index * $item_per_page;
     $stmt = database::getInstance()->con()->prepare("SELECT a.item_title,a.item_id,a.target_list,a.item_date,b.title FROM " . property::getInstance()->get('db_prefix') . "_com_feed_item a,\n                " . property::getInstance()->get('db_prefix') . "_com_feed_list b WHERE b.id = a.target_list ORDER BY a.item_date DESC LIMIT ?,?");
     $stmt->bindParam(1, $db_index, \PDO::PARAM_INT);
     $stmt->bindParam(2, $item_per_page, \PDO::PARAM_INT);
     $stmt->execute();
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($result as $row) {
         $cat_title = unserialize($row['title']);
         $params['rssfeed'][] = array('title' => system::getInstance()->nohtml($row['item_title']), 'id' => $row['item_id'], 'cat_title' => $cat_title[language::getInstance()->getUseLanguage()], 'cat_id' => $row['target_list'], 'date' => system::getInstance()->toDate($row['item_date'], 'h'));
     }
     // get total count for pagination
     $stmt = database::getInstance()->con()->query("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_com_feed_item");
     $res = $stmt->fetch();
     $stmt = null;
     $total_count = $res[0];
     $params['pagination'] = template::getInstance()->showFastPagination($index, $item_per_page, $total_count, 'feed/list');
     return template::getInstance()->twigRender('components/feed/stream.tpl', $params);
 }
Example #13
0
 public function _install()
 {
     $lang_ru = array('ru' => array('front' => array('feed_global_title' => 'Лента материалов', 'feed_breadcrumb_main' => 'Лента', 'feed_breadcrumb_category' => 'Список лент', 'feed_category_title' => 'Список каналов', 'feed_category_header' => 'Канал', 'feed_category_list' => 'Список лент', 'feed_category_allitem' => 'Все материалы'), 'back' => array('admin_components_feed.name' => 'RSS ленты', 'admin_components_feed.desc' => 'Реализация компонента сборщика информации из разных RSS потоков на сайт', 'admin_components_feed_list_title' => 'Список лент', 'admin_components_feed_settings' => 'Настройки', 'admin_components_feed_edit_title' => 'Редактирование фида', 'admin_components_feed_config_count_title' => 'Кол-во на страницу', 'admin_components_feed_config_count_desc' => 'Количество записей отображаемых на 1 странице', 'admin_components_feed_th_title' => 'Название', 'admin_components_feed_th_source' => 'Источник', 'admin_components_feed_th_actions' => 'Операции', 'admin_components_feed_button_add' => 'Добавить ленту', 'admin_components_feed_edit_form_title' => 'Название фида', 'admin_components_feed_edit_form_desc' => 'Описание', 'admin_components_feed_edit_form_desc_helper' => 'Краткое описание ленты, которое будет отображено на сайте в разделе данной ленты', 'admin_components_feed_edit_form_url' => 'RSS источник', 'admin_components_feed_edit_form_url_helper' => 'Ссылка на RSS ленту источника, которая будет обрабатываться сайтом', 'admin_components_feed_edit_button_save' => 'Сохранить', 'admin_components_feed_notify_length' => 'Длина заголовка некоректна', 'admin_components_feed_notify_source_wrong' => 'Длина ссылки на источник RSS некоректна', 'admin_components_feed_delete_title' => 'Удаление ленты', 'admin_components_feed_delete_desc' => 'Вы уверены что хотите удалить данную ленту?', 'admin_components_feed_delete_button' => 'Удалить')));
     $lang_en = array('en' => array('front' => array('feed_global_title' => 'Rss feed', 'feed_breadcrumb_main' => 'Feed', 'feed_breadcrumb_category' => 'Feed list', 'feed_category_title' => 'Channel list', 'feed_category_header' => 'Channel', 'feed_category_list' => 'List of feeds', 'feed_category_allitem' => 'All materials'), 'back' => array('admin_components_feed.name' => 'RSS feeds', 'admin_components_feed.desc' => 'This component allow to make your own rss catalog', 'admin_components_feed_list_title' => 'Feeds list', 'admin_components_feed_settings' => 'Settings', 'admin_components_feed_edit_title' => 'Edit feed', 'admin_components_feed_config_count_title' => 'Count per page', 'admin_components_feed_config_count_desc' => 'Count of items displayed on 1 page', 'admin_components_feed_th_title' => 'Title', 'admin_components_feed_th_source' => 'Source', 'admin_components_feed_th_actions' => 'Actions', 'admin_components_feed_button_add' => 'Add feed', 'admin_components_feed_edit_form_title' => 'Feed title', 'admin_components_feed_edit_form_desc' => 'Description', 'admin_components_feed_edit_form_desc_helper' => 'Short description of feed what be displayed on website', 'admin_components_feed_edit_form_url' => 'RSS source', 'admin_components_feed_edit_form_url_helper' => 'Link to URL of RSS feed to parse', 'admin_components_feed_edit_button_save' => 'Save', 'admin_components_feed_notify_length' => 'Title length is incorrent', 'admin_components_feed_notify_source_wrong' => 'Rss source URL is wrong', 'admin_components_feed_delete_title' => 'Delete feed', 'admin_components_feed_delete_desc' => 'Are you sure to delete this feed?', 'admin_components_feed_delete_button' => 'Delete')));
     language::getInstance()->add($lang_en);
     language::getInstance()->add($lang_ru);
     database::getInstance()->con()->exec("CREATE TABLE IF NOT EXISTS `" . property::getInstance()->get('db_prefix') . "_com_feed_list` (\n          `id` int(12) NOT NULL AUTO_INCREMENT,\n          `title` text NOT NULL,\n          `desc` text NOT NULL,\n          `url` varchar(512) NOT NULL,\n          `update` int(16) NOT NULL DEFAULT '0',\n          PRIMARY KEY (`id`)\n        ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;\n        CREATE TABLE IF NOT EXISTS `" . property::getInstance()->get('db_prefix') . "_com_feed_item` (\n          `item_id` int(32) NOT NULL AUTO_INCREMENT,\n          `target_list` int(12) NOT NULL,\n          `item_title` text NOT NULL,\n          `item_desc` text NOT NULL,\n          `source_url` varchar(512) NOT NULL,\n          `item_date` int(16) NOT NULL,\n          `fulltext` text NOT NULL,\n          PRIMARY KEY (`item_id`)\n        ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;\n        ");
     $cfgs = 'a:1:{s:13:"item_per_page";s:2:"10";}';
     $stmt = database::getInstance()->con()->prepare("UPDATE " . property::getInstance()->get('db_prefix') . "_extensions SET `configs` = ? WHERE `type` = 'components' AND `dir` = 'feed'");
     $stmt->bindParam(1, $cfgs, \PDO::PARAM_STR);
     $stmt->execute();
     $stmt = null;
 }
Example #14
0
 private function viewUserFields()
 {
     csrf::getInstance()->buildToken();
     $params = array();
     $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle();
     $stmt = database::getInstance()->con()->query("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_user_fields ORDER BY `id` DESC");
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($result as $row) {
         $name_serial = unserialize($row['name']);
         $params['ufield']['data'][] = array('id' => $row['id'], 'type' => $row['type'], 'name' => $name_serial[language::getInstance()->getUseLanguage()]);
     }
     return template::getInstance()->twigRender('components/user/ufield_list.tpl', $params);
 }
Example #15
0
 private function viewMenuList()
 {
     $params = array();
     $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle();
     $stmt = database::getInstance()->con()->query("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_mod_menu_header ORDER BY menu_id DESC");
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($result as $row) {
         $serial_name = unserialize($row['menu_name']);
         $params['modmenu']['list'][] = array('id' => $row['menu_id'], 'name' => $serial_name[language::getInstance()->getUseLanguage()], 'tag' => $row['menu_tag'], 'tpl' => $row['menu_tpl'], 'display' => $row['menu_display']);
     }
     return template::getInstance()->twigRender('modules/menu/list.tpl', $params);
 }
Example #16
0
 private function viewStaticList()
 {
     csrf::getInstance()->buildToken();
     $params = array();
     if (system::getInstance()->post('deleteSelected') && csrf::getInstance()->check()) {
         if (permission::getInstance()->have('global/owner') || permission::getInstance()->have('admin/components/static/delete')) {
             $toDelete = system::getInstance()->post('check_array');
             if (is_array($toDelete) && sizeof($toDelete) > 0) {
                 $listDelete = system::getInstance()->altimplode(',', $toDelete);
                 if (system::getInstance()->isIntList($listDelete)) {
                     database::getInstance()->con()->query("DELETE FROM " . property::getInstance()->get('db_prefix') . "_com_static WHERE id IN (" . $listDelete . ")");
                 }
             }
         }
     }
     $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle();
     $index_start = (int) system::getInstance()->get('index');
     $db_index = $index_start * self::ITEM_PER_PAGE;
     if (system::getInstance()->post('dosearch') && strlen(system::getInstance()->post('search')) > 0) {
         $params['search']['value'] = system::getInstance()->nohtml(system::getInstance()->post('search'));
         $search_string = "%" . system::getInstance()->nohtml(system::getInstance()->post('search')) . "%";
         $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_static WHERE title like ? OR text like ? ORDER BY id DESC LIMIT 0," . self::SEARCH_PER_PAGE);
         $stmt->bindParam(1, $search_string, PDO::PARAM_STR);
         $stmt->bindParam(2, $search_string, PDO::PARAM_STR);
         $stmt->execute();
     } else {
         $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_static ORDER BY id DESC LIMIT ?," . self::ITEM_PER_PAGE);
         $stmt->bindParam(1, $db_index, PDO::PARAM_INT);
         $stmt->execute();
     }
     $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
     foreach ($result as $data) {
         $title_locale = unserialize($data['title']);
         $params['static'][] = array('id' => $data['id'], 'title' => $title_locale[language::getInstance()->getUseLanguage()], 'path' => $data['pathway'], 'date' => system::getInstance()->toDate($data['date'], 'h'));
     }
     $params['pagination'] = template::getInstance()->showFastPagination($index_start, self::ITEM_PER_PAGE, $this->getTotalStaticCount(), '?object=components&action=static&index=');
     return template::getInstance()->twigRender('components/static/list.tpl', $params);
 }
Example #17
0
 /**
  * Magic and drugs inside (:
  * @return array
  */
 public function getCategoryArray()
 {
     $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_video_category ORDER BY `path` ASC");
     $stmt->execute();
     $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $stmt = null;
     $work_data = array();
     $total_result = array();
     foreach ($result as $item) {
         $work_data[$item['path']] = array('id' => $item['category_id'], 'name' => $item['name'], 'desc' => $item['desc']);
     }
     ksort($work_data);
     // sort
     foreach ($work_data as $path => $row) {
         $cname = unserialize($row['name']);
         $cdesc = unserialize($row['desc']);
         $spliter_count = substr_count($path, "/");
         $add = '';
         if ($path != null) {
             for ($i = -1; $i <= $spliter_count; $i++) {
                 $add .= "-";
             }
         } else {
             $add = "-";
         }
         $total_result[] = array('id' => $row['id'], 'name' => $add . ' ' . $cname[language::getInstance()->getUseLanguage()], 'desc' => $cdesc[language::getInstance()->getUseLanguage()], 'path' => $path, 'level' => $path == null ? 0 : $spliter_count + 1);
     }
     return $total_result;
 }
Example #18
0
<?php

/**
|==========================================================|
|========= @copyright Pyatinskii Mihail, 2013-2014 ========|
|================= @website: www.ffcms.ru =================|
|========= @license: GNU GPL V3, file: license.txt ========|
|==========================================================|
*/
// system are not installed or file is missed
if (!file_exists(root . "/config.php")) {
    exit("System are not installed or file config.php is missed. Run <a href='/install/'>Installer</a>.");
} else {
    require_once root . '/config.php';
}
\engine\property::getInstance()->init();
// processing of URI for multi-language and friendly url's
\engine\timezone::getInstance()->init();
// prepare tz_data worker
date_default_timezone_set(\engine\property::getInstance()->get('time_zone'));
// default timezone from configs
\engine\language::getInstance()->init();
\engine\database::getInstance()->init();
// init database PDO connect
\engine\user::getInstance()->init();
\engine\router::getInstance()->init();
\engine\extension::getInstance()->init();
// init extension controller
\engine\template::getInstance()->init();
echo \engine\admin::getInstance()->make();
Example #19
0
 private function loadDefaults()
 {
     $global_title = property::getInstance()->get('seo_title');
     $this->add('/', date('c'), 'daily', '1.0', $global_title[language::getInstance()->getUseLanguage()]);
     // main page
     $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_news_entery a, " . property::getInstance()->get('db_prefix') . "_com_news_category b WHERE a.display = 1 AND a.category = b.category_id ORDER BY a.id ASC");
     $stmt->execute();
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $link = null;
         if ($result['path'] == null) {
             $link = "/news/" . $result['link'];
         } else {
             $link = "/news/" . $result['path'] . "/" . $result['link'];
         }
         $news_title = system::getInstance()->altstripslashes(unserialize($result['title']));
         $this->add($link, date('c', $result['date']), 'weekly', '0.3', $news_title[language::getInstance()->getUseLanguage()]);
     }
     $stmt = null;
     $stmt = database::getInstance()->con()->prepare("SELECT `pathway`, `date`, `title` FROM " . property::getInstance()->get('db_prefix') . "_com_static");
     $stmt->execute();
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $static_title = system::getInstance()->altstripslashes(unserialize($result['title']));
         $this->add("/static/" . $result['pathway'], date('c', $result['date']), 'weekly', '0.4', $static_title[language::getInstance()->getUseLanguage()]);
     }
     $stmt = null;
     $stmt = database::getInstance()->con()->prepare("SELECT id,nick,login FROM " . property::getInstance()->get('db_prefix') . "_user WHERE aprove = 0");
     $stmt->execute();
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $u_title = $result['nick'];
         if (system::getInstance()->length($u_title) < 1) {
             $u_title = $result['login'];
         }
         // unsafe .. but didnt care (:
         $this->add("/user/id" . $result['id'], date('c'), 'weekly', '0.2', $u_title);
     }
     $stmt = null;
     $stmt = database::getInstance()->con()->prepare("SELECT a.`path`, a.`name`, b.`date` FROM `" . property::getInstance()->get('db_prefix') . "_com_news_category` a, `" . property::getInstance()->get('db_prefix') . "_com_news_entery` b WHERE a.category_id = b.category AND a.path != '' GROUP BY a.path ORDER BY b.`date` DESC");
     $stmt->execute();
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $cat_name = unserialize($result['name']);
         $this->add("/news/" . $result['path'], date('c', $result['date']), 'weekly', '0.3', $cat_name[language::getInstance()->getUseLanguage()]);
     }
 }
Example #20
0
 private function viewVideoList()
 {
     csrf::getInstance()->buildToken();
     $params = array();
     if (system::getInstance()->post('deleteSelected') && csrf::getInstance()->check()) {
         if (permission::getInstance()->have('global/owner') || permission::getInstance()->have('admin/components/video/delete')) {
             $toDelete = system::getInstance()->post('check_array');
             if (is_array($toDelete) && sizeof($toDelete) > 0) {
                 foreach ($toDelete as $video_single_id) {
                     // remove posible poster files and gallery images
                     if (file_exists(root . '/upload/video/poster_' . $video_single_id . '.jpg')) {
                         @unlink(root . '/upload/video/poster_' . $video_single_id . '.jpg');
                     }
                     if (file_exists(root . '/upload/video/gallery/' . $video_single_id . '/')) {
                         system::getInstance()->removeDirectory(root . '/upload/video/gallery/' . $video_single_id . '/');
                     }
                 }
                 $listDelete = system::getInstance()->altimplode(',', $toDelete);
                 if (system::getInstance()->isIntList($listDelete)) {
                     database::getInstance()->con()->query("DELETE FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery WHERE id IN (" . $listDelete . ")");
                     // drop tags
                     database::getInstance()->con()->prepare("DELETE FROM " . property::getInstance()->get('db_prefix') . "_mod_tags WHERE object_type = 'video' AND object_id IN (" . $listDelete . ")");
                 }
             }
         }
     }
     $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle();
     $params['search']['value'] = system::getInstance()->nohtml(system::getInstance()->get('search'));
     $index_start = (int) system::getInstance()->get('index');
     $db_index = $index_start * self::ITEM_PER_PAGE;
     $stmt = null;
     $filter = (int) system::getInstance()->get('filter');
     if ($filter === self::FILTER_MODERATE) {
         // 1
         $stmt = database::getInstance()->con()->prepare("SELECT a.id,a.title,a.category,a.link,a.date,b.category_id,a.important,a.display,b.path FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery a, " . property::getInstance()->get('db_prefix') . "_com_video_category b WHERE a.category = b.category_id AND a.display = 0 ORDER BY a.id DESC LIMIT ?," . self::ITEM_PER_PAGE);
         $stmt->bindParam(1, $db_index, PDO::PARAM_INT);
         $stmt->execute();
     } elseif ($filter === self::FILTER_IMPORTANT) {
         // 2
         $stmt = database::getInstance()->con()->prepare("SELECT a.id,a.title,a.category,a.link,a.date,a.important,a.display,b.category_id,b.path FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery a, " . property::getInstance()->get('db_prefix') . "_com_video_category b WHERE a.category = b.category_id AND a.important = 1 ORDER BY a.id DESC LIMIT ?," . self::ITEM_PER_PAGE);
         $stmt->bindParam(1, $db_index, PDO::PARAM_INT);
         $stmt->execute();
     } elseif ($filter === self::FILTER_SEARCH) {
         // 3
         $search_string = "%" . $params['search']['value'] . "%";
         $stmt = database::getInstance()->con()->prepare("SELECT a.id,a.title,a.category,a.link,a.date,a.important,a.display,b.category_id,b.path FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery a, " . property::getInstance()->get('db_prefix') . "_com_video_category b WHERE a.category = b.category_id AND (a.title like ? OR a.text like ?) ORDER BY a.id DESC LIMIT 0," . self::SEARCH_PER_PAGE);
         $stmt->bindParam(1, $search_string, PDO::PARAM_STR);
         $stmt->bindParam(2, $search_string, PDO::PARAM_STR);
         $stmt->execute();
     } else {
         // 0 || > 3
         $stmt = database::getInstance()->con()->prepare("SELECT a.id,a.title,a.category,a.link,a.date,b.category_id,a.important,a.display,b.path FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery a, " . property::getInstance()->get('db_prefix') . "_com_video_category b WHERE a.category = b.category_id ORDER BY a.important DESC, a.id DESC LIMIT ?," . self::ITEM_PER_PAGE);
         $stmt->bindParam(1, $db_index, PDO::PARAM_INT);
         $stmt->execute();
         $filter = 0;
     }
     $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($result as $data) {
         $title = unserialize($data['title']);
         $link = $data['path'];
         if ($link != null) {
             $link .= "/";
         }
         $link .= $data['link'];
         $params['video'][] = array('id' => $data['id'], 'title' => $title[language::getInstance()->getUseLanguage()], 'link' => $link, 'date' => system::getInstance()->toDate($data['date'], 'h'), 'important' => (int) $data['important'], 'moderate' => !(bool) $data['display']);
     }
     $params['pagination'] = template::getInstance()->showFastPagination($index_start, self::ITEM_PER_PAGE, $this->getTotalVideoCount($filter), '?object=components&action=video&filter=' . $filter . '&index=');
     return template::getInstance()->twigRender('components/video/list.tpl', $params);
 }
Example #21
0
 public function getUfieldData($target_id)
 {
     $stmt = database::getInstance()->con()->query("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_user_fields");
     $allFields = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     $ufield_user = unserialize(user::getInstance()->get('ufields', $target_id));
     $output = array();
     foreach ($allFields as $ufield) {
         $title_serial = unserialize($ufield['name']);
         $params_serial = unserialize($ufield['params']);
         if ($ufield['type'] == 'text') {
             $output[] = array('id' => $ufield['id'], 'type' => $ufield['type'], 'title' => $title_serial[language::getInstance()->getUseLanguage()], 'reg_exp' => $params_serial['regexp'], 'reg_cond' => $params_serial['regcond'], 'default' => $ufield_user[$ufield['id']]['data']);
         } elseif ($ufield['type'] == 'img') {
             $output[] = array('id' => $ufield['id'], 'type' => $ufield['type'], 'title' => $title_serial[language::getInstance()->getUseLanguage()], 'img_dx' => $params_serial['dx'], 'img_dy' => $params_serial['dy'], 'default' => $ufield_user[$ufield['id']]['data']);
         } elseif ($ufield['type'] == 'link') {
             $output[] = array('id' => $ufield['id'], 'type' => $ufield['type'], 'title' => $title_serial[language::getInstance()->getUseLanguage()], 'domain' => $params_serial['domain'], 'redirect' => $params_serial['redirect'], 'default' => $ufield_user[$ufield['id']]['data']);
         }
     }
     return $output;
 }