* @copyright Copyright (c) 2009-2011 Moc 10 Media, LLC. (http://www.moc10media.com) * @license https://phirecms.org/LICENSE.TXT New BSD License * @version 1.1 */ require_once 'bootstrap.php'; // Check if the path constants is defined or not. if (!defined('BASE_PATH') || !defined('SYS_PATH') || !defined('CONTENT_PATH')) { print("You must set up the 'config.php' file correctly. Please refer to the INSTALL.TXT for help."); // Else, check the BASE_PATH. } else if (defined('BASE_PATH') && !file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH)) { print("The BASE_PATH you defined does not exist. Please check the settings in the 'config.php' file and refer to the INSTALL.TXT for help."); // Else, check the SYS_PATH. } else if (defined('SYS_PATH') && !file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . SYS_PATH)) { print("The SYS_PATH you defined does not exist. Please check the settings in the 'config.php' file and refer to the INSTALL.TXT for help."); // Else, check the CONTENT_PATH. } else if (defined('CONTENT_PATH') && !file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH)) { print("The CONTENT_PATH you defined does not exist. Please check the settings in the 'config.php' file and refer to the INSTALL.TXT for help."); // Else, if the system is not properly configured or installed. } else { require_once 'core/process/system.check.php'; include_once 'core/process/init.php'; // If the system is not properly configured or installed. if ($sys_check == false) { include_once 'core/includes/failed.php'; // Else, process the forgot page. } else { try { include_once 'core/includes/header.php'; // Declare the forgot form. $form = new Phire_Form_Forgot($_SERVER['PHP_SELF'], 'post', ' '); // If the forgot form has been submitted, validate the form. if ($_POST) { $form->init($_POST); if ($form->isValid()) { // Determine if user password encoding is activated. If so, reset and encode the user password. if ($form->config->settings['user_password_encoding'] == 'On') { $pass = strtolower(Moc10_String::setString('')->random(8)); $form->user->password = sha1($pass); $form->user->save(); $message = "[{name}],\n\n" . $lang->__('Due to security measures enforced by the system admin, the password to your user account for the Phire CMS has been changed. Your new credentials for the Phire CMS are:') . "\n\n" . $lang->__('Username:') . " [{username}]\n" . $lang->__('Password:') . " [{password}]\n\n" . $lang->__("You can log in at the link below and change your password or manage your account by clicking on the 'My Account' link at the top right.") . "\n[{login_link}]\n\nThank You.\n" . $lang->__('The Phire CMS Team.') . "\n"; } else { $pass = $form->user->password; $message = "[{name}],\n\n" . $lang->__('Your credentials for the Phire CMS are:') . "\n\n" . $lang->__('Username:') . " [{username}]\n" . $lang->__('Password:') . " [{password}]\n\n" . $lang->__('You can then log in here:') . "\n[{login_link}]\n\n" . $lang->__('Thank You,') . "\n" . $lang->__('The Phire CMS Team.') . "\n"; } // Build and send the reminder email. $rcpt = array(array('name' => $form->user->fname . ' ' . $form->user->lname, 'email' => $form->user->email, 'username' => $form->user->username, 'password' => $pass, 'login_link' => 'http://' . $_SERVER['HTTP_HOST'] . BASE_PATH . SYS_PATH . '/')); $noreply = 'noreply@' . ((stripos($_SERVER['HTTP_HOST'], 'www.') !== false) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : $_SERVER['HTTP_HOST']); $mail = new Moc10_Mail($rcpt, null, $lang->__('Phire CMS Password Reminder')); $mail->setHeaders(array('From' => array($noreply, $noreply), 'Reply-To' => array($noreply, $noreply))); $mail->setText($message); $mail->init(); $mail->send(); print("
\n \n \n \n \n
\n
\n

" . $lang->__('Reminder Sent') . "

\n " . $lang->__('Once you receive the reminder email, you can log in %1here%2:', array("", "")) . "\n
\n
\n"); // Else, re-render the invalid forgot form with errors. } else { $form->render(); } // Else, render the new forgot form. } else { $form->init(); $form->render(); } include_once 'core/includes/footer.php'; } catch (Exception $e) { include_once 'core/includes/error.header.php'; print("

" . $lang->__('Password Reminder Error') . "

\n"); print("

" . $e->getMessage() . ". Please check your server and make sure the system has been installed and configured properly.

\n"); include_once 'core/includes/footer.php'; } } } ?>