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
1455b5c5
Commit
1455b5c5
authored
Jan 17, 2019
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPCS fixes
parent
7f8e67c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
23 deletions
+28
-23
Stats.php
qa-src/Controllers/Admin/Stats.php
+7
-4
Ip.php
qa-src/Controllers/User/Ip.php
+19
-13
Router.php
qa-src/Http/Router.php
+2
-6
No files found.
qa-src/Controllers/Admin/Stats.php
View file @
1455b5c5
...
@@ -197,14 +197,16 @@ class Stats extends \Q2A\Controllers\BaseController
...
@@ -197,14 +197,16 @@ class Stats extends \Q2A\Controllers\BaseController
),
),
);
);
if
(
QA_FINAL_EXTERNAL_USERS
)
if
(
QA_FINAL_EXTERNAL_USERS
)
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'users'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'users'
]);
else
}
else
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'users_active'
]);
unset
(
$qa_content
[
'form'
][
'fields'
][
'users_active'
]);
}
foreach
(
$qa_content
[
'form'
][
'fields'
]
as
$index
=>
$field
)
{
foreach
(
$qa_content
[
'form'
][
'fields'
]
as
$index
=>
$field
)
{
if
(
empty
(
$field
[
'type'
]))
if
(
empty
(
$field
[
'type'
]))
{
$qa_content
[
'form'
][
'fields'
][
$index
][
'type'
]
=
'static'
;
$qa_content
[
'form'
][
'fields'
][
$index
][
'type'
]
=
'static'
;
}
}
}
$qa_content
[
'form_2'
]
=
array
(
$qa_content
[
'form_2'
]
=
array
(
...
@@ -257,8 +259,9 @@ class Stats extends \Q2A\Controllers\BaseController
...
@@ -257,8 +259,9 @@ class Stats extends \Q2A\Controllers\BaseController
),
),
);
);
if
(
!
qa_using_categories
())
if
(
!
qa_using_categories
())
{
unset
(
$qa_content
[
'form_2'
][
'buttons'
][
'recalc_categories'
]);
unset
(
$qa_content
[
'form_2'
][
'buttons'
][
'recalc_categories'
]);
}
if
(
defined
(
'QA_BLOBS_DIRECTORY'
))
{
if
(
defined
(
'QA_BLOBS_DIRECTORY'
))
{
if
(
qa_db_has_blobs_in_db
())
{
if
(
qa_db_has_blobs_in_db
())
{
...
...
qa-src/Controllers/User/Ip.php
View file @
1455b5c5
...
@@ -35,8 +35,9 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -35,8 +35,9 @@ class Ip extends \Q2A\Controllers\BaseController
public
function
address
(
$ip
)
public
function
address
(
$ip
)
{
{
if
(
filter_var
(
$ip
,
FILTER_VALIDATE_IP
)
===
false
)
if
(
filter_var
(
$ip
,
FILTER_VALIDATE_IP
)
===
false
)
{
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
}
// Find recently (hidden, queued or not) questions, answers, comments and edits for this IP
// Find recently (hidden, queued or not) questions, answers, comments and edits for this IP
...
@@ -70,10 +71,9 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -70,10 +71,9 @@ class Ip extends \Q2A\Controllers\BaseController
// Perform blocking or unblocking operations as appropriate
// Perform blocking or unblocking operations as appropriate
if
(
qa_clicked
(
'doblock'
)
||
qa_clicked
(
'dounblock'
)
||
qa_clicked
(
'dohideall'
))
{
if
(
qa_clicked
(
'doblock'
)
||
qa_clicked
(
'dounblock'
)
||
qa_clicked
(
'dohideall'
))
{
if
(
!
qa_check_form_security_code
(
'ip-'
.
$ip
,
qa_post_text
(
'code'
)))
if
(
!
qa_check_form_security_code
(
'ip-'
.
$ip
,
qa_post_text
(
'code'
)))
{
$pageerror
=
qa_lang_html
(
'misc/form_security_again'
);
$pageerror
=
qa_lang_html
(
'misc/form_security_again'
);
}
elseif
(
$blockable
)
{
elseif
(
$blockable
)
{
if
(
qa_clicked
(
'doblock'
))
{
if
(
qa_clicked
(
'doblock'
))
{
$oldblocked
=
qa_opt
(
'block_ips_write'
);
$oldblocked
=
qa_opt
(
'block_ips_write'
);
qa_set_option
(
'block_ips_write'
,
(
strlen
(
$oldblocked
)
?
(
$oldblocked
.
' , '
)
:
''
)
.
$ip
);
qa_set_option
(
'block_ips_write'
,
(
strlen
(
$oldblocked
)
?
(
$oldblocked
.
' , '
)
:
''
)
.
$ip
);
...
@@ -91,8 +91,9 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -91,8 +91,9 @@ class Ip extends \Q2A\Controllers\BaseController
$blockipclauses
=
qa_block_ips_explode
(
qa_opt
(
'block_ips_write'
));
$blockipclauses
=
qa_block_ips_explode
(
qa_opt
(
'block_ips_write'
));
foreach
(
$blockipclauses
as
$key
=>
$blockipclause
)
{
foreach
(
$blockipclauses
as
$key
=>
$blockipclause
)
{
if
(
qa_block_ip_match
(
$ip
,
$blockipclause
))
if
(
qa_block_ip_match
(
$ip
,
$blockipclause
))
{
unset
(
$blockipclauses
[
$key
]);
unset
(
$blockipclauses
[
$key
]);
}
}
}
qa_set_option
(
'block_ips_write'
,
implode
(
' , '
,
$blockipclauses
));
qa_set_option
(
'block_ips_write'
,
implode
(
' , '
,
$blockipclauses
));
...
@@ -112,8 +113,9 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -112,8 +113,9 @@ class Ip extends \Q2A\Controllers\BaseController
$postids
=
qa_db_get_ip_visible_postids
(
$ip
);
$postids
=
qa_db_get_ip_visible_postids
(
$ip
);
foreach
(
$postids
as
$postid
)
foreach
(
$postids
as
$postid
)
{
qa_post_set_status
(
$postid
,
QA_POST_STATUS_HIDDEN
,
$userid
);
qa_post_set_status
(
$postid
,
QA_POST_STATUS_HIDDEN
,
$userid
);
}
qa_redirect
(
qa_request
());
qa_redirect
(
qa_request
());
}
}
...
@@ -163,8 +165,9 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -163,8 +165,9 @@ class Ip extends \Q2A\Controllers\BaseController
$matchclauses
=
array
();
$matchclauses
=
array
();
foreach
(
$blockipclauses
as
$blockipclause
)
{
foreach
(
$blockipclauses
as
$blockipclause
)
{
if
(
qa_block_ip_match
(
$ip
,
$blockipclause
))
if
(
qa_block_ip_match
(
$ip
,
$blockipclause
))
{
$matchclauses
[]
=
$blockipclause
;
$matchclauses
[]
=
$blockipclause
;
}
}
}
if
(
count
(
$matchclauses
))
{
if
(
count
(
$matchclauses
))
{
...
@@ -179,12 +182,12 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -179,12 +182,12 @@ class Ip extends \Q2A\Controllers\BaseController
'label'
=>
qa_lang_html
(
'misc/unblock_ip_button'
),
'label'
=>
qa_lang_html
(
'misc/unblock_ip_button'
),
);
);
if
(
count
(
$questions
)
&&
!
qa_user_maximum_permit_error
(
'permit_hide_show'
))
if
(
count
(
$questions
)
&&
!
qa_user_maximum_permit_error
(
'permit_hide_show'
))
{
$qa_content
[
'form'
][
'buttons'
][
'hideall'
]
=
array
(
$qa_content
[
'form'
][
'buttons'
][
'hideall'
]
=
array
(
'tags'
=>
'name="dohideall" onclick="qa_show_waiting_after(this, false);"'
,
'tags'
=>
'name="dohideall" onclick="qa_show_waiting_after(this, false);"'
,
'label'
=>
qa_lang_html
(
'misc/hide_all_ip_button'
),
'label'
=>
qa_lang_html
(
'misc/hide_all_ip_button'
),
);
);
}
}
else
{
}
else
{
$qa_content
[
'form'
][
'buttons'
][
'block'
]
=
array
(
$qa_content
[
'form'
][
'buttons'
][
'block'
]
=
array
(
'tags'
=>
'name="doblock"'
,
'tags'
=>
'name="doblock"'
,
...
@@ -210,8 +213,10 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -210,8 +213,10 @@ class Ip extends \Q2A\Controllers\BaseController
$htmlfields
=
qa_any_to_q_html_fields
(
$question
,
$userid
,
qa_cookie_get
(),
$usershtml
,
null
,
$htmloptions
);
$htmlfields
=
qa_any_to_q_html_fields
(
$question
,
$userid
,
qa_cookie_get
(),
$usershtml
,
null
,
$htmloptions
);
if
(
isset
(
$htmlfields
[
'what_url'
]))
// link directly to relevant content
if
(
isset
(
$htmlfields
[
'what_url'
]))
{
// link directly to relevant content
$htmlfields
[
'url'
]
=
$htmlfields
[
'what_url'
];
$htmlfields
[
'url'
]
=
$htmlfields
[
'what_url'
];
}
$hasother
=
isset
(
$question
[
'opostid'
]);
$hasother
=
isset
(
$question
[
'opostid'
]);
...
@@ -220,16 +225,17 @@ class Ip extends \Q2A\Controllers\BaseController
...
@@ -220,16 +225,17 @@ class Ip extends \Q2A\Controllers\BaseController
if
(
@
$htmloptions
[
'whenview'
])
{
if
(
@
$htmloptions
[
'whenview'
])
{
$updated
=
@
$question
[
$hasother
?
'oupdated'
:
'updated'
];
$updated
=
@
$question
[
$hasother
?
'oupdated'
:
'updated'
];
if
(
isset
(
$updated
))
if
(
isset
(
$updated
))
{
$htmlfields
[
'when_2'
]
=
qa_when_to_html
(
$updated
,
@
$htmloptions
[
'fulldatedays'
]);
$htmlfields
[
'when_2'
]
=
qa_when_to_html
(
$updated
,
@
$htmloptions
[
'fulldatedays'
]);
}
}
}
}
}
$qa_content
[
'q_list'
][
'qs'
][]
=
$htmlfields
;
$qa_content
[
'q_list'
][
'qs'
][]
=
$htmlfields
;
}
}
}
else
{
}
else
$qa_content
[
'q_list'
][
'title'
]
=
qa_lang_html_sub
(
'misc/no_activity_from_x'
,
qa_html
(
$ip
));
$qa_content
[
'q_list'
][
'title'
]
=
qa_lang_html_sub
(
'misc/no_activity_from_x'
,
qa_html
(
$ip
));
}
return
$qa_content
;
return
$qa_content
;
...
...
qa-src/Http/Router.php
View file @
1455b5c5
...
@@ -36,13 +36,9 @@ class Router
...
@@ -36,13 +36,9 @@ class Router
public
function
__construct
()
public
function
__construct
()
{
{
$method
=
strtoupper
(
$_SERVER
[
'REQUEST_METHOD'
]);
// implicity support HEAD requests (PHP takes care of removing the response body for us)
// implicity support HEAD requests (PHP takes care of removing the response body for us)
if
(
$method
===
'HEAD'
)
{
$method
=
strtoupper
(
$_SERVER
[
'REQUEST_METHOD'
]);
$method
=
'GET'
;
$this
->
httpMethod
=
(
$method
===
'HEAD'
?
'GET'
:
$method
);
}
$this
->
httpMethod
=
$method
;
}
}
/**
/**
...
...
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