本文整理匯總了PHP中InputFilter::xssFilterHard方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputFilter::xssFilterHard方法的具體用法?PHP InputFilter::xssFilterHard怎麽用?PHP InputFilter::xssFilterHard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InputFilter
的用法示例。
在下文中一共展示了InputFilter::xssFilterHard方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run_create_translation
function run_create_translation($args, $opts)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args);
$rootDir = realpath(__DIR__."/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$translation = new Translation();
CLI::logging("Updating labels Mafe ...\n");
foreach ($workspaces as $workspace) {
try {
echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n";
$translation->generateTransaltionMafe($lang);
} catch (Exception $e) {
echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
}
}
CLI::logging("Create successful\n");
}
示例2: dump
/**
* Dump the contents of the file using fpassthru().
*
* @return void
* @throws Exception if no file or contents.
*/
function dump()
{
if (!$this->data) {
// hmmm .. must be a file that needs to read in
if ($this->inFile) {
$fp = @fopen($this->inFile, "rb");
if (!$fp) {
throw new Exception('Unable to open file: ' . $this->inFile);
}
fpassthru($fp);
@fclose($fp);
} else {
throw new Exception('No data to dump');
}
} else {
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docuroot = explode('/', $realdocuroot);
array_pop($docuroot);
$pathhome = implode('/', $docuroot) . '/';
array_pop($docuroot);
$pathTrunk = implode('/', $docuroot) . '/';
require_once $pathTrunk . 'gulliver/system/class.inputfilter.php';
$filter = new InputFilter();
$data = $filter->xssFilterHard($this->data);
echo $data;
}
}
示例3: rangeDownload
function rangeDownload($location, $mimeType)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$location = $filter->xssFilterHard($location, "path");
if (!file_exists($location)) {
header("HTTP/1.0 404 Not Found");
return;
}
$size = filesize($location);
$time = date('r', filemtime($location));
$fm = @fopen($location, 'rb');
if (!$fm) {
header("HTTP/1.0 505 Internal server error");
return;
}
$begin = 0;
$end = $size - 1;
if (isset($_SERVER['HTTP_RANGE'])) {
if (preg_match('/bytes=\\h*(\\d+)-(\\d*)[\\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
$begin = intval($matches[1]);
if (!empty($matches[2])) {
$end = intval($matches[2]);
}
}
}
header('HTTP/1.0 206 Partial Content');
header("Content-Type: {$mimeType}");
header('Cache-Control: public, must-revalidate, max-age=0');
header('Pragma: no-cache');
header('Accept-Ranges: bytes');
header('Content-Length:' . ($end - $begin + 1));
if (isset($_SERVER['HTTP_RANGE'])) {
header("Content-Range: bytes {$begin}-{$end}/{$size}");
}
header("Content-Disposition: inline; filename={$location}");
header("Content-Transfer-Encoding: binary");
header("Last-Modified: {$time}");
$cur = $begin;
fseek($fm, $begin, 0);
while (!feof($fm) && $cur <= $end && connection_status() == 0) {
set_time_limit(0);
print fread($fm, min(1024 * 16, $end - $cur + 1));
$cur += 1024 * 16;
flush();
}
}
示例4: DumpHeaders
function DumpHeaders($filename)
{
global $root_path;
if (!$filename) {
return;
}
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
$isIE = 0;
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false && strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE = 1;
}
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE 6') !== false && strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE6 = 1;
}
$aux = preg_replace('[^-a-zA-Z0-9\\.]', '_', $filename);
$aux = explode('_', $aux);
$downloadName = $aux[count($aux) - 1];
// $downloadName = $filename;
//$downloadName = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename);
if ($isIE && !isset($isIE6)) {
// http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
// Do not have quotes around filename, but that applied to
// "attachment"... does it apply to inline too?
// This combination seems to work mostly. IE 5.5 SP 1 has
// known issues (see the Microsoft Knowledge Base)
header("Content-Disposition: inline; filename={$downloadName}");
// This works for most types, but doesn't work with Word files
header("Content-Type: application/download; name=\"{$downloadName}\"");
//header("Content-Type: $type0/$type1; name=\"$downloadName\"");
//header("Content-Type: application/x-msdownload; name=\"$downloadName\"");
//header("Content-Type: application/octet-stream; name=\"$downloadName\"");
} else {
header("Content-Disposition: attachment; filename=\"{$downloadName}\"");
header("Content-Type: application/octet-stream; name=\"{$downloadName}\"");
}
//$filename = PATH_UPLOAD . "$filename";
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$filename = $filter->xssFilterHard($filename, 'path');
readfile($filename);
}
示例5: soapRequest
/**
* soapRequest
*
* make a SOAP request to Zimbra server, returns the XML
*
* @since version 1.0
* @access public
* @param string $body body of page
* @param boolean $header
* @param boolean $footer
* @return string $response
*/
protected function soapRequest($body, $header = false, $connecting = false)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
if (!$connecting && !$this->_connected) {
throw new Exception('zimbra.class: soapRequest called without a connection to Zimbra server');
}
if ($header == false) {
$header = '<context xmlns="urn:zimbra">
<authToken>' . $this->auth_token . '</authToken>
<sessionId id="' . $this->session_id . '">' . $this->session_id . '</sessionId>
</context>';
}
$soap_message = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>' . $header . '</soap:Header>
<soap:Body>' . $body . '</soap:Body>
</soap:Envelope>';
$this->message('SOAP message:<textarea>' . $soap_message . '</textarea>');
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $soap_message);
$this->_curl = $filter->xssFilterHard($this->_curl, "url");
$response = curl_exec($this->_curl);
if (!$response) {
$this->error = 'ERROR: curl_exec - (' . curl_errno($this->_curl) . ') ' . curl_error($this->_curl);
return false;
} elseif (strpos($response, '<soap:Body><soap:Fault>') !== false) {
$error_code = $this->extractErrorCode($response);
$this->error = 'ERROR: ' . $error_code . ':<textarea>' . $response . '</textarea>';
$this->message($this->error);
$aError = array('error' => $error_code);
return $aError;
//return false;
}
$this->message('SOAP response:<textarea>' . $response . '</textarea><br/><br/>');
$this->_num_soap_calls++;
return $response;
}
示例6: saveDataLicense
public function saveDataLicense($results, $path)
{
try {
//getting info about file
$LicenseUid = G::generateUniqueID();
$LicenseUser = $results['DATA']['FIRST_NAME'] . ' ' . $results['DATA']['LAST_NAME'];
$LicenseStart = $results['DATE']['START'];
$LicenseEnd = $results['DATE']['END'];
$LicenseSpan = $results['DATE']['SPAN'];
$LicenseStatus = $this->lookForStatusLicense();
//we're looking for a status ACTIVE
//getting the content from file
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$path = $filter->xssFilterHard($path, 'path');
$handle = fopen($path, "r");
$contents = fread($handle, filesize($path));
fclose($handle);
$LicenseData = $contents;
$LicensePath = $path;
$LicenseWorkspace = isset($results['DATA']['DOMAIN_WORKSPACE']) ? $results['DATA']['DOMAIN_WORKSPACE'] : '';
$LicenseType = $results['DATA']['TYPE'];
require_once "classes/model/LicenseManager.php";
//if exists the row in the database propel will update it, otherwise will insert.
$tr = LicenseManagerPeer::retrieveByPK($LicenseUid);
if (!(is_object($tr) && get_class($tr) == 'LicenseManager')) {
$tr = new LicenseManager();
}
$tr->setLicenseUid($LicenseUid);
$tr->setLicenseUser($LicenseUser);
$tr->setLicenseStart($LicenseStart);
$tr->setLicenseEnd($LicenseEnd);
$tr->setLicenseSpan($LicenseSpan);
$tr->setLicenseStatus($LicenseStatus);
$tr->setLicenseData($LicenseData);
$tr->setLicensePath($LicensePath);
$tr->setLicenseWorkspace($LicenseWorkspace);
$tr->setLicenseType($LicenseType);
$res = $tr->save();
} catch (Exception $e) {
G::pr($e);
}
}
示例7: addInputDocument
//.........這裏部分代碼省略.........
$strPathName = PATH_DOCUMENT . G::getPathFromUID($applicationUid) . PATH_SEP;
$strFileName = $appDocUid . "_" . $docVersion . "." . $extension;
switch ($option) {
case "xmlform":
G::uploadFile($fileTmpName, $strPathName, $strFileName);
break;
case "file":
$umaskOld = umask(0);
if (!is_dir($strPathName)) {
G::verifyPath($strPathName, true);
}
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$file = $filter->xssFilterHard($file, 'path');
copy($file, $strPathName . $strFileName);
chmod($strPathName . $strFileName, 0666);
umask($umaskOld);
break;
}
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$pluginRegistry = &PMPluginRegistry::getSingleton();
if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $pluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$documentData = new uploadDocumentData(
$applicationUid,
$userUid,
$strPathName . $strFileName,
示例8: header
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$path = PATH_DB;
//using the opendir function
if (!($dir_handle = @opendir(PATH_DB))) {
header("location: /errors/error704.php");
die;
}
G::LoadSystem('inputfilter');
$filter = new InputFilter();
echo "<table class='basicTable' cellpadding='5' cellspacing='0' border='0'>";
echo "<tr class='Record'><td colspan='2' class='formTitle'>Please select a valid workspace to continue</td></tr>";
echo "<tr valign='top'>";
$curPage = getenv("REQUEST_URI");
$curPage = $filter->xssFilterHard($curPage, "url");
//running the while loop
$first = 0;
while ($file = readdir($dir_handle)) {
if (substr($file, 0, 3) == 'db_') {
if ($first == 0) {
echo "<td><table class='Record' ><tr class='formLabel''><td>RBAC built-in workspaces</td></tr>";
$first = 1;
}
$name = substr(substr($file, 0, strlen($file) - 4), 3);
$link = str_replace("/sys/", "/sys{$name}/", $curPage);
echo "<tr><td><li><a href='{$link}'>{$name}</a></td></tr>";
}
}
//closing the directory
closedir($dir_handle);
示例9: log
/**
* Writes $message to the text browser. Also, passes the message
* along to any Log_observer instances that are observing this Log.
*
* @param mixed $message String or object containing the message to log.
* @param string $priority The priority of the message. Valid
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
* @return boolean True on success or false on failure.
* @access public
*/
function log($message, $priority = null)
{
/* If a priority hasn't been specified, use the default value. */
if ($priority === null) {
$priority = $this->_priority;
}
/* Abort early if the priority is above the maximum logging level. */
if (!$this->_isMasked($priority)) {
return false;
}
/* Extract the string representation of the message. */
$message = $this->_extractMessage($message);
/* Build and output the complete log line. */
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docuroot = explode('/', $realdocuroot);
array_pop($docuroot);
$pathhome = implode('/', $docuroot) . '/';
array_pop($docuroot);
$pathTrunk = implode('/', $docuroot) . '/';
require_once $pathTrunk . 'gulliver/system/class.inputfilter.php';
$filter = new InputFilter();
$tag = $filter->xssFilterHard(ucfirst($this->priorityToString($priority)));
echo $this->_error_prepend . '<b>' . $tag . '</b>: ' . nl2br(htmlspecialchars($message)) . $this->_error_append . $this->_linebreak;
/* Notify observers about this log message. */
$this->_announce(array('priority' => $priority, 'message' => $message));
return true;
}
示例10: InputFilter
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
td {font-family: Tahoma, Verdana, sans-serif; font-size: 11px;}
</style>
<?php
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET);
$ARR_MONTHS = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$ARR_WEEKDAYS = array("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa");
$NUM_WEEKSTART = 1;
//day week starts from (normally 0-Su or 1-Mo)
$STR_ICONPATH = '/controls/';
$prevYear = $STR_ICONPATH . 'prev_year.gif';
$prevMonth = $STR_ICONPATH . 'prev.gif';
$nextMonth = $STR_ICONPATH . 'next.gif';
$nextYear = $STR_ICONPATH . 'next_year.gif';
if (isset($_GET['v']) && $_GET['v'] != '') {
$dt_value = $_GET['v'];
$dt_aux = explode('-', $dt_value);
$dt_valueDay = $dt_aux[2];
$dt_valueMonth = $dt_aux[1];
$dt_valueYear = $dt_aux[0];
示例11: deleteSkin
function deleteSkin()
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
try {
$_REQUEST['SKIN_FOLDER_ID'] = $filter->xssFilterHard($_REQUEST['SKIN_FOLDER_ID']);
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED'));
}
if ($_REQUEST['SKIN_FOLDER_ID'] == "classic") {
throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE'));
}
$folderId = $_REQUEST['SKIN_FOLDER_ID'];
if (!is_dir(PATH_CUSTOM_SKINS . $folderId)) {
throw new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS'));
}
//Delete
G::rm_dir(PATH_CUSTOM_SKINS . $folderId);
$response['success'] = true;
$response['message'] = "{$folderId} deleted";
G::auditLog("DeleteSkin", "Skin Name: " . $folderId);
} catch (Exception $e) {
$response['success'] = false;
$response['error'] = $response['message'] = $e->getMessage();
$response = $filter->xssFilterHard($response);
print_r(G::json_encode($response));
}
}
示例12: FieldCondition
$oFieldCondition = new FieldCondition();
$aConditions = $oFieldCondition->getAllByDynUid($DYN_UID);
$dynaform = new dynaform();
$arrayData = array();
$arrayData["PRO_UID"] = $PRO_UID;
$arrayData["DYN_TYPE"] = $DYN_TYPE;
$arrayData["DYN_TITLE"] = $frm["DYN_TITLENEW"];
if (isset($frm["DYN_DESCRIPTIONNEW"])) {
$arrayData["DYN_DESCRIPTION"] = $frm["DYN_DESCRIPTIONNEW"];
}
$aFields = $dynaform->create($arrayData);
$dynUid = $dynaform->getDynUid();
$hd = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.xml', "r");
$hd1 = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.xml', "w");
$templateFilename = PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.html';
$templateFilename = $filter->xssFilterHard($templateFilename, 'path');
// also make a copy of the template file in case that the html edition is enabled
if (file_exists($templateFilename)) {
$templateHd = fopen($templateFilename, "r");
$templateHd1 = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.html', "w");
}
// also copy all the necessarily conditions if there are any
foreach ($aConditions as $condition) {
$condition['FCD_UID'] = G::generateUniqueID();
$condition['FCD_DYN_UID'] = $dynUid;
$oFieldCondition->quickSave($condition);
}
// checks if the physical dynaform file exists and copy the contents
if ($hd) {
while (!feof($hd)) {
$line = fgets($hd, 4096);
示例13: dirPerms
static public function dirPerms($filename, $owner, $group, $perms)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$filename = $filter->xssFilterHard($filename, 'path');
$chown = @chown($filename, $owner);
$chgrp = @chgrp($filename, $group);
$chmod = @chmod($filename, $perms);
if ($chgrp === false || $chmod === false || $chown === false) {
if (strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN') {
exec( 'icacls ' . $filename . ' /grant Administrador:(D,WDAC) /T', $res );
} else {
CLI::logging(CLI::error("Failed to set permissions for $filename") . "\n");
}
}
if (is_dir($filename)) {
foreach (array_merge(glob($filename . "/*"), glob($filename . "/.*")) as $item) {
if (basename($item) == "." || basename($item) == "..") {
continue;
}
workspaceTools::dirPerms($item, $owner, $group, $perms);
}
}
}
示例14: InputFilter
<?php
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$_POST['qs'] = $filter->xssFilterHard($_POST['qs']);
?>
<html>
<style type="text/css">
.Footer .content {
padding :0px !important;
}
*html body {
overflow-y: hidden;
}
</style>
<body onresize="autoResizeScreen()" onload="autoResizeScreen()">
<iframe name="casesFrame" id="casesFrame" src ="../cases/main_init<?php
echo $_POST['qs'];
?>
" width="99%" height="768" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
<script>
if ( document.getElementById('pm_submenu') )
document.getElementById('pm_submenu').style.display = 'none';
document.documentElement.style.overflowY = 'hidden';
var oClientWinSize = getClientWindowSize();
示例15: GET
/**
* GET method handler
*
* @param array parameter passing array
* @return bool true on success
*/
public function GET(&$options)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$options = $filter->xssFilterHard($options);
$paths = $filter->xssFilterHard($this->paths);
$pathClasses = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) {
$fsFile = $pathClasses . $paths[1];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 2 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
header("Content-Length: " . filesize($fsFile));
return true;
}
}
$pathProcesses = PATH_DB . SYS_SYS . PATH_SEP;
if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) {
if (count($paths) == 4 && $paths[2] == 'xmlforms') {
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP;
$fsFile = $pathXmlform . $paths[3];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 4 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
header("Content-Length: " . filesize($fsFile));
return true;
}
}
if (count($paths) == 4 && $paths[2] == 'mailTemplates') {
$pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP . $paths[1] . PATH_SEP;
$fsFile = $pathTemplates . $paths[3];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 4 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
header("Content-Length: " . filesize($fsFile));
return true;
}
}
if (count($paths) == 4 && $paths[2] == 'public_html') {
$pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP;
$fsFile = $pathPublic . $paths[3];
$fsFile = $filter->xssFilterHard($fsFile);
if (count($paths) == 4 && file_exists($fsFile)) {
$content = file_get_contents($fsFile);
$content = $filter->xssFilterHard($content);
print $content;
header("Content-Type: " . mime_content_type($fsFile));
header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT");
header("Content-Length: " . filesize($fsFile));
return true;
}
}
}
print_r($paths);
return true;
if ($options["path"] == '/') {
return $this->getRoot($options);
}
//print_r ($options);
// get absolute fs path to requested resource
$fspath = $this->base . $options["path"];
// sanity check
if (!file_exists($fspath)) {
return false;
}
// is this a collection?
if (is_dir($fspath)) {
return $this->GetDir($fspath, $options);
}
// detect resource type
$options['mimetype'] = $this->_mimetype($fspath);
// detect modification time
// see rfc2518, section 13.7
// some clients seem to treat this as a reverse rule
// requiering a Last-Modified header if the getlastmodified header was set
$options['mtime'] = filemtime($fspath);
// detect resource size
$options['size'] = filesize($fspath);
// no need to check result here, it is handled by the base class
$options['stream'] = fopen($fspath, "r");
return true;
}