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
2089b48f
Commit
2089b48f
authored
Jan 13, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (misc)
parent
c1b82ae1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
64 changed files
with
343 additions
and
353 deletions
+343
-353
qa-config-example.php
qa-config-example.php
+1
-6
qa-external-users.php
qa-external-example/qa-external-users.php
+8
-8
install.php
qa-include/db/install.php
+2
-2
points.php
qa-include/db/points.php
+23
-23
account.php
qa-include/pages/account.php
+9
-9
activity.php
qa-include/pages/activity.php
+2
-2
admin-approve.php
qa-include/pages/admin/admin-approve.php
+5
-5
admin-categories.php
qa-include/pages/admin/admin-categories.php
+11
-11
admin-default.php
qa-include/pages/admin/admin-default.php
+14
-14
admin-flagged.php
qa-include/pages/admin/admin-flagged.php
+6
-6
admin-hidden.php
qa-include/pages/admin/admin-hidden.php
+8
-8
admin-moderate.php
qa-include/pages/admin/admin-moderate.php
+6
-6
admin-pages.php
qa-include/pages/admin/admin-pages.php
+14
-14
admin-plugins.php
qa-include/pages/admin/admin-plugins.php
+3
-3
admin-points.php
qa-include/pages/admin/admin-points.php
+3
-3
admin-recalc.php
qa-include/pages/admin/admin-recalc.php
+2
-2
admin-stats.php
qa-include/pages/admin/admin-stats.php
+3
-3
admin-userfields.php
qa-include/pages/admin/admin-userfields.php
+6
-6
admin-usertitles.php
qa-include/pages/admin/admin-usertitles.php
+7
-7
admin-widgets.php
qa-include/pages/admin/admin-widgets.php
+6
-6
answers.php
qa-include/pages/answers.php
+2
-2
categories.php
qa-include/pages/categories.php
+3
-3
comments.php
qa-include/pages/comments.php
+2
-2
confirm.php
qa-include/pages/confirm.php
+3
-3
default.php
qa-include/pages/default.php
+10
-10
favorites-list.php
qa-include/pages/favorites-list.php
+5
-5
favorites.php
qa-include/pages/favorites.php
+8
-8
feedback.php
qa-include/pages/feedback.php
+4
-4
forgot.php
qa-include/pages/forgot.php
+3
-3
hot.php
qa-include/pages/hot.php
+2
-2
ip.php
qa-include/pages/ip.php
+5
-5
login.php
qa-include/pages/login.php
+2
-2
message.php
qa-include/pages/message.php
+7
-7
messages.php
qa-include/pages/messages.php
+3
-3
question-post.php
qa-include/pages/question-post.php
+13
-13
question-submit.php
qa-include/pages/question-submit.php
+1
-1
question.php
qa-include/pages/question.php
+23
-28
questions.php
qa-include/pages/questions.php
+2
-2
register.php
qa-include/pages/register.php
+4
-4
reset.php
qa-include/pages/reset.php
+2
-2
search.php
qa-include/pages/search.php
+7
-7
tag.php
qa-include/pages/tag.php
+2
-2
tags.php
qa-include/pages/tags.php
+2
-2
unanswered.php
qa-include/pages/unanswered.php
+2
-2
unsubscribe.php
qa-include/pages/unsubscribe.php
+4
-4
updates.php
qa-include/pages/updates.php
+4
-4
user-activity.php
qa-include/pages/user-activity.php
+6
-6
user-answers.php
qa-include/pages/user-answers.php
+6
-6
user-profile.php
qa-include/pages/user-profile.php
+23
-23
user-questions.php
qa-include/pages/user-questions.php
+6
-6
user-wall.php
qa-include/pages/user-wall.php
+7
-7
user.php
qa-include/pages/user.php
+3
-3
users-blocked.php
qa-include/pages/users-blocked.php
+5
-5
users-newest.php
qa-include/pages/users-newest.php
+4
-4
users-special.php
qa-include/pages/users-special.php
+5
-5
users.php
qa-include/pages/users.php
+2
-2
qa-base.php
qa-include/qa-base.php
+1
-1
qa-check-lang.php
qa-include/qa-check-lang.php
+0
-0
qa-install.php
qa-include/qa-install.php
+3
-3
qa-page.php
qa-include/qa-page.php
+1
-1
qa-theme-base.php
qa-include/qa-theme-base.php
+4
-4
image.php
qa-include/util/image.php
+1
-1
qa-facebook-login.php
qa-plugin/facebook-login/qa-facebook-login.php
+1
-1
qa-xml-sitemap.php
qa-plugin/xml-sitemap/qa-xml-sitemap.php
+1
-1
No files found.
qa-config-example.php
View file @
2089b48f
...
...
@@ -108,7 +108,7 @@
and the value should be the replacement for that standard part, e.g. 'topics'. If you edit this
file in UTF-8 encoding you can also use non-ASCII characters in these URLs.
$QA_CONST_PATH_MAP
=
array(
$QA_CONST_PATH_MAP
=
array(
'questions' => 'topics',
'categories' => 'sections',
'users' => 'contributors',
...
...
@@ -197,7 +197,3 @@
file to override the default setting. Just make sure you know what you're doing!
*/
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
qa-external-example/qa-external-users.php
View file @
2089b48f
...
...
@@ -48,7 +48,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
*/
function
qa_get_mysql_user_column_type
()
{
//
Set this before anything else
//
Set this before anything else
return
null
;
...
...
@@ -101,7 +101,7 @@ function qa_get_mysql_user_column_type()
*/
function
qa_get_login_links
(
$relative_url_prefix
,
$redirect_back_to_url
)
{
//
Until you edit this function, don't show login, register or logout links
//
Until you edit this function, don't show login, register or logout links
return
array
(
'login'
=>
null
,
...
...
@@ -187,7 +187,7 @@ function qa_get_login_links($relative_url_prefix, $redirect_back_to_url)
*/
function
qa_get_logged_in_user
()
{
//
Until you edit this function, nobody is ever logged in
//
Until you edit this function, nobody is ever logged in
return
null
;
...
...
@@ -267,7 +267,7 @@ function qa_get_logged_in_user()
*/
function
qa_get_user_email
(
$userid
)
{
//
Until you edit this function, always return null
//
Until you edit this function, always return null
return
null
;
...
...
@@ -308,7 +308,7 @@ function qa_get_user_email($userid)
*/
function
qa_get_userids_from_public
(
$publicusernames
)
{
//
Until you edit this function, always return null
//
Until you edit this function, always return null
return
null
;
...
...
@@ -371,7 +371,7 @@ function qa_get_userids_from_public($publicusernames)
*/
function
qa_get_public_from_userids
(
$userids
)
{
//
Until you edit this function, always return null
//
Until you edit this function, always return null
return
null
;
...
...
@@ -440,7 +440,7 @@ function qa_get_public_from_userids($userids)
*/
function
qa_get_logged_in_user_html
(
$logged_in_user
,
$relative_url_prefix
)
{
//
By default, show the public username linked to the Q2A profile page for the user
//
By default, show the public username linked to the Q2A profile page for the user
$publicusername
=
$logged_in_user
[
'publicusername'
];
...
...
@@ -502,7 +502,7 @@ function qa_get_logged_in_user_html($logged_in_user, $relative_url_prefix)
*/
function
qa_get_users_html
(
$userids
,
$should_include_link
,
$relative_url_prefix
)
{
//
By default, show the public username linked to the Q2A profile page for each user
//
By default, show the public username linked to the Q2A profile page for each user
$useridtopublic
=
qa_get_public_from_userids
(
$userids
);
...
...
qa-include/db/install.php
View file @
2089b48f
...
...
@@ -573,7 +573,7 @@ function qa_db_missing_columns($table, $definition)
$missing
=
array
();
foreach
(
$definition
as
$colname
=>
$coldefn
)
if
(
(
!
is_int
(
$colname
)
)
&&
!
isset
(
$keycolumns
[
$colname
]))
if
(
!
is_int
(
$colname
)
&&
!
isset
(
$keycolumns
[
$colname
]))
$missing
[
$colname
]
=
$coldefn
;
return
$missing
;
...
...
@@ -649,7 +649,7 @@ function qa_db_check_tables()
$datamissing
++
;
}
if
(
(
$datacount
==
$datamissing
)
&&
(
$datamissing
==
count
(
$missing
)
))
if
(
$datacount
==
$datamissing
&&
$datamissing
==
count
(
$missing
))
return
'non-users-missing'
;
}
...
...
qa-include/db/points.php
View file @
2089b48f
...
...
@@ -148,45 +148,45 @@ function qa_db_points_update_ifuser($userid, $columns)
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
if
(
qa_should_update_counts
()
&&
isset
(
$userid
))
{
require_once
QA_INCLUDE_DIR
.
'app/options.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/options.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
$calculations
=
qa_db_points_calculations
();
$calculations
=
qa_db_points_calculations
();
if
(
$columns
===
true
)
$keycolumns
=
$calculations
;
if
(
$columns
===
true
)
$keycolumns
=
$calculations
;
elseif
(
empty
(
$columns
))
$keycolumns
=
array
();
$keycolumns
=
array
();
elseif
(
is_array
(
$columns
))
$keycolumns
=
array_flip
(
$columns
);
$keycolumns
=
array_flip
(
$columns
);
else
$keycolumns
=
array
(
$columns
=>
true
);
$keycolumns
=
array
(
$columns
=>
true
);
$insertfields
=
'userid, '
;
$insertvalues
=
'$, '
;
$insertpoints
=
(
int
)
qa_opt
(
'points_base'
);
$insertfields
=
'userid, '
;
$insertvalues
=
'$, '
;
$insertpoints
=
(
int
)
qa_opt
(
'points_base'
);
$updates
=
''
;
$updatepoints
=
$insertpoints
;
$updates
=
''
;
$updatepoints
=
$insertpoints
;
foreach
(
$calculations
as
$field
=>
$calculation
)
{
$multiple
=
(
int
)
$calculation
[
'multiple'
];
$multiple
=
(
int
)
$calculation
[
'multiple'
];
if
(
isset
(
$keycolumns
[
$field
]))
{
$insertfields
.=
$field
.
', '
;
$insertvalues
.=
'@_'
.
$field
.
':=(SELECT '
.
$calculation
[
'formula'
]
.
'), '
;
$updates
.=
$field
.
'=@_'
.
$field
.
', '
;
$insertpoints
.=
'+('
.
(
int
)
$multiple
.
'*@_'
.
$field
.
')'
;
$insertfields
.=
$field
.
', '
;
$insertvalues
.=
'@_'
.
$field
.
':=(SELECT '
.
$calculation
[
'formula'
]
.
'), '
;
$updates
.=
$field
.
'=@_'
.
$field
.
', '
;
$insertpoints
.=
'+('
.
(
int
)
$multiple
.
'*@_'
.
$field
.
')'
;
}
$updatepoints
.=
'+('
.
$multiple
.
'*'
.
(
isset
(
$keycolumns
[
$field
])
?
'@_'
:
''
)
.
$field
.
')'
;
$updatepoints
.=
'+('
.
$multiple
.
'*'
.
(
isset
(
$keycolumns
[
$field
])
?
'@_'
:
''
)
.
$field
.
')'
;
}
$query
=
'INSERT INTO ^userpoints ('
.
$insertfields
.
'points) VALUES ('
.
$insertvalues
.
$insertpoints
.
') '
.
'ON DUPLICATE KEY UPDATE '
.
$updates
.
'points='
.
$updatepoints
.
'+bonus'
;
$query
=
'INSERT INTO ^userpoints ('
.
$insertfields
.
'points) VALUES ('
.
$insertvalues
.
$insertpoints
.
') '
.
'ON DUPLICATE KEY UPDATE '
.
$updates
.
'points='
.
$updatepoints
.
'+bonus'
;
qa_db_query_raw
(
str_replace
(
'~'
,
"='"
.
qa_db_escape_string
(
$userid
)
.
"'"
,
qa_db_apply_sub
(
$query
,
array
(
$userid
))));
// build like this so that a #, $ or ^ character in the $userid (if external integration) isn't substituted
// build like this so that a #, $ or ^ character in the $userid (if external integration) isn't substituted
qa_db_query_raw
(
str_replace
(
'~'
,
"='"
.
qa_db_escape_string
(
$userid
)
.
"'"
,
qa_db_apply_sub
(
$query
,
array
(
$userid
))));
if
(
qa_db_insert_on_duplicate_inserted
())
qa_db_userpointscount_update
();
...
...
qa-include/pages/account.php
View file @
2089b48f
...
...
@@ -32,7 +32,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'util/image.php'
;
//
Check we're not using single-sign on integration, that we're logged in
//
Check we're not using single-sign on integration, that we're logged in
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
...
...
@@ -43,7 +43,7 @@ if (!isset($userid))
qa_redirect
(
'login'
);
//
Get current information on user
//
Get current information on user
list
(
$useraccount
,
$userprofile
,
$userpoints
,
$userfields
)
=
qa_db_select_with_pending
(
qa_db_user_account_selectspec
(
$userid
,
true
),
...
...
@@ -66,7 +66,7 @@ $permit_error = qa_user_permit_error();
$isblocked
=
$permit_error
!==
false
;
$pending_confirmation
=
$doconfirms
&&
$permit_error
==
'confirm'
;
//
Process profile if saved
//
Process profile if saved
// If the post_max_size is exceeded then the $_POST array is empty so no field processing can be done
if
(
qa_post_limit_exceeded
())
...
...
@@ -197,7 +197,7 @@ else {
}
//
Process change password if clicked
//
Process change password if clicked
if
(
qa_clicked
(
'dochangepassword'
))
{
$inoldpassword
=
qa_post_text
(
'oldpassword'
);
...
...
@@ -240,7 +240,7 @@ else {
}
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -346,7 +346,7 @@ if ($isblocked && !$pending_confirmation) {
$qa_content
[
'error'
]
=
qa_lang_html
(
'users/no_permission'
);
}
//
Avatar upload stuff
//
Avatar upload stuff
if
(
qa_opt
(
'avatar_allow_gravatar'
)
||
qa_opt
(
'avatar_allow_upload'
))
{
$avataroptions
=
array
();
...
...
@@ -397,7 +397,7 @@ if (qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) {
}
//
Other profile fields
//
Other profile fields
foreach
(
$userfields
as
$userfield
)
{
$value
=
@
$inprofile
[
$userfield
[
'fieldid'
]];
...
...
@@ -419,14 +419,14 @@ foreach ($userfields as $userfield) {
}
//
Raw information for plugin layers to access
//
Raw information for plugin layers to access
$qa_content
[
'raw'
][
'account'
]
=
$useraccount
;
$qa_content
[
'raw'
][
'profile'
]
=
$userprofile
;
$qa_content
[
'raw'
][
'points'
]
=
$userpoints
;
//
Change password form
//
Change password form
$qa_content
[
'form_password'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
...
...
qa-include/pages/activity.php
View file @
2089b48f
...
...
@@ -35,7 +35,7 @@ $countslugs = count($categoryslugs);
$userid
=
qa_get_logged_in_userid
();
//
Get lists of recent activity in all its forms, plus category information
//
Get lists of recent activity in all its forms, plus category information
list
(
$questions1
,
$questions2
,
$questions3
,
$questions4
,
$categories
,
$categoryid
)
=
qa_db_select_with_pending
(
qa_db_qs_selectspec
(
$userid
,
'created'
,
0
,
$categoryslugs
,
null
,
false
,
false
,
qa_opt_if_loaded
(
'page_size_activity'
)),
...
...
@@ -60,7 +60,7 @@ if ($countslugs) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
return
qa_q_list_page_content
(
qa_any_sort_and_dedupe
(
array_merge
(
$questions1
,
$questions2
,
$questions3
,
$questions4
)),
// questions
...
...
qa-include/pages/admin/admin-approve.php
View file @
2089b48f
...
...
@@ -29,13 +29,13 @@ require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once
QA_INCLUDE_DIR
.
'db/admin.php'
;
//
Check we're not using single-sign on integration
//
Check we're not using single-sign on integration
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
//
Find most flagged questions, answers, comments
//
Find most flagged questions, answers, comments
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -43,7 +43,7 @@ $users = qa_db_get_unapproved_users(qa_opt('page_size_users'));
$userfields
=
qa_db_select_with_pending
(
qa_db_userfields_selectspec
());
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_MODERATOR
)
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -52,12 +52,12 @@ if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
}
//
Check to see if any were approved or blocked here
//
Check to see if any were approved or blocked here
$pageerror
=
qa_admin_check_clicks
();
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-categories.php
View file @
2089b48f
...
...
@@ -31,7 +31,7 @@ require_once QA_INCLUDE_DIR . 'db/admin.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Get relevant list of categories
//
Get relevant list of categories
$editcategoryid
=
qa_post_text
(
'edit'
);
if
(
!
isset
(
$editcategoryid
))
...
...
@@ -42,13 +42,13 @@ if (!isset($editcategoryid))
$categories
=
qa_db_select_with_pending
(
qa_db_category_nav_selectspec
(
$editcategoryid
,
true
,
false
,
true
));
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Work out the appropriate state for the page
//
Work out the appropriate state for the page
$editcategory
=
@
$categories
[
$editcategoryid
];
...
...
@@ -78,7 +78,7 @@ foreach ($categories as $category) {
}
//
Process saving options
//
Process saving options
$savedoptions
=
false
;
$securityexpired
=
false
;
...
...
@@ -95,7 +95,7 @@ if (qa_clicked('dosaveoptions')) {
}
//
Process saving an old or new category
//
Process saving an old or new category
if
(
qa_clicked
(
'docancel'
))
{
if
(
$setmissing
||
$setparent
)
...
...
@@ -136,11 +136,11 @@ if (qa_clicked('docancel')) {
$inposition
=
qa_post_text
(
'position'
);
$errors
=
array
();
//
Check the parent ID
//
Check the parent ID
$incategories
=
qa_db_select_with_pending
(
qa_db_category_nav_selectspec
(
$inparentid
,
true
));
//
Verify the name is legitimate for that parent ID
//
Verify the name is legitimate for that parent ID
if
(
empty
(
$inname
))
$errors
[
'name'
]
=
qa_lang
(
'main/field_required'
);
...
...
@@ -158,7 +158,7 @@ if (qa_clicked('docancel')) {
}
}
//
Verify the slug is legitimate for that parent ID
//
Verify the slug is legitimate for that parent ID
for
(
$attempt
=
0
;
$attempt
<
100
;
$attempt
++
)
{
switch
(
$attempt
)
{
...
...
@@ -190,7 +190,7 @@ if (qa_clicked('docancel')) {
$errors
[
'slug'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_CAT_PAGE_TAGS_LENGTH
);
elseif
(
preg_match
(
'/[\\+\\/]/'
,
$inslug
))
$errors
[
'slug'
]
=
qa_lang_sub
(
'admin/slug_bad_chars'
,
'+ /'
);
elseif
(
(
!
isset
(
$inparentid
)
)
&&
qa_admin_is_slug_reserved
(
$inslug
))
// only top level is a problem
elseif
(
!
isset
(
$inparentid
)
&&
qa_admin_is_slug_reserved
(
$inslug
))
// only top level is a problem
$errors
[
'slug'
]
=
qa_lang
(
'admin/slug_reserved'
);
elseif
(
isset
(
$matchcategoryid
)
&&
strcmp
(
$matchcategoryid
,
@
$editcategory
[
'categoryid'
]))
$errors
[
'slug'
]
=
qa_lang
(
'admin/category_already_used'
);
...
...
@@ -203,7 +203,7 @@ if (qa_clicked('docancel')) {
break
;
}
//
Perform appropriate database action
//
Perform appropriate database action
if
(
empty
(
$errors
))
{
if
(
isset
(
$editcategory
[
'categoryid'
]))
{
// changing existing category
...
...
@@ -237,7 +237,7 @@ if (qa_clicked('docancel')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-default.php
View file @
2089b48f
...
...
@@ -32,17 +32,17 @@ require_once QA_INCLUDE_DIR . 'app/options.php';
require_once
QA_INCLUDE_DIR
.
'app/admin.php'
;
//
Pages handled by this controller: general, emails, users, layout, viewing, lists, posting, permissions, feeds, spam, caching, mailing
//
Pages handled by this controller: general, emails, users, layout, viewing, lists, posting, permissions, feeds, spam, caching, mailing
$adminsection
=
strtolower
(
qa_request_part
(
1
));
//
Get list of categories and all options
//
Get list of categories and all options
$categories
=
qa_db_select_with_pending
(
qa_db_category_nav_selectspec
(
null
,
true
));
//
See if we need to redirect
//
See if we need to redirect
if
(
empty
(
$adminsection
))
{
$subnav
=
qa_admin_sub_navigation
();
...
...
@@ -56,13 +56,13 @@ if (empty($adminsection)) {
}
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
For non-text options, lists of option types, minima and maxima
//
For non-text options, lists of option types, minima and maxima
$optiontype
=
array
(
'avatar_message_list_size'
=>
'number'
,
...
...
@@ -279,7 +279,7 @@ $optionminimum = array(
);
//
Define the options to show (and some other visual stuff) based on request
//
Define the options to show (and some other visual stuff) based on request
$formstyle
=
'tall'
;
$checkboxtodisplay
=
null
;
...
...
@@ -673,7 +673,7 @@ switch ($adminsection) {
}
//
Filter out blanks to get list of valid options
//
Filter out blanks to get list of valid options
$getoptions
=
array
();
foreach
(
$showoptions
as
$optionname
)
{
...
...
@@ -682,7 +682,7 @@ foreach ($showoptions as $optionname) {
}
//
Process user actions
//
Process user actions
$errors
=
array
();
...
...
@@ -756,7 +756,7 @@ else {
$formokhtml
=
qa_lang_html
(
'admin/options_saved'
);
//
Uploading default avatar
//
Uploading default avatar
if
(
is_array
(
@
$_FILES
[
'avatar_default_file'
]))
{
$avatarfileerror
=
$_FILES
[
'avatar_default_file'
][
'error'
];
...
...
@@ -800,7 +800,7 @@ else {
}
//
Mailings management
//
Mailings management
if
(
$adminsection
==
'mailing'
)
{
if
(
qa_clicked
(
'domailingtest'
)
||
qa_clicked
(
'domailingstart'
)
||
qa_clicked
(
'domailingresume'
)
||
qa_clicked
(
'domailingcancel'
))
{
...
...
@@ -852,12 +852,12 @@ if ($adminsection == 'mailing') {
}
//
Get the actual options
//
Get the actual options
$options
=
qa_get_options
(
$getoptions
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -1300,7 +1300,7 @@ foreach ($showoptions as $optionname) {
foreach
(
$searchmodules
as
$modulename
=>
$module
)
{
$selectoptions
[
qa_html
(
$modulename
)]
=
strlen
(
$modulename
)
?
qa_html
(
$modulename
)
:
qa_lang_html
(
'options/option_default'
);
if
(
(
$modulename
==
$value
)
&&
method_exists
(
$module
,
'admin_form'
))
{
if
(
$modulename
==
$value
&&
method_exists
(
$module
,
'admin_form'
))
{
$optionfield
[
'note'
]
=
'<a href="'
.
qa_admin_module_options_path
(
'search'
,
$modulename
)
.
'">'
.
qa_lang_html
(
'admin/options'
)
.
'</a>'
;
}
}
...
...
@@ -1568,7 +1568,7 @@ foreach ($showoptions as $optionname) {
}
//
Extra items for specific pages
//
Extra items for specific pages
switch
(
$adminsection
)
{
case
'users'
:
...
...
qa-include/pages/admin/admin-flagged.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Find most flagged questions, answers, comments
//
Find most flagged questions, answers, comments
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -39,7 +39,7 @@ $questions = qa_db_select_with_pending(
);
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
qa_user_maximum_permit_error
(
'permit_hide_show'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -48,12 +48,12 @@ if (qa_user_maximum_permit_error('permit_hide_show')) {
}
//
Check to see if any were cleared or hidden here
//
Check to see if any were cleared or hidden here
$pageerror
=
qa_admin_check_clicks
();
//
Remove questions the user has no permission to hide/show
//
Remove questions the user has no permission to hide/show
if
(
qa_user_permit_error
(
'permit_hide_show'
))
{
// if user not allowed to show/hide all posts
foreach
(
$questions
as
$index
=>
$question
)
{
...
...
@@ -64,12 +64,12 @@ if (qa_user_permit_error('permit_hide_show')) { // if user not allowed to show/h
}
//
Get information for users
//
Get information for users
$usershtml
=
qa_userids_handles_html
(
qa_any_get_userids_handles
(
$questions
));
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-hidden.php
View file @
2089b48f
...
...
@@ -31,7 +31,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Find recently hidden questions, answers, comments
//
Find recently hidden questions, answers, comments
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -42,7 +42,7 @@ list($hiddenquestions, $hiddenanswers, $hiddencomments) = qa_db_select_with_pend
);
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
qa_user_maximum_permit_error
(
'permit_hide_show'
)
&&
qa_user_maximum_permit_error
(
'permit_delete_hidden'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -51,12 +51,12 @@ if (qa_user_maximum_permit_error('permit_hide_show') && qa_user_maximum_permit_e
}
//
Check to see if any have been reshown or deleted
//
Check to see if any have been reshown or deleted
$pageerror
=
qa_admin_check_clicks
();
//
Combine sets of questions and remove those this user has no permissions for
//
Combine sets of questions and remove those this user has no permissions for
$questions
=
qa_any_sort_by_date
(
array_merge
(
$hiddenquestions
,
$hiddenanswers
,
$hiddencomments
));
...
...
@@ -69,12 +69,12 @@ if (qa_user_permit_error('permit_hide_show') && qa_user_permit_error('permit_del
}
//
Get information for users
//
Get information for users
$usershtml
=
qa_userids_handles_html
(
qa_any_get_userids_handles
(
$questions
));
//
Create list of actual hidden postids and see which ones have dependents
//
Create list of actual hidden postids and see which ones have dependents
$qhiddenpostid
=
array
();
foreach
(
$questions
as
$key
=>
$question
)
...
...
@@ -83,7 +83,7 @@ foreach ($questions as $key => $question)
$dependcounts
=
qa_db_postids_count_dependents
(
$qhiddenpostid
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -142,7 +142,7 @@ if (count($questions)) {
);
}
if
(
(
!
qa_user_post_permit_error
(
'permit_delete_hidden'
,
$question
)
)
&&
!
$dependcounts
[
$qhiddenpostid
[
$key
]])
{
if
(
!
qa_user_post_permit_error
(
'permit_delete_hidden'
,
$question
)
&&
!
$dependcounts
[
$qhiddenpostid
[
$key
]])
{
// Possible values for popup: delete_q_popup, delete_a_popup, delete_c_popup
$buttons
[
'delete'
]
=
array
(
'tags'
=>
'name="admin_'
.
qa_html
(
$qhiddenpostid
[
$key
])
.
'_delete" onclick="return qa_admin_click(this);"'
,
...
...
qa-include/pages/admin/admin-moderate.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Find queued questions, answers, comments
//
Find queued questions, answers, comments
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -41,7 +41,7 @@ list($queuedquestions, $queuedanswers, $queuedcomments) = qa_db_select_with_pend
);
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
qa_user_maximum_permit_error
(
'permit_moderate'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -50,12 +50,12 @@ if (qa_user_maximum_permit_error('permit_moderate')) {
}
//
Check to see if any were approved/rejected here
//
Check to see if any were approved/rejected here
$pageerror
=
qa_admin_check_clicks
();
//
Combine sets of questions and remove those this user has no permission to moderate
//
Combine sets of questions and remove those this user has no permission to moderate
$questions
=
qa_any_sort_by_date
(
array_merge
(
$queuedquestions
,
$queuedanswers
,
$queuedcomments
));
...
...
@@ -67,12 +67,12 @@ if (qa_user_permit_error('permit_moderate')) { // if user not allowed to moderat
}
//
Get information for users
//
Get information for users
$usershtml
=
qa_userids_handles_html
(
qa_any_get_userids_handles
(
$questions
));
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-pages.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'app/format.php';
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
//
Get current list of pages and determine the state of this admin page
//
Get current list of pages and determine the state of this admin page
$pageid
=
qa_post_text
(
'edit'
);
if
(
!
isset
(
$pageid
))
...
...
@@ -49,13 +49,13 @@ if ((qa_clicked('doaddpage') || qa_clicked('doaddlink') || qa_get('doaddlink') |
$isexternal
=
$editpage
[
'flags'
]
&
QA_PAGE_FLAGS_EXTERNAL
;
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Define an array of navigation settings we can change, option name => language key
//
Define an array of navigation settings we can change, option name => language key
$hascustomhome
=
qa_has_custom_home
();
...
...
@@ -96,7 +96,7 @@ if (!qa_using_tags())
unset
(
$navoptions
[
'nav_tags'
]);
//
Process saving an old or new page
//
Process saving an old or new page
$securityexpired
=
false
;
...
...
@@ -139,7 +139,7 @@ elseif (qa_clicked('dosaveoptions') || qa_clicked('doaddpage') || qa_clicked('do
$errors
=
array
();
//
Verify the name (navigation link) is legitimate
//
Verify the name (navigation link) is legitimate
if
(
empty
(
$inname
))
$errors
[
'name'
]
=
qa_lang
(
'main/field_required'
);
...
...
@@ -147,7 +147,7 @@ elseif (qa_clicked('dosaveoptions') || qa_clicked('doaddpage') || qa_clicked('do
$errors
[
'name'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
);
if
(
$isexternal
)
{
//
Verify the url is legitimate (vaguely)
//
Verify the url is legitimate (vaguely)
if
(
empty
(
$inurl
))
$errors
[
'url'
]
=
qa_lang
(
'main/field_required'
);
...
...
@@ -155,12 +155,12 @@ elseif (qa_clicked('dosaveoptions') || qa_clicked('doaddpage') || qa_clicked('do
$errors
[
'url'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_CAT_PAGE_TAGS_LENGTH
);
}
else
{
//
Verify the heading is legitimate
//
Verify the heading is legitimate
if
(
qa_strlen
(
$inheading
)
>
QA_DB_MAX_TITLE_LENGTH
)
$errors
[
'heading'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_TITLE_LENGTH
);
//
Verify the slug is legitimate (and try some defaults if we're creating a new page, and it's not)
//
Verify the slug is legitimate (and try some defaults if we're creating a new page, and it's not)
for
(
$attempt
=
0
;
$attempt
<
100
;
$attempt
++
)
{
switch
(
$attempt
)
{
...
...
@@ -204,7 +204,7 @@ elseif (qa_clicked('dosaveoptions') || qa_clicked('doaddpage') || qa_clicked('do
}
}
//
Perform appropriate database action
//
Perform appropriate database action
if
(
isset
(
$editpage
[
'pageid'
]))
{
// changing existing page
if
(
$isexternal
)
{
...
...
@@ -277,7 +277,7 @@ elseif (qa_clicked('dosaveoptions') || qa_clicked('doaddpage') || qa_clicked('do
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -319,7 +319,7 @@ if (isset($editpage)) {
}
}
if
(
(
!
isset
(
$editpage
[
'pageid'
])
)
||
$nav
!=
@
$editpage
[
'nav'
])
{
if
(
!
isset
(
$editpage
[
'pageid'
]
)
||
$nav
!=
@
$editpage
[
'nav'
])
{
$positionvalue
=
isset
(
$previous
)
?
qa_lang_html_sub
(
'admin/after_x_tab'
,
qa_html
(
$previous
[
'title'
]))
:
qa_lang_html
(
$langkey
);
$positionoptions
[
$nav
.
(
isset
(
$previous
)
?
(
1
+
$maxposition
)
:
1
)]
=
$positionvalue
;
}
...
...
@@ -465,7 +465,7 @@ if (isset($editpage)) {
}
else
{
//
List of standard navigation links
//
List of standard navigation links
$qa_content
[
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
...
...
@@ -515,7 +515,7 @@ if (isset($editpage)) {
'type'
=>
'blank'
);
//
List of suggested plugin pages
//
List of suggested plugin pages
$listhtml
=
''
;
...
...
@@ -549,7 +549,7 @@ if (isset($editpage)) {
);
}
//
List of custom pages or links
//
List of custom pages or links
$listhtml
=
''
;
...
...
qa-include/pages/admin/admin-plugins.php
View file @
2089b48f
...
...
@@ -28,12 +28,12 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
require_once
QA_INCLUDE_DIR
.
'app/admin.php'
;
//
Check admin privileges
//
Check admin privileges
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -69,7 +69,7 @@ if (qa_is_http_post()) {
}
}
//
Map modules with options to their containing plugins
//
Map modules with options to their containing plugins
$pluginoptionmodules
=
array
();
...
...
qa-include/pages/admin/admin-points.php
View file @
2089b48f
...
...
@@ -32,13 +32,13 @@ require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
//
Check admin privileges
//
Check admin privileges
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Process user actions
//
Process user actions
$securityexpired
=
false
;
$recalculate
=
false
;
...
...
@@ -73,7 +73,7 @@ if (qa_clicked('doshowdefaults')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-recalc.php
View file @
2089b48f
...
...
@@ -29,13 +29,13 @@ require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once
QA_INCLUDE_DIR
.
'app/recalc.php'
;
//
Check we have administrative privileges
//
Check we have administrative privileges
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Find out the operation
//
Find out the operation
$allowstates
=
array
(
'dorecountposts'
,
...
...
qa-include/pages/admin/admin-stats.php
View file @
2089b48f
...
...
@@ -31,13 +31,13 @@ require_once QA_INCLUDE_DIR . 'db/admin.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Get the information to display
//
Get the information to display
$qcount
=
(
int
)
qa_opt
(
'cache_qcount'
);
$qcount_anon
=
qa_db_count_posts
(
'Q'
,
false
);
...
...
@@ -49,7 +49,7 @@ $ccount = (int)qa_opt('cache_ccount');
$ccount_anon
=
qa_db_count_posts
(
'C'
,
false
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-userfields.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
//
Get current list of user fields and determine the state of this admin page
//
Get current list of user fields and determine the state of this admin page
$fieldid
=
qa_post_text
(
'edit'
);
if
(
!
isset
(
$fieldid
))
...
...
@@ -44,13 +44,13 @@ foreach ($userfields as $userfield) {
}
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Process saving an old or new user field
//
Process saving an old or new user field
$securityexpired
=
false
;
...
...
@@ -79,12 +79,12 @@ elseif (qa_clicked('dosavefield')) {
$errors
=
array
();
//
Verify the name is legitimate
//
Verify the name is legitimate
if
(
qa_strlen
(
$inname
)
>
QA_DB_MAX_PROFILE_TITLE_LENGTH
)
$errors
[
'name'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_PROFILE_TITLE_LENGTH
);
//
Perform appropriate database action
//
Perform appropriate database action
if
(
isset
(
$editfield
[
'fieldid'
]))
{
// changing existing user field
qa_db_userfield_set_fields
(
$editfield
[
'fieldid'
],
isset
(
$errors
[
'name'
])
?
$editfield
[
'content'
]
:
$inname
,
$inflags
,
$inpermit
);
...
...
@@ -126,7 +126,7 @@ elseif (qa_clicked('dosavefield')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-usertitles.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
//
Get current list of user titles and determine the state of this admin page
//
Get current list of user titles and determine the state of this admin page
$oldpoints
=
qa_post_text
(
'edit'
);
if
(
!
isset
(
$oldpoints
))
...
...
@@ -38,13 +38,13 @@ if (!isset($oldpoints))
$pointstitle
=
qa_get_points_to_titles
();
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Process saving an old or new user title
//
Process saving an old or new user title
$securityexpired
=
false
;
...
...
@@ -67,7 +67,7 @@ elseif (qa_clicked('dosavetitle')) {
$errors
=
array
();
//
Verify the title and points are legitimate
//
Verify the title and points are legitimate
if
(
!
strlen
(
$intitle
))
$errors
[
'title'
]
=
qa_lang
(
'main/field_required'
);
...
...
@@ -81,7 +81,7 @@ elseif (qa_clicked('dosavetitle')) {
$errors
[
'points'
]
=
qa_lang
(
'admin/title_already_used'
);
}
//
Perform appropriate action
//
Perform appropriate action
if
(
isset
(
$pointstitle
[
$oldpoints
]))
{
// changing existing user title
$newpoints
=
isset
(
$errors
[
'points'
])
?
$oldpoints
:
$inpoints
;
...
...
@@ -94,7 +94,7 @@ elseif (qa_clicked('dosavetitle')) {
$pointstitle
[
$inpoints
]
=
$intitle
;
}
//
Save the new option value
//
Save the new option value
krsort
(
$pointstitle
,
SORT_NUMERIC
);
...
...
@@ -110,7 +110,7 @@ elseif (qa_clicked('dosavetitle')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/admin/admin-widgets.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
//
Get current list of widgets and determine the state of this admin page
//
Get current list of widgets and determine the state of this admin page
$widgetid
=
qa_post_text
(
'edit'
);
if
(
!
strlen
(
$widgetid
))
...
...
@@ -58,13 +58,13 @@ $module = qa_load_module('widget', @$editwidget['title']);
$widgetfound
=
isset
(
$module
);
//
Check admin privileges (do late to allow one DB query)
//
Check admin privileges (do late to allow one DB query)
if
(
!
qa_admin_check_privileges
(
$qa_content
))
return
$qa_content
;
//
Define an array of relevant templates we can use
//
Define an array of relevant templates we can use
$templatelangkeys
=
array
(
'question'
=>
'admin/question_pages'
,
...
...
@@ -124,7 +124,7 @@ if (isset($module) && method_exists($module, 'allow_template')) {
}
//
Process saving an old or new widget
//
Process saving an old or new widget
$securityexpired
=
false
;
...
...
@@ -158,7 +158,7 @@ elseif (qa_clicked('dosavewidget')) {
$intags
=
implode
(
','
,
$intemplates
);
//
Perform appropriate database action
//
Perform appropriate database action
if
(
isset
(
$editwidget
[
'widgetid'
]))
{
// changing existing widget
$widgetid
=
$editwidget
[
'widgetid'
];
...
...
@@ -176,7 +176,7 @@ elseif (qa_clicked('dosavewidget')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/answers.php
View file @
2089b48f
...
...
@@ -35,7 +35,7 @@ $countslugs = count($categoryslugs);
$userid
=
qa_get_logged_in_userid
();
//
Get list of answers with related questions, plus category information
//
Get list of answers with related questions, plus category information
list
(
$questions
,
$categories
,
$categoryid
)
=
qa_db_select_with_pending
(
qa_db_recent_a_qs_selectspec
(
$userid
,
0
,
$categoryslugs
),
...
...
@@ -57,7 +57,7 @@ if ($countslugs) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
return
qa_q_list_page_content
(
qa_any_sort_and_dedupe
(
$questions
),
// questions
...
...
qa-include/pages/categories.php
View file @
2089b48f
...
...
@@ -33,7 +33,7 @@ $categoryslugs = qa_request_parts(1);
$countslugs
=
count
(
$categoryslugs
);
//
Get information about appropriate categories and redirect to questions page if category has no sub-categories
//
Get information about appropriate categories and redirect to questions page if category has no sub-categories
$userid
=
qa_get_logged_in_userid
();
list
(
$categories
,
$categoryid
,
$favoritecats
)
=
qa_db_select_with_pending
(
...
...
@@ -46,7 +46,7 @@ if ($countslugs && !isset($categoryid))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
//
Function for recursive display of categories
//
Function for recursive display of categories
function
qa_category_nav_to_browse
(
&
$navigation
,
$categories
,
$categoryid
,
$favoritemap
)
{
...
...
@@ -79,7 +79,7 @@ function qa_category_nav_to_browse(&$navigation, $categories, $categoryid, $favo
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
false
,
array_keys
(
qa_category_path
(
$categories
,
$categoryid
)));
...
...
qa-include/pages/comments.php
View file @
2089b48f
...
...
@@ -34,7 +34,7 @@ $countslugs = count($categoryslugs);
$userid
=
qa_get_logged_in_userid
();
//
Get list of comments with related questions, plus category information
//
Get list of comments with related questions, plus category information
list
(
$questions
,
$categories
,
$categoryid
)
=
qa_db_select_with_pending
(
qa_db_recent_c_qs_selectspec
(
$userid
,
0
,
$categoryslugs
),
...
...
@@ -56,7 +56,7 @@ if ($countslugs) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
return
qa_q_list_page_content
(
qa_any_sort_and_dedupe
(
$questions
),
// questions
...
...
qa-include/pages/confirm.php
View file @
2089b48f
...
...
@@ -25,13 +25,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
exit
;
}
//
Check we're not using single-sign on integration, that we're not already confirmed, and that we're not blocked
//
Check we're not using single-sign on integration, that we're not already confirmed, and that we're not blocked
if
(
QA_FINAL_EXTERNAL_USERS
)
{
qa_fatal_error
(
'User login is handled by external code'
);
}
//
Check if we've been asked to send a new link or have a successful email confirmation
//
Check if we've been asked to send a new link or have a successful email confirmation
// Fetch the handle from POST or GET
$handle
=
qa_post_text
(
'username'
);
...
...
@@ -92,7 +92,7 @@ if (isset($loggedInUserId) && qa_clicked('dosendconfirm')) { // A logged in user
}
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/default.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Determine whether path begins with qa or not (question and answer listing can be accessed either way)
//
Determine whether path begins with qa or not (question and answer listing can be accessed either way)
$requestparts
=
explode
(
'/'
,
qa_request
());
$explicitqa
=
(
strtolower
(
$requestparts
[
0
])
==
'qa'
);
...
...
@@ -44,7 +44,7 @@ else
$countslugs
=
count
(
$slugs
);
//
Get list of questions, other bits of information that might be useful
//
Get list of questions, other bits of information that might be useful
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -57,7 +57,7 @@ list($questions1, $questions2, $categories, $categoryid, $custompage) = qa_db_se
);
//
First, if this matches a custom page, return immediately with that page's content
//
First, if this matches a custom page, return immediately with that page's content
if
(
isset
(
$custompage
)
&&
!
(
$custompage
[
'flags'
]
&
QA_PAGE_FLAGS_EXTERNAL
))
{
qa_set_template
(
'custom-'
.
$custompage
[
'pageid'
]);
...
...
@@ -86,15 +86,15 @@ if (isset($custompage) && !($custompage['flags'] & QA_PAGE_FLAGS_EXTERNAL)) {
}
//
Then, see if we should redirect because the 'qa' page is the same as the home page
//
Then, see if we should redirect because the 'qa' page is the same as the home page
if
(
$explicitqa
&&
(
!
qa_is_http_post
())
&&
!
qa_has_custom_home
())
qa_redirect
(
qa_category_path_request
(
$categories
,
$categoryid
),
$_GET
);
//
Then, if there's a slug that matches no category, check page modules provided by plugins
//
Then, if there's a slug that matches no category, check page modules provided by plugins
if
(
(
!
$explicitqa
)
&&
$countslugs
&&
!
isset
(
$categoryid
))
{
if
(
!
$explicitqa
&&
$countslugs
&&
!
isset
(
$categoryid
))
{
$pagemodules
=
qa_load_modules_with
(
'page'
,
'match_request'
);
$request
=
qa_request
();
...
...
@@ -108,9 +108,9 @@ if ((!$explicitqa) && $countslugs && !isset($categoryid)) {
}
//
Then, check whether we are showing a custom home page
//
Then, check whether we are showing a custom home page
if
(
(
!
$explicitqa
)
&&
(
!
$countslugs
)
&&
qa_opt
(
'show_custom_home'
))
{
if
(
!
$explicitqa
&&
!
$countslugs
&&
qa_opt
(
'show_custom_home'
))
{
qa_set_template
(
'custom'
);
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
qa_html
(
qa_opt
(
'custom_home_heading'
));
...
...
@@ -119,7 +119,7 @@ if ((!$explicitqa) && (!$countslugs) && qa_opt('show_custom_home')) {
}
//
If we got this far, it's a good old-fashioned Q&A listing page
//
If we got this far, it's a good old-fashioned Q&A listing page
require_once
QA_INCLUDE_DIR
.
'app/q-list.php'
;
...
...
@@ -141,7 +141,7 @@ if ($countslugs) {
}
//
Prepare and return content for theme for Q&A listing page
//
Prepare and return content for theme for Q&A listing page
$qa_content
=
qa_q_list_page_content
(
$questions
,
// questions
...
...
qa-include/pages/favorites-list.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'app/format.php';
require_once
QA_INCLUDE_DIR
.
'app/favorites.php'
;
//
Data for functions to run
//
Data for functions to run
$favswitch
=
array
(
'questions'
=>
array
(
...
...
@@ -54,7 +54,7 @@ $favswitch = array(
);
//
Check that we're logged in
//
Check that we're logged in
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -62,7 +62,7 @@ if (!isset($userid))
qa_redirect
(
'login'
);
//
Get lists of favorites of this type
//
Get lists of favorites of this type
$favtype
=
qa_request_part
(
1
);
$start
=
qa_get_start
();
...
...
@@ -82,7 +82,7 @@ $count = $totalItems['count'];
$usershtml
=
qa_userids_handles_html
(
$items
);
//
Prepare and return content for theme
//
Prepare and return content for theme
$qa_content
=
qa_content_prepare
(
true
);
...
...
@@ -91,7 +91,7 @@ $qa_content['title'] = qa_lang_html('misc/my_favorites_title');
$qa_content
[
$key
]
=
$fn_view
(
$items
,
$usershtml
);
//
Sub navigation for account pages and suggestion
//
Sub navigation for account pages and suggestion
$qa_content
[
'suggest_next'
]
=
qa_lang_html_sub
(
'misc/suggest_favorites_add'
,
'<span class="qa-favorite-image"> </span>'
);
...
...
qa-include/pages/favorites.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'app/format.php';
require_once
QA_INCLUDE_DIR
.
'app/favorites.php'
;
//
Check that we're logged in
//
Check that we're logged in
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -38,7 +38,7 @@ if (!isset($userid))
qa_redirect
(
'login'
);
//
Get lists of favorites for this user
//
Get lists of favorites for this user
$pagesize_qs
=
qa_opt
(
'page_size_qs'
);
$pagesize_users
=
qa_opt
(
'page_size_users'
);
...
...
@@ -60,14 +60,14 @@ list($numQs, $questions, $numUsers, $users, $numTags, $tags, $categories) = qa_d
$usershtml
=
qa_userids_handles_html
(
QA_FINAL_EXTERNAL_USERS
?
$questions
:
array_merge
(
$questions
,
$users
));
//
Prepare and return content for theme
//
Prepare and return content for theme
$qa_content
=
qa_content_prepare
(
true
);
$qa_content
[
'title'
]
=
qa_lang_html
(
'misc/my_favorites_title'
);
//
Favorite questions
//
Favorite questions
$qa_content
[
'q_list'
]
=
qa_favorite_q_list_view
(
$questions
,
$usershtml
);
$qa_content
[
'q_list'
][
'title'
]
=
count
(
$questions
)
?
qa_lang_html
(
'main/nav_qs'
)
:
qa_lang_html
(
'misc/no_favorite_qs'
);
...
...
@@ -77,7 +77,7 @@ if ($numQs['count'] > count($questions)) {
}
//
Favorite users
//
Favorite users
if
(
!
QA_FINAL_EXTERNAL_USERS
)
{
$qa_content
[
'ranking_users'
]
=
qa_favorite_users_view
(
$users
,
$usershtml
);
...
...
@@ -89,7 +89,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Favorite tags
//
Favorite tags
if
(
qa_using_tags
())
{
$qa_content
[
'ranking_tags'
]
=
qa_favorite_tags_view
(
$tags
);
...
...
@@ -101,7 +101,7 @@ if (qa_using_tags()) {
}
//
Favorite categories (no pagination)
//
Favorite categories (no pagination)
if
(
qa_using_categories
())
{
$qa_content
[
'nav_list_categories'
]
=
qa_favorite_categories_view
(
$categories
);
...
...
@@ -109,7 +109,7 @@ if (qa_using_categories()) {
}
//
Sub navigation for account pages and suggestion
//
Sub navigation for account pages and suggestion
$qa_content
[
'suggest_next'
]
=
qa_lang_html_sub
(
'misc/suggest_favorites_add'
,
'<span class="qa-favorite-image"> </span>'
);
...
...
qa-include/pages/feedback.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
//
Get useful information on the logged in user
//
Get useful information on the logged in user
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -43,7 +43,7 @@ if (isset($userid) && !QA_FINAL_EXTERNAL_USERS) {
$usecaptcha
=
qa_opt
(
'captcha_on_feedback'
)
&&
qa_user_use_captcha
();
//
Check feedback is enabled and the person isn't blocked
//
Check feedback is enabled and the person isn't blocked
if
(
!
qa_opt
(
'feedback_enabled'
))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
...
...
@@ -55,7 +55,7 @@ if (qa_user_permit_error()) {
}
//
Send the feedback form
//
Send the feedback form
$feedbacksent
=
false
;
...
...
@@ -118,7 +118,7 @@ if (qa_clicked('dofeedback')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/forgot.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'db/users.php';
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
//
Check we're not using single-sign on integration and that we're not logged in
//
Check we're not using single-sign on integration and that we're not logged in
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User login is handled by external code'
);
...
...
@@ -38,7 +38,7 @@ if (qa_is_logged_in())
qa_redirect
(
''
);
//
Start the 'I forgot my password' process, sending email if appropriate
//
Start the 'I forgot my password' process, sending email if appropriate
if
(
qa_clicked
(
'doforgot'
))
{
require_once
QA_INCLUDE_DIR
.
'app/users-edit.php'
;
...
...
@@ -76,7 +76,7 @@ if (qa_clicked('doforgot')) {
$inemailhandle
=
qa_get
(
'e'
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/hot.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/q-list.php'
;
//
Get list of hottest questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php
//
Get list of hottest questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php
$categoryslugs
=
QA_ALLOW_UNINDEXED_QUERIES
?
qa_request_parts
(
1
)
:
null
;
$countslugs
=
@
count
(
$categoryslugs
);
...
...
@@ -57,7 +57,7 @@ if ($countslugs) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
return
qa_q_list_page_content
(
$questions
,
// questions
...
...
qa-include/pages/ip.php
View file @
2089b48f
...
...
@@ -34,7 +34,7 @@ if (filter_var($ip, FILTER_VALIDATE_IP) === false)
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
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -53,7 +53,7 @@ list($qs, $qs_queued, $qs_hidden, $a_qs, $a_queued_qs, $a_hidden_qs, $c_qs, $c_q
);
//
Check we have permission to view this page, and whether we can block or unblock IPs
//
Check we have permission to view this page, and whether we can block or unblock IPs
if
(
qa_user_maximum_permit_error
(
'permit_anon_view_ips'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -64,7 +64,7 @@ if (qa_user_maximum_permit_error('permit_anon_view_ips')) {
$blockable
=
qa_user_level_maximum
()
>=
QA_USER_LEVEL_MODERATOR
;
// allow moderator in one category to block across all categories
//
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_check_form_security_code
(
'ip-'
.
$ip
,
qa_post_text
(
'code'
)))
...
...
@@ -119,7 +119,7 @@ if (qa_clicked('doblock') || qa_clicked('dounblock') || qa_clicked('dohideall'))
}
//
Combine sets of questions and get information for users
//
Combine sets of questions and get information for users
$questions
=
qa_any_sort_by_date
(
array_merge
(
$qs
,
$qs_queued
,
$qs_hidden
,
$a_qs
,
$a_queued_qs
,
$a_hidden_qs
,
$c_qs
,
$c_queued_qs
,
$c_hidden_qs
,
$edit_qs
));
...
...
@@ -128,7 +128,7 @@ $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$hostname
=
gethostbyaddr
(
$ip
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/login.php
View file @
2089b48f
...
...
@@ -43,7 +43,7 @@ if (QA_FINAL_EXTERNAL_USERS) {
}
//
Process submitted form after checking we haven't reached rate limit
//
Process submitted form after checking we haven't reached rate limit
$passwordsent
=
qa_get
(
'ps'
);
$emailexists
=
qa_get
(
'ee'
);
...
...
@@ -127,7 +127,7 @@ if (qa_clicked('dologin') && (strlen($inemailhandle) || strlen($inpassword))) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/message.php
View file @
2089b48f
...
...
@@ -37,7 +37,7 @@ $fromhandle = qa_get_logged_in_handle();
$qa_content
=
qa_content_prepare
();
//
Check we have a handle, we're not using Q2A's single-sign on integration and that we're logged in
//
Check we have a handle, we're not using Q2A's single-sign on integration and that we're logged in
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
...
...
@@ -57,7 +57,7 @@ if ($handle === $fromhandle) {
}
//
Find the user profile and their recent private messages
//
Find the user profile and their recent private messages
list
(
$toaccount
,
$torecent
,
$fromrecent
)
=
qa_db_select_with_pending
(
qa_db_user_account_selectspec
(
$handle
,
false
),
...
...
@@ -66,7 +66,7 @@ list($toaccount, $torecent, $fromrecent) = qa_db_select_with_pending(
);
//
Check the user exists and work out what can and can't be set (if not using single sign-on)
//
Check the user exists and work out what can and can't be set (if not using single sign-on)
if
(
!
qa_opt
(
'allow_private_messages'
)
||
!
is_array
(
$toaccount
))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
...
...
@@ -81,7 +81,7 @@ if ($toaccount['flags'] & QA_USER_FLAGS_NO_MESSAGES) {
return
$qa_content
;
}
//
Check that we have permission and haven't reached the limit, but don't quit just yet
//
Check that we have permission and haven't reached the limit, but don't quit just yet
switch
(
qa_user_permit_error
(
null
,
QA_LIMIT_MESSAGES
))
{
case
'limit'
:
...
...
@@ -97,7 +97,7 @@ switch (qa_user_permit_error(null, QA_LIMIT_MESSAGES)) {
}
//
Process sending a message to user
//
Process sending a message to user
// check for messages or errors
$state
=
qa_get_state
();
...
...
@@ -164,7 +164,7 @@ if (qa_post_text('domessage')) {
}
//
Prepare content for theme
//
Prepare content for theme
$hideForm
=
!
empty
(
$pageerror
)
||
$messagesent
;
...
...
@@ -218,7 +218,7 @@ if ($hideForm) {
}
//
If relevant, show recent message history
//
If relevant, show recent message history
if
(
qa_opt
(
'show_message_history'
))
{
$recent
=
array_merge
(
$torecent
,
$fromrecent
);
...
...
qa-include/pages/messages.php
View file @
2089b48f
...
...
@@ -34,7 +34,7 @@ $loginUserId = qa_get_logged_in_userid();
$loginUserHandle
=
qa_get_logged_in_handle
();
//
Check which box we're showing (inbox/sent), we're not using Q2A's single-sign on integration and that we're logged in
//
Check which box we're showing (inbox/sent), we're not using Q2A's single-sign on integration and that we're logged in
$req
=
qa_request_part
(
1
);
if
(
$req
===
null
)
...
...
@@ -57,7 +57,7 @@ if (!qa_opt('allow_private_messages') || !qa_opt('show_message_history'))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
//
Find the messages for this user
//
Find the messages for this user
$start
=
qa_get_start
();
$pagesize
=
qa_opt
(
'page_size_pms'
);
...
...
@@ -71,7 +71,7 @@ list($numMessages, $userMessages) = qa_db_select_with_pending($pmSpecCount, $pmS
$count
=
$numMessages
[
'count'
];
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
qa_lang_html
(
$showOutbox
?
'misc/pm_outbox_title'
:
'misc/pm_inbox_title'
);
...
...
qa-include/pages/question-post.php
View file @
2089b48f
...
...
@@ -32,13 +32,13 @@ require_once QA_INCLUDE_DIR . 'pages/question-submit.php';
$code
=
qa_post_text
(
'code'
);
//
Process general cancel button
//
Process general cancel button
if
(
qa_clicked
(
'docancel'
))
qa_page_q_refresh
(
$pagestart
);
//
Process incoming answer (or button)
//
Process incoming answer (or button)
if
(
$question
[
'answerbutton'
])
{
if
(
qa_clicked
(
'q_doanswer'
))
...
...
@@ -86,7 +86,7 @@ if ($question['answerbutton']) {
}
//
Process close buttons for question
//
Process close buttons for question
if
(
$question
[
'closeable'
])
{
if
(
qa_clicked
(
'q_doclose'
))
...
...
@@ -98,12 +98,12 @@ if ($question['closeable']) {
else
$formtype
=
'q_close'
;
// keep editing if an error
}
elseif
(
(
$pagestate
==
'close'
)
&&
qa_page_q_permit_edit
(
$question
,
'permit_close_q'
,
$pageerror
))
}
elseif
(
$pagestate
==
'close'
&&
qa_page_q_permit_edit
(
$question
,
'permit_close_q'
,
$pageerror
))
$formtype
=
'q_close'
;
}
//
Process any single click operations or delete button for question
//
Process any single click operations or delete button for question
if
(
qa_page_q_single_click_q
(
$question
,
$answers
,
$commentsfollows
,
$closepost
,
$pageerror
))
qa_page_q_refresh
(
$pagestart
);
...
...
@@ -114,7 +114,7 @@ if (qa_clicked('q_dodelete') && $question['deleteable'] && qa_page_q_click_check
}
//
Process edit or save button for question
//
Process edit or save button for question
if
(
$question
[
'editbutton'
]
||
$question
[
'retagcatbutton'
])
{
if
(
qa_clicked
(
'q_doedit'
))
...
...
@@ -140,7 +140,7 @@ if ($question['editbutton'] || $question['retagcatbutton']) {
}
//
Process adding a comment to question (shows form or processes it)
//
Process adding a comment to question (shows form or processes it)
if
(
$question
[
'commentbutton'
])
{
if
(
qa_clicked
(
'q_docomment'
))
...
...
@@ -151,7 +151,7 @@ if ($question['commentbutton']) {
}
//
Process clicked buttons for answers
//
Process clicked buttons for answers
foreach
(
$answers
as
$answerid
=>
$answer
)
{
$prefix
=
'a'
.
$answerid
.
'_'
;
...
...
@@ -198,7 +198,7 @@ foreach ($answers as $answerid => $answer) {
}
//
Process hide, show, delete, flag, unflag, edit or save button for comments
//
Process hide, show, delete, flag, unflag, edit or save button for comments
foreach
(
$commentsfollows
as
$commentid
=>
$comment
)
{
if
(
$comment
[
'basetype'
]
==
'C'
)
{
...
...
@@ -220,7 +220,7 @@ foreach ($commentsfollows as $commentid => $comment) {
$formtype
=
'c_edit'
;
$formpostid
=
$commentid
;
// keep editing if an error
}
}
elseif
(
(
$pagestate
==
(
'edit-'
.
$commentid
)
)
&&
qa_page_q_permit_edit
(
$comment
,
'permit_edit_c'
,
$pageerror
))
{
}
elseif
(
$pagestate
==
(
'edit-'
.
$commentid
)
&&
qa_page_q_permit_edit
(
$comment
,
'permit_edit_c'
,
$pageerror
))
{
$formtype
=
'c_edit'
;
$formpostid
=
$commentid
;
}
...
...
@@ -229,7 +229,7 @@ foreach ($commentsfollows as $commentid => $comment) {
}
//
Functions used above - also see functions in qa-page-question-submit.php (which are shared with Ajax)
//
Functions used above - also see functions in qa-page-question-submit.php (which are shared with Ajax)
/*
Redirects back to the question page, with the specified parameters
...
...
@@ -678,7 +678,7 @@ function qa_page_q_edit_a_form(&$qa_content, $id, $answer, $question, $answers,
),
);
//
Show option to convert this answer to a comment, if appropriate
//
Show option to convert this answer to a comment, if appropriate
$commentonoptions
=
array
();
...
...
@@ -727,7 +727,7 @@ function qa_page_q_edit_a_form(&$qa_content, $id, $answer, $question, $answers,
));
}
//
Show name and notification field if appropriate
//
Show name and notification field if appropriate
if
(
$answer
[
'isbyuser'
])
{
if
(
!
qa_is_logged_in
())
...
...
qa-include/pages/question-submit.php
View file @
2089b48f
...
...
@@ -468,7 +468,7 @@ function qa_page_q_add_c_submit($question, $parent, $commentsfollows, $usecaptch
$testwords
=
implode
(
' '
,
qa_string_to_words
(
$in
[
'content'
]));
foreach
(
$commentsfollows
as
$comment
)
{
if
(
(
$comment
[
'basetype'
]
==
'C'
)
&&
(
$comment
[
'parentid'
]
==
$parentid
)
&&
!
$comment
[
'hidden'
])
{
if
(
$comment
[
'basetype'
]
==
'C'
&&
$comment
[
'parentid'
]
==
$parentid
&&
!
$comment
[
'hidden'
])
{
if
(
implode
(
' '
,
qa_string_to_words
(
$comment
[
'content'
]))
==
$testwords
)
{
$errors
[
'content'
]
=
qa_lang_html
(
'question/duplicate_content'
);
break
;
...
...
qa-include/pages/question.php
View file @
2089b48f
...
...
@@ -40,7 +40,7 @@ $cookieid = qa_cookie_get();
$pagestate
=
qa_get_state
();
//
Get information about this question
//
Get information about this question
$cacheHandler
=
Q2A_Storage_CacheManager
::
getInstance
();
$cacheKey
=
"page:question:
$questionid
"
;
...
...
@@ -103,7 +103,7 @@ if (isset($question)) {
}
}
//
Deal with question not found or not viewable, otherwise report the view event
//
Deal with question not found or not viewable, otherwise report the view event
if
(
!
isset
(
$question
))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
...
...
@@ -153,7 +153,7 @@ if ($permiterror && (qa_is_human_probably() || !qa_opt('allow_view_q_bots'))) {
}
//
Save question data to cache (if older than configured limit)
//
Save question data to cache (if older than configured limit)
if
(
$saveCache
)
{
$questionAge
=
qa_opt
(
'db_time'
)
-
$question
[
'created'
];
...
...
@@ -163,14 +163,14 @@ if ($saveCache) {
}
//
Determine if captchas will be required
//
Determine if captchas will be required
$captchareason
=
qa_user_captcha_reason
(
qa_user_level_for_post
(
$question
));
$usecaptcha
=
(
$captchareason
!=
false
);
//
If we're responding to an HTTP POST, include file that handles all posting/editing/etc... logic
//
This is in a separate file because it's a *lot* of logic, and will slow down ordinary page views
//
If we're responding to an HTTP POST, include file that handles all posting/editing/etc... logic
//
This is in a separate file because it's a *lot* of logic, and will slow down ordinary page views
$pagestart
=
qa_get_start
();
$showid
=
qa_get
(
'show'
);
...
...
@@ -198,20 +198,20 @@ if (qa_is_http_post() || strlen($pagestate))
$formrequested
=
isset
(
$formtype
);
if
(
(
!
$formrequested
)
&&
$question
[
'answerbutton'
])
{
if
(
!
$formrequested
&&
$question
[
'answerbutton'
])
{
$immedoption
=
qa_opt
(
'show_a_form_immediate'
);
if
(
(
$immedoption
==
'always'
)
||
((
$immedoption
==
'if_no_as'
)
&&
(
!
$question
[
'isbyuser'
])
&&
(
!
$question
[
'acount'
])
))
if
(
$immedoption
==
'always'
||
(
$immedoption
==
'if_no_as'
&&
!
$question
[
'isbyuser'
]
&&
!
$question
[
'acount'
]
))
$formtype
=
'a_add'
;
// show answer form by default
}
//
Get information on the users referenced
//
Get information on the users referenced
$usershtml
=
qa_userids_handles_html
(
array_merge
(
array
(
$question
),
$answers
,
$commentsfollows
),
true
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
,
array_keys
(
qa_category_path
(
$categories
,
$question
[
'categoryid'
])));
...
...
@@ -233,7 +233,7 @@ if ($question['hidden'])
qa_sort_by
(
$commentsfollows
,
'created'
);
//
Prepare content for the question...
//
Prepare content for the question...
if
(
$formtype
==
'q_edit'
)
{
// ...in edit mode
$qa_content
[
'title'
]
=
qa_lang_html
(
$question
[
'editable'
]
?
'question/edit_q_title'
:
...
...
@@ -264,7 +264,7 @@ if ($microdata) {
}
//
Prepare content for an answer being edited (if any) or to be added
//
Prepare content for an answer being edited (if any) or to be added
if
(
$formtype
==
'a_edit'
)
{
$qa_content
[
'a_form'
]
=
qa_page_q_edit_a_form
(
$qa_content
,
'a'
.
$formpostid
,
$answers
[
$formpostid
],
...
...
@@ -275,7 +275,7 @@ if ($formtype == 'a_edit') {
$jumptoanchor
=
'a'
.
$formpostid
;
}
elseif
(
(
$formtype
==
'a_add'
)
||
(
$question
[
'answerbutton'
]
&&
!
$formrequested
))
{
}
elseif
(
$formtype
==
'a_add'
||
(
$question
[
'answerbutton'
]
&&
!
$formrequested
))
{
$qa_content
[
'a_form'
]
=
qa_page_q_add_a_form
(
$qa_content
,
'anew'
,
$captchareason
,
$question
,
@
$anewin
,
@
$anewerrors
,
$formtype
==
'a_add'
,
$formrequested
);
if
(
$formrequested
)
{
...
...
@@ -288,22 +288,22 @@ if ($formtype == 'a_edit') {
}
//
Prepare content for comments on the question, plus add or edit comment forms
//
Prepare content for comments on the question, plus add or edit comment forms
if
(
$formtype
==
'q_close'
)
{
$qa_content
[
'q_view'
][
'c_form'
]
=
qa_page_q_close_q_form
(
$qa_content
,
$question
,
'close'
,
@
$closein
,
@
$closeerrors
);
$jumptoanchor
=
'close'
;
}
elseif
((
(
$formtype
==
'c_add'
)
&&
(
$formpostid
==
$questionid
)
)
||
(
$question
[
'commentbutton'
]
&&
!
$formrequested
))
{
// ...to be added
}
elseif
((
$formtype
==
'c_add'
&&
$formpostid
==
$questionid
)
||
(
$question
[
'commentbutton'
]
&&
!
$formrequested
))
{
// ...to be added
$qa_content
[
'q_view'
][
'c_form'
]
=
qa_page_q_add_c_form
(
$qa_content
,
$question
,
$question
,
'c'
.
$questionid
,
$captchareason
,
@
$cnewin
[
$questionid
],
@
$cnewerrors
[
$questionid
],
$formtype
==
'c_add'
);
if
(
(
$formtype
==
'c_add'
)
&&
(
$formpostid
==
$questionid
)
)
{
if
(
$formtype
==
'c_add'
&&
$formpostid
==
$questionid
)
{
$jumptoanchor
=
'c'
.
$questionid
;
$commentsall
=
$questionid
;
}
}
elseif
(
(
$formtype
==
'c_edit'
)
&&
(
@
$commentsfollows
[
$formpostid
][
'parentid'
]
==
$questionid
)
)
{
// ...being edited
}
elseif
(
$formtype
==
'c_edit'
&&
@
$commentsfollows
[
$formpostid
][
'parentid'
]
==
$questionid
)
{
// ...being edited
$qa_content
[
'q_view'
][
'c_form'
]
=
qa_page_q_edit_c_form
(
$qa_content
,
'c'
.
$formpostid
,
$commentsfollows
[
$formpostid
],
@
$ceditin
[
$formpostid
],
@
$cediterrors
[
$formpostid
]);
...
...
@@ -315,7 +315,7 @@ $qa_content['q_view']['c_list'] = qa_page_q_comment_follow_list($question, $ques
$commentsall
==
$questionid
,
$usershtml
,
$formrequested
,
$formpostid
);
// ...for viewing
//
Prepare content for existing answers (could be added to by Ajax)
//
Prepare content for existing answers (could be added to by Ajax)
$qa_content
[
'a_list'
]
=
array
(
'tags'
=>
'id="a_list"'
,
...
...
@@ -393,7 +393,7 @@ foreach ($answerids as $answerid) {
if
(
!
(
$formtype
==
'a_edit'
&&
$formpostid
==
$answerid
))
{
$a_view
=
qa_page_q_answer_view
(
$question
,
$answer
,
$answer
[
'isselected'
],
$usershtml
,
$formrequested
);
//
Prepare content for comments on this answer, plus add or edit comment forms
//
Prepare content for comments on this answer, plus add or edit comment forms
if
((
$formtype
==
'c_add'
&&
$formpostid
==
$answerid
)
||
(
$answer
[
'commentbutton'
]
&&
!
$formrequested
))
{
// ...to be added
$a_view
[
'c_form'
]
=
qa_page_q_add_c_form
(
$qa_content
,
$question
,
$answer
,
'c'
.
$answerid
,
...
...
@@ -415,7 +415,7 @@ foreach ($answerids as $answerid) {
$a_view
[
'c_list'
]
=
qa_page_q_comment_follow_list
(
$question
,
$answer
,
$commentsfollows
,
$commentsall
==
$answerid
,
$usershtml
,
$formrequested
,
$formpostid
);
// ...for viewing
//
Add the answer to the list
//
Add the answer to the list
$qa_content
[
'a_list'
][
'as'
][]
=
$a_view
;
}
...
...
@@ -441,7 +441,7 @@ if (!$formrequested)
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$pagestart
,
$pagesize
,
$countforpages
,
qa_opt
(
'pages_prev_next'
),
array
(),
false
,
'a_list_title'
);
//
Some generally useful stuff
//
Some generally useful stuff
if
(
qa_using_categories
()
&&
count
(
$categories
))
$qa_content
[
'navigation'
][
'cat'
]
=
qa_category_navigation
(
$categories
,
$question
[
'categoryid'
]);
...
...
@@ -452,8 +452,8 @@ if (isset($jumptoanchor))
);
//
Determine whether this request should be counted for page view statistics.
//
The lastviewip check is now in the hotness query in order to bypass caching.
//
Determine whether this request should be counted for page view statistics.
//
The lastviewip check is now in the hotness query in order to bypass caching.
if
(
qa_opt
(
'do_count_q_views'
)
&&
...
...
@@ -470,8 +470,3 @@ if (
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
qa-include/pages/questions.php
View file @
2089b48f
...
...
@@ -37,7 +37,7 @@ $start = qa_get_start();
$userid
=
qa_get_logged_in_userid
();
//
Get list of questions, plus category information
//
Get list of questions, plus category information
switch
(
$sort
)
{
case
'hot'
:
...
...
@@ -110,7 +110,7 @@ switch ($sort) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
$qa_content
=
qa_q_list_page_content
(
$questions
,
// questions
...
...
qa-include/pages/register.php
View file @
2089b48f
...
...
@@ -46,7 +46,7 @@ if (QA_FINAL_EXTERNAL_USERS) {
}
//
Get information about possible additional fields
//
Get information about possible additional fields
$show_terms
=
qa_opt
(
'show_register_terms'
);
...
...
@@ -60,7 +60,7 @@ foreach ($userfields as $index => $userfield) {
}
//
Check we haven't suspended registration, and this IP isn't blocked
//
Check we haven't suspended registration, and this IP isn't blocked
if
(
qa_opt
(
'suspend_register_users'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -75,7 +75,7 @@ if (qa_user_permit_error()) {
}
//
Process submitted form
//
Process submitted form
if
(
qa_clicked
(
'doregister'
))
{
require_once
QA_INCLUDE_DIR
.
'app/limits.php'
;
...
...
@@ -140,7 +140,7 @@ if (qa_clicked('doregister')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/reset.php
View file @
2089b48f
...
...
@@ -25,7 +25,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
exit
;
}
//
Check we're not using single-sign on integration and that we're not logged in
//
Check we're not using single-sign on integration and that we're not logged in
if
(
QA_FINAL_EXTERNAL_USERS
)
{
qa_fatal_error
(
'User login is handled by external code'
);
...
...
@@ -167,7 +167,7 @@ if (strlen($emailHandle) > 0) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/search.php
View file @
2089b48f
...
...
@@ -30,11 +30,11 @@ require_once QA_INCLUDE_DIR . 'app/options.php';
require_once
QA_INCLUDE_DIR
.
'app/search.php'
;
//
Perform the search if appropriate
//
Perform the search if appropriate
if
(
strlen
(
qa_get
(
'q'
)))
{
//
Pull in input parameters
//
Pull in input parameters
$inquery
=
trim
(
qa_get
(
'q'
));
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -44,17 +44,17 @@ if (strlen(qa_get('q'))) {
$count
=
2
*
(
isset
(
$display
)
?
$display
:
QA_DB_RETRIEVE_QS_AS
)
+
1
;
// get enough results to be able to give some idea of how many pages of search results there are
//
Perform the search using appropriate module
//
Perform the search using appropriate module
$results
=
qa_get_search_results
(
$inquery
,
$start
,
$count
,
$userid
,
false
,
false
);
//
Count and truncate results
//
Count and truncate results
$pagesize
=
qa_opt
(
'page_size_search'
);
$gotcount
=
count
(
$results
);
$results
=
array_slice
(
$results
,
0
,
$pagesize
);
//
Retrieve extra information on users
//
Retrieve extra information on users
$fullquestions
=
array
();
...
...
@@ -65,7 +65,7 @@ if (strlen(qa_get('q'))) {
$usershtml
=
qa_userids_handles_html
(
$fullquestions
);
//
Report the search event
//
Report the search event
qa_report_event
(
'search'
,
$userid
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
array
(
'query'
=>
$inquery
,
...
...
@@ -74,7 +74,7 @@ if (strlen(qa_get('q'))) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
...
...
qa-include/pages/tag.php
View file @
2089b48f
...
...
@@ -34,7 +34,7 @@ $start = qa_get_start();
$userid
=
qa_get_logged_in_userid
();
//
Find the questions with this tag
//
Find the questions with this tag
if
(
!
strlen
(
$tag
))
qa_redirect
(
'tags'
);
...
...
@@ -49,7 +49,7 @@ $questions = array_slice($questions, 0, $pagesize);
$usershtml
=
qa_userids_handles_html
(
$questions
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
...
...
qa-include/pages/tags.php
View file @
2089b48f
...
...
@@ -29,7 +29,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Get popular tags
//
Get popular tags
$start
=
qa_get_start
();
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -41,7 +41,7 @@ $tagcount = qa_opt('cache_tagcount');
$pagesize
=
qa_opt
(
'page_size_tags'
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/unanswered.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'app/format.php';
require_once
QA_INCLUDE_DIR
.
'app/q-list.php'
;
//
Get list of unanswered questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php
//
Get list of unanswered questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php
if
(
QA_ALLOW_UNINDEXED_QUERIES
)
$categoryslugs
=
qa_request_parts
(
1
);
...
...
@@ -114,7 +114,7 @@ switch ($by) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
$qa_content
=
qa_q_list_page_content
(
$questions
,
// questions
...
...
qa-include/pages/unsubscribe.php
View file @
2089b48f
...
...
@@ -28,13 +28,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
//
Check we're not using single-sign on integration
//
Check we're not using single-sign on integration
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User login is handled by external code'
);
//
Check the code and unsubscribe the user if appropriate
//
Check the code and unsubscribe the user if appropriate
$unsubscribed
=
false
;
$loginuserid
=
qa_get_logged_in_userid
();
...
...
@@ -51,13 +51,13 @@ if (!empty($inhandle)) { // match based on code and handle provided on URL
}
}
if
(
(
!
$unsubscribed
)
&&
isset
(
$loginuserid
))
{
// as a backup, also unsubscribe logged in user
if
(
!
$unsubscribed
&&
isset
(
$loginuserid
))
{
// as a backup, also unsubscribe logged in user
qa_db_user_set_flag
(
$loginuserid
,
QA_USER_FLAGS_NO_MAILINGS
,
true
);
$unsubscribed
=
true
;
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/updates.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'app/format.php';
require_once
QA_INCLUDE_DIR
.
'app/q-list.php'
;
//
Check that we're logged in
//
Check that we're logged in
$userid
=
qa_get_logged_in_userid
();
...
...
@@ -38,13 +38,13 @@ if (!isset($userid))
qa_redirect
(
'login'
);
//
Find out which updates to show
//
Find out which updates to show
$forfavorites
=
qa_get
(
'show'
)
!=
'content'
;
$forcontent
=
qa_get
(
'show'
)
!=
'favorites'
;
//
Get lists of recent updates for this user
//
Get lists of recent updates for this user
$questions
=
qa_db_select_with_pending
(
qa_db_user_updates_selectspec
(
$userid
,
$forfavorites
,
$forcontent
)
...
...
@@ -66,7 +66,7 @@ if ($forfavorites) {
}
//
Prepare and return content for theme
//
Prepare and return content for theme
$qa_content
=
qa_q_list_page_content
(
qa_any_sort_and_dedupe
(
$questions
),
...
...
qa-include/pages/user-activity.php
View file @
2089b48f
...
...
@@ -29,10 +29,10 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//
Find the recent activity for this user
//
Find the recent activity for this user
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
...
...
@@ -49,14 +49,14 @@ if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) // check the user exist
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
//
Get information on user references
//
Get information on user references
$questions
=
qa_any_sort_and_dedupe
(
array_merge
(
$questions
,
$answerqs
,
$commentqs
,
$editqs
));
$questions
=
array_slice
(
$questions
,
0
,
qa_opt
(
'page_size_activity'
));
$usershtml
=
qa_userids_handles_html
(
qa_any_get_userids_handles
(
$questions
),
false
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
...
...
@@ -66,7 +66,7 @@ else
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_posts_by_x'
,
$userhtml
);
//
Recent activity by this user
//
Recent activity by this user
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
...
...
@@ -89,7 +89,7 @@ foreach ($questions as $question) {
}
//
Sub menu for navigation in user pages
//
Sub menu for navigation in user pages
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'activity'
,
$ismyuser
);
...
...
qa-include/pages/user-answers.php
View file @
2089b48f
...
...
@@ -29,12 +29,12 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
$start
=
qa_get_start
();
//
Find the questions for this user
//
Find the questions for this user
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
...
...
@@ -49,7 +49,7 @@ if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) // check the user exist
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
//
Get information on user questions
//
Get information on user questions
$pagesize
=
qa_opt
(
'page_size_activity'
);
$count
=
(
int
)
@
$userpoints
[
'aposts'
];
...
...
@@ -57,7 +57,7 @@ $questions = array_slice($questions, 0, $pagesize);
$usershtml
=
qa_userids_handles_html
(
$questions
,
false
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
...
...
@@ -67,7 +67,7 @@ else
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_answers_by_x'
,
$userhtml
);
//
Recent questions by this user
//
Recent questions by this user
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
...
...
@@ -96,7 +96,7 @@ foreach ($questions as $question) {
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
//
Sub menu for navigation in user pages
//
Sub menu for navigation in user pages
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'answers'
,
$ismyuser
);
...
...
qa-include/pages/user-profile.php
View file @
2089b48f
...
...
@@ -31,16 +31,16 @@ require_once QA_INCLUDE_DIR . 'app/limits.php';
require_once
QA_INCLUDE_DIR
.
'app/updates.php'
;
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//
Redirect to 'My Account' page if button clicked
//
Redirect to 'My Account' page if button clicked
if
(
qa_clicked
(
'doaccount'
))
qa_redirect
(
'account'
);
//
Find the user profile and questions and answers for this handle
//
Find the user profile and questions and answers for this handle
$loginuserid
=
qa_get_logged_in_userid
();
...
...
@@ -66,7 +66,7 @@ if (!QA_FINAL_EXTERNAL_USERS && $handle !== qa_get_logged_in_handle()) {
}
//
Check the user exists and work out what can and can't be set (if not using single sign-on)
//
Check the user exists and work out what can and can't be set (if not using single sign-on)
$errors
=
array
();
...
...
@@ -75,7 +75,7 @@ $loginlevel = qa_get_logged_in_level();
if
(
!
QA_FINAL_EXTERNAL_USERS
)
{
// if we're using integrated user management, we can know and show more
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
if
(
(
!
is_array
(
$userpoints
)
)
&&
!
is_array
(
$useraccount
))
if
(
!
is_array
(
$userpoints
)
&&
!
is_array
(
$useraccount
))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
$userid
=
$useraccount
[
'userid'
];
...
...
@@ -115,7 +115,7 @@ if (!QA_FINAL_EXTERNAL_USERS) { // if we're using integrated user management, we
$wallposterrorhtml
=
qa_wall_error_html
(
$loginuserid
,
$useraccount
[
'userid'
],
$useraccount
[
'flags'
]);
//
This code is similar but not identical to that in to qq-page-user-wall.php
//
This code is similar but not identical to that in to qq-page-user-wall.php
$usermessages
=
array_slice
(
$usermessages
,
0
,
qa_opt
(
'page_size_wall'
));
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
0
);
...
...
@@ -133,7 +133,7 @@ if (!QA_FINAL_EXTERNAL_USERS) { // if we're using integrated user management, we
}
//
Process edit or save button for user, and other actions
//
Process edit or save button for user, and other actions
if
(
!
QA_FINAL_EXTERNAL_USERS
)
{
$reloaduser
=
false
;
...
...
@@ -313,7 +313,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Process bonus setting button
//
Process bonus setting button
if
(
$loginlevel
>=
QA_USER_LEVEL_ADMIN
&&
qa_clicked
(
'dosetbonus'
))
{
require_once
QA_INCLUDE_DIR
.
'db/points.php'
;
...
...
@@ -330,7 +330,7 @@ if ($loginlevel >= QA_USER_LEVEL_ADMIN && qa_clicked('dosetbonus')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -348,7 +348,7 @@ if (isset($loginuserid) && $loginuserid != $useraccount['userid'] && !QA_FINAL_E
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-user.js?'
.
QA_VERSION
;
//
General information about the user, only available if we're using internal user management
//
General information about the user, only available if we're using internal user management
if
(
!
QA_FINAL_EXTERNAL_USERS
)
{
$membertime
=
qa_time_to_string
(
qa_opt
(
'db_time'
)
-
$useraccount
[
'created'
]);
...
...
@@ -393,7 +393,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
unset
(
$qa_content
[
'form_profile'
][
'fields'
][
'avatar'
]);
//
Private message link
//
Private message link
if
(
qa_opt
(
'allow_private_messages'
)
&&
isset
(
$loginuserid
)
&&
$loginuserid
!=
$userid
&&
!
(
$useraccount
[
'flags'
]
&
QA_USER_FLAGS_NO_MESSAGES
)
&&
!
$userediting
)
{
$qa_content
[
'form_profile'
][
'fields'
][
'level'
][
'value'
]
.=
strtr
(
qa_lang_html
(
'profile/send_private_message'
),
array
(
...
...
@@ -403,7 +403,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Levels editing or viewing (add category-specific levels)
//
Levels editing or viewing (add category-specific levels)
if
(
$userediting
)
{
...
...
@@ -430,12 +430,12 @@ if (!QA_FINAL_EXTERNAL_USERS) {
$qa_content
[
'form_profile'
][
'fields'
][
'level'
][
'options'
]
=
$leveloptions
;
//
Category-specific levels
//
Category-specific levels
if
(
qa_using_categories
())
{
$catleveladd
=
strlen
(
qa_get
(
'catleveladd'
))
>
0
;
if
(
(
!
$catleveladd
)
&&
!
count
(
$userlevels
))
{
if
(
!
$catleveladd
&&
!
count
(
$userlevels
))
{
$qa_content
[
'form_profile'
][
'fields'
][
'level'
][
'suffix'
]
=
strtr
(
qa_lang_html
(
'users/category_level_add'
),
array
(
'^1'
=>
'<a href="'
.
qa_path_html
(
qa_request
(),
array
(
'state'
=>
'edit'
,
'catleveladd'
=>
1
))
.
'">'
,
'^2'
=>
'</a>'
,
...
...
@@ -518,7 +518,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Show any extra privileges due to user's level or their points
//
Show any extra privileges due to user's level or their points
$showpermits
=
array
();
$permitoptions
=
qa_get_permit_options
();
...
...
@@ -547,7 +547,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Show email address only if we're an administrator
//
Show email address only if we're an administrator
if
(
$loginlevel
>=
QA_USER_LEVEL_ADMIN
&&
!
qa_user_permit_error
())
{
$doconfirms
=
qa_opt
(
'confirm_user_emails'
)
&&
$useraccount
[
'level'
]
<
QA_USER_LEVEL_EXPERT
;
...
...
@@ -567,7 +567,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Show IP addresses and times for last login or write - only if we're a moderator or higher
//
Show IP addresses and times for last login or write - only if we're a moderator or higher
if
(
$loginlevel
>=
QA_USER_LEVEL_MODERATOR
&&
!
qa_user_permit_error
())
{
$qa_content
[
'form_profile'
][
'fields'
][
'lastlogin'
]
=
array
(
...
...
@@ -600,7 +600,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Show other profile fields
//
Show other profile fields
$fieldsediting
=
$fieldseditable
&&
$userediting
;
...
...
@@ -644,7 +644,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Edit form or button, if appropriate
//
Edit form or button, if appropriate
if
(
$userediting
)
{
if
(
...
...
@@ -741,7 +741,7 @@ if (!QA_FINAL_EXTERNAL_USERS) {
}
//
Information about user activity, available also with single sign-on integration
//
Information about user activity, available also with single sign-on integration
$qa_content
[
'form_activity'
]
=
array
(
'title'
=>
'<a name="activity">'
.
qa_lang_html_sub
(
'profile/activity_by_x'
,
$userhtml
)
.
'</a>'
,
...
...
@@ -898,14 +898,14 @@ if (@$userpoints['aselecteds']) {
}
//
For plugin layers to access
//
For plugin layers to access
$qa_content
[
'raw'
][
'userid'
]
=
$userid
;
$qa_content
[
'raw'
][
'points'
]
=
$userpoints
;
$qa_content
[
'raw'
][
'rank'
]
=
$userrank
;
//
Wall posts
//
Wall posts
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
qa_opt
(
'allow_user_walls'
))
{
$qa_content
[
'message_list'
]
=
array
(
...
...
@@ -955,7 +955,7 @@ if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) {
}
//
Sub menu for navigation in user pages
//
Sub menu for navigation in user pages
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'profile'
,
$ismyuser
);
...
...
qa-include/pages/user-questions.php
View file @
2089b48f
...
...
@@ -29,12 +29,12 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//
$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
$start
=
qa_get_start
();
//
Find the questions for this user
//
Find the questions for this user
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
...
...
@@ -49,7 +49,7 @@ if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) // check the user exist
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
//
Get information on user questions
//
Get information on user questions
$pagesize
=
qa_opt
(
'page_size_qs'
);
$count
=
(
int
)
@
$userpoints
[
'qposts'
];
...
...
@@ -57,7 +57,7 @@ $questions = array_slice($questions, 0, $pagesize);
$usershtml
=
qa_userids_handles_html
(
$questions
,
false
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
...
...
@@ -67,7 +67,7 @@ else
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_questions_by_x'
,
$userhtml
);
//
Recent questions by this user
//
Recent questions by this user
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
...
...
@@ -91,7 +91,7 @@ foreach ($questions as $question) {
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
//
Sub menu for navigation in user pages
//
Sub menu for navigation in user pages
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'questions'
,
$ismyuser
);
...
...
qa-include/pages/user-wall.php
View file @
2089b48f
...
...
@@ -29,18 +29,18 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
//
Check we're not using single-sign on integration, which doesn't allow walls
//
Check we're not using single-sign on integration, which doesn't allow walls
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
//
$handle, $userhtml are already set by qa-page-user.php
//
$handle, $userhtml are already set by qa-page-user.php
$start
=
qa_get_start
();
//
Find the questions for this user
//
Find the questions for this user
list
(
$useraccount
,
$usermessages
)
=
qa_db_select_with_pending
(
qa_db_user_account_selectspec
(
$handle
,
false
),
...
...
@@ -51,7 +51,7 @@ if (!is_array($useraccount)) // check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
//
Perform pagination
//
Perform pagination
$pagesize
=
qa_opt
(
'page_size_wall'
);
$count
=
$useraccount
[
'wallposts'
];
...
...
@@ -61,7 +61,7 @@ $usermessages = array_slice($usermessages, 0, $pagesize);
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
$start
);
//
Process deleting or adding a wall post (similar but not identical code to qq-page-user-profile.php)
//
Process deleting or adding a wall post (similar but not identical code to qq-page-user-profile.php)
$errors
=
array
();
...
...
@@ -92,7 +92,7 @@ if (qa_clicked('dowallpost')) {
}
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
@@ -147,7 +147,7 @@ foreach ($usermessages as $message) {
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
//
Sub menu for navigation in user pages
//
Sub menu for navigation in user pages
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'wall'
,
$ismyuser
);
...
...
qa-include/pages/user.php
View file @
2089b48f
...
...
@@ -26,7 +26,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
}
//
Determine the identify of the user
//
Determine the identify of the user
$handle
=
qa_request_part
(
1
);
...
...
@@ -36,7 +36,7 @@ if (!strlen($handle)) {
}
//
Get the HTML to display for the handle, and if we're using external users, determine the userid
//
Get the HTML to display for the handle, and if we're using external users, determine the userid
if
(
QA_FINAL_EXTERNAL_USERS
)
{
$userid
=
qa_handle_to_userid
(
$handle
);
...
...
@@ -50,7 +50,7 @@ if (QA_FINAL_EXTERNAL_USERS) {
$userhtml
=
qa_html
(
$handle
);
//
Display the appropriate page based on the request
//
Display the appropriate page based on the request
switch
(
qa_request_part
(
2
))
{
case
'wall'
:
...
...
qa-include/pages/users-blocked.php
View file @
2089b48f
...
...
@@ -30,13 +30,13 @@ require_once QA_INCLUDE_DIR . 'app/users.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Check we're not using single-sign on integration
//
Check we're not using single-sign on integration
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
//
Get list of blocked users
//
Get list of blocked users
$start
=
qa_get_start
();
$pagesize
=
qa_opt
(
'page_size_users'
);
...
...
@@ -48,7 +48,7 @@ list($numUsers, $users) = qa_db_select_with_pending($userSpecCount, $userSpec);
$count
=
$numUsers
[
'count'
];
//
Check we have permission to view this page (moderator or above)
//
Check we have permission to view this page (moderator or above)
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_MODERATOR
)
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -57,12 +57,12 @@ if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
}
//
Get userids and handles of retrieved users
//
Get userids and handles of retrieved users
$usershtml
=
qa_userids_handles_html
(
$users
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/users-newest.php
View file @
2089b48f
...
...
@@ -28,13 +28,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Check we're not using single-sign on integration
//
Check we're not using single-sign on integration
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
//
Check we have permission to view this page (moderator or above)
//
Check we have permission to view this page (moderator or above)
if
(
qa_user_permit_error
(
'permit_view_new_users_page'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -43,7 +43,7 @@ if (qa_user_permit_error('permit_view_new_users_page')) {
}
//
Get list of all users
//
Get list of all users
$start
=
qa_get_start
();
$users
=
qa_db_select_with_pending
(
qa_db_newest_users_selectspec
(
$start
,
qa_opt_if_loaded
(
'page_size_users'
)));
...
...
@@ -53,7 +53,7 @@ $pageSize = qa_opt('page_size_users');
$users
=
array_slice
(
$users
,
0
,
$pageSize
);
$usersHtml
=
qa_userids_handles_html
(
$users
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/users-special.php
View file @
2089b48f
...
...
@@ -30,18 +30,18 @@ require_once QA_INCLUDE_DIR . 'app/users.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Check we're not using single-sign on integration
//
Check we're not using single-sign on integration
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
//
Get list of special users
//
Get list of special users
$users
=
qa_db_select_with_pending
(
qa_db_users_from_level_selectspec
(
QA_USER_LEVEL_EXPERT
));
//
Check we have permission to view this page (moderator or above)
//
Check we have permission to view this page (moderator or above)
if
(
qa_user_permit_error
(
'permit_view_special_users_page'
))
{
$qa_content
=
qa_content_prepare
();
...
...
@@ -50,12 +50,12 @@ if (qa_user_permit_error('permit_view_special_users_page')) {
}
//
Get userids and handles of retrieved users
//
Get userids and handles of retrieved users
$usershtml
=
qa_userids_handles_html
(
$users
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/pages/users.php
View file @
2089b48f
...
...
@@ -30,7 +30,7 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
//
Get list of all users
//
Get list of all users
$start
=
qa_get_start
();
$users
=
qa_db_select_with_pending
(
qa_db_top_users_selectspec
(
$start
,
qa_opt_if_loaded
(
'page_size_users'
)));
...
...
@@ -41,7 +41,7 @@ $users = array_slice($users, 0, $pagesize);
$usershtml
=
qa_userids_handles_html
(
$users
);
//
Prepare content for theme
//
Prepare content for theme
$qa_content
=
qa_content_prepare
();
...
...
qa-include/qa-base.php
View file @
2089b48f
...
...
@@ -1843,7 +1843,7 @@ function qa_suspend_event_reports($suspend = true)
* @param array $params
* @return mixed|void
*/
function
qa_report_event
(
$event
,
$userid
,
$handle
,
$cookieid
,
$params
=
array
())
function
qa_report_event
(
$event
,
$userid
,
$handle
,
$cookieid
,
$params
=
array
())
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
...
...
qa-include/qa-check-lang.php
View file @
2089b48f
This diff is collapsed.
Click to expand it.
qa-include/qa-install.php
View file @
2089b48f
...
...
@@ -40,7 +40,7 @@ if (!function_exists('qa_install_db_fail_handler')) {
* @param string $error
* @param string $query
*/
function
qa_install_db_fail_handler
(
$type
,
$errno
=
null
,
$error
=
null
,
$query
=
null
)
function
qa_install_db_fail_handler
(
$type
,
$errno
=
null
,
$error
=
null
,
$query
=
null
)
{
global
$pass_failure_from_install
;
...
...
@@ -94,7 +94,7 @@ if (!isset($pass_failure_type) && qa_clicked('super')) {
}
//
Output start of HTML early, so we can see a nicely-formatted list of database queries when upgrading
//
Output start of HTML early, so we can see a nicely-formatted list of database queries when upgrading
?><!DOCTYPE html>
<html>
...
...
@@ -330,7 +330,7 @@ if (strlen($suggest))
echo
'<p>'
.
$suggest
.
'</p>'
;
//
Very simple general form display logic (we don't use theme since it depends on tons of DB options)
//
Very simple general form display logic (we don't use theme since it depends on tons of DB options)
if
(
count
(
$fields
))
{
echo
'<table>'
;
...
...
qa-include/qa-page.php
View file @
2089b48f
...
...
@@ -28,7 +28,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
require_once
QA_INCLUDE_DIR
.
'app/page.php'
;
//
Below are the steps that actually execute for this file - all the above are function definitions
//
Below are the steps that actually execute for this file - all the above are function definitions
global
$qa_usage
;
...
...
qa-include/qa-theme-base.php
View file @
2089b48f
...
...
@@ -244,10 +244,10 @@ class qa_html_theme_base
}
//
From here on, we have a large number of class methods which output particular pieces of HTML markup
//
The calling chain is initiated from qa-page.php, or qa-ajax-*.php for refreshing parts of a page,
//
For most HTML elements, the name of the function is similar to the element's CSS class, for example:
//
search() outputs <div class="qa-search">, q_list() outputs <div class="qa-q-list">, etc...
//
From here on, we have a large number of class methods which output particular pieces of HTML markup
//
The calling chain is initiated from qa-page.php, or qa-ajax-*.php for refreshing parts of a page,
//
For most HTML elements, the name of the function is similar to the element's CSS class, for example:
//
search() outputs <div class="qa-search">, q_list() outputs <div class="qa-q-list">, etc...
public
function
doctype
()
{
...
...
qa-include/util/image.php
View file @
2089b48f
...
...
@@ -127,7 +127,7 @@ function qa_image_constrain(&$width, &$height, $maxwidth, $maxheight = null)
if
(
!
isset
(
$maxheight
))
$maxheight
=
$maxwidth
;
if
(
(
$width
>
$maxwidth
)
||
(
$height
>
$maxheight
)
)
{
if
(
$width
>
$maxwidth
||
$height
>
$maxheight
)
{
$multiplier
=
min
(
$maxwidth
/
$width
,
$maxheight
/
$height
);
$width
=
floor
(
$width
*
$multiplier
);
$height
=
floor
(
$height
*
$multiplier
);
...
...
qa-plugin/facebook-login/qa-facebook-login.php
View file @
2089b48f
...
...
@@ -52,7 +52,7 @@ class qa_facebook_login
public
function
facebook_html
(
$tourl
,
$logout
,
$context
)
{
if
(
(
$context
==
'login'
)
||
(
$context
==
'register'
)
)
if
(
$context
==
'login'
||
$context
==
'register'
)
$size
=
'large'
;
else
$size
=
'medium'
;
...
...
qa-plugin/xml-sitemap/qa-xml-sitemap.php
View file @
2089b48f
...
...
@@ -173,7 +173,7 @@ class qa_xml_sitemap
// User pages
if
(
(
!
QA_FINAL_EXTERNAL_USERS
)
&&
qa_opt
(
'xml_sitemap_show_users'
))
{
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
qa_opt
(
'xml_sitemap_show_users'
))
{
$nextuserid
=
0
;
while
(
1
)
{
...
...
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