示例#1
0
 * under the License.
 * 
 * @copyright phpMyFAQ
 * @package   Frontend
 * @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-08-29
 */
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);
$type = PMF_Filter::filterInput(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
$faqid = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT, 0);
$newsid = PMF_Filter::filterInput(INPUT_POST, 'newsid', FILTER_VALIDATE_INT);
$user = PMF_Filter::filterInput(INPUT_POST, 'user', FILTER_SANITIZE_STRING);
$mail = PMF_Filter::filterInput(INPUT_POST, 'mail', FILTER_VALIDATE_EMAIL);
$comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRIPPED);
$message = '';
switch ($type) {
    case 'news':
        $id = $newsid;
        $msgWriteComment = $PMF_LANG['newsWriteComment'];
        break;
    case 'faq':
    default:
示例#2
0
if (PMF_Language::isASupportedLanguage($ajaxlang)) {
    $languageCode = trim($ajaxlang);
    require_once 'lang/language_' . $languageCode . '.php';
} else {
    $languageCode = 'en';
    require_once 'lang/language_en.php';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($languageCode);
// Check captcha
$captcha = new PMF_Captcha($faqConfig);
$captcha->setSessionId(PMF_Filter::filterInput(INPUT_COOKIE, PMF_Session::PMF_COOKIE_NAME_SESSIONID, FILTER_VALIDATE_INT));
// Prepare response
$response = new JsonResponse();
$responseWrapper = new ResponseWrapper($response);
$responseWrapper->addCommonHeaders();
// Set session
$faqsession = new PMF_Session($faqConfig);
$network = new PMF_Network($faqConfig);
$stopwords = new PMF_Stopwords($faqConfig);
if (!$network->checkIp($_SERVER['REMOTE_ADDR'])) {
    $message = array('error' => $PMF_LANG['err_bannedIP']);
}
// Check, if user is logged in
$user = PMF_User_CurrentUser::getFromSession($faqConfig);
if ($user instanceof PMF_User_CurrentUser) {
    $isLoggedIn = true;