function user_forgot_password($username, $email) { global $system, $lang; $username = basename($username); if (!($data = load_user_info($username))) { return 16; } if ($email != $data['email']) { return 11; } $new_password = gen_rand_string(8); $site_url = parse_url($system->config['site_url']); if (rcms_send_mail($data['email'], 'passreq@' . $site_url['host'], $lang['users']['pasreqsender'], $lang['options']['encoding'], $lang['users']['pasreqsubj'], $lang['users']['pasreqtext'] . $new_password)) { $data['password'] = md5($new_password); if (!file_write_contents(USERS_PATH . $username, serialize($data))) { return 10; } return 3; } return 11; }
function recoverPassword($username, $email) { if (!($data = $this->getUserData($username))) { $this->results['passrec'] = __('Cannot open profile'); return false; } if ($email != $data['email']) { $this->results['passrec'] = __('Your e-mail doesn\'t match e-mail in profile'); return false; } $new_password = rcms_random_string(8); $site_url = parse_url($this->url); $time = time(); if (!empty($data['last_prr']) && !empty($this->config['pr_flood']) && (int) $time <= (int) $data['last_prr'] + (int) $this->config['pr_flood']) { $this->results['passrec'] = __('Too many requests in limited period of time. Try later.'); $data['last_prr'] = time(); if (!$this->save_user($username, $data)) { $this->results['passrec'] .= '<br />' . __('Cannot save profile'); } rcms_log_put(__('Notification'), $this->user['username'], 'Attempted to recover password for ' . $username); return false; } if (rcms_send_mail($email, 'no_reply@' . $site_url['host'], __('Password'), $this->config['encoding'], __('Your new password at') . ' ' . $site_url['host'], __('Your username at') . ' ' . $site_url['host'] . ': ' . $username . "\r\n" . __('Your new password at') . ' ' . $site_url['host'] . ': ' . $new_password)) { $data['password'] = md5($new_password); $data['last_prr'] = $time; if (!$this->save_user($username, $data)) { $this->results['passrec'] = __('Cannot save profile'); return false; } $this->results['passrec'] = __('New password has been sent to your e-mail'); rcms_log_put(__('Notification'), $this->user['username'], 'Recovered password for ' . $username); return true; } else { rcms_log_put(__('Notification'), $this->user['username'], 'Recovered password for ' . $username . '" (BUT E-MAIL WAS NOT SENT)'); $this->results['passrec'] = __('Cannot send e-mail'); return false; } }
<?php if (!empty($_POST['new_letter'])) { if (isset($_POST['antispam']) and isset($_POST['captcheckout'])) { $defcatp = substr(md5($_POST['antispam']), 0, 5); $intcapt = $_POST['captcheckout']; if ($defcatp == $intcapt) { if (!empty($_POST['sender_name'])) { $sender = trim(htmlspecialchars($_POST['sender_name'])); if (rcms_is_valid_email(@$_POST['sender_email'])) { if (!empty($_POST['subject'])) { $subject = trim(htmlspecialchars($_POST['subject'])); if (!empty($_POST['letter'])) { $letter = trim(htmlspecialchars($_POST['letter'])); if (!empty($system->config['admin_email'])) { rcms_send_mail($system->config['admin_email'], $_POST['sender_email'], $sender, $system->config['encoding'], $subject, $letter); show_window('', __('Message sent'), 'center'); unset($_POST); } else { show_window(__('Error'), __('Admin e-mail is empty'), 'center'); } } else { show_window(__('Error'), __('Letter is empty'), 'center'); } } else { show_window(__('Error'), __('Subject of your letter'), 'center'); } } else { show_window(__('Error'), __('Error in email field'), 'center'); } } else {
} if (!empty($articles->config['email']) && rcms_is_valid_email($articles->config['email'])) { rcms_send_mail($articles->config['email'], $articles->config['email'], __('Comments'), $system->config['encoding'], __('Notification'), __('Comment') . ': http://' . $_SERVER['HTTP_HOST'] . '?module=articles&c=' . $_GET['c'] . '&b=' . $_GET['b'] . '&a=' . $_GET['a']); } rcms_redirect(RCMS_ROOT_PATH . '?module=articles&c=' . $_GET['c'] . '&b=' . $_GET['b'] . '&a=' . $_GET['a']); //f5 hack } else { show_window(__('Error'), __('Invalid form data')); } } else { if (!$articles->addComment($b, $a, $_POST['comtext'])) { show_error($articles->last_error); $com_text = $_POST['comtext']; } if (!empty($articles->config['email']) && rcms_is_valid_email($articles->config['email'])) { rcms_send_mail($articles->config['email'], $articles->config['email'], __('Comments'), $system->config['encoding'], __('Notification'), __('Comment') . ': http://' . $_SERVER['HTTP_HOST'] . '?module=articles&c=' . $_GET['c'] . '&b=' . $_GET['b'] . '&a=' . $_GET['a']); } rcms_redirect(RCMS_ROOT_PATH . '?module=articles&c=' . $_GET['c'] . '&b=' . $_GET['b'] . '&a=' . $_GET['a']); //f5 hack } } $_GET['page'] = 0; } /* If admin deleting comment */ if (isset($_POST['cdelete']) && $system->checkForRight('ARTICLES-MODERATOR')) { if (!$articles->deleteComment($b, $a, $_POST['cdelete'])) { show_error($articles->last_error); } } $article['text'] = trim($article['text']); /* Let's view selected article */
foreach ($users as $userdata) { $list[] = $userdata['email']; } } if (!empty($list) && !empty($_POST['subj']) && !empty($_POST['body'])) { $to = implode(';', $list); rcms_send_mail($to, $system->user['email'], $system->user['nickname'], $system->config['encoding'], $_POST['subj'], $_POST['body']); } } //Send emails by email if (!empty($_POST['email'])) { $_list = explode(',', $_POST['_to']); foreach ($_list as $email) { $email = trim($email); if (!empty($_POST['_subj']) && !empty($_POST['_body'])) { rcms_send_mail($email, $system->user['email'], post('_from', $system->user['nickname']), $system->config['encoding'], $_POST['_subj'], $_POST['_body']); } } } // Names $frm = new InputForm('', 'post', __('Send e-mail')); $frm->addbreak(__('Send e-mail')); $frm->hidden('name', '1'); $frm->addrow(__('Users') . '<br/>' . __('You can use * in names and divide names by comma.'), $frm->text_box('to', post('to', '*'), 60)); $frm->addrow(__('Subject'), $frm->text_box('subj', post('subj'), 60)); $frm->addrow(__('Body'), $frm->textarea('body', post('body'), 60, 10)); $frm->show(); //Skins by names $frm = new InputForm('', 'post', __('Submit')); $frm->addbreak(__('Emailing') . ': ' . __('Skins')); if (!empty($skins)) {
// http://reloadcms.sf.net // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY, without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// if (!empty($_POST['send'])) { $_list = explode(',', $_POST['to']); $list = array(); foreach ($_list as $user_mask) { $user_mask = trim($user_mask); $users = user_get_list($user_mask); foreach ($users as $userdata) { $list[] = $userdata['email']; } } if (!empty($list) && !empty($_POST['subj']) && !empty($_POST['body'])) { $to = implode(';', $list); rcms_send_mail($to, $system->user['email'], $system->user['nickname'], $system->config['encoding'], $_POST['subj'], $_POST['body']); } } // Interface generation $frm = new InputForm('', 'post', __('Send e-mail')); $frm->addbreak(__('Send e-mail')); $frm->hidden('send', '1'); $frm->addrow(__('Users') . '<br>' . __('You can use * in names and divide names by comma.'), $frm->text_box('to', '*', 60)); $frm->addrow(__('Subject'), $frm->text_box('subj', '', 60)); $frm->addrow(__('Body'), $frm->textarea('body', '', 60, 10)); $frm->show();