コード例 #1
0
ファイル: category.main.php プロジェクト: nosch/phpMyFAQ
             $groupPermission = array('category_id' => $categoryNode->getCategoryId(), 'group_id' => $groupAllowed);
             $categoryUser->update($categoryId, $userPermission);
             $categoryGroup->update($categoryId, $groupPermission);
             printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_updated']);
         } else {
             printf('<p class="error">%s</p>', $db->error());
         }
     }
 }
 // Deletes an existing category
 if ($permission['delcateg'] && $action == 'removecategory') {
     $categoryId = PMF_Filter::filterInput(INPUT_POST, 'cat', FILTER_VALIDATE_INT);
     $categoryLang = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING);
     $deleteAll = PMF_Filter::filterInput(INPUT_POST, 'deleteall', FILTER_SANITIZE_STRING);
     if ('yes' == $deleteAll) {
         $categoryNode->setLanguage($categoryLang);
         $categoryRelations->setLanguage($categoryLang);
     }
     if ($categoryNode->delete($categoryId) && $categoryRelations->delete($categoryId) && $categoryUser->delete($categoryId) && $categoryGroup->delete($categoryId)) {
         printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_deleted']);
     } else {
         printf('<p class="error">%s</p>', $db->error());
     }
 }
 // Moves a category
 if ($action == 'changecategory') {
     $firstCategoryId = PMF_Filter::filterInput(INPUT_POST, 'cat', FILTER_VALIDATE_INT);
     $secondCategoryId = PMF_Filter::filterInput(INPUT_POST, 'change', FILTER_VALIDATE_INT);
     if ($categoryHelper->swapCategories($firstCategoryId, $secondCategoryId)) {
         printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_updated']);
     } else {
コード例 #2
0
ファイル: category.translate.php プロジェクト: nosch/phpMyFAQ
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Rudi Ferrari <*****@*****.**>
 * @copyright 2006-2010 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2006-09-10
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
if ($permission["editcateg"]) {
    $categoryHelper = new PMF_Category_Helper();
    $categoryNode = new PMF_Category_Node();
    // Set language
    $categoryNode->setLanguage($LANGCODE);
    $categoryId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
    $categoryData = $categoryNode->fetch($categoryId);
    $header = sprintf('%s %s: <em>%s</em>', $PMF_LANG['ad_categ_trans_1'], $PMF_LANG['ad_categ_trans_2'], $categoryData->name);
    $selectedLanguage = PMF_Filter::filterInput(INPUT_POST, 'trlang', FILTER_SANITIZE_STRING, $LANGCODE);
    if ($selectedLanguage != $LANGCODE) {
        $showCategories = 'yes';
    } else {
        $showCategories = 'no';
    }
    printf('<h2>%s</h2>', $header);
    ?>
    <form action="?action=updatecategory" method="post">
    <fieldset>
    <legend><?php 
    print $header;