コード例 #1
0
ファイル: login.php プロジェクト: sunlight-cms/sunlight-cms-7
<?php

/* ---  kontrola jadra  --- */
if (!defined('_core')) {
    exit;
}
/* ---  vystup  --- */
$form = _uniForm("login");
$module .= $form[0];
unset($form);
// moznosti
if (_loginindicator) {
    $module .= "<h2>" . $_lang['global.choice'] . "</h2>\n<ul>\n";
    // pole polozek (adresa, titulek, podminky pro zobrazeni)
    $items = array(array("index.php?m=settings", $_lang['mod.settings'], true), array("index.php?m=profile&amp;id=" . _loginname, $_lang['mod.settings.profilelink'], true), array("index.php?m=messages", $_lang['mod.messages'] . " [" . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-pm` WHERE (receiver=" . _loginid . " AND receiver_deleted=0 AND receiver_readtime<update_time) OR (sender=" . _loginid . " AND sender_deleted=0 AND sender_readtime<update_time)"), 0) . "]", _messages), array("admin/", $_lang['admin.title'], _loginright_administration));
    // vypis
    foreach ($items as $item) {
        if ($item[2]) {
            $module .= "<li><a href='" . $item[0] . "'>" . $item[1] . "</a></li>\n";
        }
    }
    $module .= "</ul>\n";
}
コード例 #2
0
/**
 * Vytvoreni vypisu prispevku
 *
 * Type Popis               Vars
 * 1    komentare sekce     zamknute komentare 1/0
 * 2    komentare článku    zamknute komentare 1/0
 * 3    prispevky v knize   [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0]
 * 5    temata ve foru      [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0]
 * 6    odpovedi na tema    [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0, id tematu]
 * 7    vypis vzkazu        [zamknuto 1/0]
 * 8    vypis pluginpostu   [polozek na stranu, povoleno prispivani 1/0, zamknuto 1/0, plugin flag, radit sestupne 1/0, [titulek / null]]
 *
 * @param int $type typ prispevku
 * @param int $home id polozky asociovane s komentari
 * @param mixed $vars promenna nastaveni podle typu
 * @param bool $force_locked vynutit zamknuty stav
 * @param string|null $url vlastni url nebo null (= automaticky)
 * @return string
 */
function _postsOutput($type, $home, $vars, $force_locked = false, $url = null)
{
    global $_lang;
    /* ---  typ  --- */
    // vychozi hodnoty
    $desc = "DESC ";
    $ordercol = 'id';
    $countcond = "type=" . $type . " AND xhome=-1 AND home=" . $home;
    $locked_textid = '';
    $autolast = false;
    $postlink = false;
    $pluginflag = null;
    // url
    if (!isset($url)) {
        $url = _indexOutput_url;
    }
    $url_html = _htmlStr($url);
    switch ($type) {
        // komentare v sekci
        case 1:
            $posttype = 1;
            $xhome = -1;
            $subclass = "comments";
            $title = $_lang['posts.comments'];
            $addlink = $_lang['posts.addcomment'];
            $nopostsmessage = $_lang['posts.nocomments'];
            $postsperpage = _commentsperpage;
            $canpost = _loginright_postcomments;
            $locked = _boolean($vars);
            $replynote = true;
            break;
            // komentare u clanku
        // komentare u clanku
        case 2:
            $posttype = 2;
            $xhome = -1;
            $subclass = "comments";
            $title = $_lang['posts.comments'];
            $addlink = $_lang['posts.addcomment'];
            $nopostsmessage = $_lang['posts.nocomments'];
            $postsperpage = _commentsperpage;
            $canpost = _loginright_postcomments;
            $locked = _boolean($vars);
            $replynote = true;
            break;
            // prispevky v knize
        // prispevky v knize
        case 3:
            $posttype = 3;
            $xhome = -1;
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addpost'];
            $nopostsmessage = $_lang['posts.noposts'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = true;
            break;
            // temata ve foru
        // temata ve foru
        case 5:
            $posttype = 5;
            $xhome = -1;
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addtopic'];
            $nopostsmessage = $_lang['posts.notopics'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = true;
            $ordercol = 'bumptime';
            $locked_textid = '3';
            break;
            // odpovedi v tematu
        // odpovedi v tematu
        case 6:
            $posttype = 5;
            $xhome = $vars[3];
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addanswer'];
            $nopostsmessage = $_lang['posts.noanswers'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = false;
            $desc = "";
            $countcond = "type=5 AND xhome=" . $xhome . " AND home=" . $home;
            $autolast = isset($_GET['autolast']);
            $postlink = true;
            break;
            // odpovedi v konverzaci
        // odpovedi v konverzaci
        case 7:
            $posttype = 6;
            $xhome = null;
            $subclass = "book";
            $title = null;
            $addlink = $_lang['posts.addanswer'];
            $nopostsmessage = $_lang['posts.noanswers'];
            $postsperpage = _messagesperpage;
            $canpost = true;
            $locked = _boolean($vars[0]);
            $replynote = false;
            $desc = "";
            $countcond = "type=6 AND home=" . $home;
            $locked_textid = '4';
            $autolast = true;
            break;
            // plugin posty
        // plugin posty
        case 8:
            $posttype = 7;
            $xhome = -1;
            $subclass = "book";
            $title = isset($vars[5]) ? $vars[5] : null;
            $addlink = $_lang['posts.addpost'];
            $nopostsmessage = $_lang['posts.noposts'];
            $postsperpage = $vars[0];
            $canpost = $vars[1];
            $locked = _boolean($vars[2]);
            $replynote = true;
            $pluginflag = $vars[3];
            $countcond .= " AND flag=" . $pluginflag;
            if (!$vars[4]) {
                $desc = '';
            }
            break;
    }
    // vynutit uzamceni parametrem
    if ($force_locked) {
        $locked = true;
    }
    // extend
    $callback = null;
    _extend('call', 'posts.output', array('type' => $type, 'home' => $home, 'xhome' => $xhome, 'vars' => $vars, 'post_type' => $posttype, 'plugin_flag' => $pluginflag, 'canpost' => &$canpost, 'locked' => &$locked, 'autolast' => &$autolast, 'post_link' => &$postlink, 'posts_per_page' => &$postsperpage, 'sql_desc' => &$desc, 'sql_ordercol' => &$ordercol, 'sql_countcond' => &$countcond, 'callback' => &$callback));
    /* ---  vystup  --- */
    $output = "\n  <div class='anchor'><a name='posts'></a></div>\n  <div class='posts-" . $subclass . "'>\n  ";
    if ($title != null) {
        $output .= "<h2>" . $title . _linkRss($home, $posttype) . "</h2>\n";
    }
    $output .= "<div class='posts-form' id='post-form'>\n";
    /* ---  priprava strankovani  --- */
    $paging = _resultPaging($url_html, $postsperpage, "posts", $countcond, "#posts", null, $autolast);
    /* ---  zprava  --- */
    if (isset($_GET['r'])) {
        switch ($_GET['r']) {
            case 0:
                $output .= _formMessage(2, $_lang['posts.failed']);
                break;
            case 1:
                $output .= _formMessage(1, $_lang[$type != 5 ? 'posts.added' : 'posts.topicadded']);
                break;
            case 2:
                $output .= _formMessage(2, str_replace("*postsendexpire*", _postsendexpire, $_lang['misc.requestlimit']));
                break;
            case 3:
                $output .= _formMessage(2, $_lang['posts.guestnamedenied']);
                break;
            case 4:
                $output .= _formMessage(2, $_lang['xsrf.msg']);
                break;
        }
    }
    /* ---  formular nebo odkaz na pridani  --- */
    if (!$locked and (isset($_GET['addpost']) or isset($_GET['replyto']))) {
        // nacteni cisla prispevku pro odpoved
        if ($xhome == -1) {
            if (isset($_GET['replyto']) and $_GET['replyto'] != -1) {
                $reply = intval($_GET['replyto']);
                if ($replynote) {
                    $output .= "<p>" . $_lang['posts.replynote'] . " (<a href='" . $url_html . "#posts'>" . $_lang['global.cancel'] . "</a>).</p>";
                }
            } else {
                $reply = -1;
            }
        } else {
            $reply = $xhome;
        }
        // formular nebo prihlaseni
        if ($canpost) {
            $form = _uniForm("postform", array('posttype' => $type, 'pluginflag' => $pluginflag, 'posttarget' => $home, 'xhome' => $reply, 'url' => $url));
            $output .= $form[0];
        } else {
            $loginform = _uniForm("login", array(), true);
            $output .= "<p>" . $_lang['posts.loginrequired'] . "</p>" . $loginform[0];
        }
    } else {
        if (!$locked) {
            $output .= "<a href='" . _addGetToLink($url_html, "addpost&amp;page=" . $paging[2]) . "#posts'><strong>" . $addlink . " &gt;</strong></a>";
        } else {
            $output .= "<img src='" . _templateImage("icons/lock.png") . "' alt='stop' class='icon' /> <strong>" . $_lang['posts.locked' . $locked_textid] . "</strong>";
        }
    }
    $output .= "</div>\n<div class='hr'><hr /></div>\n\n";
    /* ---  vypis  --- */
    if (_pagingmode == 1 or _pagingmode == 2) {
        $output .= $paging[0];
    }
    // zaklad query
    if ($type == 5) {
        $sql = "SELECT id,author,guest,subject,time,ip,locked,bumptime,sticky,(SELECT COUNT(id) FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND xhome=post.id) AS answer_count";
    } else {
        $sql = "SELECT id,xhome,subject,text,author,guest,time,ip" . _extend('buffer', 'posts.columns');
    }
    $sql .= " FROM `" . _mysql_prefix . "-posts` AS post";
    // podminky a razeni
    $sql .= " WHERE post.type=" . $posttype . (isset($xhome) ? " AND post.xhome=" . $xhome : '') . " AND post.home=" . $home . (isset($pluginflag) ? " AND post.flag=" . $pluginflag : '');
    $sql .= " ORDER BY " . ($type == 5 ? 'sticky DESC,' : '') . $ordercol . ' ' . $desc . $paging[1];
    // dotaz
    $query = DB::query($sql);
    unset($sql);
    // nacteni prispevku do pole
    $items = array();
    if ($type == 5) {
        $item_ids_with_answers = array();
    }
    while ($item = DB::row($query)) {
        $items[$item['id']] = $item;
        if ($type == 5 && $item['answer_count'] != 0) {
            $item_ids_with_answers[] = $item['id'];
        }
    }
    // uvolneni dotazu
    DB::free($query);
    if ($type == 5) {
        // posledni prispevek (pro vypis temat)
        if (!empty($item_ids_with_answers)) {
            $topicextra = DB::query("SELECT * FROM (SELECT id,xhome,author,guest FROM `" . _mysql_prefix . "-posts` AS reply WHERE type=5 AND home=" . $home . " AND xhome IN(" . implode(',', $item_ids_with_answers) . ") ORDER BY reply.id DESC) AS replies GROUP BY xhome");
            while ($item = DB::row($topicextra)) {
                if (!isset($items[$item['xhome']])) {
                    if (_dev) {
                        trigger_error('Nenalezen domovsky prispevek pro odpoved #' . $item['id'], E_USER_WARNING);
                    }
                    continue;
                }
                $items[$item['xhome']]['_lastpost'] = $item;
            }
        }
    } elseif (!empty($items)) {
        // odpovedi (pro komentare)
        $answers = DB::query("SELECT id,xhome,text,author,guest,time,ip FROM `" . _mysql_prefix . "-posts` WHERE type=" . $posttype . " AND home=" . $home . (isset($pluginflag) ? " AND flag=" . $pluginflag : '') . " AND xhome IN(" . implode(',', array_keys($items)) . ") ORDER BY id");
        while ($item = DB::row($answers)) {
            if (!isset($items[$item['xhome']])) {
                if (_dev) {
                    trigger_error('Nenalezen domovsky prispevek pro odpoved #' . $item['id'], E_USER_WARNING);
                }
                continue;
            }
            if (!isset($items[$item['xhome']]['_answers'])) {
                $items[$item['xhome']]['_answers'] = array();
            }
            $items[$item['xhome']]['_answers'][] = $item;
        }
        DB::free($answers);
    }
    // vypis
    if (!empty($items)) {
        // vypis prispevku nebo temat
        if ($type != 5) {
            $hl = true;
            foreach ($items as $item) {
                // nacteni autora
                if ($item['guest'] == "") {
                    $author = _linkUser($item['author'], "post-author");
                } else {
                    $author = "<span class='post-author-guest' title='" . _showIP($item['ip']) . "'>" . $item['guest'] . "</span>";
                }
                // odkazy pro spravu
                $post_access = _postAccess($item);
                if ($type < 6 or $type > 7 or $post_access) {
                    $actlinks = " <span class='post-actions'>";
                    if (($type < 6 or $type > 7) && !$locked) {
                        $actlinks .= "<a href='" . _addGetToLink($url_html, "replyto=" . $item['id']) . "#posts'>" . $_lang['posts.reply'] . "</a>";
                    }
                    if ($post_access) {
                        $actlinks .= (($type < 6 or $type > 7) ? " " : '') . "<a href='index.php?m=editpost&amp;id=" . $item['id'] . "'>" . $_lang['global.edit'] . "</a>";
                    }
                    $actlinks .= "</span>";
                } else {
                    $actlinks = "";
                }
                // avatar
                if (_show_avatars) {
                    $avatar = _getAvatar($item['author']);
                } else {
                    $avatar = null;
                }
                // prispevek
                $hl = !$hl;
                _extend('call', 'posts.post', array('item' => &$item, 'avatar' => &$avatar, 'type' => $type));
                if (null === $callback) {
                    $output .= "<div id='post-" . $item['id'] . "' class='post" . ($hl ? ' post-hl' : '') . (isset($avatar) ? ' post-withavatar' : '') . "'><div class='post-head'>" . $author;
                    if ($type < 6 || $type > 7) {
                        $output .= ", <span class='post-subject'>" . $item['subject'] . "</span> ";
                    }
                    $output .= "<span class='post-info'>(" . _formatTime($item['time']) . ")</span>" . $actlinks . ($postlink ? "<a class='post-postlink' href='" . _addGetToLink($url_html, 'page=' . $paging[2]) . "#post-" . $item['id'] . "'><span>#" . str_pad($item['id'], 6, '0', STR_PAD_LEFT) . "</span></a>" : '') . "</div><div class='post-body" . (isset($avatar) ? ' post-body-withavatar' : '') . "'>" . $avatar . '<div class="post-body-text">' . _parsePost($item['text']) . "</div></div></div>\n";
                } else {
                    $output .= call_user_func($callback, array('item' => $item, 'avatar' => $avatar, 'author' => $author, 'actlinks' => $actlinks, 'page' => $paging[2], 'postlink' => $postlink));
                }
                // odpovedi
                if (($type < 6 || $type > 7) && isset($item['_answers'])) {
                    foreach ($item['_answers'] as $answer) {
                        // jmeno autora
                        if ($answer['guest'] == "") {
                            $author = _linkUser($answer['author'], "post-author");
                        } else {
                            $author = "<span class='post-author-guest' title='" . _showIP($answer['ip']) . "'>" . $answer['guest'] . "</span>";
                        }
                        // odkazy pro spravu
                        if (_postAccess($answer)) {
                            $actlinks = " <span class='post-actions'><a href='index.php?m=editpost&amp;id=" . $answer['id'] . "'>" . $_lang['global.edit'] . "</a></span>";
                        } else {
                            $actlinks = "";
                        }
                        // avatar
                        if (_show_avatars) {
                            $avatar = _getAvatar($answer['author']);
                        } else {
                            $avatar = null;
                        }
                        _extend('call', 'posts.post', array('item' => &$answer, 'avatar' => &$avatar, 'type' => $type));
                        if (null === $callback) {
                            $output .= "<div id='post-" . $answer['id'] . "' class='post-answer" . (isset($avatar) ? ' post-answer-withavatar' : '') . "'><div class='post-head'>" . $author . " " . $_lang['posts.replied'] . " <span class='post-info'>(" . _formatTime($answer['time']) . ")</span>" . $actlinks . "</div><div class='post-body" . (isset($avatar) ? ' post-body-withavatar' : '') . "'>" . $avatar . '<div class="post-body-text">' . _parsePost($answer['text']) . "</div></div></div>\n";
                        } else {
                            $output .= call_user_func($callback, array('item' => $answer, 'avatar' => $avatar, 'author' => $author, 'actlinks' => $actlinks, 'page' => $paging[2], 'postlink' => $postlink));
                        }
                    }
                }
            }
            if (_pagingmode == 2 or _pagingmode == 3) {
                $output .= "<br />" . $paging[0];
            }
        } else {
            // tabulka s tematy
            $hl = false;
            $output .= "\n<table class='topic-table'>\n<thead><tr><td colspan='2'><strong>" . $_lang['posts.topic'] . "</strong></td><td><strong>" . $_lang['global.answersnum'] . "</strong></td><td><strong>" . $_lang['global.lastanswer'] . "</strong></td></tr></thead>\n<tbody>\n";
            foreach ($items as $item) {
                // nacteni autora
                if ($item['guest'] == "") {
                    $author = _linkUser($item['author'], "post-author", false, false, 16);
                } else {
                    $author = "<span class='post-author-guest' title='" . _showIP($item['ip']) . "'>" . _cutStr($item['guest'], 16) . "</span>";
                }
                // nacteni jmena autora posledniho prispevku
                if (isset($item['_lastpost'])) {
                    if ($item['_lastpost']['author'] != -1) {
                        $lastpost = _linkUser($item['_lastpost']['author'], "post-author", false, false, 16);
                    } else {
                        $lastpost = "<span class='post-author-guest'>" . _cutStr($item['_lastpost']['guest'], 16) . "</span>";
                    }
                } else {
                    $lastpost = "-";
                }
                // vyber ikony
                if ($item['sticky']) {
                    $icon = 'sticky';
                } elseif ($item['locked']) {
                    $icon = 'locked';
                } elseif ($item['answer_count'] == 0) {
                    $icon = 'new';
                } elseif ($item['answer_count'] < _topic_hot_ratio) {
                    $icon = 'normal';
                } else {
                    $icon = 'hot';
                }
                // mini strankovani
                $tpages = '';
                $tpages_num = ceil($item['answer_count'] / _commentsperpage);
                if ($tpages_num == 0) {
                    $tpages_num = 1;
                }
                if ($tpages_num > 1) {
                    $tpages .= '<span class=\'topic-pages\'>';
                    for ($i = 1; $i <= 3 && $i <= $tpages_num; ++$i) {
                        $tpages .= "<a href='index.php?m=topic&amp;id=" . $item['id'] . "&amp;page=" . $i . "#posts'>" . $i . '</a>';
                    }
                    if ($tpages_num > 3) {
                        $tpages .= "<a href='index.php?m=topic&amp;id=" . $item['id'] . "&amp;page=" . $tpages_num . "'>" . $tpages_num . ' &rarr;</a>';
                    }
                    $tpages .= '</span>';
                }
                // vystup radku
                $output .= "<tr class='topic-" . $icon . ($hl ? ' topic-hl' : '') . "'><td class='topic-icon-cell'><a href='index.php?m=topic&amp;id=" . $item['id'] . "'><img src='" . _templateImage('icons/topic-' . $icon . '.png') . "' alt='" . $_lang['posts.topic.' . $icon] . "' /></a></td><td class='topic-main-cell'><a href='index.php?m=topic&amp;id=" . $item['id'] . "'>" . $item['subject'] . "</a>" . $tpages . "<br />" . $author . " <small class='post-info'>(" . _formatTime($item['time']) . ")</small></td><td>" . $item['answer_count'] . "</td><td>" . $lastpost . ($item['answer_count'] != 0 ? "<br /><small class='post-info'>(" . _formatTime($item['bumptime']) . ")</small>" : '') . "</td></tr>\n";
                $hl = !$hl;
            }
            $output .= "</tbody></table><br />\n\n";
            if (_pagingmode == 2 or _pagingmode == 3) {
                $output .= $paging[0] . "<br />";
            }
            // posledni odpovedi
            $output .= "\n<div class='hr'><hr /></div><br />\n<h3>" . $_lang['posts.forum.lastact'] . "</h3>\n";
            $query = DB::query("SELECT topic.id AS topic_id,topic.subject AS topic_subject,answer.author,answer.guest,answer.time FROM `" . _mysql_prefix . "-posts` AS answer JOIN `" . _mysql_prefix . "-posts` AS topic ON(topic.type=5 AND topic.id=answer.xhome) WHERE answer.type=5 AND answer.home=" . $home . " AND answer.xhome!=-1 ORDER BY answer.id DESC LIMIT " . _extratopicslimit);
            if (DB::size($query) != 0) {
                $output .= "<ul>\n";
                while ($item = DB::row($query)) {
                    if ($item['guest'] == "") {
                        $author = _linkUser($item['author']);
                    } else {
                        $author = "<span class='post-author-guest'>" . $item['guest'] . "</span>";
                    }
                    $output .= "<li><a href='index.php?m=topic&amp;id=" . $item['topic_id'] . "'>" . $item['topic_subject'] . "</a>&nbsp;&nbsp;<small>(" . $_lang['global.postauthor'] . " " . $author . " " . _formatTime($item['time']) . ")</small></li>\n";
                }
                $output .= "</ul>\n\n";
            } else {
                $output .= "<p>" . $_lang['global.nokit'] . "</p>";
            }
        }
    } else {
        $output .= "<p>" . $nopostsmessage . "</p>";
    }
    $output .= "</div>";
    return $output;
}
コード例 #3
0
ファイル: index.php プロジェクト: sunlight-cms/sunlight-cms-7
                    _extend('call', 'admin.mod.' . $getp . '.post', $extend_args);
                    _extend('call', 'admin.mod.post', $extend_args);
                } else {
                    $output .= _formMessage(2, $_lang['admin.moduleunavailable']);
                }
            } else {
                $output .= "<h1>" . $_lang['global.error'] . "</h1>" . _formMessage(3, $_lang['global.accessdenied']);
            }
        } else {
            $output .= "<h1>" . $_lang['global.error404.title'] . "</h1>" . _formMessage(2, $_lang['global.error404']);
        }
    }
} else {
    // prihlasovaci formular
    if (empty($_POST)) {
        $login = _uniForm("login");
        $output .= $login[0];
    } else {
        $output .= "<h1>" . $_lang['admin.postrestore.title'] . "</h1>\n<p class='bborder'>" . $_lang['admin.postrestore.p'] . "</p>\n" . _formMessage(2, $_lang['admin.postrestore.msg']) . "\n<form action='' method='post'>\n<input type='submit' name='' value='" . $_lang['admin.postrestore.button'] . "' />\n" . _getPostdata(false, null, array('_security_token')) . "\n" . _xsrfProtect() . "</form>\n";
    }
}
/* ---  paticka, vypis vystupu  --- */
// paticka
$output .= '
<div class="cleaner"></div>
</div>

<hr class="hidden" />
<div id="copyright">
<div>' . ((_loginindicator and _loginright_administration) ? '<a href="' . _url . '/" target="_blank">' . $_lang['admin.link.site'] . '</a> &nbsp;&bull;&nbsp; <a href="./" target="_blank">' . $_lang['admin.link.newwin'] . '</a>' : '<a href="../">&lt; ' . $_lang['admin.link.home'] . '</a>') . '</div>
';
コード例 #4
0
ファイル: index.php プロジェクト: sunlight-cms/sunlight-cms-7
if (!defined('_indexOutput_url')) {
    define('_indexOutput_url', _indexroot);
}
if (!defined('_path')) {
    define('_path', $base_path);
}
/* --  nenalezeno nebo pozadovani prihlaseni pro neverejny obsah  -- */
if (!defined('_indexOutput_content')) {
    if (!$notpublic_form) {
        $content_404 = (_template_autoheadings ? "<h1>" . $_lang['global.error404.title'] . "</h1>" : '') . _formMessage(2, $_lang['global.error404']);
        _extend('call', 'index.notfound', _extendArgs($content_404));
        define('_indexOutput_content', $content_404);
        define('_indexOutput_title', $_lang['global.error404.title']);
        $found = false;
    } else {
        $form = _uniForm("notpublic", array($notpublic_form_wholesite));
        _extend('call', 'index.notpublic', _extendArgs($form[0]));
        define('_indexOutput_content', $form[0]);
        define('_indexOutput_title', $form[1]);
    }
}
/* --  vlozeni sablony motivu nebo presmerovani  -- */
if (!defined('_redirect_to')) {
    if (!$found) {
        header('HTTP/1.1 404 Not Found');
    }
    $template_path = _extend('fetch', 'index.template');
    if (null === $template_path) {
        $template_path = _indexroot . 'plugins/templates/' . _template . '/template.php';
    }
    require $template_path;
コード例 #5
0
ファイル: topic.php プロジェクト: sunlight-cms/sunlight-cms-7
                    } else {
                        $author_name = $author_name['username'];
                    }
                    $avatar = "<img src='" . $avatar . "' alt='" . $author_name . "' class='topic-avatar' />";
                }
            }
        } else {
            $author = "<span class='post-author-guest' title='" . _showIP($query['ip']) . "'>" . $query['guest'] . "</span>";
        }
        // vystup
        $module .= "\n<h2>" . $_lang['posts.topic'] . ": " . $query['subject'] . _linkRSS($id, 6) . "</h2>\n<p><small>" . $_lang['global.postauthor'] . " " . $author . " " . _formatTime($query['time']) . "</small>" . $editlink . "</p>\n<p>" . $avatar . _parsePost($query['text']) . "</p>\n<div class='cleaner'></div>\n";
        // odpovedi
        require_once _indexroot . 'require/functions-posts.php';
        $module .= _postsOutput(6, $homedata['id'], array(_commentsperpage, _publicAccess($homedata['var3']), $homedata['var2'], $id), $query['locked'] == 1);
    } else {
        $form = _uniForm("notpublic");
        $module .= $form[0];
    }
} else {
    define('_indexOutput_url', "index.php?m=topic");
    if (_template_autoheadings) {
        $module .= "<h1>" . $_lang['global.error404.title'] . "</h1>\n";
    }
    $module .= _formMessage(2, $_lang['posts.topic.notfound']);
    $found = false;
}
/* ---  titulek  --- */
if ($forumtitle != "" and $topictitle != "") {
    define('_indexOutput_title', $forumtitle . " " . _titleseparator . " " . $topictitle);
} else {
    define('_indexOutput_title', $_lang['mod.topic']);
コード例 #6
0
/**
 * Sestavit kod systemoveho formulare
 *
 * $id          Popis                                       $vars
 *
 * login        prihlasovaci formular                       -
 * notpublic    prihlasovaci formular (neverejny obsah)     [wholesite 1/0]
 * postform     formular pro zaslani prispevku/komentare    [posttype => viz fce _postsOutput, posttarget => id_home, xhome => id_xhome, [pluginflag(pouze pro typ 7)] => xx)]
 *
 * @param string $id identifikator formulare
 * @param array $vars promenne dle typu
 * @param bool $notitle nevkladat titulek do formulare 1/0
 * @param bool $extend volat extend udalosti 1/0
 * @return array array(content, title)
 */
function _uniForm($id, $vars = array(), $notitle = false, $extend = true)
{
    // priprava
    global $_lang;
    $content = "";
    $title = "";
    // extend
    if ($extend) {
        _extend('call', 'sys.form', array('id' => $id, 'vars' => $vars, 'notitle' => &$notitle, 'content' => &$content));
    }
    // typ
    if ('' === $content) {
        switch ($id) {
            /* ---  prihlaseni  --- */
            case "login":
                // titulek
                $title = $_lang['login.title'];
                // zpravy
                if (isset($_GET['_mlr'])) {
                    switch ($_GET['_mlr']) {
                        case 0:
                            $content .= _formMessage(2, $_lang['login.failure']);
                            break;
                        case 1:
                            if (_loginindicator and !_administration) {
                                $content .= _formMessage(1, $_lang['login.success']);
                            }
                            break;
                        case 2:
                            if (!_loginindicator) {
                                $content .= _formMessage(2, $_lang['login.blocked.message']);
                            }
                            break;
                        case 3:
                            if (!_loginindicator) {
                                $content .= _formMessage(3, $_lang['login.securitylogout']);
                            }
                            break;
                        case 4:
                            if (!_loginindicator) {
                                $content .= _formMessage(1, $_lang['login.selfremove']);
                            }
                            break;
                        case 5:
                            if (!_loginindicator) {
                                $content .= _formMessage(2, str_replace(array("*1*", "*2*"), array(_maxloginattempts, _maxloginexpire / 60), $_lang['login.attemptlimit']));
                            }
                            break;
                        case 6:
                            $content .= _formMessage(3, $_lang['xsrf.msg']);
                            break;
                    }
                }
                // obsah
                if (!_loginindicator) {
                    // adresa pro navrat
                    if (isset($_GET['login_form_return'])) {
                        $return = $_GET['login_form_return'];
                    } else {
                        $return = $_SERVER['REQUEST_URI'];
                    }
                    // adresa formulare
                    $form_url = parse_url($_SERVER['REQUEST_URI']);
                    if (isset($form_url['query'])) {
                        parse_str($form_url['query'], $form_url['query']);
                        unset($form_url['query']['_formData'], $form_url['query']['_mlr']);
                        $form_url = _buildURL($form_url);
                    } else {
                        $form_url = $_SERVER['REQUEST_URI'];
                    }
                    // kod formulare
                    $callArgs = array("login_form", _indexroot . "remote/login.php?_return=" . urlencode($return), array(array($_lang['login.username'], "<input type='text' name='username' class='inputmedium'" . _restoreGetFdValue("username") . " maxlength='24' />"), array($_lang['login.password'], "<input type='password' name='password' class='inputmedium' />")), null, $_lang['global.login'], "&nbsp;&nbsp;<label><input type='checkbox' name='persistent' value='1' /> " . $_lang['login.persistent'] . "</label><input type='hidden' name='form_url' value='" . _htmlStr($form_url) . "' />\n                        &nbsp;&nbsp;<label><input type='checkbox' name='ipbound' value='1' checked='checked' /> " . (isset($_lang['login.ipbound']) ? $_lang['login.ipbound'] : 'zabezpečené') . "</label>");
                    if ($extend) {
                        _extend('call', 'sys.form.login', array('call' => &$callArgs));
                    }
                    $content .= call_user_func_array('_formOutput', $callArgs);
                    // odkazy
                    if (_registration or _lostpass) {
                        $content .= "\n\n<p>\n" . ((_registration and !_administration) ? "<a href='" . _indexroot . "index.php?m=reg'>" . $_lang['mod.reg'] . " &gt;</a>\n" : '') . (_lostpass ? ((_registration and !_administration) ? "<br />" : '') . "<a href='" . _indexroot . "index.php?m=lostpass'>" . $_lang['mod.lostpass'] . " &gt;</a>\n" : '') . "</p>";
                    }
                } else {
                    $content .= "<p>" . $_lang['login.ininfo'] . " <em>" . _loginname . "</em> - <a href='" . _xsrfLink(_indexroot . "remote/logout.php") . "'>" . $_lang['usermenu.logout'] . "</a>.</p>";
                }
                break;
                /* ---  zprava o neverejnosti obsahu (0-notpublicsite)  --- */
            /* ---  zprava o neverejnosti obsahu (0-notpublicsite)  --- */
            case "notpublic":
                $form = _uniForm("login", array(), true);
                if (!isset($vars[0])) {
                    $vars[0] = false;
                }
                $content = "<p>" . $_lang['notpublic.p' . ($vars[0] == true ? '2' : '')] . "</p>" . $form[0];
                $title = $_lang['notpublic.title'];
                break;
                /* ---  formular pro zaslani prispevku / komentare (posttype,posttarget,xhome,url)  --- */
            /* ---  formular pro zaslani prispevku / komentare (posttype,posttarget,xhome,url)  --- */
            case "postform":
                $title = "";
                $notitle = true;
                // pole
                $inputs = array();
                $captcha = _captchaInit();
                $content = _jsLimitLength(16384, "postform", "text");
                if (_loginindicator == 0) {
                    $inputs[] = array($_lang['posts.guestname'], "<input type='text' name='guest' maxlength='24' class='inputsmall'" . _restoreGetFdValue("guest") . " />");
                }
                if ($vars['xhome'] == -1) {
                    $inputs[] = array($_lang[$vars['posttype'] != 5 ? 'posts.subject' : 'posts.topic'], "<input type='text' name='subject' class='input" . ($vars['posttype'] != 5 ? 'small' : 'medium') . "' maxlength='" . ($vars['posttype'] != 5 ? 22 : 48) . "'" . _restoreGetFdValue("subject") . " />");
                }
                $inputs[] = $captcha;
                $inputs[] = array($_lang['posts.text'], "<textarea name='text' class='areamedium' rows='5' cols='33'>" . _restoreGetFdValue("text", null, true) . "</textarea><input type='hidden' name='_posttype' value='" . $vars['posttype'] . "' /><input type='hidden' name='_posttarget' value='" . $vars['posttarget'] . "' /><input type='hidden' name='_xhome' value='" . $vars['xhome'] . "' />" . (isset($vars['pluginflag']) ? "<input type='hidden' name='_pluginflag' value='" . $vars['pluginflag'] . "' />" : ''), true);
                // formular
                $callArgs = array('postform', _addGetToLink(_indexroot . "remote/post.php", "_return=" . urlencode($vars['url']), false), $inputs, array("text"), null, _getPostformControls("postform", "text"));
                if ($extend) {
                    _extend('call', 'sys.form.postform', array('call' => &$callArgs, 'vars' => $vars));
                }
                $content .= call_user_func_array('_formOutput', $callArgs);
                break;
        }
    }
    // return
    if ((_template_autoheadings == 1 or _administration == 1) and $notitle == false) {
        $content = "<h1>{$title}</h1>\n" . $content;
    }
    return array($content, $title);
}