本文整理汇总了PHP中PMF_Category类的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Category类的具体用法?PHP PMF_Category怎么用?PHP PMF_Category使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PMF_Category类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendAskedQuestion
function sendAskedQuestion($username, $usermail, $usercat, $content)
{
global $IDN, $category, $PMF_LANG, $faq, $faqconfig;
$retval = false;
$cat = new PMF_Category();
$categories = $cat->getAllCategories();
if ($faqconfig->get('records.enableVisibilityQuestions')) {
$visibility = 'N';
} else {
$visibility = 'Y';
}
$questionData = array('ask_username' => $username, 'ask_usermail' => $IDN->encode($usermail), 'ask_category' => $usercat, 'ask_content' => $content, 'ask_date' => date('YmdHis'), 'is_visible' => $visibility);
list($user, $host) = explode("@", $questionData['ask_usermail']);
if (PMF_Filter::filterVar($questionData['ask_usermail'], FILTER_VALIDATE_EMAIL) != false) {
$faq->addQuestion($questionData);
$questionMail = "User: " . $questionData['ask_username'] . ", mailto:" . $questionData['ask_usermail'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['ask_category']]["name"] . "\n\n" . wordwrap($content, 72);
$userId = $category->getCategoryUser($questionData['ask_category']);
$oUser = new PMF_User();
$oUser->getUserById($userId);
$userEmail = $oUser->getUserData('email');
$mainAdminEmail = $faqconfig->get('main.administrationMail');
$mail = new PMF_Mail();
$mail->unsetFrom();
$mail->setFrom($questionData['ask_usermail'], $questionData['ask_username']);
$mail->addTo($mainAdminEmail);
// Let the category owner get a copy of the message
if ($userEmail && $mainAdminEmail != $userEmail) {
$mail->addCc($userEmail);
}
$mail->subject = '%sitename%';
$mail->message = $questionMail;
$retval = $mail->send();
}
return $retval;
}
示例2: __construct
/**
* Constructor
*
* @param PMF_Category $parent Parent PMF_Category object
*
* @return void
*/
public function __construct(PMF_Category_Tree_DataProvider_Interface $dataProvider, PMF_Category $parent = NULL)
{
$parentId = $parent ? (int) $parent->getId() : 0;
$resultset = $dataProvider->getData($parentId);
parent::__construct($resultset);
$this->parent = $parent;
$this->dataProvider = $dataProvider;
}
示例3: header
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
?>
<header>
<h2><?php
print $PMF_LANG['ad_categ_new'];
?>
</h2>
</header>
<?php
if ($permission["addcateg"]) {
$category = new PMF_Category($current_admin_user, $current_admin_groups, false);
$parent_id = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
?>
<form action="?action=savecategory" method="post">
<input type="hidden" id="lang" name="lang" value="<?php
print $LANGCODE;
?>
" />
<input type="hidden" name="parent_id" value="<?php
print $parent_id;
?>
" />
<input type="hidden" name="csrf" value="<?php
print $user->getCsrfTokenFromSession();
?>
" />
示例4: header
* @copyright 2003-2014 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2003-03-10
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
if ($user->perm->checkRight($user->getUserId(), 'editcateg')) {
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
$category = new PMF_Category($faqConfig, [], false);
$category->setUser($currentAdminUser);
$category->setGroups($currentAdminGroups);
$categories = $category->getAllCategories();
$userPermission = $category->getPermissions('user', array($categoryId));
$groupPermission = $category->getPermissions('group', array($categoryId));
$templateVars = array('PMF_LANG' => $PMF_LANG, 'allGroups' => $groupPermission[0] == -1, 'allUsers' => $userPermission[0] == -1, 'categoryId' => $categoryId, 'categoryDescription' => $categories[$categoryId]['description'], 'categoryLanguage' => $categories[$categoryId]['lang'], 'categoryName' => $categories[$categoryId]['name'], 'csrfToken' => $user->getCsrfTokenFromSession(), 'parentId' => $categories[$categoryId]['parent_id'], 'renderGroupPermissions' => false, 'restrictedGroups' => $groupPermission[0] != -1, 'restrictedUsers' => $userPermission[0] != -1, 'userOptionsOwner' => $user->getAllUserOptions($categories[$categoryId]['user_id']), 'userOptionsPermissions' => $user->getAllUserOptions($userPermission[0]));
if ($faqConfig->get('security.permLevel') != 'basic') {
$templateVars['renderGroupPermissions'] = true;
$templateVars['groupOptions'] = $user->perm->getAllGroupsOptions($groupPermission);
}
$twig->loadTemplate('category/edit.twig')->display($templateVars);
unset($templateVars, $categoryId, $category, $categories, $userPermission, $groupPermission);
} else {
require 'noperm.php';
}
示例5: header
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
//
// GET Parameters Syntax:
// export.file.php?
// type={pdf|xhtml|xml}
// [&dispos={inline|attachment}], default: attachment
// [&catid=NN[&downwards=1]], default: all, downwards
//
$categoryId = PMF_Filter::filterInput(INPUT_POST, 'catid', FILTER_VALIDATE_INT);
$downwards = PMF_Filter::filterInput(INPUT_POST, 'downwards', FILTER_VALIDATE_BOOLEAN, false);
$inlineDisposition = PMF_Filter::filterInput(INPUT_POST, 'dispos', FILTER_SANITIZE_STRING);
$type = PMF_Filter::filterInput(INPUT_POST, 'type', FILTER_SANITIZE_STRING, 'none');
$faq = new PMF_Faq($faqConfig);
$category = new PMF_Category($faqConfig);
$category->buildTree();
$tags = new PMF_Tags($faqConfig);
$export = PMF_Export::create($faq, $category, $faqConfig, $type);
$content = $export->generate($categoryId, $downwards);
// Stream the file content
$oHttpStreamer = new PMF_HttpStreamer(Response::create(), $type, $content);
if ('inline' == $inlineDisposition) {
$oHttpStreamer->send(PMF_HttpStreamer::HTTP_CONTENT_DISPOSITION_INLINE);
} else {
$oHttpStreamer->send(PMF_HttpStreamer::HTTP_CONTENT_DISPOSITION_ATTACHMENT);
}
示例6: header
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @copyright 2003-2014 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2003-02-24
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
if ($user->perm->checkRight($user->getUserId(), 'viewlog')) {
$category = new PMF_Category($faqConfig, [], false);
$category->setUser($currentAdminUser);
$category->setGroups($currentAdminGroups);
$ratings = new PMF_Rating($faqConfig);
$ratingdata = $ratings->getAllRatings();
$numratings = count($ratingdata);
$oldcategory = 0;
?>
<header class="row">
<div class="col-lg-12">
<h2 class="page-header"><i class="fa fa-tasks"></i> <?php
echo $PMF_LANG["ad_rs"];
?>
</h2>
</div>
</header>
示例7: PMF_Faq
}
//
// Found a article language?
//
$lang = PMF_Filter::filterInput(INPUT_POST, 'artlang', FILTER_SANITIZE_STRING);
if (is_null($lang) && !PMF_Language::isASupportedLanguage($lang)) {
$lang = $LANGCODE;
}
//
// Create a new FAQ object
//
$faq = new PMF_Faq($current_user, $current_groups);
//
// Create a new Category object
//
$category = new PMF_Category($current_user, $current_groups);
//
// Create a new Tags object
//
$oTag = new PMF_Tags();
//
// Found a record ID?
//
$id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if (!is_null($id)) {
$title = ' - ' . $faq->getRecordTitle($id);
$keywords = ' ' . $faq->getRecordKeywords($id);
} else {
$id = '';
$title = ' - powered by phpMyFAQ ' . $faqconfig->get('main.currentVersion');
$keywords = '';
示例8: PMF_Category
<h2 class="page-header">
<i class="fa fa-pencil"></i> <?php
echo $PMF_LANG['ad_menu_searchfaqs'];
?>
</h2>
</div>
<header>
<div class="row">
<div class="col-lg-12">
<?php
if ($user->perm->checkRight($user->getUserId(), 'editbt') || $user->perm->checkRight($user->getUserId(), 'delbt')) {
$searchcat = PMF_Filter::filterInput(INPUT_POST, 'searchcat', FILTER_VALIDATE_INT);
$searchterm = PMF_Filter::filterInput(INPUT_POST, 'searchterm', FILTER_SANITIZE_STRIPPED);
$category = new PMF_Category($faqConfig, [], false);
$category->setUser($currentAdminUser);
$category->setGroups($currentAdminGroups);
$category->transform(0);
// Set the Category for the helper class
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$category->buildTree();
$linkVerifier = new PMF_Linkverifier($faqConfig, $user->getLogin());
?>
<form action="?action=view" method="post" class="form-horizontal" accept-charset="utf-8">
<div class="form-group">
<label class="col-lg-2 control-label"><?php
print $PMF_LANG["msgSearchWord"];
示例9: PMF_Category
$search = PMF_Filter::filterInput(INPUT_GET, 'search', FILTER_SANITIZE_STRIPPED);
$page = PMF_Filter::filterInput(INPUT_GET, 'seite', FILTER_VALIDATE_INT, 1);
// Search only on current language (default)
if (!is_null($inputLanguage)) {
$allLanguages = true;
$languages = '&langs=all';
} else {
$allLanguages = false;
$languages = '';
}
// HACK: (re)evaluate the Category object w/o passing the user language
// so the result set of a Search will have the Category Path
// for any of the multilanguage faq records and the Category list
// on the left pane will not be affected
if ($allLanguages) {
$category = new PMF_Category($faqConfig);
$category->transform(0);
}
if (is_null($user)) {
$user = new PMF_User_CurrentUser($faqConfig);
}
$faqSearch = new PMF_Search($faqConfig);
$faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
$tagSearch = false;
//
// Handle the Tagging ID
//
if (!is_null($inputTag)) {
$tagSearch = true;
$tagging = new PMF_Tags($faqConfig);
$recordIds = $tagging->getRecordsByTagId($inputTag);
示例10: array
if (isset($user) && is_object($user)) {
$current_user = $user->getUserId();
if ($user->perm instanceof PMF_Perm_Medium) {
$current_groups = $user->perm->getUserGroups($current_user);
} else {
$current_groups = array(-1);
}
if (0 == count($current_groups)) {
$current_groups = array(-1);
}
} else {
$user = new PMF_User_CurrentUser($faqConfig);
$current_user = -1;
$current_groups = array(-1);
}
$category = new PMF_Category($faqConfig);
$category->setUser($current_user);
$category->transform(0);
$category->buildTree();
$faq = new PMF_Faq($faqConfig);
$faqSearch = new PMF_Search($faqConfig);
$faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
//
// Handle the search requests
//
if (!is_null($searchString)) {
$faqSearch->setCategory($categoryId);
$searchResult = $faqSearch->search($searchString, false);
$faqSearchResult->reviewResultset($searchResult);
$faqSearchHelper = new PMF_Helper_Search($faqConfig);
$faqSearchHelper->setSearchterm($searchString);
示例11: header
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
?>
<header>
<h2><i class="icon-list"></i> <?php
print $PMF_LANG['ad_menu_categ_structure'];
?>
</h2>
</header>
<?php
if ($permission['editcateg']) {
$category = new PMF_Category($faqConfig, array(), false);
$category->setUser($currentAdminUser);
$category->setGroups($currentAdminGroups);
$currentLink = $_SERVER['SCRIPT_NAME'];
$currentLanguage = $languageCodes[strtoupper($LANGCODE)];
$all_languages = array();
$all_lang = array();
$showcat = PMF_Filter::filterInput(INPUT_POST, 'showcat', FILTER_SANITIZE_STRING);
// translate an existing category
if (!is_null($showcat) && $showcat == 'yes') {
$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, 'lang', 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));
// translate.category only returns non-existent languages to translate too
if ($category->addCategory($category_data, $parent_id, $category_data['id'])) {
printf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_categ_translated']);
} else {
示例12: header
* 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['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
if ($permission["editcateg"]) {
$category = new PMF_Category($current_admin_user, $current_admin_groups, false);
$category->getMissingCategories();
$id = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
$header = sprintf('%s %s: <em>%s</em>', $PMF_LANG['ad_categ_trans_1'], $PMF_LANG['ad_categ_trans_2'], $category->categoryName[$id]['name']);
$selected_lang = PMF_Filter::filterInput(INPUT_POST, 'trlang', FILTER_SANITIZE_STRING, $LANGCODE);
if ($selected_lang != $LANGCODE) {
$action = "showcategory";
$showcat = "yes";
} else {
$action = "updatecategory";
$showcat = "no";
}
printf('<h2>%s</h2>', $header);
?>
<form action="?action=updatecategory" method="post">
<fieldset>
示例13: header
* @package Administration
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @author Minoru TODA <todam@netjapan.co.jp>
* @copyright 2003-2011 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
* @link http://www.phpmyfaq.de
* @since 2003-02-23
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
printf("<header><h2>%s</h2><header>\n", $PMF_LANG['ad_entry_aor']);
if ($permission['editbt'] || $permission['delbt']) {
// (re)evaluate the Category object w/o passing the user language
$category = new PMF_Category($current_admin_user, $current_admin_groups, false);
$category->transform(0);
// Set the Category for the helper class
$helper = PMF_Helper_Category::getInstance();
$helper->setCategory($category);
$category->buildTree();
$linkverifier = new PMF_Linkverifier($user->getLogin());
if ($linkverifier->isReady()) {
link_verifier_javascript();
}
$comment = new PMF_Comment();
$faq = new PMF_Faq();
$cond = $numCommentsByFaq = $numActiveByCat = array();
$internalSearch = $linkState = $searchterm = '';
$searchcat = $currentcategory = 0;
$orderby = 1;
示例14: header
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
?>
<header>
<h2><i class="icon-list"></i> <?php
echo $PMF_LANG['ad_categ_new'];
?>
</h2>
</header>
<?php
if ($permission['addcateg']) {
$category = new PMF_Category($faqConfig, array(), false);
$category->setUser($currentAdminUser);
$category->setGroups($currentAdminGroups);
$parentId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
?>
<form class="form-horizontal" action="?action=savecategory" method="post" accept-charset="utf-8">
<input type="hidden" id="lang" name="lang" value="<?php
echo $LANGCODE;
?>
">
<input type="hidden" name="parent_id" value="<?php
echo $parentId;
?>
">
<input type="hidden" name="csrf" value="<?php
echo $user->getCsrfTokenFromSession();
示例15: header
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @copyright 2003-2015 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2003-02-23
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
if (($permission['editbt'] || $permission['addbt']) && !PMF_Db::checkOnEmptyTable('faqcategories')) {
$category = new PMF_Category($faqConfig, array(), false);
$category->setUser($currentAdminUser);
$category->setGroups($currentAdminGroups);
$category->buildTree();
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$selectedCategory = '';
$categories = array();
$faqData = array('id' => 0, 'lang' => $LANGCODE, 'revision_id' => 0, 'title' => '', 'dateStart' => '', 'dateEnd' => '');
$tagging = new PMF_Tags($faqConfig);
$date = new PMF_Date($faqConfig);
if ('takequestion' === $action) {
$questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$question = $faq->getQuestion($questionId);
$selectedCategory = $question['category_id'];
$faqData['title'] = $question['question'];