当前位置: 首页>>代码示例>>PHP>>正文


PHP PMF_Category::addPermission方法代码示例

本文整理汇总了PHP中PMF_Category::addPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Category::addPermission方法的具体用法?PHP PMF_Category::addPermission怎么用?PHP PMF_Category::addPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMF_Category的用法示例。


在下文中一共展示了PMF_Category::addPermission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: explode

     if ($faq->isAlreadyTranslated($record_id, $record_lang)) {
         $faq->updateRecord($recordData);
     } else {
         $record_id = $faq->addRecord($recordData, false);
     }
     $faq->deleteCategoryRelations($record_id, $record_lang);
     $faq->addCategoryRelations($categories['rubrik'], $record_id, $record_lang);
     if ($tags != '') {
         $tagging->saveTags($record_id, explode(',', $tags));
     } else {
         $tagging->deleteTagsFromRecordId($record_id);
     }
     $faq->deletePermission('user', $record_id);
     $faq->addPermission('user', $record_id, $restricted_users);
     $category->deletePermission('user', $categories['rubrik']);
     $category->addPermission('user', $categories['rubrik'], $restricted_users);
     if ($faqConfig->get('security.permLevel') != 'basic') {
         $faq->deletePermission('group', $record_id);
         $faq->addPermission('group', $record_id, $restricted_groups);
         $category->deletePermission('group', $categories['rubrik']);
         $category->addPermission('group', $categories['rubrik'], $restricted_groups);
     }
 } else {
     if ('insertentry' == $do) {
         unset($recordData['id']);
         unset($recordData['revision_id']);
         $revision_id = 1;
         $record_id = $faq->addRecord($recordData);
         if ($record_id) {
             $faq->createChangeEntry($record_id, $user->getUserId(), nl2br($changed), $recordData['lang']);
             $visits = new PMF_Visits($faqConfig);
开发者ID:Ravikumarsreerama,项目名称:faq,代码行数:31,代码来源:ajax.autosave.php

示例2: array

 $newData = array('lang' => $isTranslation == true ? $newLanguage : $languageCode, 'thema' => $question, 'active' => $autoActivate ? FAQ_SQL_ACTIVE_YES : FAQ_SQL_ACTIVE_NO, 'sticky' => 0, 'content' => nl2br($answer), 'keywords' => $keywords, 'author' => $name, 'email' => $email, 'comment' => FAQ_SQL_YES, 'date' => date('YmdHis'), 'dateStart' => '00000000000000', 'dateEnd' => '99991231235959', 'linkState' => '', 'linkDateCheck' => 0);
 if ($isNew) {
     $categories = $categories['rubrik'];
 } else {
     $newData['id'] = $faqid;
     $categories = $category->getCategoryIdsFromArticle($newData['id']);
 }
 $recordId = $faq->addRecord($newData, $isNew);
 $faq->addCategoryRelations($categories, $recordId, $newData['lang']);
 // Activate visits
 $visits = PMF_Visits::getInstance();
 $visits->add($recordId, $newData['lang']);
 if ($autoActivate) {
     // Add user permissions
     $faq->addPermission('user', $recordId, -1);
     $category->addPermission('user', $categories['rubrik'], array(-1));
     // Add group permission
     if ($faqconfig->get('security.permLevel') != 'basic') {
         $faq->addPermission('group', $recordId, -1);
         $category->addPermission('group', $categories['rubrik'], array(-1));
     }
 }
 // Let the PMF Administrator and the Category Owner to be informed by email of this new entry
 $send = array();
 $mail = new PMF_Mail();
 $mail->setReplyTo($email, $name);
 $mail->addTo($faqconfig->get('main.administrationMail'));
 $send[$faqconfig->get('main.administrationMail')] = 1;
 foreach ($categories as $_category) {
     $userId = $category->getCategoryUser($_category);
     // @todo Move this code to Category.php
开发者ID:atlcurling,项目名称:tkt,代码行数:31,代码来源:ajaxservice.php

示例3: printf

         printf('<p class="success">%s</p>', $PMF_LANG['ad_categ_added']);
     } else {
         printf('<p class="error">%s</p>', $db->error());
     }
 }
 // Updates an existing category
 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());
         }
     }
开发者ID:atlcurling,项目名称:tkt,代码行数:31,代码来源:category.main.php

示例4: array

 $category->setGroups($currentAdminGroups);
 $parentId = PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT);
 $categoryData = array('id' => PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT), 'lang' => PMF_Filter::filterInput(INPUT_POST, 'catlang', FILTER_SANITIZE_STRING), 'parent_id' => $parentId, '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));
 $permissions = array();
 if ('all' === PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING)) {
     $permissions += array('restricted_user' => array(-1));
 } 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());
     }
 }
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:31,代码来源:category.main.php

示例5: array

 if ($openQuestionId) {
     if ($faqConfig->get('records.enableDeleteQuestion')) {
         $faq->deleteQuestion($openQuestionId);
     } else {
         // adds this faq record id to the related open question
         $faq->updateQuestionAnswer($openQuestionId, $recordId, $categories[0]);
     }
 }
 // Activate visits
 $visits = new PMF_Visits($faqConfig);
 $visits->add($recordId, $newData['lang']);
 // Set permissions
 $userPermissions = $category->getPermissions('user', $categories);
 // Add user permissions
 $faq->addPermission('user', $recordId, $userPermissions);
 $category->addPermission('user', $categories, $userPermissions);
 // Add group permission
 if ($faqConfig->get('security.permLevel') !== 'basic') {
     $groupPermissions = $category->getPermissions('group', $categories);
     $faq->addPermission('group', $recordId, $groupPermissions);
     $category->addPermission('group', $categories, $groupPermissions);
 }
 // Let the PMF Administrator and the Category Owner to be informed by email of this new entry
 $send = array();
 $mail = new PMF_Mail($faqConfig);
 $mail->setReplyTo($email, $name);
 $mail->addTo($faqConfig->get('main.administrationMail'));
 $send[$faqConfig->get('main.administrationMail')] = 1;
 foreach ($categories as $_category) {
     $userId = $category->getCategoryUser($_category);
     // @todo Move this code to Category.php
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:31,代码来源:ajaxservice.php


注:本文中的PMF_Category::addPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。