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
e6f8efb5
Commit
e6f8efb5
authored
Jul 15, 2016
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (user profile pages)
parent
e449b233
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
224 additions
and
275 deletions
+224
-275
user-activity.php
qa-include/pages/user-activity.php
+29
-35
user-answers.php
qa-include/pages/user-answers.php
+33
-39
user-profile.php
qa-include/pages/user-profile.php
+0
-0
user-questions.php
qa-include/pages/user-questions.php
+31
-37
user-wall.php
qa-include/pages/user-wall.php
+45
-54
user.php
qa-include/pages/user.php
+18
-24
users-blocked.php
qa-include/pages/users-blocked.php
+25
-31
users-special.php
qa-include/pages/users-special.php
+19
-25
users.php
qa-include/pages/users.php
+24
-30
No files found.
qa-include/pages/user-activity.php
View file @
e6f8efb5
...
...
@@ -20,13 +20,13 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
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
...
...
@@ -34,70 +34,65 @@
// Find the recent activity for this user
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
list
(
$useraccount
,
$questions
,
$answerqs
,
$commentqs
,
$editqs
)
=
qa_db_select_with_pending
(
list
(
$useraccount
,
$questions
,
$answerqs
,
$commentqs
,
$editqs
)
=
qa_db_select_with_pending
(
QA_FINAL_EXTERNAL_USERS
?
null
:
qa_db_user_account_selectspec
(
$handle
,
false
),
qa_db_user_recent_qs_selectspec
(
$loginuserid
,
$identifier
,
qa_opt_if_loaded
(
'page_size_activity'
)),
qa_db_user_recent_a_qs_selectspec
(
$loginuserid
,
$identifier
),
qa_db_user_recent_c_qs_selectspec
(
$loginuserid
,
$identifier
),
qa_db_user_recent_edit_qs_selectspec
(
$loginuserid
,
$identifier
)
);
);
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
// 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
);
$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
$qa_content
=
qa_content_prepare
(
true
);
$qa_content
=
qa_content_prepare
(
true
);
if
(
count
(
$questions
))
if
(
count
(
$questions
))
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/recent_activity_by_x'
,
$userhtml
);
else
else
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_posts_by_x'
,
$userhtml
);
// Recent activity by this user
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
'hidden'
=>
array
(
'code'
=>
qa_get_form_security_code
(
'vote'
),
),
);
);
$qa_content
[
'q_list'
][
'qs'
]
=
array
();
$qa_content
[
'q_list'
][
'qs'
]
=
array
();
$htmldefaults
=
qa_post_html_defaults
(
'Q'
);
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'voteview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
$htmldefaults
=
qa_post_html_defaults
(
'Q'
);
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'voteview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
foreach
(
$questions
as
$question
)
{
foreach
(
$questions
as
$question
)
{
$qa_content
[
'q_list'
][
'qs'
][]
=
qa_any_to_q_html_fields
(
$question
,
$loginuserid
,
qa_cookie_get
(),
$usershtml
,
null
,
array
(
'voteview'
=>
false
)
+
qa_post_html_options
(
$question
,
$htmldefaults
));
}
}
// 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
);
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'activity'
,
$ismyuser
);
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/user-answers.php
View file @
e6f8efb5
...
...
@@ -20,91 +20,86 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
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
$start
=
qa_get_start
();
$start
=
qa_get_start
();
// Find the questions for this user
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
list
(
$useraccount
,
$userpoints
,
$questions
)
=
qa_db_select_with_pending
(
list
(
$useraccount
,
$userpoints
,
$questions
)
=
qa_db_select_with_pending
(
QA_FINAL_EXTERNAL_USERS
?
null
:
qa_db_user_account_selectspec
(
$handle
,
false
),
qa_db_user_points_selectspec
(
$identifier
),
qa_db_user_recent_a_qs_selectspec
(
$loginuserid
,
$identifier
,
qa_opt_if_loaded
(
'page_size_activity'
),
$start
)
);
);
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
// Get information on user questions
$pagesize
=
qa_opt
(
'page_size_activity'
);
$count
=
(
int
)
@
$userpoints
[
'aposts'
];
$questions
=
array_slice
(
$questions
,
0
,
$pagesize
);
$usershtml
=
qa_userids_handles_html
(
$questions
,
false
);
$pagesize
=
qa_opt
(
'page_size_activity'
);
$count
=
(
int
)
@
$userpoints
[
'aposts'
];
$questions
=
array_slice
(
$questions
,
0
,
$pagesize
);
$usershtml
=
qa_userids_handles_html
(
$questions
,
false
);
// Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
$qa_content
=
qa_content_prepare
(
true
);
if
(
count
(
$questions
))
if
(
count
(
$questions
))
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/answers_by_x'
,
$userhtml
);
else
else
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_answers_by_x'
,
$userhtml
);
// Recent questions by this user
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
'hidden'
=>
array
(
'code'
=>
qa_get_form_security_code
(
'vote'
),
),
);
);
$qa_content
[
'q_list'
][
'qs'
]
=
array
();
$qa_content
[
'q_list'
][
'qs'
]
=
array
();
$htmldefaults
=
qa_post_html_defaults
(
'Q'
);
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
$htmldefaults
[
'ovoteview'
]
=
true
;
$htmldefaults
[
'answersview'
]
=
false
;
$htmldefaults
=
qa_post_html_defaults
(
'Q'
);
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
$htmldefaults
[
'ovoteview'
]
=
true
;
$htmldefaults
[
'answersview'
]
=
false
;
foreach
(
$questions
as
$question
)
{
foreach
(
$questions
as
$question
)
{
$options
=
qa_post_html_options
(
$question
,
$htmldefaults
);
$options
[
'voteview'
]
=
qa_get_vote_view
(
'A'
,
false
,
false
);
$qa_content
[
'q_list'
][
'qs'
][]
=
qa_other_to_q_html_fields
(
$question
,
$loginuserid
,
qa_cookie_get
(),
$usershtml
,
null
,
$options
);
}
}
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
$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
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'answers'
,
$ismyuser
);
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'answers'
,
$ismyuser
);
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/user-profile.php
View file @
e6f8efb5
This diff is collapsed.
Click to expand it.
qa-include/pages/user-questions.php
View file @
e6f8efb5
...
...
@@ -20,86 +20,81 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
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
$start
=
qa_get_start
();
$start
=
qa_get_start
();
// Find the questions for this user
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
$loginuserid
=
qa_get_logged_in_userid
();
$identifier
=
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$handle
;
list
(
$useraccount
,
$userpoints
,
$questions
)
=
qa_db_select_with_pending
(
list
(
$useraccount
,
$userpoints
,
$questions
)
=
qa_db_select_with_pending
(
QA_FINAL_EXTERNAL_USERS
?
null
:
qa_db_user_account_selectspec
(
$handle
,
false
),
qa_db_user_points_selectspec
(
$identifier
),
qa_db_user_recent_qs_selectspec
(
$loginuserid
,
$identifier
,
qa_opt_if_loaded
(
'page_size_qs'
),
$start
)
);
);
if
((
!
QA_FINAL_EXTERNAL_USERS
)
&&
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
if
(
!
QA_FINAL_EXTERNAL_USERS
&&
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
// Get information on user questions
$pagesize
=
qa_opt
(
'page_size_qs'
);
$count
=
(
int
)
@
$userpoints
[
'qposts'
];
$questions
=
array_slice
(
$questions
,
0
,
$pagesize
);
$usershtml
=
qa_userids_handles_html
(
$questions
,
false
);
$pagesize
=
qa_opt
(
'page_size_qs'
);
$count
=
(
int
)
@
$userpoints
[
'qposts'
];
$questions
=
array_slice
(
$questions
,
0
,
$pagesize
);
$usershtml
=
qa_userids_handles_html
(
$questions
,
false
);
// Prepare content for theme
$qa_content
=
qa_content_prepare
(
true
);
$qa_content
=
qa_content_prepare
(
true
);
if
(
count
(
$questions
))
if
(
count
(
$questions
))
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/questions_by_x'
,
$userhtml
);
else
else
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_questions_by_x'
,
$userhtml
);
// Recent questions by this user
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
$qa_content
[
'q_list'
][
'form'
]
=
array
(
'tags'
=>
'method="post" action="'
.
qa_self_html
()
.
'"'
,
'hidden'
=>
array
(
'code'
=>
qa_get_form_security_code
(
'vote'
),
),
);
);
$qa_content
[
'q_list'
][
'qs'
]
=
array
();
$qa_content
[
'q_list'
][
'qs'
]
=
array
();
$htmldefaults
=
qa_post_html_defaults
(
'Q'
);
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
$htmldefaults
=
qa_post_html_defaults
(
'Q'
);
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
foreach
(
$questions
as
$question
)
{
foreach
(
$questions
as
$question
)
{
$qa_content
[
'q_list'
][
'qs'
][]
=
qa_post_html_fields
(
$question
,
$loginuserid
,
qa_cookie_get
(),
$usershtml
,
null
,
qa_post_html_options
(
$question
,
$htmldefaults
));
}
}
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
$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
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'questions'
,
$ismyuser
);
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'questions'
,
$ismyuser
);
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/user-wall.php
View file @
e6f8efb5
...
...
@@ -20,112 +20,108 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
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
if
(
QA_FINAL_EXTERNAL_USERS
)
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
$start
=
qa_get_start
();
$start
=
qa_get_start
();
// Find the questions for this user
list
(
$useraccount
,
$usermessages
)
=
qa_db_select_with_pending
(
list
(
$useraccount
,
$usermessages
)
=
qa_db_select_with_pending
(
qa_db_user_account_selectspec
(
$handle
,
false
),
qa_db_recent_messages_selectspec
(
null
,
null
,
$handle
,
false
,
qa_opt_if_loaded
(
'page_size_wall'
),
$start
)
);
);
if
(
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
if
(
!
is_array
(
$useraccount
))
// check the user exists
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
// Perform pagination
$pagesize
=
qa_opt
(
'page_size_wall'
);
$count
=
$useraccount
[
'wallposts'
];
$loginuserid
=
qa_get_logged_in_userid
();
$pagesize
=
qa_opt
(
'page_size_wall'
);
$count
=
$useraccount
[
'wallposts'
];
$loginuserid
=
qa_get_logged_in_userid
();
$usermessages
=
array_slice
(
$usermessages
,
0
,
$pagesize
);
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
$start
);
$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)
$errors
=
array
();
$errors
=
array
();
$wallposterrorhtml
=
qa_wall_error_html
(
$loginuserid
,
$useraccount
[
'userid'
],
$useraccount
[
'flags'
]);
$wallposterrorhtml
=
qa_wall_error_html
(
$loginuserid
,
$useraccount
[
'userid'
],
$useraccount
[
'flags'
]);
foreach
(
$usermessages
as
$message
)
{
if
(
$message
[
'deleteable'
]
&&
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
))
{
if
(
!
qa_check_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
],
qa_post_text
(
'code'
)))
foreach
(
$usermessages
as
$message
)
{
if
(
$message
[
'deleteable'
]
&&
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
))
{
if
(
!
qa_check_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
],
qa_post_text
(
'code'
)))
{
$errors
[
'page'
]
=
qa_lang_html
(
'misc/form_security_again'
);
else
{
}
else
{
qa_wall_delete_post
(
$loginuserid
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$message
);
qa_redirect
(
qa_request
(),
$_GET
);
}
}
}
}
if
(
qa_clicked
(
'dowallpost'
))
{
if
(
qa_clicked
(
'dowallpost'
))
{
$inmessage
=
qa_post_text
(
'message'
);
if
(
!
strlen
(
$inmessage
))
if
(
!
strlen
(
$inmessage
))
{
$errors
[
'message'
]
=
qa_lang
(
'profile/post_wall_empty'
);
elseif
(
!
qa_check_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
],
qa_post_text
(
'code'
)))
}
elseif
(
!
qa_check_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
],
qa_post_text
(
'code'
)))
{
$errors
[
'message'
]
=
qa_lang_html
(
'misc/form_security_again'
);
elseif
(
!
$wallposterrorhtml
)
{
}
elseif
(
!
$wallposterrorhtml
)
{
qa_wall_add_post
(
$loginuserid
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$useraccount
[
'userid'
],
$useraccount
[
'handle'
],
$inmessage
,
''
);
qa_redirect
(
qa_request
());
}
}
}
// Prepare content for theme
$qa_content
=
qa_content_prepare
();
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/wall_for_x'
,
$userhtml
);
$qa_content
[
'error'
]
=
@
$errors
[
'page'
];
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/wall_for_x'
,
$userhtml
);
$qa_content
[
'error'
]
=
@
$errors
[
'page'
];
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-user.js?'
.
QA_VERSION
;
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-user.js?'
.
QA_VERSION
;
$qa_content
[
'message_list'
]
=
array
(
$qa_content
[
'message_list'
]
=
array
(
'tags'
=>
'id="wallmessages"'
,
'form'
=>
array
(
'tags'
=>
'name="wallpost" method="post" action="'
.
qa_self_html
()
.
'"'
,
'tags'
=>
'name="wallpost" method="post" action="'
.
qa_self_html
()
.
'"'
,
'style'
=>
'tall'
,
'hidden'
=>
array
(
'qa_click'
=>
''
,
// for simulating clicks in Javascript
'handle'
=>
qa_html
(
$useraccount
[
'handle'
]),
'start'
=>
qa_html
(
$start
),
'code'
=>
qa_get_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
]),
'code'
=>
qa_get_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
]),
),
),
'messages'
=>
array
(),
);
);
if
(
$start
==
0
)
{
// only allow posting on first page
if
(
$wallposterrorhtml
)
if
(
$start
==
0
)
{
// only allow posting on first page
if
(
$wallposterrorhtml
)
{
$qa_content
[
'message_list'
][
'error'
]
=
$wallposterrorhtml
;
// an error that means we are not allowed to post
else
{
}
else
{
$qa_content
[
'message_list'
][
'form'
][
'fields'
]
=
array
(
'message'
=>
array
(
'tags'
=>
'name="message" id="message"'
,
...
...
@@ -142,23 +138,19 @@
),
);
}
}
}
foreach
(
$usermessages
as
$message
)
foreach
(
$usermessages
as
$message
)
{
$qa_content
[
'message_list'
][
'messages'
][]
=
qa_wall_post_view
(
$message
);
}
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
$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
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'wall'
,
$ismyuser
);
$ismyuser
=
isset
(
$loginuserid
)
&&
$loginuserid
==
(
QA_FINAL_EXTERNAL_USERS
?
$userid
:
$useraccount
[
'userid'
]);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_user_sub_navigation
(
$handle
,
'wall'
,
$ismyuser
);
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/user.php
View file @
e6f8efb5
...
...
@@ -20,71 +20,66 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
// Determine the identify of the user
$handle
=
qa_request_part
(
1
);
$handle
=
qa_request_part
(
1
);
if
(
!
strlen
(
$handle
))
{
if
(
!
strlen
(
$handle
))
{
$handle
=
qa_get_logged_in_handle
();
qa_redirect
(
!
empty
(
$handle
)
?
'user/'
.
$handle
:
'users'
);
}
qa_redirect
(
!
empty
(
$handle
)
?
'user/'
.
$handle
:
'users'
);
}
// Get the HTML to display for the handle, and if we're using external users, determine the userid
if
(
QA_FINAL_EXTERNAL_USERS
)
{
if
(
QA_FINAL_EXTERNAL_USERS
)
{
$userid
=
qa_handle_to_userid
(
$handle
);
if
(
!
isset
(
$userid
))
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
return
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
$usershtml
=
qa_get_users_html
(
array
(
$userid
),
false
,
qa_path_to_root
(),
true
);
$userhtml
=
@
$usershtml
[
$userid
];
}
else
}
else
$userhtml
=
qa_html
(
$handle
);
// Display the appropriate page based on the request
switch
(
qa_request_part
(
2
))
{
switch
(
qa_request_part
(
2
))
{
case
'wall'
:
qa_set_template
(
'user-wall'
);
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-wall.php'
;
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-wall.php'
;
break
;
case
'activity'
:
qa_set_template
(
'user-activity'
);
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-activity.php'
;
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-activity.php'
;
break
;
case
'questions'
:
qa_set_template
(
'user-questions'
);
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-questions.php'
;
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-questions.php'
;
break
;
case
'answers'
:
qa_set_template
(
'user-answers'
);
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-answers.php'
;
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-answers.php'
;
break
;
case
null
:
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-profile.php'
;
$qa_content
=
include
QA_INCLUDE_DIR
.
'pages/user-profile.php'
;
break
;
default
:
$qa_content
=
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
$qa_content
=
include
QA_INCLUDE_DIR
.
'qa-page-not-found.php'
;
break
;
}
}
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/users-blocked.php
View file @
e6f8efb5
...
...
@@ -20,76 +20,71 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
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
if
(
QA_FINAL_EXTERNAL_USERS
)
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
// Get list of blocked users
$start
=
qa_get_start
();
$pagesize
=
qa_opt
(
'page_size_users'
);
$start
=
qa_get_start
();
$pagesize
=
qa_opt
(
'page_size_users'
);
$userSpecCount
=
qa_db_selectspec_count
(
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
)
);
$userSpec
=
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
,
$start
,
$pagesize
);
$userSpecCount
=
qa_db_selectspec_count
(
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
)
);
$userSpec
=
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
,
$start
,
$pagesize
);
list
(
$numUsers
,
$users
)
=
qa_db_select_with_pending
(
$userSpecCount
,
$userSpec
);
$count
=
$numUsers
[
'count'
];
list
(
$numUsers
,
$users
)
=
qa_db_select_with_pending
(
$userSpecCount
,
$userSpec
);
$count
=
$numUsers
[
'count'
];
// Check we have permission to view this page (moderator or above)
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_MODERATOR
)
{
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_MODERATOR
)
{
$qa_content
=
qa_content_prepare
();
$qa_content
[
'error'
]
=
qa_lang_html
(
'users/no_permission'
);
return
$qa_content
;
}
}
// Get userids and handles of retrieved users
$usershtml
=
qa_userids_handles_html
(
$users
);
$usershtml
=
qa_userids_handles_html
(
$users
);
// Prepare content for theme
$qa_content
=
qa_content_prepare
();
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
$count
>
0
?
qa_lang_html
(
'users/blocked_users'
)
:
qa_lang_html
(
'users/no_blocked_users'
);
$qa_content
[
'title'
]
=
$count
>
0
?
qa_lang_html
(
'users/blocked_users'
)
:
qa_lang_html
(
'users/no_blocked_users'
);
$qa_content
[
'ranking'
]
=
array
(
$qa_content
[
'ranking'
]
=
array
(
'items'
=>
array
(),
'rows'
=>
ceil
(
count
(
$users
)
/
qa_opt
(
'columns_users'
)),
'rows'
=>
ceil
(
count
(
$users
)
/
qa_opt
(
'columns_users'
)),
'type'
=>
'users'
);
);
foreach
(
$users
as
$user
)
{
foreach
(
$users
as
$user
)
{
$qa_content
[
'ranking'
][
'items'
][]
=
array
(
'label'
=>
$usershtml
[
$user
[
'userid'
]],
'score'
=>
qa_html
(
qa_user_level_string
(
$user
[
'level'
])),
'raw'
=>
$user
,
);
}
}
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$count
,
qa_opt
(
'pages_prev_next'
));
$qa_content
[
'navigation'
][
'sub'
]
=
qa_users_sub_navigation
();
$qa_content
[
'navigation'
][
'sub'
]
=
qa_users_sub_navigation
();
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/users-special.php
View file @
e6f8efb5
...
...
@@ -20,67 +20,62 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
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
if
(
QA_FINAL_EXTERNAL_USERS
)
if
(
QA_FINAL_EXTERNAL_USERS
)
qa_fatal_error
(
'User accounts are handled by external code'
);
// Get list of special users
$users
=
qa_db_select_with_pending
(
qa_db_users_from_level_selectspec
(
QA_USER_LEVEL_EXPERT
));
$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)
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_MODERATOR
)
{
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_MODERATOR
)
{
$qa_content
=
qa_content_prepare
();
$qa_content
[
'error'
]
=
qa_lang_html
(
'users/no_permission'
);
return
$qa_content
;
}
}
// Get userids and handles of retrieved users
$usershtml
=
qa_userids_handles_html
(
$users
);
$usershtml
=
qa_userids_handles_html
(
$users
);
// Prepare content for theme
$qa_content
=
qa_content_prepare
();
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
qa_lang_html
(
'users/special_users'
);
$qa_content
[
'title'
]
=
qa_lang_html
(
'users/special_users'
);
$qa_content
[
'ranking'
]
=
array
(
$qa_content
[
'ranking'
]
=
array
(
'items'
=>
array
(),
'rows'
=>
ceil
(
qa_opt
(
'page_size_users'
)
/
qa_opt
(
'columns_users'
)),
'rows'
=>
ceil
(
qa_opt
(
'page_size_users'
)
/
qa_opt
(
'columns_users'
)),
'type'
=>
'users'
);
);
foreach
(
$users
as
$user
)
{
foreach
(
$users
as
$user
)
{
$qa_content
[
'ranking'
][
'items'
][]
=
array
(
'label'
=>
$usershtml
[
$user
[
'userid'
]],
'score'
=>
qa_html
(
qa_user_level_string
(
$user
[
'level'
])),
'raw'
=>
$user
,
);
}
}
$qa_content
[
'navigation'
][
'sub'
]
=
qa_users_sub_navigation
();
$qa_content
[
'navigation'
][
'sub'
]
=
qa_users_sub_navigation
();
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
qa-include/pages/users.php
View file @
e6f8efb5
...
...
@@ -20,40 +20,40 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
}
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
// 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'
)));
$start
=
qa_get_start
();
$users
=
qa_db_select_with_pending
(
qa_db_top_users_selectspec
(
$start
,
qa_opt_if_loaded
(
'page_size_users'
)));
$usercount
=
qa_opt
(
'cache_userpointscount'
);
$pagesize
=
qa_opt
(
'page_size_users'
);
$users
=
array_slice
(
$users
,
0
,
$pagesize
);
$usershtml
=
qa_userids_handles_html
(
$users
);
$usercount
=
qa_opt
(
'cache_userpointscount'
);
$pagesize
=
qa_opt
(
'page_size_users'
);
$users
=
array_slice
(
$users
,
0
,
$pagesize
);
$usershtml
=
qa_userids_handles_html
(
$users
);
// Prepare content for theme
$qa_content
=
qa_content_prepare
();
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
qa_lang_html
(
'main/highest_users'
);
$qa_content
[
'title'
]
=
qa_lang_html
(
'main/highest_users'
);
$qa_content
[
'ranking'
]
=
array
(
$qa_content
[
'ranking'
]
=
array
(
'items'
=>
array
(),
'rows'
=>
ceil
(
$pagesize
/
qa_opt
(
'columns_users'
)),
'rows'
=>
ceil
(
$pagesize
/
qa_opt
(
'columns_users'
)),
'type'
=>
'users'
);
);
if
(
count
(
$users
))
{
if
(
count
(
$users
))
{
foreach
(
$users
as
$userid
=>
$user
)
{
if
(
QA_FINAL_EXTERNAL_USERS
)
$avatarhtml
=
qa_get_external_avatar_html
(
$user
[
'userid'
],
qa_opt
(
'avatar_users_size'
),
true
);
...
...
@@ -70,22 +70,17 @@
'raw'
=>
$user
,
);
}
}
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html
(
'main/no_active_users'
);
}
// set the canonical url based on possible pagination
$qa_content
[
'canonical'
]
=
qa_path_html
(
qa_request
(),
(
$start
>
0
?
array
(
'start'
=>
$start
)
:
null
),
qa_opt
(
'site_url'
));
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$usercount
,
qa_opt
(
'pages_prev_next'
));
// set the canonical url based on possible pagination
$qa_content
[
'canonical'
]
=
qa_path_html
(
qa_request
(),
(
$start
>
0
?
array
(
'start'
=>
$start
)
:
null
),
qa_opt
(
'site_url'
));
$qa_content
[
'navigation'
][
'sub'
]
=
qa_users_sub_navigation
(
);
$qa_content
[
'page_links'
]
=
qa_html_page_links
(
qa_request
(),
$start
,
$pagesize
,
$usercount
,
qa_opt
(
'pages_prev_next'
)
);
$qa_content
[
'navigation'
][
'sub'
]
=
qa_users_sub_navigation
();
return
$qa_content
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
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