本文整理汇总了PHP中escapeString函数的典型用法代码示例。如果您正苦于以下问题:PHP escapeString函数的具体用法?PHP escapeString怎么用?PHP escapeString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escapeString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
if (!$this->bot->isRegistered($target)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.notRegistered'));
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < 500) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
$sql = "SELECT\n\t\t\t\tunregistercode\n\t\t\tFROM\n\t\t\t\tchanserv_channels\n\t\t\tWHERE\n\t\t\t\tchannel = '" . escapeString($target) . "'";
$row = Services::getDB()->getFirstRow($sql);
$code = $row['unregistercode'];
if (isset($messageEx[1])) {
if ($code != trim($messageEx[1])) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.codeWrong', $target));
}
// TODO: Validate unregistercode
$this->bot->unregister($target);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $target));
} else {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.code', $code));
}
}
示例2: updateDatabase
public function updateDatabase($debug = false)
{
$keys = array();
$values = array();
$query = '';
if ($this->ID == null) {
foreach ($this->_Params as $key => $propertie) {
if ($this->{$propertie} != null) {
$keys[] = '`' . $key . '`';
$values[] = "'" . escapeString($this->{$propertie}) . "'";
}
}
$query = "INSERT INTO `" . $this->getDBName() . "` (" . implode(', ', $keys) . ") VALUES (" . implode(', ', $values) . ")";
Framework::getDb()->query($query);
if (($lastID = Framework::getDb()->getLastID()) != 0) {
$this->ID = $lastID;
}
} else {
foreach ($this->_Params as $key => $propertie) {
if ($key != 'id') {
$values[] = "`" . $key . "` = '" . escapeString($this->{$propertie}) . "'";
}
}
$query = "UPDATE `" . $this->getDBName() . "` SET " . implode(', ', $values) . " WHERE `id` = '" . escapeString($this->ID) . "'";
if ($debug == true) {
echo '<pre>';
//print_r($this);
echo '<strong>Query</strong>: ' . $query . '<br />';
echo '</pre>';
}
Framework::getDb()->query($query);
}
return true;
}
示例3: update
/**
* Updates the data in our database table
*/
public function update()
{
$updateSQL = '';
$updateSQL .= '`authorID` = ' . $this->authorID;
if (!empty($this->authorName)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`authorName` = \'' . escapeString($this->authorName) . '\'';
}
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`serverID` = ' . $this->serverID . '';
if (!empty($this->serverName)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`serverName` = \'' . escapeString($this->serverID) . '\'';
}
if (!empty($this->text)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`text` = \'' . escapeString($this->text) . '\'';
}
$updateSQL .= ',`votes` = ' . $this->votes;
$updateSQL .= ',`isDisabled` = ' . $this->isDisabled;
$updateSQL .= ",`enableSmilies` = " . ($this->enableSmilies ? 1 : 0);
$updateSQL .= ",`enableHTML` = " . ($this->enableHTML ? 1 : 0);
$updateSQL .= ",`enableBBCodes` = " . ($this->enableBBCodes ? 1 : 0);
$sql = "UPDATE bash" . BASH_N . "_entry\r\n\t\t\t\tSET\r\n\t\t\t\t\t" . $updateSQL . "\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tentryID = " . $this->entryID;
WCF::getDB()->sendQuery($sql);
}
示例4: update
/**
* Updates the data in our database table
*/
public function update()
{
$updateSQL = '';
if (!empty($this->serverID)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`serverID` = ' . $this->serverID;
}
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`authorID` = ' . $this->authorID;
if (!empty($this->authorName)) {
if (!empty($updateSQL)) {
$updateSQL .= ',';
}
$updateSQL .= '`authorName` = \'' . escapeString($this->authorName) . '\'';
}
$updateSQL .= ',`message` = \'' . escapeString($this->message) . '\'';
$updateSQL .= ",`timestamp` = " . $this->timestamp;
$updateSQL .= ',`enableSmilies` = ' . ($this->enableSmilies ? '1' : '0');
$updateSQL .= ',`enableHtml` = ' . ($this->enableHtml ? '1' : '0');
$updateSQL .= ',`enableBBCodes` = ' . ($this->enableBBCodes ? '1' : '0');
$updateSQL .= ",`isDisabled` = " . $this->isDisabled;
$sql = "UPDATE bash" . BASH_N . "_server_comment\r\n\t\t\t\tSET\r\n\t\t\t\t\t" . $updateSQL . "\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tcommentID = " . $this->commentID;
WCF::getDB()->sendQuery($sql);
}
示例5: __construct
/**
* @see WCF::__construct()
*/
public function __construct()
{
// include options before locking
try {
$this->initOptions();
} catch (Exception $e) {
// ignore ...
}
// check locking
$userID = @intval($_COOKIE[COOKIE_PREFIX . 'userID']);
if ($userID) {
$i = 0;
do {
try {
LWUtil::checkLock($userID);
// everything okay
break;
} catch (SystemException $e) {
if ($i >= 6) {
die($e->getMessage());
}
++$i;
usleep(500000);
}
} while (true);
}
// bugfix
if (WCF::getDB() !== null) {
return false;
}
parent::__construct();
// game-frontend only
if ($this->getUser()->userID == 0) {
return;
}
$args = array_merge($_GET, $_POST);
if (isset($args['password'])) {
unset($args['password']);
}
// log request
$sql = "INSERT INTO ugml_request\r\n\t\t\t\t(userID, `time`, ip,\r\n\t\t\t\t data)\r\n\t\t\t\tVALUES\r\n\t\t\t\t(" . $this->getUser()->userID . ", " . TIME_NOW . ", INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "'),\r\n\t\t\t\t '" . escapeString(SerializeUtil::serialize(array('page' => LWUtil::getFileName(), 'args' => $args))) . "')";
WCF::getDB()->sendQuery($sql);
self::$requestID = WCF::getDB()->getInsertID();
if ($this->getUser()->lastLoginTime < TIME_NOW - 60 * 60 * 12 && $this->getUser()->lastLoginTime > 1188597600 && !defined('LOGIN')) {
self::logout('index.htm');
}
if ($this->getUser()) {
if ($this->getUser()->urlaubs_modus == 2) {
$sql = "UPDATE ugml_users\r\n\t\t\t\t\t\tSET urlaubs_modus = 0\r\n\t\t\t\t\t\tWHERE id = " . $this->getUser()->userID;
WCF::getDB()->sendQuery($sql);
Session::resetSessions($this->getUser()->userID);
$this->getUser()->urlaubs_modus = 0;
}
}
$this->initPlanet();
// detect bots
/*require_once(LW_DIR.'lib/data/protection/BotDetector.class.php');
new BotDetector();*/
$this->initSpec();
}
示例6: __construct
/**
* Reads a host row from database
* @param integer $hostID
* @param array $row
* @param string $host
*/
public function __construct($hostID, $row = null, $host = null, $languageCode = null)
{
$this->sqlSelects .= 'host.*';
// create sql conditions
$sqlCondition = '';
if ($hostID !== null) {
$sqlCondition .= "host.hostID = " . $hostID;
}
if ($host !== null) {
if (!empty($sqlCondition)) {
$sqlCondition .= " AND ";
}
$sqlCondition .= "host.hostname = '" . escapeString($host) . "'";
}
if ($languageCode !== null) {
if (!empty($sqlCondition)) {
$sqlCondition .= " AND ";
}
$sqlCondition .= "host.languageCode = '" . escapeString($languageCode) . "'";
}
// execute sql statement
if (!empty($sqlCondition)) {
$sql = "SELECT \t" . $this->sqlSelects . "\r\n\t\t\t\tFROM \twcf" . WCF_N . "_host host\r\n\t\t\t\t\t" . $this->sqlJoins . "\r\n\t\t\t\tWHERE \t" . $sqlCondition . $this->sqlGroupBy;
$row = WCF::getDB()->getFirstRow($sql);
}
// handle result set
parent::__construct($row);
}
示例7: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if ($eventObj->poll->messageType == 'post') {
// check permissions
require_once WBB_DIR . 'lib/data/post/Post.class.php';
$post = new Post($eventObj->poll->messageID);
if (!$post->postID) {
throw new IllegalLinkException();
}
require_once WBB_DIR . 'lib/data/thread/Thread.class.php';
$thread = new Thread($post->threadID);
$thread->enter();
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$board = new Board($thread->boardID);
$eventObj->canVotePoll = $board->getPermission('canVotePoll');
// plug in breadcrumbs
WCF::getTPL()->assign(array('board' => $board, 'thread' => $thread, 'showThread' => true));
WCF::getTPL()->append('specialBreadCrumbs', WCF::getTPL()->fetch('navigation'));
// get other polls from this thread
if ($thread->polls > 1) {
require_once WCF_DIR . 'lib/data/message/poll/Poll.class.php';
$polls = array();
$sql = "SELECT \t\tpoll_vote.pollID AS voted,\n\t\t\t\t\t\t\tpoll_vote.isChangeable,\n\t\t\t\t\t\t\tpoll.*\n\t\t\t\t\tFROM \t\twcf" . WCF_N . "_poll poll\n\t\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_poll_vote poll_vote\n\t\t\t\t\tON \t\t(poll_vote.pollID = poll.pollID\n\t\t\t\t\t\t\t" . (!WCF::getUser()->userID ? "AND poll_vote.ipAddress = '" . escapeString(WCF::getSession()->ipAddress) . "'" : '') . "\n\t\t\t\t\t\t\tAND poll_vote.userID = " . WCF::getUser()->userID . ")\n\t\t\t\t\tWHERE \t\tpoll.pollID IN (\n\t\t\t\t\t\t\t\tSELECT\tpollID\n\t\t\t\t\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\t\t\t\t\tWHERE\tthreadID = " . $thread->threadID . "\n\t\t\t\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t\t\t\t\t\tAND pollID <> 0\n\t\t\t\t\t\t\t)\n\t\t\t\t\tORDER BY\tpoll.question";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$polls[] = new Poll(null, $row, $eventObj->canVotePoll);
}
if (count($polls) > 1) {
WCF::getTPL()->assign(array('polls' => $polls, 'pollID' => $eventObj->pollID));
WCF::getTPL()->append('additionalSidebarContent', WCF::getTPL()->fetch('pollOverviewSidebar'));
}
}
}
}
示例8: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, $this->originalName)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 1) {
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\tchanserv_channel_accessLevel\n\t\t\t\tWHERE\n\t\t\t\t\tchannel = '" . escapeString($target) . "'\n\t\t\t\tORDER BY \n\t\t\t\t\taccessLevel DESC";
$result = Services::getDB()->sendQuery($sql);
while ($row = Services::getDB()->fetchArray($result)) {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.' . $row['function']) . ': ' . $row['accessLevel']);
}
} else {
if (count($messageEx) == 3) {
if ($access < $messageEx[2]) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.tooHigh'));
}
if (!$this->bot->getNeededAccess($target, $messageEx[1])) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.unknown'));
}
$sql = "UPDATE\n\t\t\t\t\t\tchanserv_channel_accessLevel\n\t\t\t\t\tSET\n\t\t\t\t\t\taccessLevel = " . $messageEx[2] . "\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tfunction = '" . escapeString($messageEx[1]) . "'";
Services::getDB()->sendQuery($sql);
} else {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
}
示例9: save
/**
* Saves options.
*
* @param array $options
*/
public static function save($options)
{
foreach ($options as $optionID => $optionValue) {
$sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\tSET\toptionValue = '" . escapeString($optionValue) . "'\n\t\t\t\tWHERE\toptionID = " . $optionID;
WCF::getDB()->sendQuery($sql);
}
}
示例10: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (WCF::getUser()->userID && WCF::getUser()->getPermission('admin.general.canUseAcp') && !defined(get_class($eventObj) . '::DO_NOT_LOG')) {
// try to find existing session log
$sql = "SELECT\tsessionLogID\n\t\t\t\tFROM\twcf" . WCF_N . "_acp_session_log\n\t\t\t\tWHERE\tsessionID = '" . WCF::getSession()->sessionID . "'\n\t\t\t\t\tAND lastActivityTime >= " . (TIME_NOW - SESSION_TIMEOUT);
$row = WCF::getDB()->getFirstRow($sql);
if (!empty($row['sessionLogID'])) {
$sessionLogID = $row['sessionLogID'];
// update session log
$sql = "UPDATE\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\tSET\tlastActivityTime = " . TIME_NOW . "\n\t\t\t\t\tWHERE\tsessionLogID = " . $sessionLogID;
WCF::getDB()->registerShutdownUpdate($sql);
} else {
// create new session log
$sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\t\t\t(sessionID, userID, ipAddress, hostname, userAgent, time, lastActivityTime)\n\t\t\t\t\tVALUES\t\t('" . WCF::getSession()->sessionID . "', " . WCF::getUser()->userID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', '" . escapeString(@gethostbyaddr(WCF::getSession()->ipAddress)) . "', '" . escapeString(WCF::getSession()->userAgent) . "', " . TIME_NOW . ", " . TIME_NOW . ")";
WCF::getDB()->sendQuery($sql);
$sessionLogID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_acp_session_log", 'sessionLogID');
}
// format request uri
$requestURI = WCF::getSession()->requestURI;
// remove directories
$URIComponents = explode('/', $requestURI);
$requestURI = array_pop($URIComponents);
// remove session url
$requestURI = preg_replace('/(?:\\?|&)s=[a-f0-9]{40}/', '', $requestURI);
// save access
$sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_access_log\n\t\t\t\t\t\t(sessionLogID, packageID, ipAddress, time, requestURI, requestMethod, className)\n\t\t\t\tVALUES\t\t(" . $sessionLogID . ", " . PACKAGE_ID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', " . TIME_NOW . ", '" . escapeString($requestURI) . "', '" . escapeString(WCF::getSession()->requestMethod) . "', '" . escapeString(get_class($eventObj)) . "')";
WCF::getDB()->registerShutdownUpdate($sql);
}
}
示例11: saved
/**
* saves the selected permissions
*/
protected function saved()
{
$sql = "UPDATE \twcf" . WCF_N . "_page_menu_item\n\t\t\tSET\tpermissions = '" . escapeString(implode(',', $this->selectedPermissions)) . "'\n\t\t\tWHERE\tmenuItemID = " . $this->eventObj->pageMenuItem->menuItemID;
WCF::getDB()->sendQuery($sql);
// clear cache
PageMenuItemEditor::clearCache();
}
开发者ID:Fighter456,项目名称:de.fighter456.wcf.pageMenuPermission,代码行数:10,代码来源:PageMenuItemAddFormPermissionListener.class.php
示例12: nettoyage_et_formatage_chaine_description_ics
function nettoyage_et_formatage_chaine_description_ics($chaine)
{
$retour = strip_tags($chaine);
$retour = escapeString($retour);
$retour = preg_replace("/\t/", " ", $retour);
$retour = preg_replace("/\n/", "\\\n", $retour);
}
示例13: save
/**
* @see Form::save()
*/
public function save()
{
parent::save();
// save
$updateOptionValueUpdate = '';
foreach ($this->activeOptions as $option) {
if ($option['defaultValue'] != $option['optionValue']) {
$sql = "UPDATE\twcf" . WCF_N . "_user_option\n\t\t\t\t\tSET\tdefaultValue = '" . escapeString($option['optionValue']) . "'\n\t\t\t\t\tWHERE\toptionID = " . $option['optionID'];
WCF::getDB()->sendQuery($sql);
if (!empty($updateOptionValueUpdate)) {
$updateOptionValueUpdate .= ',';
}
$updateOptionValueUpdate .= 'userOption' . $option['optionID'] . "='" . escapeString($option['optionValue']) . "'";
}
}
// apply to existing users
if ($this->applyChangesToExistingUsers == 1 && !empty($updateOptionValueUpdate)) {
$sql = "UPDATE\twcf" . WCF_N . "_user_option_value\n\t\t\t\tSET\t" . $updateOptionValueUpdate;
WCF::getDB()->sendQuery($sql);
// reset sessions
Session::resetSessions();
}
// reset cache
WCF::getCache()->clearResource($this->cacheName . PACKAGE_ID);
// show success message
WCF::getTPL()->assign('success', true);
}
示例14: __construct
/**
* Gets the main data of the passed user (id, name or whole datablock)
* and pass it over to the "protected function initUser()".
* You can also create an emtpy user object e.g. to search for users.
*
* @param string $userID
* @param array $row
* @param string $username
* @param string $email
*/
public function __construct($userID, $row = null, $username = null, $email = null)
{
// set sql join to user_data table
$this->sqlSelects .= 'user_option.*,';
$this->sqlJoins .= "LEFT JOIN wcf" . WCF_N . "_user_option_value user_option ON (user_option.userID = user.userID)";
// execute sql statement
$sqlCondition = '';
if ($userID !== null) {
$sqlCondition = "user.userID = " . $userID;
} else {
if ($username !== null) {
$sqlCondition = "user.username = '" . escapeString($username) . "'";
} else {
if ($email !== null) {
$sqlCondition = "user.email = '" . escapeString($email) . "'";
}
}
}
if (!empty($sqlCondition)) {
$sql = "SELECT \t" . $this->sqlSelects . "\n\t\t\t\t\tuser.*\n\t\t\t\tFROM \twcf" . WCF_N . "_user user\n\t\t\t\t\t" . $this->sqlJoins . "\n\t\t\t\tWHERE \t" . $sqlCondition . $this->sqlGroupBy;
$row = WCF::getDB()->getFirstRow($sql);
}
// handle result set
parent::__construct($row);
}
示例15: setSetting
/**
* Sets a setting with an identifier and value.
*
* @param int userID
* @param string setting
* @param mixed value
* @param int expire time
*/
public static function setSetting($userID, $setting, $value, $expireTime = 0x7fffffff)
{
$svalue = serialize($value);
$sql = "REPLACE INTO ugml_user_setting\n\t\t\t\t(userID, setting, expireTime, value)\n\t\t\t\tVALUES\n\t\t\t\t(" . $userID . ", '" . escapeString($setting) . "', " . $expireTime . ", '" . escapeString($svalue) . "')";
WCF::getDB()->sendQuery($sql);
self::$settings[$userID][$setting] = $svalue;
Session::resetSessions($userID);
}