Permalink
Browse files

(core) fixed bbcode rewrites for quotes not containing an avatar

(core) topic prefixes: the css class for formatting the prefix how has its own, dedicated database column. DB CHANGE REQUIRED (see table_changes.sql, for table prefixes)
  • Loading branch information...
silvercircle committed Apr 20, 2013
1 parent 779d75e commit 5af5274549272b72ef1e15bc6e1f720a0475b72c
View
@@ -370,7 +370,7 @@ function MessageIndex()
mf.poster_name AS first_member_name, mf.id_member AS first_id_member,
IFNULL(memf.real_name, mf.poster_name) AS first_display_name,
ml.smileys_enabled AS last_smileys, mf.smileys_enabled AS first_smileys,
p.name AS prefix_name
p.name AS prefix_name, p.css AS prefix_class
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
@@ -439,7 +439,6 @@ function MessageIndex()
$l_post_mem_href = !empty($row['last_id_member']) ? URL::user($row['last_id_member'], $row['last_display_name'] ) : '';
$l_post_msg_href = URL::topic($row['id_topic'], $row['last_subject'], $user_info['is_guest'] ? (!empty($options['view_newest_first']) ? 0 : ((int) (($row['num_replies']) / $context['pageindex_multiplier'])) * $context['pageindex_multiplier']) : 0, $user_info['is_guest'] ? true : false, $user_info['is_guest'] ? '' : ('.msg' . $row['id_last_msg']), $user_info['is_guest'] ? ('#msg' . $row['id_last_msg']) : '#new');
list($prefix_name, $prefix_class) = explode('||', $row['prefix_name'] . '||');
$context['topics'][$row['id_topic']] = array(
'id' => $row['id_topic'],
'first_post' => array(
@@ -476,7 +475,7 @@ function MessageIndex()
'href' => $l_post_msg_href,
'link' => '<a href="' . $l_post_msg_href . ($row['num_replies'] == 0 ? '' : ' rel="nofollow"') . '>' . $row['last_subject'] . '</a>'
),
'prefix' => $prefix_name ? '<a href="'. URL::parse('?board=' . $board . ';prefix=' . $row['id_prefix']) . '" class="prefix' . (!empty($prefix_class) ? ' ' . $prefix_class : '') . '">'.(html_entity_decode($prefix_name) . '</a>') : '',
'prefix' => !empty($row['prefix_name']) ? '<a href="'. URL::parse('?board=' . $board . ';prefix=' . $row['id_prefix']) . '" class="prefix' . (!empty($row['prefix_class']) ? ' ' . $row['prefix_class'] : '') . '">'.(html_entity_decode($row['prefix_name']) . '</a>') : '',
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0,
View
@@ -480,7 +480,8 @@ public static function bbcRewrites(&$buffer)
if(!empty($context['additional_uids_to_load'])) {
foreach($matches as $match) {
loadMemberContext($match[2]);
$buffer = str_replace($match[0], isset($memberContext[$match[2]]) && !empty($memberContext[$match[2]]['avatar']['image']) ? '<div class="floatleft quoteavatar"><span class="medium_avatar"><a class="mcard" data-mid="' . $match[2] . '" href="' . URL::user($match[2], $memberContext[$match[2]]['name']) . '">' . $memberContext[$match[2]]['avatar']['image'] . '</a></span></div><div class="quotewrapper indent">' : '', $buffer);
$buffer = str_replace($match[0], isset($memberContext[$match[2]]) && !empty($memberContext[$match[2]]['avatar']['image']) ? '<div class="floatleft quoteavatar"><span class="medium_avatar"><a class="mcard" data-mid="' . $match[2] . '" href="' . URL::user($match[2], $memberContext[$match[2]]['name']) . '">' . $memberContext[$match[2]]['avatar']['image'] . '</a></span></div><div class="quotewrapper indent">' : '<div class="quotewrapper">', $buffer);
//$buffer = str_replace($match[0], isset($memberContext[$match[2]]) && !empty($memberContext[$match[2]]['avatar']['image']) ? 'foo' : 'bar', $buffer);
}
}
}
@@ -439,8 +439,8 @@ function ModifyPrefixSettings()
$boards = normalizeCommaDelimitedList($_POST['boards_'.$id]);
$groups = normalizeCommaDelimitedList($_POST['groups_'.$id]);
smf_db_query( '
UPDATE {db_prefix}prefixes SET name = {string:name}, boards = {string:boards}, groups = {string:groups} WHERE id_prefix = {int:id_prefix}',
array('id_prefix' => $id, 'name' => htmlspecialchars($_POST['name_'.$id]),
UPDATE {db_prefix}prefixes SET name = {string:name}, boards = {string:boards}, groups = {string:groups}, css = {string:css} WHERE id_prefix = {int:id_prefix}',
array('id_prefix' => $id, 'name' => htmlspecialchars($_POST['name_'.$id]), 'css' => htmlspecialchars($_POST['css_' . $id]),
'boards' => $boards, 'groups' => $groups));
}
}
@@ -457,8 +457,8 @@ function ModifyPrefixSettings()
$groups = normalizeCommaDelimitedList($_POST['groups_new_'.$id]);
smf_db_query( '
INSERT INTO {db_prefix}prefixes (name, boards, groups) VALUES({string:name},
{string:boards}, {string:groups})',
array('name' => htmlentities($_POST['name_new_'.$i]), 'boards' => $boards, 'groups' => $groups));
{string:boards}, {string:groups}, {string:css})',
array('name' => htmlentities($_POST['name_new_'.$i]), 'boards' => $boards, 'groups' => $groups, 'css' => htmlspecialchars($_POST['css_new_'.$id])));
}
}
redirectexit('action=admin;area=postsettings;sa=prefixes');
@@ -2075,34 +2075,37 @@ function template_prefix_settings()
<table class="table_grid">
<thead>
<tr>
<th class="red_container nowrap">',$txt['prefix_name'],'</th>
<th class="red_container nowrap"></th>
<th class="red_container centertext" style="width:100%;">',$txt['prefix_boards'],'</th>
<th class="red_container centertext nowrap" style="width:100%;">',$txt['prefix_groups'],'</th>
<th class="glass first_th nowrap">',$txt['prefix_name'],'</th>
<th class="glass nowrap"></th>
<th class="glass centertext nowrap">',$txt['prefix_boards'],'</th>
<th class="glass centertext nowrap">',$txt['prefix_groups'],'</th>
<th class="glass centertext last_th">CSS class</th>
</tr>
</thead>
<tbody>';
foreach($context['prefixes'] as $prefix) {
echo '<tr>
<td>
<input type="hidden" name="id_', $prefix['id_prefix'], '" value="1" />
<input type="text" size="80" value="',$prefix['name'],'" name="name_',$prefix['id_prefix'],'" />
<input type="text" size="60" value="',$prefix['name'],'" name="name_',$prefix['id_prefix'],'" />
</td>
<td class="nowrap">',$prefix['preview'],'</td>
<td class="nowrap" style="width:100%;">',$prefix['preview'],'</td>
<td style="text-align:right;"><input type="text" size="25" value="',$prefix['boards'],'" name="boards_',$prefix['id_prefix'],'" /></td>
<td style="text-align:right;"><input type="text" size="25" value="',$prefix['groups'],'" name="groups_',$prefix['id_prefix'],'" /></td>
<td style="text-align:right;"><input type="text" size="10" value="',$prefix['css'],'" name="css_',$prefix['id_prefix'],'" /></td>
</tr>';
}
for($i = 0; $i < 5; $i++) {
echo '<tr>
<td>
<input type="hidden" name="id_', $i, '" value="1" />
<input type="text" size="80" name="name_new_',$i,'" />
<input type="text" size="60" name="name_new_',$i,'" />
</td>
<td>
</td>
<td style="text-align:right;"><input type="text" size="25" name="boards_new_',$i,'" /></td>
<td style="text-align:right;"><input type="text" size="25" name="groups_new_',$i,'" /></td>
<td style="text-align:right;"><input type="text" size="10" name="css_new_',$i,'" /></td>
</tr>';
}
View
@@ -1389,7 +1389,8 @@ CREATE TABLE {$db_prefix}prefixes (
id_prefix smallint(5) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
boards varchar(200) NOT NULL default '',
groups varchar(100) NOT NULL default '',
groups varchar(200) NOT NULL default '',
css varchar(20) NOT NULL default '',
PRIMARY KEY (id_prefix)
) ENGINE=MyISAM;
View
@@ -73,7 +73,8 @@ CREATE TABLE {$db_prefix}prefixes (
id_prefix smallint(5) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
boards varchar(200) NOT NULL default '',
groups varchar(100) NOT NULL default '',
groups varchar(200) NOT NULL default '',
css varchar(20) NOT NULL default '',
PRIMARY KEY (id_prefix)
) ENGINE=MyISAM;

0 comments on commit 5af5274

Please sign in to comment.