Commit 69f0154b by Scott

Reformat code for users pages, tags page, and base theme

And normalize some line endings
parent e707b833
......@@ -35,49 +35,49 @@
// Get popular tags
$start=qa_get_start();
$userid=qa_get_logged_in_userid();
$populartags=qa_db_select_with_pending(
$start = qa_get_start();
$userid = qa_get_logged_in_userid();
$populartags = qa_db_select_with_pending(
qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags'))
);
$tagcount=qa_opt('cache_tagcount');
$pagesize=qa_opt('page_size_tags');
$tagcount = qa_opt('cache_tagcount');
$pagesize = qa_opt('page_size_tags');
// Prepare content for theme
$qa_content=qa_content_prepare();
$qa_content = qa_content_prepare();
$qa_content['title']=qa_lang_html('main/popular_tags');
$qa_content['title'] = qa_lang_html('main/popular_tags');
$qa_content['ranking']=array(
$qa_content['ranking'] = array(
'items' => array(),
'rows' => ceil($pagesize/qa_opt('columns_tags')),
'type' => 'tags'
);
if (count($populartags)) {
$favoritemap=qa_get_favorite_non_qs_map();
$favoritemap = qa_get_favorite_non_qs_map();
$output=0;
$output = 0;
foreach ($populartags as $word => $count) {
$qa_content['ranking']['items'][]=array(
$qa_content['ranking']['items'][] = array(
'label' => qa_tag_html($word, false, @$favoritemap['tag'][qa_strtolower($word)]),
'count' => number_format($count),
);
if ((++$output)>=$pagesize)
if ((++$output) >= $pagesize)
break;
}
} else
$qa_content['title']=qa_lang_html('main/no_tags_found');
$qa_content['title'] = qa_lang_html('main/no_tags_found');
$qa_content['page_links']=qa_html_page_links(qa_request(), $start, $pagesize, $tagcount, qa_opt('pages_prev_next'));
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagcount, qa_opt('pages_prev_next'));
if (empty($qa_content['page_links']))
$qa_content['suggest_next']=qa_html_suggest_ask();
$qa_content['suggest_next'] = qa_html_suggest_ask();
return $qa_content;
......
......@@ -42,44 +42,44 @@
// Get list of blocked users
$users=qa_db_select_with_pending(qa_db_users_with_flag_selectspec(QA_USER_FLAGS_USER_BLOCKED));
$users = qa_db_select_with_pending(qa_db_users_with_flag_selectspec(QA_USER_FLAGS_USER_BLOCKED));
// Check we have permission to view this page (moderator or above)
if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
$qa_content=qa_content_prepare();
$qa_content['error']=qa_lang_html('users/no_permission');
$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($users) ? qa_lang_html('users/blocked_users') : qa_lang_html('users/no_blocked_users');
$qa_content['title'] = count($users) ? 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')),
'type' => 'users'
);
foreach ($users as $user) {
$qa_content['ranking']['items'][]=array(
$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;
......
......@@ -42,44 +42,44 @@
// 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) {
$qa_content=qa_content_prepare();
$qa_content['error']=qa_lang_html('users/no_permission');
$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')),
'type' => 'users'
);
foreach ($users as $user) {
$qa_content['ranking']['items'][]=array(
$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;
......
......@@ -36,22 +36,22 @@
// 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')),
'type' => 'users'
......@@ -76,11 +76,11 @@
}
}
else
$qa_content['title']=qa_lang_html('main/no_active_users');
$qa_content['title'] = qa_lang_html('main/no_active_users');
$qa_content['page_links']=qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
$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();
$qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content;
......
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