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
e8d59fb6
Commit
e8d59fb6
authored
May 24, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specified proper namespaces
parent
4a9f0eed
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
9 additions
and
130 deletions
+9
-130
main.php
apps/advanced/backstage/config/main.php
+1
-1
SiteController.php
apps/advanced/backstage/controllers/SiteController.php
+1
-1
ContactForm.php
apps/advanced/common/models/ContactForm.php
+0
-63
LoginForm.php
apps/advanced/common/models/LoginForm.php
+0
-58
User.php
apps/advanced/common/models/User.php
+1
-1
main.php
apps/advanced/console/config/main.php
+1
-1
main.php
apps/advanced/frontend/config/main.php
+1
-1
SiteController.php
apps/advanced/frontend/controllers/SiteController.php
+1
-1
ContactForm.php
apps/advanced/frontend/models/ContactForm.php
+1
-1
LoginForm.php
apps/advanced/frontend/models/LoginForm.php
+1
-1
User.php
apps/advanced/frontend/models/User.php
+1
-1
No files found.
apps/advanced/backstage/config/main.php
View file @
e8d59fb6
...
...
@@ -12,7 +12,7 @@ return array(
'id'
=>
'change-me'
,
'basePath'
=>
dirname
(
__DIR__
),
'preload'
=>
array
(
'log'
),
'controllerNamespace'
=>
'
app
\controllers'
,
'controllerNamespace'
=>
'
backstage
\controllers'
,
'modules'
=>
array
(
),
'components'
=>
array
(
...
...
apps/advanced/backstage/controllers/SiteController.php
View file @
e8d59fb6
<?php
namespace
app
\controllers
;
namespace
backstage
\controllers
;
use
Yii
;
use
yii\web\Controller
;
...
...
apps/advanced/common/models/ContactForm.php
deleted
100644 → 0
View file @
4a9f0eed
<?php
namespace
app\models
;
use
yii\base\Model
;
/**
* ContactForm is the model behind the contact form.
*/
class
ContactForm
extends
Model
{
public
$name
;
public
$email
;
public
$subject
;
public
$body
;
public
$verifyCode
;
/**
* @return array the validation rules.
*/
public
function
rules
()
{
return
array
(
// name, email, subject and body are required
array
(
'name, email, subject, body'
,
'required'
),
// email has to be a valid email address
array
(
'email'
,
'email'
),
// verifyCode needs to be entered correctly
array
(
'verifyCode'
,
'captcha'
),
);
}
/**
* @return array customized attribute labels
*/
public
function
attributeLabels
()
{
return
array
(
'verifyCode'
=>
'Verification Code'
,
);
}
/**
* Sends an email to the specified email address using the information collected by this model.
* @param string $email the target email address
* @return boolean whether the model passes validation
*/
public
function
contact
(
$email
)
{
if
(
$this
->
validate
())
{
$name
=
'=?UTF-8?B?'
.
base64_encode
(
$this
->
name
)
.
'?='
;
$subject
=
'=?UTF-8?B?'
.
base64_encode
(
$this
->
subject
)
.
'?='
;
$headers
=
"From:
$name
<
{
$this
->
email
}
>
\r\n
"
.
"Reply-To:
{
$this
->
email
}
\r\n
"
.
"MIME-Version: 1.0
\r\n
"
.
"Content-type: text/plain; charset=UTF-8"
;
mail
(
$email
,
$subject
,
$this
->
body
,
$headers
);
return
true
;
}
else
{
return
false
;
}
}
}
apps/advanced/common/models/LoginForm.php
deleted
100644 → 0
View file @
4a9f0eed
<?php
namespace
app\models
;
use
Yii
;
use
yii\base\Model
;
/**
* LoginForm is the model behind the login form.
*/
class
LoginForm
extends
Model
{
public
$username
;
public
$password
;
public
$rememberMe
=
true
;
/**
* @return array the validation rules.
*/
public
function
rules
()
{
return
array
(
// username and password are both required
array
(
'username, password'
,
'required'
),
// password is validated by validatePassword()
array
(
'password'
,
'validatePassword'
),
// rememberMe must be a boolean value
array
(
'rememberMe'
,
'boolean'
),
);
}
/**
* Validates the password.
* This method serves as the inline validation for password.
*/
public
function
validatePassword
()
{
$user
=
User
::
findByUsername
(
$this
->
username
);
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
$this
->
addError
(
'password'
,
'Incorrect username or password.'
);
}
}
/**
* Logs in a user using the provided username and password.
* @return boolean whether the user is logged in successfully
*/
public
function
login
()
{
if
(
$this
->
validate
())
{
$user
=
User
::
findByUsername
(
$this
->
username
);
Yii
::
$app
->
user
->
login
(
$user
,
$this
->
rememberMe
?
3600
*
24
*
30
:
0
);
return
true
;
}
else
{
return
false
;
}
}
}
apps/advanced/common/models/User.php
View file @
e8d59fb6
<?php
namespace
app
\models
;
namespace
common
\models
;
class
User
extends
\yii\base\Object
implements
\yii\web\Identity
{
...
...
apps/advanced/console/config/main.php
View file @
e8d59fb6
...
...
@@ -12,7 +12,7 @@ return array(
'id'
=>
'change-me'
,
'basePath'
=>
dirname
(
__DIR__
),
'preload'
=>
array
(
'log'
),
'controllerNamespace'
=>
'
app
\controllers'
,
'controllerNamespace'
=>
'
console
\controllers'
,
'modules'
=>
array
(
),
'components'
=>
array
(
...
...
apps/advanced/frontend/config/main.php
View file @
e8d59fb6
...
...
@@ -12,7 +12,7 @@ return array(
'id'
=>
'change-me'
,
'basePath'
=>
dirname
(
__DIR__
),
'preload'
=>
array
(
'log'
),
'controllerNamespace'
=>
'
app
\controllers'
,
'controllerNamespace'
=>
'
frontend
\controllers'
,
'modules'
=>
array
(
),
'components'
=>
array
(
...
...
apps/advanced/frontend/controllers/SiteController.php
View file @
e8d59fb6
<?php
namespace
app
\controllers
;
namespace
frontend
\controllers
;
use
Yii
;
use
yii\web\Controller
;
...
...
apps/advanced/frontend/models/ContactForm.php
View file @
e8d59fb6
<?php
namespace
app
\models
;
namespace
frontend
\models
;
use
yii\base\Model
;
...
...
apps/advanced/frontend/models/LoginForm.php
View file @
e8d59fb6
<?php
namespace
app
\models
;
namespace
frontend
\models
;
use
Yii
;
use
yii\base\Model
;
...
...
apps/advanced/frontend/models/User.php
View file @
e8d59fb6
<?php
namespace
app
\models
;
namespace
frontend
\models
;
class
User
extends
\yii\base\Object
implements
\yii\web\Identity
{
...
...
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