本文整理汇总了PHP中PMF_Filter::filterVar方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Filter::filterVar方法的具体用法?PHP PMF_Filter::filterVar怎么用?PHP PMF_Filter::filterVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Filter
的用法示例。
在下文中一共展示了PMF_Filter::filterVar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendAskedQuestion
function sendAskedQuestion($username, $usermail, $usercat, $content)
{
global $IDN, $category, $PMF_LANG, $faq, $faqconfig;
$retval = false;
$cat = new PMF_Category();
$categories = $cat->getAllCategories();
if ($faqconfig->get('records.enableVisibilityQuestions')) {
$visibility = 'N';
} else {
$visibility = 'Y';
}
$questionData = array('ask_username' => $username, 'ask_usermail' => $IDN->encode($usermail), 'ask_category' => $usercat, 'ask_content' => $content, 'ask_date' => date('YmdHis'), 'is_visible' => $visibility);
list($user, $host) = explode("@", $questionData['ask_usermail']);
if (PMF_Filter::filterVar($questionData['ask_usermail'], FILTER_VALIDATE_EMAIL) != false) {
$faq->addQuestion($questionData);
$questionMail = "User: " . $questionData['ask_username'] . ", mailto:" . $questionData['ask_usermail'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['ask_category']]["name"] . "\n\n" . wordwrap($content, 72);
$userId = $category->getCategoryUser($questionData['ask_category']);
$oUser = new PMF_User();
$oUser->getUserById($userId);
$userEmail = $oUser->getUserData('email');
$mainAdminEmail = $faqconfig->get('main.administrationMail');
$mail = new PMF_Mail();
$mail->unsetFrom();
$mail->setFrom($questionData['ask_usermail'], $questionData['ask_username']);
$mail->addTo($mainAdminEmail);
// Let the category owner get a copy of the message
if ($userEmail && $mainAdminEmail != $userEmail) {
$mail->addCc($userEmail);
}
$mail->subject = '%sitename%';
$mail->message = $questionMail;
$retval = $mail->send();
}
return $retval;
}
示例2: sendAskedQuestion
function sendAskedQuestion($username, $usermail, $usercat, $content)
{
global $PMF_LANG, $faq;
$retval = false;
$faqconfig = PMF_Configuration::getInstance();
$categoryNode = new PMF_Category_Node();
if ($faqconfig->get('records.enableVisibilityQuestions')) {
$visibility = 'N';
} else {
$visibility = 'Y';
}
$questionData = array('id' => null, 'username' => $username, 'email' => $usermail, 'category_id' => $usercat, 'question' => $content, 'date' => date('YmdHis'), 'is_visible' => $visibility);
list($user, $host) = explode("@", $questionData['email']);
if (PMF_Filter::filterVar($questionData['email'], FILTER_VALIDATE_EMAIL) != false) {
$faqQuestions = new PMF_Faq_Questions();
$faqQuestions->create($questionData);
$categoryData = $categoryNode->fetch($questionData['category_id']);
$questionMail = "User: " . $questionData['username'] . ", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categoryData->name . "\n\n" . wordwrap($content, 72);
$userId = $categoryData->user_id;
$oUser = new PMF_User();
$oUser->getUserById($userId);
$userEmail = $oUser->getUserData('email');
$mainAdminEmail = $faqconfig->get('main.administrationMail');
$mail = new PMF_Mail();
$mail->unsetFrom();
$mail->setFrom($questionData['email'], $questionData['username']);
$mail->addTo($mainAdminEmail);
// Let the category owner get a copy of the message
if ($userEmail && $mainAdminEmail != $userEmail) {
$mail->addCc($userEmail);
}
$mail->subject = '%sitename%';
$mail->message = $questionMail;
$retval = $mail->send();
}
return $retval;
}
示例3: header
*
* @category phpMyFAQ
* @package Frontend
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @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;
}
$recordId = PMF_Filter::filterInput(INPUT_POST, 'artikel', FILTER_VALIDATE_INT, 0);
$vote = PMF_Filter::filterInput(INPUT_POST, 'vote', FILTER_VALIDATE_INT);
$userIp = PMF_Filter::filterVar($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);
if (isset($vote) && $faq->votingCheck($recordId, $userIp) && $vote > 0 && $vote < 6) {
$faqsession->userTracking('save_voting', $recordId);
$voting = new PMF_Rating();
$votingData = array('id' => null, 'record_id' => $recordId, 'vote' => $vote, 'date' => $_SERVER['REQUEST_TIME'], 'user_ip' => $userIp);
if (!$voting->fetch($recordId)) {
$voting->create($votingData);
} else {
$voting->update($recordId, $votingData);
}
$tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['msgVoteThanks']));
} elseif (isset($voting) && !$faq->votingCheck($recordId, $userIp)) {
$faqsession->userTracking('error_save_voting', $recordId);
$tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['err_VoteTooMuch']));
} else {
$faqsession->userTracking('error_save_voting', $recordId);
示例4: strval
$response->setData(1);
break;
case 'save_added_trans':
if (!$user->perm->checkRight($user->getUserId(), 'addtranslation')) {
$response->setData($PMF_LANG['err_NotAuth']);
break;
}
if (!is_writable(PMF_ROOT_DIR . "/lang")) {
$response->setData(0);
break;
}
$langCode = PMF_Filter::filterInput(INPUT_POST, 'translang', FILTER_SANITIZE_STRING);
$langName = @$languageCodes[$langCode];
$langCharset = "UTF-8";
$langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING);
$langNPlurals = strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1));
$langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING);
$author = (array) @$_POST['author'];
if (empty($langCode) || empty($langName) || empty($langCharset) || empty($langDir) || empty($langDesc) || empty($author)) {
$response->setData(0);
break;
}
$fileTpl = <<<FILE
<?php
/**
* %s
*
* PHP Version 5.4
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can