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']['new_count'] = extension::getInstance()->getConfig('new_count', 'news_new', extension::TYPE_MODULE, 'int'); return template::getInstance()->twigRender('modules/news_new/settings.tpl', $params); }
private function viewFeedList() { $params = array(); $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle(); $index = (int) system::getInstance()->get('index'); $db_index = $index * self::ITEM_PER_PAGE; $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_feedback ORDER BY `id` DESC LIMIT ?," . self::ITEM_PER_PAGE); $stmt->bindParam(1, $db_index, PDO::PARAM_INT); $stmt->execute(); $params['feedback']['result'] = $stmt->fetchAll(PDO::FETCH_ASSOC); $params['pagination'] = template::getInstance()->showFastPagination($index, self::ITEM_PER_PAGE, $this->getFeedCount(), '?object=components&action=feedback&index='); return template::getInstance()->twigRender('components/feedback/list.tpl', $params); }
public function make() { csrf::getInstance()->buildToken(); $params = array(); if (system::getInstance()->post('submit') && csrf::getInstance()->check()) { if (admin::getInstance()->saveExtensionConfigs()) { $params['notify']['save_success'] = true; } } $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle(); $params['config']['captcha_type'] = extension::getInstance()->getConfig('captcha_type', 'captcha', extension::TYPE_HOOK, 'str'); $params['config']['captcha_publickey'] = extension::getInstance()->getConfig('captcha_publickey', 'captcha', extension::TYPE_HOOK, 'str'); $params['config']['captcha_privatekey'] = extension::getInstance()->getConfig('captcha_privatekey', 'captcha', extension::TYPE_HOOK, 'str'); return template::getInstance()->twigRender('hooks/captcha/settings.tpl', $params); }
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); }
private function viewFeedCategorys() { $params = array(); $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle(); $stmt = database::getInstance()->con()->query("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_com_feed_list"); $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); foreach ($result as $row) { $title = unserialize($row['title']); $params['rssfeed'][] = array('id' => $row['id'], 'title' => $title[language::getInstance()->getUseLanguage()], 'url' => $row['url']); } return template::getInstance()->twigRender('components/feed/list.tpl', $params); }
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); }
<?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();
private function viewCommentList() { csrf::getInstance()->buildToken(); $params = array(); if (system::getInstance()->post('deleteSelected') && csrf::getInstance()->check()) { $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') . "_mod_comments WHERE id IN (" . $listDelete . ")"); } } } $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle(); $filter = (int) system::getInstance()->get('filter'); $index = (int) system::getInstance()->get('index'); $db_index = $index * self::ITEM_PER_PAGE; $stmt = null; if ($filter == self::FILTER_MODERATE) { $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_mod_comments WHERE moderate = 1 ORDER BY id DESC LIMIT ?," . self::ITEM_PER_PAGE); $stmt->bindParam(1, $db_index, PDO::PARAM_INT); $stmt->execute(); } else { $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_mod_comments ORDER BY id DESC LIMIT ?," . self::ITEM_PER_PAGE); $stmt->bindParam(1, $db_index, PDO::PARAM_INT); $stmt->execute(); } $resultFetch = $stmt->fetchAll(PDO::FETCH_ASSOC); $authors_ids = system::getInstance()->extractFromMultyArray('author', $resultFetch); if (sizeof($authors_ids) > 1) { // 2 or more user::getInstance()->listload(system::getInstance()->extractFromMultyArray('author', $resultFetch)); } foreach ($resultFetch as $row) { $params['comments']['list'][] = array('id' => $row['id'], 'user_id' => $row['author'], 'user_name' => user::getInstance()->get('nick', $row['author']), 'comment' => extension::getInstance()->call(extension::TYPE_HOOK, 'bbtohtml')->nobbcode($row['comment']), 'guest_name' => system::getInstance()->nohtml($row['guest_name']), 'moderate' => $row['moderate'], 'date' => system::getInstance()->toDate($row['time'], 'h'), 'uri' => $row['pathway']); } $params['pagination'] = template::getInstance()->showFastPagination($index, self::ITEM_PER_PAGE, $this->getTotalCommentCount($filter), '?object=modules&action=comments&filter=' . $filter . '&index='); return template::getInstance()->twigRender('modules/comments/list.tpl', $params); }
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); }
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); }
private function viewStreamSettings() { csrf::getInstance()->buildToken(); $params = array(); $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle(); if (system::getInstance()->post('submit')) { if (admin::getInstance()->saveExtensionConfigs() && csrf::getInstance()->check()) { $params['notify']['save_success'] = true; } } $params['config']['count_stream_page'] = extension::getInstance()->getConfig('count_stream_page', 'stream', extension::TYPE_COMPONENT, 'int'); return template::getInstance()->twigRender('components/stream/settings.tpl', $params); }
private function viewUserList() { $params = array(); $params['extension']['title'] = admin::getInstance()->viewCurrentExtensionTitle(); $params['search']['value'] = system::getInstance()->nohtml(system::getInstance()->post('search')); $stmt = null; $index_start = (int) system::getInstance()->get('index'); $db_index = $index_start * self::ITEM_PER_PAGE; if (system::getInstance()->post('dosearch') && system::getInstance()->length($params['search']['value']) > 0) { $search_string = "%" . $params['search']['value'] . "%"; $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_user WHERE login like ? OR email like ? OR nick 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->bindParam(3, $search_string, PDO::PARAM_STR); $stmt->execute(); } else { $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_user ORDER BY id DESC LIMIT ?," . self::ITEM_PER_PAGE); $stmt->bindParam(1, $db_index, PDO::PARAM_INT); $stmt->execute(); } $res = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt = null; foreach ($res as $item) { $params['udata'][] = array('id' => $item['id'], 'login' => $item['login'], 'email' => $item['email']); } if (!system::getInstance()->post('dosearch')) { $params['pagination'] = template::getInstance()->showFastPagination($index_start, self::ITEM_PER_PAGE, $this->getUserTotalCount(), '?object=components&action=user&index='); } return template::getInstance()->twigRender('components/user/list.tpl', $params); }