diff --git a/Sources/DbPackages-postgresql.php b/Sources/DbPackages-postgresql.php index 8e26ab8fe8c..c6793b8b2fb 100644 --- a/Sources/DbPackages-postgresql.php +++ b/Sources/DbPackages-postgresql.php @@ -629,6 +629,8 @@ function smf_db_remove_index($table_name, $index_name, $parameters = array(), $e */ function smf_db_calculate_type($type_name, $type_size = null, $reverse = false) { + // Let's be sure it's lowercase MySQL likes both, others no. + $type_name = strtolower($type_name); // Generic => Specific. if (!$reverse) { diff --git a/Sources/DbPackages-sqlite.php b/Sources/DbPackages-sqlite.php index c5fe3eb9a6e..3cc9bc0c336 100644 --- a/Sources/DbPackages-sqlite.php +++ b/Sources/DbPackages-sqlite.php @@ -420,6 +420,8 @@ function smf_db_remove_index($table_name, $index_name, $parameters = array(), $e */ function smf_db_calculate_type($type_name, $type_size = null, $reverse = false) { + // Let's be sure it's lowercase MySQL likes both, others no. + $type_name = strtolower($type_name); // Generic => Specific. if (!$reverse) { diff --git a/Sources/Display.php b/Sources/Display.php index 3719a932657..d648b76740a 100644 --- a/Sources/Display.php +++ b/Sources/Display.php @@ -1232,7 +1232,7 @@ function Download() isAllowedTo('view_attachments'); // Make sure this attachment is on this board. - // NOTE: We must verify that $topic is the attachment's topic, or else the permission check above is broken. + // @todo: We must verify that $topic is the attachment's topic, or else the permission check above is broken. $request = $smcFunc['db_query']('', ' SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, a.approved, m.id_member FROM {db_prefix}attachments AS a diff --git a/Sources/ManageMembergroups.php b/Sources/ManageMembergroups.php index 035eb40cec5..3d5188473c3 100644 --- a/Sources/ManageMembergroups.php +++ b/Sources/ManageMembergroups.php @@ -562,22 +562,51 @@ function AddMembergroup() ); $smcFunc['db_free_result']($result); - $result = $smcFunc['db_query']('', ' - SELECT id_board, name, child_level - FROM {db_prefix}boards + $request = $smcFunc['db_query']('', ' + SELECT b.id_cat, c.name AS cat_name, b.id_board, b.name, b.child_level + FROM {db_prefix}boards AS b + LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat) ORDER BY board_order', array( ) ); - $context['boards'] = array(); - while ($row = $smcFunc['db_fetch_assoc']($result)) - $context['boards'][] = array( + $context['num_boards'] = $smcFunc['db_num_rows']($request); + + $context['categories'] = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + // This category hasn't been set up yet.. + if (!isset($context['categories'][$row['id_cat']])) + $context['categories'][$row['id_cat']] = array( + 'id' => $row['id_cat'], + 'name' => $row['cat_name'], + 'boards' => array() + ); + + // Set this board up, and let the template know when it's a child. (indent them..) + $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( 'id' => $row['id_board'], 'name' => $row['name'], 'child_level' => $row['child_level'], 'selected' => false ); - $smcFunc['db_free_result']($result); + + } + $smcFunc['db_free_result']($request); + + // Now, let's sort the list of categories into the boards for templates that like that. + $temp_boards = array(); + foreach ($context['categories'] as $category) + { + $temp_boards[] = array( + 'name' => $category['name'], + 'child_ids' => array_keys($category['boards']) + ); + $temp_boards = array_merge($temp_boards, array_values($category['boards'])); + + // Include a list of boards per category for easy toggling. + $context['categories'][$category['id']]['child_ids'] = array_keys($category['boards']); + } createToken('admin-mmg'); } @@ -1004,22 +1033,53 @@ function EditMembergroup() $context['boards'] = array(); if ($_REQUEST['group'] == 2 || $_REQUEST['group'] > 3) { - $result = $smcFunc['db_query']('', ' - SELECT id_board, name, child_level, FIND_IN_SET({string:current_group}, member_groups) != 0 AS can_access - FROM {db_prefix}boards + $request = $smcFunc['db_query']('', ' + SELECT b.id_cat, c.name as cat_name, b.id_board, b.name, b.child_level, FIND_IN_SET({string:current_group}, b.member_groups) != 0 AS can_access + FROM {db_prefix}boards AS b + LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat) ORDER BY board_order', array( 'current_group' => (int) $_REQUEST['group'], ) ); - while ($row = $smcFunc['db_fetch_assoc']($result)) - $context['boards'][] = array( + $context['categories'] = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + // This category hasn't been set up yet.. + if (!isset($context['categories'][$row['id_cat']])) + $context['categories'][$row['id_cat']] = array( + 'id' => $row['id_cat'], + 'name' => $row['cat_name'], + 'boards' => array() + ); + + // Set this board up, and let the template know when it's a child. (indent them..) + $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( 'id' => $row['id_board'], 'name' => $row['name'], 'child_level' => $row['child_level'], 'selected' => !(empty($row['can_access']) || $row['can_access'] == 'f'), ); - $smcFunc['db_free_result']($result); + } + $smcFunc['db_free_result']($request); + + // Now, let's sort the list of categories into the boards for templates that like that. + $temp_boards = array(); + foreach ($context['categories'] as $category) + { + $temp_boards[] = array( + 'name' => $category['name'], + 'child_ids' => array_keys($category['boards']) + ); + $temp_boards = array_merge($temp_boards, array_values($category['boards'])); + + // Include a list of boards per category for easy toggling. + $context['categories'][$category['id']]['child_ids'] = array_keys($category['boards']); + } + + $max_boards = ceil(count($temp_boards) / 2); + if ($max_boards == 1) + $max_boards = 2; } // Finally, get all the groups this could be inherited off. diff --git a/Sources/ManageSmileys.php b/Sources/ManageSmileys.php index 52fa01ab7ac..950ac1ee46d 100644 --- a/Sources/ManageSmileys.php +++ b/Sources/ManageSmileys.php @@ -439,7 +439,7 @@ function EditSmileySets() 'additional_rows' => array( array( 'position' => 'below_table_data', - 'value' => ' [' . $txt['smiley_sets_add'] . ']', + 'value' => '[' . $txt['smiley_sets_add'] . '] ', ), ), ); @@ -1731,7 +1731,7 @@ function EditMessageIcons() 'additional_rows' => array( array( 'position' => 'below_table_data', - 'value' => '[' . $txt['icons_add_new'] . ']', + 'value' => '[' . $txt['icons_add_new'] . '] ', ), ), ); diff --git a/Sources/Packages.php b/Sources/Packages.php index 9e3932ee8dd..e1419c1ce1d 100644 --- a/Sources/Packages.php +++ b/Sources/Packages.php @@ -1434,7 +1434,7 @@ function PackageBrowse() function PackageOptions() { - global $txt, $scripturl, $context, $sourcedir, $modSettings; + global $txt, $scripturl, $context, $sourcedir, $modSettings, $smcFunc; if (isset($_POST['submit'])) { diff --git a/Sources/Register.php b/Sources/Register.php index a1779718d40..4e79db2dd42 100644 --- a/Sources/Register.php +++ b/Sources/Register.php @@ -505,7 +505,7 @@ function Register2($verifiedOpenID = false) } else { - call_integration_hook('integrate_activate', array($row['member_name'])); + call_integration_hook('integrate_activate', array($regOptions['username'])); setLoginCookie(60 * $modSettings['cookieTime'], $memberID, sha1(sha1(strtolower($regOptions['username']) . $regOptions['password']) . $regOptions['register_vars']['password_salt'])); diff --git a/Sources/Search.php b/Sources/Search.php index 3d9ec0fb499..ad85816d240 100644 --- a/Sources/Search.php +++ b/Sources/Search.php @@ -57,9 +57,6 @@ function PlushSearch1() 'name' => $txt['search'] ); - // This is hard coded maximum string length. - $context['search_string_limit'] = 100; - $context['require_verification'] = $user_info['is_guest'] && !empty($modSettings['search_enable_captcha']) && empty($_SESSION['ss_vv_passed']); if ($context['require_verification']) { @@ -117,6 +114,9 @@ function PlushSearch1() if ($search_error === 'messages') continue; + if ($search_error == 'string_too_long') + $txt['error_string_too_long'] = sprintf($txt['error_string_too_long'], $context['search_string_limit']); + $context['search_errors']['messages'][] = $txt['error_' . $search_error]; } } @@ -597,7 +597,6 @@ function PlushSearch2() elseif ($smcFunc['strlen']($search_params['search']) > $context['search_string_limit']) { $context['search_errors']['string_too_long'] = true; - $txt['error_string_too_long'] = sprintf($txt['error_string_too_long'], $context['search_string_limit']); } // Change non-word characters into spaces. diff --git a/Sources/Subs-Editor.php b/Sources/Subs-Editor.php index c765c558825..7850a028763 100644 --- a/Sources/Subs-Editor.php +++ b/Sources/Subs-Editor.php @@ -454,10 +454,14 @@ function html_to_bbc($text) // Now work out what the attributes are. $attribs = fetchTagAttributes($matches[1]); $tags = array(); + $sizes_equivalence = array(1 => '8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); foreach ($attribs as $s => $v) { if ($s == 'size') - $tags[] = array('[size=' . (int) trim($v) . ']', '[/size]'); + { + $v = empty((int) trim($v)) ? 1 : (int) trim($v); + $tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]'); + } elseif ($s == 'face') $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); elseif ($s == 'color') diff --git a/Sources/Themes.php b/Sources/Themes.php index 18544ae8619..758dd071895 100644 --- a/Sources/Themes.php +++ b/Sources/Themes.php @@ -1178,9 +1178,12 @@ function PickTheme() $request = $smcFunc['db_query']('', ' SELECT id_theme, value FROM {db_prefix}themes - WHERE variable = {string:theme_variant}', + WHERE variable = {string:theme_variant} + AND id_member IN ({array_int:id_member}) + ORDER BY id_member ASC', array( 'theme_variant' => 'theme_variant', + 'id_member' => isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? array(-1, $context['current_member']) : array(-1), ) ); while ($row = $smcFunc['db_fetch_assoc']($request)) diff --git a/Themes/default/ManageMembergroups.template.php b/Themes/default/ManageMembergroups.template.php index 6fe5012ad70..080ef10da25 100644 --- a/Themes/default/ManageMembergroups.template.php +++ b/Themes/default/ManageMembergroups.template.php @@ -121,10 +121,32 @@ function template_new_group()
- ', $txt['membergroups_new_board_desc'], ''; - foreach ($context['boards'] as $board) + ', $txt['membergroups_new_board_desc'], ' + +
'; echo '
@@ -298,7 +320,7 @@ function template_edit_group()
'; - if (!empty($context['boards'])) + if (!empty($context['categories'])) { echo '
@@ -307,10 +329,32 @@ function template_edit_group()
- ', $txt['membergroups_new_board_desc'], ''; - foreach ($context['boards'] as $board) + ', $txt['membergroups_new_board_desc'], ' +
    '; + + foreach ($context['categories'] as $category) + { echo ' -
    '; +
  • + ', $category['name'], ' +
      '; + + foreach ($category['boards'] as $board) + { + echo ' +
    • + +
    • '; + } + + echo ' +
    +
  • '; + } + + echo ' +
+
'; echo '
diff --git a/Themes/default/Profile.template.php b/Themes/default/Profile.template.php index 7f15b89de6f..0756197290b 100644 --- a/Themes/default/Profile.template.php +++ b/Themes/default/Profile.template.php @@ -1856,19 +1856,6 @@ function template_ignoreboards() global $context, $txt, $settings, $scripturl; // The main containing header. echo ' - -