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
6b0c8daf
Commit
6b0c8daf
authored
Jan 14, 2019
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (strict): function signatures
parent
7737918c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
28 deletions
+71
-28
UserPosts.php
qa-src/Controllers/User/UserPosts.php
+17
-6
UserProfile.php
qa-src/Controllers/User/UserProfile.php
+20
-6
UsersList.php
qa-src/Controllers/User/UsersList.php
+18
-10
DbConnection.php
qa-src/Database/DbConnection.php
+4
-2
ReindexContentPostReindex.php
qa-src/Recalc/ReindexContentPostReindex.php
+12
-2
ruleset-strict.xml
qa-tests/phpcs/ruleset-strict.xml
+0
-2
No files found.
qa-src/Controllers/User/UserPosts.php
View file @
6b0c8daf
...
@@ -94,8 +94,14 @@ class UserPosts extends \Q2A\Controllers\BaseController
...
@@ -94,8 +94,14 @@ class UserPosts extends \Q2A\Controllers\BaseController
$htmldefaults
[
'avatarsize'
]
=
0
;
$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
(),
$qa_content
[
'q_list'
][
'qs'
][]
=
qa_any_to_q_html_fields
(
$usershtml
,
null
,
array
(
'voteview'
=>
false
)
+
qa_post_html_options
(
$question
,
$htmldefaults
));
$question
,
$loginuserid
,
qa_cookie_get
(),
$usershtml
,
null
,
array
(
'voteview'
=>
false
)
+
qa_post_html_options
(
$question
,
$htmldefaults
)
);
}
}
...
@@ -171,8 +177,14 @@ class UserPosts extends \Q2A\Controllers\BaseController
...
@@ -171,8 +177,14 @@ class UserPosts extends \Q2A\Controllers\BaseController
$htmldefaults
[
'avatarsize'
]
=
0
;
$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
(),
$qa_content
[
'q_list'
][
'qs'
][]
=
qa_post_html_fields
(
$usershtml
,
null
,
qa_post_html_options
(
$question
,
$htmldefaults
));
$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'
));
...
@@ -256,8 +268,7 @@ class UserPosts extends \Q2A\Controllers\BaseController
...
@@ -256,8 +268,7 @@ class UserPosts extends \Q2A\Controllers\BaseController
$options
=
qa_post_html_options
(
$question
,
$htmldefaults
);
$options
=
qa_post_html_options
(
$question
,
$htmldefaults
);
$options
[
'voteview'
]
=
qa_get_vote_view
(
'A'
,
false
,
false
);
$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
(),
$qa_content
[
'q_list'
][
'qs'
][]
=
qa_other_to_q_html_fields
(
$question
,
$loginuserid
,
qa_cookie_get
(),
$usershtml
,
null
,
$options
);
$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'
));
...
...
qa-src/Controllers/User/UserProfile.php
View file @
6b0c8daf
...
@@ -363,8 +363,8 @@ class UserProfile extends \Q2A\Controllers\BaseController
...
@@ -363,8 +363,8 @@ class UserProfile extends \Q2A\Controllers\BaseController
$favoritemap
=
qa_get_favorite_non_qs_map
();
$favoritemap
=
qa_get_favorite_non_qs_map
();
$favorite
=
@
$favoritemap
[
'user'
][
$useraccount
[
'userid'
]];
$favorite
=
@
$favoritemap
[
'user'
][
$useraccount
[
'userid'
]];
$
qa_content
[
'favorite'
]
=
qa_favorite_form
(
QA_ENTITY_USER
,
$useraccount
[
'userid'
],
$favorite
,
$
title
=
qa_lang_sub
(
$favorite
?
'main/remove_x_favorites'
:
'users/add_user_x_favorites'
,
$handle
);
qa_lang_sub
(
$favorite
?
'main/remove_x_favorites'
:
'users/add_user_x_favorites'
,
$handle
)
);
$qa_content
[
'favorite'
]
=
qa_favorite_form
(
QA_ENTITY_USER
,
$useraccount
[
'userid'
],
$favorite
,
$title
);
}
}
...
@@ -384,8 +384,15 @@ class UserProfile extends \Q2A\Controllers\BaseController
...
@@ -384,8 +384,15 @@ class UserProfile extends \Q2A\Controllers\BaseController
'type'
=>
'image'
,
'type'
=>
'image'
,
'style'
=>
'tall'
,
'style'
=>
'tall'
,
'label'
=>
''
,
'label'
=>
''
,
'html'
=>
qa_get_user_avatar_html
(
$useraccount
[
'flags'
],
$useraccount
[
'email'
],
$useraccount
[
'handle'
],
'html'
=>
qa_get_user_avatar_html
(
$useraccount
[
'avatarblobid'
],
$useraccount
[
'avatarwidth'
],
$useraccount
[
'avatarheight'
],
qa_opt
(
'avatar_profile_size'
)),
$useraccount
[
'flags'
],
$useraccount
[
'email'
],
$useraccount
[
'handle'
],
$useraccount
[
'avatarblobid'
],
$useraccount
[
'avatarwidth'
],
$useraccount
[
'avatarheight'
],
qa_opt
(
'avatar_profile_size'
)
),
'id'
=>
'avatar'
,
'id'
=>
'avatar'
,
),
),
...
@@ -488,8 +495,15 @@ class UserProfile extends \Q2A\Controllers\BaseController
...
@@ -488,8 +495,15 @@ class UserProfile extends \Q2A\Controllers\BaseController
else
else
$fieldnavcategories
=
$navcategories
;
$fieldnavcategories
=
$navcategories
;
qa_set_up_category_field
(
$qa_content
,
$qa_content
[
'form_profile'
][
'fields'
][
'uc_'
.
$index
.
'_cat'
],
qa_set_up_category_field
(
'uc_'
.
$index
.
'_cat'
,
$fieldnavcategories
,
@
$userlevel
[
'entityid'
],
true
,
true
);
$qa_content
,
$qa_content
[
'form_profile'
][
'fields'
][
'uc_'
.
$index
.
'_cat'
],
'uc_'
.
$index
.
'_cat'
,
$fieldnavcategories
,
@
$userlevel
[
'entityid'
],
true
,
true
);
unset
(
$qa_content
[
'form_profile'
][
'fields'
][
'uc_'
.
$index
.
'_cat'
][
'note'
]);
unset
(
$qa_content
[
'form_profile'
][
'fields'
][
'uc_'
.
$index
.
'_cat'
][
'note'
]);
}
}
...
...
qa-src/Controllers/User/UsersList.php
View file @
6b0c8daf
...
@@ -44,13 +44,13 @@ class UsersList extends \Q2A\Controllers\BaseController
...
@@ -44,13 +44,13 @@ class UsersList extends \Q2A\Controllers\BaseController
public
function
top
()
public
function
top
()
{
{
// callables to fetch user data
// callables to fetch user data
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
return
array
(
return
array
(
qa_opt
(
'cache_userpointscount'
),
qa_opt
(
'cache_userpointscount'
),
qa_db_select_with_pending
(
qa_db_top_users_selectspec
(
$start
,
$pageSize
))
qa_db_select_with_pending
(
qa_db_top_users_selectspec
(
$start
,
$pageSize
))
);
);
};
};
$userScore
=
function
(
$user
)
{
$userScore
=
function
(
$user
)
{
return
qa_html
(
qa_format_number
(
$user
[
'points'
],
0
,
true
));
return
qa_html
(
qa_format_number
(
$user
[
'points'
],
0
,
true
));
};
};
...
@@ -79,13 +79,13 @@ class UsersList extends \Q2A\Controllers\BaseController
...
@@ -79,13 +79,13 @@ class UsersList extends \Q2A\Controllers\BaseController
}
}
// callables to fetch user data
// callables to fetch user data
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
return
array
(
return
array
(
qa_opt
(
'cache_userpointscount'
),
qa_opt
(
'cache_userpointscount'
),
qa_db_select_with_pending
(
qa_db_newest_users_selectspec
(
$start
,
$pageSize
))
qa_db_select_with_pending
(
qa_db_newest_users_selectspec
(
$start
,
$pageSize
))
);
);
};
};
$userDate
=
function
(
$user
)
{
$userDate
=
function
(
$user
)
{
$when
=
qa_when_to_html
(
$user
[
'created'
],
7
);
$when
=
qa_when_to_html
(
$user
[
'created'
],
7
);
return
$when
[
'data'
];
return
$when
[
'data'
];
};
};
...
@@ -115,12 +115,12 @@ class UsersList extends \Q2A\Controllers\BaseController
...
@@ -115,12 +115,12 @@ class UsersList extends \Q2A\Controllers\BaseController
}
}
// callables to fetch user data
// callables to fetch user data
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
// here we fetch *all* users to get the total instead of a separate query; there are unlikely to be many special users
// here we fetch *all* users to get the total instead of a separate query; there are unlikely to be many 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
));
return
array
(
count
(
$users
),
$users
);
return
array
(
count
(
$users
),
$users
);
};
};
$userLevel
=
function
(
$user
)
{
$userLevel
=
function
(
$user
)
{
return
qa_html
(
qa_user_level_string
(
$user
[
'level'
]));
return
qa_html
(
qa_user_level_string
(
$user
[
'level'
]));
};
};
...
@@ -140,7 +140,7 @@ class UsersList extends \Q2A\Controllers\BaseController
...
@@ -140,7 +140,7 @@ class UsersList extends \Q2A\Controllers\BaseController
public
function
blocked
()
public
function
blocked
()
{
{
// callables to fetch user data
// callables to fetch user data
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
$fetchUsers
=
function
(
$start
,
$pageSize
)
{
list
(
$totalUsers
,
$users
)
=
qa_db_select_with_pending
(
list
(
$totalUsers
,
$users
)
=
qa_db_select_with_pending
(
qa_db_selectspec_count
(
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
)),
qa_db_selectspec_count
(
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
)),
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
,
$start
,
$pageSize
)
qa_db_users_with_flag_selectspec
(
QA_USER_FLAGS_USER_BLOCKED
,
$start
,
$pageSize
)
...
@@ -148,7 +148,7 @@ class UsersList extends \Q2A\Controllers\BaseController
...
@@ -148,7 +148,7 @@ class UsersList extends \Q2A\Controllers\BaseController
return
array
(
$totalUsers
[
'count'
],
$users
);
return
array
(
$totalUsers
[
'count'
],
$users
);
};
};
$userLevel
=
function
(
$user
)
{
$userLevel
=
function
(
$user
)
{
return
qa_html
(
qa_user_level_string
(
$user
[
'level'
]));
return
qa_html
(
qa_user_level_string
(
$user
[
'level'
]));
};
};
...
@@ -197,8 +197,16 @@ class UsersList extends \Q2A\Controllers\BaseController
...
@@ -197,8 +197,16 @@ class UsersList extends \Q2A\Controllers\BaseController
if
(
QA_FINAL_EXTERNAL_USERS
)
{
if
(
QA_FINAL_EXTERNAL_USERS
)
{
$avatarHtml
=
qa_get_external_avatar_html
(
$user
[
'userid'
],
qa_opt
(
'avatar_users_size'
),
true
);
$avatarHtml
=
qa_get_external_avatar_html
(
$user
[
'userid'
],
qa_opt
(
'avatar_users_size'
),
true
);
}
else
{
}
else
{
$avatarHtml
=
qa_get_user_avatar_html
(
$user
[
'flags'
],
$user
[
'email'
],
$user
[
'handle'
],
$avatarHtml
=
qa_get_user_avatar_html
(
$user
[
'avatarblobid'
],
$user
[
'avatarwidth'
],
$user
[
'avatarheight'
],
qa_opt
(
'avatar_users_size'
),
true
);
$user
[
'flags'
],
$user
[
'email'
],
$user
[
'handle'
],
$user
[
'avatarblobid'
],
$user
[
'avatarwidth'
],
$user
[
'avatarheight'
],
qa_opt
(
'avatar_users_size'
),
true
);
}
}
$content
[
'ranking'
][
'items'
][]
=
array
(
$content
[
'ranking'
][
'items'
][]
=
array
(
...
...
qa-src/Database/DbConnection.php
View file @
6b0c8daf
...
@@ -144,7 +144,9 @@ class DbConnection
...
@@ -144,7 +144,9 @@ class DbConnection
}
else
{
}
else
{
echo
sprintf
(
echo
sprintf
(
'<hr><div style="color: red">Database %s<p>%s</p><code>%s</code></div>'
,
'<hr><div style="color: red">Database %s<p>%s</p><code>%s</code></div>'
,
htmlspecialchars
(
$type
.
' error '
.
$errno
),
nl2br
(
htmlspecialchars
(
$error
)),
nl2br
(
htmlspecialchars
(
$query
))
htmlspecialchars
(
$type
.
' error '
.
$errno
),
nl2br
(
htmlspecialchars
(
$error
)),
nl2br
(
htmlspecialchars
(
$query
))
);
);
qa_exit
(
'error'
);
qa_exit
(
'error'
);
}
}
...
@@ -467,7 +469,7 @@ class DbConnection
...
@@ -467,7 +469,7 @@ class DbConnection
*/
*/
public
function
applyTableSub
(
$query
)
public
function
applyTableSub
(
$query
)
{
{
return
preg_replace_callback
(
'/\^([A-Za-z_0-9]+)/'
,
function
(
$matches
)
{
return
preg_replace_callback
(
'/\^([A-Za-z_0-9]+)/'
,
function
(
$matches
)
{
return
$this
->
addTablePrefix
(
$matches
[
1
]);
return
$this
->
addTablePrefix
(
$matches
[
1
]);
},
$query
);
},
$query
);
}
}
...
...
qa-src/Recalc/ReindexContentPostReindex.php
View file @
6b0c8daf
...
@@ -39,8 +39,18 @@ class ReindexContentPostReindex extends AbstractStep
...
@@ -39,8 +39,18 @@ class ReindexContentPostReindex extends AbstractStep
foreach
(
$posts
as
$postid
=>
$post
)
{
foreach
(
$posts
as
$postid
=>
$post
)
{
qa_post_unindex
(
$postid
);
qa_post_unindex
(
$postid
);
qa_post_index
(
$postid
,
$post
[
'type'
],
$post
[
'questionid'
],
$post
[
'parentid'
],
$post
[
'title'
],
$post
[
'content'
],
qa_post_index
(
$post
[
'format'
],
qa_viewer_text
(
$post
[
'content'
],
$post
[
'format'
]),
$post
[
'tags'
],
$post
[
'categoryid'
]);
$postid
,
$post
[
'type'
],
$post
[
'questionid'
],
$post
[
'parentid'
],
$post
[
'title'
],
$post
[
'content'
],
$post
[
'format'
],
qa_viewer_text
(
$post
[
'content'
],
$post
[
'format'
]),
$post
[
'tags'
],
$post
[
'categoryid'
]
);
}
}
$this
->
state
->
next
=
1
+
$lastpostid
;
$this
->
state
->
next
=
1
+
$lastpostid
;
...
...
qa-tests/phpcs/ruleset-strict.xml
View file @
6b0c8daf
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
<exclude
name=
"Generic.ControlStructures.InlineControlStructure"
/>
<exclude
name=
"Generic.ControlStructures.InlineControlStructure"
/>
<exclude
name=
"Squiz.ControlStructures.ControlSignature"
/>
<!-- doesn't work without above rule -->
<exclude
name=
"Squiz.ControlStructures.ControlSignature"
/>
<!-- doesn't work without above rule -->
<exclude
name=
"Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"
/>
<exclude
name=
"Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"
/>
<exclude
name=
"PSR2.Methods.FunctionCallSignature"
/>
<exclude
name=
"Squiz.Functions.MultiLineFunctionDeclaration"
/>
</rule>
</rule>
<arg
name=
"tab-width"
value=
"4"
/>
<arg
name=
"tab-width"
value=
"4"
/>
...
...
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