Ejemplo n.º 1
0
 public function showEmail($templateid, $contactid)
 {
     $contact = Contact::find($contactid);
     $template = EmailTemplate::find($templateid);
     $urlEmail = $template->html_body;
     $emailtemplate = Emailtemplate::findOrFail($id);
     return View::make('emails.templates.default', compact('emailtemplate'));
     return View::make('users.showemail')->with('contact', $contact)->with('urlEmail', $urlEmail);
 }
Ejemplo n.º 2
0
 /**
  * Remove the specified emailtemplate from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Emailtemplate::destroy($id);
     return Redirect::route('admin.templates.index')->with('message', 'Data berhasil dihapus');
 }
Ejemplo n.º 3
0
if (isset($_POST['register-captcha'])) {
    $inputValue[4] = "";
    /* we need to always clear the captcha field, because it will regenerate after a reresh*/
    if ($Error->captcha($_POST['register-captcha'])) {
        $errorClass[4] = 'success';
    } else {
        $errorClass[4] = 'error';
    }
} else {
    if (isset($_POST['action'])) {
        $Error->add('error', 'Captcha cannot be left empty');
        $errorClass[4] = 'error';
    }
}
// Instantiontiate the erroring before we need to refresh the page
$msg = $Error->alert();
// Check if the form was submitted without any errors.
if (isset($_POST['register-username']) && isset($_POST['register-password']) && isset($_POST['register-confirm']) && isset($_POST['register-email']) && isset($_POST['register-captcha']) && !$Error->ok()) {
    $complete = true;
    // Create the actual user
    Auth::createNewUser($_POST['register-username'], $_POST['register-password'], $_POST['register-email']);
    $userId = Auth::userId($_POST['register-username']);
    $link = full_url_to_script('activate.php') . "?action=activate&code=" . Activation::get($userId) . "&id=" . $userId;
    //echo $link;
    Emailtemplate::setBaseDir('./assets/email_templates');
    $html = Emailtemplate::loadTemplate('activation', array('title' => 'Activation Email', 'prettyName' => Options::get('prettyName'), 'name' => $_POST['register-username'], 'siteName' => Options::get('emailName'), 'activationLink' => $link, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
    send_html_mail(array($_POST['register-username'] => $_POST['register-email']), 'Activation Email', $html, array(Options::get('siteName') => Options::get('emailAdmin')));
}
Template::setBaseDir('./assets/tmpl');
$html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'meta' => $meta, 'selected' => 'register')), 'content' => Template::loadTemplate('register', array('errorClass' => $errorClass, 'inputValue' => $inputValue, 'complete' => $complete, 'callback' => $callback)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start))));
echo $html;
Ejemplo n.º 4
0
            if (htmlspecialchars(Options::userGet($userId, $dateOption)) !== htmlspecialchars($timestamp)) {
                // Set the option to the new value
                Options::userSet($userId, $dateOption, $timestamp);
                $changes = true;
            }
        }
    }
    if (isset($_POST['action']) && $_POST['action'] == 'Save Changes') {
        // These are the 2 static things in your account a password and a email address
        if (isset($_POST['user-email']) && $Error->email($_POST['user-email'], false) && $_POST['user-email'] !== $u->email) {
            $u->email = $_POST['user-email'];
            $u->update();
            Activation::remove($userId);
            $link = full_url_to_script('activate.php') . "?action=activate&code=" . Activation::generate($userId) . "&id=" . $userId;
            Emailtemplate::setBaseDir('./assets/email_templates');
            $html = Emailtemplate::loadTemplate('reactivate', array('title' => 'Reactivation Email', 'prettyName' => Options::get('prettyName'), 'name' => $u->username, 'siteName' => Options::get('emailName'), 'activationLink' => $link, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
            send_html_mail(array($u->username => $u->email), 'Reactivation Email', $html, array(Options::get('siteName') => Options::get('emailAdmin')));
            $Error->add('info', '<strong>Logged Out</strong><br />We have sent you a reactivation email to the new email address in order to verify it. Please check your email and follow the link within.');
            $Auth->logout();
        }
        // These are the 2 static things in your account a password and a email address
        if (isset($_POST['user-password']) && $_POST['user-password'] !== $inputValue[1] && $_POST['user-password'] !== '') {
            Auth::changePassword($u->id, $_POST['user-password']);
            $Error->add('info', '<strong>Logged Out</strong><br />Password updated, you may login with your new password');
            $Auth->logout();
        }
    }
}
Template::setBaseDir('./assets/tmpl');
$html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg)), 'content' => Template::loadTemplate('settings', array('inputValue' => $inputValue, 'userId' => $userId, 'changes' => $changes)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start))));
echo $html;
Ejemplo n.º 5
0
 public static function setDefaultTemplateExtension($ext)
 {
     self::$defaultTemplateExtension = $ext;
 }
Ejemplo n.º 6
0
// Instantiontiate the erroring before we need to refresh the page
$msg = $Error->alert();
// Check if the form was submitted without any errors.
if (isset($detail) && Auth::resetPasswordCheck($detail) !== false) {
    $userId = Auth::resetPasswordCheck($detail);
    $activationCode = Activation::get($userId);
    $complete = true;
    $u = new User($userId);
    $link = full_url_to_script('forgot.php') . "?action=resetpassword&code=" . Activation::get($userId) . "&uid=" . $userId;
    // Select the Email tempalte and replace the relevant values
    Emailtemplate::setBaseDir('./assets/email_templates');
    $html = Emailtemplate::loadTemplate('forgot', array('title' => 'Reset Password Email', 'prettyName' => Options::get('prettyName'), 'name' => $u->username, 'siteName' => Options::get('emailName'), 'link' => $link, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
    // Replace the relevant values and send the HTML email
    send_html_mail(array($u->username => $u->email), 'Reset Password Email', $html, array(Options::get('siteName') => Options::get('emailAdmin')));
}
// Otherwise if the email link is followed lets reset the password and email it to the user.
if (isset($_GET['action']) && $_GET['action'] == 'resetpassword' && isset($_GET['uid']) && isset($_GET['code']) and Activation::get($_GET['uid']) == $_GET['code']) {
    $u = new User($_GET['uid']);
    $userId = $u->id;
    $newPassword = Auth::generateStrongPassword(6, false, 'ld');
    Auth::changePassword($userId, $newPassword);
    $reset = true;
    // Select the Email tempalte and replace the relevant values
    Emailtemplate::setBaseDir('./assets/email_templates');
    $html = Emailtemplate::loadTemplate('reset', array('title' => 'Password Successfully Reset', 'prettyName' => Options::get('prettyName'), 'name' => $u->username, 'siteName' => Options::get('emailName'), 'password' => $newPassword, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
    // Replace the relevant values and send the HTML email
    send_html_mail(array($u->username => $u->email), 'New Password', $html, array(Options::get('siteName') => Options::get('emailAdmin')));
}
Template::setBaseDir('./assets/tmpl');
$html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'meta' => $meta, 'selected' => 'forgot')), 'content' => Template::loadTemplate('forgot', array('inputValue' => $inputValue, 'complete' => $complete, 'reset' => $reset, 'password' => $newPassword)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start))));
echo $html;