Beispiel #1
0
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2002-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     2002-09-16
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $Language);
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$faqsession->userTracking('new_entry', 0);
// Get possible user input
$inputQuestion = PMF_Filter::filterInput(INPUT_GET, 'question', FILTER_VALIDATE_INT);
$inputCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
$question = $readonly = '';
if (!is_null($inputQuestion)) {
    $faqQuestions = new PMF_Faq_Questions();
    $question = $faqQuestions->fetch($inputQuestion);
    if (PMF_String::strlen($question->question)) {
        $readonly = ' readonly="readonly"';
    }
}
$categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
$tpl->processTemplate('writeContent', array('msgNewContentHeader' => $PMF_LANG['msgNewContentHeader'], 'msgNewContentAddon' => $PMF_LANG['msgNewContentAddon'], 'writeSendAdress' => '?' . $sids . 'action=save', 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'msgNewContentCategory' => $PMF_LANG['msgNewContentCategory'], 'printCategoryOptions' => $categoryLayout->renderOptions(array($inputCategory)), 'msgNewContentTheme' => $PMF_LANG['msgNewContentTheme'], 'readonly' => $readonly, 'printQuestion' => $question instanceof PMF_Faq_Questions ? $question->question : '', 'msgNewContentArticle' => $PMF_LANG['msgNewContentArticle'], 'msgNewContentKeywords' => $PMF_LANG['msgNewContentKeywords'], 'msgNewContentLink' => $PMF_LANG['msgNewContentLink'], 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('add')), 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit']));
$tpl->includeTemplate('writeContent', 'index');
Beispiel #2
0
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'])) {
            $url_variables = 'saveentry&amp;id=' . $faqData['id'];
        } else {
            $url_variables = 'insertentry';
        }
        $faqData['lang'] = PMF_Filter::filterInput(INPUT_POST, 'artlang', FILTER_SANITIZE_STRING);
        $current_category = isset($_POST['rubrik']) ? $_POST['rubrik'] : null;
        if (is_array($current_category)) {
            $categoryRelations->setLanguage($faqData['lang']);