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
85a5f71e
Commit
85a5f71e
authored
Jun 27, 2013
by
Gideon Greenspan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.6
parent
d9dddd9f
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
128 additions
and
41 deletions
+128
-41
VERSION.txt
VERSION.txt
+2
-2
qa-user.js
qa-content/qa-user.js
+2
-1
qa-ajax-click-wall.php
qa-include/qa-ajax-click-wall.php
+1
-1
qa-ajax-wallpost.php
qa-include/qa-ajax-wallpost.php
+3
-2
qa-app-messages.php
qa-include/qa-app-messages.php
+11
-10
qa-base.php
qa-include/qa-base.php
+2
-2
qa-db-install.php
qa-include/qa-db-install.php
+12
-3
qa-page-admin-pages.php
qa-include/qa-page-admin-pages.php
+0
-7
qa-page-login.php
qa-include/qa-page-login.php
+5
-5
qa-page-user-answers.php
qa-include/qa-page-user-answers.php
+1
-0
qa-page-user-profile.php
qa-include/qa-page-user-profile.php
+4
-2
qa-page-user-wall.php
qa-include/qa-page-user-wall.php
+80
-2
qa-styles.css
qa-theme/Snow/qa-styles.css
+4
-3
qa-theme.php
qa-theme/Snow/qa-theme.php
+1
-1
No files found.
VERSION.txt
View file @
85a5f71e
1.6-beta-2
\ No newline at end of file
1.6
\ No newline at end of file
qa-content/qa-user.js
View file @
85a5f71e
...
...
@@ -22,13 +22,14 @@
More about this license: http://www.question2answer.org/license.php
*/
function
qa_submit_wall_post
(
elem
)
function
qa_submit_wall_post
(
elem
,
morelink
)
{
var
params
=
{};
params
.
message
=
document
.
forms
.
wallpost
.
message
.
value
;
params
.
handle
=
document
.
forms
.
wallpost
.
handle
.
value
;
params
.
code
=
document
.
forms
.
wallpost
.
code
.
value
;
params
.
morelink
=
morelink
?
1
:
0
;
qa_ajax_post
(
'wallpost'
,
params
,
function
(
lines
)
{
...
...
qa-include/qa-ajax-click-wall.php
View file @
85a5f71e
...
...
@@ -35,7 +35,7 @@
$usermessages
=
qa_db_select_with_pending
(
qa_db_recent_messages_selectspec
(
null
,
null
,
$tohandle
,
false
));
$loginuserid
=
qa_get_logged_in_userid
();
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
$loginuserid
);
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
0
,
$loginuserid
);
foreach
(
$usermessages
as
$message
)
if
(
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
)
&&
$message
[
'deleteable'
])
...
...
qa-include/qa-ajax-wallpost.php
View file @
85a5f71e
...
...
@@ -32,6 +32,7 @@
$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
();
...
...
@@ -47,7 +48,7 @@
$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
,
$loginuserid
);
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
0
,
$loginuserid
);
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'wall'
,
null
,
null
);
...
...
@@ -58,7 +59,7 @@
foreach
(
$usermessages
as
$message
)
$themeclass
->
message_item
(
qa_wall_post_view
(
$message
));
if
(
$
touseraccount
[
'wallposts'
]
>
count
(
$usermessages
))
if
(
$
morelink
&&
(
$touseraccount
[
'wallposts'
]
>
count
(
$usermessages
)
))
$themeclass
->
message_item
(
qa_wall_view_more_link
(
$tohandle
,
count
(
$usermessages
)));
}
...
...
qa-include/qa-app-messages.php
View file @
85a5f71e
...
...
@@ -117,31 +117,32 @@
}
function
qa_wall_posts_add_rules
(
$usermessages
,
$userid
)
function
qa_wall_posts_add_rules
(
$usermessages
,
$
start
,
$
userid
)
/*
Return the list of messages in $usermessages (as obtained via qa_db_recent_messages_selectspec()) with additional fields
indicating what actions can be performed on them by user $userid. Currently only 'deleteable' is relevant.
Return the list of messages in $usermessages (as obtained via qa_db_recent_messages_selectspec()) with additional
fields indicating what actions can be performed on them by user $userid. The messages are retrieved beginning at
offset $start in the database. Currently only 'deleteable' is relevant.
*/
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
$deleteable
=
isset
(
$userid
);
// can delete all
most recent messages...
$deleteable
=
(
$start
==
0
)
&&
isset
(
$userid
);
// can delete all of the
most recent messages...
foreach
(
$usermessages
as
$key
=>
$message
)
{
if
((
$message
[
'touserid'
]
!=
$userid
)
&&
(
$message
[
'fromuserid'
]
!=
$userid
))
$deleteable
=
false
;
// ... until we come across one that doesn't involve me
$usermessages
[
$key
][
'deleteable'
]
=
$deleteable
;
}
return
$usermessages
;
}
function
qa_wall_post_view
(
$message
)
/*
Returns an element to add to $qa_content['message_list']['messages'] for $message (as obtained via
qa_db_recent_messages_selectspec()
and then qa_wall_posts_add_rules()) where $userid is the identity of the user currently viewing the message
.
Returns an element to add to $qa_content['message_list']['messages'] for $message (as obtained via
qa_db_recent_messages_selectspec() and then qa_wall_posts_add_rules())
.
*/
{
require_once
QA_INCLUDE_DIR
.
'qa-app-format.php'
;
...
...
@@ -150,7 +151,7 @@
$htmlfields
=
qa_message_html_fields
(
$message
,
$options
);
if
(
@
$message
[
'deleteable'
])
if
(
$message
[
'deleteable'
])
$htmlfields
[
'form'
]
=
array
(
'style'
=>
'light'
,
...
...
qa-include/qa-base.php
View file @
85a5f71e
...
...
@@ -25,8 +25,8 @@
*/
define
(
'QA_VERSION'
,
'1.6
-beta-2
'
);
// also used as suffix for .js and .css requests
define
(
'QA_BUILD_DATE'
,
'2013-06-2
0
'
);
define
(
'QA_VERSION'
,
'1.6'
);
// also used as suffix for .js and .css requests
define
(
'QA_BUILD_DATE'
,
'2013-06-2
7
'
);
// Execution section of this file - remainder contains function definitions
...
...
qa-include/qa-db-install.php
View file @
85a5f71e
...
...
@@ -29,7 +29,7 @@
exit
;
}
define
(
'QA_DB_VERSION_CURRENT'
,
5
5
);
define
(
'QA_DB_VERSION_CURRENT'
,
5
6
);
function
qa_db_user_column_type_verify
()
...
...
@@ -259,7 +259,7 @@
'heading'
=>
'VARCHAR('
.
QA_DB_MAX_TITLE_LENGTH
.
')'
,
// for display within <h1> tags
'content'
=>
'MEDIUMTEXT'
,
// remainder of page HTML
'PRIMARY KEY (pageid)'
,
'
UNIQUE
tags (tags)'
,
'
KEY
tags (tags)'
,
'UNIQUE position (position)'
,
),
...
...
@@ -1363,7 +1363,9 @@
case
54
:
qa_db_upgrade_query
(
'UNLOCK TABLES'
);
qa_db_upgrade_query
(
'SET FOREIGN_KEY_CHECKS=0'
);
// in case InnoDB not available
qa_db_upgrade_query
(
qa_db_create_table_sql
(
'userlevels'
,
array
(
'userid'
=>
$definitions
[
'userlevels'
][
'userid'
],
'entitytype'
=>
$definitions
[
'userlevels'
][
'entitytype'
],
...
...
@@ -1397,6 +1399,13 @@
// Up to here: Version 1.6 beta 2
case
56
:
qa_db_upgrade_query
(
'ALTER TABLE ^pages DROP INDEX tags, ADD KEY tags (tags)'
);
qa_db_upgrade_query
(
$locktablesquery
);
break
;
// Up to here: Version 1.6 (release)
}
qa_db_set_db_version
(
$newversion
);
...
...
qa-include/qa-page-admin-pages.php
View file @
85a5f71e
...
...
@@ -149,13 +149,6 @@
$errors
[
'name'
]
=
qa_lang
(
'main/field_required'
);
elseif
(
qa_strlen
(
$inname
)
>
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
)
$errors
[
'name'
]
=
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_CAT_PAGE_TITLE_LENGTH
);
else
foreach
(
$pages
as
$page
)
if
(
(
$page
[
'pageid'
]
!=
@
$editpage
[
'pageid'
])
&&
qa_strtolower
(
$page
[
'title'
])
==
qa_strtolower
(
$inname
)
)
$errors
[
'name'
]
=
qa_lang
(
'admin/page_already_used'
);
if
(
$isexternal
)
{
...
...
qa-include/qa-page-login.php
View file @
85a5f71e
...
...
@@ -44,17 +44,17 @@
$passwordsent
=
qa_get
(
'ps'
);
$emailexists
=
qa_get
(
'ee'
);
if
(
qa_clicked
(
'dologin'
))
{
$inemailhandle
=
qa_post_text
(
'emailhandle'
);
$inpassword
=
qa_post_text
(
'password'
);
$inremember
=
qa_post_text
(
'remember'
);
if
(
qa_clicked
(
'dologin'
)
&&
(
strlen
(
$inemailhandle
)
||
strlen
(
$inpassword
))
)
{
require_once
QA_INCLUDE_DIR
.
'qa-app-limits.php'
;
if
(
qa_user_limits_remaining
(
QA_LIMIT_LOGINS
))
{
require_once
QA_INCLUDE_DIR
.
'qa-db-users.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-db-selects.php'
;
$inemailhandle
=
qa_post_text
(
'emailhandle'
);
$inpassword
=
qa_post_text
(
'password'
);
$inremember
=
qa_post_text
(
'remember'
);
if
(
!
qa_check_form_security_code
(
'login'
,
qa_post_text
(
'code'
)))
$pageerror
=
qa_lang_html
(
'misc/form_security_again'
);
...
...
qa-include/qa-page-user-answers.php
View file @
85a5f71e
...
...
@@ -87,6 +87,7 @@
$htmldefaults
[
'whoview'
]
=
false
;
$htmldefaults
[
'avatarsize'
]
=
0
;
$htmldefaults
[
'ovoteview'
]
=
true
;
$htmldefaults
[
'answersview'
]
=
false
;
foreach
(
$questions
as
$question
)
{
$options
=
qa_post_html_options
(
$question
,
$htmldefaults
);
...
...
qa-include/qa-page-user-profile.php
View file @
85a5f71e
...
...
@@ -111,9 +111,11 @@
$userediting
=
$usereditbutton
&&
(
qa_get_state
()
==
'edit'
);
$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
$usermessages
=
array_slice
(
$usermessages
,
0
,
qa_opt
(
'page_size_wall'
));
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
$loginuserid
);
$usermessages
=
qa_wall_posts_add_rules
(
$usermessages
,
0
,
$loginuserid
);
foreach
(
$usermessages
as
$message
)
if
(
$message
[
'deleteable'
]
&&
qa_clicked
(
'm'
.
$message
[
'messageid'
]
.
'_dodelete'
))
{
...
...
@@ -911,7 +913,7 @@
$qa_content
[
'message_list'
][
'form'
][
'buttons'
]
=
array
(
'post'
=>
array
(
'tags'
=>
'name="dowallpost" onclick="return qa_submit_wall_post(this);"'
,
'tags'
=>
'name="dowallpost" onclick="return qa_submit_wall_post(this
, true
);"'
,
'label'
=>
qa_lang_html
(
'profile/post_wall_button'
),
),
);
...
...
qa-include/qa-page-user-wall.php
View file @
85a5f71e
...
...
@@ -59,7 +59,43 @@
$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
,
$loginuserid
);
// Process deleting or adding a wall post (similar but not identical code to qq-page-user-profile.php)
$errors
=
array
();
$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'
)))
$errors
[
'page'
]
=
qa_lang_html
(
'misc/form_security_again'
);
else
{
qa_wall_delete_post
(
$loginuserid
,
qa_get_logged_in_handle
(),
qa_cookie_get
(),
$message
);
qa_redirect
(
qa_request
());
}
}
if
(
qa_clicked
(
'dowallpost'
))
{
$inmessage
=
qa_post_text
(
'message'
);
if
(
!
strlen
(
$inmessage
))
$errors
[
'message'
]
=
qa_lang
(
'profile/post_wall_empty'
);
elseif
(
!
qa_check_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
],
qa_post_text
(
'code'
)))
$errors
[
'message'
]
=
qa_lang_html
(
'misc/form_security_again'
);
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
...
...
@@ -67,11 +103,53 @@
$qa_content
=
qa_content_prepare
();
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/wall_for_x'
,
$userhtml
);
$qa_content
[
'message_list'
]
=
array
(
'messages'
=>
array
());
$qa_content
[
'error'
]
=@
$errors
[
'page'
];
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-user.js?'
.
QA_VERSION
;
$qa_content
[
'message_list'
]
=
array
(
'tags'
=>
'id="wallmessages"'
,
'form'
=>
array
(
'tags'
=>
'name="wallpost" method="post" action="'
.
qa_self_html
()
.
'"'
,
'style'
=>
'tall'
,
'hidden'
=>
array
(
'qa_click'
=>
''
,
// for simulating clicks in Javascript
),
),
'messages'
=>
array
(),
);
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
{
$qa_content
[
'message_list'
][
'form'
][
'fields'
]
=
array
(
'message'
=>
array
(
'tags'
=>
'name="message" id="message"'
,
'value'
=>
qa_html
(
@
$inmessage
,
false
),
'rows'
=>
2
,
'error'
=>
qa_html
(
@
$errors
[
'message'
]),
),
);
$qa_content
[
'message_list'
][
'form'
][
'buttons'
]
=
array
(
'post'
=>
array
(
'tags'
=>
'name="dowallpost" onclick="return qa_submit_wall_post(this, false);"'
,
'label'
=>
qa_lang_html
(
'profile/post_wall_button'
),
),
);
$qa_content
[
'message_list'
][
'form'
][
'hidden'
][
'handle'
]
=
qa_html
(
$useraccount
[
'handle'
]);
$qa_content
[
'message_list'
][
'form'
][
'hidden'
][
'code'
]
=
qa_get_form_security_code
(
'wall-'
.
$useraccount
[
'handle'
]);
}
}
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-theme/Snow/qa-styles.css
View file @
85a5f71e
...
...
@@ -2198,7 +2198,7 @@ background:url(images/a-count-icon-ie6.png) no-repeat 32px 13px;
.qa-template-user
.qa-part-form-activity
h2
{
margin-top
:
0
;
}
.qa-template-user
.qa-part-form-profile
{
.qa-template-user
.qa-part-form-profile
{
float
:
left
;
width
:
50%
;
min-height
:
630px
;
...
...
@@ -2207,13 +2207,14 @@ background:url(images/a-count-icon-ie6.png) no-repeat 32px 13px;
}
.qa-template-user
.qa-part-form-activity
,
.qa-template-user
.qa-part-message-list
,
.qa-template-user
.qa-part-form-profile
{
.qa-template-user
.qa-part-form-profile
{
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
box-sizing
:
border-box
;
overflow
:
hidden
;
}
.qa-template-user
.qa-part-message-list
.qa-form-tall-text
,
.qa-template-user
.qa-part-form-profile
.qa-form-wide-text
{
.qa-template-user
.qa-part-form-profile
.qa-form-wide-text
{
width
:
100%
!important
;
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
...
...
qa-theme/Snow/qa-theme.php
View file @
85a5f71e
...
...
@@ -25,7 +25,7 @@
$this
->
output
(
'<!--[Begin: login form]-->'
,
'<form id="qa-loginform" action="'
.
$login
[
'url'
]
.
'" method="post">'
,
'<input type="text" id="qa-userid" name="emailhandle" placeholder="'
.
trim
(
qa_lang_html
(
'users/email_handle_label'
),
':'
)
.
'" />'
,
'<input type="text" id="qa-userid" name="emailhandle" placeholder="'
.
trim
(
qa_lang_html
(
qa_opt
(
'allow_login_email_only'
)
?
'users/email_label'
:
'users/email_handle_label'
),
':'
)
.
'" />'
,
'<input type="password" id="qa-password" name="password" placeholder="'
.
trim
(
qa_lang_html
(
'users/password_label'
),
':'
)
.
'" />'
,
'<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>'
,
'<label for="qa-rememberme" id="qa-remember">'
.
qa_lang_html
(
'users/remember'
)
.
'</label></div>'
,
...
...
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