Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
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
outils
question2answer
Commits
0e0a88d1
Commit
0e0a88d1
authored
Aug 07, 2015
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (qa-filter-basic)
parent
c0c2384c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
qa-filter-basic.php
qa-include/plugins/qa-filter-basic.php
+18
-16
No files found.
qa-include/plugins/qa-filter-basic.php
View file @
0e0a88d1
...
...
@@ -27,27 +27,29 @@ class qa_filter_basic
{
public
function
filter_email
(
&
$email
,
$olduser
)
{
if
(
!
strlen
(
$email
))
if
(
!
strlen
(
$email
))
{
return
qa_lang
(
'users/email_required'
);
if
(
!
qa_email_validate
(
$email
))
}
if
(
!
qa_email_validate
(
$email
))
{
return
qa_lang
(
'users/email_invalid'
);
if
(
qa_strlen
(
$email
)
>
QA_DB_MAX_EMAIL_LENGTH
)
}
if
(
qa_strlen
(
$email
)
>
QA_DB_MAX_EMAIL_LENGTH
)
{
return
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_EMAIL_LENGTH
);
}
}
public
function
filter_handle
(
&
$handle
,
$olduser
)
{
if
(
!
strlen
(
$handle
))
if
(
!
strlen
(
$handle
))
{
return
qa_lang
(
'users/handle_empty'
);
if
(
preg_match
(
'/[\\@\\+\\/]/'
,
$handle
))
}
if
(
preg_match
(
'/[\\@\\+\\/]/'
,
$handle
))
{
return
qa_lang_sub
(
'users/handle_has_bad'
,
'@ + /'
);
if
(
qa_strlen
(
$handle
)
>
QA_DB_MAX_HANDLE_LENGTH
)
}
if
(
qa_strlen
(
$handle
)
>
QA_DB_MAX_HANDLE_LENGTH
)
{
return
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_HANDLE_LENGTH
);
}
}
public
function
filter_question
(
&
$question
,
&
$errors
,
$oldquestion
)
{
...
...
@@ -112,13 +114,12 @@ class qa_filter_basic
}
//
The definitions below are not part of a standard filter module, but just used within this one
//
The definitions below are not part of a standard filter module, but just used within this one
/**
* Add textual element $field to $errors if length of $input is not between $minlength and $maxlength.
*
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
* @deprecated This function is no longer used and will removed in the future.
*/
public
function
validate_length
(
&
$errors
,
$field
,
$input
,
$minlength
,
$maxlength
)
{
...
...
@@ -167,9 +168,10 @@ class qa_filter_basic
public
function
validate_post_email
(
&
$errors
,
$post
)
{
if
(
@
$post
[
'notify'
]
&&
strlen
(
@
$post
[
'email'
]))
{
$error
=
$this
->
filter_email
(
$post
[
'email'
],
null
);
if
(
isset
(
$error
))
$errors
[
'email'
]
=
$error
;
$error
=
$this
->
filter_email
(
$post
[
'email'
],
null
);
if
(
isset
(
$error
))
{
$errors
[
'email'
]
=
$error
;
}
}
}
}
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