本文整理汇总了PHP中Notification::setNow方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::setNow方法的具体用法?PHP Notification::setNow怎么用?PHP Notification::setNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::setNow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __
// Update options
Option::update(array('maintenance_status' => 'off', 'sitename' => Request::post('sitename'), 'siteurl' => Request::post('siteurl'), 'description' => __('Site description', 'system'), 'keywords' => __('Site keywords', 'system'), 'slogan' => __('Site slogan', 'system'), 'defaultpage' => 'home', 'timezone' => Request::post('timezone'), 'system_email' => Request::post('email'), 'theme_site_name' => 'default', 'theme_admin_name' => 'default'));
// Get users table
$users = new Table('users');
// Insert new user with role = admin
$users->insert(array('login' => Security::safeName(Request::post('login')), 'password' => Security::encryptPassword(Request::post('password')), 'email' => Request::post('email'), 'hash' => Text::random('alnum', 12), 'date_registered' => time(), 'role' => 'admin'));
// Write .htaccess
$htaccess = file_get_contents('.htaccess');
$save_htaccess_content = str_replace("/%siteurlhere%/", $rewrite_base, $htaccess);
$handle = fopen('.htaccess', "w");
fwrite($handle, $save_htaccess_content);
fclose($handle);
// Installation done :)
header("location: index.php?install=done");
} else {
Notification::setNow('errors', $errors);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Monstra :: Install</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Monstra Install Area">
<link rel="icon" href="<?php
echo $site_url;
?>
/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<?php
示例2: getLogin
/**
* Get User login
*/
public static function getLogin()
{
// Is User Loged in ?
if (!Session::get('user_id')) {
// Login Form Submit
if (Request::post('login_submit')) {
if (Cookie::get('login_attempts') && Cookie::get('login_attempts') >= 5) {
Notification::setNow('error', __('You are banned for 10 minutes. Try again later', 'users'));
} else {
// Check csrf
if (Security::check(Request::post('csrf'))) {
$user = Users::$users->select("[login='" . trim(Request::post('username')) . "']", null);
if (count($user) !== 0) {
if ($user['login'] == Request::post('username')) {
if (trim($user['password']) == Security::encryptPassword(Request::post('password'))) {
if ($user['role'] == 'admin' || $user['role'] == 'editor') {
Session::set('admin', true);
}
Session::set('user_id', (int) $user['id']);
Session::set('user_login', (string) $user['login']);
Session::set('user_role', (string) $user['role']);
Session::set('user_email', (string) $user['email']);
Request::redirect(Site::url() . '/users/' . Session::get('user_id'));
} else {
Notification::setNow('error', __('Wrong <b>username</b> or <b>password</b>', 'users'));
if (Cookie::get('login_attempts')) {
if (Cookie::get('login_attempts') < 5) {
$attempts = Cookie::get('login_attempts') + 1;
Cookie::set('login_attempts', $attempts, 600);
} else {
Notification::setNow('error', __('You are banned for 10 minutes. Try again later', 'users'));
}
} else {
Cookie::set('login_attempts', 1, 600);
}
}
}
} else {
Notification::setNow('error', __('Wrong <b>username</b> or <b>password</b>', 'users'));
if (Cookie::get('login_attempts')) {
if (Cookie::get('login_attempts') < 5) {
$attempts = Cookie::get('login_attempts') + 1;
Cookie::set('login_attempts', $attempts, 600);
} else {
Notification::setNow('error', __('You are banned for 10 minutes. Try again later', 'users'));
}
} else {
Cookie::set('login_attempts', 1, 600);
}
}
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
}
View::factory('box/users/views/frontend/login')->display();
} else {
Request::redirect(Site::url() . '/users/' . Session::get('user_id'));
}
}
示例3: PHPMailer
$mail = new PHPMailer();
$mail->CharSet = 'utf-8';
$mail->ContentType = 'text/html';
$mail->SetFrom(Option::get('system_email'));
$mail->AddReplyTo(Option::get('system_email'));
$mail->AddAddress($user['email'], $user['login']);
$mail->Subject = __('Your login details for :site_name', 'users', array(':site_name' => $site_name));
$mail->MsgHTML(View::factory('box/emails/views/emails/email_layout')->assign('site_url', $site_url)->assign('site_name', $site_name)->assign('user_id', $user['id'])->assign('user_login', $user['login'])->assign('new_hash', $new_hash)->assign('email_template', 'reset-password')->render());
$mail->Send();
// Set notification
Notification::set('success', __('Your login details for :site_name has been sent', 'users', array(':site_name' => $site_name)));
Notification::set('reset_password', 'reset_password');
// Redirect to password-reset page
Request::redirect(Site::url() . '/admin');
}
Notification::setNow('reset_password', 'reset_password');
}
// If admin user is login = true then set is_admin = true
if (Session::exists('admin') && Session::get('admin') == true) {
$is_admin = true;
} else {
$is_admin = false;
}
// Logout user from system
if (Request::get('logout') && Request::get('logout') == 'do') {
Session::destroy();
}
// If is admin then load admin area
if ($is_admin) {
// If id is empty then redirect to default plugin PAGES
if (Request::get('id')) {
示例4: main
//.........这里部分代码省略.........
if (Request::post('status')) {
$post_status = Request::post('status');
} else {
$post_status = 'published';
}
if (Request::post('access')) {
$post_access = Request::post('access');
} else {
$post_access = 'public';
}
if (Request::post('pages')) {
$parent_page = Request::post('pages');
} else {
if (Request::get('parent_page')) {
$parent_page = Request::get('parent_page');
} else {
$parent_page = '';
}
}
if (Request::post('robots_index')) {
$post_robots_index = true;
} else {
$post_robots_index = false;
}
if (Request::post('robots_follow')) {
$post_robots_follow = true;
} else {
$post_robots_follow = false;
}
//--------------
// Generate date
$date = Date::format(time(), 'Y-m-d H:i:s');
// Set Tabs State - page
Notification::setNow('page', 'page');
// Display view
View::factory('box/pages/views/backend/add')->assign('post_name', $post_name)->assign('post_title', $post_title)->assign('post_meta_title', $post_meta_title)->assign('post_description', $post_description)->assign('post_keywords', $post_keywords)->assign('post_tags', $post_tags)->assign('post_content', $post_content)->assign('pages_array', $pages_array)->assign('parent_page', $parent_page)->assign('templates_array', $templates_array)->assign('post_template', $post_template)->assign('post_status', $post_status)->assign('post_access', $post_access)->assign('status_array', $status_array)->assign('access_array', $access_array)->assign('date', $date)->assign('post_robots_index', $post_robots_index)->assign('post_robots_follow', $post_robots_follow)->assign('errors', $errors)->display();
break;
// Edit page
// -------------------------------------
// Edit page
// -------------------------------------
case "edit_page":
if (Request::post('edit_page') || Request::post('edit_page_and_exit')) {
if (Security::check(Request::post('csrf'))) {
// Get pages parent
if (Request::post('pages') == '0') {
$parent_page = '';
} else {
$parent_page = Request::post('pages');
}
// Save field
$post_parent = Request::post('pages');
// Validate
//--------------
if (trim(Request::post('page_name')) == '') {
$errors['pages_empty_name'] = __('Required field', 'pages');
}
if (count($pages->select('[slug="' . Security::safeName(Request::post('page_name'), '-', true) . '"]')) != 0 and Security::safeName(Request::post('page_old_name'), '-', true) !== Security::safeName(Request::post('page_name'), '-', true)) {
$errors['pages_exists'] = __('This page already exists', 'pages');
}
if (trim(Request::post('page_title')) == '') {
$errors['pages_empty_title'] = __('Required field', 'pages');
}
// Save fields
if (Request::post('page_name')) {
$post_name = Request::post('page_name');