Commit 1cacbd30 by Scott

Coding style (default admin page)

parent 14d54fd4
...@@ -20,31 +20,31 @@ ...@@ -20,31 +20,31 @@
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.'db/admin.php'; require_once QA_INCLUDE_DIR . 'db/admin.php';
require_once QA_INCLUDE_DIR.'db/maxima.php'; require_once QA_INCLUDE_DIR . 'db/maxima.php';
require_once QA_INCLUDE_DIR.'db/selects.php'; require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR.'app/options.php'; require_once QA_INCLUDE_DIR . 'app/options.php';
require_once QA_INCLUDE_DIR.'app/admin.php'; require_once QA_INCLUDE_DIR . 'app/admin.php';
// Pages handled by this controller: general, emails, users, layout, viewing, lists, posting, permissions, feeds, spam, caching, mailing // Pages handled by this controller: general, emails, users, layout, viewing, lists, posting, permissions, feeds, spam, caching, mailing
$adminsection = strtolower(qa_request_part(1)); $adminsection = strtolower(qa_request_part(1));
// Get list of categories and all options // Get list of categories and all options
$categories = qa_db_select_with_pending(qa_db_category_nav_selectspec(null, true)); $categories = qa_db_select_with_pending(qa_db_category_nav_selectspec(null, true));
// See if we need to redirect // See if we need to redirect
if (empty($adminsection)) { if (empty($adminsection)) {
$subnav = qa_admin_sub_navigation(); $subnav = qa_admin_sub_navigation();
if (isset($subnav[@$_COOKIE['qa_admin_last']])) if (isset($subnav[@$_COOKIE['qa_admin_last']]))
...@@ -53,18 +53,18 @@ ...@@ -53,18 +53,18 @@
reset($subnav); reset($subnav);
qa_redirect(key($subnav)); qa_redirect(key($subnav));
} }
} }
// Check admin privileges (do late to allow one DB query) // Check admin privileges (do late to allow one DB query)
if (!qa_admin_check_privileges($qa_content)) if (!qa_admin_check_privileges($qa_content))
return $qa_content; return $qa_content;
// For non-text options, lists of option types, minima and maxima // For non-text options, lists of option types, minima and maxima
$optiontype = array( $optiontype = array(
'avatar_message_list_size' => 'number', 'avatar_message_list_size' => 'number',
'avatar_profile_size' => 'number', 'avatar_profile_size' => 'number',
'avatar_q_list_size' => 'number', 'avatar_q_list_size' => 'number',
...@@ -233,9 +233,9 @@ ...@@ -233,9 +233,9 @@
'voting_on_qs' => 'checkbox', 'voting_on_qs' => 'checkbox',
'smtp_password' => 'password', 'smtp_password' => 'password',
); );
$optionmaximum = array( $optionmaximum = array(
'feed_number_items' => QA_DB_RETRIEVE_QS_AS, 'feed_number_items' => QA_DB_RETRIEVE_QS_AS,
'max_len_q_title' => QA_DB_MAX_TITLE_LENGTH, 'max_len_q_title' => QA_DB_MAX_TITLE_LENGTH,
'page_size_activity' => QA_DB_RETRIEVE_QS_AS, 'page_size_activity' => QA_DB_RETRIEVE_QS_AS,
...@@ -252,9 +252,9 @@ ...@@ -252,9 +252,9 @@
'page_size_una_qs' => QA_DB_RETRIEVE_QS_AS, 'page_size_una_qs' => QA_DB_RETRIEVE_QS_AS,
'page_size_users' => QA_DB_RETRIEVE_USERS, 'page_size_users' => QA_DB_RETRIEVE_USERS,
'page_size_wall' => QA_DB_RETRIEVE_MESSAGES, 'page_size_wall' => QA_DB_RETRIEVE_MESSAGES,
); );
$optionminimum = array( $optionminimum = array(
'flagging_hide_after' => 2, 'flagging_hide_after' => 2,
'flagging_notify_every' => 1, 'flagging_notify_every' => 1,
'flagging_notify_first' => 1, 'flagging_notify_first' => 1,
...@@ -276,19 +276,19 @@ ...@@ -276,19 +276,19 @@
'page_size_tags' => 1, 'page_size_tags' => 1,
'page_size_users' => 1, 'page_size_users' => 1,
'page_size_wall' => 1, 'page_size_wall' => 1,
); );
// Define the options to show (and some other visual stuff) based on request // Define the options to show (and some other visual stuff) based on request
$formstyle = 'tall'; $formstyle = 'tall';
$checkboxtodisplay = null; $checkboxtodisplay = null;
$maxpermitpost = max(qa_opt('permit_post_q'), qa_opt('permit_post_a')); $maxpermitpost = max(qa_opt('permit_post_q'), qa_opt('permit_post_a'));
if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) if (qa_opt('comment_on_qs') || qa_opt('comment_on_as'))
$maxpermitpost = max($maxpermitpost, qa_opt('permit_post_c')); $maxpermitpost = max($maxpermitpost, qa_opt('permit_post_c'));
switch ($adminsection) { switch ($adminsection) {
case 'general': case 'general':
$subtitle = 'admin/general_title'; $subtitle = 'admin/general_title';
$showoptions = array('site_title', 'site_url', 'neat_urls', 'site_language', 'site_theme', 'site_theme_mobile', 'site_text_direction', 'tags_or_categories', 'site_maintenance'); $showoptions = array('site_title', 'site_url', 'neat_urls', 'site_language', 'site_theme', 'site_theme_mobile', 'site_text_direction', 'tags_or_categories', 'site_maintenance');
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
$showoptions = array('show_notice_visitor', 'notice_visitor'); $showoptions = array('show_notice_visitor', 'notice_visitor');
if (!QA_FINAL_EXTERNAL_USERS) { if (!QA_FINAL_EXTERNAL_USERS) {
require_once QA_INCLUDE_DIR.'util/image.php'; require_once QA_INCLUDE_DIR . 'util/image.php';
array_push($showoptions, 'show_custom_register', 'custom_register', 'show_register_terms', 'register_terms', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome', array_push($showoptions, 'show_custom_register', 'custom_register', 'show_register_terms', 'register_terms', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome',
'', 'allow_login_email_only', 'allow_change_usernames', 'register_notify_admin', 'suspend_register_users', '', 'allow_login_email_only', 'allow_change_usernames', 'register_notify_admin', 'suspend_register_users',
...@@ -347,7 +347,7 @@ ...@@ -347,7 +347,7 @@
'avatar_default_show' => 'option_avatar_allow_gravatar || option_avatar_allow_upload', 'avatar_default_show' => 'option_avatar_allow_gravatar || option_avatar_allow_upload',
); );
if (!QA_FINAL_EXTERNAL_USERS) if (!QA_FINAL_EXTERNAL_USERS) {
$checkboxtodisplay = array_merge($checkboxtodisplay, array( $checkboxtodisplay = array_merge($checkboxtodisplay, array(
'page_size_pms' => 'option_allow_private_messages && option_show_message_history', 'page_size_pms' => 'option_allow_private_messages && option_show_message_history',
'page_size_wall' => 'option_allow_user_walls', 'page_size_wall' => 'option_allow_user_walls',
...@@ -359,6 +359,7 @@ ...@@ -359,6 +359,7 @@
'avatar_q_list_size' => 'option_avatar_allow_gravatar || option_avatar_allow_upload', 'avatar_q_list_size' => 'option_avatar_allow_gravatar || option_avatar_allow_upload',
'avatar_message_list_size' => 'option_allow_private_messages || option_allow_user_walls', 'avatar_message_list_size' => 'option_allow_private_messages || option_allow_user_walls',
)); ));
}
$formstyle = 'wide'; $formstyle = 'wide';
break; break;
...@@ -465,7 +466,7 @@ ...@@ -465,7 +466,7 @@
$showoptions = array('do_close_on_select', 'allow_close_questions', 'allow_self_answer', 'allow_multi_answers', 'follow_on_as', 'comment_on_qs', 'comment_on_as', ''); $showoptions = array('do_close_on_select', 'allow_close_questions', 'allow_self_answer', 'allow_multi_answers', 'follow_on_as', 'comment_on_qs', 'comment_on_as', '');
if (count(qa_list_modules('editor'))>1) if (count(qa_list_modules('editor')) > 1)
array_push($showoptions, 'editor_for_qs', 'editor_for_as', 'editor_for_cs', ''); array_push($showoptions, 'editor_for_qs', 'editor_for_as', 'editor_for_cs', '');
array_push($showoptions, 'show_custom_ask', 'custom_ask', 'extra_field_active', 'extra_field_prompt', 'extra_field_display', 'extra_field_label', 'show_custom_answer', 'custom_answer', 'show_custom_comment', 'custom_comment', ''); array_push($showoptions, 'show_custom_ask', 'custom_ask', 'extra_field_active', 'extra_field_prompt', 'extra_field_display', 'extra_field_label', 'show_custom_answer', 'custom_answer', 'show_custom_comment', 'custom_comment', '');
...@@ -516,13 +517,12 @@ ...@@ -516,13 +517,12 @@
if ($permitoption == 'permit_view_q_page') { if ($permitoption == 'permit_view_q_page') {
$showoptions[] = 'allow_view_q_bots'; $showoptions[] = 'allow_view_q_bots';
$checkboxtodisplay['allow_view_q_bots'] = 'option_permit_view_q_page<'.qa_js(QA_PERMIT_ALL); $checkboxtodisplay['allow_view_q_bots'] = 'option_permit_view_q_page<' . qa_js(QA_PERMIT_ALL);
} } else {
else { $showoptions[] = $permitoption . '_points';
$showoptions[] = $permitoption.'_points'; $checkboxtodisplay[$permitoption . '_points'] = '(option_' . $permitoption . '==' . qa_js(QA_PERMIT_POINTS) .
$checkboxtodisplay[$permitoption.'_points'] = '(option_'.$permitoption.'=='.qa_js(QA_PERMIT_POINTS). ')||(option_' . $permitoption . '==' . qa_js(QA_PERMIT_POINTS_CONFIRMED) . ')||(option_' . $permitoption . '==' . qa_js(QA_PERMIT_APPROVED_POINTS) . ')';
')||(option_'.$permitoption.'=='.qa_js(QA_PERMIT_POINTS_CONFIRMED).')||(option_'.$permitoption.'=='.qa_js(QA_PERMIT_APPROVED_POINTS).')';
} }
} }
...@@ -652,7 +652,7 @@ ...@@ -652,7 +652,7 @@
break; break;
case 'mailing': case 'mailing':
require_once QA_INCLUDE_DIR.'app/mailing.php'; require_once QA_INCLUDE_DIR . 'app/mailing.php';
$subtitle = 'admin/mailing_title'; $subtitle = 'admin/mailing_title';
...@@ -663,37 +663,39 @@ ...@@ -663,37 +663,39 @@
$pagemodules = qa_load_modules_with('page', 'match_request'); $pagemodules = qa_load_modules_with('page', 'match_request');
$request = qa_request(); $request = qa_request();
foreach ($pagemodules as $pagemodule) foreach ($pagemodules as $pagemodule) {
if ($pagemodule->match_request($request)) if ($pagemodule->match_request($request))
return $pagemodule->process_request($request); return $pagemodule->process_request($request);
}
return include QA_INCLUDE_DIR.'qa-page-not-found.php'; return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
break; break;
} }
// Filter out blanks to get list of valid options // Filter out blanks to get list of valid options
$getoptions = array(); $getoptions = array();
foreach ($showoptions as $optionname) foreach ($showoptions as $optionname) {
if (strlen($optionname) && (strpos($optionname, '/') === false)) // empties represent spacers in forms if (strlen($optionname) && (strpos($optionname, '/') === false)) // empties represent spacers in forms
$getoptions[] = $optionname; $getoptions[] = $optionname;
}
// Process user actions // Process user actions
$errors = array(); $errors = array();
$recalchotness = false; $recalchotness = false;
$startmailing = false; $startmailing = false;
$securityexpired = false; $securityexpired = false;
$formokhtml = null; $formokhtml = null;
// If the post_max_size is exceeded then the $_POST array is empty so no field processing can be done // If the post_max_size is exceeded then the $_POST array is empty so no field processing can be done
if (qa_post_limit_exceeded()) if (qa_post_limit_exceeded())
$errors['avatar_default_show'] = qa_lang('main/file_upload_limit_exceeded'); $errors['avatar_default_show'] = qa_lang('main/file_upload_limit_exceeded');
else else {
if (qa_clicked('doresetoptions')) { if (qa_clicked('doresetoptions')) {
if (!qa_check_form_security_code('admin/' . $adminsection, qa_post_text('code'))) if (!qa_check_form_security_code('admin/' . $adminsection, qa_post_text('code')))
$securityexpired = true; $securityexpired = true;
...@@ -711,11 +713,11 @@ ...@@ -711,11 +713,11 @@
$optionvalue = qa_post_text('option_' . $optionname); $optionvalue = qa_post_text('option_' . $optionname);
if ( if (
(@$optiontype[$optionname] == 'number') || @$optiontype[$optionname] == 'number' ||
(@$optiontype[$optionname] == 'checkbox') || @$optiontype[$optionname] == 'checkbox' ||
((@$optiontype[$optionname] == 'number-blank') && strlen($optionvalue)) (@$optiontype[$optionname] == 'number-blank' && strlen($optionvalue))
) )
$optionvalue = (int) $optionvalue; $optionvalue = (int)$optionvalue;
if (isset($optionmaximum[$optionname])) if (isset($optionmaximum[$optionname]))
$optionvalue = min($optionmaximum[$optionname], $optionvalue); $optionvalue = min($optionmaximum[$optionname], $optionvalue);
...@@ -739,12 +741,12 @@ ...@@ -739,12 +741,12 @@
break; break;
case 'block_ips_write': case 'block_ips_write':
require_once QA_INCLUDE_DIR.'app/limits.php'; require_once QA_INCLUDE_DIR . 'app/limits.php';
$optionvalue = implode(' , ', qa_block_ips_explode($optionvalue)); $optionvalue = implode(' , ', qa_block_ips_explode($optionvalue));
break; break;
case 'block_bad_words': case 'block_bad_words':
require_once QA_INCLUDE_DIR.'util/string.php'; require_once QA_INCLUDE_DIR . 'util/string.php';
$optionvalue = implode(' , ', qa_block_words_explode($optionvalue)); $optionvalue = implode(' , ', qa_block_words_explode($optionvalue));
break; break;
} }
...@@ -759,23 +761,22 @@ ...@@ -759,23 +761,22 @@
$avatarfileerror = $_FILES['avatar_default_file']['error']; $avatarfileerror = $_FILES['avatar_default_file']['error'];
// Note if $_FILES['avatar_default_file']['error'] === 1 then upload_max_filesize has been exceeded // Note if $_FILES['avatar_default_file']['error'] === 1 then upload_max_filesize has been exceeded
if ($avatarfileerror === 1) if ($avatarfileerror === 1) {
$errors['avatar_default_show'] = qa_lang('main/file_upload_limit_exceeded'); $errors['avatar_default_show'] = qa_lang('main/file_upload_limit_exceeded');
elseif ($avatarfileerror === 0 && $_FILES['avatar_default_file']['size'] > 0) { } elseif ($avatarfileerror === 0 && $_FILES['avatar_default_file']['size'] > 0) {
require_once QA_INCLUDE_DIR.'util/image.php'; require_once QA_INCLUDE_DIR . 'util/image.php';
$oldblobid = qa_opt('avatar_default_blobid'); $oldblobid = qa_opt('avatar_default_blobid');
$toobig = qa_image_file_too_big($_FILES['avatar_default_file']['tmp_name'], qa_opt('avatar_store_size')); $toobig = qa_image_file_too_big($_FILES['avatar_default_file']['tmp_name'], qa_opt('avatar_store_size'));
if ($toobig) if ($toobig) {
$errors['avatar_default_show'] = qa_lang_sub('main/image_too_big_x_pc', (int) ($toobig * 100)); $errors['avatar_default_show'] = qa_lang_sub('main/image_too_big_x_pc', (int)($toobig * 100));
} else {
else {
$imagedata = qa_image_constrain_data(file_get_contents($_FILES['avatar_default_file']['tmp_name']), $width, $height, qa_opt('avatar_store_size')); $imagedata = qa_image_constrain_data(file_get_contents($_FILES['avatar_default_file']['tmp_name']), $width, $height, qa_opt('avatar_store_size'));
if (isset($imagedata)) { if (isset($imagedata)) {
require_once QA_INCLUDE_DIR.'app/blobs.php'; require_once QA_INCLUDE_DIR . 'app/blobs.php';
$newblobid = qa_create_blob($imagedata, 'jpeg'); $newblobid = qa_create_blob($imagedata, 'jpeg');
...@@ -788,23 +789,24 @@ ...@@ -788,23 +789,24 @@
if (strlen($oldblobid)) if (strlen($oldblobid))
qa_delete_blob($oldblobid); qa_delete_blob($oldblobid);
} else } else {
$errors['avatar_default_show'] = qa_lang_sub('main/image_not_read', implode(', ', qa_gd_image_formats())); $errors['avatar_default_show'] = qa_lang_sub('main/image_not_read', implode(', ', qa_gd_image_formats()));
} }
} }
} }
} }
} }
}
}
// Mailings management // Mailings management
if ($adminsection == 'mailing') { if ($adminsection == 'mailing') {
if ( qa_clicked('domailingtest') || qa_clicked('domailingstart') || qa_clicked('domailingresume') || qa_clicked('domailingcancel') ) { if (qa_clicked('domailingtest') || qa_clicked('domailingstart') || qa_clicked('domailingresume') || qa_clicked('domailingcancel')) {
if (!qa_check_form_security_code('admin/'.$adminsection, qa_post_text('code'))) if (!qa_check_form_security_code('admin/' . $adminsection, qa_post_text('code'))) {
$securityexpired = true; $securityexpired = true;
} else {
else {
if (qa_clicked('domailingtest')) { if (qa_clicked('domailingtest')) {
$email = qa_get_logged_in_email(); $email = qa_get_logged_in_email();
...@@ -836,8 +838,7 @@ ...@@ -836,8 +838,7 @@
'mailing_enabled' => '0', 'mailing_enabled' => '0',
); );
} } else {
else {
$checkboxtodisplay = array( $checkboxtodisplay = array(
'mailing_from_name' => 'option_mailing_enabled', 'mailing_from_name' => 'option_mailing_enabled',
'mailing_from_email' => 'option_mailing_enabled', 'mailing_from_email' => 'option_mailing_enabled',
...@@ -848,27 +849,27 @@ ...@@ -848,27 +849,27 @@
'domailingstart' => 'option_mailing_enabled', 'domailingstart' => 'option_mailing_enabled',
); );
} }
} }
// Get the actual options // Get the actual options
$options = qa_get_options($getoptions); $options = qa_get_options($getoptions);
// Prepare content for theme // Prepare content for theme
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title').' - '.qa_lang_html($subtitle); $qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html($subtitle);
$qa_content['error'] = $securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error(); $qa_content['error'] = $securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error();
$qa_content['script_rel'][] = 'qa-content/qa-admin.js?'.QA_VERSION; $qa_content['script_rel'][] = 'qa-content/qa-admin.js?' . QA_VERSION;
$qa_content['form'] = array( $qa_content['form'] = array(
'ok' => $formokhtml, 'ok' => $formokhtml,
'tags' => 'method="post" action="'.qa_self_html().'" name="admin_form" onsubmit="document.forms.admin_form.has_js.value=1; return true;"', 'tags' => 'method="post" action="' . qa_self_html() . '" name="admin_form" onsubmit="document.forms.admin_form.has_js.value=1; return true;"',
'style' => $formstyle, 'style' => $formstyle,
...@@ -881,7 +882,7 @@ ...@@ -881,7 +882,7 @@
), ),
'reset' => array( 'reset' => array(
'tags' => 'name="doresetoptions" onclick="return confirm('.qa_js(qa_lang_html('admin/reset_options_confirm')).');"', 'tags' => 'name="doresetoptions" onclick="return confirm(' . qa_js(qa_lang_html('admin/reset_options_confirm')) . ');"',
'label' => qa_lang_html('admin/reset_options_button'), 'label' => qa_lang_html('admin/reset_options_button'),
), ),
), ),
...@@ -889,11 +890,11 @@ ...@@ -889,11 +890,11 @@
'hidden' => array( 'hidden' => array(
'dosaveoptions' => '1', // for IE 'dosaveoptions' => '1', // for IE
'has_js' => '0', 'has_js' => '0',
'code' => qa_get_form_security_code('admin/'.$adminsection), 'code' => qa_get_form_security_code('admin/' . $adminsection),
), ),
); );
if ($recalchotness) { if ($recalchotness) {
$qa_content['form']['ok'] = '<span id="recalc_ok"></span>'; $qa_content['form']['ok'] = '<span id="recalc_ok"></span>';
$qa_content['form']['hidden']['code_recalc'] = qa_get_form_security_code('admin/recalc'); $qa_content['form']['hidden']['code_recalc'] = qa_get_form_security_code('admin/recalc');
...@@ -903,18 +904,16 @@ ...@@ -903,18 +904,16 @@
"qa_recalc_click('dorecountposts', document.getElementById('dosaveoptions'), null, 'recalc_ok');" "qa_recalc_click('dorecountposts', document.getElementById('dosaveoptions'), null, 'recalc_ok');"
); );
} } elseif ($startmailing) {
elseif ($startmailing) {
if (qa_post_text('has_js')) { if (qa_post_text('has_js')) {
$qa_content['form']['ok'] = '<span id="mailing_ok">'.qa_html($mailingprogress).'</span>'; $qa_content['form']['ok'] = '<span id="mailing_ok">' . qa_html($mailingprogress) . '</span>';
$qa_content['script_onloads'][] = array( $qa_content['script_onloads'][] = array(
"qa_mailing_start('mailing_ok', 'domailingpause');" "qa_mailing_start('mailing_ok', 'domailingpause');"
); );
} } else { // rudimentary non-Javascript version of mass mailing loop
else { // rudimentary non-Javascript version of mass mailing loop
echo '<tt>'; echo '<tt>';
while (true) { while (true) {
...@@ -925,29 +924,29 @@ ...@@ -925,29 +924,29 @@
if (!isset($message)) if (!isset($message))
break; break;
echo qa_html($message).str_repeat(' ', 1024)."<br>\n"; echo qa_html($message) . str_repeat(' ', 1024) . "<br>\n";
flush(); flush();
sleep(1); sleep(1);
} }
echo qa_lang_html('admin/mailing_complete').'</tt><p><a href="'.qa_path_html('admin/mailing').'">'.qa_lang_html('admin/admin_title').' - '.qa_lang_html('admin/mailing_title').'</a>'; echo qa_lang_html('admin/mailing_complete') . '</tt><p><a href="' . qa_path_html('admin/mailing') . '">' . qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/mailing_title') . '</a>';
qa_exit(); qa_exit();
} }
} }
function qa_optionfield_make_select(&$optionfield, $options, $value, $default) function qa_optionfield_make_select(&$optionfield, $options, $value, $default)
{ {
$optionfield['type'] = 'select'; $optionfield['type'] = 'select';
$optionfield['options'] = $options; $optionfield['options'] = $options;
$optionfield['value'] = isset($options[qa_html($value)]) ? $options[qa_html($value)] : @$options[$default]; $optionfield['value'] = isset($options[qa_html($value)]) ? $options[qa_html($value)] : @$options[$default];
} }
$indented = false; $indented = false;
foreach ($showoptions as $optionname) foreach ($showoptions as $optionname) {
if (empty($optionname)) { if (empty($optionname)) {
$indented = false; $indented = false;
...@@ -955,8 +954,7 @@ ...@@ -955,8 +954,7 @@
'type' => 'blank' 'type' => 'blank'
); );
} } elseif (strpos($optionname, '/') !== false) {
elseif (strpos($optionname, '/') !== false) {
$qa_content['form']['fields'][] = array( $qa_content['form']['fields'][] = array(
'type' => 'static', 'type' => 'static',
'label' => qa_lang_html($optionname), 'label' => qa_lang_html($optionname),
...@@ -964,8 +962,7 @@ ...@@ -964,8 +962,7 @@
$indented = true; $indented = true;
} } else {
else {
$type = @$optiontype[$optionname]; $type = @$optiontype[$optionname];
if ($type == 'number-blank') if ($type == 'number-blank')
$type = 'number'; $type = 'number';
...@@ -974,8 +971,8 @@ ...@@ -974,8 +971,8 @@
$optionfield = array( $optionfield = array(
'id' => $optionname, 'id' => $optionname,
'label' => ($indented ? '&ndash; ' : '').qa_lang_html('options/'.$optionname), 'label' => ($indented ? '&ndash; ' : '') . qa_lang_html('options/' . $optionname),
'tags' => 'name="option_'.$optionname.'" id="option_'.$optionname.'"', 'tags' => 'name="option_' . $optionname . '" id="option_' . $optionname . '"',
'value' => qa_html($value), 'value' => qa_html($value),
'type' => $type, 'type' => $type,
'error' => qa_html(@$errors[$optionname]), 'error' => qa_html(@$errors[$optionname]),
...@@ -989,12 +986,12 @@ ...@@ -989,12 +986,12 @@
switch ($optionname) { // special treatment for certain options switch ($optionname) { // special treatment for certain options
case 'site_language': case 'site_language':
require_once QA_INCLUDE_DIR.'util/string.php'; require_once QA_INCLUDE_DIR . 'util/string.php';
qa_optionfield_make_select($optionfield, qa_admin_language_options(), $value, ''); qa_optionfield_make_select($optionfield, qa_admin_language_options(), $value, '');
$optionfield['suffix'] = strtr(qa_lang_html('admin/check_language_suffix'), array( $optionfield['suffix'] = strtr(qa_lang_html('admin/check_language_suffix'), array(
'^1' => '<a href="'.qa_html(qa_path_to_root().'qa-include/qa-check-lang.php').'">', '^1' => '<a href="' . qa_html(qa_path_to_root() . 'qa-include/qa-check-lang.php') . '">',
'^2' => '</a>', '^2' => '</a>',
)); ));
...@@ -1015,20 +1012,20 @@ ...@@ -1015,20 +1012,20 @@
foreach ($rawoptions as $rawoption) { foreach ($rawoptions as $rawoption) {
$neatoptions[$rawoption] = $neatoptions[$rawoption] =
'<iframe src="'.qa_path_html('url/test/'.QA_URL_TEST_STRING, array('dummy' => '', 'param' => QA_URL_TEST_STRING), null, $rawoption).'" width="20" height="16" style="vertical-align:middle; border:0" scrolling="no" frameborder="0"></iframe>&nbsp;'. '<iframe src="' . qa_path_html('url/test/' . QA_URL_TEST_STRING, array('dummy' => '', 'param' => QA_URL_TEST_STRING), null, $rawoption) . '" width="20" height="16" style="vertical-align:middle; border:0" scrolling="no" frameborder="0"></iframe>&nbsp;' .
'<small>'. '<small>' .
qa_html(urldecode(qa_path('123/why-do-birds-sing', null, '/', $rawoption))). qa_html(urldecode(qa_path('123/why-do-birds-sing', null, '/', $rawoption))) .
(($rawoption == QA_URL_FORMAT_NEAT) ? strtr(qa_lang_html('admin/neat_urls_note'), array( (($rawoption == QA_URL_FORMAT_NEAT) ? strtr(qa_lang_html('admin/neat_urls_note'), array(
'^1' => '<a href="http://www.question2answer.org/htaccess.php" target="_blank">', '^1' => '<a href="http://www.question2answer.org/htaccess.php" target="_blank">',
'^2' => '</a>', '^2' => '</a>',
)) : ''). )) : '') .
'</small>'; '</small>';
} }
qa_optionfield_make_select($optionfield, $neatoptions, $value, QA_URL_FORMAT_SAFEST); qa_optionfield_make_select($optionfield, $neatoptions, $value, QA_URL_FORMAT_SAFEST);
$optionfield['type'] = 'select-radio'; $optionfield['type'] = 'select-radio';
$optionfield['note'] = qa_lang_html_sub('admin/url_format_note', '<span style=" '.qa_admin_url_test_html().'/span>'); $optionfield['note'] = qa_lang_html_sub('admin/url_format_note', '<span style=" ' . qa_admin_url_test_html() . '/span>');
break; break;
case 'site_theme': case 'site_theme':
...@@ -1049,7 +1046,7 @@ ...@@ -1049,7 +1046,7 @@
} }
if (strlen(@$metadata['version'])) if (strlen(@$metadata['version']))
$namehtml = 'v'.qa_html($metadata['version']); $namehtml = 'v' . qa_html($metadata['version']);
else else
$namehtml = ''; $namehtml = '';
...@@ -1057,7 +1054,7 @@ ...@@ -1057,7 +1054,7 @@
if (!strlen($namehtml)) if (!strlen($namehtml))
$namehtml = qa_html($value); $namehtml = qa_html($value);
$namehtml = '<a href="'.qa_html($metadata['uri']).'">'.$namehtml.'</a>'; $namehtml = '<a href="' . qa_html($metadata['uri']) . '">' . $namehtml . '</a>';
} }
$authorhtml = ''; $authorhtml = '';
...@@ -1065,7 +1062,7 @@ ...@@ -1065,7 +1062,7 @@
$authorhtml = qa_html($metadata['author']); $authorhtml = qa_html($metadata['author']);
if (strlen(@$metadata['author_uri'])) if (strlen(@$metadata['author_uri']))
$authorhtml = '<a href="'.qa_html($metadata['author_uri']).'">'.$authorhtml.'</a>'; $authorhtml = '<a href="' . qa_html($metadata['author_uri']) . '">' . $authorhtml . '</a>';
$authorhtml = qa_lang_html_sub('main/by_x', $authorhtml); $authorhtml = qa_lang_html_sub('main/by_x', $authorhtml);
...@@ -1073,21 +1070,21 @@ ...@@ -1073,21 +1070,21 @@
$updatehtml = ''; $updatehtml = '';
if (strlen(@$metadata['version']) && strlen(@$metadata['update_uri'])) { if (strlen(@$metadata['version']) && strlen(@$metadata['update_uri'])) {
$elementid = 'version_check_'.$optionname; $elementid = 'version_check_' . $optionname;
$updatehtml = '(<span id="'.$elementid.'">...</span>)'; $updatehtml = '(<span id="' . $elementid . '">...</span>)';
$qa_content['script_onloads'][] = array( $qa_content['script_onloads'][] = array(
"qa_version_check(".qa_js($metadata['update_uri']).", ".qa_js($metadata['version'], true).", ".qa_js($elementid).");" "qa_version_check(" . qa_js($metadata['update_uri']) . ", " . qa_js($metadata['version'], true) . ", " . qa_js($elementid) . ");"
); );
} }
$optionfield['suffix'] = $namehtml.' '.$authorhtml.' '.$updatehtml; $optionfield['suffix'] = $namehtml . ' ' . $authorhtml . ' ' . $updatehtml;
break; break;
case 'site_text_direction': case 'site_text_direction':
$directions = array('ltr'=>'LTR', 'rtl'=>'RTL'); $directions = array('ltr' => 'LTR', 'rtl' => 'RTL');
qa_optionfield_make_select($optionfield, $directions, $value, 'ltr'); qa_optionfield_make_select($optionfield, $directions, $value, 'ltr');
break; break;
...@@ -1102,14 +1099,16 @@ ...@@ -1102,14 +1099,16 @@
$optionfield['error'] = ''; $optionfield['error'] = '';
if (qa_opt('cache_tagcount') && !qa_using_tags()) if (qa_opt('cache_tagcount') && !qa_using_tags())
$optionfield['error'] .= qa_lang_html('admin/tags_not_shown').' '; $optionfield['error'] .= qa_lang_html('admin/tags_not_shown') . ' ';
if (!qa_using_categories()) if (!qa_using_categories()) {
foreach ($categories as $category) foreach ($categories as $category) {
if ($category['qcount']) { if ($category['qcount']) {
$optionfield['error'] .= qa_lang_html('admin/categories_not_shown'); $optionfield['error'] .= qa_lang_html('admin/categories_not_shown');
break; break;
} }
}
}
break; break;
case 'smtp_secure': case 'smtp_secure':
...@@ -1177,8 +1176,8 @@ ...@@ -1177,8 +1176,8 @@
case 'avatar_default_show': case 'avatar_default_show':
$qa_content['form']['tags'] .= 'enctype="multipart/form-data"'; $qa_content['form']['tags'] .= 'enctype="multipart/form-data"';
$optionfield['label'] .= ' <span style="margin:2px 0; display:inline-block;">'. $optionfield['label'] .= ' <span style="margin:2px 0; display:inline-block;">' .
qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32). qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32) .
'</span> <input name="avatar_default_file" type="file" style="width:16em;">'; '</span> <input name="avatar_default_file" type="file" style="width:16em;">';
break; break;
...@@ -1262,8 +1261,9 @@ ...@@ -1262,8 +1261,9 @@
if ($editor == $value) { if ($editor == $value) {
$module = qa_load_module('editor', $editor); $module = qa_load_module('editor', $editor);
if (method_exists($module, 'admin_form')) if (method_exists($module, 'admin_form')) {
$optionfield['note'] = '<a href="'.qa_admin_module_options_path('editor', $editor).'">'.qa_lang_html('admin/options').'</a>'; $optionfield['note'] = '<a href="' . qa_admin_module_options_path('editor', $editor) . '">' . qa_lang_html('admin/options') . '</a>';
}
} }
} }
...@@ -1287,7 +1287,7 @@ ...@@ -1287,7 +1287,7 @@
case 'extra_field_display': case 'extra_field_display':
$optionfield['style'] = 'tall'; $optionfield['style'] = 'tall';
$optionfield['label'] = '<span id="extra_field_label_hidden" style="display:none;">'.$optionfield['label'].'</span><span id="extra_field_label_shown">'.qa_lang_html('options/extra_field_display_label').'</span>'; $optionfield['label'] = '<span id="extra_field_label_hidden" style="display:none;">' . $optionfield['label'] . '</span><span id="extra_field_label_shown">' . qa_lang_html('options/extra_field_display_label') . '</span>';
break; break;
case 'extra_field_prompt': case 'extra_field_prompt':
...@@ -1300,8 +1300,9 @@ ...@@ -1300,8 +1300,9 @@
foreach ($searchmodules as $modulename => $module) { foreach ($searchmodules as $modulename => $module) {
$selectoptions[qa_html($modulename)] = strlen($modulename) ? qa_html($modulename) : qa_lang_html('options/option_default'); $selectoptions[qa_html($modulename)] = strlen($modulename) ? qa_html($modulename) : qa_lang_html('options/option_default');
if (($modulename == $value) && method_exists($module, 'admin_form')) if (($modulename == $value) && method_exists($module, 'admin_form')) {
$optionfield['note'] = '<a href="'.qa_admin_module_options_path('search', $modulename).'">'.qa_lang_html('admin/options').'</a>'; $optionfield['note'] = '<a href="' . qa_admin_module_options_path('search', $modulename) . '">' . qa_lang_html('admin/options') . '</a>';
}
} }
qa_optionfield_make_select($optionfield, $selectoptions, $value, ''); qa_optionfield_make_select($optionfield, $selectoptions, $value, '');
...@@ -1316,7 +1317,7 @@ ...@@ -1316,7 +1317,7 @@
break; break;
case 'moderate_by_points': case 'moderate_by_points':
$optionfield['label'] = '<span id="moderate_points_label_off" style="display:none;">'.$optionfield['label'].'</span><span id="moderate_points_label_on">'.qa_lang_html('options/moderate_points_limit').'</span>'; $optionfield['label'] = '<span id="moderate_points_label_off" style="display:none;">' . $optionfield['label'] . '</span><span id="moderate_points_label_on">' . qa_lang_html('options/moderate_points_limit') . '</span>';
break; break;
case 'moderate_points_limit': case 'moderate_points_limit':
...@@ -1365,17 +1366,17 @@ ...@@ -1365,17 +1366,17 @@
$dopoints = true; $dopoints = true;
if ($optionname == 'permit_retag_cat') if ($optionname == 'permit_retag_cat')
$optionfield['label'] = qa_lang_html(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag').':'; $optionfield['label'] = qa_lang_html(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag') . ':';
else else
$optionfield['label'] = qa_lang_html('profile/'.$optionname).':'; $optionfield['label'] = qa_lang_html('profile/' . $optionname) . ':';
if ( ($optionname == 'permit_view_q_page') || ($optionname == 'permit_post_q') || ($optionname == 'permit_post_a') || ($optionname == 'permit_post_c') || ($optionname == 'permit_anon_view_ips') ) if ($optionname == 'permit_view_q_page' || $optionname == 'permit_post_q' || $optionname == 'permit_post_a' || $optionname == 'permit_post_c' || $optionname == 'permit_anon_view_ips')
$widest = QA_PERMIT_ALL; $widest = QA_PERMIT_ALL;
elseif ( ($optionname == 'permit_close_q') || ($optionname == 'permit_select_a') || ($optionname == 'permit_moderate')|| ($optionname == 'permit_hide_show') ) elseif ($optionname == 'permit_close_q' || $optionname == 'permit_select_a' || $optionname == 'permit_moderate' || $optionname == 'permit_hide_show')
$widest = QA_PERMIT_POINTS; $widest = QA_PERMIT_POINTS;
elseif ($optionname == 'permit_delete_hidden') elseif ($optionname == 'permit_delete_hidden')
$widest = QA_PERMIT_EDITORS; $widest = QA_PERMIT_EDITORS;
elseif ( ($optionname == 'permit_view_voters_flaggers') || ($optionname == 'permit_edit_silent') ) elseif ($optionname == 'permit_view_voters_flaggers' || $optionname == 'permit_edit_silent')
$widest = QA_PERMIT_EXPERTS; $widest = QA_PERMIT_EXPERTS;
else else
$widest = QA_PERMIT_USERS; $widest = QA_PERMIT_USERS;
...@@ -1383,14 +1384,13 @@ ...@@ -1383,14 +1384,13 @@
if ($optionname == 'permit_view_q_page') { if ($optionname == 'permit_view_q_page') {
$narrowest = QA_PERMIT_APPROVED; $narrowest = QA_PERMIT_APPROVED;
$dopoints = false; $dopoints = false;
} } elseif ($optionname == 'permit_edit_c' || $optionname == 'permit_close_q' || $optionname == 'permit_select_a' || $optionname == 'permit_moderate' || $optionname == 'permit_hide_show' || $optionname == 'permit_anon_view_ips')
elseif ( ($optionname == 'permit_edit_c') || ($optionname == 'permit_close_q') || ($optionname == 'permit_select_a') || ($optionname == 'permit_moderate')|| ($optionname == 'permit_hide_show') || ($optionname == 'permit_anon_view_ips') )
$narrowest = QA_PERMIT_MODERATORS; $narrowest = QA_PERMIT_MODERATORS;
elseif ( ($optionname == 'permit_post_c') || ($optionname == 'permit_edit_q') || ($optionname == 'permit_retag_cat') || ($optionname == 'permit_edit_a') || ($optionname == 'permit_flag') ) elseif ($optionname == 'permit_post_c' || $optionname == 'permit_edit_q' || $optionname == 'permit_retag_cat' || $optionname == 'permit_edit_a' || $optionname == 'permit_flag')
$narrowest = QA_PERMIT_EDITORS; $narrowest = QA_PERMIT_EDITORS;
elseif ( ($optionname == 'permit_vote_q') || ($optionname == 'permit_vote_a') || ($optionname == 'permit_post_wall') ) elseif ($optionname == 'permit_vote_q' || $optionname == 'permit_vote_a' || $optionname == 'permit_post_wall')
$narrowest = QA_PERMIT_APPROVED_POINTS; $narrowest = QA_PERMIT_APPROVED_POINTS;
elseif ( ($optionname == 'permit_delete_hidden') || ($optionname == 'permit_edit_silent') ) elseif ($optionname == 'permit_delete_hidden' || $optionname == 'permit_edit_silent')
$narrowest = QA_PERMIT_ADMINS; $narrowest = QA_PERMIT_ADMINS;
elseif ($optionname == 'permit_view_voters_flaggers') elseif ($optionname == 'permit_view_voters_flaggers')
$narrowest = QA_PERMIT_SUPERS; $narrowest = QA_PERMIT_SUPERS;
...@@ -1399,11 +1399,10 @@ ...@@ -1399,11 +1399,10 @@
$permitoptions = qa_admin_permit_options($widest, $narrowest, (!QA_FINAL_EXTERNAL_USERS) && qa_opt('confirm_user_emails'), $dopoints); $permitoptions = qa_admin_permit_options($widest, $narrowest, (!QA_FINAL_EXTERNAL_USERS) && qa_opt('confirm_user_emails'), $dopoints);
if (count($permitoptions)>1) { if (count($permitoptions) > 1) {
qa_optionfield_make_select($optionfield, $permitoptions, $value, qa_optionfield_make_select($optionfield, $permitoptions, $value,
($value == QA_PERMIT_CONFIRMED) ? QA_PERMIT_USERS : min(array_keys($permitoptions))); ($value == QA_PERMIT_CONFIRMED) ? QA_PERMIT_USERS : min(array_keys($permitoptions)));
} } else {
else {
$optionfield['type'] = 'static'; $optionfield['type'] = 'static';
$optionfield['value'] = reset($permitoptions); $optionfield['value'] = reset($permitoptions);
} }
...@@ -1429,7 +1428,7 @@ ...@@ -1429,7 +1428,7 @@
case 'permit_post_wall_points': case 'permit_post_wall_points':
unset($optionfield['label']); unset($optionfield['label']);
$optionfield['type'] = 'number'; $optionfield['type'] = 'number';
$optionfield['prefix'] = qa_lang_html('admin/users_must_have').'&nbsp;'; $optionfield['prefix'] = qa_lang_html('admin/users_must_have') . '&nbsp;';
$optionfield['note'] = qa_lang_html('admin/points'); $optionfield['note'] = qa_lang_html('admin/points');
break; break;
...@@ -1458,8 +1457,7 @@ ...@@ -1458,8 +1457,7 @@
$category = reset($categories); $category = reset($categories);
$categoryslug = $category['tags']; $categoryslug = $category['tags'];
} } else
else
$categoryslug = 'example-category'; $categoryslug = 'example-category';
if (qa_opt('feed_for_qa')) if (qa_opt('feed_for_qa'))
...@@ -1469,7 +1467,7 @@ ...@@ -1469,7 +1467,7 @@
else else
$feedrequest = 'activity'; $feedrequest = 'activity';
$feedrequest .= '/'.$categoryslug; $feedrequest .= '/' . $categoryslug;
$feedisexample = true; $feedisexample = true;
break; break;
...@@ -1478,9 +1476,8 @@ ...@@ -1478,9 +1476,8 @@
if (count($populartags)) { if (count($populartags)) {
reset($populartags); reset($populartags);
$feedrequest = 'tag/'.key($populartags); $feedrequest = 'tag/' . key($populartags);
} } else
else
$feedrequest = 'tag/singing'; $feedrequest = 'tag/singing';
$feedisexample = true; $feedisexample = true;
...@@ -1492,7 +1489,7 @@ ...@@ -1492,7 +1489,7 @@
break; break;
case 'moderate_users': case 'moderate_users':
$optionfield['note'] = '<a href="'.qa_path_html('admin/users', null, null, null, 'profile_fields').'">'.qa_lang_html('admin/registration_fields').'</a>'; $optionfield['note'] = '<a href="' . qa_path_html('admin/users', null, null, null, 'profile_fields') . '">' . qa_lang_html('admin/registration_fields') . '</a>';
break; break;
case 'captcha_module': case 'captcha_module':
...@@ -1504,8 +1501,9 @@ ...@@ -1504,8 +1501,9 @@
if ($modulename == $value) { if ($modulename == $value) {
$module = qa_load_module('captcha', $modulename); $module = qa_load_module('captcha', $modulename);
if (method_exists($module, 'admin_form')) if (method_exists($module, 'admin_form')) {
$optionfield['note'] = '<a href="'.qa_admin_module_options_path('captcha', $modulename).'">'.qa_lang_html('admin/options').'</a>'; $optionfield['note'] = '<a href="' . qa_admin_module_options_path('captcha', $modulename) . '">' . qa_lang_html('admin/options') . '</a>';
}
} }
} }
...@@ -1556,16 +1554,18 @@ ...@@ -1556,16 +1554,18 @@
break; break;
} }
if (isset($feedrequest) && $value) if (isset($feedrequest) && $value) {
$optionfield['note'] = '<a href="'.qa_path_html(qa_feed_request($feedrequest)).'">'.qa_lang_html($feedisexample ? 'admin/feed_link_example' : 'admin/feed_link').'</a>'; $optionfield['note'] = '<a href="' . qa_path_html(qa_feed_request($feedrequest)) . '">' . qa_lang_html($feedisexample ? 'admin/feed_link_example' : 'admin/feed_link') . '</a>';
}
$qa_content['form']['fields'][$optionname] = $optionfield; $qa_content['form']['fields'][$optionname] = $optionfield;
} }
}
// Extra items for specific pages // Extra items for specific pages
switch ($adminsection) { switch ($adminsection) {
case 'users': case 'users':
require_once QA_INCLUDE_DIR . 'app/format.php'; require_once QA_INCLUDE_DIR . 'app/format.php';
...@@ -1575,17 +1575,17 @@ ...@@ -1575,17 +1575,17 @@
$listhtml = ''; $listhtml = '';
foreach ($userfields as $userfield) { foreach ($userfields as $userfield) {
$listhtml .= '<li><b>'.qa_html(qa_user_userfield_label($userfield)).'</b>'; $listhtml .= '<li><b>' . qa_html(qa_user_userfield_label($userfield)) . '</b>';
$listhtml .= strtr(qa_lang_html('admin/edit_field'), array( $listhtml .= strtr(qa_lang_html('admin/edit_field'), array(
'^1' => '<a href="'.qa_path_html('admin/userfields', array('edit' => $userfield['fieldid'])).'">', '^1' => '<a href="' . qa_path_html('admin/userfields', array('edit' => $userfield['fieldid'])) . '">',
'^2' => '</a>', '^2' => '</a>',
)); ));
$listhtml .= '</li>'; $listhtml .= '</li>';
} }
$listhtml .= '<li><b><a href="'.qa_path_html('admin/userfields').'">'.qa_lang_html('admin/add_new_field').'</a></b></li>'; $listhtml .= '<li><b><a href="' . qa_path_html('admin/userfields') . '">' . qa_lang_html('admin/add_new_field') . '</a></b></li>';
$qa_content['form']['fields'][] = array('type' => 'blank'); $qa_content['form']['fields'][] = array('type' => 'blank');
...@@ -1594,7 +1594,7 @@ ...@@ -1594,7 +1594,7 @@
'id' => 'profile_fields', 'id' => 'profile_fields',
'style' => 'tall', 'style' => 'tall',
'type' => 'custom', 'type' => 'custom',
'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">'.$listhtml.'</ul>' : null, 'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">' . $listhtml . '</ul>' : null,
); );
} }
...@@ -1605,24 +1605,24 @@ ...@@ -1605,24 +1605,24 @@
$listhtml = ''; $listhtml = '';
foreach ($pointstitle as $points => $title) { foreach ($pointstitle as $points => $title) {
$listhtml .= '<li><b>'.$title.'</b> - '.(($points == 1) ? qa_lang_html_sub('main/1_point', '1', '1') $listhtml .= '<li><b>' . $title . '</b> - ' . (($points == 1) ? qa_lang_html_sub('main/1_point', '1', '1')
: qa_lang_html_sub('main/x_points', qa_html(qa_format_number($points)))); : qa_lang_html_sub('main/x_points', qa_html(qa_format_number($points))));
$listhtml .= strtr(qa_lang_html('admin/edit_title'), array( $listhtml .= strtr(qa_lang_html('admin/edit_title'), array(
'^1' => '<a href="'.qa_path_html('admin/usertitles', array('edit' => $points)).'">', '^1' => '<a href="' . qa_path_html('admin/usertitles', array('edit' => $points)) . '">',
'^2' => '</a>', '^2' => '</a>',
)); ));
$listhtml .= '</li>'; $listhtml .= '</li>';
} }
$listhtml .= '<li><b><a href="'.qa_path_html('admin/usertitles').'">'.qa_lang_html('admin/add_new_title').'</a></b></li>'; $listhtml .= '<li><b><a href="' . qa_path_html('admin/usertitles') . '">' . qa_lang_html('admin/add_new_title') . '</a></b></li>';
$qa_content['form']['fields']['usertitles'] = array( $qa_content['form']['fields']['usertitles'] = array(
'label' => qa_lang_html('admin/user_titles'), 'label' => qa_lang_html('admin/user_titles'),
'style' => 'tall', 'style' => 'tall',
'type' => 'custom', 'type' => 'custom',
'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">'.$listhtml.'</ul>' : null, 'html' => strlen($listhtml) ? '<ul style="margin-bottom:0;">' . $listhtml . '</ul>' : null,
); );
break; break;
...@@ -1631,31 +1631,33 @@ ...@@ -1631,31 +1631,33 @@
$widgetmodules = qa_load_modules_with('widget', 'allow_template'); $widgetmodules = qa_load_modules_with('widget', 'allow_template');
foreach ($widgetmodules as $tryname => $trywidget) foreach ($widgetmodules as $tryname => $trywidget) {
if (method_exists($trywidget, 'allow_region')) { if (method_exists($trywidget, 'allow_region')) {
$listhtml .= '<li><b>'.qa_html($tryname).'</b>'; $listhtml .= '<li><b>' . qa_html($tryname) . '</b>';
$listhtml .= strtr(qa_lang_html('admin/add_widget_link'), array( $listhtml .= strtr(qa_lang_html('admin/add_widget_link'), array(
'^1' => '<a href="'.qa_path_html('admin/layoutwidgets', array('title' => $tryname)).'">', '^1' => '<a href="' . qa_path_html('admin/layoutwidgets', array('title' => $tryname)) . '">',
'^2' => '</a>', '^2' => '</a>',
)); ));
if (method_exists($trywidget, 'admin_form')) if (method_exists($trywidget, 'admin_form'))
$listhtml .= strtr(qa_lang_html('admin/widget_global_options'), array( $listhtml .= strtr(qa_lang_html('admin/widget_global_options'), array(
'^1' => '<a href="'.qa_admin_module_options_path('widget', $tryname).'">', '^1' => '<a href="' . qa_admin_module_options_path('widget', $tryname) . '">',
'^2' => '</a>', '^2' => '</a>',
)); ));
$listhtml .= '</li>'; $listhtml .= '</li>';
} }
}
if (strlen($listhtml)) if (strlen($listhtml)) {
$qa_content['form']['fields']['plugins'] = array( $qa_content['form']['fields']['plugins'] = array(
'label' => qa_lang_html('admin/widgets_explanation'), 'label' => qa_lang_html('admin/widgets_explanation'),
'style' => 'tall', 'style' => 'tall',
'type' => 'custom', 'type' => 'custom',
'html' => '<ul style="margin-bottom:0;">'.$listhtml.'</ul>', 'html' => '<ul style="margin-bottom:0;">' . $listhtml . '</ul>',
); );
}
$widgets = qa_db_single_select(qa_db_widgets_selectspec()); $widgets = qa_db_single_select(qa_db_widgets_selectspec());
...@@ -1664,19 +1666,20 @@ ...@@ -1664,19 +1666,20 @@
$placeoptions = qa_admin_place_options(); $placeoptions = qa_admin_place_options();
foreach ($widgets as $widget) { foreach ($widgets as $widget) {
$listhtml .= '<li><b>'.qa_html($widget['title']).'</b> - '. $listhtml .= '<li><b>' . qa_html($widget['title']) . '</b> - ' .
'<a href="'.qa_path_html('admin/layoutwidgets', array('edit' => $widget['widgetid'])).'">'. '<a href="' . qa_path_html('admin/layoutwidgets', array('edit' => $widget['widgetid'])) . '">' .
@$placeoptions[$widget['place']].'</a>'; @$placeoptions[$widget['place']] . '</a>';
$listhtml .= '</li>'; $listhtml .= '</li>';
} }
if (strlen($listhtml)) if (strlen($listhtml)) {
$qa_content['form']['fields']['widgets'] = array( $qa_content['form']['fields']['widgets'] = array(
'label' => qa_lang_html('admin/active_widgets_explanation'), 'label' => qa_lang_html('admin/active_widgets_explanation'),
'type' => 'custom', 'type' => 'custom',
'html' => '<ul style="margin-bottom:0;">'.$listhtml.'</ul>', 'html' => '<ul style="margin-bottom:0;">' . $listhtml . '</ul>',
); );
}
break; break;
...@@ -1723,12 +1726,12 @@ ...@@ -1723,12 +1726,12 @@
'label' => qa_lang_html('options/permit_create_admins'), 'label' => qa_lang_html('options/permit_create_admins'),
'value' => qa_lang_html('options/permit_supers'), 'value' => qa_lang_html('options/permit_supers'),
); );
} }
break; break;
case 'mailing': case 'mailing':
require_once QA_INCLUDE_DIR.'util/sort.php'; require_once QA_INCLUDE_DIR . 'util/sort.php';
if (isset($mailingprogress)) { if (isset($mailingprogress)) {
unset($qa_content['form']['buttons']['save']); unset($qa_content['form']['buttons']['save']);
...@@ -1747,8 +1750,7 @@ ...@@ -1747,8 +1750,7 @@
'label' => qa_lang_html('admin/pause_mailing_button'), 'label' => qa_lang_html('admin/pause_mailing_button'),
); );
} } else {
else {
$qa_content['form']['buttons']['resume'] = array( $qa_content['form']['buttons']['resume'] = array(
'tags' => 'name="domailingresume"', 'tags' => 'name="domailingresume"',
'label' => qa_lang_html('admin/resume_mailing_button'), 'label' => qa_lang_html('admin/resume_mailing_button'),
...@@ -1759,8 +1761,7 @@ ...@@ -1759,8 +1761,7 @@
'label' => qa_lang_html('admin/cancel_mailing_button'), 'label' => qa_lang_html('admin/cancel_mailing_button'),
); );
} }
} } else {
else {
$qa_content['form']['buttons']['spacer'] = array(); $qa_content['form']['buttons']['spacer'] = array();
$qa_content['form']['buttons']['test'] = array( $qa_content['form']['buttons']['test'] = array(
...@@ -1785,18 +1786,13 @@ ...@@ -1785,18 +1786,13 @@
$cacheManager = Q2A_Storage_CacheManager::getInstance(); $cacheManager = Q2A_Storage_CacheManager::getInstance();
$qa_content['error'] = $cacheManager->getError(); $qa_content['error'] = $cacheManager->getError();
break; break;
} }
if (isset($checkboxtodisplay)) if (isset($checkboxtodisplay))
qa_set_display_rules($qa_content, $checkboxtodisplay); qa_set_display_rules($qa_content, $checkboxtodisplay);
$qa_content['navigation']['sub'] = qa_admin_sub_navigation(); $qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/* return $qa_content;
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
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