コード例 #1
0
ファイル: index.php プロジェクト: jr-ewing/phpMyFAQ
//
// Handle the SiteMap
//
$letter = PMF_Filter::filterInput(INPUT_GET, 'letter', FILTER_SANITIZE_STRIPPED);
if (!is_null($letter) && 1 == PMF_String::strlen($letter)) {
    $title = ' - ' . $letter . '...';
    $keywords = $letter;
}
//
// Found a category ID?
//
$cat = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
$cat_from_id = -1;
$categoryPath = array(0);
if (is_numeric($id) && $id > 0) {
    $categoryRelations = new PMF_Category_Relations();
    foreach ($categoryRelations->fetchAll() as $relation) {
        if ($relation->record_id == $id) {
            $cat_from_id = $relation->category_id;
            break;
        }
    }
}
if ($cat_from_id != -1 && $cat == 0) {
    $cat = $cat_from_id;
}
if ($cat != 0) {
    $categoryPath = $categoryData->getPath($cat);
}
/* @todo: Fix this old code
if (isset($cat) && ($cat != 0) && ($id == '') && isset($category->categoryName[$cat]['name'])) {
コード例 #2
0
ファイル: record.show.php プロジェクト: rybal06/phpMyFAQ
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Minoru TODA <*****@*****.**>
 * @copyright 2003-2010 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("<h2>%s</h2>\n", $PMF_LANG['ad_entry_aor']);
if ($permission['editbt'] || $permission['delbt']) {
    $categoryRelations = new PMF_Category_Relations();
    $categoryData = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE);
    $categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
    $linkverifier = new PMF_Linkverifier($user->getLogin());
    $comment = new PMF_Comment();
    $faq = new PMF_Faq();
    if ($linkverifier->isReady()) {
        link_verifier_javascript();
    }
    $cond = $numCommentsByFaq = $numActiveByCat = array();
    $internalSearch = $linkState = $searchterm = '';
    $searchcat = $currentcategory = 0;
    $orderby = 1;
    $sortby = null;
    $linkState = PMF_Filter::filterInput(INPUT_POST, 'linkstate', FILTER_SANITIZE_STRING);
    $searchcat = PMF_Filter::filterInput(INPUT_POST, 'searchcat', FILTER_VALIDATE_INT);
コード例 #3
0
ファイル: record.add.php プロジェクト: nosch/phpMyFAQ
 // Insert the tags
 if ($tags != '') {
     $tagging = new PMF_Tags();
     $tagging->saveTags($recordId, explode(',', $tags));
 }
 // Set record permissions
 $faqUser = new PMF_Faq_User();
 $faqUser->create(array('record_id' => $recordId, 'user_id' => $restricted_users));
 if ($groupSupport) {
     $faqGroup = new PMF_Faq_Group();
     $faqGroup->create(array('record_id' => $recordId, 'group_id' => $restricted_groups));
 }
 // Loop the categories
 $categoryUser = new PMF_Category_User();
 $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);
コード例 #4
0
ファイル: category.main.php プロジェクト: nosch/phpMyFAQ
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
printf('<h2>%s</h2>', $PMF_LANG['ad_menu_categ_edit']);
print "<p>\n";
printf('<img src="images/arrow.gif" width="11" height="11" alt="" border="0" /> <a href="?action=addcategory">%s</a>', $PMF_LANG['ad_kateg_add']);
print "&nbsp;&nbsp;&nbsp;";
printf('<img src="images/arrow.gif" width="11" height="11" alt="" border="0" /> <a href="?action=showcategory">%s</a>', $PMF_LANG['ad_categ_show']);
print "</p>\n";
if ($permission['editcateg']) {
    $categoryNode = new PMF_Category_Node();
    $categoryUser = new PMF_Category_User();
    $categoryGroup = new PMF_Category_Group();
    $categoryRelations = new PMF_Category_Relations();
    $categoryHelper = new PMF_Category_Helper();
    // Save a new category
    if ($action == 'savecategory') {
        $categoryData = array('id' => null, 'lang' => PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING), 'parent_id' => PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT), '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);
        $userAllowed = 'all' == $userperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT);
        $groupperm = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING);
        $groupAllowed = 'all' == $groupperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT);
        if ($categoryNode->create($categoryData)) {
            $userPermission = array('category_id' => $categoryNode->getCategoryId(), 'user_id' => $userAllowed);
            $groupPermission = array('category_id' => $categoryNode->getCategoryId(), 'group_id' => $groupAllowed);
            $categoryUser->create($userPermission);
            $categoryGroup->create($groupPermission);
            printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_added']);
        } else {
コード例 #5
0
ファイル: record.edit.php プロジェクト: rybal06/phpMyFAQ
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2003-2010 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('main.ipCheck'));
if ($permission["editbt"] && !PMF_Db::checkOnEmptyTable('faqcategories')) {
    $categoryRelations = new PMF_Category_Relations();
    $current_category = '';
    $categories = array();
    $faqData = array('id' => 0, 'lang' => $LANGCODE, 'revision_id' => 0, 'title' => '', 'dateStart' => '', 'dateEnd' => '');
    $tagging = new PMF_Tags();
    if ($action == 'takequestion') {
        $questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
        $faqQuestions = new PMF_Faq_Questions();
        $question = $faqQuestions->fetch($questionId);
        $current_category = $question->category_id;
        $faqData['title'] = $question->question;
        $categories = array('category_id' => $current_category, 'category_lang' => $faqData['lang']);
    }
    if ($action == 'editpreview') {
        $faqData['id'] = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT);
        if (!is_null($faqData['id'])) {