Esempio n. 1
0
if (_template_autoheadings == 1) {
    $module .= "<h1>" . $_lang['mod.editpost'] . "</h1><div class='hr'><hr /></div>";
}
// zpetny odkaz
$module .= "<p><a href='" . $backlink . "'>&lt; " . $_lang['global.return'] . "</a></p>";
// zprava
if (isset($_GET['saved']) and $message == "") {
    $message = _formMessage(1, $_lang['global.saved']);
}
$module .= $message;
// formular
if ($continue) {
    // pole
    $inputs = array();
    $module .= _jsLimitLength($query['type'] != 4 ? 16384 : 255, "postform", "text");
    if ($query['guest'] != "") {
        $inputs[] = array($_lang['posts.guestname'], "<input type='text' name='guest' class='inputsmall' value='" . $query['guest'] . "' />");
    }
    if ($query['xhome'] == -1 and $query['type'] != 4) {
        $inputs[] = array($_lang[$query['type'] != 5 ? 'posts.subject' : 'posts.topic'], "<input type='text' name='subject' class='input" . ($query['type'] == 5 ? 'medium' : 'small') . "' maxlength='" . ($query['type'] == 5 ? 48 : 22) . "' value='" . $query['subject'] . "' />");
    }
    $inputs[] = array($_lang['posts.text'], "<textarea name='text' class='areamedium' rows='5' cols='33'>" . $query['text'] . "</textarea>", true);
    // formoutput
    $module .= _formOutput('postform', 'index.php?m=editpost&amp;id=' . $id, $inputs, null, $_lang['global.save'], _getPostformControls("postform", "text", $nobbcode) . ($query['type'] != 6 || $query['xhome'] != -1 ? "<br /><br /><label><input type='checkbox' name='delete' value='1' /> " . $_lang['mod.editpost.delete'] . "</label>" : ''));
} else {
    /*neplatny vstup*/
    if (!$scriptbreak) {
        $module .= _formMessage(3, $_lang['global.badinput']);
        $found = false;
    }
}
Esempio n. 2
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);
}