phpMyFAQ PHP Cross Reference Customer Relationship Management

Source: /add.php - 94 lines - 3352 bytes - Text - Print

Description: This is the page there a user can add a FAQ record.

   1  <?php
   2  /**
   3   * This is the page there a user can add a FAQ record.
   4   *
   5   * PHP Version 5.3
   6   *
   7   * This Source Code Form is subject to the terms of the Mozilla Public License,
   8   * v. 2.0. If a copy of the MPL was not distributed with this file, You can
   9   * obtain one at http://mozilla.org/MPL/2.0/.
  10   *
  11   * @category  phpMyFAQ
  12   * @package   Frontend
  13   * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
  14   * @copyright 2002-2014 phpMyFAQ Team
  15   * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
  16   * @link      http://www.phpmyfaq.de
  17   * @since     2002-09-16
  18   */
  19  
  20  if (!defined('IS_VALID_PHPMYFAQ')) {
  21      $protocol = 'http';
  22      if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
  23          $protocol = 'https';
  24      }
  25      header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
  26      exit();
  27  }
  28  
  29  $captcha = new PMF_Captcha($faqConfig);
  30  $captcha->setSessionId($sids);
  31  
  32  if (! is_null($showCaptcha)) {
  33      $captcha->showCaptchaImg();
  34      exit;
  35  }
  36  
  37  $faqsession->userTracking('new_entry', 0);
  38  
  39  // Get possible user input
  40  $selectedQuestion = PMF_Filter::filterInput(INPUT_GET, 'question', FILTER_VALIDATE_INT);
  41  $selectedCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
  42  
  43  $question = $readonly = '';
  44  if (!is_null($selectedQuestion)) {
  45      $oQuestion = $faq->getQuestion($selectedQuestion);
  46      $question  = $oQuestion['question'];
  47      if (PMF_String::strlen($question)) {
  48          $readonly = ' readonly';
  49      }
  50  }
  51  
  52  $category->buildTree();
  53  
  54  $categoryHelper = new PMF_Helper_Category();
  55  $categoryHelper->setCategory($category);
  56  
  57  $captchaHelper = new PMF_Helper_Captcha($faqConfig);
  58  
  59  // Enable/Disable WYSIWYG editor
  60  if ($faqConfig->get('main.enableWysiwygEditorFrontend')) {
  61      $tpl->parseBlock(
  62          'writeContent',
  63          'enableWysiwygEditor',
  64          array(
  65              'currentTimestamp' => $_SERVER['REQUEST_TIME']
  66          )
  67      );
  68  }
  69  
  70  $tpl->parse(
  71      'writeContent', 
  72      array(
  73          'msgNewContentHeader'   => $PMF_LANG['msgNewContentHeader'],
  74          'msgNewContentAddon'    => $PMF_LANG['msgNewContentAddon'],
  75          'lang'                  => $Language->getLanguage(),
  76          'openQuestionID'        => $selectedQuestion,
  77          'defaultContentMail'    => ($user instanceof PMF_User_CurrentUser) ? $user->getUserData('email') : '',
  78          'defaultContentName'    => ($user instanceof PMF_User_CurrentUser) ? $user->getUserData('display_name') : '',
  79          'msgNewContentName'     => $PMF_LANG['msgNewContentName'],
  80          'msgNewContentMail'     => $PMF_LANG['msgNewContentMail'],
  81          'msgNewContentCategory' => $PMF_LANG['msgNewContentCategory'],
  82          'printCategoryOptions'  => $categoryHelper->renderOptions($selectedCategory),
  83          'msgNewContentTheme'    => $PMF_LANG['msgNewContentTheme'],
  84          'readonly'              => $readonly,
  85          'printQuestion'         => $question,
  86          'msgNewContentArticle'  => $PMF_LANG['msgNewContentArticle'],
  87          'msgNewContentKeywords' => $PMF_LANG['msgNewContentKeywords'],
  88          'msgNewContentLink'     => $PMF_LANG['msgNewContentLink'],
  89          'captchaFieldset'       => $captchaHelper->renderCaptcha($captcha, 'add', $PMF_LANG['msgCaptcha'], $auth),
  90          'msgNewContentSubmit'   => $PMF_LANG['msgNewContentSubmit']
  91      )
  92  );
  93  
  94  $tpl->merge('writeContent', 'index');

title

Description

title

Description

title

Description

title

title

Body