<commit_before><?php
/**
* $Id: category.add.php,v 1.10 2006-07-29 19:23:45 thorstenr Exp $
*
* Adds a category
*
* @author       <NAME> <<EMAIL>>
* @since        2003-12-20
* @copyright    (c) 2003-2006 phpMyFAQ Team
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/

if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}

print "<h2>".$PMF_LANG["ad_categ_new"]."</h2>\n";
if ($permission["addcateg"]) {
    $cat = new PMF_Category;
?>
    <form action="<?php print $_SERVER["PHP_SELF"].$linkext; ?>" method="post">
    <fieldset>
    <legend><?php print $PMF_LANG["ad_categ_new"]; ?></legend>
    <input type="hidden" name="action" value="savecategory" />
    <input type="hidden" name="parent_id" value="<?php if (isset($_GET["cat"])) { print $_GET["cat"]; } else { print "0"; } ?>" />
<?php
    if (isset($_GET["cat"])) {
?>
    <p><?php print $PMF_LANG["msgMainCategory"].": ".$cat->categoryName[$_GET["cat"]]["name"]." (".$languageCodes[strtoupper($cat->categoryName[$_GET["cat"]]["lang"])].")"; ?></p>
<?php
    }
?>
    <label class="left"><?php print $PMF_LANG["ad_categ_titel"]; ?>:</label>
    <input type="text" name="name" size="30" style="width: 250px;" /><br />

    <label class="left"><?php print $PMF_LANG["ad_categ_lang"]; ?>:</label>
    <select name="lang" size="1">
<?php
    if (isset($_GET["cat"])) {
        print languageOptions($cat->categoryName[$_GET["cat"]]["lang"], true);
    } else {
        print languageOptions($LANGCODE);
    }
?>
    </select><br />

    <label class="left"><?php print $PMF_LANG["ad_categ_desc"]; ?>:</label>
    <input type="text" name="description" size="30" style="width: 250px;" /><br />

    <label class="left">User-ID:</label>
    <input type="text" name="user_id" size="30" style="width: 250px;" /><br />

    <input class="submit" style="margin-left: 190px;" type="submit" name="submit" value="<?php print $PMF_LANG["ad_categ_add"]; ?>" />

    </fieldset>
    </form>
<?php
} else {
    print $PMF_LANG["err_NotAuth"];
}
?><commit_msg>Added dropdown list for user selection<commit_after><?php
/**
* $Id: category.add.php,v 1.11 2006-08-15 06:30:25 thorstenr Exp $
*
* Adds a category
*
* @author       <NAME> <<EMAIL>>
* @since        2003-12-20
* @copyright    (c) 2003-2006 phpMyFAQ Team
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/

if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}

print "<h2>".$PMF_LANG["ad_categ_new"]."</h2>\n";
if ($permission["addcateg"]) {
    $cat = new PMF_Category;
?>
    <form action="<?php print $_SERVER["PHP_SELF"].$linkext; ?>" method="post">
    <fieldset>
    <legend><?php print $PMF_LANG["ad_categ_new"]; ?></legend>
    <input type="hidden" name="action" value="savecategory" />
    <input type="hidden" name="parent_id" value="<?php if (isset($_GET["cat"])) { print $_GET["cat"]; } else { print "0"; } ?>" />
<?php
    if (isset($_GET["cat"])) {
?>
    <p><?php print $PMF_LANG["msgMainCategory"].": ".$cat->categoryName[$_GET["cat"]]["name"]." (".$languageCodes[strtoupper($cat->categoryName[$_GET["cat"]]["lang"])].")"; ?></p>
<?php
    }
?>
    <label class="left"><?php print $PMF_LANG["ad_categ_titel"]; ?>:</label>
    <input type="text" name="name" size="30" style="width: 250px;" /><br />

    <label class="left"><?php print $PMF_LANG["ad_categ_lang"]; ?>:</label>
    <select name="lang" size="1">
<?php
    if (isset($_GET["cat"])) {
        print languageOptions($cat->categoryName[$_GET["cat"]]["lang"], true);
    } else {
        print languageOptions($LANGCODE);
    }
?>
    </select><br />

    <label class="left"><?php print $PMF_LANG["ad_categ_desc"]; ?>:</label>
    <input type="text" name="description" size="30" style="width: 250px;" /><br />

    <label class="left">User-ID:</label>
    <select name="user_id" size="1">
<?php
    $allUsers = $user->getAllUsers();
    foreach ($allUsers as $user_id) {
        if (-1 != $user_id) {
            $user->getUserById($user_id);
            printf('<option value="%d"%s>%s</option>',
                $user_id,
                ((1 == $user_id) ? 'selected="selected"' : ''),
                $user->getUserData('display_name'));
        }
    }
?>
    </select><br />

    <input class="submit" style="margin-left: 190px;" type="submit" name="submit" value="<?php print $PMF_LANG["ad_categ_add"]; ?>" />

    </fieldset>
    </form>
<?php
} else {
    print $PMF_LANG["err_NotAuth"];
}
{'fraction_non_alphanumeric': 0.21044858777921358, 'fraction_numerical': 0.020675650729185896, 'mean_word_length': 4.082551594746716, 'pattern_counts': {'":': 2, '<': 99, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4988214', 'n_tokens_mistral': 1924, 'n_tokens_neox': 1840, 'n_words': 434}