コード例 #1
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
 public function make()
 {
     $params = array();
     meta::getInstance()->add('title', language::getInstance()->get('search_seo_title'));
     $way = router::getInstance()->shiftUriArray();
     $query = system::getInstance()->nohtml($way[0]);
     $params['query'] = null;
     if (system::getInstance()->length($query) > 2 && !system::getInstance()->prefixEquals($query, "?")) {
         $params['search'] = array_merge($this->searchOnNews($query), $this->searchOnPage($query));
         $params['query'] = $query;
     }
     $render = template::getInstance()->twigRender('components/search/search.tpl', array('local' => $params));
     template::getInstance()->set(template::TYPE_CONTENT, 'body', $render);
 }
コード例 #2
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
 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);
 }
コード例 #3
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
 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);
 }
コード例 #4
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
 /**
  * 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;
 }
コード例 #5
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms-rss-feed
 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);
 }
コード例 #6
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms-video
 public function viewCategory()
 {
     $way = router::getInstance()->shiftUriArray();
     $item_type = 'all';
     if (in_array($way[0], array('all', 'top'))) {
         $item_type = array_shift($way);
     }
     $pop_array = $way;
     $last_item = array_pop($pop_array);
     $page_index = 0;
     $page_video_count = extension::getInstance()->getConfig('count_video_page', 'video', 'components', 'int');
     $total_video_count = 0;
     $cat_link = null;
     if (system::getInstance()->isInt($last_item)) {
         $page_index = $last_item;
         $cat_link = system::getInstance()->altimplode("/", $pop_array);
     } else {
         $cat_link = system::getInstance()->altimplode("/", $way);
     }
     $select_coursor_start = $page_index * $page_video_count;
     $category_select_array = array();
     $category_list = null;
     $fstmt = null;
     $page_title = null;
     $page_desc = null;
     if (extension::getInstance()->getConfig('multi_category', 'video', 'components', 'boolean')) {
         $fstmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_video_category WHERE path like ?");
         $path_swarm = "{$cat_link}%";
         $fstmt->bindParam(1, $path_swarm, PDO::PARAM_STR);
         $fstmt->execute();
     } else {
         $fstmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_video_category WHERE path = ?");
         $fstmt->bindParam(1, $cat_link, PDO::PARAM_STR);
         $fstmt->execute();
     }
     while ($fresult = $fstmt->fetch()) {
         $category_select_array[] = $fresult['category_id'];
         if ($cat_link == $fresult['path']) {
             $serial_name = system::getInstance()->nohtml(unserialize($fresult['name']));
             $serial_desc = unserialize($fresult['desc']);
             $page_title = language::getInstance()->get('video_view_category') . ': ';
             if ($item_type == 'top') {
                 $page_title .= language::getInstance()->get('vide_view_top');
             } else {
                 $page_title .= $serial_name[language::getInstance()->getUseLanguage()];
             }
             $seo_title = $page_title;
             $seo_desc = $page_desc = $serial_desc[language::getInstance()->getUseLanguage()];
             if ($page_index > 0) {
                 $seo_title .= " - " . language::getInstance()->get('video_page_title') . ' ' . ($page_index + 1);
                 $seo_desc .= " - " . language::getInstance()->get('video_page_title') . ' ' . ($page_index + 1);
             }
             meta::getInstance()->add('title', $seo_title);
             meta::getInstance()->add('description', $seo_desc);
         }
     }
     $category_list = system::getInstance()->altimplode(',', $category_select_array);
     $theme_array = array();
     $fstmt = null;
     if (system::getInstance()->isIntList($category_list)) {
         $max_preview_length = 150;
         $time = time();
         $stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery WHERE category in ({$category_list}) AND date <= ? AND display = 1");
         $stmt->bindParam(1, $time, PDO::PARAM_INT);
         $stmt->execute();
         if ($countRows = $stmt->fetch()) {
             $total_video_count = $countRows[0];
         }
         $stmt = null;
         $order_column = 'a.date';
         if ($item_type == 'top') {
             $order_column = 'a.views';
         }
         $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_video_entery a,\n\t\t\t\t\t\t\t\t\t\t\t\t  " . property::getInstance()->get('db_prefix') . "_com_video_category b\n\t\t\t\t\t\t\t\t\t\t\t\t  WHERE a.category in ({$category_list}) AND a.date <= ?\n\t\t\t\t\t\t\t\t\t\t\t\t  AND a.category = b.category_id\n\t\t\t\t\t\t\t\t\t\t\t\t  AND a.display = 1\n\t\t\t\t\t\t\t\t\t\t\t\t  ORDER BY a.important DESC, {$order_column} DESC LIMIT ?,?");
         $stmt->bindParam(1, $time, PDO::PARAM_INT);
         $stmt->bindParam(2, $select_coursor_start, PDO::PARAM_INT);
         $stmt->bindParam(3, $page_video_count, PDO::PARAM_INT);
         $stmt->execute();
         if (sizeof($category_select_array) > 0) {
             while ($result = $stmt->fetch()) {
                 $lang_text = system::getInstance()->altstripslashes(unserialize($result['text']));
                 $lang_title = system::getInstance()->altstripslashes(unserialize($result['title']));
                 $lang_keywords = system::getInstance()->altstripslashes(unserialize($result['keywords']));
                 $video_short_text = $lang_text[language::getInstance()->getUseLanguage()];
                 if (system::getInstance()->length($lang_title[language::getInstance()->getUseLanguage()]) < 1) {
                     // do not add the empty title video
                     continue;
                 }
                 if (system::getInstance()->contains('<hr />', $video_short_text)) {
                     $video_short_text = strstr($video_short_text, '<hr />', true);
                 } elseif (system::getInstance()->length($video_short_text) > $max_preview_length) {
                     $video_short_text = system::getInstance()->sentenceSub(system::getInstance()->nohtml($video_short_text), $max_preview_length) . "...";
                 }
                 if ($result['path'] == null) {
                     $video_full_link = $result['link'];
                 } else {
                     $video_full_link = $result['path'] . "/" . $result['link'];
                 }
                 $tagPrepareArray = system::getInstance()->altexplode(',', $lang_keywords[language::getInstance()->getUseLanguage()]);
                 $tag_array = array();
                 foreach ($tagPrepareArray as $tagItem) {
                     $tag_array[] = trim($tagItem);
                 }
                 $comment_count = 0;
                 if (is_object(extension::getInstance()->call(extension::TYPE_HOOK, 'comment'))) {
                     $comment_count = extension::getInstance()->call(extension::TYPE_HOOK, 'comment')->getCount('/' . language::getInstance()->getUseLanguage() . '/video/' . $video_full_link);
                 }
                 $cat_serial_text = system::getInstance()->altstripslashes(unserialize($result['name']));
                 $video_view_id = $result['id'];
                 $image_poster_root = root . '/upload/video/poster_' . $video_view_id . '.jpg';
                 $image_poster_url = false;
                 if (file_exists($image_poster_root)) {
                     $image_poster_url = property::getInstance()->get('script_url') . '/upload/video/poster_' . $video_view_id . '.jpg';
                 }
                 $theme_array[] = array('tags' => $tag_array, 'title' => $lang_title[language::getInstance()->getUseLanguage()], 'text' => $video_short_text, 'date' => system::getInstance()->toDate($result['date'], 'h'), 'unixtime' => $result['date'], 'category_url' => $result['path'], 'category_name' => $cat_serial_text[language::getInstance()->getUseLanguage()], 'author_id' => $result['author'], 'author_nick' => user::getInstance()->get('nick', $result['author']), 'full_video_uri' => $video_full_link, 'comment_count' => $comment_count, 'view_count' => $result['views'], 'poster' => $image_poster_url, 'important' => $result['important']);
             }
         }
         $stmt = null;
     }
     if ($item_type == 'top') {
         $page_link = $cat_link == null ? "video/top" : "video/top/" . $cat_link;
     } else {
         $page_link = $cat_link == null ? "video" : "video/" . $cat_link;
     }
     $pagination = template::getInstance()->showFastPagination($page_index, $page_video_count, $total_video_count, $page_link);
     $full_params = array('local' => $theme_array, 'pagination' => $pagination, 'page_title' => $page_title, 'page_desc' => $page_desc, 'page_link' => $cat_link, 'video_sort_type' => $item_type);
     return template::getInstance()->twigRender('/components/video/short_view.tpl', $full_params);
 }
コード例 #7
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
\engine\language::getInstance()->init();
// prepare language
\engine\database::getInstance()->init();
// init database PDO connect
\engine\extension::getInstance()->init();
// init extension controller
\engine\user::getInstance()->init();
// prepare user data
\engine\router::getInstance()->init();
// prepare URI worker
\engine\meta::getInstance()->init();
\engine\template::getInstance()->init();
// set default template variables according changes in dymanic variables
\engine\extension::getInstance()->loadModules();
// prepare modules
\engine\extension::getInstance()->loadHooks();
// prepare hooks
// statistic collector
\engine\robot::getInstance()->init();
// check ip/user is fully blocked?
\engine\ban::getInstance()->init();
\engine\router::getInstance()->makeRoute();
\engine\meta::getInstance()->compile();
\engine\maintenance::getInstance()->make();
echo \engine\template::getInstance()->make();
// load debug indifferent of templates. Sounds not good but cant be removed from theme.
if (\engine\permission::getInstance()->have('global/owner') && \engine\property::getInstance()->get('debug')) {
    $debug_endtime = microtime(true);
    $load_time = number_format($debug_endtime - $debug_starttime, 3);
    echo "<hr />Debug loading: " . $load_time . " sec <br />Sql query count: " . \engine\database::getInstance()->getQueryCount() . "<br />Memory(peak): " . number_format(memory_get_peak_usage() / (1024 * 1024), 3) . "mb";
}
コード例 #8
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
 private function viewUserList($type)
 {
     $params = array();
     $params['use_karma'] = extension::getInstance()->getConfig('use_karma', 'user', extension::TYPE_COMPONENT, 'bol');
     $totalUsers = $this->totalUserCount();
     $resultAll = null;
     $way = router::getInstance()->shiftUriArray();
     $usercount_on_page = extension::getInstance()->getConfig('userlist_count', 'user', 'components', 'int');
     if ($type == null || system::getInstance()->isInt($type)) {
         // default user list with pagination
         meta::getInstance()->add('title', language::getInstance()->get('seo_title_userlist'));
         $index = (int) $type;
         $limit_start = $index * $usercount_on_page;
         $stmt = database::getInstance()->con()->prepare("SELECT a.id, a.nick, b.regdate, b.status, b.karma FROM " . property::getInstance()->get('db_prefix') . "_user a,\n            " . property::getInstance()->get('db_prefix') . "_user_custom b WHERE a.id = b.id AND a.aprove = 0 ORDER BY a.id DESC LIMIT ?, ?");
         $stmt->bindParam(1, $limit_start, PDO::PARAM_INT);
         $stmt->bindParam(2, $usercount_on_page, PDO::PARAM_INT);
         $stmt->execute();
         $resultAll = $stmt->fetchAll(\PDO::FETCH_ASSOC);
         $stmt = null;
         $params['pagination'] = template::getInstance()->showFastPagination($index, $usercount_on_page, $totalUsers, 'user');
         $params['tabtype'] = 'all';
     } elseif ($type == 'karma' && $params['use_karma']) {
         $params['tabtype'] = 'karma';
         meta::getInstance()->add('title', 'Рейтинг пользователей - Карма');
         $index = (int) $way[1];
         $limit_start = $index * $usercount_on_page;
         $stmt = database::getInstance()->con()->prepare("SELECT a.id, a.nick, b.regdate, b.status, b.karma FROM " . property::getInstance()->get('db_prefix') . "_user a,\n            " . property::getInstance()->get('db_prefix') . "_user_custom b WHERE a.id = b.id AND a.aprove = 0 ORDER BY b.karma DESC LIMIT ?, ?");
         $stmt->bindParam(1, $limit_start, PDO::PARAM_INT);
         $stmt->bindParam(2, $usercount_on_page, PDO::PARAM_INT);
         $stmt->execute();
         $resultAll = $stmt->fetchAll(\PDO::FETCH_ASSOC);
         $stmt = null;
         $params['pagination'] = template::getInstance()->showFastPagination($index, $usercount_on_page, $totalUsers, 'user/karma');
     } elseif ($type == 'search') {
         $params['tabtype'] = 'search';
         meta::getInstance()->add('title', 'Поиск пользователей');
         if (system::getInstance()->post('submit')) {
             $u_data = '%' . system::getInstance()->nohtml(system::getInstance()->post('search_user')) . '%';
             $stmt = database::getInstance()->con()->prepare("SELECT a.id, a.nick, b.regdate, b.status, b.karma FROM " . property::getInstance()->get('db_prefix') . "_user a,\n                " . property::getInstance()->get('db_prefix') . "_user_custom b WHERE a.id = b.id AND a.aprove = 0 AND a.nick like ? ORDER BY a.id DESC LIMIT 0,50");
             $stmt->bindParam(1, $u_data, \PDO::PARAM_STR);
             $stmt->execute();
             $resultAll = $stmt->fetchAll(\PDO::FETCH_ASSOC);
         }
     }
     foreach ($resultAll as $result) {
         $params['user'][] = array('user_id' => $result['id'], 'user_name' => $result['nick'], 'user_avatar' => user::getInstance()->buildAvatar('small', $result['id']), 'user_regdate' => system::getInstance()->toDate($result['regdate'], 'd'), 'user_status' => $result['status'], 'user_karma' => $result['karma']);
     }
     $params['statistic'] = array('total' => $totalUsers, 'male' => $this->maleUserCount(), 'female' => $this->femaleUserCount());
     $visit_time = time() - 15 * 60;
     $stmt = database::getInstance()->con()->prepare("SELECT a.reg_id, a.cookie, b.* FROM " . property::getInstance()->get('db_prefix') . "_statistic a,\n        " . property::getInstance()->get('db_prefix') . "_user b WHERE a.`time` >= ? AND a.reg_id > 0 AND a.reg_id = b.id GROUP BY a.reg_id, a.cookie");
     $stmt->bindParam(1, $visit_time, PDO::PARAM_INT);
     $stmt->execute();
     while ($onlineNow = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $params['online'][] = array('user_id' => $onlineNow['reg_id'], 'user_name' => $onlineNow['nick']);
     }
     $stmt = null;
     return template::getInstance()->twigRender('components/user/list.tpl', array('local' => $params));
 }