コード例 #1
0
ファイル: savequestion.php プロジェクト: noon/phpMyFAQ
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: "******", 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
0
ファイル: Tree.php プロジェクト: nosch/phpMyFAQ
 /**
  * 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
0
ファイル: category.add.php プロジェクト: atlcurling/tkt
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
0
 * @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
0
ファイル: export.file.php プロジェクト: ae120/phpMyFAQ
    $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
0
 * @author    Thorsten Rinne <*****@*****.**>
 * @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
0
ファイル: index.php プロジェクト: noon/phpMyFAQ
}
//
// 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
0
ファイル: record.search.php プロジェクト: ae120/phpMyFAQ
                <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
0
$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 = '&amp;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
0
ファイル: ajaxresponse.php プロジェクト: ae120/phpMyFAQ
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);
    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
0
ファイル: category.translate.php プロジェクト: noon/phpMyFAQ
 * 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
0
ファイル: record.show.php プロジェクト: atlcurling/tkt
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Minoru TODA <*****@*****.**>
 * @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
0
    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
0
 * @author    Thorsten Rinne <*****@*****.**>
 * @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'];
コード例 #16
0
ファイル: category.translate.php プロジェクト: atlcurling/tkt
 *
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Rudi Ferrari <*****@*****.**>
 * @copyright 2006-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     2006-09-10
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    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";
    }
    $user_permission = $category->getPermissions('user', array($id));
    $group_permission = $category->getPermissions('group', array($id));
    ?>
        <header>
コード例 #17
0
ファイル: ajaxservice.php プロジェクト: atlcurling/tkt
                 $send[$catOwnerEmail] = 1;
             }
         }
         $mail->subject = '%sitename%';
         // @todo let the email contains the faq article both as plain text and as HTML
         $mail->message = html_entity_decode($PMF_LANG['msgMailCheck']) . "\n\n" . $faqconfig->get('main.titleFAQ') . ": " . $faqconfig->get('main.referenceURL') . '/admin/';
         $result = $mail->send();
         unset($mail);
         $message = array('success' => $isNew ? $PMF_LANG['msgNewContentThanks'] : $PMF_LANG['msgNewTranslationThanks']);
     } else {
         $message = array('error' => $PMF_LANG['err_SaveEntries']);
     }
     break;
 case 'savequestion':
     $faq = new PMF_Faq();
     $cat = new PMF_Category();
     $categories = $cat->getAllCategories();
     $name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
     $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
     $ucategory = PMF_Filter::filterInput(INPUT_POST, 'category', FILTER_VALIDATE_INT);
     $question = PMF_Filter::filterInput(INPUT_POST, 'question', FILTER_SANITIZE_STRIPPED);
     $save = PMF_Filter::filterInput(INPUT_POST, 'save', FILTER_VALIDATE_INT, 0);
     // If e-mail address is set to optional
     if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($email)) {
         $email = PMF_Configuration::getInstance()->get('main.administrationMail');
     }
     if (!is_null($name) && !empty($name) && !is_null($email) && !empty($email) && !is_null($question) && !empty($question) && checkBannedWord(PMF_String::htmlspecialchars($question))) {
         if (PMF_Configuration::getInstance()->get('records.enableVisibilityQuestions')) {
             $visibility = 'N';
         } else {
             $visibility = 'Y';
コード例 #18
0
ファイル: user.php プロジェクト: maggiofrancesco/phpMyFAQ
 $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
 if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
     $csrfOkay = false;
 }
 $userAction = $defaultUserAction;
 if ($userId == 0 && !$csrfOkay) {
     $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
 } else {
     if (!$user->getUserById($userId)) {
         $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
     }
     if (!$user->deleteUser()) {
         $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_delete']);
     } else {
         // Move the categories ownership to admin (id == 1)
         $oCat = new PMF_Category($faqConfig, [], false);
         $oCat->setUser($currentAdminUser);
         $oCat->setGroups($currentAdminGroups);
         $oCat->moveOwnership($userId, 1);
         // Remove the user from groups
         if ('medium' == $faqConfig->get('security.permLevel')) {
             $oPerm = PMF_Perm::selectPerm('medium', $faqConfig);
             $oPerm->removeFromAllGroups($userId);
         }
         $message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_user_deleted']);
     }
     $userError = $user->error();
     if ($userError != "") {
         $message .= sprintf('<p class="alert alert-danger">%s</p>', $userError);
     }
 }
コード例 #19
0
ファイル: search.php プロジェクト: atlcurling/tkt
$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 = '&amp;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();
    $category->transform(0);
}
if (is_null($user)) {
    $user = new PMF_User_CurrentUser();
}
$faqSearch = new PMF_Search($db, $Language);
$faqSearchResult = new PMF_Search_Resultset($user, $faq);
$tagSearch = false;
//
// Handle the Tagging ID
//
if (!is_null($inputTag)) {
    $tagSearch = true;
    $tagging = new PMF_Tags($db, $Language);
    $recordIds = $tagging->getRecordsByTagId($inputTag);
コード例 #20
0
     $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 (!isset($categories['rubrik'])) {
     $categories['rubrik'] = array();
 }
 if (!is_null($question) && !is_null($categories['rubrik'])) {
     // new entry
     $logging = new PMF_Logging($faqConfig);
     $logging->logAdmin($user, 'Beitragcreatesave');
     printf("<h2>%s</h2>\n", $PMF_LANG['ad_entry_aor']);
     $category = new PMF_Category($faqConfig, array(), false);
     $category->setUser($currentAdminUser);
     $category->setGroups($currentAdminGroups);
     $tagging = new PMF_Tags($faqConfig);
     $recordData = array('lang' => $recordLang, 'active' => $active, 'sticky' => !is_null($sticky) ? 1 : 0, 'thema' => html_entity_decode($question), 'content' => html_entity_decode($content), 'keywords' => $keywords, 'author' => $author, 'email' => $email, 'comment' => !is_null($comment) ? 'y' : 'n', 'date' => date('YmdHis'), 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'linkState' => '', 'linkDateCheck' => 0);
     // Add new record and get that ID
     $recordId = $faq->addRecord($recordData);
     if ($recordId) {
         // Create ChangeLog entry
         $faq->createChangeEntry($recordId, $user->getUserId(), nl2br($changed), $recordData['lang']);
         // Create the visit entry
         $visits = new PMF_Visits($faqConfig);
         $visits->add($recordId);
         // Insert the new category relations
         $faq->addCategoryRelations($categories['rubrik'], $recordId, $recordData['lang']);
         // Insert the tags
コード例 #21
0
ファイル: export.main.php プロジェクト: noon/phpMyFAQ
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
require PMF_INCLUDE_DIR . '/Export.php';
?>
    <h2><?php 
print $PMF_LANG["ad_menu_export"];
?>
</h2>
    <form action="?action=exportfile" method="post">
<?php 
if (!emptyTable(SQLPREFIX . "faqdata")) {
    if (!emptyTable(SQLPREFIX . "faqcategories")) {
        $category = new PMF_Category($current_admin_user, $current_admin_groups);
        $category->buildTree();
        $helper = PMF_Helper_Category::getInstance();
        $helper->setCategory($category);
        ?>
        <fieldset><legend><?php 
        print $PMF_LANG['ad_export_which_cat'];
        ?>
</legend>
            <label class="left" for="rubrik"><?php 
        print $PMF_LANG["ad_entry_category"];
        ?>
</label>
            <select name="catid" id="catid" size="1">
<?php 
        print $helper->renderCategoryOptions();
コード例 #22
0
ファイル: record.save.php プロジェクト: atlcurling/tkt
 *
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2003-2012 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;
}
// Re-evaluate $user
$user = PMF_User_CurrentUser::getFromSession($faqconfig->get('security.ipCheck'));
$category = new PMF_Category($current_admin_user, $current_admin_groups, false);
if ($permission['editbt']) {
    // Get submit action
    $submit = PMF_Filter::filterInputArray(INPUT_POST, array('submit' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
    // FAQ data
    $dateStart = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING);
    $dateEnd = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
    $question = PMF_Filter::filterInput(INPUT_POST, 'question', FILTER_SANITIZE_STRING);
    $categories = PMF_Filter::filterInputArray(INPUT_POST, array('rubrik' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
    $record_lang = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING);
    $tags = PMF_Filter::filterInput(INPUT_POST, 'tags', FILTER_SANITIZE_STRING);
    $active = 'yes' == PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING) && $permission['approverec'] ? 'yes' : 'no';
    $sticky = PMF_Filter::filterInput(INPUT_POST, 'sticky', FILTER_SANITIZE_STRING);
    $content = PMF_Filter::filterInput(INPUT_POST, 'answer', FILTER_SANITIZE_SPECIAL_CHARS);
    $keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRING);
    $author = PMF_Filter::filterInput(INPUT_POST, 'author', FILTER_SANITIZE_STRING);
コード例 #23
0
ファイル: rss.php プロジェクト: Ravikumarsreerama/faq
        $current_groups = $user->perm->getUserGroups($current_user);
    } else {
        $current_groups = array(-1);
    }
    if (0 == count($current_groups)) {
        $current_groups = array(-1);
    }
} else {
    $current_user = -1;
    $current_groups = array(-1);
}
if (!$faqConfig->get('main.enableRssFeeds')) {
    exit;
}
$category_id = PMF_Filter::filterInput(INPUT_GET, 'category_id', FILTER_VALIDATE_INT);
$category = new PMF_Category($faqConfig);
$category->setUser($current_user);
$category->setGroups($current_groups);
$faq = new PMF_Faq($faqConfig);
$faq->setUser($current_user);
$faq->setGroups($current_groups);
$records = $faq->getAllRecordPerCategory($category_id, $faqConfig->get('records.orderby'), $faqConfig->get('records.sortby'));
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqConfig->get('main.titleFAQ') . ' - ');
$rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription')));
コード例 #24
0
ファイル: category.edit.php プロジェクト: atlcurling/tkt
 *
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @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-03-10
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
if ($permission['editcateg']) {
    $id = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
    $category = new PMF_Category($current_admin_user, $current_admin_groups, false);
    $categories = $category->getAllCategories();
    $user_permission = $category->getPermissions('user', array($id));
    if ($user_permission[0] == -1) {
        $all_users = true;
        $restricted_users = false;
    } else {
        $all_users = false;
        $restricted_users = true;
    }
    $group_permission = $category->getPermissions('group', array($id));
    if ($group_permission[0] == -1) {
        $all_groups = true;
        $restricted_groups = false;
    } else {
        $all_groups = false;
コード例 #25
0
ファイル: record.save.php プロジェクト: noon/phpMyFAQ
 * 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;
}
// Re-evaluate $user
$user = PMF_User_CurrentUser::getFromSession($faqconfig->get('main.ipCheck'));
$category = new PMF_Category($current_admin_user, $current_admin_groups, false);
if ($permission['editbt']) {
    // Get submit action
    $submit = PMF_Filter::filterInputArray(INPUT_POST, array('submit' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
    // FAQ data
    $dateStart = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING);
    $dateEnd = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
    $question = PMF_Filter::filterInput(INPUT_POST, 'thema', FILTER_SANITIZE_STRING);
    $categories = PMF_Filter::filterInputArray(INPUT_POST, array('rubrik' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
    $record_lang = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
    $tags = PMF_Filter::filterInput(INPUT_POST, 'tags', FILTER_SANITIZE_STRING);
    $active = 'yes' == PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING) && $permission['approverec'] ? 'yes' : 'no';
    $sticky = PMF_Filter::filterInput(INPUT_POST, 'sticky', FILTER_SANITIZE_STRING);
    $content = PMF_Filter::filterInput(INPUT_POST, 'content', FILTER_SANITIZE_SPECIAL_CHARS);
    $keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRING);
    $author = PMF_Filter::filterInput(INPUT_POST, 'author', FILTER_SANITIZE_STRING);
コード例 #26
0
ファイル: show.php プロジェクト: noon/phpMyFAQ
 * 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')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$currentCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
if (!is_null($currentCategory) && isset($category->categoryName[$currentCategory])) {
    $faqsession->userTracking('show_category', $currentCategory);
    $parent = $category->categoryName[$currentCategory]['parent_id'];
    $name = $category->categoryName[$currentCategory]['name'];
    $records = $faq->showAllRecords($currentCategory, $faqconfig->get('records.orderby'), $faqconfig->get('records.sortby'));
    if (!$records) {
        $subCategory = new PMF_Category($current_user, $current_groups, true);
        $subCategory->transform($currentCategory);
        $records = $subCategory->viewTree();
    }
    $up = '';
    if ($parent != 0) {
        $url = sprintf('%saction=show&amp;cat=%d', $sids, $parent);
        $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
        $oLink->itemTitle = $category->categoryName[$parent]['name'];
        $oLink->text = $PMF_LANG['msgCategoryUp'];
        $up = $oLink->toHtmlAnchor();
    }
    $tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgEntriesIn'] . $name, 'writeThemes' => $records, 'writeOneThemeBack' => $up));
    $tpl->includeTemplate('writeContent', 'index');
} else {
    $faqsession->userTracking('show_all_categories', 0);
コード例 #27
0
ファイル: category.move.php プロジェクト: atlcurling/tkt
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2004-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     2004-04-29
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
if ($permission["editcateg"]) {
    $id = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
    $parent_id = PMF_Filter::filterInput(INPUT_GET, 'parent_id', FILTER_VALIDATE_INT);
    $category = new PMF_Category($current_admin_user, $current_admin_groups, false);
    $categories = $category->getAllCategories();
    $category->categories = null;
    unset($category->categories);
    $category->getCategories($parent_id, false);
    $category->buildTree($parent_id);
    $header = sprintf('%s: <em>%s</em>', $PMF_LANG['ad_categ_move'], $category->categories[$id]['name']);
    ?>
        <header>
            <h2><?php 
    print $header;
    ?>
</h2>
        </header>
        <form action="?action=changecategory" method="post">
            <input type="hidden" name="cat" value="<?php 
コード例 #28
0
ファイル: ajax.user.php プロジェクト: ae120/phpMyFAQ
            $user->getUserById($userId);
            $response->setData($user->perm->getUserRights($userId));
            break;
        case 'activate_user':
            $user->getUserById($userId);
            $user->setStatus('active');
            echo json_encode($user->getStatus());
            break;
        case 'delete_user':
            $user->getUserById($userId);
            if ($user->getStatus() == 'protected' || $userId == 1) {
                $message = '<p class="error">' . $PMF_LANG['ad_user_error_protectedAccount'] . '</p>';
            } else {
                if (!$user->deleteUser()) {
                    $message = $PMF_LANG['ad_user_error_delete'];
                } else {
                    $category = new PMF_Category($faqConfig, [], false);
                    $category->moveOwnership($userId, 1);
                    // Remove the user from groups
                    if ('medium' == $faqConfig->get('security.permLevel')) {
                        $permissions = PMF_Perm::selectPerm('medium', $faqConfig);
                        $permissions->removeFromAllGroups($userId);
                    }
                    $message = '<p class="success">' . $PMF_LANG['ad_user_deleted'] . '</p>';
                }
            }
            $response->setData($message);
            break;
    }
}
$response->send();
コード例 #29
0
 $content = PMF_Filter::filterInput(INPUT_POST, 'answer', FILTER_SANITIZE_SPECIAL_CHARS);
 $keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRING);
 $author = PMF_Filter::filterInput(INPUT_POST, 'author', FILTER_SANITIZE_STRING);
 $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
 $comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING);
 $record_id = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
 $solution_id = PMF_Filter::filterInput(INPUT_POST, 'solution_id', FILTER_VALIDATE_INT);
 $revision_id = PMF_Filter::filterInput(INPUT_POST, 'revision_id', FILTER_VALIDATE_INT);
 $changed = PMF_Filter::filterInput(INPUT_POST, 'changed', FILTER_SANITIZE_STRING);
 $user_permission = PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING);
 $restricted_users = 'all' == $user_permission ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT);
 $group_permission = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING);
 $restricted_groups = 'all' == $group_permission ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT);
 if (!is_null($question) && !is_null($categories)) {
     $tagging = new PMF_Tags($faqConfig);
     $category = new PMF_Category($faqConfig, [], false);
     $category->setUser($currentAdminUser);
     $category->setGroups($currentAdminGroups);
     if (!isset($categories['rubrik'])) {
         $categories['rubrik'] = [];
     }
     $recordData = array('id' => $record_id, 'lang' => $record_lang, 'revision_id' => $revision_id, 'active' => $active, 'sticky' => !is_null($sticky) ? 1 : 0, 'thema' => html_entity_decode($question), 'content' => html_entity_decode($content), 'keywords' => $keywords, 'author' => $author, 'email' => $email, 'comment' => !is_null($comment) ? 'y' : 'n', 'date' => empty($date) ? date('YmdHis') : str_replace(array('-', ':', ' '), '', $date), 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'linkState' => '', 'linkDateCheck' => 0);
     if ('saveentry' == $do || $record_id) {
         /* Create a revision anyway, it's autosaving */
         $faq->addNewRevision($record_id, $record_lang);
         $revision_id++;
         $faq->createChangeEntry($record_id, $user->getUserId(), nl2br($changed), $record_lang, $revision_id);
         $visits = new PMF_Visits($faqConfig);
         $visits->add($record_id);
         if ($faq->isAlreadyTranslated($record_id, $record_lang)) {
             $faq->updateRecord($recordData);
コード例 #30
0
ファイル: category.cut.php プロジェクト: noon/phpMyFAQ
 * 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->buildTree();
    $id = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
    $parent_id = $category->categoryName[$id]['parent_id'];
    $header = sprintf('%s: <em>%s</em>', $PMF_LANG['ad_categ_move'], $category->categoryName[$id]['name']);
    printf('<h2>%s</h2>', $header);
    ?>

    <form action="?action=pastecategory" method="post">
    <fieldset>
        <legend><?php 
    print $PMF_LANG["ad_categ_paste2"];
    ?>
</legend>
	    <input type="hidden" name="cat" value="<?php 
    print $id;