本文整理汇总了PHP中PMF_Category::updateCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Category::updateCategory方法的具体用法?PHP PMF_Category::updateCategory怎么用?PHP PMF_Category::updateCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Category
的用法示例。
在下文中一共展示了PMF_Category::updateCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
$permissions += array('restricted_user' => array(PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT)));
}
if ('all' === PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING)) {
$permissions += array('restricted_groups' => array(-1));
} else {
$permissions += PMF_Filter::filterInputArray(INPUT_POST, array('restricted_groups' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
}
if (!$category->checkLanguage($categoryData['id'], $categoryData['lang'])) {
if ($category->addCategory($categoryData, $parentId, $categoryData['id']) && $category->addPermission('user', array($categoryData['id']), $permissions['restricted_user']) && $category->addPermission('group', array($categoryData['id']), $permissions['restricted_groups'])) {
printf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_categ_translated']);
} else {
printf('<p class="alert alert-error">%s</p>', $faqConfig->getDb()->error());
}
} else {
if ($category->updateCategory($categoryData)) {
$category->deletePermission('user', array($categoryData['id']));
$category->deletePermission('group', array($categoryData['id']));
$category->addPermission('user', array($categoryData['id']), $permissions['restricted_user']);
$category->addPermission('group', array($categoryData['id']), $permissions['restricted_groups']);
printf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_categ_updated']);
} else {
printf('<p class="alert alert-error">%s</p>', $faqConfig->getDb()->error());
}
}
// All the other translations
$languages = PMF_Filter::filterInput(INPUT_POST, 'used_translated_languages', FILTER_SANITIZE_STRING);
}
// Deletes an existing category
if ($permission['delcateg'] && $action == 'removecategory') {
$category = new PMF_Category($faqConfig, array(), false);
示例2: array
if ($action == 'updatecategory') {
$category = new PMF_Category($current_admin_user, $current_admin_groups, false);
$parent_id = PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT);
$category_data = array('id' => PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT), 'lang' => PMF_Filter::filterInput(INPUT_POST, 'catlang', FILTER_SANITIZE_STRING), 'parent_id' => $parent_id, 'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING), 'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING), 'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT));
$userperm = PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING);
$user_allowed = 'all' == $userperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT);
$groupperm = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING);
$group_allowed = 'all' == $groupperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT);
if (!$category->checkLanguage($category_data['id'], $category_data['lang'])) {
if ($category->addCategory($category_data, $parent_id, $category_data['id']) && $category->addPermission('user', array($category_data['id']), $user_allowed) && $category->addPermission('group', array($category_data['id']), $group_allowed)) {
printf('<p class="success">%s</p>', $PMF_LANG['ad_categ_translated']);
} else {
printf('<p class="error">%s</p>', $db->error());
}
} else {
if ($category->updateCategory($category_data)) {
$category->deletePermission('user', array($category_data['id']));
$category->deletePermission('group', array($category_data['id']));
$category->addPermission('user', array($category_data['id']), $user_allowed);
$category->addPermission('group', array($category_data['id']), $group_allowed);
printf('<p class="success">%s</p>', $PMF_LANG['ad_categ_updated']);
} else {
printf('<p class="error">%s</p>', $db->error());
}
}
// All the other translations
$languages = PMF_Filter::filterInput(INPUT_POST, 'used_translated_languages', FILTER_SANITIZE_STRING);
if ($faqconfig->get('main.enableGoogleTranslation') === true && !empty($languages)) {
$languages = explode(",", $languages);
$category_lang = $category_data['lang'];
$category_id = $category_data['id'];