예제 #1
0
$ft->define(array('main' => 'main.tpl', 'main_loader' => 'main_loader.tpl', 'rows' => 'rows.tpl', 'form_login' => 'form_login.tpl'));
$ft->assign(array('TITLE' => $i18n['index'][0], 'ERROR_MSG' => '', 'LANG' => $lang));
// deklaracja zmiennej $p
$p = empty($_GET['p']) ? '' : $_GET['p'];
if ($p == 'log') {
    $login = trim($_POST['login']);
    $password = trim(md5($_POST['password']));
    if (empty($login) || empty($password)) {
        // U�ytkownik nie uzupe�ni� wszystkich p�l::form
        $ft->assign('ERROR_MSG', $i18n['index'][1]);
        $ft->parse('ROWS', '.form_login');
    } else {
        $db = new DB_SQL();
        $query = sprintf("\n            SELECT \n                active \n            FROM \n                %1\$s \n            WHERE \n                login = '******' \n            AND \n                password = '******'", TABLE_USERS, $login, $password);
        $db->query($query);
        if ($db->num_rows()) {
            if ($db->f('active') != 'N') {
                // Rejestrujemy zmienne sesyjne
                $_SESSION['login'] = $login;
                $_SESSION['loggedIn'] = TRUE;
                header('Location: main.php');
                break;
            } else {
                // U�ytkownik nie zaaktywowa� konta::db
                $ft->assign('ERROR_MSG', $i18n['index'][2]);
                $ft->parse('ROWS', '.form_login');
            }
        } else {
            // Niepoprawne dane wej�cia<->wyj�cia::form, db
            $ft->assign('ERROR_MSG', $i18n['index'][3]);
            $ft->parse('ROWS', '.form_login');
예제 #2
0
require "administration/inc/config.php";
require "inc/common_lib.php";
require "inc/main_lib.php";
// mysql_server_version
get_mysql_server_version();
$db = new DB_SQL();
$query = sprintf("\r\n    SELECT \r\n        b.*, a.id, a.title \r\n    FROM \r\n        %1\$s b \r\n    LEFT JOIN \r\n        %2\$s a \r\n    ON \r\n        b.comments_id = a.id \r\n    GROUP BY \r\n        date \r\n    DESC \r\n    LIMIT \r\n        %3\$d", TABLE_COMMENTS, TABLE_MAIN, 10);
$db->query($query);
$rewrite = get_config('mod_rewrite');
$lang = get_config('language_set');
$ft = new FastTemplate('./templates/' . $lang . '/main/tpl/');
$ft->define('xml_feed', 'xml_feed.tpl');
$ft->define_dynamic('xml_row', 'xml_feed');
$http_root = get_httproot();
$ft->assign(array('MAINSITE_LINK' => 'http://' . $http_root, 'NEWS_FEED' => false));
if ($db->num_rows() > 0) {
    while ($db->next_record()) {
        $date = $db->f("date");
        $title = $db->f("title");
        $text = $db->f("text");
        $author = $db->f("author");
        $id = $db->f("id");
        $image = $db->f("image");
        $comments_allow = $db->f("comments_allow");
        $comments = $db->f("comments");
        $date = coreRssDateConvert($date);
        $pattern = array("&", "<br />", "<", ">");
        $replacement = array(" &amp; ", "&lt;br /&gt;", "&lt;", "&gt;");
        $text = str_replace($pattern, $replacement, $text);
        $permanent_link = (bool) $rewrite ? $http_root . '1,' . $id . ',1,item.html' : $http_root . 'index.php?p=1&amp;id=' . $id . '';
        $ft->assign(array('DATE' => $date, 'TITLE' => $title, 'AUTHOR' => $author, 'PERMALINK' => $permanent_link, 'TEXT' => $text, 'DISPLAY_XML' => true));