"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Upload/admin/modules/config/thread_prefixes.php" between
mybb_1822.zip and mybb_1823.zip

About: MyBB is a multilingual, standards-compliant and free forum (discussion board) software.

thread_prefixes.php  (mybb_1822):thread_prefixes.php  (mybb_1823)
skipping to change at line 513 skipping to change at line 513
if(!$mybb->input['action']) if(!$mybb->input['action'])
{ {
$plugins->run_hooks('admin_config_thread_prefixes_start'); $plugins->run_hooks('admin_config_thread_prefixes_start');
$page->output_header($lang->thread_prefixes); $page->output_header($lang->thread_prefixes);
$page->output_nav_tabs($sub_tabs, 'thread_prefixes'); $page->output_nav_tabs($sub_tabs, 'thread_prefixes');
$table = new Table; $table = new Table;
$table->construct_header($lang->prefix); $table->construct_header($lang->prefix);
$table->construct_header($lang->forums);
$table->construct_header($lang->controls, array('class' => 'align_center' , 'colspan' => 2)); $table->construct_header($lang->controls, array('class' => 'align_center' , 'colspan' => 2));
$prefixes = build_prefixes(); $prefixes = build_prefixes();
if(!empty($prefixes)) if(!empty($prefixes))
{ {
foreach($prefixes as &$prefix)
{
$prefix['forum_fids'] = explode(',', $prefix['forums']);
}
unset($prefix);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
if($fid)
{
$forum = get_forum($fid, 1);
if(!empty($forum))
{
$title = $lang->sprintf($lang->thread_prefixes_in
, $forum['name']);
foreach($prefixes as $key => $prefix)
{
if($prefix['forums'] !== '-1' && !in_arra
y($fid, $prefix['forum_fids']))
{
unset($prefixes[$key]);
}
}
}
}
usort($prefixes, 'thread_prefix_sort');
foreach($prefixes as $prefix) foreach($prefixes as $prefix)
{ {
$table->construct_cell("<a href=\"index.php?module=config if($prefix['forums'] === '-1')
-thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\"><strong>".htm {
lspecialchars_uni($prefix['prefix'])."</strong></a>"); $forum_names = $lang->all_forums;
}
else
{
$forum_names = array();
foreach($prefix['forum_fids'] as $fid)
{
$forum = get_forum($fid, 1);
if(!empty($forum))
{
$forum_names[] = '<a href="index.
php?module=config-thread_prefixes&amp;fid='.(int)$fid.'">'.$forum['name'].'</a>'
;
}
}
$forum_names = implode($lang->comma, $forum_names
);
}
$table->construct_cell("<a href=\"index.php?module=config
-thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\" style=\"color
: inherit;\" title=\"".htmlspecialchars_uni($prefix['prefix'])."\">".$prefix['di
splaystyle']."</a>");
$table->construct_cell($forum_names);
$table->construct_cell("<a href=\"index.php?module=config -thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\">{$lang->edit} </a>", array('width' => 100, 'class' => "align_center")); $table->construct_cell("<a href=\"index.php?module=config -thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\">{$lang->edit} </a>", array('width' => 100, 'class' => "align_center"));
$table->construct_cell("<a href=\"index.php?module=config -thread_prefixes&amp;action=delete_prefix&amp;pid={$prefix['pid']}&amp;my_post_k ey={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lan g->confirm_thread_prefix_deletion}')\">{$lang->delete}</a>", array('width' => 10 0, 'class' => 'align_center')); $table->construct_cell("<a href=\"index.php?module=config -thread_prefixes&amp;action=delete_prefix&amp;pid={$prefix['pid']}&amp;my_post_k ey={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lan g->confirm_thread_prefix_deletion}')\">{$lang->delete}</a>", array('width' => 10 0, 'class' => 'align_center'));
$table->construct_row(); $table->construct_row();
} }
} }
if($table->num_rows() == 0) if($table->num_rows() == 0)
{ {
$table->construct_cell($lang->no_thread_prefixes, array('colspan' => 3)); $table->construct_cell($lang->no_thread_prefixes, array('colspan' => 3));
$table->construct_row(); $table->construct_row();
} }
$table->output($lang->thread_prefixes); if(!isset($title))
{
$title = $lang->thread_prefixes;
}
$table->output($title);
$page->output_footer(); $page->output_footer();
} }
function thread_prefix_sort($a, $b)
{
// all forums
if($a['forums'] === '-1' && $b['forums'] !== '-1')
{
return -1;
}
if($a['forums'] !== '-1' && $b['forums'] === '-1')
{
return 1;
}
// multiple forums
if(count($a['forum_fids']) > 1 xor count($b['forum_fids']) > 1)
{
return count($b['forum_fids']) - count($a['forum_fids']);
}
// natural sort order: forum name
elseif(
count($a['forum_fids']) === 1 && count($b['forum_fids']) === 1 &&
$a['forum_fids'][0] !== $b['forum_fids'][0]
)
{
$forum_a = get_forum($a['forum_fids'][0], 1);
$forum_b = get_forum($b['forum_fids'][0], 1);
if($forum_a !== false && $forum_b !== false)
{
return strnatcmp($forum_a['name'], $forum_b['name']);
}
}
// natural sort order: prefix
return strnatcmp($a['prefix'], $b['prefix']);
}
 End of changes. 6 change blocks. 
4 lines changed or deleted 67 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)