$table->construct_row(); } $table->output("{$lang->stylesheets_in} " . htmlspecialchars_uni($theme['name'])); $buttons = array($form->generate_submit_button($lang->save_stylesheet_order)); $form->output_submit_wrapper($buttons); $form->end(); echo '<br />'; // Theme Properties table if ($errors) { $page->output_inline_error($errors); } $form = new Form("index.php?module=style-themes&action=edit", "post", "edit"); echo $form->generate_hidden_field("tid", $theme['tid']); $form_container = new FormContainer($lang->edit_theme_properties); $form_container->output_row($lang->name . " <em>*</em>", $lang->name_desc_edit, $form->generate_text_box('name', $theme['name'], array('id' => 'name')), 'name'); $options = build_theme_array($theme['tid']); $form_container->output_row($lang->parent_theme . " <em>*</em>", $lang->parent_theme_desc, $form->generate_select_box('pid', $options, $theme['pid'], array('id' => 'pid')), 'pid'); $options = array(); $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title')); $options['all'] = $lang->all_user_groups; while ($usergroup = $db->fetch_array($query)) { $options[(int) $usergroup['gid']] = $usergroup['title']; } $form_container->output_row($lang->allowed_user_groups, $lang->allowed_user_groups_desc, $form->generate_select_box('allowedgroups[]', $options, explode(",", $theme['allowedgroups']), array('id' => 'allowedgroups', 'multiple' => true, 'size' => 5)), 'allowedgroups'); $options = array(); $query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title')); while ($templateset = $db->fetch_array($query)) { $options[(int) $templateset['sid']] = $templateset['title']; } $form_container->output_row($lang->template_set . " <em>*</em>", $lang->template_set_desc, $form->generate_select_box('templateset', $options, $properties['templateset'], array('id' => 'templateset')), 'templateset'); $options = array();
function build_theme_array($ignoretid = null, $parent = 0, $depth = 0) { global $mybb, $lang, $list; static $theme_cache; if (!is_array($theme_cache)) { $themes = cache_themes(); // Restrucure the theme array to something we can "loop-de-loop" with foreach ($themes as $key => $theme) { if ($key == "default") { continue; } $theme_cache[$theme['pid']][$theme['tid']] = $theme; } unset($theme); } if (!is_array($theme_cache[$parent]) || $ignoretid === $parent) { return; } foreach ($theme_cache[$parent] as $theme) { if ($ignoretid === $theme['tid']) { continue; } $list[$theme['tid']] = str_repeat("--", $depth) . $theme['name']; // Fetch & build any child themes build_theme_array($ignoretid, $theme['tid'], $depth + 1); } if (!$parent) { return $list; } }