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
936231ab
Commit
936231ab
authored
Jan 13, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (ajax pages)
parent
4fb68aa6
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
370 additions
and
445 deletions
+370
-445
category.php
qa-include/ajax/category.php
+14
-18
click-admin.php
qa-include/ajax/click-admin.php
+11
-17
click-comment.php
qa-include/ajax/click-comment.php
+43
-52
click-pm.php
qa-include/ajax/click-pm.php
+25
-25
click-wall.php
qa-include/ajax/click-wall.php
+18
-21
comment.php
qa-include/ajax/comment.php
+48
-56
favorite.php
qa-include/ajax/favorite.php
+19
-26
mailing.php
qa-include/ajax/mailing.php
+16
-22
notice.php
qa-include/ajax/notice.php
+17
-22
recalc.php
qa-include/ajax/recalc.php
+17
-23
show-comments.php
qa-include/ajax/show-comments.php
+36
-41
version.php
qa-include/ajax/version.php
+49
-56
vote.php
qa-include/ajax/vote.php
+30
-33
wallpost.php
qa-include/ajax/wallpost.php
+27
-33
No files found.
qa-include/ajax/category.php
View file @
936231ab
...
...
@@ -20,26 +20,23 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
$categoryid
=
qa_post_text
(
'categoryid'
);
if
(
!
strlen
(
$categoryid
))
$categoryid
=
null
;
$categoryid
=
qa_post_text
(
'categoryid'
);
if
(
!
strlen
(
$categoryid
))
$categoryid
=
null
;
list
(
$fullcategory
,
$categories
)
=
qa_db_select_with_pending
(
qa_db_full_category_selectspec
(
$categoryid
,
true
),
qa_db_category_sub_selectspec
(
$categoryid
)
);
list
(
$fullcategory
,
$categories
)
=
qa_db_select_with_pending
(
qa_db_full_category_selectspec
(
$categoryid
,
true
),
qa_db_category_sub_selectspec
(
$categoryid
)
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
echo
qa_html
(
strtr
(
@
$fullcategory
[
'content'
],
"
\r\n
"
,
' '
));
// category description
echo
qa_html
(
strtr
(
@
$fullcategory
[
'content'
],
"
\r\n
"
,
' '
));
// category description
foreach
(
$categories
as
$category
)
echo
"
\n
"
.
$category
[
'categoryid'
]
.
'/'
.
$category
[
'title'
];
// subcategory information
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
foreach
(
$categories
as
$category
)
{
// subcategory information
echo
"
\n
"
.
$category
[
'categoryid'
]
.
'/'
.
$category
[
'title'
];
}
qa-include/ajax/click-admin.php
View file @
936231ab
...
...
@@ -20,22 +20,17 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/admin.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/admin.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
$entityid
=
qa_post_text
(
'entityid'
);
$action
=
qa_post_text
(
'action'
);
$entityid
=
qa_post_text
(
'entityid'
);
$action
=
qa_post_text
(
'action'
);
if
(
!
qa_check_form_security_code
(
'admin/click'
,
qa_post_text
(
'code'
)))
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'misc/form_security_reload'
);
elseif
(
qa_admin_single_click
(
$entityid
,
$action
))
// permission check happens in here
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
else
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'main/general_error'
);
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
if
(
!
qa_check_form_security_code
(
'admin/click'
,
qa_post_text
(
'code'
)))
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'misc/form_security_reload'
);
elseif
(
qa_admin_single_click
(
$entityid
,
$action
))
// permission check happens in here
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
else
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'main/general_error'
);
qa-include/ajax/click-comment.php
View file @
936231ab
...
...
@@ -20,78 +20,70 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-view.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-submit.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-view.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-submit.php'
;
//
Load relevant information about this comment
//
Load relevant information about this comment
$commentid
=
qa_post_text
(
'commentid'
);
$questionid
=
qa_post_text
(
'questionid'
);
$parentid
=
qa_post_text
(
'parentid'
);
$commentid
=
qa_post_text
(
'commentid'
);
$questionid
=
qa_post_text
(
'questionid'
);
$parentid
=
qa_post_text
(
'parentid'
);
$userid
=
qa_get_logged_in_userid
();
$userid
=
qa_get_logged_in_userid
();
list
(
$comment
,
$question
,
$parent
,
$children
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$commentid
),
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_post_selectspec
(
$userid
,
$parentid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
)
);
list
(
$comment
,
$question
,
$parent
,
$children
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$commentid
),
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_post_selectspec
(
$userid
,
$parentid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
)
);
//
Check if there was an operation that succeeded
//
Check if there was an operation that succeeded
if
(
(
@
$comment
[
'basetype'
]
==
'C'
)
&&
(
@
$question
[
'basetype'
]
==
'Q'
)
&&
((
@
$parent
[
'basetype'
]
==
'Q'
)
||
(
@
$parent
[
'basetype'
]
==
'A'
))
)
{
$comment
=
$comment
+
qa_page_q_post_rules
(
$comment
,
$parent
,
$children
,
null
);
// array union
if
(
@
$comment
[
'basetype'
]
==
'C'
&&
@
$question
[
'basetype'
]
==
'Q'
&&
(
@
$parent
[
'basetype'
]
==
'Q'
||
@
$parent
[
'basetype'
]
==
'A'
)
)
{
$comment
=
$comment
+
qa_page_q_post_rules
(
$comment
,
$parent
,
$children
,
null
);
// array union
if
(
qa_page_q_single_click_c
(
$comment
,
$question
,
$parent
,
$error
))
{
$comment
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$commentid
));
if
(
qa_page_q_single_click_c
(
$comment
,
$question
,
$parent
,
$error
))
{
$comment
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$commentid
));
// If so, page content to be updated via Ajax
// If so, page content to be updated via Ajax
echo
"QA_AJAX_RESPONSE
\n
1"
;
echo
"QA_AJAX_RESPONSE
\n
1"
;
// If the comment was not deleted...
if
(
isset
(
$comment
))
{
$parent
=
$parent
+
qa_page_q_post_rules
(
$parent
,
(
$questionid
==
$parentid
)
?
null
:
$question
,
null
,
$children
);
// in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant
$comment
=
$comment
+
qa_page_q_post_rules
(
$comment
,
$parent
,
$children
,
null
);
// If the comment was not deleted...
$usershtml
=
qa_userids_handles_html
(
array
(
$comment
),
true
);
if
(
isset
(
$comment
))
{
$parent
=
$parent
+
qa_page_q_post_rules
(
$parent
,
(
$questionid
==
$parentid
)
?
null
:
$question
,
null
,
$children
);
// in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant
$comment
=
$comment
+
qa_page_q_post_rules
(
$comment
,
$parent
,
$children
,
null
);
$c_view
=
qa_page_q_comment_view
(
$question
,
$parent
,
$comment
,
$usershtml
,
false
);
$usershtml
=
qa_userids_handles_html
(
array
(
$comment
),
true
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-comment'
,
null
,
null
);
$themeclass
->
initialize
();
$c_view
=
qa_page_q_comment_view
(
$question
,
$parent
,
$comment
,
$usershtml
,
false
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-comment'
,
null
,
null
);
$themeclass
->
initialize
();
// ... send back the HTML for it
echo
"
\n
"
;
// ... send back the HTML for it
echo
"
\n
"
;
$themeclass
->
c_list_item
(
$c_view
);
}
return
;
$themeclass
->
c_list_item
(
$c_view
);
}
}
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
// fall back to non-Ajax submission if something failed
return
;
}
}
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
// fall back to non-Ajax submission if something failed
qa-include/ajax/click-pm.php
View file @
936231ab
...
...
@@ -20,38 +20,38 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
$loginUserId
=
qa_get_logged_in_userid
();
$loginUserHandle
=
qa_get_logged_in_handle
();
$loginUserId
=
qa_get_logged_in_userid
();
$loginUserHandle
=
qa_get_logged_in_handle
();
$fromhandle
=
qa_post_text
(
'handle'
);
$start
=
(
int
)
qa_post_text
(
'start'
);
$box
=
qa_post_text
(
'box'
);
$pagesize
=
qa_opt
(
'page_size_pms'
);
$fromhandle
=
qa_post_text
(
'handle'
);
$start
=
(
int
)
qa_post_text
(
'start'
);
$box
=
qa_post_text
(
'box'
);
$pagesize
=
qa_opt
(
'page_size_pms'
);
if
(
!
isset
(
$loginUserId
)
||
$loginUserHandle
!==
$fromhandle
||
!
in_array
(
$box
,
array
(
'inbox'
,
'outbox'
))
)
{
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
return
;
}
if
(
!
isset
(
$loginUserId
)
||
$loginUserHandle
!==
$fromhandle
||
!
in_array
(
$box
,
array
(
'inbox'
,
'outbox'
))
)
{
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
return
;
}
$func
=
'qa_db_messages_'
.
$box
.
'_selectspec'
;
$pmSpec
=
$func
(
'private'
,
$loginUserId
,
true
,
$start
,
$pagesize
);
$userMessages
=
qa_db_select_with_pending
(
$pmSpec
);
$func
=
'qa_db_messages_'
.
$box
.
'_selectspec'
;
$pmSpec
=
$func
(
'private'
,
$loginUserId
,
true
,
$start
,
$pagesize
);
$userMessages
=
qa_db_select_with_pending
(
$pmSpec
);
foreach
(
$userMessages
as
$message
)
{
if
(
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
))
{
if
(
qa_check_form_security_code
(
'pm-'
.
$fromhandle
,
qa_post_text
(
'code'
)))
{
qa_pm_delete
(
$loginUserId
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$message
,
$box
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
return
;
}
foreach
(
$userMessages
as
$message
)
{
if
(
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
))
{
if
(
qa_check_form_security_code
(
'pm-'
.
$fromhandle
,
qa_post_text
(
'code'
)))
{
qa_pm_delete
(
$loginUserId
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$message
,
$box
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
return
;
}
}
}
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
qa-include/ajax/click-wall.php
View file @
936231ab
...
...
@@ -20,28 +20,26 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
$tohandle
=
qa_post_text
(
'handle'
);
$start
=
(
int
)
qa_post_text
(
'start'
);
$tohandle
=
qa_post_text
(
'handle'
);
$start
=
(
int
)
qa_post_text
(
'start'
);
$usermessages
=
qa_db_select_with_pending
(
qa_db_recent_messages_selectspec
(
null
,
null
,
$tohandle
,
false
,
null
,
$start
));
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
$start
);
$usermessages
=
qa_db_select_with_pending
(
qa_db_recent_messages_selectspec
(
null
,
null
,
$tohandle
,
false
,
null
,
$start
));
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
$start
);
foreach
(
$usermessages
as
$message
)
if
(
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
)
&&
$message
[
'deleteable'
])
if
(
qa_check_form_security_code
(
'wall-'
.
$tohandle
,
qa_post_text
(
'code'
)))
{
qa_wall_delete_post
(
qa_get_logged_in_userid
(),
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$message
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
return
;
}
foreach
(
$usermessages
as
$message
)
{
if
(
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
)
&&
$message
[
'deleteable'
])
{
if
(
qa_check_form_security_code
(
'wall-'
.
$tohandle
,
qa_post_text
(
'code'
)))
{
qa_wall_delete_post
(
qa_get_logged_in_userid
(),
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$message
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
return
;
}
}
}
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
qa-include/ajax/comment.php
View file @
936231ab
...
...
@@ -20,85 +20,78 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/limits.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/limits.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
//
Load relevant information about this question and the comment parent
//
Load relevant information about this question and the comment parent
$questionid
=
qa_post_text
(
'c_questionid'
);
$parentid
=
qa_post_text
(
'c_parentid'
);
$userid
=
qa_get_logged_in_userid
();
$questionid
=
qa_post_text
(
'c_questionid'
);
$parentid
=
qa_post_text
(
'c_parentid'
);
$userid
=
qa_get_logged_in_userid
();
list
(
$question
,
$parent
,
$children
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_post_selectspec
(
$userid
,
$parentid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
)
);
list
(
$question
,
$parent
,
$children
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_post_selectspec
(
$userid
,
$parentid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
)
);
//
Check if the question and parent exist, and whether the user has permission to do this
//
Check if the question and parent exist, and whether the user has permission to do this
if
(
(
@
$question
[
'basetype'
]
==
'Q'
)
&&
((
@
$parent
[
'basetype'
]
==
'Q'
)
||
(
@
$parent
[
'basetype'
]
==
'A'
))
&&
!
qa_user_post_permit_error
(
'permit_post_c'
,
$parent
,
QA_LIMIT_COMMENTS
))
{
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/post-create.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-view.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-submit.php'
;
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
if
(
@
$question
[
'basetype'
]
==
'Q'
&&
(
@
$parent
[
'basetype'
]
==
'Q'
||
@
$parent
[
'basetype'
]
==
'A'
)
&&
!
qa_user_post_permit_error
(
'permit_post_c'
,
$parent
,
QA_LIMIT_COMMENTS
)
)
{
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/post-create.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-view.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-submit.php'
;
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
//
Try to create the new comment
//
Try to create the new comment
$usecaptcha
=
qa_user_use_captcha
(
qa_user_level_for_post
(
$question
));
$commentid
=
qa_page_q_add_c_submit
(
$question
,
$parent
,
$children
,
$usecaptcha
,
$in
,
$errors
);
$usecaptcha
=
qa_user_use_captcha
(
qa_user_level_for_post
(
$question
));
$commentid
=
qa_page_q_add_c_submit
(
$question
,
$parent
,
$children
,
$usecaptcha
,
$in
,
$errors
);
//
If successful, page content will be updated via Ajax
//
If successful, page content will be updated via Ajax
if
(
isset
(
$commentid
))
{
$children
=
qa_db_select_with_pending
(
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
));
if
(
isset
(
$commentid
))
{
$children
=
qa_db_select_with_pending
(
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
));
$parent
=
$parent
+
qa_page_q_post_rules
(
$parent
,
(
$questionid
==
$parentid
)
?
null
:
$question
,
null
,
$children
);
// in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant
$parent
=
$parent
+
qa_page_q_post_rules
(
$parent
,
(
$questionid
==
$parentid
)
?
null
:
$question
,
null
,
$children
);
// in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant
foreach
(
$children
as
$key
=>
$child
)
$children
[
$key
]
=
$child
+
qa_page_q_post_rules
(
$child
,
$parent
,
$children
,
null
);
$usershtml
=
qa_userids_handles_html
(
$children
,
true
);
qa_sort_by
(
$children
,
'created'
);
foreach
(
$children
as
$key
=>
$child
)
{
$children
[
$key
]
=
$child
+
qa_page_q_post_rules
(
$child
,
$parent
,
$children
,
null
);
}
$c_list
=
qa_page_q_comment_follow_list
(
$question
,
$parent
,
$children
,
true
,
$usershtml
,
false
,
null
);
$usershtml
=
qa_userids_handles_html
(
$children
,
true
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-comments'
,
null
,
null
);
$themeclass
->
initialize
();
qa_sort_by
(
$children
,
'created'
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
$c_list
=
qa_page_q_comment_follow_list
(
$question
,
$parent
,
$children
,
true
,
$usershtml
,
false
,
null
)
;
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-comments'
,
null
,
null
);
$themeclass
->
initialize
();
// Send back the ID of the new comment
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
echo
qa_anchor
(
'C'
,
$commentid
)
.
"
\n
"
;
// send back the ID of the new comment
echo
qa_anchor
(
'C'
,
$commentid
)
.
"
\n
"
;
// Send back the HTML
$themeclass
->
c_list_items
(
$c_list
[
'cs'
]);
// send back the HTML
$themeclass
->
c_list_items
(
$c_list
[
'cs'
]);
return
;
}
return
;
}
}
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
// fall back to non-Ajax submission if there were any problems
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
// fall back to non-Ajax submission if there were any problems
qa-include/ajax/favorite.php
View file @
936231ab
...
...
@@ -20,37 +20,31 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/favorites.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/favorites.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
$entitytype
=
qa_post_text
(
'entitytype'
);
$entityid
=
qa_post_text
(
'entityid'
);
$setfavorite
=
qa_post_text
(
'favorite'
);
$entitytype
=
qa_post_text
(
'entitytype'
);
$entityid
=
qa_post_text
(
'entityid'
);
$setfavorite
=
qa_post_text
(
'favorite'
);
$userid
=
qa_get_logged_in_userid
();
$userid
=
qa_get_logged_in_userid
();
if
(
!
qa_check_form_security_code
(
'favorite-'
.
$entitytype
.
'-'
.
$entityid
,
qa_post_text
(
'code'
)))
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'misc/form_security_reload'
);
if
(
!
qa_check_form_security_code
(
'favorite-'
.
$entitytype
.
'-'
.
$entityid
,
qa_post_text
(
'code'
)))
{
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'misc/form_security_reload'
);
}
elseif
(
isset
(
$userid
))
{
$cookieid
=
qa_cookie_get
();
elseif
(
isset
(
$userid
))
{
$cookieid
=
qa_cookie_get
();
qa_user_favorite_set
(
$userid
,
qa_get_logged_in_handle
(),
$cookieid
,
$entitytype
,
$entityid
,
$setfavorite
);
qa_user_favorite_set
(
$userid
,
qa_get_logged_in_handle
(),
$cookieid
,
$entitytype
,
$entityid
,
$setfavorite
);
$favoriteform
=
qa_favorite_form
(
$entitytype
,
$entityid
,
$setfavorite
,
qa_lang
(
$setfavorite
?
'main/remove_favorites'
:
'main/add_favorites'
)
);
$favoriteform
=
qa_favorite_form
(
$entitytype
,
$entityid
,
$setfavorite
,
qa_lang
(
$setfavorite
?
'main/remove_favorites'
:
'main/add_favorites'
));
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-favorite'
,
null
,
null
);
$themeclass
->
initialize
();
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-favorite'
,
null
,
null
);
$themeclass
->
initialize
();
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
$themeclass
->
favorite_inner_html
(
$favoriteform
);
}
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
$themeclass
->
favorite_inner_html
(
$favoriteform
);
}
qa-include/ajax/mailing.php
View file @
936231ab
...
...
@@ -20,34 +20,29 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/mailing.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/mailing.php'
;
$continue
=
false
;
$continue
=
false
;
if
(
qa_get_logged_in_level
()
>=
QA_USER_LEVEL_ADMIN
)
{
$starttime
=
time
();
if
(
qa_get_logged_in_level
()
>=
QA_USER_LEVEL_ADMIN
)
{
$starttime
=
time
();
qa_mailing_perform_step
();
qa_mailing_perform_step
();
if
(
$starttime
==
time
())
sleep
(
1
);
// make sure at least one second has passed
if
(
$starttime
==
time
())
sleep
(
1
);
// make sure at least one second has passed
$message
=
qa_mailing_progress_message
();
$message
=
qa_mailing_progress_message
();
if
(
isset
(
$message
))
$continue
=
true
;
else
$message
=
qa_lang
(
'admin/mailing_complete'
);
if
(
isset
(
$message
))
$continue
=
true
;
else
$message
=
qa_lang
(
'admin/mailing_complete'
);
}
else
$message
=
qa_lang
(
'admin/no_privileges'
);
}
else
$message
=
qa_lang
(
'admin/no_privileges'
);
echo
"QA_AJAX_RESPONSE
\n
"
.
(
int
)
$continue
.
"
\n
"
.
qa_html
(
$message
);
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
"
.
(
int
)
$continue
.
"
\n
"
.
qa_html
(
$message
);
qa-include/ajax/notice.php
View file @
936231ab
...
...
@@ -20,34 +20,29 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/notices.php'
;
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'db/notices.php'
;
require_once
QA_INCLUDE_DIR
.
'db/users.php'
;
$noticeid
=
qa_post_text
(
'noticeid'
);
$noticeid
=
qa_post_text
(
'noticeid'
);
if
(
!
qa_check_form_security_code
(
'notice-'
.
$noticeid
,
qa_post_text
(
'code'
)))
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'misc/form_security_reload'
);
if
(
!
qa_check_form_security_code
(
'notice-'
.
$noticeid
,
qa_post_text
(
'code'
)))
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang
(
'misc/form_security_reload'
);
else
{
if
(
$noticeid
==
'visitor'
)
setcookie
(
'qa_noticed'
,
1
,
time
()
+
86400
*
3650
,
'/'
,
QA_COOKIE_DOMAIN
,
(
bool
)
ini_get
(
'session.cookie_secure'
),
true
);
else
{
$userid
=
qa_get_logged_in_userid
();
if
(
$noticeid
==
'welcome'
)
qa_db_user_set_flag
(
$userid
,
QA_USER_FLAGS_WELCOME_NOTICE
,
false
);
else
qa_db_usernotice_delete
(
$userid
,
$noticeid
);
}
else
{
if
(
$noticeid
==
'visitor'
)
setcookie
(
'qa_noticed'
,
1
,
time
()
+
86400
*
3650
,
'/'
,
QA_COOKIE_DOMAIN
,
(
bool
)
ini_get
(
'session.cookie_secure'
),
true
);
else
{
$userid
=
qa_get_logged_in_userid
();
echo
"QA_AJAX_RESPONSE
\n
1"
;
if
(
$noticeid
==
'welcome'
)
qa_db_user_set_flag
(
$userid
,
QA_USER_FLAGS_WELCOME_NOTICE
,
false
);
else
qa_db_usernotice_delete
(
$userid
,
$noticeid
);
}
/*
Omit PHP closing tag to help avoid accidental output
*/
echo
"QA_AJAX_RESPONSE
\n
1"
;
}
qa-include/ajax/recalc.php
View file @
936231ab
...
...
@@ -20,35 +20,30 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/recalc.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/recalc.php'
;
if
(
qa_get_logged_in_level
()
>=
QA_USER_LEVEL_ADMIN
)
{
if
(
qa_get_logged_in_level
()
>=
QA_USER_LEVEL_ADMIN
)
{
if
(
!
qa_check_form_security_code
(
'admin/recalc'
,
qa_post_text
(
'code'
)))
{
$state
=
''
;
$message
=
qa_lang
(
'misc/form_security_reload'
);
if
(
!
qa_check_form_security_code
(
'admin/recalc'
,
qa_post_text
(
'code'
)))
{
$state
=
''
;
$message
=
qa_lang
(
'misc/form_security_reload'
);
}
else
{
$state
=
qa_post_text
(
'state'
);
$stoptime
=
time
()
+
3
;
while
(
qa_recalc_perform_step
(
$state
)
&&
(
time
()
<
$stoptime
)
)
;
}
else
{
$state
=
qa_post_text
(
'state'
);
$stoptime
=
time
()
+
3
;
$message
=
qa_recalc_get_message
(
$state
);
}
while
(
qa_recalc_perform_step
(
$state
)
&&
(
time
()
<
$stoptime
))
;
}
else
{
$state
=
''
;
$message
=
qa_lang
(
'admin/no_privileges'
);
$message
=
qa_recalc_get_message
(
$state
);
}
}
else
{
$state
=
''
;
$message
=
qa_lang
(
'admin/no_privileges'
);
}
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
.
$state
.
"
\n
"
.
qa_html
(
$message
);
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
.
$state
.
"
\n
"
.
qa_html
(
$message
);
qa-include/ajax/show-comments.php
View file @
936231ab
...
...
@@ -20,61 +20,57 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-view.php'
;
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'pages/question-view.php'
;
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
//
Load relevant information about this question and check it exists
//
Load relevant information about this question and check it exists
$questionid
=
qa_post_text
(
'c_questionid'
);
$parentid
=
qa_post_text
(
'c_parentid'
);
$userid
=
qa_get_logged_in_userid
();
$questionid
=
qa_post_text
(
'c_questionid'
);
$parentid
=
qa_post_text
(
'c_parentid'
);
$userid
=
qa_get_logged_in_userid
();
list
(
$question
,
$parent
,
$children
,
$duplicateposts
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_post_selectspec
(
$userid
,
$parentid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
),
qa_db_post_duplicates_selectspec
(
$questionid
)
);
list
(
$question
,
$parent
,
$children
,
$duplicateposts
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_post_selectspec
(
$userid
,
$parentid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$parentid
),
qa_db_post_duplicates_selectspec
(
$questionid
)
);
if
(
isset
(
$parent
))
{
$parent
=
$parent
+
qa_page_q_post_rules
(
$parent
,
null
,
null
,
$children
+
$duplicateposts
);
// in theory we should retrieve the parent's parent and siblings for the above, but they're not going to be relevant
if
(
isset
(
$parent
))
{
$parent
=
$parent
+
qa_page_q_post_rules
(
$parent
,
null
,
null
,
$children
+
$duplicateposts
);
// in theory we should retrieve the parent's parent and siblings for the above, but they're not going to be relevant
foreach
(
$children
as
$key
=>
$child
)
$children
[
$key
]
=
$child
+
qa_page_q_post_rules
(
$child
,
$parent
,
$children
,
null
);
$commentsfollows
=
$questionid
==
$parentid
?
qa_page_q_load_c_follows
(
$question
,
$children
,
array
(),
$duplicateposts
)
:
qa_page_q_load_c_follows
(
$question
,
array
(),
$children
);
foreach
(
$children
as
$key
=>
$child
)
{
$children
[
$key
]
=
$child
+
qa_page_q_post_rules
(
$child
,
$parent
,
$children
,
null
);
}
$usershtml
=
qa_userids_handles_html
(
$commentsfollows
,
true
);
$commentsfollows
=
$questionid
==
$parentid
?
qa_page_q_load_c_follows
(
$question
,
$children
,
array
(),
$duplicateposts
)
:
qa_page_q_load_c_follows
(
$question
,
array
(),
$children
);
qa_sort_by
(
$commentsfollows
,
'created'
);
$usershtml
=
qa_userids_handles_html
(
$commentsfollows
,
true
);
$c_list
=
qa_page_q_comment_follow_list
(
$question
,
$parent
,
$commentsfollows
,
true
,
$usershtml
,
false
,
null
);
qa_sort_by
(
$commentsfollows
,
'created'
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-comments'
,
null
,
null
);
$themeclass
->
initialize
();
$c_list
=
qa_page_q_comment_follow_list
(
$question
,
$parent
,
$commentsfollows
,
true
,
$usershtml
,
false
,
null
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-comments'
,
null
,
null
);
$themeclass
->
initialize
();
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
// Send back the HTML
$themeclass
->
c_list_items
(
$c_list
[
'cs'
]);
// Send back the HTML
return
;
}
$themeclass
->
c_list_items
(
$c_list
[
'cs'
]);
return
;
}
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
;
qa-include/ajax/version.php
View file @
936231ab
...
...
@@ -20,68 +20,62 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/admin.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_ADMIN
)
{
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang_html
(
'admin/no_privileges'
);
return
;
}
$uri
=
qa_post_text
(
'uri'
);
$version
=
qa_post_text
(
'version'
);
$isCore
=
qa_post_text
(
'isCore'
)
===
"true"
;
if
(
$isCore
)
{
$contents
=
qa_retrieve_url
(
$uri
);
if
(
strlen
(
$contents
)
>
0
)
{
if
(
qa_qa_version_below
(
$contents
))
{
$response
=
'<a href="https://github.com/q2a/question2answer/releases" style="color:#d00;">'
.
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$contents
))
.
'</a>'
;
}
else
{
$response
=
qa_html
(
$contents
);
// Output the current version number
}
require_once
QA_INCLUDE_DIR
.
'app/admin.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
if
(
qa_get_logged_in_level
()
<
QA_USER_LEVEL_ADMIN
)
{
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
qa_lang_html
(
'admin/no_privileges'
);
return
;
}
$uri
=
qa_post_text
(
'uri'
);
$version
=
qa_post_text
(
'version'
);
$isCore
=
qa_post_text
(
'isCore'
)
===
"true"
;
if
(
$isCore
)
{
$contents
=
qa_retrieve_url
(
$uri
);
if
(
strlen
(
$contents
)
>
0
)
{
if
(
qa_qa_version_below
(
$contents
))
{
$response
=
'<a href="https://github.com/q2a/question2answer/releases" style="color:#d00;">'
.
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$contents
))
.
'</a>'
;
}
else
{
$response
=
qa_
lang_html
(
'admin/version_latest_unknown'
);
$response
=
qa_
html
(
$contents
);
// Output the current version number
}
}
else
{
$metadataUtil
=
new
Q2A_Util_Metadata
();
$metadata
=
$metadataUtil
->
fetchFromUrl
(
$uri
);
if
(
strlen
(
@
$metadata
[
'version'
])
>
0
)
{
if
(
strcmp
(
$metadata
[
'version'
],
$version
))
{
if
(
qa_qa_version_below
(
@
$metadata
[
'min_q2a'
]))
{
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_q2a'
),
array
(
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_q2a'
]),
));
}
elseif
(
qa_php_version_below
(
@
$metadata
[
'min_php'
]))
{
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_php'
),
array
(
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_php'
]),
));
}
else
{
$response
=
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$metadata
[
'version'
]));
$response
=
qa_lang_html
(
'admin/version_latest_unknown'
);
}
}
else
{
$metadataUtil
=
new
Q2A_Util_Metadata
();
$metadata
=
$metadataUtil
->
fetchFromUrl
(
$uri
);
if
(
strlen
(
@
$metadata
[
'version'
])
>
0
)
{
if
(
strcmp
(
$metadata
[
'version'
],
$version
))
{
if
(
qa_qa_version_below
(
@
$metadata
[
'min_q2a'
]))
{
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_q2a'
),
array
(
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_q2a'
]),
));
}
elseif
(
qa_php_version_below
(
@
$metadata
[
'min_php'
]))
{
$response
=
strtr
(
qa_lang_html
(
'admin/version_requires_php'
),
array
(
'^1'
=>
qa_html
(
'v'
.
$metadata
[
'version'
]),
'^2'
=>
qa_html
(
$metadata
[
'min_php'
]),
));
}
else
{
$response
=
qa_lang_html_sub
(
'admin/version_get_x'
,
qa_html
(
'v'
.
$metadata
[
'version'
]));
if
(
strlen
(
@
$metadata
[
'uri'
])){
$response
=
'<a href="'
.
qa_html
(
$metadata
[
'uri'
])
.
'" style="color:#d00;">'
.
$response
.
'</a>'
;
}
if
(
strlen
(
@
$metadata
[
'uri'
]))
{
$response
=
'<a href="'
.
qa_html
(
$metadata
[
'uri'
])
.
'" style="color:#d00;">'
.
$response
.
'</a>'
;
}
}
else
{
$response
=
qa_lang_html
(
'admin/version_latest'
);
}
}
else
{
$response
=
qa_lang_html
(
'admin/version_latest
_unknown
'
);
$response
=
qa_lang_html
(
'admin/version_latest'
);
}
}
else
{
$response
=
qa_lang_html
(
'admin/version_latest_unknown'
);
}
}
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
.
$response
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
.
$response
;
qa-include/ajax/vote.php
View file @
936231ab
...
...
@@ -20,48 +20,46 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/votes.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/options.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'app/votes.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/options.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
$postid
=
qa_post_text
(
'postid'
);
$vote
=
qa_post_text
(
'vote'
);
$code
=
qa_post_text
(
'code'
);
$postid
=
qa_post_text
(
'postid'
);
$vote
=
qa_post_text
(
'vote'
);
$code
=
qa_post_text
(
'code'
);
$userid
=
qa_get_logged_in_userid
();
$cookieid
=
qa_cookie_get
();
$userid
=
qa_get_logged_in_userid
();
$cookieid
=
qa_cookie_get
();
if
(
!
qa_check_form_security_code
(
'vote'
,
$code
))
$voteerror
=
qa_lang_html
(
'misc/form_security_reload'
);
if
(
!
qa_check_form_security_code
(
'vote'
,
$code
))
$voteerror
=
qa_lang_html
(
'misc/form_security_reload'
);
else
{
$post
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$postid
));
$voteerror
=
qa_vote_error_html
(
$post
,
$vote
,
$userid
,
qa_request
());
}
else
{
$post
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$postid
));
$voteerror
=
qa_vote_error_html
(
$post
,
$vote
,
$userid
,
qa_request
());
}
if
(
$voteerror
===
false
)
{
qa_vote_set
(
$post
,
$userid
,
qa_get_logged_in_handle
(),
$cookieid
,
$vote
);
if
(
$voteerror
===
false
)
{
qa_vote_set
(
$post
,
$userid
,
qa_get_logged_in_handle
(),
$cookieid
,
$vote
);
$post
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$postid
));
$post
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$postid
));
$fields
=
qa_post_html_fields
(
$post
,
$userid
,
$cookieid
,
array
(),
null
,
array
(
'voteview'
=>
qa_get_vote_view
(
$post
,
true
),
// behave as if on question page since the vote succeeded
));
$fields
=
qa_post_html_fields
(
$post
,
$userid
,
$cookieid
,
array
(),
null
,
array
(
'voteview'
=>
qa_get_vote_view
(
$post
,
true
),
// behave as if on question page since the vote succeeded
));
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'voting'
,
null
,
null
);
$themeclass
->
initialize
();
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'voting'
,
null
,
null
);
$themeclass
->
initialize
();
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
$themeclass
->
voting_inner_html
(
$fields
);
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
$themeclass
->
voting_inner_html
(
$fields
);
}
else
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
$voteerror
;
return
;
}
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
echo
"QA_AJAX_RESPONSE
\n
0
\n
"
.
$voteerror
;
qa-include/ajax/wallpost.php
View file @
936231ab
...
...
@@ -20,47 +20,42 @@
More about this license: http://www.question2answer.org/license.php
*/
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'app/messages.php'
;
require_once
QA_INCLUDE_DIR
.
'app/users.php'
;
require_once
QA_INCLUDE_DIR
.
'app/cookies.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
$message
=
qa_post_text
(
'message'
);
$tohandle
=
qa_post_text
(
'handle'
);
$morelink
=
qa_post_text
(
'morelink'
);
$message
=
qa_post_text
(
'message'
);
$tohandle
=
qa_post_text
(
'handle'
);
$morelink
=
qa_post_text
(
'morelink'
);
$touseraccount
=
qa_db_select_with_pending
(
qa_db_user_account_selectspec
(
$tohandle
,
false
));
$loginuserid
=
qa_get_logged_in_userid
();
$touseraccount
=
qa_db_select_with_pending
(
qa_db_user_account_selectspec
(
$tohandle
,
false
));
$loginuserid
=
qa_get_logged_in_userid
();
$errorhtml
=
qa_wall_error_html
(
$loginuserid
,
$touseraccount
[
'userid'
],
$touseraccount
[
'flags'
]);
$errorhtml
=
qa_wall_error_html
(
$loginuserid
,
$touseraccount
[
'userid'
],
$touseraccount
[
'flags'
]);
if
(
$errorhtml
||
(
!
strlen
(
$message
))
||
!
qa_check_form_security_code
(
'wall-'
.
$tohandle
,
qa_post_text
(
'code'
))
)
echo
"QA_AJAX_RESPONSE
\n
0"
;
// if there's an error, process in non-Ajax way
if
(
$errorhtml
||
!
strlen
(
$message
)
||
!
qa_check_form_security_code
(
'wall-'
.
$tohandle
,
qa_post_text
(
'code'
)))
{
echo
"QA_AJAX_RESPONSE
\n
0"
;
// if there's an error, process in non-Ajax way
}
else
{
$messageid
=
qa_wall_add_post
(
$loginuserid
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$touseraccount
[
'userid'
],
$touseraccount
[
'handle'
],
$message
,
''
);
$touseraccount
[
'wallposts'
]
++
;
// won't have been updated
else
{
$messageid
=
qa_wall_add_post
(
$loginuserid
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$touseraccount
[
'userid'
],
$touseraccount
[
'handle'
],
$message
,
''
);
$touseraccount
[
'wallposts'
]
++
;
// won't have been updated
$usermessages
=
qa_db_select_with_pending
(
qa_db_recent_messages_selectspec
(
null
,
null
,
$touseraccount
[
'userid'
],
true
,
qa_opt
(
'page_size_wall'
)));
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
0
);
$usermessages
=
qa_db_select_with_pending
(
qa_db_recent_messages_selectspec
(
null
,
null
,
$touseraccount
[
'userid'
],
true
,
qa_opt
(
'page_size_wall'
))
);
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
0
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'wall'
,
null
,
null
);
$themeclass
->
initialize
(
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'wall'
,
null
,
null
);
$themeclass
->
initialize
();
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
echo
"QA_AJAX_RESPONSE
\n
1
\n
"
;
echo
'm'
.
$messageid
.
"
\n
"
;
// element in list to be revealed
echo
'm'
.
$messageid
.
"
\n
"
;
// element in list to be revealed
foreach
(
$usermessages
as
$message
)
$themeclass
->
message_item
(
qa_wall_post_view
(
$message
));
if
(
$morelink
&&
(
$touseraccount
[
'wallposts'
]
>
count
(
$usermessages
)))
$themeclass
->
message_item
(
qa_wall_view_more_link
(
$tohandle
,
count
(
$usermessages
)));
foreach
(
$usermessages
as
$message
)
{
$themeclass
->
message_item
(
qa_wall_post_view
(
$message
));
}
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
if
(
$morelink
&&
(
$touseraccount
[
'wallposts'
]
>
count
(
$usermessages
)))
$themeclass
->
message_item
(
qa_wall_view_more_link
(
$tohandle
,
count
(
$usermessages
)));
}
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