Template HTML Bits:
{$this->altered} This item has been customized for this skin set.
{$this->unaltered} This item has not been customized from the master skin set.
{$this->inherited} This item has inherited customizations from the parent skin set.
";
$ibforums->html .= $ibforums->adskin->skin_jump_menu_wrap();
//-----------------------------------------
//-------------------------------
$ibforums->admin->nav[] = array( 'act=sets' ,'Skin Manager Home' );
$ibforums->admin->nav[] = array( '' ,'Managing Template Set "'.$this_set['set_name'].'"' );
$ibforums->admin->output();
}
//-----------------------------------------
// Sneaky sorting.
// We use the format "1: name". without this hack
// 1: name, 2: other name, 11: other name
// will sort as 1: name, 11: other name, 2: other name
// There is natsort and such in PHP, but it causes some
// problems on older PHP installs, this is hackish but works
// by simply adding '0' to a number less than 2 characters long.
// of course, this won't work with three numerics in the hundreds
// but we don't have to worry about more that 99 bits in a template
// at this stage.
//-----------------------------------------
function perly_word_sort($a, $b)
{
$nat_a = intval( $a['easy_name'] );
$nat_b = intval( $b['easy_name'] );
if (strlen($nat_a) < 2)
{
$nat_a = '0'.$nat_a;
}
if (strlen($nat_b) < 2)
{
$nat_b = '0'.$nat_b;
}
return strcmp($nat_a, $nat_b);
}
//-----------------------------------------
// Sort by group name
//-----------------------------------------
function perly_alpha_sort($a, $b)
{
return strcmp( strtolower($a['easy_name']), strtolower($b['easy_name']) );
}
//-----------------------------------------
// Find popular bits :D
//-----------------------------------------
function find_popular()
{
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS;
//-----------------------------------------
// Get skin set
//-----------------------------------------
$this_set = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id=".$ibforums->input['id'] ) );
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("You must specify an existing template set ID, go back and try again");
}
//-----------------------------------------
// Parent?
//-----------------------------------------
if ( ! $ibforums->input['p'] )
{
if ( $this_set['set_skin_set_parent'] )
{
$ibforums->input['p'] = $this_set['set_skin_set_parent'];
}
}
switch ( $ibforums->input['entry'] )
{
case 'boardheader':
$group_titles = $ibforums->cache_func->_get_templates($ibforums->input['id'], $ibforums->input['p'], 'groups', 'skin_global');
foreach( $group_titles as $func_name => $r )
{
if ( in_array( $func_name, array( 'member_bar', 'global_board_header' ) ) )
{
$ibforums->input['cb_'.$r['suid']] = 1;
}
}
break;
case 'catforum':
$group_titles = $ibforums->cache_func->_get_templates($ibforums->input['id'], $ibforums->input['p'], 'groups', 'skin_boards');
foreach( $group_titles as $func_name => $r )
{
if ( in_array( $func_name, array( "catheader_expanded", "pagetop", "end_this_cat", "end_all_cats", "forumrow" ) ) )
{
$ibforums->input['cb_'.$r['suid']] = 1;
}
}
break;
case 'topiclist':
$group_titles = $ibforums->cache_func->_get_templates($ibforums->input['id'], $ibforums->input['p'], 'groups', 'skin_forum');
foreach( $group_titles as $func_name => $r )
{
if ( in_array( $func_name, array( "pagetop", "tableend", "render_forum_row", "render_pinned_start", "render_pinned_end", "render_pinned_row" ) ) )
{
$ibforums->input['cb_'.$r['suid']] = 1;
}
}
break;
default:
$group_titles = $ibforums->cache_func->_get_templates($ibforums->input['id'], $ibforums->input['p'], 'groups', 'skin_topic');
foreach( $group_titles as $func_name => $r )
{
if ( in_array( $func_name, array( "topic_page_top_new_mode","topic_page_top_classic", "tablefooter", "renderrow" ) ) )
{
$ibforums->input['cb_'.$r['suid']] = 1;
}
}
break;
}
$this->edit_bit();
}
//-----------------------------------------
// ADD TEMPLATE BIT
//-----------------------------------------
function add_bit()
{
global $ibforums, $DB, $std;
$ibforums->admin->page_detail = "You may add a template bit using this section.";
$ibforums->admin->page_title = "Template Editing";
$groupname = $ibforums->input['expand'];
$this_set = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id=".$ibforums->input['id'] ) );
//-----------------------------------------
// Sort out group titles
//-----------------------------------------
$group_titles = $ibforums->cache_func->_get_templates( $ibforums->input['id'], $ibforums->input['p'], 'groups' );
$formatted_groups = array();
foreach ( $group_titles as $name => $d )
{
$formatted_groups[] = array( $d['group_name'], $d['group_name'] );
}
//-----------------------------------------
// Good form old nboy
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->js_template_tools();
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'doadd' ),
2 => array( 'act' , 'templ' ),
3 => array( 'id' , $ibforums->input['id'] ),
4 => array( 'p' , $ibforums->input['p'] ),
5 => array( 'expand', $ibforums->input['expand'] ),
) , "theform" );
//-----------------------------------------
// Editor prefs strip
//-----------------------------------------
$options .= "
";
$ibforums->html .= $this->functions->build_generic_editor_area( array( 'act' => 'templ', 'title' => 'Add New Template Bit', 'textareaname' => 'newbit', 'textareainput' => $std->txt_stripslashes($_POST['txtnewbit']) ) );
$ibforums->html = str_replace( '', $options, $ibforums->html );
$formbuttons = "