示例#1
0
        flash_message("The variable has been created.", "success");
        admin_redirect($baseurl . "&tid=" . $new_variable['tid']);
    } else {
        // Usergroup query because no All option
        $usergroups['-1'] = "All";
        $usergroupquery = $db->simple_select("usergroups", "gid,title");
        while ($group = $db->fetch_array($usergroupquery)) {
            $usergroups[$group['gid']] = $group['title'];
        }
        $form = new DefaultForm("index.php?module=style-theme_vars&action=create", "post");
        $form_container = new FormContainer("Create");
        $form_container->output_row("Unique Name <em>*</em>", "Enter a unique name for the variable.", $form->generate_text_box("unique_name", $mybb->get_input("unique_name")), "unique_name");
        $form_container->output_row("Name <em>*</em>", "Enter the readable name of the variable.", $form->generate_text_box("name", $mybb->get_input("name")), "name");
        $form_container->output_row("Theme ", "Which theme the variable belongs to.", $form->generate_select_box("tid", $themearray, $mybb->get_input("tid")), "tid");
        $form_container->output_row("Active", "If no, this variable will not be replaced.", $form->generate_select_box("active", array("1" => "Yes", "0" => "No"), $mybb->get_input("active")), "active");
        $form_container->output_row("Forums", "Select which forums this variable will work in.", $form->generate_forum_select("forums[]", -1, array("main_option" => "All", "multiple" => "multiple")), "forums");
        $form_container->output_row("Usergroups", "Select which usergroups will see the content.", $form->generate_select_box("usergroups[]", $usergroups, -1, array("multiple" => "multiple")), "usergroups");
        $form_container->output_row("Content <em>*</em>", "This is the content users will see.", $form->generate_text_area("content", ""), "content");
        $form_container->end();
        $form->output_submit_wrapper(array($form->generate_submit_button("Create Variable")));
        $form->end();
    }
}
if ($mybb->input['action'] == "copy" && $mybb->input['vid']) {
    $vid = (int) $mybb->get_input("vid");
    $variablequery = $db->simple_select("theme_variables", "*", "vid={$vid}");
    $info = $db->fetch_array($variablequery);
    if (!$info['vid']) {
        flash_message("Invalid variable.", "error");
        admin_redirect("index.php?module=style-theme_vars");
    }