// Pastes a category if ($action == 'pastecategory') { $categoryId = PMF_Filter::filterInput(INPUT_POST, 'cat', FILTER_VALIDATE_INT); $parentId = PMF_Filter::filterInput(INPUT_POST, 'after', FILTER_VALIDATE_INT); $categoryData = $categoryNode->fetch($categoryId); $categoryData->parent_id = $parentId; if ($categoryNode->update($categoryId, (array) $categoryData)) { printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_updated']); } else { printf('<p class="error">%s<br />%s</p>', $PMF_LANG['ad_categ_paste_error'], $db->error()); } } // Lists all categories $lang = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING, $LANGCODE); $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE); $categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider)); foreach ($categoryTreeHelper as $categoryId => $categoryName) { $indent = str_repeat(' ', $categoryTreeHelper->indent); $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage(); $parentId = $categoryTreeHelper->getInnerIterator()->current()->getParentId(); // show category name printf("<p>%s<strong style=\"vertical-align: top;\">· %s</strong> ", $indent, $categoryName); if ($categoryLang == $lang) { // add sub category (if actual language) printf('<a href="?action=addcategory&cat=%s&lang=%s"><img src="images/add.png" width="16" height="16" alt="%s" title="%s" border="0" /></a> ', $categoryId, $categoryLang, $PMF_LANG['ad_quick_category'], $PMF_LANG['ad_quick_category']); // rename (sub) category (if actual language) printf('<a href="?action=editcategory&cat=%s"><img src="images/edit.png" width="16" height="16" border="0" title="%s" alt="%s" /></a> ', $categoryId, $PMF_LANG['ad_kateg_rename'], $PMF_LANG['ad_kateg_rename']); } // translate category (always) printf('<a href="?action=translatecategory&cat=%s"><img src="images/translate.png" width="16" height="16" border="0" title="%s" alt="%s" /></a> ', $categoryId, $PMF_LANG['ad_categ_translate'], $PMF_LANG['ad_categ_translate']); // delete (sub) category (if actual language)
printf('<p>%s</p>', $db->error()); } } print "\n\n<table>\n"; print "<tr>\n"; print " <th>" . $currentLanguage . "</th>\n"; // get languages in use for all categories $allLanguages = PMF_Utils::languageAvailable(0, $table = 'faqcategories'); asort($allLanguages); foreach ($allLanguages as $language) { if ($languageCodes[strtoupper($language)] != $currentLanguage) { print " <th>" . $languageCodes[strtoupper($language)] . "</th>\n"; } } $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery(); $categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider)); $categoryHelper = new PMF_Category_Helper(); foreach ($categoryTreeHelper as $categoryId => $categoryName) { $indent = str_repeat(' ', $categoryTreeHelper->indent); $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage(); if ($categoryLang == $LANGCODE) { print "</tr>\n"; print "<tr>\n"; } printf(" <td> %s<strong>· %s</strong> </td>\n", $indent, $categoryName); foreach ($allLanguages as $language) { if ($language != $categoryLang && !$categoryHelper->hasTranslation($categoryId, $language)) { // translate category printf(" <td class=\"needsTranslation\"> %s<strong>· %s</strong> ", $indent, $categoryName); printf('<a href="index.php?action=translatecategory&cat=%d&trlang=%s" title="%s">', $categoryId, $LANGCODE, $PMF_LANG['ad_categ_translate']); printf('<img src="images/translate.png" width="13" height="16" border="0" title="%s" alt="%s" /></a>', $PMF_LANG['ad_categ_translate'], $PMF_LANG['ad_categ_translate']);
* @category phpMyFAQ * @package Administration * @author Thorsten Rinne <*****@*****.**> * @copyright 2004-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 2004-04-29 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } if ($permission["editcateg"]) { $categoryNode = new PMF_Category_Node(); $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE); $categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider)); $categoryId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT); $parentId = PMF_Filter::filterInput(INPUT_GET, 'parent_id', FILTER_VALIDATE_INT); $categoryData = $categoryNode->fetch($categoryId); $header = sprintf('%s: <em>%s</em>', $PMF_LANG['ad_categ_move'], $categoryData->name); printf('<h2>%s</h2>', $header); ?> <form action="?action=changecategory" method="post"> <fieldset> <legend><?php print $PMF_LANG["ad_categ_change"]; ?> </legend> <input type="hidden" name="cat" value="<?php print $categoryId; ?>