Example #1
0
    public function getContent()
    {
        global $sql;
        // Strona zabezpieczona wykonuje dwa niepotrzebne zapytania, mimo, że tekst sie nie wyświetla, należy po pierwszym zapytaniu wykonać fetch_assoc
        $page = $sql->query('
			SELECT * FROM ' . DB_PREFIX . 'subpages
			WHERE id = ' . $this->id)->fetch();
        // Page does not exist
        if (!$page) {
            return not_found('Page you have been loking for does not exists.');
        } else {
            if ($page['permit'] == 0) {
                return no_access();
            } else {
                if (!LOGGED && $page['type'] == 2) {
                    return no_access(array('Wybrana treść jest dostępna tylko dla zalogowanych osób.', t('REGISTER')));
                } else {
                    Kio::addTitle($page['title']);
                    Kio::addBreadcrumb($page['title'], $page['id'] . '/' . clean_url($page['title']));
                    //			$this->subcodename = $page['number'];
                    Kio::addHead($page['head']);
                    if ($page['description']) {
                        Kio::setDescription($page['description']);
                    }
                    if ($page['keywords']) {
                        Kio::setKeywords($page['keywords']);
                    }
                    return eval('?>' . $page['content']);
                }
            }
        }
    }
Example #2
0
    private function getFullEntry()
    {
        global $sql, $plug;
        $stmt = $sql->setCache('news_read_' . u2)->query('
			SELECT u.nickname, u.group_id, c.id c_id, c.name c_name, c.description c_description, n.*
			FROM ' . DB_PREFIX . 'news n
			LEFT JOIN ' . DB_PREFIX . 'users AS u ON u.id = n.author_id
			LEFT JOIN ' . DB_PREFIX . 'news_categories c ON c.id = n.category_id
			WHERE n.id = ' . u2);
        if ($entry = $stmt->fetch(PDO::FETCH_ASSOC)) {
            if ($entry['description']) {
                Kio::setDescription($entry['description']);
            }
            if ($entry['keywords']) {
                Kio::setKeywords($entry['keywords']);
            }
            if ($entry['c_name']) {
                Kio::addTitle($entry['c_name']);
                Kio::addBreadcrumb($entry['c_name'], 'news/category/' . $entry['c_id'] . '/' . clean_url($entry['c_name']));
            }
            if ($entry['author_id']) {
                $entry['author'] = User::format($entry['author_id'], $entry['nickname'], $entry['group_id']);
            }
            $entry['url'] = 'news/read/' . u2 . '/' . ($entry['c_name'] ? clean_url($entry['c_name']) . '/' : '') . clean_url($entry['title']);
            $this->subcodename = 'read';
            Kio::addTitle($entry['title']);
            Kio::addBreadcrumb($entry['title'], $entry['url']);
            if (Plugin::exists('comments')) {
                require_once ROOT . 'plugins/comments/comments.plugin.php';
                $comments = new Comments(u2, 'news', $entry['comments'], $entry['url']);
                $comments = $comments->getContent();
            } else {
                $comments = '';
            }
            try {
                $tpl = new PHPTAL('modules/news/read.tpl.html');
                $tpl->entry = $entry;
                $tpl->comments = $comments;
                return $tpl->execute();
            } catch (Exception $e) {
                return template_error($e);
            }
        } else {
            not_found(t('Selected entry number does not exists.'));
        }
    }
Example #3
0
define('YESTERDAY', date('Y-m-d', TIMESTAMP - 86400));
define('TOMMOROW', date('Y-m-d', TIMESTAMP + 86400));
require_once ROOT . 'system/functions.php';
Kio::startTimer();
require_once ROOT . 'config.php';
error_reporting(ERRORS);
if (!INSTALLED) {
    redirect(ROOT . 'install.php');
}
require_once ROOT . 'system/' . DB_TYPE . '.php';
Kio::loadConfig();
Kio::loadStats();
Kio::loadGroups();
Kio::addTitle(Kio::getConfig('title'));
Kio::setDescription(Kio::getConfig('description'));
Kio::setKeywords(Kio::getConfig('keywords'));
Kio::addHead(Kio::getConfig('header'));
$kio->show_blocks = true;
$kio->blocks = Kio::getConfig('blocks');
$kio->columns = Kio::getConfig('columns');
$kio->functions = array('set_magic_quotes_runtime', 'ini_set', 'date_default_timezone_set', 'mb_strlen');
$kio->functions = array_map('function_exists', array_combine($kio->functions, $kio->functions));
// Za spacje należy użyć \s, np. tanie\skomputery
$kio->spam_words = str_replace(array(',', ' ', '#'), array('|', '', ''), Kio::getConfig('spam_words'));
// Characters to replace
$kio->chars = unserialize(Kio::getConfig('chars')) + array(' ' => '_', '\' => '', '"' => '', ''' => '', '`' => '', '"' => '', '>' => '', '<' => '', '&' => '');
// Check timezone_identifiers_list()
$kio->bbcode = (include ROOT . 'system/parser/bbcode/' . (Kio::getConfig('bbcode_parser') ? Kio::getConfig('bbcode_parser') . '.php' : 'index.php'));
$kio->emoticons = (include ROOT . 'system/parser/emoticons/' . (Kio::getConfig('emoticons_parser') ? Kio::getConfig('emoticons_parser') . '.php' : 'index.php'));
$kio->censure = (include ROOT . 'system/parser/censure/' . (Kio::getConfig('censure_parser') ? Kio::getConfig('censure_parser') . '.php' : 'index.php'));
session_start();