本文整理汇总了PHP中InputFilter::process方法的典型用法代码示例。如果您正苦于以下问题:PHP InputFilter::process方法的具体用法?PHP InputFilter::process怎么用?PHP InputFilter::process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputFilter
的用法示例。
在下文中一共展示了InputFilter::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* Filters public properties
* @access protected
* @param array List of fields to ignore
*/
function filter($ignoreList = null)
{
$ignore = is_array($ignoreList);
$iFilter = new InputFilter();
foreach ($this->getPublicProperties() as $k) {
if ($ignore && in_array($k, $ignoreList)) {
continue;
}
$this->{$k} = $iFilter->process($this->{$k});
}
}
示例2: externalCallCheck
/**
* @package Mambo
* @author Mambo Foundation Inc see README.php
* @copyright Mambo Foundation Inc.
* See COPYRIGHT.php for copyright notices and details.
* @license GNU/GPL Version 2, see LICENSE.php
* Mambo is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the License.
*/
function externalCallCheck($path, $secret)
{
if (isset($_COOKIE['mostlyce']['startup_key']) && isset($_COOKIE['mostlyce']['usertype'])) {
require_once $path . '/includes/phpInputFilter/class.inputfilter.php';
$iFilter = new InputFilter(null, null, 1, 1);
$startupKey = trim($iFilter->process($_COOKIE['mostlyce']['startup_key']));
//The MOStlyCE rebuild key should match this
$usertype = strtolower(str_replace(' ', '', trim($iFilter->process($_COOKIE['mostlyce']['usertype']))));
} else {
return false;
}
$env = md5($_SERVER['HTTP_USER_AGENT']);
$rebuildKey = md5($secret . $env . $_SERVER['REMOTE_ADDR']);
if ($rebuildKey !== $startupKey) {
return false;
}
//Valid user types
$vUsers = array('author', 'editor', 'publisher', 'manager', 'administrator', 'superadministrator');
if (!in_array($usertype, $vUsers)) {
return false;
}
return true;
}
示例3: process
function process()
{
$input_filter = new InputFilter();
$input_filter->process($this);
if (!is_null($this->request->get("method"))) {
$basic = array('reqip' => $this->request->userip . ':' . $this->request->clientip, 'uri' => $this->request->url, 'method' => $this->request->get("method"), 'logid' => $this->requestId);
} else {
$basic = array('reqip' => $this->request->userip . ':' . $this->request->clientip, 'uri' => $this->request->url, 'logid' => $this->requestId);
}
kc_log_addbasic($basic);
$dispatch = new Dispatch($this);
App::getTimer()->set('framework prepare');
$dispatch->dispatch_url($this->request->url);
$this->response->send();
KC_LOG_TRACE('[TIME COST STATISTIC] [ ' . App::getTimer()->getString() . ' ].');
}
示例4: actionUpdate
/**
* Updates a particular model.
* @param integer $_GET['id'] the ID of the model to be updated
* @return updated comment text
*/
public function actionUpdate()
{
Yii::app()->end();
//disalow updates
// get Comments object from $id parameter
$model = $this->loadModel($_GET['id']);
// if Comments form exist and was called via ajax
if (isset($_POST['Comments']) && isset($_POST['ajax'])) {
// set form elements to Users model attributes
$model->attributes = $_POST['Comments'];
// clear tag from text
Yii::import('application.extensions.InputFilter.InputFilter');
$filter = new InputFilter(array('br', 'pre'));
$model->comment_text = $filter->process($model->comment_text);
// update comment
$model->save(false);
echo $model->comment_text;
}
Yii::app()->end();
}
示例5: shRedirect
function shRedirect($url, $msg = '', $redirKind = '301', $msgType = 'message')
{
global $mainframe;
$sefConfig =& shRouter::shGetConfig();
// specific filters
if (class_exists('InputFilter')) {
$iFilter = new InputFilter();
$url = $iFilter->process($url);
if (!empty($msg)) {
$msg = $iFilter->process($msg);
}
if ($iFilter->badAttributeValue(array('href', $url))) {
$url = $GLOBALS['shConfigLiveSite'];
}
}
// If the message exists, enqueue it
if (JString::trim($msg)) {
$mainframe->enqueueMessage($msg, $msgType);
}
// Persist messages if they exist
if (count($mainframe->_messageQueue)) {
$session =& JFactory::getSession();
$session->set('application.queue', $mainframe->_messageQueue);
}
if (headers_sent()) {
echo "<script>document.location.href='{$url}';</script>\n";
} else {
@ob_end_clean();
// clear output buffer
switch ($redirKind) {
case '302':
$redirHeader = 'HTTP/1.1 302 Moved Temporarily';
break;
case '303':
$redirHeader = 'HTTP/1.1 303 See Other';
break;
default:
$redirHeader = 'HTTP/1.1 301 Moved Permanently';
break;
}
header($redirHeader);
header("Location: " . $url);
}
$mainframe->close();
}
示例6: sRandomChars
$surveyid = sRandomChars(5, '123456789');
$isquery = "SELECT sid FROM " . db_table_name('surveys') . " WHERE sid={$surveyid}";
$isresult = db_execute_assoc($isquery);
// Checked
} while ($isresult->RecordCount() > 0);
if (!isset($_POST['template'])) {
$_POST['template'] = 'default';
}
if ($_SESSION['USER_RIGHT_SUPERADMIN'] != 1 && $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights($_SESSION['loginID'], $_POST['template'])) {
$_POST['template'] = "default";
}
// insert base language into surveys_language_settings
if ($filterxsshtml) {
require_once "../classes/inputfilter/class.inputfilter_clean.php";
$myFilter = new InputFilter('', '', 1, 1, 1);
$_POST['surveyls_title'] = $myFilter->process($_POST['surveyls_title']);
$_POST['description'] = $myFilter->process($_POST['description']);
$_POST['welcome'] = $myFilter->process($_POST['welcome']);
$_POST['urldescrip'] = $myFilter->process($_POST['urldescrip']);
} else {
$_POST['surveyls_title'] = html_entity_decode($_POST['surveyls_title'], ENT_QUOTES, "UTF-8");
$_POST['description'] = html_entity_decode($_POST['description'], ENT_QUOTES, "UTF-8");
$_POST['welcome'] = html_entity_decode($_POST['welcome'], ENT_QUOTES, "UTF-8");
$_POST['urldescrip'] = html_entity_decode($_POST['urldescrip'], ENT_QUOTES, "UTF-8");
}
//make sure only numbers are passed within the $_POST variable
$_POST['dateformat'] = (int) $_POST['dateformat'];
$_POST['tokenlength'] = (int) $_POST['tokenlength'];
if (trim($_POST['expires']) == '') {
$_POST['expires'] = null;
} else {
示例7: isset
//Preprocessing
if ($error == false) {
$the_text = isset($_REQUEST['thetext']) ? $_REQUEST['thetext'] : '';
$the_html = isset($_REQUEST['thehtml']) ? $_REQUEST['thehtml'] : '';
if (isset($_REQUEST['toStep2'])) {
$tplname = 'htmlprev_step2';
$the_html = htmlspecialchars(mb_ereg_replace("\n", "<br />\n", stripslashes(htmlspecialchars($the_text, ENT_COMPAT, 'UTF-8'))), ENT_COMPAT, 'UTF-8');
} else {
if (isset($_REQUEST['toStep3'])) {
global $rootpath, $stylepath;
//check the html ...
require_once $rootpath . 'lib/class.inputfilter.php';
require_once $stylepath . '/htmlprev.inc.php';
$myFilter = new InputFilter($allowedtags, $allowedattr, 0, 0, 1);
$orghtml = $the_html;
$the_html = $myFilter->process($the_html);
$tplname = 'htmlprev_step3';
tpl_set_var('orghtml', htmlspecialchars($orghtml, ENT_COMPAT, 'UTF-8'));
tpl_set_var('thecode', $the_html);
tpl_set_var('thehtmlcode', nl2br(stripslashes(htmlspecialchars($the_html, ENT_COMPAT, 'UTF-8'))));
} else {
if (isset($_REQUEST['backStep2'])) {
$tplname = 'htmlprev_step2';
$the_html = stripslashes(htmlspecialchars($the_html, ENT_COMPAT, 'UTF-8'));
} else {
//start
$tplname = 'htmlprev';
}
}
}
tpl_set_var('thetext', stripslashes(htmlspecialchars($the_text, ENT_COMPAT, 'UTF-8')));
示例8: InputFilter
<?
include("../ressources/.mysql_common.php");
require_once("class.inputfilter_clean.php");
?>
<?php
$tags = '';
$attr = '';
$tag_method = 0;
$attr_method = 0;
$xss_auto = 1;
$myFilter = new InputFilter($tags, $attr, $tag_method, $attr_method, $xss_auto);
// submitbutton=Udlever1
$divisionday = $myFilter->process($_GET["divisionday"]);
$uid = $myFilter->process($_GET["submitbutton"]);
$orderline_uid = str_replace('Udlever', '', $uid);
$query = 'SELECT
ff_orderlines.item as article, ff_pickupdates.pickupdate as pickupdate, ff_divisions.name as name, ff_items.units, ff_items.measure, ff_producttypes.explained as txt, ff_orderlines.quant,
ff_persons.firstname, ff_persons.middlename, ff_persons.lastname, ff_persons.tel, ff_persons.email, ff_persons.uid as medlem, ff_orderlines.status2, ff_orderlines.uid
FROM ff_orderlines, ff_orderhead, ff_items, ff_producttypes, ff_pickupdates, ff_divisions, ff_persons
WHERE ff_orderlines.orderno = ff_orderhead.orderno
AND ((ff_orderhead.status1 = "kontant") or (ff_orderhead.status1 = "nets"))
AND ff_orderlines.item = ff_items.id
AND ff_items.producttype_id = ff_producttypes.id
AND ff_orderlines.iteminfo = ff_pickupdates.uid
AND ff_divisions.uid = ff_pickupdates.division
AND ff_pickupdates.division = ff_items.division
AND ff_orderlines.puid = ff_persons.uid
AND ff_pickupdates.uid = ' . (int) $divisionday . '
AND ff_orderlines.uid = ' . (int) $orderline_uid . '
ORDER BY ff_pickupdates.pickupdate, ff_producttypes.explained ';
$result = doquery($query);
示例9: iconv
tpl_set_var('GeoKretyApiConfigured', 'none');
tpl_set_var('GeoKretApiSelector', '');
}
// descMode is depreciated. this was description type. Now all description are in html, then always use 3 for back compatibility
$descMode = 3;
// fuer alte Versionen von OCProp
if (isset($_POST['submit']) && !isset($_POST['version2'])) {
$descMode = 1;
$_POST['submitform'] = $_POST['submit'];
$log_text = iconv("ISO-8859-1", "UTF-8", $log_text);
}
if ($descMode != 1) {
// check input
require_once $rootpath . 'lib/class.inputfilter.php';
$myFilter = new InputFilter($allowedtags, $allowedattr, 0, 0, 1);
$log_text = $myFilter->process($log_text);
} else {
// escape text
//if( $all_ok )
$log_text = nl2br(htmlspecialchars($log_text, ENT_COMPAT, 'UTF-8'));
//else
//$log_text = strip_tags(htmlspecialchars($log_text, ENT_COMPAT, 'UTF-8'));
}
//setting tpl messages if they should be not visible.
tpl_set_var('lat_message', '');
tpl_set_var('lon_message', '');
//validate data
if (is_numeric($log_date_month) && is_numeric($log_date_day) && is_numeric($log_date_year) && is_numeric($log_date_hour) && is_numeric($log_date_min)) {
$date_not_ok = checkdate($log_date_month, $log_date_day, $log_date_year) == false || $log_date_hour < 0 || $log_date_hour > 23 || $log_date_min < 0 || $log_date_min > 60;
if ($date_not_ok == false) {
if (isset($_POST['submitform'])) {
示例10: extRedirect
/**
* Utility function redirect the browser location to another url
*
* Can optionally provide a message.
* @param string The file system path
* @param string A filter for the names
*/
function extRedirect($url, $msg = '')
{
global $mainframe;
// specific filters
$iFilter = new InputFilter();
$url = $iFilter->process($url);
if (!empty($msg)) {
$msg = $iFilter->process($msg);
}
if ($iFilter->badAttributeValue(array('href', $url))) {
$url = $GLOBALS['home_dir'];
}
if (trim($msg)) {
if (strpos($url, '?')) {
$url .= '&extmsg=' . urlencode($msg);
} else {
$url .= '?extmsg=' . urlencode($msg);
}
}
if (headers_sent()) {
echo "<script>document.location.href='{$url}';</script>\n";
} else {
@ob_end_clean();
// clear output buffer
header('HTTP/1.1 301 Moved Permanently');
header("Location: " . $url);
}
exit;
}
示例11: cleanHTML
function cleanHTML($text, $allowable_tags = null, $forbidden_attr = null)
{
// INCLUDE FILTER CLASS
if (!class_exists("InputFilter")) {
require SE_ROOT . "/include/class_inputfilter.php";
}
// New method
if (!method_exists('InputFilter', 'safeSQL')) {
return InputFilter::process($text, array('allowedTags' => $allowable_tags, 'forbiddenAttributes' => $forbidden_attr));
} else {
// INSTANTIATE INPUT FILTER CLASS WITH APPROPRIATE TAGS
$xssFilter = new InputFilter(explode(",", str_replace(" ", "", $allowable_tags)), "", 0, 1, 1);
// ADD NECESSARY BLACKLIST ITEMS
for ($i = 0; $i < count($forbidden_attr); $i++) {
$xssFilter->attrBlacklist[] = $forbidden_attr[$i];
}
// RETURN PROCESSED TEXT
return $xssFilter->process($text);
}
}
示例12: urlencode
if ($usr == false) {
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target=' . $target);
} else {
$tplname = 'myroutes';
$user_id = $usr['userid'];
$route_rs = XDb::xSql("SELECT `route_id` ,`description` `desc`, `name`,`radius`,`length`\n FROM `routes` WHERE `user_id`= ?\n ORDER BY `route_id` DESC", $user_id);
if ($routes_record = XDb::xFetchArray($route_rs)) {
$routes .= '<div class="headitems">';
$routes .= '<div style="width:80px;" class="myr">' . tr('route_name') . '</div><div class="ver"> </div><div style="width:295px;" class="myr"> ' . tr('route_desc') . '</div><div class="ver"> </div><div style="width:60px;" class="myr"> ' . tr('radius') . '</div><div class="ver"> </div><div style="width:60px;" class="myr"> ' . tr('length') . '</div><div class="ver"> </div><div style="width:70px;" class="myr"> ' . tr('caches') . '</div><div class="ver"> </div><div style="width:50px;" class="myr">' . tr('edit') . '</div><div class="ver"> </div><div style="width:20px;" class="myr"> ' . tr('delete') . '</div></div>';
do {
$desc = $routes_record['desc'];
if ($desc != '') {
require_once $rootpath . 'lib/class.inputfilter.php';
$myFilter = new InputFilter($allowedtags, $allowedattr, 0, 0, 1);
$desc = $myFilter->process($desc);
}
$routes .= '<div class="listitems">';
// $routes .= '<div style="margin-left:5px;width:75px;" class="myr">'.$routes_record['name']. '</div><div class="ver35"> </div><div style="width:295px;" class="myr">'.nl2br($desc).'</div><div class="ver35"> </div><div style="width:60px;text-align:center;" class="myr">'.$routes_record['radius']. ' km</div><div class="ver35"> </div><div style="width:60px;text-align:center;" class="myr">'.round($routes_record['length'],0). ' km</div><div class="ver35"> </div><div style="width:70px;float:left;text-align:center;"><a class="links" href="myroutes_search.php?routeid='.$routes_record['route_id'].'"><img src="tpl/stdstyle/images/action/16x16-search.png" alt="" title="Search caches along route" /></a></div><div class="ver35"> </div><div style="width:50px;float:left;text-align:center;"><a class="links" href="myroutes_edit.php?routeid='.$routes_record['route_id'].'"><img src="images/actions/edit-16.png" alt="" title="Edit route" /></a></div><div class="ver35"> </div><div style="width:20px;float:left;text-align:center;"><a class="links" href="myroutes_edit.php?routeid='.$routes_record['route_id'].'&delete" onclick="return confirm(\'Czy chcesz usunąć tę trase?\');"><img src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title="Usuń" /></a></div></div>';
$routes .= '<table border="0" class="myr"><tr><td style="margin-left:3px;width:75px;" class="myr">' . $routes_record['name'] . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:297px;" class="myr">' . nl2br($desc) . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:65px;" class="myr">' . $routes_record['radius'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:62px;" class="myr">' . $routes_record['length'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:73px;" class="myr"><a class="links" href="myroutes_search.php?routeid=' . $routes_record['route_id'] . '"><img src="tpl/stdstyle/images/action/16x16-search.png" alt="" title=' . tr("search_caches_along_route") . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:53px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '"><img src="images/actions/edit-16.png" alt="" title=' . tr('edit_route') . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:23px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '&delete" onclick="return confirm(\'' . tr("confirm_remove_route") . '\');"><img style="vertical-align: middle;" src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title=' . tr('delete') . ' /></a></td></tr></table></div>';
} while ($routes_record = XDb::xFetchArray($route_rs));
$routes .= '';
tpl_set_var('content', $routes);
} else {
tpl_set_var('content', "<div class=\"listitems\"><br/><center><span style=\"font-size:140%;font-weight:bold \"> " . tr('no_routes') . "</span><br/><br/></center></div>");
示例13: elseif
$importsurvey .= "<div class='errorheader'>" . $clang->gT("Error") . "</div>\n";
$importsurvey .= $clang->gT("Import failed. You specified an invalid file type.") . "\n";
$importerror = true;
}
} elseif ($action == 'copysurvey') {
$surveyid = sanitize_int($_POST['copysurveylist']);
$exclude = array();
if (get_magic_quotes_gpc()) {
$sNewSurveyName = stripslashes($_POST['copysurveyname']);
} else {
$sNewSurveyName = $_POST['copysurveyname'];
}
require_once "../classes/inputfilter/class.inputfilter_clean.php";
$myFilter = new InputFilter('', '', 1, 1, 1);
if ($filterxsshtml) {
$sNewSurveyName = $myFilter->process($sNewSurveyName);
} else {
$sNewSurveyName = html_entity_decode($sNewSurveyName, ENT_QUOTES, "UTF-8");
}
if (isset($_POST['copysurveyexcludequotas']) && $_POST['copysurveyexcludequotas'] == "on") {
$exclude['quotas'] = true;
}
if (isset($_POST['copysurveyexcludeanswers']) && $_POST['copysurveyexcludeanswers'] == "on") {
$exclude['answers'] = true;
}
if (isset($_POST['copysurveyresetconditions']) && $_POST['copysurveyresetconditions'] == "on") {
$exclude['conditions'] = true;
}
include "export_structure_xml.php";
$copysurveydata = getXMLData($exclude);
}
示例14: inputFilter
/**
* Removes illegal tags and attributes from html input
*/
function inputFilter($html)
{
// Replaced code to fix issue with img tags
jimport('phpinputfilter.inputfilter');
$filter = new InputFilter(array(), array(), 1, 1);
return $filter->process($html);
}
示例15: sprintf
$_SESSION['adminlang'] = $browlang;
} else {
$_SESSION['adminlang'] = $fields['lang'];
}
$clang = new limesurvey_lang($_SESSION['adminlang']);
}
$login = true;
$loginsummary .= "<div class='messagebox ui-corner-all'>\n";
$loginsummary .= "<div class='header ui-widget-header'>" . $clang->gT("Logged in") . "</div>";
$loginsummary .= "<br />" . sprintf($clang->gT("Welcome %s!"), $_SESSION['full_name']) . "<br /> ";
$loginsummary .= "</div>\n";
if (isset($_POST['refererargs']) && $_POST['refererargs'] && strpos($_POST['refererargs'], "action=logout") === FALSE) {
require_once "../classes/inputfilter/class.inputfilter_clean.php";
$myFilter = new InputFilter('', '', 1, 1, 1);
// Prevent XSS attacks
$sRefererArg = $myFilter->process($_POST['refererargs']);
$_SESSION['metaHeader'] = "<meta http-equiv=\"refresh\"" . " content=\"1;URL={$scriptname}?" . $sRefererArg . "\" />";
$loginsummary .= "<p><font size='1'><i>" . $clang->gT("Reloading screen. Please wait.") . "</i></font>\n";
}
$loginsummary .= "<br /><br />\n";
GetSessionUserRights($_SESSION['loginID']);
} else {
$query = fGetLoginAttemptUpdateQry($bLoginAttempted, $sIp);
$result = $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
if ($result) {
// wrong or unknown username
$loginsummary .= "<p>" . $clang->gT("Incorrect username and/or password!") . "<br />";
if ($intNthAttempt + 1 >= $maxLoginAttempt) {
$loginsummary .= sprintf($clang->gT("You have exceeded you maximum login attempts. Please wait %d minutes before trying again"), $timeOutTime / 60) . "<br />";
}
$loginsummary .= "<br /><a href='{$scriptname}'>" . $clang->gT("Continue") . "</a><br /> \n";