Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
dfb38954
Commit
dfb38954
authored
Oct 18, 2013
by
Yakir Sitbon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert to short syntax (array)
parent
153f6971
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
48 deletions
+48
-48
SiteController.php
apps/basic/controllers/SiteController.php
+30
-30
ContactForm.php
apps/basic/models/ContactForm.php
+7
-7
LoginForm.php
apps/basic/models/LoginForm.php
+5
-5
User.php
apps/basic/models/User.php
+6
-6
No files found.
apps/basic/controllers/SiteController.php
View file @
dfb38954
...
@@ -13,43 +13,43 @@ class SiteController extends Controller
...
@@ -13,43 +13,43 @@ class SiteController extends Controller
{
{
public
function
behaviors
()
public
function
behaviors
()
{
{
return
array
(
return
[
'access'
=>
array
(
'access'
=>
[
'class'
=>
AccessControl
::
className
(),
'class'
=>
AccessControl
::
className
(),
'only'
=>
array
(
'login'
,
'logout'
)
,
'only'
=>
[
'login'
,
'logout'
]
,
'rules'
=>
array
(
'rules'
=>
[
array
(
[
'actions'
=>
array
(
'login'
)
,
'actions'
=>
[
'login'
]
,
'allow'
=>
true
,
'allow'
=>
true
,
'roles'
=>
array
(
'?'
)
,
'roles'
=>
[
'?'
]
,
)
,
]
,
array
(
[
'actions'
=>
array
(
'logout'
)
,
'actions'
=>
[
'logout'
]
,
'allow'
=>
true
,
'allow'
=>
true
,
'roles'
=>
array
(
'@'
)
,
'roles'
=>
[
'@'
]
,
)
,
]
,
)
,
]
,
)
,
]
,
'verbs'
=>
array
(
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
array
(
'actions'
=>
[
'logout'
=>
array
(
'post'
)
,
'logout'
=>
[
'post'
]
,
)
,
]
,
)
,
]
,
)
;
]
;
}
}
public
function
actions
()
public
function
actions
()
{
{
return
array
(
return
[
'error'
=>
array
(
'error'
=>
[
'class'
=>
'yii\web\ErrorAction'
,
'class'
=>
'yii\web\ErrorAction'
,
)
,
]
,
'captcha'
=>
array
(
'captcha'
=>
[
'class'
=>
'yii\captcha\CaptchaAction'
,
'class'
=>
'yii\captcha\CaptchaAction'
,
'fixedVerifyCode'
=>
YII_ENV_TEST
?
'testme'
:
null
,
'fixedVerifyCode'
=>
YII_ENV_TEST
?
'testme'
:
null
,
)
,
]
,
)
;
]
;
}
}
public
function
actionIndex
()
public
function
actionIndex
()
...
@@ -63,9 +63,9 @@ class SiteController extends Controller
...
@@ -63,9 +63,9 @@ class SiteController extends Controller
if
(
$model
->
load
(
$_POST
)
&&
$model
->
login
())
{
if
(
$model
->
load
(
$_POST
)
&&
$model
->
login
())
{
return
$this
->
goBack
();
return
$this
->
goBack
();
}
else
{
}
else
{
return
$this
->
render
(
'login'
,
array
(
return
$this
->
render
(
'login'
,
[
'model'
=>
$model
,
'model'
=>
$model
,
)
);
]
);
}
}
}
}
...
@@ -82,9 +82,9 @@ class SiteController extends Controller
...
@@ -82,9 +82,9 @@ class SiteController extends Controller
Yii
::
$app
->
session
->
setFlash
(
'contactFormSubmitted'
);
Yii
::
$app
->
session
->
setFlash
(
'contactFormSubmitted'
);
return
$this
->
refresh
();
return
$this
->
refresh
();
}
else
{
}
else
{
return
$this
->
render
(
'contact'
,
array
(
return
$this
->
render
(
'contact'
,
[
'model'
=>
$model
,
'model'
=>
$model
,
)
);
]
);
}
}
}
}
...
...
apps/basic/models/ContactForm.php
View file @
dfb38954
...
@@ -20,14 +20,14 @@ class ContactForm extends Model
...
@@ -20,14 +20,14 @@ class ContactForm extends Model
*/
*/
public
function
rules
()
public
function
rules
()
{
{
return
array
(
return
[
// name, email, subject and body are required
// name, email, subject and body are required
array
(
'name, email, subject, body'
,
'required'
)
,
[
'name, email, subject, body'
,
'required'
]
,
// email has to be a valid email address
// email has to be a valid email address
array
(
'email'
,
'email'
)
,
[
'email'
,
'email'
]
,
// verifyCode needs to be entered correctly
// verifyCode needs to be entered correctly
array
(
'verifyCode'
,
'captcha'
)
,
[
'verifyCode'
,
'captcha'
]
,
)
;
]
;
}
}
/**
/**
...
@@ -35,9 +35,9 @@ class ContactForm extends Model
...
@@ -35,9 +35,9 @@ class ContactForm extends Model
*/
*/
public
function
attributeLabels
()
public
function
attributeLabels
()
{
{
return
array
(
return
[
'verifyCode'
=>
'Verification Code'
,
'verifyCode'
=>
'Verification Code'
,
)
;
]
;
}
}
/**
/**
...
...
apps/basic/models/LoginForm.php
View file @
dfb38954
...
@@ -19,14 +19,14 @@ class LoginForm extends Model
...
@@ -19,14 +19,14 @@ class LoginForm extends Model
*/
*/
public
function
rules
()
public
function
rules
()
{
{
return
array
(
return
[
// username and password are both required
// username and password are both required
array
(
'username, password'
,
'required'
)
,
[
'username, password'
,
'required'
]
,
// password is validated by validatePassword()
// password is validated by validatePassword()
array
(
'password'
,
'validatePassword'
)
,
[
'password'
,
'validatePassword'
]
,
// rememberMe must be a boolean value
// rememberMe must be a boolean value
array
(
'rememberMe'
,
'boolean'
)
,
[
'rememberMe'
,
'boolean'
]
,
)
;
]
;
}
}
/**
/**
...
...
apps/basic/models/User.php
View file @
dfb38954
...
@@ -9,20 +9,20 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
...
@@ -9,20 +9,20 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
public
$password
;
public
$password
;
public
$authKey
;
public
$authKey
;
private
static
$users
=
array
(
private
static
$users
=
[
'100'
=>
array
(
'100'
=>
[
'id'
=>
'100'
,
'id'
=>
'100'
,
'username'
=>
'admin'
,
'username'
=>
'admin'
,
'password'
=>
'admin'
,
'password'
=>
'admin'
,
'authKey'
=>
'test100key'
,
'authKey'
=>
'test100key'
,
)
,
]
,
'101'
=>
array
(
'101'
=>
[
'id'
=>
'101'
,
'id'
=>
'101'
,
'username'
=>
'demo'
,
'username'
=>
'demo'
,
'password'
=>
'demo'
,
'password'
=>
'demo'
,
'authKey'
=>
'test101key'
,
'authKey'
=>
'test101key'
,
)
,
]
,
)
;
]
;
public
static
function
findIdentity
(
$id
)
public
static
function
findIdentity
(
$id
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment