Ejemplo n.º 1
0
function _HCM_mailform($adresa = "", $priloha = false, $predmet = null)
{
    // priprava
    $result = "";
    $_SESSION[_sessionprefix . 'hcm_' . SL::$hcmUid . '_mail_receiver'] = @implode(",", _arrayRemoveValue(@explode(";", trim($adresa)), ""));
    if (_boolean($priloha)) {
        $rfile = array($GLOBALS['_lang']['hcm.mailform.att'], "<input type='file' name='att' />");
        $att = true;
    } else {
        $rfile = array('');
        $att = false;
    }
    if (isset($predmet)) {
        $rsubject = " value='" . _htmlStr($predmet) . "'";
    } else {
        $rsubject = "";
    }
    $rcaptcha = _captchaInit();
    // zprava
    $msg = '';
    if (isset($_GET['hcm_mr_' . SL::$hcmUid])) {
        switch ($_GET['hcm_mr_' . SL::$hcmUid]) {
            case 1:
                $msg = _formMessage(1, $GLOBALS['_lang']['hcm.mailform.msg.done']);
                break;
            case 2:
                $msg = _formMessage(2, $GLOBALS['_lang']['hcm.mailform.msg.failure']);
                break;
            case 3:
                $msg = _formMessage(3, $GLOBALS['_lang']['hcm.mailform.msg.failure2']);
                break;
            case 4:
                $msg = _formMessage(3, $GLOBALS['_lang']['xsrf.msg']);
                break;
        }
    }
    // predvyplneni odesilatele
    if (_loginindicator) {
        $sender = _loginemail;
    } else {
        $sender = "&#64;";
    }
    $result .= "<div class='anchor'><a name='hcm_mform_" . SL::$hcmUid . "'></a></div>\n" . $msg . _formOutput("mform" . SL::$hcmUid, _indexroot . "remote/hcm/mform.php?_return=" . urlencode(_indexOutput_url) . ($att ? "' enctype='multipart/form-data" : ''), array(array($GLOBALS['_lang']['hcm.mailform.sender'], "<input type='text' class='inputsmall' name='sender' value='" . $sender . "' /><input type='hidden' name='fid' value='" . SL::$hcmUid . "' />"), array($GLOBALS['_lang']['posts.subject'], "<input type='text' class='inputsmall' name='subject'" . $rsubject . " />"), $rcaptcha, array($GLOBALS['_lang']['hcm.mailform.text'], "<textarea class='areasmall' name='text' rows='9' cols='33'></textarea>", true), $rfile), array("text", "sender"), $GLOBALS['_lang']['hcm.mailform.send']);
    return $result;
}
Ejemplo n.º 2
0
                    $userdata = DB::query("SELECT email,password,salt,username FROM `" . _mysql_prefix . "-users` WHERE username='******' AND email='" . $email . "'");
                    if (DB::size($userdata) != 0) {
                        // odeslani emailu
                        $userdata = DB::row($userdata);
                        $link = _url . "/index.php?m=lostpass&link&user="******"&hash=" . md5($userdata['email'] . $userdata['salt'] . $userdata['password']);
                        $text_tags = array("*domain*", "*username*", "*link*", "*date*", "*ip*");
                        $text_contents = array(_getDomain(), $userdata['username'], $link, _formatTime(time()), _userip);
                        if (_mail($userdata['email'], str_replace('*domain*', _getDomain(), $_lang['mod.lostpass.mail.subject']), str_replace($text_tags, $text_contents, $_lang['mod.lostpass.mail.text']), "Content-Type: text/plain; charset=UTF-8\n" . _sysMailHeader())) {
                            $module .= _formMessage(1, $_lang['mod.lostpass.cmailsent']);
                            _iplogUpdate(7);
                            $sent = true;
                        } else {
                            $module .= _formMessage(3, $_lang['hcm.mailform.msg.failure2']);
                        }
                    } else {
                        $module .= _formMessage(2, $_lang['mod.lostpass.notfound']);
                    }
                } else {
                    $module .= _formMessage(2, $_lang['captcha.failure2']);
                }
            } else {
                $module .= _formMessage(3, str_replace('*limit*', _lostpassexpire / 60, $_lang['mod.lostpass.limit']));
            }
        }
        // formular
        if (!$sent) {
            $captcha = _captchaInit();
            $module .= _formOutput("lostpassform", "index.php?m=lostpass", array(array($_lang['login.username'], "<input type='text' name='username' class='inputsmall' maxlength='24'" . _restorePostValue('username') . " />"), array($_lang['global.email'], "<input type='text' name='email' class='inputsmall' " . _restorePostValue('email', '@') . " />"), $captcha), array("username", "email"), $_lang['global.send']);
        }
        break;
}
Ejemplo n.º 3
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);
}