本文整理汇总了PHP中_stripslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP _stripslashes函数的具体用法?PHP _stripslashes怎么用?PHP _stripslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_stripslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_highlight
function do_highlight($formatter, $params = array())
{
if (isset($params['value'])) {
$expr = $params['value'];
} else {
if (isset($params['q'])) {
$expr = $params['q'];
}
}
$expr = _stripslashes($expr);
$formatter->send_header('', $params);
$formatter->send_title('', '', $params);
flush();
ob_start();
$formatter->send_page();
flush();
$out = ob_get_contents();
ob_end_clean();
if (isset($expr[0])) {
highlight_repl(null, true);
$highlight = _preg_search_escape($expr);
$out = preg_replace_callback('/((<[^>]*>)|(' . $highlight . '))/i', 'highlight_repl', $out);
echo $out;
} else {
echo $out;
}
$args['editable'] = 1;
$formatter->send_footer($args, $params);
}
示例2: index
public function index()
{
//note 普通的 http 通知方式
if (!defined('IN_UC')) {
error_reporting(0);
set_magic_quotes_runtime(0);
defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
service("Passport");
$_DCACHE = $get = $post = array();
$code = @$_GET['code'];
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
if (MAGIC_QUOTES_GPC) {
$get = _stripslashes($get);
}
$timestamp = time();
if ($timestamp - $get['time'] > 3600) {
exit('Authracation has expiried');
}
if (empty($get)) {
exit('Invalid Request');
}
$action = $get['action'];
require_once DISCUZ_ROOT . './uc_client/lib/xml.class.php';
$post = xml_unserialize(file_get_contents('php://input'));
if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
exit($this->{$get}['action']($get, $post));
} else {
exit(API_RETURN_FAILED);
}
}
}
示例3: do_autosave
function do_autosave($formatter, $options)
{
global $DBInfo;
if (session_id() == '') {
// ip based
if ($DBInfo->user->id == 'Anonymous') {
$myid = md5($_SERVER['REMOTE_ADDR'] . '.' . 'MONIWIKI');
// IP based for Anonymous user XXX
} else {
$myid = md5($DBInfo->user->id . $_SERVER['REMOTE_ADDR'] . '.' . 'MONIWIKI');
}
} else {
if (0) {
if ($_SESSION['_autosave']) {
$myid = $_SESSION['_autosave'];
} else {
$myid = session_id();
$_SESSION['_autosave'] = $myid;
}
} else {
if ($DBInfo->user->id == 'Anonymous') {
$myid = md5($_SERVER['REMOTE_ADDR'] . '.' . 'MONIWIKI');
// IP based for Anonymous user XXX
} else {
$myid = md5($DBInfo->user->id . $_SERVER['REMOTE_ADDR'] . '.' . 'MONIWIKI');
}
}
}
$myid = md5($myid . $formatter->page->name);
if (isset($options['section'])) {
$myid .= '.' . $options['section'];
}
// XXX section support
$save = new Cache_text('autosave');
if (!empty($options['retrive'])) {
$saved = $save->fetch($myid);
$os = rtrim($saved);
$stamp = $save->mtime($myid);
echo $stamp . "\n" . $os;
return true;
} else {
if (!empty($options['remove'])) {
$save->remove($myid);
echo 'true';
return true;
}
}
$savetext = $options['savetext'];
$datestamp = substr($options['datestamp'], 0, 10);
// only 10-digits used
$savetext = preg_replace("/\r\n|\r/", "\n", $savetext);
$savetext = _stripslashes($savetext);
if ($save->exists($myid) and $save->mtime($myid) > $datestamp) {
echo 'false';
return false;
}
$save->update($myid, $savetext);
echo 'true';
return true;
}
示例4: index
function index()
{
/* 只提供普通的http通知方式 */
error_reporting(0);
set_magic_quotes_runtime(0);
$_DCACHE = $get = $post = array();
$code = @$_GET['code'];
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
$get = _stripslashes($get);
$timestamp = time();
if ($timestamp - $get['time'] > 3600) {
exit('Authracation has expiried');
}
if (empty($get)) {
exit('Invalid Request');
}
$action = $get['action'];
include ROOT_PATH . '/uc_client/lib/xml.class.php';
$post = xml_unserialize(file_get_contents('php://input'));
if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
exit($this->{$get}['action']($get, $post));
} else {
exit(API_RETURN_FAILED);
}
}
示例5: _stripslashes
function _stripslashes(&$var)
{
if (is_array($var)) {
foreach ($var as $k => &$v) {
_stripslashes($v);
}
} else {
$var = stripslashes($var);
}
}
示例6: _stripslashes
function _stripslashes($value)
{
if (is_array($value)) {
foreach ($value as $k => $v) {
$value[$k] = _stripslashes($v);
}
return $value;
}
return stripslashes($value);
}
示例7: _stripslashes
function _stripslashes(&$val)
{
if (!is_array($val)) {
return stripslashes($val);
}
foreach ($val as $k => &$v) {
$val[$k] = _stripslashes($v);
}
return $val;
}
示例8: _uc_stripslashes
function _uc_stripslashes($string)
{
if (is_array($string)) {
foreach ($string as $key => $val) {
$string[$key] = _stripslashes($val);
}
} else {
$string = stripslashes($string);
}
return $string;
}
示例9: User_nforge
function User_nforge($id = '')
{
if ($id) {
$this->setID($id);
$u =& user_get_object_by_name($id);
} else {
$u =& user_get_object(user_getid());
if ($u and is_object($u) and !$u->isError()) {
global $DBInfo;
$id = $u->getUnixName();
}
if (!empty($id)) {
$this->setID($id);
$udb = new UserDB($DBInfo);
$tmp = $udb->getUser($id);
// get timezone and make timezone offset
$tz_offset = date('Z');
$update = 0;
if ($tz_offset != $tmp->info['tz_offset']) {
$update = 1;
}
if (!empty($DBInfo->use_homepage_url) and empty($tmp->info['home']) or $update or empty($tmp->info['nick']) or $tmp->info['nick'] != $u->data_array['realname']) {
// register user
$tmp->info['tz_offset'] = $tz_offset;
$tmp->info['nick'] = $u->data_array['realname'];
if (!empty($DBInfo->use_homepage_url)) {
$tmp->info['home'] = util_make_url_u($u->getID(), true);
}
$udb->saveUser($tmp);
}
} else {
$id = 'Anonymous';
$this->setID('Anonymous');
}
}
$this->css = isset($_COOKIE['MONI_CSS']) ? $_COOKIE['MONI_CSS'] : '';
$this->theme = isset($_COOKIE['MONI_THEME']) ? $_COOKIE['MONI_THEME'] : '';
$this->bookmark = isset($_COOKIE['MONI_BOOKMARK']) ? $_COOKIE['MONI_BOOKMARK'] : '';
$this->trail = isset($_COOKIE['MONI_TRAIL']) ? _stripslashes($_COOKIE['MONI_TRAIL']) : '';
$this->tz_offset = isset($_COOKIE['MONI_TZ']) ? _stripslashes($_COOKIE['MONI_TZ']) : '';
$this->nick = isset($_COOKIE['MONI_NICK']) ? _stripslashes($_COOKIE['MONI_NICK']) : '';
if ($this->tz_offset == '') {
$this->tz_offset = date('Z');
}
if (!empty($id) and $id != 'Anonymous') {
global $DBInfo;
$udb = new UserDB($DBInfo);
if (!$udb->_exists($id)) {
$dummy = $udb->saveUser($this);
}
}
}
示例10: Application
/**
* @return Application Application object
* @desc Constructor - set global pathes, error reporting and maximum script execution time; register $_POST, $_GET, $_SESSION variables as $_GLOBALS.
*/
function Application()
{
// set timer ON for global execute time
$GLOBALS['start_time'] = getmicrotime();
// set up global template
$this->global_template = 'global';
// create empty array of app errors
$this->error = array();
// set GET, POST, SSESION variables global & strip slashes
if (is_array($_POST) and sizeof($_POST) > 0) {
foreach ($_POST as $key => $val) {
$val = _stripslashes($val);
$_POST[$key] = $val;
$GLOBALS[$key] = $val;
}
}
if (is_array($_GET) and sizeof($_GET) > 0) {
foreach ($_GET as $key => $val) {
$val = _stripslashes($val);
$_GET[$key] = $val;
$GLOBALS[$key] = $val;
}
}
if (is_array($_SESSION) and sizeof($_SESSION) > 0) {
foreach ($_SESSION as $key => $val) {
$val = _stripslashes($val);
$_SESSION[$key] = $val;
$GLOBALS[$key] = $val;
}
}
//
$this->user = false;
// load CP if needed
if (defined('CP_CLASS') && CP_CLASS == 1) {
$this->load('cp', 'class');
}
// set time limit & error level
error_reporting(ERROR_LEVEL);
set_time_limit(TIME_LIMIT);
// define global tpl path
if (ROOT_PATH != './' && ROOT_PATH != '') {
define('GLOBAL_TPL_PATH', '../' . ROOT_PATH . 'tpl/global/');
} else {
define('GLOBAL_TPL_PATH', 'global/');
}
$this->paging = false;
}
示例11: do_markup
function do_markup($formatter, $options)
{
$formatter->section_edit = 0;
$formatter->sister_on = 0;
$formatter->perma_icon = '';
$formatter->get_javascripts();
// trash default javascripts
//$options['fixpath']=1;
$formatter->send_header("", $options);
$formatter->postfilters = array('fiximgpath');
if (!empty($options['preview'])) {
$formatter->wikimarkup = 2;
} else {
if (empty($options['all'])) {
$formatter->wikimarkup = 1;
}
}
if (!empty($options['value'])) {
$val = _stripslashes($options['value']);
$val = preg_replace('/(\\r\\n|\\n|\\r)/', "\n", $val);
// Win32 fix
$formatter->send_page($val, $options);
} else {
if (isset($options['section'])) {
$formatter->section_edit = 1;
$formatter->sect_num = $options['section'] - 1;
$raw_body = $formatter->page->get_raw_body($options);
$sections = _get_sections($raw_body);
if ($sections[$options['section']]) {
$raw_body = $sections[$options['section']];
$formatter->send_page($raw_body, $options);
}
} else {
$formatter->section_edit = 1;
$formatter->send_page('', $options);
}
#else ignore
}
print $formatter->get_javascripts();
return;
}
示例12: define
define('THINK_PATH', SITE_PATH . '/core/ThinkPHP');
set_magic_quotes_runtime(0);
defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
require_once SITE_PATH . '/config/uc_config.inc.php';
//载入ThinkSNS配置
$tsconfig1 = (require_once SITE_PATH . '/config/config.inc.php');
$tsconfig2 = (require_once SITE_PATH . '/core/OpenSociax/convention.php');
$tsconfig = array_merge($tsconfig2, $tsconfig1);
$cookiepre = $tsconfig['COOKIE_PREFIX'];
$cookiedomain = $tsconfig['COOKIE_DOMAIN'];
$cookiepath = $tsconfig['COOKIE_PATH'];
$_DCACHE = $get = $post = array();
$code = @$_GET['code'];
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
if (MAGIC_QUOTES_GPC) {
$get = _stripslashes($get);
}
//时间戳验证
$timestamp = time();
// if($timestamp - $get['time'] > 3600) {
// exit('Authracation has expiried');
// }
if (empty($get)) {
exit('Invalid Request');
}
$action = $get['action'];
require_once DISCUZ_ROOT . './uc_client/lib/xml.class.php';
$post = xml_unserialize(file_get_contents('php://input'));
// 调试用-写log
// $log_message = "============================ \n "
// .date('Y-m-d H:i:s')." \n ".$_SERVER['REQUEST_URI']
示例13: do_msgfmt
function do_msgfmt($formatter, $options)
{
global $DBInfo;
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !$DBInfo->security->writable($options)) {
$options['title'] = _("Page is not writable");
return do_invalid($formatter, $options);
}
$po = '';
$domain = 'PoHello';
if (isset($options['msgid']) or isset($options['msgstr'])) {
# just check a single msgstr
header("Content-type: text/plain");
$date = date('Y-m-d h:i+0900');
$charset = strtoupper($DBInfo->charset);
if (_stripslashes($options['msgid']) != '""') {
$po = <<<POHEAD
msgid ""
msgstr ""
"Project-Id-Version: {$domain} 1.1\\n"
"POT-Creation-Date: {$date}\\n"
"PO-Revision-Date: {$date}\\n"
"Last-Translator: MoniWiki <nobody@localhost>\\n"
"Language-Team: moniwiki <ko@localhost>\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset={$charset}\\n"
"Content-Transfer-Encoding: 8bit\\n"
#: src/test.c
POHEAD;
}
$po .= 'msgid ' . _stripslashes($options['msgid']) . "\n";
#$msg=preg_replace('/""(?!")/',"\"\n\"",
# _stripslashes($options['msgstr']));
$msg = _stripslashes($options['msgstr']);
$po .= 'msgstr ' . $msg . "\n";
$po .= "\n\n";
$ret = _pocheck($po, 1);
if ($ret == true) {
print "true\n" . $po;
}
return;
}
if ($options['po'] and $options['btn']) {
$formatter->send_header('', $options);
$formatter->send_title(sprintf(_("Translation of %s"), $options['page']), '', $options);
$comment = $options['comment'] ? _stripslashes($options['comment']) : "Translations are updated";
$po = preg_replace("/(\r\n|\r)/", "\n", _stripslashes($options['po']));
$formatter->page->write($po);
$ret = $DBInfo->savePage($formatter->page, $comment, $options);
if ($ret != -1) {
print "<h2>" . _("Translations are successfully updated.") . "</h2>";
} else {
print "<h2>" . _("Fail to save translations.") . "</h2>";
}
$formatter->send_footer('', $options);
return;
}
$msgkeys = array_keys($options);
$msgids = preg_grep('/^msgid-/', $msgkeys);
$msgstrs = preg_grep('/^msgstr-/', $msgkeys);
if (sizeof($msgids) != sizeof($msgstrs)) {
print "Invalid request.";
return;
}
$rawpo = $formatter->page->_get_raw_body();
$lines = explode("\n", $rawpo);
$po = '';
$comment = '';
$msgid = array();
$msgstr = array();
foreach ($lines as $l) {
if ($l[0] != 'm' and !preg_match('/^\\s*"/', $l)) {
if ($msgstr) {
$mid = implode("\n", $msgid);
$id = md5($mid);
$msg = preg_replace("/(\r\n|\r)/", "\n", _stripslashes($options['msgstr-' . $id]));
$sid = md5(rtrim($msg));
if ($options['md5sum-' . $id] and $options['md5sum-' . $id] != $sid) {
$comment = preg_replace('/#, fuzzy\\n/m', '', $comment);
$comment = str_replace(', fuzzy', '', $comment);
}
# fix msgstr
#$msg=preg_replace('/(?!<\\\\)"/','\\"',$msg);
$po .= $comment;
$po .= 'msgid ' . preg_replace('/(\\r\\n|\\r)/', "\n", _stripslashes($options['msgid-' . $id])) . "\n";
$po .= 'msgstr ' . $msg . "\n";
# init
$msgid = array();
$msgstr = array();
$comment = '';
}
if ($l[0] == '#' and $l[1] == ',') {
if ($comment) {
$po .= $comment;
$comment = '';
}
$comment .= $l . "\n";
//.........这里部分代码省略.........
示例14: _CommonFilter
function _CommonFilter($str)
{
$str = str_replace(" ", " ", $str);
$str = preg_replace("/\\\$/", "$", $str);
// $str = preg_replace("/&#([0-9]+);/s", "&#\\1;" , $str );
$str = _stripslashes($str);
// $str = preg_replace( "/\\\(?!&#|\?#)/", "\" , $str );
return $str;
}
示例15: ajax_chat
function ajax_chat($formatter, $options)
{
global $DBInfo;
$user =& $DBInfo->user;
# get cookie
$id = $user->id;
$nic = '';
$udb =& $DBInfo->udb;
if (!empty($options['nic'])) {
if (!$udb->_exists($options['nic'])) {
$nic = ' ' . $options['nic'];
} else {
if ($user->id == 'Anonymous') {
$nic = ' ' . $options['nic'] . '_' . substr(md5($_SERVER['REMOTE_ADDR']), 0, 4);
}
}
}
// %uD55C%uD558
$value = _stripslashes($options['value']);
$value = preg_replace('/%u([a-f0-9]{4})/i', '&#x\\1;', $value);
$nic = preg_replace('/%u([a-f0-9]{4})/i', '&#x\\1;', $nic);
$itemnum = _stripslashes($options['item']);
if ($itemnum > 50 or $itemnum <= 0) {
$itemnum = 20;
}
$room = escapeshellcmd(_stripslashes($options['room']));
if (!file_exists($DBInfo->upload_dir . '/Chat')) {
umask(00);
mkdir($DBInfo->upload_dir . '/Chat', 0777);
umask(022);
}
if ($room == 'chat') {
$log = $DBInfo->upload_dir . '/Chat/default.log';
} else {
$room = substr($room, 4);
$log = $DBInfo->upload_dir . '/Chat/' . $room . '.log';
}
if (!$value) {
if (!file_exists($log)) {
print 'false';
return;
}
$mtime = filemtime($log);
if (empty($options['laststamp']) or $mtime <= $options['laststamp']) {
print 'false';
return;
}
}
$lines = array();
$fp = fopen($log, 'a+');
while (is_resource($fp)) {
fseek($fp, 0, SEEK_END);
if ($value) {
fwrite($fp, time() . "\t" . $user->id . $nic . "\t" . rtrim($value) . "\n");
}
if (($fz = filesize($log)) == 0) {
break;
}
fseek($fp, 0, SEEK_END);
if ($fz < 512) {
fseek($fp, 0);
$ll = rtrim(fread($fp, 512));
$lines = explode("\n", $ll);
break;
}
$a = -1;
$end = 0;
$last = '';
$check = time();
$date_from = $check - 24 * 60 * 60;
// one day
while ($date_from < $check and !feof($fp)) {
$a -= 512;
// if (-$a > $fz) { $a=-$fz; print 'wwwww';}
fseek($fp, $a, SEEK_END);
$l = fread($fp, 512);
while (($p = strrpos($l, "\n")) !== false) {
$line = substr($l, $p + 1) . $last;
$l = substr($l, 0, $p);
$dumm = explode("\t", $line, 2);
$check = $dumm[0];
if ($date_from > $check) {
break;
}
$lines[] = $line;
if (sizeof($lines) >= $itemnum) {
$check = 0;
break;
}
$last = '';
}
$last = $l . $last;
}
fclose($fp);
$lines = array_reverse($lines);
break;
}
$debug = '';
#ob_start();
#print_r($_GET);
//.........这里部分代码省略.........