コード例 #1
0
ファイル: category.main.php プロジェクト: nosch/phpMyFAQ
             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 {
         printf('<p class="error">%s<br />%s</p>', $PMF_LANG['ad_categ_paste_error'], $db->error());
     }
 }
コード例 #2
0
ファイル: record.add.php プロジェクト: nosch/phpMyFAQ
         $categoryGroup = new PMF_Category_Group();
         $categoryRelations = new PMF_Category_Relations();
         $categoryRelations->setLanguage($recordData['lang']);
         foreach ($categories['rubrik'] as $categoryId) {
             // Insert the new category relations
             $categoryData = array('category_id' => $categoryId, 'category_lang' => $categoryRelations->getLanguage(), 'record_id' => $recordId, 'record_lang' => $recordData['lang']);
             // save or update the category relations
             $categoryRelations->create($categoryData);
             // Add user permissions
             $userPermission = array('category_id' => $categoryId, 'user_id' => $restricted_users);
             $categoryUser->delete($categoryId);
             $categoryUser->create($userPermission);
             // Add group permission
             if ($groupSupport) {
                 $groupPermission = array('category_id' => $categoryId, 'group_id' => $restricted_groups);
                 $categoryGroup->delete($categoryId);
                 $categoryGroup->create($groupPermission);
             }
         }
         print $PMF_LANG['ad_entry_savedsuc'];
         // Call Link Verification
         link_ondemand_javascript($recordId, $recordData['lang']);
         ?>
 <script type="text/javascript">
 <!--
 $(document).ready(function(){
     setTimeout(function() {
         window.location = "index.php?action=view";
         }, 5000);
     });
 //-->