Commit 6b0c8daf by Scott

Coding style (strict): function signatures

parent 7737918c
...@@ -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'));
......
...@@ -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']);
} }
......
...@@ -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(
......
...@@ -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);
} }
......
...@@ -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;
......
...@@ -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"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment