Commit 69f0154b by Scott

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

And normalize some line endings
parent e707b833
<?php <?php
/* /*
Question2Answer (c) Gideon Greenspan Question2Answer (c) Gideon Greenspan
http://www.question2answer.org/ http://www.question2answer.org/
File: qa-include/qa-page-message.php File: qa-include/qa-page-message.php
Version: See define()s at top of qa-include/qa-base.php Version: See define()s at top of qa-include/qa-base.php
Description: Controller for private messaging page Description: Controller for private messaging page
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php More about this license: http://www.question2answer.org/license.php
*/ */
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../'); header('Location: ../');
exit; exit;
} }
require_once QA_INCLUDE_DIR.'qa-db-selects.php'; require_once QA_INCLUDE_DIR.'qa-db-selects.php';
require_once QA_INCLUDE_DIR.'qa-app-users.php'; require_once QA_INCLUDE_DIR.'qa-app-users.php';
require_once QA_INCLUDE_DIR.'qa-app-format.php'; require_once QA_INCLUDE_DIR.'qa-app-format.php';
require_once QA_INCLUDE_DIR.'qa-app-limits.php'; require_once QA_INCLUDE_DIR.'qa-app-limits.php';
$loginUserId = qa_get_logged_in_userid(); $loginUserId = qa_get_logged_in_userid();
// Check which box we're showing (inbox/sent), we're not using Q2A's single-sign on integration and that we're logged in // Check which box we're showing (inbox/sent), we're not using Q2A's single-sign on integration and that we're logged in
$showingInbox = qa_request_part(1) !== 'sent'; $showingInbox = qa_request_part(1) !== 'sent';
if (QA_FINAL_EXTERNAL_USERS) if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code'); qa_fatal_error('User accounts are handled by external code');
if (!isset($loginUserId)) { if (!isset($loginUserId)) {
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
$qa_content['error'] = qa_insert_login_links(qa_lang_html('misc/message_must_login'), qa_request()); $qa_content['error'] = qa_insert_login_links(qa_lang_html('misc/message_must_login'), qa_request());
return $qa_content; return $qa_content;
} }
if ( !qa_opt('allow_private_messages') ) if ( !qa_opt('allow_private_messages') )
return include QA_INCLUDE_DIR.'qa-page-not-found.php'; return include QA_INCLUDE_DIR.'qa-page-not-found.php';
// Find the user profile and questions and answers for this handle // Find the user profile and questions and answers for this handle
$pmSpec = $showingInbox $pmSpec = $showingInbox
? qa_db_messages_inbox_selectspec('private', $loginUserId, true) ? qa_db_messages_inbox_selectspec('private', $loginUserId, true)
: qa_db_messages_outbox_selectspec('private', $loginUserId, true); : qa_db_messages_outbox_selectspec('private', $loginUserId, true);
$userMessages = qa_db_select_with_pending($pmSpec); $userMessages = qa_db_select_with_pending($pmSpec);
// Prepare content for theme // Prepare content for theme
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
$qa_content['title'] = $showingInbox ? qa_lang_html('misc/pm_inbox_title') : qa_lang_html('misc/pm_outbox_title'); $qa_content['title'] = $showingInbox ? qa_lang_html('misc/pm_inbox_title') : qa_lang_html('misc/pm_outbox_title');
$qa_content['message_list'] = array( $qa_content['message_list'] = array(
'tags' => 'id="privatemessages"', 'tags' => 'id="privatemessages"',
'messages' => array(), 'messages' => array(),
); );
$htmlDefaults = qa_message_html_defaults(); $htmlDefaults = qa_message_html_defaults();
if (!$showingInbox) { if (!$showingInbox) {
$htmlDefaults['towhomview'] = true; $htmlDefaults['towhomview'] = true;
} }
foreach ($userMessages as $message) { foreach ($userMessages as $message) {
$qa_content['message_list']['messages'][] = qa_message_html_fields($message, $htmlDefaults); $qa_content['message_list']['messages'][] = qa_message_html_fields($message, $htmlDefaults);
} }
$qa_content['navigation']['sub'] = array( $qa_content['navigation']['sub'] = array(
'inbox' => array( 'inbox' => array(
'label' => qa_lang_html('misc/inbox'), 'label' => qa_lang_html('misc/inbox'),
'url' => qa_path_html('messages'), 'url' => qa_path_html('messages'),
'selected' => $showingInbox, 'selected' => $showingInbox,
), ),
'outbox' => array( 'outbox' => array(
'label' => qa_lang_html('misc/outbox'), 'label' => qa_lang_html('misc/outbox'),
'url' => qa_path_html('messages/sent'), 'url' => qa_path_html('messages/sent'),
'selected' => !$showingInbox, 'selected' => !$showingInbox,
) )
); );
return $qa_content; return $qa_content;
...@@ -35,49 +35,49 @@ ...@@ -35,49 +35,49 @@
// Get popular tags // Get popular tags
$start=qa_get_start(); $start = qa_get_start();
$userid=qa_get_logged_in_userid(); $userid = qa_get_logged_in_userid();
$populartags=qa_db_select_with_pending( $populartags = qa_db_select_with_pending(
qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags')) qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags'))
); );
$tagcount=qa_opt('cache_tagcount'); $tagcount = qa_opt('cache_tagcount');
$pagesize=qa_opt('page_size_tags'); $pagesize = qa_opt('page_size_tags');
// Prepare content for theme // 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(), 'items' => array(),
'rows' => ceil($pagesize/qa_opt('columns_tags')), 'rows' => ceil($pagesize/qa_opt('columns_tags')),
'type' => 'tags' 'type' => 'tags'
); );
if (count($populartags)) { 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) { 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)]), 'label' => qa_tag_html($word, false, @$favoritemap['tag'][qa_strtolower($word)]),
'count' => number_format($count), 'count' => number_format($count),
); );
if ((++$output)>=$pagesize) if ((++$output) >= $pagesize)
break; break;
} }
} else } 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'])) 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; return $qa_content;
......
...@@ -42,44 +42,44 @@ ...@@ -42,44 +42,44 @@
// Get list of blocked users // 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) // Check we have permission to view this page (moderator or above)
if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) { if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
$qa_content=qa_content_prepare(); $qa_content = qa_content_prepare();
$qa_content['error']=qa_lang_html('users/no_permission'); $qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content; return $qa_content;
} }
// Get userids and handles of retrieved users // Get userids and handles of retrieved users
$usershtml=qa_userids_handles_html($users); $usershtml = qa_userids_handles_html($users);
// Prepare content for theme // 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(), 'items' => array(),
'rows' => ceil(count($users)/qa_opt('columns_users')), 'rows' => ceil(count($users)/qa_opt('columns_users')),
'type' => 'users' 'type' => 'users'
); );
foreach ($users as $user) { foreach ($users as $user) {
$qa_content['ranking']['items'][]=array( $qa_content['ranking']['items'][] = array(
'label' => $usershtml[$user['userid']], 'label' => $usershtml[$user['userid']],
'score' => qa_html(qa_user_level_string($user['level'])), 'score' => qa_html(qa_user_level_string($user['level'])),
'raw' => $user, 'raw' => $user,
); );
} }
$qa_content['navigation']['sub']=qa_users_sub_navigation(); $qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content; return $qa_content;
......
...@@ -42,44 +42,44 @@ ...@@ -42,44 +42,44 @@
// Get list of special users // 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) // Check we have permission to view this page (moderator or above)
if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) { if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
$qa_content=qa_content_prepare(); $qa_content = qa_content_prepare();
$qa_content['error']=qa_lang_html('users/no_permission'); $qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content; return $qa_content;
} }
// Get userids and handles of retrieved users // Get userids and handles of retrieved users
$usershtml=qa_userids_handles_html($users); $usershtml = qa_userids_handles_html($users);
// Prepare content for theme // 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(), 'items' => array(),
'rows' => ceil(qa_opt('page_size_users')/qa_opt('columns_users')), 'rows' => ceil(qa_opt('page_size_users')/qa_opt('columns_users')),
'type' => 'users' 'type' => 'users'
); );
foreach ($users as $user) { foreach ($users as $user) {
$qa_content['ranking']['items'][]=array( $qa_content['ranking']['items'][] = array(
'label' => $usershtml[$user['userid']], 'label' => $usershtml[$user['userid']],
'score' => qa_html(qa_user_level_string($user['level'])), 'score' => qa_html(qa_user_level_string($user['level'])),
'raw' => $user, 'raw' => $user,
); );
} }
$qa_content['navigation']['sub']=qa_users_sub_navigation(); $qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content; return $qa_content;
......
...@@ -36,22 +36,22 @@ ...@@ -36,22 +36,22 @@
// Get list of all users // Get list of all users
$start=qa_get_start(); $start = qa_get_start();
$users=qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users'))); $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
$usercount=qa_opt('cache_userpointscount'); $usercount = qa_opt('cache_userpointscount');
$pagesize=qa_opt('page_size_users'); $pagesize = qa_opt('page_size_users');
$users=array_slice($users, 0, $pagesize); $users = array_slice($users, 0, $pagesize);
$usershtml=qa_userids_handles_html($users); $usershtml = qa_userids_handles_html($users);
// Prepare content for theme // 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(), 'items' => array(),
'rows' => ceil($pagesize/qa_opt('columns_users')), 'rows' => ceil($pagesize/qa_opt('columns_users')),
'type' => 'users' 'type' => 'users'
...@@ -76,11 +76,11 @@ ...@@ -76,11 +76,11 @@
} }
} }
else 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; return $qa_content;
......
<?php <?php
/** /**
* PHPMailer SPL autoloader. * PHPMailer SPL autoloader.
* PHP Version 5.0.0 * PHP Version 5.0.0
* @package PHPMailer * @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ * @link https://github.com/PHPMailer/PHPMailer/
* @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk> * @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2013 Marcus Bointon * @copyright 2013 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT * @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. * FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/** /**
* PHPMailer SPL autoloader. * PHPMailer SPL autoloader.
* @param string $classname The name of the class to load * @param string $classname The name of the class to load
*/ */
function PHPMailerAutoload($classname) function PHPMailerAutoload($classname)
{ {
//Can't use __DIR__ as it's only in PHP 5.3+ //Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) { if (is_readable($filename)) {
require $filename; require $filename;
} }
} }
if (version_compare(PHP_VERSION, '5.1.2', '>=')) { if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2 //SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true); spl_autoload_register('PHPMailerAutoload', true, true);
} else { } else {
spl_autoload_register('PHPMailerAutoload'); spl_autoload_register('PHPMailerAutoload');
} }
} else { } else {
/** /**
* Fall back to traditional autoload for old PHP versions * Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load * @param string $classname The name of the class to load
*/ */
function __autoload($classname) function __autoload($classname)
{ {
PHPMailerAutoload($classname); PHPMailerAutoload($classname);
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
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